1
0
Fork 0
owl-admin-starter/public/admin-assets/assets/mpegts-j8jvBExW.js

10 lines
267 KiB
JavaScript
Raw Blame History

import{p as Qt}from"./index-Cks8rTuj.js";function Jt(ze,Je){for(var me=0;me<Je.length;me++){const te=Je[me];if(typeof te!="string"&&!Array.isArray(te)){for(const D in te)if(D!=="default"&&!(D in ze)){const F=Object.getOwnPropertyDescriptor(te,D);F&&Object.defineProperty(ze,D,F.get?F:{enumerable:!0,get:()=>te[D]})}}}return Object.freeze(Object.defineProperty(ze,Symbol.toStringTag,{value:"Module"}))}var vt={exports:{}};(function(ze,Je){(function(me,te){ze.exports=te()})(window,function(){return function(me){var te={};function D(F){if(te[F])return te[F].exports;var M=te[F]={i:F,l:!1,exports:{}};return me[F].call(M.exports,M,M.exports,D),M.l=!0,M.exports}return D.m=me,D.c=te,D.d=function(F,M,p){D.o(F,M)||Object.defineProperty(F,M,{enumerable:!0,get:p})},D.r=function(F){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(F,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(F,"__esModule",{value:!0})},D.t=function(F,M){if(1&M&&(F=D(F)),8&M||4&M&&typeof F=="object"&&F&&F.__esModule)return F;var p=Object.create(null);if(D.r(p),Object.defineProperty(p,"default",{enumerable:!0,value:F}),2&M&&typeof F!="string")for(var v in F)D.d(p,v,(function(S){return F[S]}).bind(null,v));return p},D.n=function(F){var M=F&&F.__esModule?function(){return F.default}:function(){return F};return D.d(M,"a",M),M},D.o=function(F,M){return Object.prototype.hasOwnProperty.call(F,M)},D.p="",D(D.s=20)}([function(me,te,D){var F=D(9),M=D.n(F),p=function(){function v(){}return v.e=function(S,g){S&&!v.FORCE_GLOBAL_TAG||(S=v.GLOBAL_TAG);var T="[".concat(S,"] > ").concat(g);v.ENABLE_CALLBACK&&v.emitter.emit("log","error",T),v.ENABLE_ERROR&&(console.error?console.error(T):console.warn?console.warn(T):console.log(T))},v.i=function(S,g){S&&!v.FORCE_GLOBAL_TAG||(S=v.GLOBAL_TAG);var T="[".concat(S,"] > ").concat(g);v.ENABLE_CALLBACK&&v.emitter.emit("log","info",T),v.ENABLE_INFO&&(console.info?console.info(T):console.log(T))},v.w=function(S,g){S&&!v.FORCE_GLOBAL_TAG||(S=v.GLOBAL_TAG);var T="[".concat(S,"] > ").concat(g);v.ENABLE_CALLBACK&&v.emitter.emit("log","warn",T),v.ENABLE_WARN&&(console.warn?console.warn(T):console.log(T))},v.d=function(S,g){S&&!v.FORCE_GLOBAL_TAG||(S=v.GLOBAL_TAG);var T="[".concat(S,"] > ").concat(g);v.ENABLE_CALLBACK&&v.emitter.emit("log","debug",T),v.ENABLE_DEBUG&&(console.debug?console.debug(T):console.log(T))},v.v=function(S,g){S&&!v.FORCE_GLOBAL_TAG||(S=v.GLOBAL_TAG);var T="[".concat(S,"] > ").concat(g);v.ENABLE_CALLBACK&&v.emitter.emit("log","verbose",T),v.ENABLE_VERBOSE&&console.log(T)},v}();p.GLOBAL_TAG="mpegts.js",p.FORCE_GLOBAL_TAG=!1,p.ENABLE_ERROR=!0,p.ENABLE_INFO=!0,p.ENABLE_WARN=!0,p.ENABLE_DEBUG=!0,p.ENABLE_VERBOSE=!0,p.ENABLE_CALLBACK=!1,p.emitter=new M.a,te.a=p},function(me,te,D){var F;(function(M){M.IO_ERROR="io_error",M.DEMUX_ERROR="demux_error",M.INIT_SEGMENT="init_segment",M.MEDIA_SEGMENT="media_segment",M.LOADING_COMPLETE="loading_complete",M.RECOVERED_EARLY_EOF="recovered_early_eof",M.MEDIA_INFO="media_info",M.METADATA_ARRIVED="metadata_arrived",M.SCRIPTDATA_ARRIVED="scriptdata_arrived",M.TIMED_ID3_METADATA_ARRIVED="timed_id3_metadata_arrived",M.SYNCHRONOUS_KLV_METADATA_ARRIVED="synchronous_klv_metadata_arrived",M.ASYNCHRONOUS_KLV_METADATA_ARRIVED="asynchronous_klv_metadata_arrived",M.SMPTE2038_METADATA_ARRIVED="smpte2038_metadata_arrived",M.SCTE35_METADATA_ARRIVED="scte35_metadata_arrived",M.PES_PRIVATE_DATA_DESCRIPTOR="pes_private_data_descriptor",M.PES_PRIVATE_DATA_ARRIVED="pes_private_data_arrived",M.STATISTICS_INFO="statistics_info",M.RECOMMEND_SEEKPOINT="recommend_seekpoint"})(F||(F={})),te.a=F},function(me,te,D){D.d(te,"c",function(){return M}),D.d(te,"b",function(){return p}),D.d(te,"a",function(){return v});var F=D(3),M={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},p={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},v=function(){function S(g){this._type=g||"undefined",this._status=M.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return S.prototype.destroy=function(){this._status=M.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},S.prototype.isWorking=function(){return this._status===M.kConnecting||this._status===M.kBuffering},Object.defineProperty(S.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(g){this._onContentLengthKnown=g},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(g){this._onURLRedirect=g},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(g){this._onDataArrival=g},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onError",{get:function(){return this._onError},set:function(g){this._onError=g},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onComplete",{get:function(){return this._onComplete},set:function(g){this._onComplete=g},enumerable:!1,configurable:!0}),S.prototype.open=function(g,T){throw new F.c("Unimplemented abstract function!")},S.prototype.abort=function(){throw new F.c("Unimplemented abstract function!")},S}()},function(me,te,D){D.d(te,"d",function(){return p}),D.d(te,"a",function(){return v}),D.d(te,"b",function(){return S}),D.d(te,"c",function(){return g});var F,M=(F=function(T,E){return(F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,B){L.__proto__=B}||function(L,B){for(var w in B)Object.prototype.hasOwnProperty.call(B,w)&&(L[w]=B[w])})(T,E)},function(T,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");function L(){this.constructor=T}F(T,E),T.prototype=E===null?Object.create(E):(L.prototype=E.prototype,new L)}),p=function(){function T(E){this._message=E}return Object.defineProperty(T.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),T.prototype.toString=function(){return this.name+": "+this.message},T}(),v=function(T){function E(L){return T.call(this,L)||this}return M(E,T),Object.defineProperty(E.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),E}(p),S=function(T){function E(L){return T.call(this,L)||this}return M(E,T),Object.defineProperty(E.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),E}(p),g=function(T){function E(L){return T.call(this,L)||this}return M(E,T),Object.defineProperty(E.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),E}(p)},function(me,te,D){var F;(function(M){M.ERROR="error",M.LOADING_COMPLETE="loading_complete",M.RECOVERED_EARLY_EOF="recovered_early_eof",M.MEDIA_INFO="media_info",M.METADATA_ARRIVED="metadata_arrived",M.SCRIPTDATA_ARRIVED="scriptdata_arrived",M.TIMED_ID3_METADATA_ARRIVED="timed_id3_metadata_arrived",M.SYNCHRONOUS_KLV_METADATA_ARRIVED="synchronous_klv_metadata_arrived",M.ASYNCHRONOUS_KLV_METADATA_ARRIVED="asynchronous_klv_metadata_arrived",M.SMPTE2038_METADATA_ARRIVED="smpte2038_metadata_arrived",M.SCTE35_METADATA_ARRIVED="scte35_metadata_arrived",M.PES_PRIVATE_DATA_DESCRIPTOR="pes_private_data_descriptor",M.PES_PRIVATE_DATA_ARRIVED="pes_private_data_arrived",M.STATISTICS_INFO="statistics_info",M.DESTROYING="destroying"})(F||(F={})),te.a=F},function(me,te,D){var F={};(function(){var M=self.navigator.userAgent.toLowerCase(),p=/(edge)\/([\w.]+)/.exec(M)||/(opr)[\/]([\w.]+)/.exec(M)||/(chrome)[ \/]([\w.]+)/.exec(M)||/(iemobile)[\/]([\w.]+)/.exec(M)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(M)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(M)||/(webkit)[ \/]([\w.]+)/.exec(M)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(M)||/(msie) ([\w.]+)/.exec(M)||M.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(M)||M.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(M)||[],v=/(ipad)/.exec(M)||/(ipod)/.exec(M)||/(windows phone)/.exec(M)||/(iphone)/.exec(M)||/(kindle)/.exec(M)||/(android)/.exec(M)||/(windows)/.exec(M)||/(mac)/.exec(M)||/(linux)/.exec(M)||/(cros)/.exec(M)||[],S={browser:p[5]||p[3]||p[1]||"",version:p[2]||p[4]||"0",majorVersion:p[4]||p[2]||"0",platform:v[0]||""},g={};if(S.browser){g[S.browser]=!0;var T=S.majorVersion.split(".");g.version={major:parseInt(S.majorVersion,10),string:S.version},T.length>1&&(g.version.minor=parseInt(T[1],10)),T.length>2&&(g.version.build=parseInt(T[2],10))}S.platform&&(g[S.platform]=!0),(g.chrome||g.opr||g.safari)&&(g.webkit=!0),(g.rv||g.iemobile)&&(g.rv&&delete g.rv,S.browser="msie",g.msie=!0),g.edge&&(delete g.edge,S.browser="msedge",g.msedge=!0),g.opr&&(S.browser="opera",g.opera=!0),g.safari&&g.android&&(S.browser="android",g.android=!0);for(var E in g.name=S.browser,g.platform=S.platform,F)F.hasOwnProperty(E)&&delete F[E];Object.assign(F,g)})(),te.a=F},function(me,te,D){te.a={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},function(me,te,D){var F;(function(M){M.ERROR="error",M.SOURCE_OPEN="source_open",M.UPDATE_END="update_end",M.BUFFER_FULL="buffer_full",M.START_STREAMING="start_streaming",M.END_STREAMING="end_streaming"})(F||(F={})),te.a=F},function(me,te,D){var F=D(9),M=D.n(F),p=D(0),v=function(){function S(){}return Object.defineProperty(S,"forceGlobalTag",{get:function(){return p.a.FORCE_GLOBAL_TAG},set:function(g){p.a.FORCE_GLOBAL_TAG=g,S._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(S,"globalTag",{get:function(){return p.a.GLOBAL_TAG},set:function(g){p.a.GLOBAL_TAG=g,S._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(S,"enableAll",{get:function(){return p.a.ENABLE_VERBOSE&&p.a.ENABLE_DEBUG&&p.a.ENABLE_INFO&&p.a.ENABLE_WARN&&p.a.ENABLE_ERROR},set:function(g){p.a.ENABLE_VERBOSE=g,p.a.ENABLE_DEBUG=g,p.a.ENABLE_INFO=g,p.a.ENABLE_WARN=g,p.a.ENABLE_ERROR=g,S._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(S,"enableDebug",{get:function(){return p.a.ENABLE_DEBUG},set:function(g){p.a.ENABLE_DEBUG=g,S._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(S,"enableVerbose",{get:function(){return p.a.ENABLE_VERBOSE},set:function(g){p.a.ENABLE_VERBOSE=g,S._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(S,"enableInfo",{get:function(){return p.a.ENABLE_INFO},set:function(g){p.a.ENABLE_INFO=g,S._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(S,"enableWarn",{get:function(){return p.a.ENABLE_WARN},set:function(g){p.a.ENABLE_WARN=g,S._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(S,"enableError",{get:function(){return p.a.ENABLE_ERROR},set:function(g){p.a.ENABLE_ERROR=g,S._notifyChange()},enumerable:!1,configurable:!0}),S.getConfig=function(){return{globalTag:p.a.GLOBAL_TAG,forceGlobalTag:p.a.FORCE_GLOBAL_TAG,enableVerbose:p.a.ENABLE_VERBOSE,enableDebug:p.a.ENABLE_DEBUG,enableInfo:p.a.ENABLE_INFO,enableWarn:p.a.ENABLE_WARN,enableError:p.a.ENABLE_ERROR,enableCallback:p.a.ENABLE_CALLBACK}},S.applyConfig=function(g){p.a.GLOBAL_TAG=g.globalTag,p.a.FORCE_GLOBAL_TAG=g.forceGlobalTag,p.a.ENABLE_VERBOSE=g.enableVerbose,p.a.ENABLE_DEBUG=g.enableDebug,p.a.ENABLE_INFO=g.enableInfo,p.a.ENABLE_WARN=g.enableWarn,p.a.ENABLE_ERROR=g.enableError,p.a.ENABLE_CALLBACK=g.enableCallback},S._notifyChange=function(){var g=S.emitter;if(g.listenerCount("change")>0){var T=S.getConfig();g.emit("change",T)}},S.registerListener=function(g){S.emitter.addListener("change",g)},S.removeListener=function(g){S.emitter.removeListener("change",g)},S.addLogListener=function(g){p.a.emitter.addListener("log",g),p.a.emitter.listenerCount("log")>0&&(p.a.ENABLE_CALLBACK=!0,S._notifyChange())},S.removeLogListener=function(g){p.a.emitter.removeListener("log",g),p.a.emitter.listenerCount("log")===0&&(p.a.ENABLE_CALLBACK=!1,S._notifyChange())},S}();v.emitter=new M.a,te.a=v},function(me,te,D){var F,M=typeof Reflect=="object"?Reflect:null,p=M&&typeof M.apply=="function"?M.apply:function(k,q,Q){return Function.prototype.apply.call(k,q,Q)};F=M&&typeof M.ownKeys=="function"?M.ownKeys:Object.getOwnPropertySymbols?function(k){return Object.getOwnPropertyNames(k).concat(Object.getOwnPropertySymbols(k))}:function(k){return Object.getOwnPropertyNames(k)};var v=Number.isNaN||function(k){return k!=k};function S(){S.init.call(this)}me.exports=S,me.exports.once=function(k,q){return new Promise(function(Q,O){function l(d){k.removeListener(q,_),O(d)}function _(){typeof k.removeListener=="function"&&k.removeListener("error",l),Q([].slice.call(arguments))}X(k,q,_,{once:!0}),q!=="error"&&function(d,f,V){typeof d.on=="function"&&X(d,"error",f,V)}(k,l,{once:!0})})},S.EventEmitter=S,S.prototype._events=void 0,S.prototype._eventsCount=0,S.prototype._maxListeners=void 0;var g=10;function T(k){if(typeof k!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof k)}function E(k){return k._maxListeners===void 0?S.defaultMaxListeners:k._maxListeners}function L(k,q,Q,O){var l,_,d,f;if(T(Q),(_=k._events)===void 0?(_=k._events=Object.create(null),k._eventsCount=0):(_.newListener!==void 0&&(k.emit("newListener",q,Q.listener?Q.listener:Q),_=k._events),d=_[q]),d===void 0)d=_[q]=Q,++k._eventsCount;else if(typeof d=="function"?d=_[q]=O?[Q,d]:[d,Q]:O?d.unshift(Q):d.push(Q),(l=E(k))>0&&d.length>l&&!d.warned){d.warned=!0;var V=new Error("Possible EventEmitter memory leak detected. "+d.length+" "+String(q)+" listeners added. Use emitter.setMaxListeners() to increase limit");V.name="MaxListenersExceededWarning",V.emitter=k,V.type=q,V.count=d.length,f=V,console&&console.warn&&console.warn(f)}return k}function B(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function w(k,q,Q){var O={fired:!1,wrapFn:void 0,target:k,type:q,listener:Q},l=B.bind(O);return l.listener=Q,O.wrapFn=l,l}function U(k,q,Q){var O=k._events;if(O===void 0)return[];var l=O[q];return l===void 0?[]:typeof l=="function"?Q?[l.listener||l]:[l]:Q?function(_){for(var d=new Array(_.length),f=0;f<d.length;++f)d[f]=_[f].listener||_[f];return d}(l):P(l,l.length)}function N(k){var q=this._events;if(q!==void 0){var Q=q[k];if(typeof Q=="function")return 1;if(Q!==void 0)return Q.length}return 0}function P(k,q){for(var Q=new Array(q),O=0;O<q;++O)Q[O]=k[O];return Q}function X(k,q,Q,O){if(typeof k.on=="function")O.once?k.once(q,Q):k.on(q,Q);else{if(typeof k.addEventListener!="function")throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof k);k.addEventListener(q,function l(_){O.once&&k.removeEventListener(q,l),Q(_)})}}Object.defineProperty(S,"defaultMaxListeners",{enumerable:!0,get:function(){return g},set:function(k){if(typeof k!="number"||k<0||v(k))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+k+".");g=k}}),S.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},S.prototype.setMaxListeners=function(k){if(typeof k!="number"||k<0||v(k))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+k+".");return this._maxListeners=k,this},S.prototype.getMaxListeners=function(){return E(this)},S.prototype.emit=function(k){for(var q=[],Q=1;Q<arguments.length;Q++)q.push(arguments[Q]);var O=k==="error",l=this._events;if(l!==void 0)O=O&&l.error===void 0;else if(!O)return!1;if(O){var _;if(q.length>0&&(_=q[0]),_ instanceof Error)throw _;var d=new Error("Unhandled error."+(_?" ("+_.message+")":""));throw d.context=_,d}var f=l[k];if(f===void 0)return!1;if(typeof f=="function")p(f,this,q);else{var V=f.length,J=P(f,V);for(Q=0;Q<V;++Q)p(J[Q],this,q)}return!0},S.prototype.addListener=function(k,q){return L(this,k,q,!1)},S.prototype.on=S.prototype.addListener,S.prototype.prependListener=function(k,q){return L(this,k,q,!0)},S.prototype.once=function(k,q){return T(q),this.on(k,w(this,k,q)),this},S.prototype.prependOnceListener=function(k,q){return T(q),this.prependListener(k,w(this,k,q)),this},S.prototype.removeListener=function(k,q){var Q,O,l,_,d;if(T(q),(O=this._events)===void 0)return this;if((Q=O[k])===void 0)return this;if(Q===q||Q.listener===q)--this._eventsCount==0?this._events=Object.create(null):(delete O[k],O.removeListener&&this.emit("removeListener",k,Q.listener||q));else if(typeof Q!="function"){for(l=-1,_=Q.length-1;_>=0;_--)if(Q[_]===q||Q[_].listener===q){d=Q[_].listener,l=_;break}if(l<0)return this;l===0?Q.shift():function(f,V){for(;V+1<f.length;V++)f[V]=f[V+1];f.pop()}(Q,l),Q.length===1&&(O[k]=Q[0]),O.removeListener!==void 0&&this.emit("removeListener",k,d||q)}return this},S.prototype.off=S.prototype.removeListener,S.prototype.removeAllListeners=function(k){var q,Q,O;if((Q=this._events)===void 0)return this;if(Q.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):Q[k]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete Q[k]),this;if(arguments.length===0){var l,_=Object.keys(Q);for(O=0;O<_.length;++O)(l=_[O])!=="removeListener"&&this.removeAllListeners(l);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(q=Q[k])=="function")this.removeListener(k,q);else if(q!==void 0)for(O=q.length-1;O>=0;O--)this.removeListener(k,q[O]);return this},S.prototype.listeners=function(k){return U(this,k,!0)},S.prototype.rawListeners=function(k){return U(this,k,!1)},S.listenerCount=function(k,q){return typeof k.listenerCount=="function"?k.listenerCount(q):N.call(k,q)},S.prototype.listenerCount=N,S.prototype.eventNames=function(){return this._eventsCount>0?F(this._events):[]}},function(me,te,D){D.d(te,"b",function(){return p}),D.d(te,"a",function(){return v});var F=D(2),M=D(6),p={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},v={NETWORK_EXCEPTION:F.b.EXCEPTION,NETWORK_STATUS_CODE_INVALID:F.b.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:F.b.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:F.b.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:M.a.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:M.a.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:M.a.CODEC_UNSUPPORTED}},function(me,te,D){D.d(te,"d",function(){return F}),D.d(te,"b",function(){return M}),D.d(te,"a",function(){return p}),D.d(te,"c",function(){return v});var F=function(S,g,T,E,L){this.dts=S,this.pts=g,this.duration=T,this.originalDts=E,this.isSyncPoint=L,this.fileposition=null},M=function(){function S(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return S.prototype.appendSyncPoint=function(g){g.isSyncPoint=!0,this.syncPoints.push(g)},S}(),p=function(){function S(){this._list=[]}return S.prototype.clear=function(){this._list=[]},S.prototype.appendArray=function(g){var T=this._list;g.length!==0&&(T.length>0&&g[0].originalDts<T[T.length-1].originalDts&&this.clear(),Array.prototype.push.apply(T,g))},S.prototype.getLastSyncPointBeforeDts=function(g){if(this._list.length==0)return null;var T=this._list,E=0,L=T.length-1,B=0,w=0,U=L;for(g<T[0].dts&&(E=0,w=U+1);w<=U;){if((B=w+Math.floor((U-w)/2))===L||g>=T[B].dts&&g<T[B+1].dts){E=B;break}T[B].dts<g?w=B+1:U=B-1}return this._list[E]},S}(),v=function(){function S(g){this._type=g,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(S.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),S.prototype.isEmpty=function(){return this._list.length===0},S.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},S.prototype._searchNearestSegmentBefore=function(g){var T=this._list;if(T.length===0)return-2;var E=T.length-1,L=0,B=0,w=E,U=0;if(g<T[0].originalBeginDts)return U=-1;for(;B<=w;){if((L=B+Math.floor((w-B)/2))===E||g>T[L].lastSample.originalDts&&g<T[L+1].originalBeginDts){U=L;break}T[L].originalBeginDts<g?B=L+1:w=L-1}return U},S.prototype._searchNearestSegmentAfter=function(g){return this._searchNearestSegmentBefore(g)+1},S.prototype.append=function(g){var T=this._list,E=g,L=this._lastAppendLocation,B=0;L!==-1&&L<T.length&&E.originalBeginDts>=T[L].lastSample.originalDts&&(L===T.length-1||L<T.length-1&&E.originalBeginDts<T[L+1].originalBeginDts)?B=L+1:T.length>0&&(B=this._searchNearestSegmentBefore(E.originalBeginDts)+1),this._lastAppendLocation=B,this._list.splice(B,0,E)},S.prototype.getLastSegmentBefore=function(g){var T=this._searchNearestSegmentBefore(g);return T>=0?this._list[T]:null},S.prototype.getLastSampleBefore=function(g){var T=this.getLastSegmentBefore(g);return T!=null?T.lastSample:null},S.prototype.getLastSyncPointBefore=function(g){for(var T=this._searchNearestSegmentBefore(g),E=this._list[T].syncPoints;E.length===0&&T>0;)T--,E=this._list[T].syncPoints;return E.length>0?E[E.length-1]:null},S}()},function(me,te,D){var F=function(){function M(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return M.prototype.isComplete=function(){var p=this.hasAudio===!1||this.hasAudio===!0&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,v=this.hasVideo===!1||this.hasVideo===!0&&this.videoCodec!=null&&this.width!=null&&this.height!=null&&this.fps!=null&&this.profile!=null&&this.level!=null&&this.refFrames!=null&&this.chromaFormat!=null&&this.sarNum!=null&&this.sarDen!=null;return this.mimeType!=null&&p&&v},M.prototype.isSeekable=function(){return this.hasKeyframesIndex===!0},M.prototype.getNearestKeyframe=function(p){if(this.keyframesIndex==null)return null;var v=this.keyframesIndex,S=this._search(v.times,p);return{index:S,milliseconds:v.times[S],fileposition:v.filepositions[S]}},M.prototype._search=function(p,v){var S=0,g=p.length-1,T=0,E=0,L=g;for(v<p[0]&&(S=0,E=L+1);E<=L;){if((T=E+Math.floor((L-E)/2))===g||v>=p[T]&&v<p[T+1]){S=T;break}p[T]<v?E=T+1:L=T-1}return S},M}();te.a=F},function(me,te,D){var F=D(9),M=D.n(F),p=D(0),v=D(5),S=D(12);function g(a,i,t){var e=a;if(i+t<e.length){for(;t--;)if((192&e[++i])!=128)return!1;return!0}return!1}var T,E=function(a){for(var i=[],t=a,e=0,n=a.length;e<n;)if(t[e]<128)i.push(String.fromCharCode(t[e])),++e;else{if(!(t[e]<192)){if(t[e]<224){if(g(t,e,1)&&(o=(31&t[e])<<6|63&t[e+1])>=128){i.push(String.fromCharCode(65535&o)),e+=2;continue}}else if(t[e]<240){if(g(t,e,2)&&(o=(15&t[e])<<12|(63&t[e+1])<<6|63&t[e+2])>=2048&&(63488&o)!=55296){i.push(String.fromCharCode(65535&o)),e+=3;continue}}else if(t[e]<248){var o;if(g(t,e,3)&&(o=(7&t[e])<<18|(63&t[e+1])<<12|(63&t[e+2])<<6|63&t[e+3])>65536&&o<1114112){o-=65536,i.push(String.fromCharCode(o>>>10|55296)),i.push(String.fromCharCode(1023&o|56320)),e+=4;continue}}}i.push("<22>"),++e}return i.join("")},L=D(3),B=(T=new ArrayBuffer(2),new DataView(T).setInt16(0,256,!0),new Int16Array(T)[0]===256),w=function(){function a(){}return a.parseScriptData=function(i,t,e){var n={};try{var o=a.parseValue(i,t,e),r=a.parseValue(i,t+o.size,e-o.size);n[o.data]=r.data}catch(s){p.a.e("AMF",s.toString())}return n},a.parseObject=function(i,t,e){if(e<3)throw new L.a("Data not enough when parse ScriptDataObject");var n=a.parseString(i,t,e),o=a.parseValue(i,t+n.size,e-n.size),r=o.objectEnd;return{data:{name:n.data,value:o.data},size:n.size+o.size,objectEnd:r}},a.parseVariable=function(i,t,e){return a.parseObject(i,t,e)},a.parseString=function(i,t,e){if(e<2)throw new L.a("Data not enough when parse String");var n=new DataView(i,t,e).getUint16(0,!B);return{data:n>0?E(new Uint8Array(i,t+2,n)):"",size:2+n}},a.parseLongString=function(i,t,e){if(e<4)throw new L.a("Data not enough when parse LongString");var n=new DataView(i,t,e).getUint32(0,!B);return{data:n>0?E(new Uint8Array(i,t+4,n)):"",size:4+n}},a.parseDate=function(i,t,e){if(e<10)throw new L.a("Data size invalid when parse Date");var n=new DataView(i,t,e),o=n.getFloat64(0,!B),r=n.getInt16(8,!B);return{data:new Date(o+=60*r*1e3),size:10}},a.parseValue=function(i,t,e){if(e<1)throw new L.a("Data not enough when parse Value");var n,o=new DataView(i,t,e),r=1,s=o.getUint8(0),u=!1;try{switch(s){case 0:n=o.getFloat64(1,!B),r+=8;break;case 1:n=!!o.getUint8(1),r+=1;break;case 2:var h=a.parseString(i,t+1,e-1);n=h.data,r+=h.size;break;case 3:n={};var m=0;for((16777215&o.getUint32(e-4,!B))==9&&(m=3);r<e-4;){var A=a.parseObject(i,t+r,e-r-m);if(A.objectEnd)break;n[A.data.name]=A.data.value,r+=A.size}r<=e-3&&(16777215&o.getUint32(r-1,!B))===9&&(r+=3);break;case 8:for(n={},r+=4,m=0,(16777215&o.getUint32(e-4,!B))==9&&(m=3);r<e-8;){var y=a.parseVariable(i,t+r,e-r-m);if(y.objectEnd)break;n[y.data.name]=y.data.value,r+=y.size}r<=e-3&&(16777215&o.getUint32(r-1,!B))===9&&(r+=3);break;case 9:n=void 0,r=1,u=!0;break;case 10:n=[];var R=o.getUint32(1,!B);r+=4;for(var I=0;I<R;I++){var H=a.parseValue(i,t+r,e-r);n.push(H.data),r+=H.size}break;case 11:var x=a.parseDate(i,t+1,e-1);n=x.data,r+=x.size;break;case 12:var ee=a.parseString(i,t+1,e-1);n=ee.data,r+=ee.size;break;default:r=e,p.a.w("AMF","Unsupported AMF value type "+s)}}catch(Z){p.a.e("AMF",Z.toString())}return{data:n,size:r,objectEnd:u}},a}(),U=function(){function a(i){this.TAG="ExpGolomb",this._buffer=i,this._buffer_index=0,this._total_bytes=i.byteLength,this._total_bits=8*i.byteLength,this._current_word=0,this._current_word_bits_left=0}return a.prototype.destroy=function(){this._buffer=null},a.prototype._fillCurrentWord=function(){var i=this._total_bytes-this._buffer_index;if(i<=0)throw new L.a("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,i),e=new Uint8Array(4);e.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(e.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},a.prototype.readBits=function(i){if(i>32)throw new L.b("ExpGolomb: readBits() bits exceeded max 32bits!");if(i<=this._current_word_bits_left){var t=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t}var e=this._current_word_bits_left?this._current_word:0;e>>>=32-this._current_word_bits_left;var n=i-this._current_word_bits_left;this._fillCurrentWord();var o=Math.min(n,this._current_word_bits_left),r=this._current_word>>>32-o;return this._current_word<<=o,this._current_word_bits_left-=o,e=e<<o|r},a.prototype.readBool=function(){return this.readBits(1)===1},a.prototype.readByte=function(){return this.readBits(8)},a.prototype._skipLeadingZero=function(){var i;for(i=0;i<this._current_word_bits_left;i++)if(this._current_word&2147483648>>>i)return this._current_word<<=i,this._current_word_bits_left-=i,i;return this._fillCurrentWord(),i+this._skipLeadingZero()},a.prototype.readUEG=function(){var i=this._skipLeadingZero();return this.readBits(i+1)-1},a.prototype.readSEG=function(){var i=this.readUEG();return 1&i?i+1>>>1:-1*(i>>>1)},a}(),N=function(){function a(){}return a._ebsp2rbsp=function(i){for(var t=i,e=t.byteLength,n=new Uint8Array(e),o=0,r=0;r<e;r++)r>=2&&t[r]===3&&t[r-1]===0&&t[r-2]===0||(n[o]=t[r],o++);return new Uint8Array(n.buffer,0,o)},a.parseSPS=function(i){for(var t=i.subarray(1,4),e="avc1.",n=0;n<3;n++){var o=t[n].toString(16);o.length<2&&(o="0"+o),e+=o}var r=a._ebsp2rbsp(i),s=new U(r);s.readByte();var u=s.readByte();s.readByte();var h=s.readByte();s.readUEG();var m=a.getProfileString(u),A=a.getLevelString(h),y=1,R=420,I=8,H=8;if((u===100||u===110||u===122||u===244||u===44||u===83||u===86||u===118||u===128||u===138||u===144)&&((y=s.readUEG())===3&&s.readBits(1),y<=3&&(R=[0,420,422,444][y]),I=s.readUEG()+8,H=s.readUEG()+8,s.readBits(1),s.readBool()))for(var x=y!==3?8:12,ee=0;ee<x;ee++)s.readBool()&&(ee<6?a._skipScalingList(s,16):a._skipScalingList(s,64));s.readUEG();var Z=s.readUEG();if(Z===0)s.readUEG();else if(Z===1){s.readBits(1),s.readSEG(),s.readSEG();var Y=s.readUEG();for(ee=0;ee<Y;ee++)s.readSEG()}var re=s.readUEG();s.readBits(1);var fe=s.readUEG(),$=s.readUEG(),ae=s.readBits(1);ae===0&&s.readBits(1),s.readBits(1);var pe=0,oe=0,le=0,Se=0;s.readBool()&&(pe=s.readUEG(),oe=s.readUEG(),le=s.readUEG(),Se=s.readUEG());var Ae=1,ue=1,ge=0,Re=!0,Le=0,xe=0;if(s.readBool()){if(s.readBool()){var De=s.readByte();De>0&&De<16?(Ae=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][De-1],ue=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][De-1]):De===255&&(Ae=s.readByte()<<8|s.readByte(),ue=s.readByte()<<8|s.readByte())}if(s.readBool()&&s.readBool(),s.readBool()&&(s.readBits(4),s.readBool()&&s.readBits(24)),s.readBool()&&(s.readUEG(),s.readUEG()),s.readBool()){var Pe=s.readBits(32),Be=s.readBits(32);Re=s.readBool(),ge=(Le=Be)/(xe=2*Pe)}}var Oe=1;Ae===1&&ue===1||(Oe=Ae/ue);var Ie=0,be=0;y===0?(Ie=1,be=2-ae):(Ie=y===3?1:2,be=(y===1?2:1)*(2-ae));var Ve=16*(fe+1),Fe=16*($+1)*(2-ae);Ve-=(pe+oe)*Ie,Fe-=(le+Se)*be;var Xe=Math.ceil(Ve*Oe);return s.destroy(),s=null,{codec_mimetype:e,profile_idc:u,level_idc:h,profile_string:m,level_string:A,chroma_format_idc:y,bit_depth:I,bit_depth_luma:I,bit_depth_chroma:H,ref_frames:re,chroma_format:R,chroma_format_string:a.getChromaFormatString(R),frame_rate:{fixed:Re,fps:ge,fps_den:xe,fps_num:Le},sar_ratio:{width:Ae,height:ue},codec_size:{width:Ve,height:Fe},present_size:{width:Xe,height:Fe}}},a._skipScalingList=function(i,t){for(var e=8,n=8,o=0;o<t;o++)n!==0&&(n=(e+i.readSEG()+256)%256),e=n===0?e:n},a.getProfileString=function(i){switch(i){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}},a.getLevelString=function(i){return(i/10).toFixed(1)},a.getChromaFormatString=function(i){switch(i){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}},a}(),P=D(6),X=function(){function a(){}return a._ebsp2rbsp=function(i){for(var t=i,e=t.byteLength,n=new Uint8Array(e),o=0,r=0;r<e;r++)r>=2&&t[r]===3&&t[r-1]===0&&t[r-2]===0||(n[o]=t[r],o++);return new Uint8Array(n.buffer,0,o)},a.parseVPS=function(i){var t=a._ebsp2rbsp(i),e=new U(t);return e.readByte(),e.readByte(),e.readBits(4),e.readBits(2),e.readBits(6),{num_temporal_layers:e.readBits(3)+1,temporal_id_nested:e.readBool()}},a.parseSPS=function(i){var t=a._ebsp2rbsp(i),e=new U(t);e.readByte(),e.readByte();for(var n=0,o=0,r=0,s=0,u=(e.readBits(4),e.readBits(3)),h=(e.readBool(),e.readBits(2)),m=e.readBool(),A=e.readBits(5),y=e.readByte(),R=e.readByte(),I=e.readByte(),H=e.readByte(),x=e.readByte(),ee=e.readByte(),Z=e.readByte(),Y=e.readByte(),re=e.readByte(),fe=e.readByte(),$=e.readByte(),ae=[],pe=[],oe=0;oe<u;oe++)ae.push(e.readBool()),pe.push(e.readBool());if(u>0)for(oe=u;oe<8;oe++)e.readBits(2);for(oe=0;oe<u;oe++)ae[oe]&&(e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte(),e.readByte()),pe[oe]&&e.readByte();e.readUEG();var le=e.readUEG();le==3&&e.readBits(1);var Se=e.readUEG(),Ae=e.readUEG();e.readBool()&&(n+=e.readUEG(),o+=e.readUEG(),r+=e.readUEG(),s+=e.readUEG());var ue=e.readUEG(),ge=e.readUEG(),Re=e.readUEG();for(oe=e.readBool()?0:u;oe<=u;oe++)e.readUEG(),e.readUEG(),e.readUEG();if(e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readBool()&&e.readBool())for(var Le=0;Le<4;Le++)for(var xe=0;xe<(Le===3?2:6);xe++)if(e.readBool()){var De=Math.min(64,1<<4+(Le<<1));for(Le>1&&e.readSEG(),oe=0;oe<De;oe++)e.readSEG()}else e.readUEG();e.readBool(),e.readBool(),e.readBool()&&(e.readByte(),e.readUEG(),e.readUEG(),e.readBool());var Pe=e.readUEG(),Be=0;for(oe=0;oe<Pe;oe++){var Oe=!1;if(oe!==0&&(Oe=e.readBool()),Oe){oe===Pe&&e.readUEG(),e.readBool(),e.readUEG();for(var Ie=0,be=0;be<=Be;be++){var Ve=e.readBool(),Fe=!1;Ve||(Fe=e.readBool()),(Ve||Fe)&&Ie++}Be=Ie}else{var Xe=e.readUEG(),ct=e.readUEG();for(Be=Xe+ct,be=0;be<Xe;be++)e.readUEG(),e.readBool();for(be=0;be<ct;be++)e.readUEG(),e.readBool()}}if(e.readBool()){var Yt=e.readUEG();for(oe=0;oe<Yt;oe++){for(be=0;be<Re+4;be++)e.readBits(1);e.readBits(1)}}var ht=0,qe=1,Ke=1,lt=!1,et=1,tt=1;if(e.readBool(),e.readBool(),e.readBool()){if(e.readBool()){var We=e.readByte();We>0&&We<=16?(qe=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][We-1],Ke=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][We-1]):We===255&&(qe=e.readBits(16),Ke=e.readBits(16))}if(e.readBool()&&e.readBool(),e.readBool()&&(e.readBits(3),e.readBool(),e.readBool()&&(e.readByte(),e.readByte(),e.readByte())),e.readBool()&&(e.readUEG(),e.readUEG()),e.readBool(),e.readBool(),e.readBool(),e.readBool()&&(e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG()),e.readBool()&&(et=e.readBits(32),tt=e.readBits(32),e.readBool()&&e.readUEG(),e.readBool())){var it=!1,at=!1,Qe=!1;for(it=e.readBool(),at=e.readBool(),(it||at)&&((Qe=e.readBool())&&(e.readByte(),e.readBits(5),e.readBool(),e.readBits(5)),e.readBits(4),e.readBits(4),Qe&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5)),oe=0;oe<=u;oe++){var ut=e.readBool();lt=ut;var ft=!0,nt=1;ut||(ft=e.readBool());var pt=!1;if(ft?e.readUEG():pt=e.readBool(),pt||(nt=e.readUEG()+1),it){for(be=0;be<nt;be++)e.readUEG(),e.readUEG(),Qe&&(e.readUEG(),e.readUEG());e.readBool()}if(at){for(be=0;be<nt;be++)e.readUEG(),e.readUEG(),Qe&&(e.readUEG(),e.readUEG());e.readBool()}}}e.readBool()&&(e.readBool(),e.readBool(),e.readBool(),ht=e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG(),e.readUEG())}e.readBool();var Xt="hvc1.".concat(A,".1.L").concat($,".B0"),mt=Se-(n+o)*(le===1||le===2?2:1),gt=Ae-(r+s)*(le===1?2:1),yt=1;return qe!==1&&Ke!==1&&(yt=qe/Ke),e.destroy(),e=null,{codec_mimetype:Xt,profile_string:a.getProfileString(A),level_string:a.getLevelString($),profile_idc:A,bit_depth:ue+8,ref_frames:1,chroma_format:le,chroma_format_string:a.getChromaFormatString(le),general_level_idc:$,general_profile_space:h,general_tier_flag:m,general_profile_idc:A,general_profile_compatibility_flags_1:y,general_profile_compatibility_flags_2:R,general_profile_compatibility_flags_3:I,general_profile_compatibility_flags_4:H,general_constraint_indicator_flags_1:x,general_constraint_indicator_flags_2:ee,general_constraint_indicator_flags_3:Z,general_constraint_indicator_flags_4:Y,general_constraint_indicator_flags_5:re,general_constraint_indicator_flags_6:fe,min_spatial_segmentation_idc:ht,constant_frame_rate:0,chroma_format_idc:le,bit_depth_luma_minus8:ue,bit_depth_chroma_minus8:ge,frame_rate:{fixed:lt,fps:tt/et,fps_den:et,fps_num:tt},sar_ratio:{width:qe,height:Ke},codec_size:{width:mt,height:gt},present_size:{width:mt*yt,height:gt}}},a.parsePPS=function(i){var t=a._ebsp2rbsp(i),e=new U(t);e.readByte(),e.readByte(),e.readUEG(),e.readUEG(),e.readBool(),e.readBool(),e.readBits(3),e.readBool(),e.readBool(),e.readUEG(),e.readUEG(),e.readSEG(),e.readBool(),e.readBool(),e.readBool()&&e.readUEG(),e.readSEG(),e.readSEG(),e.readBool(),e.readBool(),e.readBool(),e.readBool();var n=e.readBool(),o=e.readBool(),r=1;return o&&n?r=0:o?r=3:n&&(r=2),{parallelismType:r}},a.getChromaFormatString=function(i){switch(i){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}},a.getProfileString=function(i){switch(i){case 1:return"Main";case 2:return"Main10";case 3:return"MainSP";case 4:return"Rext";case 9:return"SCC";default:return"Unknown"}},a.getLevelString=function(i){return(i/30).toFixed(1)},a}();function k(a){return a.byteOffset%2==0&&a.byteLength%2==0}function q(a){return a.byteOffset%4==0&&a.byteLength%4==0}function Q(a,i){for(var t=0;t<a.length;t++)if(a[t]!==i[t])return!1;return!0}var O=function(a,i){return a.byteLength===i.byteLength&&(q(a)&&q(i)?function(t,e){return Q(new Uint32Array(t.buffer,t.byteOffset,t.byteLength/4),new Uint32Array(e.buffer,e.byteOffset,e.byteLength/4))}(a,i):k(a)&&k(i)?function(t,e){return Q(new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2))}(a,i):function(t,e){return Q(t,e)}(a,i))},l=function(){return(l=Object.assign||function(a){for(var i,t=1,e=arguments.length;t<e;t++)for(var n in i=arguments[t])Object.prototype.hasOwnProperty.call(i,n)&&(a[n]=i[n]);return a}).apply(this,arguments)},_=function(){function a(){}return a.parseOBUs=function(i,t){for(var e=0;e<i.byteLength;){var n=e,o=(i[e],(120&i[e])>>3),r=(4&i[e])!=0,s=(2&i[e])!=0;i[e],e+=1,r&&(e+=1);var u=Number.POSITIVE_INFINITY;if(s){u=0;for(var h=0;;h++){var m=i[e++];if(u|=(127&m)<<7*h,(128&m)==0)break}}console.log(o),o===1?t=l(l({},a.parseSeuqneceHeader(i.subarray(e,e+u))),{sequence_header_data:i.subarray(n,e+u)}):(o==3&&t||o==6&&t)&&(t=a.parseOBUFrameHeader(i.subarray(e,e+u),0,0,t)),e+=u}return t},a.parseSeuqneceHeader=function(i){var t=new U(i),e=t.readBits(3),n=(t.readBool(),t.readBool()),o=!0,r=0,s=1,u=void 0,h=[];if(n)h.push({operating_point_idc:0,level:t.readBits(5),tier:0});else{if(t.readBool()){var m=t.readBits(32),A=t.readBits(32),y=t.readBool();if(y){for(var R=0;t.readBits(1)===0;)R+=1;R>=32||(1<<R)-1+t.readBits(R)}(r=A)/(s=m),o=y,t.readBool()&&(t.readBits(5),t.readBits(32),u=t.readBits(5),t.readBits(5))}for(var I=t.readBool(),H=t.readBits(5),x=0;x<=H;x++){var ee=t.readBits(12),Z=t.readBits(5),Y=Z>7?t.readBits(1):0;h.push({operating_point_idc:ee,level:Z,tier:Y}),I&&t.readBool()&&t.readBits(4)}}var re=h[0],fe=re.level,$=re.tier,ae=t.readBits(4),pe=t.readBits(4),oe=t.readBits(ae+1)+1,le=t.readBits(pe+1)+1,Se=!1;n||(Se=t.readBool()),Se&&(t.readBits(4),t.readBits(4)),t.readBool(),t.readBool(),t.readBool();var Ae=!1,ue=2,ge=2,Re=0;n||(t.readBool(),t.readBool(),t.readBool(),t.readBool(),(Ae=t.readBool())&&(t.readBool(),t.readBool()),(ue=t.readBool()?2:t.readBits(1))?ge=t.readBool()?2:t.readBits(1):ge=2,Ae?Re=t.readBits(3)+1:Re=0);var Le=t.readBool(),xe=(t.readBool(),t.readBool(),t.readBool()),De=8;e===2&&xe?De=t.readBool()?12:10:De=xe?10:8;var Pe=!1;e!==1&&(Pe=t.readBool()),t.readBool()&&(t.readBits(8),t.readBits(8),t.readBits(8));var Be=1,Oe=1;return Pe?(t.readBits(1),Be=1,Oe=1):(t.readBits(1),e==0?(Be=1,Oe=1):e==1?(Be=0,Oe=0):De==12?t.readBits(1)&&t.readBits(1):(Be=1,Oe=0),Be&&Oe&&t.readBits(2),t.readBits(1)),t.readBool(),t.destroy(),t=null,{codec_mimetype:"av01.".concat(e,".").concat(a.getLevelString(fe,$),".").concat(De.toString(10).padStart(2,"0")),level:fe,tier:$,level_string:a.getLevelString(fe,$),profile_idc:e,profile_string:"".concat(e),bit_depth:De,ref_frames:1,chroma_format:a.getChromaFormat(Pe,Be,Oe),chroma_format_string:a.getChromaFormatString(Pe,Be,Oe),sequence_header:{frame_id_numbers_present_flag:Se,additional_frame_id_length_minus_1:void 0,delta_frame_id_length_minus_2:void 0,reduced_still_picture_header:n,decoder_model_info_present_flag:!1,operating_points:h,buffer_removal_time_length_minus_1:u,equal_picture_interval:o,seq_force_screen_content_tools:ue,seq_force_integer_mv:ge,enable_order_hint:Ae,order_hint_bits:Re,enable_superres:Le,frame_width_bit:ae+1,frame_height_bit:pe+1,max_frame_width:oe,max_frame_height:le},keyframe:void 0,frame_rate:{fixed:o,fps:r/s,fps_den:s,fps_num:r}}},a.parseOBUFrameHeader=function(i,t,e,n){var o=n.sequence_header,r=new U(i),s=(o.max_frame_width,o.max_frame_height,0);o.frame_id_numbers_present_flag&&(s=o.additional_frame_id_length_minus_1+o.delta_frame_id_length_minus_2+3);var u=0,h=!0,m=!0,A=!1;if(!o.reduced_still_picture_header){if(r.readBool())return n;h=(u=r.readBits(2))===2||u===0,(m=r.readBool())&&o.decoder_model_info_present_flag&&o.equal_picture_interval,m&&r.readBool(),A=!!(u===3||u===0&&m)||r.readBool()}n.keyframe=h,r.readBool();var y=o.seq_force_screen_content_tools;o.seq_force_screen_content_tools===2&&(y=r.readBits(1)),y&&(o.seq_force_integer_mv,o.seq_force_integer_mv==2&&r.readBits(1)),o.frame_id_numbers_present_flag&&r.readBits(s);var R=!1;if(R=u==3||!o.reduced_still_picture_header&&r.readBool(),r.readBits(o.order_hint_bits),h||A||r.readBits(3),o.decoder_model_info_present_flag&&r.readBool()){for(var I=0;I<=o.operating_points_cnt_minus_1;I++)if(o.operating_points[I].decoder_model_present_for_this_op[I]){var H=o.operating_points[I].operating_point_idc;(H===0||H>>t&1&&H>>e+8&1)&&r.readBits(o.buffer_removal_time_length_minus_1+1)}}var x=255;if(u===3||u==0&&m||(x=r.readBits(8)),(h||x!==255)&&A&&o.enable_order_hint)for(var ee=0;ee<8;ee++)r.readBits(o.order_hint_bits);if(h){var Z=a.frameSizeAndRenderSize(r,R,o);n.codec_size={width:Z.FrameWidth,height:Z.FrameHeight},n.present_size={width:Z.RenderWidth,height:Z.RenderHeight},n.sar_ratio={width:Z.RenderWidth/Z.FrameWidth,height:Z.RenderHeight/Z.FrameHeight}}return r.destroy(),r=null,n},a.frameSizeAndRenderSize=function(i,t,e){var n=e.max_frame_width,o=e.max_frame_height;t&&(n=i.readBits(e.frame_width_bit)+1,o=i.readBits(e.frame_height_bit)+1);var r=!1;e.enable_superres&&(r=i.readBool());var s=8;r&&(s=i.readBits(3)+9);var u=n;n=Math.floor((8*u+s/2)/s);var h=u,m=o;if(i.readBool()){var A=i.readBits(16)+1,y=i.readBits(16)+1;h=i.readBits(A)+1,m=i.readBits(y)+1}return{UpscaledWidth:u,FrameWidth:n,FrameHeight:o,RenderWidth:h,RenderHeight:m}},a.getLevelString=function(i,t){return"".concat(i.toString(10).padStart(2,"0")).concat(t===0?"M":"H")},a.getChromaFormat=function(i,t,e){return i?0:t===0&&e===0?3:t===1&&e===0?2:t===1&&e===1?1:Number.NaN},a.getChromaFormatString=function(i,t,e){return i?"4:0:0":t===0&&e===0?"4:4:4":t===1&&e===0?"4:2:2":t===1&&e===1?"4:2:0":"Unknown"},a}(),d,f=function(){function a(i,t){this.TAG="FLVDemuxer",this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=i.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=i.hasAudioTrack,this._hasVideo=i.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new S.a,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256}()}return a.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},a.probe=function(i){var t=new Uint8Array(i);if(t.byteLength<9)return{needMoreData:!0};var e={match:!1};if(t[0]!==70||t[1]!==76||t[2]!==86||t[3]!==1)return e;var n,o,r=(4&t[4])>>>2!=0,s=(1&t[4])!=0,u=(n=t)[o=5]<<24|n[o+1]<<16|n[o+2]<<8|n[o+3];return u<9?e:{match:!0,consumed:u,dataOffset:u,hasAudioTrack:r,hasVideoTrack:s}},a.prototype.bindDataSource=function(i){return i.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(a.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(i){this._onTrackMetadata=i},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(i){this._onMediaInfo=i},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(i){this._onMetaDataArrived=i},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(i){this._onScriptDataArrived=i},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onError",{get:function(){return this._onError},set:function(i){this._onError=i},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(i){this._onDataAvailable=i},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(i){this._timestampBase=i},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"overridedDuration",{get:function(){return this._duration},set:function(i){this._durationOverrided=!0,this._duration=i,this._mediaInfo.duration=i},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"overridedHasAudio",{set:function(i){this._hasAudioFlagOverrided=!0,this._hasAudio=i,this._mediaInfo.hasAudio=i},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"overridedHasVideo",{set:function(i){this._hasVideoFlagOverrided=!0,this._hasVideo=i,this._mediaInfo.hasVideo=i},enumerable:!1,configurable:!0}),a.prototype.resetMediaInfo=function(){this._mediaInfo=new S.a},a.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},a.prototype.parseChunks=function(i,t){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new L.a("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var e=0,n=this._littleEndian;if(t===0){if(!(i.byteLength>13))return 0;e=a.probe(i).dataOffset}for(this._firstParse&&(this._firstParse=!1,t+e!==this._dataOffset&&p.a.w(this.TAG,"First time parsing but chunk byteStart invalid!"),(o=new DataView(i,e)).getUint32(0,!n)!==0&&p.a.w(this.TAG,"PrevTagSize0 !== 0 !!!"),e+=4);e<i.byteLength;){this._dispatch=!0;var o=new DataView(i,e);if(e+11+4>i.byteLength)break;var r=o.getUint8(0),s=16777215&o.getUint32(0,!n);if(e+11+s+4>i.byteLength)break;if(r===8||r===9||r===18){var u=o.getUint8(4),h=o.getUint8(5),m=o.getUint8(6)|h<<8|u<<16|o.getUint8(7)<<24;16777215&o.getUint32(7,!n)&&p.a.w(this.TAG,"Meet tag which has StreamID != 0!");var A=e+11;switch(r){case 8:this._parseAudioData(i,A,s,m);break;case 9:this._parseVideoData(i,A,s,m,t+e);break;case 18:this._parseScriptData(i,A,s)}var y=o.getUint32(11+s,!n);y!==11+s&&p.a.w(this.TAG,"Invalid PrevTagSize ".concat(y)),e+=11+s+4}else p.a.w(this.TAG,"Unsupported tag type ".concat(r,", skipped")),e+=11+s+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),e},a.prototype._parseScriptData=function(i,t,e){var n=w.parseScriptData(i,t,e);if(n.hasOwnProperty("onMetaData")){if(n.onMetaData==null||typeof n.onMetaData!="object")return void p.a.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&p.a.w(this.TAG,"Found another onMetaData tag!"),this._metadata=n;var o=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},o)),typeof o.hasAudio=="boolean"&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=o.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof o.hasVideo=="boolean"&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=o.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof o.audiodatarate=="number"&&(this._mediaInfo.audioDataRate=o.audiodatarate),typeof o.videodatarate=="number"&&(this._mediaInfo.videoDataRate=o.videodatarate),typeof o.width=="number"&&(this._mediaInfo.width=o.width),typeof o.height=="number"&&(this._mediaInfo.height=o.height),typeof o.duration=="number"){if(!this._durationOverrided){var r=Math.floor(o.duration*this._timescale);this._duration=r,this._mediaInfo.duration=r}}else this._mediaInfo.duration=0;if(typeof o.framerate=="number"){var s=Math.floor(1e3*o.framerate);if(s>0){var u=s/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=u,this._referenceFrameRate.fps_num=s,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=u}}if(typeof o.keyframes=="object"){this._mediaInfo.hasKeyframesIndex=!0;var h=o.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(h),o.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=o,p.a.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(n).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},n))},a.prototype._parseKeyframesIndex=function(i){for(var t=[],e=[],n=1;n<i.times.length;n++){var o=this._timestampBase+Math.floor(1e3*i.times[n]);t.push(o),e.push(i.filepositions[n])}return{times:t,filepositions:e}},a.prototype._parseAudioData=function(i,t,e,n){if(e<=1)p.a.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(this._hasAudioFlagOverrided!==!0||this._hasAudio!==!1){this._littleEndian;var o=new DataView(i,t,e).getUint8(0),r=o>>>4;if(r!==9)if(r===2||r===10){var s=0,u=(12&o)>>>2;if(u>=0&&u<=4){s=this._flvSoundRateTable[u];var h=1&o,m=this._audioMetadata,A=this._audioTrack;if(m||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(m=this._audioMetadata={}).type="audio",m.id=A.id,m.timescale=this._timescale,m.duration=this._duration,m.audioSampleRate=s,m.channelCount=h===0?1:2),r===10){var y=this._parseAACAudioData(i,t+1,e-1);if(y==null)return;if(y.packetType===0){if(m.config){if(O(y.data.config,m.config))return;p.a.w(this.TAG,"AudioSpecificConfig has been changed, re-generate initialization segment")}var R=y.data;m.audioSampleRate=R.samplingRate,m.channelCount=R.channelCount,m.codec=R.codec,m.originalCodec=R.originalCodec,m.config=R.config,m.refSampleDuration=1024/m.audioSampleRate*m.timescale,p.a.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",m),(x=this._mediaInfo).audioCodec=m.originalCodec,x.audioSampleRate=m.audioSampleRate,x.audioChannelCount=m.channelCount,x.hasVideo?x.videoCodec!=null&&(x.mimeType='video/x-flv; codecs="'+x.videoCodec+","+x.audioCodec+'"'):x.mimeType='video/x-flv; codecs="'+x.audioCodec+'"',x.isComplete()&&this._onMediaInfo(x)}else if(y.packetType===1){var I=this._timestampBase+n,H={unit:y.data,length:y.data.byteLength,dts:I,pts:I};A.samples.push(H),A.length+=y.data.length}else p.a.e(this.TAG,"Flv: Unsupported AAC data type ".concat(y.packetType))}else if(r===2){if(!m.codec){var x;if((R=this._parseMP3AudioData(i,t+1,e-1,!0))==null)return;m.audioSampleRate=R.samplingRate,m.channelCount=R.channelCount,m.codec=R.codec,m.originalCodec=R.originalCodec,m.refSampleDuration=1152/m.audioSampleRate*m.timescale,p.a.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",m),(x=this._mediaInfo).audioCodec=m.codec,x.audioSampleRate=m.audioSampleRate,x.audioChannelCount=m.channelCount,x.audioDataRate=R.bitRate,x.hasVideo?x.videoCodec!=null&&(x.mimeType='video/x-flv; codecs="'+x.videoCodec+","+x.audioCodec+'"'):x.mimeType='video/x-flv; codecs="'+x.audioCodec+'"',x.isComplete()&&this._onMediaInfo(x)}var ee=this._parseMP3AudioData(i,t+1,e-1,!1);if(ee==null)return;I=this._timestampBase+n;var Z={unit:ee,length:ee.byteLength,dts:I,pts:I};A.samples.push(Z),A.length+=ee.length}}else this._onError(P.a.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+u)}else this._onError(P.a.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+r);else{if(e<=5)return void p.a.w(this.TAG,"Flv: Invalid audio packet, missing AudioFourCC in Ehnanced FLV payload!");var Y=15&o,re=String.fromCharCode.apply(String,new Uint8Array(i,t,e).slice(1,5));switch(re){case"Opus":this._parseOpusAudioPacket(i,t+5,e-5,n,Y);break;case"fLaC":this._parseFlacAudioPacket(i,t+5,e-5,n,Y);break;default:this._onError(P.a.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec: "+re)}}}},a.prototype._parseAACAudioData=function(i,t,e){if(!(e<=1)){var n={},o=new Uint8Array(i,t,e);return n.packetType=o[0],o[0]===0?n.data=this._parseAACAudioSpecificConfig(i,t+1,e-1):n.data=o.subarray(1),n}p.a.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},a.prototype._parseAACAudioSpecificConfig=function(i,t,e){var n,o,r=new Uint8Array(i,t,e),s=null,u=0,h=null;if(u=n=r[0]>>>3,(o=(7&r[0])<<1|r[1]>>>7)<0||o>=this._mpegSamplingRates.length)this._onError(P.a.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var m=this._mpegSamplingRates[o],A=(120&r[1])>>>3;if(!(A<0||A>=8)){u===5&&(h=(7&r[1])<<1|r[2]>>>7,(124&r[2])>>>2);var y=self.navigator.userAgent.toLowerCase();return y.indexOf("firefox")!==-1?o>=6?(u=5,s=new Array(4),h=o-3):(u=2,s=new Array(2),h=o):y.indexOf("android")!==-1?(u=2,s=new Array(2),h=o):(u=5,h=o,s=new Array(4),o>=6?h=o-3:A===1&&(u=2,s=new Array(2),h=o)),s[0]=u<<3,s[0]|=(15&o)>>>1,s[1]=(15&o)<<7,s[1]|=(15&A)<<3,u===5&&(s[1]|=(15&h)>>>1,s[2]=(1&h)<<7,s[2]|=8,s[3]=0),{config:s,samplingRate:m,channelCount:A,codec:"mp4a.40."+u,originalCodec:"mp4a.40."+n}}this._onError(P.a.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},a.prototype._parseMP3AudioData=function(i,t,e,n){if(!(e<4)){this._littleEndian;var o=new Uint8Array(i,t,e),r=null;if(n){if(o[0]!==255)return;var s=o[1]>>>3&3,u=(6&o[1])>>1,h=(240&o[2])>>>4,m=(12&o[2])>>>2,A=(o[3]>>>6&3)!==3?2:1,y=0,R=0;switch(s){case 0:y=this._mpegAudioV25SampleRateTable[m];break;case 2:y=this._mpegAudioV20SampleRateTable[m];break;case 3:y=this._mpegAudioV10SampleRateTable[m]}switch(u){case 1:h<this._mpegAudioL3BitRateTable.length&&(R=this._mpegAudioL3BitRateTable[h]);break;case 2:h<this._mpegAudioL2BitRateTable.length&&(R=this._mpegAudioL2BitRateTable[h]);break;case 3:h<this._mpegAudioL1BitRateTable.length&&(R=this._mpegAudioL1BitRateTable[h])}r={bitRate:R,samplingRate:y,channelCount:A,codec:"mp3",originalCodec:"mp3"}}else r=o;return r}p.a.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},a.prototype._parseOpusAudioPacket=function(i,t,e,n,o){if(o===0)this._parseOpusSequenceHeader(i,t,e);else if(o===1)this._parseOpusAudioData(i,t,e,n);else if(o!==2)return void this._onError(P.a.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(o))},a.prototype._parseOpusSequenceHeader=function(i,t,e){if(e<=16)p.a.w(this.TAG,"Flv: Invalid OpusSequenceHeader, lack of data!");else{var n=this._audioMetadata,o=this._audioTrack;n||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(n=this._audioMetadata={}).type="audio",n.id=o.id,n.timescale=this._timescale,n.duration=this._duration);var r=new DataView(i,t,e);r.setUint8(8,0);var s=r.getUint8(9);r.setUint16(10,r.getUint16(10,!0),!1);var u=r.getUint32(12,!0);r.setUint32(12,r.getUint32(12,!0),!1);var h={config:new Uint8Array(i,t+8,e-8),channelCount:s,samplingFrequence:u,codec:"opus",originalCodec:"opus"};if(n.config){if(O(h.config,n.config))return;p.a.w(this.TAG,"OpusSequenceHeader has been changed, re-generate initialization segment")}n.audioSampleRate=h.samplingFrequence,n.channelCount=h.channelCount,n.codec=h.codec,n.originalCodec=h.originalCodec,n.config=h.config,n.refSampleDuration=20,p.a.v(this.TAG,"Parsed OpusSequenceHeader"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",n);var m=this._mediaInfo;m.audioCodec=n.originalCodec,m.audioSampleRate=n.audioSampleRate,m.audioChannelCount=n.channelCount,m.hasVideo?m.videoCodec!=null&&(m.mimeType='video/x-flv; codecs="'+m.videoCodec+","+m.audioCodec+'"'):m.mimeType='video/x-flv; codecs="'+m.audioCodec+'"',m.isComplete()&&this._onMediaInfo(m)}},a.prototype._parseOpusAudioData=function(i,t,e,n){var o=this._audioTrack,r=new Uint8Array(i,t,e),s=this._timestampBase+n,u={unit:r,length:r.byteLength,dts:s,pts:s};o.samples.push(u),o.length+=r.length},a.prototype._parseFlacAudioPacket=function(i,t,e,n,o){if(o===0)this._parseFlacSequenceHeader(i,t,e);else if(o===1)this._parseFlacAudioData(i,t,e,n);else if(o!==2)return void this._onError(P.a.FORMAT_ERROR,"Flv: Invalid Flac audio packet type ".concat(o))},a.prototype._parseFlacSequenceHeader=function(i,t,e){var n=this._audioMetadata,o=this._audioTrack;n||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(n=this._audioMetadata={}).type="audio",n.id=o.id,n.timescale=this._timescale,n.duration=this._duration);var r=new Uint8Array(i,t+4,e-4),s=new U(r),u=s.readBits(16),h=s.readBits(16),m=h===u?h:null;s.readBits(24),s.readBits(24);var A=s.readBits(20),y=s.readBits(3)+1,R=s.readBits(5)+1;s.destroy();var I=new Uint8Array(r.byteLength+4);I.set(r,4),I[0]=128,I[1]=r.byteLength>>>16&255,I[2]=r.byteLength>>>8&255,I[3]=r.byteLength>>>0&255;var H={config:I,channelCount:y,samplingFrequence:A,sampleSize:R,codec:"flac",originalCodec:"flac"};if(n.config){if(O(H.config,n.config))return;p.a.w(this.TAG,"FlacSequenceHeader has been changed, re-generate initialization segment")}n.audioSampleRate=H.samplingFrequence,n.channelCount=H.channelCount,n.sampleSize=H.sampleSize,n.codec=H.codec,n.originalCodec=H.originalCodec,n.config=H.config,n.refSampleDuration=m!=null?1e3*m/H.samplingFrequence:null,p.a.v(this.TAG,"Parsed FlacSequenceHeader"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",n);var x=this._mediaInfo;x.audioCodec=n.originalCodec,x.audioSampleRate=n.audioSampleRate,x.audioChannelCount=n.channelCount,x.hasVideo?x.videoCodec!=null&&(x.mimeType='video/x-flv; codecs="'+x.videoCodec+","+x.audioCodec+'"'):x.mimeType='video/x-flv; codecs="'+x.audioCodec+'"',x.isComplete()&&this._onMediaInfo(x)},a.prototype._parseFlacAudioData=function(i,t,e,n){var o=this._audioTrack,r=new Uint8Array(i,t,e),s=this._timestampBase+n,u={unit:r,length:r.byteLength,dts:s,pts:s};o.samples.push(u),o.length+=r.length},a.prototype._parseVideoData=function(i,t,e,n,o){if(e<=1)p.a.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(this._hasVideoFlagOverrided!==!0||this._hasVideo!==!1){var r=new Uint8Array(i,t,e)[0],s=(112&r)>>>4;if(128&r){var u=15&r,h=String.fromCharCode.apply(String,new Uint8Array(i,t,e).slice(1,5));if(h==="hvc1")this._parseEnhancedHEVCVideoPacket(i,t+5,e-5,n,o,s,u);else{if(h!=="av01")return void this._onError(P.a.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(h));this._parseEnhancedAV1VideoPacket(i,t+5,e-5,n,o,s,u)}}else{var m=15&r;if(m===7)this._parseAVCVideoPacket(i,t+1,e-1,n,o,s);else{if(m!==12)return void this._onError(P.a.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: ".concat(m));this._parseHEVCVideoPacket(i,t+1,e-1,n,o,s)}}}},a.prototype._parseAVCVideoPacket=function(i,t,e,n,o,r){if(e<4)p.a.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var s=this._littleEndian,u=new DataView(i,t,e),h=u.getUint8(0),m=(16777215&u.getUint32(0,!s))<<8>>8;if(h===0)this._parseAVCDecoderConfigurationRecord(i,t+4,e-4);else if(h===1)this._parseAVCVideoData(i,t+4,e-4,n,o,r,m);else if(h!==2)return void this._onError(P.a.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(h))}},a.prototype._parseHEVCVideoPacket=function(i,t,e,n,o,r){if(e<4)p.a.w(this.TAG,"Flv: Invalid HEVC packet, missing HEVCPacketType or/and CompositionTime");else{var s=this._littleEndian,u=new DataView(i,t,e),h=u.getUint8(0),m=(16777215&u.getUint32(0,!s))<<8>>8;if(h===0)this._parseHEVCDecoderConfigurationRecord(i,t+4,e-4);else if(h===1)this._parseHEVCVideoData(i,t+4,e-4,n,o,r,m);else if(h!==2)return void this._onError(P.a.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(h))}},a.prototype._parseEnhancedHEVCVideoPacket=function(i,t,e,n,o,r,s){var u=this._littleEndian,h=new DataView(i,t,e);if(s===0)this._parseHEVCDecoderConfigurationRecord(i,t,e);else if(s===1){var m=(4294967040&h.getUint32(0,!u))>>8;this._parseHEVCVideoData(i,t+3,e-3,n,o,r,m)}else if(s===3)this._parseHEVCVideoData(i,t,e,n,o,r,0);else if(s!==2)return void this._onError(P.a.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(s))},a.prototype._parseEnhancedAV1VideoPacket=function(i,t,e,n,o,r,s){if(this._littleEndian,s===0)this._parseAV1CodecConfigurationRecord(i,t,e);else if(s===1)this._parseAV1VideoData(i,t,e,n,o,r,0);else{if(s===5)return void this._onError(P.a.FORMAT_ERROR,"Flv: Not Supported MP2T AV1 video packet type ".concat(s));if(s!==2)return void this._onError(P.a.FORMAT_ERROR,"Flv: Invalid video packet type ".concat(s))}},a.prototype._parseAVCDecoderConfigurationRecord=function(i,t,e){if(e<7)p.a.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,o=this._videoTrack,r=this._littleEndian,s=new DataView(i,t,e);if(n){if(n.avcc!==void 0){var u=new Uint8Array(i,t,e);if(O(u,n.avcc))return;p.a.w(this.TAG,"AVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=o.id,n.timescale=this._timescale,n.duration=this._duration;var h=s.getUint8(0),m=s.getUint8(1);if(s.getUint8(2),s.getUint8(3),h===1&&m!==0)if(this._naluLengthSize=1+(3&s.getUint8(4)),this._naluLengthSize===3||this._naluLengthSize===4){var A=31&s.getUint8(5);if(A!==0){A>1&&p.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ".concat(A));for(var y=6,R=0;R<A;R++){var I=s.getUint16(y,!r);if(y+=2,I!==0){var H=new Uint8Array(i,t+y,I);y+=I;var x=N.parseSPS(H);if(R===0){n.codecWidth=x.codec_size.width,n.codecHeight=x.codec_size.height,n.presentWidth=x.present_size.width,n.presentHeight=x.present_size.height,n.profile=x.profile_string,n.level=x.level_string,n.bitDepth=x.bit_depth,n.chromaFormat=x.chroma_format,n.sarRatio=x.sar_ratio,n.frameRate=x.frame_rate,x.frame_rate.fixed!==!1&&x.frame_rate.fps_num!==0&&x.frame_rate.fps_den!==0||(n.frameRate=this._referenceFrameRate);var ee=n.frameRate.fps_den,Z=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(ee/Z);for(var Y=H.subarray(1,4),re="avc1.",fe=0;fe<3;fe++){var $=Y[fe].toString(16);$.length<2&&($="0"+$),re+=$}n.codec=re;var ae=this._mediaInfo;ae.width=n.codecWidth,ae.height=n.codecHeight,ae.fps=n.frameRate.fps,ae.profile=n.profile,ae.level=n.level,ae.refFrames=x.ref_frames,ae.chromaFormat=x.chroma_format_string,ae.sarNum=n.sarRatio.width,ae.sarDen=n.sarRatio.height,ae.videoCodec=re,ae.hasAudio?ae.audioCodec!=null&&(ae.mimeType='video/x-flv; codecs="'+ae.videoCodec+","+ae.audioCodec+'"'):ae.mimeType='video/x-flv; codecs="'+ae.videoCodec+'"',ae.isComplete()&&this._onMediaInfo(ae)}}}var pe=s.getUint8(y);if(pe!==0){for(pe>1&&p.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ".concat(pe)),y++,R=0;R<pe;R++)I=s.getUint16(y,!r),y+=2,I!==0&&(y+=I);n.avcc=new Uint8Array(e),n.avcc.set(new Uint8Array(i,t,e),0),p.a.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",n)}else this._onError(P.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(P.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(P.a.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1));else this._onError(P.a.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}},a.prototype._parseHEVCDecoderConfigurationRecord=function(i,t,e){if(e<22)p.a.w(this.TAG,"Flv: Invalid HEVCDecoderConfigurationRecord, lack of data!");else{var n=this._videoMetadata,o=this._videoTrack,r=this._littleEndian,s=new DataView(i,t,e);if(n){if(n.hvcc!==void 0){var u=new Uint8Array(i,t,e);if(O(u,n.hvcc))return;p.a.w(this.TAG,"HEVCDecoderConfigurationRecord has been changed, re-generate initialization segment")}}else this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=o.id,n.timescale=this._timescale,n.duration=this._duration;var h=s.getUint8(0),m=31&s.getUint8(1);if(h!==0&&h!==1||m===0)this._onError(P.a.FORMAT_ERROR,"Flv: Invalid HEVCDecoderConfigurationRecord");else if(this._naluLengthSize=1+(3&s.getUint8(21)),this._naluLengthSize===3||this._naluLengthSize===4){for(var A=s.getUint8(22),y=0,R=23;y<A;y++){var I=63&s.getUint8(R+0),H=s.getUint16(R+1,!r);R+=3;for(var x=0;x<H;x++){var ee=s.getUint16(R+0,!r);if(x===0)if(I===33){R+=2;var Z=new Uint8Array(i,t+R,ee),Y=X.parseSPS(Z);n.codecWidth=Y.codec_size.width,n.codecHeight=Y.codec_size.height,n.presentWidth=Y.present_size.width,n.presentHeight=Y.present_size.height,n.profile=Y.profile_string,n.level=Y.level_string,n.bitDepth=Y.bit_depth,n.chromaFormat=Y.chroma_format,n.sarRatio=Y.sar_ratio,n.frameRate=Y.frame_rate,Y.frame_rate.fixed!==!1&&Y.frame_rate.fps_num!==0&&Y.frame_rate.fps_den!==0||(n.frameRate=this._referenceFrameRate);var re=n.frameRate.fps_den,fe=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(re/fe),n.codec=Y.codec_mimetype;var $=this._mediaInfo;$.width=n.codecWidth,$.height=n.codecHeight,$.fps=n.frameRate.fps,$.profile=n.profile,$.level=n.level,$.refFrames=Y.ref_frames,$.chromaFormat=Y.chroma_format_string,$.sarNum=n.sarRatio.width,$.sarDen=n.sarRatio.height,$.videoCodec=Y.codec_mimetype,$.hasAudio?$.audioCodec!=null&&($.mimeType='video/x-flv; codecs="'+$.videoCodec+","+$.audioCodec+'"'):$.mimeType='video/x-flv; codecs="'+$.videoCodec+'"',$.isComplete()&&this._onMediaInfo($),R+=ee}else R+=2+ee;else R+=2+ee}}n.hvcc=new Uint8Array(e),n.hvcc.set(new Uint8Array(i,t,e),0),p.a.v(this.TAG,"Parsed HEVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",n)}else this._onError(P.a.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: ".concat(this._naluLengthSize-1))}},a.prototype._parseAV1CodecConfigurationRecord=function(i,t,e){if(e<4)p.a.w(this.TAG,"Flv: Invalid AV1CodecConfigurationRecord, lack of data!");else{var n=this._videoMetadata,o=this._videoTrack,r=(this._littleEndian,new DataView(i,t,e));n?n.av1c!==void 0&&p.a.w(this.TAG,"Found another AV1CodecConfigurationRecord!"):(this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(n=this._videoMetadata={}).type="video",n.id=o.id,n.timescale=this._timescale,n.duration=this._duration);var s=127&r.getUint8(0);if(r.getUint8(1),r.getUint8(1),r.getUint8(2),s===1){var u=_.parseOBUs(new Uint8Array(i,t+4,e-4));if(u!=null){n.profile=u.profile_string,n.level=u.level_string,n.bitDepth=u.bit_depth,n.chromaFormat=u.chroma_format,n.frameRate=u.frame_rate,u.frame_rate.fixed!==!1&&u.frame_rate.fps_num!==0&&u.frame_rate.fps_den!==0||(n.frameRate=this._referenceFrameRate);var h=n.frameRate.fps_den,m=n.frameRate.fps_num;n.refSampleDuration=n.timescale*(h/m),n.codec=u.codec_mimetype,n.extra=u;var A=this._mediaInfo;A.fps=n.frameRate.fps,A.profile=n.profile,A.level=n.level,A.refFrames=u.ref_frames,A.chromaFormat=u.chroma_format_string,A.videoCodec=u.codec_mimetype,A.hasAudio?A.audioCodec!=null&&(A.mimeType='video/x-flv; codecs="'+A.videoCodec+","+A.audioCodec+'"'):A.mimeType='video/x-flv; codecs="'+A.videoCodec+'"',A.isComplete()&&this._onMediaInfo(A),n.av1c=new Uint8Array(e),n.av1c.set(new Uint8Array(i,t,e),0),p.a.v(this.TAG,"Preparing AV1CodecConfigurationRecord")}else this._onError(P.a.FORMAT_ERROR,"Flv: Invalid AV1CodecConfigurationRecord")}else this._onError(P.a.FORMAT_ERROR,"Flv: Invalid AV1CodecConfigurationRecord")}},a.prototype._parseAVCVideoData=function(i,t,e,n,o,r,s){for(var u=this._littleEndian,h=new DataView(i,t,e),m=[],A=0,y=0,R=this._naluLengthSize,I=this._timestampBase+n,H=r===1;y<e;){if(y+4>=e){p.a.w(this.TAG,"Malformed Nalu near timestamp ".concat(I,", offset = ").concat(y,", dataSize = ").concat(e));break}var x=h.getUint32(y,!u);if(R===3&&(x>>>=8),x>e-R)return void p.a.w(this.TAG,"Malformed Nalus near timestamp ".concat(I,", NaluSize > DataSize!"));var ee=31&h.getUint8(y+R);ee===5&&(H=!0);var Z=new Uint8Array(i,t+y,R+x),Y={type:ee,data:Z};m.push(Y),A+=Z.byteLength,y+=R+x}if(m.length){var re=this._videoTrack,fe={units:m,length:A,isKeyframe:H,dts:I,cts:s,pts:I+s};H&&(fe.fileposition=o),re.samples.push(fe),re.length+=A}},a.prototype._parseHEVCVideoData=function(i,t,e,n,o,r,s){for(var u=this._littleEndian,h=new DataView(i,t,e),m=[],A=0,y=0,R=this._naluLengthSize,I=this._timestampBase+n,H=r===1;y<e;){if(y+4>=e){p.a.w(this.TAG,"Malformed Nalu near timestamp ".concat(I,", offset = ").concat(y,", dataSize = ").concat(e));break}var x=h.getUint32(y,!u);if(R===3&&(x>>>=8),x>e-R)return void p.a.w(this.TAG,"Malformed Nalus near timestamp ".concat(I,", NaluSize > DataSize!"));var ee=h.getUint8(y+R)>>1&63;ee!==19&&ee!==20&&ee!==21||(H=!0);var Z=new Uint8Array(i,t+y,R+x),Y={type:ee,data:Z};m.push(Y),A+=Z.byteLength,y+=R+x}if(m.length){var re=this._videoTrack,fe={units:m,length:A,isKeyframe:H,dts:I,cts:s,pts:I+s};H&&(fe.fileposition=o),re.samples.push(fe),re.length+=A}},a.prototype._parseAV1VideoData=function(i,t,e,n,o,r,s){this._littleEndian;var u,h=[],m=this._timestampBase+n,A=r===1;if(A){var y=this._videoMetadata,R=_.parseOBUs(new Uint8Array(i,t,e),y.extra);if(R==null)return void this._onError(P.a.FORMAT_ERROR,"Flv: Invalid AV1 VideoData");console.log(R),y.codecWidth=R.codec_size.width,y.codecHeight=R.codec_size.height,y.presentWidth=R.present_size.width,y.presentHeight=R.present_size.height,y.sarRatio=R.sar_ratio;var I=this._mediaInfo;I.width=y.codecWidth,I.height=y.codecHeight,I.sarNum=y.sarRatio.width,I.sarDen=y.sarRatio.height,p.a.v(this.TAG,"Parsed AV1DecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",y)}if(u=e,h.push({unitType:0,data:new Uint8Array(i,t+0,e)}),h.length){var H=this._videoTrack,x={units:h,length:u,isKeyframe:A,dts:m,cts:s,pts:m+s};A&&(x.fileposition=o),H.samples.push(x),H.length+=u}},a}(),V=function(){function a(){}return a.prototype.destroy=function(){this.onError=null,this.onMediaInfo=null,this.onMetaDataArrived=null,this.onTrackMetadata=null,this.onDataAvailable=null,this.onTimedID3Metadata=null,this.onSynchronousKLVMetadata=null,this.onAsynchronousKLVMetadata=null,this.onSMPTE2038Metadata=null,this.onSCTE35Metadata=null,this.onPESPrivateData=null,this.onPESPrivateDataDescriptor=null},a}(),J=function(){this.program_pmt_pid={}};(function(a){a[a.kMPEG1Audio=3]="kMPEG1Audio",a[a.kMPEG2Audio=4]="kMPEG2Audio",a[a.kPESPrivateData=6]="kPESPrivateData",a[a.kADTSAAC=15]="kADTSAAC",a[a.kLOASAAC=17]="kLOASAAC",a[a.kAC3=129]="kAC3",a[a.kEAC3=135]="kEAC3",a[a.kMetadata=21]="kMetadata",a[a.kSCTE35=134]="kSCTE35",a[a.kH264=27]="kH264",a[a.kH265=36]="kH265"})(d||(d={}));var G,K=function(){this.pid_stream_type={},this.common_pids={h264:void 0,h265:void 0,av1:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},this.pes_private_data_pids={},this.timed_id3_pids={},this.synchronous_klv_pids={},this.asynchronous_klv_pids={},this.scte_35_pids={},this.smpte2038_pids={}},se=function(){},Ee=function(){},_e=function(){this.slices=[],this.total_length=0,this.expected_length=0,this.file_position=0};(function(a){a[a.kUnspecified=0]="kUnspecified",a[a.kSliceNonIDR=1]="kSliceNonIDR",a[a.kSliceDPA=2]="kSliceDPA",a[a.kSliceDPB=3]="kSliceDPB",a[a.kSliceDPC=4]="kSliceDPC",a[a.kSliceIDR=5]="kSliceIDR",a[a.kSliceSEI=6]="kSliceSEI",a[a.kSliceSPS=7]="kSliceSPS",a[a.kSlicePPS=8]="kSlicePPS",a[a.kSliceAUD=9]="kSliceAUD",a[a.kEndOfSequence=10]="kEndOfSequence",a[a.kEndOfStream=11]="kEndOfStream",a[a.kFiller=12]="kFiller",a[a.kSPSExt=13]="kSPSExt",a[a.kReserved0=14]="kReserved0"})(G||(G={}));var b,c,C=function(){},z=function(a){var i=a.data.byteLength;this.type=a.type,this.data=new Uint8Array(4+i),new DataView(this.data.buffer).setUint32(0,i),this.data.set(a.data,4)},ne=function(){function a(i){this.TAG="H264AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=i,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&p.a.e(this.TAG,"Could not find H264 startcode until payload end!")}return a.prototype.findNextStartCodeOffset=function(i){for(var t=i,e=this.data_;;){if(t+3>=e.byteLength)return this.eof_flag_=!0,e.byteLength;var n=e[t+0]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],o=e[t+0]<<16|e[t+1]<<8|e[t+2];if(n===1||o===1)return t;t++}},a.prototype.readNextNaluPayload=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_startcode_offset_,n=31&i[e+=(i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3])===1?4:3],o=(128&i[e])>>>7,r=this.findNextStartCodeOffset(e);if(this.current_startcode_offset_=r,!(n>=G.kReserved0)&&o===0){var s=i.subarray(e,r);(t=new C).type=n,t.data=s}}return t},a}(),de=function(){function a(i,t,e){var n=8+i.byteLength+1+2+t.byteLength,o=!1;i[3]!==66&&i[3]!==77&&i[3]!==88&&(o=!0,n+=4);var r=this.data=new Uint8Array(n);r[0]=1,r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=255,r[5]=225;var s=i.byteLength;r[6]=s>>>8,r[7]=255&s;var u=8;r.set(i,8),r[u+=s]=1;var h=t.byteLength;r[u+1]=h>>>8,r[u+2]=255&h,r.set(t,u+3),u+=3+h,o&&(r[u]=252|e.chroma_format_idc,r[u+1]=248|e.bit_depth_luma-8,r[u+2]=248|e.bit_depth_chroma-8,r[u+3]=0,u+=4)}return a.prototype.getData=function(){return this.data},a}();(function(a){a[a.kNull=0]="kNull",a[a.kAACMain=1]="kAACMain",a[a.kAAC_LC=2]="kAAC_LC",a[a.kAAC_SSR=3]="kAAC_SSR",a[a.kAAC_LTP=4]="kAAC_LTP",a[a.kAAC_SBR=5]="kAAC_SBR",a[a.kAAC_Scalable=6]="kAAC_Scalable",a[a.kLayer1=32]="kLayer1",a[a.kLayer2=33]="kLayer2",a[a.kLayer3=34]="kLayer3"})(b||(b={})),function(a){a[a.k96000Hz=0]="k96000Hz",a[a.k88200Hz=1]="k88200Hz",a[a.k64000Hz=2]="k64000Hz",a[a.k48000Hz=3]="k48000Hz",a[a.k44100Hz=4]="k44100Hz",a[a.k32000Hz=5]="k32000Hz",a[a.k24000Hz=6]="k24000Hz",a[a.k22050Hz=7]="k22050Hz",a[a.k16000Hz=8]="k16000Hz",a[a.k12000Hz=9]="k12000Hz",a[a.k11025Hz=10]="k11025Hz",a[a.k8000Hz=11]="k8000Hz",a[a.k7350Hz=12]="k7350Hz"}(c||(c={}));var Te,ye,j=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],W=(Te=function(a,i){return(Te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(a,i)},function(a,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function t(){this.constructor=a}Te(a,i),a.prototype=i===null?Object.create(i):(t.prototype=i.prototype,new t)}),ie=function(){},ce=function(a){function i(){return a!==null&&a.apply(this,arguments)||this}return W(i,a),i}(ie),he=function(){function a(i){this.TAG="AACADTSParser",this.data_=i,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&p.a.e(this.TAG,"Could not found ADTS syncword until payload end")}return a.prototype.findNextSyncwordOffset=function(i){for(var t=i,e=this.data_;;){if(t+7>=e.byteLength)return this.eof_flag_=!0,e.byteLength;if((e[t+0]<<8|e[t+1])>>>4===4095)return t;t++}},a.prototype.readNextAACFrame=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_syncword_offset_,n=(8&i[e+1])>>>3,o=(6&i[e+1])>>>1,r=1&i[e+1],s=(192&i[e+2])>>>6,u=(60&i[e+2])>>>2,h=(1&i[e+2])<<2|(192&i[e+3])>>>6,m=(3&i[e+3])<<11|i[e+4]<<3|(224&i[e+5])>>>5;if(i[e+6],e+m>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var A=r===1?7:9,y=m-A;e+=A;var R=this.findNextSyncwordOffset(e+y);if(this.current_syncword_offset_=R,(n===0||n===1)&&o===0){var I=i.subarray(e,e+y);(t=new ie).audio_object_type=s+1,t.sampling_freq_index=u,t.sampling_frequency=j[u],t.channel_config=h,t.data=I}}return t},a.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},a.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},a}(),ve=function(){function a(i){this.TAG="AACLOASParser",this.data_=i,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&p.a.e(this.TAG,"Could not found LOAS syncword until payload end")}return a.prototype.findNextSyncwordOffset=function(i){for(var t=i,e=this.data_;;){if(t+1>=e.byteLength)return this.eof_flag_=!0,e.byteLength;if((e[t+0]<<3|e[t+1]>>>5)===695)return t;t++}},a.prototype.getLATMValue=function(i){for(var t=i.readBits(2),e=0,n=0;n<=t;n++)e<<=8,e|=i.readByte();return e},a.prototype.readNextAACFrame=function(i){for(var t=this.data_,e=null;e==null&&!this.eof_flag_;){var n=this.current_syncword_offset_,o=(31&t[n+1])<<8|t[n+2];if(n+3+o>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var r=new U(t.subarray(n+3,n+3+o)),s=null;if(r.readBool()){if(i==null){p.a.w(this.TAG,"StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(n+3+o),r.destroy();continue}s=i}else{var u=r.readBool();if(u&&r.readBool()){p.a.e(this.TAG,"audioMuxVersionA is Not Supported"),r.destroy();break}if(u&&this.getLATMValue(r),!r.readBool()){p.a.e(this.TAG,"allStreamsSameTimeFraming zero is Not Supported"),r.destroy();break}if(r.readBits(6)!==0){p.a.e(this.TAG,"more than 2 numSubFrames Not Supported"),r.destroy();break}if(r.readBits(4)!==0){p.a.e(this.TAG,"more than 2 numProgram Not Supported"),r.destroy();break}if(r.readBits(3)!==0){p.a.e(this.TAG,"more than 2 numLayer Not Supported"),r.destroy();break}var h=u?this.getLATMValue(r):0,m=r.readBits(5);h-=5;var A=r.readBits(4);h-=4;var y=r.readBits(4);h-=4,r.readBits(3),(h-=3)>0&&r.readBits(h);var R=r.readBits(3);if(R!==0){p.a.e(this.TAG,"frameLengthType = ".concat(R,". Only frameLengthType = 0 Supported")),r.destroy();break}r.readByte();var I=r.readBool();if(I)if(u)this.getLATMValue(r);else{for(var H=0;;){H<<=8;var x=r.readBool();if(H+=r.readByte(),!x)break}console.log(H)}r.readBool()&&r.readByte(),(s=new ce).audio_object_type=m,s.sampling_freq_index=A,s.sampling_frequency=j[s.sampling_freq_index],s.channel_config=y,s.other_data_present=I}for(var ee=0;;){var Z=r.readByte();if(ee+=Z,Z!==255)break}for(var Y=new Uint8Array(ee),re=0;re<ee;re++)Y[re]=r.readByte();(e=new ce).audio_object_type=s.audio_object_type,e.sampling_freq_index=s.sampling_freq_index,e.sampling_frequency=j[s.sampling_freq_index],e.channel_config=s.channel_config,e.other_data_present=s.other_data_present,e.data=Y,this.current_syncword_offset_=this.findNextSyncwordOffset(n+3+o)}return e},a.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},a.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},a}(),Me=function(a){var i=null,t=a.audio_object_type,e=a.audio_object_type,n=a.sampling_freq_index,o=a.channel_config,r=0,s=navigator.userAgent.toLowerCase();s.indexOf("firefox")!==-1?n>=6?(e=5,i=new Array(4),r=n-3):(e=2,i=new Array(2),r=n):s.indexOf("android")!==-1?(e=2,i=new Array(2),r=n):(e=5,r=n,i=new Array(4),n>=6?r=n-3:o===1&&(e=2,i=new Array(2),r=n)),i[0]=e<<3,i[0]|=(15&n)>>>1,i[1]=(15&n)<<7,i[1]|=(15&o)<<3,e===5&&(i[1]|=(15&r)>>>1,i[2]=(1&r)<<7,i[2]|=8,i[3]=0),this.config=i,this.sampling_rate=j[n],this.channel_count=o,this.codec_mimetype="mp4a.40."+e,this.original_codec_mimetype="mp4a.40."+t},Ce=function(){},Ue=function(){};(function(a){a[a.kSpliceNull=0]="kSpliceNull",a[a.kSpliceSchedule=4]="kSpliceSchedule",a[a.kSpliceInsert=5]="kSpliceInsert",a[a.kTimeSignal=6]="kTimeSignal",a[a.kBandwidthReservation=7]="kBandwidthReservation",a[a.kPrivateCommand=255]="kPrivateCommand"})(ye||(ye={}));var ke,He=function(a){var i=a.readBool();return i?(a.readBits(6),{time_specified_flag:i,pts_time:4*a.readBits(31)+a.readBits(2)}):(a.readBits(7),{time_specified_flag:i})},Ye=function(a){var i=a.readBool();return a.readBits(6),{auto_return:i,duration:4*a.readBits(31)+a.readBits(2)}},Ze=function(a,i){var t=i.readBits(8);return a?{component_tag:t}:{component_tag:t,splice_time:He(i)}},$e=function(a){return{component_tag:a.readBits(8),utc_splice_time:a.readBits(32)}},bt=function(a){var i=a.readBits(32),t=a.readBool();a.readBits(7);var e={splice_event_id:i,splice_event_cancel_indicator:t};if(t)return e;if(e.out_of_network_indicator=a.readBool(),e.program_splice_flag=a.readBool(),e.duration_flag=a.readBool(),a.readBits(5),e.program_splice_flag)e.utc_splice_time=a.readBits(32);else{e.component_count=a.readBits(8),e.components=[];for(var n=0;n<e.component_count;n++)e.components.push($e(a))}return e.duration_flag&&(e.break_duration=Ye(a)),e.unique_program_id=a.readBits(16),e.avail_num=a.readBits(8),e.avails_expected=a.readBits(8),e},At=function(a,i,t,e){return{descriptor_tag:a,descriptor_length:i,identifier:t,provider_avail_id:e.readBits(32)}},Et=function(a,i,t,e){var n=e.readBits(8),o=e.readBits(3);e.readBits(5);for(var r="",s=0;s<o;s++)r+=String.fromCharCode(e.readBits(8));return{descriptor_tag:a,descriptor_length:i,identifier:t,preroll:n,dtmf_count:o,DTMF_char:r}},Rt=function(a){var i=a.readBits(8);return a.readBits(7),{component_tag:i,pts_offset:4*a.readBits(31)+a.readBits(2)}},Tt=function(a,i,t,e){var n=e.readBits(32),o=e.readBool();e.readBits(7);var r={descriptor_tag:a,descriptor_length:i,identifier:t,segmentation_event_id:n,segmentation_event_cancel_indicator:o};if(o)return r;if(r.program_segmentation_flag=e.readBool(),r.segmentation_duration_flag=e.readBool(),r.delivery_not_restricted_flag=e.readBool(),r.delivery_not_restricted_flag?e.readBits(5):(r.web_delivery_allowed_flag=e.readBool(),r.no_regional_blackout_flag=e.readBool(),r.archive_allowed_flag=e.readBool(),r.device_restrictions=e.readBits(2)),!r.program_segmentation_flag){r.component_count=e.readBits(8),r.components=[];for(var s=0;s<r.component_count;s++)r.components.push(Rt(e))}r.segmentation_duration_flag&&(r.segmentation_duration=e.readBits(40)),r.segmentation_upid_type=e.readBits(8),r.segmentation_upid_length=e.readBits(8);var u=new Uint8Array(r.segmentation_upid_length);for(s=0;s<r.segmentation_upid_length;s++)u[s]=e.readBits(8);return r.segmentation_upid=u.buffer,r.segmentation_type_id=e.readBits(8),r.segment_num=e.readBits(8),r.segments_expected=e.readBits(8),r.segmentation_type_id!==52&&r.segmentation_type_id!==54&&r.segmentation_type_id!==56&&r.segmentation_type_id!==58||(r.sub_segment_num=e.readBits(8),r.sub_segments_expected=e.readBits(8)),r},kt=function(a,i,t,e){return{descriptor_tag:a,descriptor_length:i,identifier:t,TAI_seconds:e.readBits(48),TAI_ns:e.readBits(32),UTC_offset:e.readBits(16)}},Lt=function(a){return{component_tag:a.readBits(8),ISO_code:String.fromCharCode(a.readBits(8),a.readBits(8),a.readBits(8)),Bit_Stream_Mode:a.readBits(3),Num_Channels:a.readBits(4),Full_Srvc_Audio:a.readBool()}},wt=function(a,i,t,e){for(var n=e.readBits(4),o=[],r=0;r<n;r++)o.push(Lt(e));return{descriptor_tag:a,descriptor_length:i,identifier:t,audio_count:n,components:o}},Mt=function(a){var i=new U(a),t=i.readBits(8),e=i.readBool(),n=i.readBool();i.readBits(2);var o=i.readBits(12),r=i.readBits(8),s=i.readBool(),u=i.readBits(6),h=4*i.readBits(31)+i.readBits(2),m=i.readBits(8),A=i.readBits(12),y=i.readBits(12),R=i.readBits(8),I=null;R===ye.kSpliceNull?I={}:R===ye.kSpliceSchedule?I=function(le){for(var Se=le.readBits(8),Ae=[],ue=0;ue<Se;ue++)Ae.push(bt(le));return{splice_count:Se,events:Ae}}(i):R===ye.kSpliceInsert?I=function(le){var Se=le.readBits(32),Ae=le.readBool();le.readBits(7);var ue={splice_event_id:Se,splice_event_cancel_indicator:Ae};if(Ae)return ue;if(ue.out_of_network_indicator=le.readBool(),ue.program_splice_flag=le.readBool(),ue.duration_flag=le.readBool(),ue.splice_immediate_flag=le.readBool(),le.readBits(4),ue.program_splice_flag&&!ue.splice_immediate_flag&&(ue.splice_time=He(le)),!ue.program_splice_flag){ue.component_count=le.readBits(8),ue.components=[];for(var ge=0;ge<ue.component_count;ge++)ue.components.push(Ze(ue.splice_immediate_flag,le))}return ue.duration_flag&&(ue.break_duration=Ye(le)),ue.unique_program_id=le.readBits(16),ue.avail_num=le.readBits(8),ue.avails_expected=le.readBits(8),ue}(i):R===ye.kTimeSignal?I=function(le){return{splice_time:He(le)}}(i):R===ye.kBandwidthReservation?I={}:R===ye.kPrivateCommand?I=function(le,Se){for(var Ae=String.fromCharCode(Se.readBits(8),Se.readBits(8),Se.readBits(8),Se.readBits(8)),ue=new Uint8Array(le-4),ge=0;ge<le-4;ge++)ue[ge]=Se.readBits(8);return{identifier:Ae,private_data:ue.buffer}}(y,i):i.readBits(8*y);for(var H=[],x=i.readBits(16),ee=0;ee<x;){var Z=i.readBits(8),Y=i.readBits(8),re=String.fromCharCode(i.readBits(8),i.readBits(8),i.readBits(8),i.readBits(8));Z===0?H.push(At(Z,Y,re,i)):Z===1?H.push(Et(Z,Y,re,i)):Z===2?H.push(Tt(Z,Y,re,i)):Z===3?H.push(kt(Z,Y,re,i)):Z===4?H.push(wt(Z,Y,re,i)):i.readBits(8*(Y-4)),ee+=2+Y}var fe={table_id:t,section_syntax_indicator:e,private_indicator:n,section_length:o,protocol_version:r,encrypted_packet:s,encryption_algorithm:u,pts_adjustment:h,cw_index:m,tier:A,splice_command_length:y,splice_command_type:R,splice_command:I,descriptor_loop_length:x,splice_descriptors:H,E_CRC32:s?i.readBits(32):void 0,CRC32:i.readBits(32)};if(R===ye.kSpliceInsert){var $=I;if($.splice_event_cancel_indicator)return{splice_command_type:R,detail:fe,data:a};if($.program_splice_flag&&!$.splice_immediate_flag){var ae=$.duration_flag?$.break_duration.auto_return:void 0,pe=$.duration_flag?$.break_duration.duration/90:void 0;return $.splice_time.time_specified_flag?{splice_command_type:R,pts:(h+$.splice_time.pts_time)%Math.pow(2,33),auto_return:ae,duraiton:pe,detail:fe,data:a}:{splice_command_type:R,auto_return:ae,duraiton:pe,detail:fe,data:a}}return{splice_command_type:R,auto_return:ae=$.duration_flag?$.break_duration.auto_return:void 0,duraiton:pe=$.duration_flag?$.break_duration.duration/90:void 0,detail:fe,data:a}}if(R===ye.kTimeSignal){var oe=I;return oe.splice_time.time_specified_flag?{splice_command_type:R,pts:(h+oe.splice_time.pts_time)%Math.pow(2,33),detail:fe,data:a}:{splice_command_type:R,detail:fe,data:a}}return{splice_command_type:R,detail:fe,data:a}};(function(a){a[a.kSliceIDR_W_RADL=19]="kSliceIDR_W_RADL",a[a.kSliceIDR_N_LP=20]="kSliceIDR_N_LP",a[a.kSliceCRA_NUT=21]="kSliceCRA_NUT",a[a.kSliceVPS=32]="kSliceVPS",a[a.kSliceSPS=33]="kSliceSPS",a[a.kSlicePPS=34]="kSlicePPS",a[a.kSliceAUD=35]="kSliceAUD"})(ke||(ke={}));var Ct=function(){},Dt=function(a){var i=a.data.byteLength;this.type=a.type,this.data=new Uint8Array(4+i),new DataView(this.data.buffer).setUint32(0,i),this.data.set(a.data,4)},Ot=function(){function a(i){this.TAG="H265AnnexBParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=i,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&p.a.e(this.TAG,"Could not find H265 startcode until payload end!")}return a.prototype.findNextStartCodeOffset=function(i){for(var t=i,e=this.data_;;){if(t+3>=e.byteLength)return this.eof_flag_=!0,e.byteLength;var n=e[t+0]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],o=e[t+0]<<16|e[t+1]<<8|e[t+2];if(n===1||o===1)return t;t++}},a.prototype.readNextNaluPayload=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_startcode_offset_,n=i[e+=(i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3])===1?4:3]>>1&63,o=(128&i[e])>>>7,r=this.findNextStartCodeOffset(e);if(this.current_startcode_offset_=r,o===0){var s=i.subarray(e,r);(t=new Ct).type=n,t.data=s}}return t},a}(),Bt=function(){function a(i,t,e,n){var o=23+(5+i.byteLength)+(5+t.byteLength)+(5+e.byteLength),r=this.data=new Uint8Array(o);r[0]=1,r[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,r[2]=n.general_profile_compatibility_flags_1,r[3]=n.general_profile_compatibility_flags_2,r[4]=n.general_profile_compatibility_flags_3,r[5]=n.general_profile_compatibility_flags_4,r[6]=n.general_constraint_indicator_flags_1,r[7]=n.general_constraint_indicator_flags_2,r[8]=n.general_constraint_indicator_flags_3,r[9]=n.general_constraint_indicator_flags_4,r[10]=n.general_constraint_indicator_flags_5,r[11]=n.general_constraint_indicator_flags_6,r[12]=n.general_level_idc,r[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,r[14]=255&n.min_spatial_segmentation_idc,r[15]=252|3&n.parallelismType,r[16]=252|3&n.chroma_format_idc,r[17]=248|7&n.bit_depth_luma_minus8,r[18]=248|7&n.bit_depth_chroma_minus8,r[19]=0,r[20]=0,r[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,r[22]=3,r[23]=128|ke.kSliceVPS,r[24]=0,r[25]=1,r[26]=(65280&i.byteLength)>>8,r[27]=(255&i.byteLength)>>0,r.set(i,28),r[23+(5+i.byteLength)+0]=128|ke.kSliceSPS,r[23+(5+i.byteLength)+1]=0,r[23+(5+i.byteLength)+2]=1,r[23+(5+i.byteLength)+3]=(65280&t.byteLength)>>8,r[23+(5+i.byteLength)+4]=(255&t.byteLength)>>0,r.set(t,23+(5+i.byteLength)+5),r[23+(5+i.byteLength+5+t.byteLength)+0]=128|ke.kSlicePPS,r[23+(5+i.byteLength+5+t.byteLength)+1]=0,r[23+(5+i.byteLength+5+t.byteLength)+2]=1,r[23+(5+i.byteLength+5+t.byteLength)+3]=(65280&e.byteLength)>>8,r[23+(5+i.byteLength+5+t.byteLength)+4]=(255&e.byteLength)>>0,r.set(e,23+(5+i.byteLength+5+t.byteLength)+5)}return a.prototype.getData=function(){return this.data},a}(),It=function(){},Pt=function(){},xt=function(){},Ut=[[64,64,80,80,96,96,112,112,128,128,160,160,192,192,224,224,256,256,320,320,384,384,448,448,512,512,640,640,768,768,896,896,1024,1024,1152,1152,1280,1280],[69,70,87,88,104,105,121,122,139,140,174,175,208,209,243,244,278,279,348,349,417,418,487,488,557,558,696,697,835,836,975,976,1114,1115,1253,1254,1393,1394],[96,96,120,120,144,144,168,168,192,192,240,240,288,288,336,336,384,384,480,480,576,576,672,672,768,768,960,960,1152,1152,1344,1344,1536,1536,1728,1728,1920,1920]],Nt=function(){function a(i){this.TAG="AC3Parser",this.data_=i,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&p.a.e(this.TAG,"Could not found AC3 syncword until payload end")}return a.prototype.findNextSyncwordOffset=function(i){for(var t=i,e=this.data_;;){if(t+7>=e.byteLength)return this.eof_flag_=!0,e.byteLength;if((e[t+0]<<8|e[t+1]<<0)===2935)return t;t++}},a.prototype.readNextAC3Frame=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_syncword_offset_,n=i[e+4]>>6,o=[48e3,44200,33e3][n],r=63&i[e+4],s=2*Ut[n][r];if(isNaN(s)||e+s>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var u=this.findNextSyncwordOffset(e+s);this.current_syncword_offset_=u;var h=i[e+5]>>3,m=7&i[e+5],A=i[e+6]>>5,y=0;1&A&&A!==1&&(y+=2),4&A&&(y+=2),A===2&&(y+=2);var R=(i[e+6]<<8|i[e+7]<<0)>>12-y&1,I=[2,1,2,3,3,4,4,5][A]+R;(t=new xt).sampling_frequency=o,t.channel_count=I,t.channel_mode=A,t.bit_stream_identification=h,t.low_frequency_effects_channel_on=R,t.bit_stream_mode=m,t.frame_size_code=r,t.data=i.subarray(e,e+s)}return t},a.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},a.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},a}(),Vt=function(a){var i;i=[a.sampling_rate_code<<6|a.bit_stream_identification<<1|a.bit_stream_mode>>2,(3&a.bit_stream_mode)<<6|a.channel_mode<<3|a.low_frequency_effects_channel_on<<2|a.frame_size_code>>4,a.frame_size_code<<4&224],this.config=i,this.sampling_rate=a.sampling_frequency,this.bit_stream_identification=a.bit_stream_identification,this.bit_stream_mode=a.bit_stream_mode,this.low_frequency_effects_channel_on=a.low_frequency_effects_channel_on,this.channel_count=a.channel_count,this.channel_mode=a.channel_mode,this.codec_mimetype="ac-3",this.original_codec_mimetype="ac-3"},Ft=function(){},Gt=function(){function a(i){this.TAG="EAC3Parser",this.data_=i,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&p.a.e(this.TAG,"Could not found AC3 syncword until payload end")}return a.prototype.findNextSyncwordOffset=function(i){for(var t=i,e=this.data_;;){if(t+7>=e.byteLength)return this.eof_flag_=!0,e.byteLength;if((e[t+0]<<8|e[t+1]<<0)===2935)return t;t++}},a.prototype.readNextEAC3Frame=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_syncword_offset_,n=new U(i.subarray(e+2)),o=(n.readBits(2),n.readBits(3),n.readBits(11)+1<<1),r=n.readBits(2),s=null,u=null;r===3?(s=[24e3,22060,16e3][r=n.readBits(2)],u=3):(s=[48e3,44100,32e3][r],u=n.readBits(2));var h=n.readBits(3),m=n.readBits(1),A=n.readBits(5);if(e+o>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}var y=this.findNextSyncwordOffset(e+o);this.current_syncword_offset_=y;var R=[2,1,2,3,3,4,4,5][h]+m;n.destroy(),(t=new Ft).sampling_frequency=s,t.channel_count=R,t.channel_mode=h,t.bit_stream_identification=A,t.low_frequency_effects_channel_on=m,t.frame_size=o,t.num_blks=[1,2,3,6][u],t.data=i.subarray(e,e+o)}return t},a.prototype.hasIncompleteData=function(){return this.has_last_incomplete_data},a.prototype.getIncompleteData=function(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null},a}(),jt=function(a){var i,t=Math.floor(a.frame_size*a.sampling_frequency/(16*a.num_blks));i=[255&t,248&t,a.sampling_rate_code<<6|a.bit_stream_identification<<1|0,0|a.channel_mode<<1|a.low_frequency_effects_channel_on<<0,0],this.config=i,this.sampling_rate=a.sampling_frequency,this.bit_stream_identification=a.bit_stream_identification,this.num_blks=a.num_blks,this.low_frequency_effects_channel_on=a.low_frequency_effects_channel_on,this.channel_count=a.channel_count,this.channel_mode=a.channel_mode,this.codec_mimetype="ec-3",this.original_codec_mimetype="ec-3"},zt=function(){},Ht=function(){function a(i){this.TAG="AV1OBUInMpegTsParser",this.current_startcode_offset_=0,this.eof_flag_=!1,this.data_=i,this.current_startcode_offset_=this.findNextStartCodeOffset(0),this.eof_flag_&&p.a.e(this.TAG,"Could not find AV1 startcode until payload end!")}return a._ebsp2rbsp=function(i){for(var t=i,e=t.byteLength,n=new Uint8Array(e),o=0,r=0;r<e;r++)r>=2&&t[r]===3&&t[r-1]===0&&t[r-2]===0||(n[o]=t[r],o++);return new Uint8Array(n.buffer,0,o)},a.prototype.findNextStartCodeOffset=function(i){for(var t=i,e=this.data_;;){if(t+2>=e.byteLength)return this.eof_flag_=!0,e.byteLength;if((e[t+0]<<16|e[t+1]<<8|e[t+2])===1)return t;t++}},a.prototype.readNextOBUPayload=function(){for(var i=this.data_,t=null;t==null&&!this.eof_flag_;){var e=this.current_startcode_offset_+3,n=this.findNextStartCodeOffset(e);this.current_startcode_offset_=n,t=a._ebsp2rbsp(i.subarray(e,n))}return t},a}(),qt=function(){var a=function(i,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])})(i,t)};return function(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=i}a(i,t),i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}}(),Ge=function(){return(Ge=Object.assign||function(a){for(var i,t=1,e=arguments.length;t<e;t++)for(var n in i=arguments[t])Object.prototype.hasOwnProperty.call(i,n)&&(a[n]=i[n]);return a}).apply(this,arguments)},rt=function(a){function i(t,e){var n=a.call(this)||this;return n.TAG="TSDemuxer",n.first_parse_=!0,n.media_info_=new S.a,n.timescale_=90,n.duration_=0,n.current_pmt_pid_=-1,n.program_pmt_map_={},n.pes_slice_queues_={},n.section_slice_queues_={},n.video_metadata_={vps:void 0,sps:void 0,pps:void 0,av1c:void 0,details:void 0},n.audio_metadata_={codec:void 0,audio_object_type:void 0,sampling_freq_index:void 0,sampling_frequency:void 0,channel_config:void 0},n.last_pcr_base_=NaN,n.timestamp_offset_=0,n.audio_last_sample_pts_=void 0,n.aac_last_incomplete_data_=null,n.has_video_=!1,n.has_audio_=!1,n.video_init_segment_dispatched_=!1,n.audio_init_segment_dispatched_=!1,n.video_metadata_changed_=!1,n.audio_metadata_changed_=!1,n.loas_previous_frame=null,n.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},n.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},n.ts_packet_size_=t.ts_packet_size,n.sync_offset_=t.sync_offset,n.config_=e,n}return qt(i,a),i.prototype.destroy=function(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,a.prototype.destroy.call(this)},i.probe=function(t){var e=new Uint8Array(t),n=-1,o=188;if(e.byteLength<=3*o)return{needMoreData:!0};for(;n===-1;){for(var r=Math.min(1e3,e.byteLength-3*o),s=0;s<r;){if(e[s]===71&&e[s+o]===71&&e[s+2*o]===71){n=s;break}s++}if(n===-1)if(o===188)o=192;else{if(o!==192)break;o=204}}return n===-1?{match:!1}:(o===192&&n>=4?(p.a.v("TSDemuxer","ts_packet_size = 192, m2ts mode"),n-=4):o===204&&p.a.v("TSDemuxer","ts_packet_size = 204, RS encoded MPEG2-TS stream"),{match:!0,consumed:0,ts_packet_size:o,sync_offset:n})},i.prototype.bindDataSource=function(t){return t.onDataArrival=this.parseChunks.bind(this),this},i.prototype.resetMediaInfo=function(){this.media_info_=new S.a},i.prototype.parseChunks=function(t,e){if(!(this.onError&&this.onMediaInfo&&this.onTrackMetadata&&this.onDataAvailable))throw new L.a("onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var n=0;for(this.first_parse_&&(this.first_parse_=!1,n=this.sync_offset_);n+this.ts_packet_size_<=t.byteLength;){var o=e+n;this.ts_packet_size_===192&&(n+=4);var r=new Uint8Array(t,n,188),s=r[0];if(s!==71){p.a.e(this.TAG,"sync_byte = ".concat(s,", not 0x47"));break}var u=(64&r[1])>>>6,h=(r[1],(31&r[1])<<8|r[2]),m=(48&r[3])>>>4,A=15&r[3],y=!(!this.pmt_||this.pmt_.pcr_pid!==h),R={},I=4;if(m==2||m==3){var H=r[4];if(H>0&&(y||m==3)&&(R.discontinuity_indicator=(128&r[5])>>>7,R.random_access_indicator=(64&r[5])>>>6,R.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){var x=300*this.getPcrBase(r)+((1&r[10])<<8|r[11]);this.last_pcr_=x}if(m==2||5+H===188){n+=188,this.ts_packet_size_===204&&(n+=16);continue}I=5+H}if(m==1||m==3){if(h===0||h===this.current_pmt_pid_||this.pmt_!=null&&this.pmt_.pid_stream_type[h]===d.kSCTE35){var ee=188-I;this.handleSectionSlice(t,n+I,ee,{pid:h,file_position:o,payload_unit_start_indicator:u,continuity_conunter:A,random_access_indicator:R.random_access_indicator})}else if(this.pmt_!=null&&this.pmt_.pid_stream_type[h]!=null){ee=188-I;var Z=this.pmt_.pid_stream_type[h];h!==this.pmt_.common_pids.h264&&h!==this.pmt_.common_pids.h265&&h!==this.pmt_.common_pids.av1&&h!==this.pmt_.common_pids.adts_aac&&h!==this.pmt_.common_pids.loas_aac&&h!==this.pmt_.common_pids.ac3&&h!==this.pmt_.common_pids.eac3&&h!==this.pmt_.common_pids.opus&&h!==this.pmt_.common_pids.mp3&&this.pmt_.pes_private_data_pids[h]!==!0&&this.pmt_.timed_id3_pids[h]!==!0&&this.pmt_.synchronous_klv_pids[h]!==!0&&this.pmt_.asynchronous_klv_pids[h]!==!0||this.handlePESSlice(t,n+I,ee,{pid:h,stream_type:Z,file_position:o,payload_unit_start_indicator:u,continuity_conunter:A,random_access_indicator:R.random_access_indicator})}}n+=188,this.ts_packet_size_===204&&(n+=16)}return this.dispatchAudioVideoMediaSegment(),n},i.prototype.handleSectionSlice=function(t,e,n,o){var r=new Uint8Array(t,e,n),s=this.section_slice_queues_[o.pid];if(o.payload_unit_start_indicator){var u=r[0];if(s!=null&&s.total_length!==0){var h=new Uint8Array(t,e+1,Math.min(n,u));s.slices.push(h),s.total_length+=h.byteLength,s.total_length===s.expected_length?this.emitSectionSlices(s,o):this.clearSlices(s,o)}for(var m=1+u;m<r.byteLength&&r[m+0]!==255;){var A=(15&r[m+1])<<8|r[m+2];this.section_slice_queues_[o.pid]=new _e,(s=this.section_slice_queues_[o.pid]).expected_length=A+3,s.file_position=o.file_position,s.random_access_indicator=o.random_access_indicator,h=new Uint8Array(t,e+m,Math.min(n-m,s.expected_length-s.total_length)),s.slices.push(h),s.total_length+=h.byteLength,s.total_length===s.expected_length?this.emitSectionSlices(s,o):s.total_length>=s.expected_length&&this.clearSlices(s,o),m+=h.byteLength}}else s!=null&&s.total_length!==0&&(h=new Uint8Array(t,e,Math.min(n,s.expected_length-s.total_length)),s.slices.push(h),s.total_length+=h.byteLength,s.total_length===s.expected_length?this.emitSectionSlices(s,o):s.total_length>=s.expected_length&&this.clearSlices(s,o))},i.prototype.handlePESSlice=function(t,e,n,o){var r=new Uint8Array(t,e,n),s=r[0]<<16|r[1]<<8|r[2],u=(r[3],r[4]<<8|r[5]);if(o.payload_unit_start_indicator){if(s!==1)return void p.a.e(this.TAG,"handlePESSlice: packet_start_code_prefix should be 1 but with value ".concat(s));var h=this.pes_slice_queues_[o.pid];h&&(h.expected_length===0||h.expected_length===h.total_length?this.emitPESSlices(h,o):this.clearSlices(h,o)),this.pes_slice_queues_[o.pid]=new _e,this.pes_slice_queues_[o.pid].file_position=o.file_position,this.pes_slice_queues_[o.pid].random_access_indicator=o.random_access_indicator}if(this.pes_slice_queues_[o.pid]!=null){var m=this.pes_slice_queues_[o.pid];m.slices.push(r),o.payload_unit_start_indicator&&(m.expected_length=u===0?0:u+6),m.total_length+=r.byteLength,m.expected_length>0&&m.expected_length===m.total_length?this.emitPESSlices(m,o):m.expected_length>0&&m.expected_length<m.total_length&&this.clearSlices(m,o)}},i.prototype.emitSectionSlices=function(t,e){for(var n=new Uint8Array(t.total_length),o=0,r=0;o<t.slices.length;o++){var s=t.slices[o];n.set(s,r),r+=s.byteLength}t.slices=[],t.expected_length=-1,t.total_length=0;var u=new Ee;u.pid=e.pid,u.data=n,u.file_position=t.file_position,u.random_access_indicator=t.random_access_indicator,this.parseSection(u)},i.prototype.emitPESSlices=function(t,e){for(var n=new Uint8Array(t.total_length),o=0,r=0;o<t.slices.length;o++){var s=t.slices[o];n.set(s,r),r+=s.byteLength}t.slices=[],t.expected_length=-1,t.total_length=0;var u=new se;u.pid=e.pid,u.data=n,u.stream_type=e.stream_type,u.file_position=t.file_position,u.random_access_indicator=t.random_access_indicator,this.parsePES(u)},i.prototype.clearSlices=function(t,e){t.slices=[],t.expected_length=-1,t.total_length=0},i.prototype.parseSection=function(t){var e=t.data,n=t.pid;n===0?this.parsePAT(e):n===this.current_pmt_pid_?this.parsePMT(e):this.pmt_!=null&&this.pmt_.scte_35_pids[n]&&this.parseSCTE35(e)},i.prototype.parsePES=function(t){var e=t.data,n=e[0]<<16|e[1]<<8|e[2],o=e[3],r=e[4]<<8|e[5];if(n===1)if(o!==188&&o!==190&&o!==191&&o!==240&&o!==241&&o!==255&&o!==242&&o!==248){e[6];var s=(192&e[7])>>>6,u=e[8],h=void 0,m=void 0;s!==2&&s!==3||(h=this.getTimestamp(e,9),m=s===3?this.getTimestamp(e,14):h);var A=9+u,y=void 0;if(r!==0){if(r<3+u)return void p.a.v(this.TAG,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");y=r-3-u}else y=e.byteLength-A;var R=e.subarray(A,A+y);switch(t.stream_type){case d.kMPEG1Audio:case d.kMPEG2Audio:this.parseMP3Payload(R,h);break;case d.kPESPrivateData:this.pmt_.common_pids.av1===t.pid?this.parseAV1Payload(R,h,m,t.file_position,t.random_access_indicator):this.pmt_.common_pids.opus===t.pid?this.parseOpusPayload(R,h):this.pmt_.common_pids.ac3===t.pid?this.parseAC3Payload(R,h):this.pmt_.common_pids.eac3===t.pid?this.parseEAC3Payload(R,h):this.pmt_.asynchronous_klv_pids[t.pid]?this.parseAsynchronousKLVMetadataPayload(R,t.pid,o):this.pmt_.smpte2038_pids[t.pid]?this.parseSMPTE2038MetadataPayload(R,h,m,t.pid,o):this.parsePESPrivateDataPayload(R,h,m,t.pid,o);break;case d.kADTSAAC:this.parseADTSAACPayload(R,h);break;case d.kLOASAAC:this.parseLOASAACPayload(R,h);break;case d.kAC3:this.parseAC3Payload(R,h);break;case d.kEAC3:this.parseEAC3Payload(R,h);break;case d.kMetadata:this.pmt_.timed_id3_pids[t.pid]?this.parseTimedID3MetadataPayload(R,h,m,t.pid,o):this.pmt_.synchronous_klv_pids[t.pid]&&this.parseSynchronousKLVMetadataPayload(R,h,m,t.pid,o);break;case d.kH264:this.parseH264Payload(R,h,m,t.file_position,t.random_access_indicator);break;case d.kH265:this.parseH265Payload(R,h,m,t.file_position,t.random_access_indicator)}}else(o===188||o===191||o===240||o===241||o===255||o===242||o===248)&&t.stream_type===d.kPESPrivateData&&(A=6,y=void 0,y=r!==0?r:e.byteLength-A,R=e.subarray(A,A+y),this.parsePESPrivateDataPayload(R,void 0,void 0,t.pid,o));else p.a.e(this.TAG,"parsePES: packet_start_code_prefix should be 1 but with value ".concat(n))},i.prototype.parsePAT=function(t){var e=t[0];if(e===0){var n=(15&t[1])<<8|t[2],o=(t[3],t[4],(62&t[5])>>>1),r=1&t[5],s=t[6],u=(t[7],null);if(r===1&&s===0)(u=new J).version_number=o;else if((u=this.pat_)==null)return;for(var h=n-5-4,m=-1,A=-1,y=8;y<8+h;y+=4){var R=t[y]<<8|t[y+1],I=(31&t[y+2])<<8|t[y+3];R===0?u.network_pid=I:(u.program_pmt_pid[R]=I,m===-1&&(m=R),A===-1&&(A=I))}r===1&&s===0&&(this.pat_==null&&p.a.v(this.TAG,"Parsed first PAT: ".concat(JSON.stringify(u))),this.pat_=u,this.current_program_=m,this.current_pmt_pid_=A)}else p.a.e(this.TAG,"parsePAT: table_id ".concat(e," is not corresponded to PAT!"))},i.prototype.parsePMT=function(t){var e=t[0];if(e===2){var n=(15&t[1])<<8|t[2],o=t[3]<<8|t[4],r=(62&t[5])>>>1,s=1&t[5],u=t[6],h=(t[7],null);if(s===1&&u===0)(h=new K).program_number=o,h.version_number=r,this.program_pmt_map_[o]=h;else if((h=this.program_pmt_map_[o])==null)return;h.pcr_pid=(31&t[8])<<8|t[9];for(var m=(15&t[10])<<8|t[11],A=12+m,y=n-9-m-4,R=A;R<A+y;){var I=t[R],H=(31&t[R+1])<<8|t[R+2],x=(15&t[R+3])<<8|t[R+4];h.pid_stream_type[H]=I;var ee=h.common_pids.h264||h.common_pids.h265,Z=h.common_pids.adts_aac||h.common_pids.loas_aac||h.common_pids.ac3||h.common_pids.eac3||h.common_pids.opus||h.common_pids.mp3;if(I!==d.kH264||ee)if(I!==d.kH265||ee)if(I!==d.kADTSAAC||Z)if(I!==d.kLOASAAC||Z)if(I!==d.kAC3||Z)if(I!==d.kEAC3||Z)if(I!==d.kMPEG1Audio&&I!==d.kMPEG2Audio||Z)if(I===d.kPESPrivateData){if(h.pes_private_data_pids[H]=!0,x>0){for(var Y=R+5;Y<R+5+x;){var re=t[Y+0],fe=t[Y+1];if(re===5){var $=String.fromCharCode.apply(String,Array.from(t.subarray(Y+2,Y+2+fe)));$==="VANC"?h.smpte2038_pids[H]=!0:$==="AV01"?h.common_pids.av1=H:$==="Opus"?h.common_pids.opus=H:$==="KLVA"&&(h.asynchronous_klv_pids[H]=!0)}else if(re===127){if(H===h.common_pids.opus){var ae=null;if(t[Y+2]===128&&(ae=t[Y+3]),ae==null){p.a.e(this.TAG,"Not Supported Opus channel count.");continue}var pe={codec:"opus",channel_count:15&ae?15&ae:2,channel_config_code:ae,sample_rate:48e3},oe={codec:"opus",meta:pe};this.audio_init_segment_dispatched_==0?(this.audio_metadata_=pe,this.dispatchAudioInitSegment(oe)):this.detectAudioMetadataChange(oe)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(oe))}}else re===128&&H===h.common_pids.av1&&(this.video_metadata_.av1c=t.subarray(Y+2,Y+2+fe));Y+=2+fe}var le=t.subarray(R+5,R+5+x);this.dispatchPESPrivateDataDescriptor(H,I,le)}}else if(I===d.kMetadata){if(x>0)for(Y=R+5;Y<R+5+x;){re=t[Y+0];var Se=t[Y+1];if(re===38){var Ae=t[Y+2]<<8|t[Y+3]<<0,ue=null;Ae===65535&&(ue=String.fromCharCode.apply(String,Array.from(t.subarray(Y+4,Y+4+4))));var ge=null;if(t[Y+4+(Ae===65535?4:0)]===255){var Re=4+(Ae===65535?4:0)+1;ge=String.fromCharCode.apply(String,Array.from(t.subarray(Y+Re,Y+Re+4)))}ue==="ID3 "&&ge==="ID3 "?h.timed_id3_pids[H]=!0:ge==="KLVA"&&(h.synchronous_klv_pids[H]=!0)}Y+=2+Se}}else I===d.kSCTE35&&(h.scte_35_pids[H]=!0);else h.common_pids.mp3=H;else h.common_pids.eac3=H;else h.common_pids.ac3=H;else h.common_pids.loas_aac=H;else h.common_pids.adts_aac=H;else h.common_pids.h265=H;else h.common_pids.h264=H;R+=5+x}o===this.current_program_&&(this.pmt_==null&&p.a.v(this.TAG,"Parsed first PMT: ".concat(JSON.stringify(h))),this.pmt_=h,(h.common_pids.h264||h.common_pids.h265||h.common_pids.av1)&&(this.has_video_=!0),(h.common_pids.adts_aac||h.common_pids.loas_aac||h.common_pids.ac3||h.common_pids.opus||h.common_pids.mp3)&&(this.has_audio_=!0))}else p.a.e(this.TAG,"parsePMT: table_id ".concat(e," is not corresponded to PMT!"))},i.prototype.parseSCTE35=function(t){var e=Mt(t);if(e.pts!=null){var n=Math.floor(e.pts/this.timescale_);e.pts=n}else e.nearest_pts=this.getNearestTimestampMilliseconds();this.onSCTE35Metadata&&this.onSCTE35Metadata(e)},i.prototype.parseAV1Payload=function(t,e,n,o,r){for(var s=new Ht(t),u=null,h=[],m=0,A=!1,y=null;(u=s.readNextOBUPayload())!=null;){if((y=_.parseOBUs(u,this.video_metadata_.details))&&y.keyframe===!0)if(this.video_init_segment_dispatched_){if(this.detectVideoMetadataChange(null,y)===!0){var R;this.video_metadata_changed_=!0,this.dispatchVideoMediaSegment(),(R=new Uint8Array(new ArrayBuffer(this.video_metadata_.av1c.byteLength+y.sequence_header_data.byteLength))).set(this.video_metadata_.av1c,0),R.set(y.sequence_header_data,this.video_metadata_.av1c.byteLength),y.av1c=R,this.dispatchVideoInitSegment()}}else(R=new Uint8Array(new ArrayBuffer(this.video_metadata_.av1c.byteLength+y.sequence_header_data.byteLength))).set(this.video_metadata_.av1c,0),R.set(y.sequence_header_data,this.video_metadata_.av1c.byteLength),y.av1c=R,this.video_metadata_.details=y,this.dispatchVideoInitSegment();this.video_metadata_.details=y,A||(A=y.keyframe),h.push({data:u}),m+=u.byteLength}var I=Math.floor(e/this.timescale_),H=Math.floor(n/this.timescale_);if(h.length){var x=this.video_track_,ee={units:h,length:m,isKeyframe:A,dts:H,pts:I,cts:I-H,file_position:o};x.samples.push(ee),x.length+=m}},i.prototype.parseH264Payload=function(t,e,n,o,r){for(var s=new ne(t),u=null,h=[],m=0,A=!1;(u=s.readNextNaluPayload())!=null;){var y=new z(u);if(y.type===G.kSliceSPS){var R=N.parseSPS(u.data);this.video_init_segment_dispatched_?this.detectVideoMetadataChange(y,R)===!0&&(p.a.v(this.TAG,"H264: Critical h264 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:y,pps:void 0,av1c:void 0,details:R}):(this.video_metadata_.sps=y,this.video_metadata_.details=R)}else y.type===G.kSlicePPS?this.video_init_segment_dispatched_&&!this.video_metadata_changed_||(this.video_metadata_.pps=y,this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):(y.type===G.kSliceIDR||y.type===G.kSliceNonIDR&&r===1)&&(A=!0);this.video_init_segment_dispatched_&&(h.push(y),m+=y.data.byteLength)}var I=Math.floor(e/this.timescale_),H=Math.floor(n/this.timescale_);if(h.length){var x=this.video_track_,ee={units:h,length:m,isKeyframe:A,dts:H,pts:I,cts:I-H,file_position:o};x.samples.push(ee),x.length+=m}},i.prototype.parseH265Payload=function(t,e,n,o,r){for(var s=new Ot(t),u=null,h=[],m=0,A=!1;(u=s.readNextNaluPayload())!=null;){var y=new Dt(u);if(y.type===ke.kSliceVPS){if(!this.video_init_segment_dispatched_){var R=X.parseVPS(u.data);this.video_metadata_.vps=y,this.video_metadata_.details=Ge(Ge({},this.video_metadata_.details),R)}}else y.type===ke.kSliceSPS?(R=X.parseSPS(u.data),this.video_init_segment_dispatched_?this.detectVideoMetadataChange(y,R)===!0&&(p.a.v(this.TAG,"H265: Critical h265 metadata has been changed, attempt to re-generate InitSegment"),this.video_metadata_changed_=!0,this.video_metadata_={vps:void 0,sps:y,pps:void 0,av1c:void 0,details:R}):(this.video_metadata_.sps=y,this.video_metadata_.details=Ge(Ge({},this.video_metadata_.details),R))):y.type===ke.kSlicePPS?(!this.video_init_segment_dispatched_||this.video_metadata_changed_)&&(R=X.parsePPS(u.data),this.video_metadata_.pps=y,this.video_metadata_.details=Ge(Ge({},this.video_metadata_.details),R),this.video_metadata_.vps&&this.video_metadata_.sps&&this.video_metadata_.pps&&(this.video_metadata_changed_&&this.dispatchVideoMediaSegment(),this.dispatchVideoInitSegment())):y.type!==ke.kSliceIDR_W_RADL&&y.type!==ke.kSliceIDR_N_LP&&y.type!==ke.kSliceCRA_NUT||(A=!0);this.video_init_segment_dispatched_&&(h.push(y),m+=y.data.byteLength)}var I=Math.floor(e/this.timescale_),H=Math.floor(n/this.timescale_);if(h.length){var x=this.video_track_,ee={units:h,length:m,isKeyframe:A,dts:H,pts:I,cts:I-H,file_position:o};x.samples.push(ee),x.length+=m}},i.prototype.detectVideoMetadataChange=function(t,e){if(e.codec_mimetype!==this.video_metadata_.details.codec_mimetype)return p.a.v(this.TAG,"Video: Codec mimeType changed from "+"".concat(this.video_metadata_.details.codec_mimetype," to ").concat(e.codec_mimetype)),!0;if(e.codec_size.width!==this.video_metadata_.details.codec_size.width||e.codec_size.height!==this.video_metadata_.details.codec_size.height){var n=this.video_metadata_.details.codec_size,o=e.codec_size;return p.a.v(this.TAG,"Video: Coded Resolution changed from "+"".concat(n.width,"x").concat(n.height," to ").concat(o.width,"x").concat(o.height)),!0}return e.present_size.width!==this.video_metadata_.details.present_size.width&&(p.a.v(this.TAG,"Video: Present resolution width changed from "+"".concat(this.video_metadata_.details.present_size.width," to ").concat(e.present_size.width)),!0)},i.prototype.isInitSegmentDispatched=function(){return this.has_video_&&this.has_audio_?this.video_init_segment_dispatched_&&this.audio_init_segment_dispatched_:this.has_video_&&!this.has_audio_?this.video_init_segment_dispatched_:!(this.has_video_||!this.has_audio_)&&this.audio_init_segment_dispatched_},i.prototype.dispatchVideoInitSegment=function(){var t=this.video_metadata_.details,e={type:"video"};e.id=this.video_track_.id,e.timescale=1e3,e.duration=this.duration_,e.codecWidth=t.codec_size.width,e.codecHeight=t.codec_size.height,e.presentWidth=t.present_size.width,e.presentHeight=t.present_size.height,e.profile=t.profile_string,e.level=t.level_string,e.bitDepth=t.bit_depth,e.chromaFormat=t.chroma_format,e.sarRatio=t.sar_ratio,e.frameRate=t.frame_rate;var n=e.frameRate.fps_den,o=e.frameRate.fps_num;if(e.refSampleDuration=n/o*1e3,e.codec=t.codec_mimetype,this.video_metadata_.av1c)e.av1c=this.video_metadata_.av1c,this.video_init_segment_dispatched_==0&&p.a.v(this.TAG,"Generated first AV1 for mimeType: ".concat(e.codec));else if(this.video_metadata_.vps){var r=this.video_metadata_.vps.data.subarray(4),s=this.video_metadata_.sps.data.subarray(4),u=this.video_metadata_.pps.data.subarray(4),h=new Bt(r,s,u,t);e.hvcc=h.getData(),this.video_init_segment_dispatched_==0&&p.a.v(this.TAG,"Generated first HEVCDecoderConfigurationRecord for mimeType: ".concat(e.codec))}else{s=this.video_metadata_.sps.data.subarray(4),u=this.video_metadata_.pps.data.subarray(4);var m=new de(s,u,t);e.avcc=m.getData(),this.video_init_segment_dispatched_==0&&p.a.v(this.TAG,"Generated first AVCDecoderConfigurationRecord for mimeType: ".concat(e.codec))}this.onTrackMetadata("video",e),this.video_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var A=this.media_info_;A.hasVideo=!0,A.width=e.codecWidth,A.height=e.codecHeight,A.fps=e.frameRate.fps,A.profile=e.profile,A.level=e.level,A.refFrames=t.ref_frames,A.chromaFormat=t.chroma_format_string,A.sarNum=e.sarRatio.width,A.sarDen=e.sarRatio.height,A.videoCodec=e.codec,A.hasAudio&&A.audioCodec?A.mimeType='video/mp2t; codecs="'.concat(A.videoCodec,",").concat(A.audioCodec,'"'):A.mimeType='video/mp2t; codecs="'.concat(A.videoCodec,'"'),A.isComplete()&&this.onMediaInfo(A)},i.prototype.dispatchVideoMediaSegment=function(){this.isInitSegmentDispatched()&&this.video_track_.length&&this.onDataAvailable(null,this.video_track_)},i.prototype.dispatchAudioMediaSegment=function(){this.isInitSegmentDispatched()&&this.audio_track_.length&&this.onDataAvailable(this.audio_track_,null)},i.prototype.dispatchAudioVideoMediaSegment=function(){this.isInitSegmentDispatched()&&(this.audio_track_.length||this.video_track_.length)&&this.onDataAvailable(this.audio_track_,this.video_track_)},i.prototype.parseADTSAACPayload=function(t,e){if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var n=new Uint8Array(t.byteLength+this.aac_last_incomplete_data_.byteLength);n.set(this.aac_last_incomplete_data_,0),n.set(t,this.aac_last_incomplete_data_.byteLength),t=n}var o,r;if(e!=null&&(r=e/this.timescale_),this.audio_metadata_.codec==="aac"){if(e==null&&this.audio_last_sample_pts_!=null)o=1024/this.audio_metadata_.sampling_frequency*1e3,r=this.audio_last_sample_pts_+o;else if(e==null)return void p.a.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){o=1024/this.audio_metadata_.sampling_frequency*1e3;var s=this.audio_last_sample_pts_+o;Math.abs(s-r)>1&&(p.a.w(this.TAG,"AAC: Detected pts overlapped, "+"expected: ".concat(s,"ms, PES pts: ").concat(r,"ms")),r=s)}}for(var u,h=new he(t),m=null,A=r;(m=h.readNextAACFrame())!=null;){o=1024/m.sampling_frequency*1e3;var y={codec:"aac",data:m};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"aac",audio_object_type:m.audio_object_type,sampling_freq_index:m.sampling_freq_index,sampling_frequency:m.sampling_frequency,channel_config:m.channel_config},this.dispatchAudioInitSegment(y)):this.detectAudioMetadataChange(y)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(y)),u=A;var R=Math.floor(A),I={unit:m.data,length:m.data.byteLength,pts:R,dts:R};this.audio_track_.samples.push(I),this.audio_track_.length+=m.data.byteLength,A+=o}h.hasIncompleteData()&&(this.aac_last_incomplete_data_=h.getIncompleteData()),u&&(this.audio_last_sample_pts_=u)}},i.prototype.parseLOASAACPayload=function(t,e){var n;if(!this.has_video_||this.video_init_segment_dispatched_){if(this.aac_last_incomplete_data_){var o=new Uint8Array(t.byteLength+this.aac_last_incomplete_data_.byteLength);o.set(this.aac_last_incomplete_data_,0),o.set(t,this.aac_last_incomplete_data_.byteLength),t=o}var r,s;if(e!=null&&(s=e/this.timescale_),this.audio_metadata_.codec==="aac"){if(e==null&&this.audio_last_sample_pts_!=null)r=1024/this.audio_metadata_.sampling_frequency*1e3,s=this.audio_last_sample_pts_+r;else if(e==null)return void p.a.w(this.TAG,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){r=1024/this.audio_metadata_.sampling_frequency*1e3;var u=this.audio_last_sample_pts_+r;Math.abs(u-s)>1&&(p.a.w(this.TAG,"AAC: Detected pts overlapped, "+"expected: ".concat(u,"ms, PES pts: ").concat(s,"ms")),s=u)}}for(var h,m=new ve(t),A=null,y=s;(A=m.readNextAACFrame((n=this.loas_previous_frame)!==null&&n!==void 0?n:void 0))!=null;){this.loas_previous_frame=A,r=1024/A.sampling_frequency*1e3;var R={codec:"aac",data:A};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"aac",audio_object_type:A.audio_object_type,sampling_freq_index:A.sampling_freq_index,sampling_frequency:A.sampling_frequency,channel_config:A.channel_config},this.dispatchAudioInitSegment(R)):this.detectAudioMetadataChange(R)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(R)),h=y;var I=Math.floor(y),H={unit:A.data,length:A.data.byteLength,pts:I,dts:I};this.audio_track_.samples.push(H),this.audio_track_.length+=A.data.byteLength,y+=r}m.hasIncompleteData()&&(this.aac_last_incomplete_data_=m.getIncompleteData()),h&&(this.audio_last_sample_pts_=h)}},i.prototype.parseAC3Payload=function(t,e){if(!this.has_video_||this.video_init_segment_dispatched_){var n,o;if(e!=null&&(o=e/this.timescale_),this.audio_metadata_.codec==="ac-3"){if(e==null&&this.audio_last_sample_pts_!=null)n=1536/this.audio_metadata_.sampling_frequency*1e3,o=this.audio_last_sample_pts_+n;else if(e==null)return void p.a.w(this.TAG,"AC3: Unknown pts")}for(var r,s=new Nt(t),u=null,h=o;(u=s.readNextAC3Frame())!=null;){n=1536/u.sampling_frequency*1e3;var m={codec:"ac-3",data:u};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"ac-3",sampling_frequency:u.sampling_frequency,bit_stream_identification:u.bit_stream_identification,bit_stream_mode:u.bit_stream_mode,low_frequency_effects_channel_on:u.low_frequency_effects_channel_on,channel_mode:u.channel_mode},this.dispatchAudioInitSegment(m)):this.detectAudioMetadataChange(m)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(m)),r=h;var A=Math.floor(h),y={unit:u.data,length:u.data.byteLength,pts:A,dts:A};this.audio_track_.samples.push(y),this.audio_track_.length+=u.data.byteLength,h+=n}r&&(this.audio_last_sample_pts_=r)}},i.prototype.parseEAC3Payload=function(t,e){if(!this.has_video_||this.video_init_segment_dispatched_){var n,o;if(e!=null&&(o=e/this.timescale_),this.audio_metadata_.codec==="ec-3"){if(e==null&&this.audio_last_sample_pts_!=null)n=256*this.audio_metadata_.num_blks/this.audio_metadata_.sampling_frequency*1e3,o=this.audio_last_sample_pts_+n;else if(e==null)return void p.a.w(this.TAG,"EAC3: Unknown pts")}for(var r,s=new Gt(t),u=null,h=o;(u=s.readNextEAC3Frame())!=null;){n=1536/u.sampling_frequency*1e3;var m={codec:"ec-3",data:u};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"ec-3",sampling_frequency:u.sampling_frequency,bit_stream_identification:u.bit_stream_identification,low_frequency_effects_channel_on:u.low_frequency_effects_channel_on,num_blks:u.num_blks,channel_mode:u.channel_mode},this.dispatchAudioInitSegment(m)):this.detectAudioMetadataChange(m)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(m)),r=h;var A=Math.floor(h),y={unit:u.data,length:u.data.byteLength,pts:A,dts:A};this.audio_track_.samples.push(y),this.audio_track_.length+=u.data.byteLength,h+=n}r&&(this.audio_last_sample_pts_=r)}},i.prototype.parseOpusPayload=function(t,e){if(!this.has_video_||this.video_init_segment_dispatched_){var n,o;if(e!=null&&(o=e/this.timescale_),this.audio_metadata_.codec==="opus"){if(e==null&&this.audio_last_sample_pts_!=null)n=20,o=this.audio_last_sample_pts_+n;else if(e==null)return void p.a.w(this.TAG,"Opus: Unknown pts")}for(var r,s=o,u=0;u<t.length;){n=20;for(var h=(16&t[u+1])!=0,m=(8&t[u+1])!=0,A=u+2,y=0;t[A]===255;)y+=255,A+=1;y+=t[A],A+=1,A+=h?2:0,A+=m?2:0,r=s;var R=Math.floor(s),I=t.slice(A,A+y),H={unit:I,length:I.byteLength,pts:R,dts:R};this.audio_track_.samples.push(H),this.audio_track_.length+=I.byteLength,s+=n,u=A+y}r&&(this.audio_last_sample_pts_=r)}},i.prototype.parseMP3Payload=function(t,e){if(!this.has_video_||this.video_init_segment_dispatched_){var n=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],o=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],r=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],s=t[1]>>>3&3,u=(6&t[1])>>1,h=(240&t[2])>>>4,m=(12&t[2])>>>2,A=(t[3]>>>6&3)!==3?2:1,y=0,R=34;switch(s){case 0:y=[11025,12e3,8e3,0][m];break;case 2:y=[22050,24e3,16e3,0][m];break;case 3:y=[44100,48e3,32e3,0][m]}switch(u){case 1:R=34,h<r.length&&r[h];break;case 2:R=33,h<o.length&&o[h];break;case 3:R=32,h<n.length&&n[h]}var I=new Pt;I.object_type=R,I.sample_rate=y,I.channel_count=A,I.data=t;var H={codec:"mp3",data:I};this.audio_init_segment_dispatched_==0?(this.audio_metadata_={codec:"mp3",object_type:R,sample_rate:y,channel_count:A},this.dispatchAudioInitSegment(H)):this.detectAudioMetadataChange(H)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(H));var x={unit:t,length:t.byteLength,pts:e/this.timescale_,dts:e/this.timescale_};this.audio_track_.samples.push(x),this.audio_track_.length+=t.byteLength}},i.prototype.detectAudioMetadataChange=function(t){if(t.codec!==this.audio_metadata_.codec)return p.a.v(this.TAG,"Audio: Audio Codecs changed from "+"".concat(this.audio_metadata_.codec," to ").concat(t.codec)),!0;if(t.codec==="aac"&&this.audio_metadata_.codec==="aac"){if((e=t.data).audio_object_type!==this.audio_metadata_.audio_object_type)return p.a.v(this.TAG,"AAC: AudioObjectType changed from "+"".concat(this.audio_metadata_.audio_object_type," to ").concat(e.audio_object_type)),!0;if(e.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return p.a.v(this.TAG,"AAC: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sampling_freq_index," to ").concat(e.sampling_freq_index)),!0;if(e.channel_config!==this.audio_metadata_.channel_config)return p.a.v(this.TAG,"AAC: Channel configuration changed from "+"".concat(this.audio_metadata_.channel_config," to ").concat(e.channel_config)),!0}else if(t.codec==="ac-3"&&this.audio_metadata_.codec==="ac-3"){var e;if((e=t.data).sampling_frequency!==this.audio_metadata_.sampling_frequency)return p.a.v(this.TAG,"AC3: Sampling Frequency changed from "+"".concat(this.audio_metadata_.sampling_frequency," to ").concat(e.sampling_frequency)),!0;if(e.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return p.a.v(this.TAG,"AC3: Bit Stream Identification changed from "+"".concat(this.audio_metadata_.bit_stream_identification," to ").concat(e.bit_stream_identification)),!0;if(e.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return p.a.v(this.TAG,"AC3: BitStream Mode changed from "+"".concat(this.audio_metadata_.bit_stream_mode," to ").concat(e.bit_stream_mode)),!0;if(e.channel_mode!==this.audio_metadata_.channel_mode)return p.a.v(this.TAG,"AC3: Channel Mode changed from "+"".concat(this.audio_metadata_.channel_mode," to ").concat(e.channel_mode)),!0;if(e.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return p.a.v(this.TAG,"AC3: Low Frequency Effects Channel On changed from "+"".concat(this.audio_metadata_.low_frequency_effects_channel_on," to ").concat(e.low_frequency_effects_channel_on)),!0}else if(t.codec==="opus"&&this.audio_metadata_.codec==="opus"){if((n=t.meta).sample_rate!==this.audio_metadata_.sample_rate)return p.a.v(this.TAG,"Opus: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sample_rate," to ").concat(n.sample_rate)),!0;if(n.channel_count!==this.audio_metadata_.channel_count)return p.a.v(this.TAG,"Opus: Channel count changed from "+"".concat(this.audio_metadata_.channel_count," to ").concat(n.channel_count)),!0}else if(t.codec==="mp3"&&this.audio_metadata_.codec==="mp3"){var n;if((n=t.data).object_type!==this.audio_metadata_.object_type)return p.a.v(this.TAG,"MP3: AudioObjectType changed from "+"".concat(this.audio_metadata_.object_type," to ").concat(n.object_type)),!0;if(n.sample_rate!==this.audio_metadata_.sample_rate)return p.a.v(this.TAG,"MP3: SamplingFrequencyIndex changed from "+"".concat(this.audio_metadata_.sample_rate," to ").concat(n.sample_rate)),!0;if(n.channel_count!==this.audio_metadata_.channel_count)return p.a.v(this.TAG,"MP3: Channel count changed from "+"".concat(this.audio_metadata_.channel_count," to ").concat(n.channel_count)),!0}return!1},i.prototype.dispatchAudioInitSegment=function(t){var e={type:"audio"};if(e.id=this.audio_track_.id,e.timescale=1e3,e.duration=this.duration_,this.audio_metadata_.codec==="aac"){var n=t.codec==="aac"?t.data:null,o=new Me(n);e.audioSampleRate=o.sampling_rate,e.channelCount=o.channel_count,e.codec=o.codec_mimetype,e.originalCodec=o.original_codec_mimetype,e.config=o.config,e.refSampleDuration=1024/e.audioSampleRate*e.timescale}else if(this.audio_metadata_.codec==="ac-3"){var r=t.codec==="ac-3"?t.data:null,s=new Vt(r);e.audioSampleRate=s.sampling_rate,e.channelCount=s.channel_count,e.codec=s.codec_mimetype,e.originalCodec=s.original_codec_mimetype,e.config=s.config,e.refSampleDuration=1536/e.audioSampleRate*e.timescale}else if(this.audio_metadata_.codec==="ec-3"){var u=t.codec==="ec-3"?t.data:null,h=new jt(u);e.audioSampleRate=h.sampling_rate,e.channelCount=h.channel_count,e.codec=h.codec_mimetype,e.originalCodec=h.original_codec_mimetype,e.config=h.config,e.refSampleDuration=256*h.num_blks/e.audioSampleRate*e.timescale}else this.audio_metadata_.codec==="opus"?(e.audioSampleRate=this.audio_metadata_.sample_rate,e.channelCount=this.audio_metadata_.channel_count,e.channelConfigCode=this.audio_metadata_.channel_config_code,e.codec="opus",e.originalCodec="opus",e.config=void 0,e.refSampleDuration=20):this.audio_metadata_.codec==="mp3"&&(e.audioSampleRate=this.audio_metadata_.sample_rate,e.channelCount=this.audio_metadata_.channel_count,e.codec="mp3",e.originalCodec="mp3",e.config=void 0);this.audio_init_segment_dispatched_==0&&p.a.v(this.TAG,"Generated first AudioSpecificConfig for mimeType: ".concat(e.codec)),this.onTrackMetadata("audio",e),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;var m=this.media_info_;m.hasAudio=!0,m.audioCodec=e.originalCodec,m.audioSampleRate=e.audioSampleRate,m.audioChannelCount=e.channelCount,m.hasVideo&&m.videoCodec?m.mimeType='video/mp2t; codecs="'.concat(m.videoCodec,",").concat(m.audioCodec,'"'):m.mimeType='video/mp2t; codecs="'.concat(m.audioCodec,'"'),m.isComplete()&&this.onMediaInfo(m)},i.prototype.dispatchPESPrivateDataDescriptor=function(t,e,n){var o=new Ue;o.pid=t,o.stream_type=e,o.descriptor=n,this.onPESPrivateDataDescriptor&&this.onPESPrivateDataDescriptor(o)},i.prototype.parsePESPrivateDataPayload=function(t,e,n,o,r){var s=new Ce;if(s.pid=o,s.stream_id=r,s.len=t.byteLength,s.data=t,e!=null){var u=Math.floor(e/this.timescale_);s.pts=u}else s.nearest_pts=this.getNearestTimestampMilliseconds();if(n!=null){var h=Math.floor(n/this.timescale_);s.dts=h}this.onPESPrivateData&&this.onPESPrivateData(s)},i.prototype.parseTimedID3MetadataPayload=function(t,e,n,o,r){var s=new Ce;if(s.pid=o,s.stream_id=r,s.len=t.byteLength,s.data=t,e!=null){var u=Math.floor(e/this.timescale_);s.pts=u}if(n!=null){var h=Math.floor(n/this.timescale_);s.dts=h}this.onTimedID3Metadata&&this.onTimedID3Metadata(s)},i.prototype.parseSynchronousKLVMetadataPayload=function(t,e,n,o,r){var s=new zt;if(s.pid=o,s.stream_id=r,s.len=t.byteLength,s.data=t,e!=null){var u=Math.floor(e/this.timescale_);s.pts=u}if(n!=null){var h=Math.floor(n/this.timescale_);s.dts=h}s.access_units=function(m){for(var A=[],y=0;y+5<m.byteLength;){var R=m[y+0],I=m[y+1],H=m[y+2],x=m[y+3]<<8|m[y+4]<<0,ee=m.slice(y+5,y+5+x);A.push({service_id:R,sequence_number:I,flags:H,data:ee}),y+=5+x}return A}(t),this.onSynchronousKLVMetadata&&this.onSynchronousKLVMetadata(s)},i.prototype.parseAsynchronousKLVMetadataPayload=function(t,e,n){var o=new Ce;o.pid=e,o.stream_id=n,o.len=t.byteLength,o.data=t,this.onAsynchronousKLVMetadata&&this.onAsynchronousKLVMetadata(o)},i.prototype.parseSMPTE2038MetadataPayload=function(t,e,n,o,r){var s=new It;if(s.pid=o,s.stream_id=r,s.len=t.byteLength,s.data=t,e!=null){var u=Math.floor(e/this.timescale_);s.pts=u}if(s.nearest_pts=this.getNearestTimestampMilliseconds(),n!=null){var h=Math.floor(n/this.timescale_);s.dts=h}s.ancillaries=function(m){for(var A=new U(m),y=0,R=[];y+=6,A.readBits(6)===0;){var I=A.readBool();y+=1;var H=A.readBits(11);y+=11;var x=A.readBits(12);y+=12;var ee=255&A.readBits(10);y+=10;var Z=255&A.readBits(10);y+=10;var Y=255&A.readBits(10);y+=10;for(var re=new Uint8Array(Y),fe=0;fe<Y;fe++){var $=255&A.readBits(10);y+=10,re[fe]=$}A.readBits(10),y+=10;var ae="User Defined";ee===65?Z===7&&(ae="SCTE-104"):ee===95?Z===220?ae="ARIB STD-B37 (1SEG)":Z===221?ae="ARIB STD-B37 (ANALOG)":Z===222?ae="ARIB STD-B37 (SD)":Z===223&&(ae="ARIB STD-B37 (HD)"):ee===97&&(Z===1?ae="EIA-708":Z===2&&(ae="EIA-608")),R.push({yc_indicator:I,line_number:H,horizontal_offset:x,did:ee,sdid:Z,user_data:re,description:ae,information:{}}),A.readBits(8-(y-Math.floor(y/8))%8),y+=(8-(y-Math.floor(y/8)))%8}return A.destroy(),A=null,R}(t),this.onSMPTE2038Metadata&&this.onSMPTE2038Metadata(s)},i.prototype.getNearestTimestampMilliseconds=function(){return this.audio_last_sample_pts_!=null?Math.floor(this.audio_last_sample_pts_):this.last_pcr_!=null?Math.floor(this.last_pcr_/300/this.timescale_):void 0},i.prototype.getPcrBase=function(t){var e=33554432*t[6]+131072*t[7]+512*t[8]+2*t[9]+(128&t[10])/128+this.timestamp_offset_;return e+4294967296<this.last_pcr_base_&&(e+=8589934592,this.timestamp_offset_+=8589934592),this.last_pcr_base_=e,e},i.prototype.getTimestamp=function(t,e){var n=536870912*(14&t[e])+4194304*(255&t[e+1])+16384*(254&t[e+2])+128*(255&t[e+3])+(254&t[e+4])/2+this.timestamp_offset_;return n+4294967296<this.last_pcr_base_&&(n+=8589934592),n},i}(V),ot=function(a,i,t){for(var e,n=0,o=i.length;n<o;n++)!e&&n in i||(e||(e=Array.prototype.slice.call(i,0,n)),e[n]=i[n]);return a.concat(e||Array.prototype.slice.call(i))},st=function(){function a(){}return a.init=function(){for(var i in a.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],hvc1:[],hvcC:[],av01:[],av1C:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[],fLaC:[],dfLa:[]},a.types)a.types.hasOwnProperty(i)&&(a.types[i]=[i.charCodeAt(0),i.charCodeAt(1),i.charCodeAt(2),i.charCodeAt(3)]);var t=a.constants={};t.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),t.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),t.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSC=t.STCO=t.STTS,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),t.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),t.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},a.box=function(i){for(var t=8,e=null,n=Array.prototype.slice.call(arguments,1),o=n.length,r=0;r<o;r++)t+=n[r].byteLength;(e=new Uint8Array(t))[0]=t>>>24&255,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=255&t,e.set(i,4);var s=8;for(r=0;r<o;r++)e.set(n[r],s),s+=n[r].byteLength;return e},a.generateInitSegment=function(i){var t=a.box(a.types.ftyp,a.constants.FTYP),e=a.moov(i),n=new Uint8Array(t.byteLength+e.byteLength);return n.set(t,0),n.set(e,t.byteLength),n},a.moov=function(i){var t=a.mvhd(i.timescale,i.duration),e=a.trak(i),n=a.mvex(i);return a.box(a.types.moov,t,e,n)},a.mvhd=function(i,t){return a.box(a.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))},a.trak=function(i){return a.box(a.types.trak,a.tkhd(i),a.mdia(i))},a.tkhd=function(i){var t=i.id,e=i.duration,n=i.presentWidth,o=i.presentHeight;return a.box(a.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>>8&255,255&n,0,0,o>>>8&255,255&o,0,0]))},a.mdia=function(i){return a.box(a.types.mdia,a.mdhd(i),a.hdlr(i),a.minf(i))},a.mdhd=function(i){var t=i.timescale,e=i.duration;return a.box(a.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e,85,196,0,0]))},a.hdlr=function(i){var t=null;return t=i.type==="audio"?a.constants.HDLR_AUDIO:a.constants.HDLR_VIDEO,a.box(a.types.hdlr,t)},a.minf=function(i){var t=null;return t=i.type==="audio"?a.box(a.types.smhd,a.constants.SMHD):a.box(a.types.vmhd,a.constants.VMHD),a.box(a.types.minf,t,a.dinf(),a.stbl(i))},a.dinf=function(){return a.box(a.types.dinf,a.box(a.types.dref,a.constants.DREF))},a.stbl=function(i){return a.box(a.types.stbl,a.stsd(i),a.box(a.types.stts,a.constants.STTS),a.box(a.types.stsc,a.constants.STSC),a.box(a.types.stsz,a.constants.STSZ),a.box(a.types.stco,a.constants.STCO))},a.stsd=function(i){return i.type==="audio"?i.codec==="mp3"?a.box(a.types.stsd,a.constants.STSD_PREFIX,a.mp3(i)):i.codec==="ac-3"?a.box(a.types.stsd,a.constants.STSD_PREFIX,a.ac3(i)):i.codec==="ec-3"?a.box(a.types.stsd,a.constants.STSD_PREFIX,a.ec3(i)):i.codec==="opus"?a.box(a.types.stsd,a.constants.STSD_PREFIX,a.Opus(i)):i.codec=="flac"?a.box(a.types.stsd,a.constants.STSD_PREFIX,a.fLaC(i)):a.box(a.types.stsd,a.constants.STSD_PREFIX,a.mp4a(i)):i.type==="video"&&i.codec.startsWith("hvc1")?a.box(a.types.stsd,a.constants.STSD_PREFIX,a.hvc1(i)):i.type==="video"&&i.codec.startsWith("av01")?a.box(a.types.stsd,a.constants.STSD_PREFIX,a.av01(i)):a.box(a.types.stsd,a.constants.STSD_PREFIX,a.avc1(i))},a.mp3=function(i){var t=i.channelCount,e=i.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return a.box(a.types[".mp3"],n)},a.mp4a=function(i){var t=i.channelCount,e=i.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return a.box(a.types.mp4a,n,a.esds(i))},a.ac3=function(i){var t=i.channelCount,e=i.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return a.box(a.types["ac-3"],n,a.box(a.types.dac3,new Uint8Array(i.config)))},a.ec3=function(i){var t=i.channelCount,e=i.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return a.box(a.types["ec-3"],n,a.box(a.types.dec3,new Uint8Array(i.config)))},a.esds=function(i){var t=i.config||[],e=t.length,n=new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t).concat([6,1,2]));return a.box(a.types.esds,n)},a.Opus=function(i){var t=i.channelCount,e=i.audioSampleRate,n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return a.box(a.types.Opus,n,a.dOps(i))},a.dOps=function(i){var t=i.channelCount,e=i.channelConfigCode,n=i.audioSampleRate;if(i.config)return a.box(a.types.dOps,i.config);var o=[];switch(e){case 1:case 2:o=[0];break;case 0:o=[255,1,1,0,1];break;case 128:o=[255,2,0,0,1];break;case 3:o=[1,2,1,0,2,1];break;case 4:o=[1,2,2,0,1,2,3];break;case 5:o=[1,3,2,0,4,1,2,3];break;case 6:o=[1,4,2,0,4,1,2,3,5];break;case 7:o=[1,4,2,0,4,1,2,3,5,6];break;case 8:o=[1,5,3,0,6,1,2,3,4,5,7];break;case 130:o=[1,1,2,0,1];break;case 131:o=[1,1,3,0,1,2];break;case 132:o=[1,1,4,0,1,2,3];break;case 133:o=[1,1,5,0,1,2,3,4];break;case 134:o=[1,1,6,0,1,2,3,4,5];break;case 135:o=[1,1,7,0,1,2,3,4,5,6];break;case 136:o=[1,1,8,0,1,2,3,4,5,6,7]}var r=new Uint8Array(ot([0,t,0,0,n>>>24&255,n>>>17&255,n>>>8&255,n>>>0&255,0,0],o));return a.box(a.types.dOps,r)},a.fLaC=function(i){var t=i.channelCount,e=Math.min(i.audioSampleRate,65535),n=i.sampleSize,o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,n,0,0,0,0,e>>>8&255,255&e,0,0]);return a.box(a.types.fLaC,o,a.dfLa(i))},a.dfLa=function(i){var t=new Uint8Array(ot([0,0,0,0],i.config));return a.box(a.types.dfLa,t)},a.avc1=function(i){var t=i.avcc,e=i.codecWidth,n=i.codecHeight,o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e>>>8&255,255&e,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return a.box(a.types.avc1,o,a.box(a.types.avcC,t))},a.hvc1=function(i){var t=i.hvcc,e=i.codecWidth,n=i.codecHeight,o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e>>>8&255,255&e,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return a.box(a.types.hvc1,o,a.box(a.types.hvcC,t))},a.av01=function(i){var t=i.av1c,e=i.codecWidth||192,n=i.codecHeight||108,o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e>>>8&255,255&e,n>>>8&255,255&n,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return a.box(a.types.av01,o,a.box(a.types.av1C,t))},a.mvex=function(i){return a.box(a.types.mvex,a.trex(i))},a.trex=function(i){var t=i.id,e=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return a.box(a.types.trex,e)},a.moof=function(i,t){return a.box(a.types.moof,a.mfhd(i.sequenceNumber),a.traf(i,t))},a.mfhd=function(i){var t=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]);return a.box(a.types.mfhd,t)},a.traf=function(i,t){var e=i.id,n=a.box(a.types.tfhd,new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e])),o=a.box(a.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),r=a.sdtp(i),s=a.trun(i,r.byteLength+16+16+8+16+8+8);return a.box(a.types.traf,n,o,s,r)},a.sdtp=function(i){for(var t=i.samples||[],e=t.length,n=new Uint8Array(4+e),o=0;o<e;o++){var r=t[o].flags;n[o+4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy}return a.box(a.types.sdtp,n)},a.trun=function(i,t){var e=i.samples||[],n=e.length,o=12+16*n,r=new Uint8Array(o);t+=8+o,r.set([0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(var s=0;s<n;s++){var u=e[s].duration,h=e[s].size,m=e[s].flags,A=e[s].cts;r.set([u>>>24&255,u>>>16&255,u>>>8&255,255&u,h>>>24&255,h>>>16&255,h>>>8&255,255&h,m.isLeading<<2|m.dependsOn,m.isDependedOn<<6|m.hasRedundancy<<4|m.isNonSync,0,0,A>>>24&255,A>>>16&255,A>>>8&255,255&A],12+16*s)}return a.box(a.types.trun,r)},a.mdat=function(i){return a.box(a.types.mdat,i)},a}();st.init();var je=st,dt=function(){function a(){}return a.getSilentFrame=function(i,t){if(i==="mp4a.40.2"){if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},a}(),Ne=D(11),_t=function(){function a(i){this.TAG="MP4Remuxer",this._config=i,this._isLive=i.isLive===!0,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new Ne.c("audio"),this._videoSegmentInfoList=new Ne.c("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!v.a.chrome||!(v.a.version.major<50||v.a.version.major===50&&v.a.version.build<2661)),this._fillSilentAfterSeek=v.a.msedge||v.a.msie,this._mp3UseMpegAudio=!v.a.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return a.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},a.prototype.bindDataSource=function(i){return i.onDataAvailable=this.remux.bind(this),i.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(a.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(i){this._onInitSegment=i},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(i){this._onMediaSegment=i},enumerable:!1,configurable:!0}),a.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},a.prototype.seek=function(i){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},a.prototype.remux=function(i,t){if(!this._onMediaSegment)throw new L.a("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(i,t),t&&this._remuxVideo(t),i&&this._remuxAudio(i)},a.prototype._onTrackMetadataReceived=function(i,t){var e=null,n="mp4",o=t.codec;if(i==="audio")this._audioMeta=t,t.codec==="mp3"&&this._mp3UseMpegAudio?(n="mpeg",o="",e=new Uint8Array):e=je.generateInitSegment(t);else{if(i!=="video")return;this._videoMeta=t,e=je.generateInitSegment(t)}if(!this._onInitSegment)throw new L.a("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(i,{type:i,data:e.buffer,codec:o,container:"".concat(i,"/").concat(n),mediaDuration:t.duration})},a.prototype._calculateDtsBase=function(i,t){this._dtsBaseInited||(i&&i.samples&&i.samples.length&&(this._audioDtsBase=i.samples[0].dts),t&&t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},a.prototype.getTimestampBase=function(){if(this._dtsBaseInited)return this._dtsBase},a.prototype.flushStashedSamples=function(){var i=this._videoStashedLastSample,t=this._audioStashedLastSample,e={type:"video",id:1,sequenceNumber:0,samples:[],length:0};i!=null&&(e.samples.push(i),e.length=i.length);var n={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};t!=null&&(n.samples.push(t),n.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(e,!0),this._remuxAudio(n,!0)},a.prototype._remuxAudio=function(i,t){if(this._audioMeta!=null){var e,n=i,o=n.samples,r=void 0,s=-1,u=this._audioMeta.refSampleDuration,h=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,m=this._dtsBaseInited&&this._audioNextDts===void 0,A=!1;if(o&&o.length!==0&&(o.length!==1||t)){var y=0,R=null,I=0;h?(y=0,I=n.length):(y=8,I=8+n.length);var H=null;if(o.length>1&&(I-=(H=o.pop()).length),this._audioStashedLastSample!=null){var x=this._audioStashedLastSample;this._audioStashedLastSample=null,o.unshift(x),I+=x.length}H!=null&&(this._audioStashedLastSample=H);var ee=o[0].dts-this._dtsBase;if(this._audioNextDts)r=ee-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())r=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!=="mp3"&&(A=!0);else{var Z=this._audioSegmentInfoList.getLastSampleBefore(ee);if(Z!=null){var Y=ee-(Z.originalDts+Z.duration);Y<=3&&(Y=0),r=ee-(Z.dts+Z.duration+Y)}else r=0}if(A){var re=ee-r,fe=this._videoSegmentInfoList.getLastSegmentBefore(ee);if(fe!=null&&fe.beginDts<re){if(Le=dt.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var $=fe.beginDts,ae=re-fe.beginDts;p.a.v(this.TAG,"InsertPrefixSilentAudio: dts: ".concat($,", duration: ").concat(ae)),o.unshift({unit:Le,dts:$,pts:$}),I+=Le.byteLength}}else A=!1}for(var pe=[],oe=0;oe<o.length;oe++){var le=(x=o[oe]).unit,Se=x.dts-this._dtsBase,Ae=($=Se,!1),ue=null,ge=0;if(!(Se<-.001)){if(this._audioMeta.codec!=="mp3"&&u!=null){var Re=Se;if(this._audioNextDts&&(Re=this._audioNextDts),(r=Se-Re)<=-3*u){p.a.w(this.TAG,"Dropping 1 audio frame (originalDts: ".concat(Se," ms ,curRefDts: ").concat(Re," ms) due to dtsCorrection: ").concat(r," ms overlap."));continue}if(r>=3*u&&this._fillAudioTimestampGap&&!v.a.safari){Ae=!0;var Le,xe=Math.floor(r/u);p.a.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
`+"originalDts: ".concat(Se," ms, curRefDts: ").concat(Re," ms, ")+"dtsCorrection: ".concat(Math.round(r)," ms, generate: ").concat(xe," frames")),$=Math.floor(Re),ge=Math.floor(Re+u)-$,(Le=dt.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))==null&&(p.a.w(this.TAG,"Unable to generate silent frame for "+"".concat(this._audioMeta.originalCodec," with ").concat(this._audioMeta.channelCount," channels, repeat last frame")),Le=le),ue=[];for(var De=0;De<xe;De++){Re+=u;var Pe=Math.floor(Re),Be=Math.floor(Re+u)-Pe,Oe={dts:Pe,pts:Pe,cts:0,unit:Le,size:Le.byteLength,duration:Be,originalDts:Se,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};ue.push(Oe),I+=Oe.size}this._audioNextDts=Re+u}else $=Math.floor(Re),ge=Math.floor(Re+u)-$,this._audioNextDts=Re+u}else $=Se-r,oe!==o.length-1?ge=o[oe+1].dts-this._dtsBase-r-$:H!=null?ge=H.dts-this._dtsBase-r-$:ge=pe.length>=1?pe[pe.length-1].duration:Math.floor(u),this._audioNextDts=$+ge;s===-1&&(s=$),pe.push({dts:$,pts:$,cts:0,unit:x.unit,size:x.unit.byteLength,duration:ge,originalDts:Se,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),Ae&&pe.push.apply(pe,ue)}}if(pe.length===0)return n.samples=[],void(n.length=0);for(h?R=new Uint8Array(I):((R=new Uint8Array(I))[0]=I>>>24&255,R[1]=I>>>16&255,R[2]=I>>>8&255,R[3]=255&I,R.set(je.types.mdat,4)),oe=0;oe<pe.length;oe++)le=pe[oe].unit,R.set(le,y),y+=le.byteLength;var Ie=pe[pe.length-1];e=Ie.dts+Ie.duration;var be=new Ne.b;be.beginDts=s,be.endDts=e,be.beginPts=s,be.endPts=e,be.originalBeginDts=pe[0].originalDts,be.originalEndDts=Ie.originalDts+Ie.duration,be.firstSample=new Ne.d(pe[0].dts,pe[0].pts,pe[0].duration,pe[0].originalDts,!1),be.lastSample=new Ne.d(Ie.dts,Ie.pts,Ie.duration,Ie.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(be),n.samples=pe,n.sequenceNumber++;var Ve=null;Ve=h?new Uint8Array:je.moof(n,s),n.samples=[],n.length=0;var Fe={type:"audio",data:this._mergeBoxes(Ve,R).buffer,sampleCount:pe.length,info:be};h&&m&&(Fe.timestampOffset=s),this._onMediaSegment("audio",Fe)}}},a.prototype._remuxVideo=function(i,t){if(this._videoMeta!=null){var e,n,o=i,r=o.samples,s=void 0,u=-1,h=-1;if(r&&r.length!==0&&(r.length!==1||t)){var m=8,A=null,y=8+i.length,R=null;if(r.length>1&&(y-=(R=r.pop()).length),this._videoStashedLastSample!=null){var I=this._videoStashedLastSample;this._videoStashedLastSample=null,r.unshift(I),y+=I.length}R!=null&&(this._videoStashedLastSample=R);var H=r[0].dts-this._dtsBase;if(this._videoNextDts)s=H-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())s=0;else{var x=this._videoSegmentInfoList.getLastSampleBefore(H);if(x!=null){var ee=H-(x.originalDts+x.duration);ee<=3&&(ee=0),s=H-(x.dts+x.duration+ee)}else s=0}for(var Z=new Ne.b,Y=[],re=0;re<r.length;re++){var fe=(I=r[re]).dts-this._dtsBase,$=I.isKeyframe,ae=fe-s,pe=I.cts,oe=ae+pe;u===-1&&(u=ae,h=oe);var le=0;if(re!==r.length-1?le=r[re+1].dts-this._dtsBase-s-ae:R!=null?le=R.dts-this._dtsBase-s-ae:le=Y.length>=1?Y[Y.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),$){var Se=new Ne.d(ae,oe,le,I.dts,!0);Se.fileposition=I.fileposition,Z.appendSyncPoint(Se)}Y.push({dts:ae,pts:oe,cts:pe,units:I.units,size:I.length,isKeyframe:$,duration:le,originalDts:fe,flags:{isLeading:0,dependsOn:$?2:1,isDependedOn:$?1:0,hasRedundancy:0,isNonSync:$?0:1}})}for((A=new Uint8Array(y))[0]=y>>>24&255,A[1]=y>>>16&255,A[2]=y>>>8&255,A[3]=255&y,A.set(je.types.mdat,4),re=0;re<Y.length;re++)for(var Ae=Y[re].units;Ae.length;){var ue=Ae.shift().data;A.set(ue,m),m+=ue.byteLength}var ge=Y[Y.length-1];if(e=ge.dts+ge.duration,n=ge.pts+ge.duration,this._videoNextDts=e,Z.beginDts=u,Z.endDts=e,Z.beginPts=h,Z.endPts=n,Z.originalBeginDts=Y[0].originalDts,Z.originalEndDts=ge.originalDts+ge.duration,Z.firstSample=new Ne.d(Y[0].dts,Y[0].pts,Y[0].duration,Y[0].originalDts,Y[0].isKeyframe),Z.lastSample=new Ne.d(ge.dts,ge.pts,ge.duration,ge.originalDts,ge.isKeyframe),this._isLive||this._videoSegmentInfoList.append(Z),o.samples=Y,o.sequenceNumber++,this._forceFirstIDR){var Re=Y[0].flags;Re.dependsOn=2,Re.isNonSync=0}var Le=je.moof(o,u);o.samples=[],o.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(Le,A).buffer,sampleCount:Y.length,info:Z})}}},a.prototype._mergeBoxes=function(i,t){var e=new Uint8Array(i.byteLength+t.byteLength);return e.set(i,0),e.set(t,i.byteLength),e},a}(),Kt=D(14),we=D(1),Wt=(D(2),function(){function a(i,t){this.TAG="TransmuxingController",this._emitter=new M.a,this._config=t,i.segments||(i.segments=[{duration:i.duration,filesize:i.filesize,url:i.url}]),typeof i.cors!="boolean"&&(i.cors=!0),typeof i.withCredentials!="boolean"&&(i.withCredentials=!1),this._mediaDataSource=i,this._currentSegmentIndex=0;var e=0;this._mediaDataSource.segments.forEach(function(n){n.timestampBase=e,e+=n.duration,n.cors=i.cors,n.withCredentials=i.withCredentials,t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy)}),isNaN(e)||this._mediaDataSource.duration===e||(this._mediaDataSource.duration=e),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return a.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},a.prototype.on=function(i,t){this._emitter.addListener(i,t)},a.prototype.off=function(i,t){this._emitter.removeListener(i,t)},a.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},a.prototype._loadSegment=function(i,t){this._currentSegmentIndex=i;var e=this._mediaDataSource.segments[i],n=this._ioctl=new Kt.a(e,this._config,i);n.onError=this._onIOException.bind(this),n.onSeeked=this._onIOSeeked.bind(this),n.onComplete=this._onIOComplete.bind(this),n.onRedirect=this._onIORedirect.bind(this),n.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):n.onDataArrival=this._onInitChunkArrival.bind(this),n.open(t)},a.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},a.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},a.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},a.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},a.prototype.seek=function(i){if(this._mediaInfo!=null&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(i);if(t===this._currentSegmentIndex){var e=this._mediaInfo.segments[t];if(e==null)this._pendingSeekTime=i;else{var n=e.getNearestKeyframe(i);this._remuxer.seek(n.milliseconds),this._ioctl.seek(n.fileposition),this._pendingResolveSeekPoint=n.milliseconds}}else{var o=this._mediaInfo.segments[t];o==null?(this._pendingSeekTime=i,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t)):(n=o.getNearestKeyframe(i),this._internalAbort(),this._remuxer.seek(i),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,n.fileposition),this._pendingResolveSeekPoint=n.milliseconds,this._reportSegmentMediaInfo(t))}this._enableStatisticsReporter()}},a.prototype._searchSegmentIndexContains=function(i){for(var t=this._mediaDataSource.segments,e=t.length-1,n=0;n<t.length;n++)if(i<t[n].timestampBase){e=n-1;break}return e},a.prototype._onInitChunkArrival=function(i,t){var e=this,n=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,n=this._demuxer.parseChunks(i,t);else{var o=null;(o=f.probe(i)).match&&(this._setupFLVDemuxerRemuxer(o),n=this._demuxer.parseChunks(i,t)),o.match||o.needMoreData||(o=rt.probe(i)).match&&(this._setupTSDemuxerRemuxer(o),n=this._demuxer.parseChunks(i,t)),o.match||o.needMoreData||(o=null,p.a.e(this.TAG,"Non MPEG-TS/FLV, Unsupported media type!"),Promise.resolve().then(function(){e._internalAbort()}),this._emitter.emit(we.a.DEMUX_ERROR,P.a.FORMAT_UNSUPPORTED,"Non MPEG-TS/FLV, Unsupported media type!"))}return n},a.prototype._setupFLVDemuxerRemuxer=function(i){this._demuxer=new f(i,this._config),this._remuxer||(this._remuxer=new _t(this._config));var t=this._mediaDataSource;t.duration==null||isNaN(t.duration)||(this._demuxer.overridedDuration=t.duration),typeof t.hasAudio=="boolean"&&(this._demuxer.overridedHasAudio=t.hasAudio),typeof t.hasVideo=="boolean"&&(this._demuxer.overridedHasVideo=t.hasVideo),this._demuxer.timestampBase=t.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this)},a.prototype._setupTSDemuxerRemuxer=function(i){var t=this._demuxer=new rt(i,this._config);this._remuxer||(this._remuxer=new _t(this._config)),t.onError=this._onDemuxException.bind(this),t.onMediaInfo=this._onMediaInfo.bind(this),t.onMetaDataArrived=this._onMetaDataArrived.bind(this),t.onTimedID3Metadata=this._onTimedID3Metadata.bind(this),t.onSynchronousKLVMetadata=this._onSynchronousKLVMetadata.bind(this),t.onAsynchronousKLVMetadata=this._onAsynchronousKLVMetadata.bind(this),t.onSMPTE2038Metadata=this._onSMPTE2038Metadata.bind(this),t.onSCTE35Metadata=this._onSCTE35Metadata.bind(this),t.onPESPrivateDataDescriptor=this._onPESPrivateDataDescriptor.bind(this),t.onPESPrivateData=this._onPESPrivateData.bind(this),this._remuxer.bindDataSource(this._demuxer),this._demuxer.bindDataSource(this._ioctl),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this)},a.prototype._onMediaInfo=function(i){var t=this;this._mediaInfo==null&&(this._mediaInfo=Object.assign({},i),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,S.a.prototype));var e=Object.assign({},i);Object.setPrototypeOf(e,S.a.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=e,this._reportSegmentMediaInfo(this._currentSegmentIndex),this._pendingSeekTime!=null&&Promise.resolve().then(function(){var n=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(n)})},a.prototype._onMetaDataArrived=function(i){this._emitter.emit(we.a.METADATA_ARRIVED,i)},a.prototype._onScriptDataArrived=function(i){this._emitter.emit(we.a.SCRIPTDATA_ARRIVED,i)},a.prototype._onTimedID3Metadata=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),i.dts!=null&&(i.dts-=t),this._emitter.emit(we.a.TIMED_ID3_METADATA_ARRIVED,i))},a.prototype._onSynchronousKLVMetadata=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),i.dts!=null&&(i.dts-=t),this._emitter.emit(we.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,i))},a.prototype._onAsynchronousKLVMetadata=function(i){this._emitter.emit(we.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,i)},a.prototype._onSMPTE2038Metadata=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),i.dts!=null&&(i.dts-=t),i.nearest_pts!=null&&(i.nearest_pts-=t),this._emitter.emit(we.a.SMPTE2038_METADATA_ARRIVED,i))},a.prototype._onSCTE35Metadata=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),i.nearest_pts!=null&&(i.nearest_pts-=t),this._emitter.emit(we.a.SCTE35_METADATA_ARRIVED,i))},a.prototype._onPESPrivateDataDescriptor=function(i){this._emitter.emit(we.a.PES_PRIVATE_DATA_DESCRIPTOR,i)},a.prototype._onPESPrivateData=function(i){var t=this._remuxer.getTimestampBase();t!=null&&(i.pts!=null&&(i.pts-=t),i.nearest_pts!=null&&(i.nearest_pts-=t),i.dts!=null&&(i.dts-=t),this._emitter.emit(we.a.PES_PRIVATE_DATA_ARRIVED,i))},a.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},a.prototype._onIOComplete=function(i){var t=i+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer&&this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer&&this._remuxer.flushStashedSamples(),this._emitter.emit(we.a.LOADING_COMPLETE),this._disableStatisticsReporter())},a.prototype._onIORedirect=function(i){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=i},a.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(we.a.RECOVERED_EARLY_EOF)},a.prototype._onIOException=function(i,t){p.a.e(this.TAG,"IOException: type = ".concat(i,", code = ").concat(t.code,", msg = ").concat(t.msg)),this._emitter.emit(we.a.IO_ERROR,i,t),this._disableStatisticsReporter()},a.prototype._onDemuxException=function(i,t){p.a.e(this.TAG,"DemuxException: type = ".concat(i,", info = ").concat(t)),this._emitter.emit(we.a.DEMUX_ERROR,i,t)},a.prototype._onRemuxerInitSegmentArrival=function(i,t){this._emitter.emit(we.a.INIT_SEGMENT,i,t)},a.prototype._onRemuxerMediaSegmentArrival=function(i,t){if(this._pendingSeekTime==null&&(this._emitter.emit(we.a.MEDIA_SEGMENT,i,t),this._pendingResolveSeekPoint!=null&&i==="video")){var e=t.info.syncPoints,n=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,v.a.safari&&e.length>0&&e[0].originalDts===n&&(n=e[0].pts),this._emitter.emit(we.a.RECOMMEND_SEEKPOINT,n)}},a.prototype._enableStatisticsReporter=function(){this._statisticsReporter==null&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},a.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},a.prototype._reportSegmentMediaInfo=function(i){var t=this._mediaInfo.segments[i],e=Object.assign({},t);e.duration=this._mediaInfo.duration,e.segmentCount=this._mediaInfo.segmentCount,delete e.segments,delete e.keyframesIndex,this._emitter.emit(we.a.MEDIA_INFO,e)},a.prototype._reportStatisticsInfo=function(){var i={};i.url=this._ioctl.currentURL,i.hasRedirect=this._ioctl.hasRedirect,i.hasRedirect&&(i.redirectedURL=this._ioctl.currentRedirectedURL),i.speed=this._ioctl.currentSpeed,i.loaderType=this._ioctl.loaderType,i.currentSegmentIndex=this._currentSegmentIndex,i.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(we.a.STATISTICS_INFO,i)},a}());te.a=Wt},function(me,te,D){var F,M=D(0),p=function(){function O(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return O.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},O.prototype.addBytes=function(l){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=l,this._totalBytes+=l):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=l,this._totalBytes+=l):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=l,this._totalBytes+=l,this._lastCheckpoint=this._now())},Object.defineProperty(O.prototype,"currentKBps",{get:function(){this.addBytes(0);var l=(this._now()-this._lastCheckpoint)/1e3;return l==0&&(l=1),this._intervalBytes/l/1024},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),this._lastSecondBytes!==0?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"averageKBps",{get:function(){var l=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/l/1024},enumerable:!1,configurable:!0}),O}(),v=D(2),S=D(5),g=D(3),T=(F=function(O,l){return(F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,d){_.__proto__=d}||function(_,d){for(var f in d)Object.prototype.hasOwnProperty.call(d,f)&&(_[f]=d[f])})(O,l)},function(O,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function _(){this.constructor=O}F(O,l),O.prototype=l===null?Object.create(l):(_.prototype=l.prototype,new _)}),E=function(O){function l(_,d){var f=O.call(this,"fetch-stream-loader")||this;return f.TAG="FetchStreamLoader",f._seekHandler=_,f._config=d,f._needStash=!0,f._requestAbort=!1,f._abortController=null,f._contentLength=null,f._receivedLength=0,f}return T(l,O),l.isSupported=function(){try{var _=S.a.msedge&&S.a.version.minor>=15048,d=!S.a.msedge||_;return self.fetch&&self.ReadableStream&&d}catch{return!1}},l.prototype.destroy=function(){this.isWorking()&&this.abort(),O.prototype.destroy.call(this)},l.prototype.open=function(_,d){var f=this;this._dataSource=_,this._range=d;var V=_.url;this._config.reuseRedirectedURL&&_.redirectedURL!=null&&(V=_.redirectedURL);var J=this._seekHandler.getConfig(V,d),G=new self.Headers;if(typeof J.headers=="object"){var K=J.headers;for(var se in K)K.hasOwnProperty(se)&&G.append(se,K[se])}var Ee={method:"GET",headers:G,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(typeof this._config.headers=="object")for(var se in this._config.headers)G.append(se,this._config.headers[se]);_.cors===!1&&(Ee.mode="same-origin"),_.withCredentials&&(Ee.credentials="include"),_.referrerPolicy&&(Ee.referrerPolicy=_.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,Ee.signal=this._abortController.signal),this._status=v.c.kConnecting,self.fetch(J.url,Ee).then(function(_e){if(f._requestAbort)return f._status=v.c.kIdle,void _e.body.cancel();if(_e.ok&&_e.status>=200&&_e.status<=299){if(_e.url!==J.url&&f._onURLRedirect){var b=f._seekHandler.removeURLParameters(_e.url);f._onURLRedirect(b)}var c=_e.headers.get("Content-Length");return c!=null&&(f._contentLength=parseInt(c),f._contentLength!==0&&f._onContentLengthKnown&&f._onContentLengthKnown(f._contentLength)),f._pump.call(f,_e.body.getReader())}if(f._status=v.c.kError,!f._onError)throw new g.d("FetchStreamLoader: Http code invalid, "+_e.status+" "+_e.statusText);f._onError(v.b.HTTP_STATUS_CODE_INVALID,{code:_e.status,msg:_e.statusText})}).catch(function(_e){if(!f._abortController||!f._abortController.signal.aborted){if(f._status=v.c.kError,!f._onError)throw _e;f._onError(v.b.EXCEPTION,{code:-1,msg:_e.message})}})},l.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==v.c.kBuffering||!S.a.chrome)&&this._abortController)try{this._abortController.abort()}catch{}},l.prototype._pump=function(_){var d=this;return _.read().then(function(f){if(f.done)if(d._contentLength!==null&&d._receivedLength<d._contentLength){d._status=v.c.kError;var V=v.b.EARLY_EOF,J={code:-1,msg:"Fetch stream meet Early-EOF"};if(!d._onError)throw new g.d(J.msg);d._onError(V,J)}else d._status=v.c.kComplete,d._onComplete&&d._onComplete(d._range.from,d._range.from+d._receivedLength-1);else{if(d._abortController&&d._abortController.signal.aborted)return void(d._status=v.c.kComplete);if(d._requestAbort===!0)return d._status=v.c.kComplete,_.cancel();d._status=v.c.kBuffering;var G=f.value.buffer,K=d._range.from+d._receivedLength;d._receivedLength+=G.byteLength,d._onDataArrival&&d._onDataArrival(G,K,d._receivedLength),d._pump(_)}}).catch(function(f){if(d._abortController&&d._abortController.signal.aborted)d._status=v.c.kComplete;else if(f.code!==11||!S.a.msedge){d._status=v.c.kError;var V=0,J=null;if(f.code!==19&&f.message!=="network error"||!(d._contentLength===null||d._contentLength!==null&&d._receivedLength<d._contentLength)?(V=v.b.EXCEPTION,J={code:f.code,msg:f.message}):(V=v.b.EARLY_EOF,J={code:f.code,msg:"Fetch stream meet Early-EOF"}),!d._onError)throw new g.d(J.msg);d._onError(V,J)}})},l}(v.a),L=function(){var O=function(l,_){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var V in f)Object.prototype.hasOwnProperty.call(f,V)&&(d[V]=f[V])})(l,_)};return function(l,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");function d(){this.constructor=l}O(l,_),l.prototype=_===null?Object.create(_):(d.prototype=_.prototype,new d)}}(),B=function(O){function l(_,d){var f=O.call(this,"xhr-moz-chunked-loader")||this;return f.TAG="MozChunkedLoader",f._seekHandler=_,f._config=d,f._needStash=!0,f._xhr=null,f._requestAbort=!1,f._contentLength=null,f._receivedLength=0,f}return L(l,O),l.isSupported=function(){try{var _=new XMLHttpRequest;return _.open("GET","https://example.com",!0),_.responseType="moz-chunked-arraybuffer",_.responseType==="moz-chunked-arraybuffer"}catch(d){return M.a.w("MozChunkedLoader",d.message),!1}},l.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),O.prototype.destroy.call(this)},l.prototype.open=function(_,d){this._dataSource=_,this._range=d;var f=_.url;this._config.reuseRedirectedURL&&_.redirectedURL!=null&&(f=_.redirectedURL);var V=this._seekHandler.getConfig(f,d);this._requestURL=V.url;var J=this._xhr=new XMLHttpRequest;if(J.open("GET",V.url,!0),J.responseType="moz-chunked-arraybuffer",J.onreadystatechange=this._onReadyStateChange.bind(this),J.onprogress=this._onProgress.bind(this),J.onloadend=this._onLoadEnd.bind(this),J.onerror=this._onXhrError.bind(this),_.withCredentials&&(J.withCredentials=!0),typeof V.headers=="object"){var G=V.headers;for(var K in G)G.hasOwnProperty(K)&&J.setRequestHeader(K,G[K])}if(typeof this._config.headers=="object"){G=this._config.headers;for(var K in G)G.hasOwnProperty(K)&&J.setRequestHeader(K,G[K])}this._status=v.c.kConnecting,J.send()},l.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=v.c.kComplete},l.prototype._onReadyStateChange=function(_){var d=_.target;if(d.readyState===2){if(d.responseURL!=null&&d.responseURL!==this._requestURL&&this._onURLRedirect){var f=this._seekHandler.removeURLParameters(d.responseURL);this._onURLRedirect(f)}if(d.status!==0&&(d.status<200||d.status>299)){if(this._status=v.c.kError,!this._onError)throw new g.d("MozChunkedLoader: Http code invalid, "+d.status+" "+d.statusText);this._onError(v.b.HTTP_STATUS_CODE_INVALID,{code:d.status,msg:d.statusText})}else this._status=v.c.kBuffering}},l.prototype._onProgress=function(_){if(this._status!==v.c.kError){this._contentLength===null&&_.total!==null&&_.total!==0&&(this._contentLength=_.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var d=_.target.response,f=this._range.from+this._receivedLength;this._receivedLength+=d.byteLength,this._onDataArrival&&this._onDataArrival(d,f,this._receivedLength)}},l.prototype._onLoadEnd=function(_){this._requestAbort!==!0?this._status!==v.c.kError&&(this._status=v.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},l.prototype._onXhrError=function(_){this._status=v.c.kError;var d=0,f=null;if(this._contentLength&&_.loaded<this._contentLength?(d=v.b.EARLY_EOF,f={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(d=v.b.EXCEPTION,f={code:-1,msg:_.constructor.name+" "+_.type}),!this._onError)throw new g.d(f.msg);this._onError(d,f)},l}(v.a),w=function(){var O=function(l,_){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var V in f)Object.prototype.hasOwnProperty.call(f,V)&&(d[V]=f[V])})(l,_)};return function(l,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");function d(){this.constructor=l}O(l,_),l.prototype=_===null?Object.create(_):(d.prototype=_.prototype,new d)}}(),U=(function(O){function l(_,d){var f=O.call(this,"xhr-msstream-loader")||this;return f.TAG="MSStreamLoader",f._seekHandler=_,f._config=d,f._needStash=!0,f._xhr=null,f._reader=null,f._totalRange=null,f._currentRange=null,f._currentRequestURL=null,f._currentRedirectedURL=null,f._contentLength=null,f._receivedLength=0,f._bufferLimit=16777216,f._lastTimeBufferSize=0,f._isReconnecting=!1,f}w(l,O),l.isSupported=function(){try{if(self.MSStream===void 0||self.MSStreamReader===void 0)return!1;var _=new XMLHttpRequest;return _.open("GET","https://example.com",!0),_.responseType="ms-stream",_.responseType==="ms-stream"}catch(d){return M.a.w("MSStreamLoader",d.message),!1}},l.prototype.destroy=function(){this.isWorking()&&this.abort(),this._reader&&(this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr=null),O.prototype.destroy.call(this)},l.prototype.open=function(_,d){this._internalOpen(_,d,!1)},l.prototype._internalOpen=function(_,d,f){this._dataSource=_,f?this._currentRange=d:this._totalRange=d;var V=_.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?V=this._currentRedirectedURL:_.redirectedURL!=null&&(V=_.redirectedURL));var J=this._seekHandler.getConfig(V,d);this._currentRequestURL=J.url;var G=this._reader=new self.MSStreamReader;G.onprogress=this._msrOnProgress.bind(this),G.onload=this._msrOnLoad.bind(this),G.onerror=this._msrOnError.bind(this);var K=this._xhr=new XMLHttpRequest;if(K.open("GET",J.url,!0),K.responseType="ms-stream",K.onreadystatechange=this._xhrOnReadyStateChange.bind(this),K.onerror=this._xhrOnError.bind(this),_.withCredentials&&(K.withCredentials=!0),typeof J.headers=="object"){var se=J.headers;for(var Ee in se)se.hasOwnProperty(Ee)&&K.setRequestHeader(Ee,se[Ee])}if(typeof this._config.headers=="object"){se=this._config.headers;for(var Ee in se)se.hasOwnProperty(Ee)&&K.setRequestHeader(Ee,se[Ee])}this._isReconnecting?this._isReconnecting=!1:this._status=v.c.kConnecting,K.send()},l.prototype.abort=function(){this._internalAbort(),this._status=v.c.kComplete},l.prototype._internalAbort=function(){this._reader&&(this._reader.readyState===1&&this._reader.abort(),this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.abort(),this._xhr.onreadystatechange=null,this._xhr=null)},l.prototype._xhrOnReadyStateChange=function(_){var d=_.target;if(d.readyState===2)if(d.status>=200&&d.status<=299){if(this._status=v.c.kBuffering,d.responseURL!=null){var f=this._seekHandler.removeURLParameters(d.responseURL);d.responseURL!==this._currentRequestURL&&f!==this._currentRedirectedURL&&(this._currentRedirectedURL=f,this._onURLRedirect&&this._onURLRedirect(f))}var V=d.getResponseHeader("Content-Length");if(V!=null&&this._contentLength==null){var J=parseInt(V);J>0&&(this._contentLength=J,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength))}}else{if(this._status=v.c.kError,!this._onError)throw new g.d("MSStreamLoader: Http code invalid, "+d.status+" "+d.statusText);this._onError(v.b.HTTP_STATUS_CODE_INVALID,{code:d.status,msg:d.statusText})}else if(d.readyState===3&&d.status>=200&&d.status<=299){this._status=v.c.kBuffering;var G=d.response;this._reader.readAsArrayBuffer(G)}},l.prototype._xhrOnError=function(_){this._status=v.c.kError;var d=v.b.EXCEPTION,f={code:-1,msg:_.constructor.name+" "+_.type};if(!this._onError)throw new g.d(f.msg);this._onError(d,f)},l.prototype._msrOnProgress=function(_){var d=_.target.result;if(d!=null){var f=d.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=d.byteLength;var V=this._totalRange.from+this._receivedLength;this._receivedLength+=f.byteLength,this._onDataArrival&&this._onDataArrival(f,V,this._receivedLength),d.byteLength>=this._bufferLimit&&(M.a.v(this.TAG,"MSStream buffer exceeded max size near ".concat(V+f.byteLength,", reconnecting...")),this._doReconnectIfNeeded())}else this._doReconnectIfNeeded()},l.prototype._doReconnectIfNeeded=function(){if(this._contentLength==null||this._receivedLength<this._contentLength){this._isReconnecting=!0,this._lastTimeBufferSize=0,this._internalAbort();var _={from:this._totalRange.from+this._receivedLength,to:-1};this._internalOpen(this._dataSource,_,!0)}},l.prototype._msrOnLoad=function(_){this._status=v.c.kComplete,this._onComplete&&this._onComplete(this._totalRange.from,this._totalRange.from+this._receivedLength-1)},l.prototype._msrOnError=function(_){this._status=v.c.kError;var d=0,f=null;if(this._contentLength&&this._receivedLength<this._contentLength?(d=v.b.EARLY_EOF,f={code:-1,msg:"MSStream meet Early-Eof"}):(d=v.b.EARLY_EOF,f={code:-1,msg:_.constructor.name+" "+_.type}),!this._onError)throw new g.d(f.msg);this._onError(d,f)}}(v.a),function(){var O=function(l,_){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var V in f)Object.prototype.hasOwnProperty.call(f,V)&&(d[V]=f[V])})(l,_)};return function(l,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");function d(){this.constructor=l}O(l,_),l.prototype=_===null?Object.create(_):(d.prototype=_.prototype,new d)}}()),N=function(O){function l(_,d){var f=O.call(this,"xhr-range-loader")||this;return f.TAG="RangeLoader",f._seekHandler=_,f._config=d,f._needStash=!1,f._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],f._currentChunkSizeKB=384,f._currentSpeedNormalized=0,f._zeroSpeedChunkCount=0,f._xhr=null,f._speedSampler=new p,f._requestAbort=!1,f._waitForTotalLength=!1,f._totalLengthReceived=!1,f._currentRequestURL=null,f._currentRedirectedURL=null,f._currentRequestRange=null,f._totalLength=null,f._contentLength=null,f._receivedLength=0,f._lastTimeLoaded=0,f}return U(l,O),l.isSupported=function(){try{var _=new XMLHttpRequest;return _.open("GET","https://example.com",!0),_.responseType="arraybuffer",_.responseType==="arraybuffer"}catch(d){return M.a.w("RangeLoader",d.message),!1}},l.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),O.prototype.destroy.call(this)},Object.defineProperty(l.prototype,"currentSpeed",{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),l.prototype.open=function(_,d){this._dataSource=_,this._range=d,this._status=v.c.kConnecting;var f=!1;this._dataSource.filesize!=null&&this._dataSource.filesize!==0&&(f=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||f?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},l.prototype._openSubRange=function(){var _=1024*this._currentChunkSizeKB,d=this._range.from+this._receivedLength,f=d+_;this._contentLength!=null&&f-this._range.from>=this._contentLength&&(f=this._range.from+this._contentLength-1),this._currentRequestRange={from:d,to:f},this._internalOpen(this._dataSource,this._currentRequestRange)},l.prototype._internalOpen=function(_,d){this._lastTimeLoaded=0;var f=_.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?f=this._currentRedirectedURL:_.redirectedURL!=null&&(f=_.redirectedURL));var V=this._seekHandler.getConfig(f,d);this._currentRequestURL=V.url;var J=this._xhr=new XMLHttpRequest;if(J.open("GET",V.url,!0),J.responseType="arraybuffer",J.onreadystatechange=this._onReadyStateChange.bind(this),J.onprogress=this._onProgress.bind(this),J.onload=this._onLoad.bind(this),J.onerror=this._onXhrError.bind(this),_.withCredentials&&(J.withCredentials=!0),typeof V.headers=="object"){var G=V.headers;for(var K in G)G.hasOwnProperty(K)&&J.setRequestHeader(K,G[K])}if(typeof this._config.headers=="object"){G=this._config.headers;for(var K in G)G.hasOwnProperty(K)&&J.setRequestHeader(K,G[K])}J.send()},l.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=v.c.kComplete},l.prototype._internalAbort=function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)},l.prototype._onReadyStateChange=function(_){var d=_.target;if(d.readyState===2){if(d.responseURL!=null){var f=this._seekHandler.removeURLParameters(d.responseURL);d.responseURL!==this._currentRequestURL&&f!==this._currentRedirectedURL&&(this._currentRedirectedURL=f,this._onURLRedirect&&this._onURLRedirect(f))}if(d.status>=200&&d.status<=299){if(this._waitForTotalLength)return;this._status=v.c.kBuffering}else{if(this._status=v.c.kError,!this._onError)throw new g.d("RangeLoader: Http code invalid, "+d.status+" "+d.statusText);this._onError(v.b.HTTP_STATUS_CODE_INVALID,{code:d.status,msg:d.statusText})}}},l.prototype._onProgress=function(_){if(this._status!==v.c.kError){if(this._contentLength===null){var d=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,d=!0;var f=_.total;this._internalAbort(),f!=null&f!==0&&(this._totalLength=f)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,d)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var V=_.loaded-this._lastTimeLoaded;this._lastTimeLoaded=_.loaded,this._speedSampler.addBytes(V)}},l.prototype._normalizeSpeed=function(_){var d=this._chunkSizeKBList,f=d.length-1,V=0,J=0,G=f;if(_<d[0])return d[0];for(;J<=G;){if((V=J+Math.floor((G-J)/2))===f||_>=d[V]&&_<d[V+1])return d[V];d[V]<_?J=V+1:G=V-1}},l.prototype._onLoad=function(_){if(this._status!==v.c.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var d=this._speedSampler.lastSecondKBps;if(d===0&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(d=this._speedSampler.currentKBps)),d!==0){var f=this._normalizeSpeed(d);this._currentSpeedNormalized!==f&&(this._currentSpeedNormalized=f,this._currentChunkSizeKB=f)}var V=_.target.response,J=this._range.from+this._receivedLength;this._receivedLength+=V.byteLength;var G=!1;this._contentLength!=null&&this._receivedLength<this._contentLength?this._openSubRange():G=!0,this._onDataArrival&&this._onDataArrival(V,J,this._receivedLength),G&&(this._status=v.c.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},l.prototype._onXhrError=function(_){this._status=v.c.kError;var d=0,f=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(d=v.b.EARLY_EOF,f={code:-1,msg:"RangeLoader meet Early-Eof"}):(d=v.b.EXCEPTION,f={code:-1,msg:_.constructor.name+" "+_.type}),!this._onError)throw new g.d(f.msg);this._onError(d,f)},l}(v.a),P=function(){var O=function(l,_){return(O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,f){d.__proto__=f}||function(d,f){for(var V in f)Object.prototype.hasOwnProperty.call(f,V)&&(d[V]=f[V])})(l,_)};return function(l,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");function d(){this.constructor=l}O(l,_),l.prototype=_===null?Object.create(_):(d.prototype=_.prototype,new d)}}(),X=function(O){function l(){var _=O.call(this,"websocket-loader")||this;return _.TAG="WebSocketLoader",_._needStash=!0,_._ws=null,_._requestAbort=!1,_._receivedLength=0,_}return P(l,O),l.isSupported=function(){try{return self.WebSocket!==void 0}catch{return!1}},l.prototype.destroy=function(){this._ws&&this.abort(),O.prototype.destroy.call(this)},l.prototype.open=function(_){try{var d=this._ws=new self.WebSocket(_.url);d.binaryType="arraybuffer",d.onopen=this._onWebSocketOpen.bind(this),d.onclose=this._onWebSocketClose.bind(this),d.onmessage=this._onWebSocketMessage.bind(this),d.onerror=this._onWebSocketError.bind(this),this._status=v.c.kConnecting}catch(V){this._status=v.c.kError;var f={code:V.code,msg:V.message};if(!this._onError)throw new g.d(f.msg);this._onError(v.b.EXCEPTION,f)}},l.prototype.abort=function(){var _=this._ws;!_||_.readyState!==0&&_.readyState!==1||(this._requestAbort=!0,_.close()),this._ws=null,this._status=v.c.kComplete},l.prototype._onWebSocketOpen=function(_){this._status=v.c.kBuffering},l.prototype._onWebSocketClose=function(_){this._requestAbort!==!0?(this._status=v.c.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1},l.prototype._onWebSocketMessage=function(_){var d=this;if(_.data instanceof ArrayBuffer)this._dispatchArrayBuffer(_.data);else if(_.data instanceof Blob){var f=new FileReader;f.onload=function(){d._dispatchArrayBuffer(f.result)},f.readAsArrayBuffer(_.data)}else{this._status=v.c.kError;var V={code:-1,msg:"Unsupported WebSocket message type: "+_.data.constructor.name};if(!this._onError)throw new g.d(V.msg);this._onError(v.b.EXCEPTION,V)}},l.prototype._dispatchArrayBuffer=function(_){var d=_,f=this._receivedLength;this._receivedLength+=d.byteLength,this._onDataArrival&&this._onDataArrival(d,f,this._receivedLength)},l.prototype._onWebSocketError=function(_){this._status=v.c.kError;var d={code:_.code,msg:_.message};if(!this._onError)throw new g.d(d.msg);this._onError(v.b.EXCEPTION,d)},l}(v.a),k=function(){function O(l){this._zeroStart=l||!1}return O.prototype.getConfig=function(l,_){var d={};if(_.from!==0||_.to!==-1){var f=void 0;f=_.to!==-1?"bytes=".concat(_.from.toString(),"-").concat(_.to.toString()):"bytes=".concat(_.from.toString(),"-"),d.Range=f}else this._zeroStart&&(d.Range="bytes=0-");return{url:l,headers:d}},O.prototype.removeURLParameters=function(l){return l},O}(),q=function(){function O(l,_){this._startName=l,this._endName=_}return O.prototype.getConfig=function(l,_){var d=l;if(_.from!==0||_.to!==-1){var f=!0;d.indexOf("?")===-1&&(d+="?",f=!1),f&&(d+="&"),d+="".concat(this._startName,"=").concat(_.from.toString()),_.to!==-1&&(d+="&".concat(this._endName,"=").concat(_.to.toString()))}return{url:d,headers:{}}},O.prototype.removeURLParameters=function(l){var _=l.split("?")[0],d=void 0,f=l.indexOf("?");f!==-1&&(d=l.substring(f+1));var V="";if(d!=null&&d.length>0)for(var J=d.split("&"),G=0;G<J.length;G++){var K=J[G].split("="),se=G>0;K[0]!==this._startName&&K[0]!==this._endName&&(se&&(V+="&"),V+=J[G])}return V.length===0?_:_+"?"+V},O}(),Q=function(){function O(l,_,d){this.TAG="IOController",this._config=_,this._extraData=d,this._stashInitialSize=65536,_.stashInitialSize!=null&&_.stashInitialSize>0&&(this._stashInitialSize=_.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=Math.max(this._stashSize,3145728),this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,_.enableStashBuffer===!1&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=l,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(l.url),this._refTotalLength=l.filesize?l.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new p,this._speedNormalizeList=[32,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return O.prototype.destroy=function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null},O.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},O.prototype.isPaused=function(){return this._paused},Object.defineProperty(O.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"extraData",{get:function(){return this._extraData},set:function(l){this._extraData=l},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(l){this._onDataArrival=l},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(l){this._onSeeked=l},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onError",{get:function(){return this._onError},set:function(l){this._onError=l},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onComplete",{get:function(){return this._onComplete},set:function(l){this._onComplete=l},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(l){this._onRedirect=l},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(l){this._onRecoveredEarlyEof=l},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"hasRedirect",{get:function(){return this._redirectedURL!=null||this._dataSource.redirectedURL!=null},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"currentSpeed",{get:function(){return this._loaderClass===N?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),O.prototype._selectSeekHandler=function(){var l=this._config;if(l.seekType==="range")this._seekHandler=new k(this._config.rangeLoadZeroStart);else if(l.seekType==="param"){var _=l.seekParamStart||"bstart",d=l.seekParamEnd||"bend";this._seekHandler=new q(_,d)}else{if(l.seekType!=="custom")throw new g.b("Invalid seekType in config: ".concat(l.seekType));if(typeof l.customSeekHandler!="function")throw new g.b("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new l.customSeekHandler}},O.prototype._selectLoader=function(){if(this._config.customLoader!=null)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=X;else if(E.isSupported())this._loaderClass=E;else if(B.isSupported())this._loaderClass=B;else{if(!N.isSupported())throw new g.d("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=N}},O.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),this._loader.needStashBuffer===!1&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)},O.prototype.open=function(l){this._currentRange={from:0,to:-1},l&&(this._currentRange.from=l),this._speedSampler.reset(),l||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},O.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},O.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),this._stashUsed!==0?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},O.prototype.resume=function(){if(this._paused){this._paused=!1;var l=this._resumeFrom;this._resumeFrom=0,this._internalSeek(l,!0)}},O.prototype.seek=function(l){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(l,!0)},O.prototype._internalSeek=function(l,_){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(_),this._loader.destroy(),this._loader=null;var d={from:l,to:-1};this._currentRange={from:d.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,d),this._onSeeked&&this._onSeeked()},O.prototype.updateUrl=function(l){if(!l||typeof l!="string"||l.length===0)throw new g.b("Url must be a non-empty string!");this._dataSource.url=l},O.prototype._expandBuffer=function(l){for(var _=this._stashSize;_+1048576<l;)_*=2;if((_+=1048576)!==this._bufferSize){var d=new ArrayBuffer(_);if(this._stashUsed>0){var f=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(d,0,_).set(f,0)}this._stashBuffer=d,this._bufferSize=_}},O.prototype._normalizeSpeed=function(l){var _=this._speedNormalizeList,d=_.length-1,f=0,V=0,J=d;if(l<_[0])return _[0];for(;V<=J;){if((f=V+Math.floor((J-V)/2))===d||l>=_[f]&&l<_[f+1])return _[f];_[f]<l?V=f+1:J=f-1}},O.prototype._adjustStashSize=function(l){var _=0;(_=this._config.isLive?l/8:l<512?l:l>=512&&l<=1024?Math.floor(1.5*l):2*l)>8192&&(_=8192);var d=1024*_+1048576;this._bufferSize<d&&this._expandBuffer(d),this._stashSize=1024*_},O.prototype._dispatchChunks=function(l,_){return this._currentRange.to=_+l.byteLength-1,this._onDataArrival(l,_)},O.prototype._onURLRedirect=function(l){this._redirectedURL=l,this._onRedirect&&this._onRedirect(l)},O.prototype._onContentLengthKnown=function(l){l&&this._fullRequestFlag&&(this._totalLength=l,this._fullRequestFlag=!1)},O.prototype._onLoaderChunkArrival=function(l,_,d){if(!this._onDataArrival)throw new g.a("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(l.byteLength);var f=this._speedSampler.lastSecondKBps;if(f!==0){var V=this._normalizeSpeed(f);this._speedNormalized!==V&&(this._speedNormalized=V,this._adjustStashSize(V))}if(this._enableStash)if(this._stashUsed===0&&this._stashByteStart===0&&(this._stashByteStart=_),this._stashUsed+l.byteLength<=this._stashSize)(K=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(l),this._stashUsed),this._stashUsed+=l.byteLength;else if(K=new Uint8Array(this._stashBuffer,0,this._bufferSize),this._stashUsed>0){var J=this._stashBuffer.slice(0,this._stashUsed);(se=this._dispatchChunks(J,this._stashByteStart))<J.byteLength?se>0&&(Ee=new Uint8Array(J,se),K.set(Ee,0),this._stashUsed=Ee.byteLength,this._stashByteStart+=se):(this._stashUsed=0,this._stashByteStart+=se),this._stashUsed+l.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+l.byteLength),K=new Uint8Array(this._stashBuffer,0,this._bufferSize)),K.set(new Uint8Array(l),this._stashUsed),this._stashUsed+=l.byteLength}else(se=this._dispatchChunks(l,_))<l.byteLength&&((G=l.byteLength-se)>this._bufferSize&&(this._expandBuffer(G),K=new Uint8Array(this._stashBuffer,0,this._bufferSize)),K.set(new Uint8Array(l,se),0),this._stashUsed+=G,this._stashByteStart=_+se);else if(this._stashUsed===0){var G;(se=this._dispatchChunks(l,_))<l.byteLength&&((G=l.byteLength-se)>this._bufferSize&&this._expandBuffer(G),(K=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(l,se),0),this._stashUsed+=G,this._stashByteStart=_+se)}else{var K,se;if(this._stashUsed+l.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+l.byteLength),(K=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(l),this._stashUsed),this._stashUsed+=l.byteLength,(se=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&se>0){var Ee=new Uint8Array(this._stashBuffer,se);K.set(Ee,0)}this._stashUsed-=se,this._stashByteStart+=se}}},O.prototype._flushStashBuffer=function(l){if(this._stashUsed>0){var _=this._stashBuffer.slice(0,this._stashUsed),d=this._dispatchChunks(_,this._stashByteStart),f=_.byteLength-d;if(d<_.byteLength){if(!l){if(d>0){var V=new Uint8Array(this._stashBuffer,0,this._bufferSize),J=new Uint8Array(_,d);V.set(J,0),this._stashUsed=J.byteLength,this._stashByteStart+=d}return 0}M.a.w(this.TAG,"".concat(f," bytes unconsumed data remain when flush buffer, dropped"))}return this._stashUsed=0,this._stashByteStart=0,f}return 0},O.prototype._onLoaderComplete=function(l,_){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},O.prototype._onLoaderError=function(l,_){switch(M.a.e(this.TAG,"Loader error, code = ".concat(_.code,", msg = ").concat(_.msg)),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,l=v.b.UNRECOVERABLE_EARLY_EOF),l){case v.b.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var d=this._currentRange.to+1;return void(d<this._totalLength&&(M.a.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(d,!1)))}l=v.b.UNRECOVERABLE_EARLY_EOF;break;case v.b.UNRECOVERABLE_EARLY_EOF:case v.b.CONNECTING_TIMEOUT:case v.b.HTTP_STATUS_CODE_INVALID:case v.b.EXCEPTION:}if(!this._onError)throw new g.d("IOException: "+_.msg);this._onError(l,_)},O}();te.a=Q},function(me,te,D){var F=function(){function M(){}return M.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(p,v){return p.__proto__=v,p},Object.assign=Object.assign||function(p){if(p==null)throw new TypeError("Cannot convert undefined or null to object");for(var v=Object(p),S=1;S<arguments.length;S++){var g=arguments[S];if(g!=null)for(var T in g)g.hasOwnProperty(T)&&(v[T]=g[T])}return v},String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(p,v){var S=v>0?0|v:0;return this.substring(S,S+p.length)===p}}),typeof self.Promise!="function"&&D(21).polyfill()},M}();F.install(),te.a=F},function(me,te,D){var F=D(9),M=D.n(F),p=D(0),v=D(5),S=D(7),g=D(3),T=function(){function E(L){this.TAG="MSEController",this._config=L,this._emitter=new M.a,this._config.isLive&&this._config.autoCleanupSourceBuffer==null&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onStartStreaming:this._onStartStreaming.bind(this),onEndStreaming:this._onEndStreaming.bind(this),onQualityChange:this._onQualityChange.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._useManagedMediaSource="ManagedMediaSource"in self&&!("MediaSource"in self),this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElementProxy=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]}}return E.prototype.destroy=function(){this._mediaSource&&this.shutdown(),this._mediaSourceObjectURL&&this.revokeObjectURL(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},E.prototype.on=function(L,B){this._emitter.addListener(L,B)},E.prototype.off=function(L,B){this._emitter.removeListener(L,B)},E.prototype.initialize=function(L){if(this._mediaSource)throw new g.a("MediaSource has been attached to an HTMLMediaElement!");this._useManagedMediaSource&&p.a.v(this.TAG,"Using ManagedMediaSource");var B=this._mediaSource=this._useManagedMediaSource?new self.ManagedMediaSource:new self.MediaSource;B.addEventListener("sourceopen",this.e.onSourceOpen),B.addEventListener("sourceended",this.e.onSourceEnded),B.addEventListener("sourceclose",this.e.onSourceClose),this._useManagedMediaSource&&(B.addEventListener("startstreaming",this.e.onStartStreaming),B.addEventListener("endstreaming",this.e.onEndStreaming),B.addEventListener("qualitychange",this.e.onQualityChange)),this._mediaElementProxy=L},E.prototype.shutdown=function(){if(this._mediaSource){var L=this._mediaSource;for(var B in this._sourceBuffers){var w=this._pendingSegments[B];w.splice(0,w.length),this._pendingSegments[B]=null,this._pendingRemoveRanges[B]=null,this._lastInitSegments[B]=null;var U=this._sourceBuffers[B];if(U){if(L.readyState!=="closed"){try{L.removeSourceBuffer(U)}catch(N){p.a.e(this.TAG,N.message)}U.removeEventListener("error",this.e.onSourceBufferError),U.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[B]=null,this._sourceBuffers[B]=null}}if(L.readyState==="open")try{L.endOfStream()}catch(N){p.a.e(this.TAG,N.message)}this._mediaElementProxy=null,L.removeEventListener("sourceopen",this.e.onSourceOpen),L.removeEventListener("sourceended",this.e.onSourceEnded),L.removeEventListener("sourceclose",this.e.onSourceClose),this._useManagedMediaSource&&(L.removeEventListener("startstreaming",this.e.onStartStreaming),L.removeEventListener("endstreaming",this.e.onEndStreaming),L.removeEventListener("qualitychange",this.e.onQualityChange)),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._mediaSource=null}},E.prototype.isManagedMediaSource=function(){return this._useManagedMediaSource},E.prototype.getObject=function(){if(!this._mediaSource)throw new g.a("MediaSource has not been initialized yet!");return this._mediaSource},E.prototype.getHandle=function(){if(!this._mediaSource)throw new g.a("MediaSource has not been initialized yet!");return this._mediaSource.handle},E.prototype.getObjectURL=function(){if(!this._mediaSource)throw new g.a("MediaSource has not been initialized yet!");return this._mediaSourceObjectURL==null&&(this._mediaSourceObjectURL=URL.createObjectURL(this._mediaSource)),this._mediaSourceObjectURL},E.prototype.revokeObjectURL=function(){this._mediaSourceObjectURL&&(URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},E.prototype.appendInitSegment=function(L,B){if(B===void 0&&(B=void 0),!this._mediaSource||this._mediaSource.readyState!=="open"||this._mediaSource.streaming===!1)return this._pendingSourceBufferInit.push(L),void this._pendingSegments[L.type].push(L);var w=L,U="".concat(w.container);w.codec&&w.codec.length>0&&(w.codec==="opus"&&v.a.safari&&(w.codec="Opus"),U+=";codecs=".concat(w.codec));var N=!1;if(p.a.v(this.TAG,"Received Initialization Segment, mimeType: "+U),this._lastInitSegments[w.type]=w,U!==this._mimeTypes[w.type]){if(this._mimeTypes[w.type])p.a.v(this.TAG,"Notice: ".concat(w.type," mimeType changed, origin: ").concat(this._mimeTypes[w.type],", target: ").concat(U));else{N=!0;try{var P=this._sourceBuffers[w.type]=this._mediaSource.addSourceBuffer(U);P.addEventListener("error",this.e.onSourceBufferError),P.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(X){return p.a.e(this.TAG,X.message),void this._emitter.emit(S.a.ERROR,{code:X.code,msg:X.message})}}this._mimeTypes[w.type]=U}B||this._pendingSegments[w.type].push(w),N||this._sourceBuffers[w.type]&&!this._sourceBuffers[w.type].updating&&this._doAppendSegments(),v.a.safari&&w.container==="audio/mpeg"&&w.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=w.mediaDuration/1e3,this._updateMediaSourceDuration())},E.prototype.appendMediaSegment=function(L){var B=L;this._pendingSegments[B.type].push(B),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var w=this._sourceBuffers[B.type];!w||w.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},E.prototype.flush=function(){for(var L in this._sourceBuffers)if(this._sourceBuffers[L]){var B=this._sourceBuffers[L];if(this._mediaSource.readyState==="open")try{B.abort()}catch(k){p.a.e(this.TAG,k.message)}var w=this._pendingSegments[L];if(w.splice(0,w.length),this._mediaSource.readyState!=="closed"){for(var U=0;U<B.buffered.length;U++){var N=B.buffered.start(U),P=B.buffered.end(U);this._pendingRemoveRanges[L].push({start:N,end:P})}if(B.updating||this._doRemoveRanges(),v.a.safari){var X=this._lastInitSegments[L];X&&(this._pendingSegments[L].push(X),B.updating||this._doAppendSegments())}}}},E.prototype.endOfStream=function(){var L=this._mediaSource,B=this._sourceBuffers;L&&L.readyState==="open"?B.video&&B.video.updating||B.audio&&B.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,L.endOfStream()):L&&L.readyState==="closed"&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},E.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var L=this._mediaElementProxy.getCurrentTime();for(var B in this._sourceBuffers){var w=this._sourceBuffers[B];if(w){var U=w.buffered;if(U.length>=1&&L-U.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},E.prototype._doCleanupSourceBuffer=function(){var L=this._mediaElementProxy.getCurrentTime();for(var B in this._sourceBuffers){var w=this._sourceBuffers[B];if(w){for(var U=w.buffered,N=!1,P=0;P<U.length;P++){var X=U.start(P),k=U.end(P);if(X<=L&&L<k+3){if(L-X>=this._config.autoCleanupMaxBackwardDuration){N=!0;var q=L-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[B].push({start:X,end:q})}}else k<L&&(N=!0,this._pendingRemoveRanges[B].push({start:X,end:k}))}N&&!w.updating&&this._doRemoveRanges()}}},E.prototype._updateMediaSourceDuration=function(){var L=this._sourceBuffers;if(this._mediaElementProxy.getReadyState()!==0&&this._mediaSource.readyState==="open"&&!(L.video&&L.video.updating||L.audio&&L.audio.updating)){var B=this._mediaSource.duration,w=this._pendingMediaDuration;w>0&&(isNaN(B)||w>B)&&(p.a.v(this.TAG,"Update MediaSource duration from ".concat(B," to ").concat(w)),this._mediaSource.duration=w),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},E.prototype._doRemoveRanges=function(){for(var L in this._pendingRemoveRanges)if(this._sourceBuffers[L]&&!this._sourceBuffers[L].updating)for(var B=this._sourceBuffers[L],w=this._pendingRemoveRanges[L];w.length&&!B.updating;){var U=w.shift();B.remove(U.start,U.end)}},E.prototype._doAppendSegments=function(){var L=this._pendingSegments;for(var B in L)if(this._sourceBuffers[B]&&!this._sourceBuffers[B].updating&&this._mediaSource.streaming!==!1&&L[B].length>0){var w=L[B].shift();if(typeof w.timestampOffset=="number"&&isFinite(w.timestampOffset)){var U=this._sourceBuffers[B].timestampOffset,N=w.timestampOffset/1e3;Math.abs(U-N)>.1&&(p.a.v(this.TAG,"Update MPEG audio timestampOffset from ".concat(U," to ").concat(N)),this._sourceBuffers[B].timestampOffset=N),delete w.timestampOffset}if(!w.data||w.data.byteLength===0)continue;try{this._sourceBuffers[B].appendBuffer(w.data),this._isBufferFull=!1}catch(P){this._pendingSegments[B].unshift(w),P.code===22?(this._isBufferFull||this._emitter.emit(S.a.BUFFER_FULL),this._isBufferFull=!0):(p.a.e(this.TAG,P.message),this._emitter.emit(S.a.ERROR,{code:P.code,msg:P.message}))}}},E.prototype._onSourceOpen=function(){if(p.a.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var L=this._pendingSourceBufferInit;L.length;){var B=L.shift();this.appendInitSegment(B,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(S.a.SOURCE_OPEN)},E.prototype._onStartStreaming=function(){p.a.v(this.TAG,"ManagedMediaSource onStartStreaming"),this._emitter.emit(S.a.START_STREAMING)},E.prototype._onEndStreaming=function(){p.a.v(this.TAG,"ManagedMediaSource onEndStreaming"),this._emitter.emit(S.a.END_STREAMING)},E.prototype._onQualityChange=function(){p.a.v(this.TAG,"ManagedMediaSource onQualityChange")},E.prototype._onSourceEnded=function(){p.a.v(this.TAG,"MediaSource onSourceEnded")},E.prototype._onSourceClose=function(){p.a.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&this.e!=null&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose),this._useManagedMediaSource&&(this._mediaSource.removeEventListener("startstreaming",this.e.onStartStreaming),this._mediaSource.removeEventListener("endstreaming",this.e.onEndStreaming),this._mediaSource.removeEventListener("qualitychange",this.e.onQualityChange)))},E.prototype._hasPendingSegments=function(){var L=this._pendingSegments;return L.video.length>0||L.audio.length>0},E.prototype._hasPendingRemoveRanges=function(){var L=this._pendingRemoveRanges;return L.video.length>0||L.audio.length>0},E.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(S.a.UPDATE_END)},E.prototype._onSourceBufferError=function(L){p.a.e(this.TAG,"SourceBuffer Error: ".concat(L))},E}();te.a=T},function(me,te,D){var F=D(9),M=D.n(F),p=D(18),v=D.n(p),S=D(0),g=D(8),T=D(13),E=D(1),L=(D(19),D(12)),B=function(){function w(U,N){if(this.TAG="Transmuxer",this._emitter=new M.a,N.enableWorker&&typeof Worker<"u")try{this._worker=v()(19),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[U,N]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},g.a.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:g.a.getConfig()})}catch{S.a.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new T.a(U,N)}else this._controller=new T.a(U,N);if(this._controller){var P=this._controller;P.on(E.a.IO_ERROR,this._onIOError.bind(this)),P.on(E.a.DEMUX_ERROR,this._onDemuxError.bind(this)),P.on(E.a.INIT_SEGMENT,this._onInitSegment.bind(this)),P.on(E.a.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),P.on(E.a.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),P.on(E.a.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),P.on(E.a.MEDIA_INFO,this._onMediaInfo.bind(this)),P.on(E.a.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),P.on(E.a.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),P.on(E.a.TIMED_ID3_METADATA_ARRIVED,this._onTimedID3MetadataArrived.bind(this)),P.on(E.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,this._onSynchronousKLVMetadataArrived.bind(this)),P.on(E.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,this._onAsynchronousKLVMetadataArrived.bind(this)),P.on(E.a.SMPTE2038_METADATA_ARRIVED,this._onSMPTE2038MetadataArrived.bind(this)),P.on(E.a.SCTE35_METADATA_ARRIVED,this._onSCTE35MetadataArrived.bind(this)),P.on(E.a.PES_PRIVATE_DATA_DESCRIPTOR,this._onPESPrivateDataDescriptor.bind(this)),P.on(E.a.PES_PRIVATE_DATA_ARRIVED,this._onPESPrivateDataArrived.bind(this)),P.on(E.a.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),P.on(E.a.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return w.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),g.a.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},w.prototype.on=function(U,N){this._emitter.addListener(U,N)},w.prototype.off=function(U,N){this._emitter.removeListener(U,N)},w.prototype.hasWorker=function(){return this._worker!=null},w.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},w.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},w.prototype.seek=function(U){this._worker?this._worker.postMessage({cmd:"seek",param:U}):this._controller.seek(U)},w.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},w.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},w.prototype._onInitSegment=function(U,N){var P=this;Promise.resolve().then(function(){P._emitter.emit(E.a.INIT_SEGMENT,U,N)})},w.prototype._onMediaSegment=function(U,N){var P=this;Promise.resolve().then(function(){P._emitter.emit(E.a.MEDIA_SEGMENT,U,N)})},w.prototype._onLoadingComplete=function(){var U=this;Promise.resolve().then(function(){U._emitter.emit(E.a.LOADING_COMPLETE)})},w.prototype._onRecoveredEarlyEof=function(){var U=this;Promise.resolve().then(function(){U._emitter.emit(E.a.RECOVERED_EARLY_EOF)})},w.prototype._onMediaInfo=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.MEDIA_INFO,U)})},w.prototype._onMetaDataArrived=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.METADATA_ARRIVED,U)})},w.prototype._onScriptDataArrived=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.SCRIPTDATA_ARRIVED,U)})},w.prototype._onTimedID3MetadataArrived=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.TIMED_ID3_METADATA_ARRIVED,U)})},w.prototype._onSynchronousKLVMetadataArrived=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,U)})},w.prototype._onAsynchronousKLVMetadataArrived=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,U)})},w.prototype._onSMPTE2038MetadataArrived=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.SMPTE2038_METADATA_ARRIVED,U)})},w.prototype._onSCTE35MetadataArrived=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.SCTE35_METADATA_ARRIVED,U)})},w.prototype._onPESPrivateDataDescriptor=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.PES_PRIVATE_DATA_DESCRIPTOR,U)})},w.prototype._onPESPrivateDataArrived=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.PES_PRIVATE_DATA_ARRIVED,U)})},w.prototype._onStatisticsInfo=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.STATISTICS_INFO,U)})},w.prototype._onIOError=function(U,N){var P=this;Promise.resolve().then(function(){P._emitter.emit(E.a.IO_ERROR,U,N)})},w.prototype._onDemuxError=function(U,N){var P=this;Promise.resolve().then(function(){P._emitter.emit(E.a.DEMUX_ERROR,U,N)})},w.prototype._onRecommendSeekpoint=function(U){var N=this;Promise.resolve().then(function(){N._emitter.emit(E.a.RECOMMEND_SEEKPOINT,U)})},w.prototype._onLoggingConfigChanged=function(U){this._worker&&this._worker.postMessage({cmd:"logging_config",param:U})},w.prototype._onWorkerMessage=function(U){var N=U.data,P=N.data;if(N.msg==="destroyed"||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(N.msg){case E.a.INIT_SEGMENT:case E.a.MEDIA_SEGMENT:this._emitter.emit(N.msg,P.type,P.data);break;case E.a.LOADING_COMPLETE:case E.a.RECOVERED_EARLY_EOF:this._emitter.emit(N.msg);break;case E.a.MEDIA_INFO:Object.setPrototypeOf(P,L.a.prototype),this._emitter.emit(N.msg,P);break;case E.a.METADATA_ARRIVED:case E.a.SCRIPTDATA_ARRIVED:case E.a.TIMED_ID3_METADATA_ARRIVED:case E.a.SYNCHRONOUS_KLV_METADATA_ARRIVED:case E.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED:case E.a.SMPTE2038_METADATA_ARRIVED:case E.a.SCTE35_METADATA_ARRIVED:case E.a.PES_PRIVATE_DATA_DESCRIPTOR:case E.a.PES_PRIVATE_DATA_ARRIVED:case E.a.STATISTICS_INFO:this._emitter.emit(N.msg,P);break;case E.a.IO_ERROR:case E.a.DEMUX_ERROR:this._emitter.emit(N.msg,P.type,P.info);break;case E.a.RECOMMEND_SEEKPOINT:this._emitter.emit(N.msg,P);break;case"logcat_callback":S.a.emitter.emit("log",P.type,P.logcat)}},w}();te.a=B},function(me,te,D){function F(S){var g={};function T(L){if(g[L])return g[L].exports;var B=g[L]={i:L,l:!1,exports:{}};return S[L].call(B.exports,B,B.exports,T),B.l=!0,B.exports}T.m=S,T.c=g,T.i=function(L){return L},T.d=function(L,B,w){T.o(L,B)||Object.defineProperty(L,B,{configurable:!1,enumerable:!0,get:w})},T.r=function(L){Object.defineProperty(L,"__esModule",{value:!0})},T.n=function(L){var B=L&&L.__esModule?function(){return L.default}:function(){return L};return T.d(B,"a",B),B},T.o=function(L,B){return Object.prototype.hasOwnProperty.call(L,B)},T.p="/",T.oe=function(L){throw console.error(L),L};var E=T(T.s=ENTRY_MODULE);return E.default||E}function M(S){return(S+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function p(S,g,T){var E={};E[T]=[];var L=g.toString(),B=L.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!B)return E;for(var w,U=B[1],N=new RegExp("(\\\\n|\\W)"+M(U)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");w=N.exec(L);)w[3]!=="dll-reference"&&E[T].push(w[3]);for(N=new RegExp("\\("+M(U)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");w=N.exec(L);)S[w[2]]||(E[T].push(w[1]),S[w[2]]=D(w[1]).m),E[w[2]]=E[w[2]]||[],E[w[2]].push(w[4]);for(var P,X=Object.keys(E),k=0;k<X.length;k++)for(var q=0;q<E[X[k]].length;q++)P=E[X[k]][q],isNaN(1*P)||(E[X[k]][q]=1*E[X[k]][q]);return E}function v(S){return Object.keys(S).reduce(function(g,T){return g||S[T].length>0},!1)}me.exports=function(S,g){g=g||{};var T={main:D.m},E=g.all?{main:Object.keys(T.main)}:function(N,P){for(var X={main:[P]},k={main:[]},q={main:{}};v(X);)for(var Q=Object.keys(X),O=0;O<Q.length;O++){var l=Q[O],_=X[l].pop();if(q[l]=q[l]||{},!q[l][_]&&N[l][_]){q[l][_]=!0,k[l]=k[l]||[],k[l].push(_);for(var d=p(N,N[l][_],l),f=Object.keys(d),V=0;V<f.length;V++)X[f[V]]=X[f[V]]||[],X[f[V]]=X[f[V]].concat(d[f[V]])}}return k}(T,S),L="";Object.keys(E).filter(function(N){return N!=="main"}).forEach(function(N){for(var P=0;E[N][P];)P++;E[N].push(P),T[N][P]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",L=L+"var "+N+" = ("+F.toString().replace("ENTRY_MODULE",JSON.stringify(P))+")({"+E[N].map(function(X){return JSON.stringify(X)+": "+T[N][X].toString()}).join(",")+`});
`}),L=L+"new (("+F.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+E.main.map(function(N){return JSON.stringify(N)+": "+T.main[N].toString()}).join(",")+"}))(self);";var B=new self.Blob([L],{type:"text/javascript"});if(g.bare)return B;var w=(self.URL||self.webkitURL||self.mozURL||self.msURL).createObjectURL(B),U=new self.Worker(w);return U.objectURL=w,U}},function(me,te,D){D.r(te),D(0);var F=D(8),M=D(15),p=D(13),v=D(1);te.default=function(S){var g=null,T=(function(G,K){S.postMessage({msg:"logcat_callback",data:{type:G,logcat:K}})}).bind(this);function E(G,K){var se={msg:v.a.INIT_SEGMENT,data:{type:G,data:K}};S.postMessage(se,[K.data])}function L(G,K){var se={msg:v.a.MEDIA_SEGMENT,data:{type:G,data:K}};S.postMessage(se,[K.data])}function B(){var G={msg:v.a.LOADING_COMPLETE};S.postMessage(G)}function w(){var G={msg:v.a.RECOVERED_EARLY_EOF};S.postMessage(G)}function U(G){var K={msg:v.a.MEDIA_INFO,data:G};S.postMessage(K)}function N(G){var K={msg:v.a.METADATA_ARRIVED,data:G};S.postMessage(K)}function P(G){var K={msg:v.a.SCRIPTDATA_ARRIVED,data:G};S.postMessage(K)}function X(G){var K={msg:v.a.TIMED_ID3_METADATA_ARRIVED,data:G};S.postMessage(K)}function k(G){var K={msg:v.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,data:G};S.postMessage(K)}function q(G){var K={msg:v.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,data:G};S.postMessage(K)}function Q(G){var K={msg:v.a.SMPTE2038_METADATA_ARRIVED,data:G};S.postMessage(K)}function O(G){var K={msg:v.a.SCTE35_METADATA_ARRIVED,data:G};S.postMessage(K)}function l(G){var K={msg:v.a.PES_PRIVATE_DATA_DESCRIPTOR,data:G};S.postMessage(K)}function _(G){var K={msg:v.a.PES_PRIVATE_DATA_ARRIVED,data:G};S.postMessage(K)}function d(G){var K={msg:v.a.STATISTICS_INFO,data:G};S.postMessage(K)}function f(G,K){S.postMessage({msg:v.a.IO_ERROR,data:{type:G,info:K}})}function V(G,K){S.postMessage({msg:v.a.DEMUX_ERROR,data:{type:G,info:K}})}function J(G){S.postMessage({msg:v.a.RECOMMEND_SEEKPOINT,data:G})}M.a.install(),S.addEventListener("message",function(G){switch(G.data.cmd){case"init":(g=new p.a(G.data.param[0],G.data.param[1])).on(v.a.IO_ERROR,f.bind(this)),g.on(v.a.DEMUX_ERROR,V.bind(this)),g.on(v.a.INIT_SEGMENT,E.bind(this)),g.on(v.a.MEDIA_SEGMENT,L.bind(this)),g.on(v.a.LOADING_COMPLETE,B.bind(this)),g.on(v.a.RECOVERED_EARLY_EOF,w.bind(this)),g.on(v.a.MEDIA_INFO,U.bind(this)),g.on(v.a.METADATA_ARRIVED,N.bind(this)),g.on(v.a.SCRIPTDATA_ARRIVED,P.bind(this)),g.on(v.a.TIMED_ID3_METADATA_ARRIVED,X.bind(this)),g.on(v.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,k.bind(this)),g.on(v.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,q.bind(this)),g.on(v.a.SMPTE2038_METADATA_ARRIVED,Q.bind(this)),g.on(v.a.SCTE35_METADATA_ARRIVED,O.bind(this)),g.on(v.a.PES_PRIVATE_DATA_DESCRIPTOR,l.bind(this)),g.on(v.a.PES_PRIVATE_DATA_ARRIVED,_.bind(this)),g.on(v.a.STATISTICS_INFO,d.bind(this)),g.on(v.a.RECOMMEND_SEEKPOINT,J.bind(this));break;case"destroy":g&&(g.destroy(),g=null),S.postMessage({msg:"destroyed"});break;case"start":g.start();break;case"stop":g.stop();break;case"seek":g.seek(G.data.param);break;case"pause":g.pause();break;case"resume":g.resume();break;case"logging_config":var K=G.data.param;F.a.applyConfig(K),K.enableCallback===!0?F.a.addLogListener(T):F.a.removeLogListener(T)}})}},function(me,te,D){me.exports=D(25).default},function(me,te,D){(function(F,M){/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.8+1e68dce6
*/var p;p=function(){function v(j){return typeof j=="function"}var S=Array.isArray?Array.isArray:function(j){return Object.prototype.toString.call(j)==="[object Array]"},g=0,T=void 0,E=void 0,L=function(j,W){k[g]=j,k[g+1]=W,(g+=2)===2&&(E?E(q):d())},B=typeof window<"u"?window:void 0,w=B||{},U=w.MutationObserver||w.WebKitMutationObserver,N=typeof self>"u"&&F!==void 0&&{}.toString.call(F)==="[object process]",P=typeof Uint8ClampedArray<"u"&&typeof importScripts<"u"&&typeof MessageChannel<"u";function X(){var j=setTimeout;return function(){return j(q,1)}}var k=new Array(1e3);function q(){for(var j=0;j<g;j+=2)(0,k[j])(k[j+1]),k[j]=void 0,k[j+1]=void 0;g=0}var Q,O,l,_,d=void 0;function f(j,W){var ie=this,ce=new this.constructor(G);ce[J]===void 0&&de(ce);var he=ie._state;if(he){var ve=arguments[he-1];L(function(){return z(he,ce,ve,ie._result)})}else c(ie,ce,j,W);return ce}function V(j){if(j&&typeof j=="object"&&j.constructor===this)return j;var W=new this(G);return se(W,j),W}N?d=function(){return F.nextTick(q)}:U?(O=0,l=new U(q),_=document.createTextNode(""),l.observe(_,{characterData:!0}),d=function(){_.data=O=++O%2}):P?((Q=new MessageChannel).port1.onmessage=q,d=function(){return Q.port2.postMessage(0)}):d=B===void 0?function(){try{var j=Function("return this")().require("vertx");return(T=j.runOnLoop||j.runOnContext)!==void 0?function(){T(q)}:X()}catch{return X()}}():X();var J=Math.random().toString(36).substring(2);function G(){}function K(j,W,ie){W.constructor===j.constructor&&ie===f&&W.constructor.resolve===V?function(ce,he){he._state===1?_e(ce,he._result):he._state===2?b(ce,he._result):c(he,void 0,function(ve){return se(ce,ve)},function(ve){return b(ce,ve)})}(j,W):ie===void 0?_e(j,W):v(ie)?function(ce,he,ve){L(function(Me){var Ce=!1,Ue=function(ke,He,Ye,Ze){try{ke.call(He,Ye,Ze)}catch($e){return $e}}(ve,he,function(ke){Ce||(Ce=!0,he!==ke?se(Me,ke):_e(Me,ke))},function(ke){Ce||(Ce=!0,b(Me,ke))},Me._label);!Ce&&Ue&&(Ce=!0,b(Me,Ue))},ce)}(j,W,ie):_e(j,W)}function se(j,W){if(j===W)b(j,new TypeError("You cannot resolve a promise with itself"));else if(he=typeof(ce=W),ce===null||he!=="object"&&he!=="function")_e(j,W);else{var ie=void 0;try{ie=W.then}catch(ve){return void b(j,ve)}K(j,W,ie)}var ce,he}function Ee(j){j._onerror&&j._onerror(j._result),C(j)}function _e(j,W){j._state===void 0&&(j._result=W,j._state=1,j._subscribers.length!==0&&L(C,j))}function b(j,W){j._state===void 0&&(j._state=2,j._result=W,L(Ee,j))}function c(j,W,ie,ce){var he=j._subscribers,ve=he.length;j._onerror=null,he[ve]=W,he[ve+1]=ie,he[ve+2]=ce,ve===0&&j._state&&L(C,j)}function C(j){var W=j._subscribers,ie=j._state;if(W.length!==0){for(var ce=void 0,he=void 0,ve=j._result,Me=0;Me<W.length;Me+=3)ce=W[Me],he=W[Me+ie],ce?z(ie,ce,he,ve):he(ve);j._subscribers.length=0}}function z(j,W,ie,ce){var he=v(ie),ve=void 0,Me=void 0,Ce=!0;if(he){try{ve=ie(ce)}catch(Ue){Ce=!1,Me=Ue}if(W===ve)return void b(W,new TypeError("A promises callback cannot return that same promise."))}else ve=ce;W._state!==void 0||(he&&Ce?se(W,ve):Ce===!1?b(W,Me):j===1?_e(W,ve):j===2&&b(W,ve))}var ne=0;function de(j){j[J]=ne++,j._state=void 0,j._result=void 0,j._subscribers=[]}var Te=function(){function j(W,ie){this._instanceConstructor=W,this.promise=new W(G),this.promise[J]||de(this.promise),S(ie)?(this.length=ie.length,this._remaining=ie.length,this._result=new Array(this.length),this.length===0?_e(this.promise,this._result):(this.length=this.length||0,this._enumerate(ie),this._remaining===0&&_e(this.promise,this._result))):b(this.promise,new Error("Array Methods must be provided an Array"))}return j.prototype._enumerate=function(W){for(var ie=0;this._state===void 0&&ie<W.length;ie++)this._eachEntry(W[ie],ie)},j.prototype._eachEntry=function(W,ie){var ce=this._instanceConstructor,he=ce.resolve;if(he===V){var ve=void 0,Me=void 0,Ce=!1;try{ve=W.then}catch(ke){Ce=!0,Me=ke}if(ve===f&&W._state!==void 0)this._settledAt(W._state,ie,W._result);else if(typeof ve!="function")this._remaining--,this._result[ie]=W;else if(ce===ye){var Ue=new ce(G);Ce?b(Ue,Me):K(Ue,W,ve),this._willSettleAt(Ue,ie)}else this._willSettleAt(new ce(function(ke){return ke(W)}),ie)}else this._willSettleAt(he(W),ie)},j.prototype._settledAt=function(W,ie,ce){var he=this.promise;he._state===void 0&&(this._remaining--,W===2?b(he,ce):this._result[ie]=ce),this._remaining===0&&_e(he,this._result)},j.prototype._willSettleAt=function(W,ie){var ce=this;c(W,void 0,function(he){return ce._settledAt(1,ie,he)},function(he){return ce._settledAt(2,ie,he)})},j}(),ye=function(){function j(W){this[J]=ne++,this._result=this._state=void 0,this._subscribers=[],G!==W&&(typeof W!="function"&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof j?function(ie,ce){try{ce(function(he){se(ie,he)},function(he){b(ie,he)})}catch(he){b(ie,he)}}(this,W):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return j.prototype.catch=function(W){return this.then(null,W)},j.prototype.finally=function(W){var ie=this.constructor;return v(W)?this.then(function(ce){return ie.resolve(W()).then(function(){return ce})},function(ce){return ie.resolve(W()).then(function(){throw ce})}):this.then(W,W)},j}();return ye.prototype.then=f,ye.all=function(j){return new Te(this,j).promise},ye.race=function(j){var W=this;return S(j)?new W(function(ie,ce){for(var he=j.length,ve=0;ve<he;ve++)W.resolve(j[ve]).then(ie,ce)}):new W(function(ie,ce){return ce(new TypeError("You must pass an array to race."))})},ye.resolve=V,ye.reject=function(j){var W=new this(G);return b(W,j),W},ye._setScheduler=function(j){E=j},ye._setAsap=function(j){L=j},ye._asap=L,ye.polyfill=function(){var j=void 0;if(M!==void 0)j=M;else if(typeof self<"u")j=self;else try{j=Function("return this")()}catch{throw new Error("polyfill failed because global object is unavailable in this environment")}var W=j.Promise;if(W){var ie=null;try{ie=Object.prototype.toString.call(W.resolve())}catch{}if(ie==="[object Promise]"&&!W.cast)return}j.Promise=ye},ye.Promise=ye,ye},me.exports=p()}).call(this,D(22),D(23))},function(me,te){var D,F,M=me.exports={};function p(){throw new Error("setTimeout has not been defined")}function v(){throw new Error("clearTimeout has not been defined")}function S(P){if(D===setTimeout)return setTimeout(P,0);if((D===p||!D)&&setTimeout)return D=setTimeout,setTimeout(P,0);try{return D(P,0)}catch{try{return D.call(null,P,0)}catch{return D.call(this,P,0)}}}(function(){try{D=typeof setTimeout=="function"?setTimeout:p}catch{D=p}try{F=typeof clearTimeout=="function"?clearTimeout:v}catch{F=v}})();var g,T=[],E=!1,L=-1;function B(){E&&g&&(E=!1,g.length?T=g.concat(T):L=-1,T.length&&w())}function w(){if(!E){var P=S(B);E=!0;for(var X=T.length;X;){for(g=T,T=[];++L<X;)g&&g[L].run();L=-1,X=T.length}g=null,E=!1,function(k){if(F===clearTimeout)return clearTimeout(k);if((F===v||!F)&&clearTimeout)return F=clearTimeout,clearTimeout(k);try{F(k)}catch{try{return F.call(null,k)}catch{return F.call(this,k)}}}(P)}}function U(P,X){this.fun=P,this.array=X}function N(){}M.nextTick=function(P){var X=new Array(arguments.length-1);if(arguments.length>1)for(var k=1;k<arguments.length;k++)X[k-1]=arguments[k];T.push(new U(P,X)),T.length!==1||E||S(w)},U.prototype.run=function(){this.fun.apply(null,this.array)},M.title="browser",M.browser=!0,M.env={},M.argv=[],M.version="",M.versions={},M.on=N,M.addListener=N,M.once=N,M.off=N,M.removeListener=N,M.removeAllListeners=N,M.emit=N,M.prependListener=N,M.prependOnceListener=N,M.listeners=function(P){return[]},M.binding=function(P){throw new Error("process.binding is not supported")},M.cwd=function(){return"/"},M.chdir=function(P){throw new Error("process.chdir is not supported")},M.umask=function(){return 0}},function(me,te){var D;D=function(){return this}();try{D=D||new Function("return this")()}catch{typeof window=="object"&&(D=window)}me.exports=D},function(me,te,D){D.r(te);var F=D(0),M=D(8),p=D(3),v=D(7),S=D(16),g=D(17),T=D(1),E=D(4),L=D(10);te.default=function(B){var w="PlayerEngineWorker",U=(function(b,c){B.postMessage({msg:"logcat_callback",type:b,logcat:c})}).bind(void 0),N=null,P=null,X=null,k=null,q=!1,Q=!1,O=0,l=0,_=!1;function d(){X&&(X.shutdown(),X.destroy(),X=null)}function f(){if(N==null||P==null)throw new p.a("Worker not initialized");if(k)throw new p.a("Transmuxer has been initialized");Q||(!P.deferLoadAfterSourceOpen||q?((k=new g.a(N,P)).on(T.a.INIT_SEGMENT,function(b,c){X.appendInitSegment(c)}),k.on(T.a.MEDIA_SEGMENT,function(b,c){X.appendMediaSegment(c),B.postMessage({msg:"buffered_position_changed",buffered_position_milliseconds:c.info.endDts})}),k.on(T.a.LOADING_COMPLETE,function(){X.endOfStream(),B.postMessage({msg:"player_event",event:E.a.LOADING_COMPLETE})}),k.on(T.a.RECOVERED_EARLY_EOF,function(){B.postMessage({msg:"player_event",event:E.a.RECOVERED_EARLY_EOF})}),k.on(T.a.IO_ERROR,function(b,c){B.postMessage({msg:"player_event",event:E.a.ERROR,error_type:L.b.NETWORK_ERROR,error_detail:b,info:c})}),k.on(T.a.DEMUX_ERROR,function(b,c){B.postMessage({msg:"player_event",event:E.a.ERROR,error_type:L.b.MEDIA_ERROR,error_detail:b,info:c})}),k.on(T.a.MEDIA_INFO,function(b){Ee(T.a.MEDIA_INFO,b)}),k.on(T.a.STATISTICS_INFO,function(b){Ee(T.a.STATISTICS_INFO,b)}),k.on(T.a.RECOMMEND_SEEKPOINT,function(b){(function(c){B.postMessage({msg:"transmuxing_event",event:T.a.RECOMMEND_SEEKPOINT,milliseconds:c})})(b)}),k.on(T.a.METADATA_ARRIVED,function(b){_e(E.a.METADATA_ARRIVED,b)}),k.on(T.a.SCRIPTDATA_ARRIVED,function(b){_e(E.a.SCRIPTDATA_ARRIVED,b)}),k.on(T.a.TIMED_ID3_METADATA_ARRIVED,function(b){_e(E.a.TIMED_ID3_METADATA_ARRIVED,b)}),k.on(T.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,function(b){_e(E.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,b)}),k.on(T.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,function(b){_e(E.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,b)}),k.on(T.a.SMPTE2038_METADATA_ARRIVED,function(b){_e(E.a.SMPTE2038_METADATA_ARRIVED,b)}),k.on(T.a.SCTE35_METADATA_ARRIVED,function(b){_e(E.a.SCTE35_METADATA_ARRIVED,b)}),k.on(T.a.PES_PRIVATE_DATA_DESCRIPTOR,function(b){_e(E.a.PES_PRIVATE_DATA_DESCRIPTOR,b)}),k.on(T.a.PES_PRIVATE_DATA_ARRIVED,function(b){_e(E.a.PES_PRIVATE_DATA_ARRIVED,b)}),k.open()):Q=!0)}function V(){X&&X.flush(),k&&(k.close(),k.destroy(),k=null)}function J(){q=!0,Q&&(Q=!1,f())}function G(){B.postMessage({msg:"mse_event",event:v.a.UPDATE_END})}function K(){F.a.v(w,"MSE SourceBuffer is full, report to main thread"),B.postMessage({msg:"mse_event",event:v.a.BUFFER_FULL})}function se(b){B.postMessage({msg:"player_event",event:E.a.ERROR,error_type:L.b.MEDIA_ERROR,error_detail:L.b.MEDIA_MSE_ERROR,info:b})}function Ee(b,c){B.postMessage({msg:"transmuxing_event",event:b,info:c})}function _e(b,c){B.postMessage({msg:"player_event",event:b,extraData:c})}B.addEventListener("message",function(b){if(!_){var c=b.data;switch(c.cmd){case"logging_config":var C=c;M.a.applyConfig(C.logging_config),C.logging_config.enableCallback===!0?M.a.addLogListener(U):M.a.removeLogListener(U);break;case"init":N=(C=c).media_data_source,P=C.config;break;case"destroy":(function(){k&&V(),X&&d(),_=!0,B.postMessage({msg:"destroyed"})})();break;case"initialize_mse":(function(){F.a.v(w,"Initializing MediaSource in DedicatedWorker"),(X=new S.a(P)).on(v.a.SOURCE_OPEN,J.bind(this)),X.on(v.a.UPDATE_END,G.bind(this)),X.on(v.a.BUFFER_FULL,K.bind(this)),X.on(v.a.ERROR,se.bind(this)),X.initialize({getCurrentTime:function(){return O},getReadyState:function(){return l}});var z=X.getHandle();B.postMessage({msg:"mse_init",handle:z},[z])})();break;case"shutdown_mse":d();break;case"load":f();break;case"unload":V();break;case"unbuffered_seek":C=c,X.flush(),k.seek(C.milliseconds);break;case"timeupdate":O=(C=c).current_time;break;case"readystatechange":l=(C=c).ready_state;break;case"pause_transmuxer":k.pause();break;case"resume_transmuxer":k.resume()}}})}},function(me,te,D){D.r(te);var F=D(15),M=D(14),p={enableWorker:!1,enableWorkerForMSE:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,liveBufferLatencyChasing:!1,liveBufferLatencyChasingOnPaused:!1,liveBufferLatencyMaxLatency:1.5,liveBufferLatencyMinRemain:.5,liveSync:!1,liveSyncMaxLatency:1.2,liveSyncTargetLatency:.8,liveSyncPlaybackRate:1.2,lazyLoad:!0,lazyLoadMaxDuration:180,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:180,autoCleanupMinBackwardDuration:120,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function v(){return Object.assign({},p)}var S=function(){function b(){}return b.supportMSEH264Playback=function(){var c=self.MediaSource&&self.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),C=self.ManagedMediaSource&&self.ManagedMediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"');return c||C},b.supportMSEH265Playback=function(){var c=self.MediaSource&&self.MediaSource.isTypeSupported('video/mp4; codecs="hvc1.1.6.L93.B0"'),C=self.ManagedMediaSource&&self.ManagedMediaSource.isTypeSupported('video/mp4; codecs="hvc1.1.6.L93.B0"');return c||C},b.supportNetworkStreamIO=function(){var c=new M.a({},v()),C=c.loaderType;return c.destroy(),C=="fetch-stream-loader"||C=="xhr-moz-chunked-loader"},b.getNetworkLoaderTypeName=function(){var c=new M.a({},v()),C=c.loaderType;return c.destroy(),C},b.supportNativeMediaPlayback=function(c){b.videoElement==null&&(b.videoElement=window.document.createElement("video"));var C=b.videoElement.canPlayType(c);return C==="probably"||C=="maybe"},b.getFeatureList=function(){var c={msePlayback:!1,mseLivePlayback:!1,mseH265Playback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeMP4H265Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return c.msePlayback=b.supportMSEH264Playback(),c.networkStreamIO=b.supportNetworkStreamIO(),c.networkLoaderName=b.getNetworkLoaderTypeName(),c.mseLivePlayback=c.msePlayback&&c.networkStreamIO,c.mseH265Playback=b.supportMSEH265Playback(),c.nativeMP4H264Playback=b.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),c.nativeMP4H265Playback=b.supportNativeMediaPlayback('video/mp4; codecs="hvc1.1.6.L93.B0"'),c.nativeWebmVP8Playback=b.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),c.nativeWebmVP9Playback=b.supportNativeMediaPlayback('video/webm; codecs="vp9"'),c},b}(),g=D(2),T=D(0),E=D(9),L=D.n(E),B=D(16),w=D(4),U=D(17),N=D(7),P=D(10),X=D(3),k=D(1),q=D(5),Q=D(11),O=function(){function b(c,C,z){this.TAG="SeekingHandler",this._config=null,this._media_element=null,this._always_seek_keyframe=!1,this._on_unbuffered_seek=null,this._request_set_current_time=!1,this._seek_request_record_clocktime=null,this._idr_sample_list=new Q.a,this.e=null,this._config=c,this._media_element=C,this._on_unbuffered_seek=z,this.e={onMediaSeeking:this._onMediaSeeking.bind(this)};var ne=q.a.chrome&&(q.a.version.major<50||q.a.version.major===50&&q.a.version.build<2661);this._always_seek_keyframe=!!(ne||q.a.msedge||q.a.msie),this._always_seek_keyframe&&(this._config.accurateSeek=!1),this._media_element.addEventListener("seeking",this.e.onMediaSeeking)}return b.prototype.destroy=function(){this._idr_sample_list.clear(),this._idr_sample_list=null,this._media_element.removeEventListener("seeking",this.e.onMediaSeeking),this._media_element=null,this._on_unbuffered_seek=null},b.prototype.seek=function(c){var C=this._isPositionBuffered(c),z=!1;if(c<1&&this._media_element.buffered.length>0){var ne=this._media_element.buffered.start(0);(ne<1&&c<ne||q.a.safari)&&(z=!0,c=q.a.safari?.1:ne)}if(z)this.directSeek(c);else if(C)if(this._always_seek_keyframe){var de=this._getNearestKeyframe(Math.floor(1e3*c));de!=null&&(c=de.dts/1e3),this.directSeek(c)}else this.directSeek(c);else this._idr_sample_list.clear(),this._on_unbuffered_seek(Math.floor(1e3*c)),this._config.accurateSeek&&this.directSeek(c)},b.prototype.directSeek=function(c){this._request_set_current_time=!0,this._media_element.currentTime=c},b.prototype.appendSyncPoints=function(c){this._idr_sample_list.appendArray(c)},b.prototype._onMediaSeeking=function(c){if(this._request_set_current_time)this._request_set_current_time=!1;else{var C=this._media_element.currentTime,z=this._media_element.buffered;if(C<1&&z.length>0){var ne=z.start(0);if(ne<1&&C<ne||q.a.safari){var de=q.a.safari?.1:ne;return void this.directSeek(de)}}if(this._isPositionBuffered(C)){if(this._always_seek_keyframe){var Te=this._getNearestKeyframe(Math.floor(1e3*C));Te!=null&&(C=Te.dts/1e3,this.directSeek(C))}}else this._seek_request_record_clocktime=b._getClockTime(),window.setTimeout(this._pollAndApplyUnbufferedSeek.bind(this),50)}},b.prototype._pollAndApplyUnbufferedSeek=function(){if(this._seek_request_record_clocktime!=null)if(this._seek_request_record_clocktime<=b._getClockTime()-100){var c=this._media_element.currentTime;this._seek_request_record_clocktime=null,this._isPositionBuffered(c)||(this._idr_sample_list.clear(),this._on_unbuffered_seek(Math.floor(1e3*c)),this._config.accurateSeek&&this.directSeek(c))}else window.setTimeout(this._pollAndApplyUnbufferedSeek.bind(this),50)},b.prototype._isPositionBuffered=function(c){for(var C=this._media_element.buffered,z=0;z<C.length;z++){var ne=C.start(z),de=C.end(z);if(c>=ne&&c<de)return!0}return!1},b.prototype._getNearestKeyframe=function(c){return this._idr_sample_list.getLastSyncPointBeforeDts(c)},b._getClockTime=function(){return self.performance&&self.performance.now?self.performance.now():Date.now()},b}(),l=function(){function b(c,C,z,ne){this.TAG="LoadingController",this._config=null,this._media_element=null,this._on_pause_transmuxer=null,this._on_resume_transmuxer=null,this._paused=!1,this.e=null,this._config=c,this._media_element=C,this._on_pause_transmuxer=z,this._on_resume_transmuxer=ne,this.e={onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this)}}return b.prototype.destroy=function(){this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate),this.e=null,this._media_element=null,this._config=null,this._on_pause_transmuxer=null,this._on_resume_transmuxer=null},b.prototype.notifyBufferedPositionChanged=function(c){!this._config.isLive&&this._config.lazyLoad&&(c==null?this._suspendTransmuxerIfNeeded():this._suspendTransmuxerIfBufferedPositionExceeded(c))},b.prototype._onMediaTimeUpdate=function(c){this._paused&&this._resumeTransmuxerIfNeeded()},b.prototype._suspendTransmuxerIfNeeded=function(){for(var c=this._media_element.buffered,C=this._media_element.currentTime,z=0,ne=0;ne<c.length;ne++){var de=c.start(ne),Te=c.end(ne);if(de<=C&&C<Te){z=Te;break}}z>0&&this._suspendTransmuxerIfBufferedPositionExceeded(z)},b.prototype._suspendTransmuxerIfBufferedPositionExceeded=function(c){c>=this._media_element.currentTime+this._config.lazyLoadMaxDuration&&!this._paused&&(T.a.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this.suspendTransmuxer(),this._media_element.addEventListener("timeupdate",this.e.onMediaTimeUpdate))},b.prototype.suspendTransmuxer=function(){this._paused=!0,this._on_pause_transmuxer()},b.prototype._resumeTransmuxerIfNeeded=function(){for(var c=this._media_element.buffered,C=this._media_element.currentTime,z=this._config.lazyLoadRecoverDuration,ne=!1,de=0;de<c.length;de++){var Te=c.start(de),ye=c.end(de);if(C>=Te&&C<ye){C>=ye-z&&(ne=!0);break}}ne&&(T.a.v(this.TAG,"Continue loading from paused position"),this.resumeTransmuxer(),this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate))},b.prototype.resumeTransmuxer=function(){this._paused=!1,this._on_resume_transmuxer()},b}(),_=function(){function b(c,C){this.TAG="StartupStallJumper",this._media_element=null,this._on_direct_seek=null,this._canplay_received=!1,this.e=null,this._media_element=c,this._on_direct_seek=C,this.e={onMediaCanPlay:this._onMediaCanPlay.bind(this),onMediaStalled:this._onMediaStalled.bind(this),onMediaProgress:this._onMediaProgress.bind(this)},this._media_element.addEventListener("canplay",this.e.onMediaCanPlay),this._media_element.addEventListener("stalled",this.e.onMediaStalled),this._media_element.addEventListener("progress",this.e.onMediaProgress)}return b.prototype.destroy=function(){this._media_element.removeEventListener("canplay",this.e.onMediaCanPlay),this._media_element.removeEventListener("stalled",this.e.onMediaStalled),this._media_element.removeEventListener("progress",this.e.onMediaProgress),this._media_element=null,this._on_direct_seek=null},b.prototype._onMediaCanPlay=function(c){this._canplay_received=!0,this._media_element.removeEventListener("canplay",this.e.onMediaCanPlay)},b.prototype._onMediaStalled=function(c){this._detectAndFixStuckPlayback(!0)},b.prototype._onMediaProgress=function(c){this._detectAndFixStuckPlayback()},b.prototype._detectAndFixStuckPlayback=function(c){var C=this._media_element,z=C.buffered;c||!this._canplay_received||C.readyState<2?z.length>0&&C.currentTime<z.start(0)&&(T.a.w(this.TAG,"Playback seems stuck at ".concat(C.currentTime,", seek to ").concat(z.start(0))),this._on_direct_seek(z.start(0)),this._media_element.removeEventListener("progress",this.e.onMediaProgress)):this._media_element.removeEventListener("progress",this.e.onMediaProgress)},b}(),d=function(){function b(c,C,z){this._config=null,this._media_element=null,this._on_direct_seek=null,this._config=c,this._media_element=C,this._on_direct_seek=z}return b.prototype.destroy=function(){this._on_direct_seek=null,this._media_element=null,this._config=null},b.prototype.notifyBufferedRangeUpdate=function(){this._chaseLiveLatency()},b.prototype._chaseLiveLatency=function(){var c=this._media_element.buffered,C=this._media_element.currentTime,z=this._media_element.paused;if(this._config.isLive&&this._config.liveBufferLatencyChasing&&c.length!=0&&(this._config.liveBufferLatencyChasingOnPaused||!z)){var ne=c.end(c.length-1);if(ne>this._config.liveBufferLatencyMaxLatency&&ne-C>this._config.liveBufferLatencyMaxLatency){var de=ne-this._config.liveBufferLatencyMinRemain;this._on_direct_seek(de)}}},b}(),f=function(){function b(c,C){this._config=null,this._media_element=null,this.e=null,this._config=c,this._media_element=C,this.e={onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this)},this._media_element.addEventListener("timeupdate",this.e.onMediaTimeUpdate)}return b.prototype.destroy=function(){this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate),this._media_element=null,this._config=null},b.prototype._onMediaTimeUpdate=function(c){if(this._config.isLive&&this._config.liveSync){var C=this._getCurrentLatency();if(C>this._config.liveSyncMaxLatency){var z=Math.min(2,Math.max(1,this._config.liveSyncPlaybackRate));this._media_element.playbackRate=z}else C>this._config.liveSyncTargetLatency||this._media_element.playbackRate!==1&&this._media_element.playbackRate!==0&&(this._media_element.playbackRate=1)}},b.prototype._getCurrentLatency=function(){if(!this._media_element)return 0;var c=this._media_element.buffered,C=this._media_element.currentTime;return c.length==0?0:c.end(c.length-1)-C},b}(),V=function(){function b(c,C){this.TAG="PlayerEngineMainThread",this._emitter=new E,this._media_element=null,this._mse_controller=null,this._transmuxer=null,this._pending_seek_time=null,this._seeking_handler=null,this._loading_controller=null,this._startup_stall_jumper=null,this._live_latency_chaser=null,this._live_latency_synchronizer=null,this._mse_source_opened=!1,this._has_pending_load=!1,this._loaded_metadata_received=!1,this._media_info=null,this._statistics_info=null,this.e=null,this._media_data_source=c,this._config=v(),typeof C=="object"&&Object.assign(this._config,C),c.isLive===!0&&(this._config.isLive=!0),this.e={onMediaLoadedMetadata:this._onMediaLoadedMetadata.bind(this)}}return b.prototype.destroy=function(){this._emitter.emit(w.a.DESTROYING),this._transmuxer&&this.unload(),this._media_element&&this.detachMediaElement(),this.e=null,this._media_data_source=null,this._emitter.removeAllListeners(),this._emitter=null},b.prototype.on=function(c,C){var z=this;this._emitter.addListener(c,C),c===w.a.MEDIA_INFO&&this._media_info?Promise.resolve().then(function(){return z._emitter.emit(w.a.MEDIA_INFO,z.mediaInfo)}):c==w.a.STATISTICS_INFO&&this._statistics_info&&Promise.resolve().then(function(){return z._emitter.emit(w.a.STATISTICS_INFO,z.statisticsInfo)})},b.prototype.off=function(c,C){this._emitter.removeListener(c,C)},b.prototype.attachMediaElement=function(c){var C=this;this._media_element=c,c.src="",c.removeAttribute("src"),c.srcObject=null,c.load(),c.addEventListener("loadedmetadata",this.e.onMediaLoadedMetadata),this._mse_controller=new B.a(this._config),this._mse_controller.on(N.a.UPDATE_END,this._onMSEUpdateEnd.bind(this)),this._mse_controller.on(N.a.BUFFER_FULL,this._onMSEBufferFull.bind(this)),this._mse_controller.on(N.a.SOURCE_OPEN,this._onMSESourceOpen.bind(this)),this._mse_controller.on(N.a.ERROR,this._onMSEError.bind(this)),this._mse_controller.on(N.a.START_STREAMING,this._onMSEStartStreaming.bind(this)),this._mse_controller.on(N.a.END_STREAMING,this._onMSEEndStreaming.bind(this)),this._mse_controller.initialize({getCurrentTime:function(){return C._media_element.currentTime},getReadyState:function(){return C._media_element.readyState}}),this._mse_controller.isManagedMediaSource()?(c.disableRemotePlayback=!0,c.srcObject=this._mse_controller.getObject()):c.src=this._mse_controller.getObjectURL()},b.prototype.detachMediaElement=function(){this._media_element&&(this._mse_controller.shutdown(),this._media_element.removeEventListener("loadedmetadata",this.e.onMediaLoadedMetadata),this._media_element.src="",this._media_element.removeAttribute("src"),this._media_element.srcObject=null,this._media_element.load(),this._media_element=null,this._mse_controller.revokeObjectURL()),this._mse_controller&&(this._mse_controller.destroy(),this._mse_controller=null)},b.prototype.load=function(){var c=this;if(!this._media_element)throw new X.a("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new X.a("load() has been called, please call unload() first!");this._has_pending_load||(!this._config.deferLoadAfterSourceOpen||this._mse_source_opened?(this._transmuxer=new U.a(this._media_data_source,this._config),this._transmuxer.on(k.a.INIT_SEGMENT,function(C,z){c._mse_controller.appendInitSegment(z)}),this._transmuxer.on(k.a.MEDIA_SEGMENT,function(C,z){c._mse_controller.appendMediaSegment(z),!c._config.isLive&&C==="video"&&z.data&&z.data.byteLength>0&&"info"in z&&c._seeking_handler.appendSyncPoints(z.info.syncPoints),c._loading_controller.notifyBufferedPositionChanged(z.info.endDts/1e3)}),this._transmuxer.on(k.a.LOADING_COMPLETE,function(){c._mse_controller.endOfStream(),c._emitter.emit(w.a.LOADING_COMPLETE)}),this._transmuxer.on(k.a.RECOVERED_EARLY_EOF,function(){c._emitter.emit(w.a.RECOVERED_EARLY_EOF)}),this._transmuxer.on(k.a.IO_ERROR,function(C,z){c._emitter.emit(w.a.ERROR,P.b.NETWORK_ERROR,C,z)}),this._transmuxer.on(k.a.DEMUX_ERROR,function(C,z){c._emitter.emit(w.a.ERROR,P.b.MEDIA_ERROR,C,z)}),this._transmuxer.on(k.a.MEDIA_INFO,function(C){c._media_info=C,c._emitter.emit(w.a.MEDIA_INFO,Object.assign({},C))}),this._transmuxer.on(k.a.STATISTICS_INFO,function(C){c._statistics_info=c._fillStatisticsInfo(C),c._emitter.emit(w.a.STATISTICS_INFO,Object.assign({},C))}),this._transmuxer.on(k.a.RECOMMEND_SEEKPOINT,function(C){c._media_element&&!c._config.accurateSeek&&c._seeking_handler.directSeek(C/1e3)}),this._transmuxer.on(k.a.METADATA_ARRIVED,function(C){c._emitter.emit(w.a.METADATA_ARRIVED,C)}),this._transmuxer.on(k.a.SCRIPTDATA_ARRIVED,function(C){c._emitter.emit(w.a.SCRIPTDATA_ARRIVED,C)}),this._transmuxer.on(k.a.TIMED_ID3_METADATA_ARRIVED,function(C){c._emitter.emit(w.a.TIMED_ID3_METADATA_ARRIVED,C)}),this._transmuxer.on(k.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,function(C){c._emitter.emit(w.a.SYNCHRONOUS_KLV_METADATA_ARRIVED,C)}),this._transmuxer.on(k.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,function(C){c._emitter.emit(w.a.ASYNCHRONOUS_KLV_METADATA_ARRIVED,C)}),this._transmuxer.on(k.a.SMPTE2038_METADATA_ARRIVED,function(C){c._emitter.emit(w.a.SMPTE2038_METADATA_ARRIVED,C)}),this._transmuxer.on(k.a.SCTE35_METADATA_ARRIVED,function(C){c._emitter.emit(w.a.SCTE35_METADATA_ARRIVED,C)}),this._transmuxer.on(k.a.PES_PRIVATE_DATA_DESCRIPTOR,function(C){c._emitter.emit(w.a.PES_PRIVATE_DATA_DESCRIPTOR,C)}),this._transmuxer.on(k.a.PES_PRIVATE_DATA_ARRIVED,function(C){c._emitter.emit(w.a.PES_PRIVATE_DATA_ARRIVED,C)}),this._seeking_handler=new O(this._config,this._media_element,this._onRequiredUnbufferedSeek.bind(this)),this._loading_controller=new l(this._config,this._media_element,this._onRequestPauseTransmuxer.bind(this),this._onRequestResumeTransmuxer.bind(this)),this._startup_stall_jumper=new _(this._media_element,this._onRequestDirectSeek.bind(this)),this._config.isLive&&this._config.liveBufferLatencyChasing&&(this._live_latency_chaser=new d(this._config,this._media_element,this._onRequestDirectSeek.bind(this))),this._config.isLive&&this._config.liveSync&&(this._live_latency_synchronizer=new f(this._config,this._media_element)),this._media_element.readyState>0&&this._seeking_handler.directSeek(0),this._transmuxer.open()):this._has_pending_load=!0)},b.prototype.unload=function(){var c,C,z,ne,de,Te,ye,j,W;(c=this._media_element)===null||c===void 0||c.pause(),(C=this._live_latency_synchronizer)===null||C===void 0||C.destroy(),this._live_latency_synchronizer=null,(z=this._live_latency_chaser)===null||z===void 0||z.destroy(),this._live_latency_chaser=null,(ne=this._startup_stall_jumper)===null||ne===void 0||ne.destroy(),this._startup_stall_jumper=null,(de=this._loading_controller)===null||de===void 0||de.destroy(),this._loading_controller=null,(Te=this._seeking_handler)===null||Te===void 0||Te.destroy(),this._seeking_handler=null,(ye=this._mse_controller)===null||ye===void 0||ye.flush(),(j=this._transmuxer)===null||j===void 0||j.close(),(W=this._transmuxer)===null||W===void 0||W.destroy(),this._transmuxer=null},b.prototype.play=function(){return this._media_element.play()},b.prototype.pause=function(){this._media_element.pause()},b.prototype.seek=function(c){this._media_element&&this._seeking_handler?this._seeking_handler.seek(c):this._pending_seek_time=c},Object.defineProperty(b.prototype,"mediaInfo",{get:function(){return Object.assign({},this._media_info)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"statisticsInfo",{get:function(){return Object.assign({},this._statistics_info)},enumerable:!1,configurable:!0}),b.prototype._onMSESourceOpen=function(){this._mse_source_opened=!0,this._has_pending_load&&(this._has_pending_load=!1,this.load())},b.prototype._onMSEUpdateEnd=function(){this._config.isLive&&this._config.liveBufferLatencyChasing&&this._live_latency_chaser&&this._live_latency_chaser.notifyBufferedRangeUpdate(),this._loading_controller.notifyBufferedPositionChanged()},b.prototype._onMSEBufferFull=function(){T.a.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._loading_controller.suspendTransmuxer()},b.prototype._onMSEError=function(c){this._emitter.emit(w.a.ERROR,P.b.MEDIA_ERROR,P.a.MEDIA_MSE_ERROR,c)},b.prototype._onMSEStartStreaming=function(){this._loaded_metadata_received&&(this._config.isLive||(T.a.v(this.TAG,"Resume transmuxing task due to ManagedMediaSource onStartStreaming"),this._loading_controller.resumeTransmuxer()))},b.prototype._onMSEEndStreaming=function(){this._config.isLive||(T.a.v(this.TAG,"Suspend transmuxing task due to ManagedMediaSource onEndStreaming"),this._loading_controller.suspendTransmuxer())},b.prototype._onMediaLoadedMetadata=function(c){this._loaded_metadata_received=!0,this._pending_seek_time!=null&&(this._seeking_handler.seek(this._pending_seek_time),this._pending_seek_time=null)},b.prototype._onRequestDirectSeek=function(c){this._seeking_handler.directSeek(c)},b.prototype._onRequiredUnbufferedSeek=function(c){this._mse_controller.flush(),this._transmuxer.seek(c)},b.prototype._onRequestPauseTransmuxer=function(){this._transmuxer.pause()},b.prototype._onRequestResumeTransmuxer=function(){this._transmuxer.resume()},b.prototype._fillStatisticsInfo=function(c){if(c.playerType="MSEPlayer",!(this._media_element instanceof HTMLVideoElement))return c;var C=!0,z=0,ne=0;if(this._media_element.getVideoPlaybackQuality){var de=this._media_element.getVideoPlaybackQuality();z=de.totalVideoFrames,ne=de.droppedVideoFrames}else this._media_element.webkitDecodedFrameCount!=null?(z=this._media_element.webkitDecodedFrameCount,ne=this._media_element.webkitDroppedFrameCount):C=!1;return C&&(c.decodedFrames=z,c.droppedFrames=ne),c},b}(),J=D(18),G=D(8),K=function(){function b(c,C){this.TAG="PlayerEngineDedicatedThread",this._emitter=new E,this._media_element=null,this._worker_destroying=!1,this._seeking_handler=null,this._loading_controller=null,this._startup_stall_jumper=null,this._live_latency_chaser=null,this._live_latency_synchronizer=null,this._pending_seek_time=null,this._media_info=null,this._statistics_info=null,this.e=null,this._media_data_source=c,this._config=v(),typeof C=="object"&&Object.assign(this._config,C),c.isLive===!0&&(this._config.isLive=!0),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this),onMediaLoadedMetadata:this._onMediaLoadedMetadata.bind(this),onMediaTimeUpdate:this._onMediaTimeUpdate.bind(this),onMediaReadyStateChanged:this._onMediaReadyStateChange.bind(this)},G.a.registerListener(this.e.onLoggingConfigChanged),this._worker=J(24,{all:!0}),this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",media_data_source:this._media_data_source,config:this._config}),this._worker.postMessage({cmd:"logging_config",logging_config:G.a.getConfig()})}return b.isSupported=function(){return!!self.Worker&&(!(!self.MediaSource||!("canConstructInDedicatedWorker"in self.MediaSource)||self.MediaSource.canConstructInDedicatedWorker!==!0)||!(!self.ManagedMediaSource||!("canConstructInDedicatedWorker"in self.ManagedMediaSource)||self.ManagedMediaSource.canConstructInDedicatedWorker!==!0))},b.prototype.destroy=function(){this._emitter.emit(w.a.DESTROYING),this.unload(),this.detachMediaElement(),this._worker_destroying=!0,this._worker.postMessage({cmd:"destroy"}),G.a.removeListener(this.e.onLoggingConfigChanged),this.e=null,this._media_data_source=null,this._emitter.removeAllListeners(),this._emitter=null},b.prototype.on=function(c,C){var z=this;this._emitter.addListener(c,C),c===w.a.MEDIA_INFO&&this._media_info?Promise.resolve().then(function(){return z._emitter.emit(w.a.MEDIA_INFO,z.mediaInfo)}):c==w.a.STATISTICS_INFO&&this._statistics_info&&Promise.resolve().then(function(){return z._emitter.emit(w.a.STATISTICS_INFO,z.statisticsInfo)})},b.prototype.off=function(c,C){this._emitter.removeListener(c,C)},b.prototype.attachMediaElement=function(c){this._media_element=c,this._media_element.src="",this._media_element.removeAttribute("src"),this._media_element.srcObject=null,this._media_element.load(),this._media_element.addEventListener("loadedmetadata",this.e.onMediaLoadedMetadata),this._media_element.addEventListener("timeupdate",this.e.onMediaTimeUpdate),this._media_element.addEventListener("readystatechange",this.e.onMediaReadyStateChanged),this._worker.postMessage({cmd:"initialize_mse"})},b.prototype.detachMediaElement=function(){this._worker.postMessage({cmd:"shutdown_mse"}),this._media_element&&(this._media_element.removeEventListener("loadedmetadata",this.e.onMediaLoadedMetadata),this._media_element.removeEventListener("timeupdate",this.e.onMediaTimeUpdate),this._media_element.removeEventListener("readystatechange",this.e.onMediaReadyStateChanged),this._media_element.src="",this._media_element.removeAttribute("src"),this._media_element.srcObject=null,this._media_element.load(),this._media_element=null)},b.prototype.load=function(){this._worker.postMessage({cmd:"load"}),this._seeking_handler=new O(this._config,this._media_element,this._onRequiredUnbufferedSeek.bind(this)),this._loading_controller=new l(this._config,this._media_element,this._onRequestPauseTransmuxer.bind(this),this._onRequestResumeTransmuxer.bind(this)),this._startup_stall_jumper=new _(this._media_element,this._onRequestDirectSeek.bind(this)),this._config.isLive&&this._config.liveBufferLatencyChasing&&(this._live_latency_chaser=new d(this._config,this._media_element,this._onRequestDirectSeek.bind(this))),this._config.isLive&&this._config.liveSync&&(this._live_latency_synchronizer=new f(this._config,this._media_element)),this._media_element.readyState>0&&this._seeking_handler.directSeek(0)},b.prototype.unload=function(){var c,C,z,ne,de,Te;(c=this._media_element)===null||c===void 0||c.pause(),this._worker.postMessage({cmd:"unload"}),(C=this._live_latency_synchronizer)===null||C===void 0||C.destroy(),this._live_latency_synchronizer=null,(z=this._live_latency_chaser)===null||z===void 0||z.destroy(),this._live_latency_chaser=null,(ne=this._startup_stall_jumper)===null||ne===void 0||ne.destroy(),this._startup_stall_jumper=null,(de=this._loading_controller)===null||de===void 0||de.destroy(),this._loading_controller=null,(Te=this._seeking_handler)===null||Te===void 0||Te.destroy(),this._seeking_handler=null},b.prototype.play=function(){return this._media_element.play()},b.prototype.pause=function(){this._media_element.pause()},b.prototype.seek=function(c){this._media_element&&this._seeking_handler?this._seeking_handler.seek(c):this._pending_seek_time=c},Object.defineProperty(b.prototype,"mediaInfo",{get:function(){return Object.assign({},this._media_info)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"statisticsInfo",{get:function(){return Object.assign({},this._statistics_info)},enumerable:!1,configurable:!0}),b.prototype._onLoggingConfigChanged=function(c){var C;(C=this._worker)===null||C===void 0||C.postMessage({cmd:"logging_config",logging_config:c})},b.prototype._onMSEUpdateEnd=function(){this._config.isLive&&this._config.liveBufferLatencyChasing&&this._live_latency_chaser&&this._live_latency_chaser.notifyBufferedRangeUpdate(),this._loading_controller.notifyBufferedPositionChanged()},b.prototype._onMSEBufferFull=function(){T.a.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._loading_controller.suspendTransmuxer()},b.prototype._onMediaLoadedMetadata=function(c){this._pending_seek_time!=null&&(this._seeking_handler.seek(this._pending_seek_time),this._pending_seek_time=null)},b.prototype._onRequestDirectSeek=function(c){this._seeking_handler.directSeek(c)},b.prototype._onRequiredUnbufferedSeek=function(c){this._worker.postMessage({cmd:"unbuffered_seek",milliseconds:c})},b.prototype._onRequestPauseTransmuxer=function(){this._worker.postMessage({cmd:"pause_transmuxer"})},b.prototype._onRequestResumeTransmuxer=function(){this._worker.postMessage({cmd:"resume_transmuxer"})},b.prototype._onMediaTimeUpdate=function(c){this._worker.postMessage({cmd:"timeupdate",current_time:c.target.currentTime})},b.prototype._onMediaReadyStateChange=function(c){this._worker.postMessage({cmd:"readystatechange",ready_state:c.target.readyState})},b.prototype._onWorkerMessage=function(c){var C,z=c.data,ne=z.msg;if(ne=="destroyed"||this._worker_destroying)return this._worker_destroying=!1,(C=this._worker)===null||C===void 0||C.terminate(),void(this._worker=null);switch(ne){case"mse_init":var de=z;"ManagedMediaSource"in self&&!("MediaSource"in self)&&(this._media_element.disableRemotePlayback=!0),this._media_element.srcObject=de.handle;break;case"mse_event":(de=z).event==N.a.UPDATE_END?this._onMSEUpdateEnd():de.event==N.a.BUFFER_FULL&&this._onMSEBufferFull();break;case"transmuxing_event":if((de=z).event==k.a.MEDIA_INFO){var Te=z;this._media_info=Te.info,this._emitter.emit(w.a.MEDIA_INFO,Object.assign({},Te.info))}else if(de.event==k.a.STATISTICS_INFO){var ye=z;this._statistics_info=this._fillStatisticsInfo(ye.info),this._emitter.emit(w.a.STATISTICS_INFO,Object.assign({},ye.info))}else if(de.event==k.a.RECOMMEND_SEEKPOINT){var j=z;this._media_element&&!this._config.accurateSeek&&this._seeking_handler.directSeek(j.milliseconds/1e3)}break;case"player_event":if((de=z).event==w.a.ERROR){var W=z;this._emitter.emit(w.a.ERROR,W.error_type,W.error_detail,W.info)}else if("extraData"in de){var ie=z;this._emitter.emit(ie.event,ie.extraData)}break;case"logcat_callback":de=z,T.a.emitter.emit("log",de.type,de.logcat);break;case"buffered_position_changed":de=z,this._loading_controller.notifyBufferedPositionChanged(de.buffered_position_milliseconds/1e3)}},b.prototype._fillStatisticsInfo=function(c){if(c.playerType="MSEPlayer",!(this._media_element instanceof HTMLVideoElement))return c;var C=!0,z=0,ne=0;if(this._media_element.getVideoPlaybackQuality){var de=this._media_element.getVideoPlaybackQuality();z=de.totalVideoFrames,ne=de.droppedVideoFrames}else this._media_element.webkitDecodedFrameCount!=null?(z=this._media_element.webkitDecodedFrameCount,ne=this._media_element.webkitDroppedFrameCount):C=!1;return C&&(c.decodedFrames=z,c.droppedFrames=ne),c},b}(),se=function(){function b(c,C){this.TAG="MSEPlayer",this._type="MSEPlayer",this._media_element=null,this._player_engine=null;var z=c.type.toLowerCase();if(z!=="mse"&&z!=="mpegts"&&z!=="m2ts"&&z!=="flv")throw new X.b("MSEPlayer requires an mpegts/m2ts/flv MediaDataSource input!");if(C&&C.enableWorkerForMSE&&K.isSupported())try{this._player_engine=new K(c,C)}catch{T.a.e(this.TAG,"Error while initializing PlayerEngineDedicatedThread, fallback to PlayerEngineMainThread"),this._player_engine=new V(c,C)}else this._player_engine=new V(c,C)}return b.prototype.destroy=function(){this._player_engine.destroy(),this._player_engine=null,this._media_element=null},b.prototype.on=function(c,C){this._player_engine.on(c,C)},b.prototype.off=function(c,C){this._player_engine.off(c,C)},b.prototype.attachMediaElement=function(c){this._media_element=c,this._player_engine.attachMediaElement(c)},b.prototype.detachMediaElement=function(){this._media_element=null,this._player_engine.detachMediaElement()},b.prototype.load=function(){this._player_engine.load()},b.prototype.unload=function(){this._player_engine.unload()},b.prototype.play=function(){return this._player_engine.play()},b.prototype.pause=function(){this._player_engine.pause()},Object.defineProperty(b.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"buffered",{get:function(){return this._media_element.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"duration",{get:function(){return this._media_element.duration},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"volume",{get:function(){return this._media_element.volume},set:function(c){this._media_element.volume=c},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"muted",{get:function(){return this._media_element.muted},set:function(c){this._media_element.muted=c},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"currentTime",{get:function(){return this._media_element?this._media_element.currentTime:0},set:function(c){this._player_engine.seek(c)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"mediaInfo",{get:function(){return this._player_engine.mediaInfo},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"statisticsInfo",{get:function(){return this._player_engine.statisticsInfo},enumerable:!1,configurable:!0}),b}(),Ee=function(){function b(c,C){this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new L.a,this._config=v(),typeof C=="object"&&Object.assign(this._config,C);var z=c.type.toLowerCase();if(z==="mse"||z==="mpegts"||z==="m2ts"||z==="flv")throw new X.b("NativePlayer does't support mse/mpegts/m2ts/flv MediaDataSource input!");if(c.hasOwnProperty("segments"))throw new X.b("NativePlayer(".concat(c.type,") doesn't support multipart playback!"));this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=c,this._mediaElement=null}return b.prototype.destroy=function(){this._emitter.emit(w.a.DESTROYING),this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},b.prototype.on=function(c,C){var z=this;c===w.a.MEDIA_INFO?this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(function(){z._emitter.emit(w.a.MEDIA_INFO,z.mediaInfo)}):c===w.a.STATISTICS_INFO&&this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(function(){z._emitter.emit(w.a.STATISTICS_INFO,z.statisticsInfo)}),this._emitter.addListener(c,C)},b.prototype.off=function(c,C){this._emitter.removeListener(c,C)},b.prototype.attachMediaElement=function(c){if(this._mediaElement=c,c.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._pendingSeekTime!=null)try{c.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch{}},b.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},b.prototype.load=function(){if(!this._mediaElement)throw new X.a("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},b.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},b.prototype.play=function(){return this._mediaElement.play()},b.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(b.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(c){this._mediaElement.volume=c},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(c){this._mediaElement.muted=c},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(c){this._mediaElement?this._mediaElement.currentTime=c:this._pendingSeekTime=c},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"mediaInfo",{get:function(){var c={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(c.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(c.width=this._mediaElement.videoWidth,c.height=this._mediaElement.videoHeight)),c},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"statisticsInfo",{get:function(){var c={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return c;var C=!0,z=0,ne=0;if(this._mediaElement.getVideoPlaybackQuality){var de=this._mediaElement.getVideoPlaybackQuality();z=de.totalVideoFrames,ne=de.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(z=this._mediaElement.webkitDecodedFrameCount,ne=this._mediaElement.webkitDroppedFrameCount):C=!1;return C&&(c.decodedFrames=z,c.droppedFrames=ne),c},enumerable:!1,configurable:!0}),b.prototype._onvLoadedMetadata=function(c){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(w.a.MEDIA_INFO,this.mediaInfo)},b.prototype._reportStatisticsInfo=function(){this._emitter.emit(w.a.STATISTICS_INFO,this.statisticsInfo)},b}();F.a.install();var _e={createPlayer:function(b,c){var C=b;if(C==null||typeof C!="object")throw new X.b("MediaDataSource must be an javascript object!");if(!C.hasOwnProperty("type"))throw new X.b("MediaDataSource must has type field to indicate video file type!");switch(C.type){case"mse":case"mpegts":case"m2ts":case"flv":return new se(C,c);default:return new Ee(C,c)}},isSupported:function(){return S.supportMSEH264Playback()},getFeatureList:function(){return S.getFeatureList()}};_e.BaseLoader=g.a,_e.LoaderStatus=g.c,_e.LoaderErrors=g.b,_e.Events=w.a,_e.ErrorTypes=P.b,_e.ErrorDetails=P.a,_e.MSEPlayer=se,_e.NativePlayer=Ee,_e.LoggingControl=G.a,Object.defineProperty(_e,"version",{enumerable:!0,get:function(){return"1.8.0"}}),te.default=_e}])})})(vt);var St=vt.exports;const Zt=Qt(St),ei=Jt({__proto__:null,default:Zt},[St]);export{ei as m};