@srgssr/pillarbox-web 1.12.2 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  var videojs = require('video.js');
4
4
  require('videojs-contrib-eme');
5
5
 
6
- var version = "1.12.1";
6
+ var version = "1.13.0";
7
7
 
8
8
  /**
9
9
  * @ignore
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("video.js");require("videojs-contrib-eme");const t=e.getComponent("player");e.registerComponent("player",class extends t{constructor(t,n,s){super(t,n=e.obj.merge(n,{plugins:{eme:!0}}),s)}audioTrack(e){const t=Array.from(this.player().audioTracks());if(!e)return t.find((e=>e.enabled));const{kind:n,language:s}=e,r=t.find((e=>e.language===s&&e.kind===n))||t.find((e=>e.language===s));return r&&(r.enabled=!0),r}bufferedRanges(){const e=[];for(let t=0;t<this.buffered().length;t++){const n=this.buffered().start(t),s=this.buffered().end(t);e.push({start:n,end:s})}return e}playedPercent(){if(!Number.isFinite(this.duration()))return NaN;let e=0;for(let t=0;t!=this.played().length;t++)e+=this.played().end(t)-this.played().start(t);return e/this.duration()}playedRanges(){const e=[];for(let t=0;t<this.played().length;t++){const n=this.played().start(t),s=this.played().end(t);e.push({start:n,end:s})}return e}seekableRanges(){const e=[];for(let t=0;t<this.seekable().length;t++){const n=this.seekable().start(t),s=this.seekable().end(t);e.push({start:n,end:s})}return e}textTrack(e){const t=Array.from(this.player().textTracks()).filter((e=>!["chapters","metadata"].includes(e.kind)));if(!e)return t.find((e=>"showing"===e.mode));t.forEach((e=>e.mode="disabled"));const{kind:n,language:s}=e;return t.find((e=>(e.language===s&&e.kind===n&&(e.mode="showing"),"showing"===e.mode)))||t.find((e=>(e.language===s&&(e.mode="showing"),"showing"===e.mode)))}});const n=e;n.VERSION={pillarbox:"1.12.1",videojs:e.VERSION,[e.VhsSourceHandler.name]:e.VhsSourceHandler.VERSION,eme:e.getPlugin("eme").VERSION},n.options.enableSmoothSeeking=!0,n.options.fill=!0,n.options.html5={vhs:{useForcedSubtitles:!0}},n.options.liveTracker={trackingThreshold:120,liveTolerance:15},n.options.liveui=!0,n.options.playsinline=!0,n.options.responsive=!0,n.options.trackers={},module.exports=n;
1
+ "use strict";var e=require("video.js");require("videojs-contrib-eme");const t=e.getComponent("player");e.registerComponent("player",class extends t{constructor(t,n,s){super(t,n=e.obj.merge(n,{plugins:{eme:!0}}),s)}audioTrack(e){const t=Array.from(this.player().audioTracks());if(!e)return t.find((e=>e.enabled));const{kind:n,language:s}=e,r=t.find((e=>e.language===s&&e.kind===n))||t.find((e=>e.language===s));return r&&(r.enabled=!0),r}bufferedRanges(){const e=[];for(let t=0;t<this.buffered().length;t++){const n=this.buffered().start(t),s=this.buffered().end(t);e.push({start:n,end:s})}return e}playedPercent(){if(!Number.isFinite(this.duration()))return NaN;let e=0;for(let t=0;t!=this.played().length;t++)e+=this.played().end(t)-this.played().start(t);return e/this.duration()}playedRanges(){const e=[];for(let t=0;t<this.played().length;t++){const n=this.played().start(t),s=this.played().end(t);e.push({start:n,end:s})}return e}seekableRanges(){const e=[];for(let t=0;t<this.seekable().length;t++){const n=this.seekable().start(t),s=this.seekable().end(t);e.push({start:n,end:s})}return e}textTrack(e){const t=Array.from(this.player().textTracks()).filter((e=>!["chapters","metadata"].includes(e.kind)));if(!e)return t.find((e=>"showing"===e.mode));t.forEach((e=>e.mode="disabled"));const{kind:n,language:s}=e;return t.find((e=>(e.language===s&&e.kind===n&&(e.mode="showing"),"showing"===e.mode)))||t.find((e=>(e.language===s&&(e.mode="showing"),"showing"===e.mode)))}});const n=e;n.VERSION={pillarbox:"1.13.0",videojs:e.VERSION,[e.VhsSourceHandler.name]:e.VhsSourceHandler.VERSION,eme:e.getPlugin("eme").VERSION},n.options.enableSmoothSeeking=!0,n.options.fill=!0,n.options.html5={vhs:{useForcedSubtitles:!0}},n.options.liveTracker={trackingThreshold:120,liveTolerance:15},n.options.liveui=!0,n.options.playsinline=!0,n.options.responsive=!0,n.options.trackers={},module.exports=n;
2
2
  //# sourceMappingURL=pillarbox-core.cjs.min.js.map
@@ -1,7 +1,7 @@
1
1
  import videojs from 'video.js';
2
2
  import 'videojs-contrib-eme';
3
3
 
4
- var version = "1.12.1";
4
+ var version = "1.13.0";
5
5
 
6
6
  /**
7
7
  * @ignore
@@ -1,2 +1,2 @@
1
- import e from"video.js";import"videojs-contrib-eme";const t=e.getComponent("player");e.registerComponent("player",class extends t{constructor(t,n,s){super(t,n=e.obj.merge(n,{plugins:{eme:!0}}),s)}audioTrack(e){const t=Array.from(this.player().audioTracks());if(!e)return t.find((e=>e.enabled));const{kind:n,language:s}=e,r=t.find((e=>e.language===s&&e.kind===n))||t.find((e=>e.language===s));return r&&(r.enabled=!0),r}bufferedRanges(){const e=[];for(let t=0;t<this.buffered().length;t++){const n=this.buffered().start(t),s=this.buffered().end(t);e.push({start:n,end:s})}return e}playedPercent(){if(!Number.isFinite(this.duration()))return NaN;let e=0;for(let t=0;t!=this.played().length;t++)e+=this.played().end(t)-this.played().start(t);return e/this.duration()}playedRanges(){const e=[];for(let t=0;t<this.played().length;t++){const n=this.played().start(t),s=this.played().end(t);e.push({start:n,end:s})}return e}seekableRanges(){const e=[];for(let t=0;t<this.seekable().length;t++){const n=this.seekable().start(t),s=this.seekable().end(t);e.push({start:n,end:s})}return e}textTrack(e){const t=Array.from(this.player().textTracks()).filter((e=>!["chapters","metadata"].includes(e.kind)));if(!e)return t.find((e=>"showing"===e.mode));t.forEach((e=>e.mode="disabled"));const{kind:n,language:s}=e;return t.find((e=>(e.language===s&&e.kind===n&&(e.mode="showing"),"showing"===e.mode)))||t.find((e=>(e.language===s&&(e.mode="showing"),"showing"===e.mode)))}});const n=e;n.VERSION={pillarbox:"1.12.1",videojs:e.VERSION,[e.VhsSourceHandler.name]:e.VhsSourceHandler.VERSION,eme:e.getPlugin("eme").VERSION},n.options.enableSmoothSeeking=!0,n.options.fill=!0,n.options.html5={vhs:{useForcedSubtitles:!0}},n.options.liveTracker={trackingThreshold:120,liveTolerance:15},n.options.liveui=!0,n.options.playsinline=!0,n.options.responsive=!0,n.options.trackers={};export{n as default};
1
+ import e from"video.js";import"videojs-contrib-eme";const t=e.getComponent("player");e.registerComponent("player",class extends t{constructor(t,n,s){super(t,n=e.obj.merge(n,{plugins:{eme:!0}}),s)}audioTrack(e){const t=Array.from(this.player().audioTracks());if(!e)return t.find((e=>e.enabled));const{kind:n,language:s}=e,r=t.find((e=>e.language===s&&e.kind===n))||t.find((e=>e.language===s));return r&&(r.enabled=!0),r}bufferedRanges(){const e=[];for(let t=0;t<this.buffered().length;t++){const n=this.buffered().start(t),s=this.buffered().end(t);e.push({start:n,end:s})}return e}playedPercent(){if(!Number.isFinite(this.duration()))return NaN;let e=0;for(let t=0;t!=this.played().length;t++)e+=this.played().end(t)-this.played().start(t);return e/this.duration()}playedRanges(){const e=[];for(let t=0;t<this.played().length;t++){const n=this.played().start(t),s=this.played().end(t);e.push({start:n,end:s})}return e}seekableRanges(){const e=[];for(let t=0;t<this.seekable().length;t++){const n=this.seekable().start(t),s=this.seekable().end(t);e.push({start:n,end:s})}return e}textTrack(e){const t=Array.from(this.player().textTracks()).filter((e=>!["chapters","metadata"].includes(e.kind)));if(!e)return t.find((e=>"showing"===e.mode));t.forEach((e=>e.mode="disabled"));const{kind:n,language:s}=e;return t.find((e=>(e.language===s&&e.kind===n&&(e.mode="showing"),"showing"===e.mode)))||t.find((e=>(e.language===s&&(e.mode="showing"),"showing"===e.mode)))}});const n=e;n.VERSION={pillarbox:"1.13.0",videojs:e.VERSION,[e.VhsSourceHandler.name]:e.VhsSourceHandler.VERSION,eme:e.getPlugin("eme").VERSION},n.options.enableSmoothSeeking=!0,n.options.fill=!0,n.options.html5={vhs:{useForcedSubtitles:!0}},n.options.liveTracker={trackingThreshold:120,liveTolerance:15},n.options.liveui=!0,n.options.playsinline=!0,n.options.responsive=!0,n.options.trackers={};export{n as default};
2
2
  //# sourceMappingURL=pillarbox-core.es.min.js.map
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Pillarbox = factory());
5
5
  })(this, (function () { 'use strict';
6
6
 
7
- var version$8 = "1.12.1";
7
+ var version$8 = "1.13.0";
8
8
 
9
9
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10
10
 
@@ -31,5 +31,5 @@ const Ou=tt,Nu=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,Ru=e=>
31
31
  /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */let t=null;class i{constructor(e){let i,s,n;t||(t=function(){const e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],s=t[4],n=i[4];let r,a,o;const l=[],h=[];let u,d,c,p,m,g;for(r=0;r<256;r++)h[(l[r]=r<<1^283*(r>>7))^r]=r;for(a=o=0;!s[a];a^=u||1,o=h[o]||1)for(p=o^o<<1^o<<2^o<<3^o<<4,p=p>>8^255&p^99,s[a]=p,n[p]=a,c=l[d=l[u=l[a]]],g=16843009*c^65537*d^257*u^16843008*a,m=257*l[p]^16843008*p,r=0;r<4;r++)t[r][a]=m=m<<24^m>>>8,i[r][p]=g=g<<24^g>>>8;for(r=0;r<5;r++)t[r]=t[r].slice(0),i[r]=i[r].slice(0);return e}()),this._tables=[[t[0][0].slice(),t[0][1].slice(),t[0][2].slice(),t[0][3].slice(),t[0][4].slice()],[t[1][0].slice(),t[1][1].slice(),t[1][2].slice(),t[1][3].slice(),t[1][4].slice()]];const r=this._tables[0][4],a=this._tables[1],o=e.length;let l=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");const h=e.slice(0),u=[];for(this._key=[h,u],i=o;i<4*o+28;i++)n=h[i-1],(i%o==0||8===o&&i%o==4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],i%o==0&&(n=n<<8^n>>>24^l<<24,l=l<<1^283*(l>>7))),h[i]=h[i-o]^n;for(s=0;i;s++,i--)n=h[3&s?i:i-4],u[s]=i<=4||s<4?n:a[0][r[n>>>24]]^a[1][r[n>>16&255]]^a[2][r[n>>8&255]]^a[3][r[255&n]]}decrypt(e,t,i,s,n,r){const a=this._key[1];let o,l,h,u=e^a[0],d=s^a[1],c=i^a[2],p=t^a[3];const m=a.length/4-2;let g,f=4;const y=this._tables[1],_=y[0],v=y[1],b=y[2],T=y[3],S=y[4];for(g=0;g<m;g++)o=_[u>>>24]^v[d>>16&255]^b[c>>8&255]^T[255&p]^a[f],l=_[d>>>24]^v[c>>16&255]^b[p>>8&255]^T[255&u]^a[f+1],h=_[c>>>24]^v[p>>16&255]^b[u>>8&255]^T[255&d]^a[f+2],p=_[p>>>24]^v[u>>16&255]^b[d>>8&255]^T[255&c]^a[f+3],f+=4,u=o,d=l,c=h;for(g=0;g<4;g++)n[(3&-g)+r]=S[u>>>24]<<24^S[d>>16&255]<<16^S[c>>8&255]<<8^S[255&p]^a[f++],o=u,u=d,d=c,c=p,p=o}}class s extends e{constructor(){super(e),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))}}const n=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24};class r{constructor(e,t,i,a){const o=r.STEP,l=new Int32Array(e.buffer),h=new Uint8Array(e.byteLength);let u=0;for(this.asyncStream_=new s,this.asyncStream_.push(this.decryptChunk_(l.subarray(u,u+o),t,i,h)),u=o;u<l.length;u+=o)i=new Uint32Array([n(l[u-4]),n(l[u-3]),n(l[u-2]),n(l[u-1])]),this.asyncStream_.push(this.decryptChunk_(l.subarray(u,u+o),t,i,h));this.asyncStream_.push((function(){var e;
32
32
  /*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */a(null,(e=h).subarray(0,e.byteLength-e[e.byteLength-1]))}))}static get STEP(){return 32e3}decryptChunk_(e,t,s,r){return function(){const a=function(e,t,s){const r=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),a=new i(Array.prototype.slice.call(t)),o=new Uint8Array(e.byteLength),l=new Int32Array(o.buffer);let h,u,d,c,p,m,g,f,y;for(h=s[0],u=s[1],d=s[2],c=s[3],y=0;y<r.length;y+=4)p=n(r[y]),m=n(r[y+1]),g=n(r[y+2]),f=n(r[y+3]),a.decrypt(p,m,g,f,l,y),l[y]=n(l[y]^h),l[y+1]=n(l[y+1]^u),l[y+2]=n(l[y+2]^d),l[y+3]=n(l[y+3]^c),h=p,u=m,d=g,c=f;return o}(e,t,s);r.set(a,e.byteOffset)}}}var a,o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};a="undefined"!=typeof window?window:void 0!==o?o:"undefined"!=typeof self?self:{};var l=a.BigInt||Number;l("0x1"),l("0x100"),l("0x10000"),l("0x1000000"),l("0x100000000"),l("0x10000000000"),l("0x1000000000000"),l("0x100000000000000"),l("0x10000000000000000"),function(){var e=new Uint16Array([65484]),t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);255===t[0]||t[0]}();const h=function(e){const t={};return Object.keys(e).forEach((i=>{const s=e[i];var n;n=s,("function"===ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s})),t};self.onmessage=function(e){const t=e.data,i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),s=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),n=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new r(i,s,n,(function(e,i){self.postMessage(h({source:t.source,decrypted:i}),[i.buffer])}))}})));var xp=Yd(Cp);const Ip=e=>{let t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},Ap=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},Dp=(e,t)=>{t.activePlaylistLoader=e,e.load()},Pp={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:i},excludePlaylist:s}=t,n=i.activeTrack(),r=i.activeGroup(),a=(r.filter((e=>e.default))[0]||r[0]).id,o=i.tracks[a];if(n!==o){Iu.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const e in i.tracks)i.tracks[e].enabled=i.tracks[e]===o;i.onTrackChanged()}else s({error:{message:"Problem encountered loading the default audio track."}})},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:i}}=t;Iu.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const s=i.activeTrack();s&&(s.mode="disabled"),i.onTrackChanged()}},Lp={AUDIO:(e,t,i)=>{if(!t)return;const{tech:s,requestOptions:n,segmentLoaders:{[e]:r}}=i;t.on("loadedmetadata",(()=>{const e=t.media();r.playlist(e,n),(!s.paused()||e.endList&&"none"!==s.preload())&&r.load()})),t.on("loadedplaylist",(()=>{r.playlist(t.media(),n),s.paused()||r.load()})),t.on("error",Pp[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:s,requestOptions:n,segmentLoaders:{[e]:r},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",(()=>{const e=t.media();r.playlist(e,n),r.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&r.load()})),t.on("loadedplaylist",(()=>{r.playlist(t.media(),n),s.paused()||r.load()})),t.on("error",Pp[e](e,i))}},Op={AUDIO:(e,t)=>{const{vhs:i,sourceType:s,segmentLoaders:{[e]:n},requestOptions:r,main:{mediaGroups:a},mediaTypes:{[e]:{groups:o,tracks:l,logger_:h}},mainPlaylistLoader:u}=t,d=hd(u.main);a[e]&&0!==Object.keys(a[e]).length||(a[e]={main:{default:{default:!0}}},d&&(a[e].main.default.playlists=u.main.playlists));for(const n in a[e]){o[n]||(o[n]=[]);for(const c in a[e][n]){let p,m=a[e][n][c];if(d?(h(`AUDIO group '${n}' label '${c}' is a main playlist`),m.isMainPlaylist=!0,p=null):p="vhs-json"===s&&m.playlists?new kd(m.playlists[0],i,r):m.resolvedUri?new kd(m.resolvedUri,i,r):m.playlists&&"dash"===s?new Gd(m.playlists[0],i,r,u):null,m=Mu({id:c,playlistLoader:p},m),Lp[e](e,m.playlistLoader,t),o[n].push(m),void 0===l[c]){const e=new Iu.AudioTrack({id:c,kind:Ip(m),enabled:!1,language:m.language,default:m.default,label:c});l[c]=e}}}n.on("error",Pp[e](e,t))},SUBTITLES:(e,t)=>{const{tech:i,vhs:s,sourceType:n,segmentLoaders:{[e]:r},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[e]:{groups:l,tracks:h}},mainPlaylistLoader:u}=t;for(const r in o[e]){l[r]||(l[r]=[]);for(const d in o[e][r]){if(!s.options_.useForcedSubtitles&&o[e][r][d].forced)continue;let c,p=o[e][r][d];if("hls"===n)c=new kd(p.resolvedUri,s,a);else if("dash"===n){if(!p.playlists.filter((e=>e.excludeUntil!==1/0)).length)return;c=new Gd(p.playlists[0],s,a,u)}else"vhs-json"===n&&(c=new kd(p.playlists?p.playlists[0]:p.resolvedUri,s,a));if(p=Mu({id:d,playlistLoader:c},p),Lp[e](e,p.playlistLoader,t),l[r].push(p),void 0===h[d]){const e=i.addRemoteTextTrack({id:d,kind:"subtitles",default:p.default&&p.autoselect,language:p.language,label:d},!1).track;h[d]=e}}}r.on("error",Pp[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{const{tech:i,main:{mediaGroups:s},mediaTypes:{[e]:{groups:n,tracks:r}}}=t;for(const t in s[e]){n[t]||(n[t]=[]);for(const a in s[e][t]){const o=s[e][t][a];if(!/^(?:CC|SERVICE)/.test(o.instreamId))continue;const l=i.options_.vhs&&i.options_.vhs.captionServices||{};let h={label:a,language:o.language,instreamId:o.instreamId,default:o.default&&o.autoselect};if(l[h.instreamId]&&(h=Mu(h,l[h.instreamId])),void 0===h.default&&delete h.default,n[t].push(Mu({id:a},o)),void 0===r[a]){const e=i.addRemoteTextTrack({id:h.instreamId,kind:"captions",default:h.default,language:h.language,label:h.label},!1).track;r[a]=e}}}}},Np=(e,t)=>{for(let i=0;i<e.length;i++){if(od(t,e[i]))return!0;if(e[i].playlists&&Np(e[i].playlists,t))return!0}return!1},Rp={AUDIO:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{const{mediaTypes:{[e]:{tracks:i}}}=t;for(const e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}},Mp=e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{Op[t](t,e)}));const{mediaTypes:t,mainPlaylistLoader:i,tech:s,vhs:n,segmentLoaders:{AUDIO:r,main:a}}=e;["AUDIO","SUBTITLES"].forEach((i=>{t[i].activeGroup=((e,t)=>i=>{const{mainPlaylistLoader:s,mediaTypes:{[e]:{groups:n}}}=t,r=s.media();if(!r)return null;let a=null;r.attributes[e]&&(a=n[r.attributes[e]]);const o=Object.keys(n);if(!a)if("AUDIO"===e&&o.length>1&&hd(t.main))for(let e=0;e<o.length;e++){const t=n[o[e]];if(Np(t,r)){a=t;break}}else n.main?a=n.main:1===o.length&&(a=n[o[0]]);return void 0===i?a:null!==i&&a&&a.filter((e=>e.id===i.id))[0]||null})(i,e),t[i].activeTrack=Rp[i](i,e),t[i].onGroupChanged=((e,t)=>()=>{const{segmentLoaders:{[e]:i,main:s},mediaTypes:{[e]:n}}=t,r=n.activeTrack(),a=n.getActiveGroup(),o=n.activePlaylistLoader,l=n.lastGroup_;a&&l&&a.id===l.id||(n.lastGroup_=a,n.lastTrack_=r,Ap(i,n),a&&!a.isMainPlaylist&&(a.playlistLoader?(i.resyncLoader(),Dp(a.playlistLoader,n)):o&&s.resetEverything()))})(i,e),t[i].onGroupChanging=((e,t)=>()=>{const{segmentLoaders:{[e]:i},mediaTypes:{[e]:s}}=t;s.lastGroup_=null,i.abort(),i.pause()})(i,e),t[i].onTrackChanged=((e,t)=>()=>{const{mainPlaylistLoader:i,segmentLoaders:{[e]:s,main:n},mediaTypes:{[e]:r}}=t,a=r.activeTrack(),o=r.getActiveGroup(),l=r.activePlaylistLoader,h=r.lastTrack_;if((!h||!a||h.id!==a.id)&&(r.lastGroup_=o,r.lastTrack_=a,Ap(s,r),o)){if(o.isMainPlaylist){if(!a||!h||a.id===h.id)return;const e=t.vhs.playlistController_,s=e.selectPlaylist();if(e.media()===s)return;return r.logger_(`track change. Switching main audio from ${h.id} to ${a.id}`),i.pause(),n.resetEverything(),void e.fastQualityChange_(s)}if("AUDIO"===e){if(!o.playlistLoader)return n.setAudio(!0),void n.resetEverything();s.setAudio(!0),n.setAudio(!1)}l!==o.playlistLoader?(s.track&&s.track(a),s.resetEverything(),Dp(o.playlistLoader,r)):Dp(o.playlistLoader,r)}})(i,e),t[i].getActiveGroup=((e,{mediaTypes:t})=>()=>{const i=t[e].activeTrack();return i?t[e].activeGroup(i):null})(i,e)}));const o=t.AUDIO.activeGroup();if(o){const 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),r.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()))}));const l=()=>{t.AUDIO.onTrackChanged(),s.trigger({type:"usage",name:"vhs-audio-change"})};s.audioTracks().addEventListener("change",l),s.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),n.on("dispose",(()=>{s.audioTracks().removeEventListener("change",l),s.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),s.clearTracks("audio");for(const e in t.AUDIO.tracks)s.audioTracks().addTrack(t.AUDIO.tracks[e])};class Up{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_=Ou(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 Bp extends Iu.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Up,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_=Ru("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i)return this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),void this.trigger("error");i.startsWith("data:")?this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1)):(this.steeringManifest.reloadUri=Ou(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){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i)return this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),void this.dispose();this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},((e,t)=>{if(e){if(410===t.status)return this.logger_(`manifest request 410 ${e}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),void this.excludedSteeringManifestURLs.add(i);if(429===t.status){const i=t.responseHeaders["retry-after"];return this.logger_(`manifest request 429 ${e}.`),this.logger_(`content steering will retry in ${i} seconds.`),void this.startTTLTimeout_(parseInt(i,10))}return this.logger_(`manifest failed to load ${e}.`),void this.startTTLTimeout_()}const s=JSON.parse(this.request_.responseText);this.assignSteeringProperties_(s),this.startTTLTimeout_()}))}setProxyServerUrl_(e){const t=new s.URL(e),i=new s.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(s.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new s.URL(e),i=this.getPathway(),n=this.getBandwidth_();if(i){const e=`_${this.manifestType_}_pathway`;t.searchParams.set(e,i)}if(n){const e=`_${this.manifestType_}_throughput`;t.searchParams.set(e,n)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version)return this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),void this.trigger("error");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());const t=(e=>{for(const 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;const t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){const i=this.setProxyServerUrl_(e);if(!t(i))return i}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=1e3*e;this.ttlTimeout_=s.setTimeout((()=>{this.requestSteeringManifest()}),t)}clearTTLTimeout_(){s.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 Up}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&&(Ou(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}let Fp;const qp=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],jp=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]};class $p extends Iu.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:n,bandwidth:r,externVhs:a,useCueTags:o,playlistExclusionDuration:l,enableLowInitialPlaylist:h,sourceType:u,cacheEncryptionKeys:d,bufferBasedABR:c,leastPixelDiffSelector:p,captionServices:m}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:g}=e;null==g&&(g=1/0),Fp=a,this.bufferBasedABR=Boolean(c),this.leastPixelDiffSelector=Boolean(p),this.withCredentials=i,this.tech_=n,this.vhs_=n.vhs,this.sourceType_=u,this.useCueTags_=o,this.playlistExclusionDuration=l,this.maxPlaylistRetries=g,this.enableLowInitialPlaylist=h,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_=(()=>{const e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Xc,activeTrack:Xc,getActiveGroup:Xc,onGroupChanged:Xc,onTrackChanged:Xc,lastTrack_:null,logger_:Ru(`MediaGroups[${t}]`)}})),e})(),this.mediaSource=new s.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_=Uu(),this.hasPlayed_=!1,this.syncController_=new wp(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new xp,this.sourceUpdater_=new mp(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new kp,this.keyStatusMap_=new Map;const 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:r,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:d,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_="dash"===this.sourceType_?new Gd(t,this.vhs_,Mu(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new kd(t,this.vhs_,Mu(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Kc(Mu(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Kc(Mu(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new _p(Mu(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise(((e,t)=>{function i(){n.off("vttjserror",s),e()}function s(){n.off("vttjsloaded",i),t()}n.one("vttjsloaded",i),n.one("vttjserror",s),n.addWebVttScript_()}))}),e);this.contentSteeringController_=new Bp(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_()))),qp.forEach((e=>{this[e+"_"]=jp.bind(this,e)})),this.logger_=Ru("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;const y="none"===this.tech_.preload()?"play":"loadstart";this.tech_.one(y,(()=>{const 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_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const s=this.media(),n=s&&(s.id||s.uri),r=e&&(e.id||e.uri);n&&n!==r&&(this.logger_(`switch media ${n} -> ${r} from ${t}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})),this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,s=this.contentSteeringController_.getPathway();if(i&&s){const t=(i.length?i[0].playlists:i.playlists).filter((e=>e.attributes.serviceLocation===s));t.length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])}}))}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=s.setInterval((()=>this.checkABR_()),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(s.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,s=Object.keys(i);let n;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{const e=i.main||s.length&&i[s[0]];for(const t in e)if(e[t].default){n={label:t};break}}if(!n)return t;const r=[];for(const t in i)if(i[t][n.label]){const s=i[t][n.label];if(s.playlists&&s.playlists.length)r.push.apply(r,s.playlists);else if(s.uri)r.push(s);else if(e.playlists.length)for(let i=0;i<e.playlists.length;i++){const s=e.playlists[i];s.attributes&&s.attributes.AUDIO&&s.attributes.AUDIO===t&&r.push(s)}}return r.length?r:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ad(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()),Mp({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))return;this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial");if(!("vhs-json"===this.sourceType_&&this.initialMedia_.segments))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)})),this.mainPlaylistLoader_.on("error",(()=>{const 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",(()=>{const e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;ad(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",(()=>{const e=this.mainPlaylistLoader_.media();if("playlist-unchanged"===e.lastExcludeReason_)return;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){const i=e.mediaGroups||{};let s=!0;const n=Object.keys(i.AUDIO);for(const e in i.AUDIO)for(const t in i.AUDIO[e]){i.AUDIO[e][t].uri||(s=!1)}s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Fp.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),n.length&&Object.keys(i.AUDIO[n[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){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),s=this.bufferLowWaterLine(),n=this.bufferHighWaterLine();return function({currentPlaylist:e,buffered:t,currentTime:i,nextPlaylist:s,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:a,bufferBasedABR:o,log:l}){if(!s)return Iu.log.warn("We received no playlist to switch to. Please check your stream."),!1;const h=`allowing switch ${e&&e.id||"null"} -> ${s.id}`;if(!e)return l(`${h} as current playlist is not set`),!0;if(s.id===e.id)return!1;const u=Boolean(ju(t,i).length);if(!e.endList)return u||"number"!=typeof e.partTargetDuration?(l(`${h} as current playlist is live`),!0):(l(`not ${h} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);const d=Wu(t,i),c=o?Kd.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Kd.MAX_BUFFER_LOW_WATER_LINE;if(a<c)return l(`${h} as duration < max low water line (${a} < ${c})`),!0;const p=s.attributes.BANDWIDTH,m=e.attributes.BANDWIDTH;if(p<m&&(!o||d<r)){let e=`${h} as next bandwidth < current bandwidth (${p} < ${m})`;return o&&(e+=` and forwardBuffer < bufferHighWaterLine (${d} < ${r})`),l(e),!0}if((!o||p>m)&&d>=n){let e=`${h} as forwardBuffer >= bufferLowWaterLine (${d} >= ${n})`;return o&&(e+=` and next bandwidth > current bandwidth (${p} > ${m})`),l(e),!0}return l(`not ${h} as no switching criteria met`),!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:n,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",(()=>{const 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}))}));const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const 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()){e&&e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(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();const e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const i=t.end(0);let s=i;if(e.start){const n=e.start.timeOffset;s=n<0?Math.max(i+n,t.start(0)):Math.min(i,n)}this.trigger("firstplay"),this.tech_.setCurrentTime(s)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,(e=>{}))}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const 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){const 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;const t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;const i=Fp.Playlist.playlistEnd(e,t),s=this.tech_.currentTime(),n=this.tech_.buffered();if(!n.length)return i-s<=Fu;const r=n.end(n.length-1);return r-s<=Fu&&i-r<=Fu}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e)return this.error=t,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));e.playlistErrors_++;const s=this.mainPlaylistLoader_.main.playlists,n=s.filter(nd),r=1===n.length&&n[0]===e;if(1===s.length&&i!==1/0)return Iu.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(r);if(r){if(this.main().contentSteering){const t=this.pathwayAttribute_(e),i=1e3*this.contentSteeringController_.steeringManifest.ttl;return this.contentSteeringController_.excludePathway(t),this.excludeThenChangePathway_(),void setTimeout((()=>{this.contentSteeringController_.addAvailablePathway(t)}),i)}let t=!1;s.forEach((i=>{if(i===e)return;const s=i.excludeUntil;void 0!==s&&s!==1/0&&(t=!0,delete i.excludeUntil)})),t&&(Iu.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let a;a=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=a,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const o=this.selectPlaylist();if(!o)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");const l=t.internal?this.logger_:Iu.log.warn,h=t.message?" "+t.message:"";l(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${h} 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"]);const u=o.targetDuration/2*1e3||5e3,d="number"==typeof o.lastRequest&&Date.now()-o.lastRequest<=u;return this.switchMedia_(o,"exclude",r||d)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],s="all"===e;(s||"main"===e)&&i.push(this.mainPlaylistLoader_);const n=[];(s||"audio"===e)&&n.push("AUDIO"),(s||"subtitle"===e)&&(n.push("CLOSED-CAPTIONS"),n.push("SUBTITLES")),n.forEach((e=>{const t=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)})),["main","audio","subtitle"].forEach((t=>{const s=this[`${t}SegmentLoader_`];!s||e!==t&&"all"!==e||i.push(s)})),i.forEach((e=>t.forEach((t=>{"function"==typeof e[t]&&e[t]()}))))}setCurrentTime(e){const t=ju(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(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()),void this.load()):0}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Fp.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let t=this.mainPlaylistLoader_.media();if(!t)return;let i=this.syncController_.getExpiredTime(t,this.duration());if(null===i)return;const s=this.mainPlaylistLoader_.main,n=Fp.Playlist.seekable(t,i,Fp.Playlist.liveEdgeDelay(s,t));if(0===n.length)return;if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),i=this.syncController_.getExpiredTime(t,this.duration()),null===i)return;if(e=Fp.Playlist.seekable(t,i,Fp.Playlist.liveEdgeDelay(s,t)),0===e.length)return}let r,a;this.seekable_&&this.seekable_.length&&(r=this.seekable_.end(0),a=this.seekable_.start(0)),e?e.start(0)>n.end(0)||n.start(0)>e.end(0)?this.seekable_=n:this.seekable_=Uu([[e.start(0)>n.start(0)?e.start(0):n.start(0),e.end(0)<n.end(0)?e.end(0):n.end(0)]]):this.seekable_=n,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===r&&this.seekable_.start(0)===a||(this.logger_(`seekable updated [${Hu(this.seekable_)}]`),this.tech_.trigger("seekablechanged"))}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){const e=this.seekable();if(!e.length)return;return void((isNaN(this.mediaSource.duration)||this.mediaSource.duration<e.end(e.length-1))&&this.sourceUpdater_.setDuration(e.end(e.length-1)))}const t=this.tech_.buffered();let i=Fp.Playlist.duration(this.mainPlaylistLoader_.media());t.length>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=>{const t=this.mediaTypes_[e].groups;for(const 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_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=xc(this.main(),t),s={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=i.video||e.main.videoCodec||"avc1.4d400d"),e.main.isMuxed&&(s.video+=`,${i.audio||e.main.audioCodec||Et}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(s.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||Et,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!s.audio&&!s.video)return void this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});const r={};let a;if(["video","audio"].forEach((function(t){if(s.hasOwnProperty(t)&&(i=e[t].isFmp4,n=s[t],!(i?Tt(n):St(n)))){const i=e[t].isFmp4?"browser":"muxer";r[i]=r[i]||[],r[i].push(s[t]),"audio"===t&&(a=i)}var i,n})),n&&a&&t.attributes.AUDIO){const e=t.attributes.AUDIO;this.main().playlists.forEach((i=>{(i.attributes&&i.attributes.AUDIO)===e&&i!==t&&(i.excludeUntil=1/0)})),this.logger_(`excluding audio group ${e} as ${a} does not support codec(s): "${s.audio}"`)}if(!Object.keys(r).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const e=[];if(["video","audio"].forEach((t=>{const i=(_t(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,n=(_t(s[t]||"")[0]||{}).type;i&&n&&i.toLowerCase()!==n.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${s[t]}"`)})),e.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return s}{const e=Object.keys(r).reduce(((e,t)=>(e&&(e+=", "),e+=`${t} does not support codec(s): "${r[t].join(",")}"`)),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:e},playlistExclusionDuration:1/0})}}tryToCreateSourceBuffers_(){if("open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers())return;if(!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach((i=>{const s=e[i];if(-1!==t.indexOf(s.id))return;t.push(s.id);const n=xc(this.main,s),r=[];!n.audio||St(n.audio)||Tt(n.audio)||r.push(`audio codec ${n.audio}`),!n.video||St(n.video)||Tt(n.video)||r.push(`video codec ${n.video}`),n.text&&"stpp.ttml.im1t"===n.text&&r.push(`text codec ${n.text}`),r.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${r.join(", ")}`))}))}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,s=kc(_t(e)),n=Cc(s),r=s.video&&_t(s.video)[0]||null,a=s.audio&&_t(s.audio)[0]||null;Object.keys(i).forEach((e=>{const s=i[e];if(-1!==t.indexOf(s.id)||s.excludeUntil===1/0)return;t.push(s.id);const o=[],l=xc(this.mainPlaylistLoader_.main,s),h=Cc(l);if(l.audio||l.video){if(h!==n&&o.push(`codec count "${h}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const e=l.video&&_t(l.video)[0]||null,t=l.audio&&_t(l.audio)[0]||null;e&&r&&e.type.toLowerCase()!==r.type.toLowerCase()&&o.push(`video codec "${e.type}" !== "${r.type}"`),t&&a&&t.type.toLowerCase()!==a.type.toLowerCase()&&o.push(`audio codec "${t.type}" !== "${a.type}"`)}o.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id}: ${o.join(" && ")}`))}}))}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i=0){if(!e.segments)return;let n,r=i;for(let i=0;i<e.segments.length;i++){const a=e.segments[i];if(n||(n=vp(t,r+a.duration/2)),n){if("cueIn"in a){n.endTime=r,n.adEndTime=r,r+=a.duration,n=null;continue}if(r<n.endTime){r+=a.duration;continue}n.endTime+=a.duration}else if("cueOut"in a&&(n=new s.VTTCue(r,r+a.duration,a.cueOut),n.adStartTime=r,n.adEndTime=r+parseFloat(a.cueOut),t.addCue(n)),"cueOutCont"in a){const[e,i]=a.cueOutCont.split("/").map(parseFloat);n=new s.VTTCue(r,r+a.duration,""),n.adStartTime=r-e,n.adEndTime=n.adStartTime+i,t.addCue(n)}r+=a.duration}}(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Kd.GOAL_BUFFER_LENGTH,i=Kd.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,Kd.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,s)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Kd.BUFFER_LOW_WATER_LINE,i=Kd.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,Kd.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,Kd.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?n:s)}bufferHighWaterLine(){return Kd.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Fc(this.inbandTextTracks_,"com.apple.streaming",this.tech_),(({inbandTextTracks:e,dateRanges:t})=>{const i=e.metadataTrack_;if(!i)return;const n=s.WebKitDataCue||s.VTTCue;t.forEach((e=>{for(const t of Object.keys(e)){if(Bc.has(t))continue;const s=new n(e.startTime,e.endTime,"");s.id=e.id,s.type="com.apple.quicktime.HLS",s.value={key:Uc[t],data:e[t]},"scte35Out"!==t&&"scte35In"!==t||(s.value.data=new Uint8Array(s.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(s)}e.processDateRange()}))})({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Fc(this.inbandTextTracks_,e,this.tech_),Mc({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart?this.contentSteeringController_.requestSteeringManifest(!0):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",(()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const t=this.contentSteeringController_.getAvailablePathways(),i=[];for(const s of e.playlists){const e=s.attributes.serviceLocation;if(e&&(i.push(e),!t.has(e)))return!0}return!(i.length||!t.size)})())&&this.resetContentSteeringController_()}))}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const t=this.main().playlists,i=new Set;let s=!1;Object.keys(t).forEach((n=>{const r=t[n],a=this.pathwayAttribute_(r),o=a&&e!==a;r.excludeUntil===1/0&&"content-steering"===r.lastExcludeReason_&&!o&&(delete r.excludeUntil,delete r.lastExcludeReason_,s=!0);const l=!r.excludeUntil&&r.excludeUntil!==1/0;!i.has(r.id)&&o&&l&&(i.add(r.id),r.excludeUntil=1/0,r.lastExcludeReason_="content-steering",this.logger_(`excluding ${r.id} for ${r.lastExcludeReason_}`))})),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach((t=>{const i=this.mediaTypes_[t];if(i.activePlaylistLoader){const t=i.activePlaylistLoader.media_;t&&t.attributes.serviceLocation!==e&&(s=!0)}})),s&&this.changeSegmentPathway_()}handlePathwayClones_(){const e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||i&&i.size){for(const[e,s]of t.entries()){i.get(e)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(e))}for(const[s,n]of i.entries()){const i=t.get(s);if(i)this.equalPathwayClones_(i,n)||(this.mainPlaylistLoader_.updateOrDeleteClone(n,!0),this.contentSteeringController_.addAvailablePathway(s));else{e.filter((e=>e.attributes["PATHWAY-ID"]===n["BASE-ID"])).forEach((e=>{this.mainPlaylistLoader_.addClonePathway(n,e)})),this.contentSteeringController_.addAvailablePathway(s)}}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;const i=e["URI-REPLACEMENT"].PARAMS,s=t["URI-REPLACEMENT"].PARAMS;for(const e in i)if(i[e]!==s[e])return!1;for(const e in s)if(i[e]!==s[e])return!1;return!0}changeSegmentPathway_(){const 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;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach((i=>{const s=this.mainPlaylistLoader_.getKeyIdSet(i);s&&s.size&&s.forEach((s=>{const n="usable",r=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)===n,a=i.lastExcludeReason_===t&&i.excludeUntil===1/0;r?r&&a&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${s} is ${n}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${s} doesn't exist in the keyStatusMap or is not ${n}`)),e++)}))})),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach((e=>{const i=e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height<720,s=e.excludeUntil===1/0&&e.lastExcludeReason_===t;i&&s&&(delete e.excludeUntil,Iu.log.warn(`enabling non-HD playlist ${e.id} because all playlists were excluded due to ${t} key IDs`))}))}addKeyStatus_(e,t){const i=("string"==typeof e?e:(e=>{const t=new Uint8Array(e);return Array.from(t).map((e=>e.toString(16).padStart(2,"0"))).join("")})(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_()}}class Hp{constructor(e,t,i){const{playlistController_:s}=e,n=s.fastQualityChange_.bind(s);if(t.attributes){const 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"]}var r,a,o;this.codecs=xc(s.main(),t),this.playlist=t,this.id=i,this.enabled=(r=e.playlists,a=t.id,o=n,e=>{const t=r.main.playlists[a],i=sd(t),s=nd(t);return void 0===e?s:(e?delete t.disabled:t.disabled=!0,e===s||i||(o(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})}}const Vp=["seeking","seeked","pause","playing","error"];class zp{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_=Ru("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],l={};o.forEach((e=>{l[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},a[`${e}SegmentLoader_`].on("appendsdone",l[e].updateend),a[`${e}SegmentLoader_`].on("playlistupdate",l[e].reset),this.tech_.on(["seeked","seeking"],l[e].reset)}));const h=e=>{["main","audio"].forEach((t=>{a[`${t}SegmentLoader_`][e]("appended",this.seekingAppendCheck_)}))};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),h("off"))},this.clearSeekingAppendCheck_=()=>h("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),h("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(Vp,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(Vp,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.forEach((e=>{a[`${e}SegmentLoader_`].off("appendsdone",l[e].updateend),a[`${e}SegmentLoader_`].off("playlistupdate",l[e].reset),this.tech_.off(["seeked","seeking"],l[e].reset)})),this.checkCurrentTimeTimeout_&&s.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&s.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=s.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const 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){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],s=i.buffered_(),n=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++)if(e.start(i)!==t.start(i)||e.end(i)!==t.end(i))return!0;return!1}(this[`${e}Buffered_`],s);this[`${e}Buffered_`]=s,n?this.resetSegmentDownloads_(e):(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:Vu(s)}),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;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+Fu>=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_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)){i=e.end(e.length-1)}if(this.beforeSeekableWindow_(e,t)){const t=e.start(0);i=t+(t===e.end(0)?0:Fu)}if(void 0!==i)return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${Hu(e)}. Seeking to ${i}.`),this.tech_.setCurrentTime(i),!0;const s=this.playlistController_.sourceUpdater_,n=this.tech_.buffered(),r=s.audioBuffer?s.audioBuffered():null,a=s.videoBuffer?s.videoBuffered():null,o=this.media(),l=o.partTargetDuration?o.partTargetDuration:2*(o.targetDuration-Bu),h=[r,a];for(let e=0;e<h.length;e++){if(!h[e])continue;if(Wu(h[e],t)<l)return!1}const u=$u(n,t);return 0!==u.length&&(i=u.start(0)+Fu,this.logger_(`Buffered region starts (${u.start(0)}) just beyond seek point (${t}). Seeking to ${i}.`),this.tech_.setCurrentTime(i),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=ju(t,e);return i.length&&e+3<=i.end(0)?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),void this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})):void 0}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const 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}const i=this.tech_.vhs.playlistController_.sourceUpdater_,s=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;const n=$u(s,t);return n.length>0&&(this.logger_(`Stopped at ${t} and seeking to ${n.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let n=e.end(e.length-1)+Fu;const r=!i.endList,a="number"==typeof i.partTargetDuration;return r&&(a||s)&&(n=e.end(e.length-1)+3*i.targetDuration),t>n}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let s;if(e.length&&t.length){const n=ju(e,i-3),r=ju(e,i),a=ju(t,i);a.length&&!r.length&&n.length&&(s={start:n.end(0),end:a.end(0)})}else{$u(e,i).length||(s=this.gapFromVideoUnderflow_(e,i))}return!!s&&(this.logger_(`Encountered a gap in video from ${s.start} to ${s.end}. Seeking to current time ${i}`),!0)}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),s=$u(t,i);this.resetTimeUpdate_(),0!==s.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",s.start(0)),this.tech_.setCurrentTime(s.start(0)+Bu),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}))}gapFromVideoUnderflow_(e,t){const i=function(e){if(e.length<2)return Uu();const t=[];for(let i=1;i<e.length;i++){const s=e.end(i-1),n=e.start(i);t.push([s,n])}return Uu(t)}(e);for(let e=0;e<i.length;e++){const s=i.start(e),n=i.end(e);if(t-s<4&&t-s>2)return{start:s,end:n}}return null}}const Wp={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Gp=function(e,t){let i=0,s=0;const n=Mu(Wp,t);e.ready((()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})}));const r=function(){s&&e.currentTime(s)},a=function(t){null!=t&&(s=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",r),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){if(Date.now()-i<1e3*n.errorInterval)e.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(n.getSource&&"function"==typeof n.getSource)return i=Date.now(),n.getSource.call(e,a);Iu.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},l=function(){e.off("loadedmetadata",r),e.off("error",o),e.off("dispose",l)};e.on("error",o),e.on("dispose",l),e.reloadSourceOnError=function(t){l(),Gp(e,t)}},Kp=function(e){Gp(this,e)};var Xp="3.12.0";const Yp={PlaylistLoader:kd,Playlist:ud,utils:Md,STANDARD_PLAYLIST_SELECTOR:Nc,INITIAL_PLAYLIST_SELECTOR:function(){const e=this.playlists.main.playlists.filter(ud.isEnabled);Pc(e,((e,t)=>Lc(e,t)));return e.filter((e=>!!xc(this.playlists.main,e).video))[0]||null},lastBandwidthSelector:Nc,movingAverageBandwidthSelector:function(e){let t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let n=this.useDevicePixelRatio&&s.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(n=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),Oc(this.playlists.main,t,parseInt(Dc(this.tech_.el(),"width"),10)*n,parseInt(Dc(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:Lc,comparePlaylistResolution:function(e,t){let i,n;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||s.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),n=n||s.Number.MAX_VALUE,i===n&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:xd()};Object.keys(Kd).forEach((e=>{Object.defineProperty(Yp,e,{get:()=>(Iu.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),Kd[e]),set(t){Iu.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0?Iu.log.warn(`value of Vhs.${e} must be greater than or equal to 0`):Kd[e]=t}})}));const Qp="videojs-vhs",Jp=function(e,t){const i=t.media();let s=-1;for(let t=0;t<e.length;t++)if(e[t].id===i.id){s=t;break}e.selectedIndex_=s,e.trigger({selectedIndex:s,type:"change"})};Yp.canPlaySource=function(){return Iu.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const Zp=({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:s})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();const n=((e,t)=>e.reduce(((e,i)=>{if(!i.contentProtection)return e;const s=t.reduce(((e,t)=>{const s=i.contentProtection[t];return s&&s.pssh&&(e[t]={pssh:s.pssh}),e}),{});return Object.keys(s).length&&e.push(s),e}),[]))(i?s.concat([i]):s,Object.keys(t)),r=[],a=[];return n.forEach((t=>{a.push(new Promise(((t,i)=>{e.tech_.one("keysessioncreated",t)}))),r.push(new Promise(((i,s)=>{e.eme.initializeMediaKeys({keySystems:t},(e=>{e?s(e):i()}))})))})),Promise.race([Promise.all(r),Promise.race(a)])},em=({player:e,sourceKeySystems:t,media:i,audioMedia:s})=>{const n=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=kc(_t(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);const n=bt(s.video),r=bt(s.audio),a={};for(const i in e)a[i]={},r&&(a[i].audioContentType=r),n&&(a[i].videoContentType=n),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 Mu(e,a)})(t,i,s);return!!n&&(e.currentSource().keySystems=n,!(n&&!e.eme)||(Iu.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},tm=()=>{if(!s.localStorage)return null;const e=s.localStorage.getItem(Qp);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},im=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},sm=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},nm=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},rm=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};Yp.supportsNativeHls=function(){if(!K||!K.createElement)return!1;const e=K.createElement("video");if(!Iu.getTech("Html5").isSupported())return!1;return["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))}))}(),Yp.supportsNativeDash=!!(K&&K.createElement&&Iu.getTech("Html5").isSupported())&&/maybe|probably/i.test(K.createElement("video").canPlayType("application/dash+xml")),Yp.supportsTypeNatively=e=>"hls"===e?Yp.supportsNativeHls:"dash"===e&&Yp.supportsNativeDash,Yp.isSupported=function(){return Iu.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},Yp.xhr.onRequest=function(e){im(Yp.xhr,e)},Yp.xhr.onResponse=function(e){sm(Yp.xhr,e)},Yp.xhr.offRequest=function(e){nm(Yp.xhr,e)},Yp.xhr.offResponse=function(e){rm(Yp.xhr,e)};const am=Iu.getComponent("Component");class om extends am{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Ru("VhsHandler"),t.options_&&t.options_.playerId){const e=Iu.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 new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(K,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(e=>{const t=K.fullscreenElement||K.webkitFullscreenElement||K.mozFullScreenElement||K.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()})),this.on(this.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1: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_=Mu(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){const e=tm();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=Kd.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Kd.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;const t=this.options_.customPixelRatio;"number"==typeof t&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;var i;this.setOptions_(),this.options_.src=0===(i=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(i.substring(i.indexOf(",")+1)):i,this.options_.tech=this.tech_,this.options_.externVhs=Yp,this.options_.sourceType=Ct(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new $p(this.options_);const n=Mu({liveRangeSafeTimeDelta:Fu},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new zp(n),this.playlistController_.on("error",(()=>{const e=Iu.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}));const r=this.options_.bufferBasedABR?Yp.movingAverageBandwidthSelector(.55):Yp.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=Yp.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;const t=s.navigator.connection||s.navigator.mozConnection||s.navigator.webkitConnection,i=1e7;if(this.options_.useNetworkInformationApi&&t){const s=1e3*t.downlink*1e3;e=s>=i&&e>=i?Math.max(e,s):s}return e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const e=1/(this.bandwidth||1);let t;t=this.throughput>0?1/this.throughput:0;return Math.floor(1/(e+t))},set(){Iu.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:()=>Vu(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:()=>Vu(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&&(e=>{if(!s.localStorage)return!1;let t=tm();t=t?Mu(t,e):e;try{s.localStorage.setItem(Qp,JSON.stringify(t))}catch(e){return!1}})({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})})),this.playlistController_.on("selectedinitialmedia",(()=>{var e;(e=this).representations=()=>{const t=e.playlistController_.main(),i=hd(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((e=>!sd(e))).map(((t,i)=>new Hp(e,t,t.id))):[]}})),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_=s.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Zp({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:Iu.Error.EMEKeySessionCreationError}})}))}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=em({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});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.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){const e=Iu.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",(()=>{!function(e,t){t.representations().forEach((t=>{e.addQualityLevel(t)})),Jp(e,t.playlists)}(this.qualityLevels_,this)})),this.playlists.on("mediachange",(()=>{Jp(this.qualityLevels_,this.playlists)})))}static version(){return{"@videojs/http-streaming":Xp,"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 mp.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_&&s.URL.revokeObjectURL&&(s.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return Ud({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return Bd({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{im(this.xhr,e)},this.xhr.onResponse=e=>{sm(this.xhr,e)},this.xhr.offRequest=e=>{nm(this.xhr,e)},this.xhr.offResponse=e=>{rm(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const lm={name:"videojs-http-streaming",VERSION:Xp,canHandleSource(e,t={}){const i=Mu(Iu.options,t);return lm.canPlayType(e.type,i)},handleSource(e,t,i={}){const s=Mu(Iu.options,i);return t.vhs=new om(e,t,s),t.vhs.xhr=xd(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType(e,t){const i=Ct(e);if(!i)return"";const s=lm.getOverrideNative(t);return!Yp.supportsTypeNatively(i)||s?"maybe":""},getOverrideNative(e={}){const{vhs:t={}}=e,i=!(Iu.browser.IS_ANY_SAFARI||Iu.browser.IS_IOS),{overrideNative:s=i}=t;return s}};
33
33
  /*! @name videojs-contrib-eme @version 3.11.2 @license Apache-2.0 */
34
- function hm(){return hm=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},hm.apply(this,arguments)}Tt("avc1.4d400d,mp4a.40.2")&&Iu.getTech("Html5").registerSourceHandler(lm,0),Iu.VhsHandler=om,Iu.VhsSourceHandler=lm,Iu.Vhs=Yp,Iu.use||Iu.registerComponent("Vhs",Yp),Iu.options.vhs=Iu.options.vhs||{},Iu.getPlugin&&Iu.getPlugin("reloadSourceOnError")||Iu.registerPlugin("reloadSourceOnError",Kp);var um=function(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(var i=new DataView(e),s=new DataView(t),n=0;n<i.byteLength;n++)if(i.getUint8(n)!==s.getUint8(n))return!1;return!0},dm=function(e){return e instanceof Uint8Array||e instanceof Uint16Array?e.buffer:e},cm=function(){for(var e=Iu.obj||Iu,t=e.merge||e.mergeOptions,i=arguments.length,s=new Array(i),n=0;n<i;n++)s[n]=arguments[n];return t.apply(e,s)},pm=function(){var e=cm.apply(void 0,arguments);return Object.keys(e).forEach((function(t){null===e[t]&&delete e[t]})),e},mm=Iu.xhr.httpHandler;mm||(mm=function(e,t){return function(i,s,n){if(i)e(i);else{if(s.statusCode>=400&&s.statusCode<=599){var r=n;return t&&(r=String.fromCharCode.apply(null,new Uint8Array(n))),void e({cause:r})}e(null,n)}}});var gm=function(e,t,i,n){var r=function(e){var t=String.fromCharCode.apply(null,new Uint16Array(e)),i=(new s.DOMParser).parseFromString(t,"application/xml"),n=i.getElementsByTagName("HttpHeaders")[0],r={};if(n)for(var a=n.getElementsByTagName("name"),o=n.getElementsByTagName("value"),l=0;l<a.length;l++)r[a[l].childNodes[0].nodeValue]=o[l].childNodes[0].nodeValue;var h,u=i.getElementsByTagName("Challenge")[0];return u&&(h=s.atob(u.childNodes[0].nodeValue)),i.querySelector("parsererror")&&(r={"Content-Type":"text/xml; charset=utf-8",SOAPAction:'"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense"'},h=e),{headers:r,message:h}}(t),a=r.message,o=pm(r.headers,i.emeHeaders,e.licenseHeaders);Iu.xhr({uri:e.url,method:"post",headers:o,body:a,responseType:"arraybuffer"},mm(n,!0))},fm=function(e){var t;return Object.keys(e).forEach((function(i){var n=function(e){if(e.supportedConfigurations)return e.supportedConfigurations;var t={},i=e.audioContentType,s=e.audioRobustness,n=e.videoContentType,r=e.videoRobustness,a=e.persistentState;return(i||s)&&(t.audioCapabilities=[hm({},i?{contentType:i}:{},s?{robustness:s}:{})]),(n||r)&&(t.videoCapabilities=[hm({},n?{contentType:n}:{},r?{robustness:r}:{})]),a&&(t.persistentState=a),[t]}(e[i]);t=t?t.catch((function(e){return s.navigator.requestMediaKeySystemAccess(i,n)})):s.navigator.requestMediaKeySystemAccess(i,n)})),t},ym=function e(t,i){var s=i.mediaKeys,n=i.initDataType,r=i.initData,a=i.options,o=i.getLicense,l=i.removeSession,h=i.eventBus,u=s.createSession();return h.trigger("keysessioncreated"),t.on("dispose",(function(){u.close()})),new Promise((function(s,d){u.addEventListener("message",(function(e){"license-request"!==e.messageType&&"license-renewal"!==e.messageType||o(a,e.message).then((function(e){s(u.update(e))})).catch((function(e){d(e)}))}),!1),u.addEventListener("keystatuseschange",(function(s){var n=!1;u.keyStatuses.forEach((function(e,t){switch(h.trigger({keyId:t,status:e,target:u,type:"keystatuschange"}),e){case"expired":n=!0;break;case"internal-error":Iu.log.warn('Key status reported as "internal-error." Leaving the session open since we don\'t have enough details to know if this error is fatal.',s)}})),n&&u.close().then((function(){l(r),e(t,i)}))}),!1),u.generateRequest(n,r).catch((function(){d("Unable to create or initialize key session")}))}))},_m=function(e,t){return function(i,s){return new Promise((function(n,r){e(i,s,(function(e,i){t&&t.trigger("licenserequestattempted"),e?r(e):n(i)}))}))}},vm=function(e,t){if("string"==typeof t&&(t={url:t}),!t.url&&!t.getLicense)throw new Error("Neither URL nor getLicense function provided to get license");return t.url&&!t.getLicense&&(t.getLicense="com.microsoft.playready"===e?function(e){return function(t,i,s){gm(e,i,t,s)}}(t):function(e){return function(t,i,s){var n=pm({"Content-type":"application/octet-stream"},t.emeHeaders,e.licenseHeaders);Iu.xhr({uri:e.url,method:"POST",responseType:"arraybuffer",body:i,headers:n},mm(s,!0))}}(t)),t},bm=function(e){var t,i,s=e.player,n=e.video,r=e.initDataType,a=e.initData,o=e.keySystemAccess,l=e.options,h=e.removeSession,u=e.eventBus,d=Promise.resolve();void 0===n.mediaKeysObject&&(n.mediaKeysObject=null,n.pendingSessionData=[],d=new Promise((function(e,s){n.keySystem=o.keySystem,(i=vm(o.keySystem,l.keySystems[o.keySystem])).getCertificate?i.getCertificate(l,(function(i,n){i?s(i):(t=n,e())})):e(o)})).then((function(){return o.createMediaKeys()})).then((function(e){return function(e){var t=e.player,i=e.video,s=e.certificate,n=e.createdMediaKeys;i.mediaKeysObject=n;var r=[];s&&r.push(n.setServerCertificate(s));for(var a=0;a<i.pendingSessionData.length;a++){var o=i.pendingSessionData[a];r.push(ym(t,{mediaKeys:i.mediaKeysObject,initDataType:o.initDataType,initData:o.initData,options:o.options,getLicense:o.getLicense,removeSession:o.removeSession,eventBus:o.eventBus}))}return i.pendingSessionData=[],r.push(i.setMediaKeys(n)),Promise.all(r)}({player:s,video:n,certificate:t,createdMediaKeys:e})})).catch((function(e){return e?Promise.reject(e):Promise.reject("Failed to create and initialize a MediaKeys object")})));return d.then((function(){var e=vm(n.keySystem,l.keySystems[n.keySystem]).getLicense;return function(e){var t=e.player,i=e.video,s=e.initDataType,n=e.initData,r=e.options,a=e.getLicense,o=e.removeSession,l=e.eventBus;return i.mediaKeysObject?ym(t,{mediaKeys:i.mediaKeysObject,initDataType:s,initData:n,options:r,getLicense:a,removeSession:o,eventBus:l}):(i.pendingSessionData.push({initDataType:s,initData:n,options:r,getLicense:a,removeSession:o,eventBus:l}),Promise.resolve())}({player:s,video:n,initDataType:r,initData:a,options:l,getLicense:n.keySystem?_m(e,u):null,removeSession:h,eventBus:u})}))},Tm="com.apple.fps.1_0",Sm=function(e){var t=e.initData,i=e.id,s=e.cert;"string"==typeof i&&(i=function(e){for(var t=new ArrayBuffer(2*e.length),i=new Uint16Array(t),s=0;s<e.length;s++)i[s]=e.charCodeAt(s);return i}(i));var n=0,r=new ArrayBuffer(t.byteLength+4+i.byteLength+4+s.byteLength),a=new DataView(r);new Uint8Array(r,n,t.byteLength).set(t),n+=t.byteLength,a.setUint32(n,i.byteLength,!0),n+=4;var o=new Uint16Array(r,n,i.length);return o.set(i),n+=o.byteLength,a.setUint32(n,s.byteLength,!0),n+=4,new Uint8Array(r,n,s.byteLength).set(s),new Uint8Array(r,0,r.byteLength)},Em=function(e,t){return n=t,i=String.fromCharCode.apply(null,new Uint16Array(n.buffer)),(s=K.createElement("a")).href=i,s.hostname;var i,s,n},wm=function(e){var t=e.video,i=e.initData,n=e.options,r=e.eventBus,a=n.keySystems[Tm],o=a.getCertificate||function(e){return function(t,i){var s=pm(t.emeHeaders,e.certificateHeaders);Iu.xhr({uri:e.certificateUri,responseType:"arraybuffer",headers:s},mm((function(e,t){e?i(e):i(null,new Uint8Array(t))})))}}(a),l=a.getContentId||Em,h=a.getLicense||function(e){return function(t,i,s,n){var r=pm({"Content-type":"application/octet-stream"},t.emeHeaders,e.licenseHeaders);Iu.xhr({uri:e.licenseUri,method:"POST",responseType:"arraybuffer",body:s,headers:r},mm(n,!0))}}(a);return new Promise((function(e,t){o(n,(function(i,s){i?t(i):e(s)}))})).then((function(e){return function(e){var t=e.video,i=e.contentId,n=e.initData,r=e.cert,a=e.options,o=e.getLicense,l=e.eventBus;return new Promise((function(e,h){if(!t.webkitKeys)try{t.webkitSetMediaKeys(new s.WebKitMediaKeys(Tm))}catch(e){return void h("Could not create MediaKeys")}var u;try{u=t.webkitKeys.createSession("video/mp4",Sm({id:i,initData:n,cert:r}))}catch(e){return void h("Could not create key session")}l.trigger("keysessioncreated"),u.contentId=i,u.addEventListener("webkitkeymessage",(function(e){o(a,i,e.message,(function(e,t){l&&l.trigger("licenserequestattempted"),e?h(e):u.update(new Uint8Array(t))}))})),u.addEventListener("webkitkeyadded",(function(){e()})),u.addEventListener("webkitkeyerror",(function(){var e=u.error;h("KeySession error: code "+e.code+", systemCode "+e.systemCode)}))}))}({video:t,cert:e,initData:i,getLicense:h,options:n,contentId:l(n,i),eventBus:r})}))},km="com.microsoft.playready",Cm=function(e,t,i,s){var n=e.msKeys.createSession("video/mp4",t);if(!n)throw new Error("Could not create key session.");s.trigger("keysessioncreated"),n.addEventListener("mskeymessage",(function(e){!function(e,t,i,s){var n=e.keySystems[km];if("function"!=typeof n.getKey){"string"==typeof n?n={url:n}:"boolean"==typeof n&&(n={}),n.url||(n.url=i.destinationURL);var r=function(e,i){s&&s.trigger("licenserequestattempted"),e?s.trigger({message:"Unable to request key from url: "+n.url,target:t,type:"mskeyerror"}):t.update(new Uint8Array(i))};n.getLicense?n.getLicense(e,i.message.buffer,r):gm(n,i.message.buffer,e,r)}else n.getKey(e,i.destinationURL,i.message.buffer,(function(e,i){e?s.trigger({message:"Unable to get key: "+e,target:t,type:"mskeyerror"}):t.update(i)}))}(i,n,e,s)})),n.addEventListener("mskeyerror",(function(e){s.trigger({message:"Unexpected key error from key session with code: "+n.error.code+" and systemCode: "+n.error.systemCode,target:n,type:"mskeyerror"})})),n.addEventListener("mskeyadded",(function(){s.trigger({target:n,type:"mskeyadded"})}))},xm=function(e,t){for(var i=0;i<e.length;i++)if(e[i].initData===t)return void e.splice(i,1)},Im=function(e,t,i,s,n){if(!i||!i.keySystems)return Promise.resolve();var r=t.initData;return fm(i.keySystems).then((function(a){var o=a.keySystem;return i.keySystems[o]&&i.keySystems[o].pssh&&(r=i.keySystems[o].pssh),function(e,t){for(var i=0;i<e.length;i++)if(e[i].initData){var s=dm(e[i].initData),n=dm(t);if(um(s,n))return!0}return!1}(s,r)||!r?Promise.resolve():(s.push({initData:r}),bm({player:e,video:t.target,initDataType:t.initDataType,initData:r,keySystemAccess:a,options:i,removeSession:xm.bind(null,s),eventBus:n}))}))},Am=function(e,t,i,n){if(t.keySystems&&t.keySystems[km]&&!i.reduce((function(e,t){return e||t.playready}),!1)){var r=e.initData;t.keySystems[km]&&t.keySystems[km].pssh&&(r=t.keySystems[km].pssh),r&&(i.push({playready:!0,initData:r}),function(e){var t=e.video,i=e.initData,n=e.options,r=e.eventBus;t.msKeys&&delete t.msKeys;try{t.msSetMediaKeys(new s.MSMediaKeys(km))}catch(e){throw new Error("Unable to create media keys for PlayReady key system. Error: "+e.message)}Cm(t,i,n,r)}({video:e.target,initData:r,options:t,eventBus:n}))}},Dm=function(e){return cm(e.currentSource(),e.eme.options)},Pm=function(e){var t=e.src();t!==e.eme.activeSrc&&(e.eme.activeSrc=t,e.eme.sessions=[])},Lm=function(e,t){if("video"===e.$(".vjs-tech").tagName.toLowerCase())if(Pm(e),s.WebKitMediaKeys){var i=function(i){Pm(e),function(e,t,i){return t.keySystems&&t.keySystems[Tm]&&e.initData?wm({video:e.target,initData:e.initData,options:t,eventBus:i}):Promise.resolve()}(i,Dm(e),e.tech_).catch(t)};e.tech_.el_.addEventListener("webkitneedkey",(function(t){var s=Dm(e).firstWebkitneedkeyTimeout||1e3,n=e.src();e.eme.webkitneedkey_=e.eme.webkitneedkey_||{},e.eme.webkitneedkey_.src!==n&&(e.eme.webkitneedkey_={handledFirstEvent:!1,src:n}),e.eme.webkitneedkey_.handledFirstEvent?i(t):(e.clearTimeout(e.eme.webkitneedkey_.timeout),e.eme.webkitneedkey_.timeout=e.setTimeout((function(){e.eme.webkitneedkey_.handledFirstEvent=!0,e.eme.webkitneedkey_.timeout=null,i(t)}),s))}))}else s.MediaKeys?e.tech_.el_.addEventListener("encrypted",(function(i){Pm(e),Im(e,i,Dm(e),e.eme.sessions,e.tech_).catch(t)})):s.MSMediaKeys&&(e.tech_.el_.addEventListener("msneedkey",(function(i){Pm(e);try{Am(i,Dm(e),e.eme.sessions,e.tech_)}catch(e){t(e)}})),e.tech_.on("mskeyerror",t),e.on("dispose",(function(){e.tech_.off("mskeyerror",t)})))},Om=function(e){void 0===e&&(e={});var t=this,i=function(e){return function(t){var i={code:5};"string"==typeof t?i.message=t:t&&(t.message&&(i.message=t.message),t.cause&&(t.cause.length||t.cause.byteLength)&&(i.cause=t.cause)),e.error(i)}}(t);t.ready((function(){return Lm(t,i)})),t.eme={initializeMediaKeys:function(s,n,r){void 0===s&&(s={}),void 0===n&&(n=function(){}),void 0===r&&(r=!1);var a=cm(t.currentSource(),e,s),o={initDataType:"cenc",initData:null,target:t.tech_.el_};if(Pm(t),t.tech_.el_.setMediaKeys)Im(t,o,a,t.eme.sessions,t.tech_).then((function(){return n()})).catch((function(e){n(e),r||i(e)}));else if(t.tech_.el_.msSetMediaKeys){var l=function e(s){t.tech_.off("mskeyadded",e),t.tech_.off("mskeyerror",e),"mskeyerror"===s.type?(n(s.target.error),r||i(s.message)):n()};t.tech_.one("mskeyadded",l),t.tech_.one("mskeyerror",l);try{Am(o,a,t.eme.sessions,t.tech_)}catch(e){t.tech_.off("mskeyadded",l),t.tech_.off("mskeyerror",l),n(e),r||i(e)}}},options:e}};Iu.registerPlugin("eme",Om),Om.VERSION="3.11.2";const Nm=Iu.getComponent("player");Iu.registerComponent("player",class extends Nm{constructor(e,t,i){super(e,t=Iu.obj.merge(t,{plugins:{eme:!0}}),i)}audioTrack(e){const t=Array.from(this.player().audioTracks());if(!e)return t.find((e=>e.enabled));const{kind:i,language:s}=e,n=t.find((e=>e.language===s&&e.kind===i))||t.find((e=>e.language===s));return n&&(n.enabled=!0),n}bufferedRanges(){const e=[];for(let t=0;t<this.buffered().length;t++){const i=this.buffered().start(t),s=this.buffered().end(t);e.push({start:i,end:s})}return e}playedPercent(){if(!Number.isFinite(this.duration()))return NaN;let e=0;for(let t=0;t!=this.played().length;t++)e+=this.played().end(t)-this.played().start(t);return e/this.duration()}playedRanges(){const e=[];for(let t=0;t<this.played().length;t++){const i=this.played().start(t),s=this.played().end(t);e.push({start:i,end:s})}return e}seekableRanges(){const e=[];for(let t=0;t<this.seekable().length;t++){const i=this.seekable().start(t),s=this.seekable().end(t);e.push({start:i,end:s})}return e}textTrack(e){const t=Array.from(this.player().textTracks()).filter((e=>!["chapters","metadata"].includes(e.kind)));if(!e)return t.find((e=>"showing"===e.mode));t.forEach((e=>e.mode="disabled"));const{kind:i,language:s}=e;return t.find((e=>(e.language===s&&e.kind===i&&(e.mode="showing"),"showing"===e.mode)))||t.find((e=>(e.language===s&&(e.mode="showing"),"showing"===e.mode)))}});const Rm=Iu;return Rm.VERSION={pillarbox:"1.12.1",videojs:Iu.VERSION,[Iu.VhsSourceHandler.name]:Iu.VhsSourceHandler.VERSION,eme:Iu.getPlugin("eme").VERSION},Rm.options.enableSmoothSeeking=!0,Rm.options.fill=!0,Rm.options.html5={vhs:{useForcedSubtitles:!0}},Rm.options.liveTracker={trackingThreshold:120,liveTolerance:15},Rm.options.liveui=!0,Rm.options.playsinline=!0,Rm.options.responsive=!0,Rm.options.trackers={},Rm}));
34
+ function hm(){return hm=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},hm.apply(this,arguments)}Tt("avc1.4d400d,mp4a.40.2")&&Iu.getTech("Html5").registerSourceHandler(lm,0),Iu.VhsHandler=om,Iu.VhsSourceHandler=lm,Iu.Vhs=Yp,Iu.use||Iu.registerComponent("Vhs",Yp),Iu.options.vhs=Iu.options.vhs||{},Iu.getPlugin&&Iu.getPlugin("reloadSourceOnError")||Iu.registerPlugin("reloadSourceOnError",Kp);var um=function(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(var i=new DataView(e),s=new DataView(t),n=0;n<i.byteLength;n++)if(i.getUint8(n)!==s.getUint8(n))return!1;return!0},dm=function(e){return e instanceof Uint8Array||e instanceof Uint16Array?e.buffer:e},cm=function(){for(var e=Iu.obj||Iu,t=e.merge||e.mergeOptions,i=arguments.length,s=new Array(i),n=0;n<i;n++)s[n]=arguments[n];return t.apply(e,s)},pm=function(){var e=cm.apply(void 0,arguments);return Object.keys(e).forEach((function(t){null===e[t]&&delete e[t]})),e},mm=Iu.xhr.httpHandler;mm||(mm=function(e,t){return function(i,s,n){if(i)e(i);else{if(s.statusCode>=400&&s.statusCode<=599){var r=n;return t&&(r=String.fromCharCode.apply(null,new Uint8Array(n))),void e({cause:r})}e(null,n)}}});var gm=function(e,t,i,n){var r=function(e){var t=String.fromCharCode.apply(null,new Uint16Array(e)),i=(new s.DOMParser).parseFromString(t,"application/xml"),n=i.getElementsByTagName("HttpHeaders")[0],r={};if(n)for(var a=n.getElementsByTagName("name"),o=n.getElementsByTagName("value"),l=0;l<a.length;l++)r[a[l].childNodes[0].nodeValue]=o[l].childNodes[0].nodeValue;var h,u=i.getElementsByTagName("Challenge")[0];return u&&(h=s.atob(u.childNodes[0].nodeValue)),i.querySelector("parsererror")&&(r={"Content-Type":"text/xml; charset=utf-8",SOAPAction:'"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense"'},h=e),{headers:r,message:h}}(t),a=r.message,o=pm(r.headers,i.emeHeaders,e.licenseHeaders);Iu.xhr({uri:e.url,method:"post",headers:o,body:a,responseType:"arraybuffer"},mm(n,!0))},fm=function(e){var t;return Object.keys(e).forEach((function(i){var n=function(e){if(e.supportedConfigurations)return e.supportedConfigurations;var t={},i=e.audioContentType,s=e.audioRobustness,n=e.videoContentType,r=e.videoRobustness,a=e.persistentState;return(i||s)&&(t.audioCapabilities=[hm({},i?{contentType:i}:{},s?{robustness:s}:{})]),(n||r)&&(t.videoCapabilities=[hm({},n?{contentType:n}:{},r?{robustness:r}:{})]),a&&(t.persistentState=a),[t]}(e[i]);t=t?t.catch((function(e){return s.navigator.requestMediaKeySystemAccess(i,n)})):s.navigator.requestMediaKeySystemAccess(i,n)})),t},ym=function e(t,i){var s=i.mediaKeys,n=i.initDataType,r=i.initData,a=i.options,o=i.getLicense,l=i.removeSession,h=i.eventBus,u=s.createSession();return h.trigger("keysessioncreated"),t.on("dispose",(function(){u.close()})),new Promise((function(s,d){u.addEventListener("message",(function(e){"license-request"!==e.messageType&&"license-renewal"!==e.messageType||o(a,e.message).then((function(e){s(u.update(e))})).catch((function(e){d(e)}))}),!1),u.addEventListener("keystatuseschange",(function(s){var n=!1;u.keyStatuses.forEach((function(e,t){switch(h.trigger({keyId:t,status:e,target:u,type:"keystatuschange"}),e){case"expired":n=!0;break;case"internal-error":Iu.log.warn('Key status reported as "internal-error." Leaving the session open since we don\'t have enough details to know if this error is fatal.',s)}})),n&&u.close().then((function(){l(r),e(t,i)}))}),!1),u.generateRequest(n,r).catch((function(){d("Unable to create or initialize key session")}))}))},_m=function(e,t){return function(i,s){return new Promise((function(n,r){e(i,s,(function(e,i){t&&t.trigger("licenserequestattempted"),e?r(e):n(i)}))}))}},vm=function(e,t){if("string"==typeof t&&(t={url:t}),!t.url&&!t.getLicense)throw new Error("Neither URL nor getLicense function provided to get license");return t.url&&!t.getLicense&&(t.getLicense="com.microsoft.playready"===e?function(e){return function(t,i,s){gm(e,i,t,s)}}(t):function(e){return function(t,i,s){var n=pm({"Content-type":"application/octet-stream"},t.emeHeaders,e.licenseHeaders);Iu.xhr({uri:e.url,method:"POST",responseType:"arraybuffer",body:i,headers:n},mm(s,!0))}}(t)),t},bm=function(e){var t,i,s=e.player,n=e.video,r=e.initDataType,a=e.initData,o=e.keySystemAccess,l=e.options,h=e.removeSession,u=e.eventBus,d=Promise.resolve();void 0===n.mediaKeysObject&&(n.mediaKeysObject=null,n.pendingSessionData=[],d=new Promise((function(e,s){n.keySystem=o.keySystem,(i=vm(o.keySystem,l.keySystems[o.keySystem])).getCertificate?i.getCertificate(l,(function(i,n){i?s(i):(t=n,e())})):e(o)})).then((function(){return o.createMediaKeys()})).then((function(e){return function(e){var t=e.player,i=e.video,s=e.certificate,n=e.createdMediaKeys;i.mediaKeysObject=n;var r=[];s&&r.push(n.setServerCertificate(s));for(var a=0;a<i.pendingSessionData.length;a++){var o=i.pendingSessionData[a];r.push(ym(t,{mediaKeys:i.mediaKeysObject,initDataType:o.initDataType,initData:o.initData,options:o.options,getLicense:o.getLicense,removeSession:o.removeSession,eventBus:o.eventBus}))}return i.pendingSessionData=[],r.push(i.setMediaKeys(n)),Promise.all(r)}({player:s,video:n,certificate:t,createdMediaKeys:e})})).catch((function(e){return e?Promise.reject(e):Promise.reject("Failed to create and initialize a MediaKeys object")})));return d.then((function(){var e=vm(n.keySystem,l.keySystems[n.keySystem]).getLicense;return function(e){var t=e.player,i=e.video,s=e.initDataType,n=e.initData,r=e.options,a=e.getLicense,o=e.removeSession,l=e.eventBus;return i.mediaKeysObject?ym(t,{mediaKeys:i.mediaKeysObject,initDataType:s,initData:n,options:r,getLicense:a,removeSession:o,eventBus:l}):(i.pendingSessionData.push({initDataType:s,initData:n,options:r,getLicense:a,removeSession:o,eventBus:l}),Promise.resolve())}({player:s,video:n,initDataType:r,initData:a,options:l,getLicense:n.keySystem?_m(e,u):null,removeSession:h,eventBus:u})}))},Tm="com.apple.fps.1_0",Sm=function(e){var t=e.initData,i=e.id,s=e.cert;"string"==typeof i&&(i=function(e){for(var t=new ArrayBuffer(2*e.length),i=new Uint16Array(t),s=0;s<e.length;s++)i[s]=e.charCodeAt(s);return i}(i));var n=0,r=new ArrayBuffer(t.byteLength+4+i.byteLength+4+s.byteLength),a=new DataView(r);new Uint8Array(r,n,t.byteLength).set(t),n+=t.byteLength,a.setUint32(n,i.byteLength,!0),n+=4;var o=new Uint16Array(r,n,i.length);return o.set(i),n+=o.byteLength,a.setUint32(n,s.byteLength,!0),n+=4,new Uint8Array(r,n,s.byteLength).set(s),new Uint8Array(r,0,r.byteLength)},Em=function(e,t){return n=t,i=String.fromCharCode.apply(null,new Uint16Array(n.buffer)),(s=K.createElement("a")).href=i,s.hostname;var i,s,n},wm=function(e){var t=e.video,i=e.initData,n=e.options,r=e.eventBus,a=n.keySystems[Tm],o=a.getCertificate||function(e){return function(t,i){var s=pm(t.emeHeaders,e.certificateHeaders);Iu.xhr({uri:e.certificateUri,responseType:"arraybuffer",headers:s},mm((function(e,t){e?i(e):i(null,new Uint8Array(t))})))}}(a),l=a.getContentId||Em,h=a.getLicense||function(e){return function(t,i,s,n){var r=pm({"Content-type":"application/octet-stream"},t.emeHeaders,e.licenseHeaders);Iu.xhr({uri:e.licenseUri,method:"POST",responseType:"arraybuffer",body:s,headers:r},mm(n,!0))}}(a);return new Promise((function(e,t){o(n,(function(i,s){i?t(i):e(s)}))})).then((function(e){return function(e){var t=e.video,i=e.contentId,n=e.initData,r=e.cert,a=e.options,o=e.getLicense,l=e.eventBus;return new Promise((function(e,h){if(!t.webkitKeys)try{t.webkitSetMediaKeys(new s.WebKitMediaKeys(Tm))}catch(e){return void h("Could not create MediaKeys")}var u;try{u=t.webkitKeys.createSession("video/mp4",Sm({id:i,initData:n,cert:r}))}catch(e){return void h("Could not create key session")}l.trigger("keysessioncreated"),u.contentId=i,u.addEventListener("webkitkeymessage",(function(e){o(a,i,e.message,(function(e,t){l&&l.trigger("licenserequestattempted"),e?h(e):u.update(new Uint8Array(t))}))})),u.addEventListener("webkitkeyadded",(function(){e()})),u.addEventListener("webkitkeyerror",(function(){var e=u.error;h("KeySession error: code "+e.code+", systemCode "+e.systemCode)}))}))}({video:t,cert:e,initData:i,getLicense:h,options:n,contentId:l(n,i),eventBus:r})}))},km="com.microsoft.playready",Cm=function(e,t,i,s){var n=e.msKeys.createSession("video/mp4",t);if(!n)throw new Error("Could not create key session.");s.trigger("keysessioncreated"),n.addEventListener("mskeymessage",(function(e){!function(e,t,i,s){var n=e.keySystems[km];if("function"!=typeof n.getKey){"string"==typeof n?n={url:n}:"boolean"==typeof n&&(n={}),n.url||(n.url=i.destinationURL);var r=function(e,i){s&&s.trigger("licenserequestattempted"),e?s.trigger({message:"Unable to request key from url: "+n.url,target:t,type:"mskeyerror"}):t.update(new Uint8Array(i))};n.getLicense?n.getLicense(e,i.message.buffer,r):gm(n,i.message.buffer,e,r)}else n.getKey(e,i.destinationURL,i.message.buffer,(function(e,i){e?s.trigger({message:"Unable to get key: "+e,target:t,type:"mskeyerror"}):t.update(i)}))}(i,n,e,s)})),n.addEventListener("mskeyerror",(function(e){s.trigger({message:"Unexpected key error from key session with code: "+n.error.code+" and systemCode: "+n.error.systemCode,target:n,type:"mskeyerror"})})),n.addEventListener("mskeyadded",(function(){s.trigger({target:n,type:"mskeyadded"})}))},xm=function(e,t){for(var i=0;i<e.length;i++)if(e[i].initData===t)return void e.splice(i,1)},Im=function(e,t,i,s,n){if(!i||!i.keySystems)return Promise.resolve();var r=t.initData;return fm(i.keySystems).then((function(a){var o=a.keySystem;return i.keySystems[o]&&i.keySystems[o].pssh&&(r=i.keySystems[o].pssh),function(e,t){for(var i=0;i<e.length;i++)if(e[i].initData){var s=dm(e[i].initData),n=dm(t);if(um(s,n))return!0}return!1}(s,r)||!r?Promise.resolve():(s.push({initData:r}),bm({player:e,video:t.target,initDataType:t.initDataType,initData:r,keySystemAccess:a,options:i,removeSession:xm.bind(null,s),eventBus:n}))}))},Am=function(e,t,i,n){if(t.keySystems&&t.keySystems[km]&&!i.reduce((function(e,t){return e||t.playready}),!1)){var r=e.initData;t.keySystems[km]&&t.keySystems[km].pssh&&(r=t.keySystems[km].pssh),r&&(i.push({playready:!0,initData:r}),function(e){var t=e.video,i=e.initData,n=e.options,r=e.eventBus;t.msKeys&&delete t.msKeys;try{t.msSetMediaKeys(new s.MSMediaKeys(km))}catch(e){throw new Error("Unable to create media keys for PlayReady key system. Error: "+e.message)}Cm(t,i,n,r)}({video:e.target,initData:r,options:t,eventBus:n}))}},Dm=function(e){return cm(e.currentSource(),e.eme.options)},Pm=function(e){var t=e.src();t!==e.eme.activeSrc&&(e.eme.activeSrc=t,e.eme.sessions=[])},Lm=function(e,t){if("video"===e.$(".vjs-tech").tagName.toLowerCase())if(Pm(e),s.WebKitMediaKeys){var i=function(i){Pm(e),function(e,t,i){return t.keySystems&&t.keySystems[Tm]&&e.initData?wm({video:e.target,initData:e.initData,options:t,eventBus:i}):Promise.resolve()}(i,Dm(e),e.tech_).catch(t)};e.tech_.el_.addEventListener("webkitneedkey",(function(t){var s=Dm(e).firstWebkitneedkeyTimeout||1e3,n=e.src();e.eme.webkitneedkey_=e.eme.webkitneedkey_||{},e.eme.webkitneedkey_.src!==n&&(e.eme.webkitneedkey_={handledFirstEvent:!1,src:n}),e.eme.webkitneedkey_.handledFirstEvent?i(t):(e.clearTimeout(e.eme.webkitneedkey_.timeout),e.eme.webkitneedkey_.timeout=e.setTimeout((function(){e.eme.webkitneedkey_.handledFirstEvent=!0,e.eme.webkitneedkey_.timeout=null,i(t)}),s))}))}else s.MediaKeys?e.tech_.el_.addEventListener("encrypted",(function(i){Pm(e),Im(e,i,Dm(e),e.eme.sessions,e.tech_).catch(t)})):s.MSMediaKeys&&(e.tech_.el_.addEventListener("msneedkey",(function(i){Pm(e);try{Am(i,Dm(e),e.eme.sessions,e.tech_)}catch(e){t(e)}})),e.tech_.on("mskeyerror",t),e.on("dispose",(function(){e.tech_.off("mskeyerror",t)})))},Om=function(e){void 0===e&&(e={});var t=this,i=function(e){return function(t){var i={code:5};"string"==typeof t?i.message=t:t&&(t.message&&(i.message=t.message),t.cause&&(t.cause.length||t.cause.byteLength)&&(i.cause=t.cause)),e.error(i)}}(t);t.ready((function(){return Lm(t,i)})),t.eme={initializeMediaKeys:function(s,n,r){void 0===s&&(s={}),void 0===n&&(n=function(){}),void 0===r&&(r=!1);var a=cm(t.currentSource(),e,s),o={initDataType:"cenc",initData:null,target:t.tech_.el_};if(Pm(t),t.tech_.el_.setMediaKeys)Im(t,o,a,t.eme.sessions,t.tech_).then((function(){return n()})).catch((function(e){n(e),r||i(e)}));else if(t.tech_.el_.msSetMediaKeys){var l=function e(s){t.tech_.off("mskeyadded",e),t.tech_.off("mskeyerror",e),"mskeyerror"===s.type?(n(s.target.error),r||i(s.message)):n()};t.tech_.one("mskeyadded",l),t.tech_.one("mskeyerror",l);try{Am(o,a,t.eme.sessions,t.tech_)}catch(e){t.tech_.off("mskeyadded",l),t.tech_.off("mskeyerror",l),n(e),r||i(e)}}},options:e}};Iu.registerPlugin("eme",Om),Om.VERSION="3.11.2";const Nm=Iu.getComponent("player");Iu.registerComponent("player",class extends Nm{constructor(e,t,i){super(e,t=Iu.obj.merge(t,{plugins:{eme:!0}}),i)}audioTrack(e){const t=Array.from(this.player().audioTracks());if(!e)return t.find((e=>e.enabled));const{kind:i,language:s}=e,n=t.find((e=>e.language===s&&e.kind===i))||t.find((e=>e.language===s));return n&&(n.enabled=!0),n}bufferedRanges(){const e=[];for(let t=0;t<this.buffered().length;t++){const i=this.buffered().start(t),s=this.buffered().end(t);e.push({start:i,end:s})}return e}playedPercent(){if(!Number.isFinite(this.duration()))return NaN;let e=0;for(let t=0;t!=this.played().length;t++)e+=this.played().end(t)-this.played().start(t);return e/this.duration()}playedRanges(){const e=[];for(let t=0;t<this.played().length;t++){const i=this.played().start(t),s=this.played().end(t);e.push({start:i,end:s})}return e}seekableRanges(){const e=[];for(let t=0;t<this.seekable().length;t++){const i=this.seekable().start(t),s=this.seekable().end(t);e.push({start:i,end:s})}return e}textTrack(e){const t=Array.from(this.player().textTracks()).filter((e=>!["chapters","metadata"].includes(e.kind)));if(!e)return t.find((e=>"showing"===e.mode));t.forEach((e=>e.mode="disabled"));const{kind:i,language:s}=e;return t.find((e=>(e.language===s&&e.kind===i&&(e.mode="showing"),"showing"===e.mode)))||t.find((e=>(e.language===s&&(e.mode="showing"),"showing"===e.mode)))}});const Rm=Iu;return Rm.VERSION={pillarbox:"1.13.0",videojs:Iu.VERSION,[Iu.VhsSourceHandler.name]:Iu.VhsSourceHandler.VERSION,eme:Iu.getPlugin("eme").VERSION},Rm.options.enableSmoothSeeking=!0,Rm.options.fill=!0,Rm.options.html5={vhs:{useForcedSubtitles:!0}},Rm.options.liveTracker={trackingThreshold:120,liveTolerance:15},Rm.options.liveui=!0,Rm.options.playsinline=!0,Rm.options.responsive=!0,Rm.options.trackers={},Rm}));
35
35
  //# sourceMappingURL=pillarbox-core.umd.min.js.map
