@castlabs/prestoplay 6.14.1 → 6.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +114 -112
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +553 -538
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +74 -73
  10. package/cjs/cl.externs.js +193 -58
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +368 -264
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +72 -71
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +71 -71
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +20 -20
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +89 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +455 -443
  37. package/cl.crypto.js +9 -9
  38. package/cl.dash.js +70 -68
  39. package/cl.externs.js +189 -58
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -71
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +26 -26
  44. package/cl.ima.js +17 -17
  45. package/cl.mse.js +318 -236
  46. package/cl.muxdata.js +13 -13
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +11 -11
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +15 -15
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/package.json +1 -1
  61. package/typings.d.ts +393 -57
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 wx=function(a){switch(a.type){case 1:return tx;case 2:return ux;case 3:return vx}},yx=function(a){const b=Object.keys(a).find(c=>xx.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},Ax=function(a){let b={debug:!0,data:zx(a)};a.f&&a.f.muxOptionsOverride&&_.Bg(a.f.muxOptionsOverride)&&(b=_.xg(b,a.f.muxOptionsOverride));b=_.xg(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.h.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager();const f=
2
- a.m.getSurface();var e={player_is_paused:a.m.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){const k=new _.ql(c.url);e.video_source_url=_.Ri(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().ka(),
3
- c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.h.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.ja())&&d.language&&(e.player_language_code=d.language)}return e}});a.h.debug("Mux SDK options",b);return b},Bx=function(a){_.Xg(a.a);a.j.yd(a.F);a.j.tf(a.C)},zx=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.pa,player_software_name:_.pa,player_software_version:_.da,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
- player_mux_plugin_version:_.da};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},Cx=function(a){a.a.on(a.m,_.Ff,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.Ff,b)});a.a.on(a.m,_.Me,()=>a.emit(_.Me));a.a.on(a.m,_.Lc,a.G.bind(a));a.a.on(a.m,_.vf,a.I.bind(a));a.a.on(a.m,_.Pf,()=>a.emit(_.of));a.a.on(a.m,_.Of,()=>a.emit(_.nf));a.a.on(a.m,_.Qd,a.H.bind(a));a.a.on(a.m,_.Xb,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Zb,()=>a.emit("adbreakend"));a.a.on(a.m,_.kc,()=>
5
- {a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.gc,()=>a.emit("adpause"));a.a.on(a.m,_.ic,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.lc,()=>a.emit("adended"));a.a.on(a.m,_.cc,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.fc,()=>a.emit("admidpoint"));a.a.on(a.m,_.mc,()=>a.emit("adthirdquartile"));a.j.Hc(a.F);a.j.Be(a.C);a.a.on(a.m,_.Qd,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 _.ql(b.uris[b.uriIndex]);b={request_start:c,request_type:wx(b),request_hostname:d.a};a.h.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.ql(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:wx(c),request_hostname:f.a,request_error:`${wx(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
- a.h.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},Dx=function(a){return!_.z(a)&&typeof a.init===_.Td&&typeof a.emit===_.Td},tx="manifest",ux="media",vx="encryption",xx=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var Ex=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 _.Er;this.h=b;this.A=this.l=this.g=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.J.bind(this);this.C=this.K.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.g){try{this.g=!0,this.w.init(this.B,Ax(this))}catch(d){throw this.g=!1,Bx(this),new _.H(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=zx(this),this.emit("videochange",
8
- a),this.l=!1);Cx(this)}release(){this.h.debug("release()");this.l?this.h.debug(_.ia):(Bx(this),this.l=!0,this.o=this.f=null)}destroy(){this.h.debug(_.zd);this.A?this.h.debug(_.ha):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.H(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.h.debug(_.ze);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ka())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.h.debug(_.De);
9
- switch(a.detail.currentState){case _.Dn:this.m.getConfiguration().autoplay&&this.emit(_.Me);break;case _.Fn:this.emit(_.Te);break;case _.En:this.emit(_.Ie);break;case _.un:this.emit(_.Pd)}}H(a){this.h.debug(_.Ae);if(this.g&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.F){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(_.Qd,{player_error_code:a.code,player_error_message:b})}}J(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.ql(b.uris[b.uriIndex]);a={request_start:g,request_type:wx(b),request_hostname:d.a,request_id:yx(e),request_bytes_loaded:f,request_response_start:h,
11
- request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Ri(d)};this.h.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var Fx=class extends _.It{constructor(){super();this.f=this.m=null;this.a=!1;this.h=new _.R("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new Ex(a,this.h)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.yg(c.muxdata);try{var d=[];typeof c===_.ye&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.H(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.z(f.muxdata)&&typeof f.muxdata===_.ye){const g=f.muxdata;d=Dx(g.muxLib)?g.muxLib:window.mux;if(!Dx(d)){this.h.warn("Mux SDK is not loaded. Will do nothing.");
12
- this.a=!1;const h=new _.H(1,9,9301);this.T(a,h)}}else this.h.warn("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,this.T(a,f)}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.m=this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}emit(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&this.T(this.m,c),c;}}T(a,b){a.trigger(new _.C(_.Qd,{detail:b}))}};
13
- _.x("clpp.muxdata.MuxDataPlugin",Fx);Fx.prototype.emit=Fx.prototype.emit;Fx.Id="mux";_.Ho(new class{create(){return new Fx}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Xx=function(a){switch(a.type){case 1:return Ux;case 2:return Vx;case 3:return Wx}},Zx=function(a){const b=Object.keys(a).find(c=>Yx.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},ay=function(a){let b={debug:!0,data:$x(a)};a.f&&a.f.muxOptionsOverride&&_.Pg(a.f.muxOptionsOverride)&&(b=_.Lg(b,a.f.muxOptionsOverride));b=_.Lg(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 _.Fl(c.url);e.video_source_url=_.fj(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().oa(),
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.na())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},by=function(a){_.lh(a.a);a.j.Ud(a.F);a.j.Qf(a.D)},$x=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.ra,player_software_name:_.ra,player_software_version:_.fa,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
+ player_mux_plugin_version:_.fa};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},cy=function(a){a.a.on(a.m,_.Tf,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.Tf,b)});a.a.on(a.m,_.Qe,()=>a.emit(_.Qe));a.a.on(a.m,_.Nc,a.G.bind(a));a.a.on(a.m,_.Jf,a.I.bind(a));a.a.on(a.m,_.bg,()=>a.emit(_.Bf));a.a.on(a.m,_.ag,()=>a.emit(_.Af));a.a.on(a.m,_.q,a.H.bind(a));a.a.on(a.m,_.bc,()=>a.emit("adbreakstart"));a.a.on(a.m,_.cc,()=>a.emit("adbreakend"));a.a.on(a.m,_.pc,()=>{a.emit("adplay");
5
+ a.emit("adplaying")});a.a.on(a.m,_.lc,()=>a.emit("adpause"));a.a.on(a.m,_.nc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.qc,()=>a.emit("adended"));a.a.on(a.m,_.gc,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.jc,()=>a.emit("admidpoint"));a.a.on(a.m,_.rc,()=>a.emit("adthirdquartile"));a.j.Sc(a.F);a.j.bf(a.D);a.a.on(a.m,_.q,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 _.Fl(b.uris[b.uriIndex]);b={request_start:c,request_type:Xx(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.Fl(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:Xx(c),request_hostname:f.a,request_error:`${Xx(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
+ a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},dy=function(a){return!_.A(a)&&typeof a.init===_.Xd&&typeof a.emit===_.Xd},Ux="manifest",Vx="media",Wx="encryption",Yx=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var ey=class{constructor(a,b){this.m=a;this.o=this.f=null;this.C=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.$r;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.J.bind(this);this.D=this.K.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.h){try{this.h=!0,this.w.init(this.C,ay(this))}catch(d){throw this.h=!1,by(this),new _.H(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=$x(this),this.emit("videochange",
8
+ a),this.l=!1);cy(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ja):(by(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Dd);this.A?this.g.debug(_.ia):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.H(1,9,9301);this.w.emit(this.C,a,b)}G(a){this.g.debug(_.De);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Xa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.He);
9
+ switch(a.detail.currentState){case _.Sn:this.m.getConfiguration().autoplay&&this.emit(_.Qe);break;case _.Un:this.emit(_.af);break;case _.Tn:this.emit(_.Me);break;case _.Jn:this.emit(_.Ud)}}H(a){this.g.debug(_.Ee);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.E){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;
10
+ this.emit(_.q,{player_error_code:a.code,player_error_message:b})}}J(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.Fl(b.uris[b.uriIndex]);a={request_start:g,request_type:Xx(b),request_hostname:d.a,request_id:Zx(e),request_bytes_loaded:f,request_response_start:h,
11
+ request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.fj(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var fy=class extends _.iu{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.S("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new ey(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.Mg(c.muxdata);try{var d=[];typeof c===_.Ce&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.H(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.A(f.muxdata)&&typeof f.muxdata===_.Ce){const g=f.muxdata;d=dy(g.muxLib)?g.muxLib:window.mux;if(!dy(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
+ this.a=!1;const h=new _.H(1,9,9301);this.W(a,h)}}else this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,this.W(a,f)}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.m=this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}emit(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&this.W(this.m,c),c;}}W(a,b){a.trigger(new _.D(_.q,{detail:b}))}};
13
+ _.z("clpp.muxdata.MuxDataPlugin",fy);fy.prototype.emit=fy.prototype.emit;fy.Id="mux";_.Wo(new class{create(){return new fy}});};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 sx=function(a,b){let c=b.baseUrl;_.di(c,"/")||(c+="/");const d=g=>g&&(_.ci(g,"https://")||_.ci(g,"http://")||_.ci(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.vs(a);a.Ma(_.ud,{licenseUrl:e,videoRobustness:[_.Ab,void 0],audioRobustness:[_.zb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Il,licenseResponse:_.Jl}});a.Ma(_.pd,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.Ll,licenseResponse:_.Ml,extractContentId:_.Nl,certificateRequest:_.Ol}});a.Ma(_.sd,{licenseUrl:f,modifiers:{licenseRequest:_.Il}});_.Uk(a)};
3
- _.x("clpp.onboard.OnboardComponent",class extends _.ht{constructor(){super();this.h=new _.R("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Tk[a];this.j.clear()}g(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.h.info(`Registering the DRMtoday Onboard environment, name='${b}'`),sx(b,a),this.j.add(b))}id(){return"onboard"}});
4
- _.x("clpp.onboard.register",sx);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Tx=function(a,b){let c=b.baseUrl;_.si(c,"/")||(c+="/");const d=g=>g&&(_.ri(g,"https://")||_.ri(g,"http://")||_.ri(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.Ts(a);a.bb(_.yd,{licenseUrl:e,videoRobustness:[_.Eb,void 0],audioRobustness:[_.Db,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Ul,licenseResponse:_.Vl}});a.bb(_.ud,{licenseUrl:b,
2
+ certificateUrl:b,modifiers:{licenseRequest:_.Xl,licenseResponse:_.Yl,extractContentId:_.Zl,certificateRequest:_.$l}});a.bb(_.wd,{licenseUrl:f,modifiers:{licenseRequest:_.Ul}});_.kl(a)};
3
+ _.z("clpp.onboard.OnboardComponent",class extends _.Gt{constructor(){super();this.g=new _.S("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.jl[a];this.j.clear()}h(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),Tx(b,a),this.j.add(b))}id(){return"onboard"}});
4
+ _.z("clpp.onboard.register",Tx);};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 cx="A persistent DRM session already exists for: ",dx="No DRM configuration.",ex="clpp.persistent",fx="clpp.persistent.SimpleSessionStorage",gx=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},ix=function(a,b){a.I=hx;a.J=[];a.C=!0;return _.Hm(a,b)},kx=function(a,b,c,d,e,f){a.I=jx;const g=new Map,h=_.rm(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Fe,persistentState:_.kf,sessionTypes:[_.Ke],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,
2
- distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Gm(a,g)},lx=function(a,b){return _.w(function*(){const c=yield _.Xm(a,b);if(c){var d=[],e=a.f.get(c);e&&a.A&&(e.ob=new _.Km,d.push(e.ob));a.h.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.h.debug("Ignoring attempt to remove missing session",b)})},mx=function(a){a=a.f.keys();a=gx(a,b=>b.sessionId);return Array.from(a)},
3
- nx=function(a,b){const c=_.Wk(a),d=_.Ck({drm:a});d.drm=a;a=new _.On({mb:b,onError:()=>{},ke:()=>{},je:()=>{},onEvent:()=>{},getConfiguration:()=>d,xc:()=>null});a.g=c;return a},qx=function(a,b,c){return _.w(function*(){const d=ox;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)px.debug(cx,e);else{var g=nx(a,c);try{yield ix(g,b);yield _.Vm(g);yield _.Ym(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.uj(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:mx(g),
4
- keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw px.error(`Error while persisting DRM session ${e}`),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else px.debug(dx)})},hx=1,jx=2,rx=class{constructor(){this.h=new _.R(fx)}store(a,b){return _.w(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);
5
- const e=JSON.stringify(b.audioCapabilities),f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){const b=this;return _.w(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),f=JSON.parse(e.sessionIds),
6
- g=e.audioCapabilities||[],h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.h.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return fx}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.Cg(a.store)||c.push("store"),_.Cg(a.get)||c.push("get"),_.Cg(a.delete)||c.push("delete"),_.Cg(a.clear)||c.push("clear"),_.Cg(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw px.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});ox=a});
7
- _.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=ox,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.In(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(dx);var g=b.offlineId;if(typeof g!==_.yf||!g.length)throw e("Missing offline id.");if(yield d.get(g))px.debug(cx,g);else{var h=_.Ck();d=new _.Eo;g=[];for(var k of c){const l=new k;_.Fk(l.id())||(l.f(),_.Hk(l),g.push(l))}k=null;try{k=yield _.Kq(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
- const l=yield k.start(f.url,{networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.H(_.F,4,4014));const m=_.Iq(l.periods);yield qx(b,m,d)}catch(l){if(l instanceof _.H&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.Ek.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
- _.x("clpp.persistent.removeLicense",function(a){return _.w(function*(){var b=ox;if(_.Eg(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Eo,c=nx(e.drmConfig,d),yield kx(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Vm(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield lx(c,f);px.debug("successfully removed session with id",f)}))),yield b.delete(a)):px.debug("No persistent DRM session found")}catch(e){throw px.error("Failed to remove session"),
10
- new _.H(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else px.warn("Invalid offlineId")})});var ox=new rx,px=new _.R(ex);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.ht{constructor(){super();this.h=new _.R(ex)}id(){return _.Je}l(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().drm;if(d){c.h.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield qx(d,b,e),a.trigger(new _.C(_.Id,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.h.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.w(function*(){b.h.debug(`Getting EME session IDs for ${a}`);
11
- const c=ox;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.h.debug(`No offline session found for ${a}`);return[]}catch(d){return b.h.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Dx="A persistent DRM session already exists for: ",Ex="No DRM configuration.",Fx="clpp.persistent",Gx="clpp.persistent.SimpleSessionStorage",Hx=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},Jx=function(a,b){a.I=Ix;a.J=[];a.D=!0;return _.Wm(a,b)},Lx=function(a,b,c,d,e,f){a.I=Kx;const g=new Map,h=_.Gm(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Je,persistentState:_.tf,sessionTypes:[_.Oe],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,
2
+ distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Vm(a,g)},Mx=function(a,b){return _.x(function*(){const c=yield _.mn(a,b);if(c){var d=[],e=a.f.get(c);e&&a.A&&(e.Db=new _.Zm,d.push(e.Db));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)})},Nx=function(a){a=a.f.keys();a=Hx(a,b=>b.sessionId);return Array.from(a)},
3
+ Ox=function(a,b){const c=_.ml(a),d=_.Sk({drm:a});d.drm=a;a=new _.co({Za:b,onError:()=>{},xe:()=>{},ve:()=>{},onEvent:()=>{},getConfiguration:()=>d,Ic:()=>null});a.h=c;return a},Rx=function(a,b,c){return _.x(function*(){const d=Px;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Qx.debug(Dx,e);else{var g=Ox(a,c);try{yield Jx(g,b);yield _.kn(g);yield _.nn(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Jj(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:Nx(g),
4
+ keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Qx.error(`Error while persisting DRM session ${e}`),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Qx.debug(Ex)})},Ix=1,Kx=2,Sx=class{constructor(){this.g=new _.S(Gx)}store(a,b){return _.x(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);
5
+ const e=JSON.stringify(b.audioCapabilities),f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){const b=this;return _.x(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),f=JSON.parse(e.sessionIds),
6
+ g=e.audioCapabilities||[],h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.g.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.x(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.x(function*(){window.localStorage.clear()})}getName(){return Gx}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.A(a)||(_.Qg(a.store)||c.push("store"),_.Qg(a.get)||c.push("get"),_.Qg(a.delete)||c.push("delete"),_.Qg(a.clear)||c.push("clear"),_.Qg(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Qx.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});Px=a});
7
+ _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=Px,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.Xn(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(Ex);var g=b.offlineId;if(typeof g!==_.Mf||!g.length)throw e("Missing offline id.");if(yield d.get(g))Qx.debug(Dx,g);else{var h=_.Sk();d=new _.To;g=[];for(var k of c){const l=new k;_.Vk(l.id())||(l.f(),_.Xk(l),g.push(l))}k=null;try{k=yield _.hr(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
+ const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.H(_.E,4,4014));const m=_.fr(l.periods);yield Rx(b,m,d)}catch(l){if(l instanceof _.H&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.Uk.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
+ _.z("clpp.persistent.removeLicense",function(a){return _.x(function*(){var b=Px;if(_.Sg(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.To,c=Ox(e.drmConfig,d),yield Lx(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.kn(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield Mx(c,f);Qx.debug("successfully removed session with id",f)}))),yield b.delete(a)):Qx.debug("No persistent DRM session found")}catch(e){throw Qx.error("Failed to remove session"),
10
+ new _.H(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else Qx.warn("Invalid offlineId")})});var Px=new Sx,Qx=new _.S(Fx);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Gt{constructor(){super();this.g=new _.S(Fx)}id(){return _.Ne}l(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield Rx(d,b,e),a.trigger(new _.D(_.Nd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.x(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
+ const c=Px;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 $w=function(a,b){return 0<=b&&b<a.a.length},ax=function(a){a.trigger(new _.C(_.Ve))},bx=class extends _.qs{on(a,b,c){return super.on(a,b,c)}one(a,b,c){return super.one(a,b,c)}off(a,b){return super.off(a,b)}constructor(a,b){b=void 0===b?()=>Promise.resolve():b;super();this.m=a;this.l=b;this.f=0;this.a=[];this.g=!1;this.j=this.fc.bind(this)}getPosition(){return this.f}ng(){return this.a}Pc(){return 0<this.a.length&&$w(this,this.f)?this.a[this.f]:null}og(){const a=this.f+1;return 0<
2
- this.a.length&&$w(this,a)?this.a[a]:null}ug(){return this.g}start(){this.g||(this.g=!0,this.m.on(_.Pd,this.j),this.rd(this.f,!0))}stop(){this.g=!1;this.m.off(_.Pd,this.j)}fc(){this.next()}next(){const a=this;return _.w(function*(){yield a.rd(Math.min(a.a.length-1,a.f+1))})}Lg(){const a=this;return _.w(function*(){yield a.rd(Math.max(0,a.f-1))})}rd(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&$w(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Pc();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
- c.trigger(new _.C(_.Ue,{item:d})))}})}append(a){this.a.push(a);ax(this)}tg(a,b){if(0<=b&&b<=this.a.length){const c=this.Pc();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));ax(this)}}remove(a){if(0<this.a.length&&$w(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);ax(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;ax(this)}};_.x("clpp.Playlist",bx);bx.prototype.clear=bx.prototype.clear;bx.prototype.remove=bx.prototype.remove;bx.prototype.insert=bx.prototype.tg;
4
- bx.prototype.append=bx.prototype.append;bx.prototype.goTo=bx.prototype.rd;bx.prototype.previous=bx.prototype.Lg;bx.prototype.next=bx.prototype.next;bx.prototype.onEnded=bx.prototype.fc;bx.prototype.stop=bx.prototype.stop;bx.prototype.start=bx.prototype.start;bx.prototype.isStarted=bx.prototype.ug;bx.prototype.getUpcoming=bx.prototype.og;bx.prototype.getCurrent=bx.prototype.Pc;bx.prototype.getQueue=bx.prototype.ng;bx.prototype.getPosition=bx.prototype.getPosition;bx.prototype.off=bx.prototype.off;
5
- bx.prototype.one=bx.prototype.one;bx.prototype.on=bx.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Ax=function(a,b){return 0<=b&&b<a.a.length},Bx=function(a){a.trigger(new _.D(_.cf))},Cx=class extends _.Os{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.rc.bind(this)}getPosition(){return this.f}Fg(){return this.a}$c(){return 0<this.a.length&&Ax(this,this.f)?this.a[this.f]:null}Gg(){const a=this.f+1;return 0<
2
+ this.a.length&&Ax(this,a)?this.a[a]:null}Pg(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Ud,this.j),this.Gd(this.f,!0))}stop(){this.h=!1;this.m.off(_.Ud,this.j)}rc(){this.next()}next(){const a=this;return _.x(function*(){yield a.Gd(Math.min(a.a.length-1,a.f+1))})}dh(){const a=this;return _.x(function*(){yield a.Gd(Math.max(0,a.f-1))})}Gd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&Ax(c,a)&&(b||c.f!==a)){c.f=a;var d=c.$c();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
+ c.trigger(new _.D(_.bf,{item:d})))}})}append(a){this.a.push(a);Bx(this)}Og(a,b){if(0<=b&&b<=this.a.length){const c=this.$c();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Bx(this)}}remove(a){if(0<this.a.length&&Ax(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Bx(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;Bx(this)}};_.z("clpp.Playlist",Cx);Cx.prototype.clear=Cx.prototype.clear;Cx.prototype.remove=Cx.prototype.remove;Cx.prototype.insert=Cx.prototype.Og;
4
+ Cx.prototype.append=Cx.prototype.append;Cx.prototype.goTo=Cx.prototype.Gd;Cx.prototype.previous=Cx.prototype.dh;Cx.prototype.next=Cx.prototype.next;Cx.prototype.onEnded=Cx.prototype.rc;Cx.prototype.stop=Cx.prototype.stop;Cx.prototype.start=Cx.prototype.start;Cx.prototype.isStarted=Cx.prototype.Pg;Cx.prototype.getUpcoming=Cx.prototype.Gg;Cx.prototype.getCurrent=Cx.prototype.$c;Cx.prototype.getQueue=Cx.prototype.Fg;Cx.prototype.getPosition=Cx.prototype.getPosition;Cx.prototype.off=Cx.prototype.off;
5
+ Cx.prototype.one=Cx.prototype.one;Cx.prototype.on=Cx.prototype.on;};f.call(g, window);
package/cl.simid.js CHANGED
@@ -1,13 +1,13 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Jw="No surface found. Can not attach frame!",Kw="SIMID:Media:timeupdate",Lw="Starting creative",Mw=function(a,b,c){return{type:b,sessionId:a.g,messageId:a.l++,timestamp:Date.now(),args:c}},Pw=function(a,b){return new Promise((c,d)=>{new Nw(a.j,c,d,b);Ow(a,b)})},Qw=function(a){const b=Mw(a,"SIMID:Player:startCreative",void 0);Pw(a,b).then(()=>{var c=a.f;c.h.info(Lw);c.m.trigger(new _.C(_.qf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.h.error("Error while starting creative",
2
- c)})},Sw=function(a,b){_.w(function*(){a.g=b.sessionId;Rw(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=Mw(a,"SIMID:Player:init",d);var e=Pw(a,f)}yield e;a.h.info("Player Init acknowledged");a.f.h.info("SIMID Player initialized")}catch(f){a.h.error("Error while initializing",f),a.f.h.error("Error while initializing SIMID player: ",f),a.unload()}})},Rw=function(a,b){Ow(a,Mw(a,"resolve",{messageId:b.messageId,
4
- value:void 0}))},Ow=function(a,b){a.g?(b.type!==Kw&&a.h.info(`Posting message [${b.messageId}] '${b.type}':`,b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.h.warn(`WARNING: no session available to send message '${b.type}'`)},Tw=function(a,b,c){return new ResizeObserver(()=>{if(a.a.g){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};
5
- e=Mw(d,"SIMID:Player:resize",e);Ow(d,e)}})},Uw=function(a,b){a.h.info("SIMID Session created");a.a=b},Vw=function(a){a.h.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(()=>{a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height=
6
- "";a.g=!1;a.m.trigger(new _.C(_.rf))},Ww=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}%`}},Xw=class{constructor(a){this.f=a;this.g="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";this.a.style.border=_.xe;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
- _.xe;this.a.style.overflow=_.Vd;this.a.classList.add(_.Zc);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.yf?JSON.parse(b):b:null))if(b.type)switch(this.h.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":Sw(this,b);break;case "resolve":b=b.args;var c=this.j.get(b.messageId);c&&c.resolve(b);break;case "reject":b=b.args;(c=this.j.get(b.messageId))&&c.reject(b);break;case "SIMID:Creative:requestResize":c=this.f;var d=b.args;c.h.info("Creative requested resize",
8
- d);if(c.m&&c.m.getSurface()&&c.m.getSurface().getMedia()&&d.mediaDimensions){c.g?c.m.getSurface().getMedia().style.transition="":(c.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",c.g=!0);const e=Ww(c,d.mediaDimensions);c.m.getSurface().getMedia().style.left=e.left;c.m.getSurface().getMedia().style.top=e.top;c.m.getSurface().getMedia().style.width=e.width;c.m.getSurface().getMedia().style.height=e.height}d.creativeDimensions&&(d=Ww(c,d.creativeDimensions),c.a.a.style.left=
9
- d.left,c.a.a.style.top=d.top,c.a.a.style.width=d.width,c.a.a.style.height=d.height);Rw(this,b)}else this.h.warn("WARNING: received message without 'type' property")};this.h=new _.R("clpp.simid.SimidPlayer");Uw(this.f,this)}load(a){window.addEventListener(_.qe,this.o);this.g="";this.l=0;const b=this.f.url();this.h.info(`Loading "${b}" as src of iFrame`);this.a.src=b;this.h.info("Attaching iFrame");a.appendChild(this.a)}unload(){Vw(this.f);this.g=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.qe,
10
- this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},Nw=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.g=d;this.a=null;this.f.set(d.messageId,this);0<=e&&(this.a=setTimeout(()=>{this.resolve()},e))}resolve(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.g.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.g.messageId);this.j(a)}};var Zw=class extends _.It{constructor(){super();this.h=new _.R("clpp.simid.Plugin");this.g=this.a=this.m=null;this.l=[];this.j=null;this.w=this.A.bind(this);this.f=null;this.o=!1}id(){return"simid"}onPlayerCreated(a){this.h.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.g&&this.g.release();this.g=new Yw(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.h.info(`Setting up SIMID plugin for ${this.l.length} creatives`),
11
- b=this.m.getSurface()){this.h.info("Creating new session");this.a=new Xw(this.g);var c=b.getContainer();this.j=Tw(this,c,b);this.j.observe(c);a.on(_.Ff,this.w)}else this.h.warn(Jw)}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&&(Qw(this.a),this.o=!0,this.h.info(Lw)),
12
- c&&(c=this.a,Ow(c,Mw(c,Kw,{currentTime:a-b}))))):((a=this.m.getSurface())||this.h.warn(Jw),a=a.getContainer(),this.f=b,this.o=!1,this.h.info("Loading session"),this.g.f=b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)}onPlayerWillRelease(a){super.onPlayerWillRelease(a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.Ff,this.w),this.f&&(this.a.unload(),this.f=this.g.f=null))}},Yw=class{constructor(a){this.m=a;this.a=null;this.h=new _.R("clpp.simid.Loader");
13
- this.g=!1;this.f=null}release(){this.h.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.h.error("No player container found. Can not create SIMID init data"),new _.H(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.h.error("No player surface found. Can not create SIMID init data"),new _.H(1,10,10100,"No surface");return a}url(){return this.f?this.f.url:""}};_.Ho(new class{create(){return new Zw}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var jx="No surface found. Can not attach frame!",kx="SIMID:Media:timeupdate",lx="Starting creative",mx=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},px=function(a,b){return new Promise((c,d)=>{new nx(a.j,c,d,b);ox(a,b)})},qx=function(a){const b=mx(a,"SIMID:Player:startCreative",void 0);px(a,b).then(()=>{var c=a.f;c.g.info(lx);c.m.trigger(new _.D(_.Df));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
+ c)})},sx=function(a,b){_.x(function*(){a.h=b.sessionId;rx(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=mx(a,"SIMID:Player:init",d);var e=px(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()}})},rx=function(a,b){ox(a,mx(a,"resolve",{messageId:b.messageId,
4
+ value:void 0}))},ox=function(a,b){a.h?(b.type!==kx&&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}'`)},tx=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=mx(d,"SIMID:Player:resize",e);ox(d,e)}})},ux=function(a,b){a.g.info("SIMID Session created");a.a=b},vx=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 _.D(_.Ef))},wx=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}%`}},xx=class{constructor(a){this.f=a;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";this.a.style.border=_.Be;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
+ _.Be;this.a.style.overflow=_.Zd;this.a.classList.add(_.dd);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.Mf?JSON.parse(b):b:null))if(b.type)switch(this.g.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":sx(this,b);break;case "resolve":b=b.args;var c=this.j.get(b.messageId);c&&c.resolve(b);break;case "reject":b=b.args;(c=this.j.get(b.messageId))&&c.reject(b);break;case "SIMID:Creative:requestResize":c=this.f;var d=b.args;c.g.info("Creative requested resize",
8
+ d);if(c.m&&c.m.getSurface()&&c.m.getSurface().getMedia()&&d.mediaDimensions){c.h?c.m.getSurface().getMedia().style.transition="":(c.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",c.h=!0);const e=wx(c,d.mediaDimensions);c.m.getSurface().getMedia().style.left=e.left;c.m.getSurface().getMedia().style.top=e.top;c.m.getSurface().getMedia().style.width=e.width;c.m.getSurface().getMedia().style.height=e.height}d.creativeDimensions&&(d=wx(c,d.creativeDimensions),c.a.a.style.left=
9
+ d.left,c.a.a.style.top=d.top,c.a.a.style.width=d.width,c.a.a.style.height=d.height);rx(this,b)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.S("clpp.simid.SimidPlayer");ux(this.f,this)}load(a){window.addEventListener(_.ue,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(){vx(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.ue,
10
+ this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},nx=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.h=d;this.a=null;this.f.set(d.messageId,this);0<=e&&(this.a=setTimeout(()=>{this.resolve()},e))}resolve(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);this.j(a)}};var zx=class extends _.iu{constructor(){super();this.g=new _.S("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 yx(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.g.info(`Setting up SIMID plugin for ${this.l.length} creatives`),
11
+ b=this.m.getSurface()){this.g.info("Creating new session");this.a=new xx(this.h);var c=b.getContainer();this.j=tx(this,c,b);this.j.observe(c);a.on(_.Tf,this.w)}else this.g.warn(jx)}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&&(qx(this.a),this.o=!0,this.g.info(lx)),
12
+ c&&(c=this.a,ox(c,mx(c,kx,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(jx),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(_.Tf,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},yx=class{constructor(a){this.m=a;this.a=null;this.g=new _.S("clpp.simid.Loader");
13
+ this.h=!1;this.f=null}release(){this.g.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.H(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.H(1,10,10100,"No surface");return a}url(){return this.f?this.f.url:""}};_.Wo(new class{create(){return new zx}});};f.call(g, window);
package/cl.smooth.js CHANGED
@@ -1,59 +1,59 @@
1
- import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var UK="Full MP4 box must have flags defined",VK="clpp.smooth.SmoothMP4Processor",WK="codecPrivateData",XK=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.N(a,c);_.N(a,b)},YK=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Zk()}},ZK=function(a,b){YK(a,b>>16&255);YK(a,b>>8&255);YK(a,b&255)},$K=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.Zk()}},aL=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.Zk()}},bL=function(a,b){try{a.f.setInt16(a.a,
2
- b,a.g),a.a+=2}catch(c){_.Zk()}},cL=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},dL=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},eL=function(a,b,c,d){c=b.Se[c];b=b.eh;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
3
- String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.zy([a],[b])[0]},fL=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.u?c=["maxWidth","maxHeight","bitrate",WK,"fourCC"]:a.type===_.p&&(c=["bitrate",WK,"channels","bitsPerSample","samplingRate","fourCC"]);return _.Gg(a,b,c,["id","segmentIndex"])},gL=function(a,b,c){const d=c.kd.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Na:null,Nb:null,width:NaN,height:NaN,Gb:null,Zc:NaN,
4
- sampleSize:NaN,channelCount:NaN};switch(c.type){case _.u:a.Na=[_.mi(d[1])];a.Nb=[_.mi(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.Gb=_.mi(c.kd),a.sampleSize=c.Rf||16,a.Zc=c.Zc,a.channelCount=c.Ke}return a},hL=function(a,b){return a.filter(c=>c.type===b)},iL=function(a,b){a=a.exec(b);return null==a||""==a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},pL=function(a,b,c){var d=null;if(jL.test(a)){{a=jL.exec(a);d=Number(a[1]);const e=
5
- Number(a[2]);let f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}}else kL.test(a)?d=iL(kL,a):lL.test(a)?d=iL(lL,a):mL.test(a)?(a=mL.exec(a),d=Number(a[1])/c.frameRate):nL.test(a)?(a=nL.exec(a),d=Number(a[1])/c.a):oL.test(a)&&(d=iL(oL,a));c=d;d=c+b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},qL=function(a){let b=
6
- 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.ul(b)},xL=function(a,b,c){a:{var d=[_.ud,_.sd];for(e of d)if((d=c.qd(e))&&d.keyId){var e=d.keyId;break a}_.B(VK,"Could not get default Key ID for DRM init data!");e=null}c=new rL("xxxx");a.type===_.u?c=new sL(a.width,a.height):c=new tL(a.channelCount,a.sampleSize,a.Zc);a=new uL;a.g=1;a.j=8;a.o=e||"00000000000000000000000000000000";a=(new rL("schi")).append([a]);b=(new rL(_.sf)).append([new vL(b),new wL(_.Uc,65536),a]);c.append([b]);return c},
7
- $L=function(a,b){var c=b.ud(),d=new yL(a.timescale,a.duration,a.id),e=(new zL).append([new AL(a.id)]),f=new BL(a.id,a.duration,a.timescale,a.width,a.height),g=new CL(a.timescale,a.duration);const h=new DL(a.type);var k=null,l=new EL;l.entries=[new FL];var m=new GL;switch(a.type){case _.u:k=new HL(a.Na,a.Nb);c?(a=xL(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new IL(a.width,a.height)).append([k]),m.entries=[a]);k=new JL;break;case _.p:k=new KL(a.Gb),c?(a=xL(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
- (a=(new LL(a.channelCount,a.sampleSize,a.Zc)).append([k]),m.entries=[a]),k=new ML}m=(new NL).append([m,new OL,new PL,new QL,new RL]);l=(new SL).append([l]);l=(new TL).append([k,l,m]);g=(new UL).append([g,h,l]);f=(new VL).append([f,g]);d=(new WL).append([d,f,e]);e=new XL("dash",0,["iso6","mp41","avc1"]);c&&(c=b.qd(_.sd),b=b.qd(_.ud),c&&d.append([new YL("pssh",c.initData,8)]),b&&d.append([new YL("pssh",b.initData,8)]),c||b||_.B(VK,"Could not get PSSH init data!"));b=new ZL([e,d]);return _.J(b.write())},
9
- jM=function(a,b){let c,d,e,f,g,h;(new _.sl).L("moof",_.ll).$("mfhd",k=>{{const l=new aM;l.g=_.P(k.reader);c=l}}).L("traf",_.ll).$("tfhd",k=>{{const l=k.reader.Ca();if(null===k.flags)throw new _.H(_.F,3,3019,UK);const m=new bM(k.version||0,k.flags||0);m.g=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.gl(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.B=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.l=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.w=_.P(k.reader));
10
- 0<l-k.reader.getPosition()&&k.flags&32&&(m.o=_.P(k.reader));d=m}}).$("trun",k=>{{var l=k.reader.Ca();if(null===k.flags)throw new _.H(_.F,3,3019,UK);const m=new cM(k.version||0,k.flags||0);m.g=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.l=_.fl(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.o=_.P(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.w.push(_.P(k.reader)),k.flags&512&&m.sampleSize.push(_.P(k.reader)),k.flags&1024&&m.B.push(_.P(k.reader)),k.flags&
11
- 2048&&(0===k.version?m.j.push(_.P(k.reader)):m.j.push(_.fl(k.reader)));e=m}}).$("sdtp",k=>{{const l=_.il(k.reader,k.reader.Ca());f=new dM("sdtp",k.version||0,k.flags||0,l,0)}}).L("uuid",k=>{var l=_.il(k.reader,16);if(_.oi(l,eM)){l=_.P(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new fM(k.version,k.flags);l.j=_.P(k.reader);k.flags&1&&(l.l=_.dl(k.reader));for(let m=0;m<l.j;m++){const n={cf:_.il(k.reader,8),Gc:0,ue:[]};if(k.flags&2){n.Gc=_.el(k.reader);for(let q=0;q<n.Gc;q++){const t={Ie:0,Je:0};
12
- t.Ie=_.el(k.reader);t.Je=_.P(k.reader);n.ue.push(t)}}l.g.push(n)}g=l}}).L(_.oe,k=>{{const l=new gM;0<k.reader.Ca()?l.g=_.il(k.reader,k.reader.Ca()):(_.B(VK,"mdat box is empty!"),l.g=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new hM).append([d,e]);f&&a.append([f]);b.ud()&&g&&a.append([g]);b=(new iM).append([c,a]);return new ZL([b,h])},oM=function(a,b,c,d){var e=d.ud(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=jM(b,d);if(null===g)return a.request.contentType===_.G?a.data:
13
- g;d=g.get(_.oe);if(a.request.contentType===_.G){e=d.g.buffer;if(c){e=_.Zh(e);if((e=(new DOMParser).parseFromString(e,_.Ef))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new kM(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0])){f=h.getElementsByTagName("p");for(let t=0,v=f.length;t<v;t++){h=f[t];a=c;b=d;g=["begin",_.Od];for(let y=0,A=g.length;y<
14
- A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const D=l.length;for(;n<D;n++){var q=l[n].name;if(q=q.match(m)){k=k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[y],pL(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.$h(e).buffer}else c=e;return c}h=new iM;a=g.get("mfhd");b=new hM;k=g.get("tfhd");m=new lM(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");k.g=1;k.flags&=16777214;k.flags|=131072;b.append([k,
15
- m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.j;m++)k.push(10+6*c.g[m].Gc);else g=8;b.append([c,new mM,new nM(g,k,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new ZL([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},pM=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
16
- periodId:null}},qM=function(a){return{initData:_.py(_.dm(a)),initDataType:_.Uc,keyId:a,periodId:null}},rM=function(a,b,c){a=_.lm(a);c&&a.version!==c&&(a=_.ry(a,c));return{initData:_.py(a),initDataType:_.Uc,keyId:b,periodId:null}},sM=function(a,b){return _.w(function*(){var c=_.zi(b);c.timeout=a.f.attemptParameters.timeout;c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length);c.baseDelay=a.f.attemptParameters.baseDelay;c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;
17
- c.type=1;c=yield a.D.networkingEngine.fetch(c).P;a.l=c.uri;return c})},AM=function(a,b){let c=null;try{{const ea=new DOMParser;let Za,Ma;try{const hb=_.Zh(b);Ma=ea.parseFromString(hb.trim(),_.Ef)}catch(hb){throw hb;}Ma&&Ma.documentElement.tagName==_.Eb&&(Za=Ma.documentElement);c=Za&&0<Za.getElementsByTagName("parsererror").length?null:Za}}catch(ea){}if(!c)throw a.h.error("Unable to parse manifest"),new _.H(_.F,4,4033,a.l);const d=+tM(a,c,"MajorVersion"),e=+tM(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
18
- 1E7;let g=+tM(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.Yl(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.h.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.F,4,4036,a.l);h?(uM(a,vM),a.A=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):uM(a,wM);a.a={startTime:0,delay:0,duration:g/f,Md:l/f,Tc:0};if(m){{var n=a.f.playreadyVersion;
19
- const ea=[],Za=_.Yl(m,"ProtectionHeader")[0],Ma=_.li(_.$l(Za)||""),hb=_.lm(Ma).a;ea.push(pM(_.ud,qM(hb),[hb]));ea.push(pM(_.sd,rM(Ma,hb,n),[hb]));var q=ea}a.o=q}{const ea=[],Za=_.Yl(c,"StreamIndex");if(!Za.length)throw a.h.error("No streams found!"),new _.H(_.F,4,4034,a.l);for(let Ma=0;Ma<Za.length;Ma++){{var t=a,v=Za[Ma];const hb=tM(t,v,"Type"),Bc=+v.getAttribute("Chunks"),mh=v.getAttribute("Subtype"),$d=v.getAttribute("Language")||_.If,ae=_.Jh($d),nh=v.getAttribute("Name")||"",Rf=+v.getAttribute(_.eb),
20
- Sf=+v.getAttribute(_.db),Dl=tM(t,v,"Url"),KP=+v.getAttribute("TimeScale")||null;{const Cc=[],Ui=_.Yl(v,_.ub);for(let be=0;be<Ui.length;be++){{let Dc,Ia,rd;var y=t,A=Ui[be],D=hb;const Vi=+A.getAttribute("Index"),Tf=+tM(y,A,"Bitrate");let Yb=NaN,Uf=NaN,El=NaN,Yq=NaN,dC=NaN,eC=NaN,fC=NaN;const gC=A.getAttribute("FourCC");switch(D){case _.u:Yb=+tM(y,A,_.db);Uf=+tM(y,A,_.eb);break;case _.p:Yq=+A.getAttribute("Channels")||2,El=+tM(y,A,"SamplingRate"),eC=+tM(y,A,"AudioTag"),dC=+tM(y,A,"BitsPerSample"),fC=
21
- +tM(y,A,"PacketSize")}let Zq=String(A.getAttribute("CodecPrivateData"));if(D===_.p&&!Zq){{var E=Yq;const hC={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},Fl=hC[El];if("AACH"===gC){Ia=new Uint8Array(4);const iC=hC[2*El];Ia[0]=40|Fl>>1;Ia[1]=Fl<<7|E<<3|iC>>1;Ia[2]=iC<<7|8;Ia[3]=0;Dc=new Uint16Array(2);Dc[0]=(Ia[0]<<8)+Ia[1];Dc[1]=(Ia[2]<<8)+Ia[3];rd=Dc[0].toString(16)+Dc[1].toString(16)}else Ia=new Uint8Array(2),Ia[0]=16|Fl>>1,Ia[1]=Fl<<7|E<<3,Dc=
22
- new Uint16Array(1),Dc[0]=(Ia[0]<<8)+Ia[1],rd=Dc[0].toString(16);Zq=rd.toUpperCase()}}var O={id:y.W++,type:D,index:Vi,bitrate:Tf,kd:Zq,maxHeight:Yb,maxWidth:Uf,Zc:El,Ke:Yq,mh:eC,Rf:dC,yh:fC,hg:gC,segmentIndex:null}}Cc.push(O)}var bb=Cc}{const Cc=[],Ui=_.Yl(v,"c");for(let be=0;be<Ui.length;be++){const Dc=Ui[be];let Ia=parseInt(Dc.getAttribute("t"),10),rd=parseInt(Dc.getAttribute("d"),10),Vi=parseInt(Dc.getAttribute("r"),10),Tf=0;if(isNaN(Ia)&&isNaN(rd))throw t.h.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
23
- new _.H(_.F,4,4037,t.l);0===be&&isNaN(Ia)&&(Tf=Ia=0);if(0<be){const Yb=Cc[Cc.length-1];Tf=Yb.n+1;Yb.d||(Yb.d=Ia-Yb.t);Ia||(Ia=Yb.t+Yb.d);rd||(rd=Ia-Yb.t)}Cc.push({n:Tf,d:rd,t:Ia});if(Vi){Vi--;for(let Yb=0;Yb<Vi;Yb++){const Uf=Cc[Cc.length-1];Tf=Uf.n+1;Ia=Uf.t+Uf.d;rd=Uf.d;Cc.push({n:Tf,d:rd,t:Ia})}}}t.C()||Cc.length===Bc||t.h.warn("Number of fragments ("+Bc+") differs from number of chunks ("+Cc.length+").");var Lb=Cc}var bd={type:hb,ph:Bc,Xg:mh,language:ae,Sc:$d,name:nh,maxWidth:Rf,maxHeight:Sf,
24
- eh:Dl,tracks:bb,Se:Lb,timescale:KP}}ea.push(bd)}var Nf=ea}const Ua={xh:d,ef:e,timescale:f,duration:g,isLive:h,wh:k,Md:l,Td:!1,streams:Nf};if(a.g&&a.w)return xM(a,Ua),Promise.resolve();a.G.clear();{const ea=Ua.timescale,Za=Ua.duration,Ma=hL(Ua.streams,_.p),hb=hL(Ua.streams,_.u),Bc=hL(Ua.streams,_.G),mh=[];let $d=yM(a,Za,ea,Ma),ae=yM(a,Za,ea,hb);const nh=yM(a,Za,ea,Bc);$d.length||($d=[null]);ae.length||(ae=[null]);for(let Rf=0;Rf<ae.length;Rf++)for(let Sf=0;Sf<$d.length;Sf++)mh.push(zM(a,ae[Rf],$d[Sf]));
25
- var Xd={startTime:0,endTime:Za,variants:mh,textStreams:nh,thumbStreams:[]}}{var xc=Ua.streams;let ea=a.a.startTime,Za=a.a.delay;const Ma=a.I;let hb=Math.min(a.a.duration||Infinity,Ma);const Bc=a.C(),mh=a.a.Md,$d=a.a.Tc,ae=a.H,nh=isFinite(a.F)?a.F:0;if(Bc)hb=Infinity,ea=Date.now()/1E3-$d,a.a.startTime=ea,Za=3*ae;else{const Rf=isFinite(Ma)?Ma:a.a.duration;for(const Sf of xc)for(const Dl of Sf.tracks)Dl.segmentIndex.offset(-nh),_.Vy(Dl.segmentIndex,Rf)}a.B=new _.UD(a.f.timeline||{},ea,Za,!Bc,!0);a.B.g=
26
- hb;_.hz(a.B,ae);a.B.w=mh;Bc||a.B.offset(-nh)}a.D.filterAllPeriods([Xd]);a.g={presentationTimeline:a.B,periods:[Xd],minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.Hc(a.M),a.K=!0);a.w=Ua;return Promise.resolve()},BM=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Bb.bind(a),b))},tM=function(a,b,c){if(b=b.getAttribute(c))return b;a.h.error("required attribute not provided: "+c);throw new _.H(_.F,4,4038,a.l,c);},uM=function(a,b){const c=b===wM;a.g&&a.g.presentationTimeline&&
27
- _.cz(a.g.presentationTimeline,c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.O=b},xM=function(a,b){for(let e=0;e<a.w.streams.length;e++){const f=b.streams[e];for(const g of a.w.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){fL(g,c)||a.h.warn("The current stream is updated with a stream that seems to have different base properties!");var d=CM(a,a.w.timescale,f,c);c=g.segmentIndex;_.qz(c,d);(d=a.a.Md)&&_.rz(c,_.oz(c)-d).forEach(h=>{h.La().forEach(k=>
28
- {a.G.delete(k)})})}else a.h.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},CM=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.Se.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.F=Math.min(a.F,h)):h=f[k-1].endTime;const m=h+l,n=eL(a.l,c,k,d);a.H=Math.max(a.H,l);f.push(new _.pz(k,h,m,()=>[n],0,null,0,null,!0,g));a.G.set(n,h);e+=l});if(c.type===_.u||c.type===_.p)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Tc?a.a.Tc=b.endTime:a.a.Tc=
29
- Math.min(a.a.Tc,b.endTime);return f},yM=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=CM(a,c,k,h);const O=new _.VD(l);var m=null;k.type!==_.G&&(m=DM(a,b,c,k,h));h.segmentIndex=O;l=_.WD++;var n=Promise.resolve.bind(Promise),q=O.f.bind(O),t=O.get.bind(O),v=O.g.bind(O),y=O.getDuration.bind(O),A=EM[k.type];var D="";switch(k.type){case _.u:D=h.kd;var E=/00000001[0-9]7/.exec(D);D="avc1."+(E&&E[0]?D.substr(D.indexOf(E[0])+10,6):"42c00c");a.h.debug("VIDEO CODECS: ",
30
- D);break;case _.p:D=h.kd,E=2,"AACH"===h.hg?E=5:D&&(E=(parseInt(D.substr(0,2),16)&248)>>3),D="mp4a.40."+E,a.h.debug("AUDIO CODECS: ",D)}E=k.type===_.G?FM[k.Xg]:void 0;h={id:l,originalId:null,Ah:null,createSegmentIndex:n,findSegmentPosition:q,getSegmentReference:t,adjustSegmentDurations:v,getDuration:y,segmentIndex:O,segmentLookupStrategy:_.ay,initSegmentReference:m,mimeType:A,codecs:D,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:E,encrypted:a.J(),keyId:null,
31
- language:k.language,originalLanguage:k.Sc,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.Ke||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},zM=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.If;return c||b?{id:a.U++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},DM=function(a,b,c,d,e){b=gL(b,d.timescale||c,e);c={isLive:a.C.bind(a),
32
- ud:a.J.bind(a),mg:()=>1,qd:a.R.bind(a)};d=new Uint8Array(0);try{d=$L(b,c)}catch(g){throw a.h.error("Failed to generate initialization segment."),new _.H(_.F,3,4035,g);}const f="data:text/plain;base64,"+_.ki(d);return new _.RD(()=>[f],0,null,null,!0)},rL=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]}append(a=[]){for(let b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.f.length;b++){if(this.f[b].type===
33
- a)return this.f[b];{const c=this.f[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(let c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b}write(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.N(a,1):_.N(a,this.size);_.$k(a,cL(this.type));this.size>b&&XK(a,this.size);"uuid"===this.type&&_.$k(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),
34
- this.f[b].a(),a.getPosition()}},GM=class extends rL{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);YK(a,this.version);ZK(a,this.flags)}},YL=class extends rL{constructor(a,b,c){super(a);this.g=b;this.offset=c}a(){return this.g.byteLength+super.a()-this.offset}write(a){super.write(a);_.$k(a,this.g,this.offset);a.getPosition()}},dM=class extends GM{constructor(a,b,c,d,e){super(a,b,c);this.g=d;this.offset=e}a(){return this.g.byteLength+super.a()-
35
- this.offset}write(a){super.write(a);_.$k(a,this.g,this.offset);a.getPosition()}},XL=class extends rL{constructor(a,b,c){super("ftyp");this.j=a;this.ef=b;this.g=c}a(){let a=this.j.length;a=a+4+this.g.join("").length;return a+super.a()}write(a){super.write(a);_.$k(a,cL(this.j));_.N(a,this.ef);_.$k(a,cL(this.g.join("")));a.getPosition()}},WL=class extends rL{constructor(){super(_.ue)}},VL=class extends rL{constructor(){super(_.Gf)}},yL=class extends GM{constructor(a,b,c){super("mvhd",1,0);this.timescale=
36
- a;this.duration=b;this.volume=256;this.j=c+1;this.g=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.g.length;return a+=super.a()}write(a){super.write(a);1===this.version?(XK(a,0),XK(a,0),_.N(a,this.timescale),XK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.timescale),_.N(a,this.duration*this.timescale));_.N(a,65536);$K(a,this.volume);$K(a,0);_.N(a,0);_.N(a,0);for(let b=0;b<this.g.length;b++)YK(a,this.g[b]);
37
- _.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,0);_.N(a,this.j);a.getPosition()}},zL=class extends rL{constructor(){super("mvex")}},AL=class extends GM{constructor(a){super("trex",0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.N(a,this.g);_.N(a,1);_.N(a,0);_.N(a,0);_.N(a,0);a.getPosition()}},BL=class extends GM{constructor(a,b,c,d,e){super("tkhd",1,7);this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.g=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
38
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.g.length;return a+super.a()}write(a){super.write(a);1===this.version?(XK(a,0),XK(a,0),_.N(a,this.j),_.N(a,0),XK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.j),_.N(a,0),_.N(a,this.duration*this.timescale));_.N(a,0);_.N(a,0);$K(a,0);$K(a,0);$K(a,this.volume);$K(a,0);for(let b=0;b<this.g.length;b++)YK(a,this.g[b]);$K(a,this.width);$K(a,0);$K(a,this.height);$K(a,0);a.getPosition()}},CL=class extends GM{constructor(a,
39
- b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956}a(){let a=0;a=1===this.version?a+28:a+16;return a+4+super.a()}write(a){super.write(a);1===this.version?(XK(a,0),XK(a,0),_.N(a,this.timescale),XK(a,this.duration*this.timescale)):(_.N(a,0),_.N(a,0),_.N(a,this.timescale),_.N(a,this.duration*this.timescale));$K(a,this.language);$K(a,0);a.getPosition()}},DL=class extends GM{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.N(a,0);this.g===
40
- _.u?_.$k(a,cL("vide")):_.$k(a,cL("soun"));_.N(a,0);_.N(a,0);_.N(a,0);this.g===_.u?_.$k(a,cL("VideoHandler\x00")):_.$k(a,cL("SoundHandler\x00"));a.getPosition()}},JL=class extends GM{constructor(){super("vmhd",0,1);this.g=new Uint8Array([0,0,0,0,0,0])}a(){return 2+this.g.byteLength+super.a()}write(a){super.write(a);$K(a,0);_.$k(a,this.g);a.getPosition()}},HM=class extends rL{constructor(a){super(a);this.A=!0}a(){return 8+super.a()}write(a){super.write(a);_.N(a,0);$K(a,0);$K(a,1)}},IM=class extends HM{constructor(a){super(a);
41
- this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);$K(a,0);$K(a,0);_.N(a,0);_.N(a,0);_.N(a,0);$K(a,this.width);$K(a,this.height);_.N(a,4718592);_.N(a,4718592);_.N(a,0);$K(a,1);YK(a,10);_.$k(a,cL("AVC Coding",31));$K(a,this.depth);bL(a,-1)}},JM=class extends HM{constructor(a,b,c,d){super(a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d}a(){return 20+super.a()}write(a){super.write(a);_.N(a,0);_.N(a,0);$K(a,this.channelCount);$K(a,this.sampleSize);bL(a,0);
42
- $K(a,0);$K(a,this.sampleRate);$K(a,0)}},IL=class extends IM{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},sL=class extends IL{constructor(a,b){super(a,b);this.type="encv"}},LL=class extends JM{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},tL=class extends LL{constructor(a,b,c){super(a,b,c);this.type="enca"}},
43
- HL=class extends rL{constructor(a,b){super("avcC");this.Na=a;this.Nb=b;this.version=1;this.g=this.Na[0][1];this.j=this.Na[0][2];this.level=this.Na[0][3]}a(){let a=7;for(var b=0;b<this.Na.length;b++)a+=2,a+=this.Na[b].byteLength;for(b=0;b<this.Na.length;b++)a+=2,a+=this.Nb[b].byteLength;return a+super.a()}write(a){super.write(a);YK(a,this.version);YK(a,this.g);YK(a,this.j);YK(a,this.level);YK(a,255);YK(a,224|this.Na.length);for(var b=0;b<this.Na.length;b++)$K(a,this.Na[b].length),_.$k(a,this.Na[b]);
44
- YK(a,this.Nb.length);for(b=0;b<this.Nb.length;b++)$K(a,this.Nb[b].length),_.$k(a,this.Nb[b]);a.getPosition()}},KL=class extends GM{constructor(a){super("esds",0,0);this.Gb=a}a(){return 22+(this.Gb.byteLength+3)+super.a()}write(a){super.write(a);YK(a,3);YK(a,23+this.Gb.byteLength);$K(a,1);YK(a,0);YK(a,4);YK(a,15+this.Gb.byteLength);YK(a,64);YK(a,21);ZK(a,0);_.N(a,0);_.N(a,0);YK(a,5);YK(a,this.Gb.byteLength);_.$k(a,this.Gb);_.$k(a,new Uint8Array([6,1,2]));a.getPosition()}},FL=class extends GM{constructor(a=
45
- ""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.$k(a,cL(this.location));a.getPosition()}},EL=class extends GM{constructor(){super("dref",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},NL=class extends rL{constructor(){super(_.xf)}},GL=class extends GM{constructor(){super(_.zf,
46
- 0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},OL=class extends GM{constructor(){super("stts",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
47
- PL=class extends GM{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},RL=class extends GM{constructor(){super("stco",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.N(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
48
- a.getPosition()}},QL=class extends GM{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.N(a,0);_.N(a,0);a.getPosition()}},ML=class extends GM{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);bL(a,0);$K(a,0);a.getPosition()}},SL=class extends rL{constructor(){super("dinf")}},TL=class extends rL{constructor(){super(_.te)}},UL=class extends rL{constructor(){super(_.pe)}},lM=class extends GM{constructor(a,b){super("tfdt",a,0);this.g=b}a(){let a=
49
- 0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);1===this.version?XK(a,this.g):_.N(a,this.g);a.getPosition()}},aM=class extends GM{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.N(a,this.g);a.getPosition()}},cM=class extends GM{constructor(a,b){super("trun",a,b);this.o=this.l=this.g=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]}a(){let a=4;this.flags&KM&&(a+=4);this.flags&LM&&(a+=4);for(let b=0;b<this.g;b++)this.flags&MM&&(a+=
50
- 4),this.flags&NM&&(a+=4),this.flags&OM&&(a+=4),this.flags&PM&&(a+=4);return a+super.a()}write(a){super.write(a);_.N(a,this.g);this.flags&KM&&(a.getPosition(),aL(a,this.l));this.flags&LM&&_.N(a,this.o);for(let b=0;b<this.g;b++)this.flags&MM&&_.N(a,this.w[b]),this.flags&NM&&_.N(a,this.sampleSize[b]),this.flags&OM&&_.N(a,this.B[b]),this.flags&PM&&(0===this.version?_.N(a,this.j[b]):aL(a,this.j[b]));a.getPosition()}},KM=1,LM=4,MM=256,NM=512,OM=1024,PM=2048,bM=class extends GM{constructor(a,b){super("tfhd",
51
- a,b);this.g=255;this.o=this.w=this.l=this.B=this.j=0}a(){let a=4;this.flags&QM&&(a+=8);this.flags&RM&&(a+=4);this.flags&SM&&(a+=4);this.flags&TM&&(a+=4);this.flags&UM&&(a+=4);return a+super.a()}write(a){super.write(a);_.N(a,this.g);this.flags&QM&&XK(a,this.j);this.flags&RM&&_.N(a,this.B);this.flags&SM&&_.N(a,this.l);this.flags&TM&&_.N(a,this.w);this.flags&UM&&_.N(a,this.o);a.getPosition()}},QM=1,RM=2,SM=8,TM=16,UM=32,hM=class extends rL{constructor(){super("traf")}},iM=class extends rL{constructor(){super("moof")}},
52
- gM=class extends rL{constructor(){super(_.oe);this.g=new Uint8Array(0)}a(){return this.g.byteLength+super.a()}write(a){super.write(a);0<this.g.byteLength&&_.$k(a,this.g)}},uL=class extends GM{constructor(){super("tenc",0,0);this.g=1;this.j=8;this.o="";this.l=[]}a(){let a;a=20;1===this.g&&0===this.j&&(a=a+1+this.l.length);return a+super.a()}write(a){super.write(a);YK(a,0);0===this.version?YK(a,0):YK(a,0);YK(a,this.g);YK(a,this.j);_.$k(a,_.mi(this.o));if(1===this.g&&0===this.j){YK(a,0);for(let b=0;b<
53
- this.l.length;b++)YK(a,this.l[b])}a.getPosition()}},wL=class extends GM{constructor(a,b){super("schm",0,0);this.g=a;this.j=b;this.Db=""}a(){let a=8;this.flags&1&&(a+=cL(this.Db).byteLength);return a+super.a()}write(a){super.write(a);_.$k(a,cL(this.g));_.N(a,this.j);this.flags&1&&_.$k(a,cL(this.Db));a.getPosition()}},vL=class extends rL{constructor(a){super("frma");this.g=a}a(){return cL(this.g).byteLength+super.a()}write(a){super.write(a);_.$k(a,cL(this.g));a.getPosition()}},mM=class extends GM{constructor(){super("saio",
54
- 0,0);this.offset=[0]}a(){let a=0;this.flags&1&&(a+=8);a+=4;for(let b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.N(a,0),_.N(a,0));_.N(a,1);for(let b=0;1>b;b++)0===this.version?_.N(a,this.offset[b]):XK(a,this.offset[b]);a.getPosition()}},nM=class extends GM{constructor(a,b,c){super("saiz",0,0);this.g=a;this.l=b;this.j=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.g&&(a+=this.l.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.N(a,
55
- 0),_.N(a,0));YK(a,this.g);_.N(a,this.j);if(0===this.g)for(let b=0;b<this.j;b++)YK(a,this.l[b]);a.getPosition()}},fM=class extends GM{constructor(a,b){super("senc",a,b);this.j=0;this.l=8;this.g=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.j;b++)if(a+=this.g[b].cf.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].Gc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.N(a,this.j);this.flags&1&&YK(a,this.l);for(let b=0;b<this.j;b++)if(_.$k(a,this.g[b].cf),this.flags&2){$K(a,this.g[b].Gc);
56
- for(let c=0;c<this.g[b].Gc;c++)$K(a,this.g[b].ue[c].Ie),_.N(a,this.g[b].ue[c].Je)}a.getPosition()}};var kM=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))}},jL=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,kL=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,lL=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,mL=/^(\d*\.?\d*)f$/,nL=/^(\d*\.?\d*)t$/,oL=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var ZL=class{constructor(a){this.a=a;this.f=qL(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=qL(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var eM=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var VM=class{constructor(){this.w=this.g=this.f=this.D=null;this.U=1;this.W=0;this.l="";this.B=this.a=null;this.h=new _.R("clpp.smooth.SmoothParser");this.K=!1;this.j=this.A=null;this.O=wM;this.H=0;this.F=this.I=Infinity;this.o=[];this.M=this.V.bind(this);this.G=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,dL(a)])];return sM(this,a).then(c=>AM(this,c.data).then(()=>{BM(this,this.A);return this.g}))}stop(){this.D&&this.D.networkingEngine.yd(this.M);this.A=this.w=this.g=this.f=
57
- this.D=null;this.j&&(clearTimeout(this.j),this.j=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.C())return sM(this,[this.l]).then(a=>AM(this,a.data).then(()=>this.g)).catch(a=>{if(this.D)this.D.onError(a)})}setCurrentVariant(){}Bb(){this.h.debug(_.Sx);this.D&&(this.j=null,this.update().then(()=>{BM(this,this.A)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&BM(this,100))}))}C(){return this.O===vM}J(){return 0<this.o.length}R(a){let b=null;if(this.o.length)for(let c=
58
- 0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b}V(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.w.timescale,c={isLive:this.C.bind(this),ud:this.J.bind(this),mg:()=>1,qd:this.R.bind(this)};let d=!1;const e=new _.H(_.F,3,4035,null);let f=null;try{const g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.h.debug(`Using base media decode time ${g} instead of `+
59
- `segment reference time ${a.request.startTime}`);f=oM(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)}},EM={video:_.Yf,audio:_.Hc,text:_.yc},wM=_.Tx,vM="LIVE",FM={hh:_.Yx,jh:_.ky};_.x("clpp.smooth.SmoothComponent",class extends _.ht{f(){_.Nq.ism=VM;_.Lq[_.zc]=VM}a(){_.wz("ism");_.xz(_.zc)}id(){return"smooth"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var NP="Full MP4 box must have flags defined",OP="clpp.smooth.SmoothMP4Processor",PP="codecPrivateData",QP=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.O(a,c);_.O(a,b)},RP=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.pl()}},SP=function(a,b){RP(a,b>>16&255);RP(a,b>>8&255);RP(a,b&255)},TP=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.pl()}},UP=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.pl()}},VP=function(a,b){try{a.f.setInt16(a.a,
2
+ b,a.h),a.a+=2}catch(c){_.pl()}},WP=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},XP=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},YP=function(a,b,c,d){c=b.uf[c];b=b.yh;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
3
+ String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.EB([a],[b])[0]},ZP=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.w?c=["maxWidth","maxHeight","bitrate",PP,"fourCC"]:a.type===_.p&&(c=["bitrate",PP,"channels","bitsPerSample","samplingRate","fourCC"]);return _.Ug(a,b,c,["id","segmentIndex"])},$P=function(a,b,c){const d=c.Cd.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,cb:null,ac:null,width:NaN,height:NaN,Tb:null,qd:NaN,
4
+ sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.cb=[_.Bi(d[1])];a.ac=[_.Bi(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.Tb=_.Bi(c.Cd),a.sampleSize=c.gg||16,a.qd=c.qd,a.channelCount=c.lf}return a},aQ=function(a,b){return a.filter(c=>c.type===b)},bQ=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},iQ=function(a,b,c){var d=null;if(cQ.test(a)){{a=cQ.exec(a);d=Number(a[1]);const e=
5
+ Number(a[2]);let f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}}else dQ.test(a)?d=bQ(dQ,a):eQ.test(a)?d=bQ(eQ,a):fQ.test(a)?(a=fQ.exec(a),d=Number(a[1])/c.frameRate):gQ.test(a)?(a=gQ.exec(a),d=Number(a[1])/c.a):hQ.test(a)&&(d=bQ(hQ,a));c=d;d=c+b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},jQ=function(a){let b=
6
+ 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Jl(b)},qQ=function(a,b,c){a:{var d=[_.yd,_.wd];for(e of d)if((d=c.Fd(e))&&d.keyId){var e=d.keyId;break a}_.B(OP,"Could not get default Key ID for DRM init data!");e=null}c=new kQ("xxxx");a.type===_.w?c=new lQ(a.width,a.height):c=new mQ(a.channelCount,a.sampleSize,a.qd);a=new nQ;a.h=1;a.j=8;a.o=e||"00000000000000000000000000000000";a=(new kQ("schi")).append([a]);b=(new kQ(_.Ff)).append([new oQ(b),new pQ(_.Zc,65536),a]);c.append([b]);return c},
7
+ TQ=function(a,b){var c=b.Hd(),d=new rQ(a.timescale,a.duration,a.id),e=(new sQ).append([new tQ(a.id)]),f=new uQ(a.id,a.duration,a.timescale,a.width,a.height),g=new vQ(a.timescale,a.duration);const h=new wQ(a.type);var k=null,l=new xQ;l.entries=[new yQ];var m=new zQ;switch(a.type){case _.w:k=new AQ(a.cb,a.ac);c?(a=qQ(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new BQ(a.width,a.height)).append([k]),m.entries=[a]);k=new CQ;break;case _.p:k=new DQ(a.Tb),c?(a=qQ(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
+ (a=(new EQ(a.channelCount,a.sampleSize,a.qd)).append([k]),m.entries=[a]),k=new FQ}m=(new GQ).append([m,new HQ,new IQ,new JQ,new KQ]);l=(new LQ).append([l]);l=(new MQ).append([k,l,m]);g=(new NQ).append([g,h,l]);f=(new OQ).append([f,g]);d=(new PQ).append([d,f,e]);e=new QQ("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Fd(_.wd),b=b.Fd(_.yd),c&&d.append([new RQ("pssh",c.initData,8)]),b&&d.append([new RQ("pssh",b.initData,8)]),c||b||_.B(OP,"Could not get PSSH init data!"));b=new SQ([e,d]);return _.J(b.write())},
9
+ cR=function(a,b){let c,d,e,f,g,h;(new _.Hl).L("moof",_.Q).ba("mfhd",k=>{{const l=new UQ;l.h=_.P(k.reader);c=l}}).L("traf",_.Q).ba("tfhd",k=>{{const l=k.reader.Ja();if(null===k.flags)throw new _.H(_.E,3,3019,NP);const m=new VQ(k.version||0,k.flags||0);m.h=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.wl(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.C=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.l=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.w=_.P(k.reader));
10
+ 0<l-k.reader.getPosition()&&k.flags&32&&(m.o=_.P(k.reader));d=m}}).ba("trun",k=>{{var l=k.reader.Ja();if(null===k.flags)throw new _.H(_.E,3,3019,NP);const m=new WQ(k.version||0,k.flags||0);m.h=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.l=_.vl(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.o=_.P(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.h;l++)k.flags&256&&m.w.push(_.P(k.reader)),k.flags&512&&m.sampleSize.push(_.P(k.reader)),k.flags&1024&&m.C.push(_.P(k.reader)),k.flags&
11
+ 2048&&(0===k.version?m.j.push(_.P(k.reader)):m.j.push(_.vl(k.reader)));e=m}}).ba("sdtp",k=>{{const l=_.yl(k.reader,k.reader.Ja());f=new XQ("sdtp",k.version||0,k.flags||0,l,0)}}).L("uuid",k=>{var l=_.yl(k.reader,16);if(_.Di(l,YQ)){l=_.P(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new ZQ(k.version,k.flags);l.j=_.P(k.reader);k.flags&1&&(l.l=_.tl(k.reader));for(let m=0;m<l.j;m++){const n={Ff:_.yl(k.reader,8),Rc:0,Ke:[]};if(k.flags&2){n.Rc=_.ul(k.reader);for(let r=0;r<n.Rc;r++){const v={jf:0,kf:0};
12
+ v.jf=_.ul(k.reader);v.kf=_.P(k.reader);n.Ke.push(v)}}l.h.push(n)}g=l}}).L(_.pe,k=>{{const l=new $Q;0<k.reader.Ja()?l.h=_.yl(k.reader,k.reader.Ja()):(_.B(OP,"mdat box is empty!"),l.h=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new aR).append([d,e]);f&&a.append([f]);b.Hd()&&g&&a.append([g]);b=(new bR).append([c,a]);return new SQ([b,h])},hR=function(a,b,c,d){var e=d.Hd(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=cR(b,d);if(null===g)return a.request.contentType===_.G?a.data:
13
+ g;d=g.get(_.pe);if(a.request.contentType===_.G){e=d.h.buffer;if(c){e=_.ni(e);if((e=(new DOMParser).parseFromString(e,_.Sf))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new dR(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0])){f=h.getElementsByTagName("p");for(let v=0,u=f.length;v<u;v++){h=f[v];a=c;b=d;g=["begin",_.Td];for(let y=0,C=g.length;y<
14
+ C;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 F=l.length;for(;n<F;n++){var r=l[n].name;if(r=r.match(m)){k=k.getAttribute(r[0]);break b}}k=null}h.setAttribute(g[y],iQ(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.oi(e).buffer}else c=e;return c}h=new bR;a=g.get("mfhd");b=new aR;k=g.get("tfhd");m=new eR(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");k.h=1;k.flags&=16777214;k.flags|=131072;b.append([k,
15
+ m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.j;m++)k.push(10+6*c.h[m].Rc);else g=8;b.append([c,new fR,new gR(g,k,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new SQ([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},iR=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
16
+ periodId:null}},jR=function(a){return{initData:_.rB(_.pm(a)),initDataType:_.Zc,keyId:a,periodId:null}},kR=function(a,b,c){a=_.xm(a);c&&a.version!==c&&(a=_.tB(a,c));return{initData:_.rB(a),initDataType:_.Zc,keyId:b,periodId:null}},lR=function(a,b){return _.x(function*(){var c=_.Oi(b);c.timeout=a.f.attemptParameters.timeout;c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length);c.baseDelay=a.f.attemptParameters.baseDelay;c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;
17
+ c.type=1;c=yield a.B.networkingEngine.fetch(c).O;a.l=c.uri;return c})},tR=function(a,b){let c=null;try{{const ea=new DOMParser;let bb,Oa;try{const jb=_.ni(b);Oa=ea.parseFromString(jb.trim(),_.Sf)}catch(jb){throw jb;}Oa&&Oa.documentElement.tagName===_.Ib&&(bb=Oa.documentElement);c=bb&&0<bb.getElementsByTagName("parsererror").length?null:bb}}catch(ea){}if(!c)throw a.g.error("Unable to parse manifest"),new _.H(_.E,4,4033,a.l);const d=+mR(a,c,"MajorVersion"),e=+mR(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
18
+ 1E7;let g=+mR(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.jm(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.E,4,4036,a.l);h?(nR(a,oR),a.A=typeof a.f.liveRefreshPeriod===_.t?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):nR(a,pR);a.a={startTime:0,delay:0,duration:g/f,de:l/f,jd:0};if(m){{var n=a.f.playreadyVersion;
19
+ const ea=[],bb=_.jm(m,"ProtectionHeader")[0],Oa=_.Ai(_.lm(bb)||""),jb=_.xm(Oa).a;ea.push(iR(_.yd,jR(jb),[jb]));ea.push(iR(_.wd,kR(Oa,jb,n),[jb]));var r=ea}a.o=r}{const ea=[],bb=_.jm(c,"StreamIndex");if(!bb.length)throw a.g.error("No streams found!"),new _.H(_.E,4,4034,a.l);for(let Oa=0;Oa<bb.length;Oa++){{var v=a,u=bb[Oa];const jb=mR(v,u,"Type"),Qc=+u.getAttribute("Chunks"),Oh=u.getAttribute("Subtype"),re=u.getAttribute("Language")||_.Wf,se=_.Yh(re),Ph=u.getAttribute("Name")||"",qg=+u.getAttribute(_.gb),
20
+ rg=+u.getAttribute(_.fb),Cm=mR(v,u,"Url"),EU=+u.getAttribute("TimeScale")||null;{const Rc=[],wj=_.jm(u,_.zb);for(let te=0;te<wj.length;te++){{let Sc,Ka,Ld;var y=v,C=wj[te],F=jb;const xj=+C.getAttribute("Index"),sg=+mR(y,C,"Bitrate");let kc=NaN,tg=NaN,Dm=NaN,fs=NaN,lG=NaN,mG=NaN,nG=NaN;const oG=C.getAttribute("FourCC");switch(F){case _.w:kc=+mR(y,C,_.fb);tg=+mR(y,C,_.gb);break;case _.p:fs=+C.getAttribute("Channels")||2,Dm=+mR(y,C,"SamplingRate"),mG=+mR(y,C,"AudioTag"),lG=+mR(y,C,"BitsPerSample"),nG=
21
+ +mR(y,C,"PacketSize")}let gs=String(C.getAttribute("CodecPrivateData"));if(F===_.p&&!gs){{var N=fs;const pG={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},Em=pG[Dm];if("AACH"===oG){Ka=new Uint8Array(4);const qG=pG[2*Dm];Ka[0]=40|Em>>1;Ka[1]=Em<<7|N<<3|qG>>1;Ka[2]=qG<<7|8;Ka[3]=0;Sc=new Uint16Array(2);Sc[0]=(Ka[0]<<8)+Ka[1];Sc[1]=(Ka[2]<<8)+Ka[3];Ld=Sc[0].toString(16)+Sc[1].toString(16)}else Ka=new Uint8Array(2),Ka[0]=16|Em>>1,Ka[1]=Em<<7|N<<3,Sc=
22
+ new Uint16Array(1),Sc[0]=(Ka[0]<<8)+Ka[1],Ld=Sc[0].toString(16);gs=Ld.toUpperCase()}}var da={id:y.X++,type:F,index:xj,bitrate:sg,Cd:gs,maxHeight:kc,maxWidth:tg,qd:Dm,lf:fs,Eh:mG,gg:lG,Qh:nG,xg:oG,segmentIndex:null}}Rc.push(da)}var vb=Rc}{const Rc=[],wj=_.jm(u,"c");for(let te=0;te<wj.length;te++){const Sc=wj[te];let Ka=parseInt(Sc.getAttribute("t"),10),Ld=parseInt(Sc.getAttribute("d"),10),xj=parseInt(Sc.getAttribute("r"),10),sg=0;if(isNaN(Ka)&&isNaN(Ld))throw v.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
23
+ new _.H(_.E,4,4037,v.l);0===te&&isNaN(Ka)&&(sg=Ka=0);if(0<te){const kc=Rc[Rc.length-1];sg=kc.n+1;kc.d||(kc.d=Ka-kc.t);Ka||(Ka=kc.t+kc.d);Ld||(Ld=Ka-kc.t)}Rc.push({n:sg,d:Ld,t:Ka});if(xj){xj--;for(let kc=0;kc<xj;kc++){const tg=Rc[Rc.length-1];sg=tg.n+1;Ka=tg.t+tg.d;Ld=tg.d;Rc.push({n:sg,d:Ld,t:Ka})}}}v.D()||Rc.length===Qc||v.g.warn("Number of fragments ("+Qc+") differs from number of chunks ("+Rc.length+").");var Xb=Rc}var pd={type:jb,Hh:Qc,ph:Oh,language:se,hd:re,name:Ph,maxWidth:qg,maxHeight:rg,
24
+ yh:Cm,tracks:vb,uf:Xb,timescale:EU}}ea.push(pd)}var mg=ea}const Wa={Ph:d,Hf:e,timescale:f,duration:g,isLive:h,Oh:k,de:l,le:!1,streams:mg};if(a.h&&a.w)return qR(a,Wa),Promise.resolve();a.G.clear();{const ea=Wa.timescale,bb=Wa.duration,Oa=aQ(Wa.streams,_.p),jb=aQ(Wa.streams,_.w),Qc=aQ(Wa.streams,_.G),Oh=[];let re=rR(a,bb,ea,Oa),se=rR(a,bb,ea,jb);const Ph=rR(a,bb,ea,Qc);re.length||(re=[null]);se.length||(se=[null]);for(let qg=0;qg<se.length;qg++)for(let rg=0;rg<re.length;rg++)Oh.push(sR(a,se[qg],re[rg]));
25
+ var oe={id:"ID",configurationId:void 0,startTime:0,endTime:bb,variants:Oh,textStreams:Ph,thumbStreams:[]}}{var Mc=Wa.streams;let ea=a.a.startTime,bb=a.a.delay;const Oa=a.I;let jb=Math.min(a.a.duration||Infinity,Oa);const Qc=a.D(),Oh=a.a.de,re=a.a.jd,se=a.H,Ph=isFinite(a.F)?a.F:0;if(Qc)jb=Infinity,ea=Date.now()/1E3-re,a.a.startTime=ea,bb=3*se;else{const qg=isFinite(Oa)?Oa:a.a.duration;for(const rg of Mc)for(const Cm of rg.tracks)Cm.segmentIndex.offset(-Ph),_.eC(Cm.segmentIndex,qg)}a.C=new _.HI(a.f.timeline||
26
+ {},ea,bb,!Qc,!0);a.C.h=jb;_.tC(a.C,se);a.C.A=Oh;Qc||a.C.offset(-Ph)}a.B.filterAllPeriods([oe]);a.h={presentationTimeline:a.C,periods:[oe],minBufferTime:0};Promise.resolve();a.K||(a.B.networkingEngine.Sc(a.M),a.K=!0);a.w=Wa;return Promise.resolve()},uR=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.ob.bind(a),b))},mR=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.H(_.E,4,4038,a.l,c);},nR=function(a,b){const c=b===pR;a.h&&a.h.presentationTimeline&&
27
+ _.oC(a.h.presentationTimeline,c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.N=b},qR=function(a,b){for(let e=0;e<a.w.streams.length;e++){const f=b.streams[e];for(const g of a.w.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){ZP(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=vR(a,a.w.timescale,f,c);c=g.segmentIndex;_.GC(c,d);(d=a.a.de)&&_.HC(c,_.EC(c)-d).forEach(h=>{h.Qa().forEach(k=>
28
+ {a.G.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},vR=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.uf.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.F=Math.min(a.F,h)):h=f[k-1].endTime;const m=h+l,n=YP(a.l,c,k,d);a.H=Math.max(a.H,l);f.push(new _.FC(k,h,m,()=>[n],0,null,0,null,!0,g));a.G.set(n,h);e+=l});if(c.type===_.w||c.type===_.p)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.jd?a.a.jd=b.endTime:a.a.jd=
29
+ Math.min(a.a.jd,b.endTime);return f},rR=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=vR(a,c,k,h);const da=new _.II(l);var m=null;k.type!==_.G&&(m=wR(a,b,c,k,h));h.segmentIndex=da;l=_.MI++;var n=Promise.resolve.bind(Promise),r=da.f.bind(da),v=da.get.bind(da),u=da.h.bind(da),y=da.getDuration.bind(da),C=xR[k.type];var F="";switch(k.type){case _.w:F=h.Cd;var N=/00000001[0-9]7/.exec(F);F="avc1."+(N&&N[0]?F.substr(F.indexOf(N[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",
30
+ F);break;case _.p:F=h.Cd,N=2,"AACH"===h.xg?N=5:F&&(N=(parseInt(F.substr(0,2),16)&248)>>3),F="mp4a.40."+N,a.g.debug("AUDIO CODECS: ",F)}N=k.type===_.G?yR[k.ph]:void 0;h={id:l,originalId:null,Sh:null,createSegmentIndex:n,findSegmentPosition:r,getSegmentReference:v,adjustSegmentDurations:u,getDuration:y,segmentIndex:da,segmentLookupStrategy:_.sA,initSegmentReference:m,mimeType:C,codecs:F,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:N,encrypted:a.J(),keyId:null,
31
+ language:k.language,originalLanguage:k.hd,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.lf||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},sR=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.Wf;return c||b?{id:a.S++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},wR=function(a,b,c,d,e){b=$P(b,d.timescale||c,e);c={isLive:a.D.bind(a),
32
+ Hd:a.J.bind(a),Dg:()=>1,Fd:a.R.bind(a)};d=new Uint8Array(0);try{d=TQ(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.H(_.E,3,4035,g);}const f="data:text/plain;base64,"+_.zi(d);return new _.EI(()=>[f],0,null,null,!0)},kQ=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]}append(a=[]){for(let b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.f.length;b++){if(this.f[b].type===
33
+ a)return this.f[b];{const c=this.f[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(let c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b}write(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.O(a,1):_.O(a,this.size);_.ql(a,WP(this.type));this.size>b&&QP(a,this.size);"uuid"===this.type&&_.ql(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),
34
+ this.f[b].a(),a.getPosition()}},zR=class extends kQ{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);RP(a,this.version);SP(a,this.flags)}},RQ=class extends kQ{constructor(a,b,c){super(a);this.h=b;this.offset=c}a(){return this.h.byteLength+super.a()-this.offset}write(a){super.write(a);_.ql(a,this.h,this.offset);a.getPosition()}},XQ=class extends zR{constructor(a,b,c,d,e){super(a,b,c);this.h=d;this.offset=e}a(){return this.h.byteLength+super.a()-
35
+ this.offset}write(a){super.write(a);_.ql(a,this.h,this.offset);a.getPosition()}},QQ=class extends kQ{constructor(a,b,c){super("ftyp");this.j=a;this.Hf=b;this.h=c}a(){let a=this.j.length;a=a+4+this.h.join("").length;return a+super.a()}write(a){super.write(a);_.ql(a,WP(this.j));_.O(a,this.Hf);_.ql(a,WP(this.h.join("")));a.getPosition()}},PQ=class extends kQ{constructor(){super(_.ye)}},OQ=class extends kQ{constructor(){super(_.Uf)}},rQ=class extends zR{constructor(a,b,c){super("mvhd",1,0);this.timescale=
36
+ a;this.duration=b;this.volume=256;this.j=c+1;this.h=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.h.length;return a+=super.a()}write(a){super.write(a);1===this.version?(QP(a,0),QP(a,0),_.O(a,this.timescale),QP(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.timescale),_.O(a,this.duration*this.timescale));_.O(a,65536);TP(a,this.volume);TP(a,0);_.O(a,0);_.O(a,0);for(let b=0;b<this.h.length;b++)RP(a,this.h[b]);
37
+ _.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,this.j);a.getPosition()}},sQ=class extends kQ{constructor(){super("mvex")}},tQ=class extends zR{constructor(a){super("trex",0,0);this.h=a}a(){return 20+super.a()}write(a){super.write(a);_.O(a,this.h);_.O(a,1);_.O(a,0);_.O(a,0);_.O(a,0);a.getPosition()}},uQ=class extends zR{constructor(a,b,c,d,e){super("tkhd",1,7);this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.h=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
38
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.h.length;return a+super.a()}write(a){super.write(a);1===this.version?(QP(a,0),QP(a,0),_.O(a,this.j),_.O(a,0),QP(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.j),_.O(a,0),_.O(a,this.duration*this.timescale));_.O(a,0);_.O(a,0);TP(a,0);TP(a,0);TP(a,this.volume);TP(a,0);for(let b=0;b<this.h.length;b++)RP(a,this.h[b]);TP(a,this.width);TP(a,0);TP(a,this.height);TP(a,0);a.getPosition()}},vQ=class extends zR{constructor(a,
39
+ b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956}a(){let a=0;a=1===this.version?a+28:a+16;return a+4+super.a()}write(a){super.write(a);1===this.version?(QP(a,0),QP(a,0),_.O(a,this.timescale),QP(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.timescale),_.O(a,this.duration*this.timescale));TP(a,this.language);TP(a,0);a.getPosition()}},wQ=class extends zR{constructor(a){super("hdlr",0,0);this.h=a}a(){return 33+super.a()}write(a){super.write(a);_.O(a,0);this.h===
40
+ _.w?_.ql(a,WP("vide")):_.ql(a,WP("soun"));_.O(a,0);_.O(a,0);_.O(a,0);this.h===_.w?_.ql(a,WP("VideoHandler\x00")):_.ql(a,WP("SoundHandler\x00"));a.getPosition()}},CQ=class extends zR{constructor(){super("vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])}a(){return 2+this.h.byteLength+super.a()}write(a){super.write(a);TP(a,0);_.ql(a,this.h);a.getPosition()}},AR=class extends kQ{constructor(a){super(a);this.A=!0}a(){return 8+super.a()}write(a){super.write(a);_.O(a,0);TP(a,0);TP(a,1)}},BR=class extends AR{constructor(a){super(a);
41
+ this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);TP(a,0);TP(a,0);_.O(a,0);_.O(a,0);_.O(a,0);TP(a,this.width);TP(a,this.height);_.O(a,4718592);_.O(a,4718592);_.O(a,0);TP(a,1);RP(a,10);_.ql(a,WP("AVC Coding",31));TP(a,this.depth);VP(a,-1)}},CR=class extends AR{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);_.O(a,0);_.O(a,0);TP(a,this.channelCount);TP(a,this.sampleSize);VP(a,0);
42
+ TP(a,0);TP(a,this.sampleRate);TP(a,0)}},BQ=class extends BR{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},lQ=class extends BQ{constructor(a,b){super(a,b);this.type=_.kA}},EQ=class extends CR{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},mQ=class extends EQ{constructor(a,b,c){super(a,b,c);this.type="enca"}},AQ=
43
+ class extends kQ{constructor(a,b){super("avcC");this.cb=a;this.ac=b;this.version=1;this.h=this.cb[0][1];this.j=this.cb[0][2];this.level=this.cb[0][3]}a(){let a=7;for(var b=0;b<this.cb.length;b++)a+=2,a+=this.cb[b].byteLength;for(b=0;b<this.cb.length;b++)a+=2,a+=this.ac[b].byteLength;return a+super.a()}write(a){super.write(a);RP(a,this.version);RP(a,this.h);RP(a,this.j);RP(a,this.level);RP(a,255);RP(a,224|this.cb.length);for(var b=0;b<this.cb.length;b++)TP(a,this.cb[b].length),_.ql(a,this.cb[b]);RP(a,
44
+ this.ac.length);for(b=0;b<this.ac.length;b++)TP(a,this.ac[b].length),_.ql(a,this.ac[b]);a.getPosition()}},DQ=class extends zR{constructor(a){super("esds",0,0);this.Tb=a}a(){return 22+(this.Tb.byteLength+3)+super.a()}write(a){super.write(a);RP(a,3);RP(a,23+this.Tb.byteLength);TP(a,1);RP(a,0);RP(a,4);RP(a,15+this.Tb.byteLength);RP(a,64);RP(a,21);SP(a,0);_.O(a,0);_.O(a,0);RP(a,5);RP(a,this.Tb.byteLength);_.ql(a,this.Tb);_.ql(a,new Uint8Array([6,1,2]));a.getPosition()}},yQ=class extends zR{constructor(a=
45
+ ""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.ql(a,WP(this.location));a.getPosition()}},xQ=class extends zR{constructor(){super("dref",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},GQ=class extends kQ{constructor(){super(_.Lf)}},zQ=class extends zR{constructor(){super(_.Nf,
46
+ 0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},HQ=class extends zR{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);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
47
+ IQ=class extends zR{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);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},KQ=class extends zR{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);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
48
+ a.getPosition()}},JQ=class extends zR{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.O(a,0);_.O(a,0);a.getPosition()}},FQ=class extends zR{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);VP(a,0);TP(a,0);a.getPosition()}},LQ=class extends kQ{constructor(){super("dinf")}},MQ=class extends kQ{constructor(){super(_.xe)}},NQ=class extends kQ{constructor(){super(_.qe)}},eR=class extends zR{constructor(a,b){super("tfdt",a,0);this.baseMediaDecodeTime=
49
+ b}a(){let a=0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);1===this.version?QP(a,this.baseMediaDecodeTime):_.O(a,this.baseMediaDecodeTime);a.getPosition()}},UQ=class extends zR{constructor(){super("mfhd",0,0);this.h=0}a(){return 4+super.a()}write(a){super.write(a);_.O(a,this.h);a.getPosition()}},WQ=class extends zR{constructor(a,b){super("trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.C=[];this.j=[]}a(){let a=4;this.flags&DR&&(a+=4);this.flags&ER&&(a+=
50
+ 4);for(let b=0;b<this.h;b++)this.flags&FR&&(a+=4),this.flags&GR&&(a+=4),this.flags&HR&&(a+=4),this.flags&IR&&(a+=4);return a+super.a()}write(a){super.write(a);_.O(a,this.h);this.flags&DR&&(a.getPosition(),UP(a,this.l));this.flags&ER&&_.O(a,this.o);for(let b=0;b<this.h;b++)this.flags&FR&&_.O(a,this.w[b]),this.flags&GR&&_.O(a,this.sampleSize[b]),this.flags&HR&&_.O(a,this.C[b]),this.flags&IR&&(0===this.version?_.O(a,this.j[b]):UP(a,this.j[b]));a.getPosition()}},DR=1,ER=4,FR=256,GR=512,HR=1024,IR=2048,
51
+ VQ=class extends zR{constructor(a,b){super("tfhd",a,b);this.h=255;this.o=this.w=this.l=this.C=this.j=0}a(){let a=4;this.flags&JR&&(a+=8);this.flags&KR&&(a+=4);this.flags&LR&&(a+=4);this.flags&MR&&(a+=4);this.flags&NR&&(a+=4);return a+super.a()}write(a){super.write(a);_.O(a,this.h);this.flags&JR&&QP(a,this.j);this.flags&KR&&_.O(a,this.C);this.flags&LR&&_.O(a,this.l);this.flags&MR&&_.O(a,this.w);this.flags&NR&&_.O(a,this.o);a.getPosition()}},JR=1,KR=2,LR=8,MR=16,NR=32,aR=class extends kQ{constructor(){super("traf")}},
52
+ bR=class extends kQ{constructor(){super("moof")}},$Q=class extends kQ{constructor(){super(_.pe);this.h=new Uint8Array(0)}a(){return this.h.byteLength+super.a()}write(a){super.write(a);0<this.h.byteLength&&_.ql(a,this.h)}},nQ=class extends zR{constructor(){super("tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]}a(){let a;a=20;1===this.h&&0===this.j&&(a=a+1+this.l.length);return a+super.a()}write(a){super.write(a);RP(a,0);0===this.version?RP(a,0):RP(a,0);RP(a,this.h);RP(a,this.j);_.ql(a,_.Bi(this.o));
53
+ if(1===this.h&&0===this.j){RP(a,0);for(let b=0;b<this.l.length;b++)RP(a,this.l[b])}a.getPosition()}},pQ=class extends zR{constructor(a,b){super("schm",0,0);this.h=a;this.j=b;this.Nb=""}a(){let a=8;this.flags&1&&(a+=WP(this.Nb).byteLength);return a+super.a()}write(a){super.write(a);_.ql(a,WP(this.h));_.O(a,this.j);this.flags&1&&_.ql(a,WP(this.Nb));a.getPosition()}},oQ=class extends kQ{constructor(a){super("frma");this.h=a}a(){return WP(this.h).byteLength+super.a()}write(a){super.write(a);_.ql(a,WP(this.h));
54
+ a.getPosition()}},fR=class extends zR{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&&(_.O(a,0),_.O(a,0));_.O(a,1);for(let b=0;1>b;b++)0===this.version?_.O(a,this.offset[b]):QP(a,this.offset[b]);a.getPosition()}},gR=class extends zR{constructor(a,b,c){super("saiz",0,0);this.h=a;this.l=b;this.j=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.h&&(a+=this.l.length);
55
+ return a+super.a()}write(a){super.write(a);this.flags&1&&(_.O(a,0),_.O(a,0));RP(a,this.h);_.O(a,this.j);if(0===this.h)for(let b=0;b<this.j;b++)RP(a,this.l[b]);a.getPosition()}},ZQ=class extends zR{constructor(a,b){super("senc",a,b);this.j=0;this.l=8;this.h=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.j;b++)if(a+=this.h[b].Ff.byteLength,this.flags&2){a+=2;for(let c=0;c<this.h[b].Rc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.O(a,this.j);this.flags&1&&RP(a,this.l);for(let b=
56
+ 0;b<this.j;b++)if(_.ql(a,this.h[b].Ff),this.flags&2){TP(a,this.h[b].Rc);for(let c=0;c<this.h[b].Rc;c++)TP(a,this.h[b].Ke[c].jf),_.O(a,this.h[b].Ke[c].kf)}a.getPosition()}};var dR=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))}},cQ=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,dQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,eQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,fQ=/^(\d*\.?\d*)f$/,gQ=/^(\d*\.?\d*)t$/,hQ=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var SQ=class{constructor(a){this.a=a;this.f=jQ(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=jQ(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var YQ=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var OR=class{constructor(){this.w=this.h=this.f=this.B=null;this.S=1;this.X=0;this.l="";this.C=this.a=null;this.g=new _.S("clpp.smooth.SmoothParser");this.K=!1;this.j=this.A=null;this.N=pR;this.H=0;this.F=this.I=Infinity;this.o=[];this.M=this.T.bind(this);this.G=new Map}configure(a){this.f=a}start(a,b){this.B=b;a=[...new Set([a,XP(a)])];return lR(this,a).then(c=>tR(this,c.data).then(()=>{uR(this,this.A);return this.h}))}requestStop(){}stop(){this.B&&this.B.networkingEngine.Ud(this.M);this.A=this.w=
57
+ this.h=this.f=this.B=null;this.j&&(clearTimeout(this.j),this.j=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.D())return lR(this,[this.l]).then(a=>tR(this,a.data).then(()=>this.h)).catch(a=>{if(this.B)this.B.onError(a)})}setCurrentVariant(){}ob(){this.g.debug(_.Cz);this.B&&(this.j=null,this.update().then(()=>{uR(this,this.A)}).catch(a=>{this.B&&(this.B.onError(a),1===a.severity&&uR(this,100))}))}D(){return this.N===oR}J(){return 0<this.o.length}R(a){let b=null;if(this.o.length)for(let c=
58
+ 0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b}T(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.w.timescale,c={isLive:this.D.bind(this),Hd:this.J.bind(this),Dg:()=>1,Fd:this.R.bind(this)};let d=!1;const e=new _.H(_.E,3,4035,null);let f=null;try{const g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug(`Using base media decode time ${g} instead of `+
59
+ `segment reference time ${a.request.startTime}`);f=hR(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)}},xR={video:_.gg,audio:_.Ic,text:_.Cc},pR=_.Sb,oR="LIVE",yR={zh:_.Xz,Bh:_.dB};_.z("clpp.smooth.SmoothComponent",class extends _.Gt{f(){_.kr.ism=OR;_.ir[_.Dc]=OR}a(){_.dD("ism");_.eD(_.Dc)}id(){return _.Gf}});};f.call(g, window);