@castlabs/prestoplay 6.30.0 → 6.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +247 -179
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +19 -7
  5. package/cjs/cl.cast.js +120 -120
  6. package/cjs/cl.conviva.js +31 -31
  7. package/cjs/cl.core.js +567 -566
  8. package/cjs/cl.crypto.js +10 -10
  9. package/cjs/cl.dash.js +95 -92
  10. package/cjs/cl.externs.js +224 -40
  11. package/cjs/cl.freewheel.js +26 -25
  12. package/cjs/cl.hls.js +79 -78
  13. package/cjs/cl.hlssmpte.js +4 -4
  14. package/cjs/cl.htmlcue.js +19 -19
  15. package/cjs/cl.ima.js +26 -25
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +352 -350
  18. package/cjs/cl.muxdata.js +13 -13
  19. package/cjs/cl.onboard.js +2 -2
  20. package/cjs/cl.persistent.js +13 -13
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +10 -10
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +16 -16
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +15 -15
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +11 -11
  29. package/cjs/cl.vr.js +12 -12
  30. package/cjs/cl.vtt.js +12 -12
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +35 -35
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +14 -6
  36. package/cl.cast.js +99 -98
  37. package/cl.conviva.js +26 -26
  38. package/cl.core.js +413 -412
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +87 -84
  41. package/cl.externs.js +225 -37
  42. package/cl.freewheel.js +20 -19
  43. package/cl.hls.js +76 -76
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +20 -19
  47. package/cl.mediatailor.js +2 -2
  48. package/cl.mse.js +299 -300
  49. package/cl.muxdata.js +12 -12
  50. package/cl.onboard.js +4 -4
  51. package/cl.persistent.js +10 -10
  52. package/cl.playlist.js +5 -5
  53. package/cl.simid.js +14 -14
  54. package/cl.smooth.js +62 -60
  55. package/cl.thumbnails.js +17 -17
  56. package/cl.tizen.js +55 -55
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +15 -15
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +31 -31
  64. package/package.json +8 -7
  65. package/typings.d.ts +85 -61