@@ -110,7 +110,7 @@ function _objectWithoutProperties(source, excluded) {
110
110
  return target;
111
111
  }
112
112
 
113
- var version = "1.12.1";
113
+ var version = "1.13.0";
114
114
 
115
115
  /**
116
116
  * @ignore
@@ -2128,6 +2128,7 @@ var AGERATING18$4 = "Aus Gründen des Jugendschutzes steht dieser Inhalt nur zwi
2128
2128
  var COMMERCIAL$4 = "Die Werbung wurde übersprungen.";
2129
2129
  var ENDDATE$4 = "Dieser Inhalt ist nicht mehr verfügbar.";
2130
2130
  var GEOBLOCK$4 = "Dieser Inhalt ist ausserhalb der Schweiz nicht verfügbar.";
2131
+ var JOURNALISTIC$4 = "Dieser Inhalt steht aus publizistischen Gründen vorübergehend nicht zur Verfügung.";
2131
2132
  var LEGAL$4 = "Dieser Inhalt ist aus rechtlichen Gründen nicht verfügbar.";
2132
2133
  var STARTDATE$4 = "Dieser Inhalt ist noch nicht verfügbar. Bitte probieren Sie es später noch einmal.";
2133
2134
  var UNKNOWN$4 = "Dieser Inhalt ist nicht verfügbar.";
@@ -2137,6 +2138,7 @@ var de = {
2137
2138
  COMMERCIAL: COMMERCIAL$4,
2138
2139
  ENDDATE: ENDDATE$4,
2139
2140
  GEOBLOCK: GEOBLOCK$4,
2141
+ JOURNALISTIC: JOURNALISTIC$4,
2140
2142
  LEGAL: LEGAL$4,
2141
2143
  STARTDATE: STARTDATE$4,
2142
2144
  UNKNOWN: UNKNOWN$4
@@ -2149,6 +2151,7 @@ var pillarboxLang$4 = /*#__PURE__*/Object.freeze({
2149
2151
  COMMERCIAL: COMMERCIAL$4,
2150
2152
  ENDDATE: ENDDATE$4,
2151
2153
  GEOBLOCK: GEOBLOCK$4,
2154
+ JOURNALISTIC: JOURNALISTIC$4,
2152
2155
  LEGAL: LEGAL$4,
2153
2156
  STARTDATE: STARTDATE$4,
2154
2157
  UNKNOWN: UNKNOWN$4,
@@ -2341,6 +2344,7 @@ var AGERATING18$3 = "To protect children this content is only available between
2341
2344
  var COMMERCIAL$3 = "This commercial content is not available.";
2342
2345
  var ENDDATE$3 = "This content is not available anymore.";
2343
2346
  var GEOBLOCK$3 = "This content is not available outside Switzerland.";
2347
+ var JOURNALISTIC$3 = "This content is temporarily unavailable for journalistic reasons.";
2344
2348
  var LEGAL$3 = "This content is not available due to legal restrictions.";
2345
2349
  var STARTDATE$3 = "This content is not available yet.";
2346
2350
  var UNKNOWN$3 = "This content is not available.";
@@ -2350,6 +2354,7 @@ var en = {
2350
2354
  COMMERCIAL: COMMERCIAL$3,
2351
2355
  ENDDATE: ENDDATE$3,
2352
2356
  GEOBLOCK: GEOBLOCK$3,
2357
+ JOURNALISTIC: JOURNALISTIC$3,
2353
2358
  LEGAL: LEGAL$3,
2354
2359
  STARTDATE: STARTDATE$3,
2355
2360
  UNKNOWN: UNKNOWN$3
@@ -2362,6 +2367,7 @@ var pillarboxLang$3 = /*#__PURE__*/Object.freeze({
2362
2367
  COMMERCIAL: COMMERCIAL$3,
2363
2368
  ENDDATE: ENDDATE$3,
2364
2369
  GEOBLOCK: GEOBLOCK$3,
2370
+ JOURNALISTIC: JOURNALISTIC$3,
2365
2371
  LEGAL: LEGAL$3,
2366
2372
  STARTDATE: STARTDATE$3,
2367
2373
  UNKNOWN: UNKNOWN$3,
@@ -2553,6 +2559,7 @@ var AGERATING18$2 = "Pour protéger les enfants, ce contenu est accessible entre
2553
2559
  var COMMERCIAL$2 = "Ce contenu n'est actuellement pas disponible.";
2554
2560
  var ENDDATE$2 = "Ce contenu n'est plus disponible.";
2555
2561
  var GEOBLOCK$2 = "La RTS ne dispose pas des droits de diffusion en dehors de la Suisse.";
2562
+ var JOURNALISTIC$2 = "Ce contenu est temporairement indisponible pour des raisons éditoriales.";
2556
2563
  var LEGAL$2 = "Pour des raisons juridiques, ce contenu n'est pas disponible.";
2557
2564
  var STARTDATE$2 = "Ce contenu n'est pas encore disponible. Veuillez réessayer plus tard.";
2558
2565
  var UNKNOWN$2 = "Ce contenu n'est actuellement pas disponible.";
@@ -2562,6 +2569,7 @@ var fr = {
2562
2569
  COMMERCIAL: COMMERCIAL$2,
2563
2570
  ENDDATE: ENDDATE$2,
2564
2571
  GEOBLOCK: GEOBLOCK$2,
2572
+ JOURNALISTIC: JOURNALISTIC$2,
2565
2573
  LEGAL: LEGAL$2,
2566
2574
  STARTDATE: STARTDATE$2,
2567
2575
  UNKNOWN: UNKNOWN$2
@@ -2574,6 +2582,7 @@ var pillarboxLang$2 = /*#__PURE__*/Object.freeze({
2574
2582
  COMMERCIAL: COMMERCIAL$2,
2575
2583
  ENDDATE: ENDDATE$2,
2576
2584
  GEOBLOCK: GEOBLOCK$2,
2585
+ JOURNALISTIC: JOURNALISTIC$2,
2577
2586
  LEGAL: LEGAL$2,
2578
2587
  STARTDATE: STARTDATE$2,
2579
2588
  UNKNOWN: UNKNOWN$2,
@@ -2750,6 +2759,7 @@ var AGERATING18$1 = "Per proteggere i bambini, questo media è disponibile solo
2750
2759
  var COMMERCIAL$1 = "Questo contenuto commerciale non è disponibile.";
2751
2760
  var ENDDATE$1 = "Questo media non è più disponibile.";
2752
2761
  var GEOBLOCK$1 = "Questo media non è disponibile fuori dalla Svizzera.";
2762
+ var JOURNALISTIC$1 = "Questo contenuto è temporaneamente non disponibile per motivi editoriali.";
2753
2763
  var LEGAL$1 = "Il contenuto non è fruibile a causa di restrizioni legali.";
2754
2764
  var STARTDATE$1 = "Il contenuto non è ancora disponibile. Per cortesia prova più tardi.";
2755
2765
  var UNKNOWN$1 = "Questo media non è disponibile.";
@@ -2759,6 +2769,7 @@ var it = {
2759
2769
  COMMERCIAL: COMMERCIAL$1,
2760
2770
  ENDDATE: ENDDATE$1,
2761
2771
  GEOBLOCK: GEOBLOCK$1,
2772
+ JOURNALISTIC: JOURNALISTIC$1,
2762
2773
  LEGAL: LEGAL$1,
2763
2774
  STARTDATE: STARTDATE$1,
2764
2775
  UNKNOWN: UNKNOWN$1
@@ -2771,6 +2782,7 @@ var pillarboxLang$1 = /*#__PURE__*/Object.freeze({
2771
2782
  COMMERCIAL: COMMERCIAL$1,
2772
2783
  ENDDATE: ENDDATE$1,
2773
2784
  GEOBLOCK: GEOBLOCK$1,
2785
+ JOURNALISTIC: JOURNALISTIC$1,
2774
2786
  LEGAL: LEGAL$1,
2775
2787
  STARTDATE: STARTDATE$1,
2776
2788
  UNKNOWN: UNKNOWN$1,
@@ -2821,6 +2833,7 @@ var AGERATING18 = "Per proteger uffants, è quest cuntegn disponibel mo tranter
2821
2833
  var COMMERCIAL = "Quest medium commerzial n'è betg disponibel.";
2822
2834
  var ENDDATE = "Quest cuntegn n'è betg pli disponibel.";
2823
2835
  var GEOBLOCK = "Quest cuntegn n'è betg disponibel ordaifer la Svizra.";
2836
+ var JOURNALISTIC = "Quest cuntegn na stat ad interim betg a disposiziun per motivs publicistics.";
2824
2837
  var LEGAL = "Quest cuntegn n'è betg disponibel perquai ch'el è scadì.";
2825
2838
  var STARTDATE = "Quest cuntegn n'è betg anc disponibel. Empruvai pli tard.";
2826
2839
  var UNKNOWN = "Quest cuntegn n'è betg disponibel.";
@@ -2912,6 +2925,7 @@ var rm = {
2912
2925
  COMMERCIAL: COMMERCIAL,
2913
2926
  ENDDATE: ENDDATE,
2914
2927
  GEOBLOCK: GEOBLOCK,
2928
+ JOURNALISTIC: JOURNALISTIC,
2915
2929
  LEGAL: LEGAL,
2916
2930
  STARTDATE: STARTDATE,
2917
2931
  UNKNOWN: UNKNOWN
@@ -2939,6 +2953,7 @@ var pillarboxLang = /*#__PURE__*/Object.freeze({
2939
2953
  Fullscreen: Fullscreen,
2940
2954
  GEOBLOCK: GEOBLOCK,
2941
2955
  Green: Green,
2956
+ JOURNALISTIC: JOURNALISTIC,
2942
2957
  LEGAL: LEGAL,
2943
2958
  LIVE: LIVE,
2944
2959
  Loaded: Loaded,
@@ -3149,8 +3164,9 @@ class SrgSsr {
3149
3164
  * @returns {Array.<import('./typedef').MainResourceWithKeySystems>}
3150
3165
  */
3151
3166
  static composeKeySystemsResources(resources = []) {
3152
- if (!Drm.hasDrm(resources)) ;
3153
- return resources.map(resource => _objectSpread2(_objectSpread2({}, resource), Drm.buildKeySystems(resource.drmList)));
3167
+ if (!Drm.hasDrm(resources)) return resources;
3168
+ const resourcesWithKeySystems = resources.map(resource => _objectSpread2(_objectSpread2({}, resource), Drm.buildKeySystems(resource.drmList)));
3169
+ return resourcesWithKeySystems;
3154
3170
  }
3155
3171
 
3156
3172
  /**