@castlabs/prestoplay 6.17.1 → 6.19.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 (64) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +115 -114
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +575 -565
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +77 -74
  10. package/cjs/cl.externs.js +175 -293
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +70 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +315 -314
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -15
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +71 -71
  26. package/cjs/cl.ttml.js +29 -28
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +18 -18
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +90 -89
  36. package/cl.conviva.js +27 -27
  37. package/cl.core.js +473 -466
  38. package/cl.crypto.js +9 -9
  39. package/cl.dash.js +72 -70
  40. package/cl.externs.js +172 -294
  41. package/cl.freewheel.js +19 -19
  42. package/cl.hls.js +74 -72
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +26 -26
  45. package/cl.ima.js +17 -17
  46. package/cl.mse.js +276 -273
  47. package/cl.muxdata.js +13 -13
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +11 -11
  50. package/cl.playlist.js +5 -5
  51. package/cl.sessions.js +10 -10
  52. package/cl.simid.js +13 -13
  53. package/cl.smooth.js +59 -59
  54. package/cl.thumbnails.js +19 -19
  55. package/cl.tizen.js +57 -57
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +8 -8
  59. package/cl.vr.js +15 -15
  60. package/cl.vtt.js +12 -12
  61. package/cl.youbora.js +15 -15
  62. package/clpp.styles.css +14 -0
  63. package/package.json +2 -2
  64. package/typings.d.ts +406 -377
