@castlabs/prestoplay 6.23.1 → 6.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +116 -116
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +607 -591
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +88 -86
  10. package/cjs/cl.externs.js +105 -54
  11. package/cjs/cl.freewheel.js +25 -24
  12. package/cjs/cl.hls.js +77 -71
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +24 -23
  16. package/cjs/cl.mse.js +352 -342
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +15 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -16
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +37 -37
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +88 -88
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +491 -478
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +82 -80
  41. package/cl.externs.js +105 -54
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +79 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +18 -17
  47. package/cl.mse.js +310 -306
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +10 -10
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +60 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +28 -28
  64. package/package.json +1 -1
  65. package/typings.d.ts +54 -25
package/cjs/cl.smooth.js CHANGED
@@ -1,76 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var FR="Full MP4 box must have flags defined",GR="clpp.smooth.SmoothMP4Processor",HR="codecPrivateData",IR=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.W(a,c);_.W(a,d)},JR=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.fn()}},KR=function(a,b){JR(a,b>>16&255);JR(a,b>>8&255);JR(a,b&255)},LR=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.fn()}},MR=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.fn()}},NR=function(a,b){try{a.f.setInt16(a.a,
3
- b,a.h),a.a+=2}catch(c){_.fn()}},OR=function(a,b){if(void 0!==b){for(var c=new Uint8Array(b),d=Math.min(a.length,b),e=0;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}c=new Uint8Array(a.length);for(d=0;d<a.length;++d)c[d]=a.charCodeAt(d);return c},PR=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]},Z=function(a,b,c){PR.call(this,a);this.version=b;this.flags=c},QR=function(a,b,c){PR.call(this,a);this.f=b;this.offset=c},RR=function(a,
4
- b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},SR=function(a,b,c){PR.call(this,"ftyp");this.h=a;this.Ji=b;this.f=c},TR=function(){PR.call(this,_.Ve)},UR=function(){PR.call(this,_.ug)},VR=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},WR=function(){PR.call(this,"mvex")},YR=function(a){Z.call(this,"trex",0,0);this.f=a},ZR=function(a,b,c,d,e){Z.call(this,"tkhd",
5
- 1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},$R=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},aS=function(a){Z.call(this,"hdlr",0,0);this.f=a},bS=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},cS=function(a){PR.call(this,a);this.w=!0},dS=function(a){cS.call(this,a);this.height=this.width=0;this.depth=24},
6
- eS=function(a,b,c,d){cS.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},fS=function(a,b){dS.call(this,"avc1");this.width=a;this.height=b},gS=function(a,b){fS.call(this,a,b);this.type="encv"},hS=function(a,b,c){eS.call(this,"mp4a",a,b,c)},iS=function(a,b,c){hS.call(this,a,b,c);this.type="enca"},jS=function(a,b){PR.call(this,"avcC");this.bb=a;this.oc=b;this.version=1;this.f=this.bb[0][1];this.h=this.bb[0][2];this.level=this.bb[0][3]},kS=function(a){Z.call(this,"esds",0,0);this.lc=
7
- a},lS=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},mS=function(){Z.call(this,"dref",0,0)},nS=function(){PR.call(this,_.kg)},oS=function(){Z.call(this,_.mg,0,0)},pS=function(){Z.call(this,"stts",0,0)},qS=function(){Z.call(this,"stsc",0,0)},rS=function(){Z.call(this,"stco",0,0)},sS=function(){Z.call(this,"stsz",0,0)},tS=function(){Z.call(this,"smhd",0,0)},uS=function(){PR.call(this,"dinf")},vS=function(){PR.call(this,_.Ue)},wS=function(){PR.call(this,_.Qe)},xS=function(a,b){Z.call(this,
8
- "tfdt",a,0);this.baseMediaDecodeTime=b},yS=function(){Z.call(this,"mfhd",0,0);this.f=0},zS=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},AS=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},BS=function(){PR.call(this,"traf")},CS=function(){PR.call(this,"moof")},DS=function(){PR.call(this,_.Pe);this.f=new Uint8Array(0)},ES=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},FS=
9
- function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.ec=""},GS=function(a){PR.call(this,"frma");this.f=a},HS=function(){Z.call(this,"saio",0,0);this.offset=[0]},IS=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},JS=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},KS=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},LS=function(a,b,c,d){c=b.ai[c];b=b.Ao;a=a.replace("Manifest","");b=b.replace("{bitrate}",
10
- String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.iE([a],[b])[0]},MS=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",HR,"fourCC"]:a.type===_.Zc&&(c=["bitrate",HR,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.pa(a,b,c,["id","segmentIndex"])},NS=function(a,b,c){var d=c.Qe.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,bb:null,
11
- oc:null,width:NaN,height:NaN,lc:null,ve:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.bb=[_.Uj(d[1])];a.oc=[_.Uj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Zc:a.lc=_.Uj(c.Qe),a.sampleSize=c.Rj||16,a.ve=c.ve,a.channelCount=c.rh}return a},OS=function(a,b){return a.filter(function(c){return c.type===b})},PS=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},WS=function(a,b,
12
- c){var d=null;if(QS.test(a)){a=QS.exec(a);d=Number(a[1]);var e=Number(a[2]),f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}else RS.test(a)?d=PS(RS,a):SS.test(a)?d=PS(SS,a):TS.test(a)?(a=TS.exec(a),d=Number(a[1])/c.frameRate):US.test(a)?(a=US.exec(a),d=Number(a[1])/c.a):VS.test(a)&&(d=PS(VS,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*
13
- d);return b+":"+c+":"+a+"."+d},XS=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))},ZS=function(a){this.a=a;this.f=YS(this)},YS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.en(b)},$S=function(a,b,c){a:{var d=_.w([_.Qd,_.Od]);for(var e=d.next();!e.done;e=d.next())if((e=c.We(e.value))&&e.keyId){d=e.keyId;break a}_.Jh(GR,
14
- "Could not get default Key ID for DRM init data!");d=null}c=new PR("xxxx");a.type===_.r?c=new gS(a.width,a.height):c=new iS(a.channelCount,a.sampleSize,a.ve);a=new ES;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new PR("schi")).append([a]);b=(new PR(_.eg)).append([new GS(b),new FS(_.qd,65536),a]);c.append([b]);return c},aT=function(a,b){var c=b.$e(),d=new VR(a.timescale,a.duration,a.id),e=(new WR).append([new YR(a.id)]),f=new ZR(a.id,a.duration,a.timescale,a.width,a.height),g=new $R(a.timescale,
15
- a.duration),h=new aS(a.type),l=null,m=new mS;m.entries=[new lS];var n=new oS;switch(a.type){case _.r:var p=new jS(a.bb,a.oc);c?(l=$S(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new fS(a.width,a.height)).append([p]),n.entries=[l]);l=new bS;break;case _.Zc:p=new kS(a.lc),c?(l=$S(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new hS(a.channelCount,a.sampleSize,a.ve)).append([p]),n.entries=[l]),l=new tS}n=(new nS).append([n,new pS,new qS,new sS,new rS]);m=(new uS).append([m]);m=(new vS).append([l,m,n]);
16
- g=(new wS).append([g,h,m]);f=(new UR).append([f,g]);d=(new TR).append([d,f,e]);e=new SR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.We(_.Od),f=b.We(_.Qd),c&&d.append([new QR("pssh",c.initData,8)]),f&&d.append([new QR("pssh",f.initData,8)]),c||f||_.Jh(GR,"Could not get PSSH init data!"));c=new ZS([e,d]);return _.Hj(c.write())},cT=function(a,b){var c,d,e,f,g,h;(new _.sn).N("moof",_.tn).Z("mfhd",function(m){var n=new yS;n.f=_.nn(m.reader);c=n}).N("traf",_.tn).Z("tfhd",function(m){var n=m.reader.Sa();if(null===
17
- m.flags)throw new _.P(_.Q,3,3019,FR);var p=new AS(m.version||0,m.flags||0);p.f=_.nn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.pn(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.nn(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.nn(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.nn(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.nn(m.reader));d=p}).Z("trun",function(m){var n=m.reader.Sa();if(null===m.flags)throw new _.P(_.Q,3,3019,FR);var p=new zS(m.version||
18
- 0,m.flags||0);p.f=_.nn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.on(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.nn(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.nn(m.reader)),m.flags&512&&p.sampleSize.push(_.nn(m.reader)),m.flags&1024&&p.A.push(_.nn(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.nn(m.reader)):p.h.push(_.on(m.reader)));e=p}).Z("sdtp",function(m){var n=_.rn(m.reader,m.reader.Sa());f=new RR("sdtp",m.version||0,m.flags||
19
- 0,n,0)}).N("uuid",function(m){var n=_.rn(m.reader,16);if(_.Wj(n,bT)){n=_.nn(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new JS(m.version,m.flags);n.h=_.nn(m.reader);m.flags&1&&(n.j=_.ln(m.reader));for(var p=0;p<n.h;p++){var q={si:_.rn(m.reader,8),wd:0,Sg:[]};if(m.flags&2){q.wd=_.mn(m.reader);for(var u=0;u<q.wd;u++){var v={oh:0,ph:0};v.oh=_.mn(m.reader);v.ph=_.nn(m.reader);q.Sg.push(v)}}n.f.push(q)}g=n}}).N(_.Pe,function(m){var n=new DS;0<m.reader.Sa()?n.f=_.rn(m.reader,m.reader.Sa()):(_.Jh(GR,
20
- "mdat box is empty!"),n.f=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new BS).append([d,e]);f&&l.append([f]);b.$e()&&g&&l.append([g]);l=(new CS).append([c,l]);return new ZS([l,h])},dT=function(a,b,c,d){var e=d.$e(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=cT(b,d);if(null===g)return a.request.contentType===_.R?a.data:g;d=g.get(_.Pe);if(a.request.contentType===_.R){e=d.f.buffer;if(c){e=_.T.Zd(e);if((e=(new DOMParser).parseFromString(e,_.sg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
- e.documentElement;if(h&&(d=new XS(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.qe],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],u=new RegExp("\\w+:"+q),v=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var z=q.length;v<z;v++){var A=q[v].name;if(A=A.match(u)){p=
22
- p.getAttribute(A[0]);break b}}p=null}}f.setAttribute(l[m],WS(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.T.cb(e).buffer}else c=e;return c}h=new CS;a=g.get("mfhd");b=new BS;l=g.get("tfhd");m=new xS(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.f=1;l.flags&=16777214;l.flags|=131072;b.append([l,m,f]);n&&b.append([n]);if(e){g=0;l=[];if(c.flags&2)for(l=[],m=0;m<c.h;m++)l.push(10+6*c.f[m].wd);else g=8;b.append([c,new HS,new IS(g,l,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=
23
- new ZS([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},eT=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},fT=function(a,b,c){a=_.$o(a);c&&a.version!==c&&(a=_.ZD(a,c));return{initData:_.XD(a),initDataType:_.qd,keyId:b,periodId:null}},hT=function(){this.A=this.j=this.f=
24
- this.D=null;this.h=1;this.P=0;this.o="";this.C=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.M=gT;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.Wn.bind(this);this.H=new Map},iT=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.gk(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,
25
- c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.D.networkingEngine.fetch(c),_.y(f,d.T,2);e=f.f;a.o=e.uri;return f["return"](e)})},pT=function(a,b){var c=_.Vo,d=null;try{var e=_.T.Zd(b);d=c.se(e,_.Xb)}catch(uY){}if(!d)throw a.g.error("Unable to parse manifest"),new _.P(_.Q,4,4033,a.o);var f=+jT(a,d,"MajorVersion"),g=+jT(a,d,"MinorVersion"),h=+d.getAttribute("TimeScale")||1E7,l=+jT(a,d,"Duration"),m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||
26
- Infinity,q=c.X(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+f+"."+g))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.P(_.Q,4,4036,a.o);m?(kT(a,lT),a.B=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):kT(a,gT);a.a={startTime:0,delay:0,duration:l/h,ag:p/h,oe:0};if(q){var u=a.f.playreadyVersion,v=_.Vo,z=[],A=v.X(q,"ProtectionHeader")[0],H=_.Tj(v.ra(A)||""),G=_.$o(H).a;z.push(eT(_.Qd,{initData:_.XD(_.So(G)),initDataType:_.qd,
27
- keyId:G,periodId:null},[G]));z.push(eT(_.Od,fT(H,G,u),[G]));a.w=z}var D=[],F=_.Vo.X(d,"StreamIndex");if(!F.length)throw a.g.error("No streams found!"),new _.P(_.Q,4,4034,a.o);for(var M=0;M<F.length;M++){for(var O,S=a,V=F[M],ra=jT(S,V,"Type"),Da=+V.getAttribute("Chunks"),Ea=V.getAttribute("Subtype")||"",Fa=V.getAttribute("Language")||_.xg,Sa=_.yj(Fa),sb=V.getAttribute("Name")||"",Id=+V.getAttribute(_.ub),Fg=+V.getAttribute(_.tb),rc=jT(S,V,"Url"),wu=+V.getAttribute("TimeScale")||null,KJ=[],LJ=_.Vo.X(V,
28
- _.Nb),jv=0;jv<LJ.length;jv++){var Df=void 0,tc=void 0,kv=void 0,Ef=S,Ld=LJ[jv],lv=ra,$W=+Ld.getAttribute("Index"),aX=+jT(Ef,Ld,"Bitrate"),MJ=NaN,NJ=NaN,ro=NaN,mv=NaN,OJ=NaN,PJ=NaN,QJ=NaN,RJ=Ld.getAttribute("FourCC")||"";switch(lv){case _.r:MJ=+jT(Ef,Ld,_.tb);NJ=+jT(Ef,Ld,_.ub);break;case _.Zc:mv=+Ld.getAttribute("Channels")||2,ro=+jT(Ef,Ld,"SamplingRate"),PJ=+jT(Ef,Ld,"AudioTag"),OJ=+jT(Ef,Ld,"BitsPerSample"),QJ=+jT(Ef,Ld,"PacketSize")}var nv=String(Ld.getAttribute("CodecPrivateData"));if(lv===_.Zc&&
29
- !nv){var SJ=mv,TJ={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},so=TJ[ro];if("AACH"===RJ){tc=new Uint8Array(4);var UJ=TJ[2*ro];tc[0]=40|so>>1;tc[1]=so<<7|SJ<<3|UJ>>1;tc[2]=UJ<<7|8;tc[3]=0;Df=new Uint16Array(2);Df[0]=(tc[0]<<8)+tc[1];Df[1]=(tc[2]<<8)+tc[3];kv=Df[0].toString(16)+Df[1].toString(16)}else tc=new Uint8Array(2),tc[0]=16|so>>1,tc[1]=so<<7|SJ<<3,Df=new Uint16Array(1),Df[0]=(tc[0]<<8)+tc[1],kv=Df[0].toString(16);nv=kv.toUpperCase()}var bX=
30
- {id:Ef.P++,type:lv,index:$W,bitrate:aX,Qe:nv,maxHeight:MJ,maxWidth:NJ,ve:ro,rh:mv,Po:PJ,Rj:OJ,gp:QJ,Jl:RJ,segmentIndex:null};KJ.push(bX)}O=KJ;for(var Le=[],VJ=_.Vo.X(V,"c"),rk=0;rk<VJ.length;rk++){var ov=VJ[rk],me=parseInt(ov.getAttribute("t"),10),ci=parseInt(ov.getAttribute("d"),10),pv=parseInt(ov.getAttribute("r"),10),sk=0;if(isNaN(me)&&isNaN(ci))throw S.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.P(_.Q,4,4037,S.o);0===rk&&
31
- isNaN(me)&&(sk=me=0);if(0<rk){var Ig=Le[Le.length-1];sk=Ig.n+1;Ig.d||(Ig.d=me-Ig.t);me||(me=Ig.t+Ig.d);ci||(ci=me-Ig.t)}Le.push({n:sk,d:ci,t:me});if(pv){pv--;for(var WJ=0;WJ<pv;WJ++){var to=Le[Le.length-1];sk=to.n+1;me=to.t+to.d;ci=to.d;Le.push({n:sk,d:ci,t:me})}}}S.Od()||Le.length===Da||S.g.warn("Number of fragments ("+Da+") differs from number of chunks ("+Le.length+").");D.push({type:ra,Uo:Da,ko:Ea,language:Sa,ne:Fa,name:sb,maxWidth:Id,maxHeight:Fg,Ao:rc,tracks:O,ai:Le,timescale:wu})}var Ff={ep:f,
32
- Ji:g,timescale:h,duration:l,isLive:m,cp:n,ag:p,jg:!1,streams:D};if(a.j&&a.A)return mT(a,Ff),Promise.resolve();a.H.clear();var qv=Ff.timescale,uo=Ff.duration,dX=OS(Ff.streams,_.Zc),eX=OS(Ff.streams,_.r),fX=OS(Ff.streams,_.R),XJ=[],vo=nT(a,uo,qv,dX),wo=nT(a,uo,qv,eX),gX=nT(a,uo,qv,fX);vo.length||(vo=[null]);wo.length||(wo=[null]);for(var sv=0;sv<wo.length;sv++)for(var uv=0;uv<vo.length;uv++)XJ.push(oT(a,wo[sv],vo[uv]));var YJ={id:"ID",configurationId:void 0,startTime:0,endTime:uo,variants:XJ,textStreams:gX,
33
- thumbStreams:[]};var iX=Ff.streams,vv=a.a.startTime,ZJ=a.a.delay,wv=a.J,$J=Math.min(a.a.duration||Infinity,wv),xv=a.Od(),jX=a.a.ag,kX=a.a.oe,aK=a.I,bK=isFinite(a.G)?a.G:0;if(xv)$J=Infinity,vv=Date.now()/1E3-kX,a.a.startTime=vv,ZJ=3*aK;else for(var lX=isFinite(wv)?wv:a.a.duration,cK=_.w(iX),yv=cK.next();!yv.done;yv=cK.next())for(var dK=_.w(yv.value.tracks),zv=dK.next();!zv.done;zv=dK.next()){var eK=zv.value;eK.segmentIndex.offset(-bK);_.LE(eK.segmentIndex,lX)}var fK=a.f.timeline||{};fK.type=void 0;
34
- a.C=new _.TE(fK,vv,ZJ,!xv,!0);a.C.f=$J;_.aF(a.C,aK);a.C.A=jX;xv||a.C.offset(-bK);a.D.filterAllPeriods([YJ]);a.j={presentationTimeline:a.C,periods:[YJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.D.networkingEngine.Yc(a.L),a.K=!0);a.A=Ff;return Promise.resolve()},mT=function(a,b){for(var c=0;c<a.A.streams.length;c++)for(var d=b.streams[c],e={},f=_.w(a.A.streams[c].tracks),g=f.next();!g.done;e={ic:e.ic},g=f.next())if(e.ic=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
35
- l.ic.type&&m.bitrate===l.ic.bitrate}}(e))){MS(e.ic,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=qT(a,a.A.timescale,d,g);g=e.ic.segmentIndex;g.ta(h);(h=a.a.ag)&&_.qF(g,_.pF(g)-h).forEach(function(l){l.$a().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.ic.type+" track with bitrate "+(e.ic.bitrate+". Skipping update."))},nT=function(a,b,c,d){for(var e=[],f={Tc:0};f.Tc<d.length;f={Tc:f.Tc},
36
- f.Tc++){var g=d[f.Tc].tracks.map(function(h){return function(l){var m=d[h.Tc],n=qT(a,c,m,l);n=new _.oF(n);var p=null;m.type!==_.R&&(p=rT(a,b,c,m,l));l.segmentIndex=n;var q=_.xL++,u=Promise.resolve.bind(Promise),v=n.dd.bind(n),z=n.get.bind(n),A=n.Fd.bind(n),H=n.getDuration.bind(n),G=sT[m.type],D="";switch(m.type){case _.r:D=l.Qe;var F=/00000001[0-9]7/.exec(D);D="avc1."+(F&&F[0]?D.substr(D.indexOf(F[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",D);break;case _.Zc:D=l.Qe,F=2,"AACH"===l.Jl?F=5:D&&(F=
37
- (parseInt(D.substr(0,2),16)&248)>>3),D="mp4a.40."+F,a.g.debug("AUDIO CODECS: ",D)}F=m.type===_.R?tT[m.ko]:void 0;return{id:q,originalId:null,jp:null,createSegmentIndex:u,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:A,getDuration:H,segmentIndex:n,segmentLookupStrategy:_.FD,initSegmentReference:p,mimeType:G,codecs:D,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:F,encrypted:a.lg(),keyId:null,language:m.language,originalLanguage:m.ne,
38
- label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.rh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},qT=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.ai.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=LS(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.wj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.r||c.type===_.Zc)b=f[f.length-
39
- 1],a.J=Math.min(a.J,e),0===a.a.oe?a.a.oe=b.endTime:a.a.oe=Math.min(a.a.oe,b.endTime);return f},rT=function(a,b,c,d,e){b=NS(b,d.timescale||c,e);c={isLive:a.Od.bind(a),$e:a.lg.bind(a),Ql:function(){return 1},We:a.di.bind(a)};d=new Uint8Array(0);try{d=aT(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.P(_.Q,3,4035,g);}var f="data:text/plain;base64,"+_.Sj(d);return new _.kE(function(){return[f]},0,null,null,!0)},oT=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:
40
- 0),e=c?c.language:_.xg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},jT=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.P(_.Q,4,4038,a.o,c);},uT=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.cc.bind(a),b))},kT=function(a,b){var c=b===gT;a.j&&a.j.presentationTimeline&&_.WE(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),
41
- a.l=null,a.B=null);a.M=b},vT=function(){};PR.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.children.push(a[b]),a[b].parent=this;return this};PR.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.children.length;b++){if(this.children[b].type===a)return this.children[b];var c=this.children[b].get(a);if(c)return c}return null};
42
- PR.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(var c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b};
43
- PR.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.W(a,1):_.W(a,this.size);_.gn(a,OR(this.type));this.size>b&&IR(a,this.size);"uuid"===this.type&&_.gn(a,null);if(0<this.children.length&&!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()};_.x(Z,PR);Z.prototype.a=function(){return 4+PR.prototype.a.call(this)};
44
- Z.prototype.write=function(a){PR.prototype.write.call(this,a);JR(a,this.version);KR(a,this.flags)};_.x(QR,PR);QR.prototype.a=function(){return this.f.byteLength+PR.prototype.a.call(this)-this.offset};QR.prototype.write=function(a){PR.prototype.write.call(this,a);_.gn(a,this.f,this.offset);a.getPosition()};_.x(RR,Z);RR.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};RR.prototype.write=function(a){Z.prototype.write.call(this,a);_.gn(a,this.f,this.offset);a.getPosition()};
45
- _.x(SR,PR);SR.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+PR.prototype.a.call(this)};SR.prototype.write=function(a){PR.prototype.write.call(this,a);_.gn(a,OR(this.h));_.W(a,this.Ji);_.gn(a,OR(this.f.join("")));a.getPosition()};_.x(TR,PR);_.x(UR,PR);_.x(VR,Z);VR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=Z.prototype.a.call(this)};
46
- VR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(IR(a,0),IR(a,0),_.W(a,this.timescale),IR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);LR(a,this.volume);LR(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)JR(a,this.f[b]);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,this.h);a.getPosition()};_.x(WR,PR);_.x(YR,Z);YR.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
- YR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);_.W(a,1);_.W(a,0);_.W(a,0);_.W(a,0);a.getPosition()};_.x(ZR,Z);ZR.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+Z.prototype.a.call(this)};
48
- ZR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(IR(a,0),IR(a,0),_.W(a,this.h),_.W(a,0),IR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.h),_.W(a,0),_.W(a,this.duration*this.timescale));_.W(a,0);_.W(a,0);LR(a,0);LR(a,0);LR(a,this.volume);LR(a,0);for(var b=0;b<this.f.length;b++)JR(a,this.f[b]);LR(a,this.width);LR(a,0);LR(a,this.height);LR(a,0);a.getPosition()};_.x($R,Z);$R.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
- $R.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(IR(a,0),IR(a,0),_.W(a,this.timescale),IR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));LR(a,this.language);LR(a,0);a.getPosition()};_.x(aS,Z);aS.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
- aS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.r?_.gn(a,OR("vide")):_.gn(a,OR("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.r?_.gn(a,OR("VideoHandler\x00")):_.gn(a,OR("SoundHandler\x00"));a.getPosition()};_.x(bS,Z);bS.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};bS.prototype.write=function(a){Z.prototype.write.call(this,a);LR(a,0);_.gn(a,this.f);a.getPosition()};_.x(cS,PR);cS.prototype.a=function(){return 8+PR.prototype.a.call(this)};
51
- cS.prototype.write=function(a){PR.prototype.write.call(this,a);_.W(a,0);LR(a,0);LR(a,1)};_.x(dS,cS);dS.prototype.a=function(){return 70+cS.prototype.a.call(this)};dS.prototype.write=function(a){cS.prototype.write.call(this,a);LR(a,0);LR(a,0);_.W(a,0);_.W(a,0);_.W(a,0);LR(a,this.width);LR(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);LR(a,1);JR(a,10);_.gn(a,OR("AVC Coding",31));LR(a,this.depth);NR(a,-1)};_.x(eS,cS);eS.prototype.a=function(){return 20+cS.prototype.a.call(this)};
52
- eS.prototype.write=function(a){cS.prototype.write.call(this,a);_.W(a,0);_.W(a,0);LR(a,this.channelCount);LR(a,this.sampleSize);NR(a,0);LR(a,0);LR(a,this.sampleRate);LR(a,0)};_.x(fS,dS);fS.prototype.write=function(a){dS.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.x(gS,fS);_.x(hS,eS);hS.prototype.write=function(a){eS.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
53
- _.x(iS,hS);_.x(jS,PR);jS.prototype.a=function(){for(var a=7,b=0;b<this.bb.length;b++)a+=2,a+=this.bb[b].byteLength;for(b=0;b<this.bb.length;b++)a+=2,a+=this.oc[b].byteLength;return a+PR.prototype.a.call(this)};
54
- jS.prototype.write=function(a){PR.prototype.write.call(this,a);JR(a,this.version);JR(a,this.f);JR(a,this.h);JR(a,this.level);JR(a,255);JR(a,224|this.bb.length);for(var b=0;b<this.bb.length;b++)LR(a,this.bb[b].length),_.gn(a,this.bb[b]);JR(a,this.oc.length);for(b=0;b<this.oc.length;b++)LR(a,this.oc[b].length),_.gn(a,this.oc[b]);a.getPosition()};_.x(kS,Z);kS.prototype.a=function(){return 22+(this.lc.byteLength+3)+Z.prototype.a.call(this)};
55
- kS.prototype.write=function(a){Z.prototype.write.call(this,a);JR(a,3);JR(a,23+this.lc.byteLength);LR(a,1);JR(a,0);JR(a,4);JR(a,15+this.lc.byteLength);JR(a,64);JR(a,21);KR(a,0);_.W(a,0);_.W(a,0);JR(a,5);JR(a,this.lc.byteLength);_.gn(a,this.lc);_.gn(a,new Uint8Array([6,1,2]));a.getPosition()};_.x(lS,Z);lS.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};lS.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.gn(a,OR(this.location));a.getPosition()};
56
- _.x(mS,Z);mS.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};mS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(nS,PR);_.x(oS,Z);oS.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
57
- oS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(pS,Z);pS.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};pS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(qS,Z);
58
- qS.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};qS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(rS,Z);rS.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
59
- rS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(sS,Z);sS.prototype.a=function(){return 8+Z.prototype.a.call(this)};sS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.x(tS,Z);tS.prototype.a=function(){return 4+Z.prototype.a.call(this)};tS.prototype.write=function(a){Z.prototype.write.call(this,a);NR(a,0);LR(a,0);a.getPosition()};
60
- _.x(uS,PR);_.x(vS,PR);_.x(wS,PR);_.x(xS,Z);xS.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};xS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?IR(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.x(yS,Z);yS.prototype.a=function(){return 4+Z.prototype.a.call(this)};yS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);a.getPosition()};_.x(zS,Z);
61
- zS.prototype.a=function(){var a=4;this.flags&wT&&(a+=4);this.flags&xT&&(a+=4);for(var b=0;b<this.f;b++)this.flags&yT&&(a+=4),this.flags&zT&&(a+=4),this.flags&AT&&(a+=4),this.flags&BT&&(a+=4);return a+Z.prototype.a.call(this)};
62
- zS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&wT&&(a.getPosition(),MR(a,this.j));this.flags&xT&&_.W(a,this.l);for(var b=0;b<this.f;b++)this.flags&yT&&_.W(a,this.o[b]),this.flags&zT&&_.W(a,this.sampleSize[b]),this.flags&AT&&_.W(a,this.A[b]),this.flags&BT&&(0===this.version?_.W(a,this.h[b]):MR(a,this.h[b]));a.getPosition()};var wT=1,xT=4,yT=256,zT=512,AT=1024,BT=2048;_.x(AS,Z);
63
- AS.prototype.a=function(){var a=4;this.flags&CT&&(a+=8);this.flags&DT&&(a+=4);this.flags&ET&&(a+=4);this.flags&FT&&(a+=4);this.flags&GT&&(a+=4);return a+Z.prototype.a.call(this)};AS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&CT&&IR(a,this.h);this.flags&DT&&_.W(a,this.A);this.flags&ET&&_.W(a,this.j);this.flags&FT&&_.W(a,this.o);this.flags&GT&&_.W(a,this.l);a.getPosition()};var CT=1,DT=2,ET=8,FT=16,GT=32;_.x(BS,PR);_.x(CS,PR);_.x(DS,PR);
64
- DS.prototype.a=function(){return this.f.byteLength+PR.prototype.a.call(this)};DS.prototype.write=function(a){PR.prototype.write.call(this,a);0<this.f.byteLength&&_.gn(a,this.f)};_.x(ES,Z);ES.prototype.a=function(){var a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+Z.prototype.a.call(this)};
65
- ES.prototype.write=function(a){Z.prototype.write.call(this,a);JR(a,0);0===this.version?JR(a,0):JR(a,0);JR(a,this.f);JR(a,this.h);_.gn(a,_.Uj(this.l));if(1===this.f&&0===this.h){JR(a,0);for(var b=0;b<this.j.length;b++)JR(a,this.j[b])}a.getPosition()};_.x(FS,Z);FS.prototype.a=function(){var a=8;this.flags&1&&(a+=OR(this.ec).byteLength);return a+Z.prototype.a.call(this)};FS.prototype.write=function(a){Z.prototype.write.call(this,a);_.gn(a,OR(this.f));_.W(a,this.h);this.flags&1&&_.gn(a,OR(this.ec));a.getPosition()};
66
- _.x(GS,PR);GS.prototype.a=function(){return OR(this.f).byteLength+PR.prototype.a.call(this)};GS.prototype.write=function(a){PR.prototype.write.call(this,a);_.gn(a,OR(this.f));a.getPosition()};_.x(HS,Z);HS.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};
67
- HS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));_.W(a,1);for(var b=0;1>b;b++)0===this.version?_.W(a,this.offset[b]):IR(a,this.offset[b]);a.getPosition()};_.x(IS,Z);IS.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+Z.prototype.a.call(this)};
68
- IS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));JR(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)JR(a,this.j[b]);a.getPosition()};_.x(JS,Z);JS.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].si.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].wd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
- JS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&JR(a,this.j);for(var b=0;b<this.h;b++)if(_.gn(a,this.f[b].si),this.flags&2){LR(a,this.f[b].wd);for(var c=0;c<this.f[b].wd;c++)LR(a,this.f[b].Sg[c].oh),_.W(a,this.f[b].Sg[c].ph)}a.getPosition()};var QS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,RS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,SS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,TS=/^(\d*\.?\d*)f$/,US=/^(\d*\.?\d*)t$/,VS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;ZS.prototype.get=function(a){for(var b=0;b<this.a.length;b++){var c=this.a[b].get(a);if(c)return c}return null};ZS.prototype.write=function(){this.f=YS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var bT=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.t=hT.prototype;_.t.configure=function(a){this.f=a};_.t.start=function(a,b){var c=this;this.D=b;var d=_.gh(new Set([a,KS(a)])).concat();return iT(this,d).then(function(e){return pT(c,e.data).then(function(){uT(c,c.B);return c.j})})};_.t.requestStop=function(){};_.t.stop=function(){this.D&&this.D.networkingEngine.ue(this.L);this.B=this.A=this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.K=!1;this.J=this.G=Infinity;return Promise.resolve()};
70
- _.t.update=function(){var a=this;if(this.Od())return iT(this,[this.o]).then(function(b){return pT(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.t.setCurrentVariant=function(){};_.t.cc=function(){var a=this;this.g.debug(_.vD);this.D&&(this.l=null,this.update().then(function(){uT(a,a.B)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&uT(a,100))}))};_.t.Od=function(){return this.M===lT};_.t.lg=function(){return 0<this.w.length};
71
- _.t.di=function(a){var b=null;if(this.w.length)for(var c=0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b};
72
- _.t.Wn=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.A.timescale,c={isLive:this.Od.bind(this),$e:this.lg.bind(this),Ql:function(){return 1},We:this.di.bind(this)},d=!1,e=new _.P(_.Q,3,4035,null),f=null;try{var g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=dT(a,b,g,c)}catch(h){d=
73
- !0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};var sT={video:_.Lg,audio:_.cd,text:_.Wc},gT=_.gc,lT="LIVE",tT={Co:_.md,Io:_.og};_.x(vT,_.ku);vT.prototype.f=function(){_.Nu.ism=hT;_.Lu[_.Xc]=hT};vT.prototype.a=function(){_.SF("ism");_.TF(_.Xc)};vT.prototype.id=function(){return _.fg};_.J("clpp.smooth.SmoothComponent",vT);};
2
+ var f=function(window){var AS="Full MP4 box must have flags defined",BS="clpp.smooth.SmoothMP4Processor",CS="codecPrivateData",DS=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.W(a,c);_.W(a,d)},ES=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.rn()}},FS=function(a,b){ES(a,b>>16&255);ES(a,b>>8&255);ES(a,b&255)},GS=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.rn()}},HS=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.rn()}},IS=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.rn()}},JS=function(a,b){if(void 0!==b){for(var c=new Uint8Array(b),d=Math.min(a.length,b),e=0;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}c=new Uint8Array(a.length);for(d=0;d<a.length;++d)c[d]=a.charCodeAt(d);return c},KS=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]},Z=function(a,b,c){KS.call(this,a);this.version=b;this.flags=c},LS=function(a,b,c){KS.call(this,a);this.f=b;this.offset=c},MS=function(a,
4
+ b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},NS=function(a,b,c){KS.call(this,"ftyp");this.h=a;this.Ni=b;this.f=c},OS=function(){KS.call(this,_.cf)},PS=function(){KS.call(this,_.Jg)},QS=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},RS=function(){KS.call(this,"mvex")},SS=function(a){Z.call(this,"trex",0,0);this.f=a},TS=function(a,b,c,d,e){Z.call(this,"tkhd",
5
+ 1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},US=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},VS=function(a){Z.call(this,"hdlr",0,0);this.f=a},WS=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},XS=function(a){KS.call(this,a);this.w=!0},YS=function(a){XS.call(this,a);this.height=this.width=0;this.depth=24},
6
+ ZS=function(a,b,c,d){XS.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},$S=function(a,b){YS.call(this,"avc1");this.width=a;this.height=b},aT=function(a,b){$S.call(this,a,b);this.type="encv"},bT=function(a,b,c){ZS.call(this,"mp4a",a,b,c)},cT=function(a,b,c){bT.call(this,a,b,c);this.type="enca"},dT=function(a,b){KS.call(this,"avcC");this.hb=a;this.tc=b;this.version=1;this.f=this.hb[0][1];this.h=this.hb[0][2];this.level=this.hb[0][3]},eT=function(a){Z.call(this,"esds",0,0);this.pc=
7
+ a},fT=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},gT=function(){Z.call(this,"dref",0,0)},hT=function(){KS.call(this,_.tg)},iT=function(){Z.call(this,_.vg,0,0)},jT=function(){Z.call(this,"stts",0,0)},kT=function(){Z.call(this,"stsc",0,0)},lT=function(){Z.call(this,"stco",0,0)},mT=function(){Z.call(this,"stsz",0,0)},nT=function(){Z.call(this,"smhd",0,0)},oT=function(){KS.call(this,"dinf")},pT=function(){KS.call(this,_.bf)},qT=function(){KS.call(this,_.Ye)},rT=function(a,b){Z.call(this,
8
+ "tfdt",a,0);this.baseMediaDecodeTime=b},sT=function(){Z.call(this,"mfhd",0,0);this.f=0},tT=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},uT=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},vT=function(){KS.call(this,"traf")},wT=function(){KS.call(this,"moof")},xT=function(){KS.call(this,_.Xe);this.f=new Uint8Array(0)},yT=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},zT=
9
+ function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.kc=""},AT=function(a){KS.call(this,"frma");this.f=a},BT=function(){Z.call(this,"saio",0,0);this.offset=[0]},CT=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},DT=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},ET=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},FT=function(a,b,c,d){c=b.di[c];b=b.Ro;a=a.replace("Manifest","");b=b.replace("{bitrate}",
10
+ String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.GE([a],[b])[0]},GT=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",CS,"fourCC"]:a.type===_.dd&&(c=["bitrate",CS,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.qa(a,b,c,["id","segmentIndex"])},HT=function(a,b,c){var d=c.Xe.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,hb:null,
11
+ tc:null,width:NaN,height:NaN,pc:null,Be:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.hb=[_.bn(d[1])];a.tc=[_.bn(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.dd:a.pc=_.bn(c.Xe),a.sampleSize=c.Xj||16,a.Be=c.Be,a.channelCount=c.wh}return a},IT=function(a,b){return a.filter(function(c){return c.type===b})},JT=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},QT=function(a,b,
12
+ c){var d=null;if(KT.test(a)){a=KT.exec(a);d=Number(a[1]);var e=Number(a[2]),f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}else LT.test(a)?d=JT(LT,a):MT.test(a)?d=JT(MT,a):NT.test(a)?(a=NT.exec(a),d=Number(a[1])/c.frameRate):OT.test(a)?(a=OT.exec(a),d=Number(a[1])/c.a):PT.test(a)&&(d=JT(PT,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*
13
+ d);return b+":"+c+":"+a+"."+d},RT=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))},TT=function(a){this.a=a;this.f=ST(this)},ST=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.qn(b)},UT=function(a,b,c){a:{var d=_.w([_.Xd,_.Vd]);for(var e=d.next();!e.done;e=d.next())if((e=c.cf(e.value))&&e.keyId){d=e.keyId;break a}_.Yh(BS,
14
+ "Could not get default Key ID for DRM init data!");d=null}c=new KS("xxxx");a.type===_.r?c=new aT(a.width,a.height):c=new cT(a.channelCount,a.sampleSize,a.Be);a=new yT;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new KS("schi")).append([a]);b=(new KS(_.ng)).append([new AT(b),new zT(_.xd,65536),a]);c.append([b]);return c},VT=function(a,b){var c=b.ff(),d=new QS(a.timescale,a.duration,a.id),e=(new RS).append([new SS(a.id)]),f=new TS(a.id,a.duration,a.timescale,a.width,a.height),g=new US(a.timescale,
15
+ a.duration),h=new VS(a.type),l=null,m=new gT;m.entries=[new fT];var n=new iT;switch(a.type){case _.r:var p=new dT(a.hb,a.tc);c?(l=UT(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new $S(a.width,a.height)).append([p]),n.entries=[l]);l=new WS;break;case _.dd:p=new eT(a.pc),c?(l=UT(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new bT(a.channelCount,a.sampleSize,a.Be)).append([p]),n.entries=[l]),l=new nT}n=(new hT).append([n,new jT,new kT,new mT,new lT]);m=(new oT).append([m]);m=(new pT).append([l,m,n]);
16
+ g=(new qT).append([g,h,m]);f=(new PS).append([f,g]);d=(new OS).append([d,f,e]);e=new NS("dash",0,["iso6","mp41","avc1"]);c&&(c=b.cf(_.Vd),f=b.cf(_.Xd),c&&d.append([new LS("pssh",c.initData,8)]),f&&d.append([new LS("pssh",f.initData,8)]),c||f||_.Yh(BS,"Could not get PSSH init data!"));c=new TT([e,d]);return _.bk(c.write())},XT=function(a,b){var c,d,e,f,g,h;(new _.Dn).N("moof",_.En).aa("mfhd",function(m){var n=new sT;n.f=_.yn(m.reader);c=n}).N("traf",_.En).aa("tfhd",function(m){var n=m.reader.Wa();
17
+ if(null===m.flags)throw new _.O(_.P,3,3019,AS);var p=new uT(m.version||0,m.flags||0);p.f=_.yn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.An(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.yn(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.yn(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.yn(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.yn(m.reader));d=p}).aa("trun",function(m){var n=m.reader.Wa();if(null===m.flags)throw new _.O(_.P,3,3019,AS);
18
+ var p=new tT(m.version||0,m.flags||0);p.f=_.yn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.zn(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.yn(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.yn(m.reader)),m.flags&512&&p.sampleSize.push(_.yn(m.reader)),m.flags&1024&&p.A.push(_.yn(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.yn(m.reader)):p.h.push(_.zn(m.reader)));e=p}).aa("sdtp",function(m){var n=_.Cn(m.reader,m.reader.Wa());f=new MS("sdtp",
19
+ m.version||0,m.flags||0,n,0)}).N("uuid",function(m){var n=_.Cn(m.reader,16);if(_.dn(n,WT)){n=_.yn(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new DT(m.version,m.flags);n.h=_.yn(m.reader);m.flags&1&&(n.j=_.wn(m.reader));for(var p=0;p<n.h;p++){var q={yi:_.Cn(m.reader,8),Dd:0,Vg:[]};if(m.flags&2){q.Dd=_.xn(m.reader);for(var t=0;t<q.Dd;t++){var v={th:0,uh:0};v.th=_.xn(m.reader);v.uh=_.yn(m.reader);q.Vg.push(v)}}n.f.push(q)}g=n}}).N(_.Xe,function(m){var n=new xT;0<m.reader.Wa()?n.f=_.Cn(m.reader,m.reader.Wa()):
20
+ (_.Yh(BS,"mdat box is empty!"),n.f=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new vT).append([d,e]);f&&l.append([f]);b.ff()&&g&&l.append([g]);l=(new wT).append([c,l]);return new TT([l,h])},YT=function(a,b,c,d){var e=d.ff(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=XT(b,d);if(null===g)return a.request.contentType===_.Q?a.data:g;d=g.get(_.Xe);if(a.request.contentType===_.Q){e=d.f.buffer;if(c){e=_.T.ce(e);if((e=(new DOMParser).parseFromString(e,_.Bg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
+ e.documentElement;if(h&&(d=new RT(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.ye],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),v=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var z=q.length;v<z;v++){var A=q[v].name;if(A=A.match(t)){p=
22
+ p.getAttribute(A[0]);break b}}p=null}}f.setAttribute(l[m],QT(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.T.ib(e).buffer}else c=e;return c}h=new wT;a=g.get("mfhd");b=new vT;l=g.get("tfhd");m=new rT(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.f=1;l.flags&=16777214;l.flags|=131072;b.append([l,m,f]);n&&b.append([n]);if(e){g=0;l=[];if(c.flags&2)for(l=[],m=0;m<c.h;m++)l.push(10+6*c.f[m].Dd);else g=8;b.append([c,new BT,new CT(g,l,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=
23
+ new TT([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},ZT=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},$T=function(a,b,c){a=_.lp(a);c&&a.version!==c&&(a=_.vE(a,c));return{initData:_.tE(a),initDataType:_.xd,keyId:b,periodId:null}},bU=function(){this.A=this.j=this.f=
24
+ this.D=null;this.h=1;this.P=0;this.o="";this.C=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.M=aU;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.no.bind(this);this.H=new Map},cU=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.pk(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,
25
+ c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.D.networkingEngine.fetch(c),_.y(f,d.T,2);e=f.f;a.o=e.uri;return f["return"](e)})},jU=function(a,b){var c=_.gp,d=null;try{var e=_.T.ce(b);d=c.we(e,_.$b)}catch(sZ){}if(!d)throw a.g.error("Unable to parse manifest"),new _.O(_.P,4,4033,a.o);var f=+dU(a,d,"MajorVersion"),g=+dU(a,d,"MinorVersion"),h=+d.getAttribute("TimeScale")||1E7,l=+dU(a,d,"Duration"),m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||
26
+ Infinity,q=c.Z(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+f+"."+g))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.O(_.P,4,4036,a.o);m?(eU(a,fU),a.B=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):eU(a,aU);a.a={startTime:0,delay:0,duration:l/h,gg:p/h,se:0};if(q){var t=a.f.playreadyVersion,v=_.gp,z=[],A=v.Z(q,"ProtectionHeader")[0],E=_.an(v.sa(A)||""),G=_.lp(E).a;z.push(ZT(_.Xd,{initData:_.tE(_.dp(G)),initDataType:_.xd,
27
+ keyId:G,periodId:null},[G]));z.push(ZT(_.Vd,$T(E,G,t),[G]));a.w=z}var B=[],F=_.gp.Z(d,"StreamIndex");if(!F.length)throw a.g.error("No streams found!"),new _.O(_.P,4,4034,a.o);for(var M=0;M<F.length;M++){for(var R,la=a,U=F[M],ra=dU(la,U,"Type"),Ba=+U.getAttribute("Chunks"),Ca=U.getAttribute("Subtype")||"",Da=U.getAttribute("Language")||_.Ng,Ma=_.Pj(Da),Ab=U.getAttribute("Name")||"",qe=+U.getAttribute(_.vb),Gf=+U.getAttribute(_.ub),Lg=dU(la,U,"Url"),$u=+U.getAttribute("TimeScale")||null,pd=[],Qn=_.gp.Z(U,
28
+ _.Qb),Pv=0;Pv<Qn.length;Pv++){var If=void 0,vc=void 0,Qv=void 0,Jf=la,Qd=Qn[Pv],Rv=ra,WX=+Qd.getAttribute("Index"),XX=+dU(Jf,Qd,"Bitrate"),mK=NaN,nK=NaN,No=NaN,Sv=NaN,oK=NaN,pK=NaN,qK=NaN,rK=Qd.getAttribute("FourCC")||"";switch(Rv){case _.r:mK=+dU(Jf,Qd,_.ub);nK=+dU(Jf,Qd,_.vb);break;case _.dd:Sv=+Qd.getAttribute("Channels")||2,No=+dU(Jf,Qd,"SamplingRate"),pK=+dU(Jf,Qd,"AudioTag"),oK=+dU(Jf,Qd,"BitsPerSample"),qK=+dU(Jf,Qd,"PacketSize")}var Tv=String(Qd.getAttribute("CodecPrivateData"));if(Rv===_.dd&&
29
+ !Tv){var sK=Sv,tK={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Oo=tK[No];if("AACH"===rK){vc=new Uint8Array(4);var uK=tK[2*No];vc[0]=40|Oo>>1;vc[1]=Oo<<7|sK<<3|uK>>1;vc[2]=uK<<7|8;vc[3]=0;If=new Uint16Array(2);If[0]=(vc[0]<<8)+vc[1];If[1]=(vc[2]<<8)+vc[3];Qv=If[0].toString(16)+If[1].toString(16)}else vc=new Uint8Array(2),vc[0]=16|Oo>>1,vc[1]=Oo<<7|sK<<3,If=new Uint16Array(1),If[0]=(vc[0]<<8)+vc[1],Qv=If[0].toString(16);Tv=Qv.toUpperCase()}var YX=
30
+ {id:Jf.P++,type:Rv,index:WX,bitrate:XX,Xe:Tv,maxHeight:mK,maxWidth:nK,Be:No,wh:Sv,hp:pK,Xj:oK,yp:qK,Ul:rK,segmentIndex:null};pd.push(YX)}R=pd;for(var Pe=[],vK=_.gp.Z(U,"c"),Ck=0;Ck<vK.length;Ck++){var Uv=vK[Ck],re=parseInt(Uv.getAttribute("t"),10),ki=parseInt(Uv.getAttribute("d"),10),Vv=parseInt(Uv.getAttribute("r"),10),Dk=0;if(isNaN(re)&&isNaN(ki))throw la.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.O(_.P,4,4037,la.o);0===Ck&&
31
+ isNaN(re)&&(Dk=re=0);if(0<Ck){var Og=Pe[Pe.length-1];Dk=Og.n+1;Og.d||(Og.d=re-Og.t);re||(re=Og.t+Og.d);ki||(ki=re-Og.t)}Pe.push({n:Dk,d:ki,t:re});if(Vv){Vv--;for(var wK=0;wK<Vv;wK++){var Po=Pe[Pe.length-1];Dk=Po.n+1;re=Po.t+Po.d;ki=Po.d;Pe.push({n:Dk,d:ki,t:re})}}}la.Ud()||Pe.length===Ba||la.g.warn("Number of fragments ("+Ba+") differs from number of chunks ("+Pe.length+").");B.push({type:ra,mp:Ba,Co:Ca,language:Ma,yd:Da,name:Ab,maxWidth:qe,maxHeight:Gf,Ro:Lg,tracks:R,di:Pe,timescale:$u})}var Kf=
32
+ {wp:f,Ni:g,timescale:h,duration:l,isLive:m,vp:n,gg:p,og:!1,streams:B};if(a.j&&a.A)return gU(a,Kf),Promise.resolve();a.H.clear();var Wv=Kf.timescale,Qo=Kf.duration,$X=IT(Kf.streams,_.dd),aY=IT(Kf.streams,_.r),bY=IT(Kf.streams,_.Q),xK=[],Ro=hU(a,Qo,Wv,$X),So=hU(a,Qo,Wv,aY),cY=hU(a,Qo,Wv,bY);Ro.length||(Ro=[null]);So.length||(So=[null]);for(var Yv=0;Yv<So.length;Yv++)for(var Zv=0;Zv<Ro.length;Zv++)xK.push(iU(a,So[Yv],Ro[Zv]));var yK={id:"ID",configurationId:void 0,startTime:0,endTime:Qo,variants:xK,
33
+ textStreams:cY,thumbStreams:[]};var eY=Kf.streams,$v=a.a.startTime,zK=a.a.delay,aw=a.J,AK=Math.min(a.a.duration||Infinity,aw),bw=a.Ud(),fY=a.a.gg,gY=a.a.se,BK=a.I,CK=isFinite(a.G)?a.G:0;if(bw)AK=Infinity,$v=Date.now()/1E3-gY,a.a.startTime=$v,zK=3*BK;else for(var hY=isFinite(aw)?aw:a.a.duration,DK=_.w(eY),cw=DK.next();!cw.done;cw=DK.next())for(var EK=_.w(cw.value.tracks),dw=EK.next();!dw.done;dw=EK.next()){var FK=dw.value;FK.segmentIndex.offset(-CK);_.iF(FK.segmentIndex,hY)}var GK=a.f.timeline||{};
34
+ GK.type=void 0;a.C=new _.qF(GK,$v,zK,!bw,!0);a.C.f=AK;_.yF(a.C,BK);a.C.A=fY;bw||a.C.offset(-CK);a.D.filterAllPeriods([yK]);a.j={presentationTimeline:a.C,periods:[yK],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.D.networkingEngine.fd(a.L),a.K=!0);a.A=Kf;return Promise.resolve()},gU=function(a,b){for(var c=0;c<a.A.streams.length;c++)for(var d=b.streams[c],e={},f=_.w(a.A.streams[c].tracks),g=f.next();!g.done;e={oc:e.oc},g=f.next())if(e.oc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
35
+ l.oc.type&&m.bitrate===l.oc.bitrate}}(e))){GT(e.oc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=kU(a,a.A.timescale,d,g);g=e.oc.segmentIndex;g.ua(h);(h=a.a.gg)&&_.OF(g,_.NF(g)-h).forEach(function(l){l.eb().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.oc.type+" track with bitrate "+(e.oc.bitrate+". Skipping update."))},hU=function(a,b,c,d){for(var e=[],f={$c:0};f.$c<d.length;f={$c:f.$c},
36
+ f.$c++){var g=d[f.$c].tracks.map(function(h){return function(l){var m=d[h.$c],n=kU(a,c,m,l);n=new _.MF(n);var p=null;m.type!==_.Q&&(p=lU(a,b,c,m,l));l.segmentIndex=n;var q=_.fM++,t=Promise.resolve.bind(Promise),v=n.ld.bind(n),z=n.get.bind(n),A=n.Md.bind(n),E=n.getDuration.bind(n),G=mU[m.type],B="";switch(m.type){case _.r:B=l.Xe;var F=/00000001[0-9]7/.exec(B);B="avc1."+(F&&F[0]?B.substr(B.indexOf(F[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.dd:B=l.Xe,F=2,"AACH"===l.Ul?F=5:B&&(F=
37
+ (parseInt(B.substr(0,2),16)&248)>>3),B="mp4a.40."+F,a.g.debug("AUDIO CODECS: ",B)}F=m.type===_.Q?nU[m.Co]:void 0;return{id:q,originalId:null,Bp:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:A,getDuration:E,segmentIndex:n,segmentLookupStrategy:_.aE,initSegmentReference:p,mimeType:G,codecs:B,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:F,encrypted:a.qg(),keyId:null,language:m.language,originalLanguage:m.yd,
38
+ label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.wh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},kU=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.di.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=FT(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Nj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.r||c.type===_.dd)b=f[f.length-
39
+ 1],a.J=Math.min(a.J,e),0===a.a.se?a.a.se=b.endTime:a.a.se=Math.min(a.a.se,b.endTime);return f},lU=function(a,b,c,d,e){b=HT(b,d.timescale||c,e);c={isLive:a.Ud.bind(a),ff:a.qg.bind(a),bm:function(){return 1},cf:a.ii.bind(a)};d=new Uint8Array(0);try{d=VT(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.O(_.P,3,4035,g);}var f="data:text/plain;base64,"+_.$m(d);return new _.IE(function(){return[f]},0,null,null,!0)},iU=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:
40
+ 0),e=c?c.language:_.Ng;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},dU=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.O(_.P,4,4038,a.o,c);},oU=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.ic.bind(a),b))},eU=function(a,b){var c=b===aU;a.j&&a.j.presentationTimeline&&_.tF(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),
41
+ a.l=null,a.B=null);a.M=b},pU=function(){};KS.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.children.push(a[b]),a[b].parent=this;return this};KS.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.children.length;b++){if(this.children[b].type===a)return this.children[b];var c=this.children[b].get(a);if(c)return c}return null};
42
+ KS.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(var c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b};
43
+ KS.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.W(a,1):_.W(a,this.size);_.sn(a,JS(this.type));this.size>b&&DS(a,this.size);"uuid"===this.type&&_.sn(a,null);if(0<this.children.length&&!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()};_.x(Z,KS);Z.prototype.a=function(){return 4+KS.prototype.a.call(this)};
44
+ Z.prototype.write=function(a){KS.prototype.write.call(this,a);ES(a,this.version);FS(a,this.flags)};_.x(LS,KS);LS.prototype.a=function(){return this.f.byteLength+KS.prototype.a.call(this)-this.offset};LS.prototype.write=function(a){KS.prototype.write.call(this,a);_.sn(a,this.f,this.offset);a.getPosition()};_.x(MS,Z);MS.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};MS.prototype.write=function(a){Z.prototype.write.call(this,a);_.sn(a,this.f,this.offset);a.getPosition()};
45
+ _.x(NS,KS);NS.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+KS.prototype.a.call(this)};NS.prototype.write=function(a){KS.prototype.write.call(this,a);_.sn(a,JS(this.h));_.W(a,this.Ni);_.sn(a,JS(this.f.join("")));a.getPosition()};_.x(OS,KS);_.x(PS,KS);_.x(QS,Z);QS.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=Z.prototype.a.call(this)};
46
+ QS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(DS(a,0),DS(a,0),_.W(a,this.timescale),DS(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);GS(a,this.volume);GS(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)ES(a,this.f[b]);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,this.h);a.getPosition()};_.x(RS,KS);_.x(SS,Z);SS.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
+ SS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);_.W(a,1);_.W(a,0);_.W(a,0);_.W(a,0);a.getPosition()};_.x(TS,Z);TS.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+Z.prototype.a.call(this)};
48
+ TS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(DS(a,0),DS(a,0),_.W(a,this.h),_.W(a,0),DS(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.h),_.W(a,0),_.W(a,this.duration*this.timescale));_.W(a,0);_.W(a,0);GS(a,0);GS(a,0);GS(a,this.volume);GS(a,0);for(var b=0;b<this.f.length;b++)ES(a,this.f[b]);GS(a,this.width);GS(a,0);GS(a,this.height);GS(a,0);a.getPosition()};_.x(US,Z);US.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
+ US.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(DS(a,0),DS(a,0),_.W(a,this.timescale),DS(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));GS(a,this.language);GS(a,0);a.getPosition()};_.x(VS,Z);VS.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
+ VS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.r?_.sn(a,JS("vide")):_.sn(a,JS("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.r?_.sn(a,JS("VideoHandler\x00")):_.sn(a,JS("SoundHandler\x00"));a.getPosition()};_.x(WS,Z);WS.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};WS.prototype.write=function(a){Z.prototype.write.call(this,a);GS(a,0);_.sn(a,this.f);a.getPosition()};_.x(XS,KS);XS.prototype.a=function(){return 8+KS.prototype.a.call(this)};
51
+ XS.prototype.write=function(a){KS.prototype.write.call(this,a);_.W(a,0);GS(a,0);GS(a,1)};_.x(YS,XS);YS.prototype.a=function(){return 70+XS.prototype.a.call(this)};YS.prototype.write=function(a){XS.prototype.write.call(this,a);GS(a,0);GS(a,0);_.W(a,0);_.W(a,0);_.W(a,0);GS(a,this.width);GS(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);GS(a,1);ES(a,10);_.sn(a,JS("AVC Coding",31));GS(a,this.depth);IS(a,-1)};_.x(ZS,XS);ZS.prototype.a=function(){return 20+XS.prototype.a.call(this)};
52
+ ZS.prototype.write=function(a){XS.prototype.write.call(this,a);_.W(a,0);_.W(a,0);GS(a,this.channelCount);GS(a,this.sampleSize);IS(a,0);GS(a,0);GS(a,this.sampleRate);GS(a,0)};_.x($S,YS);$S.prototype.write=function(a){YS.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.x(aT,$S);_.x(bT,ZS);bT.prototype.write=function(a){ZS.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
53
+ _.x(cT,bT);_.x(dT,KS);dT.prototype.a=function(){for(var a=7,b=0;b<this.hb.length;b++)a+=2,a+=this.hb[b].byteLength;for(b=0;b<this.hb.length;b++)a+=2,a+=this.tc[b].byteLength;return a+KS.prototype.a.call(this)};
54
+ dT.prototype.write=function(a){KS.prototype.write.call(this,a);ES(a,this.version);ES(a,this.f);ES(a,this.h);ES(a,this.level);ES(a,255);ES(a,224|this.hb.length);for(var b=0;b<this.hb.length;b++)GS(a,this.hb[b].length),_.sn(a,this.hb[b]);ES(a,this.tc.length);for(b=0;b<this.tc.length;b++)GS(a,this.tc[b].length),_.sn(a,this.tc[b]);a.getPosition()};_.x(eT,Z);eT.prototype.a=function(){return 22+(this.pc.byteLength+3)+Z.prototype.a.call(this)};
55
+ eT.prototype.write=function(a){Z.prototype.write.call(this,a);ES(a,3);ES(a,23+this.pc.byteLength);GS(a,1);ES(a,0);ES(a,4);ES(a,15+this.pc.byteLength);ES(a,64);ES(a,21);FS(a,0);_.W(a,0);_.W(a,0);ES(a,5);ES(a,this.pc.byteLength);_.sn(a,this.pc);_.sn(a,new Uint8Array([6,1,2]));a.getPosition()};_.x(fT,Z);fT.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};fT.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.sn(a,JS(this.location));a.getPosition()};
56
+ _.x(gT,Z);gT.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};gT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(hT,KS);_.x(iT,Z);iT.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
57
+ iT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(jT,Z);jT.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};jT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(kT,Z);
58
+ kT.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};kT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(lT,Z);lT.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
59
+ lT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(mT,Z);mT.prototype.a=function(){return 8+Z.prototype.a.call(this)};mT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.x(nT,Z);nT.prototype.a=function(){return 4+Z.prototype.a.call(this)};nT.prototype.write=function(a){Z.prototype.write.call(this,a);IS(a,0);GS(a,0);a.getPosition()};
60
+ _.x(oT,KS);_.x(pT,KS);_.x(qT,KS);_.x(rT,Z);rT.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};rT.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?DS(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.x(sT,Z);sT.prototype.a=function(){return 4+Z.prototype.a.call(this)};sT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);a.getPosition()};_.x(tT,Z);
61
+ tT.prototype.a=function(){var a=4;this.flags&qU&&(a+=4);this.flags&rU&&(a+=4);for(var b=0;b<this.f;b++)this.flags&sU&&(a+=4),this.flags&tU&&(a+=4),this.flags&uU&&(a+=4),this.flags&vU&&(a+=4);return a+Z.prototype.a.call(this)};
62
+ tT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&qU&&(a.getPosition(),HS(a,this.j));this.flags&rU&&_.W(a,this.l);for(var b=0;b<this.f;b++)this.flags&sU&&_.W(a,this.o[b]),this.flags&tU&&_.W(a,this.sampleSize[b]),this.flags&uU&&_.W(a,this.A[b]),this.flags&vU&&(0===this.version?_.W(a,this.h[b]):HS(a,this.h[b]));a.getPosition()};var qU=1,rU=4,sU=256,tU=512,uU=1024,vU=2048;_.x(uT,Z);
63
+ uT.prototype.a=function(){var a=4;this.flags&wU&&(a+=8);this.flags&xU&&(a+=4);this.flags&yU&&(a+=4);this.flags&zU&&(a+=4);this.flags&AU&&(a+=4);return a+Z.prototype.a.call(this)};uT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&wU&&DS(a,this.h);this.flags&xU&&_.W(a,this.A);this.flags&yU&&_.W(a,this.j);this.flags&zU&&_.W(a,this.o);this.flags&AU&&_.W(a,this.l);a.getPosition()};var wU=1,xU=2,yU=8,zU=16,AU=32;_.x(vT,KS);_.x(wT,KS);_.x(xT,KS);
64
+ xT.prototype.a=function(){return this.f.byteLength+KS.prototype.a.call(this)};xT.prototype.write=function(a){KS.prototype.write.call(this,a);0<this.f.byteLength&&_.sn(a,this.f)};_.x(yT,Z);yT.prototype.a=function(){var a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+Z.prototype.a.call(this)};
65
+ yT.prototype.write=function(a){Z.prototype.write.call(this,a);ES(a,0);0===this.version?ES(a,0):ES(a,0);ES(a,this.f);ES(a,this.h);_.sn(a,_.bn(this.l));if(1===this.f&&0===this.h){ES(a,0);for(var b=0;b<this.j.length;b++)ES(a,this.j[b])}a.getPosition()};_.x(zT,Z);zT.prototype.a=function(){var a=8;this.flags&1&&(a+=JS(this.kc).byteLength);return a+Z.prototype.a.call(this)};zT.prototype.write=function(a){Z.prototype.write.call(this,a);_.sn(a,JS(this.f));_.W(a,this.h);this.flags&1&&_.sn(a,JS(this.kc));a.getPosition()};
66
+ _.x(AT,KS);AT.prototype.a=function(){return JS(this.f).byteLength+KS.prototype.a.call(this)};AT.prototype.write=function(a){KS.prototype.write.call(this,a);_.sn(a,JS(this.f));a.getPosition()};_.x(BT,Z);BT.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};
67
+ BT.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));_.W(a,1);for(var b=0;1>b;b++)0===this.version?_.W(a,this.offset[b]):DS(a,this.offset[b]);a.getPosition()};_.x(CT,Z);CT.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+Z.prototype.a.call(this)};
68
+ CT.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));ES(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)ES(a,this.j[b]);a.getPosition()};_.x(DT,Z);DT.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].yi.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].Dd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
+ DT.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&ES(a,this.j);for(var b=0;b<this.h;b++)if(_.sn(a,this.f[b].yi),this.flags&2){GS(a,this.f[b].Dd);for(var c=0;c<this.f[b].Dd;c++)GS(a,this.f[b].Vg[c].th),_.W(a,this.f[b].Vg[c].uh)}a.getPosition()};var KT=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,LT=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,MT=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,NT=/^(\d*\.?\d*)f$/,OT=/^(\d*\.?\d*)t$/,PT=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;TT.prototype.get=function(a){for(var b=0;b<this.a.length;b++){var c=this.a[b].get(a);if(c)return c}return null};TT.prototype.write=function(){this.f=ST(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var WT=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.u=bU.prototype;_.u.configure=function(a){this.f=a};_.u.start=function(a,b){var c=this;this.D=b;var d=_.vh(new Set([a,ET(a)])).concat();return cU(this,d).then(function(e){return jU(c,e.data).then(function(){oU(c,c.B);return c.j})})};_.u.requestStop=function(){};_.u.stop=function(){this.D&&this.D.networkingEngine.ze(this.L);this.B=this.A=this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.K=!1;this.J=this.G=Infinity;return Promise.resolve()};
70
+ _.u.update=function(){var a=this;if(this.Ud())return cU(this,[this.o]).then(function(b){return jU(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.u.setCurrentVariant=function(){};_.u.ic=function(){var a=this;this.g.debug(_.RD);this.D&&(this.l=null,this.update().then(function(){oU(a,a.B)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&oU(a,100))}))};_.u.Ud=function(){return this.M===fU};_.u.qg=function(){return 0<this.w.length};
71
+ _.u.ii=function(a){var b=null;if(this.w.length)for(var c=0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b};
72
+ _.u.no=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.A.timescale,c={isLive:this.Ud.bind(this),ff:this.qg.bind(this),bm:function(){return 1},cf:this.ii.bind(this)},d=!1,e=new _.O(_.P,3,4035,null),f=null;try{var g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=YT(a,b,g,c)}catch(h){d=
73
+ !0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};_.u.loadVariant=function(a){return _.I(function(b){return b["return"](a)})};_.u.loadTextStream=function(a,b){var c=this,d,e;return _.I(function(f){(e=c.j.periods.find(function(g){return g.id===b}))&&(d=e.textStreams.find(function(g){return g.id===a})||null);if(!d)throw new _.nj(_.kD+a);return f["return"](d)})};var mU={video:_.$g,audio:_.hd,text:_.ad},aU=_.kc,fU="LIVE",nU={To:_.td,$o:_.xg};_.x(pU,_.Gu);pU.prototype.f=function(){_.iv.ism=bU;_.gv[_.bd]=bU};pU.prototype.a=function(){_.pG("ism");_.qG(_.bd)};pU.prototype.id=function(){return _.og};_.J("clpp.smooth.SmoothComponent",pU);};
74
74
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
75
75
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
76
76
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,30 +1,30 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Hz="No thumbnail found for position: ",Iz="Position is out of range: ",Jz="Thumbnail URL is mandatory",Kz="Wrong gridSize format",Lz="clpp.thumbnails",Mz=function(){this.log=new _.K(Lz);this.player=null;this.a=[];this.w=!1},Oz=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Ze&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Nz(a,0,e,!!f)})},Promise.resolve())},Nz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Pz(a,d).then(function(){return a.a[b].load()}).then(function(){return Nz(a,
3
- e,c,d)})},Pz=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.zq)c();else a.player.one(_.id,function(){c()})})},Qz=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.va=p;this.ol=h;this.Zn=l;this.dm=m;this.em=n;this.mg=null},Rz=function(){Mz.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},Sz=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.qd=new _.ok},Tz=function(){this.g=new _.K(Lz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.ok},Uz=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.qd.resolve()})},Wz=function(a,b){return Vz(a,b).then(function(c){return new Qz(c,b.time,b.duration)})},Vz=function(a,b){return b.load().then(function(){var c=_.Hj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.Rj(c)})},Xz=function(){Mz.call(this);this.f=null},Yz=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},Zz=function(){Mz.apply(this,arguments)},$z=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{he:c,ah:d,ri:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},aA=function(){this.g=new _.K(Lz);this.a=this.m=null},bA=function(a){return a.some(function(b){return 0<
6
- b.thumbStreams.length})},gA=function(a){return a?a===cA||a===dA?new Rz:a===eA?new Xz:a===fA?new Tz:null:null},hA=function(a){if(!a)return null;a=new _.Rk(a);return a.path.match(/.*\.vtt$/i)?eA:a.path.match(/.*\.bif$/i)?fA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?cA:null},iA=function(){};Mz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Rf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&Oz(c,b.preload)})};Qz.prototype.raw=function(){return this.va.cloneNode(!1)};
7
- Qz.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.Zd);e.style.width=c+_.Of;e.style.height=d+_.Of;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.va.naturalWidth||this.va.width))+"px "+Math.ceil(d/
8
- this.height*(this.va.naturalHeight||this.va.height))+_.Of;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Of;e.style.backgroundPositionY="-"+f*d+_.Of;return e};
9
- Qz.prototype.load=function(){var a=this;this.mg||(this.mg=new Promise(function(b,c){function d(){a.width||(a.width=(a.va.naturalWidth||a.va.width)/a.ol);a.height||(a.height=(a.va.naturalHeight||a.va.height)/a.Zn);a.x||(a.x=a.width*a.dm);a.y||(a.y=a.height*a.em)}if(a.va.src&&a.va.complete)d(),b(a);else{var e=null,f=function(){d();a.va.removeEventListener(_.Je,f);a.va.removeEventListener(_.se,e);b(a)};e=function(g){a.va.removeEventListener(_.Je,f);a.va.removeEventListener(_.se,e);c(new _.P(1,9,2014,
10
- "Failed to load thumbnail.",g))};a.va.addEventListener(_.Je,f);a.va.addEventListener(_.se,e);a.va.src=a.src}}));return this.mg};_.J("clpp.thumbnails.Thumbnail",Qz);Qz.prototype.load=Qz.prototype.load;Qz.prototype.element=Qz.prototype.element;Qz.prototype.raw=Qz.prototype.raw;_.x(Rz,Mz);
11
- Rz.prototype.init=function(a,b){if(!b||!b.url)throw new _.P(1,9,7100,Jz);if("GRID"===b.mode&&!b.gridSize)throw new _.P(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.P(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{var c=this.f.gridSize.split(/x/).map(function(d){return parseInt(d,10)}).filter(function(d){return 0<d});if(2===c.length)this.h=c[0],this.o=c[1];else throw new _.P(1,9,7100,Kz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
- new _.P(1,9,7100,Kz);}Mz.prototype.init.call(this,a,b)};Rz.prototype.get=function(a){var b=this,c,d,e,f;return _.I(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.P(1,9,2014,Iz+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.P(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.y(g,f.load(),2)}return g["return"](f)})};
13
- Rz.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new Qz(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f));return Promise.resolve()};Sz.prototype.load=function(){return this.qd};
14
- Tz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,Jz);var d=b.url,e=_.gk(d);e.type=_.fk;a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;var g=_.Hj(c.f);f=_.Hj(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."));l=c.f;f=_.Hj(l);n=String.fromCharCode.apply(null,
15
- jA);g=Array.prototype.slice.call(f,0,8);f=64;h=0;m=!1;if(n===String.fromCharCode.apply(null,g))for(l=new DataView(l,16,20),l=l.getUint32(0,!0),0===l&&(l=1E3);!m;){h+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new Sz(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
- Uz(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.P(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};Tz.prototype.get=function(a){var b=this,c,d;return _.I(function(e){switch(e.a){case 1:if(0>a)throw new _.P(1,9,2014,Iz+a);return _.y(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.P(1,9,2014,Hz+a);return _.y(e,Wz(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
- Tz.prototype.Fc=function(){return 0<this.a.length};var jA=[137,66,73,70,13,10,26,10];_.x(Xz,Mz);
18
- Xz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,Jz);var d=b.url,e=_.gk(d);e.type=_.fk;this.f=a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.T.ba(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var u=h.indexOf("#");h=0>u?h:h.substr(0,u);h.match(/^http|^\/\//)||(h=
19
- d.substr(0,d.lastIndexOf("/"))+"/"+h);u=Yz(l[0]);l=Yz(l[1])-u;c.a.push(new Qz(h,u,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.P(1,9,2013,"Error while loading VTT thumbnails.",f))});Mz.prototype.init.call(this,a,b)};
20
- Xz.prototype.get=function(a){var b=this,c;return _.I(function(d){if(1==d.a){if(0>a)throw new _.P(1,9,2014,Iz+a);return _.y(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.P(1,9,2014,Hz+a);return _.y(d,c.load(),3)}return d["return"](c)})};Xz.prototype.l=function(){return this.f};_.x(Zz,Mz);
21
- Zz.prototype.get=function(a){function b(){return new _.P(1,9,2014,Hz+a)}var c=this,d,e,f,g,h,l,m,n,p,q,u,v,z;return _.I(function(A){if(1==A.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.P(1,9,2014,Iz+a);d=c.player.getPeriods();for(var H=null,G=_.w(d),D=G.next();!D.done;D=G.next())D=D.value,D.startTime<=a&&(H=D);e=H;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
- b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return A.F(2);l=$z(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.ri+m])):(q=h.$a())&&0<q.length&&(v=u=0,z=h.startTime,1<l.ri&&(u=m%l.he,v=Math.floor(m/l.he),z+=m*l.durationPerTile),n=new Qz(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.he,l.ah,
23
- u,v));return n?_.y(A,n.load(),4):A.F(2)}if(2!=A.a)return A["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};Zz.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- Zz.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=$z(d,b),f=d.$a()[0],g=new Image,h=d.startTime,l=0;l<e.ah;++l)for(var m=0;m<e.he;++m)this.a.push(new Qz(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.he,e.ah,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.t=aA.prototype;_.t.onPlayerCreated=function(a){this.m=a};_.t.onPlayerWillDestroy=function(){this.m=null};_.t.onPlayerWillRelease=function(){this.a=null};
25
- _.t.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=hA(c.url||null));(this.a=gA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Me,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
- _.t.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(bA(d)){this.a=new Zz;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.t.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.P(1,9,2014,"Thumbnail format is not supported"))};_.t.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",aA);aA.prototype.get=aA.prototype.get;aA.Id="thumbnails";
27
- iA.prototype.create=function(){return new aA};_.Ht(new iA);var cA="SINGLE",dA="GRID",eA="WEBVTT",fA="BIF";};
2
+ var f=function(window){var cA="No thumbnail found for position: ",dA="Position is out of range: ",eA="Thumbnail URL is mandatory",fA="Wrong gridSize format",gA="clpp.thumbnails",hA=function(){this.log=new _.K(gA);this.player=null;this.a=[];this.w=!1},jA=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.gf&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return iA(a,0,e,!!f)})},Promise.resolve())},iA=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return kA(a,d).then(function(){return a.a[b].load()}).then(function(){return iA(a,
3
+ e,c,d)})},kA=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Mq)c();else a.player.one(_.od,function(){c()})})},lA=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.va=p;this.xl=h;this.qo=l;this.pm=m;this.qm=n;this.rg=null},mA=function(){hA.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},nA=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.zd=new _.xk},oA=function(){this.g=new _.K(gA);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.xk},pA=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.zd.resolve()})},rA=function(a,b){return qA(a,b).then(function(c){return new lA(c,b.time,b.duration)})},qA=function(a,b){return b.load().then(function(){var c=_.bk(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.Zm(c)})},sA=function(){hA.call(this);this.f=null},tA=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},uA=function(){hA.apply(this,arguments)},vA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{ne:c,fh:d,xi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},wA=function(){this.g=new _.K(gA);this.a=this.m=null},xA=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},CA=function(a){return a?a===yA||a===zA?new mA:a===AA?new sA:a===BA?new oA:null:null},DA=function(a){if(!a)return null;a=new _.$k(a);return a.path.match(/.*\.vtt$/i)?AA:a.path.match(/.*\.bif$/i)?BA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?yA:null},EA=function(){};hA.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.$f,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&jA(c,b.preload)})};lA.prototype.raw=function(){return this.va.cloneNode(!1)};
7
+ lA.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.fe);e.style.width=c+_.Xf;e.style.height=d+_.Xf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.va.naturalWidth||this.va.width))+"px "+Math.ceil(d/
8
+ this.height*(this.va.naturalHeight||this.va.height))+_.Xf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Xf;e.style.backgroundPositionY="-"+f*d+_.Xf;return e};
9
+ lA.prototype.load=function(){var a=this;this.rg||(this.rg=new Promise(function(b,c){function d(){a.width||(a.width=(a.va.naturalWidth||a.va.width)/a.xl);a.height||(a.height=(a.va.naturalHeight||a.va.height)/a.qo);a.x||(a.x=a.width*a.pm);a.y||(a.y=a.height*a.qm)}if(a.va.src&&a.va.complete)d(),b(a);else{var e=null,f=function(){d();a.va.removeEventListener(_.Se,f);a.va.removeEventListener(_.Ae,e);b(a)};e=function(g){a.va.removeEventListener(_.Se,f);a.va.removeEventListener(_.Ae,e);c(new _.O(1,9,2014,
10
+ "Failed to load thumbnail.",g))};a.va.addEventListener(_.Se,f);a.va.addEventListener(_.Ae,e);a.va.src=a.src}}));return this.rg};_.J("clpp.thumbnails.Thumbnail",lA);lA.prototype.load=lA.prototype.load;lA.prototype.element=lA.prototype.element;lA.prototype.raw=lA.prototype.raw;_.x(mA,hA);
11
+ mA.prototype.init=function(a,b){if(!b||!b.url)throw new _.O(1,9,7100,eA);if("GRID"===b.mode&&!b.gridSize)throw new _.O(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.O(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{var c=this.f.gridSize.split(/x/).map(function(d){return parseInt(d,10)}).filter(function(d){return 0<d});if(2===c.length)this.h=c[0],this.o=c[1];else throw new _.O(1,9,7100,fA);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
+ new _.O(1,9,7100,fA);}hA.prototype.init.call(this,a,b)};mA.prototype.get=function(a){var b=this,c,d,e,f;return _.I(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.O(1,9,2014,dA+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.O(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.y(g,f.load(),2)}return g["return"](f)})};
13
+ mA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new lA(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f));return Promise.resolve()};nA.prototype.load=function(){return this.zd};
14
+ oA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,eA);var d=b.url,e=_.pk(d);e.type=_.ok;a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;var g=_.bk(c.f);f=_.bk(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."));l=c.f;f=_.bk(l);n=String.fromCharCode.apply(null,
15
+ FA);g=Array.prototype.slice.call(f,0,8);f=64;h=0;m=!1;if(n===String.fromCharCode.apply(null,g))for(l=new DataView(l,16,20),l=l.getUint32(0,!0),0===l&&(l=1E3);!m;){h+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new nA(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
+ pA(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.O(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};oA.prototype.get=function(a){var b=this,c,d;return _.I(function(e){switch(e.a){case 1:if(0>a)throw new _.O(1,9,2014,dA+a);return _.y(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.O(1,9,2014,cA+a);return _.y(e,rA(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
+ oA.prototype.Lc=function(){return 0<this.a.length};var FA=[137,66,73,70,13,10,26,10];_.x(sA,hA);
18
+ sA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,eA);var d=b.url,e=_.pk(d);e.type=_.ok;this.f=a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.T.ea(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var t=h.indexOf("#");h=0>t?h:h.substr(0,t);h.match(/^http|^\/\//)||(h=
19
+ d.substr(0,d.lastIndexOf("/"))+"/"+h);t=tA(l[0]);l=tA(l[1])-t;c.a.push(new lA(h,t,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.O(1,9,2013,"Error while loading VTT thumbnails.",f))});hA.prototype.init.call(this,a,b)};
20
+ sA.prototype.get=function(a){var b=this,c;return _.I(function(d){if(1==d.a){if(0>a)throw new _.O(1,9,2014,dA+a);return _.y(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.O(1,9,2014,cA+a);return _.y(d,c.load(),3)}return d["return"](c)})};sA.prototype.l=function(){return this.f};_.x(uA,hA);
21
+ uA.prototype.get=function(a){function b(){return new _.O(1,9,2014,cA+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.I(function(A){if(1==A.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.O(1,9,2014,dA+a);d=c.player.getPeriods();for(var E=null,G=_.w(d),B=G.next();!B.done;B=G.next())B=B.value,B.startTime<=a&&(E=B);e=E;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
+ b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return A.F(2);l=vA(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.xi+m])):(q=h.eb())&&0<q.length&&(v=t=0,z=h.startTime,1<l.xi&&(t=m%l.ne,v=Math.floor(m/l.ne),z+=m*l.durationPerTile),n=new lA(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.ne,l.fh,
23
+ t,v));return n?_.y(A,n.load(),4):A.F(2)}if(2!=A.a)return A["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};uA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ uA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=vA(d,b),f=d.eb()[0],g=new Image,h=d.startTime,l=0;l<e.fh;++l)for(var m=0;m<e.ne;++m)this.a.push(new lA(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.ne,e.fh,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.u=wA.prototype;_.u.onPlayerCreated=function(a){this.m=a};_.u.onPlayerWillDestroy=function(){this.m=null};_.u.onPlayerWillRelease=function(){this.a=null};
25
+ _.u.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=DA(c.url||null));(this.a=CA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Ue,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
+ _.u.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(xA(d)){this.a=new uA;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.u.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.O(1,9,2014,"Thumbnail format is not supported"))};_.u.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",wA);wA.prototype.get=wA.prototype.get;wA.Id="thumbnails";
27
+ EA.prototype.create=function(){return new wA};_.cu(new EA);var yA="SINGLE",zA="GRID",AA="WEBVTT",BA="BIF";};
28
28
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
29
29
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
30
30
  else{_=this.clpp._;(f.call(g,this));}