@flowplayer/player 3.20.0-rc.5 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=t()}(this,(function(){"use strict";const e=[],t=[];function n(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",n=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),r=/Android/.test(t)&&!/Firefox/.test(t),o=/^((?!chrome|android).)*safari/i.test(t),i=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),a=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),s=/edg/i.test(t),l=/opr|opera/i.test(t),c=/SamsungBrowser/.test(t),d=c&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:r,iphone:n,safari:o,edge:s,opera:l,chrome:i,firefox:a,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:c,samsung_tv:c&&d,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}}const r="retry",o="fullscreenenter",i="fullscreenexit",a="loadedmetadata",s="loadeddata",l="progress",c="loadstart",d="pause",u="playing",p="waiting",f="canplay",h="ended",m="seeked",E="seeking",y="reap",_="recover",g="content:loadstart";var v=Object.freeze({__proto__:null,MOUNT:"mount",RETRY:r,ERROR:"error",CONTEXT_MENU:"contextmenu",CLICK:"click",DBL_CLICK:"dblclick",KEYUP:"keyup",KEYDOWN:"keydown",LOAD:"load",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:"touchend",TOUCH_CANCEL:"touchcancel",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_ENTER:o,FULLSCREEN_EXIT:i,FULLSCREEN_CHANGE:"fullscreenchange",METADATA:a,DATA:s,PROGRESS:l,TIME_UPDATE:"timeupdate",LOAD_START:c,VOLUME_CHANGE:"volumechange",PAUSE:d,PLAYING:u,PLAY:"play",WAITING:p,CAN_PLAY:f,ENDED:h,SEEKED:m,SEEKING:E,DURATION_CHANGE:"durationchange",VIEW_ENTER:"viewenter",VIEW_LEAVE:"viewleave",SOURCE:"src",REAP:y,QUALITIES:"qualities",QUALITY_CHANGE:"qualitychange",VIDEO_TRACKS:"videoTracks",SET_QUALITY:"quality:set",VIDEO_TRACK_SELECT:"tracks:video:select",RECOMMENDATIONS_READY:"recommendationsready",LANDSCAPE:"landscape",PORTRAIT:"portrait",DVR:"dvr",LIVE:"live",RECOVER:_,SEEK_QUEUED:"seek:queued",SEEK_CANCEL:"seek:cancel",PLUGIN_REGISTERED:"plugin:registered",REMOTE_SESSION_STARTED:"remotesession:started",REMOTE_SESSION_ENDED:"remotesession:ended",INTERSECTIONCHANGE:"intersectionchange",WEBKIT_NEEDKEY:"webkitneedkey",RENDER_PLUGIN:"renderplugin",AUDIO_ONLY_SOURCE:"audioonlysource",NON_RECOVERABLE_ERROR:"error:fatal",CONFIG:"config",STATE:"state",BEFORE_PLAY:"beforeplay",BEFORE_PAUSE:"beforepause",CONTENT_REAL_LOAD_START:g,CUEPOINTS:"cuepoints",CUEPOINT_START:"cuepointstart",CUEPOINT_END:"cuepointend"});var S=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",VIDEO_MENU:"flowplayer-video-menu",UI:"flowplayer-ui",LOGO:"flowplayer-logo",CONTROL:"flowplayer-control",CONTROL_BUTTONS:"flowplayer-control-buttons",LIVE_STATUS:"flowplayer-live-status",ELAPSED:"flowplayer-elapsed-time",TIMELINE:"flowplayer-timeline-bar",CHAPTERS_TIMELINE:"flowplayer-chapters-timeline-bar",CONTROL_DURATION:"flowplayer-control-duration",VOLUME_CONTROL:"flowplayer-volume-control",VOLUME_BAR:"flowplayer-volume-bar",HEADER:"flowplayer-header",HEADER_LEFT_ZONE:"flowplayer-header-left-zone",HEADER_RIGHT_ZONE:"flowplayer-header-right-zone",HEADER_DURATION:"flowplayer-header-duration",MIDDLE:"flowplayer-middle",MIDDLE_ZONE:"flowplayer-middle-zone",WAIT:"flowplayer-wait",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:"flowplayer-small-play-icon",SMALL_PAUSE_ICON:"flowplayer-small-pause-icon",PLAY_ICON:"flowplayer-play-icon",PAUSE_ICON:"flowplayer-pause-icon",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:"flowplayer-rewind-icon",SHARE_ICON:"flowplayer-share-icon",SUBTITLES_MENU_ICON:"flowplayer-subs-menu-icon",MENU_BACK_ICON:"flowplayer-menu-back",VOLUME_ICON:"flowplayer-volume-icon",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:"flowplayer-live-countdown",PLAYLIST_CONTROLS:"flowplayer-playlist-controls",THUMBNAILS_CAROUSEL:"flowplayer-thumbnails-carousel",ERROR_COMPONENT:"flowplayer-error",TV_MENU:"flowplayer-tv-menu",CUE_COMPONENT:"flowplayer-cue",SSAI_UI:"flowplayer-ssai-ui",SSAI_CONTROLS:"flowplayer-ssai-controls",SSAI_TIMELINE:"flowplayer-ssai-timeline",SSAI_INDICATOR:"flowplayer-ssai-indicator"});const w="is-playing",O="is-paused",T="is-loaded",I="is-loading",A="is-starting",N="is-seeking",R="is-ended",L="is-live",b="is-waiting",D="is-live-seeked",C="no-timeline",U="will-play",P="will-pause",k="is-in-viewport";var M=Object.freeze({__proto__:null,PLAYING:w,FULLSCREEN:"is-fullscreen",PAUSED:O,MUTED:"is-muted",LOADED:T,LOADING:I,STARTING:A,SEEKING:N,GRABBING:"is-grabbing",DISABLED:"is-disabled",SMALL:"is-small",TINY:"is-tiny",RTL:"is-rtl",TV:"is-tv",ENDED:R,LIVE:L,ERRORED:"is-error",WAITING:b,AUTOPLAY:"is-autoplay",SEAMLESS:"is-seamless",TOGGLING:"is-toggling",LIVE_SEEKED:D,NO_DVR:C,HAS_POSTER:"has-poster",WILL_PLAY:U,WILL_PAUSE:P,MENU_OPENED:"has-menu-opened",TOUCHED:"is-touched",HOVERED:"is-hovered",TOUCH_DEVICE:"is-touch-device",WILL_SEEK:"will-seek",SEEKABLE:"is-seekable",IN_VIEWPORT:k,NO_CONTROLS:"no-controls",DESTROYED:"is-destroyed",IS_SOURCE_PROCESSING:"is-source-processing"});function W(e){this.message=e}W.prototype=new Error,W.prototype.name="InvalidCharacterError";var x="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new W("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,o=0,i=0,a="";r=t.charAt(i++);~r&&(n=o%4?64*n+r:r,o++%4)?a+=String.fromCharCode(255&n>>(-2*o&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};var F=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(x(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return x(t)}};function H(e){this.message=e}H.prototype=new Error,H.prototype.name="InvalidTokenError";var G=function(e,t){if("string"!=typeof e)throw new H("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(F(e.split(".")[n]))}catch(e){throw new H("Invalid token specified: "+e.message)}};G.InvalidTokenError=H;const j=new Map,V=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const o=window.customElements.get(n);return"function"!=typeof o?r:o})(e._customElements,t))(e);var B,K;!function(e){e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=4]="HIGH"}(B||(B={})),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(K||(K={}));const Y=e=>{return e.autoplay&&K.AUDIO_REQUIRED&(!0===(t=e.autoplay)?K.ON:!1===t?K.OFF:t);var t};function z(e,t,n){const r="boolean"==typeof n;if("boolean"!=typeof n&&(n=!!e.hasState(P)||e.paused),function(e,t,n){const r=e.poll(t?"beforeplay":"beforepause",{forced:n});return r&&r.defaultPrevented}(e,n,r))return Promise.resolve();if(!n)return e.hasState(U)?(e.setState(P,!0),e.setState(U,!1),Promise.resolve()):Promise.resolve(e.pause());if(0==e.reaper)return Promise.resolve();const o=e.reaper.get("__pending_play");return e.paused||o?o?(o.src!==J(e.original_src)&&q(e),o):(function(e){return(0==e.networkState||0==e.readyState)&&e.currentSrc==J(e.original_src)}(e)&&q(e),function(e){const t=e.hasState("is-autoplay"),n=t&&Y(e.opts);n&&(e.muted&&e.toggleMute(!1),0==e.volume&&(e.volume=1));t&&e.setState("is-autoplay",!1);return e.play().then(()=>{e.hasState(P)&&e.togglePlay(!1)}).catch(r=>{if(console.warn(t?n?"[flowplayer/play] autoplay audio required\n%s":"[flowplayer/play] attempting muted autoplay\n%s":"",r.message,"\ninstance:",e),t&&!n)return e.muted=!0,e.play()})}(e)):(e.setState(P,!1),!e.hasState(w)&&e.setState(U,!0),Promise.resolve())}function q(e){e.opts.is_native&&(e.hasState(T)||(e.hasState(I)||e.emit(g),e.setState(I,!0),e.load()))}function J(e){const t=document.createElement("a");return t.href=e,t.href}function Q(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function X(e){const t=document.createElement("a");t.href=e;const n=t.pathname&&t.pathname.split(".");return n.length>1&&n[n.length-1]}function Z(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const $=e=>{var{src:t}=e,n=Q(e,["src"]);return[Object.assign({src:t,type:t?Z("video/"+X(t)):""},n)]};function ee(e){return $({src:e})}function te(e){var{src:t,type:n}=e,r=Q(e,["src","type"]);return t&&n?[Object.assign({src:t,type:n},r)]:n&&!t?[Object.assign({type:n},r)]:$(Object.assign({src:t},r))}var ne;function re(e,t,n,r={safari:!1}){const o=function(e){return"string"==typeof e?ee(e):Array.isArray(e)||"object"!=typeof e?e.reduce((function(e,t){return"string"==typeof t&&(t=ee(t)),"object"!=typeof t||Array.isArray(t)||(t=te(t)),e.concat(t)}),[]):te(e)}(n);return function(e){[N,P,U,w,O,I,T,D].forEach(t=>e.setState(t,!1)),e.setState(A,!0)}(e),Array(...Array(o.length)).map((e,t)=>t).some(n=>{const i=o[n];if(ne.Ok==function(e,t,n){e.emit("src",n),"string"==typeof n.src&&(e.original_src=n.src);const r=function(e,t,n){return e.plugins.filter(e=>{return(t=e)&&"wants"in t;var t}).find(e=>e.wants(n.src||"",n,t))}(e,t,n);return e.setOpts({is_native:!r}),r?(r.onload(t,e.root,e,n),ne.Ok):ne.Err}(e,t,i)||ne.Ok==function(e,t,n,r={safari:!1}){var o;/^audio\//.test(n.type||"")&&e.emit("audioonlysource");t.start_time&&(n.src=n.src+"#t="+t.start_time);if(""==e.canPlayType(n.type||""))return ne.Err;if(n.drm&&(!n.drm["com.apple.fps.1_0"]||!r.safari))return ne.Err;"string"==typeof n.src&&(e.preload=null!==(o=t.preload)&&void 0!==o?o:"auto",e.src=n.src);return ne.Ok}(e,t,i,r))return!0;n==o.length-1&&"string"==typeof i.src&&(e.src=i.src)}),e}!function(e){e[e.Err=0]="Err",e[e.Ok=1]="Ok"}(ne||(ne={}));const oe=[y,E,"src","seek:cancel"];var ie;function ae(e,t,n){return isNaN(e.duration)||isNaN(e.currentTime)?{}:(t.offset+=n,0==t.offset?se(e,t):(t.timer&&clearTimeout(t.timer),t.timer=setTimeout((function(){0!=e.reaper&&(e.currentTime=function(e,t,n=0){return Math.max(Math.min(t,e),n)}(e.currentTime+t.offset,e.duration),t.timer=0,se(e,t))}),1e3),function(e,t){e.setState("will-seek",!0),e.setState(ie.BACKWARD,t.offset<0),e.setState(ie.FORWARD,t.offset>0)}(e,t),e.emit("seek:queued",t),t))}function se(e,t){t.timer&&clearTimeout(t.timer),t.timer=t.offset=0,function(e){e.setState(ie.FORWARD,!1),e.setState(ie.BACKWARD,!1),e.setState("will-seek",!1)}(e)}function le(){if("undefined"==typeof document)return!1;const e=document.documentElement;return e&&"rtl"==e.getAttribute("dir")}function ce(e,t,n){const r=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;r.length;){if(null==e)return n;const t=r.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}!function(e){e.FORWARD="forward",e.BACKWARD="backward"}(ie||(ie={}));const de=[1e7]+""+-1e3+-4e3+-8e3+-1e11,ue=()=>"undefined"==typeof crypto?"":de.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));let pe="";!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const fe=["touchstart","touchmove"];function he(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}function me(e,t,n){const r=he(t,n);return e.dispatchEvent(r),e}function Ee(e,t,n){const r=he(t,n);return e.dispatchEvent(r),r}function ye(e,t,n,r){Array.isArray(t)?t.forEach(t=>_e(e,t,n,r)):_e(e,t,n,r)}function _e(e,t,n,r){if(o=t,!~fe.indexOf(o))return e.addEventListener(t,n,r),e;var o;const i=Object.assign(r||{},{passive:!0});return e.addEventListener(t,n,i),e}function ge(e,t,n,r){return ye(e,t,n,Object.assign(r||{},{once:!0}))}class PlayerStorage{constructor(e,t){this.implementation=e,t&&t.keys().forEach(e=>{"string"==typeof t.implementation[e]&&this.implementation.setItem(e,t.implementation[e])})}keys(){var e;const t=[];for(var n=0;n<this.implementation.length;n++)(null===(e=this.implementation.key(n))||void 0===e?void 0:e.startsWith("flowplayer/"))&&t.push(this.implementation.key(n));return t}removeItem(e){try{this.implementation.removeItem("flowplayer/"+e)}catch(e){}}getItem(e){try{return this.implementation.getItem("flowplayer/"+e)}catch(e){return null}}setItem(e,t){try{this.implementation.setItem("flowplayer/"+e,t)}catch(e){}}clear(){try{this.keys().forEach(e=>this.implementation.removeItem(e))}catch(e){}}get length(){try{return this.keys().length}catch(e){return 0}}key(e){try{return this.implementation.key(e)}catch(e){return null}}}class InMemoryStorage{constructor(){this.pairs=[]}get length(){return this.pairs.length}clear(){this.pairs=[]}getItem(e){var t;return(null===(t=this.pairs.find(t=>t[0]===e))||void 0===t?void 0:t[1])||null}key(e){return this.pairs[e][0]||null}removeItem(e){this.pairs=this.pairs.filter(t=>t[0]!==e)}setItem(e,t){this.removeItem(e),this.pairs.push([e,t])}}const ve={preload:"auto",rtl:!1,controls:!0},Se=["loop","muted","preload"];function we(e,r,o){let i;o.live_state={dvr_window:void 0,get dvr(){return i},set dvr(t){i=t;const n=!(!e.live||t);o.hasState(C)!=n&&o.setState(C,n)}},o._storage=new PlayerStorage(["localStorage","sessionStorage"].map(e=>{try{const t=window[e];return t.getItem(""),t}catch(t){return console.debug(`Access to window.${e} denied, trying next option`),null}}).find(e=>!!e)||new InMemoryStorage),o.toJSON=function(){return{duration:o.duration,volume:o.volume,currentTime:o.currentTime,states:o.root.className}},o.setSrc=function(t){return re(o,e,t,n())},o.playerState=o.playerState||{},o.setState=function(e,t){if(o.playerState[e]===!!t)return o;const n=Object.assign({},o.playerState,{[e]:t});return o.playerState=n,me(o,"state",o.playerState),o},o.createComponents=function(...e){return Array.from({length:e.length}).map((t,n)=>V(this,e[n]))},o.hasState=function(e){return!!o.playerState[e]},o.transitionState=function(e,t,n){!o.hasState(e)&&o.hasState(t)||(n=0),n&&o.setState("is-toggling",!0),o.setState(t,!1),o.setState(e,!0),n&&setTimeout((function(){o.setState("is-toggling",!1)}),n)},o.emit=(e,t)=>(me(o,e,t),o),o.on=(e,t)=>(ye(o,e,t),o),o.once=(e,t)=>(ge(o,e,t),o),o.off=(e,t)=>{var n,r;return n=e,r=t,o.removeEventListener(n,r),o},o.poll=(e,t)=>Ee(o,e,t),o.togglePlay=function(e){return z(o,0,e)},o.toggleMute=function(e){e=null==e?!o.muted:!!e,o.muted=e,o.muted||o.volume||(o.volume=1),me(o,"volumechange")},o.toggleDisable=function(e){e=null==e?!o.disabled:!!e,o.setState("is-disabled",e),o.disabled=e},o.destroy=function(){o.pause();const e=t.indexOf(o);~e&&t.splice(e,1),setTimeout((function(){o.setSrc([]),o.reaper&&o.reaper.clear(),me(o,y),o.setState("is-destroyed",!0)}),0)},o.setAttrs=function(e){return Se.forEach(t=>{if(!(t in e))return;const n=e[t];n?o.setAttribute(t,n.toString()):o.removeAttribute(t)}),o},o.opt=function(t,n){return n=void 0===n?ce(ve,t):n,ce(e,t,n)},o.i18n=function(e,t){if(!o.reaper)return"";const n=o.reaper.get("translations");return n?function e(t,n,r,o){return(o=o||0)>=t.length?r:ce(t[o],n,e(t,n,r,o+1))}(n,e,t||""):t||""},o.setOpts=function(t){Object.assign(e,t),e.live&&!o.hasState(L)&&(o.setState(C,!0),me(o,"live")),"disabled"in t&&void 0!==t.disabled&&o.toggleDisable(t.disabled),"muted"in t&&void 0!==t.muted&&o.toggleMute(t.muted),"dvr"in e&&(o.live_state.dvr=o.opt("dvr")),o.setState("is-rtl",o.opt("rtl",function(e){if(!e)return le();const t=e.getAttribute("dir");return t?"rtl"==t:le()}(r))),o.setState(L,!!e.live),o.setState("has-poster","string"==typeof e.poster&&e.poster.length>0),o.setState("is-seekable",!!e.seekable),o.setState("no-controls",0==e.controls),r.style.backgroundImage=o.hasState("has-poster")?"url('"+e.poster+"')":"",me(o,"config",e)},o.renderPlugin=function(e){Ee(o,"renderplugin",e).defaultPrevented||o.root.appendChild(e)};const a={offset:0,timer:0};var s,l;l=a,(s=o).on(oe,(function(){se(s,l)})),o.enqueueSeek=function(e){if(0!=o.opts.seekable&&!(1==o.opts.disabled&&e>0))return ae(o,a,e)},o.deviceId=function(){return function(e){if(pe)return pe;try{const t=e.getItem("flowplayer/uuid");if(t)return t;const n=ue();return e.setItem("flowplayer/uuid",n),n}catch(e){return pe=ue()}}(o._storage)}}function Oe(e,t){const n=t.querySelector("video"),r=n||(e._video_element_callback?e._video_element_callback(e):document.createElement("video"));return r.classList.add("fp-engine"),r.playsInline=!0,n||t.append(r),r}var Te="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};const Ie=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function Ae(e,t){return!!~Ie.indexOf(e)||e.indexOf(t)===e.length-t.length}Ae.check_whitelist=function(e){return!!~Ie.indexOf(e)};const Ne="production";function Re(e,t){const n={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let r={c:"{}",exp:0};t=t||{};try{r=G(e),n.valid_jwt=!0}catch(e){}return n.raw=e,n.data=JSON.parse(r.c),n.exp=r.exp,t.require_valid_token&&Re.validate(n),n}function Le(e){try{return Re.validate(e),{success:!0,message:""}}catch(e){return{success:!1,message:e.message}}}var be;function De(e){return{grant:e,is_granted:t=>(e&t)===t}}function Ce({root:e,video:t,data:n}){t&&t.destroy(),console.error(new Error(n.details||n.reason)),e.innerHTML="",e.classList.remove("flowplayer"),e.classList.add("flowplayer-fatal"),e.style.removeProperty("background-image");const r=document.createElement("h2");r.textContent="Playback Error";const o=document.createElement("p");o.textContent="Are you the site owner?";const i=document.createElement("a");i.classList.add("troubleshoot"),i.target="_blank",i.href="https://docs.flowplayer.com/troubleshooting/player#"+n.reason,i.textContent="Troubleshoot?";const a=document.createElement("img");a.src="https://flowplayer.com/user/pages/images/logo-white.png",e.append(r,o,i,a)}Re.validate=function(e){if("string"==typeof e&&(e=Re(e)),!e||!e.raw){if(Ae.check_whitelist(window.location.hostname)||"dev"===Ne.toString())return!0;throw new Error("No token provided in configuration")}if(!e.valid_jwt)throw new Error("Invalid token provided");const t=window.location.hostname,n=Ae.bind(null,t);if("dev"!==Ne.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(n))throw new Error("Domain not allowed");if("dev"!==Ne.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},Re.id=function(e){if(e)return"string"==typeof e&&(e=Re(e)),e.data.id},function(e){e[e.ADS=2]="ADS",e[e.ANALYTICS=4]="ANALYTICS",e[e.NO_METERING=8]="NO_METERING",e[e.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",e[e.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(be||(be={})),De.of=De,De.from_token=function(e){const t=Re(e,{require_valid_token:!0});return De.of(t.data.acl)},De.permissions=be;function Ue(e){return function(e,t){const n=e.seekable;if("object"!=typeof e.opts||0==n.length)return{head:0,tail:0};const r=Pe(e),o=t||e.live_state.dvr_window;return{head:r,tail:"number"!=typeof o||r-o<0?n.start(0):r-o}}(e).tail}function Pe(e){var t;const n=e.seekable;return n.length?e.hasState("is-chromecast-playing")||!(null===(t=e.hls)||void 0===t?void 0:t.liveSyncPosition)?n.end(n.length-1):e.hls.liveSyncPosition:0}function ke(e){try{e.dvr_offset=0,e.currentTime=Pe(e)}catch(e){console.warn("failed to seek to now: %j",e)}}function Me(e,t){const n=t.clientWidth;t.classList.toggle("is-small",n<600),t.classList.toggle("is-tiny",n<400)}function We(e,t,n){let r=!0;t.classList.add("flowplayer"),Me(0,t),ye(n,c,()=>{if(!n.hasState(I)&&!n.hasState(T)&&e.is_native&&"none"!==e.preload)return"metadata"===e.preload?(n.setState(I,!0),n.emit(g)):void q(n)}),ye(n,a,()=>{e.is_native&&"metadata"===e.preload&&n.paused&&n.emit(f)}),ye(n,[c,"resize"],(function(){Me(0,t)})),ye(n,"state",(function(){Object.entries(n.playerState).forEach((function([e,n]){t.classList.toggle(e,n)}))})),ye(n,"timeupdate",(function(){n.setState(b,!n.hasState("is-casting")&&!n.hasState(A)&&n.readyState<3)})),ye(n,h,(function(t){setTimeout((function(){if(!t.defaultPrevented){if(e.rewind&&!n.loop){const e=n.src;n.setState(N,!0),ge(n,m,(function(){e===n.src&&(n.setState(N,!1),n.pause(),n.setState(A,!0))})),n.currentTime=0}ge(n,"timeupdate",(function(){n.setState(R,!1)})),n.transitionState(R,w,e.loop||e.rewind?0:300)}}),0)})),ye(n,[E,m],(function(e){n.setState(N,e.type==E)})),ye(n,"remotesession:ended",(function(e){setTimeout(()=>{e.defaultPrevented||(n.currentTime=e.detail.currentTime)},0)})),ye(n,h,(function(){n.setState(w,!1),r=!0})),ye(n,l,()=>{if(!n.opts.live||!n.opts.is_native)return;const e=n.seekable;0!=e.length&&n.emit("dvr/window",e.end(e.length-1)-e.start(0))}),ye(n,s,(function(){var e,t;n.setState(T,!0),n.setState(I,!1);const r=n;0===(null===(e=r.videoTracks)||void 0===e?void 0:e.length)&&(null===(t=r.audioTracks)||void 0===t?void 0:t.length)>0&&n.emit("audioonlysource")})),ye(n,"play",()=>{n.setState(U,!0)}),ye(n,[p,f,c],(function(t){if(!n.hasState(N)&&(t.type!=f||e.autoplay||n.setState(b,!1),t.type!=c||"none"!=n.opt("preload")||e.autoplay)){if(t.type==c&&e.autoplay)return ge(n,u,(function(){n.setState(b,!1)}));t.type!=p||n.hasState(T)||n.setState(I,!0),n.setState(R,!1),n.setState(b,t.type==p)}})),ye(n,[u,d],(function(t){setTimeout(()=>{const e=new CustomEvent("flowplayer/"+t.type,{detail:n});document.dispatchEvent(e)},0);const o=t.type==u,i=n.currentTime==n.duration,a=o&&r&&e.autoplay||n.hasState(b);if(o&&(n.started=!0,r=!1),n.setState(b,!1).setState(U,!1),!o&&n.setState(P,!1),i)return;const s=o?w:O,l=o?O:w;n.transitionState(s,l,a?0:300),!n.hasState(A)||n.root.classList.contains("ad-hide-first-frame")||n.root.classList.contains("preroll-ios")||function(e,t){if(!e.hasState(L)||![void 0,0,-1].includes(t)||!e.seekable.length||e.hasState("has-casted"))return e.setState(A,!1);e.once(m,()=>e.setState(A,!1)),0===t?function(e){e.currentTime=Ue(e)}(e):ke(e)}(n,e.start_time)}))}const xe=[0].concat(Array.from({length:100}).map((e,t)=>(t+1)/100));function Fe(e,t,n){if(!window.IntersectionObserver)return;const r={should_resume:!!e.autoplay,locked:!1};ye(n,"play",(function(){r.locked||(r.should_resume=!0)}));const o=()=>{if(!e.autoplay)return;if(n.hasState(k)&&r.should_resume)return n.togglePlay(!0);const t=n.currentSrc;e.autopause||n.hasState(k)||!r.should_resume||ge(n,"viewenter",()=>{e.autoplay&&r.should_resume&&t===n.currentSrc&&n.togglePlay(!0)})},i=()=>{if(!e.autoplay)return;if(!e.is_native)return;if("auto"===e.preload)return;if(n.hasState(k))return q(n);const t=n.currentSrc;ge(n,"viewenter",()=>{t!==n.currentSrc||n.readyState>1||!n.paused||q(n)})};ye(n,"src",(function(){r.should_resume=!!e.autoplay,n.off(c,i),n.once(c,i),n.off(f,o),n.once(f,o)})),ye(n,d,(function(){r.locked||(r.should_resume=!1)}));const a=new IntersectionObserver(e=>{e.forEach(e=>{setTimeout(()=>{const t=e.intersectionRatio,r=n.hasState(k);if(n.setState(k,t>=.2),n.emit("intersectionchange",{ratio:t}),r===n.hasState(k))return;const o=n.hasState(k)?"viewenter":"viewleave";n.emit(o)},0)})},{threshold:xe});a.observe(t),n.on(y,()=>a.disconnect()),ye(n,"viewenter",(function(){!r.should_resume||!e.autopause||He()||n.opts.autoplay&&!n.readyState||n.togglePlay(!0)})),ye(n,"viewleave",(function(){if(!e.autopause||He())return;const t=!n.paused;r.locked=!0,n.pause(),setTimeout((function(){r.should_resume=t,r.locked=!1}),0)}))}function He(){return t.find(e=>e.hasState("is-casting"))}function Ge(e,t){if(!window.ResizeObserver)return;const n=new ResizeObserver(e=>{const n=e[e.length-1];t.emit("resize",n)});n.observe(e),t.on(y,()=>n.disconnect())}function je(e){if("number"==typeof e&&!isNaN(e))return Number(e);if("string"==typeof e){const t=e.split(":");return Number(t[1])/Number(t[0])}return e}function Ve(e,t,n){const r=!!e.ratio,o=document.createElement("div");o.classList.add("fp-ratio"),t.append(o);let i=je(e.ratio||.5625);o.style.paddingTop=100*i+"%";const l=[s,a];n.on(l,(function(){if(r)return;const e=n.videoHeight&&n.videoWidth&&n.videoHeight/n.videoWidth;e&&n.setOpts({ratio:e})})),n.on("config",(function(){const t=n.videoHeight&&n.videoWidth&&n.videoHeight/n.videoWidth,r=je((null==e?void 0:e.ratio)||t||.5625);i!==r&&(i=r,o.style.paddingTop=100*r+"%")}))}class ExplorerPlan{constructor(){this.cleanUp=this.cleanUp.bind(this),this.render=this.render.bind(this),this.wireUp=this.wireUp.bind(this)}init(e,t,n){this.root=t,this.player=n,this.wireUp()}wireUp(){var e,t;this.cleanUp(),null===(e=this.player)||void 0===e||e.once(u,this.render),null===(t=this.player)||void 0===t||t.once(h,this.wireUp)}cleanUp(){var e,t,n,r;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo),null===(n=this.player)||void 0===n||n.off(u,this.render),null===(r=this.player)||void 0===r||r.off(h,this.wireUp)}render(){var e,t,n;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo);const r=(null===(n=this.root)||void 0===n?void 0:n.querySelector(".fp-ui"))||this.root;if(!r)return;const o=this._logo=document.createElement("a");o.href="https://explorer.flowplayer.com",o.target="_blank",Object.entries(Be).forEach(([e,t])=>{o.style.setProperty(e,t,"important")}),r.appendChild(o)}}const Be={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)"},Ke="flowplayer/"+u;function Ye(e){const t=t=>{t.detail!==e&&!1===e.opt("multiplay")&&e.togglePlay(!1)};e.on(y,()=>document.removeEventListener(Ke,t)),document.addEventListener(Ke,t)}function ze(e,t){const n=[];e.addEventListener("contextmenu",r=>{const o=r.timeStamp;for(n.push(o);n.length>3;)n.shift();n.length>=3&&n.every(e=>e-o<3e3)&&(console.debug("flowplayer/debug rendering info"),function(e,t){var n;!function(e){const t=e.querySelector(".debug-info");null==t||t.remove()}(e);const r=document.createElement("div");r.classList.add("debug-info");const o=qe("flowplayer.version","3.20.0-rc.5");r.append(o);const i=null===(n=null==t?void 0:t.hls)||void 0===n?void 0:n.constructor;if(i&&i.version){const e=qe("hls.version",i.version);r.append(e)}e.appendChild(r)}(e,t))})}const qe=(e,t)=>{const n=document.createElement("div");n.classList.add("row",e);const r=document.createElement("span");r.classList.add("attr"),r.textContent=e;const o=document.createElement("span");return o.textContent=t,o.classList.add("value"),n.append(r,o),n};function Je(e,t){const n=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),r=(r,...o)=>{try{const i=(null==t?void 0:t.debug)||n;i&&e.match(i)&&console.log(`flowplayer/${e} -- ${r}`,...o)}catch(e){console.warn(e)}};return r.log=r,r}const Qe=Je("core/retry");function Xe(e,t){const n={pending:void 0,count:0};var o;e.on("error",o=>{t.retry&&void 0===n.pending&&(++n.count,n.pending=function(e,t){return setTimeout(()=>{e.hasState("is-destroyed")||(t.pending=void 0,[_,r].forEach(t=>e.emit(t)),Qe("%s try",t.count))},3e3*t.count)}(e,n))}),e.on(u,()=>{n.count=0}),e.on(["src",_],()=>{n.pending&&(clearTimeout(n.pending),n.pending=void 0)}),e.on(r,(o=t=>{t.defaultPrevented||e.load()},e=>{setTimeout((function(){if(!e.defaultPrevented)return o(e)}),0)}))}const Ze="rebuffer",$e="rebuffer:ended",et="insights:ttff",tt="insights:time_to_first_frag_loaded",nt="insights:watched_interval";var rt=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:Ze,REBUFFER_ENDED:$e,DISPLAY:"display",TIME_TO_FIRST_FRAME:et,TIME_TO_FIRST_FRAGMENT_LOADED:tt,WATCHED_INTERVAL:nt});const ot=[g,"error","src"];function it(e){try{return!!new URL(e)}catch(e){return!1}}const at=navigator;function st(e){var t,n;const r=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return r?1e-6*r:(null===(n=at.connection)||void 0===n?void 0:n.downlink)||-1}function lt(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}const ct=e=>{switch(e){case!0:return K.ON;case!1:return K.OFF;default:return e}};function dt(){try{const e=window.location!==window.parent.location?document.referrer:document.location.href;return"string"==typeof e&&e.slice(0,200)}catch(e){return!1}}const ut=[],pt="https://ihi.flowplayer.com/v1/health/events";function ft(e){if(e.suspended)return;const t=ut.slice(0);ut.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),lt(function(){try{return"undefined"==typeof window?pt:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:pt}catch(e){return pt}}(),t))}async function ht(e,t,n){const r=await Et();ut.push(Object.assign(t,r)),e.logger.log(":enqueue",t.event,t),ut.length<10&&!n||ft(e)}const mt=()=>{var e,t;try{const n=window;return null===(t=null===(e=null==n?void 0:n.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},Et=async()=>({client_time:Date.now()}),yt=(e,t)=>Object.assign(e,{detail:t}),_t=(e,{event:t,media_session_id:n,session_id:r,play_range_id:o})=>({event:t,media_session_id:n,session_id:r,play_range_id:o,device_id:e.deviceId(),version:"3.20.0-rc.5",commit:"068327faac92a49c21aa9ce1e9184ec047eb1562",ima_sdk_version:mt(),preload:e.opt("preload"),autoplay:ct(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:st(e),page_url:dt(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),gt=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});function vt(e,t,n,r){const o=_t(t,e.eventInfo(n)),{before:i,after:a}=r;ht(e,((e,t,n)=>Object.assign(e,{state:{before:t,after:n}}))(o,gt(i),gt(a)))}var St;function wt(e){switch(e){case St.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case St.MEDIA_ERR_NETWORK:return"a network error occurred";case St.MEDIA_ERR_DECODE:return"unable to decode media content";case St.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case St.NO_INTERNET:return"no internet connection detected";case St.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}!function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",e[e.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MIXED_CONTENT=1001]="MIXED_CONTENT",e[e.NO_INTERNET=1002]="NO_INTERNET"}(St||(St={}));const Ot=(e,t)=>{let n=null;return(...r)=>{null!==n&&(clearTimeout(n),n=null),n=setTimeout(()=>t(...r),e)}};var Tt;!function(e){e[e.Starting=0]="Starting",e[e.ConfigFinalized=1]="ConfigFinalized",e[e.TimerStartedWithAdsAutoplay=2]="TimerStartedWithAdsAutoplay",e[e.TimerStartedWithContentAutoplay=3]="TimerStartedWithContentAutoplay",e[e.TimerStartedWithUserGesture=4]="TimerStartedWithUserGesture",e[e.MetricReported=5]="MetricReported"}(Tt||(Tt={}));const It=["click","touchend"];class TimeToFirstFrame{constructor(e=Tt.Starting,t=!1,n=!1){this.state=e,this.loadedAd=t,this.requiresUserGesture=n}reset(){this.state=Tt.Starting,this.loadedAd=!1,this.elapsed=void 0,this.adDetails=void 0}adInfo(){const{ad_tag_id:e,vast_ad_id:t}=this.adDetails||{};return{ad_tag_id:e,vast_ad_id:t}}toJSON(){var e;return Object.assign({ad_was_requested:this.loadedAd,ms_to_first_frame:Math.round((null===(e=this.elapsed)||void 0===e?void 0:e.duration)||-1)},this.adInfo())}startTimer(e){this.state==Tt.ConfigFinalized&&(this.state=e,performance.mark("ttff:start"))}hasStarted(){return[Tt.TimerStartedWithAdsAutoplay,Tt.TimerStartedWithContentAutoplay,Tt.TimerStartedWithUserGesture].includes(this.state)}stopTimer(e){if(this.hasStarted()){performance.mark("ttff:end");const t=this.elapsed=performance.measure("ttff","ttff:start","ttff:end");this.state=Tt.MetricReported,e(t)}}}function At(e){return Math.round(1e3*e)/1e3}class EWMA{constructor(e){this.tickInterval=e,this.ewma=0,this.startTime=Date.now()}decay(){const e=Date.now()-this.startTime;return Math.pow(2,-e/(4*this.tickInterval))}update(e){const t=this.decay();return this.ewma=t*this.ewma+(1-t)*e,this.ewma}toJSON(){return this.ewma}}class WatchedState{constructor(e){this.player=e,this.marchingInterval=void 0,this.lastWatchedPoint=void 0,this.watchedSum=0,this.lastReportedSum=0,this.ewmaTickWatched=new EWMA(WatchedState.AccuracyMilliseconds)}reset(){this.onNotWatching(),this.watchedSum=0,this.lastReportedSum=0,this.lastWatchedPoint=void 0}onNotWatching(){this.marchingInterval&&(this.updateWatched(),this.marchingInterval=clearInterval(this.marchingInterval))}onWatching(){this.marchingInterval||(this.lastWatchedPoint=this.createWatchedPoint(),this.marchingInterval=setInterval(()=>{this.updateWatched()},WatchedState.AccuracyMilliseconds))}createWatchedPoint(){return{currentTime:this.player.currentTime,paused:this.player.paused}}updateWatched(){const e=this.createWatchedPoint();this.lastWatchedPoint&&this.calculateTimeWatched(this.lastWatchedPoint,e),this.lastWatchedPoint=e}calculateTimeWatched(e,t){const n=t.currentTime-e.currentTime,r=this.ewmaTickWatched.update(n);if(!(n<0)&&!(1e3*n>1.3*WatchedState.AccuracyMilliseconds)&&(this.watchedSum+=n,this.watchedSum!=this.lastReportedSum&&(this.watchedSum>this.lastReportedSum+WatchedState.ReportingIntervalSeconds||this.player.ended))){const e=At(r),t={total_watched_seconds:At(this.watchedSum),tick_watched_seconds:e,batch_watched_seconds:At(this.watchedSum-this.lastReportedSum)};this.lastReportedSum=this.watchedSum,this.player.emit(nt,t)}}}WatchedState.ReportingIntervalSeconds=5,WatchedState.AccuracyMilliseconds=160;const Nt=ue();class Health{constructor(e,t){let n;this.session_id=Nt,this.suspended=!1,this.logger=Je("health",t.opts),this.media_session_id=ue(),this.play_range_id=ue(),this.analyticsLoop=setInterval(()=>ft(this),2e3),t.on(y,()=>clearInterval(this.analyticsLoop)),t.on(u,()=>{n!==this.media_session_id&&(n=this.media_session_id,this.first_playing_event_timestamp=Date.now()),this.play_range_id=ue()});let r=Date.now()-1e3;t.on("timeupdate",e=>{if(n!==this.media_session_id)return;const o=Date.now();if(o<r)return;r=Date.now()+5e3;const i=_t(t,this.eventInfo(e.type)),a=yt(i,{duration:(s=t.duration,Number.isFinite(s)?s:s===1/0?-1:void 0)});var s;this.first_playing_event_timestamp&&(Object.assign(a,{ms_since_first_playing:o-this.first_playing_event_timestamp}),this.first_playing_event_timestamp=void 0),ht(this,a)});const o=this;if(t.health={get media_session_id(){return o.media_session_id},set media_session_id(e){o.media_session_id=e},get session_id(){return o.session_id},set session_id(e){o.session_id=e},toggle(e){e?o.resume():o.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>ft(this),2e3)}init(e,t,n){if(dt().toString().startsWith("data:"))return this.suspend();!function(e){let t=null;const n=()=>{t=null};e.on(p,(function(t){e.seeking||e.networkState===e.NETWORK_LOADING&&(e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||e.emit(Ze))})),e.on(Ze,e=>{t=e}),e.on(f,r=>{if(t){const o=r.timeStamp-t.timeStamp;if(n(),o<31)return;if(o>3e5)return;e.emit($e,{rebuffer_duration:o/1e3})}}),ot.forEach(t=>e.on(t,n))}(n),function(e){let t;[f,g].forEach(n=>{e.on(n,n=>{const r=Date.now();switch(n.type){case g:return t=r;case f:if(t)return e.emit(tt,{ms_since_loading_started:r-t}),t=null}})})}(n),function(e){if(void 0===window.performance)return;const t=new TimeToFirstFrame;e.on("ovp:config:finalized",e=>{t.reset(),t.state=Tt.ConfigFinalized,t.requiresUserGesture=!e.detail.autoplay}),e.on(g,()=>{e.root.classList.contains("ad-hide-first-frame")&&t.startTimer(Tt.TimerStartedWithAdsAutoplay),e.opt("autoplay")&&t.startTimer(Tt.TimerStartedWithContentAutoplay)}),It.forEach(n=>{e.on(n,()=>{e.opt("autoplay")||t.startTimer(Tt.TimerStartedWithUserGesture)})}),e.on("ad-requested",()=>{t.loadedAd=!0}),e.on("timeupdate",()=>{if(!(e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA))switch(t.state){case Tt.TimerStartedWithContentAutoplay:case Tt.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(et,t.toJSON()))}}),e.on("ad-started",n=>{switch(t.adDetails=n.detail,t.state){case Tt.TimerStartedWithAdsAutoplay:case Tt.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(et,t.toJSON()))}})}(n),function(e){const t=new WatchedState(e);e.on(g,()=>t.reset()),e.on(u,()=>t.onWatching()),e.on(d,()=>t.onNotWatching()),e.on(E,()=>t.onNotWatching()),e.on(h,()=>t.updateWatched()),e.on("visibilitychange",()=>t.updateWatched())}(n),n.on("display",e=>{ht(this,_t(n,this.eventInfo(e.type)),!0)}),n.on("health:record",({detail:e})=>{const t=_t(n,this.eventInfo(e.event));Object.assign(t,e.detail||{}),ht(this,t)}),[c,a,s,l,p,Ze].forEach(e=>{n.on(e,e=>{ht(this,_t(n,this.eventInfo(e.type)))})}),[$e,et,tt,nt].forEach(e=>{n.on(e,e=>{const t=_t(n,this.eventInfo(e.type));ht(this,Object.assign(t,e.detail))})}),[u,d,E,m,h,o,i,f,g].forEach(e=>{n.on(e,e=>{ht(this,_t(n,this.eventInfo(e.type)))})}),n.on("volumechange",Ot(800,e=>{const t=_t(n,this.eventInfo(e.type));ht(this,yt(t,{volume:parseFloat(n.volume.toFixed(2)),muted:n.muted}))})),n.on("resize",Ot(800,e=>{const r=_t(n,this.eventInfo(e.type));ht(this,yt(r,{height:t.clientHeight,width:t.clientWidth}))})),n.on("hls/failover",e=>{const t=_t(n,this.eventInfo(e.type)),r=e.detail,{reason:o,from:i}=r;ht(this,yt(t,{reason:o,from:i}))}),n.on("qualitychange",({type:e,detail:t})=>{switch(t.plugin){case"hls":return vt(this,n,e,t)}}),n.addEventListener("error",e=>{const t=_t(n,this.eventInfo(e.type)),r=e.error||n.error;if(!r)return ht(this,t,!0);const o=r.code,i={error_message:r.message||wt(o),error_code:o,error_stack:r.stack||""};return ht(this,yt(t,i),!0)}),n.on("src",e=>{var t;const r=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof r)return;if(!it(n.original_src))return;if(!it(r))return;if(r==n.original_src)return;this.media_session_id=ue();ht(this,_t(n,this.eventInfo(e.type))),ft(this)}),n.on("visibilitychange",e=>{ht(this,_t(n,this.eventInfo(e.type))),ft(this)})}}function Rt(e,t){return function(e){return e.extensions.reduce((e,t)=>e.find(e=>e.name===t.name)?(console.warn("flowplayer: duplicate plugin %s detected, plugin names should be unique",t.name),e):(e.push(t),e),[])}(e).map(n=>new n(e,t))}Health.events=rt,Health._UNLOAD_SUBSCRIBED=!1;const Lt=function(){const e="undefined"!=typeof window?window:void 0!==Te?Te:{},t=e.flowplayer?e.flowplayer:{extensions:[]};return Array.isArray(t.extensions)||(t.extensions=[]),t}();function bt(n,r){if("function"==typeof n)return e.push(...[...arguments].filter(e=>"function"==typeof e)),bt;"string"==typeof r&&(r={src:r}),r||(r={}),r.token||"string"!=typeof window.__FLOWPLAYER_TOKEN||(r.token=window.__FLOWPLAYER_TOKEN);const o="string"==typeof n?document.querySelector(n):n;if(!o)return console.error(new Error("Flowplayer: '"+n.toString()+"' not found"));const i=o.querySelector("video.fp-engine");if(i)return i;const s=Le(r.token);if(!s.success)return Ce({root:o,data:{reason:"token",details:s.message}});const l=new Map,c=Oe(r,o);c.reaper=l,c._customElements=j,Object.defineProperty(c,"token",{value:"string"==typeof r.token?Re.id(r.token):"",writable:!1}),c.addEventListener(y,()=>{l.clear(),c.reaper=0,delete c.root}),c.root=o,r.token&&De.from_token(r.token).is_granted(De.permissions.DEVELOPER_PLAN)&&e.push(ExplorerPlan),!~t.indexOf(c)&&t.push(c),we(r,o,c),c.setAttrs(r),c.plugins=Rt(bt,c),We(r,o,c),Fe(r,o,c),Ge(o,c),Ve(r,o,c),Ye(c),ze(o,c),Xe(c,r),c.plugins.forEach(e=>{try{e.init(r,o,c)}catch(t){console.log("Error(plugin/%s)",e.constructor.name,t)}}),c.setOpts(r),c.opts=r,r.src&&c.setSrc(r.src);const d=c.readyState;return d>0&&c.currentSrc&&c.emit(a),d>2&&c.currentSrc&&c.emit(f),c.emit("mount"),c.on("error:fatal",(function(e){Ce({root:o,video:c,data:e.data||{}})})),setTimeout(me,0,document,"flowplayer:player:created",c),c}return Object.assign(bt,Lt),function(r){Array.isArray(r.extensions)&&r.extensions.forEach(t=>e.push(t)),r.customElements=j,r.defaultElements=S,r.version="3.20.0-rc.5",r.commit="068327faac92a49c21aa9ce1e9184ec047eb1562",r.instances=t,r.extensions=e,r.support=n,r.events=v,r.states=M,r.jwt=G,r.autoplay=K,r.quality=B}(bt),"object"==typeof document&&setTimeout(me,0,document,"flowplayer:umd",bt),bt.extensions.unshift.apply(bt.extensions,[Health]),bt}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=t()}(this,(function(){"use strict";const e=[],t=[];function n(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",n=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),o=/Android/.test(t)&&!/Firefox/.test(t),r=/^((?!chrome|android).)*safari/i.test(t),i=/chrome|crios/i.test(t)&&!/opr|opera|chromium|edg|ucbrowser|googlebot/i.test(t),a=/firefox|fxios/i.test(t)&&!/seamonkey/i.test(t),s=/edg/i.test(t),l=/opr|opera/i.test(t),c=/SamsungBrowser/.test(t),d=c&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:o,iphone:n,safari:r,edge:s,opera:l,chrome:i,firefox:a,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:c,samsung_tv:c&&d,touch:"ontouchstart"in window,tizen:"tizen"in window,webOS:"webos"in window}}const o="retry",r="fullscreenenter",i="fullscreenexit",a="loadedmetadata",s="loadeddata",l="progress",c="loadstart",d="pause",u="playing",p="waiting",f="canplay",h="ended",m="seeked",E="seeking",y="reap",_="recover",g="content:loadstart";var v=Object.freeze({__proto__:null,MOUNT:"mount",RETRY:o,ERROR:"error",CONTEXT_MENU:"contextmenu",CLICK:"click",DBL_CLICK:"dblclick",KEYUP:"keyup",KEYDOWN:"keydown",LOAD:"load",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:"touchend",TOUCH_CANCEL:"touchcancel",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_ENTER:r,FULLSCREEN_EXIT:i,FULLSCREEN_CHANGE:"fullscreenchange",METADATA:a,DATA:s,PROGRESS:l,TIME_UPDATE:"timeupdate",LOAD_START:c,VOLUME_CHANGE:"volumechange",PAUSE:d,PLAYING:u,PLAY:"play",WAITING:p,CAN_PLAY:f,ENDED:h,SEEKED:m,SEEKING:E,DURATION_CHANGE:"durationchange",VIEW_ENTER:"viewenter",VIEW_LEAVE:"viewleave",SOURCE:"src",REAP:y,QUALITIES:"qualities",QUALITY_CHANGE:"qualitychange",VIDEO_TRACKS:"videoTracks",SET_QUALITY:"quality:set",VIDEO_TRACK_SELECT:"tracks:video:select",RECOMMENDATIONS_READY:"recommendationsready",LANDSCAPE:"landscape",PORTRAIT:"portrait",DVR:"dvr",LIVE:"live",RECOVER:_,SEEK_QUEUED:"seek:queued",SEEK_CANCEL:"seek:cancel",PLUGIN_REGISTERED:"plugin:registered",REMOTE_SESSION_STARTED:"remotesession:started",REMOTE_SESSION_ENDED:"remotesession:ended",INTERSECTIONCHANGE:"intersectionchange",WEBKIT_NEEDKEY:"webkitneedkey",RENDER_PLUGIN:"renderplugin",AUDIO_ONLY_SOURCE:"audioonlysource",NON_RECOVERABLE_ERROR:"error:fatal",CONFIG:"config",STATE:"state",BEFORE_PLAY:"beforeplay",BEFORE_PAUSE:"beforepause",CONTENT_REAL_LOAD_START:g,CUEPOINTS:"cuepoints",CUEPOINT_START:"cuepointstart",CUEPOINT_END:"cuepointend"});var S=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",VIDEO_MENU:"flowplayer-video-menu",UI:"flowplayer-ui",LOGO:"flowplayer-logo",CONTROL:"flowplayer-control",CONTROL_BUTTONS:"flowplayer-control-buttons",LIVE_STATUS:"flowplayer-live-status",ELAPSED:"flowplayer-elapsed-time",TIMELINE:"flowplayer-timeline-bar",CHAPTERS_TIMELINE:"flowplayer-chapters-timeline-bar",CONTROL_DURATION:"flowplayer-control-duration",VOLUME_CONTROL:"flowplayer-volume-control",VOLUME_BAR:"flowplayer-volume-bar",HEADER:"flowplayer-header",HEADER_LEFT_ZONE:"flowplayer-header-left-zone",HEADER_RIGHT_ZONE:"flowplayer-header-right-zone",HEADER_DURATION:"flowplayer-header-duration",MIDDLE:"flowplayer-middle",MIDDLE_ZONE:"flowplayer-middle-zone",WAIT:"flowplayer-wait",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:"flowplayer-small-play-icon",SMALL_PAUSE_ICON:"flowplayer-small-pause-icon",PLAY_ICON:"flowplayer-play-icon",PAUSE_ICON:"flowplayer-pause-icon",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:"flowplayer-rewind-icon",SHARE_ICON:"flowplayer-share-icon",SUBTITLES_MENU_ICON:"flowplayer-subs-menu-icon",MENU_BACK_ICON:"flowplayer-menu-back",VOLUME_ICON:"flowplayer-volume-icon",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:"flowplayer-live-countdown",PLAYLIST_CONTROLS:"flowplayer-playlist-controls",THUMBNAILS_CAROUSEL:"flowplayer-thumbnails-carousel",ERROR_COMPONENT:"flowplayer-error",TV_MENU:"flowplayer-tv-menu",CUE_COMPONENT:"flowplayer-cue",SSAI_UI:"flowplayer-ssai-ui",SSAI_CONTROLS:"flowplayer-ssai-controls",SSAI_TIMELINE:"flowplayer-ssai-timeline",SSAI_INDICATOR:"flowplayer-ssai-indicator"});const w="is-playing",O="is-paused",T="is-loaded",I="is-loading",A="is-starting",N="is-seeking",R="is-ended",L="is-live",b="is-waiting",D="is-live-seeked",C="no-timeline",U="will-play",P="will-pause",k="is-in-viewport";var M=Object.freeze({__proto__:null,PLAYING:w,FULLSCREEN:"is-fullscreen",PAUSED:O,MUTED:"is-muted",LOADED:T,LOADING:I,STARTING:A,SEEKING:N,GRABBING:"is-grabbing",DISABLED:"is-disabled",SMALL:"is-small",TINY:"is-tiny",RTL:"is-rtl",TV:"is-tv",ENDED:R,LIVE:L,ERRORED:"is-error",WAITING:b,AUTOPLAY:"is-autoplay",SEAMLESS:"is-seamless",TOGGLING:"is-toggling",LIVE_SEEKED:D,NO_DVR:C,HAS_POSTER:"has-poster",WILL_PLAY:U,WILL_PAUSE:P,MENU_OPENED:"has-menu-opened",TOUCHED:"is-touched",HOVERED:"is-hovered",TOUCH_DEVICE:"is-touch-device",WILL_SEEK:"will-seek",SEEKABLE:"is-seekable",IN_VIEWPORT:k,NO_CONTROLS:"no-controls",DESTROYED:"is-destroyed",IS_SOURCE_PROCESSING:"is-source-processing"});function W(e){this.message=e}W.prototype=new Error,W.prototype.name="InvalidCharacterError";var x="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new W("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,r=0,i=0,a="";o=t.charAt(i++);~o&&(n=r%4?64*n+o:o,r++%4)?a+=String.fromCharCode(255&n>>(-2*r&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return a};var F=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(x(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return x(t)}};function H(e){this.message=e}H.prototype=new Error,H.prototype.name="InvalidTokenError";var G=function(e,t){if("string"!=typeof e)throw new H("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(F(e.split(".")[n]))}catch(e){throw new H("Invalid token specified: "+e.message)}};G.InvalidTokenError=H;const j=new Map,V=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const o=window.customElements.get(t);if(!o)throw new Error(`no default flowplayer component with the name ${t} exists`);const r=window.customElements.get(n);return"function"!=typeof r?o:r})(e._customElements,t))(e);var B,K;!function(e){e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=4]="HIGH"}(B||(B={})),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(K||(K={}));const Y=e=>{return e.autoplay&&K.AUDIO_REQUIRED&(!0===(t=e.autoplay)?K.ON:!1===t?K.OFF:t);var t};function z(e,t,n){const o="boolean"==typeof n;if("boolean"!=typeof n&&(n=!!e.hasState(P)||e.paused),function(e,t,n){const o=e.poll(t?"beforeplay":"beforepause",{forced:n});return o&&o.defaultPrevented}(e,n,o))return Promise.resolve();if(!n)return e.hasState(U)?(e.setState(P,!0),e.setState(U,!1),Promise.resolve()):Promise.resolve(e.pause());if(0==e.reaper)return Promise.resolve();const r=e.reaper.get("__pending_play");return e.paused||r?r?(r.src!==J(e.original_src)&&q(e),r):(function(e){return(0==e.networkState||0==e.readyState)&&e.currentSrc==J(e.original_src)}(e)&&q(e),function(e){const t=e.hasState("is-autoplay"),n=t&&Y(e.opts);n&&(e.muted&&e.toggleMute(!1),0==e.volume&&(e.volume=1));t&&e.setState("is-autoplay",!1);return e.play().then(()=>{e.hasState(P)&&e.togglePlay(!1)}).catch(o=>{if(console.warn(t?n?"[flowplayer/play] autoplay audio required\n%s":"[flowplayer/play] attempting muted autoplay\n%s":"",o.message,"\ninstance:",e),t&&!n)return e.muted=!0,e.play()})}(e)):(e.setState(P,!1),!e.hasState(w)&&e.setState(U,!0),Promise.resolve())}function q(e){e.opts.is_native&&(e.hasState(T)||(e.hasState(I)||e.emit(g),e.setState(I,!0),e.load()))}function J(e){const t=document.createElement("a");return t.href=e,t.href}function Q(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function X(e){const t=document.createElement("a");t.href=e;const n=t.pathname&&t.pathname.split(".");return n.length>1&&n[n.length-1]}function Z(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const $=e=>{var{src:t}=e,n=Q(e,["src"]);return[Object.assign({src:t,type:t?Z("video/"+X(t)):""},n)]};function ee(e){return $({src:e})}function te(e){var{src:t,type:n}=e,o=Q(e,["src","type"]);return t&&n?[Object.assign({src:t,type:n},o)]:n&&!t?[Object.assign({type:n},o)]:$(Object.assign({src:t},o))}var ne;function oe(e,t,n,o={safari:!1}){const r=function(e){return"string"==typeof e?ee(e):Array.isArray(e)||"object"!=typeof e?e.reduce((function(e,t){return"string"==typeof t&&(t=ee(t)),"object"!=typeof t||Array.isArray(t)||(t=te(t)),e.concat(t)}),[]):te(e)}(n);return function(e){[N,P,U,w,O,I,T,D].forEach(t=>e.setState(t,!1)),e.setState(A,!0)}(e),Array(...Array(r.length)).map((e,t)=>t).some(n=>{const i=r[n];if(ne.Ok==function(e,t,n){e.emit("src",n),"string"==typeof n.src&&(e.original_src=n.src);const o=function(e,t,n){return e.plugins.filter(e=>{return(t=e)&&"wants"in t;var t}).find(e=>e.wants(n.src||"",n,t))}(e,t,n);return e.setOpts({is_native:!o}),o?(o.onload(t,e.root,e,n),ne.Ok):ne.Err}(e,t,i)||ne.Ok==function(e,t,n,o={safari:!1}){var r;/^audio\//.test(n.type||"")&&e.emit("audioonlysource");t.start_time&&(n.src=n.src+"#t="+t.start_time);if(""==e.canPlayType(n.type||""))return ne.Err;if(n.drm&&(!n.drm["com.apple.fps.1_0"]||!o.safari))return ne.Err;"string"==typeof n.src&&(e.preload=null!==(r=t.preload)&&void 0!==r?r:"auto",e.src=n.src);return ne.Ok}(e,t,i,o))return!0;n==r.length-1&&"string"==typeof i.src&&(e.src=i.src)}),e}!function(e){e[e.Err=0]="Err",e[e.Ok=1]="Ok"}(ne||(ne={}));const re=[y,E,"src","seek:cancel"];var ie;function ae(e,t,n){return isNaN(e.duration)||isNaN(e.currentTime)?{}:(t.offset+=n,0==t.offset?se(e,t):(t.timer&&clearTimeout(t.timer),t.timer=setTimeout((function(){0!=e.reaper&&(e.currentTime=function(e,t,n=0){return Math.max(Math.min(t,e),n)}(e.currentTime+t.offset,e.duration),t.timer=0,se(e,t))}),1e3),function(e,t){e.setState("will-seek",!0),e.setState(ie.BACKWARD,t.offset<0),e.setState(ie.FORWARD,t.offset>0)}(e,t),e.emit("seek:queued",t),t))}function se(e,t){t.timer&&clearTimeout(t.timer),t.timer=t.offset=0,function(e){e.setState(ie.FORWARD,!1),e.setState(ie.BACKWARD,!1),e.setState("will-seek",!1)}(e)}function le(){if("undefined"==typeof document)return!1;const e=document.documentElement;return e&&"rtl"==e.getAttribute("dir")}function ce(e,t,n){const o=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;o.length;){if(null==e)return n;const t=o.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}!function(e){e.FORWARD="forward",e.BACKWARD="backward"}(ie||(ie={}));const de=[1e7]+""+-1e3+-4e3+-8e3+-1e11,ue=()=>"undefined"==typeof crypto?"":de.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));let pe="";!function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const fe=["touchstart","touchmove"];function he(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}function me(e,t,n){const o=he(t,n);return e.dispatchEvent(o),e}function Ee(e,t,n){const o=he(t,n);return e.dispatchEvent(o),o}function ye(e,t,n,o){Array.isArray(t)?t.forEach(t=>_e(e,t,n,o)):_e(e,t,n,o)}function _e(e,t,n,o){if(r=t,!~fe.indexOf(r))return e.addEventListener(t,n,o),e;var r;const i=Object.assign(o||{},{passive:!0});return e.addEventListener(t,n,i),e}function ge(e,t,n,o){return ye(e,t,n,Object.assign(o||{},{once:!0}))}class PlayerStorage{constructor(e,t){this.implementation=e,t&&t.keys().forEach(e=>{"string"==typeof t.implementation[e]&&this.implementation.setItem(e,t.implementation[e])})}keys(){var e;const t=[];for(var n=0;n<this.implementation.length;n++)(null===(e=this.implementation.key(n))||void 0===e?void 0:e.startsWith("flowplayer/"))&&t.push(this.implementation.key(n));return t}removeItem(e){try{this.implementation.removeItem("flowplayer/"+e)}catch(e){}}getItem(e){try{return this.implementation.getItem("flowplayer/"+e)}catch(e){return null}}setItem(e,t){try{this.implementation.setItem("flowplayer/"+e,t)}catch(e){}}clear(){try{this.keys().forEach(e=>this.implementation.removeItem(e))}catch(e){}}get length(){try{return this.keys().length}catch(e){return 0}}key(e){try{return this.implementation.key(e)}catch(e){return null}}}class InMemoryStorage{constructor(){this.pairs=[]}get length(){return this.pairs.length}clear(){this.pairs=[]}getItem(e){var t;return(null===(t=this.pairs.find(t=>t[0]===e))||void 0===t?void 0:t[1])||null}key(e){return this.pairs[e][0]||null}removeItem(e){this.pairs=this.pairs.filter(t=>t[0]!==e)}setItem(e,t){this.removeItem(e),this.pairs.push([e,t])}}const ve={preload:"auto",rtl:!1,controls:!0},Se=["loop","muted","preload"];function we(e,o,r){let i;r.live_state={dvr_window:void 0,get dvr(){return i},set dvr(t){i=t;const n=!(!e.live||t);r.hasState(C)!=n&&r.setState(C,n)}},r._storage=new PlayerStorage(["localStorage","sessionStorage"].map(e=>{try{const t=window[e];return t.getItem(""),t}catch(t){return console.debug(`Access to window.${e} denied, trying next option`),null}}).find(e=>!!e)||new InMemoryStorage),r.toJSON=function(){return{duration:r.duration,volume:r.volume,currentTime:r.currentTime,states:r.root.className}},r.setSrc=function(t){return oe(r,e,t,n())},r.playerState=r.playerState||{},r.setState=function(e,t){if(r.playerState[e]===!!t)return r;const n=Object.assign({},r.playerState,{[e]:t});return r.playerState=n,me(r,"state",r.playerState),r},r.createComponents=function(...e){return Array.from({length:e.length}).map((t,n)=>V(this,e[n]))},r.hasState=function(e){return!!r.playerState[e]},r.transitionState=function(e,t,n){!r.hasState(e)&&r.hasState(t)||(n=0),n&&r.setState("is-toggling",!0),r.setState(t,!1),r.setState(e,!0),n&&setTimeout((function(){r.setState("is-toggling",!1)}),n)},r.emit=(e,t)=>(me(r,e,t),r),r.on=(e,t)=>(ye(r,e,t),r),r.once=(e,t)=>(ge(r,e,t),r),r.off=(e,t)=>{var n,o;return n=e,o=t,r.removeEventListener(n,o),r},r.poll=(e,t)=>Ee(r,e,t),r.togglePlay=function(e){return z(r,0,e)},r.toggleMute=function(e){e=null==e?!r.muted:!!e,r.muted=e,r.muted||r.volume||(r.volume=1),me(r,"volumechange")},r.toggleDisable=function(e){e=null==e?!r.disabled:!!e,r.setState("is-disabled",e),r.disabled=e},r.destroy=function(){r.pause();const e=t.indexOf(r);~e&&t.splice(e,1),setTimeout((function(){r.setSrc([]),r.reaper&&r.reaper.clear(),me(r,y),r.setState("is-destroyed",!0)}),0)},r.setAttrs=function(e){return Se.forEach(t=>{if(!(t in e))return;const n=e[t];n?r.setAttribute(t,n.toString()):r.removeAttribute(t)}),r},r.opt=function(t,n){return n=void 0===n?ce(ve,t):n,ce(e,t,n)},r.i18n=function(e,t){if(!r.reaper)return"";const n=r.reaper.get("translations");return n?function e(t,n,o,r){return(r=r||0)>=t.length?o:ce(t[r],n,e(t,n,o,r+1))}(n,e,t||""):t||""},r.setOpts=function(t){Object.assign(e,t),e.live&&!r.hasState(L)&&(r.setState(C,!0),me(r,"live")),"disabled"in t&&void 0!==t.disabled&&r.toggleDisable(t.disabled),"muted"in t&&void 0!==t.muted&&r.toggleMute(t.muted),"dvr"in e&&(r.live_state.dvr=r.opt("dvr")),r.setState("is-rtl",r.opt("rtl",function(e){if(!e)return le();const t=e.getAttribute("dir");return t?"rtl"==t:le()}(o))),r.setState(L,!!e.live),r.setState("has-poster","string"==typeof e.poster&&e.poster.length>0),r.setState("is-seekable",!!e.seekable),r.setState("no-controls",0==e.controls),o.style.backgroundImage=r.hasState("has-poster")?"url('"+e.poster+"')":"",me(r,"config",e)},r.renderPlugin=function(e){Ee(r,"renderplugin",e).defaultPrevented||r.root.appendChild(e)};const a={offset:0,timer:0};var s,l;l=a,(s=r).on(re,(function(){se(s,l)})),r.enqueueSeek=function(e){if(0!=r.opts.seekable&&!(1==r.opts.disabled&&e>0))return ae(r,a,e)},r.deviceId=function(){return function(e){if(pe)return pe;try{const t=e.getItem("flowplayer/uuid");if(t)return t;const n=ue();return e.setItem("flowplayer/uuid",n),n}catch(e){return pe=ue()}}(r._storage)}}function Oe(e,t){const n=t.querySelector("video"),o=n||(e._video_element_callback?e._video_element_callback(e):document.createElement("video"));return o.classList.add("fp-engine"),o.playsInline=!0,n||t.append(o),o}var Te="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};const Ie=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function Ae(e,t){return!!~Ie.indexOf(e)||e.indexOf(t)===e.length-t.length}Ae.check_whitelist=function(e){return!!~Ie.indexOf(e)};const Ne="production";function Re(e,t){const n={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let o={c:"{}",exp:0};t=t||{};try{o=G(e),n.valid_jwt=!0}catch(e){}return n.raw=e,n.data=JSON.parse(o.c),n.exp=o.exp,t.require_valid_token&&Re.validate(n),n}function Le(e){try{return Re.validate(e),{success:!0,message:""}}catch(e){return{success:!1,message:e.message}}}var be;function De(e){return{grant:e,is_granted:t=>(e&t)===t}}function Ce({root:e,video:t,data:n}){t&&t.destroy(),console.error(new Error(n.details||n.reason)),e.innerHTML="",e.classList.remove("flowplayer"),e.classList.add("flowplayer-fatal"),e.style.removeProperty("background-image");const o=document.createElement("h2");o.textContent="Playback Error";const r=document.createElement("p");r.textContent="Are you the site owner?";const i=document.createElement("a");i.classList.add("troubleshoot"),i.target="_blank",i.href="https://docs.flowplayer.com/troubleshooting/player#"+n.reason,i.textContent="Troubleshoot?";const a=document.createElement("img");a.src="https://flowplayer.com/user/pages/images/logo-white.png",e.append(o,r,i,a)}Re.validate=function(e){if("string"==typeof e&&(e=Re(e)),!e||!e.raw){if(Ae.check_whitelist(window.location.hostname)||"dev"===Ne.toString())return!0;throw new Error("No token provided in configuration")}if(!e.valid_jwt)throw new Error("Invalid token provided");const t=window.location.hostname,n=Ae.bind(null,t);if("dev"!==Ne.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(n))throw new Error("Domain not allowed");if("dev"!==Ne.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},Re.id=function(e){if(e)return"string"==typeof e&&(e=Re(e)),e.data.id},function(e){e[e.ADS=2]="ADS",e[e.ANALYTICS=4]="ANALYTICS",e[e.NO_METERING=8]="NO_METERING",e[e.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",e[e.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(be||(be={})),De.of=De,De.from_token=function(e){const t=Re(e,{require_valid_token:!0});return De.of(t.data.acl)},De.permissions=be;function Ue(e){return function(e,t){const n=e.seekable;if("object"!=typeof e.opts||0==n.length)return{head:0,tail:0};const o=Pe(e),r=t||e.live_state.dvr_window;return{head:o,tail:"number"!=typeof r||o-r<0?n.start(0):o-r}}(e).tail}function Pe(e){var t;const n=e.seekable;return n.length?e.hasState("is-chromecast-playing")||!(null===(t=e.hls)||void 0===t?void 0:t.liveSyncPosition)?n.end(n.length-1):e.hls.liveSyncPosition:0}function ke(e){try{e.dvr_offset=0,e.currentTime=Pe(e)}catch(e){console.warn("failed to seek to now: %j",e)}}function Me(e,t){const n=t.clientWidth;t.classList.toggle("is-small",n<600),t.classList.toggle("is-tiny",n<400)}function We(e,t,n){let o=!0;t.classList.add("flowplayer"),Me(0,t),ye(n,c,()=>{if(!n.hasState(I)&&!n.hasState(T)&&e.is_native&&"none"!==e.preload)return"metadata"===e.preload?(n.setState(I,!0),n.emit(g)):void q(n)}),ye(n,a,()=>{e.is_native&&"metadata"===e.preload&&n.paused&&n.emit(f)}),ye(n,[c,"resize"],(function(){Me(0,t)})),ye(n,"state",(function(){Object.entries(n.playerState).forEach((function([e,n]){t.classList.toggle(e,n)}))})),ye(n,"timeupdate",(function(){n.setState(b,!n.hasState("is-casting")&&!n.hasState(A)&&n.readyState<3)})),ye(n,h,(function(t){setTimeout((function(){if(!t.defaultPrevented){if(e.rewind&&!n.loop){const e=n.src;n.setState(N,!0),ge(n,m,(function(){e===n.src&&(n.setState(N,!1),n.pause(),n.setState(A,!0))})),n.currentTime=0}ge(n,"timeupdate",(function(){n.setState(R,!1)})),n.transitionState(R,w,e.loop||e.rewind?0:300)}}),0)})),ye(n,[E,m],(function(e){n.setState(N,e.type==E)})),ye(n,"remotesession:ended",(function(e){setTimeout(()=>{e.defaultPrevented||(n.currentTime=e.detail.currentTime)},0)})),ye(n,h,(function(){n.setState(w,!1),o=!0})),ye(n,l,()=>{if(!n.opts.live||!n.opts.is_native)return;const e=n.seekable;0!=e.length&&n.emit("dvr/window",e.end(e.length-1)-e.start(0))}),ye(n,s,(function(){var e,t;n.setState(T,!0),n.setState(I,!1);const o=n;0===(null===(e=o.videoTracks)||void 0===e?void 0:e.length)&&(null===(t=o.audioTracks)||void 0===t?void 0:t.length)>0&&n.emit("audioonlysource")})),ye(n,"play",()=>{n.setState(U,!0)}),ye(n,[p,f,c],(function(t){if(!n.hasState(N)&&(t.type!=f||e.autoplay||n.setState(b,!1),t.type!=c||"none"!=n.opt("preload")||e.autoplay)){if(t.type==c&&e.autoplay)return ge(n,u,(function(){n.setState(b,!1)}));t.type!=p||n.hasState(T)||n.setState(I,!0),n.setState(R,!1),n.setState(b,t.type==p)}})),ye(n,[u,d],(function(t){setTimeout(()=>{const e=new CustomEvent("flowplayer/"+t.type,{detail:n});document.dispatchEvent(e)},0);const r=t.type==u,i=n.currentTime==n.duration,a=r&&o&&e.autoplay||n.hasState(b);if(r&&(n.started=!0,o=!1),n.setState(b,!1).setState(U,!1),!r&&n.setState(P,!1),i)return;const s=r?w:O,l=r?O:w;n.transitionState(s,l,a?0:300),!n.hasState(A)||n.root.classList.contains("ad-hide-first-frame")||n.root.classList.contains("preroll-ios")||function(e,t){if(!e.hasState(L)||![void 0,0,-1].includes(t)||!e.seekable.length||e.hasState("has-casted"))return e.setState(A,!1);e.once(m,()=>e.setState(A,!1)),0===t?function(e){e.currentTime=Ue(e)}(e):ke(e)}(n,e.start_time)}))}const xe=[0].concat(Array.from({length:100}).map((e,t)=>(t+1)/100));function Fe(e,t,n){if(!window.IntersectionObserver)return;const o={should_resume:!!e.autoplay,locked:!1};ye(n,"play",(function(){o.locked||(o.should_resume=!0)}));const r=()=>{if(!e.autoplay)return;if(n.hasState(k)&&o.should_resume)return n.togglePlay(!0);const t=n.currentSrc;e.autopause||n.hasState(k)||!o.should_resume||ge(n,"viewenter",()=>{e.autoplay&&o.should_resume&&t===n.currentSrc&&n.togglePlay(!0)})},i=()=>{if(!e.autoplay)return;if(!e.is_native)return;if("auto"===e.preload)return;if(n.hasState(k))return q(n);const t=n.currentSrc;ge(n,"viewenter",()=>{t!==n.currentSrc||n.readyState>1||!n.paused||q(n)})};ye(n,"src",(function(){o.should_resume=!!e.autoplay,n.off(c,i),n.once(c,i),n.off(f,r),n.once(f,r)})),ye(n,d,(function(){o.locked||(o.should_resume=!1)}));const a=new IntersectionObserver(e=>{e.forEach(e=>{setTimeout(()=>{const t=e.intersectionRatio,o=n.hasState(k);if(n.setState(k,t>=.2),n.emit("intersectionchange",{ratio:t}),o===n.hasState(k))return;const r=n.hasState(k)?"viewenter":"viewleave";n.emit(r)},0)})},{threshold:xe});a.observe(t),n.on(y,()=>a.disconnect()),ye(n,"viewenter",(function(){!o.should_resume||!e.autopause||He()||n.opts.autoplay&&!n.readyState||n.togglePlay(!0)})),ye(n,"viewleave",(function(){if(!e.autopause||He())return;const t=!n.paused;o.locked=!0,n.pause(),setTimeout((function(){o.should_resume=t,o.locked=!1}),0)}))}function He(){return t.find(e=>e.hasState("is-casting"))}function Ge(e,t){if(!window.ResizeObserver)return;const n=new ResizeObserver(e=>{const n=e[e.length-1];t.emit("resize",n)});n.observe(e),t.on(y,()=>n.disconnect())}function je(e){if("number"==typeof e&&!isNaN(e))return Number(e);if("string"==typeof e){const t=e.split(":");return Number(t[1])/Number(t[0])}return e}function Ve(e,t,n){const o=!!e.ratio,r=document.createElement("div");r.classList.add("fp-ratio"),t.append(r);let i=je(e.ratio||.5625);r.style.paddingTop=100*i+"%";const l=[s,a];n.on(l,(function(){if(o)return;const e=n.videoHeight&&n.videoWidth&&n.videoHeight/n.videoWidth;e&&n.setOpts({ratio:e})})),n.on("config",(function(){const t=n.videoHeight&&n.videoWidth&&n.videoHeight/n.videoWidth,o=je((null==e?void 0:e.ratio)||t||.5625);i!==o&&(i=o,r.style.paddingTop=100*o+"%")}))}class ExplorerPlan{constructor(){this.cleanUp=this.cleanUp.bind(this),this.render=this.render.bind(this),this.wireUp=this.wireUp.bind(this)}init(e,t,n){this.root=t,this.player=n,this.wireUp()}wireUp(){var e,t;this.cleanUp(),null===(e=this.player)||void 0===e||e.once(u,this.render),null===(t=this.player)||void 0===t||t.once(h,this.wireUp)}cleanUp(){var e,t,n,o;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo),null===(n=this.player)||void 0===n||n.off(u,this.render),null===(o=this.player)||void 0===o||o.off(h,this.wireUp)}render(){var e,t,n;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo);const o=(null===(n=this.root)||void 0===n?void 0:n.querySelector(".fp-ui"))||this.root;if(!o)return;const r=this._logo=document.createElement("a");r.href="https://explorer.flowplayer.com",r.target="_blank",Object.entries(Be).forEach(([e,t])=>{r.style.setProperty(e,t,"important")}),o.appendChild(r)}}const Be={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)"},Ke="flowplayer/"+u;function Ye(e){const t=t=>{t.detail!==e&&!1===e.opt("multiplay")&&e.togglePlay(!1)};e.on(y,()=>document.removeEventListener(Ke,t)),document.addEventListener(Ke,t)}function ze(e,t){const n=[];e.addEventListener("contextmenu",o=>{const r=o.timeStamp;for(n.push(r);n.length>3;)n.shift();n.length>=3&&n.every(e=>e-r<3e3)&&(console.debug("flowplayer/debug rendering info"),function(e,t){var n;!function(e){const t=e.querySelector(".debug-info");null==t||t.remove()}(e);const o=document.createElement("div");o.classList.add("debug-info");const r=qe("flowplayer.version","3.20.0");o.append(r);const i=null===(n=null==t?void 0:t.hls)||void 0===n?void 0:n.constructor;if(i&&i.version){const e=qe("hls.version",i.version);o.append(e)}e.appendChild(o)}(e,t))})}const qe=(e,t)=>{const n=document.createElement("div");n.classList.add("row",e);const o=document.createElement("span");o.classList.add("attr"),o.textContent=e;const r=document.createElement("span");return r.textContent=t,r.classList.add("value"),n.append(o,r),n};function Je(e,t){const n=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),o=(o,...r)=>{try{const i=(null==t?void 0:t.debug)||n;i&&e.match(i)&&console.log(`flowplayer/${e} -- ${o}`,...r)}catch(e){console.warn(e)}};return o.log=o,o}const Qe=Je("core/retry");function Xe(e,t){const n={pending:void 0,count:0};var r;e.on("error",r=>{t.retry&&void 0===n.pending&&(++n.count,n.pending=function(e,t){return setTimeout(()=>{e.hasState("is-destroyed")||(t.pending=void 0,[_,o].forEach(t=>e.emit(t)),Qe("%s try",t.count))},3e3*t.count)}(e,n))}),e.on(u,()=>{n.count=0}),e.on(["src",_],()=>{n.pending&&(clearTimeout(n.pending),n.pending=void 0)}),e.on(o,(r=t=>{t.defaultPrevented||e.load()},e=>{setTimeout((function(){if(!e.defaultPrevented)return r(e)}),0)}))}const Ze="rebuffer",$e="rebuffer:ended",et="insights:ttff",tt="insights:time_to_first_frag_loaded",nt="insights:watched_interval";var ot=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:Ze,REBUFFER_ENDED:$e,DISPLAY:"display",TIME_TO_FIRST_FRAME:et,TIME_TO_FIRST_FRAGMENT_LOADED:tt,WATCHED_INTERVAL:nt});const rt=[g,"error","src"];function it(e){try{return!!new URL(e)}catch(e){return!1}}const at=navigator;function st(e){var t,n;const o=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return o?1e-6*o:(null===(n=at.connection)||void 0===n?void 0:n.downlink)||-1}function lt(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}const ct=e=>{switch(e){case!0:return K.ON;case!1:return K.OFF;default:return e}};function dt(){try{const e=window.location!==window.parent.location?document.referrer:document.location.href;return"string"==typeof e&&e.slice(0,200)}catch(e){return!1}}const ut=[],pt="https://ihi.flowplayer.com/v1/health/events";function ft(e){if(e.suspended)return;const t=ut.slice(0);ut.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),lt(function(){try{return"undefined"==typeof window?pt:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:pt}catch(e){return pt}}(),t))}async function ht(e,t,n){const o=await Et();ut.push(Object.assign(t,o)),e.logger.log(":enqueue",t.event,t),ut.length<10&&!n||ft(e)}const mt=()=>{var e,t;try{const n=window;return null===(t=null===(e=null==n?void 0:n.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},Et=async()=>({client_time:Date.now()}),yt=(e,t)=>Object.assign(e,{detail:t}),_t=(e,{event:t,media_session_id:n,session_id:o,play_range_id:r})=>({event:t,media_session_id:n,session_id:o,play_range_id:r,device_id:e.deviceId(),version:"3.20.0",commit:"2ad85ecae3156abede920d7df80bb777923e012e",ima_sdk_version:mt(),preload:e.opt("preload"),autoplay:ct(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:st(e),page_url:dt(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),gt=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});function vt(e,t,n,o){const r=_t(t,e.eventInfo(n)),{before:i,after:a}=o;ht(e,((e,t,n)=>Object.assign(e,{state:{before:t,after:n}}))(r,gt(i),gt(a)))}var St;function wt(e){switch(e){case St.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case St.MEDIA_ERR_NETWORK:return"a network error occurred";case St.MEDIA_ERR_DECODE:return"unable to decode media content";case St.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case St.NO_INTERNET:return"no internet connection detected";case St.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}!function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",e[e.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MIXED_CONTENT=1001]="MIXED_CONTENT",e[e.NO_INTERNET=1002]="NO_INTERNET"}(St||(St={}));const Ot=(e,t)=>{let n=null;return(...o)=>{null!==n&&(clearTimeout(n),n=null),n=setTimeout(()=>t(...o),e)}};var Tt;!function(e){e[e.Starting=0]="Starting",e[e.ConfigFinalized=1]="ConfigFinalized",e[e.TimerStartedWithAdsAutoplay=2]="TimerStartedWithAdsAutoplay",e[e.TimerStartedWithContentAutoplay=3]="TimerStartedWithContentAutoplay",e[e.TimerStartedWithUserGesture=4]="TimerStartedWithUserGesture",e[e.MetricReported=5]="MetricReported"}(Tt||(Tt={}));const It=["click","touchend"];class TimeToFirstFrame{constructor(e=Tt.Starting,t=!1,n=!1){this.state=e,this.loadedAd=t,this.requiresUserGesture=n}reset(){this.state=Tt.Starting,this.loadedAd=!1,this.elapsed=void 0,this.adDetails=void 0}adInfo(){const{ad_tag_id:e,vast_ad_id:t}=this.adDetails||{};return{ad_tag_id:e,vast_ad_id:t}}toJSON(){var e;return Object.assign({ad_was_requested:this.loadedAd,ms_to_first_frame:Math.round((null===(e=this.elapsed)||void 0===e?void 0:e.duration)||-1)},this.adInfo())}startTimer(e){this.state==Tt.ConfigFinalized&&(this.state=e,performance.mark("ttff:start"))}hasStarted(){return[Tt.TimerStartedWithAdsAutoplay,Tt.TimerStartedWithContentAutoplay,Tt.TimerStartedWithUserGesture].includes(this.state)}stopTimer(e){if(this.hasStarted()){performance.mark("ttff:end");const t=this.elapsed=performance.measure("ttff","ttff:start","ttff:end");this.state=Tt.MetricReported,e(t)}}}function At(e){return Math.round(1e3*e)/1e3}class EWMA{constructor(e){this.tickInterval=e,this.ewma=0,this.startTime=Date.now()}decay(){const e=Date.now()-this.startTime;return Math.pow(2,-e/(4*this.tickInterval))}update(e){const t=this.decay();return this.ewma=t*this.ewma+(1-t)*e,this.ewma}toJSON(){return this.ewma}}class WatchedState{constructor(e){this.player=e,this.marchingInterval=void 0,this.lastWatchedPoint=void 0,this.watchedSum=0,this.lastReportedSum=0,this.ewmaTickWatched=new EWMA(WatchedState.AccuracyMilliseconds)}reset(){this.onNotWatching(),this.watchedSum=0,this.lastReportedSum=0,this.lastWatchedPoint=void 0}onNotWatching(){this.marchingInterval&&(this.updateWatched(),this.marchingInterval=clearInterval(this.marchingInterval))}onWatching(){this.marchingInterval||(this.lastWatchedPoint=this.createWatchedPoint(),this.marchingInterval=setInterval(()=>{this.updateWatched()},WatchedState.AccuracyMilliseconds))}createWatchedPoint(){return{currentTime:this.player.currentTime,paused:this.player.paused}}updateWatched(){const e=this.createWatchedPoint();this.lastWatchedPoint&&this.calculateTimeWatched(this.lastWatchedPoint,e),this.lastWatchedPoint=e}calculateTimeWatched(e,t){const n=t.currentTime-e.currentTime,o=this.ewmaTickWatched.update(n);if(!(n<0)&&!(1e3*n>1.3*WatchedState.AccuracyMilliseconds)&&(this.watchedSum+=n,this.watchedSum!=this.lastReportedSum&&(this.watchedSum>this.lastReportedSum+WatchedState.ReportingIntervalSeconds||this.player.ended))){const e=At(o),t={total_watched_seconds:At(this.watchedSum),tick_watched_seconds:e,batch_watched_seconds:At(this.watchedSum-this.lastReportedSum)};this.lastReportedSum=this.watchedSum,this.player.emit(nt,t)}}}WatchedState.ReportingIntervalSeconds=5,WatchedState.AccuracyMilliseconds=160;const Nt=ue();class Health{constructor(e,t){let n;this.session_id=Nt,this.suspended=!1,this.logger=Je("health",t.opts),this.media_session_id=ue(),this.play_range_id=ue(),this.analyticsLoop=setInterval(()=>ft(this),2e3),t.on(y,()=>clearInterval(this.analyticsLoop)),t.on(u,()=>{n!==this.media_session_id&&(n=this.media_session_id,this.first_playing_event_timestamp=Date.now()),this.play_range_id=ue()});let o=Date.now()-1e3;t.on("timeupdate",e=>{if(n!==this.media_session_id)return;const r=Date.now();if(r<o)return;o=Date.now()+5e3;const i=_t(t,this.eventInfo(e.type)),a=yt(i,{duration:(s=t.duration,Number.isFinite(s)?s:s===1/0?-1:void 0)});var s;this.first_playing_event_timestamp&&(Object.assign(a,{ms_since_first_playing:r-this.first_playing_event_timestamp}),this.first_playing_event_timestamp=void 0),ht(this,a)});const r=this;if(t.health={get media_session_id(){return r.media_session_id},set media_session_id(e){r.media_session_id=e},get session_id(){return r.session_id},set session_id(e){r.session_id=e},toggle(e){e?r.resume():r.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>ft(this),2e3)}init(e,t,n){if(dt().toString().startsWith("data:"))return this.suspend();!function(e){let t=null;const n=()=>{t=null};e.on(p,(function(t){e.seeking||e.networkState===e.NETWORK_LOADING&&(e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||e.emit(Ze))})),e.on(Ze,e=>{t=e}),e.on(f,o=>{if(t){const r=o.timeStamp-t.timeStamp;if(n(),r<31)return;if(r>3e5)return;e.emit($e,{rebuffer_duration:r/1e3})}}),rt.forEach(t=>e.on(t,n))}(n),function(e){let t;[f,g].forEach(n=>{e.on(n,n=>{const o=Date.now();switch(n.type){case g:return t=o;case f:if(t)return e.emit(tt,{ms_since_loading_started:o-t}),t=null}})})}(n),function(e){if(void 0===window.performance)return;const t=new TimeToFirstFrame;e.on("ovp:config:finalized",e=>{t.reset(),t.state=Tt.ConfigFinalized,t.requiresUserGesture=!e.detail.autoplay}),e.on(g,()=>{e.root.classList.contains("ad-hide-first-frame")&&t.startTimer(Tt.TimerStartedWithAdsAutoplay),e.opt("autoplay")&&t.startTimer(Tt.TimerStartedWithContentAutoplay)}),It.forEach(n=>{e.on(n,()=>{e.opt("autoplay")||t.startTimer(Tt.TimerStartedWithUserGesture)})}),e.on("ad-requested",()=>{t.loadedAd=!0}),e.on("timeupdate",()=>{if(!(e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA))switch(t.state){case Tt.TimerStartedWithContentAutoplay:case Tt.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(et,t.toJSON()))}}),e.on("ad-started",n=>{switch(t.adDetails=n.detail,t.state){case Tt.TimerStartedWithAdsAutoplay:case Tt.TimerStartedWithUserGesture:return t.stopTimer(()=>e.emit(et,t.toJSON()))}})}(n),function(e){const t=new WatchedState(e);e.on(g,()=>t.reset()),e.on(u,()=>t.onWatching()),e.on(d,()=>t.onNotWatching()),e.on(E,()=>t.onNotWatching()),e.on(h,()=>t.updateWatched()),e.on("visibilitychange",()=>t.updateWatched())}(n),n.on("display",e=>{ht(this,_t(n,this.eventInfo(e.type)),!0)}),n.on("health:record",({detail:e})=>{const t=_t(n,this.eventInfo(e.event));Object.assign(t,e.detail||{}),ht(this,t)}),[c,a,s,l,p,Ze].forEach(e=>{n.on(e,e=>{ht(this,_t(n,this.eventInfo(e.type)))})}),[$e,et,tt,nt].forEach(e=>{n.on(e,e=>{const t=_t(n,this.eventInfo(e.type));ht(this,Object.assign(t,e.detail))})}),[u,d,E,m,h,r,i,f,g].forEach(e=>{n.on(e,e=>{ht(this,_t(n,this.eventInfo(e.type)))})}),n.on("volumechange",Ot(800,e=>{const t=_t(n,this.eventInfo(e.type));ht(this,yt(t,{volume:parseFloat(n.volume.toFixed(2)),muted:n.muted}))})),n.on("resize",Ot(800,e=>{const o=_t(n,this.eventInfo(e.type));ht(this,yt(o,{height:t.clientHeight,width:t.clientWidth}))})),n.on("hls/failover",e=>{const t=_t(n,this.eventInfo(e.type)),o=e.detail,{reason:r,from:i}=o;ht(this,yt(t,{reason:r,from:i}))}),n.on("qualitychange",({type:e,detail:t})=>{switch(t.plugin){case"hls":return vt(this,n,e,t)}}),n.addEventListener("error",e=>{const t=_t(n,this.eventInfo(e.type)),o=e.error||n.error;if(!o)return ht(this,t,!0);const r=o.code,i={error_message:o.message||wt(r),error_code:r,error_stack:o.stack||""};return ht(this,yt(t,i),!0)}),n.on("src",e=>{var t;const o=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof o)return;if(!it(n.original_src))return;if(!it(o))return;if(o==n.original_src)return;this.media_session_id=ue();ht(this,_t(n,this.eventInfo(e.type))),ft(this)}),n.on("visibilitychange",e=>{ht(this,_t(n,this.eventInfo(e.type))),ft(this)})}}function Rt(e,t){return function(e){return e.extensions.reduce((e,t)=>e.find(e=>e.name===t.name)?(console.warn("flowplayer: duplicate plugin %s detected, plugin names should be unique",t.name),e):(e.push(t),e),[])}(e).map(n=>new n(e,t))}Health.events=ot,Health._UNLOAD_SUBSCRIBED=!1;const Lt=function(){const e="undefined"!=typeof window?window:void 0!==Te?Te:{},t=e.flowplayer?e.flowplayer:{extensions:[]};return Array.isArray(t.extensions)||(t.extensions=[]),t}();function bt(n,o){if("function"==typeof n)return e.push(...[...arguments].filter(e=>"function"==typeof e)),bt;"string"==typeof o&&(o={src:o}),o||(o={}),o.token||"string"!=typeof window.__FLOWPLAYER_TOKEN||(o.token=window.__FLOWPLAYER_TOKEN);const r="string"==typeof n?document.querySelector(n):n;if(!r)return console.error(new Error("Flowplayer: '"+n.toString()+"' not found"));const i=r.querySelector("video.fp-engine");if(i)return i;const s=Le(o.token);if(!s.success)return Ce({root:r,data:{reason:"token",details:s.message}});const l=new Map,c=Oe(o,r);c.reaper=l,c._customElements=j,Object.defineProperty(c,"token",{value:"string"==typeof o.token?Re.id(o.token):"",writable:!1}),c.addEventListener(y,()=>{l.clear(),c.reaper=0,delete c.root}),c.root=r,o.token&&De.from_token(o.token).is_granted(De.permissions.DEVELOPER_PLAN)&&e.push(ExplorerPlan),!~t.indexOf(c)&&t.push(c),we(o,r,c),c.setAttrs(o),c.plugins=Rt(bt,c),We(o,r,c),Fe(o,r,c),Ge(r,c),Ve(o,r,c),Ye(c),ze(r,c),Xe(c,o),c.plugins.forEach(e=>{try{e.init(o,r,c)}catch(t){console.log("Error(plugin/%s)",e.constructor.name,t)}}),c.setOpts(o),c.opts=o,o.src&&c.setSrc(o.src);const d=c.readyState;return d>0&&c.currentSrc&&c.emit(a),d>2&&c.currentSrc&&c.emit(f),c.emit("mount"),c.on("error:fatal",(function(e){Ce({root:r,video:c,data:e.data||{}})})),setTimeout(me,0,document,"flowplayer:player:created",c),c}return Object.assign(bt,Lt),function(o){Array.isArray(o.extensions)&&o.extensions.forEach(t=>e.push(t)),o.customElements=j,o.defaultElements=S,o.version="3.20.0",o.commit="2ad85ecae3156abede920d7df80bb777923e012e",o.instances=t,o.extensions=e,o.support=n,o.events=v,o.states=M,o.jwt=G,o.autoplay=K,o.quality=B}(bt),"object"==typeof document&&setTimeout(me,0,document,"flowplayer:umd",bt),bt.extensions.unshift.apply(bt.extensions,[Health]),bt}));