@flowplayer/player 3.2.6 → 3.2.8
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/events.d.ts +1 -1
- package/core.js +1 -1
- package/default.js +1 -1
- package/embed.js +3 -3
- package/flowplayer.css +1 -1
- package/index.d.ts +11 -3
- package/package.json +1 -1
- package/plugins/ads.js +2 -2
- package/plugins/analytics.js +1 -1
- package/plugins/asel.js +1 -1
- package/plugins/audio.js +1 -1
- package/plugins/chromecast.js +1 -1
- package/plugins/dash.js +1 -1
- package/plugins/endscreen.js +1 -1
- package/plugins/float-on-scroll.js +1 -1
- package/plugins/health.js +1 -1
- package/plugins/hls.js +1 -1
- package/plugins/ovp.js +1 -1
- package/plugins/playlist.js +1 -1
- package/plugins/qul.js +1 -1
- package/plugins/ssai.js +1 -1
package/embed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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=e()}(this,(function(){"use strict";const t=[],e=[];function r(){const t="undefined"!=typeof document&&"undefined"!=typeof window,e=t?navigator.userAgent:"",r=/iP(hone|od)/i.test(e)&&!/iPad/.test(e)&&!/IEMobile/i.test(e),i=/Android/.test(e)&&!/Firefox/.test(e),n=/^((?!chrome|android).)*safari/i.test(e),s=/SamsungBrowser/.test(e),a=s&&/SMART-TV/.test(e);return{controls:!r,video:function(e){return t&&document.createElement("video").canPlayType(e)},lang:t&&window.navigator.language,android:i,iphone:r,safari:n,ios:t&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:s,samsung_tv:s&&a,touch:!!("ontouchstart"in window)}}const i="error",n="click",s="dblclick",a="load",o="mouseenter",l="mouseleave",u="touchend",d="fullscreenenter",c="fullscreenexit",h="loadedmetadata",f="loadeddata",p="progress",g="loadstart",v="pause",m="playing",y="waiting",E="canplay",T="ended",_="seeked",S="seeking",b="src",A="reap",L="config",w="landscape",R="portrait";var D=Object.freeze({__proto__:null,MOUNT:"mount",ERROR:i,CONTEXT_MENU:"contextmenu",CLICK:n,DBL_CLICK:s,KEYUP:"keyup",KEYDOWN:"keydown",LOAD:a,MOUSE_ENTER:o,MOUSE_LEAVE:l,MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:u,TOUCH_CANCEL:"touchcancel",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_ENTER:d,FULLSCREEN_EXIT:c,FULLSCREEN_CHANGE:"fullscreenchange",WEBKIT_NEEDKEY:"webkitneedkey",METADATA:h,DATA:f,PROGRESS:p,TIME_UPDATE:"timeupdate",LOAD_START:g,VOLUME_CHANGE:"volumechange",PAUSE:v,PLAYING:m,PLAY:"play",WAITING:y,CAN_PLAY:E,ENDED:T,SEEKED:_,SEEKING:S,DURATION_CHANGE:"durationchange",BEFORE_PLAY:"beforeplay",BEFORE_PAUSE:"beforepause",STATE:"state",CUEPOINTS:"cuepoints",CUEPOINT_START:"cuepointstart",CUEPOINT_END:"cuepointend",VIEW_ENTER:"viewenter",VIEW_LEAVE:"viewleave",SOURCE:b,RECOVER:"recover",REAP:A,CONFIG:L,QUALITIES:"qualities",SET_QUALITY:"quality:set",NON_RECOVERABLE_ERROR:"error:fatal",RECOMMENDATIONS_READY:"recommendationsready",AUDIO_ONLY_SOURCE:"audioonlysource",LANDSCAPE:w,PORTRAIT:R,RENDER_PLUGIN:"renderplugin",DVR:"dvr",LIVE:"live",SEEK_QUEUED:"seek:queued",SEEK_CANCEL:"seek:cancel",PLUGIN_REGISTERED:"plugin:registered",REMOTE_SESSION_STARTED:"remotesession:started",REMOTE_SESSION_ENDED:"remotesession:ended",INTERSECTIONCHANGE:"intersectionchange"});const k="flowplayer-ui",O="flowplayer-control",I="flowplayer-live-status",C="flowplayer-elapsed-time",P="flowplayer-timeline-bar",x="flowplayer-header",M="flowplayer-header-right-zone",F="flowplayer-primary",N="flowplayer-middle",U="flowplayer-middle-zone",B="flowplayer-wait",G="flowplayer-small-play-icon",j="flowplayer-small-pause-icon",H="flowplayer-play-icon",K="flowplayer-pause-icon",V="flowplayer-rewind-icon",q="flowplayer-volume-icon",W="flowplayer-live-countdown";var z=Object.freeze({__proto__:null,SUBTITLES_MENU:"flowplayer-subtitles-menu",SHARE_MENU:"flowplayer-share-menu",SPEED_MENU:"flowplayer-speed-menu",QUALITY_MENU:"flowplayer-quality-menu",AUDIO_MENU:"flowplayer-audio-menu",UI:k,CONTROL:O,CONTROL_BUTTONS:"flowplayer-control-buttons",LIVE_STATUS:I,ELAPSED:C,TIMELINE:P,CONTROL_DURATION:"flowplayer-control-duration",VOLUME_CONTROL:"flowplayer-volume-control",VOLUME_BAR:"flowplayer-volume-bar",HEADER:x,HEADER_LEFT_ZONE:"flowplayer-header-left-zone",HEADER_RIGHT_ZONE:M,PRIMARY:F,HEADER_DURATION:"flowplayer-header-duration",MIDDLE:N,MIDDLE_ZONE:U,WAIT:B,MIDDLE_BUTTONS:"flowplayer-middle-buttons",MIDDLE_LEFT_ZONE:"flowplayer-middle-left-zone",MIDDLE_RIGHT_ZONE:"flowplayer-middle-right-zone",ENDSCREEN_INTERSTITIAL:"flowplayer-endscreen-interstitial",ENDSCREEN_UP_NEXT:"flowplayer-endscreen-up-next",ENDSCREEN_GRID:"flowplayer-endscreen-grid",PLAYLIST_INTERSTITIAL:"flowplayer-playlist-interstitial",AIRPLAY_ICON:"flowplayer-airplay-icon",CHROMECAST_ICON:"flowplayer-chromecast-icon",SMALL_PLAY_ICON:G,SMALL_PAUSE_ICON:j,PLAY_ICON:H,PAUSE_ICON:K,FULLSCREEN_ENTER_ICON:"flowplayer-fullscreen-enter-icon",FULLSCREEN_EXIT_ICON:"flowplayer-fullscreen-exit-icon",SKIP_NEXT_ICON:"flowplayer-skip-next-icon",SKIP_PREVIOUS_ICON:"flowplayer-skip-previous-icon",FAST_FORWARD_ICON:"flowplayer-fast-forward-icon",REWIND_ICON:V,SHARE_ICON:"flowplayer-share-icon",VOLUME_ICON:q,MUTE_ICON:"flowplayer-mute-icon",UNMUTE_ICON:"flowplayer-unmute-icon",CLOSE_ICON:"flowplayer-close-icon",FACEBOOK_ICON:"flowplayer-facebook-icon",TWITTER_ICON:"flowplayer-twitter-icon",LINK_ICON:"flowplayer-link-icon",EMBED_ICON:"flowplayer-embed-icon",LIVE_COUNTDOWN:W,PLAYLIST_CONTROLS:"flowplayer-playlist-controls",THUMBNAILS_CAROUSEL:"flowplayer-thumbnails-carousel"});const Y="is-playing",X="is-paused",Q="is-loaded",$="is-loading",Z="is-starting",J="is-seeking",tt="is-ended",et="is-live",rt="is-waiting",it="no-timeline",nt="is-touched",st="is-in-viewport";var at=Object.freeze({__proto__:null,PLAYING:Y,FULLSCREEN:"is-fullscreen",PAUSED:X,MUTED:"is-muted",LOADED:Q,LOADING:$,STARTING:Z,SEEKING:J,GRABBING:"is-grabbing",DISABLED:"is-disabled",SMALL:"is-small",TINY:"is-tiny",RTL:"is-rtl",ENDED:tt,LIVE:et,ERRORED:"is-error",WAITING:rt,AUTOPLAY:"is-autoplay",NO_AUTOPLAY:"no-autoplay",SEAMLESS:"is-seamless",TOGGLING:"is-toggling",LIVE_SEEKED:"is-live-seeked",NO_DVR:it,HAS_POSTER:"has-poster",MENU_OPENED:"has-menu-opened",TOUCHED:nt,HOVERED:"is-hovered",TOUCH_DEVICE:"is-touch-device",WILL_SEEK:"will-seek",SEEKABLE:"is-seekable",IN_VIEWPORT:st});function ot(t){this.message=t}ot.prototype=new Error,ot.prototype.name="InvalidCharacterError";var lt="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new ot("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,n=0,s=0,a="";i=e.charAt(s++);~i&&(r=n%4?64*r+i:i,n++%4)?a+=String.fromCharCode(255&r>>(-2*n&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return a};var ut=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(lt(t).replace(/(.)/g,(function(t,e){var r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(e)}catch(t){return lt(e)}};function dt(t){this.message=t}dt.prototype=new Error,dt.prototype.name="InvalidTokenError";var ct=function(t,e){if("string"!=typeof t)throw new dt("Invalid token specified");var r=!0===(e=e||{}).header?0:1;try{return JSON.parse(ut(t.split(".")[r]))}catch(t){throw new dt("Invalid token specified: "+t.message)}};ct.InvalidTokenError=dt;const ht=new Map,ft=(t,e)=>new(((t,e)=>{const r=t.get(e);if(!r)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 n=window.customElements.get(r);return"function"!=typeof n?i:n})(t._customElements,e))(t),pt=(t,e,r)=>{window.customElements.get(e)||window.customElements.define(e,r),t.customElements.get(e)||t.customElements.set(e,e)};var gt,vt;!function(t){t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=4]="HIGH"}(gt||(gt={})),function(t){t[t.OFF=0]="OFF",t[t.ON=1]="ON",t[t.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(vt||(vt={}));function mt(t,e,r){const i="boolean"==typeof r;if("boolean"!=typeof r&&(r=t.paused),function(t,e,r){const i=t.poll(e?"beforeplay":"beforepause",{forced:r});return i&&i.defaultPrevented}(t,r,i))return;if(!r)return t.hasState(et)&&t.setState("is-live-seeked",!0),t.pause();if(0==t.reaper)return;const n=t.reaper.get("__pending_play");return 0!=t.paused||n?n?(n.src!==Et(t.original_src)&&yt(t),n):(function(t){return(0==t.networkState||0==t.readyState)&&t.currentSrc==Et(t.original_src)}(t)&&yt(t),(t=>t.autoplay&&vt.AUDIO_REQUIRED&t.autoplay)(e)?function(t){t.muted=!1,0==t.volume&&(t.volume=1);return t.play().catch(t=>{console.warn("[flowplayer/play] autoplay audio required\n%s",t.message)})}(t):(t.setState(Z,!1),t.play().catch(e=>(console.warn("[flowplayer/play] attempting muted autoplay\n%s",e.message),t.muted=!0,t.volume=0,t.play())))):void 0}function yt(t){t.currentSrc.match(/^blob:/)||t.load()}function Et(t){const e=document.createElement("a");return e.href=t,e.href}function Tt(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}function _t(t){const e=document.createElement("a");e.href=t;const r=e.pathname&&e.pathname.split(".");return r.length>1&&r[r.length-1]}function St(t){switch(t){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return t}}const bt=t=>{var{src:e}=t,r=Tt(t,["src"]);return[Object.assign({src:e,type:e?St("video/"+_t(e)):""},r)]};function At(t){return bt({src:t})}function Lt(t){var{src:e,type:r}=t,i=Tt(t,["src","type"]);return e&&r?[Object.assign({src:e,type:r},i)]:r&&!e?[Object.assign({type:r},i)]:bt(Object.assign({src:e},i))}var wt;function Rt(t,e,r,i={safari:!1}){const n=function(t){return"string"==typeof t?At(t):Array.isArray(t)||"object"!=typeof t?t.reduce((function(t,e){return"string"==typeof e&&(e=At(e)),"object"!=typeof e||Array.isArray(e)||(e=Lt(e)),t.concat(e)}),[]):Lt(t)}(r);return t.currentSrc&&(t.innerHTML="",t.setOpts({live:!1,dvr_window:void 0}),delete t.opts.live,delete t.opts.dvr),[J,Y,X,$,Q].forEach(e=>t.setState(e,!1)),e.autoplay||t.setState(Z,!0),Array(...Array(n.length)).map((t,e)=>e).some(r=>{const s=n[r];if(wt.Ok==function(t,e,r){t.emit(b,r),"string"==typeof r.src&&(t.original_src=r.src);const i=function(t,e,r){return t.plugins.filter(t=>{return(e=t)&&"wants"in e;var e}).find(t=>t.wants(r.src||"",r,e))}(t,e,r);return i?(i.onload(e,t.root,t,r),wt.Ok):wt.Err}(t,e,s)||wt.Ok==function(t,e,r,i={safari:!1}){var n;/^audio\//.test(r.type||"")&&t.emit("audioonlysource");e.start_time&&(r.src=r.src+"#t="+e.start_time);if(""==t.canPlayType(r.type||""))return wt.Err;if(r.drm&&(!r.drm["com.apple.fps.1_0"]||!i.safari))return wt.Err;"string"==typeof r.src&&(t.preload=e.autoplay?"auto":null!==(n=e.preload)&&void 0!==n?n:"auto",t.src=r.src,"none"!==t.preload&&t.setState($,!0));return wt.Ok}(t,e,s,i))return!0;r==n.length-1&&"string"==typeof s.src&&(t.src=s.src)}),function(t,e){!function(t,e){if(!t.currentSrc)return;if("none"==t.opt("preload"))return;if(e.autoplay&&e.autoplay>0)return;t.load()}(t,e)}(t,e),t}!function(t){t[t.Err=0]="Err",t[t.Ok=1]="Ok"}(wt||(wt={}));const Dt=[A,S,b,"seek:cancel"];var kt;function Ot(t,e,r){return isNaN(t.duration)||isNaN(t.currentTime)?{}:(e.offset+=r,0==e.offset?It(t,e):(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((function(){0!=t.reaper&&(t.currentTime=function(t,e,r=0){return Math.max(Math.min(e,t),r)}(t.currentTime+e.offset,t.duration),e.timer=0,It(t,e))}),1e3),function(t,e){t.setState("will-seek",!0),t.setState(kt.BACKWARD,e.offset<0),t.setState(kt.FORWARD,e.offset>0)}(t,e),t.emit("seek:queued",e),e))}function It(t,e){e.timer&&clearTimeout(e.timer),e.timer=e.offset=0,function(t){t.setState(kt.FORWARD,!1),t.setState(kt.BACKWARD,!1),t.setState("will-seek",!1)}(t)}function Ct(t,e){const r=t._customElements.get(e);return r&&t.root.querySelector(r)||void 0}function Pt(){if("undefined"==typeof document)return!1;const t=document.documentElement;return t&&"rtl"==t.getAttribute("dir")}function xt(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}function Mt(t,e,r){const i=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;i.length;){if(null==t)return r;const e=i.shift();if("string"!=typeof e)return r;t=t[e]}return null==t?r:t}function Ft(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}function Nt(t){if(isNaN(t)||t>=Number.MAX_SAFE_INTEGER)return"";const e=t<0?"-":"";t=Math.round(Math.abs(t));const r=Math.floor(t/3600);let i=Math.floor(t/60);return t-=60*i,r>=1?(i-=60*r,e+r+":"+Ft(i)+":"+Ft(t)):e+Ft(i)+":"+Ft(t)}!function(t){t.FORWARD="forward",t.BACKWARD="backward"}(kt||(kt={}));const Ut=navigator.languages||[navigator.language];function Bt(t,e,r){const i={};return r=e.lang||r,t[r]&&(i[r]=t[r]),function(){try{return Ut.reduce((t,e)=>~e.indexOf("-")?t.concat(e,e.split("-")[0]):t.concat(e),[])}catch(t){return[]}}().forEach((function(e){t[e]&&!i[e]&&(i[e]=t[e])})),Object.values(i)}const Gt=[1e7]+""+-1e3+-4e3+-8e3+-1e11,jt=()=>"undefined"==typeof crypto?"":Gt.replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16));let Ht="";!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){}}();const Kt=["touchstart","touchmove"];function Vt(t,e){const r=new CustomEvent(t,{detail:e,cancelable:!0});return e&&Object.defineProperty(r,"data",{get:()=>e}),r}function qt(t,e,r){const i=Vt(e,r);return t.dispatchEvent(i),t}function Wt(t,e,r){const i=Vt(e,r);return t.dispatchEvent(i),i}function zt(t,e,r,i){Array.isArray(e)?e.forEach(e=>Yt(t,e,r,i)):Yt(t,e,r,i)}function Yt(t,e,r,i){if(n=e,!~Kt.indexOf(n))return t.addEventListener(e,r,i),t;var n;const s=Object.assign(i||{},{passive:!0});return t.addEventListener(e,r,s),t}function Xt(t,e,r,i){return zt(t,e,r,Object.assign(i||{},{once:!0}))}class PlayerStorage{constructor(t,e){this.implementation=t,e&&e.keys().forEach(t=>{"string"==typeof e.implementation[t]&&this.implementation.setItem(t,e.implementation[t])})}keys(){var t;const e=[];for(var r=0;r<this.implementation.length;r++)(null===(t=this.implementation.key(r))||void 0===t?void 0:t.startsWith("flowplayer/"))&&e.push(this.implementation.key(r));return e}removeItem(t){try{this.implementation.removeItem("flowplayer/"+t)}catch(t){}}getItem(t){try{return this.implementation.getItem("flowplayer/"+t)}catch(t){return null}}setItem(t,e){try{this.implementation.setItem("flowplayer/"+t,e)}catch(t){}}clear(){try{this.keys().forEach(t=>this.implementation.removeItem(t))}catch(t){}}get length(){try{return this.keys().length}catch(t){return 0}}key(t){try{return this.implementation.key(t)}catch(t){return null}}}class InMemoryStorage{constructor(){this.pairs=[]}get length(){return this.pairs.length}clear(){this.pairs=[]}getItem(t){var e;return(null===(e=this.pairs.find(e=>e[0]===t))||void 0===e?void 0:e[1])||null}key(t){return this.pairs[t][0]||null}removeItem(t){this.pairs=this.pairs.filter(e=>e[0]!==t)}setItem(t,e){this.removeItem(t),this.pairs.push([t,e])}}const Qt={preload:"none",rtl:!1,controls:!0},$t=["loop","muted","preload"];function Zt(t,i,n){n._storage=new PlayerStorage(["localStorage","sessionStorage"].map(t=>{try{const e=window[t];return e.getItem(""),e}catch(e){return console.debug(`Access to window.${t} denied, trying next option`),null}}).find(t=>!!t)||new InMemoryStorage),n.toJSON=function(){return{duration:n.duration,volume:n.volume,currentTime:n.currentTime,states:n.root.className}},n.setSrc=function(e){return Rt(n,t,e,r())},n.playerState=n.playerState||{},n.setState=function(t,e){if(n.playerState[t]===!!e)return n;const r=Object.assign({},n.playerState,{[t]:e});return r[rt]&&(r[Y]=!1),n.playerState=r,qt(n,"state",n.playerState),n},n.createComponents=function(...t){return Array.from({length:t.length}).map((e,r)=>ft(this,t[r]))},n.hasState=function(t){return!!n.playerState[t]},n.transitionState=function(t,e,r){!n.hasState(t)&&n.hasState(e)||(r=0),r&&n.setState("is-toggling",!0),n.setState(e,!1),n.setState(t,!0),r&&setTimeout((function(){n.setState("is-toggling",!1)}),r)},n.emit=(t,e)=>(qt(n,t,e),n),n.on=(t,e)=>(zt(n,t,e),n),n.once=(t,e)=>(Xt(n,t,e),n),n.off=(t,e)=>{var r,i;return r=t,i=e,n.removeEventListener(r,i),n},n.poll=(t,e)=>Wt(n,t,e),n.togglePlay=function(e){return mt(n,t,e)},n.toggleMute=function(t){t=null==t?!n.muted:!!t,n.muted=t,n.muted||n.volume||(n.volume=1),qt(n,"volumechange")},n.toggleDisable=function(t){t=null==t?!n.disabled:!!t,n.setState("is-disabled",t),n.disabled=t},n.destroy=function(){n.pause();const t=e.indexOf(n);~t&&e.splice(t,1),setTimeout((function(){n.setSrc([]),n.reaper&&n.reaper.clear(),qt(n,A)}),0)},n.setAttrs=function(t){return $t.forEach(e=>{if(!(e in t))return;const r=t[e];r?n.setAttribute(e,r.toString()):n.removeAttribute(e)}),n},n.opt=function(e,r){return r=void 0===r?Mt(Qt,e):r,Mt(t,e,r)},n.i18n=function(t,e){if(!n.reaper)return"";const r=n.reaper.get("translations");return r?function t(e,r,i,n){return(n=n||0)>=e.length?i:Mt(e[n],r,t(e,r,i,n+1))}(r,t,e||""):e||""},n.setOpts=function(e){Object.assign(t,e),"disabled"in e&&void 0!==e.disabled&&n.toggleDisable(e.disabled),"muted"in e&&void 0!==e.muted&&n.toggleMute(e.muted);const r=!!t.autoplay&&!n.hasState("no-autoplay");n.setState("is-autoplay",r),n.setState("is-rtl",n.opt("rtl",function(t){if(!t)return Pt();const e=t.getAttribute("dir");return e?"rtl"==e:Pt()}(i))),n.setState(et,!!t.live),n.setState(it,!(!t.live||t.dvr)),n.setState("has-poster","string"==typeof t.poster&&t.poster.length>0),n.setState("is-seekable",!!t.seekable),i.style.backgroundImage=n.hasState("has-poster")?"url('"+t.poster+"')":"",qt(n,L,t)},n.renderPlugin=function(t){Wt(n,"renderplugin",t).defaultPrevented||n.root.appendChild(t)};const s={offset:0,timer:0};var a,o;o=s,(a=n).on(Dt,(function(){It(a,o)})),n.enqueueSeek=function(t){if(0!=n.opts.seekable&&!(1==n.opts.disabled&&t>0))return Ot(n,s,t)},n.deviceId=function(){return function(t){if(Ht)return Ht;try{const e=t.getItem("flowplayer/uuid");if(e)return e;const r=jt();return t.setItem("flowplayer/uuid",r),r}catch(t){return Ht=jt()}}(n._storage)}}function Jt(t,e){const r=e.querySelector("video"),i=r||(t._video_element_callback?t._video_element_callback(t):document.createElement("video"));return i.classList.add("fp-engine"),i.playsInline=!0,r||e.append(i),i}var te="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function ee(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const r=t.flowplayer;return"function"==typeof r?(r(e),e):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(e)||r.extensions.push(e),e)}function re(){return"undefined"!=typeof window?window:void 0!==te?te:{}}const ie=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function ne(t,e){return!!~ie.indexOf(t)||t.indexOf(e)===t.length-e.length}ne.check_whitelist=function(t){return!!~ie.indexOf(t)};const se="production";function ae(t,e){const r={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let i={c:"{}",exp:0};e=e||{};try{i=ct(t),r.valid_jwt=!0}catch(t){}return r.raw=t,r.data=JSON.parse(i.c),r.exp=i.exp,e.require_valid_token&&ae.validate(r),r}function oe(t){try{return ae.validate(t),{success:!0,message:""}}catch(t){return{success:!1,message:t.message}}}var le;function ue(t){return{grant:t,is_granted:e=>(t&e)===e}}function de({root:t,video:e,data:r}){e&&e.destroy(),console.error(new Error(r.details||r.reason)),t.innerHTML="",t.classList.remove("flowplayer"),t.classList.add("flowplayer-fatal"),t.style.removeProperty("background-image");const i=document.createElement("h2");i.textContent="Playback Error";const n=document.createElement("p");n.textContent="Are you the site owner?";const s=document.createElement("a");s.classList.add("troubleshoot"),s.target="_blank",s.href="https://docs.flowplayer.com/troubleshooting/player#"+r.reason,s.textContent="Troubleshoot?";const a=document.createElement("img");a.src="https://flowplayer.com/user/pages/images/logo-white.png",t.append(i,n,s,a)}function ce(t,e){const r=e.clientWidth;e.classList.toggle("is-small",r<600),e.classList.toggle("is-tiny",r<400)}function he(t,e,i){let n=!0;e.classList.add("flowplayer"),ce(0,e),zt(i,[g,"resize"],(function(){ce(0,e)})),zt(i,"state",(function(){Object.entries(i.playerState).forEach((function([t,r]){e.classList.toggle(t,r)}))})),zt(i,"timeupdate",(function(){i.setState(rt,i.readyState<3)})),zt(i,T,(function(e){setTimeout((function(){if(!e.defaultPrevented){if(t.rewind&&!i.loop){const e=i.src;t.autoplay&&(t.autoplay=0,i.setState("is-autoplay",!1)),i.setState(J,!0),Xt(i,_,(function(){e===i.src&&(i.setState(J,!1),i.pause(),i.setState(Z,!0))})),i.currentTime=0}Xt(i,"timeupdate",(function(){i.setState(tt,!1)})),i.transitionState(tt,Y,t.loop||t.rewind?0:300)}}),0)})),zt(i,[S,_],(function(t){i.setState(J,t.type==S),i.setState(X,i.paused),i.setState(Y,!i.paused)})),zt(i,T,(function(){i.setState(Y,!1),n=!0})),zt(i,r().ios?h:f,(function(){var t,e;i.setState(Q,!0),i.setState($,!1);const r=i;0===(null===(t=r.videoTracks)||void 0===t?void 0:t.length)&&(null===(e=r.audioTracks)||void 0===e?void 0:e.length)>0&&i.emit("audioonlysource")})),zt(i,[y,E,g],(function(e){if(!i.hasState(J)&&(e.type!=E||t.autoplay||i.setState(rt,!1),e.type!=g||"none"!=i.opt("preload")||t.autoplay)){if(e.type==g&&t.autoplay)return Xt(i,m,(function(){i.setState(rt,!1)}));e.type==y&&([Y,X,Z].forEach((function(t){i.setState(t,!1)})),i.hasState(Q)||i.setState($,!0)),i.setState(tt,!1),i.setState(rt,e.type==y)}})),zt(i,[m,v],(function(e){setTimeout(()=>{const t=new CustomEvent("flowplayer/"+e.type,{detail:i});document.dispatchEvent(t)},0);const r=e.type==m,s=i.currentTime==i.duration,a=r&&n&&t.autoplay||i.hasState(rt);if(r&&(i.started=!0,n=!1),i.setState(rt,!1).setState(Z,!1),s||i.hasState(J))return;const o=r?Y:X,l=r?X:Y;i.transitionState(o,l,a?0:300),r&&i.setState("no-autoplay",!1)}))}ae.validate=function(t){if("string"==typeof t&&(t=ae(t)),!t||!t.raw){if(ne.check_whitelist(window.location.hostname)||"dev"===se.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,r=ne.bind(null,e);if("dev"!==se.toString()&&t.data.domain&&t.data.domain.length&&!t.data.domain.some(r))throw new Error("Domain not allowed");if("dev"!==se.toString()&&1e3*t.exp-Date.now()<0)throw new Error("Expired token");return!0},ae.id=function(t){if(t)return"string"==typeof t&&(t=ae(t)),t.data.id},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"}(le||(le={})),ue.of=ue,ue.from_token=function(t){const e=ae(t,{require_valid_token:!0});return ue.of(e.data.acl)},ue.permissions=le;const fe=[0].concat(Array.from({length:100}).map((t,e)=>(e+1)/100));function pe(t,e,r){if(!window.IntersectionObserver)return;const i={should_resume:!!t.autoplay,has_user_gesture:!1,locked:!1};[u,n].forEach(t=>Xt(r,t,()=>i.has_user_gesture=!0)),zt(r,"play",(function(){i.locked||(i.should_resume=!0)})),zt(r,b,(function(){i.should_resume=!!t.autoplay})),zt(r,v,(function(){i.locked||(i.should_resume=!1)})),zt(r,E,(function(e){if(t.autoplay)return r.hasState(st)&&i.should_resume?r.togglePlay(!0):void(t.autopause||r.hasState(st)||!i.should_resume||Xt(r,"viewenter",()=>{t.autoplay&&i.should_resume&&r.togglePlay(!0)}))}));const s=new IntersectionObserver(t=>{t.forEach(t=>{setTimeout(()=>{const e=t.intersectionRatio,i=r.hasState(st);if(r.setState(st,e>=.2),r.emit("intersectionchange",{ratio:e}),i===r.hasState(st))return;const n=r.hasState(st)?"viewenter":"viewleave";r.emit(n)},0)})},{threshold:fe});s.observe(e),r.on(A,()=>s.disconnect()),t.autopause&&(zt(r,"viewenter",(function(){i.should_resume&&t.autopause&&r.togglePlay(!0)})),zt(r,"viewleave",(function(){if(!t.autopause)return;const e=!r.paused;i.locked=!0,r.pause(),setTimeout((function(){i.should_resume=e,i.locked=!1}),0)})))}function ge(t,e){if(!window.ResizeObserver)return;const r=new ResizeObserver(t=>{const r=t[t.length-1];e.emit("resize",r)});r.observe(t),e.on(A,()=>r.disconnect())}function ve(t){if("number"==typeof t&&!isNaN(t))return Number(t);if("string"==typeof t){const e=t.split(":");return Number(e[1])/Number(e[0])}return t}function me(t,e,r){const i=document.createElement("div");i.classList.add("fp-ratio"),e.append(i);let n=ve(t.ratio||.5625);i.style.paddingTop=100*n+"%";const s=[f,h];r.on(s,(function(){const t=r.videoHeight&&r.videoWidth&&r.videoHeight/r.videoWidth;t&&r.setOpts({ratio:t})})),r.on(L,(function(){const e=r.videoHeight&&r.videoWidth&&r.videoHeight/r.videoWidth,s=ve((null==t?void 0:t.ratio)||e||.5625);n!==s&&(n=s,i.style.paddingTop=100*s+"%")}))}class ExplorerPlan{constructor(){this.cleanUp=this.cleanUp.bind(this),this.render=this.render.bind(this),this.wireUp=this.wireUp.bind(this)}init(t,e,r){this.root=e,this.player=r,this.wireUp()}wireUp(){var t,e;this.cleanUp(),null===(t=this.player)||void 0===t||t.once(m,this.render),null===(e=this.player)||void 0===e||e.once(T,this.wireUp)}cleanUp(){var t,e,r,i;null===(e=null===(t=this._logo)||void 0===t?void 0:t.parentElement)||void 0===e||e.removeChild(this._logo),null===(r=this.player)||void 0===r||r.off(m,this.render),null===(i=this.player)||void 0===i||i.off(T,this.wireUp)}render(){var t,e,r;null===(e=null===(t=this._logo)||void 0===t?void 0:t.parentElement)||void 0===e||e.removeChild(this._logo);const i=(null===(r=this.root)||void 0===r?void 0:r.querySelector(".fp-ui"))||this.root;if(!i)return;const n=this._logo=document.createElement("a");n.href="https://explorer.flowplayer.com",n.target="_blank",Object.entries(ye).forEach(([t,e])=>{n.style.setProperty(t,e,"important")}),i.appendChild(n)}}const ye={display:"block",opacity:"1",visibility:"visible",width:"33%","padding-top":"9%",position:"absolute","z-index":"9999",bottom:"25%",left:"10%","background-size":"cover","background-image":"url(https://static.flowplayer.com/explorer/explorer.svg)"},Ee="flowplayer/"+m;function Te(t){const e=e=>{e.detail!==t&&!1===t.opt("multiplay")&&t.togglePlay(!1)};t.on(A,()=>document.removeEventListener(Ee,e)),document.addEventListener(Ee,e)}function _e(t,e){const r=[];t.addEventListener("contextmenu",i=>{const n=i.timeStamp;for(r.push(n);r.length>3;)r.shift();r.length>=3&&r.every(t=>t-n<3e3)&&(console.debug("flowplayer/debug rendering info"),function(t,e){var r;!function(t){const e=t.querySelector(".debug-info");null==e||e.remove()}(t);const i=document.createElement("div");i.classList.add("debug-info");const n=Se("flowplayer.version","3.2.6");i.append(n);const s=null===(r=null==e?void 0:e.hls)||void 0===r?void 0:r.constructor;if(s&&s.version){const t=Se("hls.version",s.version);i.append(t)}t.appendChild(i)}(t,e))})}const Se=(t,e)=>{const r=document.createElement("div");r.classList.add("row",t);const i=document.createElement("span");i.classList.add("attr"),i.textContent=t;const n=document.createElement("span");return n.textContent=e,n.classList.add("value"),r.append(i,n),r};const be=function(){const t=re(),e=t.flowplayer?t.flowplayer:{extensions:[]};return Array.isArray(e.extensions)||(e.extensions=[]),e}();function Ae(r,i){if("function"==typeof r)return t.push(...[...arguments].filter(t=>"function"==typeof t)),Ae;"string"==typeof i&&(i={src:i}),i||(i={}),i.token||"string"!=typeof window.__FLOWPLAYER_TOKEN||(i.token=window.__FLOWPLAYER_TOKEN);const n="string"==typeof r?document.querySelector(r):r;if(!n)return console.error(new Error("Flowplayer: '"+r.toString()+"' not found"));const s=n.querySelector("video.fp-engine");if(s)return s;const a=oe(i.token);if(!a.success)return de({root:n,data:{reason:"token",details:a.message}});const o=new Map,l=Jt(i,n);l.reaper=o,l._customElements=ht,Object.defineProperty(l,"token",{value:"string"==typeof i.token?ae.id(i.token):"",writable:!1}),l.addEventListener(A,()=>{o.clear(),l.reaper=0,delete l.root}),l.root=n,i.token&&ue.from_token(i.token).is_granted(ue.permissions.DEVELOPER_PLAN)&&t.push(ExplorerPlan),!~e.indexOf(l)&&e.push(l),Zt(i,n,l),l.setAttrs(i),l.plugins=Ae.extensions.map(t=>new t(Ae,l)),he(i,n,l),pe(i,n,l),ge(n,l),me(i,n,l),Te(l),_e(n,l),l.plugins.forEach(t=>{try{t.init(i,n,l)}catch(e){console.log("Error(plugin/%s)",t.constructor.name,e)}}),l.setOpts(i),l.opts=i,i.src&&l.setSrc(i.src);const u=l.readyState;return u>0&&l.currentSrc&&l.emit(h),u>2&&l.currentSrc&&l.emit(E),l.emit("mount"),l.on("error:fatal",(function(t){de({root:n,video:l,data:t.data||{}})})),l}Object.assign(Ae,be),function(i){Array.isArray(i.extensions)&&i.extensions.forEach(e=>t.push(e)),i.customElements=ht,i.defaultElements=z,i.version="3.2.6",i.commit="5a27b6794d5549b093e5031d144faffd489fa309",i.instances=e,i.extensions=t,i.support=r,i.events=D,i.states=at,i.jwt=ct,i.autoplay=vt,i.quality=gt}(Ae),"object"==typeof document&&setTimeout(qt,0,document,"flowplayer:umd",Ae);var Le="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function we(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Re(t){var e={exports:{}};return t(e,e.exports),e.exports}var De=Re((function(t,e){var r=Le&&Le.__assign||function(){return(r=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};e.__esModule=!0,e.remove=e.downcase=e.pluck=e.merge=void 0,e.merge=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce((function(t,e){return r(r({},t),e)}),{})},e.pluck=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return Object.keys(t).filter((function(t){return~r.indexOf(t)})).reduce((function(r,i){var n;return e.merge(r,((n={})[i]=t[i],n))}),{})},e.downcase=function(t){return(t||"").toString().toLowerCase()},e.remove=function(t,e){var r=t.lastIndexOf(e);return~r&&t.splice(r,1),t}})),ke=Re((function(t,e){var r=Le&&Le.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),i=Le&&Le.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=Le&&Le.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};e.__esModule=!0;var s=n(De),a=function(){function t(){this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return t.of=function(){return new t},t.is_empty=function(t){return 0==t.pending.length},t.is_high_water=function(e){return e.open.length==t.MAX_OPEN_REQUESTS},t.maybe_spawn_req=function(e){if(t.is_empty(e))return e;if(t.is_high_water(e))return e;try{var r=t.lpop(e);r&&t.request(e,r)}catch(t){}},t.increment_failures=function(e){return e.stats.failures++,e.stats.failures>t.MAX_FAILURE_COUNT&&(e.stats.ttl=Date.now()+t.REQUEST_TTL_MS),e},t.handle_error=function(e,r){t.rm(e,r),t.increment_failures(e)},t.request=function(e,r){var i=r[0],n=r[1],s=r[2];if(!(Date.now()<e.stats.ttl)){var a=new XMLHttpRequest;e.open.push(a),a.timeout=t.REQUEST_TIMEOUT_MS,a.ontimeout=function(){t.handle_error(e,a)},a.onerror=function(r){t.handle_error(e,a)},a.onreadystatechange=function(){a.readyState==XMLHttpRequest.DONE&&t.rm(e,a),Math.floor(a.status/100)},a.onload=function(){t.rm(e,a),e.stats.failures&&e.stats.failures--},a.open(n,i),a.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{a.send(JSON.stringify(s))}catch(t){}}},t.rpush=function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return r.forEach((function(r){e.pending.length>=t.MAX_PENDING||(e.pending.push(r),t.maybe_spawn_req(e))})),e},t.lpop=function(t){return t.pending.shift()},t.rm=function(t,e){return s.remove(t.open,e),t},t.MAX_OPEN_REQUESTS=3,t.MAX_PENDING=5,t.REQUEST_TIMEOUT_MS=4e3,t.REQUEST_TTL_MS=5e3,t.MAX_FAILURE_COUNT=3,t}();e.default=a})),Oe=Re((function(t,e){var r=Le&&Le.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0;var i=r(ke);e.default=i.default.of()})),Ie=Re((function(t,e){e.__esModule=!0,e.prepare_url=e.URL_PARAM=void 0,e.URL_PARAM=/:([a-zA-Z_]+)/g,e.prepare_url=function(t,r){return t.url.replace(e.URL_PARAM,(function(e){if((e=e.slice(1,e.length))in r)return r[e].toString();t.log.error(new Error("\n preparing url["+t.url+"] failed\n \n parameter["+e+"] not detected in params:\n \n "+JSON.stringify(r,null,2)+"\n "))}))}})),Ce=Re((function(t,e){e.__esModule=!0,e.Log=void 0;var r=function(){function t(t){this.emitter=t}return t.prepare=function(t,e){var r=document.createEvent("Event");return r.initEvent(t,!1,!0),r.ns=t,r.data=e,r},t.of=function(e){return new t(e)},t.prototype.info=function(e){this.emitter.dispatchEvent(t.prepare(t.NAMESPACE.INFO,e))},t.prototype.error=function(e){this.emitter.dispatchEvent(t.prepare(t.NAMESPACE.ERROR,e))},t.prototype.warn=function(e){this.emitter.dispatchEvent(t.prepare(t.NAMESPACE.WARN,e))},t.NAMESPACE={INFO:"tracker:info",ERROR:"tracker:err",WARN:"tracker:warn"},t}();e.Log=r})),Pe=Re((function(t,e){var r;e.__esModule=!0,e.Verb=void 0,(r=e.Verb||(e.Verb={})).POST="POST",r.PUT="PUT",r.GET="GET"})),xe=Re((function(t,e){var r=Le&&Le.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),i=Le&&Le.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=Le&&Le.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},s=Le&&Le.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var i=Array(t),n=0;for(e=0;e<r;e++)for(var s=arguments[e],a=0,o=s.length;a<o;a++,n++)i[n]=s[a];return i},a=Le&&Le.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0;var o=a(Oe),l=a(ke),u=n(Ie),d=n(De),c=function(){function t(e,r){var i=this;void 0===r&&(r={});var n=this;if(this.emitter=e,this.url=r.url,this.log=Ce.Log.of(this.emitter),this.verb=r.verb,this.metadata=d.merge({},r.metadata||{}),this.rq=r.rq||o.default,this.events=r.events||[],this.required_keys=r.required_keys||[],this.optional_keys=r.optional_keys||[],this.listeners=[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),t.assert_emitter_api(this.emitter),void 0===t.verb[this.verb])throw new Error("invalid HTTP verb["+this.verb+"] passed");if("string"!=typeof this.url)throw new Error("invalid API url["+this.url+"] passed");t.TRACKERS.push(this),n.events.forEach((function(e){t.create_listener(i,e,(function(r){void 0===r&&(r={});var s=d.merge(n.metadata,{event_type:e},r.data||r),a=u.prepare_url(n,s),o=t.pluck_valid_keys(n,s),c=t.ensure_required_keys(n,o);if(c.length)return n.log.error("Tracker.validate_metadata() failed for \n Event["+e+"]\n missing keys: "+c+"\n payload:\n "+JSON.stringify(o,null,2));l.default.rpush(i.rq,[a,i.verb,o])}))}))}return t.of=function(e,r){return new t(e,r)},t.ensure_required_keys=function(t,e){return t.required_keys.filter((function(t){return!(t in e)}))},t.pluck_valid_keys=function(t,e){return d.pluck.apply(d,s([e],t.valid_keys))},t.merge_metadata=function(e,r){return void 0===r&&(r={}),e.metadata=t.pluck_valid_keys(e,d.merge(e.metadata,r)),e},t.assert_emitter_api=function(t){if("function"!=typeof(t||{}).addEventListener)throw new Error("Tracker() received an emitter that does not implement the addEventListener method");if("function"!=typeof(t||{}).removeEventListener)throw new Error("Tracker() received an emitter that does not implement the removeEventListener method")},t.create_listener=function(t,e,r){t.listeners.push([e,r]),t.emitter.addEventListener(e,r)},t.prototype.destroy=function(){var e=this;this.listeners.forEach((function(t){var r=t[0],i=t[1];return e.emitter.removeEventListener(r,i)})),delete this.rq,delete this.emitter,d.remove(t.TRACKERS,this)},t.prototype.put=function(e){return void 0===e&&(e={}),t.merge_metadata(this,e),this},t.TRACKERS=[],t.QUEUE=o.default,t.verb=Pe.Verb,t}();e.default=c})),Me=Re((function(t,e){var r=Le&&Le.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),i=Le&&Le.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=Le&&Le.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},s=Le&&Le.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0,e.API=e.Tracker=void 0;var a=s(xe);e.Tracker=a.default;var o=n(Ie);e.API=o})),Fe="ping",Ne="display",Ue="view";const Be=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],Ge=["created","position"],je=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];function He(t,e){return t.duration/1===t.duration&&Object.assign(e,function(t){const e=t/100;return{segment_duration:e,breakpoints:Array(...Array(100)).map((function(t,r){return Math.floor(r*e*1e3)/1e3}))}}(t.duration))}function Ke(t,e,r){if(!e.segment_duration&&!He(t,e))return;const i=function(t,e,r){const i=e.last_idx,n=r?99:Ve(t,e);return e.last_idx=n,n<=i?[]:e.breakpoints.slice(i,99==n?100:n).map((function(t){return e.breakpoints.indexOf(t)}))}(t,e,r);0!=i.length&&t.emit(Fe,{position:i})}function Ve(t,e){return Math.min(Math.floor(t.currentTime/e.segment_duration),99)}const qe="vod",We="live",ze=[Ne,Fe,Ue];function Ye(t,e,r){switch(null==e?void 0:e.kind){case"live":return function(t,e){const r=Date.now();r-e.last_tracked_ts<6e4||(e.last_tracked_ts=r,++e.ticks,t.emit(Fe,{position:60*e.ticks}))}(t,e);case"vod":return Ke(t,e,"boolean"==typeof r&&r)}}function Xe(t){const e=t.ads;return void 0!==e&&(void 0!==e.schedule&&("function"==typeof e.hasPreroll&&(e.currentRequests?e.currentRequests:!!e.adPlaying||!(!e.hasPreroll()||0!=e.nextIndex))))}function Qe(){try{return window.location!==window.parent.location?document.referrer:document.location.href}catch(t){return!1}}class Analytics$1{init(t,e,r){if(!ue.from_token(t.token||"").is_granted(ue.permissions.ANALYTICS))return;if(r.hasState("consent-no-tracking"))return;if(r.analytics)return;const i=r.analytics={ticker:void 0,last_media_id:"",ended:!1},n={locked:!1,ttl:6e3,task:()=>{Ye(r,i.ticker)}};const s={session_id:r.deviceId(),autoplay:r.autoplay,muted:r.muted,player_id:t.player_id,customer_user_id:t.customer_user_id,player_version:"3.2.6"},a=Me.Tracker.of(r,{verb:Me.Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:ze,required_keys:Be,optional_keys:je.concat(Ge).slice(0),metadata:s});r.on(A,(function(){a&&a.destroy()})),r.on(L,(function(e){if(!a)return;const n=Mt(e,"data.metadata",{});if(!n.media_id)return;const s=Mt(a,"metadata.media_id");if(s&&n.media_id==s)return;const o=Mt(t,"analytics",{});a.put(n),a.put(o);const l=Mt(t,"metadata.live_start_time",t.live)?We:qe;a.put({video_type:l,source:t.source||Qe()||""}),i.ticker=t.live?{ticks:0,last_tracked_ts:Date.now(),kind:"live"}:{last_idx:0,segment_duration:0,breakpoints:[],kind:"vod"},i.ended=!1,r.emit(Ne)}));let o=0;r.on(m,(function(){if(!a)return;if(o||function(t,e){return t.metadata.media_id&&t.metadata.media_id==e.last_media_id}(a,i))return;a.put({muted:r.muted});const t=Xe(r);if(t)return o=Promise.resolve(t).then((function(){i.last_media_id=a.metadata.media_id,r.emit(Ue),o=0})).catch((function(){o=0}));i.last_media_id=a.metadata.media_id,r.emit(Ue)})),r.on("timeupdate",(function(){var e;a&&(o||Xe(r)||i.ended||(!t.live&&r.currentTime+.25>=r.duration&&Ye(r,i.ticker,!0),(e=n).locked||(e.locked=setTimeout((function(){return e.task(),function(t){return t.locked=!1,t}(e)}),e.ttl))))})),r.on(_,(function(){a&&i.ticker&&"vod"==i.ticker.kind&&function(t,e){He(t,e),e.last_idx=Ve(t,e)}(r,i.ticker)})),r.on(T,(function(){a&&function(t,e){e.ended||(e.ended=!0,Ye(t,e.ticker))}(r,i)}))}}var $e;function Ze(t){switch(t){case $e.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case $e.MEDIA_ERR_NETWORK:return"a network error occurred";case $e.MEDIA_ERR_DECODE:return"unable to decode media content";case $e.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case $e.NO_INTERNET:return"no internet connection detected";case $e.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}function Je(){}function tr(){return"https:"===location.protocol}function er(t){const e=document.createElement("a");return e.href=t,e}function rr(t){try{return!!new URL(t)}catch(t){return!1}}ee(re(),Analytics$1),"undefined"!=typeof window&&window.matchMedia&&[w,R].forEach((function(t){window.matchMedia("(orientation: "+t+")").addListener((function(r){e.length&&e.forEach((function(e){r.matches&&e.emit(t)}))}))})),function(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",t[t.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",t[t.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",t[t.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",t[t.MIXED_CONTENT=1001]="MIXED_CONTENT",t[t.NO_INTERNET=1002]="NO_INTERNET"}($e||($e={}));const ir=()=>!0===(navigator||{}).onLine;function nr(t,e,r){r.on(i,(function(t){const e=t.data||r.error||new Error,i=t.code||e.code,n="Error: %s\n"+(null===(s=(new Error).stack)||void 0===s?void 0:s.split("\n").slice(2).join("\n"));var s;setTimeout((function(){if(t.defaultPrevented)return;if("AbortError"==e.name)return;r.setState("is-error",!0),8===i||e.fatal||function(t){const e=t.togglePlay,r=t.root;t.togglePlay=Je,t.once("recover",(function(){t.togglePlay=e,t.setState("is-error",!1);const i=r.querySelector(".fp-error");i&&i.remove()}))}(r);const s=function(t,e,r){switch(e){case"http:0":return function(t){return function(t){try{return tr()&&"http:"==er(t).protocol}catch(t){return!1}}(t.original_src)?{code:$e.MIXED_CONTENT}:ir()?{code:$e.MEDIA_ERR_NETWORK}:ir()?{code:$e.UNKNOWN}:{code:$e.NO_INTERNET}}(t);case $e.MEDIA_ERR_SRC_NOT_SUPPORTED:return t.once(g,(function(){t.emit("recover")})),r;default:return r}}(r,i,e),a=function(t,e){if(e.message)return e.message;if(e.stack)return e.stack;const r=e.code||-1,i=Ze(r);return t.i18n("media_errors."+r,i)}(r,s);console.error(n,a);const o=r.reaper&&r.reaper.get("ui");return o&&function(t,e,r,i){if(!t)return;const n=document.createElement("div");if(n.classList.add("fp-error"),n.innerText=e,i){const e=t.querySelector("#"+i);e&&t.removeChild(e),n.id=i}if(t.append(n),r){const t=document.createElement("div");t.classList.add("fp-error-details"),t.innerText=r,n.append(t)}}(o,a,e.details)}))}))}var sr=Object.freeze({__proto__:null,NO_FULLSCREEN:1,NO_VOLUME_CONTROL:2,NO_MUTE:4,LOGO_ON_RIGHT:8,USE_DRAG_HANDLE:16,USE_PLAY_2:32,USE_PLAY_3:64,USE_THIN_CONTROLBAR:128,NO_TITLE:256,NO_DESCRIPTION:512,NO_CONTROLS:1024,NO_DURATION:2048,NO_HEADER:4096,AUDIO_ONLY:8192,NO_TOUCH_ZONES:16384});function ar(t,e,r){let i=()=>document.fullscreenElement,n="fullscreenchange";if(!Element.prototype.requestFullscreen){const t=Element.prototype,e=document;t.webkitRequestFullScreen&&(t.requestFullscreen=t.webkitRequestFullScreen,e.fullscreenEnabled=!0),e.webkitCancelFullScreen&&(document.exitFullscreen=e.webkitCancelFullScreen),n="webkit"+n,i=()=>e.webkitCurrentFullScreenElement}const a=()=>r.getFullsceenTarget?r.getFullsceenTarget():e;r.toggleFullScreen=function(t,e){if(r.ios_fullscreen_disabled)return;if("boolean"!=typeof t&&(t=!r.hasState("is-fullscreen")),or(r)&&(t?function(t){t.getAttribute("playsinline")&&t.removeAttribute("playsinline");t.getAttribute("webkit-playsinline")&&t.removeAttribute("webkit-playsinline");t.webkitEnterFullScreen()}(r):function(t,e){t.getAttribute("playsinline")||t.setAttribute("playsinline","");t.getAttribute("webkit-playsinline")||t.setAttribute("webkit-playsinline","");e||t.webkitExitFullScreen();t.togglePlay(!1),t.hasState(nt)||t.setState(nt,!0)}(r,e)),!document.fullscreenEnabled)return;const i=a();t?i.requestFullscreen():document.exitFullscreen()},or(r)&&(r.ios_fullscreen_disabled=!0,r.once("beforeplay",(function(){r.ios_fullscreen_disabled=!1})),r.on("webkitendfullscreen",(function(){r.toggleFullScreen(!1,!0)}))),setTimeout(()=>{const t=a();t.addEventListener(n,(function(){const e=i(),n=e===t||e==r;r.emit(n?d:c),r.setState("is-fullscreen",n)}))},0),!1!==t.doubleclick&&e.addEventListener(s,(function(t){var e;t.target&&(null===(e=t.target)||void 0===e?void 0:e.classList.contains("fp-ui"))&&r.toggleFullScreen()}))}function or(t){return r().ios&&"function"==typeof t.webkitEnterFullScreen&&"function"==typeof t.webkitExitFullScreen}function lr(t,e){if("object"!=typeof t.opts)return{head:0,tail:0};if(0==t.seekable.length)return{head:0,tail:0};const r=e||t.opts.dvr_window,i=t.seekable.end(t.seekable.length-1);return{head:i,tail:r?i-r:t.seekable.start(0)}}function ur(t){return t.opt("live",!1)||t.duration>=Number.MAX_SAFE_INTEGER}function dr(t){return isFinite(t.duration)?t.duration:0==t.seekable.length?0:lr(t).head}function cr(t){return fr(t)-.5}function hr(t){return lr(t).tail}function fr(t){return lr(t).head}function pr(t){return Math.min(100,Math.max(0,(t.currentTime-hr(t))/(fr(t)-hr(t))*100))}function gr(t,e,r){if(!r.reaper)return;const i=document.createDocumentFragment(),n=ft(r,k);i.appendChild(n),r.reaper.set("ui",n),~e.className.indexOf("use-play-")||e.classList.add("use-play-1"),function(t,e,r){const i=xt("fp-footer");e.append(i),r.on(L,(function(t){var e,r;const n=null===(e=t.data)||void 0===e?void 0:e.description,s=null===(r=t.data)||void 0===r?void 0:r.title;if(i.innerHTML="","string"==typeof s){const t=xt("fp-title");t.innerText=s,i.append(t)}if("string"==typeof n){const t=n.split(" "),e=xt("fp-desc");for(e.innerText=t.join(" "),i.append(e);t.length>1&&e.scrollHeight>e.offsetHeight;)t.pop(),e.innerText=t.join(" ")+"..."}}))}(0,e,r),nr(0,0,r),e.appendChild(i),[o,l].forEach(t=>{e.addEventListener(t,(function(t){r.setState("is-hovered",t.type==o),r.setState("is-accessibility",!1)}))}),ar(t,e,r),r.on("volumechange",(function(){const t=0==r.volume||r.muted;r.setState("is-muted",t),r._storage.setItem("mute",t.toString())})),"true"==r._storage.getItem("mute")&&(r.muted=!0,r.setState("is-muted",r.muted));const s=r._storage.getItem("volume");s&&!isNaN(Number(s))&&(r.volume=Number(s)),r.emit("volumechange"),r.on("dvr/window",e=>{var i;t.live&&(!("dvr"in(i=t))||1==i.dvr)&&function(t,e,r){if(0==e)return!0;const i=lr(t,r);return i.head-i.tail>=e}(r,t.seconds_to_dvr||60,e.detail)&&(r.setOpts({dvr:r.seekable.length>0}),r.seekable.length>0&&r.setOpts({dvr_window:e.detail}))}),r.on("live",(function(){r.setState("is-live-seeked",!1)})),r.on("seeking",(function(){if(!ur(r))return;if(0==r.seekable.length)return;if(0==dr(r))return;const t=cr(r),e=r.currentTime>=t?"live":"dvr";if("live"===e)return r.emit(e);const i=dr(r),n=lr(r),s=(i-r.currentTime)/(n.head-n.tail)*100,a=Math.round(s);r.setState("is-live-seeked",a>0),r.emit(e,{offset:a})})),r.on(h,(function(){r.setOpts({live:ur(r)})})),r.on("durationchange",(function(t){const e=ur(r),i=e?dr(r):t.data||r.duration;isNaN(i)||r.setOpts({live:e,duration:i})})),r.on(L,(function(r){var i,n;t.seekable=void 0===(null===(i=null==r?void 0:r.data)||void 0===i?void 0:i.seekable)||r.data.seekable;const s=null===(n=r.data)||void 0===n?void 0:n.ui;if("number"!=typeof s)return;const a=e.classList;a.toggle("use-play-1",!(32&s||64&s)),a.toggle("use-play-2",(32&s)>0),a.toggle("use-play-3",(64&s)>0),a.toggle("use-thin-controlbar",(128&s)>0),a.toggle("no-title",(256&s)>0),a.toggle("no-description",(512&s)>0),a.toggle("logo-on-right",(8&s)>0),a.toggle("use-drag-handle",(16&s)>0),a.toggle("no-controls",(1024&s)>0),a.toggle("no-duration",(2048&s)>0),a.toggle("no-header",(4096&s)>0),a.toggle("no-mute",(4&s)>0),a.toggle("no-volume",(2&s)>0),a.toggle("no-fullscreen",(1&s)>0),a.toggle("no-touch-zones",(16384&s)>0)}));let a=null;n.addEventListener("mousemove",(function(){"number"==typeof a&&clearTimeout(a),r.setState("is-hovered",!0),a=0==r.paused&&setTimeout((function(){r.setState("is-hovered",!1)}),2e3)}))}function vr(t,e,r){if(ue.from_token(t.token||"").is_granted(ue.permissions.NO_METERING))return;const i=ae.id(t.token||"");i&&r.once(m,()=>function(t,e){fetch("https://pmi.flowplayer.com/in",{method:"POST",body:JSON.stringify({token_id:e,factor:1,rnd:Math.random().toString(36).substring(2)})}).then(e=>{401==e.status&&t.emit("error:fatal",{reason:"token",details:"The token online validation failed"})})}(r,i))}var mr={ads:{ad:"Ad",ads:"Ads",advertisement:"Advertisement"},audio:{button_txt:"Audio",menu_title:"Audio"},core:{exit_fullscreen:"Exit fullscreen",fullscreen:"Fullscreen",mute:"Mute",pause:"Pause",play:"Play",unmute:"Unmute",volume:"Volume"},ovp:{starting_in:"Countdown"},playlist:{cancel:"Cancel",up_next:"Up next"},qsel:{menu_title:"Quality"},share:{clipboard_failure:"Access to clipboard failed",clipboard_success:"The text is now on your clipboard",embed:"Embed",link:"Link",menu_title:"Share"},speed:{menu_title:"Speed"}};class I18n{init(t,e,r){r.reaper&&r.reaper.set("translations",Bt(I18n,t,"en"))}}I18n.en=mr;const yr="health:record",Er="rebuffer";var Tr=Object.freeze({__proto__:null,RECORD:yr,REBUFFER:Er});function _r(t,e){const r=function(){try{return localStorage.getItem("flowplayer/debug")}catch(t){return""}}(),i=(i,...n)=>{const s=(null==e?void 0:e.debug)||r;s&&t.match(s)&&console.log(`${t} -- ${i}`,...n)};return i.log=i,i}const Sr=navigator;function br(t){var e,r;const i=null===(e=t.hls)||void 0===e?void 0:e.bandwidthEstimate;return i?1e-6*i:(null===(r=Sr.connection)||void 0===r?void 0:r.downlink)||-1}function Ar(t,e){return function(t,e){return"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(t,e)}(t,JSON.stringify({events:e}))}const Lr="https://ljsp.lwcdn.com".concat("/web/public/countdown/time.json"),wr=window,Rr=wr._flowplayerTimekeeper||(wr._flowplayerTimekeeper={});async function Dr(){const t=Rr.cachedServerOffset;if(t)return t;const e=Rr.pendingRequest||(Rr.pendingRequest=fetch(Lr)),r=await e,i=parseInt(r.headers.get("age")||"0"),n=await r.json(),s=Date.now()-n.millisUtc-1e3*i;return Rr.cachedServerOffset=s,Rr.cachedServerOffset}const kr=t=>{switch(t){case!0:return vt.ON;case!1:return vt.OFF;default:return t}},Or=[];function Ir(t){if(t.suspended)return;const e=Or.slice(0);Or.length=0,0!=e.length&&(t.logger.log(`:dispatch events={${e.length}}`),Ar("https://ihi.flowplayer.com/v1/health/events",e))}async function Cr(t,e,r){const i=await xr();Or.push(Object.assign(e,i)),t.logger.log(":enqueue",e.event,e),Or.length<10&&!r||Ir(t)}const Pr=()=>{var t,e;try{const r=window;return null===(e=null===(t=null==r?void 0:r.google)||void 0===t?void 0:t.ima)||void 0===e?void 0:e.VERSION}catch(t){return}},xr=async()=>{try{const t=await Dr();return{timestamp:Date.now()-t,adjusted_timestamp:!0}}catch(t){return{timestamp:Date.now(),adjusted_timestamp:!1}}},Mr=(t,e)=>Object.assign(t,{detail:e}),Fr=(t,{event:e,media_session_id:r,session_id:i})=>({event:e,media_session_id:r,session_id:i,device_id:t.deviceId(),version:"3.2.6",commit:"5a27b6794d5549b093e5031d144faffd489fa309",ima_sdk_version:Pr(),preload:t.opt("preload"),autoplay:kr(t.opt("autoplay")),live:t.opt("live"),dvr:t.opt("dvr"),source:t.original_src,downlink_mbs:br(t),player_id:t.opt("metadata.player_id"),media_id:t.opt("metadata.media_id"),site_id:t.opt("metadata.site_id"),category_id:t.opt("metadata.category_id"),sitegroup_id:t.opt("metadata.sitegroup_id"),token:t.token,plugins:t.plugins.map(t=>t.constructor.name).sort((t,e)=>t.localeCompare(e)),current_time:t.currentTime,external_media_id:t.opt("external_media_id")}),Nr=t=>({bitrate:null==t?void 0:t.bitrate,resolution:null==t?void 0:t.attrs.RESOLUTION,frame_rate:null==t?void 0:t.attrs["FRAME-RATE"]});function Ur(t,e,r,i){const n=Fr(e,t.eventInfo(r)),{before:s,after:a}=i;Cr(t,((t,e,r)=>Object.assign(t,{state:{before:e,after:r}}))(n,Nr(s),Nr(a)))}const Br=(t,e)=>{let r=null;return(...i)=>{null!==r&&(clearTimeout(r),r=null),r=setTimeout(()=>e(...i),t)}},Gr=jt();class Health{constructor(t,e){this.session_id=Gr,this.suspended=!1,this.logger=_r("health",e.opts),this.media_session_id=jt(),this.analyticsLoop=setInterval(()=>Ir(this),2e3),e.on(A,()=>clearInterval(this.analyticsLoop));const r=this;if(e.health={get media_session_id(){return r.media_session_id},set media_session_id(t){r.media_session_id=t},get session_id(){return r.session_id},set session_id(t){r.session_id=t},toggle(t){t?r.resume():r.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const e=e=>t.instances.forEach(t=>t.emit(e.type));document.addEventListener("visibilitychange",t=>{"hidden"==document.visibilityState&&e(t)}),window.addEventListener("pagehide",e)}}eventInfo(t){return{event:t,media_session_id:this.media_session_id,session_id:this.session_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>Ir(this),2e3)}init(t,e,r){!function(t){t.on(y,(function(e){t.seeking||t.networkState===t.NETWORK_LOADING&&t.readyState!==t.HAVE_NOTHING&&t.emit(Er)}))}(r),r.on(yr,({detail:t})=>{const e=Fr(r,this.eventInfo(t.event));Object.assign(e,t.detail||{}),Cr(this,e)}),[E,g,a,h,f,p,y,Er].forEach(t=>{r.on(t,t=>{Cr(this,Fr(r,this.eventInfo(t.type)))})}),[m,v,S,_,T,d,c].forEach(t=>{r.on(t,t=>{Cr(this,Fr(r,this.eventInfo(t.type)))})}),r.on("volumechange",Br(800,t=>{const e=Fr(r,this.eventInfo(t.type));Cr(this,Mr(e,{volume:parseFloat(r.volume.toFixed(2)),muted:r.muted}))})),r.on("resize",Br(800,t=>{const i=Fr(r,this.eventInfo(t.type));Cr(this,Mr(i,{height:e.clientHeight,width:e.clientWidth}))})),r.on("qualitychange",({type:t,detail:e})=>{switch(e.kind){case"hls":return Ur(this,r,t,e)}});let n=Date.now()+5e3;r.on("timeupdate",t=>{if(Date.now()<n)return;n=Date.now()+5e3;const e=Fr(r,this.eventInfo(t.type));var i;Cr(this,Mr(e,{duration:(i=r.duration,Number.isFinite(i)?i:i===1/0?-1:void 0)}))}),r.addEventListener(i,t=>{const e=Fr(r,this.eventInfo(t.type)),i=t.error||r.error;if(!i)return Cr(this,e,!0);const n=i.code,s={error_message:i.message||Ze(n),error_code:n,error_stack:i.stack||""};return Cr(this,Mr(e,s),!0)}),r.on(b,t=>{var e;const i=null===(e=t.detail)||void 0===e?void 0:e.src;if("string"!=typeof i)return;if(!rr(r.original_src))return;if(!rr(i))return;if(i==r.original_src)return;this.media_session_id=jt();Cr(this,Fr(r,this.eventInfo(t.type))),Ir(this)}),r.on("visibilitychange",t=>{Cr(this,Fr(r,this.eventInfo(t.type))),Ir(this)})}}Health.events=Tr,Health._UNLOAD_SUBSCRIBED=!1,ee(window,Health);class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}class FlowplayerPrimary extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-primary");const e={logo:""};t.on(L,t=>{var r,i;const n=e.logo,s=(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.logo)||"";n!=s&&(e.logo=s,this.set_logo(s,null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.logo_href))})}set_logo(t,e){if(this.innerHTML="",!t)return;const r=document.createElement("img");if(r.classList.add("fp-logo"),r.src=t,!e)return this.append(r);const i=document.createElement("a");i.href=e,i.append(r),this.append(i)}}class FlowplayerHeaderDuration extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-duration"),t.on(L,t=>{var e;const r=(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.duration)||NaN;this.innerText=isFinite(r)?Nt(r):""})}}const jr={name:"fp-fullscreen",translation_key:"core.fullscreen"},Hr={name:"fp-fullscreen-exit",translation_key:"core.exit_fullscreen"},Kr={name:"fp-play",translation_key:"core.play"},Vr={name:"fp-pause",translation_key:"core.pause"},qr={translation_key:"core.mute",name:"fp-volume-mute-unmute"},Wr={translation_key:"core.play",name:"fp-small-play"},zr={translation_key:"core.pause",name:"fp-small-pause"},Yr={name:"fp-fast-forward"},Xr={name:"fp-rewind"};class FlowplayerIcon extends FlowplayerComponent{constructor(t,e){super(t),this.classList.add("fp-icon",e.name),e.title&&this.setAttribute("title",e.title),e.title&&this.setAttribute("aria-label",e.title),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}document.addEventListener(n,(function(t){this.active_menu&&!t.composedPath().includes(this.active_menu)&&(Array.from(document.querySelectorAll(".fp-engine")).forEach(t=>{const e=t.root.querySelector("details[open].fp-menu-container");e&&(e.open=!1,t.root.classList.toggle("has-menu-opened",!1))}),this.active_menu=void 0)}));const Qr={passive:!0};var $r;function Zr(t,e){let r=0,i=-1,n=-1;const s=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5),a=t.classList;t.id=s,a.remove($r.GRABBING),a.remove($r.TOUCHING);const o=e.onseek||Je,l=e.onstart||Je,d=e.onend||Je,c=e.onmouse||Je,h=e.ontouch||Je,f=e.ontouchend||Je;function p(e){!function(){const e=t.getBoundingClientRect();r=e.left,i=e.width}();let n=(function(t){return"function"==typeof window.TouchEvent&&t instanceof TouchEvent}(e)?e.changedTouches[0].pageX:e.pageX)-r;return n>i&&(n=i),n<0&&(n=0),n/i*100}function g(e){const r=p(e);r!=n&&(o(t,r),n=r)}return t.addEventListener("touchstart",(function(e){Jr(t,e)&&(a.add($r.TOUCHING),ti(t.parentElement)&&(a.add($r.GRABBING),h(t,p(e)),l(t,p(e)),g(e)))}),Qr),t.addEventListener("touchmove",(function(e){g(e),c(t,p(e))}),Qr),t.addEventListener(u,(function(e){setTimeout((function(){a.remove($r.TOUCHING)}),500),Jr(t,e)&&(a.remove($r.GRABBING),f(t,p(e)),d(t,p(e)),i=0)}),Qr),t.addEventListener("touchcancel",(function(){a.remove($r.GRABBING,$r.TOUCHING),i=0}),Qr),t.addEventListener("mousedown",(function(e){a.contains($r.TOUCHING)||(document.addEventListener("mousemove",g),a.add($r.GRABBING),l(t,p(e)),e.preventDefault(),g(e))})),t.addEventListener("mousemove",(function(e){a.contains($r.TOUCHING)||c(t,p(e))})),document.addEventListener("mouseup",(function(e){a.contains($r.TOUCHING)||(document.removeEventListener("mousemove",g),a.contains($r.GRABBING)&&(a.remove($r.GRABBING),d(t,p(e)),i=0))})),t}function Jr(t,e){const r=e.target;return!!r&&(r&&!r.closest(t.id)||!ti(t.parentElement)||!t.classList.contains($r.TOUCHING))}function ti(t){if(!t)return!1;const e=window.getComputedStyle(t);return"0"!==e.width&&"0"!==e.height&&"0"!==e.opacity&&"none"!==e.display&&"hidden"!==e.visibility}!function(t){t.GRABBING="has-grab",t.TOUCHING="has-touch"}($r||($r={}));class FlowplayerVolumeBar extends FlowplayerComponent{constructor(t){super(t),this.className="fp-volume";const e=t.root.classList,r=e.contains("is-tiny")?6:e.contains("is-small")?8:10,i=Array.from({length:r}).map(()=>{const t=document.createElement("i");return t.className="fp-tick",t});this.append(...i),Zr(this,{onseek:(e,r)=>{r>0&&(t.muted=!1,t._storage.removeItem("mute")),t._storage.setItem("volume",(t.volume=r/100).toString()),this.adjustVolumeSlider(t.volume)}}),this.setAttribute("tabindex","0"),this.setAttribute("role","slider"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax","1"),this.setAttribute("aria-label",t.i18n("core.volume","volume")),t.on("volumechange",()=>{const e=0==t.volume||t.muted;e&&this.adjustVolumeSlider(0);const r=t.opt("ui");this.classList.contains($r.GRABBING)||e&&"number"==typeof r&&(4&r)>0||this.adjustVolumeSlider(t.volume)})}adjustVolumeSlider(t){this.setAttribute("aria-valuenow",t.toString());const e=Array.from(this.querySelectorAll(".fp-tick")),r=Math.round(t*e.length);e.forEach((t,e)=>{t.classList.toggle("fp-color",e<r)})}}function ei(t,e){if(!t.parentElement)return;const r=t.clientWidth/t.parentElement.clientWidth*100/2;t.style.left=e-r+"%",t.style.display="block"}function ri(t,e){if(isNaN(t.duration))return;const r=t.buffered;r.length&&(e.style.width=Math.min(r.end(r.length-1)/t.duration*100,100)+"%")}function ii(t,e){t.style.width="0",e.style.display="none"}function ni(t,e,r){if(!e.seekable||0==e.seekable.length)return;ei(r,t);const i=lr(e),n=(100-Math.max(0,Math.min(t,100)))/100*(i.head-i.tail);r.innerText="-"+Nt(n)}function si(t,e){t/=100,e.currentTime=function(t,e){if(e>1||e<0)return console.warn("cannot calculate a percent outside of range(0..1)"),0;const r=lr(t);return r.tail+e*(r.head-r.tail)}(e,t)}function ai(t,e){t.style.width="0",e.style.display="none"}class FlowplayerTimelineBar extends FlowplayerComponent{constructor(t){let e;super(t),this.bufferEle=xt("fp-buffer"),this.progress=xt("fp-progress","fp-color"),this.tooltipEle=xt("fp-timestamp"),this.proposedSeekBar=xt("fp-hover"),this.dragger=xt("fp-dragger","fp-color"),this.classList.add("fp-timeline","fp-bar"),this.tooltipEle.style.display="none",this.setAttribute("role","slider"),this.setAttribute("tabindex","0"),this.setAttribute("aria-label",t.i18n("timeline","Timeline")),this.progress.append(this.dragger),this.append(this.bufferEle,this.progress,this.proposedSeekBar,this.tooltipEle);let r=!1;const n=requestAnimationFrame;let s=void 0;const a=()=>{0==t.reaper||e.live||(!function(t,e){e.style.width=t.currentTime/t.duration*100+"%"}(t,this.progress),s=void 0,t.paused||this.classList.contains($r.GRABBING)||s||(s=setTimeout(a,200)))},o=()=>!!this.player.opt("seekable",!0)&&!isNaN(this.player.duration);Zr(this,{onseek:(r,i)=>{if(o())switch(!!e.live){case!0:ni(i,t,this.tooltipEle);break;case!1:!function(t,e,r){const i=e.duration*(t/100);if(e.disabled&&i>e.currentTime)return!1;r.style.width=t+"%",e.currentTime=i}(i,t,this.progress),ei(this.tooltipEle,i)}},onstart:()=>{o()&&(t.emit("timeline/gesture/start"),t.setState(J,!0),e.live||function(t){t.style.display="block"}(this.tooltipEle))},onend:function(r,i){n(a),0!=e.seekable&&e.live&&si(i,t)},ontouch:function(){t.paused||(r=!0,t.pause())},ontouchend:()=>{r&&(r=!1,t.play()),e.live?ai(this.proposedSeekBar,this.tooltipEle):ii(this.proposedSeekBar,this.tooltipEle)},onmouse:(r,i)=>{if(o()&&!this.classList.contains($r.GRABBING))switch(t.emit("timeline/gesture/move",{percent:i}),!!e.live){case!0:!function(t,e){e.style.width=t+"%"}(i,this.proposedSeekBar),ni(i,t,this.tooltipEle);break;case!1:!function(t,e){e.style.width=t+"%"}(i,this.proposedSeekBar),function(t,e,r){if(isNaN(t)||isNaN(e.duration))return;ei(r,t),r.innerHTML="";const i=document.createElement("span");i.innerText=Nt(t/100*e.duration),r.append(i)}(i,t,this.tooltipEle)}}}),t.on(L,(function(t){t.data&&(e=t.data)})),t.on(m,()=>n(a)),t.on("live",()=>{this.progress.style.width="100%"}),t.on(p,()=>{0==t.reaper||e.live||ri(t,this.bufferEle)}),t.on("dvr",t=>{t.detail&&(this.progress.style.width=100-t.detail.offset+"%")}),t.on("timeupdate",()=>{0!=t.reaper&&(n(a),this.setAttribute("aria-valuenow",t.currentTime+""),e.live||ri(t,this.bufferEle))}),t.on(h,()=>{0!=t.reaper&&(e.live||ri(t,this.bufferEle))}),t.on("durationchange",e=>{if(0==t.reaper)return;const r=ur(t)?dr(t):e.data||t.duration;isNaN(r)||(this.setAttribute("aria-valuemax",r+""),this.setAttribute("aria-valuemin","0"))}),t.on(b,()=>{t.once("beforeplay",()=>{t.hasState(et)&&!t.hasState(it)&&(this.progress.style.width=pr(t)+"%")})}),t.on(v,()=>{if(!t.hasState(et)||t.hasState(it))return;const e=setInterval(()=>{if(t.hasState(it))return r();this.progress.style.width=pr(t)+"%"},1e4);function r(){clearInterval(e),[m,i,b,A].forEach(e=>{t.removeEventListener(e,r)})}t.on([m,i,b,A],r)}),this.addEventListener(l,()=>{t.emit("timeline/gesture/end"),e.live?ai(this.proposedSeekBar,this.tooltipEle):ii(this.proposedSeekBar,this.tooltipEle)})}}class FlowplayerChaptersTimelineBar extends FlowplayerTimelineBar{constructor(t){super(t),this.handleChapters(t)}handleChapters(t){const e=document.createElement("div");let r;this.addEventListener("chapters:new",t=>{e.innerText="",this.querySelectorAll(".fp-chapter").forEach(t=>this.removeChild(t)),t.data&&t.data.forEach(t=>{const i=document.createElement("div");i.className="fp-chapter",i.style.left=t.left,i.style.bottom=i.style.top="0",i.style.width=t.width,i.title=t.title,i.onmouseover=()=>{e.innerText=t.title},i.onmouseleave=()=>{e.innerText=r||""},this.appendChild(i)})}),this.addEventListener("chapter:changed",i=>{var n;const s=i.data;s&&(e.parentNode||(null===(n=Ct(t,O))||void 0===n||n.insertAdjacentElement("beforebegin",e),e.classList.toggle("fp-togglable",!0),e.classList.toggle("fp-chapter-info",!0)),r=s,e.innerText=s)})}}class FlowplayerLiveStatus extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-live-status");const e=xt("fp-live-text"),r=xt("fp-live-indicator","fp-color");e.textContent="live",this.append(r,e),this.addEventListener(n,(function(){!function(t){try{if(!t.hasState("is-live-seeked"))return;t.emit("live"),t.dvr_offset=0,t.currentTime=cr(t)}catch(t){console.warn("failed to seek to now: %j",t)}}(t)}))}}class FlowplayerDuration extends FlowplayerComponent{constructor(t){let e;super(t),this.classList.add("fp-duration"),t.on(L,r=>{if(0==t.reaper||!r.data)return;e=r.data;const i=ur(t)?NaN:r.data.duration||0;if(isNaN(i)||i>=Number.MAX_SAFE_INTEGER)return this.style.display="none";this.style.display="inline-block",this.innerText=Nt(i)}),t.on(h,()=>{0==t.reaper||e.live||function(t,e){t.duration&&(e.innerText=Nt(t.duration))}(t,this)})}}class FlowplayerElapsedTime extends FlowplayerComponent{constructor(t){let e;super(t),this.classList.add("fp-elapsed"),this.innerText=Nt(0),t.on(L,t=>{t.data&&(e=t.data)}),t.on("timeupdate",()=>{0!=t.reaper&&(e.live?function(t,e){e.innerText=Nt(t.currentTime)}(t,this):function(t,e){e.innerText=Nt(t.currentTime)}(t,this))})}}class FlowplayerControlButtons extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-btns","fp-small-switch");const e=ft(t,j),r=ft(t,G);e.addEventListener("click",(function(){t.togglePlay(),setTimeout((function(){r.focus&&r.focus()}),100)})),r.addEventListener("click",(function(){t.togglePlay(),setTimeout((function(){e.focus&&e.focus()}),100)})),this.append(e,r)}}class FlowplayerLeftRightZone extends FlowplayerComponent{constructor(t,e){super(t),this.classList.add(e);const r=this.classList.contains("fp-left-zone")?-1:1,i=document.createElement("span"),n=ft(t,this.classList.contains("fp-left-zone")?V:"flowplayer-fast-forward-icon");n.removeAttribute("tabindex"),i.classList.add("fp-zone-seconds"),this.append(i,n);t.on(_,()=>{i.innerText=""}),t.on("seek:queued",t=>{const e=t.data;if(!e)return;if("number"!=typeof e.offset)return;const r=e.offset;if(0==r)return this.reset_zone();r>0&&this.classList.contains("fp-right-zone")||r<0&&!this.classList.contains("fp-right-zone")?this.render_zone_state(r):this.reset_zone()}),t.on("seek:cancel",()=>{this.reset_zone()}),this.reset_zone(),this.addEventListener(u,(function(e){isNaN(t.duration)||isNaN(t.currentTime)||16384&t.opt("ui")||t.hasState(it)||!t.hasState("will-seek")&&!t.hasState(nt)||t.enqueueSeek(5*r)&&(e.stopPropagation(),e.preventDefault())}))}reset_zone(){const t=this.querySelector(".fp-zone-seconds");t&&(t.innerText="")}render_zone_state(t){const e=this.querySelector(".fp-zone-seconds");e&&(e.innerText=Math.abs(t)+"")}}class FlowplayerHeaderLeftRight extends FlowplayerComponent{constructor(t,e,...r){super(t),this.className=e;const i=t.createComponents(...r);this.append(...i),"fp-left"!==e&&i.forEach(e=>{e.addEventListener(n,()=>t.toggleFullScreen())})}}class FlowplayerMiddleWait extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-wait"),Array(...Array(4)).map((t,e)=>e).forEach(()=>{this.append(document.createElement("b"))})}}class FlowplayerMiddleZone extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-middle-zone");const e=t.createComponents(B,"flowplayer-middle-buttons");this.append(...e)}}class FlowplayerMiddleButtons extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-switch"),[H,K].forEach(e=>{const r=ft(t,e);r.removeAttribute("tabindex"),this.append(r)})}}class FlowplayerVolumeControl extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-volume-control");const e=ft(t,q);this.append(e),!r().ios&&this.append(ft(t,"flowplayer-volume-bar")),e instanceof FlowplayerIcon&&e.addEventListener(n,(function(){t.toggleMute()}))}}class FlowplayerHeader extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-header"),this.append(...t.createComponents("flowplayer-header-left-zone",M)),t.reaper&&t.reaper.set("header",this)}}class FlowplayerControls extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-controls","fp-togglable"),this.append(...t.createComponents("flowplayer-control-buttons",I,C,P,"flowplayer-control-duration","flowplayer-volume-control"))}}class FullscreenIcon extends FlowplayerIcon{constructor(t,e){super(t,e),this.setAttribute("role","button"),this.setAttribute("aria-label",t.i18n(e==jr?"core.fullscreen":"core.fullscreen_exit"))}}class FlowplayerMiddle extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-middle"),this.append(...t.createComponents("flowplayer-middle-left-zone",U,"flowplayer-middle-right-zone")),this.setAttribute("tabindex","0"),this.setAttribute("role","button"),this.setAttribute("aria-label",t.i18n("core.play")),t.reaper&&t.reaper.set("middle",this),this.handleClick(t),this.handleTouch(t),[m,_].forEach(e=>t.once(e,()=>{this.removeAttribute("tabindex"),this.removeAttribute("role"),this.removeAttribute("aria-label")}))}handleClick(t){[n,s].forEach(e=>this.addEventListener(e,(function(e){if(!e.defaultPrevented&&!t.hasState("is-endscreen"))return e.preventDefault(),t.emit(e.type),!1}))),t.on(n,(function(e){setTimeout((function(){e.defaultPrevented||t.hasState(rt)||t.togglePlay()}),0)})),t.on(s,(function(e){setTimeout((function(){e.defaultPrevented||t.toggleFullScreen()}),0)}))}handleTouch(t){let e=!1;this.addEventListener(u,(function(e){e.cancelable&&!t.hasState("is-endscreen")&&(e.preventDefault(),t.emit(e.type,{source:e}))})),t.on(u,(function(r){setTimeout((function(){if(r.defaultPrevented)return;if(t.hasState(rt))return;if(t.ended)return t.togglePlay(!0);const i=t.hasState(Z);e&&clearTimeout(e),(i||t.hasState(nt)||t.hasState("no-autoplay"))&&(t.hasState(nt)&&(t.setState(nt,!1),t.setState("is-hovered",!1)),t.togglePlay(),i)||(t.setState(nt,!0),t.paused||(e=setTimeout((function(){e=!1,t.setState(nt,!1),t.setState("is-hovered",!1)}),2e3)))}),0)}))}}class FlowplayerUi extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-ui"),this.append(...t.createComponents(x,N,O))}}Ae.extensions.unshift.apply(Ae.extensions,[I18n,Analytics$1,Health,class Default{constructor(t){pt(t,k,FlowplayerUi),pt(t,O,FlowplayerControls),pt(t,I,FlowplayerLiveStatus),pt(t,"flowplayer-control-duration",FlowplayerDuration),pt(t,P,t.extensions.find(t=>"Chapters"===t.name)?FlowplayerChaptersTimelineBar:FlowplayerTimelineBar),pt(t,C,FlowplayerElapsedTime),pt(t,"flowplayer-volume-bar",FlowplayerVolumeBar),pt(t,"flowplayer-volume-control",FlowplayerVolumeControl),pt(t,"flowplayer-control-buttons",FlowplayerControlButtons),pt(t,x,FlowplayerHeader),pt(t,F,FlowplayerPrimary),pt(t,"flowplayer-header-duration",FlowplayerHeaderDuration),pt(t,"flowplayer-header-left-zone",class extends FlowplayerHeaderLeftRight{constructor(t){super(t,"fp-left",F,"flowplayer-header-duration")}}),pt(t,M,class extends FlowplayerHeaderLeftRight{constructor(t){super(t,"fp-right fp-togglable","flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon")}}),pt(t,N,FlowplayerMiddle),pt(t,U,FlowplayerMiddleZone),pt(t,B,FlowplayerMiddleWait),pt(t,"flowplayer-middle-buttons",FlowplayerMiddleButtons),pt(t,"flowplayer-middle-right-zone",class extends FlowplayerLeftRightZone{constructor(t){super(t,"fp-right-zone")}}),pt(t,"flowplayer-middle-left-zone",class extends FlowplayerLeftRightZone{constructor(t){super(t,"fp-left-zone")}}),pt(t,G,class extends FlowplayerIcon{constructor(t){super(t,Wr),this.setAttribute("role","button")}}),pt(t,j,class extends FlowplayerIcon{constructor(t){super(t,zr),this.setAttribute("role","button")}}),pt(t,H,class extends FlowplayerIcon{constructor(t){super(t,Kr)}}),pt(t,K,class extends FlowplayerIcon{constructor(t){super(t,Vr)}}),pt(t,"flowplayer-fullscreen-enter-icon",class extends FullscreenIcon{constructor(t){super(t,jr)}}),pt(t,"flowplayer-fullscreen-exit-icon",class extends FullscreenIcon{constructor(t){super(t,Hr)}}),pt(t,"flowplayer-fast-forward-icon",class extends FlowplayerIcon{constructor(t){super(t,Yr)}}),pt(t,V,class extends FlowplayerIcon{constructor(t){super(t,Xr)}}),pt(t,q,class extends FlowplayerIcon{constructor(t){super(t,qr),this.classList.add("fp-volumebtn"),t.on("volumechange",()=>{const e=0==t.volume||t.muted;this.setAttribute("aria-label",e?t.i18n("unmute","unmute"):t.i18n("mute","mute"))})}})}init(t,e,r){vr(t,0,r),gr(t,e,r),function(t,e,r){"undefined"!=typeof window&&"ontouchstart"in window&&r.setState("is-touch-device",!0),r.setState("is-accessibility",!1)}(0,0,r)}}]);var oi=Object.assign(Ae,{ui:sr,i18n:I18n}),li=we(Re((function(t,e){var r;"undefined"!=typeof window&&(r=function(){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/dist/",r(r.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":
|
|
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=e()}(this,(function(){"use strict";const t=[],e=[];function r(){const t="undefined"!=typeof document&&"undefined"!=typeof window,e=t?navigator.userAgent:"",r=/iP(hone|od)/i.test(e)&&!/iPad/.test(e)&&!/IEMobile/i.test(e),i=/Android/.test(e)&&!/Firefox/.test(e),n=/^((?!chrome|android).)*safari/i.test(e),s=/SamsungBrowser/.test(e),a=s&&/SMART-TV/.test(e);return{controls:!r,video:function(e){return t&&document.createElement("video").canPlayType(e)},lang:t&&window.navigator.language,android:i,iphone:r,safari:n,ios:t&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:s,samsung_tv:s&&a,touch:!!("ontouchstart"in window)}}const i="error",n="click",s="dblclick",a="load",o="mouseenter",l="mouseleave",u="mousemove",d="touchmove",c="touchend",h="fullscreenenter",f="fullscreenexit",p="loadedmetadata",g="loadeddata",v="progress",m="loadstart",y="pause",E="playing",T="waiting",_="canplay",S="ended",b="seeked",A="seeking",L="reap",w="config",R="landscape",D="portrait";var k=Object.freeze({__proto__:null,MOUNT:"mount",ERROR:i,CONTEXT_MENU:"contextmenu",CLICK:n,DBL_CLICK:s,KEYUP:"keyup",KEYDOWN:"keydown",LOAD:a,MOUSE_ENTER:o,MOUSE_LEAVE:l,MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_MOVE:u,TOUCH_START:"touchstart",TOUCH_MOVE:d,TOUCH_END:c,TOUCH_CANCEL:"touchcancel",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_ENTER:h,FULLSCREEN_EXIT:f,FULLSCREEN_CHANGE:"fullscreenchange",WEBKIT_NEEDKEY:"webkitneedkey",METADATA:p,DATA:g,PROGRESS:v,TIME_UPDATE:"timeupdate",LOAD_START:m,VOLUME_CHANGE:"volumechange",PAUSE:y,PLAYING:E,PLAY:"play",WAITING:T,CAN_PLAY:_,ENDED:S,SEEKED:b,SEEKING:A,DURATION_CHANGE:"durationchange",BEFORE_PLAY:"beforeplay",BEFORE_PAUSE:"beforepause",STATE:"state",CUEPOINTS:"cuepoints",CUEPOINT_START:"cuepointstart",CUEPOINT_END:"cuepointend",VIEW_ENTER:"viewenter",VIEW_LEAVE:"viewleave",SOURCE:"src",RECOVER:"recover",REAP:L,CONFIG:w,QUALITIES:"qualities",SET_QUALITY:"quality:set",NON_RECOVERABLE_ERROR:"error:fatal",RECOMMENDATIONS_READY:"recommendationsready",AUDIO_ONLY_SOURCE:"audioonlysource",LANDSCAPE:R,PORTRAIT:D,RENDER_PLUGIN:"renderplugin",DVR:"dvr",LIVE:"live",SEEK_QUEUED:"seek:queued",SEEK_CANCEL:"seek:cancel",PLUGIN_REGISTERED:"plugin:registered",REMOTE_SESSION_STARTED:"remotesession:started",REMOTE_SESSION_ENDED:"remotesession:ended",INTERSECTIONCHANGE:"intersectionchange"});const O="flowplayer-ui",I="flowplayer-control",C="flowplayer-live-status",P="flowplayer-elapsed-time",x="flowplayer-timeline-bar",M="flowplayer-header",F="flowplayer-header-right-zone",N="flowplayer-primary",U="flowplayer-middle",B="flowplayer-middle-zone",G="flowplayer-wait",j="flowplayer-small-play-icon",H="flowplayer-small-pause-icon",K="flowplayer-play-icon",V="flowplayer-pause-icon",q="flowplayer-rewind-icon",W="flowplayer-volume-icon",z="flowplayer-live-countdown";var Y=Object.freeze({__proto__:null,SUBTITLES_MENU:"flowplayer-subtitles-menu",SHARE_MENU:"flowplayer-share-menu",SPEED_MENU:"flowplayer-speed-menu",QUALITY_MENU:"flowplayer-quality-menu",AUDIO_MENU:"flowplayer-audio-menu",UI:O,CONTROL:I,CONTROL_BUTTONS:"flowplayer-control-buttons",LIVE_STATUS:C,ELAPSED:P,TIMELINE:x,CONTROL_DURATION:"flowplayer-control-duration",VOLUME_CONTROL:"flowplayer-volume-control",VOLUME_BAR:"flowplayer-volume-bar",HEADER:M,HEADER_LEFT_ZONE:"flowplayer-header-left-zone",HEADER_RIGHT_ZONE:F,PRIMARY:N,HEADER_DURATION:"flowplayer-header-duration",MIDDLE:U,MIDDLE_ZONE:B,WAIT:G,MIDDLE_BUTTONS:"flowplayer-middle-buttons",MIDDLE_LEFT_ZONE:"flowplayer-middle-left-zone",MIDDLE_RIGHT_ZONE:"flowplayer-middle-right-zone",ENDSCREEN_INTERSTITIAL:"flowplayer-endscreen-interstitial",ENDSCREEN_UP_NEXT:"flowplayer-endscreen-up-next",ENDSCREEN_GRID:"flowplayer-endscreen-grid",PLAYLIST_INTERSTITIAL:"flowplayer-playlist-interstitial",AIRPLAY_ICON:"flowplayer-airplay-icon",CHROMECAST_ICON:"flowplayer-chromecast-icon",SMALL_PLAY_ICON:j,SMALL_PAUSE_ICON:H,PLAY_ICON:K,PAUSE_ICON:V,FULLSCREEN_ENTER_ICON:"flowplayer-fullscreen-enter-icon",FULLSCREEN_EXIT_ICON:"flowplayer-fullscreen-exit-icon",SKIP_NEXT_ICON:"flowplayer-skip-next-icon",SKIP_PREVIOUS_ICON:"flowplayer-skip-previous-icon",FAST_FORWARD_ICON:"flowplayer-fast-forward-icon",REWIND_ICON:q,SHARE_ICON:"flowplayer-share-icon",VOLUME_ICON:W,MUTE_ICON:"flowplayer-mute-icon",UNMUTE_ICON:"flowplayer-unmute-icon",CLOSE_ICON:"flowplayer-close-icon",FACEBOOK_ICON:"flowplayer-facebook-icon",TWITTER_ICON:"flowplayer-twitter-icon",LINK_ICON:"flowplayer-link-icon",EMBED_ICON:"flowplayer-embed-icon",LIVE_COUNTDOWN:z,PLAYLIST_CONTROLS:"flowplayer-playlist-controls",THUMBNAILS_CAROUSEL:"flowplayer-thumbnails-carousel",ERROR_COMPONENT:"flowplayer-error"});const X="is-playing",Q="is-paused",$="is-loaded",Z="is-loading",J="is-starting",tt="is-seeking",et="is-ended",rt="is-waiting",it="is-live-seeked",nt="no-timeline",st="is-touched",at="is-in-viewport";var ot=Object.freeze({__proto__:null,PLAYING:X,FULLSCREEN:"is-fullscreen",PAUSED:Q,MUTED:"is-muted",LOADED:$,LOADING:Z,STARTING:J,SEEKING:tt,GRABBING:"is-grabbing",DISABLED:"is-disabled",SMALL:"is-small",TINY:"is-tiny",RTL:"is-rtl",ENDED:et,LIVE:"is-live",ERRORED:"is-error",WAITING:rt,AUTOPLAY:"is-autoplay",NO_AUTOPLAY:"no-autoplay",SEAMLESS:"is-seamless",TOGGLING:"is-toggling",LIVE_SEEKED:it,NO_DVR:nt,HAS_POSTER:"has-poster",MENU_OPENED:"has-menu-opened",TOUCHED:st,HOVERED:"is-hovered",TOUCH_DEVICE:"is-touch-device",WILL_SEEK:"will-seek",SEEKABLE:"is-seekable",IN_VIEWPORT:at});function lt(t){this.message=t}lt.prototype=new Error,lt.prototype.name="InvalidCharacterError";var ut="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new lt("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,n=0,s=0,a="";i=e.charAt(s++);~i&&(r=n%4?64*r+i:i,n++%4)?a+=String.fromCharCode(255&r>>(-2*n&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return a};var dt=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(ut(t).replace(/(.)/g,(function(t,e){var r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(e)}catch(t){return ut(e)}};function ct(t){this.message=t}ct.prototype=new Error,ct.prototype.name="InvalidTokenError";var ht=function(t,e){if("string"!=typeof t)throw new ct("Invalid token specified");var r=!0===(e=e||{}).header?0:1;try{return JSON.parse(dt(t.split(".")[r]))}catch(t){throw new ct("Invalid token specified: "+t.message)}};ht.InvalidTokenError=ct;const ft=new Map,pt=(t,e)=>new(((t,e)=>{const r=t.get(e);if(!r)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 n=window.customElements.get(r);return"function"!=typeof n?i:n})(t._customElements,e))(t),gt=(t,e,r)=>{window.customElements.get(e)||window.customElements.define(e,r),t.customElements.get(e)||t.customElements.set(e,e)};var vt,mt;!function(t){t[t.LOW=1]="LOW",t[t.MEDIUM=2]="MEDIUM",t[t.HIGH=4]="HIGH"}(vt||(vt={})),function(t){t[t.OFF=0]="OFF",t[t.ON=1]="ON",t[t.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(mt||(mt={}));function yt(t,e,r){const i="boolean"==typeof r;if("boolean"!=typeof r&&(r=t.paused),function(t,e,r){const i=t.poll(e?"beforeplay":"beforepause",{forced:r});return i&&i.defaultPrevented}(t,r,i))return;if(!r)return t.pause();if(0==t.reaper)return;const n=t.reaper.get("__pending_play");return 0!=t.paused||n?n?(n.src!==Tt(t.original_src)&&Et(t),n):(function(t){return(0==t.networkState||0==t.readyState)&&t.currentSrc==Tt(t.original_src)}(t)&&Et(t),(t=>t.autoplay&&mt.AUDIO_REQUIRED&t.autoplay)(e)?function(t){t.muted=!1,0==t.volume&&(t.volume=1);return t.play().catch(t=>{console.warn("[flowplayer/play] autoplay audio required\n%s",t.message)})}(t):(t.setState(J,!1),t.play().catch(e=>(console.warn("[flowplayer/play] attempting muted autoplay\n%s",e.message),t.muted=!0,t.volume=0,t.play())))):void 0}function Et(t){t.currentSrc.match(/^blob:/)||t.load()}function Tt(t){const e=document.createElement("a");return e.href=t,e.href}function _t(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r}function St(t){const e=document.createElement("a");e.href=t;const r=e.pathname&&e.pathname.split(".");return r.length>1&&r[r.length-1]}function bt(t){switch(t){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return t}}const At=t=>{var{src:e}=t,r=_t(t,["src"]);return[Object.assign({src:e,type:e?bt("video/"+St(e)):""},r)]};function Lt(t){return At({src:t})}function wt(t){var{src:e,type:r}=t,i=_t(t,["src","type"]);return e&&r?[Object.assign({src:e,type:r},i)]:r&&!e?[Object.assign({type:r},i)]:At(Object.assign({src:e},i))}var Rt;function Dt(t,e,r,i={safari:!1}){const n=function(t){return"string"==typeof t?Lt(t):Array.isArray(t)||"object"!=typeof t?t.reduce((function(t,e){return"string"==typeof e&&(e=Lt(e)),"object"!=typeof e||Array.isArray(e)||(e=wt(e)),t.concat(e)}),[]):wt(t)}(r);return t.currentSrc&&(t.innerHTML="",t.setOpts({live:!1}),t.live_state.dvr=void 0,t.live_state.dvr_window=void 0,delete t.opts.live,delete t.opts.duration),[tt,X,Q,Z,$,it].forEach(e=>t.setState(e,!1)),e.autoplay||t.setState(J,!0),Array(...Array(n.length)).map((t,e)=>e).some(r=>{const s=n[r];if(Rt.Ok==function(t,e,r){t.emit("src",r),"string"==typeof r.src&&(t.original_src=r.src);const i=function(t,e,r){return t.plugins.filter(t=>{return(e=t)&&"wants"in e;var e}).find(t=>t.wants(r.src||"",r,e))}(t,e,r);return t.setOpts({is_native:!i}),i?(i.onload(e,t.root,t,r),Rt.Ok):Rt.Err}(t,e,s)||Rt.Ok==function(t,e,r,i={safari:!1}){var n;/^audio\//.test(r.type||"")&&t.emit("audioonlysource");e.start_time&&(r.src=r.src+"#t="+e.start_time);if(""==t.canPlayType(r.type||""))return Rt.Err;if(r.drm&&(!r.drm["com.apple.fps.1_0"]||!i.safari))return Rt.Err;"string"==typeof r.src&&(t.preload=e.autoplay?"auto":null!==(n=e.preload)&&void 0!==n?n:"auto",t.src=r.src,"none"!==t.preload&&t.setState(Z,!0));return Rt.Ok}(t,e,s,i))return!0;r==n.length-1&&"string"==typeof s.src&&(t.src=s.src)}),function(t,e){!function(t,e){if(!t.currentSrc)return;if("none"==t.opt("preload"))return;if(e.autoplay&&e.autoplay>0)return;t.load()}(t,e)}(t,e),t}!function(t){t[t.Err=0]="Err",t[t.Ok=1]="Ok"}(Rt||(Rt={}));const kt=[L,A,"src","seek:cancel"];var Ot;function It(t,e,r){return isNaN(t.duration)||isNaN(t.currentTime)?{}:(e.offset+=r,0==e.offset?Ct(t,e):(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((function(){0!=t.reaper&&(t.currentTime=function(t,e,r=0){return Math.max(Math.min(e,t),r)}(t.currentTime+e.offset,t.duration),e.timer=0,Ct(t,e))}),1e3),function(t,e){t.setState("will-seek",!0),t.setState(Ot.BACKWARD,e.offset<0),t.setState(Ot.FORWARD,e.offset>0)}(t,e),t.emit("seek:queued",e),e))}function Ct(t,e){e.timer&&clearTimeout(e.timer),e.timer=e.offset=0,function(t){t.setState(Ot.FORWARD,!1),t.setState(Ot.BACKWARD,!1),t.setState("will-seek",!1)}(t)}function Pt(t,e){const r=t._customElements.get(e);return r&&t.root.querySelector(r)||void 0}function xt(){if("undefined"==typeof document)return!1;const t=document.documentElement;return t&&"rtl"==t.getAttribute("dir")}function Mt(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}function Ft(t,e,r){const i=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;i.length;){if(null==t)return r;const e=i.shift();if("string"!=typeof e)return r;t=t[e]}return null==t?r:t}function Nt(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}function Ut(t){if(isNaN(t)||t>=Number.MAX_SAFE_INTEGER)return"";const e=t<0?"-":"";t=Math.round(Math.abs(t));const r=Math.floor(t/3600);let i=Math.floor(t/60);return t-=60*i,r>=1?(i-=60*r,e+r+":"+Nt(i)+":"+Nt(t)):e+Nt(i)+":"+Nt(t)}!function(t){t.FORWARD="forward",t.BACKWARD="backward"}(Ot||(Ot={}));const Bt=navigator.languages||[navigator.language];function Gt(t,e,r){const i={};return r=e.lang||r,t[r]&&(i[r]=t[r]),function(){try{return Bt.reduce((t,e)=>~e.indexOf("-")?t.concat(e,e.split("-")[0]):t.concat(e),[])}catch(t){return[]}}().forEach((function(e){t[e]&&!i[e]&&(i[e]=t[e])})),Object.values(i)}const jt=[1e7]+""+-1e3+-4e3+-8e3+-1e11,Ht=()=>"undefined"==typeof crypto?"":jt.replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16));let Kt="";!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){}}();const Vt=["touchstart","touchmove"];function qt(t,e){const r=new CustomEvent(t,{detail:e,cancelable:!0});return e&&Object.defineProperty(r,"data",{get:()=>e}),r}function Wt(t,e,r){const i=qt(e,r);return t.dispatchEvent(i),t}function zt(t,e,r){const i=qt(e,r);return t.dispatchEvent(i),i}function Yt(t,e,r,i){Array.isArray(e)?e.forEach(e=>Xt(t,e,r,i)):Xt(t,e,r,i)}function Xt(t,e,r,i){if(n=e,!~Vt.indexOf(n))return t.addEventListener(e,r,i),t;var n;const s=Object.assign(i||{},{passive:!0});return t.addEventListener(e,r,s),t}function Qt(t,e,r,i){return Yt(t,e,r,Object.assign(i||{},{once:!0}))}class PlayerStorage{constructor(t,e){this.implementation=t,e&&e.keys().forEach(t=>{"string"==typeof e.implementation[t]&&this.implementation.setItem(t,e.implementation[t])})}keys(){var t;const e=[];for(var r=0;r<this.implementation.length;r++)(null===(t=this.implementation.key(r))||void 0===t?void 0:t.startsWith("flowplayer/"))&&e.push(this.implementation.key(r));return e}removeItem(t){try{this.implementation.removeItem("flowplayer/"+t)}catch(t){}}getItem(t){try{return this.implementation.getItem("flowplayer/"+t)}catch(t){return null}}setItem(t,e){try{this.implementation.setItem("flowplayer/"+t,e)}catch(t){}}clear(){try{this.keys().forEach(t=>this.implementation.removeItem(t))}catch(t){}}get length(){try{return this.keys().length}catch(t){return 0}}key(t){try{return this.implementation.key(t)}catch(t){return null}}}class InMemoryStorage{constructor(){this.pairs=[]}get length(){return this.pairs.length}clear(){this.pairs=[]}getItem(t){var e;return(null===(e=this.pairs.find(e=>e[0]===t))||void 0===e?void 0:e[1])||null}key(t){return this.pairs[t][0]||null}removeItem(t){this.pairs=this.pairs.filter(e=>e[0]!==t)}setItem(t,e){this.removeItem(t),this.pairs.push([t,e])}}const $t={preload:"none",rtl:!1,controls:!0},Zt=["loop","muted","preload"];function Jt(t,i,n){let s;n.live_state={dvr_window:void 0,get dvr(){return s},set dvr(e){e!==s&&(s=e,n.setState(nt,!(!t.live||e)))}},n._storage=new PlayerStorage(["localStorage","sessionStorage"].map(t=>{try{const e=window[t];return e.getItem(""),e}catch(e){return console.debug(`Access to window.${t} denied, trying next option`),null}}).find(t=>!!t)||new InMemoryStorage),n.toJSON=function(){return{duration:n.duration,volume:n.volume,currentTime:n.currentTime,states:n.root.className}},n.setSrc=function(e){return Dt(n,t,e,r())},n.playerState=n.playerState||{},n.setState=function(t,e){if(n.playerState[t]===!!e)return n;const r=Object.assign({},n.playerState,{[t]:e});return r[rt]&&(r[X]=!1),n.playerState=r,Wt(n,"state",n.playerState),n},n.createComponents=function(...t){return Array.from({length:t.length}).map((e,r)=>pt(this,t[r]))},n.hasState=function(t){return!!n.playerState[t]},n.transitionState=function(t,e,r){!n.hasState(t)&&n.hasState(e)||(r=0),r&&n.setState("is-toggling",!0),n.setState(e,!1),n.setState(t,!0),r&&setTimeout((function(){n.setState("is-toggling",!1)}),r)},n.emit=(t,e)=>(Wt(n,t,e),n),n.on=(t,e)=>(Yt(n,t,e),n),n.once=(t,e)=>(Qt(n,t,e),n),n.off=(t,e)=>{var r,i;return r=t,i=e,n.removeEventListener(r,i),n},n.poll=(t,e)=>zt(n,t,e),n.togglePlay=function(e){return yt(n,t,e)},n.toggleMute=function(t){t=null==t?!n.muted:!!t,n.muted=t,n.muted||n.volume||(n.volume=1),Wt(n,"volumechange")},n.toggleDisable=function(t){t=null==t?!n.disabled:!!t,n.setState("is-disabled",t),n.disabled=t},n.destroy=function(){n.pause();const t=e.indexOf(n);~t&&e.splice(t,1),setTimeout((function(){n.setSrc([]),n.reaper&&n.reaper.clear(),Wt(n,L)}),0)},n.setAttrs=function(t){return Zt.forEach(e=>{if(!(e in t))return;const r=t[e];r?n.setAttribute(e,r.toString()):n.removeAttribute(e)}),n},n.opt=function(e,r){return r=void 0===r?Ft($t,e):r,Ft(t,e,r)},n.i18n=function(t,e){if(!n.reaper)return"";const r=n.reaper.get("translations");return r?function t(e,r,i,n){return(n=n||0)>=e.length?i:Ft(e[n],r,t(e,r,i,n+1))}(r,t,e||""):e||""},n.setOpts=function(e){Object.assign(t,e),t.live&&!n.hasState("is-live")&&(n.setState(nt,!0),Wt(n,"live")),"disabled"in e&&void 0!==e.disabled&&n.toggleDisable(e.disabled),"muted"in e&&void 0!==e.muted&&n.toggleMute(e.muted),"dvr"in t&&(n.live_state.dvr=n.opt("dvr"));const r=!!t.autoplay&&!n.hasState("no-autoplay");n.setState("is-autoplay",r),n.setState("is-rtl",n.opt("rtl",function(t){if(!t)return xt();const e=t.getAttribute("dir");return e?"rtl"==e:xt()}(i))),n.setState("is-live",!!t.live),n.setState("has-poster","string"==typeof t.poster&&t.poster.length>0),n.setState("is-seekable",!!t.seekable),i.style.backgroundImage=n.hasState("has-poster")?"url('"+t.poster+"')":"",Wt(n,w,t)},n.renderPlugin=function(t){zt(n,"renderplugin",t).defaultPrevented||n.root.appendChild(t)};const a={offset:0,timer:0};var o,l;l=a,(o=n).on(kt,(function(){Ct(o,l)})),n.enqueueSeek=function(t){if(0!=n.opts.seekable&&!(1==n.opts.disabled&&t>0))return It(n,a,t)},n.deviceId=function(){return function(t){if(Kt)return Kt;try{const e=t.getItem("flowplayer/uuid");if(e)return e;const r=Ht();return t.setItem("flowplayer/uuid",r),r}catch(t){return Kt=Ht()}}(n._storage)}}function te(t,e){const r=e.querySelector("video"),i=r||(t._video_element_callback?t._video_element_callback(t):document.createElement("video"));return i.classList.add("fp-engine"),i.playsInline=!0,r||e.append(i),i}var ee="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function re(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const r=t.flowplayer;return"function"==typeof r?(r(e),e):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(e)||r.extensions.push(e),e)}function ie(){return"undefined"!=typeof window?window:void 0!==ee?ee:{}}const ne=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function se(t,e){return!!~ne.indexOf(t)||t.indexOf(e)===t.length-e.length}se.check_whitelist=function(t){return!!~ne.indexOf(t)};const ae="production";function oe(t,e){const r={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let i={c:"{}",exp:0};e=e||{};try{i=ht(t),r.valid_jwt=!0}catch(t){}return r.raw=t,r.data=JSON.parse(i.c),r.exp=i.exp,e.require_valid_token&&oe.validate(r),r}function le(t){try{return oe.validate(t),{success:!0,message:""}}catch(t){return{success:!1,message:t.message}}}var ue;function de(t){return{grant:t,is_granted:e=>(t&e)===e}}function ce({root:t,video:e,data:r}){e&&e.destroy(),console.error(new Error(r.details||r.reason)),t.innerHTML="",t.classList.remove("flowplayer"),t.classList.add("flowplayer-fatal"),t.style.removeProperty("background-image");const i=document.createElement("h2");i.textContent="Playback Error";const n=document.createElement("p");n.textContent="Are you the site owner?";const s=document.createElement("a");s.classList.add("troubleshoot"),s.target="_blank",s.href="https://docs.flowplayer.com/troubleshooting/player#"+r.reason,s.textContent="Troubleshoot?";const a=document.createElement("img");a.src="https://flowplayer.com/user/pages/images/logo-white.png",t.append(i,n,s,a)}oe.validate=function(t){if("string"==typeof t&&(t=oe(t)),!t||!t.raw){if(se.check_whitelist(window.location.hostname)||"dev"===ae.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,r=se.bind(null,e);if("dev"!==ae.toString()&&t.data.domain&&t.data.domain.length&&!t.data.domain.some(r))throw new Error("Domain not allowed");if("dev"!==ae.toString()&&1e3*t.exp-Date.now()<0)throw new Error("Expired token");return!0},oe.id=function(t){if(t)return"string"==typeof t&&(t=oe(t)),t.data.id},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"}(ue||(ue={})),de.of=de,de.from_token=function(t){const e=oe(t,{require_valid_token:!0});return de.of(e.data.acl)},de.permissions=ue;function he(t,e){const r=e.clientWidth;e.classList.toggle("is-small",r<600),e.classList.toggle("is-tiny",r<400)}function fe(t,e,i){let n=!0;e.classList.add("flowplayer"),he(0,e),Yt(i,[m,"resize"],(function(){he(0,e)})),Yt(i,"state",(function(){Object.entries(i.playerState).forEach((function([t,r]){e.classList.toggle(t,r)}))})),Yt(i,"timeupdate",(function(){i.setState(rt,!i.hasState("is-casting")&&!i.hasState(J)&&i.readyState<3)})),Yt(i,S,(function(e){setTimeout((function(){if(!e.defaultPrevented){if(t.rewind&&!i.loop){const e=i.src;t.autoplay&&(t.autoplay=0,i.setState("is-autoplay",!1)),i.setState(tt,!0),Qt(i,b,(function(){e===i.src&&(i.setState(tt,!1),i.pause(),i.setState(J,!0))})),i.currentTime=0}Qt(i,"timeupdate",(function(){i.setState(et,!1)})),i.transitionState(et,X,t.loop||t.rewind?0:300)}}),0)})),Yt(i,[A,b],(function(t){i.setState(tt,t.type==A),i.setState(Q,i.paused),i.setState(X,!i.paused)})),Yt(i,"remotesession:ended",(function(t){setTimeout(()=>i.currentTime=t.detail.currentTime,0)})),Yt(i,S,(function(){i.setState(X,!1),n=!0})),Yt(i,v,()=>{if(!i.opts.live||!i.opts.is_native)return;const t=i.seekable;0!=t.length&&i.emit("dvr/window",t.end(t.length-1)-t.start(0))}),Yt(i,r().ios?p:g,(function(){var t,e;i.setState($,!0),i.setState(Z,!1);const r=i;0===(null===(t=r.videoTracks)||void 0===t?void 0:t.length)&&(null===(e=r.audioTracks)||void 0===e?void 0:e.length)>0&&i.emit("audioonlysource")})),Yt(i,[T,_,m],(function(e){if(!i.hasState(tt)&&(e.type!=_||t.autoplay||i.setState(rt,!1),e.type!=m||"none"!=i.opt("preload")||t.autoplay)){if(e.type==m&&t.autoplay)return Qt(i,E,(function(){i.setState(rt,!1)}));e.type==T&&([X,Q,J].forEach((function(t){i.setState(t,!1)})),i.hasState($)||i.setState(Z,!0)),i.setState(et,!1),i.setState(rt,e.type==T)}})),Yt(i,[E,y],(function(e){setTimeout(()=>{const t=new CustomEvent("flowplayer/"+e.type,{detail:i});document.dispatchEvent(t)},0);const r=e.type==E,s=i.currentTime==i.duration,a=r&&n&&t.autoplay||i.hasState(rt);if(r&&(i.started=!0,n=!1),i.setState(rt,!1).setState(J,!1),s||i.hasState(tt))return;const o=r?X:Q,l=r?Q:X;i.transitionState(o,l,a?0:300),r&&i.setState("no-autoplay",!1)}))}const pe=[0].concat(Array.from({length:100}).map((t,e)=>(e+1)/100));function ge(t,e,r){if(!window.IntersectionObserver)return;const i={should_resume:!!t.autoplay,has_user_gesture:!1,locked:!1};[c,n].forEach(t=>Qt(r,t,()=>i.has_user_gesture=!0)),Yt(r,"play",(function(){i.locked||(i.should_resume=!0)})),Yt(r,"src",(function(){i.should_resume=!!t.autoplay})),Yt(r,y,(function(){i.locked||(i.should_resume=!1)})),Yt(r,_,(function(e){if(t.autoplay)return r.hasState(at)&&i.should_resume?r.togglePlay(!0):void(t.autopause||r.hasState(at)||!i.should_resume||Qt(r,"viewenter",()=>{t.autoplay&&i.should_resume&&r.togglePlay(!0)}))}));const s=new IntersectionObserver(t=>{t.forEach(t=>{setTimeout(()=>{const e=t.intersectionRatio,i=r.hasState(at);if(r.setState(at,e>=.2),r.emit("intersectionchange",{ratio:e}),i===r.hasState(at))return;const n=r.hasState(at)?"viewenter":"viewleave";r.emit(n)},0)})},{threshold:pe});s.observe(e),r.on(L,()=>s.disconnect()),t.autopause&&(Yt(r,"viewenter",(function(){i.should_resume&&t.autopause&&!ve()&&r.togglePlay(!0)})),Yt(r,"viewleave",(function(){if(!t.autopause||ve())return;const e=!r.paused;i.locked=!0,r.pause(),setTimeout((function(){i.should_resume=e,i.locked=!1}),0)})))}function ve(){return e.find(t=>t.hasState("is-casting"))}function me(t,e){if(!window.ResizeObserver)return;const r=new ResizeObserver(t=>{const r=t[t.length-1];e.emit("resize",r)});r.observe(t),e.on(L,()=>r.disconnect())}function ye(t){if("number"==typeof t&&!isNaN(t))return Number(t);if("string"==typeof t){const e=t.split(":");return Number(e[1])/Number(e[0])}return t}function Ee(t,e,r){const i=!!t.ratio,n=document.createElement("div");n.classList.add("fp-ratio"),e.append(n);let s=ye(t.ratio||.5625);n.style.paddingTop=100*s+"%";const a=[g,p];r.on(a,(function(){if(i)return;const t=r.videoHeight&&r.videoWidth&&r.videoHeight/r.videoWidth;t&&r.setOpts({ratio:t})})),r.on(w,(function(){const e=r.videoHeight&&r.videoWidth&&r.videoHeight/r.videoWidth,i=ye((null==t?void 0:t.ratio)||e||.5625);s!==i&&(s=i,n.style.paddingTop=100*i+"%")}))}class ExplorerPlan{constructor(){this.cleanUp=this.cleanUp.bind(this),this.render=this.render.bind(this),this.wireUp=this.wireUp.bind(this)}init(t,e,r){this.root=e,this.player=r,this.wireUp()}wireUp(){var t,e;this.cleanUp(),null===(t=this.player)||void 0===t||t.once(E,this.render),null===(e=this.player)||void 0===e||e.once(S,this.wireUp)}cleanUp(){var t,e,r,i;null===(e=null===(t=this._logo)||void 0===t?void 0:t.parentElement)||void 0===e||e.removeChild(this._logo),null===(r=this.player)||void 0===r||r.off(E,this.render),null===(i=this.player)||void 0===i||i.off(S,this.wireUp)}render(){var t,e,r;null===(e=null===(t=this._logo)||void 0===t?void 0:t.parentElement)||void 0===e||e.removeChild(this._logo);const i=(null===(r=this.root)||void 0===r?void 0:r.querySelector(".fp-ui"))||this.root;if(!i)return;const n=this._logo=document.createElement("a");n.href="https://explorer.flowplayer.com",n.target="_blank",Object.entries(Te).forEach(([t,e])=>{n.style.setProperty(t,e,"important")}),i.appendChild(n)}}const Te={display:"block",opacity:"1",visibility:"visible",width:"33%","padding-top":"9%",position:"absolute","z-index":"9999",bottom:"25%",left:"10%","background-size":"cover","background-image":"url(https://static.flowplayer.com/explorer/explorer.svg)"},_e="flowplayer/"+E;function Se(t){const e=e=>{e.detail!==t&&!1===t.opt("multiplay")&&t.togglePlay(!1)};t.on(L,()=>document.removeEventListener(_e,e)),document.addEventListener(_e,e)}function be(t,e){const r=[];t.addEventListener("contextmenu",i=>{const n=i.timeStamp;for(r.push(n);r.length>3;)r.shift();r.length>=3&&r.every(t=>t-n<3e3)&&(console.debug("flowplayer/debug rendering info"),function(t,e){var r;!function(t){const e=t.querySelector(".debug-info");null==e||e.remove()}(t);const i=document.createElement("div");i.classList.add("debug-info");const n=Ae("flowplayer.version","3.2.8");i.append(n);const s=null===(r=null==e?void 0:e.hls)||void 0===r?void 0:r.constructor;if(s&&s.version){const t=Ae("hls.version",s.version);i.append(t)}t.appendChild(i)}(t,e))})}const Ae=(t,e)=>{const r=document.createElement("div");r.classList.add("row",t);const i=document.createElement("span");i.classList.add("attr"),i.textContent=t;const n=document.createElement("span");return n.textContent=e,n.classList.add("value"),r.append(i,n),r};const Le=function(){const t=ie(),e=t.flowplayer?t.flowplayer:{extensions:[]};return Array.isArray(e.extensions)||(e.extensions=[]),e}();function we(r,i){if("function"==typeof r)return t.push(...[...arguments].filter(t=>"function"==typeof t)),we;"string"==typeof i&&(i={src:i}),i||(i={}),i.token||"string"!=typeof window.__FLOWPLAYER_TOKEN||(i.token=window.__FLOWPLAYER_TOKEN);const n="string"==typeof r?document.querySelector(r):r;if(!n)return console.error(new Error("Flowplayer: '"+r.toString()+"' not found"));const s=n.querySelector("video.fp-engine");if(s)return s;const a=le(i.token);if(!a.success)return ce({root:n,data:{reason:"token",details:a.message}});const o=new Map,l=te(i,n);l.reaper=o,l._customElements=ft,Object.defineProperty(l,"token",{value:"string"==typeof i.token?oe.id(i.token):"",writable:!1}),l.addEventListener(L,()=>{o.clear(),l.reaper=0,delete l.root}),l.root=n,i.token&&de.from_token(i.token).is_granted(de.permissions.DEVELOPER_PLAN)&&t.push(ExplorerPlan),!~e.indexOf(l)&&e.push(l),Jt(i,n,l),l.setAttrs(i),l.plugins=we.extensions.map(t=>new t(we,l)),fe(i,n,l),ge(i,n,l),me(n,l),Ee(i,n,l),Se(l),be(n,l),l.plugins.forEach(t=>{try{t.init(i,n,l)}catch(e){console.log("Error(plugin/%s)",t.constructor.name,e)}}),l.setOpts(i),l.opts=i,i.src&&l.setSrc(i.src);const u=l.readyState;return u>0&&l.currentSrc&&l.emit(p),u>2&&l.currentSrc&&l.emit(_),l.emit("mount"),l.on("error:fatal",(function(t){ce({root:n,video:l,data:t.data||{}})})),l}Object.assign(we,Le),function(i){Array.isArray(i.extensions)&&i.extensions.forEach(e=>t.push(e)),i.customElements=ft,i.defaultElements=Y,i.version="3.2.8",i.commit="7e733a5ef06816f5a96f8e27c1ef7927fc55599b",i.instances=e,i.extensions=t,i.support=r,i.events=k,i.states=ot,i.jwt=ht,i.autoplay=mt,i.quality=vt}(we),"object"==typeof document&&setTimeout(Wt,0,document,"flowplayer:umd",we);var Re="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function De(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ke(t){var e={exports:{}};return t(e,e.exports),e.exports}var Oe=ke((function(t,e){var r=Re&&Re.__assign||function(){return(r=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};e.__esModule=!0,e.remove=e.downcase=e.pluck=e.merge=void 0,e.merge=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce((function(t,e){return r(r({},t),e)}),{})},e.pluck=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return Object.keys(t).filter((function(t){return~r.indexOf(t)})).reduce((function(r,i){var n;return e.merge(r,((n={})[i]=t[i],n))}),{})},e.downcase=function(t){return(t||"").toString().toLowerCase()},e.remove=function(t,e){var r=t.lastIndexOf(e);return~r&&t.splice(r,1),t}})),Ie=ke((function(t,e){var r=Re&&Re.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),i=Re&&Re.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=Re&&Re.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e};e.__esModule=!0;var s=n(Oe),a=function(){function t(){this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return t.of=function(){return new t},t.is_empty=function(t){return 0==t.pending.length},t.is_high_water=function(e){return e.open.length==t.MAX_OPEN_REQUESTS},t.maybe_spawn_req=function(e){if(t.is_empty(e))return e;if(t.is_high_water(e))return e;try{var r=t.lpop(e);r&&t.request(e,r)}catch(t){}},t.increment_failures=function(e){return e.stats.failures++,e.stats.failures>t.MAX_FAILURE_COUNT&&(e.stats.ttl=Date.now()+t.REQUEST_TTL_MS),e},t.handle_error=function(e,r){t.rm(e,r),t.increment_failures(e)},t.request=function(e,r){var i=r[0],n=r[1],s=r[2];if(!(Date.now()<e.stats.ttl)){var a=new XMLHttpRequest;e.open.push(a),a.timeout=t.REQUEST_TIMEOUT_MS,a.ontimeout=function(){t.handle_error(e,a)},a.onerror=function(r){t.handle_error(e,a)},a.onreadystatechange=function(){a.readyState==XMLHttpRequest.DONE&&t.rm(e,a),Math.floor(a.status/100)},a.onload=function(){t.rm(e,a),e.stats.failures&&e.stats.failures--},a.open(n,i),a.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{a.send(JSON.stringify(s))}catch(t){}}},t.rpush=function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return r.forEach((function(r){e.pending.length>=t.MAX_PENDING||(e.pending.push(r),t.maybe_spawn_req(e))})),e},t.lpop=function(t){return t.pending.shift()},t.rm=function(t,e){return s.remove(t.open,e),t},t.MAX_OPEN_REQUESTS=3,t.MAX_PENDING=5,t.REQUEST_TIMEOUT_MS=4e3,t.REQUEST_TTL_MS=5e3,t.MAX_FAILURE_COUNT=3,t}();e.default=a})),Ce=ke((function(t,e){var r=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0;var i=r(Ie);e.default=i.default.of()})),Pe=ke((function(t,e){e.__esModule=!0,e.prepare_url=e.URL_PARAM=void 0,e.URL_PARAM=/:([a-zA-Z_]+)/g,e.prepare_url=function(t,r){return t.url.replace(e.URL_PARAM,(function(e){if((e=e.slice(1,e.length))in r)return r[e].toString();t.log.error(new Error("\n preparing url["+t.url+"] failed\n \n parameter["+e+"] not detected in params:\n \n "+JSON.stringify(r,null,2)+"\n "))}))}})),xe=ke((function(t,e){e.__esModule=!0,e.Log=void 0;var r=function(){function t(t){this.emitter=t}return t.prepare=function(t,e){var r=document.createEvent("Event");return r.initEvent(t,!1,!0),r.ns=t,r.data=e,r},t.of=function(e){return new t(e)},t.prototype.info=function(e){this.emitter.dispatchEvent(t.prepare(t.NAMESPACE.INFO,e))},t.prototype.error=function(e){this.emitter.dispatchEvent(t.prepare(t.NAMESPACE.ERROR,e))},t.prototype.warn=function(e){this.emitter.dispatchEvent(t.prepare(t.NAMESPACE.WARN,e))},t.NAMESPACE={INFO:"tracker:info",ERROR:"tracker:err",WARN:"tracker:warn"},t}();e.Log=r})),Me=ke((function(t,e){var r;e.__esModule=!0,e.Verb=void 0,(r=e.Verb||(e.Verb={})).POST="POST",r.PUT="PUT",r.GET="GET"})),Fe=ke((function(t,e){var r=Re&&Re.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),i=Re&&Re.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=Re&&Re.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},s=Re&&Re.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var i=Array(t),n=0;for(e=0;e<r;e++)for(var s=arguments[e],a=0,o=s.length;a<o;a++,n++)i[n]=s[a];return i},a=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0;var o=a(Ce),l=a(Ie),u=n(Pe),d=n(Oe),c=function(){function t(e,r){var i=this;void 0===r&&(r={});var n=this;if(this.emitter=e,this.url=r.url,this.log=xe.Log.of(this.emitter),this.verb=r.verb,this.metadata=d.merge({},r.metadata||{}),this.rq=r.rq||o.default,this.events=r.events||[],this.required_keys=r.required_keys||[],this.optional_keys=r.optional_keys||[],this.listeners=[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),t.assert_emitter_api(this.emitter),void 0===t.verb[this.verb])throw new Error("invalid HTTP verb["+this.verb+"] passed");if("string"!=typeof this.url)throw new Error("invalid API url["+this.url+"] passed");t.TRACKERS.push(this),n.events.forEach((function(e){t.create_listener(i,e,(function(r){void 0===r&&(r={});var s=d.merge(n.metadata,{event_type:e},r.data||r),a=u.prepare_url(n,s),o=t.pluck_valid_keys(n,s),c=t.ensure_required_keys(n,o);if(c.length)return n.log.error("Tracker.validate_metadata() failed for \n Event["+e+"]\n missing keys: "+c+"\n payload:\n "+JSON.stringify(o,null,2));l.default.rpush(i.rq,[a,i.verb,o])}))}))}return t.of=function(e,r){return new t(e,r)},t.ensure_required_keys=function(t,e){return t.required_keys.filter((function(t){return!(t in e)}))},t.pluck_valid_keys=function(t,e){return d.pluck.apply(d,s([e],t.valid_keys))},t.merge_metadata=function(e,r){return void 0===r&&(r={}),e.metadata=t.pluck_valid_keys(e,d.merge(e.metadata,r)),e},t.assert_emitter_api=function(t){if("function"!=typeof(t||{}).addEventListener)throw new Error("Tracker() received an emitter that does not implement the addEventListener method");if("function"!=typeof(t||{}).removeEventListener)throw new Error("Tracker() received an emitter that does not implement the removeEventListener method")},t.create_listener=function(t,e,r){t.listeners.push([e,r]),t.emitter.addEventListener(e,r)},t.prototype.destroy=function(){var e=this;this.listeners.forEach((function(t){var r=t[0],i=t[1];return e.emitter.removeEventListener(r,i)})),delete this.rq,delete this.emitter,d.remove(t.TRACKERS,this)},t.prototype.put=function(e){return void 0===e&&(e={}),t.merge_metadata(this,e),this},t.TRACKERS=[],t.QUEUE=o.default,t.verb=Me.Verb,t}();e.default=c})),Ne=ke((function(t,e){var r=Re&&Re.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),i=Re&&Re.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),n=Re&&Re.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&r(e,t,n);return i(e,t),e},s=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0,e.API=e.Tracker=void 0;var a=s(Fe);e.Tracker=a.default;var o=n(Pe);e.API=o})),Ue="ping",Be="display",Ge="view";const je=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],He=["created","position"],Ke=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];function Ve(t,e){return t.duration/1===t.duration&&Object.assign(e,function(t){const e=t/100;return{segment_duration:e,breakpoints:Array(...Array(100)).map((function(t,r){return Math.floor(r*e*1e3)/1e3}))}}(t.duration))}function qe(t,e,r){if(!e.segment_duration&&!Ve(t,e))return;const i=function(t,e,r){const i=e.last_idx,n=r?99:We(t,e);return e.last_idx=n,n<=i?[]:e.breakpoints.slice(i,99==n?100:n).map((function(t){return e.breakpoints.indexOf(t)}))}(t,e,r);0!=i.length&&t.emit(Ue,{position:i})}function We(t,e){return Math.min(Math.floor(t.currentTime/e.segment_duration),99)}const ze="vod",Ye="live",Xe=[Be,Ue,Ge];function Qe(t,e,r){switch(null==e?void 0:e.kind){case"live":return function(t,e){const r=Date.now();r-e.last_tracked_ts<6e4||(e.last_tracked_ts=r,++e.ticks,t.emit(Ue,{position:60*e.ticks}))}(t,e);case"vod":return qe(t,e,"boolean"==typeof r&&r)}}function $e(t){const e=t.ads;return void 0!==e&&(void 0!==e.schedule&&("function"==typeof e.hasPreroll&&(e.currentRequests?e.currentRequests:!!e.adPlaying||!(!e.hasPreroll()||0!=e.nextIndex))))}function Ze(){try{return window.location!==window.parent.location?document.referrer:document.location.href}catch(t){return!1}}class Analytics$1{init(t,e,r){if(!de.from_token(t.token||"").is_granted(de.permissions.ANALYTICS))return;if(r.hasState("consent-no-tracking"))return;if(r.analytics)return;const i=r.analytics={ticker:void 0,last_media_id:"",ended:!1},n={locked:!1,ttl:6e3,task:()=>{Qe(r,i.ticker)}};const s={session_id:r.deviceId(),autoplay:r.autoplay,muted:r.muted,player_id:t.player_id,customer_user_id:t.customer_user_id,player_version:"3.2.8"},a=Ne.Tracker.of(r,{verb:Ne.Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:Xe,required_keys:je,optional_keys:Ke.concat(He).slice(0),metadata:s});r.on(L,(function(){a&&a.destroy()})),r.on(w,(function(e){if(!a)return;const n=Ft(e,"data.metadata",{});if(!n.media_id)return;const s=Ft(a,"metadata.media_id");if(s&&n.media_id==s)return;const o=Ft(t,"analytics",{});a.put(n),a.put(o);const l=Ft(t,"metadata.live_start_time",t.live)?Ye:ze;a.put({video_type:l,source:t.source||Ze()||""}),i.ticker=t.live?{ticks:0,last_tracked_ts:Date.now(),kind:"live"}:{last_idx:0,segment_duration:0,breakpoints:[],kind:"vod"},i.ended=!1,r.emit(Be)}));let o=0;r.on(E,(function(){if(!a)return;if(o||function(t,e){return t.metadata.media_id&&t.metadata.media_id==e.last_media_id}(a,i))return;a.put({muted:r.muted});const t=$e(r);if(t)return o=Promise.resolve(t).then((function(){i.last_media_id=a.metadata.media_id,r.emit(Ge),o=0})).catch((function(){o=0}));i.last_media_id=a.metadata.media_id,r.emit(Ge)})),r.on("timeupdate",(function(){var e;a&&(o||$e(r)||i.ended||(!t.live&&r.currentTime+.25>=r.duration&&Qe(r,i.ticker,!0),(e=n).locked||(e.locked=setTimeout((function(){return e.task(),function(t){return t.locked=!1,t}(e)}),e.ttl))))})),r.on(b,(function(){a&&i.ticker&&"vod"==i.ticker.kind&&function(t,e){Ve(t,e),e.last_idx=We(t,e)}(r,i.ticker)})),r.on(S,(function(){a&&function(t,e){e.ended||(e.ended=!0,Qe(t,e.ticker))}(r,i)}))}}var Je;function tr(t){switch(t){case Je.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case Je.MEDIA_ERR_NETWORK:return"a network error occurred";case Je.MEDIA_ERR_DECODE:return"unable to decode media content";case Je.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case Je.NO_INTERNET:return"no internet connection detected";case Je.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}function er(){}function rr(){return"https:"===location.protocol}function ir(t){const e=document.createElement("a");return e.href=t,e}function nr(t){try{return!!new URL(t)}catch(t){return!1}}re(ie(),Analytics$1),"undefined"!=typeof window&&window.matchMedia&&[R,D].forEach((function(t){window.matchMedia("(orientation: "+t+")").addListener((function(r){e.length&&e.forEach((function(e){r.matches&&e.emit(t)}))}))})),function(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",t[t.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",t[t.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",t[t.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",t[t.MIXED_CONTENT=1001]="MIXED_CONTENT",t[t.NO_INTERNET=1002]="NO_INTERNET"}(Je||(Je={}));function sr(t,e){if(e.message)return e.message;if(e.stack)return e.stack;const r=e.code||-1,i=tr(r);return t.i18n("media_errors."+r,i)}const ar=()=>!0===(navigator||{}).onLine;function or(t,e,r){const n=r.togglePlay;r.on(i,(function(t){const e=t.data||r.error,s="Error: %s\n"+(null===(a=(new Error).stack)||void 0===a?void 0:a.split("\n").slice(2).join("\n"));var a;setTimeout((function(){const a=Pt(r,O);if(t.defaultPrevented||!a||r.root.querySelector("#qul_error"))return;if("AbortError"==e.name)return;r.setState("is-error",!0),r.togglePlay=er;const o=function(t,e){return{code:"http:0"===e.code?lr(t):e.code,message:sr(t,e)}}(r,e);console.error(s,o.message);let l=Pt(r,"flowplayer-error");l||(l=pt(r,"flowplayer-error"),a.append(l)),Wt(l,i,{data:e,formatted_data:o}),r.once(m,()=>{r.togglePlay=n,r.setState("is-error",!1),null==l||l.remove()})}))}))}function lr(t){return function(t){try{return rr()&&"http:"==ir(t).protocol}catch(t){return!1}}(t.original_src)?{code:Je.MIXED_CONTENT}:ar()?{code:Je.MEDIA_ERR_NETWORK}:ar()?{code:Je.UNKNOWN}:{code:Je.NO_INTERNET}}var ur=Object.freeze({__proto__:null,NO_FULLSCREEN:1,NO_VOLUME_CONTROL:2,NO_MUTE:4,LOGO_ON_RIGHT:8,USE_DRAG_HANDLE:16,USE_PLAY_2:32,USE_PLAY_3:64,USE_THIN_CONTROLBAR:128,NO_TITLE:256,NO_DESCRIPTION:512,NO_CONTROLS:1024,NO_DURATION:2048,NO_HEADER:4096,AUDIO_ONLY:8192,NO_TOUCH_ZONES:16384});function dr(t,e,r){let i=()=>document.fullscreenElement,n="fullscreenchange";if(!Element.prototype.requestFullscreen){const t=Element.prototype,e=document;t.webkitRequestFullScreen&&(t.requestFullscreen=t.webkitRequestFullScreen,e.fullscreenEnabled=!0),e.webkitCancelFullScreen&&(document.exitFullscreen=e.webkitCancelFullScreen),n="webkit"+n,i=()=>e.webkitCurrentFullScreenElement}const a=()=>r.getFullsceenTarget?r.getFullsceenTarget():e;r.toggleFullScreen=function(t,i){if(r.ios_fullscreen_disabled)return;if("boolean"!=typeof t&&(t=!r.hasState("is-fullscreen")),cr(r)&&(t?function(t){t.getAttribute("playsinline")&&t.removeAttribute("playsinline");t.getAttribute("webkit-playsinline")&&t.removeAttribute("webkit-playsinline");t.webkitEnterFullScreen()}(r):function(t,e){t.getAttribute("playsinline")||t.setAttribute("playsinline","");t.getAttribute("webkit-playsinline")||t.setAttribute("webkit-playsinline","");e||t.webkitExitFullScreen();t.togglePlay(!1),t.hasState(st)||t.setState(st,!0)}(r,i)),!document.fullscreenEnabled)return;const n=a();if(t)return n.requestFullscreen();n!==e&&n!==r||document.exitFullscreen()},cr(r)&&(r.ios_fullscreen_disabled=!0,r.once("beforeplay",(function(){r.ios_fullscreen_disabled=!1})),r.on("webkitendfullscreen",(function(){r.toggleFullScreen(!1,!0)}))),setTimeout(()=>{const t=a();t.addEventListener(n,(function(){const e=i(),n=e===t||e==r;r.emit(n?h:f),r.setState("is-fullscreen",n)}))},0),!1!==t.doubleclick&&e.addEventListener(s,(function(t){var e;t.target&&(null===(e=t.target)||void 0===e?void 0:e.classList.contains("fp-ui"))&&r.toggleFullScreen()}))}function cr(t){return r().ios&&"function"==typeof t.webkitEnterFullScreen&&"function"==typeof t.webkitExitFullScreen}function hr(t,e){const r=t.seekable;if("object"!=typeof t.opts||0==r.length)return{head:0,tail:0};const i=r.end(r.length-1),n=e||t.live_state.dvr_window;return{head:i,tail:"number"!=typeof n||i-n<0?r.start(0):i-n}}function fr(t){return t.opt("live",!1)||t.duration>=Number.MAX_SAFE_INTEGER}function pr(t){return isFinite(t.duration)?t.duration:0==t.seekable.length?0:hr(t).head}function gr(t){return function(t){return hr(t).head}(t)-.5}function vr(t,e,r){if(!r.reaper)return;const i=document.createDocumentFragment(),n=pt(r,O);i.appendChild(n),r.reaper.set("ui",n),~e.className.indexOf("use-play-")||e.classList.add("use-play-1"),function(t,e,r){const i=Mt("fp-footer");e.append(i),r.on(w,(function(t){var e,r;const n=null===(e=t.data)||void 0===e?void 0:e.description,s=null===(r=t.data)||void 0===r?void 0:r.title;if(i.innerHTML="","string"==typeof s){const t=Mt("fp-title");t.innerText=s,i.append(t)}if("string"==typeof n){const t=n.split(" "),e=Mt("fp-desc");for(e.innerText=t.join(" "),i.append(e);t.length>1&&e.scrollHeight>e.offsetHeight;)t.pop(),e.innerText=t.join(" ")+"..."}}))}(0,e,r),or(0,0,r),e.appendChild(i),[o,l].forEach(t=>{e.addEventListener(t,(function(t){r.setState("is-hovered",t.type==o),r.setState("is-accessibility",!1)}))}),dr(t,e,r),r.on("volumechange",(function(){const t=0==r.volume||r.muted;r.setState("is-muted",t),r._storage.setItem("mute",t.toString())})),"true"==r._storage.getItem("mute")&&(r.muted=!0,r.setState("is-muted",r.muted));const s=r._storage.getItem("volume");s&&!isNaN(Number(s))&&(r.volume=Number(s)),r.emit("volumechange"),r.on("dvr/window",e=>{t.live&&!1!==r.live_state.dvr&&function(t,e,r){if(0==e)return!0;const i=hr(t,r);return i.head-i.tail>=e}(r,t.seconds_to_dvr||60,e.detail)&&(r.live_state.dvr=r.seekable.length>0,r.live_state.dvr_window=e.detail)}),r.on("live",()=>{const t=setInterval(()=>{if(r.opts.live&&!r.hasState("is-error")&&0!=r.reaper||clearInterval(t),0==r.seekable.length)return;const e=function(t){var e;const r=t.currentTime,i=hr(t),n=!t.hasState("is-chromecast-playing")&&(null===(e=t.hls)||void 0===e?void 0:e.liveSyncPosition);return{progress:Math.min(100,Math.max(0,(r-i.tail)/(i.head-i.tail)*100)),is_live:r-(n||i.head)>=-10}}(r);r.hasState(it)==e.is_live&&r.setState(it,!e.is_live),r.live_state.dvr&&r.emit("dvr",e.progress)},200)}),r.on(p,(function(){r.setOpts({live:fr(r)})})),r.on("durationchange",(function(t){const e=fr(r),i=e?pr(r):t.data||r.duration;isNaN(i)||r.setOpts({live:e,duration:i})})),r.on(w,(function(r){var i,n;t.seekable=void 0===(null===(i=null==r?void 0:r.data)||void 0===i?void 0:i.seekable)||r.data.seekable;const s=null===(n=r.data)||void 0===n?void 0:n.ui;if("number"!=typeof s)return;const a=e.classList;a.toggle("use-play-1",!(32&s||64&s)),a.toggle("use-play-2",(32&s)>0),a.toggle("use-play-3",(64&s)>0),a.toggle("use-thin-controlbar",(128&s)>0),a.toggle("no-title",(256&s)>0),a.toggle("no-description",(512&s)>0),a.toggle("logo-on-right",(8&s)>0),a.toggle("use-drag-handle",(16&s)>0),a.toggle("no-controls",(1024&s)>0),a.toggle("no-duration",(2048&s)>0),a.toggle("no-header",(4096&s)>0),a.toggle("no-mute",(4&s)>0),a.toggle("no-volume",(2&s)>0),a.toggle("no-fullscreen",(1&s)>0),a.toggle("no-touch-zones",(16384&s)>0)}));let a=null;[u,d].forEach(t=>n.addEventListener(t,(function(t){r.hasState("is-touch-device")&&t.type===u||("number"==typeof a&&clearTimeout(a),r.setState("is-hovered",!0),a=0==r.paused&&setTimeout((function(){r.setState("is-hovered",!1)}),2e3))})))}function mr(t,e,r){if(de.from_token(t.token||"").is_granted(de.permissions.NO_METERING))return;const i=oe.id(t.token||"");i&&r.once(E,()=>function(t,e){fetch("https://pmi.flowplayer.com/in",{method:"POST",body:JSON.stringify({token_id:e,factor:1,rnd:Math.random().toString(36).substring(2)})}).then(e=>{401==e.status&&t.emit("error:fatal",{reason:"token",details:"The token online validation failed"})})}(r,i))}var yr={ads:{ad:"Ad",ads:"Ads",advertisement:"Advertisement"},audio:{button_txt:"Audio",menu_title:"Audio"},core:{exit_fullscreen:"Exit fullscreen",fullscreen:"Fullscreen",mute:"Mute",pause:"Pause",play:"Play",unmute:"Unmute",volume:"Volume"},ovp:{starting_in:"Countdown"},playlist:{cancel:"Cancel",up_next:"Up next"},qsel:{menu_title:"Quality"},share:{clipboard_failure:"Access to clipboard failed",clipboard_success:"The text is now on your clipboard",embed:"Embed",link:"Link",menu_title:"Share"},speed:{menu_title:"Speed"}};class I18n{init(t,e,r){r.reaper&&r.reaper.set("translations",Gt(I18n,t,"en"))}}I18n.en=yr;const Er="health:record",Tr="rebuffer";var _r=Object.freeze({__proto__:null,RECORD:Er,REBUFFER:Tr});function Sr(t,e){const r=function(){try{return localStorage.getItem("flowplayer/debug")}catch(t){return""}}(),i=(i,...n)=>{const s=(null==e?void 0:e.debug)||r;s&&t.match(s)&&console.log(`${t} -- ${i}`,...n)};return i.log=i,i}const br=navigator;function Ar(t){var e,r;const i=null===(e=t.hls)||void 0===e?void 0:e.bandwidthEstimate;return i?1e-6*i:(null===(r=br.connection)||void 0===r?void 0:r.downlink)||-1}function Lr(t,e){return function(t,e){return"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(t,e)}(t,JSON.stringify({events:e}))}const wr="https://ljsp.lwcdn.com".concat("/web/public/countdown/time.json"),Rr=window,Dr=Rr._flowplayerTimekeeper||(Rr._flowplayerTimekeeper={});async function kr(){const t=Dr.cachedServerOffset;if(t)return t;const e=Dr.pendingRequest||(Dr.pendingRequest=fetch(wr)),r=await e,i=parseInt(r.headers.get("age")||"0"),n=await r.json(),s=Date.now()-n.millisUtc-1e3*i;return Dr.cachedServerOffset=s,Dr.cachedServerOffset}const Or=t=>{switch(t){case!0:return mt.ON;case!1:return mt.OFF;default:return t}},Ir=[];function Cr(t){if(t.suspended)return;const e=Ir.slice(0);Ir.length=0,0!=e.length&&(t.logger.log(`:dispatch events={${e.length}}`),Lr("https://ihi.flowplayer.com/v1/health/events",e))}async function Pr(t,e,r){const i=await Mr();Ir.push(Object.assign(e,i)),t.logger.log(":enqueue",e.event,e),Ir.length<10&&!r||Cr(t)}const xr=()=>{var t,e;try{const r=window;return null===(e=null===(t=null==r?void 0:r.google)||void 0===t?void 0:t.ima)||void 0===e?void 0:e.VERSION}catch(t){return}},Mr=async()=>{const t=Date.now();try{return{adjusted_time:t-await kr(),client_time:t}}catch(e){return{client_time:t}}},Fr=(t,e)=>Object.assign(t,{detail:e}),Nr=(t,{event:e,media_session_id:r,session_id:i})=>({event:e,media_session_id:r,session_id:i,device_id:t.deviceId(),version:"3.2.8",commit:"7e733a5ef06816f5a96f8e27c1ef7927fc55599b",ima_sdk_version:xr(),preload:t.opt("preload"),autoplay:Or(t.opt("autoplay")),live:t.opt("live"),dvr:!!t.live_state.dvr,source:t.original_src,downlink_mbs:Ar(t),player_id:t.opt("metadata.player_id"),media_id:t.opt("metadata.media_id"),site_id:t.opt("metadata.site_id"),category_id:t.opt("metadata.category_id"),sitegroup_id:t.opt("metadata.sitegroup_id"),token:t.token,plugins:t.plugins.map(t=>t.constructor.name).sort((t,e)=>t.localeCompare(e)),current_time:t.currentTime,external_media_id:t.opt("external_media_id")}),Ur=t=>({bitrate:null==t?void 0:t.bitrate,resolution:null==t?void 0:t.attrs.RESOLUTION,frame_rate:null==t?void 0:t.attrs["FRAME-RATE"]});function Br(t,e,r,i){const n=Nr(e,t.eventInfo(r)),{before:s,after:a}=i;Pr(t,((t,e,r)=>Object.assign(t,{state:{before:e,after:r}}))(n,Ur(s),Ur(a)))}const Gr=(t,e)=>{let r=null;return(...i)=>{null!==r&&(clearTimeout(r),r=null),r=setTimeout(()=>e(...i),t)}},jr=Ht();class Health{constructor(t,e){this.session_id=jr,this.suspended=!1,this.logger=Sr("health",e.opts),this.media_session_id=Ht(),this.analyticsLoop=setInterval(()=>Cr(this),2e3),e.on(L,()=>clearInterval(this.analyticsLoop));const r=this;if(e.health={get media_session_id(){return r.media_session_id},set media_session_id(t){r.media_session_id=t},get session_id(){return r.session_id},set session_id(t){r.session_id=t},toggle(t){t?r.resume():r.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const e=e=>t.instances.forEach(t=>t.emit(e.type));document.addEventListener("visibilitychange",t=>{"hidden"==document.visibilityState&&e(t)}),window.addEventListener("pagehide",e)}}eventInfo(t){return{event:t,media_session_id:this.media_session_id,session_id:this.session_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>Cr(this),2e3)}init(t,e,r){!function(t){t.on(T,(function(e){t.seeking||t.networkState===t.NETWORK_LOADING&&t.readyState!==t.HAVE_NOTHING&&t.emit(Tr)}))}(r),r.on(Er,({detail:t})=>{const e=Nr(r,this.eventInfo(t.event));Object.assign(e,t.detail||{}),Pr(this,e)}),[_,m,a,p,g,v,T,Tr].forEach(t=>{r.on(t,t=>{Pr(this,Nr(r,this.eventInfo(t.type)))})}),[E,y,A,b,S,h,f].forEach(t=>{r.on(t,t=>{Pr(this,Nr(r,this.eventInfo(t.type)))})}),r.on("volumechange",Gr(800,t=>{const e=Nr(r,this.eventInfo(t.type));Pr(this,Fr(e,{volume:parseFloat(r.volume.toFixed(2)),muted:r.muted}))})),r.on("resize",Gr(800,t=>{const i=Nr(r,this.eventInfo(t.type));Pr(this,Fr(i,{height:e.clientHeight,width:e.clientWidth}))})),r.on("qualitychange",({type:t,detail:e})=>{switch(e.kind){case"hls":return Br(this,r,t,e)}});let n=Date.now()+5e3;r.on("timeupdate",t=>{if(Date.now()<n)return;n=Date.now()+5e3;const e=Nr(r,this.eventInfo(t.type));var i;Pr(this,Fr(e,{duration:(i=r.duration,Number.isFinite(i)?i:i===1/0?-1:void 0)}))}),r.addEventListener(i,t=>{const e=Nr(r,this.eventInfo(t.type)),i=t.error||r.error;if(!i)return Pr(this,e,!0);const n=i.code,s={error_message:i.message||tr(n),error_code:n,error_stack:i.stack||""};return Pr(this,Fr(e,s),!0)}),r.on("src",t=>{var e;const i=null===(e=t.detail)||void 0===e?void 0:e.src;if("string"!=typeof i)return;if(!nr(r.original_src))return;if(!nr(i))return;if(i==r.original_src)return;this.media_session_id=Ht();Pr(this,Nr(r,this.eventInfo(t.type))),Cr(this)}),r.on("visibilitychange",t=>{Pr(this,Nr(r,this.eventInfo(t.type))),Cr(this)})}}Health.events=_r,Health._UNLOAD_SUBSCRIBED=!1,re(window,Health);class FlowplayerComponent extends HTMLElement{constructor(t){super(),this.player=t}}class FlowplayerPrimary extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-primary");const e={logo:""};t.on(w,t=>{var r,i;const n=e.logo,s=(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.logo)||"";n!=s&&(e.logo=s,this.set_logo(s,null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.logo_href))})}set_logo(t,e){if(this.innerHTML="",!t)return;const r=document.createElement("img");if(r.classList.add("fp-logo"),r.src=t,!e)return this.append(r);const i=document.createElement("a");i.href=e,i.append(r),this.append(i)}}class FlowplayerHeaderDuration extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-duration"),t.on(w,t=>{var e;const r=(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.duration)||NaN;this.innerText=isFinite(r)?Ut(r):""})}}const Hr={name:"fp-fullscreen",translation_key:"core.fullscreen"},Kr={name:"fp-fullscreen-exit",translation_key:"core.exit_fullscreen"},Vr={name:"fp-play",translation_key:"core.play"},qr={name:"fp-pause",translation_key:"core.pause"},Wr={translation_key:"core.mute",name:"fp-volume-mute-unmute"},zr={translation_key:"core.play",name:"fp-small-play"},Yr={translation_key:"core.pause",name:"fp-small-pause"},Xr={name:"fp-fast-forward"},Qr={name:"fp-rewind"};class FlowplayerIcon extends FlowplayerComponent{constructor(t,e){super(t),this.classList.add("fp-icon",e.name),e.title&&this.setAttribute("title",e.title),e.title&&this.setAttribute("aria-label",e.title),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}document.addEventListener(n,(function(t){this.active_menu&&!t.composedPath().includes(this.active_menu)&&(Array.from(document.querySelectorAll(".fp-engine")).forEach(t=>{const e=t.root.querySelector("details[open].fp-menu-container");e&&(e.open=!1,t.root.classList.toggle("has-menu-opened",!1))}),this.active_menu=void 0)}));const $r={passive:!0};var Zr;function Jr(t,e){let r=0,i=-1,n=-1;const s=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5),a=t.classList;t.id=s,a.remove(Zr.GRABBING),a.remove(Zr.TOUCHING);const o=e.onseek||er,l=e.onstart||er,h=e.onend||er,f=e.onmouse||er,p=e.ontouch||er,g=e.ontouchend||er;function v(e){!function(){const e=t.getBoundingClientRect();r=e.left,i=e.width}();let n=(function(t){return"function"==typeof window.TouchEvent&&t instanceof TouchEvent}(e)?e.changedTouches[0].pageX:e.pageX)-r;return n>i&&(n=i),n<0&&(n=0),n/i*100}function m(e){const r=v(e);r!=n&&(o(t,r),n=r)}return t.addEventListener("touchstart",(function(e){ti(t,e)&&(a.add(Zr.TOUCHING),ei(t.parentElement)&&(a.add(Zr.GRABBING),p(t,v(e)),l(t,v(e)),m(e)))}),$r),t.addEventListener(d,(function(e){m(e),f(t,v(e))}),$r),t.addEventListener(c,(function(e){setTimeout((function(){a.remove(Zr.TOUCHING)}),500),ti(t,e)&&(a.remove(Zr.GRABBING),g(t,v(e)),h(t,v(e)),i=0)}),$r),t.addEventListener("touchcancel",(function(){a.remove(Zr.GRABBING,Zr.TOUCHING),i=0}),$r),t.addEventListener("mousedown",(function(e){a.contains(Zr.TOUCHING)||(document.addEventListener(u,m),a.add(Zr.GRABBING),l(t,v(e)),e.preventDefault(),m(e))})),t.addEventListener(u,(function(e){a.contains(Zr.TOUCHING)||f(t,v(e))})),document.addEventListener("mouseup",(function(e){a.contains(Zr.TOUCHING)||(document.removeEventListener(u,m),a.contains(Zr.GRABBING)&&(a.remove(Zr.GRABBING),h(t,v(e)),i=0))})),t}function ti(t,e){const r=e.target;return!!r&&(r&&!r.closest(t.id)||!ei(t.parentElement)||!t.classList.contains(Zr.TOUCHING))}function ei(t){if(!t)return!1;const e=window.getComputedStyle(t);return"0"!==e.width&&"0"!==e.height&&"0"!==e.opacity&&"none"!==e.display&&"hidden"!==e.visibility}!function(t){t.GRABBING="has-grab",t.TOUCHING="has-touch"}(Zr||(Zr={}));class FlowplayerVolumeBar extends FlowplayerComponent{constructor(t){super(t),this.className="fp-volume";const e=t.root.classList,r=e.contains("is-tiny")?6:e.contains("is-small")?8:10,i=Array.from({length:r}).map(()=>{const t=document.createElement("i");return t.className="fp-tick",t});this.append(...i),Jr(this,{onseek:(e,r)=>{r>0&&(t.muted=!1,t._storage.removeItem("mute")),t._storage.setItem("volume",(t.volume=r/100).toString()),this.adjustVolumeSlider(t.volume)}}),this.setAttribute("tabindex","0"),this.setAttribute("role","slider"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax","1"),this.setAttribute("aria-label",t.i18n("core.volume","volume")),t.on("volumechange",()=>{const e=0==t.volume||t.muted;e&&this.adjustVolumeSlider(0);const r=t.opt("ui");this.classList.contains(Zr.GRABBING)||e&&"number"==typeof r&&(4&r)>0||this.adjustVolumeSlider(t.volume)})}adjustVolumeSlider(t){this.setAttribute("aria-valuenow",t.toString());const e=Array.from(this.querySelectorAll(".fp-tick")),r=Math.round(t*e.length);e.forEach((t,e)=>{t.classList.toggle("fp-color",e<r)})}}function ri(t,e){if(!t.parentElement)return;const r=t.clientWidth/t.parentElement.clientWidth*100/2;t.style.left=e-r+"%",t.style.display="block"}function ii(t,e){if(isNaN(t.duration))return;const r=t.buffered;r.length&&(e.style.width=Math.min(r.end(r.length-1)/t.duration*100,100)+"%")}function ni(t,e){t.style.width="0",e.style.display="none"}function si(t,e,r){if(!e.seekable||0==e.seekable.length)return;ri(r,t);const i=hr(e),n=(100-Math.max(0,Math.min(t,100)))/100*(i.head-i.tail);r.innerText="-"+Ut(n)}function ai(t,e){t/=100,e.currentTime=function(t,e){if(e>1||e<0)return console.warn("cannot calculate a percent outside of range(0..1)"),0;const r=hr(t);return r.tail+e*(r.head-r.tail)}(e,t)}function oi(t,e){t.style.width="0",e.style.display="none"}class FlowplayerTimelineBar extends FlowplayerComponent{constructor(t){let e;super(t),this.bufferEle=Mt("fp-buffer"),this.progress=Mt("fp-progress","fp-color"),this.tooltipEle=Mt("fp-timestamp"),this.proposedSeekBar=Mt("fp-hover"),this.dragger=Mt("fp-dragger","fp-color"),this.classList.add("fp-timeline","fp-bar"),this.tooltipEle.style.display="none",this.setAttribute("role","slider"),this.setAttribute("tabindex","0"),this.setAttribute("aria-label",t.i18n("timeline","Timeline")),this.progress.append(this.dragger),this.append(this.bufferEle,this.progress,this.proposedSeekBar,this.tooltipEle);let r=!1;const i=requestAnimationFrame;let n=void 0;const s=()=>{0==t.reaper||e.live||(!function(t,e){e.style.width=t.currentTime/t.duration*100+"%"}(t,this.progress),n=void 0,t.paused||this.classList.contains(Zr.GRABBING)||n||(n=setTimeout(s,200)))},a=()=>!!this.player.opt("seekable",!0)&&!isNaN(this.player.duration);Jr(this,{onseek:(r,i)=>{if(a())switch(!!e.live){case!0:si(i,t,this.tooltipEle);break;case!1:!function(t,e,r){const i=e.duration*(t/100);if(e.disabled&&i>e.currentTime)return!1;r.style.width=t+"%",e.currentTime=i}(i,t,this.progress),ri(this.tooltipEle,i)}},onstart:()=>{a()&&(t.emit("timeline/gesture/start"),!t.hasState("is-casting")&&t.setState(tt,!0),e.live||function(t){t.style.display="block"}(this.tooltipEle))},onend:function(r,n){i(s),0!=e.seekable&&e.live&&ai(n,t)},ontouch:function(){t.paused||(r=!0,t.pause())},ontouchend:()=>{r&&(r=!1,t.play()),e.live?oi(this.proposedSeekBar,this.tooltipEle):ni(this.proposedSeekBar,this.tooltipEle),setTimeout(()=>t.emit("timeline/gesture/end"),0)},onmouse:(r,i)=>{if(a()&&(t.emit("timeline/gesture/move",{percent:i}),!this.classList.contains(Zr.GRABBING)))switch(!!e.live){case!0:!function(t,e){e.style.width=t+"%"}(i,this.proposedSeekBar),si(i,t,this.tooltipEle);break;case!1:!function(t,e){e.style.width=t+"%"}(i,this.proposedSeekBar),function(t,e,r){if(isNaN(t)||isNaN(e.duration))return;ri(r,t),r.innerHTML="";const i=document.createElement("span");i.innerText=Ut(t/100*e.duration),r.append(i)}(i,t,this.tooltipEle)}}}),t.on(w,(function(t){t.data&&(e=t.data)})),t.on(E,()=>i(s)),t.on(v,()=>{0==t.reaper||e.live||ii(t,this.bufferEle)}),t.on("dvr",t=>{this.progress.style.width=t.detail+"%"}),t.on("timeupdate",()=>{0!=t.reaper&&(i(s),this.setAttribute("aria-valuenow",t.currentTime+""),e.live||ii(t,this.bufferEle))}),t.on(p,()=>{0!=t.reaper&&(e.live||ii(t,this.bufferEle))}),t.on("durationchange",e=>{if(0==t.reaper)return;const r=fr(t)?pr(t):e.data||t.duration;isNaN(r)||(this.setAttribute("aria-valuemax",r+""),this.setAttribute("aria-valuemin","0"))}),this.addEventListener(l,()=>{t.emit("timeline/gesture/end"),e.live?oi(this.proposedSeekBar,this.tooltipEle):ni(this.proposedSeekBar,this.tooltipEle)})}}class FlowplayerChaptersTimelineBar extends FlowplayerTimelineBar{constructor(t){super(t),this.handleChapters(t)}handleChapters(t){const e=document.createElement("div");let r;this.addEventListener("chapters:new",t=>{e.innerText="",this.querySelectorAll(".fp-chapter").forEach(t=>this.removeChild(t)),t.data&&t.data.forEach(t=>{const i=document.createElement("div");i.className="fp-chapter",i.style.left=t.left,i.style.bottom=i.style.top="0",i.style.width=t.width,i.title=t.title,i.onmouseover=()=>{e.innerText=t.title},i.onmouseleave=()=>{e.innerText=r||""},this.appendChild(i)})}),this.addEventListener("chapter:changed",i=>{var n;const s=i.data;s&&(e.parentNode||(null===(n=Pt(t,I))||void 0===n||n.insertAdjacentElement("beforebegin",e),e.classList.toggle("fp-togglable",!0),e.classList.toggle("fp-chapter-info",!0)),r=s,e.innerText=s)})}}class FlowplayerLiveStatus extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-live-status");const e=Mt("fp-live-text"),r=Mt("fp-live-indicator","fp-color");e.textContent="live",this.append(r,e),this.addEventListener(n,(function(){!function(t){try{t.dvr_offset=0,t.currentTime=gr(t)}catch(t){console.warn("failed to seek to now: %j",t)}}(t)}))}}class FlowplayerDuration extends FlowplayerComponent{constructor(t){let e;super(t),this.classList.add("fp-duration"),t.on(w,r=>{if(0==t.reaper||!r.data)return;e=r.data;const i=fr(t)?NaN:r.data.duration||0;if(isNaN(i)||i>=Number.MAX_SAFE_INTEGER)return this.style.display="none";this.style.display="inline-block",this.innerText=Ut(i)}),t.on(p,()=>{0==t.reaper||e.live||function(t,e){t.duration&&(e.innerText=Ut(t.duration))}(t,this)})}}class FlowplayerElapsedTime extends FlowplayerComponent{constructor(t){let e;super(t),this.classList.add("fp-elapsed"),this.innerText=Ut(0),t.on(w,t=>{t.data&&(e=t.data)}),t.on("timeupdate",()=>{0!=t.reaper&&(e.live?function(t,e){e.innerText=Ut(t.currentTime)}(t,this):function(t,e){e.innerText=Ut(t.currentTime)}(t,this))})}}class FlowplayerControlButtons extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-btns","fp-small-switch");const e=pt(t,H),r=pt(t,j);e.addEventListener("click",(function(){t.togglePlay(),setTimeout((function(){r.focus&&r.focus()}),100)})),r.addEventListener("click",(function(){t.togglePlay(),setTimeout((function(){e.focus&&e.focus()}),100)})),this.append(e,r)}}class FlowplayerLeftRightZone extends FlowplayerComponent{constructor(t,e){super(t),this.classList.add(e);const r=this.classList.contains("fp-left-zone")?-1:1,i=document.createElement("span"),n=pt(t,this.classList.contains("fp-left-zone")?q:"flowplayer-fast-forward-icon");n.removeAttribute("tabindex"),i.classList.add("fp-zone-seconds"),this.append(i,n);t.on(b,()=>{i.innerText=""}),t.on("seek:queued",t=>{const e=t.data;if(!e)return;if("number"!=typeof e.offset)return;const r=e.offset;if(0==r)return this.reset_zone();r>0&&this.classList.contains("fp-right-zone")||r<0&&!this.classList.contains("fp-right-zone")?this.render_zone_state(r):this.reset_zone()}),t.on("seek:cancel",()=>{this.reset_zone()}),this.reset_zone(),this.addEventListener(c,(function(e){isNaN(t.duration)||isNaN(t.currentTime)||16384&t.opt("ui")||t.hasState(nt)||!t.hasState("will-seek")&&!t.hasState(st)||t.enqueueSeek(5*r)&&(e.stopPropagation(),e.preventDefault())}))}reset_zone(){const t=this.querySelector(".fp-zone-seconds");t&&(t.innerText="")}render_zone_state(t){const e=this.querySelector(".fp-zone-seconds");e&&(e.innerText=Math.abs(t)+"")}}class FlowplayerError extends FlowplayerComponent{constructor(t){super(t),this.className="fp-error",this.message=document.createElement("p"),this.message.className="error-message",this.append(this.message),this.addEventListener("error",t=>{const e=t.detail;e&&(this.message.textContent=e.formatted_data.message)})}}class FlowplayerHeaderLeftRight extends FlowplayerComponent{constructor(t,e,...r){super(t),this.className=e;const i=t.createComponents(...r);this.append(...i),"fp-left"!==e&&i.forEach(e=>{e.addEventListener(n,()=>t.toggleFullScreen())})}}class FlowplayerMiddleWait extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-wait"),Array(...Array(4)).map((t,e)=>e).forEach(()=>{this.append(document.createElement("b"))})}}class FlowplayerMiddleZone extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-middle-zone");const e=t.createComponents(G,"flowplayer-middle-buttons");this.append(...e)}}class FlowplayerMiddleButtons extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-switch"),[K,V].forEach(e=>{const r=pt(t,e);r.removeAttribute("tabindex"),this.append(r)})}}class FlowplayerVolumeControl extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-volume-control");const e=pt(t,W);this.append(e),!r().ios&&this.append(pt(t,"flowplayer-volume-bar")),e instanceof FlowplayerIcon&&e.addEventListener(n,(function(){t.toggleMute()}))}}class FlowplayerHeader extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-header"),this.append(...t.createComponents("flowplayer-header-left-zone",F)),t.reaper&&t.reaper.set("header",this)}}class FlowplayerControls extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-controls","fp-togglable"),this.append(...t.createComponents("flowplayer-control-buttons",C,P,x,"flowplayer-control-duration","flowplayer-volume-control"))}}class FullscreenIcon extends FlowplayerIcon{constructor(t,e){super(t,e),this.setAttribute("role","button"),this.setAttribute("aria-label",t.i18n(e==Hr?"core.fullscreen":"core.fullscreen_exit"))}}class FlowplayerMiddle extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-middle"),this.append(...t.createComponents("flowplayer-middle-left-zone",B,"flowplayer-middle-right-zone")),this.setAttribute("tabindex","0"),this.setAttribute("role","button"),this.setAttribute("aria-label",t.i18n("core.play")),t.reaper&&t.reaper.set("middle",this),this.handleClick(t),this.handleTouch(t),[E,b].forEach(e=>t.once(e,()=>{this.removeAttribute("tabindex"),this.removeAttribute("role"),this.removeAttribute("aria-label")}))}handleClick(t){[n,s].forEach(e=>this.addEventListener(e,(function(e){if(!e.defaultPrevented&&!t.hasState("is-endscreen"))return e.preventDefault(),t.emit(e.type),!1}))),t.on(n,(function(e){setTimeout((function(){e.defaultPrevented||t.hasState(rt)||t.togglePlay()}),0)})),t.on(s,(function(e){setTimeout((function(){e.defaultPrevented||t.toggleFullScreen()}),0)}))}handleTouch(t){let e=!1;this.addEventListener(c,(function(e){e.cancelable&&!t.hasState("is-endscreen")&&(e.preventDefault(),t.emit(e.type,{source:e}))})),t.on(c,(function(r){setTimeout((function(){if(r.defaultPrevented)return;if(t.hasState(rt))return;if(t.ended)return t.togglePlay(!0);const i=t.hasState(J);e&&clearTimeout(e),(i||t.hasState(st)||t.hasState("no-autoplay"))&&(t.hasState(st)&&(t.setState(st,!1),t.setState("is-hovered",!1)),t.togglePlay(),i)||(t.setState(st,!0),t.paused||(e=setTimeout((function(){e=!1,t.setState(st,!1),t.setState("is-hovered",!1)}),2e3)))}),0)}))}}class FlowplayerUi extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-ui"),this.append(...t.createComponents(M,U,I))}}we.extensions.unshift.apply(we.extensions,[I18n,Analytics$1,Health,class Default{constructor(t){gt(t,O,FlowplayerUi),gt(t,"flowplayer-error",FlowplayerError),gt(t,I,FlowplayerControls),gt(t,C,FlowplayerLiveStatus),gt(t,"flowplayer-control-duration",FlowplayerDuration),gt(t,x,t.extensions.find(t=>"Chapters"===t.name)?FlowplayerChaptersTimelineBar:FlowplayerTimelineBar),gt(t,P,FlowplayerElapsedTime),gt(t,"flowplayer-volume-bar",FlowplayerVolumeBar),gt(t,"flowplayer-volume-control",FlowplayerVolumeControl),gt(t,"flowplayer-control-buttons",FlowplayerControlButtons),gt(t,M,FlowplayerHeader),gt(t,N,FlowplayerPrimary),gt(t,"flowplayer-header-duration",FlowplayerHeaderDuration),gt(t,"flowplayer-header-left-zone",class extends FlowplayerHeaderLeftRight{constructor(t){super(t,"fp-left",N,"flowplayer-header-duration")}}),gt(t,F,class extends FlowplayerHeaderLeftRight{constructor(t){super(t,"fp-right fp-togglable","flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon")}}),gt(t,U,FlowplayerMiddle),gt(t,B,FlowplayerMiddleZone),gt(t,G,FlowplayerMiddleWait),gt(t,"flowplayer-middle-buttons",FlowplayerMiddleButtons),gt(t,"flowplayer-middle-right-zone",class extends FlowplayerLeftRightZone{constructor(t){super(t,"fp-right-zone")}}),gt(t,"flowplayer-middle-left-zone",class extends FlowplayerLeftRightZone{constructor(t){super(t,"fp-left-zone")}}),gt(t,j,class extends FlowplayerIcon{constructor(t){super(t,zr),this.setAttribute("role","button")}}),gt(t,H,class extends FlowplayerIcon{constructor(t){super(t,Yr),this.setAttribute("role","button")}}),gt(t,K,class extends FlowplayerIcon{constructor(t){super(t,Vr)}}),gt(t,V,class extends FlowplayerIcon{constructor(t){super(t,qr)}}),gt(t,"flowplayer-fullscreen-enter-icon",class extends FullscreenIcon{constructor(t){super(t,Hr)}}),gt(t,"flowplayer-fullscreen-exit-icon",class extends FullscreenIcon{constructor(t){super(t,Kr)}}),gt(t,"flowplayer-fast-forward-icon",class extends FlowplayerIcon{constructor(t){super(t,Xr)}}),gt(t,q,class extends FlowplayerIcon{constructor(t){super(t,Qr)}}),gt(t,W,class extends FlowplayerIcon{constructor(t){super(t,Wr),this.classList.add("fp-volumebtn"),t.on("volumechange",()=>{const e=0==t.volume||t.muted;this.setAttribute("aria-label",e?t.i18n("unmute","unmute"):t.i18n("mute","mute"))})}})}init(t,e,r){mr(t,0,r),vr(t,e,r),function(t,e,r){"undefined"!=typeof window&&"ontouchstart"in window&&r.setState("is-touch-device",!0),r.setState("is-accessibility",!1)}(0,0,r)}}]);var li=Object.assign(we,{ui:ur,i18n:I18n}),ui=De(ke((function(t,e){var r;"undefined"!=typeof window&&(r=function(){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/dist/",r(r.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":
|
|
2
2
|
/*!*********************************************!*\
|
|
3
3
|
!*** ./node_modules/eventemitter3/index.js ***!
|
|
4
4
|
\*********************************************/
|
|
@@ -354,10 +354,10 @@
|
|
|
354
354
|
/*!*********************************!*\
|
|
355
355
|
!*** ./src/utils/xhr-loader.ts ***!
|
|
356
356
|
\*********************************/
|
|
357
|
-
/*! exports provided: default */function(t,e,r){r.r(e);var i=r(/*! ../utils/logger */"./src/utils/logger.ts"),n=r(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),s=/^age:\s*[\d.]+\s*$/m,a=function(){function t(t){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=t?t.xhrSetup:null,this.stats=new n.LoadStats,this.retryDelay=0}var e=t.prototype;return e.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},e.abortInternal=function(){var t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))},e.abort=function(){var t;this.abortInternal(),null!==(t=this.callbacks)&&void 0!==t&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},e.load=function(t,e,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=r,this.retryDelay=e.retryDelay,this.loadInternal()},e.loadInternal=function(){var t=this.config,e=this.context;if(t){var r=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0;var n=this.xhrSetup;try{if(n)try{n(r,e.url)}catch(t){r.open("GET",e.url,!0),n(r,e.url)}r.readyState||r.open("GET",e.url,!0)}catch(t){return void this.callbacks.onError({code:r.status,text:t.message},e,r)}e.rangeEnd&&r.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),r.onreadystatechange=this.readystatechange.bind(this),r.onprogress=this.loadprogress.bind(this),r.responseType=e.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),t.timeout),r.send()}},e.readystatechange=function(){var t=this.context,e=this.loader,r=this.stats;if(t&&e){var n=e.readyState,s=this.config;if(!r.aborted&&n>=2)if(self.clearTimeout(this.requestTimeout),0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start)),4===n){e.onreadystatechange=null,e.onprogress=null;var a=e.status;if(a>=200&&a<300){var o,l;if(r.loading.end=Math.max(self.performance.now(),r.loading.first),l="arraybuffer"===t.responseType?(o=e.response).byteLength:(o=e.responseText).length,r.loaded=r.total=l,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(r,t,o,e),!this.callbacks)return;var d={url:e.responseURL,data:o};this.callbacks.onSuccess(d,r,t,e)}else r.retry>=s.maxRetry||a>=400&&a<499?(i.logger.error(a+" while loading "+t.url),this.callbacks.onError({code:a,text:e.statusText},t,e)):(i.logger.warn(a+" while loading "+t.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,s.maxRetryDelay),r.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout)}},e.loadtimeout=function(){i.logger.warn("timeout while loading "+this.context.url);var t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))},e.loadprogress=function(t){var e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)},e.getCacheAge=function(){var t=null;if(this.loader&&s.test(this.loader.getAllResponseHeaders())){var e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t},t}();e.default=a}}).default},t.exports=r())})));var ui=Object.freeze({__proto__:null,ATTACHED:"hls:attached"});const di="com.widevine.alpha";const ci="application/vnd.apple.mpegURL",hi=[ci,"application/x-mpegurl"],fi=document.createElement("video").canPlayType(ci);function pi({src:t="",type:e="",drm:r},i){const n=(null==i?void 0:i.hls)||{},s="native"in n&&n.native;return(!fi||!s)&&(!(r&&!Object.keys(r).find(t=>{return e=t,[di].filter((function(t){return t===e})).length;var e}))&&(!(!e||!hi.includes(e))||function(t){const{pathname:e}=er(t);return e.endsWith(".m3u8")}(t)))}var gi="audio:set",vi="audio:update",mi="audio:tracks";const yi=[li.Events.SUBTITLE_TRACKS_UPDATED,li.Events.SUBTITLE_TRACK_SWITCH,li.Events.LEVEL_SWITCHED];function Ei(t,e){yi.forEach((function(r){t.on(r,(function(){!function(t,e){var r;const i=t.levels[t.currentLevel];if(!i||!t.subtitleTracks.length||i.attrs.SUB)return;const n=null===(r=null==i?void 0:i.attrs)||void 0===r?void 0:r.SUBTITLES;if(!n)return e.emit("tracks:text:all",[]);const s=t.subtitleTracks.filter((function(t){return t.groupId==n})).map((function(t){return e.textTracks[t.id]}));e.emit("tracks:text:all",s)}(t,e)}))}))}var Ti=Object.assign(Object.assign({},{404:"the video was not found",403:"access to this video was denied",410:"the video no longer exists",0:"no internet connection detected"}),{keySystemNoKeys:"no keys",keySystemNoAccess:"no access to key system",keySystemNoSession:"no session for key system",keySystemLicenseRequestFailed:"license request failed",keyLoadError:"decrypt key load failed",keyLoadTimeOut:"decrypt key load timed outs"});const _i=_r("hls");function Si(t,e,r){if(!t.reaper||!r.src)return;t.hls&&(t.emit("recover",{type:"hls"}),t.hls.destroy());const n="live"in e==0,s={is_audio_only:!1,fragDuration:-1};if(r.drm&&!tr()&&"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname)return t.emit(i,{message:"Secure page required for DRM"});const a=t.hls=new li(function(t){return Object.assign(Object.assign({autoStartLoad:!1},t.hls),{startPosition:t.start_time||-1})}(e)),o={retry_count:0,previous_url:"",previous_content:""};a.subtitleDisplay=!1,a.attachMedia(t),a.loadSource(r.src),t.emit("hls:attached",{hls:a}),function(t,e){t.on(li.Events.AUDIO_TRACKS_UPDATED,(function(t,r){e.emit(mi,r.audioTracks)})),t.on(li.Events.AUDIO_TRACK_SWITCHING,(function(t,r){e.emit(vi,r)})),t.on(li.Events.MANIFEST_PARSED,(function(t,r){r.audioTracks&&e.emit(mi,r.audioTracks)})),t.on(li.Events.LEVEL_SWITCHED,(function(r,i){const n=t.levels[i.level];n&&e.emit(mi,t.audioTracks.filter((function(t){return t.groupId&&~(n.audioGroupIds||[]).indexOf(t.groupId)})))}))}(a,t),Ei(a,t);const l=function(t){var e;const r=null===(e=t.data)||void 0===e?void 0:e.level;"number"==typeof r&&(a.levels[r]||-1===r?a.nextLevel=r:console.error(new Error("skipping invalid quality: "+t.data)))},u=function(t){var e;const r=null===(e=t.data)||void 0===e?void 0:e.id;"number"==typeof r&&r!=a.audioTrack&&setTimeout((function(){a.audioTrack=r}),0)};t.on("quality:set",l),t.on(gi,u),t.on(b,(function(){t.hls&&t.hls.destroy(),t.off("quality:set",l),t.off(gi,u)})),t.on("audioonlysource",(function(){s.is_audio_only=!0})),t.on(A,(function(){a&&a.destroy()})),t.on("remotesession:started",()=>{t.hls&&t.hls.stopLoad()}),t.on("remotesession:ended",()=>{t.hls&&bi(t)}),n&&a.on(li.Events.LEVEL_LOADED,(function(e,r){t.setOpts({live:r.details.live})})),a.on(li.Events.MANIFEST_PARSED,(function(r,i){const n=i.levels.slice(0).reduce((t,e,r)=>[...t,{level:r,text:e.name||e.width+"",width:e.width,height:e.height,videoCodec:e.videoCodec||""}],[{text:"AUTO",level:-1,width:0,height:0,videoCodec:""}]).sort((t,e)=>e.width-t.width);t.emit("qualities",n),function(t,e,r){var i,n;if(!t.hls)return;_i("Initializer::maybe_start_load_with_quality (start_quality, preload): (%d, %s)",e.start_quality,e.preload),void 0!==e.start_quality&&(gt.HIGH&e.start_quality&&(t.hls.startLevel=r[0].level),gt.LOW&e.start_quality&&(t.hls.startLevel=r[r.length-1].level),gt.MEDIUM&e.start_quality&&(t.hls.startLevel=r[Math.ceil(r.length/2)-1].level));const s=(null===(i=e.hls)||void 0===i?void 0:i.maxBufferSize)||1024,a=(null===(n=e.hls)||void 0===n?void 0:n.maxBufferLength)||30;_i("Setting maxBufferSize to %d",s),t.hls.config.maxBufferSize=s,"metadata"===e.preload&&_i("preload === metadata, setting maxBufferLength to 1sec");if(t.hls.config.maxBufferLength="metadata"===e.preload?1:a,t.once(m,()=>{_i("Playback started, set maxBufferLenght to %d",a),t.hls&&(t.hls.config.maxBufferLength=a)}),"none"===e.preload&&!e.autoplay)return;bi(t,e.start_time||-1)}(t,e,n.slice(0,-1));const s=n.find(t=>!!t.videoCodec);s||t.emit("audioonlysource"),!t.opt("ratio")&&s&&0!=s.width&&0!=s.height&&t.setOpts({ratio:s.width+":"+s.height})})),a.on(li.Events.INIT_PTS_FOUND,(function(t,e){s.fragDuration=e.frag.duration})),a.on(li.Events.ERROR,(function(e,r){!function(t,e,r,n){if(0==t.reaper)return;if(0==e.fatal)return;switch(e.type){case li.ErrorTypes.MEDIA_ERROR:return function(t,e){var r;t.emit(i,{fatal:!0,message:"Unrecoverable error occurred while playing media"}),null===(r=t.hls)||void 0===r||r.destroy()}(t);case li.ErrorTypes.NETWORK_ERROR:return function(t,e){var r;const n=(null===(r=e.networkDetails)||void 0===r?void 0:r.status)||"";t.emit(i,{fatal:!0,code:"http:"+n.toString(),message:Ti[n]||"an error occurred while loading this video"})}(t,e);case li.ErrorTypes.KEY_SYSTEM_ERROR:(function(t,e){var r;t.emit(i,{fatal:!0,message:Ti[e.details]||"an error occurred while accessing this video"}),null===(r=t.hls)||void 0===r||r.destroy()})(t,e)}}(t,r,t.original_src,a.config)})),a.on(li.Events.LEVEL_PTS_UPDATED,(function(e,r){var i;if("video"!==r.type&&(!s.is_audio_only||"audio"!==r.type))return;const n=null===(i=null==r?void 0:r.details)||void 0===i?void 0:i.fragments;if(!n)return;const a=n[0].start||0,o=n[n.length-1].start+n[n.length-1].duration;t.emit("dvr/window",o-a)})),a.on(li.Events.LEVEL_SWITCHING,(e,r)=>{const i=a.levels[a.currentLevel],n=a.levels[r.level];t.emit("qualitychange",{before:i,after:n,kind:"hls"})}),a.on(li.Events.LEVEL_UPDATED,(t,e)=>{e.details.url!==o.previous_url&&(o.retry_count=0),o.previous_url=e.details.url;const r=o.previous_content;if(o.previous_content=e.details.m3u8,r===e.details.m3u8){if(o.retry_count++,o.retry_count<3)return;if(a.levels[e.level].url.length<2)return;a.levelController.redundantFailover(a.currentLevel)}});const d=t.opt("start_time");d&&t.once(h,(function(){t.currentTime=d})),"none"!==e.preload||e.autoplay||t.once("beforeplay",()=>{bi(t,e.start_time||-1)})}function bi(t,e){var r;t.setState($,!0),null===(r=t.hls)||void 0===r||r.startLoad(e)}class HLS{init(){}onload(t,e,r,i){Si(r,t,i)}wants(t,e,r){return li.isSupported()&&pi(e,r)}}HLS.events=ui,HLS.version=li.version,ee(window,HLS);const Ai=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),Li=(...t)=>t.reduce((t,e)=>Ai(e)?(Object.keys(e).forEach(r=>{if(Ai(t[r])&&Ai(e[r]))return t[r]=Li(t[r],e[r]);t[r]=e[r]}),t):t,{});class Pipe{constructor(t){this.data=t}static of(t){return new Pipe(t)}static maybe(t,e,...r){return null==t?t:e.apply(t,[t,...r])}tap(t,...e){return t.apply(this,[this.data,...e]),new Pipe(this.data)}fmap(t,...e){const r=t.apply(this,[this.data,...e]);return new Pipe(r)}unwrap(){return this.data}}function wi(t){return fetch(t).then(t=>t.json())}function Ri(){let t=[].join.call(arguments,"/");return"/"!==t[0]&&(t="/"+t),Di()+"/web/public/native/config"+t}const Di=()=>"https://ljsp.lwcdn.com";function ki(t){return~t.indexOf("/")?t:"/media/"+t}var Oi={404:"media not found",402:"invalid subscription",400:"bad request",415:"unsupported media type"};function Ii(t){const e=t.ima,r=t.duration;if(!e||!r)return t;const i=null==e?void 0:e.ads;return Array.isArray(i)&&(e.ads=i.map((function(t){return"number"==typeof t.percentage&&(t.time=t.percentage*r),t}))),t}function Ci(t,e){var r,i;e="object"==typeof e?e:{};const n={title:null===(r=null==t?void 0:t.metadata)||void 0===r?void 0:r.title,description:null===(i=null==t?void 0:t.metadata)||void 0===i?void 0:i.description},s={ima:{parameters:function({media_id:t,duration:e,title:r,tags:i,category_name:n,ad_keywords:s}){return{ad_keywords:s||"",media_id:t||"",category:n||"",media_name:r||"",media_tags:i||"",media_duration:e||-1}}((null==t?void 0:t.metadata)||{})}},a=e.embed||{};return delete a.src,Li(s,n,t,(delete(o=e).src,delete o.metadata,delete o.title,delete o.description,delete o.duration,delete o.poster,o),a);var o}const Pi=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;function xi(t){return"object"==typeof t&&"ovp/base64"==t.type}function Mi(t,e){return function(t,e){return!t.startsWith("blob:")&&(!(~t.indexOf(".")||!Pi.test(t))&&(e.type="video/ovp",!0))}(t,e)||xi(e)}function Fi(t){try{return function(t){return null===t?{}:JSON.parse(t)}(decodeURIComponent(atob(t).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return{err:t.message}}}function Ni(t){const e=t.split(/[^0-9]/).map(t=>parseInt(t,10));return Date.UTC(e[0],e[1]-1,e[2],e[3],e[4],e[5])}function Ui(t){return t.live}var Bi=Object.freeze({__proto__:null,OVP_ERROR:"ovp:error",OVP_MEDIA_REQUEST_START:"ovp:request:start",OVP_MEDIA_REQUEST_COMPLETE:"ovp:request:media:complete",OVP_PLAYLIST_REQUEST_COMPLETE:"ovp:request:playlist:complete",LIVE_COUNTDOWN_TICK:"ovp:live:countdown:tick",LIVE_COUNTDOWN_START:"ovp:live:countdown:start",LIVE_COUNTDOWN_COMPLETE:"ovp:live:countdown:complete",OVP_MEDIA_CHANGED:"ovp:media:changed",OVP_REALTIME_MESSAGE:"ovp:message:realtime"});function Gi(t,e){const r=null==e?void 0:e.src;if(xi(e))return function(t,e){const r=Fi(e.src||"");if(function(t){return"string"==typeof t.err}(r))return console.error(r.err);ji(t,r)}(t,e);r&&Pipe.of(r).fmap(ki).fmap(Ri).fmap(t=>fetch(t)).fmap(e=>e.then(t=>Promise.all([t.status,t.json()])).then(([e,r])=>200==e?ji(t,r):Hi(t,r)))}function ji(t,e){return t.emit("ovp:media:changed",e),function(t){return Array.isArray(t.playlist)}(e)?function(t,e){if("function"!=typeof window.flowplayer.playlist)return console.warn("OVP responded with Playlist media but the playlist plugin does not exist"),Hi(t,{status:415});t.emit("ovp:request:playlist:complete",function(t,e){const r=Object.assign({},t),i=(null==t?void 0:t.playlist)||{},n=Li(e,i),s=((null==n?void 0:n.playlist)||[]).map(t=>Ci(t,r));return Object.assign(n,{playlist:s})}(t.opts,e))}(t,e):Ui(e)?function(t,e){var r,i;const n=(null===(r=null==e?void 0:e.metadata)||void 0===r?void 0:r.live_start_time)||(null===(i=null==e?void 0:e.metadata)||void 0===i?void 0:i.starttime);n&&(e.live_start_time=Pipe.of(n).fmap(Ni).unwrap());t.emit("ovp:live:countdown:start",Pipe.of(e).fmap(Ci,t.opts).fmap(Ii).unwrap())}(t,e):function(t,e){t.emit("ovp:request:media:complete",Pipe.of(e).fmap(Ci,t.opts).fmap(Ii).unwrap())}(t,e)}function Hi(t,e){return e.message?t.emit("ovp:error",e):e.status?t.emit("ovp:error",new Error(Oi[e.status])):t.emit("ovp:error",e)}const Ki={};function Vi(t,e,r){"object"!=typeof Ki[e]&&(Ki[e]=r);const i=t.opts,n=(null==i?void 0:i.metadata)||{};n.player_id=e,i.metadata=n,r.title&&delete r.title,r.description&&delete r.description;const s=Object.assign(i,r);t.setOpts(s),r.autoplay&&t.togglePlay(!0)}let qi=!1;function Wi(t,e,r){zi()||Pipe.of("recommendation").fmap(Ri,e,r).fmap(wi).fmap(e=>e.then(e=>function(t,e){const r=e.playlist;if(t.opts.recommendations=r,!r.length)return;t.emit("recommendationsready",{playlist:r.map((function(t){var e;return{poster:t.poster,src:t.src,title:null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.title,metadata:t.metadata||{}}}))})}(t,e)).catch(Yi))}function zi(){return qi}function Yi(t){qi=!0,console.error("Failed to load recommendations: %j",t)}function Xi(t){return t&&t.live_start_time&&t.live_start_time-Date.now()>0}function Qi(t,e){let r=0;function i(){return function(t,e){const r=Date.now()-e;return Math.floor((t-r)/1e3)}(e.live_start_time||0,e.server_time_offset||0)}function n(){const n=i();if(n<0||isNaN(n)||0===t.reaper)return clearInterval(r),function(t,e){t.emit("ovp:live:countdown:complete");const r=Ct(t,W);r&&r.remove(),t.root.classList.remove("is-livecountdown"),t.emit("ovp:request:media:complete",e)}(t,e);!function(t,e,r,i){r.classList.add("is-livecountdown"),e.emit("ovp:live:countdown:tick",{remaining_time:$i(i+1)}),e.hasState(Z)||e.setState(Z,!0)}(0,t,t.root,n)}var s;s=e,Dr().then(t=>Object.assign(s,{server_time_offset:t})),n(),r=setInterval(n,250)}function $i(t){const e=function(t){"number"!=typeof t&&(t=parseInt(t,10)),t=Math.round(t);const e=Math.floor(t/86400);t-=86400*e;const r=Math.floor(t/3600);t-=3600*r;const i=Math.floor(t/60);return{days:e,hours:r,minutes:i,seconds:t-=60*i}}(t);let r="";return e.days&&(r+=e.days+":"),r+Ft(e.hours)+":"+Ft(e.minutes)+":"+Ft(e.seconds)}class WebsocketBridge{constructor(t){this.manualDisconnect=!1,this.video=t,this.onClose=this.onClose.bind(this),this.onMessage=this.onMessage.bind(this)}static of(t){return new WebsocketBridge(t)}connect(t){this.client=new WebSocket("wss://player.ws.flowplayer.com?mediaId="+t),this.current_media_id=t,this.wireup()}onClose(){this.manualDisconnect?this.manualDisconnect=!1:this.current_media_id&&this.reconnect(this.current_media_id)}onMessage(t){JSON.parse(t.data).forEach(t=>{this.video.emit("ovp:message:realtime",t)})}reconnect(t){this.cleanup(),this.connect(t)}wireup(){this.client&&(this.client.addEventListener("message",this.onMessage),this.client.addEventListener("close",this.onClose))}cleanup(){this.client&&(this.client.removeEventListener("message",this.onMessage),this.client.removeEventListener("close",this.onClose),this.client=void 0)}disconnect(){this.client&&(this.manualDisconnect=!0,this.client.close())}}class FlowplayerLiveCountdown extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-livecountdown");const e=xt("fp-inner");this.append(e);const r=document.createElement("p");r.innerText=t.i18n("ovp.starting_in"),e.append(r);const i=document.createElement("p");i.classList.add("fp-countdown"),e.append(i),t.on("ovp:live:countdown:tick",e=>{const r=e.detail.remaining_time;t.root.classList.add("is-livecountdown"),i.innerText=r})}}const Zi=["*.lwcdn.com","*.flowplayer.com"];class OVP{constructor(t){pt(t,W,FlowplayerLiveCountdown)}onload(t,e,r,i){if("string"==typeof i.src)return"string"!=typeof t.player_id||0===i.src.indexOf(t.player_id)||xi(i)||(i.src=[t.player_id,i.src].join("/")),Gi(r,i)}wants(t,e,r){return Mi(t,e)}init(t,e,r){const n=new WebsocketBridge(r);let s=Object.assign({},t);const a=function(t){if(!s)return t;delete s.src;const e=Li(t,s);return s=!1,e};r.on("ovp:error",(function(t){r.emit(i,t.data)})),r.on("ovp:request:start",(function(){r.setState(rt,!0),t.recommendations&&(t.recommendations=!1)})),r.on("ovp:media:changed",(function({data:t}){var e;const r=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.media_id;(null==t?void 0:t.live)&&r&&(n.disconnect(),n.connect(r))})),r.on("ovp:message:realtime",(function({data:e}){var i;const n=null==e?void 0:e.event,s=null==e?void 0:e.value,a=r.opt("metadata",{live_start_time:""});switch(n){case"METADATA":{const e=Object.assign(a,s),n=Object.assign(t,{metadata:e});n.live&&(null===(i=null==n?void 0:n.metadata)||void 0===i?void 0:i.live_start_time)&&(n.live_start_time=Ni(n.metadata.live_start_time)),r.setOpts(n);break}}})),r.on("beforeplay",(function(e){const r=t;if(Ui(r)){if(Ji(r))return;e.preventDefault()}})),r.on("ovp:request:media:complete",(function(t){const e=t.data;if(!e)return;if(0==r.reaper||"object"!=typeof t.data||Xi(t.data))return;const i=a(e);r.setOpts(i),r.setAttrs(i),i.src&&r.setSrc(i.src),i.autoplay&&r.togglePlay(!0)})),r.on(L,(function({data:i}){var n,s;if("string"==typeof t.src&&Mi(t.src,{}))return;if(t.src&&tn(t.src))return;if((null==i?void 0:i.domains)&&(null==i?void 0:i.domains.length)&&!((t,e)=>{const r=t.split(".").reverse();return e.concat(Zi).some(t=>{const e=t.split(".").reverse(),i="*"===e[e.length-1];return i&&e.pop(),(i||e.length===r.length)&&e.every((t,e)=>r[e]===t)})})(function(){try{return window.location.hostname!==window.parent.location.hostname?er(document.referrer).hostname:document.location.hostname}catch(t){return window.location.hostname}}(),i.domains))return de({root:e,video:r,data:{details:`Hostname ${window.location.hostname} is not allowed to load player ${null===(n=i.metadata)||void 0===n?void 0:n.player_id}.`,reason:"domain"}});const a=null==i?void 0:i.brand_color;return a&&r.root.style.setProperty("--fp-brand-color","#"==a[0]?a:"#"+a),"string"==typeof t.player_id&&(null===(s=null==t?void 0:t.metadata)||void 0===s?void 0:s.player_id)!==t.player_id?function(t,e){if("object"==typeof Ki[e])return console.debug("using Cache(%s)",e),Vi(t,e,Ki[e]);Pipe.of(e).fmap(Ri).fmap(wi).fmap(r=>r.then(r=>Vi(t,e,r)).catch(console.error))}(r,t.player_id):void 0})),r.on("ovp:request:playlist:complete",(function(t){const e=t.data;if(!e||0==r.reaper)return;const{playlist:i}=e,n=Tt(e,["playlist"]),s=a({playlist:n});Array.isArray(s.playlist)&&(s.playlist=n),r.setOpts(s);const o={type:"flowplayer/playlist",items:i};r.setSrc(o)})),r.on("ovp:live:countdown:start",(function(i){const n=i.data;if(!n||0==r.reaper)return;const s=a(n);if(r.setOpts(s),r.setAttrs(s),!Xi(n))return r.emit("ovp:request:media:complete",n);Ct(r,W)||(e.appendChild(ft(r,W)),Qi(r,t))})),r.on("timeupdate",(function(){var e,i,n;const s=t;Ui(s)?Ji(s)||(r.togglePlay(!1),r.emit(T)):t.recommendations&&(null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.media_id)&&(Array.isArray(t.recommendations)||r.currentTime/r.duration<.8||zi()||(null===(i=null==t?void 0:t.metadata)||void 0===i?void 0:i.media_id)&&(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.player_id)&&Wi(r,t.metadata.media_id,t.metadata.player_id))})),r.on(A,(function(){n.disconnect()}))}}function Ji(t){var e,r;const i=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.live_stop_time;if(!i)return!0;return!!(null===(r=null==t?void 0:t.metadata)||void 0===r?void 0:r.allow_after_stop_time)||Ni(i)>Date.now()}OVP.events=Bi;const tn=t=>{var e;if(t&&Array.isArray(t))return"object"==typeof t[0]&&"ovp/base64"===(null===(e=t[0])||void 0===e?void 0:e.type)};function en(t){return{width:t.clientWidth,height:t.clientHeight}}function rn(t,e,r){return"number"==typeof r&&(r+="px"),t.style.setProperty(e,r),t}ee(window,OVP);const nn="ad-initialized";var sn=Object.freeze({__proto__:null,AD_INIT:nn,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"});const an="undefined"!=typeof document&&"undefined"!=typeof window&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,on=_r("ads/lifecycle"),ln=["ad-playback-error","ad-teardown","ad-break-completed"];async function un({config:t,root:e,content:r,ads:i,ima:n}){on("LifeCycle::initLifeCycle",t,e,r,i,n),r.autoplay=!1;const s=t.autoplay===vt.AUDIO_REQUIRED,a=function(t,e){return{muted:!(e||!t.muted),volume:t.volume}}(r,s);r.on("volumechange",()=>{a.volume=r.volume,a.muted=r.muted});const o=ft(r,"flowplayer-ad-ui"),l=o.adContainer;e.append(o);const u={listening:!1,preload:null==n?void 0:n.preload_ads};if(on("initial",a),i.setVideoTag(r),t.autoplay){on("Trying to autoplay"),o.hideFirstFrame(e);await async function t(e,r){const[i,n]=[e.muted,e.volume];on("Lifecycle::peek_content(:muted => %s, :volume => %s)",i,n);const s=()=>new Promise(t=>setTimeout(t,0,!1));r&&(e.muted=!1,e.volume=e.volume?e.volume:1);try{return await async function(t){return on("Lifecycle::wait_for_source"),new Promise((e,r)=>{let i=0;const n=setInterval(()=>{if(++i>40)return clearInterval(n),r(new Error("No source in 2000ms, giving up"));t.currentSrc&&(e(null),clearInterval(n))},50)})}(e),e.volume&&(e.volume=.01),on("Lifecycle::peek_content::play"),await new Promise(t=>setTimeout(()=>t(e.togglePlay(!0)))),on("Lifecycle::peek_content::pause"),await new Promise(t=>setTimeout(()=>t(e.togglePlay(!1)))),e.volume=n,on("Lifecycle::peek_content::true"),!0}catch(a){return e.volume=n,r?(e.muted=!1,0==e.volume&&(e.volume=1),await s()):i||!n?(on("Lifecycle::peek_content::false"),await s()):(on("Lifecycle::peek_content::recover"),e.muted=!0,!!await t(e)||(e.muted=i,on("Lifecycle::peek_content::false"),await s()))}}(r,s)?(on("Can autoplay, start ad"),r.opts.autoplay=1,dn({ads:i,content:r,state:u,adContainer:l,ima:n,config:t})):(on("cannot autoplay(audioRequired: %s), fallback to poster state",s),t.autoplay=0,o.showFirstFrame(e),r.setState("is-starting",!0))}t.autoplay||i.hasPreroll()&&function({content:t,ads:e,config:r,state:i,initial:n,adContainer:s,ima:a}){t.once("beforeplay",(async function(o){(t.hasState(st)||"touchend"!=o.type)&&e.shallPlayAd(0)&&(!an&&o.preventDefault(),pn({ads:e,content:t,state:i}),on("user_gesture(:intercept) -> shallPlayAd(0: %s)",e.shallPlayAd(0)),r.muted=n.muted,await dn({ads:e,content:t,state:i,adContainer:s,ima:a,config:r}),gn({ads:e,content:t}))}))}({content:r,ads:i,config:t,state:u,initial:a,adContainer:l,ima:n}),!t.autoplay&&i.hasPreroll()&&u.preload&&dn({ads:i,content:r,state:u,adContainer:l,ima:n,config:t}),fn({config:t,root:e,content:r,ads:i,state:u,adContainer:l,ui:o,ima:n,initial:a}),r.on(b,()=>{r.once("beforeplay",()=>i.resetScheduleCounter())})}async function dn(t){t.state.started||(t.content.hasState(st)?await cn(t):t.content.once("viewenter",async()=>{await cn(t)}))}async function cn({ads:t,content:e,adContainer:r,ima:i,state:n,config:s}){var a;n.started=!0;const o=Tt(i,["ads"]),l=en(e.root),u=(null==s?void 0:s.muted)||e.muted,d=Object.assign(Object.assign(Object.assign({container:r,volume:u?0:e.volume,muted:u,autoplay:(null==s?void 0:s.autoplay)||!1,video_source:e.original_src,DisableCustomPlaybackForIOS10Plus:an,preload_ads:null===(a=null==s?void 0:s.ima)||void 0===a?void 0:a.preload_ads},o),l));on("start():",d,n),await t.initialize(!1,d,n.preload)}function hn(t,e){var r,i;return{content_width:t.clientWidth||(null===(r=t.parentNode)||void 0===r?void 0:r.clientWidth)||e.clientWidth,content_height:t.clientHeight||(null===(i=t.parentNode)||void 0===i?void 0:i.clientHeight)||e.clientHeight}}function fn({config:t,root:e,content:r,ads:i,initial:n,adContainer:s,state:a,ui:o,ima:l}){on("addUIListeners()"),r.once(m,async n=>{if(i){if(on("addUIListeners() -> content started playing"),pn({ads:i,content:r,state:a}),!i.shallPlayAd(0)||!i.adapter.isLinearAd())return on("addUIListeners() -> no more preroll ads -> resume content"),await dn({ads:i,content:r,state:a,adContainer:s,ima:l,config:t});r.togglePlay(!1),await dn({ads:i,content:r,state:a,adContainer:s,ima:l,config:t}),i.shallPlayAd(0)&&i.adapter.isLinearAd()&&(o.classList.add("on","linear"),e.classList.add(rt),gn({ads:i,content:r}))}}),r.on([R,w],(function(){if(!i)return;const{content_width:t,content_height:n}=hn(r,e);i.resize({height:n,width:t})})),r.on("resize",t=>{if(!i||!t.detail)return;const{width:e,height:r}=t.detail.contentRect;i.resize({width:e,height:r})}),r.on(T,t=>{var e;i&&(on("ui_listeners(:%s, event: %o)",t.type,t.detail),(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.from)!==i&&(t.preventDefault(),Object.assign(t,{prevented_from_ads:!0}),i.finished((function(){r.emit(T,{from:i})}))))}),i.on("ad-requested",()=>{e.classList.toggle(rt,!0)}),i.once("ad-started",()=>{r.on(["beforeplay","beforepause"],t=>{var e;if(!i.adBreak||!i.adapter.isLinearAd())return;t.preventDefault();const r=(null===(e=t.detail)||void 0===e?void 0:e.forced)?"beforeplay"===t.type:!i.adPlaying;r&&i.paused&&i.resume(),r||i.paused||i.pause()})}),i.on("ad-started",t=>{const s=t.detail,{linear:a,ad:l,ad_type:u}=s;let d;if(on(`Ad[linear: ${a}, currentTime: ${r.currentTime}] starting`,l),"preroll"==u&&!a&&r.paused&&r.togglePlay(!0),"preroll"==u&&a&&r.currentTime>0&&!r.opt("start_time")&&!r.opt("live")&&(on("Preroll[rewind: true]",r.currentTime),r.currentTime=0),a&&(d=hn(r,e)),i.resize({width:d?d.content_width:l.width,height:d?d.content_height:l.height,linear:a,resize_non_linear:!0}),o.resize({linear:a,resizeContainerAlso:!0,width:a?void 0:l.width,height:a?void 0:l.height}),e.classList.remove(rt),o.classList.add("on"),o.classList.toggle("linear",a),o.classList.toggle("non-linear",!a),!a){on("non-linear ad / restarting content");try{r.togglePlay(!0),r.volume=n.volume,r.muted=n.muted}catch(t){on(t)}}}),i.on("ad-pause-content",()=>{o.resize({linear:!0,width:0,height:0})}),r.on(ln,t=>async function({root:t,content:e,ads:r,ui:i,eventName:n,err:s={reason:""}}){on("teardown(event: %s)",n),t.classList.add("is-seamless"),i.classList.remove("is-vpaid"),t.classList.remove(rt),s.reason&&on("teardown(:err, reason: %s) %o",s.reason);i.classList.remove("on");const a=r.getLastAd();if(i.showFirstFrame(t),!r.shouldRestartContent())return on("Lifecycle.teardown(:skip_restart, reason: %s)","Ad prevented restarting content"),vn(t);if(e.currentTime>0&&e.currentTime>=e.duration||"postroll"==r.ad_type||!1===(null==a?void 0:a.restart))return on("Lifecycle.teardown(:skip_restart, reason: %s)","was a postroll ad"),vn(t);""===e.currentSrc&&e.setSrc(e.original_src);e.paused&&r.shouldRestartContent()&&(on("Lifecycle.teardown(:toggle_play, %s)","attempting to restart content"),await e.togglePlay(!0));if(!e.paused)return on("Lifecycle.teardown(:ok)","restarted video content"),vn(t)}({root:e,content:r,ads:i,ui:o,err:t.detail,eventName:t.type}));let u=!!t.autoplay;r.on("viewenter",()=>{u&&i.resume()}),r.on("viewleave",()=>{u=!i.paused,i.pause()})}function pn({ads:t,content:e,state:r}){r.listening||(e.on(["timeupdate",_,m,S],r=>{t.adPlaying&&t.adapter.isLinearAd()&&!t.adapter.isSharedVideoTag()&&!e.paused&&e.pause(),gn({ads:t,content:e,seek:r.type===S})}),r.listening=!0)}function gn({ads:t,content:e,seek:r=!1}){t&&t.setCurrentTime(e.currentTime,void 0,r)}function vn(t){t.classList.remove("is-seamless")}const mn=_r("ads/timers");class TimerRegistry{constructor(t={},e={}){this.intervals=t,this.timers=e}}let yn=-1;function En(t,e,r){const i=setInterval(r,e);if(mn("TimerRegistry.createInterval() -> "+i,t.intervals),"object"==typeof i){const e=++yn;return t.intervals[e]=e,e}return t.intervals[i]=i,i}function Tn(t){if(t)return mn("TimerRegistry.empty()",Object.keys(t.timers),Object.keys(t.intervals)),Object.keys(t.intervals).forEach(e=>function(t,e){return mn("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 mn("TimerRegistry.removeTimeout() -> "+e,t.timers),clearTimeout(t.timers[e]),delete t.timers[e],t}(t,e)),t}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,r){if(this._loadPending=!1,!e)return!1;const i=r?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"}}}function _n(t){try{return t.getAdPodInfo().getPodIndex()}catch(t){return}}class IMA{constructor(t){this.eventHandler=t,this.log=_r("ads/adapter/ima"),this.google=window.google,this._adHandlers=[],this._timers=new TimerRegistry,this._started=!1,this._volumeLevel=0,this._adLoaded=!1,this._paused=!1,this._all_ads_completed=!1,this._currentDuration=0,this._currentRemaining=0,this._currentDisplayTs=0,this._iosPlaysInline=!1,this.sharedVideoTag=!1,this._isInitialized=!1,this._prepared=!1,this.opts={}}async init(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("ad-adapter-init-failed")}}isReady(){return!!this._isInitialized}setIOSPlaysInline(t){this.log("setIOSPlaysInline",t),this.sharedVideoTag=!t,this.initialize(Object.assign(Object.assign({},this.opts),{DisableCustomPlaybackForIOS10Plus:t}))}getIOSPlaysInline(){return this._iosPlaysInline}setVideoTag(t){this.videoTag=t}isLinearAd(){return!!this._adLinear}isSharedVideoTag(){return!!this.sharedVideoTag}getVideoTag(){return this.videoTag}getDimensions(){return this._dimensions||{}}getOpts(){return this.opts}isPaused(){return this._paused}destroy(){Tn(this._timers),this._adHandlers&&this._adHandlers.forEach(t=>t()),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(t){const e=this.isAdPod(),r=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;t.NumRedirects=t.NumRedirects||t.redirects;const n={VpaidMode:this.google.ima.ImaSdkSettings.VpaidMode.INSECURE,DisableCustomPlaybackForIOS10Plus:!0};if(i.setVpaidMode(t.VpaidMode||n.VpaidMode),i.setDisableCustomPlaybackForIOS10Plus(t.DisableCustomPlaybackForIOS10Plus||n.DisableCustomPlaybackForIOS10Plus),"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,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 r=new this.google.ima.AdsRenderingSettings;this.log("ima.rendering(preload: %s)",!!t.preload_ads),r.useStyledNonLinearAds=!0,r.enablePreloading=!!t.preload_ads,"number"==typeof t.media_timeout&&(r.loadVideoTimeout=t.media_timeout),r.restoreCustomPlaybackStateOnAdBreakComplete=!t.DisableCustomPlaybackForIOS10Plus,this.sharedVideoTag&&(r.playAdsAfterTime=this.videoTag.currentTime),this.eventHandler.trigger("ad-ima-rendering-settings",r);const i=this._adsManager=e.getAdsManager(this.videoTag,r);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.STARTED,t=>{this.debugEvent(t);const e=t.getAd();e&&(this._currentDuration=e.getDuration(),this._currentDisplayTs=Date.now(),this.emitWithAd("ad-started",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("ad-completed",e),Tn(this._timers)}),i.addEventListener(this.google.ima.AdEvent.Type.SKIPPED,t=>{this.debugEvent(t);const e=t.getAd();e&&this.emitWithAd("ad-skipped",e)}),i.addEventListener(this.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,t=>{this.debugEvent(t);const e=t.getAd();e&&this.emitWithAd("ad-pause-content",e)});const n=()=>{this._started=!1,this._currentDisplayTs=0,this.eventHandler.trigger("ad-break-completed")};i.addEventListener(this.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,t=>{this.debugEvent(t),n()}),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("ad-volume-changed",e)});const s=t=>{this._paused=t,this.eventHandler.trigger(t?"ad-paused":"ad-resumed")};i.addEventListener(this.google.ima.AdEvent.Type.PAUSED,()=>s(!0)),i.addEventListener(this.google.ima.AdEvent.Type.RESUMED,()=>s(!1)),i.addEventListener(this.google.ima.AdEvent.Type.STARTED,()=>s(!1)),i.addEventListener(this.google.ima.AdEvent.Type.VOLUME_MUTED,t=>{this.log("IMA::volume(type: %s, event: %o)","mute",t),this.eventHandler.trigger("ad-muted")});const{width:a,height:o}=t;a&&o&&(i.init(a,o,this.google.ima.ViewMode.NORMAL),this.log("ima.initialise: done initializing"))}),r&&(this.log("Event(reload: %s)","reload-ad-requested"),this.eventHandler.trigger("reload-ad-requested",e)),this.eventHandler.trigger(nn,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"),Tn(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){this.log(`ima.initAd(adTag: ${t}, timeout: ${e})`);try{await this.requestAd(t,e),this._adLoaded=!0}catch(t){throw this.log("ima.initAd:",t),this._adLoaded=!1,t}finally{Tn(this._timers)}}async requestAd(t,e){if(this.destroyManager("requestAd"),!this.videoTag)return;const{autoplay:r=!1}=this.opts,i=Date.now(),n=this.videoTag.muted;this._volumeLevel=this.videoTag.volume;const s=n||0==this._volumeLevel;this._all_ads_completed=!1,this.log("ima.requestAd(%o)",Object.assign(Object.assign({},this.opts),{autoplay:r,muted:n,timeout:e,adTag:t,_volumeLevel:this._volumeLevel,manager:this._adsManager})),this.clearAdHandlers();const a=new this.google.ima.AdsRequest;a.adTagUrl=t;const{height:o,width:l}=this.opts;if(l&&(a.linearAdSlotWidth=l),o&&(a.linearAdSlotHeight=o),!this.opts.disable_non_linear_ads&&l&&(a.nonLinearAdSlotWidth=l),!this.opts.disable_non_linear_ads&&o&&(a.nonLinearAdSlotHeight=o-50),a.setAdWillAutoPlay(r),a.setAdWillPlayMuted(s),a.vastLoadTimeout=e,this.eventHandler.trigger("ad-ima-before-ads-request",{request:a}),!this._adsLoader)return;this._adsLoader.requestAds(a);return new Promise(async(t,r)=>{const n=e=>{clearTimeout(o),t(e)},a=t=>{clearTimeout(o),r(t)};this.once(this._adsLoader,this.google.ima.AdErrorEvent.Type.AD_ERROR,t=>{this.emitError("ad-request-error",t),a(new Error("Ad load failed"))});const o=setTimeout(()=>{const t=new Error("Ad internal timeout reached");this.eventHandler.trigger("ad-timeout",t),r(t)},1.5*(e+(this.opts.media_timeout||5e3))),l=await this.waitForAdsManager();this.volume(s?0:this._volumeLevel),this.eventHandler.trigger("ad-volume-changed",this._volumeLevel);const u=this.cuepoints();if(u&&u.length&&0!==u[0])return n({ad:!1,adsManager:l});this.once(l,this.google.ima.AdErrorEvent.Type.AD_ERROR,t=>{this.emitError("ad-playback-error",t),a(t)}),this.once(l,this.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{this._all_ads_completed=!0,n(null)}),this.once(l,this.google.ima.AdEvent.Type.LOADED,t=>{this.eventHandler.trigger("ad-request-completed",{request_load_time:Date.now()-i});const e=t.getAd();e&&(this.log("ima.requestAd: AD_REQUEST_COMPLETED",e.getContentType()),"application/javascript"==e.getContentType()&&this.eventHandler.trigger("vpaid-init",e),n(null))}),this.once(l,this.google.ima.AdEvent.Type.CLICK,()=>{this.log("ima.requestAd: click event"),this.pause()})})}async playAd(){if(this.log("ima.playAd()",this),!this._adsManager||!this._adLoaded)return;const t=this.currentAd();if(t&&(!this.sharedVideoTag||t.isLinear()))try{await this.startAndWaitForAdCompletion(this._adsManager,t.isLinear())}catch(t){throw this.log("ima.playAd",t),t}finally{this._adLoaded=!1,Tn(this._timers)}}startAndWaitForAdCompletion(t,e){if(!this._started)return this.log("ima.startAndWaitForAdCompletion(manager: %o)",{volume:t.getVolume()}),new Promise((r,i)=>{let n=!1;this.once(t,this.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,()=>{if(this.log("ima.startAndWaitForAdCompletion: CONTENT_RESUME_REQUESTED <<< happened"),this._started=!1,n)return this.log("ima.startAndWaitForAdCompletion: Content resume requested, but trying to recover from ad error");r()}),this.once(t,this.google.ima.AdErrorEvent.Type.AD_ERROR,async t=>{this.log("ima.startAndWaitForAdCompletion: beginning error recovery ->",t),n=!0;try{const{ok:e}=await IMA.pollForFatalError({err:t,ima:this});e&&(n=!1)}catch(e){this._started=!1,i(t)}}),e&&(this._started=!0),t.start(),this.eventHandler.trigger("ad-play-requested")})}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:r,silent:i,resize_non_linear:n}){this._adsManager&&(this._adLinear=void 0===r?this._adLinear:r,this.opts&&(t||e)&&(!1===r&&(t+=10,e+=10),this._dimensions={width:t,height:e,linear:r},r&&(this.opts.width=t,this.opts.height=e),(this._adLinear||n)&&(i||this.log("ima.onResize %s x %s",t,e),this._adsManager.resize(t,e,this.google.ima.ViewMode.NORMAL))))}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,["ad-break-completed","ad-error"],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(),r=t.getMinSuggestedDuration();return e-this._currentDisplayTs>1e3*r}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 r;try{const e=t.getError(),i=e.getInnerError(),n=i?IMA.unwrapError(i,e.message):"";r={reason:n,type:e.getType(),code:e.getErrorCode()}}catch(t){}const i=e._currentRemaining;return new Promise((t,n)=>{const s=setTimeout(()=>{e.eventHandler&&e.eventHandler.trigger("ad-playback-error",r),n(new Error("Ad not progressing"))},2500);e.eventHandler.once("ad-progress",e=>{const r=e.detail.remaining;-1!==r&&r<i&&(clearTimeout(s),t({ok:1}))})})}static pollRemaining({ima:t,adsManager:e}){let r=-1;return En(t._timers,250,(function(){t._currentRemaining=e.getRemainingTime(),r!=t._currentRemaining&&(r=t._currentRemaining,t.eventHandler.trigger("ad-progress",{remaining:t._currentRemaining,duration:t._currentDuration}))}))}once(t,e,r){this._adHandlers.push(function(t,e,r){const i=n=>{r(n),t.removeEventListener(e,i)};return t.addEventListener(e,i),()=>t.removeEventListener(e,i)}(t,e,r))}static race(t,e,r){e.forEach(i=>{const n=(...i)=>{e.forEach(e=>t.removeListener(e,n)),r(i)};t.on(i,n)})}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 r=_n(e),i=r?Schedule.kindOf(r):"unknown",n=function(t){try{return t.getAdPodInfo().getAdPosition()}catch(t){return}}(e),s=function(t){try{return t.getAdPodInfo().getTotalAds()}catch(t){return}}(e),a={ad_type:i,ad:{duration:e.getDuration(),width:e.getWidth(),height:e.getHeight(),position:n,totals:s},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)`,a,e),this.eventHandler.trigger(t,a)}emitError(t,e){const r={vast_error_type:e.getError().getType(),reason:e.getError().getMessage(),vast_error:e.getError().getErrorCode()};this.log(`ima.error(${t})`,r),this.eventHandler.trigger(t,r)}debugEvent(t){try{const e=t.getAd();if(!e)return;this.log(`ima.event.${t.type} ->`,{event:t,data:t.getAdData(),position:_n(e),ad:e})}catch(t){}}}var Sn=Re((function(t,e){var r=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 r=e.plainObjects?Object.create(null):{},i=0;i<t.length;++i)void 0!==t[i]&&(r[i]=t[i]);return r},e.merge=function(t,r,n){if(!r)return t;if("object"!=typeof r){if(Array.isArray(t))t.push(r);else{if("object"!=typeof t)return[t,r];(n.plainObjects||n.allowPrototypes||!i.call(Object.prototype,r))&&(t[r]=!0)}return t}if("object"!=typeof t)return[t].concat(r);var s=t;return Array.isArray(t)&&!Array.isArray(r)&&(s=e.arrayToObject(t,n)),Object.keys(r).reduce((function(t,s){var a=r[s];return i.call(t,s)?t[s]=e.merge(t[s],a,n):t[s]=a,t}),s)},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="",n=0;n<e.length;++n){var s=e.charCodeAt(n);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?i+=e.charAt(n):s<128?i+=r[s]:s<2048?i+=r[192|s>>6]+r[128|63&s]:s<55296||s>=57344?i+=r[224|s>>12]+r[128|s>>6&63]+r[128|63&s]:(n+=1,s=65536+((1023&s)<<10|1023&e.charCodeAt(n)),i+=r[240|s>>18]+r[128|s>>12&63]+r[128|s>>6&63]+r[128|63&s])}return i},e.compact=function(t,r){if("object"!=typeof t||null===t)return t;var i=r||[],n=i.indexOf(t);if(-1!==n)return i[n];if(i.push(t),Array.isArray(t)){for(var s=[],a=0;a<t.length;++a)t[a]&&"object"==typeof t[a]?s.push(e.compact(t[a],i)):void 0!==t[a]&&s.push(t[a]);return s}for(var o=Object.keys(t),l=0;l<o.length;++l){var u=o[l];t[u]=e.compact(t[u],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))}})),bn={brackets:function(t){return t+"[]"},indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},An={delimiter:"&",strictNullHandling:!1,skipNulls:!1,encode:!0,encoder:Sn.encode},Ln=function t(e,r,i,n,s,a,o,l,u){var d=e;if("function"==typeof o)d=o(r,d);else if(d instanceof Date)d=d.toISOString();else if(null===d){if(n)return a?a(r):r;d=""}if("string"==typeof d||"number"==typeof d||"boolean"==typeof d||Sn.isBuffer(d))return a?[a(r)+"="+a(d)]:[r+"="+String(d)];var c,h=[];if(void 0===d)return h;if(Array.isArray(o))c=o;else{var f=Object.keys(d);c=l?f.sort(l):f}for(var p=0;p<c.length;++p){var g=c[p];s&&null===d[g]||(h=Array.isArray(d)?h.concat(t(d[g],i(r,g),i,n,s,a,o,l,u)):h.concat(t(d[g],r+(u?"."+g:"["+g+"]"),i,n,s,a,o,l,u)))}return h},wn=Object.prototype.hasOwnProperty,Rn={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1,decoder:Sn.decode},Dn=function(t,e,r){if(t){var i=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/g,s=/(\[[^[\]]*])/.exec(i),a=s?i.slice(0,s.index):i,o=[];if(a){if(!r.plainObjects&&wn.call(Object.prototype,a)&&!r.allowPrototypes)return;o.push(a)}for(var l=0;null!==(s=n.exec(i))&&l<r.depth;){if(l+=1,!r.plainObjects&&wn.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;o.push(s[1])}return s&&o.push("["+i.slice(s.index)+"]"),function t(e,r,i){if(!e.length)return r;var n,s=e.shift();if("[]"===s)n=(n=[]).concat(t(e,r,i));else{n=i.plainObjects?Object.create(null):{};var a="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,o=parseInt(a,10);!isNaN(o)&&s!==a&&String(o)===a&&o>=0&&i.parseArrays&&o<=i.arrayLimit?(n=[])[o]=t(e,r,i):n[a]=t(e,r,i)}return n}(o,e,r)}},kn=function(t,e){var r,i,n=t,s=e||{},a=void 0===s.delimiter?An.delimiter:s.delimiter,o="boolean"==typeof s.strictNullHandling?s.strictNullHandling:An.strictNullHandling,l="boolean"==typeof s.skipNulls?s.skipNulls:An.skipNulls,u=("boolean"==typeof s.encode?s.encode:An.encode)?"function"==typeof s.encoder?s.encoder:An.encoder:null,d="function"==typeof s.sort?s.sort:null,c=void 0!==s.allowDots&&s.allowDots;if(null!==s.encoder&&void 0!==s.encoder&&"function"!=typeof s.encoder)throw new TypeError("Encoder has to be a function.");"function"==typeof s.filter?n=(i=s.filter)("",n):Array.isArray(s.filter)&&(r=i=s.filter);var h,f=[];if("object"!=typeof n||null===n)return"";h=s.arrayFormat in bn?s.arrayFormat:"indices"in s?s.indices?"indices":"repeat":"indices";var p=bn[h];r||(r=Object.keys(n)),d&&r.sort(d);for(var g=0;g<r.length;++g){var v=r[g];l&&null===n[v]||(f=f.concat(Ln(n[v],v,p,o,l,u,i,d,c)))}return f.join(a)},On=function(t,e){var r=e||{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.delimiter="string"==typeof r.delimiter||Sn.isRegExp(r.delimiter)?r.delimiter:Rn.delimiter,r.depth="number"==typeof r.depth?r.depth:Rn.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:Rn.arrayLimit,r.parseArrays=!1!==r.parseArrays,r.decoder="function"==typeof r.decoder?r.decoder:Rn.decoder,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:Rn.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:Rn.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:Rn.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:Rn.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:Rn.strictNullHandling,""===t||null==t)return r.plainObjects?Object.create(null):{};for(var i="string"==typeof t?function(t,e){for(var r={},i=t.split(e.delimiter,e.parameterLimit===1/0?void 0:e.parameterLimit),n=0;n<i.length;++n){var s,a,o=i[n],l=-1===o.indexOf("]=")?o.indexOf("="):o.indexOf("]=")+1;-1===l?(s=e.decoder(o),a=e.strictNullHandling?null:""):(s=e.decoder(o.slice(0,l)),a=e.decoder(o.slice(l+1))),wn.call(r,s)?r[s]=[].concat(r[s]).concat(a):r[s]=a}return r}(t,r):t,n=r.plainObjects?Object.create(null):{},s=Object.keys(i),a=0;a<s.length;++a){var o=s[a],l=Dn(o,i[o],r);n=Sn.merge(n,l,r)}return Sn.compact(n)};const In=_r("fpads:macros"),Cn=/\[([\s\S]+?)\]/g;class Macros{constructor(t={},e=Cn){this.vars=t,this.pattern=e}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):""}static normalize(t){return t.trim()}static process_obj(t,e,r){return Object.keys(t).reduce((i,n)=>{const s=Macros.process_str(n,e,r,!0),a=t[n];return null===a?(i[s]=a,i):"object"==typeof a?(i[s]=Macros.process_obj(a,e,r),i):"string"==typeof a?(i[s]=Macros.process_str(a,e,r),i):(console.error(new Error(`${a} at ${n} not a handled Macro type`)),i)},{})}static process_str(t,e,r,i=!1){return t.replace(e.pattern,(t,e)=>{const n=Macros.normalize(e);if(!(n in r)||void 0===r[n])return t;const s=r[n],a=i?s:Macros.cast(s);return In("Macro.replace(raw: %s, macro: %s, value: %s)",i,e,a),a})}fork(t={},e=this.pattern){const r=Macros.merge(this.vars,t);return new Macros(r,e)}compile(t,e={}){const r=Macros.merge(this.vars,e),[i,n]=t.split("?"),s=On(n||"",{strictNullHandling:!0,decoder:t=>t}),a=kn(Macros.process_obj(s,this,r),{encode:!1,strictNullHandling:!0});return Macros.process_str(i,this,r,!0)+"?"+a}}function Pn(t,e={width:0,height:0}){let r,i;try{const t=document.createElement("a");t.href=r=window.location!=window.parent.location?document.referrer:document.location.href,i=t.hostname}catch(t){console.error(t)}const{width:n,height:s}=e,{video_source:a}=t||{},o=function(){const t=window;return"object"==typeof t.__flowplayerAdParameters?t.__flowplayerAdParameters:{}}();return Object.assign({random:Date.now(),page_url:r,domain:i,player_width:n,player_height:s,video_url:a,videourl:a},o)}Macros.patterns={BRACKETS:Cn,CURLY:/\{([\s\S]+?)\}/g,UNDERSCORE:/__([\s\S]+?)__/g};const xn=/^flowplayer:\/\/(.+)/;async function Mn(t){if("string"==typeof t&&xn.test(t)){const e=xn.exec(t),r=e&&window[e[1]];if(r)return Mn(r)}if("function"!=typeof t)return t;try{return await t()}catch(t){return""}}const Fn=Object.prototype,Nn=Object.getPrototypeOf;const Un=_r("fpads:ads:state");var Bn;!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"}(Bn||(Bn={}));class AdsState{constructor(t=0){this._state=t}static of(){return new AdsState}reset(){this._state=0}toggleState(t,e){return void 0===t&&Un(new Error("AdState cannot toggleState for `undefined`")),null==typeof 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 Gn={ok:_r("fpads:analytics:request-queue"),err:_r("fpads:analytics:request-queue:err"),warn:_r("fpads:analytics:request-queue:warn")};class RequestQueue{constructor(t=[],e=[],r={failures:0,ttl:0}){this.pending=t,this.open=e,this.stats=r}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 Gn.ok("maybe_spawn_req called Queue that is EMPTY"),t;if(RequestQueue.is_high_water(t))return Gn.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){Gn.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,r,i]){if(Gn.ok(`Request[${i.event_type}] request`,i,t.stats),Date.now()<t.stats.ttl)return Gn.warn(`Request[${i.event_type}] skipping because too many errors too quickly`,t.stats);const n=new XMLHttpRequest;t.open.push(n),n.timeout=RequestQueue.REQUEST_TIMEOUT_MS,n.ontimeout=function(){RequestQueue.handle_error(t,n),Gn.warn(`Request[${i.event_type}] timed out in ${n.timeout}ms`,t.stats)},n.onerror=function(e){RequestQueue.handle_error(t,n),e&&Gn.err(e),Gn.warn(`Request[${i.event_type}] encountered an Error`,n.responseText,t.stats)},n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&RequestQueue.rm(t,n),Math.floor(n.status/100)},n.onload=function(){RequestQueue.rm(t,n),t.stats.failures&&t.stats.failures--,Gn.ok(`Request[${i.event_type}] :ok`,n.status)},n.open(r,e),n.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{n.send(JSON.stringify(i))}catch(t){Gn.err(t)}}static rpush(t,...e){return e.forEach(e=>{if(RequestQueue.is_high_water(t))return Gn.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 r=t.open.lastIndexOf(e);return~r&&t.open.splice(r,1),t}}RequestQueue.MAX_OPEN_REQUESTS=3,RequestQueue.REQUEST_TIMEOUT_MS=4e3,RequestQueue.REQUEST_TTL_MS=5e3,RequestQueue.MAX_FAILURE_COUNT=3;const jn={"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"},Hn={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"},Kn={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Vn={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"},qn={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class Utils{static getFirstMatch(t,e){const r=e.match(t);return r&&r.length>0&&r[1]||""}static getSecondMatch(t,e){const r=e.match(t);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(t,e,r){if(t.test(e))return r}static getWindowsVersionName(t){switch(t){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(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,r=!1){const i=Utils.getVersionPrecision(t),n=Utils.getVersionPrecision(e);let s=Math.max(i,n),a=0;const o=Utils.map([t,e],t=>{const e=s-Utils.getVersionPrecision(t),r=t+new Array(e+1).join(".0");return Utils.map(r.split("."),t=>new Array(20-t.length).join("0")+t).reverse()});for(r&&(a=s-Math.min(i,n)),s-=1;s>=a;){if(o[0][s]>o[1][s])return 1;if(o[0][s]===o[1][s]){if(s===a)return 0;s-=1}else if(o[0][s]<o[1][s])return-1}}static map(t,e){const r=[];let i;if(Array.prototype.map)return Array.prototype.map.call(t,e);for(i=0;i<t.length;i+=1)r.push(e(t[i]));return r}static find(t,e){let r,i;if(Array.prototype.find)return Array.prototype.find.call(t,e);for(r=0,i=t.length;r<i;r+=1){const i=t[r];if(e(i,r))return i}}static assign(t,...e){const r=t;let i,n;if(Object.assign)return Object.assign(t,...e);for(i=0,n=e.length;i<n;i+=1){const t=e[i];if("object"==typeof t&&null!==t){Object.keys(t).forEach(e=>{r[e]=t[e]})}}return t}static getBrowserAlias(t){return jn[t]}static getBrowserTypeByAlias(t){return Hn[t]||""}}const Wn=/version\/(\d+(\.?_?\d+)+)/i,zn=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},r=Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},r=Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},r=Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},r=Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},r=Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},r=Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},r=Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},r=Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},r=Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},r=Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},r=Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},r=Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},r=Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},r=Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},r=Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return r&&(e.version=r),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},r=Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},r=Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},r=Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},r=Utils.getFirstMatch(Wn,t)||Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},r=Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},r=Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},r=Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},r=Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},r=Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},r=Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},r=Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},r=Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},r=Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e={name:"Android Browser"},r=Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},r=Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},r=Utils.getFirstMatch(Wn,t);return r&&(e.version=r),e}},{test:[/.*/i],describe(t){const e=-1!==t.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:Utils.getFirstMatch(e,t),version:Utils.getSecondMatch(e,t)}}}];var Yn=[{test:[/Roku\/DVP/],describe(t){const e=Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:Vn.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:Vn.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),r=Utils.getWindowsVersionName(e);return{name:Vn.Windows,version:e,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:Vn.iOS},r=Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return r&&(e.version=r),e}},{test:[/macintosh/i],describe(t){const e=Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),r=Utils.getMacOSVersionName(e),i={name:Vn.MacOS,version:e};return r&&(i.versionName=r),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:Vn.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e=Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),r=Utils.getAndroidVersionName(e),i={name:Vn.Android,version:e};return r&&(i.versionName=r),i}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),r={name:Vn.WebOS};return e&&e.length&&(r.version=e),r}},{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:Vn.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:Vn.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:Vn.Tizen,version:e}}},{test:[/linux/i],describe:()=>({name:Vn.Linux})},{test:[/CrOS/],describe:()=>({name:Vn.ChromeOS})},{test:[/PlayStation 4/],describe(t){const e=Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:Vn.PlayStation4,version:e}}}],Xn=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(t){const e=Utils.getFirstMatch(/(can-l01)/i,t)&&"Nova",r={type:Kn.mobile,vendor:"Huawei"};return e&&(r.model=e),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Kn.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Kn.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Kn.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Kn.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Kn.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Kn.tablet})},{test(t){const e=t.test(/ipod|iphone/i),r=t.test(/like (ipod|iphone)/i);return e&&!r},describe(t){const e=Utils.getFirstMatch(/(ipod|iphone)/i,t);return{type:Kn.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Kn.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Kn.mobile})},{test:t=>"blackberry"===t.getBrowserName(!0),describe:()=>({type:Kn.mobile,vendor:"BlackBerry"})},{test:t=>"bada"===t.getBrowserName(!0),describe:()=>({type:Kn.mobile})},{test:t=>"windows phone"===t.getBrowserName(),describe:()=>({type:Kn.mobile,vendor:"Microsoft"})},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return"android"===t.getOSName(!0)&&e>=3},describe:()=>({type:Kn.tablet})},{test:t=>"android"===t.getOSName(!0),describe:()=>({type:Kn.mobile})},{test:t=>"macos"===t.getOSName(!0),describe:()=>({type:Kn.desktop,vendor:"Apple"})},{test:t=>"windows"===t.getOSName(!0),describe:()=>({type:Kn.desktop})},{test:t=>"linux"===t.getOSName(!0),describe:()=>({type:Kn.desktop})},{test:t=>"playstation 4"===t.getOSName(!0),describe:()=>({type:Kn.tv})},{test:t=>"roku"===t.getOSName(!0),describe:()=>({type:Kn.tv})}],Qn=[{test:t=>"microsoft edge"===t.getBrowserName(!0),describe(t){if(/\sedg\//i.test(t))return{name:qn.Blink};const e=Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:qn.EdgeHTML,version:e}}},{test:[/trident/i],describe(t){const e={name:qn.Trident},r=Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:t=>t.test(/presto/i),describe(t){const e={name:qn.Presto},r=Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){const e=t.test(/gecko/i),r=t.test(/like gecko/i);return e&&!r},describe(t){const e={name:qn.Gecko},r=Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:qn.Blink})},{test:[/(apple)?webkit/i],describe(t){const e={name:qn.WebKit},r=Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),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(zn,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(Yn,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(Xn,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(Qn,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 r=0;const i={};let n=0;if(Object.keys(t).forEach(s=>{const a=t[s];"string"==typeof a?(i[s]=a,n+=1):"object"==typeof a&&(e[s]=a,r+=1)}),r>0){const t=Object.keys(e),r=Utils.find(t,t=>this.isOS(t));if(r){const t=this.satisfies(e[r]);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(n>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 r=this.getBrowserName().toLowerCase();let i=t.toLowerCase();const n=Utils.getBrowserTypeByAlias(i);return e&&n&&(i=n.toLowerCase()),i===r}compareVersion(t){let e=[0],r=t,i=!1;const n=this.getBrowserVersion();if("string"==typeof n)return">"===t[0]||"<"===t[0]?(r=t.substr(1),"="===t[1]?(i=!0,r=t.substr(2)):e=[],">"===t[0]?e.push(1):e.push(-1)):"="===t[0]?r=t.substr(1):"~"===t[0]&&(i=!0,r=t.substr(1)),e.indexOf(Utils.compareVersions(n,r,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))}}
|
|
357
|
+
/*! exports provided: default */function(t,e,r){r.r(e);var i=r(/*! ../utils/logger */"./src/utils/logger.ts"),n=r(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),s=/^age:\s*[\d.]+\s*$/m,a=function(){function t(t){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=t?t.xhrSetup:null,this.stats=new n.LoadStats,this.retryDelay=0}var e=t.prototype;return e.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},e.abortInternal=function(){var t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))},e.abort=function(){var t;this.abortInternal(),null!==(t=this.callbacks)&&void 0!==t&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},e.load=function(t,e,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=r,this.retryDelay=e.retryDelay,this.loadInternal()},e.loadInternal=function(){var t=this.config,e=this.context;if(t){var r=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0;var n=this.xhrSetup;try{if(n)try{n(r,e.url)}catch(t){r.open("GET",e.url,!0),n(r,e.url)}r.readyState||r.open("GET",e.url,!0)}catch(t){return void this.callbacks.onError({code:r.status,text:t.message},e,r)}e.rangeEnd&&r.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),r.onreadystatechange=this.readystatechange.bind(this),r.onprogress=this.loadprogress.bind(this),r.responseType=e.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),t.timeout),r.send()}},e.readystatechange=function(){var t=this.context,e=this.loader,r=this.stats;if(t&&e){var n=e.readyState,s=this.config;if(!r.aborted&&n>=2)if(self.clearTimeout(this.requestTimeout),0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start)),4===n){e.onreadystatechange=null,e.onprogress=null;var a=e.status;if(a>=200&&a<300){var o,l;if(r.loading.end=Math.max(self.performance.now(),r.loading.first),l="arraybuffer"===t.responseType?(o=e.response).byteLength:(o=e.responseText).length,r.loaded=r.total=l,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(r,t,o,e),!this.callbacks)return;var d={url:e.responseURL,data:o};this.callbacks.onSuccess(d,r,t,e)}else r.retry>=s.maxRetry||a>=400&&a<499?(i.logger.error(a+" while loading "+t.url),this.callbacks.onError({code:a,text:e.statusText},t,e)):(i.logger.warn(a+" while loading "+t.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,s.maxRetryDelay),r.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout)}},e.loadtimeout=function(){i.logger.warn("timeout while loading "+this.context.url);var t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))},e.loadprogress=function(t){var e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)},e.getCacheAge=function(){var t=null;if(this.loader&&s.test(this.loader.getAllResponseHeaders())){var e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t},t}();e.default=a}}).default},t.exports=r())})));var di=Object.freeze({__proto__:null,ATTACHED:"hls:attached"});const ci="com.widevine.alpha";const hi="application/vnd.apple.mpegURL",fi=[hi,"application/x-mpegurl"],pi=document.createElement("video").canPlayType(hi);function gi({src:t="",type:e="",drm:r},i){const n=(null==i?void 0:i.hls)||{},s="native"in n&&n.native;return(!pi||!s)&&(!(r&&!Object.keys(r).find(t=>{return e=t,[ci].filter((function(t){return t===e})).length;var e}))&&(!(!e||!fi.includes(e))||function(t){const{pathname:e}=ir(t);return e.endsWith(".m3u8")}(t)))}var vi="audio:set",mi="audio:update",yi="audio:tracks";const Ei=[ui.Events.SUBTITLE_TRACKS_UPDATED,ui.Events.SUBTITLE_TRACK_SWITCH,ui.Events.LEVEL_SWITCHED];function Ti(t,e){Ei.forEach((function(r){t.on(r,(function(){!function(t,e){var r;const i=t.levels[t.currentLevel];if(!i||!t.subtitleTracks.length||i.attrs.SUB)return;const n=null===(r=null==i?void 0:i.attrs)||void 0===r?void 0:r.SUBTITLES;if(!n)return e.emit("tracks:text:all",[]);const s=t.subtitleTracks.filter((function(t){return t.groupId==n})).map((function(t){return e.textTracks[t.id]}));e.emit("tracks:text:all",s)}(t,e)}))}))}var _i=Object.assign(Object.assign({},{404:"the video was not found",403:"access to this video was denied",410:"the video no longer exists",0:"no internet connection detected"}),{keySystemNoKeys:"no keys",keySystemNoAccess:"no access to key system",keySystemNoSession:"no session for key system",keySystemLicenseRequestFailed:"license request failed",keyLoadError:"decrypt key load failed",keyLoadTimeOut:"decrypt key load timed outs"});const Si=Sr("hls");function bi(t,e,r){if(!t.reaper||!r.src)return;t.hls&&t.hls.destroy();const n="live"in e==0,s={is_audio_only:!1,fragDuration:-1};if(r.drm&&!rr()&&"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname)return t.emit(i,{message:"Secure page required for DRM"});const a=t.hls=new ui(function(t){return Object.assign(Object.assign({autoStartLoad:!1},t.hls),{startPosition:t.start_time||-1})}(e)),o={retry_count:0,previous_url:"",previous_content:""};a.subtitleDisplay=!1,a.attachMedia(t),a.loadSource(r.src),t.emit("hls:attached",{hls:a}),function(t,e){t.on(ui.Events.AUDIO_TRACKS_UPDATED,(function(t,r){e.emit(yi,r.audioTracks)})),t.on(ui.Events.AUDIO_TRACK_SWITCHING,(function(t,r){e.emit(mi,r)})),t.on(ui.Events.MANIFEST_PARSED,(function(t,r){r.audioTracks&&e.emit(yi,r.audioTracks)})),t.on(ui.Events.LEVEL_SWITCHED,(function(r,i){const n=t.levels[i.level];n&&e.emit(yi,t.audioTracks.filter((function(t){return t.groupId&&~(n.audioGroupIds||[]).indexOf(t.groupId)})))}))}(a,t),Ti(a,t);const l=function(t){var e;const r=null===(e=t.data)||void 0===e?void 0:e.level;"number"==typeof r&&(a.levels[r]||-1===r?a.nextLevel=r:console.error(new Error("skipping invalid quality: "+t.data)))},u=function(t){var e;const r=null===(e=t.data)||void 0===e?void 0:e.id;"number"==typeof r&&r!=a.audioTrack&&setTimeout((function(){a.audioTrack=r}),0)};t.on("quality:set",l),t.on(vi,u),t.on("src",(function(){t.hls&&t.hls.destroy(),t.off("quality:set",l),t.off(vi,u)})),t.on("audioonlysource",(function(){s.is_audio_only=!0})),t.on(L,(function(){a&&a.destroy()})),t.on("remotesession:started",()=>{t.hls&&t.hls.stopLoad()}),t.on("remotesession:ended",()=>{t.hls&&Ai(t)}),n&&a.on(ui.Events.LEVEL_LOADED,(function(e,r){t.setOpts({live:r.details.live})})),a.on(ui.Events.MANIFEST_PARSED,(function(r,i){const n=i.levels.slice(0).reduce((t,e,r)=>[...t,{level:r,text:e.name||e.width+"",width:e.width,height:e.height,videoCodec:e.videoCodec||""}],[{text:"AUTO",level:-1,width:0,height:0,videoCodec:""}]).sort((t,e)=>e.width-t.width);t.emit("qualities",n),function(t,e,r){var i,n;if(!t.hls)return;Si("Initializer::maybe_start_load_with_quality (start_quality, preload): (%d, %s)",e.start_quality,e.preload),void 0!==e.start_quality&&(vt.HIGH&e.start_quality&&(t.hls.startLevel=r[0].level),vt.LOW&e.start_quality&&(t.hls.startLevel=r[r.length-1].level),vt.MEDIUM&e.start_quality&&(t.hls.startLevel=r[Math.ceil(r.length/2)-1].level));const s=(null===(i=e.hls)||void 0===i?void 0:i.maxBufferSize)||1024,a=(null===(n=e.hls)||void 0===n?void 0:n.maxBufferLength)||30;Si("Setting maxBufferSize to %d",s),t.hls.config.maxBufferSize=s,"metadata"===e.preload&&Si("preload === metadata, setting maxBufferLength to 1sec");if(t.hls.config.maxBufferLength="metadata"===e.preload?1:a,t.once(E,()=>{Si("Playback started, set maxBufferLenght to %d",a),t.hls&&(t.hls.config.maxBufferLength=a)}),"none"===e.preload&&!e.autoplay)return;Ai(t,e.start_time||-1)}(t,e,n.slice(0,-1));const s=n.find(t=>!!t.videoCodec);s||t.emit("audioonlysource"),!t.opt("ratio")&&s&&0!=s.width&&0!=s.height&&t.setOpts({ratio:s.width+":"+s.height})})),a.on(ui.Events.INIT_PTS_FOUND,(function(t,e){s.fragDuration=e.frag.duration})),a.on(ui.Events.ERROR,(function(e,r){!function(t,e,r,n){if(0==t.reaper)return;if(0==e.fatal)return;switch(e.type){case ui.ErrorTypes.MEDIA_ERROR:return function(t,e){var r;t.emit(i,{fatal:!0,message:"Unrecoverable error occurred while playing media"}),null===(r=t.hls)||void 0===r||r.destroy()}(t);case ui.ErrorTypes.NETWORK_ERROR:return function(t,e){var r;const n=(null===(r=e.networkDetails)||void 0===r?void 0:r.status)||"";t.emit(i,{fatal:!0,code:"http:"+n.toString(),message:_i[n]||"an error occurred while loading this video"})}(t,e);case ui.ErrorTypes.KEY_SYSTEM_ERROR:(function(t,e){var r;t.emit(i,{fatal:!0,message:_i[e.details]||"an error occurred while accessing this video"}),null===(r=t.hls)||void 0===r||r.destroy()})(t,e)}}(t,r,t.original_src,a.config)})),a.on(ui.Events.LEVEL_PTS_UPDATED,(function(e,r){var i;if("video"!==r.type&&(!s.is_audio_only||"audio"!==r.type))return;const n=null===(i=null==r?void 0:r.details)||void 0===i?void 0:i.fragments;if(!n)return;const a=n[0].start||0,o=n[n.length-1].start+n[n.length-1].duration;t.emit("dvr/window",o-a)})),a.on(ui.Events.LEVEL_SWITCHING,(e,r)=>{const i=a.levels[a.currentLevel],n=a.levels[r.level];t.emit("qualitychange",{before:i,after:n,kind:"hls"})}),a.on(ui.Events.LEVEL_UPDATED,(t,e)=>{e.details.url!==o.previous_url&&(o.retry_count=0),o.previous_url=e.details.url;const r=o.previous_content;if(o.previous_content=e.details.m3u8,r===e.details.m3u8){if(o.retry_count++,o.retry_count<3)return;if(a.levels[e.level].url.length<2)return;a.levelController.redundantFailover(a.currentLevel)}});const d=t.opt("start_time");d&&t.once(p,(function(){t.currentTime=d})),"none"!==e.preload||e.autoplay||t.once("beforeplay",()=>{t.hasState("is-casting")||Ai(t,e.start_time||-1)})}function Ai(t,e){var r;!t.hasState($)&&t.setState(Z,!0),null===(r=t.hls)||void 0===r||r.startLoad(e)}class HLS{init(){}onload(t,e,r,i){bi(r,t,i)}wants(t,e,r){return ui.isSupported()&&gi(e,r)}}HLS.events=di,HLS.version=ui.version,re(window,HLS);const Li=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),wi=(...t)=>t.reduce((t,e)=>Li(e)?(Object.keys(e).forEach(r=>{if(Li(t[r])&&Li(e[r]))return t[r]=wi(t[r],e[r]);t[r]=e[r]}),t):t,{});class Pipe{constructor(t){this.data=t}static of(t){return new Pipe(t)}static maybe(t,e,...r){return null==t?t:e.apply(t,[t,...r])}tap(t,...e){return t.apply(this,[this.data,...e]),new Pipe(this.data)}fmap(t,...e){const r=t.apply(this,[this.data,...e]);return new Pipe(r)}unwrap(){return this.data}}function Ri(t){return fetch(t).then(t=>t.json())}function Di(){let t=[].join.call(arguments,"/");return"/"!==t[0]&&(t="/"+t),ki()+"/web/public/native/config"+t}const ki=()=>"https://ljsp.lwcdn.com";function Oi(t){return~t.indexOf("/")?t:"/media/"+t}var Ii={404:"media not found",402:"invalid subscription",400:"bad request",415:"unsupported media type"};function Ci(t){const e=t.ima,r=t.duration;if(!e||!r)return t;const i=null==e?void 0:e.ads;return Array.isArray(i)&&(e.ads=i.map((function(t){return"number"==typeof t.percentage&&(t.time=t.percentage*r),t}))),t}function Pi(t,e){var r,i;e="object"==typeof e?e:{};const n={title:null===(r=null==t?void 0:t.metadata)||void 0===r?void 0:r.title,description:null===(i=null==t?void 0:t.metadata)||void 0===i?void 0:i.description},s={ima:{parameters:function({media_id:t,duration:e,title:r,tags:i,category_name:n,ad_keywords:s}){return{ad_keywords:s||"",media_id:t||"",category:n||"",media_name:r||"",media_tags:i||"",media_duration:e||-1}}((null==t?void 0:t.metadata)||{})}},a=e.embed||{};return delete a.src,wi(s,n,t,(delete(o=e).src,delete o.metadata,delete o.title,delete o.description,delete o.duration,delete o.poster,o),a);var o}const xi=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;function Mi(t){return"object"==typeof t&&"ovp/base64"==t.type}function Fi(t,e){return function(t,e){return!t.startsWith("blob:")&&(!(~t.indexOf(".")||!xi.test(t))&&(e.type="video/ovp",!0))}(t,e)||Mi(e)}function Ni(t){try{return function(t){return null===t?{}:JSON.parse(t)}(decodeURIComponent(atob(t).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return{err:t.message}}}function Ui(t){const e=t.split(/[^0-9]/).map(t=>parseInt(t,10));return Date.UTC(e[0],e[1]-1,e[2],e[3],e[4],e[5])}function Bi(t){return t.live}var Gi=Object.freeze({__proto__:null,OVP_ERROR:"ovp:error",OVP_MEDIA_REQUEST_START:"ovp:request:start",OVP_MEDIA_REQUEST_COMPLETE:"ovp:request:media:complete",OVP_PLAYLIST_REQUEST_COMPLETE:"ovp:request:playlist:complete",LIVE_COUNTDOWN_TICK:"ovp:live:countdown:tick",LIVE_COUNTDOWN_START:"ovp:live:countdown:start",LIVE_COUNTDOWN_COMPLETE:"ovp:live:countdown:complete",OVP_MEDIA_CHANGED:"ovp:media:changed",OVP_REALTIME_MESSAGE:"ovp:message:realtime"});function ji(t,e){const r=null==e?void 0:e.src;if(Mi(e))return function(t,e){const r=Ni(e.src||"");if(function(t){return"string"==typeof t.err}(r))return console.error(r.err);Hi(t,r)}(t,e);r&&Pipe.of(r).fmap(Oi).fmap(Di).fmap(t=>fetch(t)).fmap(e=>e.then(t=>Promise.all([t.status,t.json()])).then(([e,r])=>200==e?Hi(t,r):Ki(t,r)))}function Hi(t,e){return t.emit("ovp:media:changed",e),function(t){return Array.isArray(t.playlist)}(e)?function(t,e){if("function"!=typeof window.flowplayer.playlist)return console.warn("OVP responded with Playlist media but the playlist plugin does not exist"),Ki(t,{status:415});t.emit("ovp:request:playlist:complete",function(t,e){const r=Object.assign({},t),i=(null==t?void 0:t.playlist)||{},n=wi(e,i),s=((null==n?void 0:n.playlist)||[]).map(t=>Pi(t,r));return Object.assign(n,{playlist:s})}(t.opts,e))}(t,e):Bi(e)?function(t,e){var r,i;const n=(null===(r=null==e?void 0:e.metadata)||void 0===r?void 0:r.live_start_time)||(null===(i=null==e?void 0:e.metadata)||void 0===i?void 0:i.starttime);n&&(e.live_start_time=Pipe.of(n).fmap(Ui).unwrap());t.emit("ovp:live:countdown:start",Pipe.of(e).fmap(Pi,t.opts).fmap(Ci).unwrap())}(t,e):function(t,e){t.emit("ovp:request:media:complete",Pipe.of(e).fmap(Pi,t.opts).fmap(Ci).unwrap())}(t,e)}function Ki(t,e){return e.message?t.emit("ovp:error",e):e.status?t.emit("ovp:error",new Error(Ii[e.status])):t.emit("ovp:error",e)}const Vi={};function qi(t,e,r){"object"!=typeof Vi[e]&&(Vi[e]=r);const i=t.opts,n=(null==i?void 0:i.metadata)||{};n.player_id=e,i.metadata=n,r.title&&delete r.title,r.description&&delete r.description;const s=Object.assign(i,r);t.setOpts(s),r.autoplay&&t.togglePlay(!0)}let Wi=!1;function zi(t,e,r){Yi()||Pipe.of("recommendation").fmap(Di,e,r).fmap(Ri).fmap(e=>e.then(e=>function(t,e){const r=e.playlist;if(t.opts.recommendations=r,!r.length)return;t.emit("recommendationsready",{playlist:r.map((function(t){var e;return{poster:t.poster,src:t.src,title:null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.title,metadata:t.metadata||{}}}))})}(t,e)).catch(Xi))}function Yi(){return Wi}function Xi(t){Wi=!0,console.error("Failed to load recommendations: %j",t)}function Qi(t){const e=Date.now()-(t.server_time_offset||0);return Math.floor(((t.live_start_time||0)-e)/1e3)}function $i(t,e){let r=0;function i(){const i=Qi(e);if(i<0||isNaN(i)||0===t.reaper)return clearInterval(r),function(t,e){t.emit("ovp:live:countdown:complete");const r=Pt(t,z);r&&r.remove(),t.root.classList.remove("is-livecountdown"),t.emit("ovp:request:media:complete",e)}(t,e);!function(t,e,r,i){r.classList.add("is-livecountdown"),e.emit("ovp:live:countdown:tick",{remaining_time:Zi(i+1)}),e.hasState(J)||e.setState(J,!0)}(0,t,t.root,i)}var n;n=e,kr().then(t=>Object.assign(n,{server_time_offset:t})),i(),r=setInterval(i,250)}function Zi(t){const e=function(t){"number"!=typeof t&&(t=parseInt(t,10)),t=Math.round(t);const e=Math.floor(t/86400);t-=86400*e;const r=Math.floor(t/3600);t-=3600*r;const i=Math.floor(t/60);return{days:e,hours:r,minutes:i,seconds:t-=60*i}}(t);let r="";return e.days&&(r+=e.days+":"),r+Nt(e.hours)+":"+Nt(e.minutes)+":"+Nt(e.seconds)}class WebsocketBridge{constructor(t){this.manualDisconnect=!1,this.video=t,this.onClose=this.onClose.bind(this),this.onMessage=this.onMessage.bind(this)}static of(t){return new WebsocketBridge(t)}connect(t){this.client=new WebSocket("wss://player.ws.flowplayer.com?mediaId="+t),this.current_media_id=t,this.wireup()}onClose(){this.manualDisconnect?this.manualDisconnect=!1:this.current_media_id&&this.reconnect(this.current_media_id)}onMessage(t){JSON.parse(t.data).forEach(t=>{this.video.emit("ovp:message:realtime",t)})}reconnect(t){this.cleanup(),this.connect(t)}wireup(){this.client&&(this.client.addEventListener("message",this.onMessage),this.client.addEventListener("close",this.onClose))}cleanup(){this.client&&(this.client.removeEventListener("message",this.onMessage),this.client.removeEventListener("close",this.onClose),this.client=void 0)}disconnect(){this.client&&(this.manualDisconnect=!0,this.client.close())}}class FlowplayerLiveCountdown extends FlowplayerComponent{constructor(t){super(t),this.classList.add("fp-livecountdown");const e=Mt("fp-inner");this.append(e);const r=document.createElement("p");r.innerText=t.i18n("ovp.starting_in"),e.append(r);const i=document.createElement("p");i.classList.add("fp-countdown"),e.append(i),t.on("ovp:live:countdown:tick",e=>{const r=e.detail.remaining_time;t.root.classList.add("is-livecountdown"),i.innerText=r})}}const Ji=["*.lwcdn.com","*.flowplayer.com"];class OVP{constructor(t){gt(t,z,FlowplayerLiveCountdown)}onload(t,e,r,i){if("string"==typeof i.src)return"string"!=typeof t.player_id||0===i.src.indexOf(t.player_id)||Mi(i)||(i.src=[t.player_id,i.src].join("/")),ji(r,i)}wants(t,e,r){return Fi(t,e)}init(t,e,r){const n=new WebsocketBridge(r);let s=Object.assign({},t);const a=function(t){if(!s)return t;delete s.src;const e=wi(t,s);return s=!1,e};r.on("ovp:error",(function(t){r.emit(i,t.data)})),r.on("ovp:request:start",(function(){r.setState(rt,!0),t.recommendations&&(t.recommendations=!1)})),r.on("ovp:media:changed",(function({data:t}){var e;const r=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.media_id;(null==t?void 0:t.live)&&r&&(n.disconnect(),n.connect(r))})),r.on("ovp:message:realtime",(function({data:e}){var i;const n=null==e?void 0:e.event,s=null==e?void 0:e.value,a=r.opt("metadata",{live_start_time:""});switch(n){case"METADATA":{const e=Object.assign(a,s),n=Object.assign(t,{metadata:e});n.live&&(null===(i=null==n?void 0:n.metadata)||void 0===i?void 0:i.live_start_time)&&(n.live_start_time=Ui(n.metadata.live_start_time)),r.setOpts(n);break}}})),r.on("beforeplay",(function(e){const r=t;if(Bi(r)){if(tn(r))return;e.preventDefault()}})),r.on("ovp:request:media:complete",(function(t){const e=t.data;if(!e)return;if(0==r.reaper||"object"!=typeof e||Qi(e)>0)return;const i=a(e);r.setOpts(i),r.setAttrs(i),i.src&&r.setSrc(i.src)})),r.on(w,(function({data:i}){var n,s;if("string"==typeof t.src&&Fi(t.src,{}))return;if(t.src&&en(t.src))return;if((null==i?void 0:i.domains)&&(null==i?void 0:i.domains.length)&&!((t,e)=>{const r=t.split(".").reverse();return e.concat(Ji).some(t=>{const e=t.split(".").reverse(),i="*"===e[e.length-1];return i&&e.pop(),(i||e.length===r.length)&&e.every((t,e)=>r[e]===t)})})(function(){try{return window.location.hostname!==window.parent.location.hostname?ir(document.referrer).hostname:document.location.hostname}catch(t){return window.location.hostname}}(),i.domains))return ce({root:e,video:r,data:{details:`Hostname ${window.location.hostname} is not allowed to load player ${null===(n=i.metadata)||void 0===n?void 0:n.player_id}.`,reason:"domain"}});const a=null==i?void 0:i.brand_color;return a&&r.root.style.setProperty("--fp-brand-color","#"==a[0]?a:"#"+a),"string"==typeof t.player_id&&(null===(s=null==t?void 0:t.metadata)||void 0===s?void 0:s.player_id)!==t.player_id?function(t,e){if("object"==typeof Vi[e])return console.debug("using Cache(%s)",e),qi(t,e,Vi[e]);Pipe.of(e).fmap(Di).fmap(Ri).fmap(r=>r.then(r=>qi(t,e,r)).catch(console.error))}(r,t.player_id):void 0})),r.on("ovp:request:playlist:complete",(function(t){const e=t.data;if(!e||0==r.reaper)return;const{playlist:i}=e,n=_t(e,["playlist"]),s=a({playlist:n});Array.isArray(s.playlist)&&(s.playlist=n),r.setOpts(s);const o={type:"flowplayer/playlist",items:i};r.setSrc(o)})),r.on("ovp:live:countdown:start",(function(i){const n=i.data;if(!n||0==r.reaper)return;const s=a(n);if(r.setOpts(s),r.setAttrs(s),Qi(n)<=0)return r.emit("ovp:request:media:complete",n);Pt(r,z)||(e.appendChild(pt(r,z)),$i(r,t))})),r.on("timeupdate",(function(){var e,i,n;const s=t;Bi(s)?tn(s)||(r.togglePlay(!1),r.emit(S)):t.recommendations&&(null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.media_id)&&(Array.isArray(t.recommendations)||r.currentTime/r.duration<.8||Yi()||(null===(i=null==t?void 0:t.metadata)||void 0===i?void 0:i.media_id)&&(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.player_id)&&zi(r,t.metadata.media_id,t.metadata.player_id))})),r.on(L,(function(){n.disconnect()}))}}function tn(t){var e,r;const i=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.live_stop_time;if(!i)return!0;return!!(null===(r=null==t?void 0:t.metadata)||void 0===r?void 0:r.allow_after_stop_time)||Ui(i)>Date.now()}OVP.events=Gi;const en=t=>{var e;if(t&&Array.isArray(t))return"object"==typeof t[0]&&"ovp/base64"===(null===(e=t[0])||void 0===e?void 0:e.type)};function rn(t){return{width:t.clientWidth,height:t.clientHeight}}function nn(t,e,r){return"number"==typeof r&&(r+="px"),t.style.setProperty(e,r),t}re(window,OVP);const sn="ad-initialized";var an=Object.freeze({__proto__:null,AD_INIT:sn,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"});const on="undefined"!=typeof document&&"undefined"!=typeof window&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;const ln=Sr("ads/lifecycle"),un=["ad-playback-error","ad-teardown","ad-break-completed"];async function dn({config:t,root:e,content:r,ads:i,ima:n}){ln("LifeCycle::initLifeCycle",t,e,r,i,n),r.autoplay=!1;const s=t.autoplay===mt.AUDIO_REQUIRED,a=function(t,e){return{muted:!(e||!t.muted),volume:t.volume}}(r,s);r.on("volumechange",()=>{a.volume=r.volume,a.muted=r.muted});const o=pt(r,"flowplayer-ad-ui"),l=o.adContainer;e.append(o);const u={listening:!1,preload:null==n?void 0:n.preload_ads};if(ln("initial",a),i.setVideoTag(r),t.autoplay){ln("Trying to autoplay"),o.hideFirstFrame(e);await async function t(e,r){const[i,n]=[e.muted,e.volume];ln("Lifecycle::peek_content(:muted => %s, :volume => %s)",i,n);const s=()=>new Promise(t=>setTimeout(t,0,!1));r&&(e.muted=!1,e.volume=e.volume?e.volume:1);try{return await async function(t){return ln("Lifecycle::wait_for_source"),new Promise((e,r)=>{let i=0;const n=setInterval(()=>{if(++i>40)return clearInterval(n),r(new Error("No source in 2000ms, giving up"));t.currentSrc&&(e(null),clearInterval(n))},50)})}(e),e.volume&&(e.volume=.01),ln("Lifecycle::peek_content::play"),await new Promise(t=>setTimeout(()=>t(e.togglePlay(!0)))),ln("Lifecycle::peek_content::pause"),await new Promise(t=>setTimeout(()=>t(e.togglePlay(!1)))),e.volume=n,ln("Lifecycle::peek_content::true"),!0}catch(a){return e.volume=n,r?(e.muted=!1,0==e.volume&&(e.volume=1),await s()):i||!n?(ln("Lifecycle::peek_content::false"),await s()):(ln("Lifecycle::peek_content::recover"),e.muted=!0,!!await t(e)||(e.muted=i,ln("Lifecycle::peek_content::false"),await s()))}}(r,s)?(ln("Can autoplay, start ad"),r.opts.autoplay=1,cn({ads:i,content:r,state:u,adContainer:l,ima:n,config:t})):(ln("cannot autoplay(audioRequired: %s), fallback to poster state",s),t.autoplay=0,o.showFirstFrame(e),r.setState("is-starting",!0))}t.autoplay||i.hasPreroll()&&function({content:t,ads:e,config:r,state:i,initial:n,adContainer:s,ima:a}){t.once("beforeplay",(async function(o){(t.hasState(at)||"touchend"!=o.type)&&e.shallPlayAd(0)&&(!on&&o.preventDefault(),gn({ads:e,content:t,state:i}),ln("user_gesture(:intercept) -> shallPlayAd(0: %s)",e.shallPlayAd(0)),r.muted=n.muted,await cn({ads:e,content:t,state:i,adContainer:s,ima:a,config:r}),vn({ads:e,content:t}))}))}({content:r,ads:i,config:t,state:u,initial:a,adContainer:l,ima:n}),!t.autoplay&&i.hasPreroll()&&u.preload&&cn({ads:i,content:r,state:u,adContainer:l,ima:n,config:t}),pn({config:t,root:e,content:r,ads:i,state:u,adContainer:l,ui:o,ima:n,initial:a}),r.on("src",()=>{r.once("beforeplay",()=>i.resetScheduleCounter())}),r.on("beforeplay",t=>{(i.adBreak||i.adPlaying||i.adRequesting)&&(i.adBreak&&!i.adLinear||(ln("prevented content from starting because ad break is active"),t.preventDefault()))})}async function cn(t){t.state.started||(t.content.hasState(at)?await hn(t):t.content.once("viewenter",async()=>{await hn(t)}))}async function hn({ads:t,content:e,adContainer:r,ima:i,state:n,config:s}){var a;n.started=!0;const o=_t(i,["ads"]),l=rn(e.root),u=(null==s?void 0:s.muted)||e.muted,d=Object.assign(Object.assign(Object.assign({container:r,volume:u?0:e.volume,muted:u,autoplay:(null==s?void 0:s.autoplay)||!1,video_source:e.original_src,DisableCustomPlaybackForIOS10Plus:on,preload_ads:null===(a=null==s?void 0:s.ima)||void 0===a?void 0:a.preload_ads},o),l));ln("start():",d,n),await t.initialize(!1,d,n.preload)}function fn(t,e){var r,i;return{content_width:t.clientWidth||(null===(r=t.parentNode)||void 0===r?void 0:r.clientWidth)||e.clientWidth,content_height:t.clientHeight||(null===(i=t.parentNode)||void 0===i?void 0:i.clientHeight)||e.clientHeight}}function pn({config:t,root:e,content:r,ads:i,initial:n,adContainer:s,state:a,ui:o,ima:l}){ln("addUIListeners()"),r.once(E,async n=>{if(i){if(ln("addUIListeners() -> content started playing"),gn({ads:i,content:r,state:a}),!i.shallPlayAd(0)||!i.adapter.isLinearAd())return ln("addUIListeners() -> no more preroll ads -> resume content"),o.showFirstFrame(e),await cn({ads:i,content:r,state:a,adContainer:s,ima:l,config:t});r.togglePlay(!1),await cn({ads:i,content:r,state:a,adContainer:s,ima:l,config:t}),i.shallPlayAd(0)&&i.adapter.isLinearAd()&&(o.classList.add("on","linear"),e.classList.add(rt),vn({ads:i,content:r}))}}),r.on([D,R],(function(){if(!i)return;const{content_width:t,content_height:n}=fn(r,e);i.resize({height:n,width:t})})),r.on("resize",t=>{if(!i||!t.detail)return;const{width:e,height:r}=t.detail.contentRect;i.resize({width:e,height:r})}),r.on(S,t=>{var e;i&&(ln("ui_listeners(:%s, event: %o)",t.type,t.detail),(null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.from)!==i&&(t.preventDefault(),Object.assign(t,{prevented_from_ads:!0}),i.finished((function(){r.emit(S,{from:i})}))))}),i.on("ad-requested",()=>{e.classList.toggle(rt,!0)}),i.once("ad-started",()=>{r.on(["beforeplay","beforepause"],t=>{var e;if(!i.adBreak||!i.adapter.isLinearAd())return;t.preventDefault();const r=(null===(e=t.detail)||void 0===e?void 0:e.forced)?"beforeplay"===t.type:!i.adPlaying;r&&i.paused&&i.resume(),r||i.paused||i.pause()})}),i.on("ad-started",t=>{const s=t.detail,{linear:a,ad:l,ad_type:u}=s;let d;if(ln(`Ad[linear: ${a}, currentTime: ${r.currentTime}] starting`,l),"preroll"==u&&!a&&r.paused&&r.togglePlay(!0),"preroll"==u&&a&&r.currentTime>0&&!r.opt("start_time")&&!r.opt("live")&&(ln("Preroll[rewind: true]",r.currentTime),r.currentTime=0),a&&(d=fn(r,e)),i.resize({width:d?d.content_width:l.width,height:d?d.content_height:l.height,linear:a,resize_non_linear:!0}),o.resize({linear:a,resizeContainerAlso:!0,width:a?void 0:l.width,height:a?void 0:l.height}),e.classList.remove(rt),o.classList.add("on"),o.classList.toggle("linear",a),o.classList.toggle("non-linear",!a),!a){ln("non-linear ad / restarting content");try{r.togglePlay(!0),r.volume=n.volume,r.muted=n.muted}catch(t){ln(t)}}}),i.on("ad-pause-content",()=>{o.resize({linear:!0,width:0,height:0})}),r.on(un,t=>async function({root:t,content:e,ads:r,ui:i,eventName:n,err:s={reason:""}}){ln("teardown(event: %s)",n),t.classList.add("is-seamless"),i.classList.remove("is-vpaid"),t.classList.remove(rt),s.reason&&ln("teardown(:err, reason: %s) %o",s.reason);i.classList.remove("on");const a=r.getLastAd();if(i.showFirstFrame(t),!r.shouldRestartContent())return ln("Lifecycle.teardown(:skip_restart, reason: %s)","Ad prevented restarting content"),mn(t);if(e.currentTime>0&&e.currentTime>=e.duration||"postroll"==r.ad_type||!1===(null==a?void 0:a.restart))return ln("Lifecycle.teardown(:skip_restart, reason: %s)","was a postroll ad"),mn(t);""===e.currentSrc&&e.setSrc(e.original_src);e.paused&&r.shouldRestartContent()&&(ln("Lifecycle.teardown(:toggle_play, %s)","attempting to restart content"),await e.togglePlay(!0));if(!e.paused)return ln("Lifecycle.teardown(:ok)","restarted video content"),mn(t)}({root:e,content:r,ads:i,ui:o,err:t.detail,eventName:t.type}));let u=!!t.autoplay;var d;r.on("viewenter",()=>{u&&i.resume()}),r.on("viewleave",(d=()=>{u=!i.paused,i.pause()},t=>{setTimeout((function(){if(!t.defaultPrevented)return d(t)}),0)}))}function gn({ads:t,content:e,state:r}){r.listening||(e.on(["timeupdate",b,E,A],r=>{t.adPlaying&&t.adapter.isLinearAd()&&!t.adapter.isSharedVideoTag()&&!e.paused&&e.pause(),vn({ads:t,content:e,seek:r.type===A})}),r.listening=!0)}function vn({ads:t,content:e,seek:r=!1}){t&&t.setCurrentTime(e.currentTime,void 0,r)}function mn(t){t.classList.remove("is-seamless")}const yn=Sr("ads/timers");class TimerRegistry{constructor(t={},e={}){this.intervals=t,this.timers=e}}let En=-1;function Tn(t,e,r){const i=setInterval(r,e);if(yn("TimerRegistry.createInterval() -> "+i,t.intervals),"object"==typeof i){const e=++En;return t.intervals[e]=e,e}return t.intervals[i]=i,i}function _n(t){if(t)return yn("TimerRegistry.empty()",Object.keys(t.timers),Object.keys(t.intervals)),Object.keys(t.intervals).forEach(e=>function(t,e){return yn("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 yn("TimerRegistry.removeTimeout() -> "+e,t.timers),clearTimeout(t.timers[e]),delete t.timers[e],t}(t,e)),t}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,r){if(this._loadPending=!1,!e)return!1;const i=r?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"}}}function Sn(t){try{return t.getAdPodInfo().getPodIndex()}catch(t){return}}class IMA{constructor(t){this.eventHandler=t,this.log=Sr("ads/adapter/ima"),this.google=window.google,this._adHandlers=[],this._timers=new TimerRegistry,this._started=!1,this._volumeLevel=0,this._adLoaded=!1,this._paused=!1,this._all_ads_completed=!1,this._currentDuration=0,this._currentRemaining=0,this._currentDisplayTs=0,this._iosPlaysInline=!1,this.sharedVideoTag=!1,this._isInitialized=!1,this._prepared=!1,this.opts={}}async init(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("ad-adapter-init-failed")}}isReady(){return!!this._isInitialized}setIOSPlaysInline(t){this.log("setIOSPlaysInline",t),this.sharedVideoTag=!t,this.initialize(Object.assign(Object.assign({},this.opts),{DisableCustomPlaybackForIOS10Plus:t}))}getIOSPlaysInline(){return this._iosPlaysInline}setVideoTag(t){this.videoTag=t}isLinearAd(){return!!this._adLinear}isSharedVideoTag(){return!!this.sharedVideoTag}getVideoTag(){return this.videoTag}getDimensions(){return this._dimensions||{}}getOpts(){return this.opts}isPaused(){return this._paused}destroy(){_n(this._timers),this._adHandlers&&this._adHandlers.forEach(t=>t()),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(t){const e=this.isAdPod(),r=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;t.NumRedirects=t.NumRedirects||t.redirects;const n={VpaidMode:this.google.ima.ImaSdkSettings.VpaidMode.INSECURE,DisableCustomPlaybackForIOS10Plus:!0};if(i.setVpaidMode(t.VpaidMode||n.VpaidMode),i.setDisableCustomPlaybackForIOS10Plus(t.DisableCustomPlaybackForIOS10Plus||n.DisableCustomPlaybackForIOS10Plus),"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,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 r=new this.google.ima.AdsRenderingSettings;this.log("ima.rendering(preload: %s)",!!t.preload_ads),r.useStyledNonLinearAds=!0,r.enablePreloading=!!t.preload_ads,"number"==typeof t.media_timeout&&(r.loadVideoTimeout=t.media_timeout),r.restoreCustomPlaybackStateOnAdBreakComplete=!t.DisableCustomPlaybackForIOS10Plus,this.sharedVideoTag&&(r.playAdsAfterTime=this.videoTag.currentTime),this.eventHandler.trigger("ad-ima-rendering-settings",r);const i=this._adsManager=e.getAdsManager(this.videoTag,r);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.STARTED,t=>{this.debugEvent(t);const e=t.getAd();e&&(this._currentDuration=e.getDuration(),this._currentDisplayTs=Date.now(),this.emitWithAd("ad-started",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("ad-completed",e),_n(this._timers)}),i.addEventListener(this.google.ima.AdEvent.Type.SKIPPED,t=>{this.debugEvent(t);const e=t.getAd();e&&this.emitWithAd("ad-skipped",e)}),i.addEventListener(this.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,t=>{this.debugEvent(t);const e=t.getAd();e&&this.emitWithAd("ad-pause-content",e)});const n=()=>{this._started=!1,this._currentDisplayTs=0,this.eventHandler.trigger("ad-break-completed")};i.addEventListener(this.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,t=>{this.debugEvent(t),n()}),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("ad-volume-changed",e)});const s=t=>{this._paused=t,this.eventHandler.trigger(t?"ad-paused":"ad-resumed")};i.addEventListener(this.google.ima.AdEvent.Type.PAUSED,()=>s(!0)),i.addEventListener(this.google.ima.AdEvent.Type.RESUMED,()=>s(!1)),i.addEventListener(this.google.ima.AdEvent.Type.STARTED,()=>s(!1)),i.addEventListener(this.google.ima.AdEvent.Type.VOLUME_MUTED,t=>{this.log("IMA::volume(type: %s, event: %o)","mute",t),this.eventHandler.trigger("ad-muted")});const{width:a,height:o}=t;a&&o&&(i.init(a,o,this.google.ima.ViewMode.NORMAL),this.log("ima.initialise: done initializing"))}),r&&(this.log("Event(reload: %s)","reload-ad-requested"),this.eventHandler.trigger("reload-ad-requested",e)),this.eventHandler.trigger(sn,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"),_n(this._timers),this.clearAdHandlers(),this._started=!1,this._adLoaded=!1}cleanup(){this.destroyManager("cleanup"),this._adsLoader&&this._adsLoader.destroy(),this._adDisplayContainer&&this._adDisplayContainer.destroy(),this._adLoaded=!1}waitForAdsManager(){return new Promise(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){this.log(`ima.initAd(adTag: ${t}, timeout: ${e})`);try{await this.requestAd(t,e),this._adLoaded=!0}catch(t){throw this.log("ima.initAd:",t),this._adLoaded=!1,t}finally{_n(this._timers)}}async requestAd(t,e){if(this.destroyManager("requestAd"),!this.videoTag)return;const{autoplay:r=!1}=this.opts,i=Date.now(),n=this.videoTag.muted;this._volumeLevel=this.videoTag.volume;const s=n||0==this._volumeLevel;this._all_ads_completed=!1,this.log("ima.requestAd(%o)",Object.assign(Object.assign({},this.opts),{autoplay:r,muted:n,timeout:e,adTag:t,_volumeLevel:this._volumeLevel,manager:this._adsManager})),this.clearAdHandlers();const a=new this.google.ima.AdsRequest;a.adTagUrl=t;const{height:o,width:l}=this.opts;if(l&&(a.linearAdSlotWidth=l),o&&(a.linearAdSlotHeight=o),!this.opts.disable_non_linear_ads&&l&&(a.nonLinearAdSlotWidth=l),!this.opts.disable_non_linear_ads&&o&&(a.nonLinearAdSlotHeight=o-50),a.setAdWillAutoPlay(r),a.setAdWillPlayMuted(s),a.vastLoadTimeout=e,this.eventHandler.trigger("ad-ima-before-ads-request",{request:a}),!this._adsLoader)return;this._adsLoader.requestAds(a);return new Promise(async(t,r)=>{const n=e=>{clearTimeout(o),t(e)},a=t=>{clearTimeout(o),r(t)};this.once(this._adsLoader,this.google.ima.AdErrorEvent.Type.AD_ERROR,t=>{this.emitError("ad-request-error",t),a(new Error("Ad load failed"))});const o=setTimeout(()=>{const t=new Error("Ad internal timeout reached");this.eventHandler.trigger("ad-timeout",t),r(t)},1.5*(e+(this.opts.media_timeout||5e3))),l=await this.waitForAdsManager();this.volume(s?0:this._volumeLevel),this.eventHandler.trigger("ad-volume-changed",this._volumeLevel);const u=this.cuepoints();if(u&&u.length&&0!==u[0])return n({ad:!1,adsManager:l});this.once(l,this.google.ima.AdErrorEvent.Type.AD_ERROR,t=>{this.emitError("ad-playback-error",t),a(t)}),this.once(l,this.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,()=>{this._all_ads_completed=!0,n(null)}),this.once(l,this.google.ima.AdEvent.Type.LOADED,t=>{this.eventHandler.trigger("ad-request-completed",{request_load_time:Date.now()-i});const e=t.getAd();e&&(this.log("ima.requestAd: AD_REQUEST_COMPLETED",e.getContentType()),"application/javascript"==e.getContentType()&&this.eventHandler.trigger("vpaid-init",e),n(null))}),this.once(l,this.google.ima.AdEvent.Type.CLICK,()=>{this.log("ima.requestAd: click event"),this.pause()})})}async playAd(){if(this.log("ima.playAd()",this),!this._adsManager||!this._adLoaded)return;const t=this.currentAd();if(t&&(!this.sharedVideoTag||t.isLinear()))try{await this.startAndWaitForAdCompletion(this._adsManager,t.isLinear())}catch(t){throw this.log("ima.playAd",t),t}finally{this._adLoaded=!1,_n(this._timers)}}startAndWaitForAdCompletion(t,e){if(!this._started)return this.log("ima.startAndWaitForAdCompletion(manager: %o)",{volume:t.getVolume()}),new Promise((r,i)=>{let n=!1;this.once(t,this.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,()=>{if(this.log("ima.startAndWaitForAdCompletion: CONTENT_RESUME_REQUESTED <<< happened"),this._started=!1,n)return this.log("ima.startAndWaitForAdCompletion: Content resume requested, but trying to recover from ad error");r()}),this.once(t,this.google.ima.AdErrorEvent.Type.AD_ERROR,async t=>{this.log("ima.startAndWaitForAdCompletion: beginning error recovery ->",t),n=!0;try{const{ok:e}=await IMA.pollForFatalError({err:t,ima:this});e&&(n=!1)}catch(e){this._started=!1,i(t)}}),e&&(this._started=!0),t.start(),this.eventHandler.trigger("ad-play-requested")})}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:r,silent:i,resize_non_linear:n}){this._adsManager&&(this._adLinear=void 0===r?this._adLinear:r,this.opts&&(t||e)&&(!1===r&&(t+=10,e+=10),this._dimensions={width:t,height:e,linear:r},r&&(this.opts.width=t,this.opts.height=e),(this._adLinear||n)&&(i||this.log("ima.onResize %s x %s",t,e),this._adsManager.resize(t,e,this.google.ima.ViewMode.NORMAL))))}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,["ad-break-completed","ad-error"],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(),r=t.getMinSuggestedDuration();return e-this._currentDisplayTs>1e3*r}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 r;try{const e=t.getError(),i=e.getInnerError(),n=i?IMA.unwrapError(i,e.message):"";r={reason:n,type:e.getType(),code:e.getErrorCode()}}catch(t){}const i=e._currentRemaining;return new Promise((t,n)=>{const s=setTimeout(()=>{e.eventHandler&&e.eventHandler.trigger("ad-playback-error",r),n(new Error("Ad not progressing"))},2500);e.eventHandler.once("ad-progress",e=>{const r=e.detail.remaining;-1!==r&&r<i&&(clearTimeout(s),t({ok:1}))})})}static pollRemaining({ima:t,adsManager:e}){let r=-1;return Tn(t._timers,250,(function(){t._currentRemaining=e.getRemainingTime(),r!=t._currentRemaining&&(r=t._currentRemaining,t.eventHandler.trigger("ad-progress",{remaining:t._currentRemaining,duration:t._currentDuration}))}))}once(t,e,r){this._adHandlers.push(function(t,e,r){const i=n=>{r(n),t.removeEventListener(e,i)};return t.addEventListener(e,i),()=>t.removeEventListener(e,i)}(t,e,r))}static race(t,e,r){e.forEach(i=>{const n=(...i)=>{e.forEach(e=>t.removeListener(e,n)),r(i)};t.on(i,n)})}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 r=Sn(e),i=r?Schedule.kindOf(r):"unknown",n=function(t){try{return t.getAdPodInfo().getAdPosition()}catch(t){return}}(e),s=function(t){try{return t.getAdPodInfo().getTotalAds()}catch(t){return}}(e),a={ad_type:i,ad:{duration:e.getDuration(),width:e.getWidth(),height:e.getHeight(),position:n,totals:s},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)`,a,e),this.eventHandler.trigger(t,a)}emitError(t,e){const r={vast_error_type:e.getError().getType(),reason:e.getError().getMessage(),vast_error:e.getError().getErrorCode()};this.log(`ima.error(${t})`,r),this.eventHandler.trigger(t,r)}debugEvent(t){try{const e=t.getAd();if(!e)return;this.log(`ima.event.${t.type} ->`,{event:t,data:t.getAdData(),position:Sn(e),ad:e})}catch(t){}}}var bn=ke((function(t,e){var r=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 r=e.plainObjects?Object.create(null):{},i=0;i<t.length;++i)void 0!==t[i]&&(r[i]=t[i]);return r},e.merge=function(t,r,n){if(!r)return t;if("object"!=typeof r){if(Array.isArray(t))t.push(r);else{if("object"!=typeof t)return[t,r];(n.plainObjects||n.allowPrototypes||!i.call(Object.prototype,r))&&(t[r]=!0)}return t}if("object"!=typeof t)return[t].concat(r);var s=t;return Array.isArray(t)&&!Array.isArray(r)&&(s=e.arrayToObject(t,n)),Object.keys(r).reduce((function(t,s){var a=r[s];return i.call(t,s)?t[s]=e.merge(t[s],a,n):t[s]=a,t}),s)},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="",n=0;n<e.length;++n){var s=e.charCodeAt(n);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?i+=e.charAt(n):s<128?i+=r[s]:s<2048?i+=r[192|s>>6]+r[128|63&s]:s<55296||s>=57344?i+=r[224|s>>12]+r[128|s>>6&63]+r[128|63&s]:(n+=1,s=65536+((1023&s)<<10|1023&e.charCodeAt(n)),i+=r[240|s>>18]+r[128|s>>12&63]+r[128|s>>6&63]+r[128|63&s])}return i},e.compact=function(t,r){if("object"!=typeof t||null===t)return t;var i=r||[],n=i.indexOf(t);if(-1!==n)return i[n];if(i.push(t),Array.isArray(t)){for(var s=[],a=0;a<t.length;++a)t[a]&&"object"==typeof t[a]?s.push(e.compact(t[a],i)):void 0!==t[a]&&s.push(t[a]);return s}for(var o=Object.keys(t),l=0;l<o.length;++l){var u=o[l];t[u]=e.compact(t[u],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))}})),An={brackets:function(t){return t+"[]"},indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Ln={delimiter:"&",strictNullHandling:!1,skipNulls:!1,encode:!0,encoder:bn.encode},wn=function t(e,r,i,n,s,a,o,l,u){var d=e;if("function"==typeof o)d=o(r,d);else if(d instanceof Date)d=d.toISOString();else if(null===d){if(n)return a?a(r):r;d=""}if("string"==typeof d||"number"==typeof d||"boolean"==typeof d||bn.isBuffer(d))return a?[a(r)+"="+a(d)]:[r+"="+String(d)];var c,h=[];if(void 0===d)return h;if(Array.isArray(o))c=o;else{var f=Object.keys(d);c=l?f.sort(l):f}for(var p=0;p<c.length;++p){var g=c[p];s&&null===d[g]||(h=Array.isArray(d)?h.concat(t(d[g],i(r,g),i,n,s,a,o,l,u)):h.concat(t(d[g],r+(u?"."+g:"["+g+"]"),i,n,s,a,o,l,u)))}return h},Rn=Object.prototype.hasOwnProperty,Dn={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1,decoder:bn.decode},kn=function(t,e,r){if(t){var i=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/g,s=/(\[[^[\]]*])/.exec(i),a=s?i.slice(0,s.index):i,o=[];if(a){if(!r.plainObjects&&Rn.call(Object.prototype,a)&&!r.allowPrototypes)return;o.push(a)}for(var l=0;null!==(s=n.exec(i))&&l<r.depth;){if(l+=1,!r.plainObjects&&Rn.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;o.push(s[1])}return s&&o.push("["+i.slice(s.index)+"]"),function t(e,r,i){if(!e.length)return r;var n,s=e.shift();if("[]"===s)n=(n=[]).concat(t(e,r,i));else{n=i.plainObjects?Object.create(null):{};var a="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,o=parseInt(a,10);!isNaN(o)&&s!==a&&String(o)===a&&o>=0&&i.parseArrays&&o<=i.arrayLimit?(n=[])[o]=t(e,r,i):n[a]=t(e,r,i)}return n}(o,e,r)}},On=function(t,e){var r,i,n=t,s=e||{},a=void 0===s.delimiter?Ln.delimiter:s.delimiter,o="boolean"==typeof s.strictNullHandling?s.strictNullHandling:Ln.strictNullHandling,l="boolean"==typeof s.skipNulls?s.skipNulls:Ln.skipNulls,u=("boolean"==typeof s.encode?s.encode:Ln.encode)?"function"==typeof s.encoder?s.encoder:Ln.encoder:null,d="function"==typeof s.sort?s.sort:null,c=void 0!==s.allowDots&&s.allowDots;if(null!==s.encoder&&void 0!==s.encoder&&"function"!=typeof s.encoder)throw new TypeError("Encoder has to be a function.");"function"==typeof s.filter?n=(i=s.filter)("",n):Array.isArray(s.filter)&&(r=i=s.filter);var h,f=[];if("object"!=typeof n||null===n)return"";h=s.arrayFormat in An?s.arrayFormat:"indices"in s?s.indices?"indices":"repeat":"indices";var p=An[h];r||(r=Object.keys(n)),d&&r.sort(d);for(var g=0;g<r.length;++g){var v=r[g];l&&null===n[v]||(f=f.concat(wn(n[v],v,p,o,l,u,i,d,c)))}return f.join(a)},In=function(t,e){var r=e||{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.delimiter="string"==typeof r.delimiter||bn.isRegExp(r.delimiter)?r.delimiter:Dn.delimiter,r.depth="number"==typeof r.depth?r.depth:Dn.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:Dn.arrayLimit,r.parseArrays=!1!==r.parseArrays,r.decoder="function"==typeof r.decoder?r.decoder:Dn.decoder,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:Dn.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:Dn.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:Dn.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:Dn.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:Dn.strictNullHandling,""===t||null==t)return r.plainObjects?Object.create(null):{};for(var i="string"==typeof t?function(t,e){for(var r={},i=t.split(e.delimiter,e.parameterLimit===1/0?void 0:e.parameterLimit),n=0;n<i.length;++n){var s,a,o=i[n],l=-1===o.indexOf("]=")?o.indexOf("="):o.indexOf("]=")+1;-1===l?(s=e.decoder(o),a=e.strictNullHandling?null:""):(s=e.decoder(o.slice(0,l)),a=e.decoder(o.slice(l+1))),Rn.call(r,s)?r[s]=[].concat(r[s]).concat(a):r[s]=a}return r}(t,r):t,n=r.plainObjects?Object.create(null):{},s=Object.keys(i),a=0;a<s.length;++a){var o=s[a],l=kn(o,i[o],r);n=bn.merge(n,l,r)}return bn.compact(n)};const Cn=Sr("fpads:macros"),Pn=/\[([\s\S]+?)\]/g;class Macros{constructor(t={},e=Pn){this.vars=t,this.pattern=e}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):""}static normalize(t){return t.trim()}static process_obj(t,e,r){return Object.keys(t).reduce((i,n)=>{const s=Macros.process_str(n,e,r,!0),a=t[n];return null===a?(i[s]=a,i):"object"==typeof a?(i[s]=Macros.process_obj(a,e,r),i):"string"==typeof a?(i[s]=Macros.process_str(a,e,r),i):(console.error(new Error(`${a} at ${n} not a handled Macro type`)),i)},{})}static process_str(t,e,r,i=!1){return t.replace(e.pattern,(t,e)=>{const n=Macros.normalize(e);if(!(n in r)||void 0===r[n])return t;const s=r[n],a=i?s:Macros.cast(s);return Cn("Macro.replace(raw: %s, macro: %s, value: %s)",i,e,a),a})}fork(t={},e=this.pattern){const r=Macros.merge(this.vars,t);return new Macros(r,e)}compile(t,e={}){const r=Macros.merge(this.vars,e),[i,n]=t.split("?"),s=In(n||"",{strictNullHandling:!0,decoder:t=>t}),a=On(Macros.process_obj(s,this,r),{encode:!1,strictNullHandling:!0});return Macros.process_str(i,this,r,!0)+"?"+a}}function xn(t,e={width:0,height:0}){let r,i;try{const t=document.createElement("a");t.href=r=window.location!=window.parent.location?document.referrer:document.location.href,i=t.hostname}catch(t){console.error(t)}const{width:n,height:s}=e,{video_source:a}=t||{},o=function(){const t=window;return"object"==typeof t.__flowplayerAdParameters?t.__flowplayerAdParameters:{}}();return Object.assign({random:Date.now(),page_url:r,domain:i,player_width:n,player_height:s,video_url:a,videourl:a},o)}Macros.patterns={BRACKETS:Pn,CURLY:/\{([\s\S]+?)\}/g,UNDERSCORE:/__([\s\S]+?)__/g};const Mn=/^flowplayer:\/\/(.+)/;async function Fn(t){if("string"==typeof t&&Mn.test(t)){const e=Mn.exec(t),r=e&&window[e[1]];if(r)return Fn(r)}if("function"!=typeof t)return t;try{return await t()}catch(t){return""}}const Nn=Object.prototype,Un=Object.getPrototypeOf;const Bn=Sr("fpads:ads:state");var Gn;!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"}(Gn||(Gn={}));class AdsState{constructor(t=0){this._state=t}static of(){return new AdsState}reset(){this._state=0}toggleState(t,e){return void 0===t&&Bn(new Error("AdState cannot toggleState for `undefined`")),null==typeof 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 jn={ok:Sr("fpads:analytics:request-queue"),err:Sr("fpads:analytics:request-queue:err"),warn:Sr("fpads:analytics:request-queue:warn")};class RequestQueue{constructor(t=[],e=[],r={failures:0,ttl:0}){this.pending=t,this.open=e,this.stats=r}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 jn.ok("maybe_spawn_req called Queue that is EMPTY"),t;if(RequestQueue.is_high_water(t))return jn.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){jn.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,r,i]){if(jn.ok(`Request[${i.event_type}] request`,i,t.stats),Date.now()<t.stats.ttl)return jn.warn(`Request[${i.event_type}] skipping because too many errors too quickly`,t.stats);const n=new XMLHttpRequest;t.open.push(n),n.timeout=RequestQueue.REQUEST_TIMEOUT_MS,n.ontimeout=function(){RequestQueue.handle_error(t,n),jn.warn(`Request[${i.event_type}] timed out in ${n.timeout}ms`,t.stats)},n.onerror=function(e){RequestQueue.handle_error(t,n),e&&jn.err(e),jn.warn(`Request[${i.event_type}] encountered an Error`,n.responseText,t.stats)},n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&RequestQueue.rm(t,n),Math.floor(n.status/100)},n.onload=function(){RequestQueue.rm(t,n),t.stats.failures&&t.stats.failures--,jn.ok(`Request[${i.event_type}] :ok`,n.status)},n.open(r,e),n.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{n.send(JSON.stringify(i))}catch(t){jn.err(t)}}static rpush(t,...e){return e.forEach(e=>{if(RequestQueue.is_high_water(t))return jn.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 r=t.open.lastIndexOf(e);return~r&&t.open.splice(r,1),t}}RequestQueue.MAX_OPEN_REQUESTS=3,RequestQueue.REQUEST_TIMEOUT_MS=4e3,RequestQueue.REQUEST_TTL_MS=5e3,RequestQueue.MAX_FAILURE_COUNT=3;const Hn={"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"},Kn={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"},Vn={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},qn={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"},Wn={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class Utils{static getFirstMatch(t,e){const r=e.match(t);return r&&r.length>0&&r[1]||""}static getSecondMatch(t,e){const r=e.match(t);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(t,e,r){if(t.test(e))return r}static getWindowsVersionName(t){switch(t){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(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,r=!1){const i=Utils.getVersionPrecision(t),n=Utils.getVersionPrecision(e);let s=Math.max(i,n),a=0;const o=Utils.map([t,e],t=>{const e=s-Utils.getVersionPrecision(t),r=t+new Array(e+1).join(".0");return Utils.map(r.split("."),t=>new Array(20-t.length).join("0")+t).reverse()});for(r&&(a=s-Math.min(i,n)),s-=1;s>=a;){if(o[0][s]>o[1][s])return 1;if(o[0][s]===o[1][s]){if(s===a)return 0;s-=1}else if(o[0][s]<o[1][s])return-1}}static map(t,e){const r=[];let i;if(Array.prototype.map)return Array.prototype.map.call(t,e);for(i=0;i<t.length;i+=1)r.push(e(t[i]));return r}static find(t,e){let r,i;if(Array.prototype.find)return Array.prototype.find.call(t,e);for(r=0,i=t.length;r<i;r+=1){const i=t[r];if(e(i,r))return i}}static assign(t,...e){const r=t;let i,n;if(Object.assign)return Object.assign(t,...e);for(i=0,n=e.length;i<n;i+=1){const t=e[i];if("object"==typeof t&&null!==t){Object.keys(t).forEach(e=>{r[e]=t[e]})}}return t}static getBrowserAlias(t){return Hn[t]}static getBrowserTypeByAlias(t){return Kn[t]||""}}const zn=/version\/(\d+(\.?_?\d+)+)/i,Yn=[{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},r=Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/opera/i],describe(t){const e={name:"Opera"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},r=Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},r=Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},r=Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},r=Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},r=Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},r=Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},r=Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},r=Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},r=Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},r=Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},r=Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},r=Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},r=Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},r=Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return r&&(e.version=r),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},r=Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},r=Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},r=Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},r=Utils.getFirstMatch(zn,t)||Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},r=Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},r=Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},r=Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},r=Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},r=Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},r=Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},r=Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},r=Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},r=Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e={name:"Android Browser"},r=Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},r=Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},r=Utils.getFirstMatch(zn,t);return r&&(e.version=r),e}},{test:[/.*/i],describe(t){const e=-1!==t.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:Utils.getFirstMatch(e,t),version:Utils.getSecondMatch(e,t)}}}];var Xn=[{test:[/Roku\/DVP/],describe(t){const e=Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:qn.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:qn.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),r=Utils.getWindowsVersionName(e);return{name:qn.Windows,version:e,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:qn.iOS},r=Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return r&&(e.version=r),e}},{test:[/macintosh/i],describe(t){const e=Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),r=Utils.getMacOSVersionName(e),i={name:qn.MacOS,version:e};return r&&(i.versionName=r),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:qn.iOS,version:e}}},{test(t){const e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe(t){const e=Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),r=Utils.getAndroidVersionName(e),i={name:qn.Android,version:e};return r&&(i.versionName=r),i}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),r={name:qn.WebOS};return e&&e.length&&(r.version=e),r}},{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:qn.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:qn.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:qn.Tizen,version:e}}},{test:[/linux/i],describe:()=>({name:qn.Linux})},{test:[/CrOS/],describe:()=>({name:qn.ChromeOS})},{test:[/PlayStation 4/],describe(t){const e=Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:qn.PlayStation4,version:e}}}],Qn=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(t){const e=Utils.getFirstMatch(/(can-l01)/i,t)&&"Nova",r={type:Vn.mobile,vendor:"Huawei"};return e&&(r.model=e),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Vn.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Vn.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Vn.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Vn.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Vn.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Vn.tablet})},{test(t){const e=t.test(/ipod|iphone/i),r=t.test(/like (ipod|iphone)/i);return e&&!r},describe(t){const e=Utils.getFirstMatch(/(ipod|iphone)/i,t);return{type:Vn.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Vn.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Vn.mobile})},{test:t=>"blackberry"===t.getBrowserName(!0),describe:()=>({type:Vn.mobile,vendor:"BlackBerry"})},{test:t=>"bada"===t.getBrowserName(!0),describe:()=>({type:Vn.mobile})},{test:t=>"windows phone"===t.getBrowserName(),describe:()=>({type:Vn.mobile,vendor:"Microsoft"})},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return"android"===t.getOSName(!0)&&e>=3},describe:()=>({type:Vn.tablet})},{test:t=>"android"===t.getOSName(!0),describe:()=>({type:Vn.mobile})},{test:t=>"macos"===t.getOSName(!0),describe:()=>({type:Vn.desktop,vendor:"Apple"})},{test:t=>"windows"===t.getOSName(!0),describe:()=>({type:Vn.desktop})},{test:t=>"linux"===t.getOSName(!0),describe:()=>({type:Vn.desktop})},{test:t=>"playstation 4"===t.getOSName(!0),describe:()=>({type:Vn.tv})},{test:t=>"roku"===t.getOSName(!0),describe:()=>({type:Vn.tv})}],$n=[{test:t=>"microsoft edge"===t.getBrowserName(!0),describe(t){if(/\sedg\//i.test(t))return{name:Wn.Blink};const e=Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:Wn.EdgeHTML,version:e}}},{test:[/trident/i],describe(t){const e={name:Wn.Trident},r=Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:t=>t.test(/presto/i),describe(t){const e={name:Wn.Presto},r=Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test(t){const e=t.test(/gecko/i),r=t.test(/like gecko/i);return e&&!r},describe(t){const e={name:Wn.Gecko},r=Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:Wn.Blink})},{test:[/(apple)?webkit/i],describe(t){const e={name:Wn.WebKit},r=Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),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(Yn,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(Xn,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(Qn,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($n,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 r=0;const i={};let n=0;if(Object.keys(t).forEach(s=>{const a=t[s];"string"==typeof a?(i[s]=a,n+=1):"object"==typeof a&&(e[s]=a,r+=1)}),r>0){const t=Object.keys(e),r=Utils.find(t,t=>this.isOS(t));if(r){const t=this.satisfies(e[r]);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(n>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 r=this.getBrowserName().toLowerCase();let i=t.toLowerCase();const n=Utils.getBrowserTypeByAlias(i);return e&&n&&(i=n.toLowerCase()),i===r}compareVersion(t){let e=[0],r=t,i=!1;const n=this.getBrowserVersion();if("string"==typeof n)return">"===t[0]||"<"===t[0]?(r=t.substr(1),"="===t[1]?(i=!0,r=t.substr(2)):e=[],">"===t[0]?e.push(1):e.push(-1)):"="===t[0]?r=t.substr(1):"~"===t[0]&&(i=!0,r=t.substr(1)),e.indexOf(Utils.compareVersions(n,r,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))}}
|
|
358
358
|
/*!
|
|
359
359
|
* Bowser - a browser detector
|
|
360
360
|
* https://github.com/lancedikson/bowser
|
|
361
361
|
* MIT License | (c) Dustin Diaz 2012-2015
|
|
362
362
|
* MIT License | (c) Denis Demchenko 2015-2019
|
|
363
|
-
*/const $n=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 Hn}static get ENGINE_MAP(){return qn}static get OS_MAP(){return Vn}static get PLATFORMS_MAP(){return Kn}}.parse(window.navigator.userAgent),{platform:Zn,os:Jn,browser:ts}=$n,es=t=>t&&t.toLowerCase();var rs={rnd:Math.random().toString(36).substr(2,32),os:es(Jn.name+(Jn.versionName?" "+Jn.versionName:"")),device:es(Zn.type),browser:es(ts.name),browser_version:(ts&&ts.version?ts.version:"unknown").split(".").shift(),plugin_version:"3.2.6"};const is="https://fp-eu-w1-aai.flowplayer.com/in",ns="POST",ss=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],as=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],os=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],ls=_r("ads/analytics"),us=RequestQueue.of(),ds=(...t)=>Object.assign({},...t);class Analytics{constructor(t,e={}){this.emitter=t,this.metadata=ds(rs,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),ls(this),this.wireup()}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,r)=>Object.assign(e,{[r]:t[r]}),{}))(e,...t.valid_keys)}static mergeMetadata(t,e={}){return t.metadata=Analytics.pluck_valid_keys(t,ds(t.metadata,e,{player_version:"3.2.6"})),t}wireup(){this.events.forEach(t=>{this.emitter.on(t,e=>{const r=e.detail,i=ds(this.metadata,{event_type:t},r),n=Analytics.pluck_valid_keys(this,i),s=Analytics.ensure_required_keys(this,n);if(ls(`Event[${t}]`,{payload:n,observation:r}),s.length)return ls(`Analytics.validate_metadata() failed for\n Event[${t}]\n missing keys: ${s}`,n);RequestQueue.rpush(us,[is,ns,n])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}const cs=_r("ads/controller"),hs={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10};class AdsController extends 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 r=new CustomEvent(t,{detail:e||{}});this._bus.dispatchEvent(r)}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)}}{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({},hs),t),this.analytics=(e=this,Analytics.of(e,{required_keys:as,optional_keys:os,events:ss})),this._state=AdsState.of(),this._schedule=void 0,this._lastAd=void 0,this._macros=new Macros(t.parameters||{}),this.wireup()}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()}wireup(){const t=()=>{var t;const e=new CustomEvent("ad/playing");null===(t=this.videoTag)||void 0===t||t.dispatchEvent(e),this._state.toggleState(Bn.PLAYING,!0)};this.on("ad-play-requested",t),this.on("ad-started",t),this.on("ad-resumed",t);const e=()=>{var t;const e=new CustomEvent("ad/paused");null===(t=this.videoTag)||void 0===t||t.dispatchEvent(e),this._state.toggleState(Bn.PLAYING,!1)};this.on("ad-break-completed",e),this.on("ad-teardown",e),this.on("ad-playback-error",e),this.on("ad-request-error",e),this.on("ad-paused",e),this.on("ad-skipped",e),this.on("ad-completed",e),this.on("ad-break-completed",()=>{var t;const e=new CustomEvent("ad/complete");null===(t=this.videoTag)||void 0===t||t.dispatchEvent(e),this._state.toggleState(Bn.BREAK_ACTIVE,!1)}),this.on("ad-adapter-init-failed",()=>{console.error("Adapter init failed"),e(),this._state.toggleState(Bn.FATAL_ERROR,!0)}),this.on("reload-ad-requested",async t=>{if(cs("Ads.on(RELOAD_AD_REQUESTED)",t),this._schedule){if(e(),t)return this._schedule.reset(this._schedule.getAds());this._state.hasAny(Bn.AD_AVAILABLE)&&(this._schedule.decrement(),this._state.toggleState(Bn.AD_AVAILABLE,!1))}})}async initialize(t,e={},r){return cs("Ads.initialize():",t,e,r),this._state.toggleState(Bn.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(r),this}get videoTag(){return this.adapter.getVideoTag()}get adInfo(){return this.adapter.getAdInfo()}async setVideoTag(t){cs("Ads.setVideoTag():",t),await this.adapter.setVideoTag(t),this.trigger("ad-videotag-attached",t),this.adapter.isReady()&&await this.adapterInitialized(),t.on("request/ad/pause",()=>this.adapter.pause()),t.on("request/ad/play",()=>this.adapter.resume()),t.on("request/ad/muteunmute",()=>{var e;t.muted=(null!==(e=this.adapter.volume())&&void 0!==e?e:0)>0,this.adapter.volume(t.muted?0:0==t.volume?.1:t.volume)})}waitForVideoTag(){return new Promise(t=>{const e=this.adapter.getVideoTag();if(e)return t(e);this.on("ad-videotag-attached",e=>{this.once(nn,()=>t(e))})})}async adapterInitialized(t){cs("Ads.adapterInitialized()"),this._state.toggleState(Bn.INITIALIZING,!1),this._state.toggleState(Bn.BREAK_ACTIVE,!!this.hasPreroll()),await this.setCurrentTime(0,t),this.checkIfBreakComplete(),t&&!this.opts.autoplay||this.trigger("ad-teardown")}async fetchNextAd(t,e=0){var r,i;if(!this._schedule)return;if(!this.adapter.isReady())return;if(e>50)throw this._state.toggleState(Bn.FATAL_ERROR,!0),this._state.toggleState(Bn.FETCHING_AD,!1),new Error("Ads.fetchNextAd() :max_recursion_depth");const n=(null===(r=this._schedule)||void 0===r?void 0:r.getNextAd())||(null===(i=this._schedule)||void 0===i?void 0:i.getPostroll());if(!n||this.adapter.canDismissNonLinear()||-1===t)if(this._schedule.waitForLoad(t,n,this.opts.preload_ads))this._state.toggleState(Bn.FETCHING_AD,!1);else if(n===this._schedule.getPostroll()&&this._schedule.setPostrollActive(),this._schedule.isDrained()||this._schedule.increment(),n){cs("Ads.fetchNextAd",n),this._state.toggleState(Bn.FETCHING_AD,!0);try{return await this.requestAd(n),this._state.toggleState(Bn.AD_AVAILABLE,!0),void this._state.toggleState(Bn.FETCHING_AD,!1)}catch(r){if(cs("Ads.fetchNextAd(err: %o, ad: %o)",r,n),this.setLastAd(n),n!==this._schedule.getPostroll())return await this.fetchNextAd(t,++e)}}else this._state.toggleState(Bn.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,r=!1){if(!this._schedule)return;if(!this.adapter.isReady())return;if(this._state.hasAny(Bn.FETCHING_AD))return;if(this._state.hasAny(Bn.PLAYING)&&this.adapter.isLinearAd())return;const i=0===t&&0===this._schedule.getNextIndex();try{if(r&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(t),this._state.hasAny(Bn.AD_AVAILABLE)||await this.fetchNextAd(t),!this._state.hasAny(Bn.AD_AVAILABLE)||!this.shallPlayAd(t)||e)return;await this.playAd(),await this.setCurrentTime(t),this.checkIfBreakComplete()}catch(t){cs("setCurrentTime: Error(from: setCurrentTime, message: %s)",t.message)}finally{i&&this.trigger("ad-preroll-finished")}}async playAd(){var t;if(this._state.hasAny(Bn.AD_AVAILABLE)){this._state.toggleState(Bn.AD_AVAILABLE,!1),this._state.toggleState(Bn.BREAK_ACTIVE,!0);try{const e=null===(t=this._schedule)||void 0===t?void 0:t.getCurrentAd();await this.adapter.playAd(),e&&this.setLastAd(e)}catch(t){console.error("Ads.playAd: error",t)}}}checkIfBreakComplete(){if(!this._state.hasAny(Bn.BREAK_ACTIVE))return cs("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());cs("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(Bn.BREAK_ACTIVE,!1),this.adapter.isAdPod()||this.trigger("ad-break-completed")}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 r;if(!this.adapter.getVideoTag())return;if(!this._state)return;if("ad-break-completed"===t&&this._state.hasAny(Bn.BREAK_ACTIVE)&&!this.adapter.isAdPod())return cs("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if(null===(i=e)||"object"!=typeof i||Nn(i)!==Fn)return this.dispatch(t,e);var i;const n=Object.assign({},this.adapter.getOpts()||{},(null===(r=this._schedule)||void 0===r?void 0:r.getCurrentAd())||{},{ad_type:this.ad_type},e);return e.ima_event&&"preroll"===e.ad_type&&(n.ad_type=this.ad_type),this.dispatch(t,n)}dispatch(t,e){const r=this.adapter.getVideoTag();if(r){cs(":dispatch",t,e);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}};r.dispatchEvent(new CustomEvent(yr,{detail:i}))}catch(t){cs(":error",t)}qt(r,t,e),this.emit(t,e)}}get ad_type(){return this._schedule&&this._schedule.getCurrentType()}shouldRestartContent(){if(this.adapter.isAdPod())return!0;const t=this.getLastAd();return!!t&&(!t.outstream&&!1!==t.restart)}async finished(t){if(this._schedule&&(cs("Ads.finished"),!(this.adapter.isSharedVideoTag()&&this._state.hasAny(Bn.PLAYING)&&this.adapter.isLinearAd()))){cs("Ads.finished: trying to play postroll");try{if(!this._schedule.getPostroll())return cs("Ads.finished: no postroll found"),await this.adapter.contentComplete();this._state.hasAny(Bn.AD_AVAILABLE)||await this.fetchNextAd(-1),await this.playAd(),this.adapter.contentComplete()}catch(t){cs("Ads.finished: postroll failed:",t)}finally{this.trigger("ad-postroll-finished"),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(Bn.FATAL_ERROR))&&!!(null===(e=this._schedule)||void 0===e?void 0:e.shallPlayAd(t)))}setLastAd(t){return this._lastAd=t,this}getLastAd(){return this._lastAd}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,r=this.opts.timeout){if(!this._state)return;cs("Ads.requestAd(ad: %o)",{ad:t,timeout:r,idx:e});const i=await async function t(e){if("function"==typeof e)return[await Mn(e)];if("string"==typeof e)return[await Mn(e)];if(Array.isArray(e)){const t=e;return await Promise.all(t.map(Mn))}if("object"==typeof e&&e&&e.adTag)return await t(e.adTag);throw new Error(`\n unhandled ads type ${typeof e}:\n ${JSON.stringify(e)}\n can be:\n | Array<string>\n | string\n | function\n | {adTag: Array<string>|string|function}\n `)}(t);if(void 0===i[e])return Promise.reject(new Error("Ad failed, no fallbacks left"));if(!i[e])return await this.requestAd(i,e+1,r);this.trigger("ad-requested",t);const n=this._macros.compile(i[e],Pn(this.opts,this.adapter.getDimensions()));try{return void await this.adapter.initAd(n,r)}catch(t){return cs(`Ads.requestAd(:fallback, idx: ${e}, length: ${i.length}, adTag: ${i[e]})\nError `,{adTag:i,err:t}),this.requestAd(i,e+1,r)}}resetSchedule(t){this._schedule&&this._schedule.reset(t)}get adPlaying(){return this._state&&this._state.hasAny(Bn.PLAYING)}get adBreak(){return this._state&&this._state.hasAny(Bn.BREAK_ACTIVE)}}var fs=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"}),ps=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 gs(t){return Object.assign({muted:!1,timeout:250,inline:!1},t)}function vs(t,e){var r=t.muted,i=t.timeout,n=t.inline,s=e(),a=s.element,o=s.source,l=void 0,u=void 0,d=void 0;return a.muted=r,!0===r&&a.setAttribute("muted","muted"),!0===n&&a.setAttribute("playsinline","playsinline"),a.src=o,new Promise((function(t){l=a.play(),u=setTimeout((function(){d(!1,new Error("Timeout "+i+" ms has been reached"))}),i),d=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;a.remove(),a.srcObject=null,clearTimeout(u),t({result:e,error:r})},void 0!==l?l.then((function(){return d(!0)})).catch((function(t){return d(!1,t)})):d(!0)}))}var ms={audio:function(t){return vs(t=gs(t),(function(){return{element:document.createElement("audio"),source:URL.createObjectURL(fs)}}))},video:function(t){return vs(t=gs(t),(function(){return{element:document.createElement("video"),source:URL.createObjectURL(ps)}}))}};let ys=void 0;async function Es(t=!0){return ys||(ys=await ms.video({timeout:500,muted:t}),ys)}const Ts=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"}),_s=["progress","duration"];class AdUI extends HTMLElement{constructor(t,e=document.createElement("div")){super(),this.player=t,this.adContainer=e,this.render(),t.addEventListener("ad/playing",t=>this.updateState(t.type)),t.addEventListener("ad/paused",t=>this.updateState(t.type)),t.addEventListener("ad/complete",t=>this.updateState(t.type))}static get observedAttributes(){return _s}updateState(t){this.classList.toggle("ad-paused","ad/paused"==t),this.classList.toggle("ad-playing","ad/playing"==t)}hideFirstFrame(t){t.classList.toggle("ad-hide-first-frame",!0)}showFirstFrame(t){t.classList.toggle("ad-hide-first-frame",!1)}resize(t){const e=this.style;t.linear?t.width&&(e.width=t.width+"px"):t.width?this.adContainer.style.width=t.width+"px":e.removeProperty("width"),t.height?e.height=t.height+"px":e.removeProperty("height")}attributeChangedCallback(t,e,r){switch(t){case"duration":return this.onDurationChange(parseFloat(r));case"progress":return this.onProgress(parseFloat(e),parseFloat(r))}}onDurationChange(t){}onProgress(t,e){}render(){this.adContainer.classList.add("fp-ad-container"),this.append(this.adContainer);const t=ft(this.player,"flowplayer-ad-controls"),e=ft(this.player,"flowplayer-ad-countdown");this.append(t,e)}}const Ss=_r("fpads:native:outstream"),bs={OUTSTREAM:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"};var As,Ls;!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"}(As||(As={})),function(t){t[t.None=0]="None",t[t.Booting=1]="Booting",t[t.Ready=2]="Ready",t[t.Disposed=3]="Disposed"}(Ls||(Ls={}));class Outstream{constructor({ads:t,root:e,content:r,ima:i}){this.state=Ls.None,Ss("creating Outstream instance"),this.content=r,this.ads=t,this.root=e,this.ima=i,this.aspectRatio=r.videoHeight/r.videoWidth,this.dimensions=function(t){if(t.clientWidth>0||t.clientHeight)return en(t);const e={height:t.style.height};rn(t,"opacity",0),rn(t,"display","absolute"),rn(t,"display","inline-block"),rn(t,"height","auto");const r=en(t);return rn(t,"height",e.height),rn(t,"opacity",1),r}(this.root),this.adUi=new AdUI(r),this.adContainer=this.adUi.adContainer,this.initialVolumeState={},e.classList.add(bs.OUTSTREAM),e.append(this.adUi),this.hide(),this.ads.on("ad-pause-content",t=>{var e;if(this.state==Ls.Disposed)return;const r=!!(null===(e=t.detail)||void 0===e?void 0:e.linear);this.ads.resize(Object.assign(Object.assign({},this.dimensions),{linear:r}))}),r.on("resize",t=>{if(this.state==Ls.Disposed)return;const e=t.detail;e&&(this.dimensions={width:e.contentRect.width,height:e.contentRect.height},this.ads.resize(this.dimensions))}),r.on("intersectionchange",t=>{if(this.state==Ls.Disposed)return;const e=t.detail;if(e)switch(this.state){case Ls.Booting:return Ss(":boot skipping intersectionchange");case Ls.None:return this.state=Ls.Booting,this.begin_life_cycle();case Ls.Ready:if(e.ratio>=.5&&this.ads.adPlaying)return;e.ratio>=.5&&this.ads.resume(),e.ratio<.5&&this.ads.pause()}}),this.setup()}hide(){return this}restore_aspect_ratio(){return Ss(`Outstream.restore_aspect_ratio(${this.aspectRatio})`),this.content.setOpts({ratio:this.aspectRatio}),this}show(){this.root.classList.remove(Outstream.CLASS.HIDDEN),this.root.classList.add(Outstream.CLASS.SHOWING),this.adUi.classList.add("linear","on")}async begin_life_cycle(){this.state=Ls.Ready;const{error:t,result:e}=await Es(!1),{result:r}=await Es(!0);this.attach_ad_listeners(),this.initialVolumeState={can_autoplay:!(!e&&!r),muted:!e},Ss("Outstream.show() :autoplay >> sound="+e),t&&this.content&&!e&&(this.content.muted=!0,this.content.volume=0),await this.ads.setVideoTag(this.content),await dn({ads:this.ads,content:this.content,adContainer:this.adContainer,ima:this.ima,state:{listening:!1},config:this.content.opts}),gn({content:this.content,ads:this.ads}),this.state=Ls.Ready}attach_ad_listeners(){const t=this.ads;t.once("ad-pause-content",()=>{this.show(),this.ads.adPlaying&&this.ads.pause()}),this.ima.always_show_controls||t.on("vpaid-init",()=>this.adUi.classList.add("is-vpaid"));const e=()=>{ln.forEach(t=>this.ads.removeListener(t,e));const t=new CustomEvent(As.OUTSTREAM_TEARDOWN);Ss("Outstream(:teardown)",t),this.content.dispatchEvent(t)};ln.forEach(t=>this.ads.once(t,e)),this.content.once(As.OUTSTREAM_TEARDOWN,t=>{setTimeout(()=>{if(t.defaultPrevented)return this.handle_endscreen();this.dispose()},0)})}handle_endscreen(){this.reset_ui(),this.ads.reset(),fn({config:this.content.opts,ui:this.adUi,ads:this.ads,adContainer:this.adContainer,ima:this.ima,content:this.content,root:this.content.root,state:{started:!0,listening:!1},initial:{muted:!0,volume:1}})}empty_src(){this.content.setSrc({type:"video/mp4",src:URL.createObjectURL(Ts)})}setup(){this.root.classList.add(Outstream.CLASS.OUTSTREAM),this.root.classList.add(Outstream.CLASS.HIDDEN),this.empty_src()}reset_ui(){const t=this.root;t.classList.remove(Outstream.CLASS.SHOWING),t.classList.remove(Outstream.CLASS.OUTSTREAM),this.adUi.classList.remove("on")}dispose(){if(this.state==Ls.Disposed)return;const t=this.root,e=this.content;this.reset_ui(),t.classList.add(Outstream.CLASS.OUTSTREAM),t.classList.add(Outstream.CLASS.DONE);this.video=this.container=this.ads=0,this.state=Ls.Disposed,e.destroy(),t.innerHTML=""}}function ws(t){return t&&"number"==typeof t.time}function Rs(t){return t&&"number"==typeof t.percent&&"number"!=typeof t.time}Outstream.CLASS=bs;const Ds=_r("ads/index");function ks(t,e,r){if(!("google"in window))return console.warn("google.ima unavailable");let i=t.autoplay;t.autoplay&&(Ds("handling initial autoplay, original_autoplay: ",i),r.autoplay=!1,t.autoplay=0);const n=r.ads=new AdsController,s=n.analytics;let a=!1;n.resize(en(e)),an&&(r.on([d,c,"webkitendfullscreen"],t=>{var e;const i=t.type===d;null===(e=null==r?void 0:r.ads)||void 0===e||e.adapter.setIOSPlaysInline(!i)}),n.on("ad-postroll-finished",()=>{n.adapter.isSharedVideoTag()&&n.once("ad-break-completed",()=>{r.src=r.original_src,r.once(E,()=>{r.togglePlay(!1)}),r.webkitExitFullscreen()})})),r.on(A,(function(){n&&n.destroy()})),r.on(b,()=>{n&&n.stop()}),r.on(L,(function({detail:o}){const l=o.ima;if(void 0===i&&o.autoplay&&(i=o.autoplay),!l)return;if(!Array.isArray(l.ads))return Ds("handling non-array ima.ads"),void(void 0!==i?t.autoplay=i:delete t.autoplay);const u=o.duration||r.duration;if(l.ads=function(t,e){return Array.isArray(t)?t.filter(t=>ws(t)||Rs(t)).reduce((t,r)=>{if(ws(r))return t.push(r),t;if(r.lazy)return t.push(r),t;if(Rs(r)){const i=Object.assign({},r);return i.time=Math.floor(r.percentage*e),t.push(i),t}return t},[]):(console.warn("AdSchedule was not an Array"),[])}(l.ads,u),n.setSchedule(l.ads,u),o.metadata&&Analytics.mergeMetadata(s,o.metadata),o.metadata&&n.mergeMacros(o.metadata),o.metadata&&l.parameters&&(l.parameters=Object.assign(Object.assign({},l.parameters),o.metadata)),Analytics.mergeMetadata(s,{muted:o.muted||!1,autoplay:o.autoplay||!1}),!a){if(a=!0,t.lang&&!l.Locale&&(l.Locale=t.lang),Schedule.isOutstream(l.ads))return Ds("is outstream, returning"),new Outstream({root:e,content:r,ads:n,ima:l});un({config:Object.assign(Object.assign({},t),{autoplay:i}),root:e,content:r,ads:n,ima:l})}}))}class AdControls extends HTMLElement{constructor(t){super(),this.player=t,this.render(),t.on("ad-started",t=>{if(!this.indicatorControl)return;const{position:e,totals:r}=t.detail.ad;this.indicatorControl.textContent=`ADS ${e} / ${r}`})}render(){this.classList.add("fp-ad-controls"),this.indicatorControl=document.createElement("div"),this.indicatorControl.classList.add("ad-indicator","fp-color-text"),this.indicatorControl.textContent="ADS";const t=document.createElement("div");t.classList.add("ad-playback-controls");const e=ft(this.player,G);e.addEventListener("click",()=>this.player.emit("request/ad/play"));const r=ft(this.player,j);r.addEventListener("click",()=>this.player.emit("request/ad/pause")),t.append(e,r);const i=ft(this.player,q);i.addEventListener("click",()=>this.player.emit("request/ad/muteunmute"));const n=ft(this.player,M);this.append(this.indicatorControl,t,i,n)}}class AdCountdown extends HTMLElement{constructor(t){super(),this.player=t,t.on("ad-progress",t=>{const{duration:e,remaining:r}=t.detail;this.setAttribute("duration",e+""),this.setAttribute("remaining",r+"")}),this.addEventListener("animationend",()=>{const t=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",t)})}static get observedAttributes(){return["remaining"]}attributeChangedCallback(t,e){switch(t){case"remaining":return this.onRemaining(e)}}onRemaining(t){const e=parseFloat(this.getAttribute("duration")||"0");t||(t=e+"");const r=parseFloat(t),i=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",i),this.classList.remove("go");const n=((e-r)/e*100).toFixed(3);requestAnimationFrame(()=>{this.style.setProperty("--ad-percent-complete",n),this.classList.add("go")})}}var Os=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{samsung_tv:Is}=r();class Ads{constructor(t){this.umd=t,pt(t,"flowplayer-ad-ui",AdUI),pt(t,"flowplayer-ad-controls",AdControls),pt(t,"flowplayer-ad-countdown",AdCountdown)}init(t,e,r){if(ue.from_token(t.token||"").is_granted(ue.permissions.ADS)&&!Is)return ks(t,e,r)}}return Ads.events=sn,Ads.ui=Os,ee(window,Ads),oi.extensions.push(HLS,OVP,Ads),Object.assign(oi,{hls:HLS,ads:Ads,ovp:OVP}),oi}));
|
|
363
|
+
*/const Zn=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 Kn}static get ENGINE_MAP(){return Wn}static get OS_MAP(){return qn}static get PLATFORMS_MAP(){return Vn}}.parse(window.navigator.userAgent),{platform:Jn,os:ts,browser:es}=Zn,rs=t=>t&&t.toLowerCase();var is={rnd:Math.random().toString(36).substr(2,32),os:rs(ts.name+(ts.versionName?" "+ts.versionName:"")),device:rs(Jn.type),browser:rs(es.name),browser_version:(es&&es.version?es.version:"unknown").split(".").shift(),plugin_version:"3.2.8"};const ns="https://fp-eu-w1-aai.flowplayer.com/in",ss="POST",as=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],os=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],ls=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],us=Sr("ads/analytics"),ds=RequestQueue.of(),cs=(...t)=>Object.assign({},...t);class Analytics{constructor(t,e={}){this.emitter=t,this.metadata=cs(is,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),us(this),this.wireup()}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,r)=>Object.assign(e,{[r]:t[r]}),{}))(e,...t.valid_keys)}static mergeMetadata(t,e={}){return t.metadata=Analytics.pluck_valid_keys(t,cs(t.metadata,e,{player_version:"3.2.8"})),t}wireup(){this.events.forEach(t=>{this.emitter.on(t,e=>{const r=e.detail,i=cs(this.metadata,{event_type:t},r),n=Analytics.pluck_valid_keys(this,i),s=Analytics.ensure_required_keys(this,n);if(us(`Event[${t}]`,{payload:n,observation:r}),s.length)return us(`Analytics.validate_metadata() failed for\n Event[${t}]\n missing keys: ${s}`,n);RequestQueue.rpush(ds,[ns,ss,n])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}const hs=Sr("ads/controller"),fs={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10};class AdsController extends 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 r=new CustomEvent(t,{detail:e||{}});this._bus.dispatchEvent(r)}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)}}{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({},fs),t),this.analytics=(e=this,Analytics.of(e,{required_keys:os,optional_keys:ls,events:as})),this._state=AdsState.of(),this._schedule=void 0,this._lastAd=void 0,this._macros=new Macros(t.parameters||{}),this.wireup()}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()}wireup(){const t=()=>{var t;const e=new CustomEvent("ad/playing");null===(t=this.videoTag)||void 0===t||t.dispatchEvent(e),this._state.toggleState(Gn.PLAYING,!0)};this.on("ad-play-requested",t),this.on("ad-started",t),this.on("ad-resumed",t);const e=()=>{var t;const e=new CustomEvent("ad/paused");null===(t=this.videoTag)||void 0===t||t.dispatchEvent(e),this._state.toggleState(Gn.PLAYING,!1)};this.on("ad-break-completed",e),this.on("ad-teardown",e),this.on("ad-playback-error",e),this.on("ad-request-error",e),this.on("ad-paused",e),this.on("ad-skipped",e),this.on("ad-completed",e),this.on("ad-break-completed",()=>{var t;const e=new CustomEvent("ad/complete");null===(t=this.videoTag)||void 0===t||t.dispatchEvent(e),this._state.toggleState(Gn.BREAK_ACTIVE,!1)}),this.on("ad-adapter-init-failed",()=>{console.error("Adapter init failed"),e(),this._state.toggleState(Gn.FATAL_ERROR,!0)}),this.on("reload-ad-requested",async t=>{if(hs("Ads.on(RELOAD_AD_REQUESTED)",t),this._schedule){if(e(),t)return this._schedule.reset(this._schedule.getAds());this._state.hasAny(Gn.AD_AVAILABLE)&&(this._schedule.decrement(),this._state.toggleState(Gn.AD_AVAILABLE,!1))}})}async initialize(t,e={},r){return hs("Ads.initialize():",t,e,r),this._state.toggleState(Gn.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(r),this}get videoTag(){return this.adapter.getVideoTag()}get adInfo(){return this.adapter.getAdInfo()}async setVideoTag(t){hs("Ads.setVideoTag():",t),await this.adapter.setVideoTag(t),this.trigger("ad-videotag-attached",t),this.adapter.isReady()&&await this.adapterInitialized(),t.on("request/ad/pause",()=>this.adapter.pause()),t.on("request/ad/play",()=>this.adapter.resume()),t.on("request/ad/muteunmute",()=>{var e;t.muted=(null!==(e=this.adapter.volume())&&void 0!==e?e:0)>0,this.adapter.volume(t.muted?0:0==t.volume?.1:t.volume)})}waitForVideoTag(){return new Promise(t=>{const e=this.adapter.getVideoTag();if(e)return t(e);this.on("ad-videotag-attached",e=>{this.once(sn,()=>t(e))})})}async adapterInitialized(t){hs("Ads.adapterInitialized()"),this._state.toggleState(Gn.INITIALIZING,!1),this._state.toggleState(Gn.BREAK_ACTIVE,!!this.hasPreroll()),await this.setCurrentTime(0,t),this.checkIfBreakComplete(),t&&!this.opts.autoplay||this.trigger("ad-teardown")}async fetchNextAd(t,e=0){var r,i;if(!this._schedule)return;if(!this.adapter.isReady())return;if(e>50)throw this._state.toggleState(Gn.FATAL_ERROR,!0),this._state.toggleState(Gn.FETCHING_AD,!1),new Error("Ads.fetchNextAd() :max_recursion_depth");const n=(null===(r=this._schedule)||void 0===r?void 0:r.getNextAd())||(null===(i=this._schedule)||void 0===i?void 0:i.getPostroll());if(!n||this.adapter.canDismissNonLinear()||-1===t)if(this._schedule.waitForLoad(t,n,this.opts.preload_ads))this._state.toggleState(Gn.FETCHING_AD,!1);else if(n===this._schedule.getPostroll()&&this._schedule.setPostrollActive(),this._schedule.isDrained()||this._schedule.increment(),n){hs("Ads.fetchNextAd",n),this._state.toggleState(Gn.FETCHING_AD,!0);try{return await this.requestAd(n),this._state.toggleState(Gn.AD_AVAILABLE,!0),void this._state.toggleState(Gn.FETCHING_AD,!1)}catch(r){if(hs("Ads.fetchNextAd(err: %o, ad: %o)",r,n),this.setLastAd(n),n!==this._schedule.getPostroll())return await this.fetchNextAd(t,++e)}}else this._state.toggleState(Gn.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,r=!1){if(!this._schedule)return;if(!this.adapter.isReady())return;if(this._state.hasAny(Gn.FETCHING_AD))return;if(this._state.hasAny(Gn.PLAYING)&&this.adapter.isLinearAd())return;const i=0===t&&0===this._schedule.getNextIndex();try{if(r&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(t),this._state.hasAny(Gn.AD_AVAILABLE)||await this.fetchNextAd(t),!this._state.hasAny(Gn.AD_AVAILABLE)||!this.shallPlayAd(t)||e)return;await this.playAd(),await this.setCurrentTime(t),this.checkIfBreakComplete()}catch(t){hs("setCurrentTime: Error(from: setCurrentTime, message: %s)",t.message)}finally{i&&this.trigger("ad-preroll-finished")}}async playAd(){var t;if(this._state.hasAny(Gn.AD_AVAILABLE)){this._state.toggleState(Gn.AD_AVAILABLE,!1),this._state.toggleState(Gn.BREAK_ACTIVE,!0);try{const e=null===(t=this._schedule)||void 0===t?void 0:t.getCurrentAd();await this.adapter.playAd(),e&&this.setLastAd(e)}catch(t){console.error("Ads.playAd: error",t)}}}checkIfBreakComplete(){if(!this._state.hasAny(Gn.BREAK_ACTIVE))return hs("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());hs("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(Gn.BREAK_ACTIVE,!1),this.adapter.isAdPod()||this.trigger("ad-break-completed")}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 r;if(!this.adapter.getVideoTag())return;if(!this._state)return;if("ad-break-completed"===t&&this._state.hasAny(Gn.BREAK_ACTIVE)&&!this.adapter.isAdPod())return hs("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if(null===(i=e)||"object"!=typeof i||Un(i)!==Nn)return this.dispatch(t,e);var i;const n=Object.assign({},this.adapter.getOpts()||{},(null===(r=this._schedule)||void 0===r?void 0:r.getCurrentAd())||{},{ad_type:this.ad_type},e);return e.ima_event&&"preroll"===e.ad_type&&(n.ad_type=this.ad_type),this.dispatch(t,n)}dispatch(t,e){const r=this.adapter.getVideoTag();if(r){hs(":dispatch",t,e);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}};r.dispatchEvent(new CustomEvent(Er,{detail:i}))}catch(t){hs(":error",t)}Wt(r,t,e),this.emit(t,e)}}get ad_type(){return this._schedule&&this._schedule.getCurrentType()}shouldRestartContent(){if(this.adapter.isAdPod())return!0;const t=this.getLastAd();return!!t&&(!t.outstream&&!1!==t.restart)}async finished(t){if(this._schedule&&(hs("Ads.finished"),!(this.adapter.isSharedVideoTag()&&this._state.hasAny(Gn.PLAYING)&&this.adapter.isLinearAd()))){hs("Ads.finished: trying to play postroll");try{if(!this._schedule.getPostroll())return hs("Ads.finished: no postroll found"),await this.adapter.contentComplete();this._state.hasAny(Gn.AD_AVAILABLE)||await this.fetchNextAd(-1),await this.playAd(),this.adapter.contentComplete()}catch(t){hs("Ads.finished: postroll failed:",t)}finally{this.trigger("ad-postroll-finished"),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(Gn.FATAL_ERROR))&&!!(null===(e=this._schedule)||void 0===e?void 0:e.shallPlayAd(t)))}setLastAd(t){return this._lastAd=t,this}getLastAd(){return this._lastAd}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,r=this.opts.timeout){if(!this._state)return;hs("Ads.requestAd(ad: %o)",{ad:t,timeout:r,idx:e});const i=await async function t(e){if("function"==typeof e)return[await Fn(e)];if("string"==typeof e)return[await Fn(e)];if(Array.isArray(e)){const t=e;return await Promise.all(t.map(Fn))}if("object"==typeof e&&e&&e.adTag)return await t(e.adTag);throw new Error(`\n unhandled ads type ${typeof e}:\n ${JSON.stringify(e)}\n can be:\n | Array<string>\n | string\n | function\n | {adTag: Array<string>|string|function}\n `)}(t);if(void 0===i[e])return Promise.reject(new Error("Ad failed, no fallbacks left"));if(!i[e])return await this.requestAd(i,e+1,r);this.trigger("ad-requested",t);const n=this._macros.compile(i[e],xn(this.opts,this.adapter.getDimensions()));try{return void await this.adapter.initAd(n,r)}catch(t){return hs(`Ads.requestAd(:fallback, idx: ${e}, length: ${i.length}, adTag: ${i[e]})\nError `,{adTag:i,err:t}),this.requestAd(i,e+1,r)}}resetSchedule(t){this._schedule&&this._schedule.reset(t)}get adPlaying(){return this._state&&this._state.hasAny(Gn.PLAYING)}get adBreak(){return this._state&&this._state.hasAny(Gn.BREAK_ACTIVE)}get adRequesting(){return this._state.hasAny(Gn.FETCHING_AD)}get adLinear(){return this.adBreak&&this.adapter.isLinearAd()}}var ps=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"}),gs=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 vs(t){return Object.assign({muted:!1,timeout:250,inline:!1},t)}function ms(t,e){var r=t.muted,i=t.timeout,n=t.inline,s=e(),a=s.element,o=s.source,l=void 0,u=void 0,d=void 0;return a.muted=r,!0===r&&a.setAttribute("muted","muted"),!0===n&&a.setAttribute("playsinline","playsinline"),a.src=o,new Promise((function(t){l=a.play(),u=setTimeout((function(){d(!1,new Error("Timeout "+i+" ms has been reached"))}),i),d=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;a.remove(),a.srcObject=null,clearTimeout(u),t({result:e,error:r})},void 0!==l?l.then((function(){return d(!0)})).catch((function(t){return d(!1,t)})):d(!0)}))}var ys={audio:function(t){return ms(t=vs(t),(function(){return{element:document.createElement("audio"),source:URL.createObjectURL(ps)}}))},video:function(t){return ms(t=vs(t),(function(){return{element:document.createElement("video"),source:URL.createObjectURL(gs)}}))}};let Es=void 0;async function Ts(t=!0){return Es||(Es=await ys.video({timeout:500,muted:t}),Es)}const _s=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"}),Ss=["progress","duration"],bs=Sr("ads/ui");class AdUI extends HTMLElement{constructor(t,e=document.createElement("div")){super(),this.player=t,this.adContainer=e,this.render(),t.addEventListener("ad/playing",t=>this.updateState(t.type)),t.addEventListener("ad/paused",t=>this.updateState(t.type)),t.addEventListener("ad/complete",t=>this.updateState(t.type))}static get observedAttributes(){return Ss}updateState(t){this.classList.toggle("ad-paused","ad/paused"==t),this.classList.toggle("ad-playing","ad/playing"==t)}hideFirstFrame(t){bs("hideFirstFrame"),t.classList.toggle("ad-hide-first-frame",!0)}showFirstFrame(t){bs("showFirstFrame"),t.classList.toggle("ad-hide-first-frame",!1)}resize(t){const e=this.style;t.linear?t.width&&(e.width=t.width+"px"):t.width?this.adContainer.style.width=t.width+"px":e.removeProperty("width"),t.height?e.height=t.height+"px":e.removeProperty("height")}attributeChangedCallback(t,e,r){switch(t){case"duration":return this.onDurationChange(parseFloat(r));case"progress":return this.onProgress(parseFloat(e),parseFloat(r))}}onDurationChange(t){}onProgress(t,e){}render(){this.adContainer.classList.add("fp-ad-container"),this.append(this.adContainer);const t=pt(this.player,"flowplayer-ad-controls"),e=pt(this.player,"flowplayer-ad-countdown");this.append(t,e)}}const As=Sr("fpads:native:outstream"),Ls={OUTSTREAM:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"};var ws,Rs;!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"}(ws||(ws={})),function(t){t[t.None=0]="None",t[t.Booting=1]="Booting",t[t.Ready=2]="Ready",t[t.Disposed=3]="Disposed"}(Rs||(Rs={}));class Outstream{constructor({ads:t,root:e,content:r,ima:i}){this.state=Rs.None,As("creating Outstream instance"),this.content=r,this.ads=t,this.root=e,this.ima=i,this.aspectRatio=r.videoHeight/r.videoWidth,this.dimensions=function(t){if(t.clientWidth>0||t.clientHeight)return rn(t);const e={height:t.style.height};nn(t,"opacity",0),nn(t,"display","absolute"),nn(t,"display","inline-block"),nn(t,"height","auto");const r=rn(t);return nn(t,"height",e.height),nn(t,"opacity",1),r}(this.root),this.adUi=new AdUI(r),this.adContainer=this.adUi.adContainer,this.initialVolumeState={},e.classList.add(Ls.OUTSTREAM),e.append(this.adUi),this.hide(),this.ads.on("ad-pause-content",t=>{var e;if(this.state==Rs.Disposed)return;const r=!!(null===(e=t.detail)||void 0===e?void 0:e.linear);this.ads.resize(Object.assign(Object.assign({},this.dimensions),{linear:r}))}),r.on("resize",t=>{if(this.state==Rs.Disposed)return;const e=t.detail;e&&(this.dimensions={width:e.contentRect.width,height:e.contentRect.height},this.ads.resize(this.dimensions))}),r.on("intersectionchange",t=>{if(this.state==Rs.Disposed)return;const e=t.detail;if(e)switch(this.state){case Rs.Booting:return As(":boot skipping intersectionchange");case Rs.None:return this.state=Rs.Booting,this.begin_life_cycle();case Rs.Ready:if(e.ratio>=.5&&this.ads.adPlaying)return;e.ratio>=.5&&this.ads.resume(),e.ratio<.5&&this.ads.pause()}}),this.setup()}hide(){return this}restore_aspect_ratio(){return As(`Outstream.restore_aspect_ratio(${this.aspectRatio})`),this.content.setOpts({ratio:this.aspectRatio}),this}show(){this.root.classList.remove(Outstream.CLASS.HIDDEN),this.root.classList.add(Outstream.CLASS.SHOWING),this.adUi.classList.add("linear","on")}async begin_life_cycle(){this.state=Rs.Ready;const{error:t,result:e}=await Ts(!1),{result:r}=await Ts(!0);this.attach_ad_listeners(),this.initialVolumeState={can_autoplay:!(!e&&!r),muted:!e},As("Outstream.show() :autoplay >> sound="+e),t&&this.content&&!e&&(this.content.muted=!0,this.content.volume=0),await this.ads.setVideoTag(this.content),await cn({ads:this.ads,content:this.content,adContainer:this.adContainer,ima:this.ima,state:{listening:!1},config:this.content.opts}),vn({content:this.content,ads:this.ads}),this.state=Rs.Ready}attach_ad_listeners(){const t=this.ads;t.once("ad-pause-content",()=>{this.show(),this.ads.adPlaying&&this.ads.pause()}),this.ima.always_show_controls||t.on("vpaid-init",()=>this.adUi.classList.add("is-vpaid"));const e=()=>{un.forEach(t=>this.ads.removeListener(t,e));const t=new CustomEvent(ws.OUTSTREAM_TEARDOWN);As("Outstream(:teardown)",t),this.content.dispatchEvent(t)};un.forEach(t=>this.ads.once(t,e)),this.content.once(ws.OUTSTREAM_TEARDOWN,t=>{setTimeout(()=>{if(t.defaultPrevented)return this.handle_endscreen();this.dispose()},0)})}handle_endscreen(){this.reset_ui(),this.ads.reset(),pn({config:this.content.opts,ui:this.adUi,ads:this.ads,adContainer:this.adContainer,ima:this.ima,content:this.content,root:this.content.root,state:{started:!0,listening:!1},initial:{muted:!0,volume:1}})}empty_src(){this.content.setSrc({type:"video/mp4",src:URL.createObjectURL(_s)})}setup(){this.root.classList.add(Outstream.CLASS.OUTSTREAM),this.root.classList.add(Outstream.CLASS.HIDDEN),this.empty_src()}reset_ui(){const t=this.root;t.classList.remove(Outstream.CLASS.SHOWING),t.classList.remove(Outstream.CLASS.OUTSTREAM),this.adUi.classList.remove("on")}dispose(){if(this.state==Rs.Disposed)return;const t=this.root,e=this.content;this.reset_ui(),t.classList.add(Outstream.CLASS.OUTSTREAM),t.classList.add(Outstream.CLASS.DONE);this.video=this.container=this.ads=0,this.state=Rs.Disposed,e.destroy(),t.innerHTML=""}}function Ds(t){return t&&"number"==typeof t.time}function ks(t){return t&&"number"==typeof t.percent&&"number"!=typeof t.time}Outstream.CLASS=Ls;const Os=Sr("ads/index");function Is(t,e,r){if(!("google"in window))return console.warn("google.ima unavailable");let i=t.autoplay;t.autoplay&&(Os("handling initial autoplay, original_autoplay: ",i),r.autoplay=!1,t.autoplay=0);const n=r.ads=new AdsController,s=n.analytics;let a=!1;n.resize(rn(e)),on&&(r.on([h,f,"webkitendfullscreen"],t=>{var e;const i=t.type===h;null===(e=null==r?void 0:r.ads)||void 0===e||e.adapter.setIOSPlaysInline(!i)}),n.on("ad-postroll-finished",()=>{n.adapter.isSharedVideoTag()&&n.once("ad-break-completed",()=>{r.src=r.original_src,r.once(_,()=>{r.togglePlay(!1)}),r.webkitExitFullscreen()})})),r.on(L,(function(){n&&n.destroy()})),r.on("src",()=>{n&&n.stop()}),r.on(w,(function({detail:o}){const l=o.ima;if(void 0===i&&o.autoplay&&(i=o.autoplay),!l)return;if(!Array.isArray(l.ads))return Os("handling non-array ima.ads"),void(void 0!==i?t.autoplay=i:delete t.autoplay);const u=o.duration||r.duration;if(l.ads=function(t,e){return Array.isArray(t)?t.filter(t=>Ds(t)||ks(t)).reduce((t,r)=>{if(Ds(r))return t.push(r),t;if(r.lazy)return t.push(r),t;if(ks(r)){const i=Object.assign({},r);return i.time=Math.floor(r.percentage*e),t.push(i),t}return t},[]):(console.warn("AdSchedule was not an Array"),[])}(l.ads,u),n.setSchedule(l.ads,u),o.metadata&&Analytics.mergeMetadata(s,o.metadata),o.metadata&&n.mergeMacros(o.metadata),o.metadata&&l.parameters&&(l.parameters=Object.assign(Object.assign({},l.parameters),o.metadata)),Analytics.mergeMetadata(s,{muted:o.muted||!1,autoplay:o.autoplay||!1}),!a){if(a=!0,t.lang&&!l.Locale&&(l.Locale=t.lang),Schedule.isOutstream(l.ads))return Os("is outstream, returning"),new Outstream({root:e,content:r,ads:n,ima:l});dn({config:Object.assign(Object.assign({},t),{autoplay:i}),root:e,content:r,ads:n,ima:l})}}))}class AdControls extends HTMLElement{constructor(t){super(),this.player=t,this.render(),t.on("ad-started",t=>{if(!this.indicatorControl)return;const{position:e,totals:r}=t.detail.ad;this.indicatorControl.textContent=`${this.player.i18n("ads.indicator")} ${e} / ${r}`})}render(){this.classList.add("fp-ad-controls"),this.indicatorControl=document.createElement("div"),this.indicatorControl.classList.add("ad-indicator","fp-color-text"),this.indicatorControl.textContent=this.player.i18n("ads.indicator");const t=document.createElement("div");t.classList.add("ad-playback-controls");const e=pt(this.player,j);e.addEventListener("click",()=>this.player.emit("request/ad/play"));const r=pt(this.player,H);r.addEventListener("click",()=>this.player.emit("request/ad/pause")),t.append(e,r);const i=pt(this.player,W);i.addEventListener("click",()=>this.player.emit("request/ad/muteunmute"));const n=pt(this.player,F);this.append(this.indicatorControl,t,i,n)}}class AdCountdown extends HTMLElement{constructor(t){super(),this.player=t,t.on("ad-progress",t=>{const{duration:e,remaining:r}=t.detail;this.setAttribute("duration",e+""),this.setAttribute("remaining",r+"")}),this.addEventListener("animationend",()=>{const t=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",t)})}static get observedAttributes(){return["remaining"]}attributeChangedCallback(t,e){switch(t){case"remaining":return this.onRemaining(e)}}onRemaining(t){const e=parseFloat(this.getAttribute("duration")||"0");t||(t=e+"");const r=parseFloat(t),i=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",i),this.classList.remove("go");const n=((e-r)/e*100).toFixed(3);requestAnimationFrame(()=>{this.style.setProperty("--ad-percent-complete",n),this.classList.add("go")})}}var Cs=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{samsung_tv:Ps}=r();class Ads{constructor(t){this.umd=t,gt(t,"flowplayer-ad-ui",AdUI),gt(t,"flowplayer-ad-controls",AdControls),gt(t,"flowplayer-ad-countdown",AdCountdown)}init(t,e,r){if(de.from_token(t.token||"").is_granted(de.permissions.ADS)&&!Ps)return Is(t,e,r)}}return Ads.events=an,Ads.ui=Cs,re(window,Ads),li.extensions.push(HLS,OVP,Ads),Object.assign(li,{hls:HLS,ads:Ads,ovp:OVP}),li}));
|