=r&&n(t,s,a.flush().buffer,e)):n(t,s,u.buffer,e),l()}).catch(()=>Promise.reject());return l()}}function ux(i,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ce({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function cx(i){const e=dx.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function hx(i){const e=i.get("Content-Range");if(e){const s=cx(e);if(Q(s))return s}const t=i.get("Content-Length");if(t)return parseInt(t)}function fx(i,e){return new self.Request(i.url,e)}class mx extends Error{constructor(e,t,s){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=s}}const px=/^age:\s*[\d.]+\s*$/im;class vy{constructor(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=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Mf,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const 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()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,s){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=s,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const s=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return n(s,t.url)}).catch(a=>{if(!(this.loader!==s||this.stats.aborted))return s.open("GET",t.url,!0),n(s,t.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,t,e)}).catch(a=>{var o;(o=this.callbacks)==null||o.onError({code:s.status,text:a.message},t,s,r)}):this.openAndSendXhr(s,t,e)}openAndSendXhr(e,t,s){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=s.loadPolicy;if(r)for(const o in r)e.setRequestHeader(o,r[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),s.timeout=n&&Q(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:s}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!s.aborted&&r>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const d=t.status,u=t.responseType==="text"?t.responseText:null;if(d>=200&&d<300){const m=u??t.response;if(m!=null){var a,o;s.loading.end=Math.max(self.performance.now(),s.loading.first);const p=t.responseType==="arraybuffer"?m.byteLength:m.length;s.loaded=s.total=p,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const g=(a=this.callbacks)==null?void 0:a.onProgress;g&&g(s,e,m,t);const v={url:t.responseURL,data:m,code:d};(o=this.callbacks)==null||o.onSuccess(v,s,e,t);return}}const c=n.loadPolicy.errorRetry,h=s.retry,f={url:e.url,data:void 0,code:d};if(Md(c,h,!1,f))this.retry(c);else{var l;xe.error(`${d} while loading ${e.url}`),(l=this.callbacks)==null||l.onError({code:d,text:t.statusText},e,t,s)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Md(e,t,!0))this.retry(e);else{var s;xe.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:s}=this;this.retryDelay=Uf(e,s.retry),s.retry++,xe.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t?.url}, retrying ${s.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&px.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const gx={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},vx=Le(Le({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:vy,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:k1,bufferController:yL,capLevelController:pu,errorController:P1,fpsController:bR,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:pE,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:gx},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Ex()),{},{subtitleStreamController:wR,subtitleTrackController:AR,timelineController:rx,audioStreamController:pL,audioTrackController:gL,emeController:Rn,cmcdController:gR,contentSteeringController:ER,interstitialsController:CR});function Ex(){return{cueHandler:ox,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function yx(i,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const s=th(i),r=["manifest","level","frag"],n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(a=>{const o=`${a==="level"?"playlist":a}LoadPolicy`,l=e[o]===void 0,d=[];n.forEach(u=>{const c=`${a}Loading${u}`,h=e[c];if(h!==void 0&&l){d.push(c);const f=s[o].default;switch(e[o]={default:f},u){case"TimeOut":f.maxLoadTimeMs=h,f.maxTimeToFirstByteMs=h;break;case"MaxRetry":f.errorRetry.maxNumRetry=h,f.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":f.errorRetry.retryDelayMs=h,f.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=h,f.timeoutRetry.maxRetryDelayMs=h;break}}}),d.length&&t.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${o}": ${Pe(e[o])}`)}),Le(Le({},s),e)}function th(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(th):Object.keys(i).reduce((e,t)=>(e[t]=th(i[t]),e),{}):i}function bx(i,e){const t=i.loader;t!==Bg&&t!==vy?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):lx()&&(i.loader=Bg,i.progressive=!0,i.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const pl=2,Tx=.1,_x=.05,Ax=100;class Sx extends uE{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var s;(s=this.media)!=null&&s.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var s;this.ended=((s=this.media)==null?void 0:s.currentTime)||1,this.hls.trigger(E.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(Ax),this.mediaSource=t.mediaSource;const s=this.media=t.media;Rt(s,"playing",this.onMediaPlaying),Rt(s,"waiting",this.onMediaWaiting),Rt(s,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:s}=this;s&&(Ct(s,"playing",this.onMediaPlaying),Ct(s,"waiting",this.onMediaWaiting),Ct(s,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var s,r;const n=(s=this.hls)==null?void 0:s.config;if(!n)return;const a=this.media;if(!a)return;const{seeking:o}=a,l=this.seeking&&!o,d=!this.seeking&&o,u=a.paused&&!o||a.ended||a.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,n.nudgeOnVideoHole&&!u&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(d||l){l&&this.stallResolved(e);return}if(u){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&a.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(E.MEDIA_ENDED,{stalled:!1}));return}if(!de.getBuffered(a).length){this.nudgeRetry=0;return}const c=de.bufferInfo(a,e,0),h=c.nextStart||0,f=this.fragmentTracker;if(o&&f&&this.hls){const L=Hg(this.hls.inFlightFragments,e),S=c.len>pl,R=!h||L||h-e>pl&&!f.getPartialFragment(e);if(S||R)return;this.moved=!1}const m=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&f){if(!(c.len>0)&&!h)return;const S=Math.max(h,c.start||0)-e,x=!!(m!=null&&m.live)?m.targetduration*2:pl,I=Bo(e,f);if(S>0&&(S<=x||I)){a.paused||this._trySkipBufferHole(I);return}}const p=n.detectStallWithCurrentTimeMs,g=self.performance.now(),v=this.waiting;let b=this.stalled;if(b===null)if(v>0&&g-v=p||v)&&this.hls){var T;if(((T=this.mediaSource)==null?void 0:T.readyState)==="ended"&&!(m!=null&&m.live)&&Math.abs(e-(m?.edge||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(E.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(c),!this.media||!this.hls)return}const A=de.bufferInfo(a,e,n.maxBufferHole);this._tryFixBufferStall(A,y,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const s=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(s)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(E.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var s;const r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(s=this.buffered.audio)!=null&&s.length&&r&&r.length>1&&e>r.end(0)){const n=de.bufferedInfo(de.timeRangesToArray(this.buffered.audio),e,0);if(n.len>1&&t>=n.start){const a=de.timeRangesToArray(r),o=de.bufferedInfo(a,t,0).bufferedIndex;if(o>-1&&oo)&&u-d<1&&e-d<2){const c=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${d} -> ${u} buffered index: ${l}`);this.warn(c.message),this.media.currentTime+=1e-6;let h=Bo(e,this.fragmentTracker);h&&"fragment"in h?h=h.fragment:h||(h=void 0);const f=de.bufferInfo(this.media,e,0);this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:c,reason:c.message,frag:h,buffer:f.len,bufferInfo:f})}}}}}_tryFixBufferStall(e,t,s){var r,n;const{fragmentTracker:a,media:o}=this,l=(r=this.hls)==null?void 0:r.config;if(!o||!a||!l)return;const d=(n=this.hls)==null?void 0:n.latestLevelDetails,u=Bo(s,a);if((u||d!=null&&d.live&&s1&&e.len>l.maxBufferHole||e.nextStart&&(e.nextStart-sl.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const s=this.fragmentTracker,r=e.nextStart;if(s&&r){const n=s.getFragAtPos(t,X.MAIN),a=s.getFragAtPos(r,X.MAIN);if(n&&a)return a.sn-n.sn<2}return!1}_reportStall(e){const{hls:t,media:s,stallReported:r,stalled:n}=this;if(!r&&n!==null&&s&&t){this.stallReported=!0;const a=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${Pe(e)})`);this.warn(a.message),t.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len,bufferInfo:e,stalled:{start:n}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:s,media:r}=this,n=(t=this.hls)==null?void 0:t.config;if(!r||!s||!n)return 0;const a=r.currentTime,o=de.bufferInfo(r,a,0),l=a0&&o.len<1&&r.readyState<3,h=l-a;if(h>0&&(u||c)){if(h>n.maxBufferHole){let m=!1;if(a===0){const p=s.getAppendedFrag(0,X.MAIN);p&&l"u"))return self.VTTCue||self.TextTrackCue}function fc(i,e,t,s,r){let n=new i(e,t,"");try{n.value=s,r&&(n.type=r)}catch{n=new i(e,t,Pe(r?Le({type:r},s):s))}return n}const Ho=(()=>{const i=ih();try{i&&new i(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Lx{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(E.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var s;this.media=t.media,((s=t.overrides)==null?void 0:s.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&yn(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tHo&&(c=Ho),c-u<=0&&(c=u+Ix);for(let f=0;fu.type===Wt.audioId3&&l:r==="video"?d=u=>u.type===Wt.emsg&&o:d=u=>u.type===Wt.audioId3&&l||u.type===Wt.emsg&&o,Jc(n,t,s,d)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:s,timelineOffset:r,enableDateRangeMetadataCues:n,interstitialsController:a}=this.hls.config;if(!n)return;const o=ih();if(s&&r&&!a){const{fragmentStart:p,fragmentEnd:g}=e;let v=this.assetCue;v?(v.startTime=p,v.endTime=g):o&&(v=this.assetCue=fc(o,p,g,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),v&&(v.id=s,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(v),v.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:l}=this,{dateRanges:d}=e,u=Object.keys(d);let c=this.dateRangeCuesAppended;if(l&&t){var h;if((h=l.cues)!=null&&h.length){const p=Object.keys(c).filter(g=>!u.includes(g));for(let g=p.length;g--;){var f;const v=p[g],b=(f=c[v])==null?void 0:f.cues;delete c[v],b&&Object.keys(b).forEach(y=>{const T=b[y];if(T){T.removeEventListener("enter",this.onEventCueEnter);try{l.removeCue(T)}catch{}}})}}else c=this.dateRangeCuesAppended={}}const m=e.fragments[e.fragments.length-1];if(!(u.length===0||!Q(m?.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let p=0;p{if(F!==v.id){const V=d[F];if(V.class===v.class&&V.startDate>v.startDate&&(!M||v.startDate.01&&(F.startTime=b,F.endTime=L);else if(o){let V=v.attr[M];j1(M)&&(V=Vv(V));const H=fc(o,b,L,{key:M,data:V},Wt.dateRange);H&&(H.id=g,this.id3Track.addCue(H),T[M]=H,a&&(M==="X-ASSET-LIST"||M==="X-ASSET-URL")&&H.addEventListener("enter",this.onEventCueEnter))}}c[g]={cues:T,dateRange:v,durationKnown:A}}}}}class Rx{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,s=this.levelDetails;if(!t||!s)return;this.currentTime=t.currentTime;const r=this.computeLatency();if(r===null)return;this._latency=r;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:a}=this.config;if(!n||a===1||!s.live)return;const o=this.targetLatency;if(o===null)return;const l=r-o,d=Math.min(this.maxLatency,o+s.targetduration);if(l.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,a)),h=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20,f=Math.min(c,Math.max(1,h));this.changeMediaPlaybackRate(t,f)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:s,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let d=o&&s||t;(this._targetLatencyUpdated||l.liveSyncDuration||l.liveSyncDurationCount||d===0)&&(d=n!==void 0?n:a*r);const u=r;return d+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const s=this.levelDetails;if(s===null)return null;const r=s.edge,n=e-t-this.edgeStalled,a=r-s.totalduration,o=r-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(a,n),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const s=e.buffered.length;return(s?e.buffered.end(s-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var s;t.details===w.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(s=this.levelDetails)!=null&&s.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var s,r;e.playbackRate!==t&&((s=this.hls)==null||s.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(r=this.targetLatency)==null?void 0:r.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class xx extends Qf{constructor(e,t){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const s=this.hls.config.preferManagedMediaSource,r=[],n={},a={};let o=!1,l=!1,d=!1;t.levels.forEach(u=>{const c=u.attrs;let{audioCodec:h,videoCodec:f}=u;h&&(u.audioCodec=h=kd(h,s)||void 0),f&&(f=u.videoCodec=u1(f));const{width:m,height:p,unknownCodecs:g}=u,v=g?.length||0;if(o||(o=!!(m&&p)),l||(l=!!f),d||(d=!!h),v||h&&!this.isAudioSupported(h)||f&&!this.isVideoSupported(f)){this.log(`Some or all CODECS not supported "${c.CODECS}"`);return}const{CODECS:b,"FRAME-RATE":y,"HDCP-LEVEL":T,"PATHWAY-ID":A,RESOLUTION:L,"VIDEO-RANGE":S}=c,x=`${`${A||"."}-`}${u.bitrate}-${L}-${y}-${b}-${S}-${T}`;if(n[x])if(n[x].uri!==u.url&&!u.attrs["PATHWAY-ID"]){const I=a[x]+=1;u.attrs["PATHWAY-ID"]=new Array(I+1).join(".");const M=this.createLevel(u);n[x]=M,r.push(M)}else n[x].addGroupId("audio",c.AUDIO),n[x].addGroupId("text",c.SUBTITLES);else{const I=this.createLevel(u);n[x]=I,a[x]=1,r.push(I)}}),this.filterAndSortMediaOptions(r,t,o,l,d)}createLevel(e){const t=new eo(e),s=e.supplemental;if(s!=null&&s.videoCodec&&!this.isVideoSupported(s.videoCodec)){const r=new Error(`SUPPLEMENTAL-CODECS not supported "${s.videoCodec}"`);this.log(r.message),t.supportedResult=iE(r,[])}return t}isAudioSupported(e){return Za(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Za(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,s,r,n){var a;let o=[],l=[],d=e;const u=((a=t.stats)==null?void 0:a.parsing)||{};if((s||r)&&n&&(d=d.filter(({videoCodec:b,videoRange:y,width:T,height:A})=>(!!b||!!(T&&A))&&b1(y))),d.length===0){Promise.resolve().then(()=>{if(this.hls){let b="no level with compatible codecs found in manifest",y=b;t.levels.length&&(y=`one or more CODECS in variant not supported: ${Pe(t.levels.map(A=>A.attrs.CODECS).filter((A,L,S)=>S.indexOf(A)===L))}`,this.warn(y),b+=` (${y})`);const T=new Error(b);this.hls.trigger(E.ERROR,{type:te.MEDIA_ERROR,details:w.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:T,reason:y})}}),u.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(b=>!b.audioCodec||this.isAudioSupported(b.audioCodec)),Kg(o)),t.subtitles&&(l=t.subtitles,Kg(l));const c=d.slice(0);d.sort((b,y)=>{if(b.attrs["HDCP-LEVEL"]!==y.attrs["HDCP-LEVEL"])return(b.attrs["HDCP-LEVEL"]||"")>(y.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&b.height!==y.height)return b.height-y.height;if(b.frameRate!==y.frameRate)return b.frameRate-y.frameRate;if(b.videoRange!==y.videoRange)return Dd.indexOf(b.videoRange)-Dd.indexOf(y.videoRange);if(b.videoCodec!==y.videoCodec){const T=Pp(b.videoCodec),A=Pp(y.videoCodec);if(T!==A)return A-T}if(b.uri===y.uri&&b.codecSet!==y.codecSet){const T=xd(b.codecSet),A=xd(y.codecSet);if(T!==A)return A-T}return b.averageBitrate!==y.averageBitrate?b.averageBitrate-y.averageBitrate:0});let h=c[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==c.length)){for(let b=0;bT&&T===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=A)}break}const m=n&&!r,p=this.hls.config,g=!!(p.audioStreamController&&p.audioTrackController),v={levels:d,audioTracks:o,subtitleTracks:l,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:g&&!m&&o.some(b=>!!b.url)};u.end=performance.now(),this.hls.trigger(E.MANIFEST_PARSED,v)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const u=new Error("invalid level idx"),c=e<0;if(this.hls.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.LEVEL_SWITCH_ERROR,level:e,fatal:c,error:u,reason:u.message}),c)return;e=Math.min(e,t.length-1)}const s=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,s===e&&r&&n===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${s}${n?" with Pathway "+n:""}`);const l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(E.LEVEL_SWITCHING,l);const d=a.details;if(!d||d.live){const u=this.switchParams(a.uri,r?.details,d);this.loadPlaylist(u)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),s=e.filter(r=>t.indexOf(r)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=s}}onError(e,t){t.fatal||!t.context||t.context.type===me.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===X.MAIN){const s=t.elementaryStreams;if(!Object.keys(s).some(n=>!!s[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var s;const{level:r,details:n}=t,a=t.levelInfo;if(!a){var o;this.warn(`Invalid level index ${r}`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}if(a===this.currentLevel||t.withoutMultiVariant){a.fragmentError===0&&(a.loadError=0);let l=a.details;l===t.details&&l.advanced&&(l=void 0),this.playlistLoaded(r,t,l)}else(s=t.deliveryDirectives)!=null&&s.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const s=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,n=e.attrs["PATHWAY-ID"],a=e.details,o=a?.age;this.log(`Loading level index ${r}${t?.msn!==void 0?" at sn "+t.msn+" part "+t.part:""}${n?" Pathway "+n:""}${o&&a.live?" age "+o.toFixed(1)+(a.type&&" "+a.type||""):""} ${s}`),this.hls.trigger(E.LEVEL_LOADING,{url:s,level:r,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const s=this._levels.filter((n,a)=>a!==e?!0:(this.steering&&this.steering.removeLevel(n),n===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,n.details&&n.details.fragments.forEach(o=>o.level=-1)),!1));AE(s),this._levels=s,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const r=s.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(E.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(E.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function Kg(i){const e={};i.forEach(t=>{const s=t.groupId||"";t.id=e[s]=e[s]||0,e[s]++})}function Ey(){return self.SourceBuffer||self.WebKitSourceBuffer}function yy(){if(!Ks())return!1;const e=Ey();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function kx(){if(!yy())return!1;const i=Ks();return typeof i?.isTypeSupported=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>i.isTypeSupported(Ja(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(Ja(e,"audio"))))}function Dx(){var i;const e=Ey();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}const Cx=100;class wx extends Gf{constructor(e,t,s){super(e,t,s,"stream-controller",X.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const r=this.media,n=r?r.currentTime:null;if(n===null||!Q(n)||(this.log(`Media seeked to ${n.toFixed(3)}`),!this.getBufferedFrag(n)))return;const a=this.getFwdBufferInfoAtPos(r,n,X.MAIN,0);if(a===null||a.len===0){this.warn(`Main forward buffer length at ${n} on "seeked" event ${a?a.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:s,hls:r}=this;if(this.stopLoad(),this.setInterval(Cx),this.level=-1,!this.startFragRequested){let n=r.startLevel;n===-1&&(r.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=r.firstAutoLevel),r.nextLoadLevel=n,this.level=r.loadLevel,this._hasEnoughToStart=!!t}s>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),e=s),this.state=P.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=P.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case P.WAITING_LEVEL:{const{levels:e,level:t}=this,s=e?.[t],r=s?.details;if(r&&(!r.live||this.levelLastLoaded===s&&!this.waitForLive(s))){if(this.waitForCdnTuneIn(r))break;this.state=P.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=P.IDLE;break}break}case P.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===P.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:s,media:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(s!=null&&s[n]))return;const a=s[n],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const p={};this.altAudio===2&&(p.type="video"),this.hls.trigger(E.BUFFER_EOS,p),this.state=P.ENDED;return}if(!this.buffering)return;e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const d=a.details;if(!d||this.state===P.WAITING_LEVEL||this.waitForLive(a)){this.level=n,this.state=P.WAITING_LEVEL,this.startFragRequested=!1;return}const u=o.len,c=this.getMaxBufferLength(a.maxBitrate);if(u>=c)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:o.end;let f=this.getNextFragment(h,d);if(this.couldBacktrack&&!this.fragPrevious&&f&&ze(f)&&this.fragmentTracker.getState(f)!==dt.OK){var m;const g=((m=this.backtrackFragment)!=null?m:f).sn-d.startSN,v=d.fragments[g-1];v&&f.cc===v.cc&&(f=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,h)){if(!f.gap){const g=this.audioOnly&&!this.altAudio?Me.AUDIO:Me.VIDEO,v=(g===Me.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,g,X.MAIN)}f=this.getNextFragmentLoopLoading(f,d,o,X.MAIN,c)}f&&(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,a,h))}loadFragment(e,t,s){const r=this.fragmentTracker.getState(e);r===dt.NOT_LOADED||r===dt.PARTIAL?ze(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,s):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,X.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let s;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const o=this.getMainFwdBufferInfo();if(!o||o.len=a-t.maxFragLookUpTolerance&&n<=o;if(r!==null&&s.duration>r&&(n{this.hls&&this.hls.trigger(E.AUDIO_TRACK_SWITCHED,t)}),s.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(E.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const s=Cd(t.url,this.hls);if(s){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=s?2:0,this.tick()}onBufferCreated(e,t){const s=t.tracks;let r,n,a=!1;for(const o in s){const l=s[o];if(l.id==="main"){if(n=o,r=l,o==="video"){const d=s[o];d&&(this.videoBuffer=d.buffer)}}else a=!0}a&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:s,part:r}=t,n=s.type===X.MAIN;if(n){if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${r?" p: "+r.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===P.PARSED&&(this.state=P.IDLE);return}const o=r?r.stats:s.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),ze(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,r)}const a=this.media;a&&(!this._hasEnoughToStart&&de.getBuffered(a).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var s;if(t.fatal){this.state=P.ERROR;return}switch(t.details){case w.FRAG_GAP:case w.FRAG_PARSING_ERROR:case w.FRAG_DECRYPT_ERROR:case w.FRAG_LOAD_ERROR:case w.FRAG_LOAD_TIMEOUT:case w.KEY_LOAD_ERROR:case w.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(X.MAIN,t);break;case w.LEVEL_LOAD_ERROR:case w.LEVEL_LOAD_TIMEOUT:case w.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===P.WAITING_LEVEL&&((s=t.context)==null?void 0:s.type)===me.LEVEL&&(this.state=P.IDLE);break;case w.BUFFER_ADD_CODEC_ERROR:case w.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case w.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case w.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=P.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Me.AUDIO||!this.altAudio){const s=(t===Me.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,t,X.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let s=this.startPosition;if(s>=0&&t0&&(l{const{hls:r}=this,n=s?.frag;if(!n||this.fragContextChanged(n))return;t.fragmentError=0,this.state=P.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const a=n.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),r.trigger(E.FRAG_LOADED,s),n.bitrateTest=!1}).catch(s=>{this.state===P.STOPPED||this.state===P.ERROR||(this.warn(s),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:s}=this,{remuxResult:r,chunkMeta:n}=e,a=this.getCurrentContext(n);if(!a){this.resetWhenMissingContext(n);return}const{frag:o,part:l,level:d}=a,{video:u,text:c,id3:h,initSegment:f}=r,{details:m}=d,p=this.altAudio?void 0:r.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=P.PARSING,f){const g=f.tracks;if(g){const T=o.initSegment||o;if(this.unhandledEncryptionError(f,o))return;this._bufferInitSegment(d,g,T,n),s.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:t,tracks:g})}const v=f.initPTS,b=f.timescale,y=this.initPTS[o.cc];if(Q(v)&&(!y||y.baseTime!==v||y.timescale!==b)){const T=f.trackId;this.initPTS[o.cc]={baseTime:v,timescale:b,trackId:T},s.trigger(E.INIT_PTS_FOUND,{frag:o,id:t,initPTS:v,timescale:b,trackId:T})}}if(u&&m){p&&u.type==="audiovideo"&&this.logMuxedErr(o);const g=m.fragments[o.sn-1-m.startSN],v=o.sn===m.startSN,b=!g||o.cc>g.cc;if(r.independent!==!1){const{startPTS:y,endPTS:T,startDTS:A,endDTS:L}=u;if(l)l.elementaryStreams[u.type]={startPTS:y,endPTS:T,startDTS:A,endDTS:L};else if(u.firstKeyFrame&&u.independent&&n.id===1&&!b&&(this.couldBacktrack=!0),u.dropped&&u.independent){const S=this.getMainFwdBufferInfo(),R=(S?S.end:this.getLoadPosition())+this.config.maxBufferHole,x=u.firstKeyFramePTS?u.firstKeyFramePTS:y;if(!v&&Rpl&&(o.gap=!0);o.setElementaryStreamInfo(u.type,y,T,A,L),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(u,o,l,n,v||b)}else if(v||b)o.gap=!0;else{this.backtrack(o);return}}if(p){const{startPTS:g,endPTS:v,startDTS:b,endDTS:y}=p;l&&(l.elementaryStreams[Me.AUDIO]={startPTS:g,endPTS:v,startDTS:b,endDTS:y}),o.setElementaryStreamInfo(Me.AUDIO,g,v,b,y),this.bufferFragmentData(p,o,l,n)}if(m&&h!=null&&h.samples.length){const g={id:t,frag:o,details:m,samples:h.samples};s.trigger(E.FRAG_PARSING_METADATA,g)}if(m&&c){const g={id:t,frag:o,details:m,samples:c.samples};s.trigger(E.FRAG_PARSING_USERDATA,g)}}logMuxedErr(e){this.warn(`${ze(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,s,r){if(this.state!==P.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(s));const{audio:n,video:a,audiovideo:o}=t;if(n){const d=e.audioCodec;let u=ll(n.codec,d);u==="mp4a"&&(u="mp4a.40.5");const c=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const h=n.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&c.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&c.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),d&&d!==u&&this.log(`Swapping manifest audio codec "${d}" for "${u}"`),n.levelCodec=u,n.id=X.MAIN,this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${u||""}/${d||""}/${n.codec}]`),delete t.audiovideo}if(a){a.levelCodec=e.videoCodec,a.id=X.MAIN;const d=a.codec;if(d?.length===4)switch(d){case"hvc1":case"hev1":a.codec="hvc1.1.6.L120.90";break;case"av01":a.codec="av01.0.04M.08";break;case"avc1":a.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${d}]${a.codec!==d?" parsed-corrected="+a.codec:""}${a.supplemental?" supplemental="+a.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const l=Object.keys(t);if(l.length){if(this.hls.trigger(E.BUFFER_CODECS,t),!this.hls)return;l.forEach(d=>{const c=t[d].initSegment;c!=null&&c.byteLength&&this.hls.trigger(E.BUFFER_APPENDING,{type:d,data:c,frag:s,part:null,chunkMeta:r,parent:s.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,X.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,s=e?.[t];return s?this.getMaxBufferLength(s.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=P.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const s=e.currentTime;if(de.isBuffered(e,s)?t=this.getAppendedFrag(s):de.isBuffered(e,s+.1)&&(t=this.getAppendedFrag(s+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(E.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(E.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return Q(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(Q(t)){const s=this.getLevelDetails(),r=this.currentFrag||(s?xr(null,s.fragments,t):null);if(r){const n=r.programDateTime;if(n!==null){const a=n+(t-r.start)*1e3;return new Date(a)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Mx extends si{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const s in this.keyIdToKeyInfo){const r=this.keyIdToKeyInfo[s].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=w.KEY_LOAD_ERROR,s,r,n){return new as({type:te.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:s,networkDetails:r})}loadClear(e,t,s){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,n=t.length;r{if(!this.emeController)return;a.setKeyFormat(o);const l=ul(o);if(l)return this.emeController.getKeySystemAccess([l])})}if(this.config.requireKeySystemAccessOnStart){const r=ca(this.config);if(r.length)return this.emeController.getKeySystemAccess(r)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var s,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const d=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,d))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));const o=mc(n);let l=this.keyIdToKeyInfo[o];if((s=l)!=null&&s.decryptdata.key)return n.key=l.decryptdata.key,Promise.resolve({frag:e,keyInfo:l});if(this.emeController&&(r=l)!=null&&r.keyLoadPromise)switch(this.emeController.getKeyStatus(l.decryptdata)){case"usable":case"usable-in-future":return l.keyLoadPromise.then(u=>{const{keyInfo:c}=u;return n.key=c.decryptdata.key,{frag:e,keyInfo:c}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${n.keyId?" keyId: "+bt(n.keyId):""} URI: ${n.uri} from ${e.type} ${e.level}`),l=this.keyIdToKeyInfo[o]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(l,e):this.loadKeyEME(l,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(l,e);default:return Promise.reject(this.createKeyLoadError(e,w.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const s={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r;if(!e.decryptdata.keyId&&(r=t.initSegment)!=null&&r.data){const a=ZS(t.initSegment.data);if(a.length){let o=a[0];o.some(l=>l!==0)?(this.log(`Using keyId found in init segment ${bt(o)}`),Hs.setKeyIdForUri(e.decryptdata.uri,o)):(o=Hs.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${bt(o)}`)),e.decryptdata.keyId=o}}if(!e.decryptdata.keyId&&!ze(t))return Promise.resolve(s);const n=this.emeController.loadKey(s);return(e.keyLoadPromise=n.then(a=>(e.mediaKeySessionContext=a,s))).catch(a=>{throw e.keyLoadPromise=null,"data"in a&&(a.data.frag=t),a})}return Promise.resolve(s)}loadKeyHTTP(e,t){const s=this.config,r=s.loader,n=new r(s);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,o)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},d=s.keyLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,p)=>{const{frag:g,keyInfo:v}=m,b=mc(v.decryptdata);if(!g.decryptdata||v!==this.keyIdToKeyInfo[b])return o(this.createKeyLoadError(g,w.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),p));v.decryptdata.key=g.decryptdata.key=new Uint8Array(h.data),g.keyLoader=null,v.loader=null,a({frag:g,keyInfo:v})},onError:(h,f,m,p)=>{this.resetLoader(f),o(this.createKeyLoadError(t,w.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),m,Le({url:l.url,data:void 0},h)))},onTimeout:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,w.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,w.INTERNAL_ABORTED,new Error("key loading aborted"),m))}};n.load(l,u,c)})}resetLoader(e){const{frag:t,keyInfo:s,url:r}=e,n=s.loader;t.keyLoader===n&&(t.keyLoader=null,s.loader=null);const a=mc(s.decryptdata)||r;delete this.keyIdToKeyInfo[a],n&&n.destroy()}}function mc(i){if(i.keyFormat!==Tt.FAIRPLAY){const e=i.keyId;if(e)return bt(e)}return i.uri}function Vg(i){const{type:e}=i;switch(e){case me.AUDIO_TRACK:return X.AUDIO;case me.SUBTITLE_TRACK:return X.SUBTITLE;default:return X.MAIN}}function pc(i,e){let t=i.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Px{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,s=t.pLoader,r=t.loader,n=s||r,a=new n(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:s}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:me.MANIFEST,url:s,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:s,level:r,pathwayId:n,url:a,deliveryDirectives:o,levelInfo:l}=t;this.load({id:s,level:r,pathwayId:n,responseType:"text",type:me.LEVEL,url:a,deliveryDirectives:o,levelOrTrack:l})}onAudioTrackLoading(e,t){const{id:s,groupId:r,url:n,deliveryDirectives:a,track:o}=t;this.load({id:s,groupId:r,level:null,responseType:"text",type:me.AUDIO_TRACK,url:n,deliveryDirectives:a,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:s,groupId:r,url:n,deliveryDirectives:a,track:o}=t;this.load({id:s,groupId:r,level:null,responseType:"text",type:me.SUBTITLE_TRACK,url:n,deliveryDirectives:a,levelOrTrack:o})}onLevelsUpdated(e,t){const s=this.loaders[me.LEVEL];if(s){const r=s.context;r&&!t.levels.some(n=>n===r.levelOrTrack)&&(s.abort(),delete this.loaders[me.LEVEL])}}load(e){var t;const s=this.hls.config;let r=this.getInternalLoader(e);if(r){const d=this.hls.logger,u=r.context;if(u&&u.levelOrTrack===e.levelOrTrack&&(u.url===e.url||u.deliveryDirectives&&!e.deliveryDirectives)){u.url===e.url?d.log(`[playlist-loader]: ignore ${e.url} ongoing request`):d.log(`[playlist-loader]: ignore ${e.url} in favor of ${u.url}`);return}d.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===me.MANIFEST?n=s.manifestLoadPolicy.default:n=Ce({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),Q((t=e.deliveryDirectives)==null?void 0:t.part)){let d;if(e.type===me.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===me.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===me.SUBTITLE_TRACK&&e.id!==null&&(d=this.hls.subtitleTracks[e.id].details),d){const u=d.partTarget,c=d.targetduration;if(u&&c){const h=Math.max(u*3,c*.8)*1e3;n=Ce({},n,{maxTimeToFirstByteMs:Math.min(h,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,n.maxTimeToFirstByteMs)})}}}const a=n.errorRetry||n.timeoutRetry||{},o={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(d,u,c,h)=>{const f=this.getInternalLoader(c);this.resetInternalLoader(c.type);const m=d.data;u.parsing.start=performance.now(),Wi.isMediaPlaylist(m)||c.type!==me.MANIFEST?this.handleTrackOrLevelPlaylist(d,u,c,h||null,f):this.handleMasterPlaylist(d,u,c,h)},onError:(d,u,c,h)=>{this.handleNetworkError(u,c,!1,d,h)},onTimeout:(d,u,c)=>{this.handleNetworkError(u,c,!0,void 0,d)}};r.load(e,o,l)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:s}=this.hls;(e||s)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,s,r){const n=this.hls,a=e.data,o=pc(e,s),l=Wi.parseMasterPlaylist(a,o);if(l.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,s,l.playlistParsingError,r,t);return}const{contentSteering:d,levels:u,sessionData:c,sessionKeys:h,startTimeOffset:f,variableList:m}=l;this.variableList=m,u.forEach(b=>{const{unknownCodecs:y}=b;if(y){const{preferManagedMediaSource:T}=this.hls.config;let{audioCodec:A,videoCodec:L}=b;for(let S=y.length;S--;){const R=y[S];Za(R,"audio",T)?(b.audioCodec=A=A?`${A},${R}`:R,Fn.audio[A.substring(0,4)]=2,y.splice(S,1)):Za(R,"video",T)&&(b.videoCodec=L=L?`${L},${R}`:R,Fn.video[L.substring(0,4)]=2,y.splice(S,1))}}});const{AUDIO:p=[],SUBTITLES:g,"CLOSED-CAPTIONS":v}=Wi.parseMasterPlaylistMedia(a,o,l);p.length&&!p.some(y=>!y.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ke({}),bitrate:0,url:""})),n.trigger(E.MANIFEST_LOADED,{levels:u,audioTracks:p,subtitles:g,captions:v,contentSteering:d,url:o,stats:t,networkDetails:r,sessionData:c,sessionKeys:h,startTimeOffset:f,variableList:m})}handleTrackOrLevelPlaylist(e,t,s,r,n){const a=this.hls,{id:o,level:l,type:d}=s,u=pc(e,s),c=Q(l)?l:Q(o)?o:0,h=Vg(s),f=Wi.parseLevelPlaylist(e.data,u,c,h,0,this.variableList);if(d===me.MANIFEST){const m={attrs:new Ke({}),bitrate:0,details:f,name:"",url:u};f.requestScheduled=t.loading.start+bE(f,0),a.trigger(E.MANIFEST_LOADED,{levels:[m],audioTracks:[],url:u,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),s.levelDetails=f,this.handlePlaylistLoaded(f,e,t,s,r,n)}handleManifestParsingError(e,t,s,r,n){this.hls.trigger(E.ERROR,{type:te.NETWORK_ERROR,details:w.MANIFEST_PARSING_ERROR,fatal:t.type===me.MANIFEST,url:e.url,err:s,error:s,reason:s.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,s=!1,r,n){let a=`A network ${s?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===me.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===me.AUDIO_TRACK||e.type===me.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);this.hls.logger.warn(`[playlist-loader]: ${a}`);let l=w.UNKNOWN,d=!1;const u=this.getInternalLoader(e);switch(e.type){case me.MANIFEST:l=s?w.MANIFEST_LOAD_TIMEOUT:w.MANIFEST_LOAD_ERROR,d=!0;break;case me.LEVEL:l=s?w.LEVEL_LOAD_TIMEOUT:w.LEVEL_LOAD_ERROR,d=!1;break;case me.AUDIO_TRACK:l=s?w.AUDIO_TRACK_LOAD_TIMEOUT:w.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case me.SUBTITLE_TRACK:l=s?w.SUBTITLE_TRACK_LOAD_TIMEOUT:w.SUBTITLE_LOAD_ERROR,d=!1;break}u&&this.resetInternalLoader(e.type);const c={type:te.NETWORK_ERROR,details:l,fatal:d,url:e.url,loader:u,context:e,error:o,networkDetails:t,stats:n};if(r){const h=t?.url||e.url;c.response=Le({url:h,data:void 0},r)}this.hls.trigger(E.ERROR,c)}handlePlaylistLoaded(e,t,s,r,n,a){const o=this.hls,{type:l,level:d,levelOrTrack:u,id:c,groupId:h,deliveryDirectives:f}=r,m=pc(t,r),p=Vg(r);let g=typeof r.level=="number"&&p===X.MAIN?d:void 0;const v=e.playlistParsingError;if(v){if(this.hls.logger.warn(`${v} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(E.ERROR,{type:te.NETWORK_ERROR,details:w.LEVEL_PARSING_ERROR,fatal:!1,url:m,error:v,reason:v.message,response:t,context:r,level:g,parent:p,networkDetails:n,stats:s});return}e.playlistParsingError=null}if(!e.fragments.length){const b=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(E.ERROR,{type:te.NETWORK_ERROR,details:w.LEVEL_EMPTY_ERROR,fatal:!1,url:m,error:b,reason:b.message,response:t,context:r,level:g,parent:p,networkDetails:n,stats:s});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case me.MANIFEST:case me.LEVEL:if(g){if(!u)g=0;else if(u!==o.levels[g]){const b=o.levels.indexOf(u);b>-1&&(g=b)}}o.trigger(E.LEVEL_LOADED,{details:e,levelInfo:u||o.levels[0],level:g||0,id:c||0,stats:s,networkDetails:n,deliveryDirectives:f,withoutMultiVariant:l===me.MANIFEST});break;case me.AUDIO_TRACK:o.trigger(E.AUDIO_TRACK_LOADED,{details:e,track:u,id:c||0,groupId:h||"",stats:s,networkDetails:n,deliveryDirectives:f});break;case me.SUBTITLE_TRACK:o.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,track:u,id:c||0,groupId:h||"",stats:s,networkDetails:n,deliveryDirectives:f});break}}}class Os{static get version(){return to}static isMSESupported(){return yy()}static isSupported(){return kx()}static getMediaSource(){return Ks()}static get Events(){return E}static get MetadataSchema(){return Wt}static get ErrorTypes(){return te}static get ErrorDetails(){return w}static get DefaultConfig(){return Os.defaultConfig?Os.defaultConfig:vx}static set DefaultConfig(e){Os.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Kf,this._autoLevelCapping=-1,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.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=BS(e.debug||!1,"Hls instance",e.assetPlayerId),s=this.config=yx(Os.DefaultConfig,e,t);this.userConfig=e,s.progressive&&bx(s,t);const{abrController:r,bufferController:n,capLevelController:a,errorController:o,fpsController:l}=s,d=new o(this),u=this.abrController=new r(this),c=new O1(this),h=s.interstitialsController,f=h?this.interstitialsController=new h(this,Os):null,m=this.bufferController=new n(this,c),p=this.capLevelController=new a(this),g=new l(this),v=new Px(this),b=s.contentSteeringController,y=b?new b(this):null,T=this.levelController=new xx(this,y),A=new Lx(this),L=new Mx(this.config,this.logger),S=this.streamController=new wx(this,c,L),R=this.gapController=new Sx(this,c);p.setStreamController(S),g.setStreamController(S);const x=[v,T,S];f&&x.splice(1,0,f),y&&x.splice(1,0,y),this.networkControllers=x;const I=[u,m,R,p,g,A,c];this.audioTrackController=this.createController(s.audioTrackController,x);const M=s.audioStreamController;M&&x.push(this.audioStreamController=new M(this,c,L)),this.subtitleTrackController=this.createController(s.subtitleTrackController,x);const F=s.subtitleStreamController;F&&x.push(this.subtititleStreamController=new F(this,c,L)),this.createController(s.timelineController,I),L.emeController=this.emeController=this.createController(s.emeController,I),this.cmcdController=this.createController(s.cmcdController,I),this.latencyController=this.createController(Rx,I),this.coreComponents=I,x.push(d);const V=d.onErrorOut;typeof V=="function"&&this.on(E.ERROR,V,d),this.on(E.MANIFEST_LOADED,v.onManifestLoaded,v)}createController(e,t){if(e){const s=new e(this);return t&&t.push(s),s}return null}on(e,t,s=this){this._emitter.on(e,t,s)}once(e,t,s=this){this._emitter.once(e,t,s)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,s=this,r){this._emitter.off(e,t,s,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,s){return this._emitter.emit(e,t,s)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(s){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const r=e===E.ERROR;this.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.INTERNAL_EXCEPTION,fatal:r,event:e,error:s}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(E.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const n=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(E.ERROR,{type:te.OTHER_ERROR,details:w.ATTACH_MEDIA_ERROR,fatal:!0,error:n});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,s=t?e.media:e,r=t?e:{media:s};this._media=s,this.trigger(E.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia"),this.trigger(E.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(E.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,s=this._url,r=this._url=wf.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&s&&(s!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(E.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", ":"")})`),this.started=!0,this.resumeBuffering();for(let s=0;s{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[X.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[X.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[X.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e?.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=SR()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){y1(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const s=e.length;for(let r=0;r=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:s}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,s)for(let n=r;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=s)return n}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const s=nE(t);return sE(e,s,navigator.mediaCapabilities)}}Os.defaultConfig=void 0;var ge=Os,Re={VIDEO:"video",THUMBNAIL:"thumbnail",STORYBOARD:"storyboard",DRM:"drm"},se={NOT_AN_ERROR:0,NETWORK_OFFLINE:2000002,NETWORK_UNKNOWN_ERROR:2e6,NETWORK_NO_STATUS:2000001,NETWORK_INVALID_URL:24e5,NETWORK_NOT_FOUND:2404e3,NETWORK_NOT_READY:2412e3,NETWORK_GENERIC_SERVER_FAIL:25e5,NETWORK_TOKEN_MISSING:2403201,NETWORK_TOKEN_MALFORMED:2412202,NETWORK_TOKEN_EXPIRED:2403210,NETWORK_TOKEN_AUD_MISSING:2403221,NETWORK_TOKEN_AUD_MISMATCH:2403222,NETWORK_TOKEN_SUB_MISMATCH:2403232,ENCRYPTED_ERROR:5e6,ENCRYPTED_UNSUPPORTED_KEY_SYSTEM:5000001,ENCRYPTED_GENERATE_REQUEST_FAILED:5000002,ENCRYPTED_UPDATE_LICENSE_FAILED:5000003,ENCRYPTED_UPDATE_SERVER_CERT_FAILED:5000004,ENCRYPTED_CDM_ERROR:5000005,ENCRYPTED_OUTPUT_RESTRICTED:5000006,ENCRYPTED_MISSING_TOKEN:5000002},vu=i=>i===Re.VIDEO?"playback":i,Ss=class ha extends Error{constructor(e,t=ha.MEDIA_ERR_CUSTOM,s,r){var n;super(e),this.name="MediaError",this.code=t,this.context=r,this.fatal=s??(t>=ha.MEDIA_ERR_NETWORK&&t<=ha.MEDIA_ERR_ENCRYPTED),this.message||(this.message=(n=ha.defaultMessages[this.code])!=null?n:"")}};Ss.MEDIA_ERR_ABORTED=1,Ss.MEDIA_ERR_NETWORK=2,Ss.MEDIA_ERR_DECODE=3,Ss.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Ss.MEDIA_ERR_ENCRYPTED=5,Ss.MEDIA_ERR_CUSTOM=100,Ss.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 W=Ss,Ox=i=>i==null,tm=(i,e)=>Ox(e)?!1:i in e,sh={ANY:"any",MUTED:"muted"},Se={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},qi={MSE:"mse",NATIVE:"native"},fa={HEADER:"header",QUERY:"query",NONE:"none"},Fd=Object.values(fa),cs={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Wg={HLS:cs.M3U8};[...Object.values(cs)];var Nx="en",rh={code:Nx},lt=(i,e,t,s,r=i)=>{r.addEventListener(e,t,s),i.addEventListener("teardown",()=>{r.removeEventListener(e,t)},{once:!0})};function Ux(i,e,t){e&&t>e&&(t=e);for(let s=0;s=t)return!0;return!1}var im=i=>{let e=i.indexOf("?");if(e<0)return[i];let t=i.slice(0,e),s=i.slice(e);return[t,s]},Eu=i=>{let{type:e}=i;if(e){let t=e.toUpperCase();return tm(t,Wg)?Wg[t]:e}return $x(i)},by=i=>i==="VOD"?Se.ON_DEMAND:Se.LIVE,Ty=i=>i==="EVENT"?Number.POSITIVE_INFINITY:i==="VOD"?Number.NaN:0,$x=i=>{let{src:e}=i;if(!e)return"";let t="";try{t=new URL(e).pathname}catch{console.error("invalid url")}let s=t.lastIndexOf(".");if(s<0)return Bx(i)?cs.M3U8:"";let r=t.slice(s+1).toUpperCase();return tm(r,cs)?cs[r]:""},Fx="mux.com",Bx=({src:i,customDomain:e=Fx})=>{let t;try{t=new URL(`${i}`)}catch{return!1}let s=t.protocol==="https:",r=t.hostname===`stream.${e}`.toLowerCase(),n=t.pathname.split("/"),a=n.length===2,o=!(n!=null&&n[1].includes("."));return s&&r&&a&&o},kn=i=>{let e=(i??"").split(".")[1];if(e)try{let t=e.replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(atob(t).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(s)}catch{return}},Hx=({exp:i},e=Date.now())=>!i||i*1e3i!==e,Kx=({aud:i},e)=>!i,Vx=({aud:i},e)=>i!==e,_y="en";function ie(i,e=!0){var t,s;let r=e&&(s=(t=rh)==null?void 0:t[i])!=null?s:i,n=e?rh.code:_y;return new Wx(r,n)}var Wx=class{constructor(i,e=(t=>(t=rh)!=null?t:_y)()){this.message=i,this.locale=e}format(i){return this.message.replace(/\{(\w+)\}/g,(e,t)=>{var s;return(s=i[t])!=null?s:""})}toString(){return this.message}},qx=Object.values(sh),qg=i=>typeof i=="boolean"||typeof i=="string"&&qx.includes(i),Yx=(i,e,t)=>{let{autoplay:s}=i,r=!1,n=!1,a=qg(s)?s:!!s,o=()=>{r||lt(e,"playing",()=>{r=!0},{once:!0})};if(o(),lt(e,"loadstart",()=>{r=!1,o(),gc(e,a)},{once:!0}),lt(e,"loadstart",()=>{t||(i.streamType&&i.streamType!==Se.UNKNOWN?n=i.streamType===Se.LIVE:n=!Number.isFinite(e.duration)),gc(e,a)},{once:!0}),t&&t.once(ge.Events.LEVEL_LOADED,(l,d)=>{var u;i.streamType&&i.streamType!==Se.UNKNOWN?n=i.streamType===Se.LIVE:n=(u=d.details.live)!=null?u:!1}),!a){let l=()=>{!n||Number.isFinite(i.startTime)||(t!=null&&t.liveSyncPosition?e.currentTime=t.liveSyncPosition:Number.isFinite(e.seekable.end(0))&&(e.currentTime=e.seekable.end(0)))};t&<(e,"play",()=>{e.preload==="metadata"?t.once(ge.Events.LEVEL_UPDATED,l):l()},{once:!0})}return l=>{r||(a=qg(l)?l:!!l,gc(e,a))}},gc=(i,e)=>{if(!e)return;let t=i.muted,s=()=>i.muted=t;switch(e){case sh.ANY:i.play().catch(()=>{i.muted=!0,i.play().catch(s)});break;case sh.MUTED:i.muted=!0,i.play().catch(s);break;default:i.play().catch(()=>{});break}},jx=({preload:i,src:e},t,s)=>{let r=c=>{c!=null&&["","none","metadata","auto"].includes(c)?t.setAttribute("preload",c):t.removeAttribute("preload")};if(!s)return r(i),r;let n=!1,a=!1,o=s.config.maxBufferLength,l=s.config.maxBufferSize,d=c=>{r(c);let h=c??t.preload;a||h==="none"||(h==="metadata"?(s.config.maxBufferLength=1,s.config.maxBufferSize=1):(s.config.maxBufferLength=o,s.config.maxBufferSize=l),u())},u=()=>{!n&&e&&(n=!0,s.loadSource(e))};return lt(t,"play",()=>{a=!0,s.config.maxBufferLength=o,s.config.maxBufferSize=l,u()},{once:!0}),d(i),d};function zx(i,e){var t;if(!("videoTracks"in i))return;let s=new WeakMap;e.on(ge.Events.MANIFEST_PARSED,function(l,d){o();let u=i.addVideoTrack("main");u.selected=!0;for(let[c,h]of d.levels.entries()){let f=u.addRendition(h.url[0],h.width,h.height,h.videoCodec,h.bitrate);s.set(h,`${c}`),f.id=`${c}`}}),e.on(ge.Events.AUDIO_TRACKS_UPDATED,function(l,d){a();for(let u of d.audioTracks){let c=u.default?"main":"alternative",h=i.addAudioTrack(c,u.name,u.lang);h.id=`${u.id}`,u.default&&(h.enabled=!0)}}),i.audioTracks.addEventListener("change",()=>{var l;let d=+((l=[...i.audioTracks].find(c=>c.enabled))==null?void 0:l.id),u=e.audioTracks.map(c=>c.id);d!=e.audioTrack&&u.includes(d)&&(e.audioTrack=d)}),e.on(ge.Events.LEVELS_UPDATED,function(l,d){var u;let c=i.videoTracks[(u=i.videoTracks.selectedIndex)!=null?u:0];if(!c)return;let h=d.levels.map(f=>s.get(f));for(let f of i.videoRenditions)f.id&&!h.includes(f.id)&&c.removeRendition(f)});let r=l=>{let d=l.target.selectedIndex;d!=e.nextLevel&&(e.nextLevel=d)};(t=i.videoRenditions)==null||t.addEventListener("change",r);let n=()=>{for(let l of i.videoTracks)i.removeVideoTrack(l)},a=()=>{for(let l of i.audioTracks)i.removeAudioTrack(l)},o=()=>{n(),a()};e.once(ge.Events.DESTROYING,o)}var vc=i=>"time"in i?i.time:i.startTime;function Qx(i,e){e.on(ge.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(r,{tracks:n})=>{n.forEach(a=>{var o,l;let d=(o=a.subtitleTrack)!=null?o:a.closedCaptions,u=e.subtitleTracks.findIndex(({lang:h,name:f,type:m})=>h==d?.lang&&f===a.label&&m.toLowerCase()===a.kind),c=((l=a._id)!=null?l:a.default)?"default":`${a.kind}${u}`;sm(i,a.kind,a.label,d?.lang,c,a.default)})});let t=()=>{if(!e.subtitleTracks.length)return;let r=Array.from(i.textTracks).find(o=>o.id&&o.mode==="showing"&&["subtitles","captions"].includes(o.kind));if(!r)return;let n=e.subtitleTracks[e.subtitleTrack],a=n?n.default?"default":`${e.subtitleTracks[e.subtitleTrack].type.toLowerCase()}${e.subtitleTrack}`:void 0;if(e.subtitleTrack<0||r?.id!==a){let o=e.subtitleTracks.findIndex(({lang:l,name:d,type:u,default:c})=>r.id==="default"&&c||l==r.language&&d===r.label&&u.toLowerCase()===r.kind);e.subtitleTrack=o}r?.id===a&&r.cues&&Array.from(r.cues).forEach(o=>{r.addCue(o)})};i.textTracks.addEventListener("change",t),e.on(ge.Events.CUES_PARSED,(r,{track:n,cues:a})=>{let o=i.textTracks.getTrackById(n);if(!o)return;let l=o.mode==="disabled";l&&(o.mode="hidden"),a.forEach(d=>{var u;(u=o.cues)!=null&&u.getCueById(d.id)||o.addCue(d)}),l&&(o.mode="disabled")}),e.once(ge.Events.DESTROYING,()=>{i.textTracks.removeEventListener("change",t),i.querySelectorAll("track[data-removeondestroy]").forEach(r=>{r.remove()})});let s=()=>{Array.from(i.textTracks).forEach(r=>{var n,a;if(!["subtitles","caption"].includes(r.kind)&&(r.label==="thumbnails"||r.kind==="chapters")){if(!((n=r.cues)!=null&&n.length)){let o="track";r.kind&&(o+=`[kind="${r.kind}"]`),r.label&&(o+=`[label="${r.label}"]`);let l=i.querySelector(o),d=(a=l?.getAttribute("src"))!=null?a:"";l?.removeAttribute("src"),setTimeout(()=>{l?.setAttribute("src",d)},0)}r.mode!=="hidden"&&(r.mode="hidden")}})};e.once(ge.Events.MANIFEST_LOADED,s),e.once(ge.Events.MEDIA_ATTACHED,s)}function sm(i,e,t,s,r,n){let a=document.createElement("track");return a.kind=e,a.label=t,s&&(a.srclang=s),r&&(a.id=r),n&&(a.default=!0),a.track.mode=["subtitles","captions"].includes(e)?"disabled":"hidden",a.setAttribute("data-removeondestroy",""),i.append(a),a.track}function Xx(i,e){let t=Array.prototype.find.call(i.querySelectorAll("track"),s=>s.track===e);t?.remove()}function bo(i,e,t){var s;return(s=Array.from(i.querySelectorAll("track")).find(r=>r.track.label===e&&r.track.kind===t))==null?void 0:s.track}async function Ay(i,e,t,s){let r=bo(i,t,s);return r||(r=sm(i,s,t),r.mode="hidden",await new Promise(n=>setTimeout(()=>n(void 0),0))),r.mode!=="hidden"&&(r.mode="hidden"),[...e].sort((n,a)=>vc(a)-vc(n)).forEach(n=>{var a,o;let l=n.value,d=vc(n);if("endTime"in n&&n.endTime!=null)r?.addCue(new VTTCue(d,n.endTime,s==="chapters"?l:JSON.stringify(l??null)));else{let u=Array.prototype.findIndex.call(r?.cues,m=>m.startTime>=d),c=(a=r?.cues)==null?void 0:a[u],h=c?c.startTime:Number.isFinite(i.duration)?i.duration:Number.MAX_SAFE_INTEGER,f=(o=r?.cues)==null?void 0:o[u-1];f&&(f.endTime=d),r?.addCue(new VTTCue(d,h,s==="chapters"?l:JSON.stringify(l??null)))}}),i.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),r}var rm="cuepoints",Sy=Object.freeze({label:rm});async function Iy(i,e,t=Sy){return Ay(i,e,t.label,"metadata")}var nh=i=>({time:i.startTime,value:JSON.parse(i.text)});function Zx(i,e={label:rm}){let t=bo(i,e.label,"metadata");return t!=null&&t.cues?Array.from(t.cues,s=>nh(s)):[]}function Ly(i,e={label:rm}){var t,s;let r=bo(i,e.label,"metadata");if(!((t=r?.activeCues)!=null&&t.length))return;if(r.activeCues.length===1)return nh(r.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((s=r.activeCues)!=null?s:[],({startTime:o,endTime:l})=>o<=n&&l>n);return nh(a||r.activeCues[0])}async function Jx(i,e=Sy){return new Promise(t=>{lt(i,"loadstart",async()=>{let s=await Iy(i,[],e);lt(i,"cuechange",()=>{let r=Ly(i);if(r){let n=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:r});i.dispatchEvent(n)}},{},s),t(s)})})}var nm="chapters",Ry=Object.freeze({label:nm}),ah=i=>({startTime:i.startTime,endTime:i.endTime,value:i.text});async function xy(i,e,t=Ry){return Ay(i,e,t.label,"chapters")}function ek(i,e={label:nm}){var t;let s=bo(i,e.label,"chapters");return(t=s?.cues)!=null&&t.length?Array.from(s.cues,r=>ah(r)):[]}function ky(i,e={label:nm}){var t,s;let r=bo(i,e.label,"chapters");if(!((t=r?.activeCues)!=null&&t.length))return;if(r.activeCues.length===1)return ah(r.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((s=r.activeCues)!=null?s:[],({startTime:o,endTime:l})=>o<=n&&l>n);return ah(a||r.activeCues[0])}async function tk(i,e=Ry){return new Promise(t=>{lt(i,"loadstart",async()=>{let s=await xy(i,[],e);lt(i,"cuechange",()=>{let r=ky(i);if(r){let n=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:r});i.dispatchEvent(n)}},{},s),t(s)})})}function ik(i,e){if(e){let t=e.playingDate;if(t!=null)return new Date(t.getTime()-i.currentTime*1e3)}return typeof i.getStartDate=="function"?i.getStartDate():new Date(NaN)}function sk(i,e){if(e&&e.playingDate)return e.playingDate;if(typeof i.getStartDate=="function"){let t=i.getStartDate();return new Date(t.getTime()+i.currentTime*1e3)}return new Date(NaN)}var Ba={VIDEO:"v",THUMBNAIL:"t",STORYBOARD:"s",DRM:"d"},rk=i=>{if(i===Re.VIDEO)return Ba.VIDEO;if(i===Re.DRM)return Ba.DRM},nk=(i,e)=>{var t,s;let r=vu(i),n=`${r}Token`;return(t=e.tokens)!=null&&t[r]?(s=e.tokens)==null?void 0:s[r]:tm(n,e)?e[n]:void 0},Bd=(i,e,t,s,r=!1,n=!(a=>(a=globalThis.navigator)==null?void 0:a.onLine)())=>{var a,o;if(n){let v=ie("Your device appears to be offline",r),b,y=W.MEDIA_ERR_NETWORK,T=new W(v,y,!1,b);return T.errorCategory=e,T.muxCode=se.NETWORK_OFFLINE,T.data=i,T}let l="status"in i?i.status:i.code,d=Date.now(),u=W.MEDIA_ERR_NETWORK;if(l===200)return;let c=vu(e),h=nk(e,t),f=rk(e),[m]=im((a=t.playbackId)!=null?a:"");if(!l||!m)return;let p=kn(h);if(h&&!p){let v=ie("The {tokenNamePrefix}-token provided is invalid or malformed.",r).format({tokenNamePrefix:c}),b=ie("Compact JWT string: {token}",r).format({token:h}),y=new W(v,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_MALFORMED,y.data=i,y}if(l>=500){let v=new W("",u,s??!0);return v.errorCategory=e,v.muxCode=se.NETWORK_UNKNOWN_ERROR,v}if(l===403)if(p){if(Hx(p,d)){let v={timeStyle:"medium",dateStyle:"medium"},b=ie("The video’s secured {tokenNamePrefix}-token has expired.",r).format({tokenNamePrefix:c}),y=ie("Expired at: {expiredDate}. Current time: {currentDate}.",r).format({expiredDate:new Intl.DateTimeFormat("en",v).format((o=p.exp)!=null?o:0*1e3),currentDate:new Intl.DateTimeFormat("en",v).format(d)}),T=new W(b,u,!0,y);return T.errorCategory=e,T.muxCode=se.NETWORK_TOKEN_EXPIRED,T.data=i,T}if(Gx(p,m)){let v=ie("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",r).format({tokenNamePrefix:c}),b=ie("Specified playback ID: {playbackId} and the playback ID encoded in the {tokenNamePrefix}-token: {tokenPlaybackId}",r).format({tokenNamePrefix:c,playbackId:m,tokenPlaybackId:p.sub}),y=new W(v,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_SUB_MISMATCH,y.data=i,y}if(Kx(p)){let v=ie("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:c}),b=ie("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",r).format({tokenNamePrefix:c,expectedAud:f}),y=new W(v,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_AUD_MISSING,y.data=i,y}if(Vx(p,f)){let v=ie("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:c}),b=ie("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.",r).format({tokenNamePrefix:c,expectedAud:f,aud:p.aud}),y=new W(v,u,!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_AUD_MISMATCH,y.data=i,y}}else{let v=ie("Authorization error trying to access this {category} URL. If this is a signed URL, you might need to provide a {tokenNamePrefix}-token.",r).format({tokenNamePrefix:c,category:e}),b=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new W(v,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_TOKEN_MISSING,y.data=i,y}if(l===412){let v=ie("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",r),b=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new W(v,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_NOT_READY,y.streamType=t.streamType===Se.LIVE?"live":t.streamType===Se.ON_DEMAND?"on-demand":"unknown",y.data=i,y}if(l===404){let v=ie("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",r),b=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new W(v,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_NOT_FOUND,y.data=i,y}if(l===400){let v=ie("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),b=ie("Specified playback ID: {playbackId}",r).format({playbackId:m}),y=new W(v,u,s??!0,b);return y.errorCategory=e,y.muxCode=se.NETWORK_INVALID_URL,y.data=i,y}let g=new W("",u,s??!0);return g.errorCategory=e,g.muxCode=se.NETWORK_UNKNOWN_ERROR,g.data=i,g},Yg=ge.DefaultConfig.capLevelController,ak={"720p":921600,"1080p":2073600,"1440p":4194304,"2160p":8294400};function ok(i){let e=i.toLowerCase().trim();return ak[e]}var oh=class ma extends Yg{constructor(e){super(e)}static setMaxAutoResolution(e,t){t?ma.maxAutoResolution.set(e,t):ma.maxAutoResolution.delete(e)}getMaxAutoResolution(){var e;let t=this.hls;return(e=ma.maxAutoResolution.get(t))!=null?e:void 0}get levels(){var e;return(e=this.hls.levels)!=null?e:[]}getValidLevels(e){return this.levels.filter((t,s)=>this.isLevelAllowed(t)&&s<=e)}getMaxLevelCapped(e){let t=this.getValidLevels(e),s=this.getMaxAutoResolution();if(!s)return super.getMaxLevel(e);let r=ok(s);if(!r)return super.getMaxLevel(e);let n=t.filter(l=>l.width*l.height<=r),a=n.findIndex(l=>l.width*l.height===r);if(a!==-1){let l=n[a];return t.findIndex(d=>d===l)}if(n.length===0)return 0;let o=n[n.length-1];return t.findIndex(l=>l===o)}getMaxLevel(e){if(this.getMaxAutoResolution()!==void 0)return this.getMaxLevelCapped(e);let t=super.getMaxLevel(e),s=this.getValidLevels(e);if(!s[t])return t;let r=Math.min(s[t].width,s[t].height),n=ma.minMaxResolution;return r>=n?t:Yg.getMaxLevelByMediaSize(s,n*(16/9),n)}};oh.minMaxResolution=720,oh.maxAutoResolution=new WeakMap;var lk=oh,lh=lk,dk="com.apple.fps.1_0",uk="application/vnd.apple.mpegurl",ck=({mediaEl:i,getAppCertificate:e,getLicenseKey:t,saveAndDispatchError:s,drmTypeCb:r})=>{if(!window.WebKitMediaKeys||!("onwebkitneedkey"in i)){console.error("No WebKitMediaKeys. FairPlay may not be supported");let h=ie("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),f=new W(h,W.MEDIA_ERR_ENCRYPTED,!0);return f.errorCategory=Re.DRM,f.muxCode=se.ENCRYPTED_CDM_ERROR,s(i,f),()=>{}}let n=i,a=e(),o=null,l=h=>{(async()=>{try{n.webkitKeys||d();let f=await a;if(h.initData===null||f==null)return;let m=hk(h.initData,f);u(m)}catch(f){console.error("Could not start encrypted playback due to exception",f),s(n,f)}})()},d=()=>{try{let h=new WebKitMediaKeys(dk);n.webkitSetMediaKeys(h),r()}catch{let h="Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.",f=new W(h,W.MEDIA_ERR_ENCRYPTED,!0);throw f.errorCategory=Re.DRM,f.muxCode=se.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,f}},u=h=>{let f=n.webkitKeys.createSession(uk,h),m=async v=>{try{let b=v.message,y=await t(b);f.update(y)}catch(b){console.error("Error on FairPlay session message",b),s(i,b)}},p=v=>{let b=v.target.error;if(!b)return;console.error(`Internal Webkit Key Session Error - sysCode: ${b.systemCode} code: ${b.code}`);let y=ie("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser."),T=new W(y,W.MEDIA_ERR_ENCRYPTED,!0);T.errorCategory=Re.DRM,T.muxCode=se.ENCRYPTED_CDM_ERROR,s(i,T)},g=()=>{f.removeEventListener("webkitkeymessage",m),f.removeEventListener("webkitkeyerror",p),i.removeEventListener("teardown",g),"webkitCurrentPlaybackTargetIsWireless"in i&&i.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",g),o=null;try{f.close()}catch{}};"webkitCurrentPlaybackTargetIsWireless"in i&&i.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",g,{once:!0}),f.addEventListener("webkitkeymessage",m),f.addEventListener("webkitkeyerror",p),i.addEventListener("teardown",g),o=g},c=()=>{i.removeEventListener("webkitneedkey",l),i.removeEventListener("teardown",c),o?.();try{n.webkitSetMediaKeys(null)}catch{}};return i.addEventListener("webkitneedkey",l),i.addEventListener("teardown",c,{once:!0}),c},hk=(i,e)=>{let t=mk(fk(i)),s=new Uint8Array(i),r=new Uint8Array(t),n=new Uint8Array(e),a=s.byteLength+4+n.byteLength+4+r.byteLength,o=new Uint8Array(a),l=0,d=c=>{o.set(c,l),l+=c.byteLength},u=c=>{let h=new DataView(o.buffer),f=c.byteLength;h.setUint32(l,f,!0),l+=4,d(c)};return d(s),u(r),u(n),o},fk=i=>new TextDecoder("utf-16le").decode(i).replace("skd://","").slice(1);function mk(i){let e=new ArrayBuffer(i.length*2),t=new DataView(e);for(let s=0;s{let a=null,o=async c=>{try{let h=c.initDataType;if(h!=="skd"){console.error(`Received unexpected initialization data type "${h}"`);return}i.mediaKeys||await l(h);let f=c.initData;if(f==null){console.error(`Could not start encrypted playback due to missing initData in ${c.type} event`);return}await d(h,f)}catch(h){s(i,h);return}},l=async c=>{let h=await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[c],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}]).then(m=>(r(),m)).catch(()=>{let m=ie("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),p=new W(m,W.MEDIA_ERR_ENCRYPTED,!0);p.errorCategory=Re.DRM,p.muxCode=se.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,s(i,p)});if(!h)return;let f=await h.createMediaKeys();try{let m=await e();await f.setServerCertificate(m).catch(()=>{let p=ie("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),g=new W(p,W.MEDIA_ERR_ENCRYPTED,!0);return g.errorCategory=Re.DRM,g.muxCode=se.ENCRYPTED_UPDATE_SERVER_CERT_FAILED,Promise.reject(g)})}catch(m){s(i,m);return}await i.setMediaKeys(f)},d=async(c,h)=>{let f=i.mediaKeys.createSession(),m=async v=>{let b=v.message,y=await t(b);try{await f.update(y)}catch{let T=ie("Failed to update DRM license. This may be an issue with the player or your protected content."),A=new W(T,W.MEDIA_ERR_ENCRYPTED,!0);A.errorCategory=Re.DRM,A.muxCode=se.ENCRYPTED_UPDATE_LICENSE_FAILED,s(i,A)}},p=()=>{let v=b=>{let y;if(b==="internal-error"){let T=ie("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");y=new W(T,W.MEDIA_ERR_ENCRYPTED,!0),y.errorCategory=Re.DRM,y.muxCode=se.ENCRYPTED_CDM_ERROR}else if(b==="output-restricted"||b==="output-downscaled"){let T=ie("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");y=new W(T,W.MEDIA_ERR_ENCRYPTED,!1),y.errorCategory=Re.DRM,y.muxCode=se.ENCRYPTED_OUTPUT_RESTRICTED}y&&s(i,y)};f.keyStatuses.forEach(b=>v(b))};f.addEventListener("keystatuseschange",p),f.addEventListener("message",m);let g=async()=>{f.removeEventListener("keystatuseschange",p),f.removeEventListener("message",m),"webkitCurrentPlaybackTargetIsWireless"in i&&i.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",g),i.removeEventListener("teardown",g),await f.close().catch(v=>{console.warn("There was an error when closing EME session",v)}),a=null};"webkitCurrentPlaybackTargetIsWireless"in i&&i.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",g,{once:!0}),i.addEventListener("teardown",g,{once:!0}),a=g,await f.generateRequest(c,h).catch(async v=>{if(v.name==="NotSupportedError"&&"webkitCurrentPlaybackTargetIsWireless"in i&&i.webkitCurrentPlaybackTargetIsWireless)console.warn("Failed to generate a DRM license request. Attempting to fallback to Webkit DRM"),n?.();else{let b=ie("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),y=new W(b,W.MEDIA_ERR_ENCRYPTED,!0);return y.errorCategory=Re.DRM,y.muxCode=se.ENCRYPTED_GENERATE_REQUEST_FAILED,console.error("Failed to generate license request",v),Promise.reject(y)}})},u=async()=>{i.removeEventListener("encrypted",o),i.removeEventListener("teardown",u),a&&await a(),await i.setMediaKeys(null).catch(()=>{})};return i.addEventListener("encrypted",o),i.addEventListener("teardown",u,{once:!0}),u},gl={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},gk=i=>{if(i.includes("fps"))return gl.FAIRPLAY;if(i.includes("playready"))return gl.PLAYREADY;if(i.includes("widevine"))return gl.WIDEVINE},vk=i=>{let e=i.split(`
+`).find((t,s,r)=>s&&r[s-1].startsWith("#EXT-X-STREAM-INF"));return fetch(e).then(t=>t.status!==200?Promise.reject(t):t.text())},Ek=i=>{let e=i.split(`
+`).filter(s=>s.startsWith("#EXT-X-SESSION-DATA"));if(!e.length)return{};let t={};for(let s of e){let r=bk(s),n=r["DATA-ID"];n&&(t[n]={...r})}return{sessionData:t}},yk=/([A-Z0-9-]+)="?(.*?)"?(?:,|$)/g;function bk(i){let e=[...i.matchAll(yk)];return Object.fromEntries(e.map(([,t,s])=>[t,s]))}var Tk=i=>{var e,t,s;let r=i.split(`
+`),n=(t=((e=r.find(d=>d.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?e:"").split(":")[1])==null?void 0:t.trim(),a=by(n),o=Ty(n),l;if(a===Se.LIVE){let d=r.find(u=>u.startsWith("#EXT-X-PART-INF"));if(d)l=+d.split(":")[1].split("=")[1]*2;else{let u=r.find(h=>h.startsWith("#EXT-X-TARGETDURATION")),c=(s=u?.split(":"))==null?void 0:s[1];l=+(c??6)*3}}return{streamType:a,targetLiveWindow:o,liveEdgeStartOffset:l}},_k=async(i,e)=>{if(e===cs.MP4)return{streamType:Se.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0,sessionData:void 0};if(e===cs.M3U8){let t=await fetch(i);if(!t.ok)return Promise.reject(t);let s=await t.text(),r=await vk(s);return{...Ek(s),...Tk(r)}}return console.error(`Media type ${e} is an unrecognized or unsupported type for src ${i}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0,sessionData:void 0}},Ak=async(i,e,t=Eu({src:i}))=>{var s,r,n,a;let{streamType:o,targetLiveWindow:l,liveEdgeStartOffset:d,sessionData:u}=await _k(i,t),c=u?.["com.apple.hls.chapters"];(c!=null&&c.URI||c!=null&&c.VALUE.toLocaleLowerCase().startsWith("http"))&&am((s=c.URI)!=null?s:c.VALUE,e),((r=Fe.get(e))!=null?r:{}).liveEdgeStartOffset=d,((n=Fe.get(e))!=null?n:{}).targetLiveWindow=l,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((a=Fe.get(e))!=null?a:{}).streamType=o,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},am=async(i,e)=>{var t,s;try{let r=await fetch(i);if(!r.ok)throw new Error(`Failed to fetch Mux metadata: ${r.status} ${r.statusText}`);let n=await r.json(),a={};if(!((t=n?.[0])!=null&&t.metadata))return;for(let l of n[0].metadata)l.key&&l.value&&(a[l.key]=l.value);((s=Fe.get(e))!=null?s:{}).metadata=a;let o=new CustomEvent("muxmetadata");e.dispatchEvent(o)}catch(r){console.error(r)}},Sk=i=>{var e;let t=i.type,s=by(t),r=Ty(t),n,a=!!((e=i.partList)!=null&&e.length);return s===Se.LIVE&&(n=a?i.partTarget*2:i.targetduration*3),{streamType:s,targetLiveWindow:r,liveEdgeStartOffset:n,lowLatency:a}},Ik=(i,e,t)=>{var s,r,n,a,o,l,d,u;let{streamType:c,targetLiveWindow:h,liveEdgeStartOffset:f,lowLatency:m}=Sk(i);if(c===Se.LIVE){m?(t.config.backBufferLength=(s=t.userConfig.backBufferLength)!=null?s:4,t.config.maxFragLookUpTolerance=(r=t.userConfig.maxFragLookUpTolerance)!=null?r:.001,t.config.abrBandWidthUpFactor=(n=t.userConfig.abrBandWidthUpFactor)!=null?n:t.config.abrBandWidthFactor):t.config.backBufferLength=(a=t.userConfig.backBufferLength)!=null?a:8;let p=Object.freeze({get length(){return e.seekable.length},start(g){return e.seekable.start(g)},end(g){var v;return g>this.length||g<0||Number.isFinite(e.duration)?e.seekable.end(g):(v=t.liveSyncPosition)!=null?v:e.seekable.end(g)}});((o=Fe.get(e))!=null?o:{}).seekable=p}((l=Fe.get(e))!=null?l:{}).liveEdgeStartOffset=f,((d=Fe.get(e))!=null?d:{}).targetLiveWindow=h,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((u=Fe.get(e))!=null?u:{}).streamType=c,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},jg,zg,Dy=(zg=(jg=globalThis?.navigator)==null?void 0:jg.userAgent)!=null?zg:"",Qg,Xg,Zg,Lk=(Zg=(Xg=(Qg=globalThis?.navigator)==null?void 0:Qg.userAgentData)==null?void 0:Xg.platform)!=null?Zg:"",Rk=Dy.toLowerCase().includes("android")||["x11","android"].some(i=>Lk.toLowerCase().includes(i)),xk=i=>/^((?!chrome|android).)*safari/i.test(Dy)&&!!i.canPlayType("application/vnd.apple.mpegurl"),Fe=new WeakMap,hs="mux.com",Jg,e0,Cy=(e0=(Jg=ge).isSupported)==null?void 0:e0.call(Jg),kk=i=>Rk||!xk(i),om=()=>{if(typeof window<"u")return Cf.utils.now()},Dk=Cf.utils.generateUUID,dh=({playbackId:i,customDomain:e=hs,maxResolution:t,minResolution:s,renditionOrder:r,programStartTime:n,programEndTime:a,assetStartTime:o,assetEndTime:l,playbackToken:d,tokens:{playback:u=d}={},extraSourceParams:c={}}={})=>{if(!i)return;let[h,f=""]=im(i),m=new URL(`https://stream.${e}/${h}.m3u8${f}`);return u||m.searchParams.has("token")?(m.searchParams.forEach((p,g)=>{g!="token"&&m.searchParams.delete(g)}),u&&m.searchParams.set("token",u)):(t&&m.searchParams.set("max_resolution",t),s&&(m.searchParams.set("min_resolution",s),t&&+t.slice(0,-1)<+s.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",s,"maxResolution",t)),r&&m.searchParams.set("rendition_order",r),n&&m.searchParams.set("program_start_time",`${n}`),a&&m.searchParams.set("program_end_time",`${a}`),o&&m.searchParams.set("asset_start_time",`${o}`),l&&m.searchParams.set("asset_end_time",`${l}`),Object.entries(c).forEach(([p,g])=>{g!=null&&m.searchParams.set(p,g)})),m.toString()},yu=i=>{if(!i)return;let[e]=i.split("?");return e||void 0},lm=i=>{if(!i||!i.startsWith("https://stream."))return;let[e]=new URL(i).pathname.slice(1).split(/\.m3u8|\//);return e||void 0},Ck=i=>{var e,t,s;return(e=i?.metadata)!=null&&e.video_id?i.metadata.video_id:By(i)&&(s=(t=yu(i.playbackId))!=null?t:lm(i.src))!=null?s:i.src},wy=i=>{var e;return(e=Fe.get(i))==null?void 0:e.error},wk=i=>{var e;return(e=Fe.get(i))==null?void 0:e.metadata},uh=i=>{var e,t;return(t=(e=Fe.get(i))==null?void 0:e.streamType)!=null?t:Se.UNKNOWN},Mk=i=>{var e,t;return(t=(e=Fe.get(i))==null?void 0:e.targetLiveWindow)!=null?t:Number.NaN},dm=i=>{var e,t;return(t=(e=Fe.get(i))==null?void 0:e.seekable)!=null?t:i.seekable},Pk=i=>{var e;let t=(e=Fe.get(i))==null?void 0:e.liveEdgeStartOffset;if(typeof t!="number")return Number.NaN;let s=dm(i);return s.length?s.end(s.length-1)-t:Number.NaN},Ok=i=>{var e;return(e=Fe.get(i))==null?void 0:e.coreReference},um=.034,Nk=(i,e,t=um)=>Math.abs(i-e)<=t,My=(i,e,t=um)=>i>e||Nk(i,e,t),Uk=(i,e=um)=>i.paused&&My(i.currentTime,i.duration,e),Py=(i,e)=>{var t,s,r;if(!e||!i.buffered.length)return;if(i.readyState>2)return!1;let n=e.currentLevel>=0?(s=(t=e.levels)==null?void 0:t[e.currentLevel])==null?void 0:s.details:(r=e.levels.find(c=>!!c.details))==null?void 0:r.details;if(!n||n.live)return;let{fragments:a}=n;if(!(a!=null&&a.length))return;if(i.currentTimed&&li.ended||i.loop?i.ended:e&&Py(i,e)?!0:Uk(i),Ny=(i,e,t)=>{Uy(e,t,i);let{metadata:s={}}=i,{view_session_id:r=Dk()}=s,n=Ck(i);s.view_session_id=r,s.video_id=n,i.metadata=s;let a=h=>{var f;(f=e.mux)==null||f.emit("hb",{view_drm_type:h})};i.drmTypeCb=a,i.fallbackToWebkitFairplay=async()=>{var h;let f=!e.paused,m=e.currentTime;i.useWebkitFairplay=!0;let p=i.muxDataKeepSession;i.muxDataKeepSession=!0;let g=(h=Fe.get(e))==null?void 0:h.coreReference;Ny(i,e,g),i.muxDataKeepSession=p,i.useWebkitFairplay=!1,f&&await e.play().then(()=>{e.currentTime=m}).catch(()=>{}),e.currentTime=m},Fe.set(e,{retryCount:0});let o=$k(i,e),l=jx(i,e,o);i!=null&&i.muxDataKeepSession&&e!=null&&e.mux&&!e.mux.deleted?o&&e.mux.addHLSJS({hlsjs:o,Hls:o?ge:void 0}):Wk(i,e,o),qk(i,e,o),Jx(e),tk(e);let d=Yx(i,e,o),u={engine:o,setAutoplay:d,setPreload:l},c=Fe.get(e);return c&&(c.coreReference=u),u},Uy=(i,e,t)=>{let s=e?.engine;i!=null&&i.mux&&!i.mux.deleted&&(t!=null&&t.muxDataKeepSession?s&&i.mux.removeHLSJS():(i.mux.destroy(),delete i.mux)),s&&(s.detachMedia(),s.destroy()),i&&(i.hasAttribute("src")&&(i.removeAttribute("src"),i.load()),i.removeEventListener("error",Gy),i.removeEventListener("error",ch),i.removeEventListener("durationchange",Hy),Fe.delete(i),i.dispatchEvent(new Event("teardown")))};function $y(i,e){var t;let s=Eu(i);if(s!==cs.M3U8)return!0;let r=!s||((t=e.canPlayType(s))!=null?t:!0),{preferPlayback:n}=i,a=n===qi.MSE,o=n===qi.NATIVE,l=Cy&&(a||kk(e));return r&&(o||!l)}var $k=(i,e)=>{let{debug:t,streamType:s,startTime:r=-1,metadata:n,preferCmcd:a,_hlsConfig:o={},maxAutoResolution:l}=i,d=Eu(i)===cs.M3U8,u=$y(i,e);if(d&&!u&&Cy){let c={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelOnFPSDrop:!0},h=Fk(s),f=Bk(i),m=[fa.QUERY,fa.HEADER].includes(a)?{useHeaders:a===fa.HEADER,sessionId:n?.view_session_id,contentId:n?.video_id}:void 0,p=Vk(i),g=new ge({debug:t,startPosition:r,cmcd:m,xhrSetup:(v,b)=>{var y,T;if(a&&a!==fa.QUERY)return;let A=new URL(b);if(!A.searchParams.has("CMCD"))return;let L=((T=(y=A.searchParams.get("CMCD"))==null?void 0:y.split(","))!=null?T:[]).filter(S=>S.startsWith("sid")||S.startsWith("cid")).join(",");A.searchParams.set("CMCD",L),v.open("GET",A)},...c,...p,...h,...f,...o});return p.capLevelController===lh&&l!==void 0&&lh.setMaxAutoResolution(g,l),g.on(ge.Events.MANIFEST_PARSED,async function(v,b){var y,T;let A=(y=b.sessionData)==null?void 0:y["com.apple.hls.chapters"];(A!=null&&A.URI||A!=null&&A.VALUE.toLocaleLowerCase().startsWith("http"))&&am((T=A?.URI)!=null?T:A?.VALUE,e)}),g}},Fk=i=>i===Se.LIVE?{backBufferLength:8}:{},Bk=i=>{let{tokens:{drm:e}={},playbackId:t,drmTypeCb:s}=i,r=yu(t);return!e||!r?{}:{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:vl(i,"fairplay"),serverCertificateUrl:Fy(i,"fairplay")},"com.widevine.alpha":{licenseUrl:vl(i,"widevine")},"com.microsoft.playready":{licenseUrl:vl(i,"playready")}},requestMediaKeySystemAccessFunc:(n,a)=>(n==="com.widevine.alpha"&&(a=[...a.map(o=>{var l;let d=(l=o.videoCapabilities)==null?void 0:l.map(u=>({...u,robustness:"HW_SECURE_ALL"}));return{...o,videoCapabilities:d}}),...a]),navigator.requestMediaKeySystemAccess(n,a).then(o=>{let l=gk(n);return s?.(l),o}))}},Hk=async i=>{let e=await fetch(i);return e.status!==200?Promise.reject(e):await e.arrayBuffer()},Gk=async(i,e)=>{let t=await fetch(e,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:i});if(t.status!==200)return Promise.reject(t);let s=await t.arrayBuffer();return new Uint8Array(s)},Kk=(i,e)=>{let t={mediaEl:e,getAppCertificate:()=>Hk(Fy(i,"fairplay")).catch(s=>{if(s instanceof Response){let r=Bd(s,Re.DRM,i);return console.error("mediaError",r?.message,r?.context),r?Promise.reject(r):Promise.reject(new Error("Unexpected error in app cert request"))}return Promise.reject(s)}),getLicenseKey:s=>Gk(s,vl(i,"fairplay")).catch(r=>{if(r instanceof Response){let n=Bd(r,Re.DRM,i);return console.error("mediaError",n?.message,n?.context),n?Promise.reject(n):Promise.reject(new Error("Unexpected error in license key request"))}return Promise.reject(r)}),saveAndDispatchError:Ns,drmTypeCb:()=>{var s;(s=i.drmTypeCb)==null||s.call(i,gl.FAIRPLAY)}};if(i.useWebkitFairplay)ck(t);else{let s={fallbackToWebkitFairplay:async()=>{var n;await r(),(n=i.fallbackToWebkitFairplay)==null||n.call(i)},...t},r=pk(s)}},vl=({playbackId:i,tokens:{drm:e}={},customDomain:t=hs},s)=>{let r=yu(i);return`https://license.${t.toLocaleLowerCase().endsWith(hs)?t:hs}/license/${s}/${r}?token=${e}`},Fy=({playbackId:i,tokens:{drm:e}={},customDomain:t=hs},s)=>{let r=yu(i);return`https://license.${t.toLocaleLowerCase().endsWith(hs)?t:hs}/appcert/${s}/${r}?token=${e}`},By=({playbackId:i,src:e,customDomain:t})=>{if(i)return!0;if(typeof e!="string")return!1;let s=window?.location.href,r=new URL(e,s).hostname.toLocaleLowerCase();return r.includes(hs)||!!t&&r.includes(t.toLocaleLowerCase())},Vk=(i,e)=>{let t={};return t.capLevelToPlayerSize=i.capRenditionToPlayerSize,t.capLevelToPlayerSize==null?(t.capLevelController=lh,t.capLevelToPlayerSize=!0):t.capLevelController=pu,t},Wk=(i,e,t)=>{var s;let{envKey:r,disableTracking:n,muxDataSDK:a=Cf,muxDataSDKOptions:o={}}=i,l=By(i);if(!n&&(r||l)){let{playerInitTime:d,playerSoftwareName:u,playerSoftwareVersion:c,beaconCollectionDomain:h,debug:f,disableCookies:m}=i,p={...i.metadata,video_title:((s=i?.metadata)==null?void 0:s.video_title)||void 0},g=v=>typeof v.player_error_code=="string"?!1:typeof i.errorTranslator=="function"?i.errorTranslator(v):v;a.monitor(e,{debug:f,beaconCollectionDomain:h,hlsjs:t,Hls:t?ge:void 0,automaticErrorTracking:!1,errorTranslator:g,disableCookies:m,...o,data:{...r?{env_key:r}:{},player_software_name:u,player_software:u,player_software_version:c,player_init_time:d,...p}})}},qk=(i,e,t)=>{var s,r;let n=$y(i,e),{src:a,customDomain:o=hs}=i,l=()=>{e.ended||i.disablePseudoEnded||!Oy(e,t)||(Py(e,t)?e.currentTime=e.buffered.end(e.buffered.length-1):e.dispatchEvent(new Event("ended")))},d,u,c=()=>{let h=dm(e),f,m;h.length>0&&(f=h.start(0),m=h.end(0)),(u!==m||d!==f)&&e.dispatchEvent(new CustomEvent("seekablechange",{composed:!0})),d=f,u=m};if(lt(e,"durationchange",c),e&&n){let h=Eu(i);if(typeof a=="string"){if(a.endsWith(".mp4")&&a.includes(o)){let p=lm(a),g=new URL(`https://stream.${o}/${p}/metadata.json`);am(g.toString(),e)}let f=()=>{if(uh(e)!==Se.LIVE||Number.isFinite(e.duration))return;let p=setInterval(c,1e3);e.addEventListener("teardown",()=>{clearInterval(p)},{once:!0}),lt(e,"durationchange",()=>{Number.isFinite(e.duration)&&clearInterval(p)})},m=async()=>Ak(a,e,h).then(f).catch(p=>{if(p instanceof Response){let g=Bd(p,Re.VIDEO,i);if(g){Ns(e,g);return}}});if(e.preload==="none"){let p=()=>{m(),e.removeEventListener("loadedmetadata",g)},g=()=>{m(),e.removeEventListener("play",p)};lt(e,"play",p,{once:!0}),lt(e,"loadedmetadata",g,{once:!0})}else m();(s=i.tokens)!=null&&s.drm?Kk(i,e):lt(e,"encrypted",()=>{let p=ie("Attempting to play DRM-protected content without providing a DRM token."),g=new W(p,W.MEDIA_ERR_ENCRYPTED,!0);g.errorCategory=Re.DRM,g.muxCode=se.ENCRYPTED_MISSING_TOKEN,Ns(e,g)},{once:!0}),e.setAttribute("src",a),i.startTime&&(((r=Fe.get(e))!=null?r:{}).startTime=i.startTime,e.addEventListener("durationchange",Hy,{once:!0}))}else e.removeAttribute("src");e.addEventListener("error",Gy),e.addEventListener("error",ch),e.addEventListener("emptied",()=>{e.querySelectorAll("track[data-removeondestroy]").forEach(f=>{f.remove()})},{once:!0}),lt(e,"pause",l),lt(e,"seeked",l),lt(e,"play",()=>{e.ended||My(e.currentTime,e.duration)&&(e.currentTime=e.seekable.length?e.seekable.start(0):0)})}else t&&a?(t.once(ge.Events.LEVEL_LOADED,(h,f)=>{Ik(f.details,e,t),c(),uh(e)===Se.LIVE&&!Number.isFinite(e.duration)&&(t.on(ge.Events.LEVEL_UPDATED,c),lt(e,"durationchange",()=>{Number.isFinite(e.duration)&&t.off(ge.Events.LEVELS_UPDATED,c)}))}),t.on(ge.Events.ERROR,(h,f)=>{var m,p;let g=Yk(f,i);if(g.muxCode===se.NETWORK_NOT_READY){let v=(m=Fe.get(e))!=null?m:{},b=(p=v.retryCount)!=null?p:0;if(b<6){let y=b===0?5e3:6e4,T=new W(`Retrying in ${y/1e3} seconds...`,g.code,g.fatal);Object.assign(T,g),Ns(e,T),setTimeout(()=>{v.retryCount=b+1,f.details==="manifestLoadError"&&f.url&&t.loadSource(f.url)},y);return}else{v.retryCount=0;let y=new W('Try again later or click here to retry ',g.code,g.fatal);Object.assign(y,g),Ns(e,y);return}}Ns(e,g)}),t.on(ge.Events.MANIFEST_LOADED,()=>{let h=Fe.get(e);h&&h.error&&(h.error=null,h.retryCount=0,e.dispatchEvent(new Event("emptied")),e.dispatchEvent(new Event("loadstart")))}),e.addEventListener("error",ch),lt(e,"waiting",l),zx(i,t),Qx(e,t),t.attachMedia(e)):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 Hy(i){var e;let t=i.target,s=(e=Fe.get(t))==null?void 0:e.startTime;if(s&&Ux(t.seekable,t.duration,s)){let r=t.preload==="auto";r&&(t.preload="none"),t.currentTime=s,r&&(t.preload="auto")}}async function Gy(i){if(!i.isTrusted)return;i.stopImmediatePropagation();let e=i.target;if(!(e!=null&&e.error))return;let{message:t,code:s}=e.error,r=new W(t,s);if(e.src&&s===W.MEDIA_ERR_SRC_NOT_SUPPORTED&&e.readyState===HTMLMediaElement.HAVE_NOTHING){setTimeout(()=>{var n;let a=(n=wy(e))!=null?n:e.error;a?.code===W.MEDIA_ERR_SRC_NOT_SUPPORTED&&Ns(e,r)},500);return}if(e.src&&(s!==W.MEDIA_ERR_DECODE||s!==void 0))try{let{status:n}=await fetch(e.src);r.data={response:{code:n}}}catch{}Ns(e,r)}function Ns(i,e){var t;e.fatal&&(((t=Fe.get(i))!=null?t:{}).error=e,i.dispatchEvent(new CustomEvent("error",{detail:e})))}function ch(i){var e,t;if(!(i instanceof CustomEvent)||!(i.detail instanceof W))return;let s=i.target,r=i.detail;!r||!r.fatal||(((e=Fe.get(s))!=null?e:{}).error=r,(t=s.mux)==null||t.emit("error",{player_error_code:r.code,player_error_message:r.message,player_error_context:r.context}))}var Yk=(i,e)=>{var t,s,r;i.fatal?console.error("getErrorFromHlsErrorData()",i):e.debug&&console.warn("getErrorFromHlsErrorData() (non-fatal)",i);let n={[ge.ErrorTypes.NETWORK_ERROR]:W.MEDIA_ERR_NETWORK,[ge.ErrorTypes.MEDIA_ERROR]:W.MEDIA_ERR_DECODE,[ge.ErrorTypes.KEY_SYSTEM_ERROR]:W.MEDIA_ERR_ENCRYPTED},a=u=>[ge.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,ge.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED].includes(u.details)?W.MEDIA_ERR_NETWORK:n[u.type],o=u=>{if(u.type===ge.ErrorTypes.KEY_SYSTEM_ERROR)return Re.DRM;if(u.type===ge.ErrorTypes.NETWORK_ERROR)return Re.VIDEO},l,d=a(i);if(d===W.MEDIA_ERR_NETWORK&&i.response){let u=(t=o(i))!=null?t:Re.VIDEO;l=(s=Bd(i.response,u,e,i.fatal))!=null?s:new W("",d,i.fatal)}else if(d===W.MEDIA_ERR_ENCRYPTED)if(i.details===ge.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE){let u=ie("Attempting to play DRM-protected content without providing a DRM token.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_MISSING_TOKEN}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_NO_ACCESS){let u=ie("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_NO_SESSION){let u=ie("Failed to generate a DRM license request. This may be an issue with the player or your protected content.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,!0),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_GENERATE_REQUEST_FAILED}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED){let u=ie("Failed to update DRM license. This may be an issue with the player or your protected content.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_UPDATE_LICENSE_FAILED}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED){let u=ie("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_UPDATE_SERVER_CERT_FAILED}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR){let u=ie("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_CDM_ERROR}else if(i.details===ge.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED){let u=ie("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");l=new W(u,W.MEDIA_ERR_ENCRYPTED,!1),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_OUTPUT_RESTRICTED}else l=new W(i.error.message,W.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Re.DRM,l.muxCode=se.ENCRYPTED_ERROR;else l=new W("",d,i.fatal);return l.context||(l.context=`${i.url?`url: ${i.url}
+`:""}${i.response&&(i.response.code||i.response.text)?`response: ${i.response.code}, ${i.response.text}
+`:""}${i.reason?`failure reason: ${i.reason}
+`:""}${i.level?`level: ${i.level}
+`:""}${i.parent?`parent stream controller: ${i.parent}
+`:""}${i.buffer?`buffer length: ${i.buffer}
+`:""}${i.error?`error: ${i.error}
+`:""}${i.event?`event: ${i.event}
+`:""}${i.err?`error message: ${(r=i.err)==null?void 0:r.message}
+`:""}`),l.data=i,l};const jk=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],Ky=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function zk(i){return`
+
+
+
+
+
+ `}function Qk(i){return`
+
+
+
+
+
+ `}function Vy(i,{tag:e,is:t}){const s=globalThis.document?.createElement?.(e,{is:t}),r=s?Xk(s):[];return class hh extends i{static getTemplateHTML=e.endsWith("audio")?zk:Qk;static shadowRootOptions={mode:"open"};static Events=jk;static#e=!1;static get observedAttributes(){return hh.#s(),[...s?.constructor?.observedAttributes??[],...Ky]}static#s(){if(this.#e)return;this.#e=!0;const a=new Set(this.observedAttributes);a.delete("muted");for(const o of r)if(!(o in this.prototype))if(typeof s[o]=="function")this.prototype[o]=function(...l){return this.#n(),this.call?this.call(o,...l):this.nativeEl?.[o]?.apply(this.nativeEl,l)};else{const l={get(){this.#n();const d=o.toLowerCase();if(a.has(d)){const u=this.getAttribute(d);return u===null?!1:u===""?!0:u}return this.get?.(o)??this.nativeEl?.[o]}};o!==o.toUpperCase()&&(l.set=function(d){this.#n();const u=o.toLowerCase();if(a.has(u)){d===!0||d===!1||d==null?this.toggleAttribute(u,!!d):this.setAttribute(u,d);return}if(this.set){this.set(o,d);return}this.nativeEl&&(this.nativeEl[o]=d)}),Object.defineProperty(this.prototype,o,l)}}#i=!1;#r=null;#t=new Map;#a;get;set;call;get nativeEl(){return this.#n(),this.#r??this.querySelector(":scope > [slot=media]")??this.querySelector(e)??this.shadowRoot?.querySelector(e)??null}set nativeEl(a){this.#r=a}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(a){this.toggleAttribute("muted",a)}get src(){return this.getAttribute("src")}set src(a){this.setAttribute("src",`${a}`)}get preload(){return this.getAttribute("preload")??this.nativeEl?.preload}set preload(a){this.setAttribute("preload",`${a}`)}#n(){this.#i||(this.#i=!0,this.init())}init(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const a=Zk(this.attributes);t&&(a.is=t),e&&(a.part=e),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(a)}this.nativeEl.muted=this.hasAttribute("muted");for(const a of r)this.#c(a);this.#a=new MutationObserver(this.#o.bind(this)),this.shadowRoot.addEventListener("slotchange",()=>this.#l()),this.#l();for(const a of this.constructor.Events)this.shadowRoot.addEventListener(a,this,!0)}handleEvent(a){a.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(a.type,{detail:a.detail}))}#l(){const a=new Map(this.#t);(this.shadowRoot?.querySelector("slot:not([name])")?.assignedElements({flatten:!0}).filter(d=>["track","source"].includes(d.localName))).forEach(d=>{a.delete(d);let u=this.#t.get(d);u||(u=d.cloneNode(),this.#t.set(d,u),this.#a?.observe(d,{attributes:!0})),this.nativeEl?.append(u),this.#d(u)}),a.forEach((d,u)=>{d.remove(),this.#t.delete(u)})}#o(a){for(const o of a)if(o.type==="attributes"){const{target:l,attributeName:d}=o,u=this.#t.get(l);u&&d&&(u.setAttribute(d,l.getAttribute(d)??""),this.#d(u))}}#d(a){a&&a.localName==="track"&&a.default&&(a.kind==="chapters"||a.kind==="metadata")&&a.track.mode==="disabled"&&(a.track.mode="hidden")}#c(a){if(Object.prototype.hasOwnProperty.call(this,a)){const o=this[a];delete this[a],this[a]=o}}attributeChangedCallback(a,o,l){this.#n(),this.#u(a,o,l)}#u(a,o,l){["id","class"].includes(a)||!hh.observedAttributes.includes(a)&&this.constructor.observedAttributes.includes(a)||(l===null?this.nativeEl?.removeAttribute(a):this.nativeEl?.getAttribute(a)!==l&&this.nativeEl?.setAttribute(a,l))}connectedCallback(){this.#n()}}}function Xk(i){const e=[];for(let t=Object.getPrototypeOf(i);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t)){const s=Object.getOwnPropertyNames(t);e.push(...s)}return e}function Wy(i){let e="";for(const t in i){if(!Ky.includes(t))continue;const s=i[t];s===""?e+=` ${t}`:e+=` ${t}="${s}"`}return e}function Zk(i){const e={};for(const t of i)e[t.name]=t.value;return e}const Go=Vy(globalThis.HTMLElement??class{},{tag:"video"});Vy(globalThis.HTMLElement??class{},{tag:"audio"});var qy=i=>{throw TypeError(i)},cm=(i,e,t)=>e.has(i)||qy("Cannot "+t),ft=(i,e,t)=>(cm(i,e,"read from private field"),t?t.call(i):e.get(i)),li=(i,e,t)=>e.has(i)?qy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),fi=(i,e,t,s)=>(cm(i,e,"write to private field"),e.set(i,t),t),Ko=(i,e,t)=>(cm(i,e,"access private method"),t),Jk=()=>{try{return"0.30.3"}catch{}return"UNKNOWN"},eD=Jk(),tD=()=>eD,iD=`
+ `,D={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended",DRM_TOKEN:"drm-token",PLAYBACK_TOKEN:"playback-token",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",MIN_RESOLUTION:"min-resolution",MAX_AUTO_RESOLUTION:"max-auto-resolution",RENDITION_ORDER:"rendition-order",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",ASSET_START_TIME:"asset-start-time",ASSET_END_TIME:"asset-end-time",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_INIT_TIME:"player-init-time",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type",LOGO:"logo",CAP_RENDITION_TO_PLAYER_SIZE:"cap-rendition-to-player-size"},sD=Object.values(D),t0=tD(),i0="mux-video",pa,El,ga,yl,bl,Tl,_l,Al,va,Xt,ir,Sl,Ea,rD=class extends Go{constructor(){super(),li(this,Xt),li(this,pa),li(this,El),li(this,ga,{}),li(this,yl,{}),li(this,bl),li(this,Tl),li(this,_l),li(this,Al),li(this,va,""),li(this,Sl),fi(this,El,om()),this.nativeEl.addEventListener("muxmetadata",e=>{var t;let s=wk(this.nativeEl),r=(t=this.metadata)!=null?t:{};this.metadata={...s,...r},s?.["com.mux.video.branding"]==="mux-free-plan"&&(fi(this,va,"default"),this.updateLogo())})}static get NAME(){return i0}static get VERSION(){return t0}static get observedAttributes(){var e;return[...sD,...(e=Go.observedAttributes)!=null?e:[]]}static getLogoHTML(e){return!e||e==="false"?"":e==="default"?iD:` `}static getTemplateHTML(e={}){var t;return`
+ ${Go.getTemplateHTML(e)}
+
+
+ ${this.getLogoHTML((t=e[D.LOGO])!=null?t:"")}
+
+ `}get preferCmcd(){var e;return(e=this.getAttribute(D.PREFER_CMCD))!=null?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?Fd.includes(e)?this.setAttribute(D.PREFER_CMCD,e):console.warn(`Invalid value for preferCmcd. Must be one of ${Fd.join()}`):this.removeAttribute(D.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(D.PLAYER_INIT_TIME)?+this.getAttribute(D.PLAYER_INIT_TIME):ft(this,El)}set playerInitTime(e){e!=this.playerInitTime&&(e==null?this.removeAttribute(D.PLAYER_INIT_TIME):this.setAttribute(D.PLAYER_INIT_TIME,`${+e}`))}get playerSoftwareName(){var e;return(e=ft(this,_l))!=null?e:i0}set playerSoftwareName(e){fi(this,_l,e)}get playerSoftwareVersion(){var e;return(e=ft(this,Tl))!=null?e:t0}set playerSoftwareVersion(e){fi(this,Tl,e)}get _hls(){var e;return(e=ft(this,Xt,ir))==null?void 0:e.engine}get mux(){var e;return(e=this.nativeEl)==null?void 0:e.mux}get error(){var e;return(e=wy(this.nativeEl))!=null?e:null}get errorTranslator(){return ft(this,Al)}set errorTranslator(e){fi(this,Al,e)}get src(){return this.getAttribute("src")}set src(e){e!==this.src&&(e==null?this.removeAttribute("src"):this.setAttribute("src",e))}get type(){var e;return(e=this.getAttribute(D.TYPE))!=null?e:void 0}set type(e){e!==this.type&&(e?this.setAttribute(D.TYPE,e):this.removeAttribute(D.TYPE))}get preload(){let e=this.getAttribute("preload");return e===""?"auto":["none","metadata","auto"].includes(e)?e:super.preload}set preload(e){e!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(e)?this.setAttribute("preload",e):this.removeAttribute("preload"))}get debug(){return this.getAttribute(D.DEBUG)!=null}set debug(e){e!==this.debug&&(e?this.setAttribute(D.DEBUG,""):this.removeAttribute(D.DEBUG))}get disableTracking(){return this.hasAttribute(D.DISABLE_TRACKING)}set disableTracking(e){e!==this.disableTracking&&this.toggleAttribute(D.DISABLE_TRACKING,!!e)}get disableCookies(){return this.hasAttribute(D.DISABLE_COOKIES)}set disableCookies(e){e!==this.disableCookies&&(e?this.setAttribute(D.DISABLE_COOKIES,""):this.removeAttribute(D.DISABLE_COOKIES))}get disablePseudoEnded(){return this.hasAttribute(D.DISABLE_PSEUDO_ENDED)}set disablePseudoEnded(e){e!==this.disablePseudoEnded&&(e?this.setAttribute(D.DISABLE_PSEUDO_ENDED,""):this.removeAttribute(D.DISABLE_PSEUDO_ENDED))}get startTime(){let e=this.getAttribute(D.START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set startTime(e){e!==this.startTime&&(e==null?this.removeAttribute(D.START_TIME):this.setAttribute(D.START_TIME,`${e}`))}get playbackId(){var e;return this.hasAttribute(D.PLAYBACK_ID)?this.getAttribute(D.PLAYBACK_ID):(e=lm(this.src))!=null?e:void 0}set playbackId(e){e!==this.playbackId&&(e?this.setAttribute(D.PLAYBACK_ID,e):this.removeAttribute(D.PLAYBACK_ID))}get maxResolution(){var e;return(e=this.getAttribute(D.MAX_RESOLUTION))!=null?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(D.MAX_RESOLUTION,e):this.removeAttribute(D.MAX_RESOLUTION))}get minResolution(){var e;return(e=this.getAttribute(D.MIN_RESOLUTION))!=null?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(D.MIN_RESOLUTION,e):this.removeAttribute(D.MIN_RESOLUTION))}get maxAutoResolution(){var e;return(e=this.getAttribute(D.MAX_AUTO_RESOLUTION))!=null?e:void 0}set maxAutoResolution(e){e==null?this.removeAttribute(D.MAX_AUTO_RESOLUTION):this.setAttribute(D.MAX_AUTO_RESOLUTION,e)}get renditionOrder(){var e;return(e=this.getAttribute(D.RENDITION_ORDER))!=null?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(D.RENDITION_ORDER,e):this.removeAttribute(D.RENDITION_ORDER))}get programStartTime(){let e=this.getAttribute(D.PROGRAM_START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set programStartTime(e){e==null?this.removeAttribute(D.PROGRAM_START_TIME):this.setAttribute(D.PROGRAM_START_TIME,`${e}`)}get programEndTime(){let e=this.getAttribute(D.PROGRAM_END_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set programEndTime(e){e==null?this.removeAttribute(D.PROGRAM_END_TIME):this.setAttribute(D.PROGRAM_END_TIME,`${e}`)}get assetStartTime(){let e=this.getAttribute(D.ASSET_START_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetStartTime(e){e==null?this.removeAttribute(D.ASSET_START_TIME):this.setAttribute(D.ASSET_START_TIME,`${e}`)}get assetEndTime(){let e=this.getAttribute(D.ASSET_END_TIME);if(e==null)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetEndTime(e){e==null?this.removeAttribute(D.ASSET_END_TIME):this.setAttribute(D.ASSET_END_TIME,`${e}`)}get customDomain(){var e;return(e=this.getAttribute(D.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(D.CUSTOM_DOMAIN,e):this.removeAttribute(D.CUSTOM_DOMAIN))}get capRenditionToPlayerSize(){var e;return((e=this._hlsConfig)==null?void 0:e.capLevelToPlayerSize)!=null?this._hlsConfig.capLevelToPlayerSize:ft(this,Sl)}set capRenditionToPlayerSize(e){fi(this,Sl,e)}get drmToken(){var e;return(e=this.getAttribute(D.DRM_TOKEN))!=null?e:void 0}set drmToken(e){e!==this.drmToken&&(e?this.setAttribute(D.DRM_TOKEN,e):this.removeAttribute(D.DRM_TOKEN))}get playbackToken(){var e,t,s,r;if(this.hasAttribute(D.PLAYBACK_TOKEN))return(e=this.getAttribute(D.PLAYBACK_TOKEN))!=null?e:void 0;if(this.hasAttribute(D.PLAYBACK_ID)){let[,n]=im((t=this.playbackId)!=null?t:"");return(s=new URLSearchParams(n).get("token"))!=null?s:void 0}if(this.src)return(r=new URLSearchParams(this.src).get("token"))!=null?r:void 0}set playbackToken(e){e!==this.playbackToken&&(e?this.setAttribute(D.PLAYBACK_TOKEN,e):this.removeAttribute(D.PLAYBACK_TOKEN))}get tokens(){let e=this.getAttribute(D.PLAYBACK_TOKEN),t=this.getAttribute(D.DRM_TOKEN);return{...ft(this,yl),...e!=null?{playback:e}:{},...t!=null?{drm:t}:{}}}set tokens(e){fi(this,yl,e??{})}get ended(){return Oy(this.nativeEl,this._hls)}get envKey(){var e;return(e=this.getAttribute(D.ENV_KEY))!=null?e:void 0}set envKey(e){e!==this.envKey&&(e?this.setAttribute(D.ENV_KEY,e):this.removeAttribute(D.ENV_KEY))}get beaconCollectionDomain(){var e;return(e=this.getAttribute(D.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(D.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(D.BEACON_COLLECTION_DOMAIN))}get streamType(){var e;return(e=this.getAttribute(D.STREAM_TYPE))!=null?e:uh(this.nativeEl)}set streamType(e){e!==this.streamType&&(e?this.setAttribute(D.STREAM_TYPE,e):this.removeAttribute(D.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(D.TARGET_LIVE_WINDOW)?+this.getAttribute(D.TARGET_LIVE_WINDOW):Mk(this.nativeEl)}set targetLiveWindow(e){e!=this.targetLiveWindow&&(e==null?this.removeAttribute(D.TARGET_LIVE_WINDOW):this.setAttribute(D.TARGET_LIVE_WINDOW,`${+e}`))}get liveEdgeStart(){var e,t;if(this.hasAttribute(D.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:s}=this,r=(e=this.nativeEl.seekable.end(0))!=null?e:0,n=(t=this.nativeEl.seekable.start(0))!=null?t:0;return Math.max(n,r-s)}return Pk(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(D.LIVE_EDGE_OFFSET))return+this.getAttribute(D.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){e!=this.liveEdgeOffset&&(e==null?this.removeAttribute(D.LIVE_EDGE_OFFSET):this.setAttribute(D.LIVE_EDGE_OFFSET,`${+e}`))}get seekable(){return dm(this.nativeEl)}async addCuePoints(e){return Iy(this.nativeEl,e)}get activeCuePoint(){return Ly(this.nativeEl)}get cuePoints(){return Zx(this.nativeEl)}async addChapters(e){return xy(this.nativeEl,e)}get activeChapter(){return ky(this.nativeEl)}get chapters(){return ek(this.nativeEl)}getStartDate(){return ik(this.nativeEl,this._hls)}get currentPdt(){return sk(this.nativeEl,this._hls)}get preferPlayback(){let e=this.getAttribute(D.PREFER_PLAYBACK);if(e===qi.MSE||e===qi.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===qi.MSE||e===qi.NATIVE?this.setAttribute(D.PREFER_PLAYBACK,e):this.removeAttribute(D.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(e=>e.startsWith("metadata-")&&![D.METADATA_URL].includes(e)).reduce((e,t)=>{let s=this.getAttribute(t);return s!=null&&(e[t.replace(/^metadata-/,"").replace(/-/g,"_")]=s),e},{}),...ft(this,ga)}}set metadata(e){fi(this,ga,e??{}),this.mux&&this.mux.emit("hb",ft(this,ga))}get _hlsConfig(){return ft(this,bl)}set _hlsConfig(e){fi(this,bl,e)}get logo(){var e;return(e=this.getAttribute(D.LOGO))!=null?e:ft(this,va)}set logo(e){e?this.setAttribute(D.LOGO,e):this.removeAttribute(D.LOGO)}load(){Ny(this,this.nativeEl,ft(this,Xt,ir))}unload(){Uy(this.nativeEl,ft(this,Xt,ir),this)}attributeChangedCallback(e,t,s){var r,n;switch(Go.observedAttributes.includes(e)&&!["src","autoplay","preload"].includes(e)&&super.attributeChangedCallback(e,t,s),e){case D.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=s??void 0;break;case D.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=s??void 0;break;case"src":{let a=!!t,o=!!s;!a&&o?Ko(this,Xt,Ea).call(this):a&&!o?this.unload():a&&o&&(this.unload(),Ko(this,Xt,Ea).call(this));break}case"autoplay":if(s===t)break;(r=ft(this,Xt,ir))==null||r.setAutoplay(this.autoplay);break;case"preload":if(s===t)break;(n=ft(this,Xt,ir))==null||n.setPreload(s);break;case D.PLAYBACK_ID:this.src=dh(this);break;case D.DEBUG:{let a=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=a);break}case D.METADATA_URL:s&&fetch(s).then(a=>a.json()).then(a=>this.metadata=a).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${s}!`));break;case D.STREAM_TYPE:(s==null||s!==t)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case D.TARGET_LIVE_WINDOW:(s==null||s!==t)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;case D.LOGO:(s==null||s!==t)&&this.updateLogo();break;case D.DISABLE_TRACKING:{if(s==null||s!==t){let a=this.currentTime,o=this.paused;this.unload(),Ko(this,Xt,Ea).call(this).then(()=>{this.currentTime=a,o||this.play()})}break}case D.DISABLE_COOKIES:{(s==null||s!==t)&&this.disableCookies&&document.cookie.split(";").forEach(a=>{a.trim().startsWith("muxData")&&(document.cookie=a.replace(/^ +/,"").replace(/=.*/,"=;expires="+new Date().toUTCString()+";path=/"))});break}case D.CAP_RENDITION_TO_PLAYER_SIZE:(s==null||s!==t)&&(this.capRenditionToPlayerSize=s!=null?!0:void 0)}}updateLogo(){if(!this.shadowRoot)return;let e=this.shadowRoot.querySelector('slot[name="logo"]');if(!e)return;let t=this.constructor.getLogoHTML(ft(this,va)||this.logo);e.innerHTML=t}connectedCallback(){var e;(e=super.connectedCallback)==null||e.call(this),this.nativeEl&&this.src&&!ft(this,Xt,ir)&&Ko(this,Xt,Ea).call(this)}disconnectedCallback(){this.unload()}handleEvent(e){e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{composed:!0,detail:e.detail}))}};pa=new WeakMap,El=new WeakMap,ga=new WeakMap,yl=new WeakMap,bl=new WeakMap,Tl=new WeakMap,_l=new WeakMap,Al=new WeakMap,va=new WeakMap,Xt=new WeakSet,ir=function(){return Ok(this.nativeEl)},Sl=new WeakMap,Ea=async function(){ft(this,pa)||(await fi(this,pa,Promise.resolve()),fi(this,pa,null),this.load())};const Tr=new WeakMap;class Ec extends Error{}class nD extends Error{}const aD=["application/x-mpegURL","application/vnd.apple.mpegurl","audio/mpegurl"],oD=globalThis.WeakRef?class extends Set{add(i){super.add(new WeakRef(i))}forEach(i){super.forEach(e=>{const t=e.deref();t&&i(t)})}}:Set;function lD(i){globalThis.chrome?.cast?.isAvailable?globalThis.cast?.framework?i():customElements.whenDefined("google-cast-button").then(i):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(i)}}function dD(){return globalThis.chrome}function uD(){const i="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if(globalThis.chrome?.cast||document.querySelector(`script[src="${i}"]`))return;const e=document.createElement("script");e.src=i,document.head.append(e)}function Fs(){return globalThis.cast?.framework?.CastContext.getInstance()}function hm(){return Fs()?.getCurrentSession()}function fm(){return hm()?.getSessionObj().media[0]}function cD(i){return new Promise((e,t)=>{fm().editTracksInfo(i,e,t)})}function hD(i){return new Promise((e,t)=>{fm().getStatus(i,e,t)})}function s0(i){return Fs().setOptions({...Yy(),...i})}function Yy(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}function fD(i){if(!i)return;const e=/\.([a-zA-Z0-9]+)(?:\?.*)?$/,t=i.match(e);return t?t[1]:null}function mD(i){const e=i.split(`
+`),t=[];for(let s=0;s!s.trim().startsWith("#")&&s.trim()!=="")}async function gD(i){try{const t=(await fetch(i,{method:"HEAD"})).headers.get("Content-Type");return aD.some(s=>t===s)}catch(e){return console.error("Error while trying to get the Content-Type of the manifest",e),!1}}async function vD(i){try{const e=await(await fetch(i)).text();let t=e;const s=mD(e);if(s.length>0){const a=new URL(s[0],i).toString();t=await(await fetch(a)).text()}const r=pD(t);return fD(r)}catch(e){console.error("Error while trying to parse the manifest playlist",e);return}}const Il=new oD,bs=new WeakSet;let at;lD(()=>{if(!globalThis.chrome?.cast?.isAvailable){console.debug("chrome.cast.isAvailable",globalThis.chrome?.cast?.isAvailable);return}at||(at=cast.framework,Fs().addEventListener(at.CastContextEventType.CAST_STATE_CHANGED,i=>{Il.forEach(e=>Tr.get(e).onCastStateChanged?.(i))}),Fs().addEventListener(at.CastContextEventType.SESSION_STATE_CHANGED,i=>{Il.forEach(e=>Tr.get(e).onSessionStateChanged?.(i))}),Il.forEach(i=>Tr.get(i).init?.()))});let r0=0;class ED extends EventTarget{#e;#s;#i;#r;#t="disconnected";#a=!1;#n=new Set;#l=new WeakMap;constructor(e){super(),this.#e=e,Il.add(this),Tr.set(this,{init:()=>this.#h(),onCastStateChanged:()=>this.#u(),onSessionStateChanged:()=>this.#m(),getCastPlayer:()=>this.#o}),this.#h()}get#o(){if(bs.has(this.#e))return this.#i}get state(){return this.#t}async watchAvailability(e){if(this.#e.disableRemotePlayback)throw new Ec("disableRemotePlayback attribute is present.");return this.#l.set(e,++r0),this.#n.add(e),queueMicrotask(()=>e(this.#c())),r0}async cancelWatchAvailability(e){if(this.#e.disableRemotePlayback)throw new Ec("disableRemotePlayback attribute is present.");e?this.#n.delete(e):this.#n.clear()}async prompt(){if(this.#e.disableRemotePlayback)throw new Ec("disableRemotePlayback attribute is present.");if(!globalThis.chrome?.cast?.isAvailable)throw new nD("The RemotePlayback API is disabled on this platform.");const e=bs.has(this.#e);bs.add(this.#e),s0(this.#e.castOptions),Object.entries(this.#r).forEach(([t,s])=>{this.#i.controller.addEventListener(t,s)});try{await Fs().requestSession()}catch(t){if(e||bs.delete(this.#e),t==="cancel")return;throw new Error(t)}Tr.get(this.#e)?.loadOnPrompt?.()}#d(){bs.has(this.#e)&&(Object.entries(this.#r).forEach(([e,t])=>{this.#i.controller.removeEventListener(e,t)}),bs.delete(this.#e),this.#e.muted=this.#i.isMuted,this.#e.currentTime=this.#i.savedPlayerState.currentTime,this.#i.savedPlayerState.isPaused===!1&&this.#e.play())}#c(){const e=Fs()?.getCastState();return e&&e!=="NO_DEVICES_AVAILABLE"}#u(){const e=Fs().getCastState();if(bs.has(this.#e)&&e==="CONNECTING"&&(this.#t="connecting",this.dispatchEvent(new Event("connecting"))),!this.#a&&e?.includes("CONNECT")){this.#a=!0;for(let t of this.#n)t(!0)}else if(this.#a&&(!e||e==="NO_DEVICES_AVAILABLE")){this.#a=!1;for(let t of this.#n)t(!1)}}async#m(){const{SESSION_RESUMED:e}=at.SessionState;if(Fs().getSessionState()===e&&this.#e.castSrc===fm()?.media.contentId){bs.add(this.#e),Object.entries(this.#r).forEach(([t,s])=>{this.#i.controller.addEventListener(t,s)});try{await hD(new chrome.cast.media.GetStatusRequest)}catch(t){console.error(t)}this.#r[at.RemotePlayerEventType.IS_PAUSED_CHANGED](),this.#r[at.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}}#h(){!at||this.#s||(this.#s=!0,s0(this.#e.castOptions),this.#e.textTracks.addEventListener("change",()=>this.#f()),this.#u(),this.#i=new at.RemotePlayer,new at.RemotePlayerController(this.#i),this.#r={[at.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:e})=>{e===!0?(this.#t="connected",this.dispatchEvent(new Event("connect"))):(this.#d(),this.#t="disconnected",this.dispatchEvent(new Event("disconnect")))},[at.RemotePlayerEventType.DURATION_CHANGED]:()=>{this.#e.dispatchEvent(new Event("durationchange"))},[at.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{this.#e.dispatchEvent(new Event("volumechange"))},[at.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{this.#e.dispatchEvent(new Event("volumechange"))},[at.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{this.#o?.isMediaLoaded&&this.#e.dispatchEvent(new Event("timeupdate"))},[at.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{this.#e.dispatchEvent(new Event("resize"))},[at.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{this.#e.dispatchEvent(new Event(this.paused?"pause":"play"))},[at.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{this.#o?.playerState!==chrome.cast.media.PlayerState.PAUSED&&this.#e.dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[this.#o?.playerState]))},[at.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{this.#o?.isMediaLoaded&&(await Promise.resolve(),this.#p())}})}#p(){this.#f()}async#f(){if(!this.#o)return;const t=(this.#i.mediaInfo?.tracks??[]).filter(({type:c})=>c===chrome.cast.media.TrackType.TEXT),s=[...this.#e.textTracks].filter(({kind:c})=>c==="subtitles"||c==="captions"),r=t.map(({language:c,name:h,trackId:f})=>{const{mode:m}=s.find(p=>p.language===c&&p.label===h)??{};return m?{mode:m,trackId:f}:!1}).filter(Boolean),a=r.filter(({mode:c})=>c!=="showing").map(({trackId:c})=>c),o=r.find(({mode:c})=>c==="showing"),l=hm()?.getSessionObj().media[0]?.activeTrackIds??[];let d=l;if(l.length&&(d=d.filter(c=>!a.includes(c))),o?.trackId&&(d=[...d,o.trackId]),d=[...new Set(d)],!((c,h)=>c.length===h.length&&c.every(f=>h.includes(f)))(l,d))try{const c=new chrome.cast.media.EditTracksInfoRequest(d);await cD(c)}catch(c){console.error(c)}}}const yD=i=>class extends i{static observedAttributes=[...i.observedAttributes??[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"];#e={paused:!1};#s=Yy();#i;#r;get remote(){return this.#r?this.#r:dD()?(this.disableRemotePlayback||uD(),Tr.set(this,{loadOnPrompt:()=>this.#a()}),this.#r=new ED(this)):super.remote}get#t(){return Tr.get(this.remote)?.getCastPlayer?.()}attributeChangedCallback(t,s,r){if(super.attributeChangedCallback(t,s,r),t==="cast-receiver"&&r){this.#s.receiverApplicationId=r;return}if(this.#t)switch(t){case"cast-stream-type":case"cast-src":this.load();break}}async#a(){this.#e.paused=super.paused,super.pause(),this.muted=super.muted;try{await this.load()}catch(t){console.error(t)}}async load(){if(!this.#t)return super.load();const t=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);t.customData=this.castCustomData;const s=[...this.querySelectorAll("track")].filter(({kind:o,src:l})=>l&&(o==="subtitles"||o==="captions")),r=[];let n=0;if(s.length&&(t.tracks=s.map(o=>{const l=++n;r.length===0&&o.track.mode==="showing"&&r.push(l);const d=new chrome.cast.media.Track(l,chrome.cast.media.TrackType.TEXT);return d.trackContentId=o.src,d.trackContentType="text/vtt",d.subtype=o.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,d.name=o.label,d.language=o.srclang,d})),this.castStreamType==="live"?t.streamType=chrome.cast.media.StreamType.LIVE:t.streamType=chrome.cast.media.StreamType.BUFFERED,t.metadata=new chrome.cast.media.GenericMediaMetadata,t.metadata.title=this.title,t.metadata.images=[{url:this.poster}],gD(this.castSrc)){const o=await vD(this.castSrc);o?.includes("m4s")||o?.includes("mp4")?(t.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.FMP4,t.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.FMP4):o?.includes("ts")&&(t.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.TS,t.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.TS)}const a=new chrome.cast.media.LoadRequest(t);a.currentTime=super.currentTime??0,a.autoplay=!this.#e.paused,a.activeTrackIds=r,await hm()?.loadMedia(a),this.dispatchEvent(new Event("volumechange"))}play(){if(this.#t){this.#t.isPaused&&this.#t.controller?.playOrPause();return}return super.play()}pause(){if(this.#t){this.#t.isPaused||this.#t.controller?.playOrPause();return}super.pause()}get castOptions(){return this.#s}get castReceiver(){return this.getAttribute("cast-receiver")??void 0}set castReceiver(t){this.castReceiver!=t&&this.setAttribute("cast-receiver",`${t}`)}get castSrc(){return this.getAttribute("cast-src")??this.querySelector("source")?.src??this.currentSrc}set castSrc(t){this.castSrc!=t&&this.setAttribute("cast-src",`${t}`)}get castContentType(){return this.getAttribute("cast-content-type")??void 0}set castContentType(t){this.setAttribute("cast-content-type",`${t}`)}get castStreamType(){return this.getAttribute("cast-stream-type")??this.streamType??void 0}set castStreamType(t){this.setAttribute("cast-stream-type",`${t}`)}get castCustomData(){return this.#i}set castCustomData(t){const s=typeof t;if(!["object","undefined"].includes(s)){console.error(`castCustomData must be nullish or an object but value was of type ${s}`);return}this.#i=t}get readyState(){if(this.#t)switch(this.#t.playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return this.#t?this.#t.isPaused:super.paused}get muted(){return this.#t?this.#t?.isMuted:super.muted}set muted(t){if(this.#t){(t&&!this.#t.isMuted||!t&&this.#t.isMuted)&&this.#t.controller?.muteOrUnmute();return}super.muted=t}get volume(){return this.#t?this.#t?.volumeLevel??1:super.volume}set volume(t){if(this.#t){this.#t.volumeLevel=+t,this.#t.controller?.setVolumeLevel();return}super.volume=t}get duration(){return this.#t&&this.#t?.isMediaLoaded?this.#t?.duration??NaN:super.duration}get currentTime(){return this.#t&&this.#t?.isMediaLoaded?this.#t?.currentTime??0:super.currentTime}set currentTime(t){if(this.#t){this.#t.currentTime=t,this.#t.controller?.seek();return}super.currentTime=t}};class bu extends Event{track;constructor(e,t){super(e),this.track=t.track}}const fh=new WeakMap;function Z(i){return fh.get(i)??bD(i,{})}function bD(i,e){let t=fh.get(i);return t||fh.set(i,t={}),Object.assign(t,e)}function mh(i,e){const t=i.videoTracks;Z(e).media=i,Z(e).renditionSet||(Z(e).renditionSet=new Set);const s=Z(t).trackSet;s.add(e);const r=s.size-1;r in gh.prototype||Object.defineProperty(gh.prototype,r,{get(){return[...Z(this).trackSet][r]}}),queueMicrotask(()=>{t.dispatchEvent(new bu("addtrack",{track:e}))})}function ph(i){const e=Z(i).media?.videoTracks;if(!e)return;Z(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new bu("removetrack",{track:i}))})}function TD(i){const e=Z(i).media.videoTracks??[];let t=!1;for(const s of e)s!==i&&(s.selected=!1,t=!0);if(t){if(Z(e).changeRequested)return;Z(e).changeRequested=!0,queueMicrotask(()=>{delete Z(e).changeRequested,e.dispatchEvent(new Event("change"))})}}class gh extends EventTarget{#e;#s;#i;constructor(){super(),Z(this).trackSet=new Set}get#r(){return Z(this).trackSet}[Symbol.iterator](){return this.#r.values()}get length(){return this.#r.size}getTrackById(e){return[...this.#r].find(t=>t.id===e)??null}get selectedIndex(){return[...this.#r].findIndex(e=>e.selected)}get onaddtrack(){return this.#e}set onaddtrack(e){this.#e&&(this.removeEventListener("addtrack",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addtrack",e))}get onremovetrack(){return this.#s}set onremovetrack(e){this.#s&&(this.removeEventListener("removetrack",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removetrack",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class Tu extends Event{rendition;constructor(e,t){super(e),this.rendition=t.rendition}}function _D(i,e){const t=Z(i).media.videoRenditions;Z(e).media=Z(i).media,Z(e).track=i;const s=Z(i).renditionSet;s.add(e);const r=s.size-1;r in vh.prototype||Object.defineProperty(vh.prototype,r,{get(){return zr(this)[r]}}),queueMicrotask(()=>{i.selected&&t.dispatchEvent(new Tu("addrendition",{rendition:e}))})}function AD(i){const e=Z(i).media.videoRenditions,t=Z(i).track;Z(t).renditionSet.delete(i),queueMicrotask(()=>{Z(i).track.selected&&e.dispatchEvent(new Tu("removerendition",{rendition:i}))})}function SD(i){const e=Z(i).media.videoRenditions;!e||Z(e).changeRequested||(Z(e).changeRequested=!0,queueMicrotask(()=>{delete Z(e).changeRequested,Z(i).track.selected&&e.dispatchEvent(new Event("change"))}))}function zr(i){return[...Z(i).media.videoTracks].filter(t=>t.selected).flatMap(t=>[...Z(t).renditionSet])}class vh extends EventTarget{#e;#s;#i;[Symbol.iterator](){return zr(this).values()}get length(){return zr(this).length}getRenditionById(e){return zr(this).find(t=>`${t.id}`==`${e}`)??null}get selectedIndex(){return zr(this).findIndex(e=>e.selected)}set selectedIndex(e){for(const[t,s]of zr(this).entries())s.selected=t===e}get onaddrendition(){return this.#e}set onaddrendition(e){this.#e&&(this.removeEventListener("addrendition",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addrendition",e))}get onremoverendition(){return this.#s}set onremoverendition(e){this.#s&&(this.removeEventListener("removerendition",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removerendition",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class ID{src;id;width;height;bitrate;frameRate;codec;#e=!1;get selected(){return this.#e}set selected(e){this.#e!==e&&(this.#e=e,SD(this))}}class jy{id;kind;label="";language="";sourceBuffer;#e=!1;addRendition(e,t,s,r,n,a){const o=new ID;return o.src=e,o.width=t,o.height=s,o.frameRate=a,o.bitrate=n,o.codec=r,_D(this,o),o}removeRendition(e){AD(e)}get selected(){return this.#e}set selected(e){this.#e!==e&&(this.#e=e,e===!0&&TD(this))}}function LD(i,e){const t=Z(i).media.audioRenditions;Z(e).media=Z(i).media,Z(e).track=i;const s=Z(i).renditionSet;s.add(e);const r=s.size-1;r in Eh.prototype||Object.defineProperty(Eh.prototype,r,{get(){return Qr(this)[r]}}),queueMicrotask(()=>{i.enabled&&t.dispatchEvent(new Tu("addrendition",{rendition:e}))})}function RD(i){const e=Z(i).media.audioRenditions,t=Z(i).track;Z(t).renditionSet.delete(i),queueMicrotask(()=>{Z(i).track.enabled&&e.dispatchEvent(new Tu("removerendition",{rendition:i}))})}function xD(i){const e=Z(i).media.audioRenditions;!e||Z(e).changeRequested||(Z(e).changeRequested=!0,queueMicrotask(()=>{delete Z(e).changeRequested,Z(i).track.enabled&&e.dispatchEvent(new Event("change"))}))}function Qr(i){return[...Z(i).media.audioTracks].filter(t=>t.enabled).flatMap(t=>[...Z(t).renditionSet])}class Eh extends EventTarget{#e;#s;#i;[Symbol.iterator](){return Qr(this).values()}get length(){return Qr(this).length}getRenditionById(e){return Qr(this).find(t=>`${t.id}`==`${e}`)??null}get selectedIndex(){return Qr(this).findIndex(e=>e.selected)}set selectedIndex(e){for(const[t,s]of Qr(this).entries())s.selected=t===e}get onaddrendition(){return this.#e}set onaddrendition(e){this.#e&&(this.removeEventListener("addrendition",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addrendition",e))}get onremoverendition(){return this.#s}set onremoverendition(e){this.#s&&(this.removeEventListener("removerendition",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removerendition",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class kD{src;id;bitrate;codec;#e=!1;get selected(){return this.#e}set selected(e){this.#e!==e&&(this.#e=e,xD(this))}}function yh(i,e){const t=i.audioTracks;Z(e).media=i,Z(e).renditionSet||(Z(e).renditionSet=new Set);const s=Z(t).trackSet;s.add(e);const r=s.size-1;r in Th.prototype||Object.defineProperty(Th.prototype,r,{get(){return[...Z(this).trackSet][r]}}),queueMicrotask(()=>{t.dispatchEvent(new bu("addtrack",{track:e}))})}function bh(i){const e=Z(i).media?.audioTracks;if(!e)return;Z(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new bu("removetrack",{track:i}))})}function DD(i){const e=Z(i).media.audioTracks;!e||Z(e).changeRequested||(Z(e).changeRequested=!0,queueMicrotask(()=>{delete Z(e).changeRequested,e.dispatchEvent(new Event("change"))}))}class Th extends EventTarget{#e;#s;#i;constructor(){super(),Z(this).trackSet=new Set}get#r(){return Z(this).trackSet}[Symbol.iterator](){return this.#r.values()}get length(){return this.#r.size}getTrackById(e){return[...this.#r].find(t=>t.id===e)??null}get onaddtrack(){return this.#e}set onaddtrack(e){this.#e&&(this.removeEventListener("addtrack",this.#e),this.#e=void 0),typeof e=="function"&&(this.#e=e,this.addEventListener("addtrack",e))}get onremovetrack(){return this.#s}set onremovetrack(e){this.#s&&(this.removeEventListener("removetrack",this.#s),this.#s=void 0),typeof e=="function"&&(this.#s=e,this.addEventListener("removetrack",e))}get onchange(){return this.#i}set onchange(e){this.#i&&(this.removeEventListener("change",this.#i),this.#i=void 0),typeof e=="function"&&(this.#i=e,this.addEventListener("change",e))}}class zy{id;kind;label="";language="";sourceBuffer;#e=!1;addRendition(e,t,s){const r=new kD;return r.src=e,r.codec=t,r.bitrate=s,LD(this,r),r}removeRendition(e){RD(e)}get enabled(){return this.#e}set enabled(e){this.#e!==e&&(this.#e=e,DD(this))}}const n0=Hd(globalThis.HTMLMediaElement,"video"),a0=Hd(globalThis.HTMLMediaElement,"audio");function CD(i){if(!i?.prototype)return i;const e=Hd(i,"video");(!e||`${e}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"videoTracks",{get(){return wD(this)}});const t=Hd(i,"audio");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"audioTracks",{get(){return MD(this)}}),"addVideoTrack"in i.prototype||(i.prototype.addVideoTrack=function(n,a="",o=""){const l=new jy;return l.kind=n,l.label=a,l.language=o,mh(this,l),l}),"removeVideoTrack"in i.prototype||(i.prototype.removeVideoTrack=ph),"addAudioTrack"in i.prototype||(i.prototype.addAudioTrack=function(n,a="",o=""){const l=new zy;return l.kind=n,l.label=a,l.language=o,yh(this,l),l}),"removeAudioTrack"in i.prototype||(i.prototype.removeAudioTrack=bh),"videoRenditions"in i.prototype||Object.defineProperty(i.prototype,"videoRenditions",{get(){return s(this)}});const s=n=>{let a=Z(n).videoRenditions;return a||(a=new vh,Z(a).media=n,Z(n).videoRenditions=a),a};"audioRenditions"in i.prototype||Object.defineProperty(i.prototype,"audioRenditions",{get(){return r(this)}});const r=n=>{let a=Z(n).audioRenditions;return a||(a=new Eh,Z(a).media=n,Z(n).audioRenditions=a),a};return i}function Hd(i,e){if(i?.prototype)return Object.getOwnPropertyDescriptor(i.prototype,`${e}Tracks`)?.get}function wD(i){let e=Z(i).videoTracks;if(!e&&(e=new gh,Z(i).videoTracks=e,n0)){const t=n0.call(i.nativeEl??i);for(const s of t)mh(i,s);t.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),t.addEventListener("addtrack",s=>{if([...e].some(r=>r instanceof jy)){for(const r of t)ph(r);return}mh(i,s.track)}),t.addEventListener("removetrack",s=>{ph(s.track)})}return e}function MD(i){let e=Z(i).audioTracks;if(!e&&(e=new Th,Z(i).audioTracks=e,a0)){const t=a0.call(i.nativeEl??i);for(const s of t)yh(i,s);t.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),t.addEventListener("addtrack",s=>{if([...e].some(r=>r instanceof zy)){for(const r of t)bh(r);return}yh(i,s.track)}),t.addEventListener("removetrack",s=>{bh(s.track)})}return e}var Qy=i=>{throw TypeError(i)},Xy=(i,e,t)=>e.has(i)||Qy("Cannot "+t),PD=(i,e,t)=>(Xy(i,e,"read from private field"),t?t.call(i):e.get(i)),OD=(i,e,t)=>e.has(i)?Qy("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),ND=(i,e,t,s)=>(Xy(i,e,"write to private field"),e.set(i,t),t),Zy=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment>"u"){class i extends Zy{}globalThis.DocumentFragment=i}var UD=class extends Zy{},$D={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(UD)}},FD={customElements:$D},BD=typeof window>"u"||typeof globalThis.customElements>"u",yc=BD?FD:globalThis,Ll,o0=class extends yD(CD(rD)){constructor(){super(...arguments),OD(this,Ll)}get autoplay(){let i=this.getAttribute("autoplay");return i===null?!1:i===""?!0:i}set autoplay(i){let e=this.autoplay;i!==e&&(i?this.setAttribute("autoplay",typeof i=="string"?i:""):this.removeAttribute("autoplay"))}get muxCastCustomData(){return{mux:{playbackId:this.playbackId,minResolution:this.minResolution,maxResolution:this.maxResolution,renditionOrder:this.renditionOrder,customDomain:this.customDomain,tokens:{drm:this.drmToken},envKey:this.envKey,metadata:this.metadata,disableCookies:this.disableCookies,disableTracking:this.disableTracking,beaconCollectionDomain:this.beaconCollectionDomain,startTime:this.startTime,preferCmcd:this.preferCmcd}}}get castCustomData(){var i;return(i=PD(this,Ll))!=null?i:this.muxCastCustomData}set castCustomData(i){ND(this,Ll,i)}};Ll=new WeakMap;yc.customElements.get("mux-video")||(yc.customElements.define("mux-video",o0),yc.MuxVideoElement=o0);const Y={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_LOOP_REQUEST:"medialooprequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},Ae={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},Jy={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_PLAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_LOOP:"mediaLoop",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_LANG:"mediaLang",MEDIA_WIDTH:"mediaWidth"},eb=Object.entries(Jy),_=eb.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{}),HD={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},ms=eb.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{...HD});Object.entries(ms).reduce((i,[e,t])=>{const s=_[e];return s&&(i[t]=s),i},{userinactivechange:"userinactive"});const GD=Object.entries(_).reduce((i,[e,t])=>{const s=ms[e];return s&&(i[t]=s),i},{userinactive:"userinactivechange"}),zi={SUBTITLES:"subtitles",CAPTIONS:"captions",CHAPTERS:"chapters",METADATA:"metadata"},Dn={DISABLED:"disabled",SHOWING:"showing"},bc={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},Nt={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},ls={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},KD={FULLSCREEN:"fullscreen"};function VD(i){return i?.map(qD).join(" ")}function WD(i){return i?.split(/\s+/).map(YD)}function qD(i){if(i){const{id:e,width:t,height:s}=i;return[e,t,s].filter(r=>r!=null).join(":")}}function YD(i){if(i){const[e,t,s]=i.split(":");return{id:e,width:+t,height:+s}}}function jD(i){return i?.map(QD).join(" ")}function zD(i){return i?.split(/\s+/).map(XD)}function QD(i){if(i){const{id:e,kind:t,language:s,label:r}=i;return[e,t,s,r].filter(n=>n!=null).join(":")}}function XD(i){if(i){const[e,t,s,r]=i.split(":");return{id:e,kind:t,language:s,label:r}}}function ZD(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function mm(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function tb(i){return typeof i!="string"?!1:!isNaN(i)&&!isNaN(parseFloat(i))}const ib=i=>new Promise(e=>setTimeout(e,i)),l0=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],JD=(i,e)=>{const t=i===1?l0[e].singular:l0[e].plural;return`${i} ${t}`},Ha=i=>{if(!mm(i))return"";const e=Math.abs(i),t=e!==i,s=new Date(0,0,0,0,0,e,0);return`${[s.getHours(),s.getMinutes(),s.getSeconds()].map((o,l)=>o&&JD(o,l)).filter(o=>o).join(", ")}${t?" remaining":""}`};function Gs(i,e){let t=!1;i<0&&(t=!0,i=0-i),i=i<0?0:i;let s=Math.floor(i%60),r=Math.floor(i/60%60),n=Math.floor(i/3600);const a=Math.floor(e/60%60),o=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(n=r=s="0"),n=n>0||o>0?n+":":"",r=((n||a>=10)&&r<10?"0"+r:r)+":",s=s<10?"0"+s:s,(t?"-":"")+n+r+s}const eC={"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute",Loop:"Loop","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings",Auto:"Auto","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute","chapter: {chapterName}":"chapter: {chapterName}",live:"live",Off:"Off","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","Source Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."};var d0;const Tc={en:eC};let _h=((d0=globalThis.navigator)==null?void 0:d0.language)||"en";const tC=i=>{_h=i},iC=i=>{var e,t,s;const[r]=_h.split("-");return((e=Tc[_h])==null?void 0:e[i])||((t=Tc[r])==null?void 0:t[i])||((s=Tc.en)==null?void 0:s[i])||i},J=(i,e={})=>iC(i).replace(/\{(\w+)\}/g,(t,s)=>s in e?String(e[s]):`{${s}}`);let sb=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}};class rb extends sb{}let u0=class extends rb{constructor(){super(...arguments),this.role=null}};class sC{observe(){}unobserve(){}disconnect(){}}const nb={createElement:function(){return new no.HTMLElement},createElementNS:function(){return new no.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(i){return!1}},no={ResizeObserver:sC,document:nb,Node:rb,Element:u0,HTMLElement:class extends u0{constructor(){super(...arguments),this.innerHTML=""}get content(){return new no.DocumentFragment}},DocumentFragment:class extends sb{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem(i){return null},setItem(i,e){},removeItem(i){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia(i){return{matches:!1,media:i}},DOMParser:class{parseFromString(e,t){return{body:{textContent:e}}}}},ab="global"in globalThis&&globalThis?.global===globalThis||typeof window>"u"||typeof window.customElements>"u",ob=Object.keys(no).every(i=>i in globalThis),k=ab&&!ob?no:globalThis,tt=ab&&!ob?nb:globalThis.document,c0=new WeakMap,pm=i=>{let e=c0.get(i);return e||c0.set(i,e=new Set),e},lb=new k.ResizeObserver(i=>{for(const e of i)for(const t of pm(e.target))t(e)});function Hn(i,e){pm(i).add(e),lb.observe(i)}function Gn(i,e){const t=pm(i);t.delete(e),t.size||lb.unobserve(i)}function Yt(i){const e={};for(const t of i)e[t.name]=t.value;return e}function wt(i){var e;return(e=Ah(i))!=null?e:Yn(i,"media-controller")}function Ah(i){var e;const{MEDIA_CONTROLLER:t}=Ae,s=i.getAttribute(t);if(s)return(e=_u(i))==null?void 0:e.getElementById(s)}const db=(i,e,t=".value")=>{const s=i.querySelector(t);s&&(s.textContent=e)},rC=(i,e)=>{const t=`slot[name="${e}"]`,s=i.shadowRoot.querySelector(t);return s?s.children:[]},ub=(i,e)=>rC(i,e)[0],gs=(i,e)=>!i||!e?!1:i?.contains(e)?!0:gs(i,e.getRootNode().host),Yn=(i,e)=>{if(!i)return null;const t=i.closest(e);return t||Yn(i.getRootNode().host,e)};function gm(i=document){var e;const t=i?.activeElement;return t?(e=gm(t.shadowRoot))!=null?e:t:null}function _u(i){var e;const t=(e=i?.getRootNode)==null?void 0:e.call(i);return t instanceof ShadowRoot||t instanceof Document?t:null}function cb(i,{depth:e=3,checkOpacity:t=!0,checkVisibilityCSS:s=!0}={}){if(i.checkVisibility)return i.checkVisibility({checkOpacity:t,checkVisibilityCSS:s});let r=i;for(;r&&e>0;){const n=getComputedStyle(r);if(t&&n.opacity==="0"||s&&n.visibility==="hidden"||n.display==="none")return!1;r=r.parentElement,e--}return!0}function nC(i,e,t,s){const r=s.x-t.x,n=s.y-t.y,a=r*r+n*n;if(a===0)return 0;const o=((i-t.x)*r+(e-t.y)*n)/a;return Math.max(0,Math.min(1,o))}function ut(i,e){const t=aC(i,s=>s===e);return t||vm(i,e)}function aC(i,e){var t,s;let r;for(r of(t=i.querySelectorAll("style:not([media])"))!=null?t:[]){let n;try{n=(s=r.sheet)==null?void 0:s.cssRules}catch{continue}for(const a of n??[])if(e(a.selectorText))return a}}function vm(i,e){var t,s;const r=(t=i.querySelectorAll("style:not([media])"))!=null?t:[],n=r?.[r.length-1];return n?.sheet?(n?.sheet.insertRule(`${e}{}`,n.sheet.cssRules.length),(s=n.sheet.cssRules)==null?void 0:s[n.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",i),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function Oe(i,e,t=Number.NaN){const s=i.getAttribute(e);return s!=null?+s:t}function Ye(i,e,t){const s=+t;if(t==null||Number.isNaN(s)){i.hasAttribute(e)&&i.removeAttribute(e);return}Oe(i,e,void 0)!==s&&i.setAttribute(e,`${s}`)}function ve(i,e){return i.hasAttribute(e)}function Ee(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}ve(i,e)!=t&&i.toggleAttribute(e,t)}function Ne(i,e,t=null){var s;return(s=i.getAttribute(e))!=null?s:t}function Ue(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}const s=`${t}`;Ne(i,e,void 0)!==s&&i.setAttribute(e,s)}var hb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ts=(i,e,t)=>(hb(i,e,"read from private field"),t?t.call(i):e.get(i)),oC=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Vo=(i,e,t,s)=>(hb(i,e,"write to private field"),e.set(i,t),t),kt;function lC(i){return`
+
+ `}class Au extends k.HTMLElement{constructor(){if(super(),oC(this,kt,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Ae.MEDIA_CONTROLLER,_.MEDIA_PAUSED]}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER&&(t&&((n=(r=Ts(this,kt))==null?void 0:r.unassociateElement)==null||n.call(r,this),Vo(this,kt,null)),s&&this.isConnected&&(Vo(this,kt,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Ts(this,kt))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,s,r;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),Vo(this,kt,dC(this)),this.getAttribute(Ae.MEDIA_CONTROLLER)&&((t=(e=Ts(this,kt))==null?void 0:e.associateElement)==null||t.call(e,this)),(s=Ts(this,kt))==null||s.addEventListener("pointerdown",this),(r=Ts(this,kt))==null||r.addEventListener("click",this)}disconnectedCallback(){var e,t,s,r;this.getAttribute(Ae.MEDIA_CONTROLLER)&&((t=(e=Ts(this,kt))==null?void 0:e.unassociateElement)==null||t.call(e,this)),(s=Ts(this,kt))==null||s.removeEventListener("pointerdown",this),(r=Ts(this,kt))==null||r.removeEventListener("click",this),Vo(this,kt,null)}handleEvent(e){var t;const s=(t=e.composedPath())==null?void 0:t[0];if(["video","media-controller"].includes(s?.localName)){if(e.type==="pointerdown")this._pointerType=e.pointerType;else if(e.type==="click"){const{clientX:n,clientY:a}=e,{left:o,top:l,width:d,height:u}=this.getBoundingClientRect(),c=n-o,h=a-l;if(c<0||h<0||c>d||h>u||d===0&&u===0)return;const f=this._pointerType||"mouse";if(this._pointerType=void 0,f===bc.TOUCH){this.handleTap(e);return}else if(f===bc.MOUSE||f===bc.PEN){this.handleMouseClick(e);return}}}}get mediaPaused(){return ve(this,_.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,_.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){const t=this.mediaPaused?Y.MEDIA_PLAY_REQUEST:Y.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new k.CustomEvent(t,{composed:!0,bubbles:!0}))}}kt=new WeakMap;Au.shadowRootOptions={mode:"open"};Au.getTemplateHTML=lC;function dC(i){var e;const t=i.getAttribute(Ae.MEDIA_CONTROLLER);return t?(e=i.getRootNode())==null?void 0:e.getElementById(t):Yn(i,"media-controller")}k.customElements.get("media-gesture-receiver")||k.customElements.define("media-gesture-receiver",Au);var h0=Au,Em=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Kt=(i,e,t)=>(Em(i,e,"read from private field"),t?t.call(i):e.get(i)),Ut=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},sr=(i,e,t,s)=>(Em(i,e,"write to private field"),e.set(i,t),t),ei=(i,e,t)=>(Em(i,e,"access private method"),t),Gd,Xr,ao,bn,Rl,Sh,fb,ya,xl,Ih,mb,Lh,pb,oo,Su,Iu,ym,Kn,lo;const ne={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"};function uC(i){return`
+
+
+
+
+
+
+
+ ${h0.getTemplateHTML({})}
+
+
+
+
+
+
+
+
+
+
+
+ `}const cC=Object.values(_),hC="sm:384 md:576 lg:768 xl:960";function fC(i){gb(i.target,i.contentRect.width)}function gb(i,e){var t;if(!i.isConnected)return;const s=(t=i.getAttribute(ne.BREAKPOINTS))!=null?t:hC,r=mC(s),n=pC(r,e);let a=!1;if(Object.keys(r).forEach(o=>{if(n.includes(o)){i.hasAttribute(`breakpoint${o}`)||(i.setAttribute(`breakpoint${o}`,""),a=!0);return}i.hasAttribute(`breakpoint${o}`)&&(i.removeAttribute(`breakpoint${o}`),a=!0)}),a){const o=new CustomEvent(ms.BREAKPOINTS_CHANGE,{detail:n});i.dispatchEvent(o)}i.breakpointsComputed||(i.breakpointsComputed=!0,i.dispatchEvent(new CustomEvent(ms.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}function mC(i){const e=i.split(/\s+/);return Object.fromEntries(e.map(t=>t.split(":")))}function pC(i,e){return Object.keys(i).filter(t=>e>=parseInt(i[t]))}class Lu extends k.HTMLElement{constructor(){if(super(),Ut(this,Sh),Ut(this,Ih),Ut(this,Lh),Ut(this,oo),Ut(this,Iu),Ut(this,Kn),Ut(this,Gd,0),Ut(this,Xr,null),Ut(this,ao,null),Ut(this,bn,void 0),this.breakpointsComputed=!1,Ut(this,Rl,new MutationObserver(ei(this,Sh,fb).bind(this))),Ut(this,ya,!1),Ut(this,xl,t=>{Kt(this,ya)||(setTimeout(()=>{fC(t),sr(this,ya,!1)},0),sr(this,ya,!0))}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const t=Yt(this.attributes),s=this.constructor.getTemplateHTML(t);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(s):this.shadowRoot.innerHTML=s}const e=this.querySelector(":scope > slot[slot=media]");e&&e.addEventListener("slotchange",()=>{if(!e.assignedElements({flatten:!0}).length){Kt(this,Xr)&&this.mediaUnsetCallback(Kt(this,Xr));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[ne.AUTOHIDE,ne.GESTURES_DISABLED].concat(cC).filter(e=>![_.MEDIA_RENDITION_LIST,_.MEDIA_AUDIO_TRACK_LIST,_.MEDIA_CHAPTERS_CUES,_.MEDIA_WIDTH,_.MEDIA_HEIGHT,_.MEDIA_ERROR,_.MEDIA_ERROR_MESSAGE].includes(e))}attributeChangedCallback(e,t,s){e.toLowerCase()==ne.AUTOHIDE&&(this.autohide=s)}get media(){let e=this.querySelector(":scope > [slot=media]");return e?.nodeName=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(sr(this,Xr,e),e.localName.includes("-")&&await k.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;Kt(this,Rl).observe(this,{childList:!0,subtree:!0}),Hn(this,Kt(this,xl));const t=this.getAttribute(ne.AUDIO)!=null,s=J(t?"audio player":"video player");this.setAttribute("role","region"),this.setAttribute("aria-label",s),this.handleMediaUpdated(this.media),this.setAttribute(ne.USER_INACTIVE,""),gb(this,this.getBoundingClientRect().width),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),(e=k.window)==null||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;Kt(this,Rl).disconnect(),Gn(this,Kt(this,xl)),this.media&&this.mediaUnsetCallback(this.media),(e=k.window)==null||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){sr(this,Xr,null)}handleEvent(e){switch(e.type){case"pointerdown":sr(this,Gd,e.timeStamp);break;case"pointermove":ei(this,Ih,mb).call(this,e);break;case"pointerup":ei(this,Lh,pb).call(this,e);break;case"mouseleave":ei(this,oo,Su).call(this);break;case"mouseup":this.removeAttribute(ne.KEYBOARD_CONTROL);break;case"keyup":ei(this,Kn,lo).call(this),this.setAttribute(ne.KEYBOARD_CONTROL,"");break}}set autohide(e){const t=Number(e);sr(this,bn,isNaN(t)?0:t)}get autohide(){return(Kt(this,bn)===void 0?2:Kt(this,bn)).toString()}get breakpoints(){return Ne(this,ne.BREAKPOINTS)}set breakpoints(e){Ue(this,ne.BREAKPOINTS,e)}get audio(){return ve(this,ne.AUDIO)}set audio(e){Ee(this,ne.AUDIO,e)}get gesturesDisabled(){return ve(this,ne.GESTURES_DISABLED)}set gesturesDisabled(e){Ee(this,ne.GESTURES_DISABLED,e)}get keyboardControl(){return ve(this,ne.KEYBOARD_CONTROL)}set keyboardControl(e){Ee(this,ne.KEYBOARD_CONTROL,e)}get noAutohide(){return ve(this,ne.NO_AUTOHIDE)}set noAutohide(e){Ee(this,ne.NO_AUTOHIDE,e)}get autohideOverControls(){return ve(this,ne.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(e){Ee(this,ne.AUTOHIDE_OVER_CONTROLS,e)}get userInteractive(){return ve(this,ne.USER_INACTIVE)}set userInteractive(e){Ee(this,ne.USER_INACTIVE,e)}}Gd=new WeakMap;Xr=new WeakMap;ao=new WeakMap;bn=new WeakMap;Rl=new WeakMap;Sh=new WeakSet;fb=function(i){const e=this.media;for(const t of i){if(t.type!=="childList")continue;const s=t.removedNodes;for(const r of s){if(r.slot!="media"||t.target!=this)continue;let n=t.previousSibling&&t.previousSibling.previousElementSibling;if(!n||!e)this.mediaUnsetCallback(r);else{let a=n.slot!=="media";for(;(n=n.previousSibling)!==null;)n.slot=="media"&&(a=!1);a&&this.mediaUnsetCallback(r)}}if(e)for(const r of t.addedNodes)r===e&&this.handleMediaUpdated(e)}};ya=new WeakMap;xl=new WeakMap;Ih=new WeakSet;mb=function(i){if(i.pointerType!=="mouse"&&i.timeStamp-Kt(this,Gd)<250)return;ei(this,Iu,ym).call(this),clearTimeout(Kt(this,ao));const e=this.hasAttribute(ne.AUTOHIDE_OVER_CONTROLS);([this,this.media].includes(i.target)||e)&&ei(this,Kn,lo).call(this)};Lh=new WeakSet;pb=function(i){if(i.pointerType==="touch"){const e=!this.hasAttribute(ne.USER_INACTIVE);[this,this.media].includes(i.target)&&e?ei(this,oo,Su).call(this):ei(this,Kn,lo).call(this)}else i.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(e?.localName))&&ei(this,Kn,lo).call(this)};oo=new WeakSet;Su=function(){if(Kt(this,bn)<0||this.hasAttribute(ne.USER_INACTIVE))return;this.setAttribute(ne.USER_INACTIVE,"");const i=new k.CustomEvent(ms.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(i)};Iu=new WeakSet;ym=function(){if(!this.hasAttribute(ne.USER_INACTIVE))return;this.removeAttribute(ne.USER_INACTIVE);const i=new k.CustomEvent(ms.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(i)};Kn=new WeakSet;lo=function(){ei(this,Iu,ym).call(this),clearTimeout(Kt(this,ao));const i=parseInt(this.autohide);i<0||sr(this,ao,setTimeout(()=>{ei(this,oo,Su).call(this)},i*1e3))};Lu.shadowRootOptions={mode:"open"};Lu.getTemplateHTML=uC;k.customElements.get("media-container")||k.customElements.define("media-container",Lu);var vb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},pt=(i,e,t)=>(vb(i,e,"read from private field"),t?t.call(i):e.get(i)),ta=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Wo=(i,e,t,s)=>(vb(i,e,"write to private field"),e.set(i,t),t),Zr,Jr,Kd,pr,rs,Is;class bm{constructor(e,t,{defaultValue:s}={defaultValue:void 0}){ta(this,rs),ta(this,Zr,void 0),ta(this,Jr,void 0),ta(this,Kd,void 0),ta(this,pr,new Set),Wo(this,Zr,e),Wo(this,Jr,t),Wo(this,Kd,new Set(s))}[Symbol.iterator](){return pt(this,rs,Is).values()}get length(){return pt(this,rs,Is).size}get value(){var e;return(e=[...pt(this,rs,Is)].join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(Wo(this,pr,new Set),this.add(...(t=e?.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return[...pt(this,rs,Is)][e]}values(){return pt(this,rs,Is).values()}forEach(e,t){pt(this,rs,Is).forEach(e,t)}add(...e){var t,s;e.forEach(r=>pt(this,pr).add(r)),!(this.value===""&&!((t=pt(this,Zr))!=null&&t.hasAttribute(`${pt(this,Jr)}`)))&&((s=pt(this,Zr))==null||s.setAttribute(`${pt(this,Jr)}`,`${this.value}`))}remove(...e){var t;e.forEach(s=>pt(this,pr).delete(s)),(t=pt(this,Zr))==null||t.setAttribute(`${pt(this,Jr)}`,`${this.value}`)}contains(e){return pt(this,rs,Is).has(e)}toggle(e,t){return typeof t<"u"?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){return this.remove(e),this.add(t),e===t}}Zr=new WeakMap;Jr=new WeakMap;Kd=new WeakMap;pr=new WeakMap;rs=new WeakSet;Is=function(){return pt(this,pr).size?pt(this,pr):pt(this,Kd)};const gC=(i="")=>i.split(/\s+/),Eb=(i="")=>{const[e,t,s]=i.split(":"),r=s?decodeURIComponent(s):void 0;return{kind:e==="cc"?zi.CAPTIONS:zi.SUBTITLES,language:t,label:r}},Ru=(i="",e={})=>gC(i).map(t=>{const s=Eb(t);return{...e,...s}}),yb=i=>i?Array.isArray(i)?i.map(e=>typeof e=="string"?Eb(e):e):typeof i=="string"?Ru(i):[i]:[],Rh=({kind:i,label:e,language:t}={kind:"subtitles"})=>e?`${i==="captions"?"cc":"sb"}:${t}:${encodeURIComponent(e)}`:t,uo=(i=[])=>Array.prototype.map.call(i,Rh).join(" "),vC=(i,e)=>t=>t[i]===e,bb=i=>{const e=Object.entries(i).map(([t,s])=>vC(t,s));return t=>e.every(s=>s(t))},Ga=(i,e=[],t=[])=>{const s=yb(t).map(bb),r=n=>s.some(a=>a(n));Array.from(e).filter(r).forEach(n=>{n.mode=i})},xu=(i,e=()=>!0)=>{if(!i?.textTracks)return[];const t=typeof e=="function"?e:bb(e);return Array.from(i.textTracks).filter(t)},Tb=i=>{var e;return!!((e=i.mediaSubtitlesShowing)!=null&&e.length)||i.hasAttribute(_.MEDIA_SUBTITLES_SHOWING)},EC=i=>{var e;const{media:t,fullscreenElement:s}=i;try{const r=s&&"requestFullscreen"in s?"requestFullscreen":s&&"webkitRequestFullScreen"in s?"webkitRequestFullScreen":void 0;if(r){const n=(e=s[r])==null?void 0:e.call(s);if(n instanceof Promise)return n.catch(()=>{})}else t?.webkitEnterFullscreen?t.webkitEnterFullscreen():t?.requestFullscreen&&t.requestFullscreen()}catch(r){console.error(r)}},f0="exitFullscreen"in tt?"exitFullscreen":"webkitExitFullscreen"in tt?"webkitExitFullscreen":"webkitCancelFullScreen"in tt?"webkitCancelFullScreen":void 0,yC=i=>{var e;const{documentElement:t}=i;if(f0){const s=(e=t?.[f0])==null?void 0:e.call(t);if(s instanceof Promise)return s.catch(()=>{})}},ba="fullscreenElement"in tt?"fullscreenElement":"webkitFullscreenElement"in tt?"webkitFullscreenElement":void 0,bC=i=>{const{documentElement:e,media:t}=i,s=e?.[ba];return!s&&"webkitDisplayingFullscreen"in t&&"webkitPresentationMode"in t&&t.webkitDisplayingFullscreen&&t.webkitPresentationMode===KD.FULLSCREEN?t:s},TC=i=>{var e;const{media:t,documentElement:s,fullscreenElement:r=t}=i;if(!t||!s)return!1;const n=bC(i);if(!n)return!1;if(n===r||n===t)return!0;if(n.localName.includes("-")){let a=n.shadowRoot;if(!(ba in a))return gs(n,r);for(;a?.[ba];){if(a[ba]===r)return!0;a=(e=a[ba])==null?void 0:e.shadowRoot}}return!1},_C="fullscreenEnabled"in tt?"fullscreenEnabled":"webkitFullscreenEnabled"in tt?"webkitFullscreenEnabled":void 0,AC=i=>{const{documentElement:e,media:t}=i;return!!e?.[_C]||t&&"webkitSupportsFullscreen"in t};let qo;const Tm=()=>{var i,e;return qo||(qo=(e=(i=tt)==null?void 0:i.createElement)==null?void 0:e.call(i,"video"),qo)},SC=async(i=Tm())=>{if(!i)return!1;const e=i.volume;i.volume=e/2+.1;const t=new AbortController,s=await Promise.race([IC(i,t.signal),LC(i,e)]);return t.abort(),s},IC=(i,e)=>new Promise(t=>{i.addEventListener("volumechange",()=>t(!0),{signal:e})}),LC=async(i,e)=>{for(let t=0;t<10;t++){if(i.volume===e)return!1;await ib(10)}return i.volume!==e},RC=/.*Version\/.*Safari\/.*/.test(k.navigator.userAgent),_b=(i=Tm())=>k.matchMedia("(display-mode: standalone)").matches&&RC?!1:typeof i?.requestPictureInPicture=="function",Ab=(i=Tm())=>AC({documentElement:tt,media:i}),xC=Ab(),kC=_b(),DC=!!k.WebKitPlaybackTargetAvailabilityEvent,CC=!!k.chrome,Vd=i=>xu(i.media,e=>[zi.SUBTITLES,zi.CAPTIONS].includes(e.kind)).sort((e,t)=>e.kind>=t.kind?1:-1),Sb=i=>xu(i.media,e=>e.mode===Dn.SHOWING&&[zi.SUBTITLES,zi.CAPTIONS].includes(e.kind)),Ib=(i,e)=>{const t=Vd(i),s=Sb(i),r=!!s.length;if(t.length){if(e===!1||r&&e!==!0)Ga(Dn.DISABLED,t,s);else if(e===!0||!r&&e!==!1){let n=t[0];const{options:a}=i;if(!a?.noSubtitlesLangPref){const u=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),c=u?[u,...globalThis.navigator.languages]:globalThis.navigator.languages,h=t.filter(f=>c.some(m=>f.language.toLowerCase().startsWith(m.split("-")[0]))).sort((f,m)=>{const p=c.findIndex(v=>f.language.toLowerCase().startsWith(v.split("-")[0])),g=c.findIndex(v=>m.language.toLowerCase().startsWith(v.split("-")[0]));return p-g});h[0]&&(n=h[0])}const{language:o,label:l,kind:d}=n;Ga(Dn.DISABLED,t,s),Ga(Dn.SHOWING,t,[{language:o,label:l,kind:d}])}}},_m=(i,e)=>i===e?!0:i==null||e==null||typeof i!=typeof e?!1:typeof i=="number"&&Number.isNaN(i)&&Number.isNaN(e)?!0:typeof i!="object"?!1:Array.isArray(i)?wC(i,e):Object.entries(i).every(([t,s])=>t in e&&_m(s,e[t])),wC=(i,e)=>{const t=Array.isArray(i),s=Array.isArray(e);return t!==s?!1:t||s?i.length!==e.length?!1:i.every((r,n)=>_m(r,e[n])):!0},MC=Object.values(ls);let Wd;const PC=SC().then(i=>(Wd=i,Wd)),OC=async(...i)=>{await Promise.all(i.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof k.HTMLElement))return;const t=e.localName;if(!t.includes("-"))return;const s=k.customElements.get(t);s&&e instanceof s||(await k.customElements.whenDefined(t),k.customElements.upgrade(e))}))},NC=new k.DOMParser,UC=i=>i&&(NC.parseFromString(i,"text/html").body.textContent||i),Ta={mediaError:{get(i,e){const{media:t}=i;if(e?.type!=="playing")return t?.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(i,e){var t;const{media:s}=i;if(e?.type!=="playing")return(t=s?.error)==null?void 0:t.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(i,e){var t,s;const{media:r}=i;if(e?.type!=="playing")return(s=(t=r?.error)==null?void 0:t.message)!=null?s:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(i){var e;const{media:t}=i;return(e=t?.videoWidth)!=null?e:0},mediaEvents:["resize"]},mediaHeight:{get(i){var e;const{media:t}=i;return(e=t?.videoHeight)!=null?e:0},mediaEvents:["resize"]},mediaPaused:{get(i){var e;const{media:t}=i;return(e=t?.paused)!=null?e:!0},set(i,e){var t;const{media:s}=e;s&&(i?s.pause():(t=s.play())==null||t.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(i,e){const{media:t}=i;return t?e?e.type==="playing":!t.paused:!1},mediaEvents:["playing","emptied"]},mediaEnded:{get(i){var e;const{media:t}=i;return(e=t?.ended)!=null?e:!1},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(i){var e;const{media:t}=i;return(e=t?.playbackRate)!=null?e:1},set(i,e){const{media:t}=e;t&&Number.isFinite(+i)&&(t.playbackRate=+i)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(i){var e;const{media:t}=i;return(e=t?.muted)!=null?e:!1},set(i,e){const{media:t,options:{noMutedPref:s}={}}=e;if(t){t.muted=i;try{const r=k.localStorage.getItem("media-chrome-pref-muted")!==null,n=t.hasAttribute("muted");if(s){r&&k.localStorage.removeItem("media-chrome-pref-muted");return}if(n&&!r)return;k.localStorage.setItem("media-chrome-pref-muted",i?"true":"false")}catch(r){console.debug("Error setting muted pref",r)}}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,e)=>{const{options:{noMutedPref:t}}=e,{media:s}=e;if(!(!s||s.muted||t))try{const r=k.localStorage.getItem("media-chrome-pref-muted")==="true";Ta.mediaMuted.set(r,e),i(r)}catch(r){console.debug("Error getting muted pref",r)}}]},mediaLoop:{get(i){const{media:e}=i;return e?.loop},set(i,e){const{media:t}=e;t&&(t.loop=i)},mediaEvents:["medialooprequest"]},mediaVolume:{get(i){var e;const{media:t}=i;return(e=t?.volume)!=null?e:1},set(i,e){const{media:t,options:{noVolumePref:s}={}}=e;if(t){try{i==null?k.localStorage.removeItem("media-chrome-pref-volume"):!t.hasAttribute("muted")&&!s&&k.localStorage.setItem("media-chrome-pref-volume",i.toString())}catch(r){console.debug("Error setting volume pref",r)}Number.isFinite(+i)&&(t.volume=+i)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,e)=>{const{options:{noVolumePref:t}}=e;if(!t)try{const{media:s}=e;if(!s)return;const r=k.localStorage.getItem("media-chrome-pref-volume");if(r==null)return;Ta.mediaVolume.set(+r,e),i(+r)}catch(s){console.debug("Error getting volume pref",s)}}]},mediaVolumeLevel:{get(i){const{media:e}=i;return typeof e?.volume>"u"?"high":e.muted||e.volume===0?"off":e.volume<.5?"low":e.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(i){var e;const{media:t}=i;return(e=t?.currentTime)!=null?e:0},set(i,e){const{media:t}=e;!t||!mm(i)||(t.currentTime=i)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(i){const{media:e,options:{defaultDuration:t}={}}=i;return t&&(!e||!e.duration||Number.isNaN(e.duration)||!Number.isFinite(e.duration))?t:Number.isFinite(e?.duration)?e.duration:Number.NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(i){const{media:e}=i;return e?.readyState<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(i){var e;const{media:t}=i;if(!((e=t?.seekable)!=null&&e.length))return;const s=t.seekable.start(0),r=t.seekable.end(t.seekable.length-1);if(!(!s&&!r))return[Number(s.toFixed(3)),Number(r.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(i){var e;const{media:t}=i,s=(e=t?.buffered)!=null?e:[];return Array.from(s).map((r,n)=>[Number(s.start(n).toFixed(3)),Number(s.end(n).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(i){const{media:e,options:{defaultStreamType:t}={}}=i,s=[ls.LIVE,ls.ON_DEMAND].includes(t)?t:void 0;if(!e)return s;const{streamType:r}=e;if(MC.includes(r))return r===ls.UNKNOWN?s:r;const n=e.duration;return n===1/0?ls.LIVE:Number.isFinite(n)?ls.ON_DEMAND:s},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(i){const{media:e}=i;if(!e)return Number.NaN;const{targetLiveWindow:t}=e,s=Ta.mediaStreamType.get(i);return(t==null||Number.isNaN(t))&&s===ls.LIVE?0:t},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(i){const{media:e,options:{liveEdgeOffset:t=10}={}}=i;if(!e)return!1;if(typeof e.liveEdgeStart=="number")return Number.isNaN(e.liveEdgeStart)?!1:e.currentTime>=e.liveEdgeStart;if(!(Ta.mediaStreamType.get(i)===ls.LIVE))return!1;const r=e.seekable;if(!r)return!0;if(!r.length)return!1;const n=r.end(r.length-1)-t;return e.currentTime>=n},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get(i){return Vd(i).map(({kind:e,label:t,language:s})=>({kind:e,label:t,language:s}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get(i){return Sb(i).map(({kind:e,label:t,language:s})=>({kind:e,label:t,language:s}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(i,e)=>{var t,s;const{media:r,options:n}=e;if(!r)return;const a=o=>{var l;!n.defaultSubtitles||o&&![zi.CAPTIONS,zi.SUBTITLES].includes((l=o?.track)==null?void 0:l.kind)||Ib(e,!0)};return r.addEventListener("loadstart",a),(t=r.textTracks)==null||t.addEventListener("addtrack",a),(s=r.textTracks)==null||s.addEventListener("removetrack",a),()=>{var o,l;r.removeEventListener("loadstart",a),(o=r.textTracks)==null||o.removeEventListener("addtrack",a),(l=r.textTracks)==null||l.removeEventListener("removetrack",a)}}]},mediaChaptersCues:{get(i){var e;const{media:t}=i;if(!t)return[];const[s]=xu(t,{kind:zi.CHAPTERS});return Array.from((e=s?.cues)!=null?e:[]).map(({text:r,startTime:n,endTime:a})=>({text:UC(r),startTime:n,endTime:a}))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;if(!s)return;const r=s.querySelector('track[kind="chapters"][default][src]'),n=(t=s.shadowRoot)==null?void 0:t.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return r?.addEventListener("load",i),n?.addEventListener("load",i),()=>{r?.removeEventListener("load",i),n?.removeEventListener("load",i)}}]},mediaIsPip:{get(i){var e,t;const{media:s,documentElement:r}=i;if(!s||!r||!r.pictureInPictureElement)return!1;if(r.pictureInPictureElement===s)return!0;if(r.pictureInPictureElement instanceof HTMLMediaElement)return(e=s.localName)!=null&&e.includes("-")?gs(s,r.pictureInPictureElement):!1;if(r.pictureInPictureElement.localName.includes("-")){let n=r.pictureInPictureElement.shadowRoot;for(;n?.pictureInPictureElement;){if(n.pictureInPictureElement===s)return!0;n=(t=n.pictureInPictureElement)==null?void 0:t.shadowRoot}}return!1},set(i,e){const{media:t}=e;if(t)if(i){if(!tt.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!t.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}const s=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};t.requestPictureInPicture().catch(r=>{if(r.code===11){if(!t.src){console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.");return}if(t.readyState===0&&t.preload==="none"){const n=()=>{t.removeEventListener("loadedmetadata",a),t.preload="none"},a=()=>{t.requestPictureInPicture().catch(s),n()};t.addEventListener("loadedmetadata",a),t.preload="metadata",setTimeout(()=>{t.readyState===0&&s(),n()},1e3)}else throw r}else throw r})}else tt.pictureInPictureElement&&tt.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(i){var e;const{media:t}=i;return[...(e=t?.videoRenditions)!=null?e:[]].map(s=>({...s}))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(i){var e,t,s;const{media:r}=i;return(s=(t=r?.videoRenditions)==null?void 0:t[(e=r.videoRenditions)==null?void 0:e.selectedIndex])==null?void 0:s.id},set(i,e){const{media:t}=e;if(!t?.videoRenditions){console.warn("MediaController: Rendition selection not supported by this media.");return}const s=i,r=Array.prototype.findIndex.call(t.videoRenditions,n=>n.id==s);t.videoRenditions.selectedIndex!=r&&(t.videoRenditions.selectedIndex=r)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(i){var e;const{media:t}=i;return[...(e=t?.audioTracks)!=null?e:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(i){var e,t;const{media:s}=i;return(t=[...(e=s?.audioTracks)!=null?e:[]].find(r=>r.enabled))==null?void 0:t.id},set(i,e){const{media:t}=e;if(!t?.audioTracks){console.warn("MediaChrome: Audio track selection not supported by this media.");return}const s=i;for(const r of t.audioTracks)r.enabled=s==r.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get(i){return TC(i)},set(i,e,t){var s;i?(EC(e),t.detail&&((s=e.media)==null||s.focus())):yC(e)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(i){var e;const{media:t}=i;return!t?.remote||((e=t.remote)==null?void 0:e.state)==="disconnected"?!1:!!t.remote.state},set(i,e){var t,s;const{media:r}=e;if(r&&!(i&&((t=r.remote)==null?void 0:t.state)!=="disconnected")&&!(!i&&((s=r.remote)==null?void 0:s.state)!=="connected")){if(typeof r.remote.prompt!="function"){console.warn("MediaChrome: Casting is not supported in this environment");return}r.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get(){return!1},set(i,e){const{media:t}=e;if(t){if(!(t.webkitShowPlaybackTargetPicker&&k.WebKitPlaybackTargetAvailabilityEvent)){console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");return}t.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(i){const{media:e}=i;if(!xC||!Ab(e))return Nt.UNSUPPORTED}},mediaPipUnavailable:{get(i){const{media:e}=i;if(!kC||!_b(e))return Nt.UNSUPPORTED;if(e?.disablePictureInPicture)return Nt.UNAVAILABLE}},mediaVolumeUnavailable:{get(i){const{media:e}=i;if(Wd===!1||e?.volume==null)return Nt.UNSUPPORTED},stateOwnersUpdateHandlers:[i=>{Wd==null&&PC.then(e=>i(e?void 0:Nt.UNSUPPORTED))}]},mediaCastUnavailable:{get(i,{availability:e="not-available"}={}){var t;const{media:s}=i;if(!CC||!((t=s?.remote)!=null&&t.state))return Nt.UNSUPPORTED;if(!(e==null||e==="available"))return Nt.UNAVAILABLE},stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;return s?(s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s?.remote)==null||t.watchAvailability(n=>{i({availability:n?"available":"not-available"})}).catch(n=>{n.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var n;(n=s?.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaAirplayUnavailable:{get(i,e){if(!DC)return Nt.UNSUPPORTED;if(e?.availability==="not-available")return Nt.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:s}=e;return s?(s.disableRemotePlayback||s.hasAttribute("disableremoteplayback")||(t=s?.remote)==null||t.watchAvailability(n=>{i({availability:n?"available":"not-available"})}).catch(n=>{n.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var n;(n=s?.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaRenditionUnavailable:{get(i){var e;const{media:t}=i;if(!t?.videoRenditions)return Nt.UNSUPPORTED;if(!((e=t.videoRenditions)!=null&&e.length))return Nt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(i){var e,t;const{media:s}=i;if(!s?.audioTracks)return Nt.UNSUPPORTED;if(((t=(e=s.audioTracks)==null?void 0:e.length)!=null?t:0)<=1)return Nt.UNAVAILABLE},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaLang:{get(i){const{options:{mediaLang:e}={}}=i;return e??"en"}}},$C={[Y.MEDIA_PREVIEW_REQUEST](i,e,{detail:t}){var s,r,n;const{media:a}=e,o=t??void 0;let l,d;if(a&&o!=null){const[f]=xu(a,{kind:zi.METADATA,label:"thumbnails"}),m=Array.prototype.find.call((s=f?.cues)!=null?s:[],(p,g,v)=>g===0?p.endTime>o:g===v.length-1?p.startTime<=o:p.startTime<=o&&p.endTime>o);if(m){const p=/'^(?:[a-z]+:)?\/\//i.test(m.text)||(r=a?.querySelector('track[label="thumbnails"]'))==null?void 0:r.src,g=new URL(m.text,p);d=new URLSearchParams(g.hash).get("#xywh").split(",").map(b=>+b),l=g.href}}const u=i.mediaDuration.get(e);let h=(n=i.mediaChaptersCues.get(e).find((f,m,p)=>m===p.length-1&&u===f.endTime?f.startTime<=o&&f.endTime>=o:f.startTime<=o&&f.endTime>o))==null?void 0:n.text;return t!=null&&h==null&&(h=""),{mediaPreviewTime:o,mediaPreviewImage:l,mediaPreviewCoords:d,mediaPreviewChapter:h}},[Y.MEDIA_PAUSE_REQUEST](i,e){i["mediaPaused"].set(!0,e)},[Y.MEDIA_PLAY_REQUEST](i,e){var t,s,r,n;const a="mediaPaused",l=i.mediaStreamType.get(e)===ls.LIVE,d=!((t=e.options)!=null&&t.noAutoSeekToLive),u=i.mediaTargetLiveWindow.get(e)>0;if(l&&d&&!u){const c=(s=i.mediaSeekable.get(e))==null?void 0:s[1];if(c){const h=(n=(r=e.options)==null?void 0:r.seekToLiveOffset)!=null?n:0,f=c-h;i.mediaCurrentTime.set(f,e)}}i[a].set(!1,e)},[Y.MEDIA_PLAYBACK_RATE_REQUEST](i,e,{detail:t}){const s="mediaPlaybackRate",r=t;i[s].set(r,e)},[Y.MEDIA_MUTE_REQUEST](i,e){i["mediaMuted"].set(!0,e)},[Y.MEDIA_UNMUTE_REQUEST](i,e){const t="mediaMuted";i.mediaVolume.get(e)||i.mediaVolume.set(.25,e),i[t].set(!1,e)},[Y.MEDIA_LOOP_REQUEST](i,e,{detail:t}){const s="mediaLoop",r=!!t;return i[s].set(r,e),{mediaLoop:r}},[Y.MEDIA_VOLUME_REQUEST](i,e,{detail:t}){const s="mediaVolume",r=t;r&&i.mediaMuted.get(e)&&i.mediaMuted.set(!1,e),i[s].set(r,e)},[Y.MEDIA_SEEK_REQUEST](i,e,{detail:t}){const s="mediaCurrentTime",r=t;i[s].set(r,e)},[Y.MEDIA_SEEK_TO_LIVE_REQUEST](i,e){var t,s,r;const n="mediaCurrentTime",a=(t=i.mediaSeekable.get(e))==null?void 0:t[1];if(Number.isNaN(Number(a)))return;const o=(r=(s=e.options)==null?void 0:s.seekToLiveOffset)!=null?r:0,l=a-o;i[n].set(l,e)},[Y.MEDIA_SHOW_SUBTITLES_REQUEST](i,e,{detail:t}){var s;const{options:r}=e,n=Vd(e),a=yb(t),o=(s=a[0])==null?void 0:s.language;o&&!r.noSubtitlesLangPref&&k.localStorage.setItem("media-chrome-pref-subtitles-lang",o),Ga(Dn.SHOWING,n,a)},[Y.MEDIA_DISABLE_SUBTITLES_REQUEST](i,e,{detail:t}){const s=Vd(e),r=t??[];Ga(Dn.DISABLED,s,r)},[Y.MEDIA_TOGGLE_SUBTITLES_REQUEST](i,e,{detail:t}){Ib(e,t)},[Y.MEDIA_RENDITION_REQUEST](i,e,{detail:t}){const s="mediaRenditionSelected",r=t;i[s].set(r,e)},[Y.MEDIA_AUDIO_TRACK_REQUEST](i,e,{detail:t}){const s="mediaAudioTrackEnabled",r=t;i[s].set(r,e)},[Y.MEDIA_ENTER_PIP_REQUEST](i,e){const t="mediaIsPip";i.mediaIsFullscreen.get(e)&&i.mediaIsFullscreen.set(!1,e),i[t].set(!0,e)},[Y.MEDIA_EXIT_PIP_REQUEST](i,e){i["mediaIsPip"].set(!1,e)},[Y.MEDIA_ENTER_FULLSCREEN_REQUEST](i,e,t){const s="mediaIsFullscreen";i.mediaIsPip.get(e)&&i.mediaIsPip.set(!1,e),i[s].set(!0,e,t)},[Y.MEDIA_EXIT_FULLSCREEN_REQUEST](i,e){i["mediaIsFullscreen"].set(!1,e)},[Y.MEDIA_ENTER_CAST_REQUEST](i,e){const t="mediaIsCasting";i.mediaIsFullscreen.get(e)&&i.mediaIsFullscreen.set(!1,e),i[t].set(!0,e)},[Y.MEDIA_EXIT_CAST_REQUEST](i,e){i["mediaIsCasting"].set(!1,e)},[Y.MEDIA_AIRPLAY_REQUEST](i,e){i["mediaIsAirplaying"].set(!0,e)}},FC=({media:i,fullscreenElement:e,documentElement:t,stateMediator:s=Ta,requestMap:r=$C,options:n={},monitorStateOwnersOnlyWithSubscriptions:a=!0})=>{const o=[],l={options:{...n}};let d=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0});const u=p=>{p!=null&&(_m(p,d)||(d=Object.freeze({...d,...p}),o.forEach(g=>g(d))))},c=()=>{const p=Object.entries(s).reduce((g,[v,{get:b}])=>(g[v]=b(l),g),{});u(p)},h={};let f;const m=async(p,g)=>{var v,b,y,T,A,L,S,R,x,I,M,F,V,j,H,N;const q=!!f;if(f={...l,...f??{},...p},q)return;await OC(...Object.values(p));const B=o.length>0&&g===0&&a,z=l.media!==f.media,ee=((v=l.media)==null?void 0:v.textTracks)!==((b=f.media)==null?void 0:b.textTracks),U=((y=l.media)==null?void 0:y.videoRenditions)!==((T=f.media)==null?void 0:T.videoRenditions),$=((A=l.media)==null?void 0:A.audioTracks)!==((L=f.media)==null?void 0:L.audioTracks),re=((S=l.media)==null?void 0:S.remote)!==((R=f.media)==null?void 0:R.remote),pe=l.documentElement!==f.documentElement,ue=!!l.media&&(z||B),fe=!!((x=l.media)!=null&&x.textTracks)&&(ee||B),st=!!((I=l.media)!=null&&I.videoRenditions)&&(U||B),Qe=!!((M=l.media)!=null&&M.audioTracks)&&($||B),It=!!((F=l.media)!=null&&F.remote)&&(re||B),Pt=!!l.documentElement&&(pe||B),ni=ue||fe||st||Qe||It||Pt,vs=o.length===0&&g===1&&a,wr=!!f.media&&(z||vs),Mr=!!((V=f.media)!=null&&V.textTracks)&&(ee||vs),$u=!!((j=f.media)!=null&&j.videoRenditions)&&(U||vs),ye=!!((H=f.media)!=null&&H.audioTracks)&&($||vs),rt=!!((N=f.media)!=null&&N.remote)&&(re||vs),Lt=!!f.documentElement&&(pe||vs),Ti=wr||Mr||$u||ye||rt||Lt;if(!(ni||Ti)){Object.entries(f).forEach(([be,Ot])=>{l[be]=Ot}),c(),f=void 0;return}Object.entries(s).forEach(([be,{get:Ot,mediaEvents:To=[],textTracksEvents:Pr=[],videoRenditionsEvents:_o=[],audioTracksEvents:js=[],remoteEvents:Ao=[],rootEvents:Fu=[],stateOwnersUpdateHandlers:So=[]}])=>{h[be]||(h[be]={});const _t=He=>{const Xe=Ot(l,He);u({[be]:Xe})};let Be;Be=h[be].mediaEvents,To.forEach(He=>{Be&&ue&&(l.media.removeEventListener(He,Be),h[be].mediaEvents=void 0),wr&&(f.media.addEventListener(He,_t),h[be].mediaEvents=_t)}),Be=h[be].textTracksEvents,Pr.forEach(He=>{var Xe,ai;Be&&fe&&((Xe=l.media.textTracks)==null||Xe.removeEventListener(He,Be),h[be].textTracksEvents=void 0),Mr&&((ai=f.media.textTracks)==null||ai.addEventListener(He,_t),h[be].textTracksEvents=_t)}),Be=h[be].videoRenditionsEvents,_o.forEach(He=>{var Xe,ai;Be&&st&&((Xe=l.media.videoRenditions)==null||Xe.removeEventListener(He,Be),h[be].videoRenditionsEvents=void 0),$u&&((ai=f.media.videoRenditions)==null||ai.addEventListener(He,_t),h[be].videoRenditionsEvents=_t)}),Be=h[be].audioTracksEvents,js.forEach(He=>{var Xe,ai;Be&&Qe&&((Xe=l.media.audioTracks)==null||Xe.removeEventListener(He,Be),h[be].audioTracksEvents=void 0),ye&&((ai=f.media.audioTracks)==null||ai.addEventListener(He,_t),h[be].audioTracksEvents=_t)}),Be=h[be].remoteEvents,Ao.forEach(He=>{var Xe,ai;Be&&It&&((Xe=l.media.remote)==null||Xe.removeEventListener(He,Be),h[be].remoteEvents=void 0),rt&&((ai=f.media.remote)==null||ai.addEventListener(He,_t),h[be].remoteEvents=_t)}),Be=h[be].rootEvents,Fu.forEach(He=>{Be&&Pt&&(l.documentElement.removeEventListener(He,Be),h[be].rootEvents=void 0),Lt&&(f.documentElement.addEventListener(He,_t),h[be].rootEvents=_t)});const Io=h[be].stateOwnersUpdateHandlers;if(Io&&ni&&(Array.isArray(Io)?Io:[Io]).forEach(Xe=>{typeof Xe=="function"&&Xe()}),Ti){const He=So.map(Xe=>Xe(_t,f)).filter(Xe=>typeof Xe=="function");h[be].stateOwnersUpdateHandlers=He.length===1?He[0]:He}else ni&&(h[be].stateOwnersUpdateHandlers=void 0)}),Object.entries(f).forEach(([be,Ot])=>{l[be]=Ot}),c(),f=void 0};return m({media:i,fullscreenElement:e,documentElement:t,options:n}),{dispatch(p){const{type:g,detail:v}=p;if(r[g]&&d.mediaErrorCode==null){u(r[g](s,l,p));return}g==="mediaelementchangerequest"?m({media:v}):g==="fullscreenelementchangerequest"?m({fullscreenElement:v}):g==="documentelementchangerequest"?m({documentElement:v}):g==="optionschangerequest"&&(Object.entries(v??{}).forEach(([b,y])=>{l.options[b]=y}),c())},getState(){return d},subscribe(p){return m({},o.length+1),o.push(p),p(d),()=>{const g=o.indexOf(p);g>=0&&(m({},o.length-1),o.splice(g,1))}}}};var Am=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ae=(i,e,t)=>(Am(i,e,"read from private field"),t?t.call(i):e.get(i)),zt=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},xi=(i,e,t,s)=>(Am(i,e,"write to private field"),e.set(i,t),t),Hi=(i,e,t)=>(Am(i,e,"access private method"),t),Us,_a,Te,gr,Aa,ki,kl,Sa,Dl,xh,_r,Cn,Cl,kh,Dh,Lb;const Rb=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"," ","f","m","k","c","l","j",">","<","p"],m0=10,p0=.025,g0=.25,BC=.25,HC=2,G={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",DEFAULT_DURATION:"defaultduration",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYBOARD_BACKWARD_SEEK_OFFSET:"keyboardbackwardseekoffset",KEYBOARD_FORWARD_SEEK_OFFSET:"keyboardforwardseekoffset",KEYBOARD_DOWN_VOLUME_STEP:"keyboarddownvolumestep",KEYBOARD_UP_VOLUME_STEP:"keyboardupvolumestep",KEYS_USED:"keysused",LANG:"lang",LOOP:"loop",LIVE_EDGE_OFFSET:"liveedgeoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_DEFAULT_STORE:"nodefaultstore",NO_HOTKEYS:"nohotkeys",NO_MUTED_PREF:"nomutedpref",NO_SUBTITLES_LANG_PREF:"nosubtitleslangpref",NO_VOLUME_PREF:"novolumepref",SEEK_TO_LIVE_OFFSET:"seektoliveoffset"};class xb extends Lu{constructor(){super(),zt(this,Dl),zt(this,_r),zt(this,Cl),zt(this,Dh),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,zt(this,Us,new bm(this,G.HOTKEYS)),zt(this,_a,void 0),zt(this,Te,void 0),zt(this,gr,null),zt(this,Aa,void 0),zt(this,ki,void 0),zt(this,kl,t=>{var s;(s=ae(this,Te))==null||s.dispatch(t)}),zt(this,Sa,void 0),this.associateElement(this);let e={};xi(this,Aa,t=>{Object.entries(t).forEach(([s,r])=>{if(s in e&&e[s]===r)return;this.propagateMediaState(s,r);const n=s.toLowerCase(),a=new k.CustomEvent(GD[n],{composed:!0,detail:r});this.dispatchEvent(a)}),e=t}),this.hasAttribute(G.NO_HOTKEYS)?this.disableHotkeys():this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(G.NO_HOTKEYS,G.HOTKEYS,G.DEFAULT_STREAM_TYPE,G.DEFAULT_SUBTITLES,G.DEFAULT_DURATION,G.NO_MUTED_PREF,G.NO_VOLUME_PREF,G.LANG,G.LOOP)}get mediaStore(){return ae(this,Te)}set mediaStore(e){var t,s;if(ae(this,Te)&&((t=ae(this,ki))==null||t.call(this),xi(this,ki,void 0)),xi(this,Te,e),!ae(this,Te)&&!this.hasAttribute(G.NO_DEFAULT_STORE)){Hi(this,Dl,xh).call(this);return}xi(this,ki,(s=ae(this,Te))==null?void 0:s.subscribe(ae(this,Aa)))}get fullscreenElement(){var e;return(e=ae(this,_a))!=null?e:this}set fullscreenElement(e){var t;this.hasAttribute(G.FULLSCREEN_ELEMENT)&&this.removeAttribute(G.FULLSCREEN_ELEMENT),xi(this,_a,e),(t=ae(this,Te))==null||t.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return ve(this,G.DEFAULT_SUBTITLES)}set defaultSubtitles(e){Ee(this,G.DEFAULT_SUBTITLES,e)}get defaultStreamType(){return Ne(this,G.DEFAULT_STREAM_TYPE)}set defaultStreamType(e){Ue(this,G.DEFAULT_STREAM_TYPE,e)}get defaultDuration(){return Oe(this,G.DEFAULT_DURATION)}set defaultDuration(e){Ye(this,G.DEFAULT_DURATION,e)}get noHotkeys(){return ve(this,G.NO_HOTKEYS)}set noHotkeys(e){Ee(this,G.NO_HOTKEYS,e)}get keysUsed(){return Ne(this,G.KEYS_USED)}set keysUsed(e){Ue(this,G.KEYS_USED,e)}get liveEdgeOffset(){return Oe(this,G.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){Ye(this,G.LIVE_EDGE_OFFSET,e)}get noAutoSeekToLive(){return ve(this,G.NO_AUTO_SEEK_TO_LIVE)}set noAutoSeekToLive(e){Ee(this,G.NO_AUTO_SEEK_TO_LIVE,e)}get noVolumePref(){return ve(this,G.NO_VOLUME_PREF)}set noVolumePref(e){Ee(this,G.NO_VOLUME_PREF,e)}get noMutedPref(){return ve(this,G.NO_MUTED_PREF)}set noMutedPref(e){Ee(this,G.NO_MUTED_PREF,e)}get noSubtitlesLangPref(){return ve(this,G.NO_SUBTITLES_LANG_PREF)}set noSubtitlesLangPref(e){Ee(this,G.NO_SUBTITLES_LANG_PREF,e)}get noDefaultStore(){return ve(this,G.NO_DEFAULT_STORE)}set noDefaultStore(e){Ee(this,G.NO_DEFAULT_STORE,e)}attributeChangedCallback(e,t,s){var r,n,a,o,l,d,u,c,h,f,m,p;if(super.attributeChangedCallback(e,t,s),e===G.NO_HOTKEYS)s!==t&&s===""?(this.hasAttribute(G.HOTKEYS)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):s!==t&&s===null&&this.enableHotkeys();else if(e===G.HOTKEYS)ae(this,Us).value=s;else if(e===G.DEFAULT_SUBTITLES&&s!==t)(r=ae(this,Te))==null||r.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(G.DEFAULT_SUBTITLES)}});else if(e===G.DEFAULT_STREAM_TYPE)(a=ae(this,Te))==null||a.dispatch({type:"optionschangerequest",detail:{defaultStreamType:(n=this.getAttribute(G.DEFAULT_STREAM_TYPE))!=null?n:void 0}});else if(e===G.LIVE_EDGE_OFFSET)(o=ae(this,Te))==null||o.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?void 0:+this.getAttribute(G.LIVE_EDGE_OFFSET)}});else if(e===G.SEEK_TO_LIVE_OFFSET)(l=ae(this,Te))==null||l.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(G.SEEK_TO_LIVE_OFFSET):void 0}});else if(e===G.NO_AUTO_SEEK_TO_LIVE)(d=ae(this,Te))==null||d.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(G.NO_AUTO_SEEK_TO_LIVE)}});else if(e===G.FULLSCREEN_ELEMENT){const g=s?(u=this.getRootNode())==null?void 0:u.getElementById(s):void 0;xi(this,_a,g),(c=ae(this,Te))==null||c.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else e===G.LANG&&s!==t?(tC(s),(h=ae(this,Te))==null||h.dispatch({type:"optionschangerequest",detail:{mediaLang:s}})):e===G.LOOP&&s!==t?(f=ae(this,Te))==null||f.dispatch({type:Y.MEDIA_LOOP_REQUEST,detail:s!=null}):e===G.NO_VOLUME_PREF&&s!==t?(m=ae(this,Te))==null||m.dispatch({type:"optionschangerequest",detail:{noVolumePref:this.hasAttribute(G.NO_VOLUME_PREF)}}):e===G.NO_MUTED_PREF&&s!==t&&((p=ae(this,Te))==null||p.dispatch({type:"optionschangerequest",detail:{noMutedPref:this.hasAttribute(G.NO_MUTED_PREF)}}))}connectedCallback(){var e,t;!ae(this,Te)&&!this.hasAttribute(G.NO_DEFAULT_STORE)&&Hi(this,Dl,xh).call(this),(e=ae(this,Te))==null||e.dispatch({type:"documentelementchangerequest",detail:tt}),super.connectedCallback(),ae(this,Te)&&!ae(this,ki)&&xi(this,ki,(t=ae(this,Te))==null?void 0:t.subscribe(ae(this,Aa))),ae(this,Sa)!==void 0&&ae(this,Te)&&this.media&&setTimeout(()=>{var s,r,n;(r=(s=this.media)==null?void 0:s.textTracks)!=null&&r.length&&((n=ae(this,Te))==null||n.dispatch({type:Y.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:ae(this,Sa)}))},0),this.hasAttribute(G.NO_HOTKEYS)?this.disableHotkeys():this.enableHotkeys()}disconnectedCallback(){var e,t,s,r,n;if((e=super.disconnectedCallback)==null||e.call(this),ae(this,Te)){const a=ae(this,Te).getState();xi(this,Sa,!!((t=a.mediaSubtitlesShowing)!=null&&t.length)),(s=ae(this,Te))==null||s.dispatch({type:"documentelementchangerequest",detail:void 0}),(r=ae(this,Te))==null||r.dispatch({type:Y.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})}ae(this,ki)&&((n=ae(this,ki))==null||n.call(this),xi(this,ki,void 0))}mediaSetCallback(e){var t;super.mediaSetCallback(e),(t=ae(this,Te))==null||t.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var t;super.mediaUnsetCallback(e),(t=ae(this,Te))==null||t.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,t){y0(this.mediaStateReceivers,e,t)}associateElement(e){if(!e)return;const{associatedElementSubscriptions:t}=this;if(t.has(e))return;const s=this.registerMediaStateReceiver.bind(this),r=this.unregisterMediaStateReceiver.bind(this),n=YC(e,s,r);Object.values(Y).forEach(a=>{e.addEventListener(a,ae(this,kl))}),t.set(e,n)}unassociateElement(e){if(!e)return;const{associatedElementSubscriptions:t}=this;if(!t.has(e))return;t.get(e)(),t.delete(e),Object.values(Y).forEach(r=>{e.removeEventListener(r,ae(this,kl))})}registerMediaStateReceiver(e){if(!e)return;const t=this.mediaStateReceivers;t.indexOf(e)>-1||(t.push(e),ae(this,Te)&&Object.entries(ae(this,Te).getState()).forEach(([r,n])=>{y0([e],r,n)}))}unregisterMediaStateReceiver(e){const t=this.mediaStateReceivers,s=t.indexOf(e);s<0||t.splice(s,1)}enableHotkeys(){this.addEventListener("keydown",Hi(this,Cl,kh))}disableHotkeys(){this.removeEventListener("keydown",Hi(this,Cl,kh)),this.removeEventListener("keyup",Hi(this,_r,Cn))}get hotkeys(){return Ne(this,G.HOTKEYS)}set hotkeys(e){Ue(this,G.HOTKEYS,e)}keyboardShortcutHandler(e){var t,s,r,n,a,o,l,d,u;const c=e.target;if(((r=(s=(t=c.getAttribute(G.KEYS_USED))==null?void 0:t.split(" "))!=null?s:c?.keysUsed)!=null?r:[]).map(v=>v==="Space"?" ":v).filter(Boolean).includes(e.key))return;let f,m,p;if(!(ae(this,Us).contains(`no${e.key.toLowerCase()}`)||e.key===" "&&ae(this,Us).contains("nospace")||e.shiftKey&&(e.key==="/"||e.key==="?")&&ae(this,Us).contains("noshift+/")))switch(e.key){case" ":case"k":f=ae(this,Te).getState().mediaPaused?Y.MEDIA_PLAY_REQUEST:Y.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new k.CustomEvent(f,{composed:!0,bubbles:!0}));break;case"m":f=this.mediaStore.getState().mediaVolumeLevel==="off"?Y.MEDIA_UNMUTE_REQUEST:Y.MEDIA_MUTE_REQUEST,this.dispatchEvent(new k.CustomEvent(f,{composed:!0,bubbles:!0}));break;case"f":f=this.mediaStore.getState().mediaIsFullscreen?Y.MEDIA_EXIT_FULLSCREEN_REQUEST:Y.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new k.CustomEvent(f,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new k.CustomEvent(Y.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":case"j":{const v=this.hasAttribute(G.KEYBOARD_BACKWARD_SEEK_OFFSET)?+this.getAttribute(G.KEYBOARD_BACKWARD_SEEK_OFFSET):m0;m=Math.max(((n=this.mediaStore.getState().mediaCurrentTime)!=null?n:0)-v,0),p=new k.CustomEvent(Y.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"ArrowRight":case"l":{const v=this.hasAttribute(G.KEYBOARD_FORWARD_SEEK_OFFSET)?+this.getAttribute(G.KEYBOARD_FORWARD_SEEK_OFFSET):m0;m=Math.max(((a=this.mediaStore.getState().mediaCurrentTime)!=null?a:0)+v,0),p=new k.CustomEvent(Y.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"ArrowUp":{const v=this.hasAttribute(G.KEYBOARD_UP_VOLUME_STEP)?+this.getAttribute(G.KEYBOARD_UP_VOLUME_STEP):p0;m=Math.min(((o=this.mediaStore.getState().mediaVolume)!=null?o:1)+v,1),p=new k.CustomEvent(Y.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"ArrowDown":{const v=this.hasAttribute(G.KEYBOARD_DOWN_VOLUME_STEP)?+this.getAttribute(G.KEYBOARD_DOWN_VOLUME_STEP):p0;m=Math.max(((l=this.mediaStore.getState().mediaVolume)!=null?l:1)-v,0),p=new k.CustomEvent(Y.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"<":{const v=(d=this.mediaStore.getState().mediaPlaybackRate)!=null?d:1;m=Math.max(v-g0,BC).toFixed(2),p=new k.CustomEvent(Y.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case">":{const v=(u=this.mediaStore.getState().mediaPlaybackRate)!=null?u:1;m=Math.min(v+g0,HC).toFixed(2),p=new k.CustomEvent(Y.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:m}),this.dispatchEvent(p);break}case"/":case"?":{e.shiftKey&&Hi(this,Dh,Lb).call(this);break}case"p":{f=this.mediaStore.getState().mediaIsPip?Y.MEDIA_EXIT_PIP_REQUEST:Y.MEDIA_ENTER_PIP_REQUEST,p=new k.CustomEvent(f,{composed:!0,bubbles:!0}),this.dispatchEvent(p);break}}}}Us=new WeakMap;_a=new WeakMap;Te=new WeakMap;gr=new WeakMap;Aa=new WeakMap;ki=new WeakMap;kl=new WeakMap;Sa=new WeakMap;Dl=new WeakSet;xh=function(){var i;this.mediaStore=FC({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(G.DEFAULT_SUBTITLES),defaultDuration:this.hasAttribute(G.DEFAULT_DURATION)?+this.getAttribute(G.DEFAULT_DURATION):void 0,defaultStreamType:(i=this.getAttribute(G.DEFAULT_STREAM_TYPE))!=null?i:void 0,liveEdgeOffset:this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(G.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(G.SEEK_TO_LIVE_OFFSET):this.hasAttribute(G.LIVE_EDGE_OFFSET)?+this.getAttribute(G.LIVE_EDGE_OFFSET):void 0,noAutoSeekToLive:this.hasAttribute(G.NO_AUTO_SEEK_TO_LIVE),noVolumePref:this.hasAttribute(G.NO_VOLUME_PREF),noMutedPref:this.hasAttribute(G.NO_MUTED_PREF),noSubtitlesLangPref:this.hasAttribute(G.NO_SUBTITLES_LANG_PREF)}})};_r=new WeakSet;Cn=function(i){const{key:e,shiftKey:t}=i;if(!(t&&(e==="/"||e==="?")||Rb.includes(e))){this.removeEventListener("keyup",Hi(this,_r,Cn));return}this.keyboardShortcutHandler(i)};Cl=new WeakSet;kh=function(i){var e;const{metaKey:t,altKey:s,key:r,shiftKey:n}=i,a=n&&(r==="/"||r==="?");if(a&&((e=ae(this,gr))!=null&&e.open)){this.removeEventListener("keyup",Hi(this,_r,Cn));return}if(t||s||!a&&!Rb.includes(r)){this.removeEventListener("keyup",Hi(this,_r,Cn));return}const o=i.target,l=o instanceof HTMLElement&&(o.tagName.toLowerCase()==="media-volume-range"||o.tagName.toLowerCase()==="media-time-range");[" ","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(r)&&!(ae(this,Us).contains(`no${r.toLowerCase()}`)||r===" "&&ae(this,Us).contains("nospace"))&&!l&&i.preventDefault(),this.addEventListener("keyup",Hi(this,_r,Cn),{once:!0})};Dh=new WeakSet;Lb=function(){ae(this,gr)||(xi(this,gr,tt.createElement("media-keyboard-shortcuts-dialog")),this.appendChild(ae(this,gr))),ae(this,gr).open=!0};const GC=Object.values(_),KC=Object.values(Jy),kb=i=>{var e,t,s,r;let{observedAttributes:n}=i.constructor;!n&&((e=i.nodeName)!=null&&e.includes("-"))&&(k.customElements.upgrade(i),{observedAttributes:n}=i.constructor);const a=(r=(s=(t=i?.getAttribute)==null?void 0:t.call(i,Ae.MEDIA_CHROME_ATTRIBUTES))==null?void 0:s.split)==null?void 0:r.call(s,/\s+/);return Array.isArray(n||a)?(n||a).filter(o=>GC.includes(o)):[]},VC=i=>{var e,t;return(e=i.nodeName)!=null&&e.includes("-")&&k.customElements.get((t=i.nodeName)==null?void 0:t.toLowerCase())&&!(i instanceof k.customElements.get(i.nodeName.toLowerCase()))&&k.customElements.upgrade(i),KC.some(s=>s in i)},Ch=i=>VC(i)||!!kb(i).length,v0=i=>{var e;return(e=i?.join)==null?void 0:e.call(i,":")},E0={[_.MEDIA_SUBTITLES_LIST]:uo,[_.MEDIA_SUBTITLES_SHOWING]:uo,[_.MEDIA_SEEKABLE]:v0,[_.MEDIA_BUFFERED]:i=>i?.map(v0).join(" "),[_.MEDIA_PREVIEW_COORDS]:i=>i?.join(" "),[_.MEDIA_RENDITION_LIST]:VD,[_.MEDIA_AUDIO_TRACK_LIST]:jD},WC=async(i,e,t)=>{var s,r;if(i.isConnected||await ib(0),typeof t=="boolean"||t==null)return Ee(i,e,t);if(typeof t=="number")return Ye(i,e,t);if(typeof t=="string")return Ue(i,e,t);if(Array.isArray(t)&&!t.length)return i.removeAttribute(e);const n=(r=(s=E0[e])==null?void 0:s.call(E0,t))!=null?r:t;return i.setAttribute(e,n)},qC=i=>{var e;return!!((e=i.closest)!=null&&e.call(i,'*[slot="media"]'))},rr=(i,e)=>{if(qC(i))return;const t=(r,n)=>{var a,o;Ch(r)&&n(r);const{children:l=[]}=r??{},d=(o=(a=r?.shadowRoot)==null?void 0:a.children)!=null?o:[];[...l,...d].forEach(c=>rr(c,n))},s=i?.nodeName.toLowerCase();if(s.includes("-")&&!Ch(i)){k.customElements.whenDefined(s).then(()=>{t(i,e)});return}t(i,e)},y0=(i,e,t)=>{i.forEach(s=>{if(e in s){s[e]=t;return}const r=kb(s),n=e.toLowerCase();r.includes(n)&&WC(s,n,t)})},YC=(i,e,t)=>{rr(i,e);const s=u=>{var c;const h=(c=u?.composedPath()[0])!=null?c:u.target;e(h)},r=u=>{var c;const h=(c=u?.composedPath()[0])!=null?c:u.target;t(h)};i.addEventListener(Y.REGISTER_MEDIA_STATE_RECEIVER,s),i.addEventListener(Y.UNREGISTER_MEDIA_STATE_RECEIVER,r);const n=u=>{u.forEach(c=>{const{addedNodes:h=[],removedNodes:f=[],type:m,target:p,attributeName:g}=c;m==="childList"?(Array.prototype.forEach.call(h,v=>rr(v,e)),Array.prototype.forEach.call(f,v=>rr(v,t))):m==="attributes"&&g===Ae.MEDIA_CHROME_ATTRIBUTES&&(Ch(p)?e(p):t(p))})};let a=[];const o=u=>{const c=u.target;c.name!=="media"&&(a.forEach(h=>rr(h,t)),a=[...c.assignedElements({flatten:!0})],a.forEach(h=>rr(h,e)))};i.addEventListener("slotchange",o);const l=new MutationObserver(n);return l.observe(i,{childList:!0,attributes:!0,subtree:!0}),()=>{rr(i,t),i.removeEventListener("slotchange",o),l.disconnect(),i.removeEventListener(Y.REGISTER_MEDIA_STATE_RECEIVER,s),i.removeEventListener(Y.UNREGISTER_MEDIA_STATE_RECEIVER,r)}};k.customElements.get("media-controller")||k.customElements.define("media-controller",xb);var jC=xb;const Br={PLACEMENT:"placement",BOUNDS:"bounds"};function zC(i){return`
+
+
+
+ `}class ku extends k.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!cb(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;const t=this.placement;if(t==="left"||t==="right"){this.style.removeProperty("--media-tooltip-offset-x");return}const s=getComputedStyle(this),r=(e=Yn(this,"#"+this.bounds))!=null?e:wt(this);if(!r)return;const{x:n,width:a}=r.getBoundingClientRect(),{x:o,width:l}=this.getBoundingClientRect(),d=o+l,u=n+a,c=s.getPropertyValue("--media-tooltip-offset-x"),h=c?parseFloat(c.replace("px","")):0,f=s.getPropertyValue("--media-tooltip-container-margin"),m=f?parseFloat(f.replace("px","")):0,p=o-n+h-m,g=d-u+h+m;if(p<0){this.style.setProperty("--media-tooltip-offset-x",`${p}px`);return}if(g>0){this.style.setProperty("--media-tooltip-offset-x",`${g}px`);return}this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){const e=this.placement;delete this.placement,this.placement=e}}static get observedAttributes(){return[Br.PLACEMENT,Br.BOUNDS]}get placement(){return Ne(this,Br.PLACEMENT)}set placement(e){Ue(this,Br.PLACEMENT,e)}get bounds(){return Ne(this,Br.BOUNDS)}set bounds(e){Ue(this,Br.BOUNDS,e)}}ku.shadowRootOptions={mode:"open"};ku.getTemplateHTML=zC;k.customElements.get("media-tooltip")||k.customElements.define("media-tooltip",ku);var b0=ku,Sm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Je=(i,e,t)=>(Sm(i,e,"read from private field"),t?t.call(i):e.get(i)),Hr=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Yo=(i,e,t,s)=>(Sm(i,e,"write to private field"),e.set(i,t),t),QC=(i,e,t)=>(Sm(i,e,"access private method"),t),Di,Tn,$s,en,wl,wh,Db;const _s={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function XC(i,e={}){return`
+
+
+ ${this.getSlotTemplateHTML(i,e)}
+
+
+
+
+ ${b0.getTemplateHTML({})}
+
+
+ ${this.getTooltipContentHTML(i)}
+
+
+
+ `}function ZC(i,e){return`
+
+ `}function JC(){return""}class vt extends k.HTMLElement{constructor(){if(super(),Hr(this,wh),Hr(this,Di,void 0),this.preventClick=!1,this.tooltipEl=null,Hr(this,Tn,e=>{this.preventClick||this.handleClick(e),setTimeout(Je(this,$s),0)}),Hr(this,$s,()=>{var e,t;(t=(e=this.tooltipEl)==null?void 0:e.updateXOffset)==null||t.call(e)}),Hr(this,en,e=>{const{key:t}=e;if(!this.keysUsed.includes(t)){this.removeEventListener("keyup",Je(this,en));return}this.preventClick||this.handleClick(e)}),Hr(this,wl,e=>{const{metaKey:t,altKey:s,key:r}=e;if(t||s||!this.keysUsed.includes(r)){this.removeEventListener("keyup",Je(this,en));return}this.addEventListener("keyup",Je(this,en),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Yt(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.tooltipEl=this.shadowRoot.querySelector("media-tooltip")}static get observedAttributes(){return["disabled",_s.TOOLTIP_PLACEMENT,Ae.MEDIA_CONTROLLER,_.MEDIA_LANG]}enable(){this.addEventListener("click",Je(this,Tn)),this.addEventListener("keydown",Je(this,wl)),this.tabIndex=0}disable(){this.removeEventListener("click",Je(this,Tn)),this.removeEventListener("keydown",Je(this,wl)),this.removeEventListener("keyup",Je(this,en)),this.tabIndex=-1}attributeChangedCallback(e,t,s){var r,n,a,o,l;e===Ae.MEDIA_CONTROLLER?(t&&((n=(r=Je(this,Di))==null?void 0:r.unassociateElement)==null||n.call(r,this),Yo(this,Di,null)),s&&this.isConnected&&(Yo(this,Di,(a=this.getRootNode())==null?void 0:a.getElementById(s)),(l=(o=Je(this,Di))==null?void 0:o.associateElement)==null||l.call(o,this))):e==="disabled"&&s!==t?s==null?this.enable():this.disable():e===_s.TOOLTIP_PLACEMENT&&this.tooltipEl&&s!==t?this.tooltipEl.placement=s:e===_.MEDIA_LANG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),Je(this,$s).call(this)}connectedCallback(){var e,t,s;const{style:r}=ut(this.shadowRoot,":host");r.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")?this.disable():this.enable(),this.setAttribute("role","button");const n=this.getAttribute(Ae.MEDIA_CONTROLLER);n&&(Yo(this,Di,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(s=(t=Je(this,Di))==null?void 0:t.associateElement)==null||s.call(t,this)),k.customElements.whenDefined("media-tooltip").then(()=>QC(this,wh,Db).call(this))}disconnectedCallback(){var e,t;this.disable(),(t=(e=Je(this,Di))==null?void 0:e.unassociateElement)==null||t.call(e,this),Yo(this,Di,null),this.removeEventListener("mouseenter",Je(this,$s)),this.removeEventListener("focus",Je(this,$s)),this.removeEventListener("click",Je(this,Tn))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return Ne(this,_s.TOOLTIP_PLACEMENT)}set tooltipPlacement(e){Ue(this,_s.TOOLTIP_PLACEMENT,e)}get mediaController(){return Ne(this,Ae.MEDIA_CONTROLLER)}set mediaController(e){Ue(this,Ae.MEDIA_CONTROLLER,e)}get disabled(){return ve(this,_s.DISABLED)}set disabled(e){Ee(this,_s.DISABLED,e)}get noTooltip(){return ve(this,_s.NO_TOOLTIP)}set noTooltip(e){Ee(this,_s.NO_TOOLTIP,e)}handleClick(e){}}Di=new WeakMap;Tn=new WeakMap;$s=new WeakMap;en=new WeakMap;wl=new WeakMap;wh=new WeakSet;Db=function(){this.addEventListener("mouseenter",Je(this,$s)),this.addEventListener("focus",Je(this,$s)),this.addEventListener("click",Je(this,Tn));const i=this.tooltipPlacement;i&&this.tooltipEl&&(this.tooltipEl.placement=i)};vt.shadowRootOptions={mode:"open"};vt.getTemplateHTML=XC;vt.getSlotTemplateHTML=ZC;vt.getTooltipContentHTML=JC;k.customElements.get("media-chrome-button")||k.customElements.define("media-chrome-button",vt);const T0=`
+
+
+`;function ew(i){return`
+
+
+
+ ${T0}
+ ${T0}
+
+ `}function tw(){return`
+ ${J("start airplay")}
+ ${J("stop airplay")}
+ `}const _0=i=>{const e=i.mediaIsAirplaying?J("stop airplay"):J("start airplay");i.setAttribute("aria-label",e)};class Im extends vt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_AIRPLAYING,_.MEDIA_AIRPLAY_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),_0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_AIRPLAYING&&_0(this)}get mediaIsAirplaying(){return ve(this,_.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){Ee(this,_.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return Ne(this,_.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){Ue(this,_.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){const e=new k.CustomEvent(Y.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(e)}}Im.getSlotTemplateHTML=ew;Im.getTooltipContentHTML=tw;k.customElements.get("media-airplay-button")||k.customElements.define("media-airplay-button",Im);const iw=`
+
+ `,sw=`
+
+ `;function rw(i){return`
+
+
+
+ ${iw}
+ ${sw}
+
+ `}function nw(){return`
+ ${J("Enable captions")}
+ ${J("Disable captions")}
+ `}const A0=i=>{i.setAttribute("aria-checked",Tb(i).toString())};class Lm extends vt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_SUBTITLES_LIST,_.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",J("closed captions")),A0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_SUBTITLES_SHOWING&&A0(this)}get mediaSubtitlesList(){return S0(this,_.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){I0(this,_.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return S0(this,_.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){I0(this,_.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new k.CustomEvent(Y.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}}Lm.getSlotTemplateHTML=rw;Lm.getTooltipContentHTML=nw;const S0=(i,e)=>{const t=i.getAttribute(e);return t?Ru(t):[]},I0=(i,e,t)=>{if(!t?.length){i.removeAttribute(e);return}const s=uo(t);i.getAttribute(e)!==s&&i.setAttribute(e,s)};k.customElements.get("media-captions-button")||k.customElements.define("media-captions-button",Lm);const aw=' ',ow=' ';function lw(i){return`
+
+
+
+ ${aw}
+ ${ow}
+
+ `}function dw(){return`
+ ${J("Start casting")}
+ ${J("Stop casting")}
+ `}const L0=i=>{const e=i.mediaIsCasting?J("stop casting"):J("start casting");i.setAttribute("aria-label",e)};class Rm extends vt{static get observedAttributes(){return[...super.observedAttributes,_.MEDIA_IS_CASTING,_.MEDIA_CAST_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),L0(this)}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e===_.MEDIA_IS_CASTING&&L0(this)}get mediaIsCasting(){return ve(this,_.MEDIA_IS_CASTING)}set mediaIsCasting(e){Ee(this,_.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return Ne(this,_.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){Ue(this,_.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){const e=this.mediaIsCasting?Y.MEDIA_EXIT_CAST_REQUEST:Y.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new k.CustomEvent(e,{composed:!0,bubbles:!0}))}}Rm.getSlotTemplateHTML=lw;Rm.getTooltipContentHTML=dw;k.customElements.get("media-cast-button")||k.customElements.define("media-cast-button",Rm);var xm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ar=(i,e,t)=>(xm(i,e,"read from private field"),e.get(i)),is=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},km=(i,e,t,s)=>(xm(i,e,"write to private field"),e.set(i,t),t),Zs=(i,e,t)=>(xm(i,e,"access private method"),t),qd,co,kr,Ml,Mh,Ph,Cb,Oh,wb,Nh,Mb,Uh,Pb,$h,Ob;function uw(i){return`
+
+ ${this.getSlotTemplateHTML(i)}
+ `}function cw(i){return`
+
+ `}const ia={OPEN:"open",ANCHOR:"anchor"};class jn extends k.HTMLElement{constructor(){super(),is(this,Ml),is(this,Ph),is(this,Oh),is(this,Nh),is(this,Uh),is(this,$h),is(this,qd,!1),is(this,co,null),is(this,kr,null),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}static get observedAttributes(){return[ia.OPEN,ia.ANCHOR]}get open(){return ve(this,ia.OPEN)}set open(e){Ee(this,ia.OPEN,e)}handleEvent(e){switch(e.type){case"invoke":Zs(this,Nh,Mb).call(this,e);break;case"focusout":Zs(this,Uh,Pb).call(this,e);break;case"keydown":Zs(this,$h,Ob).call(this,e);break}}connectedCallback(){Zs(this,Ml,Mh).call(this),this.role||(this.role="dialog")}attributeChangedCallback(e,t,s){Zs(this,Ml,Mh).call(this),e===ia.OPEN&&s!==t&&(this.open?Zs(this,Ph,Cb).call(this):Zs(this,Oh,wb).call(this))}focus(){km(this,co,gm());const e=!this.dispatchEvent(new Event("focus",{composed:!0,cancelable:!0})),t=!this.dispatchEvent(new Event("focusin",{composed:!0,bubbles:!0,cancelable:!0}));if(e||t)return;const s=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');s?.focus()}get keysUsed(){return["Escape","Tab"]}}qd=new WeakMap;co=new WeakMap;kr=new WeakMap;Ml=new WeakSet;Mh=function(){if(!Ar(this,qd)&&(km(this,qd,!0),!this.shadowRoot)){this.attachShadow(this.constructor.shadowRootOptions);const i=Yt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i),queueMicrotask(()=>{const{style:e}=ut(this.shadowRoot,":host");e.setProperty("transition","display .15s, visibility .15s, opacity .15s ease-in, transform .15s ease-in")})}};Ph=new WeakSet;Cb=function(){var i;(i=Ar(this,kr))==null||i.setAttribute("aria-expanded","true"),this.dispatchEvent(new Event("open",{composed:!0,bubbles:!0})),this.addEventListener("transitionend",()=>this.focus(),{once:!0})};Oh=new WeakSet;wb=function(){var i;(i=Ar(this,kr))==null||i.setAttribute("aria-expanded","false"),this.dispatchEvent(new Event("close",{composed:!0,bubbles:!0}))};Nh=new WeakSet;Mb=function(i){km(this,kr,i.relatedTarget),gs(this,i.relatedTarget)||(this.open=!this.open)};Uh=new WeakSet;Pb=function(i){var e;gs(this,i.relatedTarget)||((e=Ar(this,co))==null||e.focus(),Ar(this,kr)&&Ar(this,kr)!==i.relatedTarget&&this.open&&(this.open=!1))};$h=new WeakSet;Ob=function(i){var e,t,s,r,n;const{key:a,ctrlKey:o,altKey:l,metaKey:d}=i;o||l||d||this.keysUsed.includes(a)&&(i.preventDefault(),i.stopPropagation(),a==="Tab"?(i.shiftKey?(t=(e=this.previousElementSibling)==null?void 0:e.focus)==null||t.call(e):(r=(s=this.nextElementSibling)==null?void 0:s.focus)==null||r.call(s),this.blur()):a==="Escape"&&((n=Ar(this,co))==null||n.focus(),this.open=!1))};jn.shadowRootOptions={mode:"open"};jn.getTemplateHTML=uw;jn.getSlotTemplateHTML=cw;k.customElements.get("media-chrome-dialog")||k.customElements.define("media-chrome-dialog",jn);var Dm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ge=(i,e,t)=>(Dm(i,e,"read from private field"),t?t.call(i):e.get(i)),Et=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ls=(i,e,t,s)=>(Dm(i,e,"write to private field"),e.set(i,t),t),mi=(i,e,t)=>(Dm(i,e,"access private method"),t),Ci,Du,Pl,Ol,pi,Yd,Nl,Ul,$l,Cm,Nb,Fl,Fh,Bl,Bh,jd,wm,Hh,Ub,Gh,$b,Kh,Fb,Vh,Bb;function hw(i){return`
+
+
+