@castlabs/prestoplay 6.2.6 → 6.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/cjs/cl.adobe.js +3 -3
  4. package/cjs/cl.airplay.js +3 -3
  5. package/cjs/cl.broadpeak.js +6 -6
  6. package/cjs/cl.cast.js +101 -101
  7. package/cjs/cl.conviva.js +32 -32
  8. package/cjs/cl.core.js +362 -362
  9. package/cjs/cl.crypto.js +9 -9
  10. package/cjs/cl.dash.js +68 -68
  11. package/cjs/cl.externs.js +63 -32
  12. package/cjs/cl.freewheel.js +19 -19
  13. package/cjs/cl.hls.js +43 -43
  14. package/cjs/cl.hlssmpte.js +6 -6
  15. package/cjs/cl.htmlcue.js +30 -30
  16. package/cjs/cl.ima.js +18 -18
  17. package/cjs/cl.mse.js +252 -249
  18. package/cjs/cl.muxdata.js +11 -11
  19. package/cjs/cl.onboard.js +3 -3
  20. package/cjs/cl.persistent.js +13 -13
  21. package/cjs/cl.playlist.js +5 -5
  22. package/cjs/cl.smooth.js +69 -69
  23. package/cjs/cl.thumbnails.js +22 -22
  24. package/cjs/cl.tizen.js +69 -69
  25. package/cjs/cl.ttml.js +26 -26
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +12 -12
  28. package/cjs/cl.vr.js +24 -0
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +16 -16
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +78 -78
  35. package/cl.conviva.js +25 -25
  36. package/cl.core.js +172 -171
  37. package/cl.crypto.js +8 -8
  38. package/cl.dash.js +61 -61
  39. package/cl.externs.js +59 -32
  40. package/cl.freewheel.js +18 -18
  41. package/cl.hls.js +36 -36
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +24 -24
  44. package/cl.ima.js +15 -15
  45. package/cl.mse.js +223 -220
  46. package/cl.muxdata.js +9 -9
  47. package/cl.onboard.js +3 -3
  48. package/cl.persistent.js +9 -9
  49. package/cl.playlist.js +4 -4
  50. package/cl.smooth.js +57 -57
  51. package/cl.thumbnails.js +15 -15
  52. package/cl.tizen.js +55 -55
  53. package/cl.ttml.js +21 -21
  54. package/cl.verimatrix.js +4 -4
  55. package/cl.vimond.js +7 -7
  56. package/cl.vr.js +14 -0
  57. package/cl.vtt.js +7 -7
  58. package/cl.youbora.js +8 -8
  59. package/package.json +1 -1
