@flowplayer/player 3.8.1 → 3.9.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.
- package/core.js +1 -1
- package/default.js +1 -1
- package/embed.js +2 -2
- package/flowplayer.css +1 -1
- package/package.json +1 -1
- package/plugins/ads.js +2 -2
- package/plugins/analytics.js +1 -1
- package/plugins/dash.js +4 -4
- package/plugins/drm.js +1 -1
- package/plugins/health.js +1 -1
- package/plugins/hls.js +1 -1
- package/plugins/ovp.js +1 -1
- package/plugins/preview.js +1 -1
- package/plugins/qul.js +1 -1
- package/plugins/subtitles.js +1 -1
- package/plugins/tizen.js +1 -1
- package/plugins/webos.js +1 -1
package/plugins/ads.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.ads=t())}(this,(function(){"use strict";var e;!function(e){e[e.ADS=2]="ADS",e[e.ANALYTICS=4]="ANALYTICS",e[e.NO_METERING=8]="NO_METERING",e[e.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",e[e.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(e||(e={}));const t=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function s(e,s){return!!~t.indexOf(e)||e.indexOf(s)===e.length-s.length}s.check_whitelist=function(e){return!!~t.indexOf(e)};function i(e){this.message=e}i.prototype=new Error,i.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new i("'atob' failed: The string to be decoded is not correctly encoded.");for(var s,r,a=0,n=0,o="";r=t.charAt(n++);~r&&(s=a%4?64*s+r:r,a++%4)?o+=String.fromCharCode(255&s>>(-2*a&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o};var a=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,t){var s=t.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s})))}(t)}catch(e){return r(t)}};function n(e){this.message=e}n.prototype=new Error,n.prototype.name="InvalidTokenError";var o=function(e,t){if("string"!=typeof e)throw new n("Invalid token specified");var s=!0===(t=t||{}).header?0:1;try{return JSON.parse(a(e.split(".")[s]))}catch(e){throw new n("Invalid token specified: "+e.message)}};o.InvalidTokenError=n;const d="production";function l(e,t){const s={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let i={c:"{}",exp:0};t=t||{};try{i=o(e),s.valid_jwt=!0}catch(e){}return s.raw=e,s.data=JSON.parse(i.c),s.exp=i.exp,t.require_valid_token&&l.validate(s),s}function c(e){return{grant:e,is_granted:t=>(e&t)===t}}function u(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",s=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),i=/Android/.test(t)&&!/Firefox/.test(t),r=/^((?!chrome|android).)*safari/i.test(t),a=/SamsungBrowser/.test(t),n=a&&/SMART-TV/.test(t);return{controls:!s,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:i,iphone:s,safari:r,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:a,samsung_tv:a&&n,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}}function h(e){return{width:e.clientWidth,height:e.clientHeight}}function p(e,t,s){return"number"==typeof s&&(s+="px"),e.style.setProperty(t,s),e}l.validate=function(e){if("string"==typeof e&&(e=l(e)),!e||!e.raw){if(s.check_whitelist(window.location.hostname)||"dev"===d.toString())return!0;throw new Error("No token provided in configuration")}if(!e.valid_jwt)throw new Error("Invalid token provided");const t=window.location.hostname,i=s.bind(null,t);if("dev"!==d.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(i))throw new Error("Domain not allowed");if("dev"!==d.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},l.id=function(e){if(e)return"string"==typeof e&&(e=l(e)),e.data.id},c.of=c,c.from_token=function(e){const t=l(e,{require_valid_token:!0});return c.of(t.data.acl)},c.permissions=e;const g="ad-initialized";var m=Object.freeze({__proto__:null,AD_INIT:g,AD_PLAYBACK_ERROR:"ad-playback-error",AD_TEARDOWN:"ad-teardown",AD_VIDEOTAG_ATTACHED:"ad-videotag-attached",AD_BLOCKED:"ad-blocked",AD_REQUEST_ERROR:"ad-request-error",AD_REQUESTED:"ad-requested",AD_REQUEST_COMPLETED:"ad-request-completed",AD_PAUSE_CONTENT:"ad-pause-content",AD_STARTED:"ad-started",AD_COMPLETED:"ad-completed",AD_PAUSED:"ad-paused",AD_RESUMED:"ad-resumed",AD_WAITING:"ad-waiting",AD_PROGRESS:"ad-progress",AD_SKIPPED:"ad-skipped",AD_MUTED:"ad-muted",AD_VOLUME_CHANGED:"ad-volume-changed",AD_FULLSCREEN:"ad-fullscreen",AD_TIMEOUT:"ad-timeout",AD_BREAK_COMPLETED:"ad-break-completed",AD_POSTROLL_FINISHED:"ad-postroll-finished",AD_PREROLL_FINSIHED:"ad-preroll-finished",AD_MIDROLL_FINISHED:"ad-midroll-finished",VPAID_INIT:"vpaid-init",IMA_ADAPTER_INIT:"ad-ima-adapter-init",IMA_BEFORE_ADS_REQUEST:"ad-ima-before-ads-request",IMA_ADS_RENDERING_SETTINGS:"ad-ima-rendering-settings",ADAPTER_INIT_FAILED:"ad-adapter-init-failed",AD_PLAY_REQUESTED:"ad-play-requested",RELOAD_AD_REQUESTED:"reload-ad-requested",AD_ERROR:"ad-error",REQUEST_AD_PAUSE:"request/ad/pause",REQUEST_AD_PLAY:"request/ad/play",REQUEST_AD_MUTE_UNMUTE:"request/ad/muteunmute",AD_HIDE_FIRST_FRAME:"ad/hide-first-frame",AD_SHOW_FIRST_FRAME:"ad/show-first-frame",AD_RESIZE:"ad/resize",AD_SET_UI_FLAGS:"ad/set-ui-flags"});const _="undefined"!=typeof document&&"undefined"!=typeof window&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;var f;function y(e,t){const s=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),i=(i,...r)=>{try{const a=(null==t?void 0:t.debug)||s;a&&e.match(a)&&console.log(`flowplayer/${e} -- ${i}`,...r)}catch(e){console.warn(e)}};return i.log=i,i}!function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(f||(f={}));const v=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const i=window.customElements.get(t);if(!i)throw new Error(`no default flowplayer component with the name ${t} exists`);const r=window.customElements.get(s);return"function"!=typeof r?i:r})(e._customElements,t))(e),A=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)},w="flowplayer-ad-ui",E=y("ads/lifecycle"),b=["ad-playback-error","ad-teardown","ad-break-completed"];async function S({config:e,root:t,content:s,ads:i,ima:r}){var a;E("LifeCycle::initLifeCycle",e,t,s,i,r),s.autoplay=!1;const n=e.autoplay===f.AUDIO_REQUIRED,o=function(e,t){return{muted:!(t||!e.muted),volume:e.volume}}(s,n);s.on("volumechange",()=>{o.volume=s.volume,o.muted=s.muted});const d=v(s,w),l=d.adContainer;s.emit("ad/set-ui-flags",{ui_flags:null===(a=e.ads)||void 0===a?void 0:a.ui}),s.renderPlugin(d);const c={listening:!1,preload:null==r?void 0:r.preload_ads};if(E("initial",o),i.setVideoTag(s),e.autoplay){E("Trying to autoplay"),s.emit("ad/hide-first-frame",{root:t});await async function e(t,s){const[i,r]=[t.muted,t.volume];E("Lifecycle::peek_content(:muted => %s, :volume => %s)",i,r);const a=()=>new Promise(e=>setTimeout(e,0,!1));s&&(t.muted=!1,t.volume=t.volume?t.volume:1);try{return await async function(e){return E("Lifecycle::wait_for_source"),new Promise((t,s)=>{let i=0;const r=setInterval(()=>{if(++i>40)return clearInterval(r),s(new Error("No source in 2000ms, giving up"));e.currentSrc&&(t(null),clearInterval(r))},50)})}(t),t.volume&&(t.volume=.01),E("Lifecycle::peek_content::play"),await new Promise(e=>setTimeout(()=>e(t.togglePlay(!0)))),E("Lifecycle::peek_content::pause"),await new Promise(e=>setTimeout(()=>e(t.togglePlay(!1)))),t.volume=r,E("Lifecycle::peek_content::true"),!0}catch(n){return t.volume=r,s?(t.muted=!1,0==t.volume&&(t.volume=1),await a()):i||!r?(E("Lifecycle::peek_content::false"),await a()):(E("Lifecycle::peek_content::recover"),t.muted=!0,!!await e(t)||(t.muted=i,E("Lifecycle::peek_content::false"),await a()))}}(s,n)?(E("Can autoplay, start ad"),s.opts.autoplay=1,L({ads:i,content:s,state:c,adContainer:l,ima:r,config:e})):(E("cannot autoplay(audioRequired: %s), fallback to poster state",n),e.autoplay=0,s.emit("ad/show-first-frame",{root:t}),s.setState("is-starting",!0))}e.autoplay||i.hasPreroll()&&function({content:e,ads:t,config:s,state:i,initial:r,adContainer:a,ima:n}){e.once("beforeplay",(async function(o){var d;(e.hasState("is-in-viewport")||"touchend"!=o.type)&&t.shallPlayAd(0)&&(_&&(null===(d=s.ima)||void 0===d?void 0:d.disable_content_peek_prevent_on_ios)||o.preventDefault(),M({ads:t,content:e,state:i}),E("user_gesture(:intercept) -> shallPlayAd(0: %s)",t.shallPlayAd(0)),s.muted=r.muted,await L({ads:t,content:e,state:i,adContainer:a,ima:n,config:s}),D({ads:t,content:e}))}))}({content:s,ads:i,config:e,state:c,initial:o,adContainer:l,ima:r}),!e.autoplay&&i.hasPreroll()&&c.preload&&L({ads:i,content:s,state:c,adContainer:l,ima:r,config:e}),R({config:e,root:t,content:s,ads:i,state:c,adContainer:l,ui:d,ima:r,initial:o});const u=async e=>{s.removeEventListener("beforeplay",u),i.resetScheduleCounter(),i.adapter&&(e.preventDefault(),await i.setCurrentTime(0),i.adapter.isAdPod()||i.trigger("ad-teardown"))};s.on("src",()=>{c.started&&(s.removeEventListener("beforeplay",u),s.addEventListener("beforeplay",u))}),s.on("beforeplay",e=>{(i.adBreak||i.adPlaying||i.adRequesting)&&(i.adBreak&&!i.adLinear||(E("prevented content from starting because ad break is active"),e.preventDefault()))})}async function L(e){e.state.started||(e.content.hasState("is-in-viewport")?await T(e):e.content.once("viewenter",async()=>{await T(e)}))}async function T({ads:e,content:t,adContainer:s,ima:i,state:r,config:a}){var n;r.started=!0;const o=function(e,t){var s={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(s[i[r]]=e[i[r]])}return s}(i,["ads"]),d=h(t.root),l=(null==a?void 0:a.muted)||t.muted,c=Object.assign(Object.assign(Object.assign({container:s,volume:l?0:t.volume,muted:l,autoplay:(null==a?void 0:a.autoplay)||!1,video_source:t.original_src,DisableCustomPlaybackForIOS10Plus:_,preload_ads:null===(n=null==a?void 0:a.ima)||void 0===n?void 0:n.preload_ads},o),d));E("start():",c,r),await e.initialize(!1,c,r.preload)}function O(e,t){var s,i;return{content_width:e.clientWidth||(null===(s=e.parentNode)||void 0===s?void 0:s.clientWidth)||t.clientWidth,content_height:e.clientHeight||(null===(i=e.parentNode)||void 0===i?void 0:i.clientHeight)||t.clientHeight}}function R({config:e,root:t,content:s,ads:i,initial:r,adContainer:a,state:n,ui:o,ima:d}){E("addUIListeners()"),s.once("playing",async r=>{if(i){if(E("addUIListeners() -> content started playing"),M({ads:i,content:s,state:n}),!i.shallPlayAd(0)||!i.adapter.isLinearAd())return E("addUIListeners() -> no more preroll ads -> resume content"),s.emit("ad/show-first-frame",{root:t}),await L({ads:i,content:s,state:n,adContainer:a,ima:d,config:e});s.togglePlay(!1),await L({ads:i,content:s,state:n,adContainer:a,ima:d,config:e}),i.shallPlayAd(0)&&i.adapter.isLinearAd()&&(o.classList.add("on","linear"),t.classList.add("is-waiting"),D({ads:i,content:s}))}}),s.on(["portrait","landscape"],(function(){if(!i)return;const{content_width:e,content_height:r}=O(s,t);i.resize({height:r,width:e})})),s.on("resize",e=>{if(!i||!e.detail)return;const{width:t,height:s}=e.detail.contentRect;i.resize({width:t,height:s})}),s.on("ended",e=>{var t;i&&(E("ui_listeners(:%s, event: %o)",e.type,e.detail),(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.from)!==i&&(e.preventDefault(),Object.assign(e,{prevented_from_ads:!0}),i.finished((function(){s.emit("ended",{from:i})}))))}),i.on("ad-requested",()=>{t.classList.toggle("is-waiting",!0)}),i.once("ad-started",()=>{s.on(["beforeplay","beforepause"],e=>{var t;if(!i.adBreak||!i.adapter.isLinearAd())return;e.preventDefault();const s=(null===(t=e.detail)||void 0===t?void 0:t.forced)?"beforeplay"===e.type:!i.adPlaying;s&&i.paused&&i.resume(),s||i.paused||i.pause()})}),i.on("ad-started",e=>{const a=e.detail,{linear:n,ad:d,ad_type:l}=a;let c;if(E(`Ad[linear: ${n}, currentTime: ${s.currentTime}] starting`,d),"preroll"==l&&!n&&s.paused&&s.togglePlay(!0),n&&(c=O(s,t)),i.resize({width:c?c.content_width:d.width,height:c?c.content_height:d.height,linear:n,resize_non_linear:!0}),s.emit("ad/resize",{opts:{linear:n,resizeContainerAlso:!0,width:n?void 0:d.width,height:n?void 0:d.height}}),t.classList.remove("is-waiting"),o.classList.add("on"),o.classList.toggle("linear",n),o.classList.toggle("non-linear",!n),!n){E("non-linear ad / restarting content");try{s.togglePlay(!0),s.volume=r.volume,s.muted=r.muted}catch(e){E(e)}}s.hasState("is-in-viewport")||s.hasState("is-popped-out")||!n||i.pause()}),i.on("ad-pause-content",()=>{s.emit("ad/resize",{opts:{linear:!0,width:0,height:0}})}),s.on(b,e=>async function({root:e,content:t,ads:s,ui:i,eventName:r,err:a={reason:""}}){E("teardown(event: %s)",r),e.classList.add("is-seamless"),i.classList.remove("is-vpaid"),e.classList.remove("is-waiting"),a.reason&&E("teardown(:err, reason: %s) %o",a.reason);i.classList.remove("on");const n=s.getLastAd();if(t.emit("ad/show-first-frame",{root:e}),!s.shouldRestartContent())return E("Lifecycle.teardown(:skip_restart, reason: %s)","Ad prevented restarting content"),I(e);if(t.currentTime>0&&t.currentTime>=t.duration||"postroll"==s.ad_type||!1===(null==n?void 0:n.restart))return E("Lifecycle.teardown(:skip_restart, reason: %s)","was a postroll ad"),I(e);""===t.currentSrc&&t.setSrc(t.original_src);t.paused&&s.shouldRestartContent()&&(E("Lifecycle.teardown(:toggle_play, %s)","attempting to restart content"),await t.togglePlay(!0));if(!t.paused)return E("Lifecycle.teardown(:ok)","restarted video content"),I(e)}({root:t,content:s,ads:i,ui:o,err:e.detail,eventName:e.type}));let l=!!e.autoplay;var c;s.on("viewenter",()=>{l&&!1!==d.autopause&&i.resume()}),s.on("viewleave",(c=()=>{!1!==d.autopause&&(l=!i.paused,i.pause())},e=>{setTimeout((function(){if(!e.defaultPrevented)return c(e)}),0)}))}function M({ads:e,content:t,state:s}){s.listening||(t.on(["timeupdate","seeked","playing","seeking"],s=>{e.adPlaying&&e.adapter.isLinearAd()&&!e.adapter.isSharedVideoTag()&&!t.paused&&t.pause(),D({ads:e,content:t,seek:"seeking"===s.type})}),s.listening=!0)}function D({ads:e,content:t,seek:s=!1}){e&&e.setCurrentTime(t.currentTime,void 0,s)}function I(e){e.classList.remove("is-seamless")}const P=y("ads/timers");class TimerRegistry{constructor(e={},t={}){this.intervals=e,this.timers=t}}let k=-1;function C(e,t,s){const i=setInterval(s,t);if(P("TimerRegistry.createInterval() -> "+i,e.intervals),"object"==typeof i){const t=++k;return e.intervals[t]=t,t}return e.intervals[i]=i,i}function N(e){if(e)return P("TimerRegistry.empty()",Object.keys(e.timers),Object.keys(e.intervals)),Object.keys(e.intervals).forEach(t=>function(e,t){return P("TimerRegistry.removeInterval() -> "+t,e.intervals),clearInterval(e.intervals[t]),delete e.intervals[t],e}(e,t)),Object.keys(e.timers).forEach(t=>function(e,t){return P("TimerRegistry.removeTimeout() -> "+t,e.timers),clearTimeout(e.timers[t]),delete e.timers[t],e}(e,t)),e}function U(e){try{return e.getAdPodInfo().getPodIndex()}catch(e){return}}class IMA{constructor(e){this.eventHandler=e,this.log=y("ads/adapter/ima"),this.google=window.google,this._adHandlers=[],this._timers=new TimerRegistry,this._started=!1,this._volumeLevel=0,this._adLoaded=!1,this._paused=!1,this._all_ads_completed=!1,this._currentDuration=0,this._currentRemaining=0,this._currentDisplayTs=0,this._iosPlaysInline=!1,this.sharedVideoTag=!1,this._isInitialized=!1,this._prepared=!1,this.opts={}}async init(e){this.log("init",this.videoTag,e),this.opts=e,this._dimensions={width:e.width,height:e.height,linear:e.linear},this._prepared=!0,!this._isInitialized&&this.videoTag&&await this.initAdapter()}async initAdapter(){this.log("initAdapter",this.opts);try{await this.initialize(this.opts),this._isInitialized=!0}catch(e){this.log("initAdapter failed:",e),this._prepared=!1,this.eventHandler.trigger("ad-adapter-init-failed")}}isReady(){return!!this._isInitialized}setIOSPlaysInline(e){this.log("setIOSPlaysInline",e),this.sharedVideoTag=!e,this.initialize(Object.assign(Object.assign({},this.opts),{DisableCustomPlaybackForIOS10Plus:e}))}getIOSPlaysInline(){return this._iosPlaysInline}setVideoTag(e){this.videoTag=e}isLinearAd(){return!!this._adLinear}isSharedVideoTag(){return!!this.sharedVideoTag}getVideoTag(){return this.videoTag}getDimensions(){return this._dimensions||{}}getOpts(){return this.opts}isPaused(){return this._paused}destroy(){N(this._timers),this._adHandlers&&this._adHandlers.forEach(e=>e()),this._adHandlers=void 0,this._adDisplayContainer&&this._adDisplayContainer.destroy(),this._adDisplayContainer=void 0,this._adsLoader&&this._adsLoader.destroy(),this._adsLoader=void 0,this._adsManager&&this._adsManager.destroy(),this._adsManager=void 0}stop(){this._adsManager&&this._adsManager.stop()}initialize(e){const t=this.isAdPod(),s=this._adLoaded||t;if(this.cleanup(),!this.videoTag)return console.warn("videoTag not set during initialization");this.opts=e,this._volumeLevel=e.volume;const i=this.google.ima.settings;e.NumRedirects=e.NumRedirects||e.redirects;const r={VpaidMode:this.google.ima.ImaSdkSettings.VpaidMode.INSECURE,DisableCustomPlaybackForIOS10Plus:!0};if(i.setVpaidMode(e.VpaidMode||r.VpaidMode),i.setDisableCustomPlaybackForIOS10Plus(e.DisableCustomPlaybackForIOS10Plus||r.DisableCustomPlaybackForIOS10Plus),"NumRedirects"in e&&i.setNumRedirects(e.NumRedirects),"AutoPlayAdBreaks"in e&&i.setAutoPlayAdBreaks(e.AutoPlayAdBreaks),"Locale"in e&&i.setLocale(e.Locale),"Ppid"in e&&i.setPpid(e.Ppid),!document.body.contains(e.container))throw new Error("AdDisplayContainer was not found in the document.body");this._adDisplayContainer=new this.google.ima.AdDisplayContainer(e.container,u().tizen||u().webOS?void 0:this.videoTag),this._adDisplayContainer.initialize(),this._adsLoader=new this.google.ima.AdsLoader(this._adDisplayContainer),this.log("ima.initialise(:wait -> ADS_MANAGER_LOADED)",Object.assign(Object.assign({},e),{volume:this.videoTag.volume,muted:this.videoTag.muted})),this._adsLoader.addEventListener(this.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,t=>{if(!this.videoTag)return;this.log("ima.initialise(:done -> ADS_MANAGER_LOADED)\n%o",Object.assign(Object.assign({},e),{volume:this.videoTag.volume,muted:this.videoTag.muted}));const s=new this.google.ima.AdsRenderingSettings;this.log("ima.rendering(preload: %s)",!!e.preload_ads),s.useStyledNonLinearAds=!0,s.enablePreloading=!!e.preload_ads,"number"==typeof e.media_timeout&&(s.loadVideoTimeout=e.media_timeout),s.restoreCustomPlaybackStateOnAdBreakComplete=!e.DisableCustomPlaybackForIOS10Plus,this.sharedVideoTag&&(s.playAdsAfterTime=this.videoTag.currentTime),this.eventHandler.trigger("ad-ima-rendering-settings",s);const i=this._adsManager=t.getAdsManager(this.videoTag,s);this.eventHandler.trigger("ad-ima-adapter-init",i),i.addEventListener(this.google.ima.AdEvent.Type.LOADED,()=>{this.log("debug(ima.adsManager): google.ima.AdEvent.Type.LOADED")}),i.addEventListener(this.google.ima.AdErrorEvent.Type.AD_ERROR,()=>{this.log("debug(ima.adsManager): google.ima.AdErrorEvent.Type.AD_ERROR")}),i.addEventListener(this.google.ima.AdEvent.Type.STARTED,()=>{this.log("debug(ima.adsManager): google.ima.AdEvent.Type.STARTED")}),i.addEventListener(this.google.ima.AdEvent.Type.AD_PROGRESS,e=>{var t,s;const i=null===(t=e.getAdData())||void 0===t?void 0:t.duration,r=null===(s=e.getAdData())||void 0===s?void 0:s.currentTime;isNaN(i)||isNaN(r)||(this._currentRemaining=i-r,this.eventHandler.trigger("ad-progress",{remaining:this._currentRemaining,duration:i}))}),i.addEventListener(this.google.ima.AdEvent.Type.STARTED,e=>{this._currentRemaining=-1,this.debugEvent(e);const t=e.getAd();t&&(this._currentDuration=t.getDuration(),this._currentDisplayTs=Date.now(),this.emitWithAd("ad-started",t),t.isLinear()&&IMA.pollRemaining({ima:this,adsManager:i}))}),i.addEventListener(this.google.ima.AdEvent.Type.COMPLETE,e=>{this.debugEvent(e);const t=e.getAd();t&&this.emitWithAd("ad-completed",t),N(this._timers)}),i.addEventListener(this.google.ima.AdEvent.Type.SKIPPED,e=>{this.debugEvent(e);const t=e.getAd();t&&this.emitWithAd("ad-skipped",t)}),i.addEventListener(this.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,e=>{this.debugEvent(e);const t=e.getAd();t&&this.emitWithAd("ad-pause-content",t)});const r=()=>{this._started=!1,this._currentDisplayTs=0,this.eventHandler.trigger("ad-break-completed")};i.addEventListener(this.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,e=>{this.debugEvent(e),r()}),i.addEventListener(this.google.ima.AdEvent.Type.VOLUME_CHANGED,e=>{this.log("IMA::volume(type: %s, event: %o)",e);const t=i.getVolume();this._volumeLevel=t,this.eventHandler.trigger("ad-volume-changed",t)});const a=e=>{this._paused=e,this.eventHandler.trigger(e?"ad-paused":"ad-resumed")};i.addEventListener(this.google.ima.AdEvent.Type.PAUSED,()=>a(!0)),i.addEventListener(this.google.ima.AdEvent.Type.RESUMED,()=>a(!1)),i.addEventListener(this.google.ima.AdEvent.Type.STARTED,()=>a(!1)),i.addEventListener(this.google.ima.AdEvent.Type.VOLUME_MUTED,e=>{this.log("IMA::volume(type: %s, event: %o)","mute",e),this.eventHandler.trigger("ad-muted")});const{width:n,height:o}=e;n&&o&&(i.init(n,o,this.google.ima.ViewMode.NORMAL),this.log("ima.initialise: done initializing"))}),s&&(this.log("Event(reload: %s)","reload-ad-requested"),this.eventHandler.trigger("reload-ad-requested",t)),this.eventHandler.trigger(g,this)}destroyManager(e="unknown"){if(!this._adsManager)return this.log("ima::destroyManager(:skip, label: %s)",e);this.log("ima::destroyManager(:ok, label: %s)",e),this._adsManager.destroy()}reset(){this.destroyManager("reset"),N(this._timers),this.clearAdHandlers(),this._started=!1,this._adLoaded=!1}cleanup(){this.destroyManager("cleanup"),this._adsLoader&&this._adsLoader.destroy(),this._adDisplayContainer&&this._adDisplayContainer.destroy(),this._adLoaded=!1}waitForAdsManager(){return new Promise(e=>{this.log("ima.waitForAdsManager:",this._adsManager),this.once(this._adsLoader,this.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,()=>{this.log("ima.waitForAdsManager(:ok)",this._adsManager),e(this._adsManager)})})}async initAd(e,t=5e3){this.log(`ima.initAd(adTag: ${e}, timeout: ${t})`);try{await this.requestAd(e,t),this._adLoaded=!0}catch(e){throw this.log("ima.initAd:",e),this._adLoaded=!1,e}finally{N(this._timers)}}async requestAd(e,t){if(this.destroyManager("requestAd"),!this.videoTag)return;const{autoplay:s=!1}=this.opts,i=Date.now(),r=this.videoTag.muted;this._volumeLevel=this.videoTag.volume;const a=r||0==this._volumeLevel;this._all_ads_completed=!1,this.log("ima.requestAd(%o)",Object.assign(Object.assign({},this.opts),{autoplay:s,muted:r,timeout:t,adTag:e,_volumeLevel:this._volumeLevel,manager:this._adsManager})),this.clearAdHandlers();const n=new this.google.ima.AdsRequest;n.adTagUrl=e;const{height:o,width:d}=this.opts;if(d&&(n.linearAdSlotWidth=d),o&&(n.linearAdSlotHeight=o),!this.opts.disable_non_linear_ads&&d&&(n.nonLinearAdSlotWidth=d),!this.opts.disable_non_linear_ads&&o&&(n.nonLinearAdSlotHeight=o-50),n.setAdWillAutoPlay(s),n.setAdWillPlayMuted(a),n.vastLoadTimeout=t,this.eventHandler.trigger("ad-ima-before-ads-request",{request:n}),!this._adsLoader)return;this._adsLoader.requestAds(n);return new Promise(async(e,s)=>{const r=t=>{clearTimeout(o),e(t)},n=e=>{clearTimeout(o),s(e)};this.once(this._adsLoader,this.google.ima.AdErrorEvent.Type.AD_ERROR,e=>{this.emitError("ad-request-error",e),n(new Error("Ad load failed"))});const o=setTimeout(()=>{const e=new Error("Ad internal timeout reached");this.eventHandler.trigger("ad-timeout",e),s(e)},1.5*(t+(this.opts.media_timeout||5e3))),d=await this.waitForAdsManager();this.volume(a?0:this._volumeLevel),this.eventHandler.trigger("ad-volume-changed",this._volumeLevel);const l=this.cuepoints();if(l&&l.length&&0!==l[0])return r({ad:!1,adsManager:d});this.once(d,this.google.ima.AdErrorEvent.Type.AD_ERROR,e=>{this.emitError("ad-playback-error",e),n(e)}),this.once(d,this.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{this._all_ads_completed=!0,r(null)}),this.once(d,this.google.ima.AdEvent.Type.LOADED,e=>{this.eventHandler.trigger("ad-request-completed",{request_load_time:Date.now()-i});const t=e.getAd();t&&(this.log("ima.requestAd: AD_REQUEST_COMPLETED",t.getContentType()),"application/javascript"==t.getContentType()&&this.eventHandler.trigger("vpaid-init",t),r(null))}),this.once(d,this.google.ima.AdEvent.Type.CLICK,()=>{this.log("ima.requestAd: click event"),this.pause()})})}async playAd(){if(this.log("ima.playAd()",this),!this._adsManager||!this._adLoaded)return;const e=this.currentAd();if(e&&(!this.sharedVideoTag||e.isLinear()))try{await this.startAndWaitForAdCompletion(this._adsManager,e.isLinear())}catch(e){throw this.log("ima.playAd",e),e}finally{this._adLoaded=!1,N(this._timers)}}startAndWaitForAdCompletion(e,t){if(!this._started)return this.log("ima.startAndWaitForAdCompletion(manager: %o)",{volume:e.getVolume()}),new Promise((s,i)=>{let r=!1;this.once(e,this.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,()=>{if(this.log("ima.startAndWaitForAdCompletion: CONTENT_RESUME_REQUESTED <<< happened"),this._started=!1,r)return this.log("ima.startAndWaitForAdCompletion: Content resume requested, but trying to recover from ad error");s()}),this.once(e,this.google.ima.AdErrorEvent.Type.AD_ERROR,async e=>{this.log("ima.startAndWaitForAdCompletion: beginning error recovery ->",e),r=!0;try{const{ok:t}=await IMA.pollForFatalError({err:e,ima:this});t&&(r=!1)}catch(t){this._started=!1,i(e)}});const a=this.getVideoTag();if(!a)return;const n=()=>{t&&(this._started=!0),e.start(),this.eventHandler.trigger("ad-play-requested")};if(!t||a.hasState("is-in-viewport")||a.hasState("is-popped-out"))return n();a.paused||a.pause(),a.once("viewenter",()=>n())})}pause(){this.log("ima.pause()"),this._adsManager&&this._adsManager.pause()}resume(){this.log("ima.resume()"),this._adsManager&&this._adsManager.resume()}volume(e){if(this._adsManager)try{return arguments.length>0&&"number"==typeof e&&this._adsManager.setVolume(e),this._volumeLevel=this._adsManager.getVolume()}catch(e){this.log("ima.volume() failed (%o)",e)}}onResize({width:e,height:t,linear:s,silent:i,resize_non_linear:r}){this._adsManager&&(this._adLinear=void 0===s?this._adLinear:s,this.opts&&(e||t)&&(!1===s&&(e+=10,t+=10),this._dimensions={width:e,height:t,linear:s},s&&(this.opts.width=e,this.opts.height=t),(this._adLinear||r)&&(i||this.log("ima.onResize %s x %s",e,t),this._adsManager.resize(e,t,this.google.ima.ViewMode.NORMAL))))}getAdInfo(){const e=this.currentAd();if(e)return{duration:e.getDuration(),currentTime:this._currentRemaining}}currentAd(){const e=this._adsManager;if(e)return e.getCurrentAd()}isAdPod(){const e=this.cuepoints();return!!(e&&e.length>1)}cuepoints(){return this._adsManager&&this._adsManager.getCuePoints()}async contentComplete(){this.log("ima.contentComplete() -> ",this),this._adsLoader&&this._adsLoader.contentComplete();const e=this.cuepoints();e&&-1!==e.indexOf(-1)&&await new Promise(e=>{IMA.race(this.eventHandler,["ad-break-completed","ad-error"],e)})}isUiDisabled(){try{const e=this.currentAd();return e&&e.isUiDisabled()}catch(e){return null}}getAdPodInfo(){try{const e=this.currentAd();return e&&e.getAdPodInfo()}catch(e){return null}}canDismissNonLinear(){const e=this.currentAd();if(!e||e.isLinear()||!this._adsManager||!this._currentDisplayTs)return!0;const t=Date.now(),s=e.getMinSuggestedDuration();return t-this._currentDisplayTs>1e3*s}static unwrapError(e,t){if(!e)return"";if("function"==typeof e.getMessage){return e.getMessage()}return e.message?e.message:t||""}static pollForFatalError({err:e,ima:t}){let s;try{const t=e.getError(),i=t.getInnerError(),r=i?IMA.unwrapError(i,t.message):"";s={reason:r,type:t.getType(),code:t.getErrorCode()}}catch(e){}const i=t._currentRemaining;return new Promise((e,r)=>{const a=setTimeout(()=>{t.eventHandler&&t.eventHandler.trigger("ad-playback-error",s),r(new Error("Ad not progressing"))},2500);t.eventHandler.once("ad-progress",t=>{const s=t.detail.remaining;-1!==s&&s<i&&(clearTimeout(a),e({ok:1}))})})}static pollRemaining({ima:e,adsManager:t}){let s=-1;return C(e._timers,250,(function(){const i=t.getRemainingTime();-1!=e._currentRemaining&&e._currentRemaining<=i||(e._currentRemaining=t.getRemainingTime(),s!=e._currentRemaining&&(s=e._currentRemaining,e.eventHandler.trigger("ad-progress",{remaining:e._currentRemaining,duration:e._currentDuration})))}))}once(e,t,s){this._adHandlers.push(function(e,t,s){const i=r=>{s(r),e.removeEventListener(t,i)};return e.addEventListener(t,i),()=>e.removeEventListener(t,i)}(e,t,s))}static race(e,t,s){t.forEach(i=>{const r=(...i)=>{t.forEach(t=>e.removeListener(t,r)),s(i)};e.on(i,r)})}clearAdHandlers(){this.log("ima.clearAdHandlers"),this._adHandlers.forEach(e=>e()),this._adHandlers=[]}emitWithAd(e,t){if(this.log("ima.emitWithAd",e,t),!this._adsManager)return;const s=function(e){try{return e.getAdPodInfo().getAdPosition()}catch(e){return}}(t),i=function(e){try{return e.getAdPodInfo().getTotalAds()}catch(e){return}}(t),r={ad:{duration:t.getDuration(),width:t.getWidth(),height:t.getHeight(),position:s,totals:i},volume:this._adsManager.getVolume(),vast_ad_id:t.getAdId(),linear:t.isLinear(),mime_type:t.getContentType(),ima_event:!0};this.log(`emitWithAd::event(name: ${e}, data: %o, ad: %o)`,r,t),this.eventHandler.trigger(e,r)}emitError(e,t){const s={vast_error_type:t.getError().getType(),reason:t.getError().getMessage(),vast_error:t.getError().getErrorCode()};this.log(`ima.error(${e})`,s),this.eventHandler.trigger(e,s)}debugEvent(e){try{const t=e.getAd();if(!t)return;this.log(`ima.event.${e.type} ->`,{event:e,data:e.getAdData(),position:U(t),ad:t})}catch(e){}}}var x=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){var s=function(){for(var e=new Array(256),t=0;t<256;++t)e[t]="%"+((t<16?"0":"")+t.toString(16)).toUpperCase();return e}(),i=Object.prototype.hasOwnProperty;t.arrayToObject=function(e,t){for(var s=t.plainObjects?Object.create(null):{},i=0;i<e.length;++i)void 0!==e[i]&&(s[i]=e[i]);return s},t.merge=function(e,s,r){if(!s)return e;if("object"!=typeof s){if(Array.isArray(e))e.push(s);else{if("object"!=typeof e)return[e,s];(r.plainObjects||r.allowPrototypes||!i.call(Object.prototype,s))&&(e[s]=!0)}return e}if("object"!=typeof e)return[e].concat(s);var a=e;return Array.isArray(e)&&!Array.isArray(s)&&(a=t.arrayToObject(e,r)),Object.keys(s).reduce((function(e,a){var n=s[a];return i.call(e,a)?e[a]=t.merge(e[a],n,r):e[a]=n,e}),a)},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),i="",r=0;r<t.length;++r){var a=t.charCodeAt(r);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?i+=t.charAt(r):a<128?i+=s[a]:a<2048?i+=s[192|a>>6]+s[128|63&a]:a<55296||a>=57344?i+=s[224|a>>12]+s[128|a>>6&63]+s[128|63&a]:(r+=1,a=65536+((1023&a)<<10|1023&t.charCodeAt(r)),i+=s[240|a>>18]+s[128|a>>12&63]+s[128|a>>6&63]+s[128|63&a])}return i},t.compact=function(e,s){if("object"!=typeof e||null===e)return e;var i=s||[],r=i.indexOf(e);if(-1!==r)return i[r];if(i.push(e),Array.isArray(e)){for(var a=[],n=0;n<e.length;++n)e[n]&&"object"==typeof e[n]?a.push(t.compact(e[n],i)):void 0!==e[n]&&a.push(e[n]);return a}for(var o=Object.keys(e),d=0;d<o.length;++d){var l=o[d];e[l]=t.compact(e[l],i)}return e},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null!=e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}})),F={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},q={delimiter:"&",strictNullHandling:!1,skipNulls:!1,encode:!0,encoder:x.encode},B=function e(t,s,i,r,a,n,o,d,l){var c=t;if("function"==typeof o)c=o(s,c);else if(c instanceof Date)c=c.toISOString();else if(null===c){if(r)return n?n(s):s;c=""}if("string"==typeof c||"number"==typeof c||"boolean"==typeof c||x.isBuffer(c))return n?[n(s)+"="+n(c)]:[s+"="+String(c)];var u,h=[];if(void 0===c)return h;if(Array.isArray(o))u=o;else{var p=Object.keys(c);u=d?p.sort(d):p}for(var g=0;g<u.length;++g){var m=u[g];a&&null===c[m]||(h=Array.isArray(c)?h.concat(e(c[m],i(s,m),i,r,a,n,o,d,l)):h.concat(e(c[m],s+(l?"."+m:"["+m+"]"),i,r,a,n,o,d,l)))}return h},j=Object.prototype.hasOwnProperty,V={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1,decoder:x.decode},z=function(e,t,s){if(e){var i=s.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,r=/(\[[^[\]]*])/g,a=/(\[[^[\]]*])/.exec(i),n=a?i.slice(0,a.index):i,o=[];if(n){if(!s.plainObjects&&j.call(Object.prototype,n)&&!s.allowPrototypes)return;o.push(n)}for(var d=0;null!==(a=r.exec(i))&&d<s.depth;){if(d+=1,!s.plainObjects&&j.call(Object.prototype,a[1].slice(1,-1))&&!s.allowPrototypes)return;o.push(a[1])}return a&&o.push("["+i.slice(a.index)+"]"),function e(t,s,i){if(!t.length)return s;var r,a=t.shift();if("[]"===a)r=(r=[]).concat(e(t,s,i));else{r=i.plainObjects?Object.create(null):{};var n="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,o=parseInt(n,10);!isNaN(o)&&a!==n&&String(o)===n&&o>=0&&i.parseArrays&&o<=i.arrayLimit?(r=[])[o]=e(t,s,i):r[n]=e(t,s,i)}return r}(o,t,s)}},H=function(e,t){var s,i,r=e,a=t||{},n=void 0===a.delimiter?q.delimiter:a.delimiter,o="boolean"==typeof a.strictNullHandling?a.strictNullHandling:q.strictNullHandling,d="boolean"==typeof a.skipNulls?a.skipNulls:q.skipNulls,l=("boolean"==typeof a.encode?a.encode:q.encode)?"function"==typeof a.encoder?a.encoder:q.encoder:null,c="function"==typeof a.sort?a.sort:null,u=void 0!==a.allowDots&&a.allowDots;if(null!==a.encoder&&void 0!==a.encoder&&"function"!=typeof a.encoder)throw new TypeError("Encoder has to be a function.");"function"==typeof a.filter?r=(i=a.filter)("",r):Array.isArray(a.filter)&&(s=i=a.filter);var h,p=[];if("object"!=typeof r||null===r)return"";h=a.arrayFormat in F?a.arrayFormat:"indices"in a?a.indices?"indices":"repeat":"indices";var g=F[h];s||(s=Object.keys(r)),c&&s.sort(c);for(var m=0;m<s.length;++m){var _=s[m];d&&null===r[_]||(p=p.concat(B(r[_],_,g,o,d,l,i,c,u)))}return p.join(n)},G=function(e,t){var s=t||{};if(null!==s.decoder&&void 0!==s.decoder&&"function"!=typeof s.decoder)throw new TypeError("Decoder has to be a function.");if(s.delimiter="string"==typeof s.delimiter||x.isRegExp(s.delimiter)?s.delimiter:V.delimiter,s.depth="number"==typeof s.depth?s.depth:V.depth,s.arrayLimit="number"==typeof s.arrayLimit?s.arrayLimit:V.arrayLimit,s.parseArrays=!1!==s.parseArrays,s.decoder="function"==typeof s.decoder?s.decoder:V.decoder,s.allowDots="boolean"==typeof s.allowDots?s.allowDots:V.allowDots,s.plainObjects="boolean"==typeof s.plainObjects?s.plainObjects:V.plainObjects,s.allowPrototypes="boolean"==typeof s.allowPrototypes?s.allowPrototypes:V.allowPrototypes,s.parameterLimit="number"==typeof s.parameterLimit?s.parameterLimit:V.parameterLimit,s.strictNullHandling="boolean"==typeof s.strictNullHandling?s.strictNullHandling:V.strictNullHandling,""===e||null==e)return s.plainObjects?Object.create(null):{};for(var i="string"==typeof e?function(e,t){for(var s={},i=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),r=0;r<i.length;++r){var a,n,o=i[r],d=-1===o.indexOf("]=")?o.indexOf("="):o.indexOf("]=")+1;-1===d?(a=t.decoder(o),n=t.strictNullHandling?null:""):(a=t.decoder(o.slice(0,d)),n=t.decoder(o.slice(d+1))),j.call(s,a)?s[a]=[].concat(s[a]).concat(n):s[a]=n}return s}(e,s):e,r=s.plainObjects?Object.create(null):{},a=Object.keys(i),n=0;n<a.length;++n){var o=a[n],d=z(o,i[o],s);r=x.merge(r,d,s)}return x.compact(r)};const Q=y("fpads:macros"),W=/\[([\s\S]+?)\]/g;class Macros{constructor(e={},t=W){this.vars=e,this.pattern=t}static run(e){try{return e()}catch(e){return void console.error(e)}}static merge(...e){return e.reduce((e,t)=>Object.assign(e,t),{})}static cast(e){return void 0===e?"":"function"==typeof e?encodeURIComponent(Macros.run(e)||""):"string"==typeof e?encodeURIComponent(e):"number"==typeof e||"boolean"==typeof e?e.toString():""}static normalize(e){return e.trim()}static process_obj(e,t,s){return Object.keys(e).reduce((i,r)=>{const a=Macros.process_str(r,t,s,!0),n=e[r];return null===n?(i[a]=n,i):"object"==typeof n?(i[a]=Macros.process_obj(n,t,s),i):"string"==typeof n?(i[a]=Macros.process_str(n,t,s),i):(console.error(new Error(`${n} at ${r} not a handled Macro type`)),i)},{})}static process_str(e,t,s,i=!1){return e.replace(t.pattern,(e,t)=>{const r=Macros.normalize(t);if(!(r in s)||void 0===s[r])return e;const a=s[r],n=i?a:Macros.cast(a);return Q("Macro.replace(raw: %s, macro: %s, value: %s)",i,t,n),n})}fork(e={},t=this.pattern){const s=Macros.merge(this.vars,e);return new Macros(s,t)}compile(e,t={}){const s=Macros.merge(this.vars,t),[i,r]=e.split("?"),a=G(r||"",{strictNullHandling:!0,decoder:e=>e}),n=H(Macros.process_obj(a,this,s),{encode:!1,strictNullHandling:!0});return Macros.process_str(i,this,s,!0)+"?"+n}}function $(e,t={width:0,height:0}){let s,i;try{const e=document.createElement("a");e.href=s=window.location!=window.parent.location?document.referrer:document.location.href,i=e.hostname}catch(e){console.error(e)}const{width:r,height:a}=t,{video_source:n}=e||{},o=function(){const e=window;return"object"==typeof e.__flowplayerAdParameters?e.__flowplayerAdParameters:{}}();return Object.assign({random:Date.now(),page_url:s,domain:i,player_width:r,player_height:a,video_url:n,videourl:n},o)}Macros.patterns={BRACKETS:W,CURLY:/\{([\s\S]+?)\}/g,UNDERSCORE:/__([\s\S]+?)__/g};const K=/^flowplayer:\/\/(.+)/;async function Y(e){if("string"==typeof e&&K.test(e)){const t=K.exec(e),s=t&&window[t[1]];if(s)return Y(s)}if("function"!=typeof e)return e;try{return await e()}catch(e){return""}}class Schedule{constructor(e,t={}){this._ads=e,this._opts=t,this._nextIndex=0,this._postroll=void 0,this._loadPending=!1,this._postrollActive=!1,this.reset(this._ads)}toJSON(){const e=(this._ads||[]).slice(this._nextIndex);return this._postroll&&e.push(this._postroll),e}reset(e){this.setAds(e),this._nextIndex=0,this._postrollActive=!1}resetCounter(){this._nextIndex=0,this._postrollActive=!1}setAds(e){this._ads=e||[],this.sort()}getAds(){return this._ads}getNextAd(e){return this._ads[this._nextIndex]||e}getCurrentAd(){return this._postrollActive?this._postroll:this._loadPending?0:this._ads[this._nextIndex-1]}getPostroll(){return this._postroll}isDrained(){return this._nextIndex+1>this._ads.length}setPostrollActive(){this._postrollActive=!0}updateContentDuration(e){this._opts.content_duration=e}increment(){++this._nextIndex}decrement(){this._nextIndex>0&&--this._nextIndex}getNextIndex(){return this._nextIndex}getCurrentType(){const e=this.getCurrentAd();if(e)return Schedule.kindOf(e.time)}sort(){this._postroll=this._ads.find(e=>-1===e.time),this._ads=this._ads.filter(e=>e!==this._postroll).sort((e,t)=>e.time===t.time?this._ads.indexOf(e)-this._ads.indexOf(t):e.time-t.time)}shallPlayAd(e){if(this._loadPending)return!1;const t=this.getCurrentAd()||this.getNextAd();return!!(t&&t.time<=e&&-1!==t.time)}shallPlayNext(){const e=this.getNextAd(),t=this.getCurrentAd();return!(!e||!t||e.time!==t.time)}waitForLoad(e,t,s){if(this._loadPending=!1,!t)return!1;const i=s?this._opts.preload_advance:0;return t.time>=0?this._loadPending=e<t.time-i:-1===t.time&&(this._loadPending=this._opts.content_duration>0&&-1!==e?e<this._opts.content_duration-i:-1!==e),this._loadPending}static hasPreroll(e){return!!e.find(e=>0===e.time)}static isOutstream(e){return Schedule.hasPreroll(e)&&!!e[0].outstream}static kindOf(e){switch(e){case 0:return"preroll";case-1:return"postroll";default:return"midroll"}}}const Z=Object.prototype,J=Object.getPrototypeOf;const X=y("fpads:ads:state");var ee;!function(e){e[e.IDLE=0]="IDLE",e[e.INITIALIZING=1]="INITIALIZING",e[e.FETCHING_AD=2]="FETCHING_AD",e[e.AD_AVAILABLE=4]="AD_AVAILABLE",e[e.BREAK_ACTIVE=8]="BREAK_ACTIVE",e[e.PLAYING=16]="PLAYING",e[e.FATAL_ERROR=32]="FATAL_ERROR"}(ee||(ee={}));class AdsState{constructor(e=0){this._state=e}static of(){return new AdsState}reset(){this._state=0}toggleState(e,t){return void 0===e&&X(new Error("AdState cannot toggleState for `undefined`")),null==typeof t?this._state^=e:t?void(this._state|=e):this._state&=~e}hasAll(e){return this._state==(this._state|e)}hasAny(e){return!!(this._state&e)}get state(){return this._state}}function te(e,t,s){const i=function(e,t){const s=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(s,"data",{get:()=>t}),s}(t,s);return e.dispatchEvent(i),e}!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const se={ok:y("fpads:analytics:request-queue"),err:y("fpads:analytics:request-queue:err"),warn:y("fpads:analytics:request-queue:warn")};class RequestQueue{constructor(e=[],t=[],s={failures:0,ttl:0}){this.pending=e,this.open=t,this.stats=s}static of(){return new RequestQueue}static is_empty(e){return 0==e.pending.length}static is_high_water(e){return e.open.length==RequestQueue.MAX_OPEN_REQUESTS}static maybe_spawn_req(e){if(RequestQueue.is_empty(e))return se.ok("maybe_spawn_req called Queue that is EMPTY"),e;if(RequestQueue.is_high_water(e))return se.warn("maybe_spawn_req called on Queue that is HIGH_WATER"),e;try{const t=RequestQueue.lpop(e);t&&RequestQueue.request(e,t)}catch(e){se.err(e)}}static increment_failures(e){return e.stats.failures++,e.stats.failures>RequestQueue.MAX_FAILURE_COUNT&&(e.stats.ttl=Date.now()+RequestQueue.REQUEST_TTL_MS),e}static handle_error(e,t){RequestQueue.rm(e,t),RequestQueue.increment_failures(e)}static request(e,[t,s,i]){if(se.ok(`Request[${i.event_type}] request`,i,e.stats),Date.now()<e.stats.ttl)return se.warn(`Request[${i.event_type}] skipping because too many errors too quickly`,e.stats);const r=new XMLHttpRequest;e.open.push(r),r.timeout=RequestQueue.REQUEST_TIMEOUT_MS,r.ontimeout=function(){RequestQueue.handle_error(e,r),se.warn(`Request[${i.event_type}] timed out in ${r.timeout}ms`,e.stats)},r.onerror=function(t){RequestQueue.handle_error(e,r),t&&se.err(t),se.warn(`Request[${i.event_type}] encountered an Error`,r.responseText,e.stats)},r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&RequestQueue.rm(e,r),Math.floor(r.status/100)},r.onload=function(){RequestQueue.rm(e,r),e.stats.failures&&e.stats.failures--,se.ok(`Request[${i.event_type}] :ok`,r.status)},r.open(s,t),r.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{r.send(JSON.stringify(i))}catch(e){se.err(e)}}static rpush(e,...t){return t.forEach(t=>{if(RequestQueue.is_high_water(e))return se.warn("Too many open requests, skipping",e.stats);e.pending.push(t),RequestQueue.maybe_spawn_req(e)}),e}static lpop(e){return e.pending.shift()}static rm(e,t){const s=e.open.lastIndexOf(t);return~s&&e.open.splice(s,1),e}}RequestQueue.MAX_OPEN_REQUESTS=3,RequestQueue.REQUEST_TIMEOUT_MS=4e3,RequestQueue.REQUEST_TTL_MS=5e3,RequestQueue.MAX_FAILURE_COUNT=3;const ie={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},re={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},ae={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},ne={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},oe={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class Utils{static getFirstMatch(e,t){const s=t.match(e);return s&&s.length>0&&s[1]||""}static getSecondMatch(e,t){const s=t.match(e);return s&&s.length>1&&s[2]||""}static matchAndReturnConst(e,t,s){if(e.test(t))return s}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map(e=>parseInt(e,10)||0);if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map(e=>parseInt(e,10)||0);if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,s=!1){const i=Utils.getVersionPrecision(e),r=Utils.getVersionPrecision(t);let a=Math.max(i,r),n=0;const o=Utils.map([e,t],e=>{const t=a-Utils.getVersionPrecision(e),s=e+new Array(t+1).join(".0");return Utils.map(s.split("."),e=>new Array(20-e.length).join("0")+e).reverse()});for(s&&(n=a-Math.min(i,r)),a-=1;a>=n;){if(o[0][a]>o[1][a])return 1;if(o[0][a]===o[1][a]){if(a===n)return 0;a-=1}else if(o[0][a]<o[1][a])return-1}}static map(e,t){const s=[];let i;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(i=0;i<e.length;i+=1)s.push(t(e[i]));return s}static find(e,t){let s,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(s=0,i=e.length;s<i;s+=1){const i=e[s];if(t(i,s))return i}}static assign(e,...t){const s=e;let i,r;if(Object.assign)return Object.assign(e,...t);for(i=0,r=t.length;i<r;i+=1){const e=t[i];if("object"==typeof e&&null!==e){Object.keys(e).forEach(t=>{s[t]=e[t]})}}return e}static getBrowserAlias(e){return ie[e]}static getBrowserTypeByAlias(e){return re[e]||""}}const de=/version\/(\d+(\.?_?\d+)+)/i,le=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},s=Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},s=Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},s=Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},s=Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},s=Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},s=Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},s=Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},s=Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},s=Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},s=Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},s=Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},s=Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},s=Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},s=Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},s=Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return s&&(t.version=s),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},s=Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},s=Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},s=Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},s=Utils.getFirstMatch(de,e)||Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},s=Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},s=Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},s=Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},s=Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},s=Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},s=Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},s=Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},s=Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},s=Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test(e){const t=!e.test(/like android/i),s=e.test(/android/i);return t&&s},describe(e){const t={name:"Android Browser"},s=Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},s=Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},s=Utils.getFirstMatch(de,e);return s&&(t.version=s),t}},{test:[/.*/i],describe(e){const t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:Utils.getFirstMatch(t,e),version:Utils.getSecondMatch(t,e)}}}];var ce=[{test:[/Roku\/DVP/],describe(e){const t=Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:ne.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:ne.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),s=Utils.getWindowsVersionName(t);return{name:ne.Windows,version:t,versionName:s}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:ne.iOS},s=Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return s&&(t.version=s),t}},{test:[/macintosh/i],describe(e){const t=Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),s=Utils.getMacOSVersionName(t),i={name:ne.MacOS,version:t};return s&&(i.versionName=s),i}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:ne.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),s=e.test(/android/i);return t&&s},describe(e){const t=Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),s=Utils.getAndroidVersionName(t),i={name:ne.Android,version:t};return s&&(i.versionName=s),i}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),s={name:ne.WebOS};return t&&t.length&&(s.version=t),s}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=Utils.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||Utils.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||Utils.getFirstMatch(/\bbb(\d+)/i,e);return{name:ne.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:ne.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:ne.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:ne.Linux})},{test:[/CrOS/],describe:()=>({name:ne.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:ne.PlayStation4,version:t}}}],ue=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(e){const t=Utils.getFirstMatch(/(can-l01)/i,e)&&"Nova",s={type:ae.mobile,vendor:"Huawei"};return t&&(s.model=t),s}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:ae.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:ae.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:ae.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:ae.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:ae.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:ae.tablet})},{test(e){const t=e.test(/ipod|iphone/i),s=e.test(/like (ipod|iphone)/i);return t&&!s},describe(e){const t=Utils.getFirstMatch(/(ipod|iphone)/i,e);return{type:ae.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:ae.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:ae.mobile})},{test:e=>"blackberry"===e.getBrowserName(!0),describe:()=>({type:ae.mobile,vendor:"BlackBerry"})},{test:e=>"bada"===e.getBrowserName(!0),describe:()=>({type:ae.mobile})},{test:e=>"windows phone"===e.getBrowserName(),describe:()=>({type:ae.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:()=>({type:ae.tablet})},{test:e=>"android"===e.getOSName(!0),describe:()=>({type:ae.mobile})},{test:e=>"macos"===e.getOSName(!0),describe:()=>({type:ae.desktop,vendor:"Apple"})},{test:e=>"windows"===e.getOSName(!0),describe:()=>({type:ae.desktop})},{test:e=>"linux"===e.getOSName(!0),describe:()=>({type:ae.desktop})},{test:e=>"playstation 4"===e.getOSName(!0),describe:()=>({type:ae.tv})},{test:e=>"roku"===e.getOSName(!0),describe:()=>({type:ae.tv})}],he=[{test:e=>"microsoft edge"===e.getBrowserName(!0),describe(e){if(/\sedg\//i.test(e))return{name:oe.Blink};const t=Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:oe.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:oe.Trident},s=Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:e=>e.test(/presto/i),describe(e){const t={name:oe.Presto},s=Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test(e){const t=e.test(/gecko/i),s=e.test(/like gecko/i);return t&&!s},describe(e){const t={name:oe.Gecko},s=Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:oe.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:oe.WebKit},s=Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}}];class Parser{constructor(e,t=!1){if(null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=Utils.find(le,e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=Utils.find(ce,e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=Utils.find(ue,e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=Utils.find(he,e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return Utils.assign({},this.parsedResult)}satisfies(e){const t={};let s=0;const i={};let r=0;if(Object.keys(e).forEach(a=>{const n=e[a];"string"==typeof n?(i[a]=n,r+=1):"object"==typeof n&&(t[a]=n,s+=1)}),s>0){const e=Object.keys(t),s=Utils.find(e,e=>this.isOS(e));if(s){const e=this.satisfies(t[s]);if(void 0!==e)return e}const i=Utils.find(e,e=>this.isPlatform(e));if(i){const e=this.satisfies(t[i]);if(void 0!==e)return e}}if(r>0){const e=Object.keys(i),t=Utils.find(e,e=>this.isBrowser(e,!0));if(void 0!==t)return this.compareVersion(i[t])}}isBrowser(e,t=!1){const s=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const r=Utils.getBrowserTypeByAlias(i);return t&&r&&(i=r.toLowerCase()),i===s}compareVersion(e){let t=[0],s=e,i=!1;const r=this.getBrowserVersion();if("string"==typeof r)return">"===e[0]||"<"===e[0]?(s=e.substr(1),"="===e[1]?(i=!0,s=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?s=e.substr(1):"~"===e[0]&&(i=!0,s=e.substr(1)),t.indexOf(Utils.compareVersions(r,s,i))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(e=>this.is(e))}}
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.ads=t())}(this,(function(){"use strict";var e;!function(e){e[e.ADS=2]="ADS",e[e.ANALYTICS=4]="ANALYTICS",e[e.NO_METERING=8]="NO_METERING",e[e.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",e[e.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(e||(e={}));const t=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function s(e,s){return!!~t.indexOf(e)||e.indexOf(s)===e.length-s.length}s.check_whitelist=function(e){return!!~t.indexOf(e)};function i(e){this.message=e}i.prototype=new Error,i.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new i("'atob' failed: The string to be decoded is not correctly encoded.");for(var s,r,a=0,n=0,o="";r=t.charAt(n++);~r&&(s=a%4?64*s+r:r,a++%4)?o+=String.fromCharCode(255&s>>(-2*a&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o};var a=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,t){var s=t.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s})))}(t)}catch(e){return r(t)}};function n(e){this.message=e}n.prototype=new Error,n.prototype.name="InvalidTokenError";var o=function(e,t){if("string"!=typeof e)throw new n("Invalid token specified");var s=!0===(t=t||{}).header?0:1;try{return JSON.parse(a(e.split(".")[s]))}catch(e){throw new n("Invalid token specified: "+e.message)}};o.InvalidTokenError=n;const d="production";function l(e,t){const s={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let i={c:"{}",exp:0};t=t||{};try{i=o(e),s.valid_jwt=!0}catch(e){}return s.raw=e,s.data=JSON.parse(i.c),s.exp=i.exp,t.require_valid_token&&l.validate(s),s}function c(e){return{grant:e,is_granted:t=>(e&t)===t}}function u(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",s=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),i=/Android/.test(t)&&!/Firefox/.test(t),r=/^((?!chrome|android).)*safari/i.test(t),a=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),n=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),o=/edg/i.test(t),d=/opr|opera/i.test(t),l=/SamsungBrowser/.test(t),c=l&&/SMART-TV/.test(t);return{controls:!s,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:i,iphone:s,safari:r,edge:o,opera:d,chrome:a,firefox:n,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:l,samsung_tv:l&&c,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}}function h(e){return{width:e.clientWidth,height:e.clientHeight}}function p(e,t,s){return"number"==typeof s&&(s+="px"),e.style.setProperty(t,s),e}l.validate=function(e){if("string"==typeof e&&(e=l(e)),!e||!e.raw){if(s.check_whitelist(window.location.hostname)||"dev"===d.toString())return!0;throw new Error("No token provided in configuration")}if(!e.valid_jwt)throw new Error("Invalid token provided");const t=window.location.hostname,i=s.bind(null,t);if("dev"!==d.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(i))throw new Error("Domain not allowed");if("dev"!==d.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},l.id=function(e){if(e)return"string"==typeof e&&(e=l(e)),e.data.id},c.of=c,c.from_token=function(e){const t=l(e,{require_valid_token:!0});return c.of(t.data.acl)},c.permissions=e;const g="ad-initialized";var m=Object.freeze({__proto__:null,AD_INIT:g,AD_PLAYBACK_ERROR:"ad-playback-error",AD_TEARDOWN:"ad-teardown",AD_VIDEOTAG_ATTACHED:"ad-videotag-attached",AD_BLOCKED:"ad-blocked",AD_REQUEST_ERROR:"ad-request-error",AD_REQUESTED:"ad-requested",AD_REQUEST_COMPLETED:"ad-request-completed",AD_PAUSE_CONTENT:"ad-pause-content",AD_STARTED:"ad-started",AD_COMPLETED:"ad-completed",AD_PAUSED:"ad-paused",AD_RESUMED:"ad-resumed",AD_WAITING:"ad-waiting",AD_PROGRESS:"ad-progress",AD_SKIPPED:"ad-skipped",AD_MUTED:"ad-muted",AD_VOLUME_CHANGED:"ad-volume-changed",AD_FULLSCREEN:"ad-fullscreen",AD_TIMEOUT:"ad-timeout",AD_BREAK_COMPLETED:"ad-break-completed",AD_POSTROLL_FINISHED:"ad-postroll-finished",AD_PREROLL_FINSIHED:"ad-preroll-finished",AD_MIDROLL_FINISHED:"ad-midroll-finished",VPAID_INIT:"vpaid-init",IMA_ADAPTER_INIT:"ad-ima-adapter-init",IMA_BEFORE_ADS_REQUEST:"ad-ima-before-ads-request",IMA_ADS_RENDERING_SETTINGS:"ad-ima-rendering-settings",ADAPTER_INIT_FAILED:"ad-adapter-init-failed",AD_PLAY_REQUESTED:"ad-play-requested",RELOAD_AD_REQUESTED:"reload-ad-requested",AD_ERROR:"ad-error",REQUEST_AD_PAUSE:"request/ad/pause",REQUEST_AD_PLAY:"request/ad/play",REQUEST_AD_MUTE_UNMUTE:"request/ad/muteunmute",AD_HIDE_FIRST_FRAME:"ad/hide-first-frame",AD_SHOW_FIRST_FRAME:"ad/show-first-frame",AD_RESIZE:"ad/resize",AD_SET_UI_FLAGS:"ad/set-ui-flags"});const _="undefined"!=typeof document&&"undefined"!=typeof window&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;const f="is-in-viewport";var y;function v(e,t){const s=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),i=(i,...r)=>{try{const a=(null==t?void 0:t.debug)||s;a&&e.match(a)&&console.log(`flowplayer/${e} -- ${i}`,...r)}catch(e){console.warn(e)}};return i.log=i,i}!function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(y||(y={}));const A=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const i=window.customElements.get(t);if(!i)throw new Error(`no default flowplayer component with the name ${t} exists`);const r=window.customElements.get(s);return"function"!=typeof r?i:r})(e._customElements,t))(e),w=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)},b="flowplayer-ad-ui",E=v("ads/lifecycle"),S=["ad-playback-error","ad-teardown","ad-break-completed"];async function L({config:e,root:t,content:s,ads:i,ima:r}){var a;E("LifeCycle::initLifeCycle",e,t,s,i,r),s.autoplay=!1;const n=e.autoplay===y.AUDIO_REQUIRED,o=function(e,t){return{muted:!(t||!e.muted),volume:e.volume}}(s,n);s.on("volumechange",()=>{o.volume=s.volume,o.muted=s.muted});const d=A(s,b),l=d.adContainer;s.emit("ad/set-ui-flags",{ui_flags:null===(a=e.ads)||void 0===a?void 0:a.ui}),s.renderPlugin(d);const c={listening:!1,preload:null==r?void 0:r.preload_ads};if(E("initial",o),i.setVideoTag(s),e.autoplay){E("Trying to autoplay"),s.emit("ad/hide-first-frame",{root:t});await async function e(t,s){const[i,r]=[t.muted,t.volume];E("Lifecycle::peek_content(:muted => %s, :volume => %s)",i,r);const a=()=>new Promise(e=>setTimeout(e,0,!1));s&&(t.muted=!1,t.volume=t.volume?t.volume:1);try{if(await async function(e){return E("Lifecycle::wait_for_source"),new Promise((t,s)=>{let i=0;const r=setInterval(()=>{if(++i>40)return clearInterval(r),s(new Error("No source in 2000ms, giving up"));e.currentSrc&&(t(null),clearInterval(r))},50)})}(t),await function(e){return new Promise(t=>{if(e.hasState(f))return t(null);e.once("viewenter",()=>t(null))})}(t),E("Lifecycle::peek_content::play"),t.volume&&(t.volume=.01),await new Promise(e=>setTimeout(()=>{s&&(t.opts.autoplay=2),t.setState("is-autoplay",!0),e(t.togglePlay(!0))})),t.paused)throw new Error("content failed to play");return E("Lifecycle::peek_content::pause"),await new Promise(e=>setTimeout(()=>e(t.togglePlay(!1)))),t.volume=r,E("Lifecycle::peek_content::true"),!0}catch(n){return t.volume=r,s?(t.muted=!1,0==t.volume&&(t.volume=1),await a()):i||!r?(E("Lifecycle::peek_content::false"),await a()):(E("Lifecycle::peek_content::recover"),t.muted=!0,!!await e(t)||(t.muted=i,E("Lifecycle::peek_content::false"),await a()))}}(s,n)?(E("Can autoplay, start ad"),s.opts.autoplay=1,T({ads:i,content:s,state:c,adContainer:l,ima:r,config:e})):(E("cannot autoplay(audioRequired: %s), fallback to poster state",n),e.autoplay=0,s.emit("ad/show-first-frame",{root:t}),s.setState("is-starting",!0))}e.autoplay||i.hasPreroll()&&function({content:e,ads:t,config:s,state:i,initial:r,adContainer:a,ima:n}){e.once("beforeplay",(async function(o){var d;(e.hasState(f)||"touchend"!=o.type)&&t.shallPlayAd(0)&&(_&&(null===(d=s.ima)||void 0===d?void 0:d.disable_content_peek_prevent_on_ios)||o.preventDefault(),D({ads:t,content:e,state:i}),E("user_gesture(:intercept) -> shallPlayAd(0: %s)",t.shallPlayAd(0)),s.muted=r.muted,await T({ads:t,content:e,state:i,adContainer:a,ima:n,config:s}),I({ads:t,content:e}))}))}({content:s,ads:i,config:e,state:c,initial:o,adContainer:l,ima:r}),!e.autoplay&&i.hasPreroll()&&c.preload&&T({ads:i,content:s,state:c,adContainer:l,ima:r,config:e}),M({config:e,root:t,content:s,ads:i,state:c,adContainer:l,ui:d,ima:r,initial:o});const u=async e=>{s.removeEventListener("beforeplay",u),i.resetScheduleCounter(),i.adapter&&(e.preventDefault(),await i.setCurrentTime(0),i.adapter.isAdPod()||i.trigger("ad-teardown"))};s.on("src",()=>{c.started&&(s.removeEventListener("beforeplay",u),s.addEventListener("beforeplay",u))}),s.on("beforeplay",e=>{(i.adBreak||i.adPlaying||i.adRequesting)&&(i.adBreak&&!i.adLinear||(E("prevented content from starting because ad break is active"),e.preventDefault()))})}async function T(e){e.state.started||(e.content.hasState(f)?await O(e):e.content.once("viewenter",async()=>{await O(e)}))}async function O({ads:e,content:t,adContainer:s,ima:i,state:r,config:a}){var n;r.started=!0;const o=function(e,t){var s={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(s[i[r]]=e[i[r]])}return s}(i,["ads"]),d=h(t.root),l=(null==a?void 0:a.muted)||t.muted,c=Object.assign(Object.assign(Object.assign({container:s,volume:l?0:t.volume,muted:l,autoplay:(null==a?void 0:a.autoplay)||!1,video_source:t.original_src,DisableCustomPlaybackForIOS10Plus:_,preload_ads:null===(n=null==a?void 0:a.ima)||void 0===n?void 0:n.preload_ads},o),d));E("start():",c,r),await e.initialize(!1,c,r.preload)}function R(e,t){var s,i;return{content_width:e.clientWidth||(null===(s=e.parentNode)||void 0===s?void 0:s.clientWidth)||t.clientWidth,content_height:e.clientHeight||(null===(i=e.parentNode)||void 0===i?void 0:i.clientHeight)||t.clientHeight}}function M({config:e,root:t,content:s,ads:i,initial:r,adContainer:a,state:n,ui:o,ima:d}){E("addUIListeners()"),s.once("playing",async r=>{if(i){if(E("addUIListeners() -> content started playing"),D({ads:i,content:s,state:n}),!i.shallPlayAd(0)||!i.adapter.isLinearAd())return E("addUIListeners() -> no more preroll ads -> resume content"),s.emit("ad/show-first-frame",{root:t}),await T({ads:i,content:s,state:n,adContainer:a,ima:d,config:e});s.togglePlay(!1),await T({ads:i,content:s,state:n,adContainer:a,ima:d,config:e}),i.shallPlayAd(0)&&i.adapter.isLinearAd()&&(o.classList.add("on","linear"),t.classList.add("is-waiting"),I({ads:i,content:s}))}}),s.on(["portrait","landscape"],(function(){if(!i)return;const{content_width:e,content_height:r}=R(s,t);i.resize({height:r,width:e})})),s.on("resize",e=>{if(!i||!e.detail)return;const{width:t,height:s}=e.detail.contentRect;i.resize({width:t,height:s})}),s.on("ended",e=>{var t;i&&(E("ui_listeners(:%s, event: %o)",e.type,e.detail),(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.from)!==i&&(e.preventDefault(),Object.assign(e,{prevented_from_ads:!0}),i.finished((function(){s.emit("ended",{from:i})}))))}),i.on("ad-requested",()=>{t.classList.toggle("is-waiting",!0)}),i.once("ad-started",()=>{s.on(["beforeplay","beforepause"],e=>{var t;if(!i.adBreak||!i.adapter.isLinearAd())return;e.preventDefault();const s=(null===(t=e.detail)||void 0===t?void 0:t.forced)?"beforeplay"===e.type:!i.adPlaying;s&&i.paused&&i.resume(),s||i.paused||i.pause()})}),i.on("ad-started",e=>{const a=e.detail,{linear:n,ad:d,ad_type:l}=a;let c;if(E(`Ad[linear: ${n}, currentTime: ${s.currentTime}] starting`,d),"preroll"==l&&!n&&s.paused&&s.togglePlay(!0),n&&(c=R(s,t)),i.resize({width:c?c.content_width:d.width,height:c?c.content_height:d.height,linear:n,resize_non_linear:!0}),s.emit("ad/resize",{opts:{linear:n,resizeContainerAlso:!0,width:n?void 0:d.width,height:n?void 0:d.height}}),t.classList.remove("is-waiting"),o.classList.add("on"),o.classList.toggle("linear",n),o.classList.toggle("non-linear",!n),!n){E("non-linear ad / restarting content");try{s.togglePlay(!0),s.volume=r.volume,s.muted=r.muted}catch(e){E(e)}}s.hasState(f)||s.hasState("is-popped-out")||!n||i.pause()}),i.on("ad-pause-content",()=>{s.emit("ad/resize",{opts:{linear:!0,width:0,height:0}})}),s.on(S,e=>async function({root:e,content:t,ads:s,ui:i,eventName:r,err:a={reason:""}}){E("teardown(event: %s)",r),e.classList.add("is-seamless"),i.classList.remove("is-vpaid"),e.classList.remove("is-waiting"),a.reason&&E("teardown(:err, reason: %s) %o",a.reason);i.classList.remove("on");const n=s.getLastAd();if(t.emit("ad/show-first-frame",{root:e}),!s.shouldRestartContent())return E("Lifecycle.teardown(:skip_restart, reason: %s)","Ad prevented restarting content"),P(e);if(t.currentTime>0&&t.currentTime>=t.duration||"postroll"==s.ad_type||!1===(null==n?void 0:n.restart))return E("Lifecycle.teardown(:skip_restart, reason: %s)","was a postroll ad"),P(e);""===t.currentSrc&&t.setSrc(t.original_src);t.paused&&s.shouldRestartContent()&&(E("Lifecycle.teardown(:toggle_play, %s)","attempting to restart content"),await t.togglePlay(!0));if(!t.paused)return E("Lifecycle.teardown(:ok)","restarted video content"),P(e)}({root:t,content:s,ads:i,ui:o,err:e.detail,eventName:e.type}));let l=!!e.autoplay;var c;s.on("viewenter",()=>{l&&!1!==d.autopause&&i.resume()}),s.on("viewleave",(c=()=>{!1!==d.autopause&&(l=!i.paused,i.pause())},e=>{setTimeout((function(){if(!e.defaultPrevented)return c(e)}),0)}))}function D({ads:e,content:t,state:s}){s.listening||(t.on(["timeupdate","seeked","playing","seeking"],s=>{e.adPlaying&&e.adapter.isLinearAd()&&!e.adapter.isSharedVideoTag()&&!t.paused&&t.pause(),I({ads:e,content:t,seek:"seeking"===s.type})}),s.listening=!0)}function I({ads:e,content:t,seek:s=!1}){e&&e.setCurrentTime(t.currentTime,void 0,s)}function P(e){e.classList.remove("is-seamless")}const k=v("ads/timers");class TimerRegistry{constructor(e={},t={}){this.intervals=e,this.timers=t}}let C=-1;function N(e,t,s){const i=setInterval(s,t);if(k("TimerRegistry.createInterval() -> "+i,e.intervals),"object"==typeof i){const t=++C;return e.intervals[t]=t,t}return e.intervals[i]=i,i}function U(e){if(e)return k("TimerRegistry.empty()",Object.keys(e.timers),Object.keys(e.intervals)),Object.keys(e.intervals).forEach(t=>function(e,t){return k("TimerRegistry.removeInterval() -> "+t,e.intervals),clearInterval(e.intervals[t]),delete e.intervals[t],e}(e,t)),Object.keys(e.timers).forEach(t=>function(e,t){return k("TimerRegistry.removeTimeout() -> "+t,e.timers),clearTimeout(e.timers[t]),delete e.timers[t],e}(e,t)),e}function x(e){try{return e.getAdPodInfo().getPodIndex()}catch(e){return}}class IMA{constructor(e){this.eventHandler=e,this.log=v("ads/adapter/ima"),this.google=window.google,this._adHandlers=[],this._timers=new TimerRegistry,this._started=!1,this._volumeLevel=0,this._adLoaded=!1,this._paused=!1,this._all_ads_completed=!1,this._currentDuration=0,this._currentRemaining=0,this._currentDisplayTs=0,this._iosPlaysInline=!1,this.sharedVideoTag=!1,this._isInitialized=!1,this._prepared=!1,this.opts={}}async init(e){this.log("init",this.videoTag,e),this.opts=e,this._dimensions={width:e.width,height:e.height,linear:e.linear},this._prepared=!0,!this._isInitialized&&this.videoTag&&await this.initAdapter()}async initAdapter(){this.log("initAdapter",this.opts);try{await this.initialize(this.opts),this._isInitialized=!0}catch(e){this.log("initAdapter failed:",e),this._prepared=!1,this.eventHandler.trigger("ad-adapter-init-failed")}}isReady(){return!!this._isInitialized}setIOSPlaysInline(e){this.log("setIOSPlaysInline",e),this.sharedVideoTag=!e,this.initialize(Object.assign(Object.assign({},this.opts),{DisableCustomPlaybackForIOS10Plus:e}))}getIOSPlaysInline(){return this._iosPlaysInline}setVideoTag(e){this.videoTag=e}isLinearAd(){return!!this._adLinear}isSharedVideoTag(){return!!this.sharedVideoTag}getVideoTag(){return this.videoTag}getDimensions(){return this._dimensions||{}}getOpts(){return this.opts}isPaused(){return this._paused}destroy(){U(this._timers),this._adHandlers&&this._adHandlers.forEach(e=>e()),this._adHandlers=void 0,this._adDisplayContainer&&this._adDisplayContainer.destroy(),this._adDisplayContainer=void 0,this._adsLoader&&this._adsLoader.destroy(),this._adsLoader=void 0,this._adsManager&&this._adsManager.destroy(),this._adsManager=void 0}stop(){this._adsManager&&this._adsManager.stop()}initialize(e){const t=this.isAdPod(),s=this._adLoaded||t;if(this.cleanup(),!this.videoTag)return console.warn("videoTag not set during initialization");this.opts=e,this._volumeLevel=e.volume;const i=this.google.ima.settings;e.NumRedirects=e.NumRedirects||e.redirects;const r={VpaidMode:this.google.ima.ImaSdkSettings.VpaidMode.INSECURE,DisableCustomPlaybackForIOS10Plus:!0};if(i.setVpaidMode(e.VpaidMode||r.VpaidMode),i.setDisableCustomPlaybackForIOS10Plus(e.DisableCustomPlaybackForIOS10Plus||r.DisableCustomPlaybackForIOS10Plus),"NumRedirects"in e&&i.setNumRedirects(e.NumRedirects),"AutoPlayAdBreaks"in e&&i.setAutoPlayAdBreaks(e.AutoPlayAdBreaks),"Locale"in e&&i.setLocale(e.Locale),"Ppid"in e&&i.setPpid(e.Ppid),!document.body.contains(e.container))throw new Error("AdDisplayContainer was not found in the document.body");this._adDisplayContainer=new this.google.ima.AdDisplayContainer(e.container,u().tizen||u().webOS?void 0:this.videoTag),this._adDisplayContainer.initialize(),this._adsLoader=new this.google.ima.AdsLoader(this._adDisplayContainer),this.log("ima.initialise(:wait -> ADS_MANAGER_LOADED)",Object.assign(Object.assign({},e),{volume:this.videoTag.volume,muted:this.videoTag.muted})),this._adsLoader.addEventListener(this.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,t=>{if(!this.videoTag)return;this.log("ima.initialise(:done -> ADS_MANAGER_LOADED)\n%o",Object.assign(Object.assign({},e),{volume:this.videoTag.volume,muted:this.videoTag.muted}));const s=new this.google.ima.AdsRenderingSettings;this.log("ima.rendering(preload: %s)",!!e.preload_ads),s.useStyledNonLinearAds=!0,s.enablePreloading=!!e.preload_ads,"number"==typeof e.media_timeout&&(s.loadVideoTimeout=e.media_timeout),s.restoreCustomPlaybackStateOnAdBreakComplete=!e.DisableCustomPlaybackForIOS10Plus,this.sharedVideoTag&&(s.playAdsAfterTime=this.videoTag.currentTime),this.eventHandler.trigger("ad-ima-rendering-settings",s);const i=this._adsManager=t.getAdsManager(this.videoTag,s);this.eventHandler.trigger("ad-ima-adapter-init",i),i.addEventListener(this.google.ima.AdEvent.Type.LOADED,()=>{this.log("debug(ima.adsManager): google.ima.AdEvent.Type.LOADED")}),i.addEventListener(this.google.ima.AdErrorEvent.Type.AD_ERROR,()=>{this.log("debug(ima.adsManager): google.ima.AdErrorEvent.Type.AD_ERROR")}),i.addEventListener(this.google.ima.AdEvent.Type.STARTED,()=>{this.log("debug(ima.adsManager): google.ima.AdEvent.Type.STARTED")}),i.addEventListener(this.google.ima.AdEvent.Type.AD_PROGRESS,e=>{var t,s;const i=null===(t=e.getAdData())||void 0===t?void 0:t.duration,r=null===(s=e.getAdData())||void 0===s?void 0:s.currentTime;isNaN(i)||isNaN(r)||(this._currentRemaining=i-r,this.eventHandler.trigger("ad-progress",{remaining:this._currentRemaining,duration:i}))}),i.addEventListener(this.google.ima.AdEvent.Type.STARTED,e=>{this._currentRemaining=-1,this.debugEvent(e);const t=e.getAd();t&&(this._currentDuration=t.getDuration(),this._currentDisplayTs=Date.now(),this.emitWithAd("ad-started",t),t.isLinear()&&IMA.pollRemaining({ima:this,adsManager:i}))}),i.addEventListener(this.google.ima.AdEvent.Type.COMPLETE,e=>{this.debugEvent(e);const t=e.getAd();t&&this.emitWithAd("ad-completed",t),U(this._timers)}),i.addEventListener(this.google.ima.AdEvent.Type.SKIPPED,e=>{this.debugEvent(e);const t=e.getAd();t&&this.emitWithAd("ad-skipped",t)}),i.addEventListener(this.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,e=>{this.debugEvent(e);const t=e.getAd();t&&this.emitWithAd("ad-pause-content",t)});const r=()=>{this._started=!1,this._currentDisplayTs=0,this.eventHandler.trigger("ad-break-completed")};i.addEventListener(this.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,e=>{this.debugEvent(e),r()}),i.addEventListener(this.google.ima.AdEvent.Type.VOLUME_CHANGED,e=>{this.log("IMA::volume(type: %s, event: %o)",e);const t=i.getVolume();this._volumeLevel=t,this.eventHandler.trigger("ad-volume-changed",t)});const a=e=>{this._paused=e,this.eventHandler.trigger(e?"ad-paused":"ad-resumed")};i.addEventListener(this.google.ima.AdEvent.Type.PAUSED,()=>a(!0)),i.addEventListener(this.google.ima.AdEvent.Type.RESUMED,()=>a(!1)),i.addEventListener(this.google.ima.AdEvent.Type.STARTED,()=>a(!1)),i.addEventListener(this.google.ima.AdEvent.Type.VOLUME_MUTED,e=>{this.log("IMA::volume(type: %s, event: %o)","mute",e),this.eventHandler.trigger("ad-muted")});const{width:n,height:o}=e;n&&o&&(i.init(n,o,this.google.ima.ViewMode.NORMAL),this.log("ima.initialise: done initializing"))}),s&&(this.log("Event(reload: %s)","reload-ad-requested"),this.eventHandler.trigger("reload-ad-requested",t)),this.eventHandler.trigger(g,this)}destroyManager(e="unknown"){if(!this._adsManager)return this.log("ima::destroyManager(:skip, label: %s)",e);this.log("ima::destroyManager(:ok, label: %s)",e),this._adsManager.destroy()}reset(){this.destroyManager("reset"),U(this._timers),this.clearAdHandlers(),this._started=!1,this._adLoaded=!1}cleanup(){this.destroyManager("cleanup"),this._adsLoader&&this._adsLoader.destroy(),this._adDisplayContainer&&this._adDisplayContainer.destroy(),this._adLoaded=!1}waitForAdsManager(){return new Promise(e=>{this.log("ima.waitForAdsManager:",this._adsManager),this.once(this._adsLoader,this.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,()=>{this.log("ima.waitForAdsManager(:ok)",this._adsManager),e(this._adsManager)})})}async initAd(e,t=5e3){this.log(`ima.initAd(adTag: ${e}, timeout: ${t})`);try{await this.requestAd(e,t),this._adLoaded=!0}catch(e){throw this.log("ima.initAd:",e),this._adLoaded=!1,e}finally{U(this._timers)}}async requestAd(e,t){if(this.destroyManager("requestAd"),!this.videoTag)return;const{autoplay:s=!1}=this.opts,i=Date.now(),r=this.videoTag.muted;this._volumeLevel=this.videoTag.volume;const a=r||0==this._volumeLevel;this._all_ads_completed=!1,this.log("ima.requestAd(%o)",Object.assign(Object.assign({},this.opts),{autoplay:s,muted:r,timeout:t,adTag:e,_volumeLevel:this._volumeLevel,manager:this._adsManager})),this.clearAdHandlers();const n=new this.google.ima.AdsRequest;n.adTagUrl=e;const{height:o,width:d}=this.opts;if(d&&(n.linearAdSlotWidth=d),o&&(n.linearAdSlotHeight=o),!this.opts.disable_non_linear_ads&&d&&(n.nonLinearAdSlotWidth=d),!this.opts.disable_non_linear_ads&&o&&(n.nonLinearAdSlotHeight=o-50),n.setAdWillAutoPlay(s),n.setAdWillPlayMuted(a),n.vastLoadTimeout=t,this.eventHandler.trigger("ad-ima-before-ads-request",{request:n}),!this._adsLoader)return;this._adsLoader.requestAds(n);return new Promise(async(e,s)=>{const r=t=>{clearTimeout(o),e(t)},n=e=>{clearTimeout(o),s(e)};this.once(this._adsLoader,this.google.ima.AdErrorEvent.Type.AD_ERROR,e=>{this.emitError("ad-request-error",e),n(new Error("Ad load failed"))});const o=setTimeout(()=>{const e=new Error("Ad internal timeout reached");this.eventHandler.trigger("ad-timeout",e),s(e)},1.5*(t+(this.opts.media_timeout||5e3))),d=await this.waitForAdsManager();this.volume(a?0:this._volumeLevel),this.eventHandler.trigger("ad-volume-changed",this._volumeLevel);const l=this.cuepoints();if(l&&l.length&&0!==l[0])return r({ad:!1,adsManager:d});this.once(d,this.google.ima.AdErrorEvent.Type.AD_ERROR,e=>{this.emitError("ad-playback-error",e),n(e)}),this.once(d,this.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{this._all_ads_completed=!0,r(null)}),this.once(d,this.google.ima.AdEvent.Type.LOADED,e=>{this.eventHandler.trigger("ad-request-completed",{request_load_time:Date.now()-i});const t=e.getAd();t&&(this.log("ima.requestAd: AD_REQUEST_COMPLETED",t.getContentType()),"application/javascript"==t.getContentType()&&this.eventHandler.trigger("vpaid-init",t),r(null))}),this.once(d,this.google.ima.AdEvent.Type.CLICK,()=>{this.log("ima.requestAd: click event"),this.pause()})})}async playAd(){if(this.log("ima.playAd()",this),!this._adsManager||!this._adLoaded)return;const e=this.currentAd();if(e&&(!this.sharedVideoTag||e.isLinear()))try{await this.startAndWaitForAdCompletion(this._adsManager,e.isLinear())}catch(e){throw this.log("ima.playAd",e),e}finally{this._adLoaded=!1,U(this._timers)}}startAndWaitForAdCompletion(e,t){if(!this._started)return this.log("ima.startAndWaitForAdCompletion(manager: %o)",{volume:e.getVolume()}),new Promise((s,i)=>{let r=!1;this.once(e,this.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,()=>{if(this.log("ima.startAndWaitForAdCompletion: CONTENT_RESUME_REQUESTED <<< happened"),this._started=!1,r)return this.log("ima.startAndWaitForAdCompletion: Content resume requested, but trying to recover from ad error");s()}),this.once(e,this.google.ima.AdErrorEvent.Type.AD_ERROR,async e=>{this.log("ima.startAndWaitForAdCompletion: beginning error recovery ->",e),r=!0;try{const{ok:t}=await IMA.pollForFatalError({err:e,ima:this});t&&(r=!1)}catch(t){this._started=!1,i(e)}});const a=this.getVideoTag();if(!a)return;const n=()=>{t&&(this._started=!0),e.start(),this.eventHandler.trigger("ad-play-requested")};if(!t||a.hasState(f)||a.hasState("is-popped-out"))return n();a.paused||a.pause(),a.once("viewenter",()=>n())})}pause(){this.log("ima.pause()"),this._adsManager&&this._adsManager.pause()}resume(){this.log("ima.resume()"),this._adsManager&&this._adsManager.resume()}volume(e){if(this._adsManager)try{return arguments.length>0&&"number"==typeof e&&this._adsManager.setVolume(e),this._volumeLevel=this._adsManager.getVolume()}catch(e){this.log("ima.volume() failed (%o)",e)}}onResize({width:e,height:t,linear:s,silent:i,resize_non_linear:r}){this._adsManager&&(this._adLinear=void 0===s?this._adLinear:s,this.opts&&(e||t)&&(!1===s&&(e+=10,t+=10),this._dimensions={width:e,height:t,linear:s},s&&(this.opts.width=e,this.opts.height=t),(this._adLinear||r)&&(i||this.log("ima.onResize %s x %s",e,t),this._adsManager.resize(e,t,this.google.ima.ViewMode.NORMAL))))}getAdInfo(){const e=this.currentAd();if(e)return{duration:e.getDuration(),currentTime:this._currentRemaining}}currentAd(){const e=this._adsManager;if(e)return e.getCurrentAd()}isAdPod(){const e=this.cuepoints();return!!(e&&e.length>1)}cuepoints(){return this._adsManager&&this._adsManager.getCuePoints()}async contentComplete(){this.log("ima.contentComplete() -> ",this),this._adsLoader&&this._adsLoader.contentComplete();const e=this.cuepoints();e&&-1!==e.indexOf(-1)&&await new Promise(e=>{IMA.race(this.eventHandler,["ad-break-completed","ad-error"],e)})}isUiDisabled(){try{const e=this.currentAd();return e&&e.isUiDisabled()}catch(e){return null}}getAdPodInfo(){try{const e=this.currentAd();return e&&e.getAdPodInfo()}catch(e){return null}}canDismissNonLinear(){const e=this.currentAd();if(!e||e.isLinear()||!this._adsManager||!this._currentDisplayTs)return!0;const t=Date.now(),s=e.getMinSuggestedDuration();return t-this._currentDisplayTs>1e3*s}static unwrapError(e,t){if(!e)return"";if("function"==typeof e.getMessage){return e.getMessage()}return e.message?e.message:t||""}static pollForFatalError({err:e,ima:t}){let s;try{const t=e.getError(),i=t.getInnerError(),r=i?IMA.unwrapError(i,t.message):"";s={reason:r,type:t.getType(),code:t.getErrorCode()}}catch(e){}const i=t._currentRemaining;return new Promise((e,r)=>{const a=setTimeout(()=>{t.eventHandler&&t.eventHandler.trigger("ad-playback-error",s),r(new Error("Ad not progressing"))},2500);t.eventHandler.once("ad-progress",t=>{const s=t.detail.remaining;-1!==s&&s<i&&(clearTimeout(a),e({ok:1}))})})}static pollRemaining({ima:e,adsManager:t}){let s=-1;return N(e._timers,250,(function(){const i=t.getRemainingTime();-1!=e._currentRemaining&&e._currentRemaining<=i||(e._currentRemaining=t.getRemainingTime(),s!=e._currentRemaining&&(s=e._currentRemaining,e.eventHandler.trigger("ad-progress",{remaining:e._currentRemaining,duration:e._currentDuration})))}))}once(e,t,s){this._adHandlers.push(function(e,t,s){const i=r=>{s(r),e.removeEventListener(t,i)};return e.addEventListener(t,i),()=>e.removeEventListener(t,i)}(e,t,s))}static race(e,t,s){t.forEach(i=>{const r=(...i)=>{t.forEach(t=>e.removeListener(t,r)),s(i)};e.on(i,r)})}clearAdHandlers(){this.log("ima.clearAdHandlers"),this._adHandlers.forEach(e=>e()),this._adHandlers=[]}emitWithAd(e,t){if(this.log("ima.emitWithAd",e,t),!this._adsManager)return;const s=function(e){try{return e.getAdPodInfo().getAdPosition()}catch(e){return}}(t),i=function(e){try{return e.getAdPodInfo().getTotalAds()}catch(e){return}}(t),r={ad:{duration:t.getDuration(),width:t.getWidth(),height:t.getHeight(),position:s,totals:i},volume:this._adsManager.getVolume(),vast_ad_id:t.getAdId(),linear:t.isLinear(),mime_type:t.getContentType(),ima_event:!0};this.log(`emitWithAd::event(name: ${e}, data: %o, ad: %o)`,r,t),this.eventHandler.trigger(e,r)}emitError(e,t){const s={vast_error_type:t.getError().getType(),reason:t.getError().getMessage(),vast_error:t.getError().getErrorCode()};this.log(`ima.error(${e})`,s),this.eventHandler.trigger(e,s)}debugEvent(e){try{const t=e.getAd();if(!t)return;this.log(`ima.event.${e.type} ->`,{event:e,data:e.getAdData(),position:x(t),ad:t})}catch(e){}}}var F=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e,t){var s=function(){for(var e=new Array(256),t=0;t<256;++t)e[t]="%"+((t<16?"0":"")+t.toString(16)).toUpperCase();return e}(),i=Object.prototype.hasOwnProperty;t.arrayToObject=function(e,t){for(var s=t.plainObjects?Object.create(null):{},i=0;i<e.length;++i)void 0!==e[i]&&(s[i]=e[i]);return s},t.merge=function(e,s,r){if(!s)return e;if("object"!=typeof s){if(Array.isArray(e))e.push(s);else{if("object"!=typeof e)return[e,s];(r.plainObjects||r.allowPrototypes||!i.call(Object.prototype,s))&&(e[s]=!0)}return e}if("object"!=typeof e)return[e].concat(s);var a=e;return Array.isArray(e)&&!Array.isArray(s)&&(a=t.arrayToObject(e,r)),Object.keys(s).reduce((function(e,a){var n=s[a];return i.call(e,a)?e[a]=t.merge(e[a],n,r):e[a]=n,e}),a)},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),i="",r=0;r<t.length;++r){var a=t.charCodeAt(r);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?i+=t.charAt(r):a<128?i+=s[a]:a<2048?i+=s[192|a>>6]+s[128|63&a]:a<55296||a>=57344?i+=s[224|a>>12]+s[128|a>>6&63]+s[128|63&a]:(r+=1,a=65536+((1023&a)<<10|1023&t.charCodeAt(r)),i+=s[240|a>>18]+s[128|a>>12&63]+s[128|a>>6&63]+s[128|63&a])}return i},t.compact=function(e,s){if("object"!=typeof e||null===e)return e;var i=s||[],r=i.indexOf(e);if(-1!==r)return i[r];if(i.push(e),Array.isArray(e)){for(var a=[],n=0;n<e.length;++n)e[n]&&"object"==typeof e[n]?a.push(t.compact(e[n],i)):void 0!==e[n]&&a.push(e[n]);return a}for(var o=Object.keys(e),d=0;d<o.length;++d){var l=o[d];e[l]=t.compact(e[l],i)}return e},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null!=e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}})),q={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},B={delimiter:"&",strictNullHandling:!1,skipNulls:!1,encode:!0,encoder:F.encode},j=function e(t,s,i,r,a,n,o,d,l){var c=t;if("function"==typeof o)c=o(s,c);else if(c instanceof Date)c=c.toISOString();else if(null===c){if(r)return n?n(s):s;c=""}if("string"==typeof c||"number"==typeof c||"boolean"==typeof c||F.isBuffer(c))return n?[n(s)+"="+n(c)]:[s+"="+String(c)];var u,h=[];if(void 0===c)return h;if(Array.isArray(o))u=o;else{var p=Object.keys(c);u=d?p.sort(d):p}for(var g=0;g<u.length;++g){var m=u[g];a&&null===c[m]||(h=Array.isArray(c)?h.concat(e(c[m],i(s,m),i,r,a,n,o,d,l)):h.concat(e(c[m],s+(l?"."+m:"["+m+"]"),i,r,a,n,o,d,l)))}return h},V=Object.prototype.hasOwnProperty,z={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1,decoder:F.decode},H=function(e,t,s){if(e){var i=s.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,r=/(\[[^[\]]*])/g,a=/(\[[^[\]]*])/.exec(i),n=a?i.slice(0,a.index):i,o=[];if(n){if(!s.plainObjects&&V.call(Object.prototype,n)&&!s.allowPrototypes)return;o.push(n)}for(var d=0;null!==(a=r.exec(i))&&d<s.depth;){if(d+=1,!s.plainObjects&&V.call(Object.prototype,a[1].slice(1,-1))&&!s.allowPrototypes)return;o.push(a[1])}return a&&o.push("["+i.slice(a.index)+"]"),function e(t,s,i){if(!t.length)return s;var r,a=t.shift();if("[]"===a)r=(r=[]).concat(e(t,s,i));else{r=i.plainObjects?Object.create(null):{};var n="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,o=parseInt(n,10);!isNaN(o)&&a!==n&&String(o)===n&&o>=0&&i.parseArrays&&o<=i.arrayLimit?(r=[])[o]=e(t,s,i):r[n]=e(t,s,i)}return r}(o,t,s)}},G=function(e,t){var s,i,r=e,a=t||{},n=void 0===a.delimiter?B.delimiter:a.delimiter,o="boolean"==typeof a.strictNullHandling?a.strictNullHandling:B.strictNullHandling,d="boolean"==typeof a.skipNulls?a.skipNulls:B.skipNulls,l=("boolean"==typeof a.encode?a.encode:B.encode)?"function"==typeof a.encoder?a.encoder:B.encoder:null,c="function"==typeof a.sort?a.sort:null,u=void 0!==a.allowDots&&a.allowDots;if(null!==a.encoder&&void 0!==a.encoder&&"function"!=typeof a.encoder)throw new TypeError("Encoder has to be a function.");"function"==typeof a.filter?r=(i=a.filter)("",r):Array.isArray(a.filter)&&(s=i=a.filter);var h,p=[];if("object"!=typeof r||null===r)return"";h=a.arrayFormat in q?a.arrayFormat:"indices"in a?a.indices?"indices":"repeat":"indices";var g=q[h];s||(s=Object.keys(r)),c&&s.sort(c);for(var m=0;m<s.length;++m){var _=s[m];d&&null===r[_]||(p=p.concat(j(r[_],_,g,o,d,l,i,c,u)))}return p.join(n)},Q=function(e,t){var s=t||{};if(null!==s.decoder&&void 0!==s.decoder&&"function"!=typeof s.decoder)throw new TypeError("Decoder has to be a function.");if(s.delimiter="string"==typeof s.delimiter||F.isRegExp(s.delimiter)?s.delimiter:z.delimiter,s.depth="number"==typeof s.depth?s.depth:z.depth,s.arrayLimit="number"==typeof s.arrayLimit?s.arrayLimit:z.arrayLimit,s.parseArrays=!1!==s.parseArrays,s.decoder="function"==typeof s.decoder?s.decoder:z.decoder,s.allowDots="boolean"==typeof s.allowDots?s.allowDots:z.allowDots,s.plainObjects="boolean"==typeof s.plainObjects?s.plainObjects:z.plainObjects,s.allowPrototypes="boolean"==typeof s.allowPrototypes?s.allowPrototypes:z.allowPrototypes,s.parameterLimit="number"==typeof s.parameterLimit?s.parameterLimit:z.parameterLimit,s.strictNullHandling="boolean"==typeof s.strictNullHandling?s.strictNullHandling:z.strictNullHandling,""===e||null==e)return s.plainObjects?Object.create(null):{};for(var i="string"==typeof e?function(e,t){for(var s={},i=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),r=0;r<i.length;++r){var a,n,o=i[r],d=-1===o.indexOf("]=")?o.indexOf("="):o.indexOf("]=")+1;-1===d?(a=t.decoder(o),n=t.strictNullHandling?null:""):(a=t.decoder(o.slice(0,d)),n=t.decoder(o.slice(d+1))),V.call(s,a)?s[a]=[].concat(s[a]).concat(n):s[a]=n}return s}(e,s):e,r=s.plainObjects?Object.create(null):{},a=Object.keys(i),n=0;n<a.length;++n){var o=a[n],d=H(o,i[o],s);r=F.merge(r,d,s)}return F.compact(r)};const W=v("fpads:macros"),$=/\[([\s\S]+?)\]/g;class Macros{constructor(e={},t=$){this.vars=e,this.pattern=t}static run(e){try{return e()}catch(e){return void console.error(e)}}static merge(...e){return e.reduce((e,t)=>Object.assign(e,t),{})}static cast(e){return void 0===e?"":"function"==typeof e?encodeURIComponent(Macros.run(e)||""):"string"==typeof e?encodeURIComponent(e):"number"==typeof e||"boolean"==typeof e?e.toString():""}static normalize(e){return e.trim()}static process_obj(e,t,s){return Object.keys(e).reduce((i,r)=>{const a=Macros.process_str(r,t,s,!0),n=e[r];return null===n?(i[a]=n,i):"object"==typeof n?(i[a]=Macros.process_obj(n,t,s),i):"string"==typeof n?(i[a]=Macros.process_str(n,t,s),i):(console.error(new Error(`${n} at ${r} not a handled Macro type`)),i)},{})}static process_str(e,t,s,i=!1){return e.replace(t.pattern,(e,t)=>{const r=Macros.normalize(t);if(!(r in s)||void 0===s[r])return e;const a=s[r],n=i?a:Macros.cast(a);return W("Macro.replace(raw: %s, macro: %s, value: %s)",i,t,n),n})}fork(e={},t=this.pattern){const s=Macros.merge(this.vars,e);return new Macros(s,t)}compile(e,t={}){const s=Macros.merge(this.vars,t),[i,r]=e.split("?"),a=Q(r||"",{strictNullHandling:!0,decoder:e=>e}),n=G(Macros.process_obj(a,this,s),{encode:!1,strictNullHandling:!0});return Macros.process_str(i,this,s,!0)+"?"+n}}function K(e,t={width:0,height:0}){let s,i;try{const e=document.createElement("a");e.href=s=window.location!=window.parent.location?document.referrer:document.location.href,i=e.hostname}catch(e){console.error(e)}const{width:r,height:a}=t,{video_source:n}=e||{},o=function(){const e=window;return"object"==typeof e.__flowplayerAdParameters?e.__flowplayerAdParameters:{}}();return Object.assign({random:Date.now(),page_url:s,domain:i,player_width:r,player_height:a,video_url:n,videourl:n},o)}Macros.patterns={BRACKETS:$,CURLY:/\{([\s\S]+?)\}/g,UNDERSCORE:/__([\s\S]+?)__/g};const Y=/^flowplayer:\/\/(.+)/;async function Z(e){if("string"==typeof e&&Y.test(e)){const t=Y.exec(e),s=t&&window[t[1]];if(s)return Z(s)}if("function"!=typeof e)return e;try{return await e()}catch(e){return""}}class Schedule{constructor(e,t={}){this._ads=e,this._opts=t,this._nextIndex=0,this._postroll=void 0,this._loadPending=!1,this._postrollActive=!1,this.reset(this._ads)}toJSON(){const e=(this._ads||[]).slice(this._nextIndex);return this._postroll&&e.push(this._postroll),e}reset(e){this.setAds(e),this._nextIndex=0,this._postrollActive=!1}resetCounter(){this._nextIndex=0,this._postrollActive=!1}setAds(e){this._ads=e||[],this.sort()}getAds(){return this._ads}getNextAd(e){return this._ads[this._nextIndex]||e}getCurrentAd(){return this._postrollActive?this._postroll:this._loadPending?0:this._ads[this._nextIndex-1]}getPostroll(){return this._postroll}isDrained(){return this._nextIndex+1>this._ads.length}setPostrollActive(){this._postrollActive=!0}updateContentDuration(e){this._opts.content_duration=e}increment(){++this._nextIndex}decrement(){this._nextIndex>0&&--this._nextIndex}getNextIndex(){return this._nextIndex}getCurrentType(){const e=this.getCurrentAd();if(e)return Schedule.kindOf(e.time)}sort(){this._postroll=this._ads.find(e=>-1===e.time),this._ads=this._ads.filter(e=>e!==this._postroll).sort((e,t)=>e.time===t.time?this._ads.indexOf(e)-this._ads.indexOf(t):e.time-t.time)}shallPlayAd(e){if(this._loadPending)return!1;const t=this.getCurrentAd()||this.getNextAd();return!!(t&&t.time<=e&&-1!==t.time)}shallPlayNext(){const e=this.getNextAd(),t=this.getCurrentAd();return!(!e||!t||e.time!==t.time)}waitForLoad(e,t,s){if(this._loadPending=!1,!t)return!1;const i=s?this._opts.preload_advance:0;return t.time>=0?this._loadPending=e<t.time-i:-1===t.time&&(this._loadPending=this._opts.content_duration>0&&-1!==e?e<this._opts.content_duration-i:-1!==e),this._loadPending}static hasPreroll(e){return!!e.find(e=>0===e.time)}static isOutstream(e){return Schedule.hasPreroll(e)&&!!e[0].outstream}static kindOf(e){switch(e){case 0:return"preroll";case-1:return"postroll";default:return"midroll"}}}const J=Object.prototype,X=Object.getPrototypeOf;const ee=v("fpads:ads:state");var te;!function(e){e[e.IDLE=0]="IDLE",e[e.INITIALIZING=1]="INITIALIZING",e[e.FETCHING_AD=2]="FETCHING_AD",e[e.AD_AVAILABLE=4]="AD_AVAILABLE",e[e.BREAK_ACTIVE=8]="BREAK_ACTIVE",e[e.PLAYING=16]="PLAYING",e[e.FATAL_ERROR=32]="FATAL_ERROR"}(te||(te={}));class AdsState{constructor(e=0){this._state=e}static of(){return new AdsState}reset(){this._state=0}toggleState(e,t){return void 0===e&&ee(new Error("AdState cannot toggleState for `undefined`")),null==typeof t?this._state^=e:t?void(this._state|=e):this._state&=~e}hasAll(e){return this._state==(this._state|e)}hasAny(e){return!!(this._state&e)}get state(){return this._state}}function se(e,t,s){const i=function(e,t){const s=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(s,"data",{get:()=>t}),s}(t,s);return e.dispatchEvent(i),e}!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const ie={ok:v("fpads:analytics:request-queue"),err:v("fpads:analytics:request-queue:err"),warn:v("fpads:analytics:request-queue:warn")};class RequestQueue{constructor(e=[],t=[],s={failures:0,ttl:0}){this.pending=e,this.open=t,this.stats=s}static of(){return new RequestQueue}static is_empty(e){return 0==e.pending.length}static is_high_water(e){return e.open.length==RequestQueue.MAX_OPEN_REQUESTS}static maybe_spawn_req(e){if(RequestQueue.is_empty(e))return ie.ok("maybe_spawn_req called Queue that is EMPTY"),e;if(RequestQueue.is_high_water(e))return ie.warn("maybe_spawn_req called on Queue that is HIGH_WATER"),e;try{const t=RequestQueue.lpop(e);t&&RequestQueue.request(e,t)}catch(e){ie.err(e)}}static increment_failures(e){return e.stats.failures++,e.stats.failures>RequestQueue.MAX_FAILURE_COUNT&&(e.stats.ttl=Date.now()+RequestQueue.REQUEST_TTL_MS),e}static handle_error(e,t){RequestQueue.rm(e,t),RequestQueue.increment_failures(e)}static request(e,[t,s,i]){if(ie.ok(`Request[${i.event_type}] request`,i,e.stats),Date.now()<e.stats.ttl)return ie.warn(`Request[${i.event_type}] skipping because too many errors too quickly`,e.stats);const r=new XMLHttpRequest;e.open.push(r),r.timeout=RequestQueue.REQUEST_TIMEOUT_MS,r.ontimeout=function(){RequestQueue.handle_error(e,r),ie.warn(`Request[${i.event_type}] timed out in ${r.timeout}ms`,e.stats)},r.onerror=function(t){RequestQueue.handle_error(e,r),t&&ie.err(t),ie.warn(`Request[${i.event_type}] encountered an Error`,r.responseText,e.stats)},r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&RequestQueue.rm(e,r),Math.floor(r.status/100)},r.onload=function(){RequestQueue.rm(e,r),e.stats.failures&&e.stats.failures--,ie.ok(`Request[${i.event_type}] :ok`,r.status)},r.open(s,t),r.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{r.send(JSON.stringify(i))}catch(e){ie.err(e)}}static rpush(e,...t){return t.forEach(t=>{if(RequestQueue.is_high_water(e))return ie.warn("Too many open requests, skipping",e.stats);e.pending.push(t),RequestQueue.maybe_spawn_req(e)}),e}static lpop(e){return e.pending.shift()}static rm(e,t){const s=e.open.lastIndexOf(t);return~s&&e.open.splice(s,1),e}}RequestQueue.MAX_OPEN_REQUESTS=3,RequestQueue.REQUEST_TIMEOUT_MS=4e3,RequestQueue.REQUEST_TTL_MS=5e3,RequestQueue.MAX_FAILURE_COUNT=3;const re={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},ae={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},ne={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},oe={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},de={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class Utils{static getFirstMatch(e,t){const s=t.match(e);return s&&s.length>0&&s[1]||""}static getSecondMatch(e,t){const s=t.match(e);return s&&s.length>1&&s[2]||""}static matchAndReturnConst(e,t,s){if(e.test(t))return s}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map(e=>parseInt(e,10)||0);if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map(e=>parseInt(e,10)||0);if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,s=!1){const i=Utils.getVersionPrecision(e),r=Utils.getVersionPrecision(t);let a=Math.max(i,r),n=0;const o=Utils.map([e,t],e=>{const t=a-Utils.getVersionPrecision(e),s=e+new Array(t+1).join(".0");return Utils.map(s.split("."),e=>new Array(20-e.length).join("0")+e).reverse()});for(s&&(n=a-Math.min(i,r)),a-=1;a>=n;){if(o[0][a]>o[1][a])return 1;if(o[0][a]===o[1][a]){if(a===n)return 0;a-=1}else if(o[0][a]<o[1][a])return-1}}static map(e,t){const s=[];let i;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(i=0;i<e.length;i+=1)s.push(t(e[i]));return s}static find(e,t){let s,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(s=0,i=e.length;s<i;s+=1){const i=e[s];if(t(i,s))return i}}static assign(e,...t){const s=e;let i,r;if(Object.assign)return Object.assign(e,...t);for(i=0,r=t.length;i<r;i+=1){const e=t[i];if("object"==typeof e&&null!==e){Object.keys(e).forEach(t=>{s[t]=e[t]})}}return e}static getBrowserAlias(e){return re[e]}static getBrowserTypeByAlias(e){return ae[e]||""}}const le=/version\/(\d+(\.?_?\d+)+)/i,ce=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},s=Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},s=Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},s=Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},s=Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},s=Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},s=Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},s=Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},s=Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},s=Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},s=Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},s=Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},s=Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},s=Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},s=Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},s=Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return s&&(t.version=s),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},s=Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},s=Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},s=Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},s=Utils.getFirstMatch(le,e)||Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},s=Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},s=Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},s=Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},s=Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},s=Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},s=Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},s=Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},s=Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},s=Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test(e){const t=!e.test(/like android/i),s=e.test(/android/i);return t&&s},describe(e){const t={name:"Android Browser"},s=Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},s=Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},s=Utils.getFirstMatch(le,e);return s&&(t.version=s),t}},{test:[/.*/i],describe(e){const t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:Utils.getFirstMatch(t,e),version:Utils.getSecondMatch(t,e)}}}];var ue=[{test:[/Roku\/DVP/],describe(e){const t=Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:oe.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:oe.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),s=Utils.getWindowsVersionName(t);return{name:oe.Windows,version:t,versionName:s}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:oe.iOS},s=Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return s&&(t.version=s),t}},{test:[/macintosh/i],describe(e){const t=Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),s=Utils.getMacOSVersionName(t),i={name:oe.MacOS,version:t};return s&&(i.versionName=s),i}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:oe.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),s=e.test(/android/i);return t&&s},describe(e){const t=Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),s=Utils.getAndroidVersionName(t),i={name:oe.Android,version:t};return s&&(i.versionName=s),i}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),s={name:oe.WebOS};return t&&t.length&&(s.version=t),s}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=Utils.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||Utils.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||Utils.getFirstMatch(/\bbb(\d+)/i,e);return{name:oe.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:oe.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:oe.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:oe.Linux})},{test:[/CrOS/],describe:()=>({name:oe.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:oe.PlayStation4,version:t}}}],he=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(e){const t=Utils.getFirstMatch(/(can-l01)/i,e)&&"Nova",s={type:ne.mobile,vendor:"Huawei"};return t&&(s.model=t),s}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:ne.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:ne.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:ne.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:ne.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:ne.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:ne.tablet})},{test(e){const t=e.test(/ipod|iphone/i),s=e.test(/like (ipod|iphone)/i);return t&&!s},describe(e){const t=Utils.getFirstMatch(/(ipod|iphone)/i,e);return{type:ne.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:ne.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:ne.mobile})},{test:e=>"blackberry"===e.getBrowserName(!0),describe:()=>({type:ne.mobile,vendor:"BlackBerry"})},{test:e=>"bada"===e.getBrowserName(!0),describe:()=>({type:ne.mobile})},{test:e=>"windows phone"===e.getBrowserName(),describe:()=>({type:ne.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:()=>({type:ne.tablet})},{test:e=>"android"===e.getOSName(!0),describe:()=>({type:ne.mobile})},{test:e=>"macos"===e.getOSName(!0),describe:()=>({type:ne.desktop,vendor:"Apple"})},{test:e=>"windows"===e.getOSName(!0),describe:()=>({type:ne.desktop})},{test:e=>"linux"===e.getOSName(!0),describe:()=>({type:ne.desktop})},{test:e=>"playstation 4"===e.getOSName(!0),describe:()=>({type:ne.tv})},{test:e=>"roku"===e.getOSName(!0),describe:()=>({type:ne.tv})}],pe=[{test:e=>"microsoft edge"===e.getBrowserName(!0),describe(e){if(/\sedg\//i.test(e))return{name:de.Blink};const t=Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:de.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:de.Trident},s=Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:e=>e.test(/presto/i),describe(e){const t={name:de.Presto},s=Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test(e){const t=e.test(/gecko/i),s=e.test(/like gecko/i);return t&&!s},describe(e){const t={name:de.Gecko},s=Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:de.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:de.WebKit},s=Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}}];class Parser{constructor(e,t=!1){if(null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=Utils.find(ce,e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=Utils.find(ue,e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=Utils.find(he,e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=Utils.find(pe,e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some(e=>this.test(e));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return Utils.assign({},this.parsedResult)}satisfies(e){const t={};let s=0;const i={};let r=0;if(Object.keys(e).forEach(a=>{const n=e[a];"string"==typeof n?(i[a]=n,r+=1):"object"==typeof n&&(t[a]=n,s+=1)}),s>0){const e=Object.keys(t),s=Utils.find(e,e=>this.isOS(e));if(s){const e=this.satisfies(t[s]);if(void 0!==e)return e}const i=Utils.find(e,e=>this.isPlatform(e));if(i){const e=this.satisfies(t[i]);if(void 0!==e)return e}}if(r>0){const e=Object.keys(i),t=Utils.find(e,e=>this.isBrowser(e,!0));if(void 0!==t)return this.compareVersion(i[t])}}isBrowser(e,t=!1){const s=this.getBrowserName().toLowerCase();let i=e.toLowerCase();const r=Utils.getBrowserTypeByAlias(i);return t&&r&&(i=r.toLowerCase()),i===s}compareVersion(e){let t=[0],s=e,i=!1;const r=this.getBrowserVersion();if("string"==typeof r)return">"===e[0]||"<"===e[0]?(s=e.substr(1),"="===e[1]?(i=!0,s=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?s=e.substr(1):"~"===e[0]&&(i=!0,s=e.substr(1)),t.indexOf(Utils.compareVersions(r,s,i))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(e=>this.is(e))}}
|
|
2
2
|
/*!
|
|
3
3
|
* Bowser - a browser detector
|
|
4
4
|
* https://github.com/lancedikson/bowser
|
|
5
5
|
* MIT License | (c) Dustin Diaz 2012-2015
|
|
6
6
|
* MIT License | (c) Denis Demchenko 2015-2019
|
|
7
|
-
*/const pe=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return re}static get ENGINE_MAP(){return oe}static get OS_MAP(){return ne}static get PLATFORMS_MAP(){return ae}}.parse(window.navigator.userAgent),{platform:ge,os:me,browser:_e}=pe,fe=e=>e&&e.toLowerCase();var ye={rnd:Math.random().toString(36).substr(2,32),os:fe(me.name+(me.versionName?" "+me.versionName:"")),device:fe(ge.type),browser:fe(_e.name),browser_version:(_e&&_e.version?_e.version:"unknown").split(".").shift(),plugin_version:"3.8.1"};const ve="https://fp-eu-w1-aai.flowplayer.com/in",Ae="POST",we=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],Ee=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],be=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],Se=y("ads/analytics"),Le=RequestQueue.of(),Te=(...e)=>Object.assign({},...e);class Analytics{constructor(e,t={}){this.emitter=e,this.metadata=Te(ye,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),Se(this),this.wireup()}static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,Te(e.metadata,t,{player_version:"3.8.1"})),e}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,i=Te(this.metadata,{event_type:e},s),r=Analytics.pluck_valid_keys(this,i),a=Analytics.ensure_required_keys(this,r);if(Se(`Event[${e}]`,{payload:r,observation:s}),a.length)return Se(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${a}`,r);RequestQueue.rpush(Le,[ve,Ae,r])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}const Oe=y("ads/controller"),Re={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10};class AdsController extends class EventBus{constructor(e=document.createElement("div"),t=[]){this._bus=e,this._listeners=t}removeAllListeners(){this._listeners.length=0,this._bus=document.createElement("div")}emit(e,t){const s=new CustomEvent(e,{detail:t||{}});this._bus.dispatchEvent(s)}on(e,t){this._listeners.push([e,t]),this._bus.addEventListener(e,t,{passive:!0})}once(e,t){this._bus.addEventListener(e,t,{once:!0})}removeListener(e,t){this._bus.removeEventListener(e,t)}}{constructor(e={}){var t;super(),this.adapter=function(e,t){return e.adapter?new e.adapter(t):new IMA(t)}(e,this),this.opts=Object.assign(Object.assign({},Re),e),this.analytics=(t=this,Analytics.of(t,{required_keys:Ee,optional_keys:be,events:we})),this._state=AdsState.of(),this._schedule=void 0,this._lastAd=void 0,this._macros=new Macros(e.parameters||{}),this.wireup(),this.content_processing_src=!1}reset(){return this.removeAllListeners(),this.wireup(),this.analytics&&this.analytics.wireup(),this._state.reset(),this.adapter.reset(),this}destroy(){this.removeAllListeners(),this.analytics&&this.analytics.destroy(),this.adapter&&this.adapter.destroy();this.analytics=void 0,this.opts=void 0,this.adapter=void 0,this._state=void 0,this._schedule=void 0,this._lastAd=void 0,this._macros=void 0}stop(){this.adapter&&this.adapter.stop()}onContentNewSrc(){this._state.reset(),this.adapter.destroyManager(),this.adapter.contentComplete()}wireup(){const e=()=>{var e;const t=new CustomEvent("ad/playing");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(ee.PLAYING,!0)};this.on("ad-play-requested",e),this.on("ad-started",e),this.on("ad-resumed",e);const t=()=>{var e;if(!this.adPlaying)return;const t=new CustomEvent("ad/paused");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(ee.PLAYING,!1)};this.on("ad-break-completed",t),this.on("ad-teardown",t),this.on("ad-playback-error",t),this.on("ad-request-error",t),this.on("ad-paused",t),this.on("ad-skipped",t),this.on("ad-completed",t),this.on("ad-break-completed",()=>{requestAnimationFrame(()=>{var e;const t=new CustomEvent("ad/complete");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(ee.BREAK_ACTIVE,!1)})}),this.on("ad-adapter-init-failed",()=>{console.error("Adapter init failed"),t(),this._state.toggleState(ee.FATAL_ERROR,!0)}),this.on("reload-ad-requested",async e=>{if(Oe("Ads.on(RELOAD_AD_REQUESTED)",e),this._schedule){if(t(),e)return this._schedule.reset(this._schedule.getAds());this._state.hasAny(ee.AD_AVAILABLE)&&(this._schedule.decrement(),this._state.toggleState(ee.AD_AVAILABLE,!1))}})}async initialize(e,t={},s){return Oe("Ads.initialize():",e,t,s),this._state.toggleState(ee.INITIALIZING,!0),Object.assign(this.opts,t),Array.isArray(e)&&this.setSchedule(e),await this.adapter.init(this.opts),this._macros=this._macros.fork(Object.assign({},t.parameters||{},{autoplay:t.autoplay,muted:t.muted})),this.adapter.isReady()&&await this.adapterInitialized(s),this}get videoTag(){return this.adapter.getVideoTag()}get adInfo(){return this.adapter.getAdInfo()}async setVideoTag(e){Oe("Ads.setVideoTag():",e),await this.adapter.setVideoTag(e),this.trigger("ad-videotag-attached",e),this.adapter.isReady()&&await this.adapterInitialized(),e.on("request/ad/pause",()=>this.adapter.pause()),e.on("request/ad/play",()=>this.adapter.resume()),e.on("request/ad/muteunmute",()=>e.toggleMute()),e.on("volumechange",()=>{this.adapter.volume(e.muted?0:0==e.volume?.1:e.volume)}),e.on("src",()=>e.hasState("ad-playing")||e.hasState("ad-paused")?(this.stop(),this.adapter.isLinearAd()?(this.setIsContentProcessingNewSrc(!0),void this.once("ad-break-completed",()=>{setTimeout(()=>{this.setIsContentProcessingNewSrc(!1),this.onContentNewSrc()},0)})):this.onContentNewSrc()):this.onContentNewSrc())}waitForVideoTag(){return new Promise(e=>{const t=this.adapter.getVideoTag();if(t)return e(t);this.on("ad-videotag-attached",t=>{this.once(g,()=>e(t))})})}async adapterInitialized(e){Oe("Ads.adapterInitialized()"),this._state.toggleState(ee.INITIALIZING,!1),this._state.toggleState(ee.BREAK_ACTIVE,!!this.hasPreroll()),await this.setCurrentTime(0,e),this.checkIfBreakComplete(),this.adapter.isAdPod()||e&&!this.opts.autoplay||this.trigger("ad-teardown")}async fetchNextAd(e,t=0){var s,i;if(!this._schedule)return;if(!this.adapter.isReady())return;if(t>50)throw this._state.toggleState(ee.FATAL_ERROR,!0),this._state.toggleState(ee.FETCHING_AD,!1),new Error("Ads.fetchNextAd() :max_recursion_depth");const r=(null===(s=this._schedule)||void 0===s?void 0:s.getNextAd())||(null===(i=this._schedule)||void 0===i?void 0:i.getPostroll());if(!r||this.adapter.canDismissNonLinear()||-1===e)if(this._schedule.waitForLoad(e,r,this.opts.preload_ads))this._state.toggleState(ee.FETCHING_AD,!1);else if(r===this._schedule.getPostroll()&&this._schedule.setPostrollActive(),this._schedule.isDrained()||this._schedule.increment(),r){Oe("Ads.fetchNextAd",r),this._state.toggleState(ee.FETCHING_AD,!0);try{return await this.requestAd(r),this._state.toggleState(ee.AD_AVAILABLE,!0),void this._state.toggleState(ee.FETCHING_AD,!1)}catch(s){if(Oe("Ads.fetchNextAd(err: %o, ad: %o)",s,r),this.setLastAd(r),r!==this._schedule.getPostroll())return await this.fetchNextAd(e,++t)}}else this._state.toggleState(ee.FETCHING_AD,!1)}skipAdsOnSeek(e){if(!this._schedule)return;let t=this._schedule.getNextAd();for(;t&&t.time<e;)this._schedule.increment(),t=this._schedule.getNextAd()}async setCurrentTime(e,t=!1,s=!1){if(!this._schedule)return;if(!this.adapter.isReady())return;if(this._state.hasAny(ee.FETCHING_AD))return;if(this._state.hasAny(ee.PLAYING)&&this.adapter.isLinearAd())return;const i=0===e&&0===this._schedule.getNextIndex();try{if(s&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(e),this._state.hasAny(ee.AD_AVAILABLE)||await this.fetchNextAd(e),!this._state.hasAny(ee.AD_AVAILABLE)||!this.shallPlayAd(e)||t)return;await this.playAd(),await this.setCurrentTime(e),this.checkIfBreakComplete()}catch(e){Oe("setCurrentTime: Error(from: setCurrentTime, message: %s)",e.message)}finally{i&&this.trigger("ad-preroll-finished")}}async playAd(){var e;if(!this._state.hasAny(ee.AD_AVAILABLE))return;this._state.toggleState(ee.AD_AVAILABLE,!1),this._state.toggleState(ee.BREAK_ACTIVE,!0);const t=null===(e=this._schedule)||void 0===e?void 0:e.getCurrentAd();try{await this.adapter.playAd()}catch(e){console.error("Ads.playAd: error",e)}finally{t&&this.setLastAd(t)}}checkIfBreakComplete(){if(!this._state.hasAny(ee.BREAK_ACTIVE))return Oe("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());Oe("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(ee.BREAK_ACTIVE,!1),this.adapter.isAdPod()||this.trigger("ad-break-completed")}resetScheduleCounter(){this._schedule&&this._schedule.resetCounter()}setSchedule(e,t){if(t&&!isNaN(t)&&this._schedule&&this._schedule.updateContentDuration(t),this._schedule&&this._schedule.getNextIndex()>0)return this._schedule.setAds(e);this._schedule=new Schedule(e,{preload_advance:this.opts.preload_advance,content_duration:t?0:t})}toJSON(){return this._schedule?this._schedule.toJSON():[]}trigger(e,t={}){var s;if(!this.adapter.getVideoTag())return;if(!this._state)return;if("ad-break-completed"===e&&this._state.hasAny(ee.BREAK_ACTIVE)&&!this.adapter.isAdPod())return Oe("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if(null===(i=t)||"object"!=typeof i||J(i)!==Z)return this.dispatch(e,t);var i;const r=Object.assign({},this.adapter.getOpts()||{},(null===(s=this._schedule)||void 0===s?void 0:s.getCurrentAd())||{},{ad_type:this.ad_type},t);return this.dispatch(e,r)}dispatch(e,t){const s=this.adapter.getVideoTag();if(s){Oe(":dispatch",e,t);try{const i={event:"ads/"+e,detail:{outstream:t.outstream,ad_type:t.ad_type,ad_break_time:t.time,ad_remaining_seconds:t.remaining,ad_muted:t.muted,ad_duration_seconds:t.duration,ad_error_reason:t.reason,ad_vast_error:t.vast_error,ad_vast_error_type:t.vast_error_type,ad_request_load_type:t.request_load_time}};s.dispatchEvent(new CustomEvent("health:record",{detail:i}))}catch(e){Oe(":error",e)}te(s,e,t),this.emit(e,t)}}get ad_type(){return this._schedule&&this._schedule.getCurrentType()}shouldRestartContent(){if(this.getIsContentProcessingNewSrc())return!1;if(this.adapter.isAdPod())return!0;const e=this.getLastAd();return!e||!e.outstream&&!1!==e.restart}async finished(e){if(this._schedule&&(Oe("Ads.finished"),!(this.adapter.isSharedVideoTag()&&this._state.hasAny(ee.PLAYING)&&this.adapter.isLinearAd()))){Oe("Ads.finished: trying to play postroll");try{if(!this._schedule.getPostroll())return Oe("Ads.finished: no postroll found"),await this.adapter.contentComplete();this._state.hasAny(ee.AD_AVAILABLE)||await this.fetchNextAd(-1),await this.playAd(),this.adapter.contentComplete()}catch(e){Oe("Ads.finished: postroll failed:",e)}finally{this.trigger("ad-postroll-finished"),this.checkIfBreakComplete(),"function"==typeof e&&e()}}}hasPreroll(){return this._schedule&&Schedule.hasPreroll(this._schedule.getAds())}shallPlayAd(e){var t;return(!this.adapter||!this.adapter.isAdPod())&&(!(!this._state||this._state.hasAny(ee.FATAL_ERROR))&&!!(null===(t=this._schedule)||void 0===t?void 0:t.shallPlayAd(e)))}setLastAd(e){return this._lastAd=e,this}setIsContentProcessingNewSrc(e){this.content_processing_src=e}getLastAd(){return this._lastAd}getIsContentProcessingNewSrc(){return this.content_processing_src}mergeMacros(e={}){return this._macros=this._macros.fork(Object.assign({},e)),this}get paused(){return this.adapter&&this.adapter.isPaused()}pause(){this.adapter&&this.adapter.pause()}resume(){this.adapter&&this.adapter.resume()}resize(e){this.adapter&&this.adapter.onResize(e)}async requestAd(e,t=0,s=this.opts.timeout){if(!this._state)return;Oe("Ads.requestAd(ad: %o)",{ad:e,timeout:s,idx:t});const i=await async function e(t){if("function"==typeof t)return[await Y(t)];if("string"==typeof t)return[await Y(t)];if(Array.isArray(t)){const e=t;return await Promise.all(e.map(Y))}if("object"==typeof t&&t&&t.adTag)return await e(t.adTag);throw new Error(`\n unhandled ads type ${typeof t}:\n ${JSON.stringify(t)}\n can be:\n | Array<string>\n | string\n | function\n | {adTag: Array<string>|string|function}\n `)}(e);if(void 0===i[t])return Promise.reject(new Error("Ad failed, no fallbacks left"));if(!i[t])return await this.requestAd(i,t+1,s);this.trigger("ad-requested",e);const r=this._macros.compile(i[t],$(this.opts,this.adapter.getDimensions()));try{return void await this.adapter.initAd(r,s)}catch(e){return Oe(`Ads.requestAd(:fallback, idx: ${t}, length: ${i.length}, adTag: ${i[t]})\nError `,{adTag:i,err:e}),this.requestAd(i,t+1,s)}}resetSchedule(e){this._schedule&&this._schedule.reset(e)}get adPlaying(){return this._state&&this._state.hasAny(ee.PLAYING)}get adBreak(){return this._state&&this._state.hasAny(ee.BREAK_ACTIVE)}get adRequesting(){return this._state.hasAny(ee.FETCHING_AD)}get adLinear(){return this.adBreak&&this.adapter.isLinearAd()}}var Me=new Blob([new Uint8Array([255,227,24,196,0,0,0,3,72,1,64,0,0,4,132,16,31,227,192,225,76,255,67,12,255,221,27,255,228,97,73,63,255,195,131,69,192,232,223,255,255,207,102,239,255,255,255,101,158,206,70,20,59,255,254,95,70,149,66,4,16,128,0,2,2,32,240,138,255,36,106,183,255,227,24,196,59,11,34,62,80,49,135,40,0,253,29,191,209,200,141,71,7,255,252,152,74,15,130,33,185,6,63,255,252,195,70,203,86,53,15,255,255,247,103,76,121,64,32,47,255,34,227,194,209,138,76,65,77,69,51,46,57,55,170,170,170,170,170,170,170,170,170,170,255,227,24,196,73,13,153,210,100,81,135,56,0,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170])],{type:"audio/mpeg"}),De=new Blob([new Uint8Array([0,0,0,28,102,116,121,112,105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,109,112,52,49,0,0,0,8,102,114,101,101,0,0,2,239,109,100,97,116,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,2,194,109,111,111,118,0,0,0,108,109,118,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,232,0,0,0,47,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,236,116,114,97,107,0,0,0,92,116,107,104,100,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,101,100,116,115,0,0,0,28,101,108,115,116,0,0,0,0,0,0,0,1,0,0,0,47,0,0,0,0,0,1,0,0,0,0,1,100,109,100,105,97,0,0,0,32,109,100,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,68,0,0,8,0,85,196,0,0,0,0,0,45,104,100,108,114,0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0,0,0,1,15,109,105,110,102,0,0,0,16,115,109,104,100,0,0,0,0,0,0,0,0,0,0,0,36,100,105,110,102,0,0,0,28,100,114,101,102,0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1,0,0,0,211,115,116,98,108,0,0,0,103,115,116,115,100,0,0,0,0,0,0,0,1,0,0,0,87,109,112,52,97,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,16,0,0,0,0,172,68,0,0,0,0,0,51,101,115,100,115,0,0,0,0,3,128,128,128,34,0,2,0,4,128,128,128,20,64,21,0,0,0,0,1,244,0,0,1,243,249,5,128,128,128,2,18,16,6,128,128,128,1,2,0,0,0,24,115,116,116,115,0,0,0,0,0,0,0,1,0,0,0,2,0,0,4,0,0,0,0,28,115,116,115,99,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,28,115,116,115,122,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,115,0,0,1,116,0,0,0,20,115,116,99,111,0,0,0,0,0,0,0,1,0,0,0,44,0,0,0,98,117,100,116,97,0,0,0,90,109,101,116,97,0,0,0,0,0,0,0,33,104,100,108,114,0,0,0,0,0,0,0,0,109,100,105,114,97,112,112,108,0,0,0,0,0,0,0,0,0,0,0,0,45,105,108,115,116,0,0,0,37,169,116,111,111,0,0,0,29,100,97,116,97,0,0,0,1,0,0,0,0,76,97,118,102,53,54,46,52,48,46,49,48,49])],{type:"video/mp4"});function Ie(e){return Object.assign({muted:!1,timeout:250,inline:!1},e)}function Pe(e,t){var s=e.muted,i=e.timeout,r=e.inline,a=t(),n=a.element,o=a.source,d=void 0,l=void 0,c=void 0;return n.muted=s,!0===s&&n.setAttribute("muted","muted"),!0===r&&n.setAttribute("playsinline","playsinline"),n.src=o,new Promise((function(e){d=n.play(),l=setTimeout((function(){c(!1,new Error("Timeout "+i+" ms has been reached"))}),i),c=function(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n.remove(),n.srcObject=null,clearTimeout(l),e({result:t,error:s})},void 0!==d?d.then((function(){return c(!0)})).catch((function(e){return c(!1,e)})):c(!0)}))}var ke={audio:function(e){return Pe(e=Ie(e),(function(){return{element:document.createElement("audio"),source:URL.createObjectURL(Me)}}))},video:function(e){return Pe(e=Ie(e),(function(){return{element:document.createElement("video"),source:URL.createObjectURL(De)}}))}};let Ce=void 0;async function Ne(e=!0){return Ce||(Ce=await ke.video({timeout:500,muted:e}),Ce)}const Ue=new Blob([new Uint8Array([0,0,0,28,102,116,121,112,105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,109,112,52,49,0,0,0,8,102,114,101,101,0,0,2,239,109,100,97,116,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,2,194,109,111,111,118,0,0,0,108,109,118,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,232,0,0,0,47,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,236,116,114,97,107,0,0,0,92,116,107,104,100,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,101,100,116,115,0,0,0,28,101,108,115,116,0,0,0,0,0,0,0,1,0,0,0,47,0,0,0,0,0,1,0,0,0,0,1,100,109,100,105,97,0,0,0,32,109,100,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,68,0,0,8,0,85,196,0,0,0,0,0,45,104,100,108,114,0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0,0,0,1,15,109,105,110,102,0,0,0,16,115,109,104,100,0,0,0,0,0,0,0,0,0,0,0,36,100,105,110,102,0,0,0,28,100,114,101,102,0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1,0,0,0,211,115,116,98,108,0,0,0,103,115,116,115,100,0,0,0,0,0,0,0,1,0,0,0,87,109,112,52,97,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,16,0,0,0,0,172,68,0,0,0,0,0,51,101,115,100,115,0,0,0,0,3,128,128,128,34,0,2,0,4,128,128,128,20,64,21,0,0,0,0,1,244,0,0,1,243,249,5,128,128,128,2,18,16,6,128,128,128,1,2,0,0,0,24,115,116,116,115,0,0,0,0,0,0,0,1,0,0,0,2,0,0,4,0,0,0,0,28,115,116,115,99,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,28,115,116,115,122,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,115,0,0,1,116,0,0,0,20,115,116,99,111,0,0,0,0,0,0,0,1,0,0,0,44,0,0,0,98,117,100,116,97,0,0,0,90,109,101,116,97,0,0,0,0,0,0,0,33,104,100,108,114,0,0,0,0,0,0,0,0,109,100,105,114,97,112,112,108,0,0,0,0,0,0,0,0,0,0,0,0,45,105,108,115,116,0,0,0,37,169,116,111,111,0,0,0,29,100,97,116,97,0,0,0,1,0,0,0,0,76,97,118,102,53,54,46,52,48,46,49,48,49])],{type:"video/mp4"});var xe=Object.freeze({__proto__:null,STICKY_CONTROLS:1,NO_FULLSCREEN:2,NO_AD_INDICATOR:4,AD_ATTRIBUTION:8,AD_CHOICES:16,REMAINING_TIME:32,VOLUME_BAR:64});function Fe(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}const qe=["progress","duration","remaining"],Be=y("ads/ui");class AdUI extends HTMLElement{constructor(e,t=document.createElement("div")){super(),this.player=e,this.adContainer=t,this.render(),e.addEventListener("ad/playing",e=>this.updateState(e.type)),e.addEventListener("ad/paused",e=>this.updateState(e.type)),e.addEventListener("ad/complete",e=>this.updateState(e.type)),e.on("ad-progress",e=>{const{remaining:t}=e.detail;this.setAttribute("remaining",t+"")}),e.on("ad/hide-first-frame",e=>{const{root:t}=e.detail;Be("hideFirstFrame"),t.classList.toggle("ad-hide-first-frame",!0)}),e.on("ad/show-first-frame",e=>{const{root:t}=e.detail;Be("showFirstFrame"),t.classList.toggle("ad-hide-first-frame",!1)}),e.on("ad/resize",e=>{const{opts:t}=e.detail,s=this.style;t.linear?t.width&&(s.width=t.width+"px"):t.width?this.adContainer.style.width=t.width+"px":s.removeProperty("width"),t.height?s.height=t.height+"px":s.removeProperty("height")}),e.on("ad/set-ui-flags",e=>{let{ui_flags:t}=e.detail;if(t=t||0,this.classList.toggle("is-ad-controls-sticky",(1&t)>0),this.classList.toggle("no-fullscreen",(2&t)>0),this.classList.toggle("no-indicator",(4&t)>0),(8&t)>0){const e=document.createElement("div");e.classList.add("ad-attribution"),e.textContent=this.player.i18n("ads.advertisement","Advertisement"),this.adContainer.append(e)}if(this.classList.toggle("no-volume-bar",0==(64&t)),(32&t)>0&&this.controls&&(this.remaining=document.createElement("div"),this.remaining.classList.add("fp-ad-remaining","fp-color-text"),this.controls.prepend(this.remaining)),(16&t)>0&&this.controls){this.classList.toggle("is-ad-choices",!0);const e=document.createElement("div");e.classList.add("fp-ad-choices"),e.textContent=this.player.i18n("ads.adchoices","AdChoices"),e.addEventListener("click",e=>{e.preventDefault(),this.player.togglePlay(!1),window.open("https://adssettings.google.com","_blank")}),this.controls.append(e)}})}static get observedAttributes(){return qe}updateState(e){["ad/paused","ad/playing"].forEach(t=>{const s=t.replace("/","-"),i=e===t;this.player.setState(s,i),this.classList.toggle(s,i)})}attributeChangedCallback(e,t,s){switch(e){case"duration":return this.onDurationChange(parseFloat(s));case"progress":return this.onProgress(parseFloat(t),parseFloat(s));case"remaining":return this.onRemaining(s)}}onDurationChange(e){}onProgress(e,t){}onRemaining(e){this.remaining&&(this.remaining.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let i=Math.floor(e/60);return e-=60*i,s>=1?(i-=60*s,t+s+":"+Fe(i)+":"+Fe(e)):t+Fe(i)+":"+Fe(e)}(parseFloat(e)))}render(){this.adContainer.classList.add("fp-ad-container"),this.append(this.adContainer),this.controls=v(this.player,"flowplayer-ad-controls");const e=v(this.player,"flowplayer-ad-countdown");this.append(this.controls,e)}}const je=y("fpads:native:outstream"),Ve={OUTSTREAM:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"};var ze,He;!function(e){e.OUTSTREAM_VISIBLE="ads-outstream-visible",e.OUTSTREAM_VIEWPORT_UPDATE="ads-outstream-viewport-update",e.OUTSTREAM_TEARDOWN="ads-outstream-teardown",e.OUTSTREAM_ENDSCREEN_READY="ads-outstream-endscreen-ready"}(ze||(ze={})),function(e){e[e.None=0]="None",e[e.Booting=1]="Booting",e[e.Ready=2]="Ready",e[e.Disposed=3]="Disposed"}(He||(He={}));class Outstream{constructor({ads:e,root:t,content:s,ima:i}){this.state=He.None,je("creating Outstream instance"),this.content=s,this.ads=e,this.root=t,this.ima=i,this.aspectRatio=s.videoHeight/s.videoWidth,this.dimensions=function(e){if(e.clientWidth>0||e.clientHeight)return h(e);const t={height:e.style.height};p(e,"opacity",0),p(e,"display","absolute"),p(e,"display","inline-block"),p(e,"height","auto");const s=h(e);return p(e,"height",t.height),p(e,"opacity",1),s}(this.root),this.adUi=new AdUI(s),this.adContainer=this.adUi.adContainer,this.initialVolumeState={},t.classList.add(Ve.OUTSTREAM),t.append(this.adUi),this.hide(),this.ads.on("ad-pause-content",e=>{var t;if(this.state==He.Disposed)return;const s=!!(null===(t=e.detail)||void 0===t?void 0:t.linear);this.ads.resize(Object.assign(Object.assign({},this.dimensions),{linear:s}))}),s.on("resize",e=>{if(this.state==He.Disposed)return;const t=e.detail;t&&(this.dimensions={width:t.contentRect.width,height:t.contentRect.height},this.ads.resize(this.dimensions))}),s.on("intersectionchange",e=>{if(this.state==He.Disposed)return;const t=e.detail;if(t)switch(this.state){case He.Booting:return je(":boot skipping intersectionchange");case He.None:return this.state=He.Booting,this.begin_life_cycle();case He.Ready:if(t.ratio>=.5&&this.ads.adPlaying)return;t.ratio>=.5&&this.ads.resume(),t.ratio<.5&&this.ads.pause()}}),this.setup(),setTimeout(()=>(this.state=He.Booting,this.begin_life_cycle()),0)}hide(){return this}restore_aspect_ratio(){return je(`Outstream.restore_aspect_ratio(${this.aspectRatio})`),this.content.setOpts({ratio:this.aspectRatio}),this}show(){this.root.classList.remove(Outstream.CLASS.HIDDEN),this.root.classList.add(Outstream.CLASS.SHOWING),this.adUi.classList.add("linear","on")}async begin_life_cycle(){this.state=He.Ready;const{error:e,result:t}=await Ne(!1),{result:s}=await Ne(!0);this.attach_ad_listeners(),this.initialVolumeState={can_autoplay:!(!t&&!s),muted:!t},je("Outstream.show() :autoplay >> sound="+t),e&&this.content&&!t&&(this.content.muted=!0,this.content.volume=0),await this.ads.setVideoTag(this.content),await L({ads:this.ads,content:this.content,adContainer:this.adContainer,ima:this.ima,state:{listening:!1},config:this.content.opts}),D({content:this.content,ads:this.ads}),this.state=He.Ready}attach_ad_listeners(){const e=this.ads;e.once("ad-pause-content",()=>{this.show(),this.ads.adPlaying&&this.ads.pause()}),this.ima.always_show_controls||e.on("vpaid-init",()=>this.adUi.classList.add("is-vpaid"));const t=()=>{b.forEach(e=>this.ads.removeListener(e,t));const e=new CustomEvent(ze.OUTSTREAM_TEARDOWN);je("Outstream(:teardown)",e),this.content.dispatchEvent(e)};b.forEach(e=>this.ads.once(e,t)),this.content.once(ze.OUTSTREAM_TEARDOWN,e=>{setTimeout(()=>{if(e.defaultPrevented)return this.handle_endscreen();this.dispose()},0)})}handle_endscreen(){this.reset_ui(),this.ads.reset(),R({config:this.content.opts,ui:this.adUi,ads:this.ads,adContainer:this.adContainer,ima:this.ima,content:this.content,root:this.content.root,state:{started:!0,listening:!1},initial:{muted:!0,volume:1}})}empty_src(){this.content.setSrc({type:"video/mp4",src:URL.createObjectURL(Ue)})}setup(){this.root.classList.add(Outstream.CLASS.OUTSTREAM),this.root.classList.add(Outstream.CLASS.HIDDEN),this.empty_src()}reset_ui(){const e=this.root;e.classList.remove(Outstream.CLASS.SHOWING),e.classList.remove(Outstream.CLASS.OUTSTREAM),this.adUi.classList.remove("on")}dispose(){if(this.state==He.Disposed)return;const e=this.root,t=this.content;this.reset_ui(),e.classList.add(Outstream.CLASS.OUTSTREAM),e.classList.add(Outstream.CLASS.DONE);this.video=this.container=this.ads=0,this.state=He.Disposed,t.destroy(),e.innerHTML=""}}function Ge(e){return e&&"number"==typeof e.time}function Qe(e){return e&&"number"==typeof e.percentage&&"number"!=typeof e.time}Outstream.CLASS=Ve;const We=y("ads/ima/sdk");var $e;async function Ke(e){var t;if(null===(t=null===window||void 0===window?void 0:window.google)||void 0===t?void 0:t.ima)return void We(":noop");const s=e._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(e){return new Promise((t,s)=>{let i=document.querySelector(`script[src='${e}']`);if(i)return Ye(i,t,s);i=document.createElement("script"),i.setAttribute("state",$e.LOADING),Ye(i,t,s),i.src=e,document.head.appendChild(i)})}(s),void We(":loaded")}catch(e){We(":error "+e.message,e)}}function Ye(e,t,s){const i=e.getAttribute("state");if(i&&[$e.ERROR,$e.LOADED].includes(i))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",$e.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",$e.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}($e||($e={}));const Ze=y("ads/index");async function Je(e,t,s){let i=e.autoplay;if(e.autoplay&&(Ze("handling initial autoplay, original_autoplay: ",i),s.autoplay=!1,e.autoplay=0,s.once("loadstart",()=>{setTimeout(()=>{var t;if(!(null===(t=e.ima)||void 0===t?void 0:t.ads)){if(e.autoplay=i,!s.hasState("is-in-viewport"))return s.once("viewenter",()=>s.togglePlay(!0));s.togglePlay(!0)}},0)})),await Ke(s),!("google"in window))return console.warn("google.ima unavailable");const r=s.ads=new AdsController,a=r.analytics;let n=!1;r.resize(h(t)),_&&(s.on(["fullscreenenter","fullscreenexit","webkitendfullscreen"],e=>{var t;const i="fullscreenenter"===e.type;null===(t=null==s?void 0:s.ads)||void 0===t||t.adapter.setIOSPlaysInline(!i)}),r.on("ad-postroll-finished",()=>{r.adapter.isSharedVideoTag()&&r.once("ad-break-completed",()=>{s.src=s.original_src,s.once("canplay",()=>{s.togglePlay(!1)}),s.webkitExitFullscreen()})})),s.on("reap",(function(){r&&r.destroy()}));const o=async e=>{const o=e.ima;if(void 0===i&&e.autoplay&&(i=e.autoplay),!o)return;if(!Array.isArray(o.ads))return Ze("handling non-array ima.ads"),void(void 0!==i?e.autoplay=i:delete e.autoplay);const d=e.duration||s.duration;if(o.ads=function(e,t){return Array.isArray(e)?e.filter(e=>Ge(e)||Qe(e)).reduce((e,s)=>{if(Ge(s))return e.push(s),e;if(s.lazy)return e.push(s),e;if(Qe(s)){const i=Object.assign({},s),r=s.percentage?s.percentage*t:0;return isNaN(r)||(i.time=r<0||r===t?-1:r),e.push(i),e}return e},[]):(console.warn("AdSchedule was not an Array"),[])}(o.ads,d),r.setSchedule(o.ads,d),e.metadata&&Analytics.mergeMetadata(a,e.metadata),e.metadata&&r.mergeMacros(e.metadata),e.metadata&&o.parameters&&(o.parameters=Object.assign(Object.assign({},o.parameters),e.metadata)),Analytics.mergeMetadata(a,{muted:e.muted||!1,autoplay:e.autoplay||!1}),!n){if(n=!0,e.lang&&!o.Locale&&(o.Locale=e.lang),Schedule.isOutstream(o.ads))return Ze("is outstream, returning"),new Outstream({root:t,content:s,ads:r,ima:o});S({config:Object.assign(Object.assign({},e),{autoplay:i}),root:t,content:s,ads:r,ima:o})}};e.ima&&o(e),s.on("config",({detail:e})=>o(e))}class AdControls extends HTMLElement{constructor(e){super(),this.player=e,this.render()}render(){this.classList.add("fp-ad-controls");const e=v(this.player,"flowplayer-ad-indicator"),t=document.createElement("div");t.classList.add("ad-playback-controls");const s=v(this.player,"flowplayer-small-play-icon"),i=v(this.player,"flowplayer-small-pause-icon");s.addEventListener("click",()=>{this.player.emit("request/ad/play"),setTimeout((function(){i.focus&&i.focus()}),100)}),i.addEventListener("click",()=>{this.player.emit("request/ad/pause"),setTimeout((function(){s.focus&&s.focus()}),100)}),t.append(s,i);const r=v(this.player,"flowplayer-volume-icon");r.addEventListener("click",()=>this.player.emit("request/ad/muteunmute"));const a=v(this.player,"flowplayer-volume-bar"),n=v(this.player,"flowplayer-header-right-zone");this.append(e,t,r,a,n)}}class AdCountdown extends HTMLElement{constructor(e){super(),this.player=e,e.on("ad-progress",e=>{const{duration:t,remaining:s}=e.detail;this.setAttribute("duration",t+""),this.setAttribute("remaining",s+"")}),e.on("ad-started",e=>{e.detail.linear&&(this.style.setProperty("--ad-percent-previous","0"),this.style.setProperty("--ad-percent-complete","0"))}),this.addEventListener("animationend",()=>{const e=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",e)})}static get observedAttributes(){return["remaining"]}attributeChangedCallback(e,t,s){switch(e){case"remaining":return this.onRemaining(s)}}onRemaining(e){const t=parseFloat(this.getAttribute("duration")||"0");e||(e=t+"");const s=parseFloat(e),i=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",i),this.classList.remove("go");const r=((t-s)/t*100).toFixed(3);requestAnimationFrame(()=>{this.style.setProperty("--ad-percent-complete",r),this.classList.add("go")})}}class AdIndicator extends HTMLElement{constructor(e){super(),this.player=e,this.render(),e.on("ad-started",e=>{const{position:t,totals:s}=e.detail.ad;this.setAttribute("position",t+""),this.setAttribute("totals",s+"")})}static get observedAttributes(){return["position","totals"]}attributeChangedCallback(e,t){switch(e){case"position":case"totals":return this.updateText()}}updateText(){if(!this.element)return;const e=parseFloat(this.getAttribute("position")||"0"),t=parseFloat(this.getAttribute("totals")||"0");this.element.textContent=`${this.player.i18n("ads.indicator","ADS")} ${e} / ${t}`}render(){this.element=document.createElement("div"),this.element.classList.add("ad-indicator","fp-color-text"),this.element.textContent=this.player.i18n("ads.indicator","ADS"),this.append(this.element)}}var Xe=Object.freeze({__proto__:null,SINGlE_INLINE_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_SKIPPABLE_INLINE:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_preroll_skippable&sz=640x480&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirectlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_ERROR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirecterror&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_BROKEN:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirecterror&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&nofb=1&correlator=",SINGLE_VPAID_20_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinearvpaid2js&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_VPAID_20_NON_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dnonlinearvpaid2js&ciu_szs=728x90%2C300x250&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_NON_LINEAR_INLINE:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/nonlinear_ad_samples&sz=480x70&cust_params=sample_ct%3Dnonlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_SESSION_AD_RULE_PREROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sar%3Da0f2&ciu_szs=300x250&ad_rule=1&gdfp_req=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_PREROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpreonly&ciu_szs=300x250%2C728x90&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_PREROLL_BUMPER:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpreonlybumper&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_POSTROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpostonly&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_POSTROLL_BUMPER:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpostonlybumper&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator="});const{samsung_tv:et}=u();class Ads{constructor(e){this.umd=e,A(e,w,AdUI),A(e,"flowplayer-ad-controls",AdControls),A(e,"flowplayer-ad-countdown",AdCountdown),A(e,"flowplayer-ad-indicator",AdIndicator)}init(e,t,s){if(c.from_token(e.token||"").is_granted(c.permissions.ADS)&&!et)return Je(e,t,s)}}return Ads.events=m,Ads.ui=xe,Ads.tags=Xe,function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const s=e.flowplayer;"function"==typeof s?s(t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t))}(window,Ads),Ads}));
|
|
7
|
+
*/const ge=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return ae}static get ENGINE_MAP(){return de}static get OS_MAP(){return oe}static get PLATFORMS_MAP(){return ne}}.parse(window.navigator.userAgent),{platform:me,os:_e,browser:fe}=ge,ye=e=>e&&e.toLowerCase();var ve={rnd:Math.random().toString(36).substr(2,32),os:ye(_e.name+(_e.versionName?" "+_e.versionName:"")),device:ye(me.type),browser:ye(fe.name),browser_version:(fe&&fe.version?fe.version:"unknown").split(".").shift(),plugin_version:"3.9.0"};const Ae="https://fp-eu-w1-aai.flowplayer.com/in",we="POST",be=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],Ee=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],Se=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],Le=v("ads/analytics"),Te=RequestQueue.of(),Oe=(...e)=>Object.assign({},...e);class Analytics{constructor(e,t={}){this.emitter=e,this.metadata=Oe(ve,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),Le(this),this.wireup()}static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,Oe(e.metadata,t,{player_version:"3.9.0"})),e}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,i=Oe(this.metadata,{event_type:e},s),r=Analytics.pluck_valid_keys(this,i),a=Analytics.ensure_required_keys(this,r);if(Le(`Event[${e}]`,{payload:r,observation:s}),a.length)return Le(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${a}`,r);RequestQueue.rpush(Te,[Ae,we,r])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}const Re=v("ads/controller"),Me={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10};class AdsController extends class EventBus{constructor(e=document.createElement("div"),t=[]){this._bus=e,this._listeners=t}removeAllListeners(){this._listeners.length=0,this._bus=document.createElement("div")}emit(e,t){const s=new CustomEvent(e,{detail:t||{}});this._bus.dispatchEvent(s)}on(e,t){this._listeners.push([e,t]),this._bus.addEventListener(e,t,{passive:!0})}once(e,t){this._bus.addEventListener(e,t,{once:!0})}removeListener(e,t){this._bus.removeEventListener(e,t)}}{constructor(e={}){var t;super(),this.adapter=function(e,t){return e.adapter?new e.adapter(t):new IMA(t)}(e,this),this.opts=Object.assign(Object.assign({},Me),e),this.analytics=(t=this,Analytics.of(t,{required_keys:Ee,optional_keys:Se,events:be})),this._state=AdsState.of(),this._schedule=void 0,this._lastAd=void 0,this._macros=new Macros(e.parameters||{}),this.wireup(),this.content_processing_src=!1}reset(){return this.removeAllListeners(),this.wireup(),this.analytics&&this.analytics.wireup(),this._state.reset(),this.adapter.reset(),this}destroy(){this.removeAllListeners(),this.analytics&&this.analytics.destroy(),this.adapter&&this.adapter.destroy();this.analytics=void 0,this.opts=void 0,this.adapter=void 0,this._state=void 0,this._schedule=void 0,this._lastAd=void 0,this._macros=void 0}stop(){this.adapter&&this.adapter.stop()}onContentNewSrc(){this._state.reset(),this.adapter.destroyManager(),this.adapter.contentComplete()}wireup(){const e=()=>{var e;const t=new CustomEvent("ad/playing");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(te.PLAYING,!0)};this.on("ad-play-requested",e),this.on("ad-started",e),this.on("ad-resumed",e);const t=()=>{var e;if(!this.adPlaying)return;const t=new CustomEvent("ad/paused");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(te.PLAYING,!1)};this.on("ad-break-completed",t),this.on("ad-teardown",t),this.on("ad-playback-error",t),this.on("ad-request-error",t),this.on("ad-paused",t),this.on("ad-skipped",t),this.on("ad-completed",t),this.on("ad-break-completed",()=>{requestAnimationFrame(()=>{var e;const t=new CustomEvent("ad/complete");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(te.BREAK_ACTIVE,!1)})}),this.on("ad-adapter-init-failed",()=>{console.error("Adapter init failed"),t(),this._state.toggleState(te.FATAL_ERROR,!0)}),this.on("reload-ad-requested",async e=>{if(Re("Ads.on(RELOAD_AD_REQUESTED)",e),this._schedule){if(t(),e)return this._schedule.reset(this._schedule.getAds());this._state.hasAny(te.AD_AVAILABLE)&&(this._schedule.decrement(),this._state.toggleState(te.AD_AVAILABLE,!1))}})}async initialize(e,t={},s){return Re("Ads.initialize():",e,t,s),this._state.toggleState(te.INITIALIZING,!0),Object.assign(this.opts,t),Array.isArray(e)&&this.setSchedule(e),await this.adapter.init(this.opts),this._macros=this._macros.fork(Object.assign({},t.parameters||{},{autoplay:t.autoplay,muted:t.muted})),this.adapter.isReady()&&await this.adapterInitialized(s),this}get videoTag(){return this.adapter.getVideoTag()}get adInfo(){return this.adapter.getAdInfo()}async setVideoTag(e){Re("Ads.setVideoTag():",e),await this.adapter.setVideoTag(e),this.trigger("ad-videotag-attached",e),this.adapter.isReady()&&await this.adapterInitialized(),e.on("request/ad/pause",()=>this.adapter.pause()),e.on("request/ad/play",()=>this.adapter.resume()),e.on("request/ad/muteunmute",()=>e.toggleMute()),e.on("volumechange",()=>{this.adapter.volume(e.muted?0:0==e.volume?.1:e.volume)}),e.on("src",()=>e.hasState("ad-playing")||e.hasState("ad-paused")?(this.stop(),this.adapter.isLinearAd()?(this.setIsContentProcessingNewSrc(!0),void this.once("ad-break-completed",()=>{setTimeout(()=>{this.setIsContentProcessingNewSrc(!1),this.onContentNewSrc()},0)})):this.onContentNewSrc()):this.onContentNewSrc())}waitForVideoTag(){return new Promise(e=>{const t=this.adapter.getVideoTag();if(t)return e(t);this.on("ad-videotag-attached",t=>{this.once(g,()=>e(t))})})}async adapterInitialized(e){Re("Ads.adapterInitialized()"),this._state.toggleState(te.INITIALIZING,!1),this._state.toggleState(te.BREAK_ACTIVE,!!this.hasPreroll()),await this.setCurrentTime(0,e),this.checkIfBreakComplete(),this.adapter.isAdPod()||e&&!this.opts.autoplay||this.trigger("ad-teardown")}async fetchNextAd(e,t=0){var s,i;if(!this._schedule)return;if(!this.adapter.isReady())return;if(t>50)throw this._state.toggleState(te.FATAL_ERROR,!0),this._state.toggleState(te.FETCHING_AD,!1),new Error("Ads.fetchNextAd() :max_recursion_depth");const r=(null===(s=this._schedule)||void 0===s?void 0:s.getNextAd())||(null===(i=this._schedule)||void 0===i?void 0:i.getPostroll());if(!r||this.adapter.canDismissNonLinear()||-1===e)if(this._schedule.waitForLoad(e,r,this.opts.preload_ads))this._state.toggleState(te.FETCHING_AD,!1);else if(r===this._schedule.getPostroll()&&this._schedule.setPostrollActive(),this._schedule.isDrained()||this._schedule.increment(),r){Re("Ads.fetchNextAd",r),this._state.toggleState(te.FETCHING_AD,!0);try{return await this.requestAd(r),this._state.toggleState(te.AD_AVAILABLE,!0),void this._state.toggleState(te.FETCHING_AD,!1)}catch(s){if(Re("Ads.fetchNextAd(err: %o, ad: %o)",s,r),this.setLastAd(r),r!==this._schedule.getPostroll())return await this.fetchNextAd(e,++t)}}else this._state.toggleState(te.FETCHING_AD,!1)}skipAdsOnSeek(e){if(!this._schedule)return;let t=this._schedule.getNextAd();for(;t&&t.time<e;)this._schedule.increment(),t=this._schedule.getNextAd()}async setCurrentTime(e,t=!1,s=!1){if(!this._schedule)return;if(!this.adapter.isReady())return;if(this._state.hasAny(te.FETCHING_AD))return;if(this._state.hasAny(te.PLAYING)&&this.adapter.isLinearAd())return;const i=0===e&&0===this._schedule.getNextIndex();try{if(s&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(e),this._state.hasAny(te.AD_AVAILABLE)||await this.fetchNextAd(e),!this._state.hasAny(te.AD_AVAILABLE)||!this.shallPlayAd(e)||t)return;await this.playAd(),await this.setCurrentTime(e),this.checkIfBreakComplete()}catch(e){Re("setCurrentTime: Error(from: setCurrentTime, message: %s)",e.message)}finally{i&&this.trigger("ad-preroll-finished")}}async playAd(){var e;if(!this._state.hasAny(te.AD_AVAILABLE))return;this._state.toggleState(te.AD_AVAILABLE,!1),this._state.toggleState(te.BREAK_ACTIVE,!0);const t=null===(e=this._schedule)||void 0===e?void 0:e.getCurrentAd();try{await this.adapter.playAd()}catch(e){console.error("Ads.playAd: error",e)}finally{t&&this.setLastAd(t)}}checkIfBreakComplete(){if(!this._state.hasAny(te.BREAK_ACTIVE))return Re("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());Re("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(te.BREAK_ACTIVE,!1),this.adapter.isAdPod()||this.trigger("ad-break-completed")}resetScheduleCounter(){this._schedule&&this._schedule.resetCounter()}setSchedule(e,t){if(t&&!isNaN(t)&&this._schedule&&this._schedule.updateContentDuration(t),this._schedule&&this._schedule.getNextIndex()>0)return this._schedule.setAds(e);this._schedule=new Schedule(e,{preload_advance:this.opts.preload_advance,content_duration:t?0:t})}toJSON(){return this._schedule?this._schedule.toJSON():[]}trigger(e,t={}){var s;if(!this.adapter.getVideoTag())return;if(!this._state)return;if("ad-break-completed"===e&&this._state.hasAny(te.BREAK_ACTIVE)&&!this.adapter.isAdPod())return Re("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if(null===(i=t)||"object"!=typeof i||X(i)!==J)return this.dispatch(e,t);var i;const r=Object.assign({},this.adapter.getOpts()||{},(null===(s=this._schedule)||void 0===s?void 0:s.getCurrentAd())||{},{ad_type:this.ad_type},t);return this.dispatch(e,r)}dispatch(e,t){const s=this.adapter.getVideoTag();if(s){Re(":dispatch",e,t);try{const i={event:"ads/"+e,detail:{outstream:t.outstream,ad_type:t.ad_type,ad_break_time:t.time,ad_remaining_seconds:t.remaining,ad_muted:t.muted,ad_duration_seconds:t.duration,ad_error_reason:t.reason,ad_vast_error:t.vast_error,ad_vast_error_type:t.vast_error_type,ad_request_load_type:t.request_load_time}};s.dispatchEvent(new CustomEvent("health:record",{detail:i}))}catch(e){Re(":error",e)}se(s,e,t),this.emit(e,t)}}get ad_type(){return this._schedule&&this._schedule.getCurrentType()}shouldRestartContent(){if(this.getIsContentProcessingNewSrc())return!1;if(this.adapter.isAdPod())return!0;const e=this.getLastAd();return!e||!e.outstream&&!1!==e.restart}async finished(e){if(this._schedule&&(Re("Ads.finished"),!(this.adapter.isSharedVideoTag()&&this._state.hasAny(te.PLAYING)&&this.adapter.isLinearAd()))){Re("Ads.finished: trying to play postroll");try{if(!this._schedule.getPostroll())return Re("Ads.finished: no postroll found"),await this.adapter.contentComplete();this._state.hasAny(te.AD_AVAILABLE)||await this.fetchNextAd(-1),await this.playAd(),this.adapter.contentComplete()}catch(e){Re("Ads.finished: postroll failed:",e)}finally{this.trigger("ad-postroll-finished"),this.checkIfBreakComplete(),"function"==typeof e&&e()}}}hasPreroll(){return this._schedule&&Schedule.hasPreroll(this._schedule.getAds())}shallPlayAd(e){var t;return(!this.adapter||!this.adapter.isAdPod())&&(!(!this._state||this._state.hasAny(te.FATAL_ERROR))&&!!(null===(t=this._schedule)||void 0===t?void 0:t.shallPlayAd(e)))}setLastAd(e){return this._lastAd=e,this}setIsContentProcessingNewSrc(e){this.content_processing_src=e}getLastAd(){return this._lastAd}getIsContentProcessingNewSrc(){return this.content_processing_src}mergeMacros(e={}){return this._macros=this._macros.fork(Object.assign({},e)),this}get paused(){return this.adapter&&this.adapter.isPaused()}pause(){this.adapter&&this.adapter.pause()}resume(){this.adapter&&this.adapter.resume()}resize(e){this.adapter&&this.adapter.onResize(e)}async requestAd(e,t=0,s=this.opts.timeout){if(!this._state)return;Re("Ads.requestAd(ad: %o)",{ad:e,timeout:s,idx:t});const i=await async function e(t){if("function"==typeof t)return[await Z(t)];if("string"==typeof t)return[await Z(t)];if(Array.isArray(t)){const e=t;return await Promise.all(e.map(Z))}if("object"==typeof t&&t&&t.adTag)return await e(t.adTag);throw new Error(`\n unhandled ads type ${typeof t}:\n ${JSON.stringify(t)}\n can be:\n | Array<string>\n | string\n | function\n | {adTag: Array<string>|string|function}\n `)}(e);if(void 0===i[t])return Promise.reject(new Error("Ad failed, no fallbacks left"));if(!i[t])return await this.requestAd(i,t+1,s);this.trigger("ad-requested",e);const r=this._macros.compile(i[t],K(this.opts,this.adapter.getDimensions()));try{return void await this.adapter.initAd(r,s)}catch(e){return Re(`Ads.requestAd(:fallback, idx: ${t}, length: ${i.length}, adTag: ${i[t]})\nError `,{adTag:i,err:e}),this.requestAd(i,t+1,s)}}resetSchedule(e){this._schedule&&this._schedule.reset(e)}get adPlaying(){return this._state&&this._state.hasAny(te.PLAYING)}get adBreak(){return this._state&&this._state.hasAny(te.BREAK_ACTIVE)}get adRequesting(){return this._state.hasAny(te.FETCHING_AD)}get adLinear(){return this.adBreak&&this.adapter.isLinearAd()}}var De=new Blob([new Uint8Array([255,227,24,196,0,0,0,3,72,1,64,0,0,4,132,16,31,227,192,225,76,255,67,12,255,221,27,255,228,97,73,63,255,195,131,69,192,232,223,255,255,207,102,239,255,255,255,101,158,206,70,20,59,255,254,95,70,149,66,4,16,128,0,2,2,32,240,138,255,36,106,183,255,227,24,196,59,11,34,62,80,49,135,40,0,253,29,191,209,200,141,71,7,255,252,152,74,15,130,33,185,6,63,255,252,195,70,203,86,53,15,255,255,247,103,76,121,64,32,47,255,34,227,194,209,138,76,65,77,69,51,46,57,55,170,170,170,170,170,170,170,170,170,170,255,227,24,196,73,13,153,210,100,81,135,56,0,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170])],{type:"audio/mpeg"}),Ie=new Blob([new Uint8Array([0,0,0,28,102,116,121,112,105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,109,112,52,49,0,0,0,8,102,114,101,101,0,0,2,239,109,100,97,116,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,2,194,109,111,111,118,0,0,0,108,109,118,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,232,0,0,0,47,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,236,116,114,97,107,0,0,0,92,116,107,104,100,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,101,100,116,115,0,0,0,28,101,108,115,116,0,0,0,0,0,0,0,1,0,0,0,47,0,0,0,0,0,1,0,0,0,0,1,100,109,100,105,97,0,0,0,32,109,100,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,68,0,0,8,0,85,196,0,0,0,0,0,45,104,100,108,114,0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0,0,0,1,15,109,105,110,102,0,0,0,16,115,109,104,100,0,0,0,0,0,0,0,0,0,0,0,36,100,105,110,102,0,0,0,28,100,114,101,102,0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1,0,0,0,211,115,116,98,108,0,0,0,103,115,116,115,100,0,0,0,0,0,0,0,1,0,0,0,87,109,112,52,97,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,16,0,0,0,0,172,68,0,0,0,0,0,51,101,115,100,115,0,0,0,0,3,128,128,128,34,0,2,0,4,128,128,128,20,64,21,0,0,0,0,1,244,0,0,1,243,249,5,128,128,128,2,18,16,6,128,128,128,1,2,0,0,0,24,115,116,116,115,0,0,0,0,0,0,0,1,0,0,0,2,0,0,4,0,0,0,0,28,115,116,115,99,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,28,115,116,115,122,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,115,0,0,1,116,0,0,0,20,115,116,99,111,0,0,0,0,0,0,0,1,0,0,0,44,0,0,0,98,117,100,116,97,0,0,0,90,109,101,116,97,0,0,0,0,0,0,0,33,104,100,108,114,0,0,0,0,0,0,0,0,109,100,105,114,97,112,112,108,0,0,0,0,0,0,0,0,0,0,0,0,45,105,108,115,116,0,0,0,37,169,116,111,111,0,0,0,29,100,97,116,97,0,0,0,1,0,0,0,0,76,97,118,102,53,54,46,52,48,46,49,48,49])],{type:"video/mp4"});function Pe(e){return Object.assign({muted:!1,timeout:250,inline:!1},e)}function ke(e,t){var s=e.muted,i=e.timeout,r=e.inline,a=t(),n=a.element,o=a.source,d=void 0,l=void 0,c=void 0;return n.muted=s,!0===s&&n.setAttribute("muted","muted"),!0===r&&n.setAttribute("playsinline","playsinline"),n.src=o,new Promise((function(e){d=n.play(),l=setTimeout((function(){c(!1,new Error("Timeout "+i+" ms has been reached"))}),i),c=function(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n.remove(),n.srcObject=null,clearTimeout(l),e({result:t,error:s})},void 0!==d?d.then((function(){return c(!0)})).catch((function(e){return c(!1,e)})):c(!0)}))}var Ce={audio:function(e){return ke(e=Pe(e),(function(){return{element:document.createElement("audio"),source:URL.createObjectURL(De)}}))},video:function(e){return ke(e=Pe(e),(function(){return{element:document.createElement("video"),source:URL.createObjectURL(Ie)}}))}};let Ne=void 0;async function Ue(e=!0){return Ne||(Ne=await Ce.video({timeout:500,muted:e}),Ne)}const xe=new Blob([new Uint8Array([0,0,0,28,102,116,121,112,105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,109,112,52,49,0,0,0,8,102,114,101,101,0,0,2,239,109,100,97,116,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,2,194,109,111,111,118,0,0,0,108,109,118,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,232,0,0,0,47,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,236,116,114,97,107,0,0,0,92,116,107,104,100,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,101,100,116,115,0,0,0,28,101,108,115,116,0,0,0,0,0,0,0,1,0,0,0,47,0,0,0,0,0,1,0,0,0,0,1,100,109,100,105,97,0,0,0,32,109,100,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,68,0,0,8,0,85,196,0,0,0,0,0,45,104,100,108,114,0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0,0,0,1,15,109,105,110,102,0,0,0,16,115,109,104,100,0,0,0,0,0,0,0,0,0,0,0,36,100,105,110,102,0,0,0,28,100,114,101,102,0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1,0,0,0,211,115,116,98,108,0,0,0,103,115,116,115,100,0,0,0,0,0,0,0,1,0,0,0,87,109,112,52,97,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,16,0,0,0,0,172,68,0,0,0,0,0,51,101,115,100,115,0,0,0,0,3,128,128,128,34,0,2,0,4,128,128,128,20,64,21,0,0,0,0,1,244,0,0,1,243,249,5,128,128,128,2,18,16,6,128,128,128,1,2,0,0,0,24,115,116,116,115,0,0,0,0,0,0,0,1,0,0,0,2,0,0,4,0,0,0,0,28,115,116,115,99,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,28,115,116,115,122,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,115,0,0,1,116,0,0,0,20,115,116,99,111,0,0,0,0,0,0,0,1,0,0,0,44,0,0,0,98,117,100,116,97,0,0,0,90,109,101,116,97,0,0,0,0,0,0,0,33,104,100,108,114,0,0,0,0,0,0,0,0,109,100,105,114,97,112,112,108,0,0,0,0,0,0,0,0,0,0,0,0,45,105,108,115,116,0,0,0,37,169,116,111,111,0,0,0,29,100,97,116,97,0,0,0,1,0,0,0,0,76,97,118,102,53,54,46,52,48,46,49,48,49])],{type:"video/mp4"});var Fe=Object.freeze({__proto__:null,STICKY_CONTROLS:1,NO_FULLSCREEN:2,NO_AD_INDICATOR:4,AD_ATTRIBUTION:8,AD_CHOICES:16,REMAINING_TIME:32,VOLUME_BAR:64});function qe(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}const Be=["progress","duration","remaining"],je=v("ads/ui");class AdUI extends HTMLElement{constructor(e,t=document.createElement("div")){super(),this.player=e,this.adContainer=t,this.render(),e.addEventListener("ad/playing",e=>this.updateState(e.type)),e.addEventListener("ad/paused",e=>this.updateState(e.type)),e.addEventListener("ad/complete",e=>this.updateState(e.type)),e.on("ad-progress",e=>{const{remaining:t}=e.detail;this.setAttribute("remaining",t+"")}),e.on("ad/hide-first-frame",e=>{const{root:t}=e.detail;je("hideFirstFrame"),t.classList.toggle("ad-hide-first-frame",!0)}),e.on("ad/show-first-frame",e=>{const{root:t}=e.detail;je("showFirstFrame"),t.classList.toggle("ad-hide-first-frame",!1)}),e.on("ad/resize",e=>{const{opts:t}=e.detail,s=this.style;t.linear?t.width&&(s.width=t.width+"px"):t.width?this.adContainer.style.width=t.width+"px":s.removeProperty("width"),t.height?s.height=t.height+"px":s.removeProperty("height")}),e.on("ad/set-ui-flags",e=>{let{ui_flags:t}=e.detail;if(t=t||0,this.classList.toggle("is-ad-controls-sticky",(1&t)>0),this.classList.toggle("no-fullscreen",(2&t)>0),this.classList.toggle("no-indicator",(4&t)>0),(8&t)>0){const e=document.createElement("div");e.classList.add("ad-attribution"),e.textContent=this.player.i18n("ads.advertisement","Advertisement"),this.adContainer.append(e)}if(this.classList.toggle("no-volume-bar",0==(64&t)),(32&t)>0&&this.controls&&(this.remaining=document.createElement("div"),this.remaining.classList.add("fp-ad-remaining","fp-color-text"),this.controls.prepend(this.remaining)),(16&t)>0&&this.controls){this.classList.toggle("is-ad-choices",!0);const e=document.createElement("div");e.classList.add("fp-ad-choices"),e.textContent=this.player.i18n("ads.adchoices","AdChoices"),e.addEventListener("click",e=>{e.preventDefault(),this.player.togglePlay(!1),window.open("https://adssettings.google.com","_blank")}),this.controls.append(e)}})}static get observedAttributes(){return Be}updateState(e){["ad/paused","ad/playing"].forEach(t=>{const s=t.replace("/","-"),i=e===t;this.player.setState(s,i),this.classList.toggle(s,i)})}attributeChangedCallback(e,t,s){switch(e){case"duration":return this.onDurationChange(parseFloat(s));case"progress":return this.onProgress(parseFloat(t),parseFloat(s));case"remaining":return this.onRemaining(s)}}onDurationChange(e){}onProgress(e,t){}onRemaining(e){this.remaining&&(this.remaining.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let i=Math.floor(e/60);return e-=60*i,s>=1?(i-=60*s,t+s+":"+qe(i)+":"+qe(e)):t+qe(i)+":"+qe(e)}(parseFloat(e)))}render(){this.adContainer.classList.add("fp-ad-container"),this.append(this.adContainer),this.controls=A(this.player,"flowplayer-ad-controls");const e=A(this.player,"flowplayer-ad-countdown");this.append(this.controls,e)}}const Ve=v("fpads:native:outstream"),ze={OUTSTREAM:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"};var He,Ge;!function(e){e.OUTSTREAM_VISIBLE="ads-outstream-visible",e.OUTSTREAM_VIEWPORT_UPDATE="ads-outstream-viewport-update",e.OUTSTREAM_TEARDOWN="ads-outstream-teardown",e.OUTSTREAM_ENDSCREEN_READY="ads-outstream-endscreen-ready"}(He||(He={})),function(e){e[e.None=0]="None",e[e.Booting=1]="Booting",e[e.Ready=2]="Ready",e[e.Disposed=3]="Disposed"}(Ge||(Ge={}));class Outstream{constructor({ads:e,root:t,content:s,ima:i}){this.state=Ge.None,Ve("creating Outstream instance"),this.content=s,this.ads=e,this.root=t,this.ima=i,this.aspectRatio=s.videoHeight/s.videoWidth,this.dimensions=function(e){if(e.clientWidth>0||e.clientHeight)return h(e);const t={height:e.style.height};p(e,"opacity",0),p(e,"display","absolute"),p(e,"display","inline-block"),p(e,"height","auto");const s=h(e);return p(e,"height",t.height),p(e,"opacity",1),s}(this.root),this.adUi=new AdUI(s),this.adContainer=this.adUi.adContainer,this.initialVolumeState={},t.classList.add(ze.OUTSTREAM),t.append(this.adUi),this.hide(),this.ads.on("ad-pause-content",e=>{var t;if(this.state==Ge.Disposed)return;const s=!!(null===(t=e.detail)||void 0===t?void 0:t.linear);this.ads.resize(Object.assign(Object.assign({},this.dimensions),{linear:s}))}),s.on("resize",e=>{if(this.state==Ge.Disposed)return;const t=e.detail;t&&(this.dimensions={width:t.contentRect.width,height:t.contentRect.height},this.ads.resize(this.dimensions))}),s.on("intersectionchange",e=>{if(this.state==Ge.Disposed)return;const t=e.detail;if(t)switch(this.state){case Ge.Booting:return Ve(":boot skipping intersectionchange");case Ge.None:return this.state=Ge.Booting,this.begin_life_cycle();case Ge.Ready:if(t.ratio>=.5&&this.ads.adPlaying)return;t.ratio>=.5&&this.ads.resume(),t.ratio<.5&&this.ads.pause()}}),this.setup(),setTimeout(()=>(this.state=Ge.Booting,this.begin_life_cycle()),0)}hide(){return this}restore_aspect_ratio(){return Ve(`Outstream.restore_aspect_ratio(${this.aspectRatio})`),this.content.setOpts({ratio:this.aspectRatio}),this}show(){this.root.classList.remove(Outstream.CLASS.HIDDEN),this.root.classList.add(Outstream.CLASS.SHOWING),this.adUi.classList.add("linear","on")}async begin_life_cycle(){var e;this.state=Ge.Ready;const{error:t,result:s}=await Ue(!1),{result:i}=await Ue(!0);this.content.emit("ad/set-ui-flags",{ui_flags:null===(e=this.content.opts.ads)||void 0===e?void 0:e.ui}),this.attach_ad_listeners(),this.initialVolumeState={can_autoplay:!(!s&&!i),muted:!s},Ve("Outstream.show() :autoplay >> sound="+s),t&&this.content&&!s&&(this.content.muted=!0,this.content.volume=0),await this.ads.setVideoTag(this.content),await T({ads:this.ads,content:this.content,adContainer:this.adContainer,ima:this.ima,state:{listening:!1},config:this.content.opts}),I({content:this.content,ads:this.ads}),this.state=Ge.Ready}attach_ad_listeners(){const e=this.ads;e.once("ad-pause-content",()=>{this.show(),this.ads.adPlaying&&this.ads.pause()}),this.ima.always_show_controls||e.on("vpaid-init",()=>this.adUi.classList.add("is-vpaid"));const t=()=>{S.forEach(e=>this.ads.removeListener(e,t));const e=new CustomEvent(He.OUTSTREAM_TEARDOWN);Ve("Outstream(:teardown)",e),this.content.dispatchEvent(e)};S.forEach(e=>this.ads.once(e,t)),this.content.once(He.OUTSTREAM_TEARDOWN,e=>{setTimeout(()=>{if(e.defaultPrevented)return this.handle_endscreen();this.dispose()},0)})}handle_endscreen(){this.reset_ui(),this.ads.reset(),M({config:this.content.opts,ui:this.adUi,ads:this.ads,adContainer:this.adContainer,ima:this.ima,content:this.content,root:this.content.root,state:{started:!0,listening:!1},initial:{muted:!0,volume:1}})}empty_src(){this.content.setSrc({type:"video/mp4",src:URL.createObjectURL(xe)})}setup(){this.root.classList.add(Outstream.CLASS.OUTSTREAM),this.root.classList.add(Outstream.CLASS.HIDDEN),this.empty_src()}reset_ui(){const e=this.root;e.classList.remove(Outstream.CLASS.SHOWING),e.classList.remove(Outstream.CLASS.OUTSTREAM),this.adUi.classList.remove("on")}dispose(){if(this.state==Ge.Disposed)return;const e=this.root,t=this.content;this.reset_ui(),e.classList.add(Outstream.CLASS.OUTSTREAM),e.classList.add(Outstream.CLASS.DONE);this.video=this.container=this.ads=0,this.state=Ge.Disposed,t.destroy(),e.innerHTML=""}}function Qe(e){return e&&"number"==typeof e.time}function We(e){return e&&"number"==typeof e.percentage&&"number"!=typeof e.time}Outstream.CLASS=ze;const $e=v("ads/ima/sdk");var Ke;async function Ye(e){var t;if(null===(t=null===window||void 0===window?void 0:window.google)||void 0===t?void 0:t.ima)return void $e(":noop");const s=e._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(e){return new Promise((t,s)=>{let i=document.querySelector(`script[src='${e}']`);if(i)return Ze(i,t,s);i=document.createElement("script"),i.setAttribute("state",Ke.LOADING),Ze(i,t,s),i.src=e,document.head.appendChild(i)})}(s),void $e(":loaded")}catch(e){$e(":error "+e.message,e)}}function Ze(e,t,s){const i=e.getAttribute("state");if(i&&[Ke.ERROR,Ke.LOADED].includes(i))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",Ke.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",Ke.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(Ke||(Ke={}));const Je=v("ads/index");async function Xe(e,t,s){let i;if(s.on("config",()=>{void 0===i&&e.autoplay&&!s.currentSrc&&(i=e.autoplay,e.autoplay=0),s.ads&&o()}),s.once("loadstart",()=>{setTimeout(()=>{var t;if(!Array.isArray(null===(t=null==e?void 0:e.ima)||void 0===t?void 0:t.ads)&&void 0!==i){if(e.autoplay=i,s.setState("is-autoplay",!0),!s.hasState(f))return s.once("viewenter",()=>s.togglePlay(!0));s.togglePlay(!0)}},0)}),await Ye(s),!("google"in window))return console.warn("google.ima unavailable");let r=!1;const a=s.ads=new AdsController,n=a.analytics;function o(){const o=e.ima;if(!o||!Array.isArray(o.ads))return;const d=e.duration||s.duration;if(o.ads=function(e,t){return Array.isArray(e)?e.filter(e=>Qe(e)||We(e)).reduce((e,s)=>{if(Qe(s))return e.push(s),e;if(s.lazy)return e.push(s),e;if(We(s)){const i=Object.assign({},s),r=s.percentage?s.percentage*t:0;return isNaN(r)||(i.time=r<0||r===t?-1:r),e.push(i),e}return e},[]):(console.warn("AdSchedule was not an Array"),[])}(o.ads,d),a.setSchedule(o.ads,d),e.metadata&&Analytics.mergeMetadata(n,e.metadata),e.metadata&&a.mergeMacros(e.metadata),e.metadata&&o.parameters&&(o.parameters=Object.assign(Object.assign({},o.parameters),e.metadata)),Analytics.mergeMetadata(n,{muted:e.muted||!1,autoplay:e.autoplay||!1}),!r){if(r=!0,e.lang&&!o.Locale&&(o.Locale=e.lang),Schedule.isOutstream(o.ads))return Je("is outstream, returning"),new Outstream({root:t,content:s,ads:a,ima:o});L({config:Object.assign(Object.assign({},e),{autoplay:i}),root:t,content:s,ads:a,ima:o})}}a.resize(h(t)),_&&(s.on(["fullscreenenter","fullscreenexit","webkitendfullscreen"],e=>{var t;const i="fullscreenenter"===e.type;null===(t=null==s?void 0:s.ads)||void 0===t||t.adapter.setIOSPlaysInline(!i)}),a.on("ad-postroll-finished",()=>{a.adapter.isSharedVideoTag()&&a.once("ad-break-completed",()=>{s.src=s.original_src,s.once("canplay",()=>{s.togglePlay(!1)}),s.webkitExitFullscreen()})})),s.on("reap",(function(){a&&a.destroy()})),o()}class AdControls extends HTMLElement{constructor(e){super(),this.player=e,this.render()}render(){this.classList.add("fp-ad-controls");const e=A(this.player,"flowplayer-ad-indicator"),t=document.createElement("div");t.classList.add("ad-playback-controls");const s=A(this.player,"flowplayer-small-play-icon"),i=A(this.player,"flowplayer-small-pause-icon");s.addEventListener("click",()=>{this.player.emit("request/ad/play"),setTimeout((function(){i.focus&&i.focus()}),100)}),i.addEventListener("click",()=>{this.player.emit("request/ad/pause"),setTimeout((function(){s.focus&&s.focus()}),100)}),t.append(s,i);const r=A(this.player,"flowplayer-volume-icon");r.addEventListener("click",()=>this.player.emit("request/ad/muteunmute"));const a=A(this.player,"flowplayer-volume-bar"),n=A(this.player,"flowplayer-header-right-zone");this.append(e,t,r,a,n)}}class AdCountdown extends HTMLElement{constructor(e){super(),this.player=e,e.on("ad-progress",e=>{const{duration:t,remaining:s}=e.detail;this.setAttribute("duration",t+""),this.setAttribute("remaining",s+"")}),e.on("ad-started",e=>{e.detail.linear&&(this.style.setProperty("--ad-percent-previous","0"),this.style.setProperty("--ad-percent-complete","0"))}),this.addEventListener("animationend",()=>{const e=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",e)})}static get observedAttributes(){return["remaining"]}attributeChangedCallback(e,t,s){switch(e){case"remaining":return this.onRemaining(s)}}onRemaining(e){const t=parseFloat(this.getAttribute("duration")||"0");e||(e=t+"");const s=parseFloat(e),i=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",i),this.classList.remove("go");const r=((t-s)/t*100).toFixed(3);requestAnimationFrame(()=>{this.style.setProperty("--ad-percent-complete",r),this.classList.add("go")})}}class AdIndicator extends HTMLElement{constructor(e){super(),this.player=e,this.render(),e.on("ad-started",e=>{const{position:t,totals:s}=e.detail.ad;this.setAttribute("position",t+""),this.setAttribute("totals",s+"")})}static get observedAttributes(){return["position","totals"]}attributeChangedCallback(e,t){switch(e){case"position":case"totals":return this.updateText()}}updateText(){if(!this.element)return;const e=parseFloat(this.getAttribute("position")||"0"),t=parseFloat(this.getAttribute("totals")||"0");this.element.textContent=`${this.player.i18n("ads.indicator","ADS")} ${e} / ${t}`}render(){this.element=document.createElement("div"),this.element.classList.add("ad-indicator","fp-color-text"),this.element.textContent=this.player.i18n("ads.indicator","ADS"),this.append(this.element)}}var et=Object.freeze({__proto__:null,SINGlE_INLINE_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_SKIPPABLE_INLINE:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_preroll_skippable&sz=640x480&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirectlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_ERROR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirecterror&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_BROKEN:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirecterror&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&nofb=1&correlator=",SINGLE_VPAID_20_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinearvpaid2js&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_VPAID_20_NON_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dnonlinearvpaid2js&ciu_szs=728x90%2C300x250&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_NON_LINEAR_INLINE:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/nonlinear_ad_samples&sz=480x70&cust_params=sample_ct%3Dnonlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_SESSION_AD_RULE_PREROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sar%3Da0f2&ciu_szs=300x250&ad_rule=1&gdfp_req=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_PREROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpreonly&ciu_szs=300x250%2C728x90&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_PREROLL_BUMPER:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpreonlybumper&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_POSTROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpostonly&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_POSTROLL_BUMPER:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpostonlybumper&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator="});const{samsung_tv:tt}=u();class Ads{constructor(e){this.umd=e,w(e,b,AdUI),w(e,"flowplayer-ad-controls",AdControls),w(e,"flowplayer-ad-countdown",AdCountdown),w(e,"flowplayer-ad-indicator",AdIndicator)}init(e,t,s){if(c.from_token(e.token||"").is_granted(c.permissions.ADS)&&!tt)return Xe(e,t,s)}}return Ads.events=m,Ads.ui=Fe,Ads.tags=et,function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const s=e.flowplayer;"function"==typeof s?s(t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t))}(window,Ads),Ads}));
|