@castlabs/prestoplay 6.32.0-beta.2 → 6.32.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 (68) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +18 -18
  5. package/cjs/cl.cast.js +126 -126
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +604 -604
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +101 -101
  10. package/cjs/cl.externs.js +1 -29
  11. package/cjs/cl.freewheel.js +26 -26
  12. package/cjs/cl.hls.js +77 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +26 -26
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +352 -352
  18. package/cjs/cl.muxdata.js +14 -14
  19. package/cjs/cl.onboard.js +4 -4
  20. package/cjs/cl.persistent.js +14 -14
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -16
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +25 -25
  25. package/cjs/cl.tizen.js +71 -71
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +18 -18
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +38 -38
  33. package/cjs/polyfill.min.js +2 -2
  34. package/cl.adobe.js +3 -3
  35. package/cl.airplay.js +3 -3
  36. package/cl.broadpeak.js +14 -14
  37. package/cl.cast.js +100 -100
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +488 -487
  40. package/cl.crypto.js +8 -8
  41. package/cl.dash.js +75 -75
  42. package/cl.externs.js +1 -25
  43. package/cl.freewheel.js +20 -20
  44. package/cl.hls.js +65 -65
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +19 -19
  48. package/cl.mediatailor.js +2 -2
  49. package/cl.mse.js +200 -200
  50. package/cl.muxdata.js +12 -12
  51. package/cl.onboard.js +3 -3
  52. package/cl.persistent.js +8 -8
  53. package/cl.playlist.js +4 -4
  54. package/cl.simid.js +2 -2
  55. package/cl.smooth.js +47 -47
  56. package/cl.thumbnails.js +12 -12
  57. package/cl.tizen.js +41 -41
  58. package/cl.ttml.js +10 -10
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +3 -3
  62. package/cl.vtt.js +11 -11
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +27 -27
  65. package/package.json +1 -1
  66. package/typings.d.ts +6 -22
  67. package/cjs/cl.cdn.js +0 -13
  68. package/cl.cdn.js +0 -7
