@castlabs/prestoplay 6.22.0 → 6.23.1

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 (65) hide show
  1. package/CHANGELOG.md +18 -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 +116 -116
  6. package/cjs/cl.conviva.js +32 -33
  7. package/cjs/cl.core.js +592 -590
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +86 -80
  10. package/cjs/cl.externs.js +43 -36
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +71 -70
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -29
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +342 -328
  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 -16
  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 +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -13
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +37 -37
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +86 -86
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +474 -472
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +80 -75
  41. package/cl.externs.js +43 -36
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +74 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +16 -16
  47. package/cl.mse.js +303 -290
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +10 -10
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +59 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +15 -15
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +27 -26
  64. package/package.json +1 -1
  65. package/typings.d.ts +53 -6
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 zA=function(a){switch(a.type){case 1:return wA;case 2:return xA;case 3:return yA}},BA=function(a){const b=Object.keys(a).find(c=>AA.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},DA=function(a){let b={debug:!0,data:CA(a)};a.f&&a.f.muxOptionsOverride&&_.Xg(a.f.muxOptionsOverride)&&(b=_.Tg(b,a.f.muxOptionsOverride));b=_.Tg(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 _.lm(c.url);e.video_source_url=_.Nj(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().la(),
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.oa())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},EA=function(a){_.uh(a.a);a.j.ld(a.F);a.j.He(a.C)},CA=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.pa,player_software_name:_.pa,player_software_version:_.da,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
- player_mux_plugin_version:_.da};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},FA=function(a){a.a.on(a.m,_.Zf,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.Zf,b)});a.a.on(a.m,_.Ue,()=>a.emit(_.Ue));a.a.on(a.m,_.Qc,a.G.bind(a));a.a.on(a.m,_.Pf,a.I.bind(a));a.a.on(a.m,_.ig,()=>a.emit(_.Hf));a.a.on(a.m,_.hg,()=>a.emit(_.Gf));a.a.on(a.m,_.r,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,_.tc,()=>{a.emit("adplay");
5
- a.emit("adplaying")});a.a.on(a.m,_.oc,()=>a.emit("adpause"));a.a.on(a.m,_.rc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.uc,()=>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,_.vc,()=>a.emit("adthirdquartile"));a.j.vc(a.F);a.j.Xd(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 _.lm(b.uris[b.uriIndex]);b={request_start:c,request_type:zA(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.lm(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:zA(c),request_hostname:f.a,request_error:`${zA(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
- a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},GA=function(a){return!_.B(a)&&typeof a.init===_.ae&&typeof a.emit===_.ae},wA="manifest",xA="media",yA="encryption",AA=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var HA=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 _.jt;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,DA(this))}catch(d){throw this.h=!1,EA(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=CA(this),this.emit("videochange",
8
- a),this.l=!1);FA(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ha):(EA(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Gd);this.A?this.g.debug(_.fa):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.I(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.g.debug(_.He);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Za())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Le);
9
- switch(a.detail.currentState){case _.Do:this.m.getConfiguration().autoplay&&this.emit(_.Ue);break;case _.Fo:this.emit(_.ef);break;case _.Eo:this.emit(_.Qe);break;case _.uo:this.emit(_.Xd)}}H(a){this.g.debug(_.Ie);if(this.h&&(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 _.lm(b.uris[b.uriIndex]);a={request_start:g,request_type:zA(b),request_hostname:d.a,request_id:BA(e),request_bytes_loaded:f,request_response_start:h,
11
- request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Nj(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var IA=class extends _.iv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.S("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new HA(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.Ug(c.muxdata);try{var d=[];typeof c===_.Ge&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.I(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.B(f.muxdata)&&typeof f.muxdata===_.Ge){const g=f.muxdata;d=GA(g.muxLib)?g.muxLib:window.mux;if(!GA(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
- this.a=!1;const h=new _.I(1,9,9301);this.T(a,h)}}else this.g.debug("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,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 _.E(_.r,{detail:b}))}};
13
- _.z("clpp.muxdata.MuxDataPlugin",IA);IA.prototype.emit=IA.prototype.emit;IA.Id="mux";_.Yq(new class{create(){return new IA}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var VA=function(a){switch(a.type){case 1:return SA;case 2:return TA;case 3:return UA}},XA=function(a){const b=Object.keys(a).find(c=>WA.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},ZA=function(a){let b={debug:!0,data:YA(a)};a.f&&a.f.muxOptionsOverride&&_.ch(a.f.muxOptionsOverride)&&(b=_.Zg(b,a.f.muxOptionsOverride));b=_.Zg(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 _.sm(c.url);e.video_source_url=_.Tj(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().la(),
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.oa())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},$A=function(a){_.Ah(a.a);a.j.od(a.F);a.j.Qe(a.C)},YA=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.qa,player_software_name:_.qa,player_software_version:_.ea,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
+ player_mux_plugin_version:_.ea};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},aB=function(a){a.a.on(a.m,_.bg,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.bg,b)});a.a.on(a.m,_.Ze,()=>a.emit(_.Ze));a.a.on(a.m,_.Tc,a.G.bind(a));a.a.on(a.m,_.Sf,a.I.bind(a));a.a.on(a.m,_.lg,()=>a.emit(_.Kf));a.a.on(a.m,_.kg,()=>a.emit(_.Jf));a.a.on(a.m,_.r,a.H.bind(a));a.a.on(a.m,_.cc,()=>a.emit("adbreakstart"));a.a.on(a.m,_.ec,()=>a.emit("adbreakend"));a.a.on(a.m,_.uc,()=>{a.emit("adplay");
5
+ a.emit("adplaying")});a.a.on(a.m,_.pc,()=>a.emit("adpause"));a.a.on(a.m,_.rc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.xc,()=>a.emit("adended"));a.a.on(a.m,_.ic,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.oc,()=>a.emit("admidpoint"));a.a.on(a.m,_.yc,()=>a.emit("adthirdquartile"));a.j.xc(a.F);a.j.fe(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 _.sm(b.uris[b.uriIndex]);b={request_start:c,request_type:VA(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.sm(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:VA(c),request_hostname:f.a,request_error:`${VA(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
+ a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},bB=function(a,b){a.trigger(new _.E(_.r,{detail:b}))},cB=function(a){return!_.B(a)&&typeof a.init===_.fe&&typeof a.emit===_.fe},SA="manifest",TA="media",UA="encryption",WA=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var dB=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 _.xt;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,ZA(this))}catch(d){throw this.h=!1,$A(this),new _.H(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=YA(this),this.emit("videochange",
8
+ a),this.l=!1);aB(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):($A(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Jd);this.A?this.g.debug(_.ha):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.H(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.g.debug(_.Le);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Wa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Qe);
9
+ switch(a.detail.currentState){case _.Zo:this.m.getConfiguration().autoplay&&this.emit(_.Ze);break;case _.ap:this.emit(_.kf);break;case _.$o:this.emit(_.Ve);break;case _.Qo:this.emit(_.be)}}H(a){this.g.debug(_.Ne);if(this.h&&(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 _.sm(b.uris[b.uriIndex]);a={request_start:g,request_type:VA(b),request_hostname:d.a,request_id:XA(e),request_bytes_loaded:f,request_response_start:h,
11
+ request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Tj(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var eB=class extends _.Fv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.S("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new dB(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.$g(c.muxdata);try{var d=[];typeof c===_.Ke&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.H(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.B(f.muxdata)&&typeof f.muxdata===_.Ke){const g=f.muxdata;d=cB(g.muxLib)?g.muxLib:window.mux;if(!cB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
+ this.a=!1;const h=new _.H(1,9,9301);bB(a,h)}}else this.g.debug("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,bB(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&&bB(this.m,c),c;}}};_.z("clpp.muxdata.MuxDataPlugin",eB);eB.prototype.emit=eB.prototype.emit;
13
+ eB.Id="mux";_.ur(new class{create(){return new eB}});};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 vA=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 _.au(a);a.ab(_.zd,{licenseUrl:e,videoRobustness:[_.Gb,void 0],audioRobustness:[_.Fb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Dm,licenseResponse:_.Em}});a.ab(_.ud,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.Gm,licenseResponse:_.Hm,extractContentId:_.Im,certificateRequest:_.Jm}});a.ab(_.xd,{licenseUrl:f,modifiers:{licenseRequest:_.Dm}});_.Ql(a)};
3
- _.z("clpp.onboard.OnboardComponent",class extends _.Iu{constructor(){super();this.g=new _.S("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Pl[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}'`),vA(b,a),this.j.add(b))}id(){return"onboard"}});
4
- _.z("clpp.onboard.register",vA);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var RA=function(a,b){let c=b.baseUrl;_.Zi(c,"/")||(c+="/");const d=g=>g&&(_.Yi(g,"https://")||_.Yi(g,"http://")||_.Yi(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.ou(a);a.Ya(_.Cd,{licenseUrl:e,videoRobustness:[_.Cb,void 0],audioRobustness:[_.Bb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Km,licenseResponse:_.Lm}});a.Ya(_.wd,{licenseUrl:b,
2
+ certificateUrl:b,modifiers:{licenseRequest:_.Nm,licenseResponse:_.Om,extractContentId:_.Pm,certificateRequest:_.Qm}});a.Ya(_.Ad,{licenseUrl:f,modifiers:{licenseRequest:_.Km}});_.Xl(a)};
3
+ _.z("clpp.onboard.OnboardComponent",class extends _.pv{constructor(){super();this.g=new _.S("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Wl[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}'`),RA(b,a),this.j.add(b))}id(){return"onboard"}});
4
+ _.z("clpp.onboard.register",RA);};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 fA="A persistent DRM session already exists for: ",gA="No DRM configuration.",hA="clpp.persistent",iA="clpp.persistent.SimpleSessionStorage",jA=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},lA=function(a,b,c,d,e,f){a.I=kA;const g=new Map,h=_.nn(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Ne,persistentState:_.zf,sessionTypes:[_.Se],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
- audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.En(a,g)},nA=function(a,b){a.I=mA;a.J=[];a.C=!0;return _.Fn(a,b)},oA=function(a,b){return _.x(function*(){const c=yield _.Xn(a,b);if(c){var d=[],e=a.f.get(c);e&&a.A&&(e.Lb=new _.In,d.push(e.Lb));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)})},pA=function(a){a=a.f.keys();a=jA(a,b=>b.sessionId);return Array.from(a)},
3
- qA=function(a,b){const c=_.Sl(a),d=_.yl({drm:a});d.drm=a;a=new _.Oo({Jb:b,onError:()=>{},xe:()=>{},we:()=>{},onEvent:()=>{},getConfiguration:()=>d,Ec:()=>null});a.h=c;return a},tA=function(a,b,c){return _.x(function*(){const d=rA;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)sA.debug(fA,e);else{var g=qA(a,c);try{yield nA(g,b);yield _.Vn(g);yield _.Yn(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.pk(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:pA(g),
4
- keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw sA.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else sA.debug(gA)})},mA=1,kA=2,uA=class{constructor(){this.g=new _.S(iA)}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);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var BA="A persistent DRM session already exists for: ",CA="No DRM configuration.",DA="clpp.persistent",EA="clpp.persistent.SimpleSessionStorage",FA=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},HA=function(a,b,c,d,e,f){a.K=GA;const g=new Map,h=_.Fn(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Se,persistentState:_.Cf,sessionTypes:[_.Xe],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
+ audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Xn(a,g)},JA=function(a,b){a.K=IA;a.L=[];a.G=!0;return _.Yn(a,b)},KA=function(a,b){return _.x(function*(){const c=yield _.po(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.ec=new _.hn,d.push(e.ec));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)})},LA=function(a){a=a.h.keys();a=FA(a,b=>b.sessionId);return Array.from(a)},
3
+ MA=function(a,b){const c=_.Zl(a),d=_.Gl({drm:a});d.drm=a;a=new _.jp({rb:b,onError:()=>{},Ge:()=>{},Fe:()=>{},onEvent:()=>{},getConfiguration:()=>d,Hc:()=>null});a.f=c;return a},PA=function(a,b,c){return _.x(function*(){const d=NA;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)OA.debug(BA,e);else{var g=MA(a,c);try{yield JA(g,b);yield _.no(g);yield _.qo(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.vk(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:LA(g),
4
+ keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw OA.error(`Error while persisting DRM session ${e}`),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else OA.debug(CA)})},IA=1,GA=2,QA=class{constructor(){this.g=new _.S(EA)}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
5
  const e=JSON.stringify(b.audioCapabilities),f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){const b=this;return _.x(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),f=JSON.parse(e.sessionIds),
6
- g=e.audioCapabilities||[],h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.g.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.x(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.x(function*(){window.localStorage.clear()})}getName(){return iA}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.Yg(a.store)||c.push("store"),_.Yg(a.get)||c.push("get"),_.Yg(a.delete)||c.push("delete"),_.Yg(a.clear)||c.push("clear"),_.Yg(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw sA.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});rA=a});
7
- _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=rA,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.Io(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(gA);var g=b.offlineId;if(typeof g!==_.Sf||!g.length)throw e("Missing offline id.");if(yield d.get(g))sA.debug(fA,g);else{var h=_.yl();d=new _.Pq;g=[];for(var k of c){const l=new k;_.Bl(l.id())||(l.f(),_.Dl(l),g.push(l))}k=null;try{k=yield _.vs(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 _.I(_.F,4,4014));const m=_.ts(l.periods);yield tA(b,m,d)}catch(l){if(l instanceof _.I&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.Al.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=rA;if(_.$g(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Pq,c=qA(e.drmConfig,d),yield lA(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Vn(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield oA(c,f);sA.debug("successfully removed session with id",f)}))),yield b.delete(a)):sA.debug("No persistent DRM session found")}catch(e){throw sA.error("Failed to remove session"),
10
- new _.I(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else sA.warn("Invalid offlineId")})});var rA=new uA,sA=new _.S(hA);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Iu{constructor(){super();this.g=new _.S(hA)}id(){return _.Re}l(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield tA(d,b,e),a.trigger(new _.E(_.Qd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.x(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
- const c=rA;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.g.debug(`No offline session found for ${a}`);return[]}catch(d){return b.g.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
6
+ g=e.audioCapabilities||[],h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.g.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.x(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.x(function*(){window.localStorage.clear()})}getName(){return EA}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.dh(a.store)||c.push("store"),_.dh(a.get)||c.push("get"),_.dh(a.delete)||c.push("delete"),_.dh(a.clear)||c.push("clear"),_.dh(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw OA.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});NA=a});
7
+ _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=NA,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.dp(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(CA);var g=b.offlineId;if(typeof g!==_.Vf||!g.length)throw e("Missing offline id.");if(yield d.get(g))OA.debug(BA,g);else{var h=_.Gl();d=new _.lr;g=[];for(var k of c){const l=new k;_.Jl(l.id())||(l.f(),_.Ll(l),g.push(l))}k=null;try{k=yield _.Js(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 _.H(_.F,4,4014));const m=_.Hs(l.periods);yield PA(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(),_.Il.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=NA;if(_.fh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.lr,c=MA(e.drmConfig,d),yield HA(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.no(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield KA(c,f);OA.debug("successfully removed session with id",f)}))),yield b.delete(a)):OA.debug("No persistent DRM session found")}catch(e){throw OA.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 OA.warn("Invalid offlineId")})});var NA=new QA,OA=new _.S(DA);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.pv{constructor(){super();this.g=new _.S(DA)}id(){return _.We}l(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield PA(d,b,e),a.trigger(new _.E(_.Vd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.x(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
+ const c=NA;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 cA=function(a,b){return 0<=b&&b<a.a.length},dA=function(a){a.trigger(new _.E(_.gf))},eA=class extends _.Wt{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.rb.bind(this)}getPosition(){return this.f}$g(){return this.a}Vc(){return 0<this.a.length&&cA(this,this.f)?this.a[this.f]:null}ah(){const a=this.f+1;return 0<
2
- this.a.length&&cA(this,a)?this.a[a]:null}kh(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Xd,this.j),this.Cd(this.f,!0))}stop(){this.h=!1;this.m.off(_.Xd,this.j)}rb(){this.next()}next(){const a=this;return _.x(function*(){yield a.Cd(Math.min(a.a.length-1,a.f+1))})}Bh(){const a=this;return _.x(function*(){yield a.Cd(Math.max(0,a.f-1))})}Cd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&cA(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Vc();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
- c.trigger(new _.E(_.ff,{item:d})))}})}append(a){this.a.push(a);dA(this)}jh(a,b){if(0<=b&&b<=this.a.length){const c=this.Vc();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));dA(this)}}remove(a){if(0<this.a.length&&cA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);dA(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;dA(this)}};_.z("clpp.Playlist",eA);eA.prototype.clear=eA.prototype.clear;eA.prototype.remove=eA.prototype.remove;eA.prototype.insert=eA.prototype.jh;
4
- eA.prototype.append=eA.prototype.append;eA.prototype.goTo=eA.prototype.Cd;eA.prototype.previous=eA.prototype.Bh;eA.prototype.next=eA.prototype.next;eA.prototype.onEnded=eA.prototype.rb;eA.prototype.stop=eA.prototype.stop;eA.prototype.start=eA.prototype.start;eA.prototype.isStarted=eA.prototype.kh;eA.prototype.getUpcoming=eA.prototype.ah;eA.prototype.getCurrent=eA.prototype.Vc;eA.prototype.getQueue=eA.prototype.$g;eA.prototype.getPosition=eA.prototype.getPosition;eA.prototype.off=eA.prototype.off;
5
- eA.prototype.one=eA.prototype.one;eA.prototype.on=eA.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var yA=function(a,b){return 0<=b&&b<a.a.length},zA=function(a){a.trigger(new _.E(_.mf))},AA=class extends _.ju{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.sb.bind(this)}getPosition(){return this.f}kh(){return this.a}Yc(){return 0<this.a.length&&yA(this,this.f)?this.a[this.f]:null}lh(){const a=this.f+1;return 0<
2
+ this.a.length&&yA(this,a)?this.a[a]:null}vh(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.be,this.j),this.Hd(this.f,!0))}stop(){this.h=!1;this.m.off(_.be,this.j)}sb(){this.next()}next(){const a=this;return _.x(function*(){yield a.Hd(Math.min(a.a.length-1,a.f+1))})}Mh(){const a=this;return _.x(function*(){yield a.Hd(Math.max(0,a.f-1))})}Hd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&yA(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Yc();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
+ c.trigger(new _.E(_.lf,{item:d})))}})}append(a){this.a.push(a);zA(this)}uh(a,b){if(0<=b&&b<=this.a.length){const c=this.Yc();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));zA(this)}}remove(a){if(0<this.a.length&&yA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);zA(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;zA(this)}};_.z("clpp.Playlist",AA);AA.prototype.clear=AA.prototype.clear;AA.prototype.remove=AA.prototype.remove;AA.prototype.insert=AA.prototype.uh;
4
+ AA.prototype.append=AA.prototype.append;AA.prototype.goTo=AA.prototype.Hd;AA.prototype.previous=AA.prototype.Mh;AA.prototype.next=AA.prototype.next;AA.prototype.onEnded=AA.prototype.sb;AA.prototype.stop=AA.prototype.stop;AA.prototype.start=AA.prototype.start;AA.prototype.isStarted=AA.prototype.vh;AA.prototype.getUpcoming=AA.prototype.lh;AA.prototype.getCurrent=AA.prototype.Yc;AA.prototype.getQueue=AA.prototype.kh;AA.prototype.getPosition=AA.prototype.getPosition;AA.prototype.off=AA.prototype.off;
5
+ AA.prototype.one=AA.prototype.one;AA.prototype.on=AA.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 Yy="apiUrl config is missing",Zy=function(a,b){a.j=a.j.filter(c=>c!==b)},$y=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]},ez=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Sf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){az(a,b<<3|2);b=new bz;for(let e=0;e<c.length;e++)d(b,c[e]);cz(a,b.length());dz(a,b.end())}else az(a,
2
- b<<3|0),d(a,c)},cz=function(a,b){if(0<=b)az(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},fz=function(a,b,c){ez(a,b,c,(d,e)=>{cz(d,e)})},az=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},hz=function(a,b,c){ez(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=$y(e);gz(d,f,g)}}else{{const [f,g]=$y(e);gz(d,f,g)}}})},iz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Sf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
3
- 0;e<c.length;e++){az(a,b<<3|2);const f=new bz;d(f,c[e]);cz(a,f.length());dz(a,f.end())}else az(a,b<<3|2),b=new bz,d(b,c),cz(a,b.length()),dz(a,b.end())},jz=function(a,b,c){iz(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)}})},dz=function(a,b){a.a.push.apply(a.a,b)},kz=function(a,b,c){iz(a,b,c,(d,e)=>{dz(d,e.a())})},lz=function(a,b,c){iz(a,b,c,(d,e)=>{dz(d,e)})},gz=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)},nz=function(a){const b=new mz;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},rz=function(a){return _.x(function*(){if(!a.j&&!a.f){0===a.a.length&&oz(a,new pz);var b=()=>
5
- {};a.f=new Promise(c=>{b=c});try{const c=new qz;c.f=a.o;c.events.push(...a.a);const d=[...a.a],e=yield fetch(a.l,{method:_.tb,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}}})},uz=function(a,b,c,d,e,f,g){const h=new sz;h.headers=[new tz("CL-BROWSER-NAME",b),new tz("CL-BROWSER-VERSION",
6
- c),new tz("CL-OS-FAMILY",d),new tz("CL-OS-VERSION",e),new tz("CL-SDK-NAME",f),new tz("CL-SDK-NAME",f),new tz("CL-SDK-VERSION",g)];oz(a,h)},oz=function(a,b){if(!a.j){var c=new vz(a.w);c.sessionId=a.A;{var d=Date.now();const e=new wz;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)}},xz=function(a){return _.x(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield rz(a),a.a=[]);a.j=!0})},yz=function(a){_.x(function*(){a.g.info("Destroy the session and stop sending events.");
7
- _.uh(a.f);a.a=!1;const b=a.m.getNetworkEngine();b.He(a.o);b.ld(a.j);Zy(b,a.j);a.h&&(yield xz(a.h),a.h=null)})},Gz=function(a){switch(a){case _.Co:return zz;case _.Do:return Az;case _.xo:return Bz;case _.Fo:return Cz;case _.Eo:return Dz;case _.uo:return Ez;case _.Bo:return Fz;default:return null}},Hz=function(a,b){a.g.debug("Sending event",b);oz(a.h,b)},Pz=function(a,b){switch(a){case 1:return Iz;case 2:return b===_.w?Jz:b===_.p?Kz:b===_.G?Lz:b===_.ee?Mz:Nz;case 3:return Oz;default:return Nz}};var bz=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var Qz=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new bz;kz(a,1,this.downloadId);fz(a,2,this.h);kz(a,3,this.duration);fz(a,4,this.j);kz(a,5,this.f);return a.end()}getId(){return 4}};var Rz=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new bz;fz(a,1,this.f);kz(a,2,this.downloadId);jz(a,3,this.url);kz(a,4,this.headers);jz(a,5,null);kz(a,6,null);kz(a,7,this.duration);hz(a,8,this.size);return a.end()}getId(){return 2}};var Sz=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new bz;fz(a,1,this.h);lz(a,2,this.f);return a.end()}};var Tz=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new bz;fz(a,1,this.errorCode);fz(a,2,this.severity);jz(a,3,this.message);jz(a,4,this.f);kz(a,5,this.cause);return a.end()}getId(){return 7}};var tz=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new bz;jz(a,1,this.key);jz(a,2,this.value);return a.end()}};var Uz=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new bz;fz(a,1,this.code);fz(a,2,this.severity);kz(a,3,this.cause);return a.end()}getId(){return 12}};var Vz=class{constructor(){this.data=null}a(){const a=new bz;lz(a,1,this.data);return a.end()}};var Wz=class extends Vz{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 sz=class{constructor(){this.headers=[]}a(){const a=new bz;kz(a,1,this.headers);return a.end()}getId(){return 1}};var pz=class{constructor(){}a(){return(new bz).end()}getId(){return 6}};var vz=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new bz;kz(a,1,this.j);kz(a,2,this.sessionId);kz(a,3,this.time);hz(a,4,null);jz(a,5,null);fz(a,6,this.h);lz(a,7,this.f);return a.end()}};var qz=class{constructor(){this.f=null;this.events=[]}a(){const a=new bz;lz(a,1,this.f);kz(a,2,this.events);return a.end()}};var wz=class{constructor(){this.f=this.h=null}a(){const a=new bz;hz(a,1,this.h);fz(a,2,this.f);return a.end()}};var mz=class{constructor(){this.f=this.h=null}a(){const a=new bz;hz(a,1,this.h);fz(a,2,this.f);return a.end()}};var Xz=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 Wz;this.A=new Wz;this.a=[];this.h=setInterval(()=>rz(this),k);this.f=null;this.j=!1;uz(this,b,c,d,e,f,g)}};var Yz=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new bz;fz(a,1,this.previousState);fz(a,2,this.currentState);fz(a,3,this.reason);kz(a,4,null);kz(a,5,null);kz(a,6,null);return a.end()}getId(){return 5}};var bA=class extends _.iv{constructor(){super();this.m=null;this.a=this.l=!1;this.f=new _.jt;this.h=null;this.g=new _.S("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!==_.Ge))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.l=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.qa),this.g.info("Create a session and start sending events."),
8
- a=_.Xk(),this.h=new Xz(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.da,b.apiUrl),this.f.on(this.m,_.Pf,this.B.bind(this)),this.f.on(this.m,_.Hf,this.A.bind(this)),this.f.on(this.m,_.Gf,this.w.bind(this)),this.f.on(this.m,_.r,this.T.bind(this)),a=this.m.getNetworkEngine(),a.Xd(this.o),a.vc(this.j),a.j.push(this.j)):(this.g.warn(Yy),a.onError(new _.I(1,9,15E3,Yy)))}onPlayerWillRelease(){yz(this)}id(){return"sessions"}B(a){if(!this.a){a=a.detail;var b=a.currentState,
9
- c=new Yz;c.previousState=Gz(a.previousState);c.currentState=Gz(b);Hz(this,c)}}A(){if(!this.a){var a=new Yz;a.previousState=Gz(this.m.getState());a.currentState=Zz;Hz(this,a);this.a=!0}}w(){if(this.a){var a=new Yz;a.previousState=Zz;a.currentState=Gz(this.m.getState());Hz(this,a);this.a=!1}}T(a){a=a.detail;var b=new Uz;b=new Tz(new Sz(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.F?$z:aA;Hz(this,b)}F(a){const b=new Wz;a.downloadId=b;
10
- const c=new Rz(Pz(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new tz(d,a.headers[d]));Hz(this,c)}C(a){var b=a.request.downloadId;b?(b=new Qz(b,a.data.byteLength,nz(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new tz(c,a.headers[c])),Hz(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.Yq(new class{create(){return new bA}});var aA=1,$z=2;var zz=0,Az=2,Fz=3,Zz=5,Bz=6,Cz=8,Dz=10,Ez=11;var Iz=0,Jz=1,Kz=2,Lz=3,Mz=4,Oz=5,Nz=9;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var tz="apiUrl config is missing",uz=function(a,b){a.j=a.j.filter(c=>c!==b)},vz=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]},Az=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Vf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){wz(a,b<<3|2);b=new xz;for(let e=0;e<c.length;e++)d(b,c[e]);yz(a,b.length());zz(a,b.end())}else wz(a,
2
+ b<<3|0),d(a,c)},yz=function(a,b){if(0<=b)wz(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},Bz=function(a,b,c){Az(a,b,c,(d,e)=>{yz(d,e)})},wz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},Dz=function(a,b,c){Az(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=vz(e);Cz(d,f,g)}}else{{const [f,g]=vz(e);Cz(d,f,g)}}})},Ez=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Vf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
3
+ 0;e<c.length;e++){wz(a,b<<3|2);const f=new xz;d(f,c[e]);yz(a,f.length());zz(a,f.end())}else wz(a,b<<3|2),b=new xz,d(b,c),yz(a,b.length()),zz(a,b.end())},Fz=function(a,b,c){Ez(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)}})},zz=function(a,b){a.a.push.apply(a.a,b)},Gz=function(a,b,c){Ez(a,b,c,(d,e)=>{zz(d,e.a())})},Hz=function(a,b,c){Ez(a,b,c,(d,e)=>{zz(d,e)})},Cz=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)},Jz=function(a){const b=new Iz;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},Nz=function(a){return _.x(function*(){if(!a.j&&!a.f){0===a.a.length&&Kz(a,new Lz);var b=()=>
5
+ {};a.f=new Promise(c=>{b=c});try{const c=new Mz;c.f=a.o;c.events.push(...a.a);const d=[...a.a],e=yield fetch(a.l,{method:_.rb,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}}})},Qz=function(a,b,c,d,e,f,g){const h=new Oz;h.headers=[new Pz("CL-BROWSER-NAME",b),new Pz("CL-BROWSER-VERSION",
6
+ c),new Pz("CL-OS-FAMILY",d),new Pz("CL-OS-VERSION",e),new Pz("CL-SDK-NAME",f),new Pz("CL-SDK-NAME",f),new Pz("CL-SDK-VERSION",g)];Kz(a,h)},Kz=function(a,b){if(!a.j){var c=new Rz(a.w);c.sessionId=a.A;{var d=Date.now();const e=new Sz;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)}},Tz=function(a){return _.x(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield Nz(a),a.a=[]);a.j=!0})},Uz=function(a){_.x(function*(){a.g.info("Destroy the session and stop sending events.");
7
+ _.Ah(a.f);a.a=!1;const b=a.m.getNetworkEngine();b.Qe(a.o);b.od(a.j);uz(b,a.j);a.h&&(yield Tz(a.h),a.h=null)})},bA=function(a){switch(a){case _.Yo:return Vz;case _.Zo:return Wz;case _.Uo:return Xz;case _.ap:return Yz;case _.$o:return Zz;case _.Qo:return $z;case _.Ro:return aA;default:return null}},cA=function(a,b){a.g.debug("Sending event",b);Kz(a.h,b)},kA=function(a,b){switch(a){case 1:return dA;case 2:return b===_.w?eA:b===_.p?fA:b===_.G?gA:b===_.je?hA:iA;case 3:return jA;default:return iA}};var xz=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var lA=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new xz;Gz(a,1,this.downloadId);Bz(a,2,this.h);Gz(a,3,this.duration);Bz(a,4,this.j);Gz(a,5,this.f);return a.end()}getId(){return 4}};var mA=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new xz;Bz(a,1,this.f);Gz(a,2,this.downloadId);Fz(a,3,this.url);Gz(a,4,this.headers);Fz(a,5,null);Gz(a,6,null);Gz(a,7,this.duration);Dz(a,8,this.size);return a.end()}getId(){return 2}};var nA=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new xz;Bz(a,1,this.h);Hz(a,2,this.f);return a.end()}};var oA=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new xz;Bz(a,1,this.errorCode);Bz(a,2,this.severity);Fz(a,3,this.message);Fz(a,4,this.f);Gz(a,5,this.cause);return a.end()}getId(){return 7}};var Pz=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new xz;Fz(a,1,this.key);Fz(a,2,this.value);return a.end()}};var pA=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new xz;Bz(a,1,this.code);Bz(a,2,this.severity);Gz(a,3,this.cause);return a.end()}getId(){return 12}};var qA=class{constructor(){this.data=null}a(){const a=new xz;Hz(a,1,this.data);return a.end()}};var rA=class extends qA{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 Oz=class{constructor(){this.headers=[]}a(){const a=new xz;Gz(a,1,this.headers);return a.end()}getId(){return 1}};var Lz=class{constructor(){}a(){return(new xz).end()}getId(){return 6}};var Rz=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new xz;Gz(a,1,this.j);Gz(a,2,this.sessionId);Gz(a,3,this.time);Dz(a,4,null);Fz(a,5,null);Bz(a,6,this.h);Hz(a,7,this.f);return a.end()}};var Mz=class{constructor(){this.f=null;this.events=[]}a(){const a=new xz;Hz(a,1,this.f);Gz(a,2,this.events);return a.end()}};var Sz=class{constructor(){this.f=this.h=null}a(){const a=new xz;Dz(a,1,this.h);Bz(a,2,this.f);return a.end()}};var Iz=class{constructor(){this.f=this.h=null}a(){const a=new xz;Dz(a,1,this.h);Bz(a,2,this.f);return a.end()}};var sA=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 rA;this.A=new rA;this.a=[];this.h=setInterval(()=>Nz(this),k);this.f=null;this.j=!1;Qz(this,b,c,d,e,f,g)}};var tA=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new xz;Bz(a,1,this.previousState);Bz(a,2,this.currentState);Bz(a,3,this.reason);Gz(a,4,null);Gz(a,5,null);Gz(a,6,null);return a.end()}getId(){return 5}};var xA=class extends _.Fv{constructor(){super();this.m=null;this.a=this.l=!1;this.f=new _.xt;this.h=null;this.g=new _.S("clpp.sessions.SessionsPlugin");this.o=this.G.bind(this);this.j=this.F.bind(this)}onPlayerCreated(a){this.m=a}onContentWillLoad(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Ke))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.l=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.ra),this.g.info("Create a session and start sending events."),
8
+ a=_.el(),this.h=new sA(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.ea,b.apiUrl),this.f.on(this.m,_.Sf,this.C.bind(this)),this.f.on(this.m,_.Kf,this.B.bind(this)),this.f.on(this.m,_.Jf,this.A.bind(this)),this.f.on(this.m,_.r,this.w.bind(this)),a=this.m.getNetworkEngine(),a.fe(this.o),a.xc(this.j),a.j.push(this.j)):(this.g.warn(tz),a.onError(new _.H(1,9,15E3,tz)))}onPlayerWillRelease(){Uz(this)}id(){return"sessions"}C(a){if(!this.a){a=a.detail;var b=a.currentState,
9
+ c=new tA;c.previousState=bA(a.previousState);c.currentState=bA(b);cA(this,c)}}B(){if(!this.a){var a=new tA;a.previousState=bA(this.m.getState());a.currentState=uA;cA(this,a);this.a=!0}}A(){if(this.a){var a=new tA;a.previousState=uA;a.currentState=bA(this.m.getState());cA(this,a);this.a=!1}}w(a){a=a.detail;var b=new pA;b=new oA(new nA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.F?vA:wA;cA(this,b)}G(a){const b=new rA;a.downloadId=b;
10
+ const c=new mA(kA(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new Pz(d,a.headers[d]));cA(this,c)}F(a){var b=a.request.downloadId;b?(b=new lA(b,a.data.byteLength,Jz(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new Pz(c,a.headers[c])),cA(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.ur(new class{create(){return new xA}});var wA=1,vA=2;var Vz=0,Wz=2,aA=3,uA=5,Xz=6,Yz=8,Zz=10,$z=11;var dA=0,eA=1,fA=2,gA=3,hA=4,jA=5,iA=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 Hy="No surface found. Can not attach frame!",Iy="SIMID:Media:timeupdate",Jy="Starting creative",Ky=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},Ny=function(a,b){return new Promise((c,d)=>{new Ly(a.j,c,d,b);My(a,b)})},Oy=function(a){const b=Ky(a,"SIMID:Player:startCreative",void 0);Ny(a,b).then(()=>{var c=a.f;c.g.info(Jy);c.m.trigger(new _.E(_.Jf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
- c)})},Qy=function(a,b){_.x(function*(){a.h=b.sessionId;Py(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=Ky(a,"SIMID:Player:init",d);var e=Ny(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()}})},Py=function(a,b){My(a,Ky(a,"resolve",{messageId:b.messageId,
4
- value:void 0}))},My=function(a,b){a.h?(b.type!==Iy&&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}'`)},Ry=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=Ky(d,"SIMID:Player:resize",e);My(d,e)}})},Sy=function(a,b){a.g.info("SIMID Session created");a.a=b},Ty=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 _.E(_.Kf))},Uy=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}%`}},Vy=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=_.Fe;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
- _.Fe;this.a.style.overflow=_.ce;this.a.classList.add(_.hd);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.Sf?JSON.parse(b):b:null))if(b.type)switch(this.g.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":Qy(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=Uy(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=Uy(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);Py(this,b)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.S("clpp.simid.SimidPlayer");Sy(this.f,this)}load(a){window.addEventListener(_.ye,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(){Ty(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.ye,
10
- this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},Ly=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 Xy=class extends _.iv{constructor(){super();this.g=new _.S("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.A.bind(this);this.f=null;this.o=!1}id(){return"simid"}onPlayerCreated(a){this.g.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.h&&this.h.release();this.h=new Wy(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 Vy(this.h);var c=b.getContainer();this.j=Ry(this,c,b);this.j.observe(c);a.on(_.Zf,this.w)}else this.g.warn(Hy)}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&&(Oy(this.a),this.o=!0,this.g.info(Jy)),
12
- c&&(c=this.a,My(c,Ky(c,Iy,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(Hy),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(_.Zf,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Wy=class{constructor(a){this.m=a;this.a=null;this.g=new _.S("clpp.simid.Loader");
13
- this.h=!1;this.f=null}release(){this.g.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.I(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.I(1,10,10100,"No surface");return a}Gf(){return this.a}url(){return this.f?this.f.url:""}};_.Yq(new class{create(){return new Xy}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var cz="No surface found. Can not attach frame!",dz="SIMID:Media:timeupdate",ez="Starting creative",fz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},iz=function(a,b){return new Promise((c,d)=>{new gz(a.j,c,d,b);hz(a,b)})},jz=function(a){const b=fz(a,"SIMID:Player:startCreative",void 0);iz(a,b).then(()=>{var c=a.f;c.g.info(ez);c.m.trigger(new _.E(_.Mf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
+ c)})},lz=function(a,b){_.x(function*(){a.h=b.sessionId;kz(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=fz(a,"SIMID:Player:init",d);var e=iz(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()}})},kz=function(a,b){hz(a,fz(a,"resolve",{messageId:b.messageId,
4
+ value:void 0}))},hz=function(a,b){a.h?(b.type!==dz&&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}'`)},mz=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=fz(d,"SIMID:Player:resize",e);hz(d,e)}})},nz=function(a,b){a.g.info("SIMID Session created");a.a=b},oz=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 _.E(_.Nf))},pz=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}%`}},qz=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=_.Je;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
+ _.Je;this.a.style.overflow=_.he;this.a.classList.add(_.id);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.Vf?JSON.parse(b):b:null))if(b.type)switch(this.g.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":lz(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=pz(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=pz(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);kz(this,b)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.S("clpp.simid.SimidPlayer");nz(this.f,this)}load(a){window.addEventListener(_.Ce,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(){oz(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Ce,
10
+ this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},gz=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 sz=class extends _.Fv{constructor(){super();this.g=new _.S("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.A.bind(this);this.f=null;this.o=!1}id(){return"simid"}onPlayerCreated(a){this.g.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.h&&this.h.release();this.h=new rz(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 qz(this.h);var c=b.getContainer();this.j=mz(this,c,b);this.j.observe(c);a.on(_.bg,this.w)}else this.g.warn(cz)}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&&(jz(this.a),this.o=!0,this.g.info(ez)),
12
+ c&&(c=this.a,hz(c,fz(c,dz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(cz),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(_.bg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},rz=class{constructor(a){this.m=a;this.a=null;this.g=new _.S("clpp.simid.Loader");
13
+ this.h=!1;this.f=null}release(){this.g.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.H(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.H(1,10,10100,"No surface");return a}Of(){return this.a}url(){return this.f?this.f.url:""}};_.ur(new class{create(){return new sz}});};f.call(g, window);