@castlabs/prestoplay 6.10.0 → 6.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +112 -112
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +467 -435
  8. package/cjs/cl.crypto.js +9 -10
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +132 -33
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +78 -74
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +274 -274
  17. package/cjs/cl.muxdata.js +14 -14
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +71 -71
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +29 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -20
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +395 -368
  36. package/cl.crypto.js +9 -9
  37. package/cl.dash.js +67 -66
  38. package/cl.externs.js +128 -33
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +64 -61
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +26 -26
  43. package/cl.ima.js +17 -17
  44. package/cl.mse.js +238 -239
  45. package/cl.muxdata.js +12 -12
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +11 -11
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +59 -59
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -15
  58. package/clpp.styles.css +15 -0
  59. package/package.json +1 -1
  60. package/typings.d.ts +202 -19
package/cjs/cl.mse.js CHANGED
@@ -1,282 +1,282 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Yu,Zu,$u,av,bv,cv,dv,ev,fv,gv,hv,kv,lv,ov,pv,qv,rv,sv,uv,wv,yv,zv,Av,Bv,Cv,Ev,Fv,Gv,Jv,Kv,Lv,Mv,Ov,Tv,Uv,Wv,Zv,aw,bw,cw,dw,ew,fw,hw,mw,nw,rw,sw,uw,ww,xw,yw,zw,Aw,Bw,Cw,Ew,Lw,Pw,Rw,Tw,Uw,Vw,Ww,$w,bx,ax,cx,dx,gx,hx,ix,jx,lx,px,nx,rx,sx,tx,ux,wx,vx,xx,zx,Ax,Bx,Dx,Cx,Fx,yx,Gx,Ex,Hx,Nx,Kx,Ix,Lx,Mx,Ox,Px,Sx,Rx,Tx,Ux,Vx,Jx,Wx,Yx,Qx,Zx,$x,ay,by,cy,dy,ey,fy,hy,iy,gy,qy,py,ry,sy,ty,vy,wy,yy,xy,zy,Cy,Ay,By,Ey,Dy,Fy,Gy,Jy,Ly,Ky,My,Ny,Oy,Py,Ry,Sy,Ty,Qy,Vy,Uy,Zy,$y,bz,Yy,Xy,cz,Wy,az,gz,iz,fz,jz,ez,hz,dz,lz,
3
- kz,nz,pz,rz,sz,xz,Az,Cz,Ez,Hz,Jz,Kz,Nz,Dz,Qz,vz,Rz,tz,Pz,Uz,Sz,Mz,Oz,Xz,Wz,Tz,cA,dA,Yz,fA,Zz,aA,iA,hA,bA,gA,jA,uz,Lz,$z,Iz,wz,yz,zz,eA,Fz,Gz,mA,nA,oA,uA,sA,rA,qA,tA,wA,AA,HA,SA,zA,MA,NA,OA,IA,PA,FA,VA,my,ky,ny,ly,oy,jy,$A,YA,KA,GA,RA,aB,ZA,cB,QA,TA,vA,JA,dB,EA,UA,gB,LA,DA,fB,eB,xA,bB,XA,iB,BA,WA,hB,jB,yA,kB,lB,mB,nB,oB,pB,qB,rB,sB,Hv;Yu=" buffer";Zu=" is being or has been set up";$u="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";av="\x3c/LA_URL\x3e";bv="\x3cLA_URL\x3e";cv='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';
4
- dv="CHECKSUM";ev="Choosing new streams after key status change";fv="IterateSegmentReference";gv="Jumping forward";hv="MediaSource threw QuotaExceededError:";_.iv="No stream with id";_.jv="Player is in ERROR state and can not switch to ";kv="PrestoPlay TextTrack";lv="Removing audio from variant - audio not compatible with platform";_.mv="Updating manifest...";_.nv="VOD";ov="bufferBehind\x3d";pv="bufferedBehind\x3d";qv="calling onCanSwitch()...";rv="cannot find segment";sv="clpp.mse.Player";uv="currentPeriod.startTime\x3d";
5
- _.vv="getSegmentNextReference";wv="key-restriction";_.xv="onChooseStreams_";yv="presentationTime:";zv="presentationTime\x3d";Av="reference.endTime\x3d";Bv="reference.position\x3d";Cv="reference.startTime\x3d";_.Dv="subtitles";Ev="switch: Stream ";Fv=function(a,b){for(var c in a.a)b(c,a.a[c])};Gv=function(a){for(var b=a.a+a.f.byteOffset,c=void 0;_.Gk(a);)if(0===_.Ik(a)){c=a.a+a.f.byteOffset-1;break}a=a.f.buffer.slice(b,c);return _.yh(a)};
6
- _.Iv=function(a){var b=new Uint8Array(Hv),c=4+b.byteLength+a.j.byteLength+4+a.f.byteLength,d=new _.Ck(c,!1);_.T(d,c);_.Ek(d,b);_.Ek(d,a.j);_.T(d,a.f.byteLength);_.Ek(d,a.f);return _.N(d.buffer)};Jv=function(a,b){a:{if(b){var c=_.u(a.f.keys());for(var d=c.next();!d.done;d=c.next()){d=a.f.get(d.value);for(var e=0;e<d.gb.length;e++)if(d.gb[e]===b){c=d;break a}}}c=null}return c?c.Fa:null};Kv=function(a,b){return _.cj("Edge/")?!0:a.M.has(b)};
7
- Lv=function(a,b){var c=a.m.get(b);return!(!c||c!==_.Ud&&c!==_.pd)};Mv=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&!Kv(a,_.Xi(c.mimeType,c.codecs))||d&&d.encrypted&&!Kv(a,_.Xi(d.mimeType,d.codecs)))return!1;var e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem==e})};_.Nv=function(a,b){return a.concat(b)};Ov=function(){};
8
- _.Pv=function(a,b){if(0==b.length)return a;var c=b.map(function(d){return new _.Pg(d)});return a.map(function(d){return new _.Pg(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.Nv,[]).map(function(d){return d.toString()})};_.Qv=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
9
- _.Rv=function(a,b,c,d,e){this.Oa=a;this.ua=b;this.ea=c;this.keyInfo=d||null;this.Hc=_.K.R(e)?!1:!!e};
10
- _.Sv=function(a,b,c,d,e,f,g,h,l,m,n,p,q,r){l=void 0===l?!1:l;m=void 0===m?null:m;n=void 0===n?null:n;p=void 0===p?null:p;q=void 0===q?null:q;r=void 0===r?[]:r;this.position=a;this.startTime=b;this.endTime=c;this.ta=g;this.Oa=d;this.ua=e;this.ea=f;this.keyInfo=(void 0===h?null:h)||null;this.Hc=_.K.R(l)?!1:!!l;this.timescale=m;this.horizontalTiles=n;this.verticalTiles=p;this.durationPerTile=q;this.a=r||[];this.g=!1};
11
- Tv=function(a,b){a=_.ih(a);b=_.ih(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};Uv=function(a){return a.language?_.ih(a.language):a.audio&&a.audio.language?_.ih(a.audio.language):a.video&&a.video.language?_.ih(a.video.language):_.Ie};
12
- _.Vv=function(a,b){for(var c=_.ih(a),d=new Set,e=_.u(b),f=e.next();!f.done;f=e.next())d.add(_.ih(f.value));e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,f==c)return f;e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,Tv(f,c))return f;e=_.u(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,h=c;g=_.ih(g);h=_.ih(h);g=g.split("-");h=h.split("-");if(2==g.length&&2==h.length&&g[0]==h[0])return f}d=_.u(d);for(f=d.next();!f.done;f=d.next())if(e=f.value,Tv(c,e))return e;return null};
13
- Wv=function(a,b){for(var c in b)if(b[c]===a)return c;return""};
14
- _.Xv=function(a,b){if(!a.length)return b;if(!b.length)return a;for(var c=[],d=0;d<a.length;d++)for(var e={},f=0;f<b.length;e={Wc:e.Wc},f++)if(a[d].keySystem===b[f].keySystem&&a[d].periodId===b[f].periodId){var g=a[d];f=b[f];var h=[];h=h.concat(g.initData||[]);h=h.concat(f.initData||[]);e.Wc=_.of(g.keyIds||[]).concat();f.keyIds&&f.keyIds.length&&f.keyIds.forEach(function(l){return function(m){l.Wc.includes(m)||l.Wc.push(m)}}(e));c.push({keySystem:g.keySystem,licenseServerUri:g.licenseServerUri||f.licenseServerUri,
15
- distinctiveIdentifierRequired:g.distinctiveIdentifierRequired||f.distinctiveIdentifierRequired,persistentStateRequired:g.persistentStateRequired||f.persistentStateRequired,videoRobustness:g.videoRobustness||f.videoRobustness,audioRobustness:g.audioRobustness||f.audioRobustness,serverCertificate:g.serverCertificate||f.serverCertificate,initData:h,keyIds:e.Wc,periodId:g.periodId});break}return c};_.Yv=function(a,b){return a.length&&b.length?0<_.Xv(a,b).length:!0};
16
- Zv=function(a,b){for(var c=0,d=_.u(a),e=d.next();!e.done;e=d.next())c+=b(e.value)?1:0;return c};_.$v=function(a){if(_.tq.has(a))return _.tq.get(a);if(window.ManagedMediaSource){var b=ManagedMediaSource.isTypeSupported(a);_.tq.set(a,b);return b}return window.MediaSource?(b=MediaSource.isTypeSupported(a),_.tq.set(a,b),b):!1};
17
- aw=function(){this.a=new muxjs.mp4.Transmuxer({keepOriginalTimestamps:!0,remux:!1});this.f=null;this.o=[];this.m=[];this.g=[];this.j=!1;this.a.on("data",this.A.bind(this));this.a.on("done",this.w.bind(this))};bw=function(a,b){a.j=!0;a.f=new _.fi;a.o=[];a.m=[];a.g=[];var c=_.N(b);a.a.push(c);a.a.flush();a.j&&a.f.reject(new _.L(_.M,3,3018));return a.f};
18
- cw=function(a,b){var c=b.replace(/mp2t/i,_.Gd);a==_.mc&&(c=c.replace(_.Re,_.mc));var d=/avc1\.(66|77|100)\.(\d+)/.exec(c);if(d){var e="avc1.",f=d[1],g=Number(d[2]);e=("66"==f?e+"4200":"77"==f?e+"4d00":e+"6400")+(g>>4).toString(16);e+=(g&15).toString(16);c=c.replace(d[0],e)}return c};
19
- dw=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?_.$v(cw(b,a))||_.$v(a.replace(/aac/i,_.Gd)):_.$v(cw(_.mc,a))||_.$v(a.replace(/aac/i,_.Gd))||_.$v(cw(_.Re,a))};
20
- ew=function(a,b){var c=new Map;c.set(a,b);try{var d=b.match(/"(.*?)"/)[0].replace(/"/g,"").split(","),e=new Map;if(1<d.length)for(var f=_.u(d),g=f.next();!g.done;g=f.next()){var h=g.value;h.startsWith("avc")?e.set(_.Re,'video/mp4;codecs\x3d"'+h+'"'):h.startsWith("mp4a")&&e.set(_.mc,'audio/mp4;codecs\x3d"'+h+'"')}return 0<e.size?e:c}catch(l){return c}};fw=function(a){var b=[a.mimeType];_.uq.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};
21
- _.gw=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};hw=function(a,b){for(var c=new _.Zj(void 0,void 0===b?"total":b),d=_.u(a),e=d.next();!e.done;e=d.next())c.a.push(e.value);c.length=a.length;return c};_.iw=function(a,b){return Array.prototype.filter.call(a.childNodes,function(c){return c instanceof Element&&c.tagName==b})};_.jw=function(a,b){var c=_.iw(a,b);return 1!=c.length?null:c[0]};
22
- _.kw=function(a){return Array.prototype.every.call(a.childNodes,function(b){return b.nodeType==Node.TEXT_NODE||b.nodeType==Node.CDATA_SECTION_NODE})?a.textContent.trim():null};_.lw=function(a,b){var c=new DOMParser,d=null,e=null;try{e=c.parseFromString(a,_.Ee)}catch(f){}e&&e.documentElement.tagName==b&&(d=e.documentElement);return d&&0<d.getElementsByTagName("parsererror").length?null:d};
23
- mw=function(a){var b=[];b.push(a[3]);b.push(a[2]);b.push(a[1]);b.push(a[0]);b.push(a[5]);b.push(a[4]);b.push(a[7]);b.push(a[6]);a=_.N(a);a.set(b,0);return a};nw=function(a,b,c,d,e,f){f=void 0===f?null:f;_.Bl.call(this,a,b,d);this.version=e;this.g=c;this.m=f};_.pw=function(a,b){return b===a.version?a:_.ow(b,a.a,a.m||void 0,a.g||void 0)};
24
- _.ow=function(a,b,c,d){var e=_.Qh(b);if(8!==e.byteLength)e="";else{var f=mw(e);e=_.Nh(f);b:switch(f=f.byteLength,_.Uf("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[cv+a+'"\x3e',"\x3cDATA\x3e\x3cPROTECTINFO\x3e","\x3cKEYLEN\x3e"+f+"\x3c/KEYLEN\x3e","\x3cALGID\x3eAESCTR\x3c/ALGID\x3e\x3c/PROTECTINFO\x3e","\x3cKID\x3e"+e+"\x3c/KID\x3e",c?"\x3cCHECKSUM\x3e"+c+"\x3c/CHECKSUM\x3e":"",d?bv+d+av:"",$u].join("");break b;case "4.1.0.0":e=[cv+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKID ALGID\x3d"AESCTR" ',
25
- c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?bv+d+av:"",$u].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[cv+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKIDS\x3e\x3cKID ALGID\x3d"AESCTR" ',c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?bv+d+av:"",$u].join("");break b;default:_.G("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.Uf("New payload",e);e=_.N(_.Dh(e,!0));return new nw(qw,
26
- b,d||null,e,a,c)};rw=function(a){a=_.jw(a,"PROTECTINFO");if(!a)return null;var b=_.jw(a,"KID");if(!b)return null;a=b.getAttribute("VALUE");if(!a)return null;var c=b.getAttribute(dv);b=b.getAttribute("ALGID");return{value:a,xe:c,vh:b}};
27
- sw=function(a){a=_.jw(a,"PROTECTINFO");if(!a)return null;a=_.jw(a,"KIDS");if(!a)return null;var b=_.iw(a,"KID");if(!b.length)return null;a=[];b=_.u(b);for(var c=b.next();!c.done;c=b.next()){var d=c.value;if(c=d.getAttribute("VALUE")){var e=d.getAttribute(dv);d=d.getAttribute("ALGID");a.push({value:c,xe:e,vh:d})}}return a.length?a:null};
28
- _.tw=function(a){a:{a=new _.Fk(new DataView(a.buffer),!0);_.U(a);for(_.Jk(a);_.Gk(a);)if(1===_.Jk(a)){var b=_.Jk(a);a=_.Nk(a,b);break a}a=null}b=_.Ah(a,!0);var c=_.lw(b,"WRMHEADER");b=c.getAttribute("version");var d=_.jw(c,"DATA");c=(c=_.jw(d,"LA_URL"))?_.kw(c):"";var e;if(e=_.jw(d,"KID"))if(e=_.kw(e)){var f=_.jw(d,dv);e={value:e,xe:f?f.textContent.trim():null}}else e=null;else e=null;d=e?[e]:(e=rw(d))?[e]:(d=sw(d))?d:null;e=d&&d[0]||{};d=e.xe;e=_.Ph(void 0===e.value?"":e.value);e=mw(e);e=_.Rh(e);
29
- return new nw(qw,e,c,a,b,d)};uw=function(a,b){return a.start-b.start};_.vw=function(a){this.m=a;this.log=new _.I("clpp.renditions");this.S=[];this.j=this.a=null;this.g=!1};ww=function(a){return a.S.map(function(b){return{start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}})};xw=function(a){a.a&&a.a.trigger(new _.J(_.rc))};
30
- yw=function(a){if(a.a){for(var b=!1,c={},d=0;d<a.S.length;d++){var e=a.S[d],f=e.width+"x"+e.height,g=c[f];if(g&&g!==e.bandwidth){b=!0;break}c[f]=e.bandwidth}b&&!a.g?(a.log.debug("Tracking timeupdates"),a.a.on(_.Fe,a.f,a),a.g=!0):!b&&a.g&&(a.log.debug("Stop tracking timeupdates"),a.a.off(_.Fe,a.f),a.g=!1)}};zw=function(a,b,c){a.S=a.S.filter(function(d){if(d.end<=b||d.start>=c)return!1;d.start=Math.max(d.start,b);d.end=Math.min(d.end,c);return!0});a.a&&a.a.trigger(new _.J(_.Ue))};
31
- Aw=function(a,b){for(var c=null,d=_.u(a),e=d.next();!e.done;e=d.next())e=e.value,b>=e.startTime&&(c=e);return c};Bw=function(a){var b=new Set;a.variants.forEach(function(c){c.audio&&b.add(c.audio);c.video&&(b.add(c.video),c.video.trickModeVideo&&b.add(c.video.trickModeVideo))});a.textStreams.forEach(function(c){return b.add(c)});a.thumbStreams.forEach(function(c){return b.add(c)});return b};Cw=function(a,b){for(var c=0;c<a.length;c++)if(Bw(a[c]).has(b))return c;return-1};
32
- Ew=function(a,b){Array.from(Bw(a)).forEach(function(c){c.segmentIndex&&_.Dw(c.segmentIndex,b)})};_.Fw=function(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.Gw=function(a,b,c){var d=Math.pow(a.g,b);c=c*(1-d)+d*a.a;isNaN(c)||(a.a=c,a.f+=b)};_.Hw=function(a){return a.a/(1-Math.pow(a.g,a.f))};
33
- _.Iw=function(a,b,c,d,e,f,g,h){a=_.ai(a);a.timeout=d.timeout;a.maxAttempts=d.maxAttempts;a.baseDelay=d.baseDelay;a.fuzzFactor=d.fuzzFactor;a.backoffFactor=d.backoffFactor;if(0!==b||null!=c)a.headers.Range=c?"bytes\x3d"+b+"-"+c:"bytes\x3d"+b+"-";e&&(a.startTime=e);f&&(a.endTime=f);g&&(a.contentType=g);h&&(a.timescale=h);return a};
34
- _.Jw=function(a,b,c,d){var e=void 0===e?!1:e;this.A=a;this.F=b;this.m=this.f=Infinity;this.a=1;this.B=0;this.g=this.j=null;this.D=0;this.w=this.o=c;this.J=void 0===d?!0:d;this.h=new _.I("clpp.media.PresentationTimeline");this.H=e;this.I=null};_.Kw=function(a,b){a.o=b;a.w=b};Lw=function(a){return a.o?a.f:a.w?a.g:null};
35
- _.Nw=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.Mw(a,b[0].startTime+c);a.a=b.reduce(function(e,f){return Math.max(e,f.endTime-f.startTime)},a.a);a.g=Math.max(a.g||0,d);null!=a.A&&a.J&&(a.A=(Date.now()+a.D)/1E3-(a.g||0)-a.a);a.h.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.Mw=function(a,b){a.j=null==a.j?b:Math.min(a.j,b)};_.Ow=function(a,b){a.a=Math.max(a.a,b);a.h.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
36
- _.Qw=function(a){return Infinity==a.m?0:Math.max(0,Pw(a)-a.m)};Pw=function(a){if(a.o)a=a.f;else if(a.w)a=a.g||0;else{var b=(Date.now()+a.D)/1E3;a=Math.min(a.H?Math.max(0,b-(a.a-a.B)-a.A):Math.max(0,b-a.a-a.A),a.f)}return a};_.Sw=function(a,b){var c=Math.max(a.j,0);return Infinity==a.m?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(Pw(a)-a.m+b,Rw(a)))};Rw=function(a){return Math.max(0,Pw(a)-(a.o||a.w?0:a.F))};Tw=function(){this.f=function(){};this.a=new Set};Uw=function(a,b){a.f=b};
37
- Vw=function(a,b,c){this.g=a;this.a=b;this.f=c;this.h=new _.I("clpp.media.SegmentIterator")};Ww=function(a){var b=a.g.get(a.a);if(!b)return null;0<b.a.length&&b.Oa().length&&a.f>=b.a.length&&(a.a+=1,a.f=0,b=a.g.get(a.a));return b&&0<b.a.length?b.a[a.f]||null:b};_.Xw=function(a){this.a=a;this.h=new _.I("clpp.media.SegmentIndex")};_.Yw=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};_.Zw=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);c=a.a;a.a=[];return c};
38
- $w=function(a,b){var c=a.Fc(b);c=null===c?-1:c-1;var d=a.get(c+1),e=-1;if(d&&0<d.a.length)for(var f=d.a.length-1;0<=f;--f){var g=d.a[f];if(b>=g.startTime&&b<g.endTime){for(;f&&!g.g;)--f,g=d.a[f];if(!g.g)break;c+=1;e=f-1;break}}return new Vw(a,c,e)};_.Dw=function(a,b){for(;a.a.length;)if(0>=a.a[0].endTime)a.a.shift();else break;0==a.a.length||a.a[a.a.length-1].startTime>=b||(a.a[a.a.length-1].endTime=b)};bx=function(a){var b=this;this.f=a;this.a=new Set;this.g=(new _.$i(function(){ax(b,!1)})).fb(.25)};
39
- ax=function(a,b){for(var c=_.u(a.a),d=c.next();!d.done;d=c.next())d.value.o(a.f.currentTime,b)};
40
- cx=function(a){var b=this;this.m=a;this.j=new Map;this.a=function(){};this.f=function(){};this.g=function(){};this.w=[{rc:null,qc:2,fc:function(c,d){return b.a(c,d)}},{rc:1,qc:2,fc:function(c,d){return b.a(c,d)}},{rc:3,qc:2,fc:function(c,d){return b.a(c,d)}},{rc:2,qc:1,fc:function(c,d){return b.f(c,d)}},{rc:2,qc:3,fc:function(c,d){return b.f(c,d)}},{rc:1,qc:3,fc:function(c,d){return b.g(c,d)}},{rc:3,qc:1,fc:function(c,d){return b.g(c,d)}}]};dx=function(a,b,c,d){a.a=b;a.f=c;a.g=d};
41
- _.ex=function(a){_.yp[a]&&delete _.yp[a]};_.fx=function(a){_.wp[a]&&delete _.wp[a]};gx=function(a,b){this.w=null;this.D=a;this.g=b;this.j=this.A=0;this.m=Infinity;this.f=this.a=null;this.B="";this.o=new Map};
42
- hx=function(a,b,c,d){return Promise.resolve().then(function(){if(a.w&&a.g)if(null==c||null==d)a.w.parseInit(_.N(b));else{var e={periodStart:a.A,segmentStart:c,segmentEnd:d};e=a.w.parseMedia(_.N(b),e);var f=e.cues.filter(function(g){return g.startTime>=a.j&&g.startTime<a.m});a.g.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.j));a.f=Math.min(d,a.m)}})};
43
- ix=function(a,b,c){a.B=b;if(b=a.o.get(b))for(var d=_.u(b.keys()),e=d.next();!e.done;e=d.next())if(e=b.get(e.value))e=e.filter(function(f){return f.endTime<=c}),a.g.append(e,[])};
44
- jx=function(a,b,c,d,e){var f=c+" "+d,g=new Map;b=_.u(b);for(var h=b.next();!h.done;h=b.next()){var l=h.value;h=l.stream;g.has(h)||g.set(h,new Map);g.get(h).has(f)||g.get(h).set(f,[]);l.startTime+=e;l.endTime+=e;l.startTime>=a.j&&l.startTime<a.m&&(l=new _.Eg(l.startTime,l.endTime,l.text),g.get(h).get(f).push(l),h==a.B&&a.g.append([l],[]))}e=_.u(g.keys());for(f=e.next();!f.done;f=e.next())for(f=f.value,a.o.has(f)||a.o.set(f,new Map),b=_.u(g.get(f).keys()),h=b.next();!h.done;h=b.next())h=h.value,l=g.get(f).get(h),
45
- a.o.get(f).set(h,l);a.a=null==a.a?Math.max(c,a.j):Math.min(a.a,Math.max(c,a.j));a.f=Math.max(a.f,Math.min(d,a.m))};_.kx=function(a){a=a.toLowerCase();return _.Tp[a]||window.muxjs&&a==_.ec?!0:!1};lx=function(){this.a=new muxjs.mp4.CaptionParser;this.m=[];this.j={}};_.mx=function(){};
46
- _.ox=function(a,b,c,d,e){this.j=a;this.B=c;this.f={};this.M=!1;this.a=null;this.g={};this.m=new _.eg;this.J=!1;this.A={};this.H=b;this.D=d;this.K=e;this.T=this.K.streaming.maxSegmentToMediaOffset||1;this.I=new _.fi;this.w="";this.F={};this.o=nx(this,this.I);this.N=!0;this.h=new _.I("clpp.mse.MediaSourceEngine")};px=function(a){var b=_.Xi(a.mimeType,a.codecs),c=fw(a);return _.kx(b)||_.$v(c)||dw(b,a.type)};
47
- nx=function(a,b){if(window.ManagedMediaSource){a.j.disableRemotePlayback=!0;var c=new ManagedMediaSource;a.m.one(c,"sourceopen",function(){URL.revokeObjectURL(a.w);b.resolve()});a.m.on(c,"startstreaming",function(){a.N=!0});a.m.on(c,"endstreaming",function(){a.N=!1});a.w=qx(c);a.j.src=a.w;return c}c=new MediaSource;a.w=qx(c);a.m.one(c,"sourceopen",function(){URL.revokeObjectURL(a.w);b.resolve()});a.j.src=a.w;return c};
48
- rx=function(a,b){b.forEach(function(c,d){var e=a.o.addSourceBuffer(c);a.m.on(e,_.jd,a.U.bind(a,d));a.m.on(e,"updateend",a.Sc.bind(a,d));a.f[d]=e;a.g[d]=[];a.F[d]=!1});a.M=b.has(_.mc)&&b.has(_.Re)};sx=function(a){return a.K.streaming.ignoreManagedMediaSourceStreamingHints?!0:a.N};tx=function(a,b){a.a||(a.a=new gx(a.K,a.B));var c=a.a;if(b!=_.ec){var d=_.Tp[b];if(!d)throw new _.L(_.M,2,2012,"Text parser is unavailable for "+b);c.w=new d(c.D)}};ux=function(a){return a.o?a.o.readyState==_.id:!0};
49
- wx=function(a){var b={};b.total=new _.Zj(a.j.buffered,"total");b.audio=vx(a,_.mc);b.video=vx(a,_.Re);var c=[];a.a&&(c=[{start:a.a.ub(),end:a.a.Da()}]);b.text=hw(c,_.Ce);return b};vx=function(a,b){try{return new _.Zj(a.f[b].buffered,b)}catch(c){return b in a.f&&a.h.error("failed to get buffered range for "+b,c),null}};xx=function(a,b){if(!a.f[b])return"";var c=vx(a,b);return c?c.toString():""};
50
- zx=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l=a.f[b],m=-1,n=0;l&&l.buffered&&(n=l.buffered.length);b===_.Re&&null!==d&&null!==e&&h&&(m=0<n?l.buffered.end(n-1):-1);b==_.Ce?c=hx(a.a,c,d,e):a.A[b]?c=bw(a.A[b],c).then(function(p){p.captions&&0<p.captions.length&&(a.a||tx(a,_.De),jx(a.a,p.captions,d,e,a.f.video.timestampOffset));var q=[];0<p.audio.byteLength&&a.f.audio&&q.push(yx(a,_.mc,a.Be.bind(a,_.mc,p.audio.buffer)));0<p.video.byteLength&&a.f.video&&q.push(yx(a,_.Re,a.Be.bind(a,_.Re,p.video.buffer)));
51
- return Promise.all(q)}):(f&&window.muxjs&&(a.a||tx(a,_.De),null==d&&null==e?a.H.init(c):a.H.g(c,function(p){p.length&&jx(a.a,p,d,e,a.f.video.timestampOffset)})),c=yx(a,b,a.Be.bind(a,b,c)));return c.then(function(){if(b===_.Re&&null!==d&&null!==e&&!h)a.D.append(d,e,g),null!==d&&null!==e&&a.h.debug("Appended video segment ",d,e,"Buffer:",xx(a,b));else if(b===_.mc&&null!==d&&null!==e)xw(a.D),null!==d&&null!==e&&a.h.debug("Appended audio segment ",d,e,"Buffer:",xx(a,b));else if(b===_.Re&&null!==d&&null!==
52
- e&&h){var p=l.buffered.length,q=0<p?l.buffered.end(p-1):-1;0>m&&0<p&&(m=l.buffered.start(0));0<=m&&0<q&&a.D.append(m,q,g)}if(!a.F[b]&&l&&1===l.buffered.length){p=l.buffered.start(0);var r=d-p;if(Math.abs(r)>a.T&&0===l.timestampOffset)return a.h.warn("Detected a delta of "+r+" between media times and segment times for "+(b+". The segment start time is ")+(d+" and the media start time is ")+(p+". Adjusting timestampOffset.")),p=yx(a,b,function(){a.hh(b,r)}),q=yx(a,b,a.ig.bind(a,b,!1)),Promise.all([p,
53
- q])}null!==d&&null!==e&&(a.F[b]=!0)})["catch"](function(p){throw p;})};Ax=function(a,b){var c=a.Da(_.Re)||0;ix(a.a,b,c)};Bx=function(a){a.a&&ix(a.a,"",0)};Dx=function(a,b,c,d,e){if(b==_.Ce)return a.a.A=c,a=a.a,a.j=d,a.m=e,Promise.resolve();b=Cx(a,b,c,d,e);a.M&&(b=b.concat(Cx(a,_.mc,c,d,e)));return Promise.all(b)};Cx=function(a,b,c,d,e){return[yx(a,b,a.th.bind(a,b)),yx(a,b,a.hh.bind(a,b,c)),yx(a,b,a.il.bind(a,b,d,e))]};Fx=function(a,b){Ex(a,function(){a.o.duration=b})};
54
- yx=function(a,b,c){if(a.J)return Promise.reject();c={start:c,p:new _.fi};a.g[b].push(c);1===a.g[b].length&&Gx(a,b);return c.p};Gx=function(a,b){var c=a.g[b][0];if(c)try{a.h.debug("Starting next operation for "+b),c.start()}catch(d){"QuotaExceededError"==d.name?c.p.reject(new _.L(_.M,3,3017,{type:b})):c.p.reject(new _.L(_.M,3,3015,{mediaError:d})),Hx(a,b)}else a.h.debug("No more scheduled operations for "+b)};
55
- Ex=function(a,b){if(a.J)return Promise.reject();var c=[],d;for(d in a.f){var e=new _.fi,f={start:function(g){g.resolve()}.bind(null,e),p:e};a.g[d].push(f);c.push(e);1==a.g[d].length&&f.start()}return Promise.all(c).then(function(){for(var g in a.f);try{b()}catch(m){var h=Promise.reject(new _.L(_.M,3,3015,{mediaError:m}))}for(var l in a.f)Hx(a,l);return h},function(){for(var g in a.f)a.g[g].length&&a.g[g].shift();return Promise.reject()})};Hx=function(a,b){a.g[b].shift();Gx(a,b)};
56
- Nx=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=Ix(e,b,c);e=Jx(e,d);if(1<a.periods.length){var f=function(n){n=n.split(".");var p=n[0];1<n.length&&(p+="."+n[1]);return p.toLowerCase()};b=[];c=_.u(a.periods);for(var g=c.next();!g.done;g=c.next()){d=new Set;g=_.u(g.value.variants);for(var h=g.next();!h.done;h=g.next())h=h.value,null!==h.audio&&d.add(f(h.audio.codecs));b.push(d)}var l=b[0];c={};for(d=1;d<b.length;c={le:c.le},d++)c.le=b[d],l=new Set(_.of(l).concat().filter(function(n){return function(p){return n.le.has(p)}}(c)));
57
- e=e.filter(function(n){return 0===l.size&&null===n.audio?!0:0<l.size&&null===n.audio?!1:l.has(f(n.audio.codecs))})}e=Kx(e);var m=Lx(e);a=_.u(a.periods);for(e=a.next();!e.done;e=a.next())e=e.value,e.variants=e.variants.filter(function(n){if(Mx(n)===m)return!0;_.Uf("Dropping Variant (better codec available)",n);return!1})};Kx=function(a){var b=new _.ag;a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Mx(c);b.push(d,c)}return b};
58
- Ix=function(a,b,c){var d={};b=_.u(b);for(var e=b.next();!e.done;d={qe:d.qe},e=b.next())if(d.qe=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.qe)}}(d)),e.length){a=e;break}d={};c=_.u(c);for(b=c.next();!b.done;d={je:d.je},b=c.next())if(d.je=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.je)}}(d)),b.length){a=b;break}return a};
59
- Lx=function(a){var b="",c=Infinity;Fv(a,function(d,e){var f=e.reduce(function(g,h){return g+h.bandwidth||0},0)/e.length;_.Uf(_.Oc,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};Mx=function(a){var b="";a.video&&(b=_.gw(a.video.codecs)[0]);var c="";a.audio&&(c=_.gw(a.audio.codecs)[0]);return b+"-"+c};
60
- Ox=function(a,b,c){function d(f,g,h){return f>=g&&f<=h}var e=a.video;return e&&e.width&&e.height&&!(d(e.width,b.minWidth,Math.min(b.maxWidth,c.width))&&d(e.height,b.minHeight,Math.min(b.maxHeight,c.height))&&d(e.width*e.height,b.minPixels,b.maxPixels))||!d(a.bandwidth,b.minBandwidth,b.maxBandwidth)?!1:!0};Px=function(a,b,c){var d=!1;a=_.u(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=e.allowedByApplication;e.allowedByApplication=Ox(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
61
- Sx=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.da&&!Mv(a,m))return _.Uf("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!px(n)){var q=n.codecs;0<=n.codecs.indexOf("ec-3")?(_.Uf("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace("ec-3","ac-3"),px(n)?_.Tf("Using AC-3 instead of EC-3 for",Qx(n)):(n.codecs=q,_.Tf(lv,Qx(n)),m.audio=null,e=!0,n=null)):(_.Tf(lv,Qx(n)),m.audio=null,e=!0,n=null)}return p&&!px(p)?(_.Tf("Dropping variant - video not compatible with platform",
62
- Qx(p)),!1):n&&b&&!Rx(n,b)?(_.Tf("Dropping variant - not compatible with active audio","active audio",Qx(b),"variant.audio",Qx(n)),!1):p&&c&&!Rx(p,c)?(_.Tf("Dropping variant - not compatible with active video","active video",Qx(c),"variant.video",Qx(p)),!1):!0});if(e){for(var f=!1,g=!1,h=_.u(d.variants),l=h.next();!l.done;l=h.next())l=l.value,!f&&l.video&&l.audio&&(f=!0),g||l.audio||!l.video||(g=!0);f&&g&&(d.variants=d.variants.filter(function(m){return m.video&&!m.audio?(_.Tf("Dropping variant - not compatible with video + audio",
63
- "variant.video",Qx(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.kx(_.Xi(m.mimeType,m.codecs));n||_.Uf("Dropping text stream. Is not supported by the platform.",m);return n})};Rx=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
64
- Tx=function(a){var b=a.audio,c=a.video,d=b?b.codecs:null,e=c?c.codecs:null,f=[];e&&f.push(e);d&&f.push(d);var g=c&&c.mimeType||null,h=b&&b.mimeType||null,l=[];b&&l.push(b.kind);c&&l.push(c.kind);l=l[0]||null;var m=new Set,n=new Set;if(b)for(var p=_.u(b.roles),q=p.next();!q.done;q=p.next())n.add(q.value);if(c)for(p=_.u(c.roles),q=p.next();!q.done;q=p.next())m.add(q.value);q=[c,b].map(function(r){return r?r.accessibility||[]:[]}).reduce(function(r,v){return r.concat(v)},[]);a={id:a.id,active:!1,type:"variant",
2
+ var f=function(window){var nw,ow,pw,qw,rw,sw,tw,uw,vw,ww,zw,Aw,Dw,Ew,Fw,Gw,Iw,Jw,Lw,Mw,Nw,Pw,Qw,Rw,Sw,Tw,Vw,Ww,Xw,bx,cx,dx,ex,fx,hx,mx,nx,px,sx,ux,vx,wx,xx,yx,zx,Bx,Cx,Ex,Fx,Gx,Hx,Ix,Jx,Kx,Mx,Sx,Wx,Yx,$x,ay,by,cy,gy,iy,hy,jy,ky,ny,oy,py,qy,sy,wy,uy,yy,zy,Ay,By,Dy,Cy,Ey,Gy,Hy,Iy,Ky,Jy,My,Fy,Ny,Ly,Oy,Uy,Ry,Py,Sy,Ty,Vy,Wy,Zy,Yy,$y,az,bz,Qy,cz,ez,Xy,fz,gz,hz,iz,jz,kz,lz,mz,oz,pz,nz,xz,wz,yz,zz,Bz,Cz,Ez,Dz,Fz,Iz,Gz,Hz,Kz,Jz,Lz,Mz,Pz,Rz,Qz,Sz,Tz,Uz,Vz,Xz,Yz,Zz,Wz,aA,$z,eA,fA,hA,dA,cA,iA,bA,gA,mA,oA,lA,pA,kA,nA,jA,rA,qA,tA,wA,
3
+ yA,zA,EA,HA,JA,LA,OA,QA,RA,TA,KA,WA,CA,XA,AA,VA,$A,YA,SA,UA,cB,bB,ZA,iB,jB,dB,lB,eB,gB,oB,nB,hB,mB,pB,BA,fB,PA,DA,FA,vA,GA,kB,MA,NA,sB,tB,uB,AB,HB,yB,xB,wB,zB,CB,DB,EB,FB,GB,LB,WB,XB,YB,SB,ZB,QB,BB,tz,rz,uz,sz,vz,qz,hC,fC,UB,RB,aC,iC,gC,kC,$B,bC,IB,TB,lC,PB,cC,oC,VB,OB,nC,mC,JB,jC,eC,qC,MB,dC,pC,rC,KB,sC,tC,uC,vC,wC,xC,yC,zC,AC,Yw;nw=" buffer";ow=" is being or has been set up";pw="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";qw="\x3c/LA_URL\x3e";rw="\x3cLA_URL\x3e";sw='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';
4
+ tw="Choosing new streams after key status change";uw="IterateSegmentReference";vw="Jumping forward";ww="MediaSource threw QuotaExceededError:";_.xw="No stream with id";_.yw="Player is in ERROR state and can not switch to ";zw="PrestoPlay TextTrack";Aw="Removing audio from variant - audio not compatible with platform";_.Bw="Updating manifest...";_.Cw="VOD";Dw="bufferBehind\x3d";Ew="bufferedBehind\x3d";Fw="calling onCanSwitch()...";Gw="cannot find segment";_.Hw="caption";Iw="clpp.mse.Player";Jw="currentPeriod.startTime\x3d";
5
+ _.Kw="getSegmentNextReference";Lw="key-restriction";Mw="manifest.end";Nw="manifest.start";_.Ow="onChooseStreams_";Pw="presentationTime:";Qw="presentationTime\x3d";Rw="reference.endTime\x3d";Sw="reference.position\x3d";Tw="reference.startTime\x3d";_.Uw="subtitles";Vw="switch: Stream ";Ww=function(a,b){for(var c in a.a)b(c,a.a[c])};Xw=function(a){for(var b=a.a+a.f.byteOffset,c=void 0;_.ml(a);)if(0===_.ol(a)){c=a.a+a.f.byteOffset-1;break}a=a.f.buffer.slice(b,c);return _.Yh(a)};
6
+ _.Zw=function(a){var b=new Uint8Array(Yw),c=4+b.byteLength+a.j.byteLength+4+a.f.byteLength,d=new _.il(c,!1);_.V(d,c);_.kl(d,b);_.kl(d,a.j);_.V(d,a.f.byteLength);_.kl(d,a.f);return _.R(d.buffer)};
7
+ _.$w=function(a,b,c,d){var e=_.pi(b);if(8!==e.byteLength)e="";else{var f=_.tm(e);e=_.mi(f);b:switch(f=f.byteLength,_.ug("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[sw+a+'"\x3e',"\x3cDATA\x3e\x3cPROTECTINFO\x3e","\x3cKEYLEN\x3e"+f+"\x3c/KEYLEN\x3e","\x3cALGID\x3eAESCTR\x3c/ALGID\x3e\x3c/PROTECTINFO\x3e","\x3cKID\x3e"+e+"\x3c/KID\x3e",c?"\x3cCHECKSUM\x3e"+c+"\x3c/CHECKSUM\x3e":"",d?rw+d+qw:"",pw].join("");break b;case "4.1.0.0":e=[sw+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKID ALGID\x3d"AESCTR" ',
8
+ c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?rw+d+qw:"",pw].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[sw+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKIDS\x3e\x3cKID ALGID\x3d"AESCTR" ',c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?rw+d+qw:"",pw].join("");break b;default:_.J("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.ug("New payload",e);e=_.R(_.ci(e,!0));return new _.pm(_.um,
9
+ b,d||null,e,a,c)};_.ax=function(a,b){return b===a.version?a:_.$w(b,a.a,a.l||void 0,a.g||void 0)};bx=function(a,b){a:{if(b){var c=_.u(a.f.keys());for(var d=c.next();!d.done;d=c.next()){d=a.f.get(d.value);for(var e=0;e<d.Wa.length;e++)if(d.Wa[e]===b){c=d;break a}}}c=null}return c?c.Ga:null};cx=function(a,b){return _.Ej("Edge/")?!0:a.M.has(b)};dx=function(a,b){var c=a.l.get(b);return!(!c||c!==_.je&&c!==_.Fd)};
10
+ ex=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&!cx(a,_.wj(c.mimeType,c.codecs))||d&&d.encrypted&&!cx(a,_.wj(d.mimeType,d.codecs)))return!1;var e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem==e})};fx=function(a,b){a.a=b.enabled};_.gx=function(a,b){return a.concat(b)};hx=function(){};
11
+ _.ix=function(a,b){if(0==b.length)return a;var c=b.map(function(d){return new _.ph(d)});return a.map(function(d){return new _.ph(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.gx,[]).map(function(d){return d.toString()})};_.jx=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
12
+ _.kx=function(a,b,c,d,e){this.Na=a;this.ta=b;this.fa=c;this.keyInfo=d||null;this.Ec=_.M.R(e)?!1:!!e};
13
+ _.lx=function(a,b,c,d,e,f,g,h,l,m,n,p,q,t){l=void 0===l?!1:l;m=void 0===m?null:m;n=void 0===n?null:n;p=void 0===p?null:p;q=void 0===q?null:q;t=void 0===t?[]:t;this.position=a;this.startTime=b;this.endTime=c;this.Ba=g;this.Na=d;this.ta=e;this.fa=f;this.keyInfo=(void 0===h?null:h)||null;this.Ec=_.M.R(l)?!1:!!l;this.timescale=m;this.horizontalTiles=n;this.verticalTiles=p;this.durationPerTile=q;this.a=t||[];this.g=!1};
14
+ mx=function(a,b){a=_.Jh(a);b=_.Jh(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};nx=function(a){return a.language?_.Jh(a.language):a.audio&&a.audio.language?_.Jh(a.audio.language):a.video&&a.video.language?_.Jh(a.video.language):_.ff};
15
+ _.ox=function(a,b){for(var c=_.Jh(a),d=new Set,e=_.u(b),f=e.next();!f.done;f=e.next())d.add(_.Jh(f.value));e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,f==c)return f;e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,mx(f,c))return f;e=_.u(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,h=c;g=_.Jh(g);h=_.Jh(h);g=g.split("-");h=h.split("-");if(2==g.length&&2==h.length&&g[0]==h[0])return f}d=_.u(d);for(f=d.next();!f.done;f=d.next())if(e=f.value,mx(c,e))return e;return null};
16
+ px=function(a,b){for(var c in b)if(b[c]===a)return c;return""};
17
+ _.qx=function(a,b){if(!a.length)return b;if(!b.length)return a;for(var c=[],d=0;d<a.length;d++)for(var e={},f=0;f<b.length;e={Tc:e.Tc},f++)if(a[d].keySystem===b[f].keySystem&&a[d].periodId===b[f].periodId){var g=a[d];f=b[f];var h=[];h=h.concat(g.initData||[]);h=h.concat(f.initData||[]);e.Tc=_.Of(g.keyIds||[]).concat();f.keyIds&&f.keyIds.length&&f.keyIds.forEach(function(l){return function(m){l.Tc.includes(m)||l.Tc.push(m)}}(e));c.push({keySystem:g.keySystem,licenseServerUri:g.licenseServerUri||f.licenseServerUri,
18
+ distinctiveIdentifierRequired:g.distinctiveIdentifierRequired||f.distinctiveIdentifierRequired,persistentStateRequired:g.persistentStateRequired||f.persistentStateRequired,videoRobustness:g.videoRobustness||f.videoRobustness,audioRobustness:g.audioRobustness||f.audioRobustness,serverCertificate:g.serverCertificate||f.serverCertificate,initData:h,keyIds:e.Tc,periodId:g.periodId});break}return c};_.rx=function(a,b){return a.length&&b.length?0<_.qx(a,b).length:!0};
19
+ sx=function(a,b){for(var c=0,d=_.u(a),e=d.next();!e.done;e=d.next())c+=b(e.value)?1:0;return c};_.tx=function(a){if(_.Gr.has(a))return _.Gr.get(a);if(window.ManagedMediaSource){var b=ManagedMediaSource.isTypeSupported(a);_.Gr.set(a,b);return b}return window.MediaSource?(b=MediaSource.isTypeSupported(a),_.Gr.set(a,b),b):!1};
20
+ ux=function(){this.a=new muxjs.mp4.Transmuxer({keepOriginalTimestamps:!0,remux:!1});this.f=null;this.o=[];this.l=[];this.g=[];this.j=!1;this.a.on("data",this.A.bind(this));this.a.on("done",this.w.bind(this))};vx=function(a,b){a.j=!0;a.f=new _.Fi;a.o=[];a.l=[];a.g=[];var c=_.R(b);a.a.push(c);a.a.flush();a.j&&a.f.reject(new _.N(_.O,3,3018));return a.f};
21
+ wx=function(a,b){var c=b.replace(/mp2t/i,_.Xd);a==_.rc&&(c=c.replace(_.uf,_.rc));var d=/avc1\.(66|77|100)\.(\d+)/.exec(c);if(d){var e="avc1.",f=d[1],g=Number(d[2]);e=("66"==f?e+"4200":"77"==f?e+"4d00":e+"6400")+(g>>4).toString(16);e+=(g&15).toString(16);c=c.replace(d[0],e)}return c};
22
+ xx=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?_.tx(wx(b,a))||_.tx(a.replace(/aac/i,_.Xd)):_.tx(wx(_.rc,a))||_.tx(a.replace(/aac/i,_.Xd))||_.tx(wx(_.uf,a))};
23
+ yx=function(a,b){var c=new Map;c.set(a,b);try{var d=b.match(/"(.*?)"/)[0].replace(/"/g,"").split(","),e=new Map;if(1<d.length)for(var f=_.u(d),g=f.next();!g.done;g=f.next()){var h=g.value;h.startsWith("avc")?e.set(_.uf,'video/mp4;codecs\x3d"'+h+'"'):h.startsWith("mp4a")&&e.set(_.rc,'audio/mp4;codecs\x3d"'+h+'"')}return 0<e.size?e:c}catch(l){return c}};zx=function(a){var b=[a.mimeType];_.Hr.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};
24
+ _.Ax=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};Bx=function(a,b){for(var c=new _.zk(void 0,void 0===b?"total":b),d=_.u(a),e=d.next();!e.done;e=d.next())c.a.push(e.value);c.length=a.length;return c};Cx=function(a,b){return a.start-b.start};_.Dx=function(a){this.j=a;this.log=new _.K("clpp.renditions");this.S=[];this.g=this.player=null;this.f=!1};Ex=function(a){return a.S.map(function(b){return{start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}})};
25
+ Fx=function(a){a.player&&a.player.trigger(new _.L(_.wc))};Gx=function(a){if(a.player){for(var b=!1,c={},d=0;d<a.S.length;d++){var e=a.S[d],f=e.width+"x"+e.height,g=c[f];if(g&&g!==e.bandwidth){b=!0;break}c[f]=e.bandwidth}b&&!a.f?(a.log.debug("Tracking timeupdates"),a.player.on(_.cf,a.a,a),a.f=!0):!b&&a.f&&(a.log.debug("Stop tracking timeupdates"),a.player.off(_.cf,a.a),a.f=!1)}};
26
+ Hx=function(a,b,c){a.S=a.S.filter(function(d){if(d.end<=b||d.start>=c)return!1;d.start=Math.max(d.start,b);d.end=Math.min(d.end,c);return!0});a.player&&a.player.trigger(new _.L(_.xf))};Ix=function(a,b){for(var c=null,d=_.u(a),e=d.next();!e.done;e=d.next())e=e.value,b>=e.startTime&&(c=e);return c};
27
+ Jx=function(a){var b=new Set;a.variants.forEach(function(c){c.audio&&b.add(c.audio);c.video&&(b.add(c.video),c.video.trickModeVideo&&b.add(c.video.trickModeVideo))});a.textStreams.forEach(function(c){return b.add(c)});a.thumbStreams.forEach(function(c){return b.add(c)});return b};Kx=function(a,b){for(var c=0;c<a.length;c++)if(Jx(a[c]).has(b))return c;return-1};Mx=function(a,b){Array.from(Jx(a)).forEach(function(c){c.segmentIndex&&_.Lx(c.segmentIndex,b)})};
28
+ _.Nx=function(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.Ox=function(a,b,c){var d=Math.pow(a.g,b);c=c*(1-d)+d*a.a;isNaN(c)||(a.a=c,a.f+=b)};_.Px=function(a){return a.a/(1-Math.pow(a.g,a.f))};
29
+ _.Qx=function(a,b,c,d,e,f,g,h){a=_.Ai(a);a.timeout=d.timeout;a.maxAttempts=d.maxAttempts;a.baseDelay=d.baseDelay;a.fuzzFactor=d.fuzzFactor;a.backoffFactor=d.backoffFactor;if(0!==b||null!=c)a.headers.Range=c?"bytes\x3d"+b+"-"+c:"bytes\x3d"+b+"-";e&&(a.startTime=e);f&&(a.endTime=f);g&&(a.contentType=g);h&&(a.timescale=h);return a};
30
+ _.Rx=function(a,b,c,d){var e=void 0===e?!1:e;this.A=a;this.F=b;this.w=this.f=Infinity;this.a=1;this.B=0;this.g=this.o=null;this.D=0;this.l=this.j=c;this.J=void 0===d?!0:d;this.h=new _.K("clpp.media.PresentationTimeline");this.H=e;this.I=null};Sx=function(a){return a.j?a.f:a.l?a.g:null};
31
+ _.Ux=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.Tx(a,b[0].startTime+c);a.a=b.reduce(function(e,f){return Math.max(e,f.endTime-f.startTime)},a.a);a.g=Math.max(a.g||0,d);null!=a.A&&a.J&&(a.A=(Date.now()+a.D)/1E3-(a.g||0)-a.a);a.h.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.Tx=function(a,b){a.o=null==a.o?b:Math.min(a.o,b)};_.Vx=function(a,b){a.a=Math.max(a.a,b);a.h.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
32
+ _.Xx=function(a){return Infinity==a.w?0:Math.max(0,Wx(a)-a.w)};Wx=function(a){if(a.j)a=a.f;else if(a.l)a=a.g||0;else{var b=(Date.now()+a.D)/1E3;a=Math.min(a.H?Math.max(0,b-(a.a-a.B)-a.A):Math.max(0,b-a.a-a.A),a.f)}return a};_.Zx=function(a,b){var c=Math.max(a.o,0);return Infinity==a.w?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(Wx(a)-a.w+b,Yx(a)))};Yx=function(a){return Math.max(0,Wx(a)-(a.j||a.l?0:a.F))};$x=function(){this.f=function(){};this.a=new Set};ay=function(a,b){a.f=b};
33
+ by=function(a,b,c){this.g=a;this.a=b;this.f=c;this.h=new _.K("clpp.media.SegmentIterator")};cy=function(a){var b=a.g.get(a.a);if(!b)return null;0<b.a.length&&b.Na().length&&a.f>=b.a.length&&(a.a+=1,a.f=0,b=a.g.get(a.a));return b&&0<b.a.length?b.a[a.f]||null:b};_.dy=function(a){this.a=a;this.h=new _.K("clpp.media.SegmentIndex")};_.ey=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};_.fy=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);c=a.a;a.a=[];return c};
34
+ gy=function(a,b){var c=a.Cc(b);c=null===c?-1:c-1;var d=a.get(c+1),e=-1;if(d&&0<d.a.length)for(var f=d.a.length-1;0<=f;--f){var g=d.a[f];if(b>=g.startTime&&b<g.endTime){for(;f&&!g.g;)--f,g=d.a[f];if(!g.g)break;c+=1;e=f-1;break}}return new by(a,c,e)};_.Lx=function(a,b){for(;a.a.length;)if(0>=a.a[0].endTime)a.a.shift();else break;0==a.a.length||a.a[a.a.length-1].startTime>=b||(a.a[a.a.length-1].endTime=b)};iy=function(a){var b=this;this.f=a;this.a=new Set;this.g=(new _.zj(function(){hy(b,!1)})).eb(.25)};
35
+ hy=function(a,b){for(var c=_.u(a.a),d=c.next();!d.done;d=c.next())d.value.o(a.f.currentTime,b)};
36
+ jy=function(a){var b=this;this.l=a;this.j=new Map;this.a=function(){};this.f=function(){};this.g=function(){};this.w=[{oc:null,nc:2,dc:function(c,d){return b.a(c,d)}},{oc:1,nc:2,dc:function(c,d){return b.a(c,d)}},{oc:3,nc:2,dc:function(c,d){return b.a(c,d)}},{oc:2,nc:1,dc:function(c,d){return b.f(c,d)}},{oc:2,nc:3,dc:function(c,d){return b.f(c,d)}},{oc:1,nc:3,dc:function(c,d){return b.g(c,d)}},{oc:3,nc:1,dc:function(c,d){return b.g(c,d)}}]};ky=function(a,b,c,d){a.a=b;a.f=c;a.g=d};
37
+ _.ly=function(a){_.Jq[a]&&delete _.Jq[a]};_.my=function(a){_.Hq[a]&&delete _.Hq[a]};ny=function(a,b){this.w=null;this.D=a;this.g=b;this.j=this.A=0;this.l=Infinity;this.f=this.a=null;this.B="";this.o=new Map};
38
+ oy=function(a,b,c,d){return Promise.resolve().then(function(){if(a.w&&a.g)if(null==c||null==d)a.w.parseInit(_.R(b));else{var e={periodStart:a.A,segmentStart:c,segmentEnd:d};e=a.w.parseMedia(_.R(b),e);var f=e.cues.filter(function(g){return g.startTime>=a.j&&g.startTime<a.l});a.g.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.j));a.f=Math.min(d,a.l)}})};
39
+ py=function(a,b,c){a.B=b;if(b=a.o.get(b))for(var d=_.u(b.keys()),e=d.next();!e.done;e=d.next())if(e=b.get(e.value))e=e.filter(function(f){return f.endTime<=c}),a.g.append(e,[])};
40
+ qy=function(a,b,c,d,e){var f=c+" "+d,g=new Map;b=_.u(b);for(var h=b.next();!h.done;h=b.next()){var l=h.value;h=l.stream;g.has(h)||g.set(h,new Map);g.get(h).has(f)||g.get(h).set(f,[]);l.startTime+=e;l.endTime+=e;l.startTime>=a.j&&l.startTime<a.l&&(l=new _.dh(l.startTime,l.endTime,l.text),g.get(h).get(f).push(l),h==a.B&&a.g.append([l],[]))}e=_.u(g.keys());for(f=e.next();!f.done;f=e.next())for(f=f.value,a.o.has(f)||a.o.set(f,new Map),b=_.u(g.get(f).keys()),h=b.next();!h.done;h=b.next())h=h.value,l=g.get(f).get(h),
41
+ a.o.get(f).set(h,l);a.a=null==a.a?Math.max(c,a.j):Math.min(a.a,Math.max(c,a.j));a.f=Math.max(a.f,Math.min(d,a.l))};_.ry=function(a){a=a.toLowerCase();return _.fr[a]||window.muxjs&&a==_.jc?!0:!1};sy=function(){this.a=new muxjs.mp4.CaptionParser;this.l=[];this.j={}};_.ty=function(){};
42
+ _.vy=function(a,b,c,d,e){this.j=a;this.B=c;this.f={};this.M=!1;this.a=null;this.g={};this.l=new _.Eg;this.J=!1;this.A={};this.H=b;this.D=d;this.K=e;this.T=this.K.streaming.maxSegmentToMediaOffset||1;this.I=new _.Fi;this.w="";this.F={};this.o=uy(this,this.I);this.P=!0;this.h=new _.K("clpp.mse.MediaSourceEngine")};wy=function(a){var b=_.wj(a.mimeType,a.codecs),c=zx(a);return _.ry(b)||_.tx(c)||xx(b,a.type)};
43
+ uy=function(a,b){if(window.ManagedMediaSource){a.j.disableRemotePlayback=!0;var c=new ManagedMediaSource;a.l.one(c,"sourceopen",function(){URL.revokeObjectURL(a.w);b.resolve()});a.l.on(c,"startstreaming",function(){a.P=!0});a.l.on(c,"endstreaming",function(){a.P=!1});a.w=xy(c);a.j.src=a.w;return c}c=new MediaSource;a.w=xy(c);a.l.one(c,"sourceopen",function(){URL.revokeObjectURL(a.w);b.resolve()});a.j.src=a.w;return c};
44
+ yy=function(a,b){b.forEach(function(c,d){var e=a.o.addSourceBuffer(c);a.l.on(e,_.yd,a.U.bind(a,d));a.l.on(e,"updateend",a.Pc.bind(a,d));a.f[d]=e;a.g[d]=[];a.F[d]=!1});a.M=b.has(_.rc)&&b.has(_.uf)};zy=function(a){return a.K.streaming.ignoreManagedMediaSourceStreamingHints?!0:a.P};Ay=function(a,b){a.a||(a.a=new ny(a.K,a.B));var c=a.a;if(b!=_.jc){var d=_.fr[b];if(!d)throw new _.N(_.O,2,2012,"Text parser is unavailable for "+b);c.w=new d(c.D)}};By=function(a){return a.o?a.o.readyState==_.xd:!0};
45
+ Dy=function(a){var b={};b.total=new _.zk(a.j.buffered,"total");b.audio=Cy(a,_.rc);b.video=Cy(a,_.uf);var c=[];a.a&&(c=[{start:a.a.tb(),end:a.a.Ea()}]);b.text=Bx(c,_.$e);return b};Cy=function(a,b){try{return new _.zk(a.f[b].buffered,b)}catch(c){return b in a.f&&a.h.error("failed to get buffered range for "+b,c),null}};Ey=function(a,b){if(!a.f[b])return"";var c=Cy(a,b);return c?c.toString():""};
46
+ Gy=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l=a.f[b],m=-1,n=0;l&&l.buffered&&(n=l.buffered.length);b===_.uf&&null!==d&&null!==e&&h&&(m=0<n?l.buffered.end(n-1):-1);b==_.$e?c=oy(a.a,c,d,e):a.A[b]?c=vx(a.A[b],c).then(function(p){p.captions&&0<p.captions.length&&(a.a||Ay(a,_.af),qy(a.a,p.captions,d,e,a.f.video.timestampOffset));var q=[];0<p.audio.byteLength&&a.f.audio&&q.push(Fy(a,_.rc,a.Ee.bind(a,_.rc,p.audio.buffer)));0<p.video.byteLength&&a.f.video&&q.push(Fy(a,_.uf,a.Ee.bind(a,_.uf,p.video.buffer)));
47
+ return Promise.all(q)}):(f&&window.muxjs&&(a.a||Ay(a,_.af),null==d&&null==e?a.H.init(c):a.H.g(c,function(p){p.length&&qy(a.a,p,d,e,a.f.video.timestampOffset)})),c=Fy(a,b,a.Ee.bind(a,b,c)));return c.then(function(){if(b===_.uf&&null!==d&&null!==e&&!h)a.D.append(d,e,g),null!==d&&null!==e&&a.h.debug("Appended video segment ",d,e,"Buffer:",Ey(a,b));else if(b===_.rc&&null!==d&&null!==e)Fx(a.D),null!==d&&null!==e&&a.h.debug("Appended audio segment ",d,e,"Buffer:",Ey(a,b));else if(b===_.uf&&null!==d&&null!==
48
+ e&&h){var p=l.buffered.length,q=0<p?l.buffered.end(p-1):-1;0>m&&0<p&&(m=l.buffered.start(0));0<=m&&0<q&&a.D.append(m,q,g)}if(!a.F[b]&&l&&1===l.buffered.length){p=l.buffered.start(0);var t=d-p;if(Math.abs(t)>a.T&&0===l.timestampOffset)return a.h.warn("Detected a delta of "+t+" between media times and segment times for "+(b+". The segment start time is ")+(d+" and the media start time is ")+(p+". Adjusting timestampOffset.")),p=Fy(a,b,function(){a.mh(b,t)}),q=Fy(a,b,a.mg.bind(a,b,!1)),Promise.all([p,
49
+ q])}null!==d&&null!==e&&(a.F[b]=!0)})["catch"](function(p){throw p;})};Hy=function(a,b){var c=a.Ea(_.uf)||0;py(a.a,b,c)};Iy=function(a){a.a&&py(a.a,"",0)};Ky=function(a,b,c,d,e){if(b==_.$e)return a.a.A=c,a=a.a,a.j=d,a.l=e,Promise.resolve();b=Jy(a,b,c,d,e);a.M&&(b=b.concat(Jy(a,_.rc,c,d,e)));return Promise.all(b)};Jy=function(a,b,c,d,e){return[Fy(a,b,a.Bh.bind(a,b)),Fy(a,b,a.mh.bind(a,b,c)),Fy(a,b,a.vl.bind(a,b,d,e))]};My=function(a,b){Ly(a,function(){a.o.duration=b})};
50
+ Fy=function(a,b,c){if(a.J)return Promise.reject();c={start:c,p:new _.Fi};a.g[b].push(c);1===a.g[b].length&&Ny(a,b);return c.p};Ny=function(a,b){var c=a.g[b][0];if(c)try{a.h.debug("Starting next operation for "+b),c.start()}catch(d){"QuotaExceededError"==d.name?c.p.reject(new _.N(_.O,3,3017,{type:b})):c.p.reject(new _.N(_.O,3,3015,{mediaError:d})),Oy(a,b)}else a.h.debug("No more scheduled operations for "+b)};
51
+ Ly=function(a,b){if(a.J)return Promise.reject();var c=[],d;for(d in a.f){var e=new _.Fi,f={start:function(g){g.resolve()}.bind(null,e),p:e};a.g[d].push(f);c.push(e);1==a.g[d].length&&f.start()}return Promise.all(c).then(function(){for(var g in a.f);try{b()}catch(m){var h=Promise.reject(new _.N(_.O,3,3015,{mediaError:m}))}for(var l in a.f)Oy(a,l);return h},function(){for(var g in a.f)a.g[g].length&&a.g[g].shift();return Promise.reject()})};Oy=function(a,b){a.g[b].shift();Ny(a,b)};
52
+ Uy=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=Py(e,b,c);e=Qy(e,d);if(1<a.periods.length){var f=function(n){n=n.split(".");var p=n[0];1<n.length&&(p+="."+n[1]);return p.toLowerCase()};b=[];c=_.u(a.periods);for(var g=c.next();!g.done;g=c.next()){d=new Set;g=_.u(g.value.variants);for(var h=g.next();!h.done;h=g.next())h=h.value,null!==h.audio&&d.add(f(h.audio.codecs));b.push(d)}var l=b[0];c={};for(d=1;d<b.length;c={oe:c.oe},d++)c.oe=b[d],l=new Set(_.Of(l).concat().filter(function(n){return function(p){return n.oe.has(p)}}(c)));
53
+ e=e.filter(function(n){return 0===l.size&&null===n.audio?!0:0<l.size&&null===n.audio?!1:l.has(f(n.audio.codecs))})}e=Ry(e);var m=Sy(e);a=_.u(a.periods);for(e=a.next();!e.done;e=a.next())e=e.value,e.variants=e.variants.filter(function(n){if(Ty(n)===m)return!0;_.ug("Dropping Variant (better codec available)",n);return!1})};Ry=function(a){var b=new _.Bg;a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Ty(c);b.push(d,c)}return b};
54
+ Py=function(a,b,c){var d={};b=_.u(b);for(var e=b.next();!e.done;d={te:d.te},e=b.next())if(d.te=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.te)}}(d)),e.length){a=e;break}d={};c=_.u(c);for(b=c.next();!b.done;d={me:d.me},b=c.next())if(d.me=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.me)}}(d)),b.length){a=b;break}return a};
55
+ Sy=function(a){var b="",c=Infinity;Ww(a,function(d,e){var f=e.reduce(function(g,h){return g+h.bandwidth||0},0)/e.length;_.ug(_.Vc,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};Ty=function(a){var b="";a.video&&(b=_.Ax(a.video.codecs)[0]);var c="";a.audio&&(c=_.Ax(a.audio.codecs)[0]);return b+"-"+c};
56
+ Vy=function(a,b,c){function d(f,g,h){return f>=g&&f<=h}var e=a.video;return e&&e.width&&e.height&&!(d(e.width,b.minWidth,Math.min(b.maxWidth,c.width))&&d(e.height,b.minHeight,Math.min(b.maxHeight,c.height))&&d(e.width*e.height,b.minPixels,b.maxPixels))||!d(a.bandwidth,b.minBandwidth,b.maxBandwidth)?!1:!0};Wy=function(a,b,c){var d=!1;a=_.u(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=e.allowedByApplication;e.allowedByApplication=Vy(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
57
+ Zy=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.ca&&!ex(a,m))return _.ug("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!wy(n)){var q=n.codecs;0<=n.codecs.indexOf("ec-3")?(_.ug("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace("ec-3","ac-3"),wy(n)?_.tg("Using AC-3 instead of EC-3 for",Xy(n)):(n.codecs=q,_.tg(Aw,Xy(n)),m.audio=null,e=!0,n=null)):(_.tg(Aw,Xy(n)),m.audio=null,e=!0,n=null)}return p&&!wy(p)?(_.tg("Dropping variant - video not compatible with platform",
58
+ Xy(p)),!1):n&&b&&!Yy(n,b)?(_.tg("Dropping variant - not compatible with active audio","active audio",Xy(b),"variant.audio",Xy(n)),!1):p&&c&&!Yy(p,c)?(_.tg("Dropping variant - not compatible with active video","active video",Xy(c),"variant.video",Xy(p)),!1):!0});if(e){for(var f=!1,g=!1,h=_.u(d.variants),l=h.next();!l.done;l=h.next())l=l.value,!f&&l.video&&l.audio&&(f=!0),g||l.audio||!l.video||(g=!0);f&&g&&(d.variants=d.variants.filter(function(m){return m.video&&!m.audio?(_.tg("Dropping variant - not compatible with video + audio",
59
+ "variant.video",Xy(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.ry(_.wj(m.mimeType,m.codecs));n||_.ug("Dropping text stream. Is not supported by the platform.",m);return n})};Yy=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
60
+ $y=function(a){var b=a.audio,c=a.video,d=b?b.codecs:null,e=c?c.codecs:null,f=[];e&&f.push(e);d&&f.push(d);var g=c&&c.mimeType||null,h=b&&b.mimeType||null,l=[];b&&l.push(b.kind);c&&l.push(c.kind);l=l[0]||null;var m=new Set,n=new Set;if(b)for(var p=_.u(b.roles),q=p.next();!q.done;q=p.next())n.add(q.value);if(c)for(p=_.u(c.roles),q=p.next();!q.done;q=p.next())m.add(q.value);q=[c,b].map(function(t){return t?t.accessibility||[]:[]}).reduce(function(t,v){return t.concat(v)},[]);a={id:a.id,active:!1,type:"variant",
65
61
  bandwidth:a.bandwidth,language:a.language,originalLanguage:a.language,label:null,kind:l,width:null,height:null,frameRate:null,mimeType:g,audioMimeType:h,codecs:f.join(", "),audioCodec:d,videoCodec:e,primary:a.primary,roles:Array.from(m),audioRoles:Array.from(n),videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,accessibility:q,keyId:c?c.keyId:b?b.keyId:null};c&&(a.videoId=c.id,a.originalVideoId=c.originalId,
66
62
  a.width=c.width||null,a.height=c.height||null,a.frameRate=c.frameRate||null,a.videoBandwidth=c.bandwidth||null);b&&(a.audioId=b.id,a.originalAudioId=b.originalId,a.originalLanguage=b.originalLanguage,a.channelsCount=b.channelsCount,a.audioBandwidth=b.bandwidth||null,a.label=b.label,a.audioRoles=b.roles);return a};
67
- Ux=function(a){return{id:a.id,active:!1,type:_.Ce,bandwidth:0,language:a.language,originalLanguage:a.originalLanguage,label:a.label,kind:a.kind||null,width:null,height:null,frameRate:null,mimeType:a.mimeType,audioMimeType:null,codecs:a.codecs||null,audioCodec:null,videoCodec:null,primary:a.primary,roles:a.roles,audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:a.originalId,accessibility:a.accessibility,
68
- keyId:null}};Vx=function(a){return a.allowedByApplication&&a.allowedByKeySystem};Jx=function(a,b){var c=a.filter(function(g){return g.audio&&g.audio.channelsCount}),d=new Map;c=_.u(c);for(var e=c.next();!e.done;e=c.next()){e=e.value;var f=e.audio.channelsCount;d.has(f)||d.set(f,[]);d.get(f).push(e)}c=Array.from(d.keys());if(0===c.length)return a;e=c.filter(function(g){return g<=b});return e.length?d.get(Math.max.apply(null,e)):d.get(Math.min.apply(null,c))};
69
- _.Xx=function(a,b,c){b=_.tg(b);var d=a,e=a.filter(function(g){return g.primary});e.length&&(d=e);var f=d.length?d[0].language:"";d=d.filter(function(g){return g.language===f});b.some(function(g){var h=_.Vv(_.ih(g),a.map(function(l){return l.language}));return h?(d=a.filter(function(l){return _.ih(l.language)===h}),!0):!1});if(c){b=Wx(d,c);if(b.length)return b;_.G("No exact match for the text role could be found.")}else if(b=d.filter(function(g){return 0===g.roles.length}),b.length)return b;b=d.map(function(g){return g.roles}).reduce(_.Nv,
70
- []);return b.length?Wx(d,b[0]):d};Wx=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};Yx=function(a,b,c){for(var d=0;d<c.length;d++)if(c[d].audio===a&&c[d].video===b)return c[d];return null};
71
- Qx=function(a){var b=fw(a);return a.type===_.mc?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.Re?"type\x3dvideo mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" frameRate\x3d"+a.frameRate+" width\x3d"+a.width+" height\x3d"+a.height:"unexpected stream type"};
72
- Zx=function(a,b){var c=String(_.zi++);c=new _.ui(c,a);c.mimeType=_.vi(b.mimeType);if(a===_.P||a===_.R)c.label=_.vi(b.label),c.language=_.vi(b.language),c.originalLanguage=_.vi(b.originalLanguage);a===_.wi?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.R?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.vi(b.audioMimeType)):(c.kind=_.vi(b.kind),c.roles=b.roles);c.accessibility=a===_.wi||a===_.R?(b.accessibility||[]).filter(function(d){return d.type===a}):b.accessibility||[];return c};
73
- $x=function(a,b,c){var d=new _.Ci(a===_.wi?""+b.videoId:a===_.R?""+b.audioId:""+b.id,c);switch(a){case _.wi:d.codec=_.vi(b.videoCodec);d.bandwidth=b.videoBandwidth||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.originalVideoId;d.drm={keyId:b.keyId||void 0};break;case _.R:d.codec=_.vi(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;d.drm={keyId:b.keyId||void 0};break;default:d.codec=_.vi(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.K.pa(e,
74
- d,null,["id","track"])}))||c.renditions.push(d);return a||d};ay=function(a,b){var c=a.reduce(function(d,e){b===_.wi?null===e.videoId||d[e.videoId]&&!e.active||(d[e.videoId]=e):b===_.R&&(null===e.audioId||d[e.audioId]&&!e.active||(d[e.audioId]=e));return d},{});return Object.values(c)};by=function(a,b){if(void 0!==b&&null!==b){var c=a.filter(function(d){return d.audio&&d.audio.id===b});if(0<c.length)return c}return a};
75
- cy=function(a,b,c){function d(f,g){return null==f?null==g:g.id==f}for(var e=0;e<c.length;e++)if(d(a,c[e].audio)&&d(b,c[e].video))return c[e];return null};dy=function(){this.h=new _.I("cl.api.mse.TrackManager");this.l=null;this.g=[];this.a=new Map;this.f=new Map};ey=function(a,b){return a.g.filter(function(c){return c.type===b})};fy=function(a,b){var c=a.a.get(b)||null;return c&&c.track};hy=function(a,b,c){c&&fy(a,c.type)===c&&!a.l.ka()||gy(a,b,c&&c.renditions[0])};
76
- iy=function(a,b){a.a.set(b.track.type,b);b===(a.f.get(b.track.type)||null)&&a.f.set(b.track.type,null)};
77
- gy=function(a,b,c,d){d=void 0===d?!1:d;if(a.l&&((a.a.get(b)||null)!==c||a.l.ka())){var e=a.l;if(c){if(0>a.g.indexOf(c.track))throw Error("Unknown rendition with ID "+c.id);if(b!==c.track.type)throw Error("Types mismatch");a.h.debug("Activate rendition type\n "+b+" with ID: "+c.id);if(b===_.P){var f=e.ia().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),iy(a,c),e.trigger(new _.J(_.Uj)),jy(e,!0).then(function(){ky(e,f)})["catch"](function(n){a.h.warn("Error while activating track",n)}))}else if(b===
78
- _.R)a.f.set(b,c),ly(e,parseInt(c.id,10));else if(b===_.wi){var g=a.a.get(_.R)||null,h=null;if(g){var l=my(e).filter(function(n){return n.videoId==c.id});h=l.find(function(n){return n.audioId==g.id})||null;if(!h){a.h.debug("Unable to find exact variant. Searching for equivalent");var m=g.track.renditions.map(function(n){return n.id}).filter(function(n){return n!==g.id});h=l.find(function(n){return m.find(function(p){return p==n.audioId})})||null}}else h=my(e).find(function(n){return n.videoId==c.id})||
79
- null;h?(a.f.set(b,c),ny(e,h,d)):a.h.warn("Cannot find matching variant")}}else a.h.debug(_.Ba+b),fy(a,b)&&(b===_.P?jy(e,!1).then(function(){a.a.set(b,null);e.trigger(new _.J(_.Uj))})["catch"](function(n){a.h.warn("Error while de-activating text tracks",n)}):b===_.R?a.h.info("Enabling ABR for audio is not supported"):ny(e,null,d))}};
80
- qy=function(a){if(a.l){a.h.debug("Track list change detected, updating track list");for(var b=[],c=_.u(Object.values(_.sq)),d=c.next();!d.done;d=c.next())d=d.value,a.a.set(d,null),a.f.set(d,null);c={};d=_.u(a.l.ia());for(var e=d.next();!e.done;c={Yb:c.Yb},e=d.next()){e=e.value;c.Yb=Zx(_.P,e);var f=b.find(function(h){return function(l){return h.Yb.pa(l)}}(c));c.Yb=f||c.Yb;var g=$x(_.P,e,c.Yb);e.active&&a.a.set(_.P,g);f||b.push(c.Yb)}oy(a.l)||a.a.set(_.P,null);c=my(a.l);py(a,b,c,_.wi);py(a,b,c,_.R);
81
- a.g=b}};py=function(a,b,c,d){var e=ay(c,d);c={};e=_.u(e);for(var f=e.next();!f.done;c={Zb:c.Zb},f=e.next()){f=f.value;c.Zb=Zx(d,f);var g=b.find(function(l){return function(m){return l.Zb.pa(m)}}(c));c.Zb=g||c.Zb;var h=$x(d,f,c.Zb);f.active&&a.a.set(d,h);g||b.push(c.Zb)}};
82
- ry=function(a,b,c){if(b){a.g.length||qy(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.u(ey(a,d)),h=g.next();!h.done&&!(f=h.value.renditions.find(function(l){return l.id==b.id}));h=g.next());f&&e!==f&&(iy(a,f),d===_.R?a.l.trigger(new _.J(_.Tj)):d===_.wi&&a.l.trigger(new _.J(_.Ve,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};sy=function(){this.f=new _.Fw(2);this.g=new _.Fw(5);this.a=0};ty=function(a,b){return 128E3>a.a?b:Math.min(_.Hw(a.f),_.Hw(a.g))};
83
- _.uy=function(){this.h=new _.I("clpp.abr");this.w=null;this.j=!1;this.f=new sy;this.o=[];this.m=1;this.B=this.A=!1;this.a=this.g=null};vy=function(a,b){a&&(b=b.filter(function(c){return Ox(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};wy=function(){this.a=new Map};yy=function(a,b){a.a.has(b)||a.a.set(b,new xy);return a.a.get(b)};xy=function(){this.text=this.variant=null};
84
- zy=function(a,b){this.f=a;this.a=new Set([a]);b=b||[];for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.add(d.value)};Cy=function(a,b){var c;if(!(c=!!a.audio!=!!b.audio||!!a.video!=!!b.video||a.language!=b.language)&&(c=a.audio&&b.audio)){c=a.audio;var d=b.audio;c=!(c.channelsCount==d.channelsCount&&Ay(c,d)&&By(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!(Ay(c,d)&&By(c.roles,d.roles)));return c?!1:!0};
85
- Ay=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.gw(f)[0]}),d=b.codecs.split(",").map(function(f){return _.gw(f)[0]});if(c.length!=d.length)return!1;c.sort();d.sort();for(var e=0;e<c.length;e++)if(c[e]!=d[e])return!1;return!0};By=function(a,b){var c=new Set(a),d=new Set(b);c["delete"]("main");d["delete"]("main");if(c.size!=d.size)return!1;c=_.u(c);for(var e=c.next();!e.done;e=c.next())if(!d.has(e.value))return!1;return!0};
86
- Ey=function(a){this.a=a;this.f=new Dy(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)};Dy=function(a,b,c){this.g=_.tg(a);this.a=b;this.f=c};Fy=function(a,b){var c=null;b.some(function(d){c=_.Vv(_.ih(d),a.map(function(e){return Uv(e)}));return!!c});return c?a.filter(function(d){return c===Uv(d)}):[]};Gy=function(a,b){return a.filter(function(c){var d=c.audio;c=c.video;return d&&0<=d.roles.indexOf(b)||c&&0<=c.roles.indexOf(b)})};
87
- Jy=function(a,b){this.a=Hy;this.f=(new Map).set(Hy,b).set(Iy,a)};
88
- Ly=function(a){var b=this;this.C=a;this.a=a.getConfiguration().streaming;this.f=new _.eg;this.h=new _.I("clpp.mse.media.LiveEdgeObserver");Ky(this)&&(a=this.C.getSurface().getMedia(),this.f.on(a,_.Fe,function(){var c=b.C.getPosition(),d=b.C.getSeekRange().end;c=d-c;var e=b.C.getPlaybackRate(),f=b.a.stopChasingAt;1<=e&&c>=b.a.chaseJumpDistance?(b.h.debug("Too far from edge, jump to beginning."),b.C.setPlaybackRate(1),b.C.seek(d)):1===e&&c>=b.a.startChasingAt?(b.h.debug("Not on live edge, increase playback rate."),
63
+ az=function(a){return{id:a.id,active:!1,type:_.$e,bandwidth:0,language:a.language,originalLanguage:a.originalLanguage,label:a.label,kind:a.kind||null,width:null,height:null,frameRate:null,mimeType:a.mimeType,audioMimeType:null,codecs:a.codecs||null,audioCodec:null,videoCodec:null,primary:a.primary,roles:a.roles,audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:a.originalId,accessibility:a.accessibility,
64
+ keyId:null}};bz=function(a){return a.allowedByApplication&&a.allowedByKeySystem};Qy=function(a,b){var c=a.filter(function(g){return g.audio&&g.audio.channelsCount}),d=new Map;c=_.u(c);for(var e=c.next();!e.done;e=c.next()){e=e.value;var f=e.audio.channelsCount;d.has(f)||d.set(f,[]);d.get(f).push(e)}c=Array.from(d.keys());if(0===c.length)return a;e=c.filter(function(g){return g<=b});return e.length?d.get(Math.max.apply(null,e)):d.get(Math.min.apply(null,c))};
65
+ _.dz=function(a,b,c){b=_.Tg(b);var d=a,e=a.filter(function(g){return g.primary});e.length&&(d=e);var f=d.length?d[0].language:"";d=d.filter(function(g){return g.language===f});b.some(function(g){var h=_.ox(_.Jh(g),a.map(function(l){return l.language}));return h?(d=a.filter(function(l){return _.Jh(l.language)===h}),!0):!1});if(c){b=cz(d,c);if(b.length)return b;_.J("No exact match for the text role could be found.")}else if(b=d.filter(function(g){return 0===g.roles.length}),b.length)return b;b=d.map(function(g){return g.roles}).reduce(_.gx,
66
+ []);return b.length?cz(d,b[0]):d};cz=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};ez=function(a,b,c){for(var d=0;d<c.length;d++)if(c[d].audio===a&&c[d].video===b)return c[d];return null};
67
+ Xy=function(a){var b=zx(a);return a.type===_.rc?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.uf?"type\x3dvideo mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" frameRate\x3d"+a.frameRate+" width\x3d"+a.width+" height\x3d"+a.height:"unexpected stream type"};
68
+ fz=function(a,b){var c=String(_.Zi++);c=new _.Ui(c,a);c.mimeType=_.Vi(b.mimeType);if(a===_.S||a===_.T)c.label=_.Vi(b.label),c.language=_.Vi(b.language),c.originalLanguage=_.Vi(b.originalLanguage);a===_.Wi?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.T?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.Vi(b.audioMimeType)):(c.kind=_.Vi(b.kind),c.roles=b.roles);c.accessibility=a===_.Wi||a===_.T?(b.accessibility||[]).filter(function(d){return d.type===a}):b.accessibility||[];return c};
69
+ gz=function(a,b,c){var d=new _.bj(a===_.Wi?""+b.videoId:a===_.T?""+b.audioId:""+b.id,c);switch(a){case _.Wi:d.codec=_.Vi(b.videoCodec);d.bandwidth=b.videoBandwidth||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.originalVideoId;d.drm={keyId:b.keyId||void 0};break;case _.T:d.codec=_.Vi(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;d.drm={keyId:b.keyId||void 0};break;default:d.codec=_.Vi(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.M.pa(e,
70
+ d,null,["id","track"])}))||c.renditions.push(d);return a||d};hz=function(a,b){var c=a.reduce(function(d,e){b===_.Wi?null===e.videoId||d[e.videoId]&&!e.active||(d[e.videoId]=e):b===_.T&&(null===e.audioId||d[e.audioId]&&!e.active||(d[e.audioId]=e));return d},{});return Object.values(c)};iz=function(a,b){if(void 0!==b&&null!==b){var c=a.filter(function(d){return d.audio&&d.audio.id===b});if(0<c.length)return c}return a};
71
+ jz=function(a,b,c){function d(f,g){return null==f?null==g:g.id==f}for(var e=0;e<c.length;e++)if(d(a,c[e].audio)&&d(b,c[e].video))return c[e];return null};kz=function(){this.h=new _.K("cl.api.mse.TrackManager");this.m=null;this.g=[];this.a=new Map;this.f=new Map};lz=function(a,b){return a.g.filter(function(c){return c.type===b})};mz=function(a,b){var c=a.a.get(b)||null;return c&&c.track};oz=function(a,b,c){c&&mz(a,c.type)===c&&!a.m.ka()||nz(a,b,c&&c.renditions[0])};
72
+ pz=function(a,b){a.a.set(b.track.type,b);b===(a.f.get(b.track.type)||null)&&a.f.set(b.track.type,null)};
73
+ nz=function(a,b,c,d){d=void 0===d?!1:d;if(a.m&&((a.a.get(b)||null)!==c||a.m.ka())){var e=a.m;if(c){if(0>a.g.indexOf(c.track))throw Error("Unknown rendition with ID "+c.id);if(b!==c.track.type)throw Error("Types mismatch");a.h.debug("Activate rendition type\n "+b+" with ID: "+c.id);if(b===_.S){var f=e.ia().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),pz(a,c),e.trigger(new _.L(_.uk)),qz(e,!0).then(function(){rz(e,f)})["catch"](function(n){a.h.warn("Error while activating track",n)}))}else if(b===
74
+ _.T)a.f.set(b,c),sz(e,parseInt(c.id,10));else if(b===_.Wi){var g=a.a.get(_.T)||null,h=null;if(g){var l=tz(e).filter(function(n){return n.videoId==c.id});h=l.find(function(n){return n.audioId==g.id})||null;if(!h){a.h.debug("Unable to find exact variant. Searching for equivalent");var m=g.track.renditions.map(function(n){return n.id}).filter(function(n){return n!==g.id});h=l.find(function(n){return m.find(function(p){return p==n.audioId})})||null}}else h=tz(e).find(function(n){return n.videoId==c.id})||
75
+ null;h?(a.f.set(b,c),uz(e,h,d)):a.h.warn("Cannot find matching variant")}}else a.h.debug(_.Fa+b),mz(a,b)&&(b===_.S?qz(e,!1).then(function(){a.a.set(b,null);e.trigger(new _.L(_.uk))})["catch"](function(n){a.h.warn("Error while de-activating text tracks",n)}):b===_.T?a.h.info("Enabling ABR for audio is not supported"):uz(e,null,d))}};
76
+ xz=function(a){if(a.m){a.h.debug("Track list change detected, updating track list");for(var b=[],c=_.u(Object.values(_.Fr)),d=c.next();!d.done;d=c.next())d=d.value,a.a.set(d,null),a.f.set(d,null);c={};d=_.u(a.m.ia());for(var e=d.next();!e.done;c={Xb:c.Xb},e=d.next()){e=e.value;c.Xb=fz(_.S,e);var f=b.find(function(h){return function(l){return h.Xb.pa(l)}}(c));c.Xb=f||c.Xb;var g=gz(_.S,e,c.Xb);e.active&&a.a.set(_.S,g);f||b.push(c.Xb)}vz(a.m)||a.a.set(_.S,null);c=tz(a.m);wz(a,b,c,_.Wi);wz(a,b,c,_.T);
77
+ a.g=b}};wz=function(a,b,c,d){var e=hz(c,d);c={};e=_.u(e);for(var f=e.next();!f.done;c={Yb:c.Yb},f=e.next()){f=f.value;c.Yb=fz(d,f);var g=b.find(function(l){return function(m){return l.Yb.pa(m)}}(c));c.Yb=g||c.Yb;var h=gz(d,f,c.Yb);f.active&&a.a.set(d,h);g||b.push(c.Yb)}};
78
+ yz=function(a,b,c){if(b){a.g.length||xz(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.u(lz(a,d)),h=g.next();!h.done&&!(f=h.value.renditions.find(function(l){return l.id==b.id}));h=g.next());f&&e!==f&&(pz(a,f),d===_.T?a.m.trigger(new _.L(_.tk)):d===_.Wi&&a.m.trigger(new _.L(_.yf,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};zz=function(){this.f=new _.Nx(2);this.g=new _.Nx(5);this.a=0};
79
+ _.Az=function(){this.h=new _.K("clpp.abr");this.w=null;this.g=!1;this.o=new zz;this.l=[];this.j=1;this.D=this.B=!1;this.A=this.a=this.f=null};Bz=function(a,b){a&&(b=b.filter(function(c){return Vy(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};Cz=function(){this.a=new Map};Ez=function(a,b){a.a.has(b)||a.a.set(b,new Dz);return a.a.get(b)};Dz=function(){this.text=this.variant=null};
80
+ Fz=function(a,b){this.f=a;this.a=new Set([a]);b=b||[];for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.add(d.value)};Iz=function(a,b){var c;if(!(c=!!a.audio!=!!b.audio||!!a.video!=!!b.video||a.language!=b.language)&&(c=a.audio&&b.audio)){c=a.audio;var d=b.audio;c=!(c.channelsCount==d.channelsCount&&Gz(c,d)&&Hz(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!(Gz(c,d)&&Hz(c.roles,d.roles)));return c?!1:!0};
81
+ Gz=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.Ax(f)[0]}),d=b.codecs.split(",").map(function(f){return _.Ax(f)[0]});if(c.length!=d.length)return!1;c.sort();d.sort();for(var e=0;e<c.length;e++)if(c[e]!=d[e])return!1;return!0};Hz=function(a,b){var c=new Set(a),d=new Set(b);c["delete"]("main");d["delete"]("main");if(c.size!=d.size)return!1;c=_.u(c);for(var e=c.next();!e.done;e=c.next())if(!d.has(e.value))return!1;return!0};
82
+ Kz=function(a){this.a=a;this.f=new Jz(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)};Jz=function(a,b,c){this.g=_.Tg(a);this.a=b;this.f=c};Lz=function(a,b){var c=null;b.some(function(d){c=_.ox(_.Jh(d),a.map(function(e){return nx(e)}));return!!c});return c?a.filter(function(d){return c===nx(d)}):[]};Mz=function(a,b){return a.filter(function(c){var d=c.audio;c=c.video;return d&&0<=d.roles.indexOf(b)||c&&0<=c.roles.indexOf(b)})};
83
+ Pz=function(a,b){this.a=Nz;this.f=(new Map).set(Nz,b).set(Oz,a)};
84
+ Rz=function(a){var b=this;this.C=a;this.a=a.getConfiguration().streaming;this.f=new _.Eg;this.h=new _.K("clpp.mse.media.LiveEdgeObserver");Qz(this)&&(a=this.C.getSurface().getMedia(),this.f.on(a,_.cf,function(){var c=b.C.getPosition(),d=b.C.getSeekRange().end;c=d-c;var e=b.C.getPlaybackRate(),f=b.a.stopChasingAt;1<=e&&c>=b.a.chaseJumpDistance?(b.h.debug("Too far from edge, jump to beginning."),b.C.setPlaybackRate(1),b.C.seek(d)):1===e&&c>=b.a.startChasingAt?(b.h.debug("Not on live edge, increase playback rate."),
89
85
  b.C.setPlaybackRate(b.a.chasingRate)):1<e&&c<=f&&(b.h.debug("On live edge, reduce playback rate."),b.C.setPlaybackRate(1))}))};
90
- Ky=function(a){return 1>=a.a.chasingRate?(a.h.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.h.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.h.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.h.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};My=function(a){this.g=a;this.a=null;this.f=function(){}};Ny=function(a,b){a.f=b};
91
- Oy=function(a){var b=this;this.a=a;this.j=!1;this.g=this.a.Ke();this.f=new _.$i(function(){b.a.Vj(.25*b.g)})};Py=function(a){a.f.stop();var b=a.j?0:a.g;0<=b?a.a.Ke()!=b&&a.a.gh(b):(a.f.fb(.25),0!=a.a.Ke()&&a.a.gh(0))};Ry=function(a,b){this.g=a;this.m=Qy(a);this.a=a.a.currentTime;this.j=Date.now()/1E3;this.o=b;this.f=function(){}};Sy=function(a,b){a.f=b};Ty=function(a){this.a=a};
92
- Qy=function(a){if(a.a.paused||0==a.a.playbackRate||0===a.a.buffered.length)var b=!1;else a:{b=a.a.buffered;a=a.a.currentTime;for(var c=0;c<b.length;c++){var d=b.start(c),e=b.end(c);if(!(a<d-.1||a>e-(c+1===b.length?.5:.1))){b=!0;break a}}b=!1}return b};Vy=function(a,b,c,d,e){var f=this;this.a=a;this.F=b;this.m=c;this.D=e;this.g=new _.eg;this.B=!1;this.I=a.readyState;this.j=!1;this.f=d;this.o=this.H=this.A=!1;this.g.on(a,_.Ze,function(){return Uy(f)});this.w=(new _.$i(function(){Uy(f)})).fb(.25)};
93
- Uy=function(a){if(0!=a.a.readyState){if(a.a.seeking){if(!a.B)return}else a.B=!1;if(!a.a.paused&&!a.o){a.a.readyState!=a.I&&(a.j=!1,a.I=a.a.readyState);var b=a.m.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.Zj(d);var f=a.m.gapDetectionThreshold;if(e.length&&!(1===e.length&&1E-6>e.end(0)-e.start(0)))for(var g=0;g<e.length;g++)if(e.start(g)>c&&(0===g||e.end(g-1)-c<=f)){e=g;break a}e=null}if(null==e){if(a.f){a=a.f;d=a.g;c=Qy(d);d=d.a.currentTime;b=Date.now()/1E3;if(a.a!=d||a.m!=c)a.j=
94
- b,a.a=d,a.m=c;d=b-a.j;d>=a.o&&c&&a.f(a.a,d)}}else if((0!=e||a.A)&&a.H&&(f=d.start(e),!(f>=Rw(a.F)))){g=f-c;b=g<=b;var h=!1;if(!(.001>g)){if(!b&&!a.j){a.j=!0;var l=new _.J("largegap",{detail:{currentTime:c,gapSize:g}});l.cancelable=!0;a.D(l);a.m.jumpLargeGaps&&!l.defaultPrevented?h=!0:_.Tf("Ignoring large gap at",c,"size",g)}if(b||h)0==e?_.Tf(gv,g,"seconds because of gap before start time of",f):_.Tf(gv,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
95
- Zy=function(a,b,c,d){this.a=a;this.j=b;this.o=d;this.A=c;this.m=!1;this.f=new _.eg;this.g=new Wy(a);this.w=!1;0<a.readyState?Xy(this,c):Yy(this,c)};$y=function(a){return a.m?a.a.currentTime:a.A};bz=function(a,b){0<a.a.readyState?az(a.g,b):Yy(a,b)};Yy=function(a,b){a.A=b;a.f.off(a.a,_.xd);a.f.one(a.a,_.xd,function(){Xy(a,b)})};Xy=function(a,b){a.w||(a.w=!0,a.o&&a.o());.001>Math.abs(a.a.currentTime-b)?cz(a):(a.f.one(a.a,_.me,function(){cz(a)}),az(a.g,0==a.a.currentTime?b:a.a.currentTime))};
96
- cz=function(a){_.ej()&&!a.m&&a.j();a.m=!0;a.f.on(a.a,_.me,function(){return a.j()})};Wy=function(a){var b=this;this.f=a;this.o=10;this.m=this.g=this.j=0;this.a=new _.$i(function(){0>=b.j?(_.G(["Failed to move playhead from",b.g,"to",b.m].join(" ")),b.a.stop()):b.f.currentTime!=b.g?b.a.stop():(b.f.currentTime=b.m,b.j--)})};az=function(a,b){a.g=a.f.currentTime;a.m=b;a.j=a.o;a.f.currentTime=b;a.a.fb(.1)};
97
- gz=function(a,b,c,d,e,f){var g=this;this.g=a;this.a=b.presentationTimeline;this.B=b.minBufferTime||0;this.m=c;this.A=e;this.w=null;this.j=new Vy(a,b.presentationTimeline,c,dz(this,a,c),f);this.f=new Zy(a,function(){a:{var h=g.j;h.B=!0;h.A=!1;h.j=!1;h=$y(g.f);var l=ez(g,h);if(.001<Math.abs(l-h)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;bz(g.f,l);h=void 0;break a}}g.h.debug("Seek to "+h);g.A();h=void 0}return h},fz(this,d),function(){g.j.H=!0});this.o=(new _.$i(function(){if(0!=g.g.readyState&&
98
- !g.g.paused){var h=$y(g.f),l=_.Sw(g.a,0),m=Rw(g.a);3>m-l&&(l=m-3);h<l&&(l=ez(g,h),g.h.info("Jumping forward "+(l-h)+" seconds to catch up with the seek range."),g.g.currentTime=l)}})).fb(.25);this.h=new _.I("clpp.mse.Playhead")};iz=function(a){var b=$y(a.f);return 0<a.g.readyState&&!a.g.paused?hz(a,b):b};fz=function(a,b){null==b?b=Infinity>a.a.getDuration()?_.Sw(a.a,0):Rw(a.a):0>b&&(b=Rw(a.a)+b);return jz(a,hz(a,b))};jz=function(a,b){var c=a.a.getDuration();return b>=c?c-a.m.durationBackoff:b};
99
- ez=function(a,b){var c=new _.Zj(a.g.buffered);c=c.hc.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal),e=a.m.safeSeekOffset,f=_.Sw(a.a,0),g=Rw(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);var l=_.Sw(a.a,d),m=_.Sw(a.a,e);d=_.Sw(a.a,d+e);if(b>=h)return a.h.debug("Playhead past duration."),jz(a,b);if(b>g)return a.h.debug("Playhead past end."),g;if(b<f){if(c(m))return a.h.debug("Playhead before start \x26 start is buffered"),m;a.h.debug("Playhead before start \x26 start is unbuffered");return d}if(b>=l||c(b))return a.h.debug("Playhead in safe region or in buffered region."),
100
- b;a.h.debug("Playhead outside safe region \x26 in unbuffered region.");return d};hz=function(a,b){var c=_.Sw(a.a,0);if(b<c)return c;c=Rw(a.a);return b>c?c:b};
101
- dz=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new Ry(new Ty(b),c.stallThreshold);Sy(c,function(f,g){a.h.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var h=new _.Zj(b.buffered),l;if(l=_.cj("Edge/")||_.cj("Trident/")||_.mi()||_.ej())a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){l=h.start(l+1)-h.end(l)>=d;break a}l=!1}if(l){a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){h=
86
+ Qz=function(a){return 1>=a.a.chasingRate?(a.h.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.h.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.h.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.h.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};Sz=function(a){this.g=a;this.a=null;this.f=function(){}};Tz=function(a,b){a.f=b};
87
+ Uz=function(a){var b=this;this.a=a;this.j=!1;this.g=this.a.Me();this.f=new _.zj(function(){b.a.ek(.25*b.g)})};Vz=function(a){a.f.stop();var b=a.j?0:a.g;0<=b?a.a.Me()!=b&&a.a.lh(b):(a.f.eb(.25),0!=a.a.Me()&&a.a.lh(0))};Xz=function(a,b){this.g=a;this.l=Wz(a);this.a=a.a.currentTime;this.j=Date.now()/1E3;this.o=b;this.f=function(){}};Yz=function(a,b){a.f=b};Zz=function(a){this.a=a};
88
+ Wz=function(a){if(a.a.paused||0==a.a.playbackRate||0===a.a.buffered.length)var b=!1;else a:{b=a.a.buffered;a=a.a.currentTime;for(var c=0;c<b.length;c++){var d=b.start(c),e=b.end(c);if(!(a<d-.1||a>e-(c+1===b.length?.5:.1))){b=!0;break a}}b=!1}return b};aA=function(a,b,c,d,e){var f=this;this.a=a;this.F=b;this.l=c;this.D=e;this.g=new _.Eg;this.B=!1;this.I=a.readyState;this.j=!1;this.f=d;this.o=this.H=this.A=!1;this.g.on(a,_.Cf,function(){return $z(f)});this.w=(new _.zj(function(){$z(f)})).eb(.25)};
89
+ $z=function(a){if(0!=a.a.readyState){if(a.a.seeking){if(!a.B)return}else a.B=!1;if(!a.a.paused&&!a.o){a.a.readyState!=a.I&&(a.j=!1,a.I=a.a.readyState);var b=a.l.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.zk(d);var f=a.l.gapDetectionThreshold;if(e.length&&!(1===e.length&&1E-6>e.end(0)-e.start(0)))for(var g=0;g<e.length;g++)if(e.start(g)>c&&(0===g||e.end(g-1)-c<=f)){e=g;break a}e=null}if(null==e){if(a.f){a=a.f;d=a.g;c=Wz(d);d=d.a.currentTime;b=Date.now()/1E3;if(a.a!=d||a.l!=c)a.j=
90
+ b,a.a=d,a.l=c;d=b-a.j;d>=a.o&&c&&a.f(a.a,d)}}else if((0!=e||a.A)&&a.H&&(f=d.start(e),!(f>=Yx(a.F)))){g=f-c;b=g<=b;var h=!1;if(!(.001>g)){if(!b&&!a.j){a.j=!0;var l=new _.L("largegap",{detail:{currentTime:c,gapSize:g}});l.cancelable=!0;a.D(l);a.l.jumpLargeGaps&&!l.defaultPrevented?h=!0:_.tg("Ignoring large gap at",c,"size",g)}if(b||h)0==e?_.tg(vw,g,"seconds because of gap before start time of",f):_.tg(vw,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
91
+ eA=function(a,b,c,d){this.a=a;this.j=b;this.o=d;this.A=c;this.l=!1;this.f=new _.Eg;this.g=new bA(a);this.w=!1;0<a.readyState?cA(this,c):dA(this,c)};fA=function(a){return a.l?a.a.currentTime:a.A};hA=function(a,b){0<a.a.readyState?gA(a.g,b):dA(a,b)};dA=function(a,b){a.A=b;a.f.off(a.a,_.Od);a.f.one(a.a,_.Od,function(){cA(a,b)})};cA=function(a,b){a.w||(a.w=!0,a.o&&a.o());.001>Math.abs(a.a.currentTime-b)?iA(a):(a.f.one(a.a,_.Me,function(){iA(a)}),gA(a.g,0==a.a.currentTime?b:a.a.currentTime))};
92
+ iA=function(a){_.Gj()&&!a.l&&a.j();a.l=!0;a.f.on(a.a,_.Me,function(){return a.j()})};bA=function(a){var b=this;this.f=a;this.o=10;this.l=this.g=this.j=0;this.a=new _.zj(function(){0>=b.j?(_.J(["Failed to move playhead from",b.g,"to",b.l].join(" ")),b.a.stop()):b.f.currentTime!=b.g?b.a.stop():(b.f.currentTime=b.l,b.j--)})};gA=function(a,b){a.g=a.f.currentTime;a.l=b;a.j=a.o;a.f.currentTime=b;a.a.eb(.1)};
93
+ mA=function(a,b,c,d,e,f){var g=this;this.g=a;this.a=b.presentationTimeline;this.B=b.minBufferTime||0;this.l=c;this.A=e;this.w=null;this.j=new aA(a,b.presentationTimeline,c,jA(this,a,c),f);this.f=new eA(a,function(){a:{var h=g.j;h.B=!0;h.A=!1;h.j=!1;h=fA(g.f);var l=kA(g,h);if(.001<Math.abs(l-h)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;hA(g.f,l);h=void 0;break a}}g.h.debug("Seek to "+h);g.A();h=void 0}return h},lA(this,d),function(){g.j.H=!0});this.o=(new _.zj(function(){if(0!=g.g.readyState&&
94
+ !g.g.paused){var h=fA(g.f),l=_.Zx(g.a,0),m=Yx(g.a);3>m-l&&(l=m-3);h<l&&(l=kA(g,h),g.h.info("Jumping forward "+(l-h)+" seconds to catch up with the seek range."),g.g.currentTime=l)}})).eb(.25);this.h=new _.K("clpp.mse.Playhead")};oA=function(a){var b=fA(a.f);return 0<a.g.readyState&&!a.g.paused?nA(a,b):b};lA=function(a,b){null==b?b=Infinity>a.a.getDuration()?_.Zx(a.a,0):Yx(a.a):0>b&&(b=Yx(a.a)+b);return pA(a,nA(a,b))};pA=function(a,b){var c=a.a.getDuration();return b>=c?c-a.l.durationBackoff:b};
95
+ kA=function(a,b){var c=new _.zk(a.g.buffered);c=c.fc.bind(c);var d=Math.max(a.B,a.l.rebufferingGoal),e=a.l.safeSeekOffset,f=_.Zx(a.a,0),g=Yx(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);var l=_.Zx(a.a,d),m=_.Zx(a.a,e);d=_.Zx(a.a,d+e);if(b>=h)return a.h.debug("Playhead past duration."),pA(a,b);if(b>g)return a.h.debug("Playhead past end."),g;if(b<f){if(c(m))return a.h.debug("Playhead before start \x26 start is buffered"),m;a.h.debug("Playhead before start \x26 start is unbuffered");return d}if(b>=l||c(b))return a.h.debug("Playhead in safe region or in buffered region."),
96
+ b;a.h.debug("Playhead outside safe region \x26 in unbuffered region.");return d};nA=function(a,b){var c=_.Zx(a.a,0);if(b<c)return c;c=Yx(a.a);return b>c?c:b};
97
+ jA=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new Xz(new Zz(b),c.stallThreshold);Yz(c,function(f,g){a.h.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var h=new _.zk(b.buffered),l;if(l=_.Ej("Edge/")||_.Ej("Trident/")||_.Mi()||_.Gj())a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){l=h.start(l+1)-h.end(l)>=d;break a}l=!1}if(l){a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){h=
102
98
  h.start(l+1)-f;break a}h=null}h&&(e=Math.min(h+.1,e))}a.h.warn("Seeking forward "+e+" seconds to break stall.");b.currentTime+=e}else a.h.warn("Pausing and unpausing to break stall."),b.pause(),b.play()});return c};
103
- lz=function(a){function b(){d=!0}function c(m){f.push(m);_.Pk(m)}a=_.N(a);var d=!1,e,f=[],g=[];(new _.Ok).L(_.Fd,c).L(_.Ge,c).L(_.Ad,c).L(_.Ed,c).L(_.ue,c).Y(_.we,function(m){e=m;f.push(m);_.Qk(m)}).Y("encv",b).Y("enca",b).Y("avc1",function(m){g.push({L:m,Rc:1701733238})}).Y("avc3",function(m){g.push({L:m,Rc:1701733238})}).Y("ac-3",function(m){g.push({L:m,Rc:1701733217})}).Y("ec-3",function(m){g.push({L:m,Rc:1701733217})}).Y("mp4a",function(m){g.push({L:m,Rc:1701733217})}).parse(a);if(d)return _.Tf("Init segment already indicates encryption."),
104
- a;if(0===g.length||!e)throw _.Vf("Failed to find boxes needed to fake encryption!"),_.Vf("Failed init segment (hex):",_.Rh(a)),new _.L(_.M,3,14E3);g.reverse();for(var h=_.u(g),l=h.next();!l.done;l=h.next())l=l.value,_.Tf('Inserting "'+_.Tk(l.Rc)+'" box into init segment.'),a=kz(a,e,l.L,f,l.Rc);return a};
105
- kz=function(a,b,c,d,e){var f=mz.value(),g=a.subarray(c.start,c.start+c.size),h=_.vh(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.vh(l);g.setUint32(4,e);l.set(f,c.size);e=h.getUint32(4);g.setUint32(c.size+16,e);nz(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.cj("Xbox One")||_.bj()?c.start:c.start+c.size;f=a.subarray(c);e.set(a.subarray(0,c));e.set(l,c);e.set(f,c+l.byteLength);a=_.u(d);for(d=a.next();!d.done;d=a.next())d=d.value,nz(e,d.start,d.size+l.byteLength);l=_.vh(e,
106
- b.start);b=_.Uk(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};nz=function(a,b,c){a=_.vh(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.oz=function(a,b){this.C=b;this.f=a;this.j=null;this.w=1;this.F=Promise.resolve();this.m=[];this.o=new Map;this.a=new Map;this.I=this.g=this.A=this.B=!1;this.H=0;this.h=new _.I("clpp.mse.Streaming");this.D=!1};
107
- pz=function(a){var b=a.a.get(_.Re);return b?a.f.periods[b.Cb]:(b=a.a.get(_.mc))?a.f.periods[b.Cb]:null};rz=function(a){return _.qz(a,_.mc)};sz=function(a){return _.qz(a,_.Re)};
108
- xz=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.B(function(q){switch(q.a){case 1:return c=_.nn,_.x(q,a.C.W.clear(c.TEXT),2);case 2:return a.H++,a.I=!1,d=a.H,e=a.C.W,f=new Map,g=new Set,f.set(c.TEXT,b),g.add(b),_.x(q,e.init(f,!1,a.j.disableAudioTracks),3);case 3:return a.g?q["return"]():_.x(q,tz(a,g),4);case 4:if(a.g)return q["return"]();l=(h=e.getTextDisplayer().isTextVisible())||a.j.alwaysStreamText;a.H!=d||a.a.has(c.TEXT)||a.I||!l||(m=a.C.zb(),n=uz(a,m),p=vz(b,n,0),a.a.set(c.TEXT,p),wz(a,p,0));
109
- _.y(q)}})};Az=function(a){a.I=!0;var b=a.a.get(_.Ce);b&&(yz(b),zz(b)["catch"](function(){}),a.a["delete"](_.Ce))};Cz=function(a,b,c,d){b.video&&_.Bz(a,b.video,c,d);b.audio&&_.Bz(a,b.audio,c,d)};
110
- Ez=function(a){function b(l){return a.C.W.hc(l,c,0)}var c=a.C.zb(),d=!1,e=uz(a,c);if(_.lh(a.a.values(),function(l){return l.Cb==e}))for(var f=_.u(a.a.keys()),g=f.next();!g.done;g=f.next()){g=g.value;var h=a.a.get(g);h.stream.segmentIterator=null;b(g)||(Dz(a,h),d=!0)}else if(!_.lh(a.a.keys(),b)){a.h.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.u(a.a.values());for(f=d.next();!f.done;f=d.next())Dz(a,f.value);d=!0}d||a.h.debug("(all): seeked: buffered seek: presentationTime\x3d"+
111
- c)};Hz=function(a,b){b=void 0===b?!1:b;if(a.g)a.h.error("Unable to retry after StreamingEngine is destroyed!");else if(a.A)a.h.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(var c=_.u(a.a.values()),d=c.next();!d.done;d=c.next()){d=d.value;var e=Fz(d);if(d.Oc||b&&Gz(d))a.h.info(e,"Retrying after failure..."),d.Oc=!1,wz(a,d,.1)}};
112
- Jz=function(a){var b,c,d,e;return _.B(function(f){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,yz(e),e.ab&&e.Fb&&(e.ab=!1,b.push(e.Fb.abort())),e.Ib&&b.push(Iz(a,e,!0,0));return _.x(f,Promise.all(b),0)})};Kz=function(a,b,c){(a=a.a.get(b))&&c&&(yz(a),a.stream=c,a.Rb=c,a.sa&&(a.sa=c.getSegmentReference(a.sa.position)),a.sa||(a.Rb=null))};_.qz=function(a,b){var c=a.a.get(b);return c?c.Vb||c.stream:null};
113
- _.Bz=function(a,b,c,d){var e=a.a.get(b.type);if(!e&&b.type==_.Ce&&a.j.ignoreTextStreamFailures)xz(a,b);else if(e){var f=Lz(a,b);if(c&&f!=e.Cb)for(a.h.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),b=_.u(a.a.values()),c=b.next();!c.done;c=b.next())Dz(a,c.value);else{e.Vb&&(a.h.debug("switch during trick play mode",b),b.trickModeVideo?(e.Vb=b,b=b.trickModeVideo,a.h.debug("switch found trick play stream",b)):(e.Vb=null,a.h.debug("switch found no special trick play stream")));
114
- var g=a.m[f];if(g&&g.Uc&&(g=a.o.get(b.id))&&g.Uc)if(e.stream!=b){g=a.f.presentationTimeline.getDuration();var h=a.C.zb();h=Mz(a,e,h);!c&&(e.endOfStream||h>=g)?a.h.debug(Ev+Fz(e)+" already buffered to the end. Not switching."):(b.type==_.Ce&&tx(a.C.W,_.Xi(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.td=!0,a.h.debug("switch: switching to Stream "+Fz(e)),Nz(a,e,f)&&(a.h.info("Aborting current segment request to switch."),e.Fb.abort()),c&&(e.$b?e.ge=!0:e.ab?(e.Ib=!0,e.Ld=d,e.ge=!0):
115
- (yz(e),Iz(a,e,!0,d)["catch"](function(l){if(a.C)a.C.onError(l)}))))}else a.h.debug(Ev+Fz(e)+" already active")}}};Nz=function(a,b,c){if(!b.Fb)return!1;var d=a.C.zb(),e=a.C.W.Da(b.type);c=(c=Oz(a,b,d,e,c))?c.ea?c.ea-c.ua+1:null:null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=(f.ea?f.ea-f.ua+1:null)||0);f=a.C.He().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.f.minBufferTime||0,a.j.rebufferingGoal))return!0;a=b.Fb;a=a.j?a.j.bytesRemaining:-1;return 0>a||a>c?!0:!1};
116
- Dz=function(a,b){var c=Fz(b);b.$b?a.h.debug(c,"clear: already clearing the buffer"):b.Ib?a.h.debug(c,"clear: already waiting"):b.ab?(a.h.debug(c,"clear: currently updating"),b.Ib=!0,b.Ld=0):null==a.C.W.ub(b.type)?(a.h.debug(c,"clear: nothing buffered"),null==b.tb&&wz(a,b,0)):(a.h.debug(c,"clear: handling right now"),yz(b),Iz(a,b,!1,0)["catch"](function(d){if(a.C)a.C.onError(d)}))};
117
- Qz=function(a,b,c,d,e){var f,g,h,l,m,n,p;return _.B(function(q){if(1==q.a)return f=a.C.zb(),g=uz(a,f),h=_.nn,l=new Map,m=new Set,b&&(l.set(h.AUDIO,b),m.add(b)),c&&(l.set(h.VIDEO,c),m.add(c)),d&&(l.set(h.TEXT,d),m.add(d)),n=a.C.W,p=a.j.forceNativeTS,_.x(q,n.init(l,p,a.j.disableAudioTracks),2);if(3!=q.a){if(a.g)return q["return"]();Pz(a);return _.x(q,tz(a,m),3)}if(a.g)return q["return"]();l.forEach(function(r,v){if(!a.a.has(v)){var z=vz(r,g,e);a.a.set(v,z);wz(a,z,0)}});_.y(q)})};
118
- vz=function(a,b,c){return{stream:a,type:a.type,Rb:null,segmentIterator:null,sa:null,Vb:null,td:!0,Cb:b,endOfStream:!1,ab:!1,tb:null,Ib:!1,Ld:0,ge:!1,$b:!1,mf:!1,Oc:!1,eh:c||0,Fb:null,Od:!1,xg:0}};
119
- Rz=function(a,b){var c=a.m[b];if(c)return a.h.debug("(all) Period "+b+Zu),c.P;a.h.debug("(all) setting up Period "+b);c={P:new _.fi,Uc:!1};a.m[b]=c;for(var d=new Set,e=_.u(a.f.periods[b].variants),f=e.next();!f.done;f=e.next())f=f.value,f.video&&d.add(f.video),f.video&&f.video.trickModeVideo&&d.add(f.video.trickModeVideo),f.audio&&d.add(f.audio);e=_.u(a.f.periods[b].textStreams);for(f=e.next();!f.done;f=e.next())d.add(f.value);a.F=a.F.then(function(){return a.g?null:tz(a,d)}).then(function(){a.g||
120
- (a.m[b].P.resolve(),a.m[b].Uc=!0,a.h.debug("(all) setup Period "+b))})["catch"](function(g){a.g||(a.m[b].P["catch"](function(){}),a.m[b].P.reject(),delete a.m[b],a.h.warn("(all) failed to setup Period "+b),a.C.onError(g))});return c.P};
121
- tz=function(a,b){var c,d,e,f,g,h,l,m,n,p,q;return _.B(function(r){switch(r.a){case 1:c=[];d=_.u(b);for(e=d.next();!e.done;e=d.next())f=e.value,(g=a.o.get(f.id))?(a.h.debug("(all) Stream "+f.id+Zu),c.push(g.P)):(a.h.debug("(all) setting up Stream "+f.id),a.o.set(f.id,{P:new _.fi,Uc:!1}),c.push(f.createSegmentIndex()));_.Bf(r,2);return _.x(r,Promise.all(c),4);case 4:if(a.g)return r["return"]();_.Cf(r,3);break;case 2:h=_.Df(r);if(a.g)return r["return"]();l=_.u(b);for(e=l.next();!e.done;e=l.next())m=
122
- e.value,a.o.get(m.id).P["catch"](function(){}),a.o.get(m.id).P.reject(),a.o["delete"](m.id);throw h;case 3:n=_.u(b);for(e=n.next();!e.done;e=n.next())p=e.value,q=a.o.get(p.id),q.Uc||(q.P.resolve(),q.Uc=!0,a.h.debug("(all) setup Stream "+p.id));_.y(r)}})};Pz=function(a){var b=a.f.presentationTimeline.getDuration();Infinity>b?Fx(a.C.W,b):Fx(a.C.W,Math.pow(2,32))};
123
- Uz=function(a,b){function c(p){return p.type==_.Ce&&p.stream.mimeType==_.ec}if(c(b))return Ax(a.C.W,b.stream.originalId||""),null;b.type==_.Ce&&Bx(a.C.W);if(!sx(a.C.W)&&b.type!=_.Ce)return a.j.bufferLimitUpdateInterval?a.j.bufferLimitUpdateInterval/2:.5;var d=Fz(b),e=a.C.zb(),f=Mz(a,b,e);a.h.debug(d,"timeNeeded\x3d"+f);var g=Lz(a,b.stream),h=uz(a,f),l=a.C.W.Ja(b.type,e);a.h.debug(d,"update_:",zv+e,"bufferedAhead\x3d"+l);var m=Math.max(a.f.minBufferTime||0,a.j.rebufferingGoal,a.j.bufferingGoal)*a.w,
124
- n=Lw(a.f.presentationTimeline);if(null!=n&&f>=n&&!b.Od)return Sz(a,b),null;b.endOfStream=!1;b.Cb=h;if(h!=g)return a.h.debug(d,"need Period "+h,zv+e,"timeNeeded\x3d"+f,"currentPeriodIndex\x3d"+g),null;if(l>=m)return a.h.debug(d,"buffering goal met"),a.j.bufferLimitUpdateInterval||.5;h=a.C.W.Da(b.type);h=Oz(a,b,e,h,g);if(!h)return a.f.presentationTimeline.isLive()||b.type===_.Ce?a.j.bufferLimitUpdateInterval||1:(a.h.debug("Media state "+d+": no next segment found. Assuming EOS."),Sz(a,b),null);d=Infinity;
125
- l=_.u(a.a.values());for(m=l.next();!m.done;m=l.next())m=m.value,c(m)||(m=Mz(a,m,e),d=Math.min(d,m));if(f>=d+a.f.presentationTimeline.a)return a.j.bufferLimitUpdateInterval||1;b.eh=0;Tz(a,b,e,g,h)["catch"](function(){});return null};Sz=function(a,b){a.h.debug(Fz(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.Re){var c=a.a.get(_.Ce);c&&c.stream.mimeType==_.ec&&(c.endOfStream=!0)}};
126
- Mz=function(a,b,c){if(!b.Rb||!b.sa)return Math.max(c,b.eh);c=Lz(a,b.Rb);return a.f.periods[c].startTime+b.sa.endTime};
127
- Oz=function(a,b,c,d,e){if(b.stream.segmentLookupStrategy===Vz)b.stream.segmentIterator?a=Ww(b.stream.segmentIterator):b.sa||d?(e=b.sa?b.sa.endTime:d,a.h.info(fv,"looking up segment from new stream endTime:",e),b.stream.segmentIterator=$w(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value,null===d&&(b.stream.segmentIterator=null,a.h.warn(fv,rv,"endTime:",e,b.sa)),a=d):(e=Math.max(c,0),a.h.info(fv,"looking up segment","lookupTime:",e,yv,c),d=null,d||(b.stream.segmentIterator=$w(b.stream.segmentIndex,
128
- c),d=b.stream.segmentIterator.next().value),null===d&&a.h.warn(fv,rv,"lookupTime:",e,yv,c),a=d);else{var f=Fz(b);b.sa&&b.stream==b.Rb?(d=b.sa.position+1,a.h.debug(f,"next position known:","position\x3d"+d),a=Wz(a,b,e,d)):(b.sa?(a.h.debug(f,"next position unknown: another Stream buffered"),c=Lz(a,b.Rb),c=Xz(a,b,a.f.periods[c].startTime+b.sa.endTime,e)):(a.h.debug(f,"next position unknown: nothing buffered"),c=Xz(a,b,d||c,e)),null==c?a=null:(f=null,null!=d||null!==a.j&&a.j.ignoreDrift||(f=Wz(a,b,e,
129
- Math.max(0,c-1))),a=f||Wz(a,b,e,c)))}return a};Xz=function(a,b,c,d){var e=Fz(b);d=a.f.periods[d];var f=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(f);a.h.debug(e,"Looked up segment:",zv+c,"lookupTime\x3d"+f,uv+d.startTime,"Result: segment position\x3d"+b);null==b&&a.h.warn(e,"cannot find segment:",uv+d.startTime,"lookupTime\x3d"+f);return b};
130
- Wz=function(a,b,c,d){var e=Fz(b);c=a.f.periods[c];var f=b.stream.getSegmentReference(d);if(!f)return a.h.debug(e,"segment does not exist:",uv+c.startTime,"position\x3d"+d),null;var g=a.f.presentationTimeline;d=_.Qw(g);g=Pw(g);return!b.Od&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.h.debug(e,"segment is not available:",uv+c.startTime,Cv+f.startTime,Av+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
131
- Tz=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,r,v,z,A,D;return _.B(function(F){f=_.nn;g=Fz(b);h=a.f.periods[d];a.h.debug(g,"fetchAndAppend_:",zv+c,uv+h.startTime,Bv+e.position,Cv+e.startTime,Av+e.endTime);l=b.stream;m=b.stream.segmentIterator;n=a.f.presentationTimeline.getDuration();p=a.f.periods[d+1];q=Math.max(0,h.startTime-.1);r=p?p.startTime+.01:n;v=Yz(a,b,d,q,r,e);b.ab=!0;b.td=!1;a.h.debug(g,"fetching segment");z=!1;A=function(E,H){if(a.g||a.A)return null;z=!0;return Zz(a,b,c,h,l,e,E,H)};D=a.C.W.Da(b.type)||
132
- 0;v.then(function(){return a.g||a.A?null:$z(a,b,e,!1,function(E){return A(E.data,!0)})}).then(function(E){return a.g||a.A?null:z||null===E?(aA(a,b,D,e,l),null):A(E,!1)}).then(function(){if(!a.g&&!a.A){aA(a,b,D,e,l);b.ab=!1;b.mf=!1;b.Ib||a.C.ce();if(m){var E=m.next().value;E&&a.h.debug("New iterated segment",E)}wz(a,b,0);bA(a,b,l);a.h.debug(g,"finished fetch and append")}})["catch"](function(E){return _.B(function(H){if(a.g||a.A)return H["return"]();b.ab=!1;if(b.type==f.TEXT&&a.j.ignoreTextStreamFailures)return 1001==
133
- E.code?a.h.warn(g,"Text stream failed to download. Proceeding without it."):a.h.warn(g,"Text stream failed to parse. Proceeding without it."),a.a["delete"](f.TEXT),H.G(0);if(7001==E.code)return b.ab=!1,b.tb=null,wz(a,b,0),H.G(0);if(3017===E.code)return cA(a,b,E),H.G(0);if(1001===E.code&&E.data&&404===E.data[1])return a.h.warn(g,"request for segment failed","segment not available on server",Bv+e.position,Cv+e.startTime,Av+e.endTime,"error\x3d"+E),b.ab=!1,b.tb=null,wz(a,b,1),H.G(0);if(b.type===f.TEXT)return E instanceof
134
- _.L&&E.a(1),yz(b),a.C.onError(new _.L(1,2,2010,E)),H.G(0);if(1001<=E.code&&1003>=E.code)return _.x(H,dA(a,b,h,E),0);a.h.error(g,"failed fetch and append: code\x3d"+E.code);b.Oc=!0;E instanceof _.L&&E.a(_.M);return _.x(H,eA(a,E),0)})});_.y(F)})};
135
- cA=function(a,b,c){var d=Fz(b);if(Array.from(a.a.values()).some(function(f){return f!=b&&f.mf}))a.h.debug(d,hv,"waiting for another stream to recover...");else{var e=Math.round(100*a.w);if(20<e)a.w-=.2;else if(4<e)a.w-=.04;else{a.h.error(d,"MediaSource threw QuotaExceededError too many times");b.Oc=!0;a.A=!0;a.C.onError(c);return}a.h.warn(d,hv,"reducing buffering goals by "+(100-Math.round(100*a.w))+"%");b.mf=!0}wz(a,b,4)};
136
- dA=function(a,b,c,d){var e,f;return _.B(function(g){e=1001===d.code&&500<=d.data.status;f=!0;e||(f=!a.C.ue(b.stream,c));if(!f)return g.G(0);b.Oc=!0;d.a(_.M);return _.x(g,eA(a,d),0)})};
137
- Yz=function(a,b,c,d,e,f){c=a.f.periods[c].startTime-f.ta;if(!b.td&&c===b.xg)return Promise.resolve();b.xg=c;var g=Fz(b);a.h.debug(g,"setting timestamp offset to "+c);a.h.debug(g,"setting append window start to "+d);a.h.debug(g,"setting append window end to "+e);d=Dx(a.C.W,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.td)return d;a.h.debug(g,"fetching init segment");e=$z(a,b,b.stream.initSegmentReference,!0).then(function(h){if(a.g)return null;a.h.debug(g,"appending init segment");return fA(a,
138
- h,b).then(function(){return zx(a.C.W,b.type,h,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(h){b.td=!0;return Promise.reject(h)});return Promise.all([d,e])};fA=function(a,b,c){var d;return _.B(function(e){if(!a.j.patchEdgeWhenMixedContent||!_.bj())return e.G(0);d=lz(b);return _.x(e,zx(a.C.W,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
139
- Zz=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l,m,n,p,q,r,v,z,A;return _.B(function(D){switch(D.a){case 1:l=Fz(b);if(!(e&&e.keyId&&a.C.ld)){D.G(2);break}m=Jv(a.C.ld,e.keyId);if(!m){a.h.warn("Unable to find DRM session for "+e.keyId);D.G(2);break}_.Bf(D,4);return _.x(D,m,6);case 6:_.Cf(D,2);break;case 4:n=_.Df(D),a.h.warn("DRM session load failed!",n);case 2:if(!(e.encrypted&&e.keyId&&a.C.ld&&Lv(a.C.ld,e.keyId))){D.G(7);break}yz(b);p=Lz(a,e);q=gA(a,p);if(!q){D.G(8);break}return _.x(D,q,8);case 8:return r=
140
- a.C.ue(e,d,wv),v=f.startTime+d.startTime,z=f.endTime+d.startTime,a.h.warn(l,"Blocked append for "+v+" - "+z+": "+r+". Stream with Key ID "+(e.keyId+" has restrictions.")),D["return"](Promise.resolve());case 7:return A=e.closedCaptions&&0<e.closedCaptions.size,null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.Ok).Y("emsg",a.Ok.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),D["return"](hA(a,b,c).then(function(){if(a.g)return null;var F=f.startTime+d.startTime,E=f.endTime+d.startTime;a.h.debug(l,
141
- "Appending segment with "+(F.toFixed(3)+" - "+E.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.Jh(e.bandwidth)+" Fragment: ")+h);return zx(a.C.W,b.type,g,F,E,A,e.id,h)}).then(function(){a.g||(a.h.debug(l,"appended media segment"),b.Rb=e,b.sa=f)}))}})};
142
- aA=function(a,b,c,d,e){if(!a.f.presentationTimeline.isLive()&&b.type!==_.Ce){var f=Fz(b),g=(a.C.W.Da(b.type)||0)-c,h=d.endTime-d.startTime;c=g-h;if(Math.abs(c)>=Math.min(.01,h)&&Math.abs(c)<=Math.min(1,h))for(a.h.debug(f,"Adjusted segment",d.position,"with real duration",g,"and accounted for",c,"delta between segment duration and real duration"),b.Od=!0,a=a.f.periods,e.adjustSegmentDurations(d.position,c),d=Cw(a,e),b=a[d],e=e.getDuration(),Ew(b,e),e=d+1;e<a.length;e++)a[e].startTime+=c}};
143
- iA=function(a,b,c){(new _.Ok).L(_.Fd,_.Pk).L(_.Ge,_.Pk).L(_.Ad,_.Pk).L(_.Ed,_.Pk).L(_.ue,_.Pk).Y(_.we,_.Qk).L("encv",function(d){d.reader.skip(78);_.Pk(d)}).L(_.oe,_.Pk).L("schi",_.Pk).L("tenc",function(d){d.reader.skip(6);if(_.Ik(d.reader)){d.reader.skip(1);var e=_.Rh(_.Nk(d.reader,16));e!==b.stream.keyId&&(a.h.debug(Fz(b),"Key id from tenc mismatches with key id from manifest. Switching from "+(b.stream.keyId+" to "+e+".")),b.stream.keyId=e)}d.parser.stop()}).parse(c)};
144
- hA=function(a,b,c){if(a.g)return Promise.resolve();var d=Fz(b);a.h.debug(d,"checking buffer length");var e=Math.max(a.j.bufferBehind,a.f.presentationTimeline.a),f=a.C.W.ub(b.type);if(null==f)return a.h.debug(d,"buffer behind okay because nothing buffered:",zv+c,ov+e),Promise.resolve();var g=c-f,h=g-e;if(.01>=h)return a.h.debug(d,"buffer behind okay:",zv+c,pv+g,ov+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.h.debug(d,"buffer behind too large:",zv+c,pv+g,ov+e,"overflow\x3d"+h);return a.C.W.remove(b.type,
145
- f,f+h).then(function(){a.g||a.h.debug(d,"evicted "+h+" seconds")})};bA=function(a,b,c){if(!a.B){b=Fz(b);var d=Array.from(a.a.values());1!=d.length||d[0].type!=_.Ce?a.B=d.every(function(e){return e.type==_.Ce||a.D?!0:!e.Ib&&!e.$b&&e.sa}):a.D&&(a.B=!0);a.B&&(a.h.debug(b,"startup complete"),c=Lz(a,c),gA(a,c))}};
146
- gA=function(a,b){var c=null;a.m[b]||(c=Rz(a,b).then(function(){a.g||(a.h.debug(qv),a.C.af())})["catch"](Ov));for(var d=0;d<a.f.periods.length;++d)Rz(a,d)["catch"](Ov);a.C.Kk&&(a.h.debug("calling onStartupComplete()..."),a.C.Kk());return c};
147
- jA=function(a,b){var c=Fz(b),d=Lz(a,b.stream);if(b.Cb!=d){var e=b.Cb,f=Array.from(a.a.values());f.every(function(g){return g.Cb==e})?f.every(Gz)?(a.h.debug(c,"all need Period "+e),Rz(a,e).then(function(){if(!a.g)if(f.every(function(n){var p=Gz(n),q=Lz(a,n.stream);return p&&n.Cb==e&&q!=e})){var g=a.f.periods[e];a.h.debug(c,"calling onChooseStreams()...");var h=a.C.bf(g);a.D=!h.variant&&!!h.text;var l=new Map;h.variant&&h.variant.video&&l.set(_.Re,h.variant.video);h.variant&&h.variant.audio&&l.set(_.mc,
148
- h.variant.audio);h.text&&l.set(_.Ce,h.text);var m=_.u(a.a.keys());for(h=m.next();!h.done;h=m.next())if(h=h.value,!l.has(h)&&h!=_.Ce){a.h.error(c,"invalid Streams chosen: missing "+h+" Stream");a.C.onError(new _.L(_.M,5,5005));return}m=_.u(Array.from(l.keys()));for(h=m.next();!h.done;h=m.next())if(h=h.value,!a.a.has(h))if(h==_.Ce)Qz(a,null,null,l.get(_.Ce),g.startTime),l["delete"](h);else{a.h.error(c,"invalid Streams chosen: unusable "+h+" Stream");a.C.onError(new _.L(_.M,5,5005));return}g=_.u(Array.from(a.a.keys()));
149
- for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.Bz(a,m,!1,0),wz(a,a.a.get(h),0)):a.a["delete"](h);a.h.debug(c,qv);a.C.af()}else a.h.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](Ov)):a.h.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle"):a.h.debug(c,"not all MediaStates need Period "+e)}};uz=function(a,b){var c=Aw(a.f.periods,b+_.qq);return c?a.f.periods.indexOf(c):0};Lz=function(a,b){return Cw(a.f.periods,b)};
150
- $z=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.Iw(c.Oa(),c.ua,c.ea,a.j.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Hc?null:e;f.disableFragmentSupport=c.Hc||a.j.disableFragmentSupport;f.disableMergedFragments=a.j.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){iA(a,b,g.data)}),b.type===_.Re&&a.j.overridePasp&&f.responseModifiers.push(a.xl.bind(a)));a.h.debug("fetching: reference\x3d",
151
- c);c=a.C.Db.fetch(f);b.Fb=c;return c.P.then(function(g){var h=a.C.He(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&h.segmentDownloaded(l,m);b.Fb=null;return g.data})};
152
- Iz=function(a,b,c,d){var e,f,g,h;return _.B(function(l){if(1==l.a)return e=Fz(b),b.Ib=!1,b.ge=!1,b.Ld=0,b.$b=!0,b.stream.segmentIterator=null,a.h.debug(e,"clearing buffer"),d?(g=a.C.zb(),h=a.C.W.getDuration(),f=a.C.W.remove(b.type,g+d,h)):f=a.C.W.clear(b.type).then(function(){return!a.g&&c?a.C.W.flush(b.type):null}),_.x(l,f,2);if(a.g)return l["return"]();a.h.debug(e,"cleared buffer");b.Rb=null;b.sa=null;b.$b=!1;b.endOfStream=!1;b.Od=!1;wz(a,b,0);_.y(l)})};
153
- wz=function(a,b,c){a.h.debug(Fz(b),"updating in "+c+" seconds");b.tb=(new _.Yi(function(){var d;return _.B(function(e){if(1==e.a)return _.Bf(e,2),_.x(e,a.Eb(b),4);if(2!=e.a)return _.Cf(e,0);d=_.Df(e);if(a.C)a.C.onError(d);_.y(e)})})).aa(c)};yz=function(a){null!=a.tb&&(a.tb.stop(),a.tb=null)};zz=function(a){return _.B(function(b){return a.Fb?_.x(b,a.Fb.abort(),0):b.G(0)})};
154
- eA=function(a,b){var c;return _.B(function(d){switch(d.a){case 1:if(a.g)return d["return"]();if(!a.C.ih){d.G(2);break}_.Bf(d,3);return _.x(d,a.C.ih(b),5);case 5:_.Cf(d,2);break;case 3:c=_.Df(d),c.cause=b,b=c;case 2:if(!b.f)a.C.onError(b);_.y(d)}})};Fz=function(a){return"("+a.type+":"+a.stream.id+")"};Gz=function(a){return!a.ab&&null==a.tb&&!a.Ib&&!a.$b};
155
- mA=function(a){_.kk.call(this,sv);var b=this;this.F=kA;this.j=this.Sb=this.da=null;this.We=0;this.Cg=2;this.hd=null;this.Ue=!1;this.o=new _.eg;this.Xa=this.Sd=this.Bc=this.sc=this.A=this.J=this.m=null;this.bd=!1;this.g=this.f=this.B=this.a=this.yc=this.H=null;this.fh=1E9;this.Xd=new Set;this.V=!0;this.ma=null;this.Yg=!1;this.Qg=0;this.ga=null;this.N=new wy;this.Zg={width:Infinity,height:Infinity};this.I=null;this.ha=_.Om;this.zc=new Dy(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
156
- this.configuration.preferredAudioChannelCount);this.Ia=this.configuration.preferredTextLanguage;this.T=this.Ac=null;this.Cc=new Map;this.na=null;this.xc=this.configuration.preferredTextRole;a&&a(this);this.Ve=null;this.o.on(window,"online",function(){b.F===lA&&Hz(b.a)})};
157
- nA=function(a){return new _.vw(function(b){if(void 0===b||null===b)return null;var c=a.getTrackManager(),d=[];if(c){c=_.u(c.getVideoTracks());for(var e=c.next();!e.done;e=c.next())d.push.apply(d,_.of(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
158
- oA=function(a,b){if(a.ha!==b)if(a.ha===_.Zm&&b!==_.Om)a.log.info(_.jv+Wv(b,_.Xm));else{var c=a.We;c=0===c?0:Date.now()-c;var d=a.ha;a.ha=b;a.We=Date.now();a.I&&_.zm(a.I.a,a.ha);b===_.Tm&&(a.Cg=a.Te?1:2);var e=a.Cg,f={currentState:a.ha,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.Tm||d===_.Tm?e:void 0};a.log.info(_.eb+Wv(d,_.Xm)+" -\x3e "+(Wv(b,_.Xm)+(b!==_.Tm?"":"["+Wv(e,_.Wm)+"]")));a.trigger(new _.J(_.re,{detail:f}));(b===_.Vm||b===_.Zm)&&a.Xa&&a.Xa.stop();b===_.Tm?a.trigger(new _.J(_.wc,
159
- {detail:{bufferedTimeMS:-1,reason:e}})):d===_.Tm&&a.trigger(new _.J(_.vc,{detail:{bufferedTimeMS:c,reason:e}}))}};uA=function(a){var b=!1;b=void 0===b?!0:b;var c,d;return _.B(function(e){switch(e.a){case 1:return a.F===pA?e["return"](Promise.reject(new _.L(_.M,7,7E3))):_.x(e,qA(a),2);case 2:return _.x(e,rA(a),3);case 3:c=_.mi(4)||_.mi(5);if(!b&&!c){e.G(0);break}d=a.getSurface().getMedia();return _.x(e,sA(a,d),5);case 5:return _.x(e,tA(a,d),0)}})};
160
- sA=function(a,b){a.j||(a.o.on(b,_.jd,function(){if(a.j.error){var c=a.j.error.code;if(1==c)c=null;else{var d=a.j.error.msExtendedCode;d&&(0>d&&(d+=Math.pow(2,32)),d=d.toString(16));c=new _.L(_.M,3,3016,{code:c,extendedError:d,message:a.j.error.message})}}else c=null;if(c)a.onError(c)}),a.j=b);return Promise.resolve()};rA=function(a){a.j&&(a.o.off(a.j,_.jd),a.j=null);return Promise.resolve()};
161
- qA=function(a){var b;return _.B(function(c){switch(c.a){case 1:a.F!==pA&&(a.F=kA);if(b=a.j)a.o.off(b,_.wd),a.o.off(b,_.$d),a.o.off(b,_.Vd),a.o.off(b,_.id),a.o.off(b,_.ee),a.o.off(b,_.ce);a.sc&&(a.sc.release(),a.sc=null);a.Xa&&(a.Xa.stop(),a.Xa=null);if(!a.B){c.G(2);break}return _.x(c,a.B.stop(),3);case 3:a.B=null;case 2:if(!a.g){c.G(4);break}return _.x(c,a.g.stop(),4);case 4:if(!a.a){c.G(6);break}return _.x(c,a.a.destroy(),7);case 7:a.a=null;case 6:a.A&&(a.A.release(),a.A=null);if(!a.J){c.G(8);break}return _.x(c,
162
- a.J.destroy(),9);case 9:a.J=null;case 8:a.Sd&&(a.Sd.release(),a.Sd=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.m){c.G(10);break}return _.x(c,a.m.destroy(),11);case 11:a.m=null;case 10:a.N.clear(),a.H=null,a.Xd.clear(),a.f=null,a.I=null,a.V=!0,a.Cc.clear(),a.bd=!1,vA(a),_.y(c)}})};
163
- tA=function(a,b){var c,d,e;return _.B(function(f){if(1==f.a)return c=window.muxjs?new lx:new _.mx,d=_.xm(a.configuration,["html","single-native"]),a.K=d.create(a),a.hd=nA(a),a.hd.track(a),e=new _.ox(b,c,a.K,a.hd,a.configuration),_.x(f,e.I,2);a.J=e;_.y(f)})};wA=function(a,b){var c,d;return _.B(function(e){if(1==e.a)return c=a.getNetworkEngine(),d=a,_.x(e,_.vp(b.url,c,a.configuration.manifest.attemptParameters,b.type||null),2);d.B=e.f;a.B.configure(a.configuration.manifest);_.y(e)})};
164
- AA=function(a,b){var c;return _.B(function(d){a.yc=new Tw;Uw(a.yc,function(e){xA(a,_.pg,e)});c=new _.gi(Promise.resolve().then(function(){var e,f,g;return _.B(function(h){switch(h.a){case 1:if(a.f){h.G(3);break}_.Bf(h,4);e=a;return _.x(h,a.B.start(b.url,yA(a)),6);case 6:e.f=h.f;_.Cf(h,1);break;case 4:f=_.Df(h);if(!a.wc)throw f;return _.x(h,a.wc(b.url,f),8);case 8:if(g=h.f)b.url=g;else throw f;h.G(1);break;case 3:!a.f.presentationTimeline||a.configuration.manifest.hlsLowLatency||_.K.R(a.configuration.suggestedPresentationDelay)||
165
- isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.F=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.H=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.L(_.M,4,4014);zA(a.f.periods);_.y(h)}})}),function(){a.log.info("Aborting parser step...");return a.B.stop()});return _.x(d,c.P,0)})};
166
- HA=function(a){var b,c,d,e,f;return _.B(function(g){switch(g.a){case 1:a.m=new _.Kl({Db:a.getNetworkEngine(),onError:function(h){return a.onError(h)},df:function(h){if(a.a){var l=BA(a),m=!1,n=Object.keys(h);0===n.length&&a.log.warn("Got a key status event without any key statuses, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");var p=1===n.length&&"00"===n[0];p&&a.log.warn("Got a synthetic key status event, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");
167
- if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var r=n[q],v=_.u(r.variants),z=v.next();!z.done;z=v.next()){z=z.value;var A=[];z.audio&&A.push(z.audio);z.video&&A.push(z.video);A=_.u(A);for(var D=A.next();!D.done;D=A.next()){D=D.value;var F=z.allowedByKeySystem;if(D.keyId){var E=h[p?"00":D.keyId];E=!!E&&!CA.includes(E);z.allowedByKeySystem=E}F!==z.allowedByKeySystem&&(E=D.type,D.type===_.Re&&(E="video "+D.width+"x"+D.height+"@"+_.Jh(D.bandwidth)),a.log.warn("DRM Key not available for KID: '"+
168
- (D.keyId+"'. Applying restrictions to "+E)));r===l&&F!==z.allowedByKeySystem&&(m=!0)}}}if(h=pz(a.a))if(p=rz(a.a),n=sz(a.a),p=Yx(p,n,h.variants),!p||p.allowedByKeySystem)a.log.info(ev),DA(a),EA(a,h.variants);m&&h!==l&&(a.log.info(ev),DA(a),EA(a,l.variants))}},onExpirationUpdated:function(h,l){if(a.B&&a.B.onExpirationUpdated)a.B.onExpirationUpdated(h,l);a.trigger(new _.J(_.$c,{expirationTime:l}))},onEvent:function(h){return a.Ae(h)},getConfiguration:function(){return a.getConfiguration()},Mc:function(){return a.Mc()}});
169
- FA(a);c=(b=a.configuration.drm)?b.offlineId||"":"";d=[];e=_.op(a.f.periods);if(!c){g.G(2);break}f=_.mk(_.Wd);if(!f){g.G(2);break}return _.x(g,f.Xk(b,e,a.getNetworkEngine()),4);case 4:return _.x(g,f.oj(c),5);case 5:d=g.f;case 2:return _.x(g,_.Pl(a.m,e,d),6);case 6:a.f&&GA(a,a.f.periods),_.y(g)}})};
170
- SA=function(a){var b,c,d,e,f,g,h,l,m,n,p;return _.B(function(q){if(1==q.a)return b=a.j,c=function(r){a.j&&a.H&&(r.type===_.me&&a.Yd?(a.H.a=Iy,vA(a)):r.type===_.Ze&&a.getState()===_.bn&&.1>a.getBufferInfo().Ja(a.getPosition())?(a.H.a=Iy,vA(a)):a.H&&IA(a));JA(a)},d=function(){if(a.j){var r=a.j.playbackRate;0!=r&&a.Bc.set(r)}},a.o.on(b,_.$d,c),a.o.on(b,_.Vd,c),a.o.on(b,_.id,c),a.o.on(b,_.me,c),a.o.on(b,_.le,c),a.o.on(b,_.ce,c),a.o.on(b,_.Ze,c),a.o.on(b,_.ee,d),a.g||(a.g=new _.uy,a.g.configure(a.configuration.abr)),
171
- KA(a,a.f.periods),a.zc=new Dy(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount),a.Ia=a.configuration.preferredTextLanguage,a.xc=a.configuration.preferredTextRole,_.x(q,_.bm(a.m,b),2);if(3!=q.a){if(!a.m)throw new _.L(_.M,7,7001);a.g.init(function(r,v,z){!a.V&&LA(a,r,v,z)});a.A=MA(a,a.configuration.startTime);a.sc=NA(a);a.Bc=new Oy({Ke:function(){return b.playbackRate},gh:function(r){b.playbackRate=r},Vj:function(r){b.currentTime+=
172
- r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.Sd=new Ly(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);OA(a,e);Nx(a.f,_.tg(a.configuration.preferredVideoCodec),_.tg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=PA(a);a.a.j=a.configuration.streaming;a.F=lA;return _.x(q,a.a.start(),3)}if(!a.a)throw new _.L(_.M,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(f=iz(a.A),g=QA(a,f),bz(a.A.f,g));h=_.u(a.f.periods);for(l=
173
- h.next();!l.done;l=h.next())m=l.value,RA(a,m);DA(a);n=BA(a)||a.f.periods[0];p=n.variants.some(function(r){return r.primary});a.configuration.preferredAudioLanguage||p||a.log.warn("No preferred audio language set. We will choose an arbitrary language initially");EA(a,n.variants);a.o.one(b,_.wd,function(){a.I.A=Date.now()/1E3-(null===a.Ve?0:a.Ve)});_.y(q)})};
174
- zA=function(a){function b(d){return d.video&&d.audio||d.video&&d.video.codecs.includes(",")}if(a.some(function(d){return d.variants.some(b)})){_.Uf("Found variant with audio and video content, so filtering out audio-only content in all periods.");a=_.u(a);for(var c=a.next();!c.done;c=a.next())c=c.value,c.variants=c.variants.filter(b)}};MA=function(a,b){return new gz(a.j,a.f,a.configuration.streaming,b,function(){a.sc&&ax(a.sc,!0);a.a&&Ez(a.a)},function(c){return a.dispatchEvent(c)})};
175
- NA=function(a){var b=new My(a.f);Ny(b,function(){DA(a)});var c=new cx(a.yc);dx(c,function(e){e.be&&e.be();xA(a,_.rg,e)},function(e){e.cf&&e.cf();xA(a,_.sg,e)},function(e,f){f||(e.be&&e.be(),xA(a,_.rg,e),e.cf&&e.cf(),xA(a,_.sg,e))});var d=new bx(a.j);d.a.add(b);d.a.add(c);return d};OA=function(a,b){a.H=new Jy(b,Math.min(.5,b/2));a.H.a=Iy;vA(a);a.Xa=(new _.$i(function(){IA(a)})).fb(.25)};
176
- IA=function(a){switch(a.F){case lA:a:if(a.j.ended||ux(a.J))var b=!0;else{if(a.isLive()){b=Pw(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.Da(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.J){var d=wx(a.J);c=d.video;d=d.audio;var e=a.j.currentTime;c&&d?(c=c.Ja(e),d=d.Ja(e),c=Math.min(c,d)):c=c?c.Ja(e):d?d.Ja(e):0}else c=0;if(d=a.H){d=a.H;var f=b,g=d.f.get(d.a);e=d.a;c=f||c>=g?Hy:Iy;d.a=c;d=e!=c}c=d;d=TA(a);c||a.getState()===_.Tm&&!d?(a.log.debug("Buffering state changed. Is buffering",
177
- d,"buffered to end",b,"state",a.getState()),vA(a)):a.bd&&JA(a)};PA=function(a){var b={zb:function(){return iz(a.A)},W:a.J,Db:a.getNetworkEngine(),bf:a.ri.bind(a),af:a.pi.bind(a),onError:a.onError.bind(a),Gg:a.sk.bind(a),onEvent:a.Ae.bind(a),Lg:a.si.bind(a),ce:a.Fk.bind(a),He:function(){return a.g},ue:a.Ah.bind(a),ih:a.rl.bind(a),ld:a.m};return new _.oz(a.f,b)};FA=function(a){var b=_.xk(a.configuration.drm);a.m.g=b};
178
- VA=function(a){a.B&&a.B.configure(a.configuration.manifest);a.m&&FA(a);if(a.a){a.a.j=a.configuration.streaming;try{for(var b=_.u(a.f.periods),c=b.next();!c.done;c=b.next())RA(a,c.value)}catch(e){a.onError(e)}c=rz(a.a);var d=sz(a.a);b=BA(a)||a.f.periods[0];c=Yx(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?EA(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),UA(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.V?a.g.enable():
179
- a.g.disable())};my=function(a){if(a.f&&a.A){var b=WA(a),c=[];a=_.u(XA(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=Tx(d);e.active=d==b;c.push(e)}return c}return[]};ky=function(a,b){if(a.f&&a.a){var c=BA(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(YA(a,c,d,!1),ZA(a,d),a.Ia=d.language):a.log.error(_.iv,b.id)}};
180
- ny=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=BA(a);if(a.configuration.abr.enabled&&b)a.log.info("Disable ABR and enable manual track selection to select "+(b.width+"x"+b.height+"@"+b.bandwidth)),a.configuration.abr.enabled=!1,a.g.disable();else if(!a.configuration.abr.enabled&&!b){a.log.info("Enable ABR Selection");a.configuration.abr.enabled=!0;a.g.enable();a.T=null;c=EA(a,e.variants);null!=a.na&&(a.zc=a.na,a.na=null);null==c||a.V||LA(a,c);return}if(b){a.T=b.id;var f=e.variants.find(function(g){return g.id==
181
- b.id});f?(a.T=f.video.id,Vx(f)?($A(a,e,f,!1),aB(a,f,c,d),null==a.na&&(a.na=a.zc),a.zc=new Ey(f),EA(a,e.variants)):a.log.error("Unable to switch to restricted track",b.id)):a.log.error("No variant with id",b.id)}else a.T=null,null!=a.na&&(a.zc=a.na,a.na=null),c=EA(a,e.variants),null==c||a.V||LA(a,c)}};
182
- ly=function(a,b){if(a.configuration.streaming.disableAudioTracks)Promise.reject(Error("Audio tracks are disabled by config."));else{if(a.a&&(a.f||a.A)){var c=sz(a.a),d=rz(a.a),e=Aw(a.f.periods,iz(a.A)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id===b&&Vx(m)});e=!1;var g=void 0;if(c){if(g=f.find(function(m){return m.video.id===c.id}),!g){a.log.debug("Cannot find exact variant, looking for anything else that matches with given audioId");e=!0;var h=a.getTrackManager().Pa();
183
- if(h){var l=h.renditions.map(function(m){return m.id});g=f.find(function(m){return l.find(function(n){return n===String(m.video.id)})})}}}else g=f[0];if(g){if(d.codecs.split(".")[0]===g.audio.codecs.split(".")[0]){d=g.audio;a.Ac=d.id;a.g.setVariants(f);f=BA(a);$A(a,f,g,!1);e||a.V?aB(a,g,!0,0):_.Bz(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()}};
184
- oy=function(a){var b=a.Ue;return a.f?a.J.getTextDisplayer().isTextVisible():b};jy=function(a,b){var c,d,e,f;return _.B(function(g){c=a.Ue;d=b;if(c==d)return g["return"]();a.Ue=d;if(a.F!==lA)return g.G(0);a.J.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.G(0);if(!b)return Az(a.a),g.G(0);e=BA(a);f=_.Xx(e.textStreams,a.Ia,a.xc);return 0<f.length?_.x(g,xz(a.a,f[0]),0):g.G(0)})};
185
- $A=function(a,b,c,d){var e=a.getTrackManager();a.B.setCurrentVariant(c);if(e){var f=a.I.B;if(c.video){ry(e,c.video,d);var g=e.fa();f.j!==g&&(f.j=g,f.a.push({timestamp:Date.now()/1E3,id:g.id,trackId:g.track.id,type:g.track.type,fromAdaptation:d,width:g.width,height:g.height,bandwidth:g.bandwidth}))}c.audio&&(ry(e,c.audio,d),e=e.La(),f.f!==e&&(f.f=e,f.a.push({timestamp:Date.now()/1E3,id:e.id,trackId:e.track.id,type:e.track.type,fromAdaptation:d,width:null,height:null,bandwidth:e.bandwidth})))}yy(a.N,
186
- b).variant=c};YA=function(a,b,c,d){yy(a.N,b).text=c;if(b=a.getTrackManager())ry(b,c,d),c=b.Na(),a=a.I.B,a.g!==c&&(a.g=c,a.a.push({timestamp:Date.now()/1E3,id:c.id,trackId:c.track.id,type:c.track.type,fromAdaptation:d,width:null,height:null,bandwidth:null}))};
187
- KA=function(a,b){for(var c=0;c<b.length;c++){for(var d=b[c],e=new Map,f=_.u(d.variants),g=f.next();!g.done;g=f.next())if(g=g.value,g.video&&g.video.closedCaptions){g=g.video;for(var h=_.u(g.closedCaptions.keys()),l=h.next();!l.done;l=h.next())if(l=l.value,!e.has(l)){var m={id:a.fh++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,ta:0,mimeType:_.ec,codecs:"",kind:"caption",
188
- encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.Ce,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,closedCaptions:null};e.set(l,m)}}e=_.u(e.values());for(f=e.next();!f.done;f=e.next())d.textStreams.push(f.value)}};
189
- GA=function(a,b){for(var c=a.a?rz(a.a):null,d=a.a?sz(a.a):null,e=_.u(b),f=e.next();!f.done;f=e.next())Sx(a.m,c,d,f.value);c=Zv(b,function(h){return h.variants.some(Vx)});if(a.configuration.streaming.disableAudioTracks)for(d=_.u(b),e=d.next();!e.done;e=d.next())for(f=_.u(e.value.variants),e=f.next();!e.done;e=f.next())delete e.value.audio;if(a.configuration.streaming.disableVideoTracks)for(d=_.u(b),e=d.next();!e.done;e=d.next())for(f=_.u(e.value.variants),e=f.next();!e.done;e=f.next()){e=e.value;var g=
190
- e.video;!g||1<ew(g.type,_.Xi(g.mimeType,g.codecs)).size||delete e.video}if(0===c)throw new _.L(_.M,4,4032);if(c<b.length)throw new _.L(_.M,4,4011);c=_.u(b);for(e=c.next();!e.done;e=c.next())d=e.value,Px(d.variants,a.configuration.restrictions,a.Zg)&&a.a&&BA(a)==d&&DA(a),bB(a,d.variants)};
191
- RA=function(a,b){var c=a.a?rz(a.a):null,d=a.a?sz(a.a):null;Sx(a.m,c,d,b);d=b.variants;if(!d.some(Vx))throw new _.L(_.M,4,4011);bB(a,b.variants);Px(d,a.configuration.restrictions,a.Zg)&&a.a&&BA(a)==b&&DA(a);if(!_.mi(2)&&(c=a.m?a.m.getDrmInfo():null)){d=_.u(d);for(var e=d.next();!e.done;e=d.next()){e=_.u(e.value.drmInfos);for(var f=e.next();!f.done;f=e.next())if(f=f.value,f.keySystem===c.keySystem){f=_.u(f.initData||[]);for(var g=f.next();!g.done;g=f.next())g=g.value,_.em(a.m,g.keyId,g.initData)||_.Wl(a.m,
192
- g.initDataType,g.initData,g.keyId)}}}};aB=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.V?(a.ma=b,a.Yg=c,a.Qg=d):Cz(a.a,b,c,d)};ZA=function(a,b){a.V?a.ga=b:_.Bz(a.a,b,!0,0)};cB=function(a){if(a.a&&a.f){var b=pz(a.a),c=BA(a);null!=b&&b==c&&(rz(a.a),sz(a.a),_.qz(a.a,_.Ce),yy(a.N,c),yy(a.N,c))}};
193
- QA=function(a,b){function c(g,h){if(!g)return null;var l=g.findSegmentPosition(h-f.startTime);return null==l?null:(l=g.getSegmentReference(l))?l.startTime+f.startTime:null}var d=rz(a.a),e=sz(a.a),f=BA(a);d=c(d,b);e=c(e,b);return null!=e&&null!=d?Math.max(e,d):null!=e?e:null!=d?d:b};TA=function(a){return a.m&&a.m.D?!0:a.H?a.H.getState()===Iy:!1};vA=function(a){if(a.I&&a.H&&a.A){var b=dB(a)===_.Tm,c=a.Bc;c.j=b;Py(c);a.A.j.o=b;JA(a)}};JA=function(a){oA(a,dB(a))};
194
- dB=function(a){var b=a.getDuration(),c=a.getPosition();return a.j&&a.j.ended||(a.bd||a.ha===_.Vm)&&1>=Math.abs(b-c)?_.Vm:TA(a)||a.Yd?_.Tm:a.j&&a.j.paused?_.an:_.bn};
195
- EA=function(a,b){try{bB(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return Vx(e)});c=by(c,a.Ac);var d=a.zc.create(c);d=Array.from(d.values());a.g.setVariants(d);if(null!==a.T&&null!==a.Ac&&(d=d.find(function(e){return e.video.id==a.T&&e.audio.id==a.Ac}),a.T=null,d))return d;if(a.configuration.abr.enabled||null===a.T)return a.g.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.T});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
196
- a.g.chooseVariant())};UA=function(a,b,c){c=void 0===c?!0:c;var d=EA(a,b.variants);a.Ac=d&&d.audio&&d.audio.id;d&&($A(a,b,d,!0),aB(a,d,c));(c=_.Xx(b.textStreams,a.Ia,a.xc)[0]||null)&&(a.configuration.streaming.alwaysStreamText||oy(a))&&(YA(a,b,c,!0),ZA(a,c))};
197
- gB=function(a,b){a.V=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");var c=EA(a,b.variants),d=_.Xx(b.textStreams,a.Ia,a.xc)[0]||null;a.ma&&(b.variants.includes(a.ma)&&(c=a.ma),a.ma=null);a.ga&&(b.textStreams.includes(a.ga)&&(d=a.ga),a.ga=null);c&&eB(a,b,function(){return $A(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||oy(a))&&eB(a,b,function(){return YA(a,b,d,!0)});b===BA(a)&&fB(a);return a.configuration.streaming.alwaysStreamText||oy(a)?{variant:c,text:d}:
198
- {variant:c,text:null}};LA=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;if(a.configuration.abr.enabled){a.log.debug("switch_");var e=hB(a,b);eB(a,e,function(){return $A(a,e,b,!0)});e===BA(a)&&fB(a);a.a&&Cz(a.a,b,c,d)}};DA=function(a){var b=a.getTrackManager();b&&a.F!==pA&&(b.l&&(qy(b),b.l.trigger(new _.J(_.vq))),fB(a))};fB=function(a){var b=BA(a);if(b){var c=a.Cc.get(b)||[];for(a.Cc["delete"](b);c.length;)c.shift()()}};eB=function(a,b,c){a.Cc.has(b)||a.Cc.set(b,[]);a.Cc.get(b).push(c)};
199
- xA=function(a,b,c){a.trigger(new _.J(b,{detail:{schemeIdUri:c.schemeIdUri,value:c.value,startTime:c.startTime,endTime:c.endTime,id:c.id,eventElement:c.eventElement,type:c.type}}))};
200
- bB=function(a,b){var c=a.m?_.K.Gf(a.m.ma):{},d=Object.keys(c);d=d.length&&"00"==d[0];for(var e=!1,f=!1,g=[],h=[],l=_.u(b),m=l.next();!m.done;m=l.next()){m=m.value;var n=[];m.audio&&n.push(m.audio);m.video&&n.push(m.video);n=_.u(n);for(var p=n.next();!p.done;p=n.next())if(p=p.value,p.keyId){var q=c[d?"00":p.keyId];q?CA.includes(q)&&(h.includes(q)||h.push(q)):g.includes(p.keyId)||g.push(p.keyId)}m.allowedByApplication?m.allowedByKeySystem&&(e=!0):f=!0}if(!e)throw new _.L(_.M,4,4012,{hasAppRestrictions:f,
201
- missingKeys:g,restrictedKeyStatuses:h});};XA=function(a){var b=BA(a);if(null==b)return[];cB(a);return b.variants.filter(function(c){return Vx(c)})};iB=function(a){var b=BA(a);if(null==b)return[];cB(a);return b.textStreams.filter(function(c){return!a.Xd.has(c)})};BA=function(a){var b=iz(a.A),c=null;a=_.u(a.f.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c};WA=function(a){var b=BA(a);return b&&yy(a.N,b).variant};
202
- hB=function(a,b){for(var c=_.u(a.f.periods),d=c.next();!d.done;d=c.next())if(d=d.value,d.variants.includes(b))return d;return null};
203
- jB=function(a,b,c){var d,e,f,g,h,l,m,n,p,q,r,v,z,A,D,F,E,H,Q;return _.B(function(O){switch(O.a){case 1:return d=_.nn,_.Bf(O,2),_.x(O,_.vp(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null),4);case 4:return e=O.f,e.configure(a.configuration.manifest),_.x(O,e.start(b.url,yA(a)),5);case 5:f=O.f;zA(f.periods);if(!f.periods.length)throw new _.L(_.M,4,4014);return _.x(O,a.B.stop(),6);case 6:a.B=e;g=c.audio&&c.audio.id;h=c.video&&c.video.id;a.f.periods=f.periods;l=Aw(f.periods,
204
- iz(a.A))||f.periods[0];Nx(a.f,_.tg(a.configuration.preferredVideoCodec),_.tg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=cy(g,h,l.variants);n=_.Xx(l.textStreams,a.Ia,a.xc)[0]||null;EA(a,l.variants);p=m&&m.video;q=m&&m.audio;r=[];v=new Set;z=_.u(l.variants);for(A=z.next();!A.done;A=z.next())D=A.value,D.video&&v.add(D.video),D.audio&&v.add(D.audio);F=_.u(_.of(v).concat(_.of(l.textStreams)));for(E=F.next();!E.done;E=F.next())H=E.value,r.push(H.createSegmentIndex());
205
- return _.x(O,Promise.all(r),7);case 7:Kz(a.a,d.AUDIO,q);Kz(a.a,d.VIDEO,p);Kz(a.a,d.TEXT,n);m&&$A(a,l,m,!1);a.log.info("Switch CDN successful.");_.Cf(O,0);break;case 2:Q=_.Df(O);if(!e){O.G(8);break}return _.x(O,e.stop(),8);case 8:throw Q;}})};
206
- yA=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return RA(a,b)},filterAllPeriods:function(b){return GA(a,b)},onTimelineCueAdded:function(b){var c=a.yc;a:{var d=_.u(c.a);for(var e=d.next();!e.done;e=d.next())if(e=e.value,e.schemeIdUri===b.schemeIdUri&&e.startTime===b.startTime&&e.endTime===b.endTime){d=e;break a}d=null}null==d&&(c.a.add(b),c.f(b))},onEvent:function(b){return a.Ae(b)},onError:function(b){return a.onError(b)}}};kB=function(){};
207
- lB=function(){var a=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];c=a.apply(this,c);c.abort=function(){};return c}};mB=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};nB=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
208
- oB=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.gw(b)[0]&&a(b)}};
209
- pB=function(){var a=MediaSource.isTypeSupported,b=/^dv(?:h[e1]|a[v1])\./;MediaSource.isTypeSupported=function(c){var d=c.split(/ *; */),e=d.shift(),f={};d=_.u(d);for(var g=d.next();!g.done;g=d.next())g=g.value.split("\x3d"),f[g[0]]=g[1].replace(/"(.*)"/,"$1");d=f.codecs;if(!d)return a(c);var h=!1,l=!1;c=d.split(",").filter(function(n){b.test(n)&&(l=!0);/^(hev|hvc)1\.2/.test(n)&&(h=!0);return!0});l&&(h=!1);f.codecs=c.join(",");h&&(f.eotf="smpte2084");for(var m in f)e+="; "+m+'\x3d"'+f[m]+'"';return cast.__platform__.canDisplayType(e)}};
210
- qB=function(a){_.cq.call(this,a);a=a.getSurface().getMedia();this.a=null;for(var b=0;b<a.textTracks.length;++b){var c=a.textTracks[b];c.mode=_.Yc;c.label===kv&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.Dv,kv));this.a.mode=_.nd};rB=function(a,b){var c=a.mode;a.mode=c==_.ne?_.ne:_.nd;for(var d=a.cues,e=d.length-1;0<=e;e--){var f=d[e];f&&b(f)&&a.removeCue(f)}a.mode=c};sB=function(){};Hv=[112,115,115,104,0,0,0,0];_.Rv.prototype.f=function(){return this.keyInfo};_.Sv.prototype.getPosition=function(){return this.position};
211
- _.Sv.prototype.f=function(){return this.keyInfo};_.uB=function tB(a){var c,d,e,f,g,h;return _.Jf(tB,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.u(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.G(0):_.x(l,{Me:c,Zk:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{Me:c,item:e,Zk:d,next:h},5):l.G(5)}c++;d=e;e=h;g=f.next();return l.G(2)})};aw.prototype.destroy=function(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()};
212
- aw.prototype.A=function(a){this.g=a.captions;var b=new Uint8Array(a.data.byteLength+a.initSegment.byteLength);b.set(a.initSegment,0);b.set(a.data,a.initSegment.byteLength);a.type===_.Re?this.o.push(b):a.type===_.mc&&this.m.push(b)};aw.prototype.w=function(){var a={video:_.Th.apply(_.Mh,_.of(this.o)),captions:this.g,audio:_.Th.apply(_.Mh,_.of(this.m))};this.f.resolve(a);this.j=!1};var qw=[154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149];_.w(nw,_.Bl);
213
- _.vw.prototype.track=function(a){null!=this.a&&(this.a&&(this.a.off(_.je,this.f),this.g&&this.a.off(_.Fe,this.f)),this.a=null);a&&(this.a=a,this.a.on(_.je,this.f,this))};
214
- _.vw.prototype.append=function(a,b,c){var d=this.m?this.m(c):null;d||this.log.debug("Unable to resolve rendition for id",c);c={start:a,end:b,rendition:d,width:d?d.width:0,height:d?d.height:0,bandwidth:d?d.bandwidth:0};var e=this.S.find(function(f){return f.start>=a&&f.end<=b});if(e)e.rendition=d,e.width=c.width,e.height=c.height,e.bandwidth=c.bandwidth,e.start=c.start,e.end=c.end;else{d=_.u(this.S);for(e=d.next();!e.done;e=d.next())e=e.value,a>=e.start&&a<e.end?e.end=a:b>=e.start&&b<e.end&&(e.start=
215
- b);this.S.push(c);this.S.sort(uw)}yw(this);this.f();this.a&&this.a.trigger(new _.J(_.Ue))};_.vw.prototype.clear=function(){this.S=[];yw(this);this.a&&(this.a.trigger(new _.J(_.Ue)),this.a.trigger(new _.J(_.rc)))};
216
- _.vw.prototype.f=function(){if(this.a){var a=this.a.getPosition();if(0<=a){a:{for(var b=this.S.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.S[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.S[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.S[0].rendition:null}if(a&&this.j!==a&&(this.j=a,this.a)){c=b=-1;if(a)b=a.width||-1,c=a.height||-1;else if(d=this.a.getSurface().getMedia())b=d.videoWidth,c=d.videoHeight;this.a.trigger(new _.J(_.tc,
217
- {detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};_.t=_.Jw.prototype;_.t.Nc=function(){return this.I};_.t.getDuration=function(){return this.f};_.t.getPresentationStartTime=function(){return this.A};_.t.offset=function(a){null!=this.j&&(this.j+=a);null!=this.g&&(this.g+=a)};_.t.isLive=function(){return Infinity==this.f&&!this.o};Tw.prototype.release=function(){this.f=function(){};this.a.clear()};Tw.prototype.cues=function(){return this.a};
218
- Vw.prototype.next=function(){var a=this.g.get(this.a);a&&0<a.a.length?(this.f+=1,a.Oa().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=Ww(this);return{value:a,done:!a}};_.t=_.Xw.prototype;_.t.destroy=function(){this.a=[];return Promise.resolve()};
219
- _.t.Fc=function(a){for(var b=this.a.length-1;0<=b;--b){var c=this.a[b];if(a>=c.startTime&&a<c.endTime)return c.position}if(this.a.length&&a<this.a[0].startTime)return this.a[0].position;this.h.warn("No Segment found for "+a+". We have "+this.a.length+" references");for(a=0;a<this.a.length;a++)b=this.a[a],this.h.debug("SegmentIndex Ref "+a+" start: "+b.startTime+" end: "+b.endTime+" pos: "+b.position);return null};
220
- _.t.get=function(a){if(0==this.a.length)return null;a-=this.a[0].position;return 0>a||a>=this.a.length?null:this.a[a]};_.t.offset=function(a){this.h.info("Apply offset"+a+" to segment index");for(var b=_.u(this.a),c=b.next();!c.done;c=b.next())c=c.value,c.startTime+=a,c.endTime+=a,c.ta-=a};
221
- _.t.Yc=function(a,b){var c=a-this.a[0].position;if(0<=c&&c<this.a.length)for(this.h.warn("Accounting for segment duration drift",b,"at",c),this.a[c].endTime+=b,c+=1;c<this.a.length;++c)this.a[c].startTime+=b,this.a[c].endTime+=b};_.t.getDuration=function(){return this.a[this.a.length-1].endTime-this.a[0].startTime};
222
- _.t.wa=function(a){for(var b=[],c=[],d=0,e=0;d<this.a.length&&e<a.length;){var f=this.a[d],g=a[e];f.startTime<g.startTime?(b.push(f),d++):(f.startTime>g.startTime?0===d?c.push(g):this.h.info("Refusing to rewrite original references on update!"):(.1<Math.abs(f.endTime-g.endTime)?(f=new _.Sv(f.position,g.startTime,g.endTime,g.Oa,g.ua,g.ea,g.ta,g.keyInfo,g.Hc,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile),b.push(f)):b.push(f),d++),e++)}for(;d<this.a.length;)b.push(this.a[d++]);if(b.length)for(d=
223
- b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.Sv(d++,f.startTime,f.endTime,f.Oa,f.ua,f.ea,f.ta,f.keyInfo,f.Hc,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile),b.push(f);else b=a;a=b;if(c.length&&b.length){a=[];e=b[0].position;d=c.length;c=_.u(c);for(f=c.next();!f.done;f=c.next())f=f.value,a.push(new _.Sv(e-d--,f.startTime,f.endTime,f.Oa,f.ua,f.ea,f.ta,f.keyInfo,f.Hc,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile));b=_.u(b);for(f=b.next();!f.done;f=b.next())a.push(f.value)}this.a=
224
- a};_.t.replace=function(a){this.a=a};bx.prototype.release=function(){this.g.stop();for(var a=_.u(this.a),b=a.next();!b.done;b=a.next())b.value.release();this.a.clear()};cx.prototype.release=function(){this.m=null;this.j.clear();this.a=function(){};this.f=function(){};this.g=function(){}};
225
- cx.prototype.o=function(a,b){for(var c={},d=_.u(this.m.cues()),e=d.next();!e.done;c={oe:c.oe,Bd:c.Bd},e=d.next()){e=e.value;c.oe=this.j.get(e)||null;c.Bd=a<e.startTime?1:a>e.endTime?3:2;this.j.set(e,c.Bd);var f=this.w.find(function(g){return function(h){return h.rc===g.oe&&h.qc===g.Bd}}(c));f&&f.fc(e,b)}};_.t=gx.prototype;_.t.destroy=function(){this.g=this.w=null;this.o.clear();return Promise.resolve()};
226
- _.t.remove=function(a,b){var c=this;return Promise.resolve().then(function(){!c.g||!c.g.remove(a,b)||null==c.a||b<=c.a||a>=c.f||(a<=c.a&&b>=c.f?c.a=c.f=null:a<=c.a&&b<c.f?c.a=b:a>c.a&&b>=c.f&&(c.f=a))})};_.t.ub=function(){return this.a};_.t.Da=function(){return this.f};_.t.hc=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.t.Ja=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};
227
- lx.prototype.init=function(a){var b=muxjs.mp4.probe;a=_.N(a);this.m=b.videoTrackIds(a);this.j=b.timescale(a);this.a.init()};lx.prototype.g=function(a,b){var c=_.N(a);(c=this.a.parse(c,this.m,this.j))&&c.captions&&b(c.captions);this.a.clearParsedCaptions()};lx.prototype.f=function(){this.a.resetCaptionStream()};_.mx.prototype.init=function(){};_.mx.prototype.g=function(){};_.mx.prototype.f=function(){};_.t=_.ox.prototype;
228
- _.t.destroy=function(){var a=this;this.J=!0;var b=[],c;for(c in this.g){var d=this.g[c],e=d[0];this.g[c]=d.slice(0,1);e&&b.push(e.p["catch"](Ov));for(e=1;e<d.length;++e)d[e].p["catch"](Ov),d[e].p.reject()}this.a&&b.push(this.a.destroy());this.B&&b.push(this.B.destroy());for(var f in this.A)b.push(this.A[f].destroy());return Promise.all(b).then(function(){a.m&&(a.m.release(),a.m=null);a.j&&(a.j.removeAttribute("src"),a.j.load(),a.j=null);a.w="";a.o=null;a.a=null;a.B=null;a.f={};a.A={};a.F={};a.H=null;
229
- a.M=!1;for(var g in a.g);a.g={}})};_.t.init=function(a,b,c){c=void 0===c?!1:c;var d=this,e;return _.B(function(f){if(1==f.a)return e=_.nn,_.x(f,d.I,2);a.forEach(function(g,h){var l=_.Xi(g.mimeType,g.codecs);if(h==e.TEXT)tx(d,l);else{var m=new Map;m.set(h,l);_.$v(l)&&b&&!g.keyInfo||!dw(l,h)||(d.A[h]=new aw,l="aac"==l.toLowerCase().split(";")[0].split("/")[1]?l.replace(/aac/i,_.Gd):cw(h,l),m=ew(h,l),c&&m["delete"](e.AUDIO));rx(d,m)}});_.y(f)})};
230
- _.t.ub=function(a){return a===_.Ce?this.a.ub():(a=vx(this,a))?a.ub():null};_.t.Da=function(a){return a===_.Ce?this.a.Da():(a=vx(this,a))?a.Da():null};_.t.hc=function(a,b,c){return a===_.Ce?this.a.hc(b):(a=vx(this,a))?a.hc(b,!1,c):!1};_.t.Ja=function(a,b){if(a===_.Ce)return this.a.Ja(b);var c=vx(this,a);return c?c.Ja(b):0};
231
- _.t.remove=function(a,b,c){var d=this;return a===_.Ce?this.a.remove(b,c):yx(this,a,this.ah.bind(this,a,b,c)).then(function(){if(a===_.Re){var e=d.ub(a),f=d.Da(a);null!==e&&null!==f&&zw(d.D,e,f)}else a===_.mc&&(e=d.D,e.a&&e.a.trigger(new _.J(_.rc)))})};_.t.clear=function(a){if(a==_.Ce){if(!this.a)return Promise.resolve();this.H.f();return this.a.remove(0,Infinity)}return yx(this,a,this.ah.bind(this,a,0,this.o.duration))};
232
- _.t.flush=function(a){return a==_.Ce?Promise.resolve():yx(this,a,this.ig.bind(this,a))};_.t.endOfStream=function(a){var b=this;return Ex(this,function(){ux(b)||(a?b.o.endOfStream(a):b.o.endOfStream())})};_.t.getDuration=function(){return this.o.duration};_.t.Be=function(a,b){this.h.debug("Appending data to "+a+Yu);try{this.f[a].appendBuffer(b)}catch(c){throw this.h.warn("Failed to append data for "+a,c),c;}this.h.debug("Done Appending data to "+a+Yu)};
233
- _.t.ah=function(a,b,c){if(c<=b)this.Sc(a);else{this.h.debug("Removing data from "+a+" range:",b,c);try{this.f[a].remove(b,c)}catch(d){throw this.h.warn("Failed to remove data from "+a+" buffer. Range:",b,c,d),d;}this.h.debug("Done Removing data from "+a+" range:",b,c)}};
234
- _.t.th=function(a){try{this.h.debug("Aborting operations for "+a+Yu);var b=this.f[a].appendWindowStart,c=this.f[a].appendWindowEnd;this.f[a].abort();this.f[a].appendWindowStart=b;this.f[a].appendWindowEnd=c}catch(d){throw this.h.warn("Failed to abort operations for "+a+Yu,d),d;}this.h.debug("Done Aborting operations for "+a+Yu);this.Sc(a)};
235
- _.t.ig=function(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.h.debug("Flushing buffer for "+a),this.j.currentTime-=.001):this.h.warn("Skip buffer flush for "+a+" with element state: "+this.j.readyState)}catch(b){throw this.h.warn("Failed to flush buffer for "+a,b),b;}this.h.debug("Done Flushing buffer for "+a);this.Sc(a)};
236
- _.t.hh=function(a,b){0>b&&(b+=.001);try{this.h.debug("Setting timestamp offset for "+a,b),this.f[a].timestampOffset=b}catch(c){throw this.h.warn("Failed to set timestamp offset for "+a,b,c),c;}this.h.debug("Done Setting timestamp offset for "+a,b);this.Sc(a)};
237
- _.t.il=function(a,b,c){try{this.h.debug("Setting append window for "+a,b,c),this.f[a].appendWindowStart=0,this.f[a].appendWindowEnd=c,this.f[a].appendWindowStart=b}catch(d){throw this.h.warn("Failed to set append window for "+a,b,c,d),d;}this.h.debug("Done Setting append window for "+a,b,c);this.Sc(a)};_.t.U=function(a){this.g[a][0].p.reject(new _.L(_.M,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
238
- _.t.Sc=function(a){var b=this.g[a][0];b&&(b.p.resolve(),this.h.debug("Update-End received for "+a),Hx(this,a))};_.t.getTextDisplayer=function(){return this.B};var qx=window.URL.createObjectURL;_.w(dy,_.S);_.t=dy.prototype;_.t.initialize=function(a){this.l=a};_.t.release=function(){this.g=[];this.a.clear();this.f.clear()};_.t.load=function(){};_.t.destroy=function(){this.release();this.l=null};_.t.getVideoTracks=function(){return ey(this,_.wi)};_.t.getAudioTracks=function(){return ey(this,_.R)};_.t.ia=function(){return ey(this,_.P)};_.t.fa=function(){return this.a.get(_.wi)||null};_.t.La=function(){return this.a.get(_.R)||null};_.t.Na=function(){return this.a.get(_.P)||null};
239
- _.t.Za=function(){return this.f.get(_.wi)||null};_.t.ib=function(){return this.f.get(_.R)||null};_.t.jb=function(){return this.f.get(_.P)||null};_.t.Pa=function(){return fy(this,_.wi)};_.t.qa=function(){return fy(this,_.R)};_.t.ra=function(){return fy(this,_.P)};_.t.eb=function(a){hy(this,_.wi,a)};_.t.ya=function(a){hy(this,_.R,a)};_.t.Ga=function(a){hy(this,_.P,a)};_.t.cb=function(a,b){gy(this,_.wi,a,void 0===b?!1:b)};_.t.pb=function(a,b){gy(this,_.R,a,void 0===b?!1:b)};
240
- _.t.qb=function(a,b){gy(this,_.P,a,void 0===b?!1:b)};_.t.addTextTrack=function(a){var b=this;return _.B(function(c){return b.l?_.x(c,b.l.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label),0):c.G(0)})};_.t.ka=function(){return!!this.l&&this.l.ka()};dy.prototype.isAbrEnabled=dy.prototype.ka;dy.prototype.addTextTrack=dy.prototype.addTextTrack;dy.prototype.setTextRendition=dy.prototype.qb;dy.prototype.setAudioRendition=dy.prototype.pb;dy.prototype.setVideoRendition=dy.prototype.cb;
241
- dy.prototype.setTextTrack=dy.prototype.Ga;dy.prototype.setAudioTrack=dy.prototype.ya;dy.prototype.setVideoTrack=dy.prototype.eb;dy.prototype.getTextTrack=dy.prototype.ra;dy.prototype.getAudioTrack=dy.prototype.qa;dy.prototype.getVideoTrack=dy.prototype.Pa;dy.prototype.getLoadingTextRendition=dy.prototype.jb;dy.prototype.getLoadingAudioRendition=dy.prototype.ib;dy.prototype.getLoadingVideoRendition=dy.prototype.Za;dy.prototype.getTextRendition=dy.prototype.Na;dy.prototype.getAudioRendition=dy.prototype.La;
242
- dy.prototype.getVideoRendition=dy.prototype.fa;dy.prototype.getTextTracks=dy.prototype.ia;dy.prototype.getAudioTracks=dy.prototype.getAudioTracks;dy.prototype.getVideoTracks=dy.prototype.getVideoTracks;_.t=_.uy.prototype;_.t.stop=function(){this.w=null;this.j=!1;this.o=[];this.m=1;this.g=null;this.B=!1};_.t.init=function(a){this.w=a};
243
- _.t.chooseVariant=function(){var a=vy(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o),b=ty(this.f,this.a.defaultBandwidthEstimate);this.o.length&&!a.length&&(this.h.warn("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),a=vy(null,this.o),a=[a[0]]);var c=a[0]||null;a=_.u(_.uB(a));for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e.item;var f=isNaN(this.m)||0===this.m?1:Math.abs(this.m),g=f*d.bandwidth,h=g/this.a.bandwidthDowngradeTarget;
244
- e=f*(e.next||{bandwidth:Infinity}).bandwidth/this.a.bandwidthUpgradeTarget;this.h.debug("Bandwidth ranges:",(g/1E6).toFixed(3),(h/1E6).toFixed(3),(e/1E6).toFixed(3));b>=h&&b<=e&&(c=d)}this.g=Date.now();this.B=!0;return c};_.t.enable=function(){this.j=!0};_.t.disable=function(){this.j=!1};
245
- _.t.segmentDownloaded=function(a,b){this.h.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.g,"enabled\x3d"+this.j);var c=this.f;if(!(16E3>b)){var d=8E3*b/a,e=a/1E3;c.a+=b;_.Gw(c.f,e,d);_.Gw(c.g,e,d)}if(null!=this.g&&this.j)a:{this.h.debug("Suggesting Streams...");if(!this.A){if(!(128E3<=this.f.a)){this.h.debug("Still waiting for a good estimate...");break a}this.A=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.g<1E3*this.a.switchInterval){this.h.debug("Skipping initial estimation switch due to switch interval...");
246
- break a}}else if(Date.now()-this.g<1E3*this.a.switchInterval){this.h.debug("Still within switch interval...");break a}c=this.chooseVariant();this.h.debug("Calling switch_(), bandwidth\x3d"+Math.round(ty(this.f,this.a.defaultBandwidthEstimate)/1E3)+" kbps");c&&this.w(c)}};_.t.playbackRateChanged=function(a){this.m=a};_.t.getBandwidthEstimate=function(){return ty(this.f,this.a.defaultBandwidthEstimate)};_.t.setVariants=function(a){this.o=a};_.t.configure=function(a){this.a=a};
247
- _.t.reset=function(){this.A=!1;this.f=new sy;var a=this.chooseVariant();a&&this.w(a)};wy.prototype.clear=function(){this.a.clear()};zy.prototype.add=function(a){if(Cy(this.f,a))return this.a.add(a),!0;_.G("Rejecting variant - not compatible with root.");return!1};zy.prototype.values=function(){return this.a.values()};Ey.prototype.create=function(a){var b=this,c=a.filter(function(d){return Cy(b.a,d)});return c.length?new zy(c[0],c):this.f.create(a)};
248
- Dy.prototype.create=function(a){var b=Fy(a,this.g);0<b.length&&(a=b);b=!1;if(this.a){var c=Gy(a,this.a);0<c.length?(a=c,b=!0):_.G("No exact match for preferred variant role could be found. Role: "+this.a)}b||(b=a.filter(function(d){return d.primary}),0<b.length&&(a=b));this.f&&(b=Jx(a,this.f),b.length?a=b:_.G("No exact match for the channel count could be found."));b=new zy(a[0]);a=_.u(a);for(c=a.next();!c.done;c=a.next())c=c.value,Cy(b.f,c)&&b.add(c);return b};Jy.prototype.getState=function(){return this.a};var Iy=0,Hy=1;Ly.prototype.release=function(){this.f.release()};My.prototype.release=function(){this.a=this.g=null;this.f=function(){}};My.prototype.o=function(a){var b=this.a,c=this.g.periods;a=Aw(c,a)||c[0];b!=a&&this.f(a);this.a=a};Oy.prototype.release=function(){this.f&&(this.f.stop(),this.f=null);this.a=null};Oy.prototype.set=function(a){this.g=a;Py(this)};Ry.prototype.release=function(){this.g=null;this.f=function(){}};Vy.prototype.release=function(){this.g&&(this.g.release(),this.g=null);null!=this.w&&(this.w.stop(),this.w=null);this.f&&(this.f.release(),this.f=null);this.a=this.F=this.D=null;this.o=!1};Vy.prototype.ce=function(){this.A=!0;Uy(this)};Zy.prototype.release=function(){this.f&&(this.f.release(),this.f=null);null!=this.g&&(this.g.release(),this.g=null);this.j=function(){};this.a=null;this.o=function(){};this.w=!1};Wy.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};gz.prototype.release=function(){this.f&&(this.f.release(),this.f=null);this.j&&(this.j.release(),this.j=null);this.o&&(this.o.stop(),this.o=null);this.g=this.f=this.a=this.m=null;this.A=function(){}};var mz=new _.Lm(function(){return new Uint8Array([0,0,0,80,115,105,110,102,0,0,0,12,102,114,109,97,0,0,0,0,0,0,0,20,115,99,104,109,0,0,0,0,99,101,110,99,0,1,0,0,0,0,0,40,115,99,104,105,0,0,0,32,116,101,110,99,0,0,0,0,0,0,1,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])});var Vz;_.t=_.oz.prototype;_.t.destroy=function(){var a=this,b,c,d,e;return _.B(function(f){if(1==f.a){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,yz(e),b.push(zz(e));return _.x(f,Promise.all(b),2)}a.a.clear();a.o.clear();a.C=null;a.f=null;a.F=null;a.m=null;a.j=null;a.g=!0;_.y(f)})};
249
- _.t.start=function(){var a=this,b,c,d;return _.B(function(e){if(1==e.a){b=a.C.zb();c=uz(a,b);d=a.C.bf(a.f.periods[c]);if(!d.variant&&!d.text)throw a.h.error("start(): No streams chosen"),new _.L(_.M,5,5005);a.D=!d.variant&&!!d.text;return _.x(e,Qz(a,d.variant?d.variant.audio:null,d.variant?d.variant.video:null,d.text,b),2)}if(a.g)return e["return"]();a.h.debug("init: completed initial Stream setup");a.C&&a.C.uk&&(a.h.debug("init: calling onInitialStreamsSetup()..."),a.C.uk());_.y(e)})};
250
- _.t.Eb=function(a){var b=this,c,d,e,f;return _.B(function(g){switch(g.a){case 1:if(b.g)return g["return"]();c=Fz(a);if(a.ab||null==a.tb||a.$b)return g["return"]();a.tb=null;if(!a.Ib){g.G(2);break}b.h.debug(c,"skipping update and clearing the buffer");return _.x(g,Iz(b,a,a.ge,a.Ld),3);case 3:return g["return"]();case 2:_.Bf(g,4);d=Uz(b,a);null!=d&&(wz(b,a,d),a.Oc=!1);_.Cf(g,5);break;case 4:return e=_.Df(g),_.x(g,eA(b,e),6);case 6:return g["return"]();case 5:f=Array.from(b.a.values()),jA(b,a),b.B&&
251
- f.every(function(h){return h.endOfStream})&&(b.h.debug(c,"calling endOfStream()..."),b.C.W.endOfStream().then(function(){if(!b.g){var h=b.C.W.getDuration();h<b.f.presentationTimeline.getDuration()&&(b.f.presentationTimeline.f=h)}}).then(function(){b.C.Gg()})),_.y(g)}})};
252
- _.t.Ok=function(a,b,c,d){var e=Gv(d.reader),f=Gv(d.reader),g=_.U(d.reader),h=_.U(d.reader),l=_.U(d.reader),m=_.U(d.reader);d=_.Nk(d.reader,d.reader.Ea()-d.reader.getPosition());a=a.startTime+b.startTime+h/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.C.Lg();else this.C.onEvent(new _.J("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:l,id:m,messageData:d}}))};
253
- _.t.xl=function(a){var b=this,c=!1,d=0;(new _.Ok).L(_.Fd,_.Pk).L(_.Ge,_.Pk).L(_.Ad,_.Pk).L(_.Ed,_.Pk).L(_.ue,_.Pk).Y(_.we,_.Qk).L("encv",function(e){e.reader.skip(78);_.Pk(e)}).L("pasp",function(e){d=e.start+e.headerSize;var f=_.U(e.reader),g=_.U(e.reader);c=f!==g;b.h.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.parser.stop()}).parse(a.data);c&&(a=new _.Ck(new DataView(a.data)),a.seek(d),_.T(a,1),_.T(a,1))};Vz="iterateSegmentReference";_.vB={ITERATOR:Vz,LOOKUP:_.vv};_.w(mA,_.kk);_.t=mA.prototype;_.t.init=function(a,b){var c=a.getMedia();_.kk.prototype.init.call(this,a,b);sA(this,c)};_.t.namespace=function(){return sv};_.t.ag=function(){return new dy};_.t.getState=function(){return this.ha};_.t.getDrmInfo=function(){return this.m?this.m.getDrmInfo():null};
254
- _.t.unload=function(){var a=this;jy(this,!1);this.bd=!1;if(this.w){var b=this.getTrackManager();b&&b.release();return this.F===pA?Promise.resolve():uA(this).then(function(){a.log.debug(_.ib,a.w);a.w=null;a.We=0;a.Ac=null;a.T=null})}return Promise.resolve()};
255
- _.t.release=function(){var a=this;return _.B(function(b){if(a.da)return b["return"](a.da);a.da=new Promise(function(c,d){try{var e=a.Sb;a.Sb=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.kk.prototype.release.call(a)}):f=_.kk.prototype.release.call(a);f=f.then(function(){return a.unload()});f.then(function(){oA(a,_.Om);a.da=null;c()})["catch"](function(g){a.da=null;d(g)})}catch(g){a.da=null,d(g)}});return b["return"](a.da)})};
256
- _.t.getBufferInfo=function(a){if(this.J){var b=wx(this.J),c=new _.Zj(void 0,a);switch(a){case _.wi:return b.video?b.video:c;case _.R:return b.audio?b.audio:c;case _.P:return b.text?b.text:c}return b.total?b.total:c}return this.hd?(b=ww(this.hd),hw(b,a)):_.kk.prototype.getBufferInfo.call(this,a)};_.t.getPosition=function(){return this.A?iz(this.A):_.kk.prototype.getPosition.call(this)};_.t.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null};
257
- _.t.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.t.destroy=function(){var a=this;return _.B(function(b){if(1==b.a)return _.x(b,_.kk.prototype.destroy.call(a),2);if(3!=b.a){if(a.F===pA)return b["return"]();a.log.debug("Destroying player...");a.F=pA;return _.x(b,rA(a),3)}a.o&&(a.o.release(),a.o=null);a.g=null;_.y(b)})};
258
- _.t.load=function(a){var b=this,c,d,e,f,g,h,l,m;return _.B(function(n){switch(n.a){case 1:if(b.F===pA)return n["return"](Promise.reject(new _.L(_.M,7,7E3)));c=new _.fi;d=function(){return b.Sb!==c};e=function(){b.log.info("Aborting current load");throw new _.L(_.M,7,7E3);};b.Sb=c;_.Bf(n,2);d()&&e();if(!b.da){n.G(4);break}_.Bf(n,5);return _.x(n,b.da,7);case 7:_.Cf(n,6,2);break;case 5:_.Df(n,2);case 6:d()&&e();case 4:return b.I=new _.Em,b.Ve=Date.now()/1E3,oA(b,_.$m),b.w=_.fn(a),_.jk(a)&&(b.configuration=
259
- _.ik(b.Pd,a)),b.log.info(_.Ta,b.configuration),b.log.info(_.db,b.w),(f=b.getTrackManager())&&f.load(),g=b.getSurface().getMedia(),g.loop=!!b.configuration.loop,_.K.R(b.configuration.volume)||b.setVolume(b.configuration.volume),_.K.R(b.configuration.muted)||b.setMuted(b.configuration.muted),VA(b),h=b.w[b.getSourceIndex()],d()&&e(),_.x(n,sA(b,g),8);case 8:return d()&&e(),_.x(n,tA(b,g),9);case 9:return d()&&e(),_.x(n,wA(b,h),10);case 10:return d()&&e(),_.x(n,AA(b,h),11);case 11:return d()&&e(),_.x(n,
260
- HA(b),12);case 12:return d()&&e(),_.x(n,SA(b),13);case 13:d()&&e();c.resolve();_.Cf(n,0);break;case 2:throw m=l=_.Df(n),d()&&(m=new _.L(_.M,7,7E3)),c.reject(m),b.onError(m),m;}})};_.t.detach=function(){var a=this;return _.B(function(b){return 1==b.a?_.x(b,qA(a),2):b["return"](rA(a))})};_.t.isLive=function(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!=a.f&&!a.o):a=!1;return a};
261
- _.t.Pg=function(){this.log.debug("User seeking finished");this.H&&IA(this);JA(this)};_.t.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:_.Sw(a,0),end:Rw(a)}}return{start:0,end:0}};_.t.Nc=function(){return this.f?this.f.presentationTimeline.Nc():null};_.t.getPlaybackRate=function(){if(this.Bc){var a=this.Bc;a=a.j?0:a.g}else a=0;return a};
262
- _.t.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.F===lA){this.Bc.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.a.get(_.Re)){var d=a.stream;if(d)if(b.h.debug("setTrickPlay",c),c)(c=d.trickModeVideo)&&!a.Vb&&(b.h.debug("Engaging trick mode stream",c),_.Bz(b,c,!1,0),a.Vb=d);else if(d=a.Vb)b.h.debug("Restoring non-trick-mode stream",d),a.Vb=null,_.Bz(b,d,!0,0)}}};
263
- _.t.ia=function(){if(this.f&&this.A){var a=BA(this);if(null==a)a=null;else{if(!yy(this.N,a).text){var b=_.Xx(a.textStreams,this.Ia,this.xc);b.length&&(b=b[0],yy(this.N,a).text=b)}a=yy(this.N,a).text}b=[];for(var c=_.u(iB(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=Ux(d);e.active=d==a;b.push(e)}return b}return[]};_.t.getPeriods=function(){return this.f.periods};
264
- _.t.getStats=function(){if(this.F!==lA)return _.Fm();JA(this);var a=this.j;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.I,c=Number(a.totalVideoFrames);b.m=Number(a.droppedVideoFrames);b.j=c}if(this.F===lA){if(a=WA(this))this.I.o=a.bandwidth;a&&a.video&&(b=this.I,c=a.video.height||NaN,b.w=a.video.width||NaN,b.g=c);a=this.g.getBandwidthEstimate();this.I.f=a}return this.I.getStats()};
265
- _.t.getTimelineCues=function(){return this.yc?_.of(this.yc.cues()).concat().map(function(a){return{schemeIdUri:a.schemeIdUri,value:a.value,startTime:a.startTime,endTime:a.endTime,id:a.id,eventElement:a.eventElement,type:a.type}}):[]};_.t.resetAbr=function(){this.g&&this.g.reset()};
266
- _.t.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,r,v,z;return _.B(function(A){if(1==A.a){if(g.F!==lA)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");h=BA(g);l=_.nn;m=g.f.periods.indexOf(h);n=m+1;p=n>=g.f.periods.length?g.f.presentationTimeline.getDuration():g.f.periods[n].startTime;q=p-h.startTime;if(Infinity==q)throw new _.L(1,4,4040);r=new _.Sv(1,0,q,function(){return[a]},0,null,0);v={id:g.fh++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
267
- findSegmentPosition:function(){return 1},getSegmentReference:function(D){return 1==D?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.vv,initSegmentReference:null,mimeType:d,codecs:e||"",kind:c,encrypted:!1,keyId:null,language:b,originalLanguage:b,label:f||null,type:l.TEXT,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,closedCaptions:null};g.Xd.add(v);h.textStreams.push(v);return _.x(A,xz(g.a,v),2)}if(z=_.qz(g.a,
268
- _.Ce))yy(g.N,h).text=z;g.Xd["delete"](v);g.log.debug("Choosing new streams after adding a text stream");UA(g,h);DA(g);return A["return"](Ux(v))})};
269
- _.t.ri=function(a){this.log.debug(_.xv,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=gB(this,a);this.log.debug("onChooseStreams_, chose variant ",b.variant);this.log.debug("onChooseStreams_, chose text ",b.text);return b}catch(c){return this.onError(c),{variant:null,text:null}}};
270
- _.t.pi=function(){this.log.debug("canSwitch_");this.V=!1;this.configuration.abr.enabled&&this.g.enable();this.ma&&(Cz(this.a,this.ma,this.Yg,this.Qg),this.ma=null);this.ga&&(_.Bz(this.a,this.ga,!0,0),this.ga=null)};_.t.si=function(){this.B&&this.B.update&&this.B.update()};_.t.Fk=function(){this.A&&this.A.j.ce()};
271
- _.t.Ah=function(a,b,c){if((void 0===c?"":c)===wv)return DA(this),this.ka()||(this.configuration.abr.enabled=!0,this.g.enable()),UA(this,b,!1),!0;if(c=b.variants.some(function(g){var h=!1,l=g[a.type];l&&(h=g.allowedByApplication&&l.id!==a.id,a.type===_.mc&&(h=h&&l.language===a.language));return h})&&this.ka()){for(var d=_.u(b.variants),e=d.next();!e.done;e=d.next()){e=e.value;var f=e[a.type];f&&f.id===a.id&&(e.allowedByApplication=!1)}DA(this);this.ka()||(this.configuration.abr.enabled=!0,this.g.enable());
272
- UA(this,b)}return c};_.t.sk=function(){this.log.debug("endOfStream called by streaming engine");this.bd=!0};_.t.onError=function(a){if(this.F!==pA&&7001!==a.code&&7E3!==a.code){var b=new _.J(_.jd,{detail:a});a.severity===_.M&&oA(this,_.Zm);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.t.Ae=function(a){a.type===_.cd?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.$e?vA(this):"emsg"!==a.type&&(a instanceof _.J?this.dispatchEvent(a):this.log.debug(_.xb,a.type)))};_.t.ka=function(){return this.configuration.abr.enabled};
273
- _.t.rl=function(a){var b=this,c,d,e,f,g,h,l,m;return _.B(function(n){switch(n.a){case 1:if(!b.wc)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ka();return _.x(n,b.wc(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.K.wa(b.getLoadedSource(),{url:e});d&&b.g.disable();return _.x(n,Jz(b.a),3);case 3:g=WA(b);case 4:return h=!1,_.Bf(n,7),b.log.info("Switching CDN to "+f.url+"."),_.x(n,jB(b,f,g),9);case 9:_.Cf(n,6);break;case 7:return l=_.Df(n),b.log.info("Switch failed"),
274
- _.x(n,b.wc(f.url,a),10);case 10:if(m=n.f)f.url=m,h=!0;else throw l;case 6:h?n.G(4):(d&&b.g.enable(),Hz(b.a,!0),b.w[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.J(_.Bc,{newManifest:f.url})),_.y(n))}})};mA.prototype.detach=mA.prototype.detach;var pA=0,kA=1,lA=2,CA=[_.Ud,_.pd];kB.prototype.a=function(){return sv};
275
- kB.prototype.canPlay=function(a,b){if(_.fj())return 0;var c=a.type||"",d=(window.ManagedMediaSource?!0:!1)||(window.MediaSource&&MediaSource.isTypeSupported?!0:!1),e=window.ManagedMediaSource||window.MediaSource&&MediaSource.isTypeSupported?c in _.wp||_.xp(a.url)in _.yp?!0:!1:!1;if(d&&e){if(_.mi(2))return 1;if(_.gj()&&c===_.Kj){if(b.streaming.preferNativeHlsOnSafari)return 1;_.G("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};
276
- kB.prototype.create=function(){return new mA};_.$f(new kB);_.Sn(function(){_.Uf("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Tf("Patching Chromecast MSE bugs."),pB();else if(_.gj()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;nB();10>=a?(_.Tf("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Tf("Patching Safari 11 \x26 12 MSE bugs."),lB(),mB()):(_.Tf("Patching Safari 13 MSE bugs."),lB())}else _.mi(2)||_.mi(3)||
277
- _.mi(4)?oB():_.Tf("Using native MSE as-is.");else _.Tf("No MSE implementation available.")});_.w(qB,_.cq);_.t=qB.prototype;
278
- _.t.append=function(a){function b(e){if(e.startTime>=e.endTime)_.G("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.Lh(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.Dc}catch(g){f.align="middle"}e.writingMode===_.Pe?f.vertical="lr":e.writingMode===_.Qe&&(f.vertical="rl");e=f}e&&c.push(e)}var c=[],d=_.u(a);for(a=d.next();!a.done;a=d.next())b(a.value);a=c.slice().sort(function(e,f){return e.startTime!==f.startTime?
279
- e.startTime-f.startTime:e.endTime!==f.endTime?e.endTime-f.startTime:c.indexOf(f)-c.indexOf(e)});d=_.u(a);for(a=d.next();!a.done;a=d.next())this.a.addCue(a.value)};_.t.remove=function(a,b){if(!this.a)return!1;rB(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.t.isTextVisible=function(){return this.a.mode==_.ne};_.t.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.ne:_.nd)};_.t.destroy=function(){this.a&&rB(this.a,function(){return!0});this.a=null;return Promise.resolve()};sB.prototype.ba=function(){return!0};sB.prototype.create=function(a){return new qB(a)};_.wm("single-native",new sB);};
99
+ rA=function(a){function b(){d=!0}function c(m){f.push(m);_.vl(m)}a=_.R(a);var d=!1,e,f=[],g=[];(new _.ul).L(_.Wd,c).L(_.df,c).L(_.Rd,c).L(_.Vd,c).L(_.Te,c).X(_.Ve,function(m){e=m;f.push(m);_.wl(m)}).X("encv",b).X("enca",b).X("avc1",function(m){g.push({L:m,Oc:1701733238})}).X("avc3",function(m){g.push({L:m,Oc:1701733238})}).X("ac-3",function(m){g.push({L:m,Oc:1701733217})}).X("ec-3",function(m){g.push({L:m,Oc:1701733217})}).X("mp4a",function(m){g.push({L:m,Oc:1701733217})}).parse(a);if(d)return _.tg("Init segment already indicates encryption."),
100
+ a;if(0===g.length||!e)throw _.vg("Failed to find boxes needed to fake encryption!"),_.vg("Failed init segment (hex):",_.qi(a)),new _.N(_.O,3,14E3);g.reverse();for(var h=_.u(g),l=h.next();!l.done;l=h.next())l=l.value,_.tg('Inserting "'+_.zl(l.Oc)+'" box into init segment.'),a=qA(a,e,l.L,f,l.Oc);return a};
101
+ qA=function(a,b,c,d,e){var f=sA.value(),g=a.subarray(c.start,c.start+c.size),h=_.Vh(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.Vh(l);g.setUint32(4,e);l.set(f,c.size);e=h.getUint32(4);g.setUint32(c.size+16,e);tA(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.Ej("Xbox One")||_.Dj()?c.start:c.start+c.size;f=a.subarray(c);e.set(a.subarray(0,c));e.set(l,c);e.set(f,c+l.byteLength);a=_.u(d);for(d=a.next();!d.done;d=a.next())d=d.value,tA(e,d.start,d.size+l.byteLength);l=_.Vh(e,
102
+ b.start);b=_.Al(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};tA=function(a,b,c){a=_.Vh(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.uA=function(a,b){this.C=b;this.j=a;this.g=null;this.w=1;this.F=Promise.resolve();this.l=[];this.o=new Map;this.a=new Map;this.I=this.f=this.A=this.B=!1;this.H=0;this.h=new _.K("clpp.mse.Streaming");this.D=!1};wA=function(a){var b=a.a.get(_.uf);return b?vA(a)[b.Bb]:(b=a.a.get(_.rc))?vA(a)[b.Bb]:null};
103
+ yA=function(a){return _.xA(a,_.rc)};zA=function(a){return _.xA(a,_.uf)};
104
+ EA=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.G(function(q){switch(q.a){case 1:return c=_.io,_.x(q,a.C.W.clear(c.TEXT),2);case 2:return a.H++,a.I=!1,d=a.H,e=a.C.W,f=new Map,g=new Set,f.set(c.TEXT,b),g.add(b),_.x(q,e.init(f,!1,a.g.disableAudioTracks),3);case 3:return a.f?q["return"]():_.x(q,AA(a,g),4);case 4:if(a.f)return q["return"]();l=(h=e.getTextDisplayer().isTextVisible())||a.g.alwaysStreamText;a.H!=d||a.a.has(c.TEXT)||a.I||!l||(m=a.C.yb(),n=BA(a,m),p=CA(b,n,0),a.a.set(c.TEXT,p),DA(a,p,0));
105
+ _.y(q)}})};HA=function(a){a.I=!0;var b=a.a.get(_.$e);b&&(FA(b),GA(b)["catch"](function(){}),a.a["delete"](_.$e))};JA=function(a,b,c,d){b.video&&_.IA(a,b.video,c,d);b.audio&&_.IA(a,b.audio,c,d)};
106
+ LA=function(a){function b(l){return a.C.W.fc(l,c,0)}var c=a.C.yb(),d=!1,e=BA(a,c);if(_.Mh(a.a.values(),function(l){return l.Bb==e}))for(var f=_.u(a.a.keys()),g=f.next();!g.done;g=f.next()){g=g.value;var h=a.a.get(g);h.stream.segmentIterator=null;b(g)||(KA(a,h),d=!0)}else if(!_.Mh(a.a.keys(),b)){a.h.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.u(a.a.values());for(f=d.next();!f.done;f=d.next())KA(a,f.value);d=!0}d||a.h.debug("(all): seeked: buffered seek: presentationTime\x3d"+
107
+ c)};OA=function(a,b){b=void 0===b?!1:b;if(a.f)a.h.error("Unable to retry after StreamingEngine is destroyed!");else if(a.A)a.h.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(var c=_.u(a.a.values()),d=c.next();!d.done;d=c.next()){d=d.value;var e=MA(d);if(d.Lc||b&&NA(d))a.h.info(e,"Retrying after failure..."),d.Lc=!1,DA(a,d,.1)}};
108
+ QA=function(a){var b,c,d,e;return _.G(function(f){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,FA(e),e.$a&&e.Eb&&(e.$a=!1,b.push(e.Eb.abort())),e.Hb&&b.push(PA(a,e,!0,0));return _.x(f,Promise.all(b),0)})};RA=function(a,b,c){(a=a.a.get(b))&&c&&(FA(a),a.stream=c,a.Qb=c,a.sa&&(a.sa=c.getSegmentReference(a.sa.position)),a.sa||(a.Qb=null))};_.xA=function(a,b){var c=a.a.get(b);return c?c.Ub||c.stream:null};
109
+ _.IA=function(a,b,c,d){var e=a.a.get(b.type);if(!e&&b.type==_.$e&&a.g.ignoreTextStreamFailures)EA(a,b);else if(e){var f=Kx(vA(a),b);if(c&&f!=e.Bb)for(a.h.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),b=_.u(a.a.values()),c=b.next();!c.done;c=b.next())KA(a,c.value);else{e.Ub&&(a.h.debug("switch during trick play mode",b),b.trickModeVideo?(e.Ub=b,b=b.trickModeVideo,a.h.debug("switch found trick play stream",b)):(e.Ub=null,a.h.debug("switch found no special trick play stream")));
110
+ var g=a.l[f];if(g&&g.Rc&&(g=a.o.get(b.id))&&g.Rc)if(e.stream!=b){g=a.j.presentationTimeline.getDuration();var h=a.C.yb();h=SA(a,e,h);!c&&(e.endOfStream||h>=g)?a.h.debug(Vw+MA(e)+" already buffered to the end. Not switching."):(b.type==_.$e&&Ay(a.C.W,_.wj(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.sd=!0,a.h.debug("switch: switching to Stream "+MA(e)),TA(a,e,f)&&(a.h.info("Aborting current segment request to switch."),e.Eb.abort()),c&&(e.Zb?e.ke=!0:e.$a?(e.Hb=!0,e.Kd=d,e.ke=!0):
111
+ (FA(e),PA(a,e,!0,d)["catch"](function(l){if(a.C)a.C.onError(l)}))))}else a.h.debug(Vw+MA(e)+" already active")}}};TA=function(a,b,c){if(!b.Eb)return!1;var d=a.C.yb(),e=a.C.W.Ea(b.type);c=(c=UA(a,b,d,e,c))?c.fa?c.fa-c.ta+1:null:null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=(f.fa?f.fa-f.ta+1:null)||0);f=a.C.Ke().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.j.minBufferTime||0,a.g.rebufferingGoal))return!0;a=b.Eb;a=a.j?a.j.bytesRemaining:-1;return 0>a||a>c?!0:!1};
112
+ KA=function(a,b){var c=MA(b);b.Zb?a.h.debug(c,"clear: already clearing the buffer"):b.Hb?a.h.debug(c,"clear: already waiting"):b.$a?(a.h.debug(c,"clear: currently updating"),b.Hb=!0,b.Kd=0):null==a.C.W.tb(b.type)?(a.h.debug(c,"clear: nothing buffered"),null==b.sb&&DA(a,b,0)):(a.h.debug(c,"clear: handling right now"),FA(b),PA(a,b,!1,0)["catch"](function(d){if(a.C)a.C.onError(d)}))};
113
+ WA=function(a,b,c,d,e){var f,g,h,l,m,n,p;return _.G(function(q){if(1==q.a)return f=a.C.yb(),g=BA(a,f),h=_.io,l=new Map,m=new Set,b&&(l.set(h.AUDIO,b),m.add(b)),c&&(l.set(h.VIDEO,c),m.add(c)),d&&(l.set(h.TEXT,d),m.add(d)),n=a.C.W,p=a.g.forceNativeTS,_.x(q,n.init(l,p,a.g.disableAudioTracks),2);if(3!=q.a){if(a.f)return q["return"]();VA(a);return _.x(q,AA(a,m),3)}if(a.f)return q["return"]();l.forEach(function(t,v){if(!a.a.has(v)){var z=CA(t,g,e);a.a.set(v,z);DA(a,z,0)}});_.y(q)})};
114
+ CA=function(a,b,c){return{stream:a,type:a.type,Qb:null,segmentIterator:null,sa:null,Ub:null,sd:!0,Bb:b,endOfStream:!1,$a:!1,sb:null,Hb:!1,Kd:0,ke:!1,Zb:!1,pf:!1,Lc:!1,jh:c||0,Eb:null,Nd:!1,Gg:0}};
115
+ XA=function(a,b){var c=a.l[b];if(c)return a.h.debug("(all) Period "+b+ow),c.O;a.h.debug("(all) setting up Period "+b);c={O:new _.Fi,Rc:!1};a.l[b]=c;for(var d=new Set,e=_.u(vA(a)[b].variants),f=e.next();!f.done;f=e.next())f=f.value,f.video&&d.add(f.video),f.video&&f.video.trickModeVideo&&d.add(f.video.trickModeVideo),f.audio&&d.add(f.audio);e=_.u(vA(a)[b].textStreams);for(f=e.next();!f.done;f=e.next())d.add(f.value);a.F=a.F.then(function(){return a.f?null:AA(a,d)}).then(function(){a.f||(a.l[b].O.resolve(),
116
+ a.l[b].Rc=!0,a.h.debug("(all) setup Period "+b))})["catch"](function(g){a.f||(a.l[b].O["catch"](function(){}),a.l[b].O.reject(),delete a.l[b],a.h.warn("(all) failed to setup Period "+b),a.C.onError(g))});return c.O};
117
+ AA=function(a,b){var c,d,e,f,g,h,l,m,n,p,q;return _.G(function(t){switch(t.a){case 1:c=[];d=_.u(b);for(e=d.next();!e.done;e=d.next())f=e.value,(g=a.o.get(f.id))?(a.h.debug("(all) Stream "+f.id+ow),c.push(g.O)):(a.h.debug("(all) setting up Stream "+f.id),a.o.set(f.id,{O:new _.Fi,Rc:!1}),c.push(f.createSegmentIndex()));_.B(t,2);return _.x(t,Promise.all(c),4);case 4:if(a.f)return t["return"]();_.ag(t,3);break;case 2:h=_.D(t);if(a.f)return t["return"]();l=_.u(b);for(e=l.next();!e.done;e=l.next())m=e.value,
118
+ a.o.get(m.id).O["catch"](function(){}),a.o.get(m.id).O.reject(),a.o["delete"](m.id);throw h;case 3:n=_.u(b);for(e=n.next();!e.done;e=n.next())p=e.value,q=a.o.get(p.id),q.Rc||(q.O.resolve(),q.Rc=!0,a.h.debug("(all) setup Stream "+p.id));_.y(t)}})};VA=function(a){var b=a.j.presentationTimeline.getDuration();Infinity>b?My(a.C.W,b):My(a.C.W,Math.pow(2,32))};
119
+ $A=function(a,b){function c(p){return p.type==_.$e&&p.stream.mimeType==_.jc}if(c(b))return Hy(a.C.W,b.stream.originalId||""),null;b.type==_.$e&&Iy(a.C.W);if(!zy(a.C.W)&&b.type!=_.$e)return a.g.bufferLimitUpdateInterval?a.g.bufferLimitUpdateInterval/2:.5;var d=MA(b),e=a.C.yb(),f=SA(a,b,e);a.h.debug(d,"timeNeeded\x3d"+f);var g=Kx(vA(a),b.stream),h=BA(a,f),l=a.C.W.Ja(b.type,e);a.h.debug(d,"update_:",Qw+e,"bufferedAhead\x3d"+l);var m=Math.max(a.j.minBufferTime||0,a.g.rebufferingGoal,a.g.bufferingGoal)*
120
+ a.w,n=Sx(a.j.presentationTimeline);if(null!=n&&f>=n&&!b.Nd)return YA(a,b),null;b.endOfStream=!1;b.Bb=h;if(h!=g)return a.h.debug(d,"need Period "+h,Qw+e,"timeNeeded\x3d"+f,"currentPeriodIndex\x3d"+g),null;if(l>=m)return a.h.debug(d,"buffering goal met"),a.g.bufferLimitUpdateInterval||.5;h=a.C.W.Ea(b.type);h=UA(a,b,e,h,g);if(!h)return a.j.presentationTimeline.isLive()||b.type===_.$e?a.g.bufferLimitUpdateInterval||1:(a.h.debug("Media state "+d+": no next segment found. Assuming EOS."),YA(a,b),null);
121
+ d=Infinity;l=_.u(a.a.values());for(m=l.next();!m.done;m=l.next())m=m.value,c(m)||(m=SA(a,m,e),d=Math.min(d,m));if(f>=d+a.j.presentationTimeline.a)return a.g.bufferLimitUpdateInterval||1;b.jh=0;ZA(a,b,e,g,h)["catch"](function(){});return null};YA=function(a,b){a.h.debug(MA(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.uf){var c=a.a.get(_.$e);c&&c.stream.mimeType==_.jc&&(c.endOfStream=!0)}};
122
+ SA=function(a,b,c){if(!b.Qb||!b.sa)return Math.max(c,b.jh);c=Kx(vA(a),b.Qb);return vA(a)[c].startTime+b.sa.endTime};
123
+ UA=function(a,b,c,d,e){if(b.stream.segmentLookupStrategy===aB)b.stream.segmentIterator?a=cy(b.stream.segmentIterator):b.sa||d?(e=b.sa?b.sa.endTime:d,a.h.info(uw,"looking up segment from new stream endTime:",e),b.stream.segmentIterator=gy(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value,null===d&&(b.stream.segmentIterator=null,a.h.warn(uw,Gw,"endTime:",e,b.sa)),a=d):(e=Math.max(c,0),a.h.info(uw,"looking up segment","lookupTime:",e,Pw,c),d=null,d||(b.stream.segmentIterator=gy(b.stream.segmentIndex,
124
+ c),d=b.stream.segmentIterator.next().value),null===d&&a.h.warn(uw,Gw,"lookupTime:",e,Pw,c),a=d);else{var f=MA(b);b.sa&&b.stream==b.Qb?(d=b.sa.position+1,a.h.debug(f,"next position known:","position\x3d"+d),a=bB(a,b,e,d)):(b.sa?(a.h.debug(f,"next position unknown: another Stream buffered"),c=Kx(vA(a),b.Qb),c=cB(a,b,vA(a)[c].startTime+b.sa.endTime,e)):(a.h.debug(f,"next position unknown: nothing buffered"),c=cB(a,b,d||c,e)),null==c?a=null:(f=null,null!=d||null!==a.g&&a.g.ignoreDrift||(f=bB(a,b,e,Math.max(0,
125
+ c-1))),a=f||bB(a,b,e,c)))}return a};cB=function(a,b,c,d){var e=MA(b);d=vA(a)[d];var f=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(f);a.h.debug(e,"Looked up segment:",Qw+c,"lookupTime\x3d"+f,Jw+d.startTime,"Result: segment position\x3d"+b);null==b&&a.h.warn(e,"cannot find segment:",Jw+d.startTime,"lookupTime\x3d"+f);return b};
126
+ bB=function(a,b,c,d){var e=MA(b);c=vA(a)[c];var f=b.stream.getSegmentReference(d);if(!f)return a.h.debug(e,"segment does not exist:",Jw+c.startTime,"position\x3d"+d),null;var g=a.j.presentationTimeline;d=_.Xx(g);g=Wx(g);return!b.Nd&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.h.debug(e,"segment is not available:",Jw+c.startTime,Tw+f.startTime,Rw+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
127
+ ZA=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,v,z,A,C;return _.G(function(F){f=_.io;g=MA(b);h=vA(a)[d];a.h.debug(g,"fetchAndAppend_:",Qw+c,Jw+h.startTime,Sw+e.position,Tw+e.startTime,Rw+e.endTime);l=b.stream;m=b.stream.segmentIterator;n=a.j.presentationTimeline.getDuration();p=vA(a)[d+1];q=Math.max(0,h.startTime-.1);t=p?p.startTime+.01:n;v=dB(a,b,d,q,t,e);b.$a=!0;b.sd=!1;a.h.debug(g,"fetching segment");z=!1;A=function(E,H){if(a.f||a.A)return null;z=!0;return eB(a,b,c,h,l,e,E,H)};C=a.C.W.Ea(b.type)||
128
+ 0;v.then(function(){return a.f||a.A?null:fB(a,b,e,!1,function(E){return A(E.data,!0)})}).then(function(E){return a.f||a.A?null:z||null===E?(gB(a,b,C,e,l),null):A(E,!1)}).then(function(){if(!a.f&&!a.A){gB(a,b,C,e,l);b.$a=!1;b.pf=!1;b.Hb||a.C.de();if(m){var E=m.next().value;E&&a.h.debug("New iterated segment",E)}DA(a,b,0);hB(a,b,l);a.h.debug(g,"finished fetch and append")}})["catch"](function(E){return _.G(function(H){if(a.f||a.A)return H["return"]();b.$a=!1;if(b.type==f.TEXT&&a.g.ignoreTextStreamFailures)return 1001==
129
+ E.code?a.h.warn(g,"Text stream failed to download. Proceeding without it."):a.h.warn(g,"Text stream failed to parse. Proceeding without it."),a.a["delete"](f.TEXT),H.G(0);if(7001==E.code)return b.$a=!1,b.sb=null,DA(a,b,0),H.G(0);if(3017===E.code)return iB(a,b,E),H.G(0);if(1001===E.code&&E.data&&404===E.data[1])return a.h.warn(g,"request for segment failed","segment not available on server",Sw+e.position,Tw+e.startTime,Rw+e.endTime,"error\x3d"+E),b.$a=!1,b.sb=null,DA(a,b,1),H.G(0);if(b.type===f.TEXT)return E instanceof
130
+ _.N&&E.a(1),FA(b),a.C.onError(new _.N(1,2,2010,E)),H.G(0);if(1001<=E.code&&1003>=E.code)return _.x(H,jB(a,b,h,E),0);a.h.error(g,"failed fetch and append: code\x3d"+E.code);b.Lc=!0;E instanceof _.N&&E.a(_.O);return _.x(H,kB(a,E),0)})});_.y(F)})};
131
+ iB=function(a,b,c){var d=MA(b);if(Array.from(a.a.values()).some(function(f){return f!=b&&f.pf}))a.h.debug(d,ww,"waiting for another stream to recover...");else{var e=Math.round(100*a.w);if(20<e)a.w-=.2;else if(4<e)a.w-=.04;else{a.h.error(d,"MediaSource threw QuotaExceededError too many times");b.Lc=!0;a.A=!0;a.C.onError(c);return}a.h.warn(d,ww,"reducing buffering goals by "+(100-Math.round(100*a.w))+"%");b.pf=!0}DA(a,b,4)};
132
+ jB=function(a,b,c,d){var e,f;return _.G(function(g){e=1001===d.code&&500<=d.data.status;f=!0;e||(f=!a.C.xe(b.stream,c));if(!f)return g.G(0);b.Lc=!0;d.a(_.O);return _.x(g,kB(a,d),0)})};
133
+ dB=function(a,b,c,d,e,f){c=vA(a)[c].startTime-f.Ba;if(!b.sd&&c===b.Gg)return Promise.resolve();b.Gg=c;var g=MA(b);a.h.debug(g,"setting timestamp offset to "+c);a.h.debug(g,"setting append window start to "+d);a.h.debug(g,"setting append window end to "+e);d=Ky(a.C.W,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.sd)return d;a.h.debug(g,"fetching init segment");e=fB(a,b,b.stream.initSegmentReference,!0).then(function(h){if(a.f)return null;a.h.debug(g,"appending init segment");return lB(a,h,b).then(function(){return Gy(a.C.W,
134
+ b.type,h,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(h){b.sd=!0;return Promise.reject(h)});return Promise.all([d,e])};lB=function(a,b,c){var d;return _.G(function(e){if(!a.g.patchEdgeWhenMixedContent||!_.Dj())return e.G(0);d=rA(b);return _.x(e,Gy(a.C.W,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
135
+ eB=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l,m,n,p,q,t,v,z,A;return _.G(function(C){switch(C.a){case 1:l=MA(b);if(!(e&&e.keyId&&a.C.hd)){C.G(2);break}m=bx(a.C.hd,e.keyId);if(!m){a.h.warn("Unable to find DRM session for "+e.keyId);C.G(2);break}_.B(C,4);return _.x(C,m,6);case 6:_.ag(C,2);break;case 4:n=_.D(C),a.h.warn("DRM session load failed!",n);case 2:if(!(e.encrypted&&e.keyId&&a.C.hd&&dx(a.C.hd,e.keyId))){C.G(7);break}FA(b);p=Kx(vA(a),e);q=mB(a,p);if(!q){C.G(8);break}return _.x(C,q,8);case 8:return t=
136
+ a.C.xe(e,d,Lw),v=f.startTime+d.startTime,z=f.endTime+d.startTime,a.h.warn(l,"Blocked append for "+v+" - "+z+": "+t+". Stream with Key ID "+(e.keyId+" has restrictions.")),C["return"](Promise.resolve());case 7:return A=e.closedCaptions&&0<e.closedCaptions.size,null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.ul).X("emsg",a.Yk.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),C["return"](nB(a,b,c).then(function(){if(a.f)return null;var F=f.startTime+d.startTime,E=f.endTime+d.startTime;a.h.debug(l,
137
+ "Appending segment with "+(F.toFixed(3)+" - "+E.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.ii(e.bandwidth)+" Fragment: ")+h);return Gy(a.C.W,b.type,g,F,E,A,e.id,h)}).then(function(){a.f||(a.h.debug(l,"appended media segment"),b.Qb=e,b.sa=f)}))}})};
138
+ gB=function(a,b,c,d,e){if(!a.j.presentationTimeline.isLive()&&b.type!==_.$e){var f=MA(b),g=(a.C.W.Ea(b.type)||0)-c,h=d.endTime-d.startTime;c=g-h;if(Math.abs(c)>=Math.min(.01,h)&&Math.abs(c)<=Math.min(1,h))for(a.h.debug(f,"Adjusted segment",d.position,"with real duration",g,"and accounted for",c,"delta between segment duration and real duration"),b.Nd=!0,a=vA(a),e.adjustSegmentDurations(d.position,c),d=Kx(a,e),b=a[d],e=e.getDuration(),Mx(b,e),e=d+1;e<a.length;e++)a[e].startTime+=c}};
139
+ oB=function(a,b,c){(new _.ul).L(_.Wd,_.vl).L(_.df,_.vl).L(_.Rd,_.vl).L(_.Vd,_.vl).L(_.Te,_.vl).X(_.Ve,_.wl).L("encv",function(d){d.reader.skip(78);_.vl(d)}).L(_.Oe,_.vl).L("schi",_.vl).L("tenc",function(d){d.reader.skip(6);if(_.ol(d.reader)){d.reader.skip(1);var e=_.qi(_.tl(d.reader,16));e!==b.stream.keyId&&(a.h.debug(MA(b),"Key id from tenc mismatches with key id from manifest. Switching from "+(b.stream.keyId+" to "+e+".")),b.stream.keyId=e)}d.parser.stop()}).parse(c)};
140
+ nB=function(a,b,c){if(a.f)return Promise.resolve();var d=MA(b);a.h.debug(d,"checking buffer length");var e=Math.max(a.g.bufferBehind,a.j.presentationTimeline.a),f=a.C.W.tb(b.type);if(null==f)return a.h.debug(d,"buffer behind okay because nothing buffered:",Qw+c,Dw+e),Promise.resolve();var g=c-f,h=g-e;if(.01>=h)return a.h.debug(d,"buffer behind okay:",Qw+c,Ew+g,Dw+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.h.debug(d,"buffer behind too large:",Qw+c,Ew+g,Dw+e,"overflow\x3d"+h);return a.C.W.remove(b.type,
141
+ f,f+h).then(function(){a.f||a.h.debug(d,"evicted "+h+" seconds")})};hB=function(a,b,c){if(!a.B){b=MA(b);var d=Array.from(a.a.values());1!=d.length||d[0].type!=_.$e?a.B=d.every(function(e){return e.type==_.$e||a.D?!0:!e.Hb&&!e.Zb&&e.sa}):a.D&&(a.B=!0);a.B&&(a.h.debug(b,"startup complete"),c=Kx(vA(a),c),mB(a,c))}};
142
+ mB=function(a,b){var c=null;a.l[b]||(c=XA(a,b).then(function(){a.f||(a.h.debug(Fw),a.C.bf())})["catch"](hx));for(var d=0;d<vA(a).length;++d)XA(a,d)["catch"](hx);a.C.Uk&&(a.h.debug("calling onStartupComplete()..."),a.C.Uk());return c};
143
+ pB=function(a,b){var c=MA(b),d=Kx(vA(a),b.stream);if(b.Bb!=d){var e=b.Bb,f=Array.from(a.a.values());f.every(function(g){return g.Bb==e})?f.every(NA)?(a.h.debug(c,"all need Period "+e),XA(a,e).then(function(){if(!a.f)if(f.every(function(n){var p=NA(n),q=Kx(vA(a),n.stream);return p&&n.Bb==e&&q!=e})){var g=vA(a)[e];a.h.debug(c,"Streaming period",e,g);a.h.debug(c,"calling onChooseStreams()...");var h=a.C.cf(g);a.D=!h.variant&&!!h.text;var l=new Map;h.variant&&h.variant.video&&l.set(_.uf,h.variant.video);
144
+ h.variant&&h.variant.audio&&l.set(_.rc,h.variant.audio);h.text&&l.set(_.$e,h.text);var m=_.u(a.a.keys());for(h=m.next();!h.done;h=m.next())if(h=h.value,!l.has(h)&&h!=_.$e){a.h.error(c,"invalid Streams chosen: missing "+h+" Stream");a.C.onError(new _.N(_.O,5,5005));return}m=_.u(Array.from(l.keys()));for(h=m.next();!h.done;h=m.next())if(h=h.value,!a.a.has(h))if(h==_.$e)WA(a,null,null,l.get(_.$e),g.startTime),l["delete"](h);else{a.h.error(c,"invalid Streams chosen: unusable "+h+" Stream");a.C.onError(new _.N(_.O,
145
+ 5,5005));return}g=_.u(Array.from(a.a.keys()));for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.IA(a,m,!1,0),DA(a,a.a.get(h),0)):a.a["delete"](h);a.h.debug(c,Fw);a.C.bf()}else a.h.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](hx)):a.h.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle"):a.h.debug(c,"not all MediaStates need Period "+e)}};BA=function(a,b){var c=Ix(vA(a),b+_.Dr);return c?vA(a).indexOf(c):0};
146
+ fB=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.Qx(c.Na(),c.ta,c.fa,a.g.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Ec?null:e;f.disableFragmentSupport=c.Ec||a.g.disableFragmentSupport;f.disableMergedFragments=a.g.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){oB(a,b,g.data)}),b.type===_.uf&&a.g.overridePasp&&f.responseModifiers.push(a.Ll.bind(a)));a.h.debug("fetching: reference\x3d",
147
+ c);c=a.C.Cb.fetch(f);b.Eb=c;return c.O.then(function(g){var h=a.C.Ke(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&h.segmentDownloaded(l,m);b.Eb=null;return g.data})};
148
+ PA=function(a,b,c,d){var e,f,g,h;return _.G(function(l){if(1==l.a)return e=MA(b),b.Hb=!1,b.ke=!1,b.Kd=0,b.Zb=!0,b.stream.segmentIterator=null,a.h.debug(e,"clearing buffer"),d?(g=a.C.yb(),h=a.C.W.getDuration(),f=a.C.W.remove(b.type,g+d,h)):f=a.C.W.clear(b.type).then(function(){return!a.f&&c?a.C.W.flush(b.type):null}),_.x(l,f,2);if(a.f)return l["return"]();a.h.debug(e,"cleared buffer");b.Qb=null;b.sa=null;b.Zb=!1;b.endOfStream=!1;b.Nd=!1;DA(a,b,0);_.y(l)})};
149
+ DA=function(a,b,c){a.h.debug(MA(b),"updating in "+c+" seconds");b.sb=(new _.xj(function(){var d;return _.G(function(e){if(1==e.a)return _.B(e,2),_.x(e,a.Db(b),4);if(2!=e.a)return _.ag(e,0);d=_.D(e);if(a.C)a.C.onError(d);_.y(e)})})).$(c)};FA=function(a){null!=a.sb&&(a.sb.stop(),a.sb=null)};vA=function(a){return a.j.adaptedPeriods||a.j.periods};GA=function(a){return _.G(function(b){return a.Eb?_.x(b,a.Eb.abort(),0):b.G(0)})};
150
+ kB=function(a,b){var c;return _.G(function(d){switch(d.a){case 1:if(a.f)return d["return"]();if(!a.C.nh){d.G(2);break}_.B(d,3);return _.x(d,a.C.nh(b),5);case 5:_.ag(d,2);break;case 3:c=_.D(d),c.cause=b,b=c;case 2:if(!b.f)a.C.onError(b);_.y(d)}})};MA=function(a){return"("+a.type+":"+a.stream.id+")"};NA=function(a){return!a.$a&&null==a.sb&&!a.Hb&&!a.Zb};
151
+ sB=function(a){_.Kk.call(this,Iw);var b=this;this.F=qB;this.j=this.Rb=this.ea=null;this.kf=0;this.dh=2;this.jd=null;this.Ye=!1;this.o=new _.Eg;this.tc=this.Vd=this.pc=this.zc=this.A=this.K=this.l=null;this.ed=!1;this.I=this.g=this.f=this.B=this.a=this.wc=this.H=null;this.rh=1E9;this.Xd=new Set;this.ca=!0;this.na=null;this.kh=!1;this.eh=0;this.ha=null;this.T=new Cz;this.oh={width:Infinity,height:Infinity};this.J=null;this.ma=_.Jn;this.xc=new Jz(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
152
+ this.configuration.preferredAudioChannelCount);this.Ra=this.configuration.preferredTextLanguage;this.V=this.yc=null;this.Ac=new Map;this.Da=null;this.vc=this.configuration.preferredTextRole;a&&a(this);this.$e=null;this.o.on(window,"online",function(){b.F===rB&&OA(b.a)});this.Zd=null};
153
+ tB=function(a){return new _.Dx(function(b){if(void 0===b||null===b)return null;var c=a.getTrackManager(),d=[];if(c){c=_.u(c.getVideoTracks());for(var e=c.next();!e.done;e=c.next())d.push.apply(d,_.Of(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
154
+ uB=function(a,b){if(a.ma!==b)if(a.ma===_.Un&&b!==_.Jn)a.log.info(_.yw+px(b,_.Sn));else{var c=a.kf;c=0===c?0:Date.now()-c;var d=a.ma;a.ma=b;a.kf=Date.now();a.J&&_.zn(a.J.a,a.ma);b===_.On&&(a.dh=a.Ve?1:2);var e=a.dh,f={currentState:a.ma,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.On||d===_.On?e:void 0};a.log.info(_.jb+px(d,_.Sn)+" -\x3e "+(px(b,_.Sn)+(b!==_.On?"":"["+px(e,_.Rn)+"]")));a.trigger(new _.L(_.Re,{detail:f}));(b===_.Qn||b===_.Un)&&a.tc&&a.tc.stop();b===_.On?a.trigger(new _.L(_.Bc,
155
+ {detail:{bufferedTimeMS:-1,reason:e}})):d===_.On&&a.trigger(new _.L(_.Ac,{detail:{bufferedTimeMS:c,reason:e}}))}};AB=function(a){var b=!1;b=void 0===b?!0:b;var c,d;return _.G(function(e){switch(e.a){case 1:return a.F===vB?e["return"](Promise.reject(new _.N(_.O,7,7E3))):_.x(e,wB(a),2);case 2:return _.x(e,xB(a),3);case 3:c=_.Mi(4)||_.Mi(5);if(!b&&!c){e.G(0);break}d=a.getSurface().getMedia();return _.x(e,yB(a,d),5);case 5:return _.x(e,zB(a,d),0)}})};
156
+ HB=function(a,b,c){c=void 0===c?!0:c;var d,e,f,g,h,l,m,n;return _.G(function(p){switch(p.a){case 1:if(a.F===vB)return p["return"](Promise.reject(new _.N(_.O,7,7E3)));d=new _.Fi;e=function(){return a.Rb!==d};f=function(){a.log.info("Aborting current load");throw new _.N(_.O,7,7E3);};a.Rb=d;_.B(p,2);e()&&f();if(!a.ea){p.G(4);break}_.B(p,5);return _.x(p,a.ea,7);case 7:_.ag(p,6,2);break;case 5:_.D(p,2);case 6:e()&&f();case 4:return a.J=new _.En,a.$e=Date.now()/1E3,uB(a,_.Vn),a.w=_.ao(b),_.Jk(b)&&(a.configuration=
157
+ _.Ik(a.Pd,b)),a.log.info(_.Wa,a.configuration),a.log.info(_.ib,a.w),(g=a.getTrackManager())&&g.load(),h=a.getSurface().getMedia(),h.loop=!!a.configuration.loop,_.M.R(a.configuration.volume)||a.setVolume(a.configuration.volume),_.M.R(a.configuration.muted)||a.setMuted(a.configuration.muted),BB(a),a.I&&(a.I.release(),a.I=null),a.I=new _.Zq(a.getNetworkEngine()),fx(a.I,{enabled:a.configuration.abr.useCmsd}),l=a.w[a.getSourceIndex()],e()&&f(),_.x(p,yB(a,h),8);case 8:return e()&&f(),_.x(p,zB(a,h),9);case 9:return e()&&
158
+ f(),_.x(p,CB(a,l),10);case 10:return _.wm(Nw),e()&&f(),_.x(p,DB(a,l),11);case 11:return _.wm(Mw),performance.measure("Fetch and parse manifest",Nw,Mw),e()&&f(),_.x(p,EB(a),12);case 12:_.wm("initDrm.end");performance.measure("Init DRM",Mw,"initDrm.end");if(!c){p.G(13);break}e()&&f();return _.x(p,FB(a),14);case 14:return e()&&f(),_.x(p,GB(a),13);case 13:e()&&f();d.resolve();_.ag(p,0);break;case 2:throw n=m=_.D(p),e()&&(n=new _.N(_.O,7,7E3)),d.reject(n),a.onError(n),n;}})};
159
+ yB=function(a,b){a.j||(a.o.on(b,_.yd,function(){if(a.j.error){var c=a.j.error.code;if(1==c)c=null;else{var d=a.j.error.msExtendedCode;d&&(0>d&&(d+=Math.pow(2,32)),d=d.toString(16));c=new _.N(_.O,3,3016,{code:c,extendedError:d,message:a.j.error.message})}}else c=null;if(c)a.onError(c)}),a.j=b);return Promise.resolve()};xB=function(a){a.j&&(a.o.off(a.j,_.yd),a.j=null);return Promise.resolve()};
160
+ wB=function(a){var b;return _.G(function(c){switch(c.a){case 1:a.F!==vB&&(a.F=qB);if(b=a.j)a.o.off(b,_.Nd),a.o.off(b,_.ve),a.o.off(b,_.ke),a.o.off(b,_.xd),a.o.off(b,_.Ee),a.o.off(b,_.Ce);a.zc&&(a.zc.release(),a.zc=null);a.tc&&(a.tc.stop(),a.tc=null);if(!a.B){c.G(2);break}return _.x(c,a.B.stop(),3);case 3:a.B=null;case 2:if(!a.g){c.G(4);break}return _.x(c,a.g.stop(),4);case 4:if(!a.a){c.G(6);break}return _.x(c,a.a.destroy(),7);case 7:a.a=null;case 6:a.A&&(a.A.release(),a.A=null);if(!a.K){c.G(8);break}return _.x(c,
161
+ a.K.destroy(),9);case 9:a.K=null;case 8:a.Vd&&(a.Vd.release(),a.Vd=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.l){c.G(10);break}return _.x(c,a.l.destroy(),11);case 11:a.l=null;case 10:a.I&&(a.I.release(),a.I=null),a.T.clear(),a.H=null,a.Xd.clear(),a.f=null,a.J=null,a.ca=!0,a.Ac.clear(),a.ed=!1,IB(a),_.y(c)}})};
162
+ zB=function(a,b){var c,d,e;return _.G(function(f){if(1==f.a)return c=window.muxjs?new sy:new _.ty,d=_.xn(a.configuration,[_.Dd,"single-native"]),a.M=d.create(a),a.jd=tB(a),a.jd.track(a),e=new _.vy(b,c,a.M,a.jd,a.configuration),_.x(f,e.I,2);a.K=e;_.y(f)})};CB=function(a,b){var c,d;return _.G(function(e){if(1==e.a)return c=a.getNetworkEngine(),d=a,_.x(e,_.Gq(b.url,c,a.configuration.manifest.attemptParameters,b.type||null),2);d.B=e.f;a.B.configure(a.configuration.manifest);_.y(e)})};
163
+ DB=function(a,b){var c;return _.G(function(d){a.wc=new $x;ay(a.wc,function(e){JB(a,_.Pg,e)});c=new _.Gi(Promise.resolve().then(function(){var e,f,g;return _.G(function(h){switch(h.a){case 1:if(a.f){h.G(3);break}_.B(h,4);e=a;return _.x(h,a.B.start(b.url,KB(a)),6);case 6:e.f=h.f;_.ag(h,1);break;case 4:f=_.D(h);if(!a.uc)throw f;return _.x(h,a.uc(b.url,f),8);case 8:if(g=h.f)b.url=g;else throw f;h.G(1);break;case 3:!a.f.presentationTimeline||a.configuration.manifest.hlsLowLatency||_.M.R(a.configuration.suggestedPresentationDelay)||
164
+ isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.F=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.H=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.N(_.O,4,4014);LB(a.f.periods);_.y(h)}})}),function(){a.log.info("Aborting parser step...");return a.B.stop()});return _.x(d,c.O,0)})};
165
+ EB=function(a){var b,c,d,e,f;return _.G(function(g){switch(g.a){case 1:a.l=new _.Bm({Cb:a.getNetworkEngine(),onError:function(h){return a.onError(h)},ef:function(h){if(a.a){var l=MB(a),m=!1,n=Object.keys(h);0===n.length&&a.log.warn("Got a key status event without any key statuses, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");var p=1===n.length&&"00"===n[0];p&&a.log.warn("Got a synthetic key status event, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");
166
+ if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var t=n[q],v=_.u(t.variants),z=v.next();!z.done;z=v.next()){z=z.value;var A=[];z.audio&&A.push(z.audio);z.video&&A.push(z.video);A=_.u(A);for(var C=A.next();!C.done;C=A.next()){C=C.value;var F=z.allowedByKeySystem;if(C.keyId){var E=h[p?"00":C.keyId];E=!!E&&!NB.includes(E);z.allowedByKeySystem=E}F!==z.allowedByKeySystem&&(E=C.type,C.type===_.uf&&(E="video "+C.width+"x"+C.height+"@"+_.ii(C.bandwidth)),a.log.warn("DRM Key not available for KID: '"+
167
+ (C.keyId+"'. Applying restrictions to "+E)));t===l&&F!==z.allowedByKeySystem&&(m=!0)}}}if(h=wA(a.a))if(p=yA(a.a),n=zA(a.a),p=ez(p,n,h.variants),!p||p.allowedByKeySystem)a.log.info(tw),OB(a),PB(a,h.variants);m&&h!==l&&(a.log.info(tw),OB(a),PB(a,l.variants))}},onExpirationUpdated:function(h,l){if(a.B&&a.B.onExpirationUpdated)a.B.onExpirationUpdated(h,l);a.trigger(new _.L(_.pd,{expirationTime:l}))},onEvent:function(h){return a.De(h)},getConfiguration:function(){return a.getConfiguration()},Jc:function(){return a.Jc()}});
168
+ QB(a);c=(b=a.configuration.drm)?b.offlineId||"":"";d=[];e=_.zq(a.f.periods);if(!c){g.G(2);break}f=_.Mk(_.le);if(!f){g.G(2);break}return _.x(g,f.l(a,e),4);case 4:return _.x(g,f.j(c),5);case 5:d=g.f;case 2:return _.x(g,_.Gm(a.l,e,d),6);case 6:a.f&&RB(a,a.f.periods),_.y(g)}})};
169
+ FB=function(a){var b,c,d,e;return _.G(function(f){if(1==f.a)return b=a.j,c=function(g){a.j&&a.H&&(g.type===_.Me&&a.$d?(a.H.a=Oz,IB(a)):g.type===_.Cf&&a.getState()===_.Xn&&.1>a.getBufferInfo().Ja(a.getPosition())?(a.H.a=Oz,IB(a)):a.H&&SB(a));TB(a)},d=function(){if(a.j){var g=a.j.playbackRate;0!=g&&a.pc.set(g)}},a.o.on(b,_.ve,c),a.o.on(b,_.ke,c),a.o.on(b,_.xd,c),a.o.on(b,_.Me,c),a.o.on(b,_.Le,c),a.o.on(b,_.Ce,c),a.o.on(b,_.Cf,c),a.o.on(b,_.Ee,d),a.g||(a.g=new _.Az,a.g.configure(a.configuration.abr)),
170
+ null!==a.I&&a.g.setCmsdManager(a.I),UB(a,a.f.periods),a.xc=new Jz(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount),a.Ra=a.configuration.preferredTextLanguage,a.vc=a.configuration.preferredTextRole,_.x(f,_.Tm(a.l,b),2);if(!a.l)throw new _.N(_.O,7,7001);a.g.init(function(g,h,l){!a.ca&&VB(a,g,h,l)});a.A=WB(a,a.configuration.startTime);a.zc=XB(a);a.pc=new Uz({Me:function(){return b.playbackRate},lh:function(g){b.playbackRate=g},
171
+ ek:function(g){b.currentTime+=g}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.Vd=new Rz(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);YB(a,e);Uy(a.f,_.Tg(a.configuration.preferredVideoCodec),_.Tg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=ZB(a);a.a.g=a.configuration.streaming;a.F=rB;_.y(f)})};
172
+ GB=function(a){var b,c,d,e,f,g,h;return _.G(function(l){if(1==l.a)return _.x(l,a.a.start(),2);if(!a.a)throw new _.N(_.O,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(b=oA(a.A),c=$B(a,b),hA(a.A.f,c));d=_.u(a.f.periods);for(e=d.next();!e.done;e=d.next())f=e.value,aC(a,f);OB(a);g=MB(a)||a.f.periods[0];h=g.variants.some(function(m){return m.primary});a.configuration.preferredAudioLanguage||h||a.log.warn("No preferred audio language set. We will choose an arbitrary language initially");PB(a,
173
+ g.variants);a.o.one(a.j,_.Nd,function(){a.J.A=Date.now()/1E3-(null===a.$e?0:a.$e)});_.y(l)})};LB=function(a){function b(d){return d.video&&d.audio||d.video&&d.video.codecs.includes(",")}if(a.some(function(d){return d.variants.some(b)})){_.ug("Found variant with audio and video content, so filtering out audio-only content in all periods.");a=_.u(a);for(var c=a.next();!c.done;c=a.next())c=c.value,c.variants=c.variants.filter(b)}};
174
+ WB=function(a,b){return new mA(a.j,a.f,a.configuration.streaming,b,function(){a.zc&&hy(a.zc,!0);a.a&&LA(a.a)},function(c){return a.dispatchEvent(c)})};XB=function(a){var b=new Sz(a.f);Tz(b,function(){OB(a)});var c=new jy(a.wc);ky(c,function(e){e.ce&&e.ce();JB(a,_.Rg,e)},function(e){e.df&&e.df();JB(a,_.Sg,e)},function(e,f){f||(e.ce&&e.ce(),JB(a,_.Rg,e),e.df&&e.df(),JB(a,_.Sg,e))});var d=new iy(a.j);d.a.add(b);d.a.add(c);return d};
175
+ YB=function(a,b){a.H=new Pz(b,Math.min(.5,b/2));a.H.a=Oz;IB(a);a.tc=(new _.zj(function(){SB(a)})).eb(.25)};
176
+ SB=function(a){switch(a.F){case rB:a:if(a.j.ended||By(a.K))var b=!0;else{if(a.isLive()){b=Wx(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.Ea(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.K){var d=Dy(a.K);c=d.video;d=d.audio;var e=a.j.currentTime;c&&d?(c=c.Ja(e),d=d.Ja(e),c=Math.min(c,d)):c=c?c.Ja(e):d?d.Ja(e):0}else c=0;if(d=a.H){d=a.H;var f=b,g=d.f.get(d.a);e=d.a;c=f||c>=g?Nz:Oz;d.a=c;d=e!=c}c=d;d=bC(a);c||a.getState()===_.On&&!d?(a.log.debug("Buffering state changed. Is buffering",
177
+ d,"buffered to end",b,"state",a.getState()),IB(a)):a.ed&&TB(a)};ZB=function(a){var b={yb:function(){return oA(a.A)},W:a.K,Cb:a.getNetworkEngine(),cf:a.Bi.bind(a),bf:a.Ai.bind(a),onError:a.onError.bind(a),Ng:a.Ck.bind(a),onEvent:a.De.bind(a),Sg:a.Ci.bind(a),de:a.Pk.bind(a),Ke:function(){return a.g},xe:a.Jh.bind(a),nh:a.Gl.bind(a),hd:a.l};return new _.uA(a.f,b)};QB=function(a){var b=_.el(a.configuration.drm);a.l.g=b};
178
+ BB=function(a){a.B&&a.B.configure(a.configuration.manifest);a.l&&QB(a);if(a.a){a.a.g=a.configuration.streaming;try{for(var b=_.u(a.f.periods),c=b.next();!c.done;c=b.next())aC(a,c.value)}catch(e){a.onError(e)}c=yA(a.a);var d=zA(a.a);b=MB(a)||a.f.periods[0];c=ez(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?PB(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),cC(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.ca?a.g.enable():
179
+ a.g.disable())};tz=function(a){if(a.f&&a.A){var b=dC(a),c=[];a=_.u(eC(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=$y(d);e.active=d==b;c.push(e)}return c}return[]};rz=function(a,b){if(a.f&&a.a){var c=MB(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(fC(a,c,d,!1),gC(a,d),a.Ra=d.language):a.log.error(_.xw,b.id)}};
180
+ uz=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=MB(a);if(a.configuration.abr.enabled&&b)a.log.info("Disable ABR and enable manual track selection to select "+(b.width+"x"+b.height+"@"+b.bandwidth)),a.configuration.abr.enabled=!1,a.g.disable();else if(!a.configuration.abr.enabled&&!b){a.log.info("Enable ABR Selection");a.configuration.abr.enabled=!0;a.g.enable();a.V=null;c=PB(a,e.variants);null!=a.Da&&(a.xc=a.Da,a.Da=null);null==c||a.ca||VB(a,c);return}if(b){a.V=b.id;var f=e.variants.find(function(g){return g.id==
181
+ b.id});f?(a.V=f.video.id,bz(f)?(hC(a,e,f,!1),iC(a,f,c,d),null==a.Da&&(a.Da=a.xc),a.xc=new Kz(f),PB(a,e.variants)):a.log.error("Unable to switch to restricted track",b.id)):a.log.error("No variant with id",b.id)}else a.V=null,null!=a.Da&&(a.xc=a.Da,a.Da=null),c=PB(a,e.variants),null==c||a.ca||VB(a,c)}};
182
+ sz=function(a,b){if(a.configuration.streaming.disableAudioTracks)Promise.reject(Error("Audio tracks are disabled by config."));else{if(a.a&&(a.f||a.A)){var c=zA(a.a),d=yA(a.a),e=Ix(a.f.periods,oA(a.A)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id===b&&bz(m)});e=!1;var g=void 0;if(c){if(g=f.find(function(m){return m.video.id===c.id}),!g){a.log.debug("Cannot find exact variant, looking for anything else that matches with given audioId");e=!0;var h=a.getTrackManager().Oa();
183
+ if(h){var l=h.renditions.map(function(m){return m.id});g=f.find(function(m){return l.find(function(n){return n===String(m.video.id)})})}}}else g=f[0];if(g){if(d.codecs.split(".")[0]===g.audio.codecs.split(".")[0]){d=g.audio;a.yc=d.id;a.g.setVariants(f);f=MB(a);hC(a,f,g,!1);e||a.ca?iC(a,g,!0,0):_.IA(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()}};
184
+ vz=function(a){var b=a.Ye;return a.f?a.K.getTextDisplayer().isTextVisible():b};qz=function(a,b){var c,d,e,f;return _.G(function(g){c=a.Ye;d=b;if(c==d)return g["return"]();a.Ye=d;if(a.F!==rB)return g.G(0);a.K.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.G(0);if(!b)return HA(a.a),g.G(0);e=MB(a);f=_.dz(e.textStreams,a.Ra,a.vc);return 0<f.length?_.x(g,EA(a.a,f[0]),0):g.G(0)})};
185
+ hC=function(a,b,c,d){var e=a.getTrackManager();a.B.setCurrentVariant(c);if(e){var f=a.J.B;if(c.video){yz(e,c.video,d);var g=e.ga();f.j!==g&&(f.j=g,f.a.push({timestamp:Date.now()/1E3,id:g.id,trackId:g.track.id,type:g.track.type,fromAdaptation:d,width:g.width,height:g.height,bandwidth:g.bandwidth}))}c.audio&&(yz(e,c.audio,d),e=e.La(),f.f!==e&&(f.f=e,f.a.push({timestamp:Date.now()/1E3,id:e.id,trackId:e.track.id,type:e.track.type,fromAdaptation:d,width:null,height:null,bandwidth:e.bandwidth})))}Ez(a.T,
186
+ b).variant=c};fC=function(a,b,c,d){Ez(a.T,b).text=c;if(b=a.getTrackManager())yz(b,c,d),c=b.Ma(),a=a.J.B,a.g!==c&&(a.g=c,a.a.push({timestamp:Date.now()/1E3,id:c.id,trackId:c.track.id,type:c.track.type,fromAdaptation:d,width:null,height:null,bandwidth:null}))};
187
+ UB=function(a,b){for(var c=0;c<b.length;c++){for(var d=b[c],e=new Map,f=_.u(d.variants),g=f.next();!g.done;g=f.next())if(g=g.value,g.video&&g.video.closedCaptions){g=g.video;for(var h=_.u(g.closedCaptions.keys()),l=h.next();!l.done;l=h.next())if(l=l.value,!e.has(l)){var m={id:a.rh++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,Ba:0,mimeType:_.jc,codecs:"",kind:_.Hw,encrypted:!1,
188
+ keyId:null,language:g.closedCaptions.get(l),label:null,type:_.$e,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,closedCaptions:null};e.set(l,m)}}e=_.u(e.values());for(f=e.next();!f.done;f=e.next())d.textStreams.push(f.value)}};
189
+ RB=function(a,b){for(var c=a.a?yA(a.a):null,d=a.a?zA(a.a):null,e=_.u(b),f=e.next();!f.done;f=e.next())Zy(a.l,c,d,f.value);c=sx(b,function(h){return h.variants.some(bz)});if(a.configuration.streaming.disableAudioTracks)for(d=_.u(b),e=d.next();!e.done;e=d.next())for(f=_.u(e.value.variants),e=f.next();!e.done;e=f.next())delete e.value.audio;if(a.configuration.streaming.disableVideoTracks)for(d=_.u(b),e=d.next();!e.done;e=d.next())for(f=_.u(e.value.variants),e=f.next();!e.done;e=f.next()){e=e.value;var g=
190
+ e.video;!g||1<yx(g.type,_.wj(g.mimeType,g.codecs)).size||delete e.video}if(0===c)throw new _.N(_.O,4,4032);if(c<b.length)throw new _.N(_.O,4,4011);c=_.u(b);for(e=c.next();!e.done;e=c.next())d=e.value,Wy(d.variants,a.configuration.restrictions,a.oh)&&a.a&&MB(a)==d&&OB(a),jC(a,d.variants)};
191
+ aC=function(a,b){var c=a.a?yA(a.a):null,d=a.a?zA(a.a):null;Zy(a.l,c,d,b);d=b.variants;if(!d.some(bz))throw new _.N(_.O,4,4011);jC(a,b.variants);Wy(d,a.configuration.restrictions,a.oh)&&a.a&&MB(a)==b&&OB(a);if(!_.Mi(2)&&(c=a.l?a.l.getDrmInfo():null)){d=_.u(d);for(var e=d.next();!e.done;e=d.next()){e=_.u(e.value.drmInfos);for(var f=e.next();!f.done;f=e.next())if(f=f.value,f.keySystem===c.keySystem){f=_.u(f.initData||[]);for(var g=f.next();!g.done;g=f.next())g=g.value,_.Wm(a.l,g.keyId,g.initData)||_.Nm(a.l,
192
+ g.initDataType,g.initData,g.keyId)}}}};iC=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.ca?(a.na=b,a.kh=c,a.eh=d):JA(a.a,b,c,d)};gC=function(a,b){a.ca?a.ha=b:_.IA(a.a,b,!0,0)};kC=function(a){if(a.a&&a.f){var b=wA(a.a),c=MB(a);null!=b&&b==c&&(yA(a.a),zA(a.a),_.xA(a.a,_.$e),Ez(a.T,c),Ez(a.T,c))}};
193
+ $B=function(a,b){function c(g,h){if(!g)return null;var l=g.findSegmentPosition(h-f.startTime);return null==l?null:(l=g.getSegmentReference(l))?l.startTime+f.startTime:null}var d=yA(a.a),e=zA(a.a),f=MB(a);d=c(d,b);e=c(e,b);return null!=e&&null!=d?Math.max(e,d):null!=e?e:null!=d?d:b};bC=function(a){return a.l&&a.l.D?!0:a.H?a.H.getState()===Oz:!1};IB=function(a){if(a.J&&a.H&&a.A){var b=lC(a)===_.On,c=a.pc;c.j=b;Vz(c);a.A.j.o=b;TB(a)}};TB=function(a){uB(a,lC(a))};
194
+ lC=function(a){var b=a.getDuration(),c=a.getPosition();return a.j&&a.j.ended||(a.ed||a.ma===_.Qn)&&1>=Math.abs(b-c)?_.Qn:bC(a)||a.$d?_.On:a.j&&a.j.paused?_.Wn:_.Xn};
195
+ PB=function(a,b){try{jC(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return bz(e)});c=iz(c,a.yc);var d=a.xc.create(c);d=Array.from(d.values());a.g.setVariants(d);if(null!==a.V&&null!==a.yc&&(d=d.find(function(e){return e.video.id==a.V&&e.audio.id==a.yc}),a.V=null,d))return d;if(a.configuration.abr.enabled||null===a.V)return a.g.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.V});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
196
+ a.g.chooseVariant())};cC=function(a,b,c){c=void 0===c?!0:c;var d=PB(a,b.variants);a.yc=d&&d.audio&&d.audio.id;d&&(hC(a,b,d,!0),iC(a,d,c));(c=_.dz(b.textStreams,a.Ra,a.vc)[0]||null)&&(a.configuration.streaming.alwaysStreamText||vz(a))&&(fC(a,b,c,!0),gC(a,c))};
197
+ oC=function(a,b){a.ca=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");var c=PB(a,b.variants),d=_.dz(b.textStreams,a.Ra,a.vc)[0]||null;a.na&&(b.variants.includes(a.na)&&(c=a.na),a.na=null);a.ha&&(b.textStreams.includes(a.ha)&&(d=a.ha),a.ha=null);c&&mC(a,b,function(){return hC(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||vz(a))&&mC(a,b,function(){return fC(a,b,d,!0)});b===MB(a)&&nC(a);return a.configuration.streaming.alwaysStreamText||vz(a)?{variant:c,text:d}:
198
+ {variant:c,text:null}};VB=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;if(a.configuration.abr.enabled){a.log.debug("switch_");var e=pC(a,b);mC(a,e,function(){return hC(a,e,b,!0)});e===MB(a)&&nC(a);a.a&&JA(a.a,b,c,d)}};OB=function(a){var b=a.getTrackManager();b&&a.F!==vB&&(b.m&&(xz(b),b.m.trigger(new _.L(_.Ir))),nC(a))};nC=function(a){var b=MB(a);if(b){var c=a.Ac.get(b)||[];for(a.Ac["delete"](b);c.length;)c.shift()()}};mC=function(a,b,c){a.Ac.has(b)||a.Ac.set(b,[]);a.Ac.get(b).push(c)};
199
+ JB=function(a,b,c){a.trigger(new _.L(b,{detail:{schemeIdUri:c.schemeIdUri,value:c.value,startTime:c.startTime,endTime:c.endTime,id:c.id,eventElement:c.eventElement,type:c.type}}))};
200
+ jC=function(a,b){var c=a.l?_.M.Gf(a.l.ma):{},d=Object.keys(c);d=d.length&&"00"==d[0];for(var e=!1,f=!1,g=[],h=[],l=_.u(b),m=l.next();!m.done;m=l.next()){m=m.value;var n=[];m.audio&&n.push(m.audio);m.video&&n.push(m.video);n=_.u(n);for(var p=n.next();!p.done;p=n.next())if(p=p.value,p.keyId){var q=c[d?"00":p.keyId];q?NB.includes(q)&&(h.includes(q)||h.push(q)):g.includes(p.keyId)||g.push(p.keyId)}m.allowedByApplication?m.allowedByKeySystem&&(e=!0):f=!0}if(!e)throw new _.N(_.O,4,4012,{hasAppRestrictions:f,
201
+ missingKeys:g,restrictedKeyStatuses:h});};eC=function(a){var b=MB(a);if(null==b)return[];kC(a);return b.variants.filter(function(c){return bz(c)})};qC=function(a){var b=MB(a);if(null==b)return[];kC(a);return b.textStreams.filter(function(c){return!a.Xd.has(c)})};MB=function(a){var b=oA(a.A),c=null;a=_.u(a.f.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c};dC=function(a){var b=MB(a);return b&&Ez(a.T,b).variant};
202
+ pC=function(a,b){for(var c=_.u(a.f.periods),d=c.next();!d.done;d=c.next())if(d=d.value,d.variants.includes(b))return d;return null};
203
+ rC=function(a,b,c){var d,e,f,g,h,l,m,n,p,q,t,v,z,A,C,F,E,H,Q;return _.G(function(P){switch(P.a){case 1:return d=_.io,_.B(P,2),_.x(P,_.Gq(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null),4);case 4:return e=P.f,e.configure(a.configuration.manifest),_.x(P,e.start(b.url,KB(a)),5);case 5:f=P.f;LB(f.periods);if(!f.periods.length)throw new _.N(_.O,4,4014);return _.x(P,a.B.stop(),6);case 6:a.B=e;g=c.audio&&c.audio.id;h=c.video&&c.video.id;a.f.periods=f.periods;l=Ix(f.periods,
204
+ oA(a.A))||f.periods[0];Uy(a.f,_.Tg(a.configuration.preferredVideoCodec),_.Tg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=jz(g,h,l.variants);n=_.dz(l.textStreams,a.Ra,a.vc)[0]||null;PB(a,l.variants);p=m&&m.video;q=m&&m.audio;t=[];v=new Set;z=_.u(l.variants);for(A=z.next();!A.done;A=z.next())C=A.value,C.video&&v.add(C.video),C.audio&&v.add(C.audio);F=_.u(_.Of(v).concat(_.Of(l.textStreams)));for(E=F.next();!E.done;E=F.next())H=E.value,t.push(H.createSegmentIndex());
205
+ return _.x(P,Promise.all(t),7);case 7:RA(a.a,d.AUDIO,q);RA(a.a,d.VIDEO,p);RA(a.a,d.TEXT,n);m&&hC(a,l,m,!1);a.log.info("Switch CDN successful.");_.ag(P,0);break;case 2:Q=_.D(P);if(!e){P.G(8);break}return _.x(P,e.stop(),8);case 8:throw Q;}})};
206
+ KB=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return aC(a,b)},filterAllPeriods:function(b){return RB(a,b)},onTimelineCueAdded:function(b){var c=a.wc;a:{var d=_.u(c.a);for(var e=d.next();!e.done;e=d.next())if(e=e.value,e.schemeIdUri===b.schemeIdUri&&e.startTime===b.startTime&&e.endTime===b.endTime){d=e;break a}d=null}null==d&&(c.a.add(b),c.f(b))},onEvent:function(b){return a.De(b)},onError:function(b){return a.onError(b)}}};sC=function(){};
207
+ tC=function(){var a=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];c=a.apply(this,c);c.abort=function(){};return c}};uC=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};vC=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
208
+ wC=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.Ax(b)[0]&&a(b)}};
209
+ xC=function(){var a=MediaSource.isTypeSupported,b=/^dv(?:h[e1]|a[v1])\./;MediaSource.isTypeSupported=function(c){var d=c.split(/ *; */),e=d.shift(),f={};d=_.u(d);for(var g=d.next();!g.done;g=d.next())g=g.value.split("\x3d"),f[g[0]]=g[1].replace(/"(.*)"/,"$1");d=f.codecs;if(!d)return a(c);var h=!1,l=!1;c=d.split(",").filter(function(n){b.test(n)&&(l=!0);/^(hev|hvc)1\.2/.test(n)&&(h=!0);return!0});l&&(h=!1);f.codecs=c.join(",");h&&(f.eotf="smpte2084");for(var m in f)e+="; "+m+'\x3d"'+f[m]+'"';return cast.__platform__.canDisplayType(e)}};
210
+ yC=function(a){_.pr.call(this,a);a=a.getSurface().getMedia();this.a=null;for(var b=0;b<a.textTracks.length;++b){var c=a.textTracks[b];c.mode=_.fd;c.label===zw&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.Uw,zw));this.a.mode=_.Cd};zC=function(a,b){var c=a.mode;a.mode=c==_.Ne?_.Ne:_.Cd;for(var d=a.cues,e=d.length-1;0<=e;e--){var f=d[e];f&&b(f)&&a.removeCue(f)}a.mode=c};AC=function(){};Yw=[112,115,115,104,0,0,0,0];_.kx.prototype.f=function(){return this.keyInfo};_.lx.prototype.getPosition=function(){return this.position};
211
+ _.lx.prototype.f=function(){return this.keyInfo};_.CC=function BC(a){var c,d,e,f,g,h;return _.ig(BC,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.u(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.G(0):_.x(l,{Oe:c,ll:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{Oe:c,item:e,ll:d,next:h},5):l.G(5)}c++;d=e;e=h;g=f.next();return l.G(2)})};ux.prototype.destroy=function(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()};
212
+ ux.prototype.A=function(a){this.g=a.captions;var b=new Uint8Array(a.data.byteLength+a.initSegment.byteLength);b.set(a.initSegment,0);b.set(a.data,a.initSegment.byteLength);a.type===_.uf?this.o.push(b):a.type===_.rc&&this.l.push(b)};ux.prototype.w=function(){var a={video:_.si.apply(_.li,_.Of(this.o)),captions:this.g,audio:_.si.apply(_.li,_.Of(this.l))};this.f.resolve(a);this.j=!1};
213
+ _.Dx.prototype.track=function(a){null!=this.player&&(this.player&&(this.player.off(_.Je,this.a),this.f&&this.player.off(_.cf,this.a)),this.player=null);a&&(this.player=a,this.player.on(_.Je,this.a,this))};
214
+ _.Dx.prototype.append=function(a,b,c){var d=this.j?this.j(c):null;d||this.log.debug("Unable to resolve rendition for id",c);c={start:a,end:b,rendition:d,width:d?d.width:0,height:d?d.height:0,bandwidth:d?d.bandwidth:0};var e=this.S.find(function(f){return f.start>=a&&f.end<=b});if(e)e.rendition=d,e.width=c.width,e.height=c.height,e.bandwidth=c.bandwidth,e.start=c.start,e.end=c.end;else{d=_.u(this.S);for(e=d.next();!e.done;e=d.next())e=e.value,a>=e.start&&a<e.end?e.end=a:b>=e.start&&b<e.end&&(e.start=
215
+ b);this.S.push(c);this.S.sort(Cx)}Gx(this);this.a();this.player&&this.player.trigger(new _.L(_.xf))};_.Dx.prototype.clear=function(){this.S=[];Gx(this);this.player&&(this.player.trigger(new _.L(_.xf)),this.player.trigger(new _.L(_.wc)))};
216
+ _.Dx.prototype.a=function(){if(this.player){var a=this.player.getPosition();if(0<=a){a:{for(var b=this.S.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.S[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.S[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.S[0].rendition:null}if(a&&this.g!==a&&(this.g=a,this.player)){c=b=-1;if(a)b=a.width||-1,c=a.height||-1;else if(d=this.player.getSurface().getMedia())b=d.videoWidth,c=d.videoHeight;this.player.trigger(new _.L(_.yc,
217
+ {detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};_.r=_.Rx.prototype;_.r.Kc=function(){return this.I};_.r.getDuration=function(){return this.f};_.r.getPresentationStartTime=function(){return this.A};_.r.offset=function(a){null!=this.o&&(this.o+=a);null!=this.g&&(this.g+=a)};_.r.isLive=function(){return Infinity==this.f&&!this.j};$x.prototype.release=function(){this.f=function(){};this.a.clear()};$x.prototype.cues=function(){return this.a};
218
+ by.prototype.next=function(){var a=this.g.get(this.a);a&&0<a.a.length?(this.f+=1,a.Na().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=cy(this);return{value:a,done:!a}};_.r=_.dy.prototype;_.r.destroy=function(){this.a=[];return Promise.resolve()};
219
+ _.r.Cc=function(a){for(var b=this.a.length-1;0<=b;--b){var c=this.a[b];if(a>=c.startTime&&a<c.endTime)return c.position}if(this.a.length&&a<this.a[0].startTime)return this.a[0].position;this.h.warn("No Segment found for "+a+". We have "+this.a.length+" references");for(a=0;a<this.a.length;a++)b=this.a[a],this.h.debug("SegmentIndex Ref "+a+" start: "+b.startTime+" end: "+b.endTime+" pos: "+b.position);return null};
220
+ _.r.get=function(a){if(0==this.a.length)return null;a-=this.a[0].position;return 0>a||a>=this.a.length?null:this.a[a]};_.r.offset=function(a){this.h.info("Apply offset"+a+" to segment index");for(var b=_.u(this.a),c=b.next();!c.done;c=b.next())c=c.value,c.startTime+=a,c.endTime+=a,c.Ba-=a};
221
+ _.r.Wc=function(a,b){var c=a-this.a[0].position;if(0<=c&&c<this.a.length)for(this.h.warn("Accounting for segment duration drift",b,"at",c),this.a[c].endTime+=b,c+=1;c<this.a.length;++c)this.a[c].startTime+=b,this.a[c].endTime+=b};_.r.getDuration=function(){return this.a[this.a.length-1].endTime-this.a[0].startTime};
222
+ _.r.va=function(a){for(var b=[],c=[],d=0,e=0;d<this.a.length&&e<a.length;){var f=this.a[d],g=a[e];f.startTime<g.startTime?(b.push(f),d++):(f.startTime>g.startTime?0===d?c.push(g):this.h.info("Refusing to rewrite original references on update!"):(.1<Math.abs(f.endTime-g.endTime)?(f=new _.lx(f.position,g.startTime,g.endTime,g.Na,g.ta,g.fa,g.Ba,g.keyInfo,g.Ec,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile),b.push(f)):b.push(f),d++),e++)}for(;d<this.a.length;)b.push(this.a[d++]);if(b.length)for(d=
223
+ b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.lx(d++,f.startTime,f.endTime,f.Na,f.ta,f.fa,f.Ba,f.keyInfo,f.Ec,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile),b.push(f);else b=a;a=b;if(c.length&&b.length){a=[];e=b[0].position;d=c.length;c=_.u(c);for(f=c.next();!f.done;f=c.next())f=f.value,a.push(new _.lx(e-d--,f.startTime,f.endTime,f.Na,f.ta,f.fa,f.Ba,f.keyInfo,f.Ec,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile));b=_.u(b);for(f=b.next();!f.done;f=b.next())a.push(f.value)}this.a=
224
+ a};_.r.replace=function(a){this.a=a};iy.prototype.release=function(){this.g.stop();for(var a=_.u(this.a),b=a.next();!b.done;b=a.next())b.value.release();this.a.clear()};jy.prototype.release=function(){this.l=null;this.j.clear();this.a=function(){};this.f=function(){};this.g=function(){}};
225
+ jy.prototype.o=function(a,b){for(var c={},d=_.u(this.l.cues()),e=d.next();!e.done;c={re:c.re,zd:c.zd},e=d.next()){e=e.value;c.re=this.j.get(e)||null;c.zd=a<e.startTime?1:a>e.endTime?3:2;this.j.set(e,c.zd);var f=this.w.find(function(g){return function(h){return h.oc===g.re&&h.nc===g.zd}}(c));f&&f.dc(e,b)}};_.r=ny.prototype;_.r.destroy=function(){this.g=this.w=null;this.o.clear();return Promise.resolve()};
226
+ _.r.remove=function(a,b){var c=this;return Promise.resolve().then(function(){!c.g||!c.g.remove(a,b)||null==c.a||b<=c.a||a>=c.f||(a<=c.a&&b>=c.f?c.a=c.f=null:a<=c.a&&b<c.f?c.a=b:a>c.a&&b>=c.f&&(c.f=a))})};_.r.tb=function(){return this.a};_.r.Ea=function(){return this.f};_.r.fc=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.r.Ja=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};
227
+ sy.prototype.init=function(a){var b=muxjs.mp4.probe;a=_.R(a);this.l=b.videoTrackIds(a);this.j=b.timescale(a);this.a.init()};sy.prototype.g=function(a,b){var c=_.R(a);(c=this.a.parse(c,this.l,this.j))&&c.captions&&b(c.captions);this.a.clearParsedCaptions()};sy.prototype.f=function(){this.a.resetCaptionStream()};_.ty.prototype.init=function(){};_.ty.prototype.g=function(){};_.ty.prototype.f=function(){};_.r=_.vy.prototype;
228
+ _.r.destroy=function(){var a=this;this.J=!0;var b=[],c;for(c in this.g){var d=this.g[c],e=d[0];this.g[c]=d.slice(0,1);e&&b.push(e.p["catch"](hx));for(e=1;e<d.length;++e)d[e].p["catch"](hx),d[e].p.reject()}this.a&&b.push(this.a.destroy());this.B&&b.push(this.B.destroy());for(var f in this.A)b.push(this.A[f].destroy());return Promise.all(b).then(function(){a.l&&(a.l.release(),a.l=null);a.j&&(a.j.removeAttribute("src"),a.j.load(),a.j=null);a.w="";a.o=null;a.a=null;a.B=null;a.f={};a.A={};a.F={};a.H=null;
229
+ a.M=!1;for(var g in a.g);a.g={}})};_.r.init=function(a,b,c){c=void 0===c?!1:c;var d=this,e;return _.G(function(f){if(1==f.a)return e=_.io,_.x(f,d.I,2);a.forEach(function(g,h){var l=_.wj(g.mimeType,g.codecs);if(h==e.TEXT)Ay(d,l);else{var m=new Map;m.set(h,l);_.tx(l)&&b&&!g.keyInfo||!xx(l,h)||(d.A[h]=new ux,l="aac"==l.toLowerCase().split(";")[0].split("/")[1]?l.replace(/aac/i,_.Xd):wx(h,l),m=yx(h,l),c&&m["delete"](e.AUDIO));yy(d,m)}});_.y(f)})};
230
+ _.r.tb=function(a){return a===_.$e?this.a.tb():(a=Cy(this,a))?a.tb():null};_.r.Ea=function(a){return a===_.$e?this.a.Ea():(a=Cy(this,a))?a.Ea():null};_.r.fc=function(a,b,c){return a===_.$e?this.a.fc(b):(a=Cy(this,a))?a.fc(b,!1,c):!1};_.r.Ja=function(a,b){if(a===_.$e)return this.a.Ja(b);var c=Cy(this,a);return c?c.Ja(b):0};
231
+ _.r.remove=function(a,b,c){var d=this;return a===_.$e?this.a.remove(b,c):Fy(this,a,this.gh.bind(this,a,b,c)).then(function(){if(a===_.uf){var e=d.tb(a),f=d.Ea(a);null!==e&&null!==f&&Hx(d.D,e,f)}else a===_.rc&&(e=d.D,e.player&&e.player.trigger(new _.L(_.wc)))})};_.r.clear=function(a){if(a==_.$e){if(!this.a)return Promise.resolve();this.H.f();return this.a.remove(0,Infinity)}return Fy(this,a,this.gh.bind(this,a,0,this.o.duration))};
232
+ _.r.flush=function(a){return a==_.$e?Promise.resolve():Fy(this,a,this.mg.bind(this,a))};_.r.endOfStream=function(a){var b=this;return Ly(this,function(){By(b)||(a?b.o.endOfStream(a):b.o.endOfStream())})};_.r.getDuration=function(){return this.o.duration};_.r.Ee=function(a,b){this.h.debug("Appending data to "+a+nw);try{this.f[a].appendBuffer(b)}catch(c){throw this.h.warn("Failed to append data for "+a,c),c;}this.h.debug("Done Appending data to "+a+nw)};
233
+ _.r.gh=function(a,b,c){if(c<=b)this.Pc(a);else{this.h.debug("Removing data from "+a+" range:",b,c);try{this.f[a].remove(b,c)}catch(d){throw this.h.warn("Failed to remove data from "+a+" buffer. Range:",b,c,d),d;}this.h.debug("Done Removing data from "+a+" range:",b,c)}};
234
+ _.r.Bh=function(a){try{this.h.debug("Aborting operations for "+a+nw);var b=this.f[a].appendWindowStart,c=this.f[a].appendWindowEnd;this.f[a].abort();this.f[a].appendWindowStart=b;this.f[a].appendWindowEnd=c}catch(d){throw this.h.warn("Failed to abort operations for "+a+nw,d),d;}this.h.debug("Done Aborting operations for "+a+nw);this.Pc(a)};
235
+ _.r.mg=function(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.h.debug("Flushing buffer for "+a),this.j.currentTime-=.001):this.h.warn("Skip buffer flush for "+a+" with element state: "+this.j.readyState)}catch(b){throw this.h.warn("Failed to flush buffer for "+a,b),b;}this.h.debug("Done Flushing buffer for "+a);this.Pc(a)};
236
+ _.r.mh=function(a,b){0>b&&(b+=.001);try{this.h.debug("Setting timestamp offset for "+a,b),this.f[a].timestampOffset=b}catch(c){throw this.h.warn("Failed to set timestamp offset for "+a,b,c),c;}this.h.debug("Done Setting timestamp offset for "+a,b);this.Pc(a)};
237
+ _.r.vl=function(a,b,c){try{this.h.debug("Setting append window for "+a,b,c),this.f[a].appendWindowStart=0,this.f[a].appendWindowEnd=c,this.f[a].appendWindowStart=b}catch(d){throw this.h.warn("Failed to set append window for "+a,b,c,d),d;}this.h.debug("Done Setting append window for "+a,b,c);this.Pc(a)};_.r.U=function(a){this.g[a][0].p.reject(new _.N(_.O,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
238
+ _.r.Pc=function(a){var b=this.g[a][0];b&&(b.p.resolve(),this.h.debug("Update-End received for "+a),Oy(this,a))};_.r.getTextDisplayer=function(){return this.B};var xy=window.URL.createObjectURL;_.w(kz,_.U);_.r=kz.prototype;_.r.initialize=function(a){this.m=a};_.r.release=function(){this.g=[];this.a.clear();this.f.clear()};_.r.load=function(){};_.r.destroy=function(){this.release();this.m=null};_.r.getVideoTracks=function(){return lz(this,_.Wi)};_.r.getAudioTracks=function(){return lz(this,_.T)};_.r.ia=function(){return lz(this,_.S)};_.r.ga=function(){return this.a.get(_.Wi)||null};_.r.La=function(){return this.a.get(_.T)||null};_.r.Ma=function(){return this.a.get(_.S)||null};
239
+ _.r.Ya=function(){return this.f.get(_.Wi)||null};_.r.hb=function(){return this.f.get(_.T)||null};_.r.ib=function(){return this.f.get(_.S)||null};_.r.Oa=function(){return mz(this,_.Wi)};_.r.qa=function(){return mz(this,_.T)};_.r.ra=function(){return mz(this,_.S)};_.r.cb=function(a){oz(this,_.Wi,a)};_.r.xa=function(a){oz(this,_.T,a)};_.r.Ia=function(a){oz(this,_.S,a)};_.r.bb=function(a,b){nz(this,_.Wi,a,void 0===b?!1:b)};_.r.ob=function(a,b){nz(this,_.T,a,void 0===b?!1:b)};
240
+ _.r.pb=function(a,b){nz(this,_.S,a,void 0===b?!1:b)};_.r.addTextTrack=function(a){var b=this;return _.G(function(c){return b.m?_.x(c,b.m.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label),0):c.G(0)})};_.r.ka=function(){return!!this.m&&this.m.ka()};kz.prototype.isAbrEnabled=kz.prototype.ka;kz.prototype.addTextTrack=kz.prototype.addTextTrack;kz.prototype.setTextRendition=kz.prototype.pb;kz.prototype.setAudioRendition=kz.prototype.ob;kz.prototype.setVideoRendition=kz.prototype.bb;
241
+ kz.prototype.setTextTrack=kz.prototype.Ia;kz.prototype.setAudioTrack=kz.prototype.xa;kz.prototype.setVideoTrack=kz.prototype.cb;kz.prototype.getTextTrack=kz.prototype.ra;kz.prototype.getAudioTrack=kz.prototype.qa;kz.prototype.getVideoTrack=kz.prototype.Oa;kz.prototype.getLoadingTextRendition=kz.prototype.ib;kz.prototype.getLoadingAudioRendition=kz.prototype.hb;kz.prototype.getLoadingVideoRendition=kz.prototype.Ya;kz.prototype.getTextRendition=kz.prototype.Ma;kz.prototype.getAudioRendition=kz.prototype.La;
242
+ kz.prototype.getVideoRendition=kz.prototype.ga;kz.prototype.getTextTracks=kz.prototype.ia;kz.prototype.getAudioTracks=kz.prototype.getAudioTracks;kz.prototype.getVideoTracks=kz.prototype.getVideoTracks;_.r=_.Az.prototype;_.r.stop=function(){this.w=null;this.g=!1;this.l=[];this.j=1;this.f=null;this.D=!1};_.r.init=function(a){this.w=a};
243
+ _.r.chooseVariant=function(){var a=Bz(!this.D&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.l),b=this.getBandwidthEstimate();this.l.length&&!a.length&&(this.h.warn("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),a=Bz(null,this.l),a=[a[0]]);var c=a[0]||null;a=_.u(_.CC(a));for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e.item;var f=isNaN(this.j)||0===this.j?1:Math.abs(this.j),g=f*d.bandwidth,h=g/this.a.bandwidthDowngradeTarget;
244
+ e=f*(e.next||{bandwidth:Infinity}).bandwidth/this.a.bandwidthUpgradeTarget;this.h.debug("Bandwidth ranges:",(g/1E6).toFixed(3),(h/1E6).toFixed(3),(e/1E6).toFixed(3));b>=h&&b<=e&&(c=d)}this.f=Date.now();this.D=!0;return c};_.r.enable=function(){this.g=!0};_.r.disable=function(){this.g=!1};
245
+ _.r.segmentDownloaded=function(a,b){this.h.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.f,"enabled\x3d"+this.g);var c=this.o;if(!(16E3>b)){var d=8E3*b/a,e=a/1E3;c.a+=b;_.Ox(c.f,e,d);_.Ox(c.g,e,d)}if(null!=this.f&&this.g)a:{this.h.debug("Suggesting Streams...");if(!this.B){if(!(128E3<=this.o.a)){this.h.debug("Still waiting for a good estimate...");break a}this.B=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.f<1E3*this.a.switchInterval){this.h.debug("Skipping initial estimation switch due to switch interval...");
246
+ break a}}else if(Date.now()-this.f<1E3*this.a.switchInterval){this.h.debug("Still within switch interval...");break a}c=this.chooseVariant();d=this.getBandwidthEstimate();this.h.debug("Calling switch_(), bandwidth\x3d"+Math.round(d/1E3)+" kbps");c&&this.w(c)}};_.r.playbackRateChanged=function(a){this.j=a};_.r.getBandwidthEstimate=function(){var a=this.A&&this.A.qg();a||(a=this.o,a=128E3>a.a?this.a.defaultBandwidthEstimate:Math.min(_.Px(a.f),_.Px(a.g)));return a};
247
+ _.r.setVariants=function(a){this.l=a};_.r.setCmsdManager=function(a){this.A=a};_.r.configure=function(a){this.a=a};_.r.reset=function(){this.B=!1;this.o=new zz;var a=this.chooseVariant();a&&this.w(a)};Cz.prototype.clear=function(){this.a.clear()};Fz.prototype.add=function(a){if(Iz(this.f,a))return this.a.add(a),!0;_.J("Rejecting variant - not compatible with root.");return!1};Fz.prototype.values=function(){return this.a.values()};Kz.prototype.create=function(a){var b=this,c=a.filter(function(d){return Iz(b.a,d)});return c.length?new Fz(c[0],c):this.f.create(a)};
248
+ Jz.prototype.create=function(a){var b=Lz(a,this.g);0<b.length&&(a=b);b=!1;if(this.a){var c=Mz(a,this.a);0<c.length?(a=c,b=!0):_.J("No exact match for preferred variant role could be found. Role: "+this.a)}b||(b=a.filter(function(d){return d.primary}),0<b.length&&(a=b));this.f&&(b=Qy(a,this.f),b.length?a=b:_.J("No exact match for the channel count could be found."));b=new Fz(a[0]);a=_.u(a);for(c=a.next();!c.done;c=a.next())c=c.value,Iz(b.f,c)&&b.add(c);return b};Pz.prototype.getState=function(){return this.a};var Oz=0,Nz=1;Rz.prototype.release=function(){this.f.release()};Sz.prototype.release=function(){this.a=this.g=null;this.f=function(){}};Sz.prototype.o=function(a){var b=this.a,c=this.g.periods;a=Ix(c,a)||c[0];b!=a&&this.f(a);this.a=a};Uz.prototype.release=function(){this.f&&(this.f.stop(),this.f=null);this.a=null};Uz.prototype.set=function(a){this.g=a;Vz(this)};Xz.prototype.release=function(){this.g=null;this.f=function(){}};aA.prototype.release=function(){this.g&&(this.g.release(),this.g=null);null!=this.w&&(this.w.stop(),this.w=null);this.f&&(this.f.release(),this.f=null);this.a=this.F=this.D=null;this.o=!1};aA.prototype.de=function(){this.A=!0;$z(this)};eA.prototype.release=function(){this.f&&(this.f.release(),this.f=null);null!=this.g&&(this.g.release(),this.g=null);this.j=function(){};this.a=null;this.o=function(){};this.w=!1};bA.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};mA.prototype.release=function(){this.f&&(this.f.release(),this.f=null);this.j&&(this.j.release(),this.j=null);this.o&&(this.o.stop(),this.o=null);this.g=this.f=this.a=this.l=null;this.A=function(){}};var sA=new _.Gn(function(){return new Uint8Array([0,0,0,80,115,105,110,102,0,0,0,12,102,114,109,97,0,0,0,0,0,0,0,20,115,99,104,109,0,0,0,0,99,101,110,99,0,1,0,0,0,0,0,40,115,99,104,105,0,0,0,32,116,101,110,99,0,0,0,0,0,0,1,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])});var aB;_.r=_.uA.prototype;_.r.destroy=function(){var a=this,b,c,d,e;return _.G(function(f){if(1==f.a){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,FA(e),b.push(GA(e));return _.x(f,Promise.all(b),2)}a.a.clear();a.o.clear();a.C=null;a.j=null;a.F=null;a.l=null;a.g=null;a.f=!0;_.y(f)})};
249
+ _.r.start=function(){var a=this,b,c,d;return _.G(function(e){if(1==e.a){b=a.C.yb();c=BA(a,b);d=a.C.cf(vA(a)[c]);if(!d.variant&&!d.text)throw a.h.error("start(): No streams chosen"),new _.N(_.O,5,5005);a.D=!d.variant&&!!d.text;return _.x(e,WA(a,d.variant?d.variant.audio:null,d.variant?d.variant.video:null,d.text,b),2)}if(a.f)return e["return"]();a.h.debug("init: completed initial Stream setup");a.C&&a.C.Ek&&(a.h.debug("init: calling onInitialStreamsSetup()..."),a.C.Ek());_.y(e)})};
250
+ _.r.Db=function(a){var b=this,c,d,e,f;return _.G(function(g){switch(g.a){case 1:if(b.f)return g["return"]();c=MA(a);if(a.$a||null==a.sb||a.Zb)return g["return"]();a.sb=null;if(!a.Hb){g.G(2);break}b.h.debug(c,"skipping update and clearing the buffer");return _.x(g,PA(b,a,a.ke,a.Kd),3);case 3:return g["return"]();case 2:_.B(g,4);d=$A(b,a);null!=d&&(DA(b,a,d),a.Lc=!1);_.ag(g,5);break;case 4:return e=_.D(g),_.x(g,kB(b,e),6);case 6:return g["return"]();case 5:f=Array.from(b.a.values()),pB(b,a),b.B&&f.every(function(h){return h.endOfStream})&&
251
+ (b.h.debug(c,"calling endOfStream()..."),b.C.W.endOfStream().then(function(){if(!b.f){var h=b.C.W.getDuration();h<b.j.presentationTimeline.getDuration()&&(b.j.presentationTimeline.f=h)}}).then(function(){b.C.Ng()})),_.y(g)}})};
252
+ _.r.Yk=function(a,b,c,d){var e=Xw(d.reader),f=Xw(d.reader),g=_.W(d.reader),h=_.W(d.reader),l=_.W(d.reader),m=_.W(d.reader);d=_.tl(d.reader,d.reader.Fa()-d.reader.getPosition());a=a.startTime+b.startTime+h/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.C.Sg();else this.C.onEvent(new _.L("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:l,id:m,messageData:d}}))};
253
+ _.r.Ll=function(a){var b=this,c=!1,d=0;(new _.ul).L(_.Wd,_.vl).L(_.df,_.vl).L(_.Rd,_.vl).L(_.Vd,_.vl).L(_.Te,_.vl).X(_.Ve,_.wl).L("encv",function(e){e.reader.skip(78);_.vl(e)}).L("pasp",function(e){d=e.start+e.headerSize;var f=_.W(e.reader),g=_.W(e.reader);c=f!==g;b.h.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.parser.stop()}).parse(a.data);c&&(a=new _.il(new DataView(a.data)),a.seek(d),_.V(a,1),_.V(a,1))};aB="iterateSegmentReference";_.DC={ITERATOR:aB,LOOKUP:_.Kw};_.w(sB,_.Kk);_.r=sB.prototype;_.r.init=function(a,b){var c=a.getMedia();_.Kk.prototype.init.call(this,a,b);yB(this,c)};_.r.namespace=function(){return Iw};_.r.dg=function(){return new kz};_.r.getState=function(){return this.ma};_.r.getDrmInfo=function(){return this.l?this.l.getDrmInfo():null};
254
+ _.r.unload=function(){var a=this;qz(this,!1);this.ed=!1;if(this.w){var b=this.getTrackManager();b&&b.release();return this.F===vB?Promise.resolve():AB(this).then(function(){a.log.debug(_.ob,a.w);a.w=null;a.kf=0;a.yc=null;a.V=null})}return Promise.resolve()};
255
+ _.r.release=function(){var a=this;return _.G(function(b){if(a.ea)return b["return"](a.ea);a.ea=new Promise(function(c,d){try{var e=a.Rb;a.Rb=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.Kk.prototype.release.call(a)}):f=_.Kk.prototype.release.call(a);f=f.then(function(){return a.unload()});f.then(function(){uB(a,_.Jn);a.ea=null;c()})["catch"](function(g){a.ea=null;d(g)})}catch(g){a.ea=null,d(g)}});return b["return"](a.ea)})};
256
+ _.r.getBufferInfo=function(a){if(this.K){var b=Dy(this.K),c=new _.zk(void 0,a);switch(a){case _.Wi:return b.video?b.video:c;case _.T:return b.audio?b.audio:c;case _.S:return b.text?b.text:c}return b.total?b.total:c}return this.jd?(b=Ex(this.jd),Bx(b,a)):_.Kk.prototype.getBufferInfo.call(this,a)};_.r.getPosition=function(){return this.A?oA(this.A):_.Kk.prototype.getPosition.call(this)};_.r.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null};
257
+ _.r.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.r.destroy=function(){var a=this;return _.G(function(b){if(1==b.a)return _.x(b,_.Kk.prototype.destroy.call(a),2);if(3!=b.a){if(a.F===vB)return b["return"]();a.log.debug("Destroying player...");a.F=vB;return _.x(b,xB(a),3)}a.o&&(a.o.release(),a.o=null);a.g=null;a.I&&(a.I.release(),a.I=null);_.y(b)})};
258
+ _.r.Rf=function(){var a=this;return _.G(function(b){if(1==b.a){if(!a.Zd)return a.log.warn("No preloaded asset found"),b["return"]();a.log.info("Loading preloaded asset",a.Zd);a.Zd=null;return _.x(b,FB(a),2)}return _.x(b,GB(a),0)})};
259
+ _.r.preload=function(a){var b=this;return _.G(function(c){if(1==c.a)return _.wm("preload.start"),b.log.info("Preloading asset",a),_.x(c,HB(b,a,!1),2);b.Zd=a;b.log.info("Preloaded asset",a);_.wm("preload.end");performance.measure("preload","preload.start","preload.end");_.y(c)})};_.r.load=function(a){return HB(this,a)};_.r.detach=function(){var a=this;return _.G(function(b){return 1==b.a?_.x(b,wB(a),2):b["return"](xB(a))})};
260
+ _.r.isLive=function(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!=a.f&&!a.j):a=!1;return a};_.r.Wg=function(){this.log.debug("User seeking finished");this.H&&SB(this);TB(this)};_.r.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:_.Zx(a,0),end:Yx(a)}}return{start:0,end:0}};_.r.Kc=function(){return this.f?this.f.presentationTimeline.Kc():null};
261
+ _.r.getPlaybackRate=function(){if(this.pc){var a=this.pc;a=a.j?0:a.g}else a=0;return a};
262
+ _.r.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.F===rB){this.pc.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.a.get(_.uf)){var d=a.stream;if(d)if(b.h.debug("setTrickPlay",c),c)(c=d.trickModeVideo)&&!a.Ub&&(b.h.debug("Engaging trick mode stream",c),_.IA(b,c,!1,0),a.Ub=d);else if(d=a.Ub)b.h.debug("Restoring non-trick-mode stream",d),a.Ub=null,_.IA(b,d,!0,0)}}};
263
+ _.r.ia=function(){if(this.f&&this.A){var a=MB(this);if(null==a)a=null;else{if(!Ez(this.T,a).text){var b=_.dz(a.textStreams,this.Ra,this.vc);b.length&&(b=b[0],Ez(this.T,a).text=b)}a=Ez(this.T,a).text}b=[];for(var c=_.u(qC(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=az(d);e.active=d==a;b.push(e)}return b}return[]};_.r.getPeriods=function(){return this.f.periods};
264
+ _.r.getStats=function(){if(this.F!==rB)return _.Fn();TB(this);var a=this.j;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.J,c=Number(a.totalVideoFrames);b.l=Number(a.droppedVideoFrames);b.j=c}if(this.F===rB){if(a=dC(this))this.J.o=a.bandwidth;a&&a.video&&(b=this.J,c=a.video.height||NaN,b.w=a.video.width||NaN,b.g=c);a=this.g.getBandwidthEstimate();this.J.f=a}return this.J.getStats()};
265
+ _.r.getTimelineCues=function(){return this.wc?_.Of(this.wc.cues()).concat().map(function(a){return{schemeIdUri:a.schemeIdUri,value:a.value,startTime:a.startTime,endTime:a.endTime,id:a.id,eventElement:a.eventElement,type:a.type}}):[]};_.r.resetAbr=function(){this.g&&this.g.reset()};
266
+ _.r.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,t,v,z;return _.G(function(A){if(1==A.a){if(g.F!==rB)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");h=MB(g);l=_.io;m=g.f.periods.indexOf(h);n=m+1;p=n>=g.f.periods.length?g.f.presentationTimeline.getDuration():g.f.periods[n].startTime;q=p-h.startTime;if(Infinity==q)throw new _.N(1,4,4040);t=new _.lx(1,0,q,function(){return[a]},0,null,0);v={id:g.rh++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
267
+ findSegmentPosition:function(){return 1},getSegmentReference:function(C){return 1==C?t:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.Kw,initSegmentReference:null,mimeType:d,codecs:e||"",kind:c,encrypted:!1,keyId:null,language:b,originalLanguage:b,label:f||null,type:l.TEXT,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,closedCaptions:null};g.Xd.add(v);h.textStreams.push(v);return _.x(A,EA(g.a,v),2)}if(z=_.xA(g.a,
268
+ _.$e))Ez(g.T,h).text=z;g.Xd["delete"](v);g.log.debug("Choosing new streams after adding a text stream");cC(g,h);OB(g);return A["return"](az(v))})};
269
+ _.r.Bi=function(a){this.log.debug(_.Ow,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=oC(this,a);this.log.debug("onChooseStreams_, chose variant ",b.variant);this.log.debug("onChooseStreams_, chose text ",b.text);return b}catch(c){return this.onError(c),{variant:null,text:null}}};
270
+ _.r.Ai=function(){this.log.debug("canSwitch_");this.ca=!1;this.configuration.abr.enabled&&this.g.enable();this.na&&(JA(this.a,this.na,this.kh,this.eh),this.na=null);this.ha&&(_.IA(this.a,this.ha,!0,0),this.ha=null)};_.r.Ci=function(){this.B&&this.B.update&&this.B.update()};_.r.Pk=function(){this.A&&this.A.j.de()};
271
+ _.r.Jh=function(a,b,c){if((void 0===c?"":c)===Lw)return OB(this),this.ka()||(this.configuration.abr.enabled=!0,this.g.enable()),cC(this,b,!1),!0;if(c=b.variants.some(function(g){var h=!1,l=g[a.type];l&&(h=g.allowedByApplication&&l.id!==a.id,a.type===_.rc&&(h=h&&l.language===a.language));return h})&&this.ka()){for(var d=_.u(b.variants),e=d.next();!e.done;e=d.next()){e=e.value;var f=e[a.type];f&&f.id===a.id&&(e.allowedByApplication=!1)}OB(this);this.ka()||(this.configuration.abr.enabled=!0,this.g.enable());
272
+ cC(this,b)}return c};_.r.Ck=function(){this.log.debug("endOfStream called by streaming engine");this.ed=!0};_.r.onError=function(a){if(this.F!==vB&&7001!==a.code&&7E3!==a.code){var b=new _.L(_.yd,{detail:a});a.severity===_.O&&uB(this,_.Un);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.r.De=function(a){a.type===_.sd?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Df?IB(this):"emsg"!==a.type&&(a instanceof _.L?this.dispatchEvent(a):this.log.debug(_.Db,a.type)))};_.r.ka=function(){return this.configuration.abr.enabled};
273
+ _.r.Gl=function(a){var b=this,c,d,e,f,g,h,l,m;return _.G(function(n){switch(n.a){case 1:if(!b.uc)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ka();return _.x(n,b.uc(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.M.va(b.getLoadedSource(),{url:e});d&&b.g.disable();return _.x(n,QA(b.a),3);case 3:g=dC(b);case 4:return h=!1,_.B(n,7),b.log.info("Switching CDN to "+f.url+"."),_.x(n,rC(b,f,g),9);case 9:_.ag(n,6);break;case 7:return l=_.D(n),b.log.info("Switch failed"),
274
+ _.x(n,b.uc(f.url,a),10);case 10:if(m=n.f)f.url=m,h=!0;else throw l;case 6:h?n.G(4):(d&&b.g.enable(),OA(b.a,!0),b.w[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.L(_.Gc,{newManifest:f.url})),_.y(n))}})};sB.prototype.detach=sB.prototype.detach;var vB=0,qB=1,rB=2,NB=[_.je,_.Fd];sC.prototype.a=function(){return Iw};
275
+ sC.prototype.canPlay=function(a,b){if(_.Hj())return 0;var c=a.type||"",d=(window.ManagedMediaSource?!0:!1)||(window.MediaSource&&MediaSource.isTypeSupported?!0:!1),e=window.ManagedMediaSource||window.MediaSource&&MediaSource.isTypeSupported?c in _.Hq||_.Iq(a.url)in _.Jq?!0:!1:!1;if(d&&e){if(_.Mi(2))return 1;if(_.Ij()&&c===_.kk){if(b.streaming.preferNativeHlsOnSafari)return 1;_.J("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};
276
+ sC.prototype.create=function(){return new sB};_.Ag(new sC);_.No(function(){_.ug("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.tg("Patching Chromecast MSE bugs."),xC();else if(_.Ij()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;vC();10>=a?(_.tg("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.tg("Patching Safari 11 \x26 12 MSE bugs."),tC(),uC()):(_.tg("Patching Safari 13 MSE bugs."),tC())}else _.Mi(2)||_.Mi(3)||
277
+ _.Mi(4)?wC():_.tg("Using native MSE as-is.");else _.tg("No MSE implementation available.")});_.w(yC,_.pr);_.r=yC.prototype;
278
+ _.r.append=function(a){function b(e){if(e.startTime>=e.endTime)_.J("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.ki(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.Ic}catch(g){f.align="middle"}e.writingMode===_.sf?f.vertical="lr":e.writingMode===_.tf&&(f.vertical="rl");e=f}e&&c.push(e)}var c=[],d=_.u(a);for(a=d.next();!a.done;a=d.next())b(a.value);a=c.slice().sort(function(e,f){return e.startTime!==f.startTime?
279
+ e.startTime-f.startTime:e.endTime!==f.endTime?e.endTime-f.startTime:c.indexOf(f)-c.indexOf(e)});d=_.u(a);for(a=d.next();!a.done;a=d.next())this.a.addCue(a.value)};_.r.remove=function(a,b){if(!this.a)return!1;zC(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.r.isTextVisible=function(){return this.a.mode==_.Ne};_.r.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.Ne:_.Cd)};_.r.destroy=function(){this.a&&zC(this.a,function(){return!0});this.a=null;return Promise.resolve()};AC.prototype.aa=function(){return!0};AC.prototype.create=function(a){return new yC(a)};_.wn("single-native",new AC);};
280
280
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
281
281
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
282
282
  else{_=this.clpp._;(f.call(g,this));}