@castlabs/prestoplay 6.15.0 → 6.16.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 (61) hide show
  1. package/CHANGELOG.md +13 -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 +114 -114
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +546 -544
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +74 -74
  10. package/cjs/cl.externs.js +57 -55
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +368 -289
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +72 -72
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +71 -71
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +20 -20
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +89 -89
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +452 -452
  37. package/cl.crypto.js +9 -9
  38. package/cl.dash.js +69 -69
  39. package/cl.externs.js +57 -55
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -71
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +26 -26
  44. package/cl.ima.js +17 -17
  45. package/cl.mse.js +318 -255
  46. package/cl.muxdata.js +13 -13
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +11 -11
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +15 -15
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/package.json +1 -1
  61. package/typings.d.ts +46 -0
package/cjs/cl.smooth.js CHANGED
@@ -1,76 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var cN="Full MP4 box must have flags defined",dN="clpp.smooth.SmoothMP4Processor",eN="codecPrivateData",fN=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.V(a,c);_.V(a,d)},gN=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Cm()}},hN=function(a,b){gN(a,b>>16&255);gN(a,b>>8&255);gN(a,b&255)},iN=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Cm()}},jN=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Cm()}},kN=function(a,b){try{a.f.setInt16(a.a,
3
- b,a.h),a.a+=2}catch(c){_.Cm()}},lN=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},mN=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]},Z=function(a,b,c){mN.call(this,a);this.version=b;this.flags=c},nN=function(a,b,c){mN.call(this,a);this.h=b;this.offset=c},oN=function(a,b,c,
4
- d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},pN=function(a,b,c){mN.call(this,"ftyp");this.j=a;this.zh=b;this.h=c},qN=function(){mN.call(this,_.Te)},rN=function(){mN.call(this,_.sg)},sN=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.j=c+1;this.h=[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]},tN=function(){mN.call(this,"mvex")},uN=function(a){Z.call(this,"trex",0,0);this.h=a},vN=function(a,b,c,d,e){Z.call(this,"tkhd",1,7);
5
- this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.h=[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]},wN=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},xN=function(a){Z.call(this,"hdlr",0,0);this.h=a},yN=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},zN=function(a){mN.call(this,a);this.A=!0},AN=function(a){zN.call(this,a);this.height=this.width=0;this.depth=24},BN=
6
- function(a,b,c,d){zN.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},CN=function(a,b){AN.call(this,"avc1");this.width=a;this.height=b},DN=function(a,b){CN.call(this,a,b);this.type="encv"},EN=function(a,b,c){BN.call(this,"mp4a",a,b,c)},FN=function(a,b,c){EN.call(this,a,b,c);this.type="enca"},GN=function(a,b){mN.call(this,"avcC");this.Ta=a;this.$b=b;this.version=1;this.h=this.Ta[0][1];this.j=this.Ta[0][2];this.level=this.Ta[0][3]},HN=function(a){Z.call(this,"esds",0,0);this.Pb=
7
- a},IN=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},JN=function(){Z.call(this,"dref",0,0)},KN=function(){mN.call(this,_.gg)},LN=function(){Z.call(this,_.ig,0,0)},MN=function(){Z.call(this,"stts",0,0)},NN=function(){Z.call(this,"stsc",0,0)},ON=function(){Z.call(this,"stco",0,0)},PN=function(){Z.call(this,"stsz",0,0)},QN=function(){Z.call(this,"smhd",0,0)},RN=function(){mN.call(this,"dinf")},SN=function(){mN.call(this,_.Se)},TN=function(){mN.call(this,_.Oe)},UN=function(a,b){Z.call(this,
8
- "tfdt",a,0);this.baseMediaDecodeTime=b},VN=function(){Z.call(this,"mfhd",0,0);this.h=0},WN=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},XN=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},YN=function(){mN.call(this,"traf")},ZN=function(){mN.call(this,"moof")},$N=function(){mN.call(this,_.Ne);this.h=new Uint8Array(0)},aO=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},bO=
9
- function(a,b){Z.call(this,"schm",0,0);this.h=a;this.j=b;this.Jb=""},cO=function(a){mN.call(this,"frma");this.h=a},dO=function(){Z.call(this,"saio",0,0);this.offset=[0]},eO=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},fO=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},gO=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},hO=function(a,b,c,d){c=b.Yg[c];b=b.an;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 _.Pi([a],[b])[0]},iO=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Fg?c=["maxWidth","maxHeight","bitrate",eN,"fourCC"]:a.type===_.bd&&(c=["bitrate",eN,"channels","bitsPerSample","samplingRate","fourCC"]);return _.O.ka(a,b,c,["id","segmentIndex"])},jO=function(a,b,c){var d=c.oe.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ta:null,
11
- $b:null,width:NaN,height:NaN,Pb:null,Wd:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Fg:a.Ta=[_.yj(d[1])];a.$b=[_.yj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.bd:a.Pb=_.yj(c.oe),a.sampleSize=c.Hi||16,a.Wd=c.Wd,a.channelCount=c.wg}return a},kO=function(a,b){return a.filter(function(c){return c.type===b})},lO=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)},sO=function(a,
12
- b,c){var d=null;if(mO.test(a)){a=mO.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 nO.test(a)?d=lO(nO,a):oO.test(a)?d=lO(oO,a):pO.test(a)?(a=pO.exec(a),d=Number(a[1])/c.frameRate):qO.test(a)?(a=qO.exec(a),d=Number(a[1])/c.a):rO.test(a)&&(d=lO(rO,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},tO=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))},vO=function(a){this.a=a;this.f=uO(this)},uO=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Bm(b)},wO=function(a,b,c){a:{var d=_.t([_.Td,_.Rd]);for(var e=d.next();!e.done;e=d.next())if((e=c.se(e.value))&&e.keyId){d=e.keyId;break a}_.J(dN,
14
- "Could not get default Key ID for DRM init data!");d=null}c=new mN("xxxx");a.type===_.Fg?c=new DN(a.width,a.height):c=new FN(a.channelCount,a.sampleSize,a.Wd);a=new aO;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new mN("schi")).append([a]);b=(new mN(_.bg)).append([new cO(b),new bO(_.td,65536),a]);c.append([b]);return c},xO=function(a,b){var c=b.ve(),d=new sN(a.timescale,a.duration,a.id),e=(new tN).append([new uN(a.id)]),f=new vN(a.id,a.duration,a.timescale,a.width,a.height),g=new wN(a.timescale,
15
- a.duration),h=new xN(a.type),l=null,m=new JN;m.entries=[new IN];var n=new LN;switch(a.type){case _.Fg:var p=new GN(a.Ta,a.$b);c?(l=wO(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new CN(a.width,a.height)).append([p]),n.entries=[l]);l=new yN;break;case _.bd:p=new HN(a.Pb),c?(l=wO(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new EN(a.channelCount,a.sampleSize,a.Wd)).append([p]),n.entries=[l]),l=new QN}n=(new KN).append([n,new MN,new NN,new PN,new ON]);m=(new RN).append([m]);m=(new SN).append([l,m,n]);
16
- g=(new TN).append([g,h,m]);f=(new rN).append([f,g]);d=(new qN).append([d,f,e]);e=new pN("dash",0,["iso6","mp41","avc1"]);c&&(c=b.se(_.Rd),f=b.se(_.Td),c&&d.append([new nN("pssh",c.initData,8)]),f&&d.append([new nN("pssh",f.initData,8)]),c||f||_.J(dN,"Could not get PSSH init data!"));c=new vO([e,d]);return _.lj(c.write())},zO=function(a,b){var c,d,e,f,g,h;(new _.Pm).M("moof",_.Qm).Y("mfhd",function(m){var n=new VN;n.h=_.W(m.reader);c=n}).M("traf",_.Qm).Y("tfhd",function(m){var n=m.reader.Fa();if(null===
17
- m.flags)throw new _.P(_.Q,3,3019,cN);var p=new XN(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.Km(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.B=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.l=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.w=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.o=_.W(m.reader));d=p}).Y("trun",function(m){var n=m.reader.Fa();if(null===m.flags)throw new _.P(_.Q,3,3019,cN);var p=new WN(m.version||
18
- 0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.l=_.Jm(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.o=_.W(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.h;n++)m.flags&256&&p.w.push(_.W(m.reader)),m.flags&512&&p.sampleSize.push(_.W(m.reader)),m.flags&1024&&p.B.push(_.W(m.reader)),m.flags&2048&&(0===m.version?p.j.push(_.W(m.reader)):p.j.push(_.Jm(m.reader)));e=p}).Y("sdtp",function(m){var n=_.Mm(m.reader,m.reader.Fa());f=new oN("sdtp",m.version||0,m.flags||0,
19
- n,0)}).M("uuid",function(m){var n=_.Mm(m.reader,16);if(_.Aj(n,yO)){n=_.W(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new fO(m.version,m.flags);n.j=_.W(m.reader);m.flags&1&&(n.l=_.Hm(m.reader));for(var p=0;p<n.j;p++){var q={nh:_.Mm(m.reader,8),fd:0,bg:[]};if(m.flags&2){q.fd=_.Im(m.reader);for(var u=0;u<q.fd;u++){var v={ug:0,vg:0};v.ug=_.Im(m.reader);v.vg=_.W(m.reader);q.bg.push(v)}}n.h.push(q)}g=n}}).M(_.Ne,function(m){var n=new $N;0<m.reader.Fa()?n.h=_.Mm(m.reader,m.reader.Fa()):(_.J(dN,"mdat box is empty!"),
20
- n.h=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new YN).append([d,e]);f&&l.append([f]);b.ve()&&g&&l.append([g]);l=(new ZN).append([c,l]);return new vO([l,h])},AO=function(a,b,c,d){var e=d.ve(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=zO(b,d);if(null===g)return a.request.contentType===_.Ri?a.data:g;d=g.get(_.Ne);if(a.request.contentType===_.Ri){e=d.h.buffer;if(c){e=_.R.zd(e);if((e=(new DOMParser).parseFromString(e,_.og))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
- e.documentElement;if(h&&(d=new tO(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",_.pe],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 B=q[v].name;if(B=B.match(u)){p=
22
- p.getAttribute(B[0]);break b}}p=null}}f.setAttribute(l[m],sO(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.Ua(e).buffer}else c=e;return c}h=new ZN;a=g.get("mfhd");b=new YN;l=g.get("tfhd");m=new UN(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.h=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.j;m++)l.push(10+6*c.h[m].fd);else g=8;b.append([c,new dO,new eO(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=
23
- new vO([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},BO=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},CO=function(a,b,c){a=_.Wn(a);c&&a.version!==c&&(a=_.tA(a,c));return{initData:_.rA(a),initDataType:_.td,keyId:b,periodId:null}},EO=function(){this.w=this.h=this.f=
24
- this.C=null;this.N=1;this.T=0;this.l="";this.B=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.L=DO;this.H=0;this.D=this.I=Infinity;this.o=[];this.K=this.Bm.bind(this);this.G=new Map},FO=function(a,b){var c,d,e;return _.E(function(f){if(1==f.a)return c=_.Jj(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.C.networkingEngine.fetch(c),_.x(f,d.P,2);e=f.f;a.l=e.uri;return f["return"](e)})},MO=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.R.zd(b);var f=d.parseFromString(e.trim(),_.og)}catch(nG){throw nG;}if(f&&f.documentElement.tagName===_.cc)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(nG){}if(!c)throw a.g.error("Unable to parse manifest"),new _.P(_.Q,4,4033,a.l);var h=+GO(a,c,"MajorVersion"),
26
- l=+GO(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+GO(a,c,"Duration"),p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),u=+c.getAttribute("DVRWindowLength")||Infinity,v=_.Cn(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+h+"."+l))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.P(_.Q,4,4036,a.l);p?(HO(a,IO),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):HO(a,DO);a.a={startTime:0,delay:0,
27
- duration:n/m,pf:u/m,Qd:0};if(v){var z=a.f.playreadyVersion,B=[],I=_.Cn(v,"ProtectionHeader")[0],F=_.xj(_.En(I)||""),D=_.Wn(F).a;B.push(BO(_.Td,{initData:_.rA(_.Jn(D)),initDataType:_.td,keyId:D,periodId:null},[D]));B.push(BO(_.Rd,CO(F,D,z),[D]));a.o=B}var G=[],M=_.Cn(c,"StreamIndex");if(!M.length)throw a.g.error("No streams found!"),new _.P(_.Q,4,4034,a.l);for(var N=0;N<M.length;N++){for(var S,oa=a,Ba=M[N],$a=GO(oa,Ba,"Type"),ab=+Ba.getAttribute("Chunks"),Pa=Ba.getAttribute("Subtype"),Ca=Ba.getAttribute("Language")||
28
- _.vg,db=_.dj(Ca),ic=Ba.getAttribute("Name")||"",pg=+Ba.getAttribute(_.yb),qg=+Ba.getAttribute(_.xb),Nm=GO(oa,Ba,"Url"),kt=+Ba.getAttribute("TimeScale")||null,Vc=[],Om=_.Cn(Ba,_.Rb),Tt=0;Tt<Om.length;Tt++){var rf=void 0,kc=void 0,Ut=void 0,sf=oa,zd=Om[Tt],Vt=$a,vS=+zd.getAttribute("Index"),wS=+GO(sf,zd,"Bitrate"),qG=NaN,rG=NaN,Kn=NaN,Wt=NaN,sG=NaN,tG=NaN,uG=NaN,vG=zd.getAttribute("FourCC");switch(Vt){case _.Fg:qG=+GO(sf,zd,_.xb);rG=+GO(sf,zd,_.yb);break;case _.bd:Wt=+zd.getAttribute("Channels")||2,
29
- Kn=+GO(sf,zd,"SamplingRate"),tG=+GO(sf,zd,"AudioTag"),sG=+GO(sf,zd,"BitsPerSample"),uG=+GO(sf,zd,"PacketSize")}var Xt=String(zd.getAttribute("CodecPrivateData"));if(Vt===_.bd&&!Xt){var wG=Wt,xG={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},Ln=xG[Kn];if("AACH"===vG){kc=new Uint8Array(4);var yG=xG[2*Kn];kc[0]=40|Ln>>1;kc[1]=Ln<<7|wG<<3|yG>>1;kc[2]=yG<<7|8;kc[3]=0;rf=new Uint16Array(2);rf[0]=(kc[0]<<8)+kc[1];rf[1]=(kc[2]<<8)+kc[3];Ut=rf[0].toString(16)+
30
- rf[1].toString(16)}else kc=new Uint8Array(2),kc[0]=16|Ln>>1,kc[1]=Ln<<7|wG<<3,rf=new Uint16Array(1),rf[0]=(kc[0]<<8)+kc[1],Ut=rf[0].toString(16);Xt=Ut.toUpperCase()}var xS={id:sf.T++,type:Vt,index:vS,bitrate:wS,oe:Xt,maxHeight:qG,maxWidth:rG,Wd:Kn,wg:Wt,un:tG,Hi:sG,Kn:uG,pk:vG,segmentIndex:null};Vc.push(xS)}S=Vc;for(var Ee=[],zG=_.Cn(Ba,"c"),Wj=0;Wj<zG.length;Wj++){var Yt=zG[Wj],Wd=parseInt(Yt.getAttribute("t"),10),Lh=parseInt(Yt.getAttribute("d"),10),Zt=parseInt(Yt.getAttribute("r"),10),Xj=0;if(isNaN(Wd)&&
31
- isNaN(Lh))throw oa.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.P(_.Q,4,4037,oa.l);0===Wj&&isNaN(Wd)&&(Xj=Wd=0);if(0<Wj){var tg=Ee[Ee.length-1];Xj=tg.n+1;tg.d||(tg.d=Wd-tg.t);Wd||(Wd=tg.t+tg.d);Lh||(Lh=Wd-tg.t)}Ee.push({n:Xj,d:Lh,t:Wd});if(Zt){Zt--;for(var AG=0;AG<Zt;AG++){var Mn=Ee[Ee.length-1];Xj=Mn.n+1;Wd=Mn.t+Mn.d;Lh=Mn.d;Ee.push({n:Xj,d:Lh,t:Wd})}}}oa.rd()||Ee.length===ab||oa.g.warn("Number of fragments ("+ab+") differs from number of chunks ("+
32
- Ee.length+").");G.push({type:$a,yn:ab,Nm:Pa,language:db,Pd:Ca,name:ic,maxWidth:pg,maxHeight:qg,an:Nm,tracks:S,Yg:Ee,timescale:kt})}var tf={In:h,zh:l,timescale:m,duration:n,isLive:p,Hn:q,pf:u,zf:!1,streams:G};if(a.h&&a.w)return JO(a,tf),Promise.resolve();a.G.clear();var $t=tf.timescale,Nn=tf.duration,zS=kO(tf.streams,_.bd),AS=kO(tf.streams,_.Fg),BS=kO(tf.streams,_.Ri),BG=[],On=KO(a,Nn,$t,zS),Pn=KO(a,Nn,$t,AS),CS=KO(a,Nn,$t,BS);On.length||(On=[null]);Pn.length||(Pn=[null]);for(var bu=0;bu<Pn.length;bu++)for(var cu=
33
- 0;cu<On.length;cu++)BG.push(LO(a,Pn[bu],On[cu]));var CG={id:"ID",configurationId:void 0,startTime:0,endTime:Nn,variants:BG,textStreams:CS,thumbStreams:[]};var ES=tf.streams,du=a.a.startTime,DG=a.a.delay,eu=a.I,EG=Math.min(a.a.duration||Infinity,eu),fu=a.rd(),FS=a.a.pf,GS=a.a.Qd,FG=a.H,GG=isFinite(a.D)?a.D:0;if(fu)EG=Infinity,du=Date.now()/1E3-GS,a.a.startTime=du,DG=3*FG;else for(var HS=isFinite(eu)?eu:a.a.duration,HG=_.t(ES),gu=HG.next();!gu.done;gu=HG.next())for(var IG=_.t(gu.value.tracks),hu=IG.next();!hu.done;hu=
34
- IG.next()){var JG=hu.value;JG.segmentIndex.offset(-GG);_.WA(JG.segmentIndex,HS)}a.B=new _.dB(a.f.timeline||{},du,DG,!fu,!0);a.B.f=EG;_.lB(a.B,FG);a.B.A=FS;fu||a.B.offset(-GG);a.C.filterAllPeriods([CG]);a.h={presentationTimeline:a.B,periods:[CG],minBufferTime:0};Promise.resolve();a.J||(a.C.networkingEngine.ld(a.K),a.J=!0);a.w=tf;return Promise.resolve()},JO=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.t(a.w.streams[c].tracks),g=f.next();!g.done;e={Nb:e.Nb},g=f.next())if(e.Nb=
35
- g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.Nb.type&&m.bitrate===l.Nb.bitrate}}(e))){iO(e.Nb,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=NO(a,a.w.timescale,d,g);g=e.Nb.segmentIndex;g.na(h);(h=a.a.pf)&&_.CB(g,_.BB(g)-h).forEach(function(l){l.Qa().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.Nb.type+" track with bitrate "+(e.Nb.bitrate+". Skipping update."))},
36
- KO=function(a,b,c,d){for(var e=[],f={Fc:0};f.Fc<d.length;f={Fc:f.Fc},f.Fc++){var g=d[f.Fc].tracks.map(function(h){return function(l){var m=d[h.Fc],n=NO(a,c,m,l);n=new _.AB(n);var p=null;m.type!==_.Ri&&(p=OO(a,b,c,m,l));l.segmentIndex=n;var q=_.$G++,u=Promise.resolve.bind(Promise),v=n.Pc.bind(n),z=n.get.bind(n),B=n.md.bind(n),I=n.getDuration.bind(n),F=PO[m.type],D="";switch(m.type){case _.Fg:D=l.oe;var G=/00000001[0-9]7/.exec(D);D="avc1."+(G&&G[0]?D.substr(D.indexOf(G[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",
37
- D);break;case _.bd:D=l.oe,G=2,"AACH"===l.pk?G=5:D&&(G=(parseInt(D.substr(0,2),16)&248)>>3),D="mp4a.40."+G,a.g.debug("AUDIO CODECS: ",D)}G=m.type===_.Ri?QO[m.Nm]:void 0;return{id:q,originalId:null,Mn:null,createSegmentIndex:u,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:B,getDuration:I,segmentIndex:n,segmentLookupStrategy:_.cA,initSegmentReference:p,mimeType:F,codecs:D,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:G,encrypted:a.Af(),
38
- keyId:null,language:m.language,originalLanguage:m.Pd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.wg||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},NO=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Yg.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.D=Math.min(a.D,n)}else n=f[l-1].endTime;var p=n+m,q=hO(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.bj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.G.set(q,
39
- n);e+=m});if(c.type===_.Fg||c.type===_.bd)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Qd?a.a.Qd=b.endTime:a.a.Qd=Math.min(a.a.Qd,b.endTime);return f},OO=function(a,b,c,d,e){b=jO(b,d.timescale||c,e);c={isLive:a.rd.bind(a),ve:a.Af.bind(a),xk:function(){return 1},se:a.ah.bind(a)};d=new Uint8Array(0);try{d=xO(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,"+_.wj(d);return new _.DA(function(){return[f]},0,null,null,!0)},
40
- LO=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.vg;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},GO=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.l,c);},RO=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Hb.bind(a),b))},HO=function(a,b){var c=b===DO;a.h&&a.h.presentationTimeline&&_.gB(a.h.presentationTimeline,
41
- c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.L=b},SO=function(){};mN.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this};mN.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.f.length;b++){if(this.f[b].type===a)return this.f[b];var c=this.f[b].get(a);if(c)return c}return null};
42
- mN.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(var c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b};
43
- mN.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.V(a,1):_.V(a,this.size);_.Dm(a,lN(this.type));this.size>b&&fN(a,this.size);"uuid"===this.type&&_.Dm(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()};_.w(Z,mN);Z.prototype.a=function(){return 4+mN.prototype.a.call(this)};Z.prototype.write=function(a){mN.prototype.write.call(this,a);gN(a,this.version);hN(a,this.flags)};
44
- _.w(nN,mN);nN.prototype.a=function(){return this.h.byteLength+mN.prototype.a.call(this)-this.offset};nN.prototype.write=function(a){mN.prototype.write.call(this,a);_.Dm(a,this.h,this.offset);a.getPosition()};_.w(oN,Z);oN.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};oN.prototype.write=function(a){Z.prototype.write.call(this,a);_.Dm(a,this.h,this.offset);a.getPosition()};_.w(pN,mN);
45
- pN.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+mN.prototype.a.call(this)};pN.prototype.write=function(a){mN.prototype.write.call(this,a);_.Dm(a,lN(this.j));_.V(a,this.zh);_.Dm(a,lN(this.h.join("")));a.getPosition()};_.w(qN,mN);_.w(rN,mN);_.w(sN,Z);sN.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.h.length;return a+=Z.prototype.a.call(this)};
46
- sN.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(fN(a,0),fN(a,0),_.V(a,this.timescale),fN(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);iN(a,this.volume);iN(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.h.length;b++)gN(a,this.h[b]);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,this.j);a.getPosition()};_.w(tN,mN);_.w(uN,Z);uN.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
- uN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);_.V(a,1);_.V(a,0);_.V(a,0);_.V(a,0);a.getPosition()};_.w(vN,Z);vN.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.h.length;return a+Z.prototype.a.call(this)};
48
- vN.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(fN(a,0),fN(a,0),_.V(a,this.j),_.V(a,0),fN(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.j),_.V(a,0),_.V(a,this.duration*this.timescale));_.V(a,0);_.V(a,0);iN(a,0);iN(a,0);iN(a,this.volume);iN(a,0);for(var b=0;b<this.h.length;b++)gN(a,this.h[b]);iN(a,this.width);iN(a,0);iN(a,this.height);iN(a,0);a.getPosition()};_.w(wN,Z);wN.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
- wN.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(fN(a,0),fN(a,0),_.V(a,this.timescale),fN(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));iN(a,this.language);iN(a,0);a.getPosition()};_.w(xN,Z);xN.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
- xN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.h===_.Fg?_.Dm(a,lN("vide")):_.Dm(a,lN("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.h===_.Fg?_.Dm(a,lN("VideoHandler\x00")):_.Dm(a,lN("SoundHandler\x00"));a.getPosition()};_.w(yN,Z);yN.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};yN.prototype.write=function(a){Z.prototype.write.call(this,a);iN(a,0);_.Dm(a,this.h);a.getPosition()};_.w(zN,mN);zN.prototype.a=function(){return 8+mN.prototype.a.call(this)};
51
- zN.prototype.write=function(a){mN.prototype.write.call(this,a);_.V(a,0);iN(a,0);iN(a,1)};_.w(AN,zN);AN.prototype.a=function(){return 70+zN.prototype.a.call(this)};AN.prototype.write=function(a){zN.prototype.write.call(this,a);iN(a,0);iN(a,0);_.V(a,0);_.V(a,0);_.V(a,0);iN(a,this.width);iN(a,this.height);_.V(a,4718592);_.V(a,4718592);_.V(a,0);iN(a,1);gN(a,10);_.Dm(a,lN("AVC Coding",31));iN(a,this.depth);kN(a,-1)};_.w(BN,zN);BN.prototype.a=function(){return 20+zN.prototype.a.call(this)};
52
- BN.prototype.write=function(a){zN.prototype.write.call(this,a);_.V(a,0);_.V(a,0);iN(a,this.channelCount);iN(a,this.sampleSize);kN(a,0);iN(a,0);iN(a,this.sampleRate);iN(a,0)};_.w(CN,AN);CN.prototype.write=function(a){AN.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(DN,CN);_.w(EN,BN);EN.prototype.write=function(a){BN.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(FN,EN);_.w(GN,mN);
53
- GN.prototype.a=function(){for(var a=7,b=0;b<this.Ta.length;b++)a+=2,a+=this.Ta[b].byteLength;for(b=0;b<this.Ta.length;b++)a+=2,a+=this.$b[b].byteLength;return a+mN.prototype.a.call(this)};
54
- GN.prototype.write=function(a){mN.prototype.write.call(this,a);gN(a,this.version);gN(a,this.h);gN(a,this.j);gN(a,this.level);gN(a,255);gN(a,224|this.Ta.length);for(var b=0;b<this.Ta.length;b++)iN(a,this.Ta[b].length),_.Dm(a,this.Ta[b]);gN(a,this.$b.length);for(b=0;b<this.$b.length;b++)iN(a,this.$b[b].length),_.Dm(a,this.$b[b]);a.getPosition()};_.w(HN,Z);HN.prototype.a=function(){return 22+(this.Pb.byteLength+3)+Z.prototype.a.call(this)};
55
- HN.prototype.write=function(a){Z.prototype.write.call(this,a);gN(a,3);gN(a,23+this.Pb.byteLength);iN(a,1);gN(a,0);gN(a,4);gN(a,15+this.Pb.byteLength);gN(a,64);gN(a,21);hN(a,0);_.V(a,0);_.V(a,0);gN(a,5);gN(a,this.Pb.byteLength);_.Dm(a,this.Pb);_.Dm(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(IN,Z);IN.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};IN.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.Dm(a,lN(this.location));a.getPosition()};
56
- _.w(JN,Z);JN.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)};JN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(KN,mN);_.w(LN,Z);LN.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
- LN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(MN,Z);MN.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)};MN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(NN,Z);
58
- NN.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)};NN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(ON,Z);ON.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
- ON.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(PN,Z);PN.prototype.a=function(){return 8+Z.prototype.a.call(this)};PN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);_.V(a,0);a.getPosition()};_.w(QN,Z);QN.prototype.a=function(){return 4+Z.prototype.a.call(this)};QN.prototype.write=function(a){Z.prototype.write.call(this,a);kN(a,0);iN(a,0);a.getPosition()};
60
- _.w(RN,mN);_.w(SN,mN);_.w(TN,mN);_.w(UN,Z);UN.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};UN.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?fN(a,this.baseMediaDecodeTime):_.V(a,this.baseMediaDecodeTime);a.getPosition()};_.w(VN,Z);VN.prototype.a=function(){return 4+Z.prototype.a.call(this)};VN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);a.getPosition()};_.w(WN,Z);
61
- WN.prototype.a=function(){var a=4;this.flags&TO&&(a+=4);this.flags&UO&&(a+=4);for(var b=0;b<this.h;b++)this.flags&VO&&(a+=4),this.flags&WO&&(a+=4),this.flags&XO&&(a+=4),this.flags&YO&&(a+=4);return a+Z.prototype.a.call(this)};
62
- WN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&TO&&(a.getPosition(),jN(a,this.l));this.flags&UO&&_.V(a,this.o);for(var b=0;b<this.h;b++)this.flags&VO&&_.V(a,this.w[b]),this.flags&WO&&_.V(a,this.sampleSize[b]),this.flags&XO&&_.V(a,this.B[b]),this.flags&YO&&(0===this.version?_.V(a,this.j[b]):jN(a,this.j[b]));a.getPosition()};var TO=1,UO=4,VO=256,WO=512,XO=1024,YO=2048;_.w(XN,Z);
63
- XN.prototype.a=function(){var a=4;this.flags&ZO&&(a+=8);this.flags&$O&&(a+=4);this.flags&aP&&(a+=4);this.flags&bP&&(a+=4);this.flags&cP&&(a+=4);return a+Z.prototype.a.call(this)};XN.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&ZO&&fN(a,this.j);this.flags&$O&&_.V(a,this.B);this.flags&aP&&_.V(a,this.l);this.flags&bP&&_.V(a,this.w);this.flags&cP&&_.V(a,this.o);a.getPosition()};var ZO=1,$O=2,aP=8,bP=16,cP=32;_.w(YN,mN);_.w(ZN,mN);_.w($N,mN);
64
- $N.prototype.a=function(){return this.h.byteLength+mN.prototype.a.call(this)};$N.prototype.write=function(a){mN.prototype.write.call(this,a);0<this.h.byteLength&&_.Dm(a,this.h)};_.w(aO,Z);aO.prototype.a=function(){var a=20;1===this.h&&0===this.j&&(a=a+1+this.l.length);return a+Z.prototype.a.call(this)};
65
- aO.prototype.write=function(a){Z.prototype.write.call(this,a);gN(a,0);0===this.version?gN(a,0):gN(a,0);gN(a,this.h);gN(a,this.j);_.Dm(a,_.yj(this.o));if(1===this.h&&0===this.j){gN(a,0);for(var b=0;b<this.l.length;b++)gN(a,this.l[b])}a.getPosition()};_.w(bO,Z);bO.prototype.a=function(){var a=8;this.flags&1&&(a+=lN(this.Jb).byteLength);return a+Z.prototype.a.call(this)};bO.prototype.write=function(a){Z.prototype.write.call(this,a);_.Dm(a,lN(this.h));_.V(a,this.j);this.flags&1&&_.Dm(a,lN(this.Jb));a.getPosition()};
66
- _.w(cO,mN);cO.prototype.a=function(){return lN(this.h).byteLength+mN.prototype.a.call(this)};cO.prototype.write=function(a){mN.prototype.write.call(this,a);_.Dm(a,lN(this.h));a.getPosition()};_.w(dO,Z);dO.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
- dO.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));_.V(a,1);for(var b=0;1>b;b++)0===this.version?_.V(a,this.offset[b]):fN(a,this.offset[b]);a.getPosition()};_.w(eO,Z);eO.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.h&&(a+=this.l.length);return a+Z.prototype.a.call(this)};
68
- eO.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));gN(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)gN(a,this.l[b]);a.getPosition()};_.w(fO,Z);fO.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].nh.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].fd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
- fO.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&gN(a,this.l);for(var b=0;b<this.j;b++)if(_.Dm(a,this.h[b].nh),this.flags&2){iN(a,this.h[b].fd);for(var c=0;c<this.h[b].fd;c++)iN(a,this.h[b].bg[c].ug),_.V(a,this.h[b].bg[c].vg)}a.getPosition()};var mO=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,nO=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,oO=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,pO=/^(\d*\.?\d*)f$/,qO=/^(\d*\.?\d*)t$/,rO=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;vO.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};vO.prototype.write=function(){this.f=uO(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var yO=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=EO.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.C=b;var d=_.ah(new Set([a,gO(a)])).concat();return FO(this,d).then(function(e){return MO(c,e.data).then(function(){RO(c,c.A);return c.h})})};_.r.requestStop=function(){};_.r.stop=function(){this.C&&this.C.networkingEngine.Ie(this.K);this.A=this.w=this.h=this.f=this.C=null;this.j&&(clearTimeout(this.j),this.j=null);this.J=!1;this.I=this.D=Infinity;return Promise.resolve()};
70
- _.r.update=function(){var a=this;if(this.rd())return FO(this,[this.l]).then(function(b){return MO(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.C)a.C.onError(b)})};_.r.setCurrentVariant=function(){};_.r.Hb=function(){var a=this;this.g.debug(_.Wz);this.C&&(this.j=null,this.update().then(function(){RO(a,a.A)})["catch"](function(b){a.C&&(a.C.onError(b),1===b.severity&&RO(a,100))}))};_.r.rd=function(){return this.L===IO};_.r.Af=function(){return 0<this.o.length};
71
- _.r.ah=function(a){var b=null;if(this.o.length)for(var c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b};
72
- _.r.Bm=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.w.timescale,c={isLive:this.rd.bind(this),ve:this.Af.bind(this),xk:function(){return 1},se:this.ah.bind(this)},d=!1,e=new _.P(_.Q,3,4035,null),f=null;try{var g=this.G.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=AO(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 PO={video:_.Hg,audio:_.fd,text:_.Zc},DO=_.oc,IO="LIVE",QO={cn:_.pd,mn:_.kg};_.w(SO,_.Cs);SO.prototype.f=function(){_.Ct.ism=EO;_.At[_.$c]=EO};SO.prototype.a=function(){_.dC("ism");_.eC(_.$c)};SO.prototype.id=function(){return"smooth"};_.H("clpp.smooth.SmoothComponent",SO);};
2
+ var f=function(window){var VQ="Full MP4 box must have flags defined",WQ="clpp.smooth.SmoothMP4Processor",XQ="codecPrivateData",YQ=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.U(a,c);_.U(a,d)},ZQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Gm()}},$Q=function(a,b){ZQ(a,b>>16&255);ZQ(a,b>>8&255);ZQ(a,b&255)},aR=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Gm()}},bR=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Gm()}},cR=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.Gm()}},dR=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},eR=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]},Z=function(a,b,c){eR.call(this,a);this.version=b;this.flags=c},fR=function(a,b,c){eR.call(this,a);this.h=b;this.offset=c},gR=function(a,b,c,
4
+ d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},hR=function(a,b,c){eR.call(this,"ftyp");this.j=a;this.bi=b;this.h=c},iR=function(){eR.call(this,_.Ue)},jR=function(){eR.call(this,_.tg)},kR=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.j=c+1;this.h=[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]},lR=function(){eR.call(this,"mvex")},mR=function(a){Z.call(this,"trex",0,0);this.h=a},nR=function(a,b,c,d,e){Z.call(this,"tkhd",1,7);
5
+ this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.h=[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]},oR=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},pR=function(a){Z.call(this,"hdlr",0,0);this.h=a},qR=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},rR=function(a){eR.call(this,a);this.A=!0},sR=function(a){rR.call(this,a);this.height=this.width=0;this.depth=24},tR=
6
+ function(a,b,c,d){rR.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},uR=function(a,b){sR.call(this,"avc1");this.width=a;this.height=b},vR=function(a,b){uR.call(this,a,b);this.type=_.$B},wR=function(a,b,c){tR.call(this,"mp4a",a,b,c)},xR=function(a,b,c){wR.call(this,a,b,c);this.type="enca"},yR=function(a,b){eR.call(this,"avcC");this.gb=a;this.kc=b;this.version=1;this.h=this.gb[0][1];this.j=this.gb[0][2];this.level=this.gb[0][3]},zR=function(a){Z.call(this,"esds",0,0);this.$b=a},
7
+ AR=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},BR=function(){Z.call(this,"dref",0,0)},CR=function(){eR.call(this,_.jg)},DR=function(){Z.call(this,_.lg,0,0)},ER=function(){Z.call(this,"stts",0,0)},FR=function(){Z.call(this,"stsc",0,0)},GR=function(){Z.call(this,"stco",0,0)},HR=function(){Z.call(this,"stsz",0,0)},IR=function(){Z.call(this,"smhd",0,0)},JR=function(){eR.call(this,"dinf")},KR=function(){eR.call(this,_.Te)},LR=function(){eR.call(this,_.Oe)},MR=function(a,b){Z.call(this,
8
+ "tfdt",a,0);this.baseMediaDecodeTime=b},NR=function(){Z.call(this,"mfhd",0,0);this.h=0},OR=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.C=[];this.j=[]},PR=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.C=this.j=0},QR=function(){eR.call(this,"traf")},RR=function(){eR.call(this,"moof")},SR=function(){eR.call(this,_.Ne);this.h=new Uint8Array(0)},TR=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},UR=
9
+ function(a,b){Z.call(this,"schm",0,0);this.h=a;this.j=b;this.Ub=""},VR=function(a){eR.call(this,"frma");this.h=a},WR=function(){Z.call(this,"saio",0,0);this.offset=[0]},YR=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},ZR=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},$R=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},aS=function(a,b,c,d){c=b.Ch[c];b=b.Bn;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 _.Si([a],[b])[0]},bS=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",XQ,"fourCC"]:a.type===_.bd&&(c=["bitrate",XQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.O.oa(a,b,c,["id","segmentIndex"])},cS=function(a,b,c){var d=c.He.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,gb:null,
11
+ kc:null,width:NaN,height:NaN,$b:null,le:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.gb=[_.Aj(d[1])];a.kc=[_.Aj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.bd:a.$b=_.Aj(c.He),a.sampleSize=c.mj||16,a.le=c.le,a.channelCount=c.Ug}return a},dS=function(a,b){return a.filter(function(c){return c.type===b})},eS=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)},lS=function(a,b,
12
+ c){var d=null;if(fS.test(a)){a=fS.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 gS.test(a)?d=eS(gS,a):hS.test(a)?d=eS(hS,a):iS.test(a)?(a=iS.exec(a),d=Number(a[1])/c.frameRate):jS.test(a)?(a=jS.exec(a),d=Number(a[1])/c.a):kS.test(a)&&(d=eS(kS,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},mS=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))},oS=function(a){this.a=a;this.f=nS(this)},nS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Fm(b)},pS=function(a,b,c){a:{var d=_.w([_.Ud,_.Sd]);for(var e=d.next();!e.done;e=d.next())if((e=c.Le(e.value))&&e.keyId){d=e.keyId;break a}_.Fh(WQ,
14
+ "Could not get default Key ID for DRM init data!");d=null}c=new eR("xxxx");a.type===_.r?c=new vR(a.width,a.height):c=new xR(a.channelCount,a.sampleSize,a.le);a=new TR;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new eR("schi")).append([a]);b=(new eR(_.dg)).append([new VR(b),new UR(_.ud,65536),a]);c.append([b]);return c},qS=function(a,b){var c=b.Pe(),d=new kR(a.timescale,a.duration,a.id),e=(new lR).append([new mR(a.id)]),f=new nR(a.id,a.duration,a.timescale,a.width,a.height),g=new oR(a.timescale,
15
+ a.duration),h=new pR(a.type),l=null,m=new BR;m.entries=[new AR];var n=new DR;switch(a.type){case _.r:var p=new yR(a.gb,a.kc);c?(l=pS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new uR(a.width,a.height)).append([p]),n.entries=[l]);l=new qR;break;case _.bd:p=new zR(a.$b),c?(l=pS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new wR(a.channelCount,a.sampleSize,a.le)).append([p]),n.entries=[l]),l=new IR}n=(new CR).append([n,new ER,new FR,new HR,new GR]);m=(new JR).append([m]);m=(new KR).append([l,m,n]);
16
+ g=(new LR).append([g,h,m]);f=(new jR).append([f,g]);d=(new iR).append([d,f,e]);e=new hR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Le(_.Sd),f=b.Le(_.Ud),c&&d.append([new fR("pssh",c.initData,8)]),f&&d.append([new fR("pssh",f.initData,8)]),c||f||_.Fh(WQ,"Could not get PSSH init data!"));c=new oS([e,d]);return _.nj(c.write())},sS=function(a,b){var c,d,e,f,g,h;(new _.Rm).K("moof",_.Sm).Y("mfhd",function(m){var n=new NR;n.h=_.V(m.reader);c=n}).K("traf",_.Sm).Y("tfhd",function(m){var n=m.reader.La();if(null===
17
+ m.flags)throw new _.P(_.Q,3,3019,VQ);var p=new PR(m.version||0,m.flags||0);p.h=_.V(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.Om(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.C=_.V(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.l=_.V(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.w=_.V(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.o=_.V(m.reader));d=p}).Y("trun",function(m){var n=m.reader.La();if(null===m.flags)throw new _.P(_.Q,3,3019,VQ);var p=new OR(m.version||
18
+ 0,m.flags||0);p.h=_.V(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.l=_.Nm(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.o=_.V(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.h;n++)m.flags&256&&p.w.push(_.V(m.reader)),m.flags&512&&p.sampleSize.push(_.V(m.reader)),m.flags&1024&&p.C.push(_.V(m.reader)),m.flags&2048&&(0===m.version?p.j.push(_.V(m.reader)):p.j.push(_.Nm(m.reader)));e=p}).Y("sdtp",function(m){var n=_.Qm(m.reader,m.reader.La());f=new gR("sdtp",m.version||0,m.flags||0,
19
+ n,0)}).K("uuid",function(m){var n=_.Qm(m.reader,16);if(_.Cj(n,rS)){n=_.V(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new ZR(m.version,m.flags);n.j=_.V(m.reader);m.flags&1&&(n.l=_.Lm(m.reader));for(var p=0;p<n.j;p++){var q={Rh:_.Qm(m.reader,8),vd:0,wg:[]};if(m.flags&2){q.vd=_.Mm(m.reader);for(var t=0;t<q.vd;t++){var v={Rg:0,Sg:0};v.Rg=_.Mm(m.reader);v.Sg=_.V(m.reader);q.wg.push(v)}}n.h.push(q)}g=n}}).K(_.Ne,function(m){var n=new SR;0<m.reader.La()?n.h=_.Qm(m.reader,m.reader.La()):(_.Fh(WQ,"mdat box is empty!"),
20
+ n.h=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new QR).append([d,e]);f&&l.append([f]);b.Pe()&&g&&l.append([g]);l=(new RR).append([c,l]);return new oS([l,h])},tS=function(a,b,c,d){var e=d.Pe(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=sS(b,d);if(null===g)return a.request.contentType===_.R?a.data:g;d=g.get(_.Ne);if(a.request.contentType===_.R){e=d.h.buffer;if(c){e=_.S.Pd(e);if((e=(new DOMParser).parseFromString(e,_.rg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
+ e.documentElement;if(h&&(d=new mS(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],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 B=q[v].name;if(B=B.match(t)){p=
22
+ p.getAttribute(B[0]);break b}}p=null}}f.setAttribute(l[m],lS(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.S.hb(e).buffer}else c=e;return c}h=new RR;a=g.get("mfhd");b=new QR;l=g.get("tfhd");m=new MR(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.h=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.j;m++)l.push(10+6*c.h[m].vd);else g=8;b.append([c,new WR,new YR(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=
23
+ new oS([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},uS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},vS=function(a,b,c){a=_.Un(a);c&&a.version!==c&&(a=_.jD(a,c));return{initData:_.hD(a),initDataType:_.ud,keyId:b,periodId:null}},xS=function(){this.w=this.h=this.f=
24
+ this.B=null;this.P=1;this.T=0;this.l="";this.C=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.M=wS;this.H=0;this.D=this.I=Infinity;this.o=[];this.L=this.dn.bind(this);this.G=new Map},yS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Lj(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.B.networkingEngine.fetch(c),_.y(f,d.N,2);e=f.f;a.l=e.uri;return f["return"](e)})},FS=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.S.Pd(b);var f=d.parseFromString(e.trim(),_.rg)}catch(UJ){throw UJ;}if(f&&f.documentElement.tagName===_.dc)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(UJ){}if(!c)throw a.g.error("Unable to parse manifest"),new _.P(_.Q,4,4033,a.l);var h=+zS(a,c,"MajorVersion"),
26
+ l=+zS(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+zS(a,c,"Duration"),p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),t=+c.getAttribute("DVRWindowLength")||Infinity,v=_.Gn(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+h+"."+l))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.P(_.Q,4,4036,a.l);p?(AS(a,BS),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):AS(a,wS);a.a={startTime:0,delay:0,
27
+ duration:n/m,If:t/m,ce:0};if(v){var z=a.f.playreadyVersion,B=[],F=_.Gn(v,"ProtectionHeader")[0],G=_.zj(_.In(F)||""),A=_.Un(G).a;B.push(uS(_.Ud,{initData:_.hD(_.Nn(A)),initDataType:_.ud,keyId:A,periodId:null},[A]));B.push(uS(_.Sd,vS(G,A,z),[A]));a.o=B}var H=[],M=_.Gn(c,"StreamIndex");if(!M.length)throw a.g.error("No streams found!"),new _.P(_.Q,4,4034,a.l);for(var N=0;N<M.length;N++){for(var W,pa=a,Ca=M[N],$a=zS(pa,Ca,"Type"),ab=+Ca.getAttribute("Chunks"),Qa=Ca.getAttribute("Subtype"),Da=Ca.getAttribute("Language")||
28
+ _.vg,fb=_.fj(Da),qc=Ca.getAttribute("Name")||"",Kg=+Ca.getAttribute(_.zb),Lg=+Ca.getAttribute(_.yb),Bn=zS(pa,Ca,"Url"),gu=+Ca.getAttribute("TimeScale")||null,ed=[],Cn=_.Gn(Ca,_.Sb),Pu=0;Pu<Cn.length;Pu++){var Qf=void 0,sc=void 0,Qu=void 0,Rf=pa,Gd=Cn[Pu],Ru=$a,nW=+Gd.getAttribute("Index"),oW=+zS(Rf,Gd,"Bitrate"),XJ=NaN,YJ=NaN,yo=NaN,Su=NaN,ZJ=NaN,$J=NaN,aK=NaN,bK=Gd.getAttribute("FourCC");switch(Ru){case _.r:XJ=+zS(Rf,Gd,_.yb);YJ=+zS(Rf,Gd,_.zb);break;case _.bd:Su=+Gd.getAttribute("Channels")||2,
29
+ yo=+zS(Rf,Gd,"SamplingRate"),$J=+zS(Rf,Gd,"AudioTag"),ZJ=+zS(Rf,Gd,"BitsPerSample"),aK=+zS(Rf,Gd,"PacketSize")}var Tu=String(Gd.getAttribute("CodecPrivateData"));if(Ru===_.bd&&!Tu){var cK=Su,dK={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},zo=dK[yo];if("AACH"===bK){sc=new Uint8Array(4);var eK=dK[2*yo];sc[0]=40|zo>>1;sc[1]=zo<<7|cK<<3|eK>>1;sc[2]=eK<<7|8;sc[3]=0;Qf=new Uint16Array(2);Qf[0]=(sc[0]<<8)+sc[1];Qf[1]=(sc[2]<<8)+sc[3];Qu=Qf[0].toString(16)+
30
+ Qf[1].toString(16)}else sc=new Uint8Array(2),sc[0]=16|zo>>1,sc[1]=zo<<7|cK<<3,Qf=new Uint16Array(1),Qf[0]=(sc[0]<<8)+sc[1],Qu=Qf[0].toString(16);Tu=Qu.toUpperCase()}var pW={id:Rf.T++,type:Ru,index:nW,bitrate:oW,He:Tu,maxHeight:XJ,maxWidth:YJ,le:yo,Ug:Su,Rn:$J,mj:ZJ,io:aK,Yk:bK,segmentIndex:null};ed.push(pW)}W=ed;for(var Qe=[],fK=_.Gn(Ca,"c"),pk=0;pk<fK.length;pk++){var Uu=fK[pk],fe=parseInt(Uu.getAttribute("t"),10),ei=parseInt(Uu.getAttribute("d"),10),Vu=parseInt(Uu.getAttribute("r"),10),qk=0;if(isNaN(fe)&&
31
+ isNaN(ei))throw pa.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.P(_.Q,4,4037,pa.l);0===pk&&isNaN(fe)&&(qk=fe=0);if(0<pk){var Og=Qe[Qe.length-1];qk=Og.n+1;Og.d||(Og.d=fe-Og.t);fe||(fe=Og.t+Og.d);ei||(ei=fe-Og.t)}Qe.push({n:qk,d:ei,t:fe});if(Vu){Vu--;for(var gK=0;gK<Vu;gK++){var Ao=Qe[Qe.length-1];qk=Ao.n+1;fe=Ao.t+Ao.d;ei=Ao.d;Qe.push({n:qk,d:ei,t:fe})}}}pa.Hd()||Qe.length===ab||pa.g.warn("Number of fragments ("+ab+") differs from number of chunks ("+
32
+ Qe.length+").");H.push({type:$a,Vn:ab,qn:Qa,language:fb,be:Da,name:qc,maxWidth:Kg,maxHeight:Lg,Bn:Bn,tracks:W,Ch:Qe,timescale:gu})}var Sf={fo:h,bi:l,timescale:m,duration:n,isLive:p,eo:q,If:t,Tf:!1,streams:H};if(a.h&&a.w)return CS(a,Sf),Promise.resolve();a.G.clear();var Wu=Sf.timescale,Bo=Sf.duration,rW=dS(Sf.streams,_.bd),sW=dS(Sf.streams,_.r),tW=dS(Sf.streams,_.R),hK=[],Co=DS(a,Bo,Wu,rW),Do=DS(a,Bo,Wu,sW),uW=DS(a,Bo,Wu,tW);Co.length||(Co=[null]);Do.length||(Do=[null]);for(var Yu=0;Yu<Do.length;Yu++)for(var Zu=
33
+ 0;Zu<Co.length;Zu++)hK.push(ES(a,Do[Yu],Co[Zu]));var iK={id:"ID",configurationId:void 0,startTime:0,endTime:Bo,variants:hK,textStreams:uW,thumbStreams:[]};var wW=Sf.streams,$u=a.a.startTime,jK=a.a.delay,av=a.I,kK=Math.min(a.a.duration||Infinity,av),bv=a.Hd(),xW=a.a.If,yW=a.a.ce,lK=a.H,mK=isFinite(a.D)?a.D:0;if(bv)kK=Infinity,$u=Date.now()/1E3-yW,a.a.startTime=$u,jK=3*lK;else for(var zW=isFinite(av)?av:a.a.duration,nK=_.w(wW),cv=nK.next();!cv.done;cv=nK.next())for(var oK=_.w(cv.value.tracks),dv=oK.next();!dv.done;dv=
34
+ oK.next()){var pK=dv.value;pK.segmentIndex.offset(-mK);_.QD(pK.segmentIndex,zW)}a.C=new _.ZD(a.f.timeline||{},$u,jK,!bv,!0);a.C.h=kK;_.gE(a.C,lK);a.C.A=xW;bv||a.C.offset(-mK);a.B.filterAllPeriods([iK]);a.h={presentationTimeline:a.C,periods:[iK],minBufferTime:0};Promise.resolve();a.J||(a.B.networkingEngine.Bd(a.L),a.J=!0);a.w=Sf;return Promise.resolve()},CS=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.w(a.w.streams[c].tracks),g=f.next();!g.done;e={Yb:e.Yb},g=f.next())if(e.Yb=
35
+ g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.Yb.type&&m.bitrate===l.Yb.bitrate}}(e))){bS(e.Yb,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=GS(a,a.w.timescale,d,g);g=e.Yb.segmentIndex;g.ra(h);(h=a.a.If)&&_.xE(g,_.wE(g)-h).forEach(function(l){l.Sa().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.Yb.type+" track with bitrate "+(e.Yb.bitrate+". Skipping update."))},
36
+ DS=function(a,b,c,d){for(var e=[],f={Sc:0};f.Sc<d.length;f={Sc:f.Sc},f.Sc++){var g=d[f.Sc].tracks.map(function(h){return function(l){var m=d[h.Sc],n=GS(a,c,m,l);n=new _.vE(n);var p=null;m.type!==_.R&&(p=HS(a,b,c,m,l));l.segmentIndex=n;var q=_.SK++,t=Promise.resolve.bind(Promise),v=n.dd.bind(n),z=n.get.bind(n),B=n.Cd.bind(n),F=n.getDuration.bind(n),G=IS[m.type],A="";switch(m.type){case _.r:A=l.He;var H=/00000001[0-9]7/.exec(A);A="avc1."+(H&&H[0]?A.substr(A.indexOf(H[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",
37
+ A);break;case _.bd:A=l.He,H=2,"AACH"===l.Yk?H=5:A&&(H=(parseInt(A.substr(0,2),16)&248)>>3),A="mp4a.40."+H,a.g.debug("AUDIO CODECS: ",A)}H=m.type===_.R?JS[m.qn]:void 0;return{id:q,originalId:null,ko:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:B,getDuration:F,segmentIndex:n,segmentLookupStrategy:_.hC,initSegmentReference:p,mimeType:G,codecs:A,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:H,encrypted:a.Uf(),
38
+ keyId:null,language:m.language,originalLanguage:m.be,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Ug||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},GS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Ch.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.D=Math.min(a.D,n)}else n=f[l-1].endTime;var p=n+m,q=aS(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.dj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.G.set(q,
39
+ n);e+=m});if(c.type===_.r||c.type===_.bd)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.ce?a.a.ce=b.endTime:a.a.ce=Math.min(a.a.ce,b.endTime);return f},HS=function(a,b,c,d,e){b=cS(b,d.timescale||c,e);c={isLive:a.Hd.bind(a),Pe:a.Uf.bind(a),fl:function(){return 1},Le:a.Fh.bind(a)};d=new Uint8Array(0);try{d=qS(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,"+_.yj(d);return new _.uD(function(){return[f]},0,null,null,!0)},ES=
40
+ function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.vg;return c||b?{id:a.P++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},zS=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.l,c);},KS=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.tb.bind(a),b))},AS=function(a,b){var c=b===wS;a.h&&a.h.presentationTimeline&&_.bE(a.h.presentationTimeline,
41
+ c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.M=b},LS=function(){};eR.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this};eR.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.f.length;b++){if(this.f[b].type===a)return this.f[b];var c=this.f[b].get(a);if(c)return c}return null};
42
+ eR.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(var c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b};
43
+ eR.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.U(a,1):_.U(a,this.size);_.Hm(a,dR(this.type));this.size>b&&YQ(a,this.size);"uuid"===this.type&&_.Hm(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()};_.x(Z,eR);Z.prototype.a=function(){return 4+eR.prototype.a.call(this)};Z.prototype.write=function(a){eR.prototype.write.call(this,a);ZQ(a,this.version);$Q(a,this.flags)};
44
+ _.x(fR,eR);fR.prototype.a=function(){return this.h.byteLength+eR.prototype.a.call(this)-this.offset};fR.prototype.write=function(a){eR.prototype.write.call(this,a);_.Hm(a,this.h,this.offset);a.getPosition()};_.x(gR,Z);gR.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};gR.prototype.write=function(a){Z.prototype.write.call(this,a);_.Hm(a,this.h,this.offset);a.getPosition()};_.x(hR,eR);
45
+ hR.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+eR.prototype.a.call(this)};hR.prototype.write=function(a){eR.prototype.write.call(this,a);_.Hm(a,dR(this.j));_.U(a,this.bi);_.Hm(a,dR(this.h.join("")));a.getPosition()};_.x(iR,eR);_.x(jR,eR);_.x(kR,Z);kR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.h.length;return a+=Z.prototype.a.call(this)};
46
+ kR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(YQ(a,0),YQ(a,0),_.U(a,this.timescale),YQ(a,this.duration*this.timescale)):(_.U(a,0),_.U(a,0),_.U(a,this.timescale),_.U(a,this.duration*this.timescale));_.U(a,65536);aR(a,this.volume);aR(a,0);_.U(a,0);_.U(a,0);for(var b=0;b<this.h.length;b++)ZQ(a,this.h[b]);_.U(a,0);_.U(a,0);_.U(a,0);_.U(a,0);_.U(a,0);_.U(a,0);_.U(a,this.j);a.getPosition()};_.x(lR,eR);_.x(mR,Z);mR.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
+ mR.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,this.h);_.U(a,1);_.U(a,0);_.U(a,0);_.U(a,0);a.getPosition()};_.x(nR,Z);nR.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.h.length;return a+Z.prototype.a.call(this)};
48
+ nR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(YQ(a,0),YQ(a,0),_.U(a,this.j),_.U(a,0),YQ(a,this.duration*this.timescale)):(_.U(a,0),_.U(a,0),_.U(a,this.j),_.U(a,0),_.U(a,this.duration*this.timescale));_.U(a,0);_.U(a,0);aR(a,0);aR(a,0);aR(a,this.volume);aR(a,0);for(var b=0;b<this.h.length;b++)ZQ(a,this.h[b]);aR(a,this.width);aR(a,0);aR(a,this.height);aR(a,0);a.getPosition()};_.x(oR,Z);oR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
+ oR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(YQ(a,0),YQ(a,0),_.U(a,this.timescale),YQ(a,this.duration*this.timescale)):(_.U(a,0),_.U(a,0),_.U(a,this.timescale),_.U(a,this.duration*this.timescale));aR(a,this.language);aR(a,0);a.getPosition()};_.x(pR,Z);pR.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
+ pR.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,0);this.h===_.r?_.Hm(a,dR("vide")):_.Hm(a,dR("soun"));_.U(a,0);_.U(a,0);_.U(a,0);this.h===_.r?_.Hm(a,dR("VideoHandler\x00")):_.Hm(a,dR("SoundHandler\x00"));a.getPosition()};_.x(qR,Z);qR.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};qR.prototype.write=function(a){Z.prototype.write.call(this,a);aR(a,0);_.Hm(a,this.h);a.getPosition()};_.x(rR,eR);rR.prototype.a=function(){return 8+eR.prototype.a.call(this)};
51
+ rR.prototype.write=function(a){eR.prototype.write.call(this,a);_.U(a,0);aR(a,0);aR(a,1)};_.x(sR,rR);sR.prototype.a=function(){return 70+rR.prototype.a.call(this)};sR.prototype.write=function(a){rR.prototype.write.call(this,a);aR(a,0);aR(a,0);_.U(a,0);_.U(a,0);_.U(a,0);aR(a,this.width);aR(a,this.height);_.U(a,4718592);_.U(a,4718592);_.U(a,0);aR(a,1);ZQ(a,10);_.Hm(a,dR("AVC Coding",31));aR(a,this.depth);cR(a,-1)};_.x(tR,rR);tR.prototype.a=function(){return 20+rR.prototype.a.call(this)};
52
+ tR.prototype.write=function(a){rR.prototype.write.call(this,a);_.U(a,0);_.U(a,0);aR(a,this.channelCount);aR(a,this.sampleSize);cR(a,0);aR(a,0);aR(a,this.sampleRate);aR(a,0)};_.x(uR,sR);uR.prototype.write=function(a){sR.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(vR,uR);_.x(wR,tR);wR.prototype.write=function(a){tR.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.x(xR,wR);_.x(yR,eR);
53
+ yR.prototype.a=function(){for(var a=7,b=0;b<this.gb.length;b++)a+=2,a+=this.gb[b].byteLength;for(b=0;b<this.gb.length;b++)a+=2,a+=this.kc[b].byteLength;return a+eR.prototype.a.call(this)};
54
+ yR.prototype.write=function(a){eR.prototype.write.call(this,a);ZQ(a,this.version);ZQ(a,this.h);ZQ(a,this.j);ZQ(a,this.level);ZQ(a,255);ZQ(a,224|this.gb.length);for(var b=0;b<this.gb.length;b++)aR(a,this.gb[b].length),_.Hm(a,this.gb[b]);ZQ(a,this.kc.length);for(b=0;b<this.kc.length;b++)aR(a,this.kc[b].length),_.Hm(a,this.kc[b]);a.getPosition()};_.x(zR,Z);zR.prototype.a=function(){return 22+(this.$b.byteLength+3)+Z.prototype.a.call(this)};
55
+ zR.prototype.write=function(a){Z.prototype.write.call(this,a);ZQ(a,3);ZQ(a,23+this.$b.byteLength);aR(a,1);ZQ(a,0);ZQ(a,4);ZQ(a,15+this.$b.byteLength);ZQ(a,64);ZQ(a,21);$Q(a,0);_.U(a,0);_.U(a,0);ZQ(a,5);ZQ(a,this.$b.byteLength);_.Hm(a,this.$b);_.Hm(a,new Uint8Array([6,1,2]));a.getPosition()};_.x(AR,Z);AR.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};AR.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.Hm(a,dR(this.location));a.getPosition()};
56
+ _.x(BR,Z);BR.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)};BR.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(CR,eR);_.x(DR,Z);DR.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
+ DR.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(ER,Z);ER.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)};ER.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(FR,Z);
58
+ FR.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)};FR.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(GR,Z);GR.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
+ GR.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.x(HR,Z);HR.prototype.a=function(){return 8+Z.prototype.a.call(this)};HR.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,0);_.U(a,0);a.getPosition()};_.x(IR,Z);IR.prototype.a=function(){return 4+Z.prototype.a.call(this)};IR.prototype.write=function(a){Z.prototype.write.call(this,a);cR(a,0);aR(a,0);a.getPosition()};
60
+ _.x(JR,eR);_.x(KR,eR);_.x(LR,eR);_.x(MR,Z);MR.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};MR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?YQ(a,this.baseMediaDecodeTime):_.U(a,this.baseMediaDecodeTime);a.getPosition()};_.x(NR,Z);NR.prototype.a=function(){return 4+Z.prototype.a.call(this)};NR.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,this.h);a.getPosition()};_.x(OR,Z);
61
+ OR.prototype.a=function(){var a=4;this.flags&MS&&(a+=4);this.flags&NS&&(a+=4);for(var b=0;b<this.h;b++)this.flags&OS&&(a+=4),this.flags&PS&&(a+=4),this.flags&QS&&(a+=4),this.flags&RS&&(a+=4);return a+Z.prototype.a.call(this)};
62
+ OR.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,this.h);this.flags&MS&&(a.getPosition(),bR(a,this.l));this.flags&NS&&_.U(a,this.o);for(var b=0;b<this.h;b++)this.flags&OS&&_.U(a,this.w[b]),this.flags&PS&&_.U(a,this.sampleSize[b]),this.flags&QS&&_.U(a,this.C[b]),this.flags&RS&&(0===this.version?_.U(a,this.j[b]):bR(a,this.j[b]));a.getPosition()};var MS=1,NS=4,OS=256,PS=512,QS=1024,RS=2048;_.x(PR,Z);
63
+ PR.prototype.a=function(){var a=4;this.flags&SS&&(a+=8);this.flags&TS&&(a+=4);this.flags&US&&(a+=4);this.flags&VS&&(a+=4);this.flags&WS&&(a+=4);return a+Z.prototype.a.call(this)};PR.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,this.h);this.flags&SS&&YQ(a,this.j);this.flags&TS&&_.U(a,this.C);this.flags&US&&_.U(a,this.l);this.flags&VS&&_.U(a,this.w);this.flags&WS&&_.U(a,this.o);a.getPosition()};var SS=1,TS=2,US=8,VS=16,WS=32;_.x(QR,eR);_.x(RR,eR);_.x(SR,eR);
64
+ SR.prototype.a=function(){return this.h.byteLength+eR.prototype.a.call(this)};SR.prototype.write=function(a){eR.prototype.write.call(this,a);0<this.h.byteLength&&_.Hm(a,this.h)};_.x(TR,Z);TR.prototype.a=function(){var a=20;1===this.h&&0===this.j&&(a=a+1+this.l.length);return a+Z.prototype.a.call(this)};
65
+ TR.prototype.write=function(a){Z.prototype.write.call(this,a);ZQ(a,0);0===this.version?ZQ(a,0):ZQ(a,0);ZQ(a,this.h);ZQ(a,this.j);_.Hm(a,_.Aj(this.o));if(1===this.h&&0===this.j){ZQ(a,0);for(var b=0;b<this.l.length;b++)ZQ(a,this.l[b])}a.getPosition()};_.x(UR,Z);UR.prototype.a=function(){var a=8;this.flags&1&&(a+=dR(this.Ub).byteLength);return a+Z.prototype.a.call(this)};UR.prototype.write=function(a){Z.prototype.write.call(this,a);_.Hm(a,dR(this.h));_.U(a,this.j);this.flags&1&&_.Hm(a,dR(this.Ub));a.getPosition()};
66
+ _.x(VR,eR);VR.prototype.a=function(){return dR(this.h).byteLength+eR.prototype.a.call(this)};VR.prototype.write=function(a){eR.prototype.write.call(this,a);_.Hm(a,dR(this.h));a.getPosition()};_.x(WR,Z);WR.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
+ WR.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.U(a,0),_.U(a,0));_.U(a,1);for(var b=0;1>b;b++)0===this.version?_.U(a,this.offset[b]):YQ(a,this.offset[b]);a.getPosition()};_.x(YR,Z);YR.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.h&&(a+=this.l.length);return a+Z.prototype.a.call(this)};
68
+ YR.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.U(a,0),_.U(a,0));ZQ(a,this.h);_.U(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)ZQ(a,this.l[b]);a.getPosition()};_.x(ZR,Z);ZR.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].Rh.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].vd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
+ ZR.prototype.write=function(a){Z.prototype.write.call(this,a);_.U(a,this.j);this.flags&1&&ZQ(a,this.l);for(var b=0;b<this.j;b++)if(_.Hm(a,this.h[b].Rh),this.flags&2){aR(a,this.h[b].vd);for(var c=0;c<this.h[b].vd;c++)aR(a,this.h[b].wg[c].Rg),_.U(a,this.h[b].wg[c].Sg)}a.getPosition()};var fS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,gS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,hS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,iS=/^(\d*\.?\d*)f$/,jS=/^(\d*\.?\d*)t$/,kS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;oS.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};oS.prototype.write=function(){this.f=nS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var rS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.u=xS.prototype;_.u.configure=function(a){this.f=a};_.u.start=function(a,b){var c=this;this.B=b;var d=_.ch(new Set([a,$R(a)])).concat();return yS(this,d).then(function(e){return FS(c,e.data).then(function(){KS(c,c.A);return c.h})})};_.u.requestStop=function(){};_.u.stop=function(){this.B&&this.B.networkingEngine.cf(this.L);this.A=this.w=this.h=this.f=this.B=null;this.j&&(clearTimeout(this.j),this.j=null);this.J=!1;this.I=this.D=Infinity;return Promise.resolve()};
70
+ _.u.update=function(){var a=this;if(this.Hd())return yS(this,[this.l]).then(function(b){return FS(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.B)a.B.onError(b)})};_.u.setCurrentVariant=function(){};_.u.tb=function(){var a=this;this.g.debug(_.sB);this.B&&(this.j=null,this.update().then(function(){KS(a,a.A)})["catch"](function(b){a.B&&(a.B.onError(b),1===b.severity&&KS(a,100))}))};_.u.Hd=function(){return this.M===BS};_.u.Uf=function(){return 0<this.o.length};
71
+ _.u.Fh=function(a){var b=null;if(this.o.length)for(var c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b};
72
+ _.u.dn=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.w.timescale,c={isLive:this.Hd.bind(this),Pe:this.Uf.bind(this),fl:function(){return 1},Le:this.Fh.bind(this)},d=!1,e=new _.P(_.Q,3,4035,null),f=null;try{var g=this.G.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=tS(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 IS={video:_.Gg,audio:_.gd,text:_.Zc},wS=_.nc,BS="LIVE",JS={Dn:_.qd,Kn:_.ng};_.x(LS,_.Gs);LS.prototype.f=function(){_.Ft.ism=xS;_.Dt[_.$c]=xS};LS.prototype.a=function(){_.ZE("ism");_.$E(_.$c)};LS.prototype.id=function(){return _.eg};_.J("clpp.smooth.SmoothComponent",LS);};
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 by="No thumbnail found for position: ",cy="Position is out of range: ",dy="Thumbnail URL is mandatory",ey="Wrong gridSize format",fy="clpp.thumbnails",gy=function(){this.log=new _.K(fy);this.player=null;this.a=[];this.w=!1},iy=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Xe&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return hy(a,0,e,!!f)})},Promise.resolve())},hy=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return jy(a,d).then(function(){return a.a[b].load()}).then(function(){return hy(a,
3
- e,c,d)})},jy=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.op)c();else a.player.one(_.ld,function(){c()})})},ky=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.oa=p;this.Uj=h;this.Cm=l;this.Nk=m;this.Ok=n;this.Bf=null},ly=function(){gy.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},my=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Td=new _.Oj},ny=function(){this.g=new _.K(fy);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Oj},oy=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Td.resolve()})},qy=function(a,b){return py(a,b).then(function(c){return new ky(c,b.time,b.duration)})},py=function(a,b){return b.load().then(function(){var c=_.lj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.vj(c)})},ry=function(){gy.call(this);this.f=null},sy=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},ty=function(){gy.apply(this,arguments)},uy=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Jd:c,jg:d,mh:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},vy=function(){this.g=new _.K(fy);this.a=this.m=null},wy=function(a){return a.some(function(b){return 0<
6
- b.thumbStreams.length})},By=function(a){return a?a===xy||a===yy?new ly:a===zy?new ry:a===Ay?new ny:null:null},Cy=function(a){if(!a)return null;a=new _.qk(a);return a.path.match(/.*\.vtt$/i)?zy:a.path.match(/.*\.bif$/i)?Ay:a.path.match(/.*\.(png|jpg|jpeg)$/i)?xy:null},Dy=function(){};gy.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Of,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&iy(c,b.preload)})};ky.prototype.raw=function(){return this.oa.cloneNode(!1)};
7
- ky.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(_.ae);e.style.width=c+_.Lf;e.style.height=d+_.Lf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.oa.naturalWidth||this.oa.width))+"px "+Math.ceil(d/
8
- this.height*(this.oa.naturalHeight||this.oa.height))+_.Lf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Lf;e.style.backgroundPositionY="-"+f*d+_.Lf;return e};
9
- ky.prototype.load=function(){var a=this;this.Bf||(this.Bf=new Promise(function(b,c){function d(){a.width||(a.width=(a.oa.naturalWidth||a.oa.width)/a.Uj);a.height||(a.height=(a.oa.naturalHeight||a.oa.height)/a.Cm);a.x||(a.x=a.width*a.Nk);a.y||(a.y=a.height*a.Ok)}if(a.oa.src&&a.oa.complete)d(),b(a);else{var e=null,f=function(){d();a.oa.removeEventListener("load",f);a.oa.removeEventListener(_.re,e);b(a)};e=function(g){a.oa.removeEventListener("load",f);a.oa.removeEventListener(_.re,e);c(new _.P(1,9,
10
- 2014,"Failed to load thumbnail.",g))};a.oa.addEventListener("load",f);a.oa.addEventListener(_.re,e);a.oa.src=a.src}}));return this.Bf};_.H("clpp.thumbnails.Thumbnail",ky);ky.prototype.load=ky.prototype.load;ky.prototype.element=ky.prototype.element;ky.prototype.raw=ky.prototype.raw;_.w(ly,gy);
11
- ly.prototype.init=function(a,b){if(!b||!b.url)throw new _.P(1,9,7100,dy);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,ey);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
- new _.P(1,9,7100,ey);}gy.prototype.init.call(this,a,b)};ly.prototype.get=function(a){var b=this,c,d,e,f;return _.E(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.P(1,9,2014,cy+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 _.x(g,f.load(),2)}return g["return"](f)})};
13
- ly.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 ky(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()};my.prototype.load=function(){return this.Td};
14
- ny.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,dy);var d=b.url,e=_.Jj(d);e.type=_.Ij;a.getNetworkEngine().fetch(e).P.then(function(f){f=f.data;var g=_.lj(c.f);f=_.lj(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=_.lj(l);n=String.fromCharCode.apply(null,
15
- Ey);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 my(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
- oy(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))})};ny.prototype.get=function(a){var b=this,c,d;return _.E(function(e){switch(e.a){case 1:if(0>a)throw new _.P(1,9,2014,cy+a);return _.x(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,by+a);return _.x(e,qy(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
17
- ny.prototype.Hd=function(){return 0<this.a.length};var Ey=[137,66,73,70,13,10,26,10];_.w(ry,gy);
18
- ry.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,dy);var d=b.url,e=_.Jj(d);e.type=_.Ij;this.f=a.getNetworkEngine().fetch(e).P.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.aa(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=sy(l[0]);l=sy(l[1])-u;c.a.push(new ky(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))});gy.prototype.init.call(this,a,b)};
20
- ry.prototype.get=function(a){var b=this,c;return _.E(function(d){if(1==d.a){if(0>a)throw new _.P(1,9,2014,cy+a);return _.x(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,by+a);return _.x(d,c.load(),3)}return d["return"](c)})};ry.prototype.l=function(){return this.f};_.w(ty,gy);
21
- ty.prototype.get=function(a){function b(){return new _.P(1,9,2014,by+a)}var c=this,d,e,f,g,h,l,m,n,p,q,u,v,z;return _.E(function(B){if(1==B.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.P(1,9,2014,cy+a);d=c.player.getPeriods();for(var I=null,F=_.t(d),D=F.next();!D.done;D=F.next())D=D.value,D.startTime<=a&&(I=D);e=I;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 B.F(2);l=uy(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.mh+m])):(q=h.Qa())&&0<q.length&&(v=u=0,z=h.startTime,1<l.mh&&(u=m%l.Jd,v=Math.floor(m/l.Jd),z+=m*l.durationPerTile),n=new ky(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Jd,l.jg,
23
- u,v));return n?_.x(B,n.load(),4):B.F(2)}if(2!=B.a)return B["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};ty.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- ty.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.t(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&&!_.O.R(d=b.getSegmentReference(c++));)for(var e=uy(d,b),f=d.Qa()[0],g=new Image,h=d.startTime,l=0;l<e.jg;++l)for(var m=0;m<e.Jd;++m)this.a.push(new ky(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Jd,e.jg,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=vy.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
25
- _.r.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=Cy(c.url||null));(this.a=By(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Ke,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
- _.r.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(wy(d)){this.a=new ty;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.r.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.P(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.H("clpp.thumbnails.ThumbnailsPlugin",vy);vy.prototype.get=vy.prototype.get;vy.Id="thumbnails";
27
- Dy.prototype.create=function(){return new vy};_.Vq(new Dy);var xy="SINGLE",yy="GRID",zy="WEBVTT",Ay="BIF";};
2
+ var f=function(window){var fy="No thumbnail found for position: ",gy="Position is out of range: ",hy="Thumbnail URL is mandatory",iy="Wrong gridSize format",jy="clpp.thumbnails",ky=function(){this.log=new _.K(jy);this.player=null;this.a=[];this.w=!1},my=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Ye&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return ly(a,0,e,!!f)})},Promise.resolve())},ly=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return ny(a,d).then(function(){return a.a[b].load()}).then(function(){return ly(a,
3
+ e,c,d)})},ny=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.sp)c();else a.player.one(_.md,function(){c()})})},oy=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.wa=p;this.Dk=h;this.en=l;this.vl=m;this.wl=n;this.Wf=null},py=function(){ky.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},qy=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.he=new _.Qj},ry=function(){this.g=new _.K(jy);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Qj},sy=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.he.resolve()})},uy=function(a,b){return ty(a,b).then(function(c){return new oy(c,b.time,b.duration)})},ty=function(a,b){return b.load().then(function(){var c=_.nj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.xj(c)})},vy=function(){ky.call(this);this.f=null},wy=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},xy=function(){ky.apply(this,arguments)},yy=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Wd:c,Fg:d,Qh:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},zy=function(){this.g=new _.K(jy);this.a=this.m=null},Ay=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},Fy=function(a){return a?a===By||a===Cy?new py:a===Dy?new vy:a===Ey?new ry:null:null},Gy=function(a){if(!a)return null;a=new _.sk(a);return a.path.match(/.*\.vtt$/i)?Dy:a.path.match(/.*\.bif$/i)?Ey:a.path.match(/.*\.(png|jpg|jpeg)$/i)?By:null},Hy=function(){};ky.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Nf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&my(c,b.preload)})};oy.prototype.raw=function(){return this.wa.cloneNode(!1)};
7
+ oy.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(_.ae);e.style.width=c+_.Kf;e.style.height=d+_.Kf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.wa.naturalWidth||this.wa.width))+"px "+Math.ceil(d/
8
+ this.height*(this.wa.naturalHeight||this.wa.height))+_.Kf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Kf;e.style.backgroundPositionY="-"+f*d+_.Kf;return e};
9
+ oy.prototype.load=function(){var a=this;this.Wf||(this.Wf=new Promise(function(b,c){function d(){a.width||(a.width=(a.wa.naturalWidth||a.wa.width)/a.Dk);a.height||(a.height=(a.wa.naturalHeight||a.wa.height)/a.en);a.x||(a.x=a.width*a.vl);a.y||(a.y=a.height*a.wl)}if(a.wa.src&&a.wa.complete)d(),b(a);else{var e=null,f=function(){d();a.wa.removeEventListener("load",f);a.wa.removeEventListener(_.se,e);b(a)};e=function(g){a.wa.removeEventListener("load",f);a.wa.removeEventListener(_.se,e);c(new _.P(1,9,
10
+ 2014,"Failed to load thumbnail.",g))};a.wa.addEventListener("load",f);a.wa.addEventListener(_.se,e);a.wa.src=a.src}}));return this.Wf};_.J("clpp.thumbnails.Thumbnail",oy);oy.prototype.load=oy.prototype.load;oy.prototype.element=oy.prototype.element;oy.prototype.raw=oy.prototype.raw;_.x(py,ky);
11
+ py.prototype.init=function(a,b){if(!b||!b.url)throw new _.P(1,9,7100,hy);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,iy);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
+ new _.P(1,9,7100,iy);}ky.prototype.init.call(this,a,b)};py.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,gy+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
+ py.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 oy(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()};qy.prototype.load=function(){return this.he};
14
+ ry.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,hy);var d=b.url,e=_.Lj(d);e.type=_.Kj;a.getNetworkEngine().fetch(e).N.then(function(f){f=f.data;var g=_.nj(c.f);f=_.nj(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=_.nj(l);n=String.fromCharCode.apply(null,
15
+ Iy);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 qy(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
+ sy(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))})};ry.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,gy+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,fy+a);return _.y(e,uy(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
17
+ ry.prototype.Vd=function(){return 0<this.a.length};var Iy=[137,66,73,70,13,10,26,10];_.x(vy,ky);
18
+ vy.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,hy);var d=b.url,e=_.Lj(d);e.type=_.Kj;this.f=a.getNetworkEngine().fetch(e).N.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.S.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=wy(l[0]);l=wy(l[1])-t;c.a.push(new oy(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 _.P(1,9,2013,"Error while loading VTT thumbnails.",f))});ky.prototype.init.call(this,a,b)};
20
+ vy.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,gy+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,fy+a);return _.y(d,c.load(),3)}return d["return"](c)})};vy.prototype.l=function(){return this.f};_.x(xy,ky);
21
+ xy.prototype.get=function(a){function b(){return new _.P(1,9,2014,fy+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.I(function(B){if(1==B.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.P(1,9,2014,gy+a);d=c.player.getPeriods();for(var F=null,G=_.w(d),A=G.next();!A.done;A=G.next())A=A.value,A.startTime<=a&&(F=A);e=F;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 B.F(2);l=yy(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.Qh+m])):(q=h.Sa())&&0<q.length&&(v=t=0,z=h.startTime,1<l.Qh&&(t=m%l.Wd,v=Math.floor(m/l.Wd),z+=m*l.durationPerTile),n=new oy(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Wd,l.Fg,
23
+ t,v));return n?_.y(B,n.load(),4):B.F(2)}if(2!=B.a)return B["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};xy.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ xy.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&&!_.O.S(d=b.getSegmentReference(c++));)for(var e=yy(d,b),f=d.Sa()[0],g=new Image,h=d.startTime,l=0;l<e.Fg;++l)for(var m=0;m<e.Wd;++m)this.a.push(new oy(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Wd,e.Fg,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.u=zy.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=Gy(c.url||null));(this.a=Fy(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Ke,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(Ay(d)){this.a=new xy;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 _.P(1,9,2014,"Thumbnail format is not supported"))};_.u.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",zy);zy.prototype.get=zy.prototype.get;zy.Id="thumbnails";
27
+ Hy.prototype.create=function(){return new zy};_.Zq(new Hy);var By="SINGLE",Cy="GRID",Dy="WEBVTT",Ey="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));}