diff --git a/pr-preview/pr-2/skip-button-plugin/index.html b/pr-preview/pr-2/skip-button-plugin/index.html index 3fe7694..929efda 100644 --- a/pr-preview/pr-2/skip-button-plugin/index.html +++ b/pr-preview/pr-2/skip-button-plugin/index.html @@ -49,4 +49,4 @@ ${u$(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=un({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:i||r&&s,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:t,level:i,stream:r})=>{this.logger_(`${u$(e)} logged from transmuxer stream ${r} as a ${i}: ${t}`)}})}trimBackBuffer_(e){let t=uj(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){let t=e.segment,i=e.part,r={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},s=e.playlist.segments[e.mediaIndex-1];if(s&&s.timeline===t.timeline&&(s.videoTimingInfo?r.baseStartTime=s.videoTimingInfo.transmuxedDecodeEnd:s.audioTimingInfo&&(r.baseStartTime=s.audioTimingInfo.transmuxedDecodeEnd)),t.key){let i=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);r.key=this.segmentKey(t.key),r.key.iv=i}return t.map&&(r.map=this.initSegmentForMap(t.map)),r}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e3*e.playlist.targetDuration,n=r&&r.end&&this.currentTime_()-r.end>3*e.playlist.partTargetDuration;if(s||n){this.logger_(`bad ${s?"segment":"part"} ${u$(e)}`),this.resetEverything();return}null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duratione.toUpperCase())},uJ=["video","audio"],uZ=(e,t)=>{let i=t[`${e}Buffer`];return i&&i.updating||t.queuePending[e]},u0=(e,t)=>{for(let i=0;i{if(0===t.queue.length)return;let i=0,r=t.queue[i];if("mediaSource"===r.type){t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),r.action(t),r.doneFn&&r.doneFn(),u1("audio",t),u1("video",t));return}if("mediaSource"!==e&&!(!t.ready()||"closed"===t.mediaSource.readyState||uZ(e,t))){if(r.type!==e){if(null===(i=u0(e,t.queue)))return;r=t.queue[i]}if(t.queue.splice(i,1),t.queuePending[e]=r,r.action(e,t),!r.doneFn){t.queuePending[e]=null,u1(e,t);return}}},u2=(e,t)=>{let i=t[`${e}Buffer`],r=uQ(e);i&&(i.removeEventListener("updateend",t[`on${r}UpdateEnd_`]),i.removeEventListener("error",t[`on${r}Error_`]),t.codecs[e]=null,t[`${e}Buffer`]=null)},u4=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),u8={appendBuffer:(e,t,i)=>(r,s)=>{let n=s[`${r}Buffer`];if(u4(s.mediaSource,n)){s.logger_(`Appending segment ${t.mediaIndex}'s ${e.length} bytes to ${r}Buffer`);try{n.appendBuffer(e)}catch(e){s.logger_(`Error with code ${e.code} `+(22===e.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${t.mediaIndex} to ${r}Buffer`),s.queuePending[r]=null,i(e)}}},remove:(e,t)=>(i,r)=>{let s=r[`${i}Buffer`];if(u4(r.mediaSource,s)){r.logger_(`Removing ${e} to ${t} from ${i}Buffer`);try{s.remove(e,t)}catch(s){r.logger_(`Remove ${e} to ${t} from ${i}Buffer failed`)}}},timestampOffset:e=>(t,i)=>{let r=i[`${t}Buffer`];u4(i.mediaSource,r)&&(i.logger_(`Setting ${t}timestampOffset to ${e}`),r.timestampOffset=e)},callback:e=>(t,i)=>{e()},endOfStream:e=>t=>{if("open"===t.mediaSource.readyState){t.logger_(`Calling mediaSource endOfStream(${e||""})`);try{t.mediaSource.endOfStream(e)}catch(e){os.log.warn("Failed to call media source endOfStream",e)}}},duration:e=>t=>{t.logger_(`Setting mediaSource duration to ${e}`);try{t.mediaSource.duration=e}catch(e){os.log.warn("Failed to set media source duration",e)}},abort:()=>(e,t)=>{if("open"!==t.mediaSource.readyState)return;let i=t[`${e}Buffer`];if(u4(t.mediaSource,i)){t.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(t){os.log.warn(`Failed to abort on ${e}Buffer`,t)}}},addSourceBuffer:(e,t)=>i=>{let r=uQ(e),s=eX(t);i.logger_(`Adding ${e}Buffer with codec ${t} to mediaSource`);let n=i.mediaSource.addSourceBuffer(s);n.addEventListener("updateend",i[`on${r}UpdateEnd_`]),n.addEventListener("error",i[`on${r}Error_`]),i.codecs[e]=t,i[`${e}Buffer`]=n},removeSourceBuffer:e=>t=>{let i=t[`${e}Buffer`];if(u2(e,t),u4(t.mediaSource,i)){t.logger_(`Removing ${e}Buffer with codec ${t.codecs[e]} from mediaSource`);try{t.mediaSource.removeSourceBuffer(i)}catch(t){os.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,t)}}},changeType:e=>(t,i)=>{let r=i[`${t}Buffer`],s=eX(e);if(!u4(i.mediaSource,r))return;let n=e.substring(0,e.indexOf(".")),a=i.codecs[t];if(a.substring(0,a.indexOf("."))!==n){i.logger_(`changing ${t}Buffer codec from ${i.codecs[t]} to ${e}`);try{r.changeType(s),i.codecs[t]=e}catch(e){os.log.warn(`Failed to changeType on ${t}Buffer`,e)}}}},u5=({type:e,sourceUpdater:t,action:i,doneFn:r,name:s})=>{t.queue.push({type:e,action:i,doneFn:r,name:s}),u1(e,t)},u3=(e,t)=>i=>{let r=function(e){if(0===e.length)return"Buffered Ranges are empty";let t="Buffered Ranges: \n";for(let i=0;i ${s}. Duration (${s-r}) `}return t}(t[`${e}Buffered`]());if(t.logger_(`received "updateend" event for ${e} Source Buffer: `,r),t.queuePending[e]){let i=t.queuePending[e].doneFn;t.queuePending[e]=null,i&&i(t[`${e}Error_`])}u1(e,t)};class u6 extends os.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>u1("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=oh("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=u3("video",this),this.onAudioUpdateEnd_=u3("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){u5({type:"mediaSource",sourceUpdater:this,action:u8.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){u5({type:e,sourceUpdater:this,action:u8.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){os.log.error("removeSourceBuffer is not supported!");return}u5({type:"mediaSource",sourceUpdater:this,action:u8.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!os.browser.IS_FIREFOX&&I(O).MediaSource&&I(O).MediaSource.prototype&&"function"==typeof I(O).MediaSource.prototype.removeSourceBuffer}static canChangeType(){return I(O).SourceBuffer&&I(O).SourceBuffer.prototype&&"function"==typeof I(O).SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){os.log.error("changeType is not supported!");return}u5({type:e,sourceUpdater:this,action:u8.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||"object"!=typeof e||0===Object.keys(e).length)throw Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{let i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){let{segmentInfo:i,type:r,bytes:s}=e;if(this.processedAppend_=!0,"audio"===r&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${s.length} until video append`);return}if(u5({type:r,sourceUpdater:this,action:u8.appendBuffer(s,i||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===r){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;let e=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${e.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,e.forEach(e=>{this.appendBuffer.apply(this,e)})}}audioBuffered(){return u4(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:op()}videoBuffered(){return u4(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:op()}buffered(){let e=u4(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=u4(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():ov(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=uY){u5({type:"mediaSource",sourceUpdater:this,action:u8.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=uY){"string"!=typeof e&&(e=void 0),u5({type:"mediaSource",sourceUpdater:this,action:u8.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=uY){if(!this.audioBuffered().length||0===this.audioBuffered().end(0)){i();return}u5({type:"audio",sourceUpdater:this,action:u8.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=uY){if(!this.videoBuffered().length||0===this.videoBuffered().end(0)){i();return}u5({type:"video",sourceUpdater:this,action:u8.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(uZ("audio",this)||uZ("video",this))}audioTimestampOffset(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(u5({type:"audio",sourceUpdater:this,action:u8.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(u5({type:"video",sourceUpdater:this,action:u8.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&u5({type:"audio",sourceUpdater:this,action:u8.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&u5({type:"video",sourceUpdater:this,action:u8.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),uJ.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>u2(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const u7=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),u9=e=>Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join(""),de=new Uint8Array("\n\n".split("").map(e=>e.charCodeAt(0)));class dt extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class di extends uX{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return op();let e=this.subtitlesTrack_.cues;return op([[e[0].startTime,e[e.length-1].startTime]])}initSegmentForMap(e,t=!1){if(!e)return null;let i=lh(e),r=this.initSegments_[i];if(t&&!r&&e.bytes){let t=new Uint8Array(de.byteLength+e.bytes.byteLength);t.set(e.bytes),t.set(de,e.bytes.byteLength),this.initSegments_[i]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}}return r||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}remove(e,t){uP(e,t,this.subtitlesTrack_)}fillBuffer_(){let e=this.chooseNextRequest_();if(e){if(null===this.syncController_.timestampOffsetForTimeline(e.timeline)){this.syncController_.one("timestampoffset",()=>{this.state="READY",this.paused()||this.monitorBuffer_()}),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===lZ.TIMEOUT&&this.handleTimeout_(),e.code===lZ.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}let r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");let s=r.segment;if(s.map&&(s.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof I(O).WebVTT&&"function"==typeof this.loadVttJs){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js",metadata:{errorType:os.Error.VttLoadError}}));return}s.requested=!0;try{this.parseVTTCues_(r)}catch(e){this.stopForError({message:e.message,metadata:{errorType:os.Error.VttCueParsingError}});return}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=s.duration,r.cues.forEach(e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new(I(O)).VTTCue(e.startTime,e.endTime,e.text):e)}),uL(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t;let i=!1;if("function"!=typeof I(O).WebVTT)throw new dt;"function"==typeof I(O).TextDecoder?t=new(I(O)).TextDecoder("utf8"):(t=I(O).WebVTT.StringDecoder(),i=!0);let r=new(I(O)).WebVTT.Parser(I(O),I(O).vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},r.oncue=e.cues.push.bind(e.cues),r.ontimestampmap=t=>{e.timestampmap=t},r.onparsingerror=e=>{os.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;i&&(t=u7(t)),r.parse(t)}let s=e.bytes;i&&(s=u7(s)),r.parse(s),r.flush()}updateTimeMapping_(e,t,i){let r=e.segment;if(!t)return;if(!e.cues.length){r.empty=!0;return}let{MPEGTS:s,LOCAL:n}=e.timestampmap,a=s/ij.ONE_SECOND_IN_TS-n+t.mapping;if(e.cues.forEach(e=>{let i=e.endTime-e.startTime,r=0===s?e.startTime+a:this.handleRollover_(e.startTime+a,t.time);e.startTime=Math.max(r,0),e.endTime=Math.max(r+i,0)}),!i.syncInfo){let t=e.cues[0].startTime,s=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(t,s-r.duration)}}}handleRollover_(e,t){let i;if(null===t)return e;let r=e*ij.ONE_SECOND_IN_TS,s=t*ij.ONE_SECOND_IN_TS;for(i=s4294967296;)r+=i;return r/ij.ONE_SECOND_IN_TS}}const dr=function(e,t){let i=e.cues;for(let e=0;e=r.adStartTime&&t<=r.adEndTime)return r}return null},ds=function(e,t,i=0){let r;if(!e.segments)return;let s=i;for(let i=0;i=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class dl{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){let{mediaSequence:i,segments:r}=e;if(this.isReliable_=this.isReliablePlaylist_(i,r),this.isReliable_)return this.updateStorage_(r,i,this.calculateBaseTime_(i,t))}getSyncInfoForTime(e){for(let{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(let t of i)if(t.isInRange(e))return t}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){let r=new Map,s="\n",n=i,a=t;this.start_=n,e.forEach((e,t)=>{let i=this.storage_.get(a),o=n,l=o+e.duration,u=!!(i&&i.segmentSyncInfo&&i.segmentSyncInfo.isAppended),d=new dn({start:o,end:l,appended:u,segmentIndex:t});e.syncInfo=d;let h=n,c=(e.parts||[]).map((e,r)=>{let n=h,o=h+e.duration,l=!!(i&&i.partsSyncInfo&&i.partsSyncInfo[r]&&i.partsSyncInfo[r].isAppended),u=new dn({start:n,end:o,appended:l,segmentIndex:t,partIndex:r});return h=o,s+=`Media Sequence: ${a}.${r} | Range: ${n} --> ${o} | Appended: ${l} `,e.syncInfo=u,u});r.set(a,new da(d,c)),s+=`${uS(e.resolvedUri)} | Media Sequence: ${a} | Range: ${o} --> ${l} | Appended: ${u} -`,a++,n=l}),this.end_=n,this.storage_=r,this.diagnostics_=s}calculateBaseTime_(e,t){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:t:0}isReliablePlaylist_(e,t){return null!=e&&Array.isArray(t)&&t.length}}class du extends dl{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t){if(!this.storage_.size){let t=this.parent_.getSyncInfoForMediaSequence(e);return t?t.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t)}}const dd=[{name:"VOD",run:(e,t,i,r,s)=>i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(e,t,i,r,s,n)=>{let a=e.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;let o=a.getSyncInfoForTime(s);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(e,t,i,r,s)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let n=null,a=null,o=oD(t);s=s||0;for(let i=0;i{let n=null,a=null;s=s||0;let o=oD(t);for(let e=0;e=e)&&(a=e,n={time:d,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return n}},{name:"Discontinuity",run:(e,t,i,r,s)=>{let n=null;if(s=s||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let r=0;r=e)&&(i=e,n={time:l.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,r,s)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class dh extends os.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};let t=new dl,i=new du(t),r=new du(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:r},this.logger_=oh("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,r,s){if(t!==1/0)return dd.find(({name:e})=>"VOD"===e).run(this,e,t);let n=this.runStrategies_(e,t,i,r,s);if(!n.length)return null;for(let t of n){let{syncPoint:i,strategy:s}=t,{segmentIndex:n,time:a}=i;if(n<0)continue;let o=a+e.segments[n].duration;if(this.logger_(`Strategy: ${s}. Current time: ${r}. selected segment: ${n}. Time: [${a} -> ${o}]}`),r>=a&&r0&&(r.time*=-1),Math.abs(r.time+oM({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,r,s){let n=[];for(let a=0;a86400){os.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let r=i-1;r>=0;r--){let i=e.segments[r];if(i&&void 0!==i.start){t.syncInfo={mediaSequence:e.mediaSequence+r,time:i.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){let t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){let i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),r=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));let s=r.dateTimeObject;r.discontinuity&&t&&s&&(this.timelineToDatetimeMappings[r.timeline]=-(s.getTime()/1e3))}timestampOffsetForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){let r,s;let n=e.segment,a=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${o.time}] [mapping: ${o.mapping}]`)),r=e.startOfSegment,s=t.end+o.mapping;else{if(!o)return!1;r=t.start+o.mapping,s=t.end+o.mapping}return a&&(a.start=r,a.end=s),(!n.start||ro){let r;r=a<0?i.start-oM({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:s}):i.end+oM({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[n]={time:r,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class dc extends os.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var dp=lF(lq(lj(function(){var e,t,i,r=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t){if(2==arguments.length)for(var i=t.length,r=0;r>7)*283)^e]=e;for(t=i=0;!h[t];t^=r||1,i=m[i]||1)for(e=0,n=(n=i^i<<1^i<<2^i<<3^i<<4)>>8^255&n^99,h[t]=n,c[n]=t,o=16843009*p[s=p[r=p[t]]]^65537*s^257*r^16843008*t,a=257*p[n]^16843008*n;e<4;e++)u[e][t]=a=a<<24^a>>>8,d[e][n]=o=o<<24^o>>>8;for(e=0;e<5;e++)u[e]=u[e].slice(0),d[e]=d[e].slice(0);return l},n=null;class a{constructor(e){let t,i,r;n||(n=s()),this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];let a=this._tables[0][4],o=this._tables[1],l=e.length,u=1;if(4!==l&&6!==l&&8!==l)throw Error("Invalid aes key size");let d=e.slice(0),h=[];for(this._key=[d,h],t=l;t<4*l+28;t++)r=d[t-1],(t%l==0||8===l&&t%l==4)&&(r=a[r>>>24]<<24^a[r>>16&255]<<16^a[r>>8&255]<<8^a[255&r],t%l==0&&(r=r<<8^r>>>24^u<<24,u=u<<1^(u>>7)*283)),d[t]=d[t-l]^r;for(i=0;t;i++,t--)r=d[3&i?t:t-4],t<=4||i<4?h[i]=r:h[i]=o[0][a[r>>>24]]^o[1][a[r>>16&255]]^o[2][a[r>>8&255]]^o[3][a[255&r]]}decrypt(e,t,i,r,s,n){let a,o,l,u;let d=this._key[1],h=e^d[0],c=r^d[1],p=i^d[2],m=t^d[3],g=d.length/4-2,f=4,y=this._tables[1],_=y[0],b=y[1],v=y[2],T=y[3],S=y[4];for(u=0;u>>24]^b[c>>16&255]^v[p>>8&255]^T[255&m]^d[f],o=_[c>>>24]^b[p>>16&255]^v[m>>8&255]^T[255&h]^d[f+1],l=_[p>>>24]^b[m>>16&255]^v[h>>8&255]^T[255&c]^d[f+2],m=_[m>>>24]^b[h>>16&255]^v[c>>8&255]^T[255&p]^d[f+3],f+=4,h=a,c=o,p=l;for(u=0;u<4;u++)s[(3&-u)+n]=S[h>>>24]<<24^S[c>>16&255]<<16^S[p>>8&255]<<8^S[255&m]^d[f++],a=h,h=c,c=p,p=m,m=a}}class o extends r{constructor(){super(r),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}let l=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},u=function(e,t,i){let r,s,n,o,u,d,h,c,p;let m=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),g=new a(Array.prototype.slice.call(t)),f=new Uint8Array(e.byteLength),y=new Int32Array(f.buffer);for(p=0,r=i[0],s=i[1],n=i[2],o=i[3];p{let r=e[i];("function"===ArrayBuffer.isView?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer)?t[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[i]=r}),t};self.onmessage=function(e){let t=e.data;new d(new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4),function(e,i){self.postMessage(p({source:t.source,decrypted:i}),[i.buffer])})}})));const dm=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},dg=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},df=(e,t)=>{t.activePlaylistLoader=e,e.load()},dy=(e,t)=>()=>{let{segmentLoaders:{[e]:i,main:r},mediaTypes:{[e]:s}}=t,n=s.activeTrack(),a=s.getActiveGroup(),o=s.activePlaylistLoader,l=s.lastGroup_;if((!a||!l||a.id!==l.id)&&(s.lastGroup_=a,s.lastTrack_=n,dg(i,s),a&&!a.isMainPlaylist)){if(!a.playlistLoader){o&&r.resetEverything();return}i.resyncLoader(),df(a.playlistLoader,s)}},d_=(e,t)=>()=>{let{segmentLoaders:{[e]:i},mediaTypes:{[e]:r}}=t;r.lastGroup_=null,i.abort(),i.pause()},db=(e,t)=>()=>{let{mainPlaylistLoader:i,segmentLoaders:{[e]:r,main:s},mediaTypes:{[e]:n}}=t,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,u=n.lastTrack_;if((!u||!a||u.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,dg(r,n),o)){if(o.isMainPlaylist){if(!a||!u||a.id===u.id)return;let e=t.vhs.playlistController_,r=e.selectPlaylist();if(e.media()===r)return;n.logger_(`track change. Switching main audio from ${u.id} to ${a.id}`),i.pause(),s.resetEverything(),e.fastQualityChange_(r);return}if("AUDIO"===e){if(!o.playlistLoader){s.setAudio(!0),s.resetEverything();return}r.setAudio(!0),s.setAudio(!1)}if(l===o.playlistLoader){df(o.playlistLoader,n);return}r.track&&r.track(a),r.resetEverything(),df(o.playlistLoader,n)}},dv={AUDIO:(e,t)=>()=>{let{mediaTypes:{[e]:i},excludePlaylist:r}=t,s=i.activeTrack(),n=i.activeGroup(),a=(n.filter(e=>e.default)[0]||n[0]).id,o=i.tracks[a];if(s===o){r({error:{message:"Problem encountered loading the default audio track."}});return}for(let e in os.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),i.tracks)i.tracks[e].enabled=i.tracks[e]===o;i.onTrackChanged()},SUBTITLES:(e,t)=>()=>{let{mediaTypes:{[e]:i}}=t;os.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");let r=i.activeTrack();r&&(r.mode="disabled"),i.onTrackChanged()}},dT={AUDIO:(e,t,i)=>{if(!t)return;let{tech:r,requestOptions:s,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{let e=t.media();n.playlist(e,s),(!r.paused()||e.endList&&"none"!==r.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),s),r.paused()||n.load()}),t.on("error",dv[e](e,i))},SUBTITLES:(e,t,i)=>{let{tech:r,requestOptions:s,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{let e=t.media();n.playlist(e,s),n.track(a.activeTrack()),(!r.paused()||e.endList&&"none"!==r.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),s),r.paused()||n.load()}),t.on("error",dv[e](e,i))}},dS={AUDIO:(e,t)=>{let{vhs:i,sourceType:r,segmentLoaders:{[e]:s},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[e]:{groups:o,tracks:l,logger_:u}},mainPlaylistLoader:d}=t,h=oH(d.main);for(let s in(!a[e]||0===Object.keys(a[e]).length)&&(a[e]={main:{default:{default:!0}}},h&&(a[e].main.default.playlists=d.main.playlists)),a[e])for(let c in o[s]||(o[s]=[]),a[e][s]){let p,m=a[e][s][c];if(h?(u(`AUDIO group '${s}' label '${c}' is a main playlist`),m.isMainPlaylist=!0,p=null):p="vhs-json"===r&&m.playlists?new li(m.playlists[0],i,n):m.resolvedUri?new li(m.resolvedUri,i,n):m.playlists&&"dash"===r?new lR(m.playlists[0],i,n,d):null,m=oc({id:c,playlistLoader:p},m),dT[e](e,m.playlistLoader,t),o[s].push(m),void 0===l[c]){let e=new os.AudioTrack({id:c,kind:dm(m),enabled:!1,language:m.language,default:m.default,label:c});l[c]=e}}s.on("error",dv[e](e,t))},SUBTITLES:(e,t)=>{let{tech:i,vhs:r,sourceType:s,segmentLoaders:{[e]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[e]:{groups:l,tracks:u}},mainPlaylistLoader:d}=t;for(let n in o[e])for(let h in l[n]||(l[n]=[]),o[e][n]){let c;if(!r.options_.useForcedSubtitles&&o[e][n][h].forced)continue;let p=o[e][n][h];if("hls"===s)c=new li(p.resolvedUri,r,a);else if("dash"===s){if(!p.playlists.filter(e=>e.excludeUntil!==1/0).length)return;c=new lR(p.playlists[0],r,a,d)}else"vhs-json"===s&&(c=new li(p.playlists?p.playlists[0]:p.resolvedUri,r,a));if(p=oc({id:h,playlistLoader:c},p),dT[e](e,p.playlistLoader,t),l[n].push(p),void 0===u[h]){let e=i.addRemoteTextTrack({id:h,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:h},!1).track;u[h]=e}}n.on("error",dv[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{let{tech:i,main:{mediaGroups:r},mediaTypes:{[e]:{groups:s,tracks:n}}}=t;for(let t in r[e])for(let a in s[t]||(s[t]=[]),r[e][t]){let o=r[e][t][a];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;let l=i.options_.vhs&&i.options_.vhs.captionServices||{},u={label:a,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(l[u.instreamId]&&(u=oc(u,l[u.instreamId])),void 0===u.default&&delete u.default,s[t].push(oc({id:a},o)),void 0===n[a]){let e=i.addRemoteTextTrack({id:u.instreamId,kind:"captions",default:u.default,language:u.language,label:u.label},!1).track;n[a]=e}}}},dE=(e,t)=>{for(let i=0;ii=>{let{mainPlaylistLoader:r,mediaTypes:{[e]:{groups:s}}}=t,n=r.media();if(!n)return null;let a=null;n.attributes[e]&&(a=s[n.attributes[e]]);let o=Object.keys(s);if(!a){if("AUDIO"===e&&o.length>1&&oH(t.main))for(let e=0;ee.id===i.id)[0]||null},dC={AUDIO:(e,t)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=t;for(let e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=t;for(let e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}},dk=(e,{mediaTypes:t})=>()=>{let i=t[e].activeTrack();return i?t[e].activeGroup(i):null},dD=e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{dS[t](t,e)});let{mediaTypes:t,mainPlaylistLoader:i,tech:r,vhs:s,segmentLoaders:{AUDIO:n,main:a}}=e;["AUDIO","SUBTITLES"].forEach(i=>{t[i].activeGroup=dw(i,e),t[i].activeTrack=dC[i](i,e),t[i].onGroupChanged=dy(i,e),t[i].onGroupChanging=d_(i,e),t[i].onTrackChanged=db(i,e),t[i].getActiveGroup=dk(i,e)});let o=t.AUDIO.activeGroup();if(o){let e=(o.filter(e=>e.default)[0]||o[0]).id;t.AUDIO.tracks[e].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}i.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(e=>t[e].onGroupChanged())}),i.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(e=>t[e].onGroupChanging())});let l=()=>{t.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};for(let e in r.audioTracks().addEventListener("change",l),r.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),s.on("dispose",()=>{r.audioTracks().removeEventListener("change",l),r.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),r.clearTracks("audio"),t.AUDIO.tracks)r.audioTracks().addTrack(t.AUDIO.tracks[e])},dI=()=>{let e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:uY,activeTrack:uY,getActiveGroup:uY,onGroupChanged:uY,onTrackChanged:uY,lastTrack_:null,logger_:oh(`MediaGroups[${t}]`)}}),e};class dx{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){1===e&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=ee(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(e=>[e.ID,e])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class dA extends os.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new dx,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=oh("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";let i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=ee(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){let t=this.steeringManifest.reloadUri;if(!t)return;let i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(e,t)=>{if(e){if(410===t.status){this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(429===t.status){let i=t.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${i} seconds.`),this.startTTLTimeout_(parseInt(i,10));return}this.logger_(`manifest failed to load ${e}.`),this.startTTLTimeout_();return}let r=JSON.parse(this.request_.responseText);this.assignSteeringProperties_(r),this.startTTLTimeout_()})}setProxyServerUrl_(e){let t=new(I(O)).URL(e),i=new(I(O)).URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){let t=JSON.parse(I(O).atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){let t=new(I(O)).URL(e),i=this.getPathway(),r=this.getBandwidth_();if(i){let e=`_${this.manifestType_}_pathway`;t.searchParams.set(e,i)}if(r){let e=`_${this.manifestType_}_throughput`;t.searchParams.set(e,r)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());let t=(e=>{for(let t of e)if(this.availablePathways_.has(t))return t;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;let t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){let i=this.setProxyServerUrl_(e);if(!t(i))return i}let i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){this.ttlTimeout_=I(O).setTimeout(()=>{this.requestSteeringManifest()},1e3*e)}clearTTLTimeout_(){I(O).clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new dx}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(ee(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const dP=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],dL=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},dO=function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:r,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:l}){if(!r)return os.log.warn("We received no playlist to switch to. Please check your stream."),!1;let u=`allowing switch ${e&&e.id||"null"} -> ${r.id}`;if(!e)return l(`${u} as current playlist is not set`),!0;if(r.id===e.id)return!1;let d=!!oy(t,i).length;if(!e.endList)return d||"number"!=typeof e.partTargetDuration?(l(`${u} as current playlist is live`),!0):(l(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);let h=oC(t,i),c=o?lM.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:lM.MAX_BUFFER_LOW_WATER_LINE;if(am)&&h>=s){let e=`${u} as forwardBuffer >= bufferLowWaterLine (${h} >= ${s})`;return o&&(e+=` and next bandwidth > current bandwidth (${p} > ${m})`),l(e),!0}return l(`not ${u} as no switching criteria met`),!1};class dR extends os.EventTarget{constructor(e){super();let{src:t,withCredentials:i,tech:r,bandwidth:s,externVhs:a,useCueTags:o,playlistExclusionDuration:l,enableLowInitialPlaylist:u,sourceType:d,cacheEncryptionKeys:h,bufferBasedABR:c,leastPixelDiffSelector:p,captionServices:m}=e;if(!t)throw Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:g}=e;null==g&&(g=1/0),n=a,this.bufferBasedABR=!!c,this.leastPixelDiffSelector=!!p,this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.sourceType_=d,this.useCueTags_=o,this.playlistExclusionDuration=l,this.maxPlaylistRetries=g,this.enableLowInitialPlaylist=u,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:g,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=dI(),this.mediaSource=new(I(O)).MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=op(),this.hasPlayed_=!1,this.syncController_=new dh(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new dp,this.sourceUpdater_=new u6(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new dc,this.keyStatusMap_=new Map;let f={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:m,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:h,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_="dash"===this.sourceType_?new lR(t,this.vhs_,oc(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new li(t,this.vhs_,oc(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new uX(oc(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new uX(oc(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new di(oc(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){r.off("vttjserror",s),e()}function s(){r.off("vttjsloaded",i),t()}r.one("vttjsloaded",i),r.one("vttjserror",s),r.addWebVttScript_()})}),e),this.contentSteeringController_=new dA(this.vhs_.xhr,()=>this.mainSegmentLoader_.bandwidth),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),dP.forEach(e=>{this[e+"_"]=dL.bind(this,e)}),this.logger_=oh("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;let y="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(y,()=>{let e=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){let e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return -1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){let t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){let r=this.media(),s=r&&(r.id||r.uri),n=e&&(e.id||e.uri);s&&s!==n&&(this.logger_(`switch media ${s} -> ${n} from ${t}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})),this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{let t=this.mediaTypes_[e],i=t?t.activeGroup():null,r=this.contentSteeringController_.getPathway();if(i&&r){let t=(i.length?i[0].playlists:i.playlists).filter(e=>e.attributes.serviceLocation===r);t.length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=I(O).setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(I(O).clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){let e;let t=this.main(),i=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return i;let r=t.mediaGroups.AUDIO,s=Object.keys(r);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)e=this.mediaTypes_.AUDIO.activeTrack();else{let t=r.main||s.length&&r[s[0]];for(let i in t)if(t[i].default){e={label:i};break}}if(!e)return i;let n=[];for(let i in r)if(r[i][e.label]){let s=r[i][e.label];if(s.playlists&&s.playlists.length)n.push.apply(n,s.playlists);else if(s.uri)n.push(s);else if(t.playlists.length)for(let e=0;e{let e=this.mainPlaylistLoader_.media(),t=1500*e.targetDuration;oj(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),dD({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){let t;if(this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_(),this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!("vhs-json"===this.sourceType_&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{let e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{let e=this.mainPlaylistLoader_.media(),t=1500*e.targetDuration;oj(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,"dash"===this.sourceType_&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{let e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),!this.tech_.paused()&&(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){let i=e.mediaGroups||{},r=!0,s=Object.keys(i.AUDIO);for(let e in i.AUDIO)for(let t in i.AUDIO[e])i.AUDIO[e][t].uri||(r=!1);r&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),n.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(i.AUDIO[s[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){let t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),r=this.bufferLowWaterLine(),s=this.bufferHighWaterLine();return dO({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:r,bufferHighWaterLine:s,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{let e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))});let e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();let e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(()=>{this.tech_.setCurrentTime(this.tech_.currentTime())})}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();let e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;let e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;let t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){let t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;let t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;let i=n.Playlist.playlistEnd(e,t),r=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return i-r<=og;let a=s.end(s.length-1);return a-r<=og&&i-a<=og}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){let r;if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;let s=this.mainPlaylistLoader_.main.playlists,n=s.filter(oF),a=1===n.length&&n[0]===e;if(1===s.length&&i!==1/0)return os.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){let t=this.pathwayAttribute_(e),i=1e3*this.contentSteeringController_.steeringManifest.ttl;this.contentSteeringController_.excludePathway(t),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(t)},i);return}let t=!1;s.forEach(i=>{if(i===e)return;let r=i.excludeUntil;void 0!==r&&r!==1/0&&(t=!0,delete i.excludeUntil)}),t&&(os.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}r=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=r,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});let o=this.selectPlaylist();if(!o){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}let l=t.internal?this.logger_:os.log.warn,u=t.message?" "+t.message:"";l(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${u} Switching to playlist ${o.id}.`),o.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),o.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);let d=o.targetDuration/2*1e3||5e3,h="number"==typeof o.lastRequest&&Date.now()-o.lastRequest<=d;return this.switchMedia_(o,"exclude",a||h)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){let i=[],r="all"===e;(r||"main"===e)&&i.push(this.mainPlaylistLoader_);let s=[];(r||"audio"===e)&&s.push("AUDIO"),(r||"subtitle"===e)&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.forEach(e=>{let t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)}),["main","audio","subtitle"].forEach(t=>{let r=this[`${t}SegmentLoader_`];r&&(e===t||"all"===e)&&i.push(r)}),i.forEach(e=>t.forEach(t=>{"function"==typeof e[t]&&e[t]()}))}setCurrentTime(e){let t=oy(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:void(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()):0}duration(){if(!this.mainPlaylistLoader_)return 0;let e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:n.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e,t,i;if(!this.mainPlaylistLoader_)return;let r=this.mainPlaylistLoader_.media();if(!r)return;let s=this.syncController_.getExpiredTime(r,this.duration());if(null===s)return;let a=this.mainPlaylistLoader_.main,o=n.Playlist.seekable(r,s,n.Playlist.liveEdgeDelay(a,r));if(0!==o.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(r=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(s=this.syncController_.getExpiredTime(r,this.duration()))||0===(e=n.Playlist.seekable(r,s,n.Playlist.liveEdgeDelay(a,r))).length)||(this.seekable_&&this.seekable_.length&&(t=this.seekable_.end(0),i=this.seekable_.start(0)),e?e.start(0)>o.end(0)||o.start(0)>e.end(0)?this.seekable_=o:this.seekable_=op([[e.start(0)>o.start(0)?e.start(0):o.start(0),e.end(0)0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{let t=this.mediaTypes_[e].groups;for(let e in t)t[e].forEach(e=>{e.playlistLoader&&e.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){let e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!!t&&!!i}getCodecsOrExclude_(){let e;let t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},i=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();t.video=t.main;let r=uc(this.main(),i),s={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(s.video=r.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(s.video+=`,${r.audio||t.main.audioCodec||eJ}`),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||n)&&(s.audio=r.audio||t.main.audioCodec||t.audio.audioCodec||eJ,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),!s.audio&&!s.video){this.excludePlaylist({playlistToExclude:i,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}let a=(e,t)=>e?eY(t):eQ(t),o={};if(["video","audio"].forEach(function(i){if(s.hasOwnProperty(i)&&!a(t[i].isFmp4,s[i])){let r=t[i].isFmp4?"browser":"muxer";o[r]=o[r]||[],o[r].push(s[i]),"audio"===i&&(e=r)}}),n&&e&&i.attributes.AUDIO){let t=i.attributes.AUDIO;this.main().playlists.forEach(e=>{(e.attributes&&e.attributes.AUDIO)===t&&e!==i&&(e.excludeUntil=1/0)}),this.logger_(`excluding audio group ${t} as ${e} does not support codec(s): "${s.audio}"`)}if(Object.keys(o).length){let e=Object.keys(o).reduce((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${o[t].join(",")}"`),"")+".";this.excludePlaylist({playlistToExclude:i,error:{internal:!0,message:e},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){let e=[];if(["video","audio"].forEach(t=>{let i=(eG(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(eG(s[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${s[t]}"`)}),e.length){this.excludePlaylist({playlistToExclude:i,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return s}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;let e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);let t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){let e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{let r=e[i];if(-1!==t.indexOf(r.id))return;t.push(r.id);let s=uc(this.main,r),n=[];!s.audio||eQ(s.audio)||eY(s.audio)||n.push(`audio codec ${s.audio}`),!s.video||eQ(s.video)||eY(s.video)||n.push(`video codec ${s.video}`),s.text&&"stpp.ttml.im1t"===s.text&&n.push(`text codec ${s.text}`),n.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${n.join(", ")}`))})}excludeIncompatibleVariants_(e){let t=[],i=this.main().playlists,r=ud(eG(e)),s=uh(r),n=r.video&&eG(r.video)[0]||null,a=r.audio&&eG(r.audio)[0]||null;Object.keys(i).forEach(e=>{let r=i[e];if(-1!==t.indexOf(r.id)||r.excludeUntil===1/0)return;t.push(r.id);let o=[],l=uc(this.mainPlaylistLoader_.main,r),u=uh(l);if(l.audio||l.video){if(u!==s&&o.push(`codec count "${u}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){let e=l.video&&eG(l.video)[0]||null,t=l.audio&&eG(l.audio)[0]||null;e&&n&&e.type.toLowerCase()!==n.type.toLowerCase()&&o.push(`video codec "${e.type}" !== "${n.type}"`),t&&a&&t.type.toLowerCase()!==a.type.toLowerCase()&&o.push(`audio codec "${t.type}" !== "${a.type}"`)}o.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id}: ${o.join(" && ")}`))}})}updateAdCues_(e){let t=0,i=this.seekable();i.length&&(t=i.start(0)),ds(e,this.cueTagsTrack_,t)}goalBufferLength(){let e=this.tech_.currentTime(),t=lM.GOAL_BUFFER_LENGTH,i=lM.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,lM.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,r)}bufferLowWaterLine(){let e=this.tech_.currentTime(),t=lM.BUFFER_LOW_WATER_LINE,i=lM.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,lM.MAX_BUFFER_LOW_WATER_LINE),s=Math.max(t,lM.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?s:r)}bufferHighWaterLine(){return lM.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){uA(this.inbandTextTracks_,"com.apple.streaming",this.tech_),ux({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){let r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();uA(this.inbandTextTracks_,e,this.tech_),uk({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:r,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){let e=this.main();if(e.contentSteering){for(let t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{let e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{let t=this.contentSteeringController_.getAvailablePathways(),i=[];for(let r of e.playlists){let e=r.attributes.serviceLocation;if(e&&(i.push(e),!t.has(e)))return!0}return!i.length&&!!t.size})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){let e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();let t=this.main().playlists,i=new Set,r=!1;Object.keys(t).forEach(s=>{let n=t[s],a=this.pathwayAttribute_(n),o=a&&e!==a;n.excludeUntil!==1/0||"content-steering"!==n.lastExcludeReason_||o||(delete n.excludeUntil,delete n.lastExcludeReason_,r=!0);let l=!n.excludeUntil&&n.excludeUntil!==1/0;!i.has(n.id)&&o&&l&&(i.add(n.id),n.excludeUntil=1/0,n.lastExcludeReason_="content-steering",this.logger_(`excluding ${n.id} for ${n.lastExcludeReason_}`))}),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach(t=>{let i=this.mediaTypes_[t];if(i.activePlaylistLoader){let t=i.activePlaylistLoader.media_;t&&t.attributes.serviceLocation!==e&&(r=!0)}}),r&&this.changeSegmentPathway_()}handlePathwayClones_(){let e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||i&&i.size){for(let[e,r]of t.entries())i.get(e)||(this.mainPlaylistLoader_.updateOrDeleteClone(r),this.contentSteeringController_.excludePathway(e));for(let[r,s]of i.entries()){let i=t.get(r);if(!i){e.filter(e=>e.attributes["PATHWAY-ID"]===s["BASE-ID"]).forEach(e=>{this.mainPlaylistLoader_.addClonePathway(s,e)}),this.contentSteeringController_.addAvailablePathway(r);continue}this.equalPathwayClones_(i,s)||(this.mainPlaylistLoader_.updateOrDeleteClone(s,!0),this.contentSteeringController_.addAvailablePathway(r))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;let i=e["URI-REPLACEMENT"].PARAMS,r=t["URI-REPLACEMENT"].PARAMS;for(let e in i)if(i[e]!==r[e])return!1;for(let e in r)if(i[e]!==r[e])return!1;return!0}changeSegmentPathway_(){let e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0,t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{let r=this.mainPlaylistLoader_.getKeyIdSet(i);r&&r.size&&r.forEach(r=>{let s="usable",n=this.keyStatusMap_.has(r)&&this.keyStatusMap_.get(r)===s,a=i.lastExcludeReason_===t&&i.excludeUntil===1/0;n?n&&a&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${r} is ${s}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${r} doesn't exist in the keyStatusMap or is not ${s}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(e=>{let i=e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height<720,r=e.excludeUntil===1/0&&e.lastExcludeReason_===t;i&&r&&(delete e.excludeUntil,os.log.warn(`enabling non-HD playlist ${e.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){let i=("string"==typeof e?e:u9(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${i} added to the keyStatusMap`),this.keyStatusMap_.set(i,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const dM=(e,t,i)=>r=>{let s=e.main.playlists[t],n=oB(s),a=oF(s);return void 0===r?a:(r?delete s.disabled:s.disabled=!0,r===a||n||(i(s),r?e.trigger("renditionenabled"):e.trigger("renditiondisabled")),r)};class dN{constructor(e,t,i){let{playlistController_:r}=e,s=r.fastQualityChange_.bind(r);if(t.attributes){let e=t.attributes.RESOLUTION;this.width=e&&e.width,this.height=e&&e.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=uc(r.main(),t),this.playlist=t,this.id=i,this.enabled=dM(e.playlists,t.id,s)}}const dU=function(e){e.representations=()=>{let t=e.playlistController_.main(),i=oH(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter(e=>!oB(e)).map((t,i)=>new dN(e,t,t.id)):[]}},dB=["seeking","seeked","pause","playing","error"];class dF{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=oh("PlaybackWatcher"),this.logger_("initialize");let t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={};a.forEach(e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[`${e}SegmentLoader_`].on("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)});let l=e=>{["main","audio"].forEach(t=>{n[`${t}SegmentLoader_`][e]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(dB,s),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(dB,s),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach(e=>{n[`${e}SegmentLoader_`].off("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)}),this.checkCurrentTimeTimeout_&&I(O).clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&I(O).clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=I(O).setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){let t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){let t=this.playlistController_,i=t[`${e}SegmentLoader_`],r=i.buffered_(),s=oE(this[`${e}Buffered_`],r);if(this[`${e}Buffered_`]=r,s){this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:oS(r)}),this[`${e}StalledDownloads_`]<10||(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),"subtitle"!==e&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;let e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+og>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){let e;if(!this.tech_.seeking())return!1;let t=this.seekable(),i=this.tech_.currentTime();if(this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){let i=t.start(0);e=i+(i===t.end(0)?0:og)}if(void 0!==e)return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${oT(t)}. Seeking to ${e}.`),this.tech_.setCurrentTime(e),!0;let r=this.playlistController_.sourceUpdater_,s=this.tech_.buffered(),n=r.audioBuffer?r.audioBuffered():null,a=r.videoBuffer?r.videoBuffered():null,o=this.media(),l=o.partTargetDuration?o.partTargetDuration:(o.targetDuration-om)*2,u=[n,a];for(let e=0;e ${t.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){let e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){let i=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${i}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}let i=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;let s=o_(r,t);return s.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,r=!1){if(!e.length)return!1;let s=e.end(e.length-1)+og,n=!i.endList,a="number"==typeof i.partTargetDuration;return n&&(a||r)&&(s=e.end(e.length-1)+3*i.targetDuration),t>s}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:s}}return null}}const dq={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},dj=function(e,t){let i=0,r=0,s=oc(dq,t);e.ready(()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})});let n=function(){r&&e.currentTime(r)},a=function(t){null!=t&&(r=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",n),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){if(Date.now()-i<1e3*s.errorInterval){e.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!s.getSource||"function"!=typeof s.getSource){os.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return i=Date.now(),s.getSource.call(e,a)},l=function(){e.off("loadedmetadata",n),e.off("error",o),e.off("dispose",l)};e.on("error",o),e.on("dispose",l),e.reloadSourceOnError=function(t){l(),dj(e,t)}};var d$="3.12.2";const dV={PlaylistLoader:li,Playlist:oz,utils:lm,STANDARD_PLAYLIST_SELECTOR:ub,INITIAL_PLAYLIST_SELECTOR:function(){let e=this.playlists.main.playlists.filter(oz.isEnabled);return uf(e,(e,t)=>uy(e,t)),e.filter(e=>!!uc(this.playlists.main,e).video)[0]||null},lastBandwidthSelector:ub,movingAverageBandwidthSelector:function(e){let t=-1,i=-1;if(e<0||e>1)throw Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let r=this.useDevicePixelRatio&&I(O).devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),u_(this.playlists.main,t,parseInt(ug(this.tech_.el(),"width"),10)*r,parseInt(ug(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:uy,comparePlaylistResolution:function(e,t){let i,r;return(e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||I(O).Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(r=t.attributes.RESOLUTION.width),i===(r=r||I(O).Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH)?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-r},xhr:la()};Object.keys(lM).forEach(e=>{Object.defineProperty(dV,e,{get:()=>(os.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),lM[e]),set(t){if(os.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0){os.log.warn(`value of Vhs.${e} must be greater than or equal to 0`);return}lM[e]=t}})});const dH="videojs-vhs",dz=function(e,t){let i=t.media(),r=-1;for(let t=0;t{e.addQualityLevel(t)}),dz(e,t.playlists)};dV.canPlaySource=function(){return os.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const dW=(e,t,i)=>{if(!e)return e;let r={};t&&t.attributes&&t.attributes.CODECS&&(r=ud(eG(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(r.audio=i.attributes.CODECS);let s=eX(r.video),n=eX(r.audio),a={};for(let i in e)a[i]={},n&&(a[i].audioContentType=n),s&&(a[i].videoContentType=s),t.contentProtection&&t.contentProtection[i]&&t.contentProtection[i].pssh&&(a[i].pssh=t.contentProtection[i].pssh),"string"==typeof e[i]&&(a[i].url=e[i]);return oc(e,a)},dK=(e,t)=>e.reduce((e,i)=>{if(!i.contentProtection)return e;let r=t.reduce((e,t)=>{let r=i.contentProtection[t];return r&&r.pssh&&(e[t]={pssh:r.pssh}),e},{});return Object.keys(r).length&&e.push(r),e},[]),dX=({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:r})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();let s=dK(i?r.concat([i]):r,Object.keys(t)),n=[],a=[];return s.forEach(t=>{a.push(new Promise((t,i)=>{e.tech_.one("keysessioncreated",t)})),n.push(new Promise((i,r)=>{e.eme.initializeMediaKeys({keySystems:t},e=>{if(e){r(e);return}i()})}))}),Promise.race([Promise.all(n),Promise.race(a)])},dY=({player:e,sourceKeySystems:t,media:i,audioMedia:r})=>{let s=dW(t,i,r);return!!s&&(e.currentSource().keySystems=s,!s||!!e.eme||(os.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},dQ=()=>{if(!I(O).localStorage)return null;let e=I(O).localStorage.getItem(dH);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},dJ=e=>{if(!I(O).localStorage)return!1;let t=dQ();t=t?oc(t,e):e;try{I(O).localStorage.setItem(dH,JSON.stringify(t))}catch(e){return!1}return t},dZ=e=>0===e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,d0=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},d1=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},d2=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},d4=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};dV.supportsNativeHls=function(){if(!I(R)||!I(R).createElement)return!1;let e=I(R).createElement("video");return!!os.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(e.canPlayType(t))})}(),dV.supportsNativeDash=!!(I(R)&&I(R).createElement&&os.getTech("Html5").isSupported())&&/maybe|probably/i.test(I(R).createElement("video").canPlayType("application/dash+xml")),dV.supportsTypeNatively=e=>"hls"===e?dV.supportsNativeHls:"dash"===e&&dV.supportsNativeDash,dV.isSupported=function(){return os.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},dV.xhr.onRequest=function(e){d0(dV.xhr,e)},dV.xhr.onResponse=function(e){d1(dV.xhr,e)},dV.xhr.offRequest=function(e){d2(dV.xhr,e)},dV.xhr.offResponse=function(e){d4(dV.xhr,e)};const d8=os.getComponent("Component");class d5 extends d8{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=oh("VhsHandler"),t.options_&&t.options_.playerId){let e=os.getPlayer(t.options_.playerId);this.player_=e}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(I(R),["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{let t=I(R).fullscreenElement||I(R).webkitFullscreenElement||I(R).mozFullScreenElement||I(R).msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=oc(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){let e=dQ();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=lM.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===lM.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{void 0!==this.source_[e]&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;let t=this.options_.customPixelRatio;"number"==typeof t&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=dZ(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=dV,this.options_.sourceType=e1(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new dR(this.options_);let i=oc({liveRangeSafeTimeDelta:og},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new dF(i),this.playlistController_.on("error",()=>{let e=os.players[this.tech_.options_.playerId],t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)});let r=this.options_.bufferBasedABR?dV.movingAverageBandwidthSelector(.55):dV.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=dV.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth,t=I(O).navigator.connection||I(O).navigator.mozConnection||I(O).navigator.webkitConnection;if(this.options_.useNetworkInformationApi&&t){let i=1e6*t.downlink;e=i>=1e7&&e>=1e7?Math.max(e,i):i}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){return Math.floor(1/(1/(this.bandwidth||1)+(this.throughput>0?1/this.throughput:0)))},set(){os.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>oS(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>oS(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&dJ({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{dU(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=I(O).URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),dX({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3,metadata:{errorType:os.Error.EMEKeySessionCreationError}})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=dY({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",e=>{this.playlistController_.updatePlaylistByKeyStatus(e.keyId,e.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){let e=os.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{dG(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{dz(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":d$,"mux.js":"7.0.3","mpd-parser":"1.3.0","m3u8-parser":"7.1.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return u6.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&I(O).URL.revokeObjectURL&&(I(O).URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return lT({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,r=2){return lS({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{d0(this.xhr,e)},this.xhr.onResponse=e=>{d1(this.xhr,e)},this.xhr.offRequest=e=>{d2(this.xhr,e)},this.xhr.offResponse=e=>{d4(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const d3={name:"videojs-http-streaming",VERSION:d$,canHandleSource(e,t={}){let i=oc(os.options,t);return d3.canPlayType(e.type,i)},handleSource(e,t,i={}){let r=oc(os.options,i);return t.vhs=new d5(e,t,r),t.vhs.xhr=la(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){let i=e1(e);if(!i)return"";let r=d3.getOverrideNative(t);return!dV.supportsTypeNatively(i)||r?"maybe":""},getOverrideNative(e={}){let{vhs:t={}}=e,i=!(os.browser.IS_ANY_SAFARI||os.browser.IS_IOS),{overrideNative:r=i}=t;return r}};eY("avc1.4d400d,mp4a.40.2")&&os.getTech("Html5").registerSourceHandler(d3,0),os.VhsHandler=d5,os.VhsSourceHandler=d3,os.Vhs=dV,os.use||os.registerComponent("Vhs",dV),os.options.vhs=os.options.vhs||{},os.getPlugin&&os.getPlugin("reloadSourceOnError")||os.registerPlugin("reloadSourceOnError",function(e){dj(this,e)});/*! @name videojs-contrib-eme @version 3.11.2 @license Apache-2.0 */var R=P("7pNCM"),O=P("eDick");function d6(){return(d6=Object.assign||function(e){for(var t=1;t=400&&r.statusCode<=599){var n=s;t&&(n=String.fromCharCode.apply(null,new Uint8Array(s))),e({cause:n});return}e(null,s)}});var hn=function(e){var t,i=String.fromCharCode.apply(null,new Uint16Array(e)),r=new(I(O)).DOMParser().parseFromString(i,"application/xml"),s=r.getElementsByTagName("HttpHeaders")[0],n={};if(s)for(var a=s.getElementsByTagName("name"),o=s.getElementsByTagName("value"),l=0;l=0||(s[i]=e[i]);return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}return s}os.registerPlugin("eme",hA),hA.VERSION="3.11.2";const hN=os.getComponent("player");os.registerComponent("player",class extends hN{constructor(e,t,i){super(e,t=os.obj.merge(t,{plugins:{eme:!0}}),i)}audioTrack(e){let t=Array.from(this.player().audioTracks());if(!e)return t.find(e=>e.enabled);let{kind:i,language:r}=e,s=t.find(e=>e.language===r&&e.kind===i)||t.find(e=>e.language===r);return s&&(s.enabled=!0),s}bufferedRanges(){let e=[];for(let t=0;t!["chapters","metadata"].includes(e.kind));if(!e)return t.find(e=>"showing"===e.mode);t.forEach(e=>e.mode="disabled");let{kind:i,language:r}=e;return t.find(e=>(e.language===r&&e.kind===i&&(e.mode="showing"),"showing"===e.mode))||t.find(e=>(e.language===r&&(e.mode="showing"),"showing"===e.mode))}}),os.VERSION={pillarbox:"1.10.0",videojs:os.VERSION,[os.VhsSourceHandler.name]:os.VhsSourceHandler.VERSION,eme:os.getPlugin("eme").VERSION},os.options.enableSmoothSeeking=!0,os.options.fill=!0,os.options.html5={vhs:{useForcedSubtitles:!0}},os.options.liveTracker={trackingThreshold:120,liveTolerance:15},os.options.liveui=!0,os.options.playsinline=!0,os.options.responsive=!0,os.options.trackers={};class hU{constructor(e="il.srgssr.ch"){this.setIlHost(e)}setIlHost(e){this.baseUrl=`${e}/integrationlayer/2.1/`}handleRequest(e){var t,i=this;return t=hR(function*(t){let r="function"==typeof e?e(t):i.mediaCompositionUrlHandler(t),s=yield fetch(r);if(!s.ok)throw s;return yield s.json()}),function(e){return t.apply(this,arguments)}}mediaCompositionUrlHandler(e){return`https://${this.baseUrl}mediaComposition/byUrn/${e}?onlyChapters=true&vector=portalplay`}}const hB="https://il.srgssr.ch/images/";class hF{static scale({url:e,width:t="960",format:i="jpg"}={},r=hB){if(!e)return;let s=new URL(r);return s.searchParams.set("imageUrl",e),s.searchParams.set("format",i),s.searchParams.set("width",t),decodeURIComponent(s.href)}static get JPG(){return"jpg"}static get PNG(){return"png"}static get WEBP(){return"webp"}static get WIDTH_240(){return"240"}static get WIDTH_320(){return"320"}static get WIDTH_480(){return"480"}static get WIDTH_960(){return"960"}static get WIDTH_1920(){return"1920"}}const hq={WIDEVINE:"com.widevine.alpha",FAIRPLAY:"com.apple.fps.1_0",PLAYREADY:"com.microsoft.playready"};class hj{static buildKeySystems(e=[]){let t={};return e.forEach(e=>{let i=hj.vendors[e.type];if(hj.vendors.FAIRPLAY===i){let{certificateUrl:r,licenseUrl:s}=e;t[i]={certificateUri:r,licenseUri:s}}else t[i]=e.licenseUrl}),{keySystems:t}}static hasDrm(e){return e.some(({drmList:e})=>e&&e.length>0)}static get vendors(){return hq}}const h$="AKAMAI",hV="NONE";class hH{static aclPath(e){let t=e.pathname;return`${t.substring(0,t.lastIndexOf("/")+1)}*`}static get AKAMAI(){return h$}static hasToken(e){return e.some(e=>hH.isAkamai(e.tokenType))}static isAkamai(e){return h$===e}static isNone(e){return hV===e}static get NONE(){return hV}static tokenize(e,t){let i=new URL(`${e.url}`),r=hH.aclPath(i);return fetch(`${t}${encodeURIComponent(r)}`).then(e=>e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText})).then(({token:{authparams:t}})=>(new URLSearchParams(t).forEach((e,t)=>i.searchParams.set(t,e)),Object.assign({},e,{url:i.toString()}))).catch(e=>Promise.reject(e))}static tokenizeSources(e,t="https://tp.srgssr.ch/akahd/token?acl="){let i=[];return e.forEach(e=>{let r=hH.tokenize(e,t);i.push(r)}),Promise.all(i).then(e=>e).catch(e=>Promise.reject(e))}}const hz="emptied",hG="ended",hW="loadeddata",hK="loadstart",hX="pause",hY="playing",hQ="ratechange",hJ="seeking",hZ="timeupdate",h0="waiting";class h1{constructor(e,{debug:t=!1,environment:i="prod",playerVersion:r="none",tagCommanderScriptURL:s="//colibri-js.akamaized.net/penguin/tc_SRGGD_11.js"}={}){this.isDebugEnabled=t,this.elapsedPlaybackTime=0,this.environment=i,this.hasStarted=!1,this.heartBeatIntervalId=void 0,this.initialized=!1,this.isSeeking=!1,this.isWaiting=!1,this.mediaSession=0,this.pendingQueue=[],this.pendingTagCommanderReload=!1,this.player=e,this.playerVersion=r,this.srcMediaData=void 0,this.startPlaybackSession=0,this.tagCommanderScriptURL=s,this.trackedCurrentTime=0,this.uptimeIntervalId=void 0,this.initScript(),this.initListeners()}beforeunload(){this.notify("stop")}clearTimers(){clearInterval(this.heartBeatIntervalId),clearInterval(this.uptimeIntervalId),clearTimeout(this.uptimeTimeoutId)}currentTime(){return Math.round(this.trackedCurrentTime)}debug(e){if(void 0===e)return this.isDebugEnabled||this.player.debug();this.isDebugEnabled=!!e}destroy(){this.clearTimers(),window.tc_vars||(window.tc_vars={}),this.elapsedPlaybackTime=0,this.hasStarted=!1,this.heartBeatIntervalId=void 0,this.initialized=!1,this.isWaiting=!1,this.mediaSession=0,this.pendingQueue=[],this.srcMediaData=void 0,this.startPlaybackSession=0,this.trackedCurrentTime=0,this.uptimeIntervalId=void 0}dispose(){this.beforeunload(),this.clearTimers(),window.removeEventListener("beforeunload",this.beforeunloadListener),this.player.off(hz,this.emptiedListener),this.player.off(hG,this.endedListener),this.player.off(hK,this.loadstartListener),this.player.off(hW,this.loadeddataListener),this.player.off(hY,this.playListener),this.player.off(hX,this.pauseListener),this.player.off(hQ,this.rateChangeListener),this.player.off(hJ,this.seekingListener),this.player.off(hZ,this.timeUpdateListener),this.player.off(h0,this.waitingListener)}emptied(){this.player.ended()||this.notify("stop")}ended(){this.notify("eof"),this.mediaSession=0,this.clearTimers()}flush(){!this.isTrackerDisabled()&&(this.pendingTagCommanderReload&&window.tC&&(window.tC.container.reload(),this.pendingTagCommanderReload=!1),window.tc_events_11&&this.pendingQueue.length>0&&(this.pendingQueue.forEach(e=>{window.tc_events_11(this.player.el(),e.action,e.labels)}),this.pendingQueue=[]))}getCurrentAudioTrack(){let e=Array.from(this.player.audioTracks()).find(e=>e.enabled),t="und";return e&&e.language&&(t=e.language),e?t.toUpperCase():""}getCurrentTextTrack(){let e=this.player.textTrack(),t="und";return e&&e.language&&(t=e.language),e?t.toUpperCase():""}getDvrWindowPosition(){let{liveTracker:e}=this.player,t=this.currentTime()-e.seekableStart()|0,i=e.liveWindow()-t;return i<0||i===1/0?0:1e3*i}getDvrWindowSize(){let e=this.player.liveTracker.liveWindow()===1/0,t=1e3*this.player.liveTracker.liveWindow();return e?0:t}getElapsedPlaybackTime(){return this.startPlaybackSession?this.getElapsedPlayingTime():this.elapsedPlaybackTime}getElapsedPlayingTime(){let e=h1.now()-this.startPlaybackSession|0;return this.elapsedPlaybackTime+e}getEventLabels(e){let t={event_id:e,event_timestamp:h1.now(),media_dvr_window_length:0,media_dvr_window_offset:0,media_is_dvr:!1,media_is_live:!1,media_mute:this.player.muted()?"1":"0",media_playback_rate:this.player.playbackRate(),media_position:this.currentTime(),media_quality:this.srcMediaData.mediaData.quality,media_subtitles_on:this.isTextTrackEnabled(),media_volume:(100*this.player.volume()).toFixed(0),navigation_environment:this.environment};return this.isAudioTrackEnabled()&&(t.media_audio_track=this.getCurrentAudioTrack()),this.isTextTrackEnabled()&&(t.media_subtitle_selection=this.getCurrentTextTrack()),this.isMediaOnDemand()||(t.media_is_live=!0,t.media_position=this.getElapsedPlaybackTime()),this.isMediaDvr()&&(t.media_dvr_window_offset=0|this.getDvrWindowPosition(),t.media_dvr_window_length=0|this.getDvrWindowSize(),t.media_is_dvr=!0,t.media_timeshift=["play",hX].includes(e)?this.timeShifted():0),t}getInternalLabels(){let e={media_bu_distributer:this.srcMediaData.mediaData.vendor,media_chromecast_selected:!!this.player.tech(!0).isCasting,media_embedding_url:document.referrer,media_player_display:"default",media_player_name:"pillarbox-web",media_player_version:this.playerVersion,media_url:this.srcMediaData.src},t=this.srcMediaData.mediaData.analyticsMetadata||{};window.tc_vars=Object.assign({},window.tc_vars,e,t)}heartBeat(){this.heartBeatIntervalId=setInterval(()=>{this.player.paused()||this.notify("pos")},3e4)}initCallbacks(){this.beforeunloadListener=this.beforeunload.bind(this),this.emptiedListener=this.emptied.bind(this),this.endedListener=this.ended.bind(this),this.loadstartListener=this.loadstart.bind(this),this.loadeddataListener=this.loadeddata.bind(this),this.playListener=this.play.bind(this),this.pauseListener=this.pause.bind(this),this.rateChangeListener=this.rateChange.bind(this),this.seekingListener=this.seeking.bind(this),this.timeUpdateListener=this.timeUpdate.bind(this),this.waitingListener=this.waiting.bind(this)}initListeners(){this.initCallbacks(),window.addEventListener("beforeunload",this.beforeunloadListener),this.player.on(hz,this.emptiedListener),this.player.on(hG,this.endedListener),this.player.on(hK,this.loadstartListener),this.player.on(hW,this.loadeddataListener),this.player.on(hY,this.playListener),this.player.on(hX,this.pauseListener),this.player.on(hQ,this.rateChangeListener),this.player.on(hJ,this.seekingListener),this.player.on(hZ,this.timeUpdateListener),this.player.on(h0,this.waitingListener),this.player.one("dispose",this.dispose.bind(this))}initScript(){let e="tc_script__11";if(!document.querySelector(`#${e}`)){let t=document.createElement("script"),i=this.tagCommanderScriptURL;t.defer=!0,t.id=e,t.src=i,t.type="text/javascript",t.onload=e=>{this.flush()},document.body.appendChild(t)}}isAudioTrackEnabled(){return!!this.getCurrentAudioTrack()}isMediaDvr(){let{trackingThreshold:e}=this.player.liveTracker.options();return!this.isMediaOnDemand()&&ethis.player.liveTracker.liveWindow()}isMediaOnDemand(){return Number.isFinite(this.player.duration())}isTextTrackEnabled(){return!!this.getCurrentTextTrack()}isTrackerDisabled(){return!this.srcMediaData||!this.srcMediaData.mediaData||(Array.isArray(this.srcMediaData.disableTrackers)?!!this.srcMediaData.disableTrackers.find(e=>e.toLowerCase()===h1.name.toLowerCase()):!!this.srcMediaData.disableTrackers)}loadstart(){this.destroy(),this.updateSrcMediaData(this.player.currentSource()),this.isTrackerDisabled()||(this.getInternalLabels(),this.reloadTagCommanderContainer(),this.notify("buffer_start"),this.hasStarted=!1)}loadeddata(){this.notify("init"),this.initialized=!0,this.notify("buffer_stop")}log(e,t,i="log"){this.debug()&&console[i](`SRGAnalytics:${e}`,t,window.tc_vars)}notify(e,t){if(this.isTrackerDisabled())return;try{this.flush()}catch(t){this.log(e,t,"error")}let i=Object.assign({},this.getEventLabels(e),t);this.log(e,i);try{window.tc_events_11?window.tc_events_11(this.player.el(),e,i):this.pendingQueue.push({action:e,labels:i})}catch(t){this.log(e,t,"error")}}static now(){return(Date.now()/1e3).toFixed(0)}play(){this.hasStarted||(this.hasStarted=!0),this.startPlaybackSession||this.isMediaOnDemand()||(this.startPlaybackSession=h1.now()),0===this.mediaSession&&(this.mediaSession=h1.now(),this.heartBeat(),this.uptime()),this.timeUpdate(),this.notify("play"),this.isSeeking&&(this.isSeeking=!1)}pause(){if(this.isMediaOnDemand()||(this.elapsedPlaybackTime=this.getElapsedPlayingTime(),this.startPlaybackSession=0),!this.player.seeking()&&!this.isMediaLive()&&this.player.currentTime(){this.player.paused()||this.isMediaOnDemand()||this.notify("uptime")};this.uptimeTimeoutId=setTimeout(()=>{e(),this.uptimeIntervalId=setInterval(()=>{e()},6e4)},3e4)}waiting(){if(!this.initialized||this.isWaiting)return;let e=()=>{this.isWaiting=!1,this.notify("buffer_stop")};this.isWaiting=!0,this.notify("buffer_start"),os.browser.IS_ANY_SAFARI?this.player.one(hZ,e):this.player.one(hY,e)}}class h2{findChapterByUrn(e){if(this.chapterList){let[t]=this.chapterList.filter(t=>t.urn===e);return t}}findMainSegment(){if(!this.segmentUrn)return;let[e]=this.getMainSegments().filter(e=>e.urn===this.segmentUrn);return e}findResourceListByUrn(e){let t=this.findChapterByUrn(e);if(t)return t.resourceList||[]}getChapters(){return this.chapterList}getFilteredExternalSubtitles(){let{subtitleList:e}=this.getMainChapter(),[{subtitleInformationList:t}={}]=this.getResourceList().filter(({subtitleInformationList:e})=>e);if(!e)return[];let i=e.filter(e=>"TTML"!==e.format);return e&&!t?i:i.filter(e=>!t.find(t=>t.locale===e.locale&&e.type===t.type))}getMainBlockReason(){let e=this.getMainChapter();if(!e)return;let{blockReason:t}=e;return!t&&new Datee.blockReason)}getMainChapter(){return this.mainChapter||(this.mainChapter=this.findChapterByUrn(this.chapterUrn)),!this.mainChapter&&this.chapterList&&this.chapterList.length>0&&([this.mainChapter]=this.chapterList),this.mainChapter}getMainChapterImageUrl(){let e=this.getMainChapter();if(e&&e.imageUrl)return e.imageUrl}getMainResources(){let e=this.getResourceList();if(e&&e.length)return e.map(e=>({analyticsData:this.getMergedAnalyticsData(e.analyticsData),analyticsMetadata:this.getMergedAnalyticsMetadata(e.analyticsMetadata),blockReason:this.getMainChapter().blockReason,blockedSegments:this.getMainBlockedSegments(),imageUrl:this.getMainChapterImageUrl(),chapters:this.getChapters(),drmList:e.drmList,dvr:e.dvr,eventData:this.getMainChapter().eventData,id:this.getMainChapter().id,imageCopyright:this.getMainChapter().imageCopyright,intervals:this.getMainTimeIntervals(),live:e.live,mediaType:this.getMainChapter().mediaType,mimeType:e.mimeType,presentation:e.presentation,quality:e.quality,streaming:e.streaming,streamOffset:e.streamOffset,subtitles:this.getFilteredExternalSubtitles(),title:this.getMainChapter().title,tokenType:e.tokenType,url:e.url,urn:this.chapterUrn,vendor:this.getMainChapter().vendor}))}getMainSegments(){let e=this.getMainChapter();return!this.mainSegments&&e&&e.segmentList&&(this.mainSegments=e.segmentList),this.mainSegments||[]}getMainTimeIntervals(){let{timeIntervalList:e=[]}=this.getMainChapter()||{};return e}getMainValidFromDate(){let e=this.getMainChapter();if(!e)return new Date(0);let{validFrom:t}=e;if(t)return new Date(t)}getMergedAnalyticsData(e){return hL(hL(hL({},this.analyticsData),this.getMainChapter().analyticsData),e)}getMergedAnalyticsMetadata(e){return hL(hL(hL({},this.analyticsMetadata),this.getMainChapter().analyticsMetadata),e)}getResourceList(){let{resourceList:e}=this.getMainChapter();return e||[]}}var h4="Wiedergabe",h8="Pause",h5="Erneut abspielen",h3="Dauer",h6="LIVE",h7="Geladen",h9="Status",ce="Vollbild",ct="Stumm schalten",ci="Ton einschalten",cr="Untertitel",cs="Untertitel",cn="Kapitel",ca="Schließen",co="Beschreibungen",cl="Schrift",cu="Weiß",cd="Schwarz",ch="Grün",cc="Blau",cp="Gelb",cm="Magenta",cg="Türkis",cf="Hintergrund",cy="Fenster",c_="Durchsichtig",cb="Undurchsichtig",cv="Kein",cT="Erhoben",cS="Gedrückt",cE="Uniform",cw="Zwanglos",cC="Schreibschrift",ck="Zurücksetzen",cD="Fertig",cI="Farbe",cx="Deckkraft",cA=Object.freeze({__proto__:null,Background:cf,Black:cd,Blue:cc,Captions:cs,Casual:cw,Chapters:cn,Close:ca,Color:cI,Cyan:cg,Depressed:cS,Descriptions:co,Done:cD,Duration:h3,Fullscreen:ce,Green:ch,LIVE:h6,Loaded:h7,Magenta:cm,Mute:ct,None:cv,Opacity:cx,Opaque:cb,Pause:h8,Play:h4,Progress:h9,Raised:cT,Red:"Rot",Replay:h5,Reset:ck,Script:cC,Subtitles:cr,Text:cl,Transparent:c_,Uniform:cE,Unmute:ci,White:cu,Window:cy,Yellow:cp,default:{Play:h4,Pause:h8,Replay:h5,"Current Time":"Aktueller Zeitpunkt",Duration:h3,"Remaining Time":"Verbleibende Zeit","Stream Type":"Streamtyp",LIVE:h6,Loaded:h7,Progress:h9,Fullscreen:ce,"Exit Fullscreen":"Vollbildmodus beenden",Mute:ct,Unmute:ci,"Playback Rate":"Wiedergabegeschwindigkeit",Subtitles:cr,"subtitles off":"Untertitel aus",Captions:cs,"captions off":"Untertitel aus",Chapters:cn,"You aborted the media playback":"Sie haben die Videowiedergabe abgebrochen.","A network error caused the media download to fail part-way.":"Der Videodownload ist aufgrund eines Netzwerkfehlers fehlgeschlagen.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Das Video konnte nicht geladen werden, da entweder ein Server- oder Netzwerkfehler auftrat oder das Format nicht unterstützt wird.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"Die Videowiedergabe wurde entweder wegen eines Problems mit einem beschädigten Video oder wegen verwendeten Funktionen, die vom Browser nicht unterstützt werden, abgebrochen.","No compatible source was found for this media.":"Für dieses Video wurde keine kompatible Quelle gefunden.","Play Video":"Video abspielen",Close:ca,"Modal Window":"Modales Fenster","This is a modal window":"Dies ist ein modales Fenster","This modal can be closed by pressing the Escape key or activating the close button.":'Durch Drücken der Esc-Taste bzw. Betätigung der Schaltfläche "Schließen" wird dieses modale Fenster geschlossen.',", opens captions settings dialog":", öffnet Einstellungen für Untertitel",", opens subtitles settings dialog":", öffnet Einstellungen für Untertitel",", selected":", ausgewählt","captions settings":"Untertiteleinstellungen","subtitles settings":"Untertiteleinstellungen","descriptions settings":"Einstellungen für Beschreibungen","Close Modal Dialog":"Modales Fenster schließen",Descriptions:co,"descriptions off":"Beschreibungen aus","The media is encrypted and we do not have the keys to decrypt it.":"Die Entschlüsselungsschlüssel für den verschlüsselten Medieninhalt sind nicht verfügbar.",", opens descriptions settings dialog":", öffnet Einstellungen für Beschreibungen","Audio Track":"Tonspur",Text:cl,White:cu,Black:cd,Red:"Rot",Green:ch,Blue:cc,Yellow:cp,Magenta:cm,Cyan:cg,Background:cf,Window:cy,Transparent:c_,"Semi-Transparent":"Halbdurchsichtig",Opaque:cb,"Font Size":"Schriftgröße","Text Edge Style":"Textkantenstil",None:cv,Raised:cT,Depressed:cS,Uniform:cE,"Drop shadow":"Schlagschatten","Font Family":"Schriftfamilie","Proportional Sans-Serif":"Proportionale Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportionale Serif","Monospace Serif":"Monospace Serif",Casual:cw,Script:cC,"Small Caps":"Small-Caps",Reset:ck,"restore all settings to the default values":"Alle Einstellungen auf die Standardwerte zurücksetzen",Done:cD,"Caption Settings Dialog":"Einstellungsdialog für Untertitel","Beginning of dialog window. Escape will cancel and close the window.":"Anfang des Dialogfensters. Esc bricht ab und schließt das Fenster.","End of dialog window.":"Ende des Dialogfensters.","Audio Player":"Audio-Player","Video Player":"Video-Player","Progress Bar":"Fortschrittsbalken","progress bar timing: currentTime={1} duration={2}":"{1} von {2}","Volume Level":"Lautstärke","{1} is loading.":"{1} wird geladen.","Seek to live, currently behind live":"Zur Live-Übertragung wechseln. Aktuell wird es nicht live abgespielt.","Seek to live, currently playing live":"Zur Live-Übertragung wechseln. Es wird aktuell live abgespielt.","Exit Picture-in-Picture":"Bild-im-Bild-Modus beenden","Picture-in-Picture":"Bild-im-Bild-Modus","No content":"Kein Inhalt",Color:cI,Opacity:cx,"Text Background":"Texthintergrund","Caption Area Background":"Hintergrund des Untertitelbereichs","Playing in Picture-in-Picture":"Wird im Bild-im-Bild-Modus wiedergegeben","Skip forward {1} seconds":"{1} Sekunden vorwärts","Skip backward {1} seconds":"{1} Sekunden zurück"}}),cP="Aus Gründen des Jugendschutzes steht dieser Inhalt nur zwischen 20:00 und 06:00 Uhr zur Verfügung.",cL="Aus Gründen des Jugendschutzes steht dieser Inhalt nur zwischen 23:00 und 05:00 Uhr zur Verfügung.",cO="Die Werbung wurde übersprungen.",cR="Dieser Inhalt ist nicht mehr verfügbar.",cM="Dieser Inhalt ist ausserhalb der Schweiz nicht verfügbar.",cN="Dieser Inhalt ist aus rechtlichen Gründen nicht verfügbar.",cU="Dieser Inhalt ist noch nicht verfügbar. Bitte probieren Sie es später noch einmal.",cB="Dieser Inhalt ist nicht verfügbar.",cF=Object.freeze({__proto__:null,AGERATING12:cP,AGERATING18:cL,COMMERCIAL:cO,ENDDATE:cR,GEOBLOCK:cM,LEGAL:cN,STARTDATE:cU,UNKNOWN:cB,default:{AGERATING12:cP,AGERATING18:cL,COMMERCIAL:cO,ENDDATE:cR,GEOBLOCK:cM,LEGAL:cN,STARTDATE:cU,UNKNOWN:cB}});os.addLanguage("de",hL(hL({},cA),cF));var cq="Play",cj="Pause",c$="Replay",cV="Duration",cH="LIVE",cz="Loaded",cG="Progress",cW="Fullscreen",cK="Mute",cX="Unmute",cY="Subtitles",cQ="Captions",cJ="Chapters",cZ="Descriptions",c0="Close",c1="Text",c2="White",c4="Black",c8="Green",c5="Blue",c3="Yellow",c6="Magenta",c7="Cyan",c9="Background",pe="Window",pt="Transparent",pi="Opaque",pr="None",ps="Raised",pn="Depressed",pa="Uniform",po="Casual",pl="Script",pu="Reset",pd="Done",ph="Color",pc="Opacity",pp=Object.freeze({__proto__:null,Background:c9,Black:c4,Blue:c5,Captions:cQ,Casual:po,Chapters:cJ,Close:c0,Color:ph,Cyan:c7,Depressed:pn,Descriptions:cZ,Done:pd,Duration:cV,Fullscreen:cW,Green:c8,LIVE:cH,Loaded:cz,Magenta:c6,Mute:cK,None:pr,Opacity:pc,Opaque:pi,Pause:cj,Play:cq,Progress:cG,Raised:ps,Red:"Red",Replay:c$,Reset:pu,Script:pl,Subtitles:cY,Text:c1,Transparent:pt,Uniform:pa,Unmute:cX,White:c2,Window:pe,Yellow:c3,default:{"Audio Player":"Audio Player","Video Player":"Video Player",Play:cq,Pause:cj,Replay:c$,"Current Time":"Current Time",Duration:cV,"Remaining Time":"Remaining Time","Stream Type":"Stream Type",LIVE:cH,"Seek to live, currently behind live":"Seek to live, currently behind live","Seek to live, currently playing live":"Seek to live, currently playing live",Loaded:cz,Progress:cG,"Progress Bar":"Progress Bar","progress bar timing: currentTime={1} duration={2}":"{1} of {2}",Fullscreen:cW,"Exit Fullscreen":"Exit Fullscreen",Mute:cK,Unmute:cX,"Playback Rate":"Playback Rate",Subtitles:cY,"subtitles off":"subtitles off",Captions:cQ,"captions off":"captions off",Chapters:cJ,Descriptions:cZ,"descriptions off":"descriptions off","Audio Track":"Audio Track","Volume Level":"Volume Level","You aborted the media playback":"You aborted the media playback","A network error caused the media download to fail part-way.":"A network error caused the media download to fail part-way.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"The media could not be loaded, either because the server or network failed or because the format is not supported.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.","No compatible source was found for this media.":"No compatible source was found for this media.","The media is encrypted and we do not have the keys to decrypt it.":"The media is encrypted and we do not have the keys to decrypt it.","Play Video":"Play Video",Close:c0,"Close Modal Dialog":"Close Modal Dialog","Modal Window":"Modal Window","This is a modal window":"This is a modal window","This modal can be closed by pressing the Escape key or activating the close button.":"This modal can be closed by pressing the Escape key or activating the close button.",", opens captions settings dialog":", opens captions settings dialog",", opens subtitles settings dialog":", opens subtitles settings dialog",", opens descriptions settings dialog":", opens descriptions settings dialog",", selected":", selected","captions settings":"captions settings","subtitles settings":"subtitles settings","descriptions settings":"descriptions settings",Text:c1,White:c2,Black:c4,Red:"Red",Green:c8,Blue:c5,Yellow:c3,Magenta:c6,Cyan:c7,Background:c9,Window:pe,Transparent:pt,"Semi-Transparent":"Semi-Transparent",Opaque:pi,"Font Size":"Font Size","Text Edge Style":"Text Edge Style",None:pr,Raised:ps,Depressed:pn,Uniform:pa,"Drop shadow":"Drop shadow","Font Family":"Font Family","Proportional Sans-Serif":"Proportional Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportional Serif","Monospace Serif":"Monospace Serif",Casual:po,Script:pl,"Small Caps":"Small Caps",Reset:pu,"restore all settings to the default values":"restore all settings to the default values",Done:pd,"Caption Settings Dialog":"Caption Settings Dialog","Beginning of dialog window. Escape will cancel and close the window.":"Beginning of dialog window. Escape will cancel and close the window.","End of dialog window.":"End of dialog window.","{1} is loading.":"{1} is loading.","Exit Picture-in-Picture":"Exit Picture-in-Picture","Picture-in-Picture":"Picture-in-Picture","No content":"No content",Color:ph,Opacity:pc,"Text Background":"Text Background","Caption Area Background":"Caption Area Background","Playing in Picture-in-Picture":"Playing in Picture-in-Picture","Skip backward {1} seconds":"Skip backward {1} seconds","Skip forward {1} seconds":"Skip forward {1} seconds"}}),pm="To protect children this content is only available between 8PM and 6AM.",pg="To protect children this content is only available between 10PM and 5AM.",pf="This commercial content is not available.",py="This content is not available anymore.",p_="This content is not available outside Switzerland.",pb="This content is not available due to legal restrictions.",pv="This content is not available yet.",pT="This content is not available.",pS=Object.freeze({__proto__:null,AGERATING12:pm,AGERATING18:pg,COMMERCIAL:pf,ENDDATE:py,GEOBLOCK:p_,LEGAL:pb,STARTDATE:pv,UNKNOWN:pT,default:{AGERATING12:pm,AGERATING18:pg,COMMERCIAL:pf,ENDDATE:py,GEOBLOCK:p_,LEGAL:pb,STARTDATE:pv,UNKNOWN:pT}});os.addLanguage("en",hL(hL({},pp),pS));var pE="Lecture",pw="Pause",pC="Revoir",pk="Durée",pD="EN DIRECT",pI="Chargé",px="Progression",pA="Plein écran",pP="Mettre en sourdine",pL="Activer le son",pO="Sous-titres",pR="Sous-titres transcrits",pM="Chapitres",pN="Descriptions",pU="Fermer",pB="Texte",pF="Blanc",pq="Noir",pj="Rouge",p$="Vert",pV="Bleu",pH="Jaune",pz="Magenta",pG="Cyan",pW="Arrière-plan",pK="Fenêtre",pX="Transparent",pY="Opaque",pQ="Aucun",pJ="Élevé",pZ="Enfoncé",p0="Uniforme",p1="Manuscrite",p2="Scripte",p4="Réinitialiser",p8="Terminé",p5="Couleur",p3="Opacité",p6=Object.freeze({__proto__:null,Background:pW,Black:pq,Blue:pV,Captions:pR,Casual:p1,Chapters:pM,Close:pU,Color:p5,Cyan:pG,Depressed:pZ,Descriptions:pN,Done:p8,Duration:pk,Fullscreen:pA,Green:p$,LIVE:pD,Loaded:pI,Magenta:pz,Mute:pP,None:pQ,Opacity:p3,Opaque:pY,Pause:pw,Play:pE,Progress:px,Raised:pJ,Red:pj,Replay:pC,Reset:p4,Script:p2,Subtitles:pO,Text:pB,Transparent:pX,Uniform:p0,Unmute:pL,White:pF,Window:pK,Yellow:pH,default:{"Audio Player":"Lecteur audio","Video Player":"Lecteur vidéo",Play:pE,Pause:pw,Replay:pC,"Current Time":"Temps actuel",Duration:pk,"Remaining Time":"Temps restant","Stream Type":"Type de flux",LIVE:pD,"Seek to live, currently behind live":"Rechercher le direct, actuellement après le direct","Seek to live, currently playing live":"Rechercher le direct, le direct actuellement en cours de lecture",Loaded:pI,Progress:px,"Progress Bar":"Barre de progression","progress bar timing: currentTime={1} duration={2}":"{1} de {2}",Fullscreen:pA,"Exit Fullscreen":"Fenêtré",Mute:pP,Unmute:pL,"Playback Rate":"Vitesse de lecture",Subtitles:pO,"subtitles off":"Sous-titres désactivés",Captions:pR,"captions off":"Sous-titres transcrits désactivés",Chapters:pM,Descriptions:pN,"descriptions off":"descriptions désactivées","Audio Track":"Piste audio","Volume Level":"Niveau de volume","You aborted the media playback":"Vous avez interrompu la lecture de la vidéo.","A network error caused the media download to fail part-way.":"Une erreur de réseau a interrompu le téléchargement de la vidéo.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Cette vidéo n'a pas pu être chargée, soit parce que le serveur ou le réseau a échoué ou parce que le format n'est pas reconnu.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"La lecture de la vidéo a été interrompue à cause d'un problème de corruption ou parce que la vidéo utilise des fonctionnalités non prises en charge par votre navigateur.","No compatible source was found for this media.":"Aucune source compatible n'a été trouvée pour cette vidéo.","The media is encrypted and we do not have the keys to decrypt it.":"Le média est chiffré et nous n'avons pas les clés pour le déchiffrer.","Play Video":"Lire la vidéo",Close:pU,"Close Modal Dialog":"Fermer la boîte de dialogue modale","Modal Window":"Fenêtre modale","This is a modal window":"Ceci est une fenêtre modale","This modal can be closed by pressing the Escape key or activating the close button.":"Ce modal peut être fermé en appuyant sur la touche Échap ou activer le bouton de fermeture.",", opens captions settings dialog":", ouvrir les paramètres des sous-titres transcrits",", opens subtitles settings dialog":", ouvrir les paramètres des sous-titres",", opens descriptions settings dialog":", ouvrir les paramètres des descriptions",", selected":", sélectionné","captions settings":"Paramètres des sous-titres transcrits","subtitles settings":"Paramètres des sous-titres","descriptions settings":"Paramètres des descriptions",Text:pB,White:pF,Black:pq,Red:pj,Green:p$,Blue:pV,Yellow:pH,Magenta:pz,Cyan:pG,Background:pW,Window:pK,Transparent:pX,"Semi-Transparent":"Semi-transparent",Opaque:pY,"Font Size":"Taille des caractères","Text Edge Style":"Style des contours du texte",None:pQ,Raised:pJ,Depressed:pZ,Uniform:p0,"Drop shadow":"Ombre portée","Font Family":"Famille de polices","Proportional Sans-Serif":"Polices à chasse variable sans empattement (Proportional Sans-Serif)","Monospace Sans-Serif":"Polices à chasse fixe sans empattement (Monospace Sans-Serif)","Proportional Serif":"Polices à chasse variable avec empattement (Proportional Serif)","Monospace Serif":"Polices à chasse fixe avec empattement (Monospace Serif)",Casual:p1,Script:p2,"Small Caps":"Petites capitales",Reset:p4,"restore all settings to the default values":"Restaurer tous les paramètres aux valeurs par défaut",Done:p8,"Caption Settings Dialog":"Boîte de dialogue des paramètres des sous-titres transcrits","Beginning of dialog window. Escape will cancel and close the window.":"Début de la fenêtre de dialogue. La touche d'échappement annulera et fermera la fenêtre.","End of dialog window.":"Fin de la fenêtre de dialogue.","Exit Picture-in-Picture":"Quitter le mode image dans l'image","Picture-in-Picture":"Image dans l'image","{1} is loading.":"{1} en cours de chargement.","No content":"Aucun contenu",Color:p5,Opacity:p3,"Text Background":"Arrière-plan du texte","Caption Area Background":"Arrière-plan de la zone de sous-titre","Skip backward {1} seconds":"Reculer de {1} secondes","Skip forward {1} seconds":"Avancer de {1} secondes"}}),p7="Pour protéger les enfants, ce contenu est accessible entre 20h et 6h.",p9="Pour protéger les enfants, ce contenu est accessible entre 23h et 5h.",me="Ce contenu n'est actuellement pas disponible.",mt="Ce contenu n'est plus disponible.",mi="La RTS ne dispose pas des droits de diffusion en dehors de la Suisse.",mr="Pour des raisons juridiques, ce contenu n'est pas disponible.",ms="Ce contenu n'est pas encore disponible. Veuillez réessayer plus tard.",mn="Ce contenu n'est actuellement pas disponible.",ma=Object.freeze({__proto__:null,AGERATING12:p7,AGERATING18:p9,COMMERCIAL:me,ENDDATE:mt,GEOBLOCK:mi,LEGAL:mr,STARTDATE:ms,UNKNOWN:mn,default:{AGERATING12:p7,AGERATING18:p9,COMMERCIAL:me,ENDDATE:mt,GEOBLOCK:mi,LEGAL:mr,STARTDATE:ms,UNKNOWN:mn}});os.addLanguage("fr",hL(hL({},p6),ma));var mo="Play",ml="Pausa",mu="Replay",md="Durata",mh="LIVE",mc="Caricato",mp="Stato",mm="Schermo intero",mg="Disattiva l’audio",mf="Attiva l’audio",my="Sottotitoli",m_="Sottotitoli non udenti",mb="Capitolo",mv="Descrizioni",mT="Chiudi",mS="Testo",mE="Bianco",mw="Nero",mC="Rosso",mk="Verde",mD="Giallo",mI="Magenta",mx="Ciano",mA="Sfondo",mP="Finestra",mL="Trasparente",mO="Opaco",mR="Nessuno",mM="Uniforme",mN="Reinizializza",mU="Fatto",mB="Colore",mF="Opacità",mq=Object.freeze({__proto__:null,Background:mA,Black:mw,Blue:"Blu",Captions:m_,Chapters:mb,Close:mT,Color:mB,Cyan:mx,Descriptions:mv,Done:mU,Duration:md,Fullscreen:mm,Green:mk,LIVE:mh,Loaded:mc,Magenta:mI,Mute:mg,None:mR,Opacity:mF,Opaque:mO,Pause:ml,Play:mo,Progress:mp,Red:mC,Replay:mu,Reset:mN,Subtitles:my,Text:mS,Transparent:mL,Uniform:mM,Unmute:mf,White:mE,Window:mP,Yellow:mD,default:{"Audio Player":"Lettore audio","Video Player":"Lettore video",Play:mo,Pause:ml,Replay:mu,"Current Time":"Orario attuale",Duration:md,"Remaining Time":"Tempo rimanente","Stream Type":"Tipo di streaming",LIVE:mh,Loaded:mc,Progress:mp,"Progress Bar":"Barra di avanzamento","progress bar timing: currentTime={1} duration={2}":"{1} di {2}",Fullscreen:mm,"Exit Fullscreen":"Chiudi Schermo intero",Mute:mg,Unmute:mf,"Playback Rate":"Velocità di riproduzione",Subtitles:my,"subtitles off":"Senza sottotitoli",Captions:m_,"captions off":"Senza sottotitoli non udenti",Chapters:mb,Descriptions:mv,"descriptions off":"Descrizioni disattivate","Audio Track":"Traccia audio","Volume Level":"Livello del volume","You aborted the media playback":"La riproduzione del contenuto multimediale è stata interrotta.","A network error caused the media download to fail part-way.":"Il download del contenuto multimediale è stato interrotto a causa di un problema rete.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Il contenuto multimediale non può essere caricato a causa di un errore nel server o nella rete o perché il formato non viene supportato.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"La riproduzione del contenuto multimediale è stata interrotta a causa di un file danneggiato o per l’utilizzo di impostazioni non supportate dal browser.","No compatible source was found for this media.":"Non ci sono fonti compatibili per questo contenuto multimediale.","The media is encrypted and we do not have the keys to decrypt it.":"Il contenuto multimediale è criptato e non disponiamo delle chiavi per decifrarlo.","Play Video":"Riproduci il video",Close:mT,"Close Modal Dialog":"Chiudi la finestra di dialogo","Modal Window":"Finestra di dialogo","This is a modal window":"Questa è una finestra di dialogo","This modal can be closed by pressing the Escape key or activating the close button.":"Questa finestra di dialogo può essere chiusa premendo sul tasto Esc o attivando il pulsante di chiusura.",", opens captions settings dialog":", aprire i parametri della trascrizione dei sottotitoli",", opens subtitles settings dialog":", aprire i parametri dei sottotitoli",", opens descriptions settings dialog":", aprire i parametri delle descrizioni",", selected":", selezionato","captions settings":"Parametri sottotitoli non udenti","subtitles settings":"Parametri sottotitoli","descriptions settings":"Parametri descrizioni",Text:mS,White:mE,Black:mw,Red:mC,Green:mk,Blue:"Blu",Yellow:mD,Magenta:mI,Cyan:mx,Background:mA,Window:mP,Transparent:mL,"Semi-Transparent":"Semi-Trasparente",Opaque:mO,"Font Size":"Dimensione dei caratteri","Text Edge Style":"Stile dei bordi del testo",None:mR,Uniform:mM,"Drop shadow":"Ombra","Font Family":"Carattere","Proportional Sans-Serif":"Sans-Serif proporzionale","Monospace Sans-Serif":"Sans-Serif monospaziato","Proportional Serif":"Serif proporzionale","Monospace Serif":"Serif monospaziato","Small Caps":"Maiuscoletto",Reset:mN,"restore all settings to the default values":"Ripristina i valori predefiniti per tutti i parametri",Done:mU,"Caption Settings Dialog":"Finestra di dialogo dei parametri della trascrizione dei sottotitoli","Beginning of dialog window. Escape will cancel and close the window.":"Inizio della finestra di dialogo. Il tasto Esc annullerà l’operazione e chiuderà la finestra.","End of dialog window.":"Fine della finestra di dialogo.","{1} is loading.":"{1} in fase di caricamento.","Exit Picture-in-Picture":"Esci dalla modalità Picture-in-Picture","Picture-in-Picture":"Picture-in-Picture",Color:mB,Opacity:mF,"Text Background":"Sfondo testo","Caption Area Background":"Sfondo area sottotitoli","Skip forward {1} seconds":"Avanti {1} secondi","Skip backward {1} seconds":"Indietro {1} secondi"}}),mj="Per proteggere i bambini, questo media è disponibile solo fra le 20 e le 6.",m$="Per proteggere i bambini, questo media è disponibile solo fra le 23 le 5.",mV="Questo contenuto commerciale non è disponibile.",mH="Questo media non è più disponibile.",mz="Questo media non è disponibile fuori dalla Svizzera.",mG="Il contenuto non è fruibile a causa di restrizioni legali.",mW="Il contenuto non è ancora disponibile. Per cortesia prova più tardi.",mK="Questo media non è disponibile.",mX=Object.freeze({__proto__:null,AGERATING12:mj,AGERATING18:m$,COMMERCIAL:mV,ENDDATE:mH,GEOBLOCK:mz,LEGAL:mG,STARTDATE:mW,UNKNOWN:mK,default:{AGERATING12:mj,AGERATING18:m$,COMMERCIAL:mV,ENDDATE:mH,GEOBLOCK:mz,LEGAL:mG,STARTDATE:mW,UNKNOWN:mK}});os.addLanguage("it",hL(hL({},mq),mX));var mY="Laschar ir",mQ="Pausa",mJ="Mussar danovamain",mZ="Durada",m0="LIVE",m1="Chargià",m2="Progress",m4="Entir visur",m8="Senza tun",m5="Cun tun",m3="Suttitels",m6="Suttitels",m7="Chapitels",m9="Descripziuns",ge="Serrar",gt="Text",gi="Nair",gr="Cotschn",gs="Verd",gn="Blau",ga="Mellen",go="Magenta",gl="Cyan",gu="Fund",gd="Fanestra",gh="Transparent",gc="Betg transparent",gp="Nagin",gm="Auzà",gg="Sbassà",gf="Uniform",gy="Sumbriva",g_="Casual",gb="Script",gv="Da nov",gT="Fatg",gS="Per proteger uffants, è quest cuntegn disponibel mo tranter las 20.00 e las 06.00.",gE="Per proteger uffants, è quest cuntegn disponibel mo tranter las 23.00 e las 05.00.",gw="Quest medium commerzial n'è betg disponibel.",gC="Quest cuntegn n'è betg pli disponibel.",gk="Quest cuntegn n'è betg disponibel ordaifer la Svizra.",gD="Quest cuntegn n'è betg disponibel perquai ch'el è scadì.",gI="Quest cuntegn n'è betg anc disponibel. Empruvai pli tard.",gx="Quest cuntegn n'è betg disponibel.",gA=Object.freeze({__proto__:null,AGERATING12:gS,AGERATING18:gE,Background:gu,Black:gi,Blue:gn,COMMERCIAL:gw,Captions:m6,Casual:g_,Chapters:m7,Close:ge,Cyan:gl,Depressed:gg,Descriptions:m9,Done:gT,Dropshadow:gy,Duration:mZ,ENDDATE:gC,Fullscreen:m4,GEOBLOCK:gk,Green:gs,LEGAL:gD,LIVE:m0,Loaded:m1,Magenta:go,Mute:m8,None:gp,Opaque:gc,Pause:mQ,Play:mY,Progress:m2,Raised:gm,Red:gr,Replay:mJ,Reset:gv,STARTDATE:gI,Script:gb,Subtitles:m3,Text:gt,Transparent:gh,UNKNOWN:gx,Uniform:gf,Unmute:m5,White:"Alv",Window:gd,Yellow:ga,default:{"Audio Player":"Audio-Player","Video Player":"Video-Player",Play:mY,Pause:mQ,Replay:mJ,"Current Time":"Temp actual",Duration:mZ,"Remaining Time":"Temp restant","Stream Type":"Tip dal stream",LIVE:m0,Loaded:m1,Progress:m2,"Progress Bar":"Bar da progessiun","progress bar timing: currentTime={1} duration={2}":"{1} da {2}",Fullscreen:m4,"Non-Fullscreen":"Betg entir visur",Mute:m8,Unmute:m5,"Playback Rate":"Tempo ",Subtitles:m3,"subtitles off":"senza suttitels",Captions:m6,"captions off":"senza suttitels",Chapters:m7,Descriptions:m9,"descriptions off":"senza descripziuns","Audio Track":"Piese audio","Volume Level":"Nivel dal volumen","You aborted the media playback":"Vus avais interrut il vdieo","A network error caused the media download to fail part-way.":"In sbagl en la rait ha impedì il download","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Il video n'è betg chargià - ubain per in sbagl da server / da la rait, ubain ch'il format n'è betg cumpatibel.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"Il video è interrut: Ubain ch'il video è donnegià, ubain che funcziuns n'èn betg cumpatiblas.","No compatible source was found for this media.":"Chattà nagina funtauna cumpatibla per quest video.","The media is encrypted and we do not have the keys to decrypt it.":"Il video è codifitgà da moda nunenconuschenta.","Play Video":"Aviar video",Close:ge,"Close Modal Dialog":"Serrar la fanestra modala","Modal Window":"Fanestra modala","This is a modal window":"Quai è ina fanestra modala","This modal can be closed by pressing the Escape key or activating the close button.":'Questa fanestra modala pudais serrar cun la tasta "Escape" ubain cun il buttun.',", opens captions settings dialog":", avra opziuns per ils suttitels",", opens subtitles settings dialog":", avra opziuns per ils suttitels",", opens descriptions settings dialog":", avra opziuns per la descripziun",", selected":", selecziunà","captions settings":"opziuns per ils suttitels","subtitles settings":"opziuns per ils suttitels","descriptions settings":"opziuns per la descripziun",Text:gt,White:"Alv",Black:gi,Red:gr,Green:gs,Blue:gn,Yellow:ga,Magenta:go,Cyan:gl,Background:gu,Window:gd,Transparent:gh,"Semi-Transparent":"Mez transparent",Opaque:gc,"Font Size":"Grandezza dal text","Text Edge Style":"Stil dal text",None:gp,Raised:gm,Depressed:gg,Uniform:gf,Dropshadow:gy,"Font Family":"Scrittira","Proportional Sans-Serif":"Proportionale Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportionale Serif","Monospace Serif":"Monospace Serif",Casual:g_,Script:gb,"Small Caps":"Bustabs pitschens",Reset:gv,"restore all settings to the default values":"Enavos tar las opziuns da standard",Done:gT,"Caption Settings Dialog":"Opziuns per suttitels","Beginning of dialog window. Escape will cancel and close the window.":"Entschatta da la fanestra da dialog. Escape stizza e serra la fanestra.","End of dialog window.":"Fin da la fanestra da dialog.",AGERATING12:gS,AGERATING18:gE,COMMERCIAL:gw,ENDDATE:gC,GEOBLOCK:gk,LEGAL:gD,STARTDATE:gI,UNKNOWN:gx}});os.addLanguage("rm",hL({},gA));const gP=["url","mimeType","keySystems"],gL=["src"];class gO{static addBlockedSegments(e,t=[]){let i="srgssr-blocked-segments",r=e.textTracks().getTrackById(i);if(r&&e.textTracks().removeTrack(r),!Array.isArray(t)||!t.length)return;let s=t.filter(e=>e.blockReason);s.length&&gO.createTextTrack(e,i).then(t=>{s.forEach(e=>{gO.addTextTrackCue(t,e)}),e.textTracks().addTrack(t)})}static addRemoteTextTracks(e,t=[]){Array.isArray(t)&&t.forEach(({type:t,language:i,locale:r,url:s})=>{e.addRemoteTextTrack({kind:"SDH"===t?"captions":"subtitles",label:i,language:r,src:s})})}static addTextTrackCue(e,t){let i=(Number.isFinite(t.markIn)?t.markIn:t.fullLengthMarkIn)/1e3,r=(Number.isFinite(t.markOut)?t.markOut:t.fullLengthMarkOut)/1e3;e.addCue(new VTTCue(i,r,JSON.stringify(t)))}static addTextTracks(e,{mediaData:t}){gO.addRemoteTextTracks(e,t.subtitles),gO.addChapters(e,t.urn,t.chapters),gO.addBlockedSegments(e,t.blockedSegments),gO.addIntervals(e,t.intervals)}static addChapters(e,t,i=[]){let r="srgssr-chapters",s=e.textTracks().getTrackById(r);s&&e.textTracks().removeTrack(s),Array.isArray(i)&&i.length&&gO.createTextTrack(e,r).then(r=>{i.forEach(e=>{t===e.fullLengthUrn&&gO.addTextTrackCue(r,e)}),e.textTracks().addTrack(r)})}static addIntervals(e,t=[]){let i="srgssr-intervals",r=e.textTracks().getTrackById(i);r&&e.textTracks().removeTrack(r),Array.isArray(t)&&t.length&&gO.createTextTrack(e,i).then(i=>{t.forEach(e=>{gO.addTextTrackCue(i,e)}),e.textTracks().addTrack(i)})}static blockingReason(e,t){if(!t.mediaData.blockReason)return;let i=e.localize(t.mediaData.blockReason);return gO.error(e,{code:MediaError.MEDIA_ERR_ABORTED,message:i,metadata:{errorType:t.mediaData.blockReason,src:t}}),!0}static composeAkamaiResources(e=[]){return hR(function*(){return hH.hasToken(e)?hH.tokenizeSources(e):Promise.resolve(e)})()}static composeKeySystemsResources(e=[]){return hj.hasDrm(e),e.map(e=>hL(hL({},e),hj.buildKeySystems(e.drmList)))}static composeMainResources(e){return gO.composeAkamaiResources(gO.composeKeySystemsResources(gO.filterIncompatibleResources(e.getMainResources())))}static composeSrcMediaData({mediaData:e,disableTrackers:t},i){let r=os.obj.merge(i,e),{url:s,mimeType:n,keySystems:a}=r;return{src:s,type:n,keySystems:a,disableTrackers:t,mediaData:hM(r,gP)}}static createTextTrack(e,t){return new Promise(i=>{setTimeout(()=>{i(new os.TextTrack({id:t,kind:"metadata",label:t,tech:e.tech(!0)}))},100)})}static cuechangeEventProxy(e){e.textTracks().on("addtrack",({track:t})=>{["srgssr-chapters","srgssr-intervals"].includes(t.id)&&t.on("cuechange",()=>{let[i]=Array.from(t.activeCues),r=t.id.includes("srgssr-chapters")?"srgssr/chapter":"srgssr/interval";e.trigger({type:r,data:i})})})}static dataProvider(e){if(!e.options().srgOptions.dataProvider){let{dataProviderHost:t,dataProviderUrlHandler:i}=e.options().srgOptions,r=new hU(t).handleRequest(i);e.options({srgOptions:{dataProvider:r}})}return e.options().srgOptions.dataProvider}static dataProviderError(e,t){if(!t)return;let i=t.statusText?t.statusText:t.message;return gO.error(e,{code:0,message:e.localize("UNKNOWN"),metadata:{errorType:"UNKNOWN",urn:e.src(),status:t.status,statusText:i,url:t.url}}),!0}static error(e,{code:t,message:i,metadata:r}){e.error(null),e.error({code:t,message:i,metadata:r})}static filterIncompatibleResources(e=[]){return e.filter(e=>!["RTMP","HDS"].includes(e.streaming))}static getBlockedSegment(e){let t=e.textTracks().getTrackById("srgssr-blocked-segments");if(!t)return;let[i]=Array.from(t.activeCues);return i}static getBlockedSegmentByTime(e,t){let i=gO.getBlockedSegment(e);if(i)return t>=i.startTime&&te===t)||e[0]}static getSrcMediaObj(e,t){return hR(function*(){let{src:i}=t,r=hM(t,gL),s=yield gO.getMediaComposition(i,gO.dataProvider(e)),n=yield gO.composeMainResources(s),a=gO.getMediaData(n);return gO.composeSrcMediaData(r,a)})()}static handleCurrentTime(e,t){let i=gO.getBlockedSegmentByTime(e,t);if(!i||!Number.isFinite(i.endTime))return t;let r=i.endTime+.1;return e.trigger({type:"srgssr/blocked-segment",data:i}),e.currentTime(r),r}static handleSetCurrentTime(e,t){let{endTime:i}=gO.getBlockedSegmentByTime(e,t)||{};return Number.isFinite(i)?i:t}static handleSetSource(e,t,i){return hR(function*(){try{let r=yield gO.getSrcMediaObj(e,t);if(gO.srgAnalytics(e),gO.updateTitleBar(e,r),gO.updatePoster(e,r),gO.blockingReason(e,r))return;return gO.addTextTracks(e,r),i(null,r)}catch(t){if(gO.dataProviderError(e,t))return;return i(t)}})()}static srgAnalytics(e){if(!1!==e.options().trackers.srgAnalytics&&!e.options().trackers.srgAnalytics){let t=new h1(e,{debug:e.debug(),playerVersion:os.VERSION.pillarbox,tagCommanderScriptURL:e.options().srgOptions.tagCommanderScriptURL});e.options({trackers:{srgAnalytics:t}})}}static updatePoster(e,t,i=hF){e.poster(i.scale({url:t.mediaData.imageUrl}))}static updateTitleBar(e,t){e.titleBar&&e.titleBar.update({title:t.mediaData.vendor,description:t.mediaData.title})}static middleware(e){var t;return gO.cuechangeEventProxy(e),{currentTime:t=>gO.handleCurrentTime(e,t),setCurrentTime:t=>gO.handleSetCurrentTime(e,t),setSource:(t=hR(function*(t,i){return gO.handleSetSource(e,t,i)}),function(e,i){return t.apply(this,arguments)})}}}os.use("srgssr/urn",gO.middleware),os.options.srgOptions={dataProvider:void 0,dataProviderHost:void 0,dataProviderUrlHandler:void 0,tagCommanderScriptURL:void 0};const gR=os.getComponent("Button");os.registerComponent("SkipButton",class extends gR{activeInterval;constructor(e,t){super(e,t),this.addClass("pbw-skip-button","vjs-hidden","vjs-visible-text"),this.player().on("srgssr/interval",({data:e})=>this.handleTimeIntervalChange(e))}handleClick(e){super.handleClick(e),this.player().currentTime(this.activeInterval.endTime)}handleTimeIntervalChange(e){if(this.activeInterval=e,!this.activeInterval){this.hide();return}let t="OPENING_CREDITS"===JSON.parse(e.text).type?"Skip intro":"Skip credits";this.controlText(this.localize(t)),this.activeInterval=e,this.show()}}),os.addLanguage("en",{"Skip credits":"Skip credits","Skip intro":"Skip intro"}),os.addLanguage("fr",{"Skip credits":"Passer","Skip intro":"Passer l’intro"}),os.addLanguage("de",{"Skip credits":"Abspann überspringen","Skip intro":"Intro überspringen"}),os.addLanguage("it",{"Skip credits":"Salta i credits","Skip intro":"Salta l'intro"}),os.addLanguage("rm",{"Skip credits":"Sursiglir credentials","Skip intro":"Sursiglir intro"});const gM=os.getPlugin("plugin");os.registerPlugin("skipButtonPlugin",class extends gM{constructor(e,t){super(e,t),this.player.addChild("SkipButton")}});const gN=new URLSearchParams(location.search),gU=gN.has("debug"),gB=gN.get("ilHost")||void 0,gF=gN.get("language"),gq=gN.get("urn")||"urn:rts:video:14683290";window.player=os("player",{debug:gU,language:gF,srgOptions:{dataProviderHost:gB},plugins:{skipButtonPlugin:!0}}),player.src({src:gq,type:"srgssr/urn"}),window.player=player,window.pillarbox=os; \ No newline at end of file +`,a++,n=l}),this.end_=n,this.storage_=r,this.diagnostics_=s}calculateBaseTime_(e,t){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:t:0}isReliablePlaylist_(e,t){return null!=e&&Array.isArray(t)&&t.length}}class du extends dl{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t){if(!this.storage_.size){let t=this.parent_.getSyncInfoForMediaSequence(e);return t?t.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t)}}const dd=[{name:"VOD",run:(e,t,i,r,s)=>i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(e,t,i,r,s,n)=>{let a=e.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;let o=a.getSyncInfoForTime(s);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(e,t,i,r,s)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let n=null,a=null,o=oD(t);s=s||0;for(let i=0;i{let n=null,a=null;s=s||0;let o=oD(t);for(let e=0;e=e)&&(a=e,n={time:d,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return n}},{name:"Discontinuity",run:(e,t,i,r,s)=>{let n=null;if(s=s||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let r=0;r=e)&&(i=e,n={time:l.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,r,s)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class dh extends os.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};let t=new dl,i=new du(t),r=new du(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:r},this.logger_=oh("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,r,s){if(t!==1/0)return dd.find(({name:e})=>"VOD"===e).run(this,e,t);let n=this.runStrategies_(e,t,i,r,s);if(!n.length)return null;for(let t of n){let{syncPoint:i,strategy:s}=t,{segmentIndex:n,time:a}=i;if(n<0)continue;let o=a+e.segments[n].duration;if(this.logger_(`Strategy: ${s}. Current time: ${r}. selected segment: ${n}. Time: [${a} -> ${o}]}`),r>=a&&r0&&(r.time*=-1),Math.abs(r.time+oM({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,r,s){let n=[];for(let a=0;a86400){os.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let r=i-1;r>=0;r--){let i=e.segments[r];if(i&&void 0!==i.start){t.syncInfo={mediaSequence:e.mediaSequence+r,time:i.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){let t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){let i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),r=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));let s=r.dateTimeObject;r.discontinuity&&t&&s&&(this.timelineToDatetimeMappings[r.timeline]=-(s.getTime()/1e3))}timestampOffsetForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){let r,s;let n=e.segment,a=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${o.time}] [mapping: ${o.mapping}]`)),r=e.startOfSegment,s=t.end+o.mapping;else{if(!o)return!1;r=t.start+o.mapping,s=t.end+o.mapping}return a&&(a.start=r,a.end=s),(!n.start||ro){let r;r=a<0?i.start-oM({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:s}):i.end+oM({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[n]={time:r,accuracy:o}}}}dispose(){this.trigger("dispose"),this.off()}}class dc extends os.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var dp=lF(lq(lj(function(){var e,t,i,r=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t){if(2==arguments.length)for(var i=t.length,r=0;r>7)*283)^e]=e;for(t=i=0;!h[t];t^=r||1,i=m[i]||1)for(e=0,n=(n=i^i<<1^i<<2^i<<3^i<<4)>>8^255&n^99,h[t]=n,c[n]=t,o=16843009*p[s=p[r=p[t]]]^65537*s^257*r^16843008*t,a=257*p[n]^16843008*n;e<4;e++)u[e][t]=a=a<<24^a>>>8,d[e][n]=o=o<<24^o>>>8;for(e=0;e<5;e++)u[e]=u[e].slice(0),d[e]=d[e].slice(0);return l},n=null;class a{constructor(e){let t,i,r;n||(n=s()),this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];let a=this._tables[0][4],o=this._tables[1],l=e.length,u=1;if(4!==l&&6!==l&&8!==l)throw Error("Invalid aes key size");let d=e.slice(0),h=[];for(this._key=[d,h],t=l;t<4*l+28;t++)r=d[t-1],(t%l==0||8===l&&t%l==4)&&(r=a[r>>>24]<<24^a[r>>16&255]<<16^a[r>>8&255]<<8^a[255&r],t%l==0&&(r=r<<8^r>>>24^u<<24,u=u<<1^(u>>7)*283)),d[t]=d[t-l]^r;for(i=0;t;i++,t--)r=d[3&i?t:t-4],t<=4||i<4?h[i]=r:h[i]=o[0][a[r>>>24]]^o[1][a[r>>16&255]]^o[2][a[r>>8&255]]^o[3][a[255&r]]}decrypt(e,t,i,r,s,n){let a,o,l,u;let d=this._key[1],h=e^d[0],c=r^d[1],p=i^d[2],m=t^d[3],g=d.length/4-2,f=4,y=this._tables[1],_=y[0],b=y[1],v=y[2],T=y[3],S=y[4];for(u=0;u>>24]^b[c>>16&255]^v[p>>8&255]^T[255&m]^d[f],o=_[c>>>24]^b[p>>16&255]^v[m>>8&255]^T[255&h]^d[f+1],l=_[p>>>24]^b[m>>16&255]^v[h>>8&255]^T[255&c]^d[f+2],m=_[m>>>24]^b[h>>16&255]^v[c>>8&255]^T[255&p]^d[f+3],f+=4,h=a,c=o,p=l;for(u=0;u<4;u++)s[(3&-u)+n]=S[h>>>24]<<24^S[c>>16&255]<<16^S[p>>8&255]<<8^S[255&m]^d[f++],a=h,h=c,c=p,p=m,m=a}}class o extends r{constructor(){super(r),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}let l=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},u=function(e,t,i){let r,s,n,o,u,d,h,c,p;let m=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),g=new a(Array.prototype.slice.call(t)),f=new Uint8Array(e.byteLength),y=new Int32Array(f.buffer);for(p=0,r=i[0],s=i[1],n=i[2],o=i[3];p{let r=e[i];("function"===ArrayBuffer.isView?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer)?t[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[i]=r}),t};self.onmessage=function(e){let t=e.data;new d(new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4),function(e,i){self.postMessage(p({source:t.source,decrypted:i}),[i.buffer])})}})));const dm=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},dg=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},df=(e,t)=>{t.activePlaylistLoader=e,e.load()},dy=(e,t)=>()=>{let{segmentLoaders:{[e]:i,main:r},mediaTypes:{[e]:s}}=t,n=s.activeTrack(),a=s.getActiveGroup(),o=s.activePlaylistLoader,l=s.lastGroup_;if((!a||!l||a.id!==l.id)&&(s.lastGroup_=a,s.lastTrack_=n,dg(i,s),a&&!a.isMainPlaylist)){if(!a.playlistLoader){o&&r.resetEverything();return}i.resyncLoader(),df(a.playlistLoader,s)}},d_=(e,t)=>()=>{let{segmentLoaders:{[e]:i},mediaTypes:{[e]:r}}=t;r.lastGroup_=null,i.abort(),i.pause()},db=(e,t)=>()=>{let{mainPlaylistLoader:i,segmentLoaders:{[e]:r,main:s},mediaTypes:{[e]:n}}=t,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,u=n.lastTrack_;if((!u||!a||u.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,dg(r,n),o)){if(o.isMainPlaylist){if(!a||!u||a.id===u.id)return;let e=t.vhs.playlistController_,r=e.selectPlaylist();if(e.media()===r)return;n.logger_(`track change. Switching main audio from ${u.id} to ${a.id}`),i.pause(),s.resetEverything(),e.fastQualityChange_(r);return}if("AUDIO"===e){if(!o.playlistLoader){s.setAudio(!0),s.resetEverything();return}r.setAudio(!0),s.setAudio(!1)}if(l===o.playlistLoader){df(o.playlistLoader,n);return}r.track&&r.track(a),r.resetEverything(),df(o.playlistLoader,n)}},dv={AUDIO:(e,t)=>()=>{let{mediaTypes:{[e]:i},excludePlaylist:r}=t,s=i.activeTrack(),n=i.activeGroup(),a=(n.filter(e=>e.default)[0]||n[0]).id,o=i.tracks[a];if(s===o){r({error:{message:"Problem encountered loading the default audio track."}});return}for(let e in os.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),i.tracks)i.tracks[e].enabled=i.tracks[e]===o;i.onTrackChanged()},SUBTITLES:(e,t)=>()=>{let{mediaTypes:{[e]:i}}=t;os.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");let r=i.activeTrack();r&&(r.mode="disabled"),i.onTrackChanged()}},dT={AUDIO:(e,t,i)=>{if(!t)return;let{tech:r,requestOptions:s,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",()=>{let e=t.media();n.playlist(e,s),(!r.paused()||e.endList&&"none"!==r.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),s),r.paused()||n.load()}),t.on("error",dv[e](e,i))},SUBTITLES:(e,t,i)=>{let{tech:r,requestOptions:s,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",()=>{let e=t.media();n.playlist(e,s),n.track(a.activeTrack()),(!r.paused()||e.endList&&"none"!==r.preload())&&n.load()}),t.on("loadedplaylist",()=>{n.playlist(t.media(),s),r.paused()||n.load()}),t.on("error",dv[e](e,i))}},dS={AUDIO:(e,t)=>{let{vhs:i,sourceType:r,segmentLoaders:{[e]:s},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[e]:{groups:o,tracks:l,logger_:u}},mainPlaylistLoader:d}=t,h=oH(d.main);for(let s in(!a[e]||0===Object.keys(a[e]).length)&&(a[e]={main:{default:{default:!0}}},h&&(a[e].main.default.playlists=d.main.playlists)),a[e])for(let c in o[s]||(o[s]=[]),a[e][s]){let p,m=a[e][s][c];if(h?(u(`AUDIO group '${s}' label '${c}' is a main playlist`),m.isMainPlaylist=!0,p=null):p="vhs-json"===r&&m.playlists?new li(m.playlists[0],i,n):m.resolvedUri?new li(m.resolvedUri,i,n):m.playlists&&"dash"===r?new lR(m.playlists[0],i,n,d):null,m=oc({id:c,playlistLoader:p},m),dT[e](e,m.playlistLoader,t),o[s].push(m),void 0===l[c]){let e=new os.AudioTrack({id:c,kind:dm(m),enabled:!1,language:m.language,default:m.default,label:c});l[c]=e}}s.on("error",dv[e](e,t))},SUBTITLES:(e,t)=>{let{tech:i,vhs:r,sourceType:s,segmentLoaders:{[e]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[e]:{groups:l,tracks:u}},mainPlaylistLoader:d}=t;for(let n in o[e])for(let h in l[n]||(l[n]=[]),o[e][n]){let c;if(!r.options_.useForcedSubtitles&&o[e][n][h].forced)continue;let p=o[e][n][h];if("hls"===s)c=new li(p.resolvedUri,r,a);else if("dash"===s){if(!p.playlists.filter(e=>e.excludeUntil!==1/0).length)return;c=new lR(p.playlists[0],r,a,d)}else"vhs-json"===s&&(c=new li(p.playlists?p.playlists[0]:p.resolvedUri,r,a));if(p=oc({id:h,playlistLoader:c},p),dT[e](e,p.playlistLoader,t),l[n].push(p),void 0===u[h]){let e=i.addRemoteTextTrack({id:h,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:h},!1).track;u[h]=e}}n.on("error",dv[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{let{tech:i,main:{mediaGroups:r},mediaTypes:{[e]:{groups:s,tracks:n}}}=t;for(let t in r[e])for(let a in s[t]||(s[t]=[]),r[e][t]){let o=r[e][t][a];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;let l=i.options_.vhs&&i.options_.vhs.captionServices||{},u={label:a,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(l[u.instreamId]&&(u=oc(u,l[u.instreamId])),void 0===u.default&&delete u.default,s[t].push(oc({id:a},o)),void 0===n[a]){let e=i.addRemoteTextTrack({id:u.instreamId,kind:"captions",default:u.default,language:u.language,label:u.label},!1).track;n[a]=e}}}},dE=(e,t)=>{for(let i=0;ii=>{let{mainPlaylistLoader:r,mediaTypes:{[e]:{groups:s}}}=t,n=r.media();if(!n)return null;let a=null;n.attributes[e]&&(a=s[n.attributes[e]]);let o=Object.keys(s);if(!a){if("AUDIO"===e&&o.length>1&&oH(t.main))for(let e=0;ee.id===i.id)[0]||null},dC={AUDIO:(e,t)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=t;for(let e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{let{mediaTypes:{[e]:{tracks:i}}}=t;for(let e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}},dk=(e,{mediaTypes:t})=>()=>{let i=t[e].activeTrack();return i?t[e].activeGroup(i):null},dD=e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{dS[t](t,e)});let{mediaTypes:t,mainPlaylistLoader:i,tech:r,vhs:s,segmentLoaders:{AUDIO:n,main:a}}=e;["AUDIO","SUBTITLES"].forEach(i=>{t[i].activeGroup=dw(i,e),t[i].activeTrack=dC[i](i,e),t[i].onGroupChanged=dy(i,e),t[i].onGroupChanging=d_(i,e),t[i].onTrackChanged=db(i,e),t[i].getActiveGroup=dk(i,e)});let o=t.AUDIO.activeGroup();if(o){let e=(o.filter(e=>e.default)[0]||o[0]).id;t.AUDIO.tracks[e].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}i.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(e=>t[e].onGroupChanged())}),i.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(e=>t[e].onGroupChanging())});let l=()=>{t.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};for(let e in r.audioTracks().addEventListener("change",l),r.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),s.on("dispose",()=>{r.audioTracks().removeEventListener("change",l),r.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),r.clearTracks("audio"),t.AUDIO.tracks)r.audioTracks().addTrack(t.AUDIO.tracks[e])},dI=()=>{let e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:uY,activeTrack:uY,getActiveGroup:uY,onGroupChanged:uY,onTrackChanged:uY,lastTrack_:null,logger_:oh(`MediaGroups[${t}]`)}}),e};class dx{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){1===e&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=ee(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(e=>[e.ID,e])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class dA extends os.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new dx,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=oh("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";let i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=ee(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){let t=this.steeringManifest.reloadUri;if(!t)return;let i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(e,t)=>{if(e){if(410===t.status){this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(429===t.status){let i=t.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${i} seconds.`),this.startTTLTimeout_(parseInt(i,10));return}this.logger_(`manifest failed to load ${e}.`),this.startTTLTimeout_();return}let r=JSON.parse(this.request_.responseText);this.assignSteeringProperties_(r),this.startTTLTimeout_()})}setProxyServerUrl_(e){let t=new(I(O)).URL(e),i=new(I(O)).URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){let t=JSON.parse(I(O).atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){let t=new(I(O)).URL(e),i=this.getPathway(),r=this.getBandwidth_();if(i){let e=`_${this.manifestType_}_pathway`;t.searchParams.set(e,i)}if(r){let e=`_${this.manifestType_}_throughput`;t.searchParams.set(e,r)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());let t=(e=>{for(let t of e)if(this.availablePathways_.has(t))return t;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;let t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){let i=this.setProxyServerUrl_(e);if(!t(i))return i}let i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){this.ttlTimeout_=I(O).setTimeout(()=>{this.requestSteeringManifest()},1e3*e)}clearTTLTimeout_(){I(O).clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new dx}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(ee(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const dP=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],dL=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},dO=function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:r,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:l}){if(!r)return os.log.warn("We received no playlist to switch to. Please check your stream."),!1;let u=`allowing switch ${e&&e.id||"null"} -> ${r.id}`;if(!e)return l(`${u} as current playlist is not set`),!0;if(r.id===e.id)return!1;let d=!!oy(t,i).length;if(!e.endList)return d||"number"!=typeof e.partTargetDuration?(l(`${u} as current playlist is live`),!0):(l(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);let h=oC(t,i),c=o?lM.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:lM.MAX_BUFFER_LOW_WATER_LINE;if(am)&&h>=s){let e=`${u} as forwardBuffer >= bufferLowWaterLine (${h} >= ${s})`;return o&&(e+=` and next bandwidth > current bandwidth (${p} > ${m})`),l(e),!0}return l(`not ${u} as no switching criteria met`),!1};class dR extends os.EventTarget{constructor(e){super();let{src:t,withCredentials:i,tech:r,bandwidth:s,externVhs:a,useCueTags:o,playlistExclusionDuration:l,enableLowInitialPlaylist:u,sourceType:d,cacheEncryptionKeys:h,bufferBasedABR:c,leastPixelDiffSelector:p,captionServices:m}=e;if(!t)throw Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:g}=e;null==g&&(g=1/0),n=a,this.bufferBasedABR=!!c,this.leastPixelDiffSelector=!!p,this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.sourceType_=d,this.useCueTags_=o,this.playlistExclusionDuration=l,this.maxPlaylistRetries=g,this.enableLowInitialPlaylist=u,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:g,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=dI(),this.mediaSource=new(I(O)).MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=op(),this.hasPlayed_=!1,this.syncController_=new dh(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new dp,this.sourceUpdater_=new u6(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new dc,this.keyStatusMap_=new Map;let f={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:m,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:h,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_="dash"===this.sourceType_?new lR(t,this.vhs_,oc(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new li(t,this.vhs_,oc(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new uX(oc(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new uX(oc(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new di(oc(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((e,t)=>{function i(){r.off("vttjserror",s),e()}function s(){r.off("vttjsloaded",i),t()}r.one("vttjsloaded",i),r.one("vttjserror",s),r.addWebVttScript_()})}),e),this.contentSteeringController_=new dA(this.vhs_.xhr,()=>this.mainSegmentLoader_.bandwidth),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),dP.forEach(e=>{this[e+"_"]=dL.bind(this,e)}),this.logger_=oh("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;let y="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(y,()=>{let e=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){let e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return -1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){let t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){let r=this.media(),s=r&&(r.id||r.uri),n=e&&(e.id||e.uri);s&&s!==n&&(this.logger_(`switch media ${s} -> ${n} from ${t}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})),this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{let t=this.mediaTypes_[e],i=t?t.activeGroup():null,r=this.contentSteeringController_.getPathway();if(i&&r){let t=(i.length?i[0].playlists:i.playlists).filter(e=>e.attributes.serviceLocation===r);t.length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=I(O).setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(I(O).clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){let e;let t=this.main(),i=t&&t.playlists||[];if(!t||!t.mediaGroups||!t.mediaGroups.AUDIO)return i;let r=t.mediaGroups.AUDIO,s=Object.keys(r);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)e=this.mediaTypes_.AUDIO.activeTrack();else{let t=r.main||s.length&&r[s[0]];for(let i in t)if(t[i].default){e={label:i};break}}if(!e)return i;let n=[];for(let i in r)if(r[i][e.label]){let s=r[i][e.label];if(s.playlists&&s.playlists.length)n.push.apply(n,s.playlists);else if(s.uri)n.push(s);else if(t.playlists.length)for(let e=0;e{let e=this.mainPlaylistLoader_.media(),t=1500*e.targetDuration;oj(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),dD({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){let t;if(this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_(),this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!("vhs-json"===this.sourceType_&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{let e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{let e=this.mainPlaylistLoader_.media(),t=1500*e.targetDuration;oj(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,"dash"===this.sourceType_&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{let e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),!this.tech_.paused()&&(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){let i=e.mediaGroups||{},r=!0,s=Object.keys(i.AUDIO);for(let e in i.AUDIO)for(let t in i.AUDIO[e])i.AUDIO[e][t].uri||(r=!1);r&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),n.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(i.AUDIO[s[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){let t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),r=this.bufferLowWaterLine(),s=this.bufferHighWaterLine();return dO({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:r,bufferHighWaterLine:s,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{let e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))});let e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();let e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(()=>{this.tech_.setCurrentTime(this.tech_.currentTime())})}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();let e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;let e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;let t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){let t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;let t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;let i=n.Playlist.playlistEnd(e,t),r=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return i-r<=og;let a=s.end(s.length-1);return a-r<=og&&i-a<=og}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){let r;if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;let s=this.mainPlaylistLoader_.main.playlists,n=s.filter(oF),a=1===n.length&&n[0]===e;if(1===s.length&&i!==1/0)return os.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){let t=this.pathwayAttribute_(e),i=1e3*this.contentSteeringController_.steeringManifest.ttl;this.contentSteeringController_.excludePathway(t),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(t)},i);return}let t=!1;s.forEach(i=>{if(i===e)return;let r=i.excludeUntil;void 0!==r&&r!==1/0&&(t=!0,delete i.excludeUntil)}),t&&(os.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}r=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=r,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});let o=this.selectPlaylist();if(!o){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}let l=t.internal?this.logger_:os.log.warn,u=t.message?" "+t.message:"";l(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${u} Switching to playlist ${o.id}.`),o.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),o.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);let d=o.targetDuration/2*1e3||5e3,h="number"==typeof o.lastRequest&&Date.now()-o.lastRequest<=d;return this.switchMedia_(o,"exclude",a||h)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){let i=[],r="all"===e;(r||"main"===e)&&i.push(this.mainPlaylistLoader_);let s=[];(r||"audio"===e)&&s.push("AUDIO"),(r||"subtitle"===e)&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.forEach(e=>{let t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)}),["main","audio","subtitle"].forEach(t=>{let r=this[`${t}SegmentLoader_`];r&&(e===t||"all"===e)&&i.push(r)}),i.forEach(e=>t.forEach(t=>{"function"==typeof e[t]&&e[t]()}))}setCurrentTime(e){let t=oy(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:void(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()):0}duration(){if(!this.mainPlaylistLoader_)return 0;let e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:n.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e,t,i;if(!this.mainPlaylistLoader_)return;let r=this.mainPlaylistLoader_.media();if(!r)return;let s=this.syncController_.getExpiredTime(r,this.duration());if(null===s)return;let a=this.mainPlaylistLoader_.main,o=n.Playlist.seekable(r,s,n.Playlist.liveEdgeDelay(a,r));if(0!==o.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(r=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(s=this.syncController_.getExpiredTime(r,this.duration()))||0===(e=n.Playlist.seekable(r,s,n.Playlist.liveEdgeDelay(a,r))).length)||(this.seekable_&&this.seekable_.length&&(t=this.seekable_.end(0),i=this.seekable_.start(0)),e?e.start(0)>o.end(0)||o.start(0)>e.end(0)?this.seekable_=o:this.seekable_=op([[e.start(0)>o.start(0)?e.start(0):o.start(0),e.end(0)0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{let t=this.mediaTypes_[e].groups;for(let e in t)t[e].forEach(e=>{e.playlistLoader&&e.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){let e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!!t&&!!i}getCodecsOrExclude_(){let e;let t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},i=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();t.video=t.main;let r=uc(this.main(),i),s={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(s.video=r.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(s.video+=`,${r.audio||t.main.audioCodec||eJ}`),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||n)&&(s.audio=r.audio||t.main.audioCodec||t.audio.audioCodec||eJ,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),!s.audio&&!s.video){this.excludePlaylist({playlistToExclude:i,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}let a=(e,t)=>e?eY(t):eQ(t),o={};if(["video","audio"].forEach(function(i){if(s.hasOwnProperty(i)&&!a(t[i].isFmp4,s[i])){let r=t[i].isFmp4?"browser":"muxer";o[r]=o[r]||[],o[r].push(s[i]),"audio"===i&&(e=r)}}),n&&e&&i.attributes.AUDIO){let t=i.attributes.AUDIO;this.main().playlists.forEach(e=>{(e.attributes&&e.attributes.AUDIO)===t&&e!==i&&(e.excludeUntil=1/0)}),this.logger_(`excluding audio group ${t} as ${e} does not support codec(s): "${s.audio}"`)}if(Object.keys(o).length){let e=Object.keys(o).reduce((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${o[t].join(",")}"`),"")+".";this.excludePlaylist({playlistToExclude:i,error:{internal:!0,message:e},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){let e=[];if(["video","audio"].forEach(t=>{let i=(eG(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(eG(s[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${s[t]}"`)}),e.length){this.excludePlaylist({playlistToExclude:i,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return s}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;let e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);let t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){let e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{let r=e[i];if(-1!==t.indexOf(r.id))return;t.push(r.id);let s=uc(this.main,r),n=[];!s.audio||eQ(s.audio)||eY(s.audio)||n.push(`audio codec ${s.audio}`),!s.video||eQ(s.video)||eY(s.video)||n.push(`video codec ${s.video}`),s.text&&"stpp.ttml.im1t"===s.text&&n.push(`text codec ${s.text}`),n.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${n.join(", ")}`))})}excludeIncompatibleVariants_(e){let t=[],i=this.main().playlists,r=ud(eG(e)),s=uh(r),n=r.video&&eG(r.video)[0]||null,a=r.audio&&eG(r.audio)[0]||null;Object.keys(i).forEach(e=>{let r=i[e];if(-1!==t.indexOf(r.id)||r.excludeUntil===1/0)return;t.push(r.id);let o=[],l=uc(this.mainPlaylistLoader_.main,r),u=uh(l);if(l.audio||l.video){if(u!==s&&o.push(`codec count "${u}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){let e=l.video&&eG(l.video)[0]||null,t=l.audio&&eG(l.audio)[0]||null;e&&n&&e.type.toLowerCase()!==n.type.toLowerCase()&&o.push(`video codec "${e.type}" !== "${n.type}"`),t&&a&&t.type.toLowerCase()!==a.type.toLowerCase()&&o.push(`audio codec "${t.type}" !== "${a.type}"`)}o.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id}: ${o.join(" && ")}`))}})}updateAdCues_(e){let t=0,i=this.seekable();i.length&&(t=i.start(0)),ds(e,this.cueTagsTrack_,t)}goalBufferLength(){let e=this.tech_.currentTime(),t=lM.GOAL_BUFFER_LENGTH,i=lM.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,lM.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,r)}bufferLowWaterLine(){let e=this.tech_.currentTime(),t=lM.BUFFER_LOW_WATER_LINE,i=lM.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,lM.MAX_BUFFER_LOW_WATER_LINE),s=Math.max(t,lM.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?s:r)}bufferHighWaterLine(){return lM.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){uA(this.inbandTextTracks_,"com.apple.streaming",this.tech_),ux({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){let r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();uA(this.inbandTextTracks_,e,this.tech_),uk({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:r,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){let e=this.main();if(e.contentSteering){for(let t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{let e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{let t=this.contentSteeringController_.getAvailablePathways(),i=[];for(let r of e.playlists){let e=r.attributes.serviceLocation;if(e&&(i.push(e),!t.has(e)))return!0}return!i.length&&!!t.size})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){let e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();let t=this.main().playlists,i=new Set,r=!1;Object.keys(t).forEach(s=>{let n=t[s],a=this.pathwayAttribute_(n),o=a&&e!==a;n.excludeUntil!==1/0||"content-steering"!==n.lastExcludeReason_||o||(delete n.excludeUntil,delete n.lastExcludeReason_,r=!0);let l=!n.excludeUntil&&n.excludeUntil!==1/0;!i.has(n.id)&&o&&l&&(i.add(n.id),n.excludeUntil=1/0,n.lastExcludeReason_="content-steering",this.logger_(`excluding ${n.id} for ${n.lastExcludeReason_}`))}),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach(t=>{let i=this.mediaTypes_[t];if(i.activePlaylistLoader){let t=i.activePlaylistLoader.media_;t&&t.attributes.serviceLocation!==e&&(r=!0)}}),r&&this.changeSegmentPathway_()}handlePathwayClones_(){let e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||i&&i.size){for(let[e,r]of t.entries())i.get(e)||(this.mainPlaylistLoader_.updateOrDeleteClone(r),this.contentSteeringController_.excludePathway(e));for(let[r,s]of i.entries()){let i=t.get(r);if(!i){e.filter(e=>e.attributes["PATHWAY-ID"]===s["BASE-ID"]).forEach(e=>{this.mainPlaylistLoader_.addClonePathway(s,e)}),this.contentSteeringController_.addAvailablePathway(r);continue}this.equalPathwayClones_(i,s)||(this.mainPlaylistLoader_.updateOrDeleteClone(s,!0),this.contentSteeringController_.addAvailablePathway(r))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;let i=e["URI-REPLACEMENT"].PARAMS,r=t["URI-REPLACEMENT"].PARAMS;for(let e in i)if(i[e]!==r[e])return!1;for(let e in r)if(i[e]!==r[e])return!1;return!0}changeSegmentPathway_(){let e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0,t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{let r=this.mainPlaylistLoader_.getKeyIdSet(i);r&&r.size&&r.forEach(r=>{let s="usable",n=this.keyStatusMap_.has(r)&&this.keyStatusMap_.get(r)===s,a=i.lastExcludeReason_===t&&i.excludeUntil===1/0;n?n&&a&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${r} is ${s}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${r} doesn't exist in the keyStatusMap or is not ${s}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(e=>{let i=e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height<720,r=e.excludeUntil===1/0&&e.lastExcludeReason_===t;i&&r&&(delete e.excludeUntil,os.log.warn(`enabling non-HD playlist ${e.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){let i=("string"==typeof e?e:u9(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${i} added to the keyStatusMap`),this.keyStatusMap_.set(i,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const dM=(e,t,i)=>r=>{let s=e.main.playlists[t],n=oB(s),a=oF(s);return void 0===r?a:(r?delete s.disabled:s.disabled=!0,r===a||n||(i(s),r?e.trigger("renditionenabled"):e.trigger("renditiondisabled")),r)};class dN{constructor(e,t,i){let{playlistController_:r}=e,s=r.fastQualityChange_.bind(r);if(t.attributes){let e=t.attributes.RESOLUTION;this.width=e&&e.width,this.height=e&&e.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=uc(r.main(),t),this.playlist=t,this.id=i,this.enabled=dM(e.playlists,t.id,s)}}const dU=function(e){e.representations=()=>{let t=e.playlistController_.main(),i=oH(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter(e=>!oB(e)).map((t,i)=>new dN(e,t,t.id)):[]}},dB=["seeking","seeked","pause","playing","error"];class dF{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=oh("PlaybackWatcher"),this.logger_("initialize");let t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={};a.forEach(e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[`${e}SegmentLoader_`].on("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)});let l=e=>{["main","audio"].forEach(t=>{n[`${t}SegmentLoader_`][e]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(dB,s),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(dB,s),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach(e=>{n[`${e}SegmentLoader_`].off("appendsdone",o[e].updateend),n[`${e}SegmentLoader_`].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)}),this.checkCurrentTimeTimeout_&&I(O).clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&I(O).clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=I(O).setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){let t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){let t=this.playlistController_,i=t[`${e}SegmentLoader_`],r=i.buffered_(),s=oE(this[`${e}Buffered_`],r);if(this[`${e}Buffered_`]=r,s){this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:oS(r)}),this[`${e}StalledDownloads_`]<10||(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),"subtitle"!==e&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;let e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+og>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){let e;if(!this.tech_.seeking())return!1;let t=this.seekable(),i=this.tech_.currentTime();if(this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){let i=t.start(0);e=i+(i===t.end(0)?0:og)}if(void 0!==e)return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${oT(t)}. Seeking to ${e}.`),this.tech_.setCurrentTime(e),!0;let r=this.playlistController_.sourceUpdater_,s=this.tech_.buffered(),n=r.audioBuffer?r.audioBuffered():null,a=r.videoBuffer?r.videoBuffered():null,o=this.media(),l=o.partTargetDuration?o.partTargetDuration:(o.targetDuration-om)*2,u=[n,a];for(let e=0;e ${t.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){let e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){let i=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${i}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}let i=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;let s=o_(r,t);return s.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,r=!1){if(!e.length)return!1;let s=e.end(e.length-1)+og,n=!i.endList,a="number"==typeof i.partTargetDuration;return n&&(a||r)&&(s=e.end(e.length-1)+3*i.targetDuration),t>s}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:s}}return null}}const dq={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},dj=function(e,t){let i=0,r=0,s=oc(dq,t);e.ready(()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})});let n=function(){r&&e.currentTime(r)},a=function(t){null!=t&&(r=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",n),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){if(Date.now()-i<1e3*s.errorInterval){e.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!s.getSource||"function"!=typeof s.getSource){os.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return i=Date.now(),s.getSource.call(e,a)},l=function(){e.off("loadedmetadata",n),e.off("error",o),e.off("dispose",l)};e.on("error",o),e.on("dispose",l),e.reloadSourceOnError=function(t){l(),dj(e,t)}};var d$="3.12.2";const dV={PlaylistLoader:li,Playlist:oz,utils:lm,STANDARD_PLAYLIST_SELECTOR:ub,INITIAL_PLAYLIST_SELECTOR:function(){let e=this.playlists.main.playlists.filter(oz.isEnabled);return uf(e,(e,t)=>uy(e,t)),e.filter(e=>!!uc(this.playlists.main,e).video)[0]||null},lastBandwidthSelector:ub,movingAverageBandwidthSelector:function(e){let t=-1,i=-1;if(e<0||e>1)throw Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let r=this.useDevicePixelRatio&&I(O).devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),u_(this.playlists.main,t,parseInt(ug(this.tech_.el(),"width"),10)*r,parseInt(ug(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:uy,comparePlaylistResolution:function(e,t){let i,r;return(e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||I(O).Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(r=t.attributes.RESOLUTION.width),i===(r=r||I(O).Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH)?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-r},xhr:la()};Object.keys(lM).forEach(e=>{Object.defineProperty(dV,e,{get:()=>(os.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),lM[e]),set(t){if(os.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0){os.log.warn(`value of Vhs.${e} must be greater than or equal to 0`);return}lM[e]=t}})});const dH="videojs-vhs",dz=function(e,t){let i=t.media(),r=-1;for(let t=0;t{e.addQualityLevel(t)}),dz(e,t.playlists)};dV.canPlaySource=function(){return os.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const dW=(e,t,i)=>{if(!e)return e;let r={};t&&t.attributes&&t.attributes.CODECS&&(r=ud(eG(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(r.audio=i.attributes.CODECS);let s=eX(r.video),n=eX(r.audio),a={};for(let i in e)a[i]={},n&&(a[i].audioContentType=n),s&&(a[i].videoContentType=s),t.contentProtection&&t.contentProtection[i]&&t.contentProtection[i].pssh&&(a[i].pssh=t.contentProtection[i].pssh),"string"==typeof e[i]&&(a[i].url=e[i]);return oc(e,a)},dK=(e,t)=>e.reduce((e,i)=>{if(!i.contentProtection)return e;let r=t.reduce((e,t)=>{let r=i.contentProtection[t];return r&&r.pssh&&(e[t]={pssh:r.pssh}),e},{});return Object.keys(r).length&&e.push(r),e},[]),dX=({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:r})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();let s=dK(i?r.concat([i]):r,Object.keys(t)),n=[],a=[];return s.forEach(t=>{a.push(new Promise((t,i)=>{e.tech_.one("keysessioncreated",t)})),n.push(new Promise((i,r)=>{e.eme.initializeMediaKeys({keySystems:t},e=>{if(e){r(e);return}i()})}))}),Promise.race([Promise.all(n),Promise.race(a)])},dY=({player:e,sourceKeySystems:t,media:i,audioMedia:r})=>{let s=dW(t,i,r);return!!s&&(e.currentSource().keySystems=s,!s||!!e.eme||(os.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},dQ=()=>{if(!I(O).localStorage)return null;let e=I(O).localStorage.getItem(dH);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},dJ=e=>{if(!I(O).localStorage)return!1;let t=dQ();t=t?oc(t,e):e;try{I(O).localStorage.setItem(dH,JSON.stringify(t))}catch(e){return!1}return t},dZ=e=>0===e.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,d0=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},d1=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},d2=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},d4=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};dV.supportsNativeHls=function(){if(!I(R)||!I(R).createElement)return!1;let e=I(R).createElement("video");return!!os.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(e.canPlayType(t))})}(),dV.supportsNativeDash=!!(I(R)&&I(R).createElement&&os.getTech("Html5").isSupported())&&/maybe|probably/i.test(I(R).createElement("video").canPlayType("application/dash+xml")),dV.supportsTypeNatively=e=>"hls"===e?dV.supportsNativeHls:"dash"===e&&dV.supportsNativeDash,dV.isSupported=function(){return os.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},dV.xhr.onRequest=function(e){d0(dV.xhr,e)},dV.xhr.onResponse=function(e){d1(dV.xhr,e)},dV.xhr.offRequest=function(e){d2(dV.xhr,e)},dV.xhr.offResponse=function(e){d4(dV.xhr,e)};const d8=os.getComponent("Component");class d5 extends d8{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=oh("VhsHandler"),t.options_&&t.options_.playerId){let e=os.getPlayer(t.options_.playerId);this.player_=e}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(I(R),["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],e=>{let t=I(R).fullscreenElement||I(R).webkitFullscreenElement||I(R).mozFullScreenElement||I(R).msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=oc(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){let e=dQ();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=lM.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===lM.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{void 0!==this.source_[e]&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;let t=this.options_.customPixelRatio;"number"==typeof t&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=dZ(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=dV,this.options_.sourceType=e1(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new dR(this.options_);let i=oc({liveRangeSafeTimeDelta:og},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new dF(i),this.playlistController_.on("error",()=>{let e=os.players[this.tech_.options_.playerId],t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)});let r=this.options_.bufferBasedABR?dV.movingAverageBandwidthSelector(.55):dV.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=dV.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth,t=I(O).navigator.connection||I(O).navigator.mozConnection||I(O).navigator.webkitConnection;if(this.options_.useNetworkInformationApi&&t){let i=1e6*t.downlink;e=i>=1e7&&e>=1e7?Math.max(e,i):i}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){return Math.floor(1/(1/(this.bandwidth||1)+(this.throughput>0?1/this.throughput:0)))},set(){os.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>oS(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>oS(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&dJ({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{dU(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=I(O).URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),dX({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3,metadata:{errorType:os.Error.EMEKeySessionCreationError}})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){let e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=dY({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",e=>{this.playlistController_.updatePlaylistByKeyStatus(e.keyId,e.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){let e=os.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{dG(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{dz(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":d$,"mux.js":"7.0.3","mpd-parser":"1.3.0","m3u8-parser":"7.1.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return u6.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&I(O).URL.revokeObjectURL&&(I(O).URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return lT({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,r=2){return lS({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{d0(this.xhr,e)},this.xhr.onResponse=e=>{d1(this.xhr,e)},this.xhr.offRequest=e=>{d2(this.xhr,e)},this.xhr.offResponse=e=>{d4(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const d3={name:"videojs-http-streaming",VERSION:d$,canHandleSource(e,t={}){let i=oc(os.options,t);return d3.canPlayType(e.type,i)},handleSource(e,t,i={}){let r=oc(os.options,i);return t.vhs=new d5(e,t,r),t.vhs.xhr=la(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){let i=e1(e);if(!i)return"";let r=d3.getOverrideNative(t);return!dV.supportsTypeNatively(i)||r?"maybe":""},getOverrideNative(e={}){let{vhs:t={}}=e,i=!(os.browser.IS_ANY_SAFARI||os.browser.IS_IOS),{overrideNative:r=i}=t;return r}};eY("avc1.4d400d,mp4a.40.2")&&os.getTech("Html5").registerSourceHandler(d3,0),os.VhsHandler=d5,os.VhsSourceHandler=d3,os.Vhs=dV,os.use||os.registerComponent("Vhs",dV),os.options.vhs=os.options.vhs||{},os.getPlugin&&os.getPlugin("reloadSourceOnError")||os.registerPlugin("reloadSourceOnError",function(e){dj(this,e)});/*! @name videojs-contrib-eme @version 3.11.2 @license Apache-2.0 */var R=P("7pNCM"),O=P("eDick");function d6(){return(d6=Object.assign||function(e){for(var t=1;t=400&&r.statusCode<=599){var n=s;t&&(n=String.fromCharCode.apply(null,new Uint8Array(s))),e({cause:n});return}e(null,s)}});var hn=function(e){var t,i=String.fromCharCode.apply(null,new Uint16Array(e)),r=new(I(O)).DOMParser().parseFromString(i,"application/xml"),s=r.getElementsByTagName("HttpHeaders")[0],n={};if(s)for(var a=s.getElementsByTagName("name"),o=s.getElementsByTagName("value"),l=0;l=0||(s[i]=e[i]);return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}return s}os.registerPlugin("eme",hA),hA.VERSION="3.11.2";const hN=os.getComponent("player");os.registerComponent("player",class extends hN{constructor(e,t,i){super(e,t=os.obj.merge(t,{plugins:{eme:!0}}),i)}audioTrack(e){let t=Array.from(this.player().audioTracks());if(!e)return t.find(e=>e.enabled);let{kind:i,language:r}=e,s=t.find(e=>e.language===r&&e.kind===i)||t.find(e=>e.language===r);return s&&(s.enabled=!0),s}bufferedRanges(){let e=[];for(let t=0;t!["chapters","metadata"].includes(e.kind));if(!e)return t.find(e=>"showing"===e.mode);t.forEach(e=>e.mode="disabled");let{kind:i,language:r}=e;return t.find(e=>(e.language===r&&e.kind===i&&(e.mode="showing"),"showing"===e.mode))||t.find(e=>(e.language===r&&(e.mode="showing"),"showing"===e.mode))}}),os.VERSION={pillarbox:"1.10.0",videojs:os.VERSION,[os.VhsSourceHandler.name]:os.VhsSourceHandler.VERSION,eme:os.getPlugin("eme").VERSION},os.options.enableSmoothSeeking=!0,os.options.fill=!0,os.options.html5={vhs:{useForcedSubtitles:!0}},os.options.liveTracker={trackingThreshold:120,liveTolerance:15},os.options.liveui=!0,os.options.playsinline=!0,os.options.responsive=!0,os.options.trackers={};class hU{constructor(e="il.srgssr.ch"){this.setIlHost(e)}setIlHost(e){this.baseUrl=`${e}/integrationlayer/2.1/`}handleRequest(e){var t,i=this;return t=hR(function*(t){let r="function"==typeof e?e(t):i.mediaCompositionUrlHandler(t),s=yield fetch(r);if(!s.ok)throw s;return yield s.json()}),function(e){return t.apply(this,arguments)}}mediaCompositionUrlHandler(e){return`https://${this.baseUrl}mediaComposition/byUrn/${e}?onlyChapters=true&vector=portalplay`}}const hB="https://il.srgssr.ch/images/";class hF{static scale({url:e,width:t="960",format:i="jpg"}={},r=hB){if(!e)return;let s=new URL(r);return s.searchParams.set("imageUrl",e),s.searchParams.set("format",i),s.searchParams.set("width",t),decodeURIComponent(s.href)}static get JPG(){return"jpg"}static get PNG(){return"png"}static get WEBP(){return"webp"}static get WIDTH_240(){return"240"}static get WIDTH_320(){return"320"}static get WIDTH_480(){return"480"}static get WIDTH_960(){return"960"}static get WIDTH_1920(){return"1920"}}const hq={WIDEVINE:"com.widevine.alpha",FAIRPLAY:"com.apple.fps.1_0",PLAYREADY:"com.microsoft.playready"};class hj{static buildKeySystems(e=[]){let t={};return e.forEach(e=>{let i=hj.vendors[e.type];if(hj.vendors.FAIRPLAY===i){let{certificateUrl:r,licenseUrl:s}=e;t[i]={certificateUri:r,licenseUri:s}}else t[i]=e.licenseUrl}),{keySystems:t}}static hasDrm(e){return e.some(({drmList:e})=>e&&e.length>0)}static get vendors(){return hq}}const h$="AKAMAI",hV="NONE";class hH{static aclPath(e){let t=e.pathname;return`${t.substring(0,t.lastIndexOf("/")+1)}*`}static get AKAMAI(){return h$}static hasToken(e){return e.some(e=>hH.isAkamai(e.tokenType))}static isAkamai(e){return h$===e}static isNone(e){return hV===e}static get NONE(){return hV}static tokenize(e,t){let i=new URL(`${e.url}`),r=hH.aclPath(i);return fetch(`${t}${encodeURIComponent(r)}`).then(e=>e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText})).then(({token:{authparams:t}})=>(new URLSearchParams(t).forEach((e,t)=>i.searchParams.set(t,e)),Object.assign({},e,{url:i.toString()}))).catch(e=>Promise.reject(e))}static tokenizeSources(e,t="https://tp.srgssr.ch/akahd/token?acl="){let i=[];return e.forEach(e=>{let r=hH.tokenize(e,t);i.push(r)}),Promise.all(i).then(e=>e).catch(e=>Promise.reject(e))}}const hz="emptied",hG="ended",hW="loadeddata",hK="loadstart",hX="pause",hY="playing",hQ="ratechange",hJ="seeking",hZ="timeupdate",h0="waiting";class h1{constructor(e,{debug:t=!1,environment:i="prod",playerVersion:r="none",tagCommanderScriptURL:s="//colibri-js.akamaized.net/penguin/tc_SRGGD_11.js"}={}){this.isDebugEnabled=t,this.elapsedPlaybackTime=0,this.environment=i,this.hasStarted=!1,this.heartBeatIntervalId=void 0,this.initialized=!1,this.isSeeking=!1,this.isWaiting=!1,this.mediaSession=0,this.pendingQueue=[],this.pendingTagCommanderReload=!1,this.player=e,this.playerVersion=r,this.srcMediaData=void 0,this.startPlaybackSession=0,this.tagCommanderScriptURL=s,this.trackedCurrentTime=0,this.uptimeIntervalId=void 0,this.initScript(),this.initListeners()}beforeunload(){this.notify("stop")}clearTimers(){clearInterval(this.heartBeatIntervalId),clearInterval(this.uptimeIntervalId),clearTimeout(this.uptimeTimeoutId)}currentTime(){return Math.round(this.trackedCurrentTime)}debug(e){if(void 0===e)return this.isDebugEnabled||this.player.debug();this.isDebugEnabled=!!e}destroy(){this.clearTimers(),window.tc_vars||(window.tc_vars={}),this.elapsedPlaybackTime=0,this.hasStarted=!1,this.heartBeatIntervalId=void 0,this.initialized=!1,this.isWaiting=!1,this.mediaSession=0,this.pendingQueue=[],this.srcMediaData=void 0,this.startPlaybackSession=0,this.trackedCurrentTime=0,this.uptimeIntervalId=void 0}dispose(){this.beforeunload(),this.clearTimers(),window.removeEventListener("beforeunload",this.beforeunloadListener),this.player.off(hz,this.emptiedListener),this.player.off(hG,this.endedListener),this.player.off(hK,this.loadstartListener),this.player.off(hW,this.loadeddataListener),this.player.off(hY,this.playListener),this.player.off(hX,this.pauseListener),this.player.off(hQ,this.rateChangeListener),this.player.off(hJ,this.seekingListener),this.player.off(hZ,this.timeUpdateListener),this.player.off(h0,this.waitingListener)}emptied(){this.player.ended()||this.notify("stop")}ended(){this.notify("eof"),this.mediaSession=0,this.clearTimers()}flush(){!this.isTrackerDisabled()&&(this.pendingTagCommanderReload&&window.tC&&(window.tC.container.reload(),this.pendingTagCommanderReload=!1),window.tc_events_11&&this.pendingQueue.length>0&&(this.pendingQueue.forEach(e=>{window.tc_events_11(this.player.el(),e.action,e.labels)}),this.pendingQueue=[]))}getCurrentAudioTrack(){let e=Array.from(this.player.audioTracks()).find(e=>e.enabled),t="und";return e&&e.language&&(t=e.language),e?t.toUpperCase():""}getCurrentTextTrack(){let e=this.player.textTrack(),t="und";return e&&e.language&&(t=e.language),e?t.toUpperCase():""}getDvrWindowPosition(){let{liveTracker:e}=this.player,t=this.currentTime()-e.seekableStart()|0,i=e.liveWindow()-t;return i<0||i===1/0?0:1e3*i}getDvrWindowSize(){let e=this.player.liveTracker.liveWindow()===1/0,t=1e3*this.player.liveTracker.liveWindow();return e?0:t}getElapsedPlaybackTime(){return this.startPlaybackSession?this.getElapsedPlayingTime():this.elapsedPlaybackTime}getElapsedPlayingTime(){let e=h1.now()-this.startPlaybackSession|0;return this.elapsedPlaybackTime+e}getEventLabels(e){let t={event_id:e,event_timestamp:h1.now(),media_dvr_window_length:0,media_dvr_window_offset:0,media_is_dvr:!1,media_is_live:!1,media_mute:this.player.muted()?"1":"0",media_playback_rate:this.player.playbackRate(),media_position:this.currentTime(),media_quality:this.srcMediaData.mediaData.quality,media_subtitles_on:this.isTextTrackEnabled(),media_volume:(100*this.player.volume()).toFixed(0),navigation_environment:this.environment};return this.isAudioTrackEnabled()&&(t.media_audio_track=this.getCurrentAudioTrack()),this.isTextTrackEnabled()&&(t.media_subtitle_selection=this.getCurrentTextTrack()),this.isMediaOnDemand()||(t.media_is_live=!0,t.media_position=this.getElapsedPlaybackTime()),this.isMediaDvr()&&(t.media_dvr_window_offset=0|this.getDvrWindowPosition(),t.media_dvr_window_length=0|this.getDvrWindowSize(),t.media_is_dvr=!0,t.media_timeshift=["play",hX].includes(e)?this.timeShifted():0),t}getInternalLabels(){let e={media_bu_distributer:this.srcMediaData.mediaData.vendor,media_chromecast_selected:!!this.player.tech(!0).isCasting,media_embedding_url:document.referrer,media_player_display:"default",media_player_name:"pillarbox-web",media_player_version:this.playerVersion,media_url:this.srcMediaData.src},t=this.srcMediaData.mediaData.analyticsMetadata||{};window.tc_vars=Object.assign({},window.tc_vars,e,t)}heartBeat(){this.heartBeatIntervalId=setInterval(()=>{this.player.paused()||this.notify("pos")},3e4)}initCallbacks(){this.beforeunloadListener=this.beforeunload.bind(this),this.emptiedListener=this.emptied.bind(this),this.endedListener=this.ended.bind(this),this.loadstartListener=this.loadstart.bind(this),this.loadeddataListener=this.loadeddata.bind(this),this.playListener=this.play.bind(this),this.pauseListener=this.pause.bind(this),this.rateChangeListener=this.rateChange.bind(this),this.seekingListener=this.seeking.bind(this),this.timeUpdateListener=this.timeUpdate.bind(this),this.waitingListener=this.waiting.bind(this)}initListeners(){this.initCallbacks(),window.addEventListener("beforeunload",this.beforeunloadListener),this.player.on(hz,this.emptiedListener),this.player.on(hG,this.endedListener),this.player.on(hK,this.loadstartListener),this.player.on(hW,this.loadeddataListener),this.player.on(hY,this.playListener),this.player.on(hX,this.pauseListener),this.player.on(hQ,this.rateChangeListener),this.player.on(hJ,this.seekingListener),this.player.on(hZ,this.timeUpdateListener),this.player.on(h0,this.waitingListener),this.player.one("dispose",this.dispose.bind(this))}initScript(){let e="tc_script__11";if(!document.querySelector(`#${e}`)){let t=document.createElement("script"),i=this.tagCommanderScriptURL;t.defer=!0,t.id=e,t.src=i,t.type="text/javascript",t.onload=e=>{this.flush()},document.body.appendChild(t)}}isAudioTrackEnabled(){return!!this.getCurrentAudioTrack()}isMediaDvr(){let{trackingThreshold:e}=this.player.liveTracker.options();return!this.isMediaOnDemand()&&ethis.player.liveTracker.liveWindow()}isMediaOnDemand(){return Number.isFinite(this.player.duration())}isTextTrackEnabled(){return!!this.getCurrentTextTrack()}isTrackerDisabled(){return!this.srcMediaData||!this.srcMediaData.mediaData||(Array.isArray(this.srcMediaData.disableTrackers)?!!this.srcMediaData.disableTrackers.find(e=>e.toLowerCase()===h1.name.toLowerCase()):!!this.srcMediaData.disableTrackers)}loadstart(){this.destroy(),this.updateSrcMediaData(this.player.currentSource()),this.isTrackerDisabled()||(this.getInternalLabels(),this.reloadTagCommanderContainer(),this.notify("buffer_start"),this.hasStarted=!1)}loadeddata(){this.notify("init"),this.initialized=!0,this.notify("buffer_stop")}log(e,t,i="log"){this.debug()&&console[i](`SRGAnalytics:${e}`,t,window.tc_vars)}notify(e,t){if(this.isTrackerDisabled())return;try{this.flush()}catch(t){this.log(e,t,"error")}let i=Object.assign({},this.getEventLabels(e),t);this.log(e,i);try{window.tc_events_11?window.tc_events_11(this.player.el(),e,i):this.pendingQueue.push({action:e,labels:i})}catch(t){this.log(e,t,"error")}}static now(){return(Date.now()/1e3).toFixed(0)}play(){this.hasStarted||(this.hasStarted=!0),this.startPlaybackSession||this.isMediaOnDemand()||(this.startPlaybackSession=h1.now()),0===this.mediaSession&&(this.mediaSession=h1.now(),this.heartBeat(),this.uptime()),this.timeUpdate(),this.notify("play"),this.isSeeking&&(this.isSeeking=!1)}pause(){if(this.isMediaOnDemand()||(this.elapsedPlaybackTime=this.getElapsedPlayingTime(),this.startPlaybackSession=0),!this.player.seeking()&&!this.isMediaLive()&&this.player.currentTime(){this.player.paused()||this.isMediaOnDemand()||this.notify("uptime")};this.uptimeTimeoutId=setTimeout(()=>{e(),this.uptimeIntervalId=setInterval(()=>{e()},6e4)},3e4)}waiting(){if(!this.initialized||this.isWaiting)return;let e=()=>{this.isWaiting=!1,this.notify("buffer_stop")};this.isWaiting=!0,this.notify("buffer_start"),os.browser.IS_ANY_SAFARI?this.player.one(hZ,e):this.player.one(hY,e)}}class h2{findChapterByUrn(e){if(this.chapterList){let[t]=this.chapterList.filter(t=>t.urn===e);return t}}findMainSegment(){if(!this.segmentUrn)return;let[e]=this.getMainSegments().filter(e=>e.urn===this.segmentUrn);return e}findResourceListByUrn(e){let t=this.findChapterByUrn(e);if(t)return t.resourceList||[]}getChapters(){return this.chapterList}getFilteredExternalSubtitles(){let{subtitleList:e}=this.getMainChapter(),[{subtitleInformationList:t}={}]=this.getResourceList().filter(({subtitleInformationList:e})=>e);if(!e)return[];let i=e.filter(e=>"TTML"!==e.format);return e&&!t?i:i.filter(e=>!t.find(t=>t.locale===e.locale&&e.type===t.type))}getMainBlockReason(){let e=this.getMainChapter();if(!e)return;let{blockReason:t}=e;return!t&&new Datee.blockReason)}getMainChapter(){return this.mainChapter||(this.mainChapter=this.findChapterByUrn(this.chapterUrn)),!this.mainChapter&&this.chapterList&&this.chapterList.length>0&&([this.mainChapter]=this.chapterList),this.mainChapter}getMainChapterImageUrl(){let e=this.getMainChapter();if(e&&e.imageUrl)return e.imageUrl}getMainResources(){let e=this.getResourceList();if(e&&e.length)return e.map(e=>({analyticsData:this.getMergedAnalyticsData(e.analyticsData),analyticsMetadata:this.getMergedAnalyticsMetadata(e.analyticsMetadata),blockReason:this.getMainChapter().blockReason,blockedSegments:this.getMainBlockedSegments(),imageUrl:this.getMainChapterImageUrl(),chapters:this.getChapters(),drmList:e.drmList,dvr:e.dvr,eventData:this.getMainChapter().eventData,id:this.getMainChapter().id,imageCopyright:this.getMainChapter().imageCopyright,intervals:this.getMainTimeIntervals(),live:e.live,mediaType:this.getMainChapter().mediaType,mimeType:e.mimeType,presentation:e.presentation,quality:e.quality,streaming:e.streaming,streamOffset:e.streamOffset,subtitles:this.getFilteredExternalSubtitles(),title:this.getMainChapter().title,tokenType:e.tokenType,url:e.url,urn:this.chapterUrn,vendor:this.getMainChapter().vendor}))}getMainSegments(){let e=this.getMainChapter();return!this.mainSegments&&e&&e.segmentList&&(this.mainSegments=e.segmentList),this.mainSegments||[]}getMainTimeIntervals(){let{timeIntervalList:e=[]}=this.getMainChapter()||{};return e}getMainValidFromDate(){let e=this.getMainChapter();if(!e)return new Date(0);let{validFrom:t}=e;if(t)return new Date(t)}getMergedAnalyticsData(e){return hL(hL(hL({},this.analyticsData),this.getMainChapter().analyticsData),e)}getMergedAnalyticsMetadata(e){return hL(hL(hL({},this.analyticsMetadata),this.getMainChapter().analyticsMetadata),e)}getResourceList(){let{resourceList:e}=this.getMainChapter();return e||[]}}var h4="Wiedergabe",h8="Pause",h5="Erneut abspielen",h3="Dauer",h6="LIVE",h7="Geladen",h9="Status",ce="Vollbild",ct="Stumm schalten",ci="Ton einschalten",cr="Untertitel",cs="Untertitel",cn="Kapitel",ca="Schließen",co="Beschreibungen",cl="Schrift",cu="Weiß",cd="Schwarz",ch="Grün",cc="Blau",cp="Gelb",cm="Magenta",cg="Türkis",cf="Hintergrund",cy="Fenster",c_="Durchsichtig",cb="Undurchsichtig",cv="Kein",cT="Erhoben",cS="Gedrückt",cE="Uniform",cw="Zwanglos",cC="Schreibschrift",ck="Zurücksetzen",cD="Fertig",cI="Farbe",cx="Deckkraft",cA=Object.freeze({__proto__:null,Background:cf,Black:cd,Blue:cc,Captions:cs,Casual:cw,Chapters:cn,Close:ca,Color:cI,Cyan:cg,Depressed:cS,Descriptions:co,Done:cD,Duration:h3,Fullscreen:ce,Green:ch,LIVE:h6,Loaded:h7,Magenta:cm,Mute:ct,None:cv,Opacity:cx,Opaque:cb,Pause:h8,Play:h4,Progress:h9,Raised:cT,Red:"Rot",Replay:h5,Reset:ck,Script:cC,Subtitles:cr,Text:cl,Transparent:c_,Uniform:cE,Unmute:ci,White:cu,Window:cy,Yellow:cp,default:{Play:h4,Pause:h8,Replay:h5,"Current Time":"Aktueller Zeitpunkt",Duration:h3,"Remaining Time":"Verbleibende Zeit","Stream Type":"Streamtyp",LIVE:h6,Loaded:h7,Progress:h9,Fullscreen:ce,"Exit Fullscreen":"Vollbildmodus beenden",Mute:ct,Unmute:ci,"Playback Rate":"Wiedergabegeschwindigkeit",Subtitles:cr,"subtitles off":"Untertitel aus",Captions:cs,"captions off":"Untertitel aus",Chapters:cn,"You aborted the media playback":"Sie haben die Videowiedergabe abgebrochen.","A network error caused the media download to fail part-way.":"Der Videodownload ist aufgrund eines Netzwerkfehlers fehlgeschlagen.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Das Video konnte nicht geladen werden, da entweder ein Server- oder Netzwerkfehler auftrat oder das Format nicht unterstützt wird.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"Die Videowiedergabe wurde entweder wegen eines Problems mit einem beschädigten Video oder wegen verwendeten Funktionen, die vom Browser nicht unterstützt werden, abgebrochen.","No compatible source was found for this media.":"Für dieses Video wurde keine kompatible Quelle gefunden.","Play Video":"Video abspielen",Close:ca,"Modal Window":"Modales Fenster","This is a modal window":"Dies ist ein modales Fenster","This modal can be closed by pressing the Escape key or activating the close button.":'Durch Drücken der Esc-Taste bzw. Betätigung der Schaltfläche "Schließen" wird dieses modale Fenster geschlossen.',", opens captions settings dialog":", öffnet Einstellungen für Untertitel",", opens subtitles settings dialog":", öffnet Einstellungen für Untertitel",", selected":", ausgewählt","captions settings":"Untertiteleinstellungen","subtitles settings":"Untertiteleinstellungen","descriptions settings":"Einstellungen für Beschreibungen","Close Modal Dialog":"Modales Fenster schließen",Descriptions:co,"descriptions off":"Beschreibungen aus","The media is encrypted and we do not have the keys to decrypt it.":"Die Entschlüsselungsschlüssel für den verschlüsselten Medieninhalt sind nicht verfügbar.",", opens descriptions settings dialog":", öffnet Einstellungen für Beschreibungen","Audio Track":"Tonspur",Text:cl,White:cu,Black:cd,Red:"Rot",Green:ch,Blue:cc,Yellow:cp,Magenta:cm,Cyan:cg,Background:cf,Window:cy,Transparent:c_,"Semi-Transparent":"Halbdurchsichtig",Opaque:cb,"Font Size":"Schriftgröße","Text Edge Style":"Textkantenstil",None:cv,Raised:cT,Depressed:cS,Uniform:cE,"Drop shadow":"Schlagschatten","Font Family":"Schriftfamilie","Proportional Sans-Serif":"Proportionale Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportionale Serif","Monospace Serif":"Monospace Serif",Casual:cw,Script:cC,"Small Caps":"Small-Caps",Reset:ck,"restore all settings to the default values":"Alle Einstellungen auf die Standardwerte zurücksetzen",Done:cD,"Caption Settings Dialog":"Einstellungsdialog für Untertitel","Beginning of dialog window. Escape will cancel and close the window.":"Anfang des Dialogfensters. Esc bricht ab und schließt das Fenster.","End of dialog window.":"Ende des Dialogfensters.","Audio Player":"Audio-Player","Video Player":"Video-Player","Progress Bar":"Fortschrittsbalken","progress bar timing: currentTime={1} duration={2}":"{1} von {2}","Volume Level":"Lautstärke","{1} is loading.":"{1} wird geladen.","Seek to live, currently behind live":"Zur Live-Übertragung wechseln. Aktuell wird es nicht live abgespielt.","Seek to live, currently playing live":"Zur Live-Übertragung wechseln. Es wird aktuell live abgespielt.","Exit Picture-in-Picture":"Bild-im-Bild-Modus beenden","Picture-in-Picture":"Bild-im-Bild-Modus","No content":"Kein Inhalt",Color:cI,Opacity:cx,"Text Background":"Texthintergrund","Caption Area Background":"Hintergrund des Untertitelbereichs","Playing in Picture-in-Picture":"Wird im Bild-im-Bild-Modus wiedergegeben","Skip forward {1} seconds":"{1} Sekunden vorwärts","Skip backward {1} seconds":"{1} Sekunden zurück"}}),cP="Aus Gründen des Jugendschutzes steht dieser Inhalt nur zwischen 20:00 und 06:00 Uhr zur Verfügung.",cL="Aus Gründen des Jugendschutzes steht dieser Inhalt nur zwischen 23:00 und 05:00 Uhr zur Verfügung.",cO="Die Werbung wurde übersprungen.",cR="Dieser Inhalt ist nicht mehr verfügbar.",cM="Dieser Inhalt ist ausserhalb der Schweiz nicht verfügbar.",cN="Dieser Inhalt ist aus rechtlichen Gründen nicht verfügbar.",cU="Dieser Inhalt ist noch nicht verfügbar. Bitte probieren Sie es später noch einmal.",cB="Dieser Inhalt ist nicht verfügbar.",cF=Object.freeze({__proto__:null,AGERATING12:cP,AGERATING18:cL,COMMERCIAL:cO,ENDDATE:cR,GEOBLOCK:cM,LEGAL:cN,STARTDATE:cU,UNKNOWN:cB,default:{AGERATING12:cP,AGERATING18:cL,COMMERCIAL:cO,ENDDATE:cR,GEOBLOCK:cM,LEGAL:cN,STARTDATE:cU,UNKNOWN:cB}});os.addLanguage("de",hL(hL({},cA),cF));var cq="Play",cj="Pause",c$="Replay",cV="Duration",cH="LIVE",cz="Loaded",cG="Progress",cW="Fullscreen",cK="Mute",cX="Unmute",cY="Subtitles",cQ="Captions",cJ="Chapters",cZ="Descriptions",c0="Close",c1="Text",c2="White",c4="Black",c8="Green",c5="Blue",c3="Yellow",c6="Magenta",c7="Cyan",c9="Background",pe="Window",pt="Transparent",pi="Opaque",pr="None",ps="Raised",pn="Depressed",pa="Uniform",po="Casual",pl="Script",pu="Reset",pd="Done",ph="Color",pc="Opacity",pp=Object.freeze({__proto__:null,Background:c9,Black:c4,Blue:c5,Captions:cQ,Casual:po,Chapters:cJ,Close:c0,Color:ph,Cyan:c7,Depressed:pn,Descriptions:cZ,Done:pd,Duration:cV,Fullscreen:cW,Green:c8,LIVE:cH,Loaded:cz,Magenta:c6,Mute:cK,None:pr,Opacity:pc,Opaque:pi,Pause:cj,Play:cq,Progress:cG,Raised:ps,Red:"Red",Replay:c$,Reset:pu,Script:pl,Subtitles:cY,Text:c1,Transparent:pt,Uniform:pa,Unmute:cX,White:c2,Window:pe,Yellow:c3,default:{"Audio Player":"Audio Player","Video Player":"Video Player",Play:cq,Pause:cj,Replay:c$,"Current Time":"Current Time",Duration:cV,"Remaining Time":"Remaining Time","Stream Type":"Stream Type",LIVE:cH,"Seek to live, currently behind live":"Seek to live, currently behind live","Seek to live, currently playing live":"Seek to live, currently playing live",Loaded:cz,Progress:cG,"Progress Bar":"Progress Bar","progress bar timing: currentTime={1} duration={2}":"{1} of {2}",Fullscreen:cW,"Exit Fullscreen":"Exit Fullscreen",Mute:cK,Unmute:cX,"Playback Rate":"Playback Rate",Subtitles:cY,"subtitles off":"subtitles off",Captions:cQ,"captions off":"captions off",Chapters:cJ,Descriptions:cZ,"descriptions off":"descriptions off","Audio Track":"Audio Track","Volume Level":"Volume Level","You aborted the media playback":"You aborted the media playback","A network error caused the media download to fail part-way.":"A network error caused the media download to fail part-way.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"The media could not be loaded, either because the server or network failed or because the format is not supported.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.","No compatible source was found for this media.":"No compatible source was found for this media.","The media is encrypted and we do not have the keys to decrypt it.":"The media is encrypted and we do not have the keys to decrypt it.","Play Video":"Play Video",Close:c0,"Close Modal Dialog":"Close Modal Dialog","Modal Window":"Modal Window","This is a modal window":"This is a modal window","This modal can be closed by pressing the Escape key or activating the close button.":"This modal can be closed by pressing the Escape key or activating the close button.",", opens captions settings dialog":", opens captions settings dialog",", opens subtitles settings dialog":", opens subtitles settings dialog",", opens descriptions settings dialog":", opens descriptions settings dialog",", selected":", selected","captions settings":"captions settings","subtitles settings":"subtitles settings","descriptions settings":"descriptions settings",Text:c1,White:c2,Black:c4,Red:"Red",Green:c8,Blue:c5,Yellow:c3,Magenta:c6,Cyan:c7,Background:c9,Window:pe,Transparent:pt,"Semi-Transparent":"Semi-Transparent",Opaque:pi,"Font Size":"Font Size","Text Edge Style":"Text Edge Style",None:pr,Raised:ps,Depressed:pn,Uniform:pa,"Drop shadow":"Drop shadow","Font Family":"Font Family","Proportional Sans-Serif":"Proportional Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportional Serif","Monospace Serif":"Monospace Serif",Casual:po,Script:pl,"Small Caps":"Small Caps",Reset:pu,"restore all settings to the default values":"restore all settings to the default values",Done:pd,"Caption Settings Dialog":"Caption Settings Dialog","Beginning of dialog window. Escape will cancel and close the window.":"Beginning of dialog window. Escape will cancel and close the window.","End of dialog window.":"End of dialog window.","{1} is loading.":"{1} is loading.","Exit Picture-in-Picture":"Exit Picture-in-Picture","Picture-in-Picture":"Picture-in-Picture","No content":"No content",Color:ph,Opacity:pc,"Text Background":"Text Background","Caption Area Background":"Caption Area Background","Playing in Picture-in-Picture":"Playing in Picture-in-Picture","Skip backward {1} seconds":"Skip backward {1} seconds","Skip forward {1} seconds":"Skip forward {1} seconds"}}),pm="To protect children this content is only available between 8PM and 6AM.",pg="To protect children this content is only available between 10PM and 5AM.",pf="This commercial content is not available.",py="This content is not available anymore.",p_="This content is not available outside Switzerland.",pb="This content is not available due to legal restrictions.",pv="This content is not available yet.",pT="This content is not available.",pS=Object.freeze({__proto__:null,AGERATING12:pm,AGERATING18:pg,COMMERCIAL:pf,ENDDATE:py,GEOBLOCK:p_,LEGAL:pb,STARTDATE:pv,UNKNOWN:pT,default:{AGERATING12:pm,AGERATING18:pg,COMMERCIAL:pf,ENDDATE:py,GEOBLOCK:p_,LEGAL:pb,STARTDATE:pv,UNKNOWN:pT}});os.addLanguage("en",hL(hL({},pp),pS));var pE="Lecture",pw="Pause",pC="Revoir",pk="Durée",pD="EN DIRECT",pI="Chargé",px="Progression",pA="Plein écran",pP="Mettre en sourdine",pL="Activer le son",pO="Sous-titres",pR="Sous-titres transcrits",pM="Chapitres",pN="Descriptions",pU="Fermer",pB="Texte",pF="Blanc",pq="Noir",pj="Rouge",p$="Vert",pV="Bleu",pH="Jaune",pz="Magenta",pG="Cyan",pW="Arrière-plan",pK="Fenêtre",pX="Transparent",pY="Opaque",pQ="Aucun",pJ="Élevé",pZ="Enfoncé",p0="Uniforme",p1="Manuscrite",p2="Scripte",p4="Réinitialiser",p8="Terminé",p5="Couleur",p3="Opacité",p6=Object.freeze({__proto__:null,Background:pW,Black:pq,Blue:pV,Captions:pR,Casual:p1,Chapters:pM,Close:pU,Color:p5,Cyan:pG,Depressed:pZ,Descriptions:pN,Done:p8,Duration:pk,Fullscreen:pA,Green:p$,LIVE:pD,Loaded:pI,Magenta:pz,Mute:pP,None:pQ,Opacity:p3,Opaque:pY,Pause:pw,Play:pE,Progress:px,Raised:pJ,Red:pj,Replay:pC,Reset:p4,Script:p2,Subtitles:pO,Text:pB,Transparent:pX,Uniform:p0,Unmute:pL,White:pF,Window:pK,Yellow:pH,default:{"Audio Player":"Lecteur audio","Video Player":"Lecteur vidéo",Play:pE,Pause:pw,Replay:pC,"Current Time":"Temps actuel",Duration:pk,"Remaining Time":"Temps restant","Stream Type":"Type de flux",LIVE:pD,"Seek to live, currently behind live":"Rechercher le direct, actuellement après le direct","Seek to live, currently playing live":"Rechercher le direct, le direct actuellement en cours de lecture",Loaded:pI,Progress:px,"Progress Bar":"Barre de progression","progress bar timing: currentTime={1} duration={2}":"{1} de {2}",Fullscreen:pA,"Exit Fullscreen":"Fenêtré",Mute:pP,Unmute:pL,"Playback Rate":"Vitesse de lecture",Subtitles:pO,"subtitles off":"Sous-titres désactivés",Captions:pR,"captions off":"Sous-titres transcrits désactivés",Chapters:pM,Descriptions:pN,"descriptions off":"descriptions désactivées","Audio Track":"Piste audio","Volume Level":"Niveau de volume","You aborted the media playback":"Vous avez interrompu la lecture de la vidéo.","A network error caused the media download to fail part-way.":"Une erreur de réseau a interrompu le téléchargement de la vidéo.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Cette vidéo n'a pas pu être chargée, soit parce que le serveur ou le réseau a échoué ou parce que le format n'est pas reconnu.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"La lecture de la vidéo a été interrompue à cause d'un problème de corruption ou parce que la vidéo utilise des fonctionnalités non prises en charge par votre navigateur.","No compatible source was found for this media.":"Aucune source compatible n'a été trouvée pour cette vidéo.","The media is encrypted and we do not have the keys to decrypt it.":"Le média est chiffré et nous n'avons pas les clés pour le déchiffrer.","Play Video":"Lire la vidéo",Close:pU,"Close Modal Dialog":"Fermer la boîte de dialogue modale","Modal Window":"Fenêtre modale","This is a modal window":"Ceci est une fenêtre modale","This modal can be closed by pressing the Escape key or activating the close button.":"Ce modal peut être fermé en appuyant sur la touche Échap ou activer le bouton de fermeture.",", opens captions settings dialog":", ouvrir les paramètres des sous-titres transcrits",", opens subtitles settings dialog":", ouvrir les paramètres des sous-titres",", opens descriptions settings dialog":", ouvrir les paramètres des descriptions",", selected":", sélectionné","captions settings":"Paramètres des sous-titres transcrits","subtitles settings":"Paramètres des sous-titres","descriptions settings":"Paramètres des descriptions",Text:pB,White:pF,Black:pq,Red:pj,Green:p$,Blue:pV,Yellow:pH,Magenta:pz,Cyan:pG,Background:pW,Window:pK,Transparent:pX,"Semi-Transparent":"Semi-transparent",Opaque:pY,"Font Size":"Taille des caractères","Text Edge Style":"Style des contours du texte",None:pQ,Raised:pJ,Depressed:pZ,Uniform:p0,"Drop shadow":"Ombre portée","Font Family":"Famille de polices","Proportional Sans-Serif":"Polices à chasse variable sans empattement (Proportional Sans-Serif)","Monospace Sans-Serif":"Polices à chasse fixe sans empattement (Monospace Sans-Serif)","Proportional Serif":"Polices à chasse variable avec empattement (Proportional Serif)","Monospace Serif":"Polices à chasse fixe avec empattement (Monospace Serif)",Casual:p1,Script:p2,"Small Caps":"Petites capitales",Reset:p4,"restore all settings to the default values":"Restaurer tous les paramètres aux valeurs par défaut",Done:p8,"Caption Settings Dialog":"Boîte de dialogue des paramètres des sous-titres transcrits","Beginning of dialog window. Escape will cancel and close the window.":"Début de la fenêtre de dialogue. La touche d'échappement annulera et fermera la fenêtre.","End of dialog window.":"Fin de la fenêtre de dialogue.","Exit Picture-in-Picture":"Quitter le mode image dans l'image","Picture-in-Picture":"Image dans l'image","{1} is loading.":"{1} en cours de chargement.","No content":"Aucun contenu",Color:p5,Opacity:p3,"Text Background":"Arrière-plan du texte","Caption Area Background":"Arrière-plan de la zone de sous-titre","Skip backward {1} seconds":"Reculer de {1} secondes","Skip forward {1} seconds":"Avancer de {1} secondes"}}),p7="Pour protéger les enfants, ce contenu est accessible entre 20h et 6h.",p9="Pour protéger les enfants, ce contenu est accessible entre 23h et 5h.",me="Ce contenu n'est actuellement pas disponible.",mt="Ce contenu n'est plus disponible.",mi="La RTS ne dispose pas des droits de diffusion en dehors de la Suisse.",mr="Pour des raisons juridiques, ce contenu n'est pas disponible.",ms="Ce contenu n'est pas encore disponible. Veuillez réessayer plus tard.",mn="Ce contenu n'est actuellement pas disponible.",ma=Object.freeze({__proto__:null,AGERATING12:p7,AGERATING18:p9,COMMERCIAL:me,ENDDATE:mt,GEOBLOCK:mi,LEGAL:mr,STARTDATE:ms,UNKNOWN:mn,default:{AGERATING12:p7,AGERATING18:p9,COMMERCIAL:me,ENDDATE:mt,GEOBLOCK:mi,LEGAL:mr,STARTDATE:ms,UNKNOWN:mn}});os.addLanguage("fr",hL(hL({},p6),ma));var mo="Play",ml="Pausa",mu="Replay",md="Durata",mh="LIVE",mc="Caricato",mp="Stato",mm="Schermo intero",mg="Disattiva l’audio",mf="Attiva l’audio",my="Sottotitoli",m_="Sottotitoli non udenti",mb="Capitolo",mv="Descrizioni",mT="Chiudi",mS="Testo",mE="Bianco",mw="Nero",mC="Rosso",mk="Verde",mD="Giallo",mI="Magenta",mx="Ciano",mA="Sfondo",mP="Finestra",mL="Trasparente",mO="Opaco",mR="Nessuno",mM="Uniforme",mN="Reinizializza",mU="Fatto",mB="Colore",mF="Opacità",mq=Object.freeze({__proto__:null,Background:mA,Black:mw,Blue:"Blu",Captions:m_,Chapters:mb,Close:mT,Color:mB,Cyan:mx,Descriptions:mv,Done:mU,Duration:md,Fullscreen:mm,Green:mk,LIVE:mh,Loaded:mc,Magenta:mI,Mute:mg,None:mR,Opacity:mF,Opaque:mO,Pause:ml,Play:mo,Progress:mp,Red:mC,Replay:mu,Reset:mN,Subtitles:my,Text:mS,Transparent:mL,Uniform:mM,Unmute:mf,White:mE,Window:mP,Yellow:mD,default:{"Audio Player":"Lettore audio","Video Player":"Lettore video",Play:mo,Pause:ml,Replay:mu,"Current Time":"Orario attuale",Duration:md,"Remaining Time":"Tempo rimanente","Stream Type":"Tipo di streaming",LIVE:mh,Loaded:mc,Progress:mp,"Progress Bar":"Barra di avanzamento","progress bar timing: currentTime={1} duration={2}":"{1} di {2}",Fullscreen:mm,"Exit Fullscreen":"Chiudi Schermo intero",Mute:mg,Unmute:mf,"Playback Rate":"Velocità di riproduzione",Subtitles:my,"subtitles off":"Senza sottotitoli",Captions:m_,"captions off":"Senza sottotitoli non udenti",Chapters:mb,Descriptions:mv,"descriptions off":"Descrizioni disattivate","Audio Track":"Traccia audio","Volume Level":"Livello del volume","You aborted the media playback":"La riproduzione del contenuto multimediale è stata interrotta.","A network error caused the media download to fail part-way.":"Il download del contenuto multimediale è stato interrotto a causa di un problema rete.","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Il contenuto multimediale non può essere caricato a causa di un errore nel server o nella rete o perché il formato non viene supportato.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"La riproduzione del contenuto multimediale è stata interrotta a causa di un file danneggiato o per l’utilizzo di impostazioni non supportate dal browser.","No compatible source was found for this media.":"Non ci sono fonti compatibili per questo contenuto multimediale.","The media is encrypted and we do not have the keys to decrypt it.":"Il contenuto multimediale è criptato e non disponiamo delle chiavi per decifrarlo.","Play Video":"Riproduci il video",Close:mT,"Close Modal Dialog":"Chiudi la finestra di dialogo","Modal Window":"Finestra di dialogo","This is a modal window":"Questa è una finestra di dialogo","This modal can be closed by pressing the Escape key or activating the close button.":"Questa finestra di dialogo può essere chiusa premendo sul tasto Esc o attivando il pulsante di chiusura.",", opens captions settings dialog":", aprire i parametri della trascrizione dei sottotitoli",", opens subtitles settings dialog":", aprire i parametri dei sottotitoli",", opens descriptions settings dialog":", aprire i parametri delle descrizioni",", selected":", selezionato","captions settings":"Parametri sottotitoli non udenti","subtitles settings":"Parametri sottotitoli","descriptions settings":"Parametri descrizioni",Text:mS,White:mE,Black:mw,Red:mC,Green:mk,Blue:"Blu",Yellow:mD,Magenta:mI,Cyan:mx,Background:mA,Window:mP,Transparent:mL,"Semi-Transparent":"Semi-Trasparente",Opaque:mO,"Font Size":"Dimensione dei caratteri","Text Edge Style":"Stile dei bordi del testo",None:mR,Uniform:mM,"Drop shadow":"Ombra","Font Family":"Carattere","Proportional Sans-Serif":"Sans-Serif proporzionale","Monospace Sans-Serif":"Sans-Serif monospaziato","Proportional Serif":"Serif proporzionale","Monospace Serif":"Serif monospaziato","Small Caps":"Maiuscoletto",Reset:mN,"restore all settings to the default values":"Ripristina i valori predefiniti per tutti i parametri",Done:mU,"Caption Settings Dialog":"Finestra di dialogo dei parametri della trascrizione dei sottotitoli","Beginning of dialog window. Escape will cancel and close the window.":"Inizio della finestra di dialogo. Il tasto Esc annullerà l’operazione e chiuderà la finestra.","End of dialog window.":"Fine della finestra di dialogo.","{1} is loading.":"{1} in fase di caricamento.","Exit Picture-in-Picture":"Esci dalla modalità Picture-in-Picture","Picture-in-Picture":"Picture-in-Picture",Color:mB,Opacity:mF,"Text Background":"Sfondo testo","Caption Area Background":"Sfondo area sottotitoli","Skip forward {1} seconds":"Avanti {1} secondi","Skip backward {1} seconds":"Indietro {1} secondi"}}),mj="Per proteggere i bambini, questo media è disponibile solo fra le 20 e le 6.",m$="Per proteggere i bambini, questo media è disponibile solo fra le 23 le 5.",mV="Questo contenuto commerciale non è disponibile.",mH="Questo media non è più disponibile.",mz="Questo media non è disponibile fuori dalla Svizzera.",mG="Il contenuto non è fruibile a causa di restrizioni legali.",mW="Il contenuto non è ancora disponibile. Per cortesia prova più tardi.",mK="Questo media non è disponibile.",mX=Object.freeze({__proto__:null,AGERATING12:mj,AGERATING18:m$,COMMERCIAL:mV,ENDDATE:mH,GEOBLOCK:mz,LEGAL:mG,STARTDATE:mW,UNKNOWN:mK,default:{AGERATING12:mj,AGERATING18:m$,COMMERCIAL:mV,ENDDATE:mH,GEOBLOCK:mz,LEGAL:mG,STARTDATE:mW,UNKNOWN:mK}});os.addLanguage("it",hL(hL({},mq),mX));var mY="Laschar ir",mQ="Pausa",mJ="Mussar danovamain",mZ="Durada",m0="LIVE",m1="Chargià",m2="Progress",m4="Entir visur",m8="Senza tun",m5="Cun tun",m3="Suttitels",m6="Suttitels",m7="Chapitels",m9="Descripziuns",ge="Serrar",gt="Text",gi="Nair",gr="Cotschn",gs="Verd",gn="Blau",ga="Mellen",go="Magenta",gl="Cyan",gu="Fund",gd="Fanestra",gh="Transparent",gc="Betg transparent",gp="Nagin",gm="Auzà",gg="Sbassà",gf="Uniform",gy="Sumbriva",g_="Casual",gb="Script",gv="Da nov",gT="Fatg",gS="Per proteger uffants, è quest cuntegn disponibel mo tranter las 20.00 e las 06.00.",gE="Per proteger uffants, è quest cuntegn disponibel mo tranter las 23.00 e las 05.00.",gw="Quest medium commerzial n'è betg disponibel.",gC="Quest cuntegn n'è betg pli disponibel.",gk="Quest cuntegn n'è betg disponibel ordaifer la Svizra.",gD="Quest cuntegn n'è betg disponibel perquai ch'el è scadì.",gI="Quest cuntegn n'è betg anc disponibel. Empruvai pli tard.",gx="Quest cuntegn n'è betg disponibel.",gA=Object.freeze({__proto__:null,AGERATING12:gS,AGERATING18:gE,Background:gu,Black:gi,Blue:gn,COMMERCIAL:gw,Captions:m6,Casual:g_,Chapters:m7,Close:ge,Cyan:gl,Depressed:gg,Descriptions:m9,Done:gT,Dropshadow:gy,Duration:mZ,ENDDATE:gC,Fullscreen:m4,GEOBLOCK:gk,Green:gs,LEGAL:gD,LIVE:m0,Loaded:m1,Magenta:go,Mute:m8,None:gp,Opaque:gc,Pause:mQ,Play:mY,Progress:m2,Raised:gm,Red:gr,Replay:mJ,Reset:gv,STARTDATE:gI,Script:gb,Subtitles:m3,Text:gt,Transparent:gh,UNKNOWN:gx,Uniform:gf,Unmute:m5,White:"Alv",Window:gd,Yellow:ga,default:{"Audio Player":"Audio-Player","Video Player":"Video-Player",Play:mY,Pause:mQ,Replay:mJ,"Current Time":"Temp actual",Duration:mZ,"Remaining Time":"Temp restant","Stream Type":"Tip dal stream",LIVE:m0,Loaded:m1,Progress:m2,"Progress Bar":"Bar da progessiun","progress bar timing: currentTime={1} duration={2}":"{1} da {2}",Fullscreen:m4,"Non-Fullscreen":"Betg entir visur",Mute:m8,Unmute:m5,"Playback Rate":"Tempo ",Subtitles:m3,"subtitles off":"senza suttitels",Captions:m6,"captions off":"senza suttitels",Chapters:m7,Descriptions:m9,"descriptions off":"senza descripziuns","Audio Track":"Piese audio","Volume Level":"Nivel dal volumen","You aborted the media playback":"Vus avais interrut il vdieo","A network error caused the media download to fail part-way.":"In sbagl en la rait ha impedì il download","The media could not be loaded, either because the server or network failed or because the format is not supported.":"Il video n'è betg chargià - ubain per in sbagl da server / da la rait, ubain ch'il format n'è betg cumpatibel.","The media playback was aborted due to a corruption problem or because the media used features your browser did not support.":"Il video è interrut: Ubain ch'il video è donnegià, ubain che funcziuns n'èn betg cumpatiblas.","No compatible source was found for this media.":"Chattà nagina funtauna cumpatibla per quest video.","The media is encrypted and we do not have the keys to decrypt it.":"Il video è codifitgà da moda nunenconuschenta.","Play Video":"Aviar video",Close:ge,"Close Modal Dialog":"Serrar la fanestra modala","Modal Window":"Fanestra modala","This is a modal window":"Quai è ina fanestra modala","This modal can be closed by pressing the Escape key or activating the close button.":'Questa fanestra modala pudais serrar cun la tasta "Escape" ubain cun il buttun.',", opens captions settings dialog":", avra opziuns per ils suttitels",", opens subtitles settings dialog":", avra opziuns per ils suttitels",", opens descriptions settings dialog":", avra opziuns per la descripziun",", selected":", selecziunà","captions settings":"opziuns per ils suttitels","subtitles settings":"opziuns per ils suttitels","descriptions settings":"opziuns per la descripziun",Text:gt,White:"Alv",Black:gi,Red:gr,Green:gs,Blue:gn,Yellow:ga,Magenta:go,Cyan:gl,Background:gu,Window:gd,Transparent:gh,"Semi-Transparent":"Mez transparent",Opaque:gc,"Font Size":"Grandezza dal text","Text Edge Style":"Stil dal text",None:gp,Raised:gm,Depressed:gg,Uniform:gf,Dropshadow:gy,"Font Family":"Scrittira","Proportional Sans-Serif":"Proportionale Sans-Serif","Monospace Sans-Serif":"Monospace Sans-Serif","Proportional Serif":"Proportionale Serif","Monospace Serif":"Monospace Serif",Casual:g_,Script:gb,"Small Caps":"Bustabs pitschens",Reset:gv,"restore all settings to the default values":"Enavos tar las opziuns da standard",Done:gT,"Caption Settings Dialog":"Opziuns per suttitels","Beginning of dialog window. Escape will cancel and close the window.":"Entschatta da la fanestra da dialog. Escape stizza e serra la fanestra.","End of dialog window.":"Fin da la fanestra da dialog.",AGERATING12:gS,AGERATING18:gE,COMMERCIAL:gw,ENDDATE:gC,GEOBLOCK:gk,LEGAL:gD,STARTDATE:gI,UNKNOWN:gx}});os.addLanguage("rm",hL({},gA));const gP=["url","mimeType","keySystems"],gL=["src"];class gO{static addBlockedSegments(e,t=[]){let i="srgssr-blocked-segments",r=e.textTracks().getTrackById(i);if(r&&e.textTracks().removeTrack(r),!Array.isArray(t)||!t.length)return;let s=t.filter(e=>e.blockReason);s.length&&gO.createTextTrack(e,i).then(t=>{s.forEach(e=>{gO.addTextTrackCue(t,e)}),e.textTracks().addTrack(t)})}static addRemoteTextTracks(e,t=[]){Array.isArray(t)&&t.forEach(({type:t,language:i,locale:r,url:s})=>{e.addRemoteTextTrack({kind:"SDH"===t?"captions":"subtitles",label:i,language:r,src:s})})}static addTextTrackCue(e,t){let i=(Number.isFinite(t.markIn)?t.markIn:t.fullLengthMarkIn)/1e3,r=(Number.isFinite(t.markOut)?t.markOut:t.fullLengthMarkOut)/1e3;e.addCue(new VTTCue(i,r,JSON.stringify(t)))}static addTextTracks(e,{mediaData:t}){gO.addRemoteTextTracks(e,t.subtitles),gO.addChapters(e,t.urn,t.chapters),gO.addBlockedSegments(e,t.blockedSegments),gO.addIntervals(e,t.intervals)}static addChapters(e,t,i=[]){let r="srgssr-chapters",s=e.textTracks().getTrackById(r);s&&e.textTracks().removeTrack(s),Array.isArray(i)&&i.length&&gO.createTextTrack(e,r).then(r=>{i.forEach(e=>{t===e.fullLengthUrn&&gO.addTextTrackCue(r,e)}),e.textTracks().addTrack(r)})}static addIntervals(e,t=[]){let i="srgssr-intervals",r=e.textTracks().getTrackById(i);r&&e.textTracks().removeTrack(r),Array.isArray(t)&&t.length&&gO.createTextTrack(e,i).then(i=>{t.forEach(e=>{gO.addTextTrackCue(i,e)}),e.textTracks().addTrack(i)})}static blockingReason(e,t){if(!t.mediaData.blockReason)return;let i=e.localize(t.mediaData.blockReason);return gO.error(e,{code:MediaError.MEDIA_ERR_ABORTED,message:i,metadata:{errorType:t.mediaData.blockReason,src:t}}),!0}static composeAkamaiResources(e=[]){return hR(function*(){return hH.hasToken(e)?hH.tokenizeSources(e):Promise.resolve(e)})()}static composeKeySystemsResources(e=[]){return hj.hasDrm(e),e.map(e=>hL(hL({},e),hj.buildKeySystems(e.drmList)))}static composeMainResources(e){return gO.composeAkamaiResources(gO.composeKeySystemsResources(gO.filterIncompatibleResources(e.getMainResources())))}static composeSrcMediaData({mediaData:e,disableTrackers:t},i){let r=os.obj.merge(i,e),{url:s,mimeType:n,keySystems:a}=r;return{src:s,type:n,keySystems:a,disableTrackers:t,mediaData:hM(r,gP)}}static createTextTrack(e,t){return new Promise(i=>{setTimeout(()=>{i(new os.TextTrack({id:t,kind:"metadata",label:t,tech:e.tech(!0)}))},100)})}static cuechangeEventProxy(e){e.textTracks().on("addtrack",({track:t})=>{["srgssr-chapters","srgssr-intervals"].includes(t.id)&&t.on("cuechange",()=>{let[i]=Array.from(t.activeCues),r=t.id.includes("srgssr-chapters")?"srgssr/chapter":"srgssr/interval";e.trigger({type:r,data:i})})})}static dataProvider(e){if(!e.options().srgOptions.dataProvider){let{dataProviderHost:t,dataProviderUrlHandler:i}=e.options().srgOptions,r=new hU(t).handleRequest(i);e.options({srgOptions:{dataProvider:r}})}return e.options().srgOptions.dataProvider}static dataProviderError(e,t){if(!t)return;let i=t.statusText?t.statusText:t.message;return gO.error(e,{code:0,message:e.localize("UNKNOWN"),metadata:{errorType:"UNKNOWN",urn:e.src(),status:t.status,statusText:i,url:t.url}}),!0}static error(e,{code:t,message:i,metadata:r}){e.error(null),e.error({code:t,message:i,metadata:r})}static filterIncompatibleResources(e=[]){return e.filter(e=>!["RTMP","HDS"].includes(e.streaming))}static getBlockedSegment(e){let t=e.textTracks().getTrackById("srgssr-blocked-segments");if(!t)return;let[i]=Array.from(t.activeCues);return i}static getBlockedSegmentByTime(e,t){let i=gO.getBlockedSegment(e);if(i)return t>=i.startTime&&te===t)||e[0]}static getSrcMediaObj(e,t){return hR(function*(){let{src:i}=t,r=hM(t,gL),s=yield gO.getMediaComposition(i,gO.dataProvider(e)),n=yield gO.composeMainResources(s),a=gO.getMediaData(n);return gO.composeSrcMediaData(r,a)})()}static handleCurrentTime(e,t){let i=gO.getBlockedSegmentByTime(e,t);if(!i||!Number.isFinite(i.endTime))return t;let r=i.endTime+.1;return e.trigger({type:"srgssr/blocked-segment",data:i}),e.currentTime(r),r}static handleSetCurrentTime(e,t){let{endTime:i}=gO.getBlockedSegmentByTime(e,t)||{};return Number.isFinite(i)?i:t}static handleSetSource(e,t,i){return hR(function*(){try{let r=yield gO.getSrcMediaObj(e,t);if(gO.srgAnalytics(e),gO.updateTitleBar(e,r),gO.updatePoster(e,r),gO.blockingReason(e,r))return;return gO.addTextTracks(e,r),i(null,r)}catch(t){if(gO.dataProviderError(e,t))return;return i(t)}})()}static srgAnalytics(e){if(!1!==e.options().trackers.srgAnalytics&&!e.options().trackers.srgAnalytics){let t=new h1(e,{debug:e.debug(),playerVersion:os.VERSION.pillarbox,tagCommanderScriptURL:e.options().srgOptions.tagCommanderScriptURL});e.options({trackers:{srgAnalytics:t}})}}static updatePoster(e,t,i=hF){e.poster(i.scale({url:t.mediaData.imageUrl}))}static updateTitleBar(e,t){e.titleBar&&e.titleBar.update({title:t.mediaData.vendor,description:t.mediaData.title})}static middleware(e){var t;return gO.cuechangeEventProxy(e),{currentTime:t=>gO.handleCurrentTime(e,t),setCurrentTime:t=>gO.handleSetCurrentTime(e,t),setSource:(t=hR(function*(t,i){return gO.handleSetSource(e,t,i)}),function(e,i){return t.apply(this,arguments)})}}}os.use("srgssr/urn",gO.middleware),os.options.srgOptions={dataProvider:void 0,dataProviderHost:void 0,dataProviderUrlHandler:void 0,tagCommanderScriptURL:void 0};var gR={};gR=JSON.parse('{"Skip credits":"Abspann überspringen","Skip intro":"Intro überspringen"}');var gM={};gM=JSON.parse('{"Skip credits":"Skip credits","Skip intro":"Skip intro"}');var gN={};gN=JSON.parse('{"Skip credits":"Passer","Skip intro":"Passer l’intro"}');var gU={};gU=JSON.parse('{"Skip credits":"Salta i credits","Skip intro":"Salta l\'intro"}');var gB={};gB=JSON.parse('{"Skip credits":"Sursiglir credentials","Skip intro":"Sursiglir intro"}'),os.addLanguage("de",gR),os.addLanguage("en",gM),os.addLanguage("fr",gN),os.addLanguage("it",gU),os.addLanguage("rm",gB);const gF=os.getComponent("Button");os.registerComponent("SkipButton",class extends gF{activeInterval;constructor(e,t){super(e,t),this.player().on("srgssr/interval",({data:e})=>this.handleTimeIntervalChange(e))}buildCSSClass(){return`${super.buildCSSClass()} pbw-skip-button vjs-hidden vjs-visible-text`}handleClick(e){super.handleClick(e),this.player().currentTime(this.activeInterval.endTime)}handleTimeIntervalChange(e){if(this.activeInterval=e,!this.activeInterval){this.hide();return}let t="OPENING_CREDITS"===JSON.parse(this.activeInterval.text).type?"Skip intro":"Skip credits";this.controlText(this.localize(t)),this.show()}});const gq=os.getPlugin("plugin");os.registerPlugin("skipButtonPlugin",class extends gq{constructor(e,t){super(e,t),this.player.addChild("SkipButton")}});const gj=new URLSearchParams(location.search),g$=gj.has("debug"),gV=gj.get("ilHost")||void 0,gH=gj.get("language"),gz=gj.get("urn")||"urn:rts:video:14683290";window.player=os("player",{debug:g$,language:gH,srgOptions:{dataProviderHost:gV},plugins:{skipButtonPlugin:!0}}),player.src({src:gz,type:"srgssr/urn"}),window.player=player,window.pillarbox=os; \ No newline at end of file