@mux/playback-core 0.16.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +3 -3
- package/dist/playback-core.js +1 -1
- package/dist/playback-core.js.map +3 -3
- package/dist/playback-core.mjs +1 -1
- package/dist/playback-core.mjs.map +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types-ts3.4/index.d.ts +2 -1
- package/dist/types-ts3.4/types.d.ts +1 -0
- package/package.json +2 -2
package/dist/playback-core.mjs
CHANGED
|
@@ -29,7 +29,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
29
29
|
`),ae=[],me=(0,tr.toMpegTsClockFromTimescale)(l,u),de="00:00.000",_e=0,Ke=0,ze=!0;I.oncue=function(Ee){var Ge=c[v],Fe=c.ccOffset,ct=(_e-me)/9e4;Ge!=null&&Ge.new&&(Ke!==void 0?Fe=c.ccOffset=Ge.start:function(At,$t,Xt){var Gt=At[$t],Zt=At[Gt.prevCC];if(!Zt||!Zt.new&&Gt.new)return At.ccOffset=At.presentationOffset=Gt.start,void(Gt.new=!1);for(;(yr=Zt)!==null&&yr!==void 0&&yr.new;){var yr;At.ccOffset+=Gt.start-Zt.start,Gt.new=!1,Zt=At[(Gt=Zt).prevCC]}At.presentationOffset=Xt}(c,v,ct)),ct&&(Fe=ct-c.presentationOffset);var Ct=Ee.endTime-Ee.startTime,ft=(0,vr.normalizePts)(9e4*(Ee.startTime+Fe-Ke),9e4*m)/9e4;Ee.startTime=Math.max(ft,0),Ee.endTime=Math.max(ft+Ct,0);var Tt=Ee.text.trim();Ee.text=decodeURIComponent(encodeURIComponent(Tt)),Ee.id||(Ee.id=sr(Ee.startTime,Ee.endTime,Tt)),Ee.endTime>0&&ae.push(Ee)},I.onparsingerror=function(Ee){x=Ee},I.onflush=function(){x?S(x):_(ae)},j.forEach(function(Ee){if(ze){if(pr(Ee,"X-TIMESTAMP-MAP=")){ze=!1,Ee.slice(16).split(",").forEach(function(Ge){pr(Ge,"LOCAL:")?de=Ge.slice(6):pr(Ge,"MPEGTS:")&&(_e=parseInt(Ge.slice(7)))});try{Ke=function(Ge){var Fe=parseInt(Ge.slice(-3)),ct=parseInt(Ge.slice(-6,-4)),Ct=parseInt(Ge.slice(-9,-7)),ft=Ge.length>9?parseInt(Ge.substring(0,Ge.indexOf(":"))):0;if(!((0,R.isFiniteNumber)(Fe)&&(0,R.isFiniteNumber)(ct)&&(0,R.isFiniteNumber)(Ct)&&(0,R.isFiniteNumber)(ft)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+Ge);return Fe+=1e3*ct,(Fe+=6e4*Ct)+36e5*ft}(de)/1e3}catch(Ge){x=Ge}return}Ee===""&&(ze=!1)}I.parse(Ee+`
|
|
30
30
|
`)}),I.flush()})((n=e.initSegment)!==null&&n!==void 0&&n.data?(0,W.appendUint8Array)(e.initSegment.data,new Uint8Array(t)):t,this.initPTS[e.cc],this.timescale[e.cc],i,e.cc,e.start,function(s){a._appendCues(s,e.level),r.trigger(p.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},function(s){a._fallbackToIMSC1(e,t),k.logger.log("Failed to parse VTT cue: "+s),r.trigger(p.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})},o._fallbackToIMSC1=function(e,t){var i=this,n=this.tracks[e.level];n.textCodec||Mn(t,this.initPTS[e.cc],this.timescale[e.cc],function(){n.textCodec=gr,i._parseIMSC1(e,t)},function(){n.textCodec="wvtt"})},o._appendCues=function(e,t){var i=this.hls;if(this.config.renderTextTracksNatively){var n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(function(s){return yt(n,s)})}else{var a=this.tracks[t];if(!a)return;var r=a.default?"default":"subtitles"+t;i.trigger(p.Events.CUES_PARSED,{type:"subtitles",cues:e,track:r})}},o.onFragDecrypted=function(e,t){var i=t.frag;if(i.type===pe.PlaylistLevelType.SUBTITLE){if(!(0,R.isFiniteNumber)(this.initPTS[i.cc]))return void this.unparsedVttFrags.push(t);this.onFragLoaded(p.Events.FRAG_LOADED,t)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(e,t){var i=this.cea608Parser1,n=this.cea608Parser2;if(this.enabled&&i&&n){var a=t.frag,r=t.samples;if(a.type!==pe.PlaylistLevelType.MAIN||this.closedCaptionsForLevel(a)!=="NONE")for(var s=0;s<r.length;s++){var l=r[s].bytes;if(l){var u=this.extractCea608Data(l);i.addData(r[s].pts,u[0]),n.addData(r[s].pts,u[1])}}}},o.onBufferFlushing=function(e,t){var i=t.startOffset,n=t.endOffset,a=t.endOffsetSubtitles,r=t.type,s=this.media;if(s&&!(s.currentTime<n)){if(!r||r==="video"){var l=this.captionsTracks;Object.keys(l).forEach(function(c){return It(l[c],i,n)})}if(this.config.renderTextTracksNatively&&i===0&&a!==void 0){var u=this.textTracks;Object.keys(u).forEach(function(c){return It(u[c],i,a)})}}},o.extractCea608Data=function(e){for(var t=[[],[]],i=31&e[0],n=2,a=0;a<i;a++){var r=e[n++],s=127&e[n++],l=127&e[n++];if((s!==0||l!==0)&&(4&r)!=0){var u=3&r;u!==0&&u!==1||(t[u].push(s),t[u].push(l))}}return t},d}();function wa(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function Aa(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}let Da=function(){function d(i){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=i,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var o,e,t=d.prototype;return t.setStreamController=function(i){this.streamController=i},t.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},t.registerListeners=function(){var i=this.hls;i.on(p.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),i.on(p.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(p.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(p.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.on(p.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},t.unregisterListener=function(){var i=this.hls;i.off(p.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),i.off(p.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(p.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(p.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.off(p.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},t.onFpsDropLevelCapping=function(i,n){d.isLevelAllowed(n.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(n.droppedLevel)},t.onMediaAttaching=function(i,n){this.media=n.media instanceof HTMLVideoElement?n.media:null,this.clientRect=null},t.onManifestParsed=function(i,n){var a=this.hls;this.restrictedLevels=[],this.firstLevel=n.firstLevel,a.config.capLevelToPlayerSize&&n.video&&this.startCapping()},t.onBufferCodecs=function(i,n){this.hls.config.capLevelToPlayerSize&&n.video&&this.startCapping()},t.onMediaDetaching=function(){this.stopCapping()},t.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var i=this.hls.levels;if(i.length){var n=this.hls;n.autoLevelCapping=this.getMaxLevel(i.length-1),n.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=n.autoLevelCapping}}},t.getMaxLevel=function(i){var n=this,a=this.hls.levels;if(!a.length)return-1;var r=a.filter(function(s,l){return d.isLevelAllowed(l,n.restrictedLevels)&&l<=i});return this.clientRect=null,d.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)},t.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},t.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},t.getDimensions=function(){if(this.clientRect)return this.clientRect;var i=this.media,n={width:0,height:0};if(i){var a=i.getBoundingClientRect();n.width=a.width,n.height=a.height,n.width||n.height||(n.width=a.right-a.left||i.width||0,n.height=a.bottom-a.top||i.height||0)}return this.clientRect=n,n},d.isLevelAllowed=function(i,n){return n===void 0&&(n=[]),n.indexOf(i)===-1},d.getMaxLevelByMediaSize=function(i,n,a){if(!i||!i.length)return-1;for(var r,s,l=i.length-1,u=0;u<i.length;u+=1){var c=i[u];if((c.width>=n||c.height>=a)&&(r=c,!(s=i[u+1])||r.width!==s.width||r.height!==s.height)){l=u;break}}return l},o=d,(e=[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var i=1;if(!this.hls.config.ignoreDevicePixelRatio)try{i=self.devicePixelRatio}catch{}return i}}])&&Aa(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),d}(),Ra=function(){function d(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var o=d.prototype;return o.setStreamController=function(e){this.streamController=e},o.registerListeners=function(){this.hls.on(p.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},o.unregisterListeners=function(){this.hls.off(p.Events.MEDIA_ATTACHING,this.onMediaAttaching)},o.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},o.onMediaAttaching=function(e,t){var i=this.hls.config;if(i.capLevelOnFPSDrop){var n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}},o.checkFPS=function(e,t,i){var n=performance.now();if(t){if(this.lastTime){var a=n-this.lastTime,r=i-this.lastDroppedFrames,s=t-this.lastDecodedFrames,l=1e3*r/a,u=this.hls;if(u.trigger(p.Events.FPS_DROP,{currentDropped:r,currentDecoded:s,totalDroppedFrames:i}),l>0&&r>u.config.fpsDroppedMonitoringThreshold*s){var c=u.currentLevel;k.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=c)&&(c-=1,u.trigger(p.Events.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:u.currentLevel}),u.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=t}},o.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},d}();var $r=N(300);function gn(d){var o=typeof Map=="function"?new Map:void 0;return gn=function(e){if(e===null||(t=e,Function.toString.call(t).indexOf("[native code]")===-1))return e;var t;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(o!==void 0){if(o.has(e))return o.get(e);o.set(e,i)}function i(){return mn(e,arguments,yn(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ki(i,e)},gn(d)}function mn(d,o,e){return mn=Ia()?Reflect.construct.bind():function(t,i,n){var a=[null];a.push.apply(a,i);var r=new(Function.bind.apply(t,a));return n&&ki(r,n.prototype),r},mn.apply(null,arguments)}function Ia(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ki(d,o){return ki=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ki(d,o)}function yn(d){return yn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},yn(d)}var qi="[eme]",Bn=function(){function d(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=d.CDMCleanupPromise?[d.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=k.logger.debug.bind(k.logger,qi),this.log=k.logger.log.bind(k.logger,qi),this.warn=k.logger.warn.bind(k.logger,qi),this.error=k.logger.error.bind(k.logger,qi),this.hls=e,this.config=e.config,this.registerListeners()}var o=d.prototype;return o.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null},o.registerListeners=function(){this.hls.on(p.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(p.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},o.unregisterListeners=function(){this.hls.off(p.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(p.Events.MANIFEST_LOADED,this.onManifestLoaded,this)},o.getLicenseServerUrl=function(e){var t=this.config,i=t.drmSystems,n=t.widevineLicenseUrl,a=i[e];if(a)return a.licenseUrl;if(e===U.WIDEVINE&&n)return n;throw new Error('no license server URL configured for key-system "'+e+'"')},o.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},o.attemptKeySystemAccess=function(e){var t=this,i=this.hls.levels,n=function(s,l,u){return!!s&&u.indexOf(s)===l},a=i.map(function(s){return s.audioCodec}).filter(n),r=i.map(function(s){return s.videoCodec}).filter(n);return a.length+r.length===0&&r.push("avc1.42e01e"),new Promise(function(s,l){(function u(c){var v=c.shift();t.getMediaKeysPromise(v,a,r).then(function(m){return s({keySystem:v,mediaKeys:m})}).catch(function(m){c.length?u(c):l(m instanceof kr?m:new kr({type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_ACCESS,error:m,fatal:!0},m.message))})})(e)})},o.requestMediaKeySystemAccess=function(e,t){var i=this.config.requestMediaKeySystemAccessFunc;if(typeof i!="function"){var n="Configured requestMediaKeySystemAccess is not a function "+i;return ye===null&&self.location.protocol==="http:"&&(n="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(n))}return i(e,t)},o.getMediaKeysPromise=function(e,t,i){var n=this,a=function(u,c,v,m){var _;switch(u){case U.FAIRPLAY:_=["cenc","sinf"];break;case U.WIDEVINE:case U.PLAYREADY:_=["cenc"];break;case U.CLEARKEY:_=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+u)}return function(S,x,I,j){return[{initDataTypes:S,persistentState:j.persistentState||"not-allowed",distinctiveIdentifier:j.distinctiveIdentifier||"not-allowed",sessionTypes:j.sessionTypes||[j.sessionType||"temporary"],audioCapabilities:x.map(function(ae){return{contentType:'audio/mp4; codecs="'+ae+'"',robustness:j.audioRobustness||"",encryptionScheme:j.audioEncryptionScheme||null}}),videoCapabilities:I.map(function(ae){return{contentType:'video/mp4; codecs="'+ae+'"',robustness:j.videoRobustness||"",encryptionScheme:j.videoEncryptionScheme||null}})}]}(_,c,v,m)}(e,t,i,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e],s=r==null?void 0:r.keySystemAccess;if(!s){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(a)),s=this.requestMediaKeySystemAccess(e,a);var l=this.keySystemAccessPromises[e]={keySystemAccess:s};return s.catch(function(u){n.log('Failed to obtain access to key-system "'+e+'": '+u)}),s.then(function(u){n.log('Access for key-system "'+u.keySystem+'" obtained');var c=n.fetchServerCertificate(e);return n.log('Create media-keys for "'+e+'"'),l.mediaKeys=u.createMediaKeys().then(function(v){return n.log('Media-keys created for "'+e+'"'),c.then(function(m){return m?n.setMediaKeysServerCertificate(v,e,m):v})}),l.mediaKeys.catch(function(v){n.error('Failed to create media-keys for "'+e+'"}: '+v)}),l.mediaKeys})}return s.then(function(){return r.mediaKeys})},o.createMediaKeySessionContext=function(e){var t=e.decryptdata,i=e.keySystem,n=e.mediaKeys;this.log('Creating key-system session "'+i+'" keyId: '+$r.default.hexDump(t.keyId||[]));var a=n.createSession(),r={decryptdata:t,keySystem:i,mediaKeys:n,mediaKeysSession:a,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r},o.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var i=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t);this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,"cenc",t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},o.getKeyIdString=function(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return $r.default.hexDump(e.keyId)},o.updateKeySession=function(e,t){var i,n=e.mediaKeysSession;return this.log('Updating key-session "'+n.sessionId+'" for keyID '+$r.default.hexDump(((i=e.decryptdata)===null||i===void 0?void 0:i.keyId)||[])+`
|
|
31
31
|
} (data length: `+(t&&t.byteLength)+")"),n.update(t)},o.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},o.getKeyFormatPromise=function(e){var t=this;return new Promise(function(i,n){var a=oe(t.config),r=e.map(M).filter(function(s){return!!s&&a.indexOf(s)!==-1});return t.getKeySystemSelectionPromise(r).then(function(s){var l=s.keySystem,u=L(l);u?i(u):n(new Error('Unable to find format for key-system "'+l+'"'))}).catch(n)})},o.loadKey=function(e){var t=this,i=e.keyInfo.decryptdata,n=this.getKeyIdString(i),a="(keyId: "+n+' format: "'+i.keyFormat+'" method: '+i.method+" uri: "+i.uri+")";this.log("Starting session for key "+a);var r=this.keyIdToKeySessionPromise[n];return r||(r=this.keyIdToKeySessionPromise[n]=this.getKeySystemForKeyPromise(i).then(function(s){var l=s.keySystem,u=s.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+a),t.attemptSetMediaKeys(l,u).then(function(){t.throwIfDestroyed();var c=t.createMediaKeySessionContext({keySystem:l,mediaKeys:u,decryptdata:i});return t.generateRequestWithPreferredKeySession(c,"cenc",i.pssh,"playlist-key")})})).catch(function(s){return t.handleError(s)}),r},o.throwIfDestroyed=function(e){if(e===void 0&&(e="Invalid state"),!this.hls)throw new Error("invalid state")},o.handleError=function(e){this.hls&&(this.error(e.message),e instanceof kr?this.hls.trigger(p.Events.ERROR,e.data):this.hls.trigger(p.Events.ERROR,{type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},o.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){var n=M(e.keyFormat),a=n?[n]:oe(this.config);return this.attemptKeySystemAccess(a)}return i},o.getKeySystemSelectionPromise=function(e){if(e.length||(e=oe(this.config)),e.length===0)throw new kr({type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},o._onMediaEncrypted=function(e){var t=this,i=e.initDataType,n=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+i+'"'),n!==null){var a,r;if(i==="sinf"&&this.config.drmSystems[U.FAIRPLAY]){var s=(0,W.bin2str)(new Uint8Array(n));try{var l=K(JSON.parse(s).sinf),u=(0,W.parseSinf)(new Uint8Array(l));if(!u)return;a=u.subarray(8,24),r=U.FAIRPLAY}catch{return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var c=(0,W.parsePssh)(n);if(c===null)return;c.version===0&&c.systemId===ke.WIDEVINE&&c.data&&(a=c.data.subarray(8,24)),r=function(ae){if(ae===ke.WIDEVINE)return U.WIDEVINE}(c.systemId)}if(r&&a){for(var v=$r.default.hexDump(a),m=this.keyIdToKeySessionPromise,_=this.mediaKeySessions,S=m[v],x=function(ae){var me=_[ae],de=me.decryptdata;if(de.pssh||!de.keyId)return"continue";var _e=$r.default.hexDump(de.keyId);return v===_e||de.uri.replace(/-/g,"").indexOf(v)!==-1?(S=m[_e],delete m[_e],de.pssh=new Uint8Array(n),de.keyId=a,S=m[v]=S.then(function(){return t.generateRequestWithPreferredKeySession(me,i,n,"encrypted-event-key-match")}),"break"):void 0},I=0;I<_.length;I++){var j=x(I);if(j!=="continue"&&j==="break")break}S||(S=m[v]=this.getKeySystemSelectionPromise([r]).then(function(ae){var me,de=ae.keySystem,_e=ae.mediaKeys;t.throwIfDestroyed();var Ke=new we("ISO-23001-7",v,(me=L(de))!=null?me:"");return Ke.pssh=new Uint8Array(n),Ke.keyId=a,t.attemptSetMediaKeys(de,_e).then(function(){t.throwIfDestroyed();var ze=t.createMediaKeySessionContext({decryptdata:Ke,keySystem:de,mediaKeys:_e});return t.generateRequestWithPreferredKeySession(ze,i,n,"encrypted-event-no-match")})})),S.catch(function(ae){return t.handleError(ae)})}}},o._onWaitingForKey=function(e){this.log('"'+e.type+'" event')},o.attemptSetMediaKeys=function(e,t){var i=this,n=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+e+'"');var a=Promise.all(n).then(function(){if(!i.media)throw new Error("Attempted to set mediaKeys without media element attached");return i.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(a),a.then(function(){i.log('Media-keys set for "'+e+'"'),n.push(a),i.setMediaKeysQueue=i.setMediaKeysQueue.filter(function(r){return n.indexOf(r)===-1})})},o.generateRequestWithPreferredKeySession=function(e,t,i,n){var a,r,s=this,l=(a=this.config.drmSystems)===null||a===void 0||(r=a[e.keySystem])===null||r===void 0?void 0:r.generateRequest;if(l)try{var u=l.call(this.hls,t,i,e);if(!u)throw new Error("Invalid response from configured generateRequest filter");t=u.initDataType,i=e.decryptdata.pssh=u.initData?new Uint8Array(u.initData):null}catch(S){var c;if(this.warn(S.message),(c=this.hls)!==null&&c!==void 0&&c.config.debug)throw S}if(i===null)return this.log('Skipping key-session request for "'+n+'" (no initData)'),Promise.resolve(e);var v=this.getKeyIdString(e.decryptdata);this.log('Generating key-session request for "'+n+'": '+v+" (init data type: "+t+" length: "+(i?i.byteLength:null)+")");var m=new(Xr());e.mediaKeysSession.onmessage=function(S){var x=e.mediaKeysSession;if(x){var I=S.messageType,j=S.message;s.log('"'+I+'" message event for session "'+x.sessionId+'" message size: '+j.byteLength),I==="license-request"||I==="license-renewal"?s.renewLicense(e,j).catch(function(ae){s.handleError(ae),m.emit("error",ae)}):I==="license-release"?e.keySystem===U.FAIRPLAY&&(s.updateKeySession(e,E("acknowledged")),s.removeSession(e)):s.warn('unhandled media key message type "'+I+'"')}else m.emit("error",new Error("invalid state"))},e.mediaKeysSession.onkeystatuseschange=function(S){if(e.mediaKeysSession){s.onKeyStatusChange(e);var x=e.keyStatus;m.emit("keyStatus",x),x==="expired"&&(s.warn(e.keySystem+" expired for key "+v),s.renewKeySession(e))}else m.emit("error",new Error("invalid state"))};var _=new Promise(function(S,x){m.on("error",x),m.on("keyStatus",function(I){I.startsWith("usable")?S():I==="output-restricted"?x(new kr({type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):I==="internal-error"?x(new kr({type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+I+'"')):I==="expired"?x(new Error("key expired while generating request")):s.warn('unhandled key status change "'+I+'"')})});return e.mediaKeysSession.generateRequest(t,i).then(function(){var S;s.log('Request generated for key-session "'+((S=e.mediaKeysSession)===null||S===void 0?void 0:S.sessionId)+'" keyId: '+v)}).catch(function(S){throw new kr({type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_NO_SESSION,error:S,fatal:!1},"Error generating key-session request: "+S)}).then(function(){return _}).catch(function(S){throw m.removeAllListeners(),s.removeSession(e),S}).then(function(){return m.removeAllListeners(),e})},o.onKeyStatusChange=function(e){var t=this;e.mediaKeysSession.keyStatuses.forEach(function(i,n){t.log('key status change "'+i+'" for keyStatuses keyId: '+$r.default.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))+" session keyId: "+$r.default.hexDump(new Uint8Array(e.decryptdata.keyId||[]))+" uri: "+e.decryptdata.uri),e.keyStatus=i})},o.fetchServerCertificate=function(e){var t=this;return new Promise(function(i,n){var a=t.getServerCertificateUrl(e);if(!a)return i();t.log('Fetching serverCertificate for "'+e+'"');var r=new XMLHttpRequest;r.open("GET",a,!0),r.responseType="arraybuffer",r.onreadystatechange=function(){r.readyState===XMLHttpRequest.DONE&&(r.status===200?i(r.response):n(new kr({type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r},'"'+e+'" certificate request XHR failed ('+a+"). Status: "+r.status+" ("+r.statusText+")")))},r.send()})},o.setMediaKeysServerCertificate=function(e,t,i){var n=this;return new Promise(function(a,r){e.setServerCertificate(i).then(function(s){n.log("setServerCertificate "+(s?"success":"not supported by CDM")+" ("+(i==null?void 0:i.byteLength)+') on "'+t+'"'),a(e)}).catch(function(s){r(new kr({type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:s,fatal:!0},s.message))})})},o.renewLicense=function(e,t){var i=this;return this.requestLicense(e,new Uint8Array(t)).then(function(n){return i.updateKeySession(e,new Uint8Array(n)).catch(function(a){throw new kr({type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:a,fatal:!0},a.message)})})},o.setupLicenseXHR=function(e,t,i,n){var a=this,r=this.config.licenseXhrSetup;return r?Promise.resolve().then(function(){if(!i.decryptdata)throw new Error("Key removed");return r.call(a.hls,e,t,i,n)}).catch(function(s){if(!i.decryptdata)throw s;return e.open("POST",t,!0),r.call(a.hls,e,t,i,n)}).then(function(s){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:s||n}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))},o.requestLicense=function(e,t){var i=this;return new Promise(function(n,a){var r=i.getLicenseServerUrl(e.keySystem);i.log("Sending license request to URL: "+r);var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=function(){if(!i.hls||!e.mediaKeysSession)return a(new Error("invalid state"));if(s.readyState===4)if(s.status===200){i._requestLicenseFailureCount=0;var l=s.response;i.log("License received "+(l instanceof ArrayBuffer?l.byteLength:l));var u=i.config.licenseResponseCallback;if(u)try{l=u.call(i.hls,s,r,e)}catch(v){i.error(v)}n(l)}else if(i._requestLicenseFailureCount++,i._requestLicenseFailureCount>3||s.status>=400&&s.status<500)a(new kr({type:w.ErrorTypes.KEY_SYSTEM_ERROR,details:w.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:s},"License Request XHR failed ("+r+"). Status: "+s.status+" ("+s.statusText+")"));else{var c=3-i._requestLicenseFailureCount+1;i.warn("Retrying license request, "+c+" attempts left"),i.requestLicense(e,t).then(n,a)}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=s,i.setupLicenseXHR(s,r,e,t).then(function(l){var u=l.xhr,c=l.licenseChallenge;u.send(c)})})},o.onMediaAttached=function(e,t){if(this.config.emeEnabled){var i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}},o.onMediaDetached=function(){var e=this,t=this.media,i=this.mediaKeySessions;t&&(t.removeEventListener("encrypted",this.onMediaEncrypted),t.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},we.clearKeyUriToKeyIdMap();var n=i.length;d.CDMCleanupPromise=Promise.all(i.map(function(a){return e.removeSession(a)}).concat(t==null?void 0:t.setMediaKeys(null).catch(function(a){e.log("Could not clear media keys: "+a+". media.src: "+(t==null?void 0:t.src))}))).then(function(){n&&(e.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(function(a){e.log("Could not close sessions and clear media keys: "+a+". media.src: "+(t==null?void 0:t.src))})},o.onManifestLoaded=function(e,t){var i=t.sessionKeys;if(i&&this.config.emeEnabled&&!this.keyFormatPromise){var n=i.reduce(function(a,r){return a.indexOf(r.keyFormat)===-1&&a.push(r.keyFormat),a},[]);this.log("Selecting key-system from session-keys "+n.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(n)}},o.removeSession=function(e){var t=this,i=e.mediaKeysSession,n=e.licenseXhr;if(i){this.log("Remove licenses and keys and close session "+i.sessionId),i.onmessage=null,i.onkeystatuseschange=null,n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var a=this.mediaKeySessions.indexOf(e);return a>-1&&this.mediaKeySessions.splice(a,1),i.remove().catch(function(r){t.log("Could not remove session: "+r)}).then(function(){return i.close()}).catch(function(r){t.log("Could not close session: "+r)})}},d}();Bn.CDMCleanupPromise=void 0;var kr=function(d){var o,e;function t(i,n){var a;return(a=d.call(this,n)||this).data=void 0,a.data=i,i.err=i.error,a}return e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,ki(o,e),t}(gn(Error));let Pa=Bn;var or,En,Hn;function Gn(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}function jn(d,o,e){return o&&Gn(d.prototype,o),e&&Gn(d,e),Object.defineProperty(d,"prototype",{writable:!1}),d}function Kn(d,o){var e=typeof Symbol!="undefined"&&d[Symbol.iterator]||d["@@iterator"];if(e)return(e=e.call(d)).next.bind(e);if(Array.isArray(d)||(e=function(i,n){if(i){if(typeof i=="string")return qn(i,n);var a=Object.prototype.toString.call(i).slice(8,-1);return a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set"?Array.from(i):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?qn(i,n):void 0}}(d))||o&&d&&typeof d.length=="number"){e&&(d=e);var t=0;return function(){return t>=d.length?{done:!0}:{done:!1,value:d[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
32
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qn(d,o){(o==null||o>d.length)&&(o=d.length);for(var e=0,t=new Array(o);e<o;e++)t[e]=d[e];return t}function Vi(){return Vi=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},Vi.apply(this,arguments)}(function(d){d.MANIFEST="m",d.AUDIO="a",d.VIDEO="v",d.MUXED="av",d.INIT="i",d.CAPTION="c",d.TIMED_TEXT="tt",d.KEY="k",d.OTHER="o"})(or||(or={})),function(d){d.DASH="d",d.HLS="h",d.SMOOTH="s",d.OTHER="o"}(En||(En={})),function(d){d.VOD="v",d.LIVE="l"}(Hn||(Hn={}));var Ca=function(){function d(e){var t=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(a){try{t.apply(a,{ot:or.MANIFEST,su:!t.initialized})}catch(r){k.logger.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=function(a){try{var r=a.frag,s=t.hls.levels[r.level],l=t.getObjectType(r),u={d:1e3*r.duration,ot:l};l!==or.VIDEO&&l!==or.AUDIO&&l!=or.MUXED||(u.br=s.bitrate/1e3,u.tb=t.getTopBandwidth(l)/1e3,u.bl=t.getBufferLength(l)),t.apply(a,u)}catch(c){k.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=e;var i=this.config=e.config,n=i.cmcd;n!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||d.uuid(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.registerListeners())}var o=d.prototype;return o.registerListeners=function(){var e=this.hls;e.on(p.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(p.Events.BUFFER_CREATED,this.onBufferCreated,this)},o.unregisterListeners=function(){var e=this.hls;e.off(p.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(p.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},o.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},o.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},o.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},o.onBufferCreated=function(e,t){var i,n;this.audioBuffer=(i=t.tracks.audio)===null||i===void 0?void 0:i.buffer,this.videoBuffer=(n=t.tracks.video)===null||n===void 0?void 0:n.buffer},o.createData=function(){var e;return{v:1,sf:En.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)===null||e===void 0?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},o.apply=function(e,t){t===void 0&&(t={}),Vi(t,this.createData());var i=t.ot===or.INIT||t.ot===or.VIDEO||t.ot===or.MUXED;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var n=d.toHeaders(t);if(!Object.keys(n).length)return;e.headers||(e.headers={}),Vi(e.headers,n)}else{var a=d.toQuery(t);if(!a)return;e.url=d.appendQueryToUri(e.url,a)}},o.getObjectType=function(e){var t=e.type;return t==="subtitle"?or.TIMED_TEXT:e.sn==="initSegment"?or.INIT:t==="audio"?or.AUDIO:t==="main"?this.hls.audioTracks.length?or.VIDEO:or.MUXED:void 0},o.getTopBandwidth=function(e){var t,i=0,n=this.hls;if(e===or.AUDIO)t=n.audioTracks;else{var a=n.maxAutoLevel,r=a>-1?a+1:n.levels.length;t=n.levels.slice(0,r)}for(var s,l=Kn(t);!(s=l()).done;){var u=s.value;u.bitrate>i&&(i=u.bitrate)}return i>0?i:NaN},o.getBufferLength=function(e){var t=this.hls.media,i=e===or.AUDIO?this.audioBuffer:this.videoBuffer;return i&&t?1e3*Mt.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN},o.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function n(r){this.loader=void 0,this.loader=new i(r)}var a=n.prototype;return a.destroy=function(){this.loader.destroy()},a.abort=function(){this.loader.abort()},a.load=function(r,s,l){t(r),this.loader.load(r,s,l)},jn(n,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),n}()},o.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function n(r){this.loader=void 0,this.loader=new i(r)}var a=n.prototype;return a.destroy=function(){this.loader.destroy()},a.abort=function(){this.loader.abort()},a.load=function(r,s,l){t(r),this.loader.load(r,s,l)},jn(n,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),n}()},d.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)},d.serialize=function(e){for(var t,i=[],n=function(S){return!Number.isNaN(S)&&S!=null&&S!==""&&S!==!1},a=function(S){return Math.round(S)},r=function(S){return 100*a(S/100)},s={br:a,d:a,bl:r,dl:r,mtp:r,nor:function(S){return encodeURIComponent(S)},rtp:r,tb:a},l=Kn(Object.keys(e||{}).sort());!(t=l()).done;){var u=t.value,c=e[u];if(n(c)&&!(u==="v"&&c===1||u=="pr"&&c===1)){var v=s[u];v&&(c=v(c));var m,_=typeof c;m=u==="ot"||u==="sf"||u==="st"?u+"="+c:_==="boolean"?u:_==="number"?u+"="+c:u+"="+JSON.stringify(c),i.push(m)}}return i.join(",")},d.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],n=[{},{},{},{}],a={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},r=0,s=Object.keys(e);r<s.length;r++){var l=s[r];n[a[l]!=null?a[l]:1][l]=e[l]}for(var u=0;u<n.length;u++){var c=d.serialize(n[u]);c&&(t["CMCD-"+i[u]]=c)}return t},d.toQuery=function(e){return"CMCD="+encodeURIComponent(d.serialize(e))},d.appendQueryToUri=function(e,t){if(!t)return e;var i=e.includes("?")?"&":"?";return""+e+i+t},d}(),Vn=N(408),xa=/^age:\s*[\d.]+\s*$/m;let Yn=function(){function d(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e?e.xhrSetup:null,this.stats=new Vn.LoadStats,this.retryDelay=0}var o=d.prototype;return o.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},o.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))},o.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},o.load=function(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.retryDelay=t.retryDelay,this.loadInternal()},o.loadInternal=function(){var e=this.config,t=this.context;if(e){var i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0;var a=this.xhrSetup;try{if(a)try{a(i,t.url)}catch{i.open("GET",t.url,!0),a(i,t.url)}i.readyState||i.open("GET",t.url,!0);var r=this.context.headers;if(r)for(var s in r)i.setRequestHeader(s,r[s])}catch(l){return void this.callbacks.onError({code:i.status,text:l.message},t,i)}t.rangeEnd&&i.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),i.onreadystatechange=this.readystatechange.bind(this),i.onprogress=this.loadprogress.bind(this),i.responseType=t.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),i.send()}},o.readystatechange=function(){var e=this.context,t=this.loader,i=this.stats;if(e&&t){var n=t.readyState,a=this.config;if(!i.aborted&&n>=2)if(self.clearTimeout(this.requestTimeout),i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start)),n===4){t.onreadystatechange=null,t.onprogress=null;var r=t.status,s=t.responseType==="arraybuffer";if(r>=200&&r<300&&(s&&t.response||t.responseText!==null)){var l,u;if(i.loading.end=Math.max(self.performance.now(),i.loading.first),u=s?(l=t.response).byteLength:(l=t.responseText).length,i.loaded=i.total=u,!this.callbacks)return;var c=this.callbacks.onProgress;if(c&&c(i,e,l,t),!this.callbacks)return;var v={url:t.responseURL,data:l};this.callbacks.onSuccess(v,i,e,t)}else i.retry>=a.maxRetry||r>=400&&r<499?(k.logger.error(r+" while loading "+e.url),this.callbacks.onError({code:r,text:t.statusText},e,t)):(k.logger.warn(r+" while loading "+e.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),i.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout)}},o.loadtimeout=function(){k.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},o.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},o.getCacheAge=function(){var e=null;if(this.loader&&xa.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},d}();function Tn(d){var o=typeof Map=="function"?new Map:void 0;return Tn=function(e){if(e===null||(t=e,Function.toString.call(t).indexOf("[native code]")===-1))return e;var t;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(o!==void 0){if(o.has(e))return o.get(e);o.set(e,i)}function i(){return bn(e,arguments,_n(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Li(i,e)},Tn(d)}function bn(d,o,e){return bn=Oa()?Reflect.construct.bind():function(t,i,n){var a=[null];a.push.apply(a,i);var r=new(Function.bind.apply(t,a));return n&&Li(r,n.prototype),r},bn.apply(null,arguments)}function Oa(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Li(d,o){return Li=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Li(d,o)}function _n(d){return _n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},_n(d)}function Sn(){return Sn=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},Sn.apply(this,arguments)}var Ma=function(){function d(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Fa,this.controller=new self.AbortController,this.stats=new Vn.LoadStats}var o=d.prototype;return o.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},o.abortInternal=function(){var e=this.response;e&&e.ok||(this.stats.aborted=!0,this.controller.abort())},o.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},o.load=function(e,t,i){var n=this,a=this.stats;if(a.loading.start)throw new Error("Loader can only be used once.");a.loading.start=self.performance.now();var r=function(c,v){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:v,headers:new self.Headers(Sn({},c.headers))};return c.rangeEnd&&m.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),m}(e,this.controller.signal),s=i.onProgress,l=e.responseType==="arraybuffer",u=l?"byteLength":"length";this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){n.abortInternal(),i.onTimeout(a,e,n.response)},t.timeout),self.fetch(this.request).then(function(c){if(n.response=n.loader=c,!c.ok){var v=c.status,m=c.statusText;throw new Na(m||"fetch, bad network response",v,c)}return a.loading.first=Math.max(self.performance.now(),a.loading.start),a.total=parseInt(c.headers.get("Content-Length")||"0"),s&&(0,R.isFiniteNumber)(t.highWaterMark)?n.loadProgressively(c,a,e,t.highWaterMark,s):l?c.arrayBuffer():c.text()}).then(function(c){var v=n.response;self.clearTimeout(n.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first);var m=c[u];m&&(a.loaded=a.total=m);var _={url:v.url,data:c};s&&!(0,R.isFiniteNumber)(t.highWaterMark)&&s(a,e,c,v),i.onSuccess(_,a,e,v)}).catch(function(c){if(self.clearTimeout(n.requestTimeout),!a.aborted){var v=c&&c.code||0,m=c?c.message:null;i.onError({code:v,text:m},e,c?c.details:null)}})},o.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},o.loadProgressively=function(e,t,i,n,a){n===void 0&&(n=0);var r=new Hi,s=e.body.getReader();return function l(){return s.read().then(function(u){if(u.done)return r.dataLength&&a(t,i,r.flush(),e),Promise.resolve(new ArrayBuffer(0));var c=u.value,v=c.length;return t.loaded+=v,v<n||r.dataLength?(r.push(c),r.dataLength>=n&&a(t,i,r.flush(),e)):a(t,i,c,e),l()}).catch(function(){return Promise.reject()})}()},d}();function Fa(d,o){return new self.Request(d.url,o)}var Na=function(d){var o,e;function t(i,n,a){var r;return(r=d.call(this,i)||this).code=void 0,r.details=void 0,r.code=n,r.details=a,r}return e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Li(o,e),t}(Tn(Error));let Wn=Ma;var Ua=/\s/;function kn(){return kn=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},kn.apply(this,arguments)}function Xn(d,o){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(d);o&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(d,i).enumerable})),e.push.apply(e,t)}return e}function zn(d){for(var o=1;o<arguments.length;o++){var e=arguments[o]!=null?arguments[o]:{};o%2?Xn(Object(e),!0).forEach(function(t){Ba(d,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):Xn(Object(e)).forEach(function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))})}return d}function Ba(d,o,e){return(o=function(t){var i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t,"string");return typeof i=="symbol"?i:String(i)}(o))in d?Object.defineProperty(d,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[o]=e,d}var Ha=zn(zn({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Yn,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:an,bufferController:hn,capLevelController:Da,fpsController:Ra,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:ye,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0},{cueHandler:{newCue:function(d,o,e,t){for(var i,n,a,r,s,l=[],u=self.VTTCue||self.TextTrackCue,c=0;c<t.rows.length;c++)if(a=!0,r=0,s="",!(i=t.rows[c]).isEmpty()){for(var v=0;v<i.chars.length;v++)Ua.test(i.chars[v].uchar)&&a?r++:(s+=i.chars[v].uchar,a=!1);i.cueStartTime=o,o===e&&(e+=1e-4),r>=16?r--:r++;var m=Kt(s.trim()),_=sr(o,e,m);d&&d.cues&&d.cues.getCueById(_)||((n=new u(o,e,m)).id=_,n.line=c+1,n.align="left",n.position=10+Math.min(80,10*Math.floor(8*r/32)),l.push(n))}return d&&l.length&&(l.sort(function(S,x){return S.line==="auto"||x.line==="auto"?0:S.line>8&&x.line>8?x.line-S.line:S.line-x.line}),l.forEach(function(S){return yt(d,S)})),l}},enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:ln,subtitleTrackController:cn,timelineController:La,audioStreamController:Ti,audioTrackController:sn,emeController:Pa,cmcdController:Ca});function Qn(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}var Jn=function(){function d(n){n===void 0&&(n={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new gi.EventEmitter,this._autoLevelCapping=void 0,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var a=this.config=function(Ee,Ge){if((Ge.liveSyncDurationCount||Ge.liveMaxLatencyDurationCount)&&(Ge.liveSyncDuration||Ge.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(Ge.liveMaxLatencyDurationCount!==void 0&&(Ge.liveSyncDurationCount===void 0||Ge.liveMaxLatencyDurationCount<=Ge.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(Ge.liveMaxLatencyDuration!==void 0&&(Ge.liveSyncDuration===void 0||Ge.liveMaxLatencyDuration<=Ge.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return kn({},Ee,Ge)}(d.DefaultConfig,n);this.userConfig=n,(0,k.enableLogs)(a.debug,"Hls instance"),this._autoLevelCapping=-1,a.progressive&&function(Ee){var Ge=Ee.loader;Ge!==Wn&&Ge!==Yn?(k.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),Ee.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(Ee.loader=Wn,Ee.progressive=!0,Ee.enableSoftwareAES=!0,k.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}(a);var r=a.abrController,s=a.bufferController,l=a.capLevelController,u=a.fpsController,c=this.abrController=new r(this),v=this.bufferController=new s(this),m=this.capLevelController=new l(this),_=new u(this),S=new Ye(this),x=new Rt(this),I=this.levelController=new ot(this),j=new bt(this),ae=new hr(this.config),me=this.streamController=new tn(this,j,ae);m.setStreamController(me),_.setStreamController(me);var de=[S,I,me];this.networkControllers=de;var _e=[c,v,m,_,x,j];this.audioTrackController=this.createController(a.audioTrackController,de);var Ke=a.audioStreamController;Ke&&de.push(new Ke(this,j,ae)),this.subtitleTrackController=this.createController(a.subtitleTrackController,de);var ze=a.subtitleStreamController;ze&&de.push(new ze(this,j,ae)),this.createController(a.timelineController,_e),ae.emeController=this.emeController=this.createController(a.emeController,_e),this.cmcdController=this.createController(a.cmcdController,_e),this.latencyController=this.createController(jt,_e),this.coreComponents=_e}d.isSupported=function(){return function(){var n=ni();if(!n)return!1;var a=ai(),r=n&&typeof n.isTypeSupported=="function"&&n.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),s=!a||a.prototype&&typeof a.prototype.appendBuffer=="function"&&typeof a.prototype.remove=="function";return!!r&&!!s}()};var o,e,t,i=d.prototype;return i.createController=function(n,a){if(n){var r=new n(this);return a&&a.push(r),r}return null},i.on=function(n,a,r){r===void 0&&(r=this),this._emitter.on(n,a,r)},i.once=function(n,a,r){r===void 0&&(r=this),this._emitter.once(n,a,r)},i.removeAllListeners=function(n){this._emitter.removeAllListeners(n)},i.off=function(n,a,r,s){r===void 0&&(r=this),this._emitter.off(n,a,r,s)},i.listeners=function(n){return this._emitter.listeners(n)},i.emit=function(n,a,r){return this._emitter.emit(n,a,r)},i.trigger=function(n,a){if(this.config.debug)return this.emit(n,n,a);try{return this.emit(n,n,a)}catch(r){k.logger.error("An internal error happened while handling event "+n+'. Error message: "'+r.message+'". Here is a stacktrace:',r),this.trigger(p.Events.ERROR,{type:w.ErrorTypes.OTHER_ERROR,details:w.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:n,error:r})}return!1},i.listenerCount=function(n){return this._emitter.listenerCount(n)},i.destroy=function(){k.logger.log("destroy"),this.trigger(p.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(n){return n.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(n){return n.destroy()}),this.coreComponents.length=0},i.attachMedia=function(n){k.logger.log("attachMedia"),this._media=n,this.trigger(p.Events.MEDIA_ATTACHING,{media:n})},i.detachMedia=function(){k.logger.log("detachMedia"),this.trigger(p.Events.MEDIA_DETACHING,void 0),this._media=null},i.loadSource=function(n){this.stopLoad();var a=this.media,r=this.url,s=this.url=$.buildAbsoluteURL(self.location.href,n,{alwaysNormalize:!0});k.logger.log("loadSource:"+s),a&&r&&r!==s&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(a)),this.trigger(p.Events.MANIFEST_LOADING,{url:n})},i.startLoad=function(n){n===void 0&&(n=-1),k.logger.log("startLoad("+n+")"),this.networkControllers.forEach(function(a){a.startLoad(n)})},i.stopLoad=function(){k.logger.log("stopLoad"),this.networkControllers.forEach(function(n){n.stopLoad()})},i.swapAudioCodec=function(){k.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},i.recoverMediaError=function(){k.logger.log("recoverMediaError");var n=this._media;this.detachMedia(),n&&this.attachMedia(n)},i.removeLevel=function(n,a){a===void 0&&(a=0),this.levelController.removeLevel(n,a)},o=d,t=[{key:"version",get:function(){return"1.3.1"}},{key:"Events",get:function(){return p.Events}},{key:"ErrorTypes",get:function(){return w.ErrorTypes}},{key:"ErrorDetails",get:function(){return w.ErrorDetails}},{key:"DefaultConfig",get:function(){return d.defaultConfig?d.defaultConfig:Ha},set:function(n){d.defaultConfig=n}}],(e=[{key:"levels",get:function(){return this.levelController.levels||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(n){k.logger.log("set currentLevel:"+n),this.loadLevel=n,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(n){k.logger.log("set nextLevel:"+n),this.levelController.manualLevel=n,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(n){k.logger.log("set loadLevel:"+n),this.levelController.manualLevel=n}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(n){this.levelController.nextLoadLevel=n}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(n){k.logger.log("set firstLevel:"+n),this.levelController.firstLevel=n}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(n){k.logger.log("set startLevel:"+n),n!==-1&&(n=Math.max(n,this.minAutoLevel)),this.levelController.startLevel=n}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(n){var a=!!n;a!==this.config.capLevelToPlayerSize&&(a?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=a)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(n){this._autoLevelCapping!==n&&(k.logger.log("set autoLevelCapping:"+n),this._autoLevelCapping=n)}},{key:"bandwidthEstimate",get:function(){var n=this.abrController.bwEstimator;return n?n.getEstimate():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(n){dr.indexOf(n)>-1&&(this._maxHdcpLevel=n)}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var n=this.levels,a=this.config.minAutoBitrate;if(!n)return 0;for(var r=n.length,s=0;s<r;s++)if(n[s].maxBitrate>=a)return s;return 0}},{key:"maxAutoLevel",get:function(){var n,a=this.levels,r=this.autoLevelCapping,s=this.maxHdcpLevel;if(n=r===-1&&a&&a.length?a.length-1:r,s)for(var l=n;l--;){var u=a[l].attrs["HDCP-LEVEL"];if(u&&u<=s)return l}return n}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(n){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,n)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var n=this.audioTrackController;return n?n.audioTracks:[]}},{key:"audioTrack",get:function(){var n=this.audioTrackController;return n?n.audioTrack:-1},set:function(n){var a=this.audioTrackController;a&&(a.audioTrack=n)}},{key:"subtitleTracks",get:function(){var n=this.subtitleTrackController;return n?n.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var n=this.subtitleTrackController;return n?n.subtitleTrack:-1},set:function(n){var a=this.subtitleTrackController;a&&(a.subtitleTrack=n)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var n=this.subtitleTrackController;return!!n&&n.subtitleDisplay},set:function(n){var a=this.subtitleTrackController;a&&(a.subtitleDisplay=n)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(n){this.config.lowLatencyMode=n}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}])&&Qn(o.prototype,e),t&&Qn(o,t),Object.defineProperty(o,"prototype",{writable:!1}),d}();Jn.defaultConfig=void 0},923:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{BaseSegment:()=>le,ElementaryStreamTypes:()=>B,Fragment:()=>Te,Part:()=>H});var B,$=N(965),R=N(945),p=N(408);function w(ce,z){ce.prototype=Object.create(z.prototype),ce.prototype.constructor=ce,k(ce,z)}function k(ce,z){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(ne,U){return ne.__proto__=U,ne},k(ce,z)}function ve(ce,z){for(var ne=0;ne<z.length;ne++){var U=z[ne];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(ce,typeof(be=function(ke,He){if(typeof ke!="object"||ke===null)return ke;var K=ke[Symbol.toPrimitive];if(K!==void 0){var E=K.call(ke,He);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(ke)}(U.key,"string"))=="symbol"?be:String(be),U)}var be}function Z(ce,z,ne){return z&&ve(ce.prototype,z),ne&&ve(ce,ne),Object.defineProperty(ce,"prototype",{writable:!1}),ce}(function(ce){ce.AUDIO="audio",ce.VIDEO="video",ce.AUDIOVIDEO="audiovideo"})(B||(B={}));var le=function(){function ce(z){var ne;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((ne={})[B.AUDIO]=null,ne[B.VIDEO]=null,ne[B.AUDIOVIDEO]=null,ne),this.baseurl=z}return ce.prototype.setByteRange=function(z,ne){var U=z.split("@",2),be=[];U.length===1?be[0]=ne?ne.byteRangeEndOffset:0:be[0]=parseInt(U[1]),be[1]=parseInt(U[0])+be[0],this._byteRange=be},Z(ce,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=(0,R.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(z){this._url=z}}]),ce}(),Te=function(ce){function z(U,be){var ke;return(ke=ce.call(this,be)||this)._decryptdata=null,ke.rawProgramDateTime=null,ke.programDateTime=null,ke.tagList=[],ke.duration=0,ke.sn=0,ke.levelkeys=void 0,ke.type=void 0,ke.loader=null,ke.keyLoader=null,ke.level=-1,ke.cc=0,ke.startPTS=void 0,ke.endPTS=void 0,ke.appendedPTS=void 0,ke.startDTS=void 0,ke.endDTS=void 0,ke.start=0,ke.deltaPTS=void 0,ke.maxStartPTS=void 0,ke.minEndPTS=void 0,ke.stats=new p.LoadStats,ke.urlId=0,ke.data=void 0,ke.bitrateTest=!1,ke.title=null,ke.initSegment=null,ke.endList=void 0,ke.type=U,ke}w(z,ce);var ne=z.prototype;return ne.setKeyFormat=function(U){if(this.levelkeys){var be=this.levelkeys[U];be&&!this._decryptdata&&(this._decryptdata=be.getDecryptData(this.sn))}},ne.abortRequests=function(){var U,be;(U=this.loader)===null||U===void 0||U.abort(),(be=this.keyLoader)===null||be===void 0||be.abort()},ne.setElementaryStreamInfo=function(U,be,ke,He,K,E){E===void 0&&(E=!1);var M=this.elementaryStreams,L=M[U];L?(L.startPTS=Math.min(L.startPTS,be),L.endPTS=Math.max(L.endPTS,ke),L.startDTS=Math.min(L.startDTS,He),L.endDTS=Math.max(L.endDTS,K)):M[U]={startPTS:be,endPTS:ke,startDTS:He,endDTS:K,partial:E}},ne.clearElementaryStreamInfo=function(){var U=this.elementaryStreams;U[B.AUDIO]=null,U[B.VIDEO]=null,U[B.AUDIOVIDEO]=null},Z(z,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var U=this.levelkeys.identity;if(U)this._decryptdata=U.getDecryptData(this.sn);else{var be=Object.keys(this.levelkeys);if(be.length===1)return this._decryptdata=this.levelkeys[be[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!(0,$.isFiniteNumber)(this.programDateTime))return null;var U=(0,$.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*U}},{key:"encrypted",get:function(){var U;if((U=this._decryptdata)!==null&&U!==void 0&&U.encrypted)return!0;if(this.levelkeys){var be=Object.keys(this.levelkeys),ke=be.length;if(ke>1||ke===1&&this.levelkeys[be[0]].encrypted)return!0}return!1}}]),z}(le),H=function(ce){function z(ne,U,be,ke,He){var K;(K=ce.call(this,be)||this).fragOffset=0,K.duration=0,K.gap=!1,K.independent=!1,K.relurl=void 0,K.fragment=void 0,K.index=void 0,K.stats=new p.LoadStats,K.duration=ne.decimalFloatingPoint("DURATION"),K.gap=ne.bool("GAP"),K.independent=ne.bool("INDEPENDENT"),K.relurl=ne.enumeratedString("URI"),K.fragment=U,K.index=ke;var E=ne.enumeratedString("BYTERANGE");return E&&K.setByteRange(E,He),He&&(K.fragOffset=He.fragOffset+He.duration),K}return w(z,ce),Z(z,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var ne=this.elementaryStreams;return!!(ne.audio||ne.video||ne.audiovideo)}}]),z}(le)},408:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{LoadStats:()=>B});var B=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},965:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{MAX_SAFE_INTEGER:()=>$,isFiniteNumber:()=>B});var B=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},$=Number.MAX_SAFE_INTEGER||9007199254740991},524:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{default:()=>ne,flushTextTrackMetadataCueSamples:()=>be,flushTextTrackUserdataCueSamples:()=>ke,normalizePts:()=>U});var B=N(965);let $=function(){function E(){}return E.getSilentFrame=function(M,L){if(M==="mp4a.40.2"){if(L===1)return new Uint8Array([0,200,0,128,35,128]);if(L===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(L===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(L===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(L===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(L===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(L===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(L===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(L===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])}},E}();var R=Math.pow(2,32)-1,p=function(){function E(){}return E.init=function(){var M;for(M in E.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},E.types)E.types.hasOwnProperty(M)&&(E.types[M]=[M.charCodeAt(0),M.charCodeAt(1),M.charCodeAt(2),M.charCodeAt(3)]);var L=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),oe=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);E.HDLR_TYPES={video:L,audio:oe};var ye=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),W=new Uint8Array([0,0,0,0,0,0,0,0]);E.STTS=E.STSC=E.STCO=W,E.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),E.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),E.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),E.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var V=new Uint8Array([105,115,111,109]),we=new Uint8Array([97,118,99,49]),Re=new Uint8Array([0,0,0,1]);E.FTYP=E.box(E.types.ftyp,V,Re,V,we),E.DINF=E.box(E.types.dinf,E.box(E.types.dref,ye))},E.box=function(M){for(var L=8,oe=arguments.length,ye=new Array(oe>1?oe-1:0),W=1;W<oe;W++)ye[W-1]=arguments[W];for(var V=ye.length,we=V;V--;)L+=ye[V].byteLength;var Re=new Uint8Array(L);for(Re[0]=L>>24&255,Re[1]=L>>16&255,Re[2]=L>>8&255,Re[3]=255&L,Re.set(M,4),V=0,L=8;V<we;V++)Re.set(ye[V],L),L+=ye[V].byteLength;return Re},E.hdlr=function(M){return E.box(E.types.hdlr,E.HDLR_TYPES[M])},E.mdat=function(M){return E.box(E.types.mdat,M)},E.mdhd=function(M,L){L*=M;var oe=Math.floor(L/(R+1)),ye=Math.floor(L%(R+1));return E.box(E.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,255&M,oe>>24,oe>>16&255,oe>>8&255,255&oe,ye>>24,ye>>16&255,ye>>8&255,255&ye,85,196,0,0]))},E.mdia=function(M){return E.box(E.types.mdia,E.mdhd(M.timescale,M.duration),E.hdlr(M.type),E.minf(M))},E.mfhd=function(M){return E.box(E.types.mfhd,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,255&M]))},E.minf=function(M){return M.type==="audio"?E.box(E.types.minf,E.box(E.types.smhd,E.SMHD),E.DINF,E.stbl(M)):E.box(E.types.minf,E.box(E.types.vmhd,E.VMHD),E.DINF,E.stbl(M))},E.moof=function(M,L,oe){return E.box(E.types.moof,E.mfhd(M),E.traf(oe,L))},E.moov=function(M){for(var L=M.length,oe=[];L--;)oe[L]=E.trak(M[L]);return E.box.apply(null,[E.types.moov,E.mvhd(M[0].timescale,M[0].duration)].concat(oe).concat(E.mvex(M)))},E.mvex=function(M){for(var L=M.length,oe=[];L--;)oe[L]=E.trex(M[L]);return E.box.apply(null,[E.types.mvex].concat(oe))},E.mvhd=function(M,L){L*=M;var oe=Math.floor(L/(R+1)),ye=Math.floor(L%(R+1)),W=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,255&M,oe>>24,oe>>16&255,oe>>8&255,255&oe,ye>>24,ye>>16&255,ye>>8&255,255&ye,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]);return E.box(E.types.mvhd,W)},E.sdtp=function(M){var L,oe,ye=M.samples||[],W=new Uint8Array(4+ye.length);for(L=0;L<ye.length;L++)oe=ye[L].flags,W[L+4]=oe.dependsOn<<4|oe.isDependedOn<<2|oe.hasRedundancy;return E.box(E.types.sdtp,W)},E.stbl=function(M){return E.box(E.types.stbl,E.stsd(M),E.box(E.types.stts,E.STTS),E.box(E.types.stsc,E.STSC),E.box(E.types.stsz,E.STSZ),E.box(E.types.stco,E.STCO))},E.avc1=function(M){var L,oe,ye,W=[],V=[];for(L=0;L<M.sps.length;L++)ye=(oe=M.sps[L]).byteLength,W.push(ye>>>8&255),W.push(255&ye),W=W.concat(Array.prototype.slice.call(oe));for(L=0;L<M.pps.length;L++)ye=(oe=M.pps[L]).byteLength,V.push(ye>>>8&255),V.push(255&ye),V=V.concat(Array.prototype.slice.call(oe));var we=E.box(E.types.avcC,new Uint8Array([1,W[3],W[4],W[5],255,224|M.sps.length].concat(W).concat([M.pps.length]).concat(V))),Re=M.width,Ce=M.height,ge=M.pixelRatio[0],qe=M.pixelRatio[1];return E.box(E.types.avc1,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,Re>>8&255,255&Re,Ce>>8&255,255&Ce,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),we,E.box(E.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),E.box(E.types.pasp,new Uint8Array([ge>>24,ge>>16&255,ge>>8&255,255&ge,qe>>24,qe>>16&255,qe>>8&255,255&qe])))},E.esds=function(M){var L=M.config.length;return new Uint8Array([0,0,0,0,3,23+L,0,1,0,4,15+L,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([L]).concat(M.config).concat([6,1,2]))},E.mp4a=function(M){var L=M.samplerate;return E.box(E.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,L>>8&255,255&L,0,0]),E.box(E.types.esds,E.esds(M)))},E.mp3=function(M){var L=M.samplerate;return E.box(E.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,L>>8&255,255&L,0,0]))},E.stsd=function(M){return M.type==="audio"?M.segmentCodec==="mp3"&&M.codec==="mp3"?E.box(E.types.stsd,E.STSD,E.mp3(M)):E.box(E.types.stsd,E.STSD,E.mp4a(M)):E.box(E.types.stsd,E.STSD,E.avc1(M))},E.tkhd=function(M){var L=M.id,oe=M.duration*M.timescale,ye=M.width,W=M.height,V=Math.floor(oe/(R+1)),we=Math.floor(oe%(R+1));return E.box(E.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,L>>24&255,L>>16&255,L>>8&255,255&L,0,0,0,0,V>>24,V>>16&255,V>>8&255,255&V,we>>24,we>>16&255,we>>8&255,255&we,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,ye>>8&255,255&ye,0,0,W>>8&255,255&W,0,0]))},E.traf=function(M,L){var oe=E.sdtp(M),ye=M.id,W=Math.floor(L/(R+1)),V=Math.floor(L%(R+1));return E.box(E.types.traf,E.box(E.types.tfhd,new Uint8Array([0,0,0,0,ye>>24,ye>>16&255,ye>>8&255,255&ye])),E.box(E.types.tfdt,new Uint8Array([1,0,0,0,W>>24,W>>16&255,W>>8&255,255&W,V>>24,V>>16&255,V>>8&255,255&V])),E.trun(M,oe.length+16+20+8+16+8+8),oe)},E.trak=function(M){return M.duration=M.duration||4294967295,E.box(E.types.trak,E.tkhd(M),E.mdia(M))},E.trex=function(M){var L=M.id;return E.box(E.types.trex,new Uint8Array([0,0,0,0,L>>24,L>>16&255,L>>8&255,255&L,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},E.trun=function(M,L){var oe,ye,W,V,we,Re,Ce=M.samples||[],ge=Ce.length,qe=12+16*ge,tt=new Uint8Array(qe);for(L+=8+qe,tt.set([M.type==="video"?1:0,0,15,1,ge>>>24&255,ge>>>16&255,ge>>>8&255,255&ge,L>>>24&255,L>>>16&255,L>>>8&255,255&L],0),oe=0;oe<ge;oe++)W=(ye=Ce[oe]).duration,V=ye.size,we=ye.flags,Re=ye.cts,tt.set([W>>>24&255,W>>>16&255,W>>>8&255,255&W,V>>>24&255,V>>>16&255,V>>>8&255,255&V,we.isLeading<<2|we.dependsOn,we.isDependedOn<<6|we.hasRedundancy<<4|we.paddingValue<<1|we.isNonSync,61440&we.degradPrio,15&we.degradPrio,Re>>>24&255,Re>>>16&255,Re>>>8&255,255&Re],12+16*oe);return E.box(E.types.trun,tt)},E.initSegment=function(M){E.types||E.init();var L=E.moov(M),oe=new Uint8Array(E.FTYP.byteLength+L.byteLength);return oe.set(E.FTYP),oe.set(L,E.FTYP.byteLength),oe},E}();p.types=void 0,p.HDLR_TYPES=void 0,p.STTS=void 0,p.STSC=void 0,p.STCO=void 0,p.STSZ=void 0,p.VMHD=void 0,p.SMHD=void 0,p.STSD=void 0,p.FTYP=void 0,p.DINF=void 0;let w=p;var k=N(851),ve=N(973),Z=N(93),le=N(308),Te=N(673);function H(){return H=Object.assign?Object.assign.bind():function(E){for(var M=1;M<arguments.length;M++){var L=arguments[M];for(var oe in L)Object.prototype.hasOwnProperty.call(L,oe)&&(E[oe]=L[oe])}return E},H.apply(this,arguments)}var ce=null,z=null,ne=function(){function E(L,oe,ye,W){if(W===void 0&&(W=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=L,this.config=oe,this.typeSupported=ye,this.ISGenerated=!1,ce===null){var V=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ce=V?parseInt(V[1]):0}if(z===null){var we=navigator.userAgent.match(/Safari\/(\d+)/i);z=we?parseInt(we[1]):0}}var M=E.prototype;return M.destroy=function(){},M.resetTimeStamp=function(L){Z.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=L},M.resetNextTimestamp=function(){Z.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},M.resetInitSegment=function(){Z.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},M.getVideoStartPts=function(L){var oe=!1,ye=L.reduce(function(W,V){var we=V.pts-W;return we<-4294967296?(oe=!0,U(W,V.pts)):we>0?W:V.pts},L[0].pts);return oe&&Z.logger.debug("PTS rollover detected"),ye},M.remux=function(L,oe,ye,W,V,we,Re,Ce){var ge,qe,tt,ee,ue,ie,Oe=V,xe=V,Ne=L.pid>-1,Be=oe.pid>-1,je=oe.samples.length,pe=L.samples.length>0,Ie=Re&&je>0||je>1;if((!Ne||pe)&&(!Be||Ie)||this.ISGenerated||Re){this.ISGenerated||(tt=this.generateIS(L,oe,V));var Ye,rt=this.isVideoContiguous,yt=-1;if(Ie&&(yt=function(kt){for(var gt=0;gt<kt.length;gt++)if(kt[gt].key)return gt;return-1}(oe.samples),!rt&&this.config.forceKeyFrameOnDiscontinuity))if(ie=!0,yt>0){Z.logger.warn("[mp4-remuxer]: Dropped "+yt+" out of "+je+" video samples due to a missing keyframe");var ht=this.getVideoStartPts(oe.samples);oe.samples=oe.samples.slice(yt),oe.dropped+=yt,Ye=xe+=(oe.samples[0].pts-ht)/oe.inputTimeScale}else yt===-1&&(Z.logger.warn("[mp4-remuxer]: No keyframe found out of "+je+" video samples"),ie=!1);if(this.ISGenerated){if(pe&&Ie){var It=this.getVideoStartPts(oe.samples),Dt=(U(L.samples[0].pts,It)-It)/oe.inputTimeScale;Oe+=Math.max(0,Dt),xe+=Math.max(0,-Dt)}if(pe){if(L.samplerate||(Z.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),tt=this.generateIS(L,oe,V)),qe=this.remuxAudio(L,Oe,this.isAudioContiguous,we,Be||Ie||Ce===le.PlaylistLevelType.AUDIO?xe:void 0),Ie){var St=qe?qe.endPTS-qe.startPTS:0;oe.inputTimeScale||(Z.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),tt=this.generateIS(L,oe,V)),ge=this.remuxVideo(oe,xe,rt,St)}}else Ie&&(ge=this.remuxVideo(oe,xe,rt,0));ge&&(ge.firstKeyFrame=yt,ge.independent=yt!==-1,ge.firstKeyFramePTS=Ye)}}return this.ISGenerated&&(ye.samples.length&&(ue=be(ye,V,this._initPTS,this._initDTS)),W.samples.length&&(ee=ke(W,V,this._initPTS))),{audio:qe,video:ge,initSegment:tt,independent:ie,text:ee,id3:ue}},M.generateIS=function(L,oe,ye){var W,V,we,Re=L.samples,Ce=oe.samples,ge=this.typeSupported,qe={},tt=!(0,B.isFiniteNumber)(this._initPTS),ee="audio/mp4";if(tt&&(W=V=1/0),L.config&&Re.length&&(L.timescale=L.samplerate,L.segmentCodec==="mp3"&&(ge.mpeg?(ee="audio/mpeg",L.codec=""):ge.mp3&&(L.codec="mp3")),qe.audio={id:"audio",container:ee,codec:L.codec,initSegment:L.segmentCodec==="mp3"&&ge.mpeg?new Uint8Array(0):w.initSegment([L]),metadata:{channelCount:L.channelCount}},tt&&(we=L.inputTimeScale,W=V=Re[0].pts-Math.round(we*ye))),oe.sps&&oe.pps&&Ce.length&&(oe.timescale=oe.inputTimeScale,qe.video={id:"main",container:"video/mp4",codec:oe.codec,initSegment:w.initSegment([oe]),metadata:{width:oe.width,height:oe.height}},tt)){we=oe.inputTimeScale;var ue=this.getVideoStartPts(Ce),ie=Math.round(we*ye);V=Math.min(V,U(Ce[0].dts,ue)-ie),W=Math.min(W,ue-ie)}if(Object.keys(qe).length)return this.ISGenerated=!0,tt&&(this._initPTS=W,this._initDTS=V),{tracks:qe,initPTS:W,timescale:we}},M.remuxVideo=function(L,oe,ye,W){var V,we,Re=L.inputTimeScale,Ce=L.samples,ge=[],qe=Ce.length,tt=this._initPTS,ee=this.nextAvcDts,ue=8,ie=this.videoSampleDuration,Oe=Number.POSITIVE_INFINITY,xe=Number.NEGATIVE_INFINITY,Ne=!1;ye&&ee!==null||(ee=oe*Re-(Ce[0].pts-U(Ce[0].dts,Ce[0].pts)));for(var Be=0;Be<qe;Be++){var je=Ce[Be];je.pts=U(je.pts-tt,ee),je.dts=U(je.dts-tt,ee),je.dts<Ce[Be>0?Be-1:Be].dts&&(Ne=!0)}Ne&&Ce.sort(function(Vt,hr){var wr=Vt.dts-hr.dts,cr=Vt.pts-hr.pts;return wr||cr}),V=Ce[0].dts;var pe=Ce[Ce.length-1].dts-V,Ie=pe?Math.round(pe/(qe-1)):ie||L.inputTimeScale/30;if(ye){var Ye=V-ee,rt=Ye>Ie,yt=Ye<-1;if((rt||yt)&&(rt?Z.logger.warn("AVC: "+(0,Te.toMsFromMpegTsClock)(Ye,!0)+" ms ("+Ye+"dts) hole between fragments detected, filling it"):Z.logger.warn("AVC: "+(0,Te.toMsFromMpegTsClock)(-Ye,!0)+" ms ("+Ye+"dts) overlapping between fragments detected"),!yt||ee>Ce[0].pts)){V=ee;var ht=Ce[0].pts-Ye;Ce[0].dts=V,Ce[0].pts=ht,Z.logger.log("Video: First PTS/DTS adjusted: "+(0,Te.toMsFromMpegTsClock)(ht,!0)+"/"+(0,Te.toMsFromMpegTsClock)(V,!0)+", delta: "+(0,Te.toMsFromMpegTsClock)(Ye,!0)+" ms")}}V=Math.max(0,V);for(var It=0,Dt=0,St=0;St<qe;St++){for(var kt=Ce[St],gt=kt.units,ut=gt.length,Rt=0,Pt=0;Pt<ut;Pt++)Rt+=gt[Pt].data.length;Dt+=Rt,It+=ut,kt.length=Rt,kt.dts=Math.max(kt.dts,V),Oe=Math.min(kt.pts,Oe),xe=Math.max(kt.pts,xe)}we=Ce[qe-1].dts;var jt,zt=Dt+4*It+8;try{jt=new Uint8Array(zt)}catch{return void this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:ve.ErrorTypes.MUX_ERROR,details:ve.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:zt,reason:"fail allocating video mdat "+zt})}var Nt=new DataView(jt.buffer);Nt.setUint32(0,zt),jt.set(w.types.mdat,4);for(var dr=!1,J=Number.POSITIVE_INFINITY,O=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY,P=Number.NEGATIVE_INFINITY,D=0;D<qe;D++){for(var F=Ce[D],q=F.units,Y=0,he=0,Le=q.length;he<Le;he++){var Ae=q[he],Me=Ae.data,Ve=Ae.data.byteLength;Nt.setUint32(ue,Ve),ue+=4,jt.set(Me,ue),ue+=Ve,Y+=4+Ve}var Ue=void 0;if(D<qe-1)ie=Ce[D+1].dts-F.dts,Ue=Ce[D+1].pts-F.pts;else{var Qe=this.config,ot=D>0?F.dts-Ce[D-1].dts:Ie;if(Ue=D>0?F.pts-Ce[D-1].pts:Ie,Qe.stretchShortVideoTrack&&this.nextAudioPts!==null){var bt=Math.floor(Qe.maxBufferHole*Re),We=(W?Oe+W*Re:this.nextAudioPts)-F.pts;We>bt?((ie=We-ot)<0?ie=ot:dr=!0,Z.logger.log("[mp4-remuxer]: It is approximately "+We/90+" ms to the next segment; using duration "+ie/90+" ms for the last video frame.")):ie=ot}else ie=ot}var Lt=Math.round(F.pts-F.dts);J=Math.min(J,ie),T=Math.max(T,ie),O=Math.min(O,Ue),P=Math.max(P,Ue),ge.push(new He(F.key,ie,Y,Lt))}if(ge.length){if(ce){if(ce<70){var Qt=ge[0].flags;Qt.dependsOn=2,Qt.isNonSync=0}}else if(z&&P-O<T-J&&Ie/T<.025&&ge[0].cts===0){Z.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var Ot=V,xt=0,Ut=ge.length;xt<Ut;xt++){var Ze=Ot+ge[xt].duration,rr=Ot+ge[xt].cts;if(xt<Ut-1){var Er=Ze+ge[xt+1].cts;ge[xt].duration=Er-rr}else ge[xt].duration=xt?ge[xt-1].duration:Ie;ge[xt].cts=0,Ot=Ze}}}ie=dr||!ie?Ie:ie,this.nextAvcDts=ee=we+ie,this.videoSampleDuration=ie,this.isVideoContiguous=!0;var Ft={data1:w.moof(L.sequenceNumber++,V,H({},L,{samples:ge})),data2:jt,startPTS:Oe/Re,endPTS:(xe+ie)/Re,startDTS:V/Re,endDTS:ee/Re,type:"video",hasAudio:!1,hasVideo:!0,nb:ge.length,dropped:L.dropped};return L.samples=[],L.dropped=0,Ft},M.remuxAudio=function(L,oe,ye,W,V){var we=L.inputTimeScale,Re=we/(L.samplerate?L.samplerate:we),Ce=L.segmentCodec==="aac"?1024:1152,ge=Ce*Re,qe=this._initPTS,tt=L.segmentCodec==="mp3"&&this.typeSupported.mpeg,ee=[],ue=V!==void 0,ie=L.samples,Oe=tt?0:8,xe=this.nextAudioPts||-1,Ne=oe*we;if(this.isAudioContiguous=ye=ye||ie.length&&xe>0&&(W&&Math.abs(Ne-xe)<9e3||Math.abs(U(ie[0].pts-qe,Ne)-xe)<20*ge),ie.forEach(function(he){he.pts=U(he.pts-qe,Ne)}),!ye||xe<0){if(ie=ie.filter(function(he){return he.pts>=0}),!ie.length)return;xe=V===0?0:W&&!ue?Math.max(0,Ne):ie[0].pts}if(L.segmentCodec==="aac")for(var Be=this.config.maxAudioFramesDrift,je=0,pe=xe;je<ie.length;je++){var Ie=ie[je],Ye=Ie.pts,rt=Ye-pe,yt=Math.abs(1e3*rt/we);if(rt<=-Be*ge&&ue)je===0&&(Z.logger.warn("Audio frame @ "+(Ye/we).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*rt/we)+" ms."),this.nextAudioPts=xe=pe=Ye);else if(rt>=Be*ge&&yt<1e4&&ue){var ht=Math.round(rt/ge);(pe=Ye-ht*ge)<0&&(ht--,pe+=ge),je===0&&(this.nextAudioPts=xe=pe),Z.logger.warn("[mp4-remuxer]: Injecting "+ht+" audio frame @ "+(pe/we).toFixed(3)+"s due to "+Math.round(1e3*rt/we)+" ms gap.");for(var It=0;It<ht;It++){var Dt=Math.max(pe,0),St=$.getSilentFrame(L.manifestCodec||L.codec,L.channelCount);St||(Z.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),St=Ie.unit.subarray()),ie.splice(je,0,{unit:St,pts:Dt}),pe+=ge,je++}}Ie.pts=pe,pe+=ge}for(var kt,gt=null,ut=null,Rt=0,Pt=ie.length;Pt--;)Rt+=ie[Pt].unit.byteLength;for(var jt=0,zt=ie.length;jt<zt;jt++){var Nt=ie[jt],dr=Nt.unit,J=Nt.pts;if(ut!==null)ee[jt-1].duration=Math.round((J-ut)/Re);else{if(ye&&L.segmentCodec==="aac"&&(J=xe),gt=J,!(Rt>0))return;Rt+=Oe;try{kt=new Uint8Array(Rt)}catch{return void this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:ve.ErrorTypes.MUX_ERROR,details:ve.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Rt,reason:"fail allocating audio mdat "+Rt})}tt||(new DataView(kt.buffer).setUint32(0,Rt),kt.set(w.types.mdat,4))}kt.set(dr,Oe);var O=dr.byteLength;Oe+=O,ee.push(new He(!0,Ce,O,0)),ut=J}var T=ee.length;if(T){var P=ee[ee.length-1];this.nextAudioPts=xe=ut+Re*P.duration;var D=tt?new Uint8Array(0):w.moof(L.sequenceNumber++,gt/Re,H({},L,{samples:ee}));L.samples=[];var F=gt/we,q=xe/we,Y={data1:D,data2:kt,startPTS:F,endPTS:q,startDTS:F,endDTS:q,type:"audio",hasAudio:!0,hasVideo:!1,nb:T};return this.isAudioContiguous=!0,Y}},M.remuxEmptyAudio=function(L,oe,ye,W){var V=L.inputTimeScale,we=V/(L.samplerate?L.samplerate:V),Re=this.nextAudioPts,Ce=(Re!==null?Re:W.startDTS*V)+this._initDTS,ge=W.endDTS*V+this._initDTS,qe=1024*we,tt=Math.ceil((ge-Ce)/qe),ee=$.getSilentFrame(L.manifestCodec||L.codec,L.channelCount);if(Z.logger.warn("[mp4-remuxer]: remux empty Audio"),ee){for(var ue=[],ie=0;ie<tt;ie++){var Oe=Ce+ie*qe;ue.push({unit:ee,pts:Oe,dts:Oe})}return L.samples=ue,this.remuxAudio(L,oe,ye,!1)}Z.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},E}();function U(E,M){var L;if(M===null)return E;for(L=M<E?-8589934592:8589934592;Math.abs(E-M)>4294967296;)E+=L;return E}function be(E,M,L,oe){var ye=E.samples.length;if(ye){for(var W=E.inputTimeScale,V=0;V<ye;V++){var we=E.samples[V];we.pts=U(we.pts-L,M*W)/W,we.dts=U(we.dts-oe,M*W)/W}var Re=E.samples;return E.samples=[],{samples:Re}}}function ke(E,M,L){var oe=E.samples.length;if(oe){for(var ye=E.inputTimeScale,W=0;W<oe;W++){var V=E.samples[W];V.pts=U(V.pts-L,M*ye)/ye}E.samples.sort(function(Re,Ce){return Re.pts-Ce.pts});var we=E.samples;return E.samples=[],{samples:we}}}var He=function(E,M,L,oe){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=M,this.size=L,this.cts=oe,this.flags=new K(E)},K=function(E){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=E?2:1,this.isNonSync=E?0:1}},856:(fe,re,N)=>{"use strict";var B;N.r(re),N.d(re,{MetadataSchema:()=>B}),function($){$.audioId3="org.id3",$.dateRange="com.apple.quicktime.HLS",$.emsg="https://aomedia.org/emsg/ID3"}(B||(B={}))},308:(fe,re,N)=>{"use strict";var B,$;N.r(re),N.d(re,{PlaylistContextType:()=>B,PlaylistLevelType:()=>$}),function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"}(B||(B={})),function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"}($||($={}))},300:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{default:()=>B});let B={hexDump:function($){for(var R="",p=0;p<$.length;p++){var w=$[p].toString(16);w.length<2&&(w="0"+w),R+=w}return R}}},93:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{enableLogs:()=>w,logger:()=>k});var B=function(){},$={trace:B,debug:B,log:B,warn:B,info:B,error:B},R=$;function p(ve){var Z=self.console[ve];return Z?Z.bind(self.console,"["+ve+"] >"):B}function w(ve,Z){if(self.console&&ve===!0||typeof ve=="object"){(function(le){for(var Te=arguments.length,H=new Array(Te>1?Te-1:0),ce=1;ce<Te;ce++)H[ce-1]=arguments[ce];H.forEach(function(z){R[z]=le[z]?le[z].bind(le):p(z)})})(ve,"debug","log","info","warn","error");try{R.log('Debug logs enabled for "'+Z+'"')}catch{R=$}}else R=$}var k=$},63:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{RemuxerTrackIdConfig:()=>Z,appendUint8Array:()=>ye,bin2str:()=>le,computeRawDurationFromSamples:()=>M,discardEPB:()=>Re,findBox:()=>ne,getDuration:()=>E,getStartDTS:()=>K,mp4Box:()=>ge,mp4pssh:()=>qe,offsetStartDTS:()=>L,parseEmsg:()=>Ce,parseInitSegment:()=>be,parsePssh:()=>tt,parseSEIMessageFromNALu:()=>we,parseSamples:()=>W,parseSegmentIndex:()=>U,parseSinf:()=>He,patchEncyptionData:()=>ke,readSint32:()=>ce,readUint16:()=>Te,readUint32:()=>H,segmentValidRange:()=>oe,writeUint32:()=>z});var B=N(923),$=N(145),R=N(181),p=N(93),w=N(300),k=Math.pow(2,32)-1,ve=[].push,Z={video:1,audio:2,id3:3,text:4};function le(ee){return String.fromCharCode.apply(null,ee)}function Te(ee,ue){var ie=ee[ue]<<8|ee[ue+1];return ie<0?65536+ie:ie}function H(ee,ue){var ie=ce(ee,ue);return ie<0?4294967296+ie:ie}function ce(ee,ue){return ee[ue]<<24|ee[ue+1]<<16|ee[ue+2]<<8|ee[ue+3]}function z(ee,ue,ie){ee[ue]=ie>>24,ee[ue+1]=ie>>16&255,ee[ue+2]=ie>>8&255,ee[ue+3]=255&ie}function ne(ee,ue){var ie=[];if(!ue.length)return ie;for(var Oe=ee.byteLength,xe=0;xe<Oe;){var Ne=H(ee,xe),Be=Ne>1?xe+Ne:Oe;if(le(ee.subarray(xe+4,xe+8))===ue[0])if(ue.length===1)ie.push(ee.subarray(xe+8,Be));else{var je=ne(ee.subarray(xe+8,Be),ue.slice(1));je.length&&ve.apply(ie,je)}xe=Be}return ie}function U(ee){var ue=[],ie=ee[0],Oe=8,xe=H(ee,Oe);Oe+=4,Oe+=ie===0?8:16,Oe+=2;var Ne=ee.length+0,Be=Te(ee,Oe);Oe+=2;for(var je=0;je<Be;je++){var pe=Oe,Ie=H(ee,pe);pe+=4;var Ye=2147483647&Ie;if((2147483648&Ie)>>>31==1)return console.warn("SIDX has hierarchical references (not supported)"),null;var rt=H(ee,pe);pe+=4,ue.push({referenceSize:Ye,subsegmentDuration:rt,info:{duration:rt/xe,start:Ne,end:Ne+Ye-1}}),Ne+=Ye,Oe=pe+=4}return{earliestPresentationTime:0,timescale:xe,version:ie,referencesCount:Be,references:ue}}function be(ee){for(var ue=[],ie=ne(ee,["moov","trak"]),Oe=0;Oe<ie.length;Oe++){var xe=ie[Oe],Ne=ne(xe,["tkhd"])[0];if(Ne){var Be=Ne[0],je=Be===0?12:20,pe=H(Ne,je),Ie=ne(xe,["mdia","mdhd"])[0];if(Ie){var Ye=H(Ie,je=(Be=Ie[0])===0?12:20),rt=ne(xe,["mdia","hdlr"])[0];if(rt){var yt=le(rt.subarray(8,12)),ht={soun:B.ElementaryStreamTypes.AUDIO,vide:B.ElementaryStreamTypes.VIDEO}[yt];if(ht){var It=ne(xe,["mdia","minf","stbl","stsd"])[0],Dt=void 0;It&&(Dt=le(It.subarray(12,16))),ue[pe]={timescale:Ye,type:ht},ue[ht]={timescale:Ye,id:pe,codec:Dt}}}}}}return ne(ee,["moov","mvex","trex"]).forEach(function(St){var kt=H(St,4),gt=ue[kt];gt&&(gt.default={duration:H(St,12),flags:H(St,20)})}),ue}function ke(ee,ue){if(!ee||!ue)return ee;var ie=ue.keyId;return ie&&ue.isCommonEncryption&&ne(ee,["moov","trak"]).forEach(function(Oe){var xe=ne(Oe,["mdia","minf","stbl","stsd"])[0].subarray(8),Ne=ne(xe,["enca"]),Be=Ne.length>0;Be||(Ne=ne(xe,["encv"])),Ne.forEach(function(je){ne(Be?je.subarray(28):je.subarray(78),["sinf"]).forEach(function(pe){var Ie=He(pe);if(Ie){var Ye=Ie.subarray(8,24);Ye.some(function(rt){return rt!==0})||(p.logger.log("[eme] Patching keyId in 'enc"+(Be?"a":"v")+">sinf>>tenc' box: "+w.default.hexDump(Ye)+" -> "+w.default.hexDump(ie)),Ie.set(ie,8))}})})}),ee}function He(ee){var ue=ne(ee,["schm"])[0];if(ue){var ie=le(ue.subarray(4,8));if(ie==="cbcs"||ie==="cenc")return ne(ee,["schi","tenc"])[0]}return p.logger.error("[eme] missing 'schm' box"),null}function K(ee,ue){return ne(ue,["moof","traf"]).reduce(function(ie,Oe){var xe=ne(Oe,["tfdt"])[0],Ne=xe[0],Be=ne(Oe,["tfhd"]).reduce(function(je,pe){var Ie=H(pe,4),Ye=ee[Ie];if(Ye){var rt=H(xe,4);Ne===1&&(rt*=Math.pow(2,32),rt+=H(xe,8));var yt=rt/(Ye.timescale||9e4);if(isFinite(yt)&&(je===null||yt<je))return yt}return je},null);return Be!==null&&isFinite(Be)&&(ie===null||Be<ie)?Be:ie},null)||0}function E(ee,ue){for(var ie=0,Oe=0,xe=0,Ne=ne(ee,["moof","traf"]),Be=0;Be<Ne.length;Be++){var je=Ne[Be],pe=ne(je,["tfhd"])[0],Ie=ue[H(pe,4)];if(Ie){var Ye=Ie.default,rt=H(pe,0)|(Ye==null?void 0:Ye.flags),yt=Ye==null?void 0:Ye.duration;8&rt&&(yt=H(pe,2&rt?12:8));for(var ht=Ie.timescale||9e4,It=ne(je,["trun"]),Dt=0;Dt<It.length;Dt++)!(ie=M(It[Dt]))&&yt&&(ie=yt*H(It[Dt],4)),Ie.type===B.ElementaryStreamTypes.VIDEO?Oe+=ie/ht:Ie.type===B.ElementaryStreamTypes.AUDIO&&(xe+=ie/ht)}}if(Oe===0&&xe===0){for(var St=0,kt=ne(ee,["sidx"]),gt=0;gt<kt.length;gt++){var ut=U(kt[gt]);ut!=null&&ut.references&&(St+=ut.references.reduce(function(Rt,Pt){return Rt+Pt.info.duration||0},0))}return St}return Oe||xe}function M(ee){var ue=H(ee,0),ie=8;1&ue&&(ie+=4),4&ue&&(ie+=4);for(var Oe=0,xe=H(ee,4),Ne=0;Ne<xe;Ne++)256&ue&&(Oe+=H(ee,ie),ie+=4),512&ue&&(ie+=4),1024&ue&&(ie+=4),2048&ue&&(ie+=4);return Oe}function L(ee,ue,ie){ne(ue,["moof","traf"]).forEach(function(Oe){ne(Oe,["tfhd"]).forEach(function(xe){var Ne=H(xe,4),Be=ee[Ne];if(Be){var je=Be.timescale||9e4;ne(Oe,["tfdt"]).forEach(function(pe){var Ie=pe[0],Ye=H(pe,4);if(Ie===0)Ye-=ie*je,z(pe,4,Ye=Math.max(Ye,0));else{Ye*=Math.pow(2,32),Ye+=H(pe,8),Ye-=ie*je,Ye=Math.max(Ye,0);var rt=Math.floor(Ye/(k+1)),yt=Math.floor(Ye%(k+1));z(pe,4,rt),z(pe,8,yt)}})}})})}function oe(ee){var ue={valid:null,remainder:null},ie=ne(ee,["moof"]);if(!ie)return ue;if(ie.length<2)return ue.remainder=ee,ue;var Oe=ie[ie.length-1];return ue.valid=(0,$.sliceUint8)(ee,0,Oe.byteOffset-8),ue.remainder=(0,$.sliceUint8)(ee,Oe.byteOffset-8),ue}function ye(ee,ue){var ie=new Uint8Array(ee.length+ue.length);return ie.set(ee),ie.set(ue,ee.length),ie}function W(ee,ue){var ie=[],Oe=ue.samples,xe=ue.timescale,Ne=ue.id,Be=!1;return ne(Oe,["moof"]).map(function(je){var pe=je.byteOffset-8;ne(je,["traf"]).map(function(Ie){var Ye=ne(Ie,["tfdt"]).map(function(rt){var yt=rt[0],ht=H(rt,4);return yt===1&&(ht*=Math.pow(2,32),ht+=H(rt,8)),ht/xe})[0];return Ye!==void 0&&(ee=Ye),ne(Ie,["tfhd"]).map(function(rt){var yt=H(rt,4),ht=16777215&H(rt,0),It=0,Dt=(16&ht)!=0,St=0,kt=(32&ht)!=0,gt=8;yt===Ne&&((1&ht)!=0&&(gt+=8),(2&ht)!=0&&(gt+=4),(8&ht)!=0&&(It=H(rt,gt),gt+=4),Dt&&(St=H(rt,gt),gt+=4),kt&&(gt+=4),ue.type==="video"&&(Be=function(ut){if(!ut)return!1;var Rt=ut.indexOf("."),Pt=Rt<0?ut:ut.substring(0,Rt);return Pt==="hvc1"||Pt==="hev1"||Pt==="dvh1"||Pt==="dvhe"}(ue.codec)),ne(Ie,["trun"]).map(function(ut){var Rt=ut[0],Pt=16777215&H(ut,0),jt=(1&Pt)!=0,zt=0,Nt=(4&Pt)!=0,dr=(256&Pt)!=0,J=0,O=(512&Pt)!=0,T=0,P=(1024&Pt)!=0,D=(2048&Pt)!=0,F=0,q=H(ut,4),Y=8;jt&&(zt=H(ut,Y),Y+=4),Nt&&(Y+=4);for(var he=zt+pe,Le=0;Le<q;Le++){if(dr?(J=H(ut,Y),Y+=4):J=It,O?(T=H(ut,Y),Y+=4):T=St,P&&(Y+=4),D&&(F=Rt===0?H(ut,Y):ce(ut,Y),Y+=4),ue.type===B.ElementaryStreamTypes.VIDEO)for(var Ae=0;Ae<T;){var Me=H(Oe,he);V(Be,Oe[he+=4])&&we(Oe.subarray(he,he+Me),Be?2:1,ee+F/xe,ie),he+=Me,Ae+=Me+4}ee+=J/xe}}))})})}),ie}function V(ee,ue){if(ee){var ie=ue>>1&63;return ie===39||ie===40}return(31&ue)==6}function we(ee,ue,ie,Oe){var xe=Re(ee),Ne=0;Ne+=ue;for(var Be=0,je=0,pe=!1,Ie=0;Ne<xe.length;){Be=0;do{if(Ne>=xe.length)break;Be+=Ie=xe[Ne++]}while(Ie===255);je=0;do{if(Ne>=xe.length)break;je+=Ie=xe[Ne++]}while(Ie===255);var Ye=xe.length-Ne;if(!pe&&Be===4&&Ne<xe.length){if(pe=!0,xe[Ne++]===181){var rt=Te(xe,Ne);if(Ne+=2,rt===49){var yt=H(xe,Ne);if(Ne+=4,yt===1195456820){var ht=xe[Ne++];if(ht===3){var It=xe[Ne++],Dt=64&It,St=Dt?2+3*(31&It):0,kt=new Uint8Array(St);if(Dt){kt[0]=It;for(var gt=1;gt<St;gt++)kt[gt]=xe[Ne++]}Oe.push({type:ht,payloadType:Be,pts:ie,bytes:kt})}}}}}else if(Be===5&&je<Ye){if(pe=!0,je>16){for(var ut=[],Rt=0;Rt<16;Rt++){var Pt=xe[Ne++].toString(16);ut.push(Pt.length==1?"0"+Pt:Pt),Rt!==3&&Rt!==5&&Rt!==7&&Rt!==9||ut.push("-")}for(var jt=je-16,zt=new Uint8Array(jt),Nt=0;Nt<jt;Nt++)zt[Nt]=xe[Ne++];Oe.push({payloadType:Be,pts:ie,uuid:ut.join(""),userData:(0,R.utf8ArrayToStr)(zt),userDataBytes:zt})}}else if(je<Ye)Ne+=je;else if(je>Ye)break}}function Re(ee){for(var ue=ee.byteLength,ie=[],Oe=1;Oe<ue-2;)ee[Oe]===0&&ee[Oe+1]===0&&ee[Oe+2]===3?(ie.push(Oe+2),Oe+=2):Oe++;if(ie.length===0)return ee;var xe=ue-ie.length,Ne=new Uint8Array(xe),Be=0;for(Oe=0;Oe<xe;Be++,Oe++)Be===ie[0]&&(Be++,ie.shift()),Ne[Oe]=ee[Be];return Ne}function Ce(ee){var ue=ee[0],ie="",Oe="",xe=0,Ne=0,Be=0,je=0,pe=0,Ie=0;if(ue===0){for(;le(ee.subarray(Ie,Ie+1))!=="\0";)ie+=le(ee.subarray(Ie,Ie+1)),Ie+=1;for(ie+=le(ee.subarray(Ie,Ie+1)),Ie+=1;le(ee.subarray(Ie,Ie+1))!=="\0";)Oe+=le(ee.subarray(Ie,Ie+1)),Ie+=1;Oe+=le(ee.subarray(Ie,Ie+1)),Ie+=1,xe=H(ee,12),Ne=H(ee,16),je=H(ee,20),pe=H(ee,24),Ie=28}else if(ue===1){xe=H(ee,Ie+=4);var Ye=H(ee,Ie+=4),rt=H(ee,Ie+=4);for(Ie+=4,Be=Math.pow(2,32)*Ye+rt,Number.isSafeInteger(Be)||(Be=Number.MAX_SAFE_INTEGER,console.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),je=H(ee,Ie),pe=H(ee,Ie+=4),Ie+=4;le(ee.subarray(Ie,Ie+1))!=="\0";)ie+=le(ee.subarray(Ie,Ie+1)),Ie+=1;for(ie+=le(ee.subarray(Ie,Ie+1)),Ie+=1;le(ee.subarray(Ie,Ie+1))!=="\0";)Oe+=le(ee.subarray(Ie,Ie+1)),Ie+=1;Oe+=le(ee.subarray(Ie,Ie+1)),Ie+=1}return{schemeIdUri:ie,value:Oe,timeScale:xe,presentationTime:Be,presentationTimeDelta:Ne,eventDuration:je,id:pe,payload:ee.subarray(Ie,ee.byteLength)}}function ge(ee){for(var ue=arguments.length,ie=new Array(ue>1?ue-1:0),Oe=1;Oe<ue;Oe++)ie[Oe-1]=arguments[Oe];for(var xe=ie.length,Ne=8,Be=xe;Be--;)Ne+=ie[Be].byteLength;var je=new Uint8Array(Ne);for(je[0]=Ne>>24&255,je[1]=Ne>>16&255,je[2]=Ne>>8&255,je[3]=255&Ne,je.set(ee,4),Be=0,Ne=8;Be<xe;Be++)je.set(ie[Be],Ne),Ne+=ie[Be].byteLength;return je}function qe(ee,ue,ie){if(ee.byteLength!==16)throw new RangeError("Invalid system id");var Oe,xe,Ne;if(ue){Oe=1,xe=new Uint8Array(16*ue.length);for(var Be=0;Be<ue.length;Be++){var je=ue[Be];if(je.byteLength!==16)throw new RangeError("Invalid key");xe.set(je,16*Be)}}else Oe=0,xe=new Uint8Array;Oe>0?(Ne=new Uint8Array(4),ue.length>0&&new DataView(Ne.buffer).setUint32(0,ue.length,!1)):Ne=new Uint8Array;var pe=new Uint8Array(4);return ie&&ie.byteLength>0&&new DataView(pe.buffer).setUint32(0,ie.byteLength,!1),ge([112,115,115,104],new Uint8Array([Oe,0,0,0]),ee,Ne,xe,pe,ie||new Uint8Array)}function tt(ee){if(!(ee instanceof ArrayBuffer)||ee.byteLength<32)return null;var ue={version:0,systemId:"",kids:null,data:null},ie=new DataView(ee),Oe=ie.getUint32(0);if(ee.byteLength!==Oe&&Oe>44||ie.getUint32(4)!==1886614376||(ue.version=ie.getUint32(8)>>>24,ue.version>1))return null;ue.systemId=w.default.hexDump(new Uint8Array(ee,12,16));var xe=ie.getUint32(28);if(ue.version===0){if(Oe-32<xe)return null;ue.data=new Uint8Array(ee,32,xe)}else if(ue.version===1){ue.kids=[];for(var Ne=0;Ne<xe;Ne++)ue.kids.push(new Uint8Array(ee,32+16*Ne,16))}return ue}},673:(fe,re,N)=>{"use strict";function B(w,k,ve,Z){ve===void 0&&(ve=1),Z===void 0&&(Z=!1);var le=w*k*ve;return Z?Math.round(le):le}function $(w,k,ve,Z){return ve===void 0&&(ve=1),Z===void 0&&(Z=!1),B(w,k,1/ve,Z)}function R(w,k){return k===void 0&&(k=!1),B(w,1e3,11111111111111112e-21,k)}function p(w,k){return k===void 0&&(k=1),B(w,9e4,1/k)}N.r(re),N.d(re,{toMpegTsClockFromTimescale:()=>p,toMsFromMpegTsClock:()=>R,toTimescaleFromBase:()=>B,toTimescaleFromScale:()=>$})},145:(fe,re,N)=>{"use strict";function B($,R,p){return Uint8Array.prototype.slice?$.slice(R,p):new Uint8Array(Array.prototype.slice.call($,R,p))}N.r(re),N.d(re,{sliceUint8:()=>B})},729:fe=>{"use strict";var re=Object.prototype.hasOwnProperty,N="~";function B(){}function $(k,ve,Z){this.fn=k,this.context=ve,this.once=Z||!1}function R(k,ve,Z,le,Te){if(typeof Z!="function")throw new TypeError("The listener must be a function");var H=new $(Z,le||k,Te),ce=N?N+ve:ve;return k._events[ce]?k._events[ce].fn?k._events[ce]=[k._events[ce],H]:k._events[ce].push(H):(k._events[ce]=H,k._eventsCount++),k}function p(k,ve){--k._eventsCount==0?k._events=new B:delete k._events[ve]}function w(){this._events=new B,this._eventsCount=0}Object.create&&(B.prototype=Object.create(null),new B().__proto__||(N=!1)),w.prototype.eventNames=function(){var k,ve,Z=[];if(this._eventsCount===0)return Z;for(ve in k=this._events)re.call(k,ve)&&Z.push(N?ve.slice(1):ve);return Object.getOwnPropertySymbols?Z.concat(Object.getOwnPropertySymbols(k)):Z},w.prototype.listeners=function(k){var ve=N?N+k:k,Z=this._events[ve];if(!Z)return[];if(Z.fn)return[Z.fn];for(var le=0,Te=Z.length,H=new Array(Te);le<Te;le++)H[le]=Z[le].fn;return H},w.prototype.listenerCount=function(k){var ve=N?N+k:k,Z=this._events[ve];return Z?Z.fn?1:Z.length:0},w.prototype.emit=function(k,ve,Z,le,Te,H){var ce=N?N+k:k;if(!this._events[ce])return!1;var z,ne,U=this._events[ce],be=arguments.length;if(U.fn){switch(U.once&&this.removeListener(k,U.fn,void 0,!0),be){case 1:return U.fn.call(U.context),!0;case 2:return U.fn.call(U.context,ve),!0;case 3:return U.fn.call(U.context,ve,Z),!0;case 4:return U.fn.call(U.context,ve,Z,le),!0;case 5:return U.fn.call(U.context,ve,Z,le,Te),!0;case 6:return U.fn.call(U.context,ve,Z,le,Te,H),!0}for(ne=1,z=new Array(be-1);ne<be;ne++)z[ne-1]=arguments[ne];U.fn.apply(U.context,z)}else{var ke,He=U.length;for(ne=0;ne<He;ne++)switch(U[ne].once&&this.removeListener(k,U[ne].fn,void 0,!0),be){case 1:U[ne].fn.call(U[ne].context);break;case 2:U[ne].fn.call(U[ne].context,ve);break;case 3:U[ne].fn.call(U[ne].context,ve,Z);break;case 4:U[ne].fn.call(U[ne].context,ve,Z,le);break;default:if(!z)for(ke=1,z=new Array(be-1);ke<be;ke++)z[ke-1]=arguments[ke];U[ne].fn.apply(U[ne].context,z)}}return!0},w.prototype.on=function(k,ve,Z){return R(this,k,ve,Z,!1)},w.prototype.once=function(k,ve,Z){return R(this,k,ve,Z,!0)},w.prototype.removeListener=function(k,ve,Z,le){var Te=N?N+k:k;if(!this._events[Te])return this;if(!ve)return p(this,Te),this;var H=this._events[Te];if(H.fn)H.fn!==ve||le&&!H.once||Z&&H.context!==Z||p(this,Te);else{for(var ce=0,z=[],ne=H.length;ce<ne;ce++)(H[ce].fn!==ve||le&&!H[ce].once||Z&&H[ce].context!==Z)&&z.push(H[ce]);z.length?this._events[Te]=z.length===1?z[0]:z:p(this,Te)}return this},w.prototype.removeAllListeners=function(k){var ve;return k?(ve=N?N+k:k,this._events[ve]&&p(this,ve)):(this._events=new B,this._eventsCount=0),this},w.prototype.off=w.prototype.removeListener,w.prototype.addListener=w.prototype.on,w.prefixed=N,w.EventEmitter=w,fe.exports=w},945:function(fe){var re,N,B,$,R;re=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,N=/^(?=([^\/?#]*))\1([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,$=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(p,w,k){if(k=k||{},p=p.trim(),!(w=w.trim())){if(!k.alwaysNormalize)return p;var ve=R.parseURL(p);if(!ve)throw new Error("Error trying to parse base URL.");return ve.path=R.normalizePath(ve.path),R.buildURLFromParts(ve)}var Z=R.parseURL(w);if(!Z)throw new Error("Error trying to parse relative URL.");if(Z.scheme)return k.alwaysNormalize?(Z.path=R.normalizePath(Z.path),R.buildURLFromParts(Z)):w;var le=R.parseURL(p);if(!le)throw new Error("Error trying to parse base URL.");if(!le.netLoc&&le.path&&le.path[0]!=="/"){var Te=N.exec(le.path);le.netLoc=Te[1],le.path=Te[2]}le.netLoc&&!le.path&&(le.path="/");var H={scheme:le.scheme,netLoc:Z.netLoc,path:null,params:Z.params,query:Z.query,fragment:Z.fragment};if(!Z.netLoc&&(H.netLoc=le.netLoc,Z.path[0]!=="/"))if(Z.path){var ce=le.path,z=ce.substring(0,ce.lastIndexOf("/")+1)+Z.path;H.path=R.normalizePath(z)}else H.path=le.path,Z.params||(H.params=le.params,Z.query||(H.query=le.query));return H.path===null&&(H.path=k.alwaysNormalize?R.normalizePath(Z.path):Z.path),R.buildURLFromParts(H)},parseURL:function(p){var w=re.exec(p);return w?{scheme:w[1]||"",netLoc:w[2]||"",path:w[3]||"",params:w[4]||"",query:w[5]||"",fragment:w[6]||""}:null},normalizePath:function(p){for(p=p.split("").reverse().join("").replace(B,"");p.length!==(p=p.replace($,"")).length;);return p.split("").reverse().join("")},buildURLFromParts:function(p){return p.scheme+p.netLoc+p.path+p.params+p.query+p.fragment}},fe.exports=R}},te={};function Se(fe){var re=te[fe];if(re!==void 0)return re.exports;var N=te[fe]={exports:{}};return X[fe].call(N.exports,N,N.exports,Se),N.exports}Se.m=X,Se.n=fe=>{var re=fe&&fe.__esModule?()=>fe.default:()=>fe;return Se.d(re,{a:re}),re},Se.d=(fe,re)=>{for(var N in re)Se.o(re,N)&&!Se.o(fe,N)&&Object.defineProperty(fe,N,{enumerable:!0,get:re[N]})},Se.o=(fe,re)=>Object.prototype.hasOwnProperty.call(fe,re),Se.r=fe=>{typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(fe,"__esModule",{value:!0})};var De=Se(76);return De.default})())});var $i=ea(ta());var ia=ea(ra()),Wa=ia.default,lr=Wa;var hi=class extends Error{constructor(Se,De=hi.MEDIA_ERR_CUSTOM,fe){var re;super(Se);this.name="MediaError",this.code=De,this.fatal=fe!=null?fe:De>=hi.MEDIA_ERR_NETWORK&&De<=hi.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(re=hi.defaultMessages[this.code])!=null?re:"")}},ur=hi;ur.MEDIA_ERR_ABORTED=1,ur.MEDIA_ERR_NETWORK=2,ur.MEDIA_ERR_DECODE=3,ur.MEDIA_ERR_SRC_NOT_SUPPORTED=4,ur.MEDIA_ERR_ENCRYPTED=5,ur.MEDIA_ERR_CUSTOM=100,ur.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var Xa=X=>X==null,Dn=(X,te)=>Xa(te)?!1:X in te,Xi={ANY:"any",MUTED:"muted"},Ii={VOD:"on-demand",ON_DEMAND:"on-demand",LIVE:"live",LL_LIVE:"ll-live",DVR:"live:dvr",LL_DVR:"ll-live:dvr"},Rn={MSE:"mse",NATIVE:"native"},zi={HEADER:"header",QUERY:"query",NONE:"none"},vs=Object.values(zi),Vr={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Qi={HLS:Vr.M3U8},ps=Object.keys(Qi),gs=[...Object.values(Vr),"hls","HLS"];var Rr=(X,te,Se,De,fe=X)=>{fe.addEventListener(te,Se,De),X.addEventListener("teardown",()=>{fe.removeEventListener(te,Se)},{once:!0})};function na(X,te,Se){te&&Se>te&&(Se=te);for(let De=0;De<X.length;De++)if(X.start(De)<=Se&&X.end(De)>=Se)return!0;return!1}var aa=X=>{let te=X.indexOf("?");if(te<0)return[X];let Se=X.slice(0,te),De=X.slice(te);return[Se,De]},In=X=>{let te=X.type;if(te){let De=te.toUpperCase();return Dn(De,Qi)?Qi[De]:te}let{src:Se}=X;return Se?za(Se):""},za=X=>{let te="";try{te=new URL(X).pathname}catch{console.error("invalid url")}let Se=te.lastIndexOf(".");if(Se<0)return"";let fe=te.slice(Se+1).toUpperCase();return Dn(fe,Vr)?Vr[fe]:""};var Qa=Object.values(Xi),sa=X=>typeof X=="boolean"||typeof X=="string"&&Qa.includes(X),oa=({autoplay:X},te,Se)=>{let De=!1,fe=!1,re=sa(X)?X:!!X,N=()=>{De||Rr(te,"playing",()=>{De=!0},{once:!0})};if(N(),Rr(te,"loadstart",()=>{De=!1,N(),Pn(te,re)},{once:!0}),Rr(te,"loadstart",()=>{Se||(fe=!Number.isFinite(te.duration)),Pn(te,re)},{once:!0}),Se&&Se.once(lr.Events.LEVEL_LOADED,($,R)=>{var p;fe=(p=R.details.live)!=null?p:!1}),!re){let $=()=>{!fe||(Se!=null&&Se.liveSyncPosition?te.currentTime=Se.liveSyncPosition:Number.isFinite(te.seekable.end(0))&&(te.currentTime=te.seekable.end(0)))};Se&&Rr(te,"play",()=>{te.preload==="metadata"?Se.once(lr.Events.LEVEL_UPDATED,$):$()},{once:!0})}return $=>{De||(re=sa($)?$:!!$,Pn(te,re))}},Pn=(X,te)=>{if(!te)return;let Se=X.muted,De=()=>X.muted=Se;switch(te){case Xi.ANY:X.play().catch(()=>{X.muted=!0,X.play().catch(De)});break;case Xi.MUTED:X.muted=!0,X.play().catch(De);break;default:X.play().catch(()=>{});break}};var la=({preload:X,src:te},Se,De)=>{let fe=w=>{w!=null&&["","none","metadata","auto"].includes(w)?Se.setAttribute("preload",w):Se.removeAttribute("preload")};if(!De)return fe(X),fe;let re=!1,N=!1,B=De.config.maxBufferLength,$=De.config.maxBufferSize,R=w=>{fe(w);let k=w!=null?w:Se.preload;N||k==="none"||(k==="metadata"?(De.config.maxBufferLength=1,De.config.maxBufferSize=1):(De.config.maxBufferLength=B,De.config.maxBufferSize=$),p())},p=()=>{!re&&te&&(re=!0,De.loadSource(te))};return Rr(Se,"play",()=>{N=!0,De.config.maxBufferLength=B,De.config.maxBufferSize=$,p()},{once:!0}),R(X),R};function ua(X,te){te.on(lr.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(fe,{tracks:re})=>{re.forEach(N=>{var R;let B=(R=N.subtitleTrack)!=null?R:N.closedCaptions,$=te.subtitleTracks.findIndex(({lang:p,name:w,type:k})=>p==(B==null?void 0:B.lang)&&w===N.label&&k.toLowerCase()===N.kind);Cn(X,N.kind,N.label,B==null?void 0:B.lang,`${N.kind}${$}`)})});let Se=()=>{var N;if(!te.subtitleTracks.length)return;let fe=Array.from(X.textTracks).find(B=>B.id&&B.mode==="showing"&&["subtitles","captions"].includes(B.kind)),re=`${(N=te.subtitleTracks[te.subtitleTrack])==null?void 0:N.type.toLowerCase()}${te.subtitleTrack}`;if(fe&&(te.subtitleTrack<0||(fe==null?void 0:fe.id)!==re)){let B=te.subtitleTracks.findIndex(({lang:$,name:R,type:p})=>$==fe.language&&R===fe.label&&p.toLowerCase()===fe.kind);te.subtitleTrack=B}fe&&(fe==null?void 0:fe.id)===re&&fe.cues&&Array.from(fe.cues).forEach(B=>{fe.addCue(B)})};X.textTracks.addEventListener("change",Se),te.on(lr.Events.CUES_PARSED,(fe,{track:re,cues:N})=>{let B=X.textTracks.getTrackById(re);if(!B)return;let $=B.mode==="disabled";$&&(B.mode="hidden"),N.forEach(R=>{var p;(p=B.cues)!=null&&p.getCueById(R.id)||B.addCue(R)}),$&&(B.mode="disabled")}),te.once(lr.Events.DESTROYING,()=>{X.textTracks.removeEventListener("change",Se),X.querySelectorAll("track[data-removeondestroy]").forEach(re=>{re.remove()})});let De=()=>{Array.from(X.textTracks).forEach(fe=>{var re,N;if(!["subtitles","caption"].includes(fe.kind)&&fe.label==="thumbnails"){if(!((re=fe.cues)!=null&&re.length)){let B=X.querySelector('track[label="thumbnails"]'),$=(N=B==null?void 0:B.getAttribute("src"))!=null?N:"";B==null||B.removeAttribute("src"),setTimeout(()=>{B==null||B.setAttribute("src",$)},0)}fe.mode!=="hidden"&&(fe.mode="hidden")}})};te.once(lr.Events.MANIFEST_LOADED,De),te.once(lr.Events.MEDIA_ATTACHED,De)}function Cn(X,te,Se,De,fe){let re=document.createElement("track");return re.kind=te,re.label=Se,De&&(re.srclang=De),fe&&(re.id=fe),re.track.mode=["subtitles","captions"].includes(te)?"disabled":"hidden",re.setAttribute("data-removeondestroy",""),X.append(re),re.track}function Ja(X,te){let Se=Array.prototype.find.call(X.querySelectorAll("track"),De=>De.track===te);Se==null||Se.remove()}var Pi="cuepoints",xn=Object.freeze({label:Pi}),Ji=(X,{label:te=Pi}=xn)=>{var Se;return(Se=Array.from(X.querySelectorAll("track")).find(De=>De.track.label===te&&De.track.kind==="metadata"))==null?void 0:Se.track};async function da(X,te,Se=xn){let De=Ji(X,Se);if(!De){let{label:fe=Pi}=Se;De=Cn(X,"metadata",fe),De.mode="hidden",await new Promise(re=>setTimeout(()=>re(void 0),0))}return De.mode!=="hidden"&&(De.mode="hidden"),[...te].sort(({time:fe},{time:re})=>re-fe).forEach(({time:fe,value:re})=>{var w,k;let N=Array.prototype.findIndex.call(De==null?void 0:De.cues,ve=>ve.startTime>=fe),B=(w=De==null?void 0:De.cues)==null?void 0:w[N],$=B?B.startTime:Number.isFinite(X.duration)?X.duration:Number.MAX_SAFE_INTEGER,R=(k=De==null?void 0:De.cues)==null?void 0:k[N-1];R&&(R.endTime=fe);let p=new VTTCue(fe,$,JSON.stringify(re!=null?re:null));De.addCue(p)}),De}var ca=X=>({time:X.startTime,value:JSON.parse(X.text)});function $a(X,te={label:Pi}){let Se=Ji(X,te);return Se!=null&&Se.cues?Array.from(Se.cues,De=>ca(De)):[]}function ha(X,te={label:Pi}){var De;let Se=Ji(X,te);if(!!((De=Se==null?void 0:Se.activeCues)!=null&&De.length))return ca(Se.activeCues[0])}async function fa(X,te=xn){return new Promise(Se=>{Rr(X,"loadstart",async()=>{let De=await da(X,[],te);Rr(X,"cuechange",()=>{let fe=ha(X);if(fe){let re=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:fe});X.dispatchEvent(re)}},{},De),Se(De)})})}var va,pa,Za=(pa=(va=globalThis==null?void 0:globalThis.navigator)==null?void 0:va.userAgent)!=null?pa:"",es=Za.toLowerCase().indexOf("android")!==-1,fi=new WeakMap,ya="mux.com",ga,ma,Ea=(ma=(ga=lr).isSupported)==null?void 0:ma.call(ga),ts=es,Hs=()=>$i.default.utils.now(),rs=$i.default.utils.generateUUID,Gs=(X,{domain:te=ya}={})=>{if(!X)return;let[Se,De=""]=aa(X);return`https://stream.${te}/${Se}.m3u8${De}`},is=X=>{if(!X)return;let[te]=X.split("?");return te||void 0},ns=X=>{if(!X||!X.startsWith("https://stream."))return;let[te]=new URL(X).pathname.slice(1).split(".m3u8");return te||void 0},as=X=>{var te,Se,De;return(te=X==null?void 0:X.metadata)!=null&&te.video_id?X.metadata.video_id:ba(X)&&(De=(Se=is(X.playbackId))!=null?Se:ns(X.src))!=null?De:X.src},js=X=>{var te;return(te=fi.get(X))==null?void 0:te.error},Ks=(X,te,Se)=>{ss(te,Se);let{metadata:De={}}=X,{view_session_id:fe=rs()}=De,re=as(X);De.view_session_id=fe,De.video_id=re,X.metadata=De,fi.set(te,{});let N=os(X,te);us(X,te,N),ds(X,te,N),fa(te);let B=oa(X,te,N),$=la(X,te,N);return{engine:N,setAutoplay:B,setPreload:$}},ss=(X,te)=>{let Se=te==null?void 0:te.engine;Se&&(Se.detachMedia(),Se.destroy()),(X==null?void 0:X.mux)&&!X.mux.deleted&&(X.mux.destroy(),delete X.mux),X&&(X.removeAttribute("src"),X.load(),X.removeEventListener("error",Sa),X.removeEventListener("error",On),X.removeEventListener("durationchange",_a),fi.delete(X),X.dispatchEvent(new Event("teardown")))};function Ta(X,te){var R;let Se=In(X);if(!(Se===Vr.M3U8))return!0;let fe=!Se||((R=te.canPlayType(Se))!=null?R:!0),{preferPlayback:re}=X,N=re===Rn.MSE,B=re===Rn.NATIVE;return fe&&(B||!(Ea&&(N||ts)))}var os=(X,te)=>{let{debug:Se,streamType:De,startTime:fe=-1,metadata:re,preferCmcd:N}=X,$=In(X)===Vr.M3U8,R=Ta(X,te);if($&&!R&&Ea){let p={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0},w=ls(De),k=N!==zi.NONE?{useHeaders:N===zi.HEADER,sessionId:re.view_session_id,contentId:re.video_id}:void 0;return new lr({debug:Se,startPosition:fe,cmcd:k,...p,...w})}},ls=X=>[Ii.LIVE,Ii.DVR].includes(X)?{backBufferLength:8}:[Ii.LL_LIVE,Ii.LL_DVR].includes(X)?{backBufferLength:4,maxFragLookUpTolerance:.001}:{},ba=({playbackId:X,src:te,customDomain:Se})=>{if(X)return!0;if(typeof te!="string")return!1;let De=window==null?void 0:window.location.href,fe=new URL(te,De).hostname.toLocaleLowerCase();return fe.includes(ya)||!!Se&&fe.includes(Se.toLocaleLowerCase())},us=(X,te,Se)=>{var re;let{envKey:De}=X,fe=ba(X);if(De||fe){let{playerInitTime:N,playerSoftwareName:B,playerSoftwareVersion:$,beaconCollectionDomain:R,debug:p,disableCookies:w}=X,k={...X.metadata,video_title:((re=X==null?void 0:X.metadata)==null?void 0:re.video_title)||void 0},ve=Z=>typeof Z.player_error_code=="string"?!1:typeof X.errorTranslator=="function"?X.errorTranslator(Z):Z;$i.default.monitor(te,{debug:p,beaconCollectionDomain:R,hlsjs:Se,Hls:Se?lr:void 0,automaticErrorTracking:!1,errorTranslator:ve,disableCookies:w,data:{...De?{env_key:De}:{},player_software_name:B,player_software:B,player_software_version:$,player_init_time:N,...k}})}},ds=(X,te,Se)=>{var re;let De=Ta(X,te),{src:fe}=X;te&&De?(typeof fe=="string"?(te.setAttribute("src",fe),X.startTime&&(((re=fi.get(te))!=null?re:{}).startTime=X.startTime,te.addEventListener("durationchange",_a,{once:!0}))):te.removeAttribute("src"),te.addEventListener("error",Sa),te.addEventListener("error",On)):Se&&fe?(Se.on(lr.Events.ERROR,(N,B)=>{let $={[lr.ErrorTypes.NETWORK_ERROR]:ur.MEDIA_ERR_NETWORK,[lr.ErrorTypes.MEDIA_ERROR]:ur.MEDIA_ERR_DECODE},R=new ur("",$[B.type]);R.fatal=B.fatal,R.data=B,te.dispatchEvent(new CustomEvent("error",{detail:R}))}),te.addEventListener("error",On),ua(te,Se),Se.attachMedia(te)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function _a(X){var De;let te=X.target,Se=(De=fi.get(te))==null?void 0:De.startTime;if(!!Se&&na(te.seekable,te.duration,Se)){let fe=te.preload==="auto";fe&&(te.preload="none"),te.currentTime=Se,fe&&(te.preload="auto")}}async function Sa(X){if(!X.isTrusted)return;X.stopImmediatePropagation();let te=X.target;if(!(te!=null&&te.error))return;let{message:Se,code:De}=te.error,fe=new ur(Se,De);if(te.src&&(De!==ur.MEDIA_ERR_DECODE||De!==void 0))try{let{status:re}=await fetch(te.src);fe.data={response:{code:re}}}catch{}te.dispatchEvent(new CustomEvent("error",{detail:fe}))}function On(X){var De,fe;if(!(X instanceof CustomEvent)||!(X.detail instanceof ur))return;let te=X.target,Se=X.detail;!Se||!Se.fatal||(((De=fi.get(te))!=null?De:{}).error=Se,(fe=te.mux)==null||fe.emit("error",{player_error_code:Se.code,player_error_message:Se.message}))}var export_mux=$i.default;export{Xi as AutoplayTypes,vs as CmcdTypeValues,zi as CmcdTypes,Vr as ExtensionMimeTypeMap,lr as Hls,ur as MediaError,Qi as MimeTypeShorthandMap,Rn as PlaybackTypes,Ii as StreamTypes,da as addCuePoints,Cn as addTextTrack,gs as allMediaTypes,Hs as generatePlayerInitTime,rs as generateUUID,ha as getActiveCuePoint,$a as getCuePoints,Ji as getCuePointsTrack,js as getError,ls as getStreamTypeConfig,Ks as initialize,Dn as isKeyOf,ba as isMuxVideoSrc,ds as loadMedia,export_mux as mux,Ja as removeTextTrack,fa as setupCuePoints,os as setupHls,us as setupMux,ps as shorthandKeys,ss as teardown,Gs as toMuxVideoURL};
|
|
32
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qn(d,o){(o==null||o>d.length)&&(o=d.length);for(var e=0,t=new Array(o);e<o;e++)t[e]=d[e];return t}function Vi(){return Vi=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},Vi.apply(this,arguments)}(function(d){d.MANIFEST="m",d.AUDIO="a",d.VIDEO="v",d.MUXED="av",d.INIT="i",d.CAPTION="c",d.TIMED_TEXT="tt",d.KEY="k",d.OTHER="o"})(or||(or={})),function(d){d.DASH="d",d.HLS="h",d.SMOOTH="s",d.OTHER="o"}(En||(En={})),function(d){d.VOD="v",d.LIVE="l"}(Hn||(Hn={}));var Ca=function(){function d(e){var t=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(a){try{t.apply(a,{ot:or.MANIFEST,su:!t.initialized})}catch(r){k.logger.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=function(a){try{var r=a.frag,s=t.hls.levels[r.level],l=t.getObjectType(r),u={d:1e3*r.duration,ot:l};l!==or.VIDEO&&l!==or.AUDIO&&l!=or.MUXED||(u.br=s.bitrate/1e3,u.tb=t.getTopBandwidth(l)/1e3,u.bl=t.getBufferLength(l)),t.apply(a,u)}catch(c){k.logger.warn("Could not generate segment CMCD data.",c)}},this.hls=e;var i=this.config=e.config,n=i.cmcd;n!=null&&(i.pLoader=this.createPlaylistLoader(),i.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||d.uuid(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.registerListeners())}var o=d.prototype;return o.registerListeners=function(){var e=this.hls;e.on(p.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.on(p.Events.BUFFER_CREATED,this.onBufferCreated,this)},o.unregisterListeners=function(){var e=this.hls;e.off(p.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.Events.MEDIA_DETACHED,this.onMediaDetached,this),e.off(p.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},o.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},o.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},o.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},o.onBufferCreated=function(e,t){var i,n;this.audioBuffer=(i=t.tracks.audio)===null||i===void 0?void 0:i.buffer,this.videoBuffer=(n=t.tracks.video)===null||n===void 0?void 0:n.buffer},o.createData=function(){var e;return{v:1,sf:En.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)===null||e===void 0?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},o.apply=function(e,t){t===void 0&&(t={}),Vi(t,this.createData());var i=t.ot===or.INIT||t.ot===or.VIDEO||t.ot===or.MUXED;if(this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering),this.useHeaders){var n=d.toHeaders(t);if(!Object.keys(n).length)return;e.headers||(e.headers={}),Vi(e.headers,n)}else{var a=d.toQuery(t);if(!a)return;e.url=d.appendQueryToUri(e.url,a)}},o.getObjectType=function(e){var t=e.type;return t==="subtitle"?or.TIMED_TEXT:e.sn==="initSegment"?or.INIT:t==="audio"?or.AUDIO:t==="main"?this.hls.audioTracks.length?or.VIDEO:or.MUXED:void 0},o.getTopBandwidth=function(e){var t,i=0,n=this.hls;if(e===or.AUDIO)t=n.audioTracks;else{var a=n.maxAutoLevel,r=a>-1?a+1:n.levels.length;t=n.levels.slice(0,r)}for(var s,l=Kn(t);!(s=l()).done;){var u=s.value;u.bitrate>i&&(i=u.bitrate)}return i>0?i:NaN},o.getBufferLength=function(e){var t=this.hls.media,i=e===or.AUDIO?this.audioBuffer:this.videoBuffer;return i&&t?1e3*Mt.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len:NaN},o.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,i=e||this.config.loader;return function(){function n(r){this.loader=void 0,this.loader=new i(r)}var a=n.prototype;return a.destroy=function(){this.loader.destroy()},a.abort=function(){this.loader.abort()},a.load=function(r,s,l){t(r),this.loader.load(r,s,l)},jn(n,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),n}()},o.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,i=e||this.config.loader;return function(){function n(r){this.loader=void 0,this.loader=new i(r)}var a=n.prototype;return a.destroy=function(){this.loader.destroy()},a.abort=function(){this.loader.abort()},a.load=function(r,s,l){t(r),this.loader.load(r,s,l)},jn(n,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),n}()},d.uuid=function(){var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)},d.serialize=function(e){for(var t,i=[],n=function(S){return!Number.isNaN(S)&&S!=null&&S!==""&&S!==!1},a=function(S){return Math.round(S)},r=function(S){return 100*a(S/100)},s={br:a,d:a,bl:r,dl:r,mtp:r,nor:function(S){return encodeURIComponent(S)},rtp:r,tb:a},l=Kn(Object.keys(e||{}).sort());!(t=l()).done;){var u=t.value,c=e[u];if(n(c)&&!(u==="v"&&c===1||u=="pr"&&c===1)){var v=s[u];v&&(c=v(c));var m,_=typeof c;m=u==="ot"||u==="sf"||u==="st"?u+"="+c:_==="boolean"?u:_==="number"?u+"="+c:u+"="+JSON.stringify(c),i.push(m)}}return i.join(",")},d.toHeaders=function(e){for(var t={},i=["Object","Request","Session","Status"],n=[{},{},{},{}],a={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},r=0,s=Object.keys(e);r<s.length;r++){var l=s[r];n[a[l]!=null?a[l]:1][l]=e[l]}for(var u=0;u<n.length;u++){var c=d.serialize(n[u]);c&&(t["CMCD-"+i[u]]=c)}return t},d.toQuery=function(e){return"CMCD="+encodeURIComponent(d.serialize(e))},d.appendQueryToUri=function(e,t){if(!t)return e;var i=e.includes("?")?"&":"?";return""+e+i+t},d}(),Vn=N(408),xa=/^age:\s*[\d.]+\s*$/m;let Yn=function(){function d(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=e?e.xhrSetup:null,this.stats=new Vn.LoadStats,this.retryDelay=0}var o=d.prototype;return o.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},o.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))},o.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},o.load=function(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.retryDelay=t.retryDelay,this.loadInternal()},o.loadInternal=function(){var e=this.config,t=this.context;if(e){var i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0;var a=this.xhrSetup;try{if(a)try{a(i,t.url)}catch{i.open("GET",t.url,!0),a(i,t.url)}i.readyState||i.open("GET",t.url,!0);var r=this.context.headers;if(r)for(var s in r)i.setRequestHeader(s,r[s])}catch(l){return void this.callbacks.onError({code:i.status,text:l.message},t,i)}t.rangeEnd&&i.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),i.onreadystatechange=this.readystatechange.bind(this),i.onprogress=this.loadprogress.bind(this),i.responseType=t.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),i.send()}},o.readystatechange=function(){var e=this.context,t=this.loader,i=this.stats;if(e&&t){var n=t.readyState,a=this.config;if(!i.aborted&&n>=2)if(self.clearTimeout(this.requestTimeout),i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start)),n===4){t.onreadystatechange=null,t.onprogress=null;var r=t.status,s=t.responseType==="arraybuffer";if(r>=200&&r<300&&(s&&t.response||t.responseText!==null)){var l,u;if(i.loading.end=Math.max(self.performance.now(),i.loading.first),u=s?(l=t.response).byteLength:(l=t.responseText).length,i.loaded=i.total=u,!this.callbacks)return;var c=this.callbacks.onProgress;if(c&&c(i,e,l,t),!this.callbacks)return;var v={url:t.responseURL,data:l};this.callbacks.onSuccess(v,i,e,t)}else i.retry>=a.maxRetry||r>=400&&r<499?(k.logger.error(r+" while loading "+e.url),this.callbacks.onError({code:r,text:t.statusText},e,t)):(k.logger.warn(r+" while loading "+e.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),i.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout)}},o.loadtimeout=function(){k.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},o.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},o.getCacheAge=function(){var e=null;if(this.loader&&xa.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},d}();function Tn(d){var o=typeof Map=="function"?new Map:void 0;return Tn=function(e){if(e===null||(t=e,Function.toString.call(t).indexOf("[native code]")===-1))return e;var t;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(o!==void 0){if(o.has(e))return o.get(e);o.set(e,i)}function i(){return bn(e,arguments,_n(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Li(i,e)},Tn(d)}function bn(d,o,e){return bn=Oa()?Reflect.construct.bind():function(t,i,n){var a=[null];a.push.apply(a,i);var r=new(Function.bind.apply(t,a));return n&&Li(r,n.prototype),r},bn.apply(null,arguments)}function Oa(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Li(d,o){return Li=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Li(d,o)}function _n(d){return _n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},_n(d)}function Sn(){return Sn=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},Sn.apply(this,arguments)}var Ma=function(){function d(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Fa,this.controller=new self.AbortController,this.stats=new Vn.LoadStats}var o=d.prototype;return o.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},o.abortInternal=function(){var e=this.response;e&&e.ok||(this.stats.aborted=!0,this.controller.abort())},o.abort=function(){var e;this.abortInternal(),(e=this.callbacks)!==null&&e!==void 0&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},o.load=function(e,t,i){var n=this,a=this.stats;if(a.loading.start)throw new Error("Loader can only be used once.");a.loading.start=self.performance.now();var r=function(c,v){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:v,headers:new self.Headers(Sn({},c.headers))};return c.rangeEnd&&m.headers.set("Range","bytes="+c.rangeStart+"-"+String(c.rangeEnd-1)),m}(e,this.controller.signal),s=i.onProgress,l=e.responseType==="arraybuffer",u=l?"byteLength":"length";this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){n.abortInternal(),i.onTimeout(a,e,n.response)},t.timeout),self.fetch(this.request).then(function(c){if(n.response=n.loader=c,!c.ok){var v=c.status,m=c.statusText;throw new Na(m||"fetch, bad network response",v,c)}return a.loading.first=Math.max(self.performance.now(),a.loading.start),a.total=parseInt(c.headers.get("Content-Length")||"0"),s&&(0,R.isFiniteNumber)(t.highWaterMark)?n.loadProgressively(c,a,e,t.highWaterMark,s):l?c.arrayBuffer():c.text()}).then(function(c){var v=n.response;self.clearTimeout(n.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first);var m=c[u];m&&(a.loaded=a.total=m);var _={url:v.url,data:c};s&&!(0,R.isFiniteNumber)(t.highWaterMark)&&s(a,e,c,v),i.onSuccess(_,a,e,v)}).catch(function(c){if(self.clearTimeout(n.requestTimeout),!a.aborted){var v=c&&c.code||0,m=c?c.message:null;i.onError({code:v,text:m},e,c?c.details:null)}})},o.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},o.loadProgressively=function(e,t,i,n,a){n===void 0&&(n=0);var r=new Hi,s=e.body.getReader();return function l(){return s.read().then(function(u){if(u.done)return r.dataLength&&a(t,i,r.flush(),e),Promise.resolve(new ArrayBuffer(0));var c=u.value,v=c.length;return t.loaded+=v,v<n||r.dataLength?(r.push(c),r.dataLength>=n&&a(t,i,r.flush(),e)):a(t,i,c,e),l()}).catch(function(){return Promise.reject()})}()},d}();function Fa(d,o){return new self.Request(d.url,o)}var Na=function(d){var o,e;function t(i,n,a){var r;return(r=d.call(this,i)||this).code=void 0,r.details=void 0,r.code=n,r.details=a,r}return e=d,(o=t).prototype=Object.create(e.prototype),o.prototype.constructor=o,Li(o,e),t}(Tn(Error));let Wn=Ma;var Ua=/\s/;function kn(){return kn=Object.assign?Object.assign.bind():function(d){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])}return d},kn.apply(this,arguments)}function Xn(d,o){var e=Object.keys(d);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(d);o&&(t=t.filter(function(i){return Object.getOwnPropertyDescriptor(d,i).enumerable})),e.push.apply(e,t)}return e}function zn(d){for(var o=1;o<arguments.length;o++){var e=arguments[o]!=null?arguments[o]:{};o%2?Xn(Object(e),!0).forEach(function(t){Ba(d,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(e)):Xn(Object(e)).forEach(function(t){Object.defineProperty(d,t,Object.getOwnPropertyDescriptor(e,t))})}return d}function Ba(d,o,e){return(o=function(t){var i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t,"string");return typeof i=="symbol"?i:String(i)}(o))in d?Object.defineProperty(d,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):d[o]=e,d}var Ha=zn(zn({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Yn,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:an,bufferController:hn,capLevelController:Da,fpsController:Ra,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:ye,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0},{cueHandler:{newCue:function(d,o,e,t){for(var i,n,a,r,s,l=[],u=self.VTTCue||self.TextTrackCue,c=0;c<t.rows.length;c++)if(a=!0,r=0,s="",!(i=t.rows[c]).isEmpty()){for(var v=0;v<i.chars.length;v++)Ua.test(i.chars[v].uchar)&&a?r++:(s+=i.chars[v].uchar,a=!1);i.cueStartTime=o,o===e&&(e+=1e-4),r>=16?r--:r++;var m=Kt(s.trim()),_=sr(o,e,m);d&&d.cues&&d.cues.getCueById(_)||((n=new u(o,e,m)).id=_,n.line=c+1,n.align="left",n.position=10+Math.min(80,10*Math.floor(8*r/32)),l.push(n))}return d&&l.length&&(l.sort(function(S,x){return S.line==="auto"||x.line==="auto"?0:S.line>8&&x.line>8?x.line-S.line:S.line-x.line}),l.forEach(function(S){return yt(d,S)})),l}},enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:ln,subtitleTrackController:cn,timelineController:La,audioStreamController:Ti,audioTrackController:sn,emeController:Pa,cmcdController:Ca});function Qn(d,o){for(var e=0;e<o.length;e++){var t=o[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(d,typeof(i=function(n,a){if(typeof n!="object"||n===null)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var s=r.call(n,a);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(t.key,"string"))=="symbol"?i:String(i),t)}var i}var Jn=function(){function d(n){n===void 0&&(n={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new gi.EventEmitter,this._autoLevelCapping=void 0,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var a=this.config=function(Ee,Ge){if((Ge.liveSyncDurationCount||Ge.liveMaxLatencyDurationCount)&&(Ge.liveSyncDuration||Ge.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(Ge.liveMaxLatencyDurationCount!==void 0&&(Ge.liveSyncDurationCount===void 0||Ge.liveMaxLatencyDurationCount<=Ge.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(Ge.liveMaxLatencyDuration!==void 0&&(Ge.liveSyncDuration===void 0||Ge.liveMaxLatencyDuration<=Ge.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return kn({},Ee,Ge)}(d.DefaultConfig,n);this.userConfig=n,(0,k.enableLogs)(a.debug,"Hls instance"),this._autoLevelCapping=-1,a.progressive&&function(Ee){var Ge=Ee.loader;Ge!==Wn&&Ge!==Yn?(k.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),Ee.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(Ee.loader=Wn,Ee.progressive=!0,Ee.enableSoftwareAES=!0,k.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}(a);var r=a.abrController,s=a.bufferController,l=a.capLevelController,u=a.fpsController,c=this.abrController=new r(this),v=this.bufferController=new s(this),m=this.capLevelController=new l(this),_=new u(this),S=new Ye(this),x=new Rt(this),I=this.levelController=new ot(this),j=new bt(this),ae=new hr(this.config),me=this.streamController=new tn(this,j,ae);m.setStreamController(me),_.setStreamController(me);var de=[S,I,me];this.networkControllers=de;var _e=[c,v,m,_,x,j];this.audioTrackController=this.createController(a.audioTrackController,de);var Ke=a.audioStreamController;Ke&&de.push(new Ke(this,j,ae)),this.subtitleTrackController=this.createController(a.subtitleTrackController,de);var ze=a.subtitleStreamController;ze&&de.push(new ze(this,j,ae)),this.createController(a.timelineController,_e),ae.emeController=this.emeController=this.createController(a.emeController,_e),this.cmcdController=this.createController(a.cmcdController,_e),this.latencyController=this.createController(jt,_e),this.coreComponents=_e}d.isSupported=function(){return function(){var n=ni();if(!n)return!1;var a=ai(),r=n&&typeof n.isTypeSupported=="function"&&n.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),s=!a||a.prototype&&typeof a.prototype.appendBuffer=="function"&&typeof a.prototype.remove=="function";return!!r&&!!s}()};var o,e,t,i=d.prototype;return i.createController=function(n,a){if(n){var r=new n(this);return a&&a.push(r),r}return null},i.on=function(n,a,r){r===void 0&&(r=this),this._emitter.on(n,a,r)},i.once=function(n,a,r){r===void 0&&(r=this),this._emitter.once(n,a,r)},i.removeAllListeners=function(n){this._emitter.removeAllListeners(n)},i.off=function(n,a,r,s){r===void 0&&(r=this),this._emitter.off(n,a,r,s)},i.listeners=function(n){return this._emitter.listeners(n)},i.emit=function(n,a,r){return this._emitter.emit(n,a,r)},i.trigger=function(n,a){if(this.config.debug)return this.emit(n,n,a);try{return this.emit(n,n,a)}catch(r){k.logger.error("An internal error happened while handling event "+n+'. Error message: "'+r.message+'". Here is a stacktrace:',r),this.trigger(p.Events.ERROR,{type:w.ErrorTypes.OTHER_ERROR,details:w.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:n,error:r})}return!1},i.listenerCount=function(n){return this._emitter.listenerCount(n)},i.destroy=function(){k.logger.log("destroy"),this.trigger(p.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(n){return n.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(n){return n.destroy()}),this.coreComponents.length=0},i.attachMedia=function(n){k.logger.log("attachMedia"),this._media=n,this.trigger(p.Events.MEDIA_ATTACHING,{media:n})},i.detachMedia=function(){k.logger.log("detachMedia"),this.trigger(p.Events.MEDIA_DETACHING,void 0),this._media=null},i.loadSource=function(n){this.stopLoad();var a=this.media,r=this.url,s=this.url=$.buildAbsoluteURL(self.location.href,n,{alwaysNormalize:!0});k.logger.log("loadSource:"+s),a&&r&&r!==s&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(a)),this.trigger(p.Events.MANIFEST_LOADING,{url:n})},i.startLoad=function(n){n===void 0&&(n=-1),k.logger.log("startLoad("+n+")"),this.networkControllers.forEach(function(a){a.startLoad(n)})},i.stopLoad=function(){k.logger.log("stopLoad"),this.networkControllers.forEach(function(n){n.stopLoad()})},i.swapAudioCodec=function(){k.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},i.recoverMediaError=function(){k.logger.log("recoverMediaError");var n=this._media;this.detachMedia(),n&&this.attachMedia(n)},i.removeLevel=function(n,a){a===void 0&&(a=0),this.levelController.removeLevel(n,a)},o=d,t=[{key:"version",get:function(){return"1.3.1"}},{key:"Events",get:function(){return p.Events}},{key:"ErrorTypes",get:function(){return w.ErrorTypes}},{key:"ErrorDetails",get:function(){return w.ErrorDetails}},{key:"DefaultConfig",get:function(){return d.defaultConfig?d.defaultConfig:Ha},set:function(n){d.defaultConfig=n}}],(e=[{key:"levels",get:function(){return this.levelController.levels||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(n){k.logger.log("set currentLevel:"+n),this.loadLevel=n,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(n){k.logger.log("set nextLevel:"+n),this.levelController.manualLevel=n,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(n){k.logger.log("set loadLevel:"+n),this.levelController.manualLevel=n}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(n){this.levelController.nextLoadLevel=n}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(n){k.logger.log("set firstLevel:"+n),this.levelController.firstLevel=n}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(n){k.logger.log("set startLevel:"+n),n!==-1&&(n=Math.max(n,this.minAutoLevel)),this.levelController.startLevel=n}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(n){var a=!!n;a!==this.config.capLevelToPlayerSize&&(a?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=a)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(n){this._autoLevelCapping!==n&&(k.logger.log("set autoLevelCapping:"+n),this._autoLevelCapping=n)}},{key:"bandwidthEstimate",get:function(){var n=this.abrController.bwEstimator;return n?n.getEstimate():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(n){dr.indexOf(n)>-1&&(this._maxHdcpLevel=n)}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var n=this.levels,a=this.config.minAutoBitrate;if(!n)return 0;for(var r=n.length,s=0;s<r;s++)if(n[s].maxBitrate>=a)return s;return 0}},{key:"maxAutoLevel",get:function(){var n,a=this.levels,r=this.autoLevelCapping,s=this.maxHdcpLevel;if(n=r===-1&&a&&a.length?a.length-1:r,s)for(var l=n;l--;){var u=a[l].attrs["HDCP-LEVEL"];if(u&&u<=s)return l}return n}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(n){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,n)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"audioTracks",get:function(){var n=this.audioTrackController;return n?n.audioTracks:[]}},{key:"audioTrack",get:function(){var n=this.audioTrackController;return n?n.audioTrack:-1},set:function(n){var a=this.audioTrackController;a&&(a.audioTrack=n)}},{key:"subtitleTracks",get:function(){var n=this.subtitleTrackController;return n?n.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var n=this.subtitleTrackController;return n?n.subtitleTrack:-1},set:function(n){var a=this.subtitleTrackController;a&&(a.subtitleTrack=n)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var n=this.subtitleTrackController;return!!n&&n.subtitleDisplay},set:function(n){var a=this.subtitleTrackController;a&&(a.subtitleDisplay=n)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(n){this.config.lowLatencyMode=n}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}])&&Qn(o.prototype,e),t&&Qn(o,t),Object.defineProperty(o,"prototype",{writable:!1}),d}();Jn.defaultConfig=void 0},923:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{BaseSegment:()=>le,ElementaryStreamTypes:()=>B,Fragment:()=>Te,Part:()=>H});var B,$=N(965),R=N(945),p=N(408);function w(ce,z){ce.prototype=Object.create(z.prototype),ce.prototype.constructor=ce,k(ce,z)}function k(ce,z){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(ne,U){return ne.__proto__=U,ne},k(ce,z)}function ve(ce,z){for(var ne=0;ne<z.length;ne++){var U=z[ne];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(ce,typeof(be=function(ke,He){if(typeof ke!="object"||ke===null)return ke;var K=ke[Symbol.toPrimitive];if(K!==void 0){var E=K.call(ke,He);if(typeof E!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(ke)}(U.key,"string"))=="symbol"?be:String(be),U)}var be}function Z(ce,z,ne){return z&&ve(ce.prototype,z),ne&&ve(ce,ne),Object.defineProperty(ce,"prototype",{writable:!1}),ce}(function(ce){ce.AUDIO="audio",ce.VIDEO="video",ce.AUDIOVIDEO="audiovideo"})(B||(B={}));var le=function(){function ce(z){var ne;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((ne={})[B.AUDIO]=null,ne[B.VIDEO]=null,ne[B.AUDIOVIDEO]=null,ne),this.baseurl=z}return ce.prototype.setByteRange=function(z,ne){var U=z.split("@",2),be=[];U.length===1?be[0]=ne?ne.byteRangeEndOffset:0:be[0]=parseInt(U[1]),be[1]=parseInt(U[0])+be[0],this._byteRange=be},Z(ce,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=(0,R.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(z){this._url=z}}]),ce}(),Te=function(ce){function z(U,be){var ke;return(ke=ce.call(this,be)||this)._decryptdata=null,ke.rawProgramDateTime=null,ke.programDateTime=null,ke.tagList=[],ke.duration=0,ke.sn=0,ke.levelkeys=void 0,ke.type=void 0,ke.loader=null,ke.keyLoader=null,ke.level=-1,ke.cc=0,ke.startPTS=void 0,ke.endPTS=void 0,ke.appendedPTS=void 0,ke.startDTS=void 0,ke.endDTS=void 0,ke.start=0,ke.deltaPTS=void 0,ke.maxStartPTS=void 0,ke.minEndPTS=void 0,ke.stats=new p.LoadStats,ke.urlId=0,ke.data=void 0,ke.bitrateTest=!1,ke.title=null,ke.initSegment=null,ke.endList=void 0,ke.type=U,ke}w(z,ce);var ne=z.prototype;return ne.setKeyFormat=function(U){if(this.levelkeys){var be=this.levelkeys[U];be&&!this._decryptdata&&(this._decryptdata=be.getDecryptData(this.sn))}},ne.abortRequests=function(){var U,be;(U=this.loader)===null||U===void 0||U.abort(),(be=this.keyLoader)===null||be===void 0||be.abort()},ne.setElementaryStreamInfo=function(U,be,ke,He,K,E){E===void 0&&(E=!1);var M=this.elementaryStreams,L=M[U];L?(L.startPTS=Math.min(L.startPTS,be),L.endPTS=Math.max(L.endPTS,ke),L.startDTS=Math.min(L.startDTS,He),L.endDTS=Math.max(L.endDTS,K)):M[U]={startPTS:be,endPTS:ke,startDTS:He,endDTS:K,partial:E}},ne.clearElementaryStreamInfo=function(){var U=this.elementaryStreams;U[B.AUDIO]=null,U[B.VIDEO]=null,U[B.AUDIOVIDEO]=null},Z(z,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var U=this.levelkeys.identity;if(U)this._decryptdata=U.getDecryptData(this.sn);else{var be=Object.keys(this.levelkeys);if(be.length===1)return this._decryptdata=this.levelkeys[be[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null||!(0,$.isFiniteNumber)(this.programDateTime))return null;var U=(0,$.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*U}},{key:"encrypted",get:function(){var U;if((U=this._decryptdata)!==null&&U!==void 0&&U.encrypted)return!0;if(this.levelkeys){var be=Object.keys(this.levelkeys),ke=be.length;if(ke>1||ke===1&&this.levelkeys[be[0]].encrypted)return!0}return!1}}]),z}(le),H=function(ce){function z(ne,U,be,ke,He){var K;(K=ce.call(this,be)||this).fragOffset=0,K.duration=0,K.gap=!1,K.independent=!1,K.relurl=void 0,K.fragment=void 0,K.index=void 0,K.stats=new p.LoadStats,K.duration=ne.decimalFloatingPoint("DURATION"),K.gap=ne.bool("GAP"),K.independent=ne.bool("INDEPENDENT"),K.relurl=ne.enumeratedString("URI"),K.fragment=U,K.index=ke;var E=ne.enumeratedString("BYTERANGE");return E&&K.setByteRange(E,He),He&&(K.fragOffset=He.fragOffset+He.duration),K}return w(z,ce),Z(z,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var ne=this.elementaryStreams;return!!(ne.audio||ne.video||ne.audiovideo)}}]),z}(le)},408:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{LoadStats:()=>B});var B=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},965:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{MAX_SAFE_INTEGER:()=>$,isFiniteNumber:()=>B});var B=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},$=Number.MAX_SAFE_INTEGER||9007199254740991},524:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{default:()=>ne,flushTextTrackMetadataCueSamples:()=>be,flushTextTrackUserdataCueSamples:()=>ke,normalizePts:()=>U});var B=N(965);let $=function(){function E(){}return E.getSilentFrame=function(M,L){if(M==="mp4a.40.2"){if(L===1)return new Uint8Array([0,200,0,128,35,128]);if(L===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(L===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(L===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(L===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(L===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(L===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(L===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(L===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])}},E}();var R=Math.pow(2,32)-1,p=function(){function E(){}return E.init=function(){var M;for(M in E.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},E.types)E.types.hasOwnProperty(M)&&(E.types[M]=[M.charCodeAt(0),M.charCodeAt(1),M.charCodeAt(2),M.charCodeAt(3)]);var L=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),oe=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);E.HDLR_TYPES={video:L,audio:oe};var ye=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),W=new Uint8Array([0,0,0,0,0,0,0,0]);E.STTS=E.STSC=E.STCO=W,E.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),E.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),E.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),E.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var V=new Uint8Array([105,115,111,109]),we=new Uint8Array([97,118,99,49]),Re=new Uint8Array([0,0,0,1]);E.FTYP=E.box(E.types.ftyp,V,Re,V,we),E.DINF=E.box(E.types.dinf,E.box(E.types.dref,ye))},E.box=function(M){for(var L=8,oe=arguments.length,ye=new Array(oe>1?oe-1:0),W=1;W<oe;W++)ye[W-1]=arguments[W];for(var V=ye.length,we=V;V--;)L+=ye[V].byteLength;var Re=new Uint8Array(L);for(Re[0]=L>>24&255,Re[1]=L>>16&255,Re[2]=L>>8&255,Re[3]=255&L,Re.set(M,4),V=0,L=8;V<we;V++)Re.set(ye[V],L),L+=ye[V].byteLength;return Re},E.hdlr=function(M){return E.box(E.types.hdlr,E.HDLR_TYPES[M])},E.mdat=function(M){return E.box(E.types.mdat,M)},E.mdhd=function(M,L){L*=M;var oe=Math.floor(L/(R+1)),ye=Math.floor(L%(R+1));return E.box(E.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,255&M,oe>>24,oe>>16&255,oe>>8&255,255&oe,ye>>24,ye>>16&255,ye>>8&255,255&ye,85,196,0,0]))},E.mdia=function(M){return E.box(E.types.mdia,E.mdhd(M.timescale,M.duration),E.hdlr(M.type),E.minf(M))},E.mfhd=function(M){return E.box(E.types.mfhd,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,255&M]))},E.minf=function(M){return M.type==="audio"?E.box(E.types.minf,E.box(E.types.smhd,E.SMHD),E.DINF,E.stbl(M)):E.box(E.types.minf,E.box(E.types.vmhd,E.VMHD),E.DINF,E.stbl(M))},E.moof=function(M,L,oe){return E.box(E.types.moof,E.mfhd(M),E.traf(oe,L))},E.moov=function(M){for(var L=M.length,oe=[];L--;)oe[L]=E.trak(M[L]);return E.box.apply(null,[E.types.moov,E.mvhd(M[0].timescale,M[0].duration)].concat(oe).concat(E.mvex(M)))},E.mvex=function(M){for(var L=M.length,oe=[];L--;)oe[L]=E.trex(M[L]);return E.box.apply(null,[E.types.mvex].concat(oe))},E.mvhd=function(M,L){L*=M;var oe=Math.floor(L/(R+1)),ye=Math.floor(L%(R+1)),W=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,255&M,oe>>24,oe>>16&255,oe>>8&255,255&oe,ye>>24,ye>>16&255,ye>>8&255,255&ye,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]);return E.box(E.types.mvhd,W)},E.sdtp=function(M){var L,oe,ye=M.samples||[],W=new Uint8Array(4+ye.length);for(L=0;L<ye.length;L++)oe=ye[L].flags,W[L+4]=oe.dependsOn<<4|oe.isDependedOn<<2|oe.hasRedundancy;return E.box(E.types.sdtp,W)},E.stbl=function(M){return E.box(E.types.stbl,E.stsd(M),E.box(E.types.stts,E.STTS),E.box(E.types.stsc,E.STSC),E.box(E.types.stsz,E.STSZ),E.box(E.types.stco,E.STCO))},E.avc1=function(M){var L,oe,ye,W=[],V=[];for(L=0;L<M.sps.length;L++)ye=(oe=M.sps[L]).byteLength,W.push(ye>>>8&255),W.push(255&ye),W=W.concat(Array.prototype.slice.call(oe));for(L=0;L<M.pps.length;L++)ye=(oe=M.pps[L]).byteLength,V.push(ye>>>8&255),V.push(255&ye),V=V.concat(Array.prototype.slice.call(oe));var we=E.box(E.types.avcC,new Uint8Array([1,W[3],W[4],W[5],255,224|M.sps.length].concat(W).concat([M.pps.length]).concat(V))),Re=M.width,Ce=M.height,ge=M.pixelRatio[0],qe=M.pixelRatio[1];return E.box(E.types.avc1,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,Re>>8&255,255&Re,Ce>>8&255,255&Ce,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),we,E.box(E.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),E.box(E.types.pasp,new Uint8Array([ge>>24,ge>>16&255,ge>>8&255,255&ge,qe>>24,qe>>16&255,qe>>8&255,255&qe])))},E.esds=function(M){var L=M.config.length;return new Uint8Array([0,0,0,0,3,23+L,0,1,0,4,15+L,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([L]).concat(M.config).concat([6,1,2]))},E.mp4a=function(M){var L=M.samplerate;return E.box(E.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,L>>8&255,255&L,0,0]),E.box(E.types.esds,E.esds(M)))},E.mp3=function(M){var L=M.samplerate;return E.box(E.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,L>>8&255,255&L,0,0]))},E.stsd=function(M){return M.type==="audio"?M.segmentCodec==="mp3"&&M.codec==="mp3"?E.box(E.types.stsd,E.STSD,E.mp3(M)):E.box(E.types.stsd,E.STSD,E.mp4a(M)):E.box(E.types.stsd,E.STSD,E.avc1(M))},E.tkhd=function(M){var L=M.id,oe=M.duration*M.timescale,ye=M.width,W=M.height,V=Math.floor(oe/(R+1)),we=Math.floor(oe%(R+1));return E.box(E.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,L>>24&255,L>>16&255,L>>8&255,255&L,0,0,0,0,V>>24,V>>16&255,V>>8&255,255&V,we>>24,we>>16&255,we>>8&255,255&we,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,ye>>8&255,255&ye,0,0,W>>8&255,255&W,0,0]))},E.traf=function(M,L){var oe=E.sdtp(M),ye=M.id,W=Math.floor(L/(R+1)),V=Math.floor(L%(R+1));return E.box(E.types.traf,E.box(E.types.tfhd,new Uint8Array([0,0,0,0,ye>>24,ye>>16&255,ye>>8&255,255&ye])),E.box(E.types.tfdt,new Uint8Array([1,0,0,0,W>>24,W>>16&255,W>>8&255,255&W,V>>24,V>>16&255,V>>8&255,255&V])),E.trun(M,oe.length+16+20+8+16+8+8),oe)},E.trak=function(M){return M.duration=M.duration||4294967295,E.box(E.types.trak,E.tkhd(M),E.mdia(M))},E.trex=function(M){var L=M.id;return E.box(E.types.trex,new Uint8Array([0,0,0,0,L>>24,L>>16&255,L>>8&255,255&L,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},E.trun=function(M,L){var oe,ye,W,V,we,Re,Ce=M.samples||[],ge=Ce.length,qe=12+16*ge,tt=new Uint8Array(qe);for(L+=8+qe,tt.set([M.type==="video"?1:0,0,15,1,ge>>>24&255,ge>>>16&255,ge>>>8&255,255&ge,L>>>24&255,L>>>16&255,L>>>8&255,255&L],0),oe=0;oe<ge;oe++)W=(ye=Ce[oe]).duration,V=ye.size,we=ye.flags,Re=ye.cts,tt.set([W>>>24&255,W>>>16&255,W>>>8&255,255&W,V>>>24&255,V>>>16&255,V>>>8&255,255&V,we.isLeading<<2|we.dependsOn,we.isDependedOn<<6|we.hasRedundancy<<4|we.paddingValue<<1|we.isNonSync,61440&we.degradPrio,15&we.degradPrio,Re>>>24&255,Re>>>16&255,Re>>>8&255,255&Re],12+16*oe);return E.box(E.types.trun,tt)},E.initSegment=function(M){E.types||E.init();var L=E.moov(M),oe=new Uint8Array(E.FTYP.byteLength+L.byteLength);return oe.set(E.FTYP),oe.set(L,E.FTYP.byteLength),oe},E}();p.types=void 0,p.HDLR_TYPES=void 0,p.STTS=void 0,p.STSC=void 0,p.STCO=void 0,p.STSZ=void 0,p.VMHD=void 0,p.SMHD=void 0,p.STSD=void 0,p.FTYP=void 0,p.DINF=void 0;let w=p;var k=N(851),ve=N(973),Z=N(93),le=N(308),Te=N(673);function H(){return H=Object.assign?Object.assign.bind():function(E){for(var M=1;M<arguments.length;M++){var L=arguments[M];for(var oe in L)Object.prototype.hasOwnProperty.call(L,oe)&&(E[oe]=L[oe])}return E},H.apply(this,arguments)}var ce=null,z=null,ne=function(){function E(L,oe,ye,W){if(W===void 0&&(W=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=L,this.config=oe,this.typeSupported=ye,this.ISGenerated=!1,ce===null){var V=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ce=V?parseInt(V[1]):0}if(z===null){var we=navigator.userAgent.match(/Safari\/(\d+)/i);z=we?parseInt(we[1]):0}}var M=E.prototype;return M.destroy=function(){},M.resetTimeStamp=function(L){Z.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=L},M.resetNextTimestamp=function(){Z.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},M.resetInitSegment=function(){Z.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},M.getVideoStartPts=function(L){var oe=!1,ye=L.reduce(function(W,V){var we=V.pts-W;return we<-4294967296?(oe=!0,U(W,V.pts)):we>0?W:V.pts},L[0].pts);return oe&&Z.logger.debug("PTS rollover detected"),ye},M.remux=function(L,oe,ye,W,V,we,Re,Ce){var ge,qe,tt,ee,ue,ie,Oe=V,xe=V,Ne=L.pid>-1,Be=oe.pid>-1,je=oe.samples.length,pe=L.samples.length>0,Ie=Re&&je>0||je>1;if((!Ne||pe)&&(!Be||Ie)||this.ISGenerated||Re){this.ISGenerated||(tt=this.generateIS(L,oe,V));var Ye,rt=this.isVideoContiguous,yt=-1;if(Ie&&(yt=function(kt){for(var gt=0;gt<kt.length;gt++)if(kt[gt].key)return gt;return-1}(oe.samples),!rt&&this.config.forceKeyFrameOnDiscontinuity))if(ie=!0,yt>0){Z.logger.warn("[mp4-remuxer]: Dropped "+yt+" out of "+je+" video samples due to a missing keyframe");var ht=this.getVideoStartPts(oe.samples);oe.samples=oe.samples.slice(yt),oe.dropped+=yt,Ye=xe+=(oe.samples[0].pts-ht)/oe.inputTimeScale}else yt===-1&&(Z.logger.warn("[mp4-remuxer]: No keyframe found out of "+je+" video samples"),ie=!1);if(this.ISGenerated){if(pe&&Ie){var It=this.getVideoStartPts(oe.samples),Dt=(U(L.samples[0].pts,It)-It)/oe.inputTimeScale;Oe+=Math.max(0,Dt),xe+=Math.max(0,-Dt)}if(pe){if(L.samplerate||(Z.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),tt=this.generateIS(L,oe,V)),qe=this.remuxAudio(L,Oe,this.isAudioContiguous,we,Be||Ie||Ce===le.PlaylistLevelType.AUDIO?xe:void 0),Ie){var St=qe?qe.endPTS-qe.startPTS:0;oe.inputTimeScale||(Z.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),tt=this.generateIS(L,oe,V)),ge=this.remuxVideo(oe,xe,rt,St)}}else Ie&&(ge=this.remuxVideo(oe,xe,rt,0));ge&&(ge.firstKeyFrame=yt,ge.independent=yt!==-1,ge.firstKeyFramePTS=Ye)}}return this.ISGenerated&&(ye.samples.length&&(ue=be(ye,V,this._initPTS,this._initDTS)),W.samples.length&&(ee=ke(W,V,this._initPTS))),{audio:qe,video:ge,initSegment:tt,independent:ie,text:ee,id3:ue}},M.generateIS=function(L,oe,ye){var W,V,we,Re=L.samples,Ce=oe.samples,ge=this.typeSupported,qe={},tt=!(0,B.isFiniteNumber)(this._initPTS),ee="audio/mp4";if(tt&&(W=V=1/0),L.config&&Re.length&&(L.timescale=L.samplerate,L.segmentCodec==="mp3"&&(ge.mpeg?(ee="audio/mpeg",L.codec=""):ge.mp3&&(L.codec="mp3")),qe.audio={id:"audio",container:ee,codec:L.codec,initSegment:L.segmentCodec==="mp3"&&ge.mpeg?new Uint8Array(0):w.initSegment([L]),metadata:{channelCount:L.channelCount}},tt&&(we=L.inputTimeScale,W=V=Re[0].pts-Math.round(we*ye))),oe.sps&&oe.pps&&Ce.length&&(oe.timescale=oe.inputTimeScale,qe.video={id:"main",container:"video/mp4",codec:oe.codec,initSegment:w.initSegment([oe]),metadata:{width:oe.width,height:oe.height}},tt)){we=oe.inputTimeScale;var ue=this.getVideoStartPts(Ce),ie=Math.round(we*ye);V=Math.min(V,U(Ce[0].dts,ue)-ie),W=Math.min(W,ue-ie)}if(Object.keys(qe).length)return this.ISGenerated=!0,tt&&(this._initPTS=W,this._initDTS=V),{tracks:qe,initPTS:W,timescale:we}},M.remuxVideo=function(L,oe,ye,W){var V,we,Re=L.inputTimeScale,Ce=L.samples,ge=[],qe=Ce.length,tt=this._initPTS,ee=this.nextAvcDts,ue=8,ie=this.videoSampleDuration,Oe=Number.POSITIVE_INFINITY,xe=Number.NEGATIVE_INFINITY,Ne=!1;ye&&ee!==null||(ee=oe*Re-(Ce[0].pts-U(Ce[0].dts,Ce[0].pts)));for(var Be=0;Be<qe;Be++){var je=Ce[Be];je.pts=U(je.pts-tt,ee),je.dts=U(je.dts-tt,ee),je.dts<Ce[Be>0?Be-1:Be].dts&&(Ne=!0)}Ne&&Ce.sort(function(Vt,hr){var wr=Vt.dts-hr.dts,cr=Vt.pts-hr.pts;return wr||cr}),V=Ce[0].dts;var pe=Ce[Ce.length-1].dts-V,Ie=pe?Math.round(pe/(qe-1)):ie||L.inputTimeScale/30;if(ye){var Ye=V-ee,rt=Ye>Ie,yt=Ye<-1;if((rt||yt)&&(rt?Z.logger.warn("AVC: "+(0,Te.toMsFromMpegTsClock)(Ye,!0)+" ms ("+Ye+"dts) hole between fragments detected, filling it"):Z.logger.warn("AVC: "+(0,Te.toMsFromMpegTsClock)(-Ye,!0)+" ms ("+Ye+"dts) overlapping between fragments detected"),!yt||ee>Ce[0].pts)){V=ee;var ht=Ce[0].pts-Ye;Ce[0].dts=V,Ce[0].pts=ht,Z.logger.log("Video: First PTS/DTS adjusted: "+(0,Te.toMsFromMpegTsClock)(ht,!0)+"/"+(0,Te.toMsFromMpegTsClock)(V,!0)+", delta: "+(0,Te.toMsFromMpegTsClock)(Ye,!0)+" ms")}}V=Math.max(0,V);for(var It=0,Dt=0,St=0;St<qe;St++){for(var kt=Ce[St],gt=kt.units,ut=gt.length,Rt=0,Pt=0;Pt<ut;Pt++)Rt+=gt[Pt].data.length;Dt+=Rt,It+=ut,kt.length=Rt,kt.dts=Math.max(kt.dts,V),Oe=Math.min(kt.pts,Oe),xe=Math.max(kt.pts,xe)}we=Ce[qe-1].dts;var jt,zt=Dt+4*It+8;try{jt=new Uint8Array(zt)}catch{return void this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:ve.ErrorTypes.MUX_ERROR,details:ve.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:zt,reason:"fail allocating video mdat "+zt})}var Nt=new DataView(jt.buffer);Nt.setUint32(0,zt),jt.set(w.types.mdat,4);for(var dr=!1,J=Number.POSITIVE_INFINITY,O=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY,P=Number.NEGATIVE_INFINITY,D=0;D<qe;D++){for(var F=Ce[D],q=F.units,Y=0,he=0,Le=q.length;he<Le;he++){var Ae=q[he],Me=Ae.data,Ve=Ae.data.byteLength;Nt.setUint32(ue,Ve),ue+=4,jt.set(Me,ue),ue+=Ve,Y+=4+Ve}var Ue=void 0;if(D<qe-1)ie=Ce[D+1].dts-F.dts,Ue=Ce[D+1].pts-F.pts;else{var Qe=this.config,ot=D>0?F.dts-Ce[D-1].dts:Ie;if(Ue=D>0?F.pts-Ce[D-1].pts:Ie,Qe.stretchShortVideoTrack&&this.nextAudioPts!==null){var bt=Math.floor(Qe.maxBufferHole*Re),We=(W?Oe+W*Re:this.nextAudioPts)-F.pts;We>bt?((ie=We-ot)<0?ie=ot:dr=!0,Z.logger.log("[mp4-remuxer]: It is approximately "+We/90+" ms to the next segment; using duration "+ie/90+" ms for the last video frame.")):ie=ot}else ie=ot}var Lt=Math.round(F.pts-F.dts);J=Math.min(J,ie),T=Math.max(T,ie),O=Math.min(O,Ue),P=Math.max(P,Ue),ge.push(new He(F.key,ie,Y,Lt))}if(ge.length){if(ce){if(ce<70){var Qt=ge[0].flags;Qt.dependsOn=2,Qt.isNonSync=0}}else if(z&&P-O<T-J&&Ie/T<.025&&ge[0].cts===0){Z.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var Ot=V,xt=0,Ut=ge.length;xt<Ut;xt++){var Ze=Ot+ge[xt].duration,rr=Ot+ge[xt].cts;if(xt<Ut-1){var Er=Ze+ge[xt+1].cts;ge[xt].duration=Er-rr}else ge[xt].duration=xt?ge[xt-1].duration:Ie;ge[xt].cts=0,Ot=Ze}}}ie=dr||!ie?Ie:ie,this.nextAvcDts=ee=we+ie,this.videoSampleDuration=ie,this.isVideoContiguous=!0;var Ft={data1:w.moof(L.sequenceNumber++,V,H({},L,{samples:ge})),data2:jt,startPTS:Oe/Re,endPTS:(xe+ie)/Re,startDTS:V/Re,endDTS:ee/Re,type:"video",hasAudio:!1,hasVideo:!0,nb:ge.length,dropped:L.dropped};return L.samples=[],L.dropped=0,Ft},M.remuxAudio=function(L,oe,ye,W,V){var we=L.inputTimeScale,Re=we/(L.samplerate?L.samplerate:we),Ce=L.segmentCodec==="aac"?1024:1152,ge=Ce*Re,qe=this._initPTS,tt=L.segmentCodec==="mp3"&&this.typeSupported.mpeg,ee=[],ue=V!==void 0,ie=L.samples,Oe=tt?0:8,xe=this.nextAudioPts||-1,Ne=oe*we;if(this.isAudioContiguous=ye=ye||ie.length&&xe>0&&(W&&Math.abs(Ne-xe)<9e3||Math.abs(U(ie[0].pts-qe,Ne)-xe)<20*ge),ie.forEach(function(he){he.pts=U(he.pts-qe,Ne)}),!ye||xe<0){if(ie=ie.filter(function(he){return he.pts>=0}),!ie.length)return;xe=V===0?0:W&&!ue?Math.max(0,Ne):ie[0].pts}if(L.segmentCodec==="aac")for(var Be=this.config.maxAudioFramesDrift,je=0,pe=xe;je<ie.length;je++){var Ie=ie[je],Ye=Ie.pts,rt=Ye-pe,yt=Math.abs(1e3*rt/we);if(rt<=-Be*ge&&ue)je===0&&(Z.logger.warn("Audio frame @ "+(Ye/we).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*rt/we)+" ms."),this.nextAudioPts=xe=pe=Ye);else if(rt>=Be*ge&&yt<1e4&&ue){var ht=Math.round(rt/ge);(pe=Ye-ht*ge)<0&&(ht--,pe+=ge),je===0&&(this.nextAudioPts=xe=pe),Z.logger.warn("[mp4-remuxer]: Injecting "+ht+" audio frame @ "+(pe/we).toFixed(3)+"s due to "+Math.round(1e3*rt/we)+" ms gap.");for(var It=0;It<ht;It++){var Dt=Math.max(pe,0),St=$.getSilentFrame(L.manifestCodec||L.codec,L.channelCount);St||(Z.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),St=Ie.unit.subarray()),ie.splice(je,0,{unit:St,pts:Dt}),pe+=ge,je++}}Ie.pts=pe,pe+=ge}for(var kt,gt=null,ut=null,Rt=0,Pt=ie.length;Pt--;)Rt+=ie[Pt].unit.byteLength;for(var jt=0,zt=ie.length;jt<zt;jt++){var Nt=ie[jt],dr=Nt.unit,J=Nt.pts;if(ut!==null)ee[jt-1].duration=Math.round((J-ut)/Re);else{if(ye&&L.segmentCodec==="aac"&&(J=xe),gt=J,!(Rt>0))return;Rt+=Oe;try{kt=new Uint8Array(Rt)}catch{return void this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:ve.ErrorTypes.MUX_ERROR,details:ve.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Rt,reason:"fail allocating audio mdat "+Rt})}tt||(new DataView(kt.buffer).setUint32(0,Rt),kt.set(w.types.mdat,4))}kt.set(dr,Oe);var O=dr.byteLength;Oe+=O,ee.push(new He(!0,Ce,O,0)),ut=J}var T=ee.length;if(T){var P=ee[ee.length-1];this.nextAudioPts=xe=ut+Re*P.duration;var D=tt?new Uint8Array(0):w.moof(L.sequenceNumber++,gt/Re,H({},L,{samples:ee}));L.samples=[];var F=gt/we,q=xe/we,Y={data1:D,data2:kt,startPTS:F,endPTS:q,startDTS:F,endDTS:q,type:"audio",hasAudio:!0,hasVideo:!1,nb:T};return this.isAudioContiguous=!0,Y}},M.remuxEmptyAudio=function(L,oe,ye,W){var V=L.inputTimeScale,we=V/(L.samplerate?L.samplerate:V),Re=this.nextAudioPts,Ce=(Re!==null?Re:W.startDTS*V)+this._initDTS,ge=W.endDTS*V+this._initDTS,qe=1024*we,tt=Math.ceil((ge-Ce)/qe),ee=$.getSilentFrame(L.manifestCodec||L.codec,L.channelCount);if(Z.logger.warn("[mp4-remuxer]: remux empty Audio"),ee){for(var ue=[],ie=0;ie<tt;ie++){var Oe=Ce+ie*qe;ue.push({unit:ee,pts:Oe,dts:Oe})}return L.samples=ue,this.remuxAudio(L,oe,ye,!1)}Z.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},E}();function U(E,M){var L;if(M===null)return E;for(L=M<E?-8589934592:8589934592;Math.abs(E-M)>4294967296;)E+=L;return E}function be(E,M,L,oe){var ye=E.samples.length;if(ye){for(var W=E.inputTimeScale,V=0;V<ye;V++){var we=E.samples[V];we.pts=U(we.pts-L,M*W)/W,we.dts=U(we.dts-oe,M*W)/W}var Re=E.samples;return E.samples=[],{samples:Re}}}function ke(E,M,L){var oe=E.samples.length;if(oe){for(var ye=E.inputTimeScale,W=0;W<oe;W++){var V=E.samples[W];V.pts=U(V.pts-L,M*ye)/ye}E.samples.sort(function(Re,Ce){return Re.pts-Ce.pts});var we=E.samples;return E.samples=[],{samples:we}}}var He=function(E,M,L,oe){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=M,this.size=L,this.cts=oe,this.flags=new K(E)},K=function(E){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=E?2:1,this.isNonSync=E?0:1}},856:(fe,re,N)=>{"use strict";var B;N.r(re),N.d(re,{MetadataSchema:()=>B}),function($){$.audioId3="org.id3",$.dateRange="com.apple.quicktime.HLS",$.emsg="https://aomedia.org/emsg/ID3"}(B||(B={}))},308:(fe,re,N)=>{"use strict";var B,$;N.r(re),N.d(re,{PlaylistContextType:()=>B,PlaylistLevelType:()=>$}),function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"}(B||(B={})),function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"}($||($={}))},300:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{default:()=>B});let B={hexDump:function($){for(var R="",p=0;p<$.length;p++){var w=$[p].toString(16);w.length<2&&(w="0"+w),R+=w}return R}}},93:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{enableLogs:()=>w,logger:()=>k});var B=function(){},$={trace:B,debug:B,log:B,warn:B,info:B,error:B},R=$;function p(ve){var Z=self.console[ve];return Z?Z.bind(self.console,"["+ve+"] >"):B}function w(ve,Z){if(self.console&&ve===!0||typeof ve=="object"){(function(le){for(var Te=arguments.length,H=new Array(Te>1?Te-1:0),ce=1;ce<Te;ce++)H[ce-1]=arguments[ce];H.forEach(function(z){R[z]=le[z]?le[z].bind(le):p(z)})})(ve,"debug","log","info","warn","error");try{R.log('Debug logs enabled for "'+Z+'"')}catch{R=$}}else R=$}var k=$},63:(fe,re,N)=>{"use strict";N.r(re),N.d(re,{RemuxerTrackIdConfig:()=>Z,appendUint8Array:()=>ye,bin2str:()=>le,computeRawDurationFromSamples:()=>M,discardEPB:()=>Re,findBox:()=>ne,getDuration:()=>E,getStartDTS:()=>K,mp4Box:()=>ge,mp4pssh:()=>qe,offsetStartDTS:()=>L,parseEmsg:()=>Ce,parseInitSegment:()=>be,parsePssh:()=>tt,parseSEIMessageFromNALu:()=>we,parseSamples:()=>W,parseSegmentIndex:()=>U,parseSinf:()=>He,patchEncyptionData:()=>ke,readSint32:()=>ce,readUint16:()=>Te,readUint32:()=>H,segmentValidRange:()=>oe,writeUint32:()=>z});var B=N(923),$=N(145),R=N(181),p=N(93),w=N(300),k=Math.pow(2,32)-1,ve=[].push,Z={video:1,audio:2,id3:3,text:4};function le(ee){return String.fromCharCode.apply(null,ee)}function Te(ee,ue){var ie=ee[ue]<<8|ee[ue+1];return ie<0?65536+ie:ie}function H(ee,ue){var ie=ce(ee,ue);return ie<0?4294967296+ie:ie}function ce(ee,ue){return ee[ue]<<24|ee[ue+1]<<16|ee[ue+2]<<8|ee[ue+3]}function z(ee,ue,ie){ee[ue]=ie>>24,ee[ue+1]=ie>>16&255,ee[ue+2]=ie>>8&255,ee[ue+3]=255&ie}function ne(ee,ue){var ie=[];if(!ue.length)return ie;for(var Oe=ee.byteLength,xe=0;xe<Oe;){var Ne=H(ee,xe),Be=Ne>1?xe+Ne:Oe;if(le(ee.subarray(xe+4,xe+8))===ue[0])if(ue.length===1)ie.push(ee.subarray(xe+8,Be));else{var je=ne(ee.subarray(xe+8,Be),ue.slice(1));je.length&&ve.apply(ie,je)}xe=Be}return ie}function U(ee){var ue=[],ie=ee[0],Oe=8,xe=H(ee,Oe);Oe+=4,Oe+=ie===0?8:16,Oe+=2;var Ne=ee.length+0,Be=Te(ee,Oe);Oe+=2;for(var je=0;je<Be;je++){var pe=Oe,Ie=H(ee,pe);pe+=4;var Ye=2147483647&Ie;if((2147483648&Ie)>>>31==1)return console.warn("SIDX has hierarchical references (not supported)"),null;var rt=H(ee,pe);pe+=4,ue.push({referenceSize:Ye,subsegmentDuration:rt,info:{duration:rt/xe,start:Ne,end:Ne+Ye-1}}),Ne+=Ye,Oe=pe+=4}return{earliestPresentationTime:0,timescale:xe,version:ie,referencesCount:Be,references:ue}}function be(ee){for(var ue=[],ie=ne(ee,["moov","trak"]),Oe=0;Oe<ie.length;Oe++){var xe=ie[Oe],Ne=ne(xe,["tkhd"])[0];if(Ne){var Be=Ne[0],je=Be===0?12:20,pe=H(Ne,je),Ie=ne(xe,["mdia","mdhd"])[0];if(Ie){var Ye=H(Ie,je=(Be=Ie[0])===0?12:20),rt=ne(xe,["mdia","hdlr"])[0];if(rt){var yt=le(rt.subarray(8,12)),ht={soun:B.ElementaryStreamTypes.AUDIO,vide:B.ElementaryStreamTypes.VIDEO}[yt];if(ht){var It=ne(xe,["mdia","minf","stbl","stsd"])[0],Dt=void 0;It&&(Dt=le(It.subarray(12,16))),ue[pe]={timescale:Ye,type:ht},ue[ht]={timescale:Ye,id:pe,codec:Dt}}}}}}return ne(ee,["moov","mvex","trex"]).forEach(function(St){var kt=H(St,4),gt=ue[kt];gt&&(gt.default={duration:H(St,12),flags:H(St,20)})}),ue}function ke(ee,ue){if(!ee||!ue)return ee;var ie=ue.keyId;return ie&&ue.isCommonEncryption&&ne(ee,["moov","trak"]).forEach(function(Oe){var xe=ne(Oe,["mdia","minf","stbl","stsd"])[0].subarray(8),Ne=ne(xe,["enca"]),Be=Ne.length>0;Be||(Ne=ne(xe,["encv"])),Ne.forEach(function(je){ne(Be?je.subarray(28):je.subarray(78),["sinf"]).forEach(function(pe){var Ie=He(pe);if(Ie){var Ye=Ie.subarray(8,24);Ye.some(function(rt){return rt!==0})||(p.logger.log("[eme] Patching keyId in 'enc"+(Be?"a":"v")+">sinf>>tenc' box: "+w.default.hexDump(Ye)+" -> "+w.default.hexDump(ie)),Ie.set(ie,8))}})})}),ee}function He(ee){var ue=ne(ee,["schm"])[0];if(ue){var ie=le(ue.subarray(4,8));if(ie==="cbcs"||ie==="cenc")return ne(ee,["schi","tenc"])[0]}return p.logger.error("[eme] missing 'schm' box"),null}function K(ee,ue){return ne(ue,["moof","traf"]).reduce(function(ie,Oe){var xe=ne(Oe,["tfdt"])[0],Ne=xe[0],Be=ne(Oe,["tfhd"]).reduce(function(je,pe){var Ie=H(pe,4),Ye=ee[Ie];if(Ye){var rt=H(xe,4);Ne===1&&(rt*=Math.pow(2,32),rt+=H(xe,8));var yt=rt/(Ye.timescale||9e4);if(isFinite(yt)&&(je===null||yt<je))return yt}return je},null);return Be!==null&&isFinite(Be)&&(ie===null||Be<ie)?Be:ie},null)||0}function E(ee,ue){for(var ie=0,Oe=0,xe=0,Ne=ne(ee,["moof","traf"]),Be=0;Be<Ne.length;Be++){var je=Ne[Be],pe=ne(je,["tfhd"])[0],Ie=ue[H(pe,4)];if(Ie){var Ye=Ie.default,rt=H(pe,0)|(Ye==null?void 0:Ye.flags),yt=Ye==null?void 0:Ye.duration;8&rt&&(yt=H(pe,2&rt?12:8));for(var ht=Ie.timescale||9e4,It=ne(je,["trun"]),Dt=0;Dt<It.length;Dt++)!(ie=M(It[Dt]))&&yt&&(ie=yt*H(It[Dt],4)),Ie.type===B.ElementaryStreamTypes.VIDEO?Oe+=ie/ht:Ie.type===B.ElementaryStreamTypes.AUDIO&&(xe+=ie/ht)}}if(Oe===0&&xe===0){for(var St=0,kt=ne(ee,["sidx"]),gt=0;gt<kt.length;gt++){var ut=U(kt[gt]);ut!=null&&ut.references&&(St+=ut.references.reduce(function(Rt,Pt){return Rt+Pt.info.duration||0},0))}return St}return Oe||xe}function M(ee){var ue=H(ee,0),ie=8;1&ue&&(ie+=4),4&ue&&(ie+=4);for(var Oe=0,xe=H(ee,4),Ne=0;Ne<xe;Ne++)256&ue&&(Oe+=H(ee,ie),ie+=4),512&ue&&(ie+=4),1024&ue&&(ie+=4),2048&ue&&(ie+=4);return Oe}function L(ee,ue,ie){ne(ue,["moof","traf"]).forEach(function(Oe){ne(Oe,["tfhd"]).forEach(function(xe){var Ne=H(xe,4),Be=ee[Ne];if(Be){var je=Be.timescale||9e4;ne(Oe,["tfdt"]).forEach(function(pe){var Ie=pe[0],Ye=H(pe,4);if(Ie===0)Ye-=ie*je,z(pe,4,Ye=Math.max(Ye,0));else{Ye*=Math.pow(2,32),Ye+=H(pe,8),Ye-=ie*je,Ye=Math.max(Ye,0);var rt=Math.floor(Ye/(k+1)),yt=Math.floor(Ye%(k+1));z(pe,4,rt),z(pe,8,yt)}})}})})}function oe(ee){var ue={valid:null,remainder:null},ie=ne(ee,["moof"]);if(!ie)return ue;if(ie.length<2)return ue.remainder=ee,ue;var Oe=ie[ie.length-1];return ue.valid=(0,$.sliceUint8)(ee,0,Oe.byteOffset-8),ue.remainder=(0,$.sliceUint8)(ee,Oe.byteOffset-8),ue}function ye(ee,ue){var ie=new Uint8Array(ee.length+ue.length);return ie.set(ee),ie.set(ue,ee.length),ie}function W(ee,ue){var ie=[],Oe=ue.samples,xe=ue.timescale,Ne=ue.id,Be=!1;return ne(Oe,["moof"]).map(function(je){var pe=je.byteOffset-8;ne(je,["traf"]).map(function(Ie){var Ye=ne(Ie,["tfdt"]).map(function(rt){var yt=rt[0],ht=H(rt,4);return yt===1&&(ht*=Math.pow(2,32),ht+=H(rt,8)),ht/xe})[0];return Ye!==void 0&&(ee=Ye),ne(Ie,["tfhd"]).map(function(rt){var yt=H(rt,4),ht=16777215&H(rt,0),It=0,Dt=(16&ht)!=0,St=0,kt=(32&ht)!=0,gt=8;yt===Ne&&((1&ht)!=0&&(gt+=8),(2&ht)!=0&&(gt+=4),(8&ht)!=0&&(It=H(rt,gt),gt+=4),Dt&&(St=H(rt,gt),gt+=4),kt&&(gt+=4),ue.type==="video"&&(Be=function(ut){if(!ut)return!1;var Rt=ut.indexOf("."),Pt=Rt<0?ut:ut.substring(0,Rt);return Pt==="hvc1"||Pt==="hev1"||Pt==="dvh1"||Pt==="dvhe"}(ue.codec)),ne(Ie,["trun"]).map(function(ut){var Rt=ut[0],Pt=16777215&H(ut,0),jt=(1&Pt)!=0,zt=0,Nt=(4&Pt)!=0,dr=(256&Pt)!=0,J=0,O=(512&Pt)!=0,T=0,P=(1024&Pt)!=0,D=(2048&Pt)!=0,F=0,q=H(ut,4),Y=8;jt&&(zt=H(ut,Y),Y+=4),Nt&&(Y+=4);for(var he=zt+pe,Le=0;Le<q;Le++){if(dr?(J=H(ut,Y),Y+=4):J=It,O?(T=H(ut,Y),Y+=4):T=St,P&&(Y+=4),D&&(F=Rt===0?H(ut,Y):ce(ut,Y),Y+=4),ue.type===B.ElementaryStreamTypes.VIDEO)for(var Ae=0;Ae<T;){var Me=H(Oe,he);V(Be,Oe[he+=4])&&we(Oe.subarray(he,he+Me),Be?2:1,ee+F/xe,ie),he+=Me,Ae+=Me+4}ee+=J/xe}}))})})}),ie}function V(ee,ue){if(ee){var ie=ue>>1&63;return ie===39||ie===40}return(31&ue)==6}function we(ee,ue,ie,Oe){var xe=Re(ee),Ne=0;Ne+=ue;for(var Be=0,je=0,pe=!1,Ie=0;Ne<xe.length;){Be=0;do{if(Ne>=xe.length)break;Be+=Ie=xe[Ne++]}while(Ie===255);je=0;do{if(Ne>=xe.length)break;je+=Ie=xe[Ne++]}while(Ie===255);var Ye=xe.length-Ne;if(!pe&&Be===4&&Ne<xe.length){if(pe=!0,xe[Ne++]===181){var rt=Te(xe,Ne);if(Ne+=2,rt===49){var yt=H(xe,Ne);if(Ne+=4,yt===1195456820){var ht=xe[Ne++];if(ht===3){var It=xe[Ne++],Dt=64&It,St=Dt?2+3*(31&It):0,kt=new Uint8Array(St);if(Dt){kt[0]=It;for(var gt=1;gt<St;gt++)kt[gt]=xe[Ne++]}Oe.push({type:ht,payloadType:Be,pts:ie,bytes:kt})}}}}}else if(Be===5&&je<Ye){if(pe=!0,je>16){for(var ut=[],Rt=0;Rt<16;Rt++){var Pt=xe[Ne++].toString(16);ut.push(Pt.length==1?"0"+Pt:Pt),Rt!==3&&Rt!==5&&Rt!==7&&Rt!==9||ut.push("-")}for(var jt=je-16,zt=new Uint8Array(jt),Nt=0;Nt<jt;Nt++)zt[Nt]=xe[Ne++];Oe.push({payloadType:Be,pts:ie,uuid:ut.join(""),userData:(0,R.utf8ArrayToStr)(zt),userDataBytes:zt})}}else if(je<Ye)Ne+=je;else if(je>Ye)break}}function Re(ee){for(var ue=ee.byteLength,ie=[],Oe=1;Oe<ue-2;)ee[Oe]===0&&ee[Oe+1]===0&&ee[Oe+2]===3?(ie.push(Oe+2),Oe+=2):Oe++;if(ie.length===0)return ee;var xe=ue-ie.length,Ne=new Uint8Array(xe),Be=0;for(Oe=0;Oe<xe;Be++,Oe++)Be===ie[0]&&(Be++,ie.shift()),Ne[Oe]=ee[Be];return Ne}function Ce(ee){var ue=ee[0],ie="",Oe="",xe=0,Ne=0,Be=0,je=0,pe=0,Ie=0;if(ue===0){for(;le(ee.subarray(Ie,Ie+1))!=="\0";)ie+=le(ee.subarray(Ie,Ie+1)),Ie+=1;for(ie+=le(ee.subarray(Ie,Ie+1)),Ie+=1;le(ee.subarray(Ie,Ie+1))!=="\0";)Oe+=le(ee.subarray(Ie,Ie+1)),Ie+=1;Oe+=le(ee.subarray(Ie,Ie+1)),Ie+=1,xe=H(ee,12),Ne=H(ee,16),je=H(ee,20),pe=H(ee,24),Ie=28}else if(ue===1){xe=H(ee,Ie+=4);var Ye=H(ee,Ie+=4),rt=H(ee,Ie+=4);for(Ie+=4,Be=Math.pow(2,32)*Ye+rt,Number.isSafeInteger(Be)||(Be=Number.MAX_SAFE_INTEGER,console.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),je=H(ee,Ie),pe=H(ee,Ie+=4),Ie+=4;le(ee.subarray(Ie,Ie+1))!=="\0";)ie+=le(ee.subarray(Ie,Ie+1)),Ie+=1;for(ie+=le(ee.subarray(Ie,Ie+1)),Ie+=1;le(ee.subarray(Ie,Ie+1))!=="\0";)Oe+=le(ee.subarray(Ie,Ie+1)),Ie+=1;Oe+=le(ee.subarray(Ie,Ie+1)),Ie+=1}return{schemeIdUri:ie,value:Oe,timeScale:xe,presentationTime:Be,presentationTimeDelta:Ne,eventDuration:je,id:pe,payload:ee.subarray(Ie,ee.byteLength)}}function ge(ee){for(var ue=arguments.length,ie=new Array(ue>1?ue-1:0),Oe=1;Oe<ue;Oe++)ie[Oe-1]=arguments[Oe];for(var xe=ie.length,Ne=8,Be=xe;Be--;)Ne+=ie[Be].byteLength;var je=new Uint8Array(Ne);for(je[0]=Ne>>24&255,je[1]=Ne>>16&255,je[2]=Ne>>8&255,je[3]=255&Ne,je.set(ee,4),Be=0,Ne=8;Be<xe;Be++)je.set(ie[Be],Ne),Ne+=ie[Be].byteLength;return je}function qe(ee,ue,ie){if(ee.byteLength!==16)throw new RangeError("Invalid system id");var Oe,xe,Ne;if(ue){Oe=1,xe=new Uint8Array(16*ue.length);for(var Be=0;Be<ue.length;Be++){var je=ue[Be];if(je.byteLength!==16)throw new RangeError("Invalid key");xe.set(je,16*Be)}}else Oe=0,xe=new Uint8Array;Oe>0?(Ne=new Uint8Array(4),ue.length>0&&new DataView(Ne.buffer).setUint32(0,ue.length,!1)):Ne=new Uint8Array;var pe=new Uint8Array(4);return ie&&ie.byteLength>0&&new DataView(pe.buffer).setUint32(0,ie.byteLength,!1),ge([112,115,115,104],new Uint8Array([Oe,0,0,0]),ee,Ne,xe,pe,ie||new Uint8Array)}function tt(ee){if(!(ee instanceof ArrayBuffer)||ee.byteLength<32)return null;var ue={version:0,systemId:"",kids:null,data:null},ie=new DataView(ee),Oe=ie.getUint32(0);if(ee.byteLength!==Oe&&Oe>44||ie.getUint32(4)!==1886614376||(ue.version=ie.getUint32(8)>>>24,ue.version>1))return null;ue.systemId=w.default.hexDump(new Uint8Array(ee,12,16));var xe=ie.getUint32(28);if(ue.version===0){if(Oe-32<xe)return null;ue.data=new Uint8Array(ee,32,xe)}else if(ue.version===1){ue.kids=[];for(var Ne=0;Ne<xe;Ne++)ue.kids.push(new Uint8Array(ee,32+16*Ne,16))}return ue}},673:(fe,re,N)=>{"use strict";function B(w,k,ve,Z){ve===void 0&&(ve=1),Z===void 0&&(Z=!1);var le=w*k*ve;return Z?Math.round(le):le}function $(w,k,ve,Z){return ve===void 0&&(ve=1),Z===void 0&&(Z=!1),B(w,k,1/ve,Z)}function R(w,k){return k===void 0&&(k=!1),B(w,1e3,11111111111111112e-21,k)}function p(w,k){return k===void 0&&(k=1),B(w,9e4,1/k)}N.r(re),N.d(re,{toMpegTsClockFromTimescale:()=>p,toMsFromMpegTsClock:()=>R,toTimescaleFromBase:()=>B,toTimescaleFromScale:()=>$})},145:(fe,re,N)=>{"use strict";function B($,R,p){return Uint8Array.prototype.slice?$.slice(R,p):new Uint8Array(Array.prototype.slice.call($,R,p))}N.r(re),N.d(re,{sliceUint8:()=>B})},729:fe=>{"use strict";var re=Object.prototype.hasOwnProperty,N="~";function B(){}function $(k,ve,Z){this.fn=k,this.context=ve,this.once=Z||!1}function R(k,ve,Z,le,Te){if(typeof Z!="function")throw new TypeError("The listener must be a function");var H=new $(Z,le||k,Te),ce=N?N+ve:ve;return k._events[ce]?k._events[ce].fn?k._events[ce]=[k._events[ce],H]:k._events[ce].push(H):(k._events[ce]=H,k._eventsCount++),k}function p(k,ve){--k._eventsCount==0?k._events=new B:delete k._events[ve]}function w(){this._events=new B,this._eventsCount=0}Object.create&&(B.prototype=Object.create(null),new B().__proto__||(N=!1)),w.prototype.eventNames=function(){var k,ve,Z=[];if(this._eventsCount===0)return Z;for(ve in k=this._events)re.call(k,ve)&&Z.push(N?ve.slice(1):ve);return Object.getOwnPropertySymbols?Z.concat(Object.getOwnPropertySymbols(k)):Z},w.prototype.listeners=function(k){var ve=N?N+k:k,Z=this._events[ve];if(!Z)return[];if(Z.fn)return[Z.fn];for(var le=0,Te=Z.length,H=new Array(Te);le<Te;le++)H[le]=Z[le].fn;return H},w.prototype.listenerCount=function(k){var ve=N?N+k:k,Z=this._events[ve];return Z?Z.fn?1:Z.length:0},w.prototype.emit=function(k,ve,Z,le,Te,H){var ce=N?N+k:k;if(!this._events[ce])return!1;var z,ne,U=this._events[ce],be=arguments.length;if(U.fn){switch(U.once&&this.removeListener(k,U.fn,void 0,!0),be){case 1:return U.fn.call(U.context),!0;case 2:return U.fn.call(U.context,ve),!0;case 3:return U.fn.call(U.context,ve,Z),!0;case 4:return U.fn.call(U.context,ve,Z,le),!0;case 5:return U.fn.call(U.context,ve,Z,le,Te),!0;case 6:return U.fn.call(U.context,ve,Z,le,Te,H),!0}for(ne=1,z=new Array(be-1);ne<be;ne++)z[ne-1]=arguments[ne];U.fn.apply(U.context,z)}else{var ke,He=U.length;for(ne=0;ne<He;ne++)switch(U[ne].once&&this.removeListener(k,U[ne].fn,void 0,!0),be){case 1:U[ne].fn.call(U[ne].context);break;case 2:U[ne].fn.call(U[ne].context,ve);break;case 3:U[ne].fn.call(U[ne].context,ve,Z);break;case 4:U[ne].fn.call(U[ne].context,ve,Z,le);break;default:if(!z)for(ke=1,z=new Array(be-1);ke<be;ke++)z[ke-1]=arguments[ke];U[ne].fn.apply(U[ne].context,z)}}return!0},w.prototype.on=function(k,ve,Z){return R(this,k,ve,Z,!1)},w.prototype.once=function(k,ve,Z){return R(this,k,ve,Z,!0)},w.prototype.removeListener=function(k,ve,Z,le){var Te=N?N+k:k;if(!this._events[Te])return this;if(!ve)return p(this,Te),this;var H=this._events[Te];if(H.fn)H.fn!==ve||le&&!H.once||Z&&H.context!==Z||p(this,Te);else{for(var ce=0,z=[],ne=H.length;ce<ne;ce++)(H[ce].fn!==ve||le&&!H[ce].once||Z&&H[ce].context!==Z)&&z.push(H[ce]);z.length?this._events[Te]=z.length===1?z[0]:z:p(this,Te)}return this},w.prototype.removeAllListeners=function(k){var ve;return k?(ve=N?N+k:k,this._events[ve]&&p(this,ve)):(this._events=new B,this._eventsCount=0),this},w.prototype.off=w.prototype.removeListener,w.prototype.addListener=w.prototype.on,w.prefixed=N,w.EventEmitter=w,fe.exports=w},945:function(fe){var re,N,B,$,R;re=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,N=/^(?=([^\/?#]*))\1([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,$=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(p,w,k){if(k=k||{},p=p.trim(),!(w=w.trim())){if(!k.alwaysNormalize)return p;var ve=R.parseURL(p);if(!ve)throw new Error("Error trying to parse base URL.");return ve.path=R.normalizePath(ve.path),R.buildURLFromParts(ve)}var Z=R.parseURL(w);if(!Z)throw new Error("Error trying to parse relative URL.");if(Z.scheme)return k.alwaysNormalize?(Z.path=R.normalizePath(Z.path),R.buildURLFromParts(Z)):w;var le=R.parseURL(p);if(!le)throw new Error("Error trying to parse base URL.");if(!le.netLoc&&le.path&&le.path[0]!=="/"){var Te=N.exec(le.path);le.netLoc=Te[1],le.path=Te[2]}le.netLoc&&!le.path&&(le.path="/");var H={scheme:le.scheme,netLoc:Z.netLoc,path:null,params:Z.params,query:Z.query,fragment:Z.fragment};if(!Z.netLoc&&(H.netLoc=le.netLoc,Z.path[0]!=="/"))if(Z.path){var ce=le.path,z=ce.substring(0,ce.lastIndexOf("/")+1)+Z.path;H.path=R.normalizePath(z)}else H.path=le.path,Z.params||(H.params=le.params,Z.query||(H.query=le.query));return H.path===null&&(H.path=k.alwaysNormalize?R.normalizePath(Z.path):Z.path),R.buildURLFromParts(H)},parseURL:function(p){var w=re.exec(p);return w?{scheme:w[1]||"",netLoc:w[2]||"",path:w[3]||"",params:w[4]||"",query:w[5]||"",fragment:w[6]||""}:null},normalizePath:function(p){for(p=p.split("").reverse().join("").replace(B,"");p.length!==(p=p.replace($,"")).length;);return p.split("").reverse().join("")},buildURLFromParts:function(p){return p.scheme+p.netLoc+p.path+p.params+p.query+p.fragment}},fe.exports=R}},te={};function Se(fe){var re=te[fe];if(re!==void 0)return re.exports;var N=te[fe]={exports:{}};return X[fe].call(N.exports,N,N.exports,Se),N.exports}Se.m=X,Se.n=fe=>{var re=fe&&fe.__esModule?()=>fe.default:()=>fe;return Se.d(re,{a:re}),re},Se.d=(fe,re)=>{for(var N in re)Se.o(re,N)&&!Se.o(fe,N)&&Object.defineProperty(fe,N,{enumerable:!0,get:re[N]})},Se.o=(fe,re)=>Object.prototype.hasOwnProperty.call(fe,re),Se.r=fe=>{typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(fe,"__esModule",{value:!0})};var De=Se(76);return De.default})())});var $i=ea(ta());var ia=ea(ra()),Wa=ia.default,lr=Wa;var hi=class extends Error{constructor(Se,De=hi.MEDIA_ERR_CUSTOM,fe){var re;super(Se);this.name="MediaError",this.code=De,this.fatal=fe!=null?fe:De>=hi.MEDIA_ERR_NETWORK&&De<=hi.MEDIA_ERR_ENCRYPTED,this.message||(this.message=(re=hi.defaultMessages[this.code])!=null?re:"")}},ur=hi;ur.MEDIA_ERR_ABORTED=1,ur.MEDIA_ERR_NETWORK=2,ur.MEDIA_ERR_DECODE=3,ur.MEDIA_ERR_SRC_NOT_SUPPORTED=4,ur.MEDIA_ERR_ENCRYPTED=5,ur.MEDIA_ERR_CUSTOM=100,ur.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var Xa=X=>X==null,Dn=(X,te)=>Xa(te)?!1:X in te,Xi={ANY:"any",MUTED:"muted"},Ii={VOD:"on-demand",ON_DEMAND:"on-demand",LIVE:"live",LL_LIVE:"ll-live",DVR:"live:dvr",LL_DVR:"ll-live:dvr"},Rn={MSE:"mse",NATIVE:"native"},zi={HEADER:"header",QUERY:"query",NONE:"none"},vs=Object.values(zi),Vr={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Qi={HLS:Vr.M3U8},ps=Object.keys(Qi),gs=[...Object.values(Vr),"hls","HLS"];var Rr=(X,te,Se,De,fe=X)=>{fe.addEventListener(te,Se,De),X.addEventListener("teardown",()=>{fe.removeEventListener(te,Se)},{once:!0})};function na(X,te,Se){te&&Se>te&&(Se=te);for(let De=0;De<X.length;De++)if(X.start(De)<=Se&&X.end(De)>=Se)return!0;return!1}var aa=X=>{let te=X.indexOf("?");if(te<0)return[X];let Se=X.slice(0,te),De=X.slice(te);return[Se,De]},In=X=>{let te=X.type;if(te){let De=te.toUpperCase();return Dn(De,Qi)?Qi[De]:te}let{src:Se}=X;return Se?za(Se):""},za=X=>{let te="";try{te=new URL(X).pathname}catch{console.error("invalid url")}let Se=te.lastIndexOf(".");if(Se<0)return"";let fe=te.slice(Se+1).toUpperCase();return Dn(fe,Vr)?Vr[fe]:""};var Qa=Object.values(Xi),sa=X=>typeof X=="boolean"||typeof X=="string"&&Qa.includes(X),oa=({autoplay:X},te,Se)=>{let De=!1,fe=!1,re=sa(X)?X:!!X,N=()=>{De||Rr(te,"playing",()=>{De=!0},{once:!0})};if(N(),Rr(te,"loadstart",()=>{De=!1,N(),Pn(te,re)},{once:!0}),Rr(te,"loadstart",()=>{Se||(fe=!Number.isFinite(te.duration)),Pn(te,re)},{once:!0}),Se&&Se.once(lr.Events.LEVEL_LOADED,($,R)=>{var p;fe=(p=R.details.live)!=null?p:!1}),!re){let $=()=>{!fe||(Se!=null&&Se.liveSyncPosition?te.currentTime=Se.liveSyncPosition:Number.isFinite(te.seekable.end(0))&&(te.currentTime=te.seekable.end(0)))};Se&&Rr(te,"play",()=>{te.preload==="metadata"?Se.once(lr.Events.LEVEL_UPDATED,$):$()},{once:!0})}return $=>{De||(re=sa($)?$:!!$,Pn(te,re))}},Pn=(X,te)=>{if(!te)return;let Se=X.muted,De=()=>X.muted=Se;switch(te){case Xi.ANY:X.play().catch(()=>{X.muted=!0,X.play().catch(De)});break;case Xi.MUTED:X.muted=!0,X.play().catch(De);break;default:X.play().catch(()=>{});break}};var la=({preload:X,src:te},Se,De)=>{let fe=w=>{w!=null&&["","none","metadata","auto"].includes(w)?Se.setAttribute("preload",w):Se.removeAttribute("preload")};if(!De)return fe(X),fe;let re=!1,N=!1,B=De.config.maxBufferLength,$=De.config.maxBufferSize,R=w=>{fe(w);let k=w!=null?w:Se.preload;N||k==="none"||(k==="metadata"?(De.config.maxBufferLength=1,De.config.maxBufferSize=1):(De.config.maxBufferLength=B,De.config.maxBufferSize=$),p())},p=()=>{!re&&te&&(re=!0,De.loadSource(te))};return Rr(Se,"play",()=>{N=!0,De.config.maxBufferLength=B,De.config.maxBufferSize=$,p()},{once:!0}),R(X),R};function ua(X,te){te.on(lr.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(fe,{tracks:re})=>{re.forEach(N=>{var R;let B=(R=N.subtitleTrack)!=null?R:N.closedCaptions,$=te.subtitleTracks.findIndex(({lang:p,name:w,type:k})=>p==(B==null?void 0:B.lang)&&w===N.label&&k.toLowerCase()===N.kind);Cn(X,N.kind,N.label,B==null?void 0:B.lang,`${N.kind}${$}`)})});let Se=()=>{var N;if(!te.subtitleTracks.length)return;let fe=Array.from(X.textTracks).find(B=>B.id&&B.mode==="showing"&&["subtitles","captions"].includes(B.kind)),re=`${(N=te.subtitleTracks[te.subtitleTrack])==null?void 0:N.type.toLowerCase()}${te.subtitleTrack}`;if(fe&&(te.subtitleTrack<0||(fe==null?void 0:fe.id)!==re)){let B=te.subtitleTracks.findIndex(({lang:$,name:R,type:p})=>$==fe.language&&R===fe.label&&p.toLowerCase()===fe.kind);te.subtitleTrack=B}fe&&(fe==null?void 0:fe.id)===re&&fe.cues&&Array.from(fe.cues).forEach(B=>{fe.addCue(B)})};X.textTracks.addEventListener("change",Se),te.on(lr.Events.CUES_PARSED,(fe,{track:re,cues:N})=>{let B=X.textTracks.getTrackById(re);if(!B)return;let $=B.mode==="disabled";$&&(B.mode="hidden"),N.forEach(R=>{var p;(p=B.cues)!=null&&p.getCueById(R.id)||B.addCue(R)}),$&&(B.mode="disabled")}),te.once(lr.Events.DESTROYING,()=>{X.textTracks.removeEventListener("change",Se),X.querySelectorAll("track[data-removeondestroy]").forEach(re=>{re.remove()})});let De=()=>{Array.from(X.textTracks).forEach(fe=>{var re,N;if(!["subtitles","caption"].includes(fe.kind)&&fe.label==="thumbnails"){if(!((re=fe.cues)!=null&&re.length)){let B=X.querySelector('track[label="thumbnails"]'),$=(N=B==null?void 0:B.getAttribute("src"))!=null?N:"";B==null||B.removeAttribute("src"),setTimeout(()=>{B==null||B.setAttribute("src",$)},0)}fe.mode!=="hidden"&&(fe.mode="hidden")}})};te.once(lr.Events.MANIFEST_LOADED,De),te.once(lr.Events.MEDIA_ATTACHED,De)}function Cn(X,te,Se,De,fe){let re=document.createElement("track");return re.kind=te,re.label=Se,De&&(re.srclang=De),fe&&(re.id=fe),re.track.mode=["subtitles","captions"].includes(te)?"disabled":"hidden",re.setAttribute("data-removeondestroy",""),X.append(re),re.track}function Ja(X,te){let Se=Array.prototype.find.call(X.querySelectorAll("track"),De=>De.track===te);Se==null||Se.remove()}var Pi="cuepoints",xn=Object.freeze({label:Pi}),Ji=(X,{label:te=Pi}=xn)=>{var Se;return(Se=Array.from(X.querySelectorAll("track")).find(De=>De.track.label===te&&De.track.kind==="metadata"))==null?void 0:Se.track};async function da(X,te,Se=xn){let De=Ji(X,Se);if(!De){let{label:fe=Pi}=Se;De=Cn(X,"metadata",fe),De.mode="hidden",await new Promise(re=>setTimeout(()=>re(void 0),0))}return De.mode!=="hidden"&&(De.mode="hidden"),[...te].sort(({time:fe},{time:re})=>re-fe).forEach(({time:fe,value:re})=>{var w,k;let N=Array.prototype.findIndex.call(De==null?void 0:De.cues,ve=>ve.startTime>=fe),B=(w=De==null?void 0:De.cues)==null?void 0:w[N],$=B?B.startTime:Number.isFinite(X.duration)?X.duration:Number.MAX_SAFE_INTEGER,R=(k=De==null?void 0:De.cues)==null?void 0:k[N-1];R&&(R.endTime=fe);let p=new VTTCue(fe,$,JSON.stringify(re!=null?re:null));De.addCue(p)}),De}var ca=X=>({time:X.startTime,value:JSON.parse(X.text)});function $a(X,te={label:Pi}){let Se=Ji(X,te);return Se!=null&&Se.cues?Array.from(Se.cues,De=>ca(De)):[]}function ha(X,te={label:Pi}){var De;let Se=Ji(X,te);if(!!((De=Se==null?void 0:Se.activeCues)!=null&&De.length))return ca(Se.activeCues[0])}async function fa(X,te=xn){return new Promise(Se=>{Rr(X,"loadstart",async()=>{let De=await da(X,[],te);Rr(X,"cuechange",()=>{let fe=ha(X);if(fe){let re=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:fe});X.dispatchEvent(re)}},{},De),Se(De)})})}var va,pa,Za=(pa=(va=globalThis==null?void 0:globalThis.navigator)==null?void 0:va.userAgent)!=null?pa:"",es=Za.toLowerCase().indexOf("android")!==-1,fi=new WeakMap,ya="mux.com",ga,ma,Ea=(ma=(ga=lr).isSupported)==null?void 0:ma.call(ga),ts=es,Hs=()=>$i.default.utils.now(),rs=$i.default.utils.generateUUID,Gs=(X,{domain:te=ya,maxResolution:Se=""}={})=>{if(!X)return;let[De,fe=""]=aa(X),re=new URL(`https://stream.${te}/${De}.m3u8${fe}`);return Se&&re.searchParams.set("max_resolution",Se),re.toString()},is=X=>{if(!X)return;let[te]=X.split("?");return te||void 0},ns=X=>{if(!X||!X.startsWith("https://stream."))return;let[te]=new URL(X).pathname.slice(1).split(".m3u8");return te||void 0},as=X=>{var te,Se,De;return(te=X==null?void 0:X.metadata)!=null&&te.video_id?X.metadata.video_id:ba(X)&&(De=(Se=is(X.playbackId))!=null?Se:ns(X.src))!=null?De:X.src},js=X=>{var te;return(te=fi.get(X))==null?void 0:te.error},Ks=(X,te,Se)=>{ss(te,Se);let{metadata:De={}}=X,{view_session_id:fe=rs()}=De,re=as(X);De.view_session_id=fe,De.video_id=re,X.metadata=De,fi.set(te,{});let N=os(X,te);us(X,te,N),ds(X,te,N),fa(te);let B=oa(X,te,N),$=la(X,te,N);return{engine:N,setAutoplay:B,setPreload:$}},ss=(X,te)=>{let Se=te==null?void 0:te.engine;Se&&(Se.detachMedia(),Se.destroy()),(X==null?void 0:X.mux)&&!X.mux.deleted&&(X.mux.destroy(),delete X.mux),X&&(X.removeAttribute("src"),X.load(),X.removeEventListener("error",Sa),X.removeEventListener("error",On),X.removeEventListener("durationchange",_a),fi.delete(X),X.dispatchEvent(new Event("teardown")))};function Ta(X,te){var R;let Se=In(X);if(!(Se===Vr.M3U8))return!0;let fe=!Se||((R=te.canPlayType(Se))!=null?R:!0),{preferPlayback:re}=X,N=re===Rn.MSE,B=re===Rn.NATIVE;return fe&&(B||!(Ea&&(N||ts)))}var os=(X,te)=>{let{debug:Se,streamType:De,startTime:fe=-1,metadata:re,preferCmcd:N}=X,$=In(X)===Vr.M3U8,R=Ta(X,te);if($&&!R&&Ea){let p={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0},w=ls(De),k=N!==zi.NONE?{useHeaders:N===zi.HEADER,sessionId:re.view_session_id,contentId:re.video_id}:void 0;return new lr({debug:Se,startPosition:fe,cmcd:k,...p,...w})}},ls=X=>[Ii.LIVE,Ii.DVR].includes(X)?{backBufferLength:8}:[Ii.LL_LIVE,Ii.LL_DVR].includes(X)?{backBufferLength:4,maxFragLookUpTolerance:.001}:{},ba=({playbackId:X,src:te,customDomain:Se})=>{if(X)return!0;if(typeof te!="string")return!1;let De=window==null?void 0:window.location.href,fe=new URL(te,De).hostname.toLocaleLowerCase();return fe.includes(ya)||!!Se&&fe.includes(Se.toLocaleLowerCase())},us=(X,te,Se)=>{var re;let{envKey:De}=X,fe=ba(X);if(De||fe){let{playerInitTime:N,playerSoftwareName:B,playerSoftwareVersion:$,beaconCollectionDomain:R,debug:p,disableCookies:w}=X,k={...X.metadata,video_title:((re=X==null?void 0:X.metadata)==null?void 0:re.video_title)||void 0},ve=Z=>typeof Z.player_error_code=="string"?!1:typeof X.errorTranslator=="function"?X.errorTranslator(Z):Z;$i.default.monitor(te,{debug:p,beaconCollectionDomain:R,hlsjs:Se,Hls:Se?lr:void 0,automaticErrorTracking:!1,errorTranslator:ve,disableCookies:w,data:{...De?{env_key:De}:{},player_software_name:B,player_software:B,player_software_version:$,player_init_time:N,...k}})}},ds=(X,te,Se)=>{var re;let De=Ta(X,te),{src:fe}=X;te&&De?(typeof fe=="string"?(te.setAttribute("src",fe),X.startTime&&(((re=fi.get(te))!=null?re:{}).startTime=X.startTime,te.addEventListener("durationchange",_a,{once:!0}))):te.removeAttribute("src"),te.addEventListener("error",Sa),te.addEventListener("error",On),te.addEventListener("emptied",()=>{te.querySelectorAll("track[data-removeondestroy]").forEach(B=>{B.remove()})},{once:!0})):Se&&fe?(Se.on(lr.Events.ERROR,(N,B)=>{let $={[lr.ErrorTypes.NETWORK_ERROR]:ur.MEDIA_ERR_NETWORK,[lr.ErrorTypes.MEDIA_ERROR]:ur.MEDIA_ERR_DECODE},R=new ur("",$[B.type]);R.fatal=B.fatal,R.data=B,te.dispatchEvent(new CustomEvent("error",{detail:R}))}),te.addEventListener("error",On),ua(te,Se),Se.attachMedia(te)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function _a(X){var De;let te=X.target,Se=(De=fi.get(te))==null?void 0:De.startTime;if(!!Se&&na(te.seekable,te.duration,Se)){let fe=te.preload==="auto";fe&&(te.preload="none"),te.currentTime=Se,fe&&(te.preload="auto")}}async function Sa(X){if(!X.isTrusted)return;X.stopImmediatePropagation();let te=X.target;if(!(te!=null&&te.error))return;let{message:Se,code:De}=te.error,fe=new ur(Se,De);if(te.src&&(De!==ur.MEDIA_ERR_DECODE||De!==void 0))try{let{status:re}=await fetch(te.src);fe.data={response:{code:re}}}catch{}te.dispatchEvent(new CustomEvent("error",{detail:fe}))}function On(X){var De,fe;if(!(X instanceof CustomEvent)||!(X.detail instanceof ur))return;let te=X.target,Se=X.detail;!Se||!Se.fatal||(((De=fi.get(te))!=null?De:{}).error=Se,(fe=te.mux)==null||fe.emit("error",{player_error_code:Se.code,player_error_message:Se.message}))}var export_mux=$i.default;export{Xi as AutoplayTypes,vs as CmcdTypeValues,zi as CmcdTypes,Vr as ExtensionMimeTypeMap,lr as Hls,ur as MediaError,Qi as MimeTypeShorthandMap,Rn as PlaybackTypes,Ii as StreamTypes,da as addCuePoints,Cn as addTextTrack,gs as allMediaTypes,Hs as generatePlayerInitTime,rs as generateUUID,ha as getActiveCuePoint,$a as getCuePoints,Ji as getCuePointsTrack,js as getError,ls as getStreamTypeConfig,Ks as initialize,Dn as isKeyOf,ba as isMuxVideoSrc,ds as loadMedia,export_mux as mux,Ja as removeTextTrack,fa as setupCuePoints,os as setupHls,us as setupMux,ps as shorthandKeys,ss as teardown,Gs as toMuxVideoURL};
|
|
33
33
|
/*!
|
|
34
34
|
* JavaScript Cookie v2.1.3
|
|
35
35
|
* https://github.com/js-cookie/js-cookie
|