@castlabs/prestoplay 6.23.0 → 6.24.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 (65) hide show
  1. package/CHANGELOG.md +23 -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 -32
  7. package/cjs/cl.core.js +606 -592
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +87 -81
  10. package/cjs/cl.externs.js +94 -30
  11. package/cjs/cl.freewheel.js +25 -24
  12. package/cjs/cl.hls.js +73 -70
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +347 -333
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +15 -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 -12
  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 +88 -88
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +492 -479
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +81 -76
  41. package/cl.externs.js +94 -30
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +75 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +17 -17
  47. package/cl.mse.js +309 -298
  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 +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +28 -28
  64. package/package.json +1 -1
  65. package/typings.d.ts +44 -10
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 IA=function(a){switch(a.type){case 1:return FA;case 2:return GA;case 3:return HA}},KA=function(a){const b=Object.keys(a).find(c=>JA.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},MA=function(a){let b={debug:!0,data:LA(a)};a.f&&a.f.muxOptionsOverride&&_.Zg(a.f.muxOptionsOverride)&&(b=_.Vg(b,a.f.muxOptionsOverride));b=_.Vg(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 _.nm(c.url);e.video_source_url=_.Pj(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().ka(),
3
- c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.g.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.na())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},NA=function(a){_.wh(a.a);a.j.jd(a.F);a.j.Fe(a.C)},LA=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},OA=function(a){a.a.on(a.m,_.ag,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.ag,b)});a.a.on(a.m,_.We,()=>a.emit(_.We));a.a.on(a.m,_.Pc,a.G.bind(a));a.a.on(a.m,_.Rf,a.I.bind(a));a.a.on(a.m,_.kg,()=>a.emit(_.Jf));a.a.on(a.m,_.jg,()=>a.emit(_.If));a.a.on(a.m,_.q,a.H.bind(a));a.a.on(a.m,_.bc,()=>a.emit("adbreakstart"));a.a.on(a.m,_.cc,()=>a.emit("adbreakend"));a.a.on(a.m,_.sc,()=>{a.emit("adplay");
5
- a.emit("adplaying")});a.a.on(a.m,_.nc,()=>a.emit("adpause"));a.a.on(a.m,_.pc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.tc,()=>a.emit("adended"));a.a.on(a.m,_.gc,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.mc,()=>a.emit("admidpoint"));a.a.on(a.m,_.uc,()=>a.emit("adthirdquartile"));a.j.tc(a.F);a.j.Vd(a.C);a.a.on(a.m,_.q,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;
6
- var d=new _.nm(b.uris[b.uriIndex]);b={request_start:c,request_type:IA(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.nm(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:IA(c),request_hostname:f.a,request_error:`${IA(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
- a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},PA=function(a,b){a.trigger(new _.D(_.q,{detail:b}))},QA=function(a){return!_.B(a)&&typeof a.init===_.be&&typeof a.emit===_.be},FA="manifest",GA="media",HA="encryption",JA=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var RA=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 _.st;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,MA(this))}catch(d){throw this.h=!1,NA(this),new _.H(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=LA(this),this.emit("videochange",
8
- a),this.l=!1);OA(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ha):(NA(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Fd);this.A?this.g.debug(_.fa):(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(_.Ie);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(_.Ne);
9
- switch(a.detail.currentState){case _.Mo:this.m.getConfiguration().autoplay&&this.emit(_.We);break;case _.Oo:this.emit(_.gf);break;case _.No:this.emit(_.Se);break;case _.Do:this.emit(_.Yd)}}H(a){this.g.debug(_.Ke);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(_.q,{player_error_code:a.code,player_error_message:b})}}J(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.nm(b.uris[b.uriIndex]);a={request_start:g,request_type:IA(b),request_hostname:d.a,request_id:KA(e),request_bytes_loaded:f,request_response_start:h,
11
- request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Pj(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var SA=class extends _.rv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.S("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new RA(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.Wg(c.muxdata);try{var d=[];typeof c===_.He&&(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===_.He){const g=f.muxdata;d=QA(g.muxLib)?g.muxLib:window.mux;if(!QA(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
- this.a=!1;const h=new _.H(1,9,9301);PA(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,PA(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&&PA(this.m,c),c;}}};_.y("clpp.muxdata.MuxDataPlugin",SA);SA.prototype.emit=SA.prototype.emit;
13
- SA.Id="mux";_.gr(new class{create(){return new SA}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var mB=function(a){switch(a.type){case 1:return jB;case 2:return kB;case 3:return lB}},oB=function(a){const b=Object.keys(a).find(c=>nB.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},qB=function(a){let b={debug:!0,data:pB(a)};a.f&&a.f.muxOptionsOverride&&_.oh(a.f.muxOptionsOverride)&&(b=_.kh(b,a.f.muxOptionsOverride));b=_.kh(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 _.Am(c.url);e.video_source_url=_.fk(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().oa(),
3
+ c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.g.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.ra())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},rB=function(a){_.Sh(a.a);a.j.vd(a.F);a.j.We(a.C)},pB=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},sB=function(a){a.a.on(a.m,_.ng,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.ng,b)});a.a.on(a.m,_.ff,()=>a.emit(_.ff));a.a.on(a.m,_.Yc,a.G.bind(a));a.a.on(a.m,_.Zf,a.I.bind(a));a.a.on(a.m,_.Bg,()=>a.emit(_.Rf));a.a.on(a.m,_.Ag,()=>a.emit(_.Qf));a.a.on(a.m,_.r,a.H.bind(a));a.a.on(a.m,_.hc,()=>a.emit("adbreakstart"));a.a.on(a.m,_.ic,()=>a.emit("adbreakend"));a.a.on(a.m,_.yc,()=>{a.emit("adplay");
5
+ a.emit("adplaying")});a.a.on(a.m,_.tc,()=>a.emit("adpause"));a.a.on(a.m,_.vc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.Bc,()=>a.emit("adended"));a.a.on(a.m,_.mc,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.sc,()=>a.emit("admidpoint"));a.a.on(a.m,_.Cc,()=>a.emit("adthirdquartile"));a.j.Ec(a.F);a.j.me(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 _.Am(b.uris[b.uriIndex]);b={request_start:c,request_type:mB(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.Am(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:mB(c),request_hostname:f.a,request_error:`${mB(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
+ a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},tB=function(a,b){a.trigger(new _.D(_.r,{detail:b}))},uB=function(a){return!_.B(a)&&typeof a.init===_.me&&typeof a.emit===_.me},jB="manifest",kB="media",lB="encryption",nB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var vB=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 _.Rt;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,qB(this))}catch(d){throw this.h=!1,rB(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=pB(this),this.emit("videochange",
8
+ a),this.l=!1);sB(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(rB(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Qd);this.A?this.g.debug(_.ha):(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(_.Se);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ra())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Xe);
9
+ switch(a.detail.currentState){case _.hp:this.m.getConfiguration().autoplay&&this.emit(_.ff);break;case _.jp:this.emit(_.rf);break;case _.ip:this.emit(_.bf);break;case _.Zo:this.emit(_.ie)}}H(a){this.g.debug(_.Ue);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 _.Am(b.uris[b.uriIndex]);a={request_start:g,request_type:mB(b),request_hostname:d.a,request_id:oB(e),request_bytes_loaded:f,request_response_start:h,
11
+ request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.fk(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var wB=class extends _.Xv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.S("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new vB(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.lh(c.muxdata);try{var d=[];typeof c===_.Re&&(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===_.Re){const g=f.muxdata;d=uB(g.muxLib)?g.muxLib:window.mux;if(!uB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
+ this.a=!1;const h=new _.I(1,9,9301);tB(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,tB(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&&tB(this.m,c),c;}}};_.z("clpp.muxdata.MuxDataPlugin",wB);wB.prototype.emit=wB.prototype.emit;
13
+ wB.Id="mux";_.Mr(new class{create(){return new wB}});};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 EA=function(a,b){let c=b.baseUrl;_.Vi(c,"/")||(c+="/");const d=g=>g&&(_.Ui(g,"https://")||_.Ui(g,"http://")||_.Ui(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.ju(a);a.Ya(_.yd,{licenseUrl:e,videoRobustness:[_.Eb,void 0],audioRobustness:[_.Db,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Fm,licenseResponse:_.Gm}});a.Ya(_.td,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.Im,licenseResponse:_.Jm,extractContentId:_.Km,certificateRequest:_.Lm}});a.Ya(_.wd,{licenseUrl:f,modifiers:{licenseRequest:_.Fm}});_.Sl(a)};
3
- _.y("clpp.onboard.OnboardComponent",class extends _.Ru{constructor(){super();this.g=new _.S("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Rl[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}'`),EA(b,a),this.j.add(b))}id(){return"onboard"}});
4
- _.y("clpp.onboard.register",EA);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var iB=function(a,b){let c=b.baseUrl;_.kj(c,"/")||(c+="/");const d=g=>g&&(_.jj(g,"https://")||_.jj(g,"http://")||_.jj(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.Gu(a);a.cb(_.Jd,{licenseUrl:e,videoRobustness:[_.Bb,void 0],audioRobustness:[_.Ab,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Sm,licenseResponse:_.Tm}});a.cb(_.Dd,{licenseUrl:b,
2
+ certificateUrl:b,modifiers:{licenseRequest:_.Vm,licenseResponse:_.Wm,extractContentId:_.Xm,certificateRequest:_.Ym}});a.cb(_.Hd,{licenseUrl:f,modifiers:{licenseRequest:_.Sm}});_.em(a)};
3
+ _.z("clpp.onboard.OnboardComponent",class extends _.Iv{constructor(){super();this.g=new _.S("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.dm[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}'`),iB(b,a),this.j.add(b))}id(){return"onboard"}});
4
+ _.z("clpp.onboard.register",iB);};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 oA="A persistent DRM session already exists for: ",pA="No DRM configuration.",qA="clpp.persistent",rA="clpp.persistent.SimpleSessionStorage",sA=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},uA=function(a,b,c,d,e,f){a.K=tA;const g=new Map,h=_.rn(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Pe,persistentState:_.Bf,sessionTypes:[_.Ue],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
- audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.In(a,g)},wA=function(a,b){a.K=vA;a.L=[];a.G=!0;return _.Jn(a,b)},xA=function(a,b){return _.x(function*(){const c=yield _.ao(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.cc=new _.Mn,d.push(e.cc));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)})},yA=function(a){a=a.h.keys();a=sA(a,b=>b.sessionId);return Array.from(a)},
3
- zA=function(a,b){const c=_.Ul(a),d=_.Bl({drm:a});d.drm=a;a=new _.Xo({qb:b,onError:()=>{},ve:()=>{},ue:()=>{},onEvent:()=>{},getConfiguration:()=>d,Cc:()=>null});a.f=c;return a},CA=function(a,b,c){return _.x(function*(){const d=AA;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)BA.debug(oA,e);else{var g=zA(a,c);try{yield wA(g,b);yield _.Zn(g);yield _.bo(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.rk(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:yA(g),
4
- keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw BA.error(`Error while persisting DRM session ${e}`),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else BA.debug(pA)})},vA=1,tA=2,DA=class{constructor(){this.g=new _.S(rA)}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 TA="A persistent DRM session already exists for: ",UA="No DRM configuration.",VA="clpp.persistent",WA="clpp.persistent.SimpleSessionStorage",XA=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},ZA=function(a,b,c,d,e,f){a.K=YA;const g=new Map,h=_.On(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Ze,persistentState:_.Jf,sessionTypes:[_.df],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
+ audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.go(a,g)},aB=function(a,b){a.K=$A;a.L=[];a.G=!0;return _.ho(a,b)},bB=function(a,b){return _.x(function*(){const c=yield _.yo(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.jc=new _.qn,d.push(e.jc));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)})},cB=function(a){a=a.h.keys();a=XA(a,b=>b.sessionId);return Array.from(a)},
3
+ dB=function(a,b){const c=_.gm(a),d=_.Ol({drm:a});d.drm=a;a=new _.qp({yb:b,onError:()=>{},Ne:()=>{},Me:()=>{},onEvent:()=>{},getConfiguration:()=>d,Oc:()=>null});a.f=c;return a},gB=function(a,b,c){return _.x(function*(){const d=eB;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)fB.debug(TA,e);else{var g=dB(a,c);try{yield aB(g,b);yield _.wo(g);yield _.zo(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Hk(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:cB(g),
4
+ keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw fB.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else fB.debug(UA)})},$A=1,YA=2,hB=class{constructor(){this.g=new _.S(WA)}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 rA}};_.y("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.$g(a.store)||c.push("store"),_.$g(a.get)||c.push("get"),_.$g(a.delete)||c.push("delete"),_.$g(a.clear)||c.push("clear"),_.$g(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw BA.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});AA=a});
7
- _.y("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=AA,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.Ro(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(pA);var g=b.offlineId;if(typeof g!==_.Uf||!g.length)throw e("Missing offline id.");if(yield d.get(g))BA.debug(oA,g);else{var h=_.Bl();d=new _.Yq;g=[];for(var k of c){const l=new k;_.El(l.id())||(l.f(),_.Gl(l),g.push(l))}k=null;try{k=yield _.Es(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=_.Cs(l.periods);yield CA(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(),_.Dl.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
- _.y("clpp.persistent.removeLicense",function(a){return _.x(function*(){var b=AA;if(_.bh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Yq,c=zA(e.drmConfig,d),yield uA(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Zn(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield xA(c,f);BA.debug("successfully removed session with id",f)}))),yield b.delete(a)):BA.debug("No persistent DRM session found")}catch(e){throw BA.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 BA.warn("Invalid offlineId")})});var AA=new DA,BA=new _.S(qA);_.y("clpp.persistent.PersistentLicenseComponent",class extends _.Ru{constructor(){super();this.g=new _.S(qA)}id(){return _.Te}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 CA(d,b,e),a.trigger(new _.D(_.Rd,{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=AA;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 WA}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.ph(a.store)||c.push("store"),_.ph(a.get)||c.push("get"),_.ph(a.delete)||c.push("delete"),_.ph(a.clear)||c.push("clear"),_.ph(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw fB.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});eB=a});
7
+ _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=eB,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.mp(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(UA);var g=b.offlineId;if(typeof g!==_.bg||!g.length)throw e("Missing offline id.");if(yield d.get(g))fB.debug(TA,g);else{var h=_.Ol();d=new _.Dr;g=[];for(var k of c){const l=new k;_.Rl(l.id())||(l.f(),_.Tl(l),g.push(l))}k=null;try{k=yield _.at(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
+ const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,onContentSteeringInfoFound:()=>null,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.I(_.F,4,4014));const m=_.Zs(l.periods);yield gB(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(),_.Ql.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=eB;if(_.rh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Dr,c=dB(e.drmConfig,d),yield ZA(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.wo(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield bB(c,f);fB.debug("successfully removed session with id",f)}))),yield b.delete(a)):fB.debug("No persistent DRM session found")}catch(e){throw fB.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 fB.warn("Invalid offlineId")})});_.z("clpp.persistent.getSessionStorage",function(){return eB});var eB=new hB,fB=new _.S(VA);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Iv{constructor(){super();this.g=new _.S(VA)}id(){return _.cf}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 gB(d,b,e),a.trigger(new _.D(_.be,{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=eB;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 lA=function(a,b){return 0<=b&&b<a.a.length},mA=function(a){a.trigger(new _.D(_.jf))},nA=class extends _.eu{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}Zg(){return this.a}Tc(){return 0<this.a.length&&lA(this,this.f)?this.a[this.f]:null}$g(){const a=this.f+1;return 0<
2
- this.a.length&&lA(this,a)?this.a[a]:null}jh(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Yd,this.j),this.zd(this.f,!0))}stop(){this.h=!1;this.m.off(_.Yd,this.j)}rb(){this.next()}next(){const a=this;return _.x(function*(){yield a.zd(Math.min(a.a.length-1,a.f+1))})}Ah(){const a=this;return _.x(function*(){yield a.zd(Math.max(0,a.f-1))})}zd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&lA(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 _.D(_.hf,{item:d})))}})}append(a){this.a.push(a);mA(this)}ih(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));mA(this)}}remove(a){if(0<this.a.length&&lA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);mA(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;mA(this)}};_.y("clpp.Playlist",nA);nA.prototype.clear=nA.prototype.clear;nA.prototype.remove=nA.prototype.remove;nA.prototype.insert=nA.prototype.ih;
4
- nA.prototype.append=nA.prototype.append;nA.prototype.goTo=nA.prototype.zd;nA.prototype.previous=nA.prototype.Ah;nA.prototype.next=nA.prototype.next;nA.prototype.onEnded=nA.prototype.rb;nA.prototype.stop=nA.prototype.stop;nA.prototype.start=nA.prototype.start;nA.prototype.isStarted=nA.prototype.jh;nA.prototype.getUpcoming=nA.prototype.$g;nA.prototype.getCurrent=nA.prototype.Tc;nA.prototype.getQueue=nA.prototype.Zg;nA.prototype.getPosition=nA.prototype.getPosition;nA.prototype.off=nA.prototype.off;
5
- nA.prototype.one=nA.prototype.one;nA.prototype.on=nA.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var QA=function(a,b){return 0<=b&&b<a.a.length},RA=function(a){a.trigger(new _.D(_.uf))},SA=class extends _.Bu{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.Da.bind(this)}getPosition(){return this.f}wh(){return this.a}dd(){return 0<this.a.length&&QA(this,this.f)?this.a[this.f]:null}xh(){const a=this.f+1;return 0<
2
+ this.a.length&&QA(this,a)?this.a[a]:null}Ih(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.ie,this.j),this.Pd(this.f,!0))}stop(){this.h=!1;this.m.off(_.ie,this.j)}Da(){this.next()}next(){const a=this;return _.x(function*(){yield a.Pd(Math.min(a.a.length-1,a.f+1))})}Zh(){const a=this;return _.x(function*(){yield a.Pd(Math.max(0,a.f-1))})}Pd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&QA(c,a)&&(b||c.f!==a)){c.f=a;var d=c.dd();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
+ c.trigger(new _.D(_.sf,{item:d})))}})}append(a){this.a.push(a);RA(this)}Gh(a,b){if(0<=b&&b<=this.a.length){const c=this.dd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));RA(this)}}remove(a){if(0<this.a.length&&QA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);RA(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;RA(this)}};_.z("clpp.Playlist",SA);SA.prototype.clear=SA.prototype.clear;SA.prototype.remove=SA.prototype.remove;SA.prototype.insert=SA.prototype.Gh;
4
+ SA.prototype.append=SA.prototype.append;SA.prototype.goTo=SA.prototype.Pd;SA.prototype.previous=SA.prototype.Zh;SA.prototype.next=SA.prototype.next;SA.prototype.onEnded=SA.prototype.Da;SA.prototype.stop=SA.prototype.stop;SA.prototype.start=SA.prototype.start;SA.prototype.isStarted=SA.prototype.Ih;SA.prototype.getUpcoming=SA.prototype.xh;SA.prototype.getCurrent=SA.prototype.dd;SA.prototype.getQueue=SA.prototype.wh;SA.prototype.getPosition=SA.prototype.getPosition;SA.prototype.off=SA.prototype.off;
5
+ SA.prototype.one=SA.prototype.one;SA.prototype.on=SA.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 gz="apiUrl config is missing",hz=function(a,b){a.j=a.j.filter(c=>c!==b)},iz=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]},nz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Uf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){jz(a,b<<3|2);b=new kz;for(let e=0;e<c.length;e++)d(b,c[e]);lz(a,b.length());mz(a,b.end())}else jz(a,
2
- b<<3|0),d(a,c)},lz=function(a,b){if(0<=b)jz(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},oz=function(a,b,c){nz(a,b,c,(d,e)=>{lz(d,e)})},jz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},qz=function(a,b,c){nz(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=iz(e);pz(d,f,g)}}else{{const [f,g]=iz(e);pz(d,f,g)}}})},rz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Uf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
3
- 0;e<c.length;e++){jz(a,b<<3|2);const f=new kz;d(f,c[e]);lz(a,f.length());mz(a,f.end())}else jz(a,b<<3|2),b=new kz,d(b,c),lz(a,b.length()),mz(a,b.end())},sz=function(a,b,c){rz(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)}})},mz=function(a,b){a.a.push.apply(a.a,b)},tz=function(a,b,c){rz(a,b,c,(d,e)=>{mz(d,e.a())})},uz=function(a,b,c){rz(a,b,c,(d,e)=>{mz(d,e)})},pz=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)},wz=function(a){const b=new vz;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},Az=function(a){return _.x(function*(){if(!a.j&&!a.f){0===a.a.length&&xz(a,new yz);var b=()=>
5
- {};a.f=new Promise(c=>{b=c});try{const c=new zz;c.f=a.o;c.events.push(...a.a);const d=[...a.a],e=yield fetch(a.l,{method:_.qb,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}}})},Dz=function(a,b,c,d,e,f,g){const h=new Bz;h.headers=[new Cz("CL-BROWSER-NAME",b),new Cz("CL-BROWSER-VERSION",
6
- c),new Cz("CL-OS-FAMILY",d),new Cz("CL-OS-VERSION",e),new Cz("CL-SDK-NAME",f),new Cz("CL-SDK-NAME",f),new Cz("CL-SDK-VERSION",g)];xz(a,h)},xz=function(a,b){if(!a.j){var c=new Ez(a.w);c.sessionId=a.A;{var d=Date.now();const e=new Fz;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)}},Gz=function(a){return _.x(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield Az(a),a.a=[]);a.j=!0})},Hz=function(a){_.x(function*(){a.g.info("Destroy the session and stop sending events.");
7
- _.wh(a.f);a.a=!1;const b=a.m.getNetworkEngine();b.Fe(a.o);b.jd(a.j);hz(b,a.j);a.h&&(yield Gz(a.h),a.h=null)})},Pz=function(a){switch(a){case _.Lo:return Iz;case _.Mo:return Jz;case _.Ho:return Kz;case _.Oo:return Lz;case _.No:return Mz;case _.Do:return Nz;case _.Eo:return Oz;default:return null}},Qz=function(a,b){a.g.debug("Sending event",b);xz(a.h,b)},Yz=function(a,b){switch(a){case 1:return Rz;case 2:return b===_.w?Sz:b===_.p?Tz:b===_.G?Uz:b===_.fe?Vz:Wz;case 3:return Xz;default:return Wz}};var kz=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var Zz=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new kz;tz(a,1,this.downloadId);oz(a,2,this.h);tz(a,3,this.duration);oz(a,4,this.j);tz(a,5,this.f);return a.end()}getId(){return 4}};var $z=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new kz;oz(a,1,this.f);tz(a,2,this.downloadId);sz(a,3,this.url);tz(a,4,this.headers);sz(a,5,null);tz(a,6,null);tz(a,7,this.duration);qz(a,8,this.size);return a.end()}getId(){return 2}};var aA=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new kz;oz(a,1,this.h);uz(a,2,this.f);return a.end()}};var bA=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new kz;oz(a,1,this.errorCode);oz(a,2,this.severity);sz(a,3,this.message);sz(a,4,this.f);tz(a,5,this.cause);return a.end()}getId(){return 7}};var Cz=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new kz;sz(a,1,this.key);sz(a,2,this.value);return a.end()}};var cA=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new kz;oz(a,1,this.code);oz(a,2,this.severity);tz(a,3,this.cause);return a.end()}getId(){return 12}};var dA=class{constructor(){this.data=null}a(){const a=new kz;uz(a,1,this.data);return a.end()}};var eA=class extends dA{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 Bz=class{constructor(){this.headers=[]}a(){const a=new kz;tz(a,1,this.headers);return a.end()}getId(){return 1}};var yz=class{constructor(){}a(){return(new kz).end()}getId(){return 6}};var Ez=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new kz;tz(a,1,this.j);tz(a,2,this.sessionId);tz(a,3,this.time);qz(a,4,null);sz(a,5,null);oz(a,6,this.h);uz(a,7,this.f);return a.end()}};var zz=class{constructor(){this.f=null;this.events=[]}a(){const a=new kz;uz(a,1,this.f);tz(a,2,this.events);return a.end()}};var Fz=class{constructor(){this.f=this.h=null}a(){const a=new kz;qz(a,1,this.h);oz(a,2,this.f);return a.end()}};var vz=class{constructor(){this.f=this.h=null}a(){const a=new kz;qz(a,1,this.h);oz(a,2,this.f);return a.end()}};var fA=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 eA;this.A=new eA;this.a=[];this.h=setInterval(()=>Az(this),k);this.f=null;this.j=!1;Dz(this,b,c,d,e,f,g)}};var gA=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new kz;oz(a,1,this.previousState);oz(a,2,this.currentState);oz(a,3,this.reason);tz(a,4,null);tz(a,5,null);tz(a,6,null);return a.end()}getId(){return 5}};var kA=class extends _.rv{constructor(){super();this.m=null;this.a=this.l=!1;this.f=new _.st;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!==_.He))||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=_.$k(),this.h=new fA(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.da,b.apiUrl),this.f.on(this.m,_.Rf,this.C.bind(this)),this.f.on(this.m,_.Jf,this.B.bind(this)),this.f.on(this.m,_.If,this.A.bind(this)),this.f.on(this.m,_.q,this.w.bind(this)),a=this.m.getNetworkEngine(),a.Vd(this.o),a.tc(this.j),a.j.push(this.j)):(this.g.warn(gz),a.onError(new _.H(1,9,15E3,gz)))}onPlayerWillRelease(){Hz(this)}id(){return"sessions"}C(a){if(!this.a){a=a.detail;var b=a.currentState,
9
- c=new gA;c.previousState=Pz(a.previousState);c.currentState=Pz(b);Qz(this,c)}}B(){if(!this.a){var a=new gA;a.previousState=Pz(this.m.getState());a.currentState=hA;Qz(this,a);this.a=!0}}A(){if(this.a){var a=new gA;a.previousState=hA;a.currentState=Pz(this.m.getState());Qz(this,a);this.a=!1}}w(a){a=a.detail;var b=new cA;b=new bA(new aA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.F?iA:jA;Qz(this,b)}G(a){const b=new eA;a.downloadId=b;
10
- const c=new $z(Yz(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new Cz(d,a.headers[d]));Qz(this,c)}F(a){var b=a.request.downloadId;b?(b=new Zz(b,a.data.byteLength,wz(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new Cz(c,a.headers[c])),Qz(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.gr(new class{create(){return new kA}});var jA=1,iA=2;var Iz=0,Jz=2,Oz=3,hA=5,Kz=6,Lz=8,Mz=10,Nz=11;var Rz=0,Sz=1,Tz=2,Uz=3,Vz=4,Xz=5,Wz=9;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Lz="apiUrl config is missing",Mz=function(a,b){a.j=a.j.filter(c=>c!==b)},Nz=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]},Sz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.bg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){Oz(a,b<<3|2);b=new Pz;for(let e=0;e<c.length;e++)d(b,c[e]);Qz(a,b.length());Rz(a,b.end())}else Oz(a,
2
+ b<<3|0),d(a,c)},Qz=function(a,b){if(0<=b)Oz(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},Tz=function(a,b,c){Sz(a,b,c,(d,e)=>{Qz(d,e)})},Oz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},Vz=function(a,b,c){Sz(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=Nz(e);Uz(d,f,g)}}else{{const [f,g]=Nz(e);Uz(d,f,g)}}})},Wz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.bg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
3
+ 0;e<c.length;e++){Oz(a,b<<3|2);const f=new Pz;d(f,c[e]);Qz(a,f.length());Rz(a,f.end())}else Oz(a,b<<3|2),b=new Pz,d(b,c),Qz(a,b.length()),Rz(a,b.end())},Xz=function(a,b,c){Wz(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)}})},Rz=function(a,b){a.a.push.apply(a.a,b)},Yz=function(a,b,c){Wz(a,b,c,(d,e)=>{Rz(d,e.a())})},Zz=function(a,b,c){Wz(a,b,c,(d,e)=>{Rz(d,e)})},Uz=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)},aA=function(a){const b=new $z;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},eA=function(a){return _.x(function*(){if(!a.j&&!a.f){0===a.a.length&&bA(a,new cA);var b=()=>
5
+ {};a.f=new Promise(c=>{b=c});try{const c=new dA;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}}})},hA=function(a,b,c,d,e,f,g){const h=new fA;h.headers=[new gA("CL-BROWSER-NAME",b),new gA("CL-BROWSER-VERSION",
6
+ c),new gA("CL-OS-FAMILY",d),new gA("CL-OS-VERSION",e),new gA("CL-SDK-NAME",f),new gA("CL-SDK-NAME",f),new gA("CL-SDK-VERSION",g)];bA(a,h)},bA=function(a,b){if(!a.j){var c=new iA(a.w);c.sessionId=a.A;{var d=Date.now();const e=new jA;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)}},kA=function(a){return _.x(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield eA(a),a.a=[]);a.j=!0})},lA=function(a){_.x(function*(){a.g.info("Destroy the session and stop sending events.");
7
+ _.Sh(a.f);a.a=!1;const b=a.m.getNetworkEngine();b.We(a.o);b.vd(a.j);Mz(b,a.j);a.h&&(yield kA(a.h),a.h=null)})},tA=function(a){switch(a){case _.gp:return mA;case _.hp:return nA;case _.cp:return oA;case _.jp:return pA;case _.ip:return qA;case _.Zo:return rA;case _.$o:return sA;default:return null}},uA=function(a,b){a.g.debug("Sending event",b);bA(a.h,b)},CA=function(a,b){switch(a){case 1:return vA;case 2:return b===_.w?wA:b===_.p?xA:b===_.H?yA:b===_.qe?zA:AA;case 3:return BA;default:return AA}};var Pz=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var DA=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new Pz;Yz(a,1,this.downloadId);Tz(a,2,this.h);Yz(a,3,this.duration);Tz(a,4,this.j);Yz(a,5,this.f);return a.end()}getId(){return 4}};var EA=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new Pz;Tz(a,1,this.f);Yz(a,2,this.downloadId);Xz(a,3,this.url);Yz(a,4,this.headers);Xz(a,5,null);Yz(a,6,null);Yz(a,7,this.duration);Vz(a,8,this.size);return a.end()}getId(){return 2}};var FA=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new Pz;Tz(a,1,this.h);Zz(a,2,this.f);return a.end()}};var GA=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new Pz;Tz(a,1,this.errorCode);Tz(a,2,this.severity);Xz(a,3,this.message);Xz(a,4,this.f);Yz(a,5,this.cause);return a.end()}getId(){return 7}};var gA=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new Pz;Xz(a,1,this.key);Xz(a,2,this.value);return a.end()}};var HA=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new Pz;Tz(a,1,this.code);Tz(a,2,this.severity);Yz(a,3,this.cause);return a.end()}getId(){return 12}};var IA=class{constructor(){this.data=null}a(){const a=new Pz;Zz(a,1,this.data);return a.end()}};var JA=class extends IA{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 fA=class{constructor(){this.headers=[]}a(){const a=new Pz;Yz(a,1,this.headers);return a.end()}getId(){return 1}};var cA=class{constructor(){}a(){return(new Pz).end()}getId(){return 6}};var iA=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new Pz;Yz(a,1,this.j);Yz(a,2,this.sessionId);Yz(a,3,this.time);Vz(a,4,null);Xz(a,5,null);Tz(a,6,this.h);Zz(a,7,this.f);return a.end()}};var dA=class{constructor(){this.f=null;this.events=[]}a(){const a=new Pz;Zz(a,1,this.f);Yz(a,2,this.events);return a.end()}};var jA=class{constructor(){this.f=this.h=null}a(){const a=new Pz;Vz(a,1,this.h);Tz(a,2,this.f);return a.end()}};var $z=class{constructor(){this.f=this.h=null}a(){const a=new Pz;Vz(a,1,this.h);Tz(a,2,this.f);return a.end()}};var KA=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 JA;this.A=new JA;this.a=[];this.h=setInterval(()=>eA(this),k);this.f=null;this.j=!1;hA(this,b,c,d,e,f,g)}};var LA=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new Pz;Tz(a,1,this.previousState);Tz(a,2,this.currentState);Tz(a,3,this.reason);Yz(a,4,null);Yz(a,5,null);Yz(a,6,null);return a.end()}getId(){return 5}};var PA=class extends _.Xv{constructor(){super();this.m=null;this.a=this.l=!1;this.f=new _.Rt;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!==_.Re))||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=_.ol(),this.h=new KA(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.ea,b.apiUrl),this.f.on(this.m,_.Zf,this.C.bind(this)),this.f.on(this.m,_.Rf,this.B.bind(this)),this.f.on(this.m,_.Qf,this.A.bind(this)),this.f.on(this.m,_.r,this.w.bind(this)),a=this.m.getNetworkEngine(),a.me(this.o),a.Ec(this.j),a.j.push(this.j)):(this.g.warn(Lz),a.onError(new _.I(1,9,15E3,Lz)))}onPlayerWillRelease(){lA(this)}id(){return"sessions"}C(a){if(!this.a){a=a.detail;var b=a.currentState,
9
+ c=new LA;c.previousState=tA(a.previousState);c.currentState=tA(b);uA(this,c)}}B(){if(!this.a){var a=new LA;a.previousState=tA(this.m.getState());a.currentState=MA;uA(this,a);this.a=!0}}A(){if(this.a){var a=new LA;a.previousState=MA;a.currentState=tA(this.m.getState());uA(this,a);this.a=!1}}w(a){a=a.detail;var b=new HA;b=new GA(new FA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.F?NA:OA;uA(this,b)}G(a){const b=new JA;a.downloadId=b;
10
+ const c=new EA(CA(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new gA(d,a.headers[d]));uA(this,c)}F(a){var b=a.request.downloadId;b?(b=new DA(b,a.data.byteLength,aA(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new gA(c,a.headers[c])),uA(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.Mr(new class{create(){return new PA}});var OA=1,NA=2;var mA=0,nA=2,sA=3,MA=5,oA=6,pA=8,qA=10,rA=11;var vA=0,wA=1,xA=2,yA=3,zA=4,BA=5,AA=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 Qy="No surface found. Can not attach frame!",Ry="SIMID:Media:timeupdate",Sy="Starting creative",Ty=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},Wy=function(a,b){return new Promise((c,d)=>{new Uy(a.j,c,d,b);Vy(a,b)})},Xy=function(a){const b=Ty(a,"SIMID:Player:startCreative",void 0);Wy(a,b).then(()=>{var c=a.f;c.g.info(Sy);c.m.trigger(new _.D(_.Lf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
- c)})},Zy=function(a,b){_.x(function*(){a.h=b.sessionId;Yy(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=Ty(a,"SIMID:Player:init",d);var e=Wy(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()}})},Yy=function(a,b){Vy(a,Ty(a,"resolve",{messageId:b.messageId,
4
- value:void 0}))},Vy=function(a,b){a.h?(b.type!==Ry&&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}'`)},$y=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=Ty(d,"SIMID:Player:resize",e);Vy(d,e)}})},az=function(a,b){a.g.info("SIMID Session created");a.a=b},bz=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(()=>{a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height=
6
- "";a.h=!1;a.m.trigger(new _.D(_.Mf))},cz=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}%`}},dz=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=_.Ge;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
- _.Ge;this.a.style.overflow=_.de;this.a.classList.add(_.gd);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.Uf?JSON.parse(b):b:null))if(b.type)switch(this.g.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":Zy(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=cz(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=cz(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);Yy(this,b)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.S("clpp.simid.SimidPlayer");az(this.f,this)}load(a){window.addEventListener(_.ze,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(){bz(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.ze,
10
- this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},Uy=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 fz=class extends _.rv{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 ez(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 dz(this.h);var c=b.getContainer();this.j=$y(this,c,b);this.j.observe(c);a.on(_.ag,this.w)}else this.g.warn(Qy)}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&&(Xy(this.a),this.o=!0,this.g.info(Sy)),
12
- c&&(c=this.a,Vy(c,Ty(c,Ry,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(Qy),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(_.ag,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},ez=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}Ef(){return this.a}url(){return this.f?this.f.url:""}};_.gr(new class{create(){return new fz}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var uz="No surface found. Can not attach frame!",vz="SIMID:Media:timeupdate",wz="Starting creative",xz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},Az=function(a,b){return new Promise((c,d)=>{new yz(a.j,c,d,b);zz(a,b)})},Bz=function(a){const b=xz(a,"SIMID:Player:startCreative",void 0);Az(a,b).then(()=>{var c=a.f;c.g.info(wz);c.m.trigger(new _.D(_.Tf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
+ c)})},Dz=function(a,b){_.x(function*(){a.h=b.sessionId;Cz(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=xz(a,"SIMID:Player:init",d);var e=Az(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()}})},Cz=function(a,b){zz(a,xz(a,"resolve",{messageId:b.messageId,
4
+ value:void 0}))},zz=function(a,b){a.h?(b.type!==vz&&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}'`)},Ez=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=xz(d,"SIMID:Player:resize",e);zz(d,e)}})},Fz=function(a,b){a.g.info("SIMID Session created");a.a=b},Gz=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(()=>{a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height=
6
+ "";a.h=!1;a.m.trigger(new _.D(_.Uf))},Hz=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}%`}},Iz=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=_.Qe;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
7
+ _.Qe;this.a.style.overflow=_.oe;this.a.classList.add(_.od);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.bg?JSON.parse(b):b:null))if(b.type)switch(this.g.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":Dz(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=Hz(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=Hz(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);Cz(this,b)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.S("clpp.simid.SimidPlayer");Fz(this.f,this)}load(a){window.addEventListener(_.Je,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(){Gz(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Je,
10
+ this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},yz=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 Kz=class extends _.Xv{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 Jz(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 Iz(this.h);var c=b.getContainer();this.j=Ez(this,c,b);this.j.observe(c);a.on(_.ng,this.w)}else this.g.warn(uz)}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&&(Bz(this.a),this.o=!0,this.g.info(wz)),
12
+ c&&(c=this.a,zz(c,xz(c,vz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(uz),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(_.ng,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Jz=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}Vf(){return this.a}url(){return this.f?this.f.url:""}};_.Mr(new class{create(){return new Kz}});};f.call(g, window);