@castlabs/prestoplay 6.31.1 → 6.32.0-beta.2

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 (68) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +2 -2
  3. package/cjs/cl.adobe.js +3 -3
  4. package/cjs/cl.airplay.js +3 -3
  5. package/cjs/cl.broadpeak.js +18 -18
  6. package/cjs/cl.cast.js +127 -125
  7. package/cjs/cl.cdn.js +13 -0
  8. package/cjs/cl.conviva.js +32 -32
  9. package/cjs/cl.core.js +615 -610
  10. package/cjs/cl.crypto.js +9 -9
  11. package/cjs/cl.dash.js +101 -95
  12. package/cjs/cl.externs.js +113 -44
  13. package/cjs/cl.freewheel.js +26 -26
  14. package/cjs/cl.hls.js +78 -78
  15. package/cjs/cl.hlssmpte.js +6 -6
  16. package/cjs/cl.htmlcue.js +30 -30
  17. package/cjs/cl.ima.js +26 -26
  18. package/cjs/cl.mediatailor.js +3 -3
  19. package/cjs/cl.mse.js +351 -350
  20. package/cjs/cl.muxdata.js +14 -14
  21. package/cjs/cl.onboard.js +4 -4
  22. package/cjs/cl.persistent.js +14 -14
  23. package/cjs/cl.playlist.js +6 -6
  24. package/cjs/cl.simid.js +16 -16
  25. package/cjs/cl.smooth.js +71 -71
  26. package/cjs/cl.thumbnails.js +26 -26
  27. package/cjs/cl.tizen.js +71 -71
  28. package/cjs/cl.ttml.js +29 -29
  29. package/cjs/cl.verimatrix.js +5 -5
  30. package/cjs/cl.vimond.js +11 -11
  31. package/cjs/cl.vr.js +19 -19
  32. package/cjs/cl.vtt.js +14 -14
  33. package/cjs/cl.yospace.js +4 -4
  34. package/cjs/cl.youbora.js +40 -40
  35. package/cl.adobe.js +3 -3
  36. package/cl.airplay.js +3 -3
  37. package/cl.broadpeak.js +14 -14
  38. package/cl.cast.js +102 -101
  39. package/cl.cdn.js +7 -0
  40. package/cl.conviva.js +27 -27
  41. package/cl.core.js +498 -495
  42. package/cl.crypto.js +9 -9
  43. package/cl.dash.js +91 -87
  44. package/cl.externs.js +109 -44
  45. package/cl.freewheel.js +20 -20
  46. package/cl.hls.js +82 -82
  47. package/cl.hlssmpte.js +5 -5
  48. package/cl.htmlcue.js +26 -26
  49. package/cl.ima.js +20 -20
  50. package/cl.mediatailor.js +2 -2
  51. package/cl.mse.js +301 -300
  52. package/cl.muxdata.js +13 -13
  53. package/cl.onboard.js +4 -4
  54. package/cl.persistent.js +10 -10
  55. package/cl.playlist.js +5 -5
  56. package/cl.simid.js +14 -14
  57. package/cl.smooth.js +61 -61
  58. package/cl.thumbnails.js +19 -19
  59. package/cl.tizen.js +56 -56
  60. package/cl.ttml.js +22 -22
  61. package/cl.verimatrix.js +4 -4
  62. package/cl.vimond.js +8 -8
  63. package/cl.vr.js +14 -14
  64. package/cl.vtt.js +12 -12
  65. package/cl.yospace.js +3 -3
  66. package/cl.youbora.js +31 -31
  67. package/package.json +7 -1
  68. package/typings.d.ts +328 -114
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 $z=function(a){switch(a.type){case 1:return Xz;case 2:return Yz;case 3:return Zz}},bA=function(a){const b=Object.keys(a).find(c=>aA.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},dA=function(a){let b={debug:!0,data:cA(a)};a.f&&a.f.muxOptionsOverride&&_.gh(a.f.muxOptionsOverride)&&(b=_.ch(b,a.f.muxOptionsOverride));b=_.ch(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 _.gp(c.url);e.video_source_url=_.Mm(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().ta(),
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.ra())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},eA=function(a){_.Xh(a.a);a.j.ze(a.F);a.j.Rg(a.C)},cA=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:_.ea,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
- player_mux_plugin_version:_.ea};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},fA=function(a){a.a.on(a.m,_.fg,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.fg,b)});a.a.on(a.m,_.We,()=>a.emit(_.We));a.a.on(a.m,_.Mc,a.G.bind(a));a.a.on(a.m,_.Qf,a.I.bind(a));a.a.on(a.m,_.tg,()=>a.emit(_.If));a.a.on(a.m,_.sg,()=>a.emit(_.Hf));a.a.on(a.m,_.Xd,a.H.bind(a));a.a.on(a.m,_.Tb,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Ub,()=>a.emit("adbreakend"));a.a.on(a.m,_.lc,()=>
5
- {a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.gc,()=>a.emit("adpause"));a.a.on(a.m,_.jc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.mc,()=>a.emit("adended"));a.a.on(a.m,_.Yb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.dc,()=>a.emit("admidpoint"));a.a.on(a.m,_.nc,()=>a.emit("adthirdquartile"));a.j.md(a.F);a.j.Nf(a.C);a.a.on(a.m,_.Xd,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 _.gp(b.uris[b.uriIndex]);b={request_start:c,request_type:$z(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.gp(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:$z(c),request_hostname:f.a,request_error:`${$z(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
- a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},gA=function(a,b){a.trigger(new _.H(_.Xd,{detail:b}))},hA=function(a){return!_.z(a)&&typeof a.init===_.ae&&typeof a.emit===_.ae},Xz="manifest",Yz="media",Zz="encryption",aA=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var iA=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 _.Lt;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.K.bind(this);this.C=this.J.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,dA(this))}catch(d){throw this.h=!1,eA(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=cA(this),this.emit("videochange",
8
- a),this.l=!1);fA(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(eA(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Dd);this.A?this.g.debug(_.ha):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.I(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.g.debug(_.Ie);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Qa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Ne);
9
- switch(a.detail.currentState){case 1:this.m.getConfiguration().autoplay&&this.emit(_.We);break;case 3:this.emit(_.gf);break;case 4:this.emit(_.Se);break;case 5:this.emit(_.Wd)}}H(a){this.g.debug(_.Ke);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.D){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(_.Xd,{player_error_code:a.code,player_error_message:b})}}K(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 _.gp(b.uris[b.uriIndex]);a={request_start:g,request_type:$z(b),request_hostname:d.a,request_id:bA(e),request_bytes_loaded:f,request_response_start:h,
11
- request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Mm(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}J(a){a.requestStartTimestamp=Date.now()}};var jA=class extends _.Pv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.T("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new iA(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.dh(c.muxdata);try{var d=[];typeof c===_.He&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.I(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.z(f.muxdata)&&typeof f.muxdata===_.He){const g=f.muxdata;d=hA(g.muxLib)?g.muxLib:window.mux;if(!hA(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
- this.a=!1;const h=new _.I(1,9,9301);gA(a,h)}}else this.g.debug("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,gA(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&&gA(this.m,c),c;}}};_.x("clpp.muxdata.MuxDataPlugin",jA);jA.prototype.emit=jA.prototype.emit;
13
- jA.Id="mux";_.Pn(new class{create(){return new jA}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var cA=function(a){switch(a.type){case 1:return $z;case 2:return aA;case 3:return bA}},eA=function(a){const b=Object.keys(a).find(c=>dA.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},gA=function(a){let b={debug:!0,data:fA(a)};a.f&&a.f.muxOptionsOverride&&_.lh(a.f.muxOptionsOverride)&&(b=_.hh(b,a.f.muxOptionsOverride));b=_.hh(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.g.debug("getStateData()");var c=a.m.Sa(),d=a.m.getTrackManager();const f=a.m.getSurface();
2
+ 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 _.lp(c.url);e.video_source_url=_.Qm(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().ta(),c={videoWidth:c.width,
3
+ 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.ra())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},hA=function(a){_.ai(a.a);a.j.Xd(a.F);a.j.Cf(a.C)},fA=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:_.ea,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
+ player_mux_plugin_version:_.ea};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},iA=function(a){a.a.on(a.m,_.gg,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.gg,b)});a.a.on(a.m,_.Xe,()=>a.emit(_.Xe));a.a.on(a.m,_.Mc,a.G.bind(a));a.a.on(a.m,_.Rf,a.I.bind(a));a.a.on(a.m,_.ug,()=>a.emit(_.Jf));a.a.on(a.m,_.qg,()=>a.emit(_.If));a.a.on(a.m,_.Xd,a.H.bind(a));a.a.on(a.m,_.Ub,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Vb,()=>a.emit("adbreakend"));a.a.on(a.m,_.mc,()=>
5
+ {a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.hc,()=>a.emit("adpause"));a.a.on(a.m,_.kc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.nc,()=>a.emit("adended"));a.a.on(a.m,_.Zb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.ec,()=>a.emit("admidpoint"));a.a.on(a.m,_.oc,()=>a.emit("adthirdquartile"));a.j.Sc(a.F);a.j.Ue(a.C);a.a.on(a.m,_.Xd,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 _.lp(b.uris[b.uriIndex]);b={request_start:c,request_type:cA(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.lp(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:cA(c),request_hostname:f.a,request_error:`${cA(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
+ a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},jA=function(a,b){a.trigger(new _.H(_.Xd,{detail:b}))},kA=function(a){return!_.z(a)&&typeof a.init===_.ae&&typeof a.emit===_.ae},$z="manifest",aA="media",bA="encryption",dA=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var lA=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 _.Vt;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.K.bind(this);this.C=this.J.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,gA(this))}catch(d){throw this.h=!1,hA(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=fA(this),this.emit("videochange",
8
+ a),this.l=!1);iA(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(hA(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Dd);this.A?this.g.debug(_.ha):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.I(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.g.debug(_.Je);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Qa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Oe);
9
+ switch(a.detail.currentState){case 1:this.m.getConfiguration().autoplay&&this.emit(_.Xe);break;case 3:this.emit(_.hf);break;case 4:this.emit(_.Te);break;case 5:this.emit(_.Wd)}}H(a){this.g.debug(_.Le);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.D){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(_.Xd,{player_error_code:a.code,player_error_message:b})}}K(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 _.lp(b.uris[b.uriIndex]);a={request_start:g,request_type:cA(b),request_hostname:d.a,request_id:eA(e),request_bytes_loaded:f,request_response_start:h,
11
+ request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Qm(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}J(a){a.requestStartTimestamp=Date.now()}};var mA=class extends _.Uv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.T("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new lA(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.ih(c.muxdata);try{var d=[];typeof c===_.Ie&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.I(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.z(f.muxdata)&&typeof f.muxdata===_.Ie){const g=f.muxdata;d=kA(g.muxLib)?g.muxLib:window.mux;if(!kA(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
+ this.a=!1;const h=new _.I(1,9,9301);jA(a,h)}}else this.g.debug("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,jA(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&&jA(this.m,c),c;}}};_.x("clpp.muxdata.MuxDataPlugin",mA);mA.prototype.emit=mA.prototype.emit;
13
+ mA.Id="mux";_.Tn(new class{create(){return new mA}});};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 Wz=function(a,b){let c=b.baseUrl;_.vi(c,"/")||(c+="/");var d=h=>h&&(_.ui(h,_.fe)||_.ui(h,"http://")||_.ui(h,"//"))?h:`${c}${h}`;const e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");d=d(b.fairplayUrl||"fairplay");b=b.serverCertificate;const g=_.Oo("V2");a=new _.zu(a);a.ib(_.wd,{licenseUrl:e,videoRobustness:[_.pb,void 0],audioRobustness:[_.ob,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:_.Po(b,g),modifiers:{licenseRequest:_.vp,
2
- licenseResponse:_.wp}});a.ib(_.sd,{licenseUrl:d,certificateUrl:d,modifiers:{licenseRequest:_.yp,licenseResponse:_.zp,extractContentId:_.Ap,certificateRequest:_.Bp}});a.ib(_.ud,{licenseUrl:f,modifiers:{licenseRequest:_.vp}});_.jn(a)};
3
- _.x("clpp.onboard.OnboardComponent",class extends _.zv{constructor(){super();this.g=new _.T("clpp.onboard");this.a=new Set}uninstall(){for(const a of this.a)delete _.hn[a];this.a.clear()}beforeLoad(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,serverCertificate:a.serverCertificate,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),
4
- Wz(b,a),this.a.add(b))}id(){return"onboard"}});_.x("clpp.onboard.register",Wz);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Zz=function(a,b){let c=b.baseUrl;_.zi(c,"/")||(c+="/");var d=h=>h&&(_.yi(h,_.ge)||_.yi(h,_.fe)||_.yi(h,"//"))?h:`${c}${h}`;const e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");d=d(b.fairplayUrl||"fairplay");b=b.serverCertificate;const g=_.To("V2");a=new _.Op(a);a.Ga(_.wd,{licenseUrl:e,videoRobustness:[_.pb,void 0],audioRobustness:[_.ob,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:_.Uo(b,g),modifiers:{licenseRequest:_.Cp,licenseResponse:_.Dp}});
2
+ a.Ga(_.sd,{licenseUrl:d,certificateUrl:d,modifiers:{licenseRequest:_.Fp,licenseResponse:_.Gp,extractContentId:_.Hp,certificateRequest:_.Ip}});a.Ga(_.ud,{licenseUrl:f,modifiers:{licenseRequest:_.Cp}});_.nn(a)};
3
+ _.x("clpp.onboard.OnboardComponent",class extends _.Ev{constructor(){super();this.g=new _.T("clpp.onboard");this.a=new Set}uninstall(){for(const a of this.a)delete _.mn[a];this.a.clear()}beforeLoad(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,serverCertificate:a.serverCertificate,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),
4
+ Zz(b,a),this.a.add(b))}id(){return"onboard"}});_.x("clpp.onboard.register",Zz);};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 Hz="A persistent DRM session already exists for: ",Iz="No DRM configuration.",Jz="clpp.persistent",Kz="clpp.persistent.SimpleSessionStorage",Mz=function(a,b,c,d,e,f){a.K=Lz;const g=new Map,h=_.kq(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Pe,persistentState:_.zf,sessionTypes:[_.Ue],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,
2
- initData:null,keyIds:null}]});return _.Cq(a,g)},Oz=function(a,b){a.K=Nz;a.L=[];a.G=!0;return _.Dq(a,b)},Pz=function(a,b){return _.w(function*(){const c=yield _.Uq(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.nc=new _.Gl,d.push(e.nc));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)})},Qz=function(a){const b=[];for(const c of a.h.keys())b.push(c.sessionId);return b},Rz=function(a,b){const c=_.ln(a),d=_.an([{drm:a}]);
3
- d.drm=a;a=new _.Ds({Ab:b,onError:()=>{},df:()=>{},cf:()=>{},onEvent:()=>{},getConfiguration:()=>d,Tc:()=>null});a.f=c;return a},Uz=function(a,b,c){return _.w(function*(){const d=Sz;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Tz.debug(Hz,e);else{var g=Rz(a,c);try{yield Oz(g,b);yield _.Sq(g);yield _.Vq(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Tm(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:Qz(g),keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,
4
- serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Tz.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Tz.debug(Iz)})},Nz=1,Lz=2,Vz=class{constructor(){this.g=new _.T(Kz)}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);const e=JSON.stringify(b.audioCapabilities),
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Kz="A persistent DRM session already exists for: ",Lz="No DRM configuration.",Mz="clpp.persistent",Nz="clpp.persistent.SimpleSessionStorage",Pz=function(a,b,c,d,e,f){a.K=Oz;const g=new Map,h=_.uq(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Qe,persistentState:_.Af,sessionTypes:[_.Ve],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,
2
+ initData:null,keyIds:null}]});return _.Mq(a,g)},Rz=function(a,b){a.K=Qz;a.L=[];a.G=!0;return _.Nq(a,b)},Sz=function(a,b){return _.w(function*(){const c=yield _.dr(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.vc=new _.Kl,d.push(e.vc));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)})},Tz=function(a){const b=[];for(const c of a.h.keys())b.push(c.sessionId);return b},Uz=function(a,b){const c=_.pn(a),d=_.en([{drm:a}]);
3
+ d.drm=a;a=new _.Ns({Cb:b,onError:()=>{},rf:()=>{},qf:()=>{},onEvent:()=>{},getConfiguration:()=>d,bd:()=>null});a.f=c;return a},Xz=function(a,b,c){return _.w(function*(){const d=Vz;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Wz.debug(Kz,e);else{var g=Uz(a,c);try{yield Rz(g,b);yield _.br(g);yield _.er(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Xm(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:Tz(g),keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,
4
+ serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Wz.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Wz.debug(Lz)})},Qz=1,Oz=2,Yz=class{constructor(){this.g=new _.T(Nz)}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);const e=JSON.stringify(b.audioCapabilities),
5
5
  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),g=e.audioCapabilities||[],
6
- 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 _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return Kz}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.hh(a.store)||c.push("store"),_.hh(a.get)||c.push("get"),_.hh(a.delete)||c.push("delete"),_.hh(a.clear)||c.push("clear"),_.hh(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Tz.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});Sz=a});
7
- _.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=Sz,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.en(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(Iz);var g=b.offlineId;if(typeof g!==_.Tf||!g.length)throw e("Missing offline id.");if(yield d.get(g))Tz.debug(Hz,g);else{var h=_.Zm();d=new _.Dn;g=[];for(var k of c){const l=new k;_.Kh(l.id())||(l.install(),_.Mh(l),g.push(l))}k=null;try{k=yield _.Dt(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
- const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,onContentSteeringInfoFound:()=>null,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.I(_.D,4,4014));const m=_.st(l.periods);yield Uz(b,m,d)}catch(l){if(l instanceof _.I&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.uninstall(),_.Jh.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=Sz;if(_.jh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Dn,c=Rz(e.drmConfig,d),yield Mz(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Sq(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield Pz(c,f);Tz.debug("successfully removed session with id",f)}))),yield b.delete(a)):Tz.debug("No persistent DRM session found")}catch(e){throw Tz.error("Failed to remove session"),
10
- new _.I(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else Tz.warn("Invalid offlineId")})});_.x("clpp.persistent.getSessionStorage",function(){return Sz});var Sz=new Vz,Tz=new _.T(Jz);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.zv{constructor(){super();this.g=new _.T(Jz)}id(){return _.Te}f(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield Uz(d,b,e),a.trigger(new _.H(_.Pd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}a(a){const b=this;return _.w(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
- const c=Sz;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);
6
+ 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 _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return Nz}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.mh(a.store)||c.push("store"),_.mh(a.get)||c.push("get"),_.mh(a.delete)||c.push("delete"),_.mh(a.clear)||c.push("clear"),_.mh(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Wz.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});Vz=a});
7
+ _.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=Vz,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.jn(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(Lz);var g=b.offlineId;if(typeof g!==_.Uf||!g.length)throw e("Missing offline id.");if(yield d.get(g))Wz.debug(Kz,g);else{var h=_.cn();d=new _.Hn;g=[];for(var k of c){const l=new k;_.Ph(l.id())||(l.install(),_.Rh(l),g.push(l))}k=null;try{k=yield _.Nt(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
+ const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,onContentSteeringInfoFound:()=>null,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.I(_.D,4,4014));const m=_.Ct(l.periods);yield Xz(b,m,d)}catch(l){if(l instanceof _.I&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.uninstall(),_.Oh.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=Vz;if(_.oh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Hn,c=Uz(e.drmConfig,d),yield Pz(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.br(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield Sz(c,f);Wz.debug("successfully removed session with id",f)}))),yield b.delete(a)):Wz.debug("No persistent DRM session found")}catch(e){throw Wz.error("Failed to remove session"),
10
+ new _.I(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else Wz.warn("Invalid offlineId")})});_.x("clpp.persistent.getSessionStorage",function(){return Vz});var Vz=new Yz,Wz=new _.T(Mz);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.Ev{constructor(){super();this.g=new _.T(Mz)}id(){return _.Ue}f(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield Xz(d,b,e),a.trigger(new _.H(_.Pd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}a(a){const b=this;return _.w(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
+ const c=Vz;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);
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 Ez=function(a,b){return 0<=b&&b<a.a.length},Fz=function(a){a.trigger(new _.H(_.jf))},Gz=class extends _.Ot{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.Ea.bind(this)}getPosition(){return this.f}xd(){return this.a}Jb(){return 0<this.a.length&&Ez(this,this.f)?this.a[this.f]:null}sg(){const a=this.f+1;return 0<
2
- this.a.length&&Ez(this,a)?this.a[a]:null}We(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Wd,this.j),this.Wc(this.f,!0))}stop(){this.h=!1;this.m.off(_.Wd,this.j)}Ea(){this.next()}next(){const a=this;return _.w(function*(){yield a.Wc(Math.min(a.a.length-1,a.f+1))})}Od(){const a=this;return _.w(function*(){yield a.Wc(Math.max(0,a.f-1))})}Wc(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&Ez(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Jb();d&&!1===d.skippable||!d||(yield c.l(d),
3
- yield c.m.load(d.configuration),c.trigger(new _.H(_.hf,{item:d})))}})}append(a){this.a.push(a);Fz(this)}wg(a,b){if(0<=b&&b<=this.a.length){const c=this.Jb();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Fz(this)}}remove(a){if(0<this.a.length&&Ez(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Fz(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;Fz(this)}};_.x("clpp.Playlist",Gz);Gz.prototype.clear=Gz.prototype.clear;Gz.prototype.remove=Gz.prototype.remove;
4
- Gz.prototype.insert=Gz.prototype.wg;Gz.prototype.append=Gz.prototype.append;Gz.prototype.goTo=Gz.prototype.Wc;Gz.prototype.previous=Gz.prototype.Od;Gz.prototype.next=Gz.prototype.next;Gz.prototype.onEnded=Gz.prototype.Ea;Gz.prototype.stop=Gz.prototype.stop;Gz.prototype.start=Gz.prototype.start;Gz.prototype.isStarted=Gz.prototype.We;Gz.prototype.getUpcoming=Gz.prototype.sg;Gz.prototype.getCurrent=Gz.prototype.Jb;Gz.prototype.getQueue=Gz.prototype.xd;Gz.prototype.getPosition=Gz.prototype.getPosition;
5
- Gz.prototype.off=Gz.prototype.off;Gz.prototype.one=Gz.prototype.one;Gz.prototype.on=Gz.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Hz=function(a,b){return 0<=b&&b<a.a.length},Iz=function(a){a.trigger(new _.H(_.kf))},Jz=class extends _.Yt{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.Ea.bind(this)}getPosition(){return this.f}Hd(){return this.a}Mb(){return 0<this.a.length&&Hz(this,this.f)?this.a[this.f]:null}Dg(){const a=this.f+1;return 0<
2
+ this.a.length&&Hz(this,a)?this.a[a]:null}hf(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Wd,this.j),this.ed(this.f,!0))}stop(){this.h=!1;this.m.off(_.Wd,this.j)}Ea(){this.next()}next(){const a=this;return _.w(function*(){yield a.ed(Math.min(a.a.length-1,a.f+1))})}Wd(){const a=this;return _.w(function*(){yield a.ed(Math.max(0,a.f-1))})}ed(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&Hz(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Mb();d&&!1===d.skippable||!d||(yield c.l(d),
3
+ yield c.m.open(d.configuration),c.trigger(new _.H(_.jf,{item:d})))}})}append(a){this.a.push(a);Iz(this)}Hg(a,b){if(0<=b&&b<=this.a.length){const c=this.Mb();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Iz(this)}}remove(a){if(0<this.a.length&&Hz(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Iz(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;Iz(this)}};_.x("clpp.Playlist",Jz);Jz.prototype.clear=Jz.prototype.clear;Jz.prototype.remove=Jz.prototype.remove;
4
+ Jz.prototype.insert=Jz.prototype.Hg;Jz.prototype.append=Jz.prototype.append;Jz.prototype.goTo=Jz.prototype.ed;Jz.prototype.previous=Jz.prototype.Wd;Jz.prototype.next=Jz.prototype.next;Jz.prototype.onEnded=Jz.prototype.Ea;Jz.prototype.stop=Jz.prototype.stop;Jz.prototype.start=Jz.prototype.start;Jz.prototype.isStarted=Jz.prototype.hf;Jz.prototype.getUpcoming=Jz.prototype.Dg;Jz.prototype.getCurrent=Jz.prototype.Mb;Jz.prototype.getQueue=Jz.prototype.Hd;Jz.prototype.getPosition=Jz.prototype.getPosition;
5
+ Jz.prototype.off=Jz.prototype.off;Jz.prototype.one=Jz.prototype.one;Jz.prototype.on=Jz.prototype.on;};f.call(g, window);
package/cl.simid.js CHANGED
@@ -1,14 +1,14 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var nz="No surface found. Can not attach frame!",oz="SIMID:Media:timeupdate",pz="Starting creative",qz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},tz=function(a,b){return new Promise((c,d)=>{new rz(a.j,c,d,b);sz(a,b)})},uz=function(a){const b=qz(a,"SIMID:Player:startCreative",void 0);tz(a,b).then(()=>{var c=a.f;c.g.info(pz);c.m.trigger(new _.H(_.Kf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
- c)})},wz=function(a,b){_.w(function*(){a.h=b.sessionId;vz(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=qz(a,"SIMID:Player:init",d);var e=tz(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()}})},vz=function(a,b){sz(a,qz(a,"resolve",{messageId:b.messageId,
4
- value:void 0}))},sz=function(a,b){a.h?(b.type!==oz&&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}'`)},xz=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=qz(d,"SIMID:Player:resize",e);sz(d,e)}})},yz=function(a,b){a.g.info("SIMID Session created");a.a=b},zz=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 _.H(_.Lf))},Az=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}%`}},Bz=class{constructor(a,b){this.f=a;this.w=b;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";a=this.w.style;a.className?this.a.classList.add(a.className):(this.a.style.border=_.Ge,this.a.style.backgroundColor="transparent",this.a.style.transition=
7
- "opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.Ge,this.a.style.overflow=_.ce);this.a.classList.add(_.ad);this.o=c=>{if(c.source===this.a.contentWindow&&(c=(c=c.data)?typeof c===_.Tf?JSON.parse(c):c:null))if(c.type)switch(this.g.info(`Received message [${c.messageId}] '${c.type}':`,c.args),c.type){case "createSession":wz(this,c);break;case "resolve":c=c.args;var d=this.j.get(c.messageId);d&&d.resolve(c);break;case "reject":c=c.args;(d=this.j.get(c.messageId))&&d.reject(c);
8
- break;case "SIMID:Creative:requestResize":d=this.f;var e=c.args;d.g.info("Creative requested resize",e);if(d.m&&d.m.getSurface()&&d.m.getSurface().getMedia()&&e.mediaDimensions){d.h?d.m.getSurface().getMedia().style.transition="":(d.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",d.h=!0);const f=Az(d,e.mediaDimensions);d.m.getSurface().getMedia().style.left=f.left;d.m.getSurface().getMedia().style.top=f.top;d.m.getSurface().getMedia().style.width=f.width;d.m.getSurface().getMedia().style.height=
9
- f.height}e.creativeDimensions&&(e=Az(d,e.creativeDimensions),d.a.a.style.left=e.left,d.a.a.style.top=e.top,d.a.a.style.width=e.width,d.a.a.style.height=e.height);vz(this,c)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.T("clpp.simid.SimidPlayer");yz(this.f,this)}load(a){window.addEventListener(_.ze,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(){zz(this.f);
10
- this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.ze,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},rz=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);
11
- this.j(a)}};var Dz=class extends _.Pv{constructor(){super();this.g=new _.T("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 Cz(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length){this.l=b.simid.creatives;this.g.info(`Setting up SIMID plugin for ${this.l.length} creatives`);
12
- var c=this.m.getSurface();c?(this.g.info("Creating new session"),this.a=new Bz(this.h,b.simid),b=c.getContainer(),this.j=xz(this,b,c),this.j.observe(b),a.on(_.fg,this.w)):this.g.warn(nz)}}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&&(uz(this.a),this.o=!0,this.g.info(pz)),
13
- c&&(c=this.a,sz(c,qz(c,oz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(nz),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(_.fg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Cz=class{constructor(a){this.m=a;this.a=null;this.g=new _.T("clpp.simid.Loader");
14
- 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 _.I(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 _.I(1,10,10100,"No surface");return a}qg(){return this.a}url(){return this.f?this.f.url:""}};_.Pn(new class{create(){return new Dz}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var qz="No surface found. Can not attach frame!",rz="SIMID:Media:timeupdate",sz="Starting creative",tz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},wz=function(a,b){return new Promise((c,d)=>{new uz(a.j,c,d,b);vz(a,b)})},xz=function(a){const b=tz(a,"SIMID:Player:startCreative",void 0);wz(a,b).then(()=>{var c=a.f;c.g.info(sz);c.m.trigger(new _.H(_.Lf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
+ c)})},zz=function(a,b){_.w(function*(){a.h=b.sessionId;yz(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=tz(a,"SIMID:Player:init",d);var e=wz(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()}})},yz=function(a,b){vz(a,tz(a,"resolve",{messageId:b.messageId,
4
+ value:void 0}))},vz=function(a,b){a.h?(b.type!==rz&&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}'`)},Az=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=tz(d,"SIMID:Player:resize",e);vz(d,e)}})},Bz=function(a,b){a.g.info("SIMID Session created");a.a=b},Cz=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 _.H(_.Mf))},Dz=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}%`}},Ez=class{constructor(a,b){this.f=a;this.w=b;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";(a=this.w.style)&&a.className?this.a.classList.add(a.className):(this.a.style.border=_.He,this.a.style.backgroundColor="transparent",this.a.style.transition=
7
+ "opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.He,this.a.style.overflow=_.ce);this.a.classList.add(_.ad);this.o=c=>{if(c.source===this.a.contentWindow&&(c=(c=c.data)?typeof c===_.Uf?JSON.parse(c):c:null))if(c.type)switch(this.g.info(`Received message [${c.messageId}] '${c.type}':`,c.args),c.type){case "createSession":zz(this,c);break;case "resolve":c=c.args;var d=this.j.get(c.messageId);d&&d.resolve(c);break;case "reject":c=c.args;(d=this.j.get(c.messageId))&&d.reject(c);
8
+ break;case "SIMID:Creative:requestResize":d=this.f;var e=c.args;d.g.info("Creative requested resize",e);if(d.m&&d.m.getSurface()&&d.m.getSurface().getMedia()&&e.mediaDimensions){d.h?d.m.getSurface().getMedia().style.transition="":(d.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",d.h=!0);const f=Dz(d,e.mediaDimensions);d.m.getSurface().getMedia().style.left=f.left;d.m.getSurface().getMedia().style.top=f.top;d.m.getSurface().getMedia().style.width=f.width;d.m.getSurface().getMedia().style.height=
9
+ f.height}e.creativeDimensions&&(e=Dz(d,e.creativeDimensions),d.a.a.style.left=e.left,d.a.a.style.top=e.top,d.a.a.style.width=e.width,d.a.a.style.height=e.height);yz(this,c)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.T("clpp.simid.SimidPlayer");Bz(this.f,this)}load(a){window.addEventListener(_.Ae,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(){Cz(this.f);
10
+ this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Ae,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},uz=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);
11
+ this.j(a)}};var Gz=class extends _.Uv{constructor(){super();this.g=new _.T("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 Fz(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length){this.l=b.simid.creatives;this.g.info(`Setting up SIMID plugin for ${this.l.length} creatives`);
12
+ var c=this.m.getSurface();c?(this.g.info("Creating new session"),this.a=new Ez(this.h,b.simid),b=c.getContainer(),this.j=Az(this,b,c),this.j.observe(b),a.on(_.gg,this.w)):this.g.warn(qz)}}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&&(xz(this.a),this.o=!0,this.g.info(sz)),
13
+ c&&(c=this.a,vz(c,tz(c,rz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(qz),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(_.gg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Fz=class{constructor(a){this.m=a;this.a=null;this.g=new _.T("clpp.simid.Loader");
14
+ 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 _.I(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 _.I(1,10,10100,"No surface");return a}Bg(){return this.a}url(){return this.f?this.f.url:""}};_.Tn(new class{create(){return new Gz}});};f.call(g, window);
package/cl.smooth.js CHANGED
@@ -1,62 +1,62 @@
1
- import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var lQ="Full MP4 box must have flags defined",mQ="clpp.smooth.SmoothMP4Processor",nQ="codecPrivateData",oQ=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.M(a,c);_.M(a,b)},pQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Qo()}},qQ=function(a,b){pQ(a,b>>16&255);pQ(a,b>>8&255);pQ(a,b&255)},rQ=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Qo()}},sQ=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Qo()}},tQ=function(a,b){try{a.f.setInt16(a.a,
2
- b,a.h),a.a+=2}catch(c){_.Qo()}},uQ=function(a,b){let c=[];const d=[];for(var e=0,f=0;e<a.a.length&&f<b.length;){var g=a.a[e];const h=b[f];g.startTime<h.startTime?(c.push(g),e++):(g.startTime>h.startTime?0===e?d.push(h):a.g.info("Refusing to rewrite original references on update!"):(.1<Math.abs(g.endTime-h.endTime)?c.push(new _.pI(g.position,h.startTime,h.endTime,h.Da,h.na,h.ja,h.Ja,h.keyInfo,h.Pc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,null,h.Uc,h.Ga)):c.push(g),e++),
3
- f++)}for(;e<a.a.length;)c.push(a.a[e++]);if(c.length)for(e=c[c.length-1].position+1;f<b.length;)g=b[f++],g=new _.pI(e++,g.startTime,g.endTime,g.Da,g.na,g.ja,g.Ja,g.keyInfo,g.Pc,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile,null,null,g.Uc,g.Ga),c.push(g);else c=b;b=c;if(d.length&&c.length){b=[];f=c[0].position;e=d.length;for(const h of d)b.push(new _.pI(f-e--,h.startTime,h.endTime,h.Da,h.na,h.ja,h.Ja,h.keyInfo,h.Pc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,
4
- null,h.Uc,h.Ga));for(const h of c)b.push(h)}a.a=b},vQ=function(a,b){for(let c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);b=a.a;a.a=[];return b},wQ=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},xQ=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:
5
- `${a}/Manifest`},yQ=function(a,b,c,d){c=b.jg[c];b=b.ij;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.oB([a],[b])[0]},zQ=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.t?c=["maxWidth","maxHeight","bitrate",nQ,"fourCC"]:a.type===_.q&&(c=["bitrate",nQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.lh(a,b,c,["id","segmentIndex"])},
6
- AQ=function(a,b,c){const d=c.de.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,jb:null,jc:null,width:NaN,height:NaN,fc:null,Pd:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.t:a.jb=[_.bm(d[1])];a.jc=[_.bm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.q:a.fc=_.bm(c.de),a.sampleSize=c.wh||16,a.Pd=c.Pd,a.channelCount=c.$f}return a},BQ=function(a,b){return a.filter(c=>c.type===b)},CQ=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+
7
- (Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},JQ=function(a,b,c){var d=null;if(DQ.test(a)){{a=DQ.exec(a);d=Number(a[1]);const e=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 EQ.test(a)?d=CQ(EQ,a):FQ.test(a)?d=CQ(FQ,a):GQ.test(a)?(a=GQ.exec(a),d=Number(a[1])/c.frameRate):HQ.test(a)?(a=HQ.exec(a),d=Number(a[1])/c.a):IQ.test(a)&&(d=CQ(IQ,a));c=d;d=c+b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*
8
- 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},KQ=function(a){let b=0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.kp(b)},RQ=function(a,b,c){a:{var d=[_.wd,_.ud];for(e of d)if((d=c.ke(e))&&d.keyId){var e=d.keyId;break a}_.C(mQ,"Could not get default Key ID for DRM init data!");e=null}c=new LQ("xxxx");a.type===_.t?c=new MQ(a.width,a.height):c=new NQ(a.channelCount,a.sampleSize,a.Pd);a=new OQ;a.f=1;a.h=8;a.l=e||"00000000000000000000000000000000";
9
- a=(new LQ("schi")).append([a]);b=(new LQ(_.Mf)).append([new PQ(b),new QQ(_.Wc,65536),a]);c.append([b]);return c},tR=function(a,b){var c=b.le(),d=new SQ(a.timescale,a.duration,a.id),e=(new TQ).append([new UQ(a.id)]),f=new VQ(a.id,a.duration,a.timescale,a.width,a.height),g=new WQ(a.timescale,a.duration);const h=new XQ(a.type);var k=null,l=new YQ;l.entries=[new ZQ];var m=new $Q;switch(a.type){case _.t:k=new aR(a.jb,a.jc);c?(a=RQ(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new bR(a.width,a.height)).append([k]),
10
- m.entries=[a]);k=new cR;break;case _.q:k=new dR(a.fc),c?(a=RQ(a,"mp4a",b),a.append([k]),m.entries=[a]):(a=(new eR(a.channelCount,a.sampleSize,a.Pd)).append([k]),m.entries=[a]),k=new fR}m=(new gR).append([m,new hR,new iR,new jR,new kR]);l=(new lR).append([l]);l=(new mR).append([k,l,m]);g=(new nR).append([g,h,l]);f=(new oR).append([f,g]);d=(new pR).append([d,f,e]);e=new qR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.ke(_.ud),b=b.ke(_.wd),c&&d.append([new rR("pssh",c.initData,8)]),b&&d.append([new rR("pssh",
11
- b.initData,8)]),c||b||_.C(mQ,"Could not get PSSH init data!"));b=new sR([e,d]);return _.G(b.write())},DR=function(a,b){let c,d,e,f,g,h;(new _.ip).O("moof",_.bp).fa("mfhd",k=>{{const l=new uR;l.f=_.N(k.reader);c=l}}).O("traf",_.bp).fa("tfhd",k=>{{const l=k.reader.Sa();if(null===k.flags)throw new _.I(_.D,3,3019,lQ);const m=new vR(k.version||0,k.flags||0);m.f=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.Xo(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.N(k.reader));0<l-k.reader.getPosition()&&
12
- k.flags&8&&(m.j=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&32&&(m.l=_.N(k.reader));d=m}}).fa("trun",k=>{{var l=k.reader.Sa();if(null===k.flags)throw new _.I(_.D,3,3019,lQ);const m=new wR(k.version||0,k.flags||0);m.f=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.Wo(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.l=_.N(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.f;l++)k.flags&256&&m.o.push(_.N(k.reader)),
13
- k.flags&512&&m.sampleSize.push(_.N(k.reader)),k.flags&1024&&m.A.push(_.N(k.reader)),k.flags&2048&&(0===k.version?m.h.push(_.N(k.reader)):m.h.push(_.Wo(k.reader)));e=m}}).fa("sdtp",k=>{{const l=_.Zo(k.reader,k.reader.Sa());f=new xR("sdtp",k.version||0,k.flags||0,l,0)}}).O("uuid",k=>{var l=_.Zo(k.reader,16);if(_.dm(l,yR)){l=_.N(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new zR(k.version,k.flags);l.h=_.N(k.reader);k.flags&1&&(l.j=_.Uo(k.reader));for(let m=0;m<l.h;m++){const n={vg:_.Zo(k.reader,
14
- 8),ld:0,yf:[]};if(k.flags&2){n.ld=_.Vo(k.reader);for(let p=0;p<n.ld;p++){const u={Wf:0,Xf:0};u.Wf=_.Vo(k.reader);u.Xf=_.N(k.reader);n.yf.push(u)}}l.f.push(n)}g=l}}).O(_.xe,k=>{{const l=new AR;0<k.reader.Sa()?l.f=_.Zo(k.reader,k.reader.Sa()):(_.C(mQ,"mdat box is empty!"),l.f=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new BR).append([d,e]);f&&a.append([f]);b.le()&&g&&a.append([g]);b=(new CR).append([c,a]);return new sR([b,h])},IR=function(a,b,c,d){var e=d.le(),f=parseInt(c*b,10);b=a.data||
15
- new ArrayBuffer(0);var g=DR(b,d);if(null===g)return a.request.contentType===_.K?a.data:g;d=g.get(_.xe);if(a.request.contentType===_.K){e=d.f.buffer;if(c){e=_.qi(e);if((e=(new DOMParser).parseFromString(e,_.$f))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new ER(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");
16
- for(let u=0,v=f.length;u<v;u++){h=f[u];a=c;b=d;g=["begin",_.Vd];for(let y=0,A=g.length;y<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 E=l.length;for(;n<E;n++){var p=l[n].name;if(p=p.match(m)){k=k.getAttribute(p[0]);break b}}k=null}h.setAttribute(g[y],JQ(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.ri(e).buffer}else c=e;return c}h=new CR;a=g.get("mfhd");b=new BR;k=g.get("tfhd");m=new FR(1,f);f=g.get("trun");
17
- n=g.get("sdtp");c=g.get("senc");k.f=1;k.flags&=16777214;k.flags|=131072;b.append([k,m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.h;m++)k.push(10+6*c.f[m].ld);else g=8;b.append([c,new GR,new HR(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new sR([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},JR=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,
18
- audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},KR=function(a){return{initData:_.bB(_.$p(a)),initDataType:_.Wc,keyId:a,periodId:null}},LR=function(a,b,c){a=_.hq(a);c&&a.version!==c&&(a=_.dB(a,c));return{initData:_.bB(a),initDataType:_.Wc,keyId:b,periodId:null}},MR=function(a,b){return _.w(function*(){var c=_.vk(b);c.timeout=a.f.attemptParameters.timeout;c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length);c.baseDelay=a.f.attemptParameters.baseDelay;
19
- c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;c.type=1;c=yield a.D.networkingEngine.fetch(c).V;a.o=c.uri;return c})},UR=function(a,b){const c=_.O;let d=null;try{const jb=_.qi(b);d=c.j(jb,_.sb)}catch(jb){}if(!d)throw a.g.error("Unable to parse manifest"),new _.I(_.D,4,4033,a.o);const e=+NR(a,d,"MajorVersion"),f=+NR(a,d,"MinorVersion"),g=+d.getAttribute("TimeScale")||1E7;let h=+NR(a,d,"Duration");const k="TRUE"===d.getAttribute("IsLive"),l=+d.getAttribute("LookAheadCount"),
20
- m=+d.getAttribute("DVRWindowLength")||Infinity,n=c.a(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.I(_.D,4,4036,a.o);k?(OR(a,PR),a.B=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),h=Infinity):OR(a,QR);a.a={startTime:0,delay:0,duration:h/g,Ne:m/g,Gd:0};if(n){{var p=a.f.playreadyVersion;const jb=_.O,xa=[],wb=jb.a(n,"ProtectionHeader")[0],wc=_.am(jb.f(wb)||""),hc=_.hq(wc).a;xa.push(JR(_.wd,
21
- KR(hc),[hc]));xa.push(JR(_.ud,LR(wc,hc,p),[hc]));var u=xa}a.w=u}{const jb=[],xa=_.O.a(d,"StreamIndex");if(!xa.length)throw a.g.error("No streams found!"),new _.I(_.D,4,4034,a.o);for(let wb=0;wb<xa.length;wb++){{var v=a,y=xa[wb];const wc=NR(v,y,"Type"),hc=+y.getAttribute("Chunks"),Gh=y.getAttribute("Subtype")||"",ue=y.getAttribute("Language")||_.kg,ve=_.Gn(ue),Hh=y.getAttribute("Name")||"",lf=+y.getAttribute(_.Qa),ng=+y.getAttribute(_.Pa),zs=NR(v,y,"Url"),Dm=+y.getAttribute("TimeScale")||null;{const dd=
22
- [],pj=_.O.a(y,_.lb);for(let we=0;we<pj.length;we++){{let ed,Na,Od;var A=v,E=pj[we],B=wc;const qj=+E.getAttribute("Index"),og=+NR(A,E,"Bitrate");let xc=NaN,pg=NaN,Em=NaN,As=NaN,JF=NaN,KF=NaN,LF=NaN;const MF=E.getAttribute("FourCC")||"";switch(B){case _.t:xc=+NR(A,E,_.Pa);pg=+NR(A,E,_.Qa);break;case _.q:As=+E.getAttribute("Channels")||2,Em=+NR(A,E,"SamplingRate"),KF=+NR(A,E,"AudioTag"),JF=+NR(A,E,"BitsPerSample"),LF=+NR(A,E,"PacketSize")}let Bs=String(E.getAttribute("CodecPrivateData"));if(B===_.q&&
23
- !Bs){{var F=As;const NF={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},Fm=NF[Em];if("AACH"===MF){Na=new Uint8Array(4);const OF=NF[2*Em];Na[0]=40|Fm>>1;Na[1]=Fm<<7|F<<3|OF>>1;Na[2]=OF<<7|8;Na[3]=0;ed=new Uint16Array(2);ed[0]=(Na[0]<<8)+Na[1];ed[1]=(Na[2]<<8)+Na[3];Od=ed[0].toString(16)+ed[1].toString(16)}else Na=new Uint8Array(2),Na[0]=16|Fm>>1,Na[1]=Fm<<7|F<<3,ed=new Uint16Array(1),ed[0]=(Na[0]<<8)+Na[1],Od=ed[0].toString(16);Bs=Od.toUpperCase()}}var ka=
24
- {id:A.U++,type:B,index:qj,bitrate:og,de:Bs,maxHeight:xc,maxWidth:pg,Pd:Em,$f:As,oj:KF,wh:JF,Bj:LF,Oh:MF,segmentIndex:null}}dd.push(ka)}var Ya=dd}{const dd=[],pj=_.O.a(y,"c");for(let we=0;we<pj.length;we++){const ed=pj[we];let Na=parseInt(ed.getAttribute("t"),10),Od=parseInt(ed.getAttribute("d"),10),qj=parseInt(ed.getAttribute("r"),10),og=0;if(isNaN(Na)&&isNaN(Od))throw v.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.I(_.D,4,4037,
25
- v.o);0===we&&isNaN(Na)&&(og=Na=0);if(0<we){const xc=dd[dd.length-1];og=xc.n+1;xc.d||(xc.d=Na-xc.t);Na||(Na=xc.t+xc.d);Od||(Od=Na-xc.t)}dd.push({n:og,d:Od,t:Na});if(qj){qj--;for(let xc=0;xc<qj;xc++){const pg=dd[dd.length-1];og=pg.n+1;Na=pg.t+pg.d;Od=pg.d;dd.push({n:og,d:Od,t:Na})}}}v.F()||dd.length===hc||v.g.warn("Number of fragments ("+hc+") differs from number of chunks ("+dd.length+").");var db=dd}var tc={type:wc,sj:hc,Wi:Gh,language:ve,bd:ue,name:Hh,maxWidth:lf,maxHeight:ng,ij:zs,tracks:Ya,jg:db,
26
- timescale:Dm}}jb.push(tc)}var Ob=jb}const ec={Aj:e,Bg:f,timescale:g,duration:h,isLive:k,zj:l,Ne:m,Ue:!1,streams:Ob};if(a.j&&a.A)return RR(a,ec),Promise.resolve();a.H.clear();{const jb=ec.timescale,xa=ec.duration,wb=BQ(ec.streams,_.q),wc=BQ(ec.streams,_.t),hc=BQ(ec.streams,_.K),Gh=[];let ue=SR(a,xa,jb,wb),ve=SR(a,xa,jb,wc);const Hh=SR(a,xa,jb,hc);ue.length||(ue=[null]);ve.length||(ve=[null]);for(let lf=0;lf<ve.length;lf++)for(let ng=0;ng<ue.length;ng++)Gh.push(TR(a,ve[lf],ue[ng]));var fc={id:"ID",
27
- configurationId:void 0,startTime:0,endTime:xa,variants:Gh,textStreams:Hh,thumbStreams:[]}}{var Hb=ec.streams;let jb=a.a.startTime,xa=a.a.delay;const wb=a.J;let wc=Math.min(a.a.duration||Infinity,wb);const hc=a.F(),Gh=a.a.Ne,ue=a.a.Gd,ve=a.I,Hh=isFinite(a.G)?a.G:0;if(hc)wc=Infinity,jb=Date.now()/1E3-ue,a.a.startTime=jb,xa=3*ve;else{const ng=isFinite(wb)?wb:a.a.duration;for(const zs of Hb)for(const Dm of zs.tracks)Dm.segmentIndex.offset(-Hh),_.TB(Dm.segmentIndex,ng)}const lf=a.f.timeline||{};lf.type=
28
- void 0;a.C=new _.sI(lf,jb,xa,!hc,!0);a.C.f=wc;_.kC(a.C,ve);a.C.A=Gh;hc||a.C.offset(-Hh)}a.D.filterAllPeriods([fc]);a.j={presentationTimeline:a.C,periods:[fc],minBufferTime:0,cues:[]};Promise.resolve();a.L||(a.D.networkingEngine.md(a.M),a.L=!0);a.A=ec;return Promise.resolve()},VR=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.Yb.bind(a),b))},NR=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.I(_.D,4,4038,a.o,c);},OR=function(a,
29
- b){const c=b===QR;a.j&&a.j.presentationTimeline&&_.fC(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.N=b},RR=function(a,b){for(let e=0;e<a.A.streams.length;e++){const f=b.streams[e];for(const g of a.A.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){zQ(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=WR(a,a.A.timescale,f,c);c=g.segmentIndex;uQ(c,d);(d=a.a.Ne)&&
30
- vQ(c,(c.a.length?c.a[c.a.length-1].endTime:0)-d).forEach(h=>{h.Da().forEach(k=>{a.H.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},WR=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.jg.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.G=Math.min(a.G,h)):h=f[k-1].endTime;const m=h+l,n=yQ(a.o,c,k,d);a.I=Math.max(a.I,l);f.push(new _.pI(k,h,m,()=>[n],0,null,0,null,!0,g));a.H.set(n,h);e+=l});if(c.type===_.t||c.type===
31
- _.q)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Gd?a.a.Gd=b.endTime:a.a.Gd=Math.min(a.a.Gd,b.endTime);return f},SR=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=WR(a,c,k,h);const F=new _.tI(l);var m=null;k.type!==_.K&&(m=YR(a,b,c,k,h));h.segmentIndex=F;l=_.nI++;var n=Promise.resolve.bind(Promise),p=F.f.bind(F),u=F.get.bind(F),v=F.h.bind(F),y=F.getDuration.bind(F),A=ZR[k.type];var E="";switch(k.type){case _.t:E=h.de;var B=/00000001[0-9]7/.exec(E);
32
- E="avc1."+(B&&B[0]?E.substr(E.indexOf(B[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.q:E=h.de,B=2,"AACH"===h.Oh?B=5:E&&(B=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+B,a.g.debug("AUDIO CODECS: ",E)}B=k.type===_.K?$R[k.Wi]:void 0;h={id:l,originalId:null,Ej:null,createSegmentIndex:n,findSegmentPosition:p,getSegmentReference:u,adjustSegmentDurations:v,getDuration:y,segmentIndex:F,segmentLookupStrategy:_.JA,initSegmentReference:m,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,
33
- width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:B,encrypted:a.K(),keyId:null,language:k.language,originalLanguage:k.bd,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.$f||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},TR=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.kg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,
34
- allowedByKeySystem:!0}:null},YR=function(a,b,c,d,e){b=AQ(b,d.timescale||c,e);c={isLive:a.F.bind(a),le:a.K.bind(a),Wh:()=>1,ke:a.R.bind(a)};d=new Uint8Array(0);try{d=tR(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.I(_.D,3,4035,g);}const f="data:text/plain;base64,"+_.$l(d);return new _.oI(()=>[f],0,null,null,!0)},LQ=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]}append(a=[]){for(let b=0;b<a.length;b++)this.children.push(a[b]),
1
+ import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var wQ="Full MP4 box must have flags defined",xQ="clpp.smooth.SmoothMP4Processor",yQ="codecPrivateData",zQ=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.M(a,c);_.M(a,b)},AQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Vo()}},BQ=function(a,b){AQ(a,b>>16&255);AQ(a,b>>8&255);AQ(a,b&255)},CQ=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Vo()}},DQ=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Vo()}},EQ=function(a,b){try{a.f.setInt16(a.a,
2
+ b,a.h),a.a+=2}catch(c){_.Vo()}},FQ=function(a,b){let c=[];const d=[];for(var e=0,f=0;e<a.a.length&&f<b.length;){var g=a.a[e];const h=b[f];g.startTime<h.startTime?(c.push(g),e++):(g.startTime>h.startTime?0===e?d.push(h):a.g.info("Refusing to rewrite original references on update!"):(.1<Math.abs(g.endTime-h.endTime)?c.push(new _.rI(g.position,h.startTime,h.endTime,h.Da,h.na,h.ja,h.Ka,h.keyInfo,h.Xc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,null,h.cd,h.Ha)):c.push(g),e++),
3
+ f++)}for(;e<a.a.length;)c.push(a.a[e++]);if(c.length)for(e=c[c.length-1].position+1;f<b.length;)g=b[f++],g=new _.rI(e++,g.startTime,g.endTime,g.Da,g.na,g.ja,g.Ka,g.keyInfo,g.Xc,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile,null,null,g.cd,g.Ha),c.push(g);else c=b;b=c;if(d.length&&c.length){b=[];f=c[0].position;e=d.length;for(const h of d)b.push(new _.rI(f-e--,h.startTime,h.endTime,h.Da,h.na,h.ja,h.Ka,h.keyInfo,h.Xc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,
4
+ null,h.cd,h.Ha));for(const h of c)b.push(h)}a.a=b},GQ=function(a,b){for(let c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);b=a.a;a.a=[];return b},HQ=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},IQ=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:
5
+ `${a}/Manifest`},JQ=function(a,b,c,d){c=b.vg[c];b=b.tj;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.qB([a],[b])[0]},KQ=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.t?c=["maxWidth","maxHeight","bitrate",yQ,"fourCC"]:a.type===_.q&&(c=["bitrate",yQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.qh(a,b,c,["id","segmentIndex"])},
6
+ LQ=function(a,b,c){const d=c.pe.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,kb:null,rc:null,width:NaN,height:NaN,lc:null,Yd:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.t:a.kb=[_.fm(d[1])];a.rc=[_.fm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.q:a.lc=_.fm(c.pe),a.sampleSize=c.Hh||16,a.Yd=c.Yd,a.channelCount=c.lg}return a},MQ=function(a,b){return a.filter(c=>c.type===b)},NQ=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+
7
+ (Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},UQ=function(a,b,c){var d=null;if(OQ.test(a)){{a=OQ.exec(a);d=Number(a[1]);const e=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 PQ.test(a)?d=NQ(PQ,a):QQ.test(a)?d=NQ(QQ,a):RQ.test(a)?(a=RQ.exec(a),d=Number(a[1])/c.frameRate):SQ.test(a)?(a=SQ.exec(a),d=Number(a[1])/c.a):TQ.test(a)&&(d=NQ(TQ,a));c=d;d=c+b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*
8
+ 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},VQ=function(a){let b=0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.pp(b)},bR=function(a,b,c){a:{var d=[_.wd,_.ud];for(e of d)if((d=c.xe(e))&&d.keyId){var e=d.keyId;break a}_.B(xQ,"Could not get default Key ID for DRM init data!");e=null}c=new WQ("xxxx");a.type===_.t?c=new XQ(a.width,a.height):c=new YQ(a.channelCount,a.sampleSize,a.Yd);a=new ZQ;a.f=1;a.h=8;a.l=e||"00000000000000000000000000000000";
9
+ a=(new WQ("schi")).append([a]);b=(new WQ(_.Nf)).append([new $Q(b),new aR(_.Wc,65536),a]);c.append([b]);return c},ER=function(a,b){var c=b.ye(),d=new cR(a.timescale,a.duration,a.id),e=(new dR).append([new eR(a.id)]),f=new fR(a.id,a.duration,a.timescale,a.width,a.height),g=new gR(a.timescale,a.duration);const h=new hR(a.type);var k=null,l=new iR;l.entries=[new jR];var m=new kR;switch(a.type){case _.t:k=new lR(a.kb,a.rc);c?(a=bR(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new mR(a.width,a.height)).append([k]),
10
+ m.entries=[a]);k=new nR;break;case _.q:k=new oR(a.lc),c?(a=bR(a,"mp4a",b),a.append([k]),m.entries=[a]):(a=(new pR(a.channelCount,a.sampleSize,a.Yd)).append([k]),m.entries=[a]),k=new qR}m=(new rR).append([m,new sR,new tR,new uR,new vR]);l=(new wR).append([l]);l=(new xR).append([k,l,m]);g=(new yR).append([g,h,l]);f=(new zR).append([f,g]);d=(new AR).append([d,f,e]);e=new BR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.xe(_.ud),b=b.xe(_.wd),c&&d.append([new CR("pssh",c.initData,8)]),b&&d.append([new CR("pssh",
11
+ b.initData,8)]),c||b||_.B(xQ,"Could not get PSSH init data!"));b=new DR([e,d]);return _.G(b.write())},OR=function(a,b){let c,d,e,f,g,h;(new _.np).N("moof",_.gp).fa("mfhd",k=>{{const l=new FR;l.f=_.N(k.reader);c=l}}).N("traf",_.gp).fa("tfhd",k=>{{const l=k.reader.Ta();if(null===k.flags)throw new _.I(_.D,3,3019,wQ);const m=new GR(k.version||0,k.flags||0);m.f=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.bp(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.N(k.reader));0<l-k.reader.getPosition()&&
12
+ k.flags&8&&(m.j=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&32&&(m.l=_.N(k.reader));d=m}}).fa("trun",k=>{{var l=k.reader.Ta();if(null===k.flags)throw new _.I(_.D,3,3019,wQ);const m=new HR(k.version||0,k.flags||0);m.f=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.ap(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.l=_.N(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.f;l++)k.flags&256&&m.o.push(_.N(k.reader)),
13
+ k.flags&512&&m.sampleSize.push(_.N(k.reader)),k.flags&1024&&m.A.push(_.N(k.reader)),k.flags&2048&&(0===k.version?m.h.push(_.N(k.reader)):m.h.push(_.ap(k.reader)));e=m}}).fa("sdtp",k=>{{const l=_.dp(k.reader,k.reader.Ta());f=new IR("sdtp",k.version||0,k.flags||0,l,0)}}).N("uuid",k=>{var l=_.dp(k.reader,16);if(_.hm(l,JR)){l=_.N(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new KR(k.version,k.flags);l.h=_.N(k.reader);k.flags&1&&(l.j=_.Zo(k.reader));for(let m=0;m<l.h;m++){const n={Gg:_.dp(k.reader,
14
+ 8),vd:0,Lf:[]};if(k.flags&2){n.vd=_.$o(k.reader);for(let p=0;p<n.vd;p++){const u={hg:0,ig:0};u.hg=_.$o(k.reader);u.ig=_.N(k.reader);n.Lf.push(u)}}l.f.push(n)}g=l}}).N(_.ve,k=>{{const l=new LR;0<k.reader.Ta()?l.f=_.dp(k.reader,k.reader.Ta()):(_.B(xQ,"mdat box is empty!"),l.f=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new MR).append([d,e]);f&&a.append([f]);b.ye()&&g&&a.append([g]);b=(new NR).append([c,a]);return new DR([b,h])},TR=function(a,b,c,d){var e=d.ye(),f=parseInt(c*b,10);b=a.data||
15
+ new ArrayBuffer(0);var g=OR(b,d);if(null===g)return a.request.contentType===_.K?a.data:g;d=g.get(_.ve);if(a.request.contentType===_.K){e=d.f.buffer;if(c){e=_.ui(e);if((e=(new DOMParser).parseFromString(e,_.ag))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new PR(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");
16
+ for(let u=0,v=f.length;u<v;u++){h=f[u];a=c;b=d;g=["begin",_.Vd];for(let y=0,A=g.length;y<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 E=l.length;for(;n<E;n++){var p=l[n].name;if(p=p.match(m)){k=k.getAttribute(p[0]);break b}}k=null}h.setAttribute(g[y],UQ(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.vi(e).buffer}else c=e;return c}h=new NR;a=g.get("mfhd");b=new MR;k=g.get("tfhd");m=new QR(1,f);f=g.get("trun");
17
+ n=g.get("sdtp");c=g.get("senc");k.f=1;k.flags&=16777214;k.flags|=131072;b.append([k,m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.h;m++)k.push(10+6*c.f[m].vd);else g=8;b.append([c,new RR,new SR(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new DR([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},UR=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,
18
+ audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},VR=function(a){return{initData:_.dB(_.jq(a)),initDataType:_.Wc,keyId:a,periodId:null}},WR=function(a,b,c){a=_.rq(a);c&&a.version!==c&&(a=_.fB(a,c));return{initData:_.dB(a),initDataType:_.Wc,keyId:b,periodId:null}},YR=function(a,b){return _.w(function*(){var c=_.zk(b);c.timeout=a.f.attemptParameters.timeout;c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length);c.baseDelay=a.f.attemptParameters.baseDelay;
19
+ c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;c.type=1;c=yield a.D.networkingEngine.fetch(c).V;a.o=c.uri;return c})},fS=function(a,b){const c=_.O;let d=null;try{const kb=_.ui(b);d=c.j(kb,_.sb)}catch(kb){}if(!d)throw a.g.error("Unable to parse manifest"),new _.I(_.D,4,4033,a.o);const e=+ZR(a,d,"MajorVersion"),f=+ZR(a,d,"MinorVersion"),g=+d.getAttribute("TimeScale")||1E7;let h=+ZR(a,d,"Duration");const k="TRUE"===d.getAttribute("IsLive"),l=+d.getAttribute("LookAheadCount"),
20
+ m=+d.getAttribute("DVRWindowLength")||Infinity,n=c.a(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.I(_.D,4,4036,a.o);k?($R(a,aS),a.B=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),h=Infinity):$R(a,bS);a.a={startTime:0,delay:0,duration:h/g,af:m/g,Qd:0};if(n){{var p=a.f.playreadyVersion;const kb=_.O,ya=[],yb=kb.a(n,"ProtectionHeader")[0],xc=_.em(kb.f(yb)||""),ic=_.rq(xc).a;ya.push(UR(_.wd,
21
+ VR(ic),[ic]));ya.push(UR(_.ud,WR(xc,ic,p),[ic]));var u=ya}a.w=u}{const kb=[],ya=_.O.a(d,"StreamIndex");if(!ya.length)throw a.g.error("No streams found!"),new _.I(_.D,4,4034,a.o);for(let yb=0;yb<ya.length;yb++){{var v=a,y=ya[yb];const xc=ZR(v,y,"Type"),ic=+y.getAttribute("Chunks"),Mh=y.getAttribute("Subtype")||"",we=y.getAttribute("Language")||_.lg,xe=_.Kn(we),Nh=y.getAttribute("Name")||"",qf=+y.getAttribute(_.Ra),rg=+y.getAttribute(_.Qa),Js=ZR(v,y,"Url"),Hm=+y.getAttribute("TimeScale")||null;{const dd=
22
+ [],sj=_.O.a(y,_.lb);for(let ye=0;ye<sj.length;ye++){{let ed,Oa,Od;var A=v,E=sj[ye],F=xc;const tj=+E.getAttribute("Index"),sg=+ZR(A,E,"Bitrate");let yc=NaN,tg=NaN,Im=NaN,Ks=NaN,bG=NaN,cG=NaN,dG=NaN;const eG=E.getAttribute("FourCC")||"";switch(F){case _.t:yc=+ZR(A,E,_.Qa);tg=+ZR(A,E,_.Ra);break;case _.q:Ks=+E.getAttribute("Channels")||2,Im=+ZR(A,E,"SamplingRate"),cG=+ZR(A,E,"AudioTag"),bG=+ZR(A,E,"BitsPerSample"),dG=+ZR(A,E,"PacketSize")}let Ls=String(E.getAttribute("CodecPrivateData"));if(F===_.q&&
23
+ !Ls){{var C=Ks;const fG={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},Jm=fG[Im];if("AACH"===eG){Oa=new Uint8Array(4);const gG=fG[2*Im];Oa[0]=40|Jm>>1;Oa[1]=Jm<<7|C<<3|gG>>1;Oa[2]=gG<<7|8;Oa[3]=0;ed=new Uint16Array(2);ed[0]=(Oa[0]<<8)+Oa[1];ed[1]=(Oa[2]<<8)+Oa[3];Od=ed[0].toString(16)+ed[1].toString(16)}else Oa=new Uint8Array(2),Oa[0]=16|Jm>>1,Oa[1]=Jm<<7|C<<3,ed=new Uint16Array(1),ed[0]=(Oa[0]<<8)+Oa[1],Od=ed[0].toString(16);Ls=Od.toUpperCase()}}var ja=
24
+ {id:A.U++,type:F,index:tj,bitrate:sg,pe:Ls,maxHeight:yc,maxWidth:tg,Yd:Im,lg:Ks,yj:cG,Hh:bG,Lj:dG,Zh:eG,segmentIndex:null}}dd.push(ja)}var Ca=dd}{const dd=[],sj=_.O.a(y,"c");for(let ye=0;ye<sj.length;ye++){const ed=sj[ye];let Oa=parseInt(ed.getAttribute("t"),10),Od=parseInt(ed.getAttribute("d"),10),tj=parseInt(ed.getAttribute("r"),10),sg=0;if(isNaN(Oa)&&isNaN(Od))throw v.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.I(_.D,4,4037,
25
+ v.o);0===ye&&isNaN(Oa)&&(sg=Oa=0);if(0<ye){const yc=dd[dd.length-1];sg=yc.n+1;yc.d||(yc.d=Oa-yc.t);Oa||(Oa=yc.t+yc.d);Od||(Od=Oa-yc.t)}dd.push({n:sg,d:Od,t:Oa});if(tj){tj--;for(let yc=0;yc<tj;yc++){const tg=dd[dd.length-1];sg=tg.n+1;Oa=tg.t+tg.d;Od=tg.d;dd.push({n:sg,d:Od,t:Oa})}}}v.F()||dd.length===ic||v.g.warn("Number of fragments ("+ic+") differs from number of chunks ("+dd.length+").");var Xa=dd}var Jb={type:xc,Cj:ic,gj:Mh,language:xe,kd:we,name:Nh,maxWidth:qf,maxHeight:rg,tj:Js,tracks:Ca,vg:Xa,
26
+ timescale:Hm}}kb.push(Jb)}var vb=kb}const fc={Kj:e,Mg:f,timescale:g,duration:h,isLive:k,Jj:l,af:m,ff:!1,streams:vb};if(a.j&&a.A)return cS(a,fc),Promise.resolve();a.H.clear();{const kb=fc.timescale,ya=fc.duration,yb=MQ(fc.streams,_.q),xc=MQ(fc.streams,_.t),ic=MQ(fc.streams,_.K),Mh=[];let we=dS(a,ya,kb,yb),xe=dS(a,ya,kb,xc);const Nh=dS(a,ya,kb,ic);we.length||(we=[null]);xe.length||(xe=[null]);for(let qf=0;qf<xe.length;qf++)for(let rg=0;rg<we.length;rg++)Mh.push(eS(a,xe[qf],we[rg]));var gc={id:"ID",
27
+ configurationId:void 0,startTime:0,endTime:ya,variants:Mh,textStreams:Nh,thumbStreams:[]}}{var Kb=fc.streams;let kb=a.a.startTime,ya=a.a.delay;const yb=a.J;let xc=Math.min(a.a.duration||Infinity,yb);const ic=a.F(),Mh=a.a.af,we=a.a.Qd,xe=a.I,Nh=isFinite(a.G)?a.G:0;if(ic)xc=Infinity,kb=Date.now()/1E3-we,a.a.startTime=kb,ya=3*xe;else{const rg=isFinite(yb)?yb:a.a.duration;for(const Js of Kb)for(const Hm of Js.tracks)Hm.segmentIndex.offset(-Nh),_.VB(Hm.segmentIndex,rg)}const qf=a.f.timeline||{};qf.type=
28
+ void 0;a.C=new _.uI(qf,kb,ya,!ic,!0);a.C.f=xc;_.mC(a.C,xe);a.C.A=Mh;ic||a.C.offset(-Nh)}a.D.filterAllPeriods([gc]);a.j={presentationTimeline:a.C,periods:[gc],minBufferTime:0,cues:[]};Promise.resolve();a.L||(a.D.networkingEngine.Sc(a.M),a.L=!0);a.A=fc;return Promise.resolve()},gS=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.dc.bind(a),b))},ZR=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.I(_.D,4,4038,a.o,c);},$R=function(a,
29
+ b){const c=b===bS;a.j&&a.j.presentationTimeline&&_.hC(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.P=b},cS=function(a,b){for(let e=0;e<a.A.streams.length;e++){const f=b.streams[e];for(const g of a.A.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){KQ(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=hS(a,a.A.timescale,f,c);c=g.segmentIndex;FQ(c,d);(d=a.a.af)&&
30
+ GQ(c,(c.a.length?c.a[c.a.length-1].endTime:0)-d).forEach(h=>{h.Da().forEach(k=>{a.H.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},hS=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.vg.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.G=Math.min(a.G,h)):h=f[k-1].endTime;const m=h+l,n=JQ(a.o,c,k,d);a.I=Math.max(a.I,l);f.push(new _.rI(k,h,m,()=>[n],0,null,0,null,!0,g));a.H.set(n,h);e+=l});if(c.type===_.t||c.type===
31
+ _.q)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Qd?a.a.Qd=b.endTime:a.a.Qd=Math.min(a.a.Qd,b.endTime);return f},dS=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=hS(a,c,k,h);const C=new _.vI(l);var m=null;k.type!==_.K&&(m=iS(a,b,c,k,h));h.segmentIndex=C;l=_.pI++;var n=Promise.resolve.bind(Promise),p=C.f.bind(C),u=C.get.bind(C),v=C.h.bind(C),y=C.getDuration.bind(C),A=jS[k.type];var E="";switch(k.type){case _.t:E=h.pe;var F=/00000001[0-9]7/.exec(E);
32
+ E="avc1."+(F&&F[0]?E.substr(E.indexOf(F[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.q:E=h.pe,F=2,"AACH"===h.Zh?F=5:E&&(F=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+F,a.g.debug("AUDIO CODECS: ",E)}F=k.type===_.K?kS[k.gj]:void 0;h={id:l,originalId:null,Oj:null,createSegmentIndex:n,findSegmentPosition:p,getSegmentReference:u,adjustSegmentDurations:v,getDuration:y,segmentIndex:C,segmentLookupStrategy:_.LA,initSegmentReference:m,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,
33
+ width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:F,encrypted:a.K(),keyId:null,language:k.language,originalLanguage:k.kd,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.lg||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},eS=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.lg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,
34
+ allowedByKeySystem:!0}:null},iS=function(a,b,c,d,e){b=LQ(b,d.timescale||c,e);c={isLive:a.F.bind(a),ye:a.K.bind(a),gi:()=>1,xe:a.R.bind(a)};d=new Uint8Array(0);try{d=ER(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.I(_.D,3,4035,g);}const f="data:text/plain;base64,"+_.dm(d);return new _.qI(()=>[f],0,null,null,!0)},WQ=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]}append(a=[]){for(let b=0;b<a.length;b++)this.children.push(a[b]),
35
35
  a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.children.length;b++){if(this.children[b].type===a)return this.children[b];{const c=this.children[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.children.length)for(let c=0;c<this.children.length;c++)b+=this.children[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>
36
- b?_.M(a,1):_.M(a,this.size);_.Ro(a,wQ(this.type));this.size>b&&oQ(a,this.size);"uuid"===this.type&&_.Ro(a,null);if(0<this.children.length&&!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()}},aS=class extends LQ{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);pQ(a,this.version);qQ(a,this.flags)}},rR=class extends LQ{constructor(a,b,c){super(a);this.f=b;this.offset=c}a(){return this.f.byteLength+
37
- super.a()-this.offset}write(a){super.write(a);_.Ro(a,this.f,this.offset);a.getPosition()}},xR=class extends aS{constructor(a,b,c,d,e){super(a,b,c);this.f=d;this.offset=e}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.Ro(a,this.f,this.offset);a.getPosition()}},qR=class extends LQ{constructor(a,b,c){super("ftyp");this.h=a;this.Bg=b;this.f=c}a(){let a=this.h.length;a=a+4+this.f.join("").length;return a+super.a()}write(a){super.write(a);_.Ro(a,wQ(this.h));_.M(a,this.Bg);
38
- _.Ro(a,wQ(this.f.join("")));a.getPosition()}},pR=class extends LQ{constructor(){super(_.De)}},oR=class extends LQ{constructor(){super(_.hg)}},SQ=class extends aS{constructor(a,b,c){super("mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=super.a()}write(a){super.write(a);1===this.version?(oQ(a,0),oQ(a,0),_.M(a,this.timescale),
39
- oQ(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));_.M(a,65536);rQ(a,this.volume);rQ(a,0);_.M(a,0);_.M(a,0);for(let b=0;b<this.f.length;b++)pQ(a,this.f[b]);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,this.h);a.getPosition()}},TQ=class extends LQ{constructor(){super("mvex")}},UQ=class extends aS{constructor(a){super("trex",0,0);this.f=a}a(){return 20+super.a()}write(a){super.write(a);_.M(a,this.f);_.M(a,1);_.M(a,0);_.M(a,
40
- 0);_.M(a,0);a.getPosition()}},VQ=class extends aS{constructor(a,b,c,d,e){super("tkhd",1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+super.a()}write(a){super.write(a);1===this.version?(oQ(a,0),oQ(a,0),_.M(a,this.h),_.M(a,0),oQ(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.h),_.M(a,0),_.M(a,
41
- this.duration*this.timescale));_.M(a,0);_.M(a,0);rQ(a,0);rQ(a,0);rQ(a,this.volume);rQ(a,0);for(let b=0;b<this.f.length;b++)pQ(a,this.f[b]);rQ(a,this.width);rQ(a,0);rQ(a,this.height);rQ(a,0);a.getPosition()}},WQ=class extends aS{constructor(a,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?(oQ(a,0),oQ(a,0),_.M(a,this.timescale),oQ(a,this.duration*this.timescale)):(_.M(a,
42
- 0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));rQ(a,this.language);rQ(a,0);a.getPosition()}},XQ=class extends aS{constructor(a){super("hdlr",0,0);this.f=a}a(){return 33+super.a()}write(a){super.write(a);_.M(a,0);this.f===_.t?_.Ro(a,wQ("vide")):_.Ro(a,wQ("soun"));_.M(a,0);_.M(a,0);_.M(a,0);this.f===_.t?_.Ro(a,wQ("VideoHandler\x00")):_.Ro(a,wQ("SoundHandler\x00"));a.getPosition()}},cR=class extends aS{constructor(){super("vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])}a(){return 2+
43
- this.f.byteLength+super.a()}write(a){super.write(a);rQ(a,0);_.Ro(a,this.f);a.getPosition()}},bS=class extends LQ{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);rQ(a,0);rQ(a,1)}},cS=class extends bS{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);rQ(a,0);rQ(a,0);_.M(a,0);_.M(a,0);_.M(a,0);rQ(a,this.width);rQ(a,this.height);_.M(a,4718592);_.M(a,4718592);_.M(a,0);rQ(a,1);pQ(a,10);_.Ro(a,wQ("AVC Coding",
44
- 31));rQ(a,this.depth);tQ(a,-1)}},dS=class extends bS{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);_.M(a,0);_.M(a,0);rQ(a,this.channelCount);rQ(a,this.sampleSize);tQ(a,0);rQ(a,0);rQ(a,this.sampleRate);rQ(a,0)}},bR=class extends cS{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()}},MQ=class extends bR{constructor(a,
45
- b){super(a,b);this.type="encv"}},eR=class extends dS{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()}},NQ=class extends eR{constructor(a,b,c){super(a,b,c);this.type="enca"}},aR=class extends LQ{constructor(a,b){super("avcC");this.jb=a;this.jc=b;this.version=1;this.f=this.jb[0][1];this.h=this.jb[0][2];this.level=this.jb[0][3]}a(){let a=7;for(var b=0;b<this.jb.length;b++)a+=2,a+=this.jb[b].byteLength;for(b=
46
- 0;b<this.jb.length;b++)a+=2,a+=this.jc[b].byteLength;return a+super.a()}write(a){super.write(a);pQ(a,this.version);pQ(a,this.f);pQ(a,this.h);pQ(a,this.level);pQ(a,255);pQ(a,224|this.jb.length);for(var b=0;b<this.jb.length;b++)rQ(a,this.jb[b].length),_.Ro(a,this.jb[b]);pQ(a,this.jc.length);for(b=0;b<this.jc.length;b++)rQ(a,this.jc[b].length),_.Ro(a,this.jc[b]);a.getPosition()}},dR=class extends aS{constructor(a){super("esds",0,0);this.fc=a}a(){return 22+(this.fc.byteLength+3)+super.a()}write(a){super.write(a);
47
- pQ(a,3);pQ(a,23+this.fc.byteLength);rQ(a,1);pQ(a,0);pQ(a,4);pQ(a,15+this.fc.byteLength);pQ(a,64);pQ(a,21);qQ(a,0);_.M(a,0);_.M(a,0);pQ(a,5);pQ(a,this.fc.byteLength);_.Ro(a,this.fc);_.Ro(a,new Uint8Array([6,1,2]));a.getPosition()}},ZQ=class extends aS{constructor(a=""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.Ro(a,wQ(this.location));a.getPosition()}},YQ=class extends aS{constructor(){super("dref",0,0)}a(){let a=4;
48
- for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},gR=class extends LQ{constructor(){super(_.Sf)}},$Q=class extends aS{constructor(){super(_.Uf,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);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
49
- a.getPosition()}},hR=class extends aS{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);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},iR=class extends aS{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);_.M(a,this.entries.length);for(let b=0;b<
50
- this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},kR=class extends aS{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);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},jR=class extends aS{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);_.M(a,0);a.getPosition()}},fR=class extends aS{constructor(){super("smhd",
51
- 0,0)}a(){return 4+super.a()}write(a){super.write(a);tQ(a,0);rQ(a,0);a.getPosition()}},lR=class extends LQ{constructor(){super("dinf")}},mR=class extends LQ{constructor(){super(_.Ce)}},nR=class extends LQ{constructor(){super(_.ye)}},FR=class extends aS{constructor(a,b){super("tfdt",a,0);this.baseMediaDecodeTime=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?oQ(a,this.baseMediaDecodeTime):_.M(a,this.baseMediaDecodeTime);a.getPosition()}},uR=class extends aS{constructor(){super("mfhd",
52
- 0,0);this.f=0}a(){return 4+super.a()}write(a){super.write(a);_.M(a,this.f);a.getPosition()}},wR=class extends aS{constructor(a,b){super("trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&1&&(a+=4);this.flags&4&&(a+=4);for(let b=0;b<this.f;b++)this.flags&256&&(a+=4),this.flags&512&&(a+=4),this.flags&1024&&(a+=4),this.flags&2048&&(a+=4);return a+super.a()}write(a){super.write(a);_.M(a,this.f);this.flags&1&&(a.getPosition(),sQ(a,this.j));this.flags&
53
- 4&&_.M(a,this.l);for(let b=0;b<this.f;b++)this.flags&256&&_.M(a,this.o[b]),this.flags&512&&_.M(a,this.sampleSize[b]),this.flags&1024&&_.M(a,this.A[b]),this.flags&2048&&(0===this.version?_.M(a,this.h[b]):sQ(a,this.h[b]));a.getPosition()}},vR=class extends aS{constructor(a,b){super("tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0}a(){let a=4;this.flags&1&&(a+=8);this.flags&2&&(a+=4);this.flags&8&&(a+=4);this.flags&16&&(a+=4);this.flags&32&&(a+=4);return a+super.a()}write(a){super.write(a);
54
- _.M(a,this.f);this.flags&1&&oQ(a,this.h);this.flags&2&&_.M(a,this.A);this.flags&8&&_.M(a,this.j);this.flags&16&&_.M(a,this.o);this.flags&32&&_.M(a,this.l);a.getPosition()}},BR=class extends LQ{constructor(){super("traf")}},CR=class extends LQ{constructor(){super("moof")}},AR=class extends LQ{constructor(){super(_.xe);this.f=new Uint8Array(0)}a(){return this.f.byteLength+super.a()}write(a){super.write(a);0<this.f.byteLength&&_.Ro(a,this.f)}},OQ=class extends aS{constructor(){super("tenc",0,0);this.f=
55
- 1;this.h=8;this.l="";this.j=[]}a(){let a;a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+super.a()}write(a){super.write(a);pQ(a,0);0===this.version?pQ(a,0):pQ(a,0);pQ(a,this.f);pQ(a,this.h);_.Ro(a,_.bm(this.l));if(1===this.f&&0===this.h){pQ(a,0);for(let b=0;b<this.j.length;b++)pQ(a,this.j[b])}a.getPosition()}},QQ=class extends aS{constructor(a,b){super("schm",0,0);this.f=a;this.h=b;this.$b=""}a(){let a=8;this.flags&1&&(a+=wQ(this.$b).byteLength);return a+super.a()}write(a){super.write(a);
56
- _.Ro(a,wQ(this.f));_.M(a,this.h);this.flags&1&&_.Ro(a,wQ(this.$b));a.getPosition()}},PQ=class extends LQ{constructor(a){super("frma");this.f=a}a(){return wQ(this.f).byteLength+super.a()}write(a){super.write(a);_.Ro(a,wQ(this.f));a.getPosition()}},GR=class extends aS{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&&(_.M(a,0),_.M(a,0));_.M(a,1);for(let b=0;1>b;b++)0===
57
- this.version?_.M(a,this.offset[b]):oQ(a,this.offset[b]);a.getPosition()}},HR=class extends aS{constructor(a,b,c){super("saiz",0,0);this.f=a;this.j=b;this.h=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));pQ(a,this.f);_.M(a,this.h);if(0===this.f)for(let b=0;b<this.h;b++)pQ(a,this.j[b]);a.getPosition()}},zR=class extends aS{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.f=[]}a(){let a=4;this.flags&
58
- 1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.f[b].vg.byteLength,this.flags&2){a+=2;for(let c=0;c<this.f[b].ld;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.M(a,this.h);this.flags&1&&pQ(a,this.j);for(let b=0;b<this.h;b++)if(_.Ro(a,this.f[b].vg),this.flags&2){rQ(a,this.f[b].ld);for(let c=0;c<this.f[b].ld;c++)rQ(a,this.f[b].yf[c].Wf),_.M(a,this.f[b].yf[c].Xf)}a.getPosition()}};var ER=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))}},DQ=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,EQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,FQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,GQ=/^(\d*\.?\d*)f$/,HQ=/^(\d*\.?\d*)t$/,IQ=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var sR=class{constructor(a){this.a=a;this.f=KQ(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=KQ(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var yR=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var eS=class{constructor(){this.A=this.j=this.f=this.D=null;this.h=1;this.U=0;this.o="";this.C=this.a=null;this.g=new _.T("clpp.smooth.SmoothParser");this.L=!1;this.l=this.B=null;this.N=QR;this.I=0;this.G=this.J=Infinity;this.w=[];this.M=this.S.bind(this);this.H=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,xQ(a)])];return MR(this,a).then(c=>UR(this,c.data).then(()=>{VR(this,this.B);return this.j}))}requestStop(){}stop(){this.D&&this.D.networkingEngine.ze(this.M);this.B=this.A=
59
- this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.L=!1;this.J=this.G=Infinity;return Promise.resolve()}update(){if(this.F())return MR(this,[this.o]).then(a=>UR(this,a.data).then(()=>this.j)).catch(a=>{if(this.D)this.D.onError(a)})}setCurrentVariant(){}Yb(){this.g.debug(_.zA);this.D&&(this.l=null,this.update().then(()=>{VR(this,this.B)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&VR(this,100))}))}F(){return this.N===PR}K(){return 0<this.w.length}R(a){let b=null;if(this.w.length)for(let c=
60
- 0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b}S(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.A.timescale,c={isLive:this.F.bind(this),le:this.K.bind(this),Wh:()=>1,ke:this.R.bind(this)};let d=!1;const e=new _.I(_.D,3,4035,null);let f=null;try{const g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug(`Using base media decode time ${g} instead of `+
61
- `segment reference time ${a.request.startTime}`);f=IR(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)}loadVariant(a){return _.w(function*(){return a})}loadTextStream(a,b){const c=this;return _.w(function*(){let d;const e=c.j.periods.find(f=>f.id===b);e&&(d=e.textStreams.find(f=>f.id===a)||null);if(!d)throw new _.pl(`Could not load text stream with id: ${a}`);return d})}},ZR={video:_.zg,audio:_.Hc,text:_.Bc},QR=_.Eb,PR=
62
- "LIVE",$R={kj:_.EA,lj:_.TA};_.x("clpp.smooth.SmoothComponent",class extends _.zv{install(){_.Ft.ism=eS;_.Et[_.Cc]=eS}uninstall(){_.OC("ism");_.PC(_.Cc)}id(){return _.Nf}});};f.call(g, window);
36
+ b?_.M(a,1):_.M(a,this.size);_.Wo(a,HQ(this.type));this.size>b&&zQ(a,this.size);"uuid"===this.type&&_.Wo(a,null);if(0<this.children.length&&!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()}},lS=class extends WQ{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);AQ(a,this.version);BQ(a,this.flags)}},CR=class extends WQ{constructor(a,b,c){super(a);this.f=b;this.offset=c}a(){return this.f.byteLength+
37
+ super.a()-this.offset}write(a){super.write(a);_.Wo(a,this.f,this.offset);a.getPosition()}},IR=class extends lS{constructor(a,b,c,d,e){super(a,b,c);this.f=d;this.offset=e}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.Wo(a,this.f,this.offset);a.getPosition()}},BR=class extends WQ{constructor(a,b,c){super("ftyp");this.h=a;this.Mg=b;this.f=c}a(){let a=this.h.length;a=a+4+this.f.join("").length;return a+super.a()}write(a){super.write(a);_.Wo(a,HQ(this.h));_.M(a,this.Mg);
38
+ _.Wo(a,HQ(this.f.join("")));a.getPosition()}},AR=class extends WQ{constructor(){super(_.Ee)}},zR=class extends WQ{constructor(){super(_.ig)}},cR=class extends lS{constructor(a,b,c){super("mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=super.a()}write(a){super.write(a);1===this.version?(zQ(a,0),zQ(a,0),_.M(a,this.timescale),
39
+ zQ(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));_.M(a,65536);CQ(a,this.volume);CQ(a,0);_.M(a,0);_.M(a,0);for(let b=0;b<this.f.length;b++)AQ(a,this.f[b]);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,this.h);a.getPosition()}},dR=class extends WQ{constructor(){super("mvex")}},eR=class extends lS{constructor(a){super("trex",0,0);this.f=a}a(){return 20+super.a()}write(a){super.write(a);_.M(a,this.f);_.M(a,1);_.M(a,0);_.M(a,
40
+ 0);_.M(a,0);a.getPosition()}},fR=class extends lS{constructor(a,b,c,d,e){super("tkhd",1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+super.a()}write(a){super.write(a);1===this.version?(zQ(a,0),zQ(a,0),_.M(a,this.h),_.M(a,0),zQ(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.h),_.M(a,0),_.M(a,
41
+ this.duration*this.timescale));_.M(a,0);_.M(a,0);CQ(a,0);CQ(a,0);CQ(a,this.volume);CQ(a,0);for(let b=0;b<this.f.length;b++)AQ(a,this.f[b]);CQ(a,this.width);CQ(a,0);CQ(a,this.height);CQ(a,0);a.getPosition()}},gR=class extends lS{constructor(a,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?(zQ(a,0),zQ(a,0),_.M(a,this.timescale),zQ(a,this.duration*this.timescale)):(_.M(a,
42
+ 0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));CQ(a,this.language);CQ(a,0);a.getPosition()}},hR=class extends lS{constructor(a){super("hdlr",0,0);this.f=a}a(){return 33+super.a()}write(a){super.write(a);_.M(a,0);this.f===_.t?_.Wo(a,HQ("vide")):_.Wo(a,HQ("soun"));_.M(a,0);_.M(a,0);_.M(a,0);this.f===_.t?_.Wo(a,HQ("VideoHandler\x00")):_.Wo(a,HQ("SoundHandler\x00"));a.getPosition()}},nR=class extends lS{constructor(){super("vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])}a(){return 2+
43
+ this.f.byteLength+super.a()}write(a){super.write(a);CQ(a,0);_.Wo(a,this.f);a.getPosition()}},mS=class extends WQ{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);CQ(a,0);CQ(a,1)}},nS=class extends mS{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);CQ(a,0);CQ(a,0);_.M(a,0);_.M(a,0);_.M(a,0);CQ(a,this.width);CQ(a,this.height);_.M(a,4718592);_.M(a,4718592);_.M(a,0);CQ(a,1);AQ(a,10);_.Wo(a,HQ("AVC Coding",
44
+ 31));CQ(a,this.depth);EQ(a,-1)}},oS=class extends mS{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);_.M(a,0);_.M(a,0);CQ(a,this.channelCount);CQ(a,this.sampleSize);EQ(a,0);CQ(a,0);CQ(a,this.sampleRate);CQ(a,0)}},mR=class extends nS{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()}},XQ=class extends mR{constructor(a,
45
+ b){super(a,b);this.type="encv"}},pR=class extends oS{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()}},YQ=class extends pR{constructor(a,b,c){super(a,b,c);this.type="enca"}},lR=class extends WQ{constructor(a,b){super("avcC");this.kb=a;this.rc=b;this.version=1;this.f=this.kb[0][1];this.h=this.kb[0][2];this.level=this.kb[0][3]}a(){let a=7;for(var b=0;b<this.kb.length;b++)a+=2,a+=this.kb[b].byteLength;for(b=
46
+ 0;b<this.kb.length;b++)a+=2,a+=this.rc[b].byteLength;return a+super.a()}write(a){super.write(a);AQ(a,this.version);AQ(a,this.f);AQ(a,this.h);AQ(a,this.level);AQ(a,255);AQ(a,224|this.kb.length);for(var b=0;b<this.kb.length;b++)CQ(a,this.kb[b].length),_.Wo(a,this.kb[b]);AQ(a,this.rc.length);for(b=0;b<this.rc.length;b++)CQ(a,this.rc[b].length),_.Wo(a,this.rc[b]);a.getPosition()}},oR=class extends lS{constructor(a){super("esds",0,0);this.lc=a}a(){return 22+(this.lc.byteLength+3)+super.a()}write(a){super.write(a);
47
+ AQ(a,3);AQ(a,23+this.lc.byteLength);CQ(a,1);AQ(a,0);AQ(a,4);AQ(a,15+this.lc.byteLength);AQ(a,64);AQ(a,21);BQ(a,0);_.M(a,0);_.M(a,0);AQ(a,5);AQ(a,this.lc.byteLength);_.Wo(a,this.lc);_.Wo(a,new Uint8Array([6,1,2]));a.getPosition()}},jR=class extends lS{constructor(a=""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.Wo(a,HQ(this.location));a.getPosition()}},iR=class extends lS{constructor(){super("dref",0,0)}a(){let a=4;
48
+ for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},rR=class extends WQ{constructor(){super(_.Tf)}},kR=class extends lS{constructor(){super(_.Vf,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);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
49
+ a.getPosition()}},sR=class extends lS{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);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},tR=class extends lS{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);_.M(a,this.entries.length);for(let b=0;b<
50
+ this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},vR=class extends lS{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);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},uR=class extends lS{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);_.M(a,0);a.getPosition()}},qR=class extends lS{constructor(){super("smhd",
51
+ 0,0)}a(){return 4+super.a()}write(a){super.write(a);EQ(a,0);CQ(a,0);a.getPosition()}},wR=class extends WQ{constructor(){super("dinf")}},xR=class extends WQ{constructor(){super(_.De)}},yR=class extends WQ{constructor(){super(_.ze)}},QR=class extends lS{constructor(a,b){super("tfdt",a,0);this.baseMediaDecodeTime=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?zQ(a,this.baseMediaDecodeTime):_.M(a,this.baseMediaDecodeTime);a.getPosition()}},FR=class extends lS{constructor(){super("mfhd",
52
+ 0,0);this.f=0}a(){return 4+super.a()}write(a){super.write(a);_.M(a,this.f);a.getPosition()}},HR=class extends lS{constructor(a,b){super("trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&1&&(a+=4);this.flags&4&&(a+=4);for(let b=0;b<this.f;b++)this.flags&256&&(a+=4),this.flags&512&&(a+=4),this.flags&1024&&(a+=4),this.flags&2048&&(a+=4);return a+super.a()}write(a){super.write(a);_.M(a,this.f);this.flags&1&&(a.getPosition(),DQ(a,this.j));this.flags&
53
+ 4&&_.M(a,this.l);for(let b=0;b<this.f;b++)this.flags&256&&_.M(a,this.o[b]),this.flags&512&&_.M(a,this.sampleSize[b]),this.flags&1024&&_.M(a,this.A[b]),this.flags&2048&&(0===this.version?_.M(a,this.h[b]):DQ(a,this.h[b]));a.getPosition()}},GR=class extends lS{constructor(a,b){super("tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0}a(){let a=4;this.flags&1&&(a+=8);this.flags&2&&(a+=4);this.flags&8&&(a+=4);this.flags&16&&(a+=4);this.flags&32&&(a+=4);return a+super.a()}write(a){super.write(a);
54
+ _.M(a,this.f);this.flags&1&&zQ(a,this.h);this.flags&2&&_.M(a,this.A);this.flags&8&&_.M(a,this.j);this.flags&16&&_.M(a,this.o);this.flags&32&&_.M(a,this.l);a.getPosition()}},MR=class extends WQ{constructor(){super("traf")}},NR=class extends WQ{constructor(){super("moof")}},LR=class extends WQ{constructor(){super(_.ve);this.f=new Uint8Array(0)}a(){return this.f.byteLength+super.a()}write(a){super.write(a);0<this.f.byteLength&&_.Wo(a,this.f)}},ZQ=class extends lS{constructor(){super("tenc",0,0);this.f=
55
+ 1;this.h=8;this.l="";this.j=[]}a(){let a;a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+super.a()}write(a){super.write(a);AQ(a,0);0===this.version?AQ(a,0):AQ(a,0);AQ(a,this.f);AQ(a,this.h);_.Wo(a,_.fm(this.l));if(1===this.f&&0===this.h){AQ(a,0);for(let b=0;b<this.j.length;b++)AQ(a,this.j[b])}a.getPosition()}},aR=class extends lS{constructor(a,b){super("schm",0,0);this.f=a;this.h=b;this.fc=""}a(){let a=8;this.flags&1&&(a+=HQ(this.fc).byteLength);return a+super.a()}write(a){super.write(a);
56
+ _.Wo(a,HQ(this.f));_.M(a,this.h);this.flags&1&&_.Wo(a,HQ(this.fc));a.getPosition()}},$Q=class extends WQ{constructor(a){super("frma");this.f=a}a(){return HQ(this.f).byteLength+super.a()}write(a){super.write(a);_.Wo(a,HQ(this.f));a.getPosition()}},RR=class extends lS{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&&(_.M(a,0),_.M(a,0));_.M(a,1);for(let b=0;1>b;b++)0===
57
+ this.version?_.M(a,this.offset[b]):zQ(a,this.offset[b]);a.getPosition()}},SR=class extends lS{constructor(a,b,c){super("saiz",0,0);this.f=a;this.j=b;this.h=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));AQ(a,this.f);_.M(a,this.h);if(0===this.f)for(let b=0;b<this.h;b++)AQ(a,this.j[b]);a.getPosition()}},KR=class extends lS{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.f=[]}a(){let a=4;this.flags&
58
+ 1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.f[b].Gg.byteLength,this.flags&2){a+=2;for(let c=0;c<this.f[b].vd;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.M(a,this.h);this.flags&1&&AQ(a,this.j);for(let b=0;b<this.h;b++)if(_.Wo(a,this.f[b].Gg),this.flags&2){CQ(a,this.f[b].vd);for(let c=0;c<this.f[b].vd;c++)CQ(a,this.f[b].Lf[c].hg),_.M(a,this.f[b].Lf[c].ig)}a.getPosition()}};var PR=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))}},OQ=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,PQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,QQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,RQ=/^(\d*\.?\d*)f$/,SQ=/^(\d*\.?\d*)t$/,TQ=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var DR=class{constructor(a){this.a=a;this.f=VQ(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=VQ(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var JR=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var pS=class{constructor(){this.A=this.j=this.f=this.D=null;this.h=1;this.U=0;this.o="";this.C=this.a=null;this.g=new _.T("clpp.smooth.SmoothParser");this.L=!1;this.l=this.B=null;this.P=bS;this.I=0;this.G=this.J=Infinity;this.w=[];this.M=this.S.bind(this);this.H=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,IQ(a)])];return YR(this,a).then(c=>fS(this,c.data).then(()=>{gS(this,this.B);return this.j}))}requestStop(){}stop(){this.D&&this.D.networkingEngine.Xd(this.M);this.B=this.A=
59
+ this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.L=!1;this.J=this.G=Infinity;return Promise.resolve()}update(){if(this.F())return YR(this,[this.o]).then(a=>fS(this,a.data).then(()=>this.j)).catch(a=>{if(this.D)this.D.onError(a)})}setCurrentVariant(){}dc(){this.g.debug(_.BA);this.D&&(this.l=null,this.update().then(()=>{gS(this,this.B)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&gS(this,100))}))}F(){return this.P===aS}K(){return 0<this.w.length}R(a){let b=null;if(this.w.length)for(let c=
60
+ 0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b}S(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.A.timescale,c={isLive:this.F.bind(this),ye:this.K.bind(this),gi:()=>1,xe:this.R.bind(this)};let d=!1;const e=new _.I(_.D,3,4035,null);let f=null;try{const g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug(`Using base media decode time ${g} instead of `+
61
+ `segment reference time ${a.request.startTime}`);f=TR(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)}loadVariant(a){return _.w(function*(){return a})}loadTextStream(a,b){const c=this;return _.w(function*(){let d;const e=c.j.periods.find(f=>f.id===b);e&&(d=e.textStreams.find(f=>f.id===a)||null);if(!d)throw new _.tl(`Could not load text stream with id: ${a}`);return d})}},jS={video:_.Ag,audio:_.Hc,text:_.Bc},bS=_.Fb,aS=
62
+ "LIVE",kS={vj:_.GA,wj:_.VA};_.x("clpp.smooth.SmoothComponent",class extends _.Ev{install(){_.Pt.ism=pS;_.Ot[_.Cc]=pS}uninstall(){_.QC("ism");_.RC(_.Cc)}id(){return _.Of}});};f.call(g, window);