package/cl.cast.js CHANGED
@@ -1,104 +1,104 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var bV="Cannot seek during ads playout.",cV="Cannot switch track",dV="Media session does not exist.",eV="No receivers available",fV="QUEUE_ITEM_CHANGED",gV="Reset ABR functionality not available on cast.",hV="SDK not yet ready",iV="Sender is destroyed.",jV="clpp.cast.CastProxy",kV="clpp.cast.Player",lV="clpp.cast.Receiver",mV="urn:x-cast:castlabs",nV="urn:x-cast:castlabs:int",oV="urn:x-cast:com.google.cast.media",pV="volume control is not supported",qV=function(a){return _.w(function*(){yield _.Zn(a,
2
- _.Ne);yield _.Zn(a,_.Me)})},rV=function(a){return JSON.stringify(a,(b,c)=>{if("license"!==b&&typeof c!==_.ae){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Ie?"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}})},sV=function(a){if(typeof a!==_.Uf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},tV=function(a,b){const c=
3
- new Set(b);return Object.keys(a).reduce((d,e)=>{c.has(e)&&(d[e]=a[e]);return d},{})},uV=function(a,b,c,d){return _.w(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Tr(d,a.mimeType,g);f&&g&&(h=_.zk(a.url),(h=yield c.fetch(h).V)&&h.data&&(e=f.a(_.G(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},vV=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=
4
- chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.Ag:return d.FMP4;case _.zg:return b===_.R?d.MPEG2_TS:c.TS;case _.Ec:return c.AAC;case _.Fc:return c.AC3;case _.Gc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Hc:return c.FMP4}},xV=function(a){a=void 0===a?wV:a;var b=cast.framework.messages||
5
- chrome.cast.media;if(!b)throw new _.I(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;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}},yV=function(){return Math.round(1E3*Math.random())},zV=function(a,b){return a.h.filter(c=>
6
- c.type===b)},BV=function(a,b){const c=AV(a);return zV(a,b).find(d=>c.includes(d.id))||null},DV=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.P){const e=a.ua();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);d.editTracksInfo(c,()=>{a.f[b]=null;CV(a,b)},e=>{a.f[b]=null;a.g.debug(cV,e)})}else b===_.P&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{CV(a,b)},e=>{a.g.debug(cV,e)}))},AV=function(a){a=a.a?a.a.a:null;return(a?
7
- a.activeTrackIds||[]:[]).map(b=>b.toString())},CV=function(a,b){b===_.Q?a.a.trigger(new _.H(_.Kc)):b===_.P&&a.a.trigger(new _.H(_.bg))},GV=function(a){if(a)for(const b of EV)FV(b)},FV=function(a){if(!a.f&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&cast.framework&&cast.framework.CastContext&&a.S.length){a.o=new cast.framework.RemotePlayer;var b=new cast.framework.RemotePlayerController(a.o);a.F.on(b,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.Aa.bind(a));a.F.on(b,
8
- cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.Jb.bind(a));a.f=!0;a.L.resolve();a.w.Nf();b=cast.framework.CastContext.getInstance();var c=new cast.framework.CastOptions;c.receiverApplicationId=a.S;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da);HV&&a.w.la(.02)}},IV=function(a){return _.w(function*(){a.F.release();
9
- EV.delete(a);if(a.f){a.f=!1;var b=cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da)}b=[];a.h&&(b.push(a.h.destroy()),a.h=null);a.l&&(b.push(a.l.destroy()),a.l=null);yield Promise.all(b);a.A=!1;a.w&&(a.w.stop(),a.w=null);a.R=null;a.X=null})},JV=function(a){return _.w(function*(){a.ya()||(yield cast.framework.CastContext.getInstance().requestSession())})},
10
- LV=function(a,b,c){c=void 0===c?0:c;return _.w(function*(){var d=a.h.ua();d&&d.language&&(a.j.preferredTextLanguage=d.language);(d=a.h.ra())&&d.language&&(a.j.preferredAudioLanguage=d.language);yield KV(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),wf:a.getPresentationStartTime(),autoplay:b,Fa:a.j})})},KV=function(a,b){return _.w(function*(){if(a.f){var c=chrome.cast.media.StreamType;yield JV(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
11
- b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.nb;e.hlsVideoSegmentFormat=vV(b.jc,_.R);e.hlsSegmentFormat=vV(c,_.Q);b.Fa&&(a.J&&(c=yield Promise.resolve(a.J(b.Fa)))&&(b.Fa=c),a.j=b.Fa,a.C=_.jn(a.j),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Fa.remoteTextTracks&&(c=yield Promise.all(b.Fa.remoteTextTracks.map(a.Ma.bind(a))),e.tracks=c.filter(k=>k),b.Fa.remoteTextTracks=void 0),delete b.Fa.autoplay,b.Fa.startTime=null,e.customData={playerConfiguration:rV(b.Fa)});c=a.Lb()||{};var f=MV(c.metadataType),
12
- g;typeof b.wf===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.wf});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=NV(c);if(g=OV(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);(g=b.queueData)&&g.items&&0<g.items.length&&(h=new chrome.cast.media.QueueData,h.items=g.items,h.startIndex=g.startIndex,e.queueData=h);typeof b.autoplay===_.Nc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e);null!=b.Fa.muted&&
13
- a.setMuted(b.Fa.muted);null!=b.Fa.volume&&a.setVolume(b.Fa.volume)}}})},OV=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(PV);for(const d of c){const [e,f]=d;if(f===b){b=e;break a}}b=null}if(!b)return null;b=xV(PV[b]);return Object.assign(b,a)},MV=function(a){var b=void 0===b?wV:b;return Object.values(PV).includes(a)?a:b},NV=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},RV=function(a,b){QV(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,
14
- a.W);b.addMessageListener(mV,a.P);b.addMessageListener(nV,a.U)},SV=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=null;a=null===a?null:a+b;return null===a?b:a},QV=function(a,b){a.a=b;a.a&&(a.l&&a.l.init(),a.trigger(new _.H(_.se)))},VV=function(a){return new TV(a.h,()=>{a.trigger(new _.H(_.Tc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&
15
- (d.ima.playAdsAfterTime=d.startTime);c.cg&&(d.preferredAudioLanguage=c.cg);c.ih&&(d.preferredTextLanguage=c.ih);_.ao(a.f,null);a.trigger(new _.H("castingended"));a.j(b,d)}},()=>UV(a))},UV=function(a){return _.w(function*(){a.trigger(new _.H(_.Sc));if(a.f.a!==a.a&&a.a){var b=null!=a.f.Sa();yield a.f.release();_.ao(a.f,a.a);b&&(_.ko(a.f),(b=a.f.getAdsManager())&&(yield b.load()))}})},WV=function(a){a.trigger(new _.H(_.kf))},YV=function(a){XV(a);const b=Math.min(a.a.Hd().length-1,a.a.getPosition()+1);
16
- a.a.setPosition(b)},XV=function(a){a.j||(a.a.on(_.jf,a.o),a.j=!0)},ZV=function(a){return a.map(b=>{const c={};c.media={contentId:b.configuration.source};c.customData={skippable:!1!==b.skippable};return c})},cW=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{$V=!1;const e=_.zk(d),f=yield c.fetch(e).V;if(f&&f.data){const g=_.ri(f.data),h=(new DOMParser).parseFromString(g,_.ag);if(h.getElementsByTagName("vmap:VMAP").length)aW.warn("VMAP detected."),a.vmapAdsRequest=bW(g);else if(h.getElementsByTagName("VAST").length){aW.warn("VAST detected.");
17
- {d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=bW(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else aW.warn("Unsupported schema."),$V=!0}}catch(e){aW.warn("Failed to fetch an ad",e),$V=!0}})},bW=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},dW=function(a,b){b=new _.I(1,10,10003,{errorType:b});a.m.onError(b)},eW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},
18
- gW=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=fW(a,c))&&(d={ad:c});a.m.trigger(new _.H(b,d))}},fW=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Uf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.Uf&&(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,
19
- h)=>g.position-h.position).findIndex(g=>g===e)));c=new Y(d,e,b.index,b.total,f)}return c},hW=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]},iW=function(a){const b=a.dashTimedMetadata;let c=_.pg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.og)?_.Hf:_.mg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,
20
- value:b&&b.value||"",eventElement:b?b.eventElement:null}},jW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},lW=function(a){a.a=jW().getTextTracksManager();const b=a.a.getTracks();a.j=kW(_.P,b)},kW=function(a,b){const c=[];for(const d of b)b=new _.Cr(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||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||
21
- null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.Gr(b.id,b)),c.push(b);return c},mW=function(a,b,c,d){c=_.ci(c).filter(g=>g);var e=!1;let f=[];b===_.Q?f=a.getAudioTracks():b===_.P&&(f=a.sa());if(c=c.find(g=>{const h=_.Kn(g);return f.some(k=>{k=_.Kn(k.language||"");return _.Ln(h,k)})})){const g=_.Kn(c);c=f.filter(h=>{h=_.Kn(h.language||"");return _.Ln(g,h)});f=c.length?c:f;e=e||!!c.length}_.Ai(d)&&(c=f.filter(g=>g.roles.includes(d)),
22
- f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.Q?a.za(e):b===_.P&&a.ab(e))},nW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},qW=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=a.drm,e=_.pn(d);if(e){var f=[_.ud];_.jn(a)[0].type!==_.Cc&&f.unshift(_.wd);d.preferredDrmSystem===_.ud&&f.reverse();
23
- for(var g,h;f.length&&!h;)g=f.shift(),h=e.La[g];h?(c=g===_.wd?cast.framework.ContentProtection.WIDEVINE:g===_.ud?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},oW(b,h,a,c),pW(b,h,a,c)):c()}else c()}else c()},rW=function(a,b){b=Object.assign({},a.shakaConfig,b);return Object.assign({},a,{shakaConfig:b})},oW=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.zk({method:_.eb,uris:[e.url]});
24
- 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},pW=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.Dk(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.G(g.data)}):a.licenseHandler=void 0},uW=function(){return sW||
25
- (sW=new tW)},vW=function(){return cast.framework.CastReceiverContext.getInstance()},wW=function(){const a=vW().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},xW=function(a,b){const c=vW().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,vW().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},zW=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;
26
- a=vW();var {hlsVideoSegmentFormat:d}=vW().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Ag:_.zg;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=yW(f,_.pa),h=yW(f,_.mb);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")},yW=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),
27
- c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),0<=d&&(c=c.substring(0,d))));return c},AW=function(a){for(const b of a)a={},b.customData&&_.kh(b.customData)&&(a=b.customData),b.roles&&(a.roles=b.roles),b.audioTrackInfo&&(a.audioTrackInfo=b.audioTrackInfo),_.kh(a)&&(b.customData=a)},BW=function(a){_.w(function*(){yield a.l.L;a.a=a.l.o;a.B.on(a.a.controller,cast.framework.RemotePlayerEventType.ANY_CHANGE,a.C.bind(a))})},CW=function(a,b,c){let d=null;c&&(d={ad:c});
28
- a.l.trigger(new _.H(b,d))},DW=function(a){if(!a.a||!a.a.mediaInfo)return null;var b=a.a.mediaInfo.breaks;const c=a.a.mediaInfo.breakClips,d=a.a.isPlayingBreak,e=a.a.breakId,f=a.a.currentBreakClipNumber,g=a.a.numberBreakClips,h=a.a.breakClipId;if(!(b&&c&&null!=e&&null!=f&&null!=g&&null!=h&&d))return null;const k=b.find(l=>l.id===e)||null;a=0;k&&(a=0>=k.position?k.position:b.filter(l=>0<=l.position).sort((l,m)=>l.position-m.position).findIndex(l=>l===k));b=c.find(l=>l.id===h)||null;return new Y(b,k,
29
- f,g,a)},EW=class{constructor(a,b){this.log=new _.T(b);this.player=a;this.l=null;this.h=_.Hs;this.o=7;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Hs)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.D&&this.a(_.As)}a(a){if(a!==this.h)if(this.h===_.As&&a!==_.Hs)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;2===this.h?(this.B=b,this.player.trigger(new _.H(_.Pc,{detail:{bufferedTimeMS:-1,
30
- reason:this.j}}))):2===this.o&&this.player.trigger(new _.H(_.Oc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.ts(this.l,this.h);this.player.trigger(new _.H(_.Rf,{detail:a}))}}},FW;_.x("clpp.cast.CastUtils",class{});
31
- var wV=0,PV={GENERIC:wV,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5},GW="addMissingTimelineCues alwaysStreamText bufferBehind bufferingGoal durationBackoff gapDetectionThreshold ignoreTextStreamFailures lowLatencyMode rebufferingGoal retryParameters safeSeekOffset stallEnabled stallSkip stallThreshold startAtSegmentBoundary".split(" "),HW="bandwidthDowngradeTarget bandwidthUpgradeTarget defaultBandwidthEstimate enabled initialRestrictions restrictions switchInterval".split(" ");var IW=class extends EW{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.dc.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.o)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.o;b&&b.isPlayingBreak||super.a(a)}dc(){if(this.f&&
32
- 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(5);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.As);break;default:this.a(_.Hs)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(3);break;case chrome.cast.media.PlayerState.PAUSED:this.a(4);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(2)}}};var JW=class extends _.V{constructor(){super();this.g=new _.T("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.R;break;case chrome.cast.media.TrackType.AUDIO:c=_.Q;break;case chrome.cast.media.TrackType.TEXT:c=_.P}c=new _.Cr(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
33
- c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;if(b.customData){c.src=b.customData.url||c.src;c.mimeType=b.customData.mimeType||c.mimeType;const d=b.customData.roles;d&&(c.roles=d);if(b=b.customData.audioTrackInfo)void 0!==b.numAudioChannels&&(c.channelsCount=b.numAudioChannels),void 0!==b.spatialAudio&&(c.spatialAudio=b.spatialAudio)}c.renditions.push(new _.Gr(c.id,c));return c}):[],this.a.trigger(new _.H(_.hg)))}destroy(){this.a=null}getVideoTracks(){return zV(this,_.R)}getAudioTracks(){return zV(this,
34
- _.Q)}sa(){return zV(this,_.P)}ta(){const a=this.Ia();return a?a.renditions[0]:null}Qa(){const a=this.ra();return a?a.renditions[0]:null}Xa(){const a=this.ua();return a?a.renditions[0]:null}xb(){return this.f[_.R]||null}Nb(){return this.f[_.Q]||null}Ob(){return this.f[_.P]||null}Ia(){return BV(this,_.R)}ra(){return BV(this,_.Q)}ua(){return BV(this,_.P)}Gb(a){DV(this,_.R,a)}za(a){DV(this,_.Q,a)}ab(a){DV(this,_.P,a)}sb(a){this.Gb(a&&a.track)}Eb(a){this.za(a&&a.track)}Fb(a){this.ab(a&&a.track)}addTextTrack(){return _.w(function*(){})}va(){return!0}};
35
- JW.prototype.isAbrEnabled=JW.prototype.va;JW.prototype.addTextTrack=JW.prototype.addTextTrack;JW.prototype.setTextRendition=JW.prototype.Fb;JW.prototype.setAudioRendition=JW.prototype.Eb;JW.prototype.setVideoRendition=JW.prototype.sb;JW.prototype.setTextTrack=JW.prototype.ab;JW.prototype.setAudioTrack=JW.prototype.za;JW.prototype.setVideoTrack=JW.prototype.Gb;JW.prototype.getTextTrack=JW.prototype.ua;JW.prototype.getAudioTrack=JW.prototype.ra;JW.prototype.getVideoTrack=JW.prototype.Ia;
36
- JW.prototype.getLoadingTextRendition=JW.prototype.Ob;JW.prototype.getLoadingAudioRendition=JW.prototype.Nb;JW.prototype.getLoadingVideoRendition=JW.prototype.xb;JW.prototype.getTextRendition=JW.prototype.Xa;JW.prototype.getAudioRendition=JW.prototype.Qa;JW.prototype.getVideoRendition=JW.prototype.ta;JW.prototype.getTextTracks=JW.prototype.sa;JW.prototype.getAudioTracks=JW.prototype.getAudioTracks;JW.prototype.getVideoTracks=JW.prototype.getVideoTracks;var TV=class extends _.Yt{constructor(a,b,c,d){super();this.g=new _.T(_.hd);this.S=a;this.w=new _.Pi(b);this.R=c;this.X=d;this.j=this.G=_.cn();this.C=[];this.B=0;this.I=new _.Hn;this.a=null;this.f=!1;this.L=new _.Kl;this.A=!1;this.ca="";this.ia=1E6;this.h=new JW;this.h.initialize(this);this.l=new IW(this);this.F=new _.Vt;this.H=null;this.K=new Set;this.M=this.cb.bind(this);this.da=this.Ub.bind(this);this.W=this.Tb.bind(this);this.P=this.Ib.bind(this);this.U=this.lb.bind(this);this.o=this.J=null;window.cast||
37
- Object.defineProperty(window,"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{GV(!0)},0)}});FV(this);EV.add(this)}init(a,b){this.j=this.G=b}unload(){return this.f?new Promise((a,b)=>{this.h&&this.h.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)}):Promise.resolve()}release(){return this.f?this.unload().then(()=>{this.l&&this.l.release()}):Promise.resolve()}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.ab)}appendLoad(){return Promise.reject(_.ab)}seekWith(){return Promise.reject(_.ab)}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}destroy(){return _.w(function*(){})}$d(a){this.J=
38
- a}gd(){return this.f}ya(){return this.A}df(){return this.ca}sendMessage(a,b){const c=this;return _.w(function*(){if(c.f){var d=cast.framework.CastContext.getInstance().getCurrentSession();if(d)try{yield d.sendMessage(a,b)}catch(f){var e=new _.I(1,8,8E3,{detailedErrorCode:f})}else e=new _.I(1,8,8004,void 0);if(e)c.onError(e)}})}cast(){const a=this;return _.w(function*(){if(!a.gd())throw a.g.warn(hV),new _.I(1,8,8001,void 0);if(!HV)throw a.g.warn(eV),new _.I(1,8,8002,void 0);if(a.ya())throw a.g.warn("Already casting"),
39
- new _.I(1,8,8003,void 0);try{yield JV(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.I(1,8,8E3,c);}})}ue(){this.f&&this.ya()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.ae&&this.K.add(a)}removeMessageListener(a){typeof a===_.ae&&this.K.delete(a)}play(){return this.f?this.isEnded()?LV(this,!0):new Promise((a,b)=>{if(!this.a)return b(dV);
40
- this.a.play(null,a,b)}):Promise.resolve()}pause(){return this.f?new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(dV);this.a.pause(null,a,b)}):Promise.resolve()}isPaused(){return this.f?!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED:!1}isEnded(){return this.f?5===this.getState():!1}seek(a){return this.f?this.isEnded()?LV(this,!1,a):new Promise((b,c)=>{this.a||c(dV);this.o.isPlayingBreak&&c(bV);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.H(_.ug));
41
- this.a.seek(d,()=>{this.trigger(new _.H(_.qg));b()},c)}):Promise.resolve()}getPosition(){return this.f?this.getMediaPosition():0}getMediaPosition(){return this.f?this.a&&this.a.getEstimatedTime()||0:0}getDuration(){return this.f?this.getMediaDuration():0}getMediaDuration(){if(!this.f)return 0;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.f?this.a&&
42
- this.a.playbackRate||0:0}setPlaybackRate(a){this.f&&this.a&&0<a&&this.sendMessage(oV,{type:"SET_PLAYBACK_RATE",requestId:yV(),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.f?this.a&&this.a.volume.level:0}setVolume(a){this.f&&this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.f?this.a&&this.a.volume.muted:!1}setMuted(a){this.f&&this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var WU="Cannot seek during ads playout.",XU="Cannot switch track",YU="Media session does not exist.",ZU="No receivers available",$U="QUEUE_ITEM_CHANGED",aV="Reset ABR functionality not available on cast.",bV="SDK not yet ready",cV="Sender is destroyed.",dV="clpp.cast.CastProxy",eV="clpp.cast.Player",fV="clpp.cast.Receiver",gV="urn:x-cast:castlabs",hV="urn:x-cast:castlabs:int",iV="urn:x-cast:com.google.cast.media",jV="volume control is not supported",kV=function(a){return _.w(function*(){yield _.Vn(a,
2
+ _.Ne);yield _.Vn(a,_.Me)})},lV=function(a){return JSON.stringify(a,(b,c)=>{if("license"!==b&&typeof c!==_.be){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Ie?"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}})},mV=function(a){if(typeof a!==_.Uf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},nV=function(a,b){const c=
3
+ new Set(b);return Object.keys(a).reduce((d,e)=>{c.has(e)&&(d[e]=a[e]);return d},{})},oV=function(a,b,c,d){return _.w(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Kr(d,a.mimeType,g);f&&g&&(h=_.vk(a.url),(h=yield c.fetch(h).V)&&h.data&&(e=f.a(_.G(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},pV=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=
4
+ chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.Ag:return d.FMP4;case _.zg:return b===_.R?d.MPEG2_TS:c.TS;case _.Fc:return c.AAC;case _.Gc:return c.AC3;case _.Hc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Ic:return c.FMP4}},rV=function(a){a=void 0===a?qV:a;var b=cast.framework.messages||
5
+ chrome.cast.media;if(!b)throw new _.I(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;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}},sV=function(){return Math.round(1E3*Math.random())},tV=function(a,b){return a.h.filter(c=>
6
+ c.type===b)},vV=function(a,b){const c=uV(a);return tV(a,b).find(d=>c.includes(d.id))||null},xV=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.P){const e=a.ua();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);d.editTracksInfo(c,()=>{a.f[b]=null;wV(a,b)},e=>{a.f[b]=null;a.g.debug(XU,e)})}else b===_.P&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{wV(a,b)},e=>{a.g.debug(XU,e)}))},uV=function(a){a=a.a?a.a.a:null;return(a?
7
+ a.activeTrackIds||[]:[]).map(b=>b.toString())},wV=function(a,b){b===_.Q?a.a.trigger(new _.H(_.Lc)):b===_.P&&a.a.trigger(new _.H(_.bg))},AV=function(a){if(a)for(const b of yV)zV(b)},zV=function(a){if(!a.f&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&cast.framework&&cast.framework.CastContext&&a.S.length){a.o=new cast.framework.RemotePlayer;var b=new cast.framework.RemotePlayerController(a.o);a.F.on(b,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.Aa.bind(a));a.F.on(b,
8
+ cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.Jb.bind(a));a.f=!0;a.L.resolve();a.w.Hf();b=cast.framework.CastContext.getInstance();var c=new cast.framework.CastOptions;c.receiverApplicationId=a.S;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da);BV&&a.w.la(.02)}},CV=function(a){return _.w(function*(){a.F.release();
9
+ yV.delete(a);if(a.f){a.f=!1;var b=cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da)}b=[];a.h&&(b.push(a.h.destroy()),a.h=null);a.l&&(b.push(a.l.destroy()),a.l=null);yield Promise.all(b);a.A=!1;a.w&&(a.w.stop(),a.w=null);a.R=null;a.X=null})},DV=function(a){return _.w(function*(){a.ya()||(yield cast.framework.CastContext.getInstance().requestSession())})},
10
+ FV=function(a,b,c){c=void 0===c?0:c;return _.w(function*(){var d=a.h.ua();d&&d.language&&(a.j.preferredTextLanguage=d.language);(d=a.h.ra())&&d.language&&(a.j.preferredAudioLanguage=d.language);yield EV(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),qf:a.getPresentationStartTime(),autoplay:b,Fa:a.j})})},EV=function(a,b){return _.w(function*(){if(a.f){var c=chrome.cast.media.StreamType;yield DV(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
11
+ b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.nb;e.hlsVideoSegmentFormat=pV(b.jc,_.R);e.hlsSegmentFormat=pV(c,_.Q);b.Fa&&(a.J&&(c=yield Promise.resolve(a.J(b.Fa)))&&(b.Fa=c),a.j=b.Fa,a.C=_.en(a.j),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Fa.remoteTextTracks&&(c=yield Promise.all(b.Fa.remoteTextTracks.map(a.La.bind(a))),e.tracks=c.filter(k=>k),b.Fa.remoteTextTracks=void 0),delete b.Fa.autoplay,b.Fa.startTime=null,e.customData={playerConfiguration:lV(b.Fa)});c=a.Lb()||{};var f=GV(c.metadataType),
12
+ g;typeof b.qf===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.qf});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=HV(c);if(g=IV(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);(g=b.queueData)&&g.items&&0<g.items.length&&(h=new chrome.cast.media.QueueData,h.items=g.items,h.startIndex=g.startIndex,e.queueData=h);typeof b.autoplay===_.Oc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e);null!=b.Fa.muted&&
13
+ a.setMuted(b.Fa.muted);null!=b.Fa.volume&&a.setVolume(b.Fa.volume)}}})},IV=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(JV);for(const d of c){const [e,f]=d;if(f===b){b=e;break a}}b=null}if(!b)return null;b=rV(JV[b]);return Object.assign(b,a)},GV=function(a){var b=void 0===b?qV:b;return Object.values(JV).includes(a)?a:b},HV=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},LV=function(a,b){KV(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,
14
+ a.W);b.addMessageListener(gV,a.P);b.addMessageListener(hV,a.U)},MV=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=null;a=null===a?null:a+b;return null===a?b:a},KV=function(a,b){a.a=b;a.a&&(a.l&&a.l.init(),a.trigger(new _.H(_.se)))},PV=function(a){return new NV(a.h,()=>{a.trigger(new _.H(_.Uc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&
15
+ (d.ima.playAdsAfterTime=d.startTime);c.Yf&&(d.preferredAudioLanguage=c.Yf);c.eh&&(d.preferredTextLanguage=c.eh);_.Xn(a.f,null);a.trigger(new _.H("castingended"));a.j(b,d)}},()=>OV(a))},OV=function(a){return _.w(function*(){a.trigger(new _.H(_.Tc));if(a.f.a!==a.a&&a.a){var b=null!=a.f.Ra();yield a.f.release();_.Xn(a.f,a.a);b&&(_.go(a.f),(b=a.f.getAdsManager())&&(yield b.load()))}})},QV=function(a){a.trigger(new _.H(_.kf))},SV=function(a){RV(a);const b=Math.min(a.a.Hd().length-1,a.a.getPosition()+1);
16
+ a.a.setPosition(b)},RV=function(a){a.j||(a.a.on(_.jf,a.o),a.j=!0)},TV=function(a){return a.map(b=>{const c={};c.media={contentId:b.configuration.source};c.customData={skippable:!1!==b.skippable};return c})},XV=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{UV=!1;const e=_.vk(d),f=yield c.fetch(e).V;if(f&&f.data){const g=_.ni(f.data),h=(new DOMParser).parseFromString(g,_.ag);if(h.getElementsByTagName("vmap:VMAP").length)VV.warn("VMAP detected."),a.vmapAdsRequest=WV(g);else if(h.getElementsByTagName("VAST").length){VV.warn("VAST detected.");
17
+ {d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=WV(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else VV.warn("Unsupported schema."),UV=!0}}catch(e){VV.warn("Failed to fetch an ad",e),UV=!0}})},WV=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},YV=function(a,b){b=new _.I(1,10,10003,{errorType:b});a.m.onError(b)},ZV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},
18
+ aW=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=$V(a,c))&&(d={ad:c});a.m.trigger(new _.H(b,d))}},$V=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Uf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.Uf&&(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,
19
+ h)=>g.position-h.position).findIndex(g=>g===e)));c=new Y(d,e,b.index,b.total,f)}return c},bW=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]},cW=function(a){const b=a.dashTimedMetadata;let c=_.pg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.og)?_.Hf:_.mg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,
20
+ value:b&&b.value||"",eventElement:b?b.eventElement:null}},dW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},fW=function(a){a.a=dW().getTextTracksManager();const b=a.a.getTracks();a.j=eW(_.P,b)},eW=function(a,b){const c=[];for(const d of b)b=new _.tr(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||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||
21
+ null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.xr(b.id,b)),c.push(b);return c},gW=function(a,b,c,d){c=_.Zh(c).filter(g=>g);var e=!1;let f=[];b===_.Q?f=a.getAudioTracks():b===_.P&&(f=a.sa());if(c=c.find(g=>{const h=_.Gn(g);return f.some(k=>{k=_.Gn(k.language||"");return _.Hn(h,k)})})){const g=_.Gn(c);c=f.filter(h=>{h=_.Gn(h.language||"");return _.Hn(g,h)});f=c.length?c:f;e=e||!!c.length}_.wi(d)&&(c=f.filter(g=>g.roles.includes(d)),
22
+ f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.Q?a.za(e):b===_.P&&a.$a(e))},hW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},kW=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=a.drm,e=_.ln(d);if(e){var f=[_.vd];_.en(a)[0].type!==_.Dc&&f.unshift(_.xd);d.preferredDrmSystem===_.vd&&f.reverse();
23
+ for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ka[g];h?(c=g===_.xd?cast.framework.ContentProtection.WIDEVINE:g===_.vd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},iW(b,h,a,c),jW(b,h,a,c)):c()}else c()}else c()},lW=function(a,b){b=Object.assign({},a.shakaConfig,b);return Object.assign({},a,{shakaConfig:b})},iW=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.vk({method:_.eb,uris:[e.url]});
24
+ 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},jW=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.zk(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.G(g.data)}):a.licenseHandler=void 0},oW=function(){return mW||
25
+ (mW=new nW)},pW=function(){return cast.framework.CastReceiverContext.getInstance()},qW=function(){const a=pW().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},rW=function(a,b){const c=pW().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,pW().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},tW=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;
26
+ a=pW();var {hlsVideoSegmentFormat:d}=pW().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Ag:_.zg;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=sW(f,_.pa),h=sW(f,_.mb);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")},sW=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),
27
+ c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),0<=d&&(c=c.substring(0,d))));return c},uW=function(a){for(const b of a)a={},b.customData&&_.gh(b.customData)&&(a=b.customData),b.roles&&(a.roles=b.roles),b.audioTrackInfo&&(a.audioTrackInfo=b.audioTrackInfo),_.gh(a)&&(b.customData=a)},vW=function(a){_.w(function*(){yield a.l.L;a.a=a.l.o;a.B.on(a.a.controller,cast.framework.RemotePlayerEventType.ANY_CHANGE,a.C.bind(a))})},wW=function(a,b,c){let d=null;c&&(d={ad:c});
28
+ a.l.trigger(new _.H(b,d))},xW=function(a){if(!a.a||!a.a.mediaInfo)return null;var b=a.a.mediaInfo.breaks;const c=a.a.mediaInfo.breakClips,d=a.a.isPlayingBreak,e=a.a.breakId,f=a.a.currentBreakClipNumber,g=a.a.numberBreakClips,h=a.a.breakClipId;if(!(b&&c&&null!=e&&null!=f&&null!=g&&null!=h&&d))return null;const k=b.find(l=>l.id===e)||null;a=0;k&&(a=0>=k.position?k.position:b.filter(l=>0<=l.position).sort((l,m)=>l.position-m.position).findIndex(l=>l===k));b=c.find(l=>l.id===h)||null;return new Y(b,k,
29
+ f,g,a)},yW=class{constructor(a,b){this.log=new _.T(b);this.player=a;this.l=null;this.h=_.Fs;this.o=7;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Fs)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.D&&this.a(_.vs)}a(a){if(a!==this.h)if(this.h===_.vs&&a!==_.Fs)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;2===this.h?(this.B=b,this.player.trigger(new _.H(_.Qc,{detail:{bufferedTimeMS:-1,
30
+ reason:this.j}}))):2===this.o&&this.player.trigger(new _.H(_.Pc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.os(this.l,this.h);this.player.trigger(new _.H(_.Rf,{detail:a}))}}},zW;_.x("clpp.cast.CastUtils",class{});
31
+ var qV=0,JV={GENERIC:qV,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5},AW="addMissingTimelineCues alwaysStreamText bufferBehind bufferingGoal durationBackoff gapDetectionThreshold ignoreTextStreamFailures lowLatencyMode rebufferingGoal retryParameters safeSeekOffset stallEnabled stallSkip stallThreshold startAtSegmentBoundary".split(" "),BW="bandwidthDowngradeTarget bandwidthUpgradeTarget defaultBandwidthEstimate enabled initialRestrictions restrictions switchInterval".split(" ");var CW=class extends yW{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.dc.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.o)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.o;b&&b.isPlayingBreak||super.a(a)}dc(){if(this.f&&
32
+ 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(5);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.vs);break;default:this.a(_.Fs)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(3);break;case chrome.cast.media.PlayerState.PAUSED:this.a(4);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(2)}}};var DW=class extends _.V{constructor(){super();this.g=new _.T("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.R;break;case chrome.cast.media.TrackType.AUDIO:c=_.Q;break;case chrome.cast.media.TrackType.TEXT:c=_.P}c=new _.tr(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
33
+ c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;if(b.customData){c.src=b.customData.url||c.src;c.mimeType=b.customData.mimeType||c.mimeType;const d=b.customData.roles;d&&(c.roles=d);if(b=b.customData.audioTrackInfo)void 0!==b.numAudioChannels&&(c.channelsCount=b.numAudioChannels),void 0!==b.spatialAudio&&(c.spatialAudio=b.spatialAudio)}c.renditions.push(new _.xr(c.id,c));return c}):[],this.a.trigger(new _.H(_.hg)))}destroy(){this.a=null}getVideoTracks(){return tV(this,_.R)}getAudioTracks(){return tV(this,
34
+ _.Q)}sa(){return tV(this,_.P)}ta(){const a=this.Ha();return a?a.renditions[0]:null}Pa(){const a=this.ra();return a?a.renditions[0]:null}Wa(){const a=this.ua();return a?a.renditions[0]:null}xb(){return this.f[_.R]||null}Nb(){return this.f[_.Q]||null}Ob(){return this.f[_.P]||null}Ha(){return vV(this,_.R)}ra(){return vV(this,_.Q)}ua(){return vV(this,_.P)}Gb(a){xV(this,_.R,a)}za(a){xV(this,_.Q,a)}$a(a){xV(this,_.P,a)}sb(a){this.Gb(a&&a.track)}Eb(a){this.za(a&&a.track)}Fb(a){this.$a(a&&a.track)}addTextTrack(){return _.w(function*(){})}va(){return!0}};
35
+ DW.prototype.isAbrEnabled=DW.prototype.va;DW.prototype.addTextTrack=DW.prototype.addTextTrack;DW.prototype.setTextRendition=DW.prototype.Fb;DW.prototype.setAudioRendition=DW.prototype.Eb;DW.prototype.setVideoRendition=DW.prototype.sb;DW.prototype.setTextTrack=DW.prototype.$a;DW.prototype.setAudioTrack=DW.prototype.za;DW.prototype.setVideoTrack=DW.prototype.Gb;DW.prototype.getTextTrack=DW.prototype.ua;DW.prototype.getAudioTrack=DW.prototype.ra;DW.prototype.getVideoTrack=DW.prototype.Ha;
36
+ DW.prototype.getLoadingTextRendition=DW.prototype.Ob;DW.prototype.getLoadingAudioRendition=DW.prototype.Nb;DW.prototype.getLoadingVideoRendition=DW.prototype.xb;DW.prototype.getTextRendition=DW.prototype.Wa;DW.prototype.getAudioRendition=DW.prototype.Pa;DW.prototype.getVideoRendition=DW.prototype.ta;DW.prototype.getTextTracks=DW.prototype.sa;DW.prototype.getAudioTracks=DW.prototype.getAudioTracks;DW.prototype.getVideoTracks=DW.prototype.getVideoTracks;var NV=class extends _.Tt{constructor(a,b,c,d){super();this.g=new _.T(_.id);this.S=a;this.w=new _.Li(b);this.R=c;this.X=d;this.j=this.G=_.Zm();this.C=[];this.B=0;this.I=new _.Dn;this.a=null;this.f=!1;this.L=new _.Gl;this.A=!1;this.ca="";this.ia=1E6;this.h=new DW;this.h.initialize(this);this.l=new CW(this);this.F=new _.Qt;this.H=null;this.K=new Set;this.M=this.bb.bind(this);this.da=this.Ub.bind(this);this.W=this.Tb.bind(this);this.P=this.Ib.bind(this);this.U=this.lb.bind(this);this.o=this.J=null;window.cast||
37
+ Object.defineProperty(window,"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{AV(!0)},0)}});zV(this);yV.add(this)}init(a,b){this.j=this.G=b}unload(){return this.f?new Promise((a,b)=>{this.h&&this.h.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)}):Promise.resolve()}release(){return this.f?this.unload().then(()=>{this.l&&this.l.release()}):Promise.resolve()}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.ab)}appendLoad(){return Promise.reject(_.ab)}seekWith(){return Promise.reject(_.ab)}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}destroy(){return _.w(function*(){})}Zd(a){this.J=
38
+ a}gd(){return this.f}ya(){return this.A}Ze(){return this.ca}sendMessage(a,b){const c=this;return _.w(function*(){if(c.f){var d=cast.framework.CastContext.getInstance().getCurrentSession();if(d)try{yield d.sendMessage(a,b)}catch(f){var e=new _.I(1,8,8E3,{detailedErrorCode:f})}else e=new _.I(1,8,8004,void 0);if(e)c.onError(e)}})}cast(){const a=this;return _.w(function*(){if(!a.gd())throw a.g.warn(bV),new _.I(1,8,8001,void 0);if(!BV)throw a.g.warn(ZU),new _.I(1,8,8002,void 0);if(a.ya())throw a.g.warn("Already casting"),
39
+ new _.I(1,8,8003,void 0);try{yield DV(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.I(1,8,8E3,c);}})}re(){this.f&&this.ya()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.be&&this.K.add(a)}removeMessageListener(a){typeof a===_.be&&this.K.delete(a)}play(){return this.f?this.isEnded()?FV(this,!0):new Promise((a,b)=>{if(!this.a)return b(YU);
40
+ this.a.play(null,a,b)}):Promise.resolve()}pause(){return this.f?new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(YU);this.a.pause(null,a,b)}):Promise.resolve()}isPaused(){return this.f?!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED:!1}isEnded(){return this.f?5===this.getState():!1}seek(a){return this.f?this.isEnded()?FV(this,!1,a):new Promise((b,c)=>{this.a||c(YU);this.o.isPlayingBreak&&c(WU);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.H(_.ug));
41
+ this.a.seek(d,()=>{this.trigger(new _.H(_.tg));b()},c)}):Promise.resolve()}getPosition(){return this.f?this.getMediaPosition():0}getMediaPosition(){return this.f?this.a&&this.a.getEstimatedTime()||0:0}getDuration(){return this.f?this.getMediaDuration():0}getMediaDuration(){if(!this.f)return 0;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.f?this.a&&
42
+ this.a.playbackRate||0:0}setPlaybackRate(a){this.f&&this.a&&0<a&&this.sendMessage(iV,{type:"SET_PLAYBACK_RATE",requestId:sV(),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.f?this.a&&this.a.volume.level:0}setVolume(a){this.f&&this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.f?this.a&&this.a.volume.muted:!1}setMuted(a){this.f&&this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,
43
43
  a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.f)return 0;if(!this.a||!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(){if(!this.f)return{start:0,end:0};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.f?this.l?this.l.getState():
44
- 7:7}getStats(){return this.f?this.a&&this.a.customData&&this.a.customData.stats?sV(this.a.customData.stats):_.xs():_.xs()}isLive(){return this.f?Infinity===this.getDuration():!1}load(a){const b=this;return _.w(function*(){if(b.gd())if(HV){b.C=_.jn(a);b.j=_.en([b.G,a]);var c=b.C[b.B];yield KV(b,{source:c,isLive:c.isLive,autoplay:b.j.autoplay,Fa:b.j,jc:c.jc,nb:c.nb})}else b.g.warn(eV);else b.g.warn(hV)})}getBufferInfo(){return new _.St}getTrackManager(){return this.h}getConfiguration(){return this.j}getSurface(){return null}setNetworkEngine(a){this.I=
45
- a}getNetworkEngine(){return this.I}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(gV)}onError(a){if(a&&(this.trigger(new _.H(_.Xd,{detail:a})),this.l))this.l.onError(a)}namespace(){return _.hd}canPlay(){return this.gd()?2:0}Lb(){return this.H}gc(a){this.H=OV(a)}$e(){this.H=null}If(a){if(this.f){var b=this.Lb()||
46
- {};a={metadataType:MV(b.metadataType),title:a};this.gc(Object.assign({},b,a))}}Gf(a){if(this.f){var b=this.Lb()||{},c=MV(b.metadataType);a=new chrome.cast.Image(a);this.gc(Object.assign({},b,{metadataType:c,images:[a]}))}}Ff(a){if(this.f){var b=this.Lb()||{};this.gc(Object.assign({},b,{metadataType:3,artist:a}))}}Hf(a){if(this.f){var b=this.Lb()||{};a={metadataType:MV(b.metadataType),releaseDate:a};this.gc(Object.assign({},b,a))}}cb(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===
47
- cast.framework.CastState.CONNECTED;HV=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.ca=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.w.Nf()}Ub(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;RV(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.ya()||(this.A=!0,RV(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.ya()&&
48
- this.a){const d=this.a.media;var b=this.h.ra(),c=this.h.ua();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:SV(this),ih:c,cg:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(mV,this.P);a.session.removeMessageListener(nV,this.U);this.A=!1;this.a=null}}Tb(a){this.g.debug("New media session",a.mediaSession);QV(this,a.mediaSession)}Jb(a){a.value&&
49
- a.value.tracks&&this.h&&this.h.load()}Ib(a,b){const c=sV(b);this.K.forEach(d=>d(c))}lb(a,b){a=sV(b);"event"===a.type&&a.name===_.Eg&&this.trigger(new _.H(_.Uc,{visible:!!a.visible}))}Aa(){this.trigger(new _.H(_.gg))}Ma(a){const b=this;return _.w(function*(){let c=null;const d=yield uV(a,[_.$f,_.Bc],b.I,b.j);d&&(c=new chrome.cast.media.Track(b.ia++,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,
50
- url:a.url});return c})}getTextDisplayer(){return null}},HV=!1,EV=new Set;window.__onGCastApiAvailable=GV;var KW=class extends _.Yt{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.ae?c:this.l;this.a=VV(this);this.g=new _.T(jV);this.forwardEventsTo(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield IV(a.a),a.a=null);a.stopForwardingEventsTo(a.f)})}l(a,b){5!==a&&a!==_.Hs&&(delete b.license,this.f.open(b))}Tc(){return!!this.a&&this.a.gd()&&HV}ya(){return!!this.a&&this.a.ya()}df(){return this.a?this.a.df():""}$d(a){this.a&&this.a.$d(a)}cast(a,b){const c=this;return _.w(function*(){if(c.a)try{if(yield c.a.cast(),
51
- c.a){{let e=null;const f=c.f.Sa();if(f){const g=c.f.getTrackManager(),h=g.getVideoTracks()[0];let k,l;h&&h.mimeType&&(k=h.mimeType);const m=c.f.getConfiguration(),n=g.ra();n&&(n.mimeType&&(l=n.mimeType),n.language&&(m.preferredAudioLanguage=n.language),n.roles.length&&(m.preferredAudioRole=n.roles[0]));const p=g.ua();p&&(p.language&&(m.preferredTextLanguage=p.language),p.roles.length&&(m.preferredTextRole=p.roles[0]));const u=f&&typeof f.isLive===_.Nc?f.isLive:c.f.isLive();e={source:f,isLive:u,autoplay:!c.f.isPaused(),
52
- currentTime:Math.max(c.f.getPosition()-1,0),wf:c.f.getPresentationStartTime(),jc:k,nb:l,Fa:m}}var d=e}b&&d&&(d.queueData={items:b.items,startIndex:b.startIndex});yield UV(c);c.a&&(d&&(d.autoplay=!c.f.isPaused()),a?yield c.f.open(a):c.a.a||(yield KV(c.a,d)))}}catch(e){c.g.error("Error while trying to cast",e),d=new _.H(_.Xd,{detail:e}),c.trigger(d)}})}ue(){this.a&&this.a.ue()}Nh(a){const b=this;return _.w(function*(){a!==b.h&&(b.h=a,b.a&&(yield IV(b.a)),b.a=VV(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?
53
- yield b.a.sendMessage(mV,a):b.g.warn(iV)})}$g(){const a=this;return _.w(function*(){yield a.a.sendMessage(oV,{type:"QUEUE_NEXT",requestId:yV(),mediaSessionId:a.a.a.mediaSessionId})})}ah(){const a=this;return _.w(function*(){yield a.a.sendMessage(oV,{type:"QUEUE_PREV",requestId:yV(),mediaSessionId:a.a.a.mediaSessionId})})}Zg(a){const b=this;return _.w(function*(){yield b.a.sendMessage(oV,{type:"QUEUE_INSERT",requestId:yV(),mediaSessionId:b.a.a.mediaSessionId,items:a})})}addMessageListener(a){this.a?
54
- this.a.addMessageListener(a):this.g.warn(iV)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(iV)}Lb(){return this.a&&this.a.Lb()}gc(a){this.a&&this.a.gc(a)}$e(){this.a&&this.a.$e()}If(a){this.a&&this.a.If(a)}Gf(a){this.a&&this.a.Gf(a)}Ff(a){this.a&&this.a.Ff(a)}Hf(a){this.a&&this.a.Hf(a)}};_.x(jV,KW);KW.prototype.setContentReleaseDate=KW.prototype.Hf;KW.prototype.setContentArtist=KW.prototype.Ff;KW.prototype.setContentImage=KW.prototype.Gf;
55
- KW.prototype.setContentTitle=KW.prototype.If;KW.prototype.clearContentMetadata=KW.prototype.$e;KW.prototype.setContentMetadata=KW.prototype.gc;KW.prototype.getContentMetadata=KW.prototype.Lb;KW.prototype.removeMessageListener=KW.prototype.removeMessageListener;KW.prototype.addMessageListener=KW.prototype.addMessageListener;KW.prototype.queueAddItems=KW.prototype.Zg;KW.prototype.queuePreviousItem=KW.prototype.ah;KW.prototype.queueNextItem=KW.prototype.$g;KW.prototype.sendMessage=KW.prototype.sendMessage;
56
- KW.prototype.changeReceiverId=KW.prototype.Nh;KW.prototype.forceDisconnect=KW.prototype.ue;KW.prototype.cast=KW.prototype.cast;KW.prototype.setPlayerConfigInterceptor=KW.prototype.$d;KW.prototype.getReceiverName=KW.prototype.df;KW.prototype.isCasting=KW.prototype.ya;KW.prototype.canCast=KW.prototype.Tc;KW.prototype.destroy=KW.prototype.destroy;var LW=class extends EW{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.ca.bind(this);this.w=this.X.bind(this);this.K=this.W.bind(this);this.J=this.U.bind(this);this.L=this.ia.bind(this);this.G=this.da.bind(this);this.F=this.P.bind(this);this.f=this.M.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,
44
+ 7:7}getStats(){return this.f?this.a&&this.a.customData&&this.a.customData.stats?mV(this.a.customData.stats):_.ss():_.ss()}isLive(){return this.f?Infinity===this.getDuration():!1}load(a){const b=this;return _.w(function*(){if(b.gd())if(BV){b.C=_.en(a);b.j=_.an([b.G,a]);var c=b.C[b.B];yield EV(b,{source:c,isLive:c.isLive,autoplay:b.j.autoplay,Fa:b.j,jc:c.jc,nb:c.nb})}else b.g.warn(ZU);else b.g.warn(bV)})}getBufferInfo(){return new _.Nt}getTrackManager(){return this.h}getConfiguration(){return this.j}getSurface(){return null}setNetworkEngine(a){this.I=
45
+ a}getNetworkEngine(){return this.I}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(aV)}onError(a){if(a&&(this.trigger(new _.H(_.Yd,{detail:a})),this.l))this.l.onError(a)}namespace(){return _.id}canPlay(){return this.gd()?2:0}Lb(){return this.H}gc(a){this.H=IV(a)}Ve(){this.H=null}Cf(a){if(this.f){var b=this.Lb()||
46
+ {};a={metadataType:GV(b.metadataType),title:a};this.gc(Object.assign({},b,a))}}Af(a){if(this.f){var b=this.Lb()||{},c=GV(b.metadataType);a=new chrome.cast.Image(a);this.gc(Object.assign({},b,{metadataType:c,images:[a]}))}}zf(a){if(this.f){var b=this.Lb()||{};this.gc(Object.assign({},b,{metadataType:3,artist:a}))}}Bf(a){if(this.f){var b=this.Lb()||{};a={metadataType:GV(b.metadataType),releaseDate:a};this.gc(Object.assign({},b,a))}}bb(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===
47
+ cast.framework.CastState.CONNECTED;BV=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.ca=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.w.Hf()}Ub(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;LV(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.ya()||(this.A=!0,LV(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.ya()&&
48
+ this.a){const d=this.a.media;var b=this.h.ra(),c=this.h.ua();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:MV(this),eh:c,Yf:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(gV,this.P);a.session.removeMessageListener(hV,this.U);this.A=!1;this.a=null}}Tb(a){this.g.debug("New media session",a.mediaSession);KV(this,a.mediaSession)}Jb(a){a.value&&
49
+ a.value.tracks&&this.h&&this.h.load()}Ib(a,b){const c=mV(b);this.K.forEach(d=>d(c))}lb(a,b){a=mV(b);"event"===a.type&&a.name===_.Eg&&this.trigger(new _.H(_.Vc,{visible:!!a.visible}))}Aa(){this.trigger(new _.H(_.gg))}La(a){const b=this;return _.w(function*(){let c=null;const d=yield oV(a,[_.$f,_.Cc],b.I,b.j);d&&(c=new chrome.cast.media.Track(b.ia++,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,
50
+ url:a.url});return c})}getTextDisplayer(){return null}},BV=!1,yV=new Set;window.__onGCastApiAvailable=AV;var EW=class extends _.Tt{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.be?c:this.l;this.a=PV(this);this.g=new _.T(dV);this.forwardEventsTo(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield CV(a.a),a.a=null);a.stopForwardingEventsTo(a.f)})}l(a,b){5!==a&&a!==_.Fs&&(delete b.license,this.f.open(b))}Sc(){return!!this.a&&this.a.gd()&&BV}ya(){return!!this.a&&this.a.ya()}Ze(){return this.a?this.a.Ze():""}Zd(a){this.a&&this.a.Zd(a)}cast(a,b){const c=this;return _.w(function*(){if(c.a)try{if(yield c.a.cast(),
51
+ c.a){{let e=null;const f=c.f.Ra();if(f){const g=c.f.getTrackManager(),h=g.getVideoTracks()[0];let k,l;h&&h.mimeType&&(k=h.mimeType);const m=c.f.getConfiguration(),n=g.ra();n&&(n.mimeType&&(l=n.mimeType),n.language&&(m.preferredAudioLanguage=n.language),n.roles.length&&(m.preferredAudioRole=n.roles[0]));const p=g.ua();p&&(p.language&&(m.preferredTextLanguage=p.language),p.roles.length&&(m.preferredTextRole=p.roles[0]));const u=f&&typeof f.isLive===_.Oc?f.isLive:c.f.isLive();e={source:f,isLive:u,autoplay:!c.f.isPaused(),
52
+ currentTime:Math.max(c.f.getPosition()-1,0),qf:c.f.getPresentationStartTime(),jc:k,nb:l,Fa:m}}var d=e}b&&d&&(d.queueData={items:b.items,startIndex:b.startIndex});yield OV(c);c.a&&(d&&(d.autoplay=!c.f.isPaused()),a?yield c.f.open(a):c.a.a||(yield EV(c.a,d)))}}catch(e){c.g.error("Error while trying to cast",e),d=new _.H(_.Yd,{detail:e}),c.trigger(d)}})}re(){this.a&&this.a.re()}Ih(a){const b=this;return _.w(function*(){a!==b.h&&(b.h=a,b.a&&(yield CV(b.a)),b.a=PV(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?
53
+ yield b.a.sendMessage(gV,a):b.g.warn(cV)})}Vg(){const a=this;return _.w(function*(){yield a.a.sendMessage(iV,{type:"QUEUE_NEXT",requestId:sV(),mediaSessionId:a.a.a.mediaSessionId})})}Wg(){const a=this;return _.w(function*(){yield a.a.sendMessage(iV,{type:"QUEUE_PREV",requestId:sV(),mediaSessionId:a.a.a.mediaSessionId})})}Ug(a){const b=this;return _.w(function*(){yield b.a.sendMessage(iV,{type:"QUEUE_INSERT",requestId:sV(),mediaSessionId:b.a.a.mediaSessionId,items:a})})}addMessageListener(a){this.a?
54
+ this.a.addMessageListener(a):this.g.warn(cV)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(cV)}Lb(){return this.a&&this.a.Lb()}gc(a){this.a&&this.a.gc(a)}Ve(){this.a&&this.a.Ve()}Cf(a){this.a&&this.a.Cf(a)}Af(a){this.a&&this.a.Af(a)}zf(a){this.a&&this.a.zf(a)}Bf(a){this.a&&this.a.Bf(a)}};_.x(dV,EW);EW.prototype.setContentReleaseDate=EW.prototype.Bf;EW.prototype.setContentArtist=EW.prototype.zf;EW.prototype.setContentImage=EW.prototype.Af;
55
+ EW.prototype.setContentTitle=EW.prototype.Cf;EW.prototype.clearContentMetadata=EW.prototype.Ve;EW.prototype.setContentMetadata=EW.prototype.gc;EW.prototype.getContentMetadata=EW.prototype.Lb;EW.prototype.removeMessageListener=EW.prototype.removeMessageListener;EW.prototype.addMessageListener=EW.prototype.addMessageListener;EW.prototype.queueAddItems=EW.prototype.Ug;EW.prototype.queuePreviousItem=EW.prototype.Wg;EW.prototype.queueNextItem=EW.prototype.Vg;EW.prototype.sendMessage=EW.prototype.sendMessage;
56
+ EW.prototype.changeReceiverId=EW.prototype.Ih;EW.prototype.forceDisconnect=EW.prototype.re;EW.prototype.cast=EW.prototype.cast;EW.prototype.setPlayerConfigInterceptor=EW.prototype.Zd;EW.prototype.getReceiverName=EW.prototype.Ze;EW.prototype.isCasting=EW.prototype.ya;EW.prototype.canCast=EW.prototype.Sc;EW.prototype.destroy=EW.prototype.destroy;var FW=class extends yW{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.ca.bind(this);this.w=this.X.bind(this);this.K=this.W.bind(this);this.J=this.U.bind(this);this.L=this.ia.bind(this);this.G=this.da.bind(this);this.F=this.P.bind(this);this.f=this.M.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,
57
57
  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.L);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 _.w(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
58
58
  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.L);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 _.H(_.Xe));this.a(3)}R(){this.a(4)}ca(){this.a(5)}X(a){a.isBuffering?
59
- this.a(2):(a=this.player.isPaused()?4:3,this.a(a))}W(){this.j=1;this.player.trigger(new _.H(_.ug))}U(){this.player.trigger(new _.H(_.qg))}ia(){this.j=2}da(){this.a(1)}M(a){const b=this.player.getStats();this.player.trigger(new _.H(_.Mc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}P(a){a=new _.I(_.D,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.H(_.Xd,{detail:a}));this.a(_.As)}};var MW=class extends _.Yt{constructor(a=[],b=0){super();this.a=a.slice();this.f=b}Hd(){return this.a}getPosition(){return this.f}Mb(){return this.a[this.f]||null}Dg(){return this.a[this.f+1]||null}setPosition(a){0>a||a>=this.a.length||(this.f=a,this.trigger(new _.H(_.jf,{item:this.Mb()})))}append(a){this.a.push(a);WV(this)}Hg(a,b){0>b||b>this.a.length||(this.a.splice(b,0,a),WV(this))}remove(a){0>a||a>=this.a.length||a===this.f||(this.a.splice(a,1),this.f>a&&this.f--,WV(this))}clear(){this.a=[];this.f=
60
- 0;WV(this)}};var NW=class extends _.Yt{constructor(a,b,c){c=void 0===c?()=>Promise.resolve():c;super();this.m=a;this.a=b;this.w=c;this.j=this.f=this.h=!1;this.o=()=>{const d=this;return _.w(function*(){if(!d.f){var e=d.a.Mb();if(e){d.f=!0;try{yield d.w(e),yield d.m.open(Object.assign({},e.configuration,{autoplay:!0}))}catch(f){throw f;}finally{d.f=!1}}}})};this.l=()=>{YV(this)}}start(){this.h||this.f||(this.h=!0,this.m.on(_.Wd,this.l),XV(this),this.a.setPosition(this.a.getPosition()))}next(){const a=this.a.Mb();
61
- a&&!1===a.skippable||YV(this)}Wd(){var a=this.a.Mb();a&&!1===a.skippable||(XV(this),a=Math.max(0,this.a.getPosition()-1),this.a.setPosition(a))}ed(a){const b=this;return _.w(function*(){b.a.setPosition(a)})}stop(){this.h=!1;this.m.off(_.Wd,this.l);this.a.off(_.jf,this.o);this.j=!1}};var OW=class{constructor(a,b,c){this.player=a;this.Rb=new MW(c);this.sd=new NW({open:this.player.open.bind(this.player),off:this.player.off.bind(this.player),on:this.player.on.bind(this.player)},this.Rb,()=>_.w(function*(){}));this.a=new KW(this.player,b,(d,e)=>{const f=this;return _.w(function*(){const g=f.Rb.getPosition();f.sd.ed(g);e.autoplay=!0;delete e.license;yield f.player.open(e);typeof e.currentTime===_.r&&(yield f.player.setPosition(Math.max(e.currentTime-1,0)));f.player.play()})});this.f=
62
- d=>{d&&d.type===fV&&typeof d.index===_.r&&this.Rb.setPosition(d.index)};this.a.addMessageListener(this.f)}Hi(a){return this.Rb.on(_.jf,a)}Ii(a){return this.Rb.on(_.kf,a)}Fi(a){return this.player.on(_.Tc,a)}Tc(){return this.a.Tc()}ji(){return this.Rb.Hd()}ya(){return this.a.ya()}append(a){const b=this;return _.w(function*(){b.Rb.append(a);b.a.ya()&&(yield b.a.Zg(ZV([a])))})}di(){return this.Rb.getPosition()}start(){this.sd.start()}play(){this.player.play()}pause(){this.player.pause()}destroy(){this.sd.stop();
63
- this.a.removeMessageListener(this.f);this.a.destroy();this.player.release()}lj(){const a=this;return _.w(function*(){if(a.a.ya())a.a.ue();else{a.sd.stop();var b=ZV(a.Rb.Hd()),c=a.Rb.getPosition();yield a.a.cast(void 0,{items:b,startIndex:c})}})}next(){const a=this;return _.w(function*(){a.a.ya()?yield a.a.$g():yield a.sd.next()})}Wd(){const a=this;return _.w(function*(){a.a.ya()?yield a.a.ah():yield a.sd.Wd()})}};_.x("clpp.cast.playlist.CastPlaylist",OW);OW.prototype.previous=OW.prototype.Wd;
64
- OW.prototype.next=OW.prototype.next;OW.prototype.toggleCast=OW.prototype.lj;OW.prototype.destroy=OW.prototype.destroy;OW.prototype.pause=OW.prototype.pause;OW.prototype.play=OW.prototype.play;OW.prototype.start=OW.prototype.start;OW.prototype.getCurrentIndex=OW.prototype.di;OW.prototype.append=OW.prototype.append;OW.prototype.isCasting=OW.prototype.ya;OW.prototype.getPlaylistItems=OW.prototype.ji;OW.prototype.canCast=OW.prototype.Tc;OW.prototype.onCastStatusChanged=OW.prototype.Fi;
65
- OW.prototype.onPlaylistModified=OW.prototype.Ii;OW.prototype.onPlaylistItemChange=OW.prototype.Hi;var Y=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.r?c:1;this.h=typeof d===_.r?d:1;this.j=typeof e===_.r?e:0}eb(){return"Google Cast Framework"}fb(){return cast.framework.VERSION}hb(){return 0}getId(){return this.a.id}getCreativeId(){return""}zb(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||
66
- 0}Bb(){return!1}Ra(){return this.a.clickThroughUrl||null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}Va(){return 0}Ua(){return 0}Ba(){return 0}Ca(){switch(this.pb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}pb(){return this.f.position}gb(){return this.l}Wa(){return this.h}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Ab(){return null}};Y.prototype.getVideoElement=Y.prototype.Ab;
67
- Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.canSeek=Y.prototype.canSeek;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.Wa;Y.prototype.getPositionInSequence=Y.prototype.gb;Y.prototype.getPodTimeOffset=Y.prototype.pb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Ca;Y.prototype.getMediaBitrate=Y.prototype.Ba;
68
- Y.prototype.getMediaHeight=Y.prototype.Ua;Y.prototype.getMediaWidth=Y.prototype.Va;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Ra;Y.prototype.isBumper=Y.prototype.Bb;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getPosition=Y.prototype.getPosition;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;
69
- Y.prototype.getApiFramework=Y.prototype.getApiFramework;Y.prototype.getSourceId=Y.prototype.zb;Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.hb;Y.prototype.getAdManagerVersion=Y.prototype.fb;Y.prototype.getAdManagerName=Y.prototype.eb;var PW=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Qb(){return!!this.a.find(a=>0===a.position)}Pb(){return!!this.a.find(a=>-1===a.position)}};PW.prototype.hasPostroll=PW.prototype.Pb;PW.prototype.hasPreroll=PW.prototype.Qb;PW.prototype.getCuePoints=PW.prototype.getCuePoints;var QW=class{constructor(a){this.m=a;this.a=null;this.B=this.C.bind(this);this.l=[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];this.f=!1;
70
- eW().addEventListener(this.l,this.B)}load(){const a=this;return _.w(function*(){$V&&($V=!1,dW(a,0))})}j(){return!0}A(){}jb(){-1!==this.getPosition()&&eW().pause()}skip(){}getAdVolume(){aW.warn(pV);return 0}h(){aW.warn(pV)}setMuted(){}isMuted(){return!1}qb(){return-1!==this.getPosition()}isPaused(){return this.f}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}w(){return!0}o(){const a=this;return _.w(function*(){eW().removeEventListener(a.l,a.B)})}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.jb()}resume(){this.j()}C(a){const b=
71
- cast.framework.events.EndedReason;switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=eW().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.H(_.qc,{adsTimeline:new PW(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:gW(this,_.dc,a);break;case cast.framework.events.EventType.BREAK_STARTED:gW(this,_.Ub,a);break;case cast.framework.events.EventType.BREAK_ENDED:gW(this,_.Vb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:gW(this,
72
- _.mc,a);break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(gW(this,_.lc,a),gW(this,_.nc,a)):a.endedReason===b.STOPPED?gW(this,_.nc,a):a.endedReason===b.END_OF_STREAM?(gW(this,_.Yb,a),gW(this,_.nc,a)):a.endedReason===b.ERROR&&dW(this,1);break;case cast.framework.events.EventType.PLAYING:this.f=!1;gW(this,_.kc,a);break;case cast.framework.events.EventType.PAUSE:this.f=!0;gW(this,_.hc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?gW(this,_.Wb,
73
- a):(this.f=!1,gW(this,_.kc,a))}}};QW.prototype.resume=QW.prototype.resume;QW.prototype.pause=QW.prototype.pause;QW.prototype.getVolume=QW.prototype.getVolume;QW.prototype.setVolume=QW.prototype.setVolume;QW.prototype.getPosition=QW.prototype.getPosition;QW.prototype.skip=QW.prototype.skip;var $V=!1,aW=new _.T("clpp.cast.ads.AdsManager");var RW=class{constructor(a){this.a=a;this.f=this.h.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(hW(),this.f)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(hW(),this.f)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>iW(a))}h(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
74
- _.cg;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.dg;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.eg}b&&this.a(new _.H(b,{detail:iW(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.a(new _.H(_.cg,{detail:b}))}};var SW=class extends _.V{constructor(){super();this.g=new _.T("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;jW().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;jW().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}sa(){return this.j}ta(){return null}Qa(){const a=
75
- this.ra();return a&&a.renditions[0]}Xa(){const a=this.ua();return a&&a.renditions[0]}xb(){return null}Nb(){return null}Ob(){return null}Ia(){return null}ra(){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}ua(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.sa().find(c=>c.id===b)||null)}return a}Gb(){this.g.warn("Video tracks unavailable on Cast")}za(a){a&&this.f&&
76
- this.f.setActiveById(+a.id)}ab(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}sb(){this.g.warn("Video renditions unavailable on Cast")}Eb(a){this.za(a&&a.track)}Fb(a){this.ab(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.m.getConfiguration();if((c=yield uV(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=
77
- 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]),lW(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}va(){return!0}w(){this.f=jW().getAudioTracksManager();var a=this.f.getTracks();this.h=kW(_.Q,a);lW(this);a=this.m.getConfiguration();mW(this,_.Q,a.preferredAudioLanguage,a.preferredAudioRole);mW(this,_.P,a.preferredTextLanguage,a.preferredTextRole)}};SW.prototype.isAbrEnabled=SW.prototype.va;
78
- SW.prototype.addTextTrack=SW.prototype.addTextTrack;SW.prototype.setTextRendition=SW.prototype.Fb;SW.prototype.setAudioRendition=SW.prototype.Eb;SW.prototype.setVideoRendition=SW.prototype.sb;SW.prototype.setTextTrack=SW.prototype.ab;SW.prototype.setAudioTrack=SW.prototype.za;SW.prototype.setVideoTrack=SW.prototype.Gb;SW.prototype.getTextTrack=SW.prototype.ua;SW.prototype.getAudioTrack=SW.prototype.ra;SW.prototype.getVideoTrack=SW.prototype.Ia;SW.prototype.getLoadingTextRendition=SW.prototype.Ob;
79
- SW.prototype.getLoadingAudioRendition=SW.prototype.Nb;SW.prototype.getLoadingVideoRendition=SW.prototype.xb;SW.prototype.getTextRendition=SW.prototype.Xa;SW.prototype.getAudioRendition=SW.prototype.Qa;SW.prototype.getVideoRendition=SW.prototype.ta;SW.prototype.getTextTracks=SW.prototype.sa;SW.prototype.getAudioTracks=SW.prototype.getAudioTracks;SW.prototype.getVideoTracks=SW.prototype.getVideoTracks;var TW=class extends _.Yt{constructor(){super();this.g=new _.T(kV);this.h=this.w=_.cn();this.A=null;this.l=-1;this.F=new _.Hn;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.h=this.w=b);a=nW();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new LW(this);this.a.init();this.j=new SW;this.j.initialize(this);this.o=new RW(c=>this.trigger(c));this.o.init()}unload(){const a=
80
- cast.framework.messages.PlayerState,b=nW();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 _.w(function*(){a.B=null;a.w=_.cn();a.h=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(){nW().play();return Promise.resolve()}pause(){nW().pause();return Promise.resolve()}isPaused(){return nW().getPlayerState()===
81
- cast.framework.messages.PlayerState.PAUSED}isEnded(){return nW().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=nW();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(bV);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}getMediaPosition(){return nW().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
82
- nW().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return nW().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;nW().sendLocalMediaRequest(b)}}getVolume(){this.g.warn(pV);return null}setVolume(){this.g.warn(pV)}setMuted(){this.g.warn(pV)}isMuted(){this.g.warn(pV);return!1}getLoadedSource(){const a=nW().getMediaInformation();if(a){var b=nW().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;
83
- 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,Fj:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return nW().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=nW().getLiveSeekableRange();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():7}getStats(){var a=
84
- _.xs();if(this.f){a=nW().getStats();this.f.h=a.estimatedBandwidth||NaN;this.f.w=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.A=a.width||NaN;b.j=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.o=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.l=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.w(function*(){b.f=new _.uv;b.a.l=b.f.a;b.A=_.jn(a);b.h=_.en([b.w,a]);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;
85
- d.autoplay=b.h.autoplay;typeof b.h.startTime===_.r&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:rV(b.h),local:!0};yield nW().load(d)}})}getBufferInfo(){this.g.warn(_.qa);return new _.St}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.ab)}appendLoad(){return Promise.reject(_.ab)}seekWith(){return Promise.reject(_.ab)}setNetworkEngine(a){this.F=
86
- a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return kV}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(gV)}onError(a){a=new _.H(_.Xd,{detail:a});this.trigger(a)}canPlay(){return _.aj()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=rV(this.getStats());var b=nW(),c=a.media||b.getMediaInformation();b=
87
- b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==b&&(this.g.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=nW().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;
88
- h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){var c=null;a.media.customData&&(c=sV(a.media.customData.playerConfiguration));var d=null;var e=null;a.media.customData&&(d=sV(a.media.customData["com.castlabs.reactnative.PlayerConfiguration"]),e=sV(a.media.customData.playerConfiguration));a=(a=d&&d.LiveConfiguration)?0===a.liveEdgeLatencyMs:!1;d=!(!d||!d.lowLatencyMode);b=(e=null!=e&&e.lowLatencyMode||a||d)?rW(b,{streaming:{lowLatencyMode:!0}}):
89
- b;if(!c)return b;e=c.chromecast||null;a=c.abr||null;d=b;a&&typeof a.defaultBandwidthEstimate===_.r?d.initialBandwidth=a.defaultBandwidthEstimate:d.initialBandwidth=void 0;qW(c,b);a={};d=c.streaming||null;e&&e.useSenderStreamingConfig&&d&&(a.streaming=tV(d,GW));c=c.abr||null;e&&e.useSenderAbrConfig&&c&&(a.abr=tV(c,HW));_.kh(a)&&(b=rW(b,a));return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};var tW=class{constructor(){this.a=!1;this.g=new _.T(lV);this.f=this.m=null;this.w=new Set;this.C=this.K.bind(this);this.B=this.F.bind(this);this.o=null;this.l=new _.Vt;this.j=this.h=this.A=null}init(a){a&&(this.f=new TW,_.ao(a,this.f),this.m=a,this.l.on(window,"unload",()=>{const b=this;return _.w(function*(){b.m&&b.m.getState()!==_.Hs&&(yield qV(b.m))})}))}start(a){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var b=vW(),c=vW().getPlayerManager(),d=new cast.framework.CastReceiverOptions;
90
- a&&null!=a.useShakaForHls&&(d.useShakaForHls=a.useShakaForHls);d.customNamespaces={};d.customNamespaces[mV]=cast.framework.system.MessageType.JSON;d.customNamespaces[nV]=cast.framework.system.MessageType.JSON;a=new cast.framework.PlaybackConfig;a.manifestHandler=this.I.bind(this);a.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};a.enableSmoothLiveRefresh=!0;d.playbackConfig=a;if(a=this.m&&this.m.getSurface().getMedia())d.mediaElement=a;d.disableIdleTimeout=!0;d.maxInactivity=Infinity;this.h&&
59
+ this.a(2):(a=this.player.isPaused()?4:3,this.a(a))}W(){this.j=1;this.player.trigger(new _.H(_.ug))}U(){this.player.trigger(new _.H(_.tg))}ia(){this.j=2}da(){this.a(1)}M(a){const b=this.player.getStats();this.player.trigger(new _.H(_.Nc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}P(a){a=new _.I(_.D,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.H(_.Yd,{detail:a}));this.a(_.vs)}};var GW=class extends _.Tt{constructor(a=[],b=0){super();this.a=a.slice();this.f=b}Hd(){return this.a}getPosition(){return this.f}Mb(){return this.a[this.f]||null}yg(){return this.a[this.f+1]||null}setPosition(a){0>a||a>=this.a.length||(this.f=a,this.trigger(new _.H(_.jf,{item:this.Mb()})))}append(a){this.a.push(a);QV(this)}Cg(a,b){0>b||b>this.a.length||(this.a.splice(b,0,a),QV(this))}remove(a){0>a||a>=this.a.length||a===this.f||(this.a.splice(a,1),this.f>a&&this.f--,QV(this))}clear(){this.a=[];this.f=
60
+ 0;QV(this)}};var HW=class extends _.Tt{constructor(a,b,c){c=void 0===c?()=>Promise.resolve():c;super();this.m=a;this.a=b;this.w=c;this.j=this.f=this.h=!1;this.o=()=>{const d=this;return _.w(function*(){if(!d.f){var e=d.a.Mb();if(e){d.f=!0;try{yield d.w(e),yield d.m.open(Object.assign({},e.configuration,{autoplay:!0}))}catch(f){throw f;}finally{d.f=!1}}}})};this.l=()=>{SV(this)}}start(){this.h||this.f||(this.h=!0,this.m.on(_.Xd,this.l),RV(this),this.a.setPosition(this.a.getPosition()))}next(){const a=this.a.Mb();
61
+ a&&!1===a.skippable||SV(this)}Wd(){var a=this.a.Mb();a&&!1===a.skippable||(RV(this),a=Math.max(0,this.a.getPosition()-1),this.a.setPosition(a))}ed(a){const b=this;return _.w(function*(){b.a.setPosition(a)})}stop(){this.h=!1;this.m.off(_.Xd,this.l);this.a.off(_.jf,this.o);this.j=!1}};var IW=class{constructor(a,b,c){this.player=a;this.Rb=new GW(c);this.sd=new HW({open:this.player.open.bind(this.player),off:this.player.off.bind(this.player),on:this.player.on.bind(this.player)},this.Rb,()=>_.w(function*(){}));this.a=new EW(this.player,b,(d,e)=>{const f=this;return _.w(function*(){const g=f.Rb.getPosition();f.sd.ed(g);e.autoplay=!0;delete e.license;yield f.player.open(e);typeof e.currentTime===_.r&&(yield f.player.setPosition(Math.max(e.currentTime-1,0)));f.player.play()})});this.f=
62
+ d=>{d&&d.type===$U&&typeof d.index===_.r&&this.Rb.setPosition(d.index)};this.a.addMessageListener(this.f)}Ci(a){return this.Rb.on(_.jf,a)}Di(a){return this.Rb.on(_.kf,a)}Ai(a){return this.player.on(_.Uc,a)}Sc(){return this.a.Sc()}ei(){return this.Rb.Hd()}ya(){return this.a.ya()}append(a){const b=this;return _.w(function*(){b.Rb.append(a);b.a.ya()&&(yield b.a.Ug(TV([a])))})}Zh(){return this.Rb.getPosition()}start(){this.sd.start()}play(){this.player.play()}pause(){this.player.pause()}destroy(){this.sd.stop();
63
+ this.a.removeMessageListener(this.f);this.a.destroy();this.player.release()}gj(){const a=this;return _.w(function*(){if(a.a.ya())a.a.re();else{a.sd.stop();var b=TV(a.Rb.Hd()),c=a.Rb.getPosition();yield a.a.cast(void 0,{items:b,startIndex:c})}})}next(){const a=this;return _.w(function*(){a.a.ya()?yield a.a.Vg():yield a.sd.next()})}Wd(){const a=this;return _.w(function*(){a.a.ya()?yield a.a.Wg():yield a.sd.Wd()})}};_.x("clpp.cast.playlist.CastPlaylist",IW);IW.prototype.previous=IW.prototype.Wd;
64
+ IW.prototype.next=IW.prototype.next;IW.prototype.toggleCast=IW.prototype.gj;IW.prototype.destroy=IW.prototype.destroy;IW.prototype.pause=IW.prototype.pause;IW.prototype.play=IW.prototype.play;IW.prototype.start=IW.prototype.start;IW.prototype.getCurrentIndex=IW.prototype.Zh;IW.prototype.append=IW.prototype.append;IW.prototype.isCasting=IW.prototype.ya;IW.prototype.getPlaylistItems=IW.prototype.ei;IW.prototype.canCast=IW.prototype.Sc;IW.prototype.onCastStatusChanged=IW.prototype.Ai;
65
+ IW.prototype.onPlaylistModified=IW.prototype.Di;IW.prototype.onPlaylistItemChange=IW.prototype.Ci;var Y=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.r?c:1;this.h=typeof d===_.r?d:1;this.j=typeof e===_.r?e:0}cb(){return"Google Cast Framework"}eb(){return cast.framework.VERSION}gb(){return 0}getId(){return this.a.id}getCreativeId(){return""}zb(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||
66
+ 0}Bb(){return!1}Qa(){return this.a.clickThroughUrl||null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}Ua(){return 0}Ta(){return 0}Ba(){return 0}Ca(){switch(this.pb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}pb(){return this.f.position}fb(){return this.l}Va(){return this.h}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Ab(){return null}};Y.prototype.getVideoElement=Y.prototype.Ab;
67
+ Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.canSeek=Y.prototype.canSeek;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.Va;Y.prototype.getPositionInSequence=Y.prototype.fb;Y.prototype.getPodTimeOffset=Y.prototype.pb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Ca;Y.prototype.getMediaBitrate=Y.prototype.Ba;
68
+ Y.prototype.getMediaHeight=Y.prototype.Ta;Y.prototype.getMediaWidth=Y.prototype.Ua;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Qa;Y.prototype.isBumper=Y.prototype.Bb;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getPosition=Y.prototype.getPosition;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;
69
+ Y.prototype.getApiFramework=Y.prototype.getApiFramework;Y.prototype.getSourceId=Y.prototype.zb;Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.gb;Y.prototype.getAdManagerVersion=Y.prototype.eb;Y.prototype.getAdManagerName=Y.prototype.cb;var JW=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Qb(){return!!this.a.find(a=>0===a.position)}Pb(){return!!this.a.find(a=>-1===a.position)}};JW.prototype.hasPostroll=JW.prototype.Pb;JW.prototype.hasPreroll=JW.prototype.Qb;JW.prototype.getCuePoints=JW.prototype.getCuePoints;var KW=class{constructor(a){this.m=a;this.a=null;this.B=this.C.bind(this);this.l=[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];this.f=!1;
70
+ ZV().addEventListener(this.l,this.B)}load(){const a=this;return _.w(function*(){UV&&(UV=!1,YV(a,0))})}j(){return!0}A(){}ib(){-1!==this.getPosition()&&ZV().pause()}skip(){}getAdVolume(){VV.warn(jV);return 0}h(){VV.warn(jV)}setMuted(){}isMuted(){return!1}qb(){return-1!==this.getPosition()}isPaused(){return this.f}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}w(){return!0}o(){const a=this;return _.w(function*(){ZV().removeEventListener(a.l,a.B)})}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.ib()}resume(){this.j()}C(a){const b=
71
+ cast.framework.events.EndedReason;switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=ZV().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.H(_.qc,{adsTimeline:new JW(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:aW(this,_.dc,a);break;case cast.framework.events.EventType.BREAK_STARTED:aW(this,_.Ub,a);break;case cast.framework.events.EventType.BREAK_ENDED:aW(this,_.Vb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:aW(this,
72
+ _.mc,a);break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(aW(this,_.lc,a),aW(this,_.nc,a)):a.endedReason===b.STOPPED?aW(this,_.nc,a):a.endedReason===b.END_OF_STREAM?(aW(this,_.Yb,a),aW(this,_.nc,a)):a.endedReason===b.ERROR&&YV(this,1);break;case cast.framework.events.EventType.PLAYING:this.f=!1;aW(this,_.kc,a);break;case cast.framework.events.EventType.PAUSE:this.f=!0;aW(this,_.hc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?aW(this,_.Wb,
73
+ a):(this.f=!1,aW(this,_.kc,a))}}};KW.prototype.resume=KW.prototype.resume;KW.prototype.pause=KW.prototype.pause;KW.prototype.getVolume=KW.prototype.getVolume;KW.prototype.setVolume=KW.prototype.setVolume;KW.prototype.getPosition=KW.prototype.getPosition;KW.prototype.skip=KW.prototype.skip;var UV=!1,VV=new _.T("clpp.cast.ads.AdsManager");var LW=class{constructor(a){this.a=a;this.f=this.h.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(bW(),this.f)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(bW(),this.f)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>cW(a))}h(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
74
+ _.cg;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.dg;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.eg}b&&this.a(new _.H(b,{detail:cW(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.a(new _.H(_.cg,{detail:b}))}};var MW=class extends _.V{constructor(){super();this.g=new _.T("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;dW().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;dW().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}sa(){return this.j}ta(){return null}Pa(){const a=
75
+ this.ra();return a&&a.renditions[0]}Wa(){const a=this.ua();return a&&a.renditions[0]}xb(){return null}Nb(){return null}Ob(){return null}Ha(){return null}ra(){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}ua(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.sa().find(c=>c.id===b)||null)}return a}Gb(){this.g.warn("Video tracks unavailable on Cast")}za(a){a&&this.f&&
76
+ this.f.setActiveById(+a.id)}$a(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}sb(){this.g.warn("Video renditions unavailable on Cast")}Eb(a){this.za(a&&a.track)}Fb(a){this.$a(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.m.getConfiguration();if((c=yield oV(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=
77
+ 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]),fW(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}va(){return!0}w(){this.f=dW().getAudioTracksManager();var a=this.f.getTracks();this.h=eW(_.Q,a);fW(this);a=this.m.getConfiguration();gW(this,_.Q,a.preferredAudioLanguage,a.preferredAudioRole);gW(this,_.P,a.preferredTextLanguage,a.preferredTextRole)}};MW.prototype.isAbrEnabled=MW.prototype.va;
78
+ MW.prototype.addTextTrack=MW.prototype.addTextTrack;MW.prototype.setTextRendition=MW.prototype.Fb;MW.prototype.setAudioRendition=MW.prototype.Eb;MW.prototype.setVideoRendition=MW.prototype.sb;MW.prototype.setTextTrack=MW.prototype.$a;MW.prototype.setAudioTrack=MW.prototype.za;MW.prototype.setVideoTrack=MW.prototype.Gb;MW.prototype.getTextTrack=MW.prototype.ua;MW.prototype.getAudioTrack=MW.prototype.ra;MW.prototype.getVideoTrack=MW.prototype.Ha;MW.prototype.getLoadingTextRendition=MW.prototype.Ob;
79
+ MW.prototype.getLoadingAudioRendition=MW.prototype.Nb;MW.prototype.getLoadingVideoRendition=MW.prototype.xb;MW.prototype.getTextRendition=MW.prototype.Wa;MW.prototype.getAudioRendition=MW.prototype.Pa;MW.prototype.getVideoRendition=MW.prototype.ta;MW.prototype.getTextTracks=MW.prototype.sa;MW.prototype.getAudioTracks=MW.prototype.getAudioTracks;MW.prototype.getVideoTracks=MW.prototype.getVideoTracks;var NW=class extends _.Tt{constructor(){super();this.g=new _.T(eV);this.h=this.w=_.Zm();this.A=null;this.l=-1;this.F=new _.Dn;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.h=this.w=b);a=hW();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new FW(this);this.a.init();this.j=new MW;this.j.initialize(this);this.o=new LW(c=>this.trigger(c));this.o.init()}unload(){const a=
80
+ cast.framework.messages.PlayerState,b=hW();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 _.w(function*(){a.B=null;a.w=_.Zm();a.h=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(){hW().play();return Promise.resolve()}pause(){hW().pause();return Promise.resolve()}isPaused(){return hW().getPlayerState()===
81
+ cast.framework.messages.PlayerState.PAUSED}isEnded(){return hW().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=hW();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(WU);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}getMediaPosition(){return hW().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
82
+ hW().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return hW().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;hW().sendLocalMediaRequest(b)}}getVolume(){this.g.warn(jV);return null}setVolume(){this.g.warn(jV)}setMuted(){this.g.warn(jV)}isMuted(){this.g.warn(jV);return!1}getLoadedSource(){const a=hW().getMediaInformation();if(a){var b=hW().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;
83
+ 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,Bj:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return hW().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=hW().getLiveSeekableRange();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():7}getStats(){var a=
84
+ _.ss();if(this.f){a=hW().getStats();this.f.h=a.estimatedBandwidth||NaN;this.f.w=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.A=a.width||NaN;b.j=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.o=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.l=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.w(function*(){b.f=new _.uv;b.a.l=b.f.a;b.A=_.en(a);b.h=_.an([b.w,a]);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;
85
+ d.autoplay=b.h.autoplay;typeof b.h.startTime===_.r&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:lV(b.h),local:!0};yield hW().load(d)}})}getBufferInfo(){this.g.warn(_.qa);return new _.Nt}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.ab)}appendLoad(){return Promise.reject(_.ab)}seekWith(){return Promise.reject(_.ab)}setNetworkEngine(a){this.F=
86
+ a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return eV}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(aV)}onError(a){a=new _.H(_.Yd,{detail:a});this.trigger(a)}canPlay(){return _.Xi()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=lV(this.getStats());var b=hW(),c=a.media||b.getMediaInformation();b=
87
+ b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==b&&(this.g.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=hW().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;
88
+ h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){var c=null;a.media.customData&&(c=mV(a.media.customData.playerConfiguration));var d=null;var e=null;a.media.customData&&(d=mV(a.media.customData["com.castlabs.reactnative.PlayerConfiguration"]),e=mV(a.media.customData.playerConfiguration));a=(a=d&&d.LiveConfiguration)?0===a.liveEdgeLatencyMs:!1;d=!(!d||!d.lowLatencyMode);b=(e=null!=e&&e.lowLatencyMode||a||d)?lW(b,{streaming:{lowLatencyMode:!0}}):
89
+ b;if(!c)return b;e=c.chromecast||null;a=c.abr||null;d=b;a&&typeof a.defaultBandwidthEstimate===_.r?d.initialBandwidth=a.defaultBandwidthEstimate:d.initialBandwidth=void 0;kW(c,b);a={};d=c.streaming||null;e&&e.useSenderStreamingConfig&&d&&(a.streaming=nV(d,AW));c=c.abr||null;e&&e.useSenderAbrConfig&&c&&(a.abr=nV(c,BW));_.gh(a)&&(b=lW(b,a));return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};var nW=class{constructor(){this.a=!1;this.g=new _.T(fV);this.f=this.m=null;this.w=new Set;this.C=this.K.bind(this);this.B=this.F.bind(this);this.o=null;this.l=new _.Qt;this.j=this.h=this.A=null}init(a){a&&(this.f=new NW,_.Xn(a,this.f),this.m=a,this.l.on(window,"unload",()=>{const b=this;return _.w(function*(){b.m&&b.m.getState()!==_.Fs&&(yield kV(b.m))})}))}start(a){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var b=pW(),c=pW().getPlayerManager(),d=new cast.framework.CastReceiverOptions;
90
+ a&&null!=a.useShakaForHls&&(d.useShakaForHls=a.useShakaForHls);d.customNamespaces={};d.customNamespaces[gV]=cast.framework.system.MessageType.JSON;d.customNamespaces[hV]=cast.framework.system.MessageType.JSON;a=new cast.framework.PlaybackConfig;a.manifestHandler=this.I.bind(this);a.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};a.enableSmoothLiveRefresh=!0;d.playbackConfig=a;if(a=this.m&&this.m.getSurface().getMedia())d.mediaElement=a;d.disableIdleTimeout=!0;d.maxInactivity=Infinity;this.h&&
91
91
  (d.queue=this.h);c.setMessageInterceptor(cast.framework.messages.MessageType.QUEUE_UPDATE,e=>{this.g.info("QUEUE_UPDATE message received",e);var f=this.getQueueManager();if(!f)return e;f=f.getCurrentItem();return f?(f=f.customData)&&!1===f.skippable?null:e:e});c.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.H.bind(this));c.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.J.bind(this));c.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
92
- this.C);c.addEventListener(cast.framework.events.EventType.MEDIA_STATUS,this.G.bind(this));b.start(d);b.addCustomMessageListener(mV,this.B);this.l.on(document,_.Eg,()=>{var e={type:"event",name:_.Eg,visible:!document.hidden};vW().sendCustomMessage(nV,void 0,e)})}}stop(){if(this.a){this.a=!1;this.l.release();const a=vW();vW().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.C);a.removeCustomMessageListener(mV,this.B);a.stop();this.j=this.h=this.m=this.f=
93
- null}}$d(a){this.o=a}bj(a){this.A=a}on(a,b){vW().addEventListener(a,b)}off(a,b){vW().removeEventListener(a,b)}addMessageListener(a){typeof a===_.ae&&this.w.add(a)}removeMessageListener(a){typeof a===_.ae&&this.w.delete(a)}sendMessage(a,b){vW().sendCustomMessage(mV,b,a)}gd(){return this.a}hf(){return this.a}Lb(){return wW()}gc(a){xW(this,a)}sj(a){const b=wW();let c=null;a?c=Object.assign({},b,a):c=b;xW(this,c)}dj(a){this.h=a;this.j=null}getQueueManager(){return vW().getPlayerManager().getQueueManager()}G(){var a=
94
- this.getQueueManager();a&&(a=a.getCurrentItemIndex(),this.j!==a&&(this.j=a,vW().sendCustomMessage(mV,void 0,{type:fV,index:a})))}I(a){a=a.trim();if(a.startsWith("#EXTM3U"))return zW(this,a);try{var b=(new DOMParser).parseFromString(a,_.ag)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=vW();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.fa);for(var f=e.length-1;0<=f;--f){var g=e[f].getAttribute("contentType");
95
- if(g===_.t||g===_.q){g=e[f].getAttribute(_.Ce);var h=e[f].getElementsByTagName(_.nb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.Ce)||g,m=h[k].getAttribute(_.pd);let n=h[k].getAttribute(_.Ng)||void 0,p=h[k].getAttribute(_.be)||void 0;void 0!==n&&(n=+n);void 0!==p&&(p=+p);b.canDisplayType(l,m,n,p)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.nb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return a=(new XMLSerializer).serializeToString(a)}if(c=
96
- b.getElementsByTagName(_.sb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=vW();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.t){e=c[d].getElementsByTagName(_.lb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ra)||void 0,h=e[f].getAttribute(_.Qa)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Ag,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.lb).length||a.removeChild(c[d])}a=(new XMLSerializer).serializeToString(a)}return a}H(a){const b=
97
- this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=sV(c.media.customData.playerConfiguration));if(b.m&&d){b.o&&(d=(yield Promise.resolve(b.o(d)))||d);d.ima&&(yield cW(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 _.mo(b.m,d),yield _.no(b.m),d=b.m.Sa(),c.media.contentId=d.url,c.media.contentType=d.type,d.jc&&(c.media.hlsVideoSegmentFormat=
98
- vV(d.jc,_.R)),d.nb&&(c.media.hlsSegmentFormat=vV(d.nb,_.Q)));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.A&&(d=yield Promise.resolve(b.A(c)))&&(c=d);return c})}J(a){var b=a.media;b&&b.tracks&&b.tracks.length&&AW(b.tracks);if((b=a.items)&&b.length)for(const c of b)(b=c&&c.media)&&b.tracks&&b.tracks.length&&AW(b.tracks);return a}K(a){if(this.m&&
99
- (!a.media.customData||!a.media.customData.local)){var b=vW().getPlayerManager(),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.setPosition(b))}_.po(this.m)}}F(a){this.w.forEach(b=>b(a.data))}};_.x(lV,tW);tW.prototype.getQueueManager=tW.prototype.getQueueManager;tW.prototype.setQueue=tW.prototype.dj;
100
- tW.prototype.updateContentMetadata=tW.prototype.sj;tW.prototype.setContentMetadata=tW.prototype.gc;tW.prototype.getContentMetadata=tW.prototype.Lb;tW.prototype.isApiReady=tW.prototype.gd;tW.prototype.sendMessage=tW.prototype.sendMessage;tW.prototype.removeMessageListener=tW.prototype.removeMessageListener;tW.prototype.addMessageListener=tW.prototype.addMessageListener;tW.prototype.off=tW.prototype.off;tW.prototype.on=tW.prototype.on;tW.prototype.setLoadRequestDataInterceptor=tW.prototype.bj;
101
- tW.prototype.setPlayerConfigInterceptor=tW.prototype.$d;tW.prototype.stop=tW.prototype.stop;tW.prototype.start=tW.prototype.start;tW.prototype.init=tW.prototype.init;tW.getInstance=uW;var sW=null;var UW=class{constructor(a){this.l=a;this.a=null;this.B=new _.Vt;this.f=null;BW(this)}load(){return _.w(function*(){})}j(){return!0}A(){}jb(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.l.a;a&&this.l.sendMessage(oV,{type:"SKIP_AD",requestId:yV(),mediaSessionId:a.mediaSessionId})}getAdVolume(){return this.l.getVolume()||0}h(a){this.l.setVolume(a)}setMuted(a){this.l.setMuted(a)}isMuted(){return!!this.l.isMuted()}qb(){return this.a?this.a.isPlayingBreak:
102
- !1}isPaused(){return this.a&&this.a.isPlayingBreak?this.a.isPaused:!1}getPosition(){let a=-1;var b=this.l.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.r&&(a=b));return a}w(){return!0}o(){const a=this;return _.w(function*(){a.B.release()})}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.jb()}resume(){this.j()}C(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.l.trigger(new _.H(_.qc,{adsTimeline:new PW(a.breaks)})));break;case "isPlayingBreak":a.value?
103
- CW(this,_.Ub):(CW(this,_.Yb,this.f),CW(this,_.nc,this.f),this.f=null,CW(this,_.Vb));break;case "isPaused":this.f&&(a.value?CW(this,_.hc):CW(this,_.kc));break;case "breakClipId":this.f&&(a=this.a.breakClipId,this.f.getId()!==a&&null!=a&&(CW(this,_.Yb,this.f),CW(this,_.nc,this.f),this.f=DW(this),CW(this,_.mc,this.f)));break;default:this.f||(this.f=DW(this))&&CW(this,_.mc,this.f)}}};UW.prototype.resume=UW.prototype.resume;UW.prototype.pause=UW.prototype.pause;UW.prototype.getVolume=UW.prototype.getVolume;
104
- UW.prototype.setVolume=UW.prototype.setVolume;UW.prototype.getPosition=UW.prototype.getPosition;UW.prototype.skip=UW.prototype.skip;var VW=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.hd?!1:!(!b||!b.ima)}create(a){return new UW(a.a)}};var WW=class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return uW().hf()?!(!b||!b.ima):!1}create(a){return new QW(a)}};_.x("clpp.cast.createCastQueue",function(){FW=class extends cast.framework.QueueBase{initialize(a){let b=a.queueData;b||(b=new cast.framework.messages.QueueData,b.name="queue",b.description="queue",b.items=[{media:a.media}],b.startTime=a.currentTime);return b}};return new FW});_.Kh(new VW);_.Kh(new WW);};f.call(g, window);
92
+ this.C);c.addEventListener(cast.framework.events.EventType.MEDIA_STATUS,this.G.bind(this));b.start(d);b.addCustomMessageListener(gV,this.B);this.l.on(document,_.Eg,()=>{var e={type:"event",name:_.Eg,visible:!document.hidden};pW().sendCustomMessage(hV,void 0,e)})}}stop(){if(this.a){this.a=!1;this.l.release();const a=pW();pW().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.C);a.removeCustomMessageListener(gV,this.B);a.stop();this.j=this.h=this.m=this.f=
93
+ null}}Zd(a){this.o=a}Xi(a){this.A=a}on(a,b){pW().addEventListener(a,b)}off(a,b){pW().removeEventListener(a,b)}addMessageListener(a){typeof a===_.be&&this.w.add(a)}removeMessageListener(a){typeof a===_.be&&this.w.delete(a)}sendMessage(a,b){pW().sendCustomMessage(gV,b,a)}gd(){return this.a}cf(){return this.a}Lb(){return qW()}gc(a){rW(this,a)}nj(a){const b=qW();let c=null;a?c=Object.assign({},b,a):c=b;rW(this,c)}Zi(a){this.h=a;this.j=null}getQueueManager(){return pW().getPlayerManager().getQueueManager()}G(){var a=
94
+ this.getQueueManager();a&&(a=a.getCurrentItemIndex(),this.j!==a&&(this.j=a,pW().sendCustomMessage(gV,void 0,{type:$U,index:a})))}I(a){a=a.trim();if(a.startsWith("#EXTM3U"))return tW(this,a);try{var b=(new DOMParser).parseFromString(a,_.ag)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=pW();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.fa);for(var f=e.length-1;0<=f;--f){var g=e[f].getAttribute("contentType");
95
+ if(g===_.t||g===_.q){g=e[f].getAttribute(_.Ce);var h=e[f].getElementsByTagName(_.nb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.Ce)||g,m=h[k].getAttribute(_.qd);let n=h[k].getAttribute(_.Ng)||void 0,p=h[k].getAttribute(_.ce)||void 0;void 0!==n&&(n=+n);void 0!==p&&(p=+p);b.canDisplayType(l,m,n,p)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.nb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return a=(new XMLSerializer).serializeToString(a)}if(c=
96
+ b.getElementsByTagName(_.sb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=pW();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.t){e=c[d].getElementsByTagName(_.lb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ra)||void 0,h=e[f].getAttribute(_.Qa)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Ag,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.lb).length||a.removeChild(c[d])}a=(new XMLSerializer).serializeToString(a)}return a}H(a){const b=
97
+ this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=mV(c.media.customData.playerConfiguration));if(b.m&&d){b.o&&(d=(yield Promise.resolve(b.o(d)))||d);d.ima&&(yield XV(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 _.io(b.m,d),yield _.jo(b.m),d=b.m.Ra(),c.media.contentId=d.url,c.media.contentType=d.type,d.jc&&(c.media.hlsVideoSegmentFormat=
98
+ pV(d.jc,_.R)),d.nb&&(c.media.hlsSegmentFormat=pV(d.nb,_.Q)));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.A&&(d=yield Promise.resolve(b.A(c)))&&(c=d);return c})}J(a){var b=a.media;b&&b.tracks&&b.tracks.length&&uW(b.tracks);if((b=a.items)&&b.length)for(const c of b)(b=c&&c.media)&&b.tracks&&b.tracks.length&&uW(b.tracks);return a}K(a){if(this.m&&
99
+ (!a.media.customData||!a.media.customData.local)){var b=pW().getPlayerManager(),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.setPosition(b))}_.lo(this.m)}}F(a){this.w.forEach(b=>b(a.data))}};_.x(fV,nW);nW.prototype.getQueueManager=nW.prototype.getQueueManager;nW.prototype.setQueue=nW.prototype.Zi;
100
+ nW.prototype.updateContentMetadata=nW.prototype.nj;nW.prototype.setContentMetadata=nW.prototype.gc;nW.prototype.getContentMetadata=nW.prototype.Lb;nW.prototype.isApiReady=nW.prototype.gd;nW.prototype.sendMessage=nW.prototype.sendMessage;nW.prototype.removeMessageListener=nW.prototype.removeMessageListener;nW.prototype.addMessageListener=nW.prototype.addMessageListener;nW.prototype.off=nW.prototype.off;nW.prototype.on=nW.prototype.on;nW.prototype.setLoadRequestDataInterceptor=nW.prototype.Xi;
101
+ nW.prototype.setPlayerConfigInterceptor=nW.prototype.Zd;nW.prototype.stop=nW.prototype.stop;nW.prototype.start=nW.prototype.start;nW.prototype.init=nW.prototype.init;nW.getInstance=oW;var mW=null;var OW=class{constructor(a){this.l=a;this.a=null;this.B=new _.Qt;this.f=null;vW(this)}load(){return _.w(function*(){})}j(){return!0}A(){}ib(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.l.a;a&&this.l.sendMessage(iV,{type:"SKIP_AD",requestId:sV(),mediaSessionId:a.mediaSessionId})}getAdVolume(){return this.l.getVolume()||0}h(a){this.l.setVolume(a)}setMuted(a){this.l.setMuted(a)}isMuted(){return!!this.l.isMuted()}qb(){return this.a?this.a.isPlayingBreak:
102
+ !1}isPaused(){return this.a&&this.a.isPlayingBreak?this.a.isPaused:!1}getPosition(){let a=-1;var b=this.l.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.r&&(a=b));return a}w(){return!0}o(){const a=this;return _.w(function*(){a.B.release()})}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.ib()}resume(){this.j()}C(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.l.trigger(new _.H(_.qc,{adsTimeline:new JW(a.breaks)})));break;case "isPlayingBreak":a.value?
103
+ wW(this,_.Ub):(wW(this,_.Yb,this.f),wW(this,_.nc,this.f),this.f=null,wW(this,_.Vb));break;case "isPaused":this.f&&(a.value?wW(this,_.hc):wW(this,_.kc));break;case "breakClipId":this.f&&(a=this.a.breakClipId,this.f.getId()!==a&&null!=a&&(wW(this,_.Yb,this.f),wW(this,_.nc,this.f),this.f=xW(this),wW(this,_.mc,this.f)));break;default:this.f||(this.f=xW(this))&&wW(this,_.mc,this.f)}}};OW.prototype.resume=OW.prototype.resume;OW.prototype.pause=OW.prototype.pause;OW.prototype.getVolume=OW.prototype.getVolume;
104
+ OW.prototype.setVolume=OW.prototype.setVolume;OW.prototype.getPosition=OW.prototype.getPosition;OW.prototype.skip=OW.prototype.skip;var PW=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.id?!1:!(!b||!b.ima)}create(a){return new OW(a.a)}};var QW=class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return oW().cf()?!(!b||!b.ima):!1}create(a){return new KW(a)}};_.x("clpp.cast.createCastQueue",function(){zW=class extends cast.framework.QueueBase{initialize(a){let b=a.queueData;b||(b=new cast.framework.messages.QueueData,b.name="queue",b.description="queue",b.items=[{media:a.media}],b.startTime=a.currentTime);return b}};return new zW});_.Gh(new PW);_.Gh(new QW);};f.call(g, window);