@castlabs/prestoplay 6.9.0 → 6.11.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 (60) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +112 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +467 -432
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +143 -45
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +78 -73
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -31
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +276 -275
  17. package/cjs/cl.muxdata.js +14 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +71 -71
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +29 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -20
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +396 -365
  36. package/cl.crypto.js +9 -9
  37. package/cl.dash.js +68 -67
  38. package/cl.externs.js +139 -45
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +64 -61
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +26 -25
  43. package/cl.ima.js +17 -17
  44. package/cl.mse.js +240 -242
  45. package/cl.muxdata.js +12 -12
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +11 -11
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +59 -58
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -15
  58. package/clpp.styles.css +15 -0
  59. package/package.json +1 -1
  60. package/typings.d.ts +249 -21
package/cl.broadpeak.js CHANGED
@@ -1,5 +1,5 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var MM=function(){return!window.SmartLib||!window.GenericPlayerApi},NM=function(a,b){const c=b.analyticsAddress||null,d=b.nanoCDNHost||null,e=b.broadpeakDomainNames||"";b=b.uuid||null;a.g||(a.g=SmartLib.getInstance(),a.g.init(c,d,e),typeof b===_.me&&a.g.setUUID(b))},PM=function(a,b){b=b.customParameters||{};a.a=a.g.createStreamingSession();for(const c in b)a.a.setCustomParameter(c,b[c]);a.j.on(a.l,_.Yc,a.U.bind(a));a.h=OM(a.l);a.a.attachPlayer(a.h)},QM=function(a,b){_.Mf(a.j);a.f&&(a.f.release(),
2
- a.f=null);a.a&&(a.a.stopStreamingSession(b),a.a=null)},RM=class{constructor(a,b){this.l=a;this.f=b;this.a=new _.jo;this.g=!1}init(){const a=this.l,b=this.a;b.on(a,_.je,this.m.bind(this));b.on(a,_.ec,this.h.bind(this));b.on(a,"seek",this.j.bind(this))}h(a){a=a.detail;typeof a.bandwidth===_.r&&this.f.notifyLayerSwitch(a.bandwidth/1E3)}m(a){const b=this.l,c=this.f;a=a.detail;const d=a.currentState;a.previousState===_.zl&&c.notifyStallEnd(!b.isPaused());switch(d){case _.zl:c.notifyStallStart();break;
3
- case _.Hl:this.g?c.notifyResume():(c.notifyFirstImage(),this.g=!0);break;case _.Gl:c.notifyPause()}}j(){const a=1E3*this.l.getPosition();this.f.notifySeek(a)}release(){this.a&&(_.Mf(this.a),this.a=null)}};var OM=a=>{class b extends GenericPlayerApi{constructor(c){super();this.l=c;this.a=_.Bi()}getPlayerName(){return _.ma}getVersion(){return _.da}getOSName(){return this.a.os}getDeviceVersion(){return this.a.osVersion.name}getDeviceType(){return"browser"}getTotalDuration(){return this.l.isLive()?0:1E3*this.l.getDuration()}getCurrentPosition(){return 1E3*this.l.getPosition()}getCurrentBitrate(){const c=this.l.getStats();return(c?c.streamBandwidth:0)/1E3}}return new b(a)};var SM=class extends _.$p{constructor(){super();this.h=this.f=this.a=this.g=this.l=null;this.j=new _.jo}onPlayerCreated(a){this.l=a}onContentWillLoad(a,b){const c=a.getConfiguration().broadpeak;if(c){if(MM())return a.onError(new _.H(1,9,11E3));NM(this,c);PM(this,c);return this.a.getURL(b.url).then(d=>{if(d.isError()){const e=d.getDetailedErrorCode();d=d.getDetailedErrorMessage();this.l.onError(new _.H(1,9,11001,{bpkErrorCode:e,message:d}));QM(this,void 0)}else b.url=d.getURL(),this.f=new RM(this.l,
4
- this.h),this.f.init()})}}U(a){a=a.detail;if(7003===a.code)QM(this,SmartLib.BPFormatNotSupportedError);else if(a.severity===_.G)switch(a.category){case 3:QM(this,SmartLib.BPDecodingError);break;case 1:QM(this,SmartLib.BPNetworkingError);break;case 6:QM(this,SmartLib.BPAccessRightError);break;default:QM(this,SmartLib.BPUnspecifiedError)}}onPlayerWillRelease(){MM()||QM(this,SmartLib.BPSessionEndsNormally)}id(){return"broadpeak"}};_.z("clpp.broadpeak.BroadpeakPlugin",SM);SM.isSdkMissing=MM;SM.Id="broadpeak";
5
- _.Hm(new class{create(){return new SM}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var pO=function(){return!window.SmartLib||!window.GenericPlayerApi},qO=function(a,b){const c=b.analyticsAddress||null,d=b.nanoCDNHost||null,e=b.broadpeakDomainNames||"";b=b.uuid||null;a.g||(a.g=SmartLib.getInstance(),a.g.init(c,d,e),typeof b===_.Je&&a.g.setUUID(b))},sO=function(a,b){b=b.customParameters||{};a.a=a.g.createStreamingSession();for(const c in b)a.a.setCustomParameter(c,b[c]);a.l.on(a.m,_.ld,a.U.bind(a));a.j=rO(a.m);a.a.attachPlayer(a.j)},tO=function(a,b){_.jg(a.l);a.f&&(a.f.release(),
2
+ a.f=null);a.a&&(a.a.stopStreamingSession(b),a.a=null)},uO=class{constructor(a,b){this.m=a;this.f=b;this.a=new _.vp;this.g=!1}init(){const a=this.m,b=this.a;b.on(a,_.Ge,this.o.bind(this));b.on(a,_.mc,this.j.bind(this));b.on(a,"seek",this.l.bind(this))}j(a){a=a.detail;typeof a.bandwidth===_.r&&this.f.notifyLayerSwitch(a.bandwidth/1E3)}o(a){const b=this.m,c=this.f;a=a.detail;const d=a.currentState;a.previousState===_.vm&&c.notifyStallEnd(!b.isPaused());switch(d){case _.vm:c.notifyStallStart();break;
3
+ case _.Dm:this.g?c.notifyResume():(c.notifyFirstImage(),this.g=!0);break;case _.Cm:c.notifyPause()}}l(){const a=1E3*this.m.getPosition();this.f.notifySeek(a)}release(){this.a&&(_.jg(this.a),this.a=null)}};var rO=a=>{class b extends GenericPlayerApi{constructor(c){super();this.m=c;this.a=_.cj()}getPlayerName(){return _.na}getVersion(){return _.da}getOSName(){return this.a.os}getDeviceVersion(){return this.a.osVersion.name}getDeviceType(){return"browser"}getTotalDuration(){return this.m.isLive()?0:1E3*this.m.getDuration()}getCurrentPosition(){return 1E3*this.m.getPosition()}getCurrentBitrate(){const c=this.m.getStats();return(c?c.streamBandwidth:0)/1E3}}return new b(a)};var vO=class extends _.rr{constructor(){super();this.j=this.f=this.a=this.g=this.m=null;this.l=new _.vp}onPlayerCreated(a){this.m=a}onContentWillLoad(a,b){const c=a.getConfiguration().broadpeak;if(c){if(pO())return a.onError(new _.H(1,9,11E3));qO(this,c);sO(this,c);return this.a.getURL(b.url).then(d=>{if(d.isError()){const e=d.getDetailedErrorCode();d=d.getDetailedErrorMessage();this.m.onError(new _.H(1,9,11001,{bpkErrorCode:e,message:d}));tO(this,void 0)}else b.url=d.getURL(),this.f=new uO(this.m,
4
+ this.j),this.f.init()})}}U(a){a=a.detail;if(7003===a.code)tO(this,SmartLib.BPFormatNotSupportedError);else if(a.severity===_.G)switch(a.category){case 3:tO(this,SmartLib.BPDecodingError);break;case 1:tO(this,SmartLib.BPNetworkingError);break;case 6:tO(this,SmartLib.BPAccessRightError);break;default:tO(this,SmartLib.BPUnspecifiedError)}}onPlayerWillRelease(){pO()||tO(this,SmartLib.BPSessionEndsNormally)}id(){return"broadpeak"}};_.z("clpp.broadpeak.BroadpeakPlugin",vO);vO.isSdkMissing=pO;vO.Id="broadpeak";
5
+ _.En(new class{create(){return new vO}});};f.call(g, window);
package/cl.cast.js CHANGED
@@ -1,88 +1,88 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var mL="Cannot seek during ads playout.",nL="Cannot switch track",oL="Media session does not exist.",pL="No receivers available",qL="Reset ABR functionality not available on cast.",rL="SDK not yet ready",sL="Sender is destroyed.",tL="clpp.cast.CastProxy",uL="clpp.cast.Player",vL="clpp.cast.Receiver",wL="urn:x-cast:castlabs",xL="urn:x-cast:com.google.cast.media",yL=function(a){return _.y(function*(){yield _.Lm(a,_.Fd);yield _.Lm(a,_.Ed)})},zL=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.$c){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Bd?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.r?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},AL=function(a){if(typeof a!==_.me)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},BL=function(a,b,c,d){return _.y(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
3
- null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Sh(d,a.mimeType,g);f&&g&&(h=_.jh(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.I(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},CL=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,
4
- d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.Je:return d.FMP4;case _.He:return b===_.L?d.MPEG2_TS:c.TS;case _.Zb:return c.AAC;case _.$b:return c.AC3;case _.ac:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.bc:return c.FMP4}},EL=function(a){a=void 0===a?DL:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.H(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
5
- b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},FL=function(a,b){return a.g.filter(c=>c.type===b)},HL=function(a,b){const c=GL(a);return FL(a,b).find(d=>c.includes(d.id))||null},JL=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.J){const e=a.oa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
- d.editTracksInfo(c,()=>{a.f[b]=null;IL(a,b)},e=>{a.f[b]=null;a.h.debug(nL,e)})}else b===_.J&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{IL(a,b)},e=>{a.h.debug(nL,e)}))},GL=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},IL=function(a,b){b===_.K?a.a.trigger(new _.F(_.Pi)):b===_.J&&a.a.trigger(new _.F(_.Qi))},ML=function(a){if(a)for(const b of KL)LL(b)},LL=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
- cast.framework&&cast.framework.CastContext&&a.V.length){a.w=!0;a.o.ee();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.V;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba);NL&&a.o.da(.02)}},OL=function(a){return _.y(function*(){KL.delete(a);if(a.w){a.w=!1;var b=
8
- cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.h&&(b.push(a.h.destroy()),a.h=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.T=null;a.Y=null})},PL=function(a){return _.y(function*(){a.ib()||(yield cast.framework.CastContext.getInstance().requestSession())})},RL=function(a,b,c){c=
9
- void 0===c?0:c;return _.y(function*(){var d=a.f.oa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.na())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield QL(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Wd:a.getPresentationStartTime(),autoplay:b,Na:a.g})})},QL=function(a,b){return _.y(function*(){var c=chrome.cast.media.StreamType;yield PL(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
10
- b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=CL(b.Bb,_.L);e.hlsSegmentFormat=CL(c,_.K);b.Na&&(a.M&&(c=yield Promise.resolve(a.M(b.Na)))&&(b.Na=c),a.g=b.Na,a.C=_.Kl(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Na.remoteTextTracks&&(c=yield Promise.all(b.Na.remoteTextTracks.map(a.La.bind(a))),e.tracks=c.filter(k=>k),b.Na.remoteTextTracks=void 0),delete b.Na.autoplay,b.Na.startTime=null,e.customData={playerConfiguration:zL(b.Na)});c=a.cb()||{};
11
- var f=SL(c.metadataType),g;typeof b.Wd===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.Wd});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=TL(c);if(g=UL(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.fc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},UL=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(VL);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=EL(VL[b]);return Object.assign(b,a)},SL=function(a){var b=void 0===b?DL:b;return Object.values(VL).includes(a)?a:b},TL=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},XL=function(a,b){WL(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(wL,a.R)},YL=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=
13
- null;a=null===a?null:a+b;return null===a?b:a},WL=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.m=null,a.m=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.m),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ma.bind(a)),a.f&&a.f.load(),a.h&&a.h.init(),a.trigger(new _.F(_.od)))},aM=function(a){return new ZL(a.h,()=>{a.trigger(new _.F(_.pc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-
14
- 1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.pe&&(d.preferredAudioLanguage=c.pe);c.$e&&(d.preferredTextLanguage=c.$e);_.Nm(a.f,null);a.trigger(new _.F("castingended"));a.j(b,d)}},()=>$L(a))},$L=function(a){return _.y(function*(){a.trigger(new _.F(_.oc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Nm(a.f,a.a))})},dM=function(a,b,c){return _.y(function*(){var d=b.adTagUrl;if(d)try{bM=!1;const e=_.jh(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.Eg(f.data),h=(new DOMParser).parseFromString(g,
15
- _.te);if(h.getElementsByTagName("vmap:VMAP").length)_.D("VMAP detected."),a.vmapAdsRequest=cM(g);else if(h.getElementsByTagName("VAST").length){_.D("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=cM(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.D("Unsupported schema."),bM=!0}}catch(e){_.D("Failed to fetch an ad",e),bM=!0}})},cM=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
- a;return b},eM=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.l.onError(b)},fM=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},hM=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=gM(a,c))&&(d={ad:c});a.l.trigger(new _.F(b,d))}},gM=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.me&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
- _.me&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Y(d,e,b.index,b.total,f)}return c},iM=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},jM=function(a){const b=
18
- a.dashTimedMetadata;let c=_.Ae;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.ze)?_.Qf:_.Of,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},kM=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},mM=function(a){a.a=kM().getTextTracksManager();const b=a.a.getTracks();a.j=lM(_.J,b)},lM=function(a,b){const c=[];for(const d of b)b=new _.xh(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
19
- null,b.language=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.Fh(b.id,b)),c.push(b);return c},nM=function(a,b,c,d){c=_.Yf(c).filter(g=>g);var e=!1;let f=[];b===_.K?f=a.getAudioTracks():b===_.J&&(f=a.ja());if(c=c.find(g=>{const h=_.rg(g);return f.some(k=>{k=_.rg(k.language||"");return _.sg(h,k)})})){const g=_.rg(c);c=f.filter(h=>
20
- {h=_.rg(h.language||"");return _.sg(g,h)});f=c.length?c:f;e=e||!!c.length}_.Ng(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.K?a.ta(e):b===_.J&&a.Da(e))},oM=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},rM=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=
21
- a.drm,e=_.oj(d);if(e){var f=[_.Hc];_.Kl(a)[0].type!==_.Xb&&f.unshift(_.Ic);d.preferredDrmSystem===_.Hc&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Pa[g];h?(c=g===_.Ic?cast.framework.ContentProtection.WIDEVINE:g===_.Hc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},pM(b,h,a,c),qM(b,h,a,c)):c()}else c()}else c()},pM=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.jh({method:"POST",
22
- uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},qM=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.y(function*(){const g=_.kh(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.I(g.data)}):a.licenseHandler=
23
- void 0},uM=function(){return sM||(sM=new tM)},vM=function(){return cast.framework.CastReceiverContext.getInstance()},xM=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=vM();var {hlsVideoSegmentFormat:d}=vM().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Je:_.He;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=wM(f,_.ka),
24
- h=wM(f,_.Ya);let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},wM=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),0<=d&&(c=c.substring(0,d))));return c},zM=function(a,b){let c=null;const d=yM(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},yM=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
- let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Y(d,c,g,e,f)}return b},AM=class{constructor(a,b){this.log=new _.O(b);this.f=a;this.m=null;this.h=_.El;this.o=_.mp;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.El)}destroy(){this.m=
26
- this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.G&&this.a(_.Dl)}a(a){if(a!==this.h)if(this.h===_.Dl&&a!==_.El)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.h;this.h=a;this.h===_.zl?(this.B=b,this.f.trigger(new _.F(_.ic,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.zl&&this.f.trigger(new _.F(_.hc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-
27
- this.C};this.C=b;this.m&&_.nl(this.m,this.h);this.f.trigger(new _.F(_.je,{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var DL=0,VL={GENERIC:DL,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var BM=class extends AM{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.g=null;this.A=this.yb.bind(this)}init(){const a=this.f,b=a.a;b&&(this.g&&this.g.removeUpdateListener(this.A),this.g=b,this.g.addUpdateListener(this.A),this.w=a.m)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.y(function*(){a.g&&(a.g.removeUpdateListener(a.A),a.g=null);yield b().call(a)})}a(a){const b=this.f.m;b&&b.isPlayingBreak||super.a(a)}yb(){if(this.g&&
28
- this.w&&!this.w.isPlayingBreak)switch(this.g.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.g.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.wl);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Dl);break;default:this.a(_.El)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Hl);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Gl);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.zl)}}};var Z=class extends _.P{constructor(){super();this.h=new _.O("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.L;break;case chrome.cast.media.TrackType.AUDIO:c=_.K;break;case chrome.cast.media.TrackType.TEXT:c=_.J}c=new _.xh(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
- c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.Fh(c.id,c));return c}):[],this.a.trigger(new _.F(_.Qo)))}destroy(){this.a=null}getVideoTracks(){return FL(this,_.L)}getAudioTracks(){return FL(this,_.K)}ja(){return FL(this,_.J)}ia(){const a=this.Ia();return a?a.renditions[0]:null}Fa(){const a=this.na();return a?a.renditions[0]:null}Ga(){const a=this.oa();return a?a.renditions[0]:
30
- null}Ra(){return this.f[_.L]||null}eb(){return this.f[_.K]||null}fb(){return this.f[_.J]||null}Ia(){return HL(this,_.L)}na(){return HL(this,_.K)}oa(){return HL(this,_.J)}Wa(a){JL(this,_.L,a)}ta(a){JL(this,_.K,a)}Da(a){JL(this,_.J,a)}Va(a){this.Wa(a&&a.track)}kb(a){this.ta(a&&a.track)}lb(a){this.Da(a&&a.track)}addTextTrack(){return _.y(function*(){})}la(){return!0}};Z.prototype.isAbrEnabled=Z.prototype.la;Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.lb;
31
- Z.prototype.setAudioRendition=Z.prototype.kb;Z.prototype.setVideoRendition=Z.prototype.Va;Z.prototype.setTextTrack=Z.prototype.Da;Z.prototype.setAudioTrack=Z.prototype.ta;Z.prototype.setVideoTrack=Z.prototype.Wa;Z.prototype.getTextTrack=Z.prototype.oa;Z.prototype.getAudioTrack=Z.prototype.na;Z.prototype.getVideoTrack=Z.prototype.Ia;Z.prototype.getLoadingTextRendition=Z.prototype.fb;Z.prototype.getLoadingAudioRendition=Z.prototype.eb;Z.prototype.getLoadingVideoRendition=Z.prototype.Ra;
32
- Z.prototype.getTextRendition=Z.prototype.Ga;Z.prototype.getAudioRendition=Z.prototype.Fa;Z.prototype.getVideoRendition=Z.prototype.ia;Z.prototype.getTextTracks=Z.prototype.ja;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var ZL=class extends _.So{constructor(a,b,c,d){super();this.j=new _.O(_.yc);this.V=a;this.o=new _.Yh(b);this.T=c;this.Y=d;this.g=this.I=_.$i();this.C=[];this.B=0;this.K=new _.Em;this.G=this.m=this.a=null;this.A=this.w=!1;this.aa="";this.ga=1E6;this.f=new Z;this.f.initialize(this);this.h=new BM(this);this.H=new _.jo;this.J=null;this.F=new Set;this.N=this.Ya.bind(this);this.ba=this.ab.bind(this);this.W=this.$a.bind(this);this.R=this.Za.bind(this);this.M=null;window.cast||Object.defineProperty(window,
33
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{ML(!0)},0)}});LL(this);KL.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.h&&this.h.release()})}destroy(){return _.y(function*(){})}Pc(a){this.M=a}Yb(){return this.w}ib(){return this.A}Cd(){return this.aa}sendMessage(a,b){const c=this;return _.y(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
34
- if(e)try{yield e.sendMessage(a,zL(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.y(function*(){if(!a.Yb())throw a.j.warn(rL),new _.H(1,8,8001,void 0);if(!NL)throw a.j.warn(pL),new _.H(1,8,8002,void 0);if(a.ib())throw a.j.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield PL(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
35
- b;throw new _.H(1,8,8E3,c);}})}xd(){this.ib()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.$c&&this.F.add(a)}removeMessageListener(a){typeof a===_.$c&&this.F.delete(a)}play(){return this.isEnded()?RL(this,!0):new Promise((a,b)=>{if(!this.a)return b(oL);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(oL);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
36
- _.wl}seek(a){return this.isEnded()?RL(this,!1,a):new Promise((b,c)=>{this.a||c(oL);this.m.isPlayingBreak&&c(mL);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.Ce));this.a.seek(d,()=>{this.trigger(new _.F(_.Be));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.r?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&
37
- this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(xL,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||
38
- !this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.r?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.h?this.h.getState():_.mp}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?AL(this.a.customData.stats):_.rl()}isLive(){return Infinity===
39
- this.getDuration()}load(a){const b=this;return _.y(function*(){if(b.Yb())if(NL){b.C=_.Kl(a);_.cj(a)&&(b.g=_.bj(b.I,a));var c=b.C[b.B];yield QL(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Na:b.g,Bb:c.Bb,audioMimeType:c.audioMimeType})}else b.j.warn(pL);else b.j.warn(rL)})}getBufferInfo(){return new _.Ro}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
40
- a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.j.warn(qL)}onError(a){if(a&&(this.trigger(new _.F(_.Yc,{detail:a})),this.h))this.h.onError(a)}namespace(){return _.yc}canPlay(){return this.Yb()?2:0}cb(){return this.J}cc(a){this.J=UL(a)}td(){this.J=null}ae(a){const b=this.cb()||{};a={metadataType:SL(b.metadataType),title:a};this.cc(Object.assign({},b,a))}Zd(a){const b=this.cb()||{},c=SL(b.metadataType);a=new chrome.cast.Image(a);
41
- this.cc(Object.assign({},b,{metadataType:c,images:[a]}))}Yd(a){const b=this.cb()||{};this.cc(Object.assign({},b,{metadataType:3,artist:a}))}$d(a){const b=this.cb()||{};a={metadataType:SL(b.metadataType),releaseDate:a};this.cc(Object.assign({},b,a))}Ya(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;NL=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.ee()}ab(a){this.j.debug(`state: ${a.sessionState}, details:`,
42
- a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;XL(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.ib()||(this.A=!0,XL(this,a.session),this.Y());break;case cast.framework.SessionState.SESSION_ENDED:if(this.ib()&&this.a){const d=this.a.media;var b=this.f.na(),c=this.f.oa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.T(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:YL(this),$e:c,
43
- pe:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(wL,this.R);this.A=!1;this.a=null;this.H.release();this.m=this.G=null}}$a(a){this.j.debug("New media session",a.mediaSession);WL(this,a.mediaSession)}Za(a,b){if(a===wL&&0<this.F.size){const c=AL(b);this.F.forEach(d=>d(c))}}ma(){this.trigger(new _.F(_.ue))}La(a){const b=this;return _.y(function*(){let c=null;const d=yield BL(a,[_.se,_.Wb],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ga++,
44
- chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};ZL.prototype.getTextDisplayer=ZL.prototype.getTextDisplayer;ZL.prototype.getNetworkEngine=ZL.prototype.getNetworkEngine;ZL.prototype.setNetworkEngine=ZL.prototype.setNetworkEngine;var NL=!1,KL=new Set;window.__onGCastApiAvailable=ML;var CM=class extends _.So{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.$c?c:(d,e)=>{this.f&&d!==_.wl&&d!==_.El&&this.f.load(e)};this.a=aM(this);this.g=new _.O(tL);this.addDelegate(this.f)}destroy(){const a=this;return _.y(function*(){a.a&&(yield OL(a.a),a.a=null);a.removeDelegate(a.f)})}qd(){return!!this.a&&this.a.Yb()&&NL}ib(){return!!this.a&&this.a.ib()}Cd(){return this.a?this.a.Cd():""}Pc(a){this.a&&this.a.Pc(a)}cast(a){const b=this;return _.y(function*(){if(b.a)try{if(yield b.a.cast(),
45
- b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.na();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.oa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.fc?e.isLive:b.f.isLive();d={source:e,
46
- isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Wd:b.f.getPresentationStartTime(),Bb:h,audioMimeType:k,Na:l}}var c=d}yield $L(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield QL(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.F(_.Yc,{detail:d}),b.trigger(c)}})}xd(){this.a&&this.a.xd()}tf(a){const b=this;return _.y(function*(){a!==b.h&&(b.h=a,b.a&&(yield OL(b.a)),b.a=aM(b))})}sendMessage(a){const b=this;return _.y(function*(){b.a?
47
- yield b.a.sendMessage(wL,a):b.g.warn(sL)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(sL)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(sL)}cb(){return this.a&&this.a.cb()}cc(a){this.a&&this.a.cc(a)}td(){this.a&&this.a.td()}ae(a){this.a&&this.a.ae(a)}Zd(a){this.a&&this.a.Zd(a)}Yd(a){this.a&&this.a.Yd(a)}$d(a){this.a&&this.a.$d(a)}};_.z(tL,CM);CM.prototype.setContentReleaseDate=CM.prototype.$d;CM.prototype.setContentArtist=CM.prototype.Yd;
48
- CM.prototype.setContentImage=CM.prototype.Zd;CM.prototype.setContentTitle=CM.prototype.ae;CM.prototype.clearContentMetadata=CM.prototype.td;CM.prototype.setContentMetadata=CM.prototype.cc;CM.prototype.getContentMetadata=CM.prototype.cb;CM.prototype.removeMessageListener=CM.prototype.removeMessageListener;CM.prototype.addMessageListener=CM.prototype.addMessageListener;CM.prototype.sendMessage=CM.prototype.sendMessage;CM.prototype.changeReceiverId=CM.prototype.tf;CM.prototype.forceDisconnect=CM.prototype.xd;
49
- CM.prototype.cast=CM.prototype.cast;CM.prototype.setPlayerConfigInterceptor=CM.prototype.Pc;CM.prototype.getReceiverName=CM.prototype.Cd;CM.prototype.isCasting=CM.prototype.ib;CM.prototype.canCast=CM.prototype.qd;CM.prototype.destroy=CM.prototype.destroy;var DM=class extends AM{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.T.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.Y.bind(this);this.K=this.W.bind(this);this.J=this.V.bind(this);this.M=this.ga.bind(this);this.G=this.ba.bind(this);this.F=this.U.bind(this);this.g=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
50
- this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.M);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.g)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.y(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
51
- d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.M);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.g);yield b().call(a)})}T(){this.f.trigger(new _.F(_.Rd));this.a(_.Hl)}R(){this.a(_.Gl)}aa(){this.a(_.wl)}Y(a){a.isBuffering?
52
- this.a(_.zl):(a=this.f.isPaused()?_.Gl:_.Hl,this.a(a))}W(){this.j=1;this.f.trigger(new _.F(_.Ce))}V(){this.f.trigger(new _.F(_.Be))}ga(){this.j=2}ba(){this.a(_.Fl)}N(a){const b=this.f.getStats();this.f.trigger(new _.F(_.ec,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.H(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.f.trigger(new _.F(_.Yc,{detail:a}));this.a(_.Dl)}};var Y=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.h=typeof c===_.r?c:1;this.j=typeof d===_.r?d:1;this.g=typeof e===_.r?e:0}pb(){return"Google Cast Framework"}qb(){return cast.framework.VERSION}vb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}$b(){return!1}Hb(){return this.a.clickThroughUrl||
53
- null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}sb(){return 0}rb(){return 0}gb(){return 0}Sa(){switch(this.Ib()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Ib(){return this.f.position}Jb(){return this.h}ub(){return this.j}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;
54
- Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.ub;Y.prototype.getPositionInSequence=Y.prototype.Jb;Y.prototype.getPodTimeOffset=Y.prototype.Ib;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Sa;Y.prototype.getMediaBitrate=Y.prototype.gb;Y.prototype.getMediaHeight=Y.prototype.rb;Y.prototype.getMediaWidth=Y.prototype.sb;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Hb;
55
- Y.prototype.isBumper=Y.prototype.$b;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;Y.prototype.getApiFramework=Y.prototype.getApiFramework;Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.vb;
56
- Y.prototype.getAdManagerVersion=Y.prototype.qb;Y.prototype.getAdManagerName=Y.prototype.pb;var EM=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Kb(){return!!this.a.find(a=>0===a.position)}hb(){return!!this.a.find(a=>-1===a.position)}};EM.prototype.hasPostroll=EM.prototype.hb;EM.prototype.hasPreroll=EM.prototype.Kb;EM.prototype.getCuePoints=EM.prototype.getCuePoints;var FM=class{constructor(a){this.l=a;this.a=null;this.g=this.h.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];fM().addEventListener(this.f,
57
- this.g)}load(){const a=this;return _.y(function*(){bM&&(bM=!1,eM(a,0))})}start(){return _.y(function*(){fM().play()})}resume(){-1!==this.getPosition()&&fM().play()}pause(){-1!==this.getPosition()&&fM().pause()}skip(){}getVolume(){return this.l.getVolume()||0}setVolume(a){this.l.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}dispose(){const a=this;return _.y(function*(){fM().removeEventListener(a.f,a.g)})}h(a){const b=cast.framework.events.EndedReason;
58
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=fM().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.F(_.Lb,{adsTimeline:new EM(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:hM(this,_.Bb,a);break;case cast.framework.events.EventType.BREAK_STARTED:hM(this,_.ub,a);break;case cast.framework.events.EventType.BREAK_ENDED:hM(this,_.vb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:hM(this,_.Hb,a);
59
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(hM(this,_.Gb,a),hM(this,_.Ib,a)):a.endedReason===b.STOPPED?hM(this,_.Ib,a):a.endedReason===b.END_OF_STREAM?(hM(this,_.yb,a),hM(this,_.Ib,a)):a.endedReason===b.ERROR&&eM(this,1);break;case cast.framework.events.EventType.PLAYING:hM(this,_.Fb,a);break;case cast.framework.events.EventType.PAUSE:hM(this,_.Db,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?hM(this,_.wb,a):hM(this,_.Fb,a)}}};
60
- FM.prototype.getPosition=FM.prototype.getPosition;FM.prototype.setVolume=FM.prototype.setVolume;FM.prototype.getVolume=FM.prototype.getVolume;FM.prototype.skip=FM.prototype.skip;FM.prototype.pause=FM.prototype.pause;FM.prototype.resume=FM.prototype.resume;var bM=!1;var GM=class{constructor(a){this.Pb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(iM(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(iM(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>jM(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
61
- _.Rf;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Tf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Uf}b&&this.Pb(new _.F(b,{detail:jM(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Pb(new _.F(_.Rf,{detail:b}))}};var HM=class extends _.P{constructor(){super();this.g=new _.O("clpp.cast.TrackManager");this.l=null;this.o=1E9;this.h=[];this.j=[];this.m=this.w.bind(this);this.a=this.f=null}initialize(a){this.l=a;kM().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.l=null;kM().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ja(){return this.j}ia(){return null}Fa(){const a=
62
- this.na();return a&&a.renditions[0]}Ga(){const a=this.oa();return a&&a.renditions[0]}Ra(){return null}eb(){return null}fb(){return null}Ia(){return null}na(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.r&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}oa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ja().find(c=>c.id===b)||null)}return a}Wa(){this.g.warn("Video tracks unavailable on Cast")}ta(a){a&&this.f&&
63
- this.f.setActiveById(+a.id)}Da(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Va(){this.g.warn("Video renditions unavailable on Cast")}kb(a){this.ta(a&&a.track)}lb(a){this.Da(a&&a.track)}addTextTrack(a){const b=this;return _.y(function*(){var c=b.l.getConfiguration();if((c=yield BL(a,Object.values(cast.framework.messages.CaptionMimeType),b.l.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
64
- c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),mM(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}la(){return!0}w(){this.f=kM().getAudioTracksManager();var a=this.f.getTracks();this.h=lM(_.K,a);mM(this);a=this.l.getConfiguration();nM(this,_.K,a.preferredAudioLanguage,a.preferredAudioRole);nM(this,_.J,a.preferredTextLanguage,a.preferredTextRole)}};HM.prototype.isAbrEnabled=HM.prototype.la;
65
- HM.prototype.addTextTrack=HM.prototype.addTextTrack;HM.prototype.setTextRendition=HM.prototype.lb;HM.prototype.setAudioRendition=HM.prototype.kb;HM.prototype.setVideoRendition=HM.prototype.Va;HM.prototype.setTextTrack=HM.prototype.Da;HM.prototype.setAudioTrack=HM.prototype.ta;HM.prototype.setVideoTrack=HM.prototype.Wa;HM.prototype.getTextTrack=HM.prototype.oa;HM.prototype.getAudioTrack=HM.prototype.na;HM.prototype.getVideoTrack=HM.prototype.Ia;HM.prototype.getLoadingTextRendition=HM.prototype.fb;
66
- HM.prototype.getLoadingAudioRendition=HM.prototype.eb;HM.prototype.getLoadingVideoRendition=HM.prototype.Ra;HM.prototype.getTextRendition=HM.prototype.Ga;HM.prototype.getAudioRendition=HM.prototype.Fa;HM.prototype.getVideoRendition=HM.prototype.ia;HM.prototype.getTextTracks=HM.prototype.ja;HM.prototype.getAudioTracks=HM.prototype.getAudioTracks;HM.prototype.getVideoTracks=HM.prototype.getVideoTracks;var IM=class extends _.So{constructor(){super();this.A=new _.O(uL);this.g=this.o=_.$i();this.w=null;this.j=-1;this.F=new _.Em;this.f=this.m=this.h=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.o=b);a=oM();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new DM(this);this.a.init();this.h=new HM;this.h.initialize(this);this.m=new GM(c=>this.trigger(c));this.m.init()}unload(){const a=
67
- cast.framework.messages.PlayerState,b=oM();b.getPlayerState()!==a.IDLE&&b.stop();this.h&&this.h.release();this.m&&this.m.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.y(function*(){a.B=null;a.o=_.$i();a.g=a.o;a.j=-1;a.w=null;a.a&&(yield a.a.destroy(),a.a=null);a.h&&(a.h.destroy(),a.h=null)})}play(){const a=oM();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
68
- a.play();return Promise.resolve()}pause(){const a=oM();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return oM().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return oM().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=oM();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(mL);b.seek(a);return Promise.resolve()}getPosition(){return oM().getCurrentTimeSec()}getDuration(){const a=
69
- oM().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return oM().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;oM().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
70
- null}getLoadedSource(){const a=oM().getMediaInformation();if(a){var b=oM().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.w&&-1!==this.j?this.w[this.j]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Hg:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return oM().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=oM().getLiveSeekableRange();
71
- b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.mp}getStats(){var a=_.rl();if(this.f){a=oM().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.m=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.o=a.width||NaN;b.g=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.j=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.h=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
72
- this;return _.y(function*(){b.f=new _.kp;b.a.m=b.f.a;b.w=_.Kl(a);_.cj(a)&&(b.g=_.bj(b.o,a));if(b.C)b.C=!1;else{var c=b.w[b.j],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.r&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:zL(b.g),local:!0};yield oM().load(d)}})}getBufferInfo(){this.A.warn(_.la);return new _.Ro}getTrackManager(){return this.h}getConfiguration(){return this.g}getSurface(){return this.B}setNetworkEngine(a){this.F=
73
- a}getNetworkEngine(){return this.F}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return uL}getTimelineCues(){return this.m&&this.m.getTimelineCues()||[]}resetAbr(){this.A.warn(qL)}onError(a){a=new _.F(_.Yc,{detail:a});this.trigger(a)}canPlay(){return _.ki()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=zL(this.getStats());var b=oM(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==
74
- b&&(this.A.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=oM().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
75
- a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=AL(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;rM(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};IM.prototype.getTextDisplayer=IM.prototype.getTextDisplayer;IM.prototype.getNetworkEngine=IM.prototype.getNetworkEngine;
76
- IM.prototype.setNetworkEngine=IM.prototype.setNetworkEngine;var tM=class{constructor(){this.a=!1;this.h=new _.O(vL);this.f=this.l=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.jo;this.m=null}init(a){a&&(this.f=new IM,_.Nm(a,this.f),this.l=a,this.o.on(window,"unload",()=>{const b=this;return _.y(function*(){b.l&&b.l.getState()!==_.El&&(yield yL(b.l))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=vM(),b=vM().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
77
- c.customNamespaces={};c.customNamespaces[wL]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.l&&this.l.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
78
- this.A);a.start(c);a.addCustomMessageListener(wL,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=vM();vM().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(wL,this.w);a.stop();this.l=this.f=null}}Pc(a){this.j=a}jg(a){this.m=a}on(a,b){vM().addEventListener(a,b)}off(a,b){vM().removeEventListener(a,b)}addMessageListener(a){typeof a===_.$c&&this.g.add(a)}removeMessageListener(a){typeof a===_.$c&&this.g.delete(a)}sendMessage(a,
79
- b){vM().sendCustomMessage(wL,b,zL(a))}Yb(){return this.a}cb(){var a;return a=(a=vM().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return xM(this,a);try{var b=(new DOMParser).parseFromString(a,_.te)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=vM();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
80
- 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.ud);var h=e[f].getElementsByTagName(_.$a);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.ud)||g,m=h[k].getAttribute(_.Dc);let n=h[k].getAttribute(_.We)||void 0,q=h[k].getAttribute(_.ad)||void 0;void 0!==n&&(n=+n);void 0!==q&&(q=+q);b.canDisplayType(l,m,n,q)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.$a).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
81
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.ib)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=vM();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.Xa);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.La)||void 0,h=e[f].getAttribute(_.Ka)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Je,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Xa).length||a.removeChild(c[d])}a=
82
- (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.y(function*(){let c=a;var d;c.media.customData&&(d=AL(c.media.customData.playerConfiguration));if(b.l&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield dM(c.media,d.ima,b.l.getNetworkEngine()));typeof d.startTime===_.r&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.Um(b.l,d),yield _.Vm(b.l),d=b.l.getLoadedSource(),c.media.contentId=
83
- d.url,c.media.contentType=d.type,d.Bb&&(c.media.hlsVideoSegmentFormat=CL(d.Bb,_.L)),d.audioMimeType&&(c.media.hlsSegmentFormat=CL(d.audioMimeType,_.K)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.r&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.l.getConfiguration().autoplay)}b.m&&(d=yield Promise.resolve(b.m(c)))&&(c=d);return c})}G(a){if(this.l&&(!a.media.customData||!a.media.customData.local)){var b=vM().getPlayerManager(),
84
- c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.l.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.l.seek(b))}_.Xm(this.l)}}B(a){if(0<this.g.size){const b=AL(a.data);this.g.forEach(c=>c(b))}}};_.z(vL,tM);tM.prototype.getContentMetadata=tM.prototype.cb;tM.prototype.isApiReady=tM.prototype.Yb;tM.prototype.sendMessage=tM.prototype.sendMessage;tM.prototype.removeMessageListener=tM.prototype.removeMessageListener;
85
- tM.prototype.addMessageListener=tM.prototype.addMessageListener;tM.prototype.off=tM.prototype.off;tM.prototype.on=tM.prototype.on;tM.prototype.setLoadRequestDataInterceptor=tM.prototype.jg;tM.prototype.setPlayerConfigInterceptor=tM.prototype.Pc;tM.prototype.stop=tM.prototype.stop;tM.prototype.start=tM.prototype.start;tM.prototype.init=tM.prototype.init;tM.getInstance=uM;var sM=null;var JM=class{constructor(a){this.f=a;this.a=null;this.g=new _.jo;this.h=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.y(function*(){a.a=a.f.m;if(a.a){const b=a.a.controller,c=a.j.bind(a);for(const d of a.h)a.g.on(b,d,c)}})}start(){return _.y(function*(){})}resume(){this.a&&
86
- this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(xL,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.r&&(a=b));return a}dispose(){const a=this;
87
- return _.y(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.Lb,{adsTimeline:new EM(a.breaks)})));break;case "isPlayingBreak":a.value?zM(this,_.ub):(zM(this,_.yb),zM(this,_.Ib),zM(this,_.vb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(zM(this,_.yb),zM(this,_.Ib)),zM(this,_.Hb));break;case "isPaused":this.a.isPlayingBreak&&(a.value?zM(this,_.Db):zM(this,_.Fb))}}};JM.prototype.getPosition=JM.prototype.getPosition;
88
- JM.prototype.setVolume=JM.prototype.setVolume;JM.prototype.getVolume=JM.prototype.getVolume;JM.prototype.skip=JM.prototype.skip;JM.prototype.pause=JM.prototype.pause;JM.prototype.resume=JM.prototype.resume;var KM=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}ea(a,b){return a.namespace()!==_.yc?!1:!(!b||!b.ima)}create(a){return new JM(a.a)}};KM.prototype.create=KM.prototype.create;KM.prototype.isSupported=KM.prototype.ea;KM.prototype.name=KM.prototype.name;_.Yl(new KM);var LM=class{name(){return"clpp.cast.ads.AdsManagerFactory"}ea(a,b){return uM().Yb()?!(!b||!b.ima):!1}create(a){return new FM(a)}};LM.prototype.create=LM.prototype.create;LM.prototype.isSupported=LM.prototype.ea;LM.prototype.name=LM.prototype.name;_.Yl(new LM);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var OM="Cannot seek during ads playout.",PM="Cannot switch track",QM="Media session does not exist.",RM="No receivers available",SM="Reset ABR functionality not available on cast.",TM="SDK not yet ready",UM="Sender is destroyed.",VM="clpp.cast.CastProxy",WM="clpp.cast.Player",XM="clpp.cast.Receiver",YM="urn:x-cast:castlabs",$M="urn:x-cast:com.google.cast.media",aN=function(a){return _.x(function*(){yield _.In(a,_.Sd);yield _.In(a,_.Rd)})},bN=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.od){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Od?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.r?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},cN=function(a){if(typeof a!==_.Je)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},dN=function(a,b,c,d){return _.x(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
3
+ null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.ti(d,a.mimeType,g);f&&g&&(h=_.Kh(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.J(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},eN=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,
4
+ d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.ff:return d.FMP4;case _.ef:return b===_.M?d.MPEG2_TS:c.TS;case _.gc:return c.AAC;case _.hc:return c.AC3;case _.ic:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.jc:return c.FMP4}},gN=function(a){a=void 0===a?fN:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.H(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
5
+ b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},hN=function(a,b){return a.g.filter(c=>c.type===b)},jN=function(a,b){const c=iN(a);return hN(a,b).find(d=>c.includes(d.id))||null},lN=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.K){const e=a.pa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;kN(a,b)},e=>{a.f[b]=null;a.h.debug(PM,e)})}else b===_.K&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{kN(a,b)},e=>{a.h.debug(PM,e)}))},iN=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},kN=function(a,b){b===_.L?a.a.trigger(new _.F(_.qj)):b===_.K&&a.a.trigger(new _.F(_.rj))},oN=function(a){if(a)for(const b of mN)nN(b)},nN=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
+ cast.framework&&cast.framework.CastContext&&a.V.length){a.w=!0;a.o.ne();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.V;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba);pN&&a.o.ca(.02)}},qN=function(a){return _.x(function*(){mN.delete(a);if(a.w){a.w=!1;var b=
8
+ cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.S=null;a.Y=null})},rN=function(a){return _.x(function*(){a.ib()||(yield cast.framework.CastContext.getInstance().requestSession())})},tN=function(a,b,c){c=
9
+ void 0===c?0:c;return _.x(function*(){var d=a.f.pa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.oa())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield sN(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),de:a.getPresentationStartTime(),autoplay:b,Oa:a.g})})},sN=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield rN(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
10
+ b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=eN(b.Bb,_.M);e.hlsSegmentFormat=eN(c,_.L);b.Oa&&(a.M&&(c=yield Promise.resolve(a.M(b.Oa)))&&(b.Oa=c),a.g=b.Oa,a.C=_.Gm(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Oa.remoteTextTracks&&(c=yield Promise.all(b.Oa.remoteTextTracks.map(a.Na.bind(a))),e.tracks=c.filter(k=>k),b.Oa.remoteTextTracks=void 0),delete b.Oa.autoplay,b.Oa.startTime=null,e.customData={playerConfiguration:bN(b.Oa)});c=a.cb()||{};
11
+ var f=uN(c.metadataType),g;typeof b.de===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.de});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=vN(c);if(g=wN(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.nc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},wN=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(xN);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=gN(xN[b]);return Object.assign(b,a)},uN=function(a){var b=void 0===b?fN:b;return Object.values(xN).includes(a)?a:b},vN=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},zN=function(a,b){yN(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(YM,a.R)},AN=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=
13
+ null;a=null===a?null:a+b;return null===a?b:a},yN=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.l),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.na.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.F(_.Bd)))},DN=function(a){return new BN(a.g,()=>{a.trigger(new _.F(_.wc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-
14
+ 1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.we&&(d.preferredAudioLanguage=c.we);c.jf&&(d.preferredTextLanguage=c.jf);_.Kn(a.f,null);a.trigger(new _.F("castingended"));a.j(b,d)}},()=>CN(a))},CN=function(a){return _.x(function*(){a.trigger(new _.F(_.vc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Kn(a.f,a.a))})},GN=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{EN=!1;const e=_.Kh(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.gh(f.data),h=(new DOMParser).parseFromString(g,
15
+ _.Re);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=FN(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=FN(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),EN=!0}}catch(e){_.C("Failed to fetch an ad",e),EN=!0}})},FN=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
+ a;return b},HN=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},IN=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},KN=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=JN(a,c))&&(d={ad:c});a.m.trigger(new _.F(b,d))}},JN=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Je&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
+ _.Je&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Z(d,e,b.index,b.total,f)}return c},LN=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},MN=function(a){const b=
18
+ a.dashTimedMetadata;let c=_.Ze;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.Ye)?_.ng:_.lg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},NN=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},PN=function(a){a.a=NN().getTextTracksManager();const b=a.a.getTracks();a.j=ON(_.K,b)},ON=function(a,b){const c=[];for(const d of b)b=new _.Zh(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
19
+ null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.gi(b.id,b)),c.push(b);return c},QN=function(a,b,c,d){c=_.ug(c).filter(g=>g);var e=!1;let f=[];b===_.L?f=a.getAudioTracks():b===_.K&&(f=a.ja());if(c=c.find(g=>{const h=_.Sg(g);return f.some(k=>{k=_.Sg(k.language||"");return _.Tg(h,k)})})){const g=
20
+ _.Sg(c);c=f.filter(h=>{h=_.Sg(h.language||"");return _.Tg(g,h)});f=c.length?c:f;e=e||!!c.length}_.ph(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.h.info("Will select track",e),b===_.L?a.sa(e):b===_.K&&a.Ea(e))},RN=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},UN=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};
21
+ if(a&&a.drm){var d=a.drm,e=_.Xj(d);if(e){var f=[_.Qc];_.Gm(a)[0].type!==_.ec&&f.unshift(_.Sc);d.preferredDrmSystem===_.Qc&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Pa[g];h?(c=g===_.Sc?cast.framework.ContentProtection.WIDEVINE:g===_.Qc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},SN(b,h,a,c),TN(b,h,a,c)):c()}else c()}else c()},SN=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
+ _.Kh({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},TN=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.Lh(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.J(g.data)}):
23
+ a.licenseHandler=void 0},XN=function(){return VN||(VN=new WN)},YN=function(){return cast.framework.CastReceiverContext.getInstance()},$N=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=YN();var {hlsVideoSegmentFormat:d}=YN().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.ff:_.ef;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=
24
+ ZN(f,_.la),h=ZN(f,_.cb);let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},ZN=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),0<=d&&(c=c.substring(0,d))));return c},bO=function(a,b){let c=null;const d=aO(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},aO=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
+ let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},cO=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.g=_.Am;this.o=_.Aq;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Am)}destroy(){this.l=
26
+ this.player=null;return Promise.resolve()}getState(){return this.g}onError(a){a.severity===_.G&&this.a(_.zm)}a(a){if(a!==this.g)if(this.g===_.zm&&a!==_.Am)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.g;this.g=a;this.g===_.vm?(this.B=b,this.player.trigger(new _.F(_.sc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.vm&&this.player.trigger(new _.F(_.oc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.g,previousState:this.o,
27
+ timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.jm(this.l,this.g);this.player.trigger(new _.F(_.Ge,{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var fN=0,xN={GENERIC:fN,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var dO=class extends cO{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.yb.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}yb(){if(this.f&&
28
+ this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.sm);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.zm);break;default:this.a(_.Am)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Dm);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Cm);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.vm)}}};var eO=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.M;break;case chrome.cast.media.TrackType.AUDIO:c=_.L;break;case chrome.cast.media.TrackType.TEXT:c=_.K}c=new _.Zh(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
+ c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.gi(c.id,c));return c}):[],this.a.trigger(new _.F(_.bq)))}destroy(){this.a=null}getVideoTracks(){return hN(this,_.M)}getAudioTracks(){return hN(this,_.L)}ja(){return hN(this,_.K)}ia(){const a=this.Ka();return a?a.renditions[0]:null}Ha(){const a=this.oa();return a?a.renditions[0]:null}Ia(){const a=this.pa();return a?a.renditions[0]:
30
+ null}Sa(){return this.f[_.M]||null}eb(){return this.f[_.L]||null}fb(){return this.f[_.K]||null}Ka(){return jN(this,_.M)}oa(){return jN(this,_.L)}pa(){return jN(this,_.K)}Xa(a){lN(this,_.M,a)}sa(a){lN(this,_.L,a)}Ea(a){lN(this,_.K,a)}Wa(a){this.Xa(a&&a.track)}kb(a){this.sa(a&&a.track)}lb(a){this.Ea(a&&a.track)}addTextTrack(){return _.x(function*(){})}la(){return!0}};eO.prototype.isAbrEnabled=eO.prototype.la;eO.prototype.addTextTrack=eO.prototype.addTextTrack;eO.prototype.setTextRendition=eO.prototype.lb;
31
+ eO.prototype.setAudioRendition=eO.prototype.kb;eO.prototype.setVideoRendition=eO.prototype.Wa;eO.prototype.setTextTrack=eO.prototype.Ea;eO.prototype.setAudioTrack=eO.prototype.sa;eO.prototype.setVideoTrack=eO.prototype.Xa;eO.prototype.getTextTrack=eO.prototype.pa;eO.prototype.getAudioTrack=eO.prototype.oa;eO.prototype.getVideoTrack=eO.prototype.Ka;eO.prototype.getLoadingTextRendition=eO.prototype.fb;eO.prototype.getLoadingAudioRendition=eO.prototype.eb;eO.prototype.getLoadingVideoRendition=eO.prototype.Sa;
32
+ eO.prototype.getTextRendition=eO.prototype.Ia;eO.prototype.getAudioRendition=eO.prototype.Ha;eO.prototype.getVideoRendition=eO.prototype.ia;eO.prototype.getTextTracks=eO.prototype.ja;eO.prototype.getAudioTracks=eO.prototype.getAudioTracks;eO.prototype.getVideoTracks=eO.prototype.getVideoTracks;var BN=class extends _.dq{constructor(a,b,c,d){super();this.h=new _.R(_.Gc);this.V=a;this.o=new _.zi(b);this.S=c;this.Y=d;this.g=this.I=_.Bj();this.C=[];this.B=0;this.K=new _.Bn;this.G=this.l=this.a=null;this.A=this.w=!1;this.aa="";this.fa=1E6;this.f=new eO;this.f.initialize(this);this.j=new dO(this);this.H=new _.vp;this.J=null;this.F=new Set;this.N=this.Za.bind(this);this.ba=this.bb.bind(this);this.W=this.ab.bind(this);this.R=this.$a.bind(this);this.M=null;window.cast||Object.defineProperty(window,
33
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{oN(!0)},0)}});nN(this);mN.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}destroy(){return _.x(function*(){})}Rc(a){this.M=a}Zb(){return this.w}ib(){return this.A}Jd(){return this.aa}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
34
+ if(e)try{yield e.sendMessage(a,bN(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.x(function*(){if(!a.Zb())throw a.h.warn(TM),new _.H(1,8,8001,void 0);if(!pN)throw a.h.warn(RM),new _.H(1,8,8002,void 0);if(a.ib())throw a.h.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield rN(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
35
+ b;throw new _.H(1,8,8E3,c);}})}Fd(){this.ib()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.od&&this.F.add(a)}removeMessageListener(a){typeof a===_.od&&this.F.delete(a)}play(){return this.isEnded()?tN(this,!0):new Promise((a,b)=>{if(!this.a)return b(QM);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(QM);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
36
+ _.sm}seek(a){return this.isEnded()?tN(this,!1,a):new Promise((b,c)=>{this.a||c(QM);this.l.isPlayingBreak&&c(OM);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.af));this.a.seek(d,()=>{this.trigger(new _.F(_.$e));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.r?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&
37
+ this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage($M,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||
38
+ !this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.r?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.Aq}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?cN(this.a.customData.stats):_.nm()}isLive(){return Infinity===
39
+ this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.Zb())if(pN){b.C=_.Gm(a);_.Ej(a)&&(b.g=_.Dj(b.I,a));var c=b.C[b.B];yield sN(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Oa:b.g,Bb:c.Bb,audioMimeType:c.audioMimeType})}else b.h.warn(RM);else b.h.warn(TM)})}getBufferInfo(){return new _.cq}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
40
+ a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.h.warn(SM)}onError(a){if(a&&(this.trigger(new _.F(_.ld,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.Gc}canPlay(){return this.Zb()?2:0}cb(){return this.J}dc(a){this.J=wN(a)}Bd(){this.J=null}je(a){const b=this.cb()||{};a={metadataType:uN(b.metadataType),title:a};this.dc(Object.assign({},b,a))}ge(a){const b=this.cb()||{},c=uN(b.metadataType);a=new chrome.cast.Image(a);
41
+ this.dc(Object.assign({},b,{metadataType:c,images:[a]}))}fe(a){const b=this.cb()||{};this.dc(Object.assign({},b,{metadataType:3,artist:a}))}he(a){const b=this.cb()||{};a={metadataType:uN(b.metadataType),releaseDate:a};this.dc(Object.assign({},b,a))}Za(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;pN=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.ne()}bb(a){this.h.debug(`state: ${a.sessionState}, details:`,
42
+ a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;zN(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.ib()||(this.A=!0,zN(this,a.session),this.Y());break;case cast.framework.SessionState.SESSION_ENDED:if(this.ib()&&this.a){const d=this.a.media;var b=this.f.oa(),c=this.f.pa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:AN(this),jf:c,
43
+ we:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(YM,this.R);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}ab(a){this.h.debug("New media session",a.mediaSession);yN(this,a.mediaSession)}$a(a,b){if(a===YM&&0<this.F.size){const c=cN(b);this.F.forEach(d=>d(c))}}na(){this.trigger(new _.F(_.Se))}Na(a){const b=this;return _.x(function*(){let c=null;const d=yield dN(a,[_.Qe,_.dc],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.fa++,
44
+ chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};BN.prototype.getTextDisplayer=BN.prototype.getTextDisplayer;BN.prototype.getNetworkEngine=BN.prototype.getNetworkEngine;BN.prototype.setNetworkEngine=BN.prototype.setNetworkEngine;var pN=!1,mN=new Set;window.__onGCastApiAvailable=oN;var fO=class extends _.dq{constructor(a,b,c){super();this.f=a;this.g=b;this.j=typeof c===_.od?c:(d,e)=>{this.f&&d!==_.sm&&d!==_.Am&&this.f.load(e)};this.a=DN(this);this.h=new _.R(VM);this.addDelegate(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield qN(a.a),a.a=null);a.removeDelegate(a.f)})}xd(){return!!this.a&&this.a.Zb()&&pN}ib(){return!!this.a&&this.a.ib()}Jd(){return this.a?this.a.Jd():""}Rc(a){this.a&&this.a.Rc(a)}cast(a){const b=this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),
45
+ b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.oa();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.pa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.nc?e.isLive:b.f.isLive();d={source:e,
46
+ isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),de:b.f.getPresentationStartTime(),Bb:h,audioMimeType:k,Oa:l}}var c=d}yield CN(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield sN(b.a,c)))}}catch(d){b.h.error("Error while trying to cast",d),c=new _.F(_.ld,{detail:d}),b.trigger(c)}})}Fd(){this.a&&this.a.Fd()}If(a){const b=this;return _.x(function*(){a!==b.g&&(b.g=a,b.a&&(yield qN(b.a)),b.a=DN(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?
47
+ yield b.a.sendMessage(YM,a):b.h.warn(UM)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.h.warn(UM)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.h.warn(UM)}cb(){return this.a&&this.a.cb()}dc(a){this.a&&this.a.dc(a)}Bd(){this.a&&this.a.Bd()}je(a){this.a&&this.a.je(a)}ge(a){this.a&&this.a.ge(a)}fe(a){this.a&&this.a.fe(a)}he(a){this.a&&this.a.he(a)}};_.z(VM,fO);fO.prototype.setContentReleaseDate=fO.prototype.he;fO.prototype.setContentArtist=fO.prototype.fe;
48
+ fO.prototype.setContentImage=fO.prototype.ge;fO.prototype.setContentTitle=fO.prototype.je;fO.prototype.clearContentMetadata=fO.prototype.Bd;fO.prototype.setContentMetadata=fO.prototype.dc;fO.prototype.getContentMetadata=fO.prototype.cb;fO.prototype.removeMessageListener=fO.prototype.removeMessageListener;fO.prototype.addMessageListener=fO.prototype.addMessageListener;fO.prototype.sendMessage=fO.prototype.sendMessage;fO.prototype.changeReceiverId=fO.prototype.If;fO.prototype.forceDisconnect=fO.prototype.Fd;
49
+ fO.prototype.cast=fO.prototype.cast;fO.prototype.setPlayerConfigInterceptor=fO.prototype.Rc;fO.prototype.getReceiverName=fO.prototype.Jd;fO.prototype.isCasting=fO.prototype.ib;fO.prototype.canCast=fO.prototype.xd;fO.prototype.destroy=fO.prototype.destroy;var gO=class extends cO{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.Y.bind(this);this.K=this.W.bind(this);this.J=this.V.bind(this);this.M=this.fa.bind(this);this.G=this.ba.bind(this);this.F=this.U.bind(this);this.f=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
50
+ this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.M);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
51
+ d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.M);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}S(){this.player.trigger(new _.F(_.ee));this.a(_.Dm)}R(){this.a(_.Cm)}aa(){this.a(_.sm)}Y(a){a.isBuffering?
52
+ this.a(_.vm):(a=this.player.isPaused()?_.Cm:_.Dm,this.a(a))}W(){this.j=1;this.player.trigger(new _.F(_.af))}V(){this.player.trigger(new _.F(_.$e))}fa(){this.j=2}ba(){this.a(_.Bm)}N(a){const b=this.player.getStats();this.player.trigger(new _.F(_.mc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.H(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.F(_.ld,{detail:a}));this.a(_.zm)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.j=typeof c===_.r?c:1;this.l=typeof d===_.r?d:1;this.g=typeof e===_.r?e:0}pb(){return"Google Cast Framework"}qb(){return cast.framework.VERSION}vb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}ac(){return!1}Ib(){return this.a.clickThroughUrl||
53
+ null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}sb(){return 0}rb(){return 0}gb(){return 0}Ta(){switch(this.Jb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Jb(){return this.f.position}Kb(){return this.j}ub(){return this.l}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;
54
+ Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.ub;Z.prototype.getPositionInSequence=Z.prototype.Kb;Z.prototype.getPodTimeOffset=Z.prototype.Jb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Ta;Z.prototype.getMediaBitrate=Z.prototype.gb;Z.prototype.getMediaHeight=Z.prototype.rb;Z.prototype.getMediaWidth=Z.prototype.sb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.Ib;
55
+ Z.prototype.isBumper=Z.prototype.ac;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;Z.prototype.getDuration=Z.prototype.getDuration;Z.prototype.getTitle=Z.prototype.getTitle;Z.prototype.getAdvertiserName=Z.prototype.getAdvertiserName;Z.prototype.getAdSystem=Z.prototype.getAdSystem;Z.prototype.getApiFramework=Z.prototype.getApiFramework;Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.vb;
56
+ Z.prototype.getAdManagerVersion=Z.prototype.qb;Z.prototype.getAdManagerName=Z.prototype.pb;var hO=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Lb(){return!!this.a.find(a=>0===a.position)}hb(){return!!this.a.find(a=>-1===a.position)}};hO.prototype.hasPostroll=hO.prototype.hb;hO.prototype.hasPreroll=hO.prototype.Lb;hO.prototype.getCuePoints=hO.prototype.getCuePoints;var iO=class{constructor(a){this.m=a;this.a=null;this.g=this.j.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];IN().addEventListener(this.f,
57
+ this.g)}load(){const a=this;return _.x(function*(){EN&&(EN=!1,HN(a,0))})}start(){return _.x(function*(){IN().play()})}resume(){-1!==this.getPosition()&&IN().play()}pause(){-1!==this.getPosition()&&IN().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}dispose(){const a=this;return _.x(function*(){IN().removeEventListener(a.f,a.g)})}j(a){const b=cast.framework.events.EndedReason;
58
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=IN().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.F(_.Vb,{adsTimeline:new hO(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:KN(this,_.Jb,a);break;case cast.framework.events.EventType.BREAK_STARTED:KN(this,_.Cb,a);break;case cast.framework.events.EventType.BREAK_ENDED:KN(this,_.Db,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:KN(this,_.Pb,a);
59
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(KN(this,_.Ob,a),KN(this,_.Qb,a)):a.endedReason===b.STOPPED?KN(this,_.Qb,a):a.endedReason===b.END_OF_STREAM?(KN(this,_.Gb,a),KN(this,_.Qb,a)):a.endedReason===b.ERROR&&HN(this,1);break;case cast.framework.events.EventType.PLAYING:KN(this,_.Nb,a);break;case cast.framework.events.EventType.PAUSE:KN(this,_.Lb,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?KN(this,_.Eb,a):KN(this,_.Nb,a)}}};
60
+ iO.prototype.getPosition=iO.prototype.getPosition;iO.prototype.setVolume=iO.prototype.setVolume;iO.prototype.getVolume=iO.prototype.getVolume;iO.prototype.skip=iO.prototype.skip;iO.prototype.pause=iO.prototype.pause;iO.prototype.resume=iO.prototype.resume;var EN=!1;var jO=class{constructor(a){this.Qb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(LN(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(LN(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>MN(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
61
+ _.og;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.qg;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.rg}b&&this.Qb(new _.F(b,{detail:MN(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Qb(new _.F(_.og,{detail:b}))}};var kO=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.g=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;NN().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.g=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;NN().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.g}ja(){return this.j}ia(){return null}Ha(){const a=
62
+ this.oa();return a&&a.renditions[0]}Ia(){const a=this.pa();return a&&a.renditions[0]}Sa(){return null}eb(){return null}fb(){return null}Ka(){return null}oa(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.r&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}pa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ja().find(c=>c.id===b)||null)}return a}Xa(){this.h.warn("Video tracks unavailable on Cast")}sa(a){a&&this.f&&
63
+ this.f.setActiveById(+a.id)}Ea(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Wa(){this.h.warn("Video renditions unavailable on Cast")}kb(a){this.sa(a&&a.track)}lb(a){this.Ea(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield dN(a,Object.values(cast.framework.messages.CaptionMimeType),b.m.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
64
+ c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),PN(b)}catch(e){throw b.h.warn("failed on track",a),e;}}})}la(){return!0}w(){this.f=NN().getAudioTracksManager();var a=this.f.getTracks();this.g=ON(_.L,a);PN(this);a=this.m.getConfiguration();QN(this,_.L,a.preferredAudioLanguage,a.preferredAudioRole);QN(this,_.K,a.preferredTextLanguage,a.preferredTextRole)}};kO.prototype.isAbrEnabled=kO.prototype.la;
65
+ kO.prototype.addTextTrack=kO.prototype.addTextTrack;kO.prototype.setTextRendition=kO.prototype.lb;kO.prototype.setAudioRendition=kO.prototype.kb;kO.prototype.setVideoRendition=kO.prototype.Wa;kO.prototype.setTextTrack=kO.prototype.Ea;kO.prototype.setAudioTrack=kO.prototype.sa;kO.prototype.setVideoTrack=kO.prototype.Xa;kO.prototype.getTextTrack=kO.prototype.pa;kO.prototype.getAudioTrack=kO.prototype.oa;kO.prototype.getVideoTrack=kO.prototype.Ka;kO.prototype.getLoadingTextRendition=kO.prototype.fb;
66
+ kO.prototype.getLoadingAudioRendition=kO.prototype.eb;kO.prototype.getLoadingVideoRendition=kO.prototype.Sa;kO.prototype.getTextRendition=kO.prototype.Ia;kO.prototype.getAudioRendition=kO.prototype.Ha;kO.prototype.getVideoRendition=kO.prototype.ia;kO.prototype.getTextTracks=kO.prototype.ja;kO.prototype.getAudioTracks=kO.prototype.getAudioTracks;kO.prototype.getVideoTracks=kO.prototype.getVideoTracks;var lO=class extends _.dq{constructor(){super();this.h=new _.R(WM);this.g=this.w=_.Bj();this.A=null;this.l=-1;this.F=new _.Bn;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.w=b);a=RN();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new gO(this);this.a.init();this.j=new kO;this.j.initialize(this);this.o=new jO(c=>this.trigger(c));this.o.init()}unload(){const a=
67
+ cast.framework.messages.PlayerState,b=RN();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.x(function*(){a.B=null;a.w=_.Bj();a.g=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=RN();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
68
+ a.play();return Promise.resolve()}pause(){const a=RN();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return RN().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return RN().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=RN();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(OM);b.seek(a);return Promise.resolve()}getPosition(){return RN().getCurrentTimeSec()}getDuration(){const a=
69
+ RN().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return RN().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;RN().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
70
+ null}getLoadedSource(){const a=RN().getMediaInformation();if(a){var b=RN().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.A&&-1!==this.l?this.A[this.l]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,bh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return RN().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=RN().getLiveSeekableRange();
71
+ b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.Aq}getStats(){var a=_.nm();if(this.f){a=RN().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.o=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.w=a.width||NaN;b.g=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
72
+ this;return _.x(function*(){b.f=new _.yq;b.a.l=b.f.a;b.A=_.Gm(a);_.Ej(a)&&(b.g=_.Dj(b.w,a));if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.r&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:bN(b.g),local:!0};yield RN().load(d)}})}getBufferInfo(){this.h.warn(_.ma);return new _.cq}getTrackManager(){return this.j}getConfiguration(){return this.g}getSurface(){return this.B}setNetworkEngine(a){this.F=
73
+ a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return WM}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.h.warn(SM)}onError(a){a=new _.F(_.ld,{detail:a});this.trigger(a)}canPlay(){return _.Oi()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=bN(this.getStats());var b=RN(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==
74
+ b&&(this.h.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=RN().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
75
+ a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=cN(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;UN(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};lO.prototype.getTextDisplayer=lO.prototype.getTextDisplayer;lO.prototype.getNetworkEngine=lO.prototype.getNetworkEngine;
76
+ lO.prototype.setNetworkEngine=lO.prototype.setNetworkEngine;var WN=class{constructor(){this.a=!1;this.h=new _.R(XM);this.f=this.m=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.vp;this.l=null}init(a){a&&(this.f=new lO,_.Kn(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.Am&&(yield aN(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=YN(),b=YN().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
77
+ c.customNamespaces={};c.customNamespaces[YM]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.m&&this.m.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
78
+ this.A);a.start(c);a.addCustomMessageListener(YM,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=YN();YN().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(YM,this.w);a.stop();this.m=this.f=null}}Rc(a){this.j=a}Gg(a){this.l=a}on(a,b){YN().addEventListener(a,b)}off(a,b){YN().removeEventListener(a,b)}addMessageListener(a){typeof a===_.od&&this.g.add(a)}removeMessageListener(a){typeof a===_.od&&this.g.delete(a)}sendMessage(a,
79
+ b){YN().sendCustomMessage(YM,b,bN(a))}Zb(){return this.a}cb(){var a;return a=(a=YN().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return $N(this,a);try{var b=(new DOMParser).parseFromString(a,_.Re)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=YN();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
80
+ 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.Hd);var h=e[f].getElementsByTagName(_.gb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.Hd)||g,m=h[k].getAttribute(_.Mc);let n=h[k].getAttribute(_.tf)||void 0,q=h[k].getAttribute(_.pd)||void 0;void 0!==n&&(n=+n);void 0!==q&&(q=+q);b.canDisplayType(l,m,n,q)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.gb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
81
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.ob)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=YN();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.bb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ma)||void 0,h=e[f].getAttribute(_.La)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.ff,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.bb).length||a.removeChild(c[d])}a=
82
+ (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=cN(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield GN(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.r&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.Rn(b.m,d),yield _.Sn(b.m),d=b.m.getLoadedSource(),c.media.contentId=
83
+ d.url,c.media.contentType=d.type,d.Bb&&(c.media.hlsVideoSegmentFormat=eN(d.Bb,_.M)),d.audioMimeType&&(c.media.hlsSegmentFormat=eN(d.audioMimeType,_.L)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.r&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.m.getConfiguration().autoplay)}b.l&&(d=yield Promise.resolve(b.l(c)))&&(c=d);return c})}G(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=YN().getPlayerManager(),
84
+ c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.m.seek(b))}_.Un(this.m)}}B(a){if(0<this.g.size){const b=cN(a.data);this.g.forEach(c=>c(b))}}};_.z(XM,WN);WN.prototype.getContentMetadata=WN.prototype.cb;WN.prototype.isApiReady=WN.prototype.Zb;WN.prototype.sendMessage=WN.prototype.sendMessage;WN.prototype.removeMessageListener=WN.prototype.removeMessageListener;
85
+ WN.prototype.addMessageListener=WN.prototype.addMessageListener;WN.prototype.off=WN.prototype.off;WN.prototype.on=WN.prototype.on;WN.prototype.setLoadRequestDataInterceptor=WN.prototype.Gg;WN.prototype.setPlayerConfigInterceptor=WN.prototype.Rc;WN.prototype.stop=WN.prototype.stop;WN.prototype.start=WN.prototype.start;WN.prototype.init=WN.prototype.init;WN.getInstance=XN;var VN=null;var mO=class{constructor(a){this.f=a;this.a=null;this.g=new _.vp;this.j=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.x(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.l.bind(a);for(const d of a.j)a.g.on(b,d,c)}})}start(){return _.x(function*(){})}resume(){this.a&&
86
+ this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage($M,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.r&&(a=b));return a}dispose(){const a=this;
87
+ return _.x(function*(){a.g.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.Vb,{adsTimeline:new hO(a.breaks)})));break;case "isPlayingBreak":a.value?bO(this,_.Cb):(bO(this,_.Gb),bO(this,_.Qb),bO(this,_.Db));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(bO(this,_.Gb),bO(this,_.Qb)),bO(this,_.Pb));break;case "isPaused":this.a.isPlayingBreak&&(a.value?bO(this,_.Lb):bO(this,_.Nb))}}};mO.prototype.getPosition=mO.prototype.getPosition;
88
+ mO.prototype.setVolume=mO.prototype.setVolume;mO.prototype.getVolume=mO.prototype.getVolume;mO.prototype.skip=mO.prototype.skip;mO.prototype.pause=mO.prototype.pause;mO.prototype.resume=mO.prototype.resume;var nO=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}da(a,b){return a.namespace()!==_.Gc?!1:!(!b||!b.ima)}create(a){return new mO(a.a)}};nO.prototype.create=nO.prototype.create;nO.prototype.isSupported=nO.prototype.da;nO.prototype.name=nO.prototype.name;_.Um(new nO);var oO=class{name(){return"clpp.cast.ads.AdsManagerFactory"}da(a,b){return XN().Zb()?!(!b||!b.ima):!1}create(a){return new iO(a)}};oO.prototype.create=oO.prototype.create;oO.prototype.isSupported=oO.prototype.da;oO.prototype.name=oO.prototype.name;_.Um(new oO);};f.call(g, window);