import{g as Qt}from"./index-CEmnTf-r.js";function Jt(ze,Je){for(var me=0;mete[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;f0&&(_=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=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=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[B].dts&&gT[L].lastSample.originalDts&&g=T[L].lastSample.originalDts&&(L===T.length-1||L0&&(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[T]&&v=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("�"),++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);r32)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<>>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=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;ee0&&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=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;oe0)for(oe=u;oe<8;oe++)e.readBits(2);for(oe=0;oe1&&e.readSEG(),oe=0;oe0&&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>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<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);ei.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>>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>>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;R1&&p.a.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ".concat(pe)),y++,R=0;R=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){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=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.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=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=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=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>>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;R0){for(var Y=R+5;Y0)for(Y=R+5;Y1&&(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>>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>>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>>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>>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>>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=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=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;oe1&&(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=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;re0)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;t0&&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._receivedLength299)){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=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&&(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[V]&&_=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._receivedLength0&&this._receivedLength0)for(var J=d.split("&"),G=0;G0;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;_+10485760){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]=512&&l<=1024?Math.floor(1.5*l):2*l)>8192&&(_=8192);var d=1024*_+1048576;this._bufferSize0){var J=this._stashBuffer.slice(0,this._stashUsed);(se=this._dispatchChunks(J,this._stashByteStart))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,_))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,_))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))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(d0?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=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=this._config.autoCleanupMaxBackwardDuration){N=!0;var q=L-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[B].push({start:X,end:q})}}else k0&&(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;k0},!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"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;j1)for(var k=1;k0){var ne=this._media_element.buffered.start(0);(ne<1&&c0){var ne=z.start(0);if(ne<1&&C=ne&&c0&&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=Te&&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.currentTimethis._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};