(function(){var g={}; var _ = _ || {}
var f=function(window){var iL="Could not parse MP4 segment start time.",jL="EXT-X-DATERANGE",kL="EXT-X-DISCONTINUITY",lL="EXT-X-KEY",mL="EXT-X-MAP",nL="EXT-X-MEDIA-SEQUENCE",oL="Failed to infer discontinuity number",pL="Guessing audio-only",qL="METHOD",rL="SAMPLE-AES-CTR",sL="Setting playlist start time to ",tL="application/vnd.apple.mpegurl",uL="manifestloaded",vL="sample",wL=function(a){if(1>a.a)throw _.gn();--a.a},xL=function(a){a=_.tj(a)||"";return null!=_.uj.video[a]?_.Jg:null!=_.uj.audio[a]?_.Pc:null},yL=function(a,
b,c,d){if(1===b){if(!d||0===d.length)throw new _.N(_.O,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.N(_.O,4,4043,"Media playlist must have at least one full segment!");}this.a=a;this.verbatimUri="";this.type=b;this.fa=c;this.U=1===b?d:null},zL=function(a,b,c){c=void 0===c?[]:c;this.fa=b;this.a=a;this.f=c;this.na=-1},AL=function(a){return a.some(function(b){return b.startsWith("#EXT-X-TARGETDURATION")})?1:0},BL=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,
function(c,d){var e=b.get(d);if(null==e)throw new _.N(_.O,4,4044,"Undefined variable '"+d+"'");return e})},CL=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=BL(d.value,b)})})},DL=function(a,b){var c=new Map,d=new URL(b);a.forEach(function(e){var f=_.P(e,_.hb),g=_.P(e,"QUERYPARAM");if(f)g=_.xj(e,"VALUE"),c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.N(_.O,4,4044,"Query param '"+g+"' missing in playlist URI.");if(!f)throw new _.N(_.O,4,4044,"Query param '"+
g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},EL=function(){this.h=0;this.a=new Map},HL=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&!_.Y.qm(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.N(_.O,4,4015);b=b.slice(1);return 0===AL(b)?FL(a,b,c):GL(a,b,c)},GL=function(a,b,c){var d=IL(b);b=d.lo;var e=d.gm,f=JL(a,d.No,c);d=e.map(function(g){return KL(a,g,f)});b=LL(a,c,b,f);return new yL(c,
1,d,b)},IL=function(a){var b=[],c=[],d=[];a=_.u(a);for(var e=a.next();!e.done;e=a.next())e=e.value,ML.test(e)?d.push(e):NL.test(e)?c.push(e):b.push(e);return{lo:b,gm:c,No:d}},FL=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=KL(a,b[e]);d.push(f);if(f.name===_.Ma){var g=b[e+1];if(!g)throw new _.N(_.O,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.yj(_.Ob,g));e++}}b=_.Y.pc(d,"EXT-X-DEFINE");_.Y.qj(b);b=DL(b,c);a.a=b;CL(d,a.a);return new yL(c,0,d)},OL=function(a,
b,c){var d=[],e=[];e.push(new _.yj(_.pa,"0"));e.push(new _.yj(_.Ob,b));c.length&&e.push(new _.yj(_.ua,c));d.push(new _.wj(a.h++,_.Ma,e));return new yL(b,0,d)},LL=function(a,b,c,d){var e=[],f=[],g=[];c.forEach(function(h){_.Y.wm(h)?(h=KL(a,h,d),"EXT-X-PART"===h.name||"EXT-X-PRELOAD-HINT"===h.name&&"PART"===_.P(h,_.Mb)?g.push(h):f.push(h)):(_.Y.wd(f,"EXT-X-GAP")||(h=BL(h,d),h=_.Y.nd(b,h),e.push(new zL(h,f,g))),f=[],g=[])});0<g.length&&e.push(new zL(null,f,g));return e},KL=function(a,b,c){a=_.Kj(a.h++,
b);c&&CL([a],c);return a},JL=function(a,b,c){b=b.map(function(e){return KL(a,e)});_.Y.qj(b);var d=DL(b,c);b.map(function(e){return _.P(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.N(_.O,4,4044,"Cannot import variable '"+e+"' as it is not defined in the master playlist");d.set(e,f)});return d},PL=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},function(c,d){return d+b})},QL=function(a,b){b=void 0===b?0:b;return b+10<=a.length&&73===
a[b]&&68===a[b+1]&&51===a[b+2]&&255>a[b+3]&&255>a[b+4]&&128>a[b+6]&&128>a[b+7]&&128>a[b+8]&&128>a[b+9]?!0:!1},RL=function(){this.a=new Map;this.f=new Map},SL=function(a){function b(l,m,n){for(var p="";m<n;m++)p+="%"+("00"+l[m].toString(16)).slice(-2);return p}function c(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.N(_.O,4,4030);}QL(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);
if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}QL(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},TL=function(a){for(;a.getPosition()<a.Ta()-1;){var b=a.getPosition();if(71===_.hn(a))return wL(a),b}return-1},UL=function(a){function b(){d.seek(e+188);f=_.hn(d);71!==f&&(d.seek(e+
192),f=_.hn(d));71!==f&&(d.seek(e+204),f=_.hn(d));71!==f&&c();wL(d)}function c(){throw new _.N(_.O,4,4030);}var d=new _.en(new DataView(a),!1),e=0,f=0;e=TL(d);0>e&&(_.Lw.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.hn(d),71!==f&&c(),a=_.jn(d),8191===(a&8191))b();else if(a&16384)if(a=(_.hn(d)&48)>>4,0!==a&&2!==a||c(),3===a&&(a=_.hn(d),d.skip(a)),1!==_.kn(d)>>8)b();else{d.skip(3);a=_.hn(d)>>6;0!==a&&1!==a||c();0===_.hn(d)&&c();a=_.hn(d);var g=_.jn(d),
h=_.jn(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},VL=function(a,b){var c=null,d=0;try{(new _.pn).M(_.Ne,_.qn).M(_.tg,_.qn).M(_.He,_.qn).aa("mdhd",function(g){g.reader.skip(0===g.version?8:16);d=_.kn(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.Lw.error("Unable to find timescale in init segment!"),new _.N(_.O,4,4030,iL,c);var e=0,f=!1;try{(new _.pn).M("moof",_.qn).M("traf",_.qn).aa("tfdt",function(g){var h=d;if(0===g.version)h=_.kn(g.reader)/
h;else{var l=_.kn(g.reader),m=_.kn(g.reader);if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.N(_.O,4,4030,iL,c);return e},YL=function(a){var b=_.xj(a,qL);if(!WL.includes(b))return XL.error("PlayReady in HLS is only supported with [",WL.join(", "),"], not",b),null;a=_.xj(a,_.Ob);b=_.yv(a);a=null;b=_.Oj(b.data);
try{a=_.wD(_.Yo(b))}catch(c){a=b}return _.KD(_.Ed,[{initDataType:_.hd,initData:a}],"")},ZL=function(a){this.g=new _.J("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Yj()}},aM=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,t;return _.H(function(v){switch(v.a){case 1:a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.Sc||d===_.Rc)return v["return"](0);g=f;if(d!==_.Qc){v.D(2);break}return _.x(v,$L(a,c,g),3);case 3:h=v.f;l=_.Oj(h.data);if(!QL(l))throw new _.N(_.O,4,4030,
"AAC segment does not contain an ID3 tag.");return v["return"](SL(l));case 2:if(d!==_.Lg&&d!==_.Tc){v.D(4);break}m=[$L(a,c,g)];b&&m.push($L(a,b,!0));return _.x(v,Promise.all(m),5);case 5:return n=v.f,p=n[0],q=n[1]||n[0],v["return"](VL(p.data,q.data));case 4:if(d!==_.Kg){v.D(6);break}return _.x(v,$L(a,c,g),7);case 7:return t=v.f,v["return"](UL(t.data));case 6:if(!_.xu((d.split("/")[0]||"")+'/mp4;codecs\x3d"'+e+'"'))return v["return"](0);throw new _.N(_.O,4,4030);}})},$L=function(a,b,c){var d,e,f,g,
h,l,m;return _.H(function(n){switch(n.a){case 1:return d=b.f(),e=_.qE(b.cb(),b.Da,b.Da+2048-1,a.a.attemptParameters),e.type=2,f=_.qE(b.cb(),b.Da,b.oa,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.C(n,2),g=c?f:e,_.x(n,a.f(g),4);case 4:return h=n.f,n["return"](h);case 2:l=_.E(n);if(7001===l.code||c)throw l;a.g.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS pre-flights.",e.uris[0]);_.C(n,
5);return _.x(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.E(n),a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.N(_.O,4,4030,"Failed to fetch the media segment.");}})},bM=function(a){this.streams=a},cM=function(a,b){a.streams.forEach(function(c){c.Sf=b})},dM=function(a,b){a.streams.forEach(function(c){c.width=b})},eM=function(a,b){a.streams.forEach(function(c){c.height=b})},fM=function(a,b){a.streams.forEach(function(c){c.frameRate=b})},gM=
function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},hM=function(a,b){var c=a.streams.find(function(d){d=d.U;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.U.find(function(d){return d.position===b})||null},iM=function(a,b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},jM=function(a){this.a=a},kM=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},lM=function(a,
b){var c=new Set(a.map(function(d){return d.na}));return b.filter(function(d){return!c.has(d.na)})},nM=function(a,b){for(;a[0].na<b[0].na;)a.splice(0,1);var c=a[0],d=b[0];c.startTime===d.startTime&&c.endTime===d.endTime||mM(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&(c.startTime!==d.startTime||c.endTime!==d.endTime)&&mM(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},sM=function(a,b,c,d,e){var f=b[0].length();f=PL(f).map(function(g){var h=kM(b,g)||[],l=iM(c,g)||[];g=iM(d,g)||[];var m=_.gh(oM(h)).concat(_.gh(l),
_.gh(g)).filter(Boolean);pM(m);var n=m[0];m=n.na;n=n.duration;return{configurationId:a,variants:h,textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,na:m}});e&&qM(f[0]);rM(f);return f},oM=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},qM=function(a){var b=oM(a.variants)[0].U[0].Ha;a.startTime+=b;a.endTime+=b},rM=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=
c.startTime+c.duration}},mM=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;tM(a.variants,b.variants);uM(_.Y.Ef(a),_.Y.Ef(b))},tM=function(a,b){var c=new Map(a.map(function(d){return[_.Y.Kh(d),d]}));b.forEach(function(d){c.get(_.Y.Kh(d)).drmInfos=d.drmInfos})},uM=function(a,b){var c=new Map(a.map(function(d){return[d.zc,d]}));b.forEach(function(d){var e=c.get(d.zc);e.U=d.U;d.U.forEach(function(f){f.initSegment=e.initSegmentReference});e.segmentIndex.replace(d.U);e.rc=
d.rc;e.hf=d.hf;e.duration=d.duration;e.Ph=d.Ph;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},pM=function(a){var b=vM(a);a.forEach(function(c){_.lE(c.segmentIndex,b);c.duration=b;c.hf=c.rc+b})},vM=function(a){var b=Infinity;_.Y.Bl(a).forEach(function(c){b=Math.min(b,c.duration)});return b},wM=function(){var a=this;this.a=this.F=null;this.h=1;this.j=new RL;this.o="";this.T=new EL;this.H=0;this.w=null;this.l=new _.Xh(function(){a.hc()});this.A=_.Wb;this.f=null;this.G=new _.nk;this.K=
this.C=null;this.g=new _.J("clpp.hls.HlsParser");this.L=new Map;this.Y=new ZL(this.ag.bind(this));this.P=!1;this.I=null;this.N=!1;this.B=new Map;this.J=new Set},xM=function(a){if(null===a.w)return[];a=a.w;return[a.audio,a.video].filter(function(b){return b}).map(function(b){return b.zc})},yM=function(a,b){var c=new Set(b.map(function(h){return h.id}));a.B.forEach(function(h,l){c.has(l)||a.B["delete"](l)});for(var d=_.u(b),e=d.next();!e.done;e=d.next()){e=e.value;var f=a.B.get(e.id);if(f&&f.Df!==e.Df)a.F.onError(new _.N(1,
4,4044,"EXT-X-DATERANGE START-DATE has changed for ID\x3d"+e.id));var g={configurationId:a.F.configurationId,schemeIdUri:e.schemeIdUri,customAttributes:e.customAttributes,value:"",startTime:e.startTime,Df:e.Df,endTime:e.endTime,id:e.id,type:_.Bi,eventElement:null};f&&!_.L.yi(f,g)||a.B.set(e.id,g)}return Array.from(a.B.values())},HM=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,A,D,G,B,F;return _.H(function(M){switch(M.a){case 1:c=_.Rq;d=zM(a,b,a.o,"");if(1===d.type){e=d.U[0].a;f=xL(e);if(!f)throw new _.N(_.O,
4,4021,"Unknown file extension "+e);g="";f===c.VIDEO?g="avc1.42E01E":f===c.AUDIO&&(g="mp4a.40.2");d=OL(a.T,a.o,a.a.hlsDefaultCodecs||g)}h=_.Y.Pn(d.fa);l=AM(h.Pc.nh);l.forEach(function(R){a.J.add(R.groupId)});return _.x(M,BM(a,h),4);case 4:m=M.f;M.D(3);break;case 5:m=M.f;case 3:n=m;p=n.Fm;q=n.periods;t=n.$n;v=n.Co;z=n.alternativeVariants;A=n.alternativeTextStreams;D=n.alternativeImageStreams;if(!a.F)throw new _.N(_.O,7,7001);CM(a,q);G=DM(a,p.delay,q,t);EM(a)||(a.H=p.Ee,FM(a));GM(a,G,q);B=yM(a,v);F=
{presentationTimeline:G,periods:q,minBufferTime:0,cues:B,muxedAudioTracks:l};z&&(F.alternativeVariants=z);A&&(F.alternativeTextStreams=A);D&&(F.alternativeImageStreams=D);a.g.debug("HLS playlist parsed",F);return M["return"](F)}})},AM=function(a){return a.filter(function(b){return b.name===_.La&&_.P(b,_.Mb)===_.ja&&!_.P(b,_.Ob)}).map(function(b){var c=_.Y.Zh(b),d=_.P(b,_.ab)||_.wg;return{groupId:_.xj(b,_.Sa),id:_.hL++,label:_.xj(b,_.hb),language:d,channelsCount:c,primary:"YES"===_.P(b,"DEFAULT")}})},
KM=function(a,b){var c,d,e,f,g,h,l,m,n;return _.H(function(p){if(1==p.a)return c=_.Y,_.x(p,IM(a,b),2);d=p.f;e=d.textStreams;f=d.thumbStreams;g=d.Mj;h=a.f.periods[0].variants;a.a.lowLatencyMode&&null!==a.w&&(h=h.filter(function(q){return q.id===a.w.id}));l=h.map(function(q){var t=c.Th(q.audio,g),v=c.Th(q.video,g);q=JM(a,t,v,q.bandwidth);if(!q)throw new _.N(_.O,4,4047,{message:"Video and audio are encrypted in an incompatible way.",Dp:v?v.dc():void 0,audio:t?t.dc():void 0});return q});m=a.F.configurationId;
n=sM(m,l,e,f,!0);return p["return"](n)})},IM=function(a,b){var c,d,e,f,g,h,l,m,n;return _.H(function(p){if(1==p.a)return c=_.Rq,d=function(q){return q.stream.a()===c.VIDEO||q.stream.a()===c.AUDIO},e=b.filter(d),f=b.filter(function(q){return!d(q)}),g=function(q){q=q.map(function(t){var v=t.stream.streams[0];t=Object.assign({},{playlist:t.playlist},{language:v.language,channelsCount:v.channelsCount,spatialAudio:v.spatialAudio,closedCaptions:v.closedCaptions,primary:v.primary,kind:v.kind||null,groupId:v.groupId,
type:v.type,codecs:v.codecs,name:v.originalId,uri:v.zc,He:{width:v.width,height:v.height,frameRate:v.frameRate}});return LM(a,t)});return Promise.all(q)},_.x(p,g(e),2);if(3!=p.a)return h=p.f,_.x(p,g(f),3);l=p.f;MM(a,h.concat(l));m=l.filter(function(q){return q.a()===c.gh});n=l.filter(function(q){return q.a()===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,Mj:h})})},MM=function(a,b){b.forEach(function(c){a.j.a.set(c.dc(),c)})},BM=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,A,D,G;return _.H(function(B){switch(B.a){case 1:return c=
_.Y,d=c.Hn(b.Pc.closedCaptions),e=NM(a,b.Ge),_.x(B,OM(a,b),2);case 2:return f=B.f,g=Object.values(f).flat().map(function(F){return F.playlist}),PM(a,g),h=g[0],l=c.Xi(h.fa),a.A=l,a.K=c.Yi(h.fa),m=c.On(h.fa,l,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay,a.a.liveRefreshPeriod),_.x(B,QM(a,f.oh,e),3);case 3:return n=B.f,_.x(B,RM(a,f.Ge,n,d),4);case 4:return p=B.f,_.x(B,SM(a,f.yo,e),5);case 5:return q=B.f,_.x(B,TM(a,f.jg),6);case 6:return t=B.f,v=a.F.configurationId,z=sM(v,p,q,t,!EM(a)),a.F.filterAllPeriods(z),
A=_.gh(f.Ge).concat(_.gh(f.oh)).map(function(F){return F.playlist}),D=UM(a,A),G=VM(a,A,D),B["return"]({periods:z,$n:D,Co:G,Fm:m})}})},XM=function(a,b){var c,d,e,f,g;return _.H(function(h){if(1==h.a)return c=_.Y.nd(a.o,b.verbatimUri),_.x(h,WM(a,c),2);d=h.f;e=d.response;f=d.text;g=e.uri;return h["return"](zM(a,f,g,b.verbatimUri))})},CM=function(a,b){EM(a)||2!==a.a.timeline.version||(a.I||(a.I=b[0].startTime),_.VF(b,-a.I))},VM=function(a,b,c){b=b.find(function(d){return null!==_.Y.bb(d.fa,jL)});if(!b)return[];
if(null===c)throw new _.N(_.O,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");return b.fa.filter(function(d){return d.name===jL}).map(function(d){return _.Y.In(d,c,a.C,!EM(a))}).filter(Boolean)},UM=function(a,b){var c=b.flatMap(function(e){return e.U[0].fa});c=_.Y.bb(c,"EXT-X-PROGRAM-DATE-TIME");if(!c)return null;var d=(new Date(c.value)).getTime();return isNaN(d)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag value (value: "+(c.value+").")),null):d/
1E3},OM=function(a,b){var c,d,e,f,g,h;return _.H(function(l){if(1==l.a)return _.x(l,Promise.all([YM(a,b.Pc.nh),YM(a,b.Pc.zo),YM(a,b.Ge),YM(a,b.jg)]),2);c=l.f;d=_.u(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({oh:e,yo:f,Ge:g,jg:h})})},$M=function(a,b){return Promise.all(b.map(function(c){return ZM(a,c)}))},NM=function(a,b){for(var c=_.Y.We,d=new Map,e=_.u(b),f=e.next();!f.done;f=e.next()){var g=f.value,h=_.P(g,_.ja);f=_.P(g,_.Vb);var l=_.P(g,_.Db);g=aN(a,
g);if(l){var m=_.sj(_.pj,g);d.set(c(_.pj,l),m);l=g.indexOf(m);-1<l&&g.splice(l,1)}h&&(l=bN(_.Pc,g),d.set(c(_.Pc,h),l));f&&(h=bN(_.Jg,g),d.set(c(_.Jg,f),h))}return d},SM=function(a,b,c){return Promise.all(b.map(function(d){return cN(a,d,c)}))},TM=function(a,b){return Promise.all(b.map(function(c){return dN(a,c)}))},QM=function(a,b,c){var d,e;return _.H(function(f){if(1==f.a){if(0===b.length)return f["return"](new Map);d=[cN(a,b[0],c)];return _.x(f,d[0],2)}if(3!=f.a)return d=d.concat(b.slice(1).map(function(g){return cN(a,
g,c)})),_.x(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.Do(e))})},RM=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,v;return _.H(function(z){if(1==z.a){e=new Set;f=_.gh(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.xj(f[l].tag,_.pa)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.x(z,eN(a,n,c,d,e),2)}if(3!=z.a)return p=z.f,q=f.map(function(A){return eN(a,A,c,d,e)}),_.x(z,Promise.all(q),3);t=z.f;t.splice(g,0,p);v=t.reduce(_.HD,[]);return z["return"](v)})},fN=function(a,b,c){var d;return _.H(function(e){if(1==
e.a)return _.x(e,LM(a,{playlist:c,codecs:b.codecs,type:b.type,yd:b.originalLanguage,xc:b.id,groupId:b.groupId,primary:b.primary,kind:b.kind||null,name:b.label,channelsCount:b.channelsCount,spatialAudio:b.spatialAudio||!1,closedCaptions:b.closedCaptions,He:{width:b.width,height:b.height,frameRate:b.frameRate}}),2);d=e.f;b.bandwidth&&gM(d,b.bandwidth);return e["return"](d)})},eN=function(a,b,c,d,e){var f,g,h,l,m,n;return _.H(function(p){return 1==p.a?(f=_.Y,g=b,h=g.tag,l=Number(_.xj(h,_.pa)),m=f.Rn(h),
_.x(p,gN(a,b,m,c,d),2)):(n=p.f)?p["return"](hN(a,n,l,e)):p["return"]([])})},iN=function(a,b,c,d,e,f){var g=aN(a,b);a.g.debug("Guessing stream type for",b.toString());b=!1;var h=_.sj(_.Jg,g),l=d+e;1!==g.length||c||h?!l&&1<g.length?(a.g.debug("Guessing multiplexed audio+video"),c=_.Jg,g=[g.join(",")]):d&&f?(a.g.debug(pL),c=_.Pc,b=!0):e?(a.g.debug(pL),c=_.Pc):(a.g.debug("Guessing video-only"),c=_.Jg):(c=_.Pc,a.g.debug(pL));return{type:c,Lj:g,mm:b}},gN=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,v,z,A,
D,G,B,F,M;return _.H(function(R){if(1==R.a)return f=_.Rq,g=_.Y.We,h=b,l=h.tag,m=h.playlist,n=_.P(l,_.ja),p=_.P(l,_.Vb),q=n?d.get(g(f.AUDIO,n))||[]:[],t=p?d.get(g(f.VIDEO,p))||[]:[],v={audio:q,video:t},z=m.verbatimUri,A=v.audio.find(function(ka){return ka.dc()===z}),D=iN(a,l,c,v.audio.length,v.video.length,A),G=D.type,B=D.Lj,F=D.mm,M=null,F?R.D(2):_.x(R,jN(a,b,B,G,e,c),3);2!=R.a&&(M=R.f);if(null==M)return R["return"](null);v[G]=[M];G===f.AUDIO&&c&&v.video.forEach(function(ka){dM(ka,c.width);eM(ka,
c.height);fM(ka,c.frameRate)});return R["return"](v)})},hN=function(a,b,c,d){var e=b.video,f=b.audio;e=0<e.length?e:[null];b=[];f=_.u(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var h=_.u(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.sl(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):(m=JM(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(b.push(m),d.add(l)))}}return b},JM=function(a,b,c,d,e){for(var f=
[],g=(c||b).length(),h=0;h<g;h++){var l=b?b.streams[h]||null:null,m=c?c.streams[h]||null:null,n=_.Y.Ql(l,m);if(!n)return null;var p=d;l={id:e?e:a.h++,language:l?l.language:_.wg,primary:!!l&&l.primary||!!m&&m.primary,audio:l,video:m,bandwidth:p,drmInfos:n,allowedByApplication:!0,allowedByKeySystem:!0};f.push(l)}return new jM(f)},cN=function(a,b,c){var d,e,f,g;return _.H(function(h){d=b;e=d.tag;f=d.playlist;g=f.verbatimUri;return h["return"](kN(a,g,function(){var l,m,n,p,q,t,v,z,A,D,G,B,F;return _.H(function(M){if(1==
M.a){l=_.Rq;m=_.Y.We;n=_.xj(e,_.Sa);p=_.Y.Jh(_.xj(e,_.Mb));q=_.Y.ol(e);t=c.get(m(p,n))||"";v=_.P(e,_.ab);z=_.P(e,_.hb);A=_.P(e,"DEFAULT");D=p===l.AUDIO?_.Y.Zh(e):null;var R=p===l.AUDIO?(R=_.P(e,"CHANNELS"))?R.includes("/JOC"):!1:!1;G=R;B="YES"===A;return _.x(M,LM(a,{playlist:f,codecs:t,type:p,yd:v,primary:B,name:z,channelsCount:D,spatialAudio:G,groupId:n,kind:q,xc:null,closedCaptions:null,He:null}),2)}F=M.f;return M["return"](F)})}))})},dN=function(a,b){var c,d,e,f;return _.H(function(g){c=b;d=c.tag;
e=c.playlist;f=e.verbatimUri;return g["return"](kN(a,f,function(){var h,l,m,n,p;return _.H(function(q){if(1==q.a)return h=_.P(d,_.ua)||"jpg",l=_.P(d,_.ab),m=_.P(d,_.hb),_.x(q,LM(a,{playlist:e,codecs:h,type:_.se,yd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,xc:null,groupId:null,He:null}),2);n=q.f;(p=_.P(d,_.pa))&&gM(n,Number(p));return q["return"](n)})}))})},aN=function(a,b){var c=_.P(b,_.ua,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);c=
_.Y.wl(c);var d=new Set,e=[];c=_.u(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.TD(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},jN=function(a,b,c,d,e,f){var g,h,l,m,n;return _.H(function(p){g=b;h=g.tag;l=g.playlist;m=_.Rq;n=l.verbatimUri;return p["return"](kN(a,n,function(){var q,t,v,z,A;return _.H(function(D){if(1==D.a){q=_.P(h,_.ta);t=null;d===m.VIDEO&&q&&"NONE"!==q&&(t=e.get(q));var G=_.P(h,_.ja)||void 0;v=G&&a.J.has(G)?G:void 0;G=bN(d,c);if(v){var B=
bN(_.Pc,c);G+=","+B}z=G;return _.x(D,LM(a,{playlist:l,codecs:z,type:d,closedCaptions:t,primary:!1,kind:null,yd:null,name:null,channelsCount:null,spatialAudio:!1,xc:null,groupId:null,muxedAudioId:v,He:f}),2)}A=D.f;return D["return"](A)})}))})},kN=function(a,b,c){if(a.j.has(b))return a=a.j.get(b),Promise.resolve(a);if(a.j.f.has(b))return a.j.f.get(b)||null;c=c();a.j.set(b,c);return c},LM=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,A,D,G,B,F,M,R,ka,U,qa;return _.H(function(Ba){if(1==Ba.a){c=lN;d=mN;
e=_.Rq;f=b;g=f.playlist;h=f.codecs;l=f.type;m=f.yd;n=f.xc;p=f.groupId;q=f.muxedAudioId;t=f.primary;v=f.kind;z=f.name;A=f.channelsCount;D=f.spatialAudio;G=f.closedCaptions;B=f.He;F=_.Y.ci(m);if(1!==g.type)throw new _.N(_.O,4,4017);return _.x(Ba,nN(a,g,l,h),2)}M=Ba.f;R=a.a.lowLatencyMode?d.xj:d.zj;ka=v;l!==e.TEXT||v||(ka=_.hg);U=_.Y.Xi(g.fa);qa=M.map(function(Ca){var Da=Ca.U,Na=Ca.yl,zb=Ca.mimeType,me=Ca.na,Cf=Da[0].startTime,Fg=Da[Da.length-1].endTime,Pu=Fg-Cf,od=new _.PE(Da),Ln=Da[0].initSegment||
null;return{id:null===n?_.hL++:n,originalId:z,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:od.ld.bind(od),getSegmentReference:od.get.bind(od),adjustSegmentDurations:od.Nd.bind(od),getDuration:od.getDuration.bind(od),segmentIndex:od,segmentLookupStrategy:R,initSegmentReference:Ln,mimeType:zb,codecs:h,kind:ka,Ph:Na.type,encrypted:Na.type===c.Cj,aesEncrypted:Ca.aesEncrypted,keyId:Na.keyId,language:F,originalLanguage:m||_.wg,label:z,type:l,primary:t,trickModeVideo:null,emsgSchemeIdUris:null,
frameRate:B?B.frameRate:void 0,width:B?B.width:void 0,height:B?B.height:void 0,bandwidth:void 0,roles:[],channelsCount:A,spatialAudio:D,closedCaptions:G,U:Da,drmInfos:Na.drmInfos,na:me,zc:g.verbatimUri,Sf:g.a,rc:Cf,hf:Fg,duration:Pu,groupId:p,wp:U,muxedAudioId:q}});return Ba["return"](new bM(qa))})},YM=function(a,b){var c;return _.H(function(d){if(1==d.a)return _.x(d,Promise.all(b.map(function(e){var f;return _.H(function(g){if(1==g.a)return _.x(g,oN(a,e),2);f=g.f;return g["return"](f?{tag:e,playlist:f}:
null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},oN=function(a,b){var c,d,e,f,g,h,l,m,n;return _.H(function(p){if(1==p.a){c=_.Y.zm(b);d=_.P(b,_.Ob,void 0,{required:c});if(!d)return p["return"](null);e=_.Y.nd(a.o,d);f=Date.now();return _.x(p,WM(a,e),2)}g=p.f;h=g.response;l=g.text;m=Date.now();a.F.onEvent(new _.K(uL,{detail:{duration:m-f,type:"media"}}));n=h.uri;return p["return"](zM(a,l,n,d))})},ZM=function(a,b){var c,d,e,f,g,h,l,m;return _.H(function(n){if(1==n.a){var p=new _.dj(b.streams[0].Sf);
if(a.a.lowLatencyMode&&a.K&&a.K.sh){var q=b.streams[b.streams.length-1].segmentIndex;if(q=q.a[q.a.length-1]){var t=q.a,v=t.length-1;q={Im:q.position,Sn:t&&0<t.length?v:null}}else q=null;if(t=q)q=t.Im,t=t.Sn,v=_.Pk(p.a.toString()),v._HLS_msn=q.toString(),null===t&&v._HLS_part&&delete v._HLS_part,null!==t&&(v._HLS_part=t.toString()),q=_.Ok(v,!0),_.gj(p,new _.kj(q))}c=p.toString();return _.x(n,WM(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.dc();h=b.streams[0].Sf;l=e.uri;h!==l&&(h=l,cM(b,h));m=zM(a,f,h,g);
return n["return"]({stream:b,playlist:m})})},zM=function(a,b,c,d){a=HL(a.T,b,c);a.verbatimUri=d;return a},pN=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.N(_.O,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},qN=function(a){a=a.map(function(b){return b.a?b.a:b.f.map(function(c){return _.P(c,_.Ob)})||null}).map(function(b){return _.tj(b)});if(1<(new Set(a)).size)throw new _.N(_.O,4,4044,"Unexpected change in file format.");
},DM=function(a,b,c,d){var e=!0,f=null,g=0;EM(a)||(e=!1,f=0,g=b);b=a.a.timeline||{};b.type=void 0;a=new _.tE(b,f,g,!0,void 0,!!a.a.lowLatencyMode);_.wE(a,e);rN(a,c);d&&_.vE(a,d);return a},sN=function(a,b,c){a=_.Y.pc(a.fa,mL);if(1<a.length)throw new _.N(_.O,4,4020);a=a[0];if(!a)return null;var d=_.xj(a,_.Ob),e=_.Y.nd(b,d);b=_.Y.Vi(a,null,!0);return new _.LD(function(){return[e]},b.Da,b.oa,c)},uN=function(a,b,c,d,e,f,g){var h=[],l={};b=_.u(tN(b.f));for(var m=b.next();!m.done;l={If:l.If},m=b.next()){var n=
m.value;m=n.li;n=n.item;var p=0===m,q=p?a:h[h.length-1],t=p?d:q.endTime,v=Number(_.P(n,_.Ja));v=t+v;p=_.Y.Vi(n,p?null:q.oa,p);q=_.P(n,_.Ob);q=_.Y.nd(g,q);l.If=q?[q]:[];t=new _.Aj(c,t,v,function(z){return function(){return z.If}}(l),p.Da,p.oa,e,f,!1,null,null,null,null);if("YES"===_.P(n,"INDEPENDENT")||0===m)t.h=!0;h.push(t)}return h},vN=function(a,b,c,d,e,f,g,h,l,m,n){var p=c.fa,q=c.a;0<_.Y.pc(p,mL).length&&(n=sN(c,l,g));var t=null!=q,v=q?[q]:[];if(!t&&!a.a.lowLatencyMode)return null;a=0;q={Da:0,
oa:null};var z=null;t?(c=_.Y.Ln(p).duration,a=e+c,q=_.Y.Wi(p,b?b.oa:null)):(b=uN(b,c,d,e,f,g,l),a=b[b.length-1].endTime,z=b);h=h===_.se?_.Y.Qn(p):null;d=new _.Aj(d,e,a,function(){return v},q.Da,q.oa,f,g,!1,null,h?h.ke:null,h?h.Fe:null,h?h.durationPerTile:null,z,n);d.na=m;return d},nN=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,v,z,A;return _.H(function(D){switch(D.a){case 1:return e=_.Y,f=wN,g=b.verbatimUri,h=b.U,l=e.Vl(b.fa,nL),m=[],_.x(D,xN(a,b.a,g,h,l,c,d),2);case 2:n=D.f,p=l,q=f.wo(h),t=0;case 3:if(!(t<
q.length)){D.D(5);break}v=q[t];z=m[m.length-1]||null;return _.x(D,yN(a,b.a,v,p,n,c,d,z),6);case 6:A=D.f;m.push(A);p+=v.length;t++;D.D(3);break;case 5:return pN(m),D["return"](m)}})},xN=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,t,v,z,A,D;return _.H(function(G){if(1==G.a){h=d[0];if(null!=a.C)return G["return"](a.C);if(!EM(a)&&a.f)try{var B=a.j.get(c),F=B?hM(B,e)||null:null;if(!F)throw new _.N(_.O,4,4030,"Segment not found in pervious playlist update.");l=F.startTime+F.Ha;a.g.debug(sL+l+".");a.C=l;return G["return"](l)}catch(M){if(m=
a.j.get(c))n=m.streams[0].U[0].position,G=m.streams[m.streams.length-1].U,p=G[G.length-1].position,q=e,t=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+" - "+p+(", new values "+q+" - "+t+"."),b,m);throw new _.N(_.O,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}return _.x(G,zN(a,f,g,h),2)}if(3!=G.a)return v=G.f,z=AN.Si(h.fa,a.o,e),A=sN(h,b,z),_.x(G,BN(a,A,h,z,v,g),3);D=G.f;a.g.debug(sL+D+".");a.C=D;return G["return"](D)})},yN=function(a,
b,c,d,e,f,g,h){var l,m,n,p,q,t,v,z,A,D,G,B,F,M,R,ka,U,qa,Ba,Ca,Da,Na;return _.H(function(zb){switch(zb.a){case 1:return l=AN,m=c[0],n=null==h,qN(c),_.x(zb,zN(a,f,g,m),2);case 2:p=zb.f;q=l.Kn(c,p,h?h.Dm:null);t=q[q.length-1];v=AN.ta(q);z=h?h.Em:null;A=CN(z,m.fa,a.o,d);D=sN(m,b,A)||(h?h.om:null);G=m.na;if(n){B=e;zb.D(3);break}return _.x(zb,DN(a,G,D,m,d,A,p,g),4);case 4:B=zb.f;case 3:F=B;M=[];R=!1;for(ka=0;ka<c.length;ka++)if(U=c[ka],qa=M[M.length-1]||null,Ba=0===ka?0:qa.endTime,Ca=d+ka,(z=Da=CN(z,U.fa,
a.o,Ca))&&(R=!0),Na=vN(a,qa,U,Ca,Ba,F,Da,f,b,G,D))D=Na.initSegment,M.push(Na);return zb["return"]({U:M,yl:v,Dm:t,aesEncrypted:R,mimeType:p,endTime:M[M.length-1].endTime,na:G,om:D,Em:z})}})},CN=function(a,b,c,d){return b.some(function(e){return e.name===lL&&"NONE"===_.P(e,qL)})?null:(b=AN.Si(b,c,d))?b:a&&a.generatedIv?Object.assign({},a,{iv:AN.Yh(d)}):a},PM=function(a,b){b.forEach(function(c){var d=a.j.get(c.verbatimUri);wN.Qj(c,d,!EM(a))});wN.tl(b)},DN=function(a,b,c,d,e,f,g,h){var l;return _.H(function(m){if(1==
m.a)return a.L.has(b)?m["return"](a.L.get(b)):_.x(m,BN(a,c,d,f,g,h),2);l=m.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.L.set(b,l);return m["return"](l)})},BN=function(a,b,c,d,e,f){var g;return _.H(function(h){if(null==c.a)return h["return"](0);g=_.Y.ql(c,d);return h["return"](aM(a.Y,b,g,e,f,null!=d))})},bN=function(a,b){if(1===b.length)return b[0];var c=_.sj(a,b);if(null!=c)return c;throw new _.N(_.O,4,4025,{codecList:b});},zN=function(a,b,c,d){var e,f,g;return _.H(function(h){e=
d.a;g=(f=_.Y.bb(d.fa,mL))?_.xj(f,_.Ob):null;return h["return"](EN(a,b,c,e,g))})},EN=function(a,b,c,d,e){var f,g,h,l,m;return _.H(function(n){if(1==n.a){f=[d,e].filter(Boolean);if(g=_.vj(f,b,c))return n["return"](g);h=_.ck([d],a.a.attemptParameters);h.method="HEAD";h.type=2;return _.x(n,a.ag(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.N(_.O,4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.toLowerCase().split(";")[0])})},GM=function(a,b,c){c=_.Y.Xl(c);"LIVE"===a.A||"EVENT"===
a.A?(c=Math.max(c,b.K),isNaN(a.a.availabilityWindowOverride)||(c=a.a.availabilityWindowOverride),b.A=c):a.A===_.Wb&&(b.f=c)},FM=function(a){for(var b=0,c=_.u(a.j.values()),d=c.next();!d.done;d=c.next())b=Math.max(b,d.value.streams[0].rc);for(c=0;95443.7176888889<=b;)c+=95443.7176888889,b-=95443.7176888889;if(c)for(a.g.debug("Offsetting live streams by",c,"to compensate for rollover"),b=_.u(a.j.values()),d=b.next();!d.done;d=b.next())d=d.value.streams[0],95443.7176888889>d.rc?(a.g.debug("Offset applied to",
d.type),d.segmentIndex.offset(c)):a.g.debug("Offset NOT applied to",d.type)},WM=function(a,b){var c,d,e;return _.H(function(f){if(1==f.a)return c=_.ck([b],a.a.attemptParameters),c.type=1,_.x(f,a.ag(c),2);d=f.f;e="";try{e=_.Q.ea(d.data)}catch(g){throw new _.N(_.O,4,4042);}e=_.Q.Fi(e);e=e.trim();return f["return"]({text:e,response:d})})},EM=function(a){return a.A===_.Wb},rN=function(a,b){_.Y.Am(b,function(c,d){_.AE(a,c.U,d.startTime)});_.sE(a.a,b[0].startTime,b[b.length-1].endTime)},FN=function(){},
mN={xj:_.iD,zj:_.hD},lN={Cj:vL,Zo:"whole-segment",NONE:_.Qe},ML=/^#EXT-X-DEFINE/,NL=/^#(EXT-X-DISCONTINUITY-SEQUENCE|EXT-X-ENDLIST|EXT-X-I-FRAMES-ONLY|EXT-X-MEDIA-SEQUENCE|EXT-X-PART-INF|EXT-X-PLAYLIST-TYPE|EXT-X-SERVER-CONTROL|EXT-X-TARGETDURATION|EXT-X-DATERANGE|EXT-X-VERSION)/,tN=function GN(a){var c,d,e,f,g,h;return _.Ch(GN,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.u(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.D(0):_.x(l,{li:c,Yn:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{li:c,
item:e,Yn:d,next:h},5):l.D(5)}c++;d=e;e=h;g=f.next();return l.D(2)})};_.r=RL.prototype;_.r.set=function(a,b){var c=this;this.f.set(a,b);return b.then(function(d){return c.a.set(a,d)})["catch"](function(){}).then(function(){return c.f["delete"](a)})};_.r.has=function(a){return this.a.has(a)};_.r.get=function(a){return this.a.get(a)||null};_.r.values=function(){return Array.from(this.a.values())};_.r.clear=function(){this.f.clear();this.a.clear()};
var wN={tl:function(a){var b=wN.Jl(a),c=wN.Cm(a);a.forEach(function(d){var e=d.U,f=e.findIndex(function(h){return h.na===b}),g=e.findIndex(function(h){return h.na===c+1});-1===g&&(g=e.length);d.U=e.slice(f,g)})},Qj:function(a,b,c){b=wN.Ul(a,b,c);a=_.u(a.U||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.wd(c.fa,kL)&&b++,c.na=b},Ul:function(a,b,c){var d=_.Y.bb(a.fa,"EXT-X-DISCONTINUITY-SEQUENCE");if(d)return Number(d.value);d=wN.rm(b);if(c&&d)try{return wN.nm(a,b)}catch(e){throw new _.N(_.O,4,
4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}return 0},rm:function(a){return 0<wN.Wl(a)},wo:function(a){if(0===a.length)return[];var b=[],c=[];a=_.u(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.wd(d.fa,kL)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},Wl:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].U;return a[a.length-1].na},nm:function(a,b){var c=_.Y.bb(a.fa,nL);if(!c)throw wN.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),
Error(oL);c=Number(c.value);var d=hM(b,c);if(!d)throw wN.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(oL);return d.na},Cm:function(a){a=a.map(function(b){return b.U[b.U.length-1].na});return Math.min.apply(Math,_.gh(a))},Jl:function(a){a=a.map(function(b){return b.U[0].na});return Math.max.apply(Math,_.gh(a))}};wN.g=new _.J("clpp.hls.DiscontinuityUtils");var HN={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Kg)throw new _.N(_.O,4,4041);if(_.xj(a,qL)===rL)throw new _.N(_.O,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.KD(_.Cd,[{initDataType:_.Yf,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":YL,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":YL,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.xj(a,qL);if(!WL.includes(b))return XL.error("Widevine in HLS is only supported with [",
WL.join(", "),"], not",b),null;b=_.xj(a,_.Ob);b=_.yv(b);b=_.Oj(b.data);b=_.KD(_.Gd,[{initDataType:_.hd,initData:b}],"");if(a=_.P(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},WL=["SAMPLE-AES",rL],XL=new _.J("clpp.hls.DrmParser");var AN={Kn:function(a,b,c){if(_.Y.wd(a[0].fa,lL)||null===c)return c=AN.Ti(a,b),0===c.length?[{type:_.Qe,drmInfos:[],keyId:null}]:c;a=AN.Ti(a,b);return[c].concat(_.gh(a))},ta:function(a){if(0===a.length)return{type:_.Qe,drmInfos:[],keyId:null};if(a.some(function(c){return"whole-segment"===c.type})||a.every(function(c){return c.type===_.Qe}))return a[0];a=a.filter(function(c){return c.type===vL});var b=_.Ki(a.flatMap(function(c){return c.drmInfos}));return{keyId:a[a.length-1].keyId,type:vL,drmInfos:b}},
Ti:function(a,b){return AN.Cl(a).map(function(c){return AN.Nn(c.fa,b)}).filter(Boolean)},Cl:function(a){return a.filter(function(b){return _.Y.wd(b.fa,lL)})},Nn:function(a,b){var c=_.Y.pc(a,lL).filter(function(e){return"AES-128"!==_.xj(e,qL)});if(0===c.length)return null;var d=_.xj(c[0],qL);if(1===c.length&&"NONE"===d)return{type:_.Qe,drmInfos:[],keyId:null};d=c.map(function(e){return _.xj(e,qL)});if(!d.every(function(e){return"SAMPLE-AES"===e})&&!d.every(function(e){return e===rL}))throw AN.g.warn("EXT-X-KEY methods "+
d.join(", ")+" are incompatible."),new _.N(_.O,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");c=c.map(function(e){var f=_.P(e,"KEYFORMAT","identity"),g=HN[f]||null;(e=g?g(e,b):null)||AN.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===c.length)throw new _.N(_.O,4,4026);return{keyId:c.map(function(e){return e.keyIds}).reduce(function(e,f){return e.concat(f)},[]).reverse()[0]||null,type:vL,drmInfos:c}},tp:function(){return{type:_.Qe,drmInfos:[],keyId:null}},
Si:function(a,b,c){a=_.Y.pc(a,lL)[0];if(!a||"AES-128"!==_.xj(a,qL))return null;var d=AN.Ol(a,c);c=d.iv;d=d.generatedIv;return{method:"AES-128",url:_.Y.nd(b,_.xj(a,_.Ob)),iv:c,generatedIv:d}},Yh:function(a){return _.Rm(new Uint8Array(12),new Uint8Array([a>>24&255,a>>16&255,a>>8&255,a&255]))},Ol:function(a,b){var c=_.P(a,"IV","");if(c)return{iv:_.Om((c||"0x").slice(2)),generatedIv:!1};c=_.P(a,"KEYFORMAT");return null==c||"identity"===c?{iv:AN.Yh(b),generatedIv:!0}:{iv:null,generatedIv:!1}}};AN.g=new _.J("clpp.hls.EncryptionUtils");bM.prototype.length=function(){return this.streams.length};bM.prototype.f=function(){return this.streams[0].groupId};bM.prototype.a=function(){return this.streams[0].type};bM.prototype.dc=function(){return this.streams[0].zc};jM.prototype.length=function(){return this.a.length};_.r=wM.prototype;_.r.configure=function(a){this.a=a;this.Y.a=a};_.r.setCurrentVariant=function(a){this.w=a};_.r.start=function(a,b){var c=this,d,e,f,g,h,l,m;return _.H(function(n){if(1==n.a){if(c.P)throw Error("start() may be called only once!");c.P=!0;c.F=b;d=Date.now();return _.x(n,WM(c,a),2)}if(3!=n.a)return e=n.f,f=e.response,g=e.text,h=Date.now(),c.F.onEvent(new _.K(uL,{detail:{duration:h-d,type:"master"}})),c.o=f.uri,_.x(n,HM(c,g),3);l=n.f;c.f=l;m=c.H;c.l&&0<m&&c.l.ga(m);return n["return"](l)})};
_.r.requestStop=function(){this.N=!0};_.r.stop=function(){this.l&&(this.l.stop(),this.l=null);var a=[];this.G&&(a.push(this.G.destroy()),this.G=null);this.j.clear();this.f=this.a=this.F=this.w=null;this.B.clear();this.J.clear();return Promise.all(a)};
_.r.update=function(){var a=this,b,c,d,e,f,g,h,l,m,n;return _.H(function(p){switch(p.a){case 1:b=a.f;if(EM(a)||!b)return p["return"]();c=b.presentationTimeline;"LIVE"===a.A&&(a.C=null);d=Array.from(a.j.values());a.a.lowLatencyMode&&null!==a.w&&(e=xM(a),d=d.filter(function(q){return e.includes(q.dc())}));return _.x(p,$M(a,d),2);case 2:return f=p.f,g=f.map(function(q){return q.playlist}),PM(a,g),_.x(p,KM(a,f),3);case 3:h=p.f;lM(b.periods,h).forEach(function(q){a.F.filterNewPeriod(q)});CM(a,h);l=UM(a,
g);m=VM(a,g,l);b.cues=yM(a,m);nM(b.periods,h);rN(c,h);if(n=_.Y.km(g))!0!==a.a.keepTimelineLive&&(a.A=_.Wb,_.wE(c,!0),c.f=h[h.length-1].endTime),a.l.stop(),a.l=null;if(a.F.onUpdate)a.F.onUpdate(b);if(n&&a.F.onTurnedStatic)a.F.onTurnedStatic();if(!a.N){p.D(4);break}return _.x(p,a.stop(),4);case 4:return p["return"](b)}})};
_.r.loadVariant=function(a,b){var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z,A,D;return _.H(function(G){if(1==G.a){d=a.id;if(e=c.f.periods.find(function(B){return B.id===b}))if(f=e.variants.find(function(B){return B.id===d}))return G["return"](f);g=c.f.alternativeVariants.find(function(B){return B.id===d});if(!g)throw new _.Zi("No alternative variant with id: "+d);h=g;m=l=null;h.audio&&(n=h.audio,l=kN(c,n.verbatimUri,function(){var B;return _.H(function(F){if(1==F.a)return _.x(F,XM(c,n),2);B=F.f;return F["return"](fN(c,
n,B))})}));h.video&&(p=h.video,m=kN(c,p.verbatimUri,function(){var B;return _.H(function(F){if(1==F.a)return _.x(F,XM(c,p),2);B=F.f;return F["return"](fN(c,p,B))})}));return _.x(G,l,2)}if(3!=G.a)return q=G.f,_.x(G,m,3);t=G.f;if(v=JM(c,q,t,h.bandwidth,h.id))A=c.F.configurationId,D=sM(A,[v],[],[],!EM(c)),c.F.filterAllPeriods(D),D.forEach(function(B,F){c.f.periods[F].variants.push(B.variants[0]);b===c.f.periods[F].id&&(z=B.variants[0])});if(!z)throw new _.Zi("Could load variant with id: "+d);return G["return"](z)})};
_.r.loadTextStream=function(a,b){var c=this,d,e,f,g,h,l;return _.H(function(m){if(1==m.a){(e=c.f.periods.find(function(n){return n.id===b}))&&(f=e.textStreams.find(function(n){return n.id===a})||null)&&(d=f);if(d||!c.f.alternativeTextStreams)return m.D(2);g=c.f.alternativeTextStreams.find(function(n){return n.id===a})||null;if(!g)throw new _.Zi(_.PC+a);h=g;return _.x(m,kN(c,h.verbatimUri,function(){var n;return _.H(function(p){if(1==p.a)return _.x(p,XM(c,h),2);n=p.f;return p["return"](fN(c,h,n))})}),
3)}2!=m.a&&(l=m.f)&&c.f.periods.forEach(function(n,p){var q=l.streams[p];c.f.periods[p].textStreams.push(q);q.id===a&&(d=q)});if(!d)throw new _.Zi(_.PC+a);return m["return"](d)})};_.r.hc=function(){var a=this,b,c;return _.H(function(d){if(1==d.a){a.g.debug(_.ZC);if(!a.F)return d["return"]();_.C(d,2);return _.x(d,a.update(),4)}if(2!=d.a)return a.l&&0<a.H&&a.l.ga(a.H),_.uh(d,0);b=_.E(d);if(!(b instanceof _.N))throw b;a.F&&(a.F.onError(b),c=b,1===c.severity&&a.l&&a.l.ga(.1));_.y(d)})};
_.r.ag=function(a){if(!this.G)throw new _.N(_.O,7,7001);a=this.F.networkingEngine.fetch(a);_.ok(this.G,a);return a.S};_.w(FN,_.Bu);FN.prototype.f=function(){_.dv.m3u8=wM;_.bv[_.Zl]=wM;_.bv[tL]=wM};FN.prototype.a=function(){_.sF("m3u8");_.tF(_.Zl);_.tF(tL)};FN.prototype.id=function(){return"hls"};_.I("clpp.hls.HlsComponent",FN);};
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));}
})();