@castlabs/prestoplay 6.8.0 → 6.10.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 (59) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +111 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +414 -411
  8. package/cjs/cl.crypto.js +10 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +36 -37
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +73 -67
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -31
  15. package/cjs/cl.ima.js +22 -22
  16. package/cjs/cl.mse.js +275 -274
  17. package/cjs/cl.muxdata.js +14 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +70 -70
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +70 -70
  24. package/cjs/cl.ttml.js +27 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +19 -19
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +366 -362
  36. package/cl.crypto.js +9 -9
  37. package/cl.dash.js +66 -66
  38. package/cl.externs.js +36 -37
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +61 -58
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +26 -25
  43. package/cl.ima.js +17 -17
  44. package/cl.mse.js +238 -239
  45. package/cl.muxdata.js +12 -12
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +59 -58
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -15
  58. package/package.json +1 -1
  59. package/typings.d.ts +74 -2
package/cl.muxdata.js CHANGED
@@ -1,12 +1,12 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var ut=function(a){switch(a.type){case 1:return rt;case 2:return st;case 3:return tt}},wt=function(a){const b=Object.keys(a).find(c=>vt.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},yt=function(a){let b={debug:!0,data:xt(a)};a.g&&a.g.muxOptionsOverride&&_.mf(a.g.muxOptionsOverride)&&(b=_.jf(b,a.g.muxOptionsOverride));b=_.jf(b,{getPlayheadTime:()=>1E3*a.l.getPosition(),getStateData:()=>{{a.f.debug("getStateData()");var c=a.l.getLoadedSource(),d=a.l.getTrackManager();const f=
2
- a.l.getSurface();var e={player_is_paused:a.l.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.l.getDuration(),player_autoplay_on:!!a.l.getConfiguration().autoplay};if(c){const k=new _.Jj(c.url);e.video_source_url=_.zh(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.l.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.l.getTrackManager().ia(),
3
- c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.f.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.f.debug("Mux SDK options",b);return b},zt=function(a){_.Mf(a.a);a.j.gd(a.G);a.j.Ne(a.F)},At=function(a,b,c){a.f.debug(`Event: ${b}`);a.B.emit(a.C,b,c)},xt=function(a){const b={env_key:a.g.envKey,video_title:a.o&&a.o.name||"",player_name:_.ma,player_software_name:_.ma,
4
- player_software_version:_.da,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",player_mux_plugin_version:_.da};(a=a.l.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},Bt=function(a){a.a.on(a.l,_.ue,()=>{const b={player_playhead_time:1E3*a.l.getPosition()};At(a,_.ue,b)});a.a.on(a.l,_.Rd,()=>At(a,_.Rd));a.a.on(a.l,_.gc,a.H.bind(a));a.a.on(a.l,_.je,a.J.bind(a));a.a.on(a.l,_.Ce,()=>At(a,_.ee));a.a.on(a.l,_.Be,()=>At(a,_.de));a.a.on(a.l,_.$c,a.I.bind(a));a.a.on(a.l,_.wb,()=>At(a,
5
- "adbreakstart"));a.a.on(a.l,_.xb,()=>At(a,"adbreakend"));a.a.on(a.l,_.Jb,()=>{At(a,"adplay");At(a,"adplaying")});a.a.on(a.l,_.Fb,()=>At(a,"adpause"));a.a.on(a.l,_.Hb,()=>{At(a,"adplay");At(a,"adplaying")});a.a.on(a.l,_.Kb,()=>At(a,"adended"));a.a.on(a.l,_.Bb,()=>At(a,"adfirstquartile"));a.a.on(a.l,_.Eb,()=>At(a,"admidpoint"));a.a.on(a.l,_.Lb,()=>At(a,"adthirdquartile"));a.j.Pc(a.G);a.j.ge(a.F);a.a.on(a.l,_.$c,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===
6
- c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;var d=new _.Jj(b.uris[b.uriIndex]);b={request_start:c,request_type:ut(b),request_hostname:d.a};a.f.debug("onRequestCanceled()","Track event: requestcanceled",b);At(a,"requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.Jj(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:ut(c),request_hostname:f.a,request_error:`${ut(c)}${"LoadError"}`,
7
- request_error_code:e,request_error_text:b.toString()};a.f.debug("onRequestFailed()","Track event: requestfailed",b);At(a,"requestfailed",b)}}}})},rt="manifest",st="media",tt="encryption",vt=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var Ct=class{constructor(a,b){this.l=a;this.o=this.g=null;this.C=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.jo;this.f=b;this.w=this.m=this.h=this.A=!1;this.B=null;this.j=a.getNetworkEngine();this.G=this.K.bind(this);this.F=this.L.bind(this)}initialize(a,b,c){this.g=a;this.o=b;this.B=c;this.A=!1;if(!this.h){try{this.h=!0,this.B.init(this.C,yt(this))}catch(d){throw this.h=!1,zt(this),new _.H(1,9,9302,null,d);}At(this,"playerready")}this.m&&!this.w&&(a=xt(this),
8
- At(this,"videochange",a),this.m=!1);Bt(this)}release(){this.f.debug("release()");this.m?this.f.debug(_.ha):(zt(this),this.m=!0,this.o=this.g=null)}destroy(){this.f.debug(_.Oc);this.w?this.f.debug(_.fa):(this.w=!0,this.h&&this.A&&At(this,"viewend"),At(this,"destroy"))}H(a){this.f.debug(_.Cd);var b=a.detail;a=this.l.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Da())&&a.bandwidth&&(b+=a.bandwidth),At(this,"renditionchange",{video_source_bitrate:b}))}J(a){this.f.debug(_.Gd);switch(a.detail.currentState){case _.Fl:this.l.getConfiguration().autoplay&&
9
- At(this,_.Rd);break;case _.Hl:At(this,_.Sd);break;case _.Gl:At(this,_.Ld);break;case _.wl:this.A=!0,At(this,_.Zc)}}I(a){this.f.debug(_.Dd);if(this.h&&(a=a.detail||null))if(10003===a.code)At(this,"aderror");else if(a.severity===_.G){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;At(this,_.$c,{player_error_code:a.code,
10
- player_error_message:b})}}K(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.Jj(b.uris[b.uriIndex]);a={request_start:g,request_type:ut(b),request_hostname:d.a,request_id:wt(e),request_bytes_loaded:f,request_response_start:h,request_response_end:a,request_response_headers:e,
11
- request_media_duration:c,request_url:_.zh(d)};this.f.debug("onRequestCompleted()","Track event: requestcompleted",a);At(this,"requestcompleted",a)}}}L(a){a.requestStartTimestamp=Date.now()}};var Dt=class extends _.aq{constructor(){super();this.f=null;this.a=!1;this.g=new _.P("clpp.muxdata")}onPlayerCreated(a){this.f=new Ct(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();var d=null;(this.a=!_.B(c.muxdata)&&typeof c.muxdata===_.Bd)?(c=c.muxdata,d=c.muxLib,d="undefined"!==typeof d&&typeof d.init===_.bd&&typeof d.emit===_.bd?c.muxLib:window.mux,"undefined"===d&&(this.g.warn("Mux SDK is not loaded. Will do nothing."),this.a=!1,c=new _.H(1,9,9301),this.T(a,c))):this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");
12
- if(this.a){c=a.getConfiguration();c=_.kf(c.muxdata||{});try{{const e=[];typeof c===_.Bd&&(c.envKey||e.push("envKey"));if(0<e.length)throw new _.H(1,9,9300,{missingKeys:e});}this.f.initialize(c,b,d)}catch(e){this.a=!1,this.T(a,e)}}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}T(a,b){a.trigger(new _.F(_.$c,{detail:b}))}};_.A("clpp.muxdata.MuxDataPlugin",Dt);Dt.Id="mux";_.Hm(new class{create(){return new Dt}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var zt=function(a){switch(a.type){case 1:return wt;case 2:return xt;case 3:return yt}},Bt=function(a){const b=Object.keys(a).find(c=>At.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},Dt=function(a){let b={debug:!0,data:Ct(a)};a.g&&a.g.muxOptionsOverride&&_.nf(a.g.muxOptionsOverride)&&(b=_.kf(b,a.g.muxOptionsOverride));b=_.kf(b,{getPlayheadTime:()=>1E3*a.l.getPosition(),getStateData:()=>{{a.f.debug("getStateData()");var c=a.l.getLoadedSource(),d=a.l.getTrackManager();const f=
2
+ a.l.getSurface();var e={player_is_paused:a.l.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.l.getDuration(),player_autoplay_on:!!a.l.getConfiguration().autoplay};if(c){const k=new _.Oj(c.url);e.video_source_url=_.Eh(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.l.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.l.getTrackManager().ia(),
3
+ c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.f.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.f.debug("Mux SDK options",b);return b},Et=function(a){_.Nf(a.a);a.j.md(a.F);a.j.Ye(a.C)},Ft=function(a,b,c){a.f.debug(`Event: ${b}`);a.A.emit(a.B,b,c)},Ct=function(a){const b={env_key:a.g.envKey,video_title:a.o&&a.o.name||"",player_name:_.ma,player_software_name:_.ma,
4
+ player_software_version:_.da,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",player_mux_plugin_version:_.da};(a=a.l.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},Gt=function(a){a.a.on(a.l,_.xe,()=>{const b={player_playhead_time:1E3*a.l.getPosition()};Ft(a,_.xe,b)});a.a.on(a.l,_.Ud,()=>Ft(a,_.Ud));a.a.on(a.l,_.gc,a.G.bind(a));a.a.on(a.l,_.me,a.I.bind(a));a.a.on(a.l,_.Fe,()=>Ft(a,_.he));a.a.on(a.l,_.Ee,()=>Ft(a,_.ge));a.a.on(a.l,_.ad,a.H.bind(a));a.a.on(a.l,_.wb,()=>Ft(a,
5
+ "adbreakstart"));a.a.on(a.l,_.xb,()=>Ft(a,"adbreakend"));a.a.on(a.l,_.Jb,()=>{Ft(a,"adplay");Ft(a,"adplaying")});a.a.on(a.l,_.Fb,()=>Ft(a,"adpause"));a.a.on(a.l,_.Hb,()=>{Ft(a,"adplay");Ft(a,"adplaying")});a.a.on(a.l,_.Kb,()=>Ft(a,"adended"));a.a.on(a.l,_.Bb,()=>Ft(a,"adfirstquartile"));a.a.on(a.l,_.Eb,()=>Ft(a,"admidpoint"));a.a.on(a.l,_.Lb,()=>Ft(a,"adthirdquartile"));a.j.Uc(a.F);a.j.pe(a.C);a.a.on(a.l,_.ad,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===
6
+ c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;var d=new _.Oj(b.uris[b.uriIndex]);b={request_start:c,request_type:zt(b),request_hostname:d.a};a.f.debug("onRequestCanceled()","Track event: requestcanceled",b);Ft(a,"requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.Oj(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:zt(c),request_hostname:f.a,request_error:`${zt(c)}${"LoadError"}`,
7
+ request_error_code:e,request_error_text:b.toString()};a.f.debug("onRequestFailed()","Track event: requestfailed",b);Ft(a,"requestfailed",b)}}}})},Ht=function(a){return!_.B(a)&&typeof a.init===_.cd&&typeof a.emit===_.cd},wt="manifest",xt="media",yt="encryption",At=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var It=class{constructor(a,b){this.l=a;this.o=this.g=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.po;this.f=b;this.w=this.m=this.h=!1;this.A=null;this.j=a.getNetworkEngine();this.F=this.J.bind(this);this.C=this.K.bind(this)}initialize(a,b,c){this.g=a;this.o=b;this.A=c;if(!this.h){try{this.h=!0,this.A.init(this.B,Dt(this))}catch(d){throw this.h=!1,Et(this),new _.H(1,9,9302,null,d);}Ft(this,"playerready")}this.m&&!this.w&&(a=Ct(this),Ft(this,"videochange",
8
+ a),this.m=!1);Gt(this)}release(){this.f.debug("release()");this.m?this.f.debug(_.ha):(Et(this),this.m=!0,this.o=this.g=null)}destroy(){this.f.debug(_.Pc);this.w?this.f.debug(_.fa):(this.w=!0,Ft(this,"destroy"))}G(a){this.f.debug(_.Ed);var b=a.detail;a=this.l.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ga())&&a.bandwidth&&(b+=a.bandwidth),Ft(this,"renditionchange",{video_source_bitrate:b}))}I(a){this.f.debug(_.Id);switch(a.detail.currentState){case _.Ll:this.l.getConfiguration().autoplay&&
9
+ Ft(this,_.Ud);break;case _.Nl:Ft(this,_.Vd);break;case _.Ml:Ft(this,_.Nd);break;case _.Cl:Ft(this,_.$c)}}H(a){this.f.debug(_.Fd);if(this.h&&(a=a.detail||null))if(10003===a.code)Ft(this,"aderror");else if(a.severity===_.G){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;Ft(this,_.ad,{player_error_code:a.code,
10
+ 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 _.Oj(b.uris[b.uriIndex]);a={request_start:g,request_type:zt(b),request_hostname:d.a,request_id:Bt(e),request_bytes_loaded:f,request_response_start:h,request_response_end:a,request_response_headers:e,
11
+ request_media_duration:c,request_url:_.Eh(d)};this.f.debug("onRequestCompleted()","Track event: requestcompleted",a);Ft(this,"requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var Jt=class extends _.fq{constructor(){super();this.f=null;this.a=!1;this.g=new _.Q("clpp.muxdata")}onPlayerCreated(a){this.f=new It(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.lf(c.muxdata);try{var d=[];typeof c===_.Dd&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.H(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.B(f.muxdata)&&typeof f.muxdata===_.Dd){const g=f.muxdata;d=Ht(g.muxLib)?g.muxLib:window.mux;if(!Ht(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
+ this.a=!1;const h=new _.H(1,9,9301);this.U(a,h)}}else this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,this.U(a,f)}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}U(a,b){a.trigger(new _.F(_.ad,{detail:b}))}};_.z("clpp.muxdata.MuxDataPlugin",Jt);Jt.Id="mux";_.Nm(new class{create(){return new Jt}});};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 qt=function(a,b){let c=b.baseUrl;_.Mg(c,"/")||(c+="/");const d=g=>g&&(_.Lg(g,"https://")||_.Lg(g,"http://")||_.Lg(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.Yo(a);a.Ia(_.Jc,{licenseUrl:e,videoRobustness:[_.eb,void 0],audioRobustness:[_.db,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Xj,licenseResponse:_.Yj}});a.Ia(_.Hc,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.ak,licenseResponse:_.bk,extractContentId:_.ck,certificateRequest:_.dk}});a.Ia(_.Ic,{licenseUrl:f,modifiers:{licenseRequest:_.Xj}});_.mj(a)};
3
- _.A("clpp.onboard.OnboardComponent",class extends _.Ap{constructor(){super();this.l=null;this.h=new _.P("clpp.onboard")}f(a){this.l=a}a(){this.l=null}g(){var a=this.l.getConfiguration().drm,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}'`),qt(b,a))}release(){}id(){return"onboard"}});
4
- _.A("clpp.onboard.register",qt);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var vt=function(a,b){let c=b.baseUrl;_.Qg(c,"/")||(c+="/");const d=g=>g&&(_.Pg(g,"https://")||_.Pg(g,"http://")||_.Pg(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.cp(a);a.La(_.Lc,{licenseUrl:e,videoRobustness:[_.eb,void 0],audioRobustness:[_.db,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.dk,licenseResponse:_.ek}});a.La(_.Jc,{licenseUrl:b,
2
+ certificateUrl:b,modifiers:{licenseRequest:_.gk,licenseResponse:_.hk,extractContentId:_.ik,certificateRequest:_.jk}});a.La(_.Kc,{licenseUrl:f,modifiers:{licenseRequest:_.dk}});_.rj(a)};
3
+ _.z("clpp.onboard.OnboardComponent",class extends _.Fp{constructor(){super();this.l=null;this.h=new _.Q("clpp.onboard")}f(a){this.l=a}a(){this.l=null}g(){var a=this.l.getConfiguration().drm,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}'`),vt(b,a))}release(){}id(){return"onboard"}});
4
+ _.z("clpp.onboard.register",vt);};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 bt="A persistent DRM session already exists for: ",ct="No DRM configuration.",dt="clpp.persistent",et=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},gt=function(a,b){a.H=ft;a.I=[];a.C=!0;return _.Gk(a,b)},it=function(a,b,c,d,e,f){a.H=ht;const g=new Map,h=_.uk(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Id,persistentState:_.ae,sessionTypes:[_.Nd],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
- audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Fk(a,g)},jt=function(a,b){return _.y(function*(){const c=yield _.Zk(a,b);if(c){var d=[],e=a.g.get(c);e&&a.A&&(e.kb=new _.Mk,d.push(e.kb));a.a.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.a.debug("Ignoring attempt to remove missing session",b)})},kt=function(a){a=a.g.keys();a=et(a,b=>b.sessionId);return Array.from(a)},lt=function(a,b){const c=_.oj(a),d=_.bj({drm:a});
3
- d.drm=a;a=new _.Ql({vb:b,onError:()=>{},Pd:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,rc:()=>null});a.h=c;return a},ot=function(a,b,c){return _.y(function*(){const d=mt;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)nt.debug(bt,e);else{var g=lt(a,c);try{yield gt(g,b);yield _.Xk(g);yield _.$k(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Uh(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:kt(g),keySystem:h.keySystem,
4
- licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw nt.error("Error while persisting DRM session"),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else nt.debug(ct)})},ft=1,ht=2,pt=class{store(a,b){return _.y(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var gt="A persistent DRM session already exists for: ",ht="No DRM configuration.",it="clpp.persistent",jt=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},lt=function(a,b){a.H=kt;a.I=[];a.C=!0;return _.Pk(a,b)},nt=function(a,b,c,d,e,f){a.H=mt;const g=new Map,h=_.Ak(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Kd,persistentState:_.de,sessionTypes:[_.Pd],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
+ audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Ok(a,g)},ot=function(a,b){return _.y(function*(){const c=yield _.fl(a,b);if(c){var d=[],e=a.g.get(c);e&&a.A&&(e.mb=new _.Sk,d.push(e.mb));a.a.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.a.debug("Ignoring attempt to remove missing session",b)})},pt=function(a){a=a.g.keys();a=jt(a,b=>b.sessionId);return Array.from(a)},qt=function(a,b){const c=_.tj(a),d=_.gj({drm:a});
3
+ d.drm=a;a=new _.Wl({xb:b,onError:()=>{},Xd:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,sc:()=>null});a.h=c;return a},tt=function(a,b,c){return _.y(function*(){const d=rt;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)st.debug(gt,e);else{var g=qt(a,c);try{yield lt(g,b);yield _.dl(g);yield _.gl(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Zh(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:pt(g),keySystem:h.keySystem,
4
+ licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw st.error("Error while persisting DRM session"),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else st.debug(ht)})},kt=1,mt=2,ut=class{store(a,b){return _.y(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),
5
5
  f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){return _.y(function*(){var b=window.localStorage.getItem(encodeURIComponent(a));if(b){{b=JSON.parse(atob(b));const c=JSON.parse(b.sessionIds),d=JSON.parse(b.audioCapabilities),e=JSON.parse(b.videoCapabilities),
6
- f=JSON.parse(b.serverCertificate),g=JSON.parse(b.drmConfig);b={sessionIds:c,keySystem:b.keySystem,licenseServerUri:decodeURIComponent(b.licenseServerUri),serverCertificate:f?new Uint8Array(f):null,audioCapabilities:d,videoCapabilities:e,drmConfig:g}}}else b=null;return b})}delete(a){return _.y(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.y(function*(){window.localStorage.clear()})}getName(){return"clpp.persistent.SimpleSessionStorage"}};_.A("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.nf(a.store)||c.push("store"),_.nf(a.get)||c.push("get"),_.nf(a.delete)||c.push("delete"),_.nf(a.clear)||c.push("clear"),_.nf(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw nt.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});mt=a});
7
- _.A("clpp.persistent.fetchLicense",function(a,b,...c){return _.y(function*(){var d=mt,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.Kl(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(ct);var g=b.offlineId;if(typeof g!==_.me||!g.length)throw e("Missing offline id.");if(yield d.get(g))nt.debug(bt,g);else{var h=_.bj();d=new _.Em;g=[];for(var k of c){const l=new k;_.ej(l.id())||(l.f(null),_.gj(l),g.push(l))}k=null;try{k=yield _.wn(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
- const l=yield k.start(f.url,{networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.H(_.G,4,4014));const m=_.un(l.periods);yield ot(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(),_.dj.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
- _.A("clpp.persistent.removeLicense",function(a){return _.y(function*(){var b=mt;if(_.pf(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Em,c=lt(e.drmConfig,d),yield it(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Xk(c),yield Promise.all(e.sessionIds.map(f=>_.y(function*(){yield jt(c,f);nt.debug("successfully removed session with id",f)}))),yield b.delete(a)):nt.debug("No persistent DRM session found")}catch(e){throw nt.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 nt.warn("Invalid offlineId")})});var mt=new pt,nt=new _.P(dt);_.A("clpp.persistent.PersistentLicenseComponent",class extends _.Ap{constructor(){super();this.l=null;this.j=mt;this.h=new _.P(dt)}f(a){this.l=a}a(){this.l=null}release(){}g(){this.j=mt}id(){return _.Md}o(a,b,c){const d=this;return _.y(function*(){if(a)try{yield ot(a,b,c),d.l.trigger(new _.F(_.Tc,{offlineId:a.offlineId}))}catch(e){d.l.onError(e)}else d.h.debug("No DRM configuration found for loaded source.")})}m(a){const b=this;return _.y(function*(){try{const c=yield b.j.get(a);if(c)return c.sessionIds;
6
+ f=JSON.parse(b.serverCertificate),g=JSON.parse(b.drmConfig);b={sessionIds:c,keySystem:b.keySystem,licenseServerUri:decodeURIComponent(b.licenseServerUri),serverCertificate:f?new Uint8Array(f):null,audioCapabilities:d,videoCapabilities:e,drmConfig:g}}}else b=null;return b})}delete(a){return _.y(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.y(function*(){window.localStorage.clear()})}getName(){return"clpp.persistent.SimpleSessionStorage"}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.of(a.store)||c.push("store"),_.of(a.get)||c.push("get"),_.of(a.delete)||c.push("delete"),_.of(a.clear)||c.push("clear"),_.of(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw st.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});rt=a});
7
+ _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.y(function*(){var d=rt,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.Ql(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(ht);var g=b.offlineId;if(typeof g!==_.pe||!g.length)throw e("Missing offline id.");if(yield d.get(g))st.debug(gt,g);else{var h=_.gj();d=new _.Km;g=[];for(var k of c){const l=new k;_.jj(l.id())||(l.f(null),_.lj(l),g.push(l))}k=null;try{k=yield _.Cn(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
+ const l=yield k.start(f.url,{networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.H(_.G,4,4014));const m=_.An(l.periods);yield tt(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(),_.ij.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 _.y(function*(){var b=rt;if(_.qf(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Km,c=qt(e.drmConfig,d),yield nt(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.dl(c),yield Promise.all(e.sessionIds.map(f=>_.y(function*(){yield ot(c,f);st.debug("successfully removed session with id",f)}))),yield b.delete(a)):st.debug("No persistent DRM session found")}catch(e){throw st.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 st.warn("Invalid offlineId")})});var rt=new ut,st=new _.Q(it);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Fp{constructor(){super();this.l=null;this.j=rt;this.h=new _.Q(it)}f(a){this.l=a}a(){this.l=null}release(){}g(){this.j=rt}id(){return _.Od}o(a,b,c){const d=this;return _.y(function*(){if(a)try{yield tt(a,b,c),d.l.trigger(new _.F(_.Uc,{offlineId:a.offlineId}))}catch(e){d.l.onError(e)}else d.h.debug("No DRM configuration found for loaded source.")})}m(a){const b=this;return _.y(function*(){try{const c=yield b.j.get(a);if(c)return c.sessionIds;
11
11
  b.h.debug(`No offline session found for ${a}`);return[]}catch(c){return b.h.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
package/cl.playlist.js CHANGED
@@ -1,5 +1,5 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Zs=function(a,b){return 0<=b&&b<a.a.length},$s=function(a){a.trigger(new _.F(_.Ud))},at=class extends _.To{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.l=a;this.j=b;this.f=0;this.a=[];this.g=!1;this.h=this.Fe.bind(this)}getPosition(){return this.f}Gf(){return this.a}vd(){return 0<this.a.length&&Zs(this,this.f)?this.a[this.f]:null}Hf(){const a=this.f+1;return 0<
2
- this.a.length&&Zs(this,a)?this.a[a]:null}Of(){return this.g}start(){this.g||(this.g=!0,this.l.on(_.Zc,this.h),this.Zc(this.f,!0))}stop(){this.g=!1;this.l.off(_.Zc,this.h)}Fe(){this.next()}next(){const a=this;return _.y(function*(){yield a.Zc(Math.min(a.a.length-1,a.f+1))})}ag(){const a=this;return _.y(function*(){yield a.Zc(Math.max(0,a.f-1))})}Zc(a,b){b=void 0===b?!1:b;const c=this;return _.y(function*(){if(0<c.a.length&&Zs(c,a)&&(b||c.f!==a)){c.f=a;var d=c.vd();d&&(yield c.j(d),yield c.l.load(d.configuration),
3
- c.trigger(new _.F(_.Td,{item:d})))}})}append(a){this.a.push(a);$s(this)}Nf(a,b){if(0<=b&&b<=this.a.length){const c=this.vd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));$s(this)}}remove(a){if(0<this.a.length&&Zs(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);$s(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;$s(this)}};_.A("clpp.Playlist",at);at.prototype.clear=at.prototype.clear;at.prototype.remove=at.prototype.remove;at.prototype.insert=at.prototype.Nf;
4
- at.prototype.append=at.prototype.append;at.prototype.goTo=at.prototype.Zc;at.prototype.previous=at.prototype.ag;at.prototype.next=at.prototype.next;at.prototype.onEnded=at.prototype.Fe;at.prototype.stop=at.prototype.stop;at.prototype.start=at.prototype.start;at.prototype.isStarted=at.prototype.Of;at.prototype.getUpcoming=at.prototype.Hf;at.prototype.getCurrent=at.prototype.vd;at.prototype.getQueue=at.prototype.Gf;at.prototype.getPosition=at.prototype.getPosition;at.prototype.off=at.prototype.off;
5
- at.prototype.one=at.prototype.one;at.prototype.on=at.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var dt=function(a,b){return 0<=b&&b<a.a.length},et=function(a){a.trigger(new _.F(_.Xd))},ft=class extends _.Yo{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.l=a;this.j=b;this.f=0;this.a=[];this.g=!1;this.h=this.Pe.bind(this)}getPosition(){return this.f}Pf(){return this.a}Cd(){return 0<this.a.length&&dt(this,this.f)?this.a[this.f]:null}Qf(){const a=this.f+1;return 0<
2
+ this.a.length&&dt(this,a)?this.a[a]:null}Wf(){return this.g}start(){this.g||(this.g=!0,this.l.on(_.$c,this.h),this.fd(this.f,!0))}stop(){this.g=!1;this.l.off(_.$c,this.h)}Pe(){this.next()}next(){const a=this;return _.y(function*(){yield a.fd(Math.min(a.a.length-1,a.f+1))})}gg(){const a=this;return _.y(function*(){yield a.fd(Math.max(0,a.f-1))})}fd(a,b){b=void 0===b?!1:b;const c=this;return _.y(function*(){if(0<c.a.length&&dt(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Cd();d&&(yield c.j(d),yield c.l.load(d.configuration),
3
+ c.trigger(new _.F(_.Wd,{item:d})))}})}append(a){this.a.push(a);et(this)}Vf(a,b){if(0<=b&&b<=this.a.length){const c=this.Cd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));et(this)}}remove(a){if(0<this.a.length&&dt(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);et(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;et(this)}};_.z("clpp.Playlist",ft);ft.prototype.clear=ft.prototype.clear;ft.prototype.remove=ft.prototype.remove;ft.prototype.insert=ft.prototype.Vf;
4
+ ft.prototype.append=ft.prototype.append;ft.prototype.goTo=ft.prototype.fd;ft.prototype.previous=ft.prototype.gg;ft.prototype.next=ft.prototype.next;ft.prototype.onEnded=ft.prototype.Pe;ft.prototype.stop=ft.prototype.stop;ft.prototype.start=ft.prototype.start;ft.prototype.isStarted=ft.prototype.Wf;ft.prototype.getUpcoming=ft.prototype.Qf;ft.prototype.getCurrent=ft.prototype.Cd;ft.prototype.getQueue=ft.prototype.Pf;ft.prototype.getPosition=ft.prototype.getPosition;ft.prototype.off=ft.prototype.off;
5
+ ft.prototype.one=ft.prototype.one;ft.prototype.on=ft.prototype.on;};f.call(g, window);
package/cl.smooth.js CHANGED
@@ -1,58 +1,59 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var vG="Full MP4 box must have flags defined",wG="clpp.smooth.SmoothMP4Processor",xG="codecPrivateData",yG=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.M(a,c);_.M(a,b)},zG=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.sj()}},AG=function(a,b){zG(a,b>>16&255);zG(a,b>>8&255);zG(a,b&255)},BG=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.sj()}},CG=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.sj()}},DG=function(a,b){try{a.f.setInt16(a.a,
2
- b,a.g),a.a+=2}catch(c){_.sj()}},EG=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},FG=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},GG=function(a,b,c,d){c=b.ue[c];b=b.og;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 _.uu([a],[b])[0]},HG=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.w?c=["maxWidth","maxHeight","bitrate",xG,"fourCC"]:a.type===_.p&&(c=["bitrate",xG,"channels","bitsPerSample","samplingRate","fourCC"]);return _.rf(a,b,c,["id","segmentIndex"])},IG=function(a,b,c){const d=c.Uc.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ja:null,Kb:null,width:NaN,height:NaN,Cb:null,Lc:NaN,
4
- sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.Ja=[_.Vg(d[1])];a.Kb=[_.Vg(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.Cb=_.Vg(c.Uc),a.sampleSize=c.hf||16,a.Lc=c.Lc,a.channelCount=c.oe}return a},JG=function(a,b){return a.filter(c=>c.type===b)},KG=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)},RG=function(a,b,c){var d=null;if(LG.test(a)){{a=LG.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 MG.test(a)?d=KG(MG,a):NG.test(a)?d=KG(NG,a):OG.test(a)?(a=OG.exec(a),d=Number(a[1])/c.frameRate):PG.test(a)?(a=PG.exec(a),d=Number(a[1])/c.a):QG.test(a)&&(d=KG(QG,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},SG=function(a){let b=
6
- 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Nj(b)},ZG=function(a,b,c){a:{var d=[_.Jc,_.Ic];for(e of d)if((d=c.Xc(e))&&d.keyId){var e=d.keyId;break a}_.C(wG,"Could not get default Key ID for DRM init data!");e=null}c=new TG("xxxx");a.type===_.w?c=new UG(a.width,a.height):c=new VG(a.channelCount,a.sampleSize,a.Lc);a=new WG;a.g=1;a.h=8;a.m=e||"00000000000000000000000000000000";a=(new TG("schi")).append([a]);b=(new TG(_.ge)).append([new XG(b),new YG(_.sc,65536),a]);c.append([b]);return c},
7
- BH=function(a,b){var c=b.bd(),d=new $G(a.timescale,a.duration,a.id),e=(new aH).append([new bH(a.id)]),f=new cH(a.id,a.duration,a.timescale,a.width,a.height),g=new dH(a.timescale,a.duration);const h=new eH(a.type);var k=null,l=new fH;l.entries=[new gH];var m=new hH;switch(a.type){case _.w:k=new iH(a.Ja,a.Kb);c?(a=ZG(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new jH(a.width,a.height)).append([k]),m.entries=[a]);k=new kH;break;case _.p:k=new lH(a.Cb),c?(a=ZG(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
- (a=(new mH(a.channelCount,a.sampleSize,a.Lc)).append([k]),m.entries=[a]),k=new nH}m=(new oH).append([m,new pH,new qH,new rH,new sH]);l=(new tH).append([l]);l=(new uH).append([k,l,m]);g=(new vH).append([g,h,l]);f=(new wH).append([f,g]);d=(new xH).append([d,f,e]);e=new yH("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Xc(_.Ic),b=b.Xc(_.Jc),c&&d.append([new zH("pssh",c.initData,8)]),b&&d.append([new zH("pssh",b.initData,8)]),c||b||_.C(wG,"Could not get PSSH init data!"));b=new AH([e,d]);return _.I(b.write())},
9
- LH=function(a,b){let c,d,e,f,g,h;(new _.Lj).M("moof",_.Ej).Z("mfhd",k=>{{const l=new CH;l.g=_.N(k.reader);c=l}}).M("traf",_.Ej).Z("tfhd",k=>{{const l=k.reader.za();if(null===k.flags)throw new _.H(_.G,3,3019,vG);const m=new DH(k.version||0,k.flags||0);m.g=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.Aj(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.j=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.N(k.reader));
10
- 0<l-k.reader.getPosition()&&k.flags&32&&(m.m=_.N(k.reader));d=m}}).Z("trun",k=>{{var l=k.reader.za();if(null===k.flags)throw new _.H(_.G,3,3019,vG);const m=new EH(k.version||0,k.flags||0);m.g=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.yj(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.m=_.N(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.o.push(_.N(k.reader)),k.flags&512&&m.sampleSize.push(_.N(k.reader)),k.flags&1024&&m.A.push(_.N(k.reader)),k.flags&
11
- 2048&&(0===k.version?m.h.push(_.N(k.reader)):m.h.push(_.yj(k.reader)));e=m}}).Z("sdtp",k=>{{const l=_.Bj(k.reader,k.reader.za());f=new FH("sdtp",k.version||0,k.flags||0,l,0)}}).M("uuid",k=>{var l=_.Bj(k.reader,16);if(_.Zg(l,GH)){l=_.N(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new HH(k.version,k.flags);l.h=_.N(k.reader);k.flags&1&&(l.j=_.wj(k.reader));for(let m=0;m<l.h;m++){const n={ye:_.Bj(k.reader,8),xc:0,Zd:[]};if(k.flags&2){n.xc=_.xj(k.reader);for(let q=0;q<n.xc;q++){const t={me:0,ne:0};
12
- t.me=_.xj(k.reader);t.ne=_.N(k.reader);n.Zd.push(t)}}l.g.push(n)}g=l}}).M(_.qd,k=>{{const l=new IH;0<k.reader.za()?l.g=_.Bj(k.reader,k.reader.za()):(_.C(wG,"mdat box is empty!"),l.g=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new JH).append([d,e]);f&&a.append([f]);b.bd()&&g&&a.append([g]);b=(new KH).append([c,a]);return new AH([b,h])},QH=function(a,b,c,d){var e=d.bd(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=LH(b,d);if(null===g)return a.request.contentType===_.v?a.data:
13
- g;d=g.get(_.qd);if(a.request.contentType===_.v){e=d.g.buffer;if(c){e=_.Hg(e);if((e=(new DOMParser).parseFromString(e,_.te))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new MH(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,u=f.length;t<u;t++){h=f[t];a=c;b=d;g=["begin",_.Yc];for(let x=0,z=g.length;x<
14
- z;x++){b:{var k=h;var l=g[x],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const E=l.length;for(;n<E;n++){var q=l[n].name;if(q=q.match(m)){k=k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[x],RG(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.Ig(e).buffer}else c=e;return c}h=new KH;a=g.get("mfhd");b=new JH;k=g.get("tfhd");m=new NH(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.h;m++)k.push(10+6*c.g[m].xc);else g=8;b.append([c,new OH,new PH(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new AH([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},RH=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
16
- periodId:null}},SH=function(a){return{initData:_.nu(_.pk(a)),initDataType:_.sc,keyId:a,periodId:null}},TH=function(a,b,c){a=_.Xu(a);c&&a.version!==c&&(a=_.Uu(a,c));return{initData:_.nu(a),initDataType:_.sc,keyId:b,periodId:null}},UH=function(a,b){return _.y(function*(){var c=_.jh(b);c.timeout=a.g.attemptParameters.timeout;c.maxAttempts=Math.max(a.g.attemptParameters.maxAttempts,b.length);c.baseDelay=a.g.attemptParameters.baseDelay;c.backoffFactor=a.g.attemptParameters.backoffFactor;c.fuzzFactor=a.g.attemptParameters.fuzzFactor;
17
- c.type=1;c=yield a.D.networkingEngine.fetch(c).P;a.m=c.uri;return c})},bI=function(a,b){let c=null;try{{const qa=new DOMParser;let jb,Ma;try{const cb=_.Hg(b);Ma=qa.parseFromString(cb.trim(),_.te)}catch(cb){throw cb;}Ma&&Ma.documentElement.tagName==_.ib&&(jb=Ma.documentElement);c=jb&&0<jb.getElementsByTagName("parsererror").length?null:jb}}catch(qa){}if(!c)throw a.a.error("Unable to parse manifest"),new _.H(_.G,4,4033,a.m);const d=+VH(a,c,"MajorVersion"),e=+VH(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
18
- 1E7;let g=+VH(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.Mu(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.a.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.G,4,4036,a.m);h?(WH(a,XH),a.A=typeof a.g.liveRefreshPeriod===_.r?1E3*a.g.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):WH(a,YH);a.f={startTime:0,delay:0,duration:g/f,rd:l/f,Gc:0};if(m){{var n=a.g.playreadyVersion;
19
- const qa=[],jb=_.Mu(m,"ProtectionHeader")[0],Ma=_.Ug(_.Ou(jb)||""),cb=_.Xu(Ma).a;qa.push(RH(_.Jc,SH(cb),[cb]));qa.push(RH(_.Ic,TH(Ma,cb,n),[cb]));var q=qa}a.o=q}{const qa=[],jb=_.Mu(c,"StreamIndex");if(!jb.length)throw a.a.error("No streams found!"),new _.H(_.G,4,4034,a.m);for(let Ma=0;Ma<jb.length;Ma++){{var t=a,u=jb[Ma];const cb=VH(t,u,"Type"),kc=+u.getAttribute("Chunks"),Xg=u.getAttribute("Subtype"),Ie=_.rg(u.getAttribute("Language")||_.xe),Pd=u.getAttribute("Name")||"",Yg=+u.getAttribute(_.Ka),
20
- Bf=+u.getAttribute(_.Ja),Cf=VH(t,u,"Url"),Hk=+u.getAttribute("TimeScale")||null;{const lc=[],ui=_.Mu(u,_.Xa);for(let Qd=0;Qd<ui.length;Qd++){{let mc,Ia,kd;var x=t,z=ui[Qd],E=cb;const vi=+z.getAttribute("Index"),Df=+VH(x,z,"Bitrate");let Sb=NaN,Ef=NaN,Ik=NaN,Ip=NaN,sz=NaN,tz=NaN,uz=NaN;const vz=z.getAttribute("FourCC");switch(E){case _.w:Sb=+VH(x,z,_.Ja);Ef=+VH(x,z,_.Ka);break;case _.p:Ip=+z.getAttribute("Channels")||2,Ik=+VH(x,z,"SamplingRate"),tz=+VH(x,z,"AudioTag"),sz=+VH(x,z,"BitsPerSample"),uz=
21
- +VH(x,z,"PacketSize")}let Jp=String(z.getAttribute("CodecPrivateData"));if(E===_.p&&!Jp){{var D=Ip;const wz={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},Jk=wz[Ik];if("AACH"===vz){Ia=new Uint8Array(4);const xz=wz[2*Ik];Ia[0]=40|Jk>>1;Ia[1]=Jk<<7|D<<3|xz>>1;Ia[2]=xz<<7|8;Ia[3]=0;mc=new Uint16Array(2);mc[0]=(Ia[0]<<8)+Ia[1];mc[1]=(Ia[2]<<8)+Ia[3];kd=mc[0].toString(16)+mc[1].toString(16)}else Ia=new Uint8Array(2),Ia[0]=16|Jk>>1,Ia[1]=Jk<<7|D<<3,mc=
22
- new Uint16Array(1),mc[0]=(Ia[0]<<8)+Ia[1],kd=mc[0].toString(16);Jp=kd.toUpperCase()}}var O={id:x.W++,type:E,index:vi,bitrate:Df,Uc:Jp,maxHeight:Sb,maxWidth:Ef,Lc:Ik,oe:Ip,xg:tz,hf:sz,Ig:uz,zf:vz,segmentIndex:null}}lc.push(O)}var pa=lc}{const lc=[],ui=_.Mu(u,"c");for(let Qd=0;Qd<ui.length;Qd++){const mc=ui[Qd];let Ia=parseInt(mc.getAttribute("t"),10),kd=parseInt(mc.getAttribute("d"),10),vi=parseInt(mc.getAttribute("r"),10),Df=0;if(isNaN(Ia)&&isNaN(kd))throw t.a.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
23
- new _.H(_.G,4,4037,t.m);0===Qd&&isNaN(Ia)&&(Df=Ia=0);if(0<Qd){const Sb=lc[lc.length-1];Df=Sb.n+1;Sb.d||(Sb.d=Ia-Sb.t);Ia||(Ia=Sb.t+Sb.d);kd||(kd=Ia-Sb.t)}lc.push({n:Df,d:kd,t:Ia});if(vi){vi--;for(let Sb=0;Sb<vi;Sb++){const Ef=lc[lc.length-1];Df=Ef.n+1;Ia=Ef.t+Ef.d;kd=Ef.d;lc.push({n:Df,d:kd,t:Ia})}}}t.C()||lc.length===kc||t.a.warn("Number of fragments ("+kc+") differs from number of chunks ("+lc.length+").");var pb=lc}var Nc={type:cb,Ag:kc,jg:Xg,language:Ie,name:Pd,maxWidth:Yg,maxHeight:Bf,og:Cf,
24
- tracks:pa,ue:pb,timescale:Hk}}qa.push(Nc)}var Qb=qa}const Qa={Hg:d,Be:e,timescale:f,duration:g,isLive:h,Gg:k,rd:l,Bd:!1,streams:Qb};if(a.h&&a.w)return ZH(a,Qa),Promise.resolve();a.G.clear();{const qa=Qa.timescale,jb=Qa.duration,Ma=JG(Qa.streams,_.p),cb=JG(Qa.streams,_.w),kc=JG(Qa.streams,_.v),Xg=[];let Ie=$H(a,jb,qa,Ma),Pd=$H(a,jb,qa,cb);const Yg=$H(a,jb,qa,kc);Ie.length||(Ie=[null]);Pd.length||(Pd=[null]);for(let Bf=0;Bf<Pd.length;Bf++)for(let Cf=0;Cf<Ie.length;Cf++)Xg.push(aI(a,Pd[Bf],Ie[Cf]));
25
- var Ge={startTime:0,variants:Xg,textStreams:Yg,thumbStreams:[]}}{var bb=Qa.streams;let qa=a.f.startTime,jb=a.f.delay;const Ma=a.I;let cb=Math.min(a.f.duration||Infinity,Ma);const kc=a.C(),Xg=a.f.rd,Ie=a.f.Gc,Pd=a.H,Yg=isFinite(a.F)?a.F:0;if(kc)cb=Infinity,qa=Date.now()/1E3-Ie,a.f.startTime=qa,jb=3*Pd;else{const Bf=isFinite(Ma)?Ma:a.f.duration;for(const Cf of bb)for(const Hk of Cf.tracks)Hk.segmentIndex.offset(-Yg),_.fv(Hk.segmentIndex,Bf)}a.B=new _.Vz(qa,jb,!kc,!0);a.B.f=cb;_.ov(a.B,Pd);a.B.j=Xg;
26
- kc||a.B.offset(-Yg)}a.D.filterAllPeriods([Ge]);a.h={presentationTimeline:a.B,periods:[Ge],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.Pc(a.L),a.K=!0);a.w=Qa;return Promise.resolve()},cI=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.wb.bind(a),b))},VH=function(a,b,c){if(b=b.getAttribute(c))return b;a.a.error("required attribute not provided: "+c);throw new _.H(_.G,4,4038,a.m,c);},WH=function(a,b){const c=b===YH;a.h&&a.h.presentationTimeline&&_.kv(a.h.presentationTimeline,
27
- c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.R=b},ZH=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){HG(g,c)||a.a.warn("The current stream is updated with a stream that seems to have different base properties!");var d=dI(a,a.w.timescale,f,c);c=g.segmentIndex;_.yv(c,d);(d=a.f.rd)&&_.zv(c,_.wv(c)-d).forEach(h=>{h.Fa().forEach(k=>{a.G.delete(k)})})}else a.a.warn(`Cannot find satisfying update for ${g.type} `+
28
- `track with bitrate ${g.bitrate}. Skipping update.`)}}},dI=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.ue.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.F=Math.min(a.F,h)):h=f[k-1].endTime;const m=h+l,n=GG(a.m,c,k,d);a.H=Math.max(a.H,l);f.push(new _.xv(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.f.Gc?a.f.Gc=b.endTime:a.f.Gc=Math.min(a.f.Gc,b.endTime);return f},$H=function(a,b,c,d){let e=[];for(let f=0;f<
29
- d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=dI(a,c,k,h);const O=new _.Wz(l);var m=null;k.type!==_.v&&(m=eI(a,b,c,k,h));h.segmentIndex=O;l=a.N++;var n=Promise.resolve.bind(Promise),q=O.f.bind(O),t=O.get.bind(O),u=O.g.bind(O),x=O.getDuration.bind(O),z=fI[k.type];var E="";switch(k.type){case _.w:E=h.Uc;var D=/00000001[0-9]7/.exec(E);E="avc1."+(D&&D[0]?E.substr(E.indexOf(D[0])+10,6):"42c00c");a.a.debug("VIDEO CODECS: ",E);break;case _.p:E=h.Uc,D=2,"AACH"===h.zf?D=5:E&&(D=(parseInt(E.substr(0,
30
- 2),16)&248)>>3),E="mp4a.40."+D,a.a.debug("AUDIO CODECS: ",E)}D=k.type===_.v?gI[k.jg]:void 0;h={id:l,originalId:null,Kg:null,createSegmentIndex:n,findSegmentPosition:q,getSegmentReference:t,adjustSegmentDurations:u,getDuration:x,segmentIndex:O,segmentLookupStrategy:_.Yt,initSegmentReference:m,mimeType:z,codecs:E,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:D,encrypted:a.J(),keyId:null,language:k.language,label:k.name,type:k.type,primary:!1,trickModeVideo:null,
31
- emsgSchemeIdUris:null,roles:[],channelsCount:h.oe||null,closedCaptions:null}}return h});e=e.concat(g)}return e},aI=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.xe;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},eI=function(a,b,c,d,e){b=IG(b,d.timescale||c,e);c={isLive:a.C.bind(a),bd:a.J.bind(a),Ef:()=>1,Xc:a.S.bind(a)};d=new Uint8Array(0);try{d=BH(b,c)}catch(g){throw a.a.error("Failed to generate initialization segment."),
32
- new _.H(_.G,3,4035,g);}const f="data:text/plain;base64,"+_.Tg(d);return new _.Sz(()=>[f],0,null,null,!0)},TG=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!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===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;
33
- 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?_.M(a,1):_.M(a,this.size);_.tj(a,EG(this.type));this.size>b&&yG(a,this.size);"uuid"===this.type&&_.tj(a,null);if(0<this.f.length&&!this.w)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()}},hI=class extends TG{constructor(a,b,c){super(a);
34
- this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);zG(a,this.version);AG(a,this.flags)}},zH=class extends TG{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);_.tj(a,this.g,this.offset);a.getPosition()}},FH=class extends hI{constructor(a,b,c,d,e){super(a,b,c);this.g=d;this.offset=e}a(){return this.g.byteLength+super.a()-this.offset}write(a){super.write(a);_.tj(a,this.g,this.offset);a.getPosition()}},
35
- yH=class extends TG{constructor(a,b,c){super("ftyp");this.h=a;this.Be=b;this.g=c}a(){let a=this.h.length;a=a+4+this.g.join("").length;return a+super.a()}write(a){super.write(a);_.tj(a,EG(this.h));_.M(a,this.Be);_.tj(a,EG(this.g.join("")));a.getPosition()}},xH=class extends TG{constructor(){super(_.wd)}},wH=class extends TG{constructor(){super(_.ve)}},$G=class extends hI{constructor(a,b,c){super("mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.g=[0,1,0,0,0,0,0,0,0,0,0,0,
36
- 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?(yG(a,0),yG(a,0),_.M(a,this.timescale),yG(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));_.M(a,65536);BG(a,this.volume);BG(a,0);_.M(a,0);_.M(a,0);for(let b=0;b<this.g.length;b++)zG(a,this.g[b]);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,this.h);a.getPosition()}},
37
- aH=class extends TG{constructor(){super("mvex")}},bH=class extends hI{constructor(a){super("trex",0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.M(a,this.g);_.M(a,1);_.M(a,0);_.M(a,0);_.M(a,0);a.getPosition()}},cH=class extends hI{constructor(a,b,c,d,e){super("tkhd",1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.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+32:a+20;a=a+24+
38
- this.g.length;return a+super.a()}write(a){super.write(a);1===this.version?(yG(a,0),yG(a,0),_.M(a,this.h),_.M(a,0),yG(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.h),_.M(a,0),_.M(a,this.duration*this.timescale));_.M(a,0);_.M(a,0);BG(a,0);BG(a,0);BG(a,this.volume);BG(a,0);for(let b=0;b<this.g.length;b++)zG(a,this.g[b]);BG(a,this.width);BG(a,0);BG(a,this.height);BG(a,0);a.getPosition()}},dH=class extends hI{constructor(a,b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=
39
- 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?(yG(a,0),yG(a,0),_.M(a,this.timescale),yG(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));BG(a,this.language);BG(a,0);a.getPosition()}},eH=class extends hI{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.M(a,0);this.g===_.w?_.tj(a,EG("vide")):_.tj(a,EG("soun"));_.M(a,0);_.M(a,0);_.M(a,
40
- 0);this.g===_.w?_.tj(a,EG("VideoHandler\x00")):_.tj(a,EG("SoundHandler\x00"));a.getPosition()}},kH=class extends hI{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);BG(a,0);_.tj(a,this.g);a.getPosition()}},iI=class extends TG{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);BG(a,0);BG(a,1)}},jI=class extends iI{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+
41
- super.a()}write(a){super.write(a);BG(a,0);BG(a,0);_.M(a,0);_.M(a,0);_.M(a,0);BG(a,this.width);BG(a,this.height);_.M(a,4718592);_.M(a,4718592);_.M(a,0);BG(a,1);zG(a,10);_.tj(a,EG("AVC Coding",31));BG(a,this.depth);DG(a,-1)}},kI=class extends iI{constructor(a,b,c,d){super(a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d}a(){return 20+super.a()}write(a){super.write(a);_.M(a,0);_.M(a,0);BG(a,this.channelCount);BG(a,this.sampleSize);DG(a,0);BG(a,0);BG(a,this.sampleRate);BG(a,0)}},jH=class extends jI{constructor(a,
42
- 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()}},UG=class extends jH{constructor(a,b){super(a,b);this.type="encv"}},mH=class extends kI{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()}},VG=class extends mH{constructor(a,b,c){super(a,b,c);this.type="enca"}},iH=class extends TG{constructor(a,b){super("avcC");this.Ja=a;this.Kb=b;this.version=
43
- 1;this.g=this.Ja[0][1];this.h=this.Ja[0][2];this.level=this.Ja[0][3]}a(){let a=7;for(var b=0;b<this.Ja.length;b++)a+=2,a+=this.Ja[b].byteLength;for(b=0;b<this.Ja.length;b++)a+=2,a+=this.Kb[b].byteLength;return a+super.a()}write(a){super.write(a);zG(a,this.version);zG(a,this.g);zG(a,this.h);zG(a,this.level);zG(a,255);zG(a,224|this.Ja.length);for(var b=0;b<this.Ja.length;b++)BG(a,this.Ja[b].length),_.tj(a,this.Ja[b]);zG(a,this.Kb.length);for(b=0;b<this.Kb.length;b++)BG(a,this.Kb[b].length),_.tj(a,this.Kb[b]);
44
- a.getPosition()}},lH=class extends hI{constructor(a){super("esds",0,0);this.Cb=a}a(){return 22+(this.Cb.byteLength+3)+super.a()}write(a){super.write(a);zG(a,3);zG(a,23+this.Cb.byteLength);BG(a,1);zG(a,0);zG(a,4);zG(a,15+this.Cb.byteLength);zG(a,64);zG(a,21);AG(a,0);_.M(a,0);_.M(a,0);zG(a,5);zG(a,this.Cb.byteLength);_.tj(a,this.Cb);_.tj(a,new Uint8Array([6,1,2]));a.getPosition()}},gH=class extends hI{constructor(a=""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);
45
- 0<this.location.length&&_.tj(a,EG(this.location));a.getPosition()}},fH=class extends hI{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);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},oH=class extends TG{constructor(){super(_.le)}},hH=class extends hI{constructor(){super(_.ne,0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();
46
- return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},pH=class extends hI{constructor(){super("stts",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},qH=class extends hI{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=
47
- 0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},sH=class extends hI{constructor(){super("stco",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},rH=class extends hI{constructor(){super("stsz",
48
- 0,0)}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);_.M(a,0);a.getPosition()}},nH=class extends hI{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);DG(a,0);BG(a,0);a.getPosition()}},tH=class extends TG{constructor(){super("dinf")}},uH=class extends TG{constructor(){super(_.vd)}},vH=class extends TG{constructor(){super(_.rd)}},NH=class extends hI{constructor(a,b){super("tfdt",a,0);this.g=b}a(){let a=0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);
49
- 1===this.version?yG(a,this.g):_.M(a,this.g);a.getPosition()}},CH=class extends hI{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.M(a,this.g);a.getPosition()}},EH=class extends hI{constructor(a,b){super("trun",a,b);this.m=this.j=this.g=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&lI&&(a+=4);this.flags&mI&&(a+=4);for(let b=0;b<this.g;b++)this.flags&nI&&(a+=4),this.flags&oI&&(a+=4),this.flags&pI&&(a+=4),this.flags&qI&&(a+=4);return a+
50
- super.a()}write(a){super.write(a);_.M(a,this.g);this.flags&lI&&(a.getPosition(),CG(a,this.j));this.flags&mI&&_.M(a,this.m);for(let b=0;b<this.g;b++)this.flags&nI&&_.M(a,this.o[b]),this.flags&oI&&_.M(a,this.sampleSize[b]),this.flags&pI&&_.M(a,this.A[b]),this.flags&qI&&(0===this.version?_.M(a,this.h[b]):CG(a,this.h[b]));a.getPosition()}},lI=1,mI=4,nI=256,oI=512,pI=1024,qI=2048,DH=class extends hI{constructor(a,b){super("tfhd",a,b);this.g=255;this.m=this.o=this.j=this.A=this.h=0}a(){let a=4;this.flags&
51
- rI&&(a+=8);this.flags&sI&&(a+=4);this.flags&tI&&(a+=4);this.flags&uI&&(a+=4);this.flags&vI&&(a+=4);return a+super.a()}write(a){super.write(a);_.M(a,this.g);this.flags&rI&&yG(a,this.h);this.flags&sI&&_.M(a,this.A);this.flags&tI&&_.M(a,this.j);this.flags&uI&&_.M(a,this.o);this.flags&vI&&_.M(a,this.m);a.getPosition()}},rI=1,sI=2,tI=8,uI=16,vI=32,JH=class extends TG{constructor(){super("traf")}},KH=class extends TG{constructor(){super("moof")}},IH=class extends TG{constructor(){super(_.qd);this.g=new Uint8Array(0)}a(){return this.g.byteLength+
52
- super.a()}write(a){super.write(a);0<this.g.byteLength&&_.tj(a,this.g)}},WG=class extends hI{constructor(){super("tenc",0,0);this.g=1;this.h=8;this.m="";this.j=[]}a(){let a;a=20;1===this.g&&0===this.h&&(a=a+1+this.j.length);return a+super.a()}write(a){super.write(a);zG(a,0);0===this.version?zG(a,0):zG(a,0);zG(a,this.g);zG(a,this.h);_.tj(a,_.Vg(this.m));if(1===this.g&&0===this.h){zG(a,0);for(let b=0;b<this.j.length;b++)zG(a,this.j[b])}a.getPosition()}},YG=class extends hI{constructor(a,b){super("schm",
53
- 0,0);this.g=a;this.h=b;this.yb=""}a(){let a=8;this.flags&1&&(a+=EG(this.yb).byteLength);return a+super.a()}write(a){super.write(a);_.tj(a,EG(this.g));_.M(a,this.h);this.flags&1&&_.tj(a,EG(this.yb));a.getPosition()}},XG=class extends TG{constructor(a){super("frma");this.g=a}a(){return EG(this.g).byteLength+super.a()}write(a){super.write(a);_.tj(a,EG(this.g));a.getPosition()}},OH=class extends hI{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=
54
- 0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));_.M(a,1);for(let b=0;1>b;b++)0===this.version?_.M(a,this.offset[b]):yG(a,this.offset[b]);a.getPosition()}},PH=class extends hI{constructor(a,b,c){super("saiz",0,0);this.g=a;this.j=b;this.h=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.g&&(a+=this.j.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));zG(a,this.g);_.M(a,this.h);if(0===this.g)for(let b=0;b<this.h;b++)zG(a,
55
- this.j[b]);a.getPosition()}},HH=class extends hI{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.g=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.g[b].ye.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].xc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.M(a,this.h);this.flags&1&&zG(a,this.j);for(let b=0;b<this.h;b++)if(_.tj(a,this.g[b].ye),this.flags&2){BG(a,this.g[b].xc);for(let c=0;c<this.g[b].xc;c++)BG(a,this.g[b].Zd[c].me),_.M(a,this.g[b].Zd[c].ne)}a.getPosition()}};var MH=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))}},LG=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,MG=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,NG=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,OG=/^(\d*\.?\d*)f$/,PG=/^(\d*\.?\d*)t$/,QG=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var AH=class{constructor(a){this.a=a;this.f=SG(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=SG(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var GH=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var wI=class{constructor(){this.w=this.h=this.g=this.D=null;this.N=1;this.W=0;this.m="";this.B=this.f=null;this.a=new _.P("clpp.smooth.SmoothParser");this.K=!1;this.j=this.A=null;this.R=YH;this.H=0;this.F=this.I=Infinity;this.o=[];this.L=this.U.bind(this);this.G=new Map}configure(a){this.g=a}start(a,b){this.D=b;a=[...new Set([a,FG(a)])];return UH(this,a).then(c=>bI(this,c.data).then(()=>{cI(this,this.A);return this.h}))}stop(){this.D&&this.D.networkingEngine.gd(this.L);this.A=this.w=this.h=this.g=
56
- 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 UH(this,[this.m]).then(a=>bI(this,a.data).then(()=>this.h)).catch(a=>{if(this.D)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}wb(){this.a.debug(_.Qt);this.D&&(this.j=null,this.update().then(()=>{cI(this,this.A)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&cI(this,100))}))}C(){return this.R===XH}J(){return 0<this.o.length}S(a){let b=
57
- null;if(this.o.length)for(let c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b}U(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.w.timescale,c={isLive:this.C.bind(this),bd:this.J.bind(this),Ef:()=>1,Xc:this.S.bind(this)};let d=!1;const e=new _.H(_.G,3,4035,null);let f=null;try{const g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.a.debug(`Using base media decode time ${g} instead of `+
58
- `segment reference time ${a.request.startTime}`);f=QH(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)}},fI={video:_.Je,audio:_.dc,text:_.Yb},YH=_.Rt,XH="LIVE",gI={tg:"caption",ug:_.fu};_.A("clpp.smooth.SmoothComponent",class extends _.Ap{constructor(){super()}f(){_.zn.ism=wI;_.xn[_.Zb]=wI}a(){_.Ev("ism");_.Fv(_.Zb)}id(){return"smooth"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var QG="Full MP4 box must have flags defined",RG="clpp.smooth.SmoothMP4Processor",SG="codecPrivateData",TG=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.O(a,c);_.O(a,b)},UG=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.xj()}},VG=function(a,b){UG(a,b>>16&255);UG(a,b>>8&255);UG(a,b&255)},WG=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.xj()}},XG=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.xj()}},YG=function(a,b){try{a.f.setInt16(a.a,
2
+ b,a.g),a.a+=2}catch(c){_.xj()}},ZG=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},$G=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},aH=function(a,b,c,d){c=b.Ee[c];b=b.wg;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 _.xu([a],[b])[0]},bH=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.w?c=["maxWidth","maxHeight","bitrate",SG,"fourCC"]:a.type===_.p&&(c=["bitrate",SG,"channels","bitsPerSample","samplingRate","fourCC"]);return _.sf(a,b,c,["id","segmentIndex"])},cH=function(a,b,c){const d=c.Zc.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ma:null,Mb:null,width:NaN,height:NaN,Fb:null,Pc:NaN,
4
+ sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.Ma=[_.ah(d[1])];a.Mb=[_.ah(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.Fb=_.ah(c.Zc),a.sampleSize=c.sf||16,a.Pc=c.Pc,a.channelCount=c.xe}return a},dH=function(a,b){return a.filter(c=>c.type===b)},eH=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)},lH=function(a,b,c){var d=null;if(fH.test(a)){{a=fH.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 gH.test(a)?d=eH(gH,a):hH.test(a)?d=eH(hH,a):iH.test(a)?(a=iH.exec(a),d=Number(a[1])/c.frameRate):jH.test(a)?(a=jH.exec(a),d=Number(a[1])/c.a):kH.test(a)&&(d=eH(kH,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},mH=function(a){let b=
6
+ 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Sj(b)},tH=function(a,b,c){a:{var d=[_.Lc,_.Kc];for(e of d)if((d=c.dd(e))&&d.keyId){var e=d.keyId;break a}_.C(RG,"Could not get default Key ID for DRM init data!");e=null}c=new nH("xxxx");a.type===_.w?c=new oH(a.width,a.height):c=new pH(a.channelCount,a.sampleSize,a.Pc);a=new qH;a.g=1;a.h=8;a.m=e||"00000000000000000000000000000000";a=(new nH("schi")).append([a]);b=(new nH(_.je)).append([new rH(b),new sH(_.uc,65536),a]);c.append([b]);return c},
7
+ WH=function(a,b){var c=b.hd(),d=new uH(a.timescale,a.duration,a.id),e=(new vH).append([new wH(a.id)]),f=new xH(a.id,a.duration,a.timescale,a.width,a.height),g=new yH(a.timescale,a.duration);const h=new zH(a.type);var k=null,l=new AH;l.entries=[new BH];var m=new CH;switch(a.type){case _.w:k=new DH(a.Ma,a.Mb);c?(a=tH(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new EH(a.width,a.height)).append([k]),m.entries=[a]);k=new FH;break;case _.p:k=new GH(a.Fb),c?(a=tH(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
+ (a=(new HH(a.channelCount,a.sampleSize,a.Pc)).append([k]),m.entries=[a]),k=new IH}m=(new JH).append([m,new KH,new LH,new MH,new NH]);l=(new OH).append([l]);l=(new PH).append([k,l,m]);g=(new QH).append([g,h,l]);f=(new RH).append([f,g]);d=(new SH).append([d,f,e]);e=new TH("dash",0,["iso6","mp41","avc1"]);c&&(c=b.dd(_.Kc),b=b.dd(_.Lc),c&&d.append([new UH("pssh",c.initData,8)]),b&&d.append([new UH("pssh",b.initData,8)]),c||b||_.C(RG,"Could not get PSSH init data!"));b=new VH([e,d]);return _.K(b.write())},
9
+ fI=function(a,b){let c,d,e,f,g,h;(new _.Qj).L("moof",_.Jj).Z("mfhd",k=>{{const l=new XH;l.g=_.P(k.reader);c=l}}).L("traf",_.Jj).Z("tfhd",k=>{{const l=k.reader.Ba();if(null===k.flags)throw new _.H(_.G,3,3019,QG);const m=new YH(k.version||0,k.flags||0);m.g=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.Ej(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.j=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.P(k.reader));
10
+ 0<l-k.reader.getPosition()&&k.flags&32&&(m.m=_.P(k.reader));d=m}}).Z("trun",k=>{{var l=k.reader.Ba();if(null===k.flags)throw new _.H(_.G,3,3019,QG);const m=new ZH(k.version||0,k.flags||0);m.g=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.Dj(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.m=_.P(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.o.push(_.P(k.reader)),k.flags&512&&m.sampleSize.push(_.P(k.reader)),k.flags&1024&&m.A.push(_.P(k.reader)),k.flags&
11
+ 2048&&(0===k.version?m.h.push(_.P(k.reader)):m.h.push(_.Dj(k.reader)));e=m}}).Z("sdtp",k=>{{const l=_.Gj(k.reader,k.reader.Ba());f=new $H("sdtp",k.version||0,k.flags||0,l,0)}}).L("uuid",k=>{var l=_.Gj(k.reader,16);if(_.ch(l,aI)){l=_.P(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new bI(k.version,k.flags);l.h=_.P(k.reader);k.flags&1&&(l.j=_.Bj(k.reader));for(let m=0;m<l.h;m++){const n={Ie:_.Gj(k.reader,8),Ac:0,ge:[]};if(k.flags&2){n.Ac=_.Cj(k.reader);for(let q=0;q<n.Ac;q++){const t={ve:0,we:0};
12
+ t.ve=_.Cj(k.reader);t.we=_.P(k.reader);n.ge.push(t)}}l.g.push(n)}g=l}}).L(_.sd,k=>{{const l=new cI;0<k.reader.Ba()?l.g=_.Gj(k.reader,k.reader.Ba()):(_.C(RG,"mdat box is empty!"),l.g=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new dI).append([d,e]);f&&a.append([f]);b.hd()&&g&&a.append([g]);b=(new eI).append([c,a]);return new VH([b,h])},kI=function(a,b,c,d){var e=d.hd(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=fI(b,d);if(null===g)return a.request.contentType===_.u?a.data:
13
+ g;d=g.get(_.sd);if(a.request.contentType===_.u){e=d.g.buffer;if(c){e=_.Lg(e);if((e=(new DOMParser).parseFromString(e,_.we))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new gI(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",_.Zc];for(let x=0,A=g.length;x<
14
+ A;x++){b:{var k=h;var l=g[x],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[x],lH(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.Mg(e).buffer}else c=e;return c}h=new eI;a=g.get("mfhd");b=new dI;k=g.get("tfhd");m=new hI(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.h;m++)k.push(10+6*c.g[m].Ac);else g=8;b.append([c,new iI,new jI(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new VH([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},lI=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
16
+ periodId:null}},mI=function(a){return{initData:_.qu(_.vk(a)),initDataType:_.uc,keyId:a,periodId:null}},nI=function(a,b,c){a=_.$u(a);c&&a.version!==c&&(a=_.Xu(a,c));return{initData:_.qu(a),initDataType:_.uc,keyId:b,periodId:null}},oI=function(a,b){return _.y(function*(){var c=_.nh(b);c.timeout=a.g.attemptParameters.timeout;c.maxAttempts=Math.max(a.g.attemptParameters.maxAttempts,b.length);c.baseDelay=a.g.attemptParameters.baseDelay;c.backoffFactor=a.g.attemptParameters.backoffFactor;c.fuzzFactor=a.g.attemptParameters.fuzzFactor;
17
+ c.type=1;c=yield a.D.networkingEngine.fetch(c).P;a.m=c.uri;return c})},wI=function(a,b){let c=null;try{{const xa=new DOMParser;let hb,Ma;try{const bb=_.Lg(b);Ma=xa.parseFromString(bb.trim(),_.we)}catch(bb){throw bb;}Ma&&Ma.documentElement.tagName==_.jb&&(hb=Ma.documentElement);c=hb&&0<hb.getElementsByTagName("parsererror").length?null:hb}}catch(xa){}if(!c)throw a.a.error("Unable to parse manifest"),new _.H(_.G,4,4033,a.m);const d=+pI(a,c,"MajorVersion"),e=+pI(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
18
+ 1E7;let g=+pI(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.Pu(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.a.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.G,4,4036,a.m);h?(qI(a,rI),a.A=typeof a.g.liveRefreshPeriod===_.r?1E3*a.g.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):qI(a,sI);a.f={startTime:0,delay:0,duration:g/f,xd:l/f,Kc:0};if(m){{var n=a.g.playreadyVersion;
19
+ const xa=[],hb=_.Pu(m,"ProtectionHeader")[0],Ma=_.$g(_.Ru(hb)||""),bb=_.$u(Ma).a;xa.push(lI(_.Lc,mI(bb),[bb]));xa.push(lI(_.Kc,nI(Ma,bb,n),[bb]));var q=xa}a.o=q}{const xa=[],hb=_.Pu(c,"StreamIndex");if(!hb.length)throw a.a.error("No streams found!"),new _.H(_.G,4,4034,a.m);for(let Ma=0;Ma<hb.length;Ma++){{var t=a,v=hb[Ma];const bb=pI(t,v,"Type"),lc=+v.getAttribute("Chunks"),Vg=v.getAttribute("Subtype"),Rd=v.getAttribute("Language")||_.Ae,Sd=_.vg(Rd),Wg=v.getAttribute("Name")||"",Df=+v.getAttribute(_.La),
20
+ Ef=+v.getAttribute(_.Ka),Kk=pI(t,v,"Url"),GL=+v.getAttribute("TimeScale")||null;{const mc=[],ti=_.Pu(v,_.Ya);for(let Td=0;Td<ti.length;Td++){{let nc,Ia,ld;var x=t,A=ti[Td],D=bb;const ui=+A.getAttribute("Index"),Ff=+pI(x,A,"Bitrate");let Qb=NaN,Gf=NaN,Lk=NaN,Kp=NaN,zz=NaN,Az=NaN,Bz=NaN;const Cz=A.getAttribute("FourCC");switch(D){case _.w:Qb=+pI(x,A,_.Ka);Gf=+pI(x,A,_.La);break;case _.p:Kp=+A.getAttribute("Channels")||2,Lk=+pI(x,A,"SamplingRate"),Az=+pI(x,A,"AudioTag"),zz=+pI(x,A,"BitsPerSample"),Bz=
21
+ +pI(x,A,"PacketSize")}let Lp=String(A.getAttribute("CodecPrivateData"));if(D===_.p&&!Lp){{var E=Kp;const Dz={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},Mk=Dz[Lk];if("AACH"===Cz){Ia=new Uint8Array(4);const Ez=Dz[2*Lk];Ia[0]=40|Mk>>1;Ia[1]=Mk<<7|E<<3|Ez>>1;Ia[2]=Ez<<7|8;Ia[3]=0;nc=new Uint16Array(2);nc[0]=(Ia[0]<<8)+Ia[1];nc[1]=(Ia[2]<<8)+Ia[3];ld=nc[0].toString(16)+nc[1].toString(16)}else Ia=new Uint8Array(2),Ia[0]=16|Mk>>1,Ia[1]=Mk<<7|E<<3,nc=
22
+ new Uint16Array(1),nc[0]=(Ia[0]<<8)+Ia[1],ld=nc[0].toString(16);Lp=ld.toUpperCase()}}var I={id:x.W++,type:D,index:ui,bitrate:Ff,Zc:Lp,maxHeight:Qb,maxWidth:Gf,Pc:Lk,xe:Kp,Fg:Az,sf:zz,Qg:Bz,If:Cz,segmentIndex:null}}mc.push(I)}var na=mc}{const mc=[],ti=_.Pu(v,"c");for(let Td=0;Td<ti.length;Td++){const nc=ti[Td];let Ia=parseInt(nc.getAttribute("t"),10),ld=parseInt(nc.getAttribute("d"),10),ui=parseInt(nc.getAttribute("r"),10),Ff=0;if(isNaN(Ia)&&isNaN(ld))throw t.a.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
23
+ new _.H(_.G,4,4037,t.m);0===Td&&isNaN(Ia)&&(Ff=Ia=0);if(0<Td){const Qb=mc[mc.length-1];Ff=Qb.n+1;Qb.d||(Qb.d=Ia-Qb.t);Ia||(Ia=Qb.t+Qb.d);ld||(ld=Ia-Qb.t)}mc.push({n:Ff,d:ld,t:Ia});if(ui){ui--;for(let Qb=0;Qb<ui;Qb++){const Gf=mc[mc.length-1];Ff=Gf.n+1;Ia=Gf.t+Gf.d;ld=Gf.d;mc.push({n:Ff,d:ld,t:Ia})}}}t.C()||mc.length===lc||t.a.warn("Number of fragments ("+lc+") differs from number of chunks ("+mc.length+").");var hc=mc}var jd={type:bb,Ig:lc,qg:Vg,language:Sd,Jc:Rd,name:Wg,maxWidth:Df,maxHeight:Ef,
24
+ wg:Kk,tracks:na,Ee:hc,timescale:GL}}xa.push(jd)}var Ob=xa}const Ta={Pg:d,Le:e,timescale:f,duration:g,isLive:h,Og:k,xd:l,Jd:!1,streams:Ob};if(a.h&&a.w)return tI(a,Ta),Promise.resolve();a.G.clear();{const xa=Ta.timescale,hb=Ta.duration,Ma=dH(Ta.streams,_.p),bb=dH(Ta.streams,_.w),lc=dH(Ta.streams,_.u),Vg=[];let Rd=uI(a,hb,xa,Ma),Sd=uI(a,hb,xa,bb);const Wg=uI(a,hb,xa,lc);Rd.length||(Rd=[null]);Sd.length||(Sd=[null]);for(let Df=0;Df<Sd.length;Df++)for(let Ef=0;Ef<Rd.length;Ef++)Vg.push(vI(a,Sd[Df],Rd[Ef]));
25
+ var sb={startTime:0,variants:Vg,textStreams:Wg,thumbStreams:[]}}{var ic=Ta.streams;let xa=a.f.startTime,hb=a.f.delay;const Ma=a.I;let bb=Math.min(a.f.duration||Infinity,Ma);const lc=a.C(),Vg=a.f.xd,Rd=a.f.Kc,Sd=a.H,Wg=isFinite(a.F)?a.F:0;if(lc)bb=Infinity,xa=Date.now()/1E3-Rd,a.f.startTime=xa,hb=3*Sd;else{const Df=isFinite(Ma)?Ma:a.f.duration;for(const Ef of ic)for(const Kk of Ef.tracks)Kk.segmentIndex.offset(-Wg),_.iv(Kk.segmentIndex,Df)}a.B=new _.Zz(xa,hb,!lc,!0);a.B.f=bb;_.rv(a.B,Sd);a.B.j=Vg;
26
+ lc||a.B.offset(-Wg)}a.D.filterAllPeriods([sb]);a.h={presentationTimeline:a.B,periods:[sb],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.Uc(a.M),a.K=!0);a.w=Ta;return Promise.resolve()},xI=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.yb.bind(a),b))},pI=function(a,b,c){if(b=b.getAttribute(c))return b;a.a.error("required attribute not provided: "+c);throw new _.H(_.G,4,4038,a.m,c);},qI=function(a,b){const c=b===sI;a.h&&a.h.presentationTimeline&&_.nv(a.h.presentationTimeline,
27
+ c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.R=b},tI=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){bH(g,c)||a.a.warn("The current stream is updated with a stream that seems to have different base properties!");var d=yI(a,a.w.timescale,f,c);c=g.segmentIndex;_.Bv(c,d);(d=a.f.xd)&&_.Cv(c,_.zv(c)-d).forEach(h=>{h.Ia().forEach(k=>{a.G.delete(k)})})}else a.a.warn(`Cannot find satisfying update for ${g.type} `+
28
+ `track with bitrate ${g.bitrate}. Skipping update.`)}}},yI=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.Ee.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=aH(a.m,c,k,d);a.H=Math.max(a.H,l);f.push(new _.Av(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.f.Kc?a.f.Kc=b.endTime:a.f.Kc=Math.min(a.f.Kc,b.endTime);return f},uI=function(a,b,c,d){let e=[];for(let f=0;f<
29
+ d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=yI(a,c,k,h);const I=new _.$z(l);var m=null;k.type!==_.u&&(m=zI(a,b,c,k,h));h.segmentIndex=I;l=a.N++;var n=Promise.resolve.bind(Promise),q=I.f.bind(I),t=I.get.bind(I),v=I.g.bind(I),x=I.getDuration.bind(I),A=AI[k.type];var D="";switch(k.type){case _.w:D=h.Zc;var E=/00000001[0-9]7/.exec(D);D="avc1."+(E&&E[0]?D.substr(D.indexOf(E[0])+10,6):"42c00c");a.a.debug("VIDEO CODECS: ",D);break;case _.p:D=h.Zc,E=2,"AACH"===h.If?E=5:D&&(E=(parseInt(D.substr(0,
30
+ 2),16)&248)>>3),D="mp4a.40."+E,a.a.debug("AUDIO CODECS: ",D)}E=k.type===_.u?BI[k.qg]:void 0;h={id:l,originalId:null,Sg:null,createSegmentIndex:n,findSegmentPosition:q,getSegmentReference:t,adjustSegmentDurations:v,getDuration:x,segmentIndex:I,segmentLookupStrategy:_.du,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,language:k.language,originalLanguage:k.Jc,label:k.name,type:k.type,
31
+ primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.xe||null,closedCaptions:null}}return h});e=e.concat(g)}return e},vI=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.Ae;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},zI=function(a,b,c,d,e){b=cH(b,d.timescale||c,e);c={isLive:a.C.bind(a),hd:a.J.bind(a),Nf:()=>1,dd:a.T.bind(a)};d=new Uint8Array(0);try{d=WH(b,
32
+ c)}catch(g){throw a.a.error("Failed to generate initialization segment."),new _.H(_.G,3,4035,g);}const f="data:text/plain;base64,"+_.Zg(d);return new _.Wz(()=>[f],0,null,null,!0)},nH=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!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===a)return this.f[b];{const c=this.f[b].get(a);
33
+ 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);_.yj(a,ZG(this.type));this.size>b&&TG(a,this.size);"uuid"===this.type&&_.yj(a,null);if(0<this.f.length&&!this.w)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()}},
34
+ CI=class extends nH{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);UG(a,this.version);VG(a,this.flags)}},UH=class extends nH{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);_.yj(a,this.g,this.offset);a.getPosition()}},$H=class extends CI{constructor(a,b,c,d,e){super(a,b,c);this.g=d;this.offset=e}a(){return this.g.byteLength+super.a()-this.offset}write(a){super.write(a);
35
+ _.yj(a,this.g,this.offset);a.getPosition()}},TH=class extends nH{constructor(a,b,c){super("ftyp");this.h=a;this.Le=b;this.g=c}a(){let a=this.h.length;a=a+4+this.g.join("").length;return a+super.a()}write(a){super.write(a);_.yj(a,ZG(this.h));_.O(a,this.Le);_.yj(a,ZG(this.g.join("")));a.getPosition()}},SH=class extends nH{constructor(){super(_.yd)}},RH=class extends nH{constructor(){super(_.ye)}},uH=class extends CI{constructor(a,b,c){super("mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;
36
+ this.h=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?(TG(a,0),TG(a,0),_.O(a,this.timescale),TG(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.timescale),_.O(a,this.duration*this.timescale));_.O(a,65536);WG(a,this.volume);WG(a,0);_.O(a,0);_.O(a,0);for(let b=0;b<this.g.length;b++)UG(a,this.g[b]);_.O(a,0);_.O(a,0);_.O(a,0);
37
+ _.O(a,0);_.O(a,0);_.O(a,0);_.O(a,this.h);a.getPosition()}},vH=class extends nH{constructor(){super("mvex")}},wH=class extends CI{constructor(a){super("trex",0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.O(a,this.g);_.O(a,1);_.O(a,0);_.O(a,0);_.O(a,0);a.getPosition()}},xH=class extends CI{constructor(a,b,c,d,e){super("tkhd",1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.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,
38
+ 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?(TG(a,0),TG(a,0),_.O(a,this.h),_.O(a,0),TG(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.h),_.O(a,0),_.O(a,this.duration*this.timescale));_.O(a,0);_.O(a,0);WG(a,0);WG(a,0);WG(a,this.volume);WG(a,0);for(let b=0;b<this.g.length;b++)UG(a,this.g[b]);WG(a,this.width);WG(a,0);WG(a,this.height);WG(a,0);a.getPosition()}},yH=class extends CI{constructor(a,b){super("mdhd",
39
+ 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?(TG(a,0),TG(a,0),_.O(a,this.timescale),TG(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.timescale),_.O(a,this.duration*this.timescale));WG(a,this.language);WG(a,0);a.getPosition()}},zH=class extends CI{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.O(a,0);this.g===_.w?_.yj(a,ZG("vide")):
40
+ _.yj(a,ZG("soun"));_.O(a,0);_.O(a,0);_.O(a,0);this.g===_.w?_.yj(a,ZG("VideoHandler\x00")):_.yj(a,ZG("SoundHandler\x00"));a.getPosition()}},FH=class extends CI{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);WG(a,0);_.yj(a,this.g);a.getPosition()}},DI=class extends nH{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.O(a,0);WG(a,0);WG(a,1)}},EI=class extends DI{constructor(a){super(a);
41
+ this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);WG(a,0);WG(a,0);_.O(a,0);_.O(a,0);_.O(a,0);WG(a,this.width);WG(a,this.height);_.O(a,4718592);_.O(a,4718592);_.O(a,0);WG(a,1);UG(a,10);_.yj(a,ZG("AVC Coding",31));WG(a,this.depth);YG(a,-1)}},FI=class extends DI{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);WG(a,this.channelCount);WG(a,this.sampleSize);YG(a,0);
42
+ WG(a,0);WG(a,this.sampleRate);WG(a,0)}},EH=class extends EI{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()}},oH=class extends EH{constructor(a,b){super(a,b);this.type="encv"}},HH=class extends FI{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()}},pH=class extends HH{constructor(a,b,c){super(a,b,c);this.type="enca"}},
43
+ DH=class extends nH{constructor(a,b){super("avcC");this.Ma=a;this.Mb=b;this.version=1;this.g=this.Ma[0][1];this.h=this.Ma[0][2];this.level=this.Ma[0][3]}a(){let a=7;for(var b=0;b<this.Ma.length;b++)a+=2,a+=this.Ma[b].byteLength;for(b=0;b<this.Ma.length;b++)a+=2,a+=this.Mb[b].byteLength;return a+super.a()}write(a){super.write(a);UG(a,this.version);UG(a,this.g);UG(a,this.h);UG(a,this.level);UG(a,255);UG(a,224|this.Ma.length);for(var b=0;b<this.Ma.length;b++)WG(a,this.Ma[b].length),_.yj(a,this.Ma[b]);
44
+ UG(a,this.Mb.length);for(b=0;b<this.Mb.length;b++)WG(a,this.Mb[b].length),_.yj(a,this.Mb[b]);a.getPosition()}},GH=class extends CI{constructor(a){super("esds",0,0);this.Fb=a}a(){return 22+(this.Fb.byteLength+3)+super.a()}write(a){super.write(a);UG(a,3);UG(a,23+this.Fb.byteLength);WG(a,1);UG(a,0);UG(a,4);UG(a,15+this.Fb.byteLength);UG(a,64);UG(a,21);VG(a,0);_.O(a,0);_.O(a,0);UG(a,5);UG(a,this.Fb.byteLength);_.yj(a,this.Fb);_.yj(a,new Uint8Array([6,1,2]));a.getPosition()}},BH=class extends CI{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&&_.yj(a,ZG(this.location));a.getPosition()}},AH=class extends CI{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()}},JH=class extends nH{constructor(){super(_.oe)}},CH=class extends CI{constructor(){super(_.qe,
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()}},KH=class extends CI{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
+ LH=class extends CI{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()}},NH=class extends CI{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()}},MH=class extends CI{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.O(a,0);_.O(a,0);a.getPosition()}},IH=class extends CI{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);YG(a,0);WG(a,0);a.getPosition()}},OH=class extends nH{constructor(){super("dinf")}},PH=class extends nH{constructor(){super(_.xd)}},QH=class extends nH{constructor(){super(_.td)}},hI=class extends CI{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?TG(a,this.g):_.O(a,this.g);a.getPosition()}},XH=class extends CI{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.O(a,this.g);a.getPosition()}},ZH=class extends CI{constructor(a,b){super("trun",a,b);this.m=this.j=this.g=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&GI&&(a+=4);this.flags&HI&&(a+=4);for(let b=0;b<this.g;b++)this.flags&II&&(a+=
50
+ 4),this.flags&JI&&(a+=4),this.flags&KI&&(a+=4),this.flags&LI&&(a+=4);return a+super.a()}write(a){super.write(a);_.O(a,this.g);this.flags&GI&&(a.getPosition(),XG(a,this.j));this.flags&HI&&_.O(a,this.m);for(let b=0;b<this.g;b++)this.flags&II&&_.O(a,this.o[b]),this.flags&JI&&_.O(a,this.sampleSize[b]),this.flags&KI&&_.O(a,this.A[b]),this.flags&LI&&(0===this.version?_.O(a,this.h[b]):XG(a,this.h[b]));a.getPosition()}},GI=1,HI=4,II=256,JI=512,KI=1024,LI=2048,YH=class extends CI{constructor(a,b){super("tfhd",
51
+ a,b);this.g=255;this.m=this.o=this.j=this.A=this.h=0}a(){let a=4;this.flags&MI&&(a+=8);this.flags&NI&&(a+=4);this.flags&OI&&(a+=4);this.flags&PI&&(a+=4);this.flags&QI&&(a+=4);return a+super.a()}write(a){super.write(a);_.O(a,this.g);this.flags&MI&&TG(a,this.h);this.flags&NI&&_.O(a,this.A);this.flags&OI&&_.O(a,this.j);this.flags&PI&&_.O(a,this.o);this.flags&QI&&_.O(a,this.m);a.getPosition()}},MI=1,NI=2,OI=8,PI=16,QI=32,dI=class extends nH{constructor(){super("traf")}},eI=class extends nH{constructor(){super("moof")}},
52
+ cI=class extends nH{constructor(){super(_.sd);this.g=new Uint8Array(0)}a(){return this.g.byteLength+super.a()}write(a){super.write(a);0<this.g.byteLength&&_.yj(a,this.g)}},qH=class extends CI{constructor(){super("tenc",0,0);this.g=1;this.h=8;this.m="";this.j=[]}a(){let a;a=20;1===this.g&&0===this.h&&(a=a+1+this.j.length);return a+super.a()}write(a){super.write(a);UG(a,0);0===this.version?UG(a,0):UG(a,0);UG(a,this.g);UG(a,this.h);_.yj(a,_.ah(this.m));if(1===this.g&&0===this.h){UG(a,0);for(let b=0;b<
53
+ this.j.length;b++)UG(a,this.j[b])}a.getPosition()}},sH=class extends CI{constructor(a,b){super("schm",0,0);this.g=a;this.h=b;this.Ab=""}a(){let a=8;this.flags&1&&(a+=ZG(this.Ab).byteLength);return a+super.a()}write(a){super.write(a);_.yj(a,ZG(this.g));_.O(a,this.h);this.flags&1&&_.yj(a,ZG(this.Ab));a.getPosition()}},rH=class extends nH{constructor(a){super("frma");this.g=a}a(){return ZG(this.g).byteLength+super.a()}write(a){super.write(a);_.yj(a,ZG(this.g));a.getPosition()}},iI=class extends CI{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&&(_.O(a,0),_.O(a,0));_.O(a,1);for(let b=0;1>b;b++)0===this.version?_.O(a,this.offset[b]):TG(a,this.offset[b]);a.getPosition()}},jI=class extends CI{constructor(a,b,c){super("saiz",0,0);this.g=a;this.j=b;this.h=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.g&&(a+=this.j.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.O(a,
55
+ 0),_.O(a,0));UG(a,this.g);_.O(a,this.h);if(0===this.g)for(let b=0;b<this.h;b++)UG(a,this.j[b]);a.getPosition()}},bI=class extends CI{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.g=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.g[b].Ie.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].Ac;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.O(a,this.h);this.flags&1&&UG(a,this.j);for(let b=0;b<this.h;b++)if(_.yj(a,this.g[b].Ie),this.flags&2){WG(a,this.g[b].Ac);
56
+ for(let c=0;c<this.g[b].Ac;c++)WG(a,this.g[b].ge[c].ve),_.O(a,this.g[b].ge[c].we)}a.getPosition()}};var gI=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))}},fH=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,gH=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,hH=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,iH=/^(\d*\.?\d*)f$/,jH=/^(\d*\.?\d*)t$/,kH=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var VH=class{constructor(a){this.a=a;this.f=mH(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=mH(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var aI=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var RI=class{constructor(){this.w=this.h=this.g=this.D=null;this.N=1;this.W=0;this.m="";this.B=this.f=null;this.a=new _.Q("clpp.smooth.SmoothParser");this.K=!1;this.j=this.A=null;this.R=sI;this.H=0;this.F=this.I=Infinity;this.o=[];this.M=this.V.bind(this);this.G=new Map}configure(a){this.g=a}start(a,b){this.D=b;a=[...new Set([a,$G(a)])];return oI(this,a).then(c=>wI(this,c.data).then(()=>{xI(this,this.A);return this.h}))}stop(){this.D&&this.D.networkingEngine.md(this.M);this.A=this.w=this.h=this.g=
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 oI(this,[this.m]).then(a=>wI(this,a.data).then(()=>this.h)).catch(a=>{if(this.D)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}yb(){this.a.debug(_.Wt);this.D&&(this.j=null,this.update().then(()=>{xI(this,this.A)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&xI(this,100))}))}C(){return this.R===rI}J(){return 0<this.o.length}T(a){let b=
58
+ null;if(this.o.length)for(let c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b}V(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.w.timescale,c={isLive:this.C.bind(this),hd:this.J.bind(this),Nf:()=>1,dd:this.T.bind(this)};let d=!1;const e=new _.H(_.G,3,4035,null);let f=null;try{const g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.a.debug(`Using base media decode time ${g} instead of `+
59
+ `segment reference time ${a.request.startTime}`);f=kI(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)}},AI={video:_.Ke,audio:_.dc,text:_.Yb},sI=_.Xt,rI="LIVE",BI={Bg:"caption",Cg:_.lu};_.z("clpp.smooth.SmoothComponent",class extends _.Fp{constructor(){super()}f(){_.Fn.ism=RI;_.Dn[_.Zb]=RI}a(){_.Hv("ism");_.Iv(_.Zb)}id(){return"smooth"}});};f.call(g, window);
package/cl.thumbnails.js CHANGED
@@ -1,17 +1,17 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var zs="No thumbnail duration or URL specified",As="No thumbnail found for position ",Bs="Position is out of range: ",Cs="Thumbnail URL is mandatory",Ds="Wrong gridSize format",Es="clpp.thumbnails",Gs=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Bd&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Fs(a,0,e,!!f))},Promise.resolve())},Fs=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Hs(a,d).then(()=>a.a[b].load()).then(()=>Fs(a,e,
2
- c,d))},Hs=function(a,b){return new Promise(c=>{if(b||a.g.getState()!==_.zl)c();else a.g.one(_.ic,()=>{c()})})},Is=function(a){const b=a.f.byteLength;a.a.forEach(c=>{c.offset+c.length<b&&c.Ae.resolve()})},Ls=function(a,b){return Js(a,b).then(c=>new Ks(c,b.time,b.duration))},Js=function(a,b){return b.load().then(()=>{const c=_.I(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.Sg(c)})},Ms=function(a){a=a.split(/\.|:/).map(parseFloat);let b=0,c;const d={3:.001,2:1,1:60,0:3600};for(c=a.length-
3
- 1;0<=c;c--)b+=a[c]*d[c];return b},Ns=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},Os=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Ec:c,fe:d,xe:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Ps=function(a){return a.some(b=>0<b.thumbStreams.length)},Qs=function(a){if(!a)return null;a=new _.Jj(a);return a.path.match(/.*\.vtt$/i)?"WEBVTT":a.path.match(/.*\.bif$/i)?"BIF":
4
- a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null};var Rs=class{constructor(){this.log=new _.P(Es);this.g=null;this.a=[];this.w=!1}init(a,b){this.g=a;a.one(_.Zd,()=>{this.w=!0});a.isLive()||this.m().then(()=>{b&&b.preload&&Gs(this,b.preload)})}};var Ks=class{constructor(a,b,c,d=0,e=0,f=0,g=0,h=1,k=1,l=0,m=0,n=new Image){this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.ka=n;this.pf=h;this.eg=k;this.If=l;this.Jf=m;this.ra=null}raw(){return this.ka.cloneNode(!1)}element(a,b){let c=this.width,d=this.height;const e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));a=document.createElement(_.Qc);a.style.width=
5
- c+_.Wd;a.style.height=d+_.Wd;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.ka.naturalWidth||this.ka.width))}px ${Math.ceil(d/this.height*(this.ka.naturalHeight||this.ka.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*c+_.Wd;a.style.backgroundPositionY="-"+b*d+_.Wd;return a}load(){this.ra||(this.ra=new Promise((a,b)=>{const c=()=>{this.width||
6
- (this.width=(this.ka.naturalWidth||this.ka.width)/this.pf);this.height||(this.height=(this.ka.naturalHeight||this.ka.height)/this.eg);this.x||(this.x=this.width*this.If);this.y||(this.y=this.height*this.Jf)};if(this.ka.src&&this.ka.complete)c(),a(this);else{var d=null,e=()=>{c();this.ka.removeEventListener("load",e);this.ka.removeEventListener(_.$c,d);a(this)};d=()=>{this.ka.removeEventListener("load",e);this.ka.removeEventListener(_.$c,d);b()};this.ka.addEventListener("load",e);this.ka.addEventListener(_.$c,
7
- d);this.ka.src=this.src}}));return this.ra}};_.A("clpp.thumbnails.Thumbnail",Ks);Ks.prototype.load=Ks.prototype.load;Ks.prototype.element=Ks.prototype.element;Ks.prototype.raw=Ks.prototype.raw;var Ss=class extends Rs{constructor(){super();this.f=null;this.o=this.h=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Cs);if("GRID"===b.mode&&!b.gridSize)throw new _.H(_.G,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.H(_.G,7,7100,"Duration is mandatory");this.f=b;const c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(zs,c,d),new _.H(_.G,7,7100,zs);this.j=c;if(this.f.gridSize)try{const e=this.f.gridSize.split(/x/).map(f=>parseInt(f,10)).filter(f=>
8
- 0<f);if(2===e.length)this.h=e[0],this.o=e[1];else throw new _.H(_.G,7,7100,Ds);}catch(e){throw this.log.error("Error during parsing gridSize",e),new _.H(_.G,7,7100,Ds);}super.init(a,b)}get(a){const b=this.g.getDuration();if(void 0===this.f.duration)return Promise.reject("Duration configuration not defined");const c=Math.floor(a/this.f.duration);if(0>a||a>b)return Promise.reject(Bs+a);const d=this.a[c];return d?d.load().then(()=>d):Promise.reject(As+a+" at index "+c)}m(){if(0<this.a.length)return Promise.resolve();
9
- var a=this.g.getDuration();const b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);const c=this.f.templateKey||"$index$";for(let d=0;d<a;d++){const e=this.f.url.replace(c,String(d+1)),f=new Image;for(let g=0;g<b;g++)this.a.push(new Ks(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f))}return Promise.resolve()}};var Ts=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Ae=new _.Mk}load(){return this.Ae}},Vs=class{constructor(){this.g=new _.P(Es);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Mk}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Cs);const c=b.url;b=_.jh(c);b.type=_.ih;a.getNetworkEngine().fetch(b).P.then(d=>{{var e=d.data;d=_.I(this.f);e=_.I(e);const f=d.byteLength+e.byteLength,g=new ArrayBuffer(f),h=new DataView(g);let k=0;for(let l=0,m=d.byteLength;l<m;l++)h.setUint8(k,
10
- d[l]),k+=1;for(let l=0,m=e.byteLength;l<m;l++)h.setUint8(k,e[l]),k+=1;this.f=g;this.g.info(`Appended ${e.byteLength} bytes.`+`Total data now ${f} bytes.`)}}).then(()=>{{var d=this.f,e=_.I(d),f=String.fromCharCode.apply(null,Us),g=Array.prototype.slice.call(e,0,8);e=64;let k=0;var h=!1;if(f===String.fromCharCode.apply(null,g))for(d=new DataView(d,16,20),d=d.getUint32(0,!0),0===d&&(d=1E3);!h;){k+=1;g=d;f=new DataView(this.f,e);h=f.getUint32(0,!0);g=h*g/1E3;f=f.getUint32(4,!0);f=new Ts(g,f);if(g=this.a.length)g=
11
- this.a[g-1],g.length=f.offset-g.offset,g.duration=f.time-g.time;this.a.push(f);e+=8;(h=4294967295===h)&&this.h.resolve();if(1E5<k)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");}}).then(()=>{Is(this)}).catch(d=>{this.g.error(`[BIF] Error while loading thumbnails '
12
- + 'URL: ${c}`,d);a.onError(new _.H(1,7,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){return 0>a?Promise.reject(Bs+a):this.h.then(()=>{for(let b=0;b<this.a.length;b++){const c=this.a[b];if(a>=c.time&&a<c.time+c.duration)return Ls(this,c).then(d=>d.load().then(()=>d))}return Promise.reject(As+a)})}},Us=[137,66,73,70,13,10,26,10];var Ws=class extends Rs{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Cs);const c=b.url,d=_.jh(c);d.type=_.ih;this.f=a.getNetworkEngine().fetch(d).P.then(e=>{if(e=e.data){e=_.Eg(e).split(/\n/);for(let m=0;m<e.length;m++){var f=e[m],g=f.split(" --\x3e ");if(2===g.length){f=e[++m];var h=f.indexOf("\x3d");var k=h=0>h?[]:f.substr(h+1).split(/,/).map(parseFloat);h=k[0];const n=k[1],q=k[2];k=k[3];var l=f.indexOf("#");f=0>l?f:f.substr(0,l);f.match(/^http|^\/\//)||(f=
13
- c.substr(0,c.lastIndexOf("/"))+"/"+f);l=Ms(g[0]);g=Ms(g[1])-l;this.a.push(new Ks(f,l,g,h,n,q,k,0,0))}}}}).catch(e=>{this.log.error("[VTT] Error while loading thumbnails "+`URL: ${c}`,e);a.onError(new _.H(1,7,2013,"Error while loading VTT thumbnails.",e))});super.init(a,b)}get(a){return 0>a?Promise.reject(Bs+a):this.f.then(()=>{for(let b=0;b<this.a.length;b++){const c=this.a[b];if(a>=c.time&&a<c.time+c.duration)return c.load().then(()=>c)}return Promise.reject(As+a)})}m(){return this.f}};var Xs=class extends Rs{get(a){if(0>a)return this.log.error("Position must be greater than 0 but is "+a),Promise.reject();var b=this.g.getPeriods();b=Ns(b,a);if(!b)return this.log.error("Could not find period for specified position",a),Promise.reject();var c=b.thumbStreams.sort(this.f)[0];if(!c)return this.log.error("Could not find thumb stream for specified position",a),Promise.reject();b=c.findSegmentPosition(a-b.startTime);if(null===b||void 0===b)return this.log.error("Could not find segment index for specified position",
14
- a),Promise.reject();var d=c.getSegmentReference(b);if(d){const e=Os(d,c);a=Math.floor((a-d.startTime)/e.durationPerTile);let f;if(0<this.a.length)d=c.findSegmentPosition(0),null!==d&&(f=this.a[(b-d)*e.xe+a]);else if((c=d.Fa())&&0<c.length){let g=0,h=0;d=d.startTime;1<e.xe&&(g=a%e.Ec,h=Math.floor(a/e.Ec),d+=a*e.durationPerTile);f=new Ks(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ec,e.fe,g,h)}if(f)return f.load().then(()=>f)}this.log.error("segment reference for specified segment index does not exist",
15
- b);return Promise.reject()}f(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0}m(){if(0<this.a.length)return Promise.resolve();var a=this.g.getPeriods();for(const b of a)if(a=b.thumbStreams.sort(this.f)[0]){let c=a.findSegmentPosition(0),d;for(;null!==c&&!_.B(d=a.getSegmentReference(c++));){const e=Os(d,a),f=d.Fa()[0],g=new Image;let h=d.startTime;for(let k=0;k<e.fe;++k)for(let l=0;l<e.Ec;++l)this.a.push(new Ks(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ec,
16
- e.fe,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var Ys=class{constructor(){this.f=new _.P(Es);this.a=this.l=null}onPlayerCreated(a){this.l=a}onPlayerWillDestroy(){this.l=null}onPlayerWillRelease(){this.a=null}onContentWillLoad(a){var b=a.getConfiguration();if(b.thumbnails){var c=b.thumbnails;c&&(void 0===c.enabled||c.enabled)&&((b=c.mode)||(b=Qs(c.url||null)),b&&("SINGLE"===b||"GRID"===b?this.a=new Ss:"WEBVTT"===b?this.a=new Ws:"BIF"===b&&(this.a=new Vs)),this.a&&(this.f.info("Loading thumbs configuration",c),this.l.one(_.od,()=>{this.f.info("Initialize thumbnails provider");
17
- this.a.init(a,c)})))}else this.a=null}onContentLoaded(a){if(!this.a){var b=a.getConfiguration();b=b&&b.thumbnails;if(!b||void 0===b.enabled||b.enabled){var c=a.getPeriods();Ps(c)&&(this.a=new Xs,this.a.init(a,b))}}}get(a){return this.a?this.a.get(a):Promise.reject()}id(){return"thumbnails"}};_.A("clpp.thumbnails.ThumbnailsPlugin",Ys);Ys.prototype.get=Ys.prototype.get;Ys.Id="thumbnails";_.Hm(new class{create(){return new Ys}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Es="No thumbnail duration or URL specified",Fs="No thumbnail found for position ",Gs="Position is out of range: ",Hs="Thumbnail URL is mandatory",Is="Wrong gridSize format",Js="clpp.thumbnails",Ls=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Dd&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Ks(a,0,e,!!f))},Promise.resolve())},Ks=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Ms(a,d).then(()=>a.a[b].load()).then(()=>Ks(a,e,
2
+ c,d))},Ms=function(a,b){return new Promise(c=>{if(b||a.g.getState()!==_.Fl)c();else a.g.one(_.kc,()=>{c()})})},Ns=function(a){const b=a.f.byteLength;a.a.forEach(c=>{c.offset+c.length<b&&c.Ke.resolve()})},Qs=function(a,b){return Os(a,b).then(c=>new Ps(c,b.time,b.duration))},Os=function(a,b){return b.load().then(()=>{const c=_.K(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.Yg(c)})},Rs=function(a){a=a.split(/\.|:/).map(parseFloat);let b=0,c;const d={3:.001,2:1,1:60,0:3600};for(c=a.length-
3
+ 1;0<=c;c--)b+=a[c]*d[c];return b},Ss=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},Ts=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Hc:c,oe:d,He:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Us=function(a){return a.some(b=>0<b.thumbStreams.length)},Vs=function(a){if(!a)return null;a=new _.Oj(a);return a.path.match(/.*\.vtt$/i)?"WEBVTT":a.path.match(/.*\.bif$/i)?"BIF":
4
+ a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null};var Ws=class{constructor(){this.log=new _.Q(Js);this.g=null;this.a=[];this.w=!1}init(a,b){this.g=a;a.one(_.be,()=>{this.w=!0});a.isLive()||this.m().then(()=>{b&&b.preload&&Ls(this,b.preload)})}};var Ps=class{constructor(a,b,c,d=0,e=0,f=0,g=0,h=1,k=1,l=0,m=0,n=new Image){this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.ka=n;this.yf=h;this.lg=k;this.Rf=l;this.Sf=m;this.ra=null}raw(){return this.ka.cloneNode(!1)}element(a,b){let c=this.width,d=this.height;const e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));a=document.createElement(_.Rc);a.style.width=
5
+ c+_.Zd;a.style.height=d+_.Zd;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.ka.naturalWidth||this.ka.width))}px ${Math.ceil(d/this.height*(this.ka.naturalHeight||this.ka.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*c+_.Zd;a.style.backgroundPositionY="-"+b*d+_.Zd;return a}load(){this.ra||(this.ra=new Promise((a,b)=>{const c=()=>{this.width||
6
+ (this.width=(this.ka.naturalWidth||this.ka.width)/this.yf);this.height||(this.height=(this.ka.naturalHeight||this.ka.height)/this.lg);this.x||(this.x=this.width*this.Rf);this.y||(this.y=this.height*this.Sf)};if(this.ka.src&&this.ka.complete)c(),a(this);else{var d=null,e=()=>{c();this.ka.removeEventListener("load",e);this.ka.removeEventListener(_.ad,d);a(this)};d=()=>{this.ka.removeEventListener("load",e);this.ka.removeEventListener(_.ad,d);b()};this.ka.addEventListener("load",e);this.ka.addEventListener(_.ad,
7
+ d);this.ka.src=this.src}}));return this.ra}};_.z("clpp.thumbnails.Thumbnail",Ps);Ps.prototype.load=Ps.prototype.load;Ps.prototype.element=Ps.prototype.element;Ps.prototype.raw=Ps.prototype.raw;var Xs=class extends Ws{constructor(){super();this.f=null;this.o=this.h=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Hs);if("GRID"===b.mode&&!b.gridSize)throw new _.H(_.G,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.H(_.G,7,7100,"Duration is mandatory");this.f=b;const c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(Es,c,d),new _.H(_.G,7,7100,Es);this.j=c;if(this.f.gridSize)try{const e=this.f.gridSize.split(/x/).map(f=>parseInt(f,10)).filter(f=>
8
+ 0<f);if(2===e.length)this.h=e[0],this.o=e[1];else throw new _.H(_.G,7,7100,Is);}catch(e){throw this.log.error("Error during parsing gridSize",e),new _.H(_.G,7,7100,Is);}super.init(a,b)}get(a){const b=this.g.getDuration();if(void 0===this.f.duration)return Promise.reject("Duration configuration not defined");const c=Math.floor(a/this.f.duration);if(0>a||a>b)return Promise.reject(Gs+a);const d=this.a[c];return d?d.load().then(()=>d):Promise.reject(Fs+a+" at index "+c)}m(){if(0<this.a.length)return Promise.resolve();
9
+ var a=this.g.getDuration();const b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);const c=this.f.templateKey||"$index$";for(let d=0;d<a;d++){const e=this.f.url.replace(c,String(d+1)),f=new Image;for(let g=0;g<b;g++)this.a.push(new Ps(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f))}return Promise.resolve()}};var Ys=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Ke=new _.Sk}load(){return this.Ke}},$s=class{constructor(){this.g=new _.Q(Js);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Sk}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Hs);const c=b.url;b=_.nh(c);b.type=_.mh;a.getNetworkEngine().fetch(b).P.then(d=>{{var e=d.data;d=_.K(this.f);e=_.K(e);const f=d.byteLength+e.byteLength,g=new ArrayBuffer(f),h=new DataView(g);let k=0;for(let l=0,m=d.byteLength;l<m;l++)h.setUint8(k,
10
+ d[l]),k+=1;for(let l=0,m=e.byteLength;l<m;l++)h.setUint8(k,e[l]),k+=1;this.f=g;this.g.info(`Appended ${e.byteLength} bytes.`+`Total data now ${f} bytes.`)}}).then(()=>{{var d=this.f,e=_.K(d),f=String.fromCharCode.apply(null,Zs),g=Array.prototype.slice.call(e,0,8);e=64;let k=0;var h=!1;if(f===String.fromCharCode.apply(null,g))for(d=new DataView(d,16,20),d=d.getUint32(0,!0),0===d&&(d=1E3);!h;){k+=1;g=d;f=new DataView(this.f,e);h=f.getUint32(0,!0);g=h*g/1E3;f=f.getUint32(4,!0);f=new Ys(g,f);if(g=this.a.length)g=
11
+ this.a[g-1],g.length=f.offset-g.offset,g.duration=f.time-g.time;this.a.push(f);e+=8;(h=4294967295===h)&&this.h.resolve();if(1E5<k)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");}}).then(()=>{Ns(this)}).catch(d=>{this.g.error(`[BIF] Error while loading thumbnails '
12
+ + 'URL: ${c}`,d);a.onError(new _.H(1,7,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){return 0>a?Promise.reject(Gs+a):this.h.then(()=>{for(let b=0;b<this.a.length;b++){const c=this.a[b];if(a>=c.time&&a<c.time+c.duration)return Qs(this,c).then(d=>d.load().then(()=>d))}return Promise.reject(Fs+a)})}},Zs=[137,66,73,70,13,10,26,10];var at=class extends Ws{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Hs);const c=b.url,d=_.nh(c);d.type=_.mh;this.f=a.getNetworkEngine().fetch(d).P.then(e=>{if(e=e.data){e=_.Ig(e).split(/\n/);for(let m=0;m<e.length;m++){var f=e[m],g=f.split(" --\x3e ");if(2===g.length){f=e[++m];var h=f.indexOf("\x3d");var k=h=0>h?[]:f.substr(h+1).split(/,/).map(parseFloat);h=k[0];const n=k[1],q=k[2];k=k[3];var l=f.indexOf("#");f=0>l?f:f.substr(0,l);f.match(/^http|^\/\//)||(f=
13
+ c.substr(0,c.lastIndexOf("/"))+"/"+f);l=Rs(g[0]);g=Rs(g[1])-l;this.a.push(new Ps(f,l,g,h,n,q,k,0,0))}}}}).catch(e=>{this.log.error("[VTT] Error while loading thumbnails "+`URL: ${c}`,e);a.onError(new _.H(1,7,2013,"Error while loading VTT thumbnails.",e))});super.init(a,b)}get(a){return 0>a?Promise.reject(Gs+a):this.f.then(()=>{for(let b=0;b<this.a.length;b++){const c=this.a[b];if(a>=c.time&&a<c.time+c.duration)return c.load().then(()=>c)}return Promise.reject(Fs+a)})}m(){return this.f}};var bt=class extends Ws{get(a){if(0>a)return this.log.error("Position must be greater than 0 but is "+a),Promise.reject();var b=this.g.getPeriods();b=Ss(b,a);if(!b)return this.log.error("Could not find period for specified position",a),Promise.reject();var c=b.thumbStreams.sort(this.f)[0];if(!c)return this.log.error("Could not find thumb stream for specified position",a),Promise.reject();b=c.findSegmentPosition(a-b.startTime);if(null===b||void 0===b)return this.log.error("Could not find segment index for specified position",
14
+ a),Promise.reject();var d=c.getSegmentReference(b);if(d){const e=Ts(d,c);a=Math.floor((a-d.startTime)/e.durationPerTile);let f;if(0<this.a.length)d=c.findSegmentPosition(0),null!==d&&(f=this.a[(b-d)*e.He+a]);else if((c=d.Ia())&&0<c.length){let g=0,h=0;d=d.startTime;1<e.He&&(g=a%e.Hc,h=Math.floor(a/e.Hc),d+=a*e.durationPerTile);f=new Ps(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.Hc,e.oe,g,h)}if(f)return f.load().then(()=>f)}this.log.error("segment reference for specified segment index does not exist",
15
+ b);return Promise.reject()}f(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0}m(){if(0<this.a.length)return Promise.resolve();var a=this.g.getPeriods();for(const b of a)if(a=b.thumbStreams.sort(this.f)[0]){let c=a.findSegmentPosition(0),d;for(;null!==c&&!_.B(d=a.getSegmentReference(c++));){const e=Ts(d,a),f=d.Ia()[0],g=new Image;let h=d.startTime;for(let k=0;k<e.oe;++k)for(let l=0;l<e.Hc;++l)this.a.push(new Ps(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Hc,
16
+ e.oe,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var ct=class{constructor(){this.f=new _.Q(Js);this.a=this.l=null}onPlayerCreated(a){this.l=a}onPlayerWillDestroy(){this.l=null}onPlayerWillRelease(){this.a=null}onContentWillLoad(a){var b=a.getConfiguration();if(b.thumbnails){var c=b.thumbnails;c&&(void 0===c.enabled||c.enabled)&&((b=c.mode)||(b=Vs(c.url||null)),b&&("SINGLE"===b||"GRID"===b?this.a=new Xs:"WEBVTT"===b?this.a=new at:"BIF"===b&&(this.a=new $s)),this.a&&(this.f.info("Loading thumbs configuration",c),this.l.one(_.qd,()=>{this.f.info("Initialize thumbnails provider");
17
+ this.a.init(a,c)})))}else this.a=null}onContentLoaded(a){if(!this.a){var b=a.getConfiguration();b=b&&b.thumbnails;if(!b||void 0===b.enabled||b.enabled){var c=a.getPeriods();Us(c)&&(this.a=new bt,this.a.init(a,b))}}}get(a){return this.a?this.a.get(a):Promise.reject()}id(){return"thumbnails"}};_.z("clpp.thumbnails.ThumbnailsPlugin",ct);ct.prototype.get=ct.prototype.get;ct.Id="thumbnails";_.Nm(new class{create(){return new ct}});};f.call(g, window);