@castlabs/prestoplay 6.4.0 → 6.5.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 (58) hide show
  1. package/CHANGELOG.md +57 -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 +110 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +421 -402
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +54 -133
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +47 -49
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +31 -32
  15. package/cjs/cl.ima.js +22 -22
  16. package/cjs/cl.mse.js +258 -255
  17. package/cjs/cl.muxdata.js +12 -12
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +69 -69
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  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 -18
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -20
  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 +363 -351
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +67 -67
  38. package/cl.externs.js +49 -132
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +40 -40
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +16 -16
  44. package/cl.mse.js +230 -231
  45. package/cl.muxdata.js +8 -8
  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 +58 -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 +15 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -16
  58. package/package.json +8 -2
package/cl.muxdata.js CHANGED
@@ -1,8 +1,8 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Ws=function(a){let b={debug:!0,data:Vs(a)};a.g&&a.g.muxOptionsOverride&&_.hf(a.g.muxOptionsOverride)&&(b=_.ef(b,a.g.muxOptionsOverride,{getPlayheadTime:()=>1E3*a.l.getPosition(),getStateData:()=>{{a.f.debug("getStateData()");var c=a.l.getLoadedSource(),d=a.l.getTrackManager();const f=a.l.getSurface(),g=d.ea();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};
2
- if(c){const h=new _.cj(c.url);e.video_source_url=_.Zi(h);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;g&&g.height&&g.width&&(e.video_source_height=g.height,e.video_source_width=g.width);(d=d.ia())&&d.language&&(e.player_language_code=d.language)}return e}}));a.f.debug("Mux SDK options",b);return b},Xs=function(a,b,c){a.f.debug(`Event: ${b}`);mux.emit(a.A,b,c)},Vs=function(a){const b={env_key:a.g.envKey,
3
- video_title:a.m&&a.m.name||"",player_name:_.na,player_software_name:_.na,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},Ys=function(a){a.a.on(a.l,_.re,()=>{Xs(a,_.re,{player_playhead_time:1E3*a.l.getPosition()})});a.a.on(a.l,_.Nd,()=>Xs(a,_.Nd));a.a.on(a.l,_.bc,a.B.bind(a));a.a.on(a.l,_.ge,a.D.bind(a));a.a.on(a.l,_.ze,()=>Xs(a,_.ae));a.a.on(a.l,_.ye,()=>Xs(a,
4
- _.$d));a.a.on(a.l,_.Tc,a.C.bind(a));a.a.on(a.l,_.qb,()=>Xs(a,"adbreakstart"));a.a.on(a.l,_.rb,()=>Xs(a,"adbreakend"));a.a.on(a.l,_.Db,()=>{Xs(a,"adplay");Xs(a,"adplaying")});a.a.on(a.l,_.zb,()=>Xs(a,"adpause"));a.a.on(a.l,_.Bb,()=>{Xs(a,"adplay");Xs(a,"adplaying")});a.a.on(a.l,_.Eb,()=>Xs(a,"adended"));a.a.on(a.l,_.vb,()=>Xs(a,"adfirstquartile"));a.a.on(a.l,_.yb,()=>Xs(a,"admidpoint"));a.a.on(a.l,_.Fb,()=>Xs(a,"adthirdquartile"))},Zs=class{constructor(a,b){this.l=a;this.m=this.g=null;this.A=("000000"+
5
- (Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.Nn;this.f=b;this.o=this.j=this.h=this.w=!1}initialize(a,b){this.g=a;this.m=b;this.w=!1;if(!this.h){try{this.h=!0,mux.init(this.A,Ws(this))}catch(c){throw this.h=!1,_.Kf(this.a),new _.G(1,9,9302,null,c);}Xs(this,"playerready")}this.j&&!this.o&&(Xs(this,"videochange",Vs(this)),this.j=!1);Ys(this)}release(){this.f.debug("release()");this.j?this.f.debug(_.ha):(_.Kf(this.a),this.j=!0,this.m=this.g=null)}destroy(){this.f.debug(_.Hc);
6
- this.o?this.f.debug(_.fa):(this.o=!0,this.h&&this.w&&Xs(this,"viewend"),Xs(this,"destroy"))}B(a){this.f.debug(_.yd);var b=a.detail;a=this.l.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ca())&&a.bandwidth&&(b+=a.bandwidth),Xs(this,"renditionchange",{video_source_bitrate:b}))}D(a){this.f.debug(_.Cd);switch(a.detail.currentState){case _.jl:this.l.getConfiguration().autoplay&&Xs(this,_.Nd);break;case _.ll:Xs(this,_.Od);break;case _.kl:Xs(this,_.Hd);break;case _.$k:this.w=!0,Xs(this,_.Sc)}}C(a){this.f.debug(_.zd);
7
- if(this.h&&(a=a.detail||null))if(10003===a.code)Xs(this,"aderror");else if(a.severity===_.F){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;Xs(this,_.Tc,{player_error_code:a.code,player_error_message:b})}}};var $s=class extends _.Ep{constructor(){super();this.f=null;this.a=!1;this.g=new _.N("clpp.muxdata")}onPlayerCreated(a){this.f=new Zs(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();if(this.a=!_.z(c.muxdata)&&typeof c.muxdata===_.xd){var d=c.muxdata;if(c="undefined"===typeof window.mux)c=d.muxLib,d="undefined"!==typeof c&&typeof c.init===_.Vc&&typeof c.emit===_.Vc,window.mux=c,c=d,c=!c;c&&(this.g.warn("Mux SDK is not loaded. Will do nothing."),this.a=!1,c=new _.G(1,9,9301),this.U(a,c))}else this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");
8
- if(this.a){c=a.getConfiguration();c=_.ff(c.muxdata||{});try{d=[];typeof c===_.xd&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.G(1,9,9300,{missingKeys:d});this.f.initialize(c,b)}catch(e){this.a=!1,this.U(a,e)}}}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 _.C(_.Tc,{detail:b}))}};_.y("clpp.muxdata.MuxDataPlugin",$s);$s.Id="mux";_.km(new class{create(){return new $s}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var tt=function(a){let b={debug:!0,data:st(a)};a.g&&a.g.muxOptionsOverride&&_.lf(a.g.muxOptionsOverride)&&(b=_.hf(b,a.g.muxOptionsOverride,{getPlayheadTime:()=>1E3*a.l.getPosition(),getStateData:()=>{{a.f.debug("getStateData()");var c=a.l.getLoadedSource(),d=a.l.getTrackManager();const f=a.l.getSurface(),g=d.fa();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};
2
+ if(c){const h=new _.Fj(c.url);e.video_source_url=_.ph(h);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;g&&g.height&&g.width&&(e.video_source_height=g.height,e.video_source_width=g.width);(d=d.ka())&&d.language&&(e.player_language_code=d.language)}return e}}));a.f.debug("Mux SDK options",b);return b},ut=function(a,b,c){a.f.debug(`Event: ${b}`);mux.emit(a.A,b,c)},st=function(a){const b={env_key:a.g.envKey,
3
+ video_title:a.m&&a.m.name||"",player_name:_.pa,player_software_name:_.pa,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},vt=function(a){a.a.on(a.l,_.ue,()=>{ut(a,_.ue,{player_playhead_time:1E3*a.l.getPosition()})});a.a.on(a.l,_.Rd,()=>ut(a,_.Rd));a.a.on(a.l,_.ec,a.B.bind(a));a.a.on(a.l,_.je,a.F.bind(a));a.a.on(a.l,_.Ce,()=>ut(a,_.ee));a.a.on(a.l,_.Be,()=>ut(a,
4
+ _.de));a.a.on(a.l,_.Xc,a.C.bind(a));a.a.on(a.l,_.ub,()=>ut(a,"adbreakstart"));a.a.on(a.l,_.vb,()=>ut(a,"adbreakend"));a.a.on(a.l,_.Hb,()=>{ut(a,"adplay");ut(a,"adplaying")});a.a.on(a.l,_.Db,()=>ut(a,"adpause"));a.a.on(a.l,_.Fb,()=>{ut(a,"adplay");ut(a,"adplaying")});a.a.on(a.l,_.Ib,()=>ut(a,"adended"));a.a.on(a.l,_.zb,()=>ut(a,"adfirstquartile"));a.a.on(a.l,_.Cb,()=>ut(a,"admidpoint"));a.a.on(a.l,_.Jb,()=>ut(a,"adthirdquartile"))},wt=class{constructor(a,b){this.l=a;this.m=this.g=null;this.A=("000000"+
5
+ (Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.po;this.f=b;this.o=this.j=this.h=this.w=!1}initialize(a,b){this.g=a;this.m=b;this.w=!1;if(!this.h){try{this.h=!0,mux.init(this.A,tt(this))}catch(c){throw this.h=!1,_.Of(this.a),new _.H(1,9,9302,null,c);}ut(this,"playerready")}this.j&&!this.o&&(ut(this,"videochange",st(this)),this.j=!1);vt(this)}release(){this.f.debug("release()");this.j?this.f.debug(_.ha):(_.Of(this.a),this.j=!0,this.m=this.g=null)}destroy(){this.f.debug(_.Lc);
6
+ this.o?this.f.debug(_.fa):(this.o=!0,this.h&&this.w&&ut(this,"viewend"),ut(this,"destroy"))}B(a){this.f.debug(_.Cd);var b=a.detail;a=this.l.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ca())&&a.bandwidth&&(b+=a.bandwidth),ut(this,"renditionchange",{video_source_bitrate:b}))}F(a){this.f.debug(_.Gd);switch(a.detail.currentState){case _.Ll:this.l.getConfiguration().autoplay&&ut(this,_.Rd);break;case _.Nl:ut(this,_.Sd);break;case _.Ml:ut(this,_.Nd);break;case _.Cl:this.w=!0,ut(this,_.Wc)}}C(a){this.f.debug(_.Dd);
7
+ if(this.h&&(a=a.detail||null))if(10003===a.code)ut(this,"aderror");else if(a.severity===_.F){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;ut(this,_.Xc,{player_error_code:a.code,player_error_message:b})}}};var xt=class extends _.bq{constructor(){super();this.f=null;this.a=!1;this.g=new _.O("clpp.muxdata")}onPlayerCreated(a){this.f=new wt(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();if(this.a=!_.z(c.muxdata)&&typeof c.muxdata===_.Bd){var d=c.muxdata;if(c="undefined"===typeof window.mux)c=d.muxLib,d="undefined"!==typeof c&&typeof c.init===_.Zc&&typeof c.emit===_.Zc,window.mux=c,c=d,c=!c;c&&(this.g.warn("Mux SDK is not loaded. Will do nothing."),this.a=!1,c=new _.H(1,9,9301),this.U(a,c))}else this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");
8
+ if(this.a){c=a.getConfiguration();c=_.jf(c.muxdata||{});try{d=[];typeof c===_.Bd&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.H(1,9,9300,{missingKeys:d});this.f.initialize(c,b)}catch(e){this.a=!1,this.U(a,e)}}}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 _.C(_.Xc,{detail:b}))}};_.x("clpp.muxdata.MuxDataPlugin",xt);xt.Id="mux";_.Nm(new class{create(){return new xt}});};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 Us=function(a,b){let c=b.baseUrl;_.xg(c,"/")||(c+="/");const d=g=>g&&(_.wg(g,"https://")||_.wg(g,"http://")||_.wg(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.xo(a);a.Ga(_.Dc,{licenseUrl:e,videoRobustness:[_.ab,void 0],audioRobustness:[_.$a,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.qj,licenseResponse:_.rj}});a.Ga(_.Bc,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.tj,licenseResponse:_.uj,extractContentId:_.vj,certificateRequest:_.wj}});a.Ga(_.Cc,{licenseUrl:f,modifiers:{licenseRequest:_.qj}});_.Di(a)};
3
- _.y("clpp.onboard.OnboardComponent",class extends _.bp{constructor(){super();this.l=null;this.h=new _.N("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}'`),Us(b,a))}release(){}id(){return"onboard"}});
4
- _.y("clpp.onboard.register",Us);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var rt=function(a,b){let c=b.baseUrl;_.Ig(c,"/")||(c+="/");const d=g=>g&&(_.Hg(g,"https://")||_.Hg(g,"http://")||_.Hg(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.$o(a);a.Ga(_.Hc,{licenseUrl:e,videoRobustness:[_.eb,void 0],audioRobustness:[_.db,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Tj,licenseResponse:_.Uj}});a.Ga(_.Fc,{licenseUrl:b,
2
+ certificateUrl:b,modifiers:{licenseRequest:_.Wj,licenseResponse:_.Xj,extractContentId:_.Yj,certificateRequest:_.Zj}});a.Ga(_.Gc,{licenseUrl:f,modifiers:{licenseRequest:_.Tj}});_.jj(a)};
3
+ _.x("clpp.onboard.OnboardComponent",class extends _.Ep{constructor(){super();this.l=null;this.h=new _.O("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}'`),rt(b,a))}release(){}id(){return"onboard"}});
4
+ _.x("clpp.onboard.register",rt);};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 Fs="A persistent DRM session already exists for: ",Gs="No DRM configuration.",Hs="clpp.persistent",Is=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},Ks=function(a,b){a.I=Js;a.J=[];a.D=!0;return _.jk(a,b)},Ms=function(a,b,c,d,e,f){a.I=Ls;const g=new Map,h=_.Xj(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Ed,persistentState:_.Xd,sessionTypes:[_.Ld],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
- audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.ik(a,g)},Ns=function(a,b){return _.w(function*(){const c=yield _.zk(a,b);if(c){var d=[],e=a.g.get(c);e&&a.B&&(e.jb=new _.mk,d.push(e.jb));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)})},Os=function(a){a=a.g.keys();a=Is(a,b=>b.sessionId);return Array.from(a)},Ps=function(a,b){const c=_.Fi(a),d=_.ji({drm:a});
3
- d.drm=a;a=new _.ul({ub:b,onError:()=>{},Hd:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,mc:()=>null});a.h=c;return a},Ss=function(a,b,c){return _.w(function*(){const d=Qs;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Rs.debug(Fs,e);else{var g=Ps(a,c);try{yield Ks(g,b);yield _.xk(g);yield _.Ak(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Vg(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:Os(g),keySystem:h.keySystem,
4
- licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Rs.error("Error while persisting DRM session"),new _.G(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Rs.debug(Gs)})},Js=1,Ls=2,Ts=class{store(a,b){return _.w(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var ct="A persistent DRM session already exists for: ",dt="No DRM configuration.",et="clpp.persistent",ft=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},ht=function(a,b){a.I=gt;a.J=[];a.C=!0;return _.Pk(a,b)},jt=function(a,b,c,d,e,f){a.I=it;const g=new Map,h=_.Ak(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Id,persistentState:_.ae,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)},kt=function(a,b){return _.w(function*(){const c=yield _.fl(a,b);if(c){var d=[],e=a.g.get(c);e&&a.A&&(e.kb=new _.Sk,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)})},lt=function(a){a=a.g.keys();a=ft(a,b=>b.sessionId);return Array.from(a)},mt=function(a,b){const c=_.lj(a),d=_.Si({drm:a});
3
+ d.drm=a;a=new _.Wl({vb:b,onError:()=>{},Md:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,oc:()=>null});a.h=c;return a},pt=function(a,b,c){return _.w(function*(){const d=nt;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)ot.debug(ct,e);else{var g=mt(a,c);try{yield ht(g,b);yield _.dl(g);yield _.gl(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Mh(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:lt(g),keySystem:h.keySystem,
4
+ licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw ot.error("Error while persisting DRM session"),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else ot.debug(dt)})},gt=1,it=2,qt=class{store(a,b){return _.w(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),
5
5
  f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){return _.w(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 _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return"clpp.persistent.SimpleSessionStorage"}};_.y("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.jf(a.store)||c.push("store"),_.jf(a.get)||c.push("get"),_.jf(a.delete)||c.push("delete"),_.jf(a.clear)||c.push("clear"),_.jf(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Rs.warn("Invalid session storage implementation"),new _.G(1,6,6202,{missingMethods:b});Qs=a});
7
- _.y("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=Qs,e=(l,m)=>new _.G(1,6,6200,l,m);const f=_.ol(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(Gs);var g=b.offlineId;if(typeof g!==_.je||!g.length)throw e("Missing offline id.");if(yield d.get(g))Rs.debug(Fs,g);else{var h=_.ji();d=new _.hm;g=[];for(var k of c){const l=new k;_.mi(l.id())||(l.f(null),_.qi(l),g.push(l))}k=null;try{k=yield _.$m(f.url,d,h.manifest.attemptParameters,f.type);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 _.G(_.F,4,4014));const m=_.Ym(l.periods);yield Ss(b,m,d)}catch(l){if(l instanceof _.G&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.li.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
- _.y("clpp.persistent.removeLicense",function(a){return _.w(function*(){var b=Qs;if(_.kf(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.hm,c=Ps(e.drmConfig,d),yield Ms(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.xk(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield Ns(c,f);Rs.debug("successfully removed session with id",f)}))),yield b.delete(a)):Rs.debug("No persistent DRM session found")}catch(e){throw Rs.error("Failed to remove session"),
10
- new _.G(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else Rs.warn("Invalid offlineId")})});var Qs=new Ts,Rs=new _.N(Hs);_.y("clpp.persistent.PersistentLicenseComponent",class extends _.bp{constructor(){super();this.l=null;this.j=Qs;this.h=new _.N(Hs)}f(a){this.l=a}a(){this.l=null}release(){}g(){this.j=Qs}id(){return _.Id}o(a,b,c){const d=this;return _.w(function*(){if(a)try{yield Ss(a,b,c),d.l.trigger(new _.C(_.Mc,{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 _.w(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 _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return"clpp.persistent.SimpleSessionStorage"}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.mf(a.store)||c.push("store"),_.mf(a.get)||c.push("get"),_.mf(a.delete)||c.push("delete"),_.mf(a.clear)||c.push("clear"),_.mf(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw ot.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});nt=a});
7
+ _.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=nt,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(dt);var g=b.offlineId;if(typeof g!==_.me||!g.length)throw e("Missing offline id.");if(yield d.get(g))ot.debug(ct,g);else{var h=_.Si();d=new _.Km;g=[];for(var k of c){const l=new k;_.Vi(l.id())||(l.f(null),_.Xi(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(_.F,4,4014));const m=_.An(l.periods);yield pt(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(),_.Ui.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
+ _.x("clpp.persistent.removeLicense",function(a){return _.w(function*(){var b=nt;if(_.of(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=mt(e.drmConfig,d),yield jt(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.dl(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield kt(c,f);ot.debug("successfully removed session with id",f)}))),yield b.delete(a)):ot.debug("No persistent DRM session found")}catch(e){throw ot.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 ot.warn("Invalid offlineId")})});var nt=new qt,ot=new _.O(et);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.Ep{constructor(){super();this.l=null;this.j=nt;this.h=new _.O(et)}f(a){this.l=a}a(){this.l=null}release(){}g(){this.j=nt}id(){return _.Od}o(a,b,c){const d=this;return _.w(function*(){if(a)try{yield pt(a,b,c),d.l.trigger(new _.C(_.Qc,{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 _.w(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 Cs=function(a,b){return 0<=b&&b<a.a.length},Ds=function(a){a.trigger(new _.C(_.Qd))},Es=class extends _.jo{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.ve.bind(this)}getPosition(){return this.f}pf(){return this.a}nd(){return 0<this.a.length&&Cs(this,this.f)?this.a[this.f]:null}qf(){const a=this.f+1;return 0<
2
- this.a.length&&Cs(this,a)?this.a[a]:null}vf(){return this.g}start(){this.g||(this.g=!0,this.l.on(_.Sc,this.h),this.Rc(this.f,!0))}stop(){this.g=!1;this.l.off(_.Sc,this.h)}ve(){this.next()}next(){const a=this;return _.w(function*(){yield a.Rc(Math.min(a.a.length-1,a.f+1))})}Ff(){const a=this;return _.w(function*(){yield a.Rc(Math.max(0,a.f-1))})}Rc(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&Cs(c,a)&&(b||c.f!==a)){c.f=a;var d=c.nd();d&&(yield c.j(d),yield c.l.load(d.configuration),
3
- c.trigger(new _.C(_.Pd,{item:d})))}})}append(a){this.a.push(a);Ds(this)}uf(a,b){if(0<=b&&b<=this.a.length){const c=this.nd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Ds(this)}}remove(a){if(0<this.a.length&&Cs(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Ds(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;Ds(this)}};_.y("clpp.Playlist",Es);Es.prototype.clear=Es.prototype.clear;Es.prototype.remove=Es.prototype.remove;Es.prototype.insert=Es.prototype.uf;
4
- Es.prototype.append=Es.prototype.append;Es.prototype.goTo=Es.prototype.Rc;Es.prototype.previous=Es.prototype.Ff;Es.prototype.next=Es.prototype.next;Es.prototype.onEnded=Es.prototype.ve;Es.prototype.stop=Es.prototype.stop;Es.prototype.start=Es.prototype.start;Es.prototype.isStarted=Es.prototype.vf;Es.prototype.getUpcoming=Es.prototype.qf;Es.prototype.getCurrent=Es.prototype.nd;Es.prototype.getQueue=Es.prototype.pf;Es.prototype.getPosition=Es.prototype.getPosition;Es.prototype.off=Es.prototype.off;
5
- Es.prototype.one=Es.prototype.one;Es.prototype.on=Es.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var $s=function(a,b){return 0<=b&&b<a.a.length},at=function(a){a.trigger(new _.C(_.Ud))},bt=class extends _.Uo{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.ze.bind(this)}getPosition(){return this.f}vf(){return this.a}rd(){return 0<this.a.length&&$s(this,this.f)?this.a[this.f]:null}wf(){const a=this.f+1;return 0<
2
+ this.a.length&&$s(this,a)?this.a[a]:null}Bf(){return this.g}start(){this.g||(this.g=!0,this.l.on(_.Wc,this.h),this.Uc(this.f,!0))}stop(){this.g=!1;this.l.off(_.Wc,this.h)}ze(){this.next()}next(){const a=this;return _.w(function*(){yield a.Uc(Math.min(a.a.length-1,a.f+1))})}Lf(){const a=this;return _.w(function*(){yield a.Uc(Math.max(0,a.f-1))})}Uc(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&$s(c,a)&&(b||c.f!==a)){c.f=a;var d=c.rd();d&&(yield c.j(d),yield c.l.load(d.configuration),
3
+ c.trigger(new _.C(_.Td,{item:d})))}})}append(a){this.a.push(a);at(this)}Af(a,b){if(0<=b&&b<=this.a.length){const c=this.rd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));at(this)}}remove(a){if(0<this.a.length&&$s(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);at(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;at(this)}};_.x("clpp.Playlist",bt);bt.prototype.clear=bt.prototype.clear;bt.prototype.remove=bt.prototype.remove;bt.prototype.insert=bt.prototype.Af;
4
+ bt.prototype.append=bt.prototype.append;bt.prototype.goTo=bt.prototype.Uc;bt.prototype.previous=bt.prototype.Lf;bt.prototype.next=bt.prototype.next;bt.prototype.onEnded=bt.prototype.ze;bt.prototype.stop=bt.prototype.stop;bt.prototype.start=bt.prototype.start;bt.prototype.isStarted=bt.prototype.Bf;bt.prototype.getUpcoming=bt.prototype.wf;bt.prototype.getCurrent=bt.prototype.rd;bt.prototype.getQueue=bt.prototype.vf;bt.prototype.getPosition=bt.prototype.getPosition;bt.prototype.off=bt.prototype.off;
5
+ bt.prototype.one=bt.prototype.one;bt.prototype.on=bt.prototype.on;};f.call(g, window);
package/cl.smooth.js CHANGED
@@ -1,58 +1,58 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var uE="Full MP4 box must have flags defined",vE="clpp.smooth.SmoothMP4Processor",wE="codecPrivateData",xE=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.L(a,c);_.L(a,b)},yE=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Ji()}},zE=function(a,b){yE(a,b>>16&255);yE(a,b>>8&255);yE(a,b&255)},AE=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.Ji()}},BE=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.Ji()}},CE=function(a,b){try{a.f.setInt16(a.a,
2
- b,a.g),a.a+=2}catch(c){_.Ji()}},DE=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},EE=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},FE=function(a,b,c,d){c=b.le[c];b=b.Tf;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 _.au([a],[b])[0]},GE=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.v?c=["maxWidth","maxHeight","bitrate",wE,"fourCC"]:a.type===_.Vb&&(c=["bitrate",wE,"channels","bitsPerSample","samplingRate","fourCC"]);return _.mf(a,b,c,["id","segmentIndex"])},HE=function(a,b,c){const d=c.Kc.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ha:null,Gb:null,width:NaN,height:NaN,zb:null,Ec:NaN,
4
- sampleSize:NaN,channelCount:NaN};switch(c.type){case _.v:a.Ha=[_.vi(d[1])];a.Gb=[_.vi(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Vb:a.zb=_.vi(c.Kc),a.sampleSize=c.Ue||16,a.Ec=c.Ec,a.channelCount=c.ge}return a},IE=function(a,b){return a.filter(c=>c.type===b)},JE=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)},QE=function(a,b,c){var d=null;if(KE.test(a)){{a=KE.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 LE.test(a)?d=JE(LE,a):ME.test(a)?d=JE(ME,a):NE.test(a)?(a=NE.exec(a),d=Number(a[1])/c.frameRate):OE.test(a)?(a=OE.exec(a),d=Number(a[1])/c.a):PE.test(a)&&(d=JE(PE,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},RE=function(a){let b=
6
- 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.gj(b)},YE=function(a,b,c){a:{var d=[_.Dc,_.Cc];for(e of d)if((d=c.Pc(e))&&d.keyId){var e=d.keyId;break a}_.B(vE,"Could not get default Key ID for DRM init data!");e=null}c=new SE("xxxx");a.type===_.v?c=new TE(a.width,a.height):c=new UE(a.channelCount,a.sampleSize,a.Ec);a=new VE;a.g=1;a.h=8;a.m=e||"00000000000000000000000000000000";a=(new SE("schi")).append([a]);b=(new SE(_.ce)).append([new WE(b),new XE(_.nc,65536),a]);c.append([b]);return c},
7
- AF=function(a,b){var c=b.Uc(),d=new ZE(a.timescale,a.duration,a.id),e=(new $E).append([new aF(a.id)]),f=new bF(a.id,a.duration,a.timescale,a.width,a.height),g=new cF(a.timescale,a.duration);const h=new dF(a.type);var k=null,l=new eF;l.entries=[new fF];var m=new gF;switch(a.type){case _.v:k=new hF(a.Ha,a.Gb);c?(a=YE(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new iF(a.width,a.height)).append([k]),m.entries=[a]);k=new jF;break;case _.Vb:k=new kF(a.zb),c?(a=YE(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
- (a=(new lF(a.channelCount,a.sampleSize,a.Ec)).append([k]),m.entries=[a]),k=new mF}m=(new nF).append([m,new oF,new pF,new qF,new rF]);l=(new sF).append([l]);l=(new tF).append([k,l,m]);g=(new uF).append([g,h,l]);f=(new vF).append([f,g]);d=(new wF).append([d,f,e]);e=new xF("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Pc(_.Cc),b=b.Pc(_.Dc),c&&d.append([new yF("pssh",c.initData,8)]),b&&d.append([new yF("pssh",b.initData,8)]),c||b||_.B(vE,"Could not get PSSH init data!"));b=new zF([e,d]);return _.K(b.write())},
9
- KF=function(a,b){let c,d,e,f,g,h;(new _.ej).L("moof",_.Vi).X("mfhd",k=>{{const l=new BF;l.g=_.M(k.G);c=l}}).L("traf",_.Vi).X("tfhd",k=>{{const l=k.G.va();if(null===k.flags)throw new _.G(_.F,3,3019,uE);const m=new CF(k.version||0,k.flags||0);m.g=_.M(k.G);0<l-k.G.getPosition()&&k.flags&1&&(m.h=_.Ri(k.G));0<l-k.G.getPosition()&&k.flags&2&&(m.A=_.M(k.G));0<l-k.G.getPosition()&&k.flags&8&&(m.j=_.M(k.G));0<l-k.G.getPosition()&&k.flags&16&&(m.o=_.M(k.G));0<l-k.G.getPosition()&&k.flags&32&&(m.m=_.M(k.G));
10
- d=m}}).X("trun",k=>{{var l=k.G.va();if(null===k.flags)throw new _.G(_.F,3,3019,uE);const m=new DF(k.version||0,k.flags||0);m.g=_.M(k.G);0<l-k.G.getPosition()&&k.flags&1&&(m.j=_.Pi(k.G));0<l-k.G.getPosition()&&k.flags&4&&(m.m=_.M(k.G));if(0<l-k.G.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.o.push(_.M(k.G)),k.flags&512&&m.sampleSize.push(_.M(k.G)),k.flags&1024&&m.A.push(_.M(k.G)),k.flags&2048&&(0===k.version?m.h.push(_.M(k.G)):m.h.push(_.Pi(k.G)));e=m}}).X("sdtp",k=>{{const l=_.Si(k.G,k.G.va());
11
- f=new EF("sdtp",k.version||0,k.flags||0,l,0)}}).L("uuid",k=>{var l=_.Si(k.G,16);if(_.xi(l,FF)){l=_.M(k.G);k.version=l>>>24;k.flags=l&16777215;l=new GF(k.version,k.flags);l.h=_.M(k.G);k.flags&1&&(l.j=_.Ni(k.G));for(let m=0;m<l.h;m++){const n={oe:_.Si(k.G,8),rc:0,Ud:[]};if(k.flags&2){n.rc=_.Oi(k.G);for(let q=0;q<n.rc;q++){const t={ee:0,fe:0};t.ee=_.Oi(k.G);t.fe=_.M(k.G);n.Ud.push(t)}}l.g.push(n)}g=l}}).L(_.ld,k=>{{const l=new HF;0<k.G.va()?l.g=_.Si(k.G,k.G.va()):(_.B(vE,"mdat box is empty!"),l.g=new Uint8Array(0));
12
- h=l}}).parse(a,!1);if(!h)return null;a=(new IF).append([d,e]);f&&a.append([f]);b.Uc()&&g&&a.append([g]);b=(new JF).append([c,a]);return new zF([b,h])},PF=function(a,b,c){var d=c.Uc(),e=a.request.startTime,f=parseInt(e*b,10);b=a.data||new ArrayBuffer(0);var g=KF(b,c);if(null===g)return a.request.contentType===_.r?a.data:g;c=g.get(_.ld);if(a.request.contentType===_.r){d=c.g.buffer;if(e){d=_.sg(d);if((d=(new DOMParser).parseFromString(d,_.qe))&&"tt"===d.documentElement.tagName.toLowerCase())var h=d.documentElement;
13
- if(h&&(c=new LF(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=e;b=c;g=["begin",_.Rc];for(let x=0,A=g.length;x<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 E=l.length;for(;n<E;n++){var q=l[n].name;if(q=q.match(m)){k=
14
- k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[x],QE(k||"",a,b))}}}d=(new XMLSerializer).serializeToString(d);e=_.tg(d).buffer}else e=d;return e}h=new JF;a=g.get("mfhd");b=new IF;k=g.get("tfhd");m=new MF(1,f);f=g.get("trun");n=g.get("sdtp");e=g.get("senc");k.g=1;k.flags&=16777214;k.flags|=131072;b.append([k,m,f]);n&&b.append([n]);if(d){g=0;k=[];if(e.flags&2)for(k=[],m=0;m<e.h;m++)k.push(10+6*e.g[m].rc);else g=8;b.append([e,new NF,new OF(g,k,e.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;c=new zF([h,
15
- c]);h=c.write();d&&(d=c.get("saio"),c=c.f,d.offset[0]=e.start+16,c.seek(d.start),d.write(c),h=c.buffer);return h},QF=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},RF=function(a){return{initData:_.It(_.Mj(a)),initDataType:_.nc,keyId:a,periodId:null}},SF=function(a,b,c){a=_.Uj(a);c&&a.version!==c&&(a=_.Kt(a,c));return{initData:_.It(a),
16
- initDataType:_.nc,keyId:b,periodId:null}},TF=function(a,b){return _.w(function*(){var c=_.Hg(b);c.timeout=a.h.attemptParameters.timeout;c.maxAttempts=Math.max(a.h.attemptParameters.maxAttempts,b.length);c.baseDelay=a.h.attemptParameters.baseDelay;c.backoffFactor=a.h.attemptParameters.backoffFactor;c.fuzzFactor=a.h.attemptParameters.fuzzFactor;c.type=1;c=yield a.g.networkingEngine.fetch(c).P;a.o=c.uri;return c})},aG=function(a,b){let c=null;try{{const xa=new DOMParser;let ib,La;try{const bb=_.sg(b);
17
- La=xa.parseFromString(bb.trim(),_.qe)}catch(bb){throw bb;}La&&La.documentElement.tagName==_.fb&&(ib=La.documentElement);c=ib&&0<ib.getElementsByTagName("parsererror").length?null:ib}}catch(xa){}if(!c)throw a.f.error("Unable to parse manifest"),new _.G(_.F,4,4033,a.o);const d=+UF(a,c,"MajorVersion"),e=+UF(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||1E7;let g=+UF(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||
18
- Infinity,m=_.Gj(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.f.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.G(_.F,4,4036,a.o);h?(VF(a,WF),a.C=typeof a.h.liveRefreshPeriod===_.p?1E3*a.h.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):VF(a,XF);a.a={startTime:0,delay:0,duration:g/f,jd:l/f,zc:0};if(m){{var n=a.h.playreadyVersion;const xa=[],ib=_.Gj(m,"ProtectionHeader")[0],La=_.ui(_.Ij(ib)||""),bb=_.Uj(La).a;xa.push(QF(_.Dc,RF(bb),[bb]));xa.push(QF(_.Cc,SF(La,
19
- bb,n),[bb]));var q=xa}a.w=q}{const xa=[],ib=_.Gj(c,"StreamIndex");if(!ib.length)throw a.f.error("No streams found!"),new _.G(_.F,4,4034,a.o);for(let La=0;La<ib.length;La++){{var t=a,u=ib[La];const bb=UF(t,u,"Type"),gc=+u.getAttribute("Chunks"),Sg=u.getAttribute("Subtype"),Ce=_.Rg(u.getAttribute("Language")||_.ue),Jd=u.getAttribute("Name")||"",Tg=+u.getAttribute(_.Ja),zf=+u.getAttribute(_.Ia),Af=UF(t,u,"Url"),Ck=+u.getAttribute("TimeScale")||null;{const hc=[],ni=_.Gj(u,_.Wa);for(let Kd=0;Kd<ni.length;Kd++){{let ic,
20
- Ha,dd;var x=t,A=ni[Kd],E=bb;const oi=+A.getAttribute("Index"),Bf=+UF(x,A,"Bitrate");let Mb=NaN,Cf=NaN,Dk=NaN,pp=NaN,vy=NaN,wy=NaN,xy=NaN;const yy=A.getAttribute("FourCC");switch(E){case _.v:Mb=+UF(x,A,_.Ia);Cf=+UF(x,A,_.Ja);break;case _.Vb:pp=+A.getAttribute("Channels")||2,Dk=+UF(x,A,"SamplingRate"),wy=+UF(x,A,"AudioTag"),vy=+UF(x,A,"BitsPerSample"),xy=+UF(x,A,"PacketSize")}let qp=String(A.getAttribute("CodecPrivateData"));if(E===_.Vb&&!qp){{var D=pp;const zy={96E3:0,88200:1,64E3:2,48E3:3,44100:4,
21
- 32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Ek=zy[Dk];if("AACH"===yy){Ha=new Uint8Array(4);const Ay=zy[2*Dk];Ha[0]=40|Ek>>1;Ha[1]=Ek<<7|D<<3|Ay>>1;Ha[2]=Ay<<7|8;Ha[3]=0;ic=new Uint16Array(2);ic[0]=(Ha[0]<<8)+Ha[1];ic[1]=(Ha[2]<<8)+Ha[3];dd=ic[0].toString(16)+ic[1].toString(16)}else Ha=new Uint8Array(2),Ha[0]=16|Ek>>1,Ha[1]=Ek<<7|D<<3,ic=new Uint16Array(1),ic[0]=(Ha[0]<<8)+Ha[1],dd=ic[0].toString(16);qp=dd.toUpperCase()}}var T={id:x.W++,type:E,index:oi,bitrate:Bf,Kc:qp,maxHeight:Mb,
22
- maxWidth:Cf,Ec:Dk,ge:pp,bg:wy,Ue:vy,lg:xy,gf:yy,segmentIndex:null}}hc.push(T)}var ia=hc}{const hc=[],ni=_.Gj(u,"c");for(let Kd=0;Kd<ni.length;Kd++){const ic=ni[Kd];let Ha=parseInt(ic.getAttribute("t"),10),dd=parseInt(ic.getAttribute("d"),10),oi=parseInt(ic.getAttribute("r"),10),Bf=0;if(isNaN(Ha)&&isNaN(dd))throw t.f.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.G(_.F,4,4037,t.o);0===Kd&&isNaN(Ha)&&(Bf=Ha=0);if(0<Kd){const Mb=hc[hc.length-
23
- 1];Bf=Mb.n+1;Mb.d||(Mb.d=Ha-Mb.t);Ha||(Ha=Mb.t+Mb.d);dd||(dd=Ha-Mb.t)}hc.push({n:Bf,d:dd,t:Ha});if(oi){oi--;for(let Mb=0;Mb<oi;Mb++){const Cf=hc[hc.length-1];Bf=Cf.n+1;Ha=Cf.t+Cf.d;dd=Cf.d;hc.push({n:Bf,d:dd,t:Ha})}}}t.D()||hc.length===gc||t.f.warn("Number of fragments ("+gc+") differs from number of chunks ("+hc.length+").");var tf=hc}var uf={type:bb,dg:gc,Pf:Sg,language:Ce,name:Jd,maxWidth:Tg,maxHeight:zf,Tf:Af,tracks:ia,le:tf,timescale:Ck}}xa.push(uf)}var vf=xa}const Pa={jg:d,re:e,timescale:f,
24
- duration:g,isLive:h,ig:k,jd:l,sd:!1,streams:vf};if(a.j&&a.A)return YF(a,Pa),Promise.resolve();{const xa=Pa.timescale,ib=Pa.duration,La=IE(Pa.streams,_.Vb),bb=IE(Pa.streams,_.v),gc=IE(Pa.streams,_.r),Sg=[];let Ce=ZF(a,ib,xa,La),Jd=ZF(a,ib,xa,bb);const Tg=ZF(a,ib,xa,gc);Ce.length||(Ce=[null]);Jd.length||(Jd=[null]);for(let zf=0;zf<Jd.length;zf++)for(let Af=0;Af<Ce.length;Af++)Sg.push($F(a,Jd[zf],Ce[Af]));var bd={startTime:0,variants:Sg,textStreams:Tg,thumbStreams:[]}}{var ed=Pa.streams;let xa=a.a.startTime,
25
- ib=a.a.delay;const La=a.I;let bb=Math.min(a.a.duration||Infinity,La);const gc=a.D(),Sg=a.a.jd,Ce=a.a.zc,Jd=a.H,Tg=isFinite(a.F)?a.F:0;if(gc)bb=Infinity,xa=Date.now()/1E3-Ce,a.a.startTime=xa,ib=3*Jd;else{const zf=isFinite(La)?La:a.a.duration;for(const Af of ed)for(const Ck of Af.tracks)Ck.segmentIndex.offset(-Tg),_.Au(Ck.segmentIndex,zf)}a.B=new _.Ry(xa,ib,!gc,!0);a.B.Jb(bb);_.nu(a.B,Jd);a.B.Yb=Sg;gc||a.B.offset(-Tg)}a.g.filterAllPeriods([bd]);a.j={presentationTimeline:a.B,periods:[bd],offlineSessionIds:[],
26
- minBufferTime:0};Promise.resolve();a.K||(a.g.networkingEngine.bd(a.M),a.K=!0);a.A=Pa;return Promise.resolve()},bG=function(a,b){null!=a.C&&null!=b&&(a.m=window.setTimeout(a.T.bind(a),b))},UF=function(a,b,c){if(b=b.getAttribute(c))return b;a.f.error("required attribute not provided: "+c);throw new _.G(_.F,4,4038,a.o,c);},VF=function(a,b){const c=b===XF;if(a.j&&a.j.presentationTimeline){var d=a.j.presentationTimeline;d.j=c;d.m=c}c&&null!=a.m&&(window.clearTimeout(a.m),a.m=null,a.C=null);a.R=b},YF=function(a,
27
- b){for(let e=0;e<a.A.streams.length;e++){const f=b.streams[e];for(const g of a.A.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){GE(g,c)||a.f.warn("The current stream is updated with a stream that seems to have different base properties!");var d=cG(a,a.A.timescale,f,c);c=g.segmentIndex;_.wu(c,d);(d=a.a.jd)&&_.xu(c,_.uu(c)-d)}else a.f.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},cG=function(a,b,c,
28
- d){let e=0;const f=[],g=c.timescale||b;c.le.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=FE(a.o,c,k,d);a.H=Math.max(a.H,l);f.push(new _.vu(k,h,m,()=>[n],0,null,0,null,!0,g));e+=l});if(c.type===_.v||c.type===_.Vb)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.zc?a.a.zc=b.endTime:a.a.zc=Math.min(a.a.zc,b.endTime);return f},ZF=function(a,b,c,d){let e=[];for(let f=0;f<d.length;f++){const g=d[f].tracks.map(h=>{var k=d[f],l=cG(a,c,k,h),m=new _.Sy(l),n=null;
29
- k.type!==_.r&&(n=dG(a,b,c,k,h));h.segmentIndex=m;l=a.N++;var q=Promise.resolve.bind(Promise),t=m.f.bind(m),u=m.get.bind(m),x=m.g.bind(m);m=m.getDuration.bind(m);var A=eG[k.type];var E="";switch(k.type){case _.v:E=h.Kc;var D=/00000001[0-9]7/.exec(E);E="avc1."+(D&&D[0]?E.substr(E.indexOf(D[0])+10,6):"42c00c");a.f.debug("VIDEO CODECS: ",E);break;case _.Vb:E=h.Kc,D=2,"AACH"===h.gf?D=5:E&&(D=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+D,a.f.debug("AUDIO CODECS: ",E)}D=k.type===_.r?fG[k.Pf]:void 0;
30
- return h={id:l,originalId:null,ng:null,createSegmentIndex:q,findSegmentPosition:t,getSegmentReference:u,adjustSegmentDurations:x,getDuration:m,segmentIndex:null,segmentLookupStrategy:_.st,initSegmentReference:n,mimeType:A,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,emsgSchemeIdUris:null,roles:[],channelsCount:h.ge||null,closedCaptions:null}});
31
- e=e.concat(g)}return e},$F=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.ue;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},dG=function(a,b,c,d,e){b=HE(b,d.timescale||c,e);c={isLive:a.D.bind(a),Uc:a.J.bind(a),mf:()=>1,Pc:a.S.bind(a)};d=new Uint8Array(0);try{d=AF(b,c)}catch(g){throw a.f.error("Failed to generate initialization segment."),new _.G(_.F,3,4035,g);}const f="data:text/plain;base64,"+
32
- _.ti(d);return new _.Qy(()=>[f],0,null,null,!0)},SE=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;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(let c=
33
- 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?_.L(a,1):_.L(a,this.size);_.Ki(a,DE(this.type));this.size>b&&xE(a,this.size);"uuid"===this.type&&_.Ki(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()}},gG=class extends SE{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);yE(a,
34
- this.version);zE(a,this.flags)}},yF=class extends SE{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);_.Ki(a,this.g,this.offset);a.getPosition()}},EF=class extends gG{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);_.Ki(a,this.g,this.offset);a.getPosition()}},xF=class extends SE{constructor(a,b,c){super("ftyp");this.h=a;this.re=b;this.g=
35
- c}a(){let a=this.h.length;a=a+4+this.g.join("").length;return a+super.a()}write(a){super.write(a);_.Ki(a,DE(this.h));_.L(a,this.re);_.Ki(a,DE(this.g.join("")));a.getPosition()}},wF=class extends SE{constructor(){super(_.rd)}},vF=class extends SE{constructor(){super(_.se)}},ZE=class extends gG{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,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?
36
- a+28:a+16;a=a+44+this.g.length;return a+=super.a()}write(a){super.write(a);1===this.version?(xE(a,0),xE(a,0),_.L(a,this.timescale),xE(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.timescale),_.L(a,this.duration*this.timescale));_.L(a,65536);AE(a,this.volume);AE(a,0);_.L(a,0);_.L(a,0);for(let b=0;b<this.g.length;b++)yE(a,this.g[b]);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,this.h);a.getPosition()}},$E=class extends SE{constructor(){super("mvex")}},aF=class extends gG{constructor(a){super("trex",
37
- 0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.L(a,this.g);_.L(a,1);_.L(a,0);_.L(a,0);_.L(a,0);a.getPosition()}},bF=class extends gG{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+this.g.length;return a+super.a()}write(a){super.write(a);1===this.version?(xE(a,0),xE(a,0),_.L(a,
38
- this.h),_.L(a,0),xE(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.h),_.L(a,0),_.L(a,this.duration*this.timescale));_.L(a,0);_.L(a,0);AE(a,0);AE(a,0);AE(a,this.volume);AE(a,0);for(let b=0;b<this.g.length;b++)yE(a,this.g[b]);AE(a,this.width);AE(a,0);AE(a,this.height);AE(a,0);a.getPosition()}},cF=class extends gG{constructor(a,b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956}a(){let a=0;a=1===this.version?a+28:a+16;return a+4+super.a()}write(a){super.write(a);
39
- 1===this.version?(xE(a,0),xE(a,0),_.L(a,this.timescale),xE(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.timescale),_.L(a,this.duration*this.timescale));AE(a,this.language);AE(a,0);a.getPosition()}},dF=class extends gG{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.L(a,0);this.g===_.v?_.Ki(a,DE("vide")):_.Ki(a,DE("soun"));_.L(a,0);_.L(a,0);_.L(a,0);this.g===_.v?_.Ki(a,DE("VideoHandler\x00")):_.Ki(a,DE("SoundHandler\x00"));a.getPosition()}},
40
- jF=class extends gG{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);AE(a,0);_.Ki(a,this.g);a.getPosition()}},hG=class extends SE{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.L(a,0);AE(a,0);AE(a,1)}},iG=class extends hG{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);AE(a,0);AE(a,0);_.L(a,0);_.L(a,0);_.L(a,0);AE(a,
41
- this.width);AE(a,this.height);_.L(a,4718592);_.L(a,4718592);_.L(a,0);AE(a,1);yE(a,10);_.Ki(a,DE("AVC Coding",31));AE(a,this.depth);CE(a,-1)}},jG=class extends hG{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);_.L(a,0);_.L(a,0);AE(a,this.channelCount);AE(a,this.sampleSize);CE(a,0);AE(a,0);AE(a,this.sampleRate);AE(a,0)}},iF=class extends iG{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);
42
- for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},TE=class extends iF{constructor(a,b){super(a,b);this.type="encv"}},lF=class extends jG{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()}},UE=class extends lF{constructor(a,b,c){super(a,b,c);this.type="enca"}},hF=class extends SE{constructor(a,b){super("avcC");this.Ha=a;this.Gb=b;this.version=1;this.g=this.Ha[0][1];this.h=this.Ha[0][2];this.level=this.Ha[0][3]}a(){let a=
43
- 7;for(var b=0;b<this.Ha.length;b++)a+=2,a+=this.Ha[b].byteLength;for(b=0;b<this.Ha.length;b++)a+=2,a+=this.Gb[b].byteLength;return a+super.a()}write(a){super.write(a);yE(a,this.version);yE(a,this.g);yE(a,this.h);yE(a,this.level);yE(a,255);yE(a,224|this.Ha.length);for(var b=0;b<this.Ha.length;b++)AE(a,this.Ha[b].length),_.Ki(a,this.Ha[b]);yE(a,this.Gb.length);for(b=0;b<this.Gb.length;b++)AE(a,this.Gb[b].length),_.Ki(a,this.Gb[b]);a.getPosition()}},kF=class extends gG{constructor(a){super("esds",0,
44
- 0);this.zb=a}a(){return 22+(this.zb.byteLength+3)+super.a()}write(a){super.write(a);yE(a,3);yE(a,23+this.zb.byteLength);AE(a,1);yE(a,0);yE(a,4);yE(a,15+this.zb.byteLength);yE(a,64);yE(a,21);zE(a,0);_.L(a,0);_.L(a,0);yE(a,5);yE(a,this.zb.byteLength);_.Ki(a,this.zb);_.Ki(a,new Uint8Array([6,1,2]));a.getPosition()}},fF=class extends gG{constructor(a=""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.Ki(a,DE(this.location));
45
- a.getPosition()}},eF=class extends gG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},nF=class extends SE{constructor(){super(_.ie)}},gF=class extends gG{constructor(){super(_.ke,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);
46
- _.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},oF=class extends gG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},pF=class extends gG{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();
47
- return a+super.a()}write(a){super.write(a);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},rF=class extends gG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},qF=class extends gG{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);
48
- _.L(a,0);_.L(a,0);a.getPosition()}},mF=class extends gG{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);CE(a,0);AE(a,0);a.getPosition()}},sF=class extends SE{constructor(){super("dinf")}},tF=class extends SE{constructor(){super(_.qd)}},uF=class extends SE{constructor(){super(_.md)}},MF=class extends gG{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);1===this.version?xE(a,this.g):_.L(a,this.g);
49
- a.getPosition()}},BF=class extends gG{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.L(a,this.g);a.getPosition()}},DF=class extends gG{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&kG&&(a+=4);this.flags&lG&&(a+=4);for(let b=0;b<this.g;b++)this.flags&mG&&(a+=4),this.flags&nG&&(a+=4),this.flags&oG&&(a+=4),this.flags&pG&&(a+=4);return a+super.a()}write(a){super.write(a);_.L(a,
50
- this.g);this.flags&kG&&(a.getPosition(),BE(a,this.j));this.flags&lG&&_.L(a,this.m);for(let b=0;b<this.g;b++)this.flags&mG&&_.L(a,this.o[b]),this.flags&nG&&_.L(a,this.sampleSize[b]),this.flags&oG&&_.L(a,this.A[b]),this.flags&pG&&(0===this.version?_.L(a,this.h[b]):BE(a,this.h[b]));a.getPosition()}},kG=1,lG=4,mG=256,nG=512,oG=1024,pG=2048,CF=class extends gG{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&qG&&(a+=8);this.flags&rG&&(a+=4);this.flags&
51
- sG&&(a+=4);this.flags&tG&&(a+=4);this.flags&uG&&(a+=4);return a+super.a()}write(a){super.write(a);_.L(a,this.g);this.flags&qG&&xE(a,this.h);this.flags&rG&&_.L(a,this.A);this.flags&sG&&_.L(a,this.j);this.flags&tG&&_.L(a,this.o);this.flags&uG&&_.L(a,this.m);a.getPosition()}},qG=1,rG=2,sG=8,tG=16,uG=32,IF=class extends SE{constructor(){super("traf")}},JF=class extends SE{constructor(){super("moof")}},HF=class extends SE{constructor(){super(_.ld);this.g=new Uint8Array(0)}a(){return this.g.byteLength+
52
- super.a()}write(a){super.write(a);0<this.g.byteLength&&_.Ki(a,this.g)}},VE=class extends gG{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);yE(a,0);0===this.version?yE(a,0):yE(a,0);yE(a,this.g);yE(a,this.h);_.Ki(a,_.vi(this.m));if(1===this.g&&0===this.h){yE(a,0);for(let b=0;b<this.j.length;b++)yE(a,this.j[b])}a.getPosition()}},XE=class extends gG{constructor(a,b){super("schm",
53
- 0,0);this.g=a;this.h=b;this.vb=""}a(){let a=8;this.flags&1&&(a+=DE(this.vb).byteLength);return a+super.a()}write(a){super.write(a);_.Ki(a,DE(this.g));_.L(a,this.h);this.flags&1&&_.Ki(a,DE(this.vb));a.getPosition()}},WE=class extends SE{constructor(a){super("frma");this.g=a}a(){return DE(this.g).byteLength+super.a()}write(a){super.write(a);_.Ki(a,DE(this.g));a.getPosition()}},NF=class extends gG{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&&(_.L(a,0),_.L(a,0));_.L(a,1);for(let b=0;1>b;b++)0===this.version?_.L(a,this.offset[b]):xE(a,this.offset[b]);a.getPosition()}},OF=class extends gG{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&&(_.L(a,0),_.L(a,0));yE(a,this.g);_.L(a,this.h);if(0===this.g)for(let b=0;b<this.h;b++)yE(a,
55
- this.j[b]);a.getPosition()}},GF=class extends gG{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].oe.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].rc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.L(a,this.h);this.flags&1&&yE(a,this.j);for(let b=0;b<this.h;b++)if(_.Ki(a,this.g[b].oe),this.flags&2){AE(a,this.g[b].rc);for(let c=0;c<this.g[b].rc;c++)AE(a,this.g[b].Ud[c].ee),_.L(a,this.g[b].Ud[c].fe)}a.getPosition()}};var LF=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))}},KE=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,LE=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,ME=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,NE=/^(\d*\.?\d*)f$/,OE=/^(\d*\.?\d*)t$/,PE=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var zF=class{constructor(a){this.a=a;this.f=RE(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=RE(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var FF=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var vG=class{constructor(){this.A=this.j=this.h=this.g=null;this.N=1;this.W=0;this.o="";this.B=this.a=null;this.f=new _.N("clpp.smooth.SmoothParser");this.K=!1;this.m=this.C=null;this.R=XF;this.H=0;this.F=this.I=Infinity;this.w=[];this.M=this.V.bind(this)}configure(a){this.h=a}start(a,b){this.g=b;a=[...new Set([a,EE(a)])];return TF(this,a).then(c=>aG(this,c.data).then(()=>{bG(this,this.C);return this.j}))}stop(){this.g&&this.g.networkingEngine.Nd(this.M);this.C=this.A=this.j=this.h=this.g=null;this.m&&
56
- (clearTimeout(this.m),this.m=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.D())return TF(this,[this.o]).then(a=>aG(this,a.data).then(()=>this.j)).catch(a=>{if(this.g)this.g.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}T(){this.f.debug(_.lt);this.g&&(this.m=null,this.update().then(()=>{bG(this,this.C)}).catch(a=>{this.g&&(this.g.onError(a),1===a.severity&&bG(this,100))}))}D(){return this.R===WF}J(){return 0<this.w.length}S(a){let b=null;if(this.w.length)for(let c=
57
- 0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[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.A.timescale,c={isLive:this.D.bind(this),Uc:this.J.bind(this),mf:()=>1,Pc:this.S.bind(this)};let d=!1;const e=new _.G(_.F,3,4035,null);let f=null;try{f=PF(a,b,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)}},eG={video:_.Fe,
58
- audio:_.Zb,text:_.Rb},XF="VOD",WF="LIVE",fG={Yf:"caption",Zf:_.At};_.y("clpp.smooth.SmoothComponent",class extends _.bp{constructor(){super()}f(){_.cn.ism=vG;_.an[_.Sb]=vG}a(){_.Du("ism");_.Eu(_.Sb)}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 PE="Full MP4 box must have flags defined",QE="clpp.smooth.SmoothMP4Processor",RE="codecPrivateData",SE=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.L(a,c);_.L(a,b)},TE=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.pj()}},UE=function(a,b){TE(a,b>>16&255);TE(a,b>>8&255);TE(a,b&255)},VE=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.pj()}},WE=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.pj()}},XE=function(a,b){try{a.f.setInt16(a.a,
2
+ b,a.g),a.a+=2}catch(c){_.pj()}},YE=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},ZE=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},$E=function(a,b,c,d){c=b.pe[c];b=b.Zf;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 _.ou([a],[b])[0]},aF=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.v?c=["maxWidth","maxHeight","bitrate",RE,"fourCC"]:a.type===_.Yb&&(c=["bitrate",RE,"channels","bitsPerSample","samplingRate","fourCC"]);return _.qf(a,b,c,["id","segmentIndex"])},bF=function(a,b,c){const d=c.Nc.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ha:null,Jb:null,width:NaN,height:NaN,Cb:null,Hc:NaN,
4
+ sampleSize:NaN,channelCount:NaN};switch(c.type){case _.v:a.Ha=[_.bj(d[1])];a.Jb=[_.bj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Yb:a.Cb=_.bj(c.Nc),a.sampleSize=c.Ye||16,a.Hc=c.Hc,a.channelCount=c.le}return a},cF=function(a,b){return a.filter(c=>c.type===b)},dF=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)},kF=function(a,b,c){var d=null;if(eF.test(a)){{a=eF.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 fF.test(a)?d=dF(fF,a):gF.test(a)?d=dF(gF,a):hF.test(a)?(a=hF.exec(a),d=Number(a[1])/c.frameRate):iF.test(a)?(a=iF.exec(a),d=Number(a[1])/c.a):jF.test(a)&&(d=dF(jF,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},lF=function(a){let b=
6
+ 0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Jj(b)},sF=function(a,b,c){a:{var d=[_.Hc,_.Gc];for(e of d)if((d=c.Sc(e))&&d.keyId){var e=d.keyId;break a}_.B(QE,"Could not get default Key ID for DRM init data!");e=null}c=new mF("xxxx");a.type===_.v?c=new nF(a.width,a.height):c=new oF(a.channelCount,a.sampleSize,a.Hc);a=new pF;a.g=1;a.h=8;a.m=e||"00000000000000000000000000000000";a=(new mF("schi")).append([a]);b=(new mF(_.ge)).append([new qF(b),new rF(_.qc,65536),a]);c.append([b]);return c},
7
+ VF=function(a,b){var c=b.Xc(),d=new tF(a.timescale,a.duration,a.id),e=(new uF).append([new vF(a.id)]),f=new wF(a.id,a.duration,a.timescale,a.width,a.height),g=new xF(a.timescale,a.duration);const h=new yF(a.type);var k=null,l=new zF;l.entries=[new AF];var m=new BF;switch(a.type){case _.v:k=new CF(a.Ha,a.Jb);c?(a=sF(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new DF(a.width,a.height)).append([k]),m.entries=[a]);k=new EF;break;case _.Yb:k=new FF(a.Cb),c?(a=sF(a,"mp4a",b),a.append([k]),m.entries=[a]):
8
+ (a=(new GF(a.channelCount,a.sampleSize,a.Hc)).append([k]),m.entries=[a]),k=new HF}m=(new IF).append([m,new JF,new KF,new LF,new MF]);l=(new NF).append([l]);l=(new OF).append([k,l,m]);g=(new PF).append([g,h,l]);f=(new QF).append([f,g]);d=(new RF).append([d,f,e]);e=new SF("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Sc(_.Gc),b=b.Sc(_.Hc),c&&d.append([new TF("pssh",c.initData,8)]),b&&d.append([new TF("pssh",b.initData,8)]),c||b||_.B(QE,"Could not get PSSH init data!"));b=new UF([e,d]);return _.G(b.write())},
9
+ eG=function(a,b){let c,d,e,f,g,h;(new _.Hj).N("moof",_.N).Y("mfhd",k=>{{const l=new WF;l.g=_.M(k.H);c=l}}).N("traf",_.N).Y("tfhd",k=>{{const l=k.H.wa();if(null===k.flags)throw new _.H(_.F,3,3019,PE);const m=new XF(k.version||0,k.flags||0);m.g=_.M(k.H);0<l-k.H.getPosition()&&k.flags&1&&(m.h=_.xj(k.H));0<l-k.H.getPosition()&&k.flags&2&&(m.A=_.M(k.H));0<l-k.H.getPosition()&&k.flags&8&&(m.j=_.M(k.H));0<l-k.H.getPosition()&&k.flags&16&&(m.o=_.M(k.H));0<l-k.H.getPosition()&&k.flags&32&&(m.m=_.M(k.H));d=
10
+ m}}).Y("trun",k=>{{var l=k.H.wa();if(null===k.flags)throw new _.H(_.F,3,3019,PE);const m=new YF(k.version||0,k.flags||0);m.g=_.M(k.H);0<l-k.H.getPosition()&&k.flags&1&&(m.j=_.vj(k.H));0<l-k.H.getPosition()&&k.flags&4&&(m.m=_.M(k.H));if(0<l-k.H.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.o.push(_.M(k.H)),k.flags&512&&m.sampleSize.push(_.M(k.H)),k.flags&1024&&m.A.push(_.M(k.H)),k.flags&2048&&(0===k.version?m.h.push(_.M(k.H)):m.h.push(_.vj(k.H)));e=m}}).Y("sdtp",k=>{{const l=_.yj(k.H,k.H.wa());f=
11
+ new ZF("sdtp",k.version||0,k.flags||0,l,0)}}).N("uuid",k=>{var l=_.yj(k.H,16);if(_.dj(l,$F)){l=_.M(k.H);k.version=l>>>24;k.flags=l&16777215;l=new aG(k.version,k.flags);l.h=_.M(k.H);k.flags&1&&(l.j=_.tj(k.H));for(let m=0;m<l.h;m++){const n={se:_.yj(k.H,8),tc:0,Yd:[]};if(k.flags&2){n.tc=_.uj(k.H);for(let q=0;q<n.tc;q++){const t={je:0,ke:0};t.je=_.uj(k.H);t.ke=_.M(k.H);n.Yd.push(t)}}l.g.push(n)}g=l}}).N(_.qd,k=>{{const l=new bG;0<k.H.wa()?l.g=_.yj(k.H,k.H.wa()):(_.B(QE,"mdat box is empty!"),l.g=new Uint8Array(0));
12
+ h=l}}).parse(a,!1);if(!h)return null;a=(new cG).append([d,e]);f&&a.append([f]);b.Xc()&&g&&a.append([g]);b=(new dG).append([c,a]);return new UF([b,h])},jG=function(a,b,c){var d=c.Xc(),e=a.request.startTime,f=parseInt(e*b,10);b=a.data||new ArrayBuffer(0);var g=eG(b,c);if(null===g)return a.request.contentType===_.r?a.data:g;c=g.get(_.qd);if(a.request.contentType===_.r){d=c.g.buffer;if(e){d=_.Dg(d);if((d=(new DOMParser).parseFromString(d,_.te))&&"tt"===d.documentElement.tagName.toLowerCase())var h=d.documentElement;
13
+ if(h&&(c=new fG(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=e;b=c;g=["begin",_.Vc];for(let y=0,A=g.length;y<A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const E=l.length;for(;n<E;n++){var q=l[n].name;if(q=q.match(m)){k=
14
+ k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[y],kF(k||"",a,b))}}}d=(new XMLSerializer).serializeToString(d);e=_.Eg(d).buffer}else e=d;return e}h=new dG;a=g.get("mfhd");b=new cG;k=g.get("tfhd");m=new gG(1,f);f=g.get("trun");n=g.get("sdtp");e=g.get("senc");k.g=1;k.flags&=16777214;k.flags|=131072;b.append([k,m,f]);n&&b.append([n]);if(d){g=0;k=[];if(e.flags&2)for(k=[],m=0;m<e.h;m++)k.push(10+6*e.g[m].tc);else g=8;b.append([e,new hG,new iG(g,k,e.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;c=new UF([h,
15
+ c]);h=c.write();d&&(d=c.get("saio"),c=c.f,d.offset[0]=e.start+16,c.seek(d.start),d.write(c),h=c.buffer);return h},kG=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},lG=function(a){return{initData:_.fu(_.pk(a)),initDataType:_.qc,keyId:a,periodId:null}},mG=function(a,b,c){a=_.xk(a);c&&a.version!==c&&(a=_.hu(a,c));return{initData:_.fu(a),
16
+ initDataType:_.qc,keyId:b,periodId:null}},nG=function(a,b){return _.w(function*(){var c=_.Yg(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;c.type=1;c=yield a.D.networkingEngine.fetch(c).R;a.m=c.uri;return c})},vG=function(a,b){let c=null;try{{const xa=new DOMParser;let ib,Na;try{const cb=_.Dg(b);
17
+ Na=xa.parseFromString(cb.trim(),_.te)}catch(cb){throw cb;}Na&&Na.documentElement.tagName==_.jb&&(ib=Na.documentElement);c=ib&&0<ib.getElementsByTagName("parsererror").length?null:ib}}catch(xa){}if(!c)throw a.f.error("Unable to parse manifest"),new _.H(_.F,4,4033,a.m);const d=+oG(a,c,"MajorVersion"),e=+oG(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||1E7;let g=+oG(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||
18
+ Infinity,m=_.jk(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.f.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.F,4,4036,a.m);h?(pG(a,qG),a.B=typeof a.g.liveRefreshPeriod===_.p?1E3*a.g.liveRefreshPeriod:Math.min(1E3*a.G,1E4),g=Infinity):pG(a,rG);a.a={startTime:0,delay:0,duration:g/f,nd:l/f,Cc:0};if(m){{var n=a.g.playreadyVersion;const xa=[],ib=_.jk(m,"ProtectionHeader")[0],Na=_.aj(_.lk(ib)||""),cb=_.xk(Na).a;xa.push(kG(_.Hc,lG(cb),[cb]));xa.push(kG(_.Gc,mG(Na,
19
+ cb,n),[cb]));var q=xa}a.o=q}{const xa=[],ib=_.jk(c,"StreamIndex");if(!ib.length)throw a.f.error("No streams found!"),new _.H(_.F,4,4034,a.m);for(let Na=0;Na<ib.length;Na++){{var t=a,u=ib[Na];const cb=oG(t,u,"Type"),ic=+u.getAttribute("Chunks"),Qg=u.getAttribute("Subtype"),Fe=_.Kh(u.getAttribute("Language")||_.xe),Kd=u.getAttribute("Name")||"",Rg=+u.getAttribute(_.La),Af=+u.getAttribute(_.Ka),Bf=oG(t,u,"Url"),Dk=+u.getAttribute("TimeScale")||null;{const jc=[],li=_.jk(u,_.Ya);for(let Ld=0;Ld<li.length;Ld++){{let kc,
20
+ Ia,hd;var y=t,A=li[Ld],E=cb;const mi=+A.getAttribute("Index"),Cf=+oG(y,A,"Bitrate");let Ob=NaN,Df=NaN,Ek=NaN,mp=NaN,uy=NaN,vy=NaN,wy=NaN;const xy=A.getAttribute("FourCC");switch(E){case _.v:Ob=+oG(y,A,_.Ka);Df=+oG(y,A,_.La);break;case _.Yb:mp=+A.getAttribute("Channels")||2,Ek=+oG(y,A,"SamplingRate"),vy=+oG(y,A,"AudioTag"),uy=+oG(y,A,"BitsPerSample"),wy=+oG(y,A,"PacketSize")}let np=String(A.getAttribute("CodecPrivateData"));if(E===_.Yb&&!np){{var D=mp;const yy={96E3:0,88200:1,64E3:2,48E3:3,44100:4,
21
+ 32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Fk=yy[Ek];if("AACH"===xy){Ia=new Uint8Array(4);const zy=yy[2*Ek];Ia[0]=40|Fk>>1;Ia[1]=Fk<<7|D<<3|zy>>1;Ia[2]=zy<<7|8;Ia[3]=0;kc=new Uint16Array(2);kc[0]=(Ia[0]<<8)+Ia[1];kc[1]=(Ia[2]<<8)+Ia[3];hd=kc[0].toString(16)+kc[1].toString(16)}else Ia=new Uint8Array(2),Ia[0]=16|Fk>>1,Ia[1]=Fk<<7|D<<3,kc=new Uint16Array(1),kc[0]=(Ia[0]<<8)+Ia[1],hd=kc[0].toString(16);np=hd.toUpperCase()}}var ma={id:y.V++,type:E,index:mi,bitrate:Cf,Nc:np,maxHeight:Ob,
22
+ maxWidth:Df,Hc:Ek,le:mp,hg:vy,Ye:uy,rg:wy,nf:xy,segmentIndex:null}}jc.push(ma)}var na=jc}{const jc=[],li=_.jk(u,"c");for(let Ld=0;Ld<li.length;Ld++){const kc=li[Ld];let Ia=parseInt(kc.getAttribute("t"),10),hd=parseInt(kc.getAttribute("d"),10),mi=parseInt(kc.getAttribute("r"),10),Cf=0;if(isNaN(Ia)&&isNaN(hd))throw t.f.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.H(_.F,4,4037,t.m);0===Ld&&isNaN(Ia)&&(Cf=Ia=0);if(0<Ld){const Ob=jc[jc.length-
23
+ 1];Cf=Ob.n+1;Ob.d||(Ob.d=Ia-Ob.t);Ia||(Ia=Ob.t+Ob.d);hd||(hd=Ia-Ob.t)}jc.push({n:Cf,d:hd,t:Ia});if(mi){mi--;for(let Ob=0;Ob<mi;Ob++){const Df=jc[jc.length-1];Cf=Df.n+1;Ia=Df.t+Df.d;hd=Df.d;jc.push({n:Cf,d:hd,t:Ia})}}}t.C()||jc.length===ic||t.f.warn("Number of fragments ("+ic+") differs from number of chunks ("+jc.length+").");var uf=jc}var vf={type:cb,jg:ic,Vf:Qg,language:Fe,name:Kd,maxWidth:Rg,maxHeight:Af,Zf:Bf,tracks:na,pe:uf,timescale:Dk}}xa.push(vf)}var wf=xa}const Ra={pg:d,ve:e,timescale:f,
24
+ duration:g,isLive:h,og:k,nd:l,wd:!1,streams:wf};if(a.h&&a.w)return sG(a,Ra),Promise.resolve();{const xa=Ra.timescale,ib=Ra.duration,Na=cF(Ra.streams,_.Yb),cb=cF(Ra.streams,_.v),ic=cF(Ra.streams,_.r),Qg=[];let Fe=tG(a,ib,xa,Na),Kd=tG(a,ib,xa,cb);const Rg=tG(a,ib,xa,ic);Fe.length||(Fe=[null]);Kd.length||(Kd=[null]);for(let Af=0;Af<Kd.length;Af++)for(let Bf=0;Bf<Fe.length;Bf++)Qg.push(uG(a,Kd[Af],Fe[Bf]));var fd={startTime:0,variants:Qg,textStreams:Rg,thumbStreams:[]}}{var id=Ra.streams;let xa=a.a.startTime,
25
+ ib=a.a.delay;const Na=a.I;let cb=Math.min(a.a.duration||Infinity,Na);const ic=a.C(),Qg=a.a.nd,Fe=a.a.Cc,Kd=a.G,Rg=isFinite(a.F)?a.F:0;if(ic)cb=Infinity,xa=Date.now()/1E3-Fe,a.a.startTime=xa,ib=3*Kd;else{const Af=isFinite(Na)?Na:a.a.duration;for(const Bf of id)for(const Dk of Bf.tracks)Dk.segmentIndex.offset(-Rg),_.Zu(Dk.segmentIndex,Af)}a.A=new _.tz(xa,ib,!ic,!0);a.A.Mb(cb);_.Mu(a.A,Kd);a.A.ac=Qg;ic||a.A.offset(-Rg)}a.D.filterAllPeriods([fd]);a.h={presentationTimeline:a.A,periods:[fd],offlineSessionIds:[],
26
+ minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.ed(a.L),a.K=!0);a.w=Ra;return Promise.resolve()},wG=function(a,b){null!=a.B&&null!=b&&(a.j=window.setTimeout(a.wb.bind(a),b))},oG=function(a,b,c){if(b=b.getAttribute(c))return b;a.f.error("required attribute not provided: "+c);throw new _.H(_.F,4,4038,a.m,c);},pG=function(a,b){const c=b===rG;if(a.h&&a.h.presentationTimeline){var d=a.h.presentationTimeline;d.j=c;d.m=c}c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.B=null);a.O=b},sG=
27
+ 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){aF(g,c)||a.f.warn("The current stream is updated with a stream that seems to have different base properties!");var d=xG(a,a.w.timescale,f,c);c=g.segmentIndex;_.Vu(c,d);(d=a.a.nd)&&_.Wu(c,_.Tu(c)-d)}else a.f.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},xG=function(a,
28
+ b,c,d){let e=0;const f=[],g=c.timescale||b;c.pe.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=$E(a.m,c,k,d);a.G=Math.max(a.G,l);f.push(new _.Uu(k,h,m,()=>[n],0,null,0,null,!0,g));e+=l});if(c.type===_.v||c.type===_.Yb)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Cc?a.a.Cc=b.endTime:a.a.Cc=Math.min(a.a.Cc,b.endTime);return f},tG=function(a,b,c,d){let e=[];for(let f=0;f<d.length;f++){const g=d[f].tracks.map(h=>{var k=d[f],l=xG(a,c,k,h),m=new _.uz(l),
29
+ n=null;k.type!==_.r&&(n=yG(a,b,c,k,h));h.segmentIndex=m;l=a.M++;var q=Promise.resolve.bind(Promise),t=m.f.bind(m),u=m.get.bind(m),y=m.g.bind(m);m=m.getDuration.bind(m);var A=zG[k.type];var E="";switch(k.type){case _.v:E=h.Nc;var D=/00000001[0-9]7/.exec(E);E="avc1."+(D&&D[0]?E.substr(E.indexOf(D[0])+10,6):"42c00c");a.f.debug("VIDEO CODECS: ",E);break;case _.Yb:E=h.Nc,D=2,"AACH"===h.nf?D=5:E&&(D=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+D,a.f.debug("AUDIO CODECS: ",E)}D=k.type===_.r?AG[k.Vf]:
30
+ void 0;return h={id:l,originalId:null,tg:null,createSegmentIndex:q,findSegmentPosition:t,getSegmentReference:u,adjustSegmentDurations:y,getDuration:m,segmentIndex:null,segmentLookupStrategy:_.Qt,initSegmentReference:n,mimeType:A,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,emsgSchemeIdUris:null,roles:[],channelsCount:h.le||null,closedCaptions:null}});
31
+ e=e.concat(g)}return e},uG=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.xe;return c||b?{id:a.M++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},yG=function(a,b,c,d,e){b=bF(b,d.timescale||c,e);c={isLive:a.C.bind(a),Xc:a.J.bind(a),tf:()=>1,Sc:a.S.bind(a)};d=new Uint8Array(0);try{d=VF(b,c)}catch(g){throw a.f.error("Failed to generate initialization segment."),new _.H(_.F,3,4035,g);}const f="data:text/plain;base64,"+
32
+ _.$i(d);return new _.sz(()=>[f],0,null,null,!0)},mF=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;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(let c=
33
+ 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?_.L(a,1):_.L(a,this.size);_.qj(a,YE(this.type));this.size>b&&SE(a,this.size);"uuid"===this.type&&_.qj(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()}},BG=class extends mF{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);TE(a,
34
+ this.version);UE(a,this.flags)}},TF=class extends mF{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);_.qj(a,this.g,this.offset);a.getPosition()}},ZF=class extends BG{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);_.qj(a,this.g,this.offset);a.getPosition()}},SF=class extends mF{constructor(a,b,c){super("ftyp");this.h=a;this.ve=b;this.g=
35
+ c}a(){let a=this.h.length;a=a+4+this.g.join("").length;return a+super.a()}write(a){super.write(a);_.qj(a,YE(this.h));_.L(a,this.ve);_.qj(a,YE(this.g.join("")));a.getPosition()}},RF=class extends mF{constructor(){super(_.wd)}},QF=class extends mF{constructor(){super(_.ve)}},tF=class extends BG{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,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?
36
+ a+28:a+16;a=a+44+this.g.length;return a+=super.a()}write(a){super.write(a);1===this.version?(SE(a,0),SE(a,0),_.L(a,this.timescale),SE(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.timescale),_.L(a,this.duration*this.timescale));_.L(a,65536);VE(a,this.volume);VE(a,0);_.L(a,0);_.L(a,0);for(let b=0;b<this.g.length;b++)TE(a,this.g[b]);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,0);_.L(a,this.h);a.getPosition()}},uF=class extends mF{constructor(){super("mvex")}},vF=class extends BG{constructor(a){super("trex",
37
+ 0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.L(a,this.g);_.L(a,1);_.L(a,0);_.L(a,0);_.L(a,0);a.getPosition()}},wF=class extends BG{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+this.g.length;return a+super.a()}write(a){super.write(a);1===this.version?(SE(a,0),SE(a,0),_.L(a,
38
+ this.h),_.L(a,0),SE(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.h),_.L(a,0),_.L(a,this.duration*this.timescale));_.L(a,0);_.L(a,0);VE(a,0);VE(a,0);VE(a,this.volume);VE(a,0);for(let b=0;b<this.g.length;b++)TE(a,this.g[b]);VE(a,this.width);VE(a,0);VE(a,this.height);VE(a,0);a.getPosition()}},xF=class extends BG{constructor(a,b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956}a(){let a=0;a=1===this.version?a+28:a+16;return a+4+super.a()}write(a){super.write(a);
39
+ 1===this.version?(SE(a,0),SE(a,0),_.L(a,this.timescale),SE(a,this.duration*this.timescale)):(_.L(a,0),_.L(a,0),_.L(a,this.timescale),_.L(a,this.duration*this.timescale));VE(a,this.language);VE(a,0);a.getPosition()}},yF=class extends BG{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.L(a,0);this.g===_.v?_.qj(a,YE("vide")):_.qj(a,YE("soun"));_.L(a,0);_.L(a,0);_.L(a,0);this.g===_.v?_.qj(a,YE("VideoHandler\x00")):_.qj(a,YE("SoundHandler\x00"));a.getPosition()}},
40
+ EF=class extends BG{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);VE(a,0);_.qj(a,this.g);a.getPosition()}},CG=class extends mF{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.L(a,0);VE(a,0);VE(a,1)}},DG=class extends CG{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);VE(a,0);VE(a,0);_.L(a,0);_.L(a,0);_.L(a,0);VE(a,
41
+ this.width);VE(a,this.height);_.L(a,4718592);_.L(a,4718592);_.L(a,0);VE(a,1);TE(a,10);_.qj(a,YE("AVC Coding",31));VE(a,this.depth);XE(a,-1)}},EG=class extends CG{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);_.L(a,0);_.L(a,0);VE(a,this.channelCount);VE(a,this.sampleSize);XE(a,0);VE(a,0);VE(a,this.sampleRate);VE(a,0)}},DF=class extends DG{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);
42
+ for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},nF=class extends DF{constructor(a,b){super(a,b);this.type="encv"}},GF=class extends EG{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()}},oF=class extends GF{constructor(a,b,c){super(a,b,c);this.type="enca"}},CF=class extends mF{constructor(a,b){super("avcC");this.Ha=a;this.Jb=b;this.version=1;this.g=this.Ha[0][1];this.h=this.Ha[0][2];this.level=this.Ha[0][3]}a(){let a=
43
+ 7;for(var b=0;b<this.Ha.length;b++)a+=2,a+=this.Ha[b].byteLength;for(b=0;b<this.Ha.length;b++)a+=2,a+=this.Jb[b].byteLength;return a+super.a()}write(a){super.write(a);TE(a,this.version);TE(a,this.g);TE(a,this.h);TE(a,this.level);TE(a,255);TE(a,224|this.Ha.length);for(var b=0;b<this.Ha.length;b++)VE(a,this.Ha[b].length),_.qj(a,this.Ha[b]);TE(a,this.Jb.length);for(b=0;b<this.Jb.length;b++)VE(a,this.Jb[b].length),_.qj(a,this.Jb[b]);a.getPosition()}},FF=class extends BG{constructor(a){super("esds",0,
44
+ 0);this.Cb=a}a(){return 22+(this.Cb.byteLength+3)+super.a()}write(a){super.write(a);TE(a,3);TE(a,23+this.Cb.byteLength);VE(a,1);TE(a,0);TE(a,4);TE(a,15+this.Cb.byteLength);TE(a,64);TE(a,21);UE(a,0);_.L(a,0);_.L(a,0);TE(a,5);TE(a,this.Cb.byteLength);_.qj(a,this.Cb);_.qj(a,new Uint8Array([6,1,2]));a.getPosition()}},AF=class extends BG{constructor(a=""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.qj(a,YE(this.location));
45
+ a.getPosition()}},zF=class extends BG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},IF=class extends mF{constructor(){super(_.le)}},BF=class extends BG{constructor(){super(_.ne,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);
46
+ _.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},JF=class extends BG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},KF=class extends BG{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();
47
+ return a+super.a()}write(a){super.write(a);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},MF=class extends BG{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);_.L(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},LF=class extends BG{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);
48
+ _.L(a,0);_.L(a,0);a.getPosition()}},HF=class extends BG{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);XE(a,0);VE(a,0);a.getPosition()}},NF=class extends mF{constructor(){super("dinf")}},OF=class extends mF{constructor(){super(_.vd)}},PF=class extends mF{constructor(){super(_.rd)}},gG=class extends BG{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);1===this.version?SE(a,this.g):_.L(a,this.g);
49
+ a.getPosition()}},WF=class extends BG{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.L(a,this.g);a.getPosition()}},YF=class extends BG{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&FG&&(a+=4);this.flags&GG&&(a+=4);for(let b=0;b<this.g;b++)this.flags&HG&&(a+=4),this.flags&IG&&(a+=4),this.flags&JG&&(a+=4),this.flags&KG&&(a+=4);return a+super.a()}write(a){super.write(a);_.L(a,
50
+ this.g);this.flags&FG&&(a.getPosition(),WE(a,this.j));this.flags&GG&&_.L(a,this.m);for(let b=0;b<this.g;b++)this.flags&HG&&_.L(a,this.o[b]),this.flags&IG&&_.L(a,this.sampleSize[b]),this.flags&JG&&_.L(a,this.A[b]),this.flags&KG&&(0===this.version?_.L(a,this.h[b]):WE(a,this.h[b]));a.getPosition()}},FG=1,GG=4,HG=256,IG=512,JG=1024,KG=2048,XF=class extends BG{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&LG&&(a+=8);this.flags&MG&&(a+=4);this.flags&
51
+ NG&&(a+=4);this.flags&OG&&(a+=4);this.flags&PG&&(a+=4);return a+super.a()}write(a){super.write(a);_.L(a,this.g);this.flags&LG&&SE(a,this.h);this.flags&MG&&_.L(a,this.A);this.flags&NG&&_.L(a,this.j);this.flags&OG&&_.L(a,this.o);this.flags&PG&&_.L(a,this.m);a.getPosition()}},LG=1,MG=2,NG=8,OG=16,PG=32,cG=class extends mF{constructor(){super("traf")}},dG=class extends mF{constructor(){super("moof")}},bG=class extends mF{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&&_.qj(a,this.g)}},pF=class extends BG{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);TE(a,0);0===this.version?TE(a,0):TE(a,0);TE(a,this.g);TE(a,this.h);_.qj(a,_.bj(this.m));if(1===this.g&&0===this.h){TE(a,0);for(let b=0;b<this.j.length;b++)TE(a,this.j[b])}a.getPosition()}},rF=class extends BG{constructor(a,b){super("schm",
53
+ 0,0);this.g=a;this.h=b;this.yb=""}a(){let a=8;this.flags&1&&(a+=YE(this.yb).byteLength);return a+super.a()}write(a){super.write(a);_.qj(a,YE(this.g));_.L(a,this.h);this.flags&1&&_.qj(a,YE(this.yb));a.getPosition()}},qF=class extends mF{constructor(a){super("frma");this.g=a}a(){return YE(this.g).byteLength+super.a()}write(a){super.write(a);_.qj(a,YE(this.g));a.getPosition()}},hG=class extends BG{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&&(_.L(a,0),_.L(a,0));_.L(a,1);for(let b=0;1>b;b++)0===this.version?_.L(a,this.offset[b]):SE(a,this.offset[b]);a.getPosition()}},iG=class extends BG{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&&(_.L(a,0),_.L(a,0));TE(a,this.g);_.L(a,this.h);if(0===this.g)for(let b=0;b<this.h;b++)TE(a,
55
+ this.j[b]);a.getPosition()}},aG=class extends BG{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].se.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].tc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.L(a,this.h);this.flags&1&&TE(a,this.j);for(let b=0;b<this.h;b++)if(_.qj(a,this.g[b].se),this.flags&2){VE(a,this.g[b].tc);for(let c=0;c<this.g[b].tc;c++)VE(a,this.g[b].Yd[c].je),_.L(a,this.g[b].Yd[c].ke)}a.getPosition()}};var fG=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))}},eF=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,fF=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,gF=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,hF=/^(\d*\.?\d*)f$/,iF=/^(\d*\.?\d*)t$/,jF=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var UF=class{constructor(a){this.a=a;this.f=lF(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=lF(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var $F=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var QG=class{constructor(){this.w=this.h=this.g=this.D=null;this.M=1;this.V=0;this.m="";this.A=this.a=null;this.f=new _.O("clpp.smooth.SmoothParser");this.K=!1;this.j=this.B=null;this.O=rG;this.G=0;this.F=this.I=Infinity;this.o=[];this.L=this.T.bind(this)}configure(a){this.g=a}start(a,b){this.D=b;a=[...new Set([a,ZE(a)])];return nG(this,a).then(c=>vG(this,c.data).then(()=>{wG(this,this.B);return this.h}))}stop(){this.D&&this.D.networkingEngine.Rd(this.L);this.B=this.w=this.h=this.g=this.D=null;this.j&&
56
+ (clearTimeout(this.j),this.j=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.C())return nG(this,[this.m]).then(a=>vG(this,a.data).then(()=>this.h)).catch(a=>{if(this.D)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}wb(){this.f.debug(_.Jt);this.D&&(this.j=null,this.update().then(()=>{wG(this,this.B)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&wG(this,100))}))}C(){return this.O===qG}J(){return 0<this.o.length}S(a){let b=null;if(this.o.length)for(let c=
57
+ 0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b}T(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.w.timescale,c={isLive:this.C.bind(this),Xc:this.J.bind(this),tf:()=>1,Sc:this.S.bind(this)};let d=!1;const e=new _.H(_.F,3,4035,null);let f=null;try{f=jG(a,b,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)}},zG={video:_.Ie,
58
+ audio:_.bc,text:_.Vb},rG="VOD",qG="LIVE",AG={dg:"caption",eg:_.Yt};_.x("clpp.smooth.SmoothComponent",class extends _.Ep{constructor(){super()}f(){_.Fn.ism=QG;_.Dn[_.Wb]=QG}a(){_.bv("ism");_.cv(_.Wb)}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 cs="No thumbnail duration or URL specified",ds="No thumbnail found for position ",es="Position is out of range: ",fs="Thumbnail URL is mandatory",gs="Wrong gridSize format",hs="clpp.thumbnails",js=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.xd&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>is(a,0,e,!!f))},Promise.resolve())},is=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return ks(a,d).then(()=>a.a[b].load()).then(()=>is(a,e,
2
- c,d))},ks=function(a,b){return new Promise(c=>{if(b||a.g.getState()!==_.dl)c();else a.g.one(_.dc,()=>{c()})})},ls=function(a){const b=a.f.byteLength;a.a.forEach(c=>{c.offset+c.length<b&&c.qe.resolve()})},os=function(a,b){return ms(a,b).then(c=>new ns(c,b.time,b.duration))},ms=function(a,b){return b.load().then(()=>{const c=_.K(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.si(c)})},ps=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},qs=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},rs=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{xc:c,$d:d,ne:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},ss=function(a){return a.some(b=>0<b.thumbStreams.length)},ts=function(a){if(!a)return null;a=new _.cj(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 us=class{constructor(){this.log=new _.N(hs);this.g=null;this.a=[];this.w=!1}init(a,b){this.g=a;a.one(_.Vd,()=>{this.w=!0});a.isLive()||this.m().then(()=>{b&&b.preload&&js(this,b.preload)})}};var ns=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.fa=n;this.Xe=h;this.Kf=k;this.rf=l;this.sf=m;this.ma=null}raw(){return this.fa.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(_.Jc);a.style.width=
5
- c+_.Sd;a.style.height=d+_.Sd;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.fa.naturalWidth||this.fa.width))}px ${Math.ceil(d/this.height*(this.fa.naturalHeight||this.fa.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*c+_.Sd;a.style.backgroundPositionY="-"+b*d+_.Sd;return a}load(){this.ma||(this.ma=new Promise((a,b)=>{const c=()=>{this.width||
6
- (this.width=(this.fa.naturalWidth||this.fa.width)/this.Xe);this.height||(this.height=(this.fa.naturalHeight||this.fa.height)/this.Kf);this.x||(this.x=this.width*this.rf);this.y||(this.y=this.height*this.sf)};if(this.fa.src&&this.fa.complete)c(),a(this);else{var d=null,e=()=>{c();this.fa.removeEventListener("load",e);this.fa.removeEventListener(_.Tc,d);a(this)};d=()=>{this.fa.removeEventListener("load",e);this.fa.removeEventListener(_.Tc,d);b()};this.fa.addEventListener("load",e);this.fa.addEventListener(_.Tc,
7
- d);this.fa.src=this.src}}));return this.ma}};_.y("clpp.thumbnails.Thumbnail",ns);ns.prototype.load=ns.prototype.load;ns.prototype.element=ns.prototype.element;ns.prototype.raw=ns.prototype.raw;var vs=class extends us{constructor(){super();this.f=null;this.o=this.h=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.G(_.F,7,7100,fs);if("GRID"===b.mode&&!b.gridSize)throw new _.G(_.F,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.G(_.F,7,7100,"Duration is mandatory");this.f=b;const c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(cs,c,d),new _.G(_.F,7,7100,cs);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 _.G(_.F,7,7100,gs);}catch(e){throw this.log.error("Error during parsing gridSize",e),new _.G(_.F,7,7100,gs);}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(es+a);const d=this.a[c];return d?d.load().then(()=>d):Promise.reject(ds+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 ns(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 ws=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.qe=new _.mk}load(){return this.qe}},ys=class{constructor(){this.g=new _.N(hs);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.mk}init(a,b){if(!b||!b.url)throw new _.G(_.F,7,7100,fs);const c=b.url;b=_.Hg(c);b.type=_.Gg;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,xs),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 ws(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(()=>{ls(this)}).catch(d=>{this.g.error(`[BIF] Error while loading thumbnails '
12
- + 'URL: ${c}`,d);a.onError(new _.G(1,7,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){return 0>a?Promise.reject(es+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 os(this,c).then(d=>d.load().then(()=>d))}return Promise.reject(ds+a)})}},xs=[137,66,73,70,13,10,26,10];var zs=class extends us{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.G(_.F,7,7100,fs);const c=b.url,d=_.Hg(c);d.type=_.Gg;this.f=a.getNetworkEngine().fetch(d).P.then(e=>{if(e=e.data){e=_.pg(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=ps(g[0]);g=ps(g[1])-l;this.a.push(new ns(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 _.G(1,7,2013,"Error while loading VTT thumbnails.",e))});super.init(a,b)}get(a){return 0>a?Promise.reject(es+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(ds+a)})}m(){return this.f}};var As=class extends us{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=qs(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=rs(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.ne+a]);else if((c=d.Ea())&&0<c.length){let g=0,h=0;d=d.startTime;1<e.ne&&(g=a%e.xc,h=Math.floor(a/e.xc),d+=a*e.durationPerTile);f=new ns(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.xc,e.$d,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&&!_.z(d=a.getSegmentReference(c++));){const e=rs(d,a),f=d.Ea()[0],g=new Image;let h=d.startTime;for(let k=0;k<e.$d;++k)for(let l=0;l<e.xc;++l)this.a.push(new ns(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.xc,
16
- e.$d,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var Bs=class{constructor(){this.f=new _.N(hs);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=ts(c.url||null)),b&&("SINGLE"===b||"GRID"===b?this.a=new vs:"WEBVTT"===b?this.a=new zs:"BIF"===b&&(this.a=new ys)),this.a&&(this.f.info("Loading thumbs configuration",c),this.l.one(_.jd,()=>{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();ss(c)&&(this.a=new As,this.a.init(a,b))}}}get(a){return this.a?this.a.get(a):Promise.reject()}id(){return"thumbnails"}};_.y("clpp.thumbnails.ThumbnailsPlugin",Bs);Bs.prototype.get=Bs.prototype.get;Bs.Id="thumbnails";_.km(new class{create(){return new Bs}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var As="No thumbnail duration or URL specified",Bs="No thumbnail found for position ",Cs="Position is out of range: ",Ds="Thumbnail URL is mandatory",Es="Wrong gridSize format",Fs="clpp.thumbnails",Hs=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Bd&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Gs(a,0,e,!!f))},Promise.resolve())},Gs=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Is(a,d).then(()=>a.a[b].load()).then(()=>Gs(a,e,
2
+ c,d))},Is=function(a,b){return new Promise(c=>{if(b||a.g.getState()!==_.Fl)c();else a.g.one(_.gc,()=>{c()})})},Js=function(a){const b=a.f.byteLength;a.a.forEach(c=>{c.offset+c.length<b&&c.ue.resolve()})},Ms=function(a,b){return Ks(a,b).then(c=>new Ls(c,b.time,b.duration))},Ks=function(a,b){return b.load().then(()=>{const c=_.G(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.Zi(c)})},Ns=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},Os=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},Ps=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Ac:c,de:d,re:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Qs=function(a){return a.some(b=>0<b.thumbStreams.length)},Rs=function(a){if(!a)return null;a=new _.Fj(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 Ss=class{constructor(){this.log=new _.O(Fs);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&&Hs(this,b.preload)})}};var Ls=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.ha=n;this.cf=h;this.Qf=k;this.xf=l;this.yf=m;this.oa=null}raw(){return this.ha.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(_.Nc);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.ha.naturalWidth||this.ha.width))}px ${Math.ceil(d/this.height*(this.ha.naturalHeight||this.ha.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.oa||(this.oa=new Promise((a,b)=>{const c=()=>{this.width||
6
+ (this.width=(this.ha.naturalWidth||this.ha.width)/this.cf);this.height||(this.height=(this.ha.naturalHeight||this.ha.height)/this.Qf);this.x||(this.x=this.width*this.xf);this.y||(this.y=this.height*this.yf)};if(this.ha.src&&this.ha.complete)c(),a(this);else{var d=null,e=()=>{c();this.ha.removeEventListener("load",e);this.ha.removeEventListener(_.Xc,d);a(this)};d=()=>{this.ha.removeEventListener("load",e);this.ha.removeEventListener(_.Xc,d);b()};this.ha.addEventListener("load",e);this.ha.addEventListener(_.Xc,
7
+ d);this.ha.src=this.src}}));return this.oa}};_.x("clpp.thumbnails.Thumbnail",Ls);Ls.prototype.load=Ls.prototype.load;Ls.prototype.element=Ls.prototype.element;Ls.prototype.raw=Ls.prototype.raw;var Ts=class extends Ss{constructor(){super();this.f=null;this.o=this.h=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.H(_.F,7,7100,Ds);if("GRID"===b.mode&&!b.gridSize)throw new _.H(_.F,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.H(_.F,7,7100,"Duration is mandatory");this.f=b;const c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(As,c,d),new _.H(_.F,7,7100,As);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(_.F,7,7100,Es);}catch(e){throw this.log.error("Error during parsing gridSize",e),new _.H(_.F,7,7100,Es);}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(Cs+a);const d=this.a[c];return d?d.load().then(()=>d):Promise.reject(Bs+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 Ls(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 Us=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.ue=new _.Sk}load(){return this.ue}},Ws=class{constructor(){this.g=new _.O(Fs);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Sk}init(a,b){if(!b||!b.url)throw new _.H(_.F,7,7100,Ds);const c=b.url;b=_.Yg(c);b.type=_.Xg;a.getNetworkEngine().fetch(b).R.then(d=>{{var e=d.data;d=_.G(this.f);e=_.G(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=_.G(d),f=String.fromCharCode.apply(null,Vs),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 Us(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(()=>{Js(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(Cs+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 Ms(this,c).then(d=>d.load().then(()=>d))}return Promise.reject(Bs+a)})}},Vs=[137,66,73,70,13,10,26,10];var Xs=class extends Ss{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.H(_.F,7,7100,Ds);const c=b.url,d=_.Yg(c);d.type=_.Xg;this.f=a.getNetworkEngine().fetch(d).R.then(e=>{if(e=e.data){e=_.Ag(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=Ns(g[0]);g=Ns(g[1])-l;this.a.push(new Ls(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(Cs+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(Bs+a)})}m(){return this.f}};var Ys=class extends Ss{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=Os(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=Ps(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.re+a]);else if((c=d.Ea())&&0<c.length){let g=0,h=0;d=d.startTime;1<e.re&&(g=a%e.Ac,h=Math.floor(a/e.Ac),d+=a*e.durationPerTile);f=new Ls(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ac,e.de,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&&!_.z(d=a.getSegmentReference(c++));){const e=Ps(d,a),f=d.Ea()[0],g=new Image;let h=d.startTime;for(let k=0;k<e.de;++k)for(let l=0;l<e.Ac;++l)this.a.push(new Ls(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ac,
16
+ e.de,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var Zs=class{constructor(){this.f=new _.O(Fs);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=Rs(c.url||null)),b&&("SINGLE"===b||"GRID"===b?this.a=new Ts:"WEBVTT"===b?this.a=new Xs:"BIF"===b&&(this.a=new Ws)),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();Qs(c)&&(this.a=new Ys,this.a.init(a,b))}}}get(a){return this.a?this.a.get(a):Promise.reject()}id(){return"thumbnails"}};_.x("clpp.thumbnails.ThumbnailsPlugin",Zs);Zs.prototype.get=Zs.prototype.get;Zs.Id="thumbnails";_.Nm(new class{create(){return new Zs}});};f.call(g, window);