@castlabs/prestoplay 6.19.0 → 6.19.1

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 (62) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +106 -106
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +536 -534
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +77 -77
  10. package/cjs/cl.externs.js +1 -1
  11. package/cjs/cl.freewheel.js +18 -19
  12. package/cjs/cl.hls.js +69 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +28 -29
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +305 -307
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -16
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +70 -71
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +69 -69
  26. package/cjs/cl.ttml.js +28 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +11 -12
  29. package/cjs/cl.vr.js +18 -18
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +16 -16
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +84 -84
  36. package/cl.conviva.js +26 -26
  37. package/cl.core.js +386 -386
  38. package/cl.crypto.js +6 -6
  39. package/cl.dash.js +71 -71
  40. package/cl.externs.js +1 -1
  41. package/cl.freewheel.js +15 -15
  42. package/cl.hls.js +74 -74
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +25 -26
  45. package/cl.ima.js +14 -14
  46. package/cl.mse.js +271 -270
  47. package/cl.muxdata.js +11 -11
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +10 -10
  50. package/cl.playlist.js +5 -5
  51. package/cl.sessions.js +10 -10
  52. package/cl.simid.js +13 -13
  53. package/cl.smooth.js +58 -58
  54. package/cl.thumbnails.js +17 -17
  55. package/cl.tizen.js +56 -56
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +9 -8
  59. package/cl.vr.js +14 -14
  60. package/cl.vtt.js +12 -12
  61. package/cl.youbora.js +12 -12
  62. package/package.json +1 -1
