@flowplayer/player 3.29.0 → 3.30.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/index.d.ts +4 -4
- package/package.json +2 -2
- package/plugins/ads.d.ts +4 -4
- package/plugins/ads.js +2 -2
- package/plugins/airplay.d.ts +4 -4
- package/plugins/airplay.js +1 -1
- package/plugins/analytics.d.ts +4 -4
- package/plugins/analytics.js +1 -1
- package/plugins/asel.d.ts +4 -4
- package/plugins/asel.js +1 -1
- package/plugins/audio.d.ts +4 -4
- package/plugins/audio.js +1 -1
- package/plugins/chapters.d.ts +4 -4
- package/plugins/chapters.js +1 -1
- package/plugins/chromecast.d.ts +4 -4
- package/plugins/chromecast.js +1 -1
- package/plugins/comscore.d.ts +4 -4
- package/plugins/comscore.js +1 -1
- package/plugins/consent.d.ts +4 -4
- package/plugins/consent.js +1 -1
- package/plugins/context-menu.d.ts +4 -4
- package/plugins/context-menu.js +1 -1
- package/plugins/cuepoints.d.ts +4 -4
- package/plugins/cuepoints.js +1 -1
- package/plugins/dash.d.ts +4 -4
- package/plugins/dash.js +2 -5
- package/plugins/drm.d.ts +4 -4
- package/plugins/drm.js +1 -1
- package/plugins/endscreen.d.ts +4 -4
- package/plugins/endscreen.js +1 -1
- package/plugins/fas.d.ts +4 -4
- package/plugins/fas.js +1 -1
- package/plugins/float-on-scroll.d.ts +4 -4
- package/plugins/float-on-scroll.js +1 -1
- package/plugins/ga4.d.ts +4 -4
- package/plugins/ga4.js +1 -1
- package/plugins/gemius.d.ts +4 -4
- package/plugins/gemius.js +1 -1
- package/plugins/google-analytics.d.ts +4 -4
- package/plugins/google-analytics.js +1 -1
- package/plugins/hls.d.ts +4 -4
- package/plugins/hls.js +1 -1
- package/plugins/id3.d.ts +4 -4
- package/plugins/id3.js +1 -1
- package/plugins/iframe.d.ts +4 -4
- package/plugins/iframe.js +1 -1
- package/plugins/keyboard.d.ts +4 -4
- package/plugins/keyboard.js +1 -1
- package/plugins/media-session.d.ts +4 -4
- package/plugins/media-session.js +1 -1
- package/plugins/message.d.ts +4 -4
- package/plugins/message.js +1 -1
- package/plugins/ovp.d.ts +10 -4
- package/plugins/ovp.js +1 -1
- package/plugins/playlist.d.ts +4 -4
- package/plugins/playlist.js +1 -1
- package/plugins/preview.d.ts +4 -4
- package/plugins/preview.js +1 -1
- package/plugins/qsel.d.ts +4 -4
- package/plugins/qsel.js +1 -1
- package/plugins/qul.d.ts +4 -4
- package/plugins/qul.js +1 -1
- package/plugins/rts.d.ts +4 -4
- package/plugins/rts.js +7 -7
- package/plugins/share.d.ts +4 -4
- package/plugins/share.js +1 -1
- package/plugins/speed.d.ts +4 -4
- package/plugins/speed.js +1 -1
- package/plugins/ssai.d.ts +4 -4
- package/plugins/ssai.js +2 -2
- package/plugins/subtitles.d.ts +4 -4
- package/plugins/subtitles.js +1 -1
- package/plugins/thumbnails.d.ts +4 -4
- package/plugins/thumbnails.js +1 -1
- package/plugins/tizen.d.ts +4 -4
- package/plugins/tizen.js +1 -1
- package/plugins/vtsel.d.ts +4 -4
- package/plugins/vtsel.js +1 -1
- package/plugins/webos.d.ts +4 -4
- package/plugins/webos.js +1 -1
- package/util/loader.d.ts +4 -4
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=/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_SHOW_FIRST_FRAME:"ad/show-first-frame",AD_RESIZE:"ad/resize",AD_SET_UI_FLAGS:"ad/set-ui-flags",PBJS_AVAILABLE:"ad/pbjs"});const _="is-in-viewport";function f(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}var v;!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){}}(),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(v||(v={}));function y(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}function A(e){return function(e,t){const s=e.seekable;if("object"!=typeof e.opts||0==s.length)return{head:0,tail:0};const i=b(e),r=t||e.live_state.dvr_window;return{head:i,tail:"number"!=typeof r||i-r<0?s.start(0):i-r}}(e).tail}function b(e){var t;const s=e.seekable;return s.length?e.hasState("is-chromecast-playing")||!(null===(t=e.hls)||void 0===t?void 0:t.liveSyncPosition)?s.end(s.length-1):e.hls.liveSyncPosition:0}function w(e){try{e.dvr_offset=0,e.currentTime=b(e)}catch(e){console.warn("failed to seek to now: %j",e)}}function E(e,t){if(!e.hasState("is-live")||![void 0,0,-1].includes(t)||!e.seekable.length||e.hasState("has-casted"))return e.setState("is-starting",!1);e.once("seeked",()=>e.setState("is-starting",!1)),0===t?function(e){e.currentTime=A(e)}(e):w(e)}function S(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}const T=(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),L=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)},O="flowplayer-ad-ui",R=S("ads/lifecycle"),M=["ad-playback-error","ad-teardown","ad-break-completed"];async function k({config:e,root:t,content:s,ads:i,ima:r}){var a;R("LifeCycle::initLifeCycle",e,t,s,i,r),s.autoplay=!1;const n=e.autoplay===v.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}),s.on("ad/show-first-frame",()=>{R("showFirstFrame"),t.classList.toggle("ad-hide-first-frame",!1)});const d=T(s,O),l=d;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(R("initial",o),i.setVideoTag(s),e.autoplay){R("Trying to autoplay"),t.classList.add("ad-hide-first-frame"),R("hideFirstFrame");await async function e(t,s){const[i,r]=[t.muted,t.volume];R("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 R("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(_))return t(null);e.once("viewenter",()=>t(null))})}(t),R("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 R("Lifecycle::peek_content::pause"),await new Promise(e=>setTimeout(()=>e(t.togglePlay(!1)))),t.volume=r,R("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?(R("Lifecycle::peek_content::false"),await a()):(R("Lifecycle::peek_content::recover"),t.muted=!0,!!await e(t)||(t.muted=i,R("Lifecycle::peek_content::false"),await a()))}}(s,n)?(R("Can autoplay, start ad"),s.opts.autoplay=1,P({ads:i,content:s,state:c,adContainer:l,ima:r,config:e})):(R("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){(e.hasState(_)||"touchend"!=o.type)&&t.shallPlayAd(0)&&(t.adapter.setAttemptingPrerollOnIOS(t.adapter.isCustomPlaybackEnabled()),t.adapter.isCustomPlaybackEnabled()||o.preventDefault(),N({ads:t,content:e,state:i}),R("user_gesture(:intercept) -> shallPlayAd(0: %s)",t.shallPlayAd(0)),s.muted=r.muted,await P({ads:t,content:e,state:i,adContainer:a,ima:n,config:s}),U({ads:t,content:e}))}))}({content:s,ads:i,config:e,state:c,initial:o,adContainer:l,ima:r}),!e.autoplay&&i.hasPreroll()&&c.preload&&P({ads:i,content:s,state:c,adContainer:l,ima:r,config:e}),C({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.hasPreroll()&&(i.adapter.setAttemptingPrerollOnIOS(i.adapter.isCustomPlaybackEnabled()),e.preventDefault(),await i.setCurrentTime(0))};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||(R("prevented content from starting because ad break is active"),e.preventDefault()))})}async function P(e){e.state.started||(e.content.hasState(_)?await D(e):e.content.once("viewenter",async()=>{await D(e)}))}async function D({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,preload_ads:null===(n=null==a?void 0:a.ima)||void 0===n?void 0:n.preload_ads},o),d));R("start():",c,r),await e.initialize(!1,c,r.preload)}function I(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 C({config:e,root:t,content:s,ads:i,initial:r,adContainer:a,state:n,ui:o,ima:d}){R("addUIListeners()");const l=async()=>{if(i){if(!(i.adapter.isAttemptingPrerollOnIOS()||i.adapter.isCustomPlaybackEnabled()&&s.currentSrc!==s.original_src)){if(s.off("playing",l),R("addUIListeners() -> content started playing"),N({ads:i,content:s,state:n}),!i.shallPlayAd(0)||!i.adapter.isLinearAd())return R("addUIListeners() -> no more preroll ads -> resume content"),s.emit("ad/show-first-frame",{root:t}),await P({ads:i,content:s,state:n,adContainer:a,ima:d,config:e});s.togglePlay(!1),await P({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"),U({ads:i,content:s}))}}else s.off("playing",l)};s.on("playing",l),s.on(["portrait","landscape"],(function(){if(!i)return;const{content_width:e,content_height:r}=I(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 r;const a=()=>{e.preventDefault(),Object.assign(e,{prevented:!0})};if(t.classList.contains("ad-linear")&&t.classList.contains("ads-custom-playback-enabled"))return a();i&&(R("ui_listeners(:%s, event: %o)",e.type,e.detail),(null===(r=null==e?void 0:e.detail)||void 0===r?void 0:r.from)!==i&&(a(),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:o,ad_type:d}=a;let l;if(R(`Ad[linear: ${n}, currentTime: ${s.currentTime}] starting`,o),"preroll"==d&&!n&&s.paused&&s.togglePlay(!0),n&&(l=I(s,t)),i.resize({width:l?l.content_width:o.width,height:l?l.content_height:o.height,linear:n,resize_non_linear:!0}),s.emit("ad/resize",{opts:{linear:n,resizeContainerAlso:!0,width:n?void 0:o.width,height:n?void 0:o.height}}),t.classList.remove("is-waiting"),s.setState("ad-linear",n),s.setState("ad-non-linear",!n),!n){R("non-linear ad / restarting content");try{s.togglePlay(!0),s.volume=r.volume,s.muted=r.muted}catch(e){R(e)}}s.hasState(_)||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(M,e=>async function({root:e,content:t,ads:s,eventName:i,err:r={reason:""}}){R("teardown(event: %s)",i),s.adapter.isAttemptingPrerollOnIOS()&&(s.adapter.setAttemptingPrerollOnIOS(!1),!t.paused&&t.hasState("is-starting")&&t.hasState("is-playing")&&E(t,t.opts.start_time));e.classList.add("is-seamless"),e.classList.remove("is-waiting"),["ad-non-linear","ad-linear"].forEach(e=>t.setState(e,!1)),r.reason&&R("teardown(:err, reason: %s) %o",r.reason);const a=s.getLastAd();if(t.emit("ad/show-first-frame",{root:e}),!s.shouldRestartContent())return R("Lifecycle.teardown(:skip_restart, reason: %s)","Ad prevented restarting content"),x(e);if(t.currentTime>0&&t.currentTime>=t.duration||"postroll"==s.ad_type||!1===(null==a?void 0:a.restart))return R("Lifecycle.teardown(:skip_restart, reason: %s)","was a postroll ad"),x(e);""===t.currentSrc&&t.setSrc(t.original_src);t.paused&&s.shouldRestartContent()&&(R("Lifecycle.teardown(:toggle_play, %s)","attempting to restart content"),await t.togglePlay(!0));if(!t.paused)return R("Lifecycle.teardown(:ok)","restarted video content"),x(e)}({root:t,content:s,ads:i,ui:o,err:e.detail,eventName:e.type}));let c=!!e.autoplay;var u;s.on("viewenter",()=>{c&&!1!==d.autopause&&i.resume()}),s.on("viewleave",(u=()=>{!1!==d.autopause&&(c=!i.paused,i.pause())},e=>{setTimeout((function(){if(!e.defaultPrevented&&!e.prevented)return u(e)}),0)}))}function N({ads:e,content:t,state:s}){s.listening||(t.on(["timeupdate","seeked","playing","seeking"],s=>{e.adapter.isCustomPlaybackEnabled()&&(e.adPlaying||e.paused)||(e.adPlaying&&e.adapter.isLinearAd()&&!t.paused&&t.pause(),U({ads:e,content:t,seek:"seeking"===s.type}))}),s.listening=!0)}function U({ads:e,content:t,seek:s=!1}){e&&e.setCurrentTime(t.currentTime,void 0,s)}function x(e){e.classList.remove("is-seamless")}const F=S("ads/timers");class TimerRegistry{constructor(e={},t={}){this.intervals=e,this.timers=t}}let q=-1;function B(e,t,s){const i=setInterval(s,t);if(F("TimerRegistry.createInterval() -> "+i,e.intervals),"object"==typeof i){const t=++q;return e.intervals[t]=t,t}return e.intervals[i]=i,i}function j(e){if(e)return F("TimerRegistry.empty()",Object.keys(e.timers),Object.keys(e.intervals)),Object.keys(e.intervals).forEach(t=>function(e,t){return F("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 F("TimerRegistry.removeTimeout() -> "+t,e.timers),clearTimeout(e.timers[t]),delete e.timers[t],e}(e,t)),e}function H(e){try{return e.getAdPodInfo().getPodIndex()}catch(e){return}}class AdLoadingController{adRequestStart(e){"number"==typeof e&&"number"!=typeof this.requestStart&&(this.requestStart=performance.now())}adRequestEnd(){this.requestStart=void 0}getRemainingAdLoadTime(e,t){return"number"!=typeof t||"number"!=typeof this.requestStart?e:Math.max(0,t-(performance.now()-this.requestStart))}}function V(e){return function(e){return!document.fullscreenEnabled&&"function"==typeof e.webkitEnterFullScreen&&"function"==typeof e.webkitExitFullScreen}(e)&&!e.root.classList.contains("no-fullscreen")}class IMA{constructor(e){this.eventHandler=e,this.log=S("ads/adapter/ima"),this.google=window.google,this._adHandlers=[],this._timers=new TimerRegistry,this._started=!1,this._volumeLevel=0,this._adLoaded=!1,this.customPlaybackEnabled=!1,this._paused=!1,this._all_ads_completed=!1,this._currentDuration=0,this._currentRemaining=0,this._currentDisplayTs=0,this._isInitialized=!1,this._adBreakTime=0,this._prepared=!1,this.opts={},this.loadingController=new AdLoadingController}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}setVideoTag(e){this.videoTag=e,this.customPlaybackEnabled=V(e),e.root.classList.toggle("ads-custom-playback-enabled",this.customPlaybackEnabled)}setAdBreakTime(e){this._adBreakTime=e}getAdBreakTime(){return this._adBreakTime}isCustomPlaybackEnabled(){return this.customPlaybackEnabled}isAttemptingPrerollOnIOS(){var e;return!!(null===(e=null==this?void 0:this.videoTag)||void 0===e?void 0:e.root.classList.contains("preroll-ios"))}setAttemptingPrerollOnIOS(e){var t;null===(t=null==this?void 0:this.videoTag)||void 0===t||t.root.classList.toggle("preroll-ios",e)}isLinearAd(){return!!this._adLinear}getVideoTag(){return this.videoTag}getDimensions(){return this._dimensions||{}}getOpts(){return this.opts}isPaused(){return this._paused}destroy(){j(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;if(e.NumRedirects=e.NumRedirects||e.redirects,i.setVpaidMode(e.VpaidMode||this.google.ima.ImaSdkSettings.VpaidMode.INSECURE),i.setDisableCustomPlaybackForIOS10Plus(!this.customPlaybackEnabled),"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,s.loadVideoTimeout=e.media_timeout||-1,s.restoreCustomPlaybackStateOnAdBreakComplete=this.customPlaybackEnabled,this.customPlaybackEnabled&&(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),j(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=>{if(this.isAdPod()&&this.videoTag){const e=Math.abs(this.videoTag.currentTime-this.videoTag.duration)<1?-1:this.videoTag.currentTime;this.setAdBreakTime(e)}this.debugEvent(e);const t=e.getAd();t&&this.emitWithAd("ad-pause-content",t)}),i.addEventListener(this.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,e=>{this.debugEvent(e),this._started=!1,this._currentDisplayTs=0,this.eventHandler.trigger("ad-break-completed",{force:!0})}),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 r=e=>{this._paused=e,this.eventHandler.trigger(e?"ad-paused":"ad-resumed")};i.addEventListener(this.google.ima.AdEvent.Type.PAUSED,()=>r(!0)),i.addEventListener(this.google.ima.AdEvent.Type.RESUMED,()=>r(!1)),i.addEventListener(this.google.ima.AdEvent.Type.STARTED,()=>r(!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:a,height:n}=e;a&&n&&(i.init(a,n,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"),j(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){var s;this.log(`ima.initAd(adTag: ${e}, timeout: ${t})`),this.customPlaybackEnabled||this.loadingController.adRequestStart(this.opts.total_loading_timeout);try{if(await this.requestAd(e,this.loadingController.getRemainingAdLoadTime(t,this.opts.total_loading_timeout)),this._adLoaded=!0,this.customPlaybackEnabled)return;null===(s=this._adsManager)||void 0===s||s.updateAdsRenderingSettings({loadVideoTimeout:this.loadingController.getRemainingAdLoadTime(this.opts.media_timeout||-1,this.opts.total_loading_timeout)})}catch(e){throw this.log("ima.initAd:",e),this._adLoaded=!1,e}finally{j(this._timers)}}async requestAd(e,t){if(this.destroyManager("requestAd"),!this.videoTag)return;this.setAdBreakTime(this.videoTag.currentTime);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;return 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?new Promise(async(e,s)=>{var i;const r=this.waitForAdsManager();null===(i=this._adsLoader)||void 0===i||i.requestAds(n),this.once(this._adsLoader,this.google.ima.AdErrorEvent.Type.AD_ERROR,e=>{s(()=>(this.emitError("ad-request-error",e),Promise.reject(new Error("Ad load failed"))))}),setTimeout(()=>{s(()=>{r.then(e=>{e.destroy(),this._adsManager===e&&(this._adsManager=void 0)});const e=new Error("Ad internal timeout reached");return this.eventHandler.trigger("ad-timeout",e),Promise.reject(e)})},t),e(await r)}).then(e=>new Promise((t,s)=>{this.volume(a?0:this._volumeLevel),this.eventHandler.trigger("ad-volume-changed",this._volumeLevel);const r=this.cuepoints();if(r&&r.length&&0!==r[0])return t({ad:!1,adsManager:e});this.once(e,this.google.ima.AdErrorEvent.Type.AD_ERROR,e=>{s(()=>(this.emitError("ad-request-error",e),Promise.reject(e)))}),this.once(e,this.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{this._all_ads_completed=!0,t(null)}),this.once(e,this.google.ima.AdEvent.Type.LOADED,e=>{this.eventHandler.trigger("ad-request-completed",{request_load_time:Date.now()-i});const s=e.getAd();s&&(this.log("ima.requestAd: AD_REQUEST_COMPLETED",s.getContentType()),"application/javascript"==s.getContentType()&&this.eventHandler.trigger("vpaid-init",s),t(null))}),this.once(e,this.google.ima.AdEvent.Type.CLICK,()=>{this.log("ima.requestAd: click event"),this.pause()})}),e=>e()):void 0}async playAd(){if(this.log("ima.playAd()",this),!this._adsManager||!this._adLoaded)return;const e=this.currentAd();if(e&&(!this.customPlaybackEnabled||e.isLinear()))try{await this.startAndWaitForAdCompletion(this._adsManager,e.isLinear())}catch(e){throw this.log("ima.playAd",e),e}finally{this._adLoaded=!1,j(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(_)||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))))}onAdRequestEnd(){var e;this.customPlaybackEnabled||(this.loadingController.adRequestEnd(),null===(e=this._adsManager)||void 0===e||e.updateAdsRenderingSettings({loadVideoTimeout:this.opts.media_timeout||-1}))}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 B(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:H(t),ad:t})}catch(e){}}}var z=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))}})),G={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},W={delimiter:"&",strictNullHandling:!1,skipNulls:!1,encode:!0,encoder:z.encode},Q=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||z.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},$=Object.prototype.hasOwnProperty,K={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1,decoder:z.decode},Y=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&&$.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&&$.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)}},Z=function(e,t){var s,i,r=e,a=t||{},n=void 0===a.delimiter?W.delimiter:a.delimiter,o="boolean"==typeof a.strictNullHandling?a.strictNullHandling:W.strictNullHandling,d="boolean"==typeof a.skipNulls?a.skipNulls:W.skipNulls,l=("boolean"==typeof a.encode?a.encode:W.encode)?"function"==typeof a.encoder?a.encoder:W.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 G?a.arrayFormat:"indices"in a?a.indices?"indices":"repeat":"indices";var g=G[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(Q(r[_],_,g,o,d,l,i,c,u)))}return p.join(n)},J=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||z.isRegExp(s.delimiter)?s.delimiter:K.delimiter,s.depth="number"==typeof s.depth?s.depth:K.depth,s.arrayLimit="number"==typeof s.arrayLimit?s.arrayLimit:K.arrayLimit,s.parseArrays=!1!==s.parseArrays,s.decoder="function"==typeof s.decoder?s.decoder:K.decoder,s.allowDots="boolean"==typeof s.allowDots?s.allowDots:K.allowDots,s.plainObjects="boolean"==typeof s.plainObjects?s.plainObjects:K.plainObjects,s.allowPrototypes="boolean"==typeof s.allowPrototypes?s.allowPrototypes:K.allowPrototypes,s.parameterLimit="number"==typeof s.parameterLimit?s.parameterLimit:K.parameterLimit,s.strictNullHandling="boolean"==typeof s.strictNullHandling?s.strictNullHandling:K.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))),$.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=Y(o,i[o],s);r=z.merge(r,d,s)}return z.compact(r)};const X=S("fpads:macros"),ee=/\[([\s\S]+?)\]/g;class Macros{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 X("Macro.replace(raw: %s, macro: %s, value: %s)",i,t,n),n})}constructor(e={},t=ee){this.vars=e,this.pattern=t}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=J(r||"",{strictNullHandling:!0,decoder:e=>e}),n=Z(Macros.process_obj(a,this,s),{encode:!1,strictNullHandling:!0});return Macros.process_str(i,this,s,!0)+"?"+n}}function te(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:ee,CURLY:/\{([\s\S]+?)\}/g,UNDERSCORE:/__([\s\S]+?)__/g};const se=/^flowplayer:\/\/(.+)/;async function ie(e){if("string"==typeof e&&se.test(e)){const t=se.exec(e),s=t&&window[t[1]];if(s)return ie(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 re=Object.prototype,ae=Object.getPrototypeOf;const ne=S("fpads:ads:state");var oe;!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"}(oe||(oe={}));class AdsState{static of(){return new AdsState}constructor(e=0){this._state=e}reset(){this._state=0}toggleState(e,t){return void 0===e&&ne(new Error("AdState cannot toggleState for `undefined`")),void 0===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}}const de={ok:S("fpads:analytics:request-queue"),err:S("fpads:analytics:request-queue:err"),warn:S("fpads:analytics:request-queue:warn")};class RequestQueue{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 de.ok("maybe_spawn_req called Queue that is EMPTY"),e;if(RequestQueue.is_high_water(e))return de.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){de.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(de.ok(`Request[${i.event_type}] request`,i,e.stats),Date.now()<e.stats.ttl)return de.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),de.warn(`Request[${i.event_type}] timed out in ${r.timeout}ms`,e.stats)},r.onerror=function(t){RequestQueue.handle_error(e,r),t&&de.err(t),de.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--,de.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){de.err(e)}}static rpush(e,...t){return t.forEach(t=>{if(RequestQueue.is_high_water(e))return de.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}constructor(e=[],t=[],s={failures:0,ttl:0}){this.pending=e,this.open=t,this.stats=s}}RequestQueue.MAX_OPEN_REQUESTS=3,RequestQueue.REQUEST_TIMEOUT_MS=4e3,RequestQueue.REQUEST_TTL_MS=5e3,RequestQueue.MAX_FAILURE_COUNT=3;const le={"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"},ce={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"},ue={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},he={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"},pe={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 le[e]}static getBrowserTypeByAlias(e){return ce[e]||""}}const ge=/version\/(\d+(\.?_?\d+)+)/i,me=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},s=Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||Utils.getFirstMatch(ge,e);return s&&(t.version=s),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},s=Utils.getFirstMatch(ge,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(ge,e);return s&&(t.version=s),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},s=Utils.getFirstMatch(ge,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(ge,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(ge,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(ge,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(ge,e);return s&&(t.version=s),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},s=Utils.getFirstMatch(ge,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(ge,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(ge,e);return s&&(t.version=s),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},s=Utils.getFirstMatch(ge,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(ge,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(ge,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(ge,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(ge,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(ge,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(ge,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(ge,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(ge,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(ge,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(ge,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(ge,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(ge,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(ge,e);return s&&(t.version=s),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},s=Utils.getFirstMatch(ge,e);return s&&(t.version=s),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},s=Utils.getFirstMatch(ge,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 _e=[{test:[/Roku\/DVP/],describe(e){const t=Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:he.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:he.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:he.Windows,version:t,versionName:s}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:he.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:he.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:he.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:he.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:he.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:he.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:he.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:he.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:he.Linux})},{test:[/CrOS/],describe:()=>({name:he.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:he.PlayStation4,version:t}}}],fe=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(e){const t=Utils.getFirstMatch(/(can-l01)/i,e)&&"Nova",s={type:ue.mobile,vendor:"Huawei"};return t&&(s.model=t),s}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:ue.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:ue.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:ue.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:ue.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:ue.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:ue.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:ue.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:ue.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:ue.mobile})},{test:e=>"blackberry"===e.getBrowserName(!0),describe:()=>({type:ue.mobile,vendor:"BlackBerry"})},{test:e=>"bada"===e.getBrowserName(!0),describe:()=>({type:ue.mobile})},{test:e=>"windows phone"===e.getBrowserName(),describe:()=>({type:ue.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:()=>({type:ue.tablet})},{test:e=>"android"===e.getOSName(!0),describe:()=>({type:ue.mobile})},{test:e=>"macos"===e.getOSName(!0),describe:()=>({type:ue.desktop,vendor:"Apple"})},{test:e=>"windows"===e.getOSName(!0),describe:()=>({type:ue.desktop})},{test:e=>"linux"===e.getOSName(!0),describe:()=>({type:ue.desktop})},{test:e=>"playstation 4"===e.getOSName(!0),describe:()=>({type:ue.tv})},{test:e=>"roku"===e.getOSName(!0),describe:()=>({type:ue.tv})}],ve=[{test:e=>"microsoft edge"===e.getBrowserName(!0),describe(e){if(/\sedg\//i.test(e))return{name:pe.Blink};const t=Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:pe.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:pe.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:pe.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:pe.Gecko},s=Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return s&&(t.version=s),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:pe.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:pe.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(me,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(_e,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(fe,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(ve,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(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=t.flowplayer||{},t.flowplayer.ads=e())}(this,function(){"use strict";var t;!function(t){t[t.ADS=2]="ADS",t[t.ANALYTICS=4]="ANALYTICS",t[t.NO_METERING=8]="NO_METERING",t[t.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",t[t.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(t||(t={}));const e=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function s(t,s){return!!~e.indexOf(t)||t.indexOf(s)===t.length-s.length}s.check_whitelist=function(t){return!!~e.indexOf(t)};function i(t){this.message=t}i.prototype=new Error,i.prototype.name="InvalidCharacterError";var r="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.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=e.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(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(r(t).replace(/(.)/g,function(t,e){var s=e.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}(e)}catch(t){return r(e)}};function n(t){this.message=t}n.prototype=new Error,n.prototype.name="InvalidTokenError";var o=function(t,e){if("string"!=typeof t)throw new n("Invalid token specified");var s=!0===(e=e||{}).header?0:1;try{return JSON.parse(a(t.split(".")[s]))}catch(t){throw new n("Invalid token specified: "+t.message)}};o.InvalidTokenError=n;const d="production";function l(t,e){const s={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let i={c:"{}",exp:0};e=e||{};try{i=o(t),s.valid_jwt=!0}catch(t){}return s.raw=t,s.data=JSON.parse(i.c),s.exp=i.exp,e.require_valid_token&&l.validate(s),s}function c(t){return{grant:t,is_granted:e=>(t&e)===e}}function u(){const t="undefined"!=typeof document&&"undefined"!=typeof window,e=t?navigator.userAgent:"",s=/iP(hone|od)/i.test(e)&&!/iPad/.test(e)&&!/IEMobile/i.test(e),i=/Android/.test(e)&&!/Firefox/.test(e),r=/^((?!chrome|android).)*safari/i.test(e),a=/chrome|crios/i.test(e)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(e),n=/firefox|fxios/i.test(e)&&!/seamonkey/i.test(e),o=/edg/i.test(e),d=/opr|opera/i.test(e),l=/SamsungBrowser/.test(e),c=l&&/SMART-TV/.test(e);return{controls:!s,video:function(e){return t&&document.createElement("video").canPlayType(e)},lang:t&&window.navigator.language,android:i,iphone:s,safari:r,edge:o,opera:d,chrome:a,firefox:n,ios:t&&/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(t){return{width:t.clientWidth,height:t.clientHeight}}function p(t,e,s){return"number"==typeof s&&(s+="px"),t.style.setProperty(e,s),t}l.validate=function(t){if("string"==typeof t&&(t=l(t)),!t||!t.raw){if(s.check_whitelist(window.location.hostname)||"dev"===d.toString())return!0;throw new Error("No token provided in configuration")}if(!t.valid_jwt)throw new Error("Invalid token provided");const e=window.location.hostname,i=s.bind(null,e);if("dev"!==d.toString()&&t.data.domain&&t.data.domain.length&&!t.data.domain.some(i))throw new Error("Domain not allowed");if("dev"!==d.toString()&&1e3*t.exp-Date.now()<0)throw new Error("Expired token");return!0},l.id=function(t){if(t)return"string"==typeof t&&(t=l(t)),t.data.id},c.of=c,c.from_token=function(t){const e=l(t,{require_valid_token:!0});return c.of(e.data.acl)},c.permissions=t;const g="ad-initialized",m="ad-playback-error",_="ad-teardown",f="ad-videotag-attached",v="ad-request-error",y="ad-requested",A="ad-request-completed",b="ad-pause-content",w="ad-started",E="ad-completed",S="ad-paused",T="ad-resumed",L="ad-progress",O="ad-skipped",R="ad-muted",M="ad-volume-changed",P="ad-timeout",k="ad-break-completed",D="ad-postroll-finished",I="ad-preroll-finished",C="vpaid-init",N="ad-ima-adapter-init",U="ad-ima-before-ads-request",x="ad-ima-rendering-settings",F="ad-adapter-init-failed",B="ad-play-requested",j="reload-ad-requested",q="ad-error",H="request/ad/pause",V="request/ad/play",z="request/ad/muteunmute",G="ad/show-first-frame",W="ad/resize",Q="ad/set-ui-flags",$="ad/pbjs";var K=Object.freeze({__proto__:null,AD_INIT:g,AD_PLAYBACK_ERROR:m,AD_TEARDOWN:_,AD_VIDEOTAG_ATTACHED:f,AD_BLOCKED:"ad-blocked",AD_REQUEST_ERROR:v,AD_REQUESTED:y,AD_REQUEST_COMPLETED:A,AD_PAUSE_CONTENT:b,AD_STARTED:w,AD_COMPLETED:E,AD_PAUSED:S,AD_RESUMED:T,AD_WAITING:"ad-waiting",AD_PROGRESS:L,AD_SKIPPED:O,AD_MUTED:R,AD_VOLUME_CHANGED:M,AD_FULLSCREEN:"ad-fullscreen",AD_TIMEOUT:P,AD_BREAK_COMPLETED:k,AD_POSTROLL_FINISHED:D,AD_PREROLL_FINSIHED:I,AD_MIDROLL_FINISHED:"ad-midroll-finished",VPAID_INIT:C,IMA_ADAPTER_INIT:N,IMA_BEFORE_ADS_REQUEST:U,IMA_ADS_RENDERING_SETTINGS:x,ADAPTER_INIT_FAILED:F,AD_PLAY_REQUESTED:B,RELOAD_AD_REQUESTED:j,AD_ERROR:q,REQUEST_AD_PAUSE:H,REQUEST_AD_PLAY:V,REQUEST_AD_MUTE_UNMUTE:z,AD_SHOW_FIRST_FRAME:G,AD_RESIZE:W,AD_SET_UI_FLAGS:Q,PBJS_AVAILABLE:$});const Y="resize",Z="volumechange",J="playing",X="ended",tt="seeked",et="seeking",st="viewenter",it="beforeplay";const rt="is-playing",at="is-starting",nt="is-live",ot="is-waiting",dt="is-autoplay",lt="is-in-viewport";function ct(t,e,s){const i=function(t,e){const s=new CustomEvent(t,{detail:e,cancelable:!0});return e&&Object.defineProperty(s,"data",{get:()=>e}),s}(e,s);return t.dispatchEvent(i),t}var ut;!function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}}(),function(t){t[t.OFF=0]="OFF",t[t.ON=1]="ON",t[t.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(ut||(ut={}));function ht(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}function pt(t){return function(t,e){const s=t.seekable;if("object"!=typeof t.opts||0==s.length)return{head:0,tail:0};const i=gt(t),r=e||t.live_state.dvr_window;return{head:i,tail:"number"!=typeof r||i-r<0?s.start(0):i-r}}(t).tail}function gt(t){var e;const s=t.seekable;return s.length?t.hasState("is-chromecast-playing")||!(null===(e=t.hls)||void 0===e?void 0:e.liveSyncPosition)?s.end(s.length-1):t.hls.liveSyncPosition:0}function mt(t){try{t.dvr_offset=0,t.currentTime=gt(t)}catch(t){console.warn("failed to seek to now: %j",t)}}function _t(t,e){if(!t.hasState(nt)||![void 0,0,-1].includes(e)||!t.seekable.length||t.hasState("has-casted"))return t.setState(at,!1);t.once(tt,()=>t.setState(at,!1)),0===e?function(t){t.currentTime=pt(t)}(t):mt(t)}const ft="is-popped-out";function vt(t,e){const s=function(){try{return localStorage.getItem("flowplayer/debug")}catch(t){return""}}(),i=(i,...r)=>{try{const a=(null==e?void 0:e.debug)||s;a&&t.match(a)&&console.log(`flowplayer/${t} -- ${i}`,...r)}catch(t){console.warn(t)}};return i.log=i,i}const yt=(t,e)=>new(((t,e)=>{const s=t.get(e);if(!s)throw new Error(`no flowplayer component with the name ${e} exists`);const i=window.customElements.get(e);if(!i)throw new Error(`no default flowplayer component with the name ${e} exists`);const r=window.customElements.get(s);return"function"!=typeof r?i:r})(t._customElements,e))(t),At=(t,e,s)=>{window.customElements.get(e)||window.customElements.define(e,s),t.customElements.get(e)||t.customElements.set(e,e)},bt="flowplayer-ad-ui",wt="flowplayer-ad-controls",Et="flowplayer-ad-countdown",St="flowplayer-ad-indicator",Tt=vt("ads/lifecycle"),Lt=[m,_,k];async function Ot({config:t,root:e,content:s,ads:i,ima:r}){var a;Tt("LifeCycle::initLifeCycle",t,e,s,i,r),s.autoplay=!1;const n=t.autoplay===ut.AUDIO_REQUIRED,o=function(t,e){return{muted:!(e||!t.muted),volume:t.volume}}(s,n);s.on(Z,()=>{o.volume=s.volume,o.muted=s.muted}),s.on(G,()=>{Tt("showFirstFrame"),e.classList.toggle("ad-hide-first-frame",!1)});const d=yt(s,bt),l=d;s.emit(Q,{ui_flags:null===(a=t.ads)||void 0===a?void 0:a.ui}),s.renderPlugin(d);const c={listening:!1,preload:null==r?void 0:r.preload_ads};if(Tt("initial",o),i.setVideoTag(s),t.autoplay){Tt("Trying to autoplay"),e.classList.add("ad-hide-first-frame"),Tt("hideFirstFrame");await Nt(s,n)?(Tt("Can autoplay, start ad"),s.opts.autoplay=1,Rt({ads:i,content:s,state:c,adContainer:l,ima:r,config:t})):(Tt("cannot autoplay(audioRequired: %s), fallback to poster state",n),t.autoplay=0,s.emit(G,{root:e}),s.setState("is-starting",!0))}t.autoplay||i.hasPreroll()&&function({content:t,ads:e,config:s,state:i,initial:r,adContainer:a,ima:n}){t.once(it,async function(o){(t.hasState(lt)||"touchend"!=o.type)&&e.shallPlayAd(0)&&(e.adapter.setAttemptingPrerollOnIOS(e.adapter.isCustomPlaybackEnabled()),e.adapter.isCustomPlaybackEnabled()||o.preventDefault(),Dt({ads:e,content:t,state:i}),Tt("user_gesture(:intercept) -> shallPlayAd(0: %s)",e.shallPlayAd(0)),s.muted=r.muted,await Rt({ads:e,content:t,state:i,adContainer:a,ima:n,config:s}),It({ads:e,content:t}))})}({content:s,ads:i,config:t,state:c,initial:o,adContainer:l,ima:r}),!t.autoplay&&i.hasPreroll()&&c.preload&&Rt({ads:i,content:s,state:c,adContainer:l,ima:r,config:t}),kt({config:t,root:e,content:s,ads:i,state:c,adContainer:l,ui:d,ima:r,initial:o});const u=async t=>{s.removeEventListener(it,u),i.resetScheduleCounter(),i.hasPreroll()&&(i.adapter.setAttemptingPrerollOnIOS(i.adapter.isCustomPlaybackEnabled()),t.preventDefault(),await i.setCurrentTime(0))};s.on("src",()=>{c.started&&(s.removeEventListener(it,u),s.addEventListener(it,u))}),s.on(it,t=>{(i.adBreak||i.adPlaying||i.adRequesting)&&(i.adBreak&&!i.adLinear||(Tt("prevented content from starting because ad break is active"),t.preventDefault()))})}async function Rt(t){t.state.started||(t.content.hasState(lt)?await Mt(t):t.content.once(st,async()=>{await Mt(t)}))}async function Mt({ads:t,content:e,adContainer:s,ima:i,state:r,config:a}){var n;r.started=!0;const o=function(t,e){var s={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(s[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(s[i[r]]=t[i[r]])}return s}(i,["ads"]),d=h(e.root),l=(null==a?void 0:a.muted)||e.muted,c=Object.assign(Object.assign(Object.assign({container:s,volume:l?0:e.volume,muted:l,autoplay:(null==a?void 0:a.autoplay)||!1,video_source:e.original_src,preload_ads:null===(n=null==a?void 0:a.ima)||void 0===n?void 0:n.preload_ads},o),d));Tt("start():",c,r),await t.initialize(!1,c,r.preload)}function Pt(t,e){var s,i;return{content_width:t.clientWidth||(null===(s=t.parentNode)||void 0===s?void 0:s.clientWidth)||e.clientWidth,content_height:t.clientHeight||(null===(i=t.parentNode)||void 0===i?void 0:i.clientHeight)||e.clientHeight}}function kt({config:t,root:e,content:s,ads:i,initial:r,adContainer:a,state:n,ui:o,ima:d}){Tt("addUIListeners()");const l=async()=>{if(i){if(!(i.adapter.isAttemptingPrerollOnIOS()||i.adapter.isCustomPlaybackEnabled()&&s.currentSrc!==s.original_src)){if(s.off(J,l),Tt("addUIListeners() -> content started playing"),Dt({ads:i,content:s,state:n}),!i.shallPlayAd(0)||!i.adapter.isLinearAd())return Tt("addUIListeners() -> no more preroll ads -> resume content"),s.emit(G,{root:e}),await Rt({ads:i,content:s,state:n,adContainer:a,ima:d,config:t});s.togglePlay(!1),await Rt({ads:i,content:s,state:n,adContainer:a,ima:d,config:t}),i.shallPlayAd(0)&&i.adapter.isLinearAd()&&(o.classList.add("on","linear"),e.classList.add(ot),It({ads:i,content:s}))}}else s.off(J,l)};s.on(J,l),s.on(["portrait","landscape"],function(){if(!i)return;const{content_width:t,content_height:r}=Pt(s,e);i.resize({height:r,width:t})}),s.on(Y,t=>{if(!i||!t.detail)return;const{width:e,height:s}=t.detail.contentRect;i.resize({width:e,height:s})}),s.on(X,t=>{var r;const a=()=>{t.preventDefault(),Object.assign(t,{prevented:!0})};if(e.classList.contains("ad-linear")&&e.classList.contains("ads-custom-playback-enabled"))return a();i&&(Tt("ui_listeners(:%s, event: %o)",t.type,t.detail),(null===(r=null==t?void 0:t.detail)||void 0===r?void 0:r.from)!==i&&(a(),i.finished(function(){s.emit(X,{from:i})})))}),i.on(y,()=>{e.classList.toggle(ot,!0)}),i.once(w,()=>{s.on([it,"beforepause"],t=>{var e;if(!i.adBreak||!i.adapter.isLinearAd())return;t.preventDefault();const s=(null===(e=t.detail)||void 0===e?void 0:e.forced)?t.type===it:!i.adPlaying;s&&i.paused&&i.resume(),s||i.paused||i.pause()})}),i.on(w,t=>{const a=t.detail,{linear:n,ad:o,ad_type:d}=a;let l;if(Tt(`Ad[linear: ${n}, currentTime: ${s.currentTime}] starting`,o),"preroll"==d&&!n&&s.paused&&s.togglePlay(!0),n&&(l=Pt(s,e)),i.resize({width:l?l.content_width:o.width,height:l?l.content_height:o.height,linear:n,resize_non_linear:!0}),s.emit(W,{opts:{linear:n,resizeContainerAlso:!0,width:n?void 0:o.width,height:n?void 0:o.height}}),e.classList.remove(ot),s.setState("ad-linear",n),s.setState("ad-non-linear",!n),!n){Tt("non-linear ad / restarting content");try{s.togglePlay(!0),s.volume=r.volume,s.muted=r.muted}catch(t){Tt(t)}}s.hasState(lt)||s.hasState(ft)||!n||i.pause()}),i.on(b,()=>{s.emit(W,{opts:{linear:!0,width:0,height:0}})}),s.on(Lt,t=>async function({root:t,content:e,ads:s,eventName:i,err:r={reason:""}}){Tt("teardown(event: %s)",i),s.adapter.isAttemptingPrerollOnIOS()&&(s.adapter.setAttemptingPrerollOnIOS(!1),!e.paused&&e.hasState(at)&&e.hasState(rt)&&_t(e,e.opts.start_time));t.classList.add("is-seamless"),t.classList.remove(ot),["ad-non-linear","ad-linear"].forEach(t=>e.setState(t,!1)),r.reason&&Tt("teardown(:err, reason: %s) %o",r.reason);const a=s.getLastAd();if(e.emit(G,{root:t}),!s.shouldRestartContent())return Tt("Lifecycle.teardown(:skip_restart, reason: %s)","Ad prevented restarting content"),Ct(t);if(e.currentTime>0&&e.currentTime>=e.duration||"postroll"==s.ad_type||!1===(null==a?void 0:a.restart))return Tt("Lifecycle.teardown(:skip_restart, reason: %s)","was a postroll ad"),Ct(t);""===e.currentSrc&&e.setSrc(e.original_src);e.paused&&s.shouldRestartContent()&&(Tt("Lifecycle.teardown(:toggle_play, %s)","attempting to restart content"),await e.togglePlay(!0));if(!e.paused)return Tt("Lifecycle.teardown(:ok)","restarted video content"),Ct(t)}({root:e,content:s,ads:i,ui:o,err:t.detail,eventName:t.type}));let c=!!t.autoplay;var u;s.on(st,()=>{c&&!1!==d.autopause&&i.resume()}),s.on("viewleave",(u=()=>{!1!==d.autopause&&(c=!i.paused,i.pause())},t=>{setTimeout(function(){if(!t.defaultPrevented&&!t.prevented)return u(t)},0)}))}function Dt({ads:t,content:e,state:s}){s.listening||(e.on(["timeupdate",tt,J,et],s=>{t.adapter.isCustomPlaybackEnabled()&&(t.adPlaying||t.paused)||(t.adPlaying&&t.adapter.isLinearAd()&&!e.paused&&e.pause(),It({ads:t,content:e,seek:s.type===et}))}),s.listening=!0)}function It({ads:t,content:e,seek:s=!1}){t&&t.setCurrentTime(e.currentTime,void 0,s)}function Ct(t){t.classList.remove("is-seamless")}async function Nt(t,e){const[s,i]=[t.muted,t.volume];Tt("Lifecycle::peek_content(:muted => %s, :volume => %s)",s,i);const r=()=>new Promise(t=>setTimeout(t,0,!1));e&&(t.muted=!1,t.volume=t.volume?t.volume:1);try{if(await async function(t){return Tt("Lifecycle::wait_for_source"),new Promise((e,s)=>{const i=50,r=2e3;let a=0;const n=setInterval(()=>{if(++a>r/i)return clearInterval(n),s(new Error(`No source in ${r}ms, giving up`));t.currentSrc&&(e(null),clearInterval(n))},i)})}(t),await function(t){return new Promise(e=>{if(t.hasState(lt))return e(null);t.once(st,()=>e(null))})}(t),Tt("Lifecycle::peek_content::play"),t.volume&&(t.volume=.01),await new Promise(s=>setTimeout(()=>{e&&(t.opts.autoplay=2),t.setState(dt,!0),s(t.togglePlay(!0))})),t.paused)throw new Error("content failed to play");return Tt("Lifecycle::peek_content::pause"),await new Promise(e=>setTimeout(()=>e(t.togglePlay(!1)))),t.volume=i,Tt("Lifecycle::peek_content::true"),!0}catch(a){return t.volume=i,e?(t.muted=!1,0==t.volume&&(t.volume=1),await r()):s||!i?(Tt("Lifecycle::peek_content::false"),await r()):(Tt("Lifecycle::peek_content::recover"),t.muted=!0,!!await Nt(t)||(t.muted=s,Tt("Lifecycle::peek_content::false"),await r()))}}const Ut=vt("ads/timers");class TimerRegistry{constructor(t={},e={}){this.intervals=t,this.timers=e}}let xt=-1;function Ft(t,e,s){const i=setInterval(s,e);if(Ut(`TimerRegistry.createInterval() -> ${i}`,t.intervals),"object"==typeof i){const e=++xt;return t.intervals[e]=e,e}return t.intervals[i]=i,i}function Bt(t){if(t)return Ut("TimerRegistry.empty()",Object.keys(t.timers),Object.keys(t.intervals)),Object.keys(t.intervals).forEach(e=>function(t,e){return Ut(`TimerRegistry.removeInterval() -> ${e}`,t.intervals),clearInterval(t.intervals[e]),delete t.intervals[e],t}(t,e)),Object.keys(t.timers).forEach(e=>function(t,e){return Ut(`TimerRegistry.removeTimeout() -> ${e}`,t.timers),clearTimeout(t.timers[e]),delete t.timers[e],t}(t,e)),t}function jt(t){try{return t.getAdPodInfo().getPodIndex()}catch(t){return}}class AdLoadingController{adRequestStart(t){"number"==typeof t&&"number"!=typeof this.requestStart&&(this.requestStart=performance.now())}adRequestEnd(){this.requestStart=void 0}getRemainingAdLoadTime(t,e){return"number"!=typeof e||"number"!=typeof this.requestStart?t:Math.max(0,e-(performance.now()-this.requestStart))}}function qt(t){return function(t){return!document.fullscreenEnabled&&"function"==typeof t.webkitEnterFullScreen&&"function"==typeof t.webkitExitFullScreen}(t)&&!t.root.classList.contains("no-fullscreen")}class IMA{constructor(t){this.eventHandler=t,this.log=vt("ads/adapter/ima"),this.google=window.google,this._adHandlers=[],this._timers=new TimerRegistry,this._started=!1,this._volumeLevel=0,this._adLoaded=!1,this.customPlaybackEnabled=!1,this._paused=!1,this._all_ads_completed=!1,this._currentDuration=0,this._currentRemaining=0,this._currentDisplayTs=0,this._isInitialized=!1,this._adBreakTime=0,this._prepared=!1,this.opts={},this.loadingController=new AdLoadingController}async init(t){this.log("init",this.videoTag,t),this.opts=t,this._dimensions={width:t.width,height:t.height,linear:t.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(t){this.log("initAdapter failed:",t),this._prepared=!1,this.eventHandler.trigger(F)}}isReady(){return!!this._isInitialized}setVideoTag(t){this.videoTag=t,this.customPlaybackEnabled=qt(t),t.root.classList.toggle("ads-custom-playback-enabled",this.customPlaybackEnabled)}setAdBreakTime(t){this._adBreakTime=t}getAdBreakTime(){return this._adBreakTime}isCustomPlaybackEnabled(){return this.customPlaybackEnabled}isAttemptingPrerollOnIOS(){var t;return!!(null===(t=null==this?void 0:this.videoTag)||void 0===t?void 0:t.root.classList.contains("preroll-ios"))}setAttemptingPrerollOnIOS(t){var e;null===(e=null==this?void 0:this.videoTag)||void 0===e||e.root.classList.toggle("preroll-ios",t)}isLinearAd(){return!!this._adLinear}getVideoTag(){return this.videoTag}getDimensions(){return this._dimensions||{}}getOpts(){return this.opts}isPaused(){return this._paused}destroy(){const t=this;Bt(this._timers),this._adHandlers&&this._adHandlers.forEach(t=>t()),t._adHandlers=void 0,this._adDisplayContainer&&this._adDisplayContainer.destroy(),t._adDisplayContainer=void 0,this._adsLoader&&this._adsLoader.destroy(),t._adsLoader=void 0,this._adsManager&&this._adsManager.destroy(),t._adsManager=void 0}stop(){this._adsManager&&this._adsManager.stop()}initialize(t){const e=this.isAdPod(),s=this._adLoaded||e;if(this.cleanup(),!this.videoTag)return console.warn("videoTag not set during initialization");this.opts=t,this._volumeLevel=t.volume;const i=this.google.ima.settings;if(t.NumRedirects=t.NumRedirects||t.redirects,i.setVpaidMode(t.VpaidMode||this.google.ima.ImaSdkSettings.VpaidMode.INSECURE),i.setDisableCustomPlaybackForIOS10Plus(!this.customPlaybackEnabled),"NumRedirects"in t&&i.setNumRedirects(t.NumRedirects),"AutoPlayAdBreaks"in t&&i.setAutoPlayAdBreaks(t.AutoPlayAdBreaks),"Locale"in t&&i.setLocale(t.Locale),"Ppid"in t&&i.setPpid(t.Ppid),!document.body.contains(t.container))throw new Error("AdDisplayContainer was not found in the document.body");this._adDisplayContainer=new this.google.ima.AdDisplayContainer(t.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({},t),{volume:this.videoTag.volume,muted:this.videoTag.muted})),this._adsLoader.addEventListener(this.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e=>{if(!this.videoTag)return;this.log("ima.initialise(:done -> ADS_MANAGER_LOADED)\n%o",Object.assign(Object.assign({},t),{volume:this.videoTag.volume,muted:this.videoTag.muted}));const s=new this.google.ima.AdsRenderingSettings;this.log("ima.rendering(preload: %s)",!!t.preload_ads),s.useStyledNonLinearAds=!0,s.enablePreloading=!!t.preload_ads,s.loadVideoTimeout=t.media_timeout||-1,s.restoreCustomPlaybackStateOnAdBreakComplete=this.customPlaybackEnabled,this.customPlaybackEnabled&&(s.playAdsAfterTime=this.videoTag.currentTime),this.eventHandler.trigger(x,s);const i=this._adsManager=e.getAdsManager(this.videoTag,s);this.eventHandler.trigger(N,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,t=>{var e,s;const i=null===(e=t.getAdData())||void 0===e?void 0:e.duration,r=null===(s=t.getAdData())||void 0===s?void 0:s.currentTime;isNaN(i)||isNaN(r)||(this._currentRemaining=i-r,this.eventHandler.trigger(L,{remaining:this._currentRemaining,duration:i}))}),i.addEventListener(this.google.ima.AdEvent.Type.STARTED,t=>{this._currentRemaining=-1,this.debugEvent(t);const e=t.getAd();e&&(this._currentDuration=e.getDuration(),this._currentDisplayTs=Date.now(),this.emitWithAd(w,e),e.isLinear()&&IMA.pollRemaining({ima:this,adsManager:i}))}),i.addEventListener(this.google.ima.AdEvent.Type.COMPLETE,t=>{this.debugEvent(t);const e=t.getAd();e&&this.emitWithAd(E,e),Bt(this._timers)}),i.addEventListener(this.google.ima.AdEvent.Type.SKIPPED,t=>{this.debugEvent(t);const e=t.getAd();e&&this.emitWithAd(O,e)}),i.addEventListener(this.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,t=>{if(this.isAdPod()&&this.videoTag){const t=Math.abs(this.videoTag.currentTime-this.videoTag.duration)<1?-1:this.videoTag.currentTime;this.setAdBreakTime(t)}this.debugEvent(t);const e=t.getAd();e&&this.emitWithAd(b,e)}),i.addEventListener(this.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,t=>{this.debugEvent(t),this._started=!1,this._currentDisplayTs=0,this.eventHandler.trigger(k,{force:!0})}),i.addEventListener(this.google.ima.AdEvent.Type.VOLUME_CHANGED,t=>{this.log("IMA::volume(type: %s, event: %o)",t);const e=i.getVolume();this._volumeLevel=e,this.eventHandler.trigger(M,e)});const r=t=>{this._paused=t,this.eventHandler.trigger(t?S:T)};i.addEventListener(this.google.ima.AdEvent.Type.PAUSED,()=>r(!0)),i.addEventListener(this.google.ima.AdEvent.Type.RESUMED,()=>r(!1)),i.addEventListener(this.google.ima.AdEvent.Type.STARTED,()=>r(!1)),i.addEventListener(this.google.ima.AdEvent.Type.VOLUME_MUTED,t=>{this.log("IMA::volume(type: %s, event: %o)","mute",t),this.eventHandler.trigger(R)});const{width:a,height:n}=t;a&&n&&(i.init(a,n,this.google.ima.ViewMode.NORMAL),this.log("ima.initialise: done initializing"))}),s&&(this.log("Event(reload: %s)",j),this.eventHandler.trigger(j,e)),this.eventHandler.trigger(g,this)}destroyManager(t="unknown"){if(!this._adsManager)return this.log("ima::destroyManager(:skip, label: %s)",t);this.log("ima::destroyManager(:ok, label: %s)",t),this._adsManager.destroy()}reset(){this.destroyManager("reset"),Bt(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(t=>{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),t(this._adsManager)})})}async initAd(t,e=5e3){var s;this.log(`ima.initAd(adTag: ${t}, timeout: ${e})`),this.customPlaybackEnabled||this.loadingController.adRequestStart(this.opts.total_loading_timeout);try{if(await this.requestAd(t,this.loadingController.getRemainingAdLoadTime(e,this.opts.total_loading_timeout)),this._adLoaded=!0,this.customPlaybackEnabled)return;null===(s=this._adsManager)||void 0===s||s.updateAdsRenderingSettings({loadVideoTimeout:this.loadingController.getRemainingAdLoadTime(this.opts.media_timeout||-1,this.opts.total_loading_timeout)})}catch(t){throw this.log("ima.initAd:",t),this._adLoaded=!1,t}finally{Bt(this._timers)}}async requestAd(t,e){if(this.destroyManager("requestAd"),!this.videoTag)return;this.setAdBreakTime(this.videoTag.currentTime);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:e,adTag:t,_volumeLevel:this._volumeLevel,manager:this._adsManager})),this.clearAdHandlers();const n=new this.google.ima.AdsRequest;n.adTagUrl=t;const{height:o,width:d}=this.opts;return 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=e,this.eventHandler.trigger(U,{request:n}),this._adsLoader?new Promise(async(t,s)=>{var i;const r=this.waitForAdsManager();null===(i=this._adsLoader)||void 0===i||i.requestAds(n),this.once(this._adsLoader,this.google.ima.AdErrorEvent.Type.AD_ERROR,t=>{s(()=>(this.emitError(v,t),Promise.reject(new Error("Ad load failed"))))}),setTimeout(()=>{s(()=>{r.then(t=>{t.destroy(),this._adsManager===t&&(this._adsManager=void 0)});const t=new Error("Ad internal timeout reached");return this.eventHandler.trigger(P,t),Promise.reject(t)})},e),t(await r)}).then(t=>new Promise((e,s)=>{this.volume(a?0:this._volumeLevel),this.eventHandler.trigger(M,this._volumeLevel);const r=this.cuepoints();if(r&&r.length&&0!==r[0])return e({ad:!1,adsManager:t});this.once(t,this.google.ima.AdErrorEvent.Type.AD_ERROR,t=>{s(()=>(this.emitError(v,t),Promise.reject(t)))}),this.once(t,this.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{this._all_ads_completed=!0,e(null)}),this.once(t,this.google.ima.AdEvent.Type.LOADED,t=>{this.eventHandler.trigger(A,{request_load_time:Date.now()-i});const s=t.getAd();s&&(this.log("ima.requestAd: AD_REQUEST_COMPLETED",s.getContentType()),"application/javascript"==s.getContentType()&&this.eventHandler.trigger(C,s),e(null))}),this.once(t,this.google.ima.AdEvent.Type.CLICK,()=>{this.log("ima.requestAd: click event"),this.pause()})}),t=>t()):void 0}async playAd(){if(this.log("ima.playAd()",this),!this._adsManager||!this._adLoaded)return;const t=this.currentAd();if(t&&(!this.customPlaybackEnabled||t.isLinear()))try{await this.startAndWaitForAdCompletion(this._adsManager,t.isLinear())}catch(t){throw this.log("ima.playAd",t),t}finally{this._adLoaded=!1,Bt(this._timers)}}startAndWaitForAdCompletion(t,e){if(!this._started)return this.log("ima.startAndWaitForAdCompletion(manager: %o)",{volume:t.getVolume()}),new Promise((s,i)=>{let r=!1;this.once(t,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(t,this.google.ima.AdErrorEvent.Type.AD_ERROR,async t=>{this.log("ima.startAndWaitForAdCompletion: beginning error recovery ->",t),r=!0;try{const{ok:e}=await IMA.pollForFatalError({err:t,ima:this});e&&(r=!1)}catch(e){this._started=!1,i(t)}});const a=this.getVideoTag();if(!a)return;const n=()=>{e&&(this._started=!0),t.start(),this.eventHandler.trigger(B)};if(!e||a.hasState(lt)||a.hasState(ft))return n();a.paused||a.pause(),a.once(st,()=>n())})}pause(){this.log("ima.pause()"),this._adsManager&&this._adsManager.pause()}resume(){this.log("ima.resume()"),this._adsManager&&this._adsManager.resume()}volume(t){if(this._adsManager)try{return arguments.length>0&&"number"==typeof t&&this._adsManager.setVolume(t),this._volumeLevel=this._adsManager.getVolume()}catch(t){this.log("ima.volume() failed (%o)",t)}}onResize({width:t,height:e,linear:s,silent:i,resize_non_linear:r}){this._adsManager&&(this._adLinear=void 0===s?this._adLinear:s,this.opts&&(t||e)&&(!1===s&&(t+=10,e+=10),this._dimensions={width:t,height:e,linear:s},s&&(this.opts.width=t,this.opts.height=e),(this._adLinear||r)&&(i||this.log("ima.onResize %s x %s",t,e),this._adsManager.resize(t,e,this.google.ima.ViewMode.NORMAL))))}onAdRequestEnd(){var t;this.customPlaybackEnabled||(this.loadingController.adRequestEnd(),null===(t=this._adsManager)||void 0===t||t.updateAdsRenderingSettings({loadVideoTimeout:this.opts.media_timeout||-1}))}getAdInfo(){const t=this.currentAd();if(t)return{duration:t.getDuration(),currentTime:this._currentRemaining}}currentAd(){const t=this._adsManager;if(t)return t.getCurrentAd()}isAdPod(){const t=this.cuepoints();return!!(t&&t.length>1)}cuepoints(){return this._adsManager&&this._adsManager.getCuePoints()}async contentComplete(){this.log("ima.contentComplete() -> ",this),this._adsLoader&&this._adsLoader.contentComplete();const t=this.cuepoints();t&&-1!==t.indexOf(-1)&&await new Promise(t=>{IMA.race(this.eventHandler,[k,q],t)})}isUiDisabled(){try{const t=this.currentAd();return t&&t.isUiDisabled()}catch(t){return null}}getAdPodInfo(){try{const t=this.currentAd();return t&&t.getAdPodInfo()}catch(t){return null}}canDismissNonLinear(){const t=this.currentAd();if(!t||t.isLinear()||!this._adsManager||!this._currentDisplayTs)return!0;const e=Date.now(),s=t.getMinSuggestedDuration();return e-this._currentDisplayTs>1e3*s}static unwrapError(t,e){if(!t)return"";if("function"==typeof t.getMessage){return t.getMessage()}return t.message?t.message:e||""}static pollForFatalError({err:t,ima:e}){let s;try{const e=t.getError(),i=e.getInnerError(),r=i?IMA.unwrapError(i,e.message):"";s={reason:r,type:e.getType(),code:e.getErrorCode()}}catch(t){}const i=e._currentRemaining;return new Promise((t,r)=>{const a=setTimeout(()=>{e.eventHandler&&e.eventHandler.trigger(m,s),r(new Error("Ad not progressing"))},2500);e.eventHandler.once(L,e=>{const s=e.detail.remaining;-1!==s&&s<i&&(clearTimeout(a),t({ok:1}))})})}static pollRemaining({ima:t,adsManager:e}){let s=-1;return Ft(t._timers,250,function(){const i=e.getRemainingTime();-1!=t._currentRemaining&&t._currentRemaining<=i||(t._currentRemaining=e.getRemainingTime(),s!=t._currentRemaining&&(s=t._currentRemaining,t.eventHandler.trigger(L,{remaining:t._currentRemaining,duration:t._currentDuration})))})}once(t,e,s){this._adHandlers.push(function(t,e,s){const i=r=>{s(r),t.removeEventListener(e,i)};return t.addEventListener(e,i),()=>t.removeEventListener(e,i)}(t,e,s))}static race(t,e,s){e.forEach(i=>{const r=(...i)=>{e.forEach(e=>t.removeListener(e,r)),s(i)};t.on(i,r)})}clearAdHandlers(){this.log("ima.clearAdHandlers"),this._adHandlers.forEach(t=>t()),this._adHandlers=[]}emitWithAd(t,e){if(this.log("ima.emitWithAd",t,e),!this._adsManager)return;const s=function(t){try{return t.getAdPodInfo().getAdPosition()}catch(t){return}}(e),i=function(t){try{return t.getAdPodInfo().getTotalAds()}catch(t){return}}(e),r={ad:{duration:e.getDuration(),width:e.getWidth(),height:e.getHeight(),position:s,totals:i},volume:this._adsManager.getVolume(),vast_ad_id:e.getAdId(),linear:e.isLinear(),mime_type:e.getContentType(),ima_event:!0};this.log(`emitWithAd::event(name: ${t}, data: %o, ad: %o)`,r,e),this.eventHandler.trigger(t,r)}emitError(t,e){const s={vast_error_type:e.getError().getType(),reason:e.getError().getMessage(),vast_error:e.getError().getErrorCode()};this.log(`ima.error(${t})`,s),this.eventHandler.trigger(t,s)}debugEvent(t){try{const e=t.getAd();if(!e)return;this.log(`ima.event.${t.type} ->`,{event:t,data:t.getAdData(),position:jt(e),ad:e})}catch(t){}}}var Ht=function(t){var e={exports:{}};return t(e,e.exports),e.exports}(function(t,e){var s=function(){for(var t=new Array(256),e=0;e<256;++e)t[e]="%"+((e<16?"0":"")+e.toString(16)).toUpperCase();return t}(),i=Object.prototype.hasOwnProperty;e.arrayToObject=function(t,e){for(var s=e.plainObjects?Object.create(null):{},i=0;i<t.length;++i)void 0!==t[i]&&(s[i]=t[i]);return s},e.merge=function(t,s,r){if(!s)return t;if("object"!=typeof s){if(Array.isArray(t))t.push(s);else{if("object"!=typeof t)return[t,s];(r.plainObjects||r.allowPrototypes||!i.call(Object.prototype,s))&&(t[s]=!0)}return t}if("object"!=typeof t)return[t].concat(s);var a=t;return Array.isArray(t)&&!Array.isArray(s)&&(a=e.arrayToObject(t,r)),Object.keys(s).reduce(function(t,a){var n=s[a];return i.call(t,a)?t[a]=e.merge(t[a],n,r):t[a]=n,t},a)},e.decode=function(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t}},e.encode=function(t){if(0===t.length)return t;for(var e="string"==typeof t?t:String(t),i="",r=0;r<e.length;++r){var a=e.charCodeAt(r);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?i+=e.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&e.charCodeAt(r)),i+=s[240|a>>18]+s[128|a>>12&63]+s[128|a>>6&63]+s[128|63&a])}return i},e.compact=function(t,s){if("object"!=typeof t||null===t)return t;var i=s||[],r=i.indexOf(t);if(-1!==r)return i[r];if(i.push(t),Array.isArray(t)){for(var a=[],n=0;n<t.length;++n)t[n]&&"object"==typeof t[n]?a.push(e.compact(t[n],i)):void 0!==t[n]&&a.push(t[n]);return a}for(var o=Object.keys(t),d=0;d<o.length;++d){var l=o[d];t[l]=e.compact(t[l],i)}return t},e.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},e.isBuffer=function(t){return null!=t&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}}),Vt={brackets:function(t){return t+"[]"},indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},zt={delimiter:"&",strictNullHandling:!1,skipNulls:!1,encode:!0,encoder:Ht.encode},Gt=function t(e,s,i,r,a,n,o,d,l){var c=e;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||Ht.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(t(c[m],i(s,m),i,r,a,n,o,d,l)):h.concat(t(c[m],s+(l?"."+m:"["+m+"]"),i,r,a,n,o,d,l)))}return h},Wt=Object.prototype.hasOwnProperty,Qt={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1,decoder:Ht.decode},$t=function t(e,s,i){if(!e.length)return s;var r,a=e.shift();if("[]"===a)r=(r=[]).concat(t(e,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]=t(e,s,i):r[n]=t(e,s,i)}return r},Kt=function(t,e,s){if(t){var i=s.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,r=/(\[[^[\]]*])/g,a=/(\[[^[\]]*])/.exec(i),n=a?i.slice(0,a.index):i,o=[];if(n){if(!s.plainObjects&&Wt.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&&Wt.call(Object.prototype,a[1].slice(1,-1))&&!s.allowPrototypes)return;o.push(a[1])}return a&&o.push("["+i.slice(a.index)+"]"),$t(o,e,s)}},Yt=function(t,e){var s,i,r=t,a=e||{},n=void 0===a.delimiter?zt.delimiter:a.delimiter,o="boolean"==typeof a.strictNullHandling?a.strictNullHandling:zt.strictNullHandling,d="boolean"==typeof a.skipNulls?a.skipNulls:zt.skipNulls,l=("boolean"==typeof a.encode?a.encode:zt.encode)?"function"==typeof a.encoder?a.encoder:zt.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 Vt?a.arrayFormat:"indices"in a?a.indices?"indices":"repeat":"indices";var g=Vt[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(Gt(r[_],_,g,o,d,l,i,c,u)))}return p.join(n)},Zt=function(t,e){var s=e||{};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||Ht.isRegExp(s.delimiter)?s.delimiter:Qt.delimiter,s.depth="number"==typeof s.depth?s.depth:Qt.depth,s.arrayLimit="number"==typeof s.arrayLimit?s.arrayLimit:Qt.arrayLimit,s.parseArrays=!1!==s.parseArrays,s.decoder="function"==typeof s.decoder?s.decoder:Qt.decoder,s.allowDots="boolean"==typeof s.allowDots?s.allowDots:Qt.allowDots,s.plainObjects="boolean"==typeof s.plainObjects?s.plainObjects:Qt.plainObjects,s.allowPrototypes="boolean"==typeof s.allowPrototypes?s.allowPrototypes:Qt.allowPrototypes,s.parameterLimit="number"==typeof s.parameterLimit?s.parameterLimit:Qt.parameterLimit,s.strictNullHandling="boolean"==typeof s.strictNullHandling?s.strictNullHandling:Qt.strictNullHandling,""===t||null==t)return s.plainObjects?Object.create(null):{};for(var i="string"==typeof t?function(t,e){for(var s={},i=t.split(e.delimiter,e.parameterLimit===1/0?void 0:e.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=e.decoder(o),n=e.strictNullHandling?null:""):(a=e.decoder(o.slice(0,d)),n=e.decoder(o.slice(d+1))),Wt.call(s,a)?s[a]=[].concat(s[a]).concat(n):s[a]=n}return s}(t,s):t,r=s.plainObjects?Object.create(null):{},a=Object.keys(i),n=0;n<a.length;++n){var o=a[n],d=Kt(o,i[o],s);r=Ht.merge(r,d,s)}return Ht.compact(r)};const Jt=vt("fpads:macros"),Xt=/\[([\s\S]+?)\]/g;class Macros{static run(t){try{return t()}catch(t){return void console.error(t)}}static merge(...t){return t.reduce((t,e)=>Object.assign(t,e),{})}static cast(t){return void 0===t?"":"function"==typeof t?encodeURIComponent(Macros.run(t)||""):"string"==typeof t?encodeURIComponent(t):"number"==typeof t||"boolean"==typeof t?t.toString():""}static normalize(t){return t.trim()}static process_obj(t,e,s){return Object.keys(t).reduce((i,r)=>{const a=Macros.process_str(r,e,s,!0),n=t[r];return null===n?(i[a]=n,i):"object"==typeof n?(i[a]=Macros.process_obj(n,e,s),i):"string"==typeof n?(i[a]=Macros.process_str(n,e,s),i):(console.error(new Error(`${n} at ${r} not a handled Macro type`)),i)},{})}static process_str(t,e,s,i=!1){return t.replace(e.pattern,(t,e)=>{const r=Macros.normalize(e);if(!(r in s)||void 0===s[r])return t;const a=s[r],n=i?a:Macros.cast(a);return Jt("Macro.replace(raw: %s, macro: %s, value: %s)",i,e,n),n})}constructor(t={},e=Xt){this.vars=t,this.pattern=e}fork(t={},e=this.pattern){const s=Macros.merge(this.vars,t);return new Macros(s,e)}compile(t,e={}){const s=Macros.merge(this.vars,e),[i,r]=t.split("?"),a=Zt(r||"",{strictNullHandling:!0,decoder:t=>t}),n=Yt(Macros.process_obj(a,this,s),{encode:!1,strictNullHandling:!0});return Macros.process_str(i,this,s,!0)+"?"+n}}function te(t,e={width:0,height:0}){let s,i;try{const t=document.createElement("a");t.href=s=window.location!=window.parent.location?document.referrer:document.location.href,i=t.hostname}catch(t){console.error(t)}const{width:r,height:a}=e,{video_source:n}=t||{},o=function(){const t=window;return"object"==typeof t.__flowplayerAdParameters?t.__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:Xt,CURLY:/\{([\s\S]+?)\}/g,UNDERSCORE:/__([\s\S]+?)__/g};const ee=/^flowplayer:\/\/(.+)/;async function se(t){if("string"==typeof t&&ee.test(t)){const e=ee.exec(t),s=e&&window[e[1]];if(s)return se(s)}if("function"!=typeof t)return t;try{return await t()}catch(t){return""}}async function ie(t){if("function"==typeof t)return[await se(t)];if("string"==typeof t)return[await se(t)];if(Array.isArray(t)){const e=t;return await Promise.all(e.map(se))}if("object"==typeof t&&t&&t.adTag)return await ie(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 `)}class Schedule{constructor(t,e={}){this._ads=t,this._opts=e,this._nextIndex=0,this._postroll=void 0,this._loadPending=!1,this._postrollActive=!1,this.reset(this._ads)}toJSON(){const t=(this._ads||[]).slice(this._nextIndex);return this._postroll&&t.push(this._postroll),t}reset(t){this.setAds(t),this._nextIndex=0,this._postrollActive=!1}resetCounter(){this._nextIndex=0,this._postrollActive=!1}setAds(t){this._ads=t||[],this.sort()}getAds(){return this._ads}getNextAd(t){return this._ads[this._nextIndex]||t}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(t){this._opts.content_duration=t}increment(){++this._nextIndex}decrement(){this._nextIndex>0&&--this._nextIndex}getNextIndex(){return this._nextIndex}getCurrentType(){const t=this.getCurrentAd();if(t)return Schedule.kindOf(t.time)}sort(){this._postroll=this._ads.find(t=>-1===t.time),this._ads=this._ads.filter(t=>t!==this._postroll).sort((t,e)=>t.time===e.time?this._ads.indexOf(t)-this._ads.indexOf(e):t.time-e.time)}shallPlayAd(t){if(this._loadPending)return!1;const e=this.getCurrentAd()||this.getNextAd();return!!(e&&e.time<=t&&-1!==e.time)}shallPlayNext(){const t=this.getNextAd(),e=this.getCurrentAd();return!(!t||!e||t.time!==e.time)}waitForLoad(t,e,s){if(this._loadPending=!1,!e)return!1;const i=s?this._opts.preload_advance:0;return e.time>=0?this._loadPending=t<e.time-i:-1===e.time&&(this._loadPending=this._opts.content_duration>0&&-1!==t?t<this._opts.content_duration-i:-1!==t),this._loadPending}static hasPreroll(t){return!!t.find(t=>0===t.time)}static isOutstream(t){return Schedule.hasPreroll(t)&&!!t[0].outstream}static kindOf(t){switch(t){case 0:return"preroll";case-1:return"postroll";default:return"midroll"}}}const re=Object.prototype,ae=Object.getPrototypeOf;const ne=vt("fpads:ads:state");var oe;!function(t){t[t.IDLE=0]="IDLE",t[t.INITIALIZING=1]="INITIALIZING",t[t.FETCHING_AD=2]="FETCHING_AD",t[t.AD_AVAILABLE=4]="AD_AVAILABLE",t[t.BREAK_ACTIVE=8]="BREAK_ACTIVE",t[t.PLAYING=16]="PLAYING",t[t.FATAL_ERROR=32]="FATAL_ERROR"}(oe||(oe={}));class AdsState{static of(){return new AdsState}constructor(t=0){this._state=t}reset(){this._state=0}toggleState(t,e){return void 0===t&&ne(new Error("AdState cannot toggleState for `undefined`")),void 0===e?this._state^=t:e?void(this._state|=t):this._state&=~t}hasAll(t){return this._state==(this._state|t)}hasAny(t){return!!(this._state&t)}get state(){return this._state}}const de={ok:vt("fpads:analytics:request-queue"),err:vt("fpads:analytics:request-queue:err"),warn:vt("fpads:analytics:request-queue:warn")};class RequestQueue{static of(){return new RequestQueue}static is_empty(t){return 0==t.pending.length}static is_high_water(t){return t.open.length==RequestQueue.MAX_OPEN_REQUESTS}static maybe_spawn_req(t){if(RequestQueue.is_empty(t))return de.ok("maybe_spawn_req called Queue that is EMPTY"),t;if(RequestQueue.is_high_water(t))return de.warn("maybe_spawn_req called on Queue that is HIGH_WATER"),t;try{const e=RequestQueue.lpop(t);e&&RequestQueue.request(t,e)}catch(t){de.err(t)}}static increment_failures(t){return t.stats.failures++,t.stats.failures>RequestQueue.MAX_FAILURE_COUNT&&(t.stats.ttl=Date.now()+RequestQueue.REQUEST_TTL_MS),t}static handle_error(t,e){RequestQueue.rm(t,e),RequestQueue.increment_failures(t)}static request(t,[e,s,i]){if(de.ok(`Request[${i.event_type}] request`,i,t.stats),Date.now()<t.stats.ttl)return de.warn(`Request[${i.event_type}] skipping because too many errors too quickly`,t.stats);const r=new XMLHttpRequest;t.open.push(r),r.timeout=RequestQueue.REQUEST_TIMEOUT_MS,r.ontimeout=function(){RequestQueue.handle_error(t,r),de.warn(`Request[${i.event_type}] timed out in ${r.timeout}ms`,t.stats)},r.onerror=function(e){RequestQueue.handle_error(t,r),e&&de.err(e),de.warn(`Request[${i.event_type}] encountered an Error`,r.responseText,t.stats)},r.onreadystatechange=function(){r.readyState==XMLHttpRequest.DONE&&RequestQueue.rm(t,r),Math.floor(r.status/100)},r.onload=function(){RequestQueue.rm(t,r),t.stats.failures&&t.stats.failures--,de.ok(`Request[${i.event_type}] :ok`,r.status)},r.open(s,e),r.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{r.send(JSON.stringify(i))}catch(t){de.err(t)}}static rpush(t,...e){return e.forEach(e=>{if(RequestQueue.is_high_water(t))return de.warn("Too many open requests, skipping",t.stats);t.pending.push(e),RequestQueue.maybe_spawn_req(t)}),t}static lpop(t){return t.pending.shift()}static rm(t,e){const s=t.open.lastIndexOf(e);return~s&&t.open.splice(s,1),t}constructor(t=[],e=[],s={failures:0,ttl:0}){this.pending=t,this.open=e,this.stats=s}}RequestQueue.MAX_OPEN_REQUESTS=3,RequestQueue.REQUEST_TIMEOUT_MS=4e3,RequestQueue.REQUEST_TTL_MS=5e3,RequestQueue.MAX_FAILURE_COUNT=3;const le={"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"},ce={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"},ue={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},he={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"},pe={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class Utils{static getFirstMatch(t,e){const s=e.match(t);return s&&s.length>0&&s[1]||""}static getSecondMatch(t,e){const s=e.match(t);return s&&s.length>1&&s[2]||""}static matchAndReturnConst(t,e,s){if(t.test(e))return s}static getWindowsVersionName(t){switch(t){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";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(t){const e=t.split(".").splice(0,2).map(t=>parseInt(t,10)||0);if(e.push(0),10===e[0])switch(e[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(t){const e=t.split(".").splice(0,2).map(t=>parseInt(t,10)||0);if(e.push(0),!(1===e[0]&&e[1]<5))return 1===e[0]&&e[1]<6?"Cupcake":1===e[0]&&e[1]>=6?"Donut":2===e[0]&&e[1]<2?"Eclair":2===e[0]&&2===e[1]?"Froyo":2===e[0]&&e[1]>2?"Gingerbread":3===e[0]?"Honeycomb":4===e[0]&&e[1]<1?"Ice Cream Sandwich":4===e[0]&&e[1]<4?"Jelly Bean":4===e[0]&&e[1]>=4?"KitKat":5===e[0]?"Lollipop":6===e[0]?"Marshmallow":7===e[0]?"Nougat":8===e[0]?"Oreo":9===e[0]?"Pie":void 0}static getVersionPrecision(t){return t.split(".").length}static compareVersions(t,e,s=!1){const i=Utils.getVersionPrecision(t),r=Utils.getVersionPrecision(e);let a=Math.max(i,r),n=0;const o=Utils.map([t,e],t=>{const e=a-Utils.getVersionPrecision(t),s=t+new Array(e+1).join(".0");return Utils.map(s.split("."),t=>new Array(20-t.length).join("0")+t).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(t,e){const s=[];let i;if(Array.prototype.map)return Array.prototype.map.call(t,e);for(i=0;i<t.length;i+=1)s.push(e(t[i]));return s}static find(t,e){let s,i;if(Array.prototype.find)return Array.prototype.find.call(t,e);for(s=0,i=t.length;s<i;s+=1){const i=t[s];if(e(i,s))return i}}static assign(t,...e){const s=t;let i,r;if(Object.assign)return Object.assign(t,...e);for(i=0,r=e.length;i<r;i+=1){const t=e[i];if("object"==typeof t&&null!==t){Object.keys(t).forEach(e=>{s[e]=t[e]})}}return t}static getBrowserAlias(t){return le[t]}static getBrowserTypeByAlias(t){return ce[t]||""}}const ge=/version\/(\d+(\.?_?\d+)+)/i,me=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},s=Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},s=Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},s=Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},s=Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},s=Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},s=Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},s=Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},s=Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},s=Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},s=Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},s=Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},s=Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},s=Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},s=Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},s=Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return s&&(e.version=s),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},s=Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},s=Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},s=Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},s=Utils.getFirstMatch(ge,t)||Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},s=Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},s=Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},s=Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},s=Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},s=Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},s=Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},s=Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},s=Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},s=Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test(t){const e=!t.test(/like android/i),s=t.test(/android/i);return e&&s},describe(t){const e={name:"Android Browser"},s=Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},s=Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},s=Utils.getFirstMatch(ge,t);return s&&(e.version=s),e}},{test:[/.*/i],describe(t){const e=-1!==t.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:Utils.getFirstMatch(e,t),version:Utils.getSecondMatch(e,t)}}}];var _e=[{test:[/Roku\/DVP/],describe(t){const e=Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:he.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:he.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),s=Utils.getWindowsVersionName(e);return{name:he.Windows,version:e,versionName:s}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:he.iOS},s=Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return s&&(e.version=s),e}},{test:[/macintosh/i],describe(t){const e=Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),s=Utils.getMacOSVersionName(e),i={name:he.MacOS,version:e};return s&&(i.versionName=s),i}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:he.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),s=t.test(/android/i);return e&&s},describe(t){const e=Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),s=Utils.getAndroidVersionName(e),i={name:he.Android,version:e};return s&&(i.versionName=s),i}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),s={name:he.WebOS};return e&&e.length&&(s.version=e),s}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=Utils.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||Utils.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||Utils.getFirstMatch(/\bbb(\d+)/i,t);return{name:he.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:he.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:he.Tizen,version:e}}},{test:[/linux/i],describe:()=>({name:he.Linux})},{test:[/CrOS/],describe:()=>({name:he.ChromeOS})},{test:[/PlayStation 4/],describe(t){const e=Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:he.PlayStation4,version:e}}}],fe=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(t){const e=Utils.getFirstMatch(/(can-l01)/i,t)&&"Nova",s={type:ue.mobile,vendor:"Huawei"};return e&&(s.model=e),s}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:ue.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:ue.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:ue.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:ue.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:ue.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:ue.tablet})},{test(t){const e=t.test(/ipod|iphone/i),s=t.test(/like (ipod|iphone)/i);return e&&!s},describe(t){const e=Utils.getFirstMatch(/(ipod|iphone)/i,t);return{type:ue.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:ue.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:ue.mobile})},{test:t=>"blackberry"===t.getBrowserName(!0),describe:()=>({type:ue.mobile,vendor:"BlackBerry"})},{test:t=>"bada"===t.getBrowserName(!0),describe:()=>({type:ue.mobile})},{test:t=>"windows phone"===t.getBrowserName(),describe:()=>({type:ue.mobile,vendor:"Microsoft"})},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return"android"===t.getOSName(!0)&&e>=3},describe:()=>({type:ue.tablet})},{test:t=>"android"===t.getOSName(!0),describe:()=>({type:ue.mobile})},{test:t=>"macos"===t.getOSName(!0),describe:()=>({type:ue.desktop,vendor:"Apple"})},{test:t=>"windows"===t.getOSName(!0),describe:()=>({type:ue.desktop})},{test:t=>"linux"===t.getOSName(!0),describe:()=>({type:ue.desktop})},{test:t=>"playstation 4"===t.getOSName(!0),describe:()=>({type:ue.tv})},{test:t=>"roku"===t.getOSName(!0),describe:()=>({type:ue.tv})}],ve=[{test:t=>"microsoft edge"===t.getBrowserName(!0),describe(t){if(/\sedg\//i.test(t))return{name:pe.Blink};const e=Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:pe.EdgeHTML,version:e}}},{test:[/trident/i],describe(t){const e={name:pe.Trident},s=Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:t=>t.test(/presto/i),describe(t){const e={name:pe.Presto},s=Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test(t){const e=t.test(/gecko/i),s=t.test(/like gecko/i);return e&&!s},describe(t){const e={name:pe.Gecko},s=Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:pe.Blink})},{test:[/(apple)?webkit/i],describe(t){const e={name:pe.WebKit},s=Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return s&&(e.version=s),e}}];class Parser{constructor(t,e=!1){if(null==t||""===t)throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},!0!==e&&this.parse()}getUA(){return this._ua}test(t){return t.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const t=Utils.find(me,t=>{if("function"==typeof t.test)return t.test(this);if(t.test instanceof Array)return t.test.some(t=>this.test(t));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(t){return t?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 t=Utils.find(_e,t=>{if("function"==typeof t.test)return t.test(this);if(t.test instanceof Array)return t.test.some(t=>this.test(t));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os}getOSName(t){const{name:e}=this.getOS();return t?String(e).toLowerCase()||"":e||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(t=!1){const{type:e}=this.getPlatform();return t?String(e).toLowerCase()||"":e||""}parsePlatform(){this.parsedResult.platform={};const t=Utils.find(fe,t=>{if("function"==typeof t.test)return t.test(this);if(t.test instanceof Array)return t.test.some(t=>this.test(t));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const t=Utils.find(ve,t=>{if("function"==typeof t.test)return t.test(this);if(t.test instanceof Array)return t.test.some(t=>this.test(t));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return Utils.assign({},this.parsedResult)}satisfies(t){const e={};let s=0;const i={};let r=0;if(Object.keys(t).forEach(a=>{const n=t[a];"string"==typeof n?(i[a]=n,r+=1):"object"==typeof n&&(e[a]=n,s+=1)}),s>0){const t=Object.keys(e),s=Utils.find(t,t=>this.isOS(t));if(s){const t=this.satisfies(e[s]);if(void 0!==t)return t}const i=Utils.find(t,t=>this.isPlatform(t));if(i){const t=this.satisfies(e[i]);if(void 0!==t)return t}}if(r>0){const t=Object.keys(i),e=Utils.find(t,t=>this.isBrowser(t,!0));if(void 0!==e)return this.compareVersion(i[e])}}isBrowser(t,e=!1){const s=this.getBrowserName().toLowerCase();let i=t.toLowerCase();const r=Utils.getBrowserTypeByAlias(i);return e&&r&&(i=r.toLowerCase()),i===s}compareVersion(t){let e=[0],s=t,i=!1;const r=this.getBrowserVersion();if("string"==typeof r)return">"===t[0]||"<"===t[0]?(s=t.substr(1),"="===t[1]?(i=!0,s=t.substr(2)):e=[],">"===t[0]?e.push(1):e.push(-1)):"="===t[0]?s=t.substr(1):"~"===t[0]&&(i=!0,s=t.substr(1)),e.indexOf(Utils.compareVersions(r,s,i))>-1}isOS(t){return this.getOSName(!0)===String(t).toLowerCase()}isPlatform(t){return this.getPlatformType(!0)===String(t).toLowerCase()}isEngine(t){return this.getEngineName(!0)===String(t).toLowerCase()}is(t,e=!1){return this.isBrowser(t,e)||this.isOS(t)||this.isPlatform(t)}some(t=[]){return t.some(t=>this.is(t))}}
|
|
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 ye=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 ce}static get ENGINE_MAP(){return pe}static get OS_MAP(){return he}static get PLATFORMS_MAP(){return ue}}.parse(window.navigator.userAgent),{platform:Ae,os:be,browser:we}=ye,Ee=e=>e&&e.toLowerCase();var Se={rnd:Math.random().toString(36).substr(2,32),os:Ee(be.name+(be.versionName?" "+be.versionName:"")),device:Ee(Ae.type),browser:Ee(we.name),browser_version:(we&&we.version?we.version:"unknown").split(".").shift(),plugin_version:"3.29.0"};const Te="https://fp-eu-w1-aai.flowplayer.com/in",Le="POST",Oe=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],Re=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],Me=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],ke=S("ads/analytics"),Pe=RequestQueue.of(),De=(...e)=>Object.assign({},...e);class Analytics{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,De(e.metadata,t,{player_version:"3.29.0"})),e}constructor(e,t={}){this.emitter=e,this.metadata=De(Se,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),ke(this),this.wireup()}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,i=De(this.metadata,{event_type:e},s),r=Analytics.pluck_valid_keys(this,i),a=Analytics.ensure_required_keys(this,r);if(ke(`Event[${e}]`,{payload:r,observation:s}),a.length)return ke(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${a}`,r);RequestQueue.rpush(Pe,[Te,Le,r])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}const Ie=S("ads/controller"),Ce={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({},Ce),e),this.analytics=(t=this,Analytics.of(t,{required_keys:Re,optional_keys:Me,events:Oe})),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,t;this.adapter.onAdRequestEnd(),null===(e=this.videoTag)||void 0===e||e.setState("ad-paused",!1),null===(t=this.videoTag)||void 0===t||t.setState("ad-playing",!0),this._state.toggleState(oe.PLAYING,!0)};this.on("ad-play-requested",e),this.on("ad-started",e),this.on("ad-resumed",e);const t=e=>{var t,s;"ad-request-error"!==(null==e?void 0:e.type)&&this.adapter.onAdRequestEnd(),null===(t=this.videoTag)||void 0===t||t.setState("ad-paused","ad-paused"===(null==e?void 0:e.type)),null===(s=this.videoTag)||void 0===s||s.setState("ad-playing",!1),this.adPlaying&&this._state.toggleState(oe.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(()=>{this._state.toggleState(oe.BREAK_ACTIVE,!1)})}),this.on("ad-adapter-init-failed",()=>{console.error("Adapter init failed"),t(),this._state.toggleState(oe.FATAL_ERROR,!0)}),this.on("reload-ad-requested",async e=>{if(Ie("Ads.on(RELOAD_AD_REQUESTED)",e),this._schedule){if(t(),e)return this._schedule.reset(this._schedule.getAds());this._state.hasAny(oe.AD_AVAILABLE)&&(this._schedule.decrement(),this._state.toggleState(oe.AD_AVAILABLE,!1))}})}async initialize(e,t={},s){return Ie("Ads.initialize():",e,t,s),this._state.toggleState(oe.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){Ie("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){Ie("Ads.adapterInitialized()"),this._state.toggleState(oe.INITIALIZING,!1),this._state.toggleState(oe.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(oe.FATAL_ERROR,!0),this._state.toggleState(oe.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(oe.FETCHING_AD,!1);else if(r!==this._schedule.getPostroll()||(this._schedule.setPostrollActive(),-1===e))if(this._schedule.isDrained()||this._schedule.increment(),r){Ie("Ads.fetchNextAd",r),this._state.toggleState(oe.FETCHING_AD,!0);try{return await this.requestAd(r),this._state.toggleState(oe.AD_AVAILABLE,!0),void this._state.toggleState(oe.FETCHING_AD,!1)}catch(s){return Ie("Ads.fetchNextAd(err: %o, ad: %o)",s,r),this.setLastAd(r),r!==this._schedule.getPostroll()?await this.fetchNextAd(e,++t):void this._state.toggleState(oe.FETCHING_AD,!1)}}else this._state.toggleState(oe.FETCHING_AD,!1);else this._state.toggleState(oe.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(oe.FETCHING_AD))return;if(this._state.hasAny(oe.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(oe.AD_AVAILABLE)||await this.fetchNextAd(e),!this._state.hasAny(oe.AD_AVAILABLE)||!this.shallPlayAd(e)||t)return;await this.playAd(),await this.setCurrentTime(e),this.checkIfBreakComplete()}catch(e){Ie("setCurrentTime: Error(from: setCurrentTime, message: %s)",e.message)}finally{i&&this.trigger("ad-preroll-finished")}}async playAd(){var e;if(!this._state.hasAny(oe.AD_AVAILABLE))return;this._state.toggleState(oe.AD_AVAILABLE,!1),this._state.toggleState(oe.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(oe.BREAK_ACTIVE))return Ie("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());Ie("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(oe.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(oe.BREAK_ACTIVE)&&!this.adapter.isAdPod()&&!t.force)return Ie("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if(null===(i=t)||"object"!=typeof i||ae(i)!==re)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){Ie(":dispatch",e,t),this.adapter.isAdPod()&&"object"==typeof t&&"time"in t&&"preroll"!==t.ad_type&&(t.time=this.adapter.getAdBreakTime());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){Ie(":error",e)}f(s,e,t),this.emit(e,t)}}get ad_type(){if(!this.videoTag)return;if(!this.adapter.isAdPod())return this._schedule&&this._schedule.getCurrentType();const e=this.adapter.getAdBreakTime();return-1===e?"postroll":this.videoTag.hasState("is-live")||e<1?"preroll":"midroll"}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&&(Ie("Ads.finished"),!(this.adapter.isCustomPlaybackEnabled()&&this._state.hasAny(oe.PLAYING)&&this.adapter.isLinearAd()))){Ie("Ads.finished: trying to play postroll");try{if(!this._schedule.getPostroll())return Ie("Ads.finished: no postroll found"),await this.adapter.contentComplete();this._state.hasAny(oe.AD_AVAILABLE)||await this.fetchNextAd(-1),await this.playAd(),this.adapter.contentComplete()}catch(e){Ie("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(oe.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;Ie("Ads.requestAd(ad: %o)",{ad:e,timeout:s,idx:t});const i=await async function e(t){if("function"==typeof t)return[await ie(t)];if("string"==typeof t)return[await ie(t)];if(Array.isArray(t)){const e=t;return await Promise.all(e.map(ie))}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 setTimeout(()=>this.trigger("ad-teardown"),0),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],te(this.opts,this.adapter.getDimensions()));try{return void await this.adapter.initAd(r,s)}catch(e){return Ie(`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(oe.PLAYING)}get adBreak(){return this._state&&this._state.hasAny(oe.BREAK_ACTIVE)}get adRequesting(){return this._state.hasAny(oe.FETCHING_AD)}get adLinear(){return this.adBreak&&this.adapter.isLinearAd()}}var Ne=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"}),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"});function xe(e){return Object.assign({muted:!1,timeout:250,inline:!1},e)}function Fe(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 qe={audio:function(e){return Fe(e=xe(e),(function(){return{element:document.createElement("audio"),source:URL.createObjectURL(Ne)}}))},video:function(e){return Fe(e=xe(e),(function(){return{element:document.createElement("video"),source:URL.createObjectURL(Ue)}}))}};let Be=void 0;async function je(e=!0){return Be||(Be=await qe.video({timeout:500,muted:e}),Be)}const He=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 Ve=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});const ze=["progress","duration","remaining"];class AdUI extends HTMLElement{static get observedAttributes(){return ze}constructor(e){super(),this.player=e,this.className="fp-ad-ui",this.append(...e.createComponents("flowplayer-ad-controls","flowplayer-ad-countdown")),e.on("ad/set-ui-flags",e=>{let{ui_flags:t}=e.detail;if(t=t||0,(8&t)>0){const e=document.createElement("div");e.classList.add("ad-attribution"),e.textContent=this.player.i18n("ads.advertisement","Advertisement"),this.append(e)}})}}const Ge=S("fpads:native:outstream"),We={OUTSTREAM:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"};var Qe,$e;!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"}(Qe||(Qe={})),function(e){e[e.None=0]="None",e[e.Booting=1]="Booting",e[e.Ready=2]="Ready",e[e.Disposed=3]="Disposed"}($e||($e={}));class Outstream{constructor({ads:e,root:t,content:s,ima:i}){this.state=$e.None,Ge("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.initialVolumeState={},t.classList.add(We.OUTSTREAM),t.append(this.adUi),this.hide(),this.ads.on("ad-pause-content",e=>{var t;if(this.state==$e.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==$e.Disposed)return;const t=e.detail;t&&(this.dimensions={width:t.contentRect.width,height:t.contentRect.height},this.ads.resize(this.dimensions))});let r=1,a=!0;s.on("intersectionchange",e=>{if(this.state==$e.Disposed)return;const t=e.detail;if(t)switch(this.state){case $e.Booting:return Ge(":boot skipping intersectionchange");case $e.None:return this.state=$e.Booting,this.begin_life_cycle();case $e.Ready:if(r=t.ratio,t.ratio>=.5&&this.ads.adPlaying)return;t.ratio>=.5&&a&&this.ads.resume(),t.ratio<.5&&this.ads.pause()}}),this.content.on("ad-paused",()=>a=r<.5),this.setup(),setTimeout(()=>(this.state=$e.Booting,this.begin_life_cycle()),0)}hide(){return this}restore_aspect_ratio(){return Ge(`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.content.setState("ad-linear",!0)}async begin_life_cycle(){var e;this.state=$e.Ready;const{error:t,result:s}=await je(!1),{result:i}=await je(!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},Ge("Outstream.show() :autoplay >> sound="+s),t&&this.content&&!s&&(this.content.muted=!0,this.content.volume=0),await this.ads.setVideoTag(this.content),await P({ads:this.ads,content:this.content,adContainer:this.adUi,ima:this.ima,state:{listening:!1},config:this.content.opts}),U({content:this.content,ads:this.ads}),this.state=$e.Ready}attach_ad_listeners(){this.ads.once("ad-pause-content",()=>{this.show(),this.ads.adPlaying&&this.ads.pause()});const e=()=>{M.forEach(t=>this.ads.removeListener(t,e));const t=new CustomEvent(Qe.OUTSTREAM_TEARDOWN);Ge("Outstream(:teardown)",t),this.content.dispatchEvent(t)};M.forEach(t=>this.ads.once(t,e)),this.content.once(Qe.OUTSTREAM_TEARDOWN,e=>{setTimeout(()=>{if(e.defaultPrevented)return this.handle_endscreen();this.dispose()},0)})}handle_endscreen(){this.reset_ui(),this.ads.reset(),C({config:this.content.opts,ui:this.adUi,ads:this.ads,adContainer:this.adUi,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(He)})}setup(){this.root.classList.add(Outstream.CLASS.OUTSTREAM),this.root.classList.add(Outstream.CLASS.HIDDEN),this.content.setState("ad-linear",!1),this.empty_src()}reset_ui(){const e=this.root;e.classList.remove(Outstream.CLASS.SHOWING),e.classList.remove(Outstream.CLASS.OUTSTREAM)}dispose(){if(this.state==$e.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=$e.Disposed,t.destroy(),e.innerHTML=""}}function Ke(e){return e&&"number"==typeof e.time}function Ye(e){return e&&"number"==typeof e.percentage&&"number"!=typeof e.time}Outstream.CLASS=We;const Ze=S("ads/ima/sdk");var Je,Xe;async function et(e,t){var s;const i=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(t?null==i?void 0:i.dai:i)return void Ze(":noop");const r=t?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":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 tt(i,t,s);i=document.createElement("script"),i.setAttribute("state",Je.LOADING),tt(i,t,s),i.src=e,document.head.appendChild(i)})}(r),void Ze(":loaded")}catch(e){Ze(":error "+e.message,e)}}function tt(e,t,s){const i=e.getAttribute("state");if(i&&[Je.ERROR,Je.LOADED].includes(i))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",Je.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",Je.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(Je||(Je={})),function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(Xe||(Xe={}));const st=S("ads/ima/sdk"),it="https://cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js";async function rt(e){var t;const s=e._storage.getItem("prebid/debug")?it:"https://cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js";if(null===(t=null===window||void 0===window?void 0:window.pbjs)||void 0===t?void 0:t.version)st(":noop");else if(!document.querySelector(`script[src='${s}']`))try{return await async function(e){return new Promise((t,s)=>{let i=document.querySelector(`script[src='${e}']`);i||(i=document.createElement("script")),i.setAttribute("state",Xe.LOADING);const r=i.getAttribute("state");if(r&&[Xe.ERROR,Xe.LOADED].includes(r))return t(void 0);i.addEventListener("load",()=>{i.setAttribute("state",Xe.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(e=>{i.addEventListener(e,()=>{i.setAttribute("state",Xe.ERROR),s("script failed to load")},{once:!0})}),i.src=e,document.head.appendChild(i)})}(s),void st(":loaded")}catch(e){console.warn(":error / failed to load prebid.js / "+e.message,e)}}const at=window.pbjs=window.pbjs||{};at.que=at.que||[];class PrebidAdController{constructor(e,t){this.player=e,this.config=t,this.player=e,this.bestOffer="",at.que.push(()=>{var s,i;const r=this.createAdUnit();at.addAdUnits(r);const a=(null===(i=null===(s=t.ads)||void 0===s?void 0:s.prebid)||void 0===i?void 0:i.pbjs)||{};at.setConfig(Object.assign({enableSendAllBids:!0},a)),e.emit("ad/pbjs",{pbjs:at}),at.requestBids({bidsBackHandler:e=>{var s,i,a,n,o;const d=null===(s=e[this.prebidCode()])||void 0===s?void 0:s.bids;if(!d)return;if(0==d.length)return;const l=d[0];if(l&&l.vastUrl)return this.bestOffer=l.vastUrl;const c=at.adServers.dfp.buildVideoUrl({adUnit:r,params:{iu:null===(a=null===(i=t.ads)||void 0===i?void 0:i.prebid)||void 0===a?void 0:a.iu,cust_params:null===(o=null===(n=t.ads)||void 0===n?void 0:n.prebid)||void 0===o?void 0:o.custom_params,output:"vast"}});this.bestOffer=c}})})}prebidCode(){var e,t;return(null===(t=null===(e=this.config.ads)||void 0===e?void 0:e.prebid)||void 0===t?void 0:t.code)||this.player.root.id}videoInfo(){var e,t;return(null===(t=null===(e=this.config.ads)||void 0===e?void 0:e.prebid)||void 0===t?void 0:t.video)||{context:"instream",playerSize:[[this.player.videoWidth||640,this.player.videoHeight||480]]}}createAdUnit(){var e,t;return{code:this.prebidCode(),mediaTypes:{video:this.videoInfo()},bids:null===(t=null===(e=this.config.ads)||void 0===e?void 0:e.prebid)||void 0===t?void 0:t.bidders}}vastGenerator(){return async()=>this.bestOffer}}function nt(e,t){var s,i;const r=null===(s=t.ads)||void 0===s?void 0:s.prebid;if(!r)return;if((null===(i=e.prebidController)||void 0===i?void 0:i.config)===t)return;e.prebidController||(e.prebidController=new PrebidAdController(e,t),rt(e));const a=e.prebidController;if(a){const t=r.breaks.map(e=>({adTag:a.vastGenerator(),time:e}));e.setOpts({ima:{ads:t}})}}const ot=S("ads/index");async function dt(e,t,s){var i;let r;if(s.on("config",()=>{var t,i,a;void 0===r&&e.autoplay&&!s.currentSrc&&(a=e.autoplay,r=!0===a?v.ON:!1===a?v.OFF:a,e.autoplay=0),(null===(t=e.ads)||void 0===t?void 0:t.prebid)&&nt(s,e),Array.isArray(null===(i=null==e?void 0:e.ima)||void 0===i?void 0:i.ads)&&V(s)&&Object.assign(e,{hls:{native:!0}}),s.ads&&d()}),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!==r){if(e.autoplay=r,s.setState("is-autoplay",!0),!s.hasState(_))return s.once("viewenter",()=>s.togglePlay(!0));s.togglePlay(!0)}},0)}),await et(s),!("google"in window))return console.warn("google.ima unavailable");let a=!1;const n=s.ads=new AdsController,o=n.analytics;function d(){const i=e.ima;if(!i||!Array.isArray(i.ads))return;const d=e.duration||s.duration;if(i.ads=function(e,t){return Array.isArray(e)?e.filter(e=>Ke(e)||Ye(e)).reduce((e,s)=>{if(Ke(s))return e.push(s),e;if(s.lazy)return e.push(s),e;if(Ye(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"),[])}(i.ads,d),n.setSchedule(i.ads,d),e.metadata&&Analytics.mergeMetadata(o,e.metadata),e.metadata&&n.mergeMacros(e.metadata),e.metadata&&i.parameters&&(i.parameters=Object.assign(Object.assign({},i.parameters),e.metadata)),Analytics.mergeMetadata(o,{muted:e.muted||!1,autoplay:e.autoplay||!1}),!a){if(a=!0,e.lang&&!i.Locale&&(i.Locale=e.lang),Schedule.isOutstream(i.ads))return ot("is outstream, returning"),new Outstream({root:t,content:s,ads:n,ima:i});k({config:Object.assign(Object.assign({},e),{autoplay:r}),root:t,content:s,ads:n,ima:i})}}n.resize(h(t)),n.on("ad-postroll-finished",()=>{n.adapter.isCustomPlaybackEnabled()&&n.once("ad-break-completed",()=>{s.src=s.original_src,s.once("canplay",()=>{s.togglePlay(!1)}),s.webkitExitFullscreen()})}),s.on("reap",(function(){n&&n.destroy()})),(null===(i=e.ads)||void 0===i?void 0:i.prebid)&&nt(s,e),d()}class AdControls extends HTMLElement{constructor(e){super(),this.player=e,this.classList.add("fp-ad-controls"),this.append(this.adRemainingTime(),T(this.player,"flowplayer-ad-indicator"),this.playbackButtons(),this.volumeBtn(),T(this.player,"flowplayer-volume-bar"),...this.fullscreenIcons(),this.adChoices()),e.on("ad/set-ui-flags",this.applyStyleFlags.bind(this))}fullscreenIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(e=>(e.onclick=()=>this.player.toggleFullScreen(),e))}volumeBtn(){const e=T(this.player,"flowplayer-volume-icon");return e.onclick=()=>this.player.emit("request/ad/muteunmute"),e}playbackButtons(){const e=document.createElement("div");e.classList.add("ad-playback-controls");const t=T(this.player,"flowplayer-small-play-icon"),s=T(this.player,"flowplayer-small-pause-icon");return t.addEventListener("click",()=>{this.player.emit("request/ad/play"),setTimeout((function(){s.focus&&s.focus()}),100)}),s.addEventListener("click",()=>{this.player.emit("request/ad/pause"),setTimeout((function(){t.focus&&t.focus()}),100)}),e.append(t,s),e}adChoices(){const e=document.createElement("div");return 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")}),e}adRemainingTime(){const e=document.createElement("div");return e.classList.add("fp-ad-remaining","fp-color-text"),this.prepend(e),this.player.on("ad-progress",t=>{const s=t.detail.remaining;e.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+":"+y(i)+":"+y(e)):t+y(i)+":"+y(e)}(parseFloat(s+""))}),e}applyStyleFlags(e){var t;const s=null!==(t=e.detail.ui_flags)&&void 0!==t?t:0;this.classList.toggle("is-ad-controls-sticky",(1&s)>0),this.classList.toggle("no-indicator",(4&s)>0),this.classList.toggle("is-ad-choices",(16&s)>0),this.classList.toggle("no-volume-bar",0==(64&s)),this.classList.toggle("is-ad-remaining",(32&s)>0),this.classList.toggle("no-fullscreen",(2&s)>0)}}class AdCountdown extends HTMLElement{static get observedAttributes(){return["remaining"]}constructor(e){super(),this.player=e,this.className="fp-ad-countdown",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)})}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{static get observedAttributes(){return["position","totals"]}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+"")})}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 lt,ct=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:ut}=u(),ht=((lt=class Ads{constructor(e){this.umd=e,L(e,O,AdUI),L(e,"flowplayer-ad-controls",AdControls),L(e,"flowplayer-ad-countdown",AdCountdown),L(e,"flowplayer-ad-indicator",AdIndicator)}init(e,t,s){if(c.from_token(e.token||"").is_granted(c.permissions.ADS)&&!ut)return dt(e,t,s)}}).pluginName="ads",lt.events=m,lt.ui=Ve,lt.tags=ct,lt);return 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;return"function"==typeof s?(s(t),t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t),t)}(window,ht)}));
|
|
7
|
+
*/const ye=class Bowser{static getParser(t,e=!1){if("string"!=typeof t)throw new Error("UserAgent should be a string");return new Parser(t,e)}static parse(t){return new Parser(t).getResult()}static get BROWSER_MAP(){return ce}static get ENGINE_MAP(){return pe}static get OS_MAP(){return he}static get PLATFORMS_MAP(){return ue}}.parse(window.navigator.userAgent),{platform:Ae,os:be,browser:we}=ye,Ee=t=>t&&t.toLowerCase();var Se={rnd:Math.random().toString(36).substr(2,32),os:Ee(be.name+(be.versionName?` ${be.versionName}`:"")),device:Ee(Ae.type),browser:Ee(we.name),browser_version:(we&&we.version?we.version:"unknown").split(".").shift(),plugin_version:"3.30.0"};const Te="https://fp-eu-w1-aai.flowplayer.com/in",Le="POST",Oe=[y,v,A,E,w,q,O],Re=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],Me=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],Pe=vt("ads/analytics"),ke=RequestQueue.of(),De=(...t)=>Object.assign({},...t);class Analytics{static of(t,e){return new Analytics(t,e)}static ensure_required_keys(t,e){return t.required_keys.filter(t=>!(t in e))}static pluck_valid_keys(t,e){return((t,...e)=>Object.keys(t).filter(t=>~e.indexOf(t)).reduce((e,s)=>Object.assign(e,{[s]:t[s]}),{}))(e,...t.valid_keys)}static mergeMetadata(t,e={}){return t.metadata=Analytics.pluck_valid_keys(t,De(t.metadata,e,{player_version:"3.30.0"})),t}constructor(t,e={}){this.emitter=t,this.metadata=De(Se,e.metadata||{}),this.emitter=t,this.events=e.events||[],this.required_keys=e.required_keys||[],this.optional_keys=e.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),Pe(this),this.wireup()}wireup(){this.events.forEach(t=>{this.emitter.on(t,e=>{const s=e.detail,i=De(this.metadata,{event_type:t},s),r=Analytics.pluck_valid_keys(this,i),a=Analytics.ensure_required_keys(this,r);if(Pe(`Event[${t}]`,{payload:r,observation:s}),a.length)return Pe(`Analytics.validate_metadata() failed for\n Event[${t}]\n missing keys: ${a}`,r);RequestQueue.rpush(ke,[Te,Le,r])})})}destroy(){const t=this;t.emitter=t.metadata=t.events=t.required_keys=t.optional_keys=t.valid_keys=void 0}}class EventBus{constructor(t=document.createElement("div"),e=[]){this._bus=t,this._listeners=e}removeAllListeners(){this._listeners.length=0,this._bus=document.createElement("div")}emit(t,e){const s=new CustomEvent(t,{detail:e||{}});this._bus.dispatchEvent(s)}on(t,e){this._listeners.push([t,e]),this._bus.addEventListener(t,e,{passive:!0})}once(t,e){this._bus.addEventListener(t,e,{once:!0})}removeListener(t,e){this._bus.removeEventListener(t,e)}}const Ie=vt("ads/controller"),Ce={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10};class AdsController extends EventBus{constructor(t={}){var e;super(),this.adapter=function(t,e){return t.adapter?new t.adapter(e):new IMA(e)}(t,this),this.opts=Object.assign(Object.assign({},Ce),t),this.analytics=(e=this,Analytics.of(e,{required_keys:Re,optional_keys:Me,events:Oe})),this._state=AdsState.of(),this._schedule=void 0,this._lastAd=void 0,this._macros=new Macros(t.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();const t=this;t.analytics=void 0,t.opts=void 0,t.adapter=void 0,t._state=void 0,t._schedule=void 0,t._lastAd=void 0,t._macros=void 0}stop(){this.adapter&&this.adapter.stop()}onContentNewSrc(){this._state.reset(),this.adapter.destroyManager(),this.adapter.contentComplete()}wireup(){const t=()=>{var t,e;this.adapter.onAdRequestEnd(),null===(t=this.videoTag)||void 0===t||t.setState("ad-paused",!1),null===(e=this.videoTag)||void 0===e||e.setState("ad-playing",!0),this._state.toggleState(oe.PLAYING,!0)};this.on(B,t),this.on(w,t),this.on(T,t);const e=t=>{var e,s;(null==t?void 0:t.type)!==v&&this.adapter.onAdRequestEnd(),null===(e=this.videoTag)||void 0===e||e.setState("ad-paused",(null==t?void 0:t.type)===S),null===(s=this.videoTag)||void 0===s||s.setState("ad-playing",!1),this.adPlaying&&this._state.toggleState(oe.PLAYING,!1)};this.on(k,e),this.on(_,e),this.on(m,e),this.on(v,e),this.on(S,e),this.on(O,e),this.on(E,e),this.on(k,()=>{requestAnimationFrame(()=>{this._state.toggleState(oe.BREAK_ACTIVE,!1)})}),this.on(F,()=>{console.error("Adapter init failed"),e(),this._state.toggleState(oe.FATAL_ERROR,!0)}),this.on(j,async t=>{if(Ie("Ads.on(RELOAD_AD_REQUESTED)",t),this._schedule){if(e(),t)return this._schedule.reset(this._schedule.getAds());this._state.hasAny(oe.AD_AVAILABLE)&&(this._schedule.decrement(),this._state.toggleState(oe.AD_AVAILABLE,!1))}})}async initialize(t,e={},s){return Ie("Ads.initialize():",t,e,s),this._state.toggleState(oe.INITIALIZING,!0),Object.assign(this.opts,e),Array.isArray(t)&&this.setSchedule(t),await this.adapter.init(this.opts),this._macros=this._macros.fork(Object.assign({},e.parameters||{},{autoplay:e.autoplay,muted:e.muted})),this.adapter.isReady()&&await this.adapterInitialized(s),this}get videoTag(){return this.adapter.getVideoTag()}get adInfo(){return this.adapter.getAdInfo()}async setVideoTag(t){Ie("Ads.setVideoTag():",t),await this.adapter.setVideoTag(t),this.trigger(f,t),this.adapter.isReady()&&await this.adapterInitialized(),t.on(H,()=>this.adapter.pause()),t.on(V,()=>this.adapter.resume()),t.on(z,()=>t.toggleMute()),t.on(Z,()=>{this.adapter.volume(t.muted?0:0==t.volume?.1:t.volume)}),t.on("src",()=>t.hasState("ad-playing")||t.hasState("ad-paused")?(this.stop(),this.adapter.isLinearAd()?(this.setIsContentProcessingNewSrc(!0),void this.once(k,()=>{setTimeout(()=>{this.setIsContentProcessingNewSrc(!1),this.onContentNewSrc()},0)})):this.onContentNewSrc()):this.onContentNewSrc())}waitForVideoTag(){return new Promise(t=>{const e=this.adapter.getVideoTag();if(e)return t(e);this.on(f,e=>{this.once(g,()=>t(e))})})}async adapterInitialized(t){Ie("Ads.adapterInitialized()"),this._state.toggleState(oe.INITIALIZING,!1),this._state.toggleState(oe.BREAK_ACTIVE,!!this.hasPreroll()),await this.setCurrentTime(0,t),this.checkIfBreakComplete(),this.adapter.isAdPod()||t&&!this.opts.autoplay||this.trigger(_)}async fetchNextAd(t,e=0){var s,i;if(!this._schedule)return;if(!this.adapter.isReady())return;if(e>50)throw this._state.toggleState(oe.FATAL_ERROR,!0),this._state.toggleState(oe.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===t)if(this._schedule.waitForLoad(t,r,this.opts.preload_ads))this._state.toggleState(oe.FETCHING_AD,!1);else if(r!==this._schedule.getPostroll()||(this._schedule.setPostrollActive(),-1===t))if(this._schedule.isDrained()||this._schedule.increment(),r){Ie("Ads.fetchNextAd",r),this._state.toggleState(oe.FETCHING_AD,!0);try{return await this.requestAd(r),this._state.toggleState(oe.AD_AVAILABLE,!0),void this._state.toggleState(oe.FETCHING_AD,!1)}catch(s){return Ie("Ads.fetchNextAd(err: %o, ad: %o)",s,r),this.setLastAd(r),r!==this._schedule.getPostroll()?await this.fetchNextAd(t,++e):void this._state.toggleState(oe.FETCHING_AD,!1)}}else this._state.toggleState(oe.FETCHING_AD,!1);else this._state.toggleState(oe.FETCHING_AD,!1)}skipAdsOnSeek(t){if(!this._schedule)return;let e=this._schedule.getNextAd();for(;e&&e.time<t;)this._schedule.increment(),e=this._schedule.getNextAd()}async setCurrentTime(t,e=!1,s=!1){if(!this._schedule)return;if(!this.adapter.isReady())return;if(this._state.hasAny(oe.FETCHING_AD))return;if(this._state.hasAny(oe.PLAYING)&&this.adapter.isLinearAd())return;const i=0===t&&0===this._schedule.getNextIndex();try{if(s&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(t),this._state.hasAny(oe.AD_AVAILABLE)||await this.fetchNextAd(t),!this._state.hasAny(oe.AD_AVAILABLE)||!this.shallPlayAd(t)||e)return;await this.playAd(),await this.setCurrentTime(t),this.checkIfBreakComplete()}catch(t){Ie("setCurrentTime: Error(from: setCurrentTime, message: %s)",t.message)}finally{i&&this.trigger(I)}}async playAd(){var t;if(!this._state.hasAny(oe.AD_AVAILABLE))return;this._state.toggleState(oe.AD_AVAILABLE,!1),this._state.toggleState(oe.BREAK_ACTIVE,!0);const e=null===(t=this._schedule)||void 0===t?void 0:t.getCurrentAd();try{await this.adapter.playAd()}catch(t){console.error("Ads.playAd: error",t)}finally{e&&this.setLastAd(e)}}checkIfBreakComplete(){if(!this._state.hasAny(oe.BREAK_ACTIVE))return Ie("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());Ie("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(oe.BREAK_ACTIVE,!1),this.adapter.isAdPod()||this.trigger(k)}resetScheduleCounter(){this._schedule&&this._schedule.resetCounter()}setSchedule(t,e){if(e&&!isNaN(e)&&this._schedule&&this._schedule.updateContentDuration(e),this._schedule&&this._schedule.getNextIndex()>0)return this._schedule.setAds(t);this._schedule=new Schedule(t,{preload_advance:this.opts.preload_advance,content_duration:e?0:e})}toJSON(){return this._schedule?this._schedule.toJSON():[]}trigger(t,e={}){var s;if(!this.adapter.getVideoTag())return;if(!this._state)return;if(t===k&&this._state.hasAny(oe.BREAK_ACTIVE)&&!this.adapter.isAdPod()&&!e.force)return Ie("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if(null===(i=e)||"object"!=typeof i||ae(i)!==re)return this.dispatch(t,e);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},e);return this.dispatch(t,r)}dispatch(t,e){const s=this.adapter.getVideoTag();if(s){Ie(":dispatch",t,e),this.adapter.isAdPod()&&"object"==typeof e&&"time"in e&&"preroll"!==e.ad_type&&(e.time=this.adapter.getAdBreakTime());try{const i={event:"ads/"+t,detail:{outstream:e.outstream,ad_type:e.ad_type,ad_break_time:e.time,ad_remaining_seconds:e.remaining,ad_muted:e.muted,ad_duration_seconds:e.duration,ad_error_reason:e.reason,ad_vast_error:e.vast_error,ad_vast_error_type:e.vast_error_type,ad_request_load_type:e.request_load_time}};s.dispatchEvent(new CustomEvent("health:record",{detail:i}))}catch(t){Ie(":error",t)}ct(s,t,e),this.emit(t,e)}}get ad_type(){if(!this.videoTag)return;if(!this.adapter.isAdPod())return this._schedule&&this._schedule.getCurrentType();const t=this.adapter.getAdBreakTime();return-1===t?"postroll":this.videoTag.hasState(nt)||t<1?"preroll":"midroll"}shouldRestartContent(){if(this.getIsContentProcessingNewSrc())return!1;if(this.adapter.isAdPod())return!0;const t=this.getLastAd();return!t||!t.outstream&&!1!==t.restart}async finished(t){if(this._schedule&&(Ie("Ads.finished"),!(this.adapter.isCustomPlaybackEnabled()&&this._state.hasAny(oe.PLAYING)&&this.adapter.isLinearAd()))){Ie("Ads.finished: trying to play postroll");try{if(!this._schedule.getPostroll())return Ie("Ads.finished: no postroll found"),await this.adapter.contentComplete();this._state.hasAny(oe.AD_AVAILABLE)||await this.fetchNextAd(-1),await this.playAd(),this.adapter.contentComplete()}catch(t){Ie("Ads.finished: postroll failed:",t)}finally{this.trigger(D),this.checkIfBreakComplete(),"function"==typeof t&&t()}}}hasPreroll(){return this._schedule&&Schedule.hasPreroll(this._schedule.getAds())}shallPlayAd(t){var e;return(!this.adapter||!this.adapter.isAdPod())&&(!(!this._state||this._state.hasAny(oe.FATAL_ERROR))&&!!(null===(e=this._schedule)||void 0===e?void 0:e.shallPlayAd(t)))}setLastAd(t){return this._lastAd=t,this}setIsContentProcessingNewSrc(t){this.content_processing_src=t}getLastAd(){return this._lastAd}getIsContentProcessingNewSrc(){return this.content_processing_src}mergeMacros(t={}){return this._macros=this._macros.fork(Object.assign({},t)),this}get paused(){return this.adapter&&this.adapter.isPaused()}pause(){this.adapter&&this.adapter.pause()}resume(){this.adapter&&this.adapter.resume()}resize(t){this.adapter&&this.adapter.onResize(t)}async requestAd(t,e=0,s=this.opts.timeout){if(!this._state)return;Ie("Ads.requestAd(ad: %o)",{ad:t,timeout:s,idx:e});const i=await ie(t);if(void 0===i[e])return setTimeout(()=>this.trigger(_),0),Promise.reject(new Error("Ad failed, no fallbacks left"));if(!i[e])return await this.requestAd(i,e+1,s);this.trigger(y,t);const r=this._macros.compile(i[e],te(this.opts,this.adapter.getDimensions()));try{return void await this.adapter.initAd(r,s)}catch(t){return Ie(`Ads.requestAd(:fallback, idx: ${e}, length: ${i.length}, adTag: ${i[e]})\nError `,{adTag:i,err:t}),this.requestAd(i,e+1,s)}}resetSchedule(t){this._schedule&&this._schedule.reset(t)}get adPlaying(){return this._state&&this._state.hasAny(oe.PLAYING)}get adBreak(){return this._state&&this._state.hasAny(oe.BREAK_ACTIVE)}get adRequesting(){return this._state.hasAny(oe.FETCHING_AD)}get adLinear(){return this.adBreak&&this.adapter.isLinearAd()}}var Ne=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"}),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"});function xe(t){return Object.assign({muted:!1,timeout:250,inline:!1},t)}function Fe(t,e){var s=t.muted,i=t.timeout,r=t.inline,a=e(),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(t){d=n.play(),l=setTimeout(function(){c(!1,new Error("Timeout "+i+" ms has been reached"))},i),c=function(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n.remove(),n.srcObject=null,clearTimeout(l),t({result:e,error:s})},void 0!==d?d.then(function(){return c(!0)}).catch(function(t){return c(!1,t)}):c(!0)})}var Be={audio:function(t){return Fe(t=xe(t),function(){return{element:document.createElement("audio"),source:URL.createObjectURL(Ne)}})},video:function(t){return Fe(t=xe(t),function(){return{element:document.createElement("video"),source:URL.createObjectURL(Ue)}})}};let je;async function qe(t=!0){return je||(je=await Be.video({timeout:500,muted:t}),je)}const He=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 Ve=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});const ze=["progress","duration","remaining"];class AdUI extends HTMLElement{static get observedAttributes(){return ze}constructor(t){super(),this.player=t,this.className="fp-ad-ui",this.append(...t.createComponents(wt,Et)),t.on(Q,t=>{let{ui_flags:e}=t.detail;if(e=e||0,(8&e)>0){const t=document.createElement("div");t.classList.add("ad-attribution"),t.textContent=this.player.i18n("ads.advertisement","Advertisement"),this.append(t)}})}}const Ge=vt("fpads:native:outstream"),We={OUTSTREAM:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"};var Qe,$e;!function(t){t.OUTSTREAM_VISIBLE="ads-outstream-visible",t.OUTSTREAM_VIEWPORT_UPDATE="ads-outstream-viewport-update",t.OUTSTREAM_TEARDOWN="ads-outstream-teardown",t.OUTSTREAM_ENDSCREEN_READY="ads-outstream-endscreen-ready"}(Qe||(Qe={})),function(t){t[t.None=0]="None",t[t.Booting=1]="Booting",t[t.Ready=2]="Ready",t[t.Disposed=3]="Disposed"}($e||($e={}));class Outstream{constructor({ads:t,root:e,content:s,ima:i}){this.state=$e.None,Ge("creating Outstream instance"),this.content=s,this.ads=t,this.root=e,this.ima=i,this.aspectRatio=s.videoHeight/s.videoWidth,this.dimensions=function(t){if(t.clientWidth>0||t.clientHeight)return h(t);const e={height:t.style.height};p(t,"opacity",0),p(t,"display","absolute"),p(t,"display","inline-block"),p(t,"height","auto");const s=h(t);return p(t,"height",e.height),p(t,"opacity",1),s}(this.root),this.adUi=new AdUI(s),this.initialVolumeState={},e.classList.add(We.OUTSTREAM),e.append(this.adUi),this.hide(),this.ads.on(b,t=>{var e;if(this.state==$e.Disposed)return;const s=!!(null===(e=t.detail)||void 0===e?void 0:e.linear);this.ads.resize(Object.assign(Object.assign({},this.dimensions),{linear:s}))}),s.on(Y,t=>{if(this.state==$e.Disposed)return;const e=t.detail;e&&(this.dimensions={width:e.contentRect.width,height:e.contentRect.height},this.ads.resize(this.dimensions))});let r=1,a=!0;s.on("intersectionchange",t=>{if(this.state==$e.Disposed)return;const e=t.detail;if(e)switch(this.state){case $e.Booting:return Ge(":boot skipping intersectionchange");case $e.None:return this.state=$e.Booting,this.begin_life_cycle();case $e.Ready:if(r=e.ratio,e.ratio>=.5&&this.ads.adPlaying)return;e.ratio>=.5&&a&&this.ads.resume(),e.ratio<.5&&this.ads.pause()}}),this.content.on(S,()=>a=r<.5),this.setup(),setTimeout(()=>(this.state=$e.Booting,this.begin_life_cycle()),0)}hide(){return this}restore_aspect_ratio(){return Ge(`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.content.setState("ad-linear",!0)}async begin_life_cycle(){var t;this.state=$e.Ready;const{error:e,result:s}=await qe(!1),{result:i}=await qe(!0);this.content.emit(Q,{ui_flags:null===(t=this.content.opts.ads)||void 0===t?void 0:t.ui}),this.attach_ad_listeners(),this.initialVolumeState={can_autoplay:!(!s&&!i),muted:!s},Ge(`Outstream.show() :autoplay >> sound=${s}`),e&&this.content&&!s&&(this.content.muted=!0,this.content.volume=0),await this.ads.setVideoTag(this.content),await Rt({ads:this.ads,content:this.content,adContainer:this.adUi,ima:this.ima,state:{listening:!1},config:this.content.opts}),It({content:this.content,ads:this.ads}),this.state=$e.Ready}attach_ad_listeners(){this.ads.once(b,()=>{this.show(),this.ads.adPlaying&&this.ads.pause()});const t=()=>{Lt.forEach(e=>this.ads.removeListener(e,t));const e=new CustomEvent(Qe.OUTSTREAM_TEARDOWN);Ge("Outstream(:teardown)",e),this.content.dispatchEvent(e)};Lt.forEach(e=>this.ads.once(e,t)),this.content.once(Qe.OUTSTREAM_TEARDOWN,t=>{setTimeout(()=>{if(t.defaultPrevented)return this.handle_endscreen();this.dispose()},0)})}handle_endscreen(){this.reset_ui(),this.ads.reset(),kt({config:this.content.opts,ui:this.adUi,ads:this.ads,adContainer:this.adUi,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(He)})}setup(){this.root.classList.add(Outstream.CLASS.OUTSTREAM),this.root.classList.add(Outstream.CLASS.HIDDEN),this.content.setState("ad-linear",!1),this.empty_src()}reset_ui(){const t=this.root;t.classList.remove(Outstream.CLASS.SHOWING),t.classList.remove(Outstream.CLASS.OUTSTREAM)}dispose(){if(this.state==$e.Disposed)return;const t=this.root,e=this.content;this.reset_ui(),t.classList.add(Outstream.CLASS.OUTSTREAM),t.classList.add(Outstream.CLASS.DONE);const s=this;s.video=s.container=s.ads=0,this.state=$e.Disposed,e.destroy(),t.innerHTML=""}}function Ke(t){return t&&"number"==typeof t.time}function Ye(t){return t&&"number"==typeof t.percentage&&"number"!=typeof t.time}Outstream.CLASS=We;const Ze=vt("ads/ima/sdk");var Je,Xe;async function ts(t,e){var s;const i=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(e?null==i?void 0:i.dai:i)return void Ze(":noop");const r=e?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":t._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(t){return new Promise((e,s)=>{let i=document.querySelector(`script[src='${t}']`);if(i)return es(i,e,s);i=document.createElement("script"),i.setAttribute("state",Je.LOADING),es(i,e,s),i.src=t,document.head.appendChild(i)})}(r),void Ze(":loaded")}catch(t){Ze(`:error ${t.message}`,t)}}function es(t,e,s){const i=t.getAttribute("state");if(i&&[Je.ERROR,Je.LOADED].includes(i))return e(void 0);t.addEventListener("load",()=>{t.setAttribute("state",Je.LOADED),e(void 0)},{once:!0}),["error","abort"].forEach(e=>{t.addEventListener(e,()=>{t.setAttribute("state",Je.ERROR),s("script failed to load")},{once:!0})})}!function(t){t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"}(Je||(Je={})),function(t){t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"}(Xe||(Xe={}));const ss=vt("ads/ima/sdk"),is="https://cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js",rs=is;async function as(t){var e;const s=t._storage.getItem("prebid/debug")?is:rs;if(null===(e=null===window||void 0===window?void 0:window.pbjs)||void 0===e?void 0:e.version)ss(":noop");else if(!document.querySelector(`script[src='${s}']`))try{return await async function(t){return new Promise((e,s)=>{let i=document.querySelector(`script[src='${t}']`);i||(i=document.createElement("script")),i.setAttribute("state",Xe.LOADING);const r=i.getAttribute("state");if(r&&[Xe.ERROR,Xe.LOADED].includes(r))return e(void 0);i.addEventListener("load",()=>{i.setAttribute("state",Xe.LOADED),e(void 0)},{once:!0}),["error","abort"].forEach(t=>{i.addEventListener(t,()=>{i.setAttribute("state",Xe.ERROR),s("script failed to load")},{once:!0})}),i.src=t,document.head.appendChild(i)})}(s),void ss(":loaded")}catch(t){console.warn(`:error / failed to load prebid.js / ${t.message}`,t)}}const ns=window.pbjs=window.pbjs||{};ns.que=ns.que||[];class PrebidAdController{constructor(t,e){this.player=t,this.config=e,this.player=t,this.bestOffer="",ns.que.push(()=>{var s,i;const r=this.createAdUnit();ns.addAdUnits(r);const a=(null===(i=null===(s=e.ads)||void 0===s?void 0:s.prebid)||void 0===i?void 0:i.pbjs)||{};ns.setConfig(Object.assign({enableSendAllBids:!0},a)),t.emit($,{pbjs:ns}),ns.requestBids({bidsBackHandler:t=>{var s,i,a,n,o;const d=null===(s=t[this.prebidCode()])||void 0===s?void 0:s.bids;if(!d)return;if(0==d.length)return;const l=d[0];if(l&&l.vastUrl)return this.bestOffer=l.vastUrl;const c=ns.adServers.dfp.buildVideoUrl({adUnit:r,params:{iu:null===(a=null===(i=e.ads)||void 0===i?void 0:i.prebid)||void 0===a?void 0:a.iu,cust_params:null===(o=null===(n=e.ads)||void 0===n?void 0:n.prebid)||void 0===o?void 0:o.custom_params,output:"vast"}});this.bestOffer=c}})})}prebidCode(){var t,e;return(null===(e=null===(t=this.config.ads)||void 0===t?void 0:t.prebid)||void 0===e?void 0:e.code)||this.player.root.id}videoInfo(){var t,e;return(null===(e=null===(t=this.config.ads)||void 0===t?void 0:t.prebid)||void 0===e?void 0:e.video)||{context:"instream",playerSize:[[this.player.videoWidth||640,this.player.videoHeight||480]]}}createAdUnit(){var t,e;return{code:this.prebidCode(),mediaTypes:{video:this.videoInfo()},bids:null===(e=null===(t=this.config.ads)||void 0===t?void 0:t.prebid)||void 0===e?void 0:e.bidders}}vastGenerator(){return async()=>this.bestOffer}}function os(t,e){var s,i;const r=null===(s=e.ads)||void 0===s?void 0:s.prebid;if(!r)return;if((null===(i=t.prebidController)||void 0===i?void 0:i.config)===e)return;t.prebidController||(t.prebidController=new PrebidAdController(t,e),as(t));const a=t.prebidController;if(a){const e=r.breaks.map(t=>({adTag:a.vastGenerator(),time:t}));t.setOpts({ima:{ads:e}})}}const ds=vt("ads/index");async function ls(t,e,s){var i;let r;if(s.on("config",()=>{var e,i,a;void 0===r&&t.autoplay&&!s.currentSrc&&(a=t.autoplay,r=!0===a?ut.ON:!1===a?ut.OFF:a,t.autoplay=0),(null===(e=t.ads)||void 0===e?void 0:e.prebid)&&os(s,t),Array.isArray(null===(i=null==t?void 0:t.ima)||void 0===i?void 0:i.ads)&&qt(s)&&Object.assign(t,{hls:{native:!0}}),s.ads&&d()}),s.once("loadstart",()=>{setTimeout(()=>{var e;if(!Array.isArray(null===(e=null==t?void 0:t.ima)||void 0===e?void 0:e.ads)&&void 0!==r){if(t.autoplay=r,s.setState(dt,!0),!s.hasState(lt))return s.once(st,()=>s.togglePlay(!0));s.togglePlay(!0)}},0)}),await ts(s),!("google"in window))return console.warn("google.ima unavailable");let a=!1;const n=s.ads=new AdsController,o=n.analytics;function d(){const i=t.ima;if(!i||!Array.isArray(i.ads))return;const d=t.duration||s.duration;if(i.ads=function(t,e){return Array.isArray(t)?t.filter(t=>Ke(t)||Ye(t)).reduce((t,s)=>{if(Ke(s))return t.push(s),t;if(s.lazy)return t.push(s),t;if(Ye(s)){const i=Object.assign({},s),r=s.percentage?s.percentage*e:0;return isNaN(r)||(i.time=r<0||r===e?-1:r),t.push(i),t}return t},[]):(console.warn("AdSchedule was not an Array"),[])}(i.ads,d),n.setSchedule(i.ads,d),t.metadata&&Analytics.mergeMetadata(o,t.metadata),t.metadata&&n.mergeMacros(t.metadata),t.metadata&&i.parameters&&(i.parameters=Object.assign(Object.assign({},i.parameters),t.metadata)),Analytics.mergeMetadata(o,{muted:t.muted||!1,autoplay:t.autoplay||!1}),!a){if(a=!0,t.lang&&!i.Locale&&(i.Locale=t.lang),Schedule.isOutstream(i.ads))return ds("is outstream, returning"),new Outstream({root:e,content:s,ads:n,ima:i});Ot({config:Object.assign(Object.assign({},t),{autoplay:r}),root:e,content:s,ads:n,ima:i})}}n.resize(h(e)),n.on(D,()=>{n.adapter.isCustomPlaybackEnabled()&&n.once(k,()=>{s.src=s.original_src,s.once("canplay",()=>{s.togglePlay(!1)}),s.webkitExitFullscreen()})}),s.on("reap",function(){n&&n.destroy()}),(null===(i=t.ads)||void 0===i?void 0:i.prebid)&&os(s,t),d()}class AdControls extends HTMLElement{constructor(t){super(),this.player=t,this.classList.add("fp-ad-controls"),this.append(this.adRemainingTime(),yt(this.player,St),this.playbackButtons(),this.volumeBtn(),yt(this.player,"flowplayer-volume-bar"),...this.fullscreenIcons(),this.adChoices()),t.on(Q,this.applyStyleFlags.bind(this))}fullscreenIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(t=>(t.onclick=()=>this.player.toggleFullScreen(),t))}volumeBtn(){const t=yt(this.player,"flowplayer-volume-icon");return t.onclick=()=>this.player.emit(z),t}playbackButtons(){const t=document.createElement("div");t.classList.add("ad-playback-controls");const e=yt(this.player,"flowplayer-small-play-icon"),s=yt(this.player,"flowplayer-small-pause-icon");return e.addEventListener("click",()=>{this.player.emit(V),setTimeout(function(){s.focus&&s.focus()},100)}),s.addEventListener("click",()=>{this.player.emit(H),setTimeout(function(){e.focus&&e.focus()},100)}),t.append(e,s),t}adChoices(){const t=document.createElement("div");return t.classList.add("fp-ad-choices"),t.textContent=this.player.i18n("ads.adchoices","AdChoices"),t.addEventListener("click",t=>{t.preventDefault(),this.player.togglePlay(!1),window.open("https://adssettings.google.com","_blank")}),t}adRemainingTime(){const t=document.createElement("div");return t.classList.add("fp-ad-remaining","fp-color-text"),this.prepend(t),this.player.on(L,e=>{const s=e.detail.remaining;t.textContent=function(t){if(isNaN(t)||t>=Number.MAX_SAFE_INTEGER)return"";const e=t<0?"-":"";t=Math.round(Math.abs(t));const s=Math.floor(t/3600);let i=Math.floor(t/60);return t-=60*i,s>=1?(i-=60*s,e+s+":"+ht(i)+":"+ht(t)):e+ht(i)+":"+ht(t)}(parseFloat(s+""))}),t}applyStyleFlags(t){var e;const s=null!==(e=t.detail.ui_flags)&&void 0!==e?e:0;this.classList.toggle("is-ad-controls-sticky",(1&s)>0),this.classList.toggle("no-indicator",(4&s)>0),this.classList.toggle("is-ad-choices",(16&s)>0),this.classList.toggle("no-volume-bar",!(64&s)),this.classList.toggle("is-ad-remaining",(32&s)>0),this.classList.toggle("no-fullscreen",(2&s)>0)}}class AdCountdown extends HTMLElement{static get observedAttributes(){return["remaining"]}constructor(t){super(),this.player=t,this.className="fp-ad-countdown",t.on(L,t=>{const{duration:e,remaining:s}=t.detail;this.setAttribute("duration",e+""),this.setAttribute("remaining",s+"")}),t.on(w,t=>{t.detail.linear&&(this.style.setProperty("--ad-percent-previous","0"),this.style.setProperty("--ad-percent-complete","0"))}),this.addEventListener("animationend",()=>{const t=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",t)})}attributeChangedCallback(t,e,s){if("remaining"===t)return this.onRemaining(s)}onRemaining(t){const e=parseFloat(this.getAttribute("duration")||"0");t||(t=e+"");const s=parseFloat(t),i=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",i),this.classList.remove("go");const r=((e-s)/e*100).toFixed(3);requestAnimationFrame(()=>{this.style.setProperty("--ad-percent-complete",r),this.classList.add("go")})}}class AdIndicator extends HTMLElement{static get observedAttributes(){return["position","totals"]}constructor(t){super(),this.player=t,this.render(),t.on(w,t=>{const{position:e,totals:s}=t.detail.ad;this.setAttribute("position",e+""),this.setAttribute("totals",s+"")})}attributeChangedCallback(t,e){switch(t){case"position":case"totals":return this.updateText()}}updateText(){if(!this.element)return;const t=parseFloat(this.getAttribute("position")||"0"),e=parseFloat(this.getAttribute("totals")||"0");this.element.textContent=`${this.player.i18n("ads.indicator","ADS")} ${t} / ${e}`}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 cs,us=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:hs}=u(),ps=(cs=class Ads{constructor(t){this.umd=t,At(t,bt,AdUI),At(t,wt,AdControls),At(t,Et,AdCountdown),At(t,St,AdIndicator)}init(t,e,s){if(c.from_token(t.token||"").is_granted(c.permissions.ADS)&&!hs)return ls(t,e,s)}},cs.pluginName="ads",cs.events=K,cs.ui=Ve,cs.tags=us,cs);return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const s=t.flowplayer;return"function"==typeof s?(s(e),e):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(e)||s.extensions.push(e),e)}(window,ps)});
|