@castlabs/prestoplay 6.6.1 → 6.7.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 (59) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +110 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +423 -423
  8. package/cjs/cl.crypto.js +10 -10
  9. package/cjs/cl.dash.js +71 -71
  10. package/cjs/cl.externs.js +47 -41
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +68 -49
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +31 -31
  15. package/cjs/cl.ima.js +24 -23
  16. package/cjs/cl.mse.js +263 -260
  17. package/cjs/cl.muxdata.js +11 -12
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +71 -71
  22. package/cjs/cl.thumbnails.js +23 -23
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +27 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +19 -19
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +346 -344
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +67 -67
  38. package/cl.externs.js +47 -41
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +57 -40
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +17 -16
  44. package/cl.mse.js +228 -228
  45. package/cl.muxdata.js +9 -8
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +10 -10
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +58 -59
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +15 -15
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +14 -14
  58. package/package.json +1 -1
  59. package/typings.d.ts +108 -7
package/cl.cast.js CHANGED
@@ -1,88 +1,88 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var AJ="Cannot seek during ads playout.",BJ="Cannot switch track",CJ="Media session does not exist.",DJ="No receivers available",EJ="Reset ABR functionality not available on cast.",FJ="SDK not yet ready",GJ="Sender is destroyed.",HJ="clpp.cast.CastProxy",IJ="clpp.cast.Player",JJ="clpp.cast.Receiver",KJ="urn:x-cast:castlabs",LJ="urn:x-cast:com.google.cast.media",MJ=function(a){return _.w(function*(){yield _.Wm(a,_.Fd);yield _.Wm(a,_.Ed)})},NJ=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.bd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Bd?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.p?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},OJ=function(a){if(typeof a!==_.ne)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},PJ=function(a,b,c,d){return _.w(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
3
- null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Kh(d,a.mimeType,g);f&&g&&(h=_.bh(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.H(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},QJ=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,
4
- d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.Je:return d.FMP4;case _.Ie:return b===_.K?d.MPEG2_TS:c.TS;case _.bc:return c.AAC;case _.cc:return c.AC3;case _.dc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.ec:return c.FMP4}},SJ=function(a){a=void 0===a?RJ:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.G(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
5
- b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},TJ=function(a,b){return a.g.filter(c=>c.type===b)},VJ=function(a,b){const c=UJ(a);return TJ(a,b).find(d=>c.includes(d.id))||null},XJ=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.I){const e=a.ma();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
- d.editTracksInfo(c,()=>{a.f[b]=null;WJ(a,b)},e=>{a.f[b]=null;a.h.debug(BJ,e)})}else b===_.I&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{WJ(a,b)},e=>{a.h.debug(BJ,e)}))},UJ=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},WJ=function(a,b){b===_.J?a.a.trigger(new _.C(_.Ki)):b===_.I&&a.a.trigger(new _.C(_.Li))},$J=function(a){if(a)for(const b of YJ)ZJ(b)},ZJ=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
- cast.framework&&cast.framework.CastContext&&a.U.length){a.w=!0;a.o.Xd();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.U;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa);aK&&a.o.ba(.02)}},bK=function(a){return _.w(function*(){YJ.delete(a);if(a.w){a.w=!1;var b=
8
- cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.h&&(b.push(a.h.destroy()),a.h=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.S=null;a.W=null})},cK=function(a){return _.w(function*(){a.fb()||(yield cast.framework.CastContext.getInstance().requestSession())})},eK=function(a,b,c){c=
9
- void 0===c?0:c;return _.w(function*(){var d=a.f.ma();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.la())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield dK(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Nd:a.getPresentationStartTime(),autoplay:b,Ka:a.g})})},dK=function(a,b){return _.w(function*(){var c=chrome.cast.media.StreamType;yield cK(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
10
- b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=QJ(b.yb,_.K);e.hlsSegmentFormat=QJ(c,_.J);b.Ka&&(a.L&&(c=yield Promise.resolve(a.L(b.Ka)))&&(b.Ka=c),a.g=b.Ka,a.C=_.Vl(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Ka.remoteTextTracks&&(c=yield Promise.all(b.Ka.remoteTextTracks.map(a.Ha.bind(a))),e.tracks=c.filter(k=>k),b.Ka.remoteTextTracks=void 0),delete b.Ka.autoplay,b.Ka.startTime=null,e.customData={playerConfiguration:NJ(b.Ka)});c=a.$a()||{};
11
- var f=fK(c.metadataType),g;typeof b.Nd===_.p&&(g={metadataType:f,sectionStartAbsoluteTime:b.Nd});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=gK(c);if(g=hK(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.lc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.p&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},hK=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(iK);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=SJ(iK[b]);return Object.assign(b,a)},fK=function(a){var b=void 0===b?RJ:b;return Object.values(iK).includes(a)?a:b},gK=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},kK=function(a,b){jK(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(KJ,a.R)},lK=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.p?null:a):a=
13
- null;a=null===a?null:a+b;return null===a?b:a},jK=function(a,b){b!==a.a&&(a.a=b,a.a&&(a.H.release(),a.G=null,a.m=null,a.m=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.m),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ka.bind(a)),a.f&&a.f.load(),a.h&&a.h.init(),a.trigger(new _.C(_.od))))},oK=function(a){return new mK(a.h,()=>{a.trigger(new _.C(_.rc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?
14
- Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.ee&&(d.preferredAudioLanguage=c.ee);c.Le&&(d.preferredTextLanguage=c.Le);_.Ym(a.f,null);a.trigger(new _.C("castingended"));a.j(b,d)}},()=>nK(a))},nK=function(a){return _.w(function*(){a.trigger(new _.C(_.qc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Ym(a.f,a.a))})},rK=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{pK=!1;const e=_.bh(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.Ig(f.data),
15
- h=(new DOMParser).parseFromString(g,_.ue);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=qK(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=qK(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),pK=!0}}catch(e){_.B("Failed to fetch an ad",e),pK=!0}})},qK=function(a){const b=new cast.framework.messages.VastAdsRequest;
16
- b.adsResponse=a;return b},sK=function(a,b){b=new _.G(1,10,10003,{errorType:b});a.l.onError(b)},tK=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},vK=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=uK(a,c))&&(d={ad:c});a.l.trigger(new _.C(b,d))}},uK=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.ne&&(d=a.a.getBreakClipById(b.breakClipId));
17
- typeof b.breakId===_.ne&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new X(d,e,b.index,b.total,f)}return c},wK=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]},
18
- xK=function(a){const b=a.dashTimedMetadata;let c=_.Be;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.Ae)?_.Sf:_.Qf,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},yK=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},AK=function(a){a.a=yK().getTextTracksManager();const b=a.a.getTracks();a.j=zK(_.I,b)},zK=function(a,b){const c=[];for(const d of b)b=new _.ph(d.trackId.toString(),a),b.roles=d.roles||
19
- [],b.kind=d.subtype||null,b.language=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.xh(b.id,b)),c.push(b);return c},BK=function(a,b,c,d){c=_.$f(c).filter(g=>g);var e=!1;let f=[];b===_.J?f=a.getAudioTracks():b===_.I&&(f=a.ha());if(c=c.find(g=>{const h=_.Nh(g);return f.some(k=>{k=_.Nh(k.language||"");return _.Oh(h,k)})})){const g=
20
- _.Nh(c);c=f.filter(h=>{h=_.Nh(h.language||"");return _.Oh(g,h)});f=c.length?c:f;e=e||!!c.length}_.Tg(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.J?a.qa(e):b===_.I&&a.ya(e))},CK=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},FK=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};
21
- if(a&&a.drm){var d=a.drm,e=_.qj(d);if(e){var f=[_.Jc];_.Vl(a)[0].type!==_.Zb&&f.unshift(_.Kc);d.preferredDrmSystem===_.Jc&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.La[g];h?(c=g===_.Kc?cast.framework.ContentProtection.WIDEVINE:g===_.Jc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},DK(b,h,a,c),EK(b,h,a,c)):c()}else c()}else c()},DK=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
- _.bh({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},EK=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.ch(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.H(g.data)}):
23
- a.licenseHandler=void 0},IK=function(){return GK||(GK=new HK)},JK=function(){return cast.framework.CastReceiverContext.getInstance()},LK=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=JK();var {hlsVideoSegmentFormat:d}=JK().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Je:_.Ie;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=
24
- KK(f,_.ma),h=KK(f,_.Za);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")},KK=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),0<=d&&(c=c.substring(0,d))));return c},NK=function(a,b){let c=null;const d=MK(a);d&&(c={ad:d});a.f.trigger(new _.C(b,c))},MK=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
- let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new X(d,c,g,e,f)}return b},OK=class{constructor(a,b){this.log=new _.O(b);this.f=a;this.m=null;this.h=_.Pl;this.o=_.yp;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Pl)}destroy(){this.m=
26
- this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.F&&this.a(_.Ol)}a(a){if(a!==this.h)if(this.h===_.Ol&&a!==_.Pl)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.h;this.h=a;this.h===_.Kl?(this.B=b,this.f.trigger(new _.C(_.nc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Kl&&this.f.trigger(new _.C(_.mc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-
27
- this.C};this.C=b;this.m&&_.yl(this.m,this.h);this.f.trigger(new _.C(_.ke,{detail:a}))}}};_.x("clpp.cast.CastUtils",class{});var RJ=0,iK={GENERIC:RJ,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var PK=class extends OK{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.g=null;this.A=this.vb.bind(this)}init(){const a=this.f,b=a.a;b&&(this.g&&this.g.removeUpdateListener(this.A),this.g=b,this.g.addUpdateListener(this.A),this.w=a.m)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){a.g&&(a.g.removeUpdateListener(a.A),a.g=null);yield b().call(a)})}a(a){const b=this.f.m;b&&b.isPlayingBreak||super.a(a)}vb(){if(this.g&&
28
- this.w&&!this.w.isPlayingBreak)switch(this.g.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.g.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Hl);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Ol);break;default:this.a(_.Pl)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Sl);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Rl);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Kl)}}};var Y=class extends _.P{constructor(){super();this.h=new _.O("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.K;break;case chrome.cast.media.TrackType.AUDIO:c=_.J;break;case chrome.cast.media.TrackType.TEXT:c=_.I}c=new _.ph(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
- c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.xh(c.id,c));return c}):[],this.a.trigger(new _.C(_.Zo)))}destroy(){this.a=null}getVideoTracks(){return TJ(this,_.K)}getAudioTracks(){return TJ(this,_.J)}ha(){return TJ(this,_.I)}ga(){const a=this.Da();return a?a.renditions[0]:null}Aa(){const a=this.la();return a?a.renditions[0]:null}Ba(){const a=this.ma();return a?a.renditions[0]:
30
- null}Na(){return this.f[_.K]||null}ab(){return this.f[_.J]||null}bb(){return this.f[_.I]||null}Da(){return VJ(this,_.K)}la(){return VJ(this,_.J)}ma(){return VJ(this,_.I)}Sa(a){XJ(this,_.K,a)}qa(a){XJ(this,_.J,a)}ya(a){XJ(this,_.I,a)}Ra(a){this.Sa(a&&a.track)}hb(a){this.qa(a&&a.track)}ib(a){this.ya(a&&a.track)}addTextTrack(){return _.w(function*(){})}ja(){return!0}};Y.prototype.isAbrEnabled=Y.prototype.ja;Y.prototype.addTextTrack=Y.prototype.addTextTrack;Y.prototype.setTextRendition=Y.prototype.ib;
31
- Y.prototype.setAudioRendition=Y.prototype.hb;Y.prototype.setVideoRendition=Y.prototype.Ra;Y.prototype.setTextTrack=Y.prototype.ya;Y.prototype.setAudioTrack=Y.prototype.qa;Y.prototype.setVideoTrack=Y.prototype.Sa;Y.prototype.getTextTrack=Y.prototype.ma;Y.prototype.getAudioTrack=Y.prototype.la;Y.prototype.getVideoTrack=Y.prototype.Da;Y.prototype.getLoadingTextRendition=Y.prototype.bb;Y.prototype.getLoadingAudioRendition=Y.prototype.ab;Y.prototype.getLoadingVideoRendition=Y.prototype.Na;
32
- Y.prototype.getTextRendition=Y.prototype.Ba;Y.prototype.getAudioRendition=Y.prototype.Aa;Y.prototype.getVideoRendition=Y.prototype.ga;Y.prototype.getTextTracks=Y.prototype.ha;Y.prototype.getAudioTracks=Y.prototype.getAudioTracks;Y.prototype.getVideoTracks=Y.prototype.getVideoTracks;var mK=class extends _.ap{constructor(a,b,c,d){super();this.j=new _.O(_.Ac);this.U=a;this.o=new _.Th(b);this.S=c;this.W=d;this.g=this.I=_.Vi();this.C=[];this.B=0;this.K=new _.Pm;this.G=this.m=this.a=null;this.A=this.w=!1;this.Z="";this.ca=1E6;this.f=new Y;this.f.initialize(this);this.h=new PK(this);this.H=new _.uo;this.J=null;this.F=new Set;this.N=this.Va.bind(this);this.aa=this.Ya.bind(this);this.V=this.Xa.bind(this);this.R=this.Wa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
33
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{$J(!0)},0)}});ZJ(this);YJ.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.h&&this.h.release()})}destroy(){return _.w(function*(){})}Ic(a){this.L=a}Vb(){return this.w}fb(){return this.A}sd(){return this.Z}sendMessage(a,b){const c=this;return _.w(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
34
- if(e)try{yield e.sendMessage(a,NJ(b))}catch(f){d=new _.G(1,8,8E3,{detailedErrorCode:f})}else d=new _.G(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.w(function*(){if(!a.Vb())throw a.j.warn(FJ),new _.G(1,8,8001,void 0);if(!aK)throw a.j.warn(DJ),new _.G(1,8,8002,void 0);if(a.fb())throw a.j.warn("Already casting"),new _.G(1,8,8003,void 0);try{yield cK(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
35
- b;throw new _.G(1,8,8E3,c);}})}od(){this.fb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.bd&&this.F.add(a)}removeMessageListener(a){typeof a===_.bd&&this.F.delete(a)}play(){return this.isEnded()?eK(this,!0):new Promise((a,b)=>{if(!this.a)return b(CJ);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(CJ);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
36
- _.Hl}seek(a){return this.isEnded()?eK(this,!1,a):new Promise((b,c)=>{this.a||c(CJ);this.m.isPlayingBreak&&c(AJ);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.C(_.Ee));this.a.seek(d,()=>{this.trigger(new _.C(_.Ce));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.p?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}getPlaybackRate(){return this.a&&
37
- this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(LJ,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||
38
- !this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.p?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.h?this.h.getState():_.yp}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?OJ(this.a.customData.stats):_.Cl()}isLive(){return Infinity===
39
- this.getDuration()}load(a){const b=this;return _.w(function*(){if(b.Vb())if(aK){b.C=_.Vl(a);_.Yi(a)&&(b.g=_.Xi(b.I,a));var c=b.C[b.B];yield dK(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Ka:b.g,yb:c.yb,audioMimeType:c.audioMimeType})}else b.j.warn(DJ);else b.j.warn(FJ)})}getBufferInfo(){return new _.$o}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
40
- a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.j.warn(EJ)}onError(a){if(a&&(this.trigger(new _.C(_.$c,{detail:a})),this.h))this.h.onError(a)}namespace(){return _.Ac}canPlay(){return this.Vb()?2:0}$a(){return this.J}ac(a){this.J=hK(a)}kd(){this.J=null}Td(a){const b=this.$a()||{};a={metadataType:fK(b.metadataType),title:a};this.ac(Object.assign({},b,a))}Rd(a){const b=this.$a()||{},c=fK(b.metadataType);a=new chrome.cast.Image(a);
41
- this.ac(Object.assign({},b,{metadataType:c,images:[a]}))}Qd(a){const b=this.$a()||{};this.ac(Object.assign({},b,{metadataType:3,artist:a}))}Sd(a){const b=this.$a()||{};a={metadataType:fK(b.metadataType),releaseDate:a};this.ac(Object.assign({},b,a))}Va(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;aK=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Z=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Xd()}Ya(a){this.j.debug(`state: ${a.sessionState}, details:`,
42
- a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;kK(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.fb()||(this.A=!0,kK(this,a.session),this.W());break;case cast.framework.SessionState.SESSION_ENDED:if(this.fb()&&this.a){const d=this.a.media;var b=this.f.la(),c=this.f.ma();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:lK(this),Le:c,
43
- ee:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(KJ,this.R);this.A=!1;this.a=null;this.H.release();this.m=this.G=null}}Xa(a){this.j.debug("New media session",a.mediaSession);jK(this,a.mediaSession)}Wa(a,b){if(a===KJ&&0<this.F.size){const c=OJ(b);this.F.forEach(d=>d(c))}}ka(){this.trigger(new _.C(_.ve))}Ha(a){const b=this;return _.w(function*(){let c=null;const d=yield PJ(a,[_.te,_.Yb],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ca++,
44
- chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};mK.prototype.getTextDisplayer=mK.prototype.getTextDisplayer;mK.prototype.getNetworkEngine=mK.prototype.getNetworkEngine;mK.prototype.setNetworkEngine=mK.prototype.setNetworkEngine;var aK=!1,YJ=new Set;window.__onGCastApiAvailable=$J;var QK=class extends _.ap{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.bd?c:(d,e)=>{this.f&&d!==_.Hl&&d!==_.Pl&&this.f.load(e)};this.a=oK(this);this.g=new _.O(HJ);this.addDelegate(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield bK(a.a),a.a=null);a.removeDelegate(a.f)})}gd(){return!!this.a&&this.a.Vb()&&aK}fb(){return!!this.a&&this.a.fb()}sd(){return this.a?this.a.sd():""}Ic(a){this.a&&this.a.Ic(a)}cast(a){const b=this;return _.w(function*(){if(b.a)try{if(yield b.a.cast(),
45
- b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.la();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.ma();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.lc?e.isLive:b.f.isLive();d={source:e,
46
- isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Nd:b.f.getPresentationStartTime(),yb:h,audioMimeType:k,Ka:l}}var c=d}yield nK(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield dK(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.C(_.$c,{detail:d}),b.trigger(c)}})}od(){this.a&&this.a.od()}af(a){const b=this;return _.w(function*(){a!==b.h&&(b.h=a,b.a&&(yield bK(b.a)),b.a=oK(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?
47
- yield b.a.sendMessage(KJ,a):b.g.warn(GJ)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(GJ)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(GJ)}$a(){return this.a&&this.a.$a()}ac(a){this.a&&this.a.ac(a)}kd(){this.a&&this.a.kd()}Td(a){this.a&&this.a.Td(a)}Rd(a){this.a&&this.a.Rd(a)}Qd(a){this.a&&this.a.Qd(a)}Sd(a){this.a&&this.a.Sd(a)}};_.x(HJ,QK);QK.prototype.setContentReleaseDate=QK.prototype.Sd;QK.prototype.setContentArtist=QK.prototype.Qd;
48
- QK.prototype.setContentImage=QK.prototype.Rd;QK.prototype.setContentTitle=QK.prototype.Td;QK.prototype.clearContentMetadata=QK.prototype.kd;QK.prototype.setContentMetadata=QK.prototype.ac;QK.prototype.getContentMetadata=QK.prototype.$a;QK.prototype.removeMessageListener=QK.prototype.removeMessageListener;QK.prototype.addMessageListener=QK.prototype.addMessageListener;QK.prototype.sendMessage=QK.prototype.sendMessage;QK.prototype.changeReceiverId=QK.prototype.af;QK.prototype.forceDisconnect=QK.prototype.od;
49
- QK.prototype.cast=QK.prototype.cast;QK.prototype.setPlayerConfigInterceptor=QK.prototype.Ic;QK.prototype.getReceiverName=QK.prototype.sd;QK.prototype.isCasting=QK.prototype.fb;QK.prototype.canCast=QK.prototype.gd;QK.prototype.destroy=QK.prototype.destroy;var RK=class extends OK{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.Z.bind(this);this.w=this.W.bind(this);this.K=this.V.bind(this);this.J=this.U.bind(this);this.L=this.ca.bind(this);this.G=this.aa.bind(this);this.F=this.T.bind(this);this.g=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
50
- this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.L);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.g)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
51
- d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.g);yield b().call(a)})}S(){this.f.trigger(new _.C(_.Sd));this.a(_.Sl)}R(){this.a(_.Rl)}Z(){this.a(_.Hl)}W(a){a.isBuffering?
52
- this.a(_.Kl):(a=this.f.isPaused()?_.Rl:_.Sl,this.a(a))}V(){this.j=1;this.f.trigger(new _.C(_.Ee))}U(){this.f.trigger(new _.C(_.Ce))}ca(){this.j=2}aa(){this.a(_.Ql)}N(a){const b=this.f.getStats();this.f.trigger(new _.C(_.hc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}T(a){a=new _.G(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.f.trigger(new _.C(_.$c,{detail:a}));this.a(_.Ol)}};var X=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.h=typeof c===_.p?c:1;this.j=typeof d===_.p?d:1;this.g=typeof e===_.p?e:0}mb(){return"Google Cast Framework"}nb(){return cast.framework.VERSION}sb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}Xb(){return!1}Db(){return this.a.clickThroughUrl||
53
- null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}pb(){return 0}ob(){return 0}cb(){return 0}Oa(){switch(this.Eb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Eb(){return this.f.position}Fb(){return this.h}rb(){return this.j}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;
54
- X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.rb;X.prototype.getPositionInSequence=X.prototype.Fb;X.prototype.getPodTimeOffset=X.prototype.Eb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Oa;X.prototype.getMediaBitrate=X.prototype.cb;X.prototype.getMediaHeight=X.prototype.ob;X.prototype.getMediaWidth=X.prototype.pb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Db;
55
- X.prototype.isBumper=X.prototype.Xb;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.sb;
56
- X.prototype.getAdManagerVersion=X.prototype.nb;X.prototype.getAdManagerName=X.prototype.mb;var SK=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Gb(){return!!this.a.find(a=>0===a.position)}eb(){return!!this.a.find(a=>-1===a.position)}};SK.prototype.hasPostroll=SK.prototype.eb;SK.prototype.hasPreroll=SK.prototype.Gb;SK.prototype.getCuePoints=SK.prototype.getCuePoints;var TK=class{constructor(a){this.l=a;this.a=null;this.g=this.h.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];tK().addEventListener(this.f,
57
- this.g)}load(){const a=this;return _.w(function*(){pK&&(pK=!1,sK(a,0))})}start(){return _.w(function*(){tK().play()})}resume(){-1!==this.getPosition()&&tK().play()}pause(){-1!==this.getPosition()&&tK().pause()}skip(){}getVolume(){return this.l.getVolume()||0}setVolume(a){this.l.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.p?a:-1}dispose(){const a=this;return _.w(function*(){tK().removeEventListener(a.f,a.g)})}h(a){const b=cast.framework.events.EndedReason;
58
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=tK().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.C(_.Ob,{adsTimeline:new SK(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:vK(this,_.Eb,a);break;case cast.framework.events.EventType.BREAK_STARTED:vK(this,_.wb,a);break;case cast.framework.events.EventType.BREAK_ENDED:vK(this,_.xb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:vK(this,_.Kb,a);
59
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(vK(this,_.Jb,a),vK(this,_.Lb,a)):a.endedReason===b.STOPPED?vK(this,_.Lb,a):a.endedReason===b.END_OF_STREAM?(vK(this,_.Bb,a),vK(this,_.Lb,a)):a.endedReason===b.ERROR&&sK(this,1);break;case cast.framework.events.EventType.PLAYING:vK(this,_.Ib,a);break;case cast.framework.events.EventType.PAUSE:vK(this,_.Gb,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?vK(this,_.zb,a):vK(this,_.Ib,a)}}};
60
- TK.prototype.getPosition=TK.prototype.getPosition;TK.prototype.setVolume=TK.prototype.setVolume;TK.prototype.getVolume=TK.prototype.getVolume;TK.prototype.skip=TK.prototype.skip;TK.prototype.pause=TK.prototype.pause;TK.prototype.resume=TK.prototype.resume;var pK=!1;var UK=class{constructor(a){this.Mb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(wK(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(wK(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>xK(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
61
- _.Tf;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Vf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Wf}b&&this.Mb(new _.C(b,{detail:xK(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Mb(new _.C(_.Tf,{detail:b}))}};var Z=class extends _.P{constructor(){super();this.g=new _.O("clpp.cast.TrackManager");this.l=null;this.o=1E9;this.h=[];this.j=[];this.m=this.w.bind(this);this.a=this.f=null}initialize(a){this.l=a;yK().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.l=null;yK().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ha(){return this.j}ga(){return null}Aa(){const a=
62
- this.la();return a&&a.renditions[0]}Ba(){const a=this.ma();return a&&a.renditions[0]}Na(){return null}ab(){return null}bb(){return null}Da(){return null}la(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.p&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}ma(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.p&&(b=b.toString(),a=this.ha().find(c=>c.id===b)||null)}return a}Sa(){this.g.warn("Video tracks unavailable on Cast")}qa(a){a&&this.f&&
63
- this.f.setActiveById(+a.id)}ya(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ra(){this.g.warn("Video renditions unavailable on Cast")}hb(a){this.qa(a&&a.track)}ib(a){this.ya(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.l.getConfiguration();if((c=yield PJ(a,Object.values(cast.framework.messages.CaptionMimeType),b.l.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
64
- c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),AK(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ja(){return!0}w(){this.f=yK().getAudioTracksManager();var a=this.f.getTracks();this.h=zK(_.J,a);AK(this);a=this.l.getConfiguration();BK(this,_.J,a.preferredAudioLanguage,a.preferredAudioRole);BK(this,_.I,a.preferredTextLanguage,a.preferredTextRole)}};Z.prototype.isAbrEnabled=Z.prototype.ja;
65
- Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.ib;Z.prototype.setAudioRendition=Z.prototype.hb;Z.prototype.setVideoRendition=Z.prototype.Ra;Z.prototype.setTextTrack=Z.prototype.ya;Z.prototype.setAudioTrack=Z.prototype.qa;Z.prototype.setVideoTrack=Z.prototype.Sa;Z.prototype.getTextTrack=Z.prototype.ma;Z.prototype.getAudioTrack=Z.prototype.la;Z.prototype.getVideoTrack=Z.prototype.Da;Z.prototype.getLoadingTextRendition=Z.prototype.bb;
66
- Z.prototype.getLoadingAudioRendition=Z.prototype.ab;Z.prototype.getLoadingVideoRendition=Z.prototype.Na;Z.prototype.getTextRendition=Z.prototype.Ba;Z.prototype.getAudioRendition=Z.prototype.Aa;Z.prototype.getVideoRendition=Z.prototype.ga;Z.prototype.getTextTracks=Z.prototype.ha;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var VK=class extends _.ap{constructor(){super();this.A=new _.O(IJ);this.g=this.o=_.Vi();this.w=null;this.j=-1;this.F=new _.Pm;this.f=this.m=this.h=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.o=b);a=CK();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new RK(this);this.a.init();this.h=new Z;this.h.initialize(this);this.m=new UK(c=>this.trigger(c));this.m.init()}unload(){const a=cast.framework.messages.PlayerState,
67
- b=CK();b.getPlayerState()!==a.IDLE&&b.stop();this.h&&this.h.release();this.m&&this.m.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.w(function*(){a.B=null;a.o=_.Vi();a.g=a.o;a.j=-1;a.w=null;a.a&&(yield a.a.destroy(),a.a=null);a.h&&(a.h.destroy(),a.h=null)})}play(){const a=CK();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");a.play();
68
- return Promise.resolve()}pause(){const a=CK();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return CK().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return CK().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=CK();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(AJ);b.seek(a);return Promise.resolve()}getPosition(){return CK().getCurrentTimeSec()}getDuration(){const a=
69
- CK().getDurationSec();return typeof a===_.p?-1===a?Infinity:a:-1}getPlaybackRate(){return CK().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;CK().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
70
- null}getLoadedSource(){const a=CK().getMediaInformation();if(a){var b=CK().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.w&&-1!==this.j?this.w[this.j]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,lg:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return CK().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=CK().getLiveSeekableRange();
71
- b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.yp}getStats(){var a=_.Cl();if(this.f){a=CK().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.m=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.o=a.width||NaN;b.g=c;b=this.f;c=typeof a.decodedFrames===_.p?a.decodedFrames:NaN;b.j=typeof a.droppedFrames===_.p?a.droppedFrames:NaN;b.h=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
72
- this;return _.w(function*(){b.f=new _.wp;b.a.m=b.f.a;b.w=_.Vl(a);_.Yi(a)&&(b.g=_.Xi(b.o,a));if(b.C)b.C=!1;else{var c=b.w[b.j],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.p&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:NJ(b.g),local:!0};yield CK().load(d)}})}getBufferInfo(){this.A.warn(_.na);return new _.$o}getTrackManager(){return this.h}getConfiguration(){return this.g}getSurface(){return this.B}setNetworkEngine(a){this.F=
73
- a}getNetworkEngine(){return this.F}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return IJ}getTimelineCues(){return this.m&&this.m.getTimelineCues()||[]}resetAbr(){this.A.warn(EJ)}onError(a){a=new _.C(_.$c,{detail:a});this.trigger(a)}canPlay(){return _.fi()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=NJ(this.getStats());var b=CK(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.p&&c.startAbsoluteTime!==
74
- b&&(this.A.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=CK().getStartAbsoluteTime();if(typeof d===_.p){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
75
- a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=OJ(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.p?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;FK(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}};VK.prototype.getTextDisplayer=VK.prototype.getTextDisplayer;VK.prototype.getNetworkEngine=VK.prototype.getNetworkEngine;
76
- VK.prototype.setNetworkEngine=VK.prototype.setNetworkEngine;var HK=class{constructor(){this.a=!1;this.h=new _.O(JJ);this.f=this.l=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.uo;this.m=null}init(a){a&&(this.f=new VK,_.Ym(a,this.f),this.l=a,this.o.on(window,"unload",()=>{const b=this;return _.w(function*(){b.l&&b.l.getState()!==_.Pl&&(yield MJ(b.l))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=JK(),b=JK().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
77
- c.customNamespaces={};c.customNamespaces[KJ]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.l&&this.l.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
78
- this.A);a.start(c);a.addCustomMessageListener(KJ,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=JK();JK().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(KJ,this.w);a.stop();this.l=this.f=null}}Ic(a){this.j=a}Qf(a){this.m=a}on(a,b){JK().addEventListener(a,b)}off(a,b){JK().removeEventListener(a,b)}addMessageListener(a){typeof a===_.bd&&this.g.add(a)}removeMessageListener(a){typeof a===_.bd&&this.g.delete(a)}sendMessage(a,
79
- b){JK().sendCustomMessage(KJ,b,NJ(a))}Vb(){return this.a}$a(){var a;return a=(a=JK().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return LK(this,a);try{var b=(new DOMParser).parseFromString(a,_.ue)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=JK();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
80
- 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.u||g===_.ac){g=e[f].getAttribute(_.ud);var h=e[f].getElementsByTagName(_.bb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.ud)||g,m=h[k].getAttribute(_.Fc);let n=h[k].getAttribute(_.We)||void 0,q=h[k].getAttribute(_.cd)||void 0;void 0!==n&&(n=+n);void 0!==q&&(q=+q);b.canDisplayType(l,m,n,q)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.bb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
81
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.kb)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=JK();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.u){e=c[d].getElementsByTagName(_.Ya);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ma)||void 0,h=e[f].getAttribute(_.Ka)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Je,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Ya).length||a.removeChild(c[d])}a=
82
- (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=OJ(c.media.customData.playerConfiguration));if(b.l&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield rK(c.media,d.ima,b.l.getNetworkEngine()));typeof d.startTime===_.p&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.en(b.l,d),yield _.fn(b.l),d=b.l.getLoadedSource(),c.media.contentId=
83
- d.url,c.media.contentType=d.type,d.yb&&(c.media.hlsVideoSegmentFormat=QJ(d.yb,_.K)),d.audioMimeType&&(c.media.hlsSegmentFormat=QJ(d.audioMimeType,_.J)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.p&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.l.getConfiguration().autoplay)}b.m&&(d=yield Promise.resolve(b.m(c)))&&(c=d);return c})}G(a){if(this.l&&(!a.media.customData||!a.media.customData.local)){var b=JK().getPlayerManager(),
84
- c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.l.getConfiguration().startTime;typeof a!==_.p||typeof c!==_.p||typeof d!==_.p||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.p&&b>=a&&b<=c&&this.l.seek(b))}_.hn(this.l)}}B(a){if(0<this.g.size){const b=OJ(a.data);this.g.forEach(c=>c(b))}}};_.x(JJ,HK);HK.prototype.getContentMetadata=HK.prototype.$a;HK.prototype.isApiReady=HK.prototype.Vb;HK.prototype.sendMessage=HK.prototype.sendMessage;HK.prototype.removeMessageListener=HK.prototype.removeMessageListener;
85
- HK.prototype.addMessageListener=HK.prototype.addMessageListener;HK.prototype.off=HK.prototype.off;HK.prototype.on=HK.prototype.on;HK.prototype.setLoadRequestDataInterceptor=HK.prototype.Qf;HK.prototype.setPlayerConfigInterceptor=HK.prototype.Ic;HK.prototype.stop=HK.prototype.stop;HK.prototype.start=HK.prototype.start;HK.prototype.init=HK.prototype.init;HK.getInstance=IK;var GK=null;var WK=class{constructor(a){this.f=a;this.a=null;this.g=new _.uo;this.h=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.w(function*(){a.a=a.f.m;if(a.a){const b=a.a.controller,c=a.j.bind(a);for(const d of a.h)a.g.on(b,d,c)}})}start(){return _.w(function*(){})}resume(){this.a&&
86
- this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(LJ,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.p&&(a=b));return a}dispose(){const a=this;
87
- return _.w(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.C(_.Ob,{adsTimeline:new SK(a.breaks)})));break;case "isPlayingBreak":a.value?NK(this,_.wb):(NK(this,_.Bb),NK(this,_.Lb),NK(this,_.xb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(NK(this,_.Bb),NK(this,_.Lb)),NK(this,_.Kb));break;case "isPaused":this.a.isPlayingBreak&&(a.value?NK(this,_.Gb):NK(this,_.Ib))}}};WK.prototype.getPosition=WK.prototype.getPosition;
88
- WK.prototype.setVolume=WK.prototype.setVolume;WK.prototype.getVolume=WK.prototype.getVolume;WK.prototype.skip=WK.prototype.skip;WK.prototype.pause=WK.prototype.pause;WK.prototype.resume=WK.prototype.resume;var XK=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}da(a,b){return a.namespace()!==_.Ac?!1:!(!b||!b.ima)}create(a){return new WK(a.a)}};XK.prototype.create=XK.prototype.create;XK.prototype.isSupported=XK.prototype.da;XK.prototype.name=XK.prototype.name;_.im(new XK);var YK=class{name(){return"clpp.cast.ads.AdsManagerFactory"}da(a,b){return IK().Vb()?!(!b||!b.ima):!1}create(a){return new TK(a)}};YK.prototype.create=YK.prototype.create;YK.prototype.isSupported=YK.prototype.da;YK.prototype.name=YK.prototype.name;_.im(new YK);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var KK="Cannot seek during ads playout.",LK="Cannot switch track",MK="Media session does not exist.",NK="No receivers available",OK="Reset ABR functionality not available on cast.",PK="SDK not yet ready",QK="Sender is destroyed.",RK="clpp.cast.CastProxy",SK="clpp.cast.Player",TK="clpp.cast.Receiver",UK="urn:x-cast:castlabs",VK="urn:x-cast:com.google.cast.media",WK=function(a){return _.y(function*(){yield _.Wm(a,_.Fd);yield _.Wm(a,_.Ed)})},XK=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.bd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Bd?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.r?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},YK=function(a){if(typeof a!==_.ne)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},ZK=function(a,b,c,d){return _.y(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
3
+ null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Th(d,a.mimeType,g);f&&g&&(h=_.kh(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.I(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},$K=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,
4
+ d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.Ke:return d.FMP4;case _.Je:return b===_.L?d.MPEG2_TS:c.TS;case _.bc:return c.AAC;case _.cc:return c.AC3;case _.dc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.ec:return c.FMP4}},bL=function(a){a=void 0===a?aL:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.H(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
5
+ b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},cL=function(a,b){return a.g.filter(c=>c.type===b)},eL=function(a,b){const c=dL(a);return cL(a,b).find(d=>c.includes(d.id))||null},gL=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.J){const e=a.oa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;fL(a,b)},e=>{a.f[b]=null;a.h.debug(LK,e)})}else b===_.J&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{fL(a,b)},e=>{a.h.debug(LK,e)}))},dL=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},fL=function(a,b){b===_.K?a.a.trigger(new _.F(_.Qi)):b===_.J&&a.a.trigger(new _.F(_.Ri))},jL=function(a){if(a)for(const b of hL)iL(b)},iL=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
+ cast.framework&&cast.framework.CastContext&&a.U.length){a.w=!0;a.o.$d();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.U;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.O);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da);kL&&a.o.$(.02)}},lL=function(a){return _.y(function*(){hL.delete(a);if(a.w){a.w=!1;var b=
8
+ cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.O);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.h&&(b.push(a.h.destroy()),a.h=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.S=null;a.X=null})},mL=function(a){return _.y(function*(){a.gb()||(yield cast.framework.CastContext.getInstance().requestSession())})},oL=function(a,b,c){c=
9
+ void 0===c?0:c;return _.y(function*(){var d=a.f.oa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.na())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield nL(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Qd:a.getPresentationStartTime(),autoplay:b,Ma:a.g})})},nL=function(a,b){return _.y(function*(){var c=chrome.cast.media.StreamType;yield mL(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
10
+ b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=$K(b.Ab,_.L);e.hlsSegmentFormat=$K(c,_.K);b.Ma&&(a.M&&(c=yield Promise.resolve(a.M(b.Ma)))&&(b.Ma=c),a.g=b.Ma,a.C=_.Vl(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Ma.remoteTextTracks&&(c=yield Promise.all(b.Ma.remoteTextTracks.map(a.Ka.bind(a))),e.tracks=c.filter(k=>k),b.Ma.remoteTextTracks=void 0),delete b.Ma.autoplay,b.Ma.startTime=null,e.customData={playerConfiguration:XK(b.Ma)});c=a.ab()||{};
11
+ var f=pL(c.metadataType),g;typeof b.Qd===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.Qd});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=qL(c);if(g=rL(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.ic&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},rL=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(sL);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=bL(sL[b]);return Object.assign(b,a)},pL=function(a){var b=void 0===b?aL:b;return Object.values(sL).includes(a)?a:b},qL=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},uL=function(a,b){tL(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(UK,a.R)},vL=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=
13
+ null;a=null===a?null:a+b;return null===a?b:a},tL=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.m=null,a.m=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.m),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ma.bind(a)),a.f&&a.f.load(),a.h&&a.h.init(),a.trigger(new _.F(_.od)))},yL=function(a){return new wL(a.h,()=>{a.trigger(new _.F(_.rc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-
14
+ 1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.je&&(d.preferredAudioLanguage=c.je);c.Se&&(d.preferredTextLanguage=c.Se);_.Ym(a.f,null);a.trigger(new _.F("castingended"));a.j(b,d)}},()=>xL(a))},xL=function(a){return _.y(function*(){a.trigger(new _.F(_.qc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Ym(a.f,a.a))})},BL=function(a,b,c){return _.y(function*(){var d=b.adTagUrl;if(d)try{zL=!1;const e=_.kh(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.Fg(f.data),h=(new DOMParser).parseFromString(g,
15
+ _.ue);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=AL(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=AL(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),zL=!0}}catch(e){_.C("Failed to fetch an ad",e),zL=!0}})},AL=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
+ a;return b},CL=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.l.onError(b)},DL=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},FL=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=EL(a,c))&&(d={ad:c});a.l.trigger(new _.F(b,d))}},EL=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.ne&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
+ _.ne&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Y(d,e,b.index,b.total,f)}return c},GL=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]},HL=function(a){const b=
18
+ a.dashTimedMetadata;let c=_.Be;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.Ae)?_.Rf:_.Pf,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},IL=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},KL=function(a){a.a=IL().getTextTracksManager();const b=a.a.getTracks();a.j=JL(_.J,b)},JL=function(a,b){const c=[];for(const d of b)b=new _.yh(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
19
+ null,b.language=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.Gh(b.id,b)),c.push(b);return c},LL=function(a,b,c,d){c=_.Zf(c).filter(g=>g);var e=!1;let f=[];b===_.K?f=a.getAudioTracks():b===_.J&&(f=a.ja());if(c=c.find(g=>{const h=_.sg(g);return f.some(k=>{k=_.sg(k.language||"");return _.tg(h,k)})})){const g=_.sg(c);c=f.filter(h=>
20
+ {h=_.sg(h.language||"");return _.tg(g,h)});f=c.length?c:f;e=e||!!c.length}_.Og(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.K?a.sa(e):b===_.J&&a.Ba(e))},ML=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},PL=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=
21
+ a.drm,e=_.pj(d);if(e){var f=[_.Jc];_.Vl(a)[0].type!==_.$b&&f.unshift(_.Kc);d.preferredDrmSystem===_.Jc&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Na[g];h?(c=g===_.Kc?cast.framework.ContentProtection.WIDEVINE:g===_.Jc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},NL(b,h,a,c),OL(b,h,a,c)):c()}else c()}else c()},NL=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.kh({method:"POST",
22
+ uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},OL=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.y(function*(){const g=_.lh(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.I(g.data)}):a.licenseHandler=
23
+ void 0},SL=function(){return QL||(QL=new RL)},TL=function(){return cast.framework.CastReceiverContext.getInstance()},VL=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=TL();var {hlsVideoSegmentFormat:d}=TL().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Ke:_.Je;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=UL(f,_.la),
24
+ h=UL(f,_.Za);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")},UL=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),0<=d&&(c=c.substring(0,d))));return c},XL=function(a,b){let c=null;const d=WL(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},WL=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
+ let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Y(d,c,g,e,f)}return b},YL=class{constructor(a,b){this.log=new _.O(b);this.f=a;this.m=null;this.h=_.Pl;this.o=_.xp;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Pl)}destroy(){this.m=
26
+ this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.G&&this.a(_.Ol)}a(a){if(a!==this.h)if(this.h===_.Ol&&a!==_.Pl)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.h;this.h=a;this.h===_.Kl?(this.B=b,this.f.trigger(new _.F(_.nc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Kl&&this.f.trigger(new _.F(_.jc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-
27
+ this.C};this.C=b;this.m&&_.yl(this.m,this.h);this.f.trigger(new _.F(_.ke,{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var aL=0,sL={GENERIC:aL,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var ZL=class extends YL{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.g=null;this.A=this.xb.bind(this)}init(){const a=this.f,b=a.a;b&&(this.g&&this.g.removeUpdateListener(this.A),this.g=b,this.g.addUpdateListener(this.A),this.w=a.m)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.y(function*(){a.g&&(a.g.removeUpdateListener(a.A),a.g=null);yield b().call(a)})}a(a){const b=this.f.m;b&&b.isPlayingBreak||super.a(a)}xb(){if(this.g&&
28
+ this.w&&!this.w.isPlayingBreak)switch(this.g.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.g.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Hl);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Ol);break;default:this.a(_.Pl)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Sl);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Rl);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Kl)}}};var Z=class extends _.P{constructor(){super();this.h=new _.O("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.L;break;case chrome.cast.media.TrackType.AUDIO:c=_.K;break;case chrome.cast.media.TrackType.TEXT:c=_.J}c=new _.yh(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
+ c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.Gh(c.id,c));return c}):[],this.a.trigger(new _.F(_.ap)))}destroy(){this.a=null}getVideoTracks(){return cL(this,_.L)}getAudioTracks(){return cL(this,_.K)}ja(){return cL(this,_.J)}ia(){const a=this.Ga();return a?a.renditions[0]:null}Da(){const a=this.na();return a?a.renditions[0]:null}Ea(){const a=this.oa();return a?a.renditions[0]:
30
+ null}Pa(){return this.f[_.L]||null}bb(){return this.f[_.K]||null}cb(){return this.f[_.J]||null}Ga(){return eL(this,_.L)}na(){return eL(this,_.K)}oa(){return eL(this,_.J)}Ua(a){gL(this,_.L,a)}sa(a){gL(this,_.K,a)}Ba(a){gL(this,_.J,a)}Ta(a){this.Ua(a&&a.track)}ib(a){this.sa(a&&a.track)}jb(a){this.Ba(a&&a.track)}addTextTrack(){return _.y(function*(){})}la(){return!0}};Z.prototype.isAbrEnabled=Z.prototype.la;Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.jb;
31
+ Z.prototype.setAudioRendition=Z.prototype.ib;Z.prototype.setVideoRendition=Z.prototype.Ta;Z.prototype.setTextTrack=Z.prototype.Ba;Z.prototype.setAudioTrack=Z.prototype.sa;Z.prototype.setVideoTrack=Z.prototype.Ua;Z.prototype.getTextTrack=Z.prototype.oa;Z.prototype.getAudioTrack=Z.prototype.na;Z.prototype.getVideoTrack=Z.prototype.Ga;Z.prototype.getLoadingTextRendition=Z.prototype.cb;Z.prototype.getLoadingAudioRendition=Z.prototype.bb;Z.prototype.getLoadingVideoRendition=Z.prototype.Pa;
32
+ Z.prototype.getTextRendition=Z.prototype.Ea;Z.prototype.getAudioRendition=Z.prototype.Da;Z.prototype.getVideoRendition=Z.prototype.ia;Z.prototype.getTextTracks=Z.prototype.ja;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var wL=class extends _.cp{constructor(a,b,c,d){super();this.j=new _.O(_.Ac);this.U=a;this.o=new _.Zh(b);this.S=c;this.X=d;this.g=this.I=_.aj();this.C=[];this.B=0;this.K=new _.Pm;this.G=this.m=this.a=null;this.A=this.w=!1;this.aa="";this.ga=1E6;this.f=new Z;this.f.initialize(this);this.h=new ZL(this);this.H=new _.uo;this.J=null;this.F=new Set;this.O=this.Wa.bind(this);this.da=this.Za.bind(this);this.W=this.Ya.bind(this);this.R=this.Xa.bind(this);this.M=null;window.cast||Object.defineProperty(window,
33
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{jL(!0)},0)}});iL(this);hL.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.h&&this.h.release()})}destroy(){return _.y(function*(){})}Nc(a){this.M=a}Xb(){return this.w}gb(){return this.A}wd(){return this.aa}sendMessage(a,b){const c=this;return _.y(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
34
+ if(e)try{yield e.sendMessage(a,XK(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.y(function*(){if(!a.Xb())throw a.j.warn(PK),new _.H(1,8,8001,void 0);if(!kL)throw a.j.warn(NK),new _.H(1,8,8002,void 0);if(a.gb())throw a.j.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield mL(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
35
+ b;throw new _.H(1,8,8E3,c);}})}sd(){this.gb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.bd&&this.F.add(a)}removeMessageListener(a){typeof a===_.bd&&this.F.delete(a)}play(){return this.isEnded()?oL(this,!0):new Promise((a,b)=>{if(!this.a)return b(MK);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(MK);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
36
+ _.Hl}seek(a){return this.isEnded()?oL(this,!1,a):new Promise((b,c)=>{this.a||c(MK);this.m.isPlayingBreak&&c(KK);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.De));this.a.seek(d,()=>{this.trigger(new _.F(_.Ce));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.r?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&
37
+ this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(VK,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||
38
+ !this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.r?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.h?this.h.getState():_.xp}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?YK(this.a.customData.stats):_.Cl()}isLive(){return Infinity===
39
+ this.getDuration()}load(a){const b=this;return _.y(function*(){if(b.Xb())if(kL){b.C=_.Vl(a);_.dj(a)&&(b.g=_.cj(b.I,a));var c=b.C[b.B];yield nL(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Ma:b.g,Ab:c.Ab,audioMimeType:c.audioMimeType})}else b.j.warn(NK);else b.j.warn(PK)})}getBufferInfo(){return new _.bp}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
40
+ a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.j.warn(OK)}onError(a){if(a&&(this.trigger(new _.F(_.$c,{detail:a})),this.h))this.h.onError(a)}namespace(){return _.Ac}canPlay(){return this.Xb()?2:0}ab(){return this.J}bc(a){this.J=rL(a)}od(){this.J=null}Wd(a){const b=this.ab()||{};a={metadataType:pL(b.metadataType),title:a};this.bc(Object.assign({},b,a))}Ud(a){const b=this.ab()||{},c=pL(b.metadataType);a=new chrome.cast.Image(a);
41
+ this.bc(Object.assign({},b,{metadataType:c,images:[a]}))}Td(a){const b=this.ab()||{};this.bc(Object.assign({},b,{metadataType:3,artist:a}))}Vd(a){const b=this.ab()||{};a={metadataType:pL(b.metadataType),releaseDate:a};this.bc(Object.assign({},b,a))}Wa(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;kL=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.$d()}Za(a){this.j.debug(`state: ${a.sessionState}, details:`,
42
+ a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;uL(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.gb()||(this.A=!0,uL(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.gb()&&this.a){const d=this.a.media;var b=this.f.na(),c=this.f.oa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:vL(this),Se:c,
43
+ je:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(UK,this.R);this.A=!1;this.a=null;this.H.release();this.m=this.G=null}}Ya(a){this.j.debug("New media session",a.mediaSession);tL(this,a.mediaSession)}Xa(a,b){if(a===UK&&0<this.F.size){const c=YK(b);this.F.forEach(d=>d(c))}}ma(){this.trigger(new _.F(_.ve))}Ka(a){const b=this;return _.y(function*(){let c=null;const d=yield ZK(a,[_.te,_.Zb],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ga++,
44
+ chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};wL.prototype.getTextDisplayer=wL.prototype.getTextDisplayer;wL.prototype.getNetworkEngine=wL.prototype.getNetworkEngine;wL.prototype.setNetworkEngine=wL.prototype.setNetworkEngine;var kL=!1,hL=new Set;window.__onGCastApiAvailable=jL;var $L=class extends _.cp{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.bd?c:(d,e)=>{this.f&&d!==_.Hl&&d!==_.Pl&&this.f.load(e)};this.a=yL(this);this.g=new _.O(RK);this.addDelegate(this.f)}destroy(){const a=this;return _.y(function*(){a.a&&(yield lL(a.a),a.a=null);a.removeDelegate(a.f)})}ld(){return!!this.a&&this.a.Xb()&&kL}gb(){return!!this.a&&this.a.gb()}wd(){return this.a?this.a.wd():""}Nc(a){this.a&&this.a.Nc(a)}cast(a){const b=this;return _.y(function*(){if(b.a)try{if(yield b.a.cast(),
45
+ b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.na();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.oa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.ic?e.isLive:b.f.isLive();d={source:e,
46
+ isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Qd:b.f.getPresentationStartTime(),Ab:h,audioMimeType:k,Ma:l}}var c=d}yield xL(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield nL(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.F(_.$c,{detail:d}),b.trigger(c)}})}sd(){this.a&&this.a.sd()}mf(a){const b=this;return _.y(function*(){a!==b.h&&(b.h=a,b.a&&(yield lL(b.a)),b.a=yL(b))})}sendMessage(a){const b=this;return _.y(function*(){b.a?
47
+ yield b.a.sendMessage(UK,a):b.g.warn(QK)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(QK)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(QK)}ab(){return this.a&&this.a.ab()}bc(a){this.a&&this.a.bc(a)}od(){this.a&&this.a.od()}Wd(a){this.a&&this.a.Wd(a)}Ud(a){this.a&&this.a.Ud(a)}Td(a){this.a&&this.a.Td(a)}Vd(a){this.a&&this.a.Vd(a)}};_.z(RK,$L);$L.prototype.setContentReleaseDate=$L.prototype.Vd;$L.prototype.setContentArtist=$L.prototype.Td;
48
+ $L.prototype.setContentImage=$L.prototype.Ud;$L.prototype.setContentTitle=$L.prototype.Wd;$L.prototype.clearContentMetadata=$L.prototype.od;$L.prototype.setContentMetadata=$L.prototype.bc;$L.prototype.getContentMetadata=$L.prototype.ab;$L.prototype.removeMessageListener=$L.prototype.removeMessageListener;$L.prototype.addMessageListener=$L.prototype.addMessageListener;$L.prototype.sendMessage=$L.prototype.sendMessage;$L.prototype.changeReceiverId=$L.prototype.mf;$L.prototype.forceDisconnect=$L.prototype.sd;
49
+ $L.prototype.cast=$L.prototype.cast;$L.prototype.setPlayerConfigInterceptor=$L.prototype.Nc;$L.prototype.getReceiverName=$L.prototype.wd;$L.prototype.isCasting=$L.prototype.gb;$L.prototype.canCast=$L.prototype.ld;$L.prototype.destroy=$L.prototype.destroy;var aM=class extends YL{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.X.bind(this);this.K=this.W.bind(this);this.J=this.U.bind(this);this.M=this.ga.bind(this);this.G=this.da.bind(this);this.F=this.T.bind(this);this.g=this.O.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
50
+ this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.M);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.g)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.y(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
51
+ d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.M);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.g);yield b().call(a)})}S(){this.f.trigger(new _.F(_.Sd));this.a(_.Sl)}R(){this.a(_.Rl)}aa(){this.a(_.Hl)}X(a){a.isBuffering?
52
+ this.a(_.Kl):(a=this.f.isPaused()?_.Rl:_.Sl,this.a(a))}W(){this.j=1;this.f.trigger(new _.F(_.De))}U(){this.f.trigger(new _.F(_.Ce))}ga(){this.j=2}da(){this.a(_.Ql)}O(a){const b=this.f.getStats();this.f.trigger(new _.F(_.hc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}T(a){a=new _.H(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.f.trigger(new _.F(_.$c,{detail:a}));this.a(_.Ol)}};var Y=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.h=typeof c===_.r?c:1;this.j=typeof d===_.r?d:1;this.g=typeof e===_.r?e:0}nb(){return"Google Cast Framework"}ob(){return cast.framework.VERSION}tb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}Zb(){return!1}Gb(){return this.a.clickThroughUrl||
53
+ null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}qb(){return 0}pb(){return 0}eb(){return 0}Qa(){switch(this.Hb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Hb(){return this.f.position}Ib(){return this.h}sb(){return this.j}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;
54
+ Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.sb;Y.prototype.getPositionInSequence=Y.prototype.Ib;Y.prototype.getPodTimeOffset=Y.prototype.Hb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Qa;Y.prototype.getMediaBitrate=Y.prototype.eb;Y.prototype.getMediaHeight=Y.prototype.pb;Y.prototype.getMediaWidth=Y.prototype.qb;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Gb;
55
+ Y.prototype.isBumper=Y.prototype.Zb;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;Y.prototype.getApiFramework=Y.prototype.getApiFramework;Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.tb;
56
+ Y.prototype.getAdManagerVersion=Y.prototype.ob;Y.prototype.getAdManagerName=Y.prototype.nb;var bM=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Jb(){return!!this.a.find(a=>0===a.position)}fb(){return!!this.a.find(a=>-1===a.position)}};bM.prototype.hasPostroll=bM.prototype.fb;bM.prototype.hasPreroll=bM.prototype.Jb;bM.prototype.getCuePoints=bM.prototype.getCuePoints;var cM=class{constructor(a){this.l=a;this.a=null;this.g=this.h.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];DL().addEventListener(this.f,
57
+ this.g)}load(){const a=this;return _.y(function*(){zL&&(zL=!1,CL(a,0))})}start(){return _.y(function*(){DL().play()})}resume(){-1!==this.getPosition()&&DL().play()}pause(){-1!==this.getPosition()&&DL().pause()}skip(){}getVolume(){return this.l.getVolume()||0}setVolume(a){this.l.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}dispose(){const a=this;return _.y(function*(){DL().removeEventListener(a.f,a.g)})}h(a){const b=cast.framework.events.EndedReason;
58
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=DL().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.F(_.Ob,{adsTimeline:new bM(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:FL(this,_.Eb,a);break;case cast.framework.events.EventType.BREAK_STARTED:FL(this,_.xb,a);break;case cast.framework.events.EventType.BREAK_ENDED:FL(this,_.yb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:FL(this,_.Kb,a);
59
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(FL(this,_.Jb,a),FL(this,_.Lb,a)):a.endedReason===b.STOPPED?FL(this,_.Lb,a):a.endedReason===b.END_OF_STREAM?(FL(this,_.Bb,a),FL(this,_.Lb,a)):a.endedReason===b.ERROR&&CL(this,1);break;case cast.framework.events.EventType.PLAYING:FL(this,_.Ib,a);break;case cast.framework.events.EventType.PAUSE:FL(this,_.Gb,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?FL(this,_.zb,a):FL(this,_.Ib,a)}}};
60
+ cM.prototype.getPosition=cM.prototype.getPosition;cM.prototype.setVolume=cM.prototype.setVolume;cM.prototype.getVolume=cM.prototype.getVolume;cM.prototype.skip=cM.prototype.skip;cM.prototype.pause=cM.prototype.pause;cM.prototype.resume=cM.prototype.resume;var zL=!1;var dM=class{constructor(a){this.Ob=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(GL(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(GL(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>HL(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
61
+ _.Sf;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Uf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Vf}b&&this.Ob(new _.F(b,{detail:HL(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Ob(new _.F(_.Sf,{detail:b}))}};var eM=class extends _.P{constructor(){super();this.g=new _.O("clpp.cast.TrackManager");this.l=null;this.o=1E9;this.h=[];this.j=[];this.m=this.w.bind(this);this.a=this.f=null}initialize(a){this.l=a;IL().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.l=null;IL().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ja(){return this.j}ia(){return null}Da(){const a=
62
+ this.na();return a&&a.renditions[0]}Ea(){const a=this.oa();return a&&a.renditions[0]}Pa(){return null}bb(){return null}cb(){return null}Ga(){return null}na(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.r&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}oa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ja().find(c=>c.id===b)||null)}return a}Ua(){this.g.warn("Video tracks unavailable on Cast")}sa(a){a&&this.f&&
63
+ this.f.setActiveById(+a.id)}Ba(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ta(){this.g.warn("Video renditions unavailable on Cast")}ib(a){this.sa(a&&a.track)}jb(a){this.Ba(a&&a.track)}addTextTrack(a){const b=this;return _.y(function*(){var c=b.l.getConfiguration();if((c=yield ZK(a,Object.values(cast.framework.messages.CaptionMimeType),b.l.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
64
+ c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),KL(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}la(){return!0}w(){this.f=IL().getAudioTracksManager();var a=this.f.getTracks();this.h=JL(_.K,a);KL(this);a=this.l.getConfiguration();LL(this,_.K,a.preferredAudioLanguage,a.preferredAudioRole);LL(this,_.J,a.preferredTextLanguage,a.preferredTextRole)}};eM.prototype.isAbrEnabled=eM.prototype.la;
65
+ eM.prototype.addTextTrack=eM.prototype.addTextTrack;eM.prototype.setTextRendition=eM.prototype.jb;eM.prototype.setAudioRendition=eM.prototype.ib;eM.prototype.setVideoRendition=eM.prototype.Ta;eM.prototype.setTextTrack=eM.prototype.Ba;eM.prototype.setAudioTrack=eM.prototype.sa;eM.prototype.setVideoTrack=eM.prototype.Ua;eM.prototype.getTextTrack=eM.prototype.oa;eM.prototype.getAudioTrack=eM.prototype.na;eM.prototype.getVideoTrack=eM.prototype.Ga;eM.prototype.getLoadingTextRendition=eM.prototype.cb;
66
+ eM.prototype.getLoadingAudioRendition=eM.prototype.bb;eM.prototype.getLoadingVideoRendition=eM.prototype.Pa;eM.prototype.getTextRendition=eM.prototype.Ea;eM.prototype.getAudioRendition=eM.prototype.Da;eM.prototype.getVideoRendition=eM.prototype.ia;eM.prototype.getTextTracks=eM.prototype.ja;eM.prototype.getAudioTracks=eM.prototype.getAudioTracks;eM.prototype.getVideoTracks=eM.prototype.getVideoTracks;var fM=class extends _.cp{constructor(){super();this.A=new _.O(SK);this.g=this.o=_.aj();this.w=null;this.j=-1;this.F=new _.Pm;this.f=this.m=this.h=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.o=b);a=ML();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new aM(this);this.a.init();this.h=new eM;this.h.initialize(this);this.m=new dM(c=>this.trigger(c));this.m.init()}unload(){const a=
67
+ cast.framework.messages.PlayerState,b=ML();b.getPlayerState()!==a.IDLE&&b.stop();this.h&&this.h.release();this.m&&this.m.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.y(function*(){a.B=null;a.o=_.aj();a.g=a.o;a.j=-1;a.w=null;a.a&&(yield a.a.destroy(),a.a=null);a.h&&(a.h.destroy(),a.h=null)})}play(){const a=ML();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
68
+ a.play();return Promise.resolve()}pause(){const a=ML();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return ML().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return ML().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=ML();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(KK);b.seek(a);return Promise.resolve()}getPosition(){return ML().getCurrentTimeSec()}getDuration(){const a=
69
+ ML().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return ML().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;ML().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
70
+ null}getLoadedSource(){const a=ML().getMediaInformation();if(a){var b=ML().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.w&&-1!==this.j?this.w[this.j]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Dg:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return ML().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=ML().getLiveSeekableRange();
71
+ b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.xp}getStats(){var a=_.Cl();if(this.f){a=ML().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.m=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.o=a.width||NaN;b.g=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.j=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.h=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
72
+ this;return _.y(function*(){b.f=new _.vp;b.a.m=b.f.a;b.w=_.Vl(a);_.dj(a)&&(b.g=_.cj(b.o,a));if(b.C)b.C=!1;else{var c=b.w[b.j],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.r&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:XK(b.g),local:!0};yield ML().load(d)}})}getBufferInfo(){this.A.warn(_.ma);return new _.bp}getTrackManager(){return this.h}getConfiguration(){return this.g}getSurface(){return this.B}setNetworkEngine(a){this.F=
73
+ a}getNetworkEngine(){return this.F}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return SK}getTimelineCues(){return this.m&&this.m.getTimelineCues()||[]}resetAbr(){this.A.warn(OK)}onError(a){a=new _.F(_.$c,{detail:a});this.trigger(a)}canPlay(){return _.li()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=XK(this.getStats());var b=ML(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==
74
+ b&&(this.A.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=ML().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
75
+ a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=YK(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;PL(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};fM.prototype.getTextDisplayer=fM.prototype.getTextDisplayer;fM.prototype.getNetworkEngine=fM.prototype.getNetworkEngine;
76
+ fM.prototype.setNetworkEngine=fM.prototype.setNetworkEngine;var RL=class{constructor(){this.a=!1;this.h=new _.O(TK);this.f=this.l=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.uo;this.m=null}init(a){a&&(this.f=new fM,_.Ym(a,this.f),this.l=a,this.o.on(window,"unload",()=>{const b=this;return _.y(function*(){b.l&&b.l.getState()!==_.Pl&&(yield WK(b.l))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=TL(),b=TL().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
77
+ c.customNamespaces={};c.customNamespaces[UK]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.l&&this.l.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
78
+ this.A);a.start(c);a.addCustomMessageListener(UK,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=TL();TL().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(UK,this.w);a.stop();this.l=this.f=null}}Nc(a){this.j=a}gg(a){this.m=a}on(a,b){TL().addEventListener(a,b)}off(a,b){TL().removeEventListener(a,b)}addMessageListener(a){typeof a===_.bd&&this.g.add(a)}removeMessageListener(a){typeof a===_.bd&&this.g.delete(a)}sendMessage(a,
79
+ b){TL().sendCustomMessage(UK,b,XK(a))}Xb(){return this.a}ab(){var a;return a=(a=TL().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return VL(this,a);try{var b=(new DOMParser).parseFromString(a,_.ue)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=TL();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
80
+ 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.ud);var h=e[f].getElementsByTagName(_.ab);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.ud)||g,m=h[k].getAttribute(_.Fc);let n=h[k].getAttribute(_.Xe)||void 0,q=h[k].getAttribute(_.cd)||void 0;void 0!==n&&(n=+n);void 0!==q&&(q=+q);b.canDisplayType(l,m,n,q)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.ab).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
81
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.kb)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=TL();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.Ya);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.La)||void 0,h=e[f].getAttribute(_.Ka)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Ke,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Ya).length||a.removeChild(c[d])}a=
82
+ (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.y(function*(){let c=a;var d;c.media.customData&&(d=YK(c.media.customData.playerConfiguration));if(b.l&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield BL(c.media,d.ima,b.l.getNetworkEngine()));typeof d.startTime===_.r&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.en(b.l,d),yield _.fn(b.l),d=b.l.getLoadedSource(),c.media.contentId=
83
+ d.url,c.media.contentType=d.type,d.Ab&&(c.media.hlsVideoSegmentFormat=$K(d.Ab,_.L)),d.audioMimeType&&(c.media.hlsSegmentFormat=$K(d.audioMimeType,_.K)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.r&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.l.getConfiguration().autoplay)}b.m&&(d=yield Promise.resolve(b.m(c)))&&(c=d);return c})}G(a){if(this.l&&(!a.media.customData||!a.media.customData.local)){var b=TL().getPlayerManager(),
84
+ c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.l.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.l.seek(b))}_.hn(this.l)}}B(a){if(0<this.g.size){const b=YK(a.data);this.g.forEach(c=>c(b))}}};_.z(TK,RL);RL.prototype.getContentMetadata=RL.prototype.ab;RL.prototype.isApiReady=RL.prototype.Xb;RL.prototype.sendMessage=RL.prototype.sendMessage;RL.prototype.removeMessageListener=RL.prototype.removeMessageListener;
85
+ RL.prototype.addMessageListener=RL.prototype.addMessageListener;RL.prototype.off=RL.prototype.off;RL.prototype.on=RL.prototype.on;RL.prototype.setLoadRequestDataInterceptor=RL.prototype.gg;RL.prototype.setPlayerConfigInterceptor=RL.prototype.Nc;RL.prototype.stop=RL.prototype.stop;RL.prototype.start=RL.prototype.start;RL.prototype.init=RL.prototype.init;RL.getInstance=SL;var QL=null;var gM=class{constructor(a){this.f=a;this.a=null;this.g=new _.uo;this.h=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.y(function*(){a.a=a.f.m;if(a.a){const b=a.a.controller,c=a.j.bind(a);for(const d of a.h)a.g.on(b,d,c)}})}start(){return _.y(function*(){})}resume(){this.a&&
86
+ this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(VK,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.r&&(a=b));return a}dispose(){const a=this;
87
+ return _.y(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.Ob,{adsTimeline:new bM(a.breaks)})));break;case "isPlayingBreak":a.value?XL(this,_.xb):(XL(this,_.Bb),XL(this,_.Lb),XL(this,_.yb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(XL(this,_.Bb),XL(this,_.Lb)),XL(this,_.Kb));break;case "isPaused":this.a.isPlayingBreak&&(a.value?XL(this,_.Gb):XL(this,_.Ib))}}};gM.prototype.getPosition=gM.prototype.getPosition;
88
+ gM.prototype.setVolume=gM.prototype.setVolume;gM.prototype.getVolume=gM.prototype.getVolume;gM.prototype.skip=gM.prototype.skip;gM.prototype.pause=gM.prototype.pause;gM.prototype.resume=gM.prototype.resume;var hM=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}ba(a,b){return a.namespace()!==_.Ac?!1:!(!b||!b.ima)}create(a){return new gM(a.a)}};hM.prototype.create=hM.prototype.create;hM.prototype.isSupported=hM.prototype.ba;hM.prototype.name=hM.prototype.name;_.im(new hM);var iM=class{name(){return"clpp.cast.ads.AdsManagerFactory"}ba(a,b){return SL().Xb()?!(!b||!b.ima):!1}create(a){return new cM(a)}};iM.prototype.create=iM.prototype.create;iM.prototype.isSupported=iM.prototype.ba;iM.prototype.name=iM.prototype.name;_.im(new iM);};f.call(g, window);
package/cl.conviva.js CHANGED
@@ -1,27 +1,27 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var bJ="Ad Error",cJ="onAdBreakStarted()",dJ="onAdBreakStopped()",eJ=function(a){var b=_.wi();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.gi()&&(f="Apple");_.fi()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.hi()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.gi()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.$h()||_.Xh()||_.Wh("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.$h()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Xh()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Wh("Hisense")&&(b="",f="Hisense")):_.Wh("Xbox One")&&(f="Microsoft",c=Conviva.Constants.DeviceType.CONSOLE,d=Conviva.Constants.DeviceCategory.XBOX);const g=a.deviceMetadata||{},h=(k,l)=>{k in g||!l||(g[k]=l)};h(Conviva.Constants.DeviceMetadata.TYPE,a.deviceType||
3
- c);h(Conviva.Constants.DeviceMetadata.OS_NAME,e);h(Conviva.Constants.DeviceMetadata.OS_VERSION,b);h(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||d);h(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||f);return g},fJ=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},gJ=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},iJ=function(a,b,c,d){const e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=b;e[Conviva.Constants.IS_LIVE]=
4
- fJ(!!d);e[Conviva.Constants.ASSET_NAME]=bJ;a&&(e[Conviva.Constants.ASSET_NAME]=a.getTitle(),e[Conviva.Constants.STREAM_URL]=a.getMediaUrl(),e[Conviva.Constants.DURATION]=a.getDuration(),e["c3.ad.id"]=hJ(a.getId()),e["c3.ad.creativeId"]=hJ(a.getCreativeId()),e["c3.ad.system"]=hJ(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=hJ(a.getApiFramework()),e["c3.ad.advertiser"]=hJ(a.getAdvertiserName()),e["c3.ad.position"]=gJ(a.getPodIndex()),e["c3.ad.technology"]=0===a.sb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=hJ(a.mb()),e["c3.ad.adManagerVersion"]=hJ(a.nb()),e["c3.ad.advertiserCategory"]=hJ(null),e["c3.ad.advertiserId"]=hJ(null),e["c3.ad.breakId"]=hJ(null),e["c3.ad.campaignName"]=hJ(null),e["c3.ad.category"]=hJ(null),e["c3.ad.classification"]=hJ(null),e["c3.ad.creativeName"]=hJ(null),e["c3.ad.sequence"]=hJ(a.Fb()),e["c3.ad.sessionStartEvent"]=hJ(null),e["c3.ad.unitName"]=hJ(null),e["c3.ad.dayPart"]=hJ(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
- a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=hJ(b),e["c3.ad.firstAdSystem"]=hJ(c),e["c3.ad.firstCreativeId"]=hJ(a));return e},hJ=function(a){return a?""+a:"NA"},mJ=function(a){a.g.on(a.l,_.wb,a.C.bind(a));a.g.on(a.l,_.xb,a.F.bind(a));a.g.on(a.l,_.Kb,a.L.bind(a));a.g.on(a.l,_.Hb,a.m.bind(a));a.g.on(a.l,_.Gb,a.m.bind(a));a.g.on(a.l,_.Ib,a.m.bind(a));a.g.on(a.l,_.zb,a.m.bind(a));a.g.on(a.l,_.Lb,a.N.bind(a));
7
- a.g.on(a.l,_.Jb,a.K.bind(a));a.g.on(a.l,_.Ab,a.G.bind(a));a.g.on(a.l,_.Db,a.I.bind(a));a.g.on(a.l,_.Eb,a.J.bind(a));a.g.on(a.l,_.Cb,a.H.bind(a));a.g.on(a.l,_.Fb,a.U.bind(a));a.g.on(a.l,_.Mb,a.R.bind(a));a.g.on(a.l,_.$c,b=>{var c=b.detail;if(10003===c.code&&(a.f.debug("onAdError()"),!a.h)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=bJ}null===a.a&&jJ(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.f.debug("Ad Playback Failure");
8
- kJ(a,lJ,c)}})},kJ=function(a,b,c=bJ){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case lJ:a.a.reportAdFailed(c,iJ(null,a.B,a.A));break;case nJ:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},jJ=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=iJ(b,a.B,a.A,a.l.isLive()),d=String(b.nb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.mb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
- d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.f.error("Could not create ad analytics session",c)}}},oJ=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.a.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,null,c);Conviva.Analytics.setDeviceMetadata(eJ(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
- b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.oa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.f.setPlayerInfo(b)},pJ=function(a){return a.l.getConfiguration().autoplay||!1},rJ=function(a){if(!a.m)if(a.C)a.a.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||a.K,c=a.l.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.a.debug(a.l.getConfiguration().source);var f={},g=
11
- new _.Kj(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.rh(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.oa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.z(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.f.reportPlaybackRequested(f);a.f.setCallback(()=>{a.a.debug("reportMiscellaneousMetrics()");if(qJ(a)){var h=1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
- h);if(h=a.l.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.a.debug("Current FPS",k),a.f.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.a.debug("Report deferred events"),a.j.forEach(h=>{h.pe(h.ce)}));a.j=[]}},sJ=function(a){if(!a.m&&a.f){const b=fJ(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},qJ=function(a){return null!==a.f&&a.C},tJ=function(a){a.a.debug("terminateSession()");
13
- a.f&&(a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.f.reportPlaybackEnded(),a.f.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},uJ=function(a,b){var c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.Bd;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.G(1,9,9E3),a.T(b,c)):b.namespace()===_.Ac&&(a.a=!1,
14
- a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},vJ=function(a){const b=[];typeof a===_.Bd&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.G(1,9,9001,{missingKeys:b});};var xJ=class{constructor(a,b){this.l=a;this.S=b;this.B="";this.A=_.oa;this.f=new _.O("clpp.conviva.ad");this.g=new _.uo;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.f.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.oa;mJ(this)}release(){this.f.debug("Release Ad Insights");this.w?this.f.debug(_.ia):(_.Of(this.g),this.a&&kJ(this,wJ),this.g.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.f.debug(_.Oc);this.o?this.f.debug(_.fa):this.o=!0}C(){this.f.debug(cJ)}F(){this.f.debug(dJ)}L(a){this.f.debug("onAdStarted()");
15
- a=a.ad;this.j||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),jJ(this,a));this.j=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.pb(),a.ob());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.cb())}m(a){this.f.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.Hb:case _.Ib:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.Gb:b(Conviva.Constants.PlayerState.PAUSED);break;case _.zb:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.f.debug("onAdStopped()");this.a&&!this.h&&kJ(this,wJ)}K(){this.f.debug("onAdSkipped()");this.a&&kJ(this,nJ)}G(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.f.debug("onAdImpression()");if(this.a){const a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}}J(a){this.f.debug("onAdLoaded()");
17
- const b=a.ad,c=()=>{this.j=!0;jJ(this,b)};if(-1!==b.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)c();else this.g.on(this.l,_.ve,()=>{this.l.getPosition()>=this.l.getDuration()-5&&(this.g.off(this.l,_.ve),c())})}H(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}U(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.f.debug("onAdThirdQuartile()");this.a&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},nJ=0,wJ=1,lJ=2;var yJ=class{constructor(a,b){this.l=a;this.g=new _.uo;this.f=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.m=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.a=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.m||(this.a.debug("Initialize conviva"),this.G=!1,this.F=_.kf(b),this.K=c,this.l=a,oJ(this,this.F),this.g.on(this.l,_.Sd,this.ka.bind(this)),this.g.on(this.l,_.ke,this.Z.bind(this)),this.g.on(this.l,_.hc,this.L.bind(this)),this.g.on(this.l,_.Ee,this.W.bind(this)),this.g.on(this.l,
19
- _.Ce,this.V.bind(this)),this.g.on(this.l,_.wb,this.S.bind(this)),this.g.on(this.l,_.xb,this.U.bind(this)),this.g.on(this.l,_.Ob,this.aa.bind(this)),this.g.on(this.l,_.gc,this.ca.bind(this)),this.g.on(this.l,_.$c,this.N.bind(this)),pJ(this)&&(this.a.debug("Start a new session: A new video starts in autoplay."),rJ(this)))}release(){this.a.debug("Release conviva");this.G?this.a.debug(_.ia):(_.Of(this.g),qJ(this)||this.o||!pJ(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),qJ(this)&&
20
- tJ(this),this.f=null,this.G=!0)}destroy(){this.a.debug(_.Oc);this.m?this.a.debug(_.fa):this.m=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.a.debug("Report app event error",d),c=!1}return c}ka(){this.a.debug("onPlayRequest()");qJ(this)||pJ(this)?qJ(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),qJ(this)&&!this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.a.debug("Creating conviva session. On Play Requested / No autoplay"),
21
- rJ(this))}Z(a){this.a.debug(_.Gd);const b=c=>{if(this.o&&(this.a.debug("Creating conviva session (On Seek / Replay)"),oJ(this,this.F),rJ(this),sJ(this),qJ(this))){var d=this.l.getTrackManager();d=d.ga()||d.Na();d.width&&d.height&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}qJ(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Sl:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.Rl:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Kl:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Hl:this.a.debug("onVideoEnded()"),qJ(this)&&(this.w&&this.w.eb()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.J=!0):tJ(this))}}L(a){this.a.debug(_.Cd);if(qJ(this)){if(a=a.detail,typeof a.width===_.p&&typeof a.height===_.p&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,
23
- a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.f.setContentInfo(b)}}else this.j.push({pe:this.L.bind(this),ce:a})}W(){this.a.debug("onSeeking()");qJ(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.a.debug("onSeeked()");qJ(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}aa(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.a.debug(cJ);
24
- var b=a.ad;a=0===b.Oa();const c=gJ(b.getPodIndex());qJ(this)||pJ(this)||!a||rJ(this);if(qJ(this)){a=0===b.sb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.rb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.fi()?b.CONTENT:b.SEPARATE;this.f.reportAdBreakStarted(a,b,e);this.B=!0}else this.a.debug("Bug: should already have a valid session")}U(){this.a.debug(dJ);
25
- qJ(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.J&&tJ(this))}N(a){this.a.debug(_.Dd);if(this.o&&this.I)this.a.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.F&&(d=Conviva.Constants.ErrorSeverity.FATAL,qJ(this)||rJ(this));qJ(this)?(this.a.debug("Report error",c,d),this.f.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.a.debug("Video Playback Failure"),
26
- this.I=!0,tJ(this))):this.j.push({pe:this.N.bind(this),ce:a})}}ca(){this.a.debug("onAutoPlayBlocked()");qJ(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,qJ(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var zJ=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.O("clpp.conviva")}onPlayerCreated(a){this.f=new yJ(a,this.h)}onContentWillLoad(a,b){uJ(this,a);if(this.a){var c=a.getConfiguration();c=_.kf(c.conviva||{});try{vJ(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new xJ(a,()=>this.f.f),this.g.initialize(c))}catch(d){d instanceof _.G?this.T(a,d):this.T(a,new _.G(1,9,9002,d,d))}}}onContentLoaded(){this.a&&sJ(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
- this.f=null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}T(a,b){a.trigger(new _.C(_.$c,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",zJ);zJ.prototype.reportAppEvent=zJ.prototype.reportAppEvent;zJ.Id="conviva";_.Sm(new class{create(){return new zJ}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var lK="Ad Error",mK="onAdBreakStarted()",nK="onAdBreakStopped()",oK=function(a){var b=_.Ci();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.mi()&&(f="Apple");_.li()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.ni()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.mi()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
+ _.fi()||_.ci()||_.bi("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.fi()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.ci()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.bi("Hisense")&&(b="",f="Hisense")):_.bi("Xbox One")&&(f="Microsoft",c=Conviva.Constants.DeviceType.CONSOLE,d=Conviva.Constants.DeviceCategory.XBOX);const g=a.deviceMetadata||{},h=(k,l)=>{k in g||!l||(g[k]=l)};h(Conviva.Constants.DeviceMetadata.TYPE,a.deviceType||
3
+ c);h(Conviva.Constants.DeviceMetadata.OS_NAME,e);h(Conviva.Constants.DeviceMetadata.OS_VERSION,b);h(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||d);h(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||f);return g},pK=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},qK=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},sK=function(a,b,c,d){const e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=b;e[Conviva.Constants.IS_LIVE]=
4
+ pK(!!d);e[Conviva.Constants.ASSET_NAME]=lK;a&&(e[Conviva.Constants.ASSET_NAME]=a.getTitle(),e[Conviva.Constants.STREAM_URL]=a.getMediaUrl(),e[Conviva.Constants.DURATION]=a.getDuration(),e["c3.ad.id"]=rK(a.getId()),e["c3.ad.creativeId"]=rK(a.getCreativeId()),e["c3.ad.system"]=rK(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=rK(a.getApiFramework()),e["c3.ad.advertiser"]=rK(a.getAdvertiserName()),e["c3.ad.position"]=qK(a.getPodIndex()),e["c3.ad.technology"]=0===a.tb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=rK(a.nb()),e["c3.ad.adManagerVersion"]=rK(a.ob()),e["c3.ad.advertiserCategory"]=rK(null),e["c3.ad.advertiserId"]=rK(null),e["c3.ad.breakId"]=rK(null),e["c3.ad.campaignName"]=rK(null),e["c3.ad.category"]=rK(null),e["c3.ad.classification"]=rK(null),e["c3.ad.creativeName"]=rK(null),e["c3.ad.sequence"]=rK(a.Ib()),e["c3.ad.sessionStartEvent"]=rK(null),e["c3.ad.unitName"]=rK(null),e["c3.ad.dayPart"]=rK(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
+ a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=rK(b),e["c3.ad.firstAdSystem"]=rK(c),e["c3.ad.firstCreativeId"]=rK(a));return e},rK=function(a){return a?""+a:"NA"},wK=function(a){a.g.on(a.l,_.xb,a.C.bind(a));a.g.on(a.l,_.yb,a.F.bind(a));a.g.on(a.l,_.Kb,a.M.bind(a));a.g.on(a.l,_.Hb,a.m.bind(a));a.g.on(a.l,_.Gb,a.m.bind(a));a.g.on(a.l,_.Ib,a.m.bind(a));a.g.on(a.l,_.zb,a.m.bind(a));a.g.on(a.l,_.Lb,a.O.bind(a));
7
+ a.g.on(a.l,_.Jb,a.K.bind(a));a.g.on(a.l,_.Ab,a.G.bind(a));a.g.on(a.l,_.Db,a.I.bind(a));a.g.on(a.l,_.Eb,a.J.bind(a));a.g.on(a.l,_.Cb,a.H.bind(a));a.g.on(a.l,_.Fb,a.U.bind(a));a.g.on(a.l,_.Mb,a.R.bind(a));a.g.on(a.l,_.$c,b=>{var c=b.detail;if(10003===c.code&&(a.f.debug("onAdError()"),!a.h)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=lK}null===a.a&&tK(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.f.debug("Ad Playback Failure");
8
+ uK(a,vK,c)}})},uK=function(a,b,c=lK){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case vK:a.a.reportAdFailed(c,sK(null,a.B,a.A));break;case xK:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},tK=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=sK(b,a.B,a.A,a.l.isLive()),d=String(b.ob()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.nb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
+ d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.f.error("Could not create ad analytics session",c)}}},yK=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.a.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,null,c);Conviva.Analytics.setDeviceMetadata(oK(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
+ b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.oa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.f.setPlayerInfo(b)},zK=function(a){return a.l.getConfiguration().autoplay||!1},BK=function(a){if(!a.m)if(a.C)a.a.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||a.K,c=a.l.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.a.debug(a.l.getConfiguration().source);var f={},g=
11
+ new _.Kj(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Ah(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.oa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.B(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.f.reportPlaybackRequested(f);a.f.setCallback(()=>{a.a.debug("reportMiscellaneousMetrics()");if(AK(a)){var h=1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
+ h);if(h=a.l.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.a.debug("Current FPS",k),a.f.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.a.debug("Report deferred events"),a.j.forEach(h=>{h.ue(h.ge)}));a.j=[]}},CK=function(a){if(!a.m&&a.f){const b=pK(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},AK=function(a){return null!==a.f&&a.C},DK=function(a){a.a.debug("terminateSession()");
13
+ a.f&&(a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.f.reportPlaybackEnded(),a.f.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},EK=function(a,b){var c=b.getConfiguration();a.a=!_.B(c.conviva)&&typeof c.conviva===_.Bd;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.T(b,c)):b.namespace()===_.Ac&&(a.a=!1,
14
+ a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},FK=function(a){const b=[];typeof a===_.Bd&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var HK=class{constructor(a,b){this.l=a;this.S=b;this.B="";this.A=_.oa;this.f=new _.O("clpp.conviva.ad");this.g=new _.uo;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.f.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.oa;wK(this)}release(){this.f.debug("Release Ad Insights");this.w?this.f.debug(_.ha):(_.Nf(this.g),this.a&&uK(this,GK),this.g.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.f.debug(_.Oc);this.o?this.f.debug(_.fa):this.o=!0}C(){this.f.debug(mK)}F(){this.f.debug(nK)}M(a){this.f.debug("onAdStarted()");
15
+ a=a.ad;this.j||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),tK(this,a));this.j=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.qb(),a.pb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.eb())}m(a){this.f.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.Hb:case _.Ib:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.Gb:b(Conviva.Constants.PlayerState.PAUSED);break;case _.zb:b(Conviva.Constants.PlayerState.BUFFERING)}}}O(){this.f.debug("onAdStopped()");this.a&&!this.h&&uK(this,GK)}K(){this.f.debug("onAdSkipped()");this.a&&uK(this,xK)}G(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.f.debug("onAdImpression()");if(this.a){const a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}}J(a){this.f.debug("onAdLoaded()");
17
+ const b=a.ad,c=()=>{this.j=!0;tK(this,b)};if(-1!==b.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)c();else this.g.on(this.l,_.ve,()=>{this.l.getPosition()>=this.l.getDuration()-5&&(this.g.off(this.l,_.ve),c())})}H(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}U(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.f.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},xK=0,GK=1,vK=2;var IK=class{constructor(a,b){this.l=a;this.g=new _.uo;this.f=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.m=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.a=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.m||(this.a.debug("Initialize conviva"),this.G=!1,this.F=_.lf(b),this.K=c,this.l=a,yK(this,this.F),this.g.on(this.l,_.Sd,this.ma.bind(this)),this.g.on(this.l,_.ke,this.aa.bind(this)),this.g.on(this.l,_.hc,this.M.bind(this)),this.g.on(this.l,_.De,this.X.bind(this)),this.g.on(this.l,
19
+ _.Ce,this.W.bind(this)),this.g.on(this.l,_.xb,this.S.bind(this)),this.g.on(this.l,_.yb,this.U.bind(this)),this.g.on(this.l,_.Ob,this.da.bind(this)),this.g.on(this.l,_.gc,this.ga.bind(this)),this.g.on(this.l,_.$c,this.O.bind(this)),zK(this)&&(this.a.debug("Start a new session: A new video starts in autoplay."),BK(this)))}release(){this.a.debug("Release conviva");this.G?this.a.debug(_.ha):(_.Nf(this.g),AK(this)||this.o||!zK(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),AK(this)&&
20
+ DK(this),this.f=null,this.G=!0)}destroy(){this.a.debug(_.Oc);this.m?this.a.debug(_.fa):this.m=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.a.debug("Report app event error",d),c=!1}return c}ma(){this.a.debug("onPlayRequest()");AK(this)||zK(this)?AK(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),AK(this)&&!this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.a.debug("Creating conviva session. On Play Requested / No autoplay"),
21
+ BK(this))}aa(a){this.a.debug(_.Gd);const b=c=>{if(this.o&&(this.a.debug("Creating conviva session (On Seek / Replay)"),yK(this,this.F),BK(this),CK(this),AK(this))){var d=this.l.getTrackManager();d=d.ia()||d.Pa();d.width&&d.height&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}AK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Sl:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.Rl:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Kl:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Hl:this.a.debug("onVideoEnded()"),AK(this)&&(this.w&&this.w.fb()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.J=!0):DK(this))}}M(a){this.a.debug(_.Cd);if(AK(this)){if(a=a.detail,typeof a.width===_.r&&typeof a.height===_.r&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,
23
+ a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.f.setContentInfo(b)}}else this.j.push({ue:this.M.bind(this),ge:a})}X(){this.a.debug("onSeeking()");AK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.a.debug("onSeeked()");AK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}da(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.a.debug(mK);
24
+ var b=a.ad;a=0===b.Qa();const c=qK(b.getPodIndex());AK(this)||zK(this)||!a||BK(this);if(AK(this)){a=0===b.tb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.sb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.li()?b.CONTENT:b.SEPARATE;this.f.reportAdBreakStarted(a,b,e);this.B=!0}else this.a.debug("Bug: should already have a valid session")}U(){this.a.debug(nK);
25
+ AK(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.J&&DK(this))}O(a){this.a.debug(_.Dd);if(this.o&&this.I)this.a.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.G&&(d=Conviva.Constants.ErrorSeverity.FATAL,AK(this)||BK(this));AK(this)?(this.a.debug("Report error",c,d),this.f.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.a.debug("Video Playback Failure"),
26
+ this.I=!0,DK(this))):this.j.push({ue:this.O.bind(this),ge:a})}}ga(){this.a.debug("onAutoPlayBlocked()");AK(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,AK(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var JK=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.O("clpp.conviva")}onPlayerCreated(a){this.f=new IK(a,this.h)}onContentWillLoad(a,b){EK(this,a);if(this.a){var c=a.getConfiguration();c=_.lf(c.conviva||{});try{FK(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new HK(a,()=>this.f.f),this.g.initialize(c))}catch(d){d instanceof _.H?this.T(a,d):this.T(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&CK(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
+ this.f=null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}T(a,b){a.trigger(new _.F(_.$c,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",JK);JK.prototype.reportAppEvent=JK.prototype.reportAppEvent;JK.Id="conviva";_.Sm(new class{create(){return new JK}});};f.call(g, window);