package/cl.freewheel.js CHANGED
@@ -1,19 +1,19 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var wG="clpp-freewheel",xG="clpp.freewheel.AdsManagerFactory",yG="freewheel",zG=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case 1:return tv.freewheel.SDK.ADUNIT_MIDROLL;case 2:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},AG=function(a){const b=[];typeof a.networkId!==_.p&&b.push("networkId");typeof a.serverUrl!==_.ee&&b.push("serverUrl");typeof a.profileId!==_.ee&&b.push("profileId");typeof a.videoAssetId!==_.ee&&typeof a.videoAssetId!==_.p&&b.push("videoAssetId");
2
- if(b.length)throw new _.H(1,9,12001,{missingKeys:b.join(", ")});},BG=function(){return _.v(function*(){var a=new _.Lo;let b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE;const c=yield a.canPlay(!1);a=yield a.canPlay(!0);c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:a&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return b})},CG=function(a){a.g.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.H.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.J.bind(a));a.g.on(a.a,
3
- tv.freewheel.SDK.EVENT_SLOT_ENDED,a.I.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.F.bind(a));a.g.on(a.l,_.me,a.D.bind(a));a.g.on(a.l,_.be,a.C.bind(a))},FG=function(a){return _.v(function*(){a.A.length?(DG(a),a.f=a.A.shift(),a.f.play()):(EG(a),yield a.l.a.play())})},EG=function(a){const b=a.l.Nb(yG).ic();b&&a.l.getSurface().hide(b);a.l.getSurface().showMediaElement()},DG=function(a){const b=a.l.Nb(yG).ic();b&&(a.l.getSurface().show(b),a.l.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(wG),
4
- a.l.isMuted()?a.setVolume(0):a.setVolume(a.l.getVolume()||1))},GG=function(a){a.w.length?(DG(a),a.f=a.w.shift(),a.f.play()):EG(a)},HG=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new W(a.a,c,d)});a.l.trigger(new _.F(b,d))},IG=class extends _.Uo{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Vk(_.Ec,{id:wG}),this.f=_.Vk(_.u,{"class":_.nc}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,
5
- !0),a.getSurface().hide(this.a);else a.onError(new _.H(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return yG}ic(){return this.a}We(){return this.f}};_.x("clpp.freewheel.FreeWheelPlugin",IG);IG.prototype.getAdVideo=IG.prototype.We;IG.prototype.getAdContainer=IG.prototype.ic;IG.Id=yG;IG.AD_CONTAINER_ID=wG;_.Cl(new class{create(){return new IG}});var W=class{constructor(a,b,c){this.g=a;this.f=b;this.a=c}gb(){return"FreeWheel AdManager SDK"}hb(){return tv.freewheel.SDK.version}mb(){return 0}aa(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.ee?a:""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():0}getSkipTimeOffset(){return 0}Rb(){return!1}xb(){return this.a&&
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var SG="clpp-freewheel",TG="clpp.freewheel.AdsManagerFactory",UG="freewheel",VG=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case 1:return tv.freewheel.SDK.ADUNIT_MIDROLL;case 2:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},WG=function(a){const b=[];typeof a.networkId!==_.p&&b.push("networkId");typeof a.serverUrl!==_.ee&&b.push("serverUrl");typeof a.profileId!==_.ee&&b.push("profileId");typeof a.videoAssetId!==_.ee&&typeof a.videoAssetId!==_.p&&b.push("videoAssetId");
2
+ if(b.length)throw new _.H(1,9,12001,{missingKeys:b.join(", ")});},XG=function(){return _.v(function*(){var a=new _.Lo;let b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE;const c=yield a.canPlay(!1);a=yield a.canPlay(!0);c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:a&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return b})},YG=function(a){a.g.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.H.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.J.bind(a));a.g.on(a.a,
3
+ tv.freewheel.SDK.EVENT_SLOT_ENDED,a.I.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.F.bind(a));a.g.on(a.l,_.me,a.D.bind(a));a.g.on(a.l,_.be,a.C.bind(a))},aH=function(a){return _.v(function*(){a.A.length?(ZG(a),a.f=a.A.shift(),a.f.play()):($G(a),yield a.l.a.play())})},$G=function(a){const b=a.l.Pb(UG).ic();b&&a.l.getSurface().hide(b);a.l.getSurface().showMediaElement()},ZG=function(a){const b=a.l.Pb(UG).ic();b&&(a.l.getSurface().show(b),a.l.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(SG),
4
+ a.l.isMuted()?a.setVolume(0):a.setVolume(a.l.getVolume()||1))},bH=function(a){a.w.length?(ZG(a),a.f=a.w.shift(),a.f.play()):$G(a)},cH=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new W(a.a,c,d)});a.l.trigger(new _.F(b,d))},dH=class extends _.So{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Vk(_.Ec,{id:SG}),this.f=_.Vk(_.u,{"class":_.nc}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,
5
+ !0),a.getSurface().hide(this.a);else a.onError(new _.H(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return UG}ic(){return this.a}$e(){return this.f}};_.x("clpp.freewheel.FreeWheelPlugin",dH);dH.prototype.getAdVideo=dH.prototype.$e;dH.prototype.getAdContainer=dH.prototype.ic;dH.Id=UG;dH.AD_CONTAINER_ID=SG;_.Cl(new class{create(){return new dH}});var W=class{constructor(a,b,c){this.g=a;this.f=b;this.a=c}gb(){return"FreeWheel AdManager SDK"}hb(){return tv.freewheel.SDK.version}mb(){return 0}ba(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.ee?a:""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():0}getSkipTimeOffset(){return 0}Tb(){return!1}zb(){return this.a&&
6
6
  this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""}getMediaUrl(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""}jb(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}ib(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}Wa(){return 0}Ja(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;
7
- default:return 1}}getPodIndex(){switch(this.Ja()){case 0:return 0;case 2:return-1}return this.g.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}yb(){switch(this.Ja()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}}zb(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}lb(){return this.f.getAdCount()}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};
8
- W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;W.prototype.getSequenceLength=W.prototype.lb;W.prototype.getPositionInSequence=W.prototype.zb;W.prototype.getPodTimeOffset=W.prototype.yb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Ja;W.prototype.getMediaBitrate=W.prototype.Wa;W.prototype.getMediaHeight=W.prototype.ib;
9
- W.prototype.getMediaWidth=W.prototype.jb;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.xb;W.prototype.isBumper=W.prototype.Rb;W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getDuration=W.prototype.getDuration;W.prototype.getTitle=W.prototype.getTitle;W.prototype.getAdvertiserName=W.prototype.getAdvertiserName;W.prototype.getAdSystem=W.prototype.getAdSystem;W.prototype.getApiFramework=W.prototype.getApiFramework;
10
- W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.aa;W.prototype.getTechnology=W.prototype.mb;W.prototype.getAdManagerVersion=W.prototype.hb;W.prototype.getAdManagerName=W.prototype.gb;var JG=class{constructor(a){this.a=a}getCuePoints(){return this.a.getTemporalSlots().map(a=>{switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})}Ab(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}Xa(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
11
- JG.prototype.hasPostroll=JG.prototype.Xa;JG.prototype.hasPreroll=JG.prototype.Ab;JG.prototype.getCuePoints=JG.prototype.getCuePoints;var KG=class{constructor(a){this.B=new _.O("clpp.freewheel.AdsManager");this.l=a;this.g=new _.cn;this.o=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.A=[];this.m=[];this.w=[];this.j=new _.Hj;this.h=null}load(){const a=this;return _.v(function*(){const b=a.l.getConfiguration().freewheel||{};try{AG(b)}catch(d){return a.l.onError(d),a.j.resolve(),a.j}a.o.setNetwork(b.networkId);a.o.setServer(b.serverUrl);a.a=a.o.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.ee&&typeof b.siteSectionId!==
12
- _.p||a.a.setSiteSection(b.siteSectionId);const c=yield BG();a.a.setVideoAsset(b.videoAssetId,a.l.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(const d of b.pods)a.a.addTemporalSlot(d.id,zG(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.rd&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);
13
- if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);CG(a);a.a.submitRequest();return a.j})}start(){const a=this;return _.v(function*(){yield FG(a)})}resume(){this.f&&this.f.resume()}pause(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getVolume(){return this.a?this.a.getAdVolume():1}setVolume(a){this.a&&this.a.setAdVolume(a)}getPosition(){return this.f?this.f.getPlayheadTime():-1}dispose(){const a=this;return _.v(function*(){a.g.release();
14
- a.h&&(a.h.stop(),a.h=null);EG(a);a.a&&(a.a.dispose(),a.a=null)})}H(a){if(a.success)this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.m=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.w=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.l.trigger(new _.F(_.Db,{adsTimeline:new JG(this.a)})),this.h=new _.Jo(this.l.getSurface(),(b,c)=>this.a.resize(b,c),this.l.Nb(yG).f);else this.l.onError(new _.H(1,
15
- 9,10003,{errorType:0},void 0));this.j.resolve()}J(a){HG(this,_.mb,a);this.h.start()}I(a){this.f=null;a=a.slot;HG(this,_.nb);this.h.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:FG(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:EG(this);this.l.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:GG(this)}}F(a){const b=a.subType;this.B.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:HG(this,_.zb,a);HG(this,
16
- _.sb,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:HG(this,_.Ab,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:HG(this,_.rb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:HG(this,_.ub,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:HG(this,_.Bb,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:HG(this,_.qb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:HG(this,_.pb,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:HG(this,_.vb,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:HG(this,
17
- _.xb,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:HG(this,_.yb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:HG(this,_.ob,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:HG(this,_.wb,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.l.onError(new _.H(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}D(){if(!this.f){var a=this.l.getPosition();if(this.f=this.m.find(b=>
18
- .5>Math.abs(a-b.getTimePosition()))||null){const b=this.m.findIndex(c=>c===this.f);this.m.splice(b,1);this.l.pause();DG(this);this.f.play()}}}C(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Ck:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Bk:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.rk:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);GG(this);break;case _.zk:case _.yk:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};
19
- KG.prototype.getPosition=KG.prototype.getPosition;KG.prototype.setVolume=KG.prototype.setVolume;KG.prototype.getVolume=KG.prototype.getVolume;KG.prototype.skip=KG.prototype.skip;KG.prototype.pause=KG.prototype.pause;KG.prototype.resume=KG.prototype.resume;KG.prototype.start=KG.prototype.start;var LG=class{constructor(){this.a=new _.O(xG)}name(){return xG}X(a,b){return a.namespace()===_.pc?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.a.warn("FreeWheel SDK is not loaded."),!1)}create(a){return new KG(a)}};LG.prototype.create=LG.prototype.create;LG.prototype.isSupported=LG.prototype.X;LG.prototype.name=LG.prototype.name;_.Sk(new LG);};f.call(g, window);
7
+ default:return 1}}getPodIndex(){switch(this.Ja()){case 0:return 0;case 2:return-1}return this.g.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}Ab(){switch(this.Ja()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}}Bb(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}lb(){return this.f.getAdCount()}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};
8
+ W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;W.prototype.getSequenceLength=W.prototype.lb;W.prototype.getPositionInSequence=W.prototype.Bb;W.prototype.getPodTimeOffset=W.prototype.Ab;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Ja;W.prototype.getMediaBitrate=W.prototype.Wa;W.prototype.getMediaHeight=W.prototype.ib;
9
+ W.prototype.getMediaWidth=W.prototype.jb;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.zb;W.prototype.isBumper=W.prototype.Tb;W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getDuration=W.prototype.getDuration;W.prototype.getTitle=W.prototype.getTitle;W.prototype.getAdvertiserName=W.prototype.getAdvertiserName;W.prototype.getAdSystem=W.prototype.getAdSystem;W.prototype.getApiFramework=W.prototype.getApiFramework;
10
+ W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.ba;W.prototype.getTechnology=W.prototype.mb;W.prototype.getAdManagerVersion=W.prototype.hb;W.prototype.getAdManagerName=W.prototype.gb;var eH=class{constructor(a){this.a=a}getCuePoints(){return this.a.getTemporalSlots().map(a=>{switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})}Cb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}Xa(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
11
+ eH.prototype.hasPostroll=eH.prototype.Xa;eH.prototype.hasPreroll=eH.prototype.Cb;eH.prototype.getCuePoints=eH.prototype.getCuePoints;var fH=class{constructor(a){this.B=new _.O("clpp.freewheel.AdsManager");this.l=a;this.g=new _.cn;this.o=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.A=[];this.m=[];this.w=[];this.j=new _.Hj;this.h=null}load(){const a=this;return _.v(function*(){const b=a.l.getConfiguration().freewheel||{};try{WG(b)}catch(d){return a.l.onError(d),a.j.resolve(),a.j}a.o.setNetwork(b.networkId);a.o.setServer(b.serverUrl);a.a=a.o.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.ee&&typeof b.siteSectionId!==
12
+ _.p||a.a.setSiteSection(b.siteSectionId);const c=yield XG();a.a.setVideoAsset(b.videoAssetId,a.l.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(const d of b.pods)a.a.addTemporalSlot(d.id,VG(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.rd&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);
13
+ if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);YG(a);a.a.submitRequest();return a.j})}start(){const a=this;return _.v(function*(){yield aH(a)})}resume(){this.f&&this.f.resume()}pause(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getVolume(){return this.a?this.a.getAdVolume():1}setVolume(a){this.a&&this.a.setAdVolume(a)}getPosition(){return this.f?this.f.getPlayheadTime():-1}dispose(){const a=this;return _.v(function*(){a.g.release();
14
+ a.h&&(a.h.stop(),a.h=null);$G(a);a.a&&(a.a.dispose(),a.a=null)})}H(a){if(a.success)this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.m=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.w=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.l.trigger(new _.F(_.Db,{adsTimeline:new eH(this.a)})),this.h=new _.Jo(this.l.getSurface(),(b,c)=>this.a.resize(b,c),this.l.Pb(UG).f);else this.l.onError(new _.H(1,
15
+ 9,10003,{errorType:0},void 0));this.j.resolve()}J(a){cH(this,_.mb,a);this.h.start()}I(a){this.f=null;a=a.slot;cH(this,_.nb);this.h.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:aH(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:$G(this);this.l.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:bH(this)}}F(a){const b=a.subType;this.B.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:cH(this,_.zb,a);cH(this,
16
+ _.sb,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:cH(this,_.Ab,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:cH(this,_.rb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:cH(this,_.ub,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:cH(this,_.Bb,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:cH(this,_.qb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:cH(this,_.pb,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:cH(this,_.vb,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:cH(this,
17
+ _.xb,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:cH(this,_.yb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:cH(this,_.ob,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:cH(this,_.wb,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.l.onError(new _.H(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}D(){if(!this.f){var a=this.l.getPosition();if(this.f=this.m.find(b=>
18
+ .5>Math.abs(a-b.getTimePosition()))||null){const b=this.m.findIndex(c=>c===this.f);this.m.splice(b,1);this.l.pause();ZG(this);this.f.play()}}}C(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Ck:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Bk:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.rk:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);bH(this);break;case _.zk:case _.yk:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};
19
+ fH.prototype.getPosition=fH.prototype.getPosition;fH.prototype.setVolume=fH.prototype.setVolume;fH.prototype.getVolume=fH.prototype.getVolume;fH.prototype.skip=fH.prototype.skip;fH.prototype.pause=fH.prototype.pause;fH.prototype.resume=fH.prototype.resume;fH.prototype.start=fH.prototype.start;var gH=class{constructor(){this.a=new _.O(TG)}name(){return TG}Y(a,b){return a.namespace()===_.pc?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.a.warn("FreeWheel SDK is not loaded."),!1)}create(a){return new fH(a)}};gH.prototype.create=gH.prototype.create;gH.prototype.isSupported=gH.prototype.Y;gH.prototype.name=gH.prototype.name;_.Sk(new gH);};f.call(g, window);
package/cl.hls.js CHANGED
@@ -1,36 +1,36 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Vx="BANDWIDTH",Wx="CLOSED-CAPTIONS",Xx="EXT-X-BYTERANGE",Yx="EXT-X-DISCONTINUITY",Zx="EXT-X-DISCONTINUITY-SEQUENCE",$x="EXT-X-ENDLIST",ay="EXT-X-MEDIA-SEQUENCE",by="EXT-X-PLAYLIST-TYPE",cy="EXT-X-STREAM-INF",dy="EXT-X-TARGETDURATION",ey="GROUP-ID",fy="Guessing audio-only",gy="SAMPLE-AES-CTR",hy="SUBTITLES",iy="URI",jy="application/vnd.apple.mpegurl",ky=function(a,b=0){return b+10<=a.length&&73===a[b]&&68===a[b+1]&&51===a[b+2]&&255>a[b+3]&&255>a[b+4]&&128>a[b+6]&&128>a[b+7]&&128>a[b+
2
- 8]&&128>a[b+9]?!0:!1},ly=function(a,b,c){return(a=a.getAttribute(b))?a.value:c||null},my=function(a,b){a=a.getAttribute(b);if(!a)throw new _.H(_.G,4,4023,b);return a.value},ny=function(a,b){return a.filter(c=>c.name==b)},oy=function(a,b){return a.filter(c=>my(c,"TYPE")===b)},py=function(a,b){a=ny(a,b);return a.length?a[0]:null},qy=function(a,b){return _.Ls([a],[b])[0]},ty=function(a,b){var c;a=a.a++;var d=b.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!d)throw new _.H(_.G,4,4016,{invalidTag:b});b=d[1];var e=
3
- d[2];d=[];if(e){e=new _.Ho(e);var f;(f=_.nm(e,/^([^,=]+)(?:,|$)/g))&&(c=f[1]);const g=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;for(;f=_.nm(e,g);)d.push(new ry(f[1],f[2]||f[3]))}return c=new sy(a,b,d,c)},wy=function(a,b,c,d){const e=[];let f=[];c.forEach(g=>{/^(#EXT)/.test(g)?(g=ty(a,g),uy.includes(g.name)?d.push(g):f.push(g)):/^#(?!EXT)/m.test(g)||(g=qy(b,g.trim()),e.push(new vy(g,f)),f=[])});return e},zy=function(a,b,c){b=_.gg(b);b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim();const d=b.split(/\n+/m);
4
- if(!/^#EXTM3U($|[ \t\n])/m.test(d[0]))throw new _.H(_.G,4,4015);b=0;let e=!0;for(var f of d)if(f=f.trim(),!f.length||/^#(?!EXT)/m.test(f)||e)e=!1;else{var g=ty(a,f);--a.a;if(uy.includes(g.name)){b=1;break}else g.name==cy&&(e=!0)}f=[];e=!0;for(var h of _.ys(d)){let {kd:k,item:l,next:m}=h;l=l.trim();if(!l.length||/^#(?!EXT)/m.test(l)||e)e=!1;else{g=ty(a,l);if(xy.includes(g.name)){if(1!=b)throw new _.H(_.G,4,4017);h=d.splice(k,d.length-k);a=wy(a,c,h,f);return new yy(c,b,f,a)}f.push(g);g.name==cy&&(g.a.push(new ry(iy,
5
- m)),e=!0)}}return new yy(c,b,f)},Ay=function(a){_.v(function*(){a.a.debug(_.gs);if(a.j)try{yield a.update(),a.A.$(a.U)}catch(b){a.j&&(a.j.onError(b),1===b.severity&&a.A.$(.1))}})},Cy=function(a,b){b=_.wg([b],a.h.attemptParameters);b.type=1;return By(a,b)},Iy=function(a,b){return _.v(function*(){var c=zy(a.K,b,a.B);if(1===c.type){a.D.set(a.B,c);c=(new _.dh(c.a[0].a)).ra.split(".").pop();var d=Dy.audio[c],e="";Dy.video[c]?e="avc1.42E01E":d&&(e="mp4a.40.2");{c=a.K;d=a.B;e=a.h.hlsDefaultCodecs||e;var f=
6
- [];const h=[];h.push(new ry(Vx,"0"));h.push(new ry(iy,d));e.length&&h.push(new ry(_.ja,e));f.push(new sy(c.a++,cy,h));c=new yy(d,0,f)}}c=yield Ey(a,c.Ga);if(!a.j)throw new _.H(_.G,7,7001);a.j.filterAllPeriods([c]);e=Infinity;d=0;f=Infinity;for(var g of a.f.values())e=Math.min(e,g.td),d=Math.max(d,g.td),g.stream.type!=_.r&&(f=Math.min(f,g.duration));a.m!=Fy?(a.g=new _.Jx(0,3*a.P,!0),a.g.f=!1):(a.g=new _.Jx(null,0,!0),a.g.f=!0);Gy(a);if(a.m!=Fy){a.U=a.R;a.m===Hy&&(g=Math.max(f,a.g.Cd),isNaN(a.h.availabilityWindowOverride)||
7
- (g=a.h.availabilityWindowOverride),a.g.Vb=g);for(g=0;95443.7176888889<=d;)g+=95443.7176888889,d-=95443.7176888889;if(g){a.a.debug("Offsetting live streams by",g,"to compensate for rollover");for(const h of a.f.values())95443.7176888889>h.td?(a.a.debug("Offset applied to",h.stream.type),h.ab.offset(g)):a.a.debug("Offset NOT applied to",h.stream.type)}}else{a.g.Fb(f);a.g.offset(-e);for(const h of a.f.values())h.ab.offset(-e),_.vt(h.ab,f)}a.H={presentationTimeline:a.g,periods:[c],offlineSessionIds:[],
8
- minBufferTime:0}})},Ly=function(a,b){return _.v(function*(){var c=yield Cy(a,b.He);c=zy(a.K,c.data,c.uri);if(1!=c.type)throw new _.H(_.G,4,4017);var d=b.stream;d=yield Jy(a,b.Rc,c,d.type,d.mimeType,d.codecs,d.keyInfo||null,b.Ne);b.ab.replace(d);d=d[d.length-1];py(c.Ga,$x)&&(Ky(a,Fy),a.g.Fb(d.endTime))})},Jy=function(a,b,c,d,e,f,g,h){return _.v(function*(){var k=c.a;const l=My(c,g);var m=(m=py(c.Ga,ay))?Number(m.value):0;null===a.L&&(a.L=yield Ny(a,b,l,k[0],m,g,e,f,d));const n=a.L;a.a.debug("First segment",
9
- k[0].a.split("/").pop(),"starts at",n);var q=py(c.Ga,Zx);let t=q?Number(q.value):0;h.has(t)||h.set(t,m);if(!q)for(;h.has(t+1)&&h.get(t+1)<m;)t++;q=a.I.get(t)||0;const w=[];for(const D of _.ys(k)){var A=D.kd;k=D.item;{const E=w[w.length-1],B=0==A?n:E.endTime;A=m+A;py(k.Ga,Yx)&&(t++,h.set(t,A),q=yield Oy(a,t,b,l,k,A,g,e,f,B,d));k=Py(E,k,A,B,q,g,d);w.push(k)}}a.S.push(w);Gy(a);return w})},Ky=function(a,b){a.m=b;a.g&&(a.g.f=a.m==Fy);a.m!=Fy||a.A.stop()},Ey=function(a,b){return _.v(function*(){var c=ny(b,
10
- "EXT-X-MEDIA"),d=ny(b,cy),e=ny(b,"EXT-X-IMAGE-STREAM-INF");for(var f of d){var g=ly(f,"AUDIO"),h=ly(f,"VIDEO"),k=ly(f,hy);const l=Qy(a,f);if(k){const m=Ry(_.r,l);a.o.set(k,m);k=l.indexOf(m);-1<k&&l.splice(k,1)}g&&(k=Sy(_.Rb,l),a.o.set(g,k));h&&(g=Sy(_.u,l),a.o.set(h,g))}yield Ty(a,c);f=oy(c,Wx);for(const l of f)f=Uy(l),h=my(l,ey),g=my(l,"INSTREAM-ID"),a.J.get(h)||a.J.set(h,new Map),a.J.get(h).set(g,f);d=yield Vy(a,d);c=yield Wy(a,c);e=yield Xy(a,e);return{startTime:0,variants:d,textStreams:c,thumbStreams:e}})},
11
- Ty=function(a,b){return _.v(function*(){b=b.filter(d=>{const e=ly(d,iy)||"";return ly(d,"TYPE")!==hy&&""!==e});b.length&&(yield Yy(a,b[0]));const c=b.slice(1).map(d=>Yy(a,d));yield Promise.all(c)})},Vy=function(a,b){return _.v(function*(){var c=f=>_.v(function*(){const g=ly(f,"FRAME-RATE"),h=Number(my(f,Vx));var k=ly(f,"RESOLUTION");const [l,m]=k?k.split("x"):[null,null];return(k=yield Zy(a,f,k,g))?$y(a,k.audio,k.video,h,l,m,g):[]});let d=0;var e=Infinity;for(let f=0;f<b.length;++f){const g=Number(my(b[f],
12
- Vx));g<e&&(e=g,d=f)}e=b.splice(d,1).pop();e=yield c(e);c=b.map(c);c=yield Promise.all(c);c.splice(d,0,e);return c.reduce(_.Js,[]).filter(_.ek)})},Wy=function(a,b){return _.v(function*(){var c=oy(b,hy),d=c.map(f=>_.v(function*(){try{return(yield Yy(a,f)).stream}catch(g){throw g;}}));d=yield Promise.all(d);for(const f of c){var e=my(f,ey);if(c=a.o.get(e))if(e=a.w.get(e))for(const g of e)g.stream.codecs=c}return d.filter(f=>f)})},Xy=function(a,b){return _.v(function*(){const c=b.map(d=>_.v(function*(){return(yield az(a,
13
- d)).stream}));return(yield Promise.all(c)).filter(d=>d)})},Qy=function(a,b){var c=ly(b,_.ja,a.h.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);b=new Set;const d=[];for(const e of c)c=_.Es(e)[0],b.has(c)?a.a.debug("Ignoring duplicate codec"):(d.push(e),b.add(c));return d},Ry=function(a,b){const c=bz[a];for(let d=0;d<c.length;d++)for(let e=0;e<b.length;e++)if(c[d].test(b[e].trim()))return b[e].trim();return a==_.r?"":null},Sy=function(a,b){if(1==b.length)return b[0];a=Ry(a,b);if(null!=
14
- a)return a;throw new _.H(_.G,4,4025,{codecList:b});},Yy=function(a,b){return _.v(function*(){const c=my(b,ey);var d="";let e=my(b,"TYPE").toLowerCase();e==_.rs&&(e=_.r);e!==_.r&&c&&a.o.has(c)&&(d=a.o.get(c));const f=my(b,iy);if(a.f.has(f))return a.f.get(f);const g=Uy(b),h=ly(b,"NAME"),k=b.getAttribute("DEFAULT"),l=b.getAttribute("AUTOSELECT"),m=ly(b,"CHANNELS");d=yield cz(a,f,d,e,g,!!k&&!!l,h,e==_.Rb?m?parseInt(m.split("/")[0],10):null:null,null);if(null==d)return null;a.w.has(c)?a.w.get(c).push(d):
15
- a.w.set(c,[d]);if(a.f.has(f))return a.f.get(f);a.f.set(f,d);return d})},az=function(a,b){return _.v(function*(){const c=my(b,iy);if(a.f.has(c))return a.f.get(c);var d=ly(b,_.ja)||"jpg",e=Uy(b);const f=ly(b,"NAME");d=yield cz(a,c,d,_.Tc,e,!1,f,null,null);if(null===d)return null;if(a.f.has(c))return a.f.get(c);if(e=ly(b,Vx))d.stream.bandwidth=Number(e);a.f.set(c,d);return d})},Zy=function(a,b,c,d){return _.v(function*(){let e=Qy(a,b);var f=ly(b,"AUDIO"),g=ly(b,"VIDEO"),h=f||g;h=h&&a.w.has(h)?a.w.get(h):
16
- [];f={audio:f?h:[],video:g?h:[]};a.a.debug("Guessing stream type for",b.toString());g=!1;const k=my(b,iy),l=f.audio.find(q=>q.Rc===k);var m=Ry(_.u,e);m=c||d||m;1!==e.length||m?!h.length&&1<e.length?(a.a.debug("Guessing multiplexed audio+video"),h=_.u,e=[e.join(",")]):f.audio.length&&l?(a.a.debug(fy),h=_.Rb,g=!0):f.video.length?(a.a.debug(fy),h=_.Rb):(a.a.debug("Guessing video-only"),h=_.u):(h=_.Rb,a.a.debug(fy));let n;g||(n=yield dz(a,b,e,h));if(n)f[n.stream.type]=[n];else if(null===n)return a.a.debug("streamInfo is null"),
17
- null;ez(f);return f})},$y=function(a,b,c,d,e,f,g){c.forEach(l=>{if(l=l.stream)l.width=Number(e)||void 0,l.height=Number(f)||void 0,l.frameRate=Number(g)||void 0});b.length||(b=[null]);c.length||(c=[null]);const h=[];for(const l of b)for(const m of c){var k=l?l.stream:null;const n=m?m.stream:null,q=l?l.drmInfos:null,t=m?m.drmInfos:null;b=(m?m.Rc:"")+" - "+(l?l.Rc:"");let w;if(k&&n)if(q.length&&t.length?0<_.Is(q,t).length:1)w=_.Is(q,t);else{a.a.warn("Incompatible DRM info in HLS variant. Skipping.");
18
- continue}else k?w=q:n&&(w=t);a.V.has(b)?a.a.debug("Skipping variant which only differs in text streams."):(k=fz(a,k,n,d,w),h.push(k),a.V.add(b))}return h},dz=function(a,b,c,d){return _.v(function*(){const e=my(b,iy);if(a.f.has(e))return a.f.get(e);var f=ly(b,Wx),g=null;d==_.u&&f&&"NONE"!=f&&(g=a.J.get(f));f=Sy(d,c);g=yield cz(a,e,f,d,_.pe,!1,null,null,g);if(null==g)return null;if(a.f.has(e))return a.f.get(e);a.f.set(e,g);return g})},ez=function(a){for(const b of a.audio.concat(a.video))a=b.stream.codecs.split(","),
19
- a=a.filter(c=>"mp4a.40.34"!=c),b.stream.codecs=a.join(",")},fz=function(a,b,c,d,e){return{id:a.Z++,language:b?b.language:_.pe,primary:!!b&&b.primary||!!c&&c.primary,audio:b,video:c,bandwidth:d,drmInfos:e,allowedByApplication:!0,allowedByKeySystem:!0}},Uy=function(a){a=ly(a,"LANGUAGE")||_.pe;return _.Gg(a)},cz=function(a,b,c,d,e,f,g,h,k){return _.v(function*(){let l=qy(a.B,b);var m=null;if(a.m==Fy&&a.D.has(l)){var n=a.D.get(l);a.D.delete(l)}else{var q=yield Cy(a,l);l=q.uri;n=zy(a.K,q.data,l)}if(1!=
20
- n.type)throw new _.H(_.G,4,4017);gz(a,n);q=yield hz(a,d,c,n);const t=[];n.a.forEach(zd=>{zd=ny(zd.Ga,"EXT-X-KEY");t.push.apply(t,zd)});let w=!1;const A=[];let D=null;for(var E of t){var B=my(E,"METHOD"),na=ly(E,"KEYFORMAT","identity");"NONE"!=B&&("AES-128"==B?(m=ly(E,"IV",""),m={method:"AES-128",url:qy(a.B,my(E,iy)),iv:m?_.ji((m||"0x").slice(2)):null},a.F=!0):(w=!0,(B=(B=iz[na])?B(E,q):null)?(B.keyIds.length&&(D=B.keyIds[0]),A.push(B)):a.a.warn("Unsupported HLS KEYFORMAT",na)))}if(w&&!A.length&&!a.F)throw new _.H(_.G,
21
- 4,4026);E=new Map;var Za=yield Jy(a,b,n,d,q,c,m,E);na=Za[0].startTime;B=Za[Za.length-1].endTime;const of=B-na;Za=new _.Kx(Za);n=My(n,m);let ue=void 0;d==_.r&&(ue=_.qs);return{stream:{id:a.Z++,originalId:g,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:Za.h.bind(Za),getSegmentReference:Za.get.bind(Za),adjustSegmentDurations:Za.f.bind(Za),getDuration:Za.getDuration.bind(Za),initSegmentReference:n,mimeType:q,codecs:c,kind:ue,encrypted:w,keyId:D,language:e,label:g,type:d,primary:f,
22
- trickModeVideo:null,emsgSchemeIdUris:null,frameRate:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:h,closedCaptions:k,keyInfo:m},ab:Za,drmInfos:A,Rc:b,He:l,td:na,Sf:B,duration:of,Ne:E}})},gz=function(a,b){var c=py(b.Ga,by),d=py(b.Ga,$x);d=c&&"VOD"==c.value||d;c=c&&"EVENT"==c.value&&!d;c=!d&&!c;d?Ky(a,Fy):(c?Ky(a,Hy):Ky(a,jz),b=kz(b.Ga,dy),b=Number(b.value),a.P=Math.max(b,a.P),a.R=Math.min(b,a.R))},hz=function(a,b,c,d){return _.v(function*(){var e=d.a[0].a;const f=(new _.dh(e)).ra.split(".").pop(),
23
- g=Dy[b][f];if(g)return g;if(b==_.r)return c&&"vtt"!=c?_.Kb:_.ke;e=_.wg([e],a.h.attemptParameters);e.method="HEAD";e.type=2;e=(yield By(a,e)).headers["content-type"];if(!e)throw new _.H(_.G,4,4021,f);return e.split(";")[0]})},My=function(a,b){var c=ny(a.Ga,"EXT-X-MAP");if(!c.length)return null;if(1<c.length)throw new _.H(_.G,4,4020);c=c[0];var d=my(c,iy);const e=qy(a.f,d);a=0;d=null;if(c=ly(c,"BYTERANGE"))a=c.split("@"),c=Number(a[0]),a=Number(a[1]),d=a+c-1;return new _.Ix(()=>[e],a,d,b)},kz=function(a,
24
- b){a=py(a,b);if(!a)throw new _.H(_.G,4,4024,{missingTag:b});return a},Gy=function(a){a.g&&(a.S.forEach(b=>{_.lt(a.g,b,0)}),a.S=[])},Py=function(a,b,c,d,e,f,g){var h=b.Ga;const k=b.a;b=kz(h,"EXTINF").value.split(",");b=d+Number(b[0]);var l=0,m=null,n=py(h,Xx);n&&(l=n.value.split("@"),m=Number(l[0]),l=l[1]?Number(l[1]):a.wa+1,m=l+m-1);(a=f?Object.assign({},f):null)&&!a.iv&&(a.iv=_.mi(new Uint8Array(12),new Uint8Array([c>>24&255,c>>16&255,c>>8&255,c&255])));let q=n=null;f=null;g===_.Tc&&(h=py(h,"EXT-X-TILES"),
25
- g="1x1",h&&(g=ly(h,"LAYOUT")||"1x1",f=(h=ly(h,"DURATION"))?Number(h):null),[n,q]=g.split("x").map(t=>parseInt(t,10)));return new _.st(c,d,b,()=>[k],l,m,e,a,!1,null,n,q,f)},Ny=function(a,b,c,d,e,f,g,h,k,l){return _.v(function*(){var m=Py(null,d,e,0,0,f,k);if(a.H&&!l){var n=a.f.get(b).ab.get(m.position);if(n)return a.a.debug("Found segment start time in previous manifest"),n.startTime;a.a.debug("Unable to find segment start time in previous manifest!")}a.a.debug("Fetching segment to find start time");
26
- if("audio/mpeg"==g)return 0;if(g==_.Sb)return m=yield lz(a,m),n=_.L(m.data),ky(n)?mz(n):nz(m.data);if(g==_.Be||g==_.Vb)return m=[lz(a,m)],c&&m.push(lz(a,c)),m=yield Promise.all(m),oz(a,m[0].data,(m[1]||m[0]).data);if(g==_.Ae)return m=yield lz(a,m),nz(m.data);if(g===_.Ub||g===_.Tb||!MediaSource.isTypeSupported(`${g.split("/")[0]||""}/mp4;codecs="${h}"`))return 0;throw new _.H(_.G,4,4030);})},Oy=function(a,b,c,d,e,f,g,h,k,l,m){return _.v(function*(){let n;a.I.has(b)?n=a.I.get(b):(n=(yield Ny(a,c,d,
27
- e,f,g,h,k,m,!0))-l,a.a.debug("Discontinuity segment offset",n),a.I.set(b,n));return n})},By=function(a,b){if(!a.C)throw new _.H(_.G,7,7001);b=a.j.networkingEngine.fetch(b);_.ch(a.C,b);return b.N},lz=function(a,b){return _.v(function*(){const c=b.a(),d=_.jt(b.Ka(),b.Fa,b.Fa+2048-1,a.h.attemptParameters);d.type=2;const e=_.jt(b.Ka(),b.Fa,b.wa,a.h.attemptParameters);e.type=2;c&&(e.keyInfo=c);try{return yield By(a,a.F?e:d)}catch(f){if(7001==f.code||a.F)throw f;a.a.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS preflights.",
28
- d.uris[0]);return yield By(a,e)}})},mz=function(a){function b(h,k,l){let m="";for(;k<l;k++)m+="%"+("00"+h[k].toString(16)).slice(-2);return m}function c(h){return h[0]<<21|h[1]<<14|h[2]<<7|h[3]}function d(){throw new _.H(_.G,4,4030);}ky(a)||d();let e=10;a[5]&64&&(e=e+4+c(a.subarray(10,14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(let h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===
29
- unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}ky(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},nz=function(a){function b(){d.seek(e+188);f=_.ts(d);71!=f&&(d.seek(e+192),f=_.ts(d));71!=f&&(d.seek(e+204),f=_.ts(d));71!=f&&c();_.us(d)}function c(){throw new _.H(_.G,4,4030);}const d=new _.On(new DataView(a),!1);let e=0,f=0;for(;;){e=d.getPosition();f=_.ts(d);71!=f&&c();a=_.Bi(d);if(8191===(a&8191)){b();continue}if(!(a&
30
- 16384)){b();continue}a=(_.ts(d)&48)>>4;0!=a&&2!=a||c();3==a&&(a=_.ts(d),d.skip(a));if(1!=_.N(d)>>8){b();continue}d.skip(3);a=_.ts(d)>>6;0!=a&&1!=a||c();0==_.ts(d)&&c();a=_.ts(d);const g=_.Bi(d),h=_.Bi(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}},oz=function(a,b,c){let d=0;(new _.Yn).M(_.ld,_.mj).M(_.ne,_.mj).M(_.gd,_.mj).W("mdhd",g=>{g.G.skip(0==g.version?8:16);d=_.N(g.G);g.Za.stop()}).parse(c,!0);if(!d)throw a.a.error("Unable to find timescale in init segment!"),new _.H(_.G,
31
- 4,4030);let e=0,f=!1;(new _.Yn).M("moof",_.mj).M("traf",_.mj).W("tfdt",g=>{e=(0==g.version?_.N(g.G):_.Di(g.G))/d;f=!0;g.Za.stop()}).parse(b,!0);if(!f)throw new _.H(_.G,4,4030);return e},yy=class{constructor(a,b,c,d){this.f=a;this.type=b;this.Ga=c;this.a=d||null}},sy=class{constructor(a,b,c,d=null){this.id=a;this.name=b;this.a=c;this.value=d}toString(){function a(d){return d.name+"\x3d"+(isNaN(Number(d.value))?'"'+d.value+'"':d.value)}let b="#"+this.name;const c=this.a?this.a.map(a):[];this.value&&
32
- c.unshift(this.value);0<c.length&&(b+=":"+c.join(","));return b}getAttribute(a){const b=this.a.filter(c=>c.name==a);return b.length?b[0]:null}},ry=class{constructor(a,b){this.name=a;this.value=b}},vy=class{constructor(a,b){this.Ga=b;this.a=a}};var pz=class{constructor(){this.a=0}},uy=[dy,ay,Zx,by,"EXT-X-MAP","EXT-X-I-FRAMES-ONLY",$x],xy=["EXTINF",Xx,Yx,"EXT-X-PROGRAM-DATE-TIME","EXT-X-KEY","EXT-X-DATERANGE"];var qz=class{constructor(){this.h=this.j=null;this.Z=1;this.w=new Map;this.V=new Set;this.f=new Map;this.g=null;this.B="";this.K=new pz;this.U=0;this.A=new _.rh(()=>{Ay(this)});this.m=Fy;this.H=null;this.P=0;this.R=Infinity;this.C=new _.An;this.S=[];this.J=new Map;this.F=!1;this.o=new Map;this.L=null;this.a=new _.O("clpp.hls.HlsParser");this.D=new Map;this.I=new Map}configure(a){this.h=a}start(a,b){const c=this;return _.v(function*(){c.j=b;var d=yield Cy(c,a);c.B=d.uri;yield Iy(c,d.data);d=c.U;0<
33
- d&&c.A.$(d);return c.H})}stop(){this.A&&(this.A.stop(),this.A=null);const a=[];this.C&&(a.push(this.C.destroy()),this.C=null);this.h=this.j=null;this.V.clear();this.f.clear();this.D.clear();this.H=null;this.w.clear();this.o.clear();return Promise.all(a)}update(){const a=this;return _.v(function*(){if(a.m!=Fy){var b=[];a.L=null;var c=Array.from(a.f.values());c.length&&(yield Ly(a,c[0]));for(let d=1;d<c.length;++d)b.push(Ly(a,c[d]));yield Promise.all(b)}})}onExpirationUpdated(){}},bz={audio:[/^vorbis$/,
34
- /^opus$/,/^flac$/,/^mp4a/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]},Dy={audio:{mp4:_.Vb,m4s:_.Vb,m4i:_.Vb,m4a:_.Vb,cmfa:_.Vb,ts:_.Ae,aac:_.Sb,ec3:_.Ub,ac3:_.Tb},video:{mp4:_.Be,m4s:_.Be,m4i:_.Be,m4v:_.Be,cmfv:_.Be,ts:_.Ae},text:{mp4:_.Kb,m4s:_.Kb,m4i:_.Kb,cmft:_.Kb,vtt:_.ke,ttml:_.Nb},image:{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",svg:"image/svg+xml",webp:"image/webp",avif:"image/avif"}},iz={"com.apple.streamingkeydelivery":function(a,
35
- b){if(b===_.Ae)throw new _.H(_.G,4,4041);return _.Ms(_.wc,[{initDataType:"sinf",initData:new Uint8Array(0)}],"")},"com.microsoft.playready":function(a){const b=my(a,"METHOD"),c=["SAMPLE-AES",gy];if(!c.includes(b))return _.yf("PlayReady in HLS is only supported with [",c.join(", "),"], not",b),null;a=my(a,iy);a=_.Pm(a);a=_.L(a.data);a=_.Xs(_.ft(a));return _.Ms(_.xc,[{initDataType:_.jc,initData:a}],"")},"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=my(a,"METHOD");const c=["SAMPLE-AES",
36
- gy];if(!c.includes(b))return _.yf("Widevine in HLS is only supported with [",c.join(", "),"], not",b),null;b=my(a,iy);b=_.Pm(b);b=_.L(b.data);b=_.Ms(_.yc,[{initDataType:_.jc,initData:b}],"");if(a=ly(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},Fy="VOD",jz="EVENT",Hy="LIVE";_.x("clpp.hls.HlsComponent",class extends _.ro{constructor(){super()}f(){_.tm.m3u8=qz;_.rm[_.Pb]=qz;_.rm[jy]=qz}a(){_.yt("m3u8");_.zt(_.Pb);_.zt(jy)}id(){return"hls"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var py="BANDWIDTH",qy="CLOSED-CAPTIONS",ry="EXT-X-BYTERANGE",sy="EXT-X-DISCONTINUITY",ty="EXT-X-DISCONTINUITY-SEQUENCE",uy="EXT-X-ENDLIST",vy="EXT-X-MEDIA-SEQUENCE",wy="EXT-X-PLAYLIST-TYPE",xy="EXT-X-STREAM-INF",yy="EXT-X-TARGETDURATION",zy="GROUP-ID",Ay="Guessing audio-only",By="SAMPLE-AES-CTR",Cy="SUBTITLES",Dy="URI",Ey="application/vnd.apple.mpegurl",Fy=function(a,b=0){return b+10<=a.length&&73===a[b]&&68===a[b+1]&&51===a[b+2]&&255>a[b+3]&&255>a[b+4]&&128>a[b+6]&&128>a[b+7]&&128>a[b+
2
+ 8]&&128>a[b+9]?!0:!1},Gy=function(a,b,c){return(a=a.getAttribute(b))?a.value:c||null},Hy=function(a,b){a=a.getAttribute(b);if(!a)throw new _.H(_.G,4,4023,b);return a.value},Iy=function(a,b){return a.filter(c=>c.name==b)},Jy=function(a,b){return a.filter(c=>Hy(c,"TYPE")===b)},Ky=function(a,b){a=Iy(a,b);return a.length?a[0]:null},Ly=function(a,b){return _.et([a],[b])[0]},Oy=function(a,b){var c;a=a.a++;var d=b.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!d)throw new _.H(_.G,4,4016,{invalidTag:b});b=d[1];var e=
3
+ d[2];d=[];if(e){e=new _.Ho(e);var f;(f=_.nm(e,/^([^,=]+)(?:,|$)/g))&&(c=f[1]);const g=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;for(;f=_.nm(e,g);)d.push(new My(f[1],f[2]||f[3]))}return c=new Ny(a,b,d,c)},Ry=function(a,b,c,d){const e=[];let f=[];c.forEach(g=>{/^(#EXT)/.test(g)?(g=Oy(a,g),Py.includes(g.name)?d.push(g):f.push(g)):/^#(?!EXT)/m.test(g)||(g=Ly(b,g.trim()),e.push(new Qy(g,f)),f=[])});return e},Uy=function(a,b,c){b=_.gg(b);b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim();const d=b.split(/\n+/m);
4
+ if(!/^#EXTM3U($|[ \t\n])/m.test(d[0]))throw new _.H(_.G,4,4015);b=0;let e=!0;for(var f of d)if(f=f.trim(),!f.length||/^#(?!EXT)/m.test(f)||e)e=!1;else{var g=Oy(a,f);--a.a;if(Py.includes(g.name)){b=1;break}else g.name==xy&&(e=!0)}f=[];e=!0;for(var h of _.Ss(d)){let {ld:k,item:l,next:m}=h;l=l.trim();if(!l.length||/^#(?!EXT)/m.test(l)||e)e=!1;else{g=Oy(a,l);if(Sy.includes(g.name)){if(1!=b)throw new _.H(_.G,4,4017);h=d.splice(k,d.length-k);a=Ry(a,c,h,f);return new Ty(c,b,f,a)}f.push(g);g.name==xy&&(g.a.push(new My(Dy,
5
+ m)),e=!0)}}return new Ty(c,b,f)},Vy=function(a){_.v(function*(){a.a.debug(_.As);if(a.j)try{yield a.update(),a.A.$(a.T)}catch(b){a.j&&(a.j.onError(b),1===b.severity&&a.A.$(.1))}})},Xy=function(a,b){b=_.wg([b],a.h.attemptParameters);b.type=1;return Wy(a,b)},cz=function(a,b){return _.v(function*(){var c=Uy(a.K,b,a.B);if(1===c.type){a.D.set(a.B,c);c=(new _.dh(c.a[0].a)).ma.split(".").pop();var d=Yy.audio[c],e="";Yy.video[c]?e="avc1.42E01E":d&&(e="mp4a.40.2");{c=a.K;d=a.B;e=a.h.hlsDefaultCodecs||e;var f=
6
+ [];const h=[];h.push(new My(py,"0"));h.push(new My(Dy,d));e.length&&h.push(new My(_.ja,e));f.push(new Ny(c.a++,xy,h));c=new Ty(d,0,f)}}c=yield Zy(a,c.Ga);if(!a.j)throw new _.H(_.G,7,7001);a.j.filterAllPeriods([c]);e=Infinity;d=0;f=Infinity;for(var g of a.f.values())e=Math.min(e,g.ud),d=Math.max(d,g.ud),g.stream.type!=_.r&&(f=Math.min(f,g.duration));a.m!=$y?(a.g=new _.dy(0,3*a.N,!0),a.g.f=!1):(a.g=new _.dy(null,0,!0),a.g.f=!0);az(a);if(a.m!=$y){a.T=a.R;a.m===bz&&(g=Math.max(f,a.g.Ed),isNaN(a.h.availabilityWindowOverride)||
7
+ (g=a.h.availabilityWindowOverride),a.g.Xb=g);for(g=0;95443.7176888889<=d;)g+=95443.7176888889,d-=95443.7176888889;if(g){a.a.debug("Offsetting live streams by",g,"to compensate for rollover");for(const h of a.f.values())95443.7176888889>h.ud?(a.a.debug("Offset applied to",h.stream.type),h.ab.offset(g)):a.a.debug("Offset NOT applied to",h.stream.type)}}else{a.g.Hb(f);a.g.offset(-e);for(const h of a.f.values())h.ab.offset(-e),_.Pt(h.ab,f)}a.H={presentationTimeline:a.g,periods:[c],offlineSessionIds:[],
8
+ minBufferTime:0}})},fz=function(a,b){return _.v(function*(){var c=yield Xy(a,b.Le);c=Uy(a.K,c.data,c.uri);if(1!=c.type)throw new _.H(_.G,4,4017);var d=b.stream;d=yield dz(a,b.Tc,c,d.type,d.mimeType,d.codecs,d.keyInfo||null,b.Re);b.ab.replace(d);d=d[d.length-1];Ky(c.Ga,uy)&&(ez(a,$y),a.g.Hb(d.endTime))})},dz=function(a,b,c,d,e,f,g,h){return _.v(function*(){var k=c.a;const l=gz(c,g);var m=(m=Ky(c.Ga,vy))?Number(m.value):0;null===a.L&&(a.L=yield hz(a,b,l,k[0],m,g,e,f,d));const n=a.L;a.a.debug("First segment",
9
+ k[0].a.split("/").pop(),"starts at",n);var q=Ky(c.Ga,ty);let t=q?Number(q.value):0;h.has(t)||h.set(t,m);if(!q)for(;h.has(t+1)&&h.get(t+1)<m;)t++;q=a.I.get(t)||0;const w=[];for(const B of _.Ss(k)){var A=B.ld;k=B.item;{const E=w[w.length-1],C=0==A?n:E.endTime;A=m+A;Ky(k.Ga,sy)&&(t++,h.set(t,A),q=yield iz(a,t,b,l,k,A,g,e,f,C,d));k=jz(E,k,A,C,q,g,d);w.push(k)}}a.S.push(w);az(a);return w})},ez=function(a,b){a.m=b;a.g&&(a.g.f=a.m==$y);a.m!=$y||a.A.stop()},Zy=function(a,b){return _.v(function*(){var c=Iy(b,
10
+ "EXT-X-MEDIA"),d=Iy(b,xy),e=Iy(b,"EXT-X-IMAGE-STREAM-INF");for(var f of d){var g=Gy(f,"AUDIO"),h=Gy(f,"VIDEO"),k=Gy(f,Cy);const l=kz(a,f);if(k){const m=lz(_.r,l);a.o.set(k,m);k=l.indexOf(m);-1<k&&l.splice(k,1)}g&&(k=mz(_.Rb,l),a.o.set(g,k));h&&(g=mz(_.u,l),a.o.set(h,g))}yield nz(a,c);f=Jy(c,qy);for(const l of f)f=oz(l),h=Hy(l,zy),g=Hy(l,"INSTREAM-ID"),a.J.get(h)||a.J.set(h,new Map),a.J.get(h).set(g,f);d=yield pz(a,d);c=yield qz(a,c);e=yield rz(a,e);return{startTime:0,variants:d,textStreams:c,thumbStreams:e}})},
11
+ nz=function(a,b){return _.v(function*(){b=b.filter(d=>{const e=Gy(d,Dy)||"";return Gy(d,"TYPE")!==Cy&&""!==e});b.length&&(yield sz(a,b[0]));const c=b.slice(1).map(d=>sz(a,d));yield Promise.all(c)})},pz=function(a,b){return _.v(function*(){var c=f=>_.v(function*(){const g=Gy(f,"FRAME-RATE"),h=Number(Hy(f,py));var k=Gy(f,"RESOLUTION");const [l,m]=k?k.split("x"):[null,null];return(k=yield tz(a,f,k,g))?uz(a,k.audio,k.video,h,l,m,g):[]});let d=0;var e=Infinity;for(let f=0;f<b.length;++f){const g=Number(Hy(b[f],
12
+ py));g<e&&(e=g,d=f)}e=b.splice(d,1).pop();e=yield c(e);c=b.map(c);c=yield Promise.all(c);c.splice(d,0,e);return c.reduce(_.ct,[]).filter(_.ek)})},qz=function(a,b){return _.v(function*(){var c=Jy(b,Cy),d=c.map(f=>_.v(function*(){try{return(yield sz(a,f)).stream}catch(g){throw g;}}));d=yield Promise.all(d);for(const f of c){var e=Hy(f,zy);if(c=a.o.get(e))if(e=a.w.get(e))for(const g of e)g.stream.codecs=c}return d.filter(f=>f)})},rz=function(a,b){return _.v(function*(){const c=b.map(d=>_.v(function*(){return(yield vz(a,
13
+ d)).stream}));return(yield Promise.all(c)).filter(d=>d)})},kz=function(a,b){var c=Gy(b,_.ja,a.h.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);b=new Set;const d=[];for(const e of c)c=_.Ys(e)[0],b.has(c)?a.a.debug("Ignoring duplicate codec"):(d.push(e),b.add(c));return d},lz=function(a,b){const c=wz[a];for(let d=0;d<c.length;d++)for(let e=0;e<b.length;e++)if(c[d].test(b[e].trim()))return b[e].trim();return a==_.r?"":null},mz=function(a,b){if(1==b.length)return b[0];a=lz(a,b);if(null!=
14
+ a)return a;throw new _.H(_.G,4,4025,{codecList:b});},sz=function(a,b){return _.v(function*(){const c=Hy(b,zy);var d="";let e=Hy(b,"TYPE").toLowerCase();e==_.Ls&&(e=_.r);e!==_.r&&c&&a.o.has(c)&&(d=a.o.get(c));const f=Hy(b,Dy);if(a.f.has(f))return a.f.get(f);const g=oz(b),h=Gy(b,"NAME"),k=b.getAttribute("DEFAULT"),l=b.getAttribute("AUTOSELECT"),m=Gy(b,"CHANNELS");d=yield xz(a,f,d,e,g,!!k&&!!l,h,e==_.Rb?m?parseInt(m.split("/")[0],10):null:null,null);if(null==d)return null;a.w.has(c)?a.w.get(c).push(d):
15
+ a.w.set(c,[d]);if(a.f.has(f))return a.f.get(f);a.f.set(f,d);return d})},vz=function(a,b){return _.v(function*(){const c=Hy(b,Dy);if(a.f.has(c))return a.f.get(c);var d=Gy(b,_.ja)||"jpg",e=oz(b);const f=Gy(b,"NAME");d=yield xz(a,c,d,_.Tc,e,!1,f,null,null);if(null===d)return null;if(a.f.has(c))return a.f.get(c);if(e=Gy(b,py))d.stream.bandwidth=Number(e);a.f.set(c,d);return d})},tz=function(a,b,c,d){return _.v(function*(){let e=kz(a,b);var f=Gy(b,"AUDIO"),g=Gy(b,"VIDEO"),h=f||g;h=h&&a.w.has(h)?a.w.get(h):
16
+ [];f={audio:f?h:[],video:g?h:[]};a.a.debug("Guessing stream type for",b.toString());g=!1;const k=Hy(b,Dy),l=f.audio.find(q=>q.Tc===k);var m=lz(_.u,e);m=c||d||m;1!==e.length||m?!h.length&&1<e.length?(a.a.debug("Guessing multiplexed audio+video"),h=_.u,e=[e.join(",")]):f.audio.length&&l?(a.a.debug(Ay),h=_.Rb,g=!0):f.video.length?(a.a.debug(Ay),h=_.Rb):(a.a.debug("Guessing video-only"),h=_.u):(h=_.Rb,a.a.debug(Ay));let n;g||(n=yield yz(a,b,e,h));if(n)f[n.stream.type]=[n];else if(null===n)return a.a.debug("streamInfo is null"),
17
+ null;zz(f);return f})},uz=function(a,b,c,d,e,f,g){c.forEach(l=>{if(l=l.stream)l.width=Number(e)||void 0,l.height=Number(f)||void 0,l.frameRate=Number(g)||void 0});b.length||(b=[null]);c.length||(c=[null]);const h=[];for(const l of b)for(const m of c){var k=l?l.stream:null;const n=m?m.stream:null,q=l?l.drmInfos:null,t=m?m.drmInfos:null;b=(m?m.Tc:"")+" - "+(l?l.Tc:"");let w;if(k&&n)if(q.length&&t.length?0<_.bt(q,t).length:1)w=_.bt(q,t);else{a.a.warn("Incompatible DRM info in HLS variant. Skipping.");
18
+ continue}else k?w=q:n&&(w=t);a.V.has(b)?a.a.debug("Skipping variant which only differs in text streams."):(k=Az(a,k,n,d,w),h.push(k),a.V.add(b))}return h},yz=function(a,b,c,d){return _.v(function*(){const e=Hy(b,Dy);if(a.f.has(e))return a.f.get(e);var f=Gy(b,qy),g=null;d==_.u&&f&&"NONE"!=f&&(g=a.J.get(f));f=mz(d,c);g=yield xz(a,e,f,d,_.pe,!1,null,null,g);if(null==g)return null;if(a.f.has(e))return a.f.get(e);a.f.set(e,g);return g})},zz=function(a){for(const b of a.audio.concat(a.video))a=b.stream.codecs.split(","),
19
+ a=a.filter(c=>"mp4a.40.34"!=c),b.stream.codecs=a.join(",")},Az=function(a,b,c,d,e){return{id:a.W++,language:b?b.language:_.pe,primary:!!b&&b.primary||!!c&&c.primary,audio:b,video:c,bandwidth:d,drmInfos:e,allowedByApplication:!0,allowedByKeySystem:!0}},oz=function(a){a=Gy(a,"LANGUAGE")||_.pe;return _.Gg(a)},xz=function(a,b,c,d,e,f,g,h,k){return _.v(function*(){let l=Ly(a.B,b);var m=null;if(a.m==$y&&a.D.has(l)){var n=a.D.get(l);a.D.delete(l)}else{var q=yield Xy(a,l);l=q.uri;n=Uy(a.K,q.data,l)}if(1!=
20
+ n.type)throw new _.H(_.G,4,4017);Bz(a,n);q=yield Cz(a,d,c,n);const t=[];n.a.forEach(Ad=>{Ad=Iy(Ad.Ga,"EXT-X-KEY");t.push.apply(t,Ad)});let w=!1;const A=[];let B=null;for(var E of t){var C=Hy(E,"METHOD"),na=Gy(E,"KEYFORMAT","identity");"NONE"!=C&&("AES-128"==C?(m=Gy(E,"IV",""),m={method:"AES-128",url:Ly(a.B,Hy(E,Dy)),iv:m?_.ji((m||"0x").slice(2)):null},a.F=!0):(w=!0,(C=(C=Dz[na])?C(E,q):null)?(C.keyIds.length&&(B=C.keyIds[0]),A.push(C)):a.a.warn("Unsupported HLS KEYFORMAT",na)))}if(w&&!A.length&&!a.F)throw new _.H(_.G,
21
+ 4,4026);E=new Map;var Za=yield dz(a,b,n,d,q,c,m,E);na=Za[0].startTime;C=Za[Za.length-1].endTime;const rf=C-na;Za=new _.ey(Za);n=gz(n,m);let we=void 0;d==_.r&&(we=_.Ks);return{stream:{id:a.W++,originalId:g,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:Za.h.bind(Za),getSegmentReference:Za.get.bind(Za),adjustSegmentDurations:Za.f.bind(Za),getDuration:Za.getDuration.bind(Za),initSegmentReference:n,mimeType:q,codecs:c,kind:we,encrypted:w,keyId:B,language:e,label:g,type:d,primary:f,
22
+ trickModeVideo:null,emsgSchemeIdUris:null,frameRate:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:h,closedCaptions:k,keyInfo:m},ab:Za,drmInfos:A,Tc:b,Le:l,ud:na,Xf:C,duration:rf,Re:E}})},Bz=function(a,b){var c=Ky(b.Ga,wy),d=Ky(b.Ga,uy);d=c&&"VOD"==c.value||d;c=c&&"EVENT"==c.value&&!d;c=!d&&!c;d?ez(a,$y):(c?ez(a,bz):ez(a,Ez),b=Fz(b.Ga,yy),b=Number(b.value),a.N=Math.max(b,a.N),a.R=Math.min(b,a.R))},Cz=function(a,b,c,d){return _.v(function*(){var e=d.a[0].a;const f=(new _.dh(e)).ma.split(".").pop(),
23
+ g=Yy[b][f];if(g)return g;if(b==_.r)return c&&"vtt"!=c?_.Kb:_.ke;e=_.wg([e],a.h.attemptParameters);e.method="HEAD";e.type=2;e=(yield Wy(a,e)).headers["content-type"];if(!e)throw new _.H(_.G,4,4021,f);return e.split(";")[0]})},gz=function(a,b){var c=Iy(a.Ga,"EXT-X-MAP");if(!c.length)return null;if(1<c.length)throw new _.H(_.G,4,4020);c=c[0];var d=Hy(c,Dy);const e=Ly(a.f,d);a=0;d=null;if(c=Gy(c,"BYTERANGE"))a=c.split("@"),c=Number(a[0]),a=Number(a[1]),d=a+c-1;return new _.cy(()=>[e],a,d,b)},Fz=function(a,
24
+ b){a=Ky(a,b);if(!a)throw new _.H(_.G,4,4024,{missingTag:b});return a},az=function(a){a.g&&(a.S.forEach(b=>{_.Ft(a.g,b,0)}),a.S=[])},jz=function(a,b,c,d,e,f,g){var h=b.Ga;const k=b.a;b=Fz(h,"EXTINF").value.split(",");b=d+Number(b[0]);var l=0,m=null,n=Ky(h,ry);n&&(l=n.value.split("@"),m=Number(l[0]),l=l[1]?Number(l[1]):a.wa+1,m=l+m-1);(a=f?Object.assign({},f):null)&&!a.iv&&(a.iv=_.mi(new Uint8Array(12),new Uint8Array([c>>24&255,c>>16&255,c>>8&255,c&255])));let q=n=null;f=null;g===_.Tc&&(h=Ky(h,"EXT-X-TILES"),
25
+ g="1x1",h&&(g=Gy(h,"LAYOUT")||"1x1",f=(h=Gy(h,"DURATION"))?Number(h):null),[n,q]=g.split("x").map(t=>parseInt(t,10)));return new _.Mt(c,d,b,()=>[k],l,m,e,a,!1,null,n,q,f)},hz=function(a,b,c,d,e,f,g,h,k,l){return _.v(function*(){var m=jz(null,d,e,0,0,f,k);if(a.H&&!l){var n=a.f.get(b).ab.get(m.position);if(n)return a.a.debug("Found segment start time in previous manifest"),n.startTime;a.a.debug("Unable to find segment start time in previous manifest!")}a.a.debug("Fetching segment to find start time");
26
+ if("audio/mpeg"==g)return 0;if(g==_.Sb)return m=yield Gz(a,m),n=_.L(m.data),Fy(n)?Hz(n):Iz(m.data);if(g==_.Be||g==_.Vb)return m=[Gz(a,m)],c&&m.push(Gz(a,c)),m=yield Promise.all(m),Jz(a,m[0].data,(m[1]||m[0]).data);if(g==_.Ae)return m=yield Gz(a,m),Iz(m.data);if(g===_.Ub||g===_.Tb||!MediaSource.isTypeSupported(`${g.split("/")[0]||""}/mp4;codecs="${h}"`))return 0;throw new _.H(_.G,4,4030);})},iz=function(a,b,c,d,e,f,g,h,k,l,m){return _.v(function*(){let n;a.I.has(b)?n=a.I.get(b):(n=(yield hz(a,c,d,
27
+ e,f,g,h,k,m,!0))-l,a.a.debug("Discontinuity segment offset",n),a.I.set(b,n));return n})},Wy=function(a,b){if(!a.C)throw new _.H(_.G,7,7001);b=a.j.networkingEngine.fetch(b);_.ch(a.C,b);return b.O},Gz=function(a,b){return _.v(function*(){const c=b.a(),d=_.Dt(b.Ka(),b.Fa,b.Fa+2048-1,a.h.attemptParameters);d.type=2;const e=_.Dt(b.Ka(),b.Fa,b.wa,a.h.attemptParameters);e.type=2;c&&(e.keyInfo=c);try{return yield Wy(a,a.F?e:d)}catch(f){if(7001==f.code||a.F)throw f;a.a.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS preflights.",
28
+ d.uris[0]);return yield Wy(a,e)}})},Hz=function(a){function b(h,k,l){let m="";for(;k<l;k++)m+="%"+("00"+h[k].toString(16)).slice(-2);return m}function c(h){return h[0]<<21|h[1]<<14|h[2]<<7|h[3]}function d(){throw new _.H(_.G,4,4030);}Fy(a)||d();let e=10;a[5]&64&&(e=e+4+c(a.subarray(10,14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(let h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===
29
+ unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}Fy(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},Iz=function(a){function b(){d.seek(e+188);f=_.Ns(d);71!=f&&(d.seek(e+192),f=_.Ns(d));71!=f&&(d.seek(e+204),f=_.Ns(d));71!=f&&c();_.Os(d)}function c(){throw new _.H(_.G,4,4030);}const d=new _.On(new DataView(a),!1);let e=0,f=0;for(;;){e=d.getPosition();f=_.Ns(d);71!=f&&c();a=_.Bi(d);if(8191===(a&8191)){b();continue}if(!(a&
30
+ 16384)){b();continue}a=(_.Ns(d)&48)>>4;0!=a&&2!=a||c();3==a&&(a=_.Ns(d),d.skip(a));if(1!=_.N(d)>>8){b();continue}d.skip(3);a=_.Ns(d)>>6;0!=a&&1!=a||c();0==_.Ns(d)&&c();a=_.Ns(d);const g=_.Bi(d),h=_.Bi(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}},Jz=function(a,b,c){let d=0;(new _.Yn).M(_.ld,_.mj).M(_.ne,_.mj).M(_.gd,_.mj).X("mdhd",g=>{g.G.skip(0==g.version?8:16);d=_.N(g.G);g.Za.stop()}).parse(c,!0);if(!d)throw a.a.error("Unable to find timescale in init segment!"),new _.H(_.G,
31
+ 4,4030);let e=0,f=!1;(new _.Yn).M("moof",_.mj).M("traf",_.mj).X("tfdt",g=>{e=(0==g.version?_.N(g.G):_.Di(g.G))/d;f=!0;g.Za.stop()}).parse(b,!0);if(!f)throw new _.H(_.G,4,4030);return e},Ty=class{constructor(a,b,c,d){this.f=a;this.type=b;this.Ga=c;this.a=d||null}},Ny=class{constructor(a,b,c,d=null){this.id=a;this.name=b;this.a=c;this.value=d}toString(){function a(d){return d.name+"\x3d"+(isNaN(Number(d.value))?'"'+d.value+'"':d.value)}let b="#"+this.name;const c=this.a?this.a.map(a):[];this.value&&
32
+ c.unshift(this.value);0<c.length&&(b+=":"+c.join(","));return b}getAttribute(a){const b=this.a.filter(c=>c.name==a);return b.length?b[0]:null}},My=class{constructor(a,b){this.name=a;this.value=b}},Qy=class{constructor(a,b){this.Ga=b;this.a=a}};var Kz=class{constructor(){this.a=0}},Py=[yy,vy,ty,wy,"EXT-X-MAP","EXT-X-I-FRAMES-ONLY",uy],Sy=["EXTINF",ry,sy,"EXT-X-PROGRAM-DATE-TIME","EXT-X-KEY","EXT-X-DATERANGE"];var Lz=class{constructor(){this.h=this.j=null;this.W=1;this.w=new Map;this.V=new Set;this.f=new Map;this.g=null;this.B="";this.K=new Kz;this.T=0;this.A=new _.rh(()=>{Vy(this)});this.m=$y;this.H=null;this.N=0;this.R=Infinity;this.C=new _.An;this.S=[];this.J=new Map;this.F=!1;this.o=new Map;this.L=null;this.a=new _.O("clpp.hls.HlsParser");this.D=new Map;this.I=new Map}configure(a){this.h=a}start(a,b){const c=this;return _.v(function*(){c.j=b;var d=yield Xy(c,a);c.B=d.uri;yield cz(c,d.data);d=c.T;0<
33
+ d&&c.A.$(d);return c.H})}stop(){this.A&&(this.A.stop(),this.A=null);const a=[];this.C&&(a.push(this.C.destroy()),this.C=null);this.h=this.j=null;this.V.clear();this.f.clear();this.D.clear();this.H=null;this.w.clear();this.o.clear();return Promise.all(a)}update(){const a=this;return _.v(function*(){if(a.m!=$y){var b=[];a.L=null;var c=Array.from(a.f.values());c.length&&(yield fz(a,c[0]));for(let d=1;d<c.length;++d)b.push(fz(a,c[d]));yield Promise.all(b)}})}onExpirationUpdated(){}},wz={audio:[/^vorbis$/,
34
+ /^opus$/,/^flac$/,/^mp4a/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]},Yy={audio:{mp4:_.Vb,m4s:_.Vb,m4i:_.Vb,m4a:_.Vb,cmfa:_.Vb,ts:_.Ae,aac:_.Sb,ec3:_.Ub,ac3:_.Tb},video:{mp4:_.Be,m4s:_.Be,m4i:_.Be,m4v:_.Be,cmfv:_.Be,ts:_.Ae},text:{mp4:_.Kb,m4s:_.Kb,m4i:_.Kb,cmft:_.Kb,vtt:_.ke,ttml:_.Nb},image:{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",svg:"image/svg+xml",webp:"image/webp",avif:"image/avif"}},Dz={"com.apple.streamingkeydelivery":function(a,
35
+ b){if(b===_.Ae)throw new _.H(_.G,4,4041);return _.ft(_.wc,[{initDataType:"sinf",initData:new Uint8Array(0)}],"")},"com.microsoft.playready":function(a){const b=Hy(a,"METHOD"),c=["SAMPLE-AES",By];if(!c.includes(b))return _.uf("PlayReady in HLS is only supported with [",c.join(", "),"], not",b),null;a=Hy(a,Dy);a=_.Pm(a);a=_.L(a.data);a=_.qt(_.zt(a));return _.ft(_.xc,[{initDataType:_.jc,initData:a}],"")},"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=Hy(a,"METHOD");const c=["SAMPLE-AES",
36
+ By];if(!c.includes(b))return _.uf("Widevine in HLS is only supported with [",c.join(", "),"], not",b),null;b=Hy(a,Dy);b=_.Pm(b);b=_.L(b.data);b=_.ft(_.yc,[{initDataType:_.jc,initData:b}],"");if(a=Gy(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},$y="VOD",Ez="EVENT",bz="LIVE";_.x("clpp.hls.HlsComponent",class extends _.ro{constructor(){super()}f(){_.tm.m3u8=Lz;_.rm[_.Pb]=Lz;_.rm[Ey]=Lz}a(){_.St("m3u8");_.Tt(_.Pb);_.Tt(Ey)}id(){return"hls"}});};f.call(g, window);
package/cl.hlssmpte.js CHANGED
@@ -1,5 +1,5 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var nG=function(a){a.a.one(a.l,_.cd,()=>mG(a))},mG=function(a){const b=a.l.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Cb,d=>oG(a,d));var c=Array.from(b.textTracks);c.filter(d=>d.kind===_.id).forEach(d=>{oG(a,{track:d})});!pG(c)&&a.m&&(a.f.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),qG(a,b))}else a.f.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");
2
- else a.f.warn("A video element is not available. Skipping.")},oG=function(a,b){b=b.track;b.kind===_.id&&(a.f.info("The metadata track has been added."),b.mode=_.Sc,a.a.on(b,_.Bc,c=>rG(a,c)))},pG=function(a){return a.some(b=>b.kind===_.id)},qG=function(a,b){const c=a.l.getTrackManager(),d=c.ha(),e=c.getAudioTracks().find(g=>g!==d);if(e){var f=()=>c.ka(d);a.a.on(b.textTracks,_.Cb,g=>{g.track.kind===_.id&&(a.a.off(b.textTracks,_.Cb,f),c.ka(d))});c.ka(e)}else a.f.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},
3
- rG=function(a,b){const c=sG(a);c&&Array.from(b.target.activeCues||[]).forEach(d=>{if(d!==a.g&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new tG(d);if(e.f===c&&null!==e.a){a.g=d;d=a.h.parseMedia(_.kg(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});const f=a.l.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},sG=function(a){return(a=a.l.getTrackManager().ia())&&a.language&&a.language.toLowerCase()},
4
- tG=class{constructor(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.y(a)){a:{var b=a.info;if(_.ff(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=a=_.ff(a)?a:null}}};var uG=class{constructor(a,b,c){this.l=a;this.m=b;this.j=c;this.a=new _.cn;this.h=(a=_.Rm[_.Nb]||null)?new a(this.l.getConfiguration()):null;this.f=new _.O("clpp.hlssmpte.ImageCueHandler");this.g=null;nG(this)}destroy(){this.a.release();this.g=null;return Promise.resolve()}};var vG=class extends _.Uo{constructor(){super();this.a=null;this.f=!1}onPlayerCreated(){}onContentWillLoad(a){if(this.f=_.Fh()){var b=a.getConfiguration();b=_.bf(b.hlssmpte||{});typeof b.patchMetadataTrack!==_.Zb&&(b.patchMetadataTrack=!1);_.gf(b.timestampOffset)||(b.timestampOffset=0);this.a=new uG(a,b.patchMetadataTrack,b.timestampOffset)}}onPlayerWillDestroy(){const a=this;return _.v(function*(){a.a&&(yield a.a.destroy(),a.a=null)})}id(){return"hlssmpte"}};_.x("clpp.hlssmpte.HlsSmptePlugin",vG);
5
- vG.Id="hlssmpte";_.Cl(new class{create(){return new vG}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var JG=function(a){a.a.one(a.l,_.cd,()=>IG(a))},IG=function(a){const b=a.l.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Cb,d=>KG(a,d));var c=Array.from(b.textTracks);c.filter(d=>d.kind===_.id).forEach(d=>{KG(a,{track:d})});!LG(c)&&a.m&&(a.f.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),MG(a,b))}else a.f.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");
2
+ else a.f.warn("A video element is not available. Skipping.")},KG=function(a,b){b=b.track;b.kind===_.id&&(a.f.info("The metadata track has been added."),b.mode=_.Sc,a.a.on(b,_.Bc,c=>NG(a,c)))},LG=function(a){return a.some(b=>b.kind===_.id)},MG=function(a,b){const c=a.l.getTrackManager(),d=c.ha(),e=c.getAudioTracks().find(g=>g!==d);if(e){var f=()=>c.la(d);a.a.on(b.textTracks,_.Cb,g=>{g.track.kind===_.id&&(a.a.off(b.textTracks,_.Cb,f),c.la(d))});c.la(e)}else a.f.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},
3
+ NG=function(a,b){const c=OG(a);c&&Array.from(b.target.activeCues||[]).forEach(d=>{if(d!==a.g&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new PG(d);if(e.f===c&&null!==e.a){a.g=d;d=a.h.parseMedia(_.kg(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});const f=a.l.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},OG=function(a){return(a=a.l.getTrackManager().ia())&&a.language&&a.language.toLowerCase()},
4
+ PG=class{constructor(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.y(a)){a:{var b=a.info;if(_.ff(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=a=_.ff(a)?a:null}}};var QG=class{constructor(a,b,c){this.l=a;this.m=b;this.j=c;this.a=new _.cn;this.h=(a=_.Rm[_.Nb]||null)?new a(this.l.getConfiguration()):null;this.f=new _.O("clpp.hlssmpte.ImageCueHandler");this.g=null;JG(this)}destroy(){this.a.release();this.g=null;return Promise.resolve()}};var RG=class extends _.So{constructor(){super();this.a=null;this.f=!1}onPlayerCreated(){}onContentWillLoad(a){if(this.f=_.Fh()){var b=a.getConfiguration();b=_.bf(b.hlssmpte||{});typeof b.patchMetadataTrack!==_.Zb&&(b.patchMetadataTrack=!1);_.gf(b.timestampOffset)||(b.timestampOffset=0);this.a=new QG(a,b.patchMetadataTrack,b.timestampOffset)}}onPlayerWillDestroy(){const a=this;return _.v(function*(){a.a&&(yield a.a.destroy(),a.a=null)})}id(){return"hlssmpte"}};_.x("clpp.hlssmpte.HlsSmptePlugin",RG);
5
+ RG.Id="hlssmpte";_.Cl(new class{create(){return new RG}});};f.call(g, window);
package/cl.htmlcue.js CHANGED
@@ -1,24 +1,24 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var hF="Unsupported unit",iF="clpp-text-plain",jF="clpp-text-ttml",kF="clpp.htmlcue.HtmlTextDisplayer",lF="initial",mF=function(a,b){let c=0,d=a.length-1;for(;c<=d;){const e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},nF=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},pF=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>oF[c]);return a},qF=
2
- function(a,b){for(const c in a)b.style[c]=a[c]},rF=function(a,b){return 0===a?"0":a+b},sF=function(a,b){return 1>Math.abs(a-b)||a<b},tF=function(a,b){return a<b&&1<Math.abs(a-b)},uF=function(a,b){return a>b&&1<Math.abs(a-b)},vF=function(a,b){return 1>Math.abs(a-b)||a>b},xF=function(a){const b=a.getBoundingClientRect();var c=getComputedStyle(a,null);const d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0;var f=parseFloat(c.getPropertyValue("border-top-width"))||
3
- 0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;const g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new wF(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},yF=function(a){return new wF(a.f,a.g,a.h,a.a,a.height,a.width)},zF=function(a,b){return b.some(c=>tF(a.f,c.g)&&uF(a.g,c.f)&&tF(a.h,c.a)&&uF(a.a,c.h))},AF=function(a,b){return vF(a.h,b.h)&&sF(a.a,b.a)&&vF(a.f,b.f)&&sF(a.g,b.g)},BF=function(a,b,c){switch(c){case "+x":return tF(a.f,b.f);case "-x":return uF(a.g,
4
- b.g);case "+y":return tF(a.h,b.h);case "-y":return uF(a.a,b.a);default:throw Error("Unknown axis");}},CF=function(a){return a.f.writingMode===_.gn},DF=function(a){switch(a.f.writingMode){case _.gn:return"horizontal-tb";case _.ye:return _.ye;case _.ze:return _.ze;default:throw Error("Unknown writing mode");}},EF=function(a){switch(a.f.positionAlign){case _.ad:return _.Yc;case "auto":case _.kc:return _.fn;case _.bd:return _.Vd}return a.f.textAlign},FF=function(a,b){if(typeof a.f.position===_.p&&typeof a.f.size===
5
- _.p)switch(b){case _.ad:return a.f.position;case "auto":case _.kc:return a.f.position-a.f.size/2;case _.bd:return a.f.position-a.f.size}return 0},GF=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Yc:case _.Yc:return _.ad;case _.fn:return _.kc;case _.Vd:case _.Vd:return _.bd}return a.f.positionAlign},JF=function(a,b,c){return(HF(a)||IF(a))&&_.gf(c)?rF(c,_.Od):HF(a)&&_.y(c)?rF(0,_.Od):CF(a)&&_.gf(b)?rF(b,"%"):lF},KF=function(a,b,c){return CF(a)&&_.gf(c)?rF(c,_.Od):(HF(a)||IF(a))&&_.gf(b)?
6
- rF(b,"%"):lF},LF=function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect();const d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return CF(a)?b:c},IF=function(a){return a.f.writingMode===_.ze},HF=function(a){return a.f.writingMode===_.ye},MF=function(a,b){if(a.h)switch(b.writingMode){case _.gn:return["-y"];case _.ye:return["+x"];case _.ze:return["-x"]}a=[];switch(b.writingMode){case _.gn:a=["+y","-y"];break;case _.ye:a=["+x","-x"];break;case _.ze:a=["-x","+x"]}0>b.line&&(a=a.reverse());
7
- return a},NF=function(a){for(a.g=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=xF(a.j.a)},OF=function(a,b){NF(a.g);a.j.unshift(b);for(const c of a.j)a.g.append(c)},PF=function(a,b,c){a=a.f;const d=a.viewportAnchorUnits;if(d===_.on)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(hF);},QF=function(a,b){a=`.${a.g} .clpp-text-container`;const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,`${a} $1`).replace(/::cue\(([^)]+)\)/g,
8
- `${c} $1`).replace(/::cue-region\(([^)]+)\)/g,`${a} $1 .clpp-text-cue`).replace(/::cue/g,c).replace(/::cue-region/g,`${a} .clpp-text-cue-region .clpp-text-cue`).replace(/::ttml/g,a)},RF=function(a,b){let c=!1;try{a.f.insertRule(b,0);const d=a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(e=>0===e.trim().indexOf(`.${a.g} `)))}catch(d){}0<a.f.cssRules.length&&a.f.deleteRule(0);c||a.A.warn(`Ignoring the CSS rule because it's not safe: ${b}`);return c},SF=function(a){if(a.a){for(;0<
9
- a.a.cssRules.length;)a.a.deleteRule(0);a.j=[]}},TF=function(a){a=_.bf(a.getConfiguration().htmlcue||{});_.y(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.y(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},ZF=function(a,b){if((b||a.j)&&a.A){var c=a.l.getPosition();if(b||a.J!==c&&a.l.getState()===_.Ck)if(a.J=c,c=UF(a,c),b||(b=a.o,b=!(null===b&&null===c||null!==b&&null!==c&&b.start===c.start&&b.end===c.end)),b&&(a.o=c,VF(a),a.h&&(b="::cue {",a.getFontColor()&&(b+=`color: ${a.getFontColor()};`),
10
- a.getBackgroundColor()&&(b+=`background-color: ${a.getBackgroundColor()};`),a.getFontFamily()&&(b+=`font-family: ${a.getFontFamily()};`),a.getEdgeType()!==_.Mo&&(b+=`text-shadow: ${_.Xm(a)};`),b+="}",SF(a.h),a.h.appendRule(b)),null!==c)){c=a.f.slice(c.start,c.end+1);for(const g of c){c=a;b=g;if(c.a){var d=c.a.a,e=null;switch(b.payloadType){case _.Ge:e="clpp-text-vtt";break;case _.oe:e=jF;break;case _.en:e=iF}e&&!d.classList.contains(e)&&_.Wk(d,e)}d=xF(c.a.a);if(0===d.width||0===d.height)c.P.warn("The height or width of the `.clpp-text-container` element is zero. Captions will not be displayed. Please check if the `clpp.styles.css` file has been included.");
11
- else{qF({fontSize:WF(c,b.containerRows)},c.a.a);d=null;e=b.payloadType===_.Ge;var f=b.payloadType===_.oe;b.region&&(e||f||b.backgroundImage)&&(c.B.has(b.region.id)?d=c.B.get(b.region.id):(d=new XF(b.region,{}),c.B.set(b.region.id,d),OF(c.a,d)));b=new YF(b,c.L,{});d?OF(d,b):OF(c.a,b)}}}}},$F=function(a){VF(a);a.J=null;a.o=null;a.f=[]},aG=function(a,b){return a.startTime<=b&&a.endTime>b},UF=function(a,b){var c=mF(a.f,d=>aG(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=
12
- c;for(;0<=d-1&&aG(a.f[d-1],b);)d--;for(;c+1<a.f.length&&aG(a.f[c+1],b);)c++;return{start:d,end:c}}},VF=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(jF);b.classList.remove(iF);a=a.a;NF(a.g);a.j=[]}},WF=function(a,b){const c=xF(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.F)return a=a.getFontSizePercent(),`${Math.round(c*a)}px`;if(typeof b===_.p&&0<b)return`${Math.round(c/b)}px`;a=a.getFontSizePercent();return`${Math.round(c*
13
- a)}px`},eG=class{parse(a){a={input:a};const b=_.Yk(_.Ec),c=[];let d=b;for(var e;null!==(e=nF(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=bG[f];h?(h=_.Yk(h),(f=cG[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||dG[g.localName]&&dG[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),
14
- d.appendChild(g),d=g)}}else d.appendChild(document.createTextNode(pF(e)));return b}},bG={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},cG={v:"voice",lang:"lang"},dG={rt:"ruby"},oF={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};var wF=class{constructor(a,b,c,d,e,f){this.f=a;this.g=b;this.h=c;this.a=d;this.height=e;this.width=f}};var fG=class{constructor(a,b,c){this.id=a;this.o=b;this.A=c;this.a=this.m();this.h=!1}init(){this.h=!0}w(){return!1}};var YF=class extends fG{constructor(a,b,c){super(a.id,"clpp-text-cue",c);this.j=b;this.f=a;this.g=!!this.f.backgroundImage}w(){return!this.g&&!(this.f.region&&this.f.region.displayAlign)}init(a){super.init(a);if(this.g)_.Wk(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage=`url("${this.f.backgroundImage}")`,this.j.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else{var b=this.f;if(b.payloadType===_.oe){var c=_.Yk(_.Ec);c.innerHTML=b.payload;b=c}else b.payloadType===_.Ge?b=(new eG).parse(b.payload):
15
- (c=_.Yk(_.Ec),c.textContent=b.payload,b=c);_.Wk(b,this.o);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.Wk(b,d);qF({writingMode:DF(this)},b);var d=b;this.a.appendChild(d);_.Wk(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.Wk(this.a,`clpp-text-wrapper__${e}`);_.y(this.f.line)&&(this.f.lineInterpretation=_.hn,this.f.line=CF(this)?-1:0);e=DF(this);qF({writingMode:e,webkitWritingMode:e,direction:lF,textAlign:EF(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){e=
16
- FF(this,GF(this));qF({position:"absolute",left:JF(this,e,null),right:IF(this)&&_.y(null)?rF(0,_.Od):lF,top:KF(this,e,null),width:CF(this)?rF(this.f.size,"%"):lF,height:HF(this)||IF(this)?rF(this.f.size,"%"):lF},this.a);d=this.f;a=CF(this)?a.height:a.width;b=LF(this);if(d.lineInterpretation===_.hn)c=b*Math.round(d.line),Math.abs(c)>a&&(c=b*(0>d.line?0:-1)),0>c&&(c+=a);else{c=b/a*100;let f=d.line;switch(d.lineAlign){case _.kc:f-=c/2;break;case _.Mc:f-=c}c=Math.round(f/100*a)}IF(this)&&(c=a-c-b);a=c;
17
- qF({left:JF(this,e,a),right:IF(this)&&_.y(a)?rF(0,_.Od):lF,top:KF(this,e,a)},this.a)}}}m(){return _.Yk(_.Ec)}};var gG=class{constructor(a,b){this.j=a;this.f=a.a;this.h=void 0===b?!1:b;this.a=xF(a.a);this.g=[]}append(a){const b=a.a;b.style.visibility=_.Sc;this.f.appendChild(b);a.h||a.init(this.a);if(a.w()){a:{var c=xF(a.a);var d=MF(this,a.f),e=LF(a);const g=yF(c);let h=null,k=0;for(const l of d){for(;BF(c,this.a,l)||AF(c,this.a)&&zF(c,this.g);){d=c;var f=e;switch(l){case "+x":d.f+=f;d.g+=f;break;case "-x":d.f-=f;d.g-=f;break;case "+y":d.h+=f;d.a+=f;break;case "-y":d.h-=f,d.a-=f}}if(this.h||AF(c,this.a))break a;
18
- d=this.a;d=Math.max(0,Math.min(c.g,d.g)-Math.max(c.f,d.f))*Math.max(0,Math.min(c.a,d.a)-Math.max(c.h,d.h))/(c.height*c.width);d>k&&(h=yF(c),k=d);c=yF(g)}c=h||g}qF({top:rF(c.h-this.a.h,_.Od),bottom:rF(this.a.a-c.a,_.Od),left:rF(c.f-this.a.f,_.Od),right:rF(this.a.g-c.g,_.Od),height:rF(c.height,_.Od),width:rF(c.width,_.Od)},a.a)}b.style.visibility="visible";this.g.push(xF(a.a))}};var hG=class extends fG{constructor(a,b,c){super(a,b,c);this.g=null;this.j=[]}init(){this.g=new gG(this);this.h=!0}m(){const a=_.Yk(_.Ec);_.Wk(a,this.o);this.id&&(a.id=this.id);return a}};var XF=class extends hG{constructor(a,b){super(a.id,"clpp-text-cue-region",b);this.f=a}init(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.on:b=b.width/100*a.width;break a;default:throw Error(hF);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.on)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(hF);d=a.height;const e=PF(this,d,a.height);qF(this.A,this.a);qF({left:rF(c,_.Od),top:rF(e,_.Od),width:rF(b,
19
- _.Od),height:rF(d,_.Od)},this.a);this.f.writingMode&&qF({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&qF({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.Wk(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.on:f=f.height/100*a.height;break a;case 2:f=f.height;c=new YF(new _.ln(0,1,"Lorem ipsum",_.en),{},{});b=c.a;this.a.appendChild(b);c.init(xF(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
20
- b=c;f*=b;break a;default:throw Error(hF);}a=PF(this,f,a.height);qF({top:rF(a,_.Od),height:rF(f,_.Od)},this.a);this.g=new gG(this,!0);this.h=!0}aa(){return this.f.id}};var jG=class{constructor(a){this.A=new _.O("clpp.htmlcue.StyleManager");this.h=a.getSurface().getContainer();this.g=`clpp-video-${iG++}`;this.m=document.createElement(_.ge);this.o=document.createElement(_.ge);this.j=[];this.f=this.a=null;this.w=!1;a=document.styleSheets;document.head.appendChild(this.m);this.a=a[a.length-1];document.head.appendChild(this.o);this.f=a[a.length-1];this.f.disabled=!0;this.h&&_.Wk(this.h,this.g)}appendRule(a){if(this.a&&!this.j.some(b=>b===a)){const b=QF(this,a);if(RF(this,
21
- b)){try{this.a.insertRule(b,this.a.cssRules.length)}catch(c){this.A.error(`An error occurred when adding a CSS rule: ${b}`)}this.j.push(a)}}}destroy(){const a=this;return _.v(function*(){a.w||(SF(a),document.head.removeChild(a.m),a.m=null,a.a=null,document.head.removeChild(a.o),a.o=null,a.f=null,a.h&&a.h.classList.remove(a.g));a.w=!0})}},iG=0;var kG=class extends _.Oo{constructor(a){super(a);this.P=new _.O(kF);this.l=a;this.L=TF(a);this.j=!1;this.f=[];this.A=a.getSurface().getContainer();this.D=new jG(a);this.h=new jG(a);this.a=new hG(null,"clpp-text-container",{});this.m=new _.Jo(a.getSurface(),this.V.bind(this));this.J=null;this.A?(this.A.appendChild(this.a.a),this.a.init(null)):this.P.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.w=new _.rh(()=>
22
- {ZF(this)});this.B=new Map;this.o=null}V(){ZF(this,!0)}append(a,b){if(0!==a.length){for(const c of b)this.D.appendRule(c);a.sort((c,d)=>c.startTime!==d.startTime?c.startTime-d.startTime:c.endTime-d.endTime);b=this.f.findIndex(c=>c.startTime>=a[0].startTime);0===b?this.f=[]:0<b&&this.f.splice(0,b);for(const c of a)this.f.some(d=>d.payload!==c.payload?!1:d.startTime!==c.startTime?!1:d.endTime!==c.endTime?!1:!0)||this.f.push(c);this.o=null;ZF(this,!1)}}g(){ZF(this,!0)}destroy(){const a=this;return _.v(function*(){$F(a);
23
- a.D&&(yield a.D.destroy(),a.D=null);a.h&&(yield a.h.destroy(),a.h=null);a.a&&(a.A.removeChild(a.a.a),a.a=null);a.m&&(a.m.stop(),a.m=null);a.w&&a.w.stop();a.j=!1})}remove(a,b){if(!this.a)return!1;this.f=this.f.filter(c=>c.startTime<a||c.endTime>=b);this.o=null;ZF(this,!0);return!0}isTextVisible(){return this.j}setTextVisibility(a){this.j!==a&&((this.j=a)?(this.w.Pa(.25),this.L.enableResizeObserver&&this.m.start(),ZF(this,!0)):(this.w.stop(),this.m.stop(),$F(this)))}};_.x(kF,kG);
24
- kG.prototype.setTextVisibility=kG.prototype.setTextVisibility;kG.prototype.isTextVisible=kG.prototype.isTextVisible;kG.prototype.remove=kG.prototype.remove;kG.prototype.destroy=kG.prototype.destroy;kG.prototype.append=kG.prototype.append;var lG=class{X(a){return!!a.enableHtmlCue&&!_.Hh()}create(a){return new kG(a)}};lG.prototype.create=lG.prototype.create;lG.prototype.isSupported=lG.prototype.X;_.x("clpp.htmlcue.HtmlCueComponent",class extends _.ro{f(){_.ck("html",new lG)}a(){}id(){return _.he}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var DF="Unsupported unit",EF="clpp-text-plain",FF="clpp-text-ttml",GF="clpp.htmlcue.HtmlTextDisplayer",HF="initial",IF=function(a,b){let c=0,d=a.length-1;for(;c<=d;){const e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},JF=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},LF=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>KF[c]);return a},MF=
2
+ function(a,b){for(const c in a)b.style[c]=a[c]},NF=function(a,b){return 0===a?"0":a+b},OF=function(a,b){return 1>Math.abs(a-b)||a<b},PF=function(a,b){return a<b&&1<Math.abs(a-b)},QF=function(a,b){return a>b&&1<Math.abs(a-b)},RF=function(a,b){return 1>Math.abs(a-b)||a>b},TF=function(a){const b=a.getBoundingClientRect();var c=getComputedStyle(a,null);const d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0;var f=parseFloat(c.getPropertyValue("border-top-width"))||
3
+ 0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;const g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new SF(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},UF=function(a){return new SF(a.f,a.g,a.h,a.a,a.height,a.width)},VF=function(a,b){return b.some(c=>PF(a.f,c.g)&&QF(a.g,c.f)&&PF(a.h,c.a)&&QF(a.a,c.h))},WF=function(a,b){return RF(a.h,b.h)&&OF(a.a,b.a)&&RF(a.f,b.f)&&OF(a.g,b.g)},XF=function(a,b,c){switch(c){case "+x":return PF(a.f,b.f);case "-x":return QF(a.g,
4
+ b.g);case "+y":return PF(a.h,b.h);case "-y":return QF(a.a,b.a);default:throw Error("Unknown axis");}},YF=function(a){return a.f.writingMode===_.gn},ZF=function(a){switch(a.f.writingMode){case _.gn:return"horizontal-tb";case _.xe:return _.xe;case _.ze:return _.ze;default:throw Error("Unknown writing mode");}},$F=function(a){switch(a.f.positionAlign){case _.ad:return _.Yc;case "auto":case _.kc:return _.fn;case _.bd:return _.Vd}return a.f.textAlign},aG=function(a,b){if(typeof a.f.position===_.p&&typeof a.f.size===
5
+ _.p)switch(b){case _.ad:return a.f.position;case "auto":case _.kc:return a.f.position-a.f.size/2;case _.bd:return a.f.position-a.f.size}return 0},bG=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Yc:case _.Yc:return _.ad;case _.fn:return _.kc;case _.Vd:case _.Vd:return _.bd}return a.f.positionAlign},eG=function(a,b,c){return(cG(a)||dG(a))&&_.gf(c)?NF(c,_.Od):cG(a)&&_.y(c)?NF(0,_.Od):YF(a)&&_.gf(b)?NF(b,"%"):HF},fG=function(a,b,c){return YF(a)&&_.gf(c)?NF(c,_.Od):(cG(a)||dG(a))&&_.gf(b)?
6
+ NF(b,"%"):HF},gG=function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect();const d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return YF(a)?b:c},dG=function(a){return a.f.writingMode===_.ze},cG=function(a){return a.f.writingMode===_.xe},hG=function(a,b){if(a.h)switch(b.writingMode){case _.gn:return["-y"];case _.xe:return["+x"];case _.ze:return["-x"]}a=[];switch(b.writingMode){case _.gn:a=["+y","-y"];break;case _.xe:a=["+x","-x"];break;case _.ze:a=["-x","+x"]}0>b.line&&(a=a.reverse());
7
+ return a},iG=function(a){for(a.g=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=TF(a.j.a)},jG=function(a,b){iG(a.g);a.j.unshift(b);for(const c of a.j)a.g.append(c)},kG=function(a,b,c){a=a.f;const d=a.viewportAnchorUnits;if(d===_.on)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(DF);},lG=function(a,b){a=`.${a.g} .clpp-text-container`;const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,`${a} $1`).replace(/::cue\(([^)]+)\)/g,
8
+ `${c} $1`).replace(/::cue-region\(([^)]+)\)/g,`${a} $1 .clpp-text-cue`).replace(/::cue/g,c).replace(/::cue-region/g,`${a} .clpp-text-cue-region .clpp-text-cue`).replace(/::ttml/g,a)},mG=function(a,b){let c=!1;try{a.f.insertRule(b,0);const d=a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(e=>0===e.trim().indexOf(`.${a.g} `)))}catch(d){}0<a.f.cssRules.length&&a.f.deleteRule(0);c||a.A.warn(`Ignoring the CSS rule because it's not safe: ${b}`);return c},nG=function(a){if(a.a){for(;0<
9
+ a.a.cssRules.length;)a.a.deleteRule(0);a.j=[]}},oG=function(a){a=_.bf(a.getConfiguration().htmlcue||{});_.y(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.y(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},uG=function(a,b){if((b||a.j)&&a.A){var c=a.l.getPosition();if(b||a.J!==c&&a.l.getState()===_.Ck)if(a.J=c,c=pG(a,c),b||(b=a.o,b=!(null===b&&null===c||null!==b&&null!==c&&b.start===c.start&&b.end===c.end)),b&&(a.o=c,qG(a),a.h&&(b="::cue {",a.getFontColor()&&(b+=`color: ${a.getFontColor()};`),
10
+ a.getBackgroundColor()&&(b+=`background-color: ${a.getBackgroundColor()};`),a.getFontFamily()&&(b+=`font-family: ${a.getFontFamily()};`),a.getEdgeType()!==_.Mo&&(b+=`text-shadow: ${_.Xm(a)};`),b+="}",nG(a.h),a.h.appendRule(b)),null!==c)){c=a.f.slice(c.start,c.end+1);for(const g of c){c=a;b=g;if(c.a){var d=c.a.a,e=null;switch(b.payloadType){case _.Ge:e="clpp-text-vtt";break;case _.oe:e=FF;break;case _.en:e=EF}e&&!d.classList.contains(e)&&_.Wk(d,e)}d=TF(c.a.a);if(0===d.width||0===d.height)c.N.warn("The height or width of the `.clpp-text-container` element is zero. Captions will not be displayed. Please check if the `clpp.styles.css` file has been included.");
11
+ else{MF({fontSize:rG(c,b.containerRows)},c.a.a);d=null;e=b.payloadType===_.Ge;var f=b.payloadType===_.oe;b.region&&(e||f||b.backgroundImage)&&(c.B.has(b.region.id)?d=c.B.get(b.region.id):(d=new sG(b.region,{}),c.B.set(b.region.id,d),jG(c.a,d)));b=new tG(b,c.L,{});d?jG(d,b):jG(c.a,b)}}}}},vG=function(a){qG(a);a.J=null;a.o=null;a.f=[]},wG=function(a,b){return a.startTime<=b&&a.endTime>b},pG=function(a,b){var c=IF(a.f,d=>wG(d,b)?0:b!==d.startTime?b-d.startTime:b-d.endTime);if(-1===c)return null;{let d=
12
+ c;for(;0<=d-1&&wG(a.f[d-1],b);)d--;for(;c+1<a.f.length&&wG(a.f[c+1],b);)c++;return{start:d,end:c}}},qG=function(a){a.B.clear();if(a.a){const b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(FF);b.classList.remove(EF);a=a.a;iG(a.g);a.j=[]}},rG=function(a,b){const c=TF(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.F)return a=a.getFontSizePercent(),`${Math.round(c*a)}px`;if(typeof b===_.p&&0<b)return`${Math.round(c/b)}px`;a=a.getFontSizePercent();return`${Math.round(c*
13
+ a)}px`},AG=class{parse(a){a={input:a};const b=_.Yk(_.Ec),c=[];let d=b;for(var e;null!==(e=JF(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=xG[f];h?(h=_.Yk(h),(f=yG[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||zG[g.localName]&&zG[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),
14
+ d.appendChild(g),d=g)}}else d.appendChild(document.createTextNode(LF(e)));return b}},xG={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},yG={v:"voice",lang:"lang"},zG={rt:"ruby"},KF={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};var SF=class{constructor(a,b,c,d,e,f){this.f=a;this.g=b;this.h=c;this.a=d;this.height=e;this.width=f}};var BG=class{constructor(a,b,c){this.id=a;this.o=b;this.A=c;this.a=this.m();this.h=!1}init(){this.h=!0}w(){return!1}};var tG=class extends BG{constructor(a,b,c){super(a.id,"clpp-text-cue",c);this.j=b;this.f=a;this.g=!!this.f.backgroundImage}w(){return!this.g&&!(this.f.region&&this.f.region.displayAlign)}init(a){super.init(a);if(this.g)_.Wk(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage=`url("${this.f.backgroundImage}")`,this.j.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else{var b=this.f;if(b.payloadType===_.oe){var c=_.Yk(_.Ec);c.innerHTML=b.payload;b=c}else b.payloadType===_.Ge?b=(new AG).parse(b.payload):
15
+ (c=_.Yk(_.Ec),c.textContent=b.payload,b=c);_.Wk(b,this.o);this.id&&(b.id=this.id);for(d of this.f.cssClassList)_.Wk(b,d);MF({writingMode:ZF(this)},b);var d=b;this.a.appendChild(d);_.Wk(this.a,"clpp-text-wrapper");for(var e of this.f.cssClassList)_.Wk(this.a,`clpp-text-wrapper__${e}`);_.y(this.f.line)&&(this.f.lineInterpretation=_.hn,this.f.line=YF(this)?-1:0);e=ZF(this);MF({writingMode:e,webkitWritingMode:e,direction:HF,textAlign:$F(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){e=
16
+ aG(this,bG(this));MF({position:"absolute",left:eG(this,e,null),right:dG(this)&&_.y(null)?NF(0,_.Od):HF,top:fG(this,e,null),width:YF(this)?NF(this.f.size,"%"):HF,height:cG(this)||dG(this)?NF(this.f.size,"%"):HF},this.a);d=this.f;a=YF(this)?a.height:a.width;b=gG(this);if(d.lineInterpretation===_.hn)c=b*Math.round(d.line),Math.abs(c)>a&&(c=b*(0>d.line?0:-1)),0>c&&(c+=a);else{c=b/a*100;let f=d.line;switch(d.lineAlign){case _.kc:f-=c/2;break;case _.Mc:f-=c}c=Math.round(f/100*a)}dG(this)&&(c=a-c-b);a=c;
17
+ MF({left:eG(this,e,a),right:dG(this)&&_.y(a)?NF(0,_.Od):HF,top:fG(this,e,a)},this.a)}}}m(){return _.Yk(_.Ec)}};var CG=class{constructor(a,b){this.j=a;this.f=a.a;this.h=void 0===b?!1:b;this.a=TF(a.a);this.g=[]}append(a){const b=a.a;b.style.visibility=_.Sc;this.f.appendChild(b);a.h||a.init(this.a);if(a.w()){a:{var c=TF(a.a);var d=hG(this,a.f),e=gG(a);const g=UF(c);let h=null,k=0;for(const l of d){for(;XF(c,this.a,l)||WF(c,this.a)&&VF(c,this.g);){d=c;var f=e;switch(l){case "+x":d.f+=f;d.g+=f;break;case "-x":d.f-=f;d.g-=f;break;case "+y":d.h+=f;d.a+=f;break;case "-y":d.h-=f,d.a-=f}}if(this.h||WF(c,this.a))break a;
18
+ d=this.a;d=Math.max(0,Math.min(c.g,d.g)-Math.max(c.f,d.f))*Math.max(0,Math.min(c.a,d.a)-Math.max(c.h,d.h))/(c.height*c.width);d>k&&(h=UF(c),k=d);c=UF(g)}c=h||g}MF({top:NF(c.h-this.a.h,_.Od),bottom:NF(this.a.a-c.a,_.Od),left:NF(c.f-this.a.f,_.Od),right:NF(this.a.g-c.g,_.Od),height:NF(c.height,_.Od),width:NF(c.width,_.Od)},a.a)}b.style.visibility="visible";this.g.push(TF(a.a))}};var DG=class extends BG{constructor(a,b,c){super(a,b,c);this.g=null;this.j=[]}init(){this.g=new CG(this);this.h=!0}m(){const a=_.Yk(_.Ec);_.Wk(a,this.o);this.id&&(a.id=this.id);return a}};var sG=class extends DG{constructor(a,b){super(a.id,"clpp-text-cue-region",b);this.f=a}init(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.on:b=b.width/100*a.width;break a;default:throw Error(DF);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.on)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(DF);d=a.height;const e=kG(this,d,a.height);MF(this.A,this.a);MF({left:NF(c,_.Od),top:NF(e,_.Od),width:NF(b,
19
+ _.Od),height:NF(d,_.Od)},this.a);this.f.writingMode&&MF({display:"flex","flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&MF({"justify-content":this.f.displayAlign},this.a);for(var f of this.f.cssClassList)_.Wk(this.a,f);a:switch(f=this.f,f.heightUnits){case 0:f=f.height;break a;case _.on:f=f.height/100*a.height;break a;case 2:f=f.height;c=new tG(new _.ln(0,1,"Lorem ipsum",_.en),{},{});b=c.a;this.a.appendChild(b);c.init(TF(this.a));c=b.getBoundingClientRect().height;this.a.removeChild(b);
20
+ b=c;f*=b;break a;default:throw Error(DF);}a=kG(this,f,a.height);MF({top:NF(a,_.Od),height:NF(f,_.Od)},this.a);this.g=new CG(this,!0);this.h=!0}ba(){return this.f.id}};var FG=class{constructor(a){this.A=new _.O("clpp.htmlcue.StyleManager");this.h=a.getSurface().getContainer();this.g=`clpp-video-${EG++}`;this.m=document.createElement(_.ge);this.o=document.createElement(_.ge);this.j=[];this.f=this.a=null;this.w=!1;a=document.styleSheets;document.head.appendChild(this.m);this.a=a[a.length-1];document.head.appendChild(this.o);this.f=a[a.length-1];this.f.disabled=!0;this.h&&_.Wk(this.h,this.g)}appendRule(a){if(this.a&&!this.j.some(b=>b===a)){const b=lG(this,a);if(mG(this,
21
+ b)){try{this.a.insertRule(b,this.a.cssRules.length)}catch(c){this.A.error(`An error occurred when adding a CSS rule: ${b}`)}this.j.push(a)}}}destroy(){const a=this;return _.v(function*(){a.w||(nG(a),document.head.removeChild(a.m),a.m=null,a.a=null,document.head.removeChild(a.o),a.o=null,a.f=null,a.h&&a.h.classList.remove(a.g));a.w=!0})}},EG=0;var GG=class extends _.Oo{constructor(a){super(a);this.N=new _.O(GF);this.l=a;this.L=oG(a);this.j=!1;this.f=[];this.A=a.getSurface().getContainer();this.D=new FG(a);this.h=new FG(a);this.a=new DG(null,"clpp-text-container",{});this.m=new _.Jo(a.getSurface(),this.V.bind(this));this.J=null;this.A?(this.A.appendChild(this.a.a),this.a.init(null)):this.N.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.w=new _.rh(()=>
22
+ {uG(this)});this.B=new Map;this.o=null}V(){uG(this,!0)}append(a,b){if(0!==a.length){for(const c of b)this.D.appendRule(c);a.sort((c,d)=>c.startTime!==d.startTime?c.startTime-d.startTime:c.endTime-d.endTime);b=this.f.findIndex(c=>c.startTime>=a[0].startTime);0===b?this.f=[]:0<b&&this.f.splice(0,b);for(const c of a)this.f.some(d=>d.payload!==c.payload?!1:d.startTime!==c.startTime?!1:d.endTime!==c.endTime?!1:!0)||this.f.push(c);this.o=null;uG(this,!1)}}g(){uG(this,!0)}destroy(){const a=this;return _.v(function*(){vG(a);
23
+ a.D&&(yield a.D.destroy(),a.D=null);a.h&&(yield a.h.destroy(),a.h=null);a.a&&(a.A.removeChild(a.a.a),a.a=null);a.m&&(a.m.stop(),a.m=null);a.w&&a.w.stop();a.j=!1})}remove(a,b){if(!this.a)return!1;this.f=this.f.filter(c=>c.startTime<a||c.endTime>=b);this.o=null;uG(this,!0);return!0}isTextVisible(){return this.j}setTextVisibility(a){this.j!==a&&((this.j=a)?(this.w.Pa(.25),this.L.enableResizeObserver&&this.m.start(),uG(this,!0)):(this.w.stop(),this.m.stop(),vG(this)))}};_.x(GF,GG);
24
+ GG.prototype.setTextVisibility=GG.prototype.setTextVisibility;GG.prototype.isTextVisible=GG.prototype.isTextVisible;GG.prototype.remove=GG.prototype.remove;GG.prototype.destroy=GG.prototype.destroy;GG.prototype.append=GG.prototype.append;var HG=class{Y(a){return!!a.enableHtmlCue&&!_.Hh()}create(a){return new GG(a)}};HG.prototype.create=HG.prototype.create;HG.prototype.isSupported=HG.prototype.Y;_.x("clpp.htmlcue.HtmlCueComponent",class extends _.ro{f(){_.ck("html",new HG)}a(){}id(){return _.he}});};f.call(g, window);
package/cl.ima.js CHANGED
@@ -1,16 +1,16 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var SE="clpp.ima.AdsManagerFactory",TE=function(a){a=a.J;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.p&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Zb?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.p&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.p&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===
2
- _.Zb&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},UE=function(a){const b=a.a,c=a.w,d=google.ima.AdEvent.Type;c.on(b,d.LOADED,a.U.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.ec.bind(a));c.on(b,d.STARTED,a.Z.bind(a));c.on(b,d.LOG,a.ua.bind(a));c.on(b,d.AD_PROGRESS,a.Sa.bind(a));c.on(b,d.AD_BUFFERING,a.ga.bind(a));c.on(b,d.FIRST_QUARTILE,a.R.bind(a));c.on(b,d.MIDPOINT,a.Qa.bind(a));c.on(b,d.THIRD_QUARTILE,a.ca.bind(a));c.on(b,d.PAUSED,
3
- a.Ra.bind(a));c.on(b,d.RESUMED,a.Ta.bind(a));c.on(b,d.CLICK,a.P.bind(a));c.on(b,d.SKIPPED,a.V.bind(a));c.on(b,d.IMPRESSION,a.S.bind(a));c.on(b,d.COMPLETE,a.ma.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.hc.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.ac.bind(a))},VE=function(a,b){const c=b?a.da.create(b.getErrorCode()):null;a.l.onError(new _.H(1,9,10003,{errorType:c},b))},WE=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new V(c,a.B,a.K)});a.l.trigger(new _.F(b,d))},XE=function(a){a.A=null;WE(a,_.Ab);
4
- a.m&&a.l.getSurface().hide(a.m)},YE=function(a){_.Xk(a.j,{visibility:"visible"})},$E=function(a){return _.v(function*(){a.I.initialize();const b=!!a.l.getConfiguration().muted;(yield a.F.canPlay(b))?ZE(a):(WE(a,_.Xb),a.L.warn(_.ia))})},aF=function(a,b){return _.v(function*(){a.I.initialize();yield b.play();ZE(a)})},ZE=function(a){a.a.init(a.j.offsetWidth,a.j.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.D=!0},bF=function(){return!window.google||!google.ima||!google.ima.AdsLoader},V=class{constructor(a,
5
- b,c){this.a=a;this.f=a.getAdPodInfo();this.h=b;this.g=c}gb(){return"Google IMA SDK"}hb(){return google.ima.VERSION}mb(){return 0}aa(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}getApiFramework(){return this.a.getApiFramework()}getAdSystem(){return this.a.getAdSystem()}getAdvertiserName(){return this.a.getAdvertiserName()}getTitle(){return this.a.getTitle()}getDuration(){return this.a.getDuration()}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}Rb(){return this.f?
6
- this.f.getIsBumper():!1}xb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.rd&&typeof b[d].clickThroughUrl===_.ee);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}jb(){return this.a.getVastMediaWidth()}ib(){return this.a.getVastMediaHeight()}Wa(){return this.a.getVastMediaBitrate()}Ja(){return this.g?2:this.h?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}yb(){return this.f?this.f.getTimeOffset():0}zb(){return this.f?this.f.getAdPosition():
7
- 1}lb(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}};V.prototype.getWrapperCreativeIds=V.prototype.getWrapperCreativeIds;V.prototype.getWrapperAdSystems=V.prototype.getWrapperAdSystems;V.prototype.getWrapperAdIds=V.prototype.getWrapperAdIds;V.prototype.getSequenceLength=V.prototype.lb;V.prototype.getPositionInSequence=V.prototype.zb;
8
- V.prototype.getPodTimeOffset=V.prototype.yb;V.prototype.getPodIndex=V.prototype.getPodIndex;V.prototype.getPodType=V.prototype.Ja;V.prototype.getMediaBitrate=V.prototype.Wa;V.prototype.getMediaHeight=V.prototype.ib;V.prototype.getMediaWidth=V.prototype.jb;V.prototype.getMediaUrl=V.prototype.getMediaUrl;V.prototype.getClickThroughUrl=V.prototype.xb;V.prototype.isBumper=V.prototype.Rb;V.prototype.getSkipTimeOffset=V.prototype.getSkipTimeOffset;V.prototype.getDuration=V.prototype.getDuration;
9
- V.prototype.getTitle=V.prototype.getTitle;V.prototype.getAdvertiserName=V.prototype.getAdvertiserName;V.prototype.getAdSystem=V.prototype.getAdSystem;V.prototype.getApiFramework=V.prototype.getApiFramework;V.prototype.getCreativeId=V.prototype.getCreativeId;V.prototype.getId=V.prototype.aa;V.prototype.getTechnology=V.prototype.mb;V.prototype.getAdManagerVersion=V.prototype.hb;V.prototype.getAdManagerName=V.prototype.gb;var cF=class{create(a){const b=google.ima.AdError.ErrorCode;switch(a){case b.VAST_LOAD_TIMEOUT:case b.VAST_MEDIA_LOAD_TIMEOUT:case b.FAILED_TO_REQUEST_ADS:return 0;case b.VIDEO_PLAY_ERROR:return 1;default:return 2}}};var dF=class{constructor(a){this.a=a}getCuePoints(){return this.a}Ab(){return 0<=this.a.indexOf(0)||0===this.a.length}Xa(){return 0<=this.a.indexOf(-1)}};dF.prototype.hasPostroll=dF.prototype.Xa;dF.prototype.hasPreroll=dF.prototype.Ab;dF.prototype.getCuePoints=dF.prototype.getCuePoints;var eF=class{constructor(a){this.l=a;this.j=a.getSurface().getMedia();a=this.l.getConfiguration();this.J=a=_.bf(a.ima||{});this.m=this.l.Nb("ima").ic();this.I=this.l.Nb("ima").g;this.o=this.l.Nb("ima").a;this.F=new _.Lo;this.L=new _.O("clpp.ima");this.h=this.a=null;this.f=new _.Hj;this.D=!1;this.w=new _.cn;this.da=new cF;this.A=null;this.H=this.C=this.K=this.B=!1;this.g=null;{a=this.w;const b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.o,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
10
- this.Ib.bind(this));a.on(this.o,b,this.Hb.bind(this));a.one(this.j,_.Nc,this.bc.bind(this))}}Ib(a){this.a=a.getAdsManager(this.j,TE(this));this.a.isCustomPlaybackUsed()?(this.L.warn("IMA plugin does not work correctly right now on platforms with single video element. Disposing."),this.l.onError(new _.H(1,9,10002)),this.dispose()):(this.h=new _.Jo(this.l.getSurface(),(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.g=new dF(a),
11
- this.l.trigger(new _.F(_.Db,{adsTimeline:this.g})),UE(this));this.f.resolve()}Hb(a){VE(this,a.getError());this.f.resolve()}ec(a){const b=this;return _.v(function*(){b.C=!0;yield b.l.pause();_.Xk(b.j,{visibility:_.Sc});WE(b,_.mb,a);b.h.start()})}U(a){a.getAd().isLinear()?WE(this,_.tb,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.l.play()))}Z(a){this.A=a.getAd().getDuration();WE(this,_.zb,a);this.l.getSurface().show(this.m)}ua(a){a=a.getAdData();VE(this,a?a.adError:null);XE(this)}Sa(a){WE(this,
12
- _.wb,a)}ga(a){WE(this,_.ob,a)}R(a){WE(this,_.rb,a)}Qa(a){WE(this,_.ub,a)}ca(a){WE(this,_.Bb,a)}Ra(a){WE(this,_.vb,a)}Ta(a){WE(this,_.xb,a)}P(a){this.pause();WE(this,_.pb,a)}V(a){WE(this,_.yb,a);XE(this)}S(a){WE(this,_.sb,a)}ma(a){WE(this,_.qb,a);XE(this)}hc(){this.B=!0;if(!this.C)return this.l.play();this.C=!1;this.h.stop();this.l.isEnded()||this.l.play();WE(this,_.nb);YE(this)}ac(){this.H=!0}bc(){this.K=!0;this.o.contentComplete()}load(){const a=this;return _.v(function*(){var b=a.l;const c=a.J;
13
- try{if(typeof c.adTagUrl!==_.ee)throw new _.H(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),a.f;b=yield a.F.canPlay(!1);const d=yield a.F.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.o.requestAds(e);return a.f})}start(a){const b=this;return _.v(function*(){b.a&&b.g&&!b.D?b.g.Ab()?yield $E(b):yield aF(b,a):yield a.play()})}resume(){this.a&&this.a.resume()}pause(){this.a&&
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var nF="clpp.ima.AdsManagerFactory",oF=function(a){a=a.J;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.p&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Zb?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.p&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.p&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===
2
+ _.Zb&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},pF=function(a){const b=a.a,c=a.w,d=google.ima.AdEvent.Type;c.on(b,d.LOADED,a.T.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.ec.bind(a));c.on(b,d.STARTED,a.W.bind(a));c.on(b,d.LOG,a.ua.bind(a));c.on(b,d.AD_PROGRESS,a.Sa.bind(a));c.on(b,d.AD_BUFFERING,a.ga.bind(a));c.on(b,d.FIRST_QUARTILE,a.R.bind(a));c.on(b,d.MIDPOINT,a.Qa.bind(a));c.on(b,d.THIRD_QUARTILE,a.aa.bind(a));c.on(b,d.PAUSED,
3
+ a.Ra.bind(a));c.on(b,d.RESUMED,a.Ta.bind(a));c.on(b,d.CLICK,a.N.bind(a));c.on(b,d.SKIPPED,a.V.bind(a));c.on(b,d.IMPRESSION,a.S.bind(a));c.on(b,d.COMPLETE,a.na.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.hc.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.Jb.bind(a))},qF=function(a,b){const c=b?a.ca.create(b.getErrorCode()):null;a.l.onError(new _.H(1,9,10003,{errorType:c},b))},rF=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new V(c,a.B,a.K)});a.l.trigger(new _.F(b,d))},sF=function(a){a.A=null;rF(a,_.Ab);
4
+ a.m&&a.l.getSurface().hide(a.m)},tF=function(a){_.Xk(a.j,{visibility:"visible"})},vF=function(a){return _.v(function*(){a.I.initialize();const b=!!a.l.getConfiguration().muted;(yield a.F.canPlay(b))?uF(a):(rF(a,_.Xb),a.L.warn(_.ia))})},wF=function(a,b){return _.v(function*(){a.I.initialize();yield b.play();uF(a)})},uF=function(a){a.a.init(a.j.offsetWidth,a.j.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.D=!0},xF=function(){return!window.google||!google.ima||!google.ima.AdsLoader},V=class{constructor(a,
5
+ b,c){this.a=a;this.f=a.getAdPodInfo();this.h=b;this.g=c}gb(){return"Google IMA SDK"}hb(){return google.ima.VERSION}mb(){return 0}ba(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}getApiFramework(){return this.a.getApiFramework()}getAdSystem(){return this.a.getAdSystem()}getAdvertiserName(){return this.a.getAdvertiserName()}getTitle(){return this.a.getTitle()}getDuration(){return this.a.getDuration()}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}Tb(){return this.f?
6
+ this.f.getIsBumper():!1}zb(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.rd&&typeof b[d].clickThroughUrl===_.ee);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}jb(){return this.a.getVastMediaWidth()}ib(){return this.a.getVastMediaHeight()}Wa(){return this.a.getVastMediaBitrate()}Ja(){return this.g?2:this.h?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Ab(){return this.f?this.f.getTimeOffset():0}Bb(){return this.f?this.f.getAdPosition():
7
+ 1}lb(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}};V.prototype.getWrapperCreativeIds=V.prototype.getWrapperCreativeIds;V.prototype.getWrapperAdSystems=V.prototype.getWrapperAdSystems;V.prototype.getWrapperAdIds=V.prototype.getWrapperAdIds;V.prototype.getSequenceLength=V.prototype.lb;V.prototype.getPositionInSequence=V.prototype.Bb;
8
+ V.prototype.getPodTimeOffset=V.prototype.Ab;V.prototype.getPodIndex=V.prototype.getPodIndex;V.prototype.getPodType=V.prototype.Ja;V.prototype.getMediaBitrate=V.prototype.Wa;V.prototype.getMediaHeight=V.prototype.ib;V.prototype.getMediaWidth=V.prototype.jb;V.prototype.getMediaUrl=V.prototype.getMediaUrl;V.prototype.getClickThroughUrl=V.prototype.zb;V.prototype.isBumper=V.prototype.Tb;V.prototype.getSkipTimeOffset=V.prototype.getSkipTimeOffset;V.prototype.getDuration=V.prototype.getDuration;
9
+ V.prototype.getTitle=V.prototype.getTitle;V.prototype.getAdvertiserName=V.prototype.getAdvertiserName;V.prototype.getAdSystem=V.prototype.getAdSystem;V.prototype.getApiFramework=V.prototype.getApiFramework;V.prototype.getCreativeId=V.prototype.getCreativeId;V.prototype.getId=V.prototype.ba;V.prototype.getTechnology=V.prototype.mb;V.prototype.getAdManagerVersion=V.prototype.hb;V.prototype.getAdManagerName=V.prototype.gb;var yF=class{create(a){const b=google.ima.AdError.ErrorCode;switch(a){case b.VAST_LOAD_TIMEOUT:case b.VAST_MEDIA_LOAD_TIMEOUT:case b.FAILED_TO_REQUEST_ADS:return 0;case b.VIDEO_PLAY_ERROR:return 1;default:return 2}}};var zF=class{constructor(a){this.a=a}getCuePoints(){return this.a}Cb(){return 0<=this.a.indexOf(0)||0===this.a.length}Xa(){return 0<=this.a.indexOf(-1)}};zF.prototype.hasPostroll=zF.prototype.Xa;zF.prototype.hasPreroll=zF.prototype.Cb;zF.prototype.getCuePoints=zF.prototype.getCuePoints;var AF=class{constructor(a){this.l=a;this.j=a.getSurface().getMedia();a=this.l.getConfiguration();this.J=a=_.bf(a.ima||{});this.m=this.l.Pb("ima").ic();this.I=this.l.Pb("ima").g;this.o=this.l.Pb("ima").a;this.F=new _.Lo;this.L=new _.O("clpp.ima");this.h=this.a=null;this.f=new _.Hj;this.D=!1;this.w=new _.cn;this.ca=new yF;this.A=null;this.H=this.C=this.K=this.B=!1;this.g=null;{a=this.w;const b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.o,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
10
+ this.wb.bind(this));a.on(this.o,b,this.vb.bind(this));a.one(this.j,_.Nc,this.Kb.bind(this))}}wb(a){this.a=a.getAdsManager(this.j,oF(this));this.a.isCustomPlaybackUsed()?(this.L.warn("IMA plugin does not work correctly right now on platforms with single video element. Disposing."),this.l.onError(new _.H(1,9,10002)),this.dispose()):(this.h=new _.Jo(this.l.getSurface(),(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.g=new zF(a),
11
+ this.l.trigger(new _.F(_.Db,{adsTimeline:this.g})),pF(this));this.f.resolve()}vb(a){qF(this,a.getError());this.f.resolve()}ec(a){const b=this;return _.v(function*(){b.C=!0;yield b.l.pause();_.Xk(b.j,{visibility:_.Sc});rF(b,_.mb,a);b.h.start()})}T(a){a.getAd().isLinear()?rF(this,_.tb,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.l.play()))}W(a){this.A=a.getAd().getDuration();rF(this,_.zb,a);this.l.getSurface().show(this.m)}ua(a){a=a.getAdData();qF(this,a?a.adError:null);sF(this)}Sa(a){rF(this,
12
+ _.wb,a)}ga(a){rF(this,_.ob,a)}R(a){rF(this,_.rb,a)}Qa(a){rF(this,_.ub,a)}aa(a){rF(this,_.Bb,a)}Ra(a){rF(this,_.vb,a)}Ta(a){rF(this,_.xb,a)}N(a){this.pause();rF(this,_.pb,a)}V(a){rF(this,_.yb,a);sF(this)}S(a){rF(this,_.sb,a)}na(a){rF(this,_.qb,a);sF(this)}hc(){this.B=!0;if(!this.C)return this.l.play();this.C=!1;this.h.stop();this.l.isEnded()||this.l.play();rF(this,_.nb);tF(this)}Jb(){this.H=!0}Kb(){this.K=!0;this.o.contentComplete()}load(){const a=this;return _.v(function*(){var b=a.l;const c=a.J;
13
+ try{if(typeof c.adTagUrl!==_.ee)throw new _.H(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),a.f;b=yield a.F.canPlay(!1);const d=yield a.F.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.o.requestAds(e);return a.f})}start(a){const b=this;return _.v(function*(){b.a&&b.g&&!b.D?b.g.Cb()?yield vF(b):yield wF(b,a):yield a.play()})}resume(){this.a&&this.a.resume()}pause(){this.a&&
14
14
  this.a.pause()}skip(){this.a&&this.a.skip()}getVolume(){return this.a?this.a.getVolume():1}setVolume(a){this.a&&this.a.setVolume(a)}getPosition(){if(!this.a||null===this.A)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.A-a}dispose(){return(new Promise(a=>{this.D&&this.g&&this.g.Xa()&&!this.H?(this.w.one(this.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{a();this.m&&this.l.getSurface().hide(this.m)}),_.Ef(this.w,this.a,[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED],
15
- ()=>{this.a&&this.a.discardAdBreak()})):a();this.a.discardAdBreak();this.o.contentComplete()})).then(()=>{YE(this);this.w.release();this.h&&(this.h.stop(),this.h=null);this.a&&(this.a.destroy(),this.a=null)})}};eF.prototype.getPosition=eF.prototype.getPosition;eF.prototype.setVolume=eF.prototype.setVolume;eF.prototype.getVolume=eF.prototype.getVolume;eF.prototype.skip=eF.prototype.skip;eF.prototype.pause=eF.prototype.pause;eF.prototype.resume=eF.prototype.resume;var fF=class extends _.Uo{constructor(){super();this.a=this.g=this.f=null}onPlayerCreated(a){if(bF())return a.onError(new _.H(1,9,1E4));this.f=_.Vk(_.Ec,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.g=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.g);this.a.getSettings().setPlayerType(_.la);this.a.getSettings().setPlayerVersion(_.da);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
16
- (this.a.destroy(),this.a=null);this.g&&(this.g.destroy(),this.g=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Xe(){return this.a}Ve(){return this.g}ic(){return this.f}id(){return"ima"}};_.x("clpp.ima.ImaPlugin",fF);fF.prototype.getAdContainer=fF.prototype.ic;fF.prototype.getAdDisplayContainer=fF.prototype.Ve;fF.prototype.getAdsLoader=fF.prototype.Xe;fF.Id="ima";fF.isSdkMissing=bF;_.Cl(new class{create(){return new fF}});var gF=class{constructor(){this.a=new _.O(SE)}name(){return SE}X(a,b){return a.namespace()===_.pc?!1:bF()?(this.a.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new eF(a)}};gF.prototype.create=gF.prototype.create;gF.prototype.isSupported=gF.prototype.X;gF.prototype.name=gF.prototype.name;_.Sk(new gF);};f.call(g, window);
15
+ ()=>{this.a&&this.a.discardAdBreak()})):a();this.a.discardAdBreak();this.o.contentComplete()})).then(()=>{tF(this);this.w.release();this.h&&(this.h.stop(),this.h=null);this.a&&(this.a.destroy(),this.a=null)})}};AF.prototype.getPosition=AF.prototype.getPosition;AF.prototype.setVolume=AF.prototype.setVolume;AF.prototype.getVolume=AF.prototype.getVolume;AF.prototype.skip=AF.prototype.skip;AF.prototype.pause=AF.prototype.pause;AF.prototype.resume=AF.prototype.resume;var BF=class extends _.So{constructor(){super();this.a=this.g=this.f=null}onPlayerCreated(a){if(xF())return a.onError(new _.H(1,9,1E4));this.f=_.Vk(_.Ec,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.g=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.g);this.a.getSettings().setPlayerType(_.la);this.a.getSettings().setPlayerVersion(_.da);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
16
+ (this.a.destroy(),this.a=null);this.g&&(this.g.destroy(),this.g=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}af(){return this.a}Ze(){return this.g}ic(){return this.f}id(){return"ima"}};_.x("clpp.ima.ImaPlugin",BF);BF.prototype.getAdContainer=BF.prototype.ic;BF.prototype.getAdDisplayContainer=BF.prototype.Ze;BF.prototype.getAdsLoader=BF.prototype.af;BF.Id="ima";BF.isSdkMissing=xF;_.Cl(new class{create(){return new BF}});var CF=class{constructor(){this.a=new _.O(nF)}name(){return nF}Y(a,b){return a.namespace()===_.pc?!1:xF()?(this.a.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new AF(a)}};CF.prototype.create=CF.prototype.create;CF.prototype.isSupported=CF.prototype.Y;CF.prototype.name=CF.prototype.name;_.Sk(new CF);};f.call(g, window);