@castlabs/prestoplay 6.15.0 → 6.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +13 -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 +114 -114
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +546 -544
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +74 -74
  10. package/cjs/cl.externs.js +57 -55
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +368 -289
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +72 -72
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +71 -71
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +20 -20
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +89 -89
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +452 -452
  37. package/cl.crypto.js +9 -9
  38. package/cl.dash.js +69 -69
  39. package/cl.externs.js +57 -55
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -71
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +26 -26
  44. package/cl.ima.js +17 -17
  45. package/cl.mse.js +318 -255
  46. package/cl.muxdata.js +13 -13
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +11 -11
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +15 -15
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/package.json +1 -1
  61. package/typings.d.ts +46 -0
package/cl.cast.js CHANGED
@@ -1,89 +1,89 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var KQ="Cannot seek during ads playout.",LQ="Cannot switch track",MQ="Media session does not exist.",NQ="No receivers available",OQ="Reset ABR functionality not available on cast.",PQ="SDK not yet ready",QQ="Sender is destroyed.",RQ="clpp.cast.CastProxy",SQ="clpp.cast.Player",TQ="clpp.cast.Receiver",VQ="urn:x-cast:castlabs",WQ="urn:x-cast:com.google.cast.media",XQ=function(a){return _.w(function*(){yield _.Yo(a,_.He);yield _.Yo(a,_.Ge)})},YQ=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.Yd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.De?"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}})},ZQ=function(a){if(typeof a!==_.Lf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},$Q=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=_.zj(d,a.mimeType,g);f&&g&&(h=_.Ni(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.I(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},aR=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 _.kg:return d.FMP4;case _.jg:return b===_.L?d.MPEG2_TS:c.TS;case _.Gc:return c.AAC;case _.Hc:return c.AC3;case _.Lc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Mc:return c.FMP4}},cR=function(a){a=void 0===a?bR: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}},dR=function(a,b){return a.g.filter(c=>c.type===b)},fR=function(a,b){const c=eR(a);return dR(a,b).find(d=>c.includes(d.id))||null},hR=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.J){const e=a.oa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
- d.editTracksInfo(c,()=>{a.f[b]=null;gR(a,b)},e=>{a.f[b]=null;a.h.debug(LQ,e)})}else b===_.J&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{gR(a,b)},e=>{a.h.debug(LQ,e)}))},eR=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},gR=function(a,b){b===_.K?a.a.trigger(new _.C(_.Dk)):b===_.J&&a.a.trigger(new _.C(_.Ek))},kR=function(a){if(a)for(const b of iR)jR(b)},jR=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
- cast.framework&&cast.framework.CastContext&&a.U.length){a.w=!0;a.o.Ee();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.U;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa);lR&&a.o.da(.02)}},mR=function(a){return _.w(function*(){iR.delete(a);if(a.w){a.w=!1;var b=
8
- cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.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.T=null;a.X=null})},nR=function(a){return _.w(function*(){a.mb()||(yield cast.framework.CastContext.getInstance().requestSession())})},pR=function(a,b,c){c=
9
- void 0===c?0:c;return _.w(function*(){var d=a.f.oa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.ja())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield oR(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),re:a.getPresentationStartTime(),autoplay:b,Oa:a.g})})},oR=function(a,b){return _.w(function*(){var c=chrome.cast.media.StreamType;yield nR(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=aR(b.Db,_.L);e.hlsSegmentFormat=aR(c,_.K);b.Oa&&(a.L&&(c=yield Promise.resolve(a.L(b.Oa)))&&(b.Oa=c),a.g=b.Oa,a.C=_.Wn(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Oa.remoteTextTracks&&(c=yield Promise.all(b.Oa.remoteTextTracks.map(a.Fa.bind(a))),e.tracks=c.filter(k=>k),b.Oa.remoteTextTracks=void 0),delete b.Oa.autoplay,b.Oa.startTime=null,e.customData={playerConfiguration:YQ(b.Oa)});c=a.gb()||{};
11
- var f=qR(c.metadataType),g;typeof b.re===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.re});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=rR(c);if(g=sR(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)}})},sR=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(tR);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=cR(tR[b]);return Object.assign(b,a)},qR=function(a){var b=void 0===b?bR:b;return Object.values(tR).includes(a)?a:b},rR=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},vR=function(a,b){uR(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(VQ,a.R)},wR=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},uR=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.ha.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.C(_.qe)))},zR=function(a){return new xR(a.g,()=>{a.trigger(new _.C(_.Xc))},(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.Re&&(d.preferredAudioLanguage=c.Re);c.If&&(d.preferredTextLanguage=c.If);_.$o(a.f,null);a.trigger(new _.C("castingended"));a.j(b,d)}},()=>yR(a))},yR=function(a){return _.w(function*(){a.trigger(new _.C(_.Wc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.$o(a.f,a.a))})},CR=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{AR=!1;const e=_.Ni(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.ji(f.data),h=(new DOMParser).parseFromString(g,
15
- _.Rf);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=BR(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=BR(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),AR=!0}}catch(e){_.B("Failed to fetch an ad",e),AR=!0}})},BR=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
- a;return b},DR=function(a,b){b=new _.G(1,10,10003,{errorType:b});a.m.onError(b)},ER=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},GR=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=FR(a,c))&&(d={ad:c});a.m.trigger(new _.C(b,d))}},FR=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Lf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
- _.Lf&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Y(d,e,b.index,b.total,f)}return c},HR=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]},IR=function(a){const b=
18
- a.dashTimedMetadata;let c=_.dg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.cg)?_.oh:_.mh,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},JR=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},LR=function(a){a.a=JR().getTextTracksManager();const b=a.a.getTracks();a.j=KR(_.J,b)},KR=function(a,b){const c=[];for(const d of b)b=new _.ej(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 _.mj(b.id,b)),c.push(b);return c},MR=function(a,b,c,d){c=_.xh(c).filter(g=>g);var e=!1;let f=[];b===_.K?f=a.getAudioTracks():b===_.J&&(f=a.ga());if(c=c.find(g=>{const h=_.Xh(g);return f.some(k=>{k=_.Xh(k.language||"");return _.Yh(h,k)})})){const g=
20
- _.Xh(c);c=f.filter(h=>{h=_.Xh(h.language||"");return _.Yh(g,h)});f=c.length?c:f;e=e||!!c.length}_.si(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.h.info("Will select track",e),b===_.K?a.ra(e):b===_.J&&a.Ea(e))},NR=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},QR=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=_.kl(d);if(e){var f=[_.wd];_.Wn(a)[0].type!==_.Dc&&f.unshift(_.yd);d.preferredDrmSystem===_.wd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Qa[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:{}},OR(b,h,a,c),PR(b,h,a,c)):c()}else c()}else c()},OR=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
- _.Ni({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},PR=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.Oi(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.I(g.data)}):
23
- a.licenseHandler=void 0},TR=function(){return RR||(RR=new SR)},UR=function(){return cast.framework.CastReceiverContext.getInstance()},WR=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=UR();var {hlsVideoSegmentFormat:d}=UR().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.kg:_.jg;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=
24
- VR(f,_.pa),h=VR(f,_.Ab);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")},VR=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},ZR=function(a,b){let c=null;const d=YR(a);d&&(c={ad:d});a.f.trigger(new _.C(b,c))},YR=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
- let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Y(d,c,g,e,f)}return b},$R=class{constructor(a,b){this.log=new _.Q(b);this.player=a;this.l=null;this.g=_.Qn;this.o=_.ht;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Qn)}destroy(){this.l=
26
- this.player=null;return Promise.resolve()}getState(){return this.g}onError(a){a.severity===_.E&&this.a(_.Pn)}a(a){if(a!==this.g)if(this.g===_.Pn&&a!==_.Qn)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.g;this.g=a;this.g===_.Ln?(this.B=b,this.player.trigger(new _.C(_.Tc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Ln&&this.player.trigger(new _.C(_.Sc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.g,previousState:this.o,
27
- timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.zn(this.l,this.g);this.player.trigger(new _.C(_.If,{detail:a}))}}};_.x("clpp.cast.CastUtils",class{});var bR=0,tR={GENERIC:bR,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var aS=class extends $R{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Ab.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)}Ab(){if(this.f&&
28
- this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.In);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Pn);break;default:this.a(_.Qn)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Tn);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Sn);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Ln)}}};var Z=class extends _.R{constructor(){super();this.h=new _.Q("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.L;break;case chrome.cast.media.TrackType.AUDIO:c=_.K;break;case chrome.cast.media.TrackType.TEXT:c=_.J}c=new _.ej(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
- c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.mj(c.id,c));return c}):[],this.a.trigger(new _.C(_.Ls)))}destroy(){this.a=null}getVideoTracks(){return dR(this,_.L)}getAudioTracks(){return dR(this,_.K)}ga(){return dR(this,_.J)}ka(){const a=this.Ca();return a?a.renditions[0]:null}Ia(){const a=this.ja();return a?a.renditions[0]:null}Ba(){const a=this.oa();return a?a.renditions[0]:
30
- null}Ua(){return this.f[_.L]||null}hb(){return this.f[_.K]||null}ib(){return this.f[_.J]||null}Ca(){return fR(this,_.L)}ja(){return fR(this,_.K)}oa(){return fR(this,_.J)}$a(a){hR(this,_.L,a)}ra(a){hR(this,_.K,a)}Ea(a){hR(this,_.J,a)}Pa(a){this.$a(a&&a.track)}Ya(a){this.ra(a&&a.track)}Za(a){this.Ea(a&&a.track)}addTextTrack(){return _.w(function*(){})}ma(){return!0}};Z.prototype.isAbrEnabled=Z.prototype.ma;Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.Za;
31
- Z.prototype.setAudioRendition=Z.prototype.Ya;Z.prototype.setVideoRendition=Z.prototype.Pa;Z.prototype.setTextTrack=Z.prototype.Ea;Z.prototype.setAudioTrack=Z.prototype.ra;Z.prototype.setVideoTrack=Z.prototype.$a;Z.prototype.getTextTrack=Z.prototype.oa;Z.prototype.getAudioTrack=Z.prototype.ja;Z.prototype.getVideoTrack=Z.prototype.Ca;Z.prototype.getLoadingTextRendition=Z.prototype.ib;Z.prototype.getLoadingAudioRendition=Z.prototype.hb;Z.prototype.getLoadingVideoRendition=Z.prototype.Ua;
32
- Z.prototype.getTextRendition=Z.prototype.Ba;Z.prototype.getAudioRendition=Z.prototype.Ia;Z.prototype.getVideoRendition=Z.prototype.ka;Z.prototype.getTextTracks=Z.prototype.ga;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var xR=class extends _.Ns{constructor(a,b,c,d){super();this.h=new _.Q(_.kd);this.U=a;this.o=new _.Nj(b);this.T=c;this.X=d;this.g=this.I=_.Ok();this.C=[];this.B=0;this.K=new _.So;this.G=this.l=this.a=null;this.A=this.w=!1;this.$="";this.ea=1E6;this.f=new Z;this.f.initialize(this);this.j=new aS(this);this.H=new _.as;this.J=null;this.F=new Set;this.N=this.bb.bind(this);this.aa=this.fb.bind(this);this.W=this.eb.bind(this);this.R=this.cb.bind(this);this.L=null;window.cast||Object.defineProperty(window,
33
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{kR(!0)},0)}});jR(this);iR.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}destroy(){return _.w(function*(){})}gd(a){this.L=
34
- a}ec(){return this.w}mb(){return this.A}$d(){return this.$}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,YQ(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.ec())throw a.h.warn(PQ),new _.G(1,8,8001,void 0);if(!lR)throw a.h.warn(NQ),new _.G(1,8,8002,void 0);if(a.mb())throw a.h.warn("Already casting"),
35
- new _.G(1,8,8003,void 0);try{yield nR(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);}})}Xd(){this.mb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Yd&&this.F.add(a)}removeMessageListener(a){typeof a===_.Yd&&this.F.delete(a)}play(){return this.isEnded()?pR(this,!0):new Promise((a,b)=>{if(!this.a)return b(MQ);this.a.play(null,
36
- a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(MQ);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.In}seek(a){return this.isEnded()?pR(this,!1,a):new Promise((b,c)=>{this.a||c(MQ);this.l.isPlayingBreak&&c(KQ);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.C(_.fg));this.a.seek(d,()=>{this.trigger(new _.C(_.eg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
37
- 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(WQ,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
38
- 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=
39
- {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():_.ht}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?ZQ(this.a.customData.stats):_.Dn()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.w(function*(){if(b.ec())if(lR){b.C=_.Wn(a);b.g=_.Qk(b.I,a);var c=b.C[b.B];yield oR(b,{source:c,
40
- isLive:c.isLive,autoplay:b.g.autoplay,Oa:b.g,Db:c.Db,audioMimeType:c.audioMimeType})}else b.h.warn(NQ);else b.h.warn(PQ)})}getBufferInfo(){return new _.Ms}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.h.warn(OQ)}onError(a){if(a&&
41
- (this.trigger(new _.C(_.Vd,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.kd}canPlay(){return this.ec()?2:0}gb(){return this.J}kc(a){this.J=sR(a)}Sd(){this.J=null}ze(a){const b=this.gb()||{};a={metadataType:qR(b.metadataType),title:a};this.kc(Object.assign({},b,a))}xe(a){const b=this.gb()||{},c=qR(b.metadataType);a=new chrome.cast.Image(a);this.kc(Object.assign({},b,{metadataType:c,images:[a]}))}we(a){const b=this.gb()||{};this.kc(Object.assign({},b,{metadataType:3,artist:a}))}ye(a){const b=
42
- this.gb()||{};a={metadataType:qR(b.metadataType),releaseDate:a};this.kc(Object.assign({},b,a))}bb(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;lR=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.$=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Ee()}fb(a){this.h.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;vR(this,a.session);break;
43
- case cast.framework.SessionState.SESSION_RESUMED:this.mb()||(this.A=!0,vR(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.mb()&&this.a){const d=this.a.media;var b=this.f.ja(),c=this.f.oa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.T(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:wR(this),If:c,Re:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(VQ,
44
- this.R);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}eb(a){this.h.debug("New media session",a.mediaSession);uR(this,a.mediaSession)}cb(a,b){if(a===VQ&&0<this.F.size){const c=ZQ(b);this.F.forEach(d=>d(c))}}ha(){this.trigger(new _.C(_.Sf))}Fa(a){const b=this;return _.w(function*(){let c=null;const d=yield $Q(a,[_.Qf,_.Cc],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ea++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
45
- d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};xR.prototype.getTextDisplayer=xR.prototype.getTextDisplayer;xR.prototype.getNetworkEngine=xR.prototype.getNetworkEngine;xR.prototype.setNetworkEngine=xR.prototype.setNetworkEngine;var lR=!1,iR=new Set;window.__onGCastApiAvailable=kR;var bS=class extends _.Ns{constructor(a,b,c){super();this.f=a;this.g=b;this.j=typeof c===_.Yd?c:(d,e)=>{this.f&&d!==_.In&&d!==_.Qn&&this.f.load(e)};this.a=zR(this);this.h=new _.Q(RQ);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield mR(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}Pd(){return!!this.a&&this.a.ec()&&lR}mb(){return!!this.a&&this.a.mb()}$d(){return this.a?this.a.$d():""}gd(a){this.a&&this.a.gd(a)}cast(a){const b=this;return _.w(function*(){if(b.a)try{if(yield b.a.cast(),
46
- 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.ja();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.oa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.Rc?e.isLive:b.f.isLive();d={source:e,
47
- isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),re:b.f.getPresentationStartTime(),Db:h,audioMimeType:k,Oa:l}}var c=d}yield yR(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield oR(b.a,c)))}}catch(d){b.h.error("Error while trying to cast",d),c=new _.C(_.Vd,{detail:d}),b.trigger(c)}})}Xd(){this.a&&this.a.Xd()}ig(a){const b=this;return _.w(function*(){a!==b.g&&(b.g=a,b.a&&(yield mR(b.a)),b.a=zR(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?
48
- yield b.a.sendMessage(VQ,a):b.h.warn(QQ)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.h.warn(QQ)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.h.warn(QQ)}gb(){return this.a&&this.a.gb()}kc(a){this.a&&this.a.kc(a)}Sd(){this.a&&this.a.Sd()}ze(a){this.a&&this.a.ze(a)}xe(a){this.a&&this.a.xe(a)}we(a){this.a&&this.a.we(a)}ye(a){this.a&&this.a.ye(a)}};_.x(RQ,bS);bS.prototype.setContentReleaseDate=bS.prototype.ye;bS.prototype.setContentArtist=bS.prototype.we;
49
- bS.prototype.setContentImage=bS.prototype.xe;bS.prototype.setContentTitle=bS.prototype.ze;bS.prototype.clearContentMetadata=bS.prototype.Sd;bS.prototype.setContentMetadata=bS.prototype.kc;bS.prototype.getContentMetadata=bS.prototype.gb;bS.prototype.removeMessageListener=bS.prototype.removeMessageListener;bS.prototype.addMessageListener=bS.prototype.addMessageListener;bS.prototype.sendMessage=bS.prototype.sendMessage;bS.prototype.changeReceiverId=bS.prototype.ig;bS.prototype.forceDisconnect=bS.prototype.Xd;
50
- bS.prototype.cast=bS.prototype.cast;bS.prototype.setPlayerConfigInterceptor=bS.prototype.gd;bS.prototype.getReceiverName=bS.prototype.$d;bS.prototype.isCasting=bS.prototype.mb;bS.prototype.canCast=bS.prototype.Pd;bS.prototype.destroy=bS.prototype.destroy;var cS=class extends $R{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.T.bind(this);this.H=this.R.bind(this);this.A=this.$.bind(this);this.w=this.X.bind(this);this.K=this.W.bind(this);this.J=this.U.bind(this);this.L=this.ea.bind(this);this.G=this.aa.bind(this);this.F=this.V.bind(this);this.f=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
51
- 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();
52
- 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)})}T(){this.player.trigger(new _.C(_.Re));this.a(_.Tn)}R(){this.a(_.Sn)}$(){this.a(_.In)}X(a){a.isBuffering?
53
- this.a(_.Ln):(a=this.player.isPaused()?_.Sn:_.Tn,this.a(a))}W(){this.j=1;this.player.trigger(new _.C(_.fg))}U(){this.player.trigger(new _.C(_.eg))}ea(){this.j=2}aa(){this.a(_.Rn)}N(a){const b=this.player.getStats();this.player.trigger(new _.C(_.Qc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}V(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(_.Pn)}};var Y=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.j=typeof c===_.r?c:1;this.l=typeof d===_.r?d:1;this.g=typeof e===_.r?e:0}rb(){return"Google Cast Framework"}sb(){return cast.framework.VERSION}yb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}gc(){return!1}Lb(){return this.a.clickThroughUrl||
54
- null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}vb(){return 0}ub(){return 0}jb(){return 0}Va(){switch(this.Mb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Mb(){return this.f.position}Nb(){return this.j}xb(){return this.l}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;
55
- Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.xb;Y.prototype.getPositionInSequence=Y.prototype.Nb;Y.prototype.getPodTimeOffset=Y.prototype.Mb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Va;Y.prototype.getMediaBitrate=Y.prototype.jb;Y.prototype.getMediaHeight=Y.prototype.ub;Y.prototype.getMediaWidth=Y.prototype.vb;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Lb;
56
- Y.prototype.isBumper=Y.prototype.gc;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;Y.prototype.getApiFramework=Y.prototype.getApiFramework;Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.yb;
57
- Y.prototype.getAdManagerVersion=Y.prototype.sb;Y.prototype.getAdManagerName=Y.prototype.rb;var dS=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Ob(){return!!this.a.find(a=>0===a.position)}lb(){return!!this.a.find(a=>-1===a.position)}};dS.prototype.hasPostroll=dS.prototype.lb;dS.prototype.hasPreroll=dS.prototype.Ob;dS.prototype.getCuePoints=dS.prototype.getCuePoints;var eS=class{constructor(a){this.m=a;this.a=null;this.g=this.j.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];ER().addEventListener(this.f,
58
- this.g)}load(){const a=this;return _.w(function*(){AR&&(AR=!1,DR(a,0))})}start(){return _.w(function*(){ER().play()})}resume(){-1!==this.getPosition()&&ER().play()}pause(){-1!==this.getPosition()&&ER().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}dispose(){const a=this;return _.w(function*(){ER().removeEventListener(a.f,a.g)})}j(a){const b=cast.framework.events.EndedReason;
59
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=ER().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.C(_.tc,{adsTimeline:new dS(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:GR(this,_.jc,a);break;case cast.framework.events.EventType.BREAK_STARTED:GR(this,_.bc,a);break;case cast.framework.events.EventType.BREAK_ENDED:GR(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:GR(this,_.pc,a);
60
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(GR(this,_.oc,a),GR(this,_.qc,a)):a.endedReason===b.STOPPED?GR(this,_.qc,a):a.endedReason===b.END_OF_STREAM?(GR(this,_.gc,a),GR(this,_.qc,a)):a.endedReason===b.ERROR&&DR(this,1);break;case cast.framework.events.EventType.PLAYING:GR(this,_.nc,a);break;case cast.framework.events.EventType.PAUSE:GR(this,_.lc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?GR(this,_.ec,a):GR(this,_.nc,a)}}};
61
- eS.prototype.getPosition=eS.prototype.getPosition;eS.prototype.setVolume=eS.prototype.setVolume;eS.prototype.getVolume=eS.prototype.getVolume;eS.prototype.skip=eS.prototype.skip;eS.prototype.pause=eS.prototype.pause;eS.prototype.resume=eS.prototype.resume;var AR=!1;var fS=class{constructor(a){this.Ub=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(HR(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(HR(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>IR(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=
62
- _.ph;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.rh;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.sh}b&&this.Ub(new _.C(b,{detail:IR(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Ub(new _.C(_.ph,{detail:b}))}};var gS=class extends _.R{constructor(){super();this.h=new _.Q("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.g=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;JR().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.g=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;JR().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.g}ga(){return this.j}ka(){return null}Ia(){const a=
63
- this.ja();return a&&a.renditions[0]}Ba(){const a=this.oa();return a&&a.renditions[0]}Ua(){return null}hb(){return null}ib(){return null}Ca(){return null}ja(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.r&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}oa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ga().find(c=>c.id===b)||null)}return a}$a(){this.h.warn("Video tracks unavailable on Cast")}ra(a){a&&this.f&&
64
- this.f.setActiveById(+a.id)}Ea(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Pa(){this.h.warn("Video renditions unavailable on Cast")}Ya(a){this.ra(a&&a.track)}Za(a){this.Ea(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.m.getConfiguration();if((c=yield $Q(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=
65
- 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]),LR(b)}catch(e){throw b.h.warn("failed on track",a),e;}}})}ma(){return!0}w(){this.f=JR().getAudioTracksManager();var a=this.f.getTracks();this.g=KR(_.K,a);LR(this);a=this.m.getConfiguration();MR(this,_.K,a.preferredAudioLanguage,a.preferredAudioRole);MR(this,_.J,a.preferredTextLanguage,a.preferredTextRole)}};gS.prototype.isAbrEnabled=gS.prototype.ma;
66
- gS.prototype.addTextTrack=gS.prototype.addTextTrack;gS.prototype.setTextRendition=gS.prototype.Za;gS.prototype.setAudioRendition=gS.prototype.Ya;gS.prototype.setVideoRendition=gS.prototype.Pa;gS.prototype.setTextTrack=gS.prototype.Ea;gS.prototype.setAudioTrack=gS.prototype.ra;gS.prototype.setVideoTrack=gS.prototype.$a;gS.prototype.getTextTrack=gS.prototype.oa;gS.prototype.getAudioTrack=gS.prototype.ja;gS.prototype.getVideoTrack=gS.prototype.Ca;gS.prototype.getLoadingTextRendition=gS.prototype.ib;
67
- gS.prototype.getLoadingAudioRendition=gS.prototype.hb;gS.prototype.getLoadingVideoRendition=gS.prototype.Ua;gS.prototype.getTextRendition=gS.prototype.Ba;gS.prototype.getAudioRendition=gS.prototype.Ia;gS.prototype.getVideoRendition=gS.prototype.ka;gS.prototype.getTextTracks=gS.prototype.ga;gS.prototype.getAudioTracks=gS.prototype.getAudioTracks;gS.prototype.getVideoTracks=gS.prototype.getVideoTracks;var hS=class extends _.Ns{constructor(){super();this.h=new _.Q(SQ);this.g=this.w=_.Ok();this.A=null;this.l=-1;this.F=new _.So;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.w=b);a=NR();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new cS(this);this.a.init();this.j=new gS;this.j.initialize(this);this.o=new fS(c=>this.trigger(c));this.o.init()}unload(){const a=
68
- cast.framework.messages.PlayerState,b=NR();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=_.Ok();a.g=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=NR();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
69
- a.play();return Promise.resolve()}pause(){const a=NR();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return NR().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return NR().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=NR();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(KQ);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}getMediaPosition(){return NR().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
70
- NR().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return NR().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;NR().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||
71
- null}getLoadedSource(){const a=NR().getMediaInformation();if(a){var b=NR().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,Kh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return NR().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=NR().getLiveSeekableRange();
72
- 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():_.ht}getStats(){var a=_.Dn();if(this.f){a=NR().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.o=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.w=a.width||NaN;b.g=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
73
- this;return _.w(function*(){b.f=new _.ft;b.a.l=b.f.a;b.A=_.Wn(a);b.g=_.Qk(b.w,a);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.r&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:YQ(b.g),local:!0};yield NR().load(d)}})}getBufferInfo(){this.h.warn(_.qa);return new _.Ms}getTrackManager(){return this.j}getConfiguration(){return this.g}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}setNetworkEngine(a){this.F=
74
- a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return SQ}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.h.warn(OQ)}onError(a){a=new _.C(_.Vd,{detail:a});this.trigger(a)}canPlay(){return _.ak()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=YQ(this.getStats());var b=NR(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==
75
- b&&(this.h.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=NR().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
76
- a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=ZQ(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;QR(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};hS.prototype.getTextDisplayer=hS.prototype.getTextDisplayer;hS.prototype.getNetworkEngine=hS.prototype.getNetworkEngine;
77
- hS.prototype.setNetworkEngine=hS.prototype.setNetworkEngine;var SR=class{constructor(){this.a=!1;this.h=new _.Q(TQ);this.f=this.m=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.as;this.l=null}init(a){a&&(this.f=new hS,_.$o(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.w(function*(){b.m&&b.m.getState()!==_.Qn&&(yield XQ(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=UR(),b=UR().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
78
- c.customNamespaces={};c.customNamespaces[VQ]=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,
79
- this.A);a.start(c);a.addCustomMessageListener(VQ,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=UR();UR().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(VQ,this.w);a.stop();this.m=this.f=null}}gd(a){this.j=a}lh(a){this.l=a}on(a,b){UR().addEventListener(a,b)}off(a,b){UR().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Yd&&this.g.add(a)}removeMessageListener(a){typeof a===_.Yd&&this.g.delete(a)}sendMessage(a,
80
- b){UR().sendCustomMessage(VQ,b,YQ(a))}ec(){return this.a}gb(){var a;return a=(a=UR().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return WR(this,a);try{var b=(new DOMParser).parseFromString(a,_.Rf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=UR();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ha);for(var f=e.length-
81
- 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.t||g===_.p){g=e[f].getAttribute(_.xe);var h=e[f].getElementsByTagName(_.Bb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.xe)||g,m=h[k].getAttribute(_.rd);let n=h[k].getAttribute(_.xg)||void 0,q=h[k].getAttribute(_.Zd)||void 0;void 0!==n&&(n=+n);void 0!==q&&(q=+q);b.canDisplayType(l,m,n,q)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.Bb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ha).length||a.removeChild(c[d])}return a=
82
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Ib)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=UR();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.t){e=c[d].getElementsByTagName(_.zb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.gb)||void 0,h=e[f].getAttribute(_.fb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.kg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.zb).length||a.removeChild(c[d])}a=
83
- (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=ZQ(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield CR(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 _.jp(b.m,d),yield _.kp(b.m),d=b.m.getLoadedSource(),c.media.contentId=
84
- d.url,c.media.contentType=d.type,d.Db&&(c.media.hlsVideoSegmentFormat=aR(d.Db,_.L)),d.audioMimeType&&(c.media.hlsSegmentFormat=aR(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=UR().getPlayerManager(),
85
- 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))}_.mp(this.m)}}B(a){if(0<this.g.size){const b=ZQ(a.data);this.g.forEach(c=>c(b))}}};_.x(TQ,SR);SR.prototype.getContentMetadata=SR.prototype.gb;SR.prototype.isApiReady=SR.prototype.ec;SR.prototype.sendMessage=SR.prototype.sendMessage;SR.prototype.removeMessageListener=SR.prototype.removeMessageListener;
86
- SR.prototype.addMessageListener=SR.prototype.addMessageListener;SR.prototype.off=SR.prototype.off;SR.prototype.on=SR.prototype.on;SR.prototype.setLoadRequestDataInterceptor=SR.prototype.lh;SR.prototype.setPlayerConfigInterceptor=SR.prototype.gd;SR.prototype.stop=SR.prototype.stop;SR.prototype.start=SR.prototype.start;SR.prototype.init=SR.prototype.init;SR.getInstance=TR;var RR=null;var iS=class{constructor(a){this.f=a;this.a=null;this.g=new _.as;this.j=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.w(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.l.bind(a);for(const d of a.j)a.g.on(b,d,c)}})}start(){return _.w(function*(){})}resume(){this.a&&
87
- 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(WQ,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.r&&(a=b));return a}dispose(){const a=this;
88
- return _.w(function*(){a.g.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.C(_.tc,{adsTimeline:new dS(a.breaks)})));break;case "isPlayingBreak":a.value?ZR(this,_.bc):(ZR(this,_.gc),ZR(this,_.qc),ZR(this,_.cc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(ZR(this,_.gc),ZR(this,_.qc)),ZR(this,_.pc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?ZR(this,_.lc):ZR(this,_.nc))}}};iS.prototype.getPosition=iS.prototype.getPosition;
89
- iS.prototype.setVolume=iS.prototype.setVolume;iS.prototype.getVolume=iS.prototype.getVolume;iS.prototype.skip=iS.prototype.skip;iS.prototype.pause=iS.prototype.pause;iS.prototype.resume=iS.prototype.resume;var jS=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}isSupported(a,b){return a.namespace()!==_.kd?!1:!(!b||!b.ima)}create(a){return new iS(a.a)}};jS.prototype.create=jS.prototype.create;jS.prototype.isSupported=jS.prototype.isSupported;jS.prototype.name=jS.prototype.name;_.lo(new jS);var kS=class{name(){return"clpp.cast.ads.AdsManagerFactory"}isSupported(a,b){return TR().ec()?!(!b||!b.ima):!1}create(a){return new eS(a)}};kS.prototype.create=kS.prototype.create;kS.prototype.isSupported=kS.prototype.isSupported;kS.prototype.name=kS.prototype.name;_.lo(new kS);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var tU="Cannot seek during ads playout.",uU="Cannot switch track",vU="Media session does not exist.",wU="No receivers available",xU="Reset ABR functionality not available on cast.",yU="SDK not yet ready",zU="Sender is destroyed.",AU="clpp.cast.CastProxy",BU="clpp.cast.Player",CU="clpp.cast.Receiver",DU="urn:x-cast:castlabs",FU="urn:x-cast:com.google.cast.media",GU=function(a){return _.x(function*(){yield _.Zo(a,_.Ge);yield _.Zo(a,_.Fe)})},HU=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.Xd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Ce?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.t?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},IU=function(a){if(typeof a!==_.Mf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},JU=function(a,b,c,d){return _.x(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
3
+ null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Aj(d,a.mimeType,g);f&&g&&(h=_.Oi(a.url),(h=yield c.fetch(h).O)&&h.data&&(e=f.a(_.J(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},KU=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 _.gg:return d.FMP4;case _.fg:return b===_.M?d.MPEG2_TS:c.TS;case _.Fc:return c.AAC;case _.Gc:return c.AC3;case _.Hc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Ic:return c.FMP4}},MU=function(a){a=void 0===a?LU:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.H(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
5
+ b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},NU=function(a,b){return a.h.filter(c=>c.type===b)},PU=function(a,b){const c=OU(a);return NU(a,b).find(d=>c.includes(d.id))||null},RU=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.K){const e=a.za();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;QU(a,b)},e=>{a.f[b]=null;a.g.debug(uU,e)})}else b===_.K&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{QU(a,b)},e=>{a.g.debug(uU,e)}))},OU=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},QU=function(a,b){b===_.L?a.a.trigger(new _.D(_.Fk)):b===_.K&&a.a.trigger(new _.D(_.Gk))},UU=function(a){if(a)for(const b of SU)TU(b)},TU=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
+ cast.framework&&cast.framework.CastContext&&a.T.length){a.w=!0;a.o.Me();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.T;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa);VU&&a.o.ia(.02)}},WU=function(a){return _.x(function*(){SU.delete(a);if(a.w){a.w=!1;var b=
8
+ cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.S=null;a.Y=null})},XU=function(a){return _.x(function*(){a.Bb()||(yield cast.framework.CastContext.getInstance().requestSession())})},ZU=function(a,b,c){c=
9
+ void 0===c?0:c;return _.x(function*(){var d=a.f.za();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.na())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield YU(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Ae:a.getPresentationStartTime(),autoplay:b,fb:a.h})})},YU=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield XU(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=KU(b.Ob,_.M);e.hlsSegmentFormat=KU(c,_.L);b.fb&&(a.M&&(c=yield Promise.resolve(a.M(b.fb)))&&(b.fb=c),a.h=b.fb,a.D=_.Xn(a.h),a.C=a.D.findIndex(k=>k.url===b.source.url),b.fb.remoteTextTracks&&(c=yield Promise.all(b.fb.remoteTextTracks.map(a.Ea.bind(a))),e.tracks=c.filter(k=>k),b.fb.remoteTextTracks=void 0),delete b.fb.autoplay,b.fb.startTime=null,e.customData={playerConfiguration:HU(b.fb)});c=a.vb()||{};
11
+ var f=$U(c.metadataType),g;typeof b.Ae===_.t&&(g={metadataType:f,sectionStartAbsoluteTime:b.Ae});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=aV(c);if(g=bV(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Oc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.t&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},bV=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(cV);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=MU(cV[b]);return Object.assign(b,a)},$U=function(a){var b=void 0===b?LU:b;return Object.values(cV).includes(a)?a:b},aV=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},eV=function(a,b){dV(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.X);b.addMessageListener(DU,a.R)},fV=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.t?null:a):a=
13
+ null;a=null===a?null:a+b;return null===a?b:a},dV=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.ga.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.D(_.le)))},iV=function(a){return new gV(a.h,()=>{a.trigger(new _.D(_.Xc))},(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.ff&&(d.preferredAudioLanguage=c.ff);c.Sf&&(d.preferredTextLanguage=c.Sf);_.ap(a.f,null);a.trigger(new _.D("castingended"));a.j(b,d)}},()=>hV(a))},hV=function(a){return _.x(function*(){a.trigger(new _.D(_.Wc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.ap(a.f,a.a))})},lV=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{jV=!1;const e=_.Oi(d),f=yield c.fetch(e).O;if(f&&f.data){const g=_.ki(f.data),h=(new DOMParser).parseFromString(g,
15
+ _.Sf);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=kV(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=kV(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),jV=!0}}catch(e){_.B("Failed to fetch an ad",e),jV=!0}})},kV=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
+ a;return b},mV=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},nV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},pV=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=oV(a,c))&&(d={ad:c});a.m.trigger(new _.D(b,d))}},oV=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Mf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
+ _.Mf&&(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},qV=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]},rV=function(a){const b=
18
+ a.dashTimedMetadata;let c=_.$f;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.Zf)?_.ph:_.nh,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},sV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},uV=function(a){a.a=sV().getTextTracksManager();const b=a.a.getTracks();a.j=tV(_.K,b)},tV=function(a,b){const c=[];for(const d of b)b=new _.dj(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 _.lj(b.id,b)),c.push(b);return c},vV=function(a,b,c,d){c=_.wh(c).filter(g=>g);var e=!1;let f=[];b===_.L?f=a.getAudioTracks():b===_.K&&(f=a.ma());if(c=c.find(g=>{const h=_.Yh(g);return f.some(k=>{k=_.Yh(k.language||"");return _.Zh(h,k)})})){const g=
20
+ _.Yh(c);c=f.filter(h=>{h=_.Yh(h.language||"");return _.Zh(g,h)});f=c.length?c:f;e=e||!!c.length}_.ti(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===_.L?a.Da(e):b===_.K&&a.Ta(e))},wV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},zV=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=_.ml(d);if(e){var f=[_.wd];_.Xn(a)[0].type!==_.Dc&&f.unshift(_.yd);d.preferredDrmSystem===_.wd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.hb[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:{}},xV(b,h,a,c),yV(b,h,a,c)):c()}else c()}else c()},xV=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
+ _.Oi({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},yV=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.Pi(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.J(g.data)}):
23
+ a.licenseHandler=void 0},CV=function(){return AV||(AV=new BV)},DV=function(){return cast.framework.CastReceiverContext.getInstance()},FV=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=DV();var {hlsVideoSegmentFormat:d}=DV().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.gg:_.fg;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=
24
+ EV(f,_.pa),h=EV(f,_.Ab);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")},EV=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},HV=function(a,b){let c=null;const d=GV(a);d&&(c={ad:d});a.f.trigger(new _.D(b,c))},GV=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
+ let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},IV=class{constructor(a,b){this.log=new _.S(b);this.player=a;this.l=null;this.h=_.Rn;this.o=_.it;this.j=2;this.D=Date.now();this.C=-1}release(){this.a(_.Rn)}destroy(){this.l=
26
+ this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.E&&this.a(_.Qn)}a(a){if(a!==this.h)if(this.h===_.Qn&&a!==_.Rn)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===_.Mn?(this.C=b,this.player.trigger(new _.D(_.Tc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Mn&&this.player.trigger(new _.D(_.Pc,{detail:{bufferedTimeMS:b-this.C,reason:this.j}}));a={currentState:this.h,previousState:this.o,
27
+ timeSinceLastStateChangeMS:b-this.D};this.D=b;this.l&&_.An(this.l,this.h);this.player.trigger(new _.D(_.Jf,{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var LU=0,cV={GENERIC:LU,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var JV=class extends IV{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.ob.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}ob(){if(this.f&&
28
+ this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Jn);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Qn);break;default:this.a(_.Rn)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Un);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Tn);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Mn)}}};var KV=class extends _.T{constructor(){super();this.g=new _.S("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=_.M;break;case chrome.cast.media.TrackType.AUDIO:c=_.L;break;case chrome.cast.media.TrackType.TEXT:c=_.K}c=new _.dj(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
+ c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.lj(c.id,c));return c}):[],this.a.trigger(new _.D(_.Ms)))}destroy(){this.a=null}getVideoTracks(){return NU(this,_.M)}getAudioTracks(){return NU(this,_.L)}ma(){return NU(this,_.K)}oa(){const a=this.Ra();return a?a.renditions[0]:null}Xa(){const a=this.na();return a?a.renditions[0]:null}Pa(){const a=this.za();return a?a.renditions[0]:
30
+ null}kb(){return this.f[_.M]||null}wb(){return this.f[_.L]||null}xb(){return this.f[_.K]||null}Ra(){return PU(this,_.M)}na(){return PU(this,_.L)}za(){return PU(this,_.K)}sb(a){RU(this,_.M,a)}Da(a){RU(this,_.L,a)}Ta(a){RU(this,_.K,a)}gb(a){this.sb(a&&a.track)}qb(a){this.Da(a&&a.track)}rb(a){this.Ta(a&&a.track)}addTextTrack(){return _.x(function*(){})}ua(){return!0}};KV.prototype.isAbrEnabled=KV.prototype.ua;KV.prototype.addTextTrack=KV.prototype.addTextTrack;KV.prototype.setTextRendition=KV.prototype.rb;
31
+ KV.prototype.setAudioRendition=KV.prototype.qb;KV.prototype.setVideoRendition=KV.prototype.gb;KV.prototype.setTextTrack=KV.prototype.Ta;KV.prototype.setAudioTrack=KV.prototype.Da;KV.prototype.setVideoTrack=KV.prototype.sb;KV.prototype.getTextTrack=KV.prototype.za;KV.prototype.getAudioTrack=KV.prototype.na;KV.prototype.getVideoTrack=KV.prototype.Ra;KV.prototype.getLoadingTextRendition=KV.prototype.xb;KV.prototype.getLoadingAudioRendition=KV.prototype.wb;KV.prototype.getLoadingVideoRendition=KV.prototype.kb;
32
+ KV.prototype.getTextRendition=KV.prototype.Pa;KV.prototype.getAudioRendition=KV.prototype.Xa;KV.prototype.getVideoRendition=KV.prototype.oa;KV.prototype.getTextTracks=KV.prototype.ma;KV.prototype.getAudioTracks=KV.prototype.getAudioTracks;KV.prototype.getVideoTracks=KV.prototype.getVideoTracks;var gV=class extends _.Os{constructor(a,b,c,d){super();this.g=new _.S(_.jd);this.T=a;this.o=new _.Pj(b);this.S=c;this.Y=d;this.h=this.I=_.Qk();this.D=[];this.C=0;this.K=new _.To;this.G=this.l=this.a=null;this.A=this.w=!1;this.Z="";this.da=1E6;this.f=new KV;this.f.initialize(this);this.j=new JV(this);this.H=new _.$r;this.J=null;this.F=new Set;this.N=this.Ua.bind(this);this.aa=this.Na.bind(this);this.X=this.Ma.bind(this);this.R=this.Va.bind(this);this.M=null;window.cast||Object.defineProperty(window,
33
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{UU(!0)},0)}});TU(this);SU.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(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}destroy(){return _.x(function*(){})}sd(a){this.M=
34
+ a}oc(){return this.w}Bb(){return this.A}je(){return this.Z}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,HU(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.x(function*(){if(!a.oc())throw a.g.warn(yU),new _.H(1,8,8001,void 0);if(!VU)throw a.g.warn(wU),new _.H(1,8,8002,void 0);if(a.Bb())throw a.g.warn("Already casting"),
35
+ new _.H(1,8,8003,void 0);try{yield XU(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 _.H(1,8,8E3,c);}})}ge(){this.Bb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Xd&&this.F.add(a)}removeMessageListener(a){typeof a===_.Xd&&this.F.delete(a)}play(){return this.isEnded()?ZU(this,!0):new Promise((a,b)=>{if(!this.a)return b(vU);this.a.play(null,
36
+ a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(vU);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.Jn}seek(a){return this.isEnded()?ZU(this,!1,a):new Promise((b,c)=>{this.a||c(vU);this.l.isPlayingBreak&&c(tU);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.D(_.bg));this.a.seek(d,()=>{this.trigger(new _.D(_.ag));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
37
+ 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!==_.t?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(FU,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
38
+ 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!==_.t?null:1E-8===a?0:a}getSeekRange(){let a=
39
+ {start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.t&&typeof b.end===_.t&&(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?IU(this.a.customData.stats):_.En()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.oc())if(VU){b.D=_.Xn(a);b.h=_.Sk(b.I,a);var c=b.D[b.C];yield YU(b,{source:c,
40
+ isLive:c.isLive,autoplay:b.h.autoplay,fb:b.h,Ob:c.Ob,audioMimeType:c.audioMimeType})}else b.g.warn(wU);else b.g.warn(yU)})}getBufferInfo(){return new _.Ns}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.C}setSourceIndex(a){this.C=a}getLoadedSource(){return this.D[this.C]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.g.warn(xU)}onError(a){if(a&&
41
+ (this.trigger(new _.D(_.q,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.jd}canPlay(){return this.oc()?2:0}vb(){return this.J}uc(a){this.J=bV(a)}be(){this.J=null}He(a){const b=this.vb()||{};a={metadataType:$U(b.metadataType),title:a};this.uc(Object.assign({},b,a))}Fe(a){const b=this.vb()||{},c=$U(b.metadataType);a=new chrome.cast.Image(a);this.uc(Object.assign({},b,{metadataType:c,images:[a]}))}Ee(a){const b=this.vb()||{};this.uc(Object.assign({},b,{metadataType:3,artist:a}))}Ge(a){const b=
42
+ this.vb()||{};a={metadataType:$U(b.metadataType),releaseDate:a};this.uc(Object.assign({},b,a))}Ua(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;VU=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Z=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Me()}Na(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;eV(this,a.session);break;
43
+ case cast.framework.SessionState.SESSION_RESUMED:this.Bb()||(this.A=!0,eV(this,a.session),this.Y());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Bb()&&this.a){const d=this.a.media;var b=this.f.na(),c=this.f.za();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:fV(this),Sf:c,ff:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.X);a.session.removeMessageListener(DU,
44
+ this.R);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}Ma(a){this.g.debug("New media session",a.mediaSession);dV(this,a.mediaSession)}Va(a,b){if(a===DU&&0<this.F.size){const c=IU(b);this.F.forEach(d=>d(c))}}ga(){this.trigger(new _.D(_.Tf))}Ea(a){const b=this;return _.x(function*(){let c=null;const d=yield JU(a,[_.Rf,_.Cc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.da++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
45
+ d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};gV.prototype.getTextDisplayer=gV.prototype.getTextDisplayer;gV.prototype.getNetworkEngine=gV.prototype.getNetworkEngine;gV.prototype.setNetworkEngine=gV.prototype.setNetworkEngine;var VU=!1,SU=new Set;window.__onGCastApiAvailable=UU;var LV=class extends _.Os{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Xd?c:(d,e)=>{this.f&&d!==_.Jn&&d!==_.Rn&&this.f.load(e)};this.a=iV(this);this.g=new _.S(AU);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield WU(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}Zd(){return!!this.a&&this.a.oc()&&VU}Bb(){return!!this.a&&this.a.Bb()}je(){return this.a?this.a.je():""}sd(a){this.a&&this.a.sd(a)}cast(a){const b=this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),
46
+ b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.na();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.za();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const r=e&&typeof e.isLive===_.Oc?e.isLive:b.f.isLive();d={source:e,
47
+ isLive:r,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Ae:b.f.getPresentationStartTime(),Ob:h,audioMimeType:k,fb:l}}var c=d}yield hV(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield YU(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.D(_.q,{detail:d}),b.trigger(c)}})}ge(){this.a&&this.a.ge()}lg(a){const b=this;return _.x(function*(){a!==b.h&&(b.h=a,b.a&&(yield WU(b.a)),b.a=iV(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?
48
+ yield b.a.sendMessage(DU,a):b.g.warn(zU)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(zU)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(zU)}vb(){return this.a&&this.a.vb()}uc(a){this.a&&this.a.uc(a)}be(){this.a&&this.a.be()}He(a){this.a&&this.a.He(a)}Fe(a){this.a&&this.a.Fe(a)}Ee(a){this.a&&this.a.Ee(a)}Ge(a){this.a&&this.a.Ge(a)}};_.z(AU,LV);LV.prototype.setContentReleaseDate=LV.prototype.Ge;LV.prototype.setContentArtist=LV.prototype.Ee;
49
+ LV.prototype.setContentImage=LV.prototype.Fe;LV.prototype.setContentTitle=LV.prototype.He;LV.prototype.clearContentMetadata=LV.prototype.be;LV.prototype.setContentMetadata=LV.prototype.uc;LV.prototype.getContentMetadata=LV.prototype.vb;LV.prototype.removeMessageListener=LV.prototype.removeMessageListener;LV.prototype.addMessageListener=LV.prototype.addMessageListener;LV.prototype.sendMessage=LV.prototype.sendMessage;LV.prototype.changeReceiverId=LV.prototype.lg;LV.prototype.forceDisconnect=LV.prototype.ge;
50
+ LV.prototype.cast=LV.prototype.cast;LV.prototype.setPlayerConfigInterceptor=LV.prototype.sd;LV.prototype.getReceiverName=LV.prototype.je;LV.prototype.isCasting=LV.prototype.Bb;LV.prototype.canCast=LV.prototype.Zd;LV.prototype.destroy=LV.prototype.destroy;var MV=class extends IV{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.Z.bind(this);this.w=this.Y.bind(this);this.K=this.X.bind(this);this.J=this.T.bind(this);this.M=this.da.bind(this);this.G=this.aa.bind(this);this.F=this.W.bind(this);this.f=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
51
+ this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.M);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
52
+ d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.M);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}S(){this.player.trigger(new _.D(_.Qe));this.a(_.Un)}R(){this.a(_.Tn)}Z(){this.a(_.Jn)}Y(a){a.isBuffering?
53
+ this.a(_.Mn):(a=this.player.isPaused()?_.Tn:_.Un,this.a(a))}X(){this.j=1;this.player.trigger(new _.D(_.bg))}T(){this.player.trigger(new _.D(_.ag))}da(){this.j=2}aa(){this.a(_.Sn)}N(a){const b=this.player.getStats();this.player.trigger(new _.D(_.Nc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}W(a){a=new _.H(_.E,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.D(_.q,{detail:a}));this.a(_.Qn)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.j=typeof c===_.t?c:1;this.l=typeof d===_.t?d:1;this.h=typeof e===_.t?e:0}Gb(){return"Google Cast Framework"}Hb(){return cast.framework.VERSION}Mb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}pc(){return!1}Xb(){return this.a.clickThroughUrl||
54
+ null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}Kb(){return 0}Jb(){return 0}yb(){return 0}lb(){switch(this.Yb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.h}Yb(){return this.f.position}Zb(){return this.j}Lb(){return this.l}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;
55
+ Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.Lb;Z.prototype.getPositionInSequence=Z.prototype.Zb;Z.prototype.getPodTimeOffset=Z.prototype.Yb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.lb;Z.prototype.getMediaBitrate=Z.prototype.yb;Z.prototype.getMediaHeight=Z.prototype.Jb;Z.prototype.getMediaWidth=Z.prototype.Kb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.Xb;
56
+ Z.prototype.isBumper=Z.prototype.pc;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;Z.prototype.getDuration=Z.prototype.getDuration;Z.prototype.getTitle=Z.prototype.getTitle;Z.prototype.getAdvertiserName=Z.prototype.getAdvertiserName;Z.prototype.getAdSystem=Z.prototype.getAdSystem;Z.prototype.getApiFramework=Z.prototype.getApiFramework;Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.Mb;
57
+ Z.prototype.getAdManagerVersion=Z.prototype.Hb;Z.prototype.getAdManagerName=Z.prototype.Gb;var NV=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}$b(){return!!this.a.find(a=>0===a.position)}Ab(){return!!this.a.find(a=>-1===a.position)}};NV.prototype.hasPostroll=NV.prototype.Ab;NV.prototype.hasPreroll=NV.prototype.$b;NV.prototype.getCuePoints=NV.prototype.getCuePoints;var OV=class{constructor(a){this.m=a;this.a=null;this.h=this.j.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];nV().addEventListener(this.f,
58
+ this.h)}load(){const a=this;return _.x(function*(){jV&&(jV=!1,mV(a,0))})}start(){return _.x(function*(){nV().play()})}resume(){-1!==this.getPosition()&&nV().play()}pause(){-1!==this.getPosition()&&nV().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===_.t?a:-1}dispose(){const a=this;return _.x(function*(){nV().removeEventListener(a.f,a.h)})}j(a){const b=cast.framework.events.EndedReason;
59
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=nV().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.D(_.tc,{adsTimeline:new NV(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:pV(this,_.ic,a);break;case cast.framework.events.EventType.BREAK_STARTED:pV(this,_.bc,a);break;case cast.framework.events.EventType.BREAK_ENDED:pV(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:pV(this,_.pc,a);
60
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(pV(this,_.oc,a),pV(this,_.qc,a)):a.endedReason===b.STOPPED?pV(this,_.qc,a):a.endedReason===b.END_OF_STREAM?(pV(this,_.fc,a),pV(this,_.qc,a)):a.endedReason===b.ERROR&&mV(this,1);break;case cast.framework.events.EventType.PLAYING:pV(this,_.nc,a);break;case cast.framework.events.EventType.PAUSE:pV(this,_.lc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?pV(this,_.dc,a):pV(this,_.nc,a)}}};
61
+ OV.prototype.getPosition=OV.prototype.getPosition;OV.prototype.setVolume=OV.prototype.setVolume;OV.prototype.getVolume=OV.prototype.getVolume;OV.prototype.skip=OV.prototype.skip;OV.prototype.pause=OV.prototype.pause;OV.prototype.resume=OV.prototype.resume;var jV=!1;var PV=class{constructor(a){this.dc=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(qV(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(qV(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>rV(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=
62
+ _.qh;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.sh;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.th}b&&this.dc(new _.D(b,{detail:rV(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.dc(new _.D(_.qh,{detail:b}))}};var QV=class extends _.T{constructor(){super();this.g=new _.S("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;sV().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;sV().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ma(){return this.j}oa(){return null}Xa(){const a=
63
+ this.na();return a&&a.renditions[0]}Pa(){const a=this.za();return a&&a.renditions[0]}kb(){return null}wb(){return null}xb(){return null}Ra(){return null}na(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.t&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}za(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.t&&(b=b.toString(),a=this.ma().find(c=>c.id===b)||null)}return a}sb(){this.g.warn("Video tracks unavailable on Cast")}Da(a){a&&this.f&&
64
+ this.f.setActiveById(+a.id)}Ta(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}gb(){this.g.warn("Video renditions unavailable on Cast")}qb(a){this.Da(a&&a.track)}rb(a){this.Ta(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield JU(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=
65
+ 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]),uV(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ua(){return!0}w(){this.f=sV().getAudioTracksManager();var a=this.f.getTracks();this.h=tV(_.L,a);uV(this);a=this.m.getConfiguration();vV(this,_.L,a.preferredAudioLanguage,a.preferredAudioRole);vV(this,_.K,a.preferredTextLanguage,a.preferredTextRole)}};QV.prototype.isAbrEnabled=QV.prototype.ua;
66
+ QV.prototype.addTextTrack=QV.prototype.addTextTrack;QV.prototype.setTextRendition=QV.prototype.rb;QV.prototype.setAudioRendition=QV.prototype.qb;QV.prototype.setVideoRendition=QV.prototype.gb;QV.prototype.setTextTrack=QV.prototype.Ta;QV.prototype.setAudioTrack=QV.prototype.Da;QV.prototype.setVideoTrack=QV.prototype.sb;QV.prototype.getTextTrack=QV.prototype.za;QV.prototype.getAudioTrack=QV.prototype.na;QV.prototype.getVideoTrack=QV.prototype.Ra;QV.prototype.getLoadingTextRendition=QV.prototype.xb;
67
+ QV.prototype.getLoadingAudioRendition=QV.prototype.wb;QV.prototype.getLoadingVideoRendition=QV.prototype.kb;QV.prototype.getTextRendition=QV.prototype.Pa;QV.prototype.getAudioRendition=QV.prototype.Xa;QV.prototype.getVideoRendition=QV.prototype.oa;QV.prototype.getTextTracks=QV.prototype.ma;QV.prototype.getAudioTracks=QV.prototype.getAudioTracks;QV.prototype.getVideoTracks=QV.prototype.getVideoTracks;var RV=class extends _.Os{constructor(){super();this.g=new _.S(BU);this.h=this.w=_.Qk();this.A=null;this.l=-1;this.F=new _.To;this.f=this.o=this.j=this.a=this.C=null;this.D=!1}init(a,b){this.C=a;b&&(this.h=this.w=b);a=wV();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new MV(this);this.a.init();this.j=new QV;this.j.initialize(this);this.o=new PV(c=>this.trigger(c));this.o.init()}unload(){const a=
68
+ cast.framework.messages.PlayerState,b=wV();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.x(function*(){a.C=null;a.w=_.Qk();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=wV();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
69
+ a.play();return Promise.resolve()}pause(){const a=wV();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return wV().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return wV().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=wV();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(tU);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}getMediaPosition(){return wV().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
70
+ wV().getDurationSec();return typeof a===_.t?-1===a?Infinity:a:-1}getPlaybackRate(){return wV().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;wV().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||
71
+ null}getLoadedSource(){const a=wV().getMediaInformation();if(a){var b=wV().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,Kh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return wV().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=wV().getLiveSeekableRange();
72
+ b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.it}getStats(){var a=_.En();if(this.f){a=wV().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===_.t?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.t?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
73
+ this;return _.x(function*(){b.f=new _.gt;b.a.l=b.f.a;b.A=_.Xn(a);b.h=_.Sk(b.w,a);if(b.D)b.D=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.h.autoplay;typeof b.h.startTime===_.t&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:HU(b.h),local:!0};yield wV().load(d)}})}getBufferInfo(){this.g.warn(_.qa);return new _.Ns}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.C}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}setNetworkEngine(a){this.F=
74
+ a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return BU}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.g.warn(xU)}onError(a){a=new _.D(_.q,{detail:a});this.trigger(a)}canPlay(){return _.ck()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=HU(this.getStats());var b=wV(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.t&&c.startAbsoluteTime!==
75
+ 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=wV().getStartAbsoluteTime();if(typeof d===_.t){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
76
+ a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=IU(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.t?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;zV(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};RV.prototype.getTextDisplayer=RV.prototype.getTextDisplayer;RV.prototype.getNetworkEngine=RV.prototype.getNetworkEngine;
77
+ RV.prototype.setNetworkEngine=RV.prototype.setNetworkEngine;var BV=class{constructor(){this.a=!1;this.g=new _.S(CU);this.f=this.m=null;this.h=new Set;this.A=this.G.bind(this);this.w=this.C.bind(this);this.j=null;this.o=new _.$r;this.l=null}init(a){a&&(this.f=new RV,_.ap(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.Rn&&(yield GU(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=DV(),b=DV().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
78
+ c.customNamespaces={};c.customNamespaces[DU]=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.D.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
79
+ this.A);a.start(c);a.addCustomMessageListener(DU,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=DV();DV().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(DU,this.w);a.stop();this.m=this.f=null}}sd(a){this.j=a}lh(a){this.l=a}on(a,b){DV().addEventListener(a,b)}off(a,b){DV().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Xd&&this.h.add(a)}removeMessageListener(a){typeof a===_.Xd&&this.h.delete(a)}sendMessage(a,
80
+ b){DV().sendCustomMessage(DU,b,HU(a))}oc(){return this.a}vb(){var a;return a=(a=DV().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return FV(this,a);try{var b=(new DOMParser).parseFromString(a,_.Sf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=DV();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ha);for(var f=e.length-
81
+ 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.we);var h=e[f].getElementsByTagName(_.Bb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.we)||g,m=h[k].getAttribute(_.rd);let n=h[k].getAttribute(_.yg)||void 0,r=h[k].getAttribute(_.Yd)||void 0;void 0!==n&&(n=+n);void 0!==r&&(r=+r);b.canDisplayType(l,m,n,r)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.Bb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ha).length||a.removeChild(c[d])}return a=
82
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Ib)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=DV();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.zb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.gb)||void 0,h=e[f].getAttribute(_.fb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.gg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.zb).length||a.removeChild(c[d])}a=
83
+ (new XMLSerializer).serializeToString(a)}return a}D(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=IU(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield lV(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.t&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.D=!0,yield _.kp(b.m,d),yield _.lp(b.m),d=b.m.getLoadedSource(),c.media.contentId=
84
+ d.url,c.media.contentType=d.type,d.Ob&&(c.media.hlsVideoSegmentFormat=KU(d.Ob,_.M)),d.audioMimeType&&(c.media.hlsSegmentFormat=KU(d.audioMimeType,_.L)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.t&&(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=DV().getPlayerManager(),
85
+ c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.t||typeof c!==_.t||typeof d!==_.t||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.t&&b>=a&&b<=c&&this.m.seek(b))}_.np(this.m)}}C(a){if(0<this.h.size){const b=IU(a.data);this.h.forEach(c=>c(b))}}};_.z(CU,BV);BV.prototype.getContentMetadata=BV.prototype.vb;BV.prototype.isApiReady=BV.prototype.oc;BV.prototype.sendMessage=BV.prototype.sendMessage;BV.prototype.removeMessageListener=BV.prototype.removeMessageListener;
86
+ BV.prototype.addMessageListener=BV.prototype.addMessageListener;BV.prototype.off=BV.prototype.off;BV.prototype.on=BV.prototype.on;BV.prototype.setLoadRequestDataInterceptor=BV.prototype.lh;BV.prototype.setPlayerConfigInterceptor=BV.prototype.sd;BV.prototype.stop=BV.prototype.stop;BV.prototype.start=BV.prototype.start;BV.prototype.init=BV.prototype.init;BV.getInstance=CV;var AV=null;var SV=class{constructor(a){this.f=a;this.a=null;this.h=new _.$r;this.j=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.x(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.l.bind(a);for(const d of a.j)a.h.on(b,d,c)}})}start(){return _.x(function*(){})}resume(){this.a&&
87
+ 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(FU,{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===_.t&&(a=b));return a}dispose(){const a=this;
88
+ return _.x(function*(){a.h.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.D(_.tc,{adsTimeline:new NV(a.breaks)})));break;case "isPlayingBreak":a.value?HV(this,_.bc):(HV(this,_.fc),HV(this,_.qc),HV(this,_.cc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(HV(this,_.fc),HV(this,_.qc)),HV(this,_.pc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?HV(this,_.lc):HV(this,_.nc))}}};SV.prototype.getPosition=SV.prototype.getPosition;
89
+ SV.prototype.setVolume=SV.prototype.setVolume;SV.prototype.getVolume=SV.prototype.getVolume;SV.prototype.skip=SV.prototype.skip;SV.prototype.pause=SV.prototype.pause;SV.prototype.resume=SV.prototype.resume;var TV=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}isSupported(a,b){return a.namespace()!==_.jd?!1:!(!b||!b.ima)}create(a){return new SV(a.a)}};TV.prototype.create=TV.prototype.create;TV.prototype.isSupported=TV.prototype.isSupported;TV.prototype.name=TV.prototype.name;_.mo(new TV);var UV=class{name(){return"clpp.cast.ads.AdsManagerFactory"}isSupported(a,b){return CV().oc()?!(!b||!b.ima):!1}create(a){return new OV(a)}};UV.prototype.create=UV.prototype.create;UV.prototype.isSupported=UV.prototype.isSupported;UV.prototype.name=UV.prototype.name;_.mo(new UV);};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 lQ="Ad Error",mQ="onAdBreakStarted()",nQ="onAdBreakStopped()",oQ=function(a){var b=_.pk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.bk()&&(f="Apple");_.ak()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.ck()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.bk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.Uj()||_.Rj()||_.Qj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Uj()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Rj()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Qj("Hisense")&&(b="",f="Hisense")):_.Qj("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},pQ=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},qQ=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},sQ=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
- pQ(!!d);e[Conviva.Constants.ASSET_NAME]=lQ;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"]=rQ(a.getId()),e["c3.ad.creativeId"]=rQ(a.getCreativeId()),e["c3.ad.system"]=rQ(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=rQ(a.getApiFramework()),e["c3.ad.advertiser"]=rQ(a.getAdvertiserName()),e["c3.ad.position"]=qQ(a.getPodIndex()),e["c3.ad.technology"]=0===a.yb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=rQ(a.rb()),e["c3.ad.adManagerVersion"]=rQ(a.sb()),e["c3.ad.advertiserCategory"]=rQ(null),e["c3.ad.advertiserId"]=rQ(null),e["c3.ad.breakId"]=rQ(null),e["c3.ad.campaignName"]=rQ(null),e["c3.ad.category"]=rQ(null),e["c3.ad.classification"]=rQ(null),e["c3.ad.creativeName"]=rQ(null),e["c3.ad.sequence"]=rQ(a.Nb()),e["c3.ad.sessionStartEvent"]=rQ(null),e["c3.ad.unitName"]=rQ(null),e["c3.ad.dayPart"]=rQ(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"]=rQ(b),e["c3.ad.firstAdSystem"]=rQ(c),e["c3.ad.firstCreativeId"]=rQ(a));return e},rQ=function(a){return a?""+a:"NA"},wQ=function(a){a.f.on(a.m,_.bc,a.C.bind(a));a.f.on(a.m,_.cc,a.F.bind(a));a.f.on(a.m,_.pc,a.L.bind(a));a.f.on(a.m,_.mc,a.l.bind(a));a.f.on(a.m,_.lc,a.l.bind(a));a.f.on(a.m,_.nc,a.l.bind(a));a.f.on(a.m,_.ec,a.l.bind(a));a.f.on(a.m,_.qc,a.N.bind(a));
7
- a.f.on(a.m,_.oc,a.K.bind(a));a.f.on(a.m,_.fc,a.G.bind(a));a.f.on(a.m,_.ic,a.I.bind(a));a.f.on(a.m,_.jc,a.J.bind(a));a.f.on(a.m,_.hc,a.H.bind(a));a.f.on(a.m,_.kc,a.U.bind(a));a.f.on(a.m,_.rc,a.R.bind(a));a.f.on(a.m,_.Vd,b=>{var c=b.detail;if(10003===c.code&&(a.h.debug("onAdError()"),!a.g)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=lQ}null===a.a&&tQ(a,null);a.a.reportAdError(c,b.FATAL);a.g=!0;a.h.debug("Ad Playback Failure");
8
- uQ(a,vQ,c)}})},uQ=function(a,b,c=lQ){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case vQ:a.a.reportAdFailed(c,sQ(null,a.B,a.A));break;case xQ:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},tQ=function(a,b){if(!a.o){a.g=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.T()),b){const c=sQ(b,a.B,a.A,a.m.isLive()),d=String(b.sb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.rb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
- d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.h.error("Could not create ad analytics session",c)}}},yQ=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.h.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(oQ(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]=_.fa;a.a.setPlayerInfo(b)},zQ=function(a){return a.m.getConfiguration().autoplay||!1},BQ=function(a){if(!a.l)if(a.C)a.h.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.h.debug(a.m.getConfiguration().source);var f={},g=
11
- new _.El(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.gj(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.h.debug("reportMiscellaneousMetrics()");if(AQ(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.h.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.g=!0;a.I=!1;0<a.j.length&&(a.h.debug("Report deferred events"),a.j.forEach(h=>{h.ef(h.args)}));a.j=[]}},CQ=function(a){if(!a.l&&a.a){const b=pQ(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},AQ=function(a){return null!==a.a&&a.C},DQ=function(a){a.h.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.g=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},EQ=function(a,b){var c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.De;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.G(1,9,9E3),a.V(b,c)):b.namespace()===_.kd&&(a.a=!1,
14
- a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},FQ=function(a){const b=[];typeof a===_.De&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.G(1,9,9001,{missingKeys:b});};var HQ=class{constructor(a,b){this.m=a;this.T=b;this.B="";this.A=_.ra;this.h=new _.Q("clpp.conviva.ad");this.f=new _.as;this.a=null;this.g=this.o=this.w=this.j=!1}initialize(a){this.h.debug("Initialize Ad Insights");this.g=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.ra;wQ(this)}release(){this.h.debug("Release Ad Insights");this.w?this.h.debug(_.ja):(_.kh(this.f),this.a&&uQ(this,GQ),this.f.release(),this.w=!0,this.j=this.g=!1)}destroy(){this.h.debug(_.Ed);this.o?this.h.debug(_.ia):this.o=!0}C(){this.h.debug(mQ)}F(){this.h.debug(nQ)}L(a){this.h.debug("onAdStarted()");
15
- a=a.ad;this.j||(this.h.warn("Ad load event was not triggered. This will have incidence on VSF"),tQ(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.vb(),a.ub());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.jb())}l(a){this.h.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.mc:case _.nc:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.lc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.ec:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.h.debug("onAdStopped()");this.a&&!this.g&&uQ(this,GQ)}K(){this.h.debug("onAdSkipped()");this.a&&uQ(this,xQ)}G(){this.h.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.h.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.h.debug("onAdLoaded()");
17
- const b=a.ad,c=()=>{this.j=!0;tQ(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Sf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Sf),c())})}H(){this.h.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}U(){this.h.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.h.debug("onAdThirdQuartile()");this.a&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},xQ=0,GQ=1,vQ=2;var IQ=class{constructor(a,b){this.m=a;this.f=new _.as;this.a=null;this.o=!1;this.G=!0;this.B=this.g=this.A=this.C=this.l=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.h=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.h.debug("Initialize conviva"),this.G=!1,this.F=_.Lg(b),this.K=c,this.m=a,yQ(this,this.F),this.f.on(this.m,_.Re,this.ha.bind(this)),this.f.on(this.m,_.If,this.$.bind(this)),this.f.on(this.m,_.Qc,this.L.bind(this)),this.f.on(this.m,_.fg,this.X.bind(this)),this.f.on(this.m,
19
- _.eg,this.W.bind(this)),this.f.on(this.m,_.bc,this.T.bind(this)),this.f.on(this.m,_.cc,this.U.bind(this)),this.f.on(this.m,_.tc,this.aa.bind(this)),this.f.on(this.m,_.Pc,this.ea.bind(this)),this.f.on(this.m,_.Vd,this.N.bind(this)),zQ(this)&&(this.h.debug("Start a new session: A new video starts in autoplay."),BQ(this)))}release(){this.h.debug("Release conviva");this.G?this.h.debug(_.ja):(_.kh(this.f),AQ(this)||this.o||!zQ(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),AQ(this)&&
20
- DQ(this),this.a=null,this.G=!0)}destroy(){this.h.debug(_.Ed);this.l?this.h.debug(_.ia):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.h.debug("Report app event error",d),c=!1}return c}ha(){this.h.debug("onPlayRequest()");AQ(this)||zQ(this)?AQ(this)&&this.A&&!this.g&&(this.h.debug("Resuming VST monitoring ..."),AQ(this)&&!this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.g=!0),this.A=!1):(this.h.debug("Creating conviva session. On Play Requested / No autoplay"),
21
- BQ(this))}$(a){this.h.debug(_.Ie);const b=c=>{if(this.o&&(this.h.debug("Creating conviva session (On Seek / Replay)"),yQ(this,this.F),BQ(this),CQ(this),AQ(this))){var d=this.m.getTrackManager();d=d.ka()||d.Ua();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)}AQ(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Tn:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.Sn:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Ln:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.In:this.h.debug("onVideoEnded()"),AQ(this)&&(this.w&&this.w.lb()?(this.h.debug("Waiting for postroll Ad before terminating session"),this.J=!0):DQ(this))}}L(a){this.h.debug(_.Ee);if(AQ(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({ef:this.L.bind(this),args:a})}X(){this.h.debug("onSeeking()");AQ(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.h.debug("onSeeked()");AQ(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}aa(a){this.h.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}T(a){this.h.debug(mQ);
24
- var b=a.ad;a=0===b.Va();const c=qQ(b.getPodIndex());AQ(this)||zQ(this)||!a||BQ(this);if(AQ(this)){a=0===b.yb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.xb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.ak()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.h.debug("Bug: should already have a valid session")}U(){this.h.debug(nQ);
25
- AQ(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&DQ(this))}N(a){this.h.debug(_.Fe);if(this.o&&this.I)this.h.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,AQ(this)||BQ(this));AQ(this)?(this.h.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.h.debug("Video Playback Failure"),
26
- this.I=!0,DQ(this))):this.j.push({ef:this.N.bind(this),args:a})}}ea(){this.h.debug("onAutoPlayBlocked()");AQ(this)&&(this.h.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,AQ(this)&&this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.g=!1))}};var JQ=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.Q("clpp.conviva")}onPlayerCreated(a){this.f=new IQ(a,this.h)}onContentWillLoad(a,b){EQ(this,a);if(this.a){var c=a.getConfiguration();c=_.Lg(c.conviva||{});try{FQ(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new HQ(a,()=>this.f.a),this.g.initialize(c))}catch(d){d instanceof _.G?this.V(a,d):this.V(a,new _.G(1,9,9002,d,d))}}}onContentLoaded(){this.a&&CQ(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
- this.f=null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}V(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",JQ);JQ.prototype.reportAppEvent=JQ.prototype.reportAppEvent;JQ.Id="conviva";_.Vo(new class{create(){return new JQ}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var VT="Ad Error",WT="onAdBreakStarted()",XT="onAdBreakStopped()",YT=function(a){var b=_.rk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.dk()&&(f="Apple");_.ck()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.ek()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.dk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
+ _.Wj()||_.Tj()||_.Sj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Wj()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Tj()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Sj("Hisense")&&(b="",f="Hisense")):_.Sj("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},ZT=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},$T=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},bU=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
+ ZT(!!d);e[Conviva.Constants.ASSET_NAME]=VT;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"]=aU(a.getId()),e["c3.ad.creativeId"]=aU(a.getCreativeId()),e["c3.ad.system"]=aU(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=aU(a.getApiFramework()),e["c3.ad.advertiser"]=aU(a.getAdvertiserName()),e["c3.ad.position"]=$T(a.getPodIndex()),e["c3.ad.technology"]=0===a.Mb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=aU(a.Gb()),e["c3.ad.adManagerVersion"]=aU(a.Hb()),e["c3.ad.advertiserCategory"]=aU(null),e["c3.ad.advertiserId"]=aU(null),e["c3.ad.breakId"]=aU(null),e["c3.ad.campaignName"]=aU(null),e["c3.ad.category"]=aU(null),e["c3.ad.classification"]=aU(null),e["c3.ad.creativeName"]=aU(null),e["c3.ad.sequence"]=aU(a.Zb()),e["c3.ad.sessionStartEvent"]=aU(null),e["c3.ad.unitName"]=aU(null),e["c3.ad.dayPart"]=aU(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"]=aU(b),e["c3.ad.firstAdSystem"]=aU(c),e["c3.ad.firstCreativeId"]=aU(a));return e},aU=function(a){return a?""+a:"NA"},fU=function(a){a.f.on(a.m,_.bc,a.D.bind(a));a.f.on(a.m,_.cc,a.F.bind(a));a.f.on(a.m,_.pc,a.M.bind(a));a.f.on(a.m,_.mc,a.l.bind(a));a.f.on(a.m,_.lc,a.l.bind(a));a.f.on(a.m,_.nc,a.l.bind(a));a.f.on(a.m,_.dc,a.l.bind(a));a.f.on(a.m,_.qc,a.N.bind(a));
7
+ a.f.on(a.m,_.oc,a.K.bind(a));a.f.on(a.m,_.ec,a.G.bind(a));a.f.on(a.m,_.hc,a.I.bind(a));a.f.on(a.m,_.ic,a.J.bind(a));a.f.on(a.m,_.gc,a.H.bind(a));a.f.on(a.m,_.jc,a.T.bind(a));a.f.on(a.m,_.rc,a.R.bind(a));a.f.on(a.m,_.q,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=VT}null===a.a&&cU(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
+ dU(a,eU,c)}})},dU=function(a,b,c=VT){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case eU:a.a.reportAdFailed(c,bU(null,a.C,a.A));break;case gU:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},cU=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=bU(b,a.C,a.A,a.m.isLive()),d=String(b.Hb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.Gb();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)}}},hU=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(YT(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]=_.fa;a.a.setPlayerInfo(b)},iU=function(a){return a.m.getConfiguration().autoplay||!1},kU=function(a){if(!a.l)if(a.D)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 _.Fl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.fj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ra;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.A(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(jU(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.D=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.vf(h.args)}));a.j=[]}},lU=function(a){if(!a.l&&a.a){const b=ZT(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},jU=function(a){return null!==a.a&&a.D},mU=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.D=!1,a.A=!1,a.h=!1,a.w=null,a.C=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},nU=function(a,b){var c=b.getConfiguration();a.a=!_.A(c.conviva)&&typeof c.conviva===_.Ce;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.W(b,c)):b.namespace()===_.jd&&(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.")},oU=function(a){const b=[];typeof a===_.Ce&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var qU=class{constructor(a,b){this.m=a;this.S=b;this.C="";this.A=_.ra;this.g=new _.S("clpp.conviva.ad");this.f=new _.$r;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.C=a.viewerId;this.A=a.playerName||_.ra;fU(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ja):(_.lh(this.f),this.a&&dU(this,pU),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}D(){this.g.debug(WT)}F(){this.g.debug(XT)}M(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"),cU(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.Kb(),a.Jb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.yb())}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 _.mc:case _.nc:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.lc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.dc:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.g.debug("onAdStopped()");this.a&&!this.h&&dU(this,pU)}K(){this.g.debug("onAdSkipped()");this.a&&dU(this,gU)}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;cU(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Tf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Tf),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}T(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.g.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},gU=0,pU=1,eU=2;var rU=class{constructor(a,b){this.m=a;this.f=new _.$r;this.a=null;this.o=!1;this.G=!0;this.C=this.h=this.A=this.D=this.l=!1;this.R=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=_.Mg(b),this.K=c,this.m=a,hU(this,this.F),this.f.on(this.m,_.Qe,this.ga.bind(this)),this.f.on(this.m,_.Jf,this.Z.bind(this)),this.f.on(this.m,_.Nc,this.M.bind(this)),this.f.on(this.m,_.bg,this.Y.bind(this)),this.f.on(this.m,
19
+ _.ag,this.X.bind(this)),this.f.on(this.m,_.bc,this.S.bind(this)),this.f.on(this.m,_.cc,this.T.bind(this)),this.f.on(this.m,_.tc,this.aa.bind(this)),this.f.on(this.m,_.Lc,this.da.bind(this)),this.f.on(this.m,_.q,this.N.bind(this)),iU(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),kU(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ja):(_.lh(this.f),jU(this)||this.o||!iU(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),jU(this)&&
20
+ mU(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}ga(){this.g.debug("onPlayRequest()");jU(this)||iU(this)?jU(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),jU(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
+ kU(this))}Z(a){this.g.debug(_.He);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),hU(this,this.F),kU(this),lU(this),jU(this))){var d=this.m.getTrackManager();d=d.oa()||d.kb();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)}jU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Un:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.Tn:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Mn:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Jn:this.g.debug("onVideoEnded()"),jU(this)&&(this.w&&this.w.Ab()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):mU(this))}}M(a){this.g.debug(_.De);if(jU(this)){if(a=a.detail,typeof a.width===_.t&&typeof a.height===_.t&&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({vf:this.M.bind(this),args:a})}Y(){this.g.debug("onSeeking()");jU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}X(){this.g.debug("onSeeked()");jU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}aa(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.g.debug(WT);
24
+ var b=a.ad;a=0===b.lb();const c=$T(b.getPodIndex());jU(this)||iU(this)||!a||kU(this);if(jU(this)){a=0===b.Mb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.Lb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.ck()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.C=!0}else this.g.debug("Bug: should already have a valid session")}T(){this.g.debug(XT);
25
+ jU(this)&&this.C&&(this.a.reportAdBreakEnded(),this.C=!1,this.J&&mU(this))}N(a){this.g.debug(_.Ee);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,jU(this)||kU(this));jU(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,mU(this))):this.j.push({vf:this.N.bind(this),args:a})}}da(){this.g.debug("onAutoPlayBlocked()");jU(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,jU(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var sU=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.S("clpp.conviva")}onPlayerCreated(a){this.f=new rU(a,this.g)}onContentWillLoad(a,b){nU(this,a);if(this.a){var c=a.getConfiguration();c=_.Mg(c.conviva||{});try{oU(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new qU(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.H?this.W(a,d):this.W(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&lU(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"}W(a,b){a.trigger(new _.D(_.q,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",sU);sU.prototype.reportAppEvent=sU.prototype.reportAppEvent;sU.Id="conviva";_.Wo(new class{create(){return new sU}});};f.call(g, window);