@castlabs/prestoplay 6.14.0 → 6.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +113 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +550 -529
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +74 -73
  10. package/cjs/cl.externs.js +191 -64
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -68
  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 +290 -275
  17. package/cjs/cl.muxdata.js +15 -15
  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 +72 -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 +89 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +457 -438
  37. package/cl.crypto.js +9 -9
  38. package/cl.dash.js +70 -68
  39. package/cl.externs.js +187 -64
  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 +255 -240
  46. package/cl.muxdata.js +13 -13
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +11 -11
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +15 -15
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/clpp.styles.css +2 -0
  61. package/package.json +1 -1
  62. package/typings.d.ts +387 -90
package/cl.muxdata.js CHANGED
@@ -1,13 +1,13 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Zw=function(a){switch(a.type){case 1:return Ww;case 2:return Xw;case 3:return Yw}},ax=function(a){const b=Object.keys(a).find(c=>$w.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},cx=function(a){let b={debug:!0,data:bx(a)};a.f&&a.f.muxOptionsOverride&&_.yg(a.f.muxOptionsOverride)&&(b=_.ug(b,a.f.muxOptionsOverride));b=_.ug(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.g.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager();const f=
2
- a.m.getSurface();var e={player_is_paused:a.m.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){const k=new _.dl(c.url);e.video_source_url=_.Mi(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().ka(),
3
- c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.g.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.ja())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},dx=function(a){_.Ug(a.a);a.j.Cd(a.F);a.j.rf(a.C)},bx=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.pa,player_software_name:_.pa,player_software_version:_.da,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
- player_mux_plugin_version:_.da};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},ex=function(a){a.a.on(a.m,_.Cf,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.Cf,b)});a.a.on(a.m,_.Je,()=>a.emit(_.Je));a.a.on(a.m,_.Jc,a.G.bind(a));a.a.on(a.m,_.sf,a.I.bind(a));a.a.on(a.m,_.Lf,()=>a.emit(_.lf));a.a.on(a.m,_.Kf,()=>a.emit(_.kf));a.a.on(a.m,_.Nd,a.H.bind(a));a.a.on(a.m,_.Wb,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Xb,()=>a.emit("adbreakend"));a.a.on(a.m,_.jc,()=>
5
- {a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.fc,()=>a.emit("adpause"));a.a.on(a.m,_.hc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.kc,()=>a.emit("adended"));a.a.on(a.m,_.bc,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.ec,()=>a.emit("admidpoint"));a.a.on(a.m,_.lc,()=>a.emit("adthirdquartile"));a.j.Hc(a.F);a.j.De(a.C);a.a.on(a.m,_.Nd,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;
6
- var d=new _.dl(b.uris[b.uriIndex]);b={request_start:c,request_type:Zw(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.dl(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:Zw(c),request_hostname:f.a,request_error:`${Zw(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
- a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},fx=function(a){return!_.B(a)&&typeof a.init===_.Qd&&typeof a.emit===_.Qd},Ww="manifest",Xw="media",Yw="encryption",$w=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var gx=class{constructor(a,b){this.m=a;this.o=this.f=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.ir;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.J.bind(this);this.C=this.K.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.h){try{this.h=!0,this.w.init(this.B,cx(this))}catch(d){throw this.h=!1,dx(this),new _.H(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=bx(this),this.emit("videochange",
8
- a),this.l=!1);ex(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(dx(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.xd);this.A?this.g.debug(_.ha):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.H(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.g.debug(_.we);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ka())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Ae);
9
- switch(a.detail.currentState){case _.pn:this.m.getConfiguration().autoplay&&this.emit(_.Je);break;case _.rn:this.emit(_.Qe);break;case _.qn:this.emit(_.Fe);break;case _.fn:this.emit(_.Md)}}H(a){this.g.debug(_.xe);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.G){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;
10
- this.emit(_.Nd,{player_error_code:a.code,player_error_message:b})}}J(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.dl(b.uris[b.uriIndex]);a={request_start:g,request_type:Zw(b),request_hostname:d.a,request_id:ax(e),request_bytes_loaded:f,request_response_start:h,
11
- request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Mi(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var hx=class extends _.kt{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.R("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new gx(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.vg(c.muxdata);try{var d=[];typeof c===_.ve&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.H(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.B(f.muxdata)&&typeof f.muxdata===_.ve){const g=f.muxdata;d=fx(g.muxLib)?g.muxLib:window.mux;if(!fx(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
- this.a=!1;const h=new _.H(1,9,9301);this.U(a,h)}}else this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,this.U(a,f)}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.m=this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}emit(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&this.U(this.m,c),c;}}U(a,b){a.trigger(new _.F(_.Nd,{detail:b}))}};
13
- _.z("clpp.muxdata.MuxDataPlugin",hx);hx.prototype.emit=hx.prototype.emit;hx.Id="mux";_.so(new class{create(){return new hx}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Wx=function(a){switch(a.type){case 1:return Tx;case 2:return Ux;case 3:return Vx}},Yx=function(a){const b=Object.keys(a).find(c=>Xx.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},$x=function(a){let b={debug:!0,data:Zx(a)};a.f&&a.f.muxOptionsOverride&&_.Og(a.f.muxOptionsOverride)&&(b=_.Kg(b,a.f.muxOptionsOverride));b=_.Kg(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.h.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager();const f=
2
+ a.m.getSurface();var e={player_is_paused:a.m.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){const k=new _.El(c.url);e.video_source_url=_.gj(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().ka(),
3
+ c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.h.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.ja())&&d.language&&(e.player_language_code=d.language)}return e}});a.h.debug("Mux SDK options",b);return b},ay=function(a){_.kh(a.a);a.j.Hd(a.F);a.j.Ef(a.C)},Zx=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.ra,player_software_name:_.ra,player_software_version:_.fa,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
+ player_mux_plugin_version:_.fa};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},by=function(a){a.a.on(a.m,_.Sf,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.Sf,b)});a.a.on(a.m,_.Re,()=>a.emit(_.Re));a.a.on(a.m,_.Qc,a.G.bind(a));a.a.on(a.m,_.If,a.I.bind(a));a.a.on(a.m,_.fg,()=>a.emit(_.Bf));a.a.on(a.m,_.eg,()=>a.emit(_.Af));a.a.on(a.m,_.Vd,a.H.bind(a));a.a.on(a.m,_.bc,()=>a.emit("adbreakstart"));a.a.on(a.m,_.cc,()=>a.emit("adbreakend"));a.a.on(a.m,_.pc,()=>
5
+ {a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.lc,()=>a.emit("adpause"));a.a.on(a.m,_.nc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.qc,()=>a.emit("adended"));a.a.on(a.m,_.hc,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.kc,()=>a.emit("admidpoint"));a.a.on(a.m,_.rc,()=>a.emit("adthirdquartile"));a.j.Gc(a.F);a.j.Ne(a.C);a.a.on(a.m,_.Vd,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;
6
+ var d=new _.El(b.uris[b.uriIndex]);b={request_start:c,request_type:Wx(b),request_hostname:d.a};a.h.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.El(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:Wx(c),request_hostname:f.a,request_error:`${Wx(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
+ a.h.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},cy=function(a){return!_.z(a)&&typeof a.init===_.Yd&&typeof a.emit===_.Yd},Tx="manifest",Ux="media",Vx="encryption",Xx=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var dy=class{constructor(a,b){this.m=a;this.o=this.f=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.as;this.h=b;this.A=this.l=this.g=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.J.bind(this);this.C=this.K.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.g){try{this.g=!0,this.w.init(this.B,$x(this))}catch(d){throw this.g=!1,ay(this),new _.G(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=Zx(this),this.emit("videochange",
8
+ a),this.l=!1);by(this)}release(){this.h.debug("release()");this.l?this.h.debug(_.ja):(ay(this),this.l=!0,this.o=this.f=null)}destroy(){this.h.debug(_.Ed);this.A?this.h.debug(_.ia):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.G(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.h.debug(_.Ee);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ia())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.h.debug(_.Ie);
9
+ switch(a.detail.currentState){case _.Rn:this.m.getConfiguration().autoplay&&this.emit(_.Re);break;case _.Tn:this.emit(_.bf);break;case _.Sn:this.emit(_.Ne);break;case _.In:this.emit(_.Ud)}}H(a){this.h.debug(_.Fe);if(this.g&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.E){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;
10
+ this.emit(_.Vd,{player_error_code:a.code,player_error_message:b})}}J(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.El(b.uris[b.uriIndex]);a={request_start:g,request_type:Wx(b),request_hostname:d.a,request_id:Yx(e),request_bytes_loaded:f,request_response_start:h,
11
+ request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.gj(d)};this.h.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var ey=class extends _.hu{constructor(){super();this.f=this.m=null;this.a=!1;this.h=new _.Q("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new dy(a,this.h)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.Lg(c.muxdata);try{var d=[];typeof c===_.De&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.G(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.z(f.muxdata)&&typeof f.muxdata===_.De){const g=f.muxdata;d=cy(g.muxLib)?g.muxLib:window.mux;if(!cy(d)){this.h.warn("Mux SDK is not loaded. Will do nothing.");
12
+ this.a=!1;const h=new _.G(1,9,9301);this.V(a,h)}}else this.h.warn("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,this.V(a,f)}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.m=this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}emit(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&this.V(this.m,c),c;}}V(a,b){a.trigger(new _.C(_.Vd,{detail:b}))}};
13
+ _.x("clpp.muxdata.MuxDataPlugin",ey);ey.prototype.emit=ey.prototype.emit;ey.Id="mux";_.Vo(new class{create(){return new ey}});};f.call(g, window);
package/cl.onboard.js CHANGED
@@ -1,4 +1,4 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Vw=function(a,b){let c=b.baseUrl;_.Zh(c,"/")||(c+="/");const d=g=>g&&(_.Yh(g,"https://")||_.Yh(g,"http://")||_.Yh(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.as(a);a.Ma(_.rd,{licenseUrl:e,videoRobustness:[_.zb,void 0],audioRobustness:[_.yb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.sl,licenseResponse:_.tl}});a.Ma(_.nd,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.vl,licenseResponse:_.wl,extractContentId:_.xl,certificateRequest:_.yl}});a.Ma(_.pd,{licenseUrl:f,modifiers:{licenseRequest:_.sl}});_.Hk(a)};
3
- _.z("clpp.onboard.OnboardComponent",class extends _.Ks{constructor(){super();this.g=new _.R("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Gk[a];this.j.clear()}h(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),Vw(b,a),this.j.add(b))}id(){return"onboard"}});
4
- _.z("clpp.onboard.register",Vw);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Sx=function(a,b){let c=b.baseUrl;_.ri(c,"/")||(c+="/");const d=g=>g&&(_.qi(g,"https://")||_.qi(g,"http://")||_.qi(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.Ss(a);a.La(_.yd,{licenseUrl:e,videoRobustness:[_.Eb,void 0],audioRobustness:[_.Db,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Wl,licenseResponse:_.Xl}});a.La(_.ud,{licenseUrl:b,
2
+ certificateUrl:b,modifiers:{licenseRequest:_.Zl,licenseResponse:_.$l,extractContentId:_.am,certificateRequest:_.bm}});a.La(_.wd,{licenseUrl:f,modifiers:{licenseRequest:_.Wl}});_.il(a)};
3
+ _.x("clpp.onboard.OnboardComponent",class extends _.Ft{constructor(){super();this.h=new _.Q("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.hl[a];this.j.clear()}g(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.h.info(`Registering the DRMtoday Onboard environment, name='${b}'`),Sx(b,a),this.j.add(b))}id(){return"onboard"}});
4
+ _.x("clpp.onboard.register",Sx);};f.call(g, window);
package/cl.persistent.js CHANGED
@@ -1,11 +1,11 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Fw="A persistent DRM session already exists for: ",Gw="No DRM configuration.",Hw="clpp.persistent",Iw="clpp.persistent.SimpleSessionStorage",Jw=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},Lw=function(a,b){a.H=Kw;a.I=[];a.C=!0;return _.tm(a,b)},Nw=function(a,b,c,d,e,f){a.H=Mw;const g=new Map,h=_.em(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Ce,persistentState:_.gf,sessionTypes:[_.He],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,
2
- distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.sm(a,g)},Ow=function(a,b){return _.x(function*(){const c=yield _.Jm(a,b);if(c){var d=[],e=a.f.get(c);e&&a.A&&(e.ob=new _.wm,d.push(e.ob));a.g.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.g.debug("Ignoring attempt to remove missing session",b)})},Pw=function(a){a=a.f.keys();a=Jw(a,b=>b.sessionId);return Array.from(a)},
3
- Qw=function(a,b){const c=_.Jk(a),d=_.pk({drm:a});d.drm=a;a=new _.An({Ab:b,onError:()=>{},ke:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,xc:()=>null});a.h=c;return a},Tw=function(a,b,c){return _.x(function*(){const d=Rw;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Sw.debug(Fw,e);else{var g=Qw(a,c);try{yield Lw(g,b);yield _.Hm(g);yield _.Km(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.ij(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));
4
- f={sessionIds:Pw(g),keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Sw.error(`Error while persisting DRM session ${e}`),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Sw.debug(Gw)})},Kw=1,Mw=2,Uw=class{constructor(){this.g=new _.R(Iw)}store(a,b){return _.x(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):
5
- null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){const b=this;return _.x(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),
6
- f=JSON.parse(e.sessionIds),g=e.audioCapabilities||[],h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.g.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.x(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.x(function*(){window.localStorage.clear()})}getName(){return Iw}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.zg(a.store)||c.push("store"),_.zg(a.get)||c.push("get"),_.zg(a.delete)||c.push("delete"),_.zg(a.clear)||c.push("clear"),_.zg(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Sw.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});Rw=a});
7
- _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=Rw,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.un(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(Gw);var g=b.offlineId;if(typeof g!==_.vf||!g.length)throw e("Missing offline id.");if(yield d.get(g))Sw.debug(Fw,g);else{var h=_.pk();d=new _.po;g=[];for(var k of c){const l=new k;_.sk(l.id())||(l.f(),_.uk(l),g.push(l))}k=null;try{k=yield _.qq(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
- const l=yield k.start(f.url,{networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.H(_.G,4,4014));const m=_.oq(l.periods);yield Tw(b,m,d)}catch(l){if(l instanceof _.H&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.rk.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
- _.z("clpp.persistent.removeLicense",function(a){return _.x(function*(){var b=Rw;if(_.Bg(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.po,c=Qw(e.drmConfig,d),yield Nw(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Hm(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield Ow(c,f);Sw.debug("successfully removed session with id",f)}))),yield b.delete(a)):Sw.debug("No persistent DRM session found")}catch(e){throw Sw.error("Failed to remove session"),
10
- new _.H(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else Sw.warn("Invalid offlineId")})});var Rw=new Uw,Sw=new _.R(Hw);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Ks{constructor(){super();this.g=new _.R(Hw)}id(){return _.Ge}l(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield Tw(d,b,e),a.trigger(new _.F(_.Gd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.x(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
- const c=Rw;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.g.debug(`No offline session found for ${a}`);return[]}catch(d){return b.g.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Cx="A persistent DRM session already exists for: ",Dx="No DRM configuration.",Ex="clpp.persistent",Fx="clpp.persistent.SimpleSessionStorage",Gx=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},Ix=function(a,b){a.I=Hx;a.J=[];a.C=!0;return _.Vm(a,b)},Kx=function(a,b,c,d,e,f){a.I=Jx;const g=new Map,h=_.Fm(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Ke,persistentState:_.tf,sessionTypes:[_.Pe],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,
2
+ distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Um(a,g)},Lx=function(a,b){return _.w(function*(){const c=yield _.ln(a,b);if(c){var d=[],e=a.f.get(c);e&&a.A&&(e.pb=new _.Ym,d.push(e.pb));a.h.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.h.debug("Ignoring attempt to remove missing session",b)})},Mx=function(a){a=a.f.keys();a=Gx(a,b=>b.sessionId);return Array.from(a)},
3
+ Nx=function(a,b){const c=_.kl(a),d=_.Qk({drm:a});d.drm=a;a=new _.bo({nb:b,onError:()=>{},oe:()=>{},ne:()=>{},onEvent:()=>{},getConfiguration:()=>d,xc:()=>null});a.g=c;return a},Qx=function(a,b,c){return _.w(function*(){const d=Ox;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Px.debug(Cx,e);else{var g=Nx(a,c);try{yield Ix(g,b);yield _.jn(g);yield _.mn(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Ij(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:Mx(g),
4
+ keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Px.error(`Error while persisting DRM session ${e}`),new _.G(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Px.debug(Dx)})},Hx=1,Jx=2,Rx=class{constructor(){this.h=new _.Q(Fx)}store(a,b){return _.w(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);
5
+ const e=JSON.stringify(b.audioCapabilities),f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){const b=this;return _.w(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),f=JSON.parse(e.sessionIds),
6
+ g=e.audioCapabilities||[],h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.h.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return Fx}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.Pg(a.store)||c.push("store"),_.Pg(a.get)||c.push("get"),_.Pg(a.delete)||c.push("delete"),_.Pg(a.clear)||c.push("clear"),_.Pg(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Px.warn("Invalid session storage implementation"),new _.G(1,6,6202,{missingMethods:b});Ox=a});
7
+ _.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=Ox,e=(l,m)=>new _.G(1,6,6200,l,m);const f=_.Wn(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(Dx);var g=b.offlineId;if(typeof g!==_.Lf||!g.length)throw e("Missing offline id.");if(yield d.get(g))Px.debug(Cx,g);else{var h=_.Qk();d=new _.So;g=[];for(var k of c){const l=new k;_.Tk(l.id())||(l.f(),_.Vk(l),g.push(l))}k=null;try{k=yield _.gr(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
+ const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.G(_.E,4,4014));const m=_.er(l.periods);yield Qx(b,m,d)}catch(l){if(l instanceof _.G&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.Sk.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
+ _.x("clpp.persistent.removeLicense",function(a){return _.w(function*(){var b=Ox;if(_.Rg(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.So,c=Nx(e.drmConfig,d),yield Kx(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.jn(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield Lx(c,f);Px.debug("successfully removed session with id",f)}))),yield b.delete(a)):Px.debug("No persistent DRM session found")}catch(e){throw Px.error("Failed to remove session"),
10
+ new _.G(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else Px.warn("Invalid offlineId")})});var Ox=new Rx,Px=new _.Q(Ex);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.Ft{constructor(){super();this.h=new _.Q(Ex)}id(){return _.Oe}l(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().drm;if(d){c.h.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield Qx(d,b,e),a.trigger(new _.C(_.Nd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.h.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.w(function*(){b.h.debug(`Getting EME session IDs for ${a}`);
11
+ const c=Ox;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.h.debug(`No offline session found for ${a}`);return[]}catch(d){return b.h.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
package/cl.playlist.js CHANGED
@@ -1,5 +1,5 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Cw=function(a,b){return 0<=b&&b<a.a.length},Dw=function(a){a.trigger(new _.F(_.Se))},Ew=class extends _.Wr{on(a,b,c){return super.on(a,b,c)}one(a,b,c){return super.one(a,b,c)}off(a,b){return super.off(a,b)}constructor(a,b){b=void 0===b?()=>Promise.resolve():b;super();this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.hc.bind(this)}getPosition(){return this.f}qg(){return this.a}Pc(){return 0<this.a.length&&Cw(this,this.f)?this.a[this.f]:null}rg(){const a=this.f+1;return 0<
2
- this.a.length&&Cw(this,a)?this.a[a]:null}xg(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Md,this.j),this.sd(this.f,!0))}stop(){this.h=!1;this.m.off(_.Md,this.j)}hc(){this.next()}next(){const a=this;return _.x(function*(){yield a.sd(Math.min(a.a.length-1,a.f+1))})}Og(){const a=this;return _.x(function*(){yield a.sd(Math.max(0,a.f-1))})}sd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&Cw(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Pc();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
- c.trigger(new _.F(_.Re,{item:d})))}})}append(a){this.a.push(a);Dw(this)}wg(a,b){if(0<=b&&b<=this.a.length){const c=this.Pc();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Dw(this)}}remove(a){if(0<this.a.length&&Cw(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Dw(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;Dw(this)}};_.z("clpp.Playlist",Ew);Ew.prototype.clear=Ew.prototype.clear;Ew.prototype.remove=Ew.prototype.remove;Ew.prototype.insert=Ew.prototype.wg;
4
- Ew.prototype.append=Ew.prototype.append;Ew.prototype.goTo=Ew.prototype.sd;Ew.prototype.previous=Ew.prototype.Og;Ew.prototype.next=Ew.prototype.next;Ew.prototype.onEnded=Ew.prototype.hc;Ew.prototype.stop=Ew.prototype.stop;Ew.prototype.start=Ew.prototype.start;Ew.prototype.isStarted=Ew.prototype.xg;Ew.prototype.getUpcoming=Ew.prototype.rg;Ew.prototype.getCurrent=Ew.prototype.Pc;Ew.prototype.getQueue=Ew.prototype.qg;Ew.prototype.getPosition=Ew.prototype.getPosition;Ew.prototype.off=Ew.prototype.off;
5
- Ew.prototype.one=Ew.prototype.one;Ew.prototype.on=Ew.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var zx=function(a,b){return 0<=b&&b<a.a.length},Ax=function(a){a.trigger(new _.C(_.df))},Bx=class extends _.Ns{on(a,b,c){return super.on(a,b,c)}one(a,b,c){return super.one(a,b,c)}off(a,b){return super.off(a,b)}constructor(a,b){b=void 0===b?()=>Promise.resolve():b;super();this.m=a;this.l=b;this.f=0;this.a=[];this.g=!1;this.j=this.ic.bind(this)}getPosition(){return this.f}Cg(){return this.a}Pc(){return 0<this.a.length&&zx(this,this.f)?this.a[this.f]:null}Dg(){const a=this.f+1;return 0<
2
+ this.a.length&&zx(this,a)?this.a[a]:null}Mg(){return this.g}start(){this.g||(this.g=!0,this.m.on(_.Ud,this.j),this.vd(this.f,!0))}stop(){this.g=!1;this.m.off(_.Ud,this.j)}ic(){this.next()}next(){const a=this;return _.w(function*(){yield a.vd(Math.min(a.a.length-1,a.f+1))})}dh(){const a=this;return _.w(function*(){yield a.vd(Math.max(0,a.f-1))})}vd(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&zx(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Pc();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
+ c.trigger(new _.C(_.cf,{item:d})))}})}append(a){this.a.push(a);Ax(this)}Lg(a,b){if(0<=b&&b<=this.a.length){const c=this.Pc();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Ax(this)}}remove(a){if(0<this.a.length&&zx(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Ax(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;Ax(this)}};_.x("clpp.Playlist",Bx);Bx.prototype.clear=Bx.prototype.clear;Bx.prototype.remove=Bx.prototype.remove;Bx.prototype.insert=Bx.prototype.Lg;
4
+ Bx.prototype.append=Bx.prototype.append;Bx.prototype.goTo=Bx.prototype.vd;Bx.prototype.previous=Bx.prototype.dh;Bx.prototype.next=Bx.prototype.next;Bx.prototype.onEnded=Bx.prototype.ic;Bx.prototype.stop=Bx.prototype.stop;Bx.prototype.start=Bx.prototype.start;Bx.prototype.isStarted=Bx.prototype.Mg;Bx.prototype.getUpcoming=Bx.prototype.Dg;Bx.prototype.getCurrent=Bx.prototype.Pc;Bx.prototype.getQueue=Bx.prototype.Cg;Bx.prototype.getPosition=Bx.prototype.getPosition;Bx.prototype.off=Bx.prototype.off;
5
+ Bx.prototype.one=Bx.prototype.one;Bx.prototype.on=Bx.prototype.on;};f.call(g, window);
package/cl.simid.js CHANGED
@@ -1,13 +1,13 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var lw="No surface found. Can not attach frame!",mw="SIMID:Media:timeupdate",nw="Starting creative",ow=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},rw=function(a,b){return new Promise((c,d)=>{new pw(a.j,c,d,b);qw(a,b)})},sw=function(a){const b=ow(a,"SIMID:Player:startCreative",void 0);rw(a,b).then(()=>{var c=a.f;c.g.info(nw);c.m.trigger(new _.F(_.nf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
- c)})},uw=function(a,b){_.x(function*(){a.h=b.sessionId;tw(a,b);try{{var c=a.f;const f=c.getSurface(),g=c.getContainer();var d={environmentData:{videoDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:c.m.isMuted()||
3
- !1,volume:c.m.getVolume()||0,navigationSupport:"adHandles",closeButtonSupport:"adHandles",nonlinearDuration:c.f.duration},creativeData:{adParameters:c.f.adParameters||"",clickThruUri:"",clickThruUrl:""}}}{const f=ow(a,"SIMID:Player:init",d);var e=rw(a,f)}yield e;a.g.info("Player Init acknowledged");a.f.g.info("SIMID Player initialized")}catch(f){a.g.error("Error while initializing",f),a.f.g.error("Error while initializing SIMID player: ",f),a.unload()}})},tw=function(a,b){qw(a,ow(a,"resolve",{messageId:b.messageId,
4
- value:void 0}))},qw=function(a,b){a.h?(b.type!==mw&&a.g.info(`Posting message [${b.messageId}] '${b.type}':`,b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn(`WARNING: no session available to send message '${b.type}'`)},vw=function(a,b,c){return new ResizeObserver(()=>{if(a.a.h){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};
5
- e=ow(d,"SIMID:Player:resize",e);qw(d,e)}})},ww=function(a,b){a.g.info("SIMID Session created");a.a=b},xw=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(()=>{a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height=
6
- "";a.h=!1;a.m.trigger(new _.F(_.of))},yw=function(a,b){var c=a.getContainer();a=c.clientWidth;c=c.clientHeight;return{top:`${b.y/c*100}%`,left:`${b.x/a*100}%`,width:`${b.width/a*100}%`,height:`${b.height/c*100}%`}},zw=class{constructor(a){this.f=a;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";this.a.style.border=_.ue;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
- _.ue;this.a.style.overflow=_.Sd;this.a.classList.add(_.Xc);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.vf?JSON.parse(b):b:null))if(b.type)switch(this.g.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":uw(this,b);break;case "resolve":b=b.args;var c=this.j.get(b.messageId);c&&c.resolve(b);break;case "reject":b=b.args;(c=this.j.get(b.messageId))&&c.reject(b);break;case "SIMID:Creative:requestResize":c=this.f;var d=b.args;c.g.info("Creative requested resize",
8
- d);if(c.m&&c.m.getSurface()&&c.m.getSurface().getMedia()&&d.mediaDimensions){c.h?c.m.getSurface().getMedia().style.transition="":(c.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",c.h=!0);const e=yw(c,d.mediaDimensions);c.m.getSurface().getMedia().style.left=e.left;c.m.getSurface().getMedia().style.top=e.top;c.m.getSurface().getMedia().style.width=e.width;c.m.getSurface().getMedia().style.height=e.height}d.creativeDimensions&&(d=yw(c,d.creativeDimensions),c.a.a.style.left=
9
- d.left,c.a.a.style.top=d.top,c.a.a.style.width=d.width,c.a.a.style.height=d.height);tw(this,b)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.R("clpp.simid.SimidPlayer");ww(this.f,this)}load(a){window.addEventListener(_.me,this.o);this.h="";this.l=0;const b=this.f.url();this.g.info(`Loading "${b}" as src of iFrame`);this.a.src=b;this.g.info("Attaching iFrame");a.appendChild(this.a)}unload(){xw(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.me,
10
- this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},pw=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.h=d;this.a=null;this.f.set(d.messageId,this);0<=e&&(this.a=setTimeout(()=>{this.resolve()},e))}resolve(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);this.j(a)}};var Bw=class extends _.kt{constructor(){super();this.g=new _.R("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.A.bind(this);this.f=null;this.o=!1}id(){return"simid"}onPlayerCreated(a){this.g.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.h&&this.h.release();this.h=new Aw(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.g.info(`Setting up SIMID plugin for ${this.l.length} creatives`),
11
- b=this.m.getSurface()){this.g.info("Creating new session");this.a=new zw(this.h);var c=b.getContainer();this.j=vw(this,c,b);this.j.observe(c);a.on(_.Cf,this.w)}else this.g.warn(lw)}A(){var a=this.m.getPosition();a:if(this.f&&a<this.f.startTime+this.f.duration)var b=this.f;else{for(b=0;b<this.l.length;b++){var c=this.l[b];const d=c.startTime+c.duration;if(a>=c.startTime-(c.preload||5)&&a<d){b=c;break a}}b=null}b?b===this.f?(b=b.startTime,this.a&&(c=a>=b,!this.o&&c&&(sw(this.a),this.o=!0,this.g.info(nw)),
12
- c&&(c=this.a,qw(c,ow(c,mw,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(lw),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)}onPlayerWillRelease(a){super.onPlayerWillRelease(a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.Cf,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Aw=class{constructor(a){this.m=a;this.a=null;this.g=new _.R("clpp.simid.Loader");
13
- this.h=!1;this.f=null}release(){this.g.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.H(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.H(1,10,10100,"No surface");return a}url(){return this.f?this.f.url:""}};_.so(new class{create(){return new Bw}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var ix="No surface found. Can not attach frame!",jx="SIMID:Media:timeupdate",kx="Starting creative",lx=function(a,b,c){return{type:b,sessionId:a.g,messageId:a.l++,timestamp:Date.now(),args:c}},ox=function(a,b){return new Promise((c,d)=>{new mx(a.j,c,d,b);nx(a,b)})},px=function(a){const b=lx(a,"SIMID:Player:startCreative",void 0);ox(a,b).then(()=>{var c=a.f;c.h.info(kx);c.m.trigger(new _.C(_.Df));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.h.error("Error while starting creative",
2
+ c)})},rx=function(a,b){_.w(function*(){a.g=b.sessionId;qx(a,b);try{{var c=a.f;const f=c.getSurface(),g=c.getContainer();var d={environmentData:{videoDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:c.m.isMuted()||
3
+ !1,volume:c.m.getVolume()||0,navigationSupport:"adHandles",closeButtonSupport:"adHandles",nonlinearDuration:c.f.duration},creativeData:{adParameters:c.f.adParameters||"",clickThruUri:"",clickThruUrl:""}}}{const f=lx(a,"SIMID:Player:init",d);var e=ox(a,f)}yield e;a.h.info("Player Init acknowledged");a.f.h.info("SIMID Player initialized")}catch(f){a.h.error("Error while initializing",f),a.f.h.error("Error while initializing SIMID player: ",f),a.unload()}})},qx=function(a,b){nx(a,lx(a,"resolve",{messageId:b.messageId,
4
+ value:void 0}))},nx=function(a,b){a.g?(b.type!==jx&&a.h.info(`Posting message [${b.messageId}] '${b.type}':`,b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.h.warn(`WARNING: no session available to send message '${b.type}'`)},sx=function(a,b,c){return new ResizeObserver(()=>{if(a.a.g){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};
5
+ e=lx(d,"SIMID:Player:resize",e);nx(d,e)}})},tx=function(a,b){a.h.info("SIMID Session created");a.a=b},ux=function(a){a.h.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(()=>{a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height=
6
+ "";a.g=!1;a.m.trigger(new _.C(_.Ef))},vx=function(a,b){var c=a.getContainer();a=c.clientWidth;c=c.clientHeight;return{top:`${b.y/c*100}%`,left:`${b.x/a*100}%`,width:`${b.width/a*100}%`,height:`${b.height/c*100}%`}},wx=class{constructor(a){this.f=a;this.g="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";this.a.style.border=_.Ce;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
+ _.Ce;this.a.style.overflow=_.$d;this.a.classList.add(_.dd);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.Lf?JSON.parse(b):b:null))if(b.type)switch(this.h.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":rx(this,b);break;case "resolve":b=b.args;var c=this.j.get(b.messageId);c&&c.resolve(b);break;case "reject":b=b.args;(c=this.j.get(b.messageId))&&c.reject(b);break;case "SIMID:Creative:requestResize":c=this.f;var d=b.args;c.h.info("Creative requested resize",
8
+ d);if(c.m&&c.m.getSurface()&&c.m.getSurface().getMedia()&&d.mediaDimensions){c.g?c.m.getSurface().getMedia().style.transition="":(c.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",c.g=!0);const e=vx(c,d.mediaDimensions);c.m.getSurface().getMedia().style.left=e.left;c.m.getSurface().getMedia().style.top=e.top;c.m.getSurface().getMedia().style.width=e.width;c.m.getSurface().getMedia().style.height=e.height}d.creativeDimensions&&(d=vx(c,d.creativeDimensions),c.a.a.style.left=
9
+ d.left,c.a.a.style.top=d.top,c.a.a.style.width=d.width,c.a.a.style.height=d.height);qx(this,b)}else this.h.warn("WARNING: received message without 'type' property")};this.h=new _.Q("clpp.simid.SimidPlayer");tx(this.f,this)}load(a){window.addEventListener(_.ve,this.o);this.g="";this.l=0;const b=this.f.url();this.h.info(`Loading "${b}" as src of iFrame`);this.a.src=b;this.h.info("Attaching iFrame");a.appendChild(this.a)}unload(){ux(this.f);this.g=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.ve,
10
+ this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},mx=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.g=d;this.a=null;this.f.set(d.messageId,this);0<=e&&(this.a=setTimeout(()=>{this.resolve()},e))}resolve(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.g.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.g.messageId);this.j(a)}};var yx=class extends _.hu{constructor(){super();this.h=new _.Q("clpp.simid.Plugin");this.g=this.a=this.m=null;this.l=[];this.j=null;this.w=this.A.bind(this);this.f=null;this.o=!1}id(){return"simid"}onPlayerCreated(a){this.h.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.g&&this.g.release();this.g=new xx(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.h.info(`Setting up SIMID plugin for ${this.l.length} creatives`),
11
+ b=this.m.getSurface()){this.h.info("Creating new session");this.a=new wx(this.g);var c=b.getContainer();this.j=sx(this,c,b);this.j.observe(c);a.on(_.Sf,this.w)}else this.h.warn(ix)}A(){var a=this.m.getPosition();a:if(this.f&&a<this.f.startTime+this.f.duration)var b=this.f;else{for(b=0;b<this.l.length;b++){var c=this.l[b];const d=c.startTime+c.duration;if(a>=c.startTime-(c.preload||5)&&a<d){b=c;break a}}b=null}b?b===this.f?(b=b.startTime,this.a&&(c=a>=b,!this.o&&c&&(px(this.a),this.o=!0,this.h.info(kx)),
12
+ c&&(c=this.a,nx(c,lx(c,jx,{currentTime:a-b}))))):((a=this.m.getSurface())||this.h.warn(ix),a=a.getContainer(),this.f=b,this.o=!1,this.h.info("Loading session"),this.g.f=b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)}onPlayerWillRelease(a){super.onPlayerWillRelease(a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.Sf,this.w),this.f&&(this.a.unload(),this.f=this.g.f=null))}},xx=class{constructor(a){this.m=a;this.a=null;this.h=new _.Q("clpp.simid.Loader");
13
+ this.g=!1;this.f=null}release(){this.h.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.h.error("No player container found. Can not create SIMID init data"),new _.G(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.h.error("No player surface found. Can not create SIMID init data"),new _.G(1,10,10100,"No surface");return a}url(){return this.f?this.f.url:""}};_.Vo(new class{create(){return new yx}});};f.call(g, window);
package/cl.smooth.js CHANGED
@@ -1,59 +1,59 @@
1
- import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var wK="Full MP4 box must have flags defined",xK="clpp.smooth.SmoothMP4Processor",yK="codecPrivateData",zK=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.N(a,c);_.N(a,b)},AK=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Mk()}},BK=function(a,b){AK(a,b>>16&255);AK(a,b>>8&255);AK(a,b&255)},CK=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Mk()}},DK=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Mk()}},EK=function(a,b){try{a.f.setInt16(a.a,
2
- b,a.h),a.a+=2}catch(c){_.Mk()}},FK=function(a,b){if(void 0!=b){var c=new Uint8Array(b);const d=Math.min(a.length,b);let e=0;for(;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}b=new Uint8Array(a.length);for(c=0;c<a.length;++c)b[c]=a.charCodeAt(c);return b},GK=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},HK=function(a,b,c,d){c=b.Ue[c];b=b.hh;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
3
- String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.by([a],[b])[0]},IK=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.w?c=["maxWidth","maxHeight","bitrate",yK,"fourCC"]:a.type===_.p&&(c=["bitrate",yK,"channels","bitsPerSample","samplingRate","fourCC"]);return _.Dg(a,b,c,["id","segmentIndex"])},JK=function(a,b,c){const d=c.kd.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Na:null,Ob:null,width:NaN,height:NaN,Hb:null,Zc:NaN,
4
- sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.Na=[_.hi(d[1])];a.Ob=[_.hi(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.Hb=_.hi(c.kd),a.sampleSize=c.Tf||16,a.Zc=c.Zc,a.channelCount=c.Me}return a},KK=function(a,b){return a.filter(c=>c.type===b)},LK=function(a,b){a=a.exec(b);return null==a||""==a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},SK=function(a,b,c){var d=null;if(MK.test(a)){{a=MK.exec(a);d=Number(a[1]);const e=
5
- Number(a[2]);let 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 NK.test(a)?d=LK(NK,a):OK.test(a)?d=LK(OK,a):PK.test(a)?(a=PK.exec(a),d=Number(a[1])/c.frameRate):QK.test(a)?(a=QK.exec(a),d=Number(a[1])/c.a):RK.test(a)&&(d=LK(RK,a));c=d;d=c+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},TK=function(a){let b=
6
- 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.hl(b)},$K=function(a,b,c){a:{var d=[_.rd,_.pd];for(e of d)if((d=c.qd(e))&&d.keyId){var e=d.keyId;break a}_.C(xK,"Could not get default Key ID for DRM init data!");e=null}c=new UK("xxxx");a.type===_.w?c=new VK(a.width,a.height):c=new WK(a.channelCount,a.sampleSize,a.Zc);a=new XK;a.h=1;a.j=8;a.o=e||"00000000000000000000000000000000";a=(new UK("schi")).append([a]);b=(new UK(_.pf)).append([new YK(b),new ZK(_.Sc,65536),a]);c.append([b]);return c},
7
- CL=function(a,b){var c=b.vd(),d=new aL(a.timescale,a.duration,a.id),e=(new bL).append([new cL(a.id)]),f=new dL(a.id,a.duration,a.timescale,a.width,a.height),g=new eL(a.timescale,a.duration);const h=new fL(a.type);var k=null,l=new gL;l.entries=[new hL];var m=new iL;switch(a.type){case _.w:k=new jL(a.Na,a.Ob);c?(a=$K(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new kL(a.width,a.height)).append([k]),m.entries=[a]);k=new lL;break;case _.p:k=new mL(a.Hb),c?(a=$K(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
- (a=(new nL(a.channelCount,a.sampleSize,a.Zc)).append([k]),m.entries=[a]),k=new oL}m=(new pL).append([m,new qL,new rL,new sL,new tL]);l=(new uL).append([l]);l=(new vL).append([k,l,m]);g=(new wL).append([g,h,l]);f=(new xL).append([f,g]);d=(new yL).append([d,f,e]);e=new zL("dash",0,["iso6","mp41","avc1"]);c&&(c=b.qd(_.pd),b=b.qd(_.rd),c&&d.append([new AL("pssh",c.initData,8)]),b&&d.append([new AL("pssh",b.initData,8)]),c||b||_.C(xK,"Could not get PSSH init data!"));b=new BL([e,d]);return _.J(b.write())},
9
- ML=function(a,b){let c,d,e,f,g,h;(new _.fl).L("moof",_.Yk).$("mfhd",k=>{{const l=new DL;l.h=_.P(k.reader);c=l}}).L("traf",_.Yk).$("tfhd",k=>{{const l=k.reader.Ca();if(null===k.flags)throw new _.H(_.G,3,3019,wK);const m=new EL(k.version||0,k.flags||0);m.h=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.Tk(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.B=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.l=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.w=_.P(k.reader));
10
- 0<l-k.reader.getPosition()&&k.flags&32&&(m.o=_.P(k.reader));d=m}}).$("trun",k=>{{var l=k.reader.Ca();if(null===k.flags)throw new _.H(_.G,3,3019,wK);const m=new FL(k.version||0,k.flags||0);m.h=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.l=_.Sk(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.o=_.P(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.h;l++)k.flags&256&&m.w.push(_.P(k.reader)),k.flags&512&&m.sampleSize.push(_.P(k.reader)),k.flags&1024&&m.B.push(_.P(k.reader)),k.flags&
11
- 2048&&(0===k.version?m.j.push(_.P(k.reader)):m.j.push(_.Sk(k.reader)));e=m}}).$("sdtp",k=>{{const l=_.Vk(k.reader,k.reader.Ca());f=new GL("sdtp",k.version||0,k.flags||0,l,0)}}).L("uuid",k=>{var l=_.Vk(k.reader,16);if(_.ji(l,HL)){l=_.P(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new IL(k.version,k.flags);l.j=_.P(k.reader);k.flags&1&&(l.l=_.Qk(k.reader));for(let m=0;m<l.j;m++){const n={df:_.Vk(k.reader,8),Gc:0,we:[]};if(k.flags&2){n.Gc=_.Rk(k.reader);for(let q=0;q<n.Gc;q++){const t={Ke:0,Le:0};
12
- t.Ke=_.Rk(k.reader);t.Le=_.P(k.reader);n.we.push(t)}}l.h.push(n)}g=l}}).L(_.ke,k=>{{const l=new JL;0<k.reader.Ca()?l.h=_.Vk(k.reader,k.reader.Ca()):(_.C(xK,"mdat box is empty!"),l.h=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new KL).append([d,e]);f&&a.append([f]);b.vd()&&g&&a.append([g]);b=(new LL).append([c,a]);return new BL([b,h])},RL=function(a,b,c,d){var e=d.vd(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=ML(b,d);if(null===g)return a.request.contentType===_.u?a.data:
13
- g;d=g.get(_.ke);if(a.request.contentType===_.u){e=d.h.buffer;if(c){e=_.Uh(e);if((e=(new DOMParser).parseFromString(e,_.Bf))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new NL(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0])){f=h.getElementsByTagName("p");for(let t=0,v=f.length;t<v;t++){h=f[t];a=c;b=d;g=["begin",_.Ld];for(let y=0,A=g.length;y<
14
- A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const D=l.length;for(;n<D;n++){var q=l[n].name;if(q=q.match(m)){k=k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[y],SK(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.Vh(e).buffer}else c=e;return c}h=new LL;a=g.get("mfhd");b=new KL;k=g.get("tfhd");m=new OL(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");k.h=1;k.flags&=16777214;k.flags|=131072;b.append([k,
15
- m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.j;m++)k.push(10+6*c.h[m].Gc);else g=8;b.append([c,new PL,new QL(g,k,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new BL([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},SL=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
16
- periodId:null}},TL=function(a){return{initData:_.Sx(_.Rl(a)),initDataType:_.Sc,keyId:a,periodId:null}},UL=function(a,b,c){a=_.Zl(a);c&&a.version!==c&&(a=_.Ux(a,c));return{initData:_.Sx(a),initDataType:_.Sc,keyId:b,periodId:null}},VL=function(a,b){return _.x(function*(){var c=_.ui(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;
17
- c.type=1;c=yield a.D.networkingEngine.fetch(c).P;a.l=c.uri;return c})},cM=function(a,b){let c=null;try{{const ea=new DOMParser;let ab,Na;try{const gb=_.Uh(b);Na=ea.parseFromString(gb.trim(),_.Bf)}catch(gb){throw gb;}Na&&Na.documentElement.tagName==_.Db&&(ab=Na.documentElement);c=ab&&0<ab.getElementsByTagName("parsererror").length?null:ab}}catch(ea){}if(!c)throw a.g.error("Unable to parse manifest"),new _.H(_.G,4,4033,a.l);const d=+WL(a,c,"MajorVersion"),e=+WL(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
18
- 1E7;let g=+WL(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.Ll(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.G,4,4036,a.l);h?(XL(a,YL),a.A=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):XL(a,ZL);a.a={startTime:0,delay:0,duration:g/f,Pd:l/f,Tc:0};if(m){{var n=a.f.playreadyVersion;
19
- const ea=[],ab=_.Ll(m,"ProtectionHeader")[0],Na=_.gi(_.Nl(ab)||""),gb=_.Zl(Na).a;ea.push(SL(_.rd,TL(gb),[gb]));ea.push(SL(_.pd,UL(Na,gb,n),[gb]));var q=ea}a.o=q}{const ea=[],ab=_.Ll(c,"StreamIndex");if(!ab.length)throw a.g.error("No streams found!"),new _.H(_.G,4,4034,a.l);for(let Na=0;Na<ab.length;Na++){{var t=a,v=ab[Na];const gb=WL(t,v,"Type"),yc=+v.getAttribute("Chunks"),lh=v.getAttribute("Subtype"),ae=v.getAttribute("Language")||_.Ff,be=_.Eh(ae),mh=v.getAttribute("Name")||"",Uf=+v.getAttribute(_.db),
20
- Vf=+v.getAttribute(_.cb),zl=WL(t,v,"Url"),mP=+v.getAttribute("TimeScale")||null;{const zc=[],Ri=_.Ll(v,_.tb);for(let ce=0;ce<Ri.length;ce++){{let Ac,Ka,sd;var y=t,A=Ri[ce],D=gb;const Si=+A.getAttribute("Index"),Wf=+WL(y,A,"Bitrate");let Yb=NaN,Xf=NaN,Al=NaN,Sq=NaN,PB=NaN,QB=NaN,RB=NaN;const SB=A.getAttribute("FourCC");switch(D){case _.w:Yb=+WL(y,A,_.cb);Xf=+WL(y,A,_.db);break;case _.p:Sq=+A.getAttribute("Channels")||2,Al=+WL(y,A,"SamplingRate"),QB=+WL(y,A,"AudioTag"),PB=+WL(y,A,"BitsPerSample"),RB=
21
- +WL(y,A,"PacketSize")}let Tq=String(A.getAttribute("CodecPrivateData"));if(D===_.p&&!Tq){{var E=Sq;const TB={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},Bl=TB[Al];if("AACH"===SB){Ka=new Uint8Array(4);const UB=TB[2*Al];Ka[0]=40|Bl>>1;Ka[1]=Bl<<7|E<<3|UB>>1;Ka[2]=UB<<7|8;Ka[3]=0;Ac=new Uint16Array(2);Ac[0]=(Ka[0]<<8)+Ka[1];Ac[1]=(Ka[2]<<8)+Ka[3];sd=Ac[0].toString(16)+Ac[1].toString(16)}else Ka=new Uint8Array(2),Ka[0]=16|Bl>>1,Ka[1]=Bl<<7|E<<3,Ac=
22
- new Uint16Array(1),Ac[0]=(Ka[0]<<8)+Ka[1],sd=Ac[0].toString(16);Tq=sd.toUpperCase()}}var O={id:y.W++,type:D,index:Si,bitrate:Wf,kd:Tq,maxHeight:Yb,maxWidth:Xf,Zc:Al,Me:Sq,nh:QB,Tf:PB,zh:RB,jg:SB,segmentIndex:null}}zc.push(O)}var sb=zc}{const zc=[],Ri=_.Ll(v,"c");for(let ce=0;ce<Ri.length;ce++){const Ac=Ri[ce];let Ka=parseInt(Ac.getAttribute("t"),10),sd=parseInt(Ac.getAttribute("d"),10),Si=parseInt(Ac.getAttribute("r"),10),Wf=0;if(isNaN(Ka)&&isNaN(sd))throw t.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
23
- new _.H(_.G,4,4037,t.l);0===ce&&isNaN(Ka)&&(Wf=Ka=0);if(0<ce){const Yb=zc[zc.length-1];Wf=Yb.n+1;Yb.d||(Yb.d=Ka-Yb.t);Ka||(Ka=Yb.t+Yb.d);sd||(sd=Ka-Yb.t)}zc.push({n:Wf,d:sd,t:Ka});if(Si){Si--;for(let Yb=0;Yb<Si;Yb++){const Xf=zc[zc.length-1];Wf=Xf.n+1;Ka=Xf.t+Xf.d;sd=Xf.d;zc.push({n:Wf,d:sd,t:Ka})}}}t.C()||zc.length===yc||t.g.warn("Number of fragments ("+yc+") differs from number of chunks ("+zc.length+").");var Mb=zc}var $c={type:gb,qh:yc,$g:lh,language:be,Sc:ae,name:mh,maxWidth:Uf,maxHeight:Vf,
24
- hh:zl,tracks:sb,Ue:Mb,timescale:mP}}ea.push($c)}var Qf=ea}const Ua={yh:d,ff:e,timescale:f,duration:g,isLive:h,xh:k,Pd:l,Wd:!1,streams:Qf};if(a.h&&a.w)return $L(a,Ua),Promise.resolve();a.G.clear();{const ea=Ua.timescale,ab=Ua.duration,Na=KK(Ua.streams,_.p),gb=KK(Ua.streams,_.w),yc=KK(Ua.streams,_.u),lh=[];let ae=aM(a,ab,ea,Na),be=aM(a,ab,ea,gb);const mh=aM(a,ab,ea,yc);ae.length||(ae=[null]);be.length||(be=[null]);for(let Uf=0;Uf<be.length;Uf++)for(let Vf=0;Vf<ae.length;Vf++)lh.push(bM(a,be[Uf],ae[Vf]));
25
- var Yd={startTime:0,variants:lh,textStreams:mh,thumbStreams:[]}}{var uc=Ua.streams;let ea=a.a.startTime,ab=a.a.delay;const Na=a.I;let gb=Math.min(a.a.duration||Infinity,Na);const yc=a.C(),lh=a.a.Pd,ae=a.a.Tc,be=a.H,mh=isFinite(a.F)?a.F:0;if(yc)gb=Infinity,ea=Date.now()/1E3-ae,a.a.startTime=ea,ab=3*be;else{const Uf=isFinite(Na)?Na:a.a.duration;for(const Vf of uc)for(const zl of Vf.tracks)zl.segmentIndex.offset(-mh),_.By(zl.segmentIndex,Uf)}a.B=new _.xD(ea,ab,!yc,!0);a.B.f=gb;_.Ky(a.B,be);a.B.w=lh;
26
- yc||a.B.offset(-mh)}a.D.filterAllPeriods([Yd]);a.h={presentationTimeline:a.B,periods:[Yd],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.Hc(a.M),a.K=!0);a.w=Ua;return Promise.resolve()},dM=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Bb.bind(a),b))},WL=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.H(_.G,4,4038,a.l,c);},XL=function(a,b){const c=b===ZL;if(a.h&&a.h.presentationTimeline){var d=
27
- a.h.presentationTimeline;d.j=c;d.l=c}c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.R=b},$L=function(a,b){for(let e=0;e<a.w.streams.length;e++){const f=b.streams[e];for(const g of a.w.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){IK(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=eM(a,a.w.timescale,f,c);c=g.segmentIndex;_.Uy(c,d);(d=a.a.Pd)&&_.Vy(c,_.Sy(c)-d).forEach(h=>{h.La().forEach(k=>
28
- {a.G.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},eM=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.Ue.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.F=Math.min(a.F,h)):h=f[k-1].endTime;const m=h+l,n=HK(a.l,c,k,d);a.H=Math.max(a.H,l);f.push(new _.Ty(k,h,m,()=>[n],0,null,0,null,!0,g));a.G.set(n,h);e+=l});if(c.type===_.w||c.type===_.p)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Tc?a.a.Tc=b.endTime:a.a.Tc=
29
- Math.min(a.a.Tc,b.endTime);return f},aM=function(a,b,c,d){let e=[];for(let f=0;f<d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=eM(a,c,k,h);const O=new _.yD(l);var m=null;k.type!==_.u&&(m=fM(a,b,c,k,h));h.segmentIndex=O;l=a.N++;var n=Promise.resolve.bind(Promise),q=O.f.bind(O),t=O.get.bind(O),v=O.h.bind(O),y=O.getDuration.bind(O),A=gM[k.type];var D="";switch(k.type){case _.w:D=h.kd;var E=/00000001[0-9]7/.exec(D);D="avc1."+(E&&E[0]?D.substr(D.indexOf(E[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",
30
- D);break;case _.p:D=h.kd,E=2,"AACH"===h.jg?E=5:D&&(E=(parseInt(D.substr(0,2),16)&248)>>3),D="mp4a.40."+E,a.g.debug("AUDIO CODECS: ",D)}E=k.type===_.u?hM[k.$g]:void 0;h={id:l,originalId:null,Bh:null,createSegmentIndex:n,findSegmentPosition:q,getSegmentReference:t,adjustSegmentDurations:v,getDuration:y,segmentIndex:O,segmentLookupStrategy:_.Dx,initSegmentReference:m,mimeType:A,codecs:D,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:E,encrypted:a.J(),keyId:null,
31
- language:k.language,originalLanguage:k.Sc,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.Me||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},bM=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.Ff;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},fM=function(a,b,c,d,e){b=JK(b,d.timescale||c,e);c={isLive:a.C.bind(a),
32
- vd:a.J.bind(a),og:()=>1,qd:a.T.bind(a)};d=new Uint8Array(0);try{d=CL(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.H(_.G,3,4035,g);}const f="data:text/plain;base64,"+_.fi(d);return new _.uD(()=>[f],0,null,null,!0)},UK=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]}append(a=[]){for(let b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.f.length;b++){if(this.f[b].type===
33
- a)return this.f[b];{const c=this.f[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(let c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b}write(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.N(a,1):_.N(a,this.size);_.Nk(a,FK(this.type));this.size>b&&zK(a,this.size);"uuid"===this.type&&_.Nk(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),
34
- this.f[b].a(),a.getPosition()}},iM=class extends UK{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);AK(a,this.version);BK(a,this.flags)}},AL=class extends UK{constructor(a,b,c){super(a);this.h=b;this.offset=c}a(){return this.h.byteLength+super.a()-this.offset}write(a){super.write(a);_.Nk(a,this.h,this.offset);a.getPosition()}},GL=class extends iM{constructor(a,b,c,d,e){super(a,b,c);this.h=d;this.offset=e}a(){return this.h.byteLength+super.a()-
35
- this.offset}write(a){super.write(a);_.Nk(a,this.h,this.offset);a.getPosition()}},zL=class extends UK{constructor(a,b,c){super("ftyp");this.j=a;this.ff=b;this.h=c}a(){let a=this.j.length;a=a+4+this.h.join("").length;return a+super.a()}write(a){super.write(a);_.Nk(a,FK(this.j));_.N(a,this.ff);_.Nk(a,FK(this.h.join("")));a.getPosition()}},yL=class extends UK{constructor(){super(_.qe)}},xL=class extends UK{constructor(){super(_.Df)}},aL=class extends iM{constructor(a,b,c){super("mvhd",1,0);this.timescale=
36
- 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]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.h.length;return a+=super.a()}write(a){super.write(a);1===this.version?(zK(a,0),zK(a,0),_.N(a,this.timescale),zK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.timescale),_.N(a,this.duration*this.timescale));_.N(a,65536);CK(a,this.volume);CK(a,0);_.N(a,0);_.N(a,0);for(let b=0;b<this.h.length;b++)AK(a,this.h[b]);
37
- _.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,this.j);a.getPosition()}},bL=class extends UK{constructor(){super("mvex")}},cL=class extends iM{constructor(a){super("trex",0,0);this.h=a}a(){return 20+super.a()}write(a){super.write(a);_.N(a,this.h);_.N(a,1);_.N(a,0);_.N(a,0);_.N(a,0);a.getPosition()}},dL=class extends iM{constructor(a,b,c,d,e){super("tkhd",1,7);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,
38
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.h.length;return a+super.a()}write(a){super.write(a);1===this.version?(zK(a,0),zK(a,0),_.N(a,this.j),_.N(a,0),zK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.j),_.N(a,0),_.N(a,this.duration*this.timescale));_.N(a,0);_.N(a,0);CK(a,0);CK(a,0);CK(a,this.volume);CK(a,0);for(let b=0;b<this.h.length;b++)AK(a,this.h[b]);CK(a,this.width);CK(a,0);CK(a,this.height);CK(a,0);a.getPosition()}},eL=class extends iM{constructor(a,
39
- b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956}a(){let a=0;a=1===this.version?a+28:a+16;return a+4+super.a()}write(a){super.write(a);1===this.version?(zK(a,0),zK(a,0),_.N(a,this.timescale),zK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.timescale),_.N(a,this.duration*this.timescale));CK(a,this.language);CK(a,0);a.getPosition()}},fL=class extends iM{constructor(a){super("hdlr",0,0);this.h=a}a(){return 33+super.a()}write(a){super.write(a);_.N(a,0);this.h===
40
- _.w?_.Nk(a,FK("vide")):_.Nk(a,FK("soun"));_.N(a,0);_.N(a,0);_.N(a,0);this.h===_.w?_.Nk(a,FK("VideoHandler\x00")):_.Nk(a,FK("SoundHandler\x00"));a.getPosition()}},lL=class extends iM{constructor(){super("vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])}a(){return 2+this.h.byteLength+super.a()}write(a){super.write(a);CK(a,0);_.Nk(a,this.h);a.getPosition()}},jM=class extends UK{constructor(a){super(a);this.A=!0}a(){return 8+super.a()}write(a){super.write(a);_.N(a,0);CK(a,0);CK(a,1)}},kM=class extends jM{constructor(a){super(a);
41
- this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);CK(a,0);CK(a,0);_.N(a,0);_.N(a,0);_.N(a,0);CK(a,this.width);CK(a,this.height);_.N(a,4718592);_.N(a,4718592);_.N(a,0);CK(a,1);AK(a,10);_.Nk(a,FK("AVC Coding",31));CK(a,this.depth);EK(a,-1)}},lM=class extends jM{constructor(a,b,c,d){super(a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d}a(){return 20+super.a()}write(a){super.write(a);_.N(a,0);_.N(a,0);CK(a,this.channelCount);CK(a,this.sampleSize);EK(a,0);
42
- CK(a,0);CK(a,this.sampleRate);CK(a,0)}},kL=class extends kM{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},VK=class extends kL{constructor(a,b){super(a,b);this.type="encv"}},nL=class extends lM{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},WK=class extends nL{constructor(a,b,c){super(a,b,c);this.type="enca"}},
43
- jL=class extends UK{constructor(a,b){super("avcC");this.Na=a;this.Ob=b;this.version=1;this.h=this.Na[0][1];this.j=this.Na[0][2];this.level=this.Na[0][3]}a(){let a=7;for(var b=0;b<this.Na.length;b++)a+=2,a+=this.Na[b].byteLength;for(b=0;b<this.Na.length;b++)a+=2,a+=this.Ob[b].byteLength;return a+super.a()}write(a){super.write(a);AK(a,this.version);AK(a,this.h);AK(a,this.j);AK(a,this.level);AK(a,255);AK(a,224|this.Na.length);for(var b=0;b<this.Na.length;b++)CK(a,this.Na[b].length),_.Nk(a,this.Na[b]);
44
- AK(a,this.Ob.length);for(b=0;b<this.Ob.length;b++)CK(a,this.Ob[b].length),_.Nk(a,this.Ob[b]);a.getPosition()}},mL=class extends iM{constructor(a){super("esds",0,0);this.Hb=a}a(){return 22+(this.Hb.byteLength+3)+super.a()}write(a){super.write(a);AK(a,3);AK(a,23+this.Hb.byteLength);CK(a,1);AK(a,0);AK(a,4);AK(a,15+this.Hb.byteLength);AK(a,64);AK(a,21);BK(a,0);_.N(a,0);_.N(a,0);AK(a,5);AK(a,this.Hb.byteLength);_.Nk(a,this.Hb);_.Nk(a,new Uint8Array([6,1,2]));a.getPosition()}},hL=class extends iM{constructor(a=
45
- ""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.Nk(a,FK(this.location));a.getPosition()}},gL=class extends iM{constructor(){super("dref",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},pL=class extends UK{constructor(){super(_.uf)}},iL=class extends iM{constructor(){super(_.wf,
46
- 0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},qL=class extends iM{constructor(){super("stts",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
47
- rL=class extends iM{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},tL=class extends iM{constructor(){super("stco",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
48
- a.getPosition()}},sL=class extends iM{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.N(a,0);_.N(a,0);a.getPosition()}},oL=class extends iM{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);EK(a,0);CK(a,0);a.getPosition()}},uL=class extends UK{constructor(){super("dinf")}},vL=class extends UK{constructor(){super(_.pe)}},wL=class extends UK{constructor(){super(_.le)}},OL=class extends iM{constructor(a,b){super("tfdt",a,0);this.h=b}a(){let a=
49
- 0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);1===this.version?zK(a,this.h):_.N(a,this.h);a.getPosition()}},DL=class extends iM{constructor(){super("mfhd",0,0);this.h=0}a(){return 4+super.a()}write(a){super.write(a);_.N(a,this.h);a.getPosition()}},FL=class extends iM{constructor(a,b){super("trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]}a(){let a=4;this.flags&mM&&(a+=4);this.flags&nM&&(a+=4);for(let b=0;b<this.h;b++)this.flags&oM&&(a+=
50
- 4),this.flags&pM&&(a+=4),this.flags&qM&&(a+=4),this.flags&rM&&(a+=4);return a+super.a()}write(a){super.write(a);_.N(a,this.h);this.flags&mM&&(a.getPosition(),DK(a,this.l));this.flags&nM&&_.N(a,this.o);for(let b=0;b<this.h;b++)this.flags&oM&&_.N(a,this.w[b]),this.flags&pM&&_.N(a,this.sampleSize[b]),this.flags&qM&&_.N(a,this.B[b]),this.flags&rM&&(0===this.version?_.N(a,this.j[b]):DK(a,this.j[b]));a.getPosition()}},mM=1,nM=4,oM=256,pM=512,qM=1024,rM=2048,EL=class extends iM{constructor(a,b){super("tfhd",
51
- a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0}a(){let a=4;this.flags&sM&&(a+=8);this.flags&tM&&(a+=4);this.flags&uM&&(a+=4);this.flags&vM&&(a+=4);this.flags&wM&&(a+=4);return a+super.a()}write(a){super.write(a);_.N(a,this.h);this.flags&sM&&zK(a,this.j);this.flags&tM&&_.N(a,this.B);this.flags&uM&&_.N(a,this.l);this.flags&vM&&_.N(a,this.w);this.flags&wM&&_.N(a,this.o);a.getPosition()}},sM=1,tM=2,uM=8,vM=16,wM=32,KL=class extends UK{constructor(){super("traf")}},LL=class extends UK{constructor(){super("moof")}},
52
- JL=class extends UK{constructor(){super(_.ke);this.h=new Uint8Array(0)}a(){return this.h.byteLength+super.a()}write(a){super.write(a);0<this.h.byteLength&&_.Nk(a,this.h)}},XK=class extends iM{constructor(){super("tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]}a(){let a;a=20;1===this.h&&0===this.j&&(a=a+1+this.l.length);return a+super.a()}write(a){super.write(a);AK(a,0);0===this.version?AK(a,0):AK(a,0);AK(a,this.h);AK(a,this.j);_.Nk(a,_.hi(this.o));if(1===this.h&&0===this.j){AK(a,0);for(let b=0;b<
53
- this.l.length;b++)AK(a,this.l[b])}a.getPosition()}},ZK=class extends iM{constructor(a,b){super("schm",0,0);this.h=a;this.j=b;this.Db=""}a(){let a=8;this.flags&1&&(a+=FK(this.Db).byteLength);return a+super.a()}write(a){super.write(a);_.Nk(a,FK(this.h));_.N(a,this.j);this.flags&1&&_.Nk(a,FK(this.Db));a.getPosition()}},YK=class extends UK{constructor(a){super("frma");this.h=a}a(){return FK(this.h).byteLength+super.a()}write(a){super.write(a);_.Nk(a,FK(this.h));a.getPosition()}},PL=class extends iM{constructor(){super("saio",
54
- 0,0);this.offset=[0]}a(){let a=0;this.flags&1&&(a+=8);a+=4;for(let b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.N(a,0),_.N(a,0));_.N(a,1);for(let b=0;1>b;b++)0===this.version?_.N(a,this.offset[b]):zK(a,this.offset[b]);a.getPosition()}},QL=class extends iM{constructor(a,b,c){super("saiz",0,0);this.h=a;this.l=b;this.j=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.h&&(a+=this.l.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.N(a,
55
- 0),_.N(a,0));AK(a,this.h);_.N(a,this.j);if(0===this.h)for(let b=0;b<this.j;b++)AK(a,this.l[b]);a.getPosition()}},IL=class extends iM{constructor(a,b){super("senc",a,b);this.j=0;this.l=8;this.h=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.j;b++)if(a+=this.h[b].df.byteLength,this.flags&2){a+=2;for(let c=0;c<this.h[b].Gc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.N(a,this.j);this.flags&1&&AK(a,this.l);for(let b=0;b<this.j;b++)if(_.Nk(a,this.h[b].df),this.flags&2){CK(a,this.h[b].Gc);
56
- for(let c=0;c<this.h[b].Gc;c++)CK(a,this.h[b].we[c].Ke),_.N(a,this.h[b].we[c].Le)}a.getPosition()}};var NL=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0==this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))}},MK=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,NK=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,OK=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,PK=/^(\d*\.?\d*)f$/,QK=/^(\d*\.?\d*)t$/,RK=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var BL=class{constructor(a){this.a=a;this.f=TK(this)}get(a){for(let b=0;b<this.a.length;b++){const c=this.a[b].get(a);if(c)return c}return null}write(){this.f=TK(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var HL=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var xM=class{constructor(){this.w=this.h=this.f=this.D=null;this.N=1;this.W=0;this.l="";this.B=this.a=null;this.g=new _.R("clpp.smooth.SmoothParser");this.K=!1;this.j=this.A=null;this.R=ZL;this.H=0;this.F=this.I=Infinity;this.o=[];this.M=this.V.bind(this);this.G=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,GK(a)])];return VL(this,a).then(c=>cM(this,c.data).then(()=>{dM(this,this.A);return this.h}))}stop(){this.D&&this.D.networkingEngine.Cd(this.M);this.A=this.w=this.h=this.f=
57
- this.D=null;this.j&&(clearTimeout(this.j),this.j=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.C())return VL(this,[this.l]).then(a=>cM(this,a.data).then(()=>this.h)).catch(a=>{if(this.D)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}Bb(){this.g.debug(_.ux);this.D&&(this.j=null,this.update().then(()=>{dM(this,this.A)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&dM(this,100))}))}C(){return this.R===YL}J(){return 0<this.o.length}T(a){let b=
58
- null;if(this.o.length)for(let c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b}V(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.w.timescale,c={isLive:this.C.bind(this),vd:this.J.bind(this),og:()=>1,qd:this.T.bind(this)};let d=!1;const e=new _.H(_.G,3,4035,null);let f=null;try{const 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 `+
59
- `segment reference time ${a.request.startTime}`);f=RL(a,b,g,c)}catch(g){d=!0,e.data=g,3E3===g.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)}},gM={video:_.Rf,audio:_.Gc,text:_.xc},ZL=_.vx,YL="LIVE",hM={ih:_.Ax,kh:_.Nx};_.z("clpp.smooth.SmoothComponent",class extends _.Ks{f(){_.tq.ism=xM;_.rq[_.Bc]=xM}a(){_.$y("ism");_.az(_.Bc)}id(){return"smooth"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var eM="Full MP4 box must have flags defined",fM="clpp.smooth.SmoothMP4Processor",gM="codecPrivateData",hM=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.N(a,c);_.N(a,b)},iM=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.nl()}},jM=function(a,b){iM(a,b>>16&255);iM(a,b>>8&255);iM(a,b&255)},kM=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.nl()}},lM=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.nl()}},mM=function(a,b){try{a.f.setInt16(a.a,
2
+ b,a.g),a.a+=2}catch(c){_.nl()}},nM=function(a,b){if(void 0!==b){var c=new Uint8Array(b);const d=Math.min(a.length,b);let e=0;for(;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}b=new Uint8Array(a.length);for(c=0;c<a.length;++c)b[c]=a.charCodeAt(c);return b},oM=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},pM=function(a,b,c,d){c=b.df[c];b=b.yh;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
3
+ String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.Zy([a],[b])[0]},qM=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.t?c=["maxWidth","maxHeight","bitrate",gM,"fourCC"]:a.type===_.p&&(c=["bitrate",gM,"channels","bitsPerSample","samplingRate","fourCC"]);return _.Tg(a,b,c,["id","segmentIndex"])},rM=function(a,b,c){const d=c.qd.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ma:null,Qb:null,width:NaN,height:NaN,Ib:null,ed:NaN,
4
+ sampleSize:NaN,channelCount:NaN};switch(c.type){case _.t:a.Ma=[_.Ai(d[1])];a.Qb=[_.Ai(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.Ib=_.Ai(c.qd),a.sampleSize=c.dg||16,a.ed=c.ed,a.channelCount=c.We}return a},sM=function(a,b){return a.filter(c=>c.type===b)},tM=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},AM=function(a,b,c){var d=null;if(uM.test(a)){{a=uM.exec(a);d=Number(a[1]);const e=
5
+ Number(a[2]);let 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 vM.test(a)?d=tM(vM,a):wM.test(a)?d=tM(wM,a):xM.test(a)?(a=xM.exec(a),d=Number(a[1])/c.frameRate):yM.test(a)?(a=yM.exec(a),d=Number(a[1])/c.a):zM.test(a)&&(d=tM(zM,a));c=d;d=c+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},BM=function(a){let b=
6
+ 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Il(b)},IM=function(a,b,c){a:{var d=[_.yd,_.wd];for(e of d)if((d=c.ud(e))&&d.keyId){var e=d.keyId;break a}_.B(fM,"Could not get default Key ID for DRM init data!");e=null}c=new CM("xxxx");a.type===_.t?c=new DM(a.width,a.height):c=new EM(a.channelCount,a.sampleSize,a.ed);a=new FM;a.g=1;a.j=8;a.o=e||"00000000000000000000000000000000";a=(new CM("schi")).append([a]);b=(new CM(_.Ff)).append([new GM(b),new HM(_.Zc,65536),a]);c.append([b]);return c},
7
+ kN=function(a,b){var c=b.wd(),d=new JM(a.timescale,a.duration,a.id),e=(new KM).append([new LM(a.id)]),f=new MM(a.id,a.duration,a.timescale,a.width,a.height),g=new NM(a.timescale,a.duration);const h=new OM(a.type);var k=null,l=new PM;l.entries=[new QM];var m=new RM;switch(a.type){case _.t:k=new SM(a.Ma,a.Qb);c?(a=IM(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new TM(a.width,a.height)).append([k]),m.entries=[a]);k=new UM;break;case _.p:k=new VM(a.Ib),c?(a=IM(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
+ (a=(new WM(a.channelCount,a.sampleSize,a.ed)).append([k]),m.entries=[a]),k=new XM}m=(new YM).append([m,new ZM,new $M,new aN,new bN]);l=(new cN).append([l]);l=(new dN).append([k,l,m]);g=(new eN).append([g,h,l]);f=(new fN).append([f,g]);d=(new gN).append([d,f,e]);e=new hN("dash",0,["iso6","mp41","avc1"]);c&&(c=b.ud(_.wd),b=b.ud(_.yd),c&&d.append([new iN("pssh",c.initData,8)]),b&&d.append([new iN("pssh",b.initData,8)]),c||b||_.B(fM,"Could not get PSSH init data!"));b=new jN([e,d]);return _.I(b.write())},
9
+ uN=function(a,b){let c,d,e,f,g,h;(new _.Gl).M("moof",_.zl).ba("mfhd",k=>{{const l=new lN;l.g=_.O(k.reader);c=l}}).M("traf",_.zl).ba("tfhd",k=>{{const l=k.reader.Aa();if(null===k.flags)throw new _.G(_.E,3,3019,eM);const m=new mN(k.version||0,k.flags||0);m.g=_.O(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.ul(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.B=_.O(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.l=_.O(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.w=_.O(k.reader));
10
+ 0<l-k.reader.getPosition()&&k.flags&32&&(m.o=_.O(k.reader));d=m}}).ba("trun",k=>{{var l=k.reader.Aa();if(null===k.flags)throw new _.G(_.E,3,3019,eM);const m=new nN(k.version||0,k.flags||0);m.g=_.O(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.l=_.tl(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.o=_.O(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.w.push(_.O(k.reader)),k.flags&512&&m.sampleSize.push(_.O(k.reader)),k.flags&1024&&m.B.push(_.O(k.reader)),k.flags&
11
+ 2048&&(0===k.version?m.j.push(_.O(k.reader)):m.j.push(_.tl(k.reader)));e=m}}).ba("sdtp",k=>{{const l=_.wl(k.reader,k.reader.Aa());f=new oN("sdtp",k.version||0,k.flags||0,l,0)}}).M("uuid",k=>{var l=_.wl(k.reader,16);if(_.Ci(l,pN)){l=_.O(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new qN(k.version,k.flags);l.j=_.O(k.reader);k.flags&1&&(l.l=_.rl(k.reader));for(let m=0;m<l.j;m++){const n={qf:_.wl(k.reader,8),Fc:0,Ce:[]};if(k.flags&2){n.Fc=_.sl(k.reader);for(let q=0;q<n.Fc;q++){const u={Ue:0,Ve:0};
12
+ u.Ue=_.sl(k.reader);u.Ve=_.O(k.reader);n.Ce.push(u)}}l.g.push(n)}g=l}}).M(_.te,k=>{{const l=new rN;0<k.reader.Aa()?l.g=_.wl(k.reader,k.reader.Aa()):(_.B(fM,"mdat box is empty!"),l.g=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new sN).append([d,e]);f&&a.append([f]);b.wd()&&g&&a.append([g]);b=(new tN).append([c,a]);return new jN([b,h])},zN=function(a,b,c,d){var e=d.wd(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=uN(b,d);if(null===g)return a.request.contentType===_.F?a.data:
13
+ g;d=g.get(_.te);if(a.request.contentType===_.F){e=d.g.buffer;if(c){e=_.mi(e);if((e=(new DOMParser).parseFromString(e,_.Rf))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new vN(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0])){f=h.getElementsByTagName("p");for(let u=0,v=f.length;u<v;u++){h=f[u];a=c;b=d;g=["begin",_.Td];for(let y=0,A=g.length;y<
14
+ A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const D=l.length;for(;n<D;n++){var q=l[n].name;if(q=q.match(m)){k=k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[y],AM(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.ni(e).buffer}else c=e;return c}h=new tN;a=g.get("mfhd");b=new sN;k=g.get("tfhd");m=new wN(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");k.g=1;k.flags&=16777214;k.flags|=131072;b.append([k,
15
+ m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.j;m++)k.push(10+6*c.g[m].Fc);else g=8;b.append([c,new xN,new yN(g,k,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new jN([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},AN=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
16
+ periodId:null}},BN=function(a){return{initData:_.Ny(_.rm(a)),initDataType:_.Zc,keyId:a,periodId:null}},CN=function(a,b,c){a=_.zm(a);c&&a.version!==c&&(a=_.Py(a,c));return{initData:_.Ny(a),initDataType:_.Zc,keyId:b,periodId:null}},DN=function(a,b){return _.w(function*(){var c=_.Ni(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;
17
+ c.type=1;c=yield a.D.networkingEngine.fetch(c).P;a.l=c.uri;return c})},LN=function(a,b){let c=null;try{{const ea=new DOMParser;let $a,Na;try{const hb=_.mi(b);Na=ea.parseFromString(hb.trim(),_.Rf)}catch(hb){throw hb;}Na&&Na.documentElement.tagName===_.Ib&&($a=Na.documentElement);c=$a&&0<$a.getElementsByTagName("parsererror").length?null:$a}}catch(ea){}if(!c)throw a.h.error("Unable to parse manifest"),new _.G(_.E,4,4033,a.l);const d=+EN(a,c,"MajorVersion"),e=+EN(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
18
+ 1E7;let g=+EN(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.lm(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.h.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.G(_.E,4,4036,a.l);h?(FN(a,GN),a.A=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):FN(a,HN);a.a={startTime:0,delay:0,duration:g/f,Ud:l/f,Yc:0};if(m){{var n=a.f.playreadyVersion;
19
+ const ea=[],$a=_.lm(m,"ProtectionHeader")[0],Na=_.zi(_.nm($a)||""),hb=_.zm(Na).a;ea.push(AN(_.yd,BN(hb),[hb]));ea.push(AN(_.wd,CN(Na,hb,n),[hb]));var q=ea}a.o=q}{const ea=[],$a=_.lm(c,"StreamIndex");if(!$a.length)throw a.h.error("No streams found!"),new _.G(_.E,4,4034,a.l);for(let Na=0;Na<$a.length;Na++){{var u=a,v=$a[Na];const hb=EN(u,v,"Type"),Ic=+v.getAttribute("Chunks"),vh=v.getAttribute("Subtype"),fe=v.getAttribute("Language")||_.Wf,ge=_.Xh(fe),wh=v.getAttribute("Name")||"",Yf=+v.getAttribute(_.gb),
20
+ Zf=+v.getAttribute(_.fb),Pl=EN(u,v,"Url"),UQ=+v.getAttribute("TimeScale")||null;{const Jc=[],cj=_.lm(v,_.zb);for(let he=0;he<cj.length;he++){{let Kc,Ja,Ad;var y=u,A=cj[he],D=hb;const dj=+A.getAttribute("Index"),$f=+EN(y,A,"Bitrate");let dc=NaN,ag=NaN,Ql=NaN,lr=NaN,QC=NaN,RC=NaN,SC=NaN;const TC=A.getAttribute("FourCC");switch(D){case _.t:dc=+EN(y,A,_.fb);ag=+EN(y,A,_.gb);break;case _.p:lr=+A.getAttribute("Channels")||2,Ql=+EN(y,A,"SamplingRate"),RC=+EN(y,A,"AudioTag"),QC=+EN(y,A,"BitsPerSample"),SC=
21
+ +EN(y,A,"PacketSize")}let mr=String(A.getAttribute("CodecPrivateData"));if(D===_.p&&!mr){{var M=lr;const UC={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},Rl=UC[Ql];if("AACH"===TC){Ja=new Uint8Array(4);const VC=UC[2*Ql];Ja[0]=40|Rl>>1;Ja[1]=Rl<<7|M<<3|VC>>1;Ja[2]=VC<<7|8;Ja[3]=0;Kc=new Uint16Array(2);Kc[0]=(Ja[0]<<8)+Ja[1];Kc[1]=(Ja[2]<<8)+Ja[3];Ad=Kc[0].toString(16)+Kc[1].toString(16)}else Ja=new Uint8Array(2),Ja[0]=16|Rl>>1,Ja[1]=Rl<<7|M<<3,Kc=
22
+ new Uint16Array(1),Kc[0]=(Ja[0]<<8)+Ja[1],Ad=Kc[0].toString(16);mr=Ad.toUpperCase()}}var da={id:y.W++,type:D,index:dj,bitrate:$f,qd:mr,maxHeight:dc,maxWidth:ag,ed:Ql,We:lr,Eh:RC,dg:QC,Qh:SC,ug:TC,segmentIndex:null}}Jc.push(da)}var sb=Jc}{const Jc=[],cj=_.lm(v,"c");for(let he=0;he<cj.length;he++){const Kc=cj[he];let Ja=parseInt(Kc.getAttribute("t"),10),Ad=parseInt(Kc.getAttribute("d"),10),dj=parseInt(Kc.getAttribute("r"),10),$f=0;if(isNaN(Ja)&&isNaN(Ad))throw u.h.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
23
+ new _.G(_.E,4,4037,u.l);0===he&&isNaN(Ja)&&($f=Ja=0);if(0<he){const dc=Jc[Jc.length-1];$f=dc.n+1;dc.d||(dc.d=Ja-dc.t);Ja||(Ja=dc.t+dc.d);Ad||(Ad=Ja-dc.t)}Jc.push({n:$f,d:Ad,t:Ja});if(dj){dj--;for(let dc=0;dc<dj;dc++){const ag=Jc[Jc.length-1];$f=ag.n+1;Ja=ag.t+ag.d;Ad=ag.d;Jc.push({n:$f,d:Ad,t:Ja})}}}u.C()||Jc.length===Ic||u.h.warn("Number of fragments ("+Ic+") differs from number of chunks ("+Jc.length+").");var Qb=Jc}var id={type:hb,Hh:Ic,ph:vh,language:ge,Xc:fe,name:wh,maxWidth:Yf,maxHeight:Zf,
24
+ yh:Pl,tracks:sb,df:Qb,timescale:UQ}}ea.push(id)}var Uf=ea}const Va={Ph:d,tf:e,timescale:f,duration:g,isLive:h,Oh:k,Ud:l,be:!1,streams:Uf};if(a.g&&a.w)return IN(a,Va),Promise.resolve();a.G.clear();{const ea=Va.timescale,$a=Va.duration,Na=sM(Va.streams,_.p),hb=sM(Va.streams,_.t),Ic=sM(Va.streams,_.F),vh=[];let fe=JN(a,$a,ea,Na),ge=JN(a,$a,ea,hb);const wh=JN(a,$a,ea,Ic);fe.length||(fe=[null]);ge.length||(ge=[null]);for(let Yf=0;Yf<ge.length;Yf++)for(let Zf=0;Zf<fe.length;Zf++)vh.push(KN(a,ge[Yf],fe[Zf]));
25
+ var ce={id:"ID",configurationId:void 0,startTime:0,endTime:$a,variants:vh,textStreams:wh,thumbStreams:[]}}{var Ec=Va.streams;let ea=a.a.startTime,$a=a.a.delay;const Na=a.I;let hb=Math.min(a.a.duration||Infinity,Na);const Ic=a.C(),vh=a.a.Ud,fe=a.a.Yc,ge=a.H,wh=isFinite(a.F)?a.F:0;if(Ic)hb=Infinity,ea=Date.now()/1E3-fe,a.a.startTime=ea,$a=3*ge;else{const Yf=isFinite(Na)?Na:a.a.duration;for(const Zf of Ec)for(const Pl of Zf.tracks)Pl.segmentIndex.offset(-wh),_.wz(Pl.segmentIndex,Yf)}a.B=new _.$E(a.f.timeline||
26
+ {},ea,$a,!Ic,!0);a.B.f=hb;_.Kz(a.B,ge);a.B.A=vh;Ic||a.B.offset(-wh)}a.D.filterAllPeriods([ce]);a.g={presentationTimeline:a.B,periods:[ce],minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.Gc(a.L),a.K=!0);a.w=Va;return Promise.resolve()},MN=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Ab.bind(a),b))},EN=function(a,b,c){if(b=b.getAttribute(c))return b;a.h.error("required attribute not provided: "+c);throw new _.G(_.E,4,4038,a.l,c);},FN=function(a,b){const c=b===HN;a.g&&a.g.presentationTimeline&&
27
+ _.Fz(a.g.presentationTimeline,c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.N=b},IN=function(a,b){for(let e=0;e<a.w.streams.length;e++){const f=b.streams[e];for(const g of a.w.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){qM(g,c)||a.h.warn("The current stream is updated with a stream that seems to have different base properties!");var d=NN(a,a.w.timescale,f,c);c=g.segmentIndex;_.Xz(c,d);(d=a.a.Ud)&&_.Yz(c,_.Vz(c)-d).forEach(h=>{h.Ja().forEach(k=>
28
+ {a.G.delete(k)})})}else a.h.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},NN=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.df.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.F=Math.min(a.F,h)):h=f[k-1].endTime;const m=h+l,n=pM(a.l,c,k,d);a.H=Math.max(a.H,l);f.push(new _.Wz(k,h,m,()=>[n],0,null,0,null,!0,g));a.G.set(n,h);e+=l});if(c.type===_.t||c.type===_.p)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Yc?a.a.Yc=b.endTime:a.a.Yc=
29
+ Math.min(a.a.Yc,b.endTime);return f},JN=function(a,b,c,d){let e=[];for(let f=0;f<d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=NN(a,c,k,h);const da=new _.aF(l);var m=null;k.type!==_.F&&(m=ON(a,b,c,k,h));h.segmentIndex=da;l=_.eF++;var n=Promise.resolve.bind(Promise),q=da.f.bind(da),u=da.get.bind(da),v=da.g.bind(da),y=da.getDuration.bind(da),A=PN[k.type];var D="";switch(k.type){case _.t:D=h.qd;var M=/00000001[0-9]7/.exec(D);D="avc1."+(M&&M[0]?D.substr(D.indexOf(M[0])+10,6):"42c00c");a.h.debug("VIDEO CODECS: ",
30
+ D);break;case _.p:D=h.qd,M=2,"AACH"===h.ug?M=5:D&&(M=(parseInt(D.substr(0,2),16)&248)>>3),D="mp4a.40."+M,a.h.debug("AUDIO CODECS: ",D)}M=k.type===_.F?QN[k.ph]:void 0;h={id:l,originalId:null,Sh:null,createSegmentIndex:n,findSegmentPosition:q,getSegmentReference:u,adjustSegmentDurations:v,getDuration:y,segmentIndex:da,segmentLookupStrategy:_.zy,initSegmentReference:m,mimeType:A,codecs:D,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:M,encrypted:a.J(),keyId:null,
31
+ language:k.language,originalLanguage:k.Xc,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.We||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},KN=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.Wf;return c||b?{id:a.T++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},ON=function(a,b,c,d,e){b=rM(b,d.timescale||c,e);c={isLive:a.C.bind(a),
32
+ wd:a.J.bind(a),Ag:()=>1,ud:a.R.bind(a)};d=new Uint8Array(0);try{d=kN(b,c)}catch(g){throw a.h.error("Failed to generate initialization segment."),new _.G(_.E,3,4035,g);}const f="data:text/plain;base64,"+_.yi(d);return new _.XE(()=>[f],0,null,null,!0)},CM=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]}append(a=[]){for(let b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.f.length;b++){if(this.f[b].type===
33
+ a)return this.f[b];{const c=this.f[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(let c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b}write(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.N(a,1):_.N(a,this.size);_.ol(a,nM(this.type));this.size>b&&hM(a,this.size);"uuid"===this.type&&_.ol(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),
34
+ this.f[b].a(),a.getPosition()}},RN=class extends CM{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);iM(a,this.version);jM(a,this.flags)}},iN=class extends CM{constructor(a,b,c){super(a);this.g=b;this.offset=c}a(){return this.g.byteLength+super.a()-this.offset}write(a){super.write(a);_.ol(a,this.g,this.offset);a.getPosition()}},oN=class extends RN{constructor(a,b,c,d,e){super(a,b,c);this.g=d;this.offset=e}a(){return this.g.byteLength+super.a()-
35
+ this.offset}write(a){super.write(a);_.ol(a,this.g,this.offset);a.getPosition()}},hN=class extends CM{constructor(a,b,c){super("ftyp");this.j=a;this.tf=b;this.g=c}a(){let a=this.j.length;a=a+4+this.g.join("").length;return a+super.a()}write(a){super.write(a);_.ol(a,nM(this.j));_.N(a,this.tf);_.ol(a,nM(this.g.join("")));a.getPosition()}},gN=class extends CM{constructor(){super(_.ze)}},fN=class extends CM{constructor(){super(_.Tf)}},JM=class extends RN{constructor(a,b,c){super("mvhd",1,0);this.timescale=
36
+ a;this.duration=b;this.volume=256;this.j=c+1;this.g=[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]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.g.length;return a+=super.a()}write(a){super.write(a);1===this.version?(hM(a,0),hM(a,0),_.N(a,this.timescale),hM(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.timescale),_.N(a,this.duration*this.timescale));_.N(a,65536);kM(a,this.volume);kM(a,0);_.N(a,0);_.N(a,0);for(let b=0;b<this.g.length;b++)iM(a,this.g[b]);
37
+ _.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,this.j);a.getPosition()}},KM=class extends CM{constructor(){super("mvex")}},LM=class extends RN{constructor(a){super("trex",0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.N(a,this.g);_.N(a,1);_.N(a,0);_.N(a,0);_.N(a,0);a.getPosition()}},MM=class extends RN{constructor(a,b,c,d,e){super("tkhd",1,7);this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.g=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
38
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.g.length;return a+super.a()}write(a){super.write(a);1===this.version?(hM(a,0),hM(a,0),_.N(a,this.j),_.N(a,0),hM(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.j),_.N(a,0),_.N(a,this.duration*this.timescale));_.N(a,0);_.N(a,0);kM(a,0);kM(a,0);kM(a,this.volume);kM(a,0);for(let b=0;b<this.g.length;b++)iM(a,this.g[b]);kM(a,this.width);kM(a,0);kM(a,this.height);kM(a,0);a.getPosition()}},NM=class extends RN{constructor(a,
39
+ b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956}a(){let a=0;a=1===this.version?a+28:a+16;return a+4+super.a()}write(a){super.write(a);1===this.version?(hM(a,0),hM(a,0),_.N(a,this.timescale),hM(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.timescale),_.N(a,this.duration*this.timescale));kM(a,this.language);kM(a,0);a.getPosition()}},OM=class extends RN{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.N(a,0);this.g===
40
+ _.t?_.ol(a,nM("vide")):_.ol(a,nM("soun"));_.N(a,0);_.N(a,0);_.N(a,0);this.g===_.t?_.ol(a,nM("VideoHandler\x00")):_.ol(a,nM("SoundHandler\x00"));a.getPosition()}},UM=class extends RN{constructor(){super("vmhd",0,1);this.g=new Uint8Array([0,0,0,0,0,0])}a(){return 2+this.g.byteLength+super.a()}write(a){super.write(a);kM(a,0);_.ol(a,this.g);a.getPosition()}},SN=class extends CM{constructor(a){super(a);this.A=!0}a(){return 8+super.a()}write(a){super.write(a);_.N(a,0);kM(a,0);kM(a,1)}},TN=class extends SN{constructor(a){super(a);
41
+ this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);kM(a,0);kM(a,0);_.N(a,0);_.N(a,0);_.N(a,0);kM(a,this.width);kM(a,this.height);_.N(a,4718592);_.N(a,4718592);_.N(a,0);kM(a,1);iM(a,10);_.ol(a,nM("AVC Coding",31));kM(a,this.depth);mM(a,-1)}},UN=class extends SN{constructor(a,b,c,d){super(a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d}a(){return 20+super.a()}write(a){super.write(a);_.N(a,0);_.N(a,0);kM(a,this.channelCount);kM(a,this.sampleSize);mM(a,0);
42
+ kM(a,0);kM(a,this.sampleRate);kM(a,0)}},TM=class extends TN{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},DM=class extends TM{constructor(a,b){super(a,b);this.type="encv"}},WM=class extends UN{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},EM=class extends WM{constructor(a,b,c){super(a,b,c);this.type="enca"}},
43
+ SM=class extends CM{constructor(a,b){super("avcC");this.Ma=a;this.Qb=b;this.version=1;this.g=this.Ma[0][1];this.j=this.Ma[0][2];this.level=this.Ma[0][3]}a(){let a=7;for(var b=0;b<this.Ma.length;b++)a+=2,a+=this.Ma[b].byteLength;for(b=0;b<this.Ma.length;b++)a+=2,a+=this.Qb[b].byteLength;return a+super.a()}write(a){super.write(a);iM(a,this.version);iM(a,this.g);iM(a,this.j);iM(a,this.level);iM(a,255);iM(a,224|this.Ma.length);for(var b=0;b<this.Ma.length;b++)kM(a,this.Ma[b].length),_.ol(a,this.Ma[b]);
44
+ iM(a,this.Qb.length);for(b=0;b<this.Qb.length;b++)kM(a,this.Qb[b].length),_.ol(a,this.Qb[b]);a.getPosition()}},VM=class extends RN{constructor(a){super("esds",0,0);this.Ib=a}a(){return 22+(this.Ib.byteLength+3)+super.a()}write(a){super.write(a);iM(a,3);iM(a,23+this.Ib.byteLength);kM(a,1);iM(a,0);iM(a,4);iM(a,15+this.Ib.byteLength);iM(a,64);iM(a,21);jM(a,0);_.N(a,0);_.N(a,0);iM(a,5);iM(a,this.Ib.byteLength);_.ol(a,this.Ib);_.ol(a,new Uint8Array([6,1,2]));a.getPosition()}},QM=class extends RN{constructor(a=
45
+ ""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.ol(a,nM(this.location));a.getPosition()}},PM=class extends RN{constructor(){super("dref",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},YM=class extends CM{constructor(){super(_.Kf)}},RM=class extends RN{constructor(){super(_.Mf,
46
+ 0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},ZM=class extends RN{constructor(){super("stts",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
47
+ $M=class extends RN{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},bN=class extends RN{constructor(){super("stco",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
48
+ a.getPosition()}},aN=class extends RN{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.N(a,0);_.N(a,0);a.getPosition()}},XM=class extends RN{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);mM(a,0);kM(a,0);a.getPosition()}},cN=class extends CM{constructor(){super("dinf")}},dN=class extends CM{constructor(){super(_.ye)}},eN=class extends CM{constructor(){super(_.ue)}},wN=class extends RN{constructor(a,b){super("tfdt",a,0);this.baseMediaDecodeTime=
49
+ b}a(){let a=0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);1===this.version?hM(a,this.baseMediaDecodeTime):_.N(a,this.baseMediaDecodeTime);a.getPosition()}},lN=class extends RN{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.N(a,this.g);a.getPosition()}},nN=class extends RN{constructor(a,b){super("trun",a,b);this.o=this.l=this.g=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]}a(){let a=4;this.flags&VN&&(a+=4);this.flags&WN&&(a+=
50
+ 4);for(let b=0;b<this.g;b++)this.flags&XN&&(a+=4),this.flags&YN&&(a+=4),this.flags&ZN&&(a+=4),this.flags&$N&&(a+=4);return a+super.a()}write(a){super.write(a);_.N(a,this.g);this.flags&VN&&(a.getPosition(),lM(a,this.l));this.flags&WN&&_.N(a,this.o);for(let b=0;b<this.g;b++)this.flags&XN&&_.N(a,this.w[b]),this.flags&YN&&_.N(a,this.sampleSize[b]),this.flags&ZN&&_.N(a,this.B[b]),this.flags&$N&&(0===this.version?_.N(a,this.j[b]):lM(a,this.j[b]));a.getPosition()}},VN=1,WN=4,XN=256,YN=512,ZN=1024,$N=2048,
51
+ mN=class extends RN{constructor(a,b){super("tfhd",a,b);this.g=255;this.o=this.w=this.l=this.B=this.j=0}a(){let a=4;this.flags&aO&&(a+=8);this.flags&bO&&(a+=4);this.flags&cO&&(a+=4);this.flags&dO&&(a+=4);this.flags&eO&&(a+=4);return a+super.a()}write(a){super.write(a);_.N(a,this.g);this.flags&aO&&hM(a,this.j);this.flags&bO&&_.N(a,this.B);this.flags&cO&&_.N(a,this.l);this.flags&dO&&_.N(a,this.w);this.flags&eO&&_.N(a,this.o);a.getPosition()}},aO=1,bO=2,cO=8,dO=16,eO=32,sN=class extends CM{constructor(){super("traf")}},
52
+ tN=class extends CM{constructor(){super("moof")}},rN=class extends CM{constructor(){super(_.te);this.g=new Uint8Array(0)}a(){return this.g.byteLength+super.a()}write(a){super.write(a);0<this.g.byteLength&&_.ol(a,this.g)}},FM=class extends RN{constructor(){super("tenc",0,0);this.g=1;this.j=8;this.o="";this.l=[]}a(){let a;a=20;1===this.g&&0===this.j&&(a=a+1+this.l.length);return a+super.a()}write(a){super.write(a);iM(a,0);0===this.version?iM(a,0):iM(a,0);iM(a,this.g);iM(a,this.j);_.ol(a,_.Ai(this.o));
53
+ if(1===this.g&&0===this.j){iM(a,0);for(let b=0;b<this.l.length;b++)iM(a,this.l[b])}a.getPosition()}},HM=class extends RN{constructor(a,b){super("schm",0,0);this.g=a;this.j=b;this.Cb=""}a(){let a=8;this.flags&1&&(a+=nM(this.Cb).byteLength);return a+super.a()}write(a){super.write(a);_.ol(a,nM(this.g));_.N(a,this.j);this.flags&1&&_.ol(a,nM(this.Cb));a.getPosition()}},GM=class extends CM{constructor(a){super("frma");this.g=a}a(){return nM(this.g).byteLength+super.a()}write(a){super.write(a);_.ol(a,nM(this.g));
54
+ a.getPosition()}},xN=class extends RN{constructor(){super("saio",0,0);this.offset=[0]}a(){let a=0;this.flags&1&&(a+=8);a+=4;for(let b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.N(a,0),_.N(a,0));_.N(a,1);for(let b=0;1>b;b++)0===this.version?_.N(a,this.offset[b]):hM(a,this.offset[b]);a.getPosition()}},yN=class extends RN{constructor(a,b,c){super("saiz",0,0);this.g=a;this.l=b;this.j=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.g&&(a+=this.l.length);
55
+ return a+super.a()}write(a){super.write(a);this.flags&1&&(_.N(a,0),_.N(a,0));iM(a,this.g);_.N(a,this.j);if(0===this.g)for(let b=0;b<this.j;b++)iM(a,this.l[b]);a.getPosition()}},qN=class extends RN{constructor(a,b){super("senc",a,b);this.j=0;this.l=8;this.g=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.j;b++)if(a+=this.g[b].qf.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].Fc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.N(a,this.j);this.flags&1&&iM(a,this.l);for(let b=
56
+ 0;b<this.j;b++)if(_.ol(a,this.g[b].qf),this.flags&2){kM(a,this.g[b].Fc);for(let c=0;c<this.g[b].Fc;c++)kM(a,this.g[b].Ce[c].Ue),_.N(a,this.g[b].Ce[c].Ve)}a.getPosition()}};var vN=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))}},uM=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,vM=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,wM=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,xM=/^(\d*\.?\d*)f$/,yM=/^(\d*\.?\d*)t$/,zM=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var jN=class{constructor(a){this.a=a;this.f=BM(this)}get(a){for(let b=0;b<this.a.length;b++){const c=this.a[b].get(a);if(c)return c}return null}write(){this.f=BM(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var pN=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var fO=class{constructor(){this.w=this.g=this.f=this.D=null;this.T=1;this.W=0;this.l="";this.B=this.a=null;this.h=new _.Q("clpp.smooth.SmoothParser");this.K=!1;this.j=this.A=null;this.N=HN;this.H=0;this.F=this.I=Infinity;this.o=[];this.L=this.U.bind(this);this.G=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,oM(a)])];return DN(this,a).then(c=>LN(this,c.data).then(()=>{MN(this,this.A);return this.g}))}requestStop(){}stop(){this.D&&this.D.networkingEngine.Hd(this.L);this.A=this.w=
57
+ this.g=this.f=this.D=null;this.j&&(clearTimeout(this.j),this.j=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.C())return DN(this,[this.l]).then(a=>LN(this,a.data).then(()=>this.g)).catch(a=>{if(this.D)this.D.onError(a)})}setCurrentVariant(){}Ab(){this.h.debug(_.ry);this.D&&(this.j=null,this.update().then(()=>{MN(this,this.A)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&MN(this,100))}))}C(){return this.N===GN}J(){return 0<this.o.length}R(a){let b=null;if(this.o.length)for(let c=
58
+ 0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b}U(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.w.timescale,c={isLive:this.C.bind(this),wd:this.J.bind(this),Ag:()=>1,ud:this.R.bind(this)};let d=!1;const e=new _.G(_.E,3,4035,null);let f=null;try{const g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.h.debug(`Using base media decode time ${g} instead of `+
59
+ `segment reference time ${a.request.startTime}`);f=zN(a,b,g,c)}catch(g){d=!0,e.data=g,3E3===g.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)}},PN={video:_.kg,audio:_.Mc,text:_.Cc},HN=_.Tb,GN="LIVE",QN={zh:_.wy,Bh:_.Iy};_.x("clpp.smooth.SmoothComponent",class extends _.Ft{f(){_.jr.ism=fO;_.hr[_.Dc]=fO}a(){_.uA("ism");_.vA(_.Dc)}id(){return"smooth"}});};f.call(g, window);