package/cl.cast.js CHANGED
@@ -1,90 +1,90 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var kT="Cannot seek during ads playout.",lT="Cannot switch track",mT="Media session does not exist.",nT="No receivers available",oT="Reset ABR functionality not available on cast.",pT="SDK not yet ready",qT="Sender is destroyed.",rT="clpp.cast.CastProxy",sT="clpp.cast.Player",tT="clpp.cast.Receiver",uT="urn:x-cast:castlabs",vT="urn:x-cast:com.google.cast.media",wT=function(a){return _.w(function*(){yield _.wq(a,_.Je);yield _.wq(a,_.Ie)})},xT=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.Zd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Fe?"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}})},yT=function(a){if(typeof a!==_.Pf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},zT=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=_.Hj(d,a.mimeType,g);f&&g&&(h=_.Wi(a.url),(h=yield c.fetch(h).W)&&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})},AT=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 _.qg:return d.FMP4;case _.mg:return b===_.L?d.MPEG2_TS:c.TS;case _.Ic:return c.AAC;case _.Jc:return c.AC3;case _.Kc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Lc:return c.FMP4}},CT=function(a){a=void 0===a?BT: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}},DT=function(a,b){return a.h.filter(c=>c.type===b)},FT=function(a,b){const c=ET(a);return DT(a,b).find(d=>c.includes(d.id))||null},HT=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.ta();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
- d.editTracksInfo(c,()=>{a.f[b]=null;GT(a,b)},e=>{a.f[b]=null;a.g.debug(lT,e)})}else b===_.J&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{GT(a,b)},e=>{a.g.debug(lT,e)}))},ET=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},GT=function(a,b){b===_.K?a.a.trigger(new _.C(_.Mk)):b===_.J&&a.a.trigger(new _.C(_.Nk))},KT=function(a){if(a)for(const b of IT)JT(b)},JT=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
- cast.framework&&cast.framework.CastContext&&a.S.length){a.w=!0;a.o.Je();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.S;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Z);LT&&a.o.fa(.02)}},MT=function(a){return _.w(function*(){IT.delete(a);if(a.w){a.w=!1;var b=
8
- cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Z)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.R=null;a.X=null})},NT=function(a){return _.w(function*(){a.Gb()||(yield cast.framework.CastContext.getInstance().requestSession())})},PT=function(a,b,c){c=
9
- void 0===c?0:c;return _.w(function*(){var d=a.f.ta();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.la())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield OT(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),ve:a.getPresentationStartTime(),autoplay:b,$a:a.h})})},OT=function(a,b){return _.w(function*(){var c=chrome.cast.media.StreamType;yield NT(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=AT(b.Tb,_.L);e.hlsSegmentFormat=AT(c,_.K);b.$a&&(a.L&&(c=yield Promise.resolve(a.L(b.$a)))&&(b.$a=c),a.h=b.$a,a.C=_.fo(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.$a.remoteTextTracks&&(c=yield Promise.all(b.$a.remoteTextTracks.map(a.ia.bind(a))),e.tracks=c.filter(k=>k),b.$a.remoteTextTracks=void 0),delete b.$a.autoplay,b.$a.startTime=null,e.customData={playerConfiguration:xT(b.$a)});c=a.yb()||{};
11
- var f=QT(c.metadataType),g;typeof b.ve===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.ve});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=RT(c);if(g=ST(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Rc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},ST=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(TT);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=CT(TT[b]);return Object.assign(b,a)},QT=function(a){var b=void 0===b?BT:b;return Object.values(TT).includes(a)?a:b},RT=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},VT=function(a,b){UT(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(uT,a.O)},WT=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},UT=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.l),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.da.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.C(_.se)))},ZT=function(a){return new XT(a.h,()=>{a.trigger(new _.C(_.$c))},(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.Ve&&(d.preferredAudioLanguage=c.Ve);c.Nf&&(d.preferredTextLanguage=c.Nf);_.yq(a.f,null);a.trigger(new _.C("castingended"));a.j(b,d)}},()=>YT(a))},YT=function(a){return _.w(function*(){a.trigger(new _.C(_.Zc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.yq(a.f,a.a))})},bU=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{$T=!1;const e=_.Wi(d),f=yield c.fetch(e).W;if(f&&f.data){const g=_.si(f.data),h=(new DOMParser).parseFromString(g,
15
- _.Vf);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=aU(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=aU(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),$T=!0}}catch(e){_.B("Failed to fetch an ad",e),$T=!0}})},aU=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
- a;return b},cU=function(a,b){b=new _.G(1,10,10003,{errorType:b});a.m.onError(b)},dU=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},fU=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=eU(a,c))&&(d={ad:c});a.m.trigger(new _.C(b,d))}},eU=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Pf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
- _.Pf&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Z(d,e,b.index,b.total,f)}return c},gU=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]},hU=function(a){const b=
18
- a.dashTimedMetadata;let c=_.eg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.dg)?_.vh:_.th,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},iU=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},kU=function(a){a.a=iU().getTextTracksManager();const b=a.a.getTracks();a.j=jU(_.J,b)},jU=function(a,b){const c=[];for(const d of b)b=new _.kj(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
19
- null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.uj(b.id,b)),c.push(b);return c},lU=function(a,b,c,d){c=_.Ch(c).filter(g=>g);var e=!1;let f=[];b===_.K?f=a.getAudioTracks():b===_.J&&(f=a.ha());if(c=c.find(g=>{const h=_.ei(g);return f.some(k=>{k=_.ei(k.language||"");return _.fi(h,k)})})){const g=
20
- _.ei(c);c=f.filter(h=>{h=_.ei(h.language||"");return _.fi(g,h)});f=c.length?c:f;e=e||!!c.length}_.Bi(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.va(e):b===_.J&&a.Na(e))},mU=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},pU=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=_.tl(d);if(e){var f=[_.wd];_.fo(a)[0].type!==_.Gc&&f.unshift(_.yd);d.preferredDrmSystem===_.wd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.bb[g];h?(c=g===_.yd?cast.framework.ContentProtection.WIDEVINE:g===_.wd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},nU(b,h,a,c),oU(b,h,a,c)):c()}else c()}else c()},nU=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
- _.Wi({method:_.vb,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},oU=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.Xi(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.I(g.data)}):
23
- a.licenseHandler=void 0},sU=function(){return qU||(qU=new rU)},tU=function(){return cast.framework.CastReceiverContext.getInstance()},uU=function(){const a=tU().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},vU=function(a,b){const c=tU().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,tU().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},xU=function(a,
24
- b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=tU();var {hlsVideoSegmentFormat:d}=tU().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.qg:_.mg;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=wU(f,_.pa),h=wU(f,_.Cb);let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},
25
- wU=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},zU=function(a,b){let c=null;const d=yU(a);d&&(c={ad:d});a.f.trigger(new _.C(b,c))},yU=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;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=
26
- 0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},AU=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.h=_.Zn;this.o=_.It;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Zn)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.E&&this.a(_.Yn)}a(a){if(a!==
27
- this.h)if(this.h===_.Yn&&a!==_.Zn)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===_.Un?(this.B=b,this.player.trigger(new _.C(_.Wc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Un&&this.player.trigger(new _.C(_.Sc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.In(this.l,this.h);this.player.trigger(new _.C(_.Mf,{detail:a}))}}};
28
- _.x("clpp.cast.CastUtils",class{});var BT=0,TT={GENERIC:BT,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var BU=class extends AU{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Pb.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}Pb(){if(this.f&&
29
- this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Rn);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Yn);break;default:this.a(_.Zn)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.bo);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.ao);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Un)}}};var CU=class extends _.S{constructor(){super();this.g=new _.R("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.L;break;case chrome.cast.media.TrackType.AUDIO:c=_.K;break;case chrome.cast.media.TrackType.TEXT:c=_.J}c=new _.kj(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
30
- 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 _.uj(c.id,c));return c}):[],this.a.trigger(new _.C(_.lt)))}destroy(){this.a=null}getVideoTracks(){return DT(this,_.L)}getAudioTracks(){return DT(this,_.K)}ha(){return DT(this,_.J)}ma(){const a=this.La();return a?a.renditions[0]:null}Ta(){const a=this.la();return a?a.renditions[0]:null}Ka(){const a=this.ta();return a?a.renditions[0]:
31
- null}jb(){return this.f[_.L]||null}zb(){return this.f[_.K]||null}Ab(){return this.f[_.J]||null}La(){return FT(this,_.L)}la(){return FT(this,_.K)}ta(){return FT(this,_.J)}ub(a){HT(this,_.L,a)}va(a){HT(this,_.K,a)}Na(a){HT(this,_.J,a)}ab(a){this.ub(a&&a.track)}sb(a){this.va(a&&a.track)}tb(a){this.Na(a&&a.track)}addTextTrack(){return _.w(function*(){})}pa(){return!0}};CU.prototype.isAbrEnabled=CU.prototype.pa;CU.prototype.addTextTrack=CU.prototype.addTextTrack;CU.prototype.setTextRendition=CU.prototype.tb;
32
- CU.prototype.setAudioRendition=CU.prototype.sb;CU.prototype.setVideoRendition=CU.prototype.ab;CU.prototype.setTextTrack=CU.prototype.Na;CU.prototype.setAudioTrack=CU.prototype.va;CU.prototype.setVideoTrack=CU.prototype.ub;CU.prototype.getTextTrack=CU.prototype.ta;CU.prototype.getAudioTrack=CU.prototype.la;CU.prototype.getVideoTrack=CU.prototype.La;CU.prototype.getLoadingTextRendition=CU.prototype.Ab;CU.prototype.getLoadingAudioRendition=CU.prototype.zb;CU.prototype.getLoadingVideoRendition=CU.prototype.jb;
33
- CU.prototype.getTextRendition=CU.prototype.Ka;CU.prototype.getAudioRendition=CU.prototype.Ta;CU.prototype.getVideoRendition=CU.prototype.ma;CU.prototype.getTextTracks=CU.prototype.ha;CU.prototype.getAudioTracks=CU.prototype.getAudioTracks;CU.prototype.getVideoTracks=CU.prototype.getVideoTracks;var XT=class extends _.nt{constructor(a,b,c,d){super();this.g=new _.R(_.kd);this.S=a;this.o=new _.Wj(b);this.R=c;this.X=d;this.h=this.I=_.Xk();this.C=[];this.B=0;this.K=new _.iq;this.G=this.l=this.a=null;this.A=this.w=!1;this.Y="";this.ba=1E6;this.f=new CU;this.f.initialize(this);this.j=new BU(this);this.H=new _.Bs;this.J=null;this.F=new Set;this.M=this.Oa.bind(this);this.Z=this.Ra.bind(this);this.V=this.Qa.bind(this);this.O=this.Pa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
34
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{KT(!0)},0)}});JT(this);IT.add(this)}init(a,b){this.h=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}setSeekInterceptor(){}destroy(){return _.w(function*(){})}jd(a){this.L=
35
- a}nc(){return this.w}Gb(){return this.A}ae(){return this.Y}sendMessage(a,b){const c=this;return _.w(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,xT(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.nc())throw a.g.warn(pT),new _.G(1,8,8001,void 0);if(!LT)throw a.g.warn(nT),new _.G(1,8,8002,void 0);if(a.Gb())throw a.g.warn("Already casting"),
36
- new _.G(1,8,8003,void 0);try{yield NT(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.G(1,8,8E3,c);}})}$d(){this.Gb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Zd&&this.F.add(a)}removeMessageListener(a){typeof a===_.Zd&&this.F.delete(a)}play(){return this.isEnded()?PT(this,!0):new Promise((a,b)=>{if(!this.a)return b(mT);this.a.play(null,
37
- a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(mT);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.Rn}seek(a){return this.isEnded()?PT(this,!1,a):new Promise((b,c)=>{this.a||c(mT);this.l.isPlayingBreak&&c(kT);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.C(_.gg));this.a.seek(d,()=>{this.trigger(new _.C(_.fg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
38
- this.a.getEstimatedTime()||0}getDuration(){return this.getMediaDuration()}getMediaDuration(){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&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(vT,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var mT="Cannot seek during ads playout.",nT="Cannot switch track",oT="Media session does not exist.",pT="No receivers available",qT="Reset ABR functionality not available on cast.",rT="SDK not yet ready",sT="Sender is destroyed.",tT="clpp.cast.CastProxy",uT="clpp.cast.Player",vT="clpp.cast.Receiver",wT="urn:x-cast:castlabs",xT="urn:x-cast:com.google.cast.media",yT=function(a){return _.w(function*(){yield _.or(a,_.Je);yield _.or(a,_.Ie)})},zT=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.Zd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Fe?"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}})},AT=function(a){if(typeof a!==_.Pf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},BT=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=_.Hj(d,a.mimeType,g);f&&g&&(h=_.Si(a.url),(h=yield c.fetch(h).W)&&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})},CT=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 _.qg:return d.FMP4;case _.mg:return b===_.L?d.MPEG2_TS:c.TS;case _.Ic:return c.AAC;case _.Jc:return c.AC3;case _.Kc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Lc:return c.FMP4}},ET=function(a){a=void 0===a?DT: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}},FT=function(a,b){return a.h.filter(c=>c.type===b)},HT=function(a,b){const c=GT(a);return FT(a,b).find(d=>c.includes(d.id))||null},JT=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.ta();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;IT(a,b)},e=>{a.f[b]=null;a.g.debug(nT,e)})}else b===_.J&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{IT(a,b)},e=>{a.g.debug(nT,e)}))},GT=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},IT=function(a,b){b===_.K?a.a.trigger(new _.C(_.Mk)):b===_.J&&a.a.trigger(new _.C(_.Nk))},MT=function(a){if(a)for(const b of KT)LT(b)},LT=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
+ cast.framework&&cast.framework.CastContext&&a.S.length){a.w=!0;a.o.Je();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.S;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Z);NT&&a.o.fa(.02)}},OT=function(a){return _.w(function*(){KT.delete(a);if(a.w){a.w=!1;var b=
8
+ cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Z)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.R=null;a.X=null})},PT=function(a){return _.w(function*(){a.Gb()||(yield cast.framework.CastContext.getInstance().requestSession())})},RT=function(a,b,c){c=
9
+ void 0===c?0:c;return _.w(function*(){var d=a.f.ta();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.la())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield QT(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),ve:a.getPresentationStartTime(),autoplay:b,$a:a.h})})},QT=function(a,b){return _.w(function*(){var c=chrome.cast.media.StreamType;yield PT(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=CT(b.Tb,_.L);e.hlsSegmentFormat=CT(c,_.K);b.$a&&(a.L&&(c=yield Promise.resolve(a.L(b.$a)))&&(b.$a=c),a.h=b.$a,a.C=_.jo(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.$a.remoteTextTracks&&(c=yield Promise.all(b.$a.remoteTextTracks.map(a.ia.bind(a))),e.tracks=c.filter(k=>k),b.$a.remoteTextTracks=void 0),delete b.$a.autoplay,b.$a.startTime=null,e.customData={playerConfiguration:zT(b.$a)});c=a.yb()||{};
11
+ var f=ST(c.metadataType),g;typeof b.ve===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.ve});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=TT(c);if(g=UT(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Rc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},UT=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(VT);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=ET(VT[b]);return Object.assign(b,a)},ST=function(a){var b=void 0===b?DT:b;return Object.values(VT).includes(a)?a:b},TT=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},XT=function(a,b){WT(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(wT,a.O)},YT=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},WT=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.l),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.da.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.C(_.se)))},aU=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{ZT=!1;const e=_.Si(d),f=yield c.fetch(e).W;if(f&&f.data){const g=_.ni(f.data),h=(new DOMParser).parseFromString(g,
14
+ _.Vf);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=$T(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=$T(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),ZT=!0}}catch(e){_.B("Failed to fetch an ad",e),ZT=!0}})},$T=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
15
+ a;return b},bU=function(a,b){b=new _.G(1,10,10003,{errorType:b});a.m.onError(b)},cU=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},eU=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=dU(a,c))&&(d={ad:c});a.m.trigger(new _.C(b,d))}},dU=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Pf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
16
+ _.Pf&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Z(d,e,b.index,b.total,f)}return c},gU=function(a,b){let c=null;const d=fU(a);d&&(c={ad:d});a.f.trigger(new _.C(b,c))},fU=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||
17
+ null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},hU=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]},iU=function(a){const b=
18
+ a.dashTimedMetadata;let c=_.eg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.dg)?_.rh:_.ph,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},jU=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},lU=function(a){a.a=jU().getTextTracksManager();const b=a.a.getTracks();a.j=kU(_.J,b)},kU=function(a,b){const c=[];for(const d of b)b=new _.jj(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
19
+ null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.tj(b.id,b)),c.push(b);return c},mU=function(a,b,c,d){c=_.yh(c).filter(g=>g);var e=!1;let f=[];b===_.K?f=a.getAudioTracks():b===_.J&&(f=a.ha());if(c=c.find(g=>{const h=_.$h(g);return f.some(k=>{k=_.$h(k.language||"");return _.ai(h,k)})})){const g=
20
+ _.$h(c);c=f.filter(h=>{h=_.$h(h.language||"");return _.ai(g,h)});f=c.length?c:f;e=e||!!c.length}_.wi(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.va(e):b===_.J&&a.Na(e))},nU=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},qU=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=_.xl(d);if(e){var f=[_.wd];_.jo(a)[0].type!==_.Gc&&f.unshift(_.yd);d.preferredDrmSystem===_.wd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.bb[g];h?(c=g===_.yd?cast.framework.ContentProtection.WIDEVINE:g===_.wd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},oU(b,h,a,c),pU(b,h,a,c)):c()}else c()}else c()},oU=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
+ _.Si({method:_.vb,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},pU=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.Wi(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.I(g.data)}):
23
+ a.licenseHandler=void 0},tU=function(){return rU||(rU=new sU)},uU=function(){return cast.framework.CastReceiverContext.getInstance()},vU=function(){const a=uU().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},wU=function(a,b){const c=uU().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,uU().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},yU=function(a,
24
+ b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=uU();var {hlsVideoSegmentFormat:d}=uU().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.qg:_.mg;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=xU(f,_.pa),h=xU(f,_.Cb);let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},
25
+ xU=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},BU=function(a){return new zU(a.h,()=>{a.trigger(new _.C(_.$c))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Ve&&(d.preferredAudioLanguage=c.Ve);
26
+ c.Nf&&(d.preferredTextLanguage=c.Nf);_.qr(a.f,null);a.trigger(new _.C("castingended"));a.j(b,d)}},()=>AU(a))},AU=function(a){return _.w(function*(){a.trigger(new _.C(_.Zc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.qr(a.f,a.a))})},CU=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.h=_.co;this.o=_.Mt;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.co)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.E&&
27
+ this.a(_.bo)}a(a){if(a!==this.h)if(this.h===_.bo&&a!==_.co)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===_.Yn?(this.B=b,this.player.trigger(new _.C(_.Wc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Yn&&this.player.trigger(new _.C(_.Sc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.Mn(this.l,this.h);this.player.trigger(new _.C(_.Mf,
28
+ {detail:a}))}}};_.x("clpp.cast.CastUtils",class{});var DT=0,VT={GENERIC:DT,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var DU=class extends CU{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Pb.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}Pb(){if(this.f&&
29
+ this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Vn);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.bo);break;default:this.a(_.co)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.go);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.fo);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Yn)}}};var EU=class extends _.S{constructor(){super();this.g=new _.R("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.L;break;case chrome.cast.media.TrackType.AUDIO:c=_.K;break;case chrome.cast.media.TrackType.TEXT:c=_.J}c=new _.jj(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
30
+ 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 _.tj(c.id,c));return c}):[],this.a.trigger(new _.C(_.pt)))}destroy(){this.a=null}getVideoTracks(){return FT(this,_.L)}getAudioTracks(){return FT(this,_.K)}ha(){return FT(this,_.J)}ma(){const a=this.La();return a?a.renditions[0]:null}Ta(){const a=this.la();return a?a.renditions[0]:null}Ka(){const a=this.ta();return a?a.renditions[0]:
31
+ null}jb(){return this.f[_.L]||null}zb(){return this.f[_.K]||null}Ab(){return this.f[_.J]||null}La(){return HT(this,_.L)}la(){return HT(this,_.K)}ta(){return HT(this,_.J)}ub(a){JT(this,_.L,a)}va(a){JT(this,_.K,a)}Na(a){JT(this,_.J,a)}ab(a){this.ub(a&&a.track)}sb(a){this.va(a&&a.track)}tb(a){this.Na(a&&a.track)}addTextTrack(){return _.w(function*(){})}pa(){return!0}};EU.prototype.isAbrEnabled=EU.prototype.pa;EU.prototype.addTextTrack=EU.prototype.addTextTrack;EU.prototype.setTextRendition=EU.prototype.tb;
32
+ EU.prototype.setAudioRendition=EU.prototype.sb;EU.prototype.setVideoRendition=EU.prototype.ab;EU.prototype.setTextTrack=EU.prototype.Na;EU.prototype.setAudioTrack=EU.prototype.va;EU.prototype.setVideoTrack=EU.prototype.ub;EU.prototype.getTextTrack=EU.prototype.ta;EU.prototype.getAudioTrack=EU.prototype.la;EU.prototype.getVideoTrack=EU.prototype.La;EU.prototype.getLoadingTextRendition=EU.prototype.Ab;EU.prototype.getLoadingAudioRendition=EU.prototype.zb;EU.prototype.getLoadingVideoRendition=EU.prototype.jb;
33
+ EU.prototype.getTextRendition=EU.prototype.Ka;EU.prototype.getAudioRendition=EU.prototype.Ta;EU.prototype.getVideoRendition=EU.prototype.ma;EU.prototype.getTextTracks=EU.prototype.ha;EU.prototype.getAudioTracks=EU.prototype.getAudioTracks;EU.prototype.getVideoTracks=EU.prototype.getVideoTracks;var zU=class extends _.rt{constructor(a,b,c,d){super();this.g=new _.R(_.kd);this.S=a;this.o=new _.Wj(b);this.R=c;this.X=d;this.h=this.I=_.al();this.C=[];this.B=0;this.K=new _.gr;this.G=this.l=this.a=null;this.A=this.w=!1;this.Y="";this.ba=1E6;this.f=new EU;this.f.initialize(this);this.j=new DU(this);this.H=new _.Fs;this.J=null;this.F=new Set;this.M=this.Oa.bind(this);this.Z=this.Ra.bind(this);this.V=this.Qa.bind(this);this.O=this.Pa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
34
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{MT(!0)},0)}});LT(this);KT.add(this)}init(a,b){this.h=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}setSeekInterceptor(){}destroy(){return _.w(function*(){})}jd(a){this.L=
35
+ a}nc(){return this.w}Gb(){return this.A}ae(){return this.Y}sendMessage(a,b){const c=this;return _.w(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,zT(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.nc())throw a.g.warn(rT),new _.G(1,8,8001,void 0);if(!NT)throw a.g.warn(pT),new _.G(1,8,8002,void 0);if(a.Gb())throw a.g.warn("Already casting"),
36
+ new _.G(1,8,8003,void 0);try{yield PT(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.G(1,8,8E3,c);}})}$d(){this.Gb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Zd&&this.F.add(a)}removeMessageListener(a){typeof a===_.Zd&&this.F.delete(a)}play(){return this.isEnded()?RT(this,!0):new Promise((a,b)=>{if(!this.a)return b(oT);this.a.play(null,
37
+ a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(oT);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.Vn}seek(a){return this.isEnded()?RT(this,!1,a):new Promise((b,c)=>{this.a||c(oT);this.l.isPlayingBreak&&c(mT);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.C(_.gg));this.a.seek(d,()=>{this.trigger(new _.C(_.fg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
38
+ this.a.getEstimatedTime()||0}getDuration(){return this.getMediaDuration()}getMediaDuration(){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&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(xT,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
39
39
  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||!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=
40
- {start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.It}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?yT(this.a.customData.stats):_.Mn()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.w(function*(){if(b.nc())if(LT){b.C=_.fo(a);b.h=_.Zk(b.I,a);var c=b.C[b.B];yield OT(b,{source:c,
41
- isLive:c.isLive,autoplay:b.h.autoplay,$a:b.h,Tb:c.Tb,audioMimeType:c.audioMimeType})}else b.g.warn(nT);else b.g.warn(pT)})}getBufferInfo(){return new _.mt}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(oT)}onError(a){if(a&&
42
- (this.trigger(new _.C(_.Vd,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.kd}canPlay(){return this.nc()?2:0}yb(){return this.J}Sb(a){this.J=ST(a)}Vd(){this.J=null}Ee(a){const b=this.yb()||{};a={metadataType:QT(b.metadataType),title:a};this.Sb(Object.assign({},b,a))}Ce(a){const b=this.yb()||{},c=QT(b.metadataType);a=new chrome.cast.Image(a);this.Sb(Object.assign({},b,{metadataType:c,images:[a]}))}Be(a){const b=this.yb()||{};this.Sb(Object.assign({},b,{metadataType:3,artist:a}))}De(a){const b=
43
- this.yb()||{};a={metadataType:QT(b.metadataType),releaseDate:a};this.Sb(Object.assign({},b,a))}Oa(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;LT=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Y=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Je()}Ra(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;VT(this,a.session);break;
44
- case cast.framework.SessionState.SESSION_RESUMED:this.Gb()||(this.A=!0,VT(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.la(),c=this.f.ta();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:WT(this),Nf:c,Ve:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(uT,
45
- this.O);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}Qa(a){this.g.debug("New media session",a.mediaSession);UT(this,a.mediaSession)}Pa(a,b){if(a===uT&&0<this.F.size){const c=yT(b);this.F.forEach(d=>d(c))}}da(){this.trigger(new _.C(_.Xf))}ia(a){const b=this;return _.w(function*(){let c=null;const d=yield zT(a,[_.Uf,_.Fc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ba++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
46
- d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};XT.prototype.getTextDisplayer=XT.prototype.getTextDisplayer;XT.prototype.getNetworkEngine=XT.prototype.getNetworkEngine;XT.prototype.setNetworkEngine=XT.prototype.setNetworkEngine;var LT=!1,IT=new Set;window.__onGCastApiAvailable=KT;var DU=class extends _.nt{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Zd?c:(d,e)=>{this.f&&d!==_.Rn&&d!==_.Zn&&this.f.load(e)};this.a=ZT(this);this.g=new _.R(rT);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield MT(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}Sd(){return!!this.a&&this.a.nc()&&LT}Gb(){return!!this.a&&this.a.Gb()}ae(){return this.a?this.a.ae():""}jd(a){this.a&&this.a.jd(a)}cast(a){const b=this;return _.w(function*(){if(b.a)try{if(yield b.a.cast(),
47
- 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.ta();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.Rc?e.isLive:b.f.isLive();d={source:e,
48
- isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),ve:b.f.getPresentationStartTime(),Tb:h,audioMimeType:k,$a:l}}var c=d}yield YT(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield OT(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.C(_.Vd,{detail:d}),b.trigger(c)}})}$d(){this.a&&this.a.$d()}ng(a){const b=this;return _.w(function*(){a!==b.h&&(b.h=a,b.a&&(yield MT(b.a)),b.a=ZT(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?
49
- yield b.a.sendMessage(uT,a):b.g.warn(qT)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(qT)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(qT)}yb(){return this.a&&this.a.yb()}Sb(a){this.a&&this.a.Sb(a)}Vd(){this.a&&this.a.Vd()}Ee(a){this.a&&this.a.Ee(a)}Ce(a){this.a&&this.a.Ce(a)}Be(a){this.a&&this.a.Be(a)}De(a){this.a&&this.a.De(a)}};_.x(rT,DU);DU.prototype.setContentReleaseDate=DU.prototype.De;DU.prototype.setContentArtist=DU.prototype.Be;
50
- DU.prototype.setContentImage=DU.prototype.Ce;DU.prototype.setContentTitle=DU.prototype.Ee;DU.prototype.clearContentMetadata=DU.prototype.Vd;DU.prototype.setContentMetadata=DU.prototype.Sb;DU.prototype.getContentMetadata=DU.prototype.yb;DU.prototype.removeMessageListener=DU.prototype.removeMessageListener;DU.prototype.addMessageListener=DU.prototype.addMessageListener;DU.prototype.sendMessage=DU.prototype.sendMessage;DU.prototype.changeReceiverId=DU.prototype.ng;DU.prototype.forceDisconnect=DU.prototype.$d;
51
- DU.prototype.cast=DU.prototype.cast;DU.prototype.setPlayerConfigInterceptor=DU.prototype.jd;DU.prototype.getReceiverName=DU.prototype.ae;DU.prototype.isCasting=DU.prototype.Gb;DU.prototype.canCast=DU.prototype.Sd;DU.prototype.destroy=DU.prototype.destroy;var EU=class extends AU{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.R.bind(this);this.H=this.O.bind(this);this.A=this.Y.bind(this);this.w=this.X.bind(this);this.K=this.V.bind(this);this.J=this.S.bind(this);this.L=this.ba.bind(this);this.G=this.Z.bind(this);this.F=this.T.bind(this);this.f=this.M.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
52
- this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.L);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
53
- d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}R(){this.player.trigger(new _.C(_.Te));this.a(_.bo)}O(){this.a(_.ao)}Y(){this.a(_.Rn)}X(a){a.isBuffering?
54
- this.a(_.Un):(a=this.player.isPaused()?_.ao:_.bo,this.a(a))}V(){this.j=1;this.player.trigger(new _.C(_.gg))}S(){this.player.trigger(new _.C(_.fg))}ba(){this.j=2}Z(){this.a(_.$n)}M(a){const b=this.player.getStats();this.player.trigger(new _.C(_.Pc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}T(a){a=new _.G(_.E,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.C(_.Vd,{detail:a}));this.a(_.Yn)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.r?c:1;this.h=typeof d===_.r?d:1;this.j=typeof e===_.r?e:0}hb(){return"Google Cast Framework"}ib(){return cast.framework.VERSION}ob(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||0}Nb(){return!1}xb(){return this.a.clickThroughUrl||
40
+ {start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.Mt}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?AT(this.a.customData.stats):_.Qn()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.w(function*(){if(b.nc())if(NT){b.C=_.jo(a);b.h=_.dl(b.I,a);var c=b.C[b.B];yield QT(b,{source:c,
41
+ isLive:c.isLive,autoplay:b.h.autoplay,$a:b.h,Tb:c.Tb,audioMimeType:c.audioMimeType})}else b.g.warn(pT);else b.g.warn(rT)})}getBufferInfo(){return new _.qt}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(qT)}onError(a){if(a&&
42
+ (this.trigger(new _.C(_.Vd,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.kd}canPlay(){return this.nc()?2:0}yb(){return this.J}Sb(a){this.J=UT(a)}Vd(){this.J=null}Ee(a){const b=this.yb()||{};a={metadataType:ST(b.metadataType),title:a};this.Sb(Object.assign({},b,a))}Ce(a){const b=this.yb()||{},c=ST(b.metadataType);a=new chrome.cast.Image(a);this.Sb(Object.assign({},b,{metadataType:c,images:[a]}))}Be(a){const b=this.yb()||{};this.Sb(Object.assign({},b,{metadataType:3,artist:a}))}De(a){const b=
43
+ this.yb()||{};a={metadataType:ST(b.metadataType),releaseDate:a};this.Sb(Object.assign({},b,a))}Oa(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;NT=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Y=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Je()}Ra(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;XT(this,a.session);break;
44
+ case cast.framework.SessionState.SESSION_RESUMED:this.Gb()||(this.A=!0,XT(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.la(),c=this.f.ta();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:YT(this),Nf:c,Ve:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(wT,
45
+ this.O);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}Qa(a){this.g.debug("New media session",a.mediaSession);WT(this,a.mediaSession)}Pa(a,b){if(a===wT&&0<this.F.size){const c=AT(b);this.F.forEach(d=>d(c))}}da(){this.trigger(new _.C(_.Xf))}ia(a){const b=this;return _.w(function*(){let c=null;const d=yield BT(a,[_.Uf,_.Fc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ba++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
46
+ d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};zU.prototype.getTextDisplayer=zU.prototype.getTextDisplayer;zU.prototype.getNetworkEngine=zU.prototype.getNetworkEngine;zU.prototype.setNetworkEngine=zU.prototype.setNetworkEngine;var NT=!1,KT=new Set;window.__onGCastApiAvailable=MT;var FU=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Eb(){return!!this.a.find(a=>0===a.position)}Db(){return!!this.a.find(a=>-1===a.position)}};FU.prototype.hasPostroll=FU.prototype.Db;FU.prototype.hasPreroll=FU.prototype.Eb;FU.prototype.getCuePoints=FU.prototype.getCuePoints;var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.r?c:1;this.h=typeof d===_.r?d:1;this.j=typeof e===_.r?e:0}hb(){return"Google Cast Framework"}ib(){return cast.framework.VERSION}ob(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||0}Nb(){return!1}xb(){return this.a.clickThroughUrl||
55
47
  null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}lb(){return 0}kb(){return 0}Za(){return 0}Ua(){switch(this.Bb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Bb(){return this.f.position}Cb(){return this.l}nb(){return this.h}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;
56
48
  Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.nb;Z.prototype.getPositionInSequence=Z.prototype.Cb;Z.prototype.getPodTimeOffset=Z.prototype.Bb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Ua;Z.prototype.getMediaBitrate=Z.prototype.Za;Z.prototype.getMediaHeight=Z.prototype.kb;Z.prototype.getMediaWidth=Z.prototype.lb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.xb;
57
49
  Z.prototype.isBumper=Z.prototype.Nb;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;Z.prototype.getPosition=Z.prototype.getPosition;Z.prototype.getDuration=Z.prototype.getDuration;Z.prototype.getTitle=Z.prototype.getTitle;Z.prototype.getAdvertiserName=Z.prototype.getAdvertiserName;Z.prototype.getAdSystem=Z.prototype.getAdSystem;Z.prototype.getApiFramework=Z.prototype.getApiFramework;Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;
58
- Z.prototype.getTechnology=Z.prototype.ob;Z.prototype.getAdManagerVersion=Z.prototype.ib;Z.prototype.getAdManagerName=Z.prototype.hb;var FU=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Eb(){return!!this.a.find(a=>0===a.position)}Db(){return!!this.a.find(a=>-1===a.position)}};FU.prototype.hasPostroll=FU.prototype.Db;FU.prototype.hasPreroll=FU.prototype.Eb;FU.prototype.getCuePoints=FU.prototype.getCuePoints;var GU=class{constructor(a){this.m=a;this.a=null;this.j=this.l.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];dU().addEventListener(this.f,
59
- this.j)}load(){const a=this;return _.w(function*(){$T&&($T=!1,cU(a,0))})}start(){return _.w(function*(){dU().play()})}w(){}resume(){-1!==this.getPosition()&&dU().play()}pause(){-1!==this.getPosition()&&dU().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}o(){return!0}h(){const a=this;return _.w(function*(){dU().removeEventListener(a.f,a.j)})}l(a){const b=cast.framework.events.EndedReason;
60
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=dU().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.C(_.wc,{adsTimeline:new FU(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:fU(this,_.mc,a);break;case cast.framework.events.EventType.BREAK_STARTED:fU(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_ENDED:fU(this,_.dc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:fU(this,_.sc,a);
61
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(fU(this,_.rc,a),fU(this,_.tc,a)):a.endedReason===b.STOPPED?fU(this,_.tc,a):a.endedReason===b.END_OF_STREAM?(fU(this,_.gc,a),fU(this,_.tc,a)):a.endedReason===b.ERROR&&cU(this,1);break;case cast.framework.events.EventType.PLAYING:fU(this,_.qc,a);break;case cast.framework.events.EventType.PAUSE:fU(this,_.oc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?fU(this,_.ec,a):fU(this,_.qc,a)}}};
62
- GU.prototype.getPosition=GU.prototype.getPosition;GU.prototype.setVolume=GU.prototype.setVolume;GU.prototype.getVolume=GU.prototype.getVolume;GU.prototype.skip=GU.prototype.skip;GU.prototype.pause=GU.prototype.pause;GU.prototype.resume=GU.prototype.resume;var $T=!1;var HU=class{constructor(a){this.cb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(gU(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(gU(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>hU(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=
63
- _.wh;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.yh;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.zh}b&&this.cb(new _.C(b,{detail:hU(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.cb(new _.C(_.wh,{detail:b}))}};var IU=class extends _.S{constructor(){super();this.g=new _.R("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;iU().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;iU().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ha(){return this.j}ma(){return null}Ta(){const a=
50
+ Z.prototype.getTechnology=Z.prototype.ob;Z.prototype.getAdManagerVersion=Z.prototype.ib;Z.prototype.getAdManagerName=Z.prototype.hb;var GU=class{constructor(a){this.m=a;this.a=null;this.j=this.l.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];cU().addEventListener(this.f,
51
+ this.j)}load(){const a=this;return _.w(function*(){ZT&&(ZT=!1,bU(a,0))})}start(){return _.w(function*(){cU().play()})}w(){}resume(){-1!==this.getPosition()&&cU().play()}pause(){-1!==this.getPosition()&&cU().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}o(){return!0}h(){const a=this;return _.w(function*(){cU().removeEventListener(a.f,a.j)})}l(a){const b=cast.framework.events.EndedReason;
52
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=cU().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.C(_.wc,{adsTimeline:new FU(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:eU(this,_.mc,a);break;case cast.framework.events.EventType.BREAK_STARTED:eU(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_ENDED:eU(this,_.dc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:eU(this,_.sc,a);
53
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(eU(this,_.rc,a),eU(this,_.tc,a)):a.endedReason===b.STOPPED?eU(this,_.tc,a):a.endedReason===b.END_OF_STREAM?(eU(this,_.gc,a),eU(this,_.tc,a)):a.endedReason===b.ERROR&&bU(this,1);break;case cast.framework.events.EventType.PLAYING:eU(this,_.qc,a);break;case cast.framework.events.EventType.PAUSE:eU(this,_.oc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?eU(this,_.ec,a):eU(this,_.qc,a)}}};
54
+ GU.prototype.getPosition=GU.prototype.getPosition;GU.prototype.setVolume=GU.prototype.setVolume;GU.prototype.getVolume=GU.prototype.getVolume;GU.prototype.skip=GU.prototype.skip;GU.prototype.pause=GU.prototype.pause;GU.prototype.resume=GU.prototype.resume;var ZT=!1;var HU=class{constructor(a){this.f=a;this.a=null;this.j=new _.Fs;this.l=[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.l;if(a.a){const b=a.a.controller,c=a.A.bind(a);for(const d of a.l)a.j.on(b,d,c)}})}start(){return _.w(function*(){})}w(){}resume(){this.a&&
55
+ 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(xT,{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}o(){return!0}h(){const a=
56
+ this;return _.w(function*(){a.j.release()})}A(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.C(_.wc,{adsTimeline:new FU(a.breaks)})));break;case "isPlayingBreak":a.value?gU(this,_.cc):(gU(this,_.gc),gU(this,_.tc),gU(this,_.dc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(gU(this,_.gc),gU(this,_.tc)),gU(this,_.sc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?gU(this,_.oc):gU(this,_.qc))}}};HU.prototype.getPosition=HU.prototype.getPosition;
57
+ HU.prototype.setVolume=HU.prototype.setVolume;HU.prototype.getVolume=HU.prototype.getVolume;HU.prototype.skip=HU.prototype.skip;HU.prototype.pause=HU.prototype.pause;HU.prototype.resume=HU.prototype.resume;var IU=class extends CU{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.R.bind(this);this.H=this.O.bind(this);this.A=this.Y.bind(this);this.w=this.X.bind(this);this.K=this.V.bind(this);this.J=this.S.bind(this);this.L=this.ba.bind(this);this.G=this.Z.bind(this);this.F=this.T.bind(this);this.f=this.M.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
58
+ this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.L);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
59
+ d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}R(){this.player.trigger(new _.C(_.Te));this.a(_.go)}O(){this.a(_.fo)}Y(){this.a(_.Vn)}X(a){a.isBuffering?
60
+ this.a(_.Yn):(a=this.player.isPaused()?_.fo:_.go,this.a(a))}V(){this.j=1;this.player.trigger(new _.C(_.gg))}S(){this.player.trigger(new _.C(_.fg))}ba(){this.j=2}Z(){this.a(_.eo)}M(a){const b=this.player.getStats();this.player.trigger(new _.C(_.Pc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}T(a){a=new _.G(_.E,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.C(_.Vd,{detail:a}));this.a(_.bo)}};var JU=class{constructor(a){this.cb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(hU(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(hU(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>iU(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
+ _.sh;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.uh;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.vh}b&&this.cb(new _.C(b,{detail:iU(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.cb(new _.C(_.sh,{detail:b}))}};var KU=class extends _.S{constructor(){super();this.g=new _.R("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;jU().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;jU().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ha(){return this.j}ma(){return null}Ta(){const a=
64
62
  this.la();return a&&a.renditions[0]}Ka(){const a=this.ta();return a&&a.renditions[0]}jb(){return null}zb(){return null}Ab(){return null}La(){return null}la(){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}ta(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ha().find(c=>c.id===b)||null)}return a}ub(){this.g.warn("Video tracks unavailable on Cast")}va(a){a&&this.f&&
65
- this.f.setActiveById(+a.id)}Na(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}ab(){this.g.warn("Video renditions unavailable on Cast")}sb(a){this.va(a&&a.track)}tb(a){this.Na(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.m.getConfiguration();if((c=yield zT(a,Object.values(cast.framework.messages.CaptionMimeType),b.m.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
66
- 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]),kU(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}pa(){return!0}w(){this.f=iU().getAudioTracksManager();var a=this.f.getTracks();this.h=jU(_.K,a);kU(this);a=this.m.getConfiguration();lU(this,_.K,a.preferredAudioLanguage,a.preferredAudioRole);lU(this,_.J,a.preferredTextLanguage,a.preferredTextRole)}};IU.prototype.isAbrEnabled=IU.prototype.pa;
67
- IU.prototype.addTextTrack=IU.prototype.addTextTrack;IU.prototype.setTextRendition=IU.prototype.tb;IU.prototype.setAudioRendition=IU.prototype.sb;IU.prototype.setVideoRendition=IU.prototype.ab;IU.prototype.setTextTrack=IU.prototype.Na;IU.prototype.setAudioTrack=IU.prototype.va;IU.prototype.setVideoTrack=IU.prototype.ub;IU.prototype.getTextTrack=IU.prototype.ta;IU.prototype.getAudioTrack=IU.prototype.la;IU.prototype.getVideoTrack=IU.prototype.La;IU.prototype.getLoadingTextRendition=IU.prototype.Ab;
68
- IU.prototype.getLoadingAudioRendition=IU.prototype.zb;IU.prototype.getLoadingVideoRendition=IU.prototype.jb;IU.prototype.getTextRendition=IU.prototype.Ka;IU.prototype.getAudioRendition=IU.prototype.Ta;IU.prototype.getVideoRendition=IU.prototype.ma;IU.prototype.getTextTracks=IU.prototype.ha;IU.prototype.getAudioTracks=IU.prototype.getAudioTracks;IU.prototype.getVideoTracks=IU.prototype.getVideoTracks;var JU=class extends _.nt{constructor(){super();this.g=new _.R(sT);this.h=this.w=_.Xk();this.A=null;this.l=-1;this.F=new _.iq;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.h=this.w=b);a=mU();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new EU(this);this.a.init();this.j=new IU;this.j.initialize(this);this.o=new HU(c=>this.trigger(c));this.o.init()}unload(){const a=
69
- cast.framework.messages.PlayerState,b=mU();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.w(function*(){a.B=null;a.w=_.Xk();a.h=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=mU();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
70
- a.play();return Promise.resolve()}pause(){const a=mU();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return mU().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return mU().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=mU();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(kT);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}getMediaPosition(){return mU().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
71
- mU().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return mU().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;mU().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||
72
- null}getLoadedSource(){const a=mU().getMediaInformation();if(a){var b=mU().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.A&&-1!==this.l?this.A[this.l]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Uh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return mU().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=mU().getLiveSeekableRange();
73
- 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():_.It}getStats(){var a=_.Mn();if(this.f){a=mU().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.o=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.w=a.width||NaN;b.h=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
74
- this;return _.w(function*(){b.f=new _.Gt;b.a.l=b.f.a;b.A=_.fo(a);b.h=_.Zk(b.w,a);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.h.autoplay;typeof b.h.startTime===_.r&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:xT(b.h),local:!0};yield mU().load(d)}})}getBufferInfo(){this.g.warn(_.qa);return new _.mt}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}setNetworkEngine(a){this.F=
75
- a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return sT}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(oT)}onError(a){a=new _.C(_.Vd,{detail:a});this.trigger(a)}canPlay(){return _.jk()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=xT(this.getStats());var b=mU(),c=a.media||b.getMediaInformation();b=
76
- b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==b&&(this.g.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=mU().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;
77
- h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=yT(a.media.customData.playerConfiguration));(a=c?c.abr||null:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;pU(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};JU.prototype.getTextDisplayer=JU.prototype.getTextDisplayer;
78
- JU.prototype.getNetworkEngine=JU.prototype.getNetworkEngine;JU.prototype.setNetworkEngine=JU.prototype.setNetworkEngine;var rU=class{constructor(){this.a=!1;this.g=new _.R(tT);this.f=this.m=null;this.h=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.Bs;this.l=null}init(a){a&&(this.f=new JU,_.yq(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.w(function*(){b.m&&b.m.getState()!==_.Zn&&(yield wT(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=tU(),b=tU().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
79
- c.customNamespaces={};c.customNamespaces[uT]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.m&&this.m.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
80
- this.A);a.start(c);a.addCustomMessageListener(uT,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=tU();tU().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(uT,this.w);a.stop();this.m=this.f=null}}jd(a){this.j=a}uh(a){this.l=a}on(a,b){tU().addEventListener(a,b)}off(a,b){tU().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Zd&&this.h.add(a)}removeMessageListener(a){typeof a===_.Zd&&this.h.delete(a)}sendMessage(a,
81
- b){tU().sendCustomMessage(uT,b,xT(a))}nc(){return this.a}yb(){return uU()}Sb(a){vU(this,a)}Hh(a){const b=uU();let c=null;a?c=Object.assign({},b,a):c=b;vU(this,c)}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return xU(this,a);try{var b=(new DOMParser).parseFromString(a,_.Vf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=tU();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ha);for(var f=e.length-
63
+ this.f.setActiveById(+a.id)}Na(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}ab(){this.g.warn("Video renditions unavailable on Cast")}sb(a){this.va(a&&a.track)}tb(a){this.Na(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.m.getConfiguration();if((c=yield BT(a,Object.values(cast.framework.messages.CaptionMimeType),b.m.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
64
+ c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),lU(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}pa(){return!0}w(){this.f=jU().getAudioTracksManager();var a=this.f.getTracks();this.h=kU(_.K,a);lU(this);a=this.m.getConfiguration();mU(this,_.K,a.preferredAudioLanguage,a.preferredAudioRole);mU(this,_.J,a.preferredTextLanguage,a.preferredTextRole)}};KU.prototype.isAbrEnabled=KU.prototype.pa;
65
+ KU.prototype.addTextTrack=KU.prototype.addTextTrack;KU.prototype.setTextRendition=KU.prototype.tb;KU.prototype.setAudioRendition=KU.prototype.sb;KU.prototype.setVideoRendition=KU.prototype.ab;KU.prototype.setTextTrack=KU.prototype.Na;KU.prototype.setAudioTrack=KU.prototype.va;KU.prototype.setVideoTrack=KU.prototype.ub;KU.prototype.getTextTrack=KU.prototype.ta;KU.prototype.getAudioTrack=KU.prototype.la;KU.prototype.getVideoTrack=KU.prototype.La;KU.prototype.getLoadingTextRendition=KU.prototype.Ab;
66
+ KU.prototype.getLoadingAudioRendition=KU.prototype.zb;KU.prototype.getLoadingVideoRendition=KU.prototype.jb;KU.prototype.getTextRendition=KU.prototype.Ka;KU.prototype.getAudioRendition=KU.prototype.Ta;KU.prototype.getVideoRendition=KU.prototype.ma;KU.prototype.getTextTracks=KU.prototype.ha;KU.prototype.getAudioTracks=KU.prototype.getAudioTracks;KU.prototype.getVideoTracks=KU.prototype.getVideoTracks;var LU=class extends _.rt{constructor(){super();this.g=new _.R(uT);this.h=this.w=_.al();this.A=null;this.l=-1;this.F=new _.gr;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.h=this.w=b);a=nU();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new IU(this);this.a.init();this.j=new KU;this.j.initialize(this);this.o=new JU(c=>this.trigger(c));this.o.init()}unload(){const a=
67
+ cast.framework.messages.PlayerState,b=nU();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.w(function*(){a.B=null;a.w=_.al();a.h=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=nU();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
68
+ a.play();return Promise.resolve()}pause(){const a=nU();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return nU().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return nU().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=nU();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(mT);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}getMediaPosition(){return nU().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
69
+ nU().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return nU().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;nU().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=nU().getMediaInformation();if(a){var b=nU().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.A&&-1!==this.l?this.A[this.l]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Uh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return nU().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=nU().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():_.Mt}getStats(){var a=_.Qn();if(this.f){a=nU().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.o=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.w=a.width||NaN;b.h=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
72
+ this;return _.w(function*(){b.f=new _.Kt;b.a.l=b.f.a;b.A=_.jo(a);b.h=_.dl(b.w,a);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.h.autoplay;typeof b.h.startTime===_.r&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:zT(b.h),local:!0};yield nU().load(d)}})}getBufferInfo(){this.g.warn(_.qa);return new _.qt}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}setNetworkEngine(a){this.F=
73
+ a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return uT}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(qT)}onError(a){a=new _.C(_.Vd,{detail:a});this.trigger(a)}canPlay(){return _.jk()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=zT(this.getStats());var b=nU(),c=a.media||b.getMediaInformation();b=
74
+ b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==b&&(this.g.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=nU().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;
75
+ h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=AT(a.media.customData.playerConfiguration));(a=c?c.abr||null:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;qU(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};LU.prototype.getTextDisplayer=LU.prototype.getTextDisplayer;
76
+ LU.prototype.getNetworkEngine=LU.prototype.getNetworkEngine;LU.prototype.setNetworkEngine=LU.prototype.setNetworkEngine;var sU=class{constructor(){this.a=!1;this.g=new _.R(vT);this.f=this.m=null;this.h=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.Fs;this.l=null}init(a){a&&(this.f=new LU,_.qr(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.w(function*(){b.m&&b.m.getState()!==_.co&&(yield yT(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=uU(),b=uU().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
77
+ c.customNamespaces={};c.customNamespaces[wT]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.m&&this.m.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
78
+ this.A);a.start(c);a.addCustomMessageListener(wT,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=uU();uU().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(wT,this.w);a.stop();this.m=this.f=null}}jd(a){this.j=a}uh(a){this.l=a}on(a,b){uU().addEventListener(a,b)}off(a,b){uU().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Zd&&this.h.add(a)}removeMessageListener(a){typeof a===_.Zd&&this.h.delete(a)}sendMessage(a,
79
+ b){uU().sendCustomMessage(wT,b,zT(a))}nc(){return this.a}yb(){return vU()}Sb(a){wU(this,a)}Hh(a){const b=vU();let c=null;a?c=Object.assign({},b,a):c=b;wU(this,c)}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return yU(this,a);try{var b=(new DOMParser).parseFromString(a,_.Vf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=uU();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ha);for(var f=e.length-
82
80
  1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.t||g===_.p){g=e[f].getAttribute(_.ze);var h=e[f].getElementsByTagName(_.Db);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.ze)||g,m=h[k].getAttribute(_.rd);let n=h[k].getAttribute(_.Dg)||void 0,q=h[k].getAttribute(_.$d)||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(_.Db).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ha).length||a.removeChild(c[d])}return a=
83
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Jb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=tU();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.t){e=c[d].getElementsByTagName(_.Bb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.hb)||void 0,h=e[f].getAttribute(_.gb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.qg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Bb).length||a.removeChild(c[d])}a=
84
- (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=yT(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield bU(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.r&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.Hq(b.m,d),yield _.Iq(b.m),d=b.m.getLoadedSource(),c.media.contentId=
85
- d.url,c.media.contentType=d.type,d.Tb&&(c.media.hlsVideoSegmentFormat=AT(d.Tb,_.L)),d.audioMimeType&&(c.media.hlsSegmentFormat=AT(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.m.getConfiguration().autoplay)}b.l&&(d=yield Promise.resolve(b.l(c)))&&(c=d);return c})}G(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=tU().getPlayerManager(),
86
- c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.m.seek(b))}_.Kq(this.m)}}B(a){if(0<this.h.size){const b=yT(a.data);this.h.forEach(c=>c(b))}}};_.x(tT,rU);rU.prototype.updateContentMetadata=rU.prototype.Hh;rU.prototype.setContentMetadata=rU.prototype.Sb;rU.prototype.getContentMetadata=rU.prototype.yb;rU.prototype.isApiReady=rU.prototype.nc;
87
- rU.prototype.sendMessage=rU.prototype.sendMessage;rU.prototype.removeMessageListener=rU.prototype.removeMessageListener;rU.prototype.addMessageListener=rU.prototype.addMessageListener;rU.prototype.off=rU.prototype.off;rU.prototype.on=rU.prototype.on;rU.prototype.setLoadRequestDataInterceptor=rU.prototype.uh;rU.prototype.setPlayerConfigInterceptor=rU.prototype.jd;rU.prototype.stop=rU.prototype.stop;rU.prototype.start=rU.prototype.start;rU.prototype.init=rU.prototype.init;rU.getInstance=sU;var qU=null;var KU=class{constructor(a){this.f=a;this.a=null;this.j=new _.Bs;this.l=[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.l;if(a.a){const b=a.a.controller,c=a.A.bind(a);for(const d of a.l)a.j.on(b,d,c)}})}start(){return _.w(function*(){})}w(){}resume(){this.a&&
88
- 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(vT,{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}o(){return!0}h(){const a=
89
- this;return _.w(function*(){a.j.release()})}A(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.C(_.wc,{adsTimeline:new FU(a.breaks)})));break;case "isPlayingBreak":a.value?zU(this,_.cc):(zU(this,_.gc),zU(this,_.tc),zU(this,_.dc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(zU(this,_.gc),zU(this,_.tc)),zU(this,_.sc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?zU(this,_.oc):zU(this,_.qc))}}};KU.prototype.getPosition=KU.prototype.getPosition;
90
- KU.prototype.setVolume=KU.prototype.setVolume;KU.prototype.getVolume=KU.prototype.getVolume;KU.prototype.skip=KU.prototype.skip;KU.prototype.pause=KU.prototype.pause;KU.prototype.resume=KU.prototype.resume;_.uo(new class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.kd?!1:!(!b||!b.ima)}create(a){return new KU(a.a)}});_.uo(new class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return sU().nc()?!(!b||!b.ima):!1}create(a){return new GU(a)}});};f.call(g, window);
81
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Jb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=uU();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.t){e=c[d].getElementsByTagName(_.Bb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.hb)||void 0,h=e[f].getAttribute(_.gb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.qg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Bb).length||a.removeChild(c[d])}a=
82
+ (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=AT(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield aU(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.r&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.zr(b.m,d),yield _.Ar(b.m),d=b.m.getLoadedSource(),c.media.contentId=
83
+ d.url,c.media.contentType=d.type,d.Tb&&(c.media.hlsVideoSegmentFormat=CT(d.Tb,_.L)),d.audioMimeType&&(c.media.hlsSegmentFormat=CT(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.m.getConfiguration().autoplay)}b.l&&(d=yield Promise.resolve(b.l(c)))&&(c=d);return c})}G(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=uU().getPlayerManager(),
84
+ c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.m.seek(b))}_.Cr(this.m)}}B(a){if(0<this.h.size){const b=AT(a.data);this.h.forEach(c=>c(b))}}};_.x(vT,sU);sU.prototype.updateContentMetadata=sU.prototype.Hh;sU.prototype.setContentMetadata=sU.prototype.Sb;sU.prototype.getContentMetadata=sU.prototype.yb;sU.prototype.isApiReady=sU.prototype.nc;
85
+ sU.prototype.sendMessage=sU.prototype.sendMessage;sU.prototype.removeMessageListener=sU.prototype.removeMessageListener;sU.prototype.addMessageListener=sU.prototype.addMessageListener;sU.prototype.off=sU.prototype.off;sU.prototype.on=sU.prototype.on;sU.prototype.setLoadRequestDataInterceptor=sU.prototype.uh;sU.prototype.setPlayerConfigInterceptor=sU.prototype.jd;sU.prototype.stop=sU.prototype.stop;sU.prototype.start=sU.prototype.start;sU.prototype.init=sU.prototype.init;sU.getInstance=tU;var rU=null;_.yo(new class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return tU().nc()?!(!b||!b.ima):!1}create(a){return new GU(a)}});_.yo(new class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.kd?!1:!(!b||!b.ima)}create(a){return new HU(a.a)}});var MU=class extends _.rt{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Zd?c:(d,e)=>{this.f&&d!==_.Vn&&d!==_.co&&this.f.load(e)};this.a=BU(this);this.g=new _.R(tT);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield OT(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}Sd(){return!!this.a&&this.a.nc()&&NT}Gb(){return!!this.a&&this.a.Gb()}ae(){return this.a?this.a.ae():""}jd(a){this.a&&this.a.jd(a)}cast(a){const b=this;return _.w(function*(){if(b.a)try{if(yield b.a.cast(),
86
+ 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.ta();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.Rc?e.isLive:b.f.isLive();d={source:e,
87
+ isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),ve:b.f.getPresentationStartTime(),Tb:h,audioMimeType:k,$a:l}}var c=d}yield AU(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield QT(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.C(_.Vd,{detail:d}),b.trigger(c)}})}$d(){this.a&&this.a.$d()}ng(a){const b=this;return _.w(function*(){a!==b.h&&(b.h=a,b.a&&(yield OT(b.a)),b.a=BU(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?
88
+ yield b.a.sendMessage(wT,a):b.g.warn(sT)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(sT)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(sT)}yb(){return this.a&&this.a.yb()}Sb(a){this.a&&this.a.Sb(a)}Vd(){this.a&&this.a.Vd()}Ee(a){this.a&&this.a.Ee(a)}Ce(a){this.a&&this.a.Ce(a)}Be(a){this.a&&this.a.Be(a)}De(a){this.a&&this.a.De(a)}};_.x(tT,MU);MU.prototype.setContentReleaseDate=MU.prototype.De;MU.prototype.setContentArtist=MU.prototype.Be;
89
+ MU.prototype.setContentImage=MU.prototype.Ce;MU.prototype.setContentTitle=MU.prototype.Ee;MU.prototype.clearContentMetadata=MU.prototype.Vd;MU.prototype.setContentMetadata=MU.prototype.Sb;MU.prototype.getContentMetadata=MU.prototype.yb;MU.prototype.removeMessageListener=MU.prototype.removeMessageListener;MU.prototype.addMessageListener=MU.prototype.addMessageListener;MU.prototype.sendMessage=MU.prototype.sendMessage;MU.prototype.changeReceiverId=MU.prototype.ng;MU.prototype.forceDisconnect=MU.prototype.$d;
90
+ MU.prototype.cast=MU.prototype.cast;MU.prototype.setPlayerConfigInterceptor=MU.prototype.jd;MU.prototype.getReceiverName=MU.prototype.ae;MU.prototype.isCasting=MU.prototype.Gb;MU.prototype.canCast=MU.prototype.Sd;MU.prototype.destroy=MU.prototype.destroy;};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 MS="Ad Error",NS="onAdBreakStarted()",OS="onAdBreakStopped()",PS=function(a){var b=_.yk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.kk()&&(f="Apple");_.jk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.lk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.kk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var OS="Ad Error",PS="onAdBreakStarted()",QS="onAdBreakStopped()",RS=function(a){var b=_.yk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.kk()&&(f="Apple");_.jk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.lk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.kk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
2
  _.dk()||_.ak()||_.Zj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.dk()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.ak()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Zj("Hisense")&&(b="",f="Hisense")):_.Zj("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},QS=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},RS=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},TS=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
- QS(!!d);e[Conviva.Constants.ASSET_NAME]=MS;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"]=SS(a.getId()),e["c3.ad.creativeId"]=SS(a.getCreativeId()),e["c3.ad.system"]=SS(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=SS(a.getApiFramework()),e["c3.ad.advertiser"]=SS(a.getAdvertiserName()),e["c3.ad.position"]=RS(a.getPodIndex()),e["c3.ad.technology"]=0===a.ob()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=SS(a.hb()),e["c3.ad.adManagerVersion"]=SS(a.ib()),e["c3.ad.advertiserCategory"]=SS(null),e["c3.ad.advertiserId"]=SS(null),e["c3.ad.breakId"]=SS(null),e["c3.ad.campaignName"]=SS(null),e["c3.ad.category"]=SS(null),e["c3.ad.classification"]=SS(null),e["c3.ad.creativeName"]=SS(null),e["c3.ad.sequence"]=SS(a.Cb()),e["c3.ad.sessionStartEvent"]=SS(null),e["c3.ad.unitName"]=SS(null),e["c3.ad.dayPart"]=SS(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"]=SS(b),e["c3.ad.firstAdSystem"]=SS(c),e["c3.ad.firstCreativeId"]=SS(a));return e},SS=function(a){return a?""+a:"NA"},XS=function(a){a.f.on(a.m,_.cc,a.C.bind(a));a.f.on(a.m,_.dc,a.F.bind(a));a.f.on(a.m,_.sc,a.L.bind(a));a.f.on(a.m,_.pc,a.l.bind(a));a.f.on(a.m,_.oc,a.l.bind(a));a.f.on(a.m,_.qc,a.l.bind(a));a.f.on(a.m,_.ec,a.l.bind(a));a.f.on(a.m,_.tc,a.M.bind(a));
7
- a.f.on(a.m,_.rc,a.K.bind(a));a.f.on(a.m,_.fc,a.G.bind(a));a.f.on(a.m,_.lc,a.I.bind(a));a.f.on(a.m,_.mc,a.J.bind(a));a.f.on(a.m,_.hc,a.H.bind(a));a.f.on(a.m,_.nc,a.S.bind(a));a.f.on(a.m,_.uc,a.O.bind(a));a.f.on(a.m,_.Vd,b=>{var c=b.detail;if(10003===c.code&&(a.g.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=MS}null===a.a&&US(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
- VS(a,WS,c)}})},VS=function(a,b,c=MS){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case WS:a.a.reportAdFailed(c,TS(null,a.B,a.A));break;case YS:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},US=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=TS(b,a.B,a.A,a.m.isLive()),d=String(b.ib()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.hb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
- d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.g.error("Could not create ad analytics session",c)}}},ZS=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.g.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(PS(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
- b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.ra;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.a.setPlayerInfo(b)},$S=function(a){return a.m.getConfiguration().autoplay||!1},bT=function(a){if(!a.l)if(a.C)a.g.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.K,c=a.m.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.g.debug(a.m.getConfiguration().source);var f={},g=
11
- new _.Nl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.mj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ra;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.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.g.debug("reportMiscellaneousMetrics()");if(aT(a)){var h=1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
- h);if(h=a.m.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.g.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.hf(h.args)}));a.j=[]}},cT=function(a){if(!a.l&&a.a){const b=QS(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},aT=function(a){return null!==a.a&&a.C},dT=function(a){a.g.debug("terminateSession()");
13
- a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.O=0,a.J=!1,a.j=[],a.H=0)},eT=function(a,b){var c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.Fe;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.G(1,9,9E3),a.T(b,c)):b.namespace()===_.kd&&(a.a=!1,
14
- a.g.debug("Conviva does not report when casting.")):a.g.warn("Conviva plugin is loaded but not configured. Will do nothing.")},fT=function(a){const b=[];typeof a===_.Fe&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.G(1,9,9001,{missingKeys:b});};var hT=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.ra;this.g=new _.R("clpp.conviva.ad");this.f=new _.Bs;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.g.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.ra;XS(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ja):(_.rh(this.f),this.a&&VS(this,gT),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Dd);this.o?this.g.debug(_.ia):this.o=!0}C(){this.g.debug(NS)}F(){this.g.debug(OS)}L(a){this.g.debug("onAdStarted()");
15
- a=a.ad;this.j||(this.g.warn("Ad load event was not triggered. This will have incidence on VSF"),US(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.lb(),a.kb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Za())}l(a){this.g.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.pc:case _.qc:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.oc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.ec:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&VS(this,gT)}K(){this.g.debug("onAdSkipped()");this.a&&VS(this,YS)}G(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.g.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.g.debug("onAdLoaded()");
17
- const b=a.ad,c=()=>{this.j=!0;US(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Xf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Xf),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}S(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}O(){this.g.debug("onAdThirdQuartile()");this.a&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},YS=0,gT=1,WS=2;var iT=class{constructor(a,b){this.m=a;this.f=new _.Bs;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.O=0;this.J=!1;this.w=null;this.I=!1;this.g=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.G=!1,this.F=_.Rg(b),this.K=c,this.m=a,ZS(this,this.F),this.f.on(this.m,_.Te,this.da.bind(this)),this.f.on(this.m,_.Mf,this.Y.bind(this)),this.f.on(this.m,_.Pc,this.L.bind(this)),this.f.on(this.m,_.gg,this.X.bind(this)),this.f.on(this.m,
19
- _.fg,this.V.bind(this)),this.f.on(this.m,_.cc,this.R.bind(this)),this.f.on(this.m,_.dc,this.S.bind(this)),this.f.on(this.m,_.wc,this.Z.bind(this)),this.f.on(this.m,_.Oc,this.ba.bind(this)),this.f.on(this.m,_.Vd,this.M.bind(this)),$S(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),bT(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ja):(_.rh(this.f),aT(this)||this.o||!$S(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),aT(this)&&
20
- dT(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Dd);this.l?this.g.debug(_.ia):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.g.debug("Report app event error",d),c=!1}return c}da(){this.g.debug("onPlayRequest()");aT(this)||$S(this)?aT(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),aT(this)&&!this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.g.debug("Creating conviva session. On Play Requested / No autoplay"),
21
- bT(this))}Y(a){this.g.debug(_.Ke);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),ZS(this,this.F),bT(this),cT(this),aT(this))){var d=this.m.getTrackManager();d=d.ma()||d.jb();d.width&&d.height&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}aT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.bo:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.ao:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Un:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Rn:this.g.debug("onVideoEnded()"),aT(this)&&(this.w&&this.w.Db()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):dT(this))}}L(a){this.g.debug(_.Ge);if(aT(this)){if(a=a.detail,typeof a.width===_.r&&typeof a.height===_.r&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.a.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.a.setContentInfo(b)}}else this.j.push({hf:this.L.bind(this),args:a})}X(){this.g.debug("onSeeking()");aT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");aT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}Z(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(NS);
24
- var b=a.ad;a=0===b.Ua();const c=RS(b.getPodIndex());aT(this)||$S(this)||!a||bT(this);if(aT(this)){a=0===b.ob()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.nb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.O;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.jk()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")}S(){this.g.debug(OS);
25
- aT(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&dT(this))}M(a){this.g.debug(_.He);if(this.o&&this.I)this.g.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===_.E&&(d=Conviva.Constants.ErrorSeverity.FATAL,aT(this)||bT(this));aT(this)?(this.g.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.g.debug("Video Playback Failure"),
26
- this.I=!0,dT(this))):this.j.push({hf:this.M.bind(this),args:a})}}ba(){this.g.debug("onAutoPlayBlocked()");aT(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,aT(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var jT=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new iT(a,this.g)}onContentWillLoad(a,b){eT(this,a);if(this.a){var c=a.getConfiguration();c=_.Rg(c.conviva||{});try{fT(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new hT(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.G?this.T(a,d):this.T(a,new _.G(1,9,9002,d,d))}}}onContentLoaded(){this.a&&cT(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
- this.f=null,this.h&&(this.h.destroy(),this.h=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.h&&this.h.release())}id(){return"conviva"}T(a,b){a.trigger(new _.C(_.Vd,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",jT);jT.prototype.reportAppEvent=jT.prototype.reportAppEvent;jT.Id="conviva";_.rq(new class{create(){return new jT}});};f.call(g, window);
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},SS=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},TS=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},VS=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
+ SS(!!d);e[Conviva.Constants.ASSET_NAME]=OS;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"]=US(a.getId()),e["c3.ad.creativeId"]=US(a.getCreativeId()),e["c3.ad.system"]=US(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=US(a.getApiFramework()),e["c3.ad.advertiser"]=US(a.getAdvertiserName()),e["c3.ad.position"]=TS(a.getPodIndex()),e["c3.ad.technology"]=0===a.ob()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=US(a.hb()),e["c3.ad.adManagerVersion"]=US(a.ib()),e["c3.ad.advertiserCategory"]=US(null),e["c3.ad.advertiserId"]=US(null),e["c3.ad.breakId"]=US(null),e["c3.ad.campaignName"]=US(null),e["c3.ad.category"]=US(null),e["c3.ad.classification"]=US(null),e["c3.ad.creativeName"]=US(null),e["c3.ad.sequence"]=US(a.Cb()),e["c3.ad.sessionStartEvent"]=US(null),e["c3.ad.unitName"]=US(null),e["c3.ad.dayPart"]=US(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"]=US(b),e["c3.ad.firstAdSystem"]=US(c),e["c3.ad.firstCreativeId"]=US(a));return e},US=function(a){return a?""+a:"NA"},ZS=function(a){a.f.on(a.m,_.cc,a.C.bind(a));a.f.on(a.m,_.dc,a.F.bind(a));a.f.on(a.m,_.sc,a.L.bind(a));a.f.on(a.m,_.pc,a.l.bind(a));a.f.on(a.m,_.oc,a.l.bind(a));a.f.on(a.m,_.qc,a.l.bind(a));a.f.on(a.m,_.ec,a.l.bind(a));a.f.on(a.m,_.tc,a.M.bind(a));
7
+ a.f.on(a.m,_.rc,a.K.bind(a));a.f.on(a.m,_.fc,a.G.bind(a));a.f.on(a.m,_.lc,a.I.bind(a));a.f.on(a.m,_.mc,a.J.bind(a));a.f.on(a.m,_.hc,a.H.bind(a));a.f.on(a.m,_.nc,a.S.bind(a));a.f.on(a.m,_.uc,a.O.bind(a));a.f.on(a.m,_.Vd,b=>{var c=b.detail;if(10003===c.code&&(a.g.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=OS}null===a.a&&WS(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
+ XS(a,YS,c)}})},XS=function(a,b,c=OS){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case YS:a.a.reportAdFailed(c,VS(null,a.B,a.A));break;case $S:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},WS=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=VS(b,a.B,a.A,a.m.isLive()),d=String(b.ib()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.hb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
+ d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.g.error("Could not create ad analytics session",c)}}},aT=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.g.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(RS(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
+ b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.ra;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.a.setPlayerInfo(b)},bT=function(a){return a.m.getConfiguration().autoplay||!1},dT=function(a){if(!a.l)if(a.C)a.g.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.K,c=a.m.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.g.debug(a.m.getConfiguration().source);var f={},g=
11
+ new _.Rl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.lj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ra;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.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.g.debug("reportMiscellaneousMetrics()");if(cT(a)){var h=1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
+ h);if(h=a.m.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.g.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.hf(h.args)}));a.j=[]}},eT=function(a){if(!a.l&&a.a){const b=SS(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},cT=function(a){return null!==a.a&&a.C},fT=function(a){a.g.debug("terminateSession()");
13
+ a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.O=0,a.J=!1,a.j=[],a.H=0)},gT=function(a,b){var c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.Fe;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.G(1,9,9E3),a.T(b,c)):b.namespace()===_.kd&&(a.a=!1,
14
+ a.g.debug("Conviva does not report when casting.")):a.g.warn("Conviva plugin is loaded but not configured. Will do nothing.")},hT=function(a){const b=[];typeof a===_.Fe&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.G(1,9,9001,{missingKeys:b});};var jT=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.ra;this.g=new _.R("clpp.conviva.ad");this.f=new _.Fs;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.g.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.ra;ZS(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ja):(_.nh(this.f),this.a&&XS(this,iT),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Dd);this.o?this.g.debug(_.ia):this.o=!0}C(){this.g.debug(PS)}F(){this.g.debug(QS)}L(a){this.g.debug("onAdStarted()");
15
+ a=a.ad;this.j||(this.g.warn("Ad load event was not triggered. This will have incidence on VSF"),WS(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.lb(),a.kb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Za())}l(a){this.g.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.pc:case _.qc:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.oc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.ec:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&XS(this,iT)}K(){this.g.debug("onAdSkipped()");this.a&&XS(this,$S)}G(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.g.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.g.debug("onAdLoaded()");
17
+ const b=a.ad,c=()=>{this.j=!0;WS(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Xf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Xf),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}S(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}O(){this.g.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},$S=0,iT=1,YS=2;var kT=class{constructor(a,b){this.m=a;this.f=new _.Fs;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.O=0;this.J=!1;this.w=null;this.I=!1;this.g=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.G=!1,this.F=_.Rg(b),this.K=c,this.m=a,aT(this,this.F),this.f.on(this.m,_.Te,this.da.bind(this)),this.f.on(this.m,_.Mf,this.Y.bind(this)),this.f.on(this.m,_.Pc,this.L.bind(this)),this.f.on(this.m,_.gg,this.X.bind(this)),this.f.on(this.m,
19
+ _.fg,this.V.bind(this)),this.f.on(this.m,_.cc,this.R.bind(this)),this.f.on(this.m,_.dc,this.S.bind(this)),this.f.on(this.m,_.wc,this.Z.bind(this)),this.f.on(this.m,_.Oc,this.ba.bind(this)),this.f.on(this.m,_.Vd,this.M.bind(this)),bT(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),dT(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ja):(_.nh(this.f),cT(this)||this.o||!bT(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),cT(this)&&
20
+ fT(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Dd);this.l?this.g.debug(_.ia):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.g.debug("Report app event error",d),c=!1}return c}da(){this.g.debug("onPlayRequest()");cT(this)||bT(this)?cT(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),cT(this)&&!this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.g.debug("Creating conviva session. On Play Requested / No autoplay"),
21
+ dT(this))}Y(a){this.g.debug(_.Ke);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),aT(this,this.F),dT(this),eT(this),cT(this))){var d=this.m.getTrackManager();d=d.ma()||d.jb();d.width&&d.height&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}cT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.go:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.fo:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Yn:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Vn:this.g.debug("onVideoEnded()"),cT(this)&&(this.w&&this.w.Db()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):fT(this))}}L(a){this.g.debug(_.Ge);if(cT(this)){if(a=a.detail,typeof a.width===_.r&&typeof a.height===_.r&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.a.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.a.setContentInfo(b)}}else this.j.push({hf:this.L.bind(this),args:a})}X(){this.g.debug("onSeeking()");cT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");cT(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}Z(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(PS);
24
+ var b=a.ad;a=0===b.Ua();const c=TS(b.getPodIndex());cT(this)||bT(this)||!a||dT(this);if(cT(this)){a=0===b.ob()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.nb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.O;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.jk()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")}S(){this.g.debug(QS);
25
+ cT(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&fT(this))}M(a){this.g.debug(_.He);if(this.o&&this.I)this.g.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===_.E&&(d=Conviva.Constants.ErrorSeverity.FATAL,cT(this)||dT(this));cT(this)?(this.g.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.g.debug("Video Playback Failure"),
26
+ this.I=!0,fT(this))):this.j.push({hf:this.M.bind(this),args:a})}}ba(){this.g.debug("onAutoPlayBlocked()");cT(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,cT(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var lT=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new kT(a,this.g)}onContentWillLoad(a,b){gT(this,a);if(this.a){var c=a.getConfiguration();c=_.Rg(c.conviva||{});try{hT(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new jT(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.G?this.T(a,d):this.T(a,new _.G(1,9,9002,d,d))}}}onContentLoaded(){this.a&&eT(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
+ this.f=null,this.h&&(this.h.destroy(),this.h=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.h&&this.h.release())}id(){return"conviva"}T(a,b){a.trigger(new _.C(_.Vd,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",lT);lT.prototype.reportAppEvent=lT.prototype.reportAppEvent;lT.Id="conviva";_.jr(new class{create(){return new lT}});};f.call(g, window);