package/cl.muxdata.js CHANGED
@@ -1,13 +1,13 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var jz=function(a){switch(a.type){case 1:return gz;case 2:return hz;case 3:return iz}},lz=function(a){const b=Object.keys(a).find(c=>kz.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},nz=function(a){let b={debug:!0,data:mz(a)};a.f&&a.f.muxOptionsOverride&&_.Qg(a.f.muxOptionsOverride)&&(b=_.Mg(b,a.f.muxOptionsOverride));b=_.Mg(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.h.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager();const f=
2
- a.m.getSurface();var e={player_is_paused:a.m.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){const k=new _.Hl(c.url);e.video_source_url=_.gj(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().ma(),
3
- c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.h.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.la())&&d.language&&(e.player_language_code=d.language)}return e}});a.h.debug("Mux SDK options",b);return b},oz=function(a){_.mh(a.a);a.j.ed(a.F);a.j.we(a.C)},mz=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.ra,player_software_name:_.ra,player_software_version:_.fa,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
- player_mux_plugin_version:_.fa};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},pz=function(a){a.a.on(a.m,_.Tf,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.Tf,b)});a.a.on(a.m,_.Qe,()=>a.emit(_.Qe));a.a.on(a.m,_.Mc,a.G.bind(a));a.a.on(a.m,_.Jf,a.I.bind(a));a.a.on(a.m,_.cg,()=>a.emit(_.Bf));a.a.on(a.m,_.bg,()=>a.emit(_.Af));a.a.on(a.m,_.r,a.H.bind(a));a.a.on(a.m,_.bc,()=>a.emit("adbreakstart"));a.a.on(a.m,_.cc,()=>a.emit("adbreakend"));a.a.on(a.m,_.pc,()=>{a.emit("adplay");
5
- a.emit("adplaying")});a.a.on(a.m,_.lc,()=>a.emit("adpause"));a.a.on(a.m,_.nc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.qc,()=>a.emit("adended"));a.a.on(a.m,_.gc,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.jc,()=>a.emit("admidpoint"));a.a.on(a.m,_.rc,()=>a.emit("adthirdquartile"));a.j.qc(a.F);a.j.Od(a.C);a.a.on(a.m,_.r,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;
6
- var d=new _.Hl(b.uris[b.uriIndex]);b={request_start:c,request_type:jz(b),request_hostname:d.a};a.h.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.Hl(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:jz(c),request_hostname:f.a,request_error:`${jz(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
- a.h.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},qz=function(a){return!_.A(a)&&typeof a.init===_.Xd&&typeof a.emit===_.Xd},gz="manifest",hz="media",iz="encryption",kz=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var rz=class{constructor(a,b){this.m=a;this.o=this.f=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.ks;this.h=b;this.A=this.l=this.g=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.J.bind(this);this.C=this.K.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.g){try{this.g=!0,this.w.init(this.B,nz(this))}catch(d){throw this.g=!1,oz(this),new _.H(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=mz(this),this.emit("videochange",
8
- a),this.l=!1);pz(this)}release(){this.h.debug("release()");this.l?this.h.debug(_.ja):(oz(this),this.l=!0,this.o=this.f=null)}destroy(){this.h.debug(_.Dd);this.A?this.h.debug(_.ia):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.H(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.h.debug(_.De);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Na())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.h.debug(_.He);
9
- switch(a.detail.currentState){case _.Un:this.m.getConfiguration().autoplay&&this.emit(_.Qe);break;case _.Wn:this.emit(_.af);break;case _.Vn:this.emit(_.Me);break;case _.Ln:this.emit(_.Ud)}}H(a){this.h.debug(_.Ee);if(this.g&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.F){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;
10
- this.emit(_.r,{player_error_code:a.code,player_error_message:b})}}J(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.Hl(b.uris[b.uriIndex]);a={request_start:g,request_type:jz(b),request_hostname:d.a,request_id:lz(e),request_bytes_loaded:f,request_response_start:h,
11
- request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.gj(d)};this.h.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var sz=class extends _.ru{constructor(){super();this.f=this.m=null;this.a=!1;this.h=new _.R("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new rz(a,this.h)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.Ng(c.muxdata);try{var d=[];typeof c===_.Ce&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.H(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.A(f.muxdata)&&typeof f.muxdata===_.Ce){const g=f.muxdata;d=qz(g.muxLib)?g.muxLib:window.mux;if(!qz(d)){this.h.warn("Mux SDK is not loaded. Will do nothing.");
12
- this.a=!1;const h=new _.H(1,9,9301);this.U(a,h)}}else this.h.warn("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,this.U(a,f)}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.m=this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}emit(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&this.U(this.m,c),c;}}U(a,b){a.trigger(new _.E(_.r,{detail:b}))}};
13
- _.z("clpp.muxdata.MuxDataPlugin",sz);sz.prototype.emit=sz.prototype.emit;sz.Id="mux";_.ap(new class{create(){return new sz}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var vz=function(a){switch(a.type){case 1:return sz;case 2:return tz;case 3:return uz}},xz=function(a){const b=Object.keys(a).find(c=>wz.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},zz=function(a){let b={debug:!0,data:yz(a)};a.f&&a.f.muxOptionsOverride&&_.Ug(a.f.muxOptionsOverride)&&(b=_.Qg(b,a.f.muxOptionsOverride));b=_.Qg(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.g.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager();const f=
2
+ a.m.getSurface();var e={player_is_paused:a.m.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){const k=new _.Nl(c.url);e.video_source_url=_.mj(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().ma(),
3
+ c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.g.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.la())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},Az=function(a){_.rh(a.a);a.j.fd(a.F);a.j.ze(a.C)},yz=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.ra,player_software_name:_.ra,player_software_version:_.da,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
+ player_mux_plugin_version:_.da};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},Bz=function(a){a.a.on(a.m,_.Xf,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.Xf,b)});a.a.on(a.m,_.Te,()=>a.emit(_.Te));a.a.on(a.m,_.Pc,a.G.bind(a));a.a.on(a.m,_.Mf,a.I.bind(a));a.a.on(a.m,_.gg,()=>a.emit(_.Ef));a.a.on(a.m,_.fg,()=>a.emit(_.Df));a.a.on(a.m,_.Vd,a.H.bind(a));a.a.on(a.m,_.cc,()=>a.emit("adbreakstart"));a.a.on(a.m,_.dc,()=>a.emit("adbreakend"));a.a.on(a.m,_.sc,()=>
5
+ {a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.oc,()=>a.emit("adpause"));a.a.on(a.m,_.qc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.tc,()=>a.emit("adended"));a.a.on(a.m,_.hc,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.nc,()=>a.emit("admidpoint"));a.a.on(a.m,_.uc,()=>a.emit("adthirdquartile"));a.j.uc(a.F);a.j.Pd(a.C);a.a.on(a.m,_.Vd,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;
6
+ var d=new _.Nl(b.uris[b.uriIndex]);b={request_start:c,request_type:vz(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.Nl(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:vz(c),request_hostname:f.a,request_error:`${vz(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
+ a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},Cz=function(a){return!_.z(a)&&typeof a.init===_.Zd&&typeof a.emit===_.Zd},sz="manifest",tz="media",uz="encryption",wz=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var Dz=class{constructor(a,b){this.m=a;this.o=this.f=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.Bs;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.J.bind(this);this.C=this.K.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.h){try{this.h=!0,this.w.init(this.B,zz(this))}catch(d){throw this.h=!1,Az(this),new _.G(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=yz(this),this.emit("videochange",
8
+ a),this.l=!1);Bz(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ja):(Az(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Dd);this.A?this.g.debug(_.ia):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.G(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.g.debug(_.Ge);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ta())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Ke);
9
+ switch(a.detail.currentState){case _.$n:this.m.getConfiguration().autoplay&&this.emit(_.Te);break;case _.bo:this.emit(_.df);break;case _.ao:this.emit(_.Pe);break;case _.Rn:this.emit(_.Ud)}}H(a){this.g.debug(_.He);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.E){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;
10
+ this.emit(_.Vd,{player_error_code:a.code,player_error_message:b})}}J(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.Nl(b.uris[b.uriIndex]);a={request_start:g,request_type:vz(b),request_hostname:d.a,request_id:xz(e),request_bytes_loaded:f,request_response_start:h,
11
+ request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.mj(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var Ez=class extends _.Bu{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.R("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new Dz(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.Rg(c.muxdata);try{var d=[];typeof c===_.Fe&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.G(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.z(f.muxdata)&&typeof f.muxdata===_.Fe){const g=f.muxdata;d=Cz(g.muxLib)?g.muxLib:window.mux;if(!Cz(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
+ this.a=!1;const h=new _.G(1,9,9301);this.T(a,h)}}else this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,this.T(a,f)}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.m=this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}emit(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&this.T(this.m,c),c;}}T(a,b){a.trigger(new _.C(_.Vd,{detail:b}))}};
13
+ _.x("clpp.muxdata.MuxDataPlugin",Ez);Ez.prototype.emit=Ez.prototype.emit;Ez.Id="mux";_.rq(new class{create(){return new Ez}});};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 fz=function(a,b){let c=b.baseUrl;_.ti(c,"/")||(c+="/");const d=g=>g&&(_.si(g,"https://")||_.si(g,"http://")||_.si(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.bt(a);a.Qa(_.yd,{licenseUrl:e,videoRobustness:[_.Fb,void 0],audioRobustness:[_.Eb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Wl,licenseResponse:_.Xl}});a.Qa(_.ud,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.Zl,licenseResponse:_.$l,extractContentId:_.am,certificateRequest:_.bm}});a.Qa(_.wd,{licenseUrl:f,modifiers:{licenseRequest:_.Wl}});_.ll(a)};
3
- _.z("clpp.onboard.OnboardComponent",class extends _.Pt{constructor(){super();this.h=new _.R("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.kl[a];this.j.clear()}g(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.h.info(`Registering the DRMtoday Onboard environment, name='${b}'`),fz(b,a),this.j.add(b))}id(){return"onboard"}});
4
- _.z("clpp.onboard.register",fz);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var rz=function(a,b){let c=b.baseUrl;_.Ai(c,"/")||(c+="/");const d=g=>g&&(_.zi(g,"https://")||_.zi(g,"http://")||_.zi(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.st(a);a.Wa(_.yd,{licenseUrl:e,videoRobustness:[_.Gb,void 0],audioRobustness:[_.Fb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.bm,licenseResponse:_.cm}});a.Wa(_.ud,{licenseUrl:b,
2
+ certificateUrl:b,modifiers:{licenseRequest:_.em,licenseResponse:_.fm,extractContentId:_.gm,certificateRequest:_.hm}});a.Wa(_.wd,{licenseUrl:f,modifiers:{licenseRequest:_.bm}});_.rl(a)};
3
+ _.x("clpp.onboard.OnboardComponent",class extends _.au{constructor(){super();this.g=new _.R("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.ql[a];this.j.clear()}h(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),rz(b,a),this.j.add(b))}id(){return"onboard"}});
4
+ _.x("clpp.onboard.register",rz);};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 Qy="A persistent DRM session already exists for: ",Ry="No DRM configuration.",Sy="clpp.persistent",Ty="clpp.persistent.SimpleSessionStorage",Uy=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},Wy=function(a,b){a.I=Vy;a.J=[];a.C=!0;return _.Ym(a,b)},Yy=function(a,b,c,d,e,f){a.I=Xy;const g=new Map,h=_.Im(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Je,persistentState:_.tf,sessionTypes:[_.Oe],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,
2
- distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Xm(a,g)},Zy=function(a,b){return _.x(function*(){const c=yield _.on(a,b);if(c){var d=[],e=a.f.get(c);e&&a.A&&(e.ub=new _.an,d.push(e.ub));a.h.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.h.debug("Ignoring attempt to remove missing session",b)})},$y=function(a){a=a.f.keys();a=Uy(a,b=>b.sessionId);return Array.from(a)},
3
- az=function(a,b){const c=_.nl(a),d=_.Tk({drm:a});d.drm=a;a=new _.fo({sb:b,onError:()=>{},pe:()=>{},oe:()=>{},onEvent:()=>{},getConfiguration:()=>d,yc:()=>null});a.g=c;return a},dz=function(a,b,c){return _.x(function*(){const d=bz;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)cz.debug(Qy,e);else{var g=az(a,c);try{yield Wy(g,b);yield _.mn(g);yield _.pn(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Kj(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:$y(g),
4
- keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw cz.error(`Error while persisting DRM session ${e}`),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else cz.debug(Ry)})},Vy=1,Xy=2,ez=class{constructor(){this.h=new _.R(Ty)}store(a,b){return _.x(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);
5
- const e=JSON.stringify(b.audioCapabilities),f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){const b=this;return _.x(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),f=JSON.parse(e.sessionIds),
6
- g=e.audioCapabilities||[],h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.h.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.x(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.x(function*(){window.localStorage.clear()})}getName(){return Ty}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.A(a)||(_.Rg(a.store)||c.push("store"),_.Rg(a.get)||c.push("get"),_.Rg(a.delete)||c.push("delete"),_.Rg(a.clear)||c.push("clear"),_.Rg(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw cz.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});bz=a});
7
- _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=bz,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.Zn(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(Ry);var g=b.offlineId;if(typeof g!==_.Mf||!g.length)throw e("Missing offline id.");if(yield d.get(g))cz.debug(Qy,g);else{var h=_.Tk();d=new _.Yo;g=[];for(var k of c){const l=new k;_.Wk(l.id())||(l.f(),_.Yk(l),g.push(l))}k=null;try{k=yield _.qr(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
- const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.H(_.F,4,4014));const m=_.or(l.periods);yield dz(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(),_.Vk.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
- _.z("clpp.persistent.removeLicense",function(a){return _.x(function*(){var b=bz;if(_.Tg(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Yo,c=az(e.drmConfig,d),yield Yy(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.mn(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield Zy(c,f);cz.debug("successfully removed session with id",f)}))),yield b.delete(a)):cz.debug("No persistent DRM session found")}catch(e){throw cz.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 cz.warn("Invalid offlineId")})});var bz=new ez,cz=new _.R(Sy);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Pt{constructor(){super();this.h=new _.R(Sy)}id(){return _.Ne}l(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().drm;if(d){c.h.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield dz(d,b,e),a.trigger(new _.E(_.Nd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.h.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.x(function*(){b.h.debug(`Getting EME session IDs for ${a}`);
11
- const c=bz;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.h.debug(`No offline session found for ${a}`);return[]}catch(d){return b.h.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var bz="A persistent DRM session already exists for: ",cz="No DRM configuration.",dz="clpp.persistent",ez="clpp.persistent.SimpleSessionStorage",fz=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},hz=function(a,b){a.I=gz;a.J=[];a.C=!0;return _.dn(a,b)},jz=function(a,b,c,d,e,f){a.I=iz;const g=new Map,h=_.Om(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Me,persistentState:_.wf,sessionTypes:[_.Re],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,
2
+ distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.cn(a,g)},kz=function(a,b){return _.w(function*(){const c=yield _.un(a,b);if(c){var d=[],e=a.f.get(c);e&&a.A&&(e.Jb=new _.gn,d.push(e.Jb));a.g.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.g.debug("Ignoring attempt to remove missing session",b)})},lz=function(a){a=a.f.keys();a=fz(a,b=>b.sessionId);return Array.from(a)},
3
+ mz=function(a,b){const c=_.tl(a),d=_.Zk({drm:a});d.drm=a;a=new _.lo({Hb:b,onError:()=>{},qe:()=>{},pe:()=>{},onEvent:()=>{},getConfiguration:()=>d,Cc:()=>null});a.h=c;return a},pz=function(a,b,c){return _.w(function*(){const d=nz;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)oz.debug(bz,e);else{var g=mz(a,c);try{yield hz(g,b);yield _.sn(g);yield _.vn(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Qj(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:lz(g),
4
+ keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw oz.error(`Error while persisting DRM session ${e}`),new _.G(1,6,6200,null,h);}finally{yield g.destroy()}}}}else oz.debug(cz)})},gz=1,iz=2,qz=class{constructor(){this.g=new _.R(ez)}store(a,b){return _.w(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);
5
+ const e=JSON.stringify(b.audioCapabilities),f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){const b=this;return _.w(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),f=JSON.parse(e.sessionIds),
6
+ g=e.audioCapabilities||[],h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.g.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return ez}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.Vg(a.store)||c.push("store"),_.Vg(a.get)||c.push("get"),_.Vg(a.delete)||c.push("delete"),_.Vg(a.clear)||c.push("clear"),_.Vg(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw oz.warn("Invalid session storage implementation"),new _.G(1,6,6202,{missingMethods:b});nz=a});
7
+ _.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=nz,e=(l,m)=>new _.G(1,6,6200,l,m);const f=_.fo(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(cz);var g=b.offlineId;if(typeof g!==_.Pf||!g.length)throw e("Missing offline id.");if(yield d.get(g))oz.debug(bz,g);else{var h=_.Zk();d=new _.iq;g=[];for(var k of c){const l=new k;_.bl(l.id())||(l.f(),_.el(l),g.push(l))}k=null;try{k=yield _.Kr(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
+ const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.G(_.E,4,4014));const m=_.Ir(l.periods);yield pz(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(),_.al.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=nz;if(_.Xg(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.iq,c=mz(e.drmConfig,d),yield jz(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.sn(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield kz(c,f);oz.debug("successfully removed session with id",f)}))),yield b.delete(a)):oz.debug("No persistent DRM session found")}catch(e){throw oz.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 oz.warn("Invalid offlineId")})});var nz=new qz,oz=new _.R(dz);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.au{constructor(){super();this.g=new _.R(dz)}id(){return _.Qe}l(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield pz(d,b,e),a.trigger(new _.C(_.Nd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.w(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
+ const c=nz;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.g.debug(`No offline session found for ${a}`);return[]}catch(d){return b.g.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
package/cl.playlist.js CHANGED
@@ -1,5 +1,5 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Ny=function(a,b){return 0<=b&&b<a.a.length},Oy=function(a){a.trigger(new _.E(_.cf))},Py=class extends _.Xs{on(a,b,c){return super.on(a,b,c)}one(a,b,c){return super.one(a,b,c)}off(a,b){return super.off(a,b)}constructor(a,b){b=void 0===b?()=>Promise.resolve():b;super();this.m=a;this.l=b;this.f=0;this.a=[];this.g=!1;this.j=this.ic.bind(this)}getPosition(){return this.f}Cg(){return this.a}Pc(){return 0<this.a.length&&Ny(this,this.f)?this.a[this.f]:null}Dg(){const a=this.f+1;return 0<
2
- this.a.length&&Ny(this,a)?this.a[a]:null}Ng(){return this.g}start(){this.g||(this.g=!0,this.m.on(_.Ud,this.j),this.xd(this.f,!0))}stop(){this.g=!1;this.m.off(_.Ud,this.j)}ic(){this.next()}next(){const a=this;return _.x(function*(){yield a.xd(Math.min(a.a.length-1,a.f+1))})}eh(){const a=this;return _.x(function*(){yield a.xd(Math.max(0,a.f-1))})}xd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&Ny(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Pc();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
- c.trigger(new _.E(_.bf,{item:d})))}})}append(a){this.a.push(a);Oy(this)}Mg(a,b){if(0<=b&&b<=this.a.length){const c=this.Pc();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Oy(this)}}remove(a){if(0<this.a.length&&Ny(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Oy(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;Oy(this)}};_.z("clpp.Playlist",Py);Py.prototype.clear=Py.prototype.clear;Py.prototype.remove=Py.prototype.remove;Py.prototype.insert=Py.prototype.Mg;
4
- Py.prototype.append=Py.prototype.append;Py.prototype.goTo=Py.prototype.xd;Py.prototype.previous=Py.prototype.eh;Py.prototype.next=Py.prototype.next;Py.prototype.onEnded=Py.prototype.ic;Py.prototype.stop=Py.prototype.stop;Py.prototype.start=Py.prototype.start;Py.prototype.isStarted=Py.prototype.Ng;Py.prototype.getUpcoming=Py.prototype.Dg;Py.prototype.getCurrent=Py.prototype.Pc;Py.prototype.getQueue=Py.prototype.Cg;Py.prototype.getPosition=Py.prototype.getPosition;Py.prototype.off=Py.prototype.off;
5
- Py.prototype.one=Py.prototype.one;Py.prototype.on=Py.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Zy=function(a,b){return 0<=b&&b<a.a.length},$y=function(a){a.trigger(new _.C(_.gf))},az=class extends _.nt{on(a,b,c){return super.on(a,b,c)}one(a,b,c){return super.one(a,b,c)}off(a,b){return super.off(a,b)}constructor(a,b){b=void 0===b?()=>Promise.resolve():b;super();this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.pb.bind(this)}getPosition(){return this.f}Hg(){return this.a}Tc(){return 0<this.a.length&&Zy(this,this.f)?this.a[this.f]:null}Ig(){const a=this.f+1;return 0<
2
+ this.a.length&&Zy(this,a)?this.a[a]:null}Sg(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Ud,this.j),this.xd(this.f,!0))}stop(){this.h=!1;this.m.off(_.Ud,this.j)}pb(){this.next()}next(){const a=this;return _.w(function*(){yield a.xd(Math.min(a.a.length-1,a.f+1))})}ih(){const a=this;return _.w(function*(){yield a.xd(Math.max(0,a.f-1))})}xd(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&Zy(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Tc();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
+ c.trigger(new _.C(_.ef,{item:d})))}})}append(a){this.a.push(a);$y(this)}Qg(a,b){if(0<=b&&b<=this.a.length){const c=this.Tc();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));$y(this)}}remove(a){if(0<this.a.length&&Zy(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);$y(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;$y(this)}};_.x("clpp.Playlist",az);az.prototype.clear=az.prototype.clear;az.prototype.remove=az.prototype.remove;az.prototype.insert=az.prototype.Qg;
4
+ az.prototype.append=az.prototype.append;az.prototype.goTo=az.prototype.xd;az.prototype.previous=az.prototype.ih;az.prototype.next=az.prototype.next;az.prototype.onEnded=az.prototype.pb;az.prototype.stop=az.prototype.stop;az.prototype.start=az.prototype.start;az.prototype.isStarted=az.prototype.Sg;az.prototype.getUpcoming=az.prototype.Ig;az.prototype.getCurrent=az.prototype.Tc;az.prototype.getQueue=az.prototype.Hg;az.prototype.getPosition=az.prototype.getPosition;az.prototype.off=az.prototype.off;
5
+ az.prototype.one=az.prototype.one;az.prototype.on=az.prototype.on;};f.call(g, window);
package/cl.sessions.js CHANGED
@@ -1,10 +1,10 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Jx="apiUrl config is missing",Kx=function(a,b){a.j=a.j.filter(c=>c!==b)},Lx=function(a){let b=0>a;a=Math.abs(a);let c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));return[c,a]},Qx=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Mf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){Mx(a,b<<3|2);b=new Nx;for(let e=0;e<c.length;e++)d(b,c[e]);Ox(a,b.length());Px(a,b.end())}else Mx(a,
2
- b<<3|0),d(a,c)},Ox=function(a,b){if(0<=b)Mx(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},Rx=function(a,b,c){Qx(a,b,c,(d,e)=>{Ox(d,e)})},Mx=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},Tx=function(a,b,c){Qx(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=Lx(e);Sx(d,f,g)}}else{{const [f,g]=Lx(e);Sx(d,f,g)}}})},Ux=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Mf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
3
- 0;e<c.length;e++){Mx(a,b<<3|2);const f=new Nx;d(f,c[e]);Ox(a,f.length());Px(a,f.end())}else Mx(a,b<<3|2),b=new Nx,d(b,c),Ox(a,b.length()),Px(a,b.end())},Vx=function(a,b,c){Ux(a,b,c,(d,e)=>{for(let f=0;f<e.length;f++){let g=e.charCodeAt(f);if(128>g)d.a.push(g);else if(2048>g)d.a.push(g>>6|192),d.a.push(g&63|128);else if(65536>g)if(55296<=g&&56319>=g&&f+1<e.length){let h=e.charCodeAt(f+1);56320<=h&&57343>=h&&(g=1024*(g-55296)+h-56320+65536,d.a.push(g>>18|240),d.a.push(g>>12&63|128),d.a.push(g>>6&63|
4
- 128),d.a.push(g&63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},Px=function(a,b){a.a.push.apply(a.a,b)},Wx=function(a,b,c){Ux(a,b,c,(d,e)=>{Px(d,e.a())})},Xx=function(a,b,c){Ux(a,b,c,(d,e)=>{Px(d,e)})},Sx=function(a,b,c){for(;0<c||127<b;)a.a.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.a.push(b)},Zx=function(a){const b=new Yx;b.g=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},cy=function(a){return _.x(function*(){if(!a.j&&!a.f){0===a.a.length&&$x(a,new ay);var b=()=>
5
- {};a.f=new Promise(c=>{b=c});try{const c=new by;c.f=a.o;c.events.push(...a.a);const d=[...a.a],e=yield fetch(a.l,{method:"POST",headers:{"Content-Type":"application/proto"},body:new Uint8Array(c.a())});if(e.ok)a.a=a.a.filter(f=>!d.includes(f));else throw Error("An error occurred while sending telemetry events to the API, "+`status='${e.status}' statusText='${e.statusText}'`);}finally{b(),a.f=null}}})},fy=function(a,b,c,d,e,f,g){const h=new dy;h.headers=[new ey("CL-BROWSER-NAME",b),new ey("CL-BROWSER-VERSION",
6
- c),new ey("CL-OS-FAMILY",d),new ey("CL-OS-VERSION",e),new ey("CL-SDK-NAME",f),new ey("CL-SDK-NAME",f),new ey("CL-SDK-VERSION",g)];$x(a,h)},$x=function(a,b){if(!a.j){var c=new gy(a.w);c.sessionId=a.A;{var d=Date.now();const e=new hy;e.g=Math.floor(d/1E3);e.f=d%1E3*1E6;d=e}c.time=d;c.g=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},iy=function(a){_.x(function*(){a.h.info("Destroy the session and stop sending events.");_.mh(a.f);a.a=!1;const b=a.m.getNetworkEngine();b.we(a.o);b.ed(a.j);Kx(b,a.j);
7
- a.g&&(yield a.g.dispose(),a.g=null)})},qy=function(a){switch(a){case _.Tn:return jy;case _.Un:return ky;case _.On:return ly;case _.Wn:return my;case _.Vn:return ny;case _.Ln:return oy;case _.Sn:return py;default:return null}},ry=function(a,b){a.h.debug("Sending event",b);$x(a.g,b)},zy=function(a,b){switch(a){case 1:return sy;case 2:return b===_.w?ty:b===_.p?uy:b===_.G?vy:b===_.ae?wy:xy;case 3:return yy;default:return xy}};var Nx=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var Ay=class{constructor(a,b,c,d){this.downloadId=a;this.g=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new Nx;Wx(a,1,this.downloadId);Rx(a,2,this.g);Wx(a,3,this.duration);Rx(a,4,this.j);Wx(a,5,this.f);return a.end()}getId(){return 4}};var By=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new Nx;Rx(a,1,this.f);Wx(a,2,this.downloadId);Vx(a,3,this.url);Wx(a,4,this.headers);Vx(a,5,null);Wx(a,6,null);Wx(a,7,this.duration);Tx(a,8,this.size);return a.end()}getId(){return 2}};var Cy=class{constructor(a,b){this.g=a;this.f=b}a(){const a=new Nx;Rx(a,1,this.g);Xx(a,2,this.f);return a.end()}};var Dy=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new Nx;Rx(a,1,this.errorCode);Rx(a,2,this.severity);Vx(a,3,this.message);Vx(a,4,this.f);Wx(a,5,this.cause);return a.end()}getId(){return 7}};var ey=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new Nx;Vx(a,1,this.key);Vx(a,2,this.value);return a.end()}};var Ey=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new Nx;Rx(a,1,this.code);Rx(a,2,this.severity);Wx(a,3,this.cause);return a.end()}getId(){return 12}};var Fy=class{constructor(){this.data=null}a(){const a=new Nx;Xx(a,1,this.data);return a.end()}};var Gy=class extends Fy{constructor(){super();var a=new Uint8Array(16);crypto.getRandomValues(a);a[6]=a[6]&15|64;a[8]=a[8]&63|128;this.data=a}toString(){const a=[];for(let b=0;256>b;++b)a.push((b+256).toString(16).slice(1));return a[this.data[0]]+a[this.data[1]]+a[this.data[2]]+a[this.data[3]]+"-"+a[this.data[4]]+a[this.data[5]]+"-"+a[this.data[6]]+a[this.data[7]]+"-"+a[this.data[8]]+a[this.data[9]]+"-"+a[this.data[10]]+a[this.data[11]]+a[this.data[12]]+a[this.data[13]]+a[this.data[14]]+a[this.data[15]]}};var dy=class{constructor(){this.headers=[]}a(){const a=new Nx;Wx(a,1,this.headers);return a.end()}getId(){return 1}};var ay=class{constructor(){}a(){return(new Nx).end()}getId(){return 6}};var gy=class{constructor(a){this.j=a;this.f=this.g=this.time=this.sessionId=null}a(){const a=new Nx;Wx(a,1,this.j);Wx(a,2,this.sessionId);Wx(a,3,this.time);Tx(a,4,null);Vx(a,5,null);Rx(a,6,this.g);Xx(a,7,this.f);return a.end()}};var by=class{constructor(){this.f=null;this.events=[]}a(){const a=new Nx;Xx(a,1,this.f);Wx(a,2,this.events);return a.end()}};var hy=class{constructor(){this.f=this.g=null}a(){const a=new Nx;Tx(a,1,this.g);Rx(a,2,this.f);return a.end()}};var Yx=class{constructor(){this.f=this.g=null}a(){const a=new Nx;Tx(a,1,this.g);Rx(a,2,this.f);return a.end()}};var Hy=class{constructor(a,b,c,d,e,f,g,h,k){k=void 0===k?2500:k;this.o=a;this.l=h;this.w=new Gy;this.A=new Gy;this.a=[];this.g=setInterval(()=>cy(this),k);this.f=null;this.j=!1;fy(this,b,c,d,e,f,g)}dispose(){const a=this;return _.x(function*(){a.g&&(clearInterval(a.g),a.g=null);a.f&&(yield a.f);0<a.a.length&&(yield cy(a),a.a=[]);a.j=!0})}};var Iy=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new Nx;Rx(a,1,this.previousState);Rx(a,2,this.currentState);Rx(a,3,this.reason);Wx(a,4,null);Wx(a,5,null);Wx(a,6,null);return a.end()}getId(){return 5}};var My=class extends _.ru{constructor(){super();this.m=null;this.a=this.l=!1;this.f=new _.ks;this.g=null;this.h=new _.R("clpp.sessions.SessionsPlugin");this.o=this.F.bind(this);this.j=this.C.bind(this)}onPlayerCreated(a){this.m=a}onContentWillLoad(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Ce))||this.h.warn("Sessions plugin is loaded but not configured. Will do nothing.");if(this.l=b)b=a.getConfiguration().sessions,b.apiUrl?(this.h.debug(_.sa),this.h.info("Create a session and start sending events."),
8
- a=_.sk(),this.g=new Hy(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.fa,b.apiUrl),this.f.on(this.m,_.Jf,this.B.bind(this)),this.f.on(this.m,_.Bf,this.A.bind(this)),this.f.on(this.m,_.Af,this.w.bind(this)),this.f.on(this.m,_.r,this.U.bind(this)),a=this.m.getNetworkEngine(),a.Od(this.o),a.qc(this.j),a.j.push(this.j)):(this.h.warn(Jx),a.onError(new _.H(1,9,15E3,Jx)))}onPlayerWillRelease(){iy(this)}id(){return"sessions"}B(a){if(!this.a){a=a.detail;var b=a.currentState,
9
- c=new Iy;c.previousState=qy(a.previousState);c.currentState=qy(b);ry(this,c)}}A(){if(!this.a){var a=new Iy;a.previousState=qy(this.m.getState());a.currentState=Jy;ry(this,a);this.a=!0}}w(){if(this.a){var a=new Iy;a.previousState=Jy;a.currentState=qy(this.m.getState());ry(this,a);this.a=!1}}U(a){a=a.detail;var b=new Ey;b=new Dy(new Cy(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.F?Ky:Ly;ry(this,b)}F(a){const b=new Gy;a.downloadId=b;
10
- const c=new By(zy(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new ey(d,a.headers[d]));ry(this,c)}C(a){var b=a.request.downloadId;b?(b=new Ay(b,a.data.byteLength,Zx(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new ey(c,a.headers[c])),ry(this,b)):this.h.warn("Download ID is missing on download completed event.")}};_.ap(new class{create(){return new My}});var Ly=1,Ky=2;var jy=0,ky=2,py=3,Jy=5,ly=6,my=8,ny=10,oy=11;var sy=0,ty=1,uy=2,vy=3,wy=4,yy=5,xy=9;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Ux="apiUrl config is missing",Vx=function(a,b){a.j=a.j.filter(c=>c!==b)},Wx=function(a){let b=0>a;a=Math.abs(a);let c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));return[c,a]},ay=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.r&&0===c||typeof c===_.Pf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){Xx(a,b<<3|2);b=new Yx;for(let e=0;e<c.length;e++)d(b,c[e]);Zx(a,b.length());$x(a,b.end())}else Xx(a,
2
+ b<<3|0),d(a,c)},Zx=function(a,b){if(0<=b)Xx(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},by=function(a,b,c){ay(a,b,c,(d,e)=>{Zx(d,e)})},Xx=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},dy=function(a,b,c){ay(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=Wx(e);cy(d,f,g)}}else{{const [f,g]=Wx(e);cy(d,f,g)}}})},ey=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.r&&0===c||typeof c===_.Pf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
3
+ 0;e<c.length;e++){Xx(a,b<<3|2);const f=new Yx;d(f,c[e]);Zx(a,f.length());$x(a,f.end())}else Xx(a,b<<3|2),b=new Yx,d(b,c),Zx(a,b.length()),$x(a,b.end())},fy=function(a,b,c){ey(a,b,c,(d,e)=>{for(let f=0;f<e.length;f++){let g=e.charCodeAt(f);if(128>g)d.a.push(g);else if(2048>g)d.a.push(g>>6|192),d.a.push(g&63|128);else if(65536>g)if(55296<=g&&56319>=g&&f+1<e.length){let h=e.charCodeAt(f+1);56320<=h&&57343>=h&&(g=1024*(g-55296)+h-56320+65536,d.a.push(g>>18|240),d.a.push(g>>12&63|128),d.a.push(g>>6&63|
4
+ 128),d.a.push(g&63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},$x=function(a,b){a.a.push.apply(a.a,b)},gy=function(a,b,c){ey(a,b,c,(d,e)=>{$x(d,e.a())})},hy=function(a,b,c){ey(a,b,c,(d,e)=>{$x(d,e)})},cy=function(a,b,c){for(;0<c||127<b;)a.a.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.a.push(b)},jy=function(a){const b=new iy;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},ny=function(a){return _.w(function*(){if(!a.j&&!a.f){0===a.a.length&&ky(a,new ly);var b=()=>
5
+ {};a.f=new Promise(c=>{b=c});try{const c=new my;c.f=a.o;c.events.push(...a.a);const d=[...a.a],e=yield fetch(a.l,{method:_.vb,headers:{"Content-Type":"application/proto"},body:new Uint8Array(c.a())});if(e.ok)a.a=a.a.filter(f=>!d.includes(f));else throw Error("An error occurred while sending telemetry events to the API, "+`status='${e.status}' statusText='${e.statusText}'`);}finally{b(),a.f=null}}})},qy=function(a,b,c,d,e,f,g){const h=new oy;h.headers=[new py("CL-BROWSER-NAME",b),new py("CL-BROWSER-VERSION",
6
+ c),new py("CL-OS-FAMILY",d),new py("CL-OS-VERSION",e),new py("CL-SDK-NAME",f),new py("CL-SDK-NAME",f),new py("CL-SDK-VERSION",g)];ky(a,h)},ky=function(a,b){if(!a.j){var c=new ry(a.w);c.sessionId=a.A;{var d=Date.now();const e=new sy;e.h=Math.floor(d/1E3);e.f=d%1E3*1E6;d=e}c.time=d;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},ty=function(a){return _.w(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield ny(a),a.a=[]);a.j=!0})},uy=function(a){_.w(function*(){a.g.info("Destroy the session and stop sending events.");
7
+ _.rh(a.f);a.a=!1;const b=a.m.getNetworkEngine();b.ze(a.o);b.fd(a.j);Vx(b,a.j);a.h&&(yield ty(a.h),a.h=null)})},Cy=function(a){switch(a){case _.Zn:return vy;case _.$n:return wy;case _.Un:return xy;case _.bo:return yy;case _.ao:return zy;case _.Rn:return Ay;case _.Yn:return By;default:return null}},Dy=function(a,b){a.g.debug("Sending event",b);ky(a.h,b)},Ly=function(a,b){switch(a){case 1:return Ey;case 2:return b===_.t?Fy:b===_.p?Gy:b===_.F?Hy:b===_.de?Iy:Jy;case 3:return Ky;default:return Jy}};var Yx=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var My=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new Yx;gy(a,1,this.downloadId);by(a,2,this.h);gy(a,3,this.duration);by(a,4,this.j);gy(a,5,this.f);return a.end()}getId(){return 4}};var Ny=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new Yx;by(a,1,this.f);gy(a,2,this.downloadId);fy(a,3,this.url);gy(a,4,this.headers);fy(a,5,null);gy(a,6,null);gy(a,7,this.duration);dy(a,8,this.size);return a.end()}getId(){return 2}};var Oy=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new Yx;by(a,1,this.h);hy(a,2,this.f);return a.end()}};var Py=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new Yx;by(a,1,this.errorCode);by(a,2,this.severity);fy(a,3,this.message);fy(a,4,this.f);gy(a,5,this.cause);return a.end()}getId(){return 7}};var py=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new Yx;fy(a,1,this.key);fy(a,2,this.value);return a.end()}};var Qy=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new Yx;by(a,1,this.code);by(a,2,this.severity);gy(a,3,this.cause);return a.end()}getId(){return 12}};var Ry=class{constructor(){this.data=null}a(){const a=new Yx;hy(a,1,this.data);return a.end()}};var Sy=class extends Ry{constructor(){super();var a=new Uint8Array(16);crypto.getRandomValues(a);a[6]=a[6]&15|64;a[8]=a[8]&63|128;this.data=a}toString(){const a=[];for(let b=0;256>b;++b)a.push((b+256).toString(16).slice(1));return a[this.data[0]]+a[this.data[1]]+a[this.data[2]]+a[this.data[3]]+"-"+a[this.data[4]]+a[this.data[5]]+"-"+a[this.data[6]]+a[this.data[7]]+"-"+a[this.data[8]]+a[this.data[9]]+"-"+a[this.data[10]]+a[this.data[11]]+a[this.data[12]]+a[this.data[13]]+a[this.data[14]]+a[this.data[15]]}};var oy=class{constructor(){this.headers=[]}a(){const a=new Yx;gy(a,1,this.headers);return a.end()}getId(){return 1}};var ly=class{constructor(){}a(){return(new Yx).end()}getId(){return 6}};var ry=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new Yx;gy(a,1,this.j);gy(a,2,this.sessionId);gy(a,3,this.time);dy(a,4,null);fy(a,5,null);by(a,6,this.h);hy(a,7,this.f);return a.end()}};var my=class{constructor(){this.f=null;this.events=[]}a(){const a=new Yx;hy(a,1,this.f);gy(a,2,this.events);return a.end()}};var sy=class{constructor(){this.f=this.h=null}a(){const a=new Yx;dy(a,1,this.h);by(a,2,this.f);return a.end()}};var iy=class{constructor(){this.f=this.h=null}a(){const a=new Yx;dy(a,1,this.h);by(a,2,this.f);return a.end()}};var Ty=class{constructor(a,b,c,d,e,f,g,h,k){k=void 0===k?2500:k;this.o=a;this.l=h;this.w=new Sy;this.A=new Sy;this.a=[];this.h=setInterval(()=>ny(this),k);this.f=null;this.j=!1;qy(this,b,c,d,e,f,g)}};var Uy=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new Yx;by(a,1,this.previousState);by(a,2,this.currentState);by(a,3,this.reason);gy(a,4,null);gy(a,5,null);gy(a,6,null);return a.end()}getId(){return 5}};var Yy=class extends _.Bu{constructor(){super();this.m=null;this.a=this.l=!1;this.f=new _.Bs;this.h=null;this.g=new _.R("clpp.sessions.SessionsPlugin");this.o=this.F.bind(this);this.j=this.C.bind(this)}onPlayerCreated(a){this.m=a}onContentWillLoad(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Fe))||this.g.warn("Sessions plugin is loaded but not configured. Will do nothing.");if(this.l=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.sa),this.g.info("Create a session and start sending events."),
8
+ a=_.yk(),this.h=new Ty(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.da,b.apiUrl),this.f.on(this.m,_.Mf,this.B.bind(this)),this.f.on(this.m,_.Ef,this.A.bind(this)),this.f.on(this.m,_.Df,this.w.bind(this)),this.f.on(this.m,_.Vd,this.T.bind(this)),a=this.m.getNetworkEngine(),a.Pd(this.o),a.uc(this.j),a.j.push(this.j)):(this.g.warn(Ux),a.onError(new _.G(1,9,15E3,Ux)))}onPlayerWillRelease(){uy(this)}id(){return"sessions"}B(a){if(!this.a){a=a.detail;var b=
9
+ a.currentState,c=new Uy;c.previousState=Cy(a.previousState);c.currentState=Cy(b);Dy(this,c)}}A(){if(!this.a){var a=new Uy;a.previousState=Cy(this.m.getState());a.currentState=Vy;Dy(this,a);this.a=!0}}w(){if(this.a){var a=new Uy;a.previousState=Vy;a.currentState=Cy(this.m.getState());Dy(this,a);this.a=!1}}T(a){a=a.detail;var b=new Qy;b=new Py(new Oy(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.E?Wy:Xy;Dy(this,b)}F(a){const b=new Sy;
10
+ a.downloadId=b;const c=new Ny(Ly(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new py(d,a.headers[d]));Dy(this,c)}C(a){var b=a.request.downloadId;b?(b=new My(b,a.data.byteLength,jy(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new py(c,a.headers[c])),Dy(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.rq(new class{create(){return new Yy}});var Xy=1,Wy=2;var vy=0,wy=2,By=3,Vy=5,xy=6,yy=8,zy=10,Ay=11;var Ey=0,Fy=1,Gy=2,Hy=3,Iy=4,Ky=5,Jy=9;};f.call(g, window);
package/cl.simid.js CHANGED
@@ -1,13 +1,13 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var sx="No surface found. Can not attach frame!",tx="SIMID:Media:timeupdate",ux="Starting creative",vx=function(a,b,c){return{type:b,sessionId:a.g,messageId:a.l++,timestamp:Date.now(),args:c}},yx=function(a,b){return new Promise((c,d)=>{new wx(a.j,c,d,b);xx(a,b)})},zx=function(a){const b=vx(a,"SIMID:Player:startCreative",void 0);yx(a,b).then(()=>{var c=a.f;c.h.info(ux);c.m.trigger(new _.E(_.Df));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.h.error("Error while starting creative",
2
- c)})},Bx=function(a,b){_.x(function*(){a.g=b.sessionId;Ax(a,b);try{{var c=a.f;const f=c.getSurface(),g=c.getContainer();var d={environmentData:{videoDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:c.m.isMuted()||
3
- !1,volume:c.m.getVolume()||0,navigationSupport:"adHandles",closeButtonSupport:"adHandles",nonlinearDuration:c.f.duration},creativeData:{adParameters:c.f.adParameters||"",clickThruUri:"",clickThruUrl:""}}}{const f=vx(a,"SIMID:Player:init",d);var e=yx(a,f)}yield e;a.h.info("Player Init acknowledged");a.f.h.info("SIMID Player initialized")}catch(f){a.h.error("Error while initializing",f),a.f.h.error("Error while initializing SIMID player: ",f),a.unload()}})},Ax=function(a,b){xx(a,vx(a,"resolve",{messageId:b.messageId,
4
- value:void 0}))},xx=function(a,b){a.g?(b.type!==tx&&a.h.info(`Posting message [${b.messageId}] '${b.type}':`,b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.h.warn(`WARNING: no session available to send message '${b.type}'`)},Cx=function(a,b,c){return new ResizeObserver(()=>{if(a.a.g){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};
5
- e=vx(d,"SIMID:Player:resize",e);xx(d,e)}})},Dx=function(a,b){a.h.info("SIMID Session created");a.a=b},Ex=function(a){a.h.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(()=>{a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height=
6
- "";a.g=!1;a.m.trigger(new _.E(_.Ef))},Fx=function(a,b){var c=a.getContainer();a=c.clientWidth;c=c.clientHeight;return{top:`${b.y/c*100}%`,left:`${b.x/a*100}%`,width:`${b.width/a*100}%`,height:`${b.height/c*100}%`}},Gx=class{constructor(a){this.f=a;this.g="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";this.a.style.border=_.Be;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
- _.Be;this.a.style.overflow=_.Zd;this.a.classList.add(_.dd);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.Mf?JSON.parse(b):b:null))if(b.type)switch(this.h.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":Bx(this,b);break;case "resolve":b=b.args;var c=this.j.get(b.messageId);c&&c.resolve(b);break;case "reject":b=b.args;(c=this.j.get(b.messageId))&&c.reject(b);break;case "SIMID:Creative:requestResize":c=this.f;var d=b.args;c.h.info("Creative requested resize",
8
- d);if(c.m&&c.m.getSurface()&&c.m.getSurface().getMedia()&&d.mediaDimensions){c.g?c.m.getSurface().getMedia().style.transition="":(c.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",c.g=!0);const e=Fx(c,d.mediaDimensions);c.m.getSurface().getMedia().style.left=e.left;c.m.getSurface().getMedia().style.top=e.top;c.m.getSurface().getMedia().style.width=e.width;c.m.getSurface().getMedia().style.height=e.height}d.creativeDimensions&&(d=Fx(c,d.creativeDimensions),c.a.a.style.left=
9
- d.left,c.a.a.style.top=d.top,c.a.a.style.width=d.width,c.a.a.style.height=d.height);Ax(this,b)}else this.h.warn("WARNING: received message without 'type' property")};this.h=new _.R("clpp.simid.SimidPlayer");Dx(this.f,this)}load(a){window.addEventListener(_.ue,this.o);this.g="";this.l=0;const b=this.f.url();this.h.info(`Loading "${b}" as src of iFrame`);this.a.src=b;this.h.info("Attaching iFrame");a.appendChild(this.a)}unload(){Ex(this.f);this.g=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.ue,
10
- this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},wx=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.g=d;this.a=null;this.f.set(d.messageId,this);0<=e&&(this.a=setTimeout(()=>{this.resolve()},e))}resolve(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.g.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.g.messageId);this.j(a)}};var Ix=class extends _.ru{constructor(){super();this.h=new _.R("clpp.simid.Plugin");this.g=this.a=this.m=null;this.l=[];this.j=null;this.w=this.A.bind(this);this.f=null;this.o=!1}id(){return"simid"}onPlayerCreated(a){this.h.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.g&&this.g.release();this.g=new Hx(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.h.info(`Setting up SIMID plugin for ${this.l.length} creatives`),
11
- b=this.m.getSurface()){this.h.info("Creating new session");this.a=new Gx(this.g);var c=b.getContainer();this.j=Cx(this,c,b);this.j.observe(c);a.on(_.Tf,this.w)}else this.h.warn(sx)}A(){var a=this.m.getPosition();a:if(this.f&&a<this.f.startTime+this.f.duration)var b=this.f;else{for(b=0;b<this.l.length;b++){var c=this.l[b];const d=c.startTime+c.duration;if(a>=c.startTime-(c.preload||5)&&a<d){b=c;break a}}b=null}b?b===this.f?(b=b.startTime,this.a&&(c=a>=b,!this.o&&c&&(zx(this.a),this.o=!0,this.h.info(ux)),
12
- c&&(c=this.a,xx(c,vx(c,tx,{currentTime:a-b}))))):((a=this.m.getSurface())||this.h.warn(sx),a=a.getContainer(),this.f=b,this.o=!1,this.h.info("Loading session"),this.g.f=b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)}onPlayerWillRelease(a){super.onPlayerWillRelease(a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.Tf,this.w),this.f&&(this.a.unload(),this.f=this.g.f=null))}},Hx=class{constructor(a){this.m=a;this.a=null;this.h=new _.R("clpp.simid.Loader");
13
- this.g=!1;this.f=null}release(){this.h.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.h.error("No player container found. Can not create SIMID init data"),new _.H(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.h.error("No player surface found. Can not create SIMID init data"),new _.H(1,10,10100,"No surface");return a}url(){return this.f?this.f.url:""}};_.ap(new class{create(){return new Ix}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Dx="No surface found. Can not attach frame!",Ex="SIMID:Media:timeupdate",Fx="Starting creative",Gx=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},Jx=function(a,b){return new Promise((c,d)=>{new Hx(a.j,c,d,b);Ix(a,b)})},Kx=function(a){const b=Gx(a,"SIMID:Player:startCreative",void 0);Jx(a,b).then(()=>{var c=a.f;c.g.info(Fx);c.m.trigger(new _.C(_.Gf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
+ c)})},Mx=function(a,b){_.w(function*(){a.h=b.sessionId;Lx(a,b);try{{var c=a.f;const f=c.getSurface(),g=c.getContainer();var d={environmentData:{videoDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:c.m.isMuted()||
3
+ !1,volume:c.m.getVolume()||0,navigationSupport:"adHandles",closeButtonSupport:"adHandles",nonlinearDuration:c.f.duration},creativeData:{adParameters:c.f.adParameters||"",clickThruUri:"",clickThruUrl:""}}}{const f=Gx(a,"SIMID:Player:init",d);var e=Jx(a,f)}yield e;a.g.info("Player Init acknowledged");a.f.g.info("SIMID Player initialized")}catch(f){a.g.error("Error while initializing",f),a.f.g.error("Error while initializing SIMID player: ",f),a.unload()}})},Lx=function(a,b){Ix(a,Gx(a,"resolve",{messageId:b.messageId,
4
+ value:void 0}))},Ix=function(a,b){a.h?(b.type!==Ex&&a.g.info(`Posting message [${b.messageId}] '${b.type}':`,b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn(`WARNING: no session available to send message '${b.type}'`)},Nx=function(a,b,c){return new ResizeObserver(()=>{if(a.a.h){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};
5
+ e=Gx(d,"SIMID:Player:resize",e);Ix(d,e)}})},Ox=function(a,b){a.g.info("SIMID Session created");a.a=b},Px=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(()=>{a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height=
6
+ "";a.h=!1;a.m.trigger(new _.C(_.Hf))},Qx=function(a,b){var c=a.getContainer();a=c.clientWidth;c=c.clientHeight;return{top:`${b.y/c*100}%`,left:`${b.x/a*100}%`,width:`${b.width/a*100}%`,height:`${b.height/c*100}%`}},Rx=class{constructor(a){this.f=a;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";this.a.style.border=_.Ee;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
+ _.Ee;this.a.style.overflow=_.ae;this.a.classList.add(_.gd);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.Pf?JSON.parse(b):b:null))if(b.type)switch(this.g.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":Mx(this,b);break;case "resolve":b=b.args;var c=this.j.get(b.messageId);c&&c.resolve(b);break;case "reject":b=b.args;(c=this.j.get(b.messageId))&&c.reject(b);break;case "SIMID:Creative:requestResize":c=this.f;var d=b.args;c.g.info("Creative requested resize",
8
+ d);if(c.m&&c.m.getSurface()&&c.m.getSurface().getMedia()&&d.mediaDimensions){c.h?c.m.getSurface().getMedia().style.transition="":(c.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",c.h=!0);const e=Qx(c,d.mediaDimensions);c.m.getSurface().getMedia().style.left=e.left;c.m.getSurface().getMedia().style.top=e.top;c.m.getSurface().getMedia().style.width=e.width;c.m.getSurface().getMedia().style.height=e.height}d.creativeDimensions&&(d=Qx(c,d.creativeDimensions),c.a.a.style.left=
9
+ d.left,c.a.a.style.top=d.top,c.a.a.style.width=d.width,c.a.a.style.height=d.height);Lx(this,b)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.R("clpp.simid.SimidPlayer");Ox(this.f,this)}load(a){window.addEventListener(_.xe,this.o);this.h="";this.l=0;const b=this.f.url();this.g.info(`Loading "${b}" as src of iFrame`);this.a.src=b;this.g.info("Attaching iFrame");a.appendChild(this.a)}unload(){Px(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.xe,
10
+ this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},Hx=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.h=d;this.a=null;this.f.set(d.messageId,this);0<=e&&(this.a=setTimeout(()=>{this.resolve()},e))}resolve(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);this.j(a)}};var Tx=class extends _.Bu{constructor(){super();this.g=new _.R("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.A.bind(this);this.f=null;this.o=!1}id(){return"simid"}onPlayerCreated(a){this.g.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.h&&this.h.release();this.h=new Sx(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.g.info(`Setting up SIMID plugin for ${this.l.length} creatives`),
11
+ b=this.m.getSurface()){this.g.info("Creating new session");this.a=new Rx(this.h);var c=b.getContainer();this.j=Nx(this,c,b);this.j.observe(c);a.on(_.Xf,this.w)}else this.g.warn(Dx)}A(){var a=this.m.getPosition();a:if(this.f&&a<this.f.startTime+this.f.duration)var b=this.f;else{for(b=0;b<this.l.length;b++){var c=this.l[b];const d=c.startTime+c.duration;if(a>=c.startTime-(c.preload||5)&&a<d){b=c;break a}}b=null}b?b===this.f?(b=b.startTime,this.a&&(c=a>=b,!this.o&&c&&(Kx(this.a),this.o=!0,this.g.info(Fx)),
12
+ c&&(c=this.a,Ix(c,Gx(c,Ex,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(Dx),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)}onPlayerWillRelease(a){super.onPlayerWillRelease(a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.Xf,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Sx=class{constructor(a){this.m=a;this.a=null;this.g=new _.R("clpp.simid.Loader");
13
+ this.h=!1;this.f=null}release(){this.g.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.G(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.G(1,10,10100,"No surface");return a}url(){return this.f?this.f.url:""}};_.rq(new class{create(){return new Tx}});};f.call(g, window);