@castlabs/prestoplay 6.13.0 → 6.14.1

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 (62) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -6
  5. package/cjs/cl.cast.js +111 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +528 -518
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +60 -58
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -67
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +265 -274
  17. package/cjs/cl.muxdata.js +15 -14
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +71 -71
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +70 -70
  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 +88 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +441 -431
  37. package/cl.crypto.js +8 -8
  38. package/cl.dash.js +68 -68
  39. package/cl.externs.js +60 -58
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -69
  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 +236 -239
  46. package/cl.muxdata.js +13 -12
  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 +14 -14
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/clpp.styles.css +2 -0
  61. package/package.json +4 -4
  62. package/typings.d.ts +93 -50
package/cjs/cl.smooth.js CHANGED
@@ -1,75 +1,75 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var rL="Full MP4 box must have flags defined",sL="clpp.smooth.SmoothMP4Processor",tL="codecPrivateData",uL=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)},vL=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.bm()}},wL=function(a,b){vL(a,b>>16&255);vL(a,b>>8&255);vL(a,b&255)},xL=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.bm()}},yL=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.bm()}},zL=function(a,b){try{a.f.setInt16(a.a,
3
- b,a.h),a.a+=2}catch(c){_.bm()}},AL=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},BL=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){BL.call(this,a);this.version=b;this.flags=c},CL=function(a,b,c){BL.call(this,a);this.h=b;this.offset=c},DL=function(a,b,c,
4
- d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},EL=function(a,b,c){BL.call(this,"ftyp");this.j=a;this.gh=b;this.h=c},FL=function(){BL.call(this,_.Oe)},GL=function(){BL.call(this,_.fg)},HL=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]},IL=function(){BL.call(this,"mvex")},JL=function(a){Z.call(this,"trex",0,0);this.h=a},KL=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]},LL=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},ML=function(a){Z.call(this,"hdlr",0,0);this.h=a},NL=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},OL=function(a){BL.call(this,a);this.A=!0},PL=function(a){OL.call(this,a);this.height=this.width=0;this.depth=24},QL=
6
- function(a,b,c,d){OL.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},RL=function(a,b){PL.call(this,"avc1");this.width=a;this.height=b},SL=function(a,b){RL.call(this,a,b);this.type="encv"},TL=function(a,b,c){QL.call(this,"mp4a",a,b,c)},UL=function(a,b,c){TL.call(this,a,b,c);this.type="enca"},VL=function(a,b){BL.call(this,"avcC");this.Ua=a;this.$b=b;this.version=1;this.h=this.Ua[0][1];this.j=this.Ua[0][2];this.level=this.Ua[0][3]},WL=function(a){Z.call(this,"esds",0,0);this.Ob=
7
- a},XL=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},YL=function(){Z.call(this,"dref",0,0)},ZL=function(){BL.call(this,_.Vf)},$L=function(){Z.call(this,_.Xf,0,0)},aM=function(){Z.call(this,"stts",0,0)},bM=function(){Z.call(this,"stsc",0,0)},cM=function(){Z.call(this,"stco",0,0)},dM=function(){Z.call(this,"stsz",0,0)},eM=function(){Z.call(this,"smhd",0,0)},fM=function(){BL.call(this,"dinf")},gM=function(){BL.call(this,_.Ne)},hM=function(){BL.call(this,_.Je)},iM=function(a,b){Z.call(this,
8
- "tfdt",a,0);this.h=b},jM=function(){Z.call(this,"mfhd",0,0);this.h=0},kM=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},lM=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},mM=function(){BL.call(this,"traf")},nM=function(){BL.call(this,"moof")},oM=function(){BL.call(this,_.Ie);this.h=new Uint8Array(0)},pM=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},qM=function(a,b){Z.call(this,
9
- "schm",0,0);this.h=a;this.j=b;this.Jb=""},rM=function(a){BL.call(this,"frma");this.h=a},sM=function(){Z.call(this,"saio",0,0);this.offset=[0]},tM=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},uM=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},vM=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},wM=function(a,b,c,d){c=b.Ig[c];b=b.zm;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
10
- String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.Bi([a],[b])[0]},xM=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.sg?c=["maxWidth","maxHeight","bitrate",tL,"fourCC"]:a.type===_.$c&&(c=["bitrate",tL,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.ra(a,b,c,["id","segmentIndex"])},yM=function(a,b,c){var d=c.ce.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ua:null,$b:null,width:NaN,height:NaN,Ob:null,Md:NaN,
11
- sampleSize:NaN,channelCount:NaN};switch(c.type){case _.sg:a.Ua=[_.gj(d[1])];a.$b=[_.gj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.$c:a.Ob=_.gj(c.ce),a.sampleSize=c.ji||16,a.Md=c.Md,a.channelCount=c.gg}return a},zM=function(a,b){return a.filter(function(c){return c.type===b})},AM=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)},HM=function(a,b,c){var d=null;if(BM.test(a)){a=BM.exec(a);d=
12
- 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 CM.test(a)?d=AM(CM,a):DM.test(a)?d=AM(DM,a):EM.test(a)?(a=EM.exec(a),d=Number(a[1])/c.frameRate):FM.test(a)?(a=FM.exec(a),d=Number(a[1])/c.a):GM.test(a)&&(d=AM(GM,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*d);return b+":"+c+":"+a+"."+d},IM=function(a,
13
- 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))},KM=function(a){this.a=a;this.f=JM(this)},JM=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.am(b)},LM=function(a,b,c){a:{var d=_.u([_.Rd,_.Pd]);for(var e=d.next();!e.done;e=d.next())if((e=c.je(e.value))&&e.keyId){d=e.keyId;break a}_.J(sL,"Could not get default Key ID for DRM init data!");
14
- d=null}c=new BL("xxxx");a.type===_.sg?c=new SL(a.width,a.height):c=new UL(a.channelCount,a.sampleSize,a.Md);a=new pM;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new BL("schi")).append([a]);b=(new BL(_.Qf)).append([new rM(b),new qM(_.rd,65536),a]);c.append([b]);return c},MM=function(a,b){var c=b.pe(),d=new HL(a.timescale,a.duration,a.id),e=(new IL).append([new JL(a.id)]),f=new KL(a.id,a.duration,a.timescale,a.width,a.height),g=new LL(a.timescale,a.duration),h=new ML(a.type),l=null,m=new YL;
15
- m.entries=[new XL];var n=new $L;switch(a.type){case _.sg:var p=new VL(a.Ua,a.$b);c?(l=LM(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new RL(a.width,a.height)).append([p]),n.entries=[l]);l=new NL;break;case _.$c:p=new WL(a.Ob),c?(l=LM(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new TL(a.channelCount,a.sampleSize,a.Md)).append([p]),n.entries=[l]),l=new eM}n=(new ZL).append([n,new aM,new bM,new dM,new cM]);m=(new fM).append([m]);m=(new gM).append([l,m,n]);g=(new hM).append([g,h,m]);f=(new GL).append([f,
16
- g]);d=(new FL).append([d,f,e]);e=new EL("dash",0,["iso6","mp41","avc1"]);c&&(c=b.je(_.Pd),f=b.je(_.Rd),c&&d.append([new CL("pssh",c.initData,8)]),f&&d.append([new CL("pssh",f.initData,8)]),c||f||_.J(sL,"Could not get PSSH init data!"));c=new KM([e,d]);return _.Ui(c.write())},OM=function(a,b){var c,d,e,f,g,h;(new _.mm).L("moof",_.nm).Y("mfhd",function(m){var n=new jM;n.h=_.W(m.reader);c=n}).L("traf",_.nm).Y("tfhd",function(m){var n=m.reader.Ga();if(null===m.flags)throw new _.P(_.Q,3,3019,rL);var p=
17
- new lM(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.jm(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.Ga();if(null===m.flags)throw new _.P(_.Q,3,3019,rL);var p=new kM(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-
18
- m.reader.getPosition()&&m.flags&1&&(p.l=_.im(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(_.im(m.reader)));e=p}).Y("sdtp",function(m){var n=_.lm(m.reader,m.reader.Ga());f=new DL("sdtp",m.version||0,m.flags||0,n,0)}).L("uuid",function(m){var n=_.lm(m.reader,
19
- 16);if(_.ij(n,NM)){n=_.W(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new uM(m.version,m.flags);n.j=_.W(m.reader);m.flags&1&&(n.l=_.gm(m.reader));for(var p=0;p<n.j;p++){var q={Wg:_.lm(m.reader,8),ed:0,Pf:[]};if(m.flags&2){q.ed=_.hm(m.reader);for(var t=0;t<q.ed;t++){var v={eg:0,fg:0};v.eg=_.hm(m.reader);v.fg=_.W(m.reader);q.Pf.push(v)}}n.h.push(q)}g=n}}).L(_.Ie,function(m){var n=new oM;0<m.reader.Ga()?n.h=_.lm(m.reader,m.reader.Ga()):(_.J(sL,"mdat box is empty!"),n.h=new Uint8Array(0));h=n}).parse(a,
20
- !1);if(!h)return null;var l=(new mM).append([d,e]);f&&l.append([f]);b.pe()&&g&&l.append([g]);l=(new nM).append([c,l]);return new KM([l,h])},PM=function(a,b,c,d){var e=d.pe(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=OM(b,d);if(null===g)return a.request.contentType===_.bg?a.data:g;d=g.get(_.Ie);if(a.request.contentType===_.bg){e=d.h.buffer;if(c){e=_.R.xd(e);if((e=(new DOMParser).parseFromString(e,_.dg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new IM(h.getAttribute("ttp:frameRate"),
21
- 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",_.le],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 D=q[v].name;if(D=D.match(t)){p=p.getAttribute(D[0]);break b}}p=null}}f.setAttribute(l[m],HM(p||
22
- "",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.Va(e).buffer}else c=e;return c}h=new nM;a=g.get("mfhd");b=new mM;l=g.get("tfhd");m=new iM(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].ed);else g=8;b.append([c,new sM,new tM(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new KM([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=
23
- c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},QM=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},RM=function(a,b,c){a=_.on(a);c&&a.version!==c&&(a=_.wz(a,c));return{initData:_.uz(a),initDataType:_.rd,keyId:b,periodId:null}},TM=function(){this.w=this.h=this.f=this.C=null;this.M=1;this.T=0;this.l="";this.B=this.a=null;this.g=
24
- new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.P=SM;this.H=0;this.D=this.I=Infinity;this.o=[];this.K=this.cm.bind(this);this.G=new Map},UM=function(a,b){var c,d,e;return _.E(function(f){if(1==f.a)return c=_.rj(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,c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.C.networkingEngine.fetch(c),
25
- _.x(f,d.O,2);e=f.f;a.l=e.uri;return f["return"](e)})},aN=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.R.xd(b);var f=d.parseFromString(e.trim(),_.dg)}catch(gF){throw gF;}if(f&&f.documentElement.tagName==_.ac)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(gF){}if(!c)throw a.g.error("Unable to parse manifest"),new _.P(_.Q,4,4033,a.l);var h=+VM(a,c,"MajorVersion"),l=+VM(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+VM(a,c,"Duration"),
26
- p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),t=+c.getAttribute("DVRWindowLength")||Infinity,v=_.$m(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?(WM(a,XM),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):WM(a,SM);a.a={startTime:0,delay:0,duration:n/m,$e:t/m,Fd:0};if(v){var z=a.f.playreadyVersion,D=[],G=_.$m(v,"ProtectionHeader")[0],
27
- F=_.fj(_.bn(G)||""),B=_.on(F).a;D.push(QM(_.Rd,{initData:_.uz(_.gn(B)),initDataType:_.rd,keyId:B,periodId:null},[B]));D.push(QM(_.Pd,RM(F,B,z),[B]));a.o=D}var I=[],O=_.$m(c,"StreamIndex");if(!O.length)throw a.g.error("No streams found!"),new _.P(_.Q,4,4034,a.l);for(var M=0;M<O.length;M++){for(var aa,oa=a,pa=O[M],Ja=VM(oa,pa,"Type"),Ma=+pa.getAttribute("Chunks"),xa=pa.getAttribute("Subtype"),qa=pa.getAttribute("Language")||_.hg,Fa=_.Ni(qa),nb=pa.getAttribute("Name")||"",ic=+pa.getAttribute(_.xb),Kb=
28
- +pa.getAttribute(_.wb),ye=VM(oa,pa,"Url"),Ks=+pa.getAttribute("TimeScale")||null,Mc=[],Em=_.$m(pa,_.Ob),tt=0;tt<Em.length;tt++){var rf=void 0,kc=void 0,ut=void 0,sf=oa,qd=Em[tt],vt=Ja,JQ=+qd.getAttribute("Index"),KQ=+VM(sf,qd,"Bitrate"),jF=NaN,kF=NaN,yn=NaN,wt=NaN,lF=NaN,mF=NaN,nF=NaN,oF=qd.getAttribute("FourCC");switch(vt){case _.sg:jF=+VM(sf,qd,_.wb);kF=+VM(sf,qd,_.xb);break;case _.$c:wt=+qd.getAttribute("Channels")||2,yn=+VM(sf,qd,"SamplingRate"),mF=+VM(sf,qd,"AudioTag"),lF=+VM(sf,qd,"BitsPerSample"),
29
- nF=+VM(sf,qd,"PacketSize")}var xt=String(qd.getAttribute("CodecPrivateData"));if(vt===_.$c&&!xt){var pF=wt,qF={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},zn=qF[yn];if("AACH"===oF){kc=new Uint8Array(4);var rF=qF[2*yn];kc[0]=40|zn>>1;kc[1]=zn<<7|pF<<3|rF>>1;kc[2]=rF<<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)+rf[1].toString(16)}else kc=new Uint8Array(2),kc[0]=16|zn>>1,kc[1]=zn<<7|pF<<3,
30
- rf=new Uint16Array(1),rf[0]=(kc[0]<<8)+kc[1],ut=rf[0].toString(16);xt=ut.toUpperCase()}var LQ={id:sf.T++,type:vt,index:JQ,bitrate:KQ,ce:xt,maxHeight:jF,maxWidth:kF,Md:yn,gg:wt,Tm:mF,ji:lF,jn:nF,Vj:oF,segmentIndex:null};Mc.push(LQ)}aa=Mc;for(var Ce=[],sF=_.$m(pa,"c"),Lj=0;Lj<sF.length;Lj++){var yt=sF[Lj],Od=parseInt(yt.getAttribute("t"),10),Ch=parseInt(yt.getAttribute("d"),10),zt=parseInt(yt.getAttribute("r"),10),Mj=0;if(isNaN(Od)&&isNaN(Ch))throw oa.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
31
- new _.P(_.Q,4,4037,oa.l);0===Lj&&isNaN(Od)&&(Mj=Od=0);if(0<Lj){var og=Ce[Ce.length-1];Mj=og.n+1;og.d||(og.d=Od-og.t);Od||(Od=og.t+og.d);Ch||(Ch=Od-og.t)}Ce.push({n:Mj,d:Ch,t:Od});if(zt){zt--;for(var tF=0;tF<zt;tF++){var An=Ce[Ce.length-1];Mj=An.n+1;Od=An.t+An.d;Ch=An.d;Ce.push({n:Mj,d:Ch,t:Od})}}}oa.pd()||Ce.length===Ma||oa.g.warn("Number of fragments ("+Ma+") differs from number of chunks ("+Ce.length+").");I.push({type:Ja,Xm:Ma,om:xa,language:Fa,Ed:qa,name:nb,maxWidth:ic,maxHeight:Kb,zm:ye,tracks:aa,
32
- Ig:Ce,timescale:Ks})}var tf={gn:h,gh:l,timescale:m,duration:n,isLive:p,fn:q,$e:t,jf:!1,streams:I};if(a.h&&a.w)return YM(a,tf),Promise.resolve();a.G.clear();var At=tf.timescale,Bt=tf.duration,NQ=zM(tf.streams,_.$c),OQ=zM(tf.streams,_.sg),PQ=zM(tf.streams,_.bg),uF=[],Bn=ZM(a,Bt,At,NQ),Cn=ZM(a,Bt,At,OQ),QQ=ZM(a,Bt,At,PQ);Bn.length||(Bn=[null]);Cn.length||(Cn=[null]);for(var Dt=0;Dt<Cn.length;Dt++)for(var Et=0;Et<Bn.length;Et++)uF.push($M(a,Cn[Dt],Bn[Et]));var vF={startTime:0,variants:uF,textStreams:QQ,
33
- thumbStreams:[]};var SQ=tf.streams,Ft=a.a.startTime,wF=a.a.delay,Gt=a.I,xF=Math.min(a.a.duration||Infinity,Gt),Ht=a.pd(),TQ=a.a.$e,UQ=a.a.Fd,yF=a.H,zF=isFinite(a.D)?a.D:0;if(Ht)xF=Infinity,Ft=Date.now()/1E3-UQ,a.a.startTime=Ft,wF=3*yF;else for(var VQ=isFinite(Gt)?Gt:a.a.duration,AF=_.u(SQ),It=AF.next();!It.done;It=AF.next())for(var BF=_.u(It.value.tracks),Jt=BF.next();!Jt.done;Jt=BF.next()){var CF=Jt.value;CF.segmentIndex.offset(-zF);_.aA(CF.segmentIndex,VQ)}a.B=new _.gA(Ft,wF,!Ht,!0);a.B.f=xF;_.lA(a.B,
34
- yF);a.B.w=TQ;Ht||a.B.offset(-zF);a.C.filterAllPeriods([vF]);a.h={presentationTimeline:a.B,periods:[vF],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.J||(a.C.networkingEngine.hd(a.K),a.J=!0);a.w=tf;return Promise.resolve()},YM=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.u(a.w.streams[c].tracks),g=f.next();!g.done;e={Nb:e.Nb},g=f.next())if(e.Nb=g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.Nb.type&&m.bitrate===l.Nb.bitrate}}(e))){xM(e.Nb,
35
- g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=bN(a,a.w.timescale,d,g);g=e.Nb.segmentIndex;g.na(h);(h=a.a.$e)&&_.xA(g,_.wA(g)-h).forEach(function(l){l.Ra().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."))},ZM=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=
36
- d[h.Fc],n=bN(a,c,m,l);n=new _.vA(n);var p=null;m.type!==_.bg&&(p=cN(a,b,c,m,l));l.segmentIndex=n;var q=a.M++,t=Promise.resolve.bind(Promise),v=n.Nc.bind(n),z=n.get.bind(n),D=n.jd.bind(n),G=n.getDuration.bind(n),F=dN[m.type],B="";switch(m.type){case _.sg:B=l.ce;var I=/00000001[0-9]7/.exec(B);B="avc1."+(I&&I[0]?B.substr(B.indexOf(I[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.$c:B=l.ce,I=2,"AACH"===l.Vj?I=5:B&&(I=(parseInt(B.substr(0,2),16)&248)>>3),B="mp4a.40."+I,a.g.debug("AUDIO CODECS: ",
37
- B)}I=m.type===_.bg?eN[m.om]:void 0;return{id:q,originalId:null,ln:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:D,getDuration:G,segmentIndex:n,segmentLookupStrategy:_.ez,initSegmentReference:p,mimeType:F,codecs:B,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:I,encrypted:a.lf(),keyId:null,language:m.language,originalLanguage:m.Ed,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,
38
- roles:[],channelsCount:l.gg||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},bN=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Ig.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=wM(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.Li(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.G.set(q,n);e+=m});if(c.type===_.sg||c.type===_.$c)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Fd?a.a.Fd=b.endTime:a.a.Fd=Math.min(a.a.Fd,
39
- b.endTime);return f},cN=function(a,b,c,d,e){b=yM(b,d.timescale||c,e);c={isLive:a.pd.bind(a),pe:a.lf.bind(a),bk:function(){return 1},je:a.Kg.bind(a)};d=new Uint8Array(0);try{d=MM(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,"+_.ej(d);return new _.Ez(function(){return[f]},0,null,null,!0)},$M=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.hg;return c||b?{id:a.M++,language:e,primary:!1,audio:c,
40
- video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},VM=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);},fN=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Hb.bind(a),b))},WM=function(a,b){var c=b===SM;if(a.h&&a.h.presentationTimeline){var d=a.h.presentationTimeline;d.j=c;d.l=c}c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.P=b},gN=function(){};
41
- BL.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};BL.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};BL.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};
42
- BL.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);_.cm(a,AL(this.type));this.size>b&&uL(a,this.size);"uuid"===this.type&&_.cm(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,BL);Z.prototype.a=function(){return 4+BL.prototype.a.call(this)};Z.prototype.write=function(a){BL.prototype.write.call(this,a);vL(a,this.version);wL(a,this.flags)};
43
- _.w(CL,BL);CL.prototype.a=function(){return this.h.byteLength+BL.prototype.a.call(this)-this.offset};CL.prototype.write=function(a){BL.prototype.write.call(this,a);_.cm(a,this.h,this.offset);a.getPosition()};_.w(DL,Z);DL.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};DL.prototype.write=function(a){Z.prototype.write.call(this,a);_.cm(a,this.h,this.offset);a.getPosition()};_.w(EL,BL);
44
- EL.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+BL.prototype.a.call(this)};EL.prototype.write=function(a){BL.prototype.write.call(this,a);_.cm(a,AL(this.j));_.V(a,this.gh);_.cm(a,AL(this.h.join("")));a.getPosition()};_.w(FL,BL);_.w(GL,BL);_.w(HL,Z);HL.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)};
45
- HL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(uL(a,0),uL(a,0),_.V(a,this.timescale),uL(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);xL(a,this.volume);xL(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.h.length;b++)vL(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(IL,BL);_.w(JL,Z);JL.prototype.a=function(){return 20+Z.prototype.a.call(this)};
46
- JL.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(KL,Z);KL.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)};
47
- KL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(uL(a,0),uL(a,0),_.V(a,this.j),_.V(a,0),uL(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);xL(a,0);xL(a,0);xL(a,this.volume);xL(a,0);for(var b=0;b<this.h.length;b++)vL(a,this.h[b]);xL(a,this.width);xL(a,0);xL(a,this.height);xL(a,0);a.getPosition()};_.w(LL,Z);LL.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
48
- LL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(uL(a,0),uL(a,0),_.V(a,this.timescale),uL(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));xL(a,this.language);xL(a,0);a.getPosition()};_.w(ML,Z);ML.prototype.a=function(){return 33+Z.prototype.a.call(this)};
49
- ML.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.h===_.sg?_.cm(a,AL("vide")):_.cm(a,AL("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.h===_.sg?_.cm(a,AL("VideoHandler\x00")):_.cm(a,AL("SoundHandler\x00"));a.getPosition()};_.w(NL,Z);NL.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};NL.prototype.write=function(a){Z.prototype.write.call(this,a);xL(a,0);_.cm(a,this.h);a.getPosition()};_.w(OL,BL);OL.prototype.a=function(){return 8+BL.prototype.a.call(this)};
50
- OL.prototype.write=function(a){BL.prototype.write.call(this,a);_.V(a,0);xL(a,0);xL(a,1)};_.w(PL,OL);PL.prototype.a=function(){return 70+OL.prototype.a.call(this)};PL.prototype.write=function(a){OL.prototype.write.call(this,a);xL(a,0);xL(a,0);_.V(a,0);_.V(a,0);_.V(a,0);xL(a,this.width);xL(a,this.height);_.V(a,4718592);_.V(a,4718592);_.V(a,0);xL(a,1);vL(a,10);_.cm(a,AL("AVC Coding",31));xL(a,this.depth);zL(a,-1)};_.w(QL,OL);QL.prototype.a=function(){return 20+OL.prototype.a.call(this)};
51
- QL.prototype.write=function(a){OL.prototype.write.call(this,a);_.V(a,0);_.V(a,0);xL(a,this.channelCount);xL(a,this.sampleSize);zL(a,0);xL(a,0);xL(a,this.sampleRate);xL(a,0)};_.w(RL,PL);RL.prototype.write=function(a){PL.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(SL,RL);_.w(TL,QL);TL.prototype.write=function(a){QL.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(UL,TL);_.w(VL,BL);
52
- VL.prototype.a=function(){for(var a=7,b=0;b<this.Ua.length;b++)a+=2,a+=this.Ua[b].byteLength;for(b=0;b<this.Ua.length;b++)a+=2,a+=this.$b[b].byteLength;return a+BL.prototype.a.call(this)};
53
- VL.prototype.write=function(a){BL.prototype.write.call(this,a);vL(a,this.version);vL(a,this.h);vL(a,this.j);vL(a,this.level);vL(a,255);vL(a,224|this.Ua.length);for(var b=0;b<this.Ua.length;b++)xL(a,this.Ua[b].length),_.cm(a,this.Ua[b]);vL(a,this.$b.length);for(b=0;b<this.$b.length;b++)xL(a,this.$b[b].length),_.cm(a,this.$b[b]);a.getPosition()};_.w(WL,Z);WL.prototype.a=function(){return 22+(this.Ob.byteLength+3)+Z.prototype.a.call(this)};
54
- WL.prototype.write=function(a){Z.prototype.write.call(this,a);vL(a,3);vL(a,23+this.Ob.byteLength);xL(a,1);vL(a,0);vL(a,4);vL(a,15+this.Ob.byteLength);vL(a,64);vL(a,21);wL(a,0);_.V(a,0);_.V(a,0);vL(a,5);vL(a,this.Ob.byteLength);_.cm(a,this.Ob);_.cm(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(XL,Z);XL.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};XL.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.cm(a,AL(this.location));a.getPosition()};
55
- _.w(YL,Z);YL.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)};YL.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(ZL,BL);_.w($L,Z);$L.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)};
56
- $L.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(aM,Z);aM.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)};aM.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(bM,Z);
57
- bM.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)};bM.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(cM,Z);cM.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)};
58
- cM.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(dM,Z);dM.prototype.a=function(){return 8+Z.prototype.a.call(this)};dM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);_.V(a,0);a.getPosition()};_.w(eM,Z);eM.prototype.a=function(){return 4+Z.prototype.a.call(this)};eM.prototype.write=function(a){Z.prototype.write.call(this,a);zL(a,0);xL(a,0);a.getPosition()};
59
- _.w(fM,BL);_.w(gM,BL);_.w(hM,BL);_.w(iM,Z);iM.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};iM.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?uL(a,this.h):_.V(a,this.h);a.getPosition()};_.w(jM,Z);jM.prototype.a=function(){return 4+Z.prototype.a.call(this)};jM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);a.getPosition()};_.w(kM,Z);
60
- kM.prototype.a=function(){var a=4;this.flags&hN&&(a+=4);this.flags&iN&&(a+=4);for(var b=0;b<this.h;b++)this.flags&jN&&(a+=4),this.flags&kN&&(a+=4),this.flags&lN&&(a+=4),this.flags&mN&&(a+=4);return a+Z.prototype.a.call(this)};
61
- kM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&hN&&(a.getPosition(),yL(a,this.l));this.flags&iN&&_.V(a,this.o);for(var b=0;b<this.h;b++)this.flags&jN&&_.V(a,this.w[b]),this.flags&kN&&_.V(a,this.sampleSize[b]),this.flags&lN&&_.V(a,this.B[b]),this.flags&mN&&(0===this.version?_.V(a,this.j[b]):yL(a,this.j[b]));a.getPosition()};var hN=1,iN=4,jN=256,kN=512,lN=1024,mN=2048;_.w(lM,Z);
62
- lM.prototype.a=function(){var a=4;this.flags&nN&&(a+=8);this.flags&oN&&(a+=4);this.flags&pN&&(a+=4);this.flags&qN&&(a+=4);this.flags&rN&&(a+=4);return a+Z.prototype.a.call(this)};lM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&nN&&uL(a,this.j);this.flags&oN&&_.V(a,this.B);this.flags&pN&&_.V(a,this.l);this.flags&qN&&_.V(a,this.w);this.flags&rN&&_.V(a,this.o);a.getPosition()};var nN=1,oN=2,pN=8,qN=16,rN=32;_.w(mM,BL);_.w(nM,BL);_.w(oM,BL);
63
- oM.prototype.a=function(){return this.h.byteLength+BL.prototype.a.call(this)};oM.prototype.write=function(a){BL.prototype.write.call(this,a);0<this.h.byteLength&&_.cm(a,this.h)};_.w(pM,Z);pM.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)};
64
- pM.prototype.write=function(a){Z.prototype.write.call(this,a);vL(a,0);0===this.version?vL(a,0):vL(a,0);vL(a,this.h);vL(a,this.j);_.cm(a,_.gj(this.o));if(1===this.h&&0===this.j){vL(a,0);for(var b=0;b<this.l.length;b++)vL(a,this.l[b])}a.getPosition()};_.w(qM,Z);qM.prototype.a=function(){var a=8;this.flags&1&&(a+=AL(this.Jb).byteLength);return a+Z.prototype.a.call(this)};qM.prototype.write=function(a){Z.prototype.write.call(this,a);_.cm(a,AL(this.h));_.V(a,this.j);this.flags&1&&_.cm(a,AL(this.Jb));a.getPosition()};
65
- _.w(rM,BL);rM.prototype.a=function(){return AL(this.h).byteLength+BL.prototype.a.call(this)};rM.prototype.write=function(a){BL.prototype.write.call(this,a);_.cm(a,AL(this.h));a.getPosition()};_.w(sM,Z);sM.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)};
66
- sM.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]):uL(a,this.offset[b]);a.getPosition()};_.w(tM,Z);tM.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)};
67
- tM.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));vL(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)vL(a,this.l[b]);a.getPosition()};_.w(uM,Z);uM.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].Wg.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].ed;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
68
- uM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&vL(a,this.l);for(var b=0;b<this.j;b++)if(_.cm(a,this.h[b].Wg),this.flags&2){xL(a,this.h[b].ed);for(var c=0;c<this.h[b].ed;c++)xL(a,this.h[b].Pf[c].eg),_.V(a,this.h[b].Pf[c].fg)}a.getPosition()};var BM=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,CM=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,DM=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,EM=/^(\d*\.?\d*)f$/,FM=/^(\d*\.?\d*)t$/,GM=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;KM.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};KM.prototype.write=function(){this.f=JM(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var NM=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=TM.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.C=b;var d=_.Og(new Set([a,vM(a)])).concat();return UM(this,d).then(function(e){return aN(c,e.data).then(function(){fN(c,c.A);return c.h})})};_.r.stop=function(){this.C&&this.C.networkingEngine.ye(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()};
69
- _.r.update=function(){var a=this;if(this.pd())return UM(this,[this.l]).then(function(b){return aN(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.C)a.C.onError(b)})};_.r.onExpirationUpdated=function(){};_.r.setCurrentVariant=function(){};_.r.Hb=function(){var a=this;this.g.debug(_.Yy);this.C&&(this.j=null,this.update().then(function(){fN(a,a.A)})["catch"](function(b){a.C&&(a.C.onError(b),1===b.severity&&fN(a,100))}))};_.r.pd=function(){return this.P===XM};
70
- _.r.lf=function(){return 0<this.o.length};_.r.Kg=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};
71
- _.r.cm=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.pd.bind(this),pe:this.lf.bind(this),bk:function(){return 1},je:this.Kg.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=PM(a,b,g,c)}catch(h){d=
72
- !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 dN={video:_.ug,audio:_.dd,text:_.Xc},SM=_.mc,XM="LIVE",eN={Cm:_.md,Mm:_.Zf};_.w(gN,_.Hr);gN.prototype.f=function(){_.Es.ism=TM;_.Cs[_.Yc]=TM};gN.prototype.a=function(){_.DA("ism");_.EA(_.Yc)};gN.prototype.id=function(){return"smooth"};_.H("clpp.smooth.SmoothComponent",gN);};
2
+ var f=function(window){var OL="Full MP4 box must have flags defined",PL="clpp.smooth.SmoothMP4Processor",QL="codecPrivateData",RL=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)},SL=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.nm()}},TL=function(a,b){SL(a,b>>16&255);SL(a,b>>8&255);SL(a,b&255)},UL=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.nm()}},VL=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.nm()}},WL=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.nm()}},XL=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},YL=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){YL.call(this,a);this.version=b;this.flags=c},ZL=function(a,b,c){YL.call(this,a);this.h=b;this.offset=c},$L=function(a,b,c,
4
+ d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},aM=function(a,b,c){YL.call(this,"ftyp");this.j=a;this.ih=b;this.h=c},bM=function(){YL.call(this,_.Re)},cM=function(){YL.call(this,_.gg)},dM=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]},eM=function(){YL.call(this,"mvex")},fM=function(a){Z.call(this,"trex",0,0);this.h=a},gM=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]},hM=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},iM=function(a){Z.call(this,"hdlr",0,0);this.h=a},jM=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},kM=function(a){YL.call(this,a);this.A=!0},lM=function(a){kM.call(this,a);this.height=this.width=0;this.depth=24},mM=
6
+ function(a,b,c,d){kM.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},nM=function(a,b){lM.call(this,"avc1");this.width=a;this.height=b},oM=function(a,b){nM.call(this,a,b);this.type="encv"},pM=function(a,b,c){mM.call(this,"mp4a",a,b,c)},qM=function(a,b,c){pM.call(this,a,b,c);this.type="enca"},rM=function(a,b){YL.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]},sM=function(a){Z.call(this,"esds",0,0);this.Ob=
7
+ a},tM=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},uM=function(){Z.call(this,"dref",0,0)},vM=function(){YL.call(this,_.Xf)},wM=function(){Z.call(this,_.Zf,0,0)},xM=function(){Z.call(this,"stts",0,0)},yM=function(){Z.call(this,"stsc",0,0)},zM=function(){Z.call(this,"stco",0,0)},AM=function(){Z.call(this,"stsz",0,0)},BM=function(){Z.call(this,"smhd",0,0)},CM=function(){YL.call(this,"dinf")},DM=function(){YL.call(this,_.Qe)},EM=function(){YL.call(this,_.Me)},FM=function(a,b){Z.call(this,
8
+ "tfdt",a,0);this.h=b},GM=function(){Z.call(this,"mfhd",0,0);this.h=0},HM=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},IM=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},JM=function(){YL.call(this,"traf")},KM=function(){YL.call(this,"moof")},LM=function(){YL.call(this,_.Le);this.h=new Uint8Array(0)},MM=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},NM=function(a,b){Z.call(this,
9
+ "schm",0,0);this.h=a;this.j=b;this.Jb=""},OM=function(a){YL.call(this,"frma");this.h=a},PM=function(){Z.call(this,"saio",0,0);this.offset=[0]},QM=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},RM=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},SM=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},TM=function(a,b,c,d){c=b.Jg[c];b=b.Cm;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
10
+ String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.Bi([a],[b])[0]},UM=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.tg?c=["maxWidth","maxHeight","bitrate",QL,"fourCC"]:a.type===_.$c&&(c=["bitrate",QL,"channels","bitsPerSample","samplingRate","fourCC"]);return _.O.ta(a,b,c,["id","segmentIndex"])},VM=function(a,b,c){var d=c.de.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ta:null,$b:null,width:NaN,height:NaN,Ob:null,Od:NaN,
11
+ sampleSize:NaN,channelCount:NaN};switch(c.type){case _.tg:a.Ta=[_.jj(d[1])];a.$b=[_.jj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.$c:a.Ob=_.jj(c.de),a.sampleSize=c.mi||16,a.Od=c.Od,a.channelCount=c.hg}return a},WM=function(a,b){return a.filter(function(c){return c.type===b})},XM=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)},dN=function(a,b,c){var d=null;if(YM.test(a)){a=YM.exec(a);d=
12
+ 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 ZM.test(a)?d=XM(ZM,a):$M.test(a)?d=XM($M,a):aN.test(a)?(a=aN.exec(a),d=Number(a[1])/c.frameRate):bN.test(a)?(a=bN.exec(a),d=Number(a[1])/c.a):cN.test(a)&&(d=XM(cN,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*d);return b+":"+c+":"+a+"."+d},eN=function(a,
13
+ 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))},gN=function(a){this.a=a;this.f=fN(this)},fN=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.mm(b)},hN=function(a,b,c){a:{var d=_.u([_.Sd,_.Qd]);for(var e=d.next();!e.done;e=d.next())if((e=c.ke(e.value))&&e.keyId){d=e.keyId;break a}_.J(PL,"Could not get default Key ID for DRM init data!");
14
+ d=null}c=new YL("xxxx");a.type===_.tg?c=new oM(a.width,a.height):c=new qM(a.channelCount,a.sampleSize,a.Od);a=new MM;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new YL("schi")).append([a]);b=(new YL(_.Sf)).append([new OM(b),new NM(_.rd,65536),a]);c.append([b]);return c},iN=function(a,b){var c=b.pe(),d=new dM(a.timescale,a.duration,a.id),e=(new eM).append([new fM(a.id)]),f=new gM(a.id,a.duration,a.timescale,a.width,a.height),g=new hM(a.timescale,a.duration),h=new iM(a.type),l=null,m=new uM;
15
+ m.entries=[new tM];var n=new wM;switch(a.type){case _.tg:var p=new rM(a.Ta,a.$b);c?(l=hN(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new nM(a.width,a.height)).append([p]),n.entries=[l]);l=new jM;break;case _.$c:p=new sM(a.Ob),c?(l=hN(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new pM(a.channelCount,a.sampleSize,a.Od)).append([p]),n.entries=[l]),l=new BM}n=(new vM).append([n,new xM,new yM,new AM,new zM]);m=(new CM).append([m]);m=(new DM).append([l,m,n]);g=(new EM).append([g,h,m]);f=(new cM).append([f,
16
+ g]);d=(new bM).append([d,f,e]);e=new aM("dash",0,["iso6","mp41","avc1"]);c&&(c=b.ke(_.Qd),f=b.ke(_.Sd),c&&d.append([new ZL("pssh",c.initData,8)]),f&&d.append([new ZL("pssh",f.initData,8)]),c||f||_.J(PL,"Could not get PSSH init data!"));c=new gN([e,d]);return _.Xi(c.write())},kN=function(a,b){var c,d,e,f,g,h;(new _.ym).M("moof",_.zm).Y("mfhd",function(m){var n=new GM;n.h=_.W(m.reader);c=n}).M("traf",_.zm).Y("tfhd",function(m){var n=m.reader.Ga();if(null===m.flags)throw new _.P(_.Q,3,3019,OL);var p=
17
+ new IM(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.vm(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.Ga();if(null===m.flags)throw new _.P(_.Q,3,3019,OL);var p=new HM(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-
18
+ m.reader.getPosition()&&m.flags&1&&(p.l=_.um(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(_.um(m.reader)));e=p}).Y("sdtp",function(m){var n=_.xm(m.reader,m.reader.Ga());f=new $L("sdtp",m.version||0,m.flags||0,n,0)}).M("uuid",function(m){var n=_.xm(m.reader,
19
+ 16);if(_.lj(n,jN)){n=_.W(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new RM(m.version,m.flags);n.j=_.W(m.reader);m.flags&1&&(n.l=_.sm(m.reader));for(var p=0;p<n.j;p++){var q={Yg:_.xm(m.reader,8),bd:0,Qf:[]};if(m.flags&2){q.bd=_.tm(m.reader);for(var t=0;t<q.bd;t++){var v={fg:0,gg:0};v.fg=_.tm(m.reader);v.gg=_.W(m.reader);q.Qf.push(v)}}n.h.push(q)}g=n}}).M(_.Le,function(m){var n=new LM;0<m.reader.Ga()?n.h=_.xm(m.reader,m.reader.Ga()):(_.J(PL,"mdat box is empty!"),n.h=new Uint8Array(0));h=n}).parse(a,
20
+ !1);if(!h)return null;var l=(new JM).append([d,e]);f&&l.append([f]);b.pe()&&g&&l.append([g]);l=(new KM).append([c,l]);return new gN([l,h])},lN=function(a,b,c,d){var e=d.pe(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=kN(b,d);if(null===g)return a.request.contentType===_.Di?a.data:g;d=g.get(_.Le);if(a.request.contentType===_.Di){e=d.h.buffer;if(c){e=_.R.zd(e);if((e=(new DOMParser).parseFromString(e,_.eg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new eN(h.getAttribute("ttp:frameRate"),
21
+ 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",_.ne],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 D=q[v].name;if(D=D.match(t)){p=p.getAttribute(D[0]);break b}}p=null}}f.setAttribute(l[m],dN(p||
22
+ "",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.Ua(e).buffer}else c=e;return c}h=new KM;a=g.get("mfhd");b=new JM;l=g.get("tfhd");m=new FM(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].bd);else g=8;b.append([c,new PM,new QM(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new gN([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=
23
+ c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},mN=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},nN=function(a,b,c){a=_.Bn(a);c&&a.version!==c&&(a=_.Tz(a,c));return{initData:_.Rz(a),initDataType:_.rd,keyId:b,periodId:null}},pN=function(){this.w=this.h=this.f=this.C=null;this.P=1;this.U=0;this.l="";this.B=this.a=null;this.g=
24
+ new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.L=oN;this.H=0;this.D=this.I=Infinity;this.o=[];this.K=this.fm.bind(this);this.G=new Map},qN=function(a,b){var c,d,e;return _.E(function(f){if(1==f.a)return c=_.uj(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,c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.C.networkingEngine.fetch(c),
25
+ _.x(f,d.O,2);e=f.f;a.l=e.uri;return f["return"](e)})},xN=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.R.zd(b);var f=d.parseFromString(e.trim(),_.eg)}catch(wF){throw wF;}if(f&&f.documentElement.tagName==_.ac)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(wF){}if(!c)throw a.g.error("Unable to parse manifest"),new _.P(_.Q,4,4033,a.l);var h=+rN(a,c,"MajorVersion"),l=+rN(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+rN(a,c,"Duration"),
26
+ p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),t=+c.getAttribute("DVRWindowLength")||Infinity,v=_.nn(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?(sN(a,tN),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):sN(a,oN);a.a={startTime:0,delay:0,duration:n/m,$e:t/m,Hd:0};if(v){var z=a.f.playreadyVersion,D=[],G=_.nn(v,"ProtectionHeader")[0],
27
+ F=_.ij(_.pn(G)||""),B=_.Bn(F).a;D.push(mN(_.Sd,{initData:_.Rz(_.un(B)),initDataType:_.rd,keyId:B,periodId:null},[B]));D.push(mN(_.Qd,nN(F,B,z),[B]));a.o=D}var H=[],N=_.nn(c,"StreamIndex");if(!N.length)throw a.g.error("No streams found!"),new _.P(_.Q,4,4034,a.l);for(var M=0;M<N.length;M++){for(var S,ba=a,qa=N[M],Ta=rN(ba,qa,"Type"),Ga=+qa.getAttribute("Chunks"),Ca=qa.getAttribute("Subtype"),oa=qa.getAttribute("Language")||_.ig,Ia=_.Qi(oa),tb=qa.getAttribute("Name")||"",Ib=+qa.getAttribute(_.wb),Oc=
28
+ +qa.getAttribute(_.vb),Gm=rN(ba,qa,"Url"),Ts=+qa.getAttribute("TimeScale")||null,Pc=[],Hm=_.nn(qa,_.Ob),Bt=0;Bt<Hm.length;Bt++){var of=void 0,hc=void 0,Ct=void 0,pf=ba,sd=Hm[Bt],Dt=Ta,fR=+sd.getAttribute("Index"),gR=+rN(pf,sd,"Bitrate"),zF=NaN,AF=NaN,Cn=NaN,Et=NaN,BF=NaN,CF=NaN,DF=NaN,EF=sd.getAttribute("FourCC");switch(Dt){case _.tg:zF=+rN(pf,sd,_.vb);AF=+rN(pf,sd,_.wb);break;case _.$c:Et=+sd.getAttribute("Channels")||2,Cn=+rN(pf,sd,"SamplingRate"),CF=+rN(pf,sd,"AudioTag"),BF=+rN(pf,sd,"BitsPerSample"),
29
+ DF=+rN(pf,sd,"PacketSize")}var Ft=String(sd.getAttribute("CodecPrivateData"));if(Dt===_.$c&&!Ft){var FF=Et,GF={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},Dn=GF[Cn];if("AACH"===EF){hc=new Uint8Array(4);var HF=GF[2*Cn];hc[0]=40|Dn>>1;hc[1]=Dn<<7|FF<<3|HF>>1;hc[2]=HF<<7|8;hc[3]=0;of=new Uint16Array(2);of[0]=(hc[0]<<8)+hc[1];of[1]=(hc[2]<<8)+hc[3];Ct=of[0].toString(16)+of[1].toString(16)}else hc=new Uint8Array(2),hc[0]=16|Dn>>1,hc[1]=Dn<<7|FF<<3,
30
+ of=new Uint16Array(1),of[0]=(hc[0]<<8)+hc[1],Ct=of[0].toString(16);Ft=Ct.toUpperCase()}var hR={id:pf.U++,type:Dt,index:fR,bitrate:gR,de:Ft,maxHeight:zF,maxWidth:AF,Od:Cn,hg:Et,Vm:CF,mi:BF,ln:DF,Yj:EF,segmentIndex:null};Pc.push(hR)}S=Pc;for(var Ae=[],IF=_.nn(qa,"c"),Lj=0;Lj<IF.length;Lj++){var Gt=IF[Lj],Nd=parseInt(Gt.getAttribute("t"),10),Bh=parseInt(Gt.getAttribute("d"),10),Ht=parseInt(Gt.getAttribute("r"),10),Mj=0;if(isNaN(Nd)&&isNaN(Bh))throw ba.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
31
+ new _.P(_.Q,4,4037,ba.l);0===Lj&&isNaN(Nd)&&(Mj=Nd=0);if(0<Lj){var kg=Ae[Ae.length-1];Mj=kg.n+1;kg.d||(kg.d=Nd-kg.t);Nd||(Nd=kg.t+kg.d);Bh||(Bh=Nd-kg.t)}Ae.push({n:Mj,d:Bh,t:Nd});if(Ht){Ht--;for(var JF=0;JF<Ht;JF++){var En=Ae[Ae.length-1];Mj=En.n+1;Nd=En.t+En.d;Bh=En.d;Ae.push({n:Mj,d:Bh,t:Nd})}}}ba.rd()||Ae.length===Ga||ba.g.warn("Number of fragments ("+Ga+") differs from number of chunks ("+Ae.length+").");H.push({type:Ta,Zm:Ga,rm:Ca,language:Ia,Gd:oa,name:tb,maxWidth:Ib,maxHeight:Oc,Cm:Gm,tracks:S,
32
+ Jg:Ae,timescale:Ts})}var qf={jn:h,ih:l,timescale:m,duration:n,isLive:p,hn:q,$e:t,jf:!1,streams:H};if(a.h&&a.w)return uN(a,qf),Promise.resolve();a.G.clear();var It=qf.timescale,Fn=qf.duration,jR=WM(qf.streams,_.$c),kR=WM(qf.streams,_.tg),lR=WM(qf.streams,_.Di),KF=[],Gn=vN(a,Fn,It,jR),Hn=vN(a,Fn,It,kR),mR=vN(a,Fn,It,lR);Gn.length||(Gn=[null]);Hn.length||(Hn=[null]);for(var Kt=0;Kt<Hn.length;Kt++)for(var Lt=0;Lt<Gn.length;Lt++)KF.push(wN(a,Hn[Kt],Gn[Lt]));var LF={startTime:0,endTime:Fn,variants:KF,textStreams:mR,
33
+ thumbStreams:[]};var oR=qf.streams,Mt=a.a.startTime,MF=a.a.delay,Nt=a.I,NF=Math.min(a.a.duration||Infinity,Nt),Ot=a.rd(),pR=a.a.$e,qR=a.a.Hd,OF=a.H,PF=isFinite(a.D)?a.D:0;if(Ot)NF=Infinity,Mt=Date.now()/1E3-qR,a.a.startTime=Mt,MF=3*OF;else for(var rR=isFinite(Nt)?Nt:a.a.duration,QF=_.u(oR),Pt=QF.next();!Pt.done;Pt=QF.next())for(var RF=_.u(Pt.value.tracks),Qt=RF.next();!Qt.done;Qt=RF.next()){var SF=Qt.value;SF.segmentIndex.offset(-PF);_.sA(SF.segmentIndex,rR)}a.B=new _.AA(a.f.timeline||{},Mt,MF,!Ot,
34
+ !0);a.B.h=NF;_.GA(a.B,OF);a.B.w=pR;Ot||a.B.offset(-PF);a.C.filterAllPeriods([LF]);a.h={presentationTimeline:a.B,periods:[LF],minBufferTime:0};Promise.resolve();a.J||(a.C.networkingEngine.jd(a.K),a.J=!0);a.w=qf;return Promise.resolve()},uN=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.u(a.w.streams[c].tracks),g=f.next();!g.done;e={Nb:e.Nb},g=f.next())if(e.Nb=g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.Nb.type&&m.bitrate===l.Nb.bitrate}}(e))){UM(e.Nb,
35
+ g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=yN(a,a.w.timescale,d,g);g=e.Nb.segmentIndex;g.oa(h);(h=a.a.$e)&&_.TA(g,_.SA(g)-h).forEach(function(l){l.Ra().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."))},vN=function(a,b,c,d){for(var e=[],f={Cc:0};f.Cc<d.length;f={Cc:f.Cc},f.Cc++){var g=d[f.Cc].tracks.map(function(h){return function(l){var m=
36
+ d[h.Cc],n=yN(a,c,m,l);n=new _.RA(n);var p=null;m.type!==_.Di&&(p=zN(a,b,c,m,l));l.segmentIndex=n;var q=_.uF++,t=Promise.resolve.bind(Promise),v=n.Kc.bind(n),z=n.get.bind(n),D=n.kd.bind(n),G=n.getDuration.bind(n),F=AN[m.type],B="";switch(m.type){case _.tg:B=l.de;var H=/00000001[0-9]7/.exec(B);B="avc1."+(H&&H[0]?B.substr(B.indexOf(H[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.$c:B=l.de,H=2,"AACH"===l.Yj?H=5:B&&(H=(parseInt(B.substr(0,2),16)&248)>>3),B="mp4a.40."+H,a.g.debug("AUDIO CODECS: ",
37
+ B)}H=m.type===_.Di?BN[m.rm]:void 0;return{id:q,originalId:null,nn:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:D,getDuration:G,segmentIndex:n,segmentLookupStrategy:_.Cz,initSegmentReference:p,mimeType:F,codecs:B,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:H,encrypted:a.lf(),keyId:null,language:m.language,originalLanguage:m.Gd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,
38
+ roles:[],channelsCount:l.hg||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},yN=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Jg.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=TM(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.Oi(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.G.set(q,n);e+=m});if(c.type===_.tg||c.type===_.$c)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Hd?a.a.Hd=b.endTime:a.a.Hd=Math.min(a.a.Hd,
39
+ b.endTime);return f},zN=function(a,b,c,d,e){b=VM(b,d.timescale||c,e);c={isLive:a.rd.bind(a),pe:a.lf.bind(a),ek:function(){return 1},ke:a.Lg.bind(a)};d=new Uint8Array(0);try{d=iN(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,"+_.hj(d);return new _.aA(function(){return[f]},0,null,null,!0)},wN=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.ig;return c||b?{id:a.P++,language:e,primary:!1,audio:c,
40
+ video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},rN=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);},CN=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Hb.bind(a),b))},sN=function(a,b){var c=b===oN;a.h&&a.h.presentationTimeline&&_.BA(a.h.presentationTimeline,c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.L=b},DN=function(){};
41
+ YL.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};YL.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};YL.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};
42
+ YL.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);_.om(a,XL(this.type));this.size>b&&RL(a,this.size);"uuid"===this.type&&_.om(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,YL);Z.prototype.a=function(){return 4+YL.prototype.a.call(this)};Z.prototype.write=function(a){YL.prototype.write.call(this,a);SL(a,this.version);TL(a,this.flags)};
43
+ _.w(ZL,YL);ZL.prototype.a=function(){return this.h.byteLength+YL.prototype.a.call(this)-this.offset};ZL.prototype.write=function(a){YL.prototype.write.call(this,a);_.om(a,this.h,this.offset);a.getPosition()};_.w($L,Z);$L.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};$L.prototype.write=function(a){Z.prototype.write.call(this,a);_.om(a,this.h,this.offset);a.getPosition()};_.w(aM,YL);
44
+ aM.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+YL.prototype.a.call(this)};aM.prototype.write=function(a){YL.prototype.write.call(this,a);_.om(a,XL(this.j));_.V(a,this.ih);_.om(a,XL(this.h.join("")));a.getPosition()};_.w(bM,YL);_.w(cM,YL);_.w(dM,Z);dM.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)};
45
+ dM.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(RL(a,0),RL(a,0),_.V(a,this.timescale),RL(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);UL(a,this.volume);UL(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.h.length;b++)SL(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(eM,YL);_.w(fM,Z);fM.prototype.a=function(){return 20+Z.prototype.a.call(this)};
46
+ fM.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(gM,Z);gM.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)};
47
+ gM.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(RL(a,0),RL(a,0),_.V(a,this.j),_.V(a,0),RL(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);UL(a,0);UL(a,0);UL(a,this.volume);UL(a,0);for(var b=0;b<this.h.length;b++)SL(a,this.h[b]);UL(a,this.width);UL(a,0);UL(a,this.height);UL(a,0);a.getPosition()};_.w(hM,Z);hM.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
48
+ hM.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(RL(a,0),RL(a,0),_.V(a,this.timescale),RL(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));UL(a,this.language);UL(a,0);a.getPosition()};_.w(iM,Z);iM.prototype.a=function(){return 33+Z.prototype.a.call(this)};
49
+ iM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.h===_.tg?_.om(a,XL("vide")):_.om(a,XL("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.h===_.tg?_.om(a,XL("VideoHandler\x00")):_.om(a,XL("SoundHandler\x00"));a.getPosition()};_.w(jM,Z);jM.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};jM.prototype.write=function(a){Z.prototype.write.call(this,a);UL(a,0);_.om(a,this.h);a.getPosition()};_.w(kM,YL);kM.prototype.a=function(){return 8+YL.prototype.a.call(this)};
50
+ kM.prototype.write=function(a){YL.prototype.write.call(this,a);_.V(a,0);UL(a,0);UL(a,1)};_.w(lM,kM);lM.prototype.a=function(){return 70+kM.prototype.a.call(this)};lM.prototype.write=function(a){kM.prototype.write.call(this,a);UL(a,0);UL(a,0);_.V(a,0);_.V(a,0);_.V(a,0);UL(a,this.width);UL(a,this.height);_.V(a,4718592);_.V(a,4718592);_.V(a,0);UL(a,1);SL(a,10);_.om(a,XL("AVC Coding",31));UL(a,this.depth);WL(a,-1)};_.w(mM,kM);mM.prototype.a=function(){return 20+kM.prototype.a.call(this)};
51
+ mM.prototype.write=function(a){kM.prototype.write.call(this,a);_.V(a,0);_.V(a,0);UL(a,this.channelCount);UL(a,this.sampleSize);WL(a,0);UL(a,0);UL(a,this.sampleRate);UL(a,0)};_.w(nM,lM);nM.prototype.write=function(a){lM.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(oM,nM);_.w(pM,mM);pM.prototype.write=function(a){mM.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(qM,pM);_.w(rM,YL);
52
+ rM.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+YL.prototype.a.call(this)};
53
+ rM.prototype.write=function(a){YL.prototype.write.call(this,a);SL(a,this.version);SL(a,this.h);SL(a,this.j);SL(a,this.level);SL(a,255);SL(a,224|this.Ta.length);for(var b=0;b<this.Ta.length;b++)UL(a,this.Ta[b].length),_.om(a,this.Ta[b]);SL(a,this.$b.length);for(b=0;b<this.$b.length;b++)UL(a,this.$b[b].length),_.om(a,this.$b[b]);a.getPosition()};_.w(sM,Z);sM.prototype.a=function(){return 22+(this.Ob.byteLength+3)+Z.prototype.a.call(this)};
54
+ sM.prototype.write=function(a){Z.prototype.write.call(this,a);SL(a,3);SL(a,23+this.Ob.byteLength);UL(a,1);SL(a,0);SL(a,4);SL(a,15+this.Ob.byteLength);SL(a,64);SL(a,21);TL(a,0);_.V(a,0);_.V(a,0);SL(a,5);SL(a,this.Ob.byteLength);_.om(a,this.Ob);_.om(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(tM,Z);tM.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};tM.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.om(a,XL(this.location));a.getPosition()};
55
+ _.w(uM,Z);uM.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)};uM.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(vM,YL);_.w(wM,Z);wM.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)};
56
+ wM.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(xM,Z);xM.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)};xM.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(yM,Z);
57
+ yM.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)};yM.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(zM,Z);zM.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)};
58
+ zM.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(AM,Z);AM.prototype.a=function(){return 8+Z.prototype.a.call(this)};AM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);_.V(a,0);a.getPosition()};_.w(BM,Z);BM.prototype.a=function(){return 4+Z.prototype.a.call(this)};BM.prototype.write=function(a){Z.prototype.write.call(this,a);WL(a,0);UL(a,0);a.getPosition()};
59
+ _.w(CM,YL);_.w(DM,YL);_.w(EM,YL);_.w(FM,Z);FM.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};FM.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?RL(a,this.h):_.V(a,this.h);a.getPosition()};_.w(GM,Z);GM.prototype.a=function(){return 4+Z.prototype.a.call(this)};GM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);a.getPosition()};_.w(HM,Z);
60
+ HM.prototype.a=function(){var a=4;this.flags&EN&&(a+=4);this.flags&FN&&(a+=4);for(var b=0;b<this.h;b++)this.flags&GN&&(a+=4),this.flags&HN&&(a+=4),this.flags&IN&&(a+=4),this.flags&JN&&(a+=4);return a+Z.prototype.a.call(this)};
61
+ HM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&EN&&(a.getPosition(),VL(a,this.l));this.flags&FN&&_.V(a,this.o);for(var b=0;b<this.h;b++)this.flags&GN&&_.V(a,this.w[b]),this.flags&HN&&_.V(a,this.sampleSize[b]),this.flags&IN&&_.V(a,this.B[b]),this.flags&JN&&(0===this.version?_.V(a,this.j[b]):VL(a,this.j[b]));a.getPosition()};var EN=1,FN=4,GN=256,HN=512,IN=1024,JN=2048;_.w(IM,Z);
62
+ IM.prototype.a=function(){var a=4;this.flags&KN&&(a+=8);this.flags&LN&&(a+=4);this.flags&MN&&(a+=4);this.flags&NN&&(a+=4);this.flags&ON&&(a+=4);return a+Z.prototype.a.call(this)};IM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&KN&&RL(a,this.j);this.flags&LN&&_.V(a,this.B);this.flags&MN&&_.V(a,this.l);this.flags&NN&&_.V(a,this.w);this.flags&ON&&_.V(a,this.o);a.getPosition()};var KN=1,LN=2,MN=8,NN=16,ON=32;_.w(JM,YL);_.w(KM,YL);_.w(LM,YL);
63
+ LM.prototype.a=function(){return this.h.byteLength+YL.prototype.a.call(this)};LM.prototype.write=function(a){YL.prototype.write.call(this,a);0<this.h.byteLength&&_.om(a,this.h)};_.w(MM,Z);MM.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)};
64
+ MM.prototype.write=function(a){Z.prototype.write.call(this,a);SL(a,0);0===this.version?SL(a,0):SL(a,0);SL(a,this.h);SL(a,this.j);_.om(a,_.jj(this.o));if(1===this.h&&0===this.j){SL(a,0);for(var b=0;b<this.l.length;b++)SL(a,this.l[b])}a.getPosition()};_.w(NM,Z);NM.prototype.a=function(){var a=8;this.flags&1&&(a+=XL(this.Jb).byteLength);return a+Z.prototype.a.call(this)};NM.prototype.write=function(a){Z.prototype.write.call(this,a);_.om(a,XL(this.h));_.V(a,this.j);this.flags&1&&_.om(a,XL(this.Jb));a.getPosition()};
65
+ _.w(OM,YL);OM.prototype.a=function(){return XL(this.h).byteLength+YL.prototype.a.call(this)};OM.prototype.write=function(a){YL.prototype.write.call(this,a);_.om(a,XL(this.h));a.getPosition()};_.w(PM,Z);PM.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)};
66
+ PM.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]):RL(a,this.offset[b]);a.getPosition()};_.w(QM,Z);QM.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)};
67
+ QM.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));SL(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)SL(a,this.l[b]);a.getPosition()};_.w(RM,Z);RM.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].Yg.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].bd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
68
+ RM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&SL(a,this.l);for(var b=0;b<this.j;b++)if(_.om(a,this.h[b].Yg),this.flags&2){UL(a,this.h[b].bd);for(var c=0;c<this.h[b].bd;c++)UL(a,this.h[b].Qf[c].fg),_.V(a,this.h[b].Qf[c].gg)}a.getPosition()};var YM=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,ZM=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,$M=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,aN=/^(\d*\.?\d*)f$/,bN=/^(\d*\.?\d*)t$/,cN=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;gN.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};gN.prototype.write=function(){this.f=fN(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var jN=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=pN.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.C=b;var d=_.Pg(new Set([a,SM(a)])).concat();return qN(this,d).then(function(e){return xN(c,e.data).then(function(){CN(c,c.A);return c.h})})};_.r.stop=function(){this.C&&this.C.networkingEngine.ye(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()};
69
+ _.r.update=function(){var a=this;if(this.rd())return qN(this,[this.l]).then(function(b){return xN(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(_.vz);this.C&&(this.j=null,this.update().then(function(){CN(a,a.A)})["catch"](function(b){a.C&&(a.C.onError(b),1===b.severity&&CN(a,100))}))};_.r.rd=function(){return this.L===tN};_.r.lf=function(){return 0<this.o.length};
70
+ _.r.Lg=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};
71
+ _.r.fm=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),pe:this.lf.bind(this),ek:function(){return 1},ke:this.Lg.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=lN(a,b,g,c)}catch(h){d=
72
+ !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 AN={video:_.vg,audio:_.dd,text:_.Xc},oN=_.lc,tN="LIVE",BN={Fm:_.nd,Om:_.ag};_.w(DN,_.fs);DN.prototype.f=function(){_.dt.ism=pN;_.bt[_.Yc]=pN};DN.prototype.a=function(){_.ZA("ism");_.$A(_.Yc)};DN.prototype.id=function(){return"smooth"};_.I("clpp.smooth.SmoothComponent",DN);};
73
73
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
74
74
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
75
75
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,30 +1,30 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var cx="No thumbnail found for position: ",dx="Position is out of range: ",ex="Thumbnail URL is mandatory",fx="Wrong gridSize format",gx="clpp.thumbnails",hx=function(){this.log=new _.K(gx);this.player=null;this.a=[];this.w=!1},jx=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Te&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return ix(a,0,e,!!f)})},Promise.resolve())},ix=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return kx(a,d).then(function(){return a.a[b].load()}).then(function(){return ix(a,
3
- e,c,d)})},kx=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Lo)c();else a.player.one(_.id,function(){c()})})},lx=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.ka=p;this.Aj=h;this.dm=l;this.nk=m;this.pk=n;this.Yb=null},mx=function(){hx.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},nx=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Jd=new _.wj},ox=function(){this.g=new _.K(gx);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.wj},px=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Jd.resolve()})},rx=function(a,b){return qx(a,b).then(function(c){return new lx(c,b.time,b.duration)})},qx=function(a,b){return b.load().then(function(){var c=_.Ui(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.dj(c)})},sx=function(){hx.call(this);this.f=null},tx=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},ux=function(){hx.apply(this,arguments)},vx=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Cd:c,Vf:d,Vg:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},wx=function(){this.g=new _.K(gx);this.a=this.m=null},xx=function(a){return a.some(function(b){return 0<
6
- b.thumbStreams.length})},Cx=function(a){return a?a===yx||a===zx?new mx:a===Ax?new sx:a===Bx?new ox:null:null},Dx=function(a){if(!a)return null;a=new _.Xj(a);return a.path.match(/.*\.vtt$/i)?Ax:a.path.match(/.*\.bif$/i)?Bx:a.path.match(/.*\.(png|jpg|jpeg)$/i)?yx:null},Ex=function(){};hx.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Gf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&jx(c,b.preload)})};lx.prototype.raw=function(){return this.ka.cloneNode(!1)};
7
- lx.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(_.Yd);e.style.width=c+_.Df;e.style.height=d+_.Df;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.ka.naturalWidth||this.ka.width))+"px "+Math.ceil(d/
8
- this.height*(this.ka.naturalHeight||this.ka.height))+_.Df;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Df;e.style.backgroundPositionY="-"+f*d+_.Df;return e};
9
- lx.prototype.load=function(){var a=this;this.Yb||(this.Yb=new Promise(function(b,c){function d(){a.width||(a.width=(a.ka.naturalWidth||a.ka.width)/a.Aj);a.height||(a.height=(a.ka.naturalHeight||a.ka.height)/a.dm);a.x||(a.x=a.width*a.nk);a.y||(a.y=a.height*a.pk)}if(a.ka.src&&a.ka.complete)d(),b(a);else{var e=null,f=function(){d();a.ka.removeEventListener("load",f);a.ka.removeEventListener(_.ne,e);b(a)};e=function(g){a.ka.removeEventListener("load",f);a.ka.removeEventListener(_.ne,e);c(new _.P(1,9,
10
- 2014,"Failed to load thumbnail.",g))};a.ka.addEventListener("load",f);a.ka.addEventListener(_.ne,e);a.ka.src=a.src}}));return this.Yb};_.H("clpp.thumbnails.Thumbnail",lx);lx.prototype.load=lx.prototype.load;lx.prototype.element=lx.prototype.element;lx.prototype.raw=lx.prototype.raw;_.w(mx,hx);
11
- mx.prototype.init=function(a,b){if(!b||!b.url)throw new _.P(1,9,7100,ex);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,fx);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
- new _.P(1,9,7100,fx);}hx.prototype.init.call(this,a,b)};mx.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,dx+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
- mx.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 lx(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()};nx.prototype.load=function(){return this.Jd};
14
- ox.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,ex);var d=b.url,e=_.rj(d);e.type=_.qj;a.getNetworkEngine().fetch(e).O.then(function(f){f=f.data;var g=_.Ui(c.f);f=_.Ui(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=_.Ui(l);n=String.fromCharCode.apply(null,
15
- Fx);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 nx(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
- px(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))})};ox.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,dx+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,cx+a);return _.x(e,rx(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
17
- ox.prototype.Bd=function(){return 0<this.a.length};var Fx=[137,66,73,70,13,10,26,10];_.w(sx,hx);
18
- sx.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,ex);var d=b.url,e=_.rj(d);e.type=_.qj;this.f=a.getNetworkEngine().fetch(e).O.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.Z(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=tx(l[0]);l=tx(l[1])-t;c.a.push(new lx(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))});hx.prototype.init.call(this,a,b)};
20
- sx.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,dx+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,cx+a);return _.x(d,c.load(),3)}return d["return"](c)})};sx.prototype.l=function(){return this.f};_.w(ux,hx);
21
- ux.prototype.get=function(a){function b(){return new _.P(1,9,2014,cx+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.E(function(D){if(1==D.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.P(1,9,2014,dx+a);d=c.player.getPeriods();for(var G=null,F=_.u(d),B=F.next();!B.done;B=F.next())B=B.value,B.startTime<=a&&(G=B);e=G;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 D.F(2);l=vx(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.Vg+m])):(q=h.Ra())&&0<q.length&&(v=t=0,z=h.startTime,1<l.Vg&&(t=m%l.Cd,v=Math.floor(m/l.Cd),z+=m*l.durationPerTile),n=new lx(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Cd,l.Vf,
23
- t,v));return n?_.x(D,n.load(),4):D.F(2)}if(2!=D.a)return D["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};ux.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- ux.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.u(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=vx(d,b),f=d.Ra()[0],g=new Image,h=d.startTime,l=0;l<e.Vf;++l)for(var m=0;m<e.Cd;++m)this.a.push(new lx(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Cd,e.Vf,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=wx.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=Dx(c.url||null));(this.a=Cx(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Fe,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(xx(d)){this.a=new ux;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",wx);wx.prototype.get=wx.prototype.get;wx.Id="thumbnails";
27
- Ex.prototype.create=function(){return new wx};_.mq(new Ex);var yx="SINGLE",zx="GRID",Ax="WEBVTT",Bx="BIF";};
2
+ var f=function(window){var Bx="No thumbnail found for position: ",Cx="Position is out of range: ",Dx="Thumbnail URL is mandatory",Ex="Wrong gridSize format",Fx="clpp.thumbnails",Gx=function(){this.log=new _.K(Fx);this.player=null;this.a=[];this.w=!1},Ix=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Ve&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Hx(a,0,e,!!f)})},Promise.resolve())},Hx=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Jx(a,d).then(function(){return a.a[b].load()}).then(function(){return Hx(a,
3
+ e,c,d)})},Jx=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.$o)c();else a.player.one(_.jd,function(){c()})})},Kx=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.la=p;this.Dj=h;this.gm=l;this.rk=m;this.sk=n;this.Yb=null},Lx=function(){Gx.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},Mx=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Ld=new _.zj},Nx=function(){this.g=new _.K(Fx);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.zj},Ox=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Ld.resolve()})},Qx=function(a,b){return Px(a,b).then(function(c){return new Kx(c,b.time,b.duration)})},Px=function(a,b){return b.load().then(function(){var c=_.Xi(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.gj(c)})},Rx=function(){Gx.call(this);this.f=null},Sx=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},Tx=function(){Gx.apply(this,arguments)},Ux=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Ed:c,Wf:d,Xg:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Vx=function(){this.g=new _.K(Fx);this.a=this.m=null},Wx=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},ay=function(a){return a?a===Xx||a===Yx?new Lx:a===Zx?new Rx:a===$x?new Nx:null:null},by=function(a){if(!a)return null;a=new _.bk(a);return a.path.match(/.*\.vtt$/i)?Zx:a.path.match(/.*\.bif$/i)?$x:a.path.match(/.*\.(png|jpg|jpeg)$/i)?Xx:null},cy=function(){};Gx.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.If,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&Ix(c,b.preload)})};Kx.prototype.raw=function(){return this.la.cloneNode(!1)};
7
+ Kx.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.Zd);e.style.width=c+_.Ff;e.style.height=d+_.Ff;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.la.naturalWidth||this.la.width))+"px "+Math.ceil(d/
8
+ this.height*(this.la.naturalHeight||this.la.height))+_.Ff;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Ff;e.style.backgroundPositionY="-"+f*d+_.Ff;return e};
9
+ Kx.prototype.load=function(){var a=this;this.Yb||(this.Yb=new Promise(function(b,c){function d(){a.width||(a.width=(a.la.naturalWidth||a.la.width)/a.Dj);a.height||(a.height=(a.la.naturalHeight||a.la.height)/a.gm);a.x||(a.x=a.width*a.rk);a.y||(a.y=a.height*a.sk)}if(a.la.src&&a.la.complete)d(),b(a);else{var e=null,f=function(){d();a.la.removeEventListener("load",f);a.la.removeEventListener(_.pe,e);b(a)};e=function(g){a.la.removeEventListener("load",f);a.la.removeEventListener(_.pe,e);c(new _.P(1,9,
10
+ 2014,"Failed to load thumbnail.",g))};a.la.addEventListener("load",f);a.la.addEventListener(_.pe,e);a.la.src=a.src}}));return this.Yb};_.I("clpp.thumbnails.Thumbnail",Kx);Kx.prototype.load=Kx.prototype.load;Kx.prototype.element=Kx.prototype.element;Kx.prototype.raw=Kx.prototype.raw;_.w(Lx,Gx);
11
+ Lx.prototype.init=function(a,b){if(!b||!b.url)throw new _.P(1,9,7100,Dx);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,Ex);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
+ new _.P(1,9,7100,Ex);}Gx.prototype.init.call(this,a,b)};Lx.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,Cx+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
+ Lx.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 Kx(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()};Mx.prototype.load=function(){return this.Ld};
14
+ Nx.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,Dx);var d=b.url,e=_.uj(d);e.type=_.tj;a.getNetworkEngine().fetch(e).O.then(function(f){f=f.data;var g=_.Xi(c.f);f=_.Xi(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=_.Xi(l);n=String.fromCharCode.apply(null,
15
+ dy);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 Mx(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
+ Ox(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))})};Nx.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,Cx+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,Bx+a);return _.x(e,Qx(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
17
+ Nx.prototype.Dd=function(){return 0<this.a.length};var dy=[137,66,73,70,13,10,26,10];_.w(Rx,Gx);
18
+ Rx.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,Dx);var d=b.url,e=_.uj(d);e.type=_.tj;this.f=a.getNetworkEngine().fetch(e).O.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.Z(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=Sx(l[0]);l=Sx(l[1])-t;c.a.push(new Kx(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))});Gx.prototype.init.call(this,a,b)};
20
+ Rx.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,Cx+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,Bx+a);return _.x(d,c.load(),3)}return d["return"](c)})};Rx.prototype.l=function(){return this.f};_.w(Tx,Gx);
21
+ Tx.prototype.get=function(a){function b(){return new _.P(1,9,2014,Bx+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.E(function(D){if(1==D.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.P(1,9,2014,Cx+a);d=c.player.getPeriods();for(var G=null,F=_.u(d),B=F.next();!B.done;B=F.next())B=B.value,B.startTime<=a&&(G=B);e=G;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 D.F(2);l=Ux(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.Xg+m])):(q=h.Ra())&&0<q.length&&(v=t=0,z=h.startTime,1<l.Xg&&(t=m%l.Ed,v=Math.floor(m/l.Ed),z+=m*l.durationPerTile),n=new Kx(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Ed,l.Wf,
23
+ t,v));return n?_.x(D,n.load(),4):D.F(2)}if(2!=D.a)return D["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};Tx.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ Tx.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.u(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=Ux(d,b),f=d.Ra()[0],g=new Image,h=d.startTime,l=0;l<e.Wf;++l)for(var m=0;m<e.Ed;++m)this.a.push(new Kx(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ed,e.Wf,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=Vx.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=by(c.url||null));(this.a=ay(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Ie,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(Wx(d)){this.a=new Tx;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"};_.I("clpp.thumbnails.ThumbnailsPlugin",Vx);Vx.prototype.get=Vx.prototype.get;Vx.Id="thumbnails";
27
+ cy.prototype.create=function(){return new Vx};_.Dq(new cy);var Xx="SINGLE",Yx="GRID",Zx="WEBVTT",$x="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));}