@@ -1,29 +1,30 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var uU="clpp-freewheel",vU="clpp.freewheel.AdsManagerFactory",wU="freewheel",xU=function(){this.f=this.a=null},yU=function(){},zU=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""}},AU=function(a,b,c){this.h=a;this.f=b;this.a=c},BU=function(a){this.a=a},CU=function(a){this.g=new _.L("clpp.freewheel.AdsManager");this.m=a;this.h=new _.wi;this.w=new tv.freewheel.SDK.AdManager;
3
- this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.om;this.j=null},DU=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.lg&&b.push("serverUrl");typeof a.profileId!==_.lg&&b.push("profileId");typeof a.videoAssetId!==_.lg&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.O(1,9,12001,{missingKeys:b.join(", ")});},EU=function(){var a,b,c,d;return _.I(function(e){if(1==e.a)return a=new _.qv,b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,
4
- _.x(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.x(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},FU=function(a){var b=a.m.ke(wU).sd();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(uU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},GU=function(a){var b=a.m.ke(wU).sd();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},
5
- HU=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 AU(a.a,c,d)});a.m.trigger(new _.Q(b,d))},IU=function(){this.Ea=new _.L(vU)};_.w(xU,_.Zv);_.r=xU.prototype;_.r.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Yi(_.Xd,{id:uU}),this.f=_.Yi(_.Sg,{"class":_.sd}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.O(1,9,12E3))};
6
- _.r.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.r.id=function(){return wU};_.r.sd=function(){return this.a};_.r.im=function(){return this.f};_.K("clpp.freewheel.FreeWheelPlugin",xU);xU.prototype.getAdVideo=xU.prototype.im;xU.prototype.getAdContainer=xU.prototype.sd;xU.Id=wU;xU.AD_CONTAINER_ID=uU;yU.prototype.create=function(){return new xU};_.r=AU.prototype;_.r.wb=function(){return"FreeWheel AdManager SDK"};_.r.xb=function(){return tv.freewheel.SDK.version};_.r.Cb=function(){return 0};_.r.getId=function(){return this.a?this.a.getAdId():""};_.r.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.lg?a:""};_.r.ac=function(){return""};_.r.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.r.getAdSystem=function(){return""};_.r.getAdvertiserName=function(){return""};
7
- _.r.getTitle=function(){return""};_.r.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.r.getPosition=function(){return 0};_.r.getSkipTimeOffset=function(){return 0};_.r.fc=function(){return!1};_.r.yb=function(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""};_.r.getMediaUrl=function(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""};
8
- _.r.nb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.lb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.Ya=function(){return 0};_.r.Za=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
9
- _.r.getPodIndex=function(){switch(this.Za()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.r.Pb=function(){switch(this.Za()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.r.Ab=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.r.ob=function(){return this.f.getAdCount()};_.r.getWrapperAdIds=function(){return[]};_.r.canSeek=function(){return!1};
10
- _.r.getWrapperAdSystems=function(){return[]};_.r.getWrapperCreativeIds=function(){return[]};_.r.dc=function(){return null};AU.prototype.getVideoElement=AU.prototype.dc;AU.prototype.getWrapperCreativeIds=AU.prototype.getWrapperCreativeIds;AU.prototype.getWrapperAdSystems=AU.prototype.getWrapperAdSystems;AU.prototype.canSeek=AU.prototype.canSeek;AU.prototype.getWrapperAdIds=AU.prototype.getWrapperAdIds;AU.prototype.getSequenceLength=AU.prototype.ob;AU.prototype.getPositionInSequence=AU.prototype.Ab;
11
- AU.prototype.getPodTimeOffset=AU.prototype.Pb;AU.prototype.getPodIndex=AU.prototype.getPodIndex;AU.prototype.getPodType=AU.prototype.Za;AU.prototype.getMediaBitrate=AU.prototype.Ya;AU.prototype.getMediaHeight=AU.prototype.lb;AU.prototype.getMediaWidth=AU.prototype.nb;AU.prototype.getMediaUrl=AU.prototype.getMediaUrl;AU.prototype.getClickThroughUrl=AU.prototype.yb;AU.prototype.isBumper=AU.prototype.fc;AU.prototype.getSkipTimeOffset=AU.prototype.getSkipTimeOffset;AU.prototype.getPosition=AU.prototype.getPosition;
12
- AU.prototype.getDuration=AU.prototype.getDuration;AU.prototype.getTitle=AU.prototype.getTitle;AU.prototype.getAdvertiserName=AU.prototype.getAdvertiserName;AU.prototype.getAdSystem=AU.prototype.getAdSystem;AU.prototype.getApiFramework=AU.prototype.getApiFramework;AU.prototype.getSourceId=AU.prototype.ac;AU.prototype.getCreativeId=AU.prototype.getCreativeId;AU.prototype.getId=AU.prototype.getId;AU.prototype.getTechnology=AU.prototype.Cb;AU.prototype.getAdManagerVersion=AU.prototype.xb;
13
- AU.prototype.getAdManagerName=AU.prototype.wb;BU.prototype.getCuePoints=function(){return this.a.getTemporalSlots().map(function(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()}})};BU.prototype.Sb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};BU.prototype.Rb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
14
- BU.prototype.hasPostroll=BU.prototype.Rb;BU.prototype.hasPreroll=BU.prototype.Sb;BU.prototype.getCuePoints=BU.prototype.getCuePoints;_.r=CU.prototype;
15
- _.r.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{DU(b)}catch(n){return a.m.onError(n),a.l.resolve(),m["return"](a.l)}a.w.setNetwork(b.networkId);a.w.setServer(b.serverUrl);a.a=a.w.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.lg&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.x(m,EU(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
16
- _.v(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,zU(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.$e&&Object.keys(b.keyValues).forEach(function(n){return a.a.addKeyValue(n,b.keyValues[n])});a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(g=_.v(b.parameters),h=g.next();!h.done;h=
17
- g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.Tn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.Yn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.Xn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.ln.bind(a));a.h.on(a.m,_.zg,a.cl.bind(a));a.h.on(a.m,_.ig,a.al.bind(a));a.a.submitRequest();return m["return"](a.l)})};
18
- _.r.Cd=function(){if(this.B.length){FU(this);this.f=this.B.shift();this.f.play();var a=!1}else GU(this),a=!0;return a};_.r.md=function(){};_.r.resume=function(){this.f&&this.f.resume()};_.r.pause=function(){this.f&&this.f.pause()};_.r.skip=function(){this.f&&this.f.skipCurrentAd()};_.r.getVolume=function(){return this.a?this.a.getAdVolume():1};_.r.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.r.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.r.jd=function(){return!0};
19
- _.r.Ic=function(){var a=this;return _.I(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);GU(a);a.a&&(a.a.dispose(),a.a=null);_.z(b)})};
20
- _.r.Tn=function(a){var b=this;if(a.success)this.B=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.o=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.Q(_.Fc,{adsTimeline:new BU(this.a)})),this.j=new _.ov(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.ke(wU).f);else this.m.onError(new _.O(1,9,10003,{errorType:0},
21
- void 0));this.l.resolve()};_.r.Yn=function(a){HU(this,_.jc,a);this.j.start()};_.r.Xn=function(a){this.f=null;a=a.slot;HU(this,_.kc);this.j.stop();GU(this);a&&a.getTimePositionClass()===tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL||this.m.play()};
22
- _.r.ln=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:HU(this,_.Bc,a);HU(this,_.uc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:HU(this,_.Cc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:HU(this,_.oc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:HU(this,_.wc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:HU(this,_.Dc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:HU(this,_.nc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:HU(this,
23
- _.mc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:HU(this,_.xc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:HU(this,_.zc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:HU(this,_.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:HU(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:HU(this,_.yc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.O(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],
24
- fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.r.cl=function(){var a=this;if(!this.f){var b=this.m.getPosition();if(this.f=this.o.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.o.findIndex(function(d){return d===a.f});this.o.splice(c,1);this.m.pause();FU(this);this.f.play()}}};
25
- _.r.al=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case 3:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case 4:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 5:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);this.A.length?(FU(this),this.f=this.A.shift(),this.f.play()):GU(this);break;case _.eu:case _.Co:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};CU.prototype.getPosition=CU.prototype.getPosition;
26
- CU.prototype.setVolume=CU.prototype.setVolume;CU.prototype.getVolume=CU.prototype.getVolume;CU.prototype.skip=CU.prototype.skip;CU.prototype.pause=CU.prototype.pause;CU.prototype.resume=CU.prototype.resume;IU.prototype.name=function(){return vU};IU.prototype.a=function(a,b){return a.namespace()!==_.xd&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Ea.warn("FreeWheel SDK is not loaded."),!1):!1};IU.prototype.create=function(a){return new CU(a)};_.ei(new IU);_.bp(new yU);};
2
+ var f=function(window){var uU="clpp-freewheel",vU="clpp.freewheel.AdsManagerFactory",wU="freewheel",xU=function(){this.f=this.a=null},yU=function(){},zU=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""}},AU=function(a,b,c){this.h=a;this.f=b;this.a=c},BU=function(a){this.a=a},CU=function(a){this.g=new _.M("clpp.freewheel.AdsManager");this.m=a;this.h=new _.wi;this.G=new tv.freewheel.SDK.AdManager;
3
+ this.f=this.a=null;this.I=[];this.B=[];this.H=[];this.A=new _.nm;this.j=null;this.l=!1;this.w=1;this.D=!1;this.o=!0},DU=function(a){var b=[];typeof a.networkId!==_.h&&b.push("networkId");typeof a.serverUrl!==_.lg&&b.push("serverUrl");typeof a.profileId!==_.lg&&b.push("profileId");typeof a.videoAssetId!==_.lg&&typeof a.videoAssetId!==_.h&&b.push("videoAssetId");if(b.length)throw new _.O(1,9,12001,{missingKeys:b.join(", ")});},EU=function(){var a,b,c,d;return _.I(function(e){if(1==e.a)return a=new _.pv,
4
+ b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,_.x(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.x(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},FU=function(a){var b=a.m.oe(wU).xd();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(uU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},GU=function(a){var b=a.m.oe(wU).xd();
5
+ b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},HU=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 AU(a.a,c,d)});a.m.trigger(new _.Q(b,d))},IU=function(){this.Fa=new _.M(vU)};_.w(xU,_.Yv);_.r=xU.prototype;
6
+ _.r.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Yi(_.Xd,{id:uU}),this.f=_.Yi(_.Sg,{"class":_.sd}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.O(1,9,12E3))};_.r.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.r.id=function(){return wU};_.r.xd=function(){return this.a};_.r.km=function(){return this.f};
7
+ _.K("clpp.freewheel.FreeWheelPlugin",xU);xU.prototype.getAdVideo=xU.prototype.km;xU.prototype.getAdContainer=xU.prototype.xd;xU.Id=wU;xU.AD_CONTAINER_ID=uU;yU.prototype.create=function(){return new xU};_.r=AU.prototype;_.r.jb=function(){return"FreeWheel AdManager SDK"};_.r.kb=function(){return tv.freewheel.SDK.version};_.r.nb=function(){return 0};_.r.getId=function(){return this.a?this.a.getAdId():""};_.r.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.lg?a:""};_.r.Hb=function(){return""};_.r.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.r.getAdSystem=function(){return""};_.r.getAdvertiserName=function(){return""};
8
+ _.r.getTitle=function(){return""};_.r.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.r.getPosition=function(){return 0};_.r.getSkipTimeOffset=function(){return 0};_.r.Jb=function(){return!1};_.r.$a=function(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""};_.r.getMediaUrl=function(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""};
9
+ _.r.eb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.cb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.Ga=function(){return 0};_.r.Ha=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
10
+ _.r.getPodIndex=function(){switch(this.Ha()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.r.yb=function(){switch(this.Ha()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.r.lb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.r.fb=function(){return this.f.getAdCount()};_.r.getWrapperAdIds=function(){return[]};_.r.canSeek=function(){return!1};
11
+ _.r.getWrapperAdSystems=function(){return[]};_.r.getWrapperCreativeIds=function(){return[]};_.r.Ib=function(){return null};AU.prototype.getVideoElement=AU.prototype.Ib;AU.prototype.getWrapperCreativeIds=AU.prototype.getWrapperCreativeIds;AU.prototype.getWrapperAdSystems=AU.prototype.getWrapperAdSystems;AU.prototype.canSeek=AU.prototype.canSeek;AU.prototype.getWrapperAdIds=AU.prototype.getWrapperAdIds;AU.prototype.getSequenceLength=AU.prototype.fb;AU.prototype.getPositionInSequence=AU.prototype.lb;
12
+ AU.prototype.getPodTimeOffset=AU.prototype.yb;AU.prototype.getPodIndex=AU.prototype.getPodIndex;AU.prototype.getPodType=AU.prototype.Ha;AU.prototype.getMediaBitrate=AU.prototype.Ga;AU.prototype.getMediaHeight=AU.prototype.cb;AU.prototype.getMediaWidth=AU.prototype.eb;AU.prototype.getMediaUrl=AU.prototype.getMediaUrl;AU.prototype.getClickThroughUrl=AU.prototype.$a;AU.prototype.isBumper=AU.prototype.Jb;AU.prototype.getSkipTimeOffset=AU.prototype.getSkipTimeOffset;AU.prototype.getPosition=AU.prototype.getPosition;
13
+ AU.prototype.getDuration=AU.prototype.getDuration;AU.prototype.getTitle=AU.prototype.getTitle;AU.prototype.getAdvertiserName=AU.prototype.getAdvertiserName;AU.prototype.getAdSystem=AU.prototype.getAdSystem;AU.prototype.getApiFramework=AU.prototype.getApiFramework;AU.prototype.getSourceId=AU.prototype.Hb;AU.prototype.getCreativeId=AU.prototype.getCreativeId;AU.prototype.getId=AU.prototype.getId;AU.prototype.getTechnology=AU.prototype.nb;AU.prototype.getAdManagerVersion=AU.prototype.kb;
14
+ AU.prototype.getAdManagerName=AU.prototype.jb;BU.prototype.getCuePoints=function(){return this.a.getTemporalSlots().map(function(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()}})};BU.prototype.Yb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};BU.prototype.Xb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
15
+ BU.prototype.hasPostroll=BU.prototype.Xb;BU.prototype.hasPreroll=BU.prototype.Yb;BU.prototype.getCuePoints=BU.prototype.getCuePoints;_.r=CU.prototype;
16
+ _.r.load=function(){var a=this,b,c,d,e,f,g,k,l;return _.I(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{DU(b)}catch(n){return a.m.onError(n),a.A.resolve(),m["return"](a.A)}a.G.setNetwork(b.networkId);a.G.setServer(b.serverUrl);a.a=a.G.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.lg&&typeof b.siteSectionId!==_.h||a.a.setSiteSection(b.siteSectionId);return _.x(m,EU(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
17
+ _.v(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,zU(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.$e&&Object.keys(b.keyValues).forEach(function(n){return a.a.addKeyValue(n,b.keyValues[n])});a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(g=_.v(b.parameters),k=g.next();!k.done;k=
18
+ g.next())l=k.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.Wn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.ao.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.$n.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.nn.bind(a));a.h.on(a.m,_.zg,a.fl.bind(a));a.h.on(a.m,_.ig,a.el.bind(a));a.a.submitRequest();return m["return"](a.A)})};
19
+ _.r.Ab=function(){if(this.I.length){FU(this);this.f=this.I.shift();this.f.play();var a=!1}else this.f?(this.f.resume(),a=!1):(GU(this),a=!0);return a};_.r.Nc=function(){};_.r.pb=function(){this.f&&this.f.pause()};_.r.skip=function(){this.f&&this.f.skipCurrentAd()};_.r.getAdVolume=function(){return!this.a||this.l?this.w:this.a.getAdVolume()};_.r.Oa=function(a){this.w=a;this.l||this.a&&this.a.setAdVolume(a)};_.r.setMuted=function(a){this.l=a;this.a&&(a?this.a.setAdVolume(0):this.a.setAdVolume(this.w))};
20
+ _.r.isMuted=function(){return this.l};_.r.jc=function(){return this.D};_.r.isPaused=function(){return this.o};_.r.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.r.setVolume=function(a){this.Oa(a)};_.r.getVolume=function(){return this.getAdVolume()};_.r.pause=function(){this.pb()};_.r.resume=function(){this.Ab()};_.r.Kc=function(){return!0};_.r.xc=function(){var a=this;return _.I(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);GU(a);a.a&&(a.a.dispose(),a.a=null);_.A(b)})};
21
+ _.r.Wn=function(a){var b=this;if(a.success)this.I=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.B=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.H=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.Q(_.Fc,{adsTimeline:new BU(this.a)})),this.j=new _.nv(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.oe(wU).f);else this.m.onError(new _.O(1,9,10003,{errorType:0},
22
+ void 0));this.A.resolve()};_.r.ao=function(a){HU(this,_.jc,a);this.j.start()};_.r.$n=function(a){this.f=null;a=a.slot;HU(this,_.kc);this.j.stop();GU(this);a&&a.getTimePositionClass()===tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL||this.m.play()};
23
+ _.r.nn=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:this.setMuted(this.l);this.Oa(this.w);this.D=!0;this.o=!1;HU(this,_.Bc,a);HU(this,_.sc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:HU(this,_.Cc,a);this.o=this.D=!1;break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:HU(this,_.oc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:HU(this,_.wc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:HU(this,_.Dc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:HU(this,
24
+ _.nc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:HU(this,_.mc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:this.o=!0;HU(this,_.xc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:this.o=!1;HU(this,_.zc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:HU(this,_.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:HU(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:HU(this,_.yc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.O(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],
25
+ fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.r.fl=function(){var a=this;if(!this.f){var b=this.m.getPosition();if(this.f=this.B.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.B.findIndex(function(d){return d===a.f});this.B.splice(c,1);this.m.pause();FU(this);this.f.play()}}};
26
+ _.r.el=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case 3:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case 4:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 5:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);this.H.length?(FU(this),this.f=this.H.shift(),this.f.play()):GU(this);break;case _.du:case _.Bo:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};CU.prototype.resume=CU.prototype.resume;CU.prototype.pause=CU.prototype.pause;
27
+ CU.prototype.getVolume=CU.prototype.getVolume;CU.prototype.setVolume=CU.prototype.setVolume;CU.prototype.getPosition=CU.prototype.getPosition;CU.prototype.skip=CU.prototype.skip;IU.prototype.name=function(){return vU};IU.prototype.a=function(a,b){return a.namespace()!==_.xd&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Fa.warn("FreeWheel SDK is not loaded."),!1):!1};IU.prototype.create=function(a){return new CU(a)};_.ei(new IU);_.bp(new yU);};
27
28
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
28
29
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
29
30
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.hls.js CHANGED
@@ -1,82 +1,83 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var bK="Could not parse MP4 segment start time.",cK="EXT-X-DATERANGE",dK="EXT-X-DISCONTINUITY",eK="EXT-X-KEY",fK="EXT-X-MAP",gK="EXT-X-MEDIA-SEQUENCE",hK="EXT-X-PROGRAM-DATE-TIME",iK="Failed to infer discontinuity number",jK="Guessing audio-only",kK="METHOD",lK="SAMPLE-AES-CTR",mK="Setting playlist start time to ",nK="_HLS_part",oK="application/vnd.apple.mpegurl",pK="manifestloaded",qK="sample",rK=function(a){if(1>a.a)throw _.gq();--a.a},sK=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},
3
- function(c,d){return d+b})},tK=function(a,b){b=void 0===b?0:b;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+8]&&128>a[b+9]?!0:!1},uK=function(a){a=_.Bn(a)||"";return null!=_.Np.video[a]?_.Sg:null!=_.Np.audio[a]?_.Sc:null},vK=function(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.O(_.P,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.O(_.P,4,4043,"Media playlist must have at least one full segment!");
4
- }this.a=a;this.verbatimUri="";this.type=b;this.Y=c;this.S=1===b?d:null},wK=function(a,b,c){c=void 0===c?[]:c;this.Y=b;this.a=a;this.f=c;this.sa=-1},xK=function(a){return a.some(function(b){return b.startsWith("#EXT-X-TARGETDURATION")})?1:0},yK=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,function(c,d){var e=b.get(d);if(null==e)throw new _.O(_.P,4,4044,"Undefined variable '"+d+"'");return e})},zK=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=yK(d.value,b)})})},
5
- AK=function(a,b){var c=new Map,d=new URL(b);a.forEach(function(e){var f=_.T(e,_.gb),g=_.T(e,"QUERYPARAM");if(f)g=_.Qp(e,"VALUE"),c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.O(_.P,4,4044,"Query param '"+g+"' missing in playlist URI.");if(!f)throw new _.O(_.P,4,4044,"Query param '"+g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},BK=function(){this.h=0;this.a=new Map},EK=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&
6
- !_.Y.Km(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.O(_.P,4,4015);b=b.slice(1);return 0===xK(b)?CK(a,b,c):DK(a,b,c)},DK=function(a,b,c){var d=FK(b);b=d.Fo;var e=d.Dm,f=GK(a,d.kp,c);d=e.map(function(g){return HK(a,g,f)});b=IK(a,c,b,f);return new vK(c,1,d,b)},FK=function(a){var b=[],c=[],d=[];a=_.v(a);for(var e=a.next();!e.done;e=a.next())e=e.value,JK.test(e)?d.push(e):KK.test(e)?c.push(e):b.push(e);return{Fo:b,Dm:c,kp:d}},CK=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=HK(a,b[e]);
7
- d.push(f);if(f.name===_.Ma){var g=b[e+1];if(!g)throw new _.O(_.P,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.Rp(_.Mb,g));e++}}b=_.Y.sc(d,"EXT-X-DEFINE");_.Y.Qj(b);b=AK(b,c);a.a=b;zK(d,a.a);return new vK(c,0,d)},LK=function(a,b,c){var d=[],e=[];e.push(new _.Rp(_.pa,"0"));e.push(new _.Rp(_.Mb,b));c.length&&e.push(new _.Rp(_.ua,c));d.push(new _.Pp(a.h++,_.Ma,e));return new vK(b,0,d)},IK=function(a,b,c,d){var e=[],f=[],g=[];c.forEach(function(h){_.Y.Qm(h)?(h=HK(a,h,d),
8
- "EXT-X-PART"===h.name||"EXT-X-PRELOAD-HINT"===h.name&&"PART"===_.T(h,_.Kb)?g.push(h):f.push(h)):(_.Y.Nc(f,"EXT-X-GAP")||(h=yK(h,d),h=_.An(h,b),e.push(new wK(h,f,g))),f=[],g=[])});0<g.length&&e.push(new wK(null,f,g));return e},HK=function(a,b,c){a=_.Ys(a.h++,b);c&&zK([a],c);return a},GK=function(a,b,c){b=b.map(function(e){return HK(a,e)});_.Y.Qj(b);var d=AK(b,c);b.map(function(e){return _.T(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.O(_.P,4,4044,"Cannot import variable '"+
9
- e+"' as it is not defined in the master playlist");d.set(e,f)});return d},MK=function(){this.a=new Map;this.f=new Map},NK=function(a){function b(l,m,n){for(var p="";m<n;m++)p+="%"+("00"+l[m].toString(16)).slice(-2);return p}function c(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.O(_.P,4,4030);}tK(a)||d();var 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,
10
- e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===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}}tK(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},OK=function(a){for(;a.getPosition()<a.Xa()-1;){var b=a.getPosition();if(71===_.hq(a))return rK(a),b}return-1},PK=function(a){function b(){d.seek(e+188);f=_.hq(d);71!==f&&(d.seek(e+192),f=_.hq(d));71!==f&&(d.seek(e+
11
- 204),f=_.hq(d));71!==f&&c();rK(d)}function c(){throw new _.O(_.P,4,4030);}var d=new _.eq(new DataView(a),!1),e=0,f=0;e=OK(d);0>e&&(_.Fw.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.hq(d),71!==f&&c(),a=_.iq(d),8191===(a&8191))b();else if(a&16384)if(a=(_.hq(d)&48)>>4,0!==a&&2!==a||c(),3===a&&(a=_.hq(d),d.skip(a)),1!==_.jq(d)>>8)b();else{d.skip(3);a=_.hq(d)>>6;0!==a&&1!==a||c();0===_.hq(d)&&c();a=_.hq(d);var g=_.iq(d),h=_.iq(d);return(1073741824*((a&14)>>
12
- 1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},QK=function(a,b){var c=null,d=0;try{(new _.oq).M(_.We,_.pq).M(_.Bg,_.pq).M(_.Re,_.pq).ba("mdhd",function(g){g.reader.skip(0===g.version?8:16);d=_.jq(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.Fw.error("Unable to find timescale in init segment!"),new _.O(_.P,4,4030,bK,c);var e=0,f=!1;try{(new _.oq).M("moof",_.pq).M("traf",_.pq).ba("tfdt",function(g){var h=d;if(0===g.version)h=_.jq(g.reader)/h;else{var l=_.jq(g.reader),m=_.jq(g.reader);
13
- if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.O(_.P,4,4030,bK,c);return e},TK=function(a){var b=_.Qp(a,kK);if(!RK.includes(b))return SK.error("PlayReady in HLS is only supported with [",RK.join(", "),"], not",b),null;a=_.Qp(a,_.Mb);b=_.Rm(a);a=null;b=_.Qi(b.data);try{a=_.kC(_.Qr(b))}catch(c){a=b}return _.xC(_.Kd,
14
- [{initDataType:_.ld,initData:a}],"")},UK=function(a){this.g=new _.L("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Wk()}},WK=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,t;return _.I(function(u){switch(u.a){case 1:a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.Vc||d===_.Uc)return u["return"](0);g=f;if(d!==_.Tc){u.C(2);break}return _.x(u,VK(a,c,g),3);case 3:h=u.f;l=_.Qi(h.data);if(!tK(l))throw new _.O(_.P,4,4030,"AAC segment does not contain an ID3 tag.");return u["return"](NK(l));
15
- case 2:if(d!==_.Ug&&d!==_.Wc){u.C(4);break}m=[VK(a,c,g)];b&&m.push(VK(a,b,!0));return _.x(u,Promise.all(m),5);case 5:return n=u.f,p=n[0],q=n[1]||n[0],u["return"](QK(p.data,q.data));case 4:if(d!==_.Tg){u.C(6);break}return _.x(u,VK(a,c,g),7);case 7:return t=u.f,u["return"](PK(t.data));case 6:if(!_.Yu((d.split("/")[0]||"")+'/mp4;codecs\x3d"'+e+'"'))return u["return"](0);throw new _.O(_.P,4,4030);}})},VK=function(a,b,c){var d,e,f,g,h,l,m;return _.I(function(n){switch(n.a){case 1:return d=b.f(),e=_.fD(b.La(),
16
- b.la,b.la+2048-1,a.a.attemptParameters),e.type=2,f=_.fD(b.La(),b.la,b.ga,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.F(n,2),g=c?f:e,_.x(n,a.f(g),4);case 4:return h=n.f,n["return"](h);case 2:l=_.H(n);if(7001===l.code||c)throw l;a.g.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 pre-flights.",e.uris[0]);_.F(n,5);return _.x(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.H(n),
17
- a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.O(_.P,4,4030,"Failed to fetch the media segment.");}})},XK=function(a){this.streams=a},YK=function(a,b){a.streams.forEach(function(c){c.fg=b})},ZK=function(a,b){a.streams.forEach(function(c){c.width=b})},$K=function(a,b){a.streams.forEach(function(c){c.height=b})},aL=function(a,b){a.streams.forEach(function(c){c.frameRate=b})},bL=function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},cL=function(a,b){var c=
18
- a.streams.find(function(d){d=d.S;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.S.find(function(d){return d.position===b})||null},dL=function(a,b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},eL=function(a){this.a=a},fL=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},gL=function(a,b){var c=new Set(a.map(function(d){return d.sa}));return b.filter(function(d){return!c.has(d.sa)})},
19
- iL=function(a,b){for(;a[0].sa<b[0].sa;)a.splice(0,1);var c=a[0],d=b[0];c.startTime===d.startTime&&c.endTime===d.endTime||hL(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&(c.startTime!==d.startTime||c.endTime!==d.endTime)&&hL(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},nL=function(a,b,c,d,e){var f=b[0].length();f=sK(f).map(function(g){var h=fL(b,g)||[],l=dL(c,g)||[];g=dL(d,g)||[];var m=_.ph(jL(h)).concat(_.ph(l),_.ph(g)).filter(Boolean);kL(m);var n=m[0];m=n.sa;n=n.duration;return{configurationId:a,variants:h,
20
- textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,sa:m}});e&&lL(f[0]);mL(f);return f},jL=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},lL=function(a){var b=jL(a.variants)[0].S[0].Ha;a.startTime+=b;a.endTime+=b},mL=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},hL=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=
21
- b.duration;oL(a.variants,b.variants);pL(_.Y.Tf(a),_.Y.Tf(b))},oL=function(a,b){var c=new Map(a.map(function(d){return[_.Y.ai(d),d]}));b.forEach(function(d){c.get(_.Y.ai(d)).drmInfos=d.drmInfos})},pL=function(a,b){var c=new Map(a.map(function(d){return[d.Dc,d]}));b.forEach(function(d){var e=c.get(d.Dc);e.S=d.S;d.S.forEach(function(f){f.initSegment=e.initSegmentReference});e.segmentIndex.replace(d.S);e.vc=d.vc;e.yf=d.yf;e.duration=d.duration;e.gi=d.gi;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=
22
- d.keyId})},kL=function(a){var b=qL(a);a.forEach(function(c){_.aD(c.segmentIndex,b);c.duration=b;c.yf=c.vc+b})},qL=function(a){var b=Infinity;_.Y.Yl(a).forEach(function(c){b=Math.min(b,c.duration)});return b},uL=function(a){if(!(2>a.length)&&rL(a)){a=a.map(function(e){return{playlist:e,ci:sL(e.S[0])}});var b=a.map(function(e){return e.ci}),c=Math.max.apply(Math,_.ph(b));b=Math.min.apply(Math,_.ph(b));if(!(1E3>c-b)){a.forEach(function(e){for(var f=e.playlist,g=e.ci;0<f.S.length&&1E3<c-g;){e=f.S.shift();
23
- var h=f.S[0];if(!h)break;tL(e,h);h=sL(h);null!=h?g=h:(e=_.Y.sj(e.Y).duration,g+=1E3*e)}});a=a.map(function(e){return e.playlist});if(a.some(function(e){return 0===e.S.length}))throw new _.O(_.P,4,4048,"Media playlists are completely out of sync.");var d=Math.min.apply(Math,_.ph(a.map(function(e){return e.S.length})));a.forEach(function(e){for(;e.S.length>d;)e.S.pop()})}}},rL=function(a){return a.every(function(b){return!!sL(b.S[0])})},sL=function(a){if(!a)return null;a=_.Y.Wa(a.Y,hK);if(!a)return null;
24
- a=Date.parse(a.value);return isNaN(a)?null:a},tL=function(a,b){a&&b&&[fK,eK].forEach(function(c){if(!_.Y.Nc(b.Y,c)){var d=a.Y.filter(function(e){return e.name===c});0!==d.length&&d.forEach(function(e){b.Y.push(e)})}})},vL=function(){var a=this;this.a=this.D=null;this.h=1;this.j=new MK;this.o="";this.T=new BK;this.H=0;this.w=null;this.l=new _.gj(function(){a.hc()});this.A=_.Ub;this.f=null;this.G=new _.lm;this.K=this.F=null;this.g=new _.L("clpp.hls.HlsParser");this.L=new Map;this.Z=new UK(this.og.bind(this));
25
- this.P=!1;this.I=null;this.O=!1;this.B=new Map;this.J=new Set},wL=function(a){if(null===a.w)return[];a=a.w;return[a.audio,a.video].filter(function(b){return b}).map(function(b){return b.Dc})},xL=function(a,b){var c=new Set(b.map(function(h){return h.id}));a.B.forEach(function(h,l){c.has(l)||a.B["delete"](l)});for(var d=_.v(b),e=d.next();!e.done;e=d.next()){e=e.value;var f=a.B.get(e.id);if(f&&f.Ke!==e.Ke)a.D.onError(new _.O(1,4,4044,"EXT-X-DATERANGE START-DATE has changed for ID\x3d"+e.id));var g=
26
- {configurationId:a.D.configurationId,schemeIdUri:e.schemeIdUri,customAttributes:e.customAttributes,value:"",startTime:e.startTime,Ke:e.Ke,endTime:e.endTime,id:e.id,type:_.xe,eventElement:null};f&&!_.M.Si(f,g)||a.B.set(e.id,g)}return Array.from(a.B.values())},GL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,D,C,B,E,A;return _.I(function(J){switch(J.a){case 1:c=_.su;d=yL(a,b,a.o,"");if(1===d.type){e=d.S[0].a;f=uK(e);if(!f)throw new _.O(_.P,4,4021,"Unknown file extension "+e);g="";f===c.VIDEO?g="avc1.42E01E":
27
- f===c.AUDIO&&(g="mp4a.40.2");d=LK(a.T,a.o,a.a.hlsDefaultCodecs||g)}h=_.Y.mo(d.Y);l=zL(h.Sc.Dh);l.forEach(function(N){a.J.add(N.groupId)});return _.x(J,AL(a,h),4);case 4:m=J.f;J.C(3);break;case 5:m=J.f;case 3:n=m;p=n.Zm;q=n.periods;t=n.wo;u=n.Xo;y=n.alternativeVariants;D=n.alternativeTextStreams;C=n.alternativeImageStreams;if(!a.D)throw new _.O(_.P,7,7001);BL(a,q);B=CL(a,p.delay,q,t);DL(a)||(a.H=p.Me,EL(a));FL(a,B,q);E=xL(a,u);A={presentationTimeline:B,periods:q,minBufferTime:0,cues:E,muxedAudioTracks:l};
28
- y&&(A.alternativeVariants=y);D&&(A.alternativeTextStreams=D);C&&(A.alternativeImageStreams=C);a.g.debug("HLS playlist parsed",A);return J["return"](A)}})},zL=function(a){return a.filter(function(b){return b.name===_.La&&_.T(b,_.Kb)===_.ja&&!_.T(b,_.Mb)}).map(function(b){var c=_.Y.ri(b),d=_.T(b,_.$a)||_.Hg;return{groupId:_.Qp(b,_.Ra),id:_.aK++,label:_.Qp(b,_.gb),language:d,channelsCount:c,primary:"YES"===_.T(b,"DEFAULT")}})},JL=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a)return c=
29
- _.Y,_.x(p,HL(a,b),2);d=p.f;e=d.textStreams;f=d.thumbStreams;g=d.mk;h=a.f.periods[0].variants;a.a.lowLatencyMode&&null!==a.w&&(h=h.filter(function(q){return q.id===a.w.id}));l=h.map(function(q){var t=c.ki(q.audio,g),u=c.ki(q.video,g);q=IL(a,t,u,q.bandwidth);if(!q)throw new _.O(_.P,4,4047,{message:"Video and audio are encrypted in an incompatible way.",bq:u?u.cc():void 0,audio:t?t.cc():void 0});return q});m=a.D.configurationId;n=nL(m,l,e,f,!0);return p["return"](n)})},HL=function(a,b){var c,d,e,f,g,
30
- h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.su,d=function(q){return q.stream.a()===c.VIDEO||q.stream.a()===c.AUDIO},e=b.filter(d),f=b.filter(function(q){return!d(q)}),g=function(q){q=q.map(function(t){var u=t.stream.streams[0];t=Object.assign({},{playlist:t.playlist},{language:u.language,channelsCount:u.channelsCount,spatialAudio:u.spatialAudio,closedCaptions:u.closedCaptions,primary:u.primary,kind:u.kind||null,groupId:u.groupId,type:u.type,codecs:u.codecs,name:u.originalId,uri:u.Dc,Pe:{width:u.width,
31
- height:u.height,frameRate:u.frameRate}});return KL(a,t)});return Promise.all(q)},_.x(p,g(e),2);if(3!=p.a)return h=p.f,_.x(p,g(f),3);l=p.f;LL(a,h.concat(l));m=l.filter(function(q){return q.a()===c.vh});n=l.filter(function(q){return q.a()===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,mk:h})})},LL=function(a,b){b.forEach(function(c){a.j.a.set(c.cc(),c)})},AL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,D,C,B;return _.I(function(E){switch(E.a){case 1:return c=_.Y,d=c.eo(b.Sc.closedCaptions),
32
- e=ML(a,b.Oe),_.x(E,NL(a,b),2);case 2:return f=E.f,g=Object.values(f).flat().map(function(A){return A.playlist}),h=g[0],l=c.tj(h.Y),a.A=l,OL(a,g),!DL(a)&&uL(g),a.K=c.uj(h.Y),m=c.lo(h.Y,l,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay,a.a.liveRefreshPeriod),_.x(E,PL(a,f.Eh,e),3);case 3:return n=E.f,_.x(E,QL(a,f.Oe,n,d),4);case 4:return p=E.f,_.x(E,RL(a,f.To,e),5);case 5:return q=E.f,_.x(E,SL(a,f.yg),6);case 6:return t=E.f,u=a.D.configurationId,y=nL(u,p,q,t,!DL(a)),a.D.filterAllPeriods(y),D=_.ph(f.Oe).concat(_.ph(f.Eh)).map(function(A){return A.playlist}),
33
- C=TL(a,D),B=UL(a,D,C),E["return"]({periods:y,wo:C,Xo:B,Zm:m})}})},WL=function(a,b){var c,d,e,f,g;return _.I(function(h){if(1==h.a)return c=_.An(b.verbatimUri,a.o),_.x(h,VL(a,c),2);d=h.f;e=d.response;f=d.text;g=e.uri;return h["return"](yL(a,f,g,b.verbatimUri))})},BL=function(a,b){DL(a)||2!==a.a.timeline.version||(a.I||(a.I=b[0].startTime),_.EE(b,-a.I))},UL=function(a,b,c){b=b.find(function(g){return null!==_.Y.Wa(g.Y,cK)});if(!b)return[];if(null===c)throw new _.O(_.P,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");
34
- var d=b.Y.filter(function(g){return g.name===cK});b=new Map;d=_.v(d);for(var e=d.next();!e.done;e=d.next()){e=e.value;var f=_.T(e,"ID");f=f?b.get(f):void 0;(e=_.Y.fo(e,c,a.F,!DL(a),f))&&b.set(e.id,e)}return Array.from(b.values())},TL=function(a,b){var c=b.flatMap(function(e){return e.S[0].Y});c=_.Y.Wa(c,hK);if(!c)return null;var d=(new Date(c.value)).getTime();return isNaN(d)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag value (value: "+(c.value+").")),null):d/1E3},NL=function(a,b){var c,
35
- d,e,f,g,h;return _.I(function(l){if(1==l.a)return _.x(l,Promise.all([XL(a,b.Sc.Dh),XL(a,b.Sc.Uo),XL(a,b.Oe),XL(a,b.yg)]),2);c=l.f;d=_.v(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({Eh:e,To:f,Oe:g,yg:h})})},ZL=function(a,b){return Promise.all(b.map(function(c){return YL(a,c)}))},ML=function(a,b){for(var c=_.Y.lf,d=new Map,e=_.v(b),f=e.next();!f.done;f=e.next()){var g=f.value,h=_.T(g,_.ja);f=_.T(g,_.Tb);var l=_.T(g,_.Bb);g=$L(a,g);if(l){var m=_.Mp(_.Dn,
36
- g);d.set(c(_.Dn,l),m);l=g.indexOf(m);-1<l&&g.splice(l,1)}h&&(l=aM(_.Sc,g),d.set(c(_.Sc,h),l));f&&(h=aM(_.Sg,g),d.set(c(_.Sg,f),h))}return d},RL=function(a,b,c){return Promise.all(b.map(function(d){return bM(a,d,c)}))},SL=function(a,b){return Promise.all(b.map(function(c){return cM(a,c)}))},PL=function(a,b,c){var d,e;return _.I(function(f){if(1==f.a){if(0===b.length)return f["return"](new Map);d=[bM(a,b[0],c)];return _.x(f,d[0],2)}if(3!=f.a)return d=d.concat(b.slice(1).map(function(g){return bM(a,
37
- g,c)})),_.x(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.Yo(e))})},QL=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,u;return _.I(function(y){if(1==y.a){e=new Set;f=_.ph(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.Qp(f[l].tag,_.pa)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.x(y,dM(a,n,c,d,e),2)}if(3!=y.a)return p=y.f,q=f.map(function(D){return dM(a,D,c,d,e)}),_.x(y,Promise.all(q),3);t=y.f;t.splice(g,0,p);u=t.reduce(_.uC,[]);return y["return"](u)})},eM=function(a,b,c){var d;return _.I(function(e){if(1==
38
- e.a)return _.x(e,KL(a,{playlist:c,codecs:b.codecs,type:b.type,yd:b.originalLanguage,Bc:b.id,groupId:b.groupId,primary:b.primary,kind:b.kind||null,name:b.label,channelsCount:b.channelsCount,spatialAudio:b.spatialAudio||!1,closedCaptions:b.closedCaptions,Pe:{width:b.width,height:b.height,frameRate:b.frameRate}}),2);d=e.f;b.bandwidth&&bL(d,b.bandwidth);return e["return"](d)})},dM=function(a,b,c,d,e){var f,g,h,l,m,n;return _.I(function(p){return 1==p.a?(f=_.Y,g=b,h=g.tag,l=Number(_.Qp(h,_.pa)),m=f.oo(h),
39
- _.x(p,fM(a,b,m,c,d),2)):(n=p.f)?p["return"](gM(a,n,l,e)):p["return"]([])})},hM=function(a,b,c,d,e,f){var g=$L(a,b);a.g.debug("Guessing stream type for",b.toString());b=!1;var h=_.Mp(_.Sg,g),l=d+e;1!==g.length||c||h?!l&&1<g.length?(a.g.debug("Guessing multiplexed audio+video"),c=_.Sg,g=[g.join(",")]):d&&f?(a.g.debug(jK),c=_.Sc,b=!0):e?(a.g.debug(jK),c=_.Sc):(a.g.debug("Guessing video-only"),c=_.Sg):(c=_.Sc,a.g.debug(jK));return{type:c,lk:g,Hm:b}},fM=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,u,y,D,
40
- C,B,E,A,J;return _.I(function(N){if(1==N.a)return f=_.su,g=_.Y.lf,h=b,l=h.tag,m=h.playlist,n=_.T(l,_.ja),p=_.T(l,_.Tb),q=n?d.get(g(f.AUDIO,n))||[]:[],t=p?d.get(g(f.VIDEO,p))||[]:[],u={audio:q,video:t},y=m.verbatimUri,D=u.audio.find(function(V){return V.cc()===y}),C=hM(a,l,c,u.audio.length,u.video.length,D),B=C.type,E=C.lk,A=C.Hm,J=null,A?N.C(2):_.x(N,iM(a,b,E,B,e,c),3);2!=N.a&&(J=N.f);if(null==J)return N["return"](null);u[B]=[J];B===f.AUDIO&&c&&u.video.forEach(function(V){ZK(V,c.width);$K(V,c.height);
41
- aL(V,c.frameRate)});return N["return"](u)})},gM=function(a,b,c,d){var e=b.video,f=b.audio;e=0<e.length?e:[null];b=[];f=_.v(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var h=_.v(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.Pl(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):(m=IL(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(b.push(m),d.add(l)))}}return b},IL=function(a,b,c,d,e){for(var f=[],g=(c||
42
- b).length(),h=0;h<g;h++){var l=b?b.streams[h]||null:null,m=c?c.streams[h]||null:null,n=_.Y.mm(l,m);if(!n)return null;var p=d;l={id:e?e:a.h++,language:l?l.language:_.Hg,primary:!!l&&l.primary||!!m&&m.primary,audio:l,video:m,bandwidth:p,drmInfos:n,allowedByApplication:!0,allowedByKeySystem:!0};f.push(l)}return new eL(f)},bM=function(a,b,c){var d,e,f,g;return _.I(function(h){d=b;e=d.tag;f=d.playlist;g=f.verbatimUri;return h["return"](jM(a,g,function(){var l,m,n,p,q,t,u,y,D,C,B,E,A;return _.I(function(J){if(1==
43
- J.a){l=_.su;m=_.Y.lf;n=_.Qp(e,_.Ra);p=_.Y.$h(_.Qp(e,_.Kb));q=_.Y.Ll(e);t=c.get(m(p,n))||"";u=_.T(e,_.$a);y=_.T(e,_.gb);D=_.T(e,"DEFAULT");C=p===l.AUDIO?_.Y.ri(e):null;var N=p===l.AUDIO?(N=_.T(e,"CHANNELS"))?N.includes("/JOC"):!1:!1;B=N;E="YES"===D;return _.x(J,KL(a,{playlist:f,codecs:t,type:p,yd:u,primary:E,name:y,channelsCount:C,spatialAudio:B,groupId:n,kind:q,Bc:null,closedCaptions:null,Pe:null}),2)}A=J.f;return J["return"](A)})}))})},cM=function(a,b){var c,d,e,f;return _.I(function(g){c=b;d=c.tag;
44
- e=c.playlist;f=e.verbatimUri;return g["return"](jM(a,f,function(){var h,l,m,n,p;return _.I(function(q){if(1==q.a)return h=_.T(d,_.ua)||"jpg",l=_.T(d,_.$a),m=_.T(d,_.gb),_.x(q,KL(a,{playlist:e,codecs:h,type:_.Ae,yd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,Bc:null,groupId:null,Pe:null}),2);n=q.f;(p=_.T(d,_.pa))&&bL(n,Number(p));return q["return"](n)})}))})},$L=function(a,b){var c=_.T(b,_.ua,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);c=
45
- _.Y.Tl(c);var d=new Set,e=[];c=_.v(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.AC(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},iM=function(a,b,c,d,e,f){var g,h,l,m,n;return _.I(function(p){g=b;h=g.tag;l=g.playlist;m=_.su;n=l.verbatimUri;return p["return"](jM(a,n,function(){var q,t,u,y,D;return _.I(function(C){if(1==C.a){q=_.T(h,_.ta);t=null;d===m.VIDEO&&q&&"NONE"!==q&&(t=e.get(q));var B=_.T(h,_.ja)||void 0;u=B&&a.J.has(B)?B:void 0;B=aM(d,c);if(u){var E=
46
- aM(_.Sc,c);B+=","+E}y=B;return _.x(C,KL(a,{playlist:l,codecs:y,type:d,closedCaptions:t,primary:!1,kind:null,yd:null,name:null,channelsCount:null,spatialAudio:!1,Bc:null,groupId:null,muxedAudioId:u,Pe:f}),2)}D=C.f;return C["return"](D)})}))})},jM=function(a,b,c){if(a.j.has(b))return a=a.j.get(b),Promise.resolve(a);if(a.j.f.has(b))return a.j.f.get(b)||null;c=c();a.j.set(b,c);return c},KL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,D,C,B,E,A,J,N,V,U,qa;return _.I(function(wa){if(1==wa.a){c=kM;d=lM;
47
- e=_.su;f=b;g=f.playlist;h=f.codecs;l=f.type;m=f.yd;n=f.Bc;p=f.groupId;q=f.muxedAudioId;t=f.primary;u=f.kind;y=f.name;D=f.channelsCount;C=f.spatialAudio;B=f.closedCaptions;E=f.Pe;A=_.Y.xi(m);if(1!==g.type)throw new _.O(_.P,4,4017);return _.x(wa,mM(a,g,l,h),2)}J=wa.f;N=a.a.lowLatencyMode?d.Yj:d.$j;V=u;l!==e.TEXT||u||(V=_.og);U=_.Y.tj(g.Y);qa=J.map(function(oa){var Ca=oa.S,Ja=oa.Vl,Ia=oa.mimeType,dc=oa.sa,md=Ca[0].startTime,nd=Ca[Ca.length-1].endTime,dk=nd-md,qc=new _.KD(Ca),Ke=Ca[0].initSegment||null;
48
- return{id:null===n?_.aK++:n,originalId:y,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:qc.Wd.bind(qc),getSegmentReference:qc.get.bind(qc),adjustSegmentDurations:qc.df.bind(qc),getDuration:qc.getDuration.bind(qc),segmentIndex:qc,segmentLookupStrategy:N,initSegmentReference:Ke,mimeType:Ia,codecs:h,kind:V,gi:Ja.type,encrypted:Ja.type===c.ck,aesEncrypted:oa.aesEncrypted,keyId:Ja.keyId,language:A,originalLanguage:m||_.Hg,label:y,type:l,primary:t,trickModeVideo:null,emsgSchemeIdUris:null,
49
- frameRate:E?E.frameRate:void 0,width:E?E.width:void 0,height:E?E.height:void 0,bandwidth:void 0,roles:[],channelsCount:D,spatialAudio:C,closedCaptions:B,S:Ca,drmInfos:Ja.drmInfos,sa:dc,Dc:g.verbatimUri,fg:g.a,vc:md,yf:nd,duration:dk,groupId:p,Tp:U,muxedAudioId:q}});return wa["return"](new XK(qa))})},XL=function(a,b){var c;return _.I(function(d){if(1==d.a)return _.x(d,Promise.all(b.map(function(e){var f;return _.I(function(g){if(1==g.a)return _.x(g,nM(a,e),2);f=g.f;return g["return"](f?{tag:e,playlist:f}:
50
- null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},nM=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a){c=_.Y.Tm(b);d=_.T(b,_.Mb,void 0,{required:c});if(!d)return p["return"](null);e=_.An(d,a.o);f=Date.now();return _.x(p,VL(a,e),2)}g=p.f;h=g.response;l=g.text;m=Date.now();a.D.onEvent(new _.Q(pK,{detail:{duration:m-f,type:"media"}}));n=h.uri;return p["return"](yL(a,l,n,d))})},YL=function(a,b){var c,d,e,f,g,h,l,m;return _.I(function(n){if(1==n.a){var p=new URL(b.streams[0].fg);
51
- if(a.a.lowLatencyMode&&a.K&&a.K.Jh){var q=b.streams[b.streams.length-1].segmentIndex;if(q=q.a[q.a.length-1]){var t=q.a,u=t.length-1;q={bn:q.position,po:t&&0<t.length?u:null}}else q=null;q&&(t=p.searchParams,u=q.po,t.set("_HLS_msn",q.bn.toString()),null===u&&t.get(nK)&&t["delete"](nK),null!==u&&t.set(nK,u.toString()))}c=p.toString();return _.x(n,VL(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.cc();h=b.streams[0].fg;l=e.uri;h!==l&&(h=l,YK(b,h));m=yL(a,f,h,g);return n["return"]({stream:b,playlist:m})})},
52
- yL=function(a,b,c,d){a=EK(a.T,b,c);a.verbatimUri=d;return a},oM=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.O(_.P,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},CL=function(a,b,c,d){var e=!0,f=null,g=0;DL(a)||(e=!1,f=0,g=b);b=a.a.timeline||{};b.type=void 0;a=new _.nD(b,f,g,!0,void 0,!!a.a.lowLatencyMode);_.qD(a,e);pM(a,c);d&&_.pD(a,d);return a},qM=function(a,b,c){a=_.Y.sc(a.Y,fK);if(1<a.length)throw new _.O(_.P,
53
- 4,4020);a=a[0];if(!a)return null;var d=_.Qp(a,_.Mb),e=_.An(d,b);b=_.Y.qj(a,null,!0);return new _.KC(function(){return[e]},b.la,b.ga,c)},rM=function(a,b,c,d,e,f,g){for(var h=[],l={},m=0;m<b.f.length;l={Yf:l.Yf},m++){var n=b.f[m],p=0===m,q=p?a:h[h.length-1],t=p?d:q.endTime,u=Number(_.T(n,_.Ha));u=t+u;p=_.Y.qj(n,p?null:q.ga,p);q=String(_.T(n,_.Mb));q=_.An(q,g);l.Yf=q?[q]:[];t=new _.Tp(c,t,u,function(y){return function(){return y.Yf}}(l),p.la,p.ga,e,f,!1,null,null,null,null);if("YES"===_.T(n,"INDEPENDENT")||
54
- 0===m)t.h=!0;h.push(t)}return h},sM=function(a,b,c,d,e,f,g,h,l,m,n){var p=c.Y,q=c.a;0<_.Y.sc(p,fK).length&&(n=qM(c,l,g));var t=null!=q,u=q?[q]:[];if(!t&&!a.a.lowLatencyMode)return null;a=0;q={la:0,ga:null};var y=null;t?(c=_.Y.sj(p).duration,a=e+c,q=_.Y.rj(p,b?b.ga:null)):(b=rM(b,c,d,e,f,g,l),a=b[b.length-1].endTime,y=b);h=h===_.Ae?_.Y.no(p):null;d=new _.Tp(d,e,a,function(){return u},q.la,q.ga,f,g,!1,null,h?h.pe:null,h?h.Ne:null,h?h.durationPerTile:null,y,n);d.sa=m;return d},mM=function(a,b,c,d){var e,
55
- f,g,h,l,m,n,p,q,t,u,y,D;return _.I(function(C){switch(C.a){case 1:return e=_.Y,f=tM,g=b.verbatimUri,h=b.S,l=e.sm(b.Y,gK),m=[],_.x(C,uM(a,b.a,g,h,l,c,d),2);case 2:n=C.f,p=l,q=f.Ro(h),t=0;case 3:if(!(t<q.length)){C.C(5);break}u=q[t];y=m[m.length-1]||null;return _.x(C,vM(a,b.a,u,p,n,c,d,y),6);case 6:D=C.f;m.push(D);p+=u.length;t++;C.C(3);break;case 5:return oM(m),C["return"](m)}})},uM=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,t,u,y,D,C;return _.I(function(B){if(1==B.a){h=d[0];if(null!=a.F)return B["return"](a.F);
56
- if(!DL(a)&&a.f)try{var E=a.j.get(c),A=E?cL(E,e)||null:null;if(!A)throw new _.O(_.P,4,4030,"Segment not found in pervious playlist update.");l=A.startTime+A.Ha;a.g.debug(mK+l+".");a.F=l;return B["return"](l)}catch(J){if(m=a.j.get(c))n=m.streams[0].S[0].position,B=m.streams[m.streams.length-1].S,p=B[B.length-1].position,q=e,t=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+" - "+p+(", new values "+q+" - "+t+"."),b,m);throw new _.O(_.P,4,4047,{message:"The updated playlist does not share any segments with the previous one.",
57
- uri:c});}return _.x(B,wM(a,f,g,h),2)}if(3!=B.a)return u=B.f,y=xM.nj(h.Y,a.o,e),D=qM(h,b,y),_.x(B,yM(a,D,h,y,u,g),3);C=B.f;a.g.debug(mK+C+".");a.F=C;return B["return"](C)})},vM=function(a,b,c,d,e,f,g,h){var l,m,n,p,q,t,u,y,D,C,B,E,A,J,N,V,U,qa,wa,oa,Ca,Ja;return _.I(function(Ia){switch(Ia.a){case 1:return l=xM,m=c[0],n=null==h,_.x(Ia,wM(a,f,g,m),2);case 2:p=Ia.f;q=l.io(c,p,h?h.Xm:null);t=q[q.length-1];u=xM.ra(q);y=h?h.Ym:null;D=zM(y,m.Y,a.o,d);C=qM(m,b,D)||(h?h.Jm:null);B=m.sa;if(n){E=e;Ia.C(3);break}return _.x(Ia,
58
- AM(a,B,C,m,d,D,p,g),4);case 4:E=Ia.f;case 3:A=E;J=[];N=!1;for(V=0;V<c.length;V++)if(U=c[V],qa=J[J.length-1]||null,wa=0===V?0:qa.endTime,oa=d+V,(y=Ca=zM(y,U.Y,a.o,oa))&&(N=!0),Ja=sM(a,qa,U,oa,wa,A,Ca,f,b,B,C))C=Ja.initSegment,J.push(Ja);return Ia["return"]({S:J,Vl:u,Xm:t,aesEncrypted:N,mimeType:p,endTime:J[J.length-1].endTime,sa:B,Jm:C,Ym:y})}})},zM=function(a,b,c,d){return b.some(function(e){return e.name===eK&&"NONE"===_.T(e,kK)})?null:(b=xM.nj(b,c,d))?b:a&&a.generatedIv?Object.assign({},a,{iv:xM.pi(d)}):
59
- a},OL=function(a,b){b.forEach(function(c){var d=a.j.get(c.verbatimUri);tM.rk(c,d,!DL(a))});tM.Ql(b)},AM=function(a,b,c,d,e,f,g,h){var l;return _.I(function(m){if(1==m.a)return a.L.has(b)?m["return"](a.L.get(b)):_.x(m,yM(a,c,d,f,g,h),2);l=m.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.L.set(b,l);return m["return"](l)})},yM=function(a,b,c,d,e,f){var g;return _.I(function(h){if(null==c.a)return h["return"](0);g=_.Y.Nl(c,d);return h["return"](WK(a.Z,b,g,e,f,null!=d))})},aM=function(a,
60
- b){if(1===b.length)return b[0];var c=_.Mp(a,b);if(null!=c)return c;throw new _.O(_.P,4,4025,{codecList:b});},wM=function(a,b,c,d){var e,f,g;return _.I(function(h){e=d.a;g=(f=_.Y.Wa(d.Y,fK))?_.Qp(f,_.Mb):null;return h["return"](BM(a,b,c,e,g))})},BM=function(a,b,c,d,e){var f,g,h,l,m;return _.I(function(n){if(1==n.a){f=[d,e].filter(Boolean);if(g=_.Op(f,b,c))return n["return"](g);h=_.$k([d],a.a.attemptParameters);h.method="HEAD";h.type=2;return _.x(n,a.og(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.O(_.P,
61
- 4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.toLowerCase().split(";")[0])})},FL=function(a,b,c){c=_.Y.um(c);"LIVE"===a.A||"EVENT"===a.A?(c=Math.max(c,b.K),isNaN(a.a.availabilityWindowOverride)||(c=a.a.availabilityWindowOverride),b.A=c):a.A===_.Ub&&(b.f=c)},EL=function(a){for(var b=0,c=_.v(a.j.values()),d=c.next();!d.done;d=c.next())b=Math.max(b,d.value.streams[0].vc);for(c=0;95443.7176888889<=b;)c+=95443.7176888889,b-=95443.7176888889;if(c)for(a.g.debug("Offsetting live streams by",
62
- c,"to compensate for rollover"),b=_.v(a.j.values()),d=b.next();!d.done;d=b.next())d=d.value.streams[0],95443.7176888889>d.vc?(a.g.debug("Offset applied to",d.type),d.segmentIndex.offset(c)):a.g.debug("Offset NOT applied to",d.type)},VL=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.$k([b],a.a.attemptParameters),c.type=1,_.x(f,a.og(c),2);d=f.f;e="";try{e=_.R.ea(d.data)}catch(g){throw new _.O(_.P,4,4042);}e=_.R.Zi(e);e=e.trim();return f["return"]({text:e,response:d})})},DL=function(a){return a.A===
63
- _.Ub},pM=function(a,b){_.Y.Um(b,function(c,d){_.tD(a,c.S,d.startTime)});_.mD(a.a,b[0].startTime,b[b.length-1].endTime)},CM=function(){},lM={Yj:_.UB,$j:_.TB},kM={ck:qK,wp:"whole-segment",NONE:_.Ze},JK=/^#EXT-X-DEFINE/,KK=/^#(EXT-X-DISCONTINUITY-SEQUENCE|EXT-X-ENDLIST|EXT-X-I-FRAMES-ONLY|EXT-X-MEDIA-SEQUENCE|EXT-X-PART-INF|EXT-X-PLAYLIST-TYPE|EXT-X-SERVER-CONTROL|EXT-X-TARGETDURATION|EXT-X-DATERANGE|EXT-X-VERSION)/;_.r=MK.prototype;
64
- _.r.set=function(a,b){var c=this;this.f.set(a,b);return b.then(function(d){return c.a.set(a,d)})["catch"](function(){}).then(function(){return c.f["delete"](a)})};_.r.has=function(a){return this.a.has(a)};_.r.get=function(a){return this.a.get(a)||null};_.r.values=function(){return Array.from(this.a.values())};_.r.clear=function(){this.f.clear();this.a.clear()};
65
- var tM={Ql:function(a){var b=tM.fm(a),c=tM.Wm(a);a.forEach(function(d){var e=d.S,f=e.findIndex(function(h){return h.sa===b}),g=e.findIndex(function(h){return h.sa===c+1});-1===g&&(g=e.length);d.S=e.slice(f,g)})},rk:function(a,b,c){b=tM.rm(a,b,c);a=_.v(a.S||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.Nc(c.Y,dK)&&b++,c.sa=b},rm:function(a,b,c){var d=_.Y.Wa(a.Y,"EXT-X-DISCONTINUITY-SEQUENCE");if(d)return Number(d.value);d=tM.Lm(b);if(c&&d)try{return tM.Im(a,b)}catch(e){throw new _.O(_.P,4,4024,
66
- "EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}return 0},Lm:function(a){return 0<tM.tm(a)},Ro:function(a){if(0===a.length)return[];var b=[],c=[];a=_.v(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.Nc(d.Y,dK)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},tm:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].S;return a[a.length-1].sa},Im:function(a,b){var c=_.Y.Wa(a.Y,gK);if(!c)throw tM.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),
67
- Error(iK);c=Number(c.value);var d=cL(b,c);if(!d)throw tM.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(iK);return d.sa},Wm:function(a){a=a.map(function(b){return b.S[b.S.length-1].sa});return Math.min.apply(Math,_.ph(a))},fm:function(a){a=a.map(function(b){return b.S[0].sa});return Math.max.apply(Math,_.ph(a))}};tM.g=new _.L("clpp.hls.DiscontinuityUtils");var DM={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Tg)throw new _.O(_.P,4,4041);if(_.Qp(a,kK)===lK)throw new _.O(_.P,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.xC(_.Id,[{initDataType:_.eg,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":TK,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":TK,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.Qp(a,kK);if(!RK.includes(b))return SK.error("Widevine in HLS is only supported with [",
68
- RK.join(", "),"], not",b),null;b=_.Qp(a,_.Mb);b=_.Rm(b);b=_.Qi(b.data);b=_.xC(_.Md,[{initDataType:_.ld,initData:b}],"");if(a=_.T(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},RK=["SAMPLE-AES",lK],SK=new _.L("clpp.hls.DrmParser");var xM={io:function(a,b,c){if(_.Y.Nc(a[0].Y,eK)||null===c)return c=xM.oj(a,b),0===c.length?[{type:_.Ze,drmInfos:[],keyId:null}]:c;a=xM.oj(a,b);return[c].concat(_.ph(a))},ra:function(a){if(0===a.length)return{type:_.Ze,drmInfos:[],keyId:null};if(a.some(function(c){return"whole-segment"===c.type})||a.every(function(c){return c.type===_.Ze}))return a[0];a=a.filter(function(c){return c.type===qK});var b=_.Mi(a.flatMap(function(c){return c.drmInfos}));return{keyId:a[a.length-1].keyId,type:qK,drmInfos:b}},
69
- oj:function(a,b){return xM.Zl(a).map(function(c){return xM.ko(c.Y,b)}).filter(Boolean)},Zl:function(a){return a.filter(function(b){return _.Y.Nc(b.Y,eK)})},ko:function(a,b){var c=_.Y.sc(a,eK).filter(function(e){return"AES-128"!==_.Qp(e,kK)});if(0===c.length)return null;var d=_.Qp(c[0],kK);if(1===c.length&&"NONE"===d)return{type:_.Ze,drmInfos:[],keyId:null};d=c.map(function(e){return _.Qp(e,kK)});if(!d.every(function(e){return"SAMPLE-AES"===e})&&!d.every(function(e){return e===lK}))throw xM.g.warn("EXT-X-KEY methods "+
70
- d.join(", ")+" are incompatible."),new _.O(_.P,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");c=c.map(function(e){var f=_.T(e,"KEYFORMAT","identity"),g=DM[f]||null;(e=g?g(e,b):null)||xM.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===c.length)throw new _.O(_.P,4,4026);return{keyId:c.map(function(e){return e.keyIds}).reduce(function(e,f){return e.concat(f)},[]).reverse()[0]||null,type:qK,drmInfos:c}},Qp:function(){return{type:_.Ze,drmInfos:[],keyId:null}},
71
- nj:function(a,b,c){a=_.Y.sc(a,eK)[0];if(!a||"AES-128"!==_.Qp(a,kK))return null;var d=xM.km(a,c);c=d.iv;d=d.generatedIv;return{method:"AES-128",url:_.An(_.Qp(a,_.Mb),b),iv:c,generatedIv:d}},pi:function(a){return _.Qm(new Uint8Array(12),new Uint8Array([a>>24&255,a>>16&255,a>>8&255,a&255]))},km:function(a,b){var c=_.T(a,"IV","");if(c)return{iv:_.Nm((c||"0x").slice(2)),generatedIv:!1};c=_.T(a,"KEYFORMAT");return null==c||"identity"===c?{iv:xM.pi(b),generatedIv:!0}:{iv:null,generatedIv:!1}}};xM.g=new _.L("clpp.hls.EncryptionUtils");XK.prototype.length=function(){return this.streams.length};XK.prototype.f=function(){return this.streams[0].groupId};XK.prototype.a=function(){return this.streams[0].type};XK.prototype.cc=function(){return this.streams[0].Dc};eL.prototype.length=function(){return this.a.length};_.r=vL.prototype;_.r.configure=function(a){this.a=a;this.Z.a=a};_.r.setCurrentVariant=function(a){this.w=a};_.r.start=function(a,b){var c=this,d,e,f,g,h,l,m;return _.I(function(n){if(1==n.a){if(c.P)throw Error("start() may be called only once!");c.P=!0;c.D=b;d=Date.now();return _.x(n,VL(c,a),2)}if(3!=n.a)return e=n.f,f=e.response,g=e.text,h=Date.now(),c.D.onEvent(new _.Q(pK,{detail:{duration:h-d,type:"master"}})),c.o=f.uri,_.x(n,GL(c,g),3);l=n.f;c.f=l;m=c.H;c.l&&0<m&&c.l.ha(m);return n["return"](l)})};
72
- _.r.requestStop=function(){this.O=!0};_.r.stop=function(){this.l&&(this.l.stop(),this.l=null);var a=[];this.G&&(a.push(this.G.destroy()),this.G=null);this.j.clear();this.f=this.a=this.D=this.w=null;this.B.clear();this.J.clear();return Promise.all(a)};
73
- _.r.update=function(){var a=this,b,c,d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:b=a.f;if(DL(a)||!b)return p["return"]();c=b.presentationTimeline;"LIVE"===a.A&&(a.F=null);d=Array.from(a.j.values());a.a.lowLatencyMode&&null!==a.w&&(e=wL(a),d=d.filter(function(q){return e.includes(q.cc())}));return _.x(p,ZL(a,d),2);case 2:return f=p.f,g=f.map(function(q){return q.playlist}),OL(a,g),_.x(p,JL(a,f),3);case 3:h=p.f;gL(b.periods,h).forEach(function(q){a.D.filterNewPeriod(q)});BL(a,h);l=TL(a,
74
- g);m=UL(a,g,l);b.cues=xL(a,m);iL(b.periods,h);pM(c,h);if(n=_.Y.Fm(g))!0!==a.a.keepTimelineLive&&(a.A=_.Ub,_.qD(c,!0),c.f=h[h.length-1].endTime),a.l.stop(),a.l=null;if(a.D.onUpdate)a.D.onUpdate(b);if(n&&a.D.onTurnedStatic)a.D.onTurnedStatic();if(!a.O){p.C(4);break}return _.x(p,a.stop(),4);case 4:return p["return"](b)}})};
75
- _.r.loadVariant=function(a,b){var c=this,d,e,f,g,h,l,m,n,p,q,t,u,y,D,C;return _.I(function(B){if(1==B.a){d=a.id;if(e=c.f.periods.find(function(E){return E.id===b}))if(f=e.variants.find(function(E){return E.id===d}))return B["return"](f);g=c.f.alternativeVariants.find(function(E){return E.id===d});if(!g)throw new _.ui("No alternative variant with id: "+d);h=g;m=l=null;h.audio&&(n=h.audio,l=jM(c,n.verbatimUri,function(){var E;return _.I(function(A){if(1==A.a)return _.x(A,WL(c,n),2);E=A.f;return A["return"](eM(c,
76
- n,E))})}));h.video&&(p=h.video,m=jM(c,p.verbatimUri,function(){var E;return _.I(function(A){if(1==A.a)return _.x(A,WL(c,p),2);E=A.f;return A["return"](eM(c,p,E))})}));return _.x(B,l,2)}if(3!=B.a)return q=B.f,_.x(B,m,3);t=B.f;if(u=IL(c,q,t,h.bandwidth,h.id))D=c.D.configurationId,C=nL(D,[u],[],[],!DL(c)),c.D.filterAllPeriods(C),C.forEach(function(E,A){c.f.periods[A].variants.push(E.variants[0]);b===c.f.periods[A].id&&(y=E.variants[0])});if(!y)throw new _.ui("Could load variant with id: "+d);return B["return"](y)})};
77
- _.r.loadTextStream=function(a,b){var c=this,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){(e=c.f.periods.find(function(n){return n.id===b}))&&(f=e.textStreams.find(function(n){return n.id===a})||null)&&(d=f);if(d||!c.f.alternativeTextStreams)return m.C(2);g=c.f.alternativeTextStreams.find(function(n){return n.id===a})||null;if(!g)throw new _.ui(_.AB+a);h=g;return _.x(m,jM(c,h.verbatimUri,function(){var n;return _.I(function(p){if(1==p.a)return _.x(p,WL(c,h),2);n=p.f;return p["return"](eM(c,h,n))})}),
78
- 3)}2!=m.a&&(l=m.f)&&c.f.periods.forEach(function(n,p){var q=l.streams[p];c.f.periods[p].textStreams.push(q);q.id===a&&(d=q)});if(!d)throw new _.ui(_.AB+a);return m["return"](d)})};_.r.hc=function(){var a=this,b,c;return _.I(function(d){if(1==d.a){a.g.debug(_.KB);if(!a.D)return d["return"]();_.F(d,2);return _.x(d,a.update(),4)}if(2!=d.a)return a.l&&0<a.H&&a.l.ha(a.H),_.G(d,0);b=_.H(d);if(!(b instanceof _.O))throw b;a.D&&(a.D.onError(b),c=b,1===c.severity&&a.l&&a.l.ha(.1));_.z(d)})};
79
- _.r.og=function(a){if(!this.G)throw new _.O(_.P,7,7001);a=this.D.networkingEngine.fetch(a);_.nm(this.G,a);return a.U};_.w(CM,_.bv);CM.prototype.install=function(){_.Xv.m3u8=vL;_.Wv[_.Yl]=vL;_.Wv[oK]=vL};CM.prototype.uninstall=function(){_.kE("m3u8");_.lE(_.Yl);_.lE(oK)};CM.prototype.id=function(){return"hls"};_.K("clpp.hls.HlsComponent",CM);};
2
+ var f=function(window){var bK="Could not parse MP4 segment start time.",cK="EXT-X-DATERANGE",dK="EXT-X-DISCONTINUITY",eK="EXT-X-KEY",fK="EXT-X-MAP",gK="EXT-X-MEDIA-SEQUENCE",hK="EXT-X-PROGRAM-DATE-TIME",iK="Failed to infer discontinuity number",jK="Guessing audio-only",kK="METHOD",lK="SAMPLE-AES-CTR",mK="_HLS_part",nK="application/vnd.apple.mpegurl",oK="manifestloaded",pK="sample",qK=function(a){if(1>a.a)throw _.gq();--a.a},rK=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},function(c,d){return d+b})},
3
+ sK=function(a,b){b=void 0===b?0:b;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+8]&&128>a[b+9]?!0:!1},tK=function(a){a=_.An(a)||"";return null!=_.Np.video[a]?_.Sg:null!=_.Np.audio[a]?_.Sc:null},uK=function(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.O(_.P,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.O(_.P,4,4043,"Media playlist must have at least one full segment!");}this.a=a;this.verbatimUri=
4
+ "";this.type=b;this.$=c;this.S=1===b?d:null},vK=function(a,b,c){c=void 0===c?[]:c;this.$=b;this.a=a;this.f=c;this.ka=-1},wK=function(a){return a.some(function(b){return b.startsWith("#EXT-X-TARGETDURATION")})?1:0},xK=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,function(c,d){var e=b.get(d);if(null==e)throw new _.O(_.P,4,4044,"Undefined variable '"+d+"'");return e})},yK=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=xK(d.value,b)})})},zK=function(a,b){var c=
5
+ new Map,d=new URL(b);a.forEach(function(e){var f=_.T(e,_.gb),g=_.T(e,"QUERYPARAM");if(f)g=_.Qp(e,"VALUE"),c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.O(_.P,4,4044,"Query param '"+g+"' missing in playlist URI.");if(!f)throw new _.O(_.P,4,4044,"Query param '"+g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},AK=function(){this.h=0;this.a=new Map},DK=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&
6
+ !_.Y.Mm(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.O(_.P,4,4015);b=b.slice(1);return 0===wK(b)?BK(a,b,c):CK(a,b,c)},CK=function(a,b,c){var d=EK(b);b=d.Jo;var e=d.Fm,f=FK(a,d.pp,c);d=e.map(function(g){return GK(a,g,f)});b=HK(a,c,b,f);return new uK(c,1,d,b)},EK=function(a){var b=[],c=[],d=[];a=_.v(a);for(var e=a.next();!e.done;e=a.next())e=e.value,IK.test(e)?d.push(e):JK.test(e)?c.push(e):b.push(e);return{Jo:b,Fm:c,pp:d}},BK=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=GK(a,b[e]);
7
+ d.push(f);if(f.name===_.La){var g=b[e+1];if(!g)throw new _.O(_.P,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.Rp(_.Mb,g));e++}}b=_.Y.yc(d,"EXT-X-DEFINE");_.Y.Sj(b);b=zK(b,c);a.a=b;yK(d,a.a);return new uK(c,0,d)},KK=function(a,b,c){var d=[],e=[];e.push(new _.Rp(_.oa,"0"));e.push(new _.Rp(_.Mb,b));c.length&&e.push(new _.Rp(_.ua,c));d.push(new _.Pp(a.h++,_.La,e));return new uK(b,0,d)},HK=function(a,b,c,d){var e=[],f=[],g=[];c.forEach(function(k){_.Y.Sm(k)?(k=GK(a,k,d),
8
+ "EXT-X-PART"===k.name||"EXT-X-PRELOAD-HINT"===k.name&&"PART"===_.T(k,_.Kb)?g.push(k):f.push(k)):(_.Y.Tc(f,"EXT-X-GAP")||(k=xK(k,d),k=_.zn(k,b),e.push(new vK(k,f,g))),f=[],g=[])});0<g.length&&e.push(new vK(null,f,g));return e},GK=function(a,b,c){a=_.Ys(a.h++,b);c&&yK([a],c);return a},FK=function(a,b,c){b=b.map(function(e){return GK(a,e)});_.Y.Sj(b);var d=zK(b,c);b.map(function(e){return _.T(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.O(_.P,4,4044,"Cannot import variable '"+
9
+ e+"' as it is not defined in the master playlist");d.set(e,f)});return d},LK=function(){this.a=new Map;this.f=new Map},MK=function(a){function b(l,m,n){for(var p="";m<n;m++)p+="%"+("00"+l[m].toString(16)).slice(-2);return p}function c(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.O(_.P,4,4030);}sK(a)||d();var 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,
10
+ e+f+10);for(var k=0;k<g.byteLength;k++)if(0===g[k]){if("com.apple.streaming.transportStreamTimestamp"===unescape(b(g,0,k)))return a=g.subarray(k+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}}sK(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},NK=function(a){for(;a.getPosition()<a.bb()-1;){var b=a.getPosition();if(71===_.hq(a))return qK(a),b}return-1},OK=function(a){function b(){d.seek(e+188);f=_.hq(d);71!==f&&(d.seek(e+192),f=_.hq(d));71!==f&&(d.seek(e+
11
+ 204),f=_.hq(d));71!==f&&c();qK(d)}function c(){throw new _.O(_.P,4,4030);}var d=new _.eq(new DataView(a),!1),e=0,f=0;e=NK(d);0>e&&(_.Fw.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.hq(d),71!==f&&c(),a=_.iq(d),8191===(a&8191))b();else if(a&16384)if(a=(_.hq(d)&48)>>4,0!==a&&2!==a||c(),3===a&&(a=_.hq(d),d.skip(a)),1!==_.jq(d)>>8)b();else{d.skip(3);a=_.hq(d)>>6;0!==a&&1!==a||c();0===_.hq(d)&&c();a=_.hq(d);var g=_.iq(d),k=_.iq(d);return(1073741824*((a&14)>>
12
+ 1)+((g&65534)<<14|(k&65534)>>1))/9E4}else b()},PK=function(a,b){var c=null,d=0;try{(new _.oq).N(_.We,_.pq).N(_.Bg,_.pq).N(_.Qe,_.pq).da("mdhd",function(g){g.reader.skip(0===g.version?8:16);d=_.jq(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.Fw.error("Unable to find timescale in init segment!"),new _.O(_.P,4,4030,bK,c);var e=0,f=!1;try{(new _.oq).N("moof",_.pq).N("traf",_.pq).da("tfdt",function(g){var k=d;if(0===g.version)k=_.jq(g.reader)/k;else{var l=_.jq(g.reader),m=_.jq(g.reader);
13
+ if(!(2097151>=l||k>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");k=l/k*Math.pow(2,32)+m/k}e=k;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.O(_.P,4,4030,bK,c);return e},SK=function(a){var b=_.Qp(a,kK);if(!QK.includes(b))return RK.error("PlayReady in HLS is only supported with [",QK.join(", "),"], not",b),null;a=_.Qp(a,_.Mb);b=_.Qm(a);a=null;b=_.Qi(b.data);try{a=_.lC(_.Qr(b))}catch(c){a=b}return _.yC(_.Kd,
14
+ [{initDataType:_.ld,initData:a}],"")},TK=function(a){this.g=new _.M("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Vk()}},VK=function(a,b,c,d,e,f){var g,k,l,m,n,p,q,t;return _.I(function(u){switch(u.a){case 1:a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.Vc||d===_.Uc)return u["return"](0);g=f;if(d!==_.Tc){u.C(2);break}return _.x(u,UK(a,c,g),3);case 3:k=u.f;l=_.Qi(k.data);if(!sK(l))throw new _.O(_.P,4,4030,"AAC segment does not contain an ID3 tag.");return u["return"](MK(l));
15
+ case 2:if(d!==_.Ug&&d!==_.Wc){u.C(4);break}m=[UK(a,c,g)];b&&m.push(UK(a,b,!0));return _.x(u,Promise.all(m),5);case 5:return n=u.f,p=n[0],q=n[1]||n[0],u["return"](PK(p.data,q.data));case 4:if(d!==_.Tg){u.C(6);break}return _.x(u,UK(a,c,g),7);case 7:return t=u.f,u["return"](OK(t.data));case 6:if(!_.Xu((d.split("/")[0]||"")+'/mp4;codecs\x3d"'+e+'"'))return u["return"](0);throw new _.O(_.P,4,4030);}})},UK=function(a,b,c){var d,e,f,g,k,l,m;return _.I(function(n){switch(n.a){case 1:return d=b.f(),e=_.gD(b.Ia(),
16
+ b.la,b.la+2048-1,a.a.attemptParameters),e.type=2,f=_.gD(b.Ia(),b.la,b.fa,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.F(n,2),g=c?f:e,_.x(n,a.f(g),4);case 4:return k=n.f,n["return"](k);case 2:l=_.H(n);if(7001===l.code||c)throw l;a.g.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 pre-flights.",e.uris[0]);_.F(n,5);return _.x(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.H(n),
17
+ a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.O(_.P,4,4030,"Failed to fetch the media segment.");}})},WK=function(a){this.streams=a},XK=function(a,b){a.streams.forEach(function(c){c.jg=b})},YK=function(a,b){a.streams.forEach(function(c){c.width=b})},ZK=function(a,b){a.streams.forEach(function(c){c.height=b})},$K=function(a,b){a.streams.forEach(function(c){c.frameRate=b})},aL=function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},bL=function(a,b){var c=
18
+ a.streams.find(function(d){d=d.S;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.S.find(function(d){return d.position===b})||null},cL=function(a,b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},dL=function(a){this.a=a},eL=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},fL=function(a,b){var c=new Set(a.map(function(d){return d.ka}));return b.filter(function(d){return!c.has(d.ka)})},
19
+ hL=function(a,b){for(;a[0].ka<b[0].ka;)a.splice(0,1);var c=a[0],d=b[0];c.startTime===d.startTime&&c.endTime===d.endTime||gL(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&(c.startTime!==d.startTime||c.endTime!==d.endTime)&&gL(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},lL=function(a,b,c,d,e){var f=b[0].length();f=rK(f).map(function(g){var k=eL(b,g)||[],l=cL(c,g)||[];g=cL(d,g)||[];var m=_.ph(iL(k)).concat(_.ph(l),_.ph(g)).filter(Boolean);jL(m);var n=m[0];m=n.ka;n=n.duration;return{configurationId:a,variants:k,
20
+ textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,ka:m}});f[0].startTime+=e;f[0].endTime+=e;kL(f);return f},iL=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},kL=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},gL=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;mL(a.variants,b.variants);nL(_.Y.Xf(a),_.Y.Xf(b))},
21
+ mL=function(a,b){var c=new Map(a.map(function(d){return[_.Y.ei(d),d]}));b.forEach(function(d){c.get(_.Y.ei(d)).drmInfos=d.drmInfos})},nL=function(a,b){var c=new Map(a.map(function(d){return[d.bd,d]}));b.forEach(function(d){var e=c.get(d.bd);e.S=d.S;d.S.forEach(function(f){f.initSegment=e.initSegmentReference});e.segmentIndex.replace(d.S);e.Bc=d.Bc;e.Cf=d.Cf;e.duration=d.duration;e.ki=d.ki;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},jL=function(a){var b=oL(a);a.forEach(function(c){_.bD(c.segmentIndex,
22
+ b);c.duration=b;c.Cf=c.Bc+b})},oL=function(a){var b=Infinity;_.Y.$l(a).forEach(function(c){b=Math.min(b,c.duration)});return b},sL=function(a){if(!(2>a.length)&&pL(a)){a=a.map(function(e){return{playlist:e,gi:qL(e.S[0])}});var b=a.map(function(e){return e.gi}),c=Math.max.apply(Math,_.ph(b));b=Math.min.apply(Math,_.ph(b));if(!(1E3>c-b)){a.forEach(function(e){for(var f=e.playlist,g=e.gi;0<f.S.length&&1E3<c-g;){e=f.S.shift();var k=f.S[0];if(!k)break;rL(e,k);k=qL(k);null!=k?g=k:(e=_.Y.uj(e.$).duration,
23
+ g+=1E3*e)}});a=a.map(function(e){return e.playlist});if(a.some(function(e){return 0===e.S.length}))throw new _.O(_.P,4,4048,"Media playlists are completely out of sync.");var d=Math.min.apply(Math,_.ph(a.map(function(e){return e.S.length})));a.forEach(function(e){for(;e.S.length>d;)e.S.pop()})}}},pL=function(a){return a.every(function(b){return!!qL(b.S[0])})},qL=function(a){if(!a)return null;a=_.Y.ab(a.$,hK);if(!a)return null;a=Date.parse(a.value);return isNaN(a)?null:a},rL=function(a,b){a&&b&&[fK,
24
+ eK].forEach(function(c){if(!_.Y.Tc(b.$,c)){var d=a.$.filter(function(e){return e.name===c});0!==d.length&&d.forEach(function(e){b.$.push(e)})}})},tL=function(){var a=this;this.a=this.F=null;this.h=1;this.j=new LK;this.o="";this.W=new AK;this.H=0;this.l=new _.gj(function(){a.mc()});this.w=_.Ub;this.f=null;this.G=new _.km;this.B=0;this.L=null;this.g=new _.M("clpp.hls.HlsParser");this.D=new Map;this.I=this.M=!1;this.X=new TK(this.tg.bind(this));this.P=!1;this.J=null;this.T=!1;this.A=new Map;this.K=new Set},
25
+ uL=function(a,b){var c=new Set(b.map(function(k){return k.id}));a.A.forEach(function(k,l){c.has(l)||a.A["delete"](l)});for(var d=_.v(b),e=d.next();!e.done;e=d.next()){e=e.value;var f=a.A.get(e.id);if(f&&f.Oe!==e.Oe)a.F.onError(new _.O(1,4,4044,"EXT-X-DATERANGE START-DATE has changed for ID\x3d"+e.id));var g={configurationId:a.F.configurationId,schemeIdUri:e.schemeIdUri,customAttributes:e.customAttributes,value:"",startTime:e.startTime,Oe:e.Oe,endTime:e.endTime,id:e.id,type:_.xe,eventElement:null};
26
+ f&&!_.N.Vi(f,g)||a.A.set(e.id,g)}return Array.from(a.A.values())},DL=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,t,u,y,C,D,B,E,z;return _.I(function(L){switch(L.a){case 1:c=_.ru;d=vL(a,b,a.o,"");if(1===d.type){e=d.S[0].a;f=tK(e);if(!f)throw new _.O(_.P,4,4021,"Unknown file extension "+e);g="";f===c.VIDEO?g="avc1.42E01E":f===c.AUDIO&&(g="mp4a.40.2");d=KK(a.W,a.o,a.a.hlsDefaultCodecs||g)}k=_.Y.qo(d.$);l=wL(k.Xc.Hh);l.forEach(function(J){a.K.add(J.groupId)});return _.x(L,xL(a,k),4);case 4:m=L.f;L.C(3);break;
27
+ case 5:m=L.f;case 3:n=m;p=n.an;q=n.periods;t=n.Ao;u=n.ap;y=n.alternativeVariants;C=n.alternativeTextStreams;D=n.alternativeImageStreams;if(!a.F)throw new _.O(_.P,7,7001);yL(a,q);B=zL(a,p.delay,q,t);AL(a)||(a.H=p.Qe,a.g.info("Update playlist each "+a.H+" s"),BL(a));CL(a,B,q);E=uL(a,u);z={presentationTimeline:B,periods:q,minBufferTime:0,cues:E,muxedAudioTracks:l};y&&(z.alternativeVariants=y);C&&(z.alternativeTextStreams=C);D&&(z.alternativeImageStreams=D);a.g.debug("HLS playlist parsed",z);return L["return"](z)}})},
28
+ wL=function(a){return a.filter(function(b){return b.name===_.Ka&&_.T(b,_.Kb)===_.ja&&!_.T(b,_.Mb)}).map(function(b){var c=_.Y.xi(b),d=_.T(b,_.$a)||_.Hg;return{groupId:_.Qp(b,_.Qa),id:_.aK++,label:_.Qp(b,_.gb),language:d,channelsCount:c,primary:"YES"===_.T(b,"DEFAULT")}})},GL=function(a,b){var c,d,e,f,g,k,l,m,n;return _.I(function(p){if(1==p.a)return c=_.Y,"LIVE"===a.w&&(a.M=!0,a.I=!0),_.x(p,EL(a,b),2);d=p.f;e=d.textStreams;f=d.thumbStreams;g=d.pk;k=a.f.periods[0].variants;l=k.map(function(q){var t=
29
+ c.oi(q.audio,g),u=c.oi(q.video,g);q=FL(a,t,u,q.bandwidth);if(!q)throw new _.O(_.P,4,4047,{message:"Video and audio are encrypted in an incompatible way.",hq:u?u.zc():void 0,audio:t?t.zc():void 0});return q});m=a.F.configurationId;n=lL(m,l,e,f,a.B);return p["return"](n)})},EL=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,t,u,y,C,D,B,E;return _.I(function(z){switch(z.a){case 1:c=_.ru,d=function(L){return L.stream.Sc()===c.VIDEO||L.stream.Sc()===c.AUDIO},e=b.filter(d),f=b.filter(function(L){return!d(L)}),
30
+ g=function(L){var J=L.stream.streams[0];L=Object.assign({},{playlist:L.playlist,qc:null},{language:J.language,channelsCount:J.channelsCount,spatialAudio:J.spatialAudio,closedCaptions:J.closedCaptions,primary:J.primary,kind:J.kind||null,groupId:J.groupId,type:J.type,codecs:J.codecs,name:J.originalId,uri:J.bd,Te:{width:J.width,height:J.height,frameRate:J.frameRate}});return HL(a,L)},k=[],l=_.v(e),m=l.next();case 2:if(m.done){z.C(4);break}n=m.value;p=k;q=p.push;return _.x(z,g(n),5);case 5:q.call(p,z.f);
31
+ m=l.next();z.C(2);break;case 4:t=[],u=_.v(f),m=u.next();case 6:if(m.done){z.C(8);break}y=m.value;C=t;D=C.push;return _.x(z,g(y),9);case 9:D.call(C,z.f);m=u.next();z.C(6);break;case 8:return IL(a,k.concat(t)),B=t.filter(function(L){return L.Sc()===c.zh}),E=t.filter(function(L){return L.Sc()===c.IMAGE}),z["return"]({textStreams:B,thumbStreams:E,pk:k})}})},IL=function(a,b){b.forEach(function(c){a.j.a.set(c.zc(),c)})},xL=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,t,u,y,C,D,B;return _.I(function(E){switch(E.a){case 1:return c=
32
+ _.Y,d=c.jo(b.Xc.closedCaptions),e=JL(a,b.Se),_.x(E,KL(a,b),2);case 2:return f=E.f,g=Object.values(f).flat().map(function(z){return z.playlist}),k=g[0],l=c.vj(k.$),a.w=l,l!==_.Ub&&(a.I=!0),LL(a,g),!AL(a)&&sL(g),a.L=c.wj(k.$),m=c.po(k.$,l,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay,a.a.liveRefreshPeriod),_.x(E,ML(a,f.Ih,e),3);case 3:return n=E.f,_.x(E,NL(a,f.Se,n,d),4);case 4:return p=E.f,_.x(E,OL(a,f.Xo,e),5);case 5:return q=E.f,_.x(E,PL(a,f.Dg),6);case 6:return t=E.f,u=a.F.configurationId,
33
+ y=lL(u,p,q,t,a.B),a.F.filterAllPeriods(y),C=_.ph(f.Se).concat(_.ph(f.Ih)).map(function(z){return z.playlist}),D=QL(a,C),B=RL(a,C,D),E["return"]({periods:y,Ao:D,ap:B,an:m})}})},TL=function(a,b){var c,d,e,f,g;return _.I(function(k){if(1==k.a)return c=_.zn(b.verbatimUri,a.o),_.x(k,SL(a,c),2);d=k.f;e=d.response;f=d.text;g=e.uri;return k["return"](vL(a,f,g,b.verbatimUri))})},yL=function(a,b){AL(a)||2!==a.a.timeline.version||(a.J||(a.J=b[0].startTime),_.DE(b,-a.J))},RL=function(a,b,c){b=b.find(function(g){return null!==
34
+ _.Y.ab(g.$,cK)});if(!b)return[];if(null===c)throw new _.O(_.P,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");var d=b.$.filter(function(g){return g.name===cK});b=new Map;d=_.v(d);for(var e=d.next();!e.done;e=d.next()){e=e.value;var f=_.T(e,"ID");f=f?b.get(f):void 0;(e=_.Y.ko(e,c,a.B,!AL(a),f))&&b.set(e.id,e)}return Array.from(b.values())},QL=function(a,b){var c=b.flatMap(function(e){return e.S[0].$});c=_.Y.ab(c,hK);if(!c)return null;var d=(new Date(c.value)).getTime();
35
+ return isNaN(d)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag value (value: "+(c.value+").")),null):d/1E3},KL=function(a,b){var c,d,e,f,g,k;return _.I(function(l){if(1==l.a)return _.x(l,Promise.all([UL(a,b.Xc.Hh),UL(a,b.Xc.Yo),UL(a,b.Se),UL(a,b.Dg)]),2);c=l.f;d=_.v(c);e=d.next().value;f=d.next().value;g=d.next().value;k=d.next().value;return l["return"]({Ih:e,Xo:f,Se:g,Dg:k})})},WL=function(a,b){return Promise.all(b.map(function(c){return VL(a,c)}))},JL=function(a,b){for(var c=_.Y.qf,d=new Map,
36
+ e=_.v(b),f=e.next();!f.done;f=e.next()){var g=f.value,k=_.T(g,_.ja);f=_.T(g,_.Tb);var l=_.T(g,_.Bb);g=XL(a,g);if(l){var m=_.Mp(_.Cn,g);d.set(c(_.Cn,l),m);l=g.indexOf(m);-1<l&&g.splice(l,1)}k&&(l=YL(_.Sc,g),d.set(c(_.Sc,k),l));f&&(k=YL(_.Sg,g),d.set(c(_.Sg,f),k))}return d},OL=function(a,b,c){return Promise.all(b.map(function(d){return ZL(a,d,c)}))},PL=function(a,b){return Promise.all(b.map(function(c){return $L(a,c)}))},ML=function(a,b,c){var d,e;return _.I(function(f){if(1==f.a){if(0===b.length)return f["return"](new Map);
37
+ d=[ZL(a,b[0],c)];return _.x(f,d[0],2)}if(3!=f.a)return d=d.concat(b.slice(1).map(function(g){return ZL(a,g,c)})),_.x(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.bp(e))})},NL=function(a,b,c,d){var e,f,g,k,l,m,n,p,q,t,u;return _.I(function(y){if(1==y.a){e=new Set;f=_.ph(b).concat();g=0;k=Infinity;for(l=0;l<f.length;++l)m=Number(_.Qp(f[l].tag,_.oa)),m<k&&(k=m,g=l);n=f.splice(g,1).pop();return _.x(y,aM(a,n,c,d,e),2)}if(3!=y.a)return p=y.f,q=f.map(function(C){return aM(a,C,c,d,e)}),_.x(y,Promise.all(q),
38
+ 3);t=y.f;t.splice(g,0,p);u=t.reduce(_.vC,[]);return y["return"](u)})},bM=function(a,b,c){var d;return _.I(function(e){if(1==e.a)return _.x(e,HL(a,{playlist:c,codecs:b.codecs,type:b.type,Gd:b.originalLanguage,qc:b.id,groupId:b.groupId,primary:b.primary,kind:b.kind||null,name:b.label,channelsCount:b.channelsCount,spatialAudio:b.spatialAudio||!1,closedCaptions:b.closedCaptions,Te:{width:b.width,height:b.height,frameRate:b.frameRate}}),2);d=e.f;b.bandwidth&&aL(d,b.bandwidth);return e["return"](d)})},
39
+ aM=function(a,b,c,d,e){var f,g,k,l,m,n;return _.I(function(p){return 1==p.a?(f=_.Y,g=b,k=g.tag,l=Number(_.Qp(k,_.oa)),m=f.so(k),_.x(p,cM(a,b,m,c,d),2)):(n=p.f)?p["return"](dM(a,n,l,e)):p["return"]([])})},eM=function(a,b,c,d,e,f){var g=XL(a,b);a.g.debug("Guessing stream type for",b.toString());b=!1;var k=_.Mp(_.Sg,g),l=d+e;1!==g.length||c||k?!l&&1<g.length?(a.g.debug("Guessing multiplexed audio+video"),c=_.Sg,g=[g.join(",")]):d&&f?(a.g.debug(jK),c=_.Sc,b=!0):e?(a.g.debug(jK),c=_.Sc):(a.g.debug("Guessing video-only"),
40
+ c=_.Sg):(c=_.Sc,a.g.debug(jK));return{type:c,nk:g,Jm:b}},cM=function(a,b,c,d,e){var f,g,k,l,m,n,p,q,t,u,y,C,D,B,E,z,L;return _.I(function(J){if(1==J.a)return f=_.ru,g=_.Y.qf,k=b,l=k.tag,m=k.playlist,n=_.T(l,_.ja),p=_.T(l,_.Tb),q=n?d.get(g(f.AUDIO,n))||[]:[],t=p?d.get(g(f.VIDEO,p))||[]:[],u={audio:q,video:t},y=m.verbatimUri,C=u.audio.find(function(V){return V.zc()===y}),D=eM(a,l,c,u.audio.length,u.video.length,C),B=D.type,E=D.nk,z=D.Jm,L=null,z?J.C(2):_.x(J,fM(a,b,E,B,e,c),3);2!=J.a&&(L=J.f);if(null==
41
+ L)return J["return"](null);u[B]=[L];B===f.AUDIO&&c&&u.video.forEach(function(V){YK(V,c.width);ZK(V,c.height);$K(V,c.frameRate)});return J["return"](u)})},dM=function(a,b,c,d){var e=b.video,f=b.audio;e=0<e.length?e:[null];b=[];f=_.v(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var k=_.v(e),l=k.next();!l.done;l=k.next()){var m=l.value;l=_.Y.Rl(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):(m=FL(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):
42
+ (b.push(m),d.add(l)))}}return b},FL=function(a,b,c,d,e){for(var f=[],g=(c||b).length(),k=0;k<g;k++){var l=b?b.streams[k]||null:null,m=c?c.streams[k]||null:null,n=_.Y.om(l,m);if(!n)return null;var p=d;l={id:e?e:a.h++,language:l?l.language:_.Hg,primary:!!l&&l.primary||!!m&&m.primary,audio:l,video:m,bandwidth:p,drmInfos:n,allowedByApplication:!0,allowedByKeySystem:!0};f.push(l)}return new dL(f)},ZL=function(a,b,c){var d,e,f,g;return _.I(function(k){d=b;e=d.tag;f=d.playlist;g=f.verbatimUri;return k["return"](gM(a,
43
+ g,function(){var l,m,n,p,q,t,u,y,C,D,B,E,z;return _.I(function(L){if(1==L.a){l=_.ru;m=_.Y.qf;n=_.Qp(e,_.Qa);p=_.Y.di(_.Qp(e,_.Kb));q=_.Y.Nl(e);t=c.get(m(p,n))||"";u=_.T(e,_.$a);y=_.T(e,_.gb);C=_.T(e,"DEFAULT");D=p===l.AUDIO?_.Y.xi(e):null;var J=p===l.AUDIO?(J=_.T(e,"CHANNELS"))?J.includes("/JOC"):!1:!1;B=J;E="YES"===C;return _.x(L,HL(a,{playlist:f,codecs:t,type:p,Gd:u,primary:E,name:y,channelsCount:D,spatialAudio:B,groupId:n,kind:q,qc:null,closedCaptions:null,Te:null}),2)}z=L.f;return L["return"](z)})}))})},
44
+ $L=function(a,b){var c,d,e,f;return _.I(function(g){c=b;d=c.tag;e=c.playlist;f=e.verbatimUri;return g["return"](gM(a,f,function(){var k,l,m,n,p;return _.I(function(q){if(1==q.a)return k=_.T(d,_.ua)||"jpg",l=_.T(d,_.$a),m=_.T(d,_.gb),_.x(q,HL(a,{playlist:e,codecs:k,type:_.Ae,Gd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,qc:null,groupId:null,Te:null}),2);n=q.f;(p=_.T(d,_.oa))&&aL(n,Number(p));return q["return"](n)})}))})},XL=function(a,b){var c=_.T(b,_.ua,a.a.hlsDefaultCodecs||
45
+ "avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);c=_.Y.Vl(c);var d=new Set,e=[];c=_.v(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.BC(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},fM=function(a,b,c,d,e,f){var g,k,l,m,n;return _.I(function(p){g=b;k=g.tag;l=g.playlist;m=_.ru;n=l.verbatimUri;return p["return"](gM(a,n,function(){var q,t,u,y,C;return _.I(function(D){if(1==D.a){q=_.T(k,_.sa);t=null;d===m.VIDEO&&q&&"NONE"!==q&&(t=e.get(q));var B=_.T(k,_.ja)||void 0;
46
+ u=B&&a.K.has(B)?B:void 0;B=YL(d,c);if(u){var E=YL(_.Sc,c);B+=","+E}y=B;return _.x(D,HL(a,{playlist:l,codecs:y,type:d,closedCaptions:t,primary:!1,kind:null,Gd:null,name:null,channelsCount:null,spatialAudio:!1,qc:null,groupId:null,muxedAudioId:u,Te:f}),2)}C=D.f;return D["return"](C)})}))})},gM=function(a,b,c){if(a.j.has(b))return a=a.j.get(b),Promise.resolve(a);if(a.j.f.has(b))return a.j.f.get(b)||null;c=c();a.j.set(b,c);return c},HL=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,t,u,y,C,D,B,E,z,L,J,V,U,ta;
47
+ return _.I(function(wa){if(1==wa.a){c=hM;d=iM;e=_.ru;f=b;g=f.playlist;k=f.codecs;l=f.type;m=f.Gd;n=f.qc;p=f.groupId;q=f.muxedAudioId;t=f.primary;u=f.kind;y=f.name;C=f.channelsCount;D=f.spatialAudio;B=f.closedCaptions;E=f.Te;z=_.Y.Bi(m);if(1!==g.type)throw new _.O(_.P,4,4017);return _.x(wa,jM(a,g,l,k),2)}L=wa.f;J=a.a.lowLatencyMode?d.$j:d.bk;V=u;l!==e.TEXT||u||(V=_.og);U=_.Y.vj(g.$);ta=L.map(function(qa){var za=qa.S,Fa=qa.Xl,Ya=qa.mimeType,ec=qa.ka,qd=za[0].startTime,rd=za[za.length-1].endTime,dk=
48
+ rd-qd,tc=new _.LD(za),Pe=za[0].initSegment||null;return{id:null==n?_.aK++:n,originalId:y,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:tc.nf.bind(tc),getSegmentReference:tc.get.bind(tc),adjustSegmentDurations:tc.lg.bind(tc),getDuration:tc.getDuration.bind(tc),segmentIndex:tc,segmentLookupStrategy:J,initSegmentReference:Pe,mimeType:Ya,codecs:k,kind:V,ki:Fa.type,encrypted:Fa.type===c.ek,aesEncrypted:qa.aesEncrypted,keyId:Fa.keyId,language:z,originalLanguage:m||_.Hg,label:y,type:l,
49
+ primary:t,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:E?E.frameRate:void 0,width:E?E.width:void 0,height:E?E.height:void 0,bandwidth:void 0,roles:[],channelsCount:C,spatialAudio:D,closedCaptions:B,S:za,drmInfos:Fa.drmInfos,ka:ec,bd:g.verbatimUri,jg:g.a,Bc:qd,Cf:rd,duration:dk,groupId:p,Yp:U,muxedAudioId:q}});return wa["return"](new WK(ta))})},UL=function(a,b){var c;return _.I(function(d){if(1==d.a)return _.x(d,Promise.all(b.map(function(e){var f;return _.I(function(g){if(1==g.a)return _.x(g,
50
+ kM(a,e),2);f=g.f;return g["return"](f?{tag:e,playlist:f}:null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},kM=function(a,b){var c,d,e,f,g,k,l,m,n;return _.I(function(p){if(1==p.a){c=_.Y.Vm(b);d=_.T(b,_.Mb,void 0,{required:c});if(!d)return p["return"](null);e=_.zn(d,a.o);f=Date.now();return _.x(p,SL(a,e),2)}g=p.f;k=g.response;l=g.text;m=Date.now();a.F.onEvent(new _.Q(oK,{detail:{duration:m-f,type:"media"}}));n=k.uri;return p["return"](vL(a,l,n,d))})},VL=function(a,b){var c,d,e,f,g,k,l,m;
51
+ return _.I(function(n){if(1==n.a){var p=new URL(b.streams[0].jg);if(a.a.lowLatencyMode&&a.L&&a.L.Nh){var q=b.streams[b.streams.length-1].segmentIndex;if(q=q.a[q.a.length-1]){var t=q.a,u=t.length-1;q={dn:q.position,uo:t&&0<t.length?u:null}}else q=null;q&&(t=p.searchParams,u=q.uo,t.set("_HLS_msn",q.dn.toString()),null===u&&t.get(mK)&&t["delete"](mK),null!==u&&t.set(mK,u.toString()))}c=p.toString();return _.x(n,SL(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.zc();k=b.streams[0].jg;l=e.uri;k!==l&&(k=l,XK(b,
52
+ k));m=vL(a,f,k,g);return n["return"]({stream:b,playlist:m})})},vL=function(a,b,c,d){a=DK(a.W,b,c);a.verbatimUri=d;return a},lM=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.O(_.P,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},zL=function(a,b,c,d){var e=!0,f=null,g=0;AL(a)||(e=!1,f=0,g=b);b=a.a.timeline||{};b.type=void 0;a=new _.oD(b,f,g,!0,void 0,!!a.a.lowLatencyMode);_.rD(a,e);mM(a,c);d&&_.qD(a,
53
+ d);return a},nM=function(a,b,c){a=_.Y.yc(a.$,fK);if(1<a.length)throw new _.O(_.P,4,4020);a=a[0];if(!a)return null;var d=_.Qp(a,_.Mb),e=_.zn(d,b);b=_.Y.sj(a,null,!0);return new _.LC(function(){return[e]},b.la,b.fa,c)},oM=function(a,b,c,d,e,f,g){for(var k=[],l={},m=0;m<b.f.length;l={bg:l.bg},m++){var n=b.f[m],p=0===m,q=p?a:k[k.length-1],t=p?d:q.endTime,u=Number(_.T(n,_.Ia));u=t+u;p=_.Y.sj(n,p?null:q.fa,p);q=String(_.T(n,_.Mb));q=_.zn(q,g);l.bg=q?[q]:[];t=new _.Tp(c,t,u,function(y){return function(){return y.bg}}(l),
54
+ p.la,p.fa,e,f,!1,null,null,null,null);if("YES"===_.T(n,"INDEPENDENT")||0===m)t.h=!0;k.push(t)}return k},pM=function(a,b,c,d,e,f,g,k,l,m,n){var p=c.$,q=c.a;0<_.Y.yc(p,fK).length&&(n=nM(c,l,g));var t=null!=q,u=q?[q]:[];if(!t&&!a.a.lowLatencyMode)return null;a=0;q={la:0,fa:null};var y=null;t?(c=_.Y.uj(p).duration,a=e+c,q=_.Y.tj(p,b?b.fa:null)):(b=oM(b,c,d,e,f,g,l),a=b[b.length-1].endTime,y=b);k=k===_.Ae?_.Y.ro(p):null;d=new _.Tp(d,e,a,function(){return u},q.la,q.fa,f,g,!1,null,k?k.se:null,k?k.Re:null,
55
+ k?k.durationPerTile:null,y,n);d.ka=m;return d},jM=function(a,b,c,d){var e,f,g,k,l,m,n,p,q,t,u,y,C,D,B;return _.I(function(E){switch(E.a){case 1:e=_.Y;f=qM;g=b.verbatimUri;k=b.S;l=e.um(b.$,gK);m=[];n=null;if(!a.I){E.C(2);break}a.I=!1;p=a.B;q=a;return _.x(E,rM(a,b.a,g,k,l,c,d),3);case 3:q.B=E.f,null!=p&&(n=a.B-p);case 2:t=l,u=f.Vo(k),y=0;case 4:if(!(y<u.length)){E.C(6);break}C=u[y];D=m[m.length-1]||null;return _.x(E,sM(a,b.a,C,t,c,d,D,n),7);case 7:B=E.f;m.push(B);t+=C.length;y++;E.C(4);break;case 6:return lM(m),
56
+ E["return"](m)}})},rM=function(a,b,c,d,e,f,g){var k,l,m,n,p,q,t,u,y,C,D;return _.I(function(B){if(1==B.a){k=d[0];if(!AL(a)&&a.f)try{return l=tM(a,c,e),B["return"](l)}catch(E){if(m=a.j.get(c))n=m.streams[0].S[0].position,B=m.streams[m.streams.length-1].S,p=B[B.length-1].position,q=e,t=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+" - "+p+(", new values "+q+" - "+t+"."),b,m);throw new _.O(_.P,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});
57
+ }return _.x(B,uM(a,f,g,k),2)}if(3!=B.a)return u=B.f,y=vM.pj(k.$,a.o,e),C=nM(k,b,y),_.x(B,wM(a,C,k,y,u,g),3);D=B.f;a.g.debug("Setting playlist start time to "+D+".");return B["return"](D)})},sM=function(a,b,c,d,e,f,g,k){var l,m,n,p,q,t,u,y,C,D,B,E,z,L,J,V,U,ta,wa,qa,za;return _.I(function(Fa){if(1==Fa.a)return l=vM,m=c[0],_.x(Fa,uM(a,e,f,m),2);if(3!=Fa.a)return n=Fa.f,p=l.mo(c,n,g?g.Zm:null),q=p[p.length-1],t=vM.ta(p),u=g?g.$m:null,y=xM(u,m.$,a.o,d),C=nM(m,b,y)||(g?g.Lm:null),D=m.ka,B=null==g,_.x(Fa,
58
+ yM(a,D,C,m,d,y,n,f,k,B),3);E=Fa.f;z=[];L=!1;for(J=0;J<c.length;J++)if(V=c[J],U=z[z.length-1]||null,ta=0===J?0:U.endTime,wa=d+J,(u=qa=xM(u,V.$,a.o,wa))&&(L=!0),za=pM(a,U,V,wa,ta,E,qa,e,b,D,C))C=za.initSegment,z.push(za);return Fa["return"]({S:z,Xl:t,Zm:q,aesEncrypted:L,mimeType:n,endTime:z[z.length-1].endTime,ka:D,Lm:C,$m:u})})},xM=function(a,b,c,d){return b.some(function(e){return e.name===eK&&"NONE"===_.T(e,kK)})?null:(b=vM.pj(b,c,d))?b:a&&a.generatedIv?Object.assign({},a,{iv:vM.wi(d)}):a},LL=function(a,
59
+ b){b.forEach(function(c){var d=a.j.get(c.verbatimUri);qM.tk(c,d,!AL(a))});qM.Sl(b)},yM=function(a,b,c,d,e,f,g,k,l,m){var n,p,q,t,u;return _.I(function(y){if(1==y.a)return a.D.has(b)&&m&&a.M&&null!=l&&(n=a.f.periods,p=n.filter(function(C){return C.ka<b}).map(function(C){return C.duration}).reduce(function(C,D){return C+D},0),q=l-p,t=a.D.get(b),a.D.set(b,t+q),a.M=!1),a.D.has(b)?y["return"](a.D.get(b)):_.x(y,wM(a,c,d,f,g,k),2);u=y.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(u+" s."));a.D.set(b,
60
+ u);return y["return"](u)})},wM=function(a,b,c,d,e,f){var g;return _.I(function(k){if(null==c.a)return k["return"](0);g=_.Y.Pl(c,d);return k["return"](VK(a.X,b,g,e,f,null!=d))})},tM=function(a,b,c){var d=zM(a,b,c);if(!d)throw new _.O(_.P,4,4030,"Segment not found in previous playlist update.");return a.f.periods.find(function(e){return e.ka===d.ka}).startTime+d.startTime},zM=function(a,b,c){return(a=a.j.get(b))?bL(a,c)||null:null},YL=function(a,b){if(1===b.length)return b[0];var c=_.Mp(a,b);if(null!=
61
+ c)return c;throw new _.O(_.P,4,4025,{codecList:b});},uM=function(a,b,c,d){var e,f,g;return _.I(function(k){e=d.a;g=(f=_.Y.ab(d.$,fK))?_.Qp(f,_.Mb):null;return k["return"](AM(a,b,c,e,g))})},AM=function(a,b,c,d,e){var f,g,k,l,m;return _.I(function(n){if(1==n.a){f=[d,e].filter(Boolean);if(g=_.Op(f,b,c))return n["return"](g);k=_.Zk([d],a.a.attemptParameters);k.method="HEAD";k.type=2;return _.x(n,a.tg(k),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.O(_.P,4,4021,"Unknown MIME type of: "+f.join(", "));
62
+ return n["return"](m.toLowerCase().split(";")[0])})},CL=function(a,b,c){c=_.Y.wm(c);"LIVE"===a.w||"EVENT"===a.w?(c=Math.max(c,b.K),isNaN(a.a.availabilityWindowOverride)||(c=a.a.availabilityWindowOverride),b.A=c):a.w===_.Ub&&(b.f=c)},BL=function(a){for(var b=0,c=_.v(a.j.values()),d=c.next();!d.done;d=c.next())b=Math.max(b,d.value.streams[0].Bc);for(c=0;95443.7176888889<=b;)c+=95443.7176888889,b-=95443.7176888889;if(c)for(a.g.debug("Offsetting live streams by",c,"to compensate for rollover"),b=_.v(a.j.values()),
63
+ d=b.next();!d.done;d=b.next())d=d.value.streams[0],95443.7176888889>d.Bc?(a.g.debug("Offset applied to",d.type),d.segmentIndex.offset(c)):a.g.debug("Offset NOT applied to",d.type)},SL=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Zk([b],a.a.attemptParameters),c.type=1,_.x(f,a.tg(c),2);d=f.f;e="";try{e=_.R.ga(d.data)}catch(g){throw new _.O(_.P,4,4042);}e=_.R.bj(e);e=e.trim();return f["return"]({text:e,response:d})})},AL=function(a){return a.w===_.Ub},mM=function(a,b){_.Y.Wm(b,
64
+ function(c,d){_.uD(a,c.S,d.startTime)});_.nD(a.a,b[0].startTime,b[b.length-1].endTime)},BM=function(){},iM={$j:_.VB,bk:_.UB},hM={ek:pK,Bp:"whole-segment",NONE:_.Ze},IK=/^#EXT-X-DEFINE/,JK=/^#(EXT-X-DISCONTINUITY-SEQUENCE|EXT-X-ENDLIST|EXT-X-I-FRAMES-ONLY|EXT-X-MEDIA-SEQUENCE|EXT-X-PART-INF|EXT-X-PLAYLIST-TYPE|EXT-X-SERVER-CONTROL|EXT-X-TARGETDURATION|EXT-X-DATERANGE|EXT-X-VERSION)/;_.r=LK.prototype;_.r.set=function(a,b){var c=this;this.f.set(a,b);return b.then(function(d){return c.a.set(a,d)})["catch"](function(){}).then(function(){return c.f["delete"](a)})};
65
+ _.r.has=function(a){return this.a.has(a)};_.r.get=function(a){return this.a.get(a)||null};_.r.values=function(){return Array.from(this.a.values())};_.r.clear=function(){this.f.clear();this.a.clear()};
66
+ var qM={Sl:function(a){var b=qM.hm(a),c=qM.Ym(a);a.forEach(function(d){var e=d.S,f=e.findIndex(function(k){return k.ka===b}),g=e.findIndex(function(k){return k.ka===c+1});-1===g&&(g=e.length);d.S=e.slice(f,g)})},tk:function(a,b,c){b=qM.tm(a,b,c);a=_.v(a.S||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.Tc(c.$,dK)&&b++,c.ka=b},tm:function(a,b,c){var d=_.Y.ab(a.$,"EXT-X-DISCONTINUITY-SEQUENCE");if(d)return Number(d.value);d=qM.Nm(b);if(c&&d)try{return qM.Km(a,b)}catch(e){throw new _.O(_.P,4,4024,
67
+ "EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}return 0},Nm:function(a){return 0<qM.vm(a)},Vo:function(a){if(0===a.length)return[];var b=[],c=[];a=_.v(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.Tc(d.$,dK)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},vm:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].S;return a[a.length-1].ka},Km:function(a,b){var c=_.Y.ab(a.$,gK);if(!c)throw qM.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),
68
+ Error(iK);c=Number(c.value);var d=bL(b,c);if(!d)throw qM.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(iK);return d.ka},Ym:function(a){a=a.map(function(b){return b.S[b.S.length-1].ka});return Math.min.apply(Math,_.ph(a))},hm:function(a){a=a.map(function(b){return b.S[0].ka});return Math.max.apply(Math,_.ph(a))}};qM.g=new _.M("clpp.hls.DiscontinuityUtils");var CM={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Tg)throw new _.O(_.P,4,4041);if(_.Qp(a,kK)===lK)throw new _.O(_.P,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.yC(_.Id,[{initDataType:_.eg,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":SK,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":SK,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.Qp(a,kK);if(!QK.includes(b))return RK.error("Widevine in HLS is only supported with [",
69
+ QK.join(", "),"], not",b),null;b=_.Qp(a,_.Mb);b=_.Qm(b);b=_.Qi(b.data);b=_.yC(_.Md,[{initDataType:_.ld,initData:b}],"");if(a=_.T(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},QK=["SAMPLE-AES",lK],RK=new _.M("clpp.hls.DrmParser");var vM={mo:function(a,b,c){if(_.Y.Tc(a[0].$,eK)||null===c)return c=vM.qj(a,b),0===c.length?[{type:_.Ze,drmInfos:[],keyId:null}]:c;a=vM.qj(a,b);return[c].concat(_.ph(a))},ta:function(a){if(0===a.length)return{type:_.Ze,drmInfos:[],keyId:null};if(a.some(function(c){return"whole-segment"===c.type})||a.every(function(c){return c.type===_.Ze}))return a[0];a=a.filter(function(c){return c.type===pK});var b=_.Mi(a.flatMap(function(c){return c.drmInfos}));return{keyId:a[a.length-1].keyId,type:pK,drmInfos:b}},
70
+ qj:function(a,b){return vM.am(a).map(function(c){return vM.oo(c.$,b)}).filter(Boolean)},am:function(a){return a.filter(function(b){return _.Y.Tc(b.$,eK)})},oo:function(a,b){var c=_.Y.yc(a,eK).filter(function(e){return"AES-128"!==_.Qp(e,kK)});if(0===c.length)return null;var d=_.Qp(c[0],kK);if(1===c.length&&"NONE"===d)return{type:_.Ze,drmInfos:[],keyId:null};d=c.map(function(e){return _.Qp(e,kK)});if(!d.every(function(e){return"SAMPLE-AES"===e})&&!d.every(function(e){return e===lK}))throw vM.g.warn("EXT-X-KEY methods "+
71
+ d.join(", ")+" are incompatible."),new _.O(_.P,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");c=c.map(function(e){var f=_.T(e,"KEYFORMAT","identity"),g=CM[f]||null;(e=g?g(e,b):null)||vM.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===c.length)throw new _.O(_.P,4,4026);return{keyId:c.map(function(e){return e.keyIds}).reduce(function(e,f){return e.concat(f)},[]).reverse()[0]||null,type:pK,drmInfos:c}},Vp:function(){return{type:_.Ze,drmInfos:[],keyId:null}},
72
+ pj:function(a,b,c){a=_.Y.yc(a,eK)[0];if(!a||"AES-128"!==_.Qp(a,kK))return null;var d=vM.mm(a,c);c=d.iv;d=d.generatedIv;return{method:"AES-128",url:_.zn(_.Qp(a,_.Mb),b),iv:c,generatedIv:d}},wi:function(a){return _.Pm(new Uint8Array(12),new Uint8Array([a>>24&255,a>>16&255,a>>8&255,a&255]))},mm:function(a,b){var c=_.T(a,"IV","");if(c)return{iv:_.Mm((c||"0x").slice(2)),generatedIv:!1};c=_.T(a,"KEYFORMAT");return null==c||"identity"===c?{iv:vM.wi(b),generatedIv:!0}:{iv:null,generatedIv:!1}}};vM.g=new _.M("clpp.hls.EncryptionUtils");WK.prototype.length=function(){return this.streams.length};WK.prototype.a=function(){return this.streams[0].groupId};WK.prototype.Sc=function(){return this.streams[0].type};WK.prototype.zc=function(){return this.streams[0].bd};dL.prototype.length=function(){return this.a.length};_.r=tL.prototype;_.r.configure=function(a){this.a=a;this.X.a=a};_.r.setCurrentVariant=function(){};_.r.start=function(a,b){var c=this,d,e,f,g,k,l,m;return _.I(function(n){if(1==n.a){if(c.P)throw Error("start() may be called only once!");c.P=!0;c.F=b;d=Date.now();return _.x(n,SL(c,a),2)}if(3!=n.a)return e=n.f,f=e.response,g=e.text,k=Date.now(),c.F.onEvent(new _.Q(oK,{detail:{duration:k-d,type:"master"}})),c.o=f.uri,_.x(n,DL(c,g),3);l=n.f;c.f=l;m=c.H;c.l&&0<m&&c.l.ia(m);return n["return"](l)})};
73
+ _.r.requestStop=function(){this.T=!0};_.r.stop=function(){this.l&&(this.l.stop(),this.l=null);var a=[];this.G&&(a.push(this.G.destroy()),this.G=null);this.j.clear();this.f=this.a=this.F=null;this.A.clear();this.K.clear();return Promise.all(a)};
74
+ _.r.update=function(){var a=this,b,c,d,e,f,g,k,l,m;return _.I(function(n){switch(n.a){case 1:b=a.f;if(AL(a)||!b)return n["return"]();c=b.presentationTimeline;d=Array.from(a.j.values());return _.x(n,WL(a,d),2);case 2:return e=n.f,f=e.map(function(p){return p.playlist}),LL(a,f),_.x(n,GL(a,e),3);case 3:g=n.f;fL(b.periods,g).forEach(function(p){a.F.filterNewPeriod(p)});yL(a,g);k=QL(a,f);l=RL(a,f,k);b.cues=uL(a,l);hL(b.periods,g);mM(c,g);if(m=_.Y.Hm(f))!0!==a.a.keepTimelineLive&&(a.w=_.Ub,_.rD(c,!0),c.f=
75
+ g[g.length-1].endTime),a.l.stop(),a.l=null;if(a.F.onUpdate)a.F.onUpdate(b);if(m&&a.F.onTurnedStatic)a.F.onTurnedStatic();if(!a.T){n.C(4);break}return _.x(n,a.stop(),4);case 4:return n["return"](b)}})};
76
+ _.r.loadVariant=function(a,b){var c=this,d,e,f,g,k,l,m,n,p,q,t,u,y,C,D;return _.I(function(B){if(1==B.a){d=a.id;if(e=c.f.periods.find(function(E){return E.id===b}))if(f=e.variants.find(function(E){return E.id===d}))return B["return"](f);g=c.f.alternativeVariants.find(function(E){return E.id===d});if(!g)throw new _.ui("No alternative variant with id: "+d);k=g;m=l=null;k.audio&&(n=k.audio,l=gM(c,n.verbatimUri,function(){var E;return _.I(function(z){if(1==z.a)return _.x(z,TL(c,n),2);E=z.f;return z["return"](bM(c,
77
+ n,E))})}));k.video&&(p=k.video,m=gM(c,p.verbatimUri,function(){var E;return _.I(function(z){if(1==z.a)return _.x(z,TL(c,p),2);E=z.f;return z["return"](bM(c,p,E))})}));return _.x(B,l,2)}if(3!=B.a)return q=B.f,_.x(B,m,3);t=B.f;if(u=FL(c,q,t,k.bandwidth,k.id))C=c.F.configurationId,D=lL(C,[u],[],[],0),c.F.filterAllPeriods(D),D.forEach(function(E,z){c.f.periods[z].variants.push(E.variants[0]);b===c.f.periods[z].id&&(y=E.variants[0])});if(!y)throw new _.ui("Could load variant with id: "+d);return B["return"](y)})};
78
+ _.r.loadTextStream=function(a,b){var c=this,d,e,f,g,k,l;return _.I(function(m){if(1==m.a){(e=c.f.periods.find(function(n){return n.id===b}))&&(f=e.textStreams.find(function(n){return n.id===a})||null)&&(d=f);if(d||!c.f.alternativeTextStreams)return m.C(2);g=c.f.alternativeTextStreams.find(function(n){return n.id===a})||null;if(!g)throw new _.ui(_.BB+a);k=g;return _.x(m,gM(c,k.verbatimUri,function(){var n;return _.I(function(p){if(1==p.a)return _.x(p,TL(c,k),2);n=p.f;LL(c,[n]);return p["return"](bM(c,
79
+ k,n))})}),3)}2!=m.a&&(l=m.f)&&c.f.periods.forEach(function(n,p){var q=l.streams[p];c.f.periods[p].textStreams.push(q);q.id===a&&(d=q)});if(!d)throw new _.ui(_.BB+a);return m["return"](d)})};_.r.mc=function(){var a=this,b,c;return _.I(function(d){if(1==d.a){a.g.debug(_.LB);if(!a.F)return d["return"]();_.F(d,2);return _.x(d,a.update(),4)}if(2!=d.a)return a.l&&0<a.H&&a.l.ia(a.H),_.G(d,0);b=_.H(d);if(!(b instanceof _.O))throw b;a.F&&(a.F.onError(b),c=b,1===c.severity&&a.l&&a.l.ia(.1));_.A(d)})};
80
+ _.r.tg=function(a){if(!this.G)throw new _.O(_.P,7,7001);a=this.F.networkingEngine.fetch(a);_.mm(this.G,a);return a.U};_.w(BM,_.av);BM.prototype.install=function(){_.Wv.m3u8=tL;_.Vv[_.Xl]=tL;_.Vv[nK]=tL};BM.prototype.uninstall=function(){_.jE("m3u8");_.kE(_.Xl);_.kE(nK)};BM.prototype.id=function(){return"hls"};_.K("clpp.hls.HlsComponent",BM);};
80
81
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
81
82
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
82
83
  else{_=this.clpp._;(f.call(g,this));}