(function(){var g={}; var _ = _ || {}
var f=function(window){var GC,HC,IC,JC,KC,LC,MC,NC,OC,QC,RC,SC,TC,VC,WC,XC,YC,$C,aD,bD,cD,dD,eD,fD,jD,kD,mD,nD,oD,pD,qD,sD,uD,zD,AD,BD,CD,DD,ED,FD,GD,ID,MD,ND,PD,QD,RD,SD,UD,VD,XD,YD,$D,aE,bE,dE,eE,fE,gE,hE,iE,jE,kE,mE,rE,xE,CE,FE,uE,EE,GE,HE,IE,JE,KE,LE,ME,NE,OE,SE,UE,VE,WE,TE,YE,XE,ZE,$E,cF,dF,eF,bF,aF,fF,jF,lF,iF,mF,hF,kF,gF,oF,nF,pF,qF,rF,uF,wF,zF,BF,AF,FF,IF,GF,HF,KF,JF,LF,MF,NF,OF,QF,RF,SF,TF,UF,WF,XF,YF,$F,aG,ZF,bG,cG,dG,eG,fG,gG,hG,iG,jG,mG,pG,qG,uG,sG,tG,yG,xG,zG,DG,BG,FG,HG,GG,JG,KG,LG,NG,MG,OG,PG,QG,RG,UG,TG,
WG,IG,XG,VG,YG,SG,dH,eH,aH,ZG,bH,cH,fH,gH,jH,iH,kH,lH,mH,$G,nH,hH,qH,rH,tH,sH,uH,wG,vH,wH,zH,xH,yH,BH,AH,CH,DH,EH,HH,JH,IH,KH,LH,MH,NH,QH,PH,OH,SH,RH,UH,YH,$H,aI,fI,iI,jI,lI,nI,pI,rI,VH,sI,vI,wI,xI,zI,AI,CI,DI,FI,mI,oI,dI,II,HI,bI,qI,LI,JI,EI,GI,NI,MI,KI,UI,VI,PI,XI,QI,SI,$I,ZI,TI,YI,aJ,cI,BI,bJ,cJ,RI,yI,eI,gI,XH,OI,hI,WI,tI,uI,dJ,gJ,hJ,iJ,jJ,kJ,nJ,oJ,mJ,PJ,QJ,XJ,lJ,WJ,YJ,RJ,SJ,TJ,cK,ZJ,sJ,rJ,qJ,tJ,aK,bK,UJ,VJ,lK,gK,pK,qK,rK,wK,tK,kG,oG,lG,IK,HK,rG,nG,FK,KK,EK,JK,DK,LK,mK,kK,vK,GK,NK,uK,yK,eK,xK,
OK,jK,QK,PK,RK,SK,VK,oK,iK,UK,TK,$J,MK,BK,XK,vG,AK,zK,WK,pJ,YK,fK,sK,nK,ZK,$K,aL,bL,cL,dL,eL,fL,gL;GC=" buffer";HC=" is being or has been set up";IC=" seconds";JC="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";KC="\x3c/LA_URL\x3e";LC="\x3cLA_URL\x3e";MC='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';NC="Cannot get segment, period ID unknown";OC="Choosing new streams after key status change";_.PC="Could not load text stream with id: ";QC="IterateSegmentReference";
RC="Jumping forward";SC="MediaSource threw QuotaExceededError:";TC="Period not found.";_.UC="Player is in ERROR state and can not switch to ";VC="PrestoPlay TextTrack";WC="Removing audio from variant - audio not compatible with platform";XC="Setting playback rate to\x3d";YC="URI-REPLACEMENT";_.ZC="Updating manifest...";$C="X-Playback-Session-Id";aD="bufferBehind\x3d";bD="bufferedBehind\x3d";cD="calling onCanSwitch()...";dD="cannot find segment";eD="clpp.mse.Player";fD="currentPeriod.startTime\x3d";
_.gD="dashif:Laurl";_.hD="getSegmentNextReference";_.iD="iterateSegmentReference";jD="key-restriction";kD="manifest.start";_.lD="onChooseStreams_";mD="presentationTime:";nD="presentationTime\x3d";oD="reference.endTime\x3d";pD="reference.position\x3d";qD="reference.startTime\x3d";_.rD="subtitles";sD="switch: Stream ";_.tD=function(a,b){return _.dh[a]=b};uD=function(a){for(var b=a.a+a.f.byteOffset,c=void 0;_.fn(a);)if(0===_.hn(a)){c=a.a+a.f.byteOffset-1;break}a=a.f.buffer.slice(b,c);return _.Q.ea(a)};
_.wD=function(a){var b=new Uint8Array(vD),c=4+b.byteLength+a.j.byteLength+4+a.f.byteLength,d=new _.bn(c,!1);_.V(d,c);_.dn(d,b);_.dn(d,a.j);_.V(d,a.f.byteLength);_.dn(d,a.f);return _.Oj(d.buffer)};
_.xD=function(a,b,c,d){var e=_.Om(b);if(8!==e.byteLength)e="";else{var f=_.Wo(e);e=_.Lm(f);b:switch(f=f.byteLength,_.Oh("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[MC+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?LC+d+KC:"",JC].join("");break b;case "4.1.0.0":e=[MC+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKID ALGID\x3d"AESCTR" ',
c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?LC+d+KC:"",JC].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[MC+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?LC+d+KC:"",JC].join("");break b;default:_.Jh("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.Oh("New payload",e);e=_.Oj(_.Q.Gf(e,!0));return new _.So(_.Xo,
b,d||null,e,a,c)};_.yD=function(a,b){return b===a.version?a:_.xD(b,a.a,a.l||void 0,a.h||void 0)};zD=function(a,b){a:{if(b){var c=_.u(a.h.keys());for(var d=c.next();!d.done;d=c.next()){d=a.h.get(d.value);for(var e=0;e<d.vb.length;e++)if(d.vb[e]===b){c=d;break a}}}c=null}return c?c.qb:null};AD=function(a,b){if(_.tl("Edge/"))return!0;b=b.toLowerCase();if(_.qk()&&b.includes('codecs\x3d"ac-3"')){var c=b.replace("ac-3",_.ee);return a.K.has(b)||a.K.has(c)}return a.K.has(b)};
BD=function(a,b){var c=a.o.get(b);return!(!c||c!==_.af&&c!==_.te)};CD=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&(c=_.Kp(c),!AD(a,c))||d&&d.encrypted&&(d=_.Kp(d),!AD(a,d)))return!1;var e=a.keySystem();return 0===b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem===e})};DD=function(a,b,c){a.f!==b&&(a.f=b,a.a.push({timestamp:Date.now()/1E3,id:b.id,trackId:b.track.id,type:b.track.type,fromAdaptation:c,width:null,height:null,bandwidth:b.bandwidth}))};
ED=function(a,b){if(null==a.a)return null;var c=a.a[a.a.length-1];return c?c[b]:null};FD=function(a){a=ED(a,_.Gw);return null==a?null:a};GD=function(a,b){if(a.a.length)if(0>b)a.f=0;else{for(var c=0,d=a.a[c]||null;d&&b>d.cc()+d.getDuration();)c+=1,d=a.a[c]||null;a.f=d?c:a.a.length-1}else a.f=-1};_.HD=function(a,b){return a.concat(b)};ID=function(){};
_.JD=function(a,b){if(0===b.length)return a;var c=b.map(function(d){return new _.dj(d)});return a.map(function(d){return new _.dj(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.HD,[]).map(function(d){return d.toString()})};_.KD=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
_.LD=function(a,b,c,d,e,f,g){f=void 0===f?"":f;this.cb=a;this.Da=b;this.oa=c;this.keyInfo=d||null;this.qd=_.L.R(e)?!1:!!e;this.xe=f;this.Qa=g};MD=function(a,b){a=_.Cj(a);b=_.Cj(b);var c=a.split("-"),d=b.split("-");return c[0]===d[0]&&1===c.length&&2===d.length};ND=function(a){return a.language?_.Cj(a.language):a.audio&&a.audio.language?_.Cj(a.audio.language):a.video&&a.video.language?_.Cj(a.video.language):_.wg};
_.OD=function(a,b){for(var c=_.Cj(a),d=new Set,e=_.u(b),f=e.next();!f.done;f=e.next())d.add(_.Cj(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,MD(f,c))return f;e=_.u(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,h=c;g=_.Cj(g);h=_.Cj(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,MD(c,e))return e;return null};
PD=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};QD=function(a,b){var c=_.nl(b,a);if(!c)return!1;c=c();var d=c.isMuxed(a,b);c.destroy();return d};RD=function(a){for(var b=[a.mimeType],c=_.u(_.qw),d=c.next();!d.done;d=c.next()){var e=_.u(d.value);d=e.next().value;e=e.next().value;d=a[d];null!=d&&b.push(e.trim()+'\x3d"'+String(d).trim()+'"')}return b.join(";").replace(/\s/g,"")};
SD=function(a){return a.split(",").map(function(b){return b.trim()}).filter(function(b){return 0<b.length})};_.TD=function(a){var b=[];a=_.u(a.split(/\s*,\s*/));for(var c=a.next();!c.done;c=a.next()){c=c.value.split(".");var d=c[0];c.shift();b.push(d)}return b.sort().join(",")};UD=function(a,b){var c=_.TD(_.ql(a)),d=_.pl(a),e=_.TD(_.ql(b));return d===_.pl(b)&&c===e};
VD=function(a,b){for(var c=new _.lm(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};_.WD=function(a,b,c,d,e,f){this.tagName=a;this.textContent=b;this.attributes=c;this.childNodes=d;this.localName=e;this.a=f};
XD=function(a){return-1===a.indexOf("\x26")?a:a.replace(/&(?:amp|lt|gt|quot|apos|nbsp|lrm|rlm|#[xX]?[0-9a-fA-F]+);/g,function(b){switch(b){case "\x26amp;":return"\x26";case "\x26lt;":return"\x3c";case "\x26gt;":return"\x3e";case "\x26quot;":return'"';case "\x26apos;":return"'";case "\x26nbsp;":return"\u00a0";case "\x26lrm;":return"\u200e";case "\x26rlm;":return"\u200f";default:return"#"===b[1]?(b="x"===b[2]||"X"===b[2]?parseInt(b.slice(3),16):parseInt(b.slice(2),10),String.fromCodePoint(b)):b}})};
YD=function(a){function b(h,l){return new _.WD(void 0===l?_.da:l,h,{},[],null,g)}function c(h){h=void 0===h?"":h;for(var l=[];a[e];)if(60==a.charCodeAt(e)){if(47===a.charCodeAt(e+1)){var m=e+2;e=a.indexOf("\x3e",e);if(!a.startsWith(h,m))throw h=a.substring(0,e).split("\n"),Error("Unexpected close tag\nLine: "+(h.length-1)+"\nColumn: "+(h[h.length-1].length+1)+"\nChar: "+a[e]);e+1&&(e+=1);break}else if(63===a.charCodeAt(e+1)){e=a.indexOf("\x3e",e);e++;continue}else if(33===a.charCodeAt(e+1)){if(45==
a.charCodeAt(e+2)){for(;-1!==e&&(62!==a.charCodeAt(e)||45!=a.charCodeAt(e-1)||45!=a.charCodeAt(e-2)||-1==e);)e=a.indexOf("\x3e",e+1);-1===e&&(e=f)}else if(91===a.charCodeAt(e+2)&&91===a.charCodeAt(e+8)&&a.startsWith("CDATA",e+3)){m=a.indexOf("]]\x3e",e);-1==m?(l.push(b(a.substr(e+9),"#cdata")),e=f):(l.push(b(a.substring(e+9,m),"#cdata")),e=m+3);continue}else{m=e+1;e+=2;for(var n=!1;(62!==a.charCodeAt(e)||!0===n)&&a[e];)91===a.charCodeAt(e)?n=!0:!0===n&&93===a.charCodeAt(e)&&(n=!1),e++;l.push(b(a.substring(m,
e),"#doctype"))}e++;continue}e++;n=m=d();var p=m.indexOf(":");-1!==p&&(m.slice(0,p),n=m.slice(p+1));for(p={};62!==a.charCodeAt(e)&&a[e];){var q=a.charCodeAt(e);if(64<q&&91>q||96<q&&123>q){q=d();for(var t="",v=a.charCodeAt(e);39!==v&&34!==v;)e++,v=a.charCodeAt(e);if(39===v||34===v){if(t=e+1,e=a.indexOf(a[e],t),t=a.slice(t,e),-1===e)throw Error("Missing closing quote");}else e--;p[q]=t;q=q.split(":");"xmlns"===q[0]&&q[1]&&g.set(t,q[1])}e++}q=[];t=a.charCodeAt(e-1);e++;47!==t&&(q=c(m));l.push(new _.WD(m,
null,p,q,n,g))}else m=e,e=a.indexOf("\x3c",e)-1,-2===e&&(e=f),m=XD(a.slice(m,e+1)).trim(),0<m.length&&l.push(b(m)),e++;return l}function d(){for(var h=e;-1==="\r\n\t\x3e/\x3d ".indexOf(a[e])&&a[e];)e++;return a.slice(h,e)}var e=0,f=a.length,g=new Map;return new _.WD("#document",null,{},c(""),null,g)};_.ZD=function(){};
$D=function(a){switch(a){case _.sm:_.Fw.info("Select DOM parser for XML");_.To=new _.Go;break;case "txml":_.Fw.info("Select TXML parser for XML");_.To=new _.ZD;break;default:_.Fw.warn("XML parser option unknown, using default DOM parser. Option: "+a),_.To=new _.Go}};aE=function(){return!!window.SourceBuffer&&!!SourceBuffer.prototype&&!!SourceBuffer.prototype.changeType};bE=function(a,b){return a.start-b.start};
_.cE=function(a){this.h=void 0===a?null:a;this.log=new _.J("clpp.renditions");this.U=[];this.f=this.player=null;this.a=!1};dE=function(a){return a.U.map(function(b){return{start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}})};eE=function(a){a.player&&(a.player.off(_.Nf,a.jd),a.a&&a.player.off(_.rg,a.jd));a.player=null};fE=function(a){a.player&&a.player.trigger(new _.K(_.Vc))};
gE=function(a){if(a.player){for(var b=!1,c={},d=0;d<a.U.length;d++){var e=a.U[d],f=e.width+"x"+e.height,g=c[f];if(g&&g!==e.bandwidth){b=!0;break}c[f]=e.bandwidth}b&&!a.a?(a.log.debug("Tracking timeupdates"),a.player.on(_.rg,a.jd,a),a.a=!0):!b&&a.a&&(a.log.debug("Stop tracking timeupdates"),a.player.off(_.rg,a.jd),a.a=!1)}};hE=function(a,b,c){a.U=a.U.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 _.K(_.Mg))};
iE=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};jE=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};kE=function(a,b){for(var c=0;c<a.length;c++)if(jE(a[c]).has(b))return c;return-1};
mE=function(a,b){Array.from(jE(a)).forEach(function(c){c.segmentIndex&&_.lE(c.segmentIndex,b)})};_.nE=function(a){this.h=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.oE=function(a,b,c){var d=Math.pow(a.h,b);c=c*(1-d)+d*a.a;isNaN(c)||(a.a=c,a.f+=b)};_.pE=function(a){return a.a/(1-Math.pow(a.h,a.f))};
_.qE=function(a,b,c,d,e,f,g,h){a=_.ck(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};rE=function(a){this.a=this.h=0;this.f=a};_.sE=function(a,b,c){a.h=b;a.a=c};
_.tE=function(a,b,c,d,e,f){f=void 0===f?!1:f;this.j=a;this.G=b;this.K=c;this.A=this.f=Infinity;this.h=1;this.H=0;this.o=this.w=null;this.I=0;this.C=this.l=d;this.N=void 0===e?!0:e;this.g=new _.J("clpp.media.PresentationTimeline");this.P=f;this.L=null;this.a=new rE(d);this.J=null;this.B=this.j.type||null};_.vE=function(a,b){a.L={offsetDateTime:b-uE(a),seekRangeStartDateTime:b}};_.wE=function(a,b){a.l=b;a.C=b;a.a.f=b};xE=function(a){return 2===a.j.version?a.a.f?a.a.a:null:a.l?a.f:a.C?a.o:null};
_.AE=function(a,b,c){if(0!==b.length){var d=b[b.length-1].endTime+c;_.yE(a,b[0].startTime+c);a.h=b.reduce(function(e,f){return Math.max(e,f.endTime-f.startTime)},a.h);_.zE(a,d);null!=a.G&&a.N&&(a.G=(Date.now()+a.I)/1E3-(a.o||0)-a.h);a.g.debug("notifySegments: maxSegmentDuration\x3d"+a.h)}};_.yE=function(a,b){a.w=null==a.w?b:Math.min(a.w,b)};_.zE=function(a,b){a.o=Math.max(a.o||0,b)};_.BE=function(a,b){a.h=Math.max(a.h,b);a.g.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.h)};
_.DE=function(a){return 2===a.j.version?a.a.cc():Infinity===a.A?0:Math.max(0,CE(a)-a.A)};CE=function(a){if(2===a.j.version)a=a.a.a;else if(a.l)a=a.f;else if(a.C)a=a.o||0;else{if("startover"===a.B)var b=a.J||0;else b=(Date.now()+a.I)/1E3,b=a.P?Math.max(0,b-(a.h-a.H)-a.G):Math.max(0,b-a.h-a.G);a=Math.min(b,a.f)}return a};FE=function(a,b){if(2===a.j.version)return a.a.cc();var c=Math.max(a.w,0);return Infinity===a.A?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(CE(a)-a.A+b,EE(a)))};
uE=function(a){return 2===a.j.version?a.a.cc():FE(a,0)};EE=function(a){var b=a.qe()&&!a.C?a.K:0;return 2===a.j.version?a.a.a-b:Math.max(0,CE(a)-b)};GE=function(a,b){var c=(void 0===b?0:b)?a.offset:0;return{schemeIdUri:a.schemeIdUri,configurationId:a.configurationId,value:a.value,startTime:a.startTime+c,endTime:a.endTime+c,id:a.id,eventElement:a.eventElement,type:a.type,customAttributes:a.customAttributes}};HE=function(){this.f=function(){};this.h=function(){};this.a=new Set};
IE=function(a,b,c){a.f=b;a.h=c};JE=function(a,b){for(var c=[],d=!1,e={},f=_.u(b),g=f.next();!g.done;e={Xc:e.Xc},g=f.next())e.Xc=g.value,a.a.has(e.Xc)||(c.push(e.Xc),g=Array.from(a.a.values()).some(function(h){return function(l){return l.id===h.Xc.id}}(e)),e.Xc.id&&g&&(d=!0));e=a.a.size;a.a.clear();b.forEach(function(h){return a.a.add(h)});f=a.a.size;c.forEach(function(h){return a.f(h)});(d||0<c.length||e!==f)&&a.h()};
KE=function(a,b){b=void 0===b?!1:b;return Array.from(a.a.values()).map(function(c){return GE(c,b)}).sort(function(c,d){return c.startTime-d.startTime})};LE=function(a,b,c,d){this.a=a;this.h=null;this.j=b;this.f=c;this.o=d;"flat"===d.timeline&&d.cropTimeline&&(a=d.startTime||0,this.j.a=new _.Yu("crop",a,d.endTime?d.endTime-a:Infinity,!1))};ME=function(a){var b=a.a.$h(),c=a.h,d=b?b.id:null;(c?c.id:null)!==d&&b&&a.f(new _.K(_.Qf,{id:d}));a.h=b;"basic"===a.o.timeline&&(a.j.a=b)};
NE=function(a,b,c){this.h=a;this.a=b;this.f=c;this.g=new _.J("clpp.media.SegmentIterator")};OE=function(a){var b=a.h.get(a.a);if(!b)return null;0<b.a.length&&b.cb().length&&a.f>=b.a.length&&(a.a+=1,a.f=0,b=a.h.get(a.a));return b&&0<b.a.length?b.a[a.f]||null:b};_.PE=function(a){this.a=a;this.g=new _.J("clpp.media.SegmentIndex")};_.QE=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};_.RE=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};
SE=function(a,b){var c=a.ld(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.h;)--f,g=d.a[f];if(!g.h)break;c+=1;e=f-1;break}}return new NE(a,c,e)};_.lE=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)};
UE=function(a,b){this.h=a;this.l=TE(a);this.a=a.a.currentTime;this.j=Date.now()/1E3;this.o=b;this.f=function(){}};VE=function(a,b){a.f=b};WE=function(a){this.a=a};TE=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};
YE=function(a,b,c,d,e){var f=this;this.a=a;this.H=b;this.h=c;this.G=e;this.j=new _.gi;this.C=!1;this.J=a.readyState;this.l=!1;this.f=d;this.B=this.o=this.I=this.A=!1;this.j.on(a,_.Rg,function(){return XE(f)});this.w=(new _.Xh(function(){XE(f)})).Jb(.25)};
XE=function(a){if(0!==a.a.readyState){if(a.a.seeking){if(!a.C)return}else a.C=!1;if(!a.a.paused&&!a.o){a.a.readyState!==a.J&&(a.l=!1,a.J=a.a.readyState);var b=a.h.smallGapLimit,c=a.a.currentTime,d=a.a.buffered,e=a.h.gapTolerance;a:{var f=new _.lm(d);var g=a.h.gapDetectionThreshold;g=void 0===g?0:g;if(f.length&&!(1===f.length&&1E-6>f.end(0)-f.start(0)))for(var h=0;h<f.length;h++)if(f.start(h)>c&&(0===h||f.end(h-1)-c<=g)){f=h;break a}f=null}if(null==f){if(a.f){a=a.f;d=a.h;c=TE(d);d=d.a.currentTime;
e=Date.now()/1E3;if(a.a!==d||a.l!==c)a.j=e,a.a=d,a.l=c;d=e-a.j;d>=a.o&&c&&a.f(a.a,d)}}else if((0!==f||a.A)&&a.I&&(g=d.start(f),!(g>=EE(a.H)))){h=g-c;b=h<=b;var l=!1;h<e||(b||a.l||(a.l=!0,e=new _.K("largegap",{detail:{currentTime:c,gapSize:h}}),e.cancelable=!0,a.G(e),a.h.jumpLargeGaps&&!e.defaultPrevented?l=!0:_.Nh("Ignoring large gap at",c,"size",h)),!b&&!l)||(0===f?_.Nh(RC,h,"seconds because of gap before start time of",g):_.Nh(RC,h,"seconds because of gap starting at",d.end(f-1),"and ending at",
g),a.B=!0,a.a.currentTime=g)}}}};ZE=function(a){var b=this;this.f=a;this.o=10;this.l=this.h=this.j=0;this.a=new _.Xh(function(){0>=b.j?(_.Jh(["Failed to move playhead from",b.h,"to",b.l].join(" ")),b.a.stop()):b.f.currentTime!==b.h?b.a.stop():(b.f.currentTime=b.l,b.j--)})};$E=function(a,b){a.h=a.f.currentTime;a.l=b;a.j=a.o;a.f.currentTime=b;a.a.Jb(.1)};cF=function(a,b,c,d){this.a=a;this.j=b;this.o=d;this.A=c;this.l=!1;this.f=new _.gi;this.h=new ZE(a);this.w=!1;0<a.readyState?aF(this,c):bF(this,c)};
dF=function(a){return a.l?a.a.currentTime:a.A};eF=function(a,b){0<a.a.readyState?$E(a.h,b):bF(a,b)};bF=function(a,b){a.A=b;a.f.off(a.a,_.De);a.f.one(a.a,_.De,function(){aF(a,b)})};aF=function(a,b){a.w||(a.w=!0,a.o&&a.o());.001>Math.abs(a.a.currentTime-b)?fF(a):(a.f.one(a.a,_.Uf,function(){fF(a)}),$E(a.h,0===a.a.currentTime?b:a.a.currentTime))};fF=function(a){_.vl()&&!a.l&&a.j();a.l=!0;a.f.on(a.a,_.Uf,function(){return a.j()})};
jF=function(a,b,c,d,e,f,g){var h=this;this.h=a;this.a=b.presentationTimeline;this.B=b.minBufferTime||0;this.l=c;this.A=e;this.w=null;this.j=new YE(a,b.presentationTimeline,c,gF(this,a,c),f);this.f=new cF(a,function(){a:{var l=h.j;var m=l.B;l.B=!1;l.C=!0;l.A=!1;l.l=!1;l=dF(h.f);var n=hF(h,l);if(Math.abs(n-l)>h.l.gapTolerance){var p=(new Date).getTime()/1E3;if(!h.w||h.w<p-1){h.w=p;eF(h.f,n);m=void 0;break a}}h.g.debug("Seek to "+l);h.A(m?1:0);m=void 0}return m},iF(this,d,g),function(){h.j.I=!0});this.o=
(new _.Xh(function(){if(0!==h.h.readyState&&!h.h.paused){var l=dF(h.f),m=uE(h.a),n=EE(h.a);3>n-m&&(m=n-3);l<m&&(m=hF(h,l),h.g.info("Jumping forward "+(m-l)+" seconds to catch up with the seek range."),h.h.currentTime=m)}})).Jb(.25);this.g=new _.J("clpp.mse.Playhead")};lF=function(a){var b=dF(a.f);return 0<a.h.readyState&&!a.h.paused?kF(a,b):b};iF=function(a,b,c){null==b?b=Infinity>a.a.getDuration()||c?uE(a.a):EE(a.a):0>b&&(b=EE(a.a)+b);return mF(a,kF(a,b))};
mF=function(a,b){var c=a.a.getDuration();return b>=c?c-a.l.durationBackoff:b};
hF=function(a,b){if("startover"===a.a.B)return b;var c=new _.lm(a.h.buffered);c=c.Mc.bind(c);var d=Math.max(a.B,a.l.rebufferingGoal),e=a.l.safeSeekOffset,f=uE(a.a),g=EE(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);var l=FE(a.a,d),m=FE(a.a,e);d=FE(a.a,d+e);if(b>=h)return a.g.debug("Playhead past duration."),mF(a,b);if(b>g)return a.g.debug("Playhead past end."),g;if(b<f){if(c(m))return a.g.debug("Playhead before start \x26 start is buffered"),m;a.g.debug("Playhead before start \x26 start is unbuffered");
return d}if(b>=l||c(b))return a.g.debug("Playhead in safe region or in buffered region."),b;a.g.debug("Playhead outside safe region \x26 in unbuffered region.");return d};kF=function(a,b){var c=uE(a.a);if(b<c)return c;c=EE(a.a);return b>c?c:b};
gF=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new UE(new WE(b),c.stallThreshold);VE(c,function(f,g){a.g.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var h=new _.lm(b.buffered),l;if(l=_.tl("Edge/")||_.tl("Trident/")||_.qk()||_.vl())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=
h.start(l+1)-f;break a}h=null}h&&(e=Math.min(h+.1,e))}a.g.warn("Seeking forward "+e+" seconds to break stall.");b.currentTime+=e}else a.g.warn("Pausing and unpausing to break stall."),b.pause(),b.play()});return c};oF=function(a){var b=this;this.f=a;this.a=new Set;this.h=(new _.Xh(function(){nF(b,!1)})).Jb(.25)};nF=function(a,b,c){c=void 0===c?0:c;for(var d=_.u(a.a),e=d.next();!e.done;e=d.next())e.value.l(a.f.currentTime,b,c)};
pF=function(a,b){var c=a.offset||0;return b<a.startTime+c?1:b>a.endTime+c?3:2};
qF=function(a){var b=this;this.j=a;this.o=new Map;this.a=function(){};this.f=function(){};this.h=function(){};this.w=[{Vc:null,Uc:2,Kc:function(c,d){return b.a(c,d)}},{Vc:1,Uc:2,Kc:function(c,d){return b.a(c,d)}},{Vc:3,Uc:2,Kc:function(c,d){return b.a(c,d)}},{Vc:2,Uc:1,Kc:function(c,d){return b.f(c,d)}},{Vc:2,Uc:3,Kc:function(c,d){return b.f(c,d)}},{Vc:1,Uc:3,Kc:function(c,d){return b.h(c,d)}},{Vc:3,Uc:1,Kc:function(c,d){return b.h(c,d)}}]};rF=function(a,b,c,d){a.a=b;a.f=c;a.h=d};
_.sF=function(a){_.dv[a]&&delete _.dv[a]};_.tF=function(a){_.bv[a]&&delete _.bv[a]};uF=function(){this.f=new _.nE(2);this.h=new _.nE(5);this.a=0};_.vF=function(a,b,c){if(!(16E3>c)){var d=8E3*c/b;b/=1E3;a.a+=c;_.oE(a.f,b,d);_.oE(a.h,b,d)}};wF=function(a,b){if(typeof a!==typeof b||a.length!==b.length)return!1;for(var c=0;c<a.length;c++)if(a[c].serviceLocationId!==b[c].serviceLocationId||a[c].uri!==b[c].uri||a[c].params!==b[c].params)return!1;return!0};_.xF=function(a,b){this.id=a;this.ka=b};
_.yF=function(a,b){return a.ka.map(function(c){var d=new URL(c.uri+b);if(c.params){c=_.u(Object.entries(c.params));for(var e=c.next();!e.done;e=c.next()){var f=_.u(e.value);e=f.next().value;f=f.next().value;d.searchParams.set(e,f)}}return d.toString()})};zF=function(a,b){_.mm.call(this);this.A=a;this.h=null;this.B=b;this.C=new _.nk;this.f=300;this.o=new Map;this.l=new Map;this.w=new Map;this.j=new Map;this.a=null;this.g=new _.J("clpp.net.ContentSteeringManager")};
BF=function(a,b){return _.H(function(c){null!=a.a&&(a.a.stop(),a.a=null);a.o.clear();a.l.clear();a.j.clear();a.w.clear();a.g.debug("contentSteeringServerUri: "+b.contentSteeringServerUri);a.g.info("queryBeforeStart: "+b.queryBeforeStart);a.h={manifestType:b.manifestType,contentSteeringServerUri:b.contentSteeringServerUri,queryBeforeStart:b.queryBeforeStart,Mh:b.defaultServiceLocation?b.defaultServiceLocation.split(","):[]};b.baseUriCollections.forEach(function(d){var e=[];if(a.h.Mh.length)for(var f=
{},g=_.u(a.h.Mh),h=g.next();!h.done;f={Ne:f.Ne},h=g.next())f.Ne=h.value,(h=d.ka.find(function(l){return function(m){return m.serviceLocationId===l.Ne}}(f)))?e.push(h):a.g.warn("setManifestConfig: could not get default location:","pathwayId: "+f.Ne+" processedLocations:",e);e.length?a.l.set(d.id,e):a.l.set(d.id,d.ka);a.o.set(d.id,d.ka)});if(b.contentSteeringServerUri){if(a.h.queryBeforeStart)return c["return"](AF(a));a.g.info("defaultServiceLocations: "+b.defaultServiceLocation);AF(a)}_.y(c)})};
_.DF=function(a,b){var c=a.l.get(b);if(!c)return a.g.warn("getBaseUriCollectionById: invalid baseUriSetId:"+b+"."),null;var d=Date.now();a.j.forEach(function(f,g){f.Qd&&d>f.Qd&&(f.Qd=0,a.trigger(new _.K(_.Jd,{detail:{serviceLocationId:g,banned:!1,bannedSeconds:0}})))});var e=c.filter(function(f){return 0===_.CF(a,f.serviceLocationId).Qd});e.length||(e=c);e.length&&(c=a.w.get(b),wF(e,c)||(c={baseUriCollectionId:b,from:c||[],to:e},a.g.info("Steering server update baseUriCollectionId: "+c.baseUriCollectionId+
" from: "+JSON.stringify(c.from)+" to: "+JSON.stringify(c.to)),a.trigger(new _.K(_.Id,{detail:c})),a.w.set(b,e)));return new _.xF(b,e)};_.EF=function(a,b){var c=_.CF(a,b);c.Qd=Date.now()+1E3*a.f;c.ze=!1;a.g.info("service location "+b+" banned during "+a.f+IC);a.trigger(new _.K(_.Jd,{detail:{serviceLocationId:b,banned:!0,bannedSeconds:a.f}}))};_.CF=function(a,b){var c=a.j.get(b);c||(c={Qd:0,Uf:new uF,ze:!1},a.j.set(b,c));return c};
AF=function(a,b){var c,d,e,f,g,h,l;return _.H(function(m){if(1==m.a)return b=b||a.h.contentSteeringServerUri,c=FF(a,b),a.g.info("Sending request to content steering server, URI: "+c),d=_.ck(c,a.A.attemptParameters),d.type=7,e=a.B.fetch(d),_.ok(a.C,e),_.x(m,e.S,2);f=m.f;if(410===f.status)a.g.info(" Content steering server not available(HTTP response 410), stopping updates."),null!=a.a&&(a.a.stop(),a.a=null);else if(429===f.status){a.g.info("Content steering server overloaded (HTTP response 429).");
if(g=parseInt(f.headers["retry-after"],10))a.g.info("Will retry after "+g+" s based on Retry-After header."),a.f=g;GF(a,a.f)}else try{h=_.Q.ea(f.data),l=JSON.parse(h),1===l.VERSION?HF(a,l,f.uri):a.g.warn("Received unsupported steering manifest version: "+l.VERSION+", ignoring it and stop requesting.")}catch(n){a.g.error("requestInfo_: error parsing received steering manifest:",n);if(n&&7001===n.code)return m["return"]();null!=a.a&&(a.a.stop(),a.a=null);a.a=new _.Xh(function(){AF(a)});GF(a,a.f)}_.y(m)})};
FF=function(a,b){var c=new URL(b),d=[],e=[];a.j.forEach(function(f,g){f.ze&&(d.push(g),e.push(parseInt(f.Uf.getBandwidthEstimate(1E4),10)));f.ze=!1});d.length?a.h.manifestType===_.Ic?(c.searchParams.set("_DASH_pathway",'"'+d.toString()+'"'),c.searchParams.set("_DASH_throughput",e.toString())):a.h.manifestType===_.Zl&&(c.searchParams.set("_HLS_pathway",'"'+d.toString()+'"'),c.searchParams.set("_HLS_throughput",e.toString())):a.g.debug("addQueryParams_: serviceLocations EMPTY");return c.toString()};
IF=function(a,b,c,d){var e=[],f=a.o.get(b)||[];if(!c.length)return a.l.get(b);a={};c=_.u(c);for(b=c.next();!b.done;a={Md:a.Md,Xb:a.Xb,Gd:a.Gd},b=c.next())if(a.Md=b.value,b=f.find(function(g){return function(h){return h.serviceLocationId===g.Md}}(a)))e.push(b);else if(a.Xb=d.find(function(g){return function(h){return h.ID===g.Md}}(a)),a.Xb&&(b=f.find(function(g){return function(h){return h.serviceLocationId===g.Xb["BASE-ID"]}}(a))))a.Gd={serviceLocationId:a.Md,uri:b.uri,params:{}},a.Xb[YC]&&(a.Xb[YC].HOST&&
(b=new URL(b.uri),b.hostname=a.Xb[YC].HOST,a.Gd.uri=b.toString()),a.Xb[YC].PARAMS&&Object.entries(a.Xb[YC].PARAMS).forEach(function(g){return function(h){var l=_.u(h);h=l.next().value;l=l.next().value;g.Gd.params[h]=l}}(a))),e.push(a.Gd);return e};GF=function(a,b){a.g.info("Scheduling next steering manifest update in "+b+" s.");a.a.ga(b)};
HF=function(a,b,c){null!=a.a&&(a.a.stop(),a.a=null);var d=b["RELOAD-URI"]||c;a.a=new _.Xh(function(){AF(a,d)});if(c=b.TTL)a.f=c;GF(a,a.f);var e=b["PATHWAY-PRIORITY"]||[],f=b["PATHWAY-CLONES"]||[];a.j.forEach(function(g,h){e.includes(h)||a.j["delete"](h)});a.o.forEach(function(g,h){var l=IF(a,h,e,f);a.l.set(h,l)})};KF=function(a,b){this.f=a;this.a=b;this.h=JF(this);this.f.Qe(this.h)};
JF=function(a){return function(b){if(!a.a||!a.a.enabled)return Promise.resolve(b);b.headers=Object.assign({},b.headers||{});return Promise.resolve(b)}};LF=function(a,b){this.w=null;this.C=a;this.h=b;this.j=this.A=0;this.l=Infinity;this.f=this.a=null;this.B="";this.o=new Map};
MF=function(a,b,c,d){return Promise.resolve().then(function(){if(a.w&&a.h)if(null==c||null==d)a.w.parseInit(_.Oj(b));else{var e={periodStart:a.A,segmentStart:c,segmentEnd:d};e=a.w.parseMedia(_.Oj(b),e);var f=e.cues.filter(function(g){return g.startTime>=a.j&&g.startTime<a.l});a.h.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.j));a.f=Math.min(d,a.l)}})};
NF=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.h.append(e,[])};
OF=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 _.Si(l.startTime,l.endTime,l.text),g.get(h).get(f).push(l),h===a.B&&a.h.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),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))};_.PF=function(a){a=a.toLowerCase();return _.zv[a]||window.muxjs&&a===_.Hc?!0:!1};
QF=function(a,b){var c=String(_.Ik++);c=new _.Dk(c,a);c.mimeType=_.Ek(b.mimeType);if(a===_.S||a===_.T)c.label=_.Ek(b.label),c.language=_.Ek(b.language),c.originalLanguage=_.Ek(b.originalLanguage);a===_.Fk?(c.frameRate=b.frameRate,c.roles=b.roles,c.trickPlay=b.trickPlay):a===_.T?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.Ek(b.audioMimeType)):(c.kind=_.Ek(b.kind),c.roles=b.roles);c.accessibility=a===_.Fk||a===_.T?(b.accessibility||[]).filter(function(d){return d.type===a}):
b.accessibility||[];return c};
RF=function(a,b,c){var d=new _.Lk(a===_.Fk?""+b.videoId:a===_.T?""+b.audioId:""+b.id,c);switch(a){case _.Fk:d.codec=_.Ek(b.videoCodec);d.bandwidth=b.videoBandwidth||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.originalVideoId;break;case _.T:d.codec=_.Ek(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;break;default:d.codec=_.Ek(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.L.pa(e,d,null,["id","track"])}))||c.renditions.push(d);
return a||d};SF=function(a,b){var c=a.reduce(function(d,e){b===_.Fk?null===e.videoId||d[e.videoId]&&!e.activeVideo||(d[e.videoId]=e):b===_.T&&(null===e.audioId||d[e.audioId]&&!e.activeAudio||(d[e.audioId]=e));return d},{});return Object.values(c)};TF=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};
UF=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};_.VF=function(a,b){a.forEach(function(c){c.startTime+=b;c.endTime+=b})};WF=function(a){var b=a.periods[0].startTime;a=a.periods[a.periods.length-1].endTime;if(null==a)throw Error("Period end time must be known");return{start:b,end:a}};XF=function(a){return Object.assign({},a,{periods:a.periods.map(function(b){return Object.assign({},b)})})};
YF=function(a,b){if(0===a.length)throw Error("Cannot concatenate 0 manifests");if(1===a.length)return a[0];a[0].cues.forEach(function(f){f.offset=0});for(var c=_.gh(a[0].periods).concat(),d={},e=1;e<a.length;d={Oe:d.Oe},e++)d.Oe=WF(a[e-1]).end,_.VF(a[e].periods,d.Oe),c.push.apply(c,_.gh(a[e].periods)),a[e].cues.forEach(function(f){return function(g){g.offset=f.Oe}}(d));d=a.flatMap(function(f){return f.cues});c={periods:c,presentationTimeline:b,minBufferTime:0,cues:d,alternativeVariants:a[0].alternativeVariants};
d=WF(c).end;_.sE(b.a,0,d);(d=a[0].presentationTimeline.Ic())&&_.vE(b,d.seekRangeStartDateTime);return c};$F=function(a,b){try{if(1===a.length)return a[0];if(!a.every(ZF))throw new _.Zi("Period durations must be finite");return YF(a,b)}catch(c){throw new _.N(_.O,7,7003,"Failed to join manifests into a continuous playlist!",c);}};
aG=function(a,b){var c=b.periods[0].configurationId,d=_.gh(a.periods).concat().filter(function(f){return f.configurationId!==c}),e=a.presentationTimeline;d={periods:d,presentationTimeline:e,minBufferTime:0};_.wE(e,b.presentationTimeline.l);return $F([d,b],e)};ZF=function(a){return a.periods.every(function(b){return null!=b.endTime&&0<=b.endTime&&isFinite(b.endTime)})};
bG=function(a){return{id:a.id,bandwidth:a.bandwidth,trickPlay:a.video?a.video.trickPlay:!1,width:a.video?a.video.width:void 0,height:a.video?a.video.height:void 0}};cG=function(a,b){return b.find(function(c){return c.id===a.id})||null};dG=function(){this.g=new _.J("clpp.mse.TrackManager");this.m=null;this.h=[];this.a=new Map;this.f=new Map};eG=function(a,b){return a.h.filter(function(c){return c.type===b})};fG=function(a,b){var c=a.a.get(b)||null;return c&&c.track};
gG=function(a,b,c){if(!c||fG(a,c.type)!==c||a.m.va())switch(c=c?c.renditions[0]||null:null,b){case _.Fk:a.sb(c);break;case _.T:a.Gb(c);break;case _.S:a.Hb(c);break;default:throw Error("Unknown track type "+b);}};hG=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)};iG=function(a,b,c){return a.m.va()?!0:(a.a.get(c)||null)===b?!1:!0};
jG=function(a,b,c){if(0>a.h.indexOf(b.track))throw Error("Unknown rendition with ID "+b.id);if(c!==b.track.type)throw Error("Types mismatch");};
mG=function(a,b,c){jG(a,b,_.Fk);if(iG(a,b,_.Fk)){var d=a.m;a.g.info("Set video rendition with ID: "+b.id);var e=a.a.get(_.T)||null,f=null;if(e&&!e.a){var g=kG(d).filter(function(l){return l.videoId===parseInt(b.id,10)});f=g.find(function(l){return l.audioId===parseInt(e.id,10)})||null;if(!f){a.g.debug("Unable to find exact variant. Searching for equivalent");var h=e.track.renditions.map(function(l){return l.id}).filter(function(l){return l!==e.id});f=g.find(function(l){return h.find(function(m){return m===
l.audioId})})||null}}else f=kG(d).find(function(l){return l.videoId===parseInt(b.id,10)})||null;f?(a.f.set(_.Fk,b),lG(d,f,c)):a.g.warn("Cannot find matching variant")}};
pG=function(a,b){var c,d,e;_.H(function(f){switch(f.a){case 1:c=_.S;jG(a,b,c);if(!iG(a,b,c))return f["return"]();d=a.m.la().find(function(g){return g.id===parseInt(b.id,10)});if(!d)return a.g.warn("Text rendition with ID: "+b.id+" not found."),f["return"]();a.g.info("Set text rendition with ID: "+b.id);a.f.set(c,b);_.C(f,2);hG(a,b);return _.x(f,nG(a.m,!0),4);case 4:return _.x(f,oG(a.m,d),5);case 5:a.m.trigger(new _.K(_.mg));_.uh(f,0);break;case 2:e=_.E(f),a.g.warn("Failed to set text rendition",e),
_.y(f)}})};qG=function(a){var b,c,d;_.H(function(e){if(1==e.a){b=_.S;c=fG(a,b);if(!c)return e["return"]();a.g.info("Unset text rendition.");_.C(e,2);return _.x(e,nG(a.m,!1),4)}if(2!=e.a)return a.a.set(b,null),a.m.trigger(new _.K(_.mg)),_.uh(e,0);d=_.E(e);a.g.warn("Failed to unset text rendition",d);_.y(e)})};
uG=function(a){if(a.m){a.g.debug("Track list change detected, updating track list");for(var b=[],c=_.u(Object.values(_.pw)),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.la());for(var e=d.next();!e.done;c={Ac:c.Ac},e=d.next()){e=e.value;c.Ac=QF(_.S,e);var f=b.find(function(h){return function(l){return h.Ac.pa(l)}}(c));c.Ac=f||c.Ac;var g=RF(_.S,e,c.Ac);e.activeText&&a.a.set(_.S,g);f||b.push(c.Ac)}rG(a.m)||a.a.set(_.S,null);c=kG(a.m);sG(a,b,c,_.Fk);sG(a,b,c,
_.T);tG(a,b);a.h=b}};sG=function(a,b,c,d){var e=SF(c,d);c={};e=_.u(e);for(var f=e.next();!f.done;c={Bc:c.Bc},f=e.next()){f=f.value;c.Bc=QF(d,f);var g=b.find(function(l){return function(m){return l.Bc.pa(m)}}(c));c.Bc=g||c.Bc;var h=RF(d,f,c.Bc);(d===_.Fk&&f.activeVideo||d===_.T&&f.activeAudio)&&a.a.set(d,h);g||b.push(c.Bc)}};
tG=function(a,b){var c=a.m;if(c.f){var d=(d=vG(c))?wG(c.o,d).eb:null;c=c.f.muxedAudioTracks||[];if(d)for(var e=_.u(c),f=e.next();!f.done;f=e.next())f=f.value,f.active=d.id===f.id;d=c}else d=[];d=_.u(d);for(c=d.next();!c.done;c=d.next())c=c.value,e=String(_.Ik++),e=new _.Dk(e,_.T),e.mimeType="",e.label=c.label,e.language=c.language,e.originalLanguage=c.language,e.channelsCount=c.channelsCount,e.roles=[],e.accessibility=[],f=new _.Lk(""+c.id,e),f.codec="",f.bandwidth=0,f.originalId=c.label,f.a=!0,e.renditions.push(f),
b.push(e),c.active&&a.a.set(_.T,e.renditions[0])};yG=function(a,b,c,d){a.h.length||uG(a);var e=a.a.get(c)||null;(b=xG(a,b,c))&&e!==b&&(hG(a,b),c===_.T?a.m.trigger(new _.K(_.Wc)):c===_.Fk&&a.m.trigger(new _.K(_.Ng,{details:{width:b.width||0,height:b.height||0,bandwidth:b.bandwidth,track:b.track,abrSelection:d}})))};xG=function(a,b,c){return eG(a,c).flatMap(function(d){return d.renditions}).find(function(d){return parseInt(d.id,10)===b})||null};
zG=function(){this.a=new muxjs.mp4.CaptionParser;this.l=[];this.j={}};_.AG=function(){};_.CG=function(a,b,c,d,e){this.j=a;this.B=c;this.a={};this.J={};this.N=!1;this.f=null;this.h={};this.l=new _.gi;this.K=!1;this.w={};this.H=b;this.C=d;this.I=e;this.T=this.I.streaming.maxSegmentToMediaOffset||1;this.L=new _.kk;this.A="";this.G={};this.o=BG(this,this.L);this.P=!0;this.g=new _.J("clpp.mse.MediaSourceEngine")};
DG=function(a){var b=_.ol(a.mimeType,a.codecs),c=RD(a);return _.PF(b)||_.xu(c)||(_.nl(b,a.type)?!0:!1)};
BG=function(a,b){if(window.ManagedMediaSource){a.j.disableRemotePlayback=!0;var c=new ManagedMediaSource;a.l.one(c,"sourceopen",function(){URL.revokeObjectURL(a.A);b.resolve()});a.l.on(c,"startstreaming",function(){a.P=!0});a.l.on(c,"endstreaming",function(){a.P=!1});a.A=EG(c);a.j.src=a.A;return c}c=new MediaSource;a.A=EG(c);a.l.one(c,"sourceopen",function(){URL.revokeObjectURL(a.A);b.resolve()});a.j.src=a.A;return c};FG=function(a){a.g.debug("Reset transmuxers.");Object.values(a.w).forEach(function(b){return b.reset()})};
HG=function(a,b){var c,d,e,f,g,h,l,m,n;return _.H(function(p){1==p.a&&(c=_.u(b),d=c.next());if(5!=p.a){if(d.done)return p.D(0);e=d.value;f=_.u(e);g=f.next().value;h=f.next().value;l=g;m=a.a[l];return m?_.x(p,GG(a,l,m),5):(n=a.o.addSourceBuffer(h),a.l.on(n,_.ie,a.Lk.bind(a,l)),a.l.on(n,"updateend",a.Qc.bind(a,l)),a.a[l]=n,p.D(5))}a.J[l]=h;a.h[l]=[];a.G[l]=!1;d=c.next();return p.D(2)})};GG=function(a,b,c){return _.H(function(d){return _.x(d,IG(a,b,function(){c.remove(0,Infinity)}),0)})};
JG=function(a){return a.I.streaming.ignoreManagedMediaSourceStreamingHints?!0:a.P};KG=function(a,b){a.f||(a.f=new LF(a.I,a.B));var c=a.f;if(b!==_.Hc){var d=_.zv[b];if(!d)throw new _.N(_.O,2,2012,"Text parser is unavailable for "+b);c.w=new d(c.C)}};LG=function(a){return a.o?a.o.readyState===_.he:!0};NG=function(a){var b={};b.total=new _.lm(a.j.buffered,"total");b.audio=MG(a,_.Pc);b.video=MG(a,_.Jg);var c=[];a.f&&(c=[{start:a.f.Zb(),end:a.f.Ra()}]);b.text=VD(c,_.pj);return b};
MG=function(a,b){try{return new _.lm(a.a[b].buffered,b)}catch(c){return b in a.a&&a.g.error("failed to get buffered range for "+b,c),null}};OG=function(a,b){if(!a.a[b])return"";var c=MG(a,b);return c?c.toString():""};
PG=function(a,b,c,d,e,f,g,h,l){h=void 0===h?!1:h;l=void 0===l?!1:l;var m=a.a[b],n=-1,p=0;m&&m.buffered&&(p=m.buffered.length);b===_.Jg&&null!==d&&null!==e&&h&&(n=0<p?m.buffered.end(p-1):-1);b===_.pj?l=MF(a.f,c,d,e):a.w[b]?(c=a.w[b].transmux(c),c.captions&&0<c.captions.length&&(a.f||KG(a,_.kg),OF(a.f,c.captions,d,e,a.a.video.timestampOffset)),f=[],0<c.audio.byteLength&&a.a.audio&&!l&&f.push(IG(a,_.Pc,a.cg.bind(a,_.Pc,c.audio.buffer))),0<c.video.byteLength&&a.a.video&&f.push(IG(a,_.Jg,a.cg.bind(a,_.Jg,
c.video.buffer))),l=Promise.all(f)):(f&&window.muxjs&&(a.f||KG(a,_.kg),null==d&&null==e?a.H.init(c):a.H.h(c,function(q){q.length&&OF(a.f,q,d,e,a.a.video.timestampOffset)})),l=IG(a,b,a.cg.bind(a,b,c)));return l.then(function(){if(b===_.Jg&&null!==d&&null!==e&&!h)a.C.append(d,e,g),null!==d&&null!==e&&a.g.debug("Appended video segment ",d,e,"Buffer:",OG(a,b));else if(b===_.Pc&&null!==d&&null!==e)fE(a.C),null!==d&&null!==e&&a.g.debug("Appended audio segment ",d,e,"Buffer:",OG(a,b));else if(b===_.Jg&&
null!==d&&null!==e&&h){var q=m.buffered.length,t=0<q?m.buffered.end(q-1):-1;0>n&&0<q&&(n=m.buffered.start(0));0<=n&&0<t&&a.C.append(n,t,g)}if(!a.G[b]&&m&&1===m.buffered.length){q=m.buffered.start(0);var v=d-q;if(Math.abs(v)>a.T&&0===m.timestampOffset)return a.g.warn("Detected a delta of "+v+" between media times and segment times for "+(b+". The segment start time is ")+(d+" and the media start time is ")+(q+". Adjusting timestampOffset.")),q=IG(a,b,function(){a.kj(b,v)}),t=IG(a,b,a.Vh.bind(a,b,!1)),
Promise.all([q,t])}null!==d&&null!==e&&(a.G[b]=!0)})["catch"](function(q){throw q;})};QG=function(a,b){var c=a.Ra(_.Jg)||0;NF(a.f,b,c)};RG=function(a){a.f&&NF(a.f,"",0)};UG=function(a,b,c,d,e,f,g){var h,l;return _.H(function(m){if(1==m.a){h=_.Rq;if(b===h.TEXT){a.f.A=c;var n=a.f;n.j=d;n.l=e;return m["return"]()}return _.x(m,SG(a,b,f,g),2)}l=TG(a,b,c,d,e);a.N&&(l=l.concat(TG(a,h.AUDIO,c,d,e)));return _.x(m,Promise.all(l),0)})};
TG=function(a,b,c,d,e){return[IG(a,b,a.Ej.bind(a,b)),IG(a,b,a.kj.bind(a,b,c)),IG(a,b,a.mo.bind(a,b,d,e))]};WG=function(a,b){VG(a,function(){a.o.duration=b})};IG=function(a,b,c){if(a.K)return Promise.reject();c={start:c,p:new _.kk};a.h[b].push(c);1===a.h[b].length&&XG(a,b);return c.p};
XG=function(a,b){var c=a.h[b][0];if(c)try{a.g.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})),YG(a,b)}else a.g.debug("No more scheduled operations for "+b)};
VG=function(a,b){var c,d,e,f,g,h,l,m,n;return _.H(function(p){switch(p.a){case 1:if(a.K)return p["return"](Promise.reject());c=[];for(d in a.a)e=new _.kk,f={start:function(q){q.resolve()}.bind(null,e),p:e},a.h[d].push(f),c.push(e),1===a.h[d].length&&f.start();_.C(p,2);return _.x(p,Promise.all(c),4);case 4:_.uh(p,3);break;case 2:g=_.E(p);for(h in a.a)a.h[h].length&&a.h[h].shift();return p["return"](Promise.reject(g));case 3:for(l in a.a);_.C(p,5,6);return _.x(p,b(),6);case 6:_.vh(p);for(m in a.a)YG(a,
m);_.wh(p);break;case 5:return n=_.E(p),p["return"](Promise.reject(new _.N(_.O,3,3015,{mediaError:n})))}})};YG=function(a,b){a.h[b].shift();XG(a,b)};SG=function(a,b,c,d){var e,f,g;return _.H(function(h){e=_.Rq;if(b===e.TEXT||!aE()||a.I.mediaSource.codecSwitchingStrategy!==_.Zf)return h["return"]();f=a.J[b];g=_.ol(c,d);return UD(f,g)?h["return"]():_.x(h,IG(a,b,function(){a.g.info("Change MIME type of "+b+" to "+g);a.a[b].changeType(g);a.J[b]=g;a.Qc(b)}),0)})};
dH=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants}),f=e;if(b.length||c.length)f=ZG(f,b,c);f=$G(f,d);if(1<a.periods.length&&e.some(function(n){return null!=n.audio})){var g=function(n){n=n.split(".");var p=n[0];1<n.length&&(p+="."+n[1]);return p.toLowerCase()};b=[];c=_.u(a.periods);for(e=c.next();!e.done;e=c.next()){d=new Set;e=_.u(e.value.variants);for(var h=e.next();!h.done;h=e.next())h=h.value,null!==h.audio&&d.add(g(h.audio.codecs));b.push(d)}var l=b[0];c={};for(d=1;d<
b.length;c={Lf:c.Lf},d++)c.Lf=b[d],l=new Set(_.gh(l).concat().filter(function(n){return function(p){return n.Lf.has(p)}}(c)));f=f.filter(function(n){return 0===l.size&&null===n.audio?!0:0<l.size&&null===n.audio?!1:l.has(g(n.audio.codecs))})}f=aH(f);var m=bH(f);a=_.u(a.periods);for(f=a.next();!f.done;f=a.next())f=f.value,f.variants=f.variants.filter(function(n){if(cH(n)===m)return!0;_.Oh("Dropping Variant (better codec available)",n);return!1})};
eH=function(a,b,c,d){var e=a.periods.flatMap(function(f){return f.variants});if(b.length||c.length)e=ZG(e,b,c);e=$G(e,d);a=_.u(a.periods);for(b=a.next();!b.done;b=a.next())b=b.value,b.variants=b.variants.filter(function(f){return e.includes(f)})};aH=function(a){var b=new _.di;a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=cH(c);b.push(d,c)}return b};
ZG=function(a,b,c){if(!b.length&&!c.length)return a;var d=a.filter(function(g){return(g=g.audio)&&c.length&&(g=_.TD(g.codecs),c.includes(g))?!0:!1}),e=a.filter(function(g){return(g=g.video)&&b.length&&(g=_.TD(g.codecs),b.includes(g))?!0:!1}),f=a.filter(function(g){return d.length&&!e.length?d.includes(g):!d.length&&e.length?e.includes(g):d.includes(g)&&e.includes(g)});return f.length?f:a};
bH=function(a){var b="",c=Infinity;a.forEach(function(d,e){var f=e.reduce(function(g,h){return g+h.bandwidth||0},0)/e.length;_.Oh(_.zd,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};cH=function(a){var b="";a.video&&(b=_.TD(a.video.codecs));var c="";a.audio&&(c=_.TD(a.audio.codecs));return b+"-"+c};
fH=function(a,b){function c(d,e,f){return d>=e&&d<=f}return(!a.width||!a.height||c(a.width,b.minWidth,b.maxWidth)&&c(a.height,b.minHeight,b.maxHeight)&&c(a.width*a.height,b.minPixels,b.maxPixels))&&c(a.bandwidth,b.minBandwidth,b.maxBandwidth)?!0:!1};gH=function(a,b){for(var c=!1,d=_.u(a),e=d.next();!e.done;e=d.next()){e=e.value;var f=e.allowedByApplication;e.allowedByApplication=fH(e,b);f!==e.allowedByApplication&&(c=!0)}return c};
jH=function(a,b,c,d,e){e=void 0===e?!0:e;var f=!1;d.variants=d.variants.filter(function(n){if(a&&a.ca&&!CD(a,n))return _.Oh("Dropping variant - not compatible with key system",n),!1;var p=n.audio,q=n.video;if(p&&!DG(p)){var t=p.codecs;0<=p.codecs.indexOf(_.ee)?(_.Oh("Trying to use AC-3 for EC-3"),p.codecs=p.codecs.replace(_.ee,"ac-3"),DG(p)?_.Nh("Using AC-3 instead of EC-3 for",hH(p)):(p.codecs=t,_.Nh(WC,hH(p)),n.audio=null,f=!0,p=null)):(_.Nh(WC,hH(p)),n.audio=null,f=!0,p=null)}return q&&!DG(q)?
(_.Nh("Dropping variant - video not compatible with platform",hH(q)),!1):p&&b&&!iH(p,b,e)?(_.Nh("Dropping variant - not compatible with active audio","active audio",hH(b),"variant.audio",hH(p)),!1):q&&c&&!iH(q,c,e)?(_.Nh("Dropping variant - not compatible with active video","active video",hH(c),"variant.video",hH(q)),!1):!0});if(f){for(var g=!1,h=!1,l=_.u(d.variants),m=l.next();!m.done;m=l.next())m=m.value,!g&&m.video&&m.audio&&(g=!0),h||m.audio||!m.video||(h=!0);g&&h&&(d.variants=d.variants.filter(function(n){return n.video&&
!n.audio?(_.Nh("Dropping variant - not compatible with video + audio","variant.video",hH(n.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(n){var p=_.PF(_.ol(n.mimeType,n.codecs));p||_.Oh("Dropping text stream. Is not supported by the platform.",n);return p})};iH=function(a,b,c){return a.mimeType!==b.mimeType||(void 0===c||c)&&a.codecs.split(".")[0]!==b.codecs.split(".")[0]?!1:!0};
kH=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,activeVideo:!1,
activeAudio:!1,activeText:!1,type:"variant",bandwidth:a.bandwidth,language:a.language,originalLanguage:a.language,label:null,kind:l,width:null,height:null,frameRate:null,trickPlay:!1,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,spatialAudio:!1,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,accessibility:q};c&&
(a.videoId=c.id,a.originalVideoId=c.originalId,a.width=c.width||null,a.height=c.height||null,a.frameRate=c.frameRate||null,a.trickPlay=!!c.trickPlay,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};
lH=function(a){return{id:a.id,activeVideo:!1,activeAudio:!1,activeText:!1,type:_.pj,bandwidth:0,language:a.language,originalLanguage:a.originalLanguage,label:a.label,kind:a.kind||null,width:null,height:null,frameRate:null,trickPlay:!1,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,spatialAudio:!1,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,
originalTextId:a.originalId,accessibility:a.accessibility,keyId:null}};mH=function(a){return a.allowedByApplication&&a.allowedByKeySystem};
$G=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))};
_.oH=function(a,b,c,d){b=_.Gi(b);var e=a,f=a.filter(function(h){return h.primary});f.length&&(e=f);var g=e.length?e[0].language:"";e=e.filter(function(h){return h.language===g});b.some(function(h){var l=_.OD(_.Cj(h),a.map(function(m){return m.language}));return l?(e=a.filter(function(m){return _.Cj(m.language)===l}),!0):!1});d&&e.some(function(h){return h.kind===_.ke})&&(e=e.filter(function(h){return h.kind===_.ke}));if(c){b=nH(e,c);if(b.length)return b;_.Jh("No exact match for the text role could be found.")}else if(b=
e.filter(function(h){return 0===h.roles.length}),b.length)return b;b=e.map(function(h){return h.roles}).reduce(_.HD,[]);return b.length?nH(e,b[0]):e};nH=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};
hH=function(a){var b=RD(a);return a.type===_.Pc?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.Jg?"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"};
_.pH=function(){this.g=new _.J("clpp.abr");this.A=null;this.l=!1;this.w=new uF;this.f=[];this.o=1;this.C=this.B=!1;this.j=this.a=this.h=null};qH=function(a,b,c){if(a.j&&a.a.useCmsd){var d=FD(a.j);null!==d&&(a.g.debug("Using CMSD maxSuggestedBitrateKbps:",d),c=c.filter(function(e){return e.bandwidth<=1E3*d}))}a=c.filter(function(e){return!e.trickPlay});b&&(a=a.filter(function(e){return fH(e,b)}));return a.sort(function(e,f){return e.bandwidth-f.bandwidth})};rH=function(){this.a=null};
tH=function(a,b){if(b&&(null==a.a||a.a!==b))throw sH(a);};sH=function(a){return new _.N(_.O,7,7E3,a.a?"Another load operation was started while a load operation was in progress.":"Player was released while a load operation was in progress.")};uH=function(){this.a=new Map};wG=function(a,b){a.a.has(b)||a.a.set(b,new vH);return a.a.get(b)};vH=function(){this.text=this.video=this.eb=this.audio=null};wH=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)};
zH=function(a,b,c){c=void 0===c?!0:c;var d;if(!(d=!!a.audio!==!!b.audio||!!a.video!==!!b.video||a.language!==b.language)&&(d=a.audio&&b.audio)){d=a.audio;var e=b.audio;d=!(d.channelsCount===e.channelsCount&&(!c||xH(d,e))&&yH(d.roles,e.roles))}!d&&(d=a.video&&b.video)&&(a=a.video,b=b.video,d=!((!c||xH(a,b))&&yH(a.roles,b.roles)));return d?!1:!0};
xH=function(a,b){if(a.mimeType!==b.mimeType)return!1;var c=SD(a.codecs).map(function(f){return _.TD(f)}),d=SD(b.codecs).map(function(f){return _.TD(f)});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};yH=function(a,b){var c=new Set(a),d=new Set(b);c["delete"](_.Fe);d["delete"](_.Fe);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};
BH=function(a){var b=void 0===b?_.Af:b;this.f=a;this.a=b;this.h=new AH(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0,!1,b)};AH=function(a,b,c,d,e){this.j=_.Gi(a);this.a=b;this.f=c;this.l=void 0===d?!1:d;this.h=void 0===e?_.Af:e};CH=function(a,b){var c=null;b.some(function(d){c=_.OD(_.Cj(d),a.map(function(e){return ND(e)}));return!!c});return c?a.filter(function(d){return c===ND(d)}):[]};
DH=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)})};EH=function(a,b){return a.filter(function(c){return c.audio&&c.audio.spatialAudio!==b?!1:!0})};HH=function(a,b){this.a=FH;this.f=(new Map).set(FH,b).set(GH,a)};
JH=function(a){var b=this;this.F=a;this.a=a.getConfiguration().streaming;this.f=new _.gi;this.g=new _.J("clpp.mse.media.LiveEdgeObserver");IH(this)&&(a=this.F.getSurface().getMedia(),this.f.on(a,_.rg,function(){var c=b.F.getPosition(),d=b.F.getSeekRange().end;c=d-c;var e=b.F.getPlaybackRate(),f=b.a.stopChasingAt;1<=e&&c>=b.a.chaseJumpDistance?(b.g.debug("Too far from edge, jump to beginning."),b.F.setPlaybackRate(1),b.F.seek(d)):1===e&&c>=b.a.startChasingAt?(b.g.debug("Not on live edge, increase playback rate."),
b.F.setPlaybackRate(b.a.chasingRate,_.Md)):1<e&&c<=f&&(b.g.debug("On live edge, reduce playback rate."),b.F.setPlaybackRate(1))}))};
IH=function(a){return 1>=a.a.chasingRate?(a.g.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.g.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.g.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.g.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};KH=function(a){this.h=a;this.a=null;this.f=function(){}};LH=function(a,b){a.f=b};
MH=function(a){var b=this;this.f=a;this.o=this.A=this.l=!1;this.h=this.f.gi();this.w=_.Md;this.j=null;this.a=new _.Xh(function(){b.A||b.f.Mm(.25*b.h)});this.g=new _.J("clpp.mse.media.PlayRateController")};NH=function(a,b){a.j=b;a.j.speedUpMode&&(a.w=a.j.speedUpMode)};
QH=function(a,b){a.a.stop();a.l||(a.o=!1);var c=a.l?0:a.h;if((b?b:a.w)===_.Md||0===c||1===c)try{OH(a,c)}catch(d){a.g.warn('Set playbackRate using "decoder" mode fails, due to unsupported range by platform. Fallback to "seek" mode.',d),PH(a)}else PH(a)};PH=function(a){a.g.debug(XC,a.h,' using "seek" mode.');OH(a,0);a.o=!0;a.a.Jb(.25)};OH=function(a,b){if(a.f.gi()!==b){a.g.debug(XC,b,' using native playbackRate "decoder" mode.');try{a.f.so(b)}catch(c){throw c;}}};
SH=function(a){function b(){d=!0}function c(m){f.push(m);_.qn(m)}a=_.Oj(a);var d=!1,e,f=[],g=[];(new _.pn).M(_.Ne,c).M(_.tg,c).M(_.He,c).M(_.Le,c).M(_.dg,c).aa(_.fg,function(m){e=m;f.push(m);_.rn(m)}).aa("encv",b).aa("enca",b).aa("avc1",function(m){g.push({M:m,Bd:1701733238})}).aa("avc3",function(m){g.push({M:m,Bd:1701733238})}).aa("ac-3",function(m){g.push({M:m,Bd:1701733217})}).aa(_.ee,function(m){g.push({M:m,Bd:1701733217})}).aa("mp4a",function(m){g.push({M:m,Bd:1701733217})}).parse(a);if(d)return _.Nh("Init segment already indicates encryption."),
a;if(0===g.length||!e)throw _.Ph("Failed to find boxes needed to fake encryption!"),_.Ph("Failed init segment (hex):",_.Pm(a)),new _.N(_.O,3,14E3);g.reverse();for(var h=_.u(g),l=h.next();!l.done;l=h.next())l=l.value,_.Nh('Inserting "'+_.un(l.Bd)+'" box into init segment.'),a=RH(a,e,l.M,f,l.Bd);return a};
RH=function(a,b,c,d,e){var f=TH.value(),g=a.subarray(c.start,c.start+c.size),h=_.Vj(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.Vj(l);g.setUint32(4,e);l.set(f,c.size);e=h.getUint32(4);g.setUint32(c.size+16,e);UH(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.tl("Xbox One")||_.sl()?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,UH(e,d.start,d.size+l.byteLength);l=_.Vj(e,
b.start);b=_.vn(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};UH=function(a,b,c){a=_.Vj(a,b);b=a.getUint32(0);0!==b&&(1===b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.WH=function(a,b){this.F=b;this.j=a;VH(a);this.h=null;this.l=1;this.H=Promise.resolve();this.B=new Map;this.w=new Map;this.a=new Map;this.J=this.f=this.o=this.C=!1;this.I=0;this.g=new _.J("clpp.mse.Streaming");this.A=this.G=!1};
YH=function(a){var b=a.a.get(_.Jg);return b?XH(a,b.gc):(b=a.a.get(_.Pc))?XH(a,b.gc):null};$H=function(a){return _.ZH(a,_.Pc)};aI=function(a){return _.ZH(a,_.Jg)};
fI=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.H(function(q){switch(q.a){case 1:return c=_.Rq,_.x(q,a.F.X.clear(c.TEXT),2);case 2:return a.I++,a.J=!1,d=a.I,e=a.F.X,f=new Map,g=new Set,f.set(c.TEXT,b),g.add(b),_.x(q,e.init(f,!1,a.h.disableAudioTracks),3);case 3:return a.f?q["return"]():_.x(q,bI(a,g),4);case 4:if(a.f)return q["return"]();l=(h=e.getTextDisplayer().isTextVisible())||a.h.alwaysStreamText;if(a.I===d&&!a.a.has(c.TEXT)&&!a.J&&l){m=a.F.Pb();n=cI(a,m);if(null==n)return a.g.warn("Cannot set up text media state, period not found at",
m),q["return"]();p=dI(b,n,0);a.a.set(c.TEXT,p);eI(a,p,0)}_.y(q)}})};iI=function(a){a.J=!0;var b=a.a.get(_.pj);b&&(a.g.info("Unload text stream"),gI(b),hI(b)["catch"](function(){}),a.a["delete"](_.pj))};jI=function(a){var b,c;return _.H(function(d){if(1==d.a){b=_.Rq;c=a.a.get(b.AUDIO);if(!c)return d.D(0);a.g.info("Unload audio stream");gI(c);return _.x(d,hI(c)["catch"](function(){}),3)}a.a["delete"](b.AUDIO);_.y(d)})};lI=function(a,b,c,d){b.video&&_.kI(a,b.video,c,d);b.audio&&_.kI(a,b.audio,c,d)};
nI=function(a){var b,c;_.H(function(d){if(1==d.a){if(a.A)return d["return"]();a.A=!0;return _.x(d,jI(a),2)}b=_.Rq;c=a.a.get(b.VIDEO);return _.x(d,mI(a,c),0)})};pI=function(a,b){var c;_.H(function(d){if(1==d.a){if(!a.A)return d.D(2);a.A=!1;c=a.F.Pb();return _.x(d,oI(a,b,null,null,c),2)}_.kI(a,b,!0,0);_.y(d)})};rI=function(a,b){var c=a.j.periods.map(function(d){return d.id});a.g.debug("Manifest updated, periods ("+c.length+"): "+c.join(", "));a.j.periods=b.periods;VH(a.j);qI(a)};
VH=function(a){a.periods.every(function(b){return typeof b.id===_.eg})};
sI=function(a){function b(l){return a.F.X.Mc(l,c,0)}var c=a.F.Pb(),d=!1,e=cI(a,c);if(_.Lj(a.a.values(),function(l){return l.gc===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)||(mI(a,h),d=!0)}else if(!_.Lj(a.a.keys(),b)){a.g.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.u(a.a.values());for(f=d.next();!f.done;f=d.next())mI(a,f.value);d=!0}d||a.g.debug("(all): seeked: buffered seek: presentationTime\x3d"+
c)};vI=function(a,b){b=void 0===b?!1:b;if(a.f)a.g.error("Unable to retry after StreamingEngine is destroyed!");else if(a.o)a.g.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=tI(d);if(d.vd||b&&uI(d))a.g.info(e,"Retrying after failure..."),d.vd=!1,eI(a,d,.1)}};wI=function(a){return Array.from(a.a.values()).some(function(b){return null!==b.ub})};
xI=function(a){var b=Array.from(a.a.values());return a.C&&b.every(function(c){return c.endOfStream})};zI=function(a){var b,c,d,e;return _.H(function(f){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,gI(e),e.Eb&&e.ic&&(e.Eb=!1,b.push(e.ic.abort())),e.mc&&b.push(yI(a,e,!0,0));return _.x(f,Promise.all(b),0)})};AI=function(a,b,c){(a=a.a.get(b))&&c&&(gI(a),a.stream=c,a.qc=c,a.sa&&(a.sa=c.getSegmentReference(a.sa.position)),a.sa||(a.qc=null))};
_.ZH=function(a,b){var c=a.a.get(b);return c?c.uc||c.stream:null};
_.kI=function(a,b,c,d){var e=a.a.get(b.type);if(!e&&b.type===_.pj&&a.h.ignoreTextStreamFailures)fI(a,b);else if(e){var f=BI(a,b).id;if(c&&f!==e.gc)for(a.g.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())mI(a,c.value);else if(e.uc&&(a.g.debug("switch during trick play mode",b),b.trickModeVideo?(e.uc=b,b=b.trickModeVideo,a.g.debug("switch found trick play stream",b)):(e.uc=null,a.g.debug("switch found no special trick play stream"))),
CI(a,f))if(DI(a,b.id)||bI(a,new Set([b])),e.stream!==b){var g=a.j.presentationTimeline.getDuration(),h=a.F.Pb();h=EI(a,e,h);!c&&(e.endOfStream||h>=g)?a.g.debug(sD+tI(e)+" already buffered to the end. Not switching."):(b.type===_.pj&&KG(a.F.X,_.ol(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.mf=!0,a.g.debug("switch: switching to Stream "+tI(e)),FI(a,e,f)&&(a.g.info("Aborting current segment request to switch."),e.ic.abort()),c&&(e.Cc?e.Hf=!0:e.Eb?(e.mc=!0,e.Te=d,e.Hf=!0):(gI(e),
yI(a,e,!0,d)["catch"](function(l){if(a.F)a.F.onError(l)}))))}else a.g.debug(sD+tI(e)+" already active")}};CI=function(a,b){var c=a.B.get(b);return!(!c||!c.Cf)};DI=function(a,b){var c=a.w.get(b);return!(!c||!c.Cf)};
FI=function(a,b,c){if(!b.ic)return!1;var d=a.F.Pb(),e=a.F.X.Ra(b.type);c=(c=GI(a,b,d,e,c))?c.je():null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=f.je()||0);f=a.F.fe().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.j.minBufferTime||0,a.h.rebufferingGoal))return!0;a=b.ic;a=a.j?a.j.bytesRemaining:-1;return 0>a||a>c?!0:!1};
mI=function(a,b){var c,d;return _.H(function(e){c=tI(b);if(b.Cc)return a.g.debug(c,"clear: already clearing the buffer"),e["return"]();if(b.mc)return a.g.debug(c,"clear: already waiting"),e["return"]();if(b.Eb)return a.g.debug(c,"clear: currently updating"),b.mc=!0,b.Te=0,e["return"]();d=b.type;if(null==a.F.X.Zb(d))return a.g.debug(c,"clear: nothing buffered"),null==b.ub&&eI(a,b,0),e["return"]();a.g.debug(c,"clear: handling right now");gI(b);return _.x(e,yI(a,b,!1,0)["catch"](function(f){if(a.F)a.F.onError(f)}),
0)})};
oI=function(a,b,c,d,e){var f,g,h,l,m,n,p;return _.H(function(q){if(1==q.a){f=a.F.Pb();g=cI(a,f);if(null==g)return a.g.warn("Cannot initialize streams, period not found at",f),q["return"]();h=_.Rq;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.F.X;p=a.h.forceNativeTS;return _.x(q,n.init(l,p,a.h.disableAudioTracks),2)}if(3!=q.a){if(a.f)return q["return"]();qI(a);return _.x(q,bI(a,m),3)}if(a.f)return q["return"]();l.forEach(function(t,v){if(!a.a.has(v)){var z=
dI(t,g,e);a.a.set(v,z);eI(a,z,0)}});_.y(q)})};dI=function(a,b,c){return{stream:a,type:a.type,qc:null,segmentIterator:null,sa:null,uc:null,mf:!0,gc:b,endOfStream:!1,Eb:!1,ub:null,mc:!1,Te:0,Hf:!1,Cc:!1,Gg:!1,vd:!1,hj:c||0,ic:null,Xe:!1,Ai:0}};II=function(a){a.g.debug("(all) setupAllPeriods_");a.j.periods.map(function(b){return b.id}).forEach(function(b){HI(a,b)["catch"](ID)})};
HI=function(a,b){var c=a.B.get(b);if(c)return a.g.debug("(all) Period "+b+HC),c;a.g.debug("(all) setting up Period "+b);var d=new _.kk;a.B.set(b,d);var e=new Set;c=XH(a,b);for(var f=_.u(c.variants),g=f.next();!g.done;g=f.next())g=g.value,g.video&&e.add(g.video),g.video&&g.video.trickModeVideo&&e.add(g.video.trickModeVideo),g.audio&&e.add(g.audio);c=_.u(c.textStreams);for(f=c.next();!f.done;f=c.next())e.add(f.value);a.H=a.H.then(function(){return a.f?null:bI(a,e)}).then(function(){a.f||(d.resolve(),
a.g.debug("(all) setup Period "+b))})["catch"](function(h){a.f||(d["catch"](function(){}),d.reject(),a.B["delete"](b),a.g.warn("(all) failed to setup Period "+b),a.F.onError(h))});return d};
bI=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v;return _.H(function(z){switch(z.a){case 1:c=[];d=_.u(b);for(e=d.next();!e.done;e=d.next())f=e.value,(g=a.w.get(f.id))?(a.g.debug("(all) Stream "+f.id+HC),c.push(g)):(a.g.debug("(all) setting up Stream "+f.id),a.w.set(f.id,new _.kk),h=a.F.Db,c.push(f.createSegmentIndex(h)));_.C(z,2);return _.x(z,Promise.all(c),4);case 4:if(a.f)return z["return"]();_.uh(z,3);break;case 2:l=_.E(z);if(a.f)return z["return"]();m=_.u(b);for(e=m.next();!e.done;e=m.next())if(n=
e.value,p=a.w.get(n.id))p["catch"](function(){}),p.reject(),a.w["delete"](n.id);throw l;case 3:q=_.u(b);for(e=q.next();!e.done;e=q.next())t=e.value,(v=a.w.get(t.id))&&!v.done&&(v.resolve(),a.g.debug("(all) setup Stream "+t.id));_.y(z)}})};qI=function(a){var b=a.j.presentationTimeline.getDuration();Infinity>b?WG(a.F.X,b):WG(a.F.X,Math.pow(2,32))};
LI=function(a,b){function c(n){return n.type===_.pj&&n.stream.mimeType===_.Hc}if(c(b))return QG(a.F.X,b.stream.originalId||""),null;b.type===_.pj&&RG(a.F.X);if(!JG(a.F.X)&&b.type!==_.pj)return a.h.bufferLimitUpdateInterval?a.h.bufferLimitUpdateInterval/2:.5;var d=tI(b),e=a.F.Pb(),f=EI(a,b,e);a.g.debug(d,"timeNeeded\x3d"+f);var g=a.F.X.$a(b.type,e);a.g.debug(d,"update_:",nD+e,"bufferedAhead\x3d"+g);var h=Math.max(a.j.minBufferTime||0,a.h.rebufferingGoal,a.h.bufferingGoal)*a.l,l=xE(a.j.presentationTimeline);
if(null!=l&&f>=l&&!b.Xe)return JI(a,b),null;b.endOfStream=!1;l=BI(a,b.stream).id;var m=cI(a,f);null!=m&&(b.gc=m);if(m!==l)return a.g.debug(d,"need Period "+m,nD+e,"timeNeeded\x3d"+f,"currentPeriodId\x3d"+l),null;if(g>=h)return a.g.debug(d,"buffering goal met"),a.h.bufferLimitUpdateInterval||.5;g=a.F.X.Ra(b.type);g=GI(a,b,e,g,l);if(!g)return a.j.presentationTimeline.isLive()||b.type===_.pj?a.h.bufferLimitUpdateInterval||1:(a.g.debug("Media state "+d+": no next segment found. Assuming EOS."),JI(a,b),
null);d=Infinity;h=_.u(a.a.values());for(m=h.next();!m.done;m=h.next())m=m.value,c(m)||(m=EI(a,m,e),d=Math.min(d,m));if(f>=d+a.j.presentationTimeline.h)return a.h.bufferLimitUpdateInterval||1;b.hj=0;KI(a,b,e,l,g)["catch"](function(){});return null};JI=function(a,b){a.g.debug(tI(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type===_.Jg){var c=a.a.get(_.pj);c&&c.stream.mimeType===_.Hc&&(c.endOfStream=!0)}};
EI=function(a,b,c){return b.qc&&b.sa?BI(a,b.qc).startTime+b.sa.endTime:Math.max(c,b.hj)};
GI=function(a,b,c,d,e){if(null==e)return a.g.warn(NC),null;if(b.stream.segmentLookupStrategy===_.iD)b.stream.segmentIterator?a=OE(b.stream.segmentIterator):b.sa||d?(c=b.sa?b.sa.endTime:d,a.g.info(QC,"looking up segment from new stream endTime:",c),b.stream.segmentIterator=SE(b.stream.segmentIndex,c),e=b.stream.segmentIterator.next().value,null===e&&(b.stream.segmentIterator=null,a.g.warn(QC,dD,"endTime:",c,b.sa)),a=e):(e=XH(a,e),e=Math.max(0,c-e.startTime),a.g.info(QC,"looking up segment","lookupTime:",
e,mD,c),d=null,d||(b.stream.segmentIterator=SE(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value),null===d&&a.g.warn(QC,dD,"lookupTime:",e,mD,c),a=d);else{var f=tI(b);if(b.sa&&b.stream===b.qc)c=b.sa.position+1,a.g.debug(f,"next position known:","position\x3d"+c),a=MI(a,b,e,c);else{if(b.sa){a.g.debug(f,"next position unknown: another Stream buffered");f=BI(a,b.qc);var g=NI(a,b,f.startTime+b.sa.endTime,e)}else a.g.debug(f,"next position unknown: nothing buffered"),g=NI(a,b,d||c,e);if(null==
g)a=null;else if(f=MI(a,b,e,g),null==f)a=null;else{var h=null==a.h?!1:a.h.ignoreDrift;null!=d||h||(d=f,d.Ha+d.startTime+2>c&&(a=MI(a,b,e,Math.max(0,g-1)))&&(f=a));a=f}}}return a};NI=function(a,b,c,d){var e=tI(b);d=XH(a,d);var f=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(f);a.g.debug(e,"Looked up segment:",nD+c,"lookupTime\x3d"+f,fD+d.startTime,"Result: segment position\x3d"+b);null==b&&a.g.warn(e,"cannot find segment:",fD+d.startTime,"lookupTime\x3d"+f);return b};
MI=function(a,b,c,d){var e=tI(b);if(null==c)return a.g.warn(e,NC),null;c=XH(a,c);var f=b.stream.getSegmentReference(d);if(!f)return a.g.debug(e,"segment does not exist:",fD+c.startTime,"position\x3d"+d),null;var g=a.j.presentationTimeline;d=_.DE(g);g=CE(g);return!b.Xe&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.g.debug(e,"segment is not available:",fD+c.startTime,qD+f.startTime,oD+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
KI=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,v,z,A,D;return _.H(function(G){f=_.Rq;g=tI(b);h=XH(a,d);a.g.debug(g,"fetchAndAppend_:",nD+c,fD+h.startTime,pD+e.position,qD+e.startTime,oD+e.endTime);l=b.stream;m=b.stream.segmentIterator;n=a.j.presentationTimeline.getDuration();p=OI(a,d);q=Math.max(0,h.startTime-.1);t=p?p.startTime+.01:n;v=PI(a,b,h,q,t,e);b.Eb=!0;b.mf=!1;a.g.debug(g,"fetching segment");z=!1;A=function(B,F){if(a.f||a.o)return null;z=!0;return QI(a,b,c,h,l,e,B,F)};D=a.F.X.Ra(b.type)||0;
v.then(function(){return a.f||a.o?null:RI(a,b,e,!1,function(B){return A(B.data,!0)})}).then(function(B){return a.f||a.o?null:z||null===B?(SI(a,b,D,e,l),null):A(B,!1)}).then(function(){if(!a.f&&!a.o){SI(a,b,D,e,l);b.Eb=!1;b.Gg=!1;b.mc||a.F.uf();if(m){var B=m.next().value;B&&a.g.debug("New iterated segment",B)}eI(a,b,0);TI(a,b,l);a.g.debug(g,"finished fetch and append")}})["catch"](function(B){return _.H(function(F){if(a.f||a.o)return F["return"]();b.Eb=!1;if(b.type===f.TEXT&&a.h.ignoreTextStreamFailures)return 1001===
B.code?a.g.warn(g,"Text stream failed to download. Proceeding without it."):a.g.warn(g,"Text stream failed to parse. Proceeding without it."),a.a["delete"](f.TEXT),F.D(0);if(7001===B.code)return b.Eb=!1,b.ub=null,eI(a,b,0),F.D(0);if(3017===B.code)return UI(a,b,B),F.D(0);if(1001===B.code&&B.data&&404===B.data[1])return a.g.warn(g,"request for segment failed","segment not available on server",pD+e.position,qD+e.startTime,oD+e.endTime,"error\x3d"+B),b.Eb=!1,b.ub=null,eI(a,b,1),F.D(0);if(b.type===f.TEXT)return B instanceof
_.N&&B.a(1),gI(b),a.F.onError(new _.N(1,2,2010,B)),F.D(0);if(1001<=B.code&&1003>=B.code)return _.x(F,VI(a,b,h,B),0);a.g.error(g,"failed fetch and append: code\x3d"+B.code);b.vd=!0;B instanceof _.N&&B.a(_.O);return _.x(F,WI(a,B),0)})});_.y(G)})};
UI=function(a,b,c){var d=tI(b);if(Array.from(a.a.values()).some(function(f){return f!==b&&f.Gg}))a.g.debug(d,SC,"waiting for another stream to recover...");else{var e=Math.round(100*a.l);if(20<e)a.l-=.2;else if(4<e)a.l-=.04;else{a.g.error(d,"MediaSource threw QuotaExceededError too many times");b.vd=!0;a.o=!0;a.F.onError(c);return}a.g.warn(d,SC,"reducing buffering goals by "+(100-Math.round(100*a.l))+"%");b.Gg=!0}eI(a,b,4)};
VI=function(a,b,c,d){var e,f;return _.H(function(g){e=1001===d.code&&500<=d.data.status;f=!0;e||(f=!a.F.Wf(b.stream,c));if(!f)return g.D(0);b.vd=!0;d.a(_.O);return _.x(g,WI(a,d),0)})};
PI=function(a,b,c,d,e,f){var g,h,l,m,n,p,q;return _.H(function(t){g=c.startTime-f.Ha;h=b.mf||f.initSegment!==(b.sa&&b.sa.initSegment);if(!h&&g===b.Ai)return t["return"](Promise.resolve());b.Ai=g;l=tI(b);a.g.debug(l,"setting timestamp offset to "+g);a.g.debug(l,"setting append window start to "+d);a.g.debug(l,"setting append window end to "+e);m=UG(a.F.X,b.type,g,d,e,b.stream.mimeType,b.stream.codecs);if(!b.stream.initSegmentReference||!h)return t["return"](m);a.g.debug(l,"fetching init segment");
n=f&&f.initSegment||b.stream.initSegmentReference;p=RI(a,b,n,!0);q=p.then(function(v){if(a.f)return null;a.g.debug(l,"appending init segment");return XI(a,v,b).then(function(){return PG(a.F.X,b.type,v,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(v){b.mf=!0;return Promise.reject(v)});return t["return"](Promise.all([m,q]))})};
XI=function(a,b,c){var d;return _.H(function(e){if(!a.h.patchEdgeWhenMixedContent||!_.sl())return e.D(0);d=SH(b);return _.x(e,PG(a.F.X,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
QI=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l,m,n,p,q,t,v,z;return _.H(function(A){switch(A.a){case 1:l=tI(b);if(!(e&&e.keyId&&a.F.$d)){A.D(2);break}m=zD(a.F.$d,e.keyId);if(!m){a.g.warn("Unable to find DRM session for "+e.keyId);A.D(2);break}_.C(A,4);return _.x(A,m,6);case 6:_.uh(A,2);break;case 4:_.E(A),a.g.warn("DRM session load failed, cannot append segment!");case 2:if(!(e.encrypted&&e.keyId&&a.F.$d&&BD(a.F.$d,e.keyId))){A.D(7);break}gI(b);n=BI(a,e).id;p=YI(a,n);if(!p){A.D(8);break}return _.x(A,
p,8);case 8:return q=a.F.Wf(e,d,jD),t=f.startTime+d.startTime,v=f.endTime+d.startTime,a.g.warn(l,"Blocked append for "+t+" - "+v+": "+q+". Stream with Key ID "+(e.keyId+" has restrictions.")),A["return"](Promise.resolve());case 7:return z=e.closedCaptions&&0<e.closedCaptions.size,null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.pn).aa("emsg",a.Jn.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),A["return"](ZI(a,b,c).then(function(){if(a.f)return null;var D=f.startTime+d.startTime,G=f.endTime+
d.startTime;a.g.debug(l,"Appending segment with "+(D.toFixed(3)+" - "+G.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.Q.Vf(e.bandwidth)+" Fragment: ")+h);return PG(a.F.X,b.type,g,D,G,z,e.id,h,e.type===_.Jg&&null!=e.muxedAudioId&&!a.A)}).then(function(){a.f||(a.g.debug(l,"appended media segment"),b.qc=e,b.sa=f)}))}})};
SI=function(a,b,c,d,e){if(!a.j.presentationTimeline.isLive()&&b.type!==_.pj){var f=tI(b),g=(a.F.X.Ra(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.g.debug(f,"Adjusted segment",d.position,"with real duration",g,"and accounted for",c,"delta between segment duration and real duration"),b.Xe=!0,a=a.j.periods,e.adjustSegmentDurations(d.position,c),d=kE(a,e),b=a[d],e=e.getDuration(),mE(b,e),e=d+1;e<a.length;e++)a[e].startTime+=c}};
$I=function(a,b,c){(new _.pn).M(_.Ne,_.qn).M(_.tg,_.qn).M(_.He,_.qn).M(_.Le,_.qn).M(_.dg,_.qn).aa(_.fg,_.rn).M("encv",function(d){d.reader.skip(78);_.qn(d)}).M(_.Yf,_.qn).M("schi",_.qn).M("tenc",function(d){d.reader.skip(6);if(_.hn(d.reader)){d.reader.skip(1);var e=_.Pm(_.on(d.reader,16));e!==b.stream.keyId&&(a.g.debug(tI(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)};
ZI=function(a,b,c){if(a.f)return Promise.resolve();var d=tI(b);a.g.debug(d,"checking buffer length");var e=Math.max(a.h.bufferBehind,a.j.presentationTimeline.h),f=a.F.X.Zb(b.type);if(null==f)return a.g.debug(d,"buffer behind okay because nothing buffered:",nD+c,aD+e),Promise.resolve();var g=c-f,h=g-e;if(.01>=h)return a.g.debug(d,"buffer behind okay:",nD+c,bD+g,aD+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.g.debug(d,"buffer behind too large:",nD+c,bD+g,aD+e,"overflow\x3d"+h);return a.F.X.remove(b.type,
f,f+h).then(function(){a.f||a.g.debug(d,"evicted "+h+IC)})};TI=function(a,b,c){if(!a.C){b=tI(b);var d=Array.from(a.a.values());1!==d.length||d[0].type!==_.pj?a.C=d.every(function(e){return e.type===_.pj||a.G?!0:!e.mc&&!e.Cc&&e.sa}):a.G&&(a.C=!0);a.C&&(a.g.debug(b,"startup complete"),c=BI(a,c).id,OI(a,c),YI(a,c))}};YI=function(a,b){var c=null;a.B.has(b)||(c=HI(a,b).then(function(){a.f||(a.g.debug(cD),a.F.tg())})["catch"](ID));II(a);a.F.Dn&&(a.g.debug("calling onStartupComplete()..."),a.F.Dn());return c};
aJ=function(a,b){var c=tI(b),d=BI(a,b.stream).id;if(b.gc!==d){var e=b.gc,f=Array.from(a.a.values());f.every(function(g){return g.gc===e})?f.every(uI)?(a.g.debug(c,"all need Period "+e),HI(a,e).then(function(){if(!a.f)if(FG(a.F.X),f.every(function(n){var p=uI(n),q=BI(a,n.stream).id;return p&&n.gc===e&&q!==e})){var g=XH(a,e);a.g.debug(c,"Streaming period",e,g);a.g.debug(c,"calling onChooseStreams()...");var h=a.F.ug(g);a.G=!h.audio&&!h.video&&!!h.text;var l=new Map;h.video&&l.set(_.Jg,h.video);h.audio&&
l.set(_.Pc,h.audio);h.text&&l.set(_.pj,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!==_.pj){a.g.error(c,"invalid Streams chosen: missing "+h+" Stream");a.F.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===_.pj)oI(a,null,null,l.get(_.pj),g.startTime),l["delete"](h);else{a.g.error(c,"invalid Streams chosen: unusable "+h+" Stream");a.F.onError(new _.N(_.O,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))?(_.kI(a,m,!1,0),eI(a,a.a.get(h),0)):a.a["delete"](h);a.g.debug(c,cD);a.F.tg()}else a.g.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](ID)):a.g.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle"):a.g.debug(c,"not all MediaStates need Period "+e)}};cI=function(a,b){var c=iE(a.j.periods,b+_.nw);return c?c.id:null};
BI=function(a,b){var c=a.j.periods,d=kE(c,b);c=c[d];if(!c)throw new _.N(_.O,5,5006,"No period found for stream with ID "+b.id+".");return c};bJ=function(a,b){if(a.F.od){var c=b.Qa;if(c)return _.DF(a.F.od,c.id)}return null};cJ=function(a,b,c){if(a.F.od&&b){c&&0===c.request.uriIndex||_.EF(a.F.od,b.ka[0].serviceLocationId);var d=c.request,e=c.timeMs;c=c.data.byteLength;e&&c&&(a=_.CF(a.F.od,b.ka[d.uriIndex].serviceLocationId),_.vF(a.Uf,e,c),a.ze=!0)}};
RI=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=[],g=bJ(a,c);g&&(f=_.yF(g,c.xe));f.length||(f=c.cb());f=_.qE(f,c.Da,c.oa,a.h.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.qd?null:e;f.disableFragmentSupport=c.qd||a.h.disableFragmentSupport;f.disableMergedFragments=a.h.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(h){$I(a,b,h.data)}),b.type===_.Jg&&a.h.overridePasp&&f.responseModifiers.push(a.Lo.bind(a)));
a.g.debug("fetching: reference\x3d",c);c=a.F.Db.fetch(f);b.ic=c;return c.S.then(function(h){var l=a.F.fe(),m=h.timeMs,n=h.data.byteLength;m&&n&&!d&&l.segmentDownloaded(m,n);cJ(a,g,h);b.ic=null;return h.data})["catch"](function(h){cJ(a,g);throw h;})};
yI=function(a,b,c,d){var e,f,g,h;return _.H(function(l){if(1==l.a)return e=tI(b),b.mc=!1,b.Hf=!1,b.Te=0,b.Cc=!0,b.stream.segmentIterator=null,a.g.debug(e,"clearing buffer"),d?(g=a.F.Pb(),h=a.F.X.getDuration(),f=a.F.X.remove(b.type,g+d,h)):f=a.F.X.clear(b.type).then(function(){return!a.f&&c?a.F.X.flush(b.type):null}),_.x(l,f,2);if(a.f)return l["return"]();a.g.debug(e,"cleared buffer");b.qc=null;b.sa=null;b.Cc=!1;b.endOfStream=!1;b.Xe=!1;eI(a,b,0);_.y(l)})};
eI=function(a,b,c){a.g.debug(tI(b),"updating in "+c+IC);b.ub=(new _.Vh(function(){var d;return _.H(function(e){if(1==e.a)return _.C(e,2),_.x(e,a.hc(b),4);if(2!=e.a)return _.uh(e,0);d=_.E(e);if(a.F)a.F.onError(d);_.y(e)})})).ga(c)};gI=function(a){null!=a.ub&&(a.ub.stop(),a.ub=null)};XH=function(a,b){var c=a.j.periods.find(function(d){return d.id===b})||null;if(!c)throw new _.N(_.O,5,5006,"Period "+b+" not found");return c};
OI=function(a,b){var c=a.j.periods.findIndex(function(d){return d.id===b});return 0>c?null:a.j.periods[c+1]||null};hI=function(a){return _.H(function(b){return a.ic?_.x(b,a.ic.abort(),0):b.D(0)})};WI=function(a,b){var c;return _.H(function(d){switch(d.a){case 1:if(a.f)return d["return"]();if(!a.F.nj){d.D(2);break}_.C(d,3);return _.x(d,a.F.nj(b),5);case 5:_.uh(d,2);break;case 3:c=_.E(d),c.cause=b,b=c;case 2:if(!b.f)a.F.onError(b);_.y(d)}})};tI=function(a){return"("+a.type+":"+a.stream.id+")"};
uI=function(a){return!a.Eb&&null==a.ub&&!a.mc&&!a.Cc};dJ=function(){this.a=null};
gJ=function(){_.xm.call(this,eD);var a=this;this.I=eJ;this.l=this.ja=null;this.ah=0;this.rj=2;this.ed=null;this.Vg=!1;this.w=new _.gi;this.bd=this.bh=this.lf=this.J=this.dd=this.C=this.N=this.B=null;this.le=!1;this.f=this.j=this.a=this.L=this.K=null;this.h=new _.pH;this.da=this.gf=null;this.eh=1E9;this.pf=new Set;this.ha=!0;this.Ea=null;this.dh=!1;this.sj=0;this.ca=null;this.o=new uH;this.H=null;this.Kb=_.tq;this.ce=new AH(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
this.configuration.preferredAudioChannelCount,this.configuration.preferSpatialAudio,this.configuration.mediaSource.codecSwitchingStrategy);this.Xd=this.configuration.preferredTextLanguage;this.A=new rH;this.xa=this.Yb=null;this.Wc=new Map;this.ee=null;this.ff=this.configuration.preferredTextRole;this.Rd=this.configuration.preferForcedSubtitles;this.w.on(window,"online",function(){a.I===fJ&&vI(a.a)});this.wf=this.ae=this.yf=null;this.Y=_.ra;this.oe=new dJ;this.Yg=null};
hJ=function(a){return new _.cE(function(b){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,_.gh(e.value.renditions))}return d.find(function(f){return f.id===b.toString()})||null})};
iJ=function(a,b){if(a.Kb!==b){var c=_.Q.zl;if(a.Kb===_.Eq&&b!==_.tq)c=c(b,_.Cq),a.log.info(_.UC+c);else{var d=a.ah;d=0===d?0:Date.now()-d;var e=a.Kb;a.Kb=b;a.ah=Date.now();null!==a.J&&(a.J.A=b===_.Gq);a.H&&_.mq(a.H.a,a.Kb);b===_.yq&&(a.rj=a.Rg?1:2);var f=a.rj,g={currentState:a.Kb,previousState:e,timeSinceLastStateChangeMS:d,reason:b===_.yq||e===_.yq?f:void 0},h=c(e,_.Cq),l=c(b,_.Cq);c=b!==_.yq?"":"["+c(f,_.Bq)+"]";a.log.info(_.wb+h+" -\x3e "+(l+c));a.trigger(new _.K(_.bg,{detail:g}));(b===_.Aq||b===
_.Eq)&&a.bd&&a.bd.stop();b===_.yq?a.trigger(new _.K(_.ad,{detail:{bufferedTimeMS:-1,reason:f}})):e===_.yq&&a.trigger(new _.K(_.$c,{detail:{bufferedTimeMS:d,reason:f}}))}}};jJ=function(a){var b;return _.H(function(c){switch(c.a){case 1:b=a.A.a;if(!b){c.D(2);break}return _.x(c,b["catch"](function(){}),2);case 2:return a.gf&&(a.gf.release(),a.gf=null),_.x(c,_.xm.prototype.release.call(a),4);case 4:return _.x(c,a.unload(),5);case 5:iJ(a,_.tq),_.y(c)}})};
kJ=function(a){var b=new _.Zu;(a=a.playlist)&&a.cropTimeline&&(a.startTime||a.endTime)&&(b.h={start:a.startTime||null,end:a.endTime||null});return b};nJ=function(a,b){var c,d;return _.H(function(e){a.Y===_.ra?lJ(a,b.cues):a.Y===_.rb?(a.f=aG(a.f,XF(b)),c=a.configuration.playlist.endTime,d=a.f.presentationTimeline.a.a,c&&d>c&&(a.log.info("Reached end of playlist. Turning timeline static."),a.j.requestStop(),a.j=null,_.wE(a.f.presentationTimeline,!0),a.trigger(new _.K(_.Ae))),mJ(a,a.f)):rI(a.a,b);_.y(e)})};
oJ=function(a){return _.H(function(b){a.j.requestStop();a.j=null;a.Y===_.rb?a.trigger(new _.K(_.Rf)):a.trigger(new _.K(_.Ae));_.y(b)})};
mJ=function(a,b){var c=a.getMediaPosition(),d=a.ae,e=b.periods,f=d.a;d.a=[];var g=null,h=null;e=_.u(e);for(var l=e.next();!l.done;l=e.next()){l=l.value;var m=l.endTime-l.startTime;l.configurationId===g?h.a+=m:(g=l.configurationId||"",h=new _.Yu(g||"",l.startTime,m,!1),d.a.push(h))}d.h&&(h=d.h,g=h.start,h=h.end,e=d.a[0],null!=g&&e&&g>=e.f&&g<=e.f+e.a&&(l=g-e.f,l<e.a&&(e.f=g,e.a-=l)),g=d.a[d.a.length-1],null!=h&&g&&h>=g.f&&h<=g.f+g.a&&(g.a=h-g.f));GD(d,c);a:if(c=d.a,f.length!==c.length)f=!1;else{for(d=
0;d<f.length;d++)if(!f[d].pa(c[d])){f=!1;break a}f=!0}!f&&a.trigger(new _.K(_.Sf));ME(a.wf);JE(a.L,b.cues)};PJ=function(a){var b,c;return _.H(function(d){if(1==d.a)return pJ(a),_.x(d,qJ(a),2);if(3!=d.a){rJ(a);b=_.qk(4)||_.qk(5);if(!b)return d.D(3);c=a.getSurface().getMedia();sJ(a,c);return _.x(d,tJ(a,c),3)}a.configuration=a.jb;_.y(d)})};
QJ=function(a,b){return _.H(function(c){if(1==c.a){if(!a.configuration.contentSteering.enabled)return c.D(2);if(a.da)return c.D(3);a.da=new zF(a.configuration.contentSteering,a.getNetworkEngine());a.da.on(_.Id,function(d){a.trigger(d)});return _.x(c,BF(a.da,b),3)}return 2!=c.a?c["return"](a.da):c["return"](null)})};
XJ=function(a,b,c){c=void 0===c?!0:c;var d,e,f,g,h;return _.H(function(l){switch(l.a){case 1:return d=Date.now()/1E3,e=new _.kk,a.A.a=e,b.cmcd&&b.cmcd.enabled&&(a.gf=new KF(a.getNetworkEngine(),b.cmcd)),_.C(l,2),pJ(a),_.x(l,RJ(a),4);case 4:return tH(a.A,e),a.ba=_.Lq(b),a.configuration=_.vm(a.jb,b),$D(a.configuration.xmlParser),a.Yg&&a.configuration.mse.sendPlaybackSessionIdHeader&&a.getNetworkEngine().headers.set($C,a.Yg),a.log.info(_.db,a.configuration),a.log.info(_.vb,a.ba),_.x(l,SJ(a,e),5);case 5:return tH(a.A,
e),_.x(l,TJ(a,b,a.getSourceIndex(),e,!1),6);case 6:return f=l.f,tH(a.A,e),a.j=f.parser,a.f=f.manifest,lJ(a,f.manifest.cues),g=a,_.x(l,UJ(a,a.f,a.configuration),7);case 7:g.B=l.f;tH(a.A,e);if(!c){l.D(8);break}return _.x(l,VJ(a,e),9);case 9:tH(a.A,e),a.w.one(a.l,_.Ce,function(){var m=Date.now()/1E3-d;a.H&&(a.H.B=m)});case 8:e.resolve();_.uh(l,0);break;case 2:h=_.E(l),WJ(a,h,e),_.y(l)}})};
lJ=function(a,b){if(a.configuration.ads.hls.mockCuesFn){var c=a.configuration.ads.hls.mockCuesFn(a);JE(a.L,c)}else JE(a.L,b)};WJ=function(a,b,c){b=YJ(a,b,c);c["catch"](function(){});c.reject(b);a.onError(b);throw b;};YJ=function(a,b,c){var d=a.A;return null!=d.a&&d.a===c||b instanceof _.N&&7E3===b.code?b instanceof _.N?b:new _.N(_.O,7,7003,"Unexpected error.",b):sH(a.A)};RJ=function(a){return a.ja?a.ja["catch"](function(){}):Promise.resolve()};
SJ=function(a,b){var c;return _.H(function(d){if(1==d.a)return a.H=new _.rq,iJ(a,_.Fq),c=ZJ(a,a.configuration),_.x(d,tJ(a,c),2);tH(a.A,b);a.L=new HE;IE(a.L,function(e){a.log.info("Timeline cue found",e);$J(a,_.ng,e)},function(){a.log.info("Timeline cues changed");a.trigger(new _.K(_.qg))});_.y(d)})};
TJ=function(a,b,c,d,e){var f,g,h,l,m;return _.H(function(n){switch(n.a){case 1:return f=b,g=_.Lq(f),h=g[c],_.x(n,aK(a,h),2);case 2:return l=n.f,tH(a.A,d),_.$o(kD),_.x(n,bK(a,l,h,f.id||""),3);case 3:m=n.f;tH(a.A,d);if(!e||!m.presentationTimeline.l){n.D(4);break}return _.x(n,l.stop(),5);case 5:tH(a.A,d);case 4:return _.$o("manifest.end"),_.bp("Fetch and parse manifest",kD,"manifest.end"),n["return"]({parser:l,manifest:m})}})};
cK=function(a,b){var c,d,e;return _.H(function(f){if(1==f.a)return _.x(f,TJ(a,b,0,null,!0),2);c=f.f;try{return d=[a.f,XF(c.manifest)],e=$F(d,a.f.presentationTimeline),f["return"]({parser:c.parser,manifest:e})}catch(g){throw new _.N(_.O,7,7003,"Failed to append load manifest");}})};ZJ=function(a,b){var c=a.getSurface().getMedia();c.loop=!!b.loop;_.L.R(b.volume)||a.setVolume(b.volume);_.L.R(b.muted)||a.setMuted(b.muted);sJ(a,c);return c};
sJ=function(a,b){a.l||(a.w.on(b,_.ie,function(){if(a.l.error){var c=a.l.error.code;if(1===c)c=null;else{var d=a.l.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.l.error.message})}}else c=null;if(c)a.onError(c)}),a.l=b)};rJ=function(a){a.l&&(a.w.off(a.l,_.ie),a.l=null)};
qJ=function(a){var b;return _.H(function(c){switch(c.a){case 1:a.I!==dK&&(a.I=eJ);if(b=a.l)a.w.off(b,_.Ce),a.w.off(b,_.rf),a.w.off(b,_.bf),a.w.off(b,_.he),a.w.off(b,_.If),a.w.off(b,_.Df);a.L&&(a.L.release(),a.L=null);a.dd&&(a.dd.release(),a.dd=null);a.bd&&(a.bd.stop(),a.bd=null);if(!a.j){c.D(2);break}return _.x(c,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.h){c.D(4);break}return _.x(c,a.h.stop(),4);case 4:if(!a.a){c.D(6);break}return _.x(c,a.a.destroy(),7);case 7:a.a=null;case 6:if(!a.da){c.D(8);break}return _.x(c,
a.da.destroy(),9);case 9:a.da=null;case 8:a.C&&(a.C.release(),a.C=null);a.J&&(a.J.release(),a.J=null);if(!a.N){c.D(10);break}return _.x(c,a.N.destroy(),11);case 11:a.N=null;case 10:a.ed&&(a.ed.release(),a.ed=null);a.lf&&(a.lf.release(),a.lf=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.B){c.D(12);break}return _.x(c,a.B.destroy(),13);case 13:a.B=null;case 12:a.o.clear(),a.K=null,a.pf.clear(),a.f=null,a.H=null,a.ha=!0,a.Wc.clear(),a.le=!1,eK(a),_.y(c)}})};
tJ=function(a,b){var c,d,e,f,g;return _.H(function(h){if(1==h.a)return c=window.muxjs?new zG:new _.AG,d=_.kq(a.configuration,[_.re,"single-native"]),e=d.create(a),a.T=e,f=hJ(a),f.track(a),a.ed=f,g=new _.CG(b,c,e,f,a.configuration),_.x(h,g.open(),2);a.N=g;_.y(h)})};aK=function(a,b){var c,d;return _.H(function(e){if(1==e.a)return c=a.getNetworkEngine(),_.x(e,_.av(b.url,c,a.configuration.manifest.attemptParameters,b.type||null),2);d=e.f;d.configure(a.configuration.manifest);return e["return"](d)})};
bK=function(a,b,c,d){return(new _.lk(Promise.resolve().then(function(){var e,f,g;return _.H(function(h){switch(h.a){case 1:e=null;case 2:if(e){h.D(3);break}_.C(h,4);var l=c.url;var m=fK(a,d);l=b.start(l,m);return _.x(h,l,6);case 6:e=h.f;_.uh(h,2);break;case 4:f=_.E(h);if(!a.cd)throw f;return _.x(h,a.cd(c.url,f),8);case 8:if(g=h.f)c.url=g;else throw f;h.D(2);break;case 3:if(0===e.periods.length)throw new _.N(_.O,4,4014);gK(e.periods);return h["return"](e)}})}),function(){a.log.info("Aborting parser step...");
return b.stop()})).S};
UJ=function(a,b,c){var d,e,f,g,h,l,m,n;return _.H(function(p){switch(p.a){case 1:_.$o("initDrm.start");d=new _.gp({Db:a.getNetworkEngine(),onError:function(q){return a.onError(q)},xg:function(q){if(a.a){var t=vG(a),v=!1,z=Object.keys(q);0===z.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 A=1===z.length&&"00"===z[0];A&&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.");
if(z.length&&!a.configuration.disableRestrictions){z=a.getPeriods();for(var D=0;D<z.length;D++)for(var G=z[D],B=_.u(G.variants),F=B.next();!F.done;F=B.next()){F=F.value;var M=[];F.audio&&M.push(F.audio);F.video&&M.push(F.video);M=_.u(M);for(var R=M.next();!R.done;R=M.next()){R=R.value;var ka=F.allowedByKeySystem;if(R.keyId){var U=q[A?"00":R.keyId];U=!!U&&!hK.includes(U);F.allowedByKeySystem=U}ka!==F.allowedByKeySystem&&(U=R.type,R.type===_.Jg&&(U="video "+R.width+"x"+R.height+"@"+_.Q.Vf(R.bandwidth)),
a.log.warn("DRM Key not available for KID: '"+(R.keyId+"'. Applying restrictions to "+U)));G===t&&ka!==F.allowedByKeySystem&&(v=!0)}}}if(q=YH(a.a)){A=$H(a.a);z=aI(a.a);a:{D=q.variants;for(G=0;G<D.length;G++)if(D[G].audio===A&&D[G].video===z){A=D[G];break a}A=null}if(!A||A.allowedByKeySystem)a.log.info(OC),iK(a),jK(a,q.variants)}v&&q!==t&&(a.log.info(OC),iK(a),jK(a,t.variants))}},wg:function(q,t){a.trigger(new _.K(_.Xd,{expirationTime:t}))},onEvent:function(q){return a.bg(q)},getConfiguration:function(){return a.getConfiguration()},
ud:function(){return a.ud()}});e=b.periods.every(function(q){return q.variants.some(function(t){return t.drmInfos.some(function(v){return v.licenseServerUriOrigin===_.gD})})});c.drmResolver&&(c.drm=c.drmResolver({hasLaurl:e}));f=c.drm;g=_.Ym(f);d.f=g;h=f?f.offlineId||"":"";l=[];m=_.Su(b.periods);if(!h){p.D(2);break}n=_.zm(_.cf);if(!n){p.D(2);break}return _.x(p,n.l(a,m),4);case 4:return _.x(p,n.j(h),5);case 5:l=p.f;case 2:return _.x(p,_.lp(d,m,l),6);case 6:return a.B=d,kK(a,b.periods),_.$o("initDrm.end"),
_.bp("Init DRM","initDrm.start","initDrm.end"),p["return"](d)}})};
VJ=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.H(function(q){if(1==q.a)return c=a.l,lK(a,c),mK(a,a.f.periods),a.ce=new AH(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount,a.configuration.preferSpatialAudio,a.configuration.mediaSource.codecSwitchingStrategy),a.Xd=a.configuration.preferredTextLanguage,a.ff=a.configuration.preferredTextRole,a.Rd=a.configuration.preferForcedSubtitles,_.x(q,_.Dp(a.B,c),2);if(3!=q.a)return tH(a.A,
b),a.h.configure(a.configuration.abr),a.Fg&&a.h.setCmsdManager(a.Fg),a.h.init(function(t,v,z){var A,D,G;return _.H(function(B){if(1==B.a){if(a.ha)return B["return"]();A=nK(a).find(function(F){return F.id===t.id})||null;if(!A)return a.log.warn("No matching variant found for track switch"),B.D(0);D=vG(a);return _.x(B,a.j.loadVariant(A,D.id),3)}G=B.f;oK(a,G,v,z);_.y(B)})}),a.C=pK(a,c,a.configuration.startTime),a.dd=qK(a),a.J=new MH({gi:function(){return c.playbackRate},so:function(t){c.playbackRate=
t},Mm:function(t){c.currentTime+=t}}),NH(a.J,a.configuration.trickPlay),a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.lf=new JH(a)),d=Math.max(1E-4,a.configuration.streaming.rebufferingGoal),rK(a,d),sK(a)?eH(a.f,_.Gi(a.configuration.preferredVideoCodec),_.Gi(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount):dH(a.f,_.Gi(a.configuration.preferredVideoCodec),_.Gi(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount),e=tK(a),
e.h=a.configuration.streaming,a.a=e,a.I=fJ,_.x(q,e.start(),3);tH(a.A,b);a.configuration.streaming.startAtSegmentBoundary&&(f=lF(a.C),g=uK(a,f),eF(a.C.f,g));h=_.u(a.f.periods);for(l=h.next();!l.done;l=h.next())m=l.value,vK(a,m);iK(a);n=nK(a);p=n.some(function(t){return t.primary});a.configuration.preferredAudioLanguage||p||a.log.warn("No preferred audio language set.  We will choose an arbitrary language initially");jK(a,n);_.y(q)})};
lK=function(a,b){function c(d){a.l&&a.K&&(d.type===_.Uf&&a.re?(a.K.a=GH,eK(a)):d.type===_.Rg&&a.getState()===_.Hq&&.1>a.getBufferInfo().$a(a.getMediaPosition())?(a.K.a=GH,eK(a)):a.K&&wK(a));xK(a)}a.w.on(b,_.rf,c);a.w.on(b,_.bf,c);a.w.on(b,_.he,c);a.w.on(b,_.Uf,c);a.w.on(b,_.Tf,c);a.w.on(b,_.Df,c);a.w.on(b,_.Rg,c);a.w.on(b,_.If,function(){if(a.l){var d=a.l.playbackRate;0!==d&&a.J.set(d)}})};
gK=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)})){_.Oh("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)}};pK=function(a,b,c){return new jF(b,a.f,a.configuration.streaming,c,function(d){a.dd&&nF(a.dd,!0,d);a.a&&sI(a.a)},function(d){return a.dispatchEvent(d)},a.Y===_.rb)};
qK=function(a){var b=new oF(a.l),c=new KH(a.f);LH(c,function(){iK(a)});b.a.add(c);a.L&&(c=new qF(a.L),rF(c,function(d){d.rf&&d.rf();$J(a,_.og,d)},function(d){d.vg&&d.vg();$J(a,_.pg,d)},function(d,e){e||(d.rf&&d.rf(),$J(a,_.og,d),d.vg&&d.vg(),$J(a,_.pg,d))}),b.a.add(c));a.Y===_.rb&&(c=new LE(a.ae,a.oe,function(d){return a.trigger(d)},a.configuration.playlist),b.a.add(c),a.wf=c);return b};rK=function(a,b){a.K=new HH(b,Math.min(.5,b/2));a.K.a=GH;eK(a);a.bd=(new _.Xh(function(){wK(a)})).Jb(.25)};
wK=function(a){switch(a.I){case fJ:a:if(a.l.ended||LG(a.N))var b=!0;else{if(a.isLive()){b=CE(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.Ra(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.N){var d=NG(a.N);c=d.video;d=d.audio;var e=a.l.currentTime;c&&d?(c=c.$a(e),d=d.$a(e),c=Math.min(c,d)):c=c?c.$a(e):d?d.$a(e):0}else c=0;if(d=a.K){d=a.K;var f=b,g=d.f.get(d.a);e=d.a;c=f||c>=g?FH:GH;d.a=c;d=e!==c}c=d;d=yK(a);c||a.getState()===_.yq&&!d?(a.log.debug("Buffering state changed. Is buffering",
d,"buffered to end",b,"state",a.getState()),eK(a)):a.le&&xK(a)};tK=function(a){var b={configuration:{Bm:a.Y===_.rb},Pb:function(){return lF(a.C)},X:a.N,Db:a.getNetworkEngine(),od:a.da,ug:a.Kk.bind(a),tg:a.Jk.bind(a),onError:a.onError.bind(a),Ii:a.jn.bind(a),onEvent:a.bg.bind(a),Ni:a.Ko.bind(a),uf:a.yn.bind(a),fe:function(){return a.h},Wf:a.Pj.bind(a),nj:a.Ao.bind(a),$d:a.B};return new _.WH(a.f,b)};
kG=function(a){if(!a.f||!a.C)return[];var b=zK(a),c=AK(a),d=[];a=_.u(BK(a));for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=kH(e);f.activeVideo=e.video===b;f.activeAudio=e.audio===c;d.push(f)}return d};oG=function(a,b){var c,d,e;return _.H(function(f){if(1==f.a){c=CK;if(!a.f||!a.a)return f.D(0);d=vG(a);return _.x(f,a.j.loadTextStream(b.id,d.id),3)}if(4!=f.a)return e=f.f,_.x(f,fI(a.a,e),4);DK(a,d,e,!1);a.ha?a.ca=e:_.kI(a.a,e,!0,0);a.Xd=e.language;a.Rd=e.kind===c.wj;_.y(f)})};
lG=function(a,b,c){c=void 0===c?!1:c;var d=void 0===d?0:d;var e,f,g,h,l,m,n;_.H(function(p){if(1==p.a){if(!a.f||!a.a)throw Error("Player not ready to select tracks.");e=vG(a);if(!e)throw Error(TC);if(!b)return a.xa=null,null!=a.ee&&(a.ce=a.ee,a.ee=null),a.configuration.abr.enabled||(a.log.info("Enable ABR Selection"),a.configuration.abr.enabled=!0,a.h.enable()),f=jK(a,e.variants),g=f.variant,null==g||a.ha||oK(a,g),p["return"]();a.configuration.abr.enabled&&(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.h.disable());h=nK(a);l=h.find(function(q){return q.id===b.id})||null;if(!l)throw a.log.error("No variant with id",b.id),Error("Variant not found.");if(!mH(l))throw a.log.error("Unable to switch to restricted track",b.id),Error("Unable to switch to restricted track.");a.xa=l.video.id;return _.x(p,a.j.loadVariant(l,e.id),2)}m=p.f;(n=!!wG(a.o,e).eb)?m.video&&(EK(a,e,m.video,!1),_.kI(a.a,m.video,c,d)):(FK(a,e,m,!1),GK(a,m,c,d));
null==a.ee&&(a.ee=a.ce);a.ce=new BH(l);jK(a,e.variants);_.y(p)})};
IK=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z;_.H(function(A){if(1==A.a){if(a.configuration.streaming.disableAudioTracks)throw Error("Audio tracks are disabled by config.");if(!a.a||!a.f||!a.C)throw Error("Not ready to select audio track.");if(c=(a.f.muxedAudioTracks||[]).find(function(D){return D.id===b}))return HK(a,c),A["return"]();d=aI(a.a);e=$H(a.a);f=vG(a);if(!f)throw Error(TC);g=nK(a).filter(function(D){return D.audio.id===b&&mH(D)});h=!1;l=void 0;if(d){if(l=g.find(function(D){return D.video.id===
d.id}),!l&&(a.log.debug("Cannot find exact variant, looking for anything else that matches with given audioId"),h=!0,m=a.getTrackManager().La()))n=m.renditions.map(function(D){return D.id}),l=g.find(function(D){return n.find(function(G){return G===String(D.video.id)})})}else l=g[0];if(!l)throw Error("Variant with target audio track not found.");q=(p=!!wG(a.o,f).eb)?!0:e.codecs.split(".")[0]===l.audio.codecs.split(".")[0];if(!q)throw a.log.warn("Cannot select audio track, codecs are not compatible with active track."),
Error("Audio codecs not compatible with active audio.");return _.x(A,a.j.loadVariant(l,f.id),2)}t=A.f;v=t.audio;a.Yb=v.id;z=g.map(bG);a.h.setTracks(z);FK(a,f,t,!1);h||a.ha?GK(a,t,!0,0):pI(a.a,v);_.y(A)})};
HK=function(a,b){var c=vG(a);if(!c)throw Error(TC);var d=c.variants.filter(function(g){return g.video&&g.video.muxedAudioId===b.groupId&&mH(g)});if(0===d.length)throw Error("No variants containing muxed audio found.");var e=d[0],f=aI(a.a);f&&(e=d.find(function(g){return g.video.id===f.id})||null);e&&e.video&&(a.Yb=b.id,a.log.info("Select muxed audio track "+b.id),JK(a,c,b,!1),nI(a.a))};rG=function(a){var b=a.Vg;return a.f?a.N.getTextDisplayer().isTextVisible():b};
nG=function(a,b){var c,d,e,f;return _.H(function(g){c=a.Vg;d=b;if(c===d)return g["return"]();a.Vg=d;if(a.I!==fJ)return g.D(0);a.N.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.D(0);if(!b)return iI(a.a),g.D(0);e=vG(a);f=_.oH(e.textStreams,a.Xd,a.ff,a.Rd);return 0<f.length?_.x(g,fI(a.a,f[0]),0):g.D(0)})};FK=function(a,b,c,d){a.j&&a.j.setCurrentVariant(c);c.video&&EK(a,b,c.video,d);c.audio&&KK(a,b,c.audio,d)};
KK=function(a,b,c,d){var e=a.getTrackManager();if(e){var f=a.H.f;a=wG(a.o,b);a.audio=c;a.eb=null;yG(e,c.id,_.T,d);c=e.Sa();DD(f,c,d)}};EK=function(a,b,c,d){var e=a.getTrackManager();if(e){var f=a.H.f;wG(a.o,b).video=c;yG(e,c.id,_.Fk,d);a=e.ma();f.j!==a&&(f.j=a,f.a.push({timestamp:Date.now()/1E3,id:a.id,trackId:a.track.id,type:a.track.type,fromAdaptation:d,width:a.width,height:a.height,bandwidth:a.bandwidth}))}};
JK=function(a,b,c,d){b=wG(a.o,b);b.audio=null;b.eb=c;if(b=a.getTrackManager())a=a.H.f,yG(b,c.id,_.T,d),c=b.Sa(),DD(a,c,d)};DK=function(a,b,c,d){wG(a.o,b).text=c;if(b=a.getTrackManager())yG(b,c.id,_.S,d),c=b.Wa(),a=a.H.f,a.h!==c&&(a.h=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}))};LK=function(a){return a.Y===_.rb&&"flat"===a.configuration.playlist.timeline};
mK=function(a,b){for(var c=0;c<b.length;c++){for(var d=b[c],e=new Map,f=_.u(nK(a)),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.eh++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,Ha:0,mimeType:_.Hc,codecs:"",kind:_.dd,encrypted:!1,
keyId:null,language:g.closedCaptions.get(l),label:null,type:_.pj,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,spatialAudio:!1,closedCaptions:null};e.set(l,m)}}e=_.u(e.values());for(f=e.next();!f.done;f=e.next())d.textStreams.push(f.value)}};
kK=function(a,b){for(var c=a.a?$H(a.a):null,d=a.a?aI(a.a):null,e=!sK(a),f=_.u(b),g=f.next();!g.done;g=f.next())jH(a.B,c,d,g.value,e);c=PD(b,function(h){return h.variants.some(mH)});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,(g=e.video)&&!QD(g.type,_.ol(g.mimeType,g.codecs))&&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,gH(d.variants,a.configuration.restrictions)&&a.a&&vG(a)===d&&iK(a),MK(a,d.variants)};
vK=function(a,b){var c=a.a?$H(a.a):null,d=a.a?aI(a.a):null,e=!sK(a);jH(a.B,c,d,b,e);d=b.variants;if(a.configuration.streaming.disableAudioTracks)for(c=_.u(d),e=c.next();!e.done;e=c.next())delete e.value.audio;if(!d.some(mH))throw new _.N(_.O,4,4011);MK(a,b.variants);gH(d,a.configuration.restrictions)&&a.a&&vG(a)===b&&iK(a);if(!_.qk(2)&&(c=a.B?a.B.getDrmInfo():null))for(d=_.u(d),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,_.Gp(a.B,g.keyId,g.initData)||_.wp(a.B,g.initDataType,g.initData,g.keyId)}}};GK=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.ha?(a.Ea=b,a.dh=c,a.sj=d):lI(a.a,b,c,d)};NK=function(a){if(a.a&&a.f){var b=YH(a.a),c=vG(a);null!=b&&b===c&&($H(a.a),aI(a.a),_.ZH(a.a,_.pj),wG(a.o,c),wG(a.o,c),wG(a.o,c),wG(a.o,c))}};
uK=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=$H(a.a),e=aI(a.a),f=vG(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};yK=function(a){return a.B&&a.B.G?!0:a.K?a.K.getState()===GH:!1};
eK=function(a){if(a.H&&a.K&&a.C){var b=OK(a)===_.yq,c=a.J;c.l=b;QH(c,c.o?"seek":void 0);a.C.j.o=b;xK(a);a.wf&&(c=1>Math.abs(a.getMediaDuration()-a.getMediaPosition()),a=a.wf,b&&c&&(b=a.a,b.a[b.a.length-1]&&a.f(new _.K(_.Pf))))}};xK=function(a){iJ(a,OK(a))};OK=function(a){if(a.re)var b=!1;else if(a.l&&a.l.ended)b=!0;else{b=a.getMediaDuration();var c=a.getMediaPosition();b=a.le&&0<=c&&b<=c?!0:!1}return b?_.Aq:yK(a)||a.re?_.yq:a.l&&a.l.paused?_.Gq:_.Hq};
jK=function(a,b){var c=PK(a,b);if(!c)return{variant:null,eb:null};var d=QK(a,c);return{variant:c,eb:d}};QK=function(a,b){if(!b||!b.video)return null;var c=(a.f.muxedAudioTracks||[]).find(function(d){return d.groupId===b.video.muxedAudioId});return c&&c.primary?c:null};
PK=function(a,b){try{MK(a,b)}catch(f){return a.onError(f),null}var c=b.filter(function(f){return mH(f)}),d=TF(c,a.Yb);c=a.ce.create(d);c=Array.from(c.values());var e=c.map(bG);a.h.setTracks(e);if(null!==a.xa&&null!==a.Yb&&(e=c.find(function(f){return f.video.id===a.xa&&f.audio.id===a.Yb}),a.xa=null,e))return e;if(a.configuration.abr.enabled||null===a.xa)return d=a.h.chooseTrack(),cG(d,c);d=d.find(function(f){return null!==f.video&&f.video.id===a.xa});return d?d:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
d=a.h.chooseTrack(),cG(d,c))};RK=function(a,b){return _.oH(b,a.Xd,a.ff,a.Rd)[0]||null};SK=function(a,b,c){c=void 0===c?!0:c;var d,e,f,g;_.H(function(h){if(1==h.a)return d=jK(a,b.variants),e=d.variant,a.Yb=e&&e.audio&&e.audio.id,e?_.x(h,a.j.loadVariant(e,b.id),3):h.D(2);2!=h.a&&(f=h.f,FK(a,b,f,!0),GK(a,f,c));(g=RK(a,b.textStreams))&&(a.configuration.streaming.alwaysStreamText||rG(a))&&(DK(a,b,g,!0),a.ha?a.ca=g:_.kI(a.a,g,!0,0));_.y(h)})};
VK=function(a,b){a.ha=!0;a.h.disable();a.log.debug("Choosing new streams after period changed");var c=jK(a,b.variants),d=c.variant,e=c.eb,f=RK(a,b.textStreams);a.Ea&&(b.variants.includes(a.Ea)&&(d=a.Ea),a.Ea=null);a.ca&&(b.textStreams.includes(a.ca)&&(f=a.ca),a.ca=null);var g=d?d.video:null,h=d&&!e?d.audio:null;d&&a.j&&a.j.setCurrentVariant(d);g&&TK(a,b,function(){return EK(a,b,g,!0)});h&&TK(a,b,function(){return KK(a,b,h,!0)});e&&TK(a,b,function(){return JK(a,b,e,!0)});f&&(a.configuration.streaming.alwaysStreamText||
rG(a))&&TK(a,b,function(){return DK(a,b,f,!0)});b===vG(a)&&UK(a);c=a.configuration.streaming.alwaysStreamText||rG(a)?f:null;return{video:g,audio:h,text:c,eb:e}};oK=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;if(a.configuration.abr.enabled&&a.a){var e=WK(a,b);if(wG(a.o,e).eb){var f=b.video;if(f){TK(a,e,function(){return EK(a,e,f,!0)});e===vG(a)&&UK(a);_.kI(a.a,f,c,d);return}}TK(a,e,function(){FK(a,e,b,!0)});e===vG(a)&&UK(a);lI(a.a,b,c,d)}};
iK=function(a){var b=a.getTrackManager();b&&a.I!==dK&&(b.m&&(uG(b),b.m.trigger(new _.K(_.sg))),UK(a))};UK=function(a){var b=vG(a);if(b){var c=a.Wc.get(b)||[];for(a.Wc["delete"](b);c.length;)c.shift()()}};TK=function(a,b,c){a.Wc.has(b)||a.Wc.set(b,[]);a.Wc.get(b).push(c)};$J=function(a,b,c){a.trigger(new _.K(b,{detail:GE(c,LK(a))}))};
MK=function(a,b){var c=a.B?_.L.ih(a.B.ja):{},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?hK.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,
missingKeys:g,restrictedKeyStatuses:h});};BK=function(a){if(null==vG(a))return[];NK(a);return nK(a).filter(function(b){return mH(b)})};XK=function(a){var b=vG(a);if(null==b)return[];NK(a);return a.f.alternativeTextStreams?a.f.alternativeTextStreams:b.textStreams.filter(function(c){return!a.pf.has(c)})};vG=function(a){var b=lF(a.C),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};AK=function(a){var b=vG(a);return b?wG(a.o,b).audio:null};
zK=function(a){var b=vG(a);return b?wG(a.o,b).video:null};WK=function(a,b){for(var c=_.u(a.f.periods),d=c.next();!d.done;d=c.next())if(d=d.value,d.variants.some(function(e){return e.id===b.id}))return d;return null};pJ=function(a){if(a.I===dK)throw new _.N(_.O,7,7E3,"Player is destroyed.");};
YK=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,v,z,A,D,G,B,F,M,R,ka;return _.H(function(U){switch(U.a){case 1:return e=_.Rq,_.C(U,2),_.x(U,_.av(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null),4);case 4:f=U.f;f.configure(a.configuration.manifest);var qa=f;var Ba=b.url,Ca=fK(a,a.configuration.id||"");qa=qa.start(Ba,Ca);return _.x(U,qa,5);case 5:g=U.f;gK(g.periods);if(!g.periods.length)throw new _.N(_.O,4,4014);return _.x(U,a.j.stop(),6);case 6:a.j=f;h=d&&d.id;l=c&&
c.id;a.f.periods=g.periods;m=iE(g.periods,lF(a.C))||g.periods[0];sK(a)?eH(a.f,_.Gi(a.configuration.preferredVideoCodec),_.Gi(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount):dH(a.f,_.Gi(a.configuration.preferredVideoCodec),_.Gi(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);n=UF(h,l,m.variants);p=RK(a,m.textStreams);jK(a,m.variants);q=n&&n.video;t=n&&n.audio;v=[];z=new Set;A=_.u(m.variants);for(D=A.next();!D.done;D=A.next())G=D.value,
G.video&&z.add(G.video),G.audio&&z.add(G.audio);B=a.getNetworkEngine();F=_.u(_.gh(z).concat(_.gh(m.textStreams)));for(M=F.next();!M.done;M=F.next())R=M.value,v.push(R.createSegmentIndex(B));return _.x(U,Promise.all(v),7);case 7:AI(a.a,e.AUDIO,t);AI(a.a,e.VIDEO,q);AI(a.a,e.TEXT,p);n&&FK(a,m,n,!1);a.log.info("Switch CDN successful.");_.uh(U,0);break;case 2:ka=_.E(U);if(!f){U.D(8);break}return _.x(U,f.stop(),8);case 8:throw ka;}})};
fK=function(a,b){return{networkingEngine:a.getNetworkEngine(),onContentSteeringInfoFound:function(c){return QJ(a,c)},configurationId:b,filterNewPeriod:function(c){return vK(a,c)},filterAllPeriods:function(c){return kK(a,c)},onEvent:function(c){return a.bg(c)},onError:function(c){return a.onError(c)},onUpdate:function(c){return nJ(a,c)},onTurnedStatic:function(){return oJ(a)},fe:function(){return a.h}}};
sK=function(a){return a.configuration.mediaSource.codecSwitchingStrategy===_.Zf&&(_.qk(2)||_.qk(3)||_.qk(4)||_.qk(5)||_.qk(6)||_.rk()&&38===_.ul().major||_.rk()&&53===_.ul().major||_.rk()&&68===_.ul().major?!1:!0)};nK=function(a){return a.f.alternativeVariants&&0<a.f.alternativeVariants.length?a.f.alternativeVariants:a.C?vG(a).variants:a.f.periods[0].variants};ZK=function(){};
$K=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}};aL=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};bL=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"===b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
cL=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!==_.TD(b)&&a(b)}};
dL=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)}};
eL=function(a){_.$v.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=_.Pd;c.label===VC&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.rD,VC));this.a.mode=_.qe};fL=function(a,b){var c=a.mode;a.mode=c===_.Vf?_.Vf:_.qe;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};gL=function(){};_.zj.prototype.f=_.tD(0,function(){return this.keyInfo});var vD=[112,115,115,104,0,0,0,0],CK={gh:_.hg,Qo:_.dd,wj:_.ke};
_.LD.prototype.je=function(){return this.oa?this.oa-this.Da+1:null};_.LD.prototype.f=function(){return this.keyInfo};_.WD.prototype.getAttribute=function(a){a=this.attributes[a];return null==a?null:a};_.r=_.ZD.prototype;_.r.we=function(a,b){var c=YD(a).childNodes[0];return b&&c.tagName!==b?null:c};_.r.Ka=function(a,b){var c=this.$(a,b);return 1!==c.length?null:c[0]};_.r.$=function(a,b){return Array.from(a.childNodes).filter(function(c){return c.tagName===b})};_.r.ac=_.eh(1);_.r.Fc=_.eh(3);
_.r.ra=function(a){return a.childNodes.every(function(b){return b.tagName===_.da||"#cdata"===b.tagName})?a.childNodes.map(function(b){return b.textContent}).join(""):null};_.r.getAttributeNS=function(a,b,c){return(b=a.a.get(b))?a.attributes[b+":"+c]||null:null};_.r.W=_.eh(5);_.r.Ze=_.eh(7);_.r.zf=_.eh(11);_.r.removeChild=function(a,b){a.childNodes=a.childNodes.filter(function(c){return c!==b})};_.r.kf=_.eh(13);_.r.jf=_.eh(15);_.r.md=_.eh(9);_.r.Af=_.eh(17);_.r.De=_.eh(19);_.hL=0;_.r=_.cE.prototype;
_.r.track=function(a){null!=this.player&&eE(this);a&&(this.player=a,this.player.on(_.Nf,this.jd,this))};_.r.release=function(){eE(this);this.U=[];this.f=this.h=null};
_.r.append=function(a,b,c){c=void 0===c?null:c;var d=this.h&&null!==c?this.h(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.U.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.U);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=b);this.U.push(c);this.U.sort(bE)}gE(this);this.jd();this.player&&this.player.trigger(new _.K(_.Mg))};_.r.clear=function(){this.U=[];gE(this);this.player&&(this.player.trigger(new _.K(_.Mg)),this.player.trigger(new _.K(_.Vc)))};
_.r.jd=function(){if(this.player){var a=this.player.getMediaPosition();if(0<=a){a:{for(var b=this.U.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.U[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.U[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.U[0].rendition:null}if(a&&this.f!==a&&(this.f=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 _.K(_.Yc,
{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};rE.prototype.cc=function(){return this.h};rE.prototype.getDuration=function(){return this.f?this.a-this.h:Infinity};_.r=_.tE.prototype;_.r.Ic=function(){return this.L};_.r.getDuration=function(){return 2===this.j.version?this.a.getDuration():this.f};_.r.getPresentationStartTime=function(){return this.G};_.r.offset=function(a){null!=this.w&&(this.w+=a);null!=this.o&&(this.o+=a)};
_.r.isLive=function(){return 2===this.j.version?!this.a.f:Infinity===this.f&&!this.l};_.r.qe=function(){return!this.l};HE.prototype.release=function(){this.f=function(){};this.h=function(){};this.a.clear()};HE.prototype.cues=function(){return this.a};LE.prototype.release=function(){this.f=this.j=this.h=this.a=null};LE.prototype.l=function(a){GD(this.a,a);ME(this)};
NE.prototype.next=function(){var a=this.h.get(this.a);a&&0<a.a.length?(this.f+=1,a.cb().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=OE(this);return{value:a,done:!a}};_.r=_.PE.prototype;_.r.destroy=function(){this.a=[];return Promise.resolve()};
_.r.ld=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.g.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.g.debug("SegmentIndex Ref "+a+" start: "+b.startTime+" end: "+b.endTime+" pos: "+b.position);return null};
_.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.g.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.Ha-=a};
_.r.Nd=function(a,b){var c=a-this.a[0].position;if(0<=c&&c<this.a.length)for(this.g.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 0===this.a.length?0:this.a[this.a.length-1].endTime-this.a[0].startTime};
_.r.ta=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.g.info("Refusing to rewrite original references on update!"):(.1<Math.abs(f.endTime-g.endTime)?(f=new _.zj(f.position,g.startTime,g.endTime,g.cb,g.Da,g.oa,g.Ha,g.keyInfo,g.qd,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile,null,null,g.xe,g.Qa),b.push(f)):b.push(f),d++),e++)}for(;d<this.a.length;)b.push(this.a[d++]);
if(b.length)for(d=b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.zj(d++,f.startTime,f.endTime,f.cb,f.Da,f.oa,f.Ha,f.keyInfo,f.qd,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile,null,null,f.xe,f.Qa),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 _.zj(e-d--,f.startTime,f.endTime,f.cb,f.Da,f.oa,f.Ha,f.keyInfo,f.qd,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile,null,null,
f.xe,f.Qa));b=_.u(b);for(f=b.next();!f.done;f=b.next())a.push(f.value)}this.a=a};_.r.replace=function(a){this.a=a};UE.prototype.release=function(){this.h=null;this.f=function(){}};YE.prototype.release=function(){this.j&&(this.j.release(),this.j=null);null!=this.w&&(this.w.stop(),this.w=null);this.f&&(this.f.release(),this.f=null);this.a=this.H=this.G=null;this.o=!1};YE.prototype.uf=function(){this.A=!0;XE(this)};ZE.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};
cF.prototype.release=function(){this.f&&(this.f.release(),this.f=null);null!=this.h&&(this.h.release(),this.h=null);this.j=function(){};this.a=null;this.o=function(){};this.w=!1};jF.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.h=this.f=this.a=this.l=null;this.A=function(){}};oF.prototype.release=function(){this.h.stop();for(var a=_.u(this.a),b=a.next();!b.done;b=a.next())b.value.release();this.a.clear()};
qF.prototype.release=function(){this.j=null;this.o.clear();this.a=function(){};this.f=function(){};this.h=function(){}};qF.prototype.l=function(a,b,c){if(this.j)for(var d={},e=_.u(this.j.cues()),f=e.next();!f.done;d={Pf:d.Pf,Ie:d.Ie},f=e.next()){f=f.value;d.Pf=this.o.get(f)||null;d.Ie=pF(f,a);this.o.set(f,d.Ie);var g=this.w.find(function(h){return function(l){return l.Vc===h.Pf&&l.Uc===h.Ie}}(d));g&&g.Kc(f,b&&0===c)}};
uF.prototype.getBandwidthEstimate=function(a){return 128E3>this.a?a:Math.min(_.pE(this.f),_.pE(this.h))};_.w(zF,_.mm);zF.prototype.destroy=function(){this.B=this.h=this.A=null;this.o.clear();this.l.clear();this.j.clear();this.w.clear();null!=this.a&&(this.a.stop(),this.a=null);return this.C.destroy()};KF.prototype.release=function(){this.f.Bf(this.h)};_.r=LF.prototype;_.r.destroy=function(){this.h=this.w=null;this.o.clear();return Promise.resolve()};
_.r.remove=function(a,b){var c=this;return Promise.resolve().then(function(){!c.h||!c.h.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.Zb=function(){return this.a};_.r.Ra=function(){return this.f};_.r.Mc=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.r.$a=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};_.w(dG,_.gl);_.r=dG.prototype;_.r.initialize=function(a){this.m=a};_.r.release=function(){this.h=[];this.a.clear();this.f.clear()};_.r.load=function(){};_.r.destroy=function(){this.release();this.m=null};_.r.getVideoTracks=function(){return eG(this,_.Fk)};_.r.getAudioTracks=function(){return eG(this,_.T)};_.r.la=function(){return eG(this,_.S)};_.r.ma=function(){return this.a.get(_.Fk)||null};_.r.Sa=function(){return this.a.get(_.T)||null};_.r.Wa=function(){return this.a.get(_.S)||null};
_.r.Ab=function(){return this.f.get(_.Fk)||null};_.r.Mb=function(){return this.f.get(_.T)||null};_.r.Nb=function(){return this.f.get(_.S)||null};_.r.La=function(){return fG(this,_.Fk)};_.r.qa=function(){return fG(this,_.T)};_.r.Ba=function(){return fG(this,_.S)};_.r.Ib=function(a){this.m&&gG(this,_.Fk,a)};_.r.Ia=function(a){this.m&&gG(this,_.T,a)};_.r.Xa=function(a){this.m&&gG(this,_.S,a)};
_.r.sb=function(a,b){b=void 0===b?!1:b;if(this.m)if(a)mG(this,a,b);else{var c=b,d=fG(this,_.Fk);d&&(this.g.info("Unset video rendition."),d.trickPlay?this.g.info("Enabling ABR for trick play tracks is not supported"):(this.g.info("Enable ABR."),lG(this.m,null,c)))}};_.r.Gb=function(a){this.m&&(a?(jG(this,a,_.T),iG(this,a,_.T)&&(this.g.info("Set audio rendition with ID: "+a.id),this.f.set(_.T,a),IK(this.m,parseInt(a.id,10)))):this.g.info("Enabling ABR for audio is not supported"))};
_.r.addTextTrack=function(a){var b=this;return _.H(function(c){return b.m?_.x(c,b.m.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label),0):c["return"]()})};_.r.va=function(){return!!this.m&&this.m.va()};
_.r.Hb=function(a){if(this.m){var b=a;if(!a){var c=this.Wa();if(c&&c.track.kind!==_.ke){a=this.la().find(function(e){return e.kind===_.ke&&e.language===c.track.language});if(!a){var d=this.qa();d&&(a=this.la().find(function(e){return e.kind===_.ke&&e.language===d.language}))}a&&(b=a.renditions[0])}}b?pG(this,b):qG(this)}};dG.prototype.setTextRendition=dG.prototype.Hb;dG.prototype.isAbrEnabled=dG.prototype.va;dG.prototype.addTextTrack=dG.prototype.addTextTrack;dG.prototype.setAudioRendition=dG.prototype.Gb;
dG.prototype.setVideoRendition=dG.prototype.sb;dG.prototype.setTextTrack=dG.prototype.Xa;dG.prototype.setAudioTrack=dG.prototype.Ia;dG.prototype.setVideoTrack=dG.prototype.Ib;dG.prototype.getTextTrack=dG.prototype.Ba;dG.prototype.getAudioTrack=dG.prototype.qa;dG.prototype.getVideoTrack=dG.prototype.La;dG.prototype.getLoadingTextRendition=dG.prototype.Nb;dG.prototype.getLoadingAudioRendition=dG.prototype.Mb;dG.prototype.getLoadingVideoRendition=dG.prototype.Ab;dG.prototype.getTextRendition=dG.prototype.Wa;
dG.prototype.getAudioRendition=dG.prototype.Sa;dG.prototype.getVideoRendition=dG.prototype.ma;dG.prototype.getTextTracks=dG.prototype.la;dG.prototype.getAudioTracks=dG.prototype.getAudioTracks;dG.prototype.getVideoTracks=dG.prototype.getVideoTracks;zG.prototype.init=function(a){var b=muxjs.mp4.probe;a=_.Oj(a);this.l=b.videoTrackIds(a);this.j=b.timescale(a)||{};this.a.init()};zG.prototype.h=function(a,b){var c=_.Oj(a);(c=this.a.parse(c,this.l,this.j))&&c.captions&&b(c.captions);this.a.clearParsedCaptions()};zG.prototype.f=function(){this.a.resetCaptionStream()};_.AG.prototype.init=function(){};_.AG.prototype.h=function(){};_.AG.prototype.f=function(){};_.r=_.CG.prototype;
_.r.destroy=function(){var a=this;window.ManagedMediaSource&&(this.j.disableRemotePlayback=!1);this.K=!0;var b=[],c;for(c in this.h){var d=this.h[c],e=d[0];this.h[c]=d.slice(0,1);e&&b.push(e.p["catch"](ID));for(e=1;e<d.length;++e)d[e].p["catch"](ID),d[e].p.reject()}this.f&&b.push(this.f.destroy());this.B&&b.push(this.B.destroy());for(var f in this.w)this.w[f].destroy(),delete this.w[f];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.A="";a.o=null;a.f=null;a.B=null;a.a={};a.J={};a.w={};a.G={};a.H=null;a.N=!1;for(var g in a.h);a.h={}})};_.r.open=function(){return this.L};
_.r.init=function(a,b,c){c=void 0===c?!1:c;var d=this,e,f,g,h,l,m,n,p,q,t,v,z,A;return _.H(function(D){switch(D.a){case 1:return e=_.Rq,_.x(D,d.L,2);case 2:f=_.u(a),g=f.next();case 3:if(g.done){D.D(0);break}h=g.value;l=_.u(h);m=l.next().value;p=n=l.next().value;q=m;t=_.ol(p.mimeType,p.codecs);if(q===e.TEXT){KG(d,t);D.D(4);break}v=new Map;v.set(q,t);_.xu(t)&&b&&!p.aesEncrypted||!_.nl(t,q)||!(z=_.nl(t))||(A=z(),d.w[q]=A,v=A.demuxMimeTypes(q,t),c&&v["delete"](e.AUDIO));return _.x(D,HG(d,v),7);case 7:d.N=
v.has(e.AUDIO)&&v.has(e.VIDEO);case 4:g=f.next(),D.D(3)}})};_.r.Zb=function(a){return a===_.pj?this.f.Zb():(a=MG(this,a))?a.Zb():null};_.r.Ra=function(a){return a===_.pj?this.f.Ra():(a=MG(this,a))?a.Ra():null};_.r.Mc=function(a,b,c){return a===_.pj?this.f.Mc(b):(a=MG(this,a))?a.Mc(b,!1,c):!1};_.r.$a=function(a,b){if(a===_.pj)return this.f.$a(b);var c=MG(this,a);return c?c.$a(b):0};
_.r.remove=function(a,b,c){var d=this;return a===_.pj?this.f.remove(b,c):IG(this,a,this.ej.bind(this,a,b,c)).then(function(){if(a===_.Jg){var e=d.Zb(a),f=d.Ra(a);null!==e&&null!==f&&hE(d.C,e,f)}else a===_.Pc&&(e=d.C,e.player&&e.player.trigger(new _.K(_.Vc)))})};_.r.clear=function(a){if(a===_.pj){if(!this.f)return Promise.resolve();this.H.f();return this.f.remove(0,Infinity)}return IG(this,a,this.ej.bind(this,a,0,this.o.duration))};
_.r.flush=function(a){return a===_.pj?Promise.resolve():IG(this,a,this.Vh.bind(this,a))};_.r.endOfStream=function(a){var b=this;return VG(this,function(){LG(b)||(a?b.o.endOfStream(a):b.o.endOfStream())})};_.r.getDuration=function(){return this.o.duration};_.r.cg=function(a,b){this.g.debug("Appending data to "+a+GC);try{this.a[a].appendBuffer(b)}catch(c){throw this.g.warn("Failed to append data for "+a,c),c;}this.g.debug("Done Appending data to "+a+GC)};
_.r.ej=function(a,b,c){if(c<=b)this.Qc(a);else{this.g.debug("Removing data from "+a+" range:",b,c);try{this.a[a].remove(b,c)}catch(d){throw this.g.warn("Failed to remove data from "+a+" buffer. Range:",b,c,d),d;}this.g.debug("Done Removing data from "+a+" range:",b,c)}};
_.r.Ej=function(a){try{this.g.debug("Aborting operations for "+a+GC);var b=this.a[a].appendWindowStart,c=this.a[a].appendWindowEnd;this.a[a].abort();this.a[a].appendWindowStart=b;this.a[a].appendWindowEnd=c}catch(d){throw this.g.warn("Failed to abort operations for "+a+GC,d),d;}this.g.debug("Done Aborting operations for "+a+GC);this.Qc(a)};
_.r.Vh=function(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.g.debug("Flushing buffer for "+a),this.j.currentTime-=.001):this.g.warn("Skip buffer flush for "+a+" with element state: "+this.j.readyState)}catch(b){throw this.g.warn("Failed to flush buffer for "+a,b),b;}this.g.debug("Done Flushing buffer for "+a);this.Qc(a)};
_.r.kj=function(a,b){0>b&&(b+=.001);try{this.g.debug("Setting timestamp offset for "+a,b),this.a[a].timestampOffset=b}catch(c){throw this.g.warn("Failed to set timestamp offset for "+a,b,c),c;}this.g.debug("Done Setting timestamp offset for "+a,b);this.Qc(a)};
_.r.mo=function(a,b,c){try{this.g.debug("Setting append window for "+a,b,c),this.a[a].appendWindowStart=0,this.a[a].appendWindowEnd=c,this.a[a].appendWindowStart=b}catch(d){throw this.g.warn("Failed to set append window for "+a,b,c,d),d;}this.g.debug("Done Setting append window for "+a,b,c);this.Qc(a)};_.r.Lk=function(a){this.h[a][0].p.reject(new _.N(_.O,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
_.r.Qc=function(a){var b=this.h[a][0];b&&(b.p.resolve(),this.g.debug("Update-End received for "+a),YG(this,a))};_.r.getTextDisplayer=function(){return this.B};var EG=window.URL.createObjectURL;_.r=_.pH.prototype;_.r.stop=function(){this.A=null;this.l=!1;this.f=[];this.o=1;this.h=null;this.C=!1};_.r.init=function(a){this.A=a};
_.r.chooseTrack=function(){var a=qH(this,!this.C&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.f),b=this.getBandwidthEstimate();this.f.length&&!a.length&&(this.g.warn("No tracks met the ABR restrictions. Choosing a track by lowest bandwidth."),a=qH(this,null,this.f),a=[a[0]]);this.h=Date.now();this.C=!0;for(var c=a,d=c[0]||null,e=0;e<c.length;e++){var f=c[e],g=c[e+1],h=isNaN(this.o)||0===this.o?1:Math.abs(this.o),l=h*f.bandwidth,m=l/this.a.bandwidthDowngradeTarget;
g=h*(g?g.bandwidth:Infinity)/this.a.bandwidthUpgradeTarget;this.g.debug("Bandwidth ranges:",(l/1E6).toFixed(3),(m/1E6).toFixed(3),(g/1E6).toFixed(3));b>=m&&b<=g&&(d=f)}return d||a[0]||this.f[0]};_.r.enable=function(){this.l=!0};_.r.disable=function(){this.l=!1};
_.r.segmentDownloaded=function(a,b){this.g.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.l);_.vF(this.w,a,b);if(null!=this.h&&this.l)a:{this.g.debug("Suggesting Streams...");if(!this.B){if(!(128E3<=this.w.a)){this.g.debug("Still waiting for a good estimate...");break a}this.B=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.h<1E3*this.a.switchInterval){this.g.debug("Skipping initial estimation switch due to switch interval...");
break a}}else if(Date.now()-this.h<1E3*this.a.switchInterval){this.g.debug("Still within switch interval...");break a}var c=this.chooseTrack(),d=this.getBandwidthEstimate();this.g.debug("Calling switch_(), bandwidth\x3d"+Math.round(d/1E3)+" kbps");c&&this.A(c)}};_.r.playbackRateChanged=function(a){this.o=a};_.r.getBandwidthEstimate=function(){if(this.j&&this.a.useCmsd){var a=ED(this.j,_.je);a=null==a?null:a;if(null!==a)return this.g.debug("Using CMSD estimatedThroughputKbps:",a),1E3*a}return this.w.getBandwidthEstimate(this.a.defaultBandwidthEstimate)};
_.r.setTracks=function(a){this.f=a};_.r.setCmsdManager=function(a){this.j=a};_.r.configure=function(a){this.a=a};_.r.reset=function(){this.B=!1;this.w=new uF;var a=this.chooseTrack();a&&this.A(a)};uH.prototype.clear=function(){this.a.clear()};wH.prototype.add=function(a,b){var c=void 0===b?!0:b;if(zH(this.f,a,void 0===c?!0:c))return this.a.add(a),!0;_.Jh("Dropping variant due to incompatible codecs for the current adaptation set. This may be because CodecSwitchingStrategy is set to PREVENT or SourceBuffer.changeType() is not available on this platform. Variant dropped:",a,"because it is not compatible with",this.f);return!1};wH.prototype.values=function(){return this.a.values()};BH.prototype.create=function(a){var b=this,c=this.a===_.Zf&&aE(),d=a.filter(function(e){return zH(b.f,e,!c)});return d.length?new wH(d[0],d):this.h.create(a)};
AH.prototype.create=function(a){var b=CH(a,this.j);0<b.length&&(a=b);b=!1;if(this.a){var c=DH(a,this.a);0<c.length?(a=c,b=!0):_.Jh("No exact match for preferred variant role could be found. Role: "+this.a)}b||(b=a.filter(function(e){return e.primary}),0<b.length&&(a=b));this.f&&(b=$G(a,this.f),b.length?a=b:_.Jh("No exact match for the channel count could be found."));b=EH(a,this.l);b.length?a=b:_.Jh("No exact match for spatial audio could be found.");b=this.h===_.Zf&&aE();c=new wH(a[0]);a=_.u(a);
for(var d=a.next();!d.done;d=a.next())c.add(d.value,!b);return c};HH.prototype.getState=function(){return this.a};var GH=0,FH=1;JH.prototype.release=function(){this.f.release()};KH.prototype.release=function(){this.a=this.h=null;this.f=function(){}};KH.prototype.l=function(a){var b=this.a,c=this.h.periods;a=iE(c,a)||c[0];b!==a&&this.f(a);this.a=a};MH.prototype.getConfiguration=function(){return this.j};MH.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};MH.prototype.set=function(a,b){this.h=a;QH(this,b)};var TH=new _.ao(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])});_.r=_.WH.prototype;_.r.destroy=function(){var a=this,b,c,d,e;return _.H(function(f){if(1==f.a){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,gI(e),b.push(hI(e));return _.x(f,Promise.all(b),2)}a.a.clear();a.w.clear();a.F=null;a.j=null;a.H=null;a.B.clear();a.h=null;a.f=!0;_.y(f)})};
_.r.start=function(){var a=this,b,c,d;return _.H(function(e){if(1==e.a){b=a.F.Pb();c=iE(a.j.periods,b+_.nw);if(!c)throw new _.N(_.O,5,5006,"No period found.");d=a.F.ug(c);if(!d.video&&!d.audio&&!d.text)throw a.g.error("start(): No streams chosen"),new _.N(_.O,5,5005,"No streams chosen.");a.G=!d.video&&!d.audio&&!!d.text;a.A=!!d.eb;return _.x(e,oI(a,d.audio,d.video,d.text,b),2)}if(a.f)return e["return"]();a.g.debug("init: completed initial Stream setup");a.F&&a.F.ln&&(a.g.debug("init: calling onInitialStreamsSetup()..."),
a.F.ln());_.y(e)})};_.r.resume=function(){if(!wI(this))for(var a=_.u(this.a.values()),b=a.next();!b.done;b=a.next())b=b.value,b.endOfStream=!1,eI(this,b,0)};
_.r.hc=function(a){var b=this,c,d,e,f,g,h,l;return _.H(function(m){switch(m.a){case 1:if(b.f)return m["return"]();c=tI(a);if(a.Eb||null==a.ub||a.Cc)return m["return"]();a.ub=null;if(!a.mc){m.D(2);break}b.g.debug(c,"skipping update and clearing the buffer");return _.x(m,yI(b,a,a.Hf,a.Te),3);case 3:return m["return"]();case 2:_.C(m,4);d=LI(b,a);null!=d&&(eI(b,a,d),a.vd=!1);_.uh(m,5);break;case 4:return e=_.E(m),_.x(m,WI(b,e),6);case 6:return m["return"]();case 5:aJ(b,a);if(!xI(b)){m.D(0);break}if(b.F.configuration.Bm){b.g.debug("End of stream reached, keeping MediaSource open.");
f=_.u(b.a.values());for(g=f.next();!g.done;g=f.next())h=g.value,h.ub=null;return m["return"]()}b.g.debug("End of stream reached, calling ms.endOfStream().");return _.x(m,b.F.X.endOfStream(),8);case 8:if(b.f)return m["return"]();l=b.F.X.getDuration();l<b.j.presentationTimeline.getDuration()&&(b.j.presentationTimeline.f=l);b.F.Ii();_.y(m)}})};
_.r.Jn=function(a,b,c,d){var e=uD(d.reader),f=uD(d.reader),g=_.kn(d.reader),h=_.kn(d.reader),l=_.kn(d.reader),m=_.kn(d.reader);d=_.on(d.reader,d.reader.Ta()-d.reader.getPosition());a=a.startTime+b.startTime+h/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"===e)this.F.Ni();else this.F.onEvent(new _.K("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:l,id:m,messageData:d}}))};
_.r.Lo=function(a){var b=this,c=!1,d=0;(new _.pn).M(_.Ne,_.qn).M(_.tg,_.qn).M(_.He,_.qn).M(_.Le,_.qn).M(_.dg,_.qn).aa(_.fg,_.rn).M("encv",function(e){e.reader.skip(78);_.qn(e)}).M("pasp",function(e){d=e.start+e.headerSize;var f=_.kn(e.reader),g=_.kn(e.reader);c=f!==g;b.g.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.parser.stop()}).parse(a.data);c&&(a=new _.bn(new DataView(a.data)),a.seek(d),_.V(a,1),_.V(a,1))};_.w(gJ,_.xm);_.r=gJ.prototype;_.r.init=function(a,b){var c=a.getMedia();_.xm.prototype.init.call(this,a,b);sJ(this,c)};_.r.namespace=function(){return eD};_.r.setSeekInterceptor=function(a){this.bh=a||null};_.r.setPlaybackSessionId=function(a){this.Yg=a};_.r.Lh=function(){return new dG};_.r.getState=function(){return this.Kb};_.r.getDrmInfo=function(){return this.B?this.B.getDrmInfo():null};
_.r.unload=function(){var a=this,b;return _.H(function(c){if(1==c.a){nG(a,!1);a.le=!1;if(!a.ba)return c["return"]();a.log.debug("Unload player with source",a.ba);(b=a.getTrackManager())&&b.release();return a.I===dK?c["return"]():_.x(c,PJ(a),2)}a.ba=null;a.ah=0;a.Yb=null;a.xa=null;a.getNetworkEngine().headers["delete"]($C);_.y(c)})};_.r.release=function(){var a=this;return _.H(function(b){if(a.ja)return b["return"](a.ja);a.ja=jJ(a);a.ja["finally"](function(){a.ja=null});return b["return"](a.ja)})};
_.r.getBufferInfo=function(a){if(this.N){var b=NG(this.N),c=new _.lm(void 0,a);switch(a){case _.Fk: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.ed?(b=dE(this.ed),VD(b,a)):_.xm.prototype.getBufferInfo.call(this,a)};_.r.getPosition=function(){var a=this.oe,b=this.getMediaPosition();a.a&&(a=a.a,b-=a.f,b=0>b?0:b>a.a?a.a:b);return b};_.r.getMediaPosition=function(){return this.C?lF(this.C):_.xm.prototype.getMediaPosition.call(this)};
_.r.seek=function(a,b){if(this.bh&&!this.bh(a,b))return Promise.resolve();var c=this.oe;c=c.a?a+c.a.cc():a;c!==a&&this.log.info("Seeking to "+a+" s corresponding to media time of "+(c+" s."));return _.xm.prototype.seek.call(this,c)};_.r.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null};_.r.getDuration=function(){var a=this.oe,b=this.getMediaDuration();return a.a?a.a.getDuration():b};
_.r.getMediaDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.r.destroy=function(){var a=this;return _.H(function(b){if(1==b.a)return _.x(b,_.xm.prototype.destroy.call(a),2);if(a.I===dK)return b["return"]();a.log.debug("Destroying player...");a.I=dK;rJ(a);a.w&&(a.w.release(),a.w=null);a.ae=null;a.h=null;_.y(b)})};_.r.getTimeline=function(){return this.ae};
_.r.setupPlaylist=function(a){var b=this,c,d,e,f,g,h,l,m,n,p,q,t,v;return _.H(function(z){switch(z.a){case 1:return c=new _.kk,b.A.a=c,_.C(z,2),pJ(b),b.Y=_.rb,_.x(z,RJ(b),4);case 4:return tH(b.A,c),d=a[0],d.playlist&&d.playlist.startTime&&(d.startTime=d.playlist.startTime),b.ba=_.Lq(d),b.configuration=_.vm(b.jb,d),b.log.info("Loading playlist configurations",a),b.ae=kJ(b.configuration),_.x(z,SJ(b,c),5);case 5:return tH(b.A,c),e=a.map(function(A){return TJ(b,A,0,null,!0)}),_.x(z,Promise.all(e),6);
case 6:f=z.f;g=f.filter(function(A){return A.manifest.presentationTimeline.isLive()});if(h=g[0])b.j=h.parser;if(1<g.length)throw new _.N(_.O,7,7003,"Playlist of multiple live streams is not supported.");if(h){l=b.configuration.playlist.content;if(l===_.Wb)throw new _.N(_.O,7,7003,"Cannot play live content in VOD mode.");if("IPR"===l&&h!==f[f.length-1])throw new _.N(_.O,7,7003,"Wrong order of playlist assets.");}m=null==h;n=new _.tE({version:2},null,0,m);p=f.map(function(A){return XF(A.manifest)});
q=$F(p,n);b.f=q;t=b;return _.x(z,UJ(b,q,b.configuration),7);case 7:return t.B=z.f,tH(b.A,c),_.x(z,VJ(b,c),8);case 8:tH(b.A,c);rI(b.a,q);mJ(b,q);c.resolve();_.uh(z,0);break;case 2:v=_.E(z);if(!b.j){z.D(9);break}return _.x(z,b.j.stop(),10);case 10:b.j=null;case 9:WJ(b,v,c),_.y(z)}})};
_.r.appendLoad=function(a){var b=this,c;return _.H(function(d){if(1==d.a){pJ(b);if(b.Y!==_.rb)throw new _.N(_.O,7,7003,"Cannot append-load to non-playlist player.");return _.x(d,cK(b,a),2)}c=d.f;b.f=c.manifest;b.j=c.parser;rI(b.a,c.manifest);xI(b.a)&&b.a.resume();mJ(b,c.manifest);_.y(d)})};_.r.seekWith=function(a){return this.seek(this.getPosition()+a)};
_.r.yh=function(){var a=this;return _.H(function(b){pJ(a);if(!a.yf)return a.log.warn("No preloaded asset found"),b["return"]();a.log.info("Loading preloaded asset",a.yf);a.yf=null;return _.x(b,VJ(a,null),0)})};_.r.preload=function(a){var b=this;return _.H(function(c){if(1==c.a)return pJ(b),_.$o("preload.start"),b.log.info("Preloading asset",a),_.x(c,XJ(b,a,!1),2);b.yf=a;b.log.info("Preloaded asset",a);_.$o("preload.end");_.bp("preload","preload.start","preload.end");_.y(c)})};
_.r.load=function(a){return XJ(this,a)};_.r.detach=function(){var a=this;return _.H(function(b){if(1==b.a)return _.x(b,qJ(a),2);a.configuration=a.jb;rJ(a);_.y(b)})};_.r.isLive=function(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!==a.f&&!a.l):a=!1;return a};_.r.Ri=function(){this.log.debug("User seeking finished");this.K&&wK(this);xK(this)};
_.r.getSeekRange=function(){var a={start:0,end:0};if(this.f){var b=this.f.presentationTimeline;a={start:uE(b),end:EE(b)}}b=this.oe;b.a?(b=b.a.getDuration(),b>a.end&&(b=a.end),b={start:0,end:b}):b=a;return b};_.r.Ic=function(){return this.f?this.f.presentationTimeline.Ic():null};_.r.getPlaybackRate=function(){if(this.J){var a=this.J;a=a.l?0:a.h}else a=0;return a};
_.r.setPlaybackRate=function(a,b){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.I===fJ){if(_.qk()){this.log.warn("Pausing and unpausing to mitigate playbackRate platform issue.");var c=this.getSurface().getMedia();c.pause();this.J.set(a,b);c.play()}else this.J.set(a,b);if((c=this.J.getConfiguration())&&c.preferTrickPlayTracks){c=this.a;var d=1<Math.abs(a),e=c.a.get(_.Jg);if(e){var f=e.stream;if(f)if(c.g.debug("setTrickPlay",d),d)(d=f.trickModeVideo)&&!e.uc&&(c.g.debug("Engaging trick mode stream",
d),_.kI(c,d,!1,0),e.uc=f);else if(f=e.uc)c.g.debug("Restoring non-trick-mode stream",f),e.uc=null,_.kI(c,f,!0,0)}}this.h.playbackRateChanged(a)}};_.r.la=function(){if(this.f&&this.C){var a=vG(this);if(null==a)a=null;else{if(!wG(this.o,a).text){var b=_.oH(a.textStreams,this.Xd,this.ff,this.Rd);b.length&&(b=b[0],wG(this.o,a).text=b)}a=wG(this.o,a).text}b=[];for(var c=_.u(XK(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=lH(d);e.activeText=d===a;b.push(e)}return b}return[]};_.r.getPeriods=function(){return this.f.periods};
_.r.getStats=function(){if(this.I!==fJ)return _.sq();xK(this);var a=this.l;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.H,c=Number(a.totalVideoFrames);b.o=Number(a.droppedVideoFrames);b.l=c}if(this.I===fJ){(b=vG(this))?(a=wG(this.o,b).video,b=wG(this.o,b).audio,a=(a.bandwidth||0)+(b.bandwidth||0)):a=null;a&&(this.H.w=a);if(a=zK(this))b=this.H,c=a.height||NaN,b.A=a.width||NaN,b.j=c;a=this.h.getBandwidthEstimate();this.H.h=a}return this.H.getStats()};
_.r.getBandwidthEstimate=function(){return this.h.getBandwidthEstimate()};_.r.getCueTimeline=function(){return this.L};_.r.getTimelineCues=function(){return this.L?KE(this.L,LK(this)):[]};_.r.resetAbr=function(){this.h&&this.h.reset()};_.r.fe=function(){return this.h};
_.r.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,t,v,z;return _.H(function(A){if(1==A.a){if(g.I!==fJ)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");h=vG(g);l=_.Rq;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 _.zj(1,0,q,function(){return[a]},0,null,0);v={id:g.eh++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
findSegmentPosition:function(){return 1},getSegmentReference:function(D){return 1===D?t:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.hD,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,spatialAudio:!1,closedCaptions:null};g.pf.add(v);h.textStreams.push(v);return _.x(A,fI(g.a,v),
2)}if(z=_.ZH(g.a,_.pj))wG(g.o,h).text=z;g.pf["delete"](v);g.log.debug("Choosing new streams after adding a text stream");SK(g,h);iK(g);return A["return"](lH(v))})};
_.r.Kk=function(a){this.log.debug(_.lD,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=VK(this,a);this.log.debug("onChooseStreams_, chose video ",b.video);this.log.debug("onChooseStreams_, chose audio ",b.audio);this.log.debug("onChooseStreams_, chose text ",b.text);return b}catch(c){return this.onError(c),{audio:null,video:null,text:null,eb:null}}};
_.r.Jk=function(){this.log.debug("canSwitch_");this.ha=!1;this.configuration.abr.enabled&&this.h.enable();this.Ea&&(lI(this.a,this.Ea,this.dh,this.sj),this.Ea=null);this.ca&&(_.kI(this.a,this.ca,!0,0),this.ca=null)};_.r.Ko=function(){this.j&&this.j.update()};_.r.yn=function(){this.C&&this.C.j.uf()};
_.r.Pj=function(a,b,c){if((void 0===c?"":c)===jD)return iK(this),this.va()||(this.configuration.abr.enabled=!0,this.h.enable()),SK(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===_.Pc&&(h=h&&l.language===a.language));return h})&&this.va()){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)}iK(this);this.va()||(this.configuration.abr.enabled=!0,this.h.enable());
SK(this,b)}return c};_.r.jn=function(){this.log.debug("endOfStream called by streaming engine");this.le=!0};_.r.onError=function(a){if(this.I!==dK&&7001!==a.code&&7E3!==a.code){var b=new _.K(_.ie,{detail:a});a.severity===_.O&&iJ(this,_.Eq);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.r.bg=function(a){a.type===_.be?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Sg?eK(this):"emsg"!==a.type&&(a instanceof _.K?this.dispatchEvent(a):this.log.debug(_.Qb,a.type)))};_.r.va=function(){return this.configuration.abr.enabled};
_.r.Ao=function(a){var b=this,c,d,e,f,g,h,l,m,n;return _.H(function(p){switch(p.a){case 1:if(!b.cd)return p["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.va();return _.x(p,b.cd(c.url,a),2);case 2:e=p.f;if(!e)return p["return"]();f=_.L.ta(b.getLoadedSource(),{url:e});d&&b.h.disable();return _.x(p,zI(b.a),3);case 3:g=zK(b),h=AK(b);case 4:return l=!1,_.C(p,7),b.log.info("Switching CDN to "+f.url+"."),_.x(p,YK(b,f,g,h),9);case 9:_.uh(p,6);break;case 7:return m=_.E(p),b.log.info("Switch failed"),
_.x(p,b.cd(f.url,a),10);case 10:if(n=p.f)f.url=n,l=!0;else throw m;case 6:l?p.D(4):(d&&b.h.enable(),vI(b.a,!0),b.ba[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.K(_.gd,{newManifest:f.url})),_.y(p))}})};var dK=0,eJ=1,fJ=2,hK=[_.af,_.te];ZK.prototype.a=function(){return eD};
ZK.prototype.canPlay=function(a,b){if(_.wl())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 _.bv||_.cv(a.url)in _.dv?!0:!1:!1;if(d&&e){if(_.qk(2))return 1;if(_.xl()&&c===_.Zl){if(b.streaming.preferNativeHlsOnSafari)return 1;_.Jh("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};
ZK.prototype.f=function(a){return a===_.ra||a===_.rb};ZK.prototype.create=function(){return new gJ};_.Th(new ZK);_.et(function(){_.Oh("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Nh("Patching Chromecast MSE bugs."),dL();else if(_.xl()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;bL();10>=a?(_.Nh("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Nh("Patching Safari 11 \x26 12 MSE bugs."),$K(),aL()):(_.Nh("Patching Safari 13 MSE bugs."),$K())}else _.qk(2)||_.qk(3)||
_.qk(4)?cL():_.Nh("Using native MSE as-is.");else _.Nh("No MSE implementation available.")});_.w(eL,_.$v);_.r=eL.prototype;
_.r.append=function(a){function b(e){if(e.startTime>=e.endTime)_.Jh("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.Q.Pg(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.id}catch(g){f.align="middle"}e.writingMode===_.Gg?f.vertical="lr":e.writingMode===_.Hg&&(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?
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;fL(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.r.isTextVisible=function(){return this.a.mode===_.Vf};_.r.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.Vf:_.qe)};_.r.destroy=function(){this.a&&fL(this.a,function(){return!0});this.a=null;return Promise.resolve()};gL.prototype.a=function(){return!0};gL.prototype.create=function(a){return new eL(a)};_.jq("single-native",new gL);};
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
else{_=this.clpp._;(f.call(g,this));}
})();