@flowplayer/player 3.0.1-canary.58 → 3.0.1-canary.59

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/embed.js CHANGED
@@ -1,4 +1,4 @@
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 r(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",r=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),n=/Android/.test(t)&&!/Firefox/.test(t),i=/^((?!chrome|android).)*safari/i.test(t),a=/SamsungBrowser/.test(t),s=a&&/SMART-TV/.test(t);return{controls:!r,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:n,iphone:r,safari:i,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:a,samsung_tv:a&&s,touch:!!("ontouchstart"in window)}}const n="error",i="click",a="dblclick",s="load",o="mouseenter",u="mouseleave",l="touchend",c="resize",d="loadedmetadata",f="loadeddata",h="progress",p="loadstart",v="pause",g="playing",m="waiting",y="canplay",E="ended",_="seeked",T="seeking",b="reap",A="config",S="landscape",L="portrait";var k=Object.freeze({__proto__:null,MOUNT:"mount",ERROR:n,CONTEXT_MENU:"contextmenu",CLICK:i,DBL_CLICK:a,KEYUP:"keyup",KEYDOWN:"keydown",LOAD:s,MOUSE_ENTER:o,MOUSE_LEAVE:u,MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:l,TOUCH_CANCEL:"touchcancel",RESIZE:c,SCROLL:"scroll",FULLSCREEN_ENTER:"fullscreenenter",FULLSCREEN_EXIT:"fullscreenexit",FULLSCREEN_CHANGE:"fullscreenchange",WEBKIT_NEEDKEY:"webkitneedkey",METADATA:d,DATA:f,PROGRESS:h,TIME_UPDATE:"timeupdate",LOAD_START:p,VOLUME_CHANGE:"volumechange",PAUSE:v,PLAYING:g,PLAY:"play",WAITING:m,CAN_PLAY:y,ENDED:E,SEEKED:_,SEEKING:T,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:b,CONFIG:A,QUALITIES:"qualities",SET_QUALITY:"quality:set",NON_RECOVERABLE_ERROR:"error:fatal",RECOMMENDATIONS_READY:"recommendationsready",AUDIO_ONLY_SOURCE:"audioonlysource",LANDSCAPE:S,PORTRAIT:L,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"});const w="is-playing",D="is-paused",R="is-loading",O="is-starting",C="is-seeking",I="is-ended",x="is-waiting",P="is-live-seeked",M="is-touched";var N=Object.freeze({__proto__:null,PLAYING:w,FULLSCREEN:"is-fullscreen",PAUSED:D,MUTED:"is-muted",LOADED:"is-loaded",LOADING:R,STARTING:O,SEEKING:C,GRABBING:"is-grabbing",DISABLED:"is-disabled",SMALL:"is-small",TINY:"is-tiny",RTL:"is-rtl",ENDED:I,LIVE:"is-live",ERRORED:"is-error",WAITING:x,AUTOPLAY:"is-autoplay",NO_AUTOPLAY:"no-autoplay",SEAMLESS:"is-seamless",TOGGLING:"is-toggling",LIVE_SEEKED:P,NO_DVR:"no-timeline",HAS_POSTER:"has-poster",MENU_OPENED:"has-menu-opened",TOUCHED:M,HOVERED:"is-hovered",TOUCH_DEVICE:"is-touch-device",WILL_SEEK:"will-seek",SEEKABLE:"is-seekable"});function F(e){this.message=e}F.prototype=new Error,F.prototype.name="InvalidCharacterError";var U="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new F("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,a=0,s="";n=t.charAt(a++);~n&&(r=i%4?64*r+n:n,i++%4)?s+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return s};var B=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(U(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return U(t)}};function j(e){this.message=e}j.prototype=new Error,j.prototype.name="InvalidTokenError";var G,H=function(e,t){if("string"!=typeof e)throw new j("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(B(e.split(".")[r]))}catch(e){throw new j("Invalid token specified: "+e.message)}};H.InvalidTokenError=j,function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(G||(G={}));const K=function(){const e=new Map;return{render:(t,r)=>{const n=e.get(t);if(!n)return;const i=null==n?void 0:n.onrender;"function"==typeof i&&i(...r)},remove:(t,r)=>{const n=e.get(t);if(!n)return;const i=null==n?void 0:n.onremove;"function"==typeof i&&i(...r)},put:(t,r)=>{e.set(t,r)}}}();var V;!function(e){e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=4]="HIGH"}(V||(V={}));function W(e,t,r){const n="boolean"==typeof r;if("boolean"!=typeof r&&(r=e.paused),function(e,t,r){const n=e.poll(t?"beforeplay":"beforepause",{forced:r});return n&&n.defaultPrevented}(e,r,n))return;if(!r)return e.hasState("is-live")&&e.setState(P,!0),e.pause();if(0==e.reaper)return;const i=e.reaper.get("__pending_play");return 0!=e.paused||i?i?(i.src!==Y(e.original_src)&&q(e),i):(function(e){return(0==e.networkState||0==e.readyState)&&e.currentSrc==Y(e.original_src)}(e)&&q(e),(e=>e.autoplay&&G.AUDIO_REQUIRED&e.autoplay)(t)?function(e){e.muted=!1,0==e.volume&&(e.volume=1);return e.play().catch(e=>{console.warn("[flowplayer/play] autoplay audio required\n%s",e.message)})}(e):e.play().catch(t=>(console.warn("[flowplayer/play] attempting muted autoplay\n%s",t.message),e.muted=!0,e.volume=0,e.play()))):void 0}function q(e){e.currentSrc.match(/^blob:/)||e.load()}function Y(e){const t=document.createElement("a");return t.href=e,t.href}
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 r(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",r=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),n=/Android/.test(t)&&!/Firefox/.test(t),i=/^((?!chrome|android).)*safari/i.test(t),a=/SamsungBrowser/.test(t),s=a&&/SMART-TV/.test(t);return{controls:!r,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:n,iphone:r,safari:i,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:a,samsung_tv:a&&s,touch:!!("ontouchstart"in window)}}const n="error",i="click",a="dblclick",s="load",o="mouseenter",u="mouseleave",l="touchend",c="resize",d="fullscreenenter",f="fullscreenexit",h="loadedmetadata",p="loadeddata",v="progress",g="loadstart",m="pause",y="playing",E="waiting",_="canplay",T="ended",b="seeked",S="seeking",A="reap",L="config",k="landscape",w="portrait";var D=Object.freeze({__proto__:null,MOUNT:"mount",ERROR:n,CONTEXT_MENU:"contextmenu",CLICK:i,DBL_CLICK:a,KEYUP:"keyup",KEYDOWN:"keydown",LOAD:s,MOUSE_ENTER:o,MOUSE_LEAVE:u,MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:l,TOUCH_CANCEL:"touchcancel",RESIZE:c,SCROLL:"scroll",FULLSCREEN_ENTER:d,FULLSCREEN_EXIT:f,FULLSCREEN_CHANGE:"fullscreenchange",WEBKIT_NEEDKEY:"webkitneedkey",METADATA:h,DATA:p,PROGRESS:v,TIME_UPDATE:"timeupdate",LOAD_START:g,VOLUME_CHANGE:"volumechange",PAUSE:m,PLAYING:y,PLAY:"play",WAITING:E,CAN_PLAY:_,ENDED:T,SEEKED:b,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:"src",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:k,PORTRAIT:w,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"});const R="is-playing",O="is-paused",C="is-loading",I="is-starting",x="is-seeking",P="is-ended",M="is-waiting",N="is-live-seeked",F="is-touched";var U=Object.freeze({__proto__:null,PLAYING:R,FULLSCREEN:"is-fullscreen",PAUSED:O,MUTED:"is-muted",LOADED:"is-loaded",LOADING:C,STARTING:I,SEEKING:x,GRABBING:"is-grabbing",DISABLED:"is-disabled",SMALL:"is-small",TINY:"is-tiny",RTL:"is-rtl",ENDED:P,LIVE:"is-live",ERRORED:"is-error",WAITING:M,AUTOPLAY:"is-autoplay",NO_AUTOPLAY:"no-autoplay",SEAMLESS:"is-seamless",TOGGLING:"is-toggling",LIVE_SEEKED:N,NO_DVR:"no-timeline",HAS_POSTER:"has-poster",MENU_OPENED:"has-menu-opened",TOUCHED:F,HOVERED:"is-hovered",TOUCH_DEVICE:"is-touch-device",WILL_SEEK:"will-seek",SEEKABLE:"is-seekable"});function B(e){this.message=e}B.prototype=new Error,B.prototype.name="InvalidCharacterError";var j="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new B("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,a=0,s="";n=t.charAt(a++);~n&&(r=i%4?64*r+n:n,i++%4)?s+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return s};var G=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(j(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return j(t)}};function H(e){this.message=e}H.prototype=new Error,H.prototype.name="InvalidTokenError";var K,V=function(e,t){if("string"!=typeof e)throw new H("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(G(e.split(".")[r]))}catch(e){throw new H("Invalid token specified: "+e.message)}};V.InvalidTokenError=H,function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(K||(K={}));const W=function(){const e=new Map;return{render:(t,r)=>{const n=e.get(t);if(!n)return;const i=null==n?void 0:n.onrender;"function"==typeof i&&i(...r)},remove:(t,r)=>{const n=e.get(t);if(!n)return;const i=null==n?void 0:n.onremove;"function"==typeof i&&i(...r)},put:(t,r)=>{e.set(t,r)}}}();var q;!function(e){e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=4]="HIGH"}(q||(q={}));function Y(e,t,r){const n="boolean"==typeof r;if("boolean"!=typeof r&&(r=e.paused),function(e,t,r){const n=e.poll(t?"beforeplay":"beforepause",{forced:r});return n&&n.defaultPrevented}(e,r,n))return;if(!r)return e.hasState("is-live")&&e.setState(N,!0),e.pause();if(0==e.reaper)return;const i=e.reaper.get("__pending_play");return 0!=e.paused||i?i?(i.src!==X(e.original_src)&&z(e),i):(function(e){return(0==e.networkState||0==e.readyState)&&e.currentSrc==X(e.original_src)}(e)&&z(e),(e=>e.autoplay&&K.AUDIO_REQUIRED&e.autoplay)(t)?function(e){e.muted=!1,0==e.volume&&(e.volume=1);return e.play().catch(e=>{console.warn("[flowplayer/play] autoplay audio required\n%s",e.message)})}(e):e.play().catch(t=>(console.warn("[flowplayer/play] attempting muted autoplay\n%s",t.message),e.muted=!0,e.volume=0,e.play()))):void 0}function z(e){e.currentSrc.match(/^blob:/)||e.load()}function X(e){const t=document.createElement("a");return t.href=e,t.href}
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -12,7 +12,7 @@
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */function z(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function X(e){const t=document.createElement("a");t.href=e;const r=t.pathname&&t.pathname.split(".");return r.length>1&&r[r.length-1]}function Q(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const J=e=>{var{src:t}=e,r=z(e,["src"]);return[Object.assign({src:t,type:t?Q("video/"+X(t)):""},r)]};function Z(e){return J({src:e})}function $(e){var{src:t,type:r}=e,n=z(e,["src","type"]);return t&&r?[Object.assign({src:t,type:r},n)]:r&&!t?[Object.assign({type:r},n)]:J(Object.assign({src:t},n))}var ee;function te(e,t,r,n={safari:!1}){const i=function(e){return"string"==typeof e?Z(e):Array.isArray(e)||"object"!=typeof e?e.reduce((function(e,t){return"string"==typeof t&&(t=Z(t)),"object"!=typeof t||Array.isArray(t)||(t=$(t)),e.concat(t)}),[]):$(e)}(r);return e.currentSrc&&(e.innerHTML=""),Array(...Array(i.length)).map((e,t)=>t).some(r=>{const a=i[r];if(ee.Ok==function(e,t,r){e.emit("src",r),"string"==typeof r.src&&(e.original_src=r.src);const n=function(e,t,r){return e.plugins.filter(e=>{return(t=e)&&"wants"in t;var t}).find(e=>e.wants(r.src||"",r,t))}(e,t,r);return n?(n.onload(t,e.root,e,r),ee.Ok):ee.Err}(e,t,a)||ee.Ok==function(e,t,r,n={safari:!1}){/^audio\//.test(r.type||"")&&e.emit("audioonlysource");t.start_time&&(r.src=r.src+"#t="+t.start_time);if(""==e.canPlayType(r.type||""))return ee.Err;if(r.drm&&(!r.drm["com.apple.fps.1_0"]||!n.safari))return ee.Err;"string"==typeof r.src&&(e.src=r.src);return ee.Ok}(e,t,a,n))return!0;r==i.length-1&&"string"==typeof a.src&&(e.src=a.src)}),function(e,t){(function(e,t){if(!e.currentSrc)return;if("none"==e.opt("preload"))return;if(t.autoplay&&t.autoplay>0)return;e.load()})(e,t),"none"==e.opt("preload")&&e.render()}(e,t),e}!function(e){e[e.Err=0]="Err",e[e.Ok=1]="Ok"}(ee||(ee={}));const re=[b,T,"src","seek:cancel"];var ne;function ie(e,t,r){return isNaN(e.duration)||isNaN(e.currentTime)?{}:(t.offset+=r,0==t.offset?ae(e,t):(t.timer&&clearTimeout(t.timer),t.timer=setTimeout((function(){0!=e.reaper&&(e.currentTime=function(e,t,r=0){return Math.max(Math.min(t,e),r)}(e.currentTime+t.offset,e.duration),t.timer=0,ae(e,t))}),1e3),function(e,t){e.setState("will-seek",!0),e.setState(ne.BACKWARD,t.offset<0),e.setState(ne.FORWARD,t.offset>0)}(e,t),e.emit("seek:queued",t),t))}function ae(e,t){t.timer&&clearTimeout(t.timer),t.timer=t.offset=0,function(e){e.setState(ne.FORWARD,!1),e.setState(ne.BACKWARD,!1),e.setState("will-seek",!1)}(e)}function se(){if("undefined"==typeof document)return!1;const e=document.documentElement;return e&&"rtl"==e.getAttribute("dir")}function oe(...e){const t=document.createElement("div");return 0==e.length||t.classList.add(...e),t}function ue(e,t,r){const n=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;n.length;){if(null==e)return r;const t=n.shift();if("string"!=typeof t)return r;e=e[t]}return null==e?r:e}function le(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}function ce(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const r=Math.floor(e/3600);let n=Math.floor(e/60);return e-=60*n,r>=1?(n-=60*r,t+r+":"+le(n)+":"+le(e)):t+le(n)+":"+le(e)}!function(e){e.FORWARD="forward",e.BACKWARD="backward"}(ne||(ne={}));const de=navigator.languages||[navigator.language];function fe(e,t,r){const n={};return r=t.lang||r,e[r]&&(n[r]=e[r]),function(){try{return de.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().forEach((function(t){e[t]&&!n[t]&&(n[t]=e[t])})),Object.values(n)}const he=[1e7]+""+-1e3+-4e3+-8e3+-1e11,pe=()=>"undefined"==typeof crypto?"":he.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));let ve="";!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 ge=["touchstart","touchmove"];function me(e,t){const r=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(r,"data",{get:()=>t}),r}function ye(e,t,r){const n=me(t,r);return e.dispatchEvent(n),e}function Ee(e,t,r){const n=me(t,r);return e.dispatchEvent(n),n}function _e(e,t,r,n){Array.isArray(t)?t.forEach(t=>Te(e,t,r,n)):Te(e,t,r,n)}function Te(e,t,r,n){if(i=t,!~ge.indexOf(i))return e.addEventListener(t,r,n),e;var i;const a=Object.assign(n||{},{passive:!0});return e.addEventListener(t,r,a),e}function be(e,t,r,n){return _e(e,t,r,Object.assign(n||{},{once:!0}))}const Ae={preload:"none",rtl:!1,controls:!0},Se=["loop","muted","preload"];function Le(e,n,i){i.toJSON=function(){return{duration:i.duration,volume:i.volume,currentTime:i.currentTime,states:i.root.className}},i.setSrc=function(t){return te(i,e,t,r())},i.playerState=i.playerState||{},i.setState=function(e,t){if(i.playerState[e]===!!t)return i;const r=Object.assign({},i.playerState,{[e]:t});return r[x]&&(r[w]=!1),i.playerState=r,ye(i,"state",i.playerState),i},i.hasState=function(e){return!!i.playerState[e]},i.transitionState=function(e,t,r){i.hasState(e)&&(r=0),r&&i.setState("is-toggling",!0),i.setState(t,!1),i.setState(e,!0),r&&setTimeout((function(){i.setState("is-toggling",!1)}),r)},i.render=function(e,t){return"string"==typeof e?K.render(e,t):(ye(i,r().ios?d:f),ye(i,y),i)},i.emit=(e,t)=>(ye(i,e,t),i),i.on=(e,t)=>(_e(i,e,t),i),i.once=(e,t)=>(be(i,e,t),i),i.off=(e,t)=>{var r,n;return r=e,n=t,i.removeEventListener(r,n),i},i.poll=(e,t)=>Ee(i,e,t),i.togglePlay=function(t){return W(i,e,t)},i.toggleMute=function(e){e=null==e?!i.muted:!!e,i.muted=e,i.muted||i.volume||(i.volume=1),ye(i,"volumechange")},i.toggleDisable=function(e){e=null==e?!i.disabled:!!e,i.setState("is-disabled",e),i.disabled=e},i.destroy=function(){i.pause();const e=t.indexOf(i);~e&&t.splice(e,1),setTimeout((function(){i.setSrc([]),i.reaper&&i.reaper.clear(),ye(i,b)}),0)},i.setAttrs=function(e){return Se.forEach(t=>{if(!(t in e))return;const r=e[t];r?i.setAttribute(t,r.toString()):i.removeAttribute(t)}),i},i.opt=function(t,r){return r=void 0===r?ue(Ae,t):r,ue(e,t,r)},i.i18n=function(e,t){if(!i.reaper)return"";const r=i.reaper.get("translations");return r?function e(t,r,n,i){return(i=i||0)>=t.length?n:ue(t[i],r,e(t,r,n,i+1))}(r,e,t||""):t||""},i.setOpts=function(t){Object.assign(e,t),"disabled"in t&&void 0!==t.disabled&&i.toggleDisable(t.disabled),"muted"in t&&void 0!==t.muted&&i.toggleMute(t.muted);const r=!!e.autoplay&&!i.hasState("no-autoplay");i.setState("is-autoplay",r),i.setState("is-rtl",i.opt("rtl",function(e){if(!e)return se();const t=e.getAttribute("dir");return t?"rtl"==t:se()}(n))),i.setState("is-live",!!e.live),i.setState("no-timeline",!(!e.live||e.dvr)),i.setState("has-poster","string"==typeof e.poster&&e.poster.length>0),i.setState("is-seekable",!!e.seekable),n.style.backgroundImage=i.hasState("has-poster")?"url('"+e.poster+"')":"",ye(i,A,e)},i.renderPlugin=function(e){Ee(i,"renderplugin",e).defaultPrevented||i.root.appendChild(e)};const a={offset:0,timer:0};var s,o;o=a,(s=i).on(re,(function(){ae(s,o)})),i.enqueueSeek=function(e){if(0!=i.opts.seekable&&!(1==i.opts.disabled&&e>0))return ie(i,a,e)},i.deviceId=function(){return function(){if(ve)return ve;try{const e=localStorage.getItem("flowplayer/uuid");if(e)return e;const t=pe();return localStorage.setItem("flowplayer/uuid",t),t}catch(e){return ve=pe()}}()}}function ke(e,t){const r=t.querySelector("video"),n=r||(e._video_element_callback?e._video_element_callback(e):document.createElement("video"));return n.classList.add("fp-engine"),n.playsInline=!0,r||t.append(n),n}function we(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const r=e.flowplayer;return"function"==typeof r?(r(t),t):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(t)||r.extensions.push(t),t)}function De(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}}const Re=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function Oe(e,t){return!!~Re.indexOf(e)||e.indexOf(t)===e.length-t.length}Oe.check_whitelist=function(e){return!!~Re.indexOf(e)};const Ce="production";function Ie(e,t){const r={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let n={c:"{}",exp:0};t=t||{};try{n=H(e),r.valid_jwt=!0}catch(e){}return r.raw=e,r.data=JSON.parse(n.c),r.exp=n.exp,t.require_valid_token&&Ie.validate(r),r}function xe(e){try{return Ie.validate(e),{success:!0,message:""}}catch(e){return{success:!1,message:e.message}}}var Pe;function Me(e){return{grant:e,is_granted:t=>(e&t)===t}}function Ne(e,t,r){t&&t.destroy(),console.error(new Error(r.details||r.reason)),e.innerHTML="",e.classList.remove("flowplayer"),e.classList.add("flowplayer-fatal"),e.innerHTML='\n <h2>Playback Error</h2>\n <p>Are you the site owner?</p>\n <a class="troubleshoot" target="_blank" href="https://flowplayer.com/help/developers/troubleshooting">Troubleshoot?</a>\n <img src=""https://flowplayer.com/user/pages/images/logo-white.png""/>\n '}function Fe(e,t){const r=t.clientWidth;t.classList.toggle("is-small",r<600),t.classList.toggle("is-tiny",r<400)}function Ue(e,t,n){let i=!0;t.classList.add("flowplayer"),Fe(0,t),_e(n,[p,c],(function(){Fe(0,t)})),_e(n,"state",(function(){Object.entries(n.playerState).forEach((function([e,r]){t.classList.toggle(e,r)}))})),_e(n,"timeupdate",(function(){n.setState(x,!1)})),_e(n,A,(function(){const r=n.paused&&(!e.autoplay||t.classList.contains("no-autoplay"))&&0==n.currentTime;[R,O].forEach((function(e){n.setState(e,r)}))})),_e(n,E,(function(t){setTimeout((function(){t.defaultPrevented||(e.rewind&&!n.loop&&(e.autoplay&&(e.autoplay=0,n.setState("is-autoplay",!1)),n.setState(C,!0),be(n,_,(function(){n.setState(C,!1),n.pause(),n.setState(O,!0)})),n.currentTime=0),be(n,"timeupdate",(function(){n.setState(I,!1)})),n.transitionState(I,w,e.loop||e.rewind?0:300))}),0)})),_e(n,[T,_],(function(e){n.setState(C,e.type==T),n.setState(D,n.paused),n.setState(w,!n.paused)})),_e(n,E,(function(){n.setState(w,!1),i=!0})),_e(n,r().ios?d:f,(function(e){const t="src"!=e.type||"none"!==n.opt("preload");n.setState("is-loaded",t),n.setState(R,!t)})),_e(n,[m,y,p],(function(t){if(!n.hasState(C)&&(t.type!=y||e.autoplay||n.setState(x,!1),t.type!=p||"none"!=n.opt("preload")||e.autoplay)){if(t.type==p&&e.autoplay)return be(n,g,(function(){n.setState(x,!1)}));t.type==m&&[w,D,O].forEach((function(e){n.setState(e,!1)})),n.setState(I,!1),n.setState(x,t.type==m)}})),_e(n,[g,v],(function(t){setTimeout(()=>{const e=new CustomEvent("flowplayer/"+t.type,{detail:n});document.dispatchEvent(e)},0);const r=t.type==g,a=n.currentTime==n.duration,s=r&&i&&e.autoplay||n.hasState(x);if(r&&(n.started=!0,i=!1),n.setState(x,!1).setState(O,!1),a||n.hasState(C))return;const o=r?w:D,u=r?D:w;n.transitionState(o,u,s?0:300),r&&n.setState("no-autoplay",!1)}))}function Be(e){const t=function(e){const t=e.getBoundingClientRect(),r=window.innerHeight,n=t.height,i=t.bottom,a=n/5;return t.top<=a&&t.top+n>r-a||i-n+a>=0&&i<r+a}(e.root);return e.in_viewport===t||(e.in_viewport=t,ye(e,t?"viewenter":"viewleave")),e}function je(e,r,n){Be(n);const a={should_resume:!!e.autoplay,has_user_gesture:!1,locked:!1};[l,i].forEach(e=>be(n,e,()=>a.has_user_gesture=!0)),_e(n,"play",(function(){a.locked||(a.should_resume=!0)})),_e(n,v,(function(){a.locked||(a.should_resume=!1)})),_e(n,y,(function(r){!e.autoplay||t.filter((function(e){return!e.paused})).length&&!e.multiplay||n.in_viewport&&n.paused&&a.should_resume&&n.togglePlay(!0)})),e.autopause&&(_e(n,"viewenter",(function(){a.should_resume&&n.togglePlay(!0)})),_e(n,"viewleave",(function(){const e=!n.paused;a.locked=!0,n.pause(),setTimeout((function(){a.should_resume=e,a.locked=!1}),0)})))}Ie.validate=function(e){if("string"==typeof e&&(e=Ie(e)),!e||!e.raw){if(Oe.check_whitelist(window.location.hostname)||"dev"===Ce.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,r=Oe.bind(null,t);if("dev"!==Ce.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(r))throw new Error("Domain not allowed");if("dev"!==Ce.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},Ie.id=function(e){if(e)return"string"==typeof e&&(e=Ie(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"}(Pe||(Pe={})),Me.of=Me,Me.from_token=function(e){const t=Ie(e,{require_valid_token:!0});return Me.of(t.data.acl)},Me.permissions=Pe,[s,c].forEach(e=>{window.addEventListener(e,(function(){t.forEach((function(e){const t=e.root;t.prevWidth!=t.clientWidth&&(ye(e,c),t.prevWidth=t.clientWidth)}))}))}),window.addEventListener("scroll",(function(){t.forEach(Be)}));function Ge(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 He(e,t,r){const n=document.createElement("div");n.classList.add("fp-ratio"),t.append(n);let i=Ge(e.ratio||.5625);n.style.paddingTop=100*i+"%";const a=[f,d];r.on(a,(function(){const e=r.videoHeight&&r.videoWidth&&r.videoHeight/r.videoWidth;e&&r.setOpts({ratio:e})})),r.on(A,(function(){const t=r.videoHeight&&r.videoWidth&&r.videoHeight/r.videoWidth,a=Ge((null==e?void 0:e.ratio)||t||.5625);i!==a&&(i=a,n.style.paddingTop=100*a+"%")}))}const Ke="flowplayer/"+g;function Ve(e){const t=t=>{t.detail!==e&&!e.opt("multiplay")&&e.pause()};e.on(b,()=>document.removeEventListener(Ke,t)),document.addEventListener(Ke,t)}const We=function(){const e=De(),t=e.flowplayer?e.flowplayer:{extensions:[]};return Array.isArray(t.extensions)||(t.extensions=[]),t}();function qe(r,n){if("function"==typeof r)return e.push(...[...arguments].filter(e=>"function"==typeof e)),qe;"string"==typeof n&&(n={src:n}),n||(n={}),n.token||"string"!=typeof window.__FLOWPLAYER_TOKEN||(n.token=window.__FLOWPLAYER_TOKEN);const i="string"==typeof r?document.querySelector(r):r;if(!i)return console.error(new Error("Flowplayer: '"+r.toString()+"' not found"));const a=i.querySelector("video.fp-engine");if(a)return a;const s=xe(n.token);if(!s.success)return Ne(i,null,{reason:"token",details:s.message});const o=new Map,u=ke(n,i);if(u.reaper=o,Object.defineProperty(u,"token",{value:"string"==typeof n.token?Ie.id(n.token):"",writable:!1}),u.addEventListener(b,()=>{o.clear(),u.reaper=0,delete u.root}),u.root=i,n.token&&Me.from_token(n.token).is_granted(Me.permissions.DEVELOPER_PLAN))return Ne(i,null,{reason:"developer_plan",details:"Using developer plan tokens is not currently supported"});!~t.indexOf(u)&&t.push(u),Le(n,i,u),u.setAttrs(n),u.plugins=qe.extensions.map(e=>new e(qe,u)),Ue(n,i,u),je(n,0,u),He(n,i,u),Ve(u),u.plugins.forEach(e=>{try{e.init(n,i,u)}catch(t){console.log("Error(plugin/%s)",e.constructor.name,t)}}),u.setOpts(n),u.opts=n,n.src&&u.setSrc(n.src);const l=u.readyState;return l>0&&u.currentSrc&&u.emit(d),l>2&&u.currentSrc&&u.emit(y),"none"==u.opt("preload")&&u.paused&&u.currentSrc&&u.render(),u.emit("mount"),u.on("error:fatal",(function(e){Ne(i,u,e.data||{})})),u}Object.assign(qe,We),function(n){Array.isArray(n.extensions)&&n.extensions.forEach(t=>e.push(t)),n.components=K,n.version="3.0.0-rc6",n.commit="ad6acdc4a9531cfb786b26bd1c68dd86bd3151af",n.instances=t,n.extensions=e,n.support=r,n.events=k,n.states=N,n.jwt=H,n.autoplay=G,n.quality=V}(qe),"object"==typeof document&&setTimeout(ye,0,document,"flowplayer:umd",qe);var Ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ze(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Xe(e){var t={exports:{}};return e(t,t.exports),t.exports}var Qe=Xe((function(e,t){var r=Ye&&Ye.__assign||function(){return(r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};t.__esModule=!0,t.remove=t.downcase=t.pluck=t.merge=void 0,t.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return r(r({},e),t)}),{})},t.pluck=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return Object.keys(e).filter((function(e){return~r.indexOf(e)})).reduce((function(r,n){var i;return t.merge(r,((i={})[n]=e[n],i))}),{})},t.downcase=function(e){return(e||"").toString().toLowerCase()},t.remove=function(e,t){var r=e.lastIndexOf(t);return~r&&e.splice(r,1),e}})),Je=Xe((function(e,t){var r=Ye&&Ye.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=Ye&&Ye.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=Ye&&Ye.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&r(t,e,i);return n(t,e),t};t.__esModule=!0;var a=i(Qe),s=function(){function e(){this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return e.of=function(){return new e},e.is_empty=function(e){return 0==e.pending.length},e.is_high_water=function(t){return t.open.length==e.MAX_OPEN_REQUESTS},e.maybe_spawn_req=function(t){if(e.is_empty(t))return t;if(e.is_high_water(t))return t;try{var r=e.lpop(t);r&&e.request(t,r)}catch(e){}},e.increment_failures=function(t){return t.stats.failures++,t.stats.failures>e.MAX_FAILURE_COUNT&&(t.stats.ttl=Date.now()+e.REQUEST_TTL_MS),t},e.handle_error=function(t,r){e.rm(t,r),e.increment_failures(t)},e.request=function(t,r){var n=r[0],i=r[1],a=r[2];if(!(Date.now()<t.stats.ttl)){var s=new XMLHttpRequest;t.open.push(s),s.timeout=e.REQUEST_TIMEOUT_MS,s.ontimeout=function(){e.handle_error(t,s)},s.onerror=function(r){e.handle_error(t,s)},s.onreadystatechange=function(){s.readyState==XMLHttpRequest.DONE&&e.rm(t,s),Math.floor(s.status/100)},s.onload=function(){e.rm(t,s),t.stats.failures&&t.stats.failures--},s.open(i,n),s.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{s.send(JSON.stringify(a))}catch(e){}}},e.rpush=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return r.forEach((function(r){t.pending.length>=e.MAX_PENDING||(t.pending.push(r),e.maybe_spawn_req(t))})),t},e.lpop=function(e){return e.pending.shift()},e.rm=function(e,t){return a.remove(e.open,t),e},e.MAX_OPEN_REQUESTS=3,e.MAX_PENDING=5,e.REQUEST_TIMEOUT_MS=4e3,e.REQUEST_TTL_MS=5e3,e.MAX_FAILURE_COUNT=3,e}();t.default=s})),Ze=Xe((function(e,t){var r=Ye&&Ye.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var n=r(Je);t.default=n.default.of()})),$e=Xe((function(e,t){t.__esModule=!0,t.prepare_url=t.URL_PARAM=void 0,t.URL_PARAM=/:([a-zA-Z_]+)/g,t.prepare_url=function(e,r){return e.url.replace(t.URL_PARAM,(function(t){if((t=t.slice(1,t.length))in r)return r[t].toString();e.log.error(new Error("\n preparing url["+e.url+"] failed\n \n parameter["+t+"] not detected in params:\n \n "+JSON.stringify(r,null,2)+"\n "))}))}})),et=Xe((function(e,t){t.__esModule=!0,t.Log=void 0;var r=function(){function e(e){this.emitter=e}return e.prepare=function(e,t){var r=document.createEvent("Event");return r.initEvent(e,!1,!0),r.ns=e,r.data=t,r},e.of=function(t){return new e(t)},e.prototype.info=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.INFO,t))},e.prototype.error=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.ERROR,t))},e.prototype.warn=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.WARN,t))},e.NAMESPACE={INFO:"tracker:info",ERROR:"tracker:err",WARN:"tracker:warn"},e}();t.Log=r})),tt=Xe((function(e,t){var r;t.__esModule=!0,t.Verb=void 0,(r=t.Verb||(t.Verb={})).POST="POST",r.PUT="PUT",r.GET="GET"})),rt=Xe((function(e,t){var r=Ye&&Ye.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=Ye&&Ye.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=Ye&&Ye.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&r(t,e,i);return n(t,e),t},a=Ye&&Ye.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var a=arguments[t],s=0,o=a.length;s<o;s++,i++)n[i]=a[s];return n},s=Ye&&Ye.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var o=s(Ze),u=s(Je),l=i($e),c=i(Qe),d=function(){function e(t,r){var n=this;void 0===r&&(r={});var i=this;if(this.emitter=t,this.url=r.url,this.log=et.Log.of(this.emitter),this.verb=r.verb,this.metadata=c.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),e.assert_emitter_api(this.emitter),void 0===e.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");e.TRACKERS.push(this),i.events.forEach((function(t){e.create_listener(n,t,(function(r){void 0===r&&(r={});var a=c.merge(i.metadata,{event_type:t},r.data||r),s=l.prepare_url(i,a),o=e.pluck_valid_keys(i,a),d=e.ensure_required_keys(i,o);if(d.length)return i.log.error("Tracker.validate_metadata() failed for \n Event["+t+"]\n missing keys: "+d+"\n payload:\n "+JSON.stringify(o,null,2));u.default.rpush(n.rq,[s,n.verb,o])}))}))}return e.of=function(t,r){return new e(t,r)},e.ensure_required_keys=function(e,t){return e.required_keys.filter((function(e){return!(e in t)}))},e.pluck_valid_keys=function(e,t){return c.pluck.apply(c,a([t],e.valid_keys))},e.merge_metadata=function(t,r){return void 0===r&&(r={}),t.metadata=e.pluck_valid_keys(t,c.merge(t.metadata,r)),t},e.assert_emitter_api=function(e){if("function"!=typeof(e||{}).addEventListener)throw new Error("Tracker() received an emitter that does not implement the addEventListener method");if("function"!=typeof(e||{}).removeEventListener)throw new Error("Tracker() received an emitter that does not implement the removeEventListener method")},e.create_listener=function(e,t,r){e.listeners.push([t,r]),e.emitter.addEventListener(t,r)},e.prototype.destroy=function(){var t=this;this.listeners.forEach((function(e){var r=e[0],n=e[1];return t.emitter.removeEventListener(r,n)})),delete this.rq,delete this.emitter,c.remove(e.TRACKERS,this)},e.prototype.put=function(t){return void 0===t&&(t={}),e.merge_metadata(this,t),this},e.TRACKERS=[],e.QUEUE=o.default,e.verb=tt.Verb,e}();t.default=d})),nt=Xe((function(e,t){var r=Ye&&Ye.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=Ye&&Ye.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=Ye&&Ye.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&r(t,e,i);return n(t,e),t},a=Ye&&Ye.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0,t.API=t.Tracker=void 0;var s=a(rt);t.Tracker=s.default;var o=i($e);t.API=o})),it="ping",at="display",st="view";const ot=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],ut=["created","position"],lt=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];function ct(e,t){return e.duration/1===e.duration&&Object.assign(t,function(e){const t=e/100;return{segment_duration:t,breakpoints:Array(...Array(100)).map((function(e,r){return Math.floor(r*t*1e3)/1e3}))}}(e.duration))}function dt(e,t,r){if(!t.segment_duration&&!ct(e,t))return;const n=function(e,t,r){const n=t.last_idx,i=r?99:ft(e,t);return t.last_idx=i,i<=n?[]:t.breakpoints.slice(n,99==i?100:i).map((function(e){return t.breakpoints.indexOf(e)}))}(e,t,r);0!=n.length&&e.emit(it,{position:n})}function ft(e,t){return Math.min(Math.floor(e.currentTime/t.segment_duration),99)}const ht="vod",pt="live",vt=[at,it,st];function gt(e,t,r){switch(null==t?void 0:t.kind){case"live":return function(e,t){const r=Date.now();r-t.last_tracked_ts<6e4||(t.last_tracked_ts=r,++t.ticks,e.emit(it,{position:60*t.ticks}))}(e,t);case"vod":return dt(e,t,"boolean"==typeof r&&r)}}function mt(e){const t=e.ads;return void 0!==t&&(void 0!==t.schedule&&("function"==typeof t.hasPreroll&&(t.currentRequests?t.currentRequests:!!t.adPlaying||!(!t.hasPreroll()||0!=t.nextIndex))))}function yt(){try{return window.location!==window.parent.location?document.referrer:document.location.href}catch(e){return!1}}class Et{init(e,t,r){if(!Me.from_token(e.token||"").is_granted(Me.permissions.ANALYTICS))return;if(r.analytics)return;const n=r.analytics={ticker:void 0,last_media_id:"",ended:!1},i={locked:!1,ttl:6e3,task:()=>{gt(r,n.ticker)}};const a={session_id:r.deviceId(),autoplay:r.autoplay,muted:r.muted,player_id:e.player_id,customer_user_id:e.customer_user_id},s=nt.Tracker.of(r,{verb:nt.Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:vt,required_keys:ot,optional_keys:lt.concat(ut).slice(0),metadata:a});r.on(b,(function(){s&&s.destroy()})),r.on(A,(function(t){if(!s)return;const i=ue(t,"data.metadata",{});if(!i.media_id)return;const a=ue(s,"metadata.media_id");if(a&&i.media_id==a)return;const o=ue(e,"analytics",{});s.put(i),s.put(o);const u=ue(e,"metadata.live_start_time",e.live)?pt:ht;s.put({video_type:u,source:e.source||yt()||""}),n.ticker=e.live?{ticks:0,last_tracked_ts:Date.now(),kind:"live"}:{last_idx:0,segment_duration:0,breakpoints:[],kind:"vod"},n.ended=!1,r.emit(at)}));let o=0;r.on(g,(function(){if(!s)return;if(o||function(e,t){return e.metadata.media_id&&e.metadata.media_id==t.last_media_id}(s,n))return;s.put({muted:r.muted});const e=mt(r);if(e)return o=Promise.resolve(e).then((function(){n.last_media_id=s.metadata.media_id,r.emit(st),o=0})).catch((function(){o=0}));n.last_media_id=s.metadata.media_id,r.emit(st)})),r.on("timeupdate",(function(){var t;s&&(o||mt(r)||n.ended||(!e.live&&r.currentTime+.25>=r.duration&&gt(r,n.ticker,!0),(t=i).locked||(t.locked=setTimeout((function(){return t.task(),function(e){return e.locked=!1,e}(t)}),t.ttl))))})),r.on(_,(function(){s&&n.ticker&&"vod"==n.ticker.kind&&function(e,t){ct(e,t),t.last_idx=ft(e,t)}(r,n.ticker)})),r.on(E,(function(){s&&function(e,t){t.ended||(t.ended=!0,gt(e,t.ticker))}(r,n)}))}}function _t(e,t,r){!function(e,t,r){"undefined"!=typeof window&&"ontouchstart"in window&&r.setState("is-touch-device",!0);let n=!1;r.setState("is-accessibility",!1);const i=t.querySelector(".fp-middle");i&&i.addEventListener(l,(function(e){0!=e.cancelable&&(e.preventDefault(),r.emit(e.type,{source:e}))})),r.on(l,(function(e){setTimeout((function(){if(e.defaultPrevented)return;if(r.hasState(x))return;if(r.ended)return r.togglePlay(!0);const t=r.hasState(O);n&&clearTimeout(n),(t||r.hasState(M)||r.hasState("no-autoplay"))&&(r.hasState(M)&&(r.setState(M,!1),r.setState("is-hovered",!1)),r.togglePlay(),t)||(r.setState(M,!0),r.paused||(n=setTimeout((function(){n=!1,r.setState(M,!1),r.setState("is-hovered",!1)}),2e3)))}),0)}))}(0,t,r)}function Tt(e,t,r){let n=()=>document.fullscreenElement,i="fullscreenchange";if(!Element.prototype.requestFullscreen){const e=Element.prototype,t=document;e.webkitRequestFullScreen&&(e.requestFullscreen=e.webkitRequestFullScreen,t.fullscreenEnabled=!0),t.webkitCancelFullScreen&&(document.exitFullscreen=t.webkitCancelFullScreen),i="webkit"+i,n=()=>t.webkitCurrentFullScreenElement}r.toggleFullScreen=function(e,n){r.ios_fullscreen_disabled||("boolean"!=typeof e&&(e=!r.in_fullscreen),bt(r)&&(e?function(e){e.getAttribute("playsinline")&&e.removeAttribute("playsinline");e.getAttribute("webkit-playsinline")&&e.removeAttribute("webkit-playsinline");e.webkitEnterFullScreen()}(r):function(e,t){e.getAttribute("playsinline")||e.setAttribute("playsinline","");e.getAttribute("webkit-playsinline")||e.setAttribute("webkit-playsinline","");t||e.webkitExitFullScreen();e.togglePlay(!1),e.hasState(M)||e.setState(M,!0)}(r,n)),document.fullscreenEnabled&&(e?t.requestFullscreen():document.exitFullscreen()))},bt(r)&&(r.ios_fullscreen_disabled=!0,r.once("beforeplay",(function(){r.ios_fullscreen_disabled=!1})),r.on("webkitendfullscreen",(function(){r.toggleFullScreen(!1,!0)}))),t.addEventListener(i,(function(){const e=n(),i=e===t||e==r;r.in_fullscreen=i,r.emit(i?"fullscreenenter":"fullscreenexit"),r.setState("is-fullscreen",i),r.emit(c)})),!1!==e.doubleclick&&t.addEventListener(a,(function(e){var t;e.target&&(null===(t=e.target)||void 0===t?void 0:t.classList.contains("fp-ui"))&&r.toggleFullScreen()}))}function bt(e){return r().ios&&"function"==typeof e.webkitEnterFullScreen&&"function"==typeof e.webkitExitFullScreen}we(De(),Et),"undefined"!=typeof window&&window.matchMedia&&[S,L].forEach((function(e){window.matchMedia("(orientation: "+e+")").addListener((function(r){t.length&&t.forEach((function(t){r.matches&&t.emit(e)}))}))}));const At={name:"fp-fullscreen",translation_key:"core.fullscreen"},St={name:"fp-fullscreen-exit",translation_key:"core.exit_fullscreen"},Lt={name:"fp-play",translation_key:"core.play"},kt={name:"fp-pause",translation_key:"core.pause"},wt={translation_key:"core.mute",name:"fp-volume-mute-unmute"},Dt={translation_key:"core.play",name:"fp-small-play"},Rt={translation_key:"core.pause",name:"fp-small-pause"},Ot={name:"fp-fast-forward"};function Ct(e){const t=document.createElement("div");return t.classList.add("fp-icon",e.name),e.title&&t.setAttribute("title",e.title),e.title&&t.setAttribute("aria-label",e.title),t.setAttribute("tabindex","0"),t.setAttribute("focusable","true"),t}function It(e,t,r){const n=oe("fp-header"),a=oe("fp-primary"),s=oe("fp-duration"),o=function(e,t){const r=oe();r.classList.add("fp-secondary","fp-togglable"),Tt(e,t.root,t);const n=Ct(At);n.setAttribute("role","button"),n.setAttribute("aria-label",t.i18n("core.fullscreen"));const a=Ct(St);return a.setAttribute("role","button"),a.setAttribute("aria-label",t.i18n("core.fullscreen_exit")),n.addEventListener(i,()=>t.toggleFullScreen()),a.addEventListener(i,()=>t.toggleFullScreen()),r.append(n,a),r}(e,r),u={logo:""};r.on(A,(function(e){var t,r,n,i,o;i=s,o=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.duration)||NaN,i.innerText=isFinite(o)?ce(o):"";const l=u.logo,c=(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.logo)||"";l!=c&&(u.logo=c,function(e,t,r){if(e.innerHTML="",!t)return;const n=document.createElement("img");if(n.classList.add("fp-logo"),n.src=t,!r)return e.append(n);const i=document.createElement("a");i.href=r,i.append(n),e.append(i)}(a,c,null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.logo_href))})),n.append(a,s,o),t.append(n),r.reaper&&(r.reaper.set("header",n),r.reaper.set("header.secondary",o))}var xt=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 Pt(e,t,r){if(!r.reaper)return;const n=oe("fp-middle"),s=oe("fp-left-zone"),o=oe("fp-middle-zone"),u=oe("fp-right-zone"),c=[s,o,u];!function(e,t){const r=t[0],n=t[1];e.on(_,(function(){t.forEach(Nt)})),e.on("seek:queued",(function(e){const i=e.data;if(!i)return;if("number"!=typeof i.offset)return;const a=i.offset;if(0==a)return t.forEach(Nt);const s=a>0?n:r;return Nt(s==n?r:n),function(e,t){const r=e.querySelector(".fp-zone-seconds");r&&(r.innerText=Math.abs(t)+"")}(s,a)})),e.on("seek:cancel",(function(){t.forEach(Nt)})),t.forEach((function(t){const n=t==r?-1:1,i=document.createElement("span"),a=Mt(Ot);i.classList.add("fp-zone-seconds"),t.append(i,a),Nt(t),t.addEventListener(l,(function(t){isNaN(e.duration)||isNaN(e.currentTime)||16384&e.opt("ui")||e.hasState("no-timeline")||!e.hasState("will-seek")&&!e.hasState(M)||e.enqueueSeek(5*n)&&(t.stopPropagation(),t.preventDefault())}))}))}(r,[s,u]),c.forEach((function(e){n.append(e)})),r.reaper.set("middle",n),function(e,t){[i,a].forEach(r=>e.addEventListener(r,(function(e){if(!e.defaultPrevented)return e.preventDefault(),t.emit(e.type),!1}))),t.on(i,(function(e){setTimeout((function(){e.defaultPrevented||t.hasState(x)||t.togglePlay()}),0)})),t.on(a,(function(e){setTimeout((function(){e.defaultPrevented||t.toggleFullScreen()}),0)}))}(n,r),function(e){const t=oe("fp-wait");Array(...Array(4)).map((e,t)=>t).forEach(()=>{t.append(document.createElement("b"))}),e.append(t)}(o);const d=oe("fp-switch");return d.append(...[Lt,kt].map(Mt)),o.append(d),t.append(n),n.setAttribute("tabindex","0"),n.setAttribute("role","button"),n.setAttribute("aria-label",r.i18n("core.play")),[g,_].forEach(e=>r.once(e,(function(){n.removeAttribute("tabindex"),n.removeAttribute("role"),n.removeAttribute("aria-label")}))),n}function Mt(e){const t=Ct(e);return t.removeAttribute("tabindex"),t}function Nt(e){const t=e.querySelector(".fp-zone-seconds");t&&(t.innerText="")}function Ft(){}document.addEventListener(i,(function(e){this.active_menu&&!this.active_menu.contains(e.target)&&(Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{const t=e.root.querySelector("details[open].fp-menu-container");t&&(t.open=!1,e.root.classList.toggle("has-menu-opened",!1))}),this.active_menu=void 0)}));const Ut={passive:!0};var Bt;function jt(e,t){let r=0,n=-1,i=-1;const a=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5),s=e.classList;e.id=a,s.remove(Bt.GRABBING),s.remove(Bt.TOUCHING);const o=t.onseek||Ft,u=t.onstart||Ft,c=t.onend||Ft,d=t.onmouse||Ft,f=t.ontouch||Ft,h=t.ontouchend||Ft;function p(t){!function(){const t=e.getBoundingClientRect();r=t.left,n=t.width}();let i=(function(e){return"function"==typeof window.TouchEvent&&e instanceof TouchEvent}(t)?t.changedTouches[0].pageX:t.pageX)-r;return i>n&&(i=n),i<0&&(i=0),i/n*100}function v(t){const r=p(t);r!=i&&(o(e,r),i=r)}return e.addEventListener("touchstart",(function(t){Gt(e,t)&&(s.add(Bt.TOUCHING),Ht(e.parentElement)&&(t.preventDefault(),s.add(Bt.GRABBING),f(e,p(t)),u(e,p(t)),v(t)))}),Ut),e.addEventListener("touchmove",(function(t){t.preventDefault(),v(t),d(e,p(t))}),Ut),e.addEventListener(l,(function(t){setTimeout((function(){s.remove(Bt.TOUCHING)}),500),Gt(e,t)&&(t.preventDefault(),s.remove(Bt.GRABBING),h(e,p(t)),c(e,p(t)),n=0)}),Ut),e.addEventListener("touchcancel",(function(){s.remove(Bt.GRABBING,Bt.TOUCHING),n=0}),Ut),e.addEventListener("mousedown",(function(t){s.contains(Bt.TOUCHING)||(document.addEventListener("mousemove",v),s.add(Bt.GRABBING),u(e,p(t)),t.preventDefault(),v(t))})),e.addEventListener("mousemove",(function(t){s.contains(Bt.TOUCHING)||d(e,p(t))})),document.addEventListener("mouseup",(function(t){s.contains(Bt.TOUCHING)||(document.removeEventListener("mousemove",v),s.contains(Bt.GRABBING)&&(s.remove(Bt.GRABBING),c(e,p(t)),n=0))})),e}function Gt(e,t){const r=t.target;return!!r&&(r&&!r.closest(e.id)||!Ht(e.parentElement)||!e.classList.contains(Bt.TOUCHING))}function Ht(e){if(!e)return!1;const t=window.getComputedStyle(e);return"0"!==t.width&&"0"!==t.height&&"0"!==t.opacity&&"none"!==t.display&&"hidden"!==t.visibility}!function(e){e.GRABBING="has-grab",e.TOUCHING="has-touch"}(Bt||(Bt={}));function Kt(e){if("object"!=typeof e.opts)return{head:0,tail:0};if(0==e.seekable.length)return{head:0,tail:0};const t=e.opt("live_dvr_window",0),r=e.seekable.end(e.seekable.length-1);return{head:r,tail:Math.max(e.seekable.start(0),r-t)}}function Vt(e){return e.opt("live",!1)||e.duration>=Number.MAX_SAFE_INTEGER}function Wt(e){return isFinite(e.duration)?e.duration:0==e.seekable.length?0:e.seekable.end(0)}function qt(e){return function(e){return Kt(e).head}(e)-.5}function Yt(e,t){if(!e.parentElement)return;const r=e.clientWidth/e.parentElement.clientWidth*100/2;e.style.left=t-r+"%",e.style.display="block"}function zt(e,t){if(isNaN(e.duration))return;const r=e.buffered;r.length&&(t.style.width=Math.min(r.end(r.length-1)/e.duration*100,100)+"%")}function Xt(e,t){e.style.width="0",t.style.width="0",t.style.display="none"}function Qt(e,t,r){if(t.seeking||!t.seekable||0==t.seekable.length)return;const n=Jt(t,e/100);Yt(r,e);const i=isFinite(t.duration)?n:t.seekable.start(0)+n;r.innerText=ce(i)}function Jt(e,t){if(t>1||t<0)return console.warn("cannot calculate a percent outside of range(0..1)"),0;if(isFinite(e.duration))return Wt(e)*t;const r=e.seekable.start(0);return r+t*(e.seekable.end(0)-r)}function Zt(e,t){e.style.width="0",t.style.display="none"}const $t=requestAnimationFrame;function er(e,t,r){const n=oe("fp-controls","fp-togglable"),a=oe("fp-timeline","fp-bar"),s=oe("fp-btns","fp-small-switch"),o=oe("fp-live-status"),l=oe("fp-live-indicator","fp-color"),c=oe("fp-live-text"),f=oe("fp-buffer"),p=oe("fp-progress","fp-color"),v=oe("fp-hover"),m=oe("fp-timestamp"),y=oe("fp-duration"),E=oe("fp-dragger","fp-color"),_=document.createElement("span");c.innerHTML="live",m.style.display="none",_.classList.add("fp-elapsed"),_.innerText=ce(0),a.setAttribute("role","slider"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label",r.i18n("timeline","Timeline")),a.append(f,p,v,m),n.append(s,o,_,a,y),o.append(l,c);const T=Ct(Rt);T.setAttribute("role","button");const b=Ct(Dt);b.setAttribute("role","button"),T.addEventListener("click",(function(){r.togglePlay(),setTimeout((function(){b.focus&&b.focus()}),100)})),b.addEventListener("click",(function(){r.togglePlay(),setTimeout((function(){T.focus&&T.focus()}),100)})),s.append(T,b),p.append(E),o.addEventListener(i,(function(){!function(e,t){try{if(!e.hasState(P))return;e.dvr_offset=0;const r=qt(e);e.currentTime=r,e.setState(P,!1),t.style.width="0"}catch(e){console.warn("failed to seek to now: %j",e)}}(r,p)})),r.on(A,(function(t){if(0==r.reaper)return;if(!t.data)return;e.seekable=void 0===t.data.seekable||t.data.seekable;const n=Vt(r)?NaN:t.data.duration||0;if(isNaN(n)||n>=Number.MAX_SAFE_INTEGER)return y.style.display="none";y.style.display="inline-block",y.innerText=ce(n)}));let S=performance.now();const L=()=>{if(0==r.reaper||e.live)return;const t=performance.now();var n;t-S>1e3/30&&(n=r,p.style.width=n.currentTime/n.duration*100+"%",S=t),r.paused||a.classList.contains(Bt.GRABBING)||$t(L)};r.on(g,()=>$t(L)),r.on("timeupdate",(function(){var t;0!=r.reaper&&($t(L),a.setAttribute("aria-valuenow",r.currentTime+""),e.live?function(e,t){t.innerText=ce(e.currentTime)}(r,_):(t=r,_.innerText=ce(t.currentTime)),e.live||zt(r,f),e.live&&function(e){return!("dvr"in e)||1==e.dvr}(e)&&function(e,t){if(0==t)return!0;const r=Kt(e);return r.head-r.tail>=t}(r,e.seconds_to_dvr||0)&&r.setOpts({dvr:r.seekable.length>0}))})),r.on(h,(function(){0!=r.reaper&&(e.live||zt(r,f))})),r.on("live",(function(){r.setState(P,!1),p.style.width="0%"})),r.on("dvr",(function(){const e=Wt(r),t=r.seekable.end(0)-r.seekable.start(0),n=(e-r.currentTime)/t*100,i=Math.round(n);r.setState(P,i>0),p.style.width=i+"%"})),r.on("seeking",(function(){if(!Vt(r))return;if(0==r.seekable.length||0==r.played.length)return;if(0==Wt(r))return;const e=qt(r),t=r.currentTime>=e?"live":"dvr";r.emit(t)})),r.on(d,(function(){var t,n;0!=r.reaper&&(r.setOpts({live:Vt(r)}),e.live||(n=y,(t=r).duration&&(n.innerText=ce(t.duration)),zt(r,f)))})),r.on("durationchange",(function(e){if(0==r.reaper)return;const t=Vt(r),n=t?Wt(r):e.data||r.duration;isNaN(n)||(r.setOpts({live:t,duration:n}),a.setAttribute("aria-valuemax",n+""),a.setAttribute("aria-valuemin","0"))}));let k=!1;return jt(a,{onseek:function(t,n){if(tr(r))switch(!!e.live){case!0:Qt(n,r,m);break;case!1:!function(e,t,r){const n=t.duration*(e/100);if(t.disabled&&n>t.currentTime)return!1;r.style.width=e+"%",t.currentTime=n}(n,r,p),Yt(m,n)}},onstart:function(){tr(r)&&(r.emit("timeline/gesture/start"),r.setState(C,!0),e.live||function(e){!function(e){e.style.display="block"}(e)}(m))},onend:function(t,n){$t(L),0!=e.seekable&&(r.setState(C,!1),e.live&&function(e,t){e/=100,t.currentTime=Jt(t,e)}(n,r))},ontouch:function(){r.paused||(k=!0,r.pause())},ontouchend:function(){k&&(k=!1,r.play()),e.live?Zt(v,m):Xt(v,m)},onmouse:function(t,n){if(tr(r)&&!a.classList.contains(Bt.GRABBING))switch(r.emit("timeline/gesture/move",{percent:n}),!!e.live){case!0:!function(e,t){t.style.width=function(e){return 100-e}(e)+"%"}(n,v),Qt(n,r,m);break;case!1:!function(e,t){t.style.width=e+"%"}(n,v),function(e,t,r){if(isNaN(e)||isNaN(t.duration))return;Yt(r,e),r.innerHTML="";const n=document.createElement("span");n.innerText=ce(e/100*t.duration),r.append(n)}(n,r,m)}}}),a.addEventListener(u,(function(){r.emit("timeline/gesture/end"),e.live?Zt(v,m):Xt(v,m)})),n}function tr(e){return 0!=e.opt("opts.seekable",!0)&&!isNaN(e.duration)}function rr(e){try{return localStorage.getItem(e)}catch(e){return null}}function nr(e,t){try{localStorage.setItem(e,t)}catch(e){}}function ir(e,t,n){const a=document.createElement("div");a.className="fp-volumebtn",a.append(Ct(wt)),n.append(a),a.addEventListener(i,(function(){t.toggleMute()}));const s=!r().ios&&function(e){const t=function(e,t){const r=document.createElement("div");r.className="fp-volume";const n=e.classList;let i=10;n.contains("is-small")&&(i=8);n.contains("is-tiny")&&(i=6);const a=Array.from({length:i}).map(()=>{const e=document.createElement("i");return e.className="fp-tick",e});return r.append(...a),jt(r,{onseek:t})}(e.root,(r,n)=>{n>0&&(e.muted=!1,function(e){try{localStorage.removeItem(e)}catch(e){}}("mute")),nr("volume",(e.volume=n/100).toString()),ar(t,e.volume)});return t.setAttribute("tabindex","0"),t.setAttribute("role","slider"),t.setAttribute("aria-valuemin","0"),t.setAttribute("aria-valuemax","1"),t.setAttribute("aria-label",e.i18n("core.volume","volume")),t}(t);s&&n.append(s),t.on("volumechange",(function(){const e=0==t.volume||t.muted;t.setState("is-muted",e),nr("mute",e.toString()),a.setAttribute("aria-label",e?t.i18n("unmute","unmute"):t.i18n("mute","mute")),s&&(e&&ar(s,0),s.classList.contains(Bt.GRABBING)||ar(s,t.volume))})),"true"==rr("mute")&&(t.muted=!0,t.setState("is-muted",t.muted));const o=rr("volume");o&&!isNaN(Number(o))&&(t.volume=Number(o)),t.emit("volumechange")}function ar(e,t){e.setAttribute("aria-valuenow",t.toString());const r=Array.from(e.querySelectorAll(".fp-tick")),n=Math.round(t*r.length);r.forEach((e,t)=>{e.classList.toggle("fp-color",t<n)})}var sr;function or(e){switch(e){case sr.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case sr.MEDIA_ERR_NETWORK:return"a network error occurred";case sr.MEDIA_ERR_DECODE:return"unable to decode media content";case sr.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case sr.NO_INTERNET:return"no internet connection detected";case sr.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}function ur(){return"https:"===location.protocol}function lr(e){const t=document.createElement("a");return t.href=e,t}function cr(e){try{return!!new URL(e)}catch(e){return!1}}!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"}(sr||(sr={}));const dr=()=>!0===(navigator||{}).onLine;function fr(e,t,r){r.on(n,(function(e){const t=e.data||r.error||new Error,n=e.code||t.code,i="Error: %s\n"+(null===(a=(new Error).stack)||void 0===a?void 0:a.split("\n").slice(2).join("\n"));var a;setTimeout((function(){if(e.defaultPrevented)return;if("AbortError"==t.name)return;r.setState("is-error",!0),8===n||t.fatal||function(e){const t=e.togglePlay,r=e.root;e.togglePlay=Ft,e.once("recover",(function(){e.togglePlay=t,e.setState("is-error",!1);const n=r.querySelector(".fp-error");n&&n.remove()}))}(r);const a=function(e,t,r){switch(t){case"http:0":return function(e){return function(e){try{return ur()&&"http:"==lr(e).protocol}catch(e){return!1}}(e.original_src)?{code:sr.MIXED_CONTENT}:dr()?{code:sr.MEDIA_ERR_NETWORK}:dr()?{code:sr.UNKNOWN}:{code:sr.NO_INTERNET}}(e);case sr.MEDIA_ERR_SRC_NOT_SUPPORTED:return e.once(p,(function(){e.emit("recover")})),r;default:return r}}(r,n,t),s=function(e,t){if(t.message)return t.message;if(t.stack)return t.stack;const r=t.code||-1,n=or(r);return e.i18n("media_errors."+r,n)}(r,a);console.error(i,s);const o=r.reaper&&r.reaper.get("ui");return o&&function(e,t,r,n){if(!e)return;const i=document.createElement("div");if(i.classList.add("fp-error"),i.innerText=t,n){const t=e.querySelector("#"+n);t&&e.removeChild(t),i.id=n}if(e.append(i),r){const e=document.createElement("div");e.classList.add("fp-error-details"),e.innerText=r,i.append(e)}}(o,s,t.details)}))}))}function hr(e,t,r){if(!r.reaper)return;const n=document.createDocumentFragment(),i=oe("fp-ui");n.appendChild(i),r.reaper.set("ui",i),~t.className.indexOf("use-play-")||t.classList.add("use-play-1"),function(e,t,r){const n=oe("fp-footer");t.append(n),r.on(A,(function(e){var t,r;const i=null===(t=e.data)||void 0===t?void 0:t.description,a=null===(r=e.data)||void 0===r?void 0:r.title;if(n.innerHTML="","string"==typeof a){const e=oe("fp-title");e.innerText=a,n.append(e)}if("string"==typeof i){const e=i.split(" "),t=oe("fp-desc");for(t.innerText=e.join(" "),n.append(t);e.length>1&&t.scrollHeight>t.offsetHeight;)e.pop(),t.innerText=e.join(" ")+"..."}}))}(0,t,r),It(e,i,r),Pt(0,i,r);const a=er(e,0,r);i.append(a),ir(0,r,a),fr(0,0,r),t.appendChild(n),[o,u].forEach(e=>{t.addEventListener(e,(function(e){r.setState("is-hovered",e.type==o),r.setState("is-accessibility",!1)}))}),r.on(A,(function(e){var r;const n=null===(r=e.data)||void 0===r?void 0:r.ui;if("number"!=typeof n)return;const i=t.classList;i.toggle("use-play-1",!(32&n||64&n)),i.toggle("use-play-2",(32&n)>0),i.toggle("use-play-3",(64&n)>0),i.toggle("use-thin-controlbar",(128&n)>0),i.toggle("no-title",(256&n)>0),i.toggle("no-description",(512&n)>0),i.toggle("logo-on-right",(8&n)>0),i.toggle("use-drag-handle",(16&n)>0),i.toggle("no-controls",(1024&n)>0),i.toggle("no-duration",(2048&n)>0),i.toggle("no-header",(4096&n)>0),i.toggle("no-mute",(4&n)>0),i.toggle("no-volume",(2&n)>0),i.toggle("no-fullscreen",(1&n)>0),i.toggle("no-touch-zones",(16384&n)>0)}));let s=null;i.addEventListener("mousemove",(function(){"number"==typeof s&&clearTimeout(s),r.setState("is-hovered",!0),s=0==r.paused&&setTimeout((function(){r.setState("is-hovered",!1)}),2e3)}))}function pr(e,t,r){if(Me.from_token(e.token||"").is_granted(Me.permissions.NO_METERING))return;const n=Ie.id(e.token||"");n&&r.once(g,()=>function(e,t){fetch("https://pmi.flowplayer.com/in",{method:"POST",body:JSON.stringify({token_id:t,factor:1,rnd:Math.random().toString(36).substring(2)})}).then(t=>{401==t.status&&e.emit("error:fatal",{reason:"token",details:"The token online validation failed"})})}(r,n))}var vr={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 gr{init(e,t,r){r.reaper&&r.reaper.set("translations",fe(gr,e,"en"))}}gr.en=vr;const mr="rebuffer";var yr=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:mr});const Er=navigator;function _r(e){var t,r;const n=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return n?1e-6*n:(null===(r=Er.connection)||void 0===r?void 0:r.downlink)||-1}function Tr(e,t){return function(e,t){return"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(e,t)}(e,JSON.stringify({events:t}))}const br=pe(),Ar=[];function Sr(e){const t=Ar.slice(0);Ar.length=0,e.logger.log(`:dispatch events={${t.length}}`),Tr("https://health.flowplayer.com/v1/health/events",t)}function Lr(e,t,r){Ar.push(t),e.logger.log(":enqueue",t.event,t),Ar.length<10&&!r||Sr(e)}const kr=(e,t)=>Object.assign(e,{detail:t}),wr=(e,{event:t,media_session_id:r})=>({event:t,media_session_id:r,device_id:e.deviceId(),session_id:br,timestamp:Date.now(),version:"3.0.0-rc6",commit:"ad6acdc4a9531cfb786b26bd1c68dd86bd3151af",preload:e.opt("preload"),autoplay:e.opt("autoplay",e.autoplay),source:e.original_src,downlink_mbs:_r(e),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}),Dr=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 Rr(e,t,r,n){const i=wr(t,{event:r,media_session_id:e.media_session_id}),{before:a,after:s}=n;Lr(e,((e,t,r)=>Object.assign(e,{state:{before:t,after:r}}))(i,Dr(a),Dr(s)))}class Or{constructor(e,t){this.logger=function(e,t){return{log:(...r)=>{const n=e.opt("debug");n&&t.match(n)&&console.log(t,...r)}}}(t,"health"),this.media_session_id=pe(),Or._UNLOAD_SUBSCRIBED||(Or._UNLOAD_SUBSCRIBED=!0,window.addEventListener("unload",()=>{e.instances.forEach(e=>e.emit("unload"))}))}init(e,t,r){!function(e){e.on(m,(function(t){e.seeking||e.networkState===e.NETWORK_LOADING&&e.readyState!==e.HAVE_NOTHING&&e.emit(mr)}))}(r),r.on("health:record",({detail:e})=>{const t=wr(r,{event:e.event,media_session_id:this.media_session_id});Object.assign(t,e.detail||{}),Lr(this,t)}),[y,p,s,d,f,h,m,mr].forEach(e=>{r.on(e,e=>{Lr(this,wr(r,{event:e.type,media_session_id:this.media_session_id}))})}),[g,v,T,_,E].forEach(e=>{r.on(e,e=>{Lr(this,wr(r,{event:e.type,media_session_id:this.media_session_id}))})}),r.on("volumechange",e=>{const t=wr(r,{event:e.type,media_session_id:this.media_session_id});Lr(this,kr(t,{volume:parseFloat(r.volume.toFixed(2)),muted:r.muted}))}),r.on("qualitychange",({type:e,detail:t})=>{switch(t.kind){case"hls":return Rr(this,r,e,t)}}),r.addEventListener(n,e=>{const t=wr(r,{event:e.type,media_session_id:this.media_session_id}),n=e.error||r.error;if(!n)return Lr(this,t,!0);const i=n.code,a={error_message:n.message||or(i),error_code:i,error_stack:n.stack||""};return Lr(this,kr(t,a),!0)}),r.on("src",e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof n)return;if(!cr(r.original_src))return;if(!cr(n))return;if(n==r.original_src)return;this.media_session_id=pe();Lr(this,wr(r,{event:e.type,media_session_id:this.media_session_id})),Sr(this)}),r.on("unload",e=>{Lr(this,wr(r,{event:e.type,media_session_id:this.media_session_id})),Sr(this)})}}Or.events=yr,Or._UNLOAD_SUBSCRIBED=!1,we(window,Or);qe.extensions.unshift.apply(qe.extensions,[gr,Et,Or,class{init(e,t,r){pr(e,0,r),hr(e,t,r),_t(0,t,r)}}]);var Cr=Object.assign(qe,{ui:xt,i18n:gr}),Ir=ze(Xe((function(e,t){var r;"undefined"!=typeof window&&(r=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/dist/",r(r.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":
15
+ ***************************************************************************** */function Q(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function J(e){const t=document.createElement("a");t.href=e;const r=t.pathname&&t.pathname.split(".");return r.length>1&&r[r.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,r=Q(e,["src"]);return[Object.assign({src:t,type:t?Z("video/"+J(t)):""},r)]};function ee(e){return $({src:e})}function te(e){var{src:t,type:r}=e,n=Q(e,["src","type"]);return t&&r?[Object.assign({src:t,type:r},n)]:r&&!t?[Object.assign({type:r},n)]:$(Object.assign({src:t},n))}var re;function ne(e,t,r,n={safari:!1}){const i=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)}(r);return e.currentSrc&&(e.innerHTML=""),Array(...Array(i.length)).map((e,t)=>t).some(r=>{const a=i[r];if(re.Ok==function(e,t,r){e.emit("src",r),"string"==typeof r.src&&(e.original_src=r.src);const n=function(e,t,r){return e.plugins.filter(e=>{return(t=e)&&"wants"in t;var t}).find(e=>e.wants(r.src||"",r,t))}(e,t,r);return n?(n.onload(t,e.root,e,r),re.Ok):re.Err}(e,t,a)||re.Ok==function(e,t,r,n={safari:!1}){/^audio\//.test(r.type||"")&&e.emit("audioonlysource");t.start_time&&(r.src=r.src+"#t="+t.start_time);if(""==e.canPlayType(r.type||""))return re.Err;if(r.drm&&(!r.drm["com.apple.fps.1_0"]||!n.safari))return re.Err;"string"==typeof r.src&&(e.src=r.src);return re.Ok}(e,t,a,n))return!0;r==i.length-1&&"string"==typeof a.src&&(e.src=a.src)}),function(e,t){(function(e,t){if(!e.currentSrc)return;if("none"==e.opt("preload"))return;if(t.autoplay&&t.autoplay>0)return;e.load()})(e,t),"none"==e.opt("preload")&&e.render()}(e,t),e}!function(e){e[e.Err=0]="Err",e[e.Ok=1]="Ok"}(re||(re={}));const ie=[A,S,"src","seek:cancel"];var ae;function se(e,t,r){return isNaN(e.duration)||isNaN(e.currentTime)?{}:(t.offset+=r,0==t.offset?oe(e,t):(t.timer&&clearTimeout(t.timer),t.timer=setTimeout((function(){0!=e.reaper&&(e.currentTime=function(e,t,r=0){return Math.max(Math.min(t,e),r)}(e.currentTime+t.offset,e.duration),t.timer=0,oe(e,t))}),1e3),function(e,t){e.setState("will-seek",!0),e.setState(ae.BACKWARD,t.offset<0),e.setState(ae.FORWARD,t.offset>0)}(e,t),e.emit("seek:queued",t),t))}function oe(e,t){t.timer&&clearTimeout(t.timer),t.timer=t.offset=0,function(e){e.setState(ae.FORWARD,!1),e.setState(ae.BACKWARD,!1),e.setState("will-seek",!1)}(e)}function ue(){if("undefined"==typeof document)return!1;const e=document.documentElement;return e&&"rtl"==e.getAttribute("dir")}function le(...e){const t=document.createElement("div");return 0==e.length||t.classList.add(...e),t}function ce(e,t,r){const n=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;n.length;){if(null==e)return r;const t=n.shift();if("string"!=typeof t)return r;e=e[t]}return null==e?r:e}function de(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}function fe(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const r=Math.floor(e/3600);let n=Math.floor(e/60);return e-=60*n,r>=1?(n-=60*r,t+r+":"+de(n)+":"+de(e)):t+de(n)+":"+de(e)}!function(e){e.FORWARD="forward",e.BACKWARD="backward"}(ae||(ae={}));const he=navigator.languages||[navigator.language];function pe(e,t,r){const n={};return r=t.lang||r,e[r]&&(n[r]=e[r]),function(){try{return he.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().forEach((function(t){e[t]&&!n[t]&&(n[t]=e[t])})),Object.values(n)}const ve=[1e7]+""+-1e3+-4e3+-8e3+-1e11,ge=()=>"undefined"==typeof crypto?"":ve.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));let me="";!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 ye=["touchstart","touchmove"];function Ee(e,t){const r=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(r,"data",{get:()=>t}),r}function _e(e,t,r){const n=Ee(t,r);return e.dispatchEvent(n),e}function Te(e,t,r){const n=Ee(t,r);return e.dispatchEvent(n),n}function be(e,t,r,n){Array.isArray(t)?t.forEach(t=>Se(e,t,r,n)):Se(e,t,r,n)}function Se(e,t,r,n){if(i=t,!~ye.indexOf(i))return e.addEventListener(t,r,n),e;var i;const a=Object.assign(n||{},{passive:!0});return e.addEventListener(t,r,a),e}function Ae(e,t,r,n){return be(e,t,r,Object.assign(n||{},{once:!0}))}const Le={preload:"none",rtl:!1,controls:!0},ke=["loop","muted","preload"];function we(e,n,i){i.toJSON=function(){return{duration:i.duration,volume:i.volume,currentTime:i.currentTime,states:i.root.className}},i.setSrc=function(t){return ne(i,e,t,r())},i.playerState=i.playerState||{},i.setState=function(e,t){if(i.playerState[e]===!!t)return i;const r=Object.assign({},i.playerState,{[e]:t});return r[M]&&(r[R]=!1),i.playerState=r,_e(i,"state",i.playerState),i},i.hasState=function(e){return!!i.playerState[e]},i.transitionState=function(e,t,r){i.hasState(e)&&(r=0),r&&i.setState("is-toggling",!0),i.setState(t,!1),i.setState(e,!0),r&&setTimeout((function(){i.setState("is-toggling",!1)}),r)},i.render=function(e,t){return"string"==typeof e?W.render(e,t):(_e(i,r().ios?h:p),_e(i,_),i)},i.emit=(e,t)=>(_e(i,e,t),i),i.on=(e,t)=>(be(i,e,t),i),i.once=(e,t)=>(Ae(i,e,t),i),i.off=(e,t)=>{var r,n;return r=e,n=t,i.removeEventListener(r,n),i},i.poll=(e,t)=>Te(i,e,t),i.togglePlay=function(t){return Y(i,e,t)},i.toggleMute=function(e){e=null==e?!i.muted:!!e,i.muted=e,i.muted||i.volume||(i.volume=1),_e(i,"volumechange")},i.toggleDisable=function(e){e=null==e?!i.disabled:!!e,i.setState("is-disabled",e),i.disabled=e},i.destroy=function(){i.pause();const e=t.indexOf(i);~e&&t.splice(e,1),setTimeout((function(){i.setSrc([]),i.reaper&&i.reaper.clear(),_e(i,A)}),0)},i.setAttrs=function(e){return ke.forEach(t=>{if(!(t in e))return;const r=e[t];r?i.setAttribute(t,r.toString()):i.removeAttribute(t)}),i},i.opt=function(t,r){return r=void 0===r?ce(Le,t):r,ce(e,t,r)},i.i18n=function(e,t){if(!i.reaper)return"";const r=i.reaper.get("translations");return r?function e(t,r,n,i){return(i=i||0)>=t.length?n:ce(t[i],r,e(t,r,n,i+1))}(r,e,t||""):t||""},i.setOpts=function(t){Object.assign(e,t),"disabled"in t&&void 0!==t.disabled&&i.toggleDisable(t.disabled),"muted"in t&&void 0!==t.muted&&i.toggleMute(t.muted);const r=!!e.autoplay&&!i.hasState("no-autoplay");i.setState("is-autoplay",r),i.setState("is-rtl",i.opt("rtl",function(e){if(!e)return ue();const t=e.getAttribute("dir");return t?"rtl"==t:ue()}(n))),i.setState("is-live",!!e.live),i.setState("no-timeline",!(!e.live||e.dvr)),i.setState("has-poster","string"==typeof e.poster&&e.poster.length>0),i.setState("is-seekable",!!e.seekable),n.style.backgroundImage=i.hasState("has-poster")?"url('"+e.poster+"')":"",_e(i,L,e)},i.renderPlugin=function(e){Te(i,"renderplugin",e).defaultPrevented||i.root.appendChild(e)};const a={offset:0,timer:0};var s,o;o=a,(s=i).on(ie,(function(){oe(s,o)})),i.enqueueSeek=function(e){if(0!=i.opts.seekable&&!(1==i.opts.disabled&&e>0))return se(i,a,e)},i.deviceId=function(){return function(){if(me)return me;try{const e=localStorage.getItem("flowplayer/uuid");if(e)return e;const t=ge();return localStorage.setItem("flowplayer/uuid",t),t}catch(e){return me=ge()}}()}}function De(e,t){const r=t.querySelector("video"),n=r||(e._video_element_callback?e._video_element_callback(e):document.createElement("video"));return n.classList.add("fp-engine"),n.playsInline=!0,r||t.append(n),n}function Re(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const r=e.flowplayer;return"function"==typeof r?(r(t),t):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(t)||r.extensions.push(t),t)}function Oe(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}}const Ce=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function Ie(e,t){return!!~Ce.indexOf(e)||e.indexOf(t)===e.length-t.length}Ie.check_whitelist=function(e){return!!~Ce.indexOf(e)};const xe="production";function Pe(e,t){const r={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let n={c:"{}",exp:0};t=t||{};try{n=V(e),r.valid_jwt=!0}catch(e){}return r.raw=e,r.data=JSON.parse(n.c),r.exp=n.exp,t.require_valid_token&&Pe.validate(r),r}function Me(e){try{return Pe.validate(e),{success:!0,message:""}}catch(e){return{success:!1,message:e.message}}}var Ne;function Fe(e){return{grant:e,is_granted:t=>(e&t)===t}}function Ue(e,t,r){t&&t.destroy(),console.error(new Error(r.details||r.reason)),e.innerHTML="",e.classList.remove("flowplayer"),e.classList.add("flowplayer-fatal"),e.innerHTML='\n <h2>Playback Error</h2>\n <p>Are you the site owner?</p>\n <a class="troubleshoot" target="_blank" href="https://flowplayer.com/help/developers/troubleshooting">Troubleshoot?</a>\n <img src=""https://flowplayer.com/user/pages/images/logo-white.png""/>\n '}function Be(e,t){const r=t.clientWidth;t.classList.toggle("is-small",r<600),t.classList.toggle("is-tiny",r<400)}function je(e,t,n){let i=!0;t.classList.add("flowplayer"),Be(0,t),be(n,[g,c],(function(){Be(0,t)})),be(n,"state",(function(){Object.entries(n.playerState).forEach((function([e,r]){t.classList.toggle(e,r)}))})),be(n,"timeupdate",(function(){n.setState(M,!1)})),be(n,L,(function(){const r=n.paused&&(!e.autoplay||t.classList.contains("no-autoplay"))&&0==n.currentTime;[C,I].forEach((function(e){n.setState(e,r)}))})),be(n,T,(function(t){setTimeout((function(){t.defaultPrevented||(e.rewind&&!n.loop&&(e.autoplay&&(e.autoplay=0,n.setState("is-autoplay",!1)),n.setState(x,!0),Ae(n,b,(function(){n.setState(x,!1),n.pause(),n.setState(I,!0)})),n.currentTime=0),Ae(n,"timeupdate",(function(){n.setState(P,!1)})),n.transitionState(P,R,e.loop||e.rewind?0:300))}),0)})),be(n,[S,b],(function(e){n.setState(x,e.type==S),n.setState(O,n.paused),n.setState(R,!n.paused)})),be(n,T,(function(){n.setState(R,!1),i=!0})),be(n,r().ios?h:p,(function(e){const t="src"!=e.type||"none"!==n.opt("preload");n.setState("is-loaded",t),n.setState(C,!t)})),be(n,[E,_,g],(function(t){if(!n.hasState(x)&&(t.type!=_||e.autoplay||n.setState(M,!1),t.type!=g||"none"!=n.opt("preload")||e.autoplay)){if(t.type==g&&e.autoplay)return Ae(n,y,(function(){n.setState(M,!1)}));t.type==E&&[R,O,I].forEach((function(e){n.setState(e,!1)})),n.setState(P,!1),n.setState(M,t.type==E)}})),be(n,[y,m],(function(t){setTimeout(()=>{const e=new CustomEvent("flowplayer/"+t.type,{detail:n});document.dispatchEvent(e)},0);const r=t.type==y,a=n.currentTime==n.duration,s=r&&i&&e.autoplay||n.hasState(M);if(r&&(n.started=!0,i=!1),n.setState(M,!1).setState(I,!1),a||n.hasState(x))return;const o=r?R:O,u=r?O:R;n.transitionState(o,u,s?0:300),r&&n.setState("no-autoplay",!1)}))}function Ge(e){const t=function(e){const t=e.getBoundingClientRect(),r=window.innerHeight,n=t.height,i=t.bottom,a=n/5;return t.top<=a&&t.top+n>r-a||i-n+a>=0&&i<r+a}(e.root);return e.in_viewport===t||(e.in_viewport=t,_e(e,t?"viewenter":"viewleave")),e}function He(e,r,n){Ge(n);const a={should_resume:!!e.autoplay,has_user_gesture:!1,locked:!1};[l,i].forEach(e=>Ae(n,e,()=>a.has_user_gesture=!0)),be(n,"play",(function(){a.locked||(a.should_resume=!0)})),be(n,m,(function(){a.locked||(a.should_resume=!1)})),be(n,_,(function(r){!e.autoplay||t.filter((function(e){return!e.paused})).length&&!e.multiplay||n.in_viewport&&n.paused&&a.should_resume&&n.togglePlay(!0)})),e.autopause&&(be(n,"viewenter",(function(){a.should_resume&&n.togglePlay(!0)})),be(n,"viewleave",(function(){const e=!n.paused;a.locked=!0,n.pause(),setTimeout((function(){a.should_resume=e,a.locked=!1}),0)})))}Pe.validate=function(e){if("string"==typeof e&&(e=Pe(e)),!e||!e.raw){if(Ie.check_whitelist(window.location.hostname)||"dev"===xe.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,r=Ie.bind(null,t);if("dev"!==xe.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(r))throw new Error("Domain not allowed");if("dev"!==xe.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},Pe.id=function(e){if(e)return"string"==typeof e&&(e=Pe(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"}(Ne||(Ne={})),Fe.of=Fe,Fe.from_token=function(e){const t=Pe(e,{require_valid_token:!0});return Fe.of(t.data.acl)},Fe.permissions=Ne,[s,c].forEach(e=>{window.addEventListener(e,(function(){t.forEach((function(e){const t=e.root;t.prevWidth!=t.clientWidth&&(_e(e,c),t.prevWidth=t.clientWidth)}))}))}),window.addEventListener("scroll",(function(){t.forEach(Ge)}));function Ke(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,r){const n=document.createElement("div");n.classList.add("fp-ratio"),t.append(n);let i=Ke(e.ratio||.5625);n.style.paddingTop=100*i+"%";const a=[p,h];r.on(a,(function(){const e=r.videoHeight&&r.videoWidth&&r.videoHeight/r.videoWidth;e&&r.setOpts({ratio:e})})),r.on(L,(function(){const t=r.videoHeight&&r.videoWidth&&r.videoHeight/r.videoWidth,a=Ke((null==e?void 0:e.ratio)||t||.5625);i!==a&&(i=a,n.style.paddingTop=100*a+"%")}))}const We="flowplayer/"+y;function qe(e){const t=t=>{t.detail!==e&&!e.opt("multiplay")&&e.pause()};e.on(A,()=>document.removeEventListener(We,t)),document.addEventListener(We,t)}const Ye=function(){const e=Oe(),t=e.flowplayer?e.flowplayer:{extensions:[]};return Array.isArray(t.extensions)||(t.extensions=[]),t}();function ze(r,n){if("function"==typeof r)return e.push(...[...arguments].filter(e=>"function"==typeof e)),ze;"string"==typeof n&&(n={src:n}),n||(n={}),n.token||"string"!=typeof window.__FLOWPLAYER_TOKEN||(n.token=window.__FLOWPLAYER_TOKEN);const i="string"==typeof r?document.querySelector(r):r;if(!i)return console.error(new Error("Flowplayer: '"+r.toString()+"' not found"));const a=i.querySelector("video.fp-engine");if(a)return a;const s=Me(n.token);if(!s.success)return Ue(i,null,{reason:"token",details:s.message});const o=new Map,u=De(n,i);if(u.reaper=o,Object.defineProperty(u,"token",{value:"string"==typeof n.token?Pe.id(n.token):"",writable:!1}),u.addEventListener(A,()=>{o.clear(),u.reaper=0,delete u.root}),u.root=i,n.token&&Fe.from_token(n.token).is_granted(Fe.permissions.DEVELOPER_PLAN))return Ue(i,null,{reason:"developer_plan",details:"Using developer plan tokens is not currently supported"});!~t.indexOf(u)&&t.push(u),we(n,i,u),u.setAttrs(n),u.plugins=ze.extensions.map(e=>new e(ze,u)),je(n,i,u),He(n,0,u),Ve(n,i,u),qe(u),u.plugins.forEach(e=>{try{e.init(n,i,u)}catch(t){console.log("Error(plugin/%s)",e.constructor.name,t)}}),u.setOpts(n),u.opts=n,n.src&&u.setSrc(n.src);const l=u.readyState;return l>0&&u.currentSrc&&u.emit(h),l>2&&u.currentSrc&&u.emit(_),"none"==u.opt("preload")&&u.paused&&u.currentSrc&&u.render(),u.emit("mount"),u.on("error:fatal",(function(e){Ue(i,u,e.data||{})})),u}Object.assign(ze,Ye),function(n){Array.isArray(n.extensions)&&n.extensions.forEach(t=>e.push(t)),n.components=W,n.version="3.0.0-rc6",n.commit="7e4127eb89f3f663206df10d63e302b72236f0be",n.instances=t,n.extensions=e,n.support=r,n.events=D,n.states=U,n.jwt=V,n.autoplay=K,n.quality=q}(ze),"object"==typeof document&&setTimeout(_e,0,document,"flowplayer:umd",ze);var Xe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Qe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Je(e){var t={exports:{}};return e(t,t.exports),t.exports}var Ze=Je((function(e,t){var r=Xe&&Xe.__assign||function(){return(r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};t.__esModule=!0,t.remove=t.downcase=t.pluck=t.merge=void 0,t.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return r(r({},e),t)}),{})},t.pluck=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return Object.keys(e).filter((function(e){return~r.indexOf(e)})).reduce((function(r,n){var i;return t.merge(r,((i={})[n]=e[n],i))}),{})},t.downcase=function(e){return(e||"").toString().toLowerCase()},t.remove=function(e,t){var r=e.lastIndexOf(t);return~r&&e.splice(r,1),e}})),$e=Je((function(e,t){var r=Xe&&Xe.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=Xe&&Xe.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=Xe&&Xe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&r(t,e,i);return n(t,e),t};t.__esModule=!0;var a=i(Ze),s=function(){function e(){this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return e.of=function(){return new e},e.is_empty=function(e){return 0==e.pending.length},e.is_high_water=function(t){return t.open.length==e.MAX_OPEN_REQUESTS},e.maybe_spawn_req=function(t){if(e.is_empty(t))return t;if(e.is_high_water(t))return t;try{var r=e.lpop(t);r&&e.request(t,r)}catch(e){}},e.increment_failures=function(t){return t.stats.failures++,t.stats.failures>e.MAX_FAILURE_COUNT&&(t.stats.ttl=Date.now()+e.REQUEST_TTL_MS),t},e.handle_error=function(t,r){e.rm(t,r),e.increment_failures(t)},e.request=function(t,r){var n=r[0],i=r[1],a=r[2];if(!(Date.now()<t.stats.ttl)){var s=new XMLHttpRequest;t.open.push(s),s.timeout=e.REQUEST_TIMEOUT_MS,s.ontimeout=function(){e.handle_error(t,s)},s.onerror=function(r){e.handle_error(t,s)},s.onreadystatechange=function(){s.readyState==XMLHttpRequest.DONE&&e.rm(t,s),Math.floor(s.status/100)},s.onload=function(){e.rm(t,s),t.stats.failures&&t.stats.failures--},s.open(i,n),s.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{s.send(JSON.stringify(a))}catch(e){}}},e.rpush=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return r.forEach((function(r){t.pending.length>=e.MAX_PENDING||(t.pending.push(r),e.maybe_spawn_req(t))})),t},e.lpop=function(e){return e.pending.shift()},e.rm=function(e,t){return a.remove(e.open,t),e},e.MAX_OPEN_REQUESTS=3,e.MAX_PENDING=5,e.REQUEST_TIMEOUT_MS=4e3,e.REQUEST_TTL_MS=5e3,e.MAX_FAILURE_COUNT=3,e}();t.default=s})),et=Je((function(e,t){var r=Xe&&Xe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var n=r($e);t.default=n.default.of()})),tt=Je((function(e,t){t.__esModule=!0,t.prepare_url=t.URL_PARAM=void 0,t.URL_PARAM=/:([a-zA-Z_]+)/g,t.prepare_url=function(e,r){return e.url.replace(t.URL_PARAM,(function(t){if((t=t.slice(1,t.length))in r)return r[t].toString();e.log.error(new Error("\n preparing url["+e.url+"] failed\n \n parameter["+t+"] not detected in params:\n \n "+JSON.stringify(r,null,2)+"\n "))}))}})),rt=Je((function(e,t){t.__esModule=!0,t.Log=void 0;var r=function(){function e(e){this.emitter=e}return e.prepare=function(e,t){var r=document.createEvent("Event");return r.initEvent(e,!1,!0),r.ns=e,r.data=t,r},e.of=function(t){return new e(t)},e.prototype.info=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.INFO,t))},e.prototype.error=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.ERROR,t))},e.prototype.warn=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.WARN,t))},e.NAMESPACE={INFO:"tracker:info",ERROR:"tracker:err",WARN:"tracker:warn"},e}();t.Log=r})),nt=Je((function(e,t){var r;t.__esModule=!0,t.Verb=void 0,(r=t.Verb||(t.Verb={})).POST="POST",r.PUT="PUT",r.GET="GET"})),it=Je((function(e,t){var r=Xe&&Xe.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=Xe&&Xe.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=Xe&&Xe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&r(t,e,i);return n(t,e),t},a=Xe&&Xe.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var a=arguments[t],s=0,o=a.length;s<o;s++,i++)n[i]=a[s];return n},s=Xe&&Xe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var o=s(et),u=s($e),l=i(tt),c=i(Ze),d=function(){function e(t,r){var n=this;void 0===r&&(r={});var i=this;if(this.emitter=t,this.url=r.url,this.log=rt.Log.of(this.emitter),this.verb=r.verb,this.metadata=c.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),e.assert_emitter_api(this.emitter),void 0===e.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");e.TRACKERS.push(this),i.events.forEach((function(t){e.create_listener(n,t,(function(r){void 0===r&&(r={});var a=c.merge(i.metadata,{event_type:t},r.data||r),s=l.prepare_url(i,a),o=e.pluck_valid_keys(i,a),d=e.ensure_required_keys(i,o);if(d.length)return i.log.error("Tracker.validate_metadata() failed for \n Event["+t+"]\n missing keys: "+d+"\n payload:\n "+JSON.stringify(o,null,2));u.default.rpush(n.rq,[s,n.verb,o])}))}))}return e.of=function(t,r){return new e(t,r)},e.ensure_required_keys=function(e,t){return e.required_keys.filter((function(e){return!(e in t)}))},e.pluck_valid_keys=function(e,t){return c.pluck.apply(c,a([t],e.valid_keys))},e.merge_metadata=function(t,r){return void 0===r&&(r={}),t.metadata=e.pluck_valid_keys(t,c.merge(t.metadata,r)),t},e.assert_emitter_api=function(e){if("function"!=typeof(e||{}).addEventListener)throw new Error("Tracker() received an emitter that does not implement the addEventListener method");if("function"!=typeof(e||{}).removeEventListener)throw new Error("Tracker() received an emitter that does not implement the removeEventListener method")},e.create_listener=function(e,t,r){e.listeners.push([t,r]),e.emitter.addEventListener(t,r)},e.prototype.destroy=function(){var t=this;this.listeners.forEach((function(e){var r=e[0],n=e[1];return t.emitter.removeEventListener(r,n)})),delete this.rq,delete this.emitter,c.remove(e.TRACKERS,this)},e.prototype.put=function(t){return void 0===t&&(t={}),e.merge_metadata(this,t),this},e.TRACKERS=[],e.QUEUE=o.default,e.verb=nt.Verb,e}();t.default=d})),at=Je((function(e,t){var r=Xe&&Xe.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=Xe&&Xe.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=Xe&&Xe.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&r(t,e,i);return n(t,e),t},a=Xe&&Xe.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0,t.API=t.Tracker=void 0;var s=a(it);t.Tracker=s.default;var o=i(tt);t.API=o})),st="ping",ot="display",ut="view";const lt=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],ct=["created","position"],dt=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];function ft(e,t){return e.duration/1===e.duration&&Object.assign(t,function(e){const t=e/100;return{segment_duration:t,breakpoints:Array(...Array(100)).map((function(e,r){return Math.floor(r*t*1e3)/1e3}))}}(e.duration))}function ht(e,t,r){if(!t.segment_duration&&!ft(e,t))return;const n=function(e,t,r){const n=t.last_idx,i=r?99:pt(e,t);return t.last_idx=i,i<=n?[]:t.breakpoints.slice(n,99==i?100:i).map((function(e){return t.breakpoints.indexOf(e)}))}(e,t,r);0!=n.length&&e.emit(st,{position:n})}function pt(e,t){return Math.min(Math.floor(e.currentTime/t.segment_duration),99)}const vt="vod",gt="live",mt=[ot,st,ut];function yt(e,t,r){switch(null==t?void 0:t.kind){case"live":return function(e,t){const r=Date.now();r-t.last_tracked_ts<6e4||(t.last_tracked_ts=r,++t.ticks,e.emit(st,{position:60*t.ticks}))}(e,t);case"vod":return ht(e,t,"boolean"==typeof r&&r)}}function Et(e){const t=e.ads;return void 0!==t&&(void 0!==t.schedule&&("function"==typeof t.hasPreroll&&(t.currentRequests?t.currentRequests:!!t.adPlaying||!(!t.hasPreroll()||0!=t.nextIndex))))}function _t(){try{return window.location!==window.parent.location?document.referrer:document.location.href}catch(e){return!1}}class Tt{init(e,t,r){if(!Fe.from_token(e.token||"").is_granted(Fe.permissions.ANALYTICS))return;if(r.analytics)return;const n=r.analytics={ticker:void 0,last_media_id:"",ended:!1},i={locked:!1,ttl:6e3,task:()=>{yt(r,n.ticker)}};const a={session_id:r.deviceId(),autoplay:r.autoplay,muted:r.muted,player_id:e.player_id,customer_user_id:e.customer_user_id},s=at.Tracker.of(r,{verb:at.Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:mt,required_keys:lt,optional_keys:dt.concat(ct).slice(0),metadata:a});r.on(A,(function(){s&&s.destroy()})),r.on(L,(function(t){if(!s)return;const i=ce(t,"data.metadata",{});if(!i.media_id)return;const a=ce(s,"metadata.media_id");if(a&&i.media_id==a)return;const o=ce(e,"analytics",{});s.put(i),s.put(o);const u=ce(e,"metadata.live_start_time",e.live)?gt:vt;s.put({video_type:u,source:e.source||_t()||""}),n.ticker=e.live?{ticks:0,last_tracked_ts:Date.now(),kind:"live"}:{last_idx:0,segment_duration:0,breakpoints:[],kind:"vod"},n.ended=!1,r.emit(ot)}));let o=0;r.on(y,(function(){if(!s)return;if(o||function(e,t){return e.metadata.media_id&&e.metadata.media_id==t.last_media_id}(s,n))return;s.put({muted:r.muted});const e=Et(r);if(e)return o=Promise.resolve(e).then((function(){n.last_media_id=s.metadata.media_id,r.emit(ut),o=0})).catch((function(){o=0}));n.last_media_id=s.metadata.media_id,r.emit(ut)})),r.on("timeupdate",(function(){var t;s&&(o||Et(r)||n.ended||(!e.live&&r.currentTime+.25>=r.duration&&yt(r,n.ticker,!0),(t=i).locked||(t.locked=setTimeout((function(){return t.task(),function(e){return e.locked=!1,e}(t)}),t.ttl))))})),r.on(b,(function(){s&&n.ticker&&"vod"==n.ticker.kind&&function(e,t){ft(e,t),t.last_idx=pt(e,t)}(r,n.ticker)})),r.on(T,(function(){s&&function(e,t){t.ended||(t.ended=!0,yt(e,t.ticker))}(r,n)}))}}function bt(e,t,r){!function(e,t,r){"undefined"!=typeof window&&"ontouchstart"in window&&r.setState("is-touch-device",!0);let n=!1;r.setState("is-accessibility",!1);const i=t.querySelector(".fp-middle");i&&i.addEventListener(l,(function(e){0!=e.cancelable&&(e.preventDefault(),r.emit(e.type,{source:e}))})),r.on(l,(function(e){setTimeout((function(){if(e.defaultPrevented)return;if(r.hasState(M))return;if(r.ended)return r.togglePlay(!0);const t=r.hasState(I);n&&clearTimeout(n),(t||r.hasState(F)||r.hasState("no-autoplay"))&&(r.hasState(F)&&(r.setState(F,!1),r.setState("is-hovered",!1)),r.togglePlay(),t)||(r.setState(F,!0),r.paused||(n=setTimeout((function(){n=!1,r.setState(F,!1),r.setState("is-hovered",!1)}),2e3)))}),0)}))}(0,t,r)}function St(e,t,r){let n=()=>document.fullscreenElement,i="fullscreenchange";if(!Element.prototype.requestFullscreen){const e=Element.prototype,t=document;e.webkitRequestFullScreen&&(e.requestFullscreen=e.webkitRequestFullScreen,t.fullscreenEnabled=!0),t.webkitCancelFullScreen&&(document.exitFullscreen=t.webkitCancelFullScreen),i="webkit"+i,n=()=>t.webkitCurrentFullScreenElement}r.toggleFullScreen=function(e,n){r.ios_fullscreen_disabled||("boolean"!=typeof e&&(e=!r.in_fullscreen),At(r)&&(e?function(e){e.getAttribute("playsinline")&&e.removeAttribute("playsinline");e.getAttribute("webkit-playsinline")&&e.removeAttribute("webkit-playsinline");e.webkitEnterFullScreen()}(r):function(e,t){e.getAttribute("playsinline")||e.setAttribute("playsinline","");e.getAttribute("webkit-playsinline")||e.setAttribute("webkit-playsinline","");t||e.webkitExitFullScreen();e.togglePlay(!1),e.hasState(F)||e.setState(F,!0)}(r,n)),document.fullscreenEnabled&&(e?t.requestFullscreen():document.exitFullscreen()))},At(r)&&(r.ios_fullscreen_disabled=!0,r.once("beforeplay",(function(){r.ios_fullscreen_disabled=!1})),r.on("webkitendfullscreen",(function(){r.toggleFullScreen(!1,!0)}))),t.addEventListener(i,(function(){const e=n(),i=e===t||e==r;r.in_fullscreen=i,r.emit(i?d:f),r.setState("is-fullscreen",i),r.emit(c)})),!1!==e.doubleclick&&t.addEventListener(a,(function(e){var t;e.target&&(null===(t=e.target)||void 0===t?void 0:t.classList.contains("fp-ui"))&&r.toggleFullScreen()}))}function At(e){return r().ios&&"function"==typeof e.webkitEnterFullScreen&&"function"==typeof e.webkitExitFullScreen}Re(Oe(),Tt),"undefined"!=typeof window&&window.matchMedia&&[k,w].forEach((function(e){window.matchMedia("(orientation: "+e+")").addListener((function(r){t.length&&t.forEach((function(t){r.matches&&t.emit(e)}))}))}));const Lt={name:"fp-fullscreen",translation_key:"core.fullscreen"},kt={name:"fp-fullscreen-exit",translation_key:"core.exit_fullscreen"},wt={name:"fp-play",translation_key:"core.play"},Dt={name:"fp-pause",translation_key:"core.pause"},Rt={translation_key:"core.mute",name:"fp-volume-mute-unmute"},Ot={translation_key:"core.play",name:"fp-small-play"},Ct={translation_key:"core.pause",name:"fp-small-pause"},It={name:"fp-fast-forward"};function xt(e){const t=document.createElement("div");return t.classList.add("fp-icon",e.name),e.title&&t.setAttribute("title",e.title),e.title&&t.setAttribute("aria-label",e.title),t.setAttribute("tabindex","0"),t.setAttribute("focusable","true"),t}function Pt(e,t,r){const n=le("fp-header"),a=le("fp-primary"),s=le("fp-duration"),o=function(e,t){const r=le();r.classList.add("fp-secondary","fp-togglable"),St(e,t.root,t);const n=xt(Lt);n.setAttribute("role","button"),n.setAttribute("aria-label",t.i18n("core.fullscreen"));const a=xt(kt);return a.setAttribute("role","button"),a.setAttribute("aria-label",t.i18n("core.fullscreen_exit")),n.addEventListener(i,()=>t.toggleFullScreen()),a.addEventListener(i,()=>t.toggleFullScreen()),r.append(n,a),r}(e,r),u={logo:""};r.on(L,(function(e){var t,r,n,i,o;i=s,o=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.duration)||NaN,i.innerText=isFinite(o)?fe(o):"";const l=u.logo,c=(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.logo)||"";l!=c&&(u.logo=c,function(e,t,r){if(e.innerHTML="",!t)return;const n=document.createElement("img");if(n.classList.add("fp-logo"),n.src=t,!r)return e.append(n);const i=document.createElement("a");i.href=r,i.append(n),e.append(i)}(a,c,null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.logo_href))})),n.append(a,s,o),t.append(n),r.reaper&&(r.reaper.set("header",n),r.reaper.set("header.secondary",o))}var Mt=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 Nt(e,t,r){if(!r.reaper)return;const n=le("fp-middle"),s=le("fp-left-zone"),o=le("fp-middle-zone"),u=le("fp-right-zone"),c=[s,o,u];!function(e,t){const r=t[0],n=t[1];e.on(b,(function(){t.forEach(Ut)})),e.on("seek:queued",(function(e){const i=e.data;if(!i)return;if("number"!=typeof i.offset)return;const a=i.offset;if(0==a)return t.forEach(Ut);const s=a>0?n:r;return Ut(s==n?r:n),function(e,t){const r=e.querySelector(".fp-zone-seconds");r&&(r.innerText=Math.abs(t)+"")}(s,a)})),e.on("seek:cancel",(function(){t.forEach(Ut)})),t.forEach((function(t){const n=t==r?-1:1,i=document.createElement("span"),a=Ft(It);i.classList.add("fp-zone-seconds"),t.append(i,a),Ut(t),t.addEventListener(l,(function(t){isNaN(e.duration)||isNaN(e.currentTime)||16384&e.opt("ui")||e.hasState("no-timeline")||!e.hasState("will-seek")&&!e.hasState(F)||e.enqueueSeek(5*n)&&(t.stopPropagation(),t.preventDefault())}))}))}(r,[s,u]),c.forEach((function(e){n.append(e)})),r.reaper.set("middle",n),function(e,t){[i,a].forEach(r=>e.addEventListener(r,(function(e){if(!e.defaultPrevented)return e.preventDefault(),t.emit(e.type),!1}))),t.on(i,(function(e){setTimeout((function(){e.defaultPrevented||t.hasState(M)||t.togglePlay()}),0)})),t.on(a,(function(e){setTimeout((function(){e.defaultPrevented||t.toggleFullScreen()}),0)}))}(n,r),function(e){const t=le("fp-wait");Array(...Array(4)).map((e,t)=>t).forEach(()=>{t.append(document.createElement("b"))}),e.append(t)}(o);const d=le("fp-switch");return d.append(...[wt,Dt].map(Ft)),o.append(d),t.append(n),n.setAttribute("tabindex","0"),n.setAttribute("role","button"),n.setAttribute("aria-label",r.i18n("core.play")),[y,b].forEach(e=>r.once(e,(function(){n.removeAttribute("tabindex"),n.removeAttribute("role"),n.removeAttribute("aria-label")}))),n}function Ft(e){const t=xt(e);return t.removeAttribute("tabindex"),t}function Ut(e){const t=e.querySelector(".fp-zone-seconds");t&&(t.innerText="")}function Bt(){}document.addEventListener(i,(function(e){this.active_menu&&!this.active_menu.contains(e.target)&&(Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{const t=e.root.querySelector("details[open].fp-menu-container");t&&(t.open=!1,e.root.classList.toggle("has-menu-opened",!1))}),this.active_menu=void 0)}));const jt={passive:!0};var Gt;function Ht(e,t){let r=0,n=-1,i=-1;const a=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5),s=e.classList;e.id=a,s.remove(Gt.GRABBING),s.remove(Gt.TOUCHING);const o=t.onseek||Bt,u=t.onstart||Bt,c=t.onend||Bt,d=t.onmouse||Bt,f=t.ontouch||Bt,h=t.ontouchend||Bt;function p(t){!function(){const t=e.getBoundingClientRect();r=t.left,n=t.width}();let i=(function(e){return"function"==typeof window.TouchEvent&&e instanceof TouchEvent}(t)?t.changedTouches[0].pageX:t.pageX)-r;return i>n&&(i=n),i<0&&(i=0),i/n*100}function v(t){const r=p(t);r!=i&&(o(e,r),i=r)}return e.addEventListener("touchstart",(function(t){Kt(e,t)&&(s.add(Gt.TOUCHING),Vt(e.parentElement)&&(t.preventDefault(),s.add(Gt.GRABBING),f(e,p(t)),u(e,p(t)),v(t)))}),jt),e.addEventListener("touchmove",(function(t){t.preventDefault(),v(t),d(e,p(t))}),jt),e.addEventListener(l,(function(t){setTimeout((function(){s.remove(Gt.TOUCHING)}),500),Kt(e,t)&&(t.preventDefault(),s.remove(Gt.GRABBING),h(e,p(t)),c(e,p(t)),n=0)}),jt),e.addEventListener("touchcancel",(function(){s.remove(Gt.GRABBING,Gt.TOUCHING),n=0}),jt),e.addEventListener("mousedown",(function(t){s.contains(Gt.TOUCHING)||(document.addEventListener("mousemove",v),s.add(Gt.GRABBING),u(e,p(t)),t.preventDefault(),v(t))})),e.addEventListener("mousemove",(function(t){s.contains(Gt.TOUCHING)||d(e,p(t))})),document.addEventListener("mouseup",(function(t){s.contains(Gt.TOUCHING)||(document.removeEventListener("mousemove",v),s.contains(Gt.GRABBING)&&(s.remove(Gt.GRABBING),c(e,p(t)),n=0))})),e}function Kt(e,t){const r=t.target;return!!r&&(r&&!r.closest(e.id)||!Vt(e.parentElement)||!e.classList.contains(Gt.TOUCHING))}function Vt(e){if(!e)return!1;const t=window.getComputedStyle(e);return"0"!==t.width&&"0"!==t.height&&"0"!==t.opacity&&"none"!==t.display&&"hidden"!==t.visibility}!function(e){e.GRABBING="has-grab",e.TOUCHING="has-touch"}(Gt||(Gt={}));function Wt(e){if("object"!=typeof e.opts)return{head:0,tail:0};if(0==e.seekable.length)return{head:0,tail:0};const t=e.opt("live_dvr_window",0),r=e.seekable.end(e.seekable.length-1);return{head:r,tail:Math.max(e.seekable.start(0),r-t)}}function qt(e){return e.opt("live",!1)||e.duration>=Number.MAX_SAFE_INTEGER}function Yt(e){return isFinite(e.duration)?e.duration:0==e.seekable.length?0:e.seekable.end(0)}function zt(e){return function(e){return Wt(e).head}(e)-.5}function Xt(e,t){if(!e.parentElement)return;const r=e.clientWidth/e.parentElement.clientWidth*100/2;e.style.left=t-r+"%",e.style.display="block"}function Qt(e,t){if(isNaN(e.duration))return;const r=e.buffered;r.length&&(t.style.width=Math.min(r.end(r.length-1)/e.duration*100,100)+"%")}function Jt(e,t){e.style.width="0",t.style.width="0",t.style.display="none"}function Zt(e,t,r){if(t.seeking||!t.seekable||0==t.seekable.length)return;const n=$t(t,e/100);Xt(r,e);const i=isFinite(t.duration)?n:t.seekable.start(0)+n;r.innerText=fe(i)}function $t(e,t){if(t>1||t<0)return console.warn("cannot calculate a percent outside of range(0..1)"),0;if(isFinite(e.duration))return Yt(e)*t;const r=e.seekable.start(0);return r+t*(e.seekable.end(0)-r)}function er(e,t){e.style.width="0",t.style.display="none"}const tr=requestAnimationFrame;function rr(e,t,r){const n=le("fp-controls","fp-togglable"),a=le("fp-timeline","fp-bar"),s=le("fp-btns","fp-small-switch"),o=le("fp-live-status"),l=le("fp-live-indicator","fp-color"),c=le("fp-live-text"),d=le("fp-buffer"),f=le("fp-progress","fp-color"),p=le("fp-hover"),g=le("fp-timestamp"),m=le("fp-duration"),E=le("fp-dragger","fp-color"),_=document.createElement("span");c.innerHTML="live",g.style.display="none",_.classList.add("fp-elapsed"),_.innerText=fe(0),a.setAttribute("role","slider"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label",r.i18n("timeline","Timeline")),a.append(d,f,p,g),n.append(s,o,_,a,m),o.append(l,c);const T=xt(Ct);T.setAttribute("role","button");const b=xt(Ot);b.setAttribute("role","button"),T.addEventListener("click",(function(){r.togglePlay(),setTimeout((function(){b.focus&&b.focus()}),100)})),b.addEventListener("click",(function(){r.togglePlay(),setTimeout((function(){T.focus&&T.focus()}),100)})),s.append(T,b),f.append(E),o.addEventListener(i,(function(){!function(e,t){try{if(!e.hasState(N))return;e.dvr_offset=0;const r=zt(e);e.currentTime=r,e.setState(N,!1),t.style.width="0"}catch(e){console.warn("failed to seek to now: %j",e)}}(r,f)})),r.on(L,(function(t){if(0==r.reaper)return;if(!t.data)return;e.seekable=void 0===t.data.seekable||t.data.seekable;const n=qt(r)?NaN:t.data.duration||0;if(isNaN(n)||n>=Number.MAX_SAFE_INTEGER)return m.style.display="none";m.style.display="inline-block",m.innerText=fe(n)}));let S=performance.now();const A=()=>{if(0==r.reaper||e.live)return;const t=performance.now();var n;t-S>1e3/30&&(n=r,f.style.width=n.currentTime/n.duration*100+"%",S=t),r.paused||a.classList.contains(Gt.GRABBING)||tr(A)};r.on(y,()=>tr(A)),r.on("timeupdate",(function(){var t;0!=r.reaper&&(tr(A),a.setAttribute("aria-valuenow",r.currentTime+""),e.live?function(e,t){t.innerText=fe(e.currentTime)}(r,_):(t=r,_.innerText=fe(t.currentTime)),e.live||Qt(r,d),e.live&&function(e){return!("dvr"in e)||1==e.dvr}(e)&&function(e,t){if(0==t)return!0;const r=Wt(e);return r.head-r.tail>=t}(r,e.seconds_to_dvr||0)&&r.setOpts({dvr:r.seekable.length>0}))})),r.on(v,(function(){0!=r.reaper&&(e.live||Qt(r,d))})),r.on("live",(function(){r.setState(N,!1),f.style.width="0%"})),r.on("dvr",(function(){const e=Yt(r),t=r.seekable.end(0)-r.seekable.start(0),n=(e-r.currentTime)/t*100,i=Math.round(n);r.setState(N,i>0),f.style.width=i+"%"})),r.on("seeking",(function(){if(!qt(r))return;if(0==r.seekable.length||0==r.played.length)return;if(0==Yt(r))return;const e=zt(r),t=r.currentTime>=e?"live":"dvr";r.emit(t)})),r.on(h,(function(){var t,n;0!=r.reaper&&(r.setOpts({live:qt(r)}),e.live||(n=m,(t=r).duration&&(n.innerText=fe(t.duration)),Qt(r,d)))})),r.on("durationchange",(function(e){if(0==r.reaper)return;const t=qt(r),n=t?Yt(r):e.data||r.duration;isNaN(n)||(r.setOpts({live:t,duration:n}),a.setAttribute("aria-valuemax",n+""),a.setAttribute("aria-valuemin","0"))}));let k=!1;return Ht(a,{onseek:function(t,n){if(nr(r))switch(!!e.live){case!0:Zt(n,r,g);break;case!1:!function(e,t,r){const n=t.duration*(e/100);if(t.disabled&&n>t.currentTime)return!1;r.style.width=e+"%",t.currentTime=n}(n,r,f),Xt(g,n)}},onstart:function(){nr(r)&&(r.emit("timeline/gesture/start"),r.setState(x,!0),e.live||function(e){!function(e){e.style.display="block"}(e)}(g))},onend:function(t,n){tr(A),0!=e.seekable&&(r.setState(x,!1),e.live&&function(e,t){e/=100,t.currentTime=$t(t,e)}(n,r))},ontouch:function(){r.paused||(k=!0,r.pause())},ontouchend:function(){k&&(k=!1,r.play()),e.live?er(p,g):Jt(p,g)},onmouse:function(t,n){if(nr(r)&&!a.classList.contains(Gt.GRABBING))switch(r.emit("timeline/gesture/move",{percent:n}),!!e.live){case!0:!function(e,t){t.style.width=function(e){return 100-e}(e)+"%"}(n,p),Zt(n,r,g);break;case!1:!function(e,t){t.style.width=e+"%"}(n,p),function(e,t,r){if(isNaN(e)||isNaN(t.duration))return;Xt(r,e),r.innerHTML="";const n=document.createElement("span");n.innerText=fe(e/100*t.duration),r.append(n)}(n,r,g)}}}),a.addEventListener(u,(function(){r.emit("timeline/gesture/end"),e.live?er(p,g):Jt(p,g)})),n}function nr(e){return 0!=e.opt("opts.seekable",!0)&&!isNaN(e.duration)}function ir(e){try{return localStorage.getItem(e)}catch(e){return null}}function ar(e,t){try{localStorage.setItem(e,t)}catch(e){}}function sr(e,t,n){const a=document.createElement("div");a.className="fp-volumebtn",a.append(xt(Rt)),n.append(a),a.addEventListener(i,(function(){t.toggleMute()}));const s=!r().ios&&function(e){const t=function(e,t){const r=document.createElement("div");r.className="fp-volume";const n=e.classList;let i=10;n.contains("is-small")&&(i=8);n.contains("is-tiny")&&(i=6);const a=Array.from({length:i}).map(()=>{const e=document.createElement("i");return e.className="fp-tick",e});return r.append(...a),Ht(r,{onseek:t})}(e.root,(r,n)=>{n>0&&(e.muted=!1,function(e){try{localStorage.removeItem(e)}catch(e){}}("mute")),ar("volume",(e.volume=n/100).toString()),or(t,e.volume)});return t.setAttribute("tabindex","0"),t.setAttribute("role","slider"),t.setAttribute("aria-valuemin","0"),t.setAttribute("aria-valuemax","1"),t.setAttribute("aria-label",e.i18n("core.volume","volume")),t}(t);s&&n.append(s),t.on("volumechange",(function(){const e=0==t.volume||t.muted;t.setState("is-muted",e),ar("mute",e.toString()),a.setAttribute("aria-label",e?t.i18n("unmute","unmute"):t.i18n("mute","mute")),s&&(e&&or(s,0),s.classList.contains(Gt.GRABBING)||or(s,t.volume))})),"true"==ir("mute")&&(t.muted=!0,t.setState("is-muted",t.muted));const o=ir("volume");o&&!isNaN(Number(o))&&(t.volume=Number(o)),t.emit("volumechange")}function or(e,t){e.setAttribute("aria-valuenow",t.toString());const r=Array.from(e.querySelectorAll(".fp-tick")),n=Math.round(t*r.length);r.forEach((e,t)=>{e.classList.toggle("fp-color",t<n)})}var ur;function lr(e){switch(e){case ur.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case ur.MEDIA_ERR_NETWORK:return"a network error occurred";case ur.MEDIA_ERR_DECODE:return"unable to decode media content";case ur.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case ur.NO_INTERNET:return"no internet connection detected";case ur.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}function cr(){return"https:"===location.protocol}function dr(e){const t=document.createElement("a");return t.href=e,t}function fr(e){try{return!!new URL(e)}catch(e){return!1}}!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"}(ur||(ur={}));const hr=()=>!0===(navigator||{}).onLine;function pr(e,t,r){r.on(n,(function(e){const t=e.data||r.error||new Error,n=e.code||t.code,i="Error: %s\n"+(null===(a=(new Error).stack)||void 0===a?void 0:a.split("\n").slice(2).join("\n"));var a;setTimeout((function(){if(e.defaultPrevented)return;if("AbortError"==t.name)return;r.setState("is-error",!0),8===n||t.fatal||function(e){const t=e.togglePlay,r=e.root;e.togglePlay=Bt,e.once("recover",(function(){e.togglePlay=t,e.setState("is-error",!1);const n=r.querySelector(".fp-error");n&&n.remove()}))}(r);const a=function(e,t,r){switch(t){case"http:0":return function(e){return function(e){try{return cr()&&"http:"==dr(e).protocol}catch(e){return!1}}(e.original_src)?{code:ur.MIXED_CONTENT}:hr()?{code:ur.MEDIA_ERR_NETWORK}:hr()?{code:ur.UNKNOWN}:{code:ur.NO_INTERNET}}(e);case ur.MEDIA_ERR_SRC_NOT_SUPPORTED:return e.once(g,(function(){e.emit("recover")})),r;default:return r}}(r,n,t),s=function(e,t){if(t.message)return t.message;if(t.stack)return t.stack;const r=t.code||-1,n=lr(r);return e.i18n("media_errors."+r,n)}(r,a);console.error(i,s);const o=r.reaper&&r.reaper.get("ui");return o&&function(e,t,r,n){if(!e)return;const i=document.createElement("div");if(i.classList.add("fp-error"),i.innerText=t,n){const t=e.querySelector("#"+n);t&&e.removeChild(t),i.id=n}if(e.append(i),r){const e=document.createElement("div");e.classList.add("fp-error-details"),e.innerText=r,i.append(e)}}(o,s,t.details)}))}))}function vr(e,t,r){if(!r.reaper)return;const n=document.createDocumentFragment(),i=le("fp-ui");n.appendChild(i),r.reaper.set("ui",i),~t.className.indexOf("use-play-")||t.classList.add("use-play-1"),function(e,t,r){const n=le("fp-footer");t.append(n),r.on(L,(function(e){var t,r;const i=null===(t=e.data)||void 0===t?void 0:t.description,a=null===(r=e.data)||void 0===r?void 0:r.title;if(n.innerHTML="","string"==typeof a){const e=le("fp-title");e.innerText=a,n.append(e)}if("string"==typeof i){const e=i.split(" "),t=le("fp-desc");for(t.innerText=e.join(" "),n.append(t);e.length>1&&t.scrollHeight>t.offsetHeight;)e.pop(),t.innerText=e.join(" ")+"..."}}))}(0,t,r),Pt(e,i,r),Nt(0,i,r);const a=rr(e,0,r);i.append(a),sr(0,r,a),pr(0,0,r),t.appendChild(n),[o,u].forEach(e=>{t.addEventListener(e,(function(e){r.setState("is-hovered",e.type==o),r.setState("is-accessibility",!1)}))}),r.on(L,(function(e){var r;const n=null===(r=e.data)||void 0===r?void 0:r.ui;if("number"!=typeof n)return;const i=t.classList;i.toggle("use-play-1",!(32&n||64&n)),i.toggle("use-play-2",(32&n)>0),i.toggle("use-play-3",(64&n)>0),i.toggle("use-thin-controlbar",(128&n)>0),i.toggle("no-title",(256&n)>0),i.toggle("no-description",(512&n)>0),i.toggle("logo-on-right",(8&n)>0),i.toggle("use-drag-handle",(16&n)>0),i.toggle("no-controls",(1024&n)>0),i.toggle("no-duration",(2048&n)>0),i.toggle("no-header",(4096&n)>0),i.toggle("no-mute",(4&n)>0),i.toggle("no-volume",(2&n)>0),i.toggle("no-fullscreen",(1&n)>0),i.toggle("no-touch-zones",(16384&n)>0)}));let s=null;i.addEventListener("mousemove",(function(){"number"==typeof s&&clearTimeout(s),r.setState("is-hovered",!0),s=0==r.paused&&setTimeout((function(){r.setState("is-hovered",!1)}),2e3)}))}function gr(e,t,r){if(Fe.from_token(e.token||"").is_granted(Fe.permissions.NO_METERING))return;const n=Pe.id(e.token||"");n&&r.once(y,()=>function(e,t){fetch("https://pmi.flowplayer.com/in",{method:"POST",body:JSON.stringify({token_id:t,factor:1,rnd:Math.random().toString(36).substring(2)})}).then(t=>{401==t.status&&e.emit("error:fatal",{reason:"token",details:"The token online validation failed"})})}(r,n))}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 yr{init(e,t,r){r.reaper&&r.reaper.set("translations",pe(yr,e,"en"))}}yr.en=mr;const Er="rebuffer";var _r=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:Er});const Tr=navigator;function br(e){var t,r;const n=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return n?1e-6*n:(null===(r=Tr.connection)||void 0===r?void 0:r.downlink)||-1}function Sr(e,t){return function(e,t){return"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(e,t)}(e,JSON.stringify({events:t}))}const Ar=ge(),Lr=[];function kr(e){const t=Lr.slice(0);Lr.length=0,e.logger.log(`:dispatch events={${t.length}}`),Sr("https://health.flowplayer.com/v1/health/events",t)}function wr(e,t,r){Lr.push(t),e.logger.log(":enqueue",t.event,t),Lr.length<10&&!r||kr(e)}const Dr=()=>{var e,t;try{const r=window;return null===(t=null===(e=null==r?void 0:r.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},Rr=(e,t)=>Object.assign(e,{detail:t}),Or=(e,{event:t,media_session_id:r})=>({event:t,media_session_id:r,device_id:e.deviceId(),session_id:Ar,timestamp:Date.now(),version:"3.0.0-rc6",commit:"7e4127eb89f3f663206df10d63e302b72236f0be",ima_sdk_version:Dr(),preload:e.opt("preload"),autoplay:e.opt("autoplay",e.autoplay),source:e.original_src,downlink_mbs:br(e),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}),Cr=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 Ir(e,t,r,n){const i=Or(t,{event:r,media_session_id:e.media_session_id}),{before:a,after:s}=n;wr(e,((e,t,r)=>Object.assign(e,{state:{before:t,after:r}}))(i,Cr(a),Cr(s)))}const xr=(e,t)=>{let r=null;return(...n)=>{null!==r&&(clearTimeout(r),r=null),r=setTimeout(()=>t(...n),e)}};class Pr{constructor(e,t){if(this.logger=function(e,t){return{log:(...r)=>{const n=e.opt("debug");n&&t.match(n)&&console.log(t,...r)}}}(t,"health"),this.media_session_id=ge(),!Pr._UNLOAD_SUBSCRIBED){Pr._UNLOAD_SUBSCRIBED=!0;const t=()=>e.instances.forEach(e=>e.emit("unload"));document.addEventListener("visibilitychange",()=>{"hidden"==document.visibilityState&&t()}),window.addEventListener("pagehide",t)}}init(e,t,r){!function(e){e.on(E,(function(t){e.seeking||e.networkState===e.NETWORK_LOADING&&e.readyState!==e.HAVE_NOTHING&&e.emit(Er)}))}(r),r.on("health:record",({detail:e})=>{const t=Or(r,{event:e.event,media_session_id:this.media_session_id});Object.assign(t,e.detail||{}),wr(this,t)}),[_,g,s,h,p,v,E,Er].forEach(e=>{r.on(e,e=>{wr(this,Or(r,{event:e.type,media_session_id:this.media_session_id}))})}),[y,m,S,b,T,d,f].forEach(e=>{r.on(e,e=>{wr(this,Or(r,{event:e.type,media_session_id:this.media_session_id}))})}),r.on("volumechange",xr(800,e=>{const t=Or(r,{event:e.type,media_session_id:this.media_session_id});wr(this,Rr(t,{volume:parseFloat(r.volume.toFixed(2)),muted:r.muted}))})),r.on(c,xr(800,e=>{const n=Or(r,{event:e.type,media_session_id:this.media_session_id});wr(this,Rr(n,{height:t.clientHeight,width:t.clientWidth}))})),r.on("qualitychange",({type:e,detail:t})=>{switch(t.kind){case"hls":return Ir(this,r,e,t)}}),r.addEventListener(n,e=>{const t=Or(r,{event:e.type,media_session_id:this.media_session_id}),n=e.error||r.error;if(!n)return wr(this,t,!0);const i=n.code,a={error_message:n.message||lr(i),error_code:i,error_stack:n.stack||""};return wr(this,Rr(t,a),!0)}),r.on("src",e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof n)return;if(!fr(r.original_src))return;if(!fr(n))return;if(n==r.original_src)return;this.media_session_id=ge();wr(this,Or(r,{event:e.type,media_session_id:this.media_session_id})),kr(this)}),r.on("unload",e=>{wr(this,Or(r,{event:e.type,media_session_id:this.media_session_id})),kr(this)})}}Pr.events=_r,Pr._UNLOAD_SUBSCRIBED=!1,Re(window,Pr);ze.extensions.unshift.apply(ze.extensions,[yr,Tt,Pr,class{init(e,t,r){gr(e,0,r),vr(e,t,r),bt(0,t,r)}}]);var Mr=Object.assign(ze,{ui:Mt,i18n:yr}),Nr=Qe(Je((function(e,t){var r;"undefined"!=typeof window&&(r=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/dist/",r(r.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":
16
16
  /*!*********************************************!*\
17
17
  !*** ./node_modules/eventemitter3/index.js ***!
18
18
  \*********************************************/
@@ -28,15 +28,15 @@
28
28
  /*!***********************!*\
29
29
  !*** ./src/config.ts ***!
30
30
  \***********************/
31
- /*! exports provided: hlsDefaultConfig, mergeConfig, enableStreamingMode */function(e,t,r){r.r(t),r.d(t,"hlsDefaultConfig",(function(){return b})),r.d(t,"mergeConfig",(function(){return A})),r.d(t,"enableStreamingMode",(function(){return S}));var n=r(/*! ./controller/abr-controller */"./src/controller/abr-controller.ts"),i=r(/*! ./controller/audio-stream-controller */"./src/controller/audio-stream-controller.ts"),a=r(/*! ./controller/audio-track-controller */"./src/controller/audio-track-controller.ts"),s=r(/*! ./controller/subtitle-stream-controller */"./src/controller/subtitle-stream-controller.ts"),o=r(/*! ./controller/subtitle-track-controller */"./src/controller/subtitle-track-controller.ts"),u=r(/*! ./controller/buffer-controller */"./src/controller/buffer-controller.ts"),l=r(/*! ./controller/timeline-controller */"./src/controller/timeline-controller.ts"),c=r(/*! ./controller/cap-level-controller */"./src/controller/cap-level-controller.ts"),d=r(/*! ./controller/fps-controller */"./src/controller/fps-controller.ts"),f=r(/*! ./controller/eme-controller */"./src/controller/eme-controller.ts"),h=r(/*! ./utils/xhr-loader */"./src/utils/xhr-loader.ts"),p=r(/*! ./utils/fetch-loader */"./src/utils/fetch-loader.ts"),v=r(/*! ./utils/cues */"./src/utils/cues.ts"),g=r(/*! ./utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts"),m=r(/*! ./utils/logger */"./src/utils/logger.ts");function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(Object(r),!0).forEach((function(t){T(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b=_(_({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:h.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:n.default,bufferController:u.default,capLevelController:c.default,fpsController:d.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:g.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0},{cueHandler:v.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:s.SubtitleStreamController,subtitleTrackController:o.default,timelineController:l.TimelineController,audioStreamController:i.default,audioTrackController:a.default,emeController:f.default});function A(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return y({},e,t)}function S(e){var t=e.loader;t!==p.default&&t!==h.default?(m.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):Object(p.fetchSupported)()&&(e.loader=p.default,e.progressive=!0,e.enableSoftwareAES=!0,m.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}},"./src/controller/abr-controller.ts":
31
+ /*! exports provided: hlsDefaultConfig, mergeConfig, enableStreamingMode */function(e,t,r){r.r(t),r.d(t,"hlsDefaultConfig",(function(){return b})),r.d(t,"mergeConfig",(function(){return S})),r.d(t,"enableStreamingMode",(function(){return A}));var n=r(/*! ./controller/abr-controller */"./src/controller/abr-controller.ts"),i=r(/*! ./controller/audio-stream-controller */"./src/controller/audio-stream-controller.ts"),a=r(/*! ./controller/audio-track-controller */"./src/controller/audio-track-controller.ts"),s=r(/*! ./controller/subtitle-stream-controller */"./src/controller/subtitle-stream-controller.ts"),o=r(/*! ./controller/subtitle-track-controller */"./src/controller/subtitle-track-controller.ts"),u=r(/*! ./controller/buffer-controller */"./src/controller/buffer-controller.ts"),l=r(/*! ./controller/timeline-controller */"./src/controller/timeline-controller.ts"),c=r(/*! ./controller/cap-level-controller */"./src/controller/cap-level-controller.ts"),d=r(/*! ./controller/fps-controller */"./src/controller/fps-controller.ts"),f=r(/*! ./controller/eme-controller */"./src/controller/eme-controller.ts"),h=r(/*! ./utils/xhr-loader */"./src/utils/xhr-loader.ts"),p=r(/*! ./utils/fetch-loader */"./src/utils/fetch-loader.ts"),v=r(/*! ./utils/cues */"./src/utils/cues.ts"),g=r(/*! ./utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts"),m=r(/*! ./utils/logger */"./src/utils/logger.ts");function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(Object(r),!0).forEach((function(t){T(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b=_(_({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:h.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:n.default,bufferController:u.default,capLevelController:c.default,fpsController:d.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:g.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0},{cueHandler:v.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:s.SubtitleStreamController,subtitleTrackController:o.default,timelineController:l.TimelineController,audioStreamController:i.default,audioTrackController:a.default,emeController:f.default});function S(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return y({},e,t)}function A(e){var t=e.loader;t!==p.default&&t!==h.default?(m.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):Object(p.fetchSupported)()&&(e.loader=p.default,e.progressive=!0,e.enableSoftwareAES=!0,m.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}},"./src/controller/abr-controller.ts":
32
32
  /*!******************************************!*\
33
33
  !*** ./src/controller/abr-controller.ts ***!
34
34
  \******************************************/
35
- /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/ewma-bandwidth-estimator */"./src/utils/ewma-bandwidth-estimator.ts"),a=r(/*! ../events */"./src/events.ts"),s=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=r(/*! ../errors */"./src/errors.ts"),u=r(/*! ../types/loader */"./src/types/loader.ts"),l=r(/*! ../utils/logger */"./src/utils/logger.ts");function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var d=function(){function e(e){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;var t=e.config;this.bwEstimator=new i.default(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}var t,r,d,f=e.prototype;return f.registerListeners=function(){var e=this.hls;e.on(a.Events.FRAG_LOADING,this.onFragLoading,this),e.on(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(a.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var e=this.hls;e.off(a.Events.FRAG_LOADING,this.onFragLoading,this),e.off(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(a.Events.ERROR,this.onError,this)},f.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},f.onFragLoading=function(e,t){var r,n=t.frag;n.type===u.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=n,this.partCurrent=null!=(r=t.part)?r:null,this.timer=self.setInterval(this.onCheck,100)))},f.onLevelLoaded=function(e,t){var r=this.hls.config;t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)},f._abandonRulesCheck=function(){var e=this.fragCurrent,t=this.partCurrent,r=this.hls,i=r.autoLevelEnabled,o=r.config,u=r.media;if(e&&u){var c=t?t.stats:e.stats,d=t?t.duration:e.duration;if(c.aborted)return l.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);if(i&&!u.paused&&u.playbackRate&&u.readyState){var f=performance.now()-c.loading.start,h=Math.abs(u.playbackRate);if(!(f<=500*d/h)){var p=r.levels,v=r.minAutoLevel,g=p[e.level],m=c.total||Math.max(c.loaded,Math.round(d*g.maxBitrate/8)),y=Math.max(1,c.bwEstimate?c.bwEstimate/8:1e3*c.loaded/f),E=(m-c.loaded)/y,_=u.currentTime,T=(s.BufferHelper.bufferInfo(u,_,o.maxBufferHole).end-_)/h;if(!(T>=2*d/h||E<=T)){var b,A=Number.POSITIVE_INFINITY;for(b=e.level-1;b>v&&!((A=d*p[b].maxBitrate/(6.4*y))<T);b--);if(!(A>=E)){var S=this.bwEstimator.getEstimate();l.logger.warn("Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+b+"\n Current BW estimate: "+(Object(n.isFiniteNumber)(S)?(S/1024).toFixed(3):"Unknown")+" Kb/s\n Estimated load time for current fragment: "+E.toFixed(3)+" s\n Estimated load time for the next fragment: "+A.toFixed(3)+" s\n Time to underbuffer: "+T.toFixed(3)+" s"),r.nextLoadLevel=b,this.bwEstimator.sample(f,c.loaded),this.clearTimer(),e.loader&&(this.fragCurrent=this.partCurrent=null,e.loader.abort()),r.trigger(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:c})}}}}}},f.onFragLoaded=function(e,t){var r=t.frag,i=t.part;if(r.type===u.PlaylistLevelType.MAIN&&Object(n.isFiniteNumber)(r.sn)){var s=i?i.stats:r.stats,o=i?i.duration:r.duration;if(this.clearTimer(),this.lastLoadedFragLevel=r.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var l=this.hls.levels[r.level],c=(l.loaded?l.loaded.bytes:0)+s.loaded,d=(l.loaded?l.loaded.duration:0)+o;l.loaded={bytes:c,duration:d},l.realBitrate=Math.round(8*c/d)}if(r.bitrateTest){var f={stats:s,frag:r,part:i,id:r.type};this.onFragBuffered(a.Events.FRAG_BUFFERED,f),r.bitrateTest=!1}}},f.onFragBuffered=function(e,t){var r=t.frag,n=t.part,i=n?n.stats:r.stats;if(!i.aborted&&r.type===u.PlaylistLevelType.MAIN&&"initSegment"!==r.sn){var a=i.parsing.end-i.loading.start;this.bwEstimator.sample(a,i.loaded),i.bwEstimate=this.bwEstimator.getEstimate(),r.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}},f.onError=function(e,t){switch(t.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},f.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},f.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,r=this.hls,n=r.maxAutoLevel,i=r.config,a=r.minAutoLevel,o=r.media,u=t?t.duration:e?e.duration:0,c=o?o.currentTime:0,d=o&&0!==o.playbackRate?Math.abs(o.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,h=(s.BufferHelper.bufferInfo(o,c,i.maxBufferHole).end-c)/d,p=this.findBestLevel(f,a,n,h,i.abrBandWidthFactor,i.abrBandWidthUpFactor);if(p>=0)return p;l.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=u?Math.min(u,i.maxStarvationDelay):i.maxStarvationDelay,g=i.abrBandWidthFactor,m=i.abrBandWidthUpFactor;if(!h){var y=this.bitrateTestDelay;y&&(v=(u?Math.min(u,i.maxLoadingDelay):i.maxLoadingDelay)-y,l.logger.trace("bitrate test took "+Math.round(1e3*y)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),g=m=1)}return p=this.findBestLevel(f,a,n,h+v,g,m),Math.max(p,0)},f.findBestLevel=function(e,t,r,n,i,a){for(var s,o=this.fragCurrent,u=this.partCurrent,c=this.lastLoadedFragLevel,d=this.hls.levels,f=d[c],h=!(null==f||null===(s=f.details)||void 0===s||!s.live),p=null==f?void 0:f.codecSet,v=u?u.duration:o?o.duration:0,g=r;g>=t;g--){var m=d[g];if(m&&(!p||m.codecSet===p)){var y=m.details,E=(u?null==y?void 0:y.partTarget:null==y?void 0:y.averagetargetduration)||v,_=void 0;_=g<=c?i*e:a*e;var T=d[g].maxBitrate,b=T*E/_;if(l.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+g+"/"+Math.round(_)+"/"+T+"/"+E+"/"+n+"/"+b),_>T&&(!b||h&&!this.bitrateTestDelay||b<n))return g}}return-1},t=e,(r=[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this.bwEstimator;if(!(-1===e||t&&t.canEstimate()))return e;var r=this.getNextABRAutoLevel();return-1!==e&&(r=Math.min(e,r)),r},set:function(e){this._nextAutoLevel=e}}])&&c(t.prototype,r),d&&c(t,d),e}();t.default=d},"./src/controller/audio-stream-controller.ts":
35
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/ewma-bandwidth-estimator */"./src/utils/ewma-bandwidth-estimator.ts"),a=r(/*! ../events */"./src/events.ts"),s=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=r(/*! ../errors */"./src/errors.ts"),u=r(/*! ../types/loader */"./src/types/loader.ts"),l=r(/*! ../utils/logger */"./src/utils/logger.ts");function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var d=function(){function e(e){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=e;var t=e.config;this.bwEstimator=new i.default(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate),this.registerListeners()}var t,r,d,f=e.prototype;return f.registerListeners=function(){var e=this.hls;e.on(a.Events.FRAG_LOADING,this.onFragLoading,this),e.on(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(a.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var e=this.hls;e.off(a.Events.FRAG_LOADING,this.onFragLoading,this),e.off(a.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(a.Events.ERROR,this.onError,this)},f.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},f.onFragLoading=function(e,t){var r,n=t.frag;n.type===u.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=n,this.partCurrent=null!=(r=t.part)?r:null,this.timer=self.setInterval(this.onCheck,100)))},f.onLevelLoaded=function(e,t){var r=this.hls.config;t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)},f._abandonRulesCheck=function(){var e=this.fragCurrent,t=this.partCurrent,r=this.hls,i=r.autoLevelEnabled,o=r.config,u=r.media;if(e&&u){var c=t?t.stats:e.stats,d=t?t.duration:e.duration;if(c.aborted)return l.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);if(i&&!u.paused&&u.playbackRate&&u.readyState){var f=performance.now()-c.loading.start,h=Math.abs(u.playbackRate);if(!(f<=500*d/h)){var p=r.levels,v=r.minAutoLevel,g=p[e.level],m=c.total||Math.max(c.loaded,Math.round(d*g.maxBitrate/8)),y=Math.max(1,c.bwEstimate?c.bwEstimate/8:1e3*c.loaded/f),E=(m-c.loaded)/y,_=u.currentTime,T=(s.BufferHelper.bufferInfo(u,_,o.maxBufferHole).end-_)/h;if(!(T>=2*d/h||E<=T)){var b,S=Number.POSITIVE_INFINITY;for(b=e.level-1;b>v&&!((S=d*p[b].maxBitrate/(6.4*y))<T);b--);if(!(S>=E)){var A=this.bwEstimator.getEstimate();l.logger.warn("Fragment "+e.sn+(t?" part "+t.index:"")+" of level "+e.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+b+"\n Current BW estimate: "+(Object(n.isFiniteNumber)(A)?(A/1024).toFixed(3):"Unknown")+" Kb/s\n Estimated load time for current fragment: "+E.toFixed(3)+" s\n Estimated load time for the next fragment: "+S.toFixed(3)+" s\n Time to underbuffer: "+T.toFixed(3)+" s"),r.nextLoadLevel=b,this.bwEstimator.sample(f,c.loaded),this.clearTimer(),e.loader&&(this.fragCurrent=this.partCurrent=null,e.loader.abort()),r.trigger(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:c})}}}}}},f.onFragLoaded=function(e,t){var r=t.frag,i=t.part;if(r.type===u.PlaylistLevelType.MAIN&&Object(n.isFiniteNumber)(r.sn)){var s=i?i.stats:r.stats,o=i?i.duration:r.duration;if(this.clearTimer(),this.lastLoadedFragLevel=r.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var l=this.hls.levels[r.level],c=(l.loaded?l.loaded.bytes:0)+s.loaded,d=(l.loaded?l.loaded.duration:0)+o;l.loaded={bytes:c,duration:d},l.realBitrate=Math.round(8*c/d)}if(r.bitrateTest){var f={stats:s,frag:r,part:i,id:r.type};this.onFragBuffered(a.Events.FRAG_BUFFERED,f),r.bitrateTest=!1}}},f.onFragBuffered=function(e,t){var r=t.frag,n=t.part,i=n?n.stats:r.stats;if(!i.aborted&&r.type===u.PlaylistLevelType.MAIN&&"initSegment"!==r.sn){var a=i.parsing.end-i.loading.start;this.bwEstimator.sample(a,i.loaded),i.bwEstimate=this.bwEstimator.getEstimate(),r.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}},f.onError=function(e,t){switch(t.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},f.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},f.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,r=this.hls,n=r.maxAutoLevel,i=r.config,a=r.minAutoLevel,o=r.media,u=t?t.duration:e?e.duration:0,c=o?o.currentTime:0,d=o&&0!==o.playbackRate?Math.abs(o.playbackRate):1,f=this.bwEstimator?this.bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,h=(s.BufferHelper.bufferInfo(o,c,i.maxBufferHole).end-c)/d,p=this.findBestLevel(f,a,n,h,i.abrBandWidthFactor,i.abrBandWidthUpFactor);if(p>=0)return p;l.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=u?Math.min(u,i.maxStarvationDelay):i.maxStarvationDelay,g=i.abrBandWidthFactor,m=i.abrBandWidthUpFactor;if(!h){var y=this.bitrateTestDelay;y&&(v=(u?Math.min(u,i.maxLoadingDelay):i.maxLoadingDelay)-y,l.logger.trace("bitrate test took "+Math.round(1e3*y)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*v)+" ms"),g=m=1)}return p=this.findBestLevel(f,a,n,h+v,g,m),Math.max(p,0)},f.findBestLevel=function(e,t,r,n,i,a){for(var s,o=this.fragCurrent,u=this.partCurrent,c=this.lastLoadedFragLevel,d=this.hls.levels,f=d[c],h=!(null==f||null===(s=f.details)||void 0===s||!s.live),p=null==f?void 0:f.codecSet,v=u?u.duration:o?o.duration:0,g=r;g>=t;g--){var m=d[g];if(m&&(!p||m.codecSet===p)){var y=m.details,E=(u?null==y?void 0:y.partTarget:null==y?void 0:y.averagetargetduration)||v,_=void 0;_=g<=c?i*e:a*e;var T=d[g].maxBitrate,b=T*E/_;if(l.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+g+"/"+Math.round(_)+"/"+T+"/"+E+"/"+n+"/"+b),_>T&&(!b||h&&!this.bitrateTestDelay||b<n))return g}}return-1},t=e,(r=[{key:"nextAutoLevel",get:function(){var e=this._nextAutoLevel,t=this.bwEstimator;if(!(-1===e||t&&t.canEstimate()))return e;var r=this.getNextABRAutoLevel();return-1!==e&&(r=Math.min(e,r)),r},set:function(e){this._nextAutoLevel=e}}])&&c(t.prototype,r),d&&c(t,d),e}();t.default=d},"./src/controller/audio-stream-controller.ts":
36
36
  /*!***************************************************!*\
37
37
  !*** ./src/controller/audio-stream-controller.ts ***!
38
38
  \***************************************************/
39
- /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),a=r(/*! ../events */"./src/events.ts"),s=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),u=r(/*! ../types/level */"./src/types/level.ts"),l=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),d=r(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts"),f=r(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),h=r(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),p=r(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),v=r(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),g=r(/*! ./gap-controller */"./src/controller/gap-controller.ts"),m=r(/*! ../errors */"./src/errors.ts"),y=r(/*! ../utils/logger */"./src/utils/logger.ts");function E(){return(E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var T=function(e){var t,r;function T(t,r){var n;return(n=e.call(this,t,r,"[audio-stream-controller]")||this).videoBuffer=null,n.videoTrackCC=-1,n.waitingVideoCC=-1,n.audioSwitch=!1,n.trackId=-1,n.waitingData=null,n.mainDetails=null,n._registerListeners(),n}r=e,(t=T).prototype=Object.create(r.prototype),t.prototype.constructor=t,_(t,r);var b=T.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var e=this.hls;e.on(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(a.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(a.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(a.Events.ERROR,this.onError,this),e.on(a.Events.BUFFER_RESET,this.onBufferReset,this),e.on(a.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var e=this.hls;e.off(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(a.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(a.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(a.Events.ERROR,this.onError,this),e.off(a.Events.BUFFER_RESET,this.onBufferReset,this),e.off(a.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onInitPtsFound=function(e,t){var r=t.frag,n=t.id,a=t.initPTS;if("main"===n){var s=r.cc;this.initPTS[r.cc]=a,this.log("InitPTS for cc: "+s+" found from main: "+a),this.videoTrackCC=s,this.state===i.State.WAITING_INIT_PTS&&this.tick()}},b.startLoad=function(e){if(!this.levels)return this.startPosition=e,void(this.state=i.State.STOPPED);var t=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,t>0&&-1===e?(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=i.State.IDLE):(this.loadedmetadata=!1,this.state=i.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},b.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_TRACK:var t,r=this.levels,n=this.trackId,a=null==r||null===(t=r[n])||void 0===t?void 0:t.details;if(a){if(this.waitForCdnTuneIn(a))break;this.state=i.State.WAITING_INIT_PTS}break;case i.State.FRAG_LOADING_WAITING_RETRY:var o,u=performance.now(),l=this.retryDate;(!l||u>=l||null!==(o=this.media)&&void 0!==o&&o.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=i.State.IDLE);break;case i.State.WAITING_INIT_PTS:var c=this.waitingData;if(c){var d=c.frag,f=c.part,h=c.cache,v=c.complete;if(void 0!==this.initPTS[d.cc]){this.waitingData=null,this.state=i.State.FRAG_LOADING;var g={frag:d,part:f,payload:h.flush(),networkDetails:null};this._handleFragmentLoadProgress(g),v&&e.prototype._handleFragmentLoadComplete.call(this,g)}else if(this.videoTrackCC!==this.waitingVideoCC)y.logger.log("Waiting fragment cc ("+d.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var m=s.BufferHelper.bufferInfo(this.mediaBuffer,this.media.currentTime,this.config.maxBufferHole);Object(p.fragmentWithinToleranceTest)(m.end,this.config.maxFragLookUpTolerance,d)<0&&(y.logger.log("Waiting fragment cc ("+d.cc+") @ "+d.start+" cancelled because another fragment at "+m.end+" is needed"),this.clearWaitingFragment())}}else this.state=i.State.IDLE}this.onTickEnd()},b.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=i.State.IDLE)},b.onTickEnd=function(){var e=this.media;if(e&&e.readyState){var t=(this.mediaBuffer?this.mediaBuffer:e).buffered;!this.loadedmetadata&&t.length&&(this.loadedmetadata=!0),this.lastCurrentTime=e.currentTime}},b.doTickIdle=function(){var e,t,r=this.hls,o=this.levels,u=this.media,l=this.trackId,c=r.config;if(o&&o[l]&&(u||!this.startFragRequested&&c.startFragPrefetch)){var d=this.getLoadPosition();if(Object(n.isFiniteNumber)(d)){var f=o[l].details;if(!f||f.live&&this.levelLastLoaded!==l||this.waitForCdnTuneIn(f))this.state=i.State.WAITING_TRACK;else{var h=f.initSegment,p=0;if(!h||h.data){var v=this.mediaBuffer?this.mediaBuffer:this.media,m=this.videoBuffer?this.videoBuffer:this.media,y=d<c.maxBufferHole?Math.max(g.MAX_START_GAP_JUMP,c.maxBufferHole):c.maxBufferHole,E=s.BufferHelper.bufferInfo(v,d,y),_=s.BufferHelper.bufferInfo(m,d,y),T=E.len,b=Math.min(c.maxBufferLength,c.maxMaxBufferLength),A=Math.max(b,_.len),S=this.audioSwitch;if(T>=A&&!S)return;if(!S&&this._streamEnded(E,f))return r.trigger(a.Events.BUFFER_EOS,{type:"audio"}),void(this.state=i.State.ENDED);var L=f.fragments[0].start;if(p=E.end,S&&(p=d,f.PTSKnown&&d<L&&(E.end>L||E.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),u.currentTime=L+.05)),!(h=this.getNextFragment(p,f)))return}"identity"!==(null===(e=h.decryptdata)||void 0===e?void 0:e.keyFormat)||null!==(t=h.decryptdata)&&void 0!==t&&t.key?this.loadFragment(h,f,p):this.loadKey(h,f)}}}},b.onMediaDetaching=function(){this.videoBuffer=null,e.prototype.onMediaDetaching.call(this)},b.onAudioTracksUpdated=function(e,t){var r=t.audioTracks;this.resetTransmuxer(),this.levels=r.map((function(e){return new u.Level(e)}))},b.onAudioTrackSwitching=function(e,t){var r=!!t.url;this.trackId=t.id;var n=this.fragCurrent;null!=n&&n.loader&&n.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.audioSwitch=!0,this.state=i.State.IDLE):this.state=i.State.STOPPED,this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0},b.onLevelLoaded=function(e,t){if(null===this.mainDetails){var r=this.mainDetails=t.details,n=this.levelLastLoaded;if(null!==n&&this.levels&&-1===this.startPosition&&r.live){var i=this.levels[n];if(!i.details||!i.details.fragments[0])return;Object(v.alignPDT)(i.details,r),this.setStartPosition(i.details,i.details.fragments[0].start)}}},b.onAudioTrackLoaded=function(e,t){var r,n=this.levels,a=t.details,s=t.id;if(n){this.log("Track "+s+" loaded ["+a.startSN+","+a.endSN+"],duration:"+a.totalduration);var o=n[s],u=0;if(a.live||null!==(r=o.details)&&void 0!==r&&r.live){var l;if(a.fragments[0]||(a.deltaUpdateFailed=!0),a.deltaUpdateFailed)return;!o.details&&null!==(l=this.mainDetails)&&void 0!==l&&l.hasProgramDateTime&&a.hasProgramDateTime?(Object(v.alignPDT)(a,this.mainDetails),u=a.fragments[0].start):u=this.alignPlaylists(a,o.details)}o.details=a,this.levelLastLoaded=s,this.startFragRequested||!this.mainDetails&&a.live||this.setStartPosition(o.details,u),this.state!==i.State.WAITING_TRACK||this.waitForCdnTuneIn(a)||(this.state=i.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+s)},b._handleFragmentLoadProgress=function(e){var t,r=e.frag,n=e.part,a=e.payload,s=this.config,o=this.trackId,u=this.levels;if(u){var c=u[o];console.assert(c,"Audio track is defined on fragment load progress");var p=c.details;console.assert(p,"Audio track details are defined on fragment load progress");var v=s.defaultAudioCodec||c.audioCodec||"mp4a.40.2",g=this.transmuxer;g||(g=this.transmuxer=new f.default(this.hls,l.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var m=this.initPTS[r.cc],E=null===(t=p.initSegment)||void 0===t?void 0:t.data;if(void 0!==m){var _=n?n.index:-1,T=-1!==_,b=new h.ChunkMetadata(r.level,r.sn,r.stats.chunkCount,a.byteLength,_,T);g.push(a,E,v,"",r,n,p.totalduration,!1,b,m)}else y.logger.log("Unknown video PTS for cc "+r.cc+", waiting for video PTS before demuxing audio frag "+r.sn+" of ["+p.startSN+" ,"+p.endSN+"],track "+o),(this.waitingData=this.waitingData||{frag:r,part:n,cache:new d.default,complete:!1}).cache.push(new Uint8Array(a)),this.waitingVideoCC=this.videoTrackCC,this.state=i.State.WAITING_INIT_PTS}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},b._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:e.prototype._handleFragmentLoadComplete.call(this,t)},b.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},b.onBufferCreated=function(e,t){var r=t.tracks.audio;r&&(this.mediaBuffer=r.buffer),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},b.onFragBuffered=function(e,t){var r=t.frag,n=t.part;r.type===l.PlaylistLevelType.AUDIO&&(this.fragContextChanged(r)?this.warn("Fragment "+r.sn+(n?" p: "+n.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==r.sn&&(this.fragPrevious=r,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(r,n)))},b.onError=function(t,r){switch(r.details){case m.ErrorDetails.FRAG_LOAD_ERROR:case m.ErrorDetails.FRAG_LOAD_TIMEOUT:case m.ErrorDetails.KEY_LOAD_ERROR:case m.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(l.PlaylistLevelType.AUDIO,r);break;case m.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case m.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==i.State.ERROR&&this.state!==i.State.STOPPED&&(this.state=r.fatal?i.State.ERROR:i.State.IDLE,this.warn(r.details+" while loading frag, switching to "+this.state+" state"));break;case m.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===r.parent&&(this.state===i.State.PARSING||this.state===i.State.PARSED)){var n=this.mediaBuffer,a=this.media.currentTime;n&&s.BufferHelper.isBuffered(n,a)&&s.BufferHelper.isBuffered(n,a+.5)?(this.reduceMaxBufferLength(),this.state=i.State.IDLE):(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"))}}},b.onBufferFlushed=function(e,t){var r=t.type;if(r===c.ElementaryStreamTypes.AUDIO){var n=this.mediaBuffer?this.mediaBuffer:this.media;this.afterBufferFlushed(n,r,l.PlaylistLevelType.AUDIO)}},b._handleTransmuxComplete=function(e){var t,r="audio",n=this.hls,s=e.remuxResult,o=e.chunkMeta,u=this.getCurrentContext(o);if(!u)return this.warn("The loading context changed while buffering fragment "+o.sn+" of level "+o.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(o.level);var l=u.frag,d=u.part,f=s.audio,h=s.text,p=s.id3,v=s.initSegment;if(!this.fragContextChanged(l)){if(this.state=i.State.PARSING,this.audioSwitch&&f&&this.completeAudioSwitch(),null!=v&&v.tracks&&(this._bufferInitSegment(v.tracks,l,o),n.trigger(a.Events.FRAG_PARSING_INIT_SEGMENT,{frag:l,id:r,tracks:v.tracks})),f){var g=f.startPTS,m=f.endPTS,y=f.startDTS,_=f.endDTS;d&&(d.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:g,endPTS:m,startDTS:y,endDTS:_}),l.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,g,m,y,_),this.bufferFragmentData(f,l,d,o)}if(null!=p&&null!==(t=p.samples)&&void 0!==t&&t.length){var T=E({frag:l,id:r},p);n.trigger(a.Events.FRAG_PARSING_METADATA,T)}if(h){var b=E({frag:l,id:r},h);n.trigger(a.Events.FRAG_PARSING_USERDATA,b)}}},b._bufferInitSegment=function(e,t,r){if(this.state===i.State.PARSING){e.video&&delete e.video;var n=e.audio;if(n){n.levelCodec=n.codec,n.id="audio",this.log("Init audio buffer, container:"+n.container+", codecs[parsed]=["+n.codec+"]"),this.hls.trigger(a.Events.BUFFER_CODECS,e);var s=n.initSegment;if(null!=s&&s.byteLength){var o={type:"audio",frag:t,part:null,chunkMeta:r,parent:t.type,data:s};this.hls.trigger(a.Events.BUFFER_APPENDING,o)}this.tick()}}},b.loadFragment=function(t,r,a){var s=this.fragmentTracker.getState(t);this.fragCurrent=t,(this.audioSwitch||s===o.FragmentState.NOT_LOADED||s===o.FragmentState.PARTIAL)&&("initSegment"===t.sn?this._loadInitSegment(t):r.live&&!Object(n.isFiniteNumber)(this.initPTS[t.cc])?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=i.State.WAITING_INIT_PTS):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,r,a)))},b.completeAudioSwitch=function(){var t=this.hls,r=this.media,n=this.trackId;r&&(this.log("Switching audio track : flushing all audio"),e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,t.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:n})},T}(i.default);t.default=T},"./src/controller/audio-track-controller.ts":
39
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),a=r(/*! ../events */"./src/events.ts"),s=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),u=r(/*! ../types/level */"./src/types/level.ts"),l=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),d=r(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts"),f=r(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),h=r(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),p=r(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),v=r(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),g=r(/*! ./gap-controller */"./src/controller/gap-controller.ts"),m=r(/*! ../errors */"./src/errors.ts"),y=r(/*! ../utils/logger */"./src/utils/logger.ts");function E(){return(E=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var T=function(e){var t,r;function T(t,r){var n;return(n=e.call(this,t,r,"[audio-stream-controller]")||this).videoBuffer=null,n.videoTrackCC=-1,n.waitingVideoCC=-1,n.audioSwitch=!1,n.trackId=-1,n.waitingData=null,n.mainDetails=null,n._registerListeners(),n}r=e,(t=T).prototype=Object.create(r.prototype),t.prototype.constructor=t,_(t,r);var b=T.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var e=this.hls;e.on(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(a.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(a.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(a.Events.ERROR,this.onError,this),e.on(a.Events.BUFFER_RESET,this.onBufferReset,this),e.on(a.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var e=this.hls;e.off(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(a.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(a.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(a.Events.ERROR,this.onError,this),e.off(a.Events.BUFFER_RESET,this.onBufferReset,this),e.off(a.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onInitPtsFound=function(e,t){var r=t.frag,n=t.id,a=t.initPTS;if("main"===n){var s=r.cc;this.initPTS[r.cc]=a,this.log("InitPTS for cc: "+s+" found from main: "+a),this.videoTrackCC=s,this.state===i.State.WAITING_INIT_PTS&&this.tick()}},b.startLoad=function(e){if(!this.levels)return this.startPosition=e,void(this.state=i.State.STOPPED);var t=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,t>0&&-1===e?(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),this.state=i.State.IDLE):(this.loadedmetadata=!1,this.state=i.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},b.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_TRACK:var t,r=this.levels,n=this.trackId,a=null==r||null===(t=r[n])||void 0===t?void 0:t.details;if(a){if(this.waitForCdnTuneIn(a))break;this.state=i.State.WAITING_INIT_PTS}break;case i.State.FRAG_LOADING_WAITING_RETRY:var o,u=performance.now(),l=this.retryDate;(!l||u>=l||null!==(o=this.media)&&void 0!==o&&o.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=i.State.IDLE);break;case i.State.WAITING_INIT_PTS:var c=this.waitingData;if(c){var d=c.frag,f=c.part,h=c.cache,v=c.complete;if(void 0!==this.initPTS[d.cc]){this.waitingData=null,this.state=i.State.FRAG_LOADING;var g={frag:d,part:f,payload:h.flush(),networkDetails:null};this._handleFragmentLoadProgress(g),v&&e.prototype._handleFragmentLoadComplete.call(this,g)}else if(this.videoTrackCC!==this.waitingVideoCC)y.logger.log("Waiting fragment cc ("+d.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var m=s.BufferHelper.bufferInfo(this.mediaBuffer,this.media.currentTime,this.config.maxBufferHole);Object(p.fragmentWithinToleranceTest)(m.end,this.config.maxFragLookUpTolerance,d)<0&&(y.logger.log("Waiting fragment cc ("+d.cc+") @ "+d.start+" cancelled because another fragment at "+m.end+" is needed"),this.clearWaitingFragment())}}else this.state=i.State.IDLE}this.onTickEnd()},b.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=i.State.IDLE)},b.onTickEnd=function(){var e=this.media;if(e&&e.readyState){var t=(this.mediaBuffer?this.mediaBuffer:e).buffered;!this.loadedmetadata&&t.length&&(this.loadedmetadata=!0),this.lastCurrentTime=e.currentTime}},b.doTickIdle=function(){var e,t,r=this.hls,o=this.levels,u=this.media,l=this.trackId,c=r.config;if(o&&o[l]&&(u||!this.startFragRequested&&c.startFragPrefetch)){var d=this.getLoadPosition();if(Object(n.isFiniteNumber)(d)){var f=o[l].details;if(!f||f.live&&this.levelLastLoaded!==l||this.waitForCdnTuneIn(f))this.state=i.State.WAITING_TRACK;else{var h=f.initSegment,p=0;if(!h||h.data){var v=this.mediaBuffer?this.mediaBuffer:this.media,m=this.videoBuffer?this.videoBuffer:this.media,y=d<c.maxBufferHole?Math.max(g.MAX_START_GAP_JUMP,c.maxBufferHole):c.maxBufferHole,E=s.BufferHelper.bufferInfo(v,d,y),_=s.BufferHelper.bufferInfo(m,d,y),T=E.len,b=Math.min(c.maxBufferLength,c.maxMaxBufferLength),S=Math.max(b,_.len),A=this.audioSwitch;if(T>=S&&!A)return;if(!A&&this._streamEnded(E,f))return r.trigger(a.Events.BUFFER_EOS,{type:"audio"}),void(this.state=i.State.ENDED);var L=f.fragments[0].start;if(p=E.end,A&&(p=d,f.PTSKnown&&d<L&&(E.end>L||E.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),u.currentTime=L+.05)),!(h=this.getNextFragment(p,f)))return}"identity"!==(null===(e=h.decryptdata)||void 0===e?void 0:e.keyFormat)||null!==(t=h.decryptdata)&&void 0!==t&&t.key?this.loadFragment(h,f,p):this.loadKey(h,f)}}}},b.onMediaDetaching=function(){this.videoBuffer=null,e.prototype.onMediaDetaching.call(this)},b.onAudioTracksUpdated=function(e,t){var r=t.audioTracks;this.resetTransmuxer(),this.levels=r.map((function(e){return new u.Level(e)}))},b.onAudioTrackSwitching=function(e,t){var r=!!t.url;this.trackId=t.id;var n=this.fragCurrent;null!=n&&n.loader&&n.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.audioSwitch=!0,this.state=i.State.IDLE):this.state=i.State.STOPPED,this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0},b.onLevelLoaded=function(e,t){if(null===this.mainDetails){var r=this.mainDetails=t.details,n=this.levelLastLoaded;if(null!==n&&this.levels&&-1===this.startPosition&&r.live){var i=this.levels[n];if(!i.details||!i.details.fragments[0])return;Object(v.alignPDT)(i.details,r),this.setStartPosition(i.details,i.details.fragments[0].start)}}},b.onAudioTrackLoaded=function(e,t){var r,n=this.levels,a=t.details,s=t.id;if(n){this.log("Track "+s+" loaded ["+a.startSN+","+a.endSN+"],duration:"+a.totalduration);var o=n[s],u=0;if(a.live||null!==(r=o.details)&&void 0!==r&&r.live){var l;if(a.fragments[0]||(a.deltaUpdateFailed=!0),a.deltaUpdateFailed)return;!o.details&&null!==(l=this.mainDetails)&&void 0!==l&&l.hasProgramDateTime&&a.hasProgramDateTime?(Object(v.alignPDT)(a,this.mainDetails),u=a.fragments[0].start):u=this.alignPlaylists(a,o.details)}o.details=a,this.levelLastLoaded=s,this.startFragRequested||!this.mainDetails&&a.live||this.setStartPosition(o.details,u),this.state!==i.State.WAITING_TRACK||this.waitForCdnTuneIn(a)||(this.state=i.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+s)},b._handleFragmentLoadProgress=function(e){var t,r=e.frag,n=e.part,a=e.payload,s=this.config,o=this.trackId,u=this.levels;if(u){var c=u[o];console.assert(c,"Audio track is defined on fragment load progress");var p=c.details;console.assert(p,"Audio track details are defined on fragment load progress");var v=s.defaultAudioCodec||c.audioCodec||"mp4a.40.2",g=this.transmuxer;g||(g=this.transmuxer=new f.default(this.hls,l.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var m=this.initPTS[r.cc],E=null===(t=p.initSegment)||void 0===t?void 0:t.data;if(void 0!==m){var _=n?n.index:-1,T=-1!==_,b=new h.ChunkMetadata(r.level,r.sn,r.stats.chunkCount,a.byteLength,_,T);g.push(a,E,v,"",r,n,p.totalduration,!1,b,m)}else y.logger.log("Unknown video PTS for cc "+r.cc+", waiting for video PTS before demuxing audio frag "+r.sn+" of ["+p.startSN+" ,"+p.endSN+"],track "+o),(this.waitingData=this.waitingData||{frag:r,part:n,cache:new d.default,complete:!1}).cache.push(new Uint8Array(a)),this.waitingVideoCC=this.videoTrackCC,this.state=i.State.WAITING_INIT_PTS}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},b._handleFragmentLoadComplete=function(t){this.waitingData?this.waitingData.complete=!0:e.prototype._handleFragmentLoadComplete.call(this,t)},b.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},b.onBufferCreated=function(e,t){var r=t.tracks.audio;r&&(this.mediaBuffer=r.buffer),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},b.onFragBuffered=function(e,t){var r=t.frag,n=t.part;r.type===l.PlaylistLevelType.AUDIO&&(this.fragContextChanged(r)?this.warn("Fragment "+r.sn+(n?" p: "+n.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==r.sn&&(this.fragPrevious=r,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(r,n)))},b.onError=function(t,r){switch(r.details){case m.ErrorDetails.FRAG_LOAD_ERROR:case m.ErrorDetails.FRAG_LOAD_TIMEOUT:case m.ErrorDetails.KEY_LOAD_ERROR:case m.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(l.PlaylistLevelType.AUDIO,r);break;case m.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case m.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==i.State.ERROR&&this.state!==i.State.STOPPED&&(this.state=r.fatal?i.State.ERROR:i.State.IDLE,this.warn(r.details+" while loading frag, switching to "+this.state+" state"));break;case m.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===r.parent&&(this.state===i.State.PARSING||this.state===i.State.PARSED)){var n=this.mediaBuffer,a=this.media.currentTime;n&&s.BufferHelper.isBuffered(n,a)&&s.BufferHelper.isBuffered(n,a+.5)?(this.reduceMaxBufferLength(),this.state=i.State.IDLE):(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"))}}},b.onBufferFlushed=function(e,t){var r=t.type;if(r===c.ElementaryStreamTypes.AUDIO){var n=this.mediaBuffer?this.mediaBuffer:this.media;this.afterBufferFlushed(n,r,l.PlaylistLevelType.AUDIO)}},b._handleTransmuxComplete=function(e){var t,r="audio",n=this.hls,s=e.remuxResult,o=e.chunkMeta,u=this.getCurrentContext(o);if(!u)return this.warn("The loading context changed while buffering fragment "+o.sn+" of level "+o.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(o.level);var l=u.frag,d=u.part,f=s.audio,h=s.text,p=s.id3,v=s.initSegment;if(!this.fragContextChanged(l)){if(this.state=i.State.PARSING,this.audioSwitch&&f&&this.completeAudioSwitch(),null!=v&&v.tracks&&(this._bufferInitSegment(v.tracks,l,o),n.trigger(a.Events.FRAG_PARSING_INIT_SEGMENT,{frag:l,id:r,tracks:v.tracks})),f){var g=f.startPTS,m=f.endPTS,y=f.startDTS,_=f.endDTS;d&&(d.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:g,endPTS:m,startDTS:y,endDTS:_}),l.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,g,m,y,_),this.bufferFragmentData(f,l,d,o)}if(null!=p&&null!==(t=p.samples)&&void 0!==t&&t.length){var T=E({frag:l,id:r},p);n.trigger(a.Events.FRAG_PARSING_METADATA,T)}if(h){var b=E({frag:l,id:r},h);n.trigger(a.Events.FRAG_PARSING_USERDATA,b)}}},b._bufferInitSegment=function(e,t,r){if(this.state===i.State.PARSING){e.video&&delete e.video;var n=e.audio;if(n){n.levelCodec=n.codec,n.id="audio",this.log("Init audio buffer, container:"+n.container+", codecs[parsed]=["+n.codec+"]"),this.hls.trigger(a.Events.BUFFER_CODECS,e);var s=n.initSegment;if(null!=s&&s.byteLength){var o={type:"audio",frag:t,part:null,chunkMeta:r,parent:t.type,data:s};this.hls.trigger(a.Events.BUFFER_APPENDING,o)}this.tick()}}},b.loadFragment=function(t,r,a){var s=this.fragmentTracker.getState(t);this.fragCurrent=t,(this.audioSwitch||s===o.FragmentState.NOT_LOADED||s===o.FragmentState.PARTIAL)&&("initSegment"===t.sn?this._loadInitSegment(t):r.live&&!Object(n.isFiniteNumber)(this.initPTS[t.cc])?(this.log("Waiting for video PTS in continuity counter "+t.cc+" of live stream before loading audio fragment "+t.sn+" of level "+this.trackId),this.state=i.State.WAITING_INIT_PTS):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,r,a)))},b.completeAudioSwitch=function(){var t=this.hls,r=this.media,n=this.trackId;r&&(this.log("Switching audio track : flushing all audio"),e.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,t.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:n})},T}(i.default);t.default=T},"./src/controller/audio-track-controller.ts":
40
40
  /*!**************************************************!*\
41
41
  !*** ./src/controller/audio-track-controller.ts ***!
42
42
  \**************************************************/
@@ -48,7 +48,7 @@
48
48
  /*!**************************************************!*\
49
49
  !*** ./src/controller/base-stream-controller.ts ***!
50
50
  \**************************************************/
51
- /*! exports provided: State, default */function(e,t,r){r.r(t),r.d(t,"State",(function(){return T})),r.d(t,"default",(function(){return b}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../task-loop */"./src/task-loop.ts"),a=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),s=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=r(/*! ../utils/logger */"./src/utils/logger.ts"),u=r(/*! ../events */"./src/events.ts"),l=r(/*! ../errors */"./src/errors.ts"),c=r(/*! ./level-helper */"./src/controller/level-helper.ts"),d=r(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),f=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),h=r(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),p=r(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),v=r(/*! ../loader/fragment-loader */"./src/loader/fragment-loader.ts"),g=r(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),m=r(/*! ../utils/time-ranges */"./src/utils/time-ranges.ts"),y=r(/*! ../types/loader */"./src/types/loader.ts");function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var T={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},b=function(e){var t,r;function i(t,r,n){var i;return(i=e.call(this)||this).hls=void 0,i.fragPrevious=null,i.fragCurrent=null,i.fragmentTracker=void 0,i.transmuxer=null,i._state=T.STOPPED,i.media=void 0,i.mediaBuffer=void 0,i.config=void 0,i.bitrateTest=!1,i.lastCurrentTime=0,i.nextLoadPosition=0,i.startPosition=0,i.loadedmetadata=!1,i.fragLoadError=0,i.retryDate=0,i.levels=null,i.fragmentLoader=void 0,i.levelLastLoaded=null,i.startFragRequested=!1,i.decrypter=void 0,i.initPTS=[],i.onvseeking=null,i.onvended=null,i.logPrefix="",i.log=void 0,i.warn=void 0,i.logPrefix=n,i.log=o.logger.log.bind(o.logger,n+":"),i.warn=o.logger.warn.bind(o.logger,n+":"),i.hls=t,i.fragmentLoader=new v.default(t.config),i.fragmentTracker=r,i.config=t.config,i.decrypter=new g.default(t,t.config),t.on(u.Events.KEY_LOADED,i.onKeyLoaded,function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i)),i}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,_(t,r);var b,A,S,L=i.prototype;return L.doTick=function(){this.onTickEnd()},L.onTickEnd=function(){},L.startLoad=function(e){},L.stopLoad=function(){this.fragmentLoader.abort();var e=this.fragCurrent;e&&this.fragmentTracker.removeFragment(e),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},L._streamEnded=function(e,t){var r=this.fragCurrent,n=this.fragmentTracker;if(!t.live&&r&&r.sn===t.endSN&&!e.nextStart){var i=n.getState(r);return i===a.FragmentState.PARTIAL||i===a.FragmentState.OK}return!1},L.onMediaAttached=function(e,t){var r=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),r.addEventListener("seeking",this.onvseeking),r.addEventListener("ended",this.onvended);var n=this.config;this.levels&&n.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(n.startPosition)},L.onMediaDetaching=function(){var e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},L.onMediaSeeking=function(){var e=this.config,t=this.fragCurrent,r=this.media,i=this.mediaBuffer,a=this.state,o=r?r.currentTime:0,u=s.BufferHelper.bufferInfo(i||r,o,e.maxBufferHole);if(this.log("media seeking to "+(Object(n.isFiniteNumber)(o)?o.toFixed(3):o)+", state: "+a),a===T.ENDED)this.resetLoadingState();else if(t&&!u.len){var l=e.maxFragLookUpTolerance,c=t.start-l,d=t.start+t.duration+l;(o<c||o>d)&&(t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.loader.abort()),this.resetLoadingState())}r&&(this.lastCurrentTime=o),this.loadedmetadata||u.len||(this.nextLoadPosition=this.startPosition=o),this.tick()},L.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},L.onKeyLoaded=function(e,t){if(this.state===T.KEY_LOADING&&t.frag===this.fragCurrent&&this.levels){this.state=T.IDLE;var r=this.levels[t.frag.level].details;r&&this.loadFragment(t.frag,r,t.frag.start)}},L.onHandlerDestroying=function(){this.stopLoad(),e.prototype.onHandlerDestroying.call(this)},L.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(u.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,e.prototype.onHandlerDestroyed.call(this)},L.loadKey=function(e,t){this.log("Loading key for "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level),this.state=T.KEY_LOADING,this.fragCurrent=e,this.hls.trigger(u.Events.KEY_LOADING,{frag:e})},L.loadFragment=function(e,t,r){this._loadFragForPlayback(e,t,r)},L._loadFragForPlayback=function(e,t,r){var n=this;this._doFragLoad(e,t,r,(function(t){if(n.fragContextChanged(e))return n.warn("Fragment "+e.sn+(t.part?" p: "+t.part.index:"")+" of level "+e.level+" was dropped during download."),void n.fragmentTracker.removeFragment(e);e.stats.chunkCount++,n._handleFragmentLoadProgress(t)})).then((function(t){if(t){n.fragLoadError=0;var r=n.state;if(!n.fragContextChanged(e))return"payload"in t&&(n.log("Loaded fragment "+e.sn+" of level "+e.level),n.hls.trigger(u.Events.FRAG_LOADED,t),n.state===T.BACKTRACKING)?(n.fragmentTracker.backtrack(e,t),void n.resetFragmentLoading(e)):void n._handleFragmentLoadComplete(t);(r===T.FRAG_LOADING||r===T.BACKTRACKING||!n.fragCurrent&&r===T.PARSING)&&(n.fragmentTracker.removeFragment(e),n.state=T.IDLE)}})).catch((function(t){n.warn(t),n.resetFragmentLoading(e)}))},L.flushMainBuffer=function(e,t,r){void 0===r&&(r=null);var n={startOffset:e,endOffset:t,type:r};this.fragLoadError=0,this.hls.trigger(u.Events.BUFFER_FLUSHING,n)},L._loadInitSegment=function(e){var t=this;this._doFragLoad(e).then((function(r){if(!r||t.fragContextChanged(e)||!t.levels)throw new Error("init load aborted");return r})).then((function(r){var n=t.hls,i=r.payload,a=e.decryptdata;if(i&&i.byteLength>0&&a&&a.key&&a.iv&&"AES-128"===a.method){var s=self.performance.now();return t.decrypter.webCryptoDecrypt(new Uint8Array(i),a.key.buffer,a.iv.buffer).then((function(t){var i=self.performance.now();return n.trigger(u.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:s,tdecrypt:i}}),r.payload=t,r}))}return r})).then((function(r){var n=t.fragCurrent,i=t.hls,a=t.levels;if(!a)throw new Error("init load aborted, missing levels");var s=a[e.level].details;console.assert(s,"Level details are defined when init segment is loaded");var o=s.initSegment;console.assert(o,"Fragment initSegment is defined when init segment is loaded");var l=e.stats;t.state=T.IDLE,t.fragLoadError=0,o.data=new Uint8Array(r.payload),l.parsing.start=l.buffering.start=self.performance.now(),l.parsing.end=l.buffering.end=self.performance.now(),r.frag===n&&i.trigger(u.Events.FRAG_BUFFERED,{stats:l,frag:n,part:null,id:e.type}),t.tick()})).catch((function(r){t.warn(r),t.resetFragmentLoading(e)}))},L.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId},L.fragBufferedComplete=function(e,t){var r=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level+" "+m.default.toString(s.BufferHelper.getBuffered(r))),this.state=T.IDLE,this.tick()},L._handleFragmentLoadComplete=function(e){var t=this.transmuxer;if(t){var r=e.frag,n=e.part,i=e.partsLoaded,a=!i||0===i.length||i.some((function(e){return!e})),s=new d.ChunkMetadata(r.level,r.sn,r.stats.chunkCount+1,0,n?n.index:-1,!a);t.flush(s)}},L._handleFragmentLoadProgress=function(e){},L._doFragLoad=function(e,t,r,i){var a=this;if(void 0===r&&(r=null),!this.levels)throw new Error("frag load aborted, missing levels");if(r=Math.max(e.start,r||0),this.config.lowLatencyMode&&t){var s=t.partList;if(s&&i){r>e.end&&t.fragmentHint&&(e=t.fragmentHint);var o=this.getNextPart(s,e,r);if(o>-1){var l=s[o];return this.log("Loading part sn: "+e.sn+" p: "+l.index+" cc: "+e.cc+" of playlist ["+t.startSN+"-"+t.endSN+"] parts [0-"+o+"-"+(s.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(r.toFixed(3))),this.nextLoadPosition=l.start+l.duration,this.state=T.FRAG_LOADING,this.hls.trigger(u.Events.FRAG_LOADING,{frag:e,part:s[o],targetBufferTime:r}),this.doFragPartsLoad(e,s,o,i).catch((function(e){return a.handleFragLoadError(e)}))}if(!e.url||this.loadedEndOfParts(s,r))return Promise.resolve(null)}}return this.log("Loading fragment "+e.sn+" cc: "+e.cc+" "+(t?"of ["+t.startSN+"-"+t.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(r.toFixed(3))),Object(n.isFiniteNumber)(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=T.FRAG_LOADING,this.hls.trigger(u.Events.FRAG_LOADING,{frag:e,targetBufferTime:r}),this.fragmentLoader.load(e,i).catch((function(e){return a.handleFragLoadError(e)}))},L.doFragPartsLoad=function(e,t,r,n){var i=this;return new Promise((function(a,s){var o=[];!function r(l){var c=t[l];i.fragmentLoader.loadPart(e,c,n).then((function(n){o[c.index]=n;var s=n.part;i.hls.trigger(u.Events.FRAG_LOADED,n);var d=t[l+1];if(!d||d.fragment!==e)return a({frag:e,part:s,partsLoaded:o});r(l+1)})).catch(s)}(r)}))},L.handleFragLoadError=function(e){var t=e.data;return t&&t.details===l.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(u.Events.ERROR,t),null},L._handleTransmuxerFlush=function(e){var t=this.getCurrentContext(e);if(t&&this.state===T.PARSING){var r=t.frag,n=t.part,i=t.level,a=self.performance.now();r.stats.parsing.end=a,n&&(n.stats.parsing.end=a),this.updateLevelTiming(r,n,i,e.partial)}else this.fragCurrent||(this.state=T.IDLE)},L.getCurrentContext=function(e){var t=this.levels,r=e.level,n=e.sn,i=e.part;if(!t||!t[r])return this.warn("Levels object was unset while buffering fragment "+n+" of level "+r+". The current chunk will not be buffered."),null;var a=t[r],s=i>-1?c.getPartWith(a,n,i):null,o=s?s.fragment:c.getFragmentWithSN(a,n);return o?{frag:o,part:s,level:a}:null},L.bufferFragmentData=function(e,t,r,n){if(e&&this.state===T.PARSING){var i=e.data1,a=e.data2,s=i;if(i&&a&&(s=Object(f.appendUint8Array)(i,a)),s&&s.length){var o={type:e.type,frag:t,part:r,chunkMeta:n,parent:t.type,data:s};this.hls.trigger(u.Events.BUFFER_APPENDING,o),e.dropped&&e.independent&&!r&&this.flushBufferGap(t)}}},L.flushBufferGap=function(e){var t=this.media;if(t)if(s.BufferHelper.isBuffered(t,t.currentTime)){var r=t.currentTime,n=s.BufferHelper.bufferInfo(t,r,0),i=e.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),o=Math.max(Math.min(e.start-a,n.end-a),r+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}else this.flushMainBuffer(0,e.start)},L.reduceMaxBufferLength=function(e){var t=this.config,r=e||t.maxBufferLength;return t.maxMaxBufferLength>=r&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},L.getNextFragment=function(e,t){var r=t.fragments,n=r.length;if(!n)return null;var i,a=this.config,s=r[0].start;if(!t.initSegment||t.initSegment.data||this.bitrateTest)if(t.live){var o=a.initialLiveManifestSize;if(n<o)return this.warn("Not enough fragments to start playback (have: "+n+", need: "+o+")"),null;t.PTSKnown||this.startFragRequested||-1!==this.startPosition||(i=this.getInitialLiveFragment(t,r),this.startPosition=i?this.hls.liveSyncPosition||i.start:e)}else e<=s&&(i=r[0]);else i=t.initSegment;if(!i){var u=a.lowLatencyMode?t.partEnd:t.fragmentEnd;i=this.getFragmentAtPosition(e,u,t)}return i},L.getNextPart=function(e,t,r){for(var n=-1,i=!1,a=!0,s=0,o=e.length;s<o;s++){var u=e[s];if(a=a&&!u.independent,n>-1&&r<u.start)break;var l=u.loaded;!l&&(i||u.independent||a)&&u.fragment===t&&(n=s),i=l}return n},L.loadedEndOfParts=function(e,t){var r=e[e.length-1];return r&&t>r.start&&r.loaded},L.getInitialLiveFragment=function(e,t){var r=this.fragPrevious,n=null;if(r){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),n=Object(p.findFragmentByPDT)(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){var i=r.sn+1;if(i>=e.startSN&&i<=e.endSN){var a=t[i-e.startSN];r.cc===a.cc&&(n=a,this.log("Live playlist, switching playlist, load frag with next SN: "+n.sn))}n||(n=Object(p.findFragWithCC)(t,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+n.sn)}}else{var s=this.hls.liveSyncPosition;null!==s&&(n=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n},L.getFragmentAtPosition=function(e,t,r){var n,i=this.config,s=this.fragPrevious,o=r.fragments,u=r.endSN,l=r.fragmentHint,c=i.maxFragLookUpTolerance,d=!!(i.lowLatencyMode&&r.partList&&l);if(d&&l&&!this.bitrateTest&&(o=o.concat(l),u=l.sn),e<t){var f=e>t-c?0:c;n=Object(p.findFragmentByPTS)(s,o,e,f)}else n=o[o.length-1];if(n){var h=n.sn-r.startSN,v=s&&n.level===s.level,g=o[h+1];if(this.fragmentTracker.getState(n)===a.FragmentState.BACKTRACKED){n=null;for(var m=h;o[m]&&this.fragmentTracker.getState(o[m])===a.FragmentState.BACKTRACKED;)n=s?o[m--]:o[--m];n||(n=g)}else s&&n.sn===s.sn&&!d&&v&&(n.sn<u&&this.fragmentTracker.getState(g)!==a.FragmentState.OK?(this.log("SN "+n.sn+" just loaded, load next one: "+g.sn),n=g):n=null)}return n},L.synchronizeToLiveEdge=function(e){var t=this.config,r=this.media;if(r){var n=this.hls.liveSyncPosition,i=r.currentTime,a=e.fragments[0].start,s=e.edge,o=i>=a-t.maxFragLookUpTolerance&&i<=s;if(null!==n&&r.duration>n&&(i<n||!o)){var u=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!o&&r.readyState<4||i<s-u)&&(this.loadedmetadata||(this.nextLoadPosition=n),r.readyState&&(this.warn("Playback: "+i.toFixed(3)+" is located too far from the end of live sliding playlist: "+s+", reset currentTime to : "+n.toFixed(3)),r.currentTime=n))}}},L.alignPlaylists=function(e,t){var r=this.levels,i=this.levelLastLoaded,a=null!==i?r[i]:null,s=0;return t&&e.fragments.length>0?(s=e.fragments[0].start,e.alignedSliding&&Object(n.isFiniteNumber)(s)?this.log("Live playlist sliding:"+s.toFixed(3)):s||(this.warn("["+this.constructor.name+"] Live playlist - outdated PTS, unknown sliding"),Object(h.alignStream)(this.fragPrevious,a,e))):(this.log("Live playlist - first load, unknown sliding"),Object(h.alignStream)(this.fragPrevious,a,e)),s},L.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},L.setStartPosition=function(e,t){var r=this.startPosition;if(-1===this.startPosition||-1===this.lastCurrentTime){var i=e.startTimeOffset;Object(n.isFiniteNumber)(i)?(i<0&&(this.log("Negative start time offset "+i+", count from end of last fragment"),i=t+e.totalduration+i),this.log("Start time offset found in playlist, adjust startPosition to "+i),this.startPosition=r=i):e.live?r=this.hls.liveSyncPosition||t:this.startPosition=r=0,this.lastCurrentTime=r}this.nextLoadPosition=r},L.getLoadPosition=function(){var e=this.media,t=0;return this.loadedmetadata?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t},L.handleFragLoadAborted=function(e,t){this.transmuxer&&"initSegment"!==e.sn&&(this.warn("Fragment "+e.sn+(t?" part"+t.index:"")+" of level "+e.level+" was aborted"),this.resetFragmentLoading(e))},L.resetFragmentLoading=function(e){this.fragCurrent&&this.fragContextChanged(e)||(this.state=T.IDLE)},L.onFragmentOrKeyLoadError=function(e,t){if(!t.fatal){var r=t.frag;if(r&&r.type===e){var n=this.fragCurrent;console.assert(n&&r.sn===n.sn&&r.level===n.level&&r.urlId===n.urlId,"Frag load error must match current frag to retry");var i=this.config;if(this.fragLoadError+1<=i.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(r.level))return;var a=Math.min(Math.pow(2,this.fragLoadError)*i.fragLoadingRetryDelay,i.fragLoadingMaxRetryTimeout);this.warn("Fragment "+r.sn+" of "+e+" "+r.level+" failed to load, retrying in "+a+"ms"),this.retryDate=self.performance.now()+a,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else t.levelRetry?(e===y.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(o.logger.error(t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)}}},L.afterBufferFlushed=function(e,t,r){if(e){var n=s.BufferHelper.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,r),this.state===T.ENDED&&this.resetLoadingState()}},L.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},L.resetLiveStartWhenNotLoaded=function(e){if(!this.loadedmetadata){this.startFragRequested=!1;var t=this.levels?this.levels[e].details:null;if(null!=t&&t.live)return this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},L.updateLevelTiming=function(e,t,r,n){var i=this,a=r.details;console.assert(!!a,"level.details must be defined"),Object.keys(e.elementaryStreams).reduce((function(t,s){var o=e.elementaryStreams[s];if(o){var l=o.endPTS-o.startPTS;if(l<=0)return i.warn("Could not parse fragment "+e.sn+" "+s+" duration reliably ("+l+") resetting transmuxer to fallback to playlist timing"),i.resetTransmuxer(),t||!1;var d=n?0:c.updateFragPTSDTS(a,e,o.startPTS,o.endPTS,o.startDTS,o.endDTS);return i.hls.trigger(u.Events.LEVEL_PTS_UPDATED,{details:a,level:r,drift:d,type:s,frag:e,start:o.startPTS,end:o.endPTS}),!0}return t}),!1)?(this.state=T.PARSED,this.hls.trigger(u.Events.FRAG_PARSED,{frag:e,part:t})):this.resetLoadingState()},L.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},b=i,(A=[{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}])&&E(b.prototype,A),S&&E(b,S),i}(i.default)},"./src/controller/buffer-controller.ts":
51
+ /*! exports provided: State, default */function(e,t,r){r.r(t),r.d(t,"State",(function(){return T})),r.d(t,"default",(function(){return b}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../task-loop */"./src/task-loop.ts"),a=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),s=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),o=r(/*! ../utils/logger */"./src/utils/logger.ts"),u=r(/*! ../events */"./src/events.ts"),l=r(/*! ../errors */"./src/errors.ts"),c=r(/*! ./level-helper */"./src/controller/level-helper.ts"),d=r(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),f=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),h=r(/*! ../utils/discontinuities */"./src/utils/discontinuities.ts"),p=r(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),v=r(/*! ../loader/fragment-loader */"./src/loader/fragment-loader.ts"),g=r(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),m=r(/*! ../utils/time-ranges */"./src/utils/time-ranges.ts"),y=r(/*! ../types/loader */"./src/types/loader.ts");function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var T={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},b=function(e){var t,r;function i(t,r,n){var i;return(i=e.call(this)||this).hls=void 0,i.fragPrevious=null,i.fragCurrent=null,i.fragmentTracker=void 0,i.transmuxer=null,i._state=T.STOPPED,i.media=void 0,i.mediaBuffer=void 0,i.config=void 0,i.bitrateTest=!1,i.lastCurrentTime=0,i.nextLoadPosition=0,i.startPosition=0,i.loadedmetadata=!1,i.fragLoadError=0,i.retryDate=0,i.levels=null,i.fragmentLoader=void 0,i.levelLastLoaded=null,i.startFragRequested=!1,i.decrypter=void 0,i.initPTS=[],i.onvseeking=null,i.onvended=null,i.logPrefix="",i.log=void 0,i.warn=void 0,i.logPrefix=n,i.log=o.logger.log.bind(o.logger,n+":"),i.warn=o.logger.warn.bind(o.logger,n+":"),i.hls=t,i.fragmentLoader=new v.default(t.config),i.fragmentTracker=r,i.config=t.config,i.decrypter=new g.default(t,t.config),t.on(u.Events.KEY_LOADED,i.onKeyLoaded,function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i)),i}r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,_(t,r);var b,S,A,L=i.prototype;return L.doTick=function(){this.onTickEnd()},L.onTickEnd=function(){},L.startLoad=function(e){},L.stopLoad=function(){this.fragmentLoader.abort();var e=this.fragCurrent;e&&this.fragmentTracker.removeFragment(e),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},L._streamEnded=function(e,t){var r=this.fragCurrent,n=this.fragmentTracker;if(!t.live&&r&&r.sn===t.endSN&&!e.nextStart){var i=n.getState(r);return i===a.FragmentState.PARTIAL||i===a.FragmentState.OK}return!1},L.onMediaAttached=function(e,t){var r=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),r.addEventListener("seeking",this.onvseeking),r.addEventListener("ended",this.onvended);var n=this.config;this.levels&&n.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(n.startPosition)},L.onMediaDetaching=function(){var e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},L.onMediaSeeking=function(){var e=this.config,t=this.fragCurrent,r=this.media,i=this.mediaBuffer,a=this.state,o=r?r.currentTime:0,u=s.BufferHelper.bufferInfo(i||r,o,e.maxBufferHole);if(this.log("media seeking to "+(Object(n.isFiniteNumber)(o)?o.toFixed(3):o)+", state: "+a),a===T.ENDED)this.resetLoadingState();else if(t&&!u.len){var l=e.maxFragLookUpTolerance,c=t.start-l,d=t.start+t.duration+l;(o<c||o>d)&&(t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.loader.abort()),this.resetLoadingState())}r&&(this.lastCurrentTime=o),this.loadedmetadata||u.len||(this.nextLoadPosition=this.startPosition=o),this.tick()},L.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},L.onKeyLoaded=function(e,t){if(this.state===T.KEY_LOADING&&t.frag===this.fragCurrent&&this.levels){this.state=T.IDLE;var r=this.levels[t.frag.level].details;r&&this.loadFragment(t.frag,r,t.frag.start)}},L.onHandlerDestroying=function(){this.stopLoad(),e.prototype.onHandlerDestroying.call(this)},L.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(u.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,e.prototype.onHandlerDestroyed.call(this)},L.loadKey=function(e,t){this.log("Loading key for "+e.sn+" of ["+t.startSN+"-"+t.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level),this.state=T.KEY_LOADING,this.fragCurrent=e,this.hls.trigger(u.Events.KEY_LOADING,{frag:e})},L.loadFragment=function(e,t,r){this._loadFragForPlayback(e,t,r)},L._loadFragForPlayback=function(e,t,r){var n=this;this._doFragLoad(e,t,r,(function(t){if(n.fragContextChanged(e))return n.warn("Fragment "+e.sn+(t.part?" p: "+t.part.index:"")+" of level "+e.level+" was dropped during download."),void n.fragmentTracker.removeFragment(e);e.stats.chunkCount++,n._handleFragmentLoadProgress(t)})).then((function(t){if(t){n.fragLoadError=0;var r=n.state;if(!n.fragContextChanged(e))return"payload"in t&&(n.log("Loaded fragment "+e.sn+" of level "+e.level),n.hls.trigger(u.Events.FRAG_LOADED,t),n.state===T.BACKTRACKING)?(n.fragmentTracker.backtrack(e,t),void n.resetFragmentLoading(e)):void n._handleFragmentLoadComplete(t);(r===T.FRAG_LOADING||r===T.BACKTRACKING||!n.fragCurrent&&r===T.PARSING)&&(n.fragmentTracker.removeFragment(e),n.state=T.IDLE)}})).catch((function(t){n.warn(t),n.resetFragmentLoading(e)}))},L.flushMainBuffer=function(e,t,r){void 0===r&&(r=null);var n={startOffset:e,endOffset:t,type:r};this.fragLoadError=0,this.hls.trigger(u.Events.BUFFER_FLUSHING,n)},L._loadInitSegment=function(e){var t=this;this._doFragLoad(e).then((function(r){if(!r||t.fragContextChanged(e)||!t.levels)throw new Error("init load aborted");return r})).then((function(r){var n=t.hls,i=r.payload,a=e.decryptdata;if(i&&i.byteLength>0&&a&&a.key&&a.iv&&"AES-128"===a.method){var s=self.performance.now();return t.decrypter.webCryptoDecrypt(new Uint8Array(i),a.key.buffer,a.iv.buffer).then((function(t){var i=self.performance.now();return n.trigger(u.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:s,tdecrypt:i}}),r.payload=t,r}))}return r})).then((function(r){var n=t.fragCurrent,i=t.hls,a=t.levels;if(!a)throw new Error("init load aborted, missing levels");var s=a[e.level].details;console.assert(s,"Level details are defined when init segment is loaded");var o=s.initSegment;console.assert(o,"Fragment initSegment is defined when init segment is loaded");var l=e.stats;t.state=T.IDLE,t.fragLoadError=0,o.data=new Uint8Array(r.payload),l.parsing.start=l.buffering.start=self.performance.now(),l.parsing.end=l.buffering.end=self.performance.now(),r.frag===n&&i.trigger(u.Events.FRAG_BUFFERED,{stats:l,frag:n,part:null,id:e.type}),t.tick()})).catch((function(r){t.warn(r),t.resetFragmentLoading(e)}))},L.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.level!==t.level||e.sn!==t.sn||e.urlId!==t.urlId},L.fragBufferedComplete=function(e,t){var r=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level+" "+m.default.toString(s.BufferHelper.getBuffered(r))),this.state=T.IDLE,this.tick()},L._handleFragmentLoadComplete=function(e){var t=this.transmuxer;if(t){var r=e.frag,n=e.part,i=e.partsLoaded,a=!i||0===i.length||i.some((function(e){return!e})),s=new d.ChunkMetadata(r.level,r.sn,r.stats.chunkCount+1,0,n?n.index:-1,!a);t.flush(s)}},L._handleFragmentLoadProgress=function(e){},L._doFragLoad=function(e,t,r,i){var a=this;if(void 0===r&&(r=null),!this.levels)throw new Error("frag load aborted, missing levels");if(r=Math.max(e.start,r||0),this.config.lowLatencyMode&&t){var s=t.partList;if(s&&i){r>e.end&&t.fragmentHint&&(e=t.fragmentHint);var o=this.getNextPart(s,e,r);if(o>-1){var l=s[o];return this.log("Loading part sn: "+e.sn+" p: "+l.index+" cc: "+e.cc+" of playlist ["+t.startSN+"-"+t.endSN+"] parts [0-"+o+"-"+(s.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(r.toFixed(3))),this.nextLoadPosition=l.start+l.duration,this.state=T.FRAG_LOADING,this.hls.trigger(u.Events.FRAG_LOADING,{frag:e,part:s[o],targetBufferTime:r}),this.doFragPartsLoad(e,s,o,i).catch((function(e){return a.handleFragLoadError(e)}))}if(!e.url||this.loadedEndOfParts(s,r))return Promise.resolve(null)}}return this.log("Loading fragment "+e.sn+" cc: "+e.cc+" "+(t?"of ["+t.startSN+"-"+t.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(r.toFixed(3))),Object(n.isFiniteNumber)(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=T.FRAG_LOADING,this.hls.trigger(u.Events.FRAG_LOADING,{frag:e,targetBufferTime:r}),this.fragmentLoader.load(e,i).catch((function(e){return a.handleFragLoadError(e)}))},L.doFragPartsLoad=function(e,t,r,n){var i=this;return new Promise((function(a,s){var o=[];!function r(l){var c=t[l];i.fragmentLoader.loadPart(e,c,n).then((function(n){o[c.index]=n;var s=n.part;i.hls.trigger(u.Events.FRAG_LOADED,n);var d=t[l+1];if(!d||d.fragment!==e)return a({frag:e,part:s,partsLoaded:o});r(l+1)})).catch(s)}(r)}))},L.handleFragLoadError=function(e){var t=e.data;return t&&t.details===l.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(u.Events.ERROR,t),null},L._handleTransmuxerFlush=function(e){var t=this.getCurrentContext(e);if(t&&this.state===T.PARSING){var r=t.frag,n=t.part,i=t.level,a=self.performance.now();r.stats.parsing.end=a,n&&(n.stats.parsing.end=a),this.updateLevelTiming(r,n,i,e.partial)}else this.fragCurrent||(this.state=T.IDLE)},L.getCurrentContext=function(e){var t=this.levels,r=e.level,n=e.sn,i=e.part;if(!t||!t[r])return this.warn("Levels object was unset while buffering fragment "+n+" of level "+r+". The current chunk will not be buffered."),null;var a=t[r],s=i>-1?c.getPartWith(a,n,i):null,o=s?s.fragment:c.getFragmentWithSN(a,n);return o?{frag:o,part:s,level:a}:null},L.bufferFragmentData=function(e,t,r,n){if(e&&this.state===T.PARSING){var i=e.data1,a=e.data2,s=i;if(i&&a&&(s=Object(f.appendUint8Array)(i,a)),s&&s.length){var o={type:e.type,frag:t,part:r,chunkMeta:n,parent:t.type,data:s};this.hls.trigger(u.Events.BUFFER_APPENDING,o),e.dropped&&e.independent&&!r&&this.flushBufferGap(t)}}},L.flushBufferGap=function(e){var t=this.media;if(t)if(s.BufferHelper.isBuffered(t,t.currentTime)){var r=t.currentTime,n=s.BufferHelper.bufferInfo(t,r,0),i=e.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),o=Math.max(Math.min(e.start-a,n.end-a),r+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}else this.flushMainBuffer(0,e.start)},L.reduceMaxBufferLength=function(e){var t=this.config,r=e||t.maxBufferLength;return t.maxMaxBufferLength>=r&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},L.getNextFragment=function(e,t){var r=t.fragments,n=r.length;if(!n)return null;var i,a=this.config,s=r[0].start;if(!t.initSegment||t.initSegment.data||this.bitrateTest)if(t.live){var o=a.initialLiveManifestSize;if(n<o)return this.warn("Not enough fragments to start playback (have: "+n+", need: "+o+")"),null;t.PTSKnown||this.startFragRequested||-1!==this.startPosition||(i=this.getInitialLiveFragment(t,r),this.startPosition=i?this.hls.liveSyncPosition||i.start:e)}else e<=s&&(i=r[0]);else i=t.initSegment;if(!i){var u=a.lowLatencyMode?t.partEnd:t.fragmentEnd;i=this.getFragmentAtPosition(e,u,t)}return i},L.getNextPart=function(e,t,r){for(var n=-1,i=!1,a=!0,s=0,o=e.length;s<o;s++){var u=e[s];if(a=a&&!u.independent,n>-1&&r<u.start)break;var l=u.loaded;!l&&(i||u.independent||a)&&u.fragment===t&&(n=s),i=l}return n},L.loadedEndOfParts=function(e,t){var r=e[e.length-1];return r&&t>r.start&&r.loaded},L.getInitialLiveFragment=function(e,t){var r=this.fragPrevious,n=null;if(r){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),n=Object(p.findFragmentByPDT)(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){var i=r.sn+1;if(i>=e.startSN&&i<=e.endSN){var a=t[i-e.startSN];r.cc===a.cc&&(n=a,this.log("Live playlist, switching playlist, load frag with next SN: "+n.sn))}n||(n=Object(p.findFragWithCC)(t,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+n.sn)}}else{var s=this.hls.liveSyncPosition;null!==s&&(n=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n},L.getFragmentAtPosition=function(e,t,r){var n,i=this.config,s=this.fragPrevious,o=r.fragments,u=r.endSN,l=r.fragmentHint,c=i.maxFragLookUpTolerance,d=!!(i.lowLatencyMode&&r.partList&&l);if(d&&l&&!this.bitrateTest&&(o=o.concat(l),u=l.sn),e<t){var f=e>t-c?0:c;n=Object(p.findFragmentByPTS)(s,o,e,f)}else n=o[o.length-1];if(n){var h=n.sn-r.startSN,v=s&&n.level===s.level,g=o[h+1];if(this.fragmentTracker.getState(n)===a.FragmentState.BACKTRACKED){n=null;for(var m=h;o[m]&&this.fragmentTracker.getState(o[m])===a.FragmentState.BACKTRACKED;)n=s?o[m--]:o[--m];n||(n=g)}else s&&n.sn===s.sn&&!d&&v&&(n.sn<u&&this.fragmentTracker.getState(g)!==a.FragmentState.OK?(this.log("SN "+n.sn+" just loaded, load next one: "+g.sn),n=g):n=null)}return n},L.synchronizeToLiveEdge=function(e){var t=this.config,r=this.media;if(r){var n=this.hls.liveSyncPosition,i=r.currentTime,a=e.fragments[0].start,s=e.edge,o=i>=a-t.maxFragLookUpTolerance&&i<=s;if(null!==n&&r.duration>n&&(i<n||!o)){var u=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!o&&r.readyState<4||i<s-u)&&(this.loadedmetadata||(this.nextLoadPosition=n),r.readyState&&(this.warn("Playback: "+i.toFixed(3)+" is located too far from the end of live sliding playlist: "+s+", reset currentTime to : "+n.toFixed(3)),r.currentTime=n))}}},L.alignPlaylists=function(e,t){var r=this.levels,i=this.levelLastLoaded,a=null!==i?r[i]:null,s=0;return t&&e.fragments.length>0?(s=e.fragments[0].start,e.alignedSliding&&Object(n.isFiniteNumber)(s)?this.log("Live playlist sliding:"+s.toFixed(3)):s||(this.warn("["+this.constructor.name+"] Live playlist - outdated PTS, unknown sliding"),Object(h.alignStream)(this.fragPrevious,a,e))):(this.log("Live playlist - first load, unknown sliding"),Object(h.alignStream)(this.fragPrevious,a,e)),s},L.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},L.setStartPosition=function(e,t){var r=this.startPosition;if(-1===this.startPosition||-1===this.lastCurrentTime){var i=e.startTimeOffset;Object(n.isFiniteNumber)(i)?(i<0&&(this.log("Negative start time offset "+i+", count from end of last fragment"),i=t+e.totalduration+i),this.log("Start time offset found in playlist, adjust startPosition to "+i),this.startPosition=r=i):e.live?r=this.hls.liveSyncPosition||t:this.startPosition=r=0,this.lastCurrentTime=r}this.nextLoadPosition=r},L.getLoadPosition=function(){var e=this.media,t=0;return this.loadedmetadata?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t},L.handleFragLoadAborted=function(e,t){this.transmuxer&&"initSegment"!==e.sn&&(this.warn("Fragment "+e.sn+(t?" part"+t.index:"")+" of level "+e.level+" was aborted"),this.resetFragmentLoading(e))},L.resetFragmentLoading=function(e){this.fragCurrent&&this.fragContextChanged(e)||(this.state=T.IDLE)},L.onFragmentOrKeyLoadError=function(e,t){if(!t.fatal){var r=t.frag;if(r&&r.type===e){var n=this.fragCurrent;console.assert(n&&r.sn===n.sn&&r.level===n.level&&r.urlId===n.urlId,"Frag load error must match current frag to retry");var i=this.config;if(this.fragLoadError+1<=i.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(r.level))return;var a=Math.min(Math.pow(2,this.fragLoadError)*i.fragLoadingRetryDelay,i.fragLoadingMaxRetryTimeout);this.warn("Fragment "+r.sn+" of "+e+" "+r.level+" failed to load, retrying in "+a+"ms"),this.retryDate=self.performance.now()+a,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else t.levelRetry?(e===y.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(o.logger.error(t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)}}},L.afterBufferFlushed=function(e,t,r){if(e){var n=s.BufferHelper.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,r),this.state===T.ENDED&&this.resetLoadingState()}},L.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},L.resetLiveStartWhenNotLoaded=function(e){if(!this.loadedmetadata){this.startFragRequested=!1;var t=this.levels?this.levels[e].details:null;if(null!=t&&t.live)return this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},L.updateLevelTiming=function(e,t,r,n){var i=this,a=r.details;console.assert(!!a,"level.details must be defined"),Object.keys(e.elementaryStreams).reduce((function(t,s){var o=e.elementaryStreams[s];if(o){var l=o.endPTS-o.startPTS;if(l<=0)return i.warn("Could not parse fragment "+e.sn+" "+s+" duration reliably ("+l+") resetting transmuxer to fallback to playlist timing"),i.resetTransmuxer(),t||!1;var d=n?0:c.updateFragPTSDTS(a,e,o.startPTS,o.endPTS,o.startDTS,o.endDTS);return i.hls.trigger(u.Events.LEVEL_PTS_UPDATED,{details:a,level:r,drift:d,type:s,frag:e,start:o.startPTS,end:o.endPTS}),!0}return t}),!1)?(this.state=T.PARSED,this.hls.trigger(u.Events.FRAG_PARSED,{frag:e,part:t})):this.resetLoadingState()},L.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},b=i,(S=[{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}])&&E(b.prototype,S),A&&E(b,A),i}(i.default)},"./src/controller/buffer-controller.ts":
52
52
  /*!*********************************************!*\
53
53
  !*** ./src/controller/buffer-controller.ts ***!
54
54
  \*********************************************/
@@ -80,7 +80,7 @@
80
80
  /*!******************************************!*\
81
81
  !*** ./src/controller/gap-controller.ts ***!
82
82
  \******************************************/
83
- /*! exports provided: STALL_MINIMUM_DURATION_MS, MAX_START_GAP_JUMP, SKIP_BUFFER_HOLE_STEP_SECONDS, SKIP_BUFFER_RANGE_START, default */function(e,t,r){r.r(t),r.d(t,"STALL_MINIMUM_DURATION_MS",(function(){return o})),r.d(t,"MAX_START_GAP_JUMP",(function(){return u})),r.d(t,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return l})),r.d(t,"SKIP_BUFFER_RANGE_START",(function(){return c})),r.d(t,"default",(function(){return d}));var n=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../events */"./src/events.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=250,u=2,l=.1,c=.05,d=function(){function e(e,t,r,n){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=r,this.hls=n}var t=e.prototype;return t.destroy=function(){this.hls=this.fragmentTracker=this.media=null},t.poll=function(e){var t=this.config,r=this.media,i=this.stalled,a=r.currentTime,l=r.seeking,c=this.seeking&&!l,d=!this.seeking&&l;if(this.seeking=l,a===e){if((d||c)&&(this.stalled=null),!r.paused&&!r.ended&&0!==r.playbackRate&&n.BufferHelper.getBuffered(r).length){var f=n.BufferHelper.bufferInfo(r,a,0),h=f.len>0,p=f.nextStart||0;if(h||p){if(l){var v=f.len>u,g=!p||p-a>u&&!this.fragmentTracker.getPartialFragment(a);if(v||g)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var m,y=Math.max(p,f.start||0)-a,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,_=(null==E||null===(m=E.details)||void 0===m?void 0:m.live)?2*E.details.targetduration:u;if(y>0&&y<=_)return void this._trySkipBufferHole(null)}var T=self.performance.now();if(null!==i){var b=T-i;!l&&b>=o&&this._reportStall(f.len);var A=n.BufferHelper.bufferInfo(r,a,t.maxBufferHole);this._tryFixBufferStall(A,b)}else this.stalled=T}}}else if(this.moved=!0,null!==i){if(this.stallReported){var S=self.performance.now()-i;s.logger.warn("playback not stuck anymore @"+a+", after "+Math.round(S)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},t._tryFixBufferStall=function(e,t){var r=this.config,n=this.fragmentTracker,i=this.media.currentTime,a=n.getPartialFragment(i);a&&this._trySkipBufferHole(a)||e.len>r.maxBufferHole&&t>1e3*r.highBufferWatchdogPeriod&&(s.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,r=this.media;this.stallReported||(this.stallReported=!0,s.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,r=this.hls,o=this.media,u=o.currentTime,d=0,f=n.BufferHelper.getBuffered(o),h=0;h<f.length;h++){var p=f.start(h);if(u+t.maxBufferHole>=d&&u<p){var v=Math.max(p+c,o.currentTime+l);return s.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+v),this.moved=!0,this.stalled=null,o.currentTime=v,e&&r.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+v,frag:e}),v}d=f.end(h)}return 0},t._tryNudgeBuffer=function(){var e=this.config,t=this.hls,r=this.media,n=r.currentTime,o=(this.nudgeRetry||0)+1;if(this.nudgeRetry=o,o<e.nudgeMaxRetry){var u=n+o*e.nudgeOffset;s.logger.warn("Nudging 'currentTime' from "+n+" to "+u),r.currentTime=u,t.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else s.logger.error("Playhead still not moving while enough data buffered @"+n+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},e}()},"./src/controller/id3-track-controller.ts":
83
+ /*! exports provided: STALL_MINIMUM_DURATION_MS, MAX_START_GAP_JUMP, SKIP_BUFFER_HOLE_STEP_SECONDS, SKIP_BUFFER_RANGE_START, default */function(e,t,r){r.r(t),r.d(t,"STALL_MINIMUM_DURATION_MS",(function(){return o})),r.d(t,"MAX_START_GAP_JUMP",(function(){return u})),r.d(t,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return l})),r.d(t,"SKIP_BUFFER_RANGE_START",(function(){return c})),r.d(t,"default",(function(){return d}));var n=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../events */"./src/events.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=250,u=2,l=.1,c=.05,d=function(){function e(e,t,r,n){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=r,this.hls=n}var t=e.prototype;return t.destroy=function(){this.hls=this.fragmentTracker=this.media=null},t.poll=function(e){var t=this.config,r=this.media,i=this.stalled,a=r.currentTime,l=r.seeking,c=this.seeking&&!l,d=!this.seeking&&l;if(this.seeking=l,a===e){if((d||c)&&(this.stalled=null),!r.paused&&!r.ended&&0!==r.playbackRate&&n.BufferHelper.getBuffered(r).length){var f=n.BufferHelper.bufferInfo(r,a,0),h=f.len>0,p=f.nextStart||0;if(h||p){if(l){var v=f.len>u,g=!p||p-a>u&&!this.fragmentTracker.getPartialFragment(a);if(v||g)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var m,y=Math.max(p,f.start||0)-a,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,_=(null==E||null===(m=E.details)||void 0===m?void 0:m.live)?2*E.details.targetduration:u;if(y>0&&y<=_)return void this._trySkipBufferHole(null)}var T=self.performance.now();if(null!==i){var b=T-i;!l&&b>=o&&this._reportStall(f.len);var S=n.BufferHelper.bufferInfo(r,a,t.maxBufferHole);this._tryFixBufferStall(S,b)}else this.stalled=T}}}else if(this.moved=!0,null!==i){if(this.stallReported){var A=self.performance.now()-i;s.logger.warn("playback not stuck anymore @"+a+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},t._tryFixBufferStall=function(e,t){var r=this.config,n=this.fragmentTracker,i=this.media.currentTime,a=n.getPartialFragment(i);a&&this._trySkipBufferHole(a)||e.len>r.maxBufferHole&&t>1e3*r.highBufferWatchdogPeriod&&(s.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,r=this.media;this.stallReported||(this.stallReported=!0,s.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,r=this.hls,o=this.media,u=o.currentTime,d=0,f=n.BufferHelper.getBuffered(o),h=0;h<f.length;h++){var p=f.start(h);if(u+t.maxBufferHole>=d&&u<p){var v=Math.max(p+c,o.currentTime+l);return s.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+v),this.moved=!0,this.stalled=null,o.currentTime=v,e&&r.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+v,frag:e}),v}d=f.end(h)}return 0},t._tryNudgeBuffer=function(){var e=this.config,t=this.hls,r=this.media,n=r.currentTime,o=(this.nudgeRetry||0)+1;if(this.nudgeRetry=o,o<e.nudgeMaxRetry){var u=n+o*e.nudgeOffset;s.logger.warn("Nudging 'currentTime' from "+n+" to "+u),r.currentTime=u,t.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else s.logger.error("Playhead still not moving while enough data buffered @"+n+" after "+e.nudgeMaxRetry+" nudges"),t.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},e}()},"./src/controller/id3-track-controller.ts":
84
84
  /*!************************************************!*\
85
85
  !*** ./src/controller/id3-track-controller.ts ***!
86
86
  \************************************************/
@@ -100,7 +100,7 @@
100
100
  /*!*********************************************!*\
101
101
  !*** ./src/controller/stream-controller.ts ***!
102
102
  \*********************************************/
103
- /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return y}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),a=r(/*! ../is-supported */"./src/is-supported.ts"),s=r(/*! ../events */"./src/events.ts"),o=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),u=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),l=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),d=r(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),f=r(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),h=r(/*! ./gap-controller */"./src/controller/gap-controller.ts"),p=r(/*! ../errors */"./src/errors.ts"),v=r(/*! ../utils/logger */"./src/utils/logger.ts");function g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(e){var t,r;function y(t,r){var n;return(n=e.call(this,t,r,"[stream-controller]")||this).audioCodecSwap=!1,n.gapController=null,n.level=-1,n._forceStartLoad=!1,n.altAudio=!1,n.audioOnly=!1,n.fragPlaying=null,n.onvplaying=null,n.onvseeked=null,n.fragLastKbps=0,n.stalled=!1,n.audioCodecSwitch=!1,n.videoBuffer=null,n._registerListeners(),n}r=e,(t=y).prototype=Object.create(r.prototype),t.prototype.constructor=t,m(t,r);var E,_,T,b=y.prototype;return b._registerListeners=function(){var e=this.hls;e.on(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(s.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(s.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(s.Events.ERROR,this.onError,this),e.on(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(s.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(s.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(s.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var e=this.hls;e.off(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(s.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(s.Events.ERROR,this.onError,this),e.off(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(s.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(s.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(s.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(e){if(this.levels){var t=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var n=r.startLevel;-1===n&&(r.config.testBandwidth?(n=0,this.bitrateTest=!0):n=r.nextAutoLevel),this.level=r.nextLoadLevel=n,this.loadedmetadata=!1}t>0&&-1===e&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=i.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=i.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,e.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_LEVEL:var e,t=this.levels,r=this.level,n=null==t||null===(e=t[r])||void 0===e?void 0:e.details;if(n&&(!n.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(n))break;this.state=i.State.IDLE;break}break;case i.State.FRAG_LOADING_WAITING_RETRY:var a,s=self.performance.now(),o=this.retryDate;(!o||s>=o||null!==(a=this.media)&&void 0!==a&&a.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=i.State.IDLE)}this.onTickEnd()},b.onTickEnd=function(){e.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var e,t,r=this.hls,a=this.levelLastLoaded,l=this.levels,c=this.media,d=r.config,f=r.nextLoadLevel;if(null!==a&&(c||!this.startFragRequested&&d.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&l&&l[f]){var p=l[f];this.level=r.nextLoadLevel=f;var v=p.details;if(!v||this.state===i.State.WAITING_LEVEL||v.live&&this.levelLastLoaded!==f)this.state=i.State.WAITING_LEVEL;else{var g=this.getLoadPosition();if(Object(n.isFiniteNumber)(g)){var m=v.initSegment,y=0;if(!m||m.data||this.bitrateTest){var E,_=p.maxBitrate;E=_?Math.max(8*d.maxBufferSize/_,d.maxBufferLength):d.maxBufferLength,E=Math.min(E,d.maxMaxBufferLength);var T=g<d.maxBufferHole?Math.max(h.MAX_START_GAP_JUMP,d.maxBufferHole):d.maxBufferHole,b=o.BufferHelper.bufferInfo(this.mediaBuffer?this.mediaBuffer:c,g,T);if(b.len>=E)return;if(this._streamEnded(b,v)){var A={};return this.altAudio&&(A.type="video"),this.hls.trigger(s.Events.BUFFER_EOS,A),void(this.state=i.State.ENDED)}if(y=b.end,(m=this.getNextFragment(y,v))&&this.fragmentTracker.getState(m)===u.FragmentState.OK&&this.nextLoadPosition>y&&(m=this.getNextFragment(this.nextLoadPosition,v)),!m)return}"identity"!==(null===(e=m.decryptdata)||void 0===e?void 0:e.keyFormat)||null!==(t=m.decryptdata)&&void 0!==t&&t.key?this.loadFragment(m,v,y):this.loadKey(m,v)}}}},b.loadFragment=function(t,r,n){var i,a=this.fragmentTracker.getState(t);if(this.fragCurrent=t,a===u.FragmentState.BACKTRACKED){var s=this.fragmentTracker.getBacktrackData(t);if(s)return this._handleFragmentLoadProgress(s),void this._handleFragmentLoadComplete(s);a=u.FragmentState.NOT_LOADED}a===u.FragmentState.NOT_LOADED||a===u.FragmentState.PARTIAL?"initSegment"===t.sn?this._loadInitSegment(t):this.bitrateTest?(t.bitrateTest=!0,this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t)):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,r,n)):a===u.FragmentState.APPENDING?this.reduceMaxBufferLength(t.duration)&&this.fragmentTracker.removeFragment(t):0===(null===(i=this.media)||void 0===i?void 0:i.buffered.length)&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(e){var t=this.fragmentTracker.getAppendedFrag(e,l.PlaylistLevelType.MAIN);return t&&"fragment"in t?t.fragment:t},b.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,l.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var e=this.levels,t=this.media;if(null!=t&&t.readyState){var r,n=this.getAppendedFrag(t.currentTime);if(n&&n.start>1&&this.flushMainBuffer(0,n.start-1),!t.paused&&e){var i=e[this.hls.nextLoadLevel],a=this.fragLastKbps;r=a&&this.fragCurrent?this.fragCurrent.duration*i.maxBitrate/(1e3*a)+1:0}else r=0;var s=this.getBufferedFrag(t.currentTime+r);if(s){var o=this.followingBufferedFrag(s);if(o){this.abortCurrentFrag();var u=o.maxStartPTS?o.maxStartPTS:o.start,l=o.duration,c=Math.max(s.end,u+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,.5*l),.75*l));this.flushMainBuffer(c,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var e=this.fragCurrent;this.fragCurrent=null,null!=e&&e.loader&&e.loader.abort(),this.state===i.State.KEY_LOADING&&(this.state=i.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(t,r){e.prototype.flushMainBuffer.call(this,t,r,this.altAudio?"video":null)},b.onMediaAttached=function(t,r){e.prototype.onMediaAttached.call(this,t,r);var n=r.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener("playing",this.onvplaying),n.addEventListener("seeked",this.onvseeked),this.gapController=new h.default(this.config,n,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var t=this.media;t&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),e.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:null;Object(n.isFiniteNumber)(t)&&this.log("Media seeked to "+t.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(s.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(e,t){var r,n=!1,i=!1;t.levels.forEach((function(e){(r=e.audioCodec)&&(-1!==r.indexOf("mp4a.40.2")&&(n=!0),-1!==r.indexOf("mp4a.40.5")&&(i=!0))})),this.audioCodecSwitch=n&&i&&!Object(a.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},b.onLevelLoading=function(e,t){var r=this.levels;if(r&&this.state===i.State.IDLE){var n=r[t.level];(!n.details||n.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(n.details))&&(this.state=i.State.WAITING_LEVEL)}},b.onLevelLoaded=function(e,t){var r,n=this.levels,a=t.level,o=t.details,u=o.totalduration;if(n){this.log("Level "+a+" loaded ["+o.startSN+","+o.endSN+"], cc ["+o.startCC+", "+o.endCC+"] duration:"+u);var l=this.fragCurrent;!l||this.state!==i.State.FRAG_LOADING&&this.state!==i.State.FRAG_LOADING_WAITING_RETRY||l.level!==t.level&&l.loader&&(this.state=i.State.IDLE,l.loader.abort());var c=n[a],d=0;if(o.live||null!==(r=c.details)&&void 0!==r&&r.live){if(o.fragments[0]||(o.deltaUpdateFailed=!0),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,c.details)}if(c.details=o,this.levelLastLoaded=a,this.hls.trigger(s.Events.LEVEL_UPDATED,{details:o,level:a}),this.state===i.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=i.State.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,d),this.tick()}else this.warn("Levels were reset while loading level "+a)},b._handleFragmentLoadProgress=function(e){var t,r=e.frag,n=e.part,i=e.payload,a=this.levels;if(a){var s=a[r.level],o=s.details;if(o){var u=s.videoCodec,c=o.PTSKnown||!o.live,h=null===(t=o.initSegment)||void 0===t?void 0:t.data,p=this._getAudioCodec(s),v=this.transmuxer=this.transmuxer||new d.default(this.hls,l.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=n?n.index:-1,m=-1!==g,y=new f.ChunkMetadata(r.level,r.sn,r.stats.chunkCount,i.byteLength,g,m),E=this.initPTS[r.cc];v.push(i,h,p,u,r,n,o.totalduration,c,y,E)}else this.warn("Dropping fragment "+r.sn+" of level "+r.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},b.onAudioTrackSwitching=function(e,t){var r=this.altAudio,n=!!t.url,i=t.id;if(!n){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var a=this.fragCurrent;null!=a&&a.loader&&(this.log("Switching to main audio track, cancel main fragment load"),a.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var o=this.hls;r&&o.trigger(s.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),o.trigger(s.Events.AUDIO_TRACK_SWITCHED,{id:i})}},b.onAudioTrackSwitched=function(e,t){var r=t.id,n=!!this.hls.audioTracks[r].url;if(n){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=n,this.tick()},b.onBufferCreated=function(e,t){var r,n,i=t.tracks,a=!1;for(var s in i){var o=i[s];if("main"===o.id){if(n=s,r=o,"video"===s){var u=i[s];u&&(this.videoBuffer=u.buffer)}}else a=!0}a&&r?(this.log("Alternate track found, use "+n+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(e,t){var r=t.frag,n=t.part;if(!r||r.type===l.PlaylistLevelType.MAIN){if(this.fragContextChanged(r))return this.warn("Fragment "+r.sn+(n?" p: "+n.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===i.State.PARSED&&(this.state=i.State.IDLE));var a=n?n.stats:r.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,n)}},b.onError=function(e,t){switch(t.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(l.PlaylistLevelType.MAIN,t);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==i.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=i.State.ERROR):t.levelRetry||this.state!==i.State.WAITING_LEVEL||(this.state=i.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:"main"!==t.parent||this.state!==i.State.PARSING&&this.state!==i.State.PARSED||(this.media&&o.BufferHelper.isBuffered(this.media,this.media.currentTime)&&o.BufferHelper.isBuffered(this.media,this.media.currentTime+.5)?(this.reduceMaxBufferLength(),this.state=i.State.IDLE):(this.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.immediateLevelSwitch()))}},b.checkBuffer=function(){var e=this.media,t=this.gapController;if(e&&t&&e.readyState){var r=o.BufferHelper.getBuffered(e);!this.loadedmetadata&&r.length?(this.loadedmetadata=!0,this.seekToStartPos()):t.poll(this.lastCurrentTime),this.lastCurrentTime=e.currentTime}},b.onFragLoadEmergencyAborted=function(){this.state=i.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},b.onBufferFlushed=function(e,t){var r=t.type;if(r!==c.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var n=(r===c.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(n,r,l.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(e,t){this.levels=t.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var e=this.media,t=e.currentTime,r=this.startPosition;if(r>=0&&t<r){if(e.seeking)return void v.logger.log("could not seek to "+r+", already seeking at "+t);var n=o.BufferHelper.getBuffered(e),i=(n.length?n.start(0):0)-r;i>0&&i<this.config.maxBufferHole&&(v.logger.log("adjusting start position by "+i+" to match buffer start"),r+=i,this.startPosition=r),this.log("seek to target start position "+r+" from current time "+t),e.currentTime=r}},b._getAudioCodec=function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t},b._loadBitrateTestFrag=function(e){var t=this;this._doFragLoad(e).then((function(r){var n=t.hls;if(r&&!n.nextLoadLevel&&!t.fragContextChanged(e)){t.fragLoadError=0,t.state=i.State.IDLE,t.startFragRequested=!1,t.bitrateTest=!1;var a=e.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),n.trigger(s.Events.FRAG_LOADED,r)}}))},b._handleTransmuxComplete=function(e){var t,r="main",a=this.hls,o=e.remuxResult,u=e.chunkMeta,l=this.getCurrentContext(u);if(!l)return this.warn("The loading context changed while buffering fragment "+u.sn+" of level "+u.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(u.level);var d=l.frag,f=l.part,h=l.level,p=o.video,v=o.text,g=o.id3,m=o.initSegment,y=this.altAudio?void 0:o.audio;if(!this.fragContextChanged(d)){if(this.state=i.State.PARSING,m){m.tracks&&(this._bufferInitSegment(h,m.tracks,d,u),a.trigger(s.Events.FRAG_PARSING_INIT_SEGMENT,{frag:d,id:r,tracks:m.tracks}));var E=m.initPTS,_=m.timescale;Object(n.isFiniteNumber)(E)&&(this.initPTS[d.cc]=E,a.trigger(s.Events.INIT_PTS_FOUND,{frag:d,id:r,initPTS:E,timescale:_}))}if(p&&!1!==o.independent){if(h.details){var T=p.startPTS,b=p.endPTS,A=p.startDTS,S=p.endDTS;if(f)f.elementaryStreams[p.type]={startPTS:T,endPTS:b,startDTS:A,endDTS:S};else if(p.dropped&&p.independent){if(this.getLoadPosition()+this.config.maxBufferHole<T)return void this.backtrack(d);d.setElementaryStreamInfo(p.type,d.start,b,d.start,S,!0)}d.setElementaryStreamInfo(p.type,T,b,A,S),this.bufferFragmentData(p,d,f,u)}}else if(!1===o.independent)return void this.backtrack(d);if(y){var L=y.startPTS,k=y.endPTS,w=y.startDTS,D=y.endDTS;f&&(f.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:L,endPTS:k,startDTS:w,endDTS:D}),d.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,L,k,w,D),this.bufferFragmentData(y,d,f,u)}if(null!=g&&null!==(t=g.samples)&&void 0!==t&&t.length){var R={frag:d,id:r,samples:g.samples};a.trigger(s.Events.FRAG_PARSING_METADATA,R)}if(v){var O={frag:d,id:r,samples:v.samples};a.trigger(s.Events.FRAG_PARSING_USERDATA,O)}}},b._bufferInitSegment=function(e,t,r,n){var a=this;if(this.state===i.State.PARSING){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var o=t.audio,u=t.video,l=t.audiovideo;if(o){var c=e.audioCodec,d=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(c&&(c=-1!==c.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==o.metadata.channelCount&&-1===d.indexOf("firefox")&&(c="mp4a.40.5")),-1!==d.indexOf("android")&&"audio/mpeg"!==o.container&&(c="mp4a.40.2",this.log("Android: force audio codec to "+c)),e.audioCodec&&e.audioCodec!==c&&this.log('Swapping manifest audio codec "'+e.audioCodec+'" for "'+c+'"'),o.levelCodec=c,o.id="main",this.log("Init audio buffer, container:"+o.container+", codecs[selected/level/parsed]=["+(c||"")+"/"+(e.audioCodec||"")+"/"+o.codec+"]")}u&&(u.levelCodec=e.videoCodec,u.id="main",this.log("Init video buffer, container:"+u.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+u.codec+"]")),l&&this.log("Init audiovideo buffer, container:"+l.container+", codecs[level/parsed]=["+(e.attrs.CODECS||"")+"/"+l.codec+"]"),this.hls.trigger(s.Events.BUFFER_CODECS,t),Object.keys(t).forEach((function(e){var i=t[e].initSegment;null!=i&&i.byteLength&&a.hls.trigger(s.Events.BUFFER_APPENDING,{type:e,data:i,frag:r,part:null,chunkMeta:n,parent:r.type})})),this.tick()}},b.backtrack=function(e){this.resetTransmuxer(),this.flushBufferGap(e);var t=this.fragmentTracker.backtrack(e);this.fragPrevious=null,this.nextLoadPosition=e.start,t?this.resetFragmentLoading(e):this.state=i.State.BACKTRACKING},b.checkFragmentChanged=function(){var e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){var r=e.currentTime;if(o.BufferHelper.isBuffered(e,r)?t=this.getAppendedFrag(r):o.BufferHelper.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t){var n=this.fragPlaying,i=t.level;n&&t.sn===n.sn&&n.level===i&&t.urlId===n.urlId||(this.hls.trigger(s.Events.FRAG_CHANGED,{frag:t}),n&&n.level===i||this.hls.trigger(s.Events.LEVEL_SWITCHED,{level:i}),this.fragPlaying=t)}}},E=y,(_=[{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentLevel",get:function(){var e=this.media;if(e){var t=this.getAppendedFrag(e.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;if(e){var t=this.getAppendedFrag(e.currentTime);return this.followingBufferedFrag(t)}return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&g(E.prototype,_),T&&g(E,T),y}(i.default)},"./src/controller/subtitle-stream-controller.ts":
103
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return y}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),a=r(/*! ../is-supported */"./src/is-supported.ts"),s=r(/*! ../events */"./src/events.ts"),o=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),u=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),l=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),d=r(/*! ../demux/transmuxer-interface */"./src/demux/transmuxer-interface.ts"),f=r(/*! ../types/transmuxer */"./src/types/transmuxer.ts"),h=r(/*! ./gap-controller */"./src/controller/gap-controller.ts"),p=r(/*! ../errors */"./src/errors.ts"),v=r(/*! ../utils/logger */"./src/utils/logger.ts");function g(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(e){var t,r;function y(t,r){var n;return(n=e.call(this,t,r,"[stream-controller]")||this).audioCodecSwap=!1,n.gapController=null,n.level=-1,n._forceStartLoad=!1,n.altAudio=!1,n.audioOnly=!1,n.fragPlaying=null,n.onvplaying=null,n.onvseeked=null,n.fragLastKbps=0,n.stalled=!1,n.audioCodecSwitch=!1,n.videoBuffer=null,n._registerListeners(),n}r=e,(t=y).prototype=Object.create(r.prototype),t.prototype.constructor=t,m(t,r);var E,_,T,b=y.prototype;return b._registerListeners=function(){var e=this.hls;e.on(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(s.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(s.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(s.Events.ERROR,this.onError,this),e.on(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(s.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(s.Events.BUFFER_CREATED,this.onBufferCreated,this),e.on(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(s.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var e=this.hls;e.off(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(s.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(s.Events.ERROR,this.onError,this),e.off(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(s.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(s.Events.BUFFER_CREATED,this.onBufferCreated,this),e.off(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(s.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(e){if(this.levels){var t=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var n=r.startLevel;-1===n&&(r.config.testBandwidth?(n=0,this.bitrateTest=!0):n=r.nextAutoLevel),this.level=r.nextLoadLevel=n,this.loadedmetadata=!1}t>0&&-1===e&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=i.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=i.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,e.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_LEVEL:var e,t=this.levels,r=this.level,n=null==t||null===(e=t[r])||void 0===e?void 0:e.details;if(n&&(!n.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(n))break;this.state=i.State.IDLE;break}break;case i.State.FRAG_LOADING_WAITING_RETRY:var a,s=self.performance.now(),o=this.retryDate;(!o||s>=o||null!==(a=this.media)&&void 0!==a&&a.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=i.State.IDLE)}this.onTickEnd()},b.onTickEnd=function(){e.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var e,t,r=this.hls,a=this.levelLastLoaded,l=this.levels,c=this.media,d=r.config,f=r.nextLoadLevel;if(null!==a&&(c||!this.startFragRequested&&d.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&l&&l[f]){var p=l[f];this.level=r.nextLoadLevel=f;var v=p.details;if(!v||this.state===i.State.WAITING_LEVEL||v.live&&this.levelLastLoaded!==f)this.state=i.State.WAITING_LEVEL;else{var g=this.getLoadPosition();if(Object(n.isFiniteNumber)(g)){var m=v.initSegment,y=0;if(!m||m.data||this.bitrateTest){var E,_=p.maxBitrate;E=_?Math.max(8*d.maxBufferSize/_,d.maxBufferLength):d.maxBufferLength,E=Math.min(E,d.maxMaxBufferLength);var T=g<d.maxBufferHole?Math.max(h.MAX_START_GAP_JUMP,d.maxBufferHole):d.maxBufferHole,b=o.BufferHelper.bufferInfo(this.mediaBuffer?this.mediaBuffer:c,g,T);if(b.len>=E)return;if(this._streamEnded(b,v)){var S={};return this.altAudio&&(S.type="video"),this.hls.trigger(s.Events.BUFFER_EOS,S),void(this.state=i.State.ENDED)}if(y=b.end,(m=this.getNextFragment(y,v))&&this.fragmentTracker.getState(m)===u.FragmentState.OK&&this.nextLoadPosition>y&&(m=this.getNextFragment(this.nextLoadPosition,v)),!m)return}"identity"!==(null===(e=m.decryptdata)||void 0===e?void 0:e.keyFormat)||null!==(t=m.decryptdata)&&void 0!==t&&t.key?this.loadFragment(m,v,y):this.loadKey(m,v)}}}},b.loadFragment=function(t,r,n){var i,a=this.fragmentTracker.getState(t);if(this.fragCurrent=t,a===u.FragmentState.BACKTRACKED){var s=this.fragmentTracker.getBacktrackData(t);if(s)return this._handleFragmentLoadProgress(s),void this._handleFragmentLoadComplete(s);a=u.FragmentState.NOT_LOADED}a===u.FragmentState.NOT_LOADED||a===u.FragmentState.PARTIAL?"initSegment"===t.sn?this._loadInitSegment(t):this.bitrateTest?(t.bitrateTest=!0,this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t)):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,r,n)):a===u.FragmentState.APPENDING?this.reduceMaxBufferLength(t.duration)&&this.fragmentTracker.removeFragment(t):0===(null===(i=this.media)||void 0===i?void 0:i.buffered.length)&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(e){var t=this.fragmentTracker.getAppendedFrag(e,l.PlaylistLevelType.MAIN);return t&&"fragment"in t?t.fragment:t},b.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,l.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var e=this.levels,t=this.media;if(null!=t&&t.readyState){var r,n=this.getAppendedFrag(t.currentTime);if(n&&n.start>1&&this.flushMainBuffer(0,n.start-1),!t.paused&&e){var i=e[this.hls.nextLoadLevel],a=this.fragLastKbps;r=a&&this.fragCurrent?this.fragCurrent.duration*i.maxBitrate/(1e3*a)+1:0}else r=0;var s=this.getBufferedFrag(t.currentTime+r);if(s){var o=this.followingBufferedFrag(s);if(o){this.abortCurrentFrag();var u=o.maxStartPTS?o.maxStartPTS:o.start,l=o.duration,c=Math.max(s.end,u+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,.5*l),.75*l));this.flushMainBuffer(c,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var e=this.fragCurrent;this.fragCurrent=null,null!=e&&e.loader&&e.loader.abort(),this.state===i.State.KEY_LOADING&&(this.state=i.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(t,r){e.prototype.flushMainBuffer.call(this,t,r,this.altAudio?"video":null)},b.onMediaAttached=function(t,r){e.prototype.onMediaAttached.call(this,t,r);var n=r.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener("playing",this.onvplaying),n.addEventListener("seeked",this.onvseeked),this.gapController=new h.default(this.config,n,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var t=this.media;t&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),e.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:null;Object(n.isFiniteNumber)(t)&&this.log("Media seeked to "+t.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(s.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},b.onManifestParsed=function(e,t){var r,n=!1,i=!1;t.levels.forEach((function(e){(r=e.audioCodec)&&(-1!==r.indexOf("mp4a.40.2")&&(n=!0),-1!==r.indexOf("mp4a.40.5")&&(i=!0))})),this.audioCodecSwitch=n&&i&&!Object(a.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},b.onLevelLoading=function(e,t){var r=this.levels;if(r&&this.state===i.State.IDLE){var n=r[t.level];(!n.details||n.details.live&&this.levelLastLoaded!==t.level||this.waitForCdnTuneIn(n.details))&&(this.state=i.State.WAITING_LEVEL)}},b.onLevelLoaded=function(e,t){var r,n=this.levels,a=t.level,o=t.details,u=o.totalduration;if(n){this.log("Level "+a+" loaded ["+o.startSN+","+o.endSN+"], cc ["+o.startCC+", "+o.endCC+"] duration:"+u);var l=this.fragCurrent;!l||this.state!==i.State.FRAG_LOADING&&this.state!==i.State.FRAG_LOADING_WAITING_RETRY||l.level!==t.level&&l.loader&&(this.state=i.State.IDLE,l.loader.abort());var c=n[a],d=0;if(o.live||null!==(r=c.details)&&void 0!==r&&r.live){if(o.fragments[0]||(o.deltaUpdateFailed=!0),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,c.details)}if(c.details=o,this.levelLastLoaded=a,this.hls.trigger(s.Events.LEVEL_UPDATED,{details:o,level:a}),this.state===i.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=i.State.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,d),this.tick()}else this.warn("Levels were reset while loading level "+a)},b._handleFragmentLoadProgress=function(e){var t,r=e.frag,n=e.part,i=e.payload,a=this.levels;if(a){var s=a[r.level],o=s.details;if(o){var u=s.videoCodec,c=o.PTSKnown||!o.live,h=null===(t=o.initSegment)||void 0===t?void 0:t.data,p=this._getAudioCodec(s),v=this.transmuxer=this.transmuxer||new d.default(this.hls,l.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=n?n.index:-1,m=-1!==g,y=new f.ChunkMetadata(r.level,r.sn,r.stats.chunkCount,i.byteLength,g,m),E=this.initPTS[r.cc];v.push(i,h,p,u,r,n,o.totalduration,c,y,E)}else this.warn("Dropping fragment "+r.sn+" of level "+r.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+r.sn+" of level "+r.level+" will not be buffered")},b.onAudioTrackSwitching=function(e,t){var r=this.altAudio,n=!!t.url,i=t.id;if(!n){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var a=this.fragCurrent;null!=a&&a.loader&&(this.log("Switching to main audio track, cancel main fragment load"),a.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var o=this.hls;r&&o.trigger(s.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),o.trigger(s.Events.AUDIO_TRACK_SWITCHED,{id:i})}},b.onAudioTrackSwitched=function(e,t){var r=t.id,n=!!this.hls.audioTracks[r].url;if(n){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=n,this.tick()},b.onBufferCreated=function(e,t){var r,n,i=t.tracks,a=!1;for(var s in i){var o=i[s];if("main"===o.id){if(n=s,r=o,"video"===s){var u=i[s];u&&(this.videoBuffer=u.buffer)}}else a=!0}a&&r?(this.log("Alternate track found, use "+n+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(e,t){var r=t.frag,n=t.part;if(!r||r.type===l.PlaylistLevelType.MAIN){if(this.fragContextChanged(r))return this.warn("Fragment "+r.sn+(n?" p: "+n.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===i.State.PARSED&&(this.state=i.State.IDLE));var a=n?n.stats:r.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,n)}},b.onError=function(e,t){switch(t.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(l.PlaylistLevelType.MAIN,t);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==i.State.ERROR&&(t.fatal?(this.warn(""+t.details),this.state=i.State.ERROR):t.levelRetry||this.state!==i.State.WAITING_LEVEL||(this.state=i.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:"main"!==t.parent||this.state!==i.State.PARSING&&this.state!==i.State.PARSED||(this.media&&o.BufferHelper.isBuffered(this.media,this.media.currentTime)&&o.BufferHelper.isBuffered(this.media,this.media.currentTime+.5)?(this.reduceMaxBufferLength(),this.state=i.State.IDLE):(this.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.immediateLevelSwitch()))}},b.checkBuffer=function(){var e=this.media,t=this.gapController;if(e&&t&&e.readyState){var r=o.BufferHelper.getBuffered(e);!this.loadedmetadata&&r.length?(this.loadedmetadata=!0,this.seekToStartPos()):t.poll(this.lastCurrentTime),this.lastCurrentTime=e.currentTime}},b.onFragLoadEmergencyAborted=function(){this.state=i.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},b.onBufferFlushed=function(e,t){var r=t.type;if(r!==c.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var n=(r===c.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(n,r,l.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(e,t){this.levels=t.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var e=this.media,t=e.currentTime,r=this.startPosition;if(r>=0&&t<r){if(e.seeking)return void v.logger.log("could not seek to "+r+", already seeking at "+t);var n=o.BufferHelper.getBuffered(e),i=(n.length?n.start(0):0)-r;i>0&&i<this.config.maxBufferHole&&(v.logger.log("adjusting start position by "+i+" to match buffer start"),r+=i,this.startPosition=r),this.log("seek to target start position "+r+" from current time "+t),e.currentTime=r}},b._getAudioCodec=function(e){var t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t},b._loadBitrateTestFrag=function(e){var t=this;this._doFragLoad(e).then((function(r){var n=t.hls;if(r&&!n.nextLoadLevel&&!t.fragContextChanged(e)){t.fragLoadError=0,t.state=i.State.IDLE,t.startFragRequested=!1,t.bitrateTest=!1;var a=e.stats;a.parsing.start=a.parsing.end=a.buffering.start=a.buffering.end=self.performance.now(),n.trigger(s.Events.FRAG_LOADED,r)}}))},b._handleTransmuxComplete=function(e){var t,r="main",a=this.hls,o=e.remuxResult,u=e.chunkMeta,l=this.getCurrentContext(u);if(!l)return this.warn("The loading context changed while buffering fragment "+u.sn+" of level "+u.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(u.level);var d=l.frag,f=l.part,h=l.level,p=o.video,v=o.text,g=o.id3,m=o.initSegment,y=this.altAudio?void 0:o.audio;if(!this.fragContextChanged(d)){if(this.state=i.State.PARSING,m){m.tracks&&(this._bufferInitSegment(h,m.tracks,d,u),a.trigger(s.Events.FRAG_PARSING_INIT_SEGMENT,{frag:d,id:r,tracks:m.tracks}));var E=m.initPTS,_=m.timescale;Object(n.isFiniteNumber)(E)&&(this.initPTS[d.cc]=E,a.trigger(s.Events.INIT_PTS_FOUND,{frag:d,id:r,initPTS:E,timescale:_}))}if(p&&!1!==o.independent){if(h.details){var T=p.startPTS,b=p.endPTS,S=p.startDTS,A=p.endDTS;if(f)f.elementaryStreams[p.type]={startPTS:T,endPTS:b,startDTS:S,endDTS:A};else if(p.dropped&&p.independent){if(this.getLoadPosition()+this.config.maxBufferHole<T)return void this.backtrack(d);d.setElementaryStreamInfo(p.type,d.start,b,d.start,A,!0)}d.setElementaryStreamInfo(p.type,T,b,S,A),this.bufferFragmentData(p,d,f,u)}}else if(!1===o.independent)return void this.backtrack(d);if(y){var L=y.startPTS,k=y.endPTS,w=y.startDTS,D=y.endDTS;f&&(f.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:L,endPTS:k,startDTS:w,endDTS:D}),d.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,L,k,w,D),this.bufferFragmentData(y,d,f,u)}if(null!=g&&null!==(t=g.samples)&&void 0!==t&&t.length){var R={frag:d,id:r,samples:g.samples};a.trigger(s.Events.FRAG_PARSING_METADATA,R)}if(v){var O={frag:d,id:r,samples:v.samples};a.trigger(s.Events.FRAG_PARSING_USERDATA,O)}}},b._bufferInitSegment=function(e,t,r,n){var a=this;if(this.state===i.State.PARSING){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var o=t.audio,u=t.video,l=t.audiovideo;if(o){var c=e.audioCodec,d=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(c&&(c=-1!==c.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==o.metadata.channelCount&&-1===d.indexOf("firefox")&&(c="mp4a.40.5")),-1!==d.indexOf("android")&&"audio/mpeg"!==o.container&&(c="mp4a.40.2",this.log("Android: force audio codec to "+c)),e.audioCodec&&e.audioCodec!==c&&this.log('Swapping manifest audio codec "'+e.audioCodec+'" for "'+c+'"'),o.levelCodec=c,o.id="main",this.log("Init audio buffer, container:"+o.container+", codecs[selected/level/parsed]=["+(c||"")+"/"+(e.audioCodec||"")+"/"+o.codec+"]")}u&&(u.levelCodec=e.videoCodec,u.id="main",this.log("Init video buffer, container:"+u.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+u.codec+"]")),l&&this.log("Init audiovideo buffer, container:"+l.container+", codecs[level/parsed]=["+(e.attrs.CODECS||"")+"/"+l.codec+"]"),this.hls.trigger(s.Events.BUFFER_CODECS,t),Object.keys(t).forEach((function(e){var i=t[e].initSegment;null!=i&&i.byteLength&&a.hls.trigger(s.Events.BUFFER_APPENDING,{type:e,data:i,frag:r,part:null,chunkMeta:n,parent:r.type})})),this.tick()}},b.backtrack=function(e){this.resetTransmuxer(),this.flushBufferGap(e);var t=this.fragmentTracker.backtrack(e);this.fragPrevious=null,this.nextLoadPosition=e.start,t?this.resetFragmentLoading(e):this.state=i.State.BACKTRACKING},b.checkFragmentChanged=function(){var e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){var r=e.currentTime;if(o.BufferHelper.isBuffered(e,r)?t=this.getAppendedFrag(r):o.BufferHelper.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t){var n=this.fragPlaying,i=t.level;n&&t.sn===n.sn&&n.level===i&&t.urlId===n.urlId||(this.hls.trigger(s.Events.FRAG_CHANGED,{frag:t}),n&&n.level===i||this.hls.trigger(s.Events.LEVEL_SWITCHED,{level:i}),this.fragPlaying=t)}}},E=y,(_=[{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentLevel",get:function(){var e=this.media;if(e){var t=this.getAppendedFrag(e.currentTime);if(t)return t.level}return-1}},{key:"nextBufferedFrag",get:function(){var e=this.media;if(e){var t=this.getAppendedFrag(e.currentTime);return this.followingBufferedFrag(t)}return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&g(E.prototype,_),T&&g(E,T),y}(i.default)},"./src/controller/subtitle-stream-controller.ts":
104
104
  /*!******************************************************!*\
105
105
  !*** ./src/controller/subtitle-stream-controller.ts ***!
106
106
  \******************************************************/
@@ -120,7 +120,7 @@
120
120
  /*!************************************!*\
121
121
  !*** ./src/crypt/aes-decryptor.ts ***!
122
122
  \************************************/
123
- /*! exports provided: removePadding, default */function(e,t,r){r.r(t),r.d(t,"removePadding",(function(){return i})),r.d(t,"default",(function(){return a}));var n=r(/*! ../utils/typed-array */"./src/utils/typed-array.ts");function i(e){var t=e.byteLength,r=t&&new DataView(e.buffer).getUint8(t-1);return r?Object(n.sliceUint8)(e,0,t-r):e}var a=function(){function e(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var t=e.prototype;return t.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),r=new Uint32Array(4),n=0;n<4;n++)r[n]=t.getUint32(4*n);return r},t.initTable=function(){var e=this.sBox,t=this.invSBox,r=this.subMix,n=r[0],i=r[1],a=r[2],s=r[3],o=this.invSubMix,u=o[0],l=o[1],c=o[2],d=o[3],f=new Uint32Array(256),h=0,p=0,v=0;for(v=0;v<256;v++)f[v]=v<128?v<<1:v<<1^283;for(v=0;v<256;v++){var g=p^p<<1^p<<2^p<<3^p<<4;g=g>>>8^255&g^99,e[h]=g,t[g]=h;var m=f[h],y=f[m],E=f[y],_=257*f[g]^16843008*g;n[h]=_<<24|_>>>8,i[h]=_<<16|_>>>16,a[h]=_<<8|_>>>24,s[h]=_,_=16843009*E^65537*y^257*m^16843008*h,u[g]=_<<24|_>>>8,l[g]=_<<16|_>>>16,c[g]=_<<8|_>>>24,d[g]=_,h?(h=m^f[f[f[E^m]]],p^=f[f[p]]):h=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,n=0;n<t.length&&r;)r=t[n]===this.key[n],n++;if(!r){this.key=t;var i=this.keySize=t.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);var a,s,o,u,l=this.ksRows=4*(i+6+1),c=this.keySchedule=new Uint32Array(l),d=this.invKeySchedule=new Uint32Array(l),f=this.sBox,h=this.rcon,p=this.invSubMix,v=p[0],g=p[1],m=p[2],y=p[3];for(a=0;a<l;a++)a<i?o=c[a]=t[a]:(u=o,a%i==0?(u=f[(u=u<<8|u>>>24)>>>24]<<24|f[u>>>16&255]<<16|f[u>>>8&255]<<8|f[255&u],u^=h[a/i|0]<<24):i>6&&a%i==4&&(u=f[u>>>24]<<24|f[u>>>16&255]<<16|f[u>>>8&255]<<8|f[255&u]),c[a]=o=(c[a-i]^u)>>>0);for(s=0;s<l;s++)a=l-s,u=3&s?c[a]:c[a-4],d[s]=s<4||a<=4?u:v[f[u>>>24]]^g[f[u>>>16&255]]^m[f[u>>>8&255]]^y[f[255&u]],d[s]=d[s]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,r){for(var n,i,a,s,o,u,l,c,d,f,h,p,v,g,m=this.keySize+6,y=this.invKeySchedule,E=this.invSBox,_=this.invSubMix,T=_[0],b=_[1],A=_[2],S=_[3],L=this.uint8ArrayToUint32Array_(r),k=L[0],w=L[1],D=L[2],R=L[3],O=new Int32Array(e),C=new Int32Array(O.length),I=this.networkToHostOrderSwap;t<O.length;){for(d=I(O[t]),f=I(O[t+1]),h=I(O[t+2]),p=I(O[t+3]),o=d^y[0],u=p^y[1],l=h^y[2],c=f^y[3],v=4,g=1;g<m;g++)n=T[o>>>24]^b[u>>16&255]^A[l>>8&255]^S[255&c]^y[v],i=T[u>>>24]^b[l>>16&255]^A[c>>8&255]^S[255&o]^y[v+1],a=T[l>>>24]^b[c>>16&255]^A[o>>8&255]^S[255&u]^y[v+2],s=T[c>>>24]^b[o>>16&255]^A[u>>8&255]^S[255&l]^y[v+3],o=n,u=i,l=a,c=s,v+=4;n=E[o>>>24]<<24^E[u>>16&255]<<16^E[l>>8&255]<<8^E[255&c]^y[v],i=E[u>>>24]<<24^E[l>>16&255]<<16^E[c>>8&255]<<8^E[255&o]^y[v+1],a=E[l>>>24]<<24^E[c>>16&255]<<16^E[o>>8&255]<<8^E[255&u]^y[v+2],s=E[c>>>24]<<24^E[o>>16&255]<<16^E[u>>8&255]<<8^E[255&l]^y[v+3],C[t]=I(n^k),C[t+1]=I(s^w),C[t+2]=I(a^D),C[t+3]=I(i^R),k=d,w=f,D=h,R=p,t+=4}return C.buffer},e}()},"./src/crypt/decrypter.ts":
123
+ /*! exports provided: removePadding, default */function(e,t,r){r.r(t),r.d(t,"removePadding",(function(){return i})),r.d(t,"default",(function(){return a}));var n=r(/*! ../utils/typed-array */"./src/utils/typed-array.ts");function i(e){var t=e.byteLength,r=t&&new DataView(e.buffer).getUint8(t-1);return r?Object(n.sliceUint8)(e,0,t-r):e}var a=function(){function e(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var t=e.prototype;return t.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),r=new Uint32Array(4),n=0;n<4;n++)r[n]=t.getUint32(4*n);return r},t.initTable=function(){var e=this.sBox,t=this.invSBox,r=this.subMix,n=r[0],i=r[1],a=r[2],s=r[3],o=this.invSubMix,u=o[0],l=o[1],c=o[2],d=o[3],f=new Uint32Array(256),h=0,p=0,v=0;for(v=0;v<256;v++)f[v]=v<128?v<<1:v<<1^283;for(v=0;v<256;v++){var g=p^p<<1^p<<2^p<<3^p<<4;g=g>>>8^255&g^99,e[h]=g,t[g]=h;var m=f[h],y=f[m],E=f[y],_=257*f[g]^16843008*g;n[h]=_<<24|_>>>8,i[h]=_<<16|_>>>16,a[h]=_<<8|_>>>24,s[h]=_,_=16843009*E^65537*y^257*m^16843008*h,u[g]=_<<24|_>>>8,l[g]=_<<16|_>>>16,c[g]=_<<8|_>>>24,d[g]=_,h?(h=m^f[f[f[E^m]]],p^=f[f[p]]):h=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,n=0;n<t.length&&r;)r=t[n]===this.key[n],n++;if(!r){this.key=t;var i=this.keySize=t.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);var a,s,o,u,l=this.ksRows=4*(i+6+1),c=this.keySchedule=new Uint32Array(l),d=this.invKeySchedule=new Uint32Array(l),f=this.sBox,h=this.rcon,p=this.invSubMix,v=p[0],g=p[1],m=p[2],y=p[3];for(a=0;a<l;a++)a<i?o=c[a]=t[a]:(u=o,a%i==0?(u=f[(u=u<<8|u>>>24)>>>24]<<24|f[u>>>16&255]<<16|f[u>>>8&255]<<8|f[255&u],u^=h[a/i|0]<<24):i>6&&a%i==4&&(u=f[u>>>24]<<24|f[u>>>16&255]<<16|f[u>>>8&255]<<8|f[255&u]),c[a]=o=(c[a-i]^u)>>>0);for(s=0;s<l;s++)a=l-s,u=3&s?c[a]:c[a-4],d[s]=s<4||a<=4?u:v[f[u>>>24]]^g[f[u>>>16&255]]^m[f[u>>>8&255]]^y[f[255&u]],d[s]=d[s]>>>0}},t.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},t.decrypt=function(e,t,r){for(var n,i,a,s,o,u,l,c,d,f,h,p,v,g,m=this.keySize+6,y=this.invKeySchedule,E=this.invSBox,_=this.invSubMix,T=_[0],b=_[1],S=_[2],A=_[3],L=this.uint8ArrayToUint32Array_(r),k=L[0],w=L[1],D=L[2],R=L[3],O=new Int32Array(e),C=new Int32Array(O.length),I=this.networkToHostOrderSwap;t<O.length;){for(d=I(O[t]),f=I(O[t+1]),h=I(O[t+2]),p=I(O[t+3]),o=d^y[0],u=p^y[1],l=h^y[2],c=f^y[3],v=4,g=1;g<m;g++)n=T[o>>>24]^b[u>>16&255]^S[l>>8&255]^A[255&c]^y[v],i=T[u>>>24]^b[l>>16&255]^S[c>>8&255]^A[255&o]^y[v+1],a=T[l>>>24]^b[c>>16&255]^S[o>>8&255]^A[255&u]^y[v+2],s=T[c>>>24]^b[o>>16&255]^S[u>>8&255]^A[255&l]^y[v+3],o=n,u=i,l=a,c=s,v+=4;n=E[o>>>24]<<24^E[u>>16&255]<<16^E[l>>8&255]<<8^E[255&c]^y[v],i=E[u>>>24]<<24^E[l>>16&255]<<16^E[c>>8&255]<<8^E[255&o]^y[v+1],a=E[l>>>24]<<24^E[c>>16&255]<<16^E[o>>8&255]<<8^E[255&u]^y[v+2],s=E[c>>>24]<<24^E[o>>16&255]<<16^E[u>>8&255]<<8^E[255&l]^y[v+3],C[t]=I(n^k),C[t+1]=I(s^w),C[t+2]=I(a^D),C[t+3]=I(i^R),k=d,w=f,D=h,R=p,t+=4}return C.buffer},e}()},"./src/crypt/decrypter.ts":
124
124
  /*!********************************!*\
125
125
  !*** ./src/crypt/decrypter.ts ***!
126
126
  \********************************/
@@ -176,7 +176,7 @@
176
176
  /*!*******************************************!*\
177
177
  !*** ./src/demux/transmuxer-interface.ts ***!
178
178
  \*******************************************/
179
- /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return d}));var n=r(/*! webworkify-webpack */"./node_modules/webworkify-webpack/index.js"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../errors */"./src/errors.ts"),u=r(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),l=r(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),c=Object(u.getMediaSource)()||{isTypeSupported:function(){return!1}},d=function(){function e(e,t,r,u){var d=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=e,this.id=t,this.onTransmuxComplete=r,this.onFlush=u;var f=e.config,h=function(t,r){(r=r||{}).frag=d.frag,r.id=d.id,e.trigger(t,r)};this.observer=new l.EventEmitter,this.observer.on(i.Events.FRAG_DECRYPTED,h),this.observer.on(i.Events.ERROR,h);var p={mp4:c.isTypeSupported("video/mp4"),mpeg:c.isTypeSupported("audio/mpeg"),mp3:c.isTypeSupported('audio/mp4; codecs="mp3"')},v=navigator.vendor;if(f.enableWorker&&"undefined"!=typeof Worker){var g;s.logger.log("demuxing in webworker");try{g=this.worker=n(/*! ../demux/transmuxer-worker.ts */"./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),g.addEventListener("message",this.onwmsg),g.onerror=function(t){e.trigger(i.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(t.message+" ("+t.filename+":"+t.lineno+")")})},g.postMessage({cmd:"init",typeSupported:p,vendor:v,id:t,config:JSON.stringify(f)})}catch(e){s.logger.warn("Error in worker:",e),s.logger.error("Error while initializing DemuxerWorker, fallback to inline"),g&&self.URL.revokeObjectURL(g.objectURL),this.transmuxer=new a.default(this.observer,p,f,v),this.worker=null}}else this.transmuxer=new a.default(this.observer,p,f,v)}var t=e.prototype;return t.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null;else{var t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}var r=this.observer;r&&r.removeAllListeners(),this.observer=null},t.push=function(e,t,r,n,i,o,u,l,c,d){var f=this;c.transmuxing.start=self.performance.now();var h=this.transmuxer,p=this.worker,v=o?o.start:i.start,g=i.decryptdata,m=this.frag,y=!(m&&i.cc===m.cc),E=!(m&&c.level===m.level),_=m?c.sn-m.sn:-1,T=this.part?c.part-this.part.index:1,b=!E&&(1===_||0===_&&1===T),A=self.performance.now();(E||_||0===i.stats.parsing.start)&&(i.stats.parsing.start=A),!o||!T&&b||(o.stats.parsing.start=A);var S=new a.TransmuxState(y,b,l,E,v);if(!b||y){s.logger.log("[transmuxer-interface, "+i.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+"\n discontinuity: "+y+"\n trackSwitch: "+E+"\n contiguous: "+b+"\n accurateTimeOffset: "+l+"\n timeOffset: "+v);var L=new a.TransmuxConfig(r,n,t,u,d);this.configureTransmuxer(L)}if(this.frag=i,this.part=o,p)p.postMessage({cmd:"demux",data:e,decryptdata:g,chunkMeta:c,state:S},e instanceof ArrayBuffer?[e]:[]);else if(h){var k=h.push(e,g,c,S);Object(a.isPromise)(k)?k.then((function(e){f.handleTransmuxComplete(e)})):this.handleTransmuxComplete(k)}},t.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var r=this.transmuxer,n=this.worker;if(n)n.postMessage({cmd:"flush",chunkMeta:e});else if(r){var i=r.flush(e);Object(a.isPromise)(i)?i.then((function(r){t.handleFlushResult(r,e)})):this.handleFlushResult(i,e)}},t.handleFlushResult=function(e,t){var r=this;e.forEach((function(e){r.handleTransmuxComplete(e)})),this.onFlush(t)},t.onWorkerMessage=function(e){var t=e.data,r=this.hls;switch(t.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,r.trigger(t.event,t.data)}},t.configureTransmuxer=function(e){var t=this.worker,r=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):r&&r.configure(e)},t.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},e}()},"./src/demux/transmuxer-worker.ts":
179
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return d}));var n=r(/*! webworkify-webpack */"./node_modules/webworkify-webpack/index.js"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../errors */"./src/errors.ts"),u=r(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),l=r(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),c=Object(u.getMediaSource)()||{isTypeSupported:function(){return!1}},d=function(){function e(e,t,r,u){var d=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=e,this.id=t,this.onTransmuxComplete=r,this.onFlush=u;var f=e.config,h=function(t,r){(r=r||{}).frag=d.frag,r.id=d.id,e.trigger(t,r)};this.observer=new l.EventEmitter,this.observer.on(i.Events.FRAG_DECRYPTED,h),this.observer.on(i.Events.ERROR,h);var p={mp4:c.isTypeSupported("video/mp4"),mpeg:c.isTypeSupported("audio/mpeg"),mp3:c.isTypeSupported('audio/mp4; codecs="mp3"')},v=navigator.vendor;if(f.enableWorker&&"undefined"!=typeof Worker){var g;s.logger.log("demuxing in webworker");try{g=this.worker=n(/*! ../demux/transmuxer-worker.ts */"./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),g.addEventListener("message",this.onwmsg),g.onerror=function(t){e.trigger(i.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(t.message+" ("+t.filename+":"+t.lineno+")")})},g.postMessage({cmd:"init",typeSupported:p,vendor:v,id:t,config:JSON.stringify(f)})}catch(e){s.logger.warn("Error in worker:",e),s.logger.error("Error while initializing DemuxerWorker, fallback to inline"),g&&self.URL.revokeObjectURL(g.objectURL),this.transmuxer=new a.default(this.observer,p,f,v),this.worker=null}}else this.transmuxer=new a.default(this.observer,p,f,v)}var t=e.prototype;return t.destroy=function(){var e=this.worker;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null;else{var t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}var r=this.observer;r&&r.removeAllListeners(),this.observer=null},t.push=function(e,t,r,n,i,o,u,l,c,d){var f=this;c.transmuxing.start=self.performance.now();var h=this.transmuxer,p=this.worker,v=o?o.start:i.start,g=i.decryptdata,m=this.frag,y=!(m&&i.cc===m.cc),E=!(m&&c.level===m.level),_=m?c.sn-m.sn:-1,T=this.part?c.part-this.part.index:1,b=!E&&(1===_||0===_&&1===T),S=self.performance.now();(E||_||0===i.stats.parsing.start)&&(i.stats.parsing.start=S),!o||!T&&b||(o.stats.parsing.start=S);var A=new a.TransmuxState(y,b,l,E,v);if(!b||y){s.logger.log("[transmuxer-interface, "+i.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+"\n discontinuity: "+y+"\n trackSwitch: "+E+"\n contiguous: "+b+"\n accurateTimeOffset: "+l+"\n timeOffset: "+v);var L=new a.TransmuxConfig(r,n,t,u,d);this.configureTransmuxer(L)}if(this.frag=i,this.part=o,p)p.postMessage({cmd:"demux",data:e,decryptdata:g,chunkMeta:c,state:A},e instanceof ArrayBuffer?[e]:[]);else if(h){var k=h.push(e,g,c,A);Object(a.isPromise)(k)?k.then((function(e){f.handleTransmuxComplete(e)})):this.handleTransmuxComplete(k)}},t.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var r=this.transmuxer,n=this.worker;if(n)n.postMessage({cmd:"flush",chunkMeta:e});else if(r){var i=r.flush(e);Object(a.isPromise)(i)?i.then((function(r){t.handleFlushResult(r,e)})):this.handleFlushResult(i,e)}},t.handleFlushResult=function(e,t){var r=this;e.forEach((function(e){r.handleTransmuxComplete(e)})),this.onFlush(t)},t.onWorkerMessage=function(e){var t=e.data,r=this.hls;switch(t.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,r.trigger(t.event,t.data)}},t.configureTransmuxer=function(e){var t=this.worker,r=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):r&&r.configure(e)},t.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},e}()},"./src/demux/transmuxer-worker.ts":
180
180
  /*!****************************************!*\
181
181
  !*** ./src/demux/transmuxer-worker.ts ***!
182
182
  \****************************************/
@@ -184,11 +184,11 @@
184
184
  /*!*********************************!*\
185
185
  !*** ./src/demux/transmuxer.ts ***!
186
186
  \*********************************/
187
- /*! exports provided: default, isPromise, TransmuxConfig, TransmuxState */function(e,t,r){r.r(t),r.d(t,"default",(function(){return y})),r.d(t,"isPromise",(function(){return _})),r.d(t,"TransmuxConfig",(function(){return T})),r.d(t,"TransmuxState",(function(){return b}));var n,i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../errors */"./src/errors.ts"),s=r(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),o=r(/*! ../demux/aacdemuxer */"./src/demux/aacdemuxer.ts"),u=r(/*! ../demux/mp4demuxer */"./src/demux/mp4demuxer.ts"),l=r(/*! ../demux/tsdemuxer */"./src/demux/tsdemuxer.ts"),c=r(/*! ../demux/mp3demuxer */"./src/demux/mp3demuxer.ts"),d=r(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),f=r(/*! ../remux/passthrough-remuxer */"./src/remux/passthrough-remuxer.ts"),h=r(/*! ./chunk-cache */"./src/demux/chunk-cache.ts"),p=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),v=r(/*! ../utils/logger */"./src/utils/logger.ts");try{n=self.performance.now.bind(self.performance)}catch(e){v.logger.debug("Unable to use Performance API on this environment"),n=self.Date.now}var g=[{demux:l.default,remux:d.default},{demux:u.default,remux:f.default},{demux:o.default,remux:d.default},{demux:c.default,remux:d.default}],m=1024;g.forEach((function(e){var t=e.demux;m=Math.max(m,t.minProbeByteLength)}));var y=function(){function e(e,t,r,n){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new h.default,this.observer=e,this.typeSupported=t,this.config=r,this.vendor=n}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,r,i){var a=this,s=r.transmuxing;s.executeStart=n();var o=new Uint8Array(e),u=this.cache,l=this.config,c=this.currentTransmuxState,d=this.transmuxConfig;i&&(this.currentTransmuxState=i);var f=function(e,t){var r=null;return e.byteLength>0&&null!=t&&null!=t.key&&null!==t.iv&&null!=t.method&&(r=t),r}(o,t);if(f&&"AES-128"===f.method){var h=this.getDecrypter();if(!l.enableSoftwareAES)return this.decryptionPromise=h.webCryptoDecrypt(o,f.key.buffer,f.iv.buffer).then((function(e){var t=a.push(e,null,r);return a.decryptionPromise=null,t})),this.decryptionPromise;var v=h.softwareDecrypt(o,f.key.buffer,f.iv.buffer);if(!v)return s.executeEnd=n(),E(r);o=new Uint8Array(v)}var g=i||c,m=g.contiguous,y=g.discontinuity,_=g.trackSwitch,T=g.accurateTimeOffset,b=g.timeOffset,A=d.audioCodec,S=d.videoCodec,L=d.defaultInitPts,k=d.duration,w=d.initSegmentData;if((y||_)&&this.resetInitSegment(w,A,S,k),y&&this.resetInitialTimestamp(L),m||this.resetContiguity(),this.needsProbing(o,y,_)){if(u.dataLength){var D=u.flush();o=Object(p.appendUint8Array)(D,o)}this.configureTransmuxer(o,d)}var R=this.transmux(o,f,b,T,r),O=this.currentTransmuxState;return O.contiguous=!0,O.discontinuity=!1,O.trackSwitch=!1,s.executeEnd=n(),R},t.flush=function(e){var t=this,r=e.transmuxing;r.executeStart=n();var s=this.decrypter,o=this.cache,u=this.currentTransmuxState,l=this.decryptionPromise;if(l)return l.then((function(){return t.flush(e)}));var c=[],d=u.timeOffset;if(s){var f=s.flush();f&&c.push(this.push(f,null,e))}var h=o.dataLength;o.reset();var p=this.demuxer,v=this.remuxer;if(!p||!v)return h>=m&&this.observer.emit(i.Events.ERROR,i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),r.executeEnd=n(),[E(e)];var g=p.flush(d);return _(g)?g.then((function(r){return t.flushRemux(c,r,e),c})):(this.flushRemux(c,g,e),c)},t.flushRemux=function(e,t,r){var i=t.audioTrack,a=t.avcTrack,s=t.id3Track,o=t.textTrack,u=this.currentTransmuxState,l=u.accurateTimeOffset,c=u.timeOffset;v.logger.log("[transmuxer.ts]: Flushed fragment "+r.sn+(r.part>-1?" p: "+r.part:"")+" of level "+r.level);var d=this.remuxer.remux(i,a,s,o,c,l,!0);e.push({remuxResult:d,chunkMeta:r}),r.transmuxing.executeEnd=n()},t.resetInitialTimestamp=function(e){var t=this.demuxer,r=this.remuxer;t&&r&&(t.resetTimeStamp(e),r.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,r,n){var i=this.demuxer,a=this.remuxer;i&&a&&(i.resetInitSegment(t,r,n),a.resetInitSegment(e,t,r))},t.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},t.transmux=function(e,t,r,n,i){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,r,n,i):this.transmuxUnencrypted(e,r,n,i)},t.transmuxUnencrypted=function(e,t,r,n){var i=this.demuxer.demux(e,t,!1,!this.config.progressive),a=i.audioTrack,s=i.avcTrack,o=i.id3Track,u=i.textTrack;return{remuxResult:this.remuxer.remux(a,s,o,u,t,r,!1),chunkMeta:n}},t.transmuxSampleAes=function(e,t,r,n,i){var a=this;return this.demuxer.demuxSampleAes(e,t,r).then((function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.avcTrack,e.id3Track,e.textTrack,r,n,!1),chunkMeta:i}}))},t.configureTransmuxer=function(e,t){for(var r,n=this.config,i=this.observer,a=this.typeSupported,s=this.vendor,o=t.audioCodec,l=t.defaultInitPts,c=t.duration,d=t.initSegmentData,h=t.videoCodec,p=0,m=g.length;p<m;p++)if(g[p].demux.probe(e)){r=g[p];break}r||(v.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),r={demux:u.default,remux:f.default});var y=this.demuxer,E=this.remuxer,_=r.remux,T=r.demux;E&&E instanceof _||(this.remuxer=new _(i,n,a,s)),y&&y instanceof T||(this.demuxer=new T(i,n,a),this.probe=T.probe),this.resetInitSegment(d,o,h,c),this.resetInitialTimestamp(l)},t.needsProbing=function(e,t,r){return!this.demuxer||!this.remuxer||t||r},t.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new s.default(this.observer,this.config)),e},e}(),E=function(e){return{remuxResult:{},chunkMeta:e}};function _(e){return"then"in e&&e.then instanceof Function}var T=function(e,t,r,n,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=r,this.duration=n,this.defaultInitPts=i},b=function(e,t,r,n,i){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=r,this.trackSwitch=n,this.timeOffset=i}},"./src/demux/tsdemuxer.ts":
187
+ /*! exports provided: default, isPromise, TransmuxConfig, TransmuxState */function(e,t,r){r.r(t),r.d(t,"default",(function(){return y})),r.d(t,"isPromise",(function(){return _})),r.d(t,"TransmuxConfig",(function(){return T})),r.d(t,"TransmuxState",(function(){return b}));var n,i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../errors */"./src/errors.ts"),s=r(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),o=r(/*! ../demux/aacdemuxer */"./src/demux/aacdemuxer.ts"),u=r(/*! ../demux/mp4demuxer */"./src/demux/mp4demuxer.ts"),l=r(/*! ../demux/tsdemuxer */"./src/demux/tsdemuxer.ts"),c=r(/*! ../demux/mp3demuxer */"./src/demux/mp3demuxer.ts"),d=r(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),f=r(/*! ../remux/passthrough-remuxer */"./src/remux/passthrough-remuxer.ts"),h=r(/*! ./chunk-cache */"./src/demux/chunk-cache.ts"),p=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),v=r(/*! ../utils/logger */"./src/utils/logger.ts");try{n=self.performance.now.bind(self.performance)}catch(e){v.logger.debug("Unable to use Performance API on this environment"),n=self.Date.now}var g=[{demux:l.default,remux:d.default},{demux:u.default,remux:f.default},{demux:o.default,remux:d.default},{demux:c.default,remux:d.default}],m=1024;g.forEach((function(e){var t=e.demux;m=Math.max(m,t.minProbeByteLength)}));var y=function(){function e(e,t,r,n){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new h.default,this.observer=e,this.typeSupported=t,this.config=r,this.vendor=n}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,r,i){var a=this,s=r.transmuxing;s.executeStart=n();var o=new Uint8Array(e),u=this.cache,l=this.config,c=this.currentTransmuxState,d=this.transmuxConfig;i&&(this.currentTransmuxState=i);var f=function(e,t){var r=null;return e.byteLength>0&&null!=t&&null!=t.key&&null!==t.iv&&null!=t.method&&(r=t),r}(o,t);if(f&&"AES-128"===f.method){var h=this.getDecrypter();if(!l.enableSoftwareAES)return this.decryptionPromise=h.webCryptoDecrypt(o,f.key.buffer,f.iv.buffer).then((function(e){var t=a.push(e,null,r);return a.decryptionPromise=null,t})),this.decryptionPromise;var v=h.softwareDecrypt(o,f.key.buffer,f.iv.buffer);if(!v)return s.executeEnd=n(),E(r);o=new Uint8Array(v)}var g=i||c,m=g.contiguous,y=g.discontinuity,_=g.trackSwitch,T=g.accurateTimeOffset,b=g.timeOffset,S=d.audioCodec,A=d.videoCodec,L=d.defaultInitPts,k=d.duration,w=d.initSegmentData;if((y||_)&&this.resetInitSegment(w,S,A,k),y&&this.resetInitialTimestamp(L),m||this.resetContiguity(),this.needsProbing(o,y,_)){if(u.dataLength){var D=u.flush();o=Object(p.appendUint8Array)(D,o)}this.configureTransmuxer(o,d)}var R=this.transmux(o,f,b,T,r),O=this.currentTransmuxState;return O.contiguous=!0,O.discontinuity=!1,O.trackSwitch=!1,s.executeEnd=n(),R},t.flush=function(e){var t=this,r=e.transmuxing;r.executeStart=n();var s=this.decrypter,o=this.cache,u=this.currentTransmuxState,l=this.decryptionPromise;if(l)return l.then((function(){return t.flush(e)}));var c=[],d=u.timeOffset;if(s){var f=s.flush();f&&c.push(this.push(f,null,e))}var h=o.dataLength;o.reset();var p=this.demuxer,v=this.remuxer;if(!p||!v)return h>=m&&this.observer.emit(i.Events.ERROR,i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),r.executeEnd=n(),[E(e)];var g=p.flush(d);return _(g)?g.then((function(r){return t.flushRemux(c,r,e),c})):(this.flushRemux(c,g,e),c)},t.flushRemux=function(e,t,r){var i=t.audioTrack,a=t.avcTrack,s=t.id3Track,o=t.textTrack,u=this.currentTransmuxState,l=u.accurateTimeOffset,c=u.timeOffset;v.logger.log("[transmuxer.ts]: Flushed fragment "+r.sn+(r.part>-1?" p: "+r.part:"")+" of level "+r.level);var d=this.remuxer.remux(i,a,s,o,c,l,!0);e.push({remuxResult:d,chunkMeta:r}),r.transmuxing.executeEnd=n()},t.resetInitialTimestamp=function(e){var t=this.demuxer,r=this.remuxer;t&&r&&(t.resetTimeStamp(e),r.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,r,n){var i=this.demuxer,a=this.remuxer;i&&a&&(i.resetInitSegment(t,r,n),a.resetInitSegment(e,t,r))},t.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},t.transmux=function(e,t,r,n,i){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,r,n,i):this.transmuxUnencrypted(e,r,n,i)},t.transmuxUnencrypted=function(e,t,r,n){var i=this.demuxer.demux(e,t,!1,!this.config.progressive),a=i.audioTrack,s=i.avcTrack,o=i.id3Track,u=i.textTrack;return{remuxResult:this.remuxer.remux(a,s,o,u,t,r,!1),chunkMeta:n}},t.transmuxSampleAes=function(e,t,r,n,i){var a=this;return this.demuxer.demuxSampleAes(e,t,r).then((function(e){return{remuxResult:a.remuxer.remux(e.audioTrack,e.avcTrack,e.id3Track,e.textTrack,r,n,!1),chunkMeta:i}}))},t.configureTransmuxer=function(e,t){for(var r,n=this.config,i=this.observer,a=this.typeSupported,s=this.vendor,o=t.audioCodec,l=t.defaultInitPts,c=t.duration,d=t.initSegmentData,h=t.videoCodec,p=0,m=g.length;p<m;p++)if(g[p].demux.probe(e)){r=g[p];break}r||(v.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),r={demux:u.default,remux:f.default});var y=this.demuxer,E=this.remuxer,_=r.remux,T=r.demux;E&&E instanceof _||(this.remuxer=new _(i,n,a,s)),y&&y instanceof T||(this.demuxer=new T(i,n,a),this.probe=T.probe),this.resetInitSegment(d,o,h,c),this.resetInitialTimestamp(l)},t.needsProbing=function(e,t,r){return!this.demuxer||!this.remuxer||t||r},t.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new s.default(this.observer,this.config)),e},e}(),E=function(e){return{remuxResult:{},chunkMeta:e}};function _(e){return"then"in e&&e.then instanceof Function}var T=function(e,t,r,n,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=r,this.duration=n,this.defaultInitPts=i},b=function(e,t,r,n,i){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=r,this.trackSwitch=n,this.timeOffset=i}},"./src/demux/tsdemuxer.ts":
188
188
  /*!********************************!*\
189
189
  !*** ./src/demux/tsdemuxer.ts ***!
190
190
  \********************************/
191
- /*! exports provided: discardEPB, default */function(e,t,r){r.r(t),r.d(t,"discardEPB",(function(){return _}));var n=r(/*! ./adts */"./src/demux/adts.ts"),i=r(/*! ./mpegaudio */"./src/demux/mpegaudio.ts"),a=r(/*! ./exp-golomb */"./src/demux/exp-golomb.ts"),s=r(/*! ./id3 */"./src/demux/id3.ts"),o=r(/*! ./sample-aes */"./src/demux/sample-aes.ts"),u=r(/*! ../events */"./src/events.ts"),l=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),c=r(/*! ../utils/logger */"./src/utils/logger.ts"),d=r(/*! ../errors */"./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},h=function(){function e(e,t,r){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=e,this.config=t,this.typeSupported=r}e.probe=function(t){var r=e.syncOffset(t);return!(r<0||(r&&c.logger.warn("MPEG2-TS detected but first sync word found @ offset "+r+", junk ahead ?"),0))},e.syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),r=0;r<t;){if(71===e[r]&&71===e[r+188]&&71===e[r+376])return r;r++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:f[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}};var t=e.prototype;return t.resetInitSegment=function(t,r,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=e.createTrack("video",n),this._audioTrack=e.createTrack("audio",n),this._id3Track=e.createTrack("id3",n),this._txtTrack=e.createTrack("text",n),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=t,this.videoCodec=r,this._duration=n},t.resetTimeStamp=function(){},t.resetContiguity=function(){var e=this._audioTrack,t=this._avcTrack,r=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},t.demux=function(t,r,n,i){var a;void 0===n&&(n=!1),void 0===i&&(i=!1),n||(this.sampleAes=null);var s=this._avcTrack,o=this._audioTrack,f=this._id3Track,h=s.pid,p=s.pesData,y=o.pid,E=f.pid,_=o.pesData,T=f.pesData,b=!1,A=this.pmtParsed,S=this._pmtId,L=t.length;if(this.remainderData&&(L=(t=Object(l.appendUint8Array)(this.remainderData,t)).length,this.remainderData=null),L<188&&!i)return this.remainderData=t,{audioTrack:o,avcTrack:s,id3Track:f,textTrack:this._txtTrack};var k=Math.max(0,e.syncOffset(t));(L-=(L+k)%188)<t.byteLength&&!i&&(this.remainderData=new Uint8Array(t.buffer,L,t.buffer.byteLength-L));for(var w=k;w<L;w+=188)if(71===t[w]){var D=!!(64&t[w+1]),R=((31&t[w+1])<<8)+t[w+2],O=void 0;if((48&t[w+3])>>4>1){if((O=w+5+t[w+4])===w+188)continue}else O=w+4;switch(R){case h:D&&(p&&(a=m(p))&&this.parseAVCPES(a,!1),p={data:[],size:0}),p&&(p.data.push(t.subarray(O,w+188)),p.size+=w+188-O);break;case y:D&&(_&&(a=m(_))&&(o.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),_={data:[],size:0}),_&&(_.data.push(t.subarray(O,w+188)),_.size+=w+188-O);break;case E:D&&(T&&(a=m(T))&&this.parseID3PES(a),T={data:[],size:0}),T&&(T.data.push(t.subarray(O,w+188)),T.size+=w+188-O);break;case 0:D&&(O+=t[O]+1),S=this._pmtId=v(t,O);break;case S:D&&(O+=t[O]+1);var C=g(t,O,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,n);(h=C.avc)>0&&(s.pid=h),(y=C.audio)>0&&(o.pid=y,o.isAAC=C.isAAC),(E=C.id3)>0&&(f.pid=E),b&&!A&&(c.logger.log("reparse from beginning"),b=!1,w=k-188),A=this.pmtParsed=!0;break;case 17:case 8191:break;default:b=!0}}else this.observer.emit(u.Events.ERROR,u.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});s.pesData=p,o.pesData=_,f.pesData=T;var I={audioTrack:o,avcTrack:s,id3Track:f,textTrack:this._txtTrack};return i&&this.extractRemainingSamples(I),I},t.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},t.extractRemainingSamples=function(e){var t,r=e.audioTrack,n=e.avcTrack,i=e.id3Track,a=n.pesData,s=r.pesData,o=i.pesData;a&&(t=m(a))?(this.parseAVCPES(t,!0),n.pesData=null):n.pesData=a,s&&(t=m(s))?(r.isAAC?this.parseAACPES(t):this.parseMPEGPES(t),r.pesData=null):(null!=s&&s.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=s),o&&(t=m(o))?(this.parseID3PES(t),i.pesData=null):i.pesData=o},t.demuxSampleAes=function(e,t,r){var n=this.demux(e,r,!0,!this.config.progressive),i=this.sampleAes=new o.default(this.observer,this.config,t);return this.decrypt(n,i)},t.decrypt=function(e,t){return new Promise((function(r){var n=e.audioTrack,i=e.avcTrack;n.samples&&n.isAAC?t.decryptAacSamples(n.samples,0,(function(){i.samples?t.decryptAvcSamples(i.samples,0,0,(function(){r(e)})):r(e)})):i.samples&&t.decryptAvcSamples(i.samples,0,0,(function(){r(e)}))}))},t.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},t.parseAVCPES=function(e,t){var r,n=this,i=this._avcTrack,o=this.parseAVCNALu(e.data),u=this.avcSample,l=!1;e.data=null,u&&o.length&&!i.audFound&&(y(u,i),u=this.avcSample=p(!1,e.pts,e.dts,"")),o.forEach((function(t){switch(t.type){case 1:r=!0,u||(u=n.avcSample=p(!0,e.pts,e.dts,"")),u.frame=!0;var o=t.data;if(l&&o.length>4){var c=new a.default(o).readSliceType();2!==c&&4!==c&&7!==c&&9!==c||(u.key=!0)}break;case 5:r=!0,u||(u=n.avcSample=p(!0,e.pts,e.dts,"")),u.key=!0,u.frame=!0;break;case 6:r=!0;var d=new a.default(_(t.data));d.readUByte();for(var f=0,h=0,v=!1,g=0;!v&&d.bytesAvailable>1;){f=0;do{f+=g=d.readUByte()}while(255===g);h=0;do{h+=g=d.readUByte()}while(255===g);if(4===f&&0!==d.bytesAvailable){if(v=!0,181===d.readUByte()&&49===d.readUShort()&&1195456820===d.readUInt()&&3===d.readUByte()){for(var m=d.readUByte(),T=31&m,b=[m,d.readUByte()],A=0;A<T;A++)b.push(d.readUByte()),b.push(d.readUByte()),b.push(d.readUByte());E(n._txtTrack.samples,{type:3,pts:e.pts,bytes:b})}}else if(5===f&&0!==d.bytesAvailable){if(v=!0,h>16){for(var S=[],L=0;L<16;L++)S.push(d.readUByte().toString(16)),3!==L&&5!==L&&7!==L&&9!==L||S.push("-");for(var k=h-16,w=new Uint8Array(k),D=0;D<k;D++)w[D]=d.readUByte();E(n._txtTrack.samples,{pts:e.pts,payloadType:f,uuid:S.join(""),userData:Object(s.utf8ArrayToStr)(w),userDataBytes:w})}}else if(h<d.bytesAvailable)for(var R=0;R<h;R++)d.readUByte()}break;case 7:if(r=!0,l=!0,!i.sps){var O=new a.default(t.data).readSPS();i.width=O.width,i.height=O.height,i.pixelRatio=O.pixelRatio,i.sps=[t.data],i.duration=n._duration;for(var C=t.data.subarray(1,4),I="avc1.",x=0;x<3;x++){var P=C[x].toString(16);P.length<2&&(P="0"+P),I+=P}i.codec=I}break;case 8:r=!0,i.pps||(i.pps=[t.data]);break;case 9:r=!1,i.audFound=!0,u&&y(u,i),u=n.avcSample=p(!1,e.pts,e.dts,"");break;case 12:r=!1;break;default:r=!1,u&&(u.debug+="unknown NAL "+t.type+" ")}u&&r&&u.units.push(t)})),t&&u&&(y(u,i),this.avcSample=null)},t.getLastNalUnit=function(){var e,t,r=this.avcSample;if(!r||0===r.units.length){var n=this._avcTrack.samples;r=n[n.length-1]}if(null!==(e=r)&&void 0!==e&&e.units){var i=r.units;t=i[i.length-1]}return t},t.parseAVCNALu=function(e){var t,r,n=e.byteLength,i=this._avcTrack,a=i.naluState||0,s=a,o=[],u=0,l=-1,c=0;for(-1===a&&(l=0,c=31&e[0],a=0,u=1);u<n;)if(t=e[u++],a)if(1!==a)if(t)if(1===t){if(l>=0){var d={data:e.subarray(l,u-a-1),type:c};o.push(d)}else{var f=this.getLastNalUnit();if(f&&(s&&u<=4-s&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-s)),(r=u-a-1)>0)){var h=new Uint8Array(f.data.byteLength+r);h.set(f.data,0),h.set(e.subarray(0,r),f.data.byteLength),f.data=h}}u<n?(l=u,c=31&e[u],a=0):a=-1}else a=0;else a=3;else a=t?0:2;else a=t?0:1;if(l>=0&&a>=0){var p={data:e.subarray(l,n),type:c,state:a};o.push(p)}if(0===o.length){var v=this.getLastNalUnit();if(v){var g=new Uint8Array(v.data.byteLength+e.byteLength);g.set(v.data,0),g.set(e,v.data.byteLength),v.data=g}}return i.naluState=a,o},t.parseAACPES=function(e){var t,r,i,a,s=this._audioTrack,o=this.aacLastPTS,l=this.aacOverFlow,f=e.data;if(l){var h=new Uint8Array(l.byteLength+f.byteLength);h.set(l,0),h.set(f,l.byteLength),f=h}for(t=0,r=f.length;t<r-1&&!n.isHeader(f,t);t++);if(!t||(t<r-1?(i="AAC PES did not start with ADTS header,offset:"+t,a=!1):(i="no ADTS header found in AAC PES",a=!0),c.logger.warn("parsing error:"+i),this.observer.emit(u.Events.ERROR,u.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:a,reason:i}),!a)){n.initTrackConfig(s,this.observer,f,t,this.audioCodec);var p,v=0,g=n.getFrameDuration(s.samplerate);if(void 0!==e.pts)p=e.pts;else{if(null===o)return void c.logger.warn("[tsdemuxer]: AAC PES unknown PTS");p=o}if(l&&null!==o){var m=o+g;Math.abs(m-p)>1&&(c.logger.log("[tsdemuxer]: AAC: align PTS for overlapping frames by "+Math.round((m-p)/90)),p=m)}for(var y=null;t<r;){if(n.isHeader(f,t)){if(t+5<r){var E=n.appendFrame(s,f,t,p,v);if(E){t+=E.length,y=E.sample.pts,v++;continue}}break}t++}this.aacOverFlow=t<r?f.subarray(t,r):null,this.aacLastPTS=y}},t.parseMPEGPES=function(e){var t=e.data,r=t.length,n=0,a=0,s=e.pts;if(void 0!==s)for(;a<r;)if(i.isHeader(t,a)){var o=i.appendFrame(this._audioTrack,t,a,s,n);if(!o)break;a+=o.length,n++}else a++;else c.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},t.parseID3PES=function(e){void 0!==e.pts?this._id3Track.samples.push(e):c.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},e}();function p(e,t,r,n){return{key:e,frame:!1,pts:t,dts:r,units:[],debug:n,length:0}}function v(e,t){return(31&e[t+10])<<8|e[t+11]}function g(e,t,r,n){var i={audio:-1,avc:-1,id3:-1,isAAC:!0},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<a;){var s=(31&e[t+1])<<8|e[t+2];switch(e[t]){case 207:if(!n){c.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===i.audio&&(i.audio=s);break;case 21:-1===i.id3&&(i.id3=s);break;case 219:if(!n){c.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===i.avc&&(i.avc=s);break;case 3:case 4:r?-1===i.audio&&(i.audio=s,i.isAAC=!1):c.logger.log("MPEG audio found, not supported in this browser");break;case 36:c.logger.warn("Unsupported HEVC stream type found")}t+=5+((15&e[t+3])<<8|e[t+4])}return i}function m(e){var t,r,n,i,a,s=0,o=e.data;if(!e||0===e.size)return null;for(;o[0].length<19&&o.length>1;){var u=new Uint8Array(o[0].length+o[1].length);u.set(o[0]),u.set(o[1],o[0].length),o[0]=u,o.splice(1,1)}if(1===((t=o[0])[0]<<16)+(t[1]<<8)+t[2]){if((r=(t[4]<<8)+t[5])&&r>e.size-6)return null;var l=t[7];192&l&&(i=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?i-(a=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(c.logger.warn(Math.round((i-a)/9e4)+"s delta between PTS and DTS, align them"),i=a):a=i);var d=(n=t[8])+9;if(e.size<=d)return null;e.size-=d;for(var f=new Uint8Array(e.size),h=0,p=o.length;h<p;h++){var v=(t=o[h]).byteLength;if(d){if(d>v){d-=v;continue}t=t.subarray(d),v-=d,d=0}f.set(t,s),s+=v}return r&&(r-=n+3),{data:f,pts:i,dts:a,len:r}}return null}function y(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var r=t.samples,n=r.length;if(!n)return void t.dropped++;var i=r[n-1];e.pts=i.pts,e.dts=i.dts}t.samples.push(e)}e.debug.length&&c.logger.log(e.pts+"/"+e.dts+":"+e.debug)}function E(e,t){var r=e.length;if(r>0){if(t.pts>=e[r-1].pts)e.push(t);else for(var n=r-1;n>=0;n--)if(t.pts<e[n].pts){e.splice(n,0,t);break}}else e.push(t)}function _(e){for(var t=e.byteLength,r=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(0===r.length)return e;var i=t-r.length,a=new Uint8Array(i),s=0;for(n=0;n<i;s++,n++)s===r[0]&&(s++,r.shift()),a[n]=e[s];return a}h.minProbeByteLength=188,t.default=h},"./src/errors.ts":
191
+ /*! exports provided: discardEPB, default */function(e,t,r){r.r(t),r.d(t,"discardEPB",(function(){return _}));var n=r(/*! ./adts */"./src/demux/adts.ts"),i=r(/*! ./mpegaudio */"./src/demux/mpegaudio.ts"),a=r(/*! ./exp-golomb */"./src/demux/exp-golomb.ts"),s=r(/*! ./id3 */"./src/demux/id3.ts"),o=r(/*! ./sample-aes */"./src/demux/sample-aes.ts"),u=r(/*! ../events */"./src/events.ts"),l=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),c=r(/*! ../utils/logger */"./src/utils/logger.ts"),d=r(/*! ../errors */"./src/errors.ts"),f={video:1,audio:2,id3:3,text:4},h=function(){function e(e,t,r){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=e,this.config=t,this.typeSupported=r}e.probe=function(t){var r=e.syncOffset(t);return!(r<0||(r&&c.logger.warn("MPEG2-TS detected but first sync word found @ offset "+r+", junk ahead ?"),0))},e.syncOffset=function(e){for(var t=Math.min(1e3,e.length-564),r=0;r<t;){if(71===e[r]&&71===e[r+188]&&71===e[r+376])return r;r++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:f[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}};var t=e.prototype;return t.resetInitSegment=function(t,r,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=e.createTrack("video",n),this._audioTrack=e.createTrack("audio",n),this._id3Track=e.createTrack("id3",n),this._txtTrack=e.createTrack("text",n),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=t,this.videoCodec=r,this._duration=n},t.resetTimeStamp=function(){},t.resetContiguity=function(){var e=this._audioTrack,t=this._avcTrack,r=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},t.demux=function(t,r,n,i){var a;void 0===n&&(n=!1),void 0===i&&(i=!1),n||(this.sampleAes=null);var s=this._avcTrack,o=this._audioTrack,f=this._id3Track,h=s.pid,p=s.pesData,y=o.pid,E=f.pid,_=o.pesData,T=f.pesData,b=!1,S=this.pmtParsed,A=this._pmtId,L=t.length;if(this.remainderData&&(L=(t=Object(l.appendUint8Array)(this.remainderData,t)).length,this.remainderData=null),L<188&&!i)return this.remainderData=t,{audioTrack:o,avcTrack:s,id3Track:f,textTrack:this._txtTrack};var k=Math.max(0,e.syncOffset(t));(L-=(L+k)%188)<t.byteLength&&!i&&(this.remainderData=new Uint8Array(t.buffer,L,t.buffer.byteLength-L));for(var w=k;w<L;w+=188)if(71===t[w]){var D=!!(64&t[w+1]),R=((31&t[w+1])<<8)+t[w+2],O=void 0;if((48&t[w+3])>>4>1){if((O=w+5+t[w+4])===w+188)continue}else O=w+4;switch(R){case h:D&&(p&&(a=m(p))&&this.parseAVCPES(a,!1),p={data:[],size:0}),p&&(p.data.push(t.subarray(O,w+188)),p.size+=w+188-O);break;case y:D&&(_&&(a=m(_))&&(o.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),_={data:[],size:0}),_&&(_.data.push(t.subarray(O,w+188)),_.size+=w+188-O);break;case E:D&&(T&&(a=m(T))&&this.parseID3PES(a),T={data:[],size:0}),T&&(T.data.push(t.subarray(O,w+188)),T.size+=w+188-O);break;case 0:D&&(O+=t[O]+1),A=this._pmtId=v(t,O);break;case A:D&&(O+=t[O]+1);var C=g(t,O,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,n);(h=C.avc)>0&&(s.pid=h),(y=C.audio)>0&&(o.pid=y,o.isAAC=C.isAAC),(E=C.id3)>0&&(f.pid=E),b&&!S&&(c.logger.log("reparse from beginning"),b=!1,w=k-188),S=this.pmtParsed=!0;break;case 17:case 8191:break;default:b=!0}}else this.observer.emit(u.Events.ERROR,u.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});s.pesData=p,o.pesData=_,f.pesData=T;var I={audioTrack:o,avcTrack:s,id3Track:f,textTrack:this._txtTrack};return i&&this.extractRemainingSamples(I),I},t.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},t.extractRemainingSamples=function(e){var t,r=e.audioTrack,n=e.avcTrack,i=e.id3Track,a=n.pesData,s=r.pesData,o=i.pesData;a&&(t=m(a))?(this.parseAVCPES(t,!0),n.pesData=null):n.pesData=a,s&&(t=m(s))?(r.isAAC?this.parseAACPES(t):this.parseMPEGPES(t),r.pesData=null):(null!=s&&s.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=s),o&&(t=m(o))?(this.parseID3PES(t),i.pesData=null):i.pesData=o},t.demuxSampleAes=function(e,t,r){var n=this.demux(e,r,!0,!this.config.progressive),i=this.sampleAes=new o.default(this.observer,this.config,t);return this.decrypt(n,i)},t.decrypt=function(e,t){return new Promise((function(r){var n=e.audioTrack,i=e.avcTrack;n.samples&&n.isAAC?t.decryptAacSamples(n.samples,0,(function(){i.samples?t.decryptAvcSamples(i.samples,0,0,(function(){r(e)})):r(e)})):i.samples&&t.decryptAvcSamples(i.samples,0,0,(function(){r(e)}))}))},t.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},t.parseAVCPES=function(e,t){var r,n=this,i=this._avcTrack,o=this.parseAVCNALu(e.data),u=this.avcSample,l=!1;e.data=null,u&&o.length&&!i.audFound&&(y(u,i),u=this.avcSample=p(!1,e.pts,e.dts,"")),o.forEach((function(t){switch(t.type){case 1:r=!0,u||(u=n.avcSample=p(!0,e.pts,e.dts,"")),u.frame=!0;var o=t.data;if(l&&o.length>4){var c=new a.default(o).readSliceType();2!==c&&4!==c&&7!==c&&9!==c||(u.key=!0)}break;case 5:r=!0,u||(u=n.avcSample=p(!0,e.pts,e.dts,"")),u.key=!0,u.frame=!0;break;case 6:r=!0;var d=new a.default(_(t.data));d.readUByte();for(var f=0,h=0,v=!1,g=0;!v&&d.bytesAvailable>1;){f=0;do{f+=g=d.readUByte()}while(255===g);h=0;do{h+=g=d.readUByte()}while(255===g);if(4===f&&0!==d.bytesAvailable){if(v=!0,181===d.readUByte()&&49===d.readUShort()&&1195456820===d.readUInt()&&3===d.readUByte()){for(var m=d.readUByte(),T=31&m,b=[m,d.readUByte()],S=0;S<T;S++)b.push(d.readUByte()),b.push(d.readUByte()),b.push(d.readUByte());E(n._txtTrack.samples,{type:3,pts:e.pts,bytes:b})}}else if(5===f&&0!==d.bytesAvailable){if(v=!0,h>16){for(var A=[],L=0;L<16;L++)A.push(d.readUByte().toString(16)),3!==L&&5!==L&&7!==L&&9!==L||A.push("-");for(var k=h-16,w=new Uint8Array(k),D=0;D<k;D++)w[D]=d.readUByte();E(n._txtTrack.samples,{pts:e.pts,payloadType:f,uuid:A.join(""),userData:Object(s.utf8ArrayToStr)(w),userDataBytes:w})}}else if(h<d.bytesAvailable)for(var R=0;R<h;R++)d.readUByte()}break;case 7:if(r=!0,l=!0,!i.sps){var O=new a.default(t.data).readSPS();i.width=O.width,i.height=O.height,i.pixelRatio=O.pixelRatio,i.sps=[t.data],i.duration=n._duration;for(var C=t.data.subarray(1,4),I="avc1.",x=0;x<3;x++){var P=C[x].toString(16);P.length<2&&(P="0"+P),I+=P}i.codec=I}break;case 8:r=!0,i.pps||(i.pps=[t.data]);break;case 9:r=!1,i.audFound=!0,u&&y(u,i),u=n.avcSample=p(!1,e.pts,e.dts,"");break;case 12:r=!1;break;default:r=!1,u&&(u.debug+="unknown NAL "+t.type+" ")}u&&r&&u.units.push(t)})),t&&u&&(y(u,i),this.avcSample=null)},t.getLastNalUnit=function(){var e,t,r=this.avcSample;if(!r||0===r.units.length){var n=this._avcTrack.samples;r=n[n.length-1]}if(null!==(e=r)&&void 0!==e&&e.units){var i=r.units;t=i[i.length-1]}return t},t.parseAVCNALu=function(e){var t,r,n=e.byteLength,i=this._avcTrack,a=i.naluState||0,s=a,o=[],u=0,l=-1,c=0;for(-1===a&&(l=0,c=31&e[0],a=0,u=1);u<n;)if(t=e[u++],a)if(1!==a)if(t)if(1===t){if(l>=0){var d={data:e.subarray(l,u-a-1),type:c};o.push(d)}else{var f=this.getLastNalUnit();if(f&&(s&&u<=4-s&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-s)),(r=u-a-1)>0)){var h=new Uint8Array(f.data.byteLength+r);h.set(f.data,0),h.set(e.subarray(0,r),f.data.byteLength),f.data=h}}u<n?(l=u,c=31&e[u],a=0):a=-1}else a=0;else a=3;else a=t?0:2;else a=t?0:1;if(l>=0&&a>=0){var p={data:e.subarray(l,n),type:c,state:a};o.push(p)}if(0===o.length){var v=this.getLastNalUnit();if(v){var g=new Uint8Array(v.data.byteLength+e.byteLength);g.set(v.data,0),g.set(e,v.data.byteLength),v.data=g}}return i.naluState=a,o},t.parseAACPES=function(e){var t,r,i,a,s=this._audioTrack,o=this.aacLastPTS,l=this.aacOverFlow,f=e.data;if(l){var h=new Uint8Array(l.byteLength+f.byteLength);h.set(l,0),h.set(f,l.byteLength),f=h}for(t=0,r=f.length;t<r-1&&!n.isHeader(f,t);t++);if(!t||(t<r-1?(i="AAC PES did not start with ADTS header,offset:"+t,a=!1):(i="no ADTS header found in AAC PES",a=!0),c.logger.warn("parsing error:"+i),this.observer.emit(u.Events.ERROR,u.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:a,reason:i}),!a)){n.initTrackConfig(s,this.observer,f,t,this.audioCodec);var p,v=0,g=n.getFrameDuration(s.samplerate);if(void 0!==e.pts)p=e.pts;else{if(null===o)return void c.logger.warn("[tsdemuxer]: AAC PES unknown PTS");p=o}if(l&&null!==o){var m=o+g;Math.abs(m-p)>1&&(c.logger.log("[tsdemuxer]: AAC: align PTS for overlapping frames by "+Math.round((m-p)/90)),p=m)}for(var y=null;t<r;){if(n.isHeader(f,t)){if(t+5<r){var E=n.appendFrame(s,f,t,p,v);if(E){t+=E.length,y=E.sample.pts,v++;continue}}break}t++}this.aacOverFlow=t<r?f.subarray(t,r):null,this.aacLastPTS=y}},t.parseMPEGPES=function(e){var t=e.data,r=t.length,n=0,a=0,s=e.pts;if(void 0!==s)for(;a<r;)if(i.isHeader(t,a)){var o=i.appendFrame(this._audioTrack,t,a,s,n);if(!o)break;a+=o.length,n++}else a++;else c.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},t.parseID3PES=function(e){void 0!==e.pts?this._id3Track.samples.push(e):c.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},e}();function p(e,t,r,n){return{key:e,frame:!1,pts:t,dts:r,units:[],debug:n,length:0}}function v(e,t){return(31&e[t+10])<<8|e[t+11]}function g(e,t,r,n){var i={audio:-1,avc:-1,id3:-1,isAAC:!0},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t<a;){var s=(31&e[t+1])<<8|e[t+2];switch(e[t]){case 207:if(!n){c.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===i.audio&&(i.audio=s);break;case 21:-1===i.id3&&(i.id3=s);break;case 219:if(!n){c.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===i.avc&&(i.avc=s);break;case 3:case 4:r?-1===i.audio&&(i.audio=s,i.isAAC=!1):c.logger.log("MPEG audio found, not supported in this browser");break;case 36:c.logger.warn("Unsupported HEVC stream type found")}t+=5+((15&e[t+3])<<8|e[t+4])}return i}function m(e){var t,r,n,i,a,s=0,o=e.data;if(!e||0===e.size)return null;for(;o[0].length<19&&o.length>1;){var u=new Uint8Array(o[0].length+o[1].length);u.set(o[0]),u.set(o[1],o[0].length),o[0]=u,o.splice(1,1)}if(1===((t=o[0])[0]<<16)+(t[1]<<8)+t[2]){if((r=(t[4]<<8)+t[5])&&r>e.size-6)return null;var l=t[7];192&l&&(i=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?i-(a=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(c.logger.warn(Math.round((i-a)/9e4)+"s delta between PTS and DTS, align them"),i=a):a=i);var d=(n=t[8])+9;if(e.size<=d)return null;e.size-=d;for(var f=new Uint8Array(e.size),h=0,p=o.length;h<p;h++){var v=(t=o[h]).byteLength;if(d){if(d>v){d-=v;continue}t=t.subarray(d),v-=d,d=0}f.set(t,s),s+=v}return r&&(r-=n+3),{data:f,pts:i,dts:a,len:r}}return null}function y(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var r=t.samples,n=r.length;if(!n)return void t.dropped++;var i=r[n-1];e.pts=i.pts,e.dts=i.dts}t.samples.push(e)}e.debug.length&&c.logger.log(e.pts+"/"+e.dts+":"+e.debug)}function E(e,t){var r=e.length;if(r>0){if(t.pts>=e[r-1].pts)e.push(t);else for(var n=r-1;n>=0;n--)if(t.pts<e[n].pts){e.splice(n,0,t);break}}else e.push(t)}function _(e){for(var t=e.byteLength,r=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(r.push(n+2),n+=2):n++;if(0===r.length)return e;var i=t-r.length,a=new Uint8Array(i),s=0;for(n=0;n<i;s++,n++)s===r[0]&&(s++,r.shift()),a[n]=e[s];return a}h.minProbeByteLength=188,t.default=h},"./src/errors.ts":
192
192
  /*!***********************!*\
193
193
  !*** ./src/errors.ts ***!
194
194
  \***********************/
@@ -200,7 +200,7 @@
200
200
  /*!********************!*\
201
201
  !*** ./src/hls.ts ***!
202
202
  \********************/
203
- /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return y}));var n=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),i=r(/*! ./loader/playlist-loader */"./src/loader/playlist-loader.ts"),a=r(/*! ./loader/key-loader */"./src/loader/key-loader.ts"),s=r(/*! ./controller/id3-track-controller */"./src/controller/id3-track-controller.ts"),o=r(/*! ./controller/latency-controller */"./src/controller/latency-controller.ts"),u=r(/*! ./controller/level-controller */"./src/controller/level-controller.ts"),l=r(/*! ./controller/fragment-tracker */"./src/controller/fragment-tracker.ts"),c=r(/*! ./controller/stream-controller */"./src/controller/stream-controller.ts"),d=r(/*! ./is-supported */"./src/is-supported.ts"),f=r(/*! ./utils/logger */"./src/utils/logger.ts"),h=r(/*! ./config */"./src/config.ts"),p=r(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),v=r(/*! ./events */"./src/events.ts"),g=r(/*! ./errors */"./src/errors.ts");function m(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var y=function(){function e(t){void 0===t&&(t={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this._media=null,this.url=null;var r=this.config=Object(h.mergeConfig)(e.DefaultConfig,t);this.userConfig=t,Object(f.enableLogs)(r.debug),this._autoLevelCapping=-1,r.progressive&&Object(h.enableStreamingMode)(r);var n=r.abrController,d=r.bufferController,v=r.capLevelController,g=r.fpsController,m=this.abrController=new n(this),y=this.bufferController=new d(this),E=this.capLevelController=new v(this),_=new g(this),T=new i.default(this),b=new a.default(this),A=new s.default(this),S=this.levelController=new u.default(this),L=new l.FragmentTracker(this),k=this.streamController=new c.default(this,L);E.setStreamController(k),_.setStreamController(k);var w=[S,k];this.networkControllers=w;var D=[T,b,m,y,E,_,A,L];this.audioTrackController=this.createController(r.audioTrackController,null,w),this.createController(r.audioStreamController,L,w),this.subtitleTrackController=this.createController(r.subtitleTrackController,null,w),this.createController(r.subtitleStreamController,L,w),this.createController(r.timelineController,null,D),this.emeController=this.createController(r.emeController,null,D),this.latencyController=this.createController(o.default,null,D),this.coreComponents=D}e.isSupported=function(){return Object(d.isSupported)()};var t,r,y,E=e.prototype;return E.createController=function(e,t,r){if(e){var n=t?new e(this,t):new e(this);return r&&r.push(n),n}return null},E.on=function(e,t,r){void 0===r&&(r=this),this._emitter.on(e,t,r)},E.once=function(e,t,r){void 0===r&&(r=this),this._emitter.once(e,t,r)},E.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},E.off=function(e,t,r,n){void 0===r&&(r=this),this._emitter.off(e,t,r,n)},E.listeners=function(e){return this._emitter.listeners(e)},E.emit=function(e,t,r){return this._emitter.emit(e,t,r)},E.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){f.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.trigger(v.Events.ERROR,{type:g.ErrorTypes.OTHER_ERROR,details:g.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,error:t})}return!1},E.listenerCount=function(e){return this._emitter.listenerCount(e)},E.destroy=function(){f.logger.log("destroy"),this.trigger(v.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((function(e){return e.destroy()})),this.networkControllers.length=0,this.coreComponents.forEach((function(e){return e.destroy()})),this.coreComponents.length=0},E.attachMedia=function(e){f.logger.log("attachMedia"),this._media=e,this.trigger(v.Events.MEDIA_ATTACHING,{media:e})},E.detachMedia=function(){f.logger.log("detachMedia"),this.trigger(v.Events.MEDIA_DETACHING,void 0),this._media=null},E.loadSource=function(e){this.stopLoad();var t=this.media,r=this.url,i=this.url=n.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});f.logger.log("loadSource:"+i),t&&r&&r!==i&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(t)),this.trigger(v.Events.MANIFEST_LOADING,{url:e})},E.startLoad=function(e){void 0===e&&(e=-1),f.logger.log("startLoad("+e+")"),this.networkControllers.forEach((function(t){t.startLoad(e)}))},E.stopLoad=function(){f.logger.log("stopLoad"),this.networkControllers.forEach((function(e){e.stopLoad()}))},E.swapAudioCodec=function(){f.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},E.recoverMediaError=function(){f.logger.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},E.removeLevel=function(e,t){void 0===t&&(t=0),this.levelController.removeLevel(e,t)},t=e,y=[{key:"version",get:function(){return"1.0.2"}},{key:"Events",get:function(){return v.Events}},{key:"ErrorTypes",get:function(){return g.ErrorTypes}},{key:"ErrorDetails",get:function(){return g.ErrorDetails}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:h.hlsDefaultConfig},set:function(t){e.defaultConfig=t}}],(r=[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){f.logger.log("set currentLevel:"+e),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){f.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){f.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){f.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){f.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(f.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e)}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var r=e.length,n=0;n<r;n++)if(e[n].maxBitrate>t)return n;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}])&&m(t.prototype,r),y&&m(t,y),e}();y.defaultConfig=void 0},"./src/is-supported.ts":
203
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return y}));var n=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),i=r(/*! ./loader/playlist-loader */"./src/loader/playlist-loader.ts"),a=r(/*! ./loader/key-loader */"./src/loader/key-loader.ts"),s=r(/*! ./controller/id3-track-controller */"./src/controller/id3-track-controller.ts"),o=r(/*! ./controller/latency-controller */"./src/controller/latency-controller.ts"),u=r(/*! ./controller/level-controller */"./src/controller/level-controller.ts"),l=r(/*! ./controller/fragment-tracker */"./src/controller/fragment-tracker.ts"),c=r(/*! ./controller/stream-controller */"./src/controller/stream-controller.ts"),d=r(/*! ./is-supported */"./src/is-supported.ts"),f=r(/*! ./utils/logger */"./src/utils/logger.ts"),h=r(/*! ./config */"./src/config.ts"),p=r(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),v=r(/*! ./events */"./src/events.ts"),g=r(/*! ./errors */"./src/errors.ts");function m(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var y=function(){function e(t){void 0===t&&(t={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this._media=null,this.url=null;var r=this.config=Object(h.mergeConfig)(e.DefaultConfig,t);this.userConfig=t,Object(f.enableLogs)(r.debug),this._autoLevelCapping=-1,r.progressive&&Object(h.enableStreamingMode)(r);var n=r.abrController,d=r.bufferController,v=r.capLevelController,g=r.fpsController,m=this.abrController=new n(this),y=this.bufferController=new d(this),E=this.capLevelController=new v(this),_=new g(this),T=new i.default(this),b=new a.default(this),S=new s.default(this),A=this.levelController=new u.default(this),L=new l.FragmentTracker(this),k=this.streamController=new c.default(this,L);E.setStreamController(k),_.setStreamController(k);var w=[A,k];this.networkControllers=w;var D=[T,b,m,y,E,_,S,L];this.audioTrackController=this.createController(r.audioTrackController,null,w),this.createController(r.audioStreamController,L,w),this.subtitleTrackController=this.createController(r.subtitleTrackController,null,w),this.createController(r.subtitleStreamController,L,w),this.createController(r.timelineController,null,D),this.emeController=this.createController(r.emeController,null,D),this.latencyController=this.createController(o.default,null,D),this.coreComponents=D}e.isSupported=function(){return Object(d.isSupported)()};var t,r,y,E=e.prototype;return E.createController=function(e,t,r){if(e){var n=t?new e(this,t):new e(this);return r&&r.push(n),n}return null},E.on=function(e,t,r){void 0===r&&(r=this),this._emitter.on(e,t,r)},E.once=function(e,t,r){void 0===r&&(r=this),this._emitter.once(e,t,r)},E.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},E.off=function(e,t,r,n){void 0===r&&(r=this),this._emitter.off(e,t,r,n)},E.listeners=function(e){return this._emitter.listeners(e)},E.emit=function(e,t,r){return this._emitter.emit(e,t,r)},E.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){f.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),this.trigger(v.Events.ERROR,{type:g.ErrorTypes.OTHER_ERROR,details:g.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,error:t})}return!1},E.listenerCount=function(e){return this._emitter.listenerCount(e)},E.destroy=function(){f.logger.log("destroy"),this.trigger(v.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((function(e){return e.destroy()})),this.networkControllers.length=0,this.coreComponents.forEach((function(e){return e.destroy()})),this.coreComponents.length=0},E.attachMedia=function(e){f.logger.log("attachMedia"),this._media=e,this.trigger(v.Events.MEDIA_ATTACHING,{media:e})},E.detachMedia=function(){f.logger.log("detachMedia"),this.trigger(v.Events.MEDIA_DETACHING,void 0),this._media=null},E.loadSource=function(e){this.stopLoad();var t=this.media,r=this.url,i=this.url=n.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});f.logger.log("loadSource:"+i),t&&r&&r!==i&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(t)),this.trigger(v.Events.MANIFEST_LOADING,{url:e})},E.startLoad=function(e){void 0===e&&(e=-1),f.logger.log("startLoad("+e+")"),this.networkControllers.forEach((function(t){t.startLoad(e)}))},E.stopLoad=function(){f.logger.log("stopLoad"),this.networkControllers.forEach((function(e){e.stopLoad()}))},E.swapAudioCodec=function(){f.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},E.recoverMediaError=function(){f.logger.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},E.removeLevel=function(e,t){void 0===t&&(t=0),this.levelController.removeLevel(e,t)},t=e,y=[{key:"version",get:function(){return"1.0.2"}},{key:"Events",get:function(){return v.Events}},{key:"ErrorTypes",get:function(){return g.ErrorTypes}},{key:"ErrorDetails",get:function(){return g.ErrorDetails}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:h.hlsDefaultConfig},set:function(t){e.defaultConfig=t}}],(r=[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){f.logger.log("set currentLevel:"+e),this.loadLevel=e,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){f.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){f.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){f.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){f.logger.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(f.logger.log("set autoLevelCapping:"+e),this._autoLevelCapping=e)}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var r=e.length,n=0;n<r;n++)if(e[n].maxBitrate>t)return n;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}])&&m(t.prototype,r),y&&m(t,y),e}();y.defaultConfig=void 0},"./src/is-supported.ts":
204
204
  /*!*****************************!*\
205
205
  !*** ./src/is-supported.ts ***!
206
206
  \*****************************/
@@ -232,7 +232,7 @@
232
232
  /*!***********************************!*\
233
233
  !*** ./src/loader/m3u8-parser.ts ***!
234
234
  \***********************************/
235
- /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return g}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),a=r(/*! ./fragment */"./src/loader/fragment.ts"),s=r(/*! ./level-details */"./src/loader/level-details.ts"),o=r(/*! ./level-key */"./src/loader/level-key.ts"),u=r(/*! ../utils/attr-list */"./src/utils/attr-list.ts"),l=r(/*! ../utils/logger */"./src/utils/logger.ts"),c=r(/*! ../utils/codecs */"./src/utils/codecs.ts"),d=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,f=/#EXT-X-MEDIA:(.*)/g,h=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),v=/\.(mp4|m4s|m4v|m4a)$/i,g=function(){function e(){}return e.findGroup=function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(n.id===t)return n}},e.convertAVC1ToAVCOTI=function(e){var t=e.split(".");if(t.length>2){var r=t.shift()+".";return r+=parseInt(t.shift()).toString(16),r+=("000"+parseInt(t.shift()).toString(16)).substr(-4)}return e},e.resolve=function(e,t){return i.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.parseMasterPlaylist=function(t,r){var n,i=[],a={},s=!1;for(d.lastIndex=0;null!=(n=d.exec(t));)if(n[1]){var o=new u.AttrList(n[1]),l={attrs:o,bitrate:o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),name:o.NAME,url:e.resolve(n[2],r)},c=o.decimalResolution("RESOLUTION");c&&(l.width=c.width,l.height=c.height),m((o.CODECS||"").split(/[ ,]+/).filter((function(e){return e})),l),l.videoCodec&&-1!==l.videoCodec.indexOf("avc1")&&(l.videoCodec=e.convertAVC1ToAVCOTI(l.videoCodec)),i.push(l)}else if(n[3]){var f=new u.AttrList(n[3]);f["DATA-ID"]&&(s=!0,a[f["DATA-ID"]]=f)}return{levels:i,sessionData:s?a:null}},e.parseMasterPlaylistMedia=function(t,r,n,i){var a;void 0===i&&(i=[]);var s=[],o=0;for(f.lastIndex=0;null!==(a=f.exec(t));){var l=new u.AttrList(a[1]);if(l.TYPE===n){var c={attrs:l,bitrate:0,id:o++,groupId:l["GROUP-ID"],instreamId:l["INSTREAM-ID"],name:l.NAME||l.LANGUAGE||"",type:n,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:l.LANGUAGE,url:l.URI?e.resolve(l.URI,r):""};if(i.length){var d=e.findGroup(i,c.groupId)||i[0];y(c,d,"audioCodec"),y(c,d,"textCodec")}s.push(c)}}return s},e.parseLevelPlaylist=function(e,t,r,c,d){var f,g,m,y=new s.LevelDetails(t),_=y.fragments,T=0,b=0,A=0,S=0,L=null,k=new a.Fragment(c,t),w=-1;for(h.lastIndex=0,y.m3u8=e;null!==(f=h.exec(e));){var D=f[1];if(D){k.duration=parseFloat(D);var R=(" "+f[2]).slice(1);k.title=R||null,k.tagList.push(R?["INF",D,R]:["INF",D])}else if(f[3])Object(n.isFiniteNumber)(k.duration)&&(k.start=A,m&&(k.levelkey=m),k.sn=T,k.level=r,k.cc=S,k.urlId=d,_.push(k),k.relurl=(" "+f[3]).slice(1),E(k,L),L=k,A+=k.duration,T++,b=0,(k=new a.Fragment(c,t)).start=A,k.sn=T,k.cc=S,k.level=r);else if(f[4]){var O=(" "+f[4]).slice(1);L?k.setByteRange(O,L):k.setByteRange(O)}else if(f[5])k.rawProgramDateTime=(" "+f[5]).slice(1),k.tagList.push(["PROGRAM-DATE-TIME",k.rawProgramDateTime]),-1===w&&(w=_.length);else{if(!(f=f[0].match(p))){l.logger.warn("No matches on slow regex match for level playlist!");continue}for(g=1;g<f.length&&void 0===f[g];g++);var C=(" "+f[g]).slice(1),I=(" "+f[g+1]).slice(1),x=f[g+2]?(" "+f[g+2]).slice(1):"";switch(C){case"PLAYLIST-TYPE":y.type=I.toUpperCase();break;case"MEDIA-SEQUENCE":T=y.startSN=parseInt(I);break;case"SKIP":var P=new u.AttrList(I),M=P.decimalInteger("SKIPPED-SEGMENTS");if(Object(n.isFiniteNumber)(M)){y.skippedSegments=M;for(var N=M;N--;)_.unshift(null);T+=M}var F=P.enumeratedString("RECENTLY-REMOVED-DATERANGES");F&&(y.recentlyRemovedDateranges=F.split("\t"));break;case"TARGETDURATION":y.targetduration=parseFloat(I);break;case"VERSION":y.version=parseInt(I);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(I||x)&&k.tagList.push(x?[I,x]:[I]);break;case"DIS":S++;case"GAP":k.tagList.push([C]);break;case"BITRATE":k.tagList.push([C,I]);break;case"DISCONTINUITY-SEQ":S=parseInt(I);break;case"KEY":var U,B=new u.AttrList(I),j=B.enumeratedString("METHOD"),G=B.URI,H=B.hexadecimalInteger("IV"),K=B.enumeratedString("KEYFORMATVERSIONS"),V=B.enumeratedString("KEYID"),W=null!=(U=B.enumeratedString("KEYFORMAT"))?U:"identity";if(["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"].indexOf(W)>-1){l.logger.warn("Keyformat "+W+" is not supported from the manifest");continue}if("identity"!==W)continue;j&&(m=o.LevelKey.fromURL(t,G),G&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(j)>=0&&(m.method=j,m.keyFormat=W,V&&(m.keyID=V),K&&(m.keyFormatVersions=K),m.iv=H));break;case"START":var q=new u.AttrList(I).decimalFloatingPoint("TIME-OFFSET");Object(n.isFiniteNumber)(q)&&(y.startTimeOffset=q);break;case"MAP":var Y=new u.AttrList(I);k.relurl=Y.URI,Y.BYTERANGE&&k.setByteRange(Y.BYTERANGE),k.level=r,k.sn="initSegment",m&&(k.levelkey=m),y.initSegment=k,(k=new a.Fragment(c,t)).rawProgramDateTime=y.initSegment.rawProgramDateTime;break;case"SERVER-CONTROL":var z=new u.AttrList(I);y.canBlockReload=z.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=z.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&z.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=z.optionalFloat("PART-HOLD-BACK",0),y.holdBack=z.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var X=new u.AttrList(I);y.partTarget=X.decimalFloatingPoint("PART-TARGET");break;case"PART":var Q=y.partList;Q||(Q=y.partList=[]);var J=b>0?Q[Q.length-1]:void 0,Z=b++,$=new a.Part(new u.AttrList(I),k,t,Z,J);Q.push($),k.duration+=$.duration;break;case"PRELOAD-HINT":var ee=new u.AttrList(I);y.preloadHint=ee;break;case"RENDITION-REPORT":var te=new u.AttrList(I);y.renditionReports=y.renditionReports||[],y.renditionReports.push(te);break;default:l.logger.warn("line parsed but not handled: "+f)}}}L&&!L.relurl?(_.pop(),A-=L.duration,y.partList&&(y.fragmentHint=L)):y.partList&&(E(k,L),k.cc=S,y.fragmentHint=k);var re=_.length,ne=_[0],ie=_[re-1];if((A+=y.skippedSegments*y.targetduration)>0&&re&&ie){y.averagetargetduration=A/re;var ae=ie.sn;y.endSN="initSegment"!==ae?ae:0,ne&&(y.startCC=ne.cc,y.initSegment||y.fragments.every((function(e){return e.relurl&&function(e){var t,r;return v.test(null!=(t=null===(r=i.parseURL(e))||void 0===r?void 0:r.path)?t:"")}(e.relurl)}))&&(l.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(k=new a.Fragment(c,t)).relurl=ie.relurl,k.level=r,k.sn="initSegment",y.initSegment=k,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(A+=y.fragmentHint.duration),y.totalduration=A,y.endCC=S,w>0&&function(e,t){for(var r=e[t],n=t;n--;){var i=e[n];if(!i)return;i.programDateTime=r.programDateTime-1e3*i.duration,r=i}}(_,w),y},e}();function m(e,t){["video","audio","text"].forEach((function(r){var n=e.filter((function(e){return Object(c.isCodecType)(e,r)}));if(n.length){var i=n.filter((function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)}));t[r+"Codec"]=i.length>0?i[0]:n[0],e=e.filter((function(e){return-1===n.indexOf(e)}))}})),t.unknownCodecs=e}function y(e,t,r){var n=t[r];n&&(e[r]=n)}function E(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Object(n.isFiniteNumber)(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":
235
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return g}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),a=r(/*! ./fragment */"./src/loader/fragment.ts"),s=r(/*! ./level-details */"./src/loader/level-details.ts"),o=r(/*! ./level-key */"./src/loader/level-key.ts"),u=r(/*! ../utils/attr-list */"./src/utils/attr-list.ts"),l=r(/*! ../utils/logger */"./src/utils/logger.ts"),c=r(/*! ../utils/codecs */"./src/utils/codecs.ts"),d=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,f=/#EXT-X-MEDIA:(.*)/g,h=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),v=/\.(mp4|m4s|m4v|m4a)$/i,g=function(){function e(){}return e.findGroup=function(e,t){for(var r=0;r<e.length;r++){var n=e[r];if(n.id===t)return n}},e.convertAVC1ToAVCOTI=function(e){var t=e.split(".");if(t.length>2){var r=t.shift()+".";return r+=parseInt(t.shift()).toString(16),r+=("000"+parseInt(t.shift()).toString(16)).substr(-4)}return e},e.resolve=function(e,t){return i.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.parseMasterPlaylist=function(t,r){var n,i=[],a={},s=!1;for(d.lastIndex=0;null!=(n=d.exec(t));)if(n[1]){var o=new u.AttrList(n[1]),l={attrs:o,bitrate:o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),name:o.NAME,url:e.resolve(n[2],r)},c=o.decimalResolution("RESOLUTION");c&&(l.width=c.width,l.height=c.height),m((o.CODECS||"").split(/[ ,]+/).filter((function(e){return e})),l),l.videoCodec&&-1!==l.videoCodec.indexOf("avc1")&&(l.videoCodec=e.convertAVC1ToAVCOTI(l.videoCodec)),i.push(l)}else if(n[3]){var f=new u.AttrList(n[3]);f["DATA-ID"]&&(s=!0,a[f["DATA-ID"]]=f)}return{levels:i,sessionData:s?a:null}},e.parseMasterPlaylistMedia=function(t,r,n,i){var a;void 0===i&&(i=[]);var s=[],o=0;for(f.lastIndex=0;null!==(a=f.exec(t));){var l=new u.AttrList(a[1]);if(l.TYPE===n){var c={attrs:l,bitrate:0,id:o++,groupId:l["GROUP-ID"],instreamId:l["INSTREAM-ID"],name:l.NAME||l.LANGUAGE||"",type:n,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:l.LANGUAGE,url:l.URI?e.resolve(l.URI,r):""};if(i.length){var d=e.findGroup(i,c.groupId)||i[0];y(c,d,"audioCodec"),y(c,d,"textCodec")}s.push(c)}}return s},e.parseLevelPlaylist=function(e,t,r,c,d){var f,g,m,y=new s.LevelDetails(t),_=y.fragments,T=0,b=0,S=0,A=0,L=null,k=new a.Fragment(c,t),w=-1;for(h.lastIndex=0,y.m3u8=e;null!==(f=h.exec(e));){var D=f[1];if(D){k.duration=parseFloat(D);var R=(" "+f[2]).slice(1);k.title=R||null,k.tagList.push(R?["INF",D,R]:["INF",D])}else if(f[3])Object(n.isFiniteNumber)(k.duration)&&(k.start=S,m&&(k.levelkey=m),k.sn=T,k.level=r,k.cc=A,k.urlId=d,_.push(k),k.relurl=(" "+f[3]).slice(1),E(k,L),L=k,S+=k.duration,T++,b=0,(k=new a.Fragment(c,t)).start=S,k.sn=T,k.cc=A,k.level=r);else if(f[4]){var O=(" "+f[4]).slice(1);L?k.setByteRange(O,L):k.setByteRange(O)}else if(f[5])k.rawProgramDateTime=(" "+f[5]).slice(1),k.tagList.push(["PROGRAM-DATE-TIME",k.rawProgramDateTime]),-1===w&&(w=_.length);else{if(!(f=f[0].match(p))){l.logger.warn("No matches on slow regex match for level playlist!");continue}for(g=1;g<f.length&&void 0===f[g];g++);var C=(" "+f[g]).slice(1),I=(" "+f[g+1]).slice(1),x=f[g+2]?(" "+f[g+2]).slice(1):"";switch(C){case"PLAYLIST-TYPE":y.type=I.toUpperCase();break;case"MEDIA-SEQUENCE":T=y.startSN=parseInt(I);break;case"SKIP":var P=new u.AttrList(I),M=P.decimalInteger("SKIPPED-SEGMENTS");if(Object(n.isFiniteNumber)(M)){y.skippedSegments=M;for(var N=M;N--;)_.unshift(null);T+=M}var F=P.enumeratedString("RECENTLY-REMOVED-DATERANGES");F&&(y.recentlyRemovedDateranges=F.split("\t"));break;case"TARGETDURATION":y.targetduration=parseFloat(I);break;case"VERSION":y.version=parseInt(I);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(I||x)&&k.tagList.push(x?[I,x]:[I]);break;case"DIS":A++;case"GAP":k.tagList.push([C]);break;case"BITRATE":k.tagList.push([C,I]);break;case"DISCONTINUITY-SEQ":A=parseInt(I);break;case"KEY":var U,B=new u.AttrList(I),j=B.enumeratedString("METHOD"),G=B.URI,H=B.hexadecimalInteger("IV"),K=B.enumeratedString("KEYFORMATVERSIONS"),V=B.enumeratedString("KEYID"),W=null!=(U=B.enumeratedString("KEYFORMAT"))?U:"identity";if(["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"].indexOf(W)>-1){l.logger.warn("Keyformat "+W+" is not supported from the manifest");continue}if("identity"!==W)continue;j&&(m=o.LevelKey.fromURL(t,G),G&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(j)>=0&&(m.method=j,m.keyFormat=W,V&&(m.keyID=V),K&&(m.keyFormatVersions=K),m.iv=H));break;case"START":var q=new u.AttrList(I).decimalFloatingPoint("TIME-OFFSET");Object(n.isFiniteNumber)(q)&&(y.startTimeOffset=q);break;case"MAP":var Y=new u.AttrList(I);k.relurl=Y.URI,Y.BYTERANGE&&k.setByteRange(Y.BYTERANGE),k.level=r,k.sn="initSegment",m&&(k.levelkey=m),y.initSegment=k,(k=new a.Fragment(c,t)).rawProgramDateTime=y.initSegment.rawProgramDateTime;break;case"SERVER-CONTROL":var z=new u.AttrList(I);y.canBlockReload=z.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=z.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&z.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=z.optionalFloat("PART-HOLD-BACK",0),y.holdBack=z.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var X=new u.AttrList(I);y.partTarget=X.decimalFloatingPoint("PART-TARGET");break;case"PART":var Q=y.partList;Q||(Q=y.partList=[]);var J=b>0?Q[Q.length-1]:void 0,Z=b++,$=new a.Part(new u.AttrList(I),k,t,Z,J);Q.push($),k.duration+=$.duration;break;case"PRELOAD-HINT":var ee=new u.AttrList(I);y.preloadHint=ee;break;case"RENDITION-REPORT":var te=new u.AttrList(I);y.renditionReports=y.renditionReports||[],y.renditionReports.push(te);break;default:l.logger.warn("line parsed but not handled: "+f)}}}L&&!L.relurl?(_.pop(),S-=L.duration,y.partList&&(y.fragmentHint=L)):y.partList&&(E(k,L),k.cc=A,y.fragmentHint=k);var re=_.length,ne=_[0],ie=_[re-1];if((S+=y.skippedSegments*y.targetduration)>0&&re&&ie){y.averagetargetduration=S/re;var ae=ie.sn;y.endSN="initSegment"!==ae?ae:0,ne&&(y.startCC=ne.cc,y.initSegment||y.fragments.every((function(e){return e.relurl&&function(e){var t,r;return v.test(null!=(t=null===(r=i.parseURL(e))||void 0===r?void 0:r.path)?t:"")}(e.relurl)}))&&(l.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(k=new a.Fragment(c,t)).relurl=ie.relurl,k.level=r,k.sn="initSegment",y.initSegment=k,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(S+=y.fragmentHint.duration),y.totalduration=S,y.endCC=A,w>0&&function(e,t){for(var r=e[t],n=t;n--;){var i=e[n];if(!i)return;i.programDateTime=r.programDateTime-1e3*i.duration,r=i}}(_,w),y},e}();function m(e,t){["video","audio","text"].forEach((function(r){var n=e.filter((function(e){return Object(c.isCodecType)(e,r)}));if(n.length){var i=n.filter((function(e){return 0===e.lastIndexOf("avc1",0)||0===e.lastIndexOf("mp4a",0)}));t[r+"Codec"]=i.length>0?i[0]:n[0],e=e.filter((function(e){return-1===n.indexOf(e)}))}})),t.unknownCodecs=e}function y(e,t,r){var n=t[r];n&&(e[r]=n)}function E(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),Object(n.isFiniteNumber)(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":
236
236
  /*!***************************************!*\
237
237
  !*** ./src/loader/playlist-loader.ts ***!
238
238
  \***************************************/
@@ -252,7 +252,7 @@
252
252
  /*!**********************************!*\
253
253
  !*** ./src/remux/mp4-remuxer.ts ***!
254
254
  \**********************************/
255
- /*! exports provided: default, normalizePts */function(e,t,r){r.r(t),r.d(t,"default",(function(){return p})),r.d(t,"normalizePts",(function(){return v}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./aac-helper */"./src/remux/aac-helper.ts"),a=r(/*! ./mp4-generator */"./src/remux/mp4-generator.ts"),s=r(/*! ../events */"./src/events.ts"),o=r(/*! ../errors */"./src/errors.ts"),u=r(/*! ../utils/logger */"./src/utils/logger.ts"),l=r(/*! ../utils/timescale-conversion */"./src/utils/timescale-conversion.ts");function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var d=null,f=null,h=!1,p=function(){function e(e,t,r,n){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=r,this.ISGenerated=!1,null===d){var i=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);d=i?parseInt(i[1]):0}if(null===f){var a=navigator.userAgent.match(/Safari\/(\d+)/i);f=a?parseInt(a[1]):0}h=!!d&&d<75||!!f&&f<600}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){u.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){u.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){u.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},t.getVideoStartPts=function(e){var t=!1,r=e.reduce((function(e,r){var n=r.pts-e;return n<-4294967296?(t=!0,v(e,r.pts)):n>0?e:r.pts}),e[0].pts);return t&&u.logger.debug("PTS rollover detected"),r},t.remux=function(e,t,r,n,i,a,s){var o,l,c,d,f,h,p=i,g=i,m=e.pid>-1,y=t.pid>-1,E=e.samples.length>0,_=t.samples.length>1;if((!m||E)&&(!y||_)||this.ISGenerated||s){this.ISGenerated||(c=this.generateIS(e,t,i));var T=this.isVideoContiguous;if(_&&!T&&this.config.forceKeyFrameOnDiscontinuity){var b=t.samples.length,A=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples);if(h=!0,A>0){u.logger.warn("[mp4-remuxer]: Dropped "+A+" out of "+b+" video samples due to a missing keyframe");var S=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(A),t.dropped+=A,g+=(t.samples[0].pts-S)/(t.timescale||9e4)}else-1===A&&(u.logger.warn("[mp4-remuxer]: No keyframe found out of "+b+" video samples"),h=!1)}if(this.ISGenerated){if(E&&_){var L=this.getVideoStartPts(t.samples),k=(v(e.samples[0].pts,L)-L)/t.inputTimeScale;p+=Math.max(0,k),g+=Math.max(0,-k)}if(E){if(e.samplerate||(u.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),delete(c=this.generateIS(e,t,i)).video),l=this.remuxAudio(e,p,this.isAudioContiguous,a,_?g:void 0),_){var w=l?l.endPTS-l.startPTS:0;t.inputTimeScale||(u.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(e,t,i)),o=this.remuxVideo(t,g,T,w)}}else _&&(o=this.remuxVideo(t,g,T,0));o&&void 0!==h&&(o.independent=h)}}return this.ISGenerated&&(r.samples.length&&(f=this.remuxID3(r,i)),n.samples.length&&(d=this.remuxText(n,i))),{audio:l,video:o,initSegment:c,independent:h,text:d,id3:f}},t.generateIS=function(e,t,r){var i,s,o,u=e.samples,l=t.samples,c=this.typeSupported,d={},f=!Object(n.isFiniteNumber)(this._initPTS),h="audio/mp4";if(f&&(i=s=1/0),e.config&&u.length&&(e.timescale=e.samplerate,e.isAAC||(c.mpeg?(h="audio/mpeg",e.codec=""):c.mp3&&(e.codec="mp3")),d.audio={id:"audio",container:h,codec:e.codec,initSegment:!e.isAAC&&c.mpeg?new Uint8Array(0):a.default.initSegment([e]),metadata:{channelCount:e.channelCount}},f&&(o=e.inputTimeScale,i=s=u[0].pts-Math.round(o*r))),t.sps&&t.pps&&l.length&&(t.timescale=t.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:a.default.initSegment([t]),metadata:{width:t.width,height:t.height}},f)){o=t.inputTimeScale;var p=this.getVideoStartPts(l),g=Math.round(o*r);s=Math.min(s,v(l[0].dts,p)-g),i=Math.min(i,p-g)}if(Object.keys(d).length)return this.ISGenerated=!0,f&&(this._initPTS=i,this._initDTS=s),{tracks:d,initPTS:i,timescale:o}},t.remuxVideo=function(e,t,r,n){var i,f,p,m=e.inputTimeScale,y=e.samples,E=[],_=y.length,T=this._initPTS,b=this.nextAvcDts,A=8,S=Number.POSITIVE_INFINITY,L=Number.NEGATIVE_INFINITY,k=0,w=!1;r&&null!==b||(b=t*m-(y[0].pts-v(y[0].dts,y[0].pts)));for(var D=0;D<_;D++){var R=y[D];R.pts=v(R.pts-T,b),R.dts=v(R.dts-T,b),R.dts>R.pts&&(k=Math.max(Math.min(k,R.pts-R.dts),-18e3)),R.dts<y[D>0?D-1:D].dts&&(w=!0)}w&&y.sort((function(e,t){var r=e.dts-t.dts,n=e.pts-t.pts;return r||n})),f=y[0].dts,p=y[y.length-1].dts;var O=Math.round((p-f)/(_-1));if(k<0){if(k<-2*O){u.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(l.toMsFromMpegTsClock)(-O,!0)+" ms");for(var C=k,I=0;I<_;I++)y[I].dts=C=Math.max(C,y[I].pts-O),y[I].pts=Math.max(C,y[I].pts)}else{u.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(l.toMsFromMpegTsClock)(k,!0)+" ms to overcome this issue");for(var x=0;x<_;x++)y[x].dts=y[x].dts+k}f=y[0].dts}if(r){var P=f-b,M=P>O;if(M||P<-1){M?u.logger.warn("AVC: "+Object(l.toMsFromMpegTsClock)(P,!0)+" ms ("+P+"dts) hole between fragments detected, filling it"):u.logger.warn("AVC: "+Object(l.toMsFromMpegTsClock)(-P,!0)+" ms ("+P+"dts) overlapping between fragments detected"),f=b;var N=y[0].pts-P;y[0].dts=f,y[0].pts=N,u.logger.log("Video: First PTS/DTS adjusted: "+Object(l.toMsFromMpegTsClock)(N,!0)+"/"+Object(l.toMsFromMpegTsClock)(f,!0)+", delta: "+Object(l.toMsFromMpegTsClock)(P,!0)+" ms")}}h&&(f=Math.max(0,f));for(var F=0,U=0,B=0;B<_;B++){for(var j=y[B],G=j.units,H=G.length,K=0,V=0;V<H;V++)K+=G[V].data.length;U+=K,F+=H,j.length=K,j.dts=Math.max(j.dts,f),j.pts=Math.max(j.pts,j.dts,0),S=Math.min(j.pts,S),L=Math.max(j.pts,L)}p=y[_-1].dts;var W,q=U+4*F+8;try{W=new Uint8Array(q)}catch(e){return void this.observer.emit(s.Events.ERROR,s.Events.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:q,reason:"fail allocating video mdat "+q})}var Y=new DataView(W.buffer);Y.setUint32(0,q),W.set(a.default.types.mdat,4);for(var z=0;z<_;z++){for(var X=y[z],Q=X.units,J=0,Z=0,$=Q.length;Z<$;Z++){var ee=Q[Z],te=ee.data,re=ee.data.byteLength;Y.setUint32(A,re),A+=4,W.set(te,A),A+=re,J+=4+re}if(z<_-1)i=y[z+1].dts-X.dts;else{var ne=this.config,ie=X.dts-y[z>0?z-1:z].dts;if(ne.stretchShortVideoTrack&&null!==this.nextAudioPts){var ae=Math.floor(ne.maxBufferHole*m),se=(n?S+n*m:this.nextAudioPts)-X.pts;se>ae?((i=se-ie)<0&&(i=ie),u.logger.log("[mp4-remuxer]: It is approximately "+se/90+" ms to the next segment; using duration "+i/90+" ms for the last video frame.")):i=ie}else i=ie}var oe=Math.round(X.pts-X.dts);E.push(new g(X.key,i,J,oe))}if(E.length&&d&&d<70){var ue=E[0].flags;ue.dependsOn=2,ue.isNonSync=0}console.assert(void 0!==i,"mp4SampleDuration must be computed"),this.nextAvcDts=b=p+i,this.isVideoContiguous=!0;var le={data1:a.default.moof(e.sequenceNumber++,f,c({},e,{samples:E})),data2:W,startPTS:S/m,endPTS:(L+i)/m,startDTS:f/m,endDTS:b/m,type:"video",hasAudio:!1,hasVideo:!0,nb:E.length,dropped:e.dropped};return e.samples=[],e.dropped=0,console.assert(W.length,"MDAT length must not be zero"),le},t.remuxAudio=function(e,t,r,n,l){var d,f=e.inputTimeScale,h=f/(e.samplerate?e.samplerate:f),p=e.isAAC?1024:1152,m=p*h,y=this._initPTS,E=!e.isAAC&&this.typeSupported.mpeg,_=[],T=e.samples,b=E?0:8,A=this.nextAudioPts||-1,S=t*f;if(this.isAudioContiguous=r=r||T.length&&A>0&&(n&&Math.abs(S-A)<9e3||Math.abs(v(T[0].pts-y,S)-A)<20*m),T.forEach((function(e){e.pts=e.dts=v(e.pts-y,S)})),!r||A<0){if(!(T=T.filter((function(e){return e.pts>=0}))).length)return;A=0===l?0:n?Math.max(0,S):T[0].pts}if(e.isAAC)for(var L=this.config.maxAudioFramesDrift,k=0,w=A;k<T.length;){var D=T[k],R=D.pts,O=R-w,C=Math.abs(1e3*O/f);if(O<=-L*m&&void 0!==l)r||k>0?(u.logger.warn("[mp4-remuxer]: Dropping 1 audio frame @ "+(w/f).toFixed(3)+"s due to "+Math.round(C)+" ms overlap."),T.splice(k,1)):(u.logger.warn("Audio frame @ "+(R/f).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*O/f)+" ms."),w=R+m,k++);else if(O>=L*m&&C<1e4&&void 0!==l){var I=Math.floor(O/m);w=R-I*m,u.logger.warn("[mp4-remuxer]: Injecting "+I+" audio frame @ "+(w/f).toFixed(3)+"s due to "+Math.round(1e3*O/f)+" ms gap.");for(var x=0;x<I;x++){var P=Math.max(w,0);(d=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(u.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),d=D.unit.subarray()),T.splice(k,0,{unit:d,pts:P,dts:P}),w+=m,k++}D.pts=D.dts=w,w+=m,k++}else D.pts=D.dts=w,w+=m,k++}for(var M,N=null,F=null,U=0,B=T.length;B--;)U+=T[B].unit.byteLength;for(var j=0,G=T.length;j<G;j++){var H=T[j],K=H.unit,V=H.pts;if(null!==F)_[j-1].duration=Math.round((V-F)/h);else{var W=Math.round(1e3*(V-A)/f),q=0;if(r&&e.isAAC){if(W>0&&W<1e4)q=Math.round((V-A)/m),u.logger.log("[mp4-remuxer]: "+W+" ms hole between AAC samples detected,filling it"),q>0&&((d=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(d=K.subarray()),U+=q*d.length);else if(W<-12){u.logger.log("[mp4-remuxer]: drop overlapping AAC sample, expected/parsed/delta:"+(A/f).toFixed(3)+"s/"+(V/f).toFixed(3)+"s/"+-W+"ms"),U-=K.byteLength;continue}V=A}if(N=V,!(U>0))return;U+=b;try{M=new Uint8Array(U)}catch(e){return void this.observer.emit(s.Events.ERROR,s.Events.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:U,reason:"fail allocating audio mdat "+U})}E||(new DataView(M.buffer).setUint32(0,U),M.set(a.default.types.mdat,4));for(var Y=0;Y<q;Y++)(d=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(u.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating the current frame instead"),d=K.subarray()),M.set(d,b),b+=d.byteLength,_.push(new g(!0,1024,d.byteLength,0))}M.set(K,b);var z=K.byteLength;b+=z,_.push(new g(!0,p,z,0)),F=V}var X=_.length;if(X){var Q=_[_.length-1];this.nextAudioPts=A=F+h*Q.duration;var J=E?new Uint8Array(0):a.default.moof(e.sequenceNumber++,N/h,c({},e,{samples:_}));e.samples=[];var Z=N/f,$=A/f,ee={data1:J,data2:M,startPTS:Z,endPTS:$,startDTS:Z,endDTS:$,type:"audio",hasAudio:!0,hasVideo:!1,nb:X};return this.isAudioContiguous=!0,console.assert(M.length,"MDAT length must not be zero"),ee}},t.remuxEmptyAudio=function(e,t,r,n){var a=e.inputTimeScale,s=a/(e.samplerate?e.samplerate:a),o=this.nextAudioPts,l=(null!==o?o:n.startDTS*a)+this._initDTS,c=n.endDTS*a+this._initDTS,d=1024*s,f=Math.ceil((c-l)/d),h=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(u.logger.warn("[mp4-remuxer]: remux empty Audio"),h){for(var p=[],v=0;v<f;v++){var g=l+v*d;p.push({unit:h,pts:g,dts:g})}return e.samples=p,this.remuxAudio(e,t,r,!1)}u.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},t.remuxID3=function(e,t){var r=e.samples.length;if(r){for(var n=e.inputTimeScale,i=this._initPTS,a=this._initDTS,s=0;s<r;s++){var o=e.samples[s];o.pts=v(o.pts-i,t*n)/n,o.dts=v(o.dts-a,t*n)/n}var u=e.samples;return e.samples=[],{samples:u}}},t.remuxText=function(e,t){var r=e.samples.length;if(r){for(var n=e.inputTimeScale,i=this._initPTS,a=0;a<r;a++){var s=e.samples[a];s.pts=v(s.pts-i,t*n)/n}e.samples.sort((function(e,t){return e.pts-t.pts}));var o=e.samples;return e.samples=[],{samples:o}}},e}();function v(e,t){var r;if(null===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}var g=function(e,t,r,n){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=r,this.cts=n,this.flags=new m(e)},m=function(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=e?0:1}},"./src/remux/passthrough-remuxer.ts":
255
+ /*! exports provided: default, normalizePts */function(e,t,r){r.r(t),r.d(t,"default",(function(){return p})),r.d(t,"normalizePts",(function(){return v}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./aac-helper */"./src/remux/aac-helper.ts"),a=r(/*! ./mp4-generator */"./src/remux/mp4-generator.ts"),s=r(/*! ../events */"./src/events.ts"),o=r(/*! ../errors */"./src/errors.ts"),u=r(/*! ../utils/logger */"./src/utils/logger.ts"),l=r(/*! ../utils/timescale-conversion */"./src/utils/timescale-conversion.ts");function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var d=null,f=null,h=!1,p=function(){function e(e,t,r,n){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=e,this.config=t,this.typeSupported=r,this.ISGenerated=!1,null===d){var i=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);d=i?parseInt(i[1]):0}if(null===f){var a=navigator.userAgent.match(/Safari\/(\d+)/i);f=a?parseInt(a[1]):0}h=!!d&&d<75||!!f&&f<600}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){u.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){u.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){u.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},t.getVideoStartPts=function(e){var t=!1,r=e.reduce((function(e,r){var n=r.pts-e;return n<-4294967296?(t=!0,v(e,r.pts)):n>0?e:r.pts}),e[0].pts);return t&&u.logger.debug("PTS rollover detected"),r},t.remux=function(e,t,r,n,i,a,s){var o,l,c,d,f,h,p=i,g=i,m=e.pid>-1,y=t.pid>-1,E=e.samples.length>0,_=t.samples.length>1;if((!m||E)&&(!y||_)||this.ISGenerated||s){this.ISGenerated||(c=this.generateIS(e,t,i));var T=this.isVideoContiguous;if(_&&!T&&this.config.forceKeyFrameOnDiscontinuity){var b=t.samples.length,S=function(e){for(var t=0;t<e.length;t++)if(e[t].key)return t;return-1}(t.samples);if(h=!0,S>0){u.logger.warn("[mp4-remuxer]: Dropped "+S+" out of "+b+" video samples due to a missing keyframe");var A=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(S),t.dropped+=S,g+=(t.samples[0].pts-A)/(t.timescale||9e4)}else-1===S&&(u.logger.warn("[mp4-remuxer]: No keyframe found out of "+b+" video samples"),h=!1)}if(this.ISGenerated){if(E&&_){var L=this.getVideoStartPts(t.samples),k=(v(e.samples[0].pts,L)-L)/t.inputTimeScale;p+=Math.max(0,k),g+=Math.max(0,-k)}if(E){if(e.samplerate||(u.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),delete(c=this.generateIS(e,t,i)).video),l=this.remuxAudio(e,p,this.isAudioContiguous,a,_?g:void 0),_){var w=l?l.endPTS-l.startPTS:0;t.inputTimeScale||(u.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(e,t,i)),o=this.remuxVideo(t,g,T,w)}}else _&&(o=this.remuxVideo(t,g,T,0));o&&void 0!==h&&(o.independent=h)}}return this.ISGenerated&&(r.samples.length&&(f=this.remuxID3(r,i)),n.samples.length&&(d=this.remuxText(n,i))),{audio:l,video:o,initSegment:c,independent:h,text:d,id3:f}},t.generateIS=function(e,t,r){var i,s,o,u=e.samples,l=t.samples,c=this.typeSupported,d={},f=!Object(n.isFiniteNumber)(this._initPTS),h="audio/mp4";if(f&&(i=s=1/0),e.config&&u.length&&(e.timescale=e.samplerate,e.isAAC||(c.mpeg?(h="audio/mpeg",e.codec=""):c.mp3&&(e.codec="mp3")),d.audio={id:"audio",container:h,codec:e.codec,initSegment:!e.isAAC&&c.mpeg?new Uint8Array(0):a.default.initSegment([e]),metadata:{channelCount:e.channelCount}},f&&(o=e.inputTimeScale,i=s=u[0].pts-Math.round(o*r))),t.sps&&t.pps&&l.length&&(t.timescale=t.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:a.default.initSegment([t]),metadata:{width:t.width,height:t.height}},f)){o=t.inputTimeScale;var p=this.getVideoStartPts(l),g=Math.round(o*r);s=Math.min(s,v(l[0].dts,p)-g),i=Math.min(i,p-g)}if(Object.keys(d).length)return this.ISGenerated=!0,f&&(this._initPTS=i,this._initDTS=s),{tracks:d,initPTS:i,timescale:o}},t.remuxVideo=function(e,t,r,n){var i,f,p,m=e.inputTimeScale,y=e.samples,E=[],_=y.length,T=this._initPTS,b=this.nextAvcDts,S=8,A=Number.POSITIVE_INFINITY,L=Number.NEGATIVE_INFINITY,k=0,w=!1;r&&null!==b||(b=t*m-(y[0].pts-v(y[0].dts,y[0].pts)));for(var D=0;D<_;D++){var R=y[D];R.pts=v(R.pts-T,b),R.dts=v(R.dts-T,b),R.dts>R.pts&&(k=Math.max(Math.min(k,R.pts-R.dts),-18e3)),R.dts<y[D>0?D-1:D].dts&&(w=!0)}w&&y.sort((function(e,t){var r=e.dts-t.dts,n=e.pts-t.pts;return r||n})),f=y[0].dts,p=y[y.length-1].dts;var O=Math.round((p-f)/(_-1));if(k<0){if(k<-2*O){u.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(l.toMsFromMpegTsClock)(-O,!0)+" ms");for(var C=k,I=0;I<_;I++)y[I].dts=C=Math.max(C,y[I].pts-O),y[I].pts=Math.max(C,y[I].pts)}else{u.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(l.toMsFromMpegTsClock)(k,!0)+" ms to overcome this issue");for(var x=0;x<_;x++)y[x].dts=y[x].dts+k}f=y[0].dts}if(r){var P=f-b,M=P>O;if(M||P<-1){M?u.logger.warn("AVC: "+Object(l.toMsFromMpegTsClock)(P,!0)+" ms ("+P+"dts) hole between fragments detected, filling it"):u.logger.warn("AVC: "+Object(l.toMsFromMpegTsClock)(-P,!0)+" ms ("+P+"dts) overlapping between fragments detected"),f=b;var N=y[0].pts-P;y[0].dts=f,y[0].pts=N,u.logger.log("Video: First PTS/DTS adjusted: "+Object(l.toMsFromMpegTsClock)(N,!0)+"/"+Object(l.toMsFromMpegTsClock)(f,!0)+", delta: "+Object(l.toMsFromMpegTsClock)(P,!0)+" ms")}}h&&(f=Math.max(0,f));for(var F=0,U=0,B=0;B<_;B++){for(var j=y[B],G=j.units,H=G.length,K=0,V=0;V<H;V++)K+=G[V].data.length;U+=K,F+=H,j.length=K,j.dts=Math.max(j.dts,f),j.pts=Math.max(j.pts,j.dts,0),A=Math.min(j.pts,A),L=Math.max(j.pts,L)}p=y[_-1].dts;var W,q=U+4*F+8;try{W=new Uint8Array(q)}catch(e){return void this.observer.emit(s.Events.ERROR,s.Events.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:q,reason:"fail allocating video mdat "+q})}var Y=new DataView(W.buffer);Y.setUint32(0,q),W.set(a.default.types.mdat,4);for(var z=0;z<_;z++){for(var X=y[z],Q=X.units,J=0,Z=0,$=Q.length;Z<$;Z++){var ee=Q[Z],te=ee.data,re=ee.data.byteLength;Y.setUint32(S,re),S+=4,W.set(te,S),S+=re,J+=4+re}if(z<_-1)i=y[z+1].dts-X.dts;else{var ne=this.config,ie=X.dts-y[z>0?z-1:z].dts;if(ne.stretchShortVideoTrack&&null!==this.nextAudioPts){var ae=Math.floor(ne.maxBufferHole*m),se=(n?A+n*m:this.nextAudioPts)-X.pts;se>ae?((i=se-ie)<0&&(i=ie),u.logger.log("[mp4-remuxer]: It is approximately "+se/90+" ms to the next segment; using duration "+i/90+" ms for the last video frame.")):i=ie}else i=ie}var oe=Math.round(X.pts-X.dts);E.push(new g(X.key,i,J,oe))}if(E.length&&d&&d<70){var ue=E[0].flags;ue.dependsOn=2,ue.isNonSync=0}console.assert(void 0!==i,"mp4SampleDuration must be computed"),this.nextAvcDts=b=p+i,this.isVideoContiguous=!0;var le={data1:a.default.moof(e.sequenceNumber++,f,c({},e,{samples:E})),data2:W,startPTS:A/m,endPTS:(L+i)/m,startDTS:f/m,endDTS:b/m,type:"video",hasAudio:!1,hasVideo:!0,nb:E.length,dropped:e.dropped};return e.samples=[],e.dropped=0,console.assert(W.length,"MDAT length must not be zero"),le},t.remuxAudio=function(e,t,r,n,l){var d,f=e.inputTimeScale,h=f/(e.samplerate?e.samplerate:f),p=e.isAAC?1024:1152,m=p*h,y=this._initPTS,E=!e.isAAC&&this.typeSupported.mpeg,_=[],T=e.samples,b=E?0:8,S=this.nextAudioPts||-1,A=t*f;if(this.isAudioContiguous=r=r||T.length&&S>0&&(n&&Math.abs(A-S)<9e3||Math.abs(v(T[0].pts-y,A)-S)<20*m),T.forEach((function(e){e.pts=e.dts=v(e.pts-y,A)})),!r||S<0){if(!(T=T.filter((function(e){return e.pts>=0}))).length)return;S=0===l?0:n?Math.max(0,A):T[0].pts}if(e.isAAC)for(var L=this.config.maxAudioFramesDrift,k=0,w=S;k<T.length;){var D=T[k],R=D.pts,O=R-w,C=Math.abs(1e3*O/f);if(O<=-L*m&&void 0!==l)r||k>0?(u.logger.warn("[mp4-remuxer]: Dropping 1 audio frame @ "+(w/f).toFixed(3)+"s due to "+Math.round(C)+" ms overlap."),T.splice(k,1)):(u.logger.warn("Audio frame @ "+(R/f).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*O/f)+" ms."),w=R+m,k++);else if(O>=L*m&&C<1e4&&void 0!==l){var I=Math.floor(O/m);w=R-I*m,u.logger.warn("[mp4-remuxer]: Injecting "+I+" audio frame @ "+(w/f).toFixed(3)+"s due to "+Math.round(1e3*O/f)+" ms gap.");for(var x=0;x<I;x++){var P=Math.max(w,0);(d=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(u.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),d=D.unit.subarray()),T.splice(k,0,{unit:d,pts:P,dts:P}),w+=m,k++}D.pts=D.dts=w,w+=m,k++}else D.pts=D.dts=w,w+=m,k++}for(var M,N=null,F=null,U=0,B=T.length;B--;)U+=T[B].unit.byteLength;for(var j=0,G=T.length;j<G;j++){var H=T[j],K=H.unit,V=H.pts;if(null!==F)_[j-1].duration=Math.round((V-F)/h);else{var W=Math.round(1e3*(V-S)/f),q=0;if(r&&e.isAAC){if(W>0&&W<1e4)q=Math.round((V-S)/m),u.logger.log("[mp4-remuxer]: "+W+" ms hole between AAC samples detected,filling it"),q>0&&((d=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(d=K.subarray()),U+=q*d.length);else if(W<-12){u.logger.log("[mp4-remuxer]: drop overlapping AAC sample, expected/parsed/delta:"+(S/f).toFixed(3)+"s/"+(V/f).toFixed(3)+"s/"+-W+"ms"),U-=K.byteLength;continue}V=S}if(N=V,!(U>0))return;U+=b;try{M=new Uint8Array(U)}catch(e){return void this.observer.emit(s.Events.ERROR,s.Events.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:U,reason:"fail allocating audio mdat "+U})}E||(new DataView(M.buffer).setUint32(0,U),M.set(a.default.types.mdat,4));for(var Y=0;Y<q;Y++)(d=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(u.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating the current frame instead"),d=K.subarray()),M.set(d,b),b+=d.byteLength,_.push(new g(!0,1024,d.byteLength,0))}M.set(K,b);var z=K.byteLength;b+=z,_.push(new g(!0,p,z,0)),F=V}var X=_.length;if(X){var Q=_[_.length-1];this.nextAudioPts=S=F+h*Q.duration;var J=E?new Uint8Array(0):a.default.moof(e.sequenceNumber++,N/h,c({},e,{samples:_}));e.samples=[];var Z=N/f,$=S/f,ee={data1:J,data2:M,startPTS:Z,endPTS:$,startDTS:Z,endDTS:$,type:"audio",hasAudio:!0,hasVideo:!1,nb:X};return this.isAudioContiguous=!0,console.assert(M.length,"MDAT length must not be zero"),ee}},t.remuxEmptyAudio=function(e,t,r,n){var a=e.inputTimeScale,s=a/(e.samplerate?e.samplerate:a),o=this.nextAudioPts,l=(null!==o?o:n.startDTS*a)+this._initDTS,c=n.endDTS*a+this._initDTS,d=1024*s,f=Math.ceil((c-l)/d),h=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(u.logger.warn("[mp4-remuxer]: remux empty Audio"),h){for(var p=[],v=0;v<f;v++){var g=l+v*d;p.push({unit:h,pts:g,dts:g})}return e.samples=p,this.remuxAudio(e,t,r,!1)}u.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},t.remuxID3=function(e,t){var r=e.samples.length;if(r){for(var n=e.inputTimeScale,i=this._initPTS,a=this._initDTS,s=0;s<r;s++){var o=e.samples[s];o.pts=v(o.pts-i,t*n)/n,o.dts=v(o.dts-a,t*n)/n}var u=e.samples;return e.samples=[],{samples:u}}},t.remuxText=function(e,t){var r=e.samples.length;if(r){for(var n=e.inputTimeScale,i=this._initPTS,a=0;a<r;a++){var s=e.samples[a];s.pts=v(s.pts-i,t*n)/n}e.samples.sort((function(e,t){return e.pts-t.pts}));var o=e.samples;return e.samples=[],{samples:o}}},e}();function v(e,t){var r;if(null===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}var g=function(e,t,r,n){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=r,this.cts=n,this.flags=new m(e)},m=function(e){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=e?2:1,this.isNonSync=e?0:1}},"./src/remux/passthrough-remuxer.ts":
256
256
  /*!******************************************!*\
257
257
  !*** ./src/remux/passthrough-remuxer.ts ***!
258
258
  \******************************************/
@@ -364,10 +364,10 @@
364
364
  /*!************************************!*\
365
365
  !*** ./src/utils/webvtt-parser.ts ***!
366
366
  \************************************/
367
- /*! exports provided: generateCueId, parseWebVTT */function(e,t,r){r.r(t),r.d(t,"generateCueId",(function(){return d})),r.d(t,"parseWebVTT",(function(){return f}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./vttparser */"./src/utils/vttparser.ts"),a=r(/*! ../demux/id3 */"./src/demux/id3.ts"),s=r(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),o=r(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),u=/\r\n|\n\r|\n|\r/g,l=function(e,t,r){return void 0===r&&(r=0),e.substr(r,t.length)===t},c=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return(t>>>0).toString()};function d(e,t,r){return c(e.toString())+c(t.toString())+c(r)}function f(e,t,r,c,f,h,p,v){var g,m=new i.VTTParser,y=Object(a.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(u,"\n").split("\n"),E=[],_=Object(s.toMpegTsClockFromTimescale)(t,r),T="00:00.000",b=0,A=0,S=!0,L=!1;m.oncue=function(e){var t=c[f],r=c.ccOffset,n=(b-_)/9e4;if(null!=t&&t.new&&(void 0!==A?r=c.ccOffset=t.start:function(e,t,r){var n=e[t],i=e[n.prevCC];if(!i||!i.new&&n.new)return e.ccOffset=e.presentationOffset=n.start,void(n.new=!1);for(;null!==(a=i)&&void 0!==a&&a.new;){var a;e.ccOffset+=n.start-i.start,n.new=!1,i=e[(n=i).prevCC]}e.presentationOffset=r}(c,f,n)),n&&(r=n-c.presentationOffset),L){var i=e.endTime-e.startTime,a=Object(o.normalizePts)(9e4*(e.startTime+r-A),9e4*h)/9e4;e.startTime=a,e.endTime=a+i}var s=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(s)),e.id||(e.id=d(e.startTime,e.endTime,s)),e.endTime>0&&E.push(e)},m.onparsingerror=function(e){g=e},m.onflush=function(){g?v(g):p(E)},y.forEach((function(e){if(S){if(l(e,"X-TIMESTAMP-MAP=")){S=!1,L=!0,e.substr(16).split(",").forEach((function(e){l(e,"LOCAL:")?T=e.substr(6):l(e,"MPEGTS:")&&(b=parseInt(e.substr(7)))}));try{A=function(e){var t=parseInt(e.substr(-3)),r=parseInt(e.substr(-6,2)),i=parseInt(e.substr(-9,2)),a=e.length>9?parseInt(e.substr(0,e.indexOf(":"))):0;if(!(Object(n.isFiniteNumber)(t)&&Object(n.isFiniteNumber)(r)&&Object(n.isFiniteNumber)(i)&&Object(n.isFiniteNumber)(a)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*r,t+=6e4*i,t+=36e5*a}(T)/1e3}catch(e){L=!1,g=e}return}""===e&&(S=!1)}m.parse(e+"\n")})),m.flush()}},"./src/utils/xhr-loader.ts":
367
+ /*! exports provided: generateCueId, parseWebVTT */function(e,t,r){r.r(t),r.d(t,"generateCueId",(function(){return d})),r.d(t,"parseWebVTT",(function(){return f}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./vttparser */"./src/utils/vttparser.ts"),a=r(/*! ../demux/id3 */"./src/demux/id3.ts"),s=r(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),o=r(/*! ../remux/mp4-remuxer */"./src/remux/mp4-remuxer.ts"),u=/\r\n|\n\r|\n|\r/g,l=function(e,t,r){return void 0===r&&(r=0),e.substr(r,t.length)===t},c=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return(t>>>0).toString()};function d(e,t,r){return c(e.toString())+c(t.toString())+c(r)}function f(e,t,r,c,f,h,p,v){var g,m=new i.VTTParser,y=Object(a.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(u,"\n").split("\n"),E=[],_=Object(s.toMpegTsClockFromTimescale)(t,r),T="00:00.000",b=0,S=0,A=!0,L=!1;m.oncue=function(e){var t=c[f],r=c.ccOffset,n=(b-_)/9e4;if(null!=t&&t.new&&(void 0!==S?r=c.ccOffset=t.start:function(e,t,r){var n=e[t],i=e[n.prevCC];if(!i||!i.new&&n.new)return e.ccOffset=e.presentationOffset=n.start,void(n.new=!1);for(;null!==(a=i)&&void 0!==a&&a.new;){var a;e.ccOffset+=n.start-i.start,n.new=!1,i=e[(n=i).prevCC]}e.presentationOffset=r}(c,f,n)),n&&(r=n-c.presentationOffset),L){var i=e.endTime-e.startTime,a=Object(o.normalizePts)(9e4*(e.startTime+r-S),9e4*h)/9e4;e.startTime=a,e.endTime=a+i}var s=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(s)),e.id||(e.id=d(e.startTime,e.endTime,s)),e.endTime>0&&E.push(e)},m.onparsingerror=function(e){g=e},m.onflush=function(){g?v(g):p(E)},y.forEach((function(e){if(A){if(l(e,"X-TIMESTAMP-MAP=")){A=!1,L=!0,e.substr(16).split(",").forEach((function(e){l(e,"LOCAL:")?T=e.substr(6):l(e,"MPEGTS:")&&(b=parseInt(e.substr(7)))}));try{S=function(e){var t=parseInt(e.substr(-3)),r=parseInt(e.substr(-6,2)),i=parseInt(e.substr(-9,2)),a=e.length>9?parseInt(e.substr(0,e.indexOf(":"))):0;if(!(Object(n.isFiniteNumber)(t)&&Object(n.isFiniteNumber)(r)&&Object(n.isFiniteNumber)(i)&&Object(n.isFiniteNumber)(a)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*r,t+=6e4*i,t+=36e5*a}(T)/1e3}catch(e){L=!1,g=e}return}""===e&&(A=!1)}m.parse(e+"\n")})),m.flush()}},"./src/utils/xhr-loader.ts":
368
368
  /*!*********************************!*\
369
369
  !*** ./src/utils/xhr-loader.ts ***!
370
370
  \*********************************/
371
- /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=r(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),a=/^age:\s*[\d.]+\s*$/m,s=function(){function e(e){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=e?e.xhrSetup:null,this.stats=new i.LoadStats,this.retryDelay=0}var t=e.prototype;return t.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},t.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))},t.abort=function(){var e;this.abortInternal(),null!==(e=this.callbacks)&&void 0!==e&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},t.load=function(e,t,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=r,this.retryDelay=t.retryDelay,this.loadInternal()},t.loadInternal=function(){var e=this.config,t=this.context;if(e){var r=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0;var i=this.xhrSetup;try{if(i)try{i(r,t.url)}catch(e){r.open("GET",t.url,!0),i(r,t.url)}r.readyState||r.open("GET",t.url,!0)}catch(e){return void this.callbacks.onError({code:r.status,text:e.message},t,r)}t.rangeEnd&&r.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),r.onreadystatechange=this.readystatechange.bind(this),r.onprogress=this.loadprogress.bind(this),r.responseType=t.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),r.send()}},t.readystatechange=function(){var e=this.context,t=this.loader,r=this.stats;if(e&&t){var i=t.readyState,a=this.config;if(!r.aborted&&i>=2)if(self.clearTimeout(this.requestTimeout),0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start)),4===i){t.onreadystatechange=null,t.onprogress=null;var s=t.status;if(s>=200&&s<300){var o,u;if(r.loading.end=Math.max(self.performance.now(),r.loading.first),u="arraybuffer"===e.responseType?(o=t.response).byteLength:(o=t.responseText).length,r.loaded=r.total=u,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(r,e,o,t),!this.callbacks)return;var c={url:t.responseURL,data:o};this.callbacks.onSuccess(c,r,e,t)}else r.retry>=a.maxRetry||s>=400&&s<499?(n.logger.error(s+" while loading "+e.url),this.callbacks.onError({code:s,text:t.statusText},e,t)):(n.logger.warn(s+" while loading "+e.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,a.maxRetryDelay),r.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout)}},t.loadtimeout=function(){n.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},t.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},t.getCacheAge=function(){var e=null;if(this.loader&&a.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},e}();t.default=s}}).default},e.exports=r())})));var xr=Object.freeze({__proto__:null,ATTACHED:"hls:attached"});const Pr="com.widevine.alpha";const Mr="application/vnd.apple.mpegURL",Nr=[Mr,"application/x-mpegurl"],Fr=document.createElement("video").canPlayType(Mr);function Ur({src:e="",type:t="",drm:r},n){const i=(null==n?void 0:n.hls)||{},a="native"in i&&i.native;return(!Fr||!a)&&(!(r&&!Object.keys(r).find(e=>{return t=e,[Pr].filter((function(e){return e===t})).length;var t}))&&(!(!t||!Nr.includes(t))||function(e){const{pathname:t}=lr(e);return t.endsWith(".m3u8")}(e)))}var Br="audio:set",jr="audio:update",Gr="audio:tracks";const Hr=[Ir.Events.SUBTITLE_TRACKS_UPDATED,Ir.Events.SUBTITLE_TRACK_SWITCH,Ir.Events.LEVEL_SWITCHED];function Kr(e,t){Hr.forEach((function(r){e.on(r,(function(){!function(e,t){var r;const n=e.levels[e.currentLevel];if(!n||!e.subtitleTracks.length||n.attrs.SUB)return;const i=null===(r=null==n?void 0:n.attrs)||void 0===r?void 0:r.SUBTITLES;if(!i)return t.emit("tracks:text:all",[]);const a=e.subtitleTracks.filter((function(e){return e.groupId==i})).map((function(e){return t.textTracks[e.id]}));t.emit("tracks:text:all",a)}(e,t)}))}))}var Vr=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"});function Wr(e,t,r){if(!e.reaper||!r.src)return;e.hls&&(e.emit("recover",{type:"hls"}),e.hls.destroy());const i="live"in t==0;if(r.drm&&!ur()&&"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname)return e.emit(n,{message:"Secure page required for DRM"});const a=e.hls=new Ir(function(e){return Object.assign(Object.assign({autoStartLoad:!1},e.hls),{startPosition:e.start_time||-1})}(t));a.subtitleDisplay=!1,a.attachMedia(e),a.loadSource(r.src),e.emit("hls:attached",{hls:a}),function(e,t){e.on(Ir.Events.AUDIO_TRACKS_UPDATED,(function(e,r){t.emit(Gr,r.audioTracks)})),e.on(Ir.Events.AUDIO_TRACK_SWITCHING,(function(e,r){t.emit(jr,r)})),e.on(Ir.Events.MANIFEST_PARSED,(function(e,r){r.audioTracks&&t.emit(Gr,r.audioTracks)})),e.on(Ir.Events.LEVEL_SWITCHED,(function(r,n){const i=e.levels[n.level];i&&t.emit(Gr,e.audioTracks.filter((function(e){return e.groupId&&~(i.audioGroupIds||[]).indexOf(e.groupId)})))}))}(a,e),Kr(a,e);const s=function(e){var t;const r=null===(t=e.data)||void 0===t?void 0:t.level;"number"==typeof r&&(a.levels[r]||-1===r?a.nextLevel=r:console.error(new Error("skipping invalid quality: "+e.data)))},o=function(e){var t;const r=null===(t=e.data)||void 0===t?void 0:t.id;"number"==typeof r&&r!=a.audioTrack&&setTimeout((function(){a.audioTrack=r}),0)};e.on("quality:set",s),e.on(Br,o),e.on("src",(function(){e.hls&&e.hls.destroy(),e.off("quality:set",s),e.off(Br,o)})),e.on("audioonlysource",(function(){})),e.on(b,(function(){a&&a.destroy()})),e.on("remotesession:started",()=>{e.hls&&e.hls.stopLoad()}),e.on("remotesession:ended",()=>{e.hls&&e.hls.startLoad()}),i&&a.on(Ir.Events.LEVEL_LOADED,(function(t,r){e.setOpts({live:r.details.live})})),a.on(Ir.Events.MANIFEST_PARSED,(function(r,n){const i=n.levels.slice(0).reduce((e,t,r)=>[...e,{level:r,text:t.name||t.width+"",width:t.width,height:t.height,videoCodec:t.videoCodec||""}],[{text:"AUTO",level:-1,width:0,height:0,videoCodec:""}]).sort((e,t)=>t.width-e.width);e.emit("qualities",i),function(e,t,r){var n;if(!e.hls)return;void 0!==t.start_quality&&(V.HIGH&t.start_quality&&(e.hls.startLevel=r[0].level),V.LOW&t.start_quality&&(e.hls.startLevel=r[r.length-1].level),V.MEDIUM&t.start_quality&&(e.hls.startLevel=r[Math.ceil(r.length/2)-1].level));("none"!==t.preload||t.autoplay)&&(null===(n=e.hls)||void 0===n||n.startLoad(t.start_time||-1))}(e,t,i.slice(0,-1));const a=i.find(e=>!!e.videoCodec);a||e.emit("audioonlysource"),!e.opt("ratio")&&a&&0!=a.width&&0!=a.height&&e.setOpts({ratio:a.width+":"+a.height})})),a.on(Ir.Events.INIT_PTS_FOUND,(function(e,t){t.frag.duration})),a.on(Ir.Events.ERROR,(function(t,r){!function(e,t,r,i){if(0==e.reaper)return;if(0==t.fatal)return;switch(t.type){case Ir.ErrorTypes.MEDIA_ERROR:return function(e,t){var r;e.emit(n,{fatal:!0,message:"Unrecoverable error occurred while playing media"}),null===(r=e.hls)||void 0===r||r.destroy()}(e);case Ir.ErrorTypes.NETWORK_ERROR:return function(e,t){var r;const i=null===(r=t.networkDetails)||void 0===r?void 0:r.status;e.emit(n,{fatal:!0,code:"http:"+i.toString(),message:Vr[i]||"an error occurred while loading this video"})}(e,t);case Ir.ErrorTypes.KEY_SYSTEM_ERROR:(function(e,t){var r;e.emit(n,{fatal:!0,message:Vr[t.details]||"an error occurred while accessing this video"}),null===(r=e.hls)||void 0===r||r.destroy()})(e,t)}}(e,r,e.original_src)})),a.on(Ir.Events.LEVEL_SWITCHING,(t,r)=>{const n=a.levels[a.currentLevel],i=a.levels[r.level];e.emit("qualitychange",{before:n,after:i,kind:"hls"})});const u=e.opt("start_time");u&&e.once(d,(function(){e.currentTime=u})),"none"===t.preload&&e.once("beforeplay",()=>{a.startLoad(t.start_time||-1)})}class qr{init(){}onload(e,t,r,n){Wr(r,e,n)}wants(e,t,r){return Ir.isSupported()&&Ur(t,r)}}qr.events=xr,qr.version=Ir.version,we(window,qr);const Yr=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),zr=(...e)=>e.reduce((e,t)=>Yr(t)?(Object.keys(t).forEach(r=>{if(Yr(e[r])&&Yr(t[r]))return e[r]=zr(e[r],t[r]);e[r]=t[r]}),e):e,{});class Xr{constructor(e){this.data=e}static of(e){return new Xr(e)}static maybe(e,t,...r){return null==e?e:t.apply(e,[e,...r])}tap(e,...t){return e.apply(this,[this.data,...t]),new Xr(this.data)}fmap(e,...t){const r=e.apply(this,[this.data,...t]);return new Xr(r)}unwrap(){return this.data}}function Qr(e){return fetch(e).then(e=>e.json())}function Jr(){let e=[].join.call(arguments,"/");return"/"!==e[0]&&(e="/"+e),Zr()+"/web/public/native/config"+e}const Zr=()=>"https://ljsp.lwcdn.com";function $r(e){return~e.indexOf("/")?e:"/media/"+e}var en={404:"media not found",402:"invalid subscription",400:"bad request",415:"unsupported media type"};function tn(e){const t=e.ima,r=e.duration;if(!t||!r)return e;const n=null==t?void 0:t.ads;return Array.isArray(n)&&(t.ads=n.map((function(e){return"number"==typeof e.percentage&&(e.time=e.percentage*r),e}))),e}function rn(e,t){var r,n;t="object"==typeof t?t:{};const i={title:null===(r=null==e?void 0:e.metadata)||void 0===r?void 0:r.title,description:null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.description},a={ima:{parameters:function({media_id:e,duration:t,title:r,tags:n,category_name:i,ad_keywords:a}){return{ad_keywords:a||"",media_id:e||"",category:i||"",media_name:r||"",media_tags:n||"",media_duration:t||-1}}((null==e?void 0:e.metadata)||{})}},s=t.embed||{};return delete s.src,zr(a,i,e,(delete(o=t).src,delete o.metadata,delete o.title,delete o.description,delete o.duration,delete o.poster,o),s);var o}const nn=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;function an(e){return"object"==typeof e&&"ovp/base64"==e.type}function sn(e,t){return function(e,t){return!(~e.indexOf(".")||!nn.test(e))&&(t.type="video/ovp",!0)}(e,t)||an(t)}function on(e){try{return function(e){return null===e?{}:JSON.parse(e)}(decodeURIComponent(atob(e).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(e){return{err:e.message}}}function un(e){const t=e.split(/[^0-9]/).map(e=>parseInt(e,10));return Date.UTC(t[0],t[1]-1,t[2],t[3],t[4],t[5])}function ln(e){return e.live}var cn=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 dn(e,t){const r=null==t?void 0:t.src;if(an(t))return function(e,t){const r=on(t.src||"");if(function(e){return"string"==typeof e.err}(r))return console.error(r.err);fn(e,r)}(e,t);r&&Xr.of(r).fmap($r).fmap(Jr).fmap(e=>fetch(e)).fmap(t=>t.then(e=>Promise.all([e.status,e.json()])).then(([t,r])=>200==t?fn(e,r):hn(e,r)))}function fn(e,t){return e.emit("ovp:media:changed",t),function(e){return Array.isArray(e.playlist)}(t)?function(e,t){if("function"!=typeof window.flowplayer.playlist)return console.warn("OVP responded with Playlist media but the playlist plugin does not exist"),hn(e,{status:415});e.emit("ovp:request:playlist:complete",function(e,t){const r=Object.assign({},e),n=(null==e?void 0:e.playlist)||{},i=zr(t,n),a=((null==i?void 0:i.playlist)||[]).map(e=>rn(e,r));return Object.assign(i,{playlist:a})}(e.opts,t))}(e,t):ln(t)?function(e,t){var r,n;const i=(null===(r=null==t?void 0:t.metadata)||void 0===r?void 0:r.live_start_time)||(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.starttime);i&&(t.live_start_time=Xr.of(i).fmap(un).unwrap());e.emit("ovp:live:countdown:start",Xr.of(t).fmap(rn,e.opts).fmap(tn).unwrap())}(e,t):function(e,t){e.emit("ovp:request:media:complete",Xr.of(t).fmap(rn,e.opts).fmap(tn).unwrap())}(e,t)}function hn(e,t){return t.message?e.emit("ovp:error",t):t.status?e.emit("ovp:error",new Error(en[t.status])):e.emit("ovp:error",t)}const pn={};function vn(e,t,r){"object"!=typeof pn[t]&&(pn[t]=r);const n=e.opts,i=(null==n?void 0:n.metadata)||{};i.player_id=t,n.metadata=i,r.title&&delete r.title,r.description&&delete r.description;const a=Object.assign(n,r);e.setOpts(a),r.autoplay&&e.togglePlay(!0)}let gn=!1;function mn(e,t,r){yn()||Xr.of("recommendation").fmap(Jr,t,r).fmap(Qr).fmap(t=>t.then(t=>function(e,t){const r=t.playlist;if(e.opts.recommendations=r,!r.length)return;e.emit("recommendationsready",{playlist:r.map((function(e){var t;return{poster:e.poster,src:e.src,title:null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.title,metadata:e.metadata||{}}}))})}(e,t)).catch(En))}function yn(){return gn}function En(e){gn=!0,console.error("Failed to load recommendations: %j",e)}function _n(e,t,r){if(!bn(e))return r.emit("ovp:request:media:complete",e);oe();const n=oe("fp-livecountdown");t.append(n);const i=oe("fp-inner");n.append(i);const a=document.createElement("p");a.innerText=r.i18n("ovp.starting_in"),i.append(a);const s=document.createElement("p");function o(e){var n;const i=(null===(n=e.data)||void 0===n?void 0:n.remaining)||-1;if(i<0||isNaN(i))return r.emit("ovp:live:countdown:complete");t.classList.add("is-livecountdown"),s.innerText=function(e){const t=function(e){"number"!=typeof e&&(e=parseInt(e,10)),e=Math.round(e);const t=Math.floor(e/86400);e-=86400*t;const r=Math.floor(e/3600);e-=3600*r;const n=Math.floor(e/60);return{days:t,hours:r,minutes:n,seconds:e-=60*n}}(e);let r="";t.days&&(r+=t.days+":");return r+le(t.hours)+":"+le(t.minutes)+":"+le(t.seconds)}(i+1),r.hasState(O)||r.setState(O,!0)}s.classList.add("fp-countdown"),i.append(s),r.on("ovp:live:countdown:tick",o),r.once("ovp:live:countdown:complete",(function(){n.remove(),t.classList.remove("is-livecountdown"),r.off("ovp:live:countdown:tick",o),r.emit("ovp:request:media:complete",e)})),function(e,t){let r=0;function n(){return function(e,t){const r=Date.now()-t;return Math.floor((e-r)/1e3)}(t.live_start_time||0,t.server_time_offset||0)}function i(){const t=n();e.emit("ovp:live:countdown:tick",{remaining:t}),(t<0||0===e.reaper)&&clearInterval(r)}a=t,Qr(Zr()+"/web/public/countdown/time.json").then(e=>Object.assign(a,{server_time_offset:Date.now()-e.millisUtc})),i(),r=setInterval(i,250);var a}(r,e)}function Tn(e,t,r){}function bn(e){return e&&e.live_start_time&&e.live_start_time-Date.now()>0}class An{constructor(e){this.manualDisconnect=!1,this.video=e,this.onClose=this.onClose.bind(this),this.onMessage=this.onMessage.bind(this)}static of(e){return new An(e)}connect(e){this.client=new WebSocket("wss://player.ws.flowplayer.com?mediaId="+e),this.current_media_id=e,this.wireup()}onClose(){this.manualDisconnect?this.manualDisconnect=!1:this.current_media_id&&this.reconnect(this.current_media_id)}onMessage(e){JSON.parse(e.data).forEach(e=>{this.video.emit("ovp:message:realtime",e)})}reconnect(e){this.cleanup(),this.connect(e)}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 Sn{constructor(e){e.components.put("live/countdown",{onrender:_n,onremove:Tn})}onload(e,t,r,n){if("string"==typeof n.src)return"string"!=typeof e.player_id||0===n.src.indexOf(e.player_id)||an(n)||(n.src=[e.player_id,n.src].join("/")),dn(r,n)}wants(e,t,r){return sn(e,t)}init(e,t,r){const i=new An(r);let a=Object.assign({},e);const s=function(e){if(!a)return e;delete a.src;const t=zr(e,a);return a=!1,t};r.on("ovp:error",(function(e){r.emit(n,e.data)})),r.on("ovp:request:start",(function(){r.setState(x,!0),e.recommendations&&(e.recommendations=!1)})),r.on("ovp:media:changed",(function({data:e}){var t;const r=null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.media_id;(null==e?void 0:e.live)&&r&&(i.disconnect(),i.connect(r))})),r.on("ovp:message:realtime",(function({data:t}){var n;const i=null==t?void 0:t.event,a=null==t?void 0:t.value,s=r.opt("metadata",{live_start_time:""});switch(i){case"METADATA":{const t=Object.assign(s,a),i=Object.assign(e,{metadata:t});i.live&&(null===(n=null==i?void 0:i.metadata)||void 0===n?void 0:n.live_start_time)&&(i.live_start_time=un(i.metadata.live_start_time)),r.setOpts(i);break}}})),r.on("beforeplay",(function(t){const r=e;if(ln(r)){if(Ln(r))return;t.preventDefault()}})),r.on("ovp:request:media:complete",(function(e){const t=e.data;if(!t)return;if(0==r.reaper||"object"!=typeof e.data||bn(e.data))return;const n=s(t);r.setOpts(n),r.setAttrs(n),n.src&&r.setSrc(n.src),n.autoplay&&r.togglePlay(!0)})),r.on(A,(function({data:t}){var n;if("string"==typeof e.src&&sn(e.src,{}))return;if(e.src&&kn(e.src))return;const i=null==t?void 0:t.brand_color;return i&&r.root.style.setProperty("--fp-brand-color","#"==i[0]?i:"#"+i),"string"==typeof e.player_id&&(null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.player_id)!==e.player_id?function(e,t){if("object"==typeof pn[t])return console.debug("using Cache(%s)",t),vn(e,t,pn[t]);Xr.of(t).fmap(Jr).fmap(Qr).fmap(r=>r.then(r=>vn(e,t,r)).catch(console.error))}(r,e.player_id):void 0})),r.on("ovp:request:playlist:complete",(function(e){const t=e.data;if(!t||0==r.reaper)return;const{playlist:n}=t,i=z(t,["playlist"]),a=s({playlist:i});r.setOpts(a);const o={type:"flowplayer/playlist",items:n};r.setSrc(o)})),r.on("ovp:live:countdown:start",(function(n){const i=n.data;if(!i||0==r.reaper)return;const a=s(i);r.setOpts(a),r.setAttrs(a),r.render("live/countdown",[e,t,r])})),r.on("timeupdate",(function(){var t,n,i;const a=e;ln(a)?Ln(a)||(r.togglePlay(!1),r.emit(E)):e.recommendations&&((null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.media_id)||Array.isArray(e.recommendations)||r.currentTime/r.duration<.8||yn()||(null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.media_id)&&(null===(i=null==e?void 0:e.metadata)||void 0===i?void 0:i.player_id)&&mn(r,e.metadata.media_id,e.metadata.player_id))})),r.on(b,(function(){i.disconnect()}))}}function Ln(e){var t,r;const n=null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.live_stop_time;if(!n)return!0;return!!(null===(r=null==e?void 0:e.metadata)||void 0===r?void 0:r.allow_after_stop_time)||un(n)>Date.now()}Sn.events=cn;const kn=e=>{var t;if(e&&Array.isArray(e))return"object"==typeof e[0]&&"ovp/base64"===(null===(t=e[0])||void 0===t?void 0:t.type)};we(window,Sn);
371
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=r(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),a=/^age:\s*[\d.]+\s*$/m,s=function(){function e(e){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=e?e.xhrSetup:null,this.stats=new i.LoadStats,this.retryDelay=0}var t=e.prototype;return t.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},t.abortInternal=function(){var e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))},t.abort=function(){var e;this.abortInternal(),null!==(e=this.callbacks)&&void 0!==e&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},t.load=function(e,t,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=r,this.retryDelay=t.retryDelay,this.loadInternal()},t.loadInternal=function(){var e=this.config,t=this.context;if(e){var r=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0;var i=this.xhrSetup;try{if(i)try{i(r,t.url)}catch(e){r.open("GET",t.url,!0),i(r,t.url)}r.readyState||r.open("GET",t.url,!0)}catch(e){return void this.callbacks.onError({code:r.status,text:e.message},t,r)}t.rangeEnd&&r.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),r.onreadystatechange=this.readystatechange.bind(this),r.onprogress=this.loadprogress.bind(this),r.responseType=t.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout),r.send()}},t.readystatechange=function(){var e=this.context,t=this.loader,r=this.stats;if(e&&t){var i=t.readyState,a=this.config;if(!r.aborted&&i>=2)if(self.clearTimeout(this.requestTimeout),0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start)),4===i){t.onreadystatechange=null,t.onprogress=null;var s=t.status;if(s>=200&&s<300){var o,u;if(r.loading.end=Math.max(self.performance.now(),r.loading.first),u="arraybuffer"===e.responseType?(o=t.response).byteLength:(o=t.responseText).length,r.loaded=r.total=u,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(r,e,o,t),!this.callbacks)return;var c={url:t.responseURL,data:o};this.callbacks.onSuccess(c,r,e,t)}else r.retry>=a.maxRetry||s>=400&&s<499?(n.logger.error(s+" while loading "+e.url),this.callbacks.onError({code:s,text:t.statusText},e,t)):(n.logger.warn(s+" while loading "+e.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,a.maxRetryDelay),r.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout)}},t.loadtimeout=function(){n.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},t.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},t.getCacheAge=function(){var e=null;if(this.loader&&a.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},e}();t.default=s}}).default},e.exports=r())})));var Fr=Object.freeze({__proto__:null,ATTACHED:"hls:attached"});const Ur="com.widevine.alpha";const Br="application/vnd.apple.mpegURL",jr=[Br,"application/x-mpegurl"],Gr=document.createElement("video").canPlayType(Br);function Hr({src:e="",type:t="",drm:r},n){const i=(null==n?void 0:n.hls)||{},a="native"in i&&i.native;return(!Gr||!a)&&(!(r&&!Object.keys(r).find(e=>{return t=e,[Ur].filter((function(e){return e===t})).length;var t}))&&(!(!t||!jr.includes(t))||function(e){const{pathname:t}=dr(e);return t.endsWith(".m3u8")}(e)))}var Kr="audio:set",Vr="audio:update",Wr="audio:tracks";const qr=[Nr.Events.SUBTITLE_TRACKS_UPDATED,Nr.Events.SUBTITLE_TRACK_SWITCH,Nr.Events.LEVEL_SWITCHED];function Yr(e,t){qr.forEach((function(r){e.on(r,(function(){!function(e,t){var r;const n=e.levels[e.currentLevel];if(!n||!e.subtitleTracks.length||n.attrs.SUB)return;const i=null===(r=null==n?void 0:n.attrs)||void 0===r?void 0:r.SUBTITLES;if(!i)return t.emit("tracks:text:all",[]);const a=e.subtitleTracks.filter((function(e){return e.groupId==i})).map((function(e){return t.textTracks[e.id]}));t.emit("tracks:text:all",a)}(e,t)}))}))}var zr=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"});function Xr(e,t,r){if(!e.reaper||!r.src)return;e.hls&&(e.emit("recover",{type:"hls"}),e.hls.destroy());const i="live"in t==0;if(r.drm&&!cr()&&"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname)return e.emit(n,{message:"Secure page required for DRM"});const a=e.hls=new Nr(function(e){return Object.assign(Object.assign({autoStartLoad:!1},e.hls),{startPosition:e.start_time||-1})}(t));a.subtitleDisplay=!1,a.attachMedia(e),a.loadSource(r.src),e.emit("hls:attached",{hls:a}),function(e,t){e.on(Nr.Events.AUDIO_TRACKS_UPDATED,(function(e,r){t.emit(Wr,r.audioTracks)})),e.on(Nr.Events.AUDIO_TRACK_SWITCHING,(function(e,r){t.emit(Vr,r)})),e.on(Nr.Events.MANIFEST_PARSED,(function(e,r){r.audioTracks&&t.emit(Wr,r.audioTracks)})),e.on(Nr.Events.LEVEL_SWITCHED,(function(r,n){const i=e.levels[n.level];i&&t.emit(Wr,e.audioTracks.filter((function(e){return e.groupId&&~(i.audioGroupIds||[]).indexOf(e.groupId)})))}))}(a,e),Yr(a,e);const s=function(e){var t;const r=null===(t=e.data)||void 0===t?void 0:t.level;"number"==typeof r&&(a.levels[r]||-1===r?a.nextLevel=r:console.error(new Error("skipping invalid quality: "+e.data)))},o=function(e){var t;const r=null===(t=e.data)||void 0===t?void 0:t.id;"number"==typeof r&&r!=a.audioTrack&&setTimeout((function(){a.audioTrack=r}),0)};e.on("quality:set",s),e.on(Kr,o),e.on("src",(function(){e.hls&&e.hls.destroy(),e.off("quality:set",s),e.off(Kr,o)})),e.on("audioonlysource",(function(){})),e.on(A,(function(){a&&a.destroy()})),e.on("remotesession:started",()=>{e.hls&&e.hls.stopLoad()}),e.on("remotesession:ended",()=>{e.hls&&e.hls.startLoad()}),i&&a.on(Nr.Events.LEVEL_LOADED,(function(t,r){e.setOpts({live:r.details.live})})),a.on(Nr.Events.MANIFEST_PARSED,(function(r,n){const i=n.levels.slice(0).reduce((e,t,r)=>[...e,{level:r,text:t.name||t.width+"",width:t.width,height:t.height,videoCodec:t.videoCodec||""}],[{text:"AUTO",level:-1,width:0,height:0,videoCodec:""}]).sort((e,t)=>t.width-e.width);e.emit("qualities",i),function(e,t,r){var n;if(!e.hls)return;void 0!==t.start_quality&&(q.HIGH&t.start_quality&&(e.hls.startLevel=r[0].level),q.LOW&t.start_quality&&(e.hls.startLevel=r[r.length-1].level),q.MEDIUM&t.start_quality&&(e.hls.startLevel=r[Math.ceil(r.length/2)-1].level));("none"!==t.preload||t.autoplay)&&(null===(n=e.hls)||void 0===n||n.startLoad(t.start_time||-1))}(e,t,i.slice(0,-1));const a=i.find(e=>!!e.videoCodec);a||e.emit("audioonlysource"),!e.opt("ratio")&&a&&0!=a.width&&0!=a.height&&e.setOpts({ratio:a.width+":"+a.height})})),a.on(Nr.Events.INIT_PTS_FOUND,(function(e,t){t.frag.duration})),a.on(Nr.Events.ERROR,(function(t,r){!function(e,t,r,i){if(0==e.reaper)return;if(0==t.fatal)return;switch(t.type){case Nr.ErrorTypes.MEDIA_ERROR:return function(e,t){var r;e.emit(n,{fatal:!0,message:"Unrecoverable error occurred while playing media"}),null===(r=e.hls)||void 0===r||r.destroy()}(e);case Nr.ErrorTypes.NETWORK_ERROR:return function(e,t){var r;const i=null===(r=t.networkDetails)||void 0===r?void 0:r.status;e.emit(n,{fatal:!0,code:"http:"+i.toString(),message:zr[i]||"an error occurred while loading this video"})}(e,t);case Nr.ErrorTypes.KEY_SYSTEM_ERROR:(function(e,t){var r;e.emit(n,{fatal:!0,message:zr[t.details]||"an error occurred while accessing this video"}),null===(r=e.hls)||void 0===r||r.destroy()})(e,t)}}(e,r,e.original_src)})),a.on(Nr.Events.LEVEL_SWITCHING,(t,r)=>{const n=a.levels[a.currentLevel],i=a.levels[r.level];e.emit("qualitychange",{before:n,after:i,kind:"hls"})});const u=e.opt("start_time");u&&e.once(h,(function(){e.currentTime=u})),"none"===t.preload&&e.once("beforeplay",()=>{a.startLoad(t.start_time||-1)})}class Qr{init(){}onload(e,t,r,n){Xr(r,e,n)}wants(e,t,r){return Nr.isSupported()&&Hr(t,r)}}Qr.events=Fr,Qr.version=Nr.version,Re(window,Qr);const Jr=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Zr=(...e)=>e.reduce((e,t)=>Jr(t)?(Object.keys(t).forEach(r=>{if(Jr(e[r])&&Jr(t[r]))return e[r]=Zr(e[r],t[r]);e[r]=t[r]}),e):e,{});class $r{constructor(e){this.data=e}static of(e){return new $r(e)}static maybe(e,t,...r){return null==e?e:t.apply(e,[e,...r])}tap(e,...t){return e.apply(this,[this.data,...t]),new $r(this.data)}fmap(e,...t){const r=e.apply(this,[this.data,...t]);return new $r(r)}unwrap(){return this.data}}function en(e){return fetch(e).then(e=>e.json())}function tn(){let e=[].join.call(arguments,"/");return"/"!==e[0]&&(e="/"+e),rn()+"/web/public/native/config"+e}const rn=()=>"https://ljsp.lwcdn.com";function nn(e){return~e.indexOf("/")?e:"/media/"+e}var an={404:"media not found",402:"invalid subscription",400:"bad request",415:"unsupported media type"};function sn(e){const t=e.ima,r=e.duration;if(!t||!r)return e;const n=null==t?void 0:t.ads;return Array.isArray(n)&&(t.ads=n.map((function(e){return"number"==typeof e.percentage&&(e.time=e.percentage*r),e}))),e}function on(e,t){var r,n;t="object"==typeof t?t:{};const i={title:null===(r=null==e?void 0:e.metadata)||void 0===r?void 0:r.title,description:null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.description},a={ima:{parameters:function({media_id:e,duration:t,title:r,tags:n,category_name:i,ad_keywords:a}){return{ad_keywords:a||"",media_id:e||"",category:i||"",media_name:r||"",media_tags:n||"",media_duration:t||-1}}((null==e?void 0:e.metadata)||{})}},s=t.embed||{};return delete s.src,Zr(a,i,e,(delete(o=t).src,delete o.metadata,delete o.title,delete o.description,delete o.duration,delete o.poster,o),s);var o}const un=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;function ln(e){return"object"==typeof e&&"ovp/base64"==e.type}function cn(e,t){return function(e,t){return!(~e.indexOf(".")||!un.test(e))&&(t.type="video/ovp",!0)}(e,t)||ln(t)}function dn(e){try{return function(e){return null===e?{}:JSON.parse(e)}(decodeURIComponent(atob(e).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(e){return{err:e.message}}}function fn(e){const t=e.split(/[^0-9]/).map(e=>parseInt(e,10));return Date.UTC(t[0],t[1]-1,t[2],t[3],t[4],t[5])}function hn(e){return e.live}var pn=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 vn(e,t){const r=null==t?void 0:t.src;if(ln(t))return function(e,t){const r=dn(t.src||"");if(function(e){return"string"==typeof e.err}(r))return console.error(r.err);gn(e,r)}(e,t);r&&$r.of(r).fmap(nn).fmap(tn).fmap(e=>fetch(e)).fmap(t=>t.then(e=>Promise.all([e.status,e.json()])).then(([t,r])=>200==t?gn(e,r):mn(e,r)))}function gn(e,t){return e.emit("ovp:media:changed",t),function(e){return Array.isArray(e.playlist)}(t)?function(e,t){if("function"!=typeof window.flowplayer.playlist)return console.warn("OVP responded with Playlist media but the playlist plugin does not exist"),mn(e,{status:415});e.emit("ovp:request:playlist:complete",function(e,t){const r=Object.assign({},e),n=(null==e?void 0:e.playlist)||{},i=Zr(t,n),a=((null==i?void 0:i.playlist)||[]).map(e=>on(e,r));return Object.assign(i,{playlist:a})}(e.opts,t))}(e,t):hn(t)?function(e,t){var r,n;const i=(null===(r=null==t?void 0:t.metadata)||void 0===r?void 0:r.live_start_time)||(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.starttime);i&&(t.live_start_time=$r.of(i).fmap(fn).unwrap());e.emit("ovp:live:countdown:start",$r.of(t).fmap(on,e.opts).fmap(sn).unwrap())}(e,t):function(e,t){e.emit("ovp:request:media:complete",$r.of(t).fmap(on,e.opts).fmap(sn).unwrap())}(e,t)}function mn(e,t){return t.message?e.emit("ovp:error",t):t.status?e.emit("ovp:error",new Error(an[t.status])):e.emit("ovp:error",t)}const yn={};function En(e,t,r){"object"!=typeof yn[t]&&(yn[t]=r);const n=e.opts,i=(null==n?void 0:n.metadata)||{};i.player_id=t,n.metadata=i,r.title&&delete r.title,r.description&&delete r.description;const a=Object.assign(n,r);e.setOpts(a),r.autoplay&&e.togglePlay(!0)}let _n=!1;function Tn(e,t,r){bn()||$r.of("recommendation").fmap(tn,t,r).fmap(en).fmap(t=>t.then(t=>function(e,t){const r=t.playlist;if(e.opts.recommendations=r,!r.length)return;e.emit("recommendationsready",{playlist:r.map((function(e){var t;return{poster:e.poster,src:e.src,title:null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.title,metadata:e.metadata||{}}}))})}(e,t)).catch(Sn))}function bn(){return _n}function Sn(e){_n=!0,console.error("Failed to load recommendations: %j",e)}function An(e,t,r){if(!kn(e))return r.emit("ovp:request:media:complete",e);le();const n=le("fp-livecountdown");t.append(n);const i=le("fp-inner");n.append(i);const a=document.createElement("p");a.innerText=r.i18n("ovp.starting_in"),i.append(a);const s=document.createElement("p");function o(e){var n;const i=(null===(n=e.data)||void 0===n?void 0:n.remaining)||-1;if(i<0||isNaN(i))return r.emit("ovp:live:countdown:complete");t.classList.add("is-livecountdown"),s.innerText=function(e){const t=function(e){"number"!=typeof e&&(e=parseInt(e,10)),e=Math.round(e);const t=Math.floor(e/86400);e-=86400*t;const r=Math.floor(e/3600);e-=3600*r;const n=Math.floor(e/60);return{days:t,hours:r,minutes:n,seconds:e-=60*n}}(e);let r="";t.days&&(r+=t.days+":");return r+de(t.hours)+":"+de(t.minutes)+":"+de(t.seconds)}(i+1),r.hasState(I)||r.setState(I,!0)}s.classList.add("fp-countdown"),i.append(s),r.on("ovp:live:countdown:tick",o),r.once("ovp:live:countdown:complete",(function(){n.remove(),t.classList.remove("is-livecountdown"),r.off("ovp:live:countdown:tick",o),r.emit("ovp:request:media:complete",e)})),function(e,t){let r=0;function n(){return function(e,t){const r=Date.now()-t;return Math.floor((e-r)/1e3)}(t.live_start_time||0,t.server_time_offset||0)}function i(){const t=n();e.emit("ovp:live:countdown:tick",{remaining:t}),(t<0||0===e.reaper)&&clearInterval(r)}a=t,en(rn()+"/web/public/countdown/time.json").then(e=>Object.assign(a,{server_time_offset:Date.now()-e.millisUtc})),i(),r=setInterval(i,250);var a}(r,e)}function Ln(e,t,r){}function kn(e){return e&&e.live_start_time&&e.live_start_time-Date.now()>0}class wn{constructor(e){this.manualDisconnect=!1,this.video=e,this.onClose=this.onClose.bind(this),this.onMessage=this.onMessage.bind(this)}static of(e){return new wn(e)}connect(e){this.client=new WebSocket("wss://player.ws.flowplayer.com?mediaId="+e),this.current_media_id=e,this.wireup()}onClose(){this.manualDisconnect?this.manualDisconnect=!1:this.current_media_id&&this.reconnect(this.current_media_id)}onMessage(e){JSON.parse(e.data).forEach(e=>{this.video.emit("ovp:message:realtime",e)})}reconnect(e){this.cleanup(),this.connect(e)}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 Dn{constructor(e){e.components.put("live/countdown",{onrender:An,onremove:Ln})}onload(e,t,r,n){if("string"==typeof n.src)return"string"!=typeof e.player_id||0===n.src.indexOf(e.player_id)||ln(n)||(n.src=[e.player_id,n.src].join("/")),vn(r,n)}wants(e,t,r){return cn(e,t)}init(e,t,r){const i=new wn(r);let a=Object.assign({},e);const s=function(e){if(!a)return e;delete a.src;const t=Zr(e,a);return a=!1,t};r.on("ovp:error",(function(e){r.emit(n,e.data)})),r.on("ovp:request:start",(function(){r.setState(M,!0),e.recommendations&&(e.recommendations=!1)})),r.on("ovp:media:changed",(function({data:e}){var t;const r=null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.media_id;(null==e?void 0:e.live)&&r&&(i.disconnect(),i.connect(r))})),r.on("ovp:message:realtime",(function({data:t}){var n;const i=null==t?void 0:t.event,a=null==t?void 0:t.value,s=r.opt("metadata",{live_start_time:""});switch(i){case"METADATA":{const t=Object.assign(s,a),i=Object.assign(e,{metadata:t});i.live&&(null===(n=null==i?void 0:i.metadata)||void 0===n?void 0:n.live_start_time)&&(i.live_start_time=fn(i.metadata.live_start_time)),r.setOpts(i);break}}})),r.on("beforeplay",(function(t){const r=e;if(hn(r)){if(Rn(r))return;t.preventDefault()}})),r.on("ovp:request:media:complete",(function(e){const t=e.data;if(!t)return;if(0==r.reaper||"object"!=typeof e.data||kn(e.data))return;const n=s(t);r.setOpts(n),r.setAttrs(n),n.src&&r.setSrc(n.src),n.autoplay&&r.togglePlay(!0)})),r.on(L,(function({data:t}){var n;if("string"==typeof e.src&&cn(e.src,{}))return;if(e.src&&On(e.src))return;const i=null==t?void 0:t.brand_color;return i&&r.root.style.setProperty("--fp-brand-color","#"==i[0]?i:"#"+i),"string"==typeof e.player_id&&(null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.player_id)!==e.player_id?function(e,t){if("object"==typeof yn[t])return console.debug("using Cache(%s)",t),En(e,t,yn[t]);$r.of(t).fmap(tn).fmap(en).fmap(r=>r.then(r=>En(e,t,r)).catch(console.error))}(r,e.player_id):void 0})),r.on("ovp:request:playlist:complete",(function(e){const t=e.data;if(!t||0==r.reaper)return;const{playlist:n}=t,i=Q(t,["playlist"]),a=s({playlist:i});r.setOpts(a);const o={type:"flowplayer/playlist",items:n};r.setSrc(o)})),r.on("ovp:live:countdown:start",(function(n){const i=n.data;if(!i||0==r.reaper)return;const a=s(i);r.setOpts(a),r.setAttrs(a),r.render("live/countdown",[e,t,r])})),r.on("timeupdate",(function(){var t,n,i;const a=e;hn(a)?Rn(a)||(r.togglePlay(!1),r.emit(T)):e.recommendations&&((null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.media_id)||Array.isArray(e.recommendations)||r.currentTime/r.duration<.8||bn()||(null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.media_id)&&(null===(i=null==e?void 0:e.metadata)||void 0===i?void 0:i.player_id)&&Tn(r,e.metadata.media_id,e.metadata.player_id))})),r.on(A,(function(){i.disconnect()}))}}function Rn(e){var t,r;const n=null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.live_stop_time;if(!n)return!0;return!!(null===(r=null==e?void 0:e.metadata)||void 0===r?void 0:r.allow_after_stop_time)||fn(n)>Date.now()}Dn.events=pn;const On=e=>{var t;if(e&&Array.isArray(e))return"object"==typeof e[0]&&"ovp/base64"===(null===(t=e[0])||void 0===t?void 0:t.type)};Re(window,Dn);
372
372
  /*! native-plugin.js / 1.16.5 / 97d8e0feaab02bf3b718cc47ac2992e46fe9b188 / 2021-11-29T13:08:19+02:00 / (c) Flowplayer AB */
373
- var wn=ze(Xe((function(e,t){window,e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=111)}([function(e,t,r){t.a={AD_INIT:"ad-initialized",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-rendeding-settings",ADAPTER_INIT_FAILED:"ad-adapter-init-failed",AD_PLAY_REQUESTED:"ad-play-requested",RELOAD_AD_REQUESTED:"reload-ad-requested"}},function(e,t,r){e.exports=r(82)},function(e,t){function r(e,t,r,n,i,a,s){try{var o=e[a](s),u=o.value}catch(e){return void r(e)}o.done?t(u):Promise.resolve(u).then(n,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var s=e.apply(t,n);function o(e){r(s,i,a,o,u,"next",e)}function u(e){r(s,i,a,o,u,"throw",e)}o(void 0)}))}}},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,r){var n=r(27);e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},i=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),i.forEach((function(t){n(e,t,r[t])}))}return e}},function(e,t){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(t){return"function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?e.exports=n=function(e){return r(e)}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},n(t)}e.exports=n},function(e,t,r){var n,i,a,s;function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}s=function(){return function e(t,r,n){function i(s,o){if(!r[s]){if(!t[s]){if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[s]={exports:{}};t[s][0].call(l.exports,(function(e){return i(t[s][1][e]||e)}),l,l.exports,e,t,r,n)}return r[s].exports}for(var a=!1,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,r){var n=1e3,i=6e4,a=60*i,s=24*a;function o(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}t.exports=function(e,t){t=t||{};var r,l,c=u(e);if("string"===c&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*a;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===c&&!1===isNaN(e))return t.long?(r=e,(l=Math.abs(r))>=s?o(r,l,s,"day"):l>=a?o(r,l,a,"hour"):l>=i?o(r,l,i,"minute"):l>=n?o(r,l,n,"second"):r+" ms"):function(e){var t=Math.abs(e);return t>=s?Math.round(e/s)+"d":t>=a?Math.round(e/a)+"h":t>=i?Math.round(e/i)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],2:[function(e,t,r){var n,i,a=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var l,c=[],d=!1,f=-1;function h(){d&&l&&(d=!1,l.length?c=l.concat(c):f=-1,c.length&&p())}function p(){if(!d){var e=u(h);d=!0;for(var t=c.length;t;){for(l=c,c=[];++f<t;)l&&l[f].run();f=-1,t=c.length}l=null,d=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function v(e,t){this.fun=e,this.array=t}function g(){}a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new v(e,t)),1!==c.length||d||u(p)},v.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=g,a.addListener=g,a.once=g,a.off=g,a.removeListener=g,a.removeAllListeners=g,a.emit=g,a.prependListener=g,a.prependOnceListener=g,a.listeners=function(e){return[]},a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],3:[function(e,t,r){t.exports=function(t){function r(e){for(var t=0,r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return n.colors[Math.abs(t)%n.colors.length]}function n(e){var t;function s(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];if(s.enabled){var a=s,o=Number(new Date),u=o-(t||o);a.diff=u,a.prev=t,a.curr=o,t=o,r[0]=n.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var l=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(function(e,t){if("%%"===e)return e;l++;var i=n.formatters[t];if("function"==typeof i){var s=r[l];e=i.call(a,s),r.splice(l,1),l--}return e})),n.formatArgs.call(a,r);var c=a.log||n.log;c.apply(a,r)}}return s.namespace=e,s.enabled=n.enabled(e),s.useColors=n.useColors(),s.color=r(e),s.destroy=i,s.extend=a,"function"==typeof n.init&&n.init(s),n.instances.push(s),s}function i(){var e=n.instances.indexOf(this);return-1!==e&&(n.instances.splice(e,1),!0)}function a(e,t){var r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){return e instanceof Error?e.stack||e.message:e},n.disable=function(){var e=[].concat(o(n.names.map(s)),o(n.skips.map(s).map((function(e){return"-"+e})))).join(",");return n.enable(""),e},n.enable=function(e){var t;n.save(e),n.names=[],n.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(t=0;t<i;t++)r[t]&&("-"===(e=r[t].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")));for(t=0;t<n.instances.length;t++){var a=n.instances[t];a.enabled=n.enabled(a.namespace)}},n.enabled=function(e){if("*"===e[e.length-1])return!0;var t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1},n.humanize=e("ms"),Object.keys(t).forEach((function(e){n[e]=t[e]})),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=r,n.enable(n.load()),n}},{ms:1}],4:[function(e,t,r){(function(n){r.log=function(){var e;return"object"===("undefined"==typeof console?"undefined":u(console))&&console.log&&(e=console).log.apply(e,arguments)},r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),this.useColors){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(n++,"%c"===e&&(i=n))})),e.splice(i,0,r)}},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){var e;try{e=r.storage.getItem("debug")}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e},r.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},r.storage=function(){try{return localStorage}catch(e){}}(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=e("./common")(r),t.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,e("_process"))},{"./common":3,_process:2}]},{},[4])(4)},"object"===u(t)&&void 0!==e?e.exports=s():(i=[],void 0===(a="function"==typeof(n=s)?n.apply(t,i):n)||(e.exports=a))},function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},function(e,t,r){r.d(t,"a",(function(){return o}));var n=r(4),i=r.n(n),a=r(3),s=r.n(a),o=function(){function e(t,r){i()(this,e),this._nextIndex=0,this._postroll=0,this._loadPending=!1,this._opts=r||{},this.reset(t)}return s()(e,null,[{key:"of",value:function(t,r){return new e(t,r)}}]),s()(e,[{key:"toJSON",value:function(){var e=(this._ads||[]).slice(this._nextIndex);return this._postroll&&e.push(this._postroll),e}},{key:"reset",value:function(e){this.setAds(e),this._nextIndex=0,this._postrollActive=!1}},{key:"resetCounter",value:function(){this._nextIndex=0,this._postrollActive=!1}},{key:"setAds",value:function(e){this._ads=e||[],this.sort()}},{key:"getAds",value:function(){return this._ads}},{key:"getNextAd",value:function(e){return this._ads[this._nextIndex]||e}},{key:"getCurrentAd",value:function(){return this._postrollActive?this._postroll:this._loadPending?0:this._ads[this._nextIndex-1]}},{key:"getPostroll",value:function(){return this._postroll}},{key:"isDrained",value:function(){return this._nextIndex+1>this._ads.length}},{key:"setPostrollActive",value:function(){this._postrollActive=!0}},{key:"updateContentDuration",value:function(e){this._opts.content_duration=e}},{key:"increment",value:function(){++this._nextIndex}},{key:"decrement",value:function(){this._nextIndex>0&&--this._nextIndex}},{key:"getNextIndex",value:function(){return this._nextIndex}},{key:"getCurrentType",value:function(){return this.getCurrentAd()&&e.kindOf(this.getCurrentAd().time)}},{key:"sort",value:function(){var e=this;this._postroll=this._ads.filter((function(e){return-1===e.time}))[0],this._ads=this._ads.filter((function(t){return t!==e._postroll})).sort((function(t,r){return t.time===r.time?e._ads.indexOf(t)-e._ads.indexOf(r):t.time-r.time}))}},{key:"shallPlayAd",value:function(e){if(this._loadPending)return!1;var t=this.getCurrentAd()||this.getNextAd();return!!(t&&t.time<=e&&-1!==t.time)}},{key:"shallPlayNext",value:function(){var e=this.getNextAd(),t=this.getCurrentAd();return!(!e||!t||e.time!==t.time)}},{key:"waitForLoad",value:function(e,t,r){if(this._loadPending=!1,!t)return!1;var n=r?this._opts.preload_advance:0;return t.time>=0?this._loadPending=e<t.time-n:-1===t.time&&(this._loadPending=this._opts.content_duration>0&&-1!==e?e<this._opts.content_duration-n:-1!==e),this._loadPending}}],[{key:"hasPreroll",value:function(e){return!!e.find((function(e){return 0===e.time}))}},{key:"isOutstream",value:function(t){return e.hasPreroll(t)&&!!t[0].outstream}},{key:"kindOf",value:function(e){switch(e){case 0:return"preroll";case-1:return"postroll";default:return"midroll"}}}]),e}()},function(e,t){var r=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=r)},function(e,t,r){var n=r(6),i=r(16);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?i(e):t}},function(e,t,r){var n=r(52);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},function(e,t){var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(e,t,r){var n=r(13),i=r(10),a=r(21),s=r(61),o=r(33),u=function(e,t,r){var l,c,d,f,h=e&u.F,p=e&u.G,v=e&u.S,g=e&u.P,m=e&u.B,y=p?n:v?n[t]||(n[t]={}):(n[t]||{}).prototype,E=p?i:i[t]||(i[t]={}),_=E.prototype||(E.prototype={});for(l in p&&(r=t),r)d=((c=!h&&y&&void 0!==y[l])?y:r)[l],f=m&&c?o(d,n):g&&"function"==typeof d?o(Function.call,d):d,y&&s(y,l,d,e&u.U),E[l]!=d&&a(E,l,f),g&&_[l]!=d&&(_[l]=d)};n.core=i,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,r){var n=r(85),i=r(86),a=r(87);e.exports=function(e,t){return n(e)||i(e,t)||a()}},function(e,t,r){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=function(e,t){var r,n,i,a=e[1]||"",s=e[3];if(!s)return a;if(t&&"function"==typeof btoa){var o=(r=s,n=btoa(unescape(encodeURIComponent(JSON.stringify(r)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n),"/*# ".concat(i," */")),u=s.sources.map((function(e){return"/*# sourceURL=".concat(s.sourceRoot).concat(e," */")}));return[a].concat(u).concat([o]).join("\n")}return[a].join("\n")}(t,e);return t[2]?"@media ".concat(t[2],"{").concat(r,"}"):r})).join("")},t.i=function(e,r){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},i=0;i<this.length;i++){var a=this[i][0];null!=a&&(n[a]=!0)}for(var s=0;s<e.length;s++){var o=e[s];null!=o[0]&&n[o[0]]||(r&&!o[2]?o[2]=r:r&&(o[2]="(".concat(o[2],") and (").concat(r,")")),t.push(o))}},t}},function(e,t,r){var n,i={},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}();function s(e,t){for(var r=[],n={},i=0;i<e.length;i++){var a=e[i],s=t.base?a[0]+t.base:a[0],o={css:a[1],media:a[2],sourceMap:a[3]};n[s]?n[s].parts.push(o):r.push(n[s]={id:s,parts:[o]})}return r}function o(e,t){for(var r=0;r<e.length;r++){var n=e[r],a=i[n.id],s=0;if(a){for(a.refs++;s<a.parts.length;s++)a.parts[s](n.parts[s]);for(;s<n.parts.length;s++)a.parts.push(v(n.parts[s],t))}else{for(var o=[];s<n.parts.length;s++)o.push(v(n.parts[s],t));i[n.id]={id:n.id,refs:1,parts:o}}}}function u(e){var t=document.createElement("style");if(void 0===e.attributes.nonce){var n=r.nc;n&&(e.attributes.nonce=n)}if(Object.keys(e.attributes).forEach((function(r){t.setAttribute(r,e.attributes[r])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var l,c=(l=[],function(e,t){return l[e]=t,l.filter(Boolean).join("\n")});function d(e,t,r,n){var i=r?"":n.css;if(e.styleSheet)e.styleSheet.cssText=c(t,i);else{var a=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}function f(e,t,r){var n=r.css,i=r.media,a=r.sourceMap;if(i&&e.setAttribute("media",i),a&&btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var h=null,p=0;function v(e,t){var r,n,i;if(t.singleton){var a=p++;r=h||(h=u(t)),n=d.bind(null,r,a,!1),i=d.bind(null,r,a,!0)}else r=u(t),n=f.bind(null,r,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).attributes="object"==typeof t.attributes?t.attributes:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n));var r=s(e,t);return o(r,t),function(e){for(var n=[],a=0;a<r.length;a++){var u=r[a],l=i[u.id];l&&(l.refs--,n.push(l))}e&&o(s(e,t),t);for(var c=0;c<n.length;c++){var d=n[c];if(0===d.refs){for(var f=0;f<d.parts.length;f++)d.parts[f]();delete i[d.id]}}}}},function(e,t,r){r.d(t,"b",(function(){return U})),r.d(t,"a",(function(){return F}));var n=r(47),i=r.n(n),a=r(4),s=r.n(a),o=r(3),u=r.n(o),l=r(27),c=r.n(l),d=r(7),f=r.n(d),h=r(17),p=r.n(h),v={ok:f()("fpads:analytics:request-queue"),err:f()("fpads:analytics:request-queue:err"),warn:f()("fpads:analytics:request-queue:warn")},g=function(){function e(){s()(this,e),this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return u()(e,null,[{key:"of",value:function(){return new e}},{key:"is_empty",value:function(e){return 0==e.pending.size}},{key:"is_high_water",value:function(t){return t.open.size==e.MAX_OPEN_REQUESTS}},{key:"maybe_spawn_req",value:function(t){if(e.is_empty(t))return v.ok("maybe_spawn_req called Queue that is EMPTY"),t;if(e.is_high_water(t))return v.warn("maybe_spawn_req called on Queue that is HIGH_WATER"),t;try{e.request(t,e.lpop(t))}catch(e){v.err(e)}}},{key:"increment_failures",value:function(t){return t.stats.failures++,t.stats.failures>e.MAX_FAILURE_COUNT&&(t.stats.ttl=Date.now()+e.REQUEST_TTL_MS),t}},{key:"handle_error",value:function(t,r){e.rm(t,r),e.increment_failures(t)}},{key:"request",value:function(t,r){var n=p()(r,3),i=n[0],a=n[1],s=n[2];if(v.ok("Request[".concat(s.event_type,"] request"),s,t.stats),Date.now()<t.stats.ttl)return v.warn("Request[".concat(s.event_type,"] skipping because too many errors too quickly"),t.stats);var o=new XMLHttpRequest;t.open.push(o),o.timeout=e.REQUEST_TIMEOUT_MS,o.ontimeout=function(){e.handle_error(t,o),v.warn("Request[".concat(s.event_type,"] timed out in ").concat(o.timeout,"ms"),t.stats)},o.onerror=function(r){e.handle_error(t,o),r&&v.err(r),v.warn("Request[".concat(s.event_type,"] encountered an Error"),o.responseText,t.stats)},o.onreadystatechange=function(){o.readyState==XMLHttpRequest.DONE&&e.rm(t,o),Math.floor(o.status/100)},o.onload=function(){e.rm(t,o),t.stats.failures&&t.stats.failures--,v.ok("Request[".concat(s.event_type,"] :ok"),o.stats)},o.open(a,i),o.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{o.send(JSON.stringify(s))}catch(e){v.err(e)}}},{key:"rpush",value:function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.forEach((function(r){if(t.pending.length>=e.HIGH_WATER_PENDING)return v.warn("Too many open requests, skipping",t.stats);t.pending.push(r),e.maybe_spawn_req(t)})),t}},{key:"lpop",value:function(e){return e.pending.shift()}},{key:"rm",value:function(e,t){var r=e.open.lastIndexOf(t);return~r&&e.open.splice(r,1),e}}]),e}();g.MAX_OPEN_REQUESTS=3,g.MAX_PENDING=5,g.REQUEST_TIMEOUT_MS=4e3,g.REQUEST_TTL_MS=5e3,g.MAX_FAILURE_COUNT=3;var m=r(48),y=r.n(m),E=r(49),_=r(7)("fpads:device"),T=y.a.parse(window.navigator.userAgent),b=T.platform,A=T.os,S=T.browser;_(T);var L=function(e){return e&&e.toLowerCase()},k={rnd:Math.random().toString(36).substr(2,32),os:L(A.name+(A.versionName?" ".concat(A.versionName):"")),device:L(b.type),browser:L(S.name),browser_version:(S&&S.version?S.version:"unknown").split(".").shift(),plugin_version:E.version},w=r(0),D="https://fp-eu-w1-aai.flowplayer.com/in",R="POST",O=[w.a.AD_REQUESTED,w.a.AD_REQUEST_ERROR,w.a.AD_REQUEST_COMPLETED,w.a.AD_COMPLETED,w.a.AD_STARTED,w.a.AD_ERROR,w.a.AD_SKIPPED],C=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],I=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],x=f()("fpads:analytics"),P=g.of(),M=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Object.assign.apply(Object,[{}].concat(t))},N=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Object.keys(e).filter((function(e){return~r.indexOf(e)})).reduce((function(t,r){return Object.assign(t,c()({},r,e[r]))}),{})},F=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s()(this,e),this.metadata=M(k,r.metadata||{}),this.emitter=t,this.events=r.events||[],this.required_keys=r.required_keys||[],this.optional_keys=r.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),x(this),this.wireup()}return u()(e,null,[{key:"of",value:function(t,r){return new e(t,r)}},{key:"ensure_required_keys",value:function(e,t){return e.required_keys.filter((function(e){return!(e in t)}))}},{key:"pluck_valid_keys",value:function(e,t){return N.apply(void 0,[t].concat(i()(e.valid_keys)))}},{key:"mergeMetadata",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.metadata=e.pluck_valid_keys(t,M(t.metadata,r,{player_version:window.flowplayer.version})),t}}]),u()(e,[{key:"wireup",value:function(){var t=this;t.events.forEach((function(r){t.emitter.on(r,(function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=M(t.metadata,{event_type:r},n),a=e.pluck_valid_keys(t,i),s=e.ensure_required_keys(t,a);if(x("Event[".concat(r,"]"),{payload:a,observation:n}),s.length)return x("Analytics.validate_metadata() failed for \n Event[".concat(r,"]\n missing keys: ").concat(s),a);g.rpush(P,[D,R,a])}))}))}},{key:"destroy",value:function(){this.metadata=void 0,this.emitter=void 0,this.events=void 0,this.required_keys=void 0,this.optional_keys=void 0,this.valid_keys=void 0}}]),e}(),U=function(e){return F.of(e,{required_keys:C,optional_keys:I,events:O})}},function(e,t,r){var n=r(55),i=r(60);e.exports=r(22)?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t,r){e.exports=!r(23)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){var r=0,n=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+n).toString(36))}},function(e,t,r){var n=r(26),i=r(36);e.exports=function(e){return n(i(e))}},function(e,t,r){var n=r(35);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){r(8);var n=r(84);function i(t,r,a){return"undefined"!=typeof Reflect&&Reflect.get?e.exports=i=Reflect.get:e.exports=i=function(e,t,r){var i=n(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(r):a.value}},i(t,r,a||t)}e.exports=i},function(e,t,r){var n,i="object"==typeof Reflect?Reflect:null,a=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(){void 0!==a&&e.removeListener("error",a),r([].slice.call(arguments))}var a;"error"!==t&&(a=function(r){e.removeListener(t,i),n(r)},e.once("error",a)),e.once(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var u=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function d(e,t,r,n){var i,a,s,o;if(l(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),s=a[t]),void 0===s)s=a[t]=r,++e._eventsCount;else if("function"==typeof s?s=a[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,o=u,console&&console.warn&&console.warn(o)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):g(i,i.length)}function v(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)a(u,this,t);else{var l=u.length,c=g(u,l);for(r=0;r<l;++r)a(c[r],this,t)}return!0},o.prototype.addListener=function(e,t){return d(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return d(this,e,t,!0)},o.prototype.once=function(e,t){return l(t),this.on(e,h(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,h(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,a,s;if(l(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){s=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):v.call(e,t)},o.prototype.listenerCount=v,o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,r){var n=r(88),i=r(89),a=r(45);e.exports={formats:a,parse:i,stringify:n}},function(e,t,r){r.d(t,"a",(function(){return f}));var n=r(1),i=r.n(n),a=r(2),s=r.n(a),o=(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"}),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 u(e){return Object.assign({muted:!1,timeout:250,inline:!1},e)}function l(e,t){var r=e.muted,n=e.timeout,i=e.inline,a=t(),s=a.element,o=a.source,u=void 0,l=void 0,c=void 0;return s.muted=r,!0===r&&s.setAttribute("muted","muted"),!0===i&&s.setAttribute("playsinline","playsinline"),s.src=o,new Promise((function(e){u=s.play(),l=setTimeout((function(){c(!1,new Error("Timeout "+n+" ms has been reached"))}),n),c=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;clearTimeout(l),e({result:t,error:r})},void 0!==u?u.then((function(){return c(!0)})).catch((function(e){return c(!1,e)})):c(!0)}))}var c=function(e){return l(e=u(e),(function(){return{element:document.createElement("video"),source:URL.createObjectURL(o)}}))},d=void 0;function f(){return h.apply(this,arguments)}function h(){return(h=s()(i.a.mark((function e(){var t,r=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!(r.length>0&&void 0!==r[0])||r[0],!d){e.next=3;break}return e.abrupt("return",d);case 3:return e.next=5,c({timeout:500,muted:t});case 5:return d=e.sent,e.abrupt("return",d);case 7:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}},function(e,t){var r={}.hasOwnProperty;e.exports=function(e,t){return r.call(e,t)}},function(e,t,r){var n=r(62);e.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,r){var n=r(64),i=r(69);e.exports=Object.keys||function(e){return n(e,i)}},function(e,t){var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,r){var n=r(38),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},function(e,t){var r=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:r)(e)}},function(e,t,r){var n=r(10),i=r(13),a=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:n.version,mode:r(68)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,r){var n=r(36);e.exports=function(e){return Object(n(e))}},function(e,t,r){var n=r(34),i=r(25),a=r(40).f;e.exports=function(e){return function(t){for(var r,s=i(t),o=n(s),u=o.length,l=0,c=[];u>l;)a.call(s,r=o[l++])&&c.push(e?[r,s[r]]:s[r]);return c}}},function(e,t,r){var n=r(39)("wks"),i=r(24),a=r(13).Symbol,s="function"==typeof a;(e.exports=function(e){return n[e]||(n[e]=s&&a[e]||(s?a:i)("Symbol."+e))}).store=n},function(e,t,r){var n=Object.prototype.hasOwnProperty,i=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r};e.exports={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var i=t[n],a=i.obj[i.prop],s=Object.keys(a),o=0;o<s.length;++o){var u=s[o],l=a[u];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(t.push({obj:a,prop:u}),r.push(l))}return function(e){for(var t;e.length;){var r=e.pop();if(t=r.obj[r.prop],Array.isArray(t)){for(var n=[],i=0;i<t.length;++i)void 0!==t[i]&&n.push(t[i]);r.obj[r.prop]=n}}return t}(t)},decode:function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},encode:function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),r="",n=0;n<t.length;++n){var a=t.charCodeAt(n);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?r+=t.charAt(n):a<128?r+=i[a]:a<2048?r+=i[192|a>>6]+i[128|63&a]:a<55296||a>=57344?r+=i[224|a>>12]+i[128|a>>6&63]+i[128|63&a]:(n+=1,a=65536+((1023&a)<<10|1023&t.charCodeAt(n)),r+=i[240|a>>18]+i[128|a>>12&63]+i[128|a>>6&63]+i[128|63&a])}return r},isBuffer:function(e){return null!=e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},merge:function e(t,r,i){if(!r)return t;if("object"!=typeof r){if(Array.isArray(t))t.push(r);else{if("object"!=typeof t)return[t,r];(i.plainObjects||i.allowPrototypes||!n.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=a(t,i)),Array.isArray(t)&&Array.isArray(r)?(r.forEach((function(r,a){n.call(t,a)?t[a]&&"object"==typeof t[a]?t[a]=e(t[a],r,i):t.push(r):t[a]=r})),t):Object.keys(r).reduce((function(t,a){var s=r[a];return n.call(t,a)?t[a]=e(t[a],s,i):t[a]=s,t}),s)}}},function(e,t,r){var n=String.prototype.replace,i=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return n.call(e,i,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t,r){r.d(t,"a",(function(){return n})),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"});var n=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(e,t,r){var n=r(90),i=r(91),a=r(92);e.exports=function(e){return n(e)||i(e)||a()}},function(e,t,r){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),a=e.getVersionPrecision(r),s=Math.max(i,a),o=0,u=e.map([t,r],(function(t){var r=s-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(o=s-Math.min(i,a)),s-=1;s>=o;){if(u[0][s]>u[1][s])return 1;if(u[0][s]===u[1][s]){if(s===o)return 0;s-=1}else if(u[0][s]<u[1][s])return-1}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,r){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",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"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",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"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={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"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},a=r(18),s=function(){function e(){}var t;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},(t=[{key:"BROWSER_MAP",get:function(){return a.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return a.ENGINE_MAP}},{key:"OS_MAP",get:function(){return a.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return a.PLATFORMS_MAP}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e,t),e}();t.default=s,e.exports=t.default},91:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=u(r(92)),i=u(r(93)),a=u(r(94)),s=u(r(95)),o=u(r(17));function u(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=n.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=i.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return Object.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,i={},a=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,a+=1):"object"==typeof s&&(r[t]=s,n+=1)})),n>0){var s=Object.keys(r),o=s.find((function(e){return t.isOS(e)}));if(o){var u=this.satisfies(r[o]);if(void 0!==u)return u}var l=s.find((function(e){return t.isPlatform(e)}));if(l){var c=this.satisfies(r[l]);if(void 0!==c)return c}}if(a>0){var d=Object.keys(i).find((function(e){return t.isBrowser(e,!0)}));if(void 0!==d)return this.compareVersion(i[d])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=o.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(o.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e){return this.isBrowser(e)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=l,e.exports=t.default},92:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=r(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:a.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.WindowsPhone,version:t}}},{test:[/windows/i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:a.OS_MAP.Windows,version:t,versionName:r}}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:a.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:a.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:a.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:a.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:a.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:a.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:a.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=r(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:a.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:a.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:a.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=r(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:a.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:a.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:a.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:a.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:a.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:a.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:a.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=s,e.exports=t.default}})},function(e){e.exports=JSON.parse('{"name":"@flowplayer/ads","version":"1.16.5","description":"","main":"index.js","scripts":{"lint":"eslint src","test:debug":"DEBUG=collector:* jest -i","test":"jest -i","dev":"NODE_ENV=development TARGET=unlocked webpack-dev-server --progress --colors --port 8844 --host 0.0.0.0","prod":"webpack -p","build":"webpack","prepublish":"rm -rf dist/ && NO_DEMOS=true npm run build:unlocked && npx uglifyjs dist/native.js","build:locked":"TARGET=locked webpack","build:unlocked":"TARGET=unlocked webpack","collector":"node node_modules/.bin/collector","rel":"git tag -d production && git push origin :production && git tag production && git push origin --tags","test:browserstack":"jest -i --testMatch=**/test/browserstack/*.spec.js","test:unit":"jest -i --env jsdom --testMatch \'<rootDir>/test/unit/**/*.spec.js\'"},"husky":{"hooks":{"pre-commit":"yarn lint","post-merge":"yarn"}},"jest":{"testMatch":["**/__tests__/**/*.js?(x)","**/?(*.)(spec|test).js?(x)"],"testURL":"https://flowplayer.com/videos/fake","moduleNameMapper":{"<%TARGET%>":"<rootDir>/test/jest/transform.js"},"globalSetup":"./test/jest/setup","globalTeardown":"./test/jest/teardown","testEnvironment":"./test/jest/browserstack","bail":true},"author":"","license":"ISC","devDependencies":{"@babel/core":"^7.1.0","@babel/plugin-proposal-object-rest-spread":"^7.0.0","@babel/plugin-syntax-object-rest-spread":"^7.0.0","@babel/plugin-transform-runtime":"^7.1.0","@babel/preset-env":"^7.1.0","@babel/runtime":"^7.0.0","@flowplayer/collector":"^0.2.2","babel-core":"^7.0.0-bridge.0","babel-eslint":"^10.0.1","babel-jest":"^23.6.0","babel-loader":"^8.0.2","chai":"^4.1.2","css-loader":"^3.1.0","eslint":"^5.5.0","eslint-import-resolver-webpack":"^0.12.0","eslint-plugin-import":"^2.14.0","git-rev-sync":"^2.0.0","handlebars":"^4.7.7","handlebars-loader":"^1.7.0","html-webpack-plugin":"^4.0.3","husky":"^4.3.0","jest":"^26.4.2","moment":"^2.19.2","node-sass":"^4.13.1","sass-loader":"^8.0.0","style-loader":"^1.0.0","webpack":"^4.37.0","webpack-cli":"^3.1.1","webpack-dev-server":"^3.1.11"},"dependencies":{"bean":"^1.0.15","bowser":"^2.7.0","can-autoplay":"^3.0.0","core-js":"^2.5.7","debug":"^4.0.1","es6-event-emitter":"^1.10.2"}}')},function(e,t,r){function n(e,t){var r=!1,n=function(){var n,i=(n=e.getBoundingClientRect()).top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)+n.height&&n.right<=(window.innerWidth||document.documentElement.clientWidth)+n.width;i!==r&&t(i),r=i};return setTimeout(n),document.addEventListener("scroll",n),function(){return document.removeEventListener("scroll",n)}}r.d(t,"a",(function(){return n}))},function(e,t,r){r.d(t,"a",(function(){return ae}));var n=r(1),i=r.n(n),a=r(2),s=r.n(a),o=r(5),u=r.n(o),l=r(4),c=r.n(l),d=r(3),f=r.n(d),h=r(11),p=r.n(h),v=r(8),g=r.n(v),m=r(12),y=r.n(m),E=r(16),_=r.n(E),T=r(28),b=r.n(T),A=r(0),S=r(6),L=r.n(S),k=r(7)("fpads:timers"),w=-1,D=function(){function e(){c()(this,e),this.intervals={},this.timers={}}return f()(e,null,[{key:"of",value:function(){return new e}},{key:"id",value:function(){return++w}},{key:"createTimeout",value:function(t,r,n){var i=setTimeout((function(){delete t.timers[i],n()}),r);if(k("TimerRegistry.createTimeout() -> ".concat(i),t.timers),"object"==L()(i)){var a=e.id();return t.timers[a]=i,a}return t.timers[i]=i,i}},{key:"removeTimeout",value:function(e,t){return k("TimerRegistry.removeTimeout() -> ".concat(t),e.timers),clearTimeout(e.timers[t]),delete e.timers[t],e}},{key:"createInterval",value:function(t,r,n){var i=setInterval(n,r);if(k("TimerRegistry.createInterval() -> ".concat(i),t.intervals),"object"==L()(i)){var a=e.id();return t.intervals[a]=i,a}return t.intervals[i]=i,i}},{key:"removeInterval",value:function(e,t){return k("TimerRegistry.removeInterval() -> ".concat(t),e.intervals),clearInterval(e.intervals[t]),delete e.intervals[t],e}},{key:"empty",value:function(t){if(t)return k("TimerRegistry.empty()",Object.keys(t.timers),Object.keys(t.intervals)),Object.keys(t.intervals).forEach((function(r){return e.removeInterval(t,r)})),Object.keys(t.timers).forEach((function(r){return e.removeTimeout(t,r)})),t}}]),e}(),R=r(9),O=function(e,t){var r="".concat(e,"() not implemented by the adapter");if(t)throw new Error(r);console.warning(r)},C=function(){function e(){c()(this,e)}var t,r,n;return f()(e,[{key:"initialize",value:function(e){O("initialize",!0)}},{key:"reset",value:function(){O("reset",!0)}},{key:"destroy",value:function(){O("destroy",!0)}},{key:"stop",value:function(){O("stop",!0)}},{key:"initAd",value:(n=s()(i.a.mark((function e(t,r){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:O("initAd",!0);case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"playAd",value:(r=s()(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:O("playAd",!0);case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"pause",value:function(){O("pause",!1)}},{key:"resume",value:function(){O("resume",!1)}},{key:"volume",value:function(e){O("volume",!1)}},{key:"contentComplete",value:(t=s()(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:O("contentComplete",!1);case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"onResize",value:function(e){O("onResize",!1)}},{key:"isUiDisabled",value:function(){return!1}},{key:"getAdPodInfo",value:function(){return null}},{key:"isAdPod",value:function(){return!1}},{key:"canDismissNonLinear",value:function(){return!1}}]),e}(),I=r(7)("fpads:adapter:base"),x=function(e){function t(e){var r;return c()(this,t),(r=p()(this,g()(t).call(this))).eventHandler=e,r.opts={},r._prepared=void 0,r._initialized=void 0,r._videoTag=void 0,r._dimensions=void 0,r._sharedVideoTag=void 0,r._autoplayResult=void 0,r._adLinear=!0,r._paused=!0,r}var r,n,a;return y()(t,e),f()(t,[{key:"destroy",value:function(){this.eventHandler=void 0,this._videoTag=void 0}},{key:"stop",value:function(){}},{key:"isReady",value:function(){return!!this._initialized}},{key:"init",value:(a=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I("init",this._videoTag,t),this.opts=t,this._dimensions={width:t.width,height:t.height},this._prepared=!0,this._initialized||!this._videoTag){e.next=7;break}return e.next=7,this.initAdapter();case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"setVideoTag",value:(n=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._videoTag=t,this._initialized||!this._prepared){e.next=4;break}return e.next=4,this.initAdapter();case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"initAdapter",value:(r=s()(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I("initAdapter",this.opts),e.prev=1,e.next=4,this.initialize(this.opts);case 4:this._initialized=!0,e.next=12;break;case 7:e.prev=7,e.t0=e.catch(1),I("initAdapter failed:",e.t0),this._prepared=!1,this.eventHandler.trigger(A.a.ADAPTER_INIT_FAILED);case 12:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return r.apply(this,arguments)})},{key:"setIOSPlaysInline",value:function(e){I("setIOSPlaysInline",e),this._sharedVideoTag=!e,this.initialize(u()({},this.opts,{DisableCustomPlaybackForIOS10Plus:e}))}},{key:"resize",value:function(e){var t=e.width,r=e.height,n=e.linear,i=e.silent,a=e.resize_non_linear;!1===n&&(t+=10,r+=10),this._adLinear=void 0===n?this._adLinear:n,this.onResize({width:t,height:r,linear:this._adLinear,silent:i,resize_non_linear:a}),this._dimensions={width:t,height:r,linear:n}}},{key:"dimensions",get:function(){return this._dimensions}},{key:"videoTag",get:function(){return this._videoTag}},{key:"adLinear",get:function(){return this._adLinear}},{key:"sharedVideoTag",get:function(){return this._sharedVideoTag}},{key:"paused",get:function(){return this._paused}}]),t}(C);function P(e){try{return e.getAdPodInfo().getPodIndex()}catch(e){return}}var M=r(7)("fpads:adapter:ima"),N=function(e){function t(e){var r;return c()(this,t),(r=p()(this,g()(t).call(this,e)))._adHandlers=[],r._timers=D.of(),r._started=!1,r._volumeLevel=0,r._adLoaded=!1,r._currentDuration=0,r._currentRemaining=0,r._currentDisplayTs=0,r}var r,n,a,o;return y()(t,e),f()(t,[{key:"destroy",value:function(){b()(g()(t.prototype),"destroy",this).call(this),D.empty(this._timers),this._adHandlers&&this._adHandlers.forEach((function(e){return e()})),this._adHandlers=void 0,this._adDisplayContainer&&this._adDisplayContainer.destroy(),this._adDisplayContainer=void 0,this._adsLoader&&this._adsLoader.destroy(),this._adsLoader=void 0,this._adsManager&&this._adsManager.destroy(),this._adsManager=void 0}},{key:"stop",value:function(){b()(g()(t.prototype),"stop",this).call(this),this._adsManager&&this._adsManager.stop()}},{key:"initialize",value:function(e){var r=this,n=this.isAdPod(),i=this._adLoaded||n;this.cleanup();var a=this;this.opts=e,this._volumeLevel=e.volume;var s=google.ima.settings;e.NumRedirects=e.NumRedirects||e.redirects,Object.keys(e).forEach((function(t){void 0!==s["set".concat(t)]&&s["set".concat(t)](e[t])}));var o={VpaidMode:google.ima.ImaSdkSettings.VpaidMode.INSECURE,DisableCustomPlaybackForIOS10Plus:!0};Object.keys(o).filter((function(t){return void 0===e[t]})).forEach((function(e){return s["set".concat(e)](o[e])})),this._adDisplayContainer=new google.ima.AdDisplayContainer(e.container,this.videoTag),this._adDisplayContainer.initialize(),this._adsLoader=new google.ima.AdsLoader(this._adDisplayContainer),M("ima.initialise(:wait -> ADS_MANAGER_LOADED)",u()({},e,{volume:this.videoTag.volume,muted:this.videoTag.muted})),this._adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(function(n){M("ima.initialise(:done -> ADS_MANAGER_LOADED)\n%o",u()({},e,{volume:r.videoTag.volume,muted:r.videoTag.muted}));var i=new google.ima.AdsRenderingSettings;M("ima.rendering(preload: %s)",!!e.preload_ads),i.useStyledNonLinearAds=!0,i.enablePreloading=!!e.preload_ads,"number"==typeof e.media_timeout&&(i.loadVideoTimeout=e.media_timeout),i.restoreCustomPlaybackStateOnAdBreakComplete=!e.DisableCustomPlaybackForIOS10Plus,r.sharedVideoTag&&(i.playAdsAfterTime=r.videoTag.currentTime),r.eventHandler.trigger(A.a.IMA_ADS_RENDERING_SETTINGS,i);var s=r._adsManager=n.getAdsManager(r.videoTag,i);r.eventHandler.trigger(A.a.IMA_ADAPTER_INIT,s),s.addEventListener(google.ima.AdEvent.Type.LOADED,(function(){M("debug(ima.adsManager): google.ima.AdEvent.Type.LOADED")})),s.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(){M("debug(ima.adsManager): google.ima.AdErrorEvent.Type.AD_ERROR")})),s.addEventListener(google.ima.AdEvent.Type.STARTED,(function(){M("debug(ima.adsManager): google.ima.AdEvent.Type.STARTED")})),s.addEventListener(google.ima.AdEvent.Type.STARTED,(function(e){a.debugEvent(e);var n=e.getAd();a._currentDuration=n.getDuration(),a._currentDisplayTs=Date.now(),r.emitWithAd(A.a.AD_STARTED,n),n.isLinear()&&t.pollRemaining({ima:a,adsManager:s})})),s.addEventListener(google.ima.AdEvent.Type.COMPLETE,(function(e){a.debugEvent(e),a.emitWithAd(A.a.AD_COMPLETED,e.getAd()),D.empty(r._timers)})),s.addEventListener(google.ima.AdEvent.Type.SKIPPED,(function(e){a.debugEvent(e),a.emitWithAd(A.a.AD_SKIPPED,e.getAd())})),s.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,(function(e){a.debugEvent(e),a.emitWithAd(A.a.AD_PAUSE_CONTENT,e.getAd())})),s.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,(function(e){a.debugEvent(e),a._started=!1,a._currentDisplayTs=0,a.eventHandler.trigger(A.a.AD_BREAK_COMPLETED)})),s.addEventListener(google.ima.AdEvent.Type.VOLUME_CHANGED,(function(e){M("IMA::volume(type: %s, event: %o)",e.type,e);var t=s.getVolume();a._volumeLevel=t,a.eventHandler.trigger(A.a.AD_VOLUME_CHANGED,t)}));var o=function(e){a._paused=e,a.eventHandler.trigger(e?A.a.AD_PAUSED:A.a.AD_RESUMED)};s.addEventListener(google.ima.AdEvent.Type.PAUSED,(function(){return o(!0)})),s.addEventListener(google.ima.AdEvent.Type.RESUMED,(function(){return o(!1)})),s.addEventListener(google.ima.AdEvent.Type.STARTED,(function(){return o(!1)})),s.addEventListener(google.ima.AdEvent.Type.VOLUME_MUTED,(function(e){M("IMA::volume(type: %s, event: %o)",e.type,e),a.eventHandler.trigger(A.a.AD_MUTED)})),s.init(r.opts.width,r.opts.height,google.ima.ViewMode.NORMAL),M("ima.initialise: done initializing")})),i&&(M("Event(reload: %s)",A.a.RELOAD_AD_REQUESTED),a.eventHandler.trigger(A.a.RELOAD_AD_REQUESTED,n)),this.eventHandler.trigger(A.a.AD_INIT,this)}},{key:"destroyManager",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"unknown";if(!this._adsManager)return M("ima::destroyManager(:skip, label: %s)",e);M("ima::destroyManager(:ok, label: %s)",e),this._adsManager.destroy()}},{key:"reset",value:function(){this.destroyManager("reset"),D.empty(this._timers),this.clearAdHandlers(),this._started=!1,this._adLoaded=!1}},{key:"cleanup",value:function(){this.destroyManager("cleanup"),this._adsLoader&&this._adsLoader.destroy(),this._adDisplayContainer&&this._adDisplayContainer.destroy(),this._adLoaded=!1}},{key:"waitForAdsManager",value:function(){var e=this;return new Promise((function(t){M("ima.waitForAdsManager:",e._adsManager),e.once(e._adsLoader,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(function(){M("ima.waitForAdsManager(:ok)",e._adsManager),t(e._adsManager)}))}))}},{key:"initAd",value:(o=s()(i.a.mark((function e(t){var r,n=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:5e3,M("ima.initAd(adTag: ".concat(t,", timeout: ").concat(r,")")),e.prev=2,e.next=5,this.requestAd(t,r);case 5:this._adLoaded=!0,e.next=13;break;case 8:throw e.prev=8,e.t0=e.catch(2),M("ima.initAd:",e.t0),this._adLoaded=!1,e.t0;case 13:return e.prev=13,D.empty(this._timers),e.finish(13);case 16:case"end":return e.stop()}}),e,this,[[2,8,13,16]])}))),function(e){return o.apply(this,arguments)})},{key:"requestAd",value:(a=s()(i.a.mark((function e(t,r){var n,a,o,l,c,d,f,h,p,v=this;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.destroyManager("requestAd"),n=this,o=this.opts.autoplay,l=void 0!==o&&o,c=Date.now(),d=this.videoTag.muted,this._volumeLevel=this.videoTag.volume,f=d||0==this._volumeLevel,n._all_ads_completed=!1,M("ima.requestAd(%o)",u()({},this.opts,{autoplay:l,muted:d,timeout:r,adTag:t,_volumeLevel:this._volumeLevel,manager:this._adsManager})),this.clearAdHandlers(),(h=new google.ima.AdsRequest).adTagUrl=t,h.linearAdSlotWidth=this.opts.width,h.linearAdSlotHeight=this.opts.height,this.opts.disable_non_linear_ads||(h.nonLinearAdSlotWidth=this.opts.width),this.opts.disable_non_linear_ads||(h.nonLinearAdSlotHeight=this.opts.height-50),h.setAdWillAutoPlay(l),h.setAdWillPlayMuted(f),h.vastLoadTimeout=r,this.eventHandler.trigger(A.a.IMA_BEFORE_ADS_REQUEST,{request:h}),this._adsLoader.requestAds(h),p=new Promise(function(){var e=s()(i.a.mark((function e(t,s){var o,u,l,d,h;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(){clearTimeout(l),t.apply(void 0,arguments)},u=function(){clearTimeout(l),s.apply(void 0,arguments)},v.once(v._adsLoader,google.ima.AdErrorEvent.Type.AD_ERROR,(function(e){v.emitError(A.a.AD_REQUEST_ERROR,e),u(new Error("Ad load failed"))})),l=setTimeout((function(){var e=new Error("Ad internal timeout reached");v.eventHandler.trigger(A.a.AD_TIMEOUT,e),s(e)}),1.5*(r+(v.opts.media_timeout||5e3))),e.next=6,n.waitForAdsManager();case 6:if(d=e.sent,v.volume(f?0:v._volumeLevel),n.eventHandler.trigger(A.a.AD_VOLUME_CHANGED,v._volumeLevel),!(h=v.cuepoints())||!h.length||0===h[0]){e.next=12;break}return e.abrupt("return",o({ad:!1,adsManager:d}));case 12:v.once(d,google.ima.AdErrorEvent.Type.AD_ERROR,(function(e){v.emitError(A.a.AD_PLAYBACK_ERROR,e),u(e)})),v.once(d,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,(function(){v._all_ads_completed=!0,o()})),v.once(d,google.ima.AdEvent.Type.LOADED,(function(e){v.eventHandler.trigger(A.a.AD_REQUEST_COMPLETED,{request_load_time:Date.now()-c}),a=e.getAd(),M("ima.requestAd: AD_REQUEST_COMPLETED",a.getContentType()),"application/javascript"==a.getContentType()&&v.eventHandler.trigger(A.a.VPAID_INIT,a),o()})),v.once(d,google.ima.AdEvent.Type.CLICK,(function(){M("ima.requestAd: click event"),n.pause()}));case 16:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("return",p);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"playAd",value:(n=s()(i.a.mark((function e(){var t;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(M("ima.playAd()",this),this._adsManager&&this._adLoaded){e.next=3;break}return e.abrupt("return");case 3:if(t=this._adsManager.getCurrentAd()){e.next=6;break}return e.abrupt("return");case 6:if(!this.sharedVideoTag||t.isLinear()){e.next=8;break}return e.abrupt("return");case 8:return e.prev=8,e.next=11,this.startAndWaitForAdCompletion(this._adsManager,t.isLinear());case 11:e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(8),M("ima.playAd",e.t0),e.t0;case 17:return e.prev=17,this._adLoaded=!1,D.empty(this._timers),e.finish(17);case 21:case"end":return e.stop()}}),e,this,[[8,13,17,21]])}))),function(){return n.apply(this,arguments)})},{key:"startAndWaitForAdCompletion",value:function(e,r){var n=this;if(!this._started){M("ima.startAndWaitForAdCompletion(manager: %o)",{volume:e.getVolume()});var a=this;return new Promise((function(o,u){var l=!1;a.once(e,google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,(function(){if(M("ima.startAndWaitForAdCompletion: CONTENT_RESUME_REQUESTED <<< happened"),a._started=!1,l)return M("ima.startAndWaitForAdCompletion: Content resume requested, but trying to recover from ad error");o()})),a.once(e,google.ima.AdErrorEvent.Type.AD_ERROR,function(){var e=s()(i.a.mark((function e(r){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return M("ima.startAndWaitForAdCompletion: beginning error recovery ->",r),l=!0,e.prev=2,e.next=5,t.pollForFatalError({err:r,ima:a});case 5:e.sent.ok&&(l=!1),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(2),a._started=!1,u(r);case 14:case"end":return e.stop()}}),e,this,[[2,10]])})));return function(t){return e.apply(this,arguments)}}()),r&&(n._started=!0),e.start(),n.eventHandler.trigger(A.a.AD_PLAY_REQUESTED)}))}}},{key:"pause",value:function(){M("ima.pause()"),this._adsManager&&this._adsManager.pause()}},{key:"resume",value:function(){M("ima.resume()"),this._adsManager&&this._adsManager.resume()}},{key:"volume",value:function(e){try{return arguments.length>0&&"number"==typeof e&&this._adsManager.setVolume(e),this._volumeLevel=this._adsManager.getVolume()}catch(e){M("ima.volume() failed (%o)",e)}}},{key:"onResize",value:function(e){var t=e.width,r=e.height,n=e.linear,i=e.silent,a=e.resize_non_linear;this.opts&&(t||r)&&(n&&(this.opts.width=t,this.opts.height=r),this._adsManager&&(n||a)&&(i||M("ima.onResize %s x %s",t,r),this._adsManager.resize(t,r,google.ima.ViewMode.NORMAL)))}},{key:"currentAd",value:function(){return this._adsManager&&this._adsManager.getCurrentAd()}},{key:"isAdPod",value:function(){return this.cuepoints()&&this.cuepoints().length>1}},{key:"cuepoints",value:function(){return this._adsManager&&this._adsManager.getCuePoints()}},{key:"contentComplete",value:(r=s()(i.a.mark((function e(){var r=this;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(M("ima.contentComplete() -> ",this),this._adsLoader&&this._adsLoader.contentComplete(),this.cuepoints()&&-1!==this.cuepoints().indexOf(-1)){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,new Promise((function(e){t.race(r.eventHandler,[A.a.AD_BREAK_COMPLETED,A.a.AD_ERROR],e)}));case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"isUiDisabled",value:function(){return this.currentAd()&&this.currentAd().isUiDisabled()}},{key:"getAdPodInfo",value:function(){try{return this.currentAd()&&this.currentAd().getAdPodInfo()}catch(e){return null}}},{key:"canDismissNonLinear",value:function(){var e=this.currentAd();if(!e||e.isLinear()||!this._adsManager||!this._currentDisplayTs)return!0;var t=Date.now(),r=e.getMinSuggestedDuration();return t-this._currentDisplayTs>1e3*r}},{key:"once",value:function(e,t,r){this._adHandlers.push(function(e,t,r){var n=function n(i){r(i),e.removeEventListener(t,n)};return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}}(e,t,r))}},{key:"clearAdHandlers",value:function(){M("ima.clearAdHandlers"),this._adHandlers.forEach((function(e){return e()})),this._adHandlers=[]}},{key:"emitWithAd",value:function(e,t){var r={ad_type:R.a.kindOf(P(t)),ad:{duration:t.getDuration(),width:t.getWidth(),height:t.getHeight()},volume:this._adsManager.getVolume(),vast_ad_id:t.getAdId(),linear:t.isLinear(),mime_type:t.getContentType(),ima_event:!0};M("emitWithAd::event(name: ".concat(e,", data: %o, ad: %o)"),r,t),this.eventHandler.trigger(e,r)}},{key:"emitError",value:function(e,t){var r={vast_error_type:t.getError().getType(),reason:t.getError().getMessage(),vast_error:t.getError().getErrorCode()};M("ima.error(".concat(e,")"),r),this.eventHandler.trigger(e,r)}},{key:"debugEvent",value:function(e){try{var t=e.getAd();if(!t)return;M("ima.event.".concat(e.type," ->"),{event:e,data:e.getAdData(),position:P(t),ad:t})}catch(e){}}}],[{key:"unwrapError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"function"==typeof e.getMessage?e.getMessage():e.message?e.message:t}},{key:"pollForFatalError",value:function(e){var r,n=e.err,i=e.ima;try{var a=n.getError(),s=t.unwrapError(a.getInnerError(),a);r={reason:s,type:a.getType(),code:a.getErrorCode()},M("ima.pollForFatalError",r)}catch(n){M("ima.pollForFatalError",n)}var o=i._currentRemaining;return new Promise((function(e,t){var n=setTimeout((function(){M("ima.pollForFatalError: Ad errored and not progressing, reject"),i.eventHandler&&i.eventHandler.trigger(A.a.AD_PLAYBACK_ERROR,r),t(new Error("Ad not progressing"))}),2500);i.eventHandler.once(A.a.AD_PROGRESS,(function(t){-1!==t.remaining&&t.remaining<o&&(M("ima.pollForFatalError: Ad still progressing even though errored, skip error rejection"),clearTimeout(n),e({ok:1}))}))}))}},{key:"pollRemaining",value:function(e){var t=e.ima,r=e.adsManager;return M("ima.pollRemaining"),D.createInterval(t._timers,250,(function(){t._currentRemaining=r.getRemainingTime(),t.eventHandler.trigger(A.a.AD_PROGRESS,{remaining:t._currentRemaining,duration:t._currentDuration})}))}},{key:"race",value:function(e,t,r){t.forEach((function(n){e.on(n,(function n(){t.forEach((function(t){return e.removeListener(t,n)}));for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];r(a)}))}))}}]),t}(x),F=function(){function e(){c()(this,e)}return f()(e,null,[{key:"create",value:function(e,t){return e.adapter?new e.adapter(t):new N(t)}}]),e}(),U=r(29),B=r(17),j=r.n(B),G=r(30),H=r.n(G),K=r(7)("fpads:macros"),V=/\[([\s\S]+?)\]/g,W=function(){function e(t,r){c()(this,e),this.vars=t,this.pattern=r}return f()(e,null,[{key:"of",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:V;return new e(t,r)}},{key:"run",value:function(e){try{return e()}catch(e){return void console.error(e)}}},{key:"merge",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce((function(e,t){return Object.assign(e,t)}),{})}},{key:"cast",value:function(t){var r=L()(t);return"undefined"===r?"":("function"===r&&(t=e.run(t)),encodeURIComponent(t))}},{key:"normalize",value:function(e){return e.trim()}},{key:"process_obj",value:function(t,r,n){return Object.keys(t).reduce((function(i,a){var s=e.process_str(a,r,n,!0),o=t[a];return null===o?(i[s]=o,i):"object"==L()(o)?(i[s]=e.process_obj(o,r,n),i):"string"==typeof o?(i[s]=e.process_str(o,r,n),i):void console.error(new Error("".concat(o," at ").concat(a," not a handled Macro type")))}),{})}},{key:"process_str",value:function(t,r,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return t.replace(r.pattern,(function(t,r){var a=e.normalize(r);if(!(a in n)||void 0===n[a])return t;var s=n[a],o=i?s:e.cast(s);return K("Macro.replace(raw: %s, macro: %s, value: %s)",i,r,o),o}))}}]),f()(e,[{key:"fork",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.pattern,n=e.merge(this.vars,t);return e.of(n,r)}},{key:"compile",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.merge(this.vars,r),i=t.split("?"),a=j()(i,2),s=a[0],o=a[1],u=H.a.parse(o||"",{strictNullHandling:!0,decoder:function(e){return e}}),l=H.a.stringify(e.process_obj(u,this,n),{encode:!1,strictNullHandling:!0});return e.process_str(s,this,n,!0)+"?"+l}}]),e}();function q(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{width:0,height:0};try{var i=document.createElement("a");i.href=t=window.location!=window.parent.location?document.referrer:document.location.href,r=i.hostname}catch(e){console.error(e)}var a=n.width,s=n.height,o=e||{},l=o.video_source,c="object"==L()(window.__flowplayerAdParameters)?window.__flowplayerAdParameters:{};return u()({random:Date.now(),page_url:t,domain:r,player_width:a,player_height:s,video_url:l,videourl:l},c)}function Y(e){return z.apply(this,arguments)}function z(){return(z=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"==typeof t){e.next=2;break}return e.abrupt("return",t);case 2:return e.prev=2,e.next=5,t();case 5:return e.abrupt("return",e.sent);case 8:return e.prev=8,e.t0=e.catch(2),e.abrupt("return","");case 11:case"end":return e.stop()}}),e,this,[[2,8]])})))).apply(this,arguments)}function X(e){return Q.apply(this,arguments)}function Q(){return(Q=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=L()(t),e.next="function"===e.t0||"string"===e.t0?3:"object"===e.t0?7:8;break;case 3:return e.next=5,Y(t);case 5:return e.t1=e.sent,e.abrupt("return",[e.t1]);case 7:return e.abrupt("return",Array.isArray(t)?Promise.all(t.map(Y)):X(t.adTag||[]));case 8:throw new Error("\n unhandled ads type ".concat(L()(t),":\n ").concat(JSON.stringify(t),"\n can be:\n | Array<string>\n | string\n | function\n | {adTag: Array<string>|string|function}\n "));case 9:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}Object.assign(W,{patterns:{BRACKETS:V,CURLY:/\{([\s\S]+?)\}/g,UNDERSCORE:/__([\s\S]+?)__/g}});var J=Object.prototype,Z=Object.getPrototypeOf;function $(e){return null!==e&&"object"===L()(e)&&Z(e)===J}var ee=r(7)("fpads:ads:state"),te={IDLE:0,INITIALIZING:1,FETCHING_AD:2,AD_AVAILABLE:4,BREAK_ACTIVE:8,PLAYING:16,FATAL_ERROR:32},re=function(){function e(){c()(this,e),this._state=0}return f()(e,null,[{key:"of",value:function(){return new e}}]),f()(e,[{key:"reset",value:function(){this._state=0}},{key:"toString",value:function(){var e=this;return 0==this._state?"AdState(None)":"AdState("+Object.keys(te).reduce((function(t,r){return e.hasAny(te[r])?t+r+": "+!!e.hasAny(te[r])+" ":t}),"").trim()+")"}},{key:"toggleState",value:function(e,t){return void 0===e&&ee(new Error("AdState cannot toggleState for `undefined`")),null==L()(t)?this._state^=e:t?void(this._state|=e):this._state&=~e}},{key:"hasAll",value:function(e){return this._state==(this._state|e)}},{key:"hasAny",value:function(e){return this._state&e}},{key:"state",get:function(){return this._state}}]),e}(),ne=r(7)("fpads:ads"),ie={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10},ae=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return c()(this,t),(e=p()(this,g()(t).call(this))).adapter=F.create(r,_()(_()(e))),e.opts=u()({},ie),e.analytics=void 0,e._state=re.of(),e._schedule=void 0,e._lastAd=void 0,e._macros=W.of(r.parameters||{}),e.wireup(),e}var r,n,a,o,l,d,h,v;return y()(t,e),f()(t,[{key:"reset",value:function(){return this.removeAllListeners(),this.wireup(),this.analytics&&this.analytics.wireup(),this._state.reset(),this.adapter.reset(),this}},{key:"destroy",value:function(){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}},{key:"stop",value:function(){this.adapter&&this.adapter.stop()}},{key:"wireup",value:function(){var e=this,t=function(){return e._state.toggleState(te.PLAYING,!0)};this.on(A.a.AD_PLAY_REQUESTED,t),this.on(A.a.AD_STARTED,t),this.on(A.a.AD_RESUMED,t);var r=function(){return e._state.toggleState(te.PLAYING,!1)};this.on(A.a.AD_BREAK_COMPLETED,r),this.on(A.a.AD_TEARDOWN,r),this.on(A.a.AD_PLAYBACK_ERROR,r),this.on(A.a.AD_REQUEST_ERROR,r),this.on(A.a.AD_PAUSED,r),this.on(A.a.AD_SKIPPED,r),this.on(A.a.AD_COMPLETED,r),this.on(A.a.AD_BREAK_COMPLETED,(function(){e._state.toggleState(te.BREAK_ACTIVE,!1)})),this.on(A.a.ADAPTER_INIT_FAILED,(function(){console.error("Adapter init failed"),r(),e._state.toggleState(te.FATAL_ERROR,!0)})),this.on(A.a.RELOAD_AD_REQUESTED,function(){var t=s()(i.a.mark((function t(n){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(ne("Ads.on(RELOAD_AD_REQUESTED)",n),r(),!n){t.next=4;break}return t.abrupt("return",e._schedule.reset(e._schedule.getAds()));case 4:e._state.hasAny(te.AD_AVAILABLE)&&(e._schedule.decrement(),e._state.toggleState(te.AD_AVAILABLE,!1));case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}())}},{key:"initialize",value:(v=s()(i.a.mark((function e(t){var r,n,a=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},n=a.length>2?a[2]:void 0,ne("Ads.initialize():",t,r,n),this._state.toggleState(te.INITIALIZING,!0),this.opts=Object.assign({},this.opts,r),Array.isArray(t)&&this.setSchedule(t),e.next=8,this.adapter.init(this.opts);case 8:if(this._macros=this._macros.fork(Object.assign({},r.parameters||{},{autoplay:r.autoplay,muted:r.muted})),!this.adapter.isReady()){e.next=12;break}return e.next=12,this.adapterInitialized(n);case 12:return e.abrupt("return",this);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"setVideoTag",value:(h=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ne("Ads.setVideoTag():",t),e.next=3,this.adapter.setVideoTag(t);case 3:if(this.trigger(A.a.AD_VIDEOTAG_ATTACHED,t),!this.adapter.isReady()){e.next=7;break}return e.next=7,this.adapterInitialized();case 7:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"waitForVideoTag",value:function(){var e=this;return new Promise((function(t){var r=e.adapter.videoTag;if(r)return t(r);e.on(A.a.AD_VIDEOTAG_ATTACHED,(function(r){e.once(A.a.AD_INIT,(function(){return t(r)}))}))}))}},{key:"adapterInitialized",value:(d=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ne("Ads.adapterInitialized()"),this._state.toggleState(te.INITIALIZING,!1),this._state.toggleState(te.BREAK_ACTIVE,this.hasPreroll()),e.next=5,this.setCurrentTime(0,t);case 5:this.checkIfBreakComplete(),t&&!this.opts.autoplay||this.trigger(A.a.AD_TEARDOWN);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"fetchNextAd",value:(l=s()(i.a.mark((function e(t){var r,n,a=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>1&&void 0!==a[1]?a[1]:0,this.adapter.isReady()){e.next=3;break}return e.abrupt("return");case 3:if(!(r>50)){e.next=7;break}throw this._state.toggleState(te.FATAL_ERROR,!0),this._state.toggleState(te.FETCHING_AD,!1),new Error("Ads.fetchNextAd() :max_recursion_depth");case 7:if(!(n=this._schedule.getNextAd()||this._schedule.getPostroll())||this.adapter.canDismissNonLinear()||-1===t){e.next=10;break}return e.abrupt("return",!1);case 10:if(!this._schedule.waitForLoad(t,n,this.opts.preload_ads)){e.next=13;break}return this._state.toggleState(te.FETCHING_AD,!1),e.abrupt("return",!1);case 13:if(n===this._schedule.getPostroll()&&this._schedule.setPostrollActive(),this._schedule.isDrained()||this._schedule.increment(),n){e.next=18;break}return this._state.toggleState(te.FETCHING_AD,!1),e.abrupt("return",!1);case 18:return ne("Ads.fetchNextAd",n),this._state.toggleState(te.FETCHING_AD,!0),e.prev=20,e.next=23,this.requestAd(n);case 23:return this._state.toggleState(te.AD_AVAILABLE,!0),this._state.toggleState(te.FETCHING_AD,!1),e.abrupt("return",this);case 28:if(e.prev=28,e.t0=e.catch(20),ne("Ads.fetchNextAd(err: %o, ad: %o)",e.t0,n),this.setLastAd(n),n===this._schedule.getPostroll()){e.next=36;break}return e.next=35,this.fetchNextAd(t,++r);case 35:return e.abrupt("return",e.sent);case 36:case"end":return e.stop()}}),e,this,[[20,28]])}))),function(e){return l.apply(this,arguments)})},{key:"skipAdsOnSeek",value:function(e){for(var t=this._schedule.getNextAd();t&&t.time<e;)this._schedule.increment(),t=this._schedule.getNextAd()}},{key:"setCurrentTime",value:(o=s()(i.a.mark((function e(t,r){var n,a,s=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=s.length>2&&void 0!==s[2]&&s[2],this._schedule){e.next=3;break}return e.abrupt("return");case 3:if(this.adapter.isReady()){e.next=5;break}return e.abrupt("return");case 5:if(!this._state.hasAny(te.FETCHING_AD)){e.next=7;break}return e.abrupt("return");case 7:if(!this._state.hasAny(te.PLAYING)||!this.adapter.adLinear){e.next=9;break}return e.abrupt("return");case 9:if(a=0===t&&0===this._schedule.getNextIndex(),e.prev=10,n&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(t),this._state.hasAny(te.AD_AVAILABLE)){e.next=15;break}return e.next=15,this.fetchNextAd(t);case 15:if(this._state.hasAny(te.AD_AVAILABLE)&&this.shallPlayAd(t)&&!r){e.next=17;break}return e.abrupt("return");case 17:return e.next=19,this.playAd();case 19:return e.next=21,this.setCurrentTime(t);case 21:this.checkIfBreakComplete(),e.next=27;break;case 24:e.prev=24,e.t0=e.catch(10),ne("setCurrentTime: Error(from: setCurrentTime, message: %s)",e.t0.message);case 27:return e.prev=27,a&&this.trigger(A.a.AD_PREROLL_FINSIHED),e.finish(27);case 30:case"end":return e.stop()}}),e,this,[[10,24,27,30]])}))),function(e,t){return o.apply(this,arguments)})},{key:"playAd",value:(a=s()(i.a.mark((function e(){var t;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._state.hasAny(te.AD_AVAILABLE)){e.next=2;break}return e.abrupt("return");case 2:return this._state.toggleState(te.AD_AVAILABLE,!1),this._state.toggleState(te.BREAK_ACTIVE,!0),e.prev=4,t=this._schedule.getCurrentAd(),e.next=8,this.adapter.playAd();case 8:t&&this.setLastAd(t),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),console.error("Ads.playAd: error",e.t0);case 14:case"end":return e.stop()}}),e,this,[[4,11]])}))),function(){return a.apply(this,arguments)})},{key:"checkIfBreakComplete",value:function(){if(!this._state.hasAny(te.BREAK_ACTIVE))return ne("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());ne("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(te.BREAK_ACTIVE,!1),this.adapter.isAdPod()||this.trigger(A.a.AD_BREAK_COMPLETED)}},{key:"resetScheduleCounter",value:function(){this._schedule&&this._schedule.resetCounter()}},{key:"setSchedule",value:function(e,t){if(!isNaN(t)&&this._schedule&&this._schedule.updateContentDuration(t),this._schedule&&this._schedule.getNextIndex()>0)return this._schedule.setAds(e);this._schedule=R.a.of(e,{preload_advance:this.opts.preload_advance,content_duration:isNaN(t)?0:t})}},{key:"toJSON",value:function(){return this._schedule?this._schedule.toJSON():[]}},{key:"trigger",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._state){if(e===A.a.AD_BREAK_COMPLETED&&this._state.hasAny(te.BREAK_ACTIVE)&&!this.adapter.isAdPod())return ne("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if($(t)&&(t=Object.assign({},this.adapter.opts||{},this._schedule.getCurrentAd()||{},{ad_type:this.ad_type},t)).ima_event&&"preroll"===t.ad_type&&(t.ad_type=this.ad_type),this.adapter.videoTag){var r=document.createEvent("Event");r.initEvent(e,!1,!1),r.data=t,this.adapter.videoTag.dispatchEvent(r)}U.EventEmitter.prototype.emit.apply(this,[e,t])}}},{key:"shouldRestartContent",value:function(){var e=this.getLastAd();return!e.outstream&&!1!==e.restart}},{key:"finished",value:(n=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ne("Ads.finished"),!(this.adapter.sharedVideoTag&&this._state.hasAny(te.PLAYING)&&this.adapter.adLinear)){e.next=3;break}return e.abrupt("return");case 3:if(ne("Ads.finished: trying to play postroll"),e.prev=4,this._schedule.getPostroll()){e.next=10;break}return ne("Ads.finished: no postroll found"),e.next=9,this.adapter.contentComplete();case 9:return e.abrupt("return",e.sent);case 10:if(this._state.hasAny(te.AD_AVAILABLE)){e.next=13;break}return e.next=13,this.fetchNextAd(-1);case 13:return e.next=15,this.playAd();case 15:this.adapter.contentComplete(),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(4),ne("Ads.finished: postroll failed:",e.t0);case 21:return e.prev=21,this.trigger(A.a.AD_POSTROLL_FINISHED),this.checkIfBreakComplete(),"function"==typeof t&&t(),e.finish(21);case 26:case"end":return e.stop()}}),e,this,[[4,18,21,26]])}))),function(e){return n.apply(this,arguments)})},{key:"hasPreroll",value:function(){return this._schedule&&R.a.hasPreroll(this._schedule.getAds())}},{key:"shallPlayAd",value:function(e){return(!this.adapter||!this.adapter.isAdPod())&&!(!this._state||this._state.hasAny(te.FATAL_ERROR))&&this._schedule.shallPlayAd(e)}},{key:"setLastAd",value:function(e){return this._lastAd=e,this}},{key:"getLastAd",value:function(){return this._lastAd||{}}},{key:"mergeMacros",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._macros=this._macros.fork(Object.assign({},e)),this}},{key:"pause",value:function(){this.adapter&&this.adapter.pause()}},{key:"resume",value:function(){this.adapter&&this.adapter.resume()}},{key:"resize",value:function(e){this.adapter&&this.adapter.resize(e)}},{key:"requestAd",value:(r=s()(i.a.mark((function e(t){var r,n,a,s,o,u=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:0,n=u.length>2&&void 0!==u[2]?u[2]:this.opts.timeout,this._state){e.next=4;break}return e.abrupt("return");case 4:return ne("Ads.requestAd(ad: %o)",{ad:t,timeout:n,idx:r}),e.next=7,X(t);case 7:if(void 0!==(a=e.sent)[r]){e.next=10;break}return e.abrupt("return",Promise.reject(new Error("Ad failed, no fallbacks left")));case 10:if(a[r]){e.next=14;break}return e.next=13,this.requestAd(a,r+1,n);case 13:return e.abrupt("return",e.sent);case 14:return this.trigger(A.a.AD_REQUESTED,t),s=this._macros.compile(a[r],q(this.opts,this.adapter.dimensions)),e.prev=16,e.next=19,this.adapter.initAd(s,n);case 19:return o=e.sent,e.abrupt("return",{ok:o});case 23:return e.prev=23,e.t0=e.catch(16),ne("Ads.requestAd(:fallback, idx: ".concat(r,", length: ").concat(a.length,", adTag: ").concat(a[r],")\nError "),{adTag:a,err:e.t0}),e.abrupt("return",this.requestAd(a,r+1,n));case 27:case"end":return e.stop()}}),e,this,[[16,23]])}))),function(e){return r.apply(this,arguments)})},{key:"resetSchedule",value:function(e){this._schedule&&this._schedule.reset(e)}},{key:"ad_type",get:function(){return this._schedule&&this._schedule.getCurrentType()}},{key:"paused",get:function(){return this.adapter&&this.adapter.paused}},{key:"adPlaying",get:function(){return this._state&&this._state.hasAny(te.PLAYING)}},{key:"adBreak",get:function(){return this._state&&this._state.hasAny(te.BREAK_ACTIVE)}}]),t}(U.EventEmitter)},function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(t,n)}e.exports=r},function(e,t,r){r(54),e.exports=r(10).Object.assign},function(e,t,r){var n=r(14);n(n.S+n.F,"Object",{assign:r(63)})},function(e,t,r){var n=r(56),i=r(57),a=r(59),s=Object.defineProperty;t.f=r(22)?Object.defineProperty:function(e,t,r){if(n(e),t=a(t,!0),n(r),i)try{return s(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},function(e,t,r){var n=r(15);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,r){e.exports=!r(22)&&!r(23)((function(){return 7!=Object.defineProperty(r(58)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,r){var n=r(15),i=r(13).document,a=n(i)&&n(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,r){var n=r(15);e.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,r){var n=r(13),i=r(21),a=r(32),s=r(24)("src"),o=Function.toString,u=(""+o).split("toString");r(10).inspectSource=function(e){return o.call(e)},(e.exports=function(e,t,r,o){var l="function"==typeof r;l&&(a(r,"name")||i(r,"name",t)),e[t]!==r&&(l&&(a(r,s)||i(r,s,e[t]?""+e[t]:u.join(String(t)))),e===n?e[t]=r:o?e[t]?e[t]=r:i(e,t,r):(delete e[t],i(e,t,r)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[s]||o.call(this)}))},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,r){var n=r(34),i=r(70),a=r(40),s=r(41),o=r(26),u=Object.assign;e.exports=!u||r(23)((function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=u({},e)[r]||Object.keys(u({},t)).join("")!=n}))?function(e,t){for(var r=s(e),u=arguments.length,l=1,c=i.f,d=a.f;u>l;)for(var f,h=o(arguments[l++]),p=c?n(h).concat(c(h)):n(h),v=p.length,g=0;v>g;)d.call(h,f=p[g++])&&(r[f]=h[f]);return r}:u},function(e,t,r){var n=r(32),i=r(25),a=r(65)(!1),s=r(67)("IE_PROTO");e.exports=function(e,t){var r,o=i(e),u=0,l=[];for(r in o)r!=s&&n(o,r)&&l.push(r);for(;t.length>u;)n(o,r=t[u++])&&(~a(l,r)||l.push(r));return l}},function(e,t,r){var n=r(25),i=r(37),a=r(66);e.exports=function(e){return function(t,r,s){var o,u=n(t),l=i(u.length),c=a(s,l);if(e&&r!=r){for(;l>c;)if((o=u[c++])!=o)return!0}else for(;l>c;c++)if((e||c in u)&&u[c]===r)return e||c||0;return!e&&-1}}},function(e,t,r){var n=r(38),i=Math.max,a=Math.min;e.exports=function(e,t){return(e=n(e))<0?i(e+t,0):a(e,t)}},function(e,t,r){var n=r(39)("keys"),i=r(24);e.exports=function(e){return n[e]||(n[e]=i(e))}},function(e,t){e.exports=!1},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,r){r(72),e.exports=r(10).Object.values},function(e,t,r){var n=r(14),i=r(42)(!1);n(n.S,"Object",{values:function(e){return i(e)}})},function(e,t,r){r(74),e.exports=r(10).Object.entries},function(e,t,r){var n=r(14),i=r(42)(!0);n(n.S,"Object",{entries:function(e){return i(e)}})},function(e,t,r){r(76),e.exports=r(10).Array.find},function(e,t,r){var n=r(14),i=r(77)(5),a=!0;"find"in[]&&Array(1).find((function(){a=!1})),n(n.P+n.F*a,"Array",{find:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),r(81)("find")},function(e,t,r){var n=r(33),i=r(26),a=r(41),s=r(37),o=r(78);e.exports=function(e,t){var r=1==e,u=2==e,l=3==e,c=4==e,d=6==e,f=5==e||d,h=t||o;return function(t,o,p){for(var v,g,m=a(t),y=i(m),E=n(o,p,3),_=s(y.length),T=0,b=r?h(t,_):u?h(t,0):void 0;_>T;T++)if((f||T in y)&&(g=E(v=y[T],T,m),e))if(r)b[T]=g;else if(g)switch(e){case 3:return!0;case 5:return v;case 6:return T;case 2:b.push(v)}else if(c)return!1;return d?-1:l||c?c:b}}},function(e,t,r){var n=r(79);e.exports=function(e,t){return new(n(e))(t)}},function(e,t,r){var n=r(15),i=r(80),a=r(43)("species");e.exports=function(e){var t;return i(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!i(t.prototype)||(t=void 0),n(t)&&null===(t=t[a])&&(t=void 0)),void 0===t?Array:t}},function(e,t,r){var n=r(35);e.exports=Array.isArray||function(e){return"Array"==n(e)}},function(e,t,r){var n=r(43)("unscopables"),i=Array.prototype;null==i[n]&&r(21)(i,n,{}),e.exports=function(e){i[n][e]=!0}},function(e,t,r){var n=function(){return this||"object"==typeof self&&self}()||Function("return this")(),i=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,a=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,e.exports=r(83),i)n.regeneratorRuntime=a;else try{delete n.regeneratorRuntime}catch(e){n.regeneratorRuntime=void 0}},function(e,t){!function(t){var r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag",u="object"==typeof e,l=t.regeneratorRuntime;if(l)u&&(e.exports=l);else{(l=t.regeneratorRuntime=u?e.exports:{}).wrap=v;var c={},d={};d[a]=function(){return this};var f=Object.getPrototypeOf,h=f&&f(f(k([])));h&&h!==r&&n.call(h,a)&&(d=h);var p=E.prototype=m.prototype=Object.create(d);y.prototype=p.constructor=E,E.constructor=y,E[o]=y.displayName="GeneratorFunction",l.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,o in e||(e[o]="GeneratorFunction")),e.prototype=Object.create(p),e},l.awrap=function(e){return{__await:e}},_(T.prototype),T.prototype[s]=function(){return this},l.AsyncIterator=T,l.async=function(e,t,r,n){var i=new T(v(e,t,r,n));return l.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(p),p[o]="Generator",p[a]=function(){return this},p.toString=function(){return"[object Generator]"},l.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},l.values=k,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(o&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:k(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}}}function v(e,t,r,n){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),s=new L(n||[]);return a._invoke=function(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var o=b(s,r);if(o){if(o===c)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=g(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,s),a}function g(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function m(){}function y(){}function E(){}function _(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function T(e){var t;this._invoke=function(r,i){function a(){return new Promise((function(t,a){!function t(r,i,a,s){var o=g(e[r],e,i);if("throw"!==o.type){var u=o.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then((function(e){t("next",e,a,s)}),(function(e){t("throw",e,a,s)})):Promise.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return t("throw",e,a,s)}))}s(o.arg)}(r,i,t,a)}))}return t=t?t.then(a,a):a()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=g(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,c;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function k(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}}(function(){return this||"object"==typeof self&&self}()||Function("return this")())},function(e,t,r){var n=r(8);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=n(e)););return e}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw a}}return r}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t,r){var n=r(44),i=r(45),a={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},s=Date.prototype.toISOString,o={delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,serializeDate:function(e){return s.call(e)},skipNulls:!1,strictNullHandling:!1},u=function e(t,r,i,a,s,u,l,c,d,f,h,p){var v=t;if("function"==typeof l)v=l(r,v);else if(v instanceof Date)v=f(v);else if(null===v){if(a)return u&&!p?u(r,o.encoder):r;v=""}if("string"==typeof v||"number"==typeof v||"boolean"==typeof v||n.isBuffer(v))return u?[h(p?r:u(r,o.encoder))+"="+h(u(v,o.encoder))]:[h(r)+"="+h(String(v))];var g,m=[];if(void 0===v)return m;if(Array.isArray(l))g=l;else{var y=Object.keys(v);g=c?y.sort(c):y}for(var E=0;E<g.length;++E){var _=g[E];s&&null===v[_]||(m=Array.isArray(v)?m.concat(e(v[_],i(r,_),i,a,s,u,l,c,d,f,h,p)):m.concat(e(v[_],r+(d?"."+_:"["+_+"]"),i,a,s,u,l,c,d,f,h,p)))}return m};e.exports=function(e,t){var r=e,s=t?n.assign({},t):{};if(null!==s.encoder&&void 0!==s.encoder&&"function"!=typeof s.encoder)throw new TypeError("Encoder has to be a function.");var l=void 0===s.delimiter?o.delimiter:s.delimiter,c="boolean"==typeof s.strictNullHandling?s.strictNullHandling:o.strictNullHandling,d="boolean"==typeof s.skipNulls?s.skipNulls:o.skipNulls,f="boolean"==typeof s.encode?s.encode:o.encode,h="function"==typeof s.encoder?s.encoder:o.encoder,p="function"==typeof s.sort?s.sort:null,v=void 0!==s.allowDots&&s.allowDots,g="function"==typeof s.serializeDate?s.serializeDate:o.serializeDate,m="boolean"==typeof s.encodeValuesOnly?s.encodeValuesOnly:o.encodeValuesOnly;if(void 0===s.format)s.format=i.default;else if(!Object.prototype.hasOwnProperty.call(i.formatters,s.format))throw new TypeError("Unknown format option provided.");var y,E,_=i.formatters[s.format];"function"==typeof s.filter?r=(E=s.filter)("",r):Array.isArray(s.filter)&&(y=E=s.filter);var T,b=[];if("object"!=typeof r||null===r)return"";T=s.arrayFormat in a?s.arrayFormat:"indices"in s?s.indices?"indices":"repeat":"indices";var A=a[T];y||(y=Object.keys(r)),p&&y.sort(p);for(var S=0;S<y.length;++S){var L=y[S];d&&null===r[L]||(b=b.concat(u(r[L],L,A,c,d,f?h:null,E,p,v,g,_,m)))}var k=b.join(l),w=!0===s.addQueryPrefix?"?":"";return k.length>0?w+k:""}},function(e,t,r){var n=r(44),i=Object.prototype.hasOwnProperty,a={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:n.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},s=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/g,s=/(\[[^[\]]*])/.exec(n),o=s?n.slice(0,s.index):n,u=[];if(o){if(!r.plainObjects&&i.call(Object.prototype,o)&&!r.allowPrototypes)return;u.push(o)}for(var l=0;null!==(s=a.exec(n))&&l<r.depth;){if(l+=1,!r.plainObjects&&i.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(s[1])}return s&&u.push("["+n.slice(s.index)+"]"),function(e,t,r){for(var n=t,i=e.length-1;i>=0;--i){var a,s=e[i];if("[]"===s)a=(a=[]).concat(n);else{a=r.plainObjects?Object.create(null):{};var o="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,u=parseInt(o,10);!isNaN(u)&&s!==o&&String(u)===o&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(a=[])[u]=n:a[o]=n}n=a}return n}(u,t,r)}};e.exports=function(e,t){var r=t?n.assign({},t):{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.ignoreQueryPrefix=!0===r.ignoreQueryPrefix,r.delimiter="string"==typeof r.delimiter||n.isRegExp(r.delimiter)?r.delimiter:a.delimiter,r.depth="number"==typeof r.depth?r.depth:a.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:a.arrayLimit,r.parseArrays=!1!==r.parseArrays,r.decoder="function"==typeof r.decoder?r.decoder:a.decoder,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:a.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:a.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:a.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:a.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:a.strictNullHandling,""===e||null==e)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof e?function(e,t){for(var r={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=n.split(t.delimiter,s),u=0;u<o.length;++u){var l,c,d=o[u],f=d.indexOf("]="),h=-1===f?d.indexOf("="):f+1;-1===h?(l=t.decoder(d,a.decoder),c=t.strictNullHandling?null:""):(l=t.decoder(d.slice(0,h),a.decoder),c=t.decoder(d.slice(h+1),a.decoder)),i.call(r,l)?r[l]=[].concat(r[l]).concat(c):r[l]=c}return r}(e,r):e,u=r.plainObjects?Object.create(null):{},l=Object.keys(o),c=0;c<l.length;++c){var d=l[c],f=s(d,o[d],r);u=n.merge(u,f,r)}return n.compact(u)}},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t,r){var n=r(96);e.exports=function(e,t){if(null==e)return{};var r,i,a=n(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)r=s[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}},function(e,t,r){var n=r(52);function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function a(t,r,s){return i()?e.exports=a=Reflect.construct:e.exports=a=function(e,t,r){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return r&&n(a,r.prototype),a},a.apply(null,arguments)}e.exports=a},function(e,t,r){r.r(t),r.d(t,"default",(function(){return oe}));var n={};r.r(n),r.d(n,"STICKY_CONTROLS",(function(){return T})),r.d(n,"NO_FULLSCREEN",(function(){return b})),r.d(n,"NO_AD_INDICATOR",(function(){return A})),r.d(n,"AD_ATTRIBUTION",(function(){return S})),r.d(n,"AD_CHOICES",(function(){return L})),r.d(n,"REMAINING_TIME",(function(){return k})),r.d(n,"VOLUME_BAR",(function(){return w}));var i=r(5),a=r.n(i),s=r(6),o=r.n(s),u=r(93),l=r.n(u),c=r(1),d=r.n(c),f=r(2),h=r.n(f),p=r(4),v=r.n(p),g=r(3),m=r.n(g),y=r(94),E=r.n(y),_=(r(97),r(99),r(101),r(103),r(0)),T=1,b=2,A=4,S=8,L=16,k=32,w=64;function D(e){var t=window.getComputedStyle(e);return"0"!==t.width&&"0"!==t.height&&"0"!==t.opacity&&"none"!==t.display&&"hidden"!==t.visibility}var R=function(){};function O(e,t,r){for(var n=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);n.length;){if(null==e)return r;var i=n.shift();if("string"!=typeof i)return r;e=e[i]}return null==e?r:e}var C="undefined"!=typeof document&&"undefined"!=typeof window&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,I="function"==typeof requestAnimationFrame?requestAnimationFrame:setTimeout,x=function(){var e,t=document.createElement("div");return(e=t.classList).add.apply(e,arguments),t},P=[].forEach,M=r(7)("fpads:native:ui"),N="is-ad-showing",F="is-ad-linear",U="is-ad-nonlinear",B="ad-playing",j="no-fullscreen",G="ad-hide-first-frame",H=function(){function e(t){var r,n,i,a,s=this,o=t.root,u=t.content,l=t.config,c=t.initial,d=t.ads;v()(this,e),Object.assign(this,{root:o,content:u,initial:c,ads:d,config:l}),this.progress={percent:0},this.animation=(r=function(e){if(s.halt_animation())return s.animation.running=!1;s.set_progress_bar(Math.round(s.progress.percent)),requestAnimationFrame(s.animation)},n=Math.ceil(1e3/60),i=0,a=null,function(){var e=Date.now()-i;null===a&&(a=I((function(){a=null,r.apply(this,arguments),i=Date.now()}),n-e))}),d.ui=this,this.render().wireup(),u.on("reap",(function(e){return s.destroy()}))}return m()(e,null,[{key:"of",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E()(e,r)}},{key:"as_progress",value:function(e){var t=e.remaining,r=e.duration;return{percent:Math.min(100,Math.max(0,(r-t)/r*100))}}},{key:"clone",value:function(e,t,r){var n=t.querySelector(r);if(n){var i=n.cloneNode(!0);return e.append(i),i}}}]),m()(e,[{key:"halt_animation",value:function(){return!this.progress_bar||0==this.content.reaper||!this.wrapper||!this.wrapper.classList.contains(B)}},{key:"animate",value:function(){this.animation.running||function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];e.apply(void 0,r)}(this.animation)}},{key:"resize",value:function(e){if(e.linear)return this.toggle(a()({on:!0},e));M("UI.resize(): ",e),this.adContainer.style.width=e.width+"px",this.wrapper.style.height=e.height+"px";var t=this.root.querySelector(".fp-controls"),r=t?e.height+t.clientHeight:e.height;this.wrapper.style.marginTop="-".concat(r,"px")}},{key:"set_progress_bar",value:function(e){this.progress_bar&&(this.progress_bar.style.width="".concat(e,"%"))}},{key:"reset_styles",value:function(){var e=this;this.progress.percent=0,"height width marginLeft marginTop".split(" ").forEach((function(t){e.wrapper.style[t]="",e.adContainer.style[t]=""}));try{window.emit("resize")}catch(e){}}},{key:"reset",value:function(){return this.wrapper.className="fp-ad-container",this.reset_styles(),this.progress={percent:0},this}},{key:"isShowing",value:function(){return this.root.classList.contains(N)}},{key:"hideFirstFrame",value:function(){return this.root.classList.toggle(G,!0),this}},{key:"showFirstFrame",value:function(){return this.root.classList.toggle(G,!1),this}},{key:"toggle",value:function(e){var t=e.on,r=e.linear;if(this.root)return M("UI.toggle(): ",arguments[0]),this.showFirstFrame(),t||this.reset(),r&&this.reset_styles(),this.root.classList.toggle(N,t),this.root.classList.toggle(F,t&&r),this.root.classList.toggle(U,t&&!r),this}},{key:"addClass",value:function(){var e;this.wrapper&&(e=this.wrapper.classList).add.apply(e,arguments)}},{key:"removeClass",value:function(){var e;this.wrapper&&(e=this.wrapper.classList).remove.apply(e,arguments)}},{key:"render",value:function(){var t=this,r=document.createDocumentFragment(),n=this,i=O(this,"config.ima.flags",O(this,"config.ima.ui",0));return this.wrapper=x("fp-ad-container"),this.ad_wrapper=x("fp-ad-wrapper"),this.adContainer=x("fp-ad"),this.controls=x("fp-ad-controls"),this.progress_wrapper=x("fp-ad-progress-wrapper"),this.progress_bar=x("fp-ad-progress","fp-color"),this.waiting=e.clone(this.wrapper,this.root,".fp-wait"),this.play_btn=e.clone(this.controls,this.root,".fp-btns.fp-small-switch"),this.volume_btn=e.clone(this.controls,this.root,".fp-volumebtn"),this.volume_bar=e.clone(this.controls,this.root,".fp-volume"),this.fs_btn=e.clone(this.controls,this.root,".fp-secondary"),w&i&&(this.root.classList.toggle("ad-volume-bar"),function(e,t){var r,n,i;if("grabbing"in e)return e;e.grabbing=!1,e.touching=!1;var a=t.onseek||R,s=t.onstart||R,o=t.onend||R,u=t.onmouse||R,l=t.ontouch||R,c=t.ontouchend||R,d=t.ctx;function f(t){r=e.offset().left,n=e.clientWidth;var i=(function(e){return"function"==typeof window.TouchEvent&&e instanceof TouchEvent}(t)?t.changedTouches[0].pageX:t.pageX)-r;return i>n&&(i=n),i<0&&(i=0),Math.round(i/n*100)}function h(t){var r=f(t);r!=i&&(a.call(d,r,e),i=r)}function p(e){if(e){var t="";return Array.prototype.forEach.call(e.classList,(function(e){t="."+e})),t}}e.addEventListener("touchstart",(function(t){t.target.closest(p(e))&&(e.touching=!0,D(e.parentElement)&&(t.preventDefault(),e.grabbing=!0,l(d,e),s(d,e),h(t)))})),e.addEventListener("touchmove",(function(t){t.target.closest(p(e))&&D(e.parentElement)&&e.touching&&(t.preventDefault(),h(t),u.call(d,f(t),e))})),e.addEventListener("touchend",(function(t){setTimeout((function(){e.touching=!1,console.debug("Touching to false")}),500),t.target.closest(p(e))&&D(e.parentElement)&&(t.preventDefault(),e.grabbing=!1,c(d,e),o(d,e),n=0)})),e.addEventListener("touchcancel",(function(){e.touching=!1,e.grabbing=!1,n=0})),e.addEventListener("mousedown",(function(t){e.touching||(document.addEventListener("mousemove",h),e.grabbing=!0,s.call(d,e),t.preventDefault(),h(t))})),e.addEventListener("mousemove",(function(t){e.touching||u.call(d,f(t),e)})),document.addEventListener("mouseup",(function(){e.touching||(document.removeEventListener("mousemove",h),e.grabbing=!1,o.call(d,e),n=0)}))}(this.volume_bar,{onseek:function(e){return t.maybe_adapter((function(t){return t.volume(e/100)}))}})),this.fs_btn&&(this.fs_btn.classList.remove("fp-togglable"),P.call(this.fs_btn.childNodes,(function(e){"svg"==e.tagName.toLowerCase()||e.remove()}))),this.root.classList.toggle("is-ad-controls-sticky",T&i),this.root.classList.toggle("is-ad-attribution",S&i),this.root.classList.toggle(j,b&i),C&&this.content.once([_.a.AD_BREAK_COMPLETED,_.a.AD_REQUEST_ERROR,_.a.AD_STARTED],(function(e){t.root.classList.toggle(j,b&i||e.type===_.a.AD_STARTED)})),!O(this,"config.ima.indicator",!0)||A&i||(this.indicator=x("ad-indicator"),this.controls.prepend(this.indicator),this.indicator.classList.add("fp-color-text")),k&i&&(this.remaining=x("fp-ad-remaining"),this.remaining.classList.add("fp-color-text"),this.controls.prepend(this.remaining)),L&i&&(this.root.classList.toggle("is-ad-choices",!0),this.ad_choices=x("fp-ad-choices"),this.ad_choices.textContext="AdChoices",this.ad_choices.addEventListener("click",(function(e){e.preventDefault(),n.ads.pause(),window.open("https://adssettings.google.com","_blank")}))),this.ad_wrapper.append(this.adContainer),this.progress_wrapper.append(this.progress_bar),r.appendChild(this.wrapper),this.wrapper.append(this.ad_wrapper,this.controls,this.progress_wrapper),this.ad_choices&&this.wrapper.appendChild(this.ad_choices),this.content.renderPlugin(r),this}},{key:"ad_loading",value:function(e){M("ad_loading",e),this.wrapper&&this.wrapper.classList.toggle("is-waiting",e)}},{key:"update_time_remaining",value:function(e){this.remaining&&(this.remaining.textContent=function(e){var t,r=Math.floor(e/60);return r+":"+(t=e-=60*r,(t=parseInt(t,10))>=10?t:"0"+t)}(e))}},{key:"update_ad_indicator",value:function(){if(this.indicator){var e=this.maybe_adapter((function(e){return e.getAdPodInfo()}));if(e){M("IMA -> ",e);var t=this.content.i18n("ads.indicator","ADS");this.indicator.textContent="".concat(t," ").concat(e.getAdPosition()," / ").concat(e.getTotalAds())}}}},{key:"wireup",value:function(){var t=this;this.ads.on(_.a.AD_REQUESTED,(function(e){t.ad_loading(!0)})),this.ads.on(_.a.AD_VOLUME_CHANGED,(function(e){M("Event(%s, level: %o)",_.a.AD_VOLUME_CHANGED,e),t.content.muted||(t.content.volume=e),t.adjust_volume_slider(e)})),this.ads.on(_.a.AD_STARTED,(function(e){t.playback_changed(!0),t.update_ad_indicator()})),this.ads.on(_.a.AD_COMPLETED,(function(e){t.set_progress_bar(0)})),this.ads.on(_.a.AD_PAUSED,(function(e){return t.playback_changed(!1)})),this.ads.on(_.a.AD_RESUMED,(function(e){return t.playback_changed(!0)})),this.ads.on(_.a.AD_PROGRESS,(function(r){t.update_time_remaining(r.remaining,r.duration),t.progress=e.as_progress(r)})),this.play_btn&&["click","touchend"].forEach((function(e){return t.play_btn.addEventListener(e,(function(e){return"touchend"==e.type&&e.preventDefault(),t.ads.paused?t.ads.resume():t.ads.pause()}))})),this.fs_btn&&this.fs_btn.addEventListener("click",(function(e){t.content.toggleFullScreen()})),this.volume_btn&&this.volume_btn.addEventListener("click",(function(){return t.maybe_adapter((function(e){t.content.muted=e.volume()>0,e.volume(t.content.muted?0:0==t.content.volume?.1:t.content.volume)}))}))}},{key:"adjust_volume_slider",value:function(e){if(this.volume_bar){var t=[].slice.call(this.volume_bar.querySelectorAll(".fp-tick")),r=Math.round(e*t.length);this.volume_bar.setAttribute("aria-valuenow",e),t.slice(r).forEach((function(e){return e.classList.remove("fp-color")})),t.slice(0,r).forEach((function(e){return e.classList.add("fp-color")}))}}},{key:"playback_changed",value:function(e){this.ad_loading(!1),e&&this.animate(),this.wrapper.classList.toggle(B,e),this.wrapper.classList.toggle("ad-paused",!e),this.wrapper.classList.toggle("ad-ui-disabled",this.maybe_adapter((function(e){return e.isUiDisabled()})))}},{key:"maybe_adapter",value:function(e){return this.ads&&this.ads.adapter?e(this.ads.adapter):0}},{key:"destroy",value:function(){this.ads.ui=this.root=this.content=this.config=this.wrapper=this.adContainer=0}},{key:"classList",get:function(){return this.wrapper.classList}}]),e}();function K(e){return{width:e.clientWidth,height:e.clientHeight}}function V(e,t,r){return"number"==typeof r&&(r+="px"),e.style.setProperty(t,r),e}r(7)("fpads:dom");var W=r(7)("fpads:plugin:native"),q={on:!0},Y={on:!1},z=[_.a.AD_PLAYBACK_ERROR,_.a.AD_TEARDOWN,_.a.AD_BREAK_COMPLETED],X=function(){function e(){v()(this,e)}var t,r,n,i;return m()(e,null,[{key:"user_gesture",value:function(){return flowplayer.events.BEFORE_PLAY}},{key:"snapshot",value:function(e,t){return{muted:!(t||!e.muted),volume:e.volume}}},{key:"start_from_user_gesture",value:function(t){var r=t.content,n=t.ads,i=t.config,a=t.ui,s=t.state,o=t.initial,u=t.adContainer,l=t.ima,c=e.user_gesture();r.once(c,function(){var t=h()(d.a.mark((function t(c){return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r.in_viewport||"touchend"!=c.type){t.next=2;break}return t.abrupt("return");case 2:if(n.shallPlayAd(0)){t.next=4;break}return t.abrupt("return");case 4:return!C&&c.preventDefault(),e.add_time_listeners({ads:n,content:r,ui:a,state:s}),W("LifeCycle.user_gesture(:intercept) -> shallPlayAd(0: %s)",n.shallPlayAd(0)),i.muted=o.muted,t.next=10,e.start({ads:n,content:r,state:s,adContainer:u,ima:l,config:i});case 10:e.update_time({ads:n,content:r,ui:a});case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}())}},{key:"init",value:(i=h()(d.a.mark((function t(r){var n,i,a,s,o,u,l,c,f,h,p,v;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r.config,i=r.root,a=r.content,s=r.ads,o=r.ima,a.autoplay=!1,u=n.autoplay===(flowplayer.autoplay||flowplayer.autoplay_options).AUDIO_REQUIRED,l=e.snapshot(a,u),c=flowplayer,f=c.events,a.on(f.VOLUME_CHANGE,(function(){l.volume=a.volume,l.muted=a.muted})),h=H.of({ads:s,content:a,config:n,initial:l,root:a.root}),p=h.adContainer,v={listening:!1,preload:O(n,"ima.preload_ads",!1)},W("LifeCycle.initial()",{initial:l}),s.setVideoTag(a),!n.autoplay){t.next=18;break}return W("Trying to autoplay"),h.hideFirstFrame(),t.next=16,e.peek_content(a,u);case 16:t.sent?(W("Can autoplay, start ad"),a.opts.autoplay=!0,e.start({ads:s,content:a,state:v,adContainer:p,ima:o,config:n})):(W("cannot autoplay(audioRequired: %s), fallback to poster state",u),n.autoplay=!1,h.showFirstFrame(),a.setState("is-starting",!0));case 18:n.autoplay||s.hasPreroll()&&e.start_from_user_gesture({content:a,ads:s,config:n,ui:h,state:v,initial:l,adContainer:p,ima:o}),!n.autoplay&&s.hasPreroll()&&v.preload&&e.start({ads:s,content:a,state:v,adContainer:p,ima:o,config:n}),e.ui_listeners({config:n,root:i,content:a,ads:s,state:v,adContainer:p,ui:h,ima:o,initial:l}),a.on(f.SOURCE,(function(){a.once(f.BEFORE_PLAY,(function(){return s.resetScheduleCounter()}))}));case 22:case"end":return t.stop()}}),t,this)}))),function(e){return i.apply(this,arguments)})},{key:"start",value:(n=h()(d.a.mark((function e(t){var r,n,i,s,o,u,c,f,h,p,v;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ads,n=t.content,i=t.adContainer,s=t.ima,o=t.state,u=t.config,c=void 0===u?{}:u,!o.started){e.next=3;break}return e.abrupt("return");case 3:return o.started=!0,s.ads,f=l()(s,["ads"]),h=c.dimensions||K(n.root),p=O(c,"muted",n.muted),v=Object.assign(a()({container:i,volume:p?0:O(c,"volume",n.volume),muted:p,autoplay:O(c,"autoplay",!1),video_source:n.original_src,DisableCustomPlaybackForIOS10Plus:O(c,"fake_fullscreen",C),preload_ads:O(c,"ima.preload_ads",!1)},f,h)),W("LifeCycle.start():",v,o),e.next=11,r.initialize(!1,v,o.preload);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"ui_listeners",value:function(t){var r=t.config,n=t.root,i=t.content,s=t.ads,o=t.initial,u=t.adContainer,l=t.state,c=t.ui,f=t.ima;W("LifeCycle.ui_listeners()");var p=flowplayer,v=p.events,g=p.states;i.once(v.PLAYING,function(){var t=h()(d.a.mark((function t(o){return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s){t.next=2;break}return t.abrupt("return");case 2:if(W("LifeCycle.ui_listeners() -> content started playing"),e.add_time_listeners({ads:s,content:i,ui:c,state:l}),s.shallPlayAd(0)&&s.adapter.adLinear){t.next=9;break}return W("LifeCycle.ui_listeners() -> no more preroll ads -> resume content"),t.next=8,e.start({ads:s,content:i,state:l,adContainer:u,ima:f,config:r});case 8:return t.abrupt("return",t.sent);case 9:return i.pause(),t.next=12,e.start({ads:s,content:i,state:l,adContainer:u,ima:f,config:r});case 12:if(s.shallPlayAd(0)&&s.adapter.adLinear){t.next=14;break}return t.abrupt("return");case 14:c.toggle(a()({},q,{linear:!0})),n.classList.add(g.WAITING),e.update_time({ads:s,content:i,ui:c});case 17:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()),i.on([v.PORTRAIT,v.LANDSCAPE,v.RESIZE],(function(){if(s){var e=i.clientWidth||i.parentNode.clientWidth||n.clientWidth,t=i.clientHeight||i.parentNode.clientHeight||n.clientHeight;s.resize({height:t,width:e})}})),i.on(v.ENDED,(function(e){s&&(W("LifeCycle.ui_listeners(:%s, event: %o)",e.type,e.data),e.data&&e.data.from===s||(e.preventDefault(),s.finished((function(){i.emit(v.ENDED,{from:s})}))))})),s.on(_.a.AD_REQUESTED,(function(){n.classList.toggle(g.WAITING,!0)})),s.once(_.a.AD_STARTED,(function(){var e=flowplayer.events;i.on([e.BEFORE_PLAY,e.BEFORE_PAUSE],(function(t){if(s.adBreak&&s.adapter.adLinear){t.preventDefault();var r=O(t,"data.forced",!1)?t.type===e.BEFORE_PLAY:!s.adPlaying;r&&s.paused&&s.resume(),r||s.paused||s.pause()}}))})),s.on(_.a.AD_STARTED,(function(e){var t=e.linear,r=e.ad,u=e.ad_type;if(W("Ad[linear: ".concat(t,", currentTime: ").concat(i.currentTime,"] starting"),r),"preroll"==u&&!t&&i.paused&&i.play(),"preroll"==u&&t&&i.currentTime>0&&!i.opt("start_time")&&!i.opt("live")&&(W("Preroll[rewind: true]",i.currentTime),i.currentTime=0),s.resize({width:r.width,height:r.height,linear:t,resize_non_linear:!0}),c.resize({linear:t,resizeContainerAlso:!0,width:t?void 0:r.width,height:t?void 0:r.height}),n.classList.remove(g.WAITING),c.toggle(a()({},q,{linear:t,ad:r})),!t)try{i.togglePlay(!0),i.volume=o.volume,i.muted=o.muted}catch(e){W(e)}})),s.on(_.a.AD_PAUSE_CONTENT,(function(){c.resize({linear:!0,resizeContainerAlso:!0,width:void 0,height:void 0})})),z.forEach((function(t){return s.on(t,(function(r){return e.teardown({root:n,content:i,ui:c,initial:o,err:r,event:t})}))}))}},{key:"add_time_listeners",value:function(t){var r=t.ads,n=t.content,i=t.ui,a=t.state,s=flowplayer.events;a.listening||(n.on([s.TIME_UPDATE,s.SEEKED,s.PLAYING,s.SEEKING],(function(t){r&&(r.adPlaying&&r.adapter.adLinear&&!r.adapter.sharedVideoTag&&!n.paused&&n.pause(),e.update_time({ads:r,content:n,ui:i,seek:t.type===s.SEEKING}))})),a.listening=!0)}},{key:"update_time",value:function(e){var t=e.ads,r=e.content,n=e.seek,i=void 0!==n&&n;t&&t.setCurrentTime(r.currentTime,void 0,i)}},{key:"teardown",value:(r=h()(d.a.mark((function t(r){var n,i,a,s,o,u,l,c,f,h;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r.root,i=r.content,a=r.ui,s=r.event,o=r.err,u=void 0===o?{}:o,a.isShowing()||i.paused){t.next=3;break}return t.abrupt("return",{noop:1});case 3:if(l=flowplayer,c=l.states,n.classList.add("is-seamless"),a.classList.remove("is-vpaid"),n.classList.remove(c.WAITING),W("LifeCycle.teardown(event: %s)",s),u.reason&&W("LifeCycle.teardown(:err, reason: %s) %o",u.reason),a.toggle(Y),f=i.ads,h=f.getLastAd(),f.shouldRestartContent()){t.next=15;break}return W("Lifecycle.teardown(:skip_restart, reason: %s)","Ad prevented restarting content"),t.abrupt("return",e.on_content_playing(n));case 15:if(!(i.currentTime>0&&i.currentTime>=i.duration||"postroll"==f.ad_type||!1===h.restart)){t.next=18;break}return W("Lifecycle.teardown(:skip_restart, reason: %s)","was a postroll ad"),t.abrupt("return",e.on_content_playing(n));case 18:if(""===i.currentSrc&&i.setSrc(i.original_src),!i.paused||!f.shouldRestartContent()){t.next=23;break}return W("Lifecycle.teardown(:toggle_play, %s)","attempting to restart content"),t.next=23,i.togglePlay(!0);case 23:if(i.paused){t.next=26;break}return W("Lifecycle.teardown(:ok)","restarted video content"),t.abrupt("return",e.on_content_playing(n));case 26:case"end":return t.stop()}}),t,this)}))),function(e){return r.apply(this,arguments)})},{key:"on_content_playing",value:function(e){e.classList.remove("is-seamless")}},{key:"maybe_blocked",value:function(e){W("google.ima not found in window"),[].slice.call(document.getElementsByTagName("script")).filter((function(e){return t=e.src,(r=document.createElement("a")).href=t,"imasdk.googleapis.com/js/sdkloader/ima3.js"=="".concat(r.host).concat(r.pathname);var t,r})).length>0&&e.emit(_.a.AD_BLOCKED)}},{key:"peek_content",value:(t=h()(d.a.mark((function t(r,n){var i,a,s,o,u,l;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=[r.muted,r.volume],W("LifeCycle::peek_content(:muted => %s, :volume => %s)",a=i[0],s=i[1]),o=function(){return new Promise((function(e){return setTimeout(e,0,!1)}))},u=function(){return new Promise((function(e){return setTimeout((function(){return e(r.play())}))}))},l=function(){return new Promise((function(e){return setTimeout((function(){return e(r.pause())}))}))},n&&(r.muted=!1,r.volume=r.volume?r.volume:1),t.prev=6,t.next=9,e.wait_for_source(r);case 9:return r.volume&&(r.volume=.01),W("LifeCycle::peek_content::play"),t.next=13,u();case 13:return W("LifeCycle::peek_content::pause"),t.next=16,l();case 16:return r.volume=s,W("LifeCycle::peek_content::true"),t.abrupt("return",!0);case 21:if(t.prev=21,t.t0=t.catch(6),r.volume=s,!n){t.next=30;break}return r.muted=!1,0==r.volume&&(r.volume=1),t.next=29,o();case 29:return t.abrupt("return",t.sent);case 30:if(!a&&s){t.next=35;break}return W("LifeCycle::peek_content::false"),t.next=34,o();case 34:return t.abrupt("return",t.sent);case 35:return W("LifeCycle::peek_content::recover"),r.muted=!0,t.next=39,e.peek_content(r);case 39:if(!t.sent){t.next=41;break}return t.abrupt("return",!0);case 41:return r.muted=a,W("LifeCycle::peek_content::false"),t.next=45,o();case 45:return t.abrupt("return",t.sent);case 46:case"end":return t.stop()}}),t,this,[[6,21]])}))),function(e,r){return t.apply(this,arguments)})},{key:"wait_for_source",value:function(e){return W("LifeCycle::wait_for_source"),new Promise((function(t,r){var n=0,i=setInterval((function(){if(++n>40)return clearInterval(i),r(new Error("No source in ".concat(2e3,"ms, giving up")));e.currentSrc&&(t(),clearInterval(i))}),50)}))}}]),e}();X.TERMINAL_EVENTS=z;var Q=r(51),J=r(20),Z="function"==typeof requestAnimationFrame?requestAnimationFrame:setTimeout;function $(e){var t=0,r=null;return function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var s=Date.now()-t;null===r&&(r=Z((function(){r=null,e.apply(void 0,i),t=Date.now()}),16-s))}}r(105);var ee=r(31),te=r(46),re=r(50),ne=r(7)("fpads:native:outstream"),ie={OUTSTREAM_VISIBLE:"ads-outstream-visible",OUTSTREAM_VIEWPORT_UPDATE:"ads-outstream-viewport-update",OUTSTREAM_TEARDOWN:"ads-outstream-teardown",OUTSTREAM_ENDSCREEN_READY:"ads-outstream-endscreen-ready"},ae=function(){function e(t){var r=this,n=t.ads,i=t.container,a=t.video,s=t.ima;v()(this,e),n.outstream=this,this.video=a,this.ads=n,this.container=i,this.ima=s,this.aspect_ratio=i.aspect_ratio.style.paddingTop,this.dimensions=function(e){if(e.clientWidth>0||e.clientHeight)return K(e);var t={height:e.style.height};V(e,"opacity",0),V(e,"display","absolute"),V(e,"display","inline-block"),V(e,"height","auto");var r=K(e);return V(e,"height",t.height),V(e,"opacity",1),r}(this.container),ne("creating Outstream instance"),this.hide(),this.poll_viewport_exit=e.fps_60_visibilty_checker({outstream:this}),this.setup();var o=Object(re.a)(this.container,function(){var e=h()(d.a.mark((function e(t){return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return o(),e.next=5,r.begin_life_cycle();case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}())}var t;return m()(e,null,[{key:"of",value:function(t){return new e(t)}},{key:"fps_60_visibilty_checker",value:function(e){var t=e.outstream;return $((function(){if(!t.disposed){var e=t.percent_in_viewport();if(t.ads.emit(ie.OUTSTREAM_VIEWPORT_UPDATE,{percent:e}),!(e>.5&&t.ads.adPlaying))return e>.5?t.ads.resume():void t.ads.pause()}}))}}]),m()(e,[{key:"hide",value:function(){return this}},{key:"restore_aspect_ratio",value:function(){return ne("Outstream.restore_aspect_ratio(".concat(this.aspect_ratio,")")),this.container.aspect_ratio.style.paddingTop=this.aspect_ratio,this}},{key:"percent_in_viewport",value:function(){return e=this.video.root.getBoundingClientRect(),t=window.innerHeight,(r=e.y)>t||r+e.height<0?0:e.y<0?(e.height+r)/e.height:t-e.y>e.height?1:Math.abs((t-e.y)/e.height);var e,t,r}},{key:"show",value:function(){this.container.removeClass(e.CLASS.HIDDEN),this.container.addClass(e.CLASS.SHOWING),this.ui.toggle({linear:!0,on:!0})}},{key:"begin_life_cycle",value:(t=h()(d.a.mark((function e(){var t,r,n,i,s,o=this;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ee.a(!1);case 2:return t=e.sent,r=t.error,n=t.result,e.next=7,ee.a(!0);case 7:return i=e.sent,s=i.result,this.attach_ad_listeners(),this.ui.initial={can_autoplay:!(!n&&!s),muted:!n},ne("Outstream.show() :autoplay >> ",this,{error:r,can_autoplay_audio:n}),r&&this.video&&!n&&(this.video.muted=!0,this.video.volume=0),e.next=15,this.ads.setVideoTag(this.video);case 15:return this.ads.on(_.a.AD_PAUSE_CONTENT,(function(e){var t=e.linear;o.ads.resize({width:o.dimensions.width,height:o.dimensions.height,linear:t})})),e.next=18,X.start({ads:this.ads,content:this.video,adContainer:this.adContainer,ima:this.ima,state:{},opts:a()({},this.video.opts,{muted:!0,dimensions:this.dimensions})});case 18:X.update_time({content:this.video,ads:this.ads,ui:this.ui});case 19:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"attach_ad_listeners",value:function(){var e=this,t=this,r=t.ads;r.once(_.a.AD_PAUSE_CONTENT,(function(){t.show(),t.poll_viewport_exit(),document.addEventListener("scroll",t.poll_viewport_exit),window.emit("resize")})),t.ima.always_show_controls||r.on(_.a.VPAID_INIT,(function(){return t.ui.addClass("is-vpaid")}));var n=function r(n){X.TERMINAL_EVENTS.forEach((function(e){return t.ads.removeListener(e,r)}));var i,a,s=(i=ie.OUTSTREAM_TEARDOWN,(a=document.createEvent("Event")).initEvent(i,!1,!0),a);ne("Outstream(:teardown)",s),e.video.dispatchEvent(s)};X.TERMINAL_EVENTS.forEach((function(e){return t.ads.once(e,n)})),this.video.once(ie.OUTSTREAM_TEARDOWN,(function(e){setTimeout((function(){if(e.defaultPrevented)return t.handle_endscreen();t.dispose()}),0)}))}},{key:"handle_endscreen",value:function(){this.reset_ui(),this.ads.reset(),this.ui.wireup(),X.ui_listeners(a()({},this,{content:this.video,root:this.video.root,state:{started:!0},initial:{muted:!0}}))}},{key:"empty_src",value:function(){this.video.setSrc({type:"video/mp4",src:URL.createObjectURL(te.a)})}},{key:"setup",value:function(){this.container.addClass(e.CLASS.IS),this.container.addClass(e.CLASS.HIDDEN),this.empty_src(),this.ui=H.of({root:this.video.root,content:this.video,ads:this.ads,config:this.video.opts}),this.adContainer=this.ui.adContainer}},{key:"poll_viewport_exit",value:function(){this.ads.adPlaying&&this.ads.pause()}},{key:"reset_ui",value:function(){var t=this.container;t.removeClass(e.CLASS.SHOWING),t.removeClass(e.CLASS.IS),document.removeEventListener("scroll",this.poll_viewport_exit),this.ui.toggle({on:!1})}},{key:"dispose",value:function(){if(!this.disposed){var t=this.container,r=this.video;this.reset_ui(),t.addClass(e.CLASS.IS),t.addClass(e.CLASS.DONE),this.video=this.container=this.ads=0,this.disposed=1,r.destroy()}}}]),e}();ae.CLASS={IS:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"},ae.events=ae.EVENT=ie;var se=r(9);function oe(e,t,r){if(!("google"in window))return X.maybe_blocked(r);var i=e.autoplay;r.autoplay=e.autoplay=!1;var s=r.ads=new Q.a,o=s.analytics=Object(J.b)(s),u=!1;s.resize(K(t)),flowplayer.ads||(flowplayer.ads={}),flowplayer.ads.version="1.16.5",flowplayer.ads.commit="97d8e0feaab02bf3b718cc47ac2992e46fe9b188",flowplayer.ads.events=_.a,flowplayer.ads.ui=n,C&&(r.on([flowplayer.events.FULLSCREEN_ENTER,flowplayer.events.FULLSREEN_EXIT,"webkitendfullscreen"],(function(e){var t=e.type===flowplayer.events.FULLSCREEN_ENTER;r.ads.adapter.setIOSPlaysInline(!t)})),s.on(_.a.AD_POSTROLL_FINISHED,(function(){s.adapter.sharedVideoTag&&s.once(_.a.AD_BREAK_COMPLETED,(function(){r.src=r.original_src,r.once(flowplayer.events.CAN_PLAY,(function(e){r.pause()})),r.webkitExitFullscreen()}))}))),flowplayer.Outstream=ae,r.on(flowplayer.events.REAP,(function(){s&&s.destroy(),o=s=void 0})),r.on(flowplayer.events.SOURCE,(function(){s&&s.stop()})),r.on(flowplayer.events.CONFIG,(function(n){var l=n.data,c=l.ima||{};if(Array.isArray(c.ads)){var d=l.duration||r.duration;if(c.ads=function(e,t){return Array.isArray(e)&&e.map((function(e,r){return"number"==typeof e.time||e.lazy?e:isNaN(e.percentage)?(console.warn("Ad[index: ".concat(r,"] passed without 'time' property or 'percentage' properties")),e):isNaN(t)?(console.warn("Ad[index: ".concat(r,"] passed with 'percentage' property but both content and config 'duration' was ").concat(t)),e):"number"==typeof e.percentage?(e.time=Math.floor(e.percentage*t),e):e}),[])}(c.ads,d),s.setSchedule(c.ads,d),l.metadata&&J.a.mergeMetadata(o,l.metadata),l.metadata&&s.mergeMacros(l.metadata),l.metadata&&c.parameters&&(c.parameters=a()({},c.parameters,l.metadata)),J.a.mergeMetadata(o,{muted:l.muted||!1,autoplay:l.autoplay||!1}),!u){if(u=!0,e.lang&&!c.Locale&&(c.Locale=e.lang),se.a.isOutstream(c.ads))return ae.of({container:t,video:r,ads:s,ima:c});X.init({config:a()({},e,{autoplay:i}),root:t,content:r,ads:s,ima:c})}}else void 0!==i?e.autoplay=i:delete e.autoplay}))}Object.assign(_.a,ae.events),window.addEventListener("resize",$((function(){null!=("undefined"==typeof flowplayer?"undefined":o()(flowplayer))&&Array.isArray(flowplayer.instances)&&flowplayer.instances.forEach((function(e){return e.ads&&e.ads.resize(K(e))}))}))),oe.events=_.a,oe.ui=n,oe.Outstream=ae,oe.version="1.16.5",oe.commit="97d8e0feaab02bf3b718cc47ac2992e46fe9b188"},function(e,t){e.exports=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}},function(e,t,r){var n=r(98);"string"==typeof n&&(n=[[e.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(18)(!1)).push([e.i,'.fp-ad-container .fp-color{background-color:#ffd700}.fp-ad-container .fp-color-text{color:#ffd700;font-weight:700;line-height:1.8em}.fp-ad-container{position:absolute;z-index:-1;background:#333;top:0;left:0;right:0;bottom:0;opacity:0}.fp-ad-controls{position:absolute;direction:ltr;top:100%;left:0;margin-top:-3.2em;height:3em;z-index:1000;display:none;padding:0.72em 0em 0.72em 2em;justify-content:space-between;align-items:center;font-weight:500;text-align:right}.fp-ad-controls .fp-volumebtn:after{filter:drop-shadow(0 0 2px rgba(0,0,0,0.4))}.fp-ad-controls .fp-secondary{filter:drop-shadow(0 0 2px rgba(0,0,0,0.4));position:relative;left:0;top:0}.is-small .ad-indicator{display:none}.is-small .fp-ad-controls>*{transform:scale(0.8)}.is-tiny .fp-ad-controls>*{transform:scale(0.7)}.fp-ad-controls .fp-fullscreen,.fp-ad-controls .fp-fullscreen-exit{visibility:visible !important}.fp-ad-controls .fp-fullscreen,.fp-ad-controls .fp-fullscreen-exit,.fp-ad-controls .fp-secondary{height:1.8em;width:auto}.fp-ad-controls .fp-volumebtn{margin-right:2.38em}.fp-ad-controls .fp-btns,.fp-ad-controls .ad-indicator,.fp-ad-controls .fp-volume{margin-right:1em}.no-fullscreen .fp-ad-controls .fp-fullscreen,.no-fullscreen .fp-ad-controls .fp-fullscreen-exit{visibility:hidden !important;height:0;width:0}.fp-ad-controls .ad-indicator:before{margin-right:0.5em}.fp-ad-controls .fp-volumebtn{width:1.12em}.fp-ad-controls .fp-volume{display:none;margin-left:-2.0em}.fp-ad-controls .fp-skip-next{display:none}.ad-volume-bar .fp-volume{display:flex}.fp-ad-controls .fp-volumebtn{height:100%}.fp-ad-controls .fp-volumebtn:after{font-size:230% !important;line-height:inherit !important}.fp-ad-controls .fp-btns{width:1.8em}.fp-ad-container.ad-paused .fp-small-play{display:inline-block}.fp-ad-container.ad-playing .fp-small-pause{display:inline-block}.fp-ad-container.ad-playing .fp-small-play{display:none}.fp-ad-container .fp-volume-mute-unmute{height:100%}.fp-ad-remaining:after{content:"·";margin-left:0.5em;margin-right:0.5em}.fp-ad-progress-wrapper{direction:ltr}.fp-ad-progress{height:0.2em;top:100%;margin-top:-0.2em;width:0%;position:absolute;transition:width .2s}.logo-on-right .fp-secondary>*{margin:0}.fp-ad-choises-icon{display:none}.is-ad-attribution .fp-ad-container::after{content:"Advertisement";position:absolute;width:100%;text-align:center;z-index:10;color:gray;background-color:rgba(255,255,255,0.2);font-size:11px;font-weight:500}.is-ad-choices .fp-ad-choices{position:absolute;width:77px;height:15px;right:0;border-bottom-left-radius:8px;padding-left:5px;color:black;background-color:rgba(255,255,255,0.7);font-size:11px;font-weight:500;z-index:11}.is-ad-choices .fp-ad-choices::after{content:" ";background-image:url("data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI1MDAiIHZpZXdCb3g9Ii4yIDAgMTkuNCAyMCIgd2lkdGg9IjI0MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0ibTIuMiAyMGMxIDAgMS43LS41IDIuNC0uOS42LS4zIDEuMi0uNyAxLjktMSAzLjItMS43IDYuNC0zLjUgOS42LTUuMyAxLS41IDIuMy0xIDMtMS45LjItLjMuNS0uNy40LTEuMi0uMy0xLjEtMS43LTEuNS0yLjYtMi0yLjItMS4yLTQuNS0yLjUtNi43LTMuNy0uOC0uNS0yLTEuNC0zLS43LS40LjItLjYuNC0uNy43LS4xLjQgMCAuOSAwIDEuM3YzLjJjMCAuOS0uMSAxLjYuNSAyIC4yLjEuNi4yLjkuMSAxLS40LjctMi4yLjctMy42di0xLjFjMS43LjkgMy40IDEuOCA1LjEgMi42LjYuMyAxLjYuNiAxLjggMS40LjIuOS0xLjcgMS42LTIuMyAxLjlsLTYuOSAzLjljLS41LjMtMS44IDEuMy0yLjYgMS0uMy0uMS0uNS0uNC0uNS0uNi0uMS0uNC0uMS0xLS4xLTEuNXYtMy4yLTUuNGMwLS44LS4xLTEuOC4yLTIuMy43LTEgMi4zLjggMi44LS44LjEtLjQtLjEtLjgtLjMtMS0uNC0uNi0yLjItMS41LTIuOS0xLjctLjItLjEtLjctLjItMS0uMi0xLjcuMy0xLjMgMy0xLjMgNXY5LjljMCAxLjUtLjIgMy41LjQgNC40LjMuNS42LjUgMS4yLjd6bTUuMi02LjVjMS41IDAgMS42LTEuOS4yLTIuMi0uOC0uMS0xLjQuNy0xLjIgMS40LjIuNS41LjYgMSAuOHoiIGZpbGw9IiMwMGFlY2QiLz48L3N2Zz4=");background-size:contain;display:inline-block;position:absolute;width:13px;height:13.747px;right:1px;top:1px}.ad-hide-first-frame .fp-wait{opacity:1}.ad-hide-first-frame .fp-engine{display:none}.ad-hide-first-frame>.fp-ui .fp-switch{display:none}\n',""])},function(e,t,r){var n=r(100);"string"==typeof n&&(n=[[e.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(18)(!1)).push([e.i,".is-ad-linear .fp-ad-container{z-index:1;opacity:1}.is-ad-linear.is-hovered .fp-ad div{background-image:linear-gradient(to top, rgba(0,0,0,0.5), transparent 15%),linear-gradient(to bottom, rgba(0,0,0,0.5), transparent 20%)}.is-ad-linear.is-hovered .fp-ad-controls,.is-ad-linear.is-ad-controls-sticky .fp-ad-controls,.is-ad-linear .ad-paused .fp-ad-controls{display:flex}.is-ad-linear .fp-ad-container.ad-ui-disabled .fp-ad-controls,.is-ad-linear .fp-ad-container.ad-ui-disabled .fp-ad-progress{display:none !important}.ad-paused .fp-ad-controls .fp-btns svg.fp-small-play{display:inline}.ad-paused .fp-ad-controls .fp-btns svg.fp-small-pause{display:none}.ad-playing .fp-ad-controls .fp-btns svg.fp-small-pause{display:inline}.ad-playing .fp-ad-controls .fp-btns svg.fp-small-play{display:none}.fp-ad-container.ad-paused .fp-wait,.fp-ad-container.ad-playing .fp-wait{display:none !important}.fp-ad-container.is-waiting .fp-ad-controls,.fp-ad-container.is-waiting .fp-ad-progress{display:none}.fp-ad-container.is-waiting .fp-wait{position:absolute;height:2em;opacity:1;top:50%;z-index:1;width:4em;left:50%;margin-left:-2em;margin-top:-1em}\n",""])},function(e,t,r){var n=r(102);"string"==typeof n&&(n=[[e.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(18)(!1)).push([e.i,".is-ad-nonlinear .fp-ad-controls,.is-ad-nonlinear .fp-ad-progress{display:none}.is-ad-nonlinear .fp-ad-container{background:transparent}.is-ad-nonlinear.is-ad-showing .fp-ad-container{left:0%;top:100%;width:100%;z-index:1;opacity:1}.is-ad-nonlinear.is-ad-showing .fp-ad-wrapper{position:relative}.is-ad-nonlinear.is-ad-showing .fp-ad{margin:0 auto}\n",""])},function(e,t,r){var n=r(104);"string"==typeof n&&(n=[[e.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(18)(!1)).push([e.i,".fp-ad-container.is-vpaid .fp-ad-controls{display:none}\n",""])},function(e,t,r){var n=r(106);"string"==typeof n&&(n=[[e.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(18)(!1)).push([e.i,".flowplayer.is-outstream{background:transparent}.flowplayer.is-outstream .fp-ui{visibility:hidden}.flowplayer.is-outstream-hidden>video,.flowplayer.is-outstream-done>video{display:none}.flowplayer.is-outstream-visible{height:auto}.flowplayer.is-outstream-visible .fp-ad-container{left:0px;top:0px}\n",""])},,,,,function(e,t,r){r(53),r(71),r(73),r(75),e.exports=r(95)}]).default})));const{samsung_tv:Dn}=r();class Rn{init(e,t,r){if(Me.from_token(e.token||"").is_granted(Me.permissions.ADS)&&!Dn)return wn(e,t,r)}}return we(window,Object.assign(Rn,wn)),Cr.extensions.push(qr,Sn,Rn),Object.assign(Cr,{hls:qr,ads:Rn,ovp:Sn}),Cr}));
373
+ var Cn=Qe(Je((function(e,t){window,e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=111)}([function(e,t,r){t.a={AD_INIT:"ad-initialized",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-rendeding-settings",ADAPTER_INIT_FAILED:"ad-adapter-init-failed",AD_PLAY_REQUESTED:"ad-play-requested",RELOAD_AD_REQUESTED:"reload-ad-requested"}},function(e,t,r){e.exports=r(82)},function(e,t){function r(e,t,r,n,i,a,s){try{var o=e[a](s),u=o.value}catch(e){return void r(e)}o.done?t(u):Promise.resolve(u).then(n,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var s=e.apply(t,n);function o(e){r(s,i,a,o,u,"next",e)}function u(e){r(s,i,a,o,u,"throw",e)}o(void 0)}))}}},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,r){var n=r(27);e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},i=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),i.forEach((function(t){n(e,t,r[t])}))}return e}},function(e,t){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(t){return"function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?e.exports=n=function(e){return r(e)}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},n(t)}e.exports=n},function(e,t,r){var n,i,a,s;function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}s=function(){return function e(t,r,n){function i(s,o){if(!r[s]){if(!t[s]){if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[s]={exports:{}};t[s][0].call(l.exports,(function(e){return i(t[s][1][e]||e)}),l,l.exports,e,t,r,n)}return r[s].exports}for(var a=!1,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,r){var n=1e3,i=6e4,a=60*i,s=24*a;function o(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}t.exports=function(e,t){t=t||{};var r,l,c=u(e);if("string"===c&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*a;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===c&&!1===isNaN(e))return t.long?(r=e,(l=Math.abs(r))>=s?o(r,l,s,"day"):l>=a?o(r,l,a,"hour"):l>=i?o(r,l,i,"minute"):l>=n?o(r,l,n,"second"):r+" ms"):function(e){var t=Math.abs(e);return t>=s?Math.round(e/s)+"d":t>=a?Math.round(e/a)+"h":t>=i?Math.round(e/i)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],2:[function(e,t,r){var n,i,a=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var l,c=[],d=!1,f=-1;function h(){d&&l&&(d=!1,l.length?c=l.concat(c):f=-1,c.length&&p())}function p(){if(!d){var e=u(h);d=!0;for(var t=c.length;t;){for(l=c,c=[];++f<t;)l&&l[f].run();f=-1,t=c.length}l=null,d=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function v(e,t){this.fun=e,this.array=t}function g(){}a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new v(e,t)),1!==c.length||d||u(p)},v.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=g,a.addListener=g,a.once=g,a.off=g,a.removeListener=g,a.removeAllListeners=g,a.emit=g,a.prependListener=g,a.prependOnceListener=g,a.listeners=function(e){return[]},a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],3:[function(e,t,r){t.exports=function(t){function r(e){for(var t=0,r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return n.colors[Math.abs(t)%n.colors.length]}function n(e){var t;function s(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];if(s.enabled){var a=s,o=Number(new Date),u=o-(t||o);a.diff=u,a.prev=t,a.curr=o,t=o,r[0]=n.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var l=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(function(e,t){if("%%"===e)return e;l++;var i=n.formatters[t];if("function"==typeof i){var s=r[l];e=i.call(a,s),r.splice(l,1),l--}return e})),n.formatArgs.call(a,r);var c=a.log||n.log;c.apply(a,r)}}return s.namespace=e,s.enabled=n.enabled(e),s.useColors=n.useColors(),s.color=r(e),s.destroy=i,s.extend=a,"function"==typeof n.init&&n.init(s),n.instances.push(s),s}function i(){var e=n.instances.indexOf(this);return-1!==e&&(n.instances.splice(e,1),!0)}function a(e,t){var r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){return e instanceof Error?e.stack||e.message:e},n.disable=function(){var e=[].concat(o(n.names.map(s)),o(n.skips.map(s).map((function(e){return"-"+e})))).join(",");return n.enable(""),e},n.enable=function(e){var t;n.save(e),n.names=[],n.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(t=0;t<i;t++)r[t]&&("-"===(e=r[t].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")));for(t=0;t<n.instances.length;t++){var a=n.instances[t];a.enabled=n.enabled(a.namespace)}},n.enabled=function(e){if("*"===e[e.length-1])return!0;var t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1},n.humanize=e("ms"),Object.keys(t).forEach((function(e){n[e]=t[e]})),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=r,n.enable(n.load()),n}},{ms:1}],4:[function(e,t,r){(function(n){r.log=function(){var e;return"object"===("undefined"==typeof console?"undefined":u(console))&&console.log&&(e=console).log.apply(e,arguments)},r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),this.useColors){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(n++,"%c"===e&&(i=n))})),e.splice(i,0,r)}},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){var e;try{e=r.storage.getItem("debug")}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e},r.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},r.storage=function(){try{return localStorage}catch(e){}}(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=e("./common")(r),t.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,e("_process"))},{"./common":3,_process:2}]},{},[4])(4)},"object"===u(t)&&void 0!==e?e.exports=s():(i=[],void 0===(a="function"==typeof(n=s)?n.apply(t,i):n)||(e.exports=a))},function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},function(e,t,r){r.d(t,"a",(function(){return o}));var n=r(4),i=r.n(n),a=r(3),s=r.n(a),o=function(){function e(t,r){i()(this,e),this._nextIndex=0,this._postroll=0,this._loadPending=!1,this._opts=r||{},this.reset(t)}return s()(e,null,[{key:"of",value:function(t,r){return new e(t,r)}}]),s()(e,[{key:"toJSON",value:function(){var e=(this._ads||[]).slice(this._nextIndex);return this._postroll&&e.push(this._postroll),e}},{key:"reset",value:function(e){this.setAds(e),this._nextIndex=0,this._postrollActive=!1}},{key:"resetCounter",value:function(){this._nextIndex=0,this._postrollActive=!1}},{key:"setAds",value:function(e){this._ads=e||[],this.sort()}},{key:"getAds",value:function(){return this._ads}},{key:"getNextAd",value:function(e){return this._ads[this._nextIndex]||e}},{key:"getCurrentAd",value:function(){return this._postrollActive?this._postroll:this._loadPending?0:this._ads[this._nextIndex-1]}},{key:"getPostroll",value:function(){return this._postroll}},{key:"isDrained",value:function(){return this._nextIndex+1>this._ads.length}},{key:"setPostrollActive",value:function(){this._postrollActive=!0}},{key:"updateContentDuration",value:function(e){this._opts.content_duration=e}},{key:"increment",value:function(){++this._nextIndex}},{key:"decrement",value:function(){this._nextIndex>0&&--this._nextIndex}},{key:"getNextIndex",value:function(){return this._nextIndex}},{key:"getCurrentType",value:function(){return this.getCurrentAd()&&e.kindOf(this.getCurrentAd().time)}},{key:"sort",value:function(){var e=this;this._postroll=this._ads.filter((function(e){return-1===e.time}))[0],this._ads=this._ads.filter((function(t){return t!==e._postroll})).sort((function(t,r){return t.time===r.time?e._ads.indexOf(t)-e._ads.indexOf(r):t.time-r.time}))}},{key:"shallPlayAd",value:function(e){if(this._loadPending)return!1;var t=this.getCurrentAd()||this.getNextAd();return!!(t&&t.time<=e&&-1!==t.time)}},{key:"shallPlayNext",value:function(){var e=this.getNextAd(),t=this.getCurrentAd();return!(!e||!t||e.time!==t.time)}},{key:"waitForLoad",value:function(e,t,r){if(this._loadPending=!1,!t)return!1;var n=r?this._opts.preload_advance:0;return t.time>=0?this._loadPending=e<t.time-n:-1===t.time&&(this._loadPending=this._opts.content_duration>0&&-1!==e?e<this._opts.content_duration-n:-1!==e),this._loadPending}}],[{key:"hasPreroll",value:function(e){return!!e.find((function(e){return 0===e.time}))}},{key:"isOutstream",value:function(t){return e.hasPreroll(t)&&!!t[0].outstream}},{key:"kindOf",value:function(e){switch(e){case 0:return"preroll";case-1:return"postroll";default:return"midroll"}}}]),e}()},function(e,t){var r=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=r)},function(e,t,r){var n=r(6),i=r(16);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?i(e):t}},function(e,t,r){var n=r(52);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},function(e,t){var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(e,t,r){var n=r(13),i=r(10),a=r(21),s=r(61),o=r(33),u=function(e,t,r){var l,c,d,f,h=e&u.F,p=e&u.G,v=e&u.S,g=e&u.P,m=e&u.B,y=p?n:v?n[t]||(n[t]={}):(n[t]||{}).prototype,E=p?i:i[t]||(i[t]={}),_=E.prototype||(E.prototype={});for(l in p&&(r=t),r)d=((c=!h&&y&&void 0!==y[l])?y:r)[l],f=m&&c?o(d,n):g&&"function"==typeof d?o(Function.call,d):d,y&&s(y,l,d,e&u.U),E[l]!=d&&a(E,l,f),g&&_[l]!=d&&(_[l]=d)};n.core=i,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,r){var n=r(85),i=r(86),a=r(87);e.exports=function(e,t){return n(e)||i(e,t)||a()}},function(e,t,r){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=function(e,t){var r,n,i,a=e[1]||"",s=e[3];if(!s)return a;if(t&&"function"==typeof btoa){var o=(r=s,n=btoa(unescape(encodeURIComponent(JSON.stringify(r)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n),"/*# ".concat(i," */")),u=s.sources.map((function(e){return"/*# sourceURL=".concat(s.sourceRoot).concat(e," */")}));return[a].concat(u).concat([o]).join("\n")}return[a].join("\n")}(t,e);return t[2]?"@media ".concat(t[2],"{").concat(r,"}"):r})).join("")},t.i=function(e,r){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},i=0;i<this.length;i++){var a=this[i][0];null!=a&&(n[a]=!0)}for(var s=0;s<e.length;s++){var o=e[s];null!=o[0]&&n[o[0]]||(r&&!o[2]?o[2]=r:r&&(o[2]="(".concat(o[2],") and (").concat(r,")")),t.push(o))}},t}},function(e,t,r){var n,i={},a=function(){var e={};return function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}e[t]=r}return e[t]}}();function s(e,t){for(var r=[],n={},i=0;i<e.length;i++){var a=e[i],s=t.base?a[0]+t.base:a[0],o={css:a[1],media:a[2],sourceMap:a[3]};n[s]?n[s].parts.push(o):r.push(n[s]={id:s,parts:[o]})}return r}function o(e,t){for(var r=0;r<e.length;r++){var n=e[r],a=i[n.id],s=0;if(a){for(a.refs++;s<a.parts.length;s++)a.parts[s](n.parts[s]);for(;s<n.parts.length;s++)a.parts.push(v(n.parts[s],t))}else{for(var o=[];s<n.parts.length;s++)o.push(v(n.parts[s],t));i[n.id]={id:n.id,refs:1,parts:o}}}}function u(e){var t=document.createElement("style");if(void 0===e.attributes.nonce){var n=r.nc;n&&(e.attributes.nonce=n)}if(Object.keys(e.attributes).forEach((function(r){t.setAttribute(r,e.attributes[r])})),"function"==typeof e.insert)e.insert(t);else{var i=a(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var l,c=(l=[],function(e,t){return l[e]=t,l.filter(Boolean).join("\n")});function d(e,t,r,n){var i=r?"":n.css;if(e.styleSheet)e.styleSheet.cssText=c(t,i);else{var a=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}function f(e,t,r){var n=r.css,i=r.media,a=r.sourceMap;if(i&&e.setAttribute("media",i),a&&btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var h=null,p=0;function v(e,t){var r,n,i;if(t.singleton){var a=p++;r=h||(h=u(t)),n=d.bind(null,r,a,!1),i=d.bind(null,r,a,!0)}else r=u(t),n=f.bind(null,r,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(r)};return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).attributes="object"==typeof t.attributes?t.attributes:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=(void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n));var r=s(e,t);return o(r,t),function(e){for(var n=[],a=0;a<r.length;a++){var u=r[a],l=i[u.id];l&&(l.refs--,n.push(l))}e&&o(s(e,t),t);for(var c=0;c<n.length;c++){var d=n[c];if(0===d.refs){for(var f=0;f<d.parts.length;f++)d.parts[f]();delete i[d.id]}}}}},function(e,t,r){r.d(t,"b",(function(){return U})),r.d(t,"a",(function(){return F}));var n=r(47),i=r.n(n),a=r(4),s=r.n(a),o=r(3),u=r.n(o),l=r(27),c=r.n(l),d=r(7),f=r.n(d),h=r(17),p=r.n(h),v={ok:f()("fpads:analytics:request-queue"),err:f()("fpads:analytics:request-queue:err"),warn:f()("fpads:analytics:request-queue:warn")},g=function(){function e(){s()(this,e),this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return u()(e,null,[{key:"of",value:function(){return new e}},{key:"is_empty",value:function(e){return 0==e.pending.size}},{key:"is_high_water",value:function(t){return t.open.size==e.MAX_OPEN_REQUESTS}},{key:"maybe_spawn_req",value:function(t){if(e.is_empty(t))return v.ok("maybe_spawn_req called Queue that is EMPTY"),t;if(e.is_high_water(t))return v.warn("maybe_spawn_req called on Queue that is HIGH_WATER"),t;try{e.request(t,e.lpop(t))}catch(e){v.err(e)}}},{key:"increment_failures",value:function(t){return t.stats.failures++,t.stats.failures>e.MAX_FAILURE_COUNT&&(t.stats.ttl=Date.now()+e.REQUEST_TTL_MS),t}},{key:"handle_error",value:function(t,r){e.rm(t,r),e.increment_failures(t)}},{key:"request",value:function(t,r){var n=p()(r,3),i=n[0],a=n[1],s=n[2];if(v.ok("Request[".concat(s.event_type,"] request"),s,t.stats),Date.now()<t.stats.ttl)return v.warn("Request[".concat(s.event_type,"] skipping because too many errors too quickly"),t.stats);var o=new XMLHttpRequest;t.open.push(o),o.timeout=e.REQUEST_TIMEOUT_MS,o.ontimeout=function(){e.handle_error(t,o),v.warn("Request[".concat(s.event_type,"] timed out in ").concat(o.timeout,"ms"),t.stats)},o.onerror=function(r){e.handle_error(t,o),r&&v.err(r),v.warn("Request[".concat(s.event_type,"] encountered an Error"),o.responseText,t.stats)},o.onreadystatechange=function(){o.readyState==XMLHttpRequest.DONE&&e.rm(t,o),Math.floor(o.status/100)},o.onload=function(){e.rm(t,o),t.stats.failures&&t.stats.failures--,v.ok("Request[".concat(s.event_type,"] :ok"),o.stats)},o.open(a,i),o.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{o.send(JSON.stringify(s))}catch(e){v.err(e)}}},{key:"rpush",value:function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return n.forEach((function(r){if(t.pending.length>=e.HIGH_WATER_PENDING)return v.warn("Too many open requests, skipping",t.stats);t.pending.push(r),e.maybe_spawn_req(t)})),t}},{key:"lpop",value:function(e){return e.pending.shift()}},{key:"rm",value:function(e,t){var r=e.open.lastIndexOf(t);return~r&&e.open.splice(r,1),e}}]),e}();g.MAX_OPEN_REQUESTS=3,g.MAX_PENDING=5,g.REQUEST_TIMEOUT_MS=4e3,g.REQUEST_TTL_MS=5e3,g.MAX_FAILURE_COUNT=3;var m=r(48),y=r.n(m),E=r(49),_=r(7)("fpads:device"),T=y.a.parse(window.navigator.userAgent),b=T.platform,S=T.os,A=T.browser;_(T);var L=function(e){return e&&e.toLowerCase()},k={rnd:Math.random().toString(36).substr(2,32),os:L(S.name+(S.versionName?" ".concat(S.versionName):"")),device:L(b.type),browser:L(A.name),browser_version:(A&&A.version?A.version:"unknown").split(".").shift(),plugin_version:E.version},w=r(0),D="https://fp-eu-w1-aai.flowplayer.com/in",R="POST",O=[w.a.AD_REQUESTED,w.a.AD_REQUEST_ERROR,w.a.AD_REQUEST_COMPLETED,w.a.AD_COMPLETED,w.a.AD_STARTED,w.a.AD_ERROR,w.a.AD_SKIPPED],C=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],I=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],x=f()("fpads:analytics"),P=g.of(),M=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Object.assign.apply(Object,[{}].concat(t))},N=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return Object.keys(e).filter((function(e){return~r.indexOf(e)})).reduce((function(t,r){return Object.assign(t,c()({},r,e[r]))}),{})},F=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s()(this,e),this.metadata=M(k,r.metadata||{}),this.emitter=t,this.events=r.events||[],this.required_keys=r.required_keys||[],this.optional_keys=r.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),x(this),this.wireup()}return u()(e,null,[{key:"of",value:function(t,r){return new e(t,r)}},{key:"ensure_required_keys",value:function(e,t){return e.required_keys.filter((function(e){return!(e in t)}))}},{key:"pluck_valid_keys",value:function(e,t){return N.apply(void 0,[t].concat(i()(e.valid_keys)))}},{key:"mergeMetadata",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.metadata=e.pluck_valid_keys(t,M(t.metadata,r,{player_version:window.flowplayer.version})),t}}]),u()(e,[{key:"wireup",value:function(){var t=this;t.events.forEach((function(r){t.emitter.on(r,(function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=M(t.metadata,{event_type:r},n),a=e.pluck_valid_keys(t,i),s=e.ensure_required_keys(t,a);if(x("Event[".concat(r,"]"),{payload:a,observation:n}),s.length)return x("Analytics.validate_metadata() failed for \n Event[".concat(r,"]\n missing keys: ").concat(s),a);g.rpush(P,[D,R,a])}))}))}},{key:"destroy",value:function(){this.metadata=void 0,this.emitter=void 0,this.events=void 0,this.required_keys=void 0,this.optional_keys=void 0,this.valid_keys=void 0}}]),e}(),U=function(e){return F.of(e,{required_keys:C,optional_keys:I,events:O})}},function(e,t,r){var n=r(55),i=r(60);e.exports=r(22)?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t,r){e.exports=!r(23)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){var r=0,n=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+n).toString(36))}},function(e,t,r){var n=r(26),i=r(36);e.exports=function(e){return n(i(e))}},function(e,t,r){var n=r(35);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){r(8);var n=r(84);function i(t,r,a){return"undefined"!=typeof Reflect&&Reflect.get?e.exports=i=Reflect.get:e.exports=i=function(e,t,r){var i=n(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(r):a.value}},i(t,r,a||t)}e.exports=i},function(e,t,r){var n,i="object"==typeof Reflect?Reflect:null,a=i&&"function"==typeof i.apply?i.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(){void 0!==a&&e.removeListener("error",a),r([].slice.call(arguments))}var a;"error"!==t&&(a=function(r){e.removeListener(t,i),n(r)},e.once("error",a)),e.once(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var u=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function d(e,t,r,n){var i,a,s,o;if(l(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),s=a[t]),void 0===s)s=a[t]=r,++e._eventsCount;else if("function"==typeof s?s=a[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,o=u,console&&console.warn&&console.warn(o)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):g(i,i.length)}function v(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)a(u,this,t);else{var l=u.length,c=g(u,l);for(r=0;r<l;++r)a(c[r],this,t)}return!0},o.prototype.addListener=function(e,t){return d(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return d(this,e,t,!0)},o.prototype.once=function(e,t){return l(t),this.on(e,h(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,h(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,a,s;if(l(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===t||r[a].listener===t){s=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,a=Object.keys(r);for(n=0;n<a.length;++n)"removeListener"!==(i=a[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):v.call(e,t)},o.prototype.listenerCount=v,o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(e,t,r){var n=r(88),i=r(89),a=r(45);e.exports={formats:a,parse:i,stringify:n}},function(e,t,r){r.d(t,"a",(function(){return f}));var n=r(1),i=r.n(n),a=r(2),s=r.n(a),o=(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"}),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 u(e){return Object.assign({muted:!1,timeout:250,inline:!1},e)}function l(e,t){var r=e.muted,n=e.timeout,i=e.inline,a=t(),s=a.element,o=a.source,u=void 0,l=void 0,c=void 0;return s.muted=r,!0===r&&s.setAttribute("muted","muted"),!0===i&&s.setAttribute("playsinline","playsinline"),s.src=o,new Promise((function(e){u=s.play(),l=setTimeout((function(){c(!1,new Error("Timeout "+n+" ms has been reached"))}),n),c=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;clearTimeout(l),e({result:t,error:r})},void 0!==u?u.then((function(){return c(!0)})).catch((function(e){return c(!1,e)})):c(!0)}))}var c=function(e){return l(e=u(e),(function(){return{element:document.createElement("video"),source:URL.createObjectURL(o)}}))},d=void 0;function f(){return h.apply(this,arguments)}function h(){return(h=s()(i.a.mark((function e(){var t,r=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!(r.length>0&&void 0!==r[0])||r[0],!d){e.next=3;break}return e.abrupt("return",d);case 3:return e.next=5,c({timeout:500,muted:t});case 5:return d=e.sent,e.abrupt("return",d);case 7:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}},function(e,t){var r={}.hasOwnProperty;e.exports=function(e,t){return r.call(e,t)}},function(e,t,r){var n=r(62);e.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,r){var n=r(64),i=r(69);e.exports=Object.keys||function(e){return n(e,i)}},function(e,t){var r={}.toString;e.exports=function(e){return r.call(e).slice(8,-1)}},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,r){var n=r(38),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},function(e,t){var r=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:r)(e)}},function(e,t,r){var n=r(10),i=r(13),a=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return a[e]||(a[e]=void 0!==t?t:{})})("versions",[]).push({version:n.version,mode:r(68)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,r){var n=r(36);e.exports=function(e){return Object(n(e))}},function(e,t,r){var n=r(34),i=r(25),a=r(40).f;e.exports=function(e){return function(t){for(var r,s=i(t),o=n(s),u=o.length,l=0,c=[];u>l;)a.call(s,r=o[l++])&&c.push(e?[r,s[r]]:s[r]);return c}}},function(e,t,r){var n=r(39)("wks"),i=r(24),a=r(13).Symbol,s="function"==typeof a;(e.exports=function(e){return n[e]||(n[e]=s&&a[e]||(s?a:i)("Symbol."+e))}).store=n},function(e,t,r){var n=Object.prototype.hasOwnProperty,i=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),a=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r};e.exports={arrayToObject:a,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],n=0;n<t.length;++n)for(var i=t[n],a=i.obj[i.prop],s=Object.keys(a),o=0;o<s.length;++o){var u=s[o],l=a[u];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(t.push({obj:a,prop:u}),r.push(l))}return function(e){for(var t;e.length;){var r=e.pop();if(t=r.obj[r.prop],Array.isArray(t)){for(var n=[],i=0;i<t.length;++i)void 0!==t[i]&&n.push(t[i]);r.obj[r.prop]=n}}return t}(t)},decode:function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},encode:function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),r="",n=0;n<t.length;++n){var a=t.charCodeAt(n);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?r+=t.charAt(n):a<128?r+=i[a]:a<2048?r+=i[192|a>>6]+i[128|63&a]:a<55296||a>=57344?r+=i[224|a>>12]+i[128|a>>6&63]+i[128|63&a]:(n+=1,a=65536+((1023&a)<<10|1023&t.charCodeAt(n)),r+=i[240|a>>18]+i[128|a>>12&63]+i[128|a>>6&63]+i[128|63&a])}return r},isBuffer:function(e){return null!=e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},merge:function e(t,r,i){if(!r)return t;if("object"!=typeof r){if(Array.isArray(t))t.push(r);else{if("object"!=typeof t)return[t,r];(i.plainObjects||i.allowPrototypes||!n.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=a(t,i)),Array.isArray(t)&&Array.isArray(r)?(r.forEach((function(r,a){n.call(t,a)?t[a]&&"object"==typeof t[a]?t[a]=e(t[a],r,i):t.push(r):t[a]=r})),t):Object.keys(r).reduce((function(t,a){var s=r[a];return n.call(t,a)?t[a]=e(t[a],s,i):t[a]=s,t}),s)}}},function(e,t,r){var n=String.prototype.replace,i=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return n.call(e,i,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t,r){r.d(t,"a",(function(){return n})),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"});var n=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(e,t,r){var n=r(90),i=r(91),a=r(92);e.exports=function(e){return n(e)||i(e)||a()}},function(e,t,r){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),a=e.getVersionPrecision(r),s=Math.max(i,a),o=0,u=e.map([t,r],(function(t){var r=s-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(o=s-Math.min(i,a)),s-=1;s>=o;){if(u[0][s]>u[1][s])return 1;if(u[0][s]===u[1][s]){if(s===o)return 0;s-=1}else if(u[0][s]<u[1][s])return-1}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,r){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",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"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",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"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={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"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},a=r(18),s=function(){function e(){}var t;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},(t=[{key:"BROWSER_MAP",get:function(){return a.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return a.ENGINE_MAP}},{key:"OS_MAP",get:function(){return a.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return a.PLATFORMS_MAP}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e,t),e}();t.default=s,e.exports=t.default},91:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=u(r(92)),i=u(r(93)),a=u(r(94)),s=u(r(95)),o=u(r(17));function u(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=n.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=i.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find((function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return Object.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,i={},a=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(i[t]=s,a+=1):"object"==typeof s&&(r[t]=s,n+=1)})),n>0){var s=Object.keys(r),o=s.find((function(e){return t.isOS(e)}));if(o){var u=this.satisfies(r[o]);if(void 0!==u)return u}var l=s.find((function(e){return t.isPlatform(e)}));if(l){var c=this.satisfies(r[l]);if(void 0!==c)return c}}if(a>0){var d=Object.keys(i).find((function(e){return t.isBrowser(e,!0)}));if(void 0!==d)return this.compareVersion(i[d])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=o.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(o.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e){return this.isBrowser(e)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=l,e.exports=t.default},92:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(a,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(a,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=r(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:a.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.WindowsPhone,version:t}}},{test:[/windows/i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:a.OS_MAP.Windows,version:t,versionName:r}}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:a.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:a.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:a.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:a.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:a.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:a.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:a.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:a.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=r(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:a.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:a.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:a.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:a.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=r(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:a.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:a.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:a.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:a.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:a.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:a.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:a.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=s,e.exports=t.default}})},function(e){e.exports=JSON.parse('{"name":"@flowplayer/ads","version":"1.16.5","description":"","main":"index.js","scripts":{"lint":"eslint src","test:debug":"DEBUG=collector:* jest -i","test":"jest -i","dev":"NODE_ENV=development TARGET=unlocked webpack-dev-server --progress --colors --port 8844 --host 0.0.0.0","prod":"webpack -p","build":"webpack","prepublish":"rm -rf dist/ && NO_DEMOS=true npm run build:unlocked && npx uglifyjs dist/native.js","build:locked":"TARGET=locked webpack","build:unlocked":"TARGET=unlocked webpack","collector":"node node_modules/.bin/collector","rel":"git tag -d production && git push origin :production && git tag production && git push origin --tags","test:browserstack":"jest -i --testMatch=**/test/browserstack/*.spec.js","test:unit":"jest -i --env jsdom --testMatch \'<rootDir>/test/unit/**/*.spec.js\'"},"husky":{"hooks":{"pre-commit":"yarn lint","post-merge":"yarn"}},"jest":{"testMatch":["**/__tests__/**/*.js?(x)","**/?(*.)(spec|test).js?(x)"],"testURL":"https://flowplayer.com/videos/fake","moduleNameMapper":{"<%TARGET%>":"<rootDir>/test/jest/transform.js"},"globalSetup":"./test/jest/setup","globalTeardown":"./test/jest/teardown","testEnvironment":"./test/jest/browserstack","bail":true},"author":"","license":"ISC","devDependencies":{"@babel/core":"^7.1.0","@babel/plugin-proposal-object-rest-spread":"^7.0.0","@babel/plugin-syntax-object-rest-spread":"^7.0.0","@babel/plugin-transform-runtime":"^7.1.0","@babel/preset-env":"^7.1.0","@babel/runtime":"^7.0.0","@flowplayer/collector":"^0.2.2","babel-core":"^7.0.0-bridge.0","babel-eslint":"^10.0.1","babel-jest":"^23.6.0","babel-loader":"^8.0.2","chai":"^4.1.2","css-loader":"^3.1.0","eslint":"^5.5.0","eslint-import-resolver-webpack":"^0.12.0","eslint-plugin-import":"^2.14.0","git-rev-sync":"^2.0.0","handlebars":"^4.7.7","handlebars-loader":"^1.7.0","html-webpack-plugin":"^4.0.3","husky":"^4.3.0","jest":"^26.4.2","moment":"^2.19.2","node-sass":"^4.13.1","sass-loader":"^8.0.0","style-loader":"^1.0.0","webpack":"^4.37.0","webpack-cli":"^3.1.1","webpack-dev-server":"^3.1.11"},"dependencies":{"bean":"^1.0.15","bowser":"^2.7.0","can-autoplay":"^3.0.0","core-js":"^2.5.7","debug":"^4.0.1","es6-event-emitter":"^1.10.2"}}')},function(e,t,r){function n(e,t){var r=!1,n=function(){var n,i=(n=e.getBoundingClientRect()).top>=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)+n.height&&n.right<=(window.innerWidth||document.documentElement.clientWidth)+n.width;i!==r&&t(i),r=i};return setTimeout(n),document.addEventListener("scroll",n),function(){return document.removeEventListener("scroll",n)}}r.d(t,"a",(function(){return n}))},function(e,t,r){r.d(t,"a",(function(){return ae}));var n=r(1),i=r.n(n),a=r(2),s=r.n(a),o=r(5),u=r.n(o),l=r(4),c=r.n(l),d=r(3),f=r.n(d),h=r(11),p=r.n(h),v=r(8),g=r.n(v),m=r(12),y=r.n(m),E=r(16),_=r.n(E),T=r(28),b=r.n(T),S=r(0),A=r(6),L=r.n(A),k=r(7)("fpads:timers"),w=-1,D=function(){function e(){c()(this,e),this.intervals={},this.timers={}}return f()(e,null,[{key:"of",value:function(){return new e}},{key:"id",value:function(){return++w}},{key:"createTimeout",value:function(t,r,n){var i=setTimeout((function(){delete t.timers[i],n()}),r);if(k("TimerRegistry.createTimeout() -> ".concat(i),t.timers),"object"==L()(i)){var a=e.id();return t.timers[a]=i,a}return t.timers[i]=i,i}},{key:"removeTimeout",value:function(e,t){return k("TimerRegistry.removeTimeout() -> ".concat(t),e.timers),clearTimeout(e.timers[t]),delete e.timers[t],e}},{key:"createInterval",value:function(t,r,n){var i=setInterval(n,r);if(k("TimerRegistry.createInterval() -> ".concat(i),t.intervals),"object"==L()(i)){var a=e.id();return t.intervals[a]=i,a}return t.intervals[i]=i,i}},{key:"removeInterval",value:function(e,t){return k("TimerRegistry.removeInterval() -> ".concat(t),e.intervals),clearInterval(e.intervals[t]),delete e.intervals[t],e}},{key:"empty",value:function(t){if(t)return k("TimerRegistry.empty()",Object.keys(t.timers),Object.keys(t.intervals)),Object.keys(t.intervals).forEach((function(r){return e.removeInterval(t,r)})),Object.keys(t.timers).forEach((function(r){return e.removeTimeout(t,r)})),t}}]),e}(),R=r(9),O=function(e,t){var r="".concat(e,"() not implemented by the adapter");if(t)throw new Error(r);console.warning(r)},C=function(){function e(){c()(this,e)}var t,r,n;return f()(e,[{key:"initialize",value:function(e){O("initialize",!0)}},{key:"reset",value:function(){O("reset",!0)}},{key:"destroy",value:function(){O("destroy",!0)}},{key:"stop",value:function(){O("stop",!0)}},{key:"initAd",value:(n=s()(i.a.mark((function e(t,r){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:O("initAd",!0);case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"playAd",value:(r=s()(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:O("playAd",!0);case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"pause",value:function(){O("pause",!1)}},{key:"resume",value:function(){O("resume",!1)}},{key:"volume",value:function(e){O("volume",!1)}},{key:"contentComplete",value:(t=s()(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:O("contentComplete",!1);case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"onResize",value:function(e){O("onResize",!1)}},{key:"isUiDisabled",value:function(){return!1}},{key:"getAdPodInfo",value:function(){return null}},{key:"isAdPod",value:function(){return!1}},{key:"canDismissNonLinear",value:function(){return!1}}]),e}(),I=r(7)("fpads:adapter:base"),x=function(e){function t(e){var r;return c()(this,t),(r=p()(this,g()(t).call(this))).eventHandler=e,r.opts={},r._prepared=void 0,r._initialized=void 0,r._videoTag=void 0,r._dimensions=void 0,r._sharedVideoTag=void 0,r._autoplayResult=void 0,r._adLinear=!0,r._paused=!0,r}var r,n,a;return y()(t,e),f()(t,[{key:"destroy",value:function(){this.eventHandler=void 0,this._videoTag=void 0}},{key:"stop",value:function(){}},{key:"isReady",value:function(){return!!this._initialized}},{key:"init",value:(a=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I("init",this._videoTag,t),this.opts=t,this._dimensions={width:t.width,height:t.height},this._prepared=!0,this._initialized||!this._videoTag){e.next=7;break}return e.next=7,this.initAdapter();case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"setVideoTag",value:(n=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._videoTag=t,this._initialized||!this._prepared){e.next=4;break}return e.next=4,this.initAdapter();case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"initAdapter",value:(r=s()(i.a.mark((function e(){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return I("initAdapter",this.opts),e.prev=1,e.next=4,this.initialize(this.opts);case 4:this._initialized=!0,e.next=12;break;case 7:e.prev=7,e.t0=e.catch(1),I("initAdapter failed:",e.t0),this._prepared=!1,this.eventHandler.trigger(S.a.ADAPTER_INIT_FAILED);case 12:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return r.apply(this,arguments)})},{key:"setIOSPlaysInline",value:function(e){I("setIOSPlaysInline",e),this._sharedVideoTag=!e,this.initialize(u()({},this.opts,{DisableCustomPlaybackForIOS10Plus:e}))}},{key:"resize",value:function(e){var t=e.width,r=e.height,n=e.linear,i=e.silent,a=e.resize_non_linear;!1===n&&(t+=10,r+=10),this._adLinear=void 0===n?this._adLinear:n,this.onResize({width:t,height:r,linear:this._adLinear,silent:i,resize_non_linear:a}),this._dimensions={width:t,height:r,linear:n}}},{key:"dimensions",get:function(){return this._dimensions}},{key:"videoTag",get:function(){return this._videoTag}},{key:"adLinear",get:function(){return this._adLinear}},{key:"sharedVideoTag",get:function(){return this._sharedVideoTag}},{key:"paused",get:function(){return this._paused}}]),t}(C);function P(e){try{return e.getAdPodInfo().getPodIndex()}catch(e){return}}var M=r(7)("fpads:adapter:ima"),N=function(e){function t(e){var r;return c()(this,t),(r=p()(this,g()(t).call(this,e)))._adHandlers=[],r._timers=D.of(),r._started=!1,r._volumeLevel=0,r._adLoaded=!1,r._currentDuration=0,r._currentRemaining=0,r._currentDisplayTs=0,r}var r,n,a,o;return y()(t,e),f()(t,[{key:"destroy",value:function(){b()(g()(t.prototype),"destroy",this).call(this),D.empty(this._timers),this._adHandlers&&this._adHandlers.forEach((function(e){return e()})),this._adHandlers=void 0,this._adDisplayContainer&&this._adDisplayContainer.destroy(),this._adDisplayContainer=void 0,this._adsLoader&&this._adsLoader.destroy(),this._adsLoader=void 0,this._adsManager&&this._adsManager.destroy(),this._adsManager=void 0}},{key:"stop",value:function(){b()(g()(t.prototype),"stop",this).call(this),this._adsManager&&this._adsManager.stop()}},{key:"initialize",value:function(e){var r=this,n=this.isAdPod(),i=this._adLoaded||n;this.cleanup();var a=this;this.opts=e,this._volumeLevel=e.volume;var s=google.ima.settings;e.NumRedirects=e.NumRedirects||e.redirects,Object.keys(e).forEach((function(t){void 0!==s["set".concat(t)]&&s["set".concat(t)](e[t])}));var o={VpaidMode:google.ima.ImaSdkSettings.VpaidMode.INSECURE,DisableCustomPlaybackForIOS10Plus:!0};Object.keys(o).filter((function(t){return void 0===e[t]})).forEach((function(e){return s["set".concat(e)](o[e])})),this._adDisplayContainer=new google.ima.AdDisplayContainer(e.container,this.videoTag),this._adDisplayContainer.initialize(),this._adsLoader=new google.ima.AdsLoader(this._adDisplayContainer),M("ima.initialise(:wait -> ADS_MANAGER_LOADED)",u()({},e,{volume:this.videoTag.volume,muted:this.videoTag.muted})),this._adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(function(n){M("ima.initialise(:done -> ADS_MANAGER_LOADED)\n%o",u()({},e,{volume:r.videoTag.volume,muted:r.videoTag.muted}));var i=new google.ima.AdsRenderingSettings;M("ima.rendering(preload: %s)",!!e.preload_ads),i.useStyledNonLinearAds=!0,i.enablePreloading=!!e.preload_ads,"number"==typeof e.media_timeout&&(i.loadVideoTimeout=e.media_timeout),i.restoreCustomPlaybackStateOnAdBreakComplete=!e.DisableCustomPlaybackForIOS10Plus,r.sharedVideoTag&&(i.playAdsAfterTime=r.videoTag.currentTime),r.eventHandler.trigger(S.a.IMA_ADS_RENDERING_SETTINGS,i);var s=r._adsManager=n.getAdsManager(r.videoTag,i);r.eventHandler.trigger(S.a.IMA_ADAPTER_INIT,s),s.addEventListener(google.ima.AdEvent.Type.LOADED,(function(){M("debug(ima.adsManager): google.ima.AdEvent.Type.LOADED")})),s.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,(function(){M("debug(ima.adsManager): google.ima.AdErrorEvent.Type.AD_ERROR")})),s.addEventListener(google.ima.AdEvent.Type.STARTED,(function(){M("debug(ima.adsManager): google.ima.AdEvent.Type.STARTED")})),s.addEventListener(google.ima.AdEvent.Type.STARTED,(function(e){a.debugEvent(e);var n=e.getAd();a._currentDuration=n.getDuration(),a._currentDisplayTs=Date.now(),r.emitWithAd(S.a.AD_STARTED,n),n.isLinear()&&t.pollRemaining({ima:a,adsManager:s})})),s.addEventListener(google.ima.AdEvent.Type.COMPLETE,(function(e){a.debugEvent(e),a.emitWithAd(S.a.AD_COMPLETED,e.getAd()),D.empty(r._timers)})),s.addEventListener(google.ima.AdEvent.Type.SKIPPED,(function(e){a.debugEvent(e),a.emitWithAd(S.a.AD_SKIPPED,e.getAd())})),s.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,(function(e){a.debugEvent(e),a.emitWithAd(S.a.AD_PAUSE_CONTENT,e.getAd())})),s.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,(function(e){a.debugEvent(e),a._started=!1,a._currentDisplayTs=0,a.eventHandler.trigger(S.a.AD_BREAK_COMPLETED)})),s.addEventListener(google.ima.AdEvent.Type.VOLUME_CHANGED,(function(e){M("IMA::volume(type: %s, event: %o)",e.type,e);var t=s.getVolume();a._volumeLevel=t,a.eventHandler.trigger(S.a.AD_VOLUME_CHANGED,t)}));var o=function(e){a._paused=e,a.eventHandler.trigger(e?S.a.AD_PAUSED:S.a.AD_RESUMED)};s.addEventListener(google.ima.AdEvent.Type.PAUSED,(function(){return o(!0)})),s.addEventListener(google.ima.AdEvent.Type.RESUMED,(function(){return o(!1)})),s.addEventListener(google.ima.AdEvent.Type.STARTED,(function(){return o(!1)})),s.addEventListener(google.ima.AdEvent.Type.VOLUME_MUTED,(function(e){M("IMA::volume(type: %s, event: %o)",e.type,e),a.eventHandler.trigger(S.a.AD_MUTED)})),s.init(r.opts.width,r.opts.height,google.ima.ViewMode.NORMAL),M("ima.initialise: done initializing")})),i&&(M("Event(reload: %s)",S.a.RELOAD_AD_REQUESTED),a.eventHandler.trigger(S.a.RELOAD_AD_REQUESTED,n)),this.eventHandler.trigger(S.a.AD_INIT,this)}},{key:"destroyManager",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"unknown";if(!this._adsManager)return M("ima::destroyManager(:skip, label: %s)",e);M("ima::destroyManager(:ok, label: %s)",e),this._adsManager.destroy()}},{key:"reset",value:function(){this.destroyManager("reset"),D.empty(this._timers),this.clearAdHandlers(),this._started=!1,this._adLoaded=!1}},{key:"cleanup",value:function(){this.destroyManager("cleanup"),this._adsLoader&&this._adsLoader.destroy(),this._adDisplayContainer&&this._adDisplayContainer.destroy(),this._adLoaded=!1}},{key:"waitForAdsManager",value:function(){var e=this;return new Promise((function(t){M("ima.waitForAdsManager:",e._adsManager),e.once(e._adsLoader,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(function(){M("ima.waitForAdsManager(:ok)",e._adsManager),t(e._adsManager)}))}))}},{key:"initAd",value:(o=s()(i.a.mark((function e(t){var r,n=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:5e3,M("ima.initAd(adTag: ".concat(t,", timeout: ").concat(r,")")),e.prev=2,e.next=5,this.requestAd(t,r);case 5:this._adLoaded=!0,e.next=13;break;case 8:throw e.prev=8,e.t0=e.catch(2),M("ima.initAd:",e.t0),this._adLoaded=!1,e.t0;case 13:return e.prev=13,D.empty(this._timers),e.finish(13);case 16:case"end":return e.stop()}}),e,this,[[2,8,13,16]])}))),function(e){return o.apply(this,arguments)})},{key:"requestAd",value:(a=s()(i.a.mark((function e(t,r){var n,a,o,l,c,d,f,h,p,v=this;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.destroyManager("requestAd"),n=this,o=this.opts.autoplay,l=void 0!==o&&o,c=Date.now(),d=this.videoTag.muted,this._volumeLevel=this.videoTag.volume,f=d||0==this._volumeLevel,n._all_ads_completed=!1,M("ima.requestAd(%o)",u()({},this.opts,{autoplay:l,muted:d,timeout:r,adTag:t,_volumeLevel:this._volumeLevel,manager:this._adsManager})),this.clearAdHandlers(),(h=new google.ima.AdsRequest).adTagUrl=t,h.linearAdSlotWidth=this.opts.width,h.linearAdSlotHeight=this.opts.height,this.opts.disable_non_linear_ads||(h.nonLinearAdSlotWidth=this.opts.width),this.opts.disable_non_linear_ads||(h.nonLinearAdSlotHeight=this.opts.height-50),h.setAdWillAutoPlay(l),h.setAdWillPlayMuted(f),h.vastLoadTimeout=r,this.eventHandler.trigger(S.a.IMA_BEFORE_ADS_REQUEST,{request:h}),this._adsLoader.requestAds(h),p=new Promise(function(){var e=s()(i.a.mark((function e(t,s){var o,u,l,d,h;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(){clearTimeout(l),t.apply(void 0,arguments)},u=function(){clearTimeout(l),s.apply(void 0,arguments)},v.once(v._adsLoader,google.ima.AdErrorEvent.Type.AD_ERROR,(function(e){v.emitError(S.a.AD_REQUEST_ERROR,e),u(new Error("Ad load failed"))})),l=setTimeout((function(){var e=new Error("Ad internal timeout reached");v.eventHandler.trigger(S.a.AD_TIMEOUT,e),s(e)}),1.5*(r+(v.opts.media_timeout||5e3))),e.next=6,n.waitForAdsManager();case 6:if(d=e.sent,v.volume(f?0:v._volumeLevel),n.eventHandler.trigger(S.a.AD_VOLUME_CHANGED,v._volumeLevel),!(h=v.cuepoints())||!h.length||0===h[0]){e.next=12;break}return e.abrupt("return",o({ad:!1,adsManager:d}));case 12:v.once(d,google.ima.AdErrorEvent.Type.AD_ERROR,(function(e){v.emitError(S.a.AD_PLAYBACK_ERROR,e),u(e)})),v.once(d,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,(function(){v._all_ads_completed=!0,o()})),v.once(d,google.ima.AdEvent.Type.LOADED,(function(e){v.eventHandler.trigger(S.a.AD_REQUEST_COMPLETED,{request_load_time:Date.now()-c}),a=e.getAd(),M("ima.requestAd: AD_REQUEST_COMPLETED",a.getContentType()),"application/javascript"==a.getContentType()&&v.eventHandler.trigger(S.a.VPAID_INIT,a),o()})),v.once(d,google.ima.AdEvent.Type.CLICK,(function(){M("ima.requestAd: click event"),n.pause()}));case 16:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("return",p);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"playAd",value:(n=s()(i.a.mark((function e(){var t;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(M("ima.playAd()",this),this._adsManager&&this._adLoaded){e.next=3;break}return e.abrupt("return");case 3:if(t=this._adsManager.getCurrentAd()){e.next=6;break}return e.abrupt("return");case 6:if(!this.sharedVideoTag||t.isLinear()){e.next=8;break}return e.abrupt("return");case 8:return e.prev=8,e.next=11,this.startAndWaitForAdCompletion(this._adsManager,t.isLinear());case 11:e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(8),M("ima.playAd",e.t0),e.t0;case 17:return e.prev=17,this._adLoaded=!1,D.empty(this._timers),e.finish(17);case 21:case"end":return e.stop()}}),e,this,[[8,13,17,21]])}))),function(){return n.apply(this,arguments)})},{key:"startAndWaitForAdCompletion",value:function(e,r){var n=this;if(!this._started){M("ima.startAndWaitForAdCompletion(manager: %o)",{volume:e.getVolume()});var a=this;return new Promise((function(o,u){var l=!1;a.once(e,google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,(function(){if(M("ima.startAndWaitForAdCompletion: CONTENT_RESUME_REQUESTED <<< happened"),a._started=!1,l)return M("ima.startAndWaitForAdCompletion: Content resume requested, but trying to recover from ad error");o()})),a.once(e,google.ima.AdErrorEvent.Type.AD_ERROR,function(){var e=s()(i.a.mark((function e(r){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return M("ima.startAndWaitForAdCompletion: beginning error recovery ->",r),l=!0,e.prev=2,e.next=5,t.pollForFatalError({err:r,ima:a});case 5:e.sent.ok&&(l=!1),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(2),a._started=!1,u(r);case 14:case"end":return e.stop()}}),e,this,[[2,10]])})));return function(t){return e.apply(this,arguments)}}()),r&&(n._started=!0),e.start(),n.eventHandler.trigger(S.a.AD_PLAY_REQUESTED)}))}}},{key:"pause",value:function(){M("ima.pause()"),this._adsManager&&this._adsManager.pause()}},{key:"resume",value:function(){M("ima.resume()"),this._adsManager&&this._adsManager.resume()}},{key:"volume",value:function(e){try{return arguments.length>0&&"number"==typeof e&&this._adsManager.setVolume(e),this._volumeLevel=this._adsManager.getVolume()}catch(e){M("ima.volume() failed (%o)",e)}}},{key:"onResize",value:function(e){var t=e.width,r=e.height,n=e.linear,i=e.silent,a=e.resize_non_linear;this.opts&&(t||r)&&(n&&(this.opts.width=t,this.opts.height=r),this._adsManager&&(n||a)&&(i||M("ima.onResize %s x %s",t,r),this._adsManager.resize(t,r,google.ima.ViewMode.NORMAL)))}},{key:"currentAd",value:function(){return this._adsManager&&this._adsManager.getCurrentAd()}},{key:"isAdPod",value:function(){return this.cuepoints()&&this.cuepoints().length>1}},{key:"cuepoints",value:function(){return this._adsManager&&this._adsManager.getCuePoints()}},{key:"contentComplete",value:(r=s()(i.a.mark((function e(){var r=this;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(M("ima.contentComplete() -> ",this),this._adsLoader&&this._adsLoader.contentComplete(),this.cuepoints()&&-1!==this.cuepoints().indexOf(-1)){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,new Promise((function(e){t.race(r.eventHandler,[S.a.AD_BREAK_COMPLETED,S.a.AD_ERROR],e)}));case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"isUiDisabled",value:function(){return this.currentAd()&&this.currentAd().isUiDisabled()}},{key:"getAdPodInfo",value:function(){try{return this.currentAd()&&this.currentAd().getAdPodInfo()}catch(e){return null}}},{key:"canDismissNonLinear",value:function(){var e=this.currentAd();if(!e||e.isLinear()||!this._adsManager||!this._currentDisplayTs)return!0;var t=Date.now(),r=e.getMinSuggestedDuration();return t-this._currentDisplayTs>1e3*r}},{key:"once",value:function(e,t,r){this._adHandlers.push(function(e,t,r){var n=function n(i){r(i),e.removeEventListener(t,n)};return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}}(e,t,r))}},{key:"clearAdHandlers",value:function(){M("ima.clearAdHandlers"),this._adHandlers.forEach((function(e){return e()})),this._adHandlers=[]}},{key:"emitWithAd",value:function(e,t){var r={ad_type:R.a.kindOf(P(t)),ad:{duration:t.getDuration(),width:t.getWidth(),height:t.getHeight()},volume:this._adsManager.getVolume(),vast_ad_id:t.getAdId(),linear:t.isLinear(),mime_type:t.getContentType(),ima_event:!0};M("emitWithAd::event(name: ".concat(e,", data: %o, ad: %o)"),r,t),this.eventHandler.trigger(e,r)}},{key:"emitError",value:function(e,t){var r={vast_error_type:t.getError().getType(),reason:t.getError().getMessage(),vast_error:t.getError().getErrorCode()};M("ima.error(".concat(e,")"),r),this.eventHandler.trigger(e,r)}},{key:"debugEvent",value:function(e){try{var t=e.getAd();if(!t)return;M("ima.event.".concat(e.type," ->"),{event:e,data:e.getAdData(),position:P(t),ad:t})}catch(e){}}}],[{key:"unwrapError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"function"==typeof e.getMessage?e.getMessage():e.message?e.message:t}},{key:"pollForFatalError",value:function(e){var r,n=e.err,i=e.ima;try{var a=n.getError(),s=t.unwrapError(a.getInnerError(),a);r={reason:s,type:a.getType(),code:a.getErrorCode()},M("ima.pollForFatalError",r)}catch(n){M("ima.pollForFatalError",n)}var o=i._currentRemaining;return new Promise((function(e,t){var n=setTimeout((function(){M("ima.pollForFatalError: Ad errored and not progressing, reject"),i.eventHandler&&i.eventHandler.trigger(S.a.AD_PLAYBACK_ERROR,r),t(new Error("Ad not progressing"))}),2500);i.eventHandler.once(S.a.AD_PROGRESS,(function(t){-1!==t.remaining&&t.remaining<o&&(M("ima.pollForFatalError: Ad still progressing even though errored, skip error rejection"),clearTimeout(n),e({ok:1}))}))}))}},{key:"pollRemaining",value:function(e){var t=e.ima,r=e.adsManager;return M("ima.pollRemaining"),D.createInterval(t._timers,250,(function(){t._currentRemaining=r.getRemainingTime(),t.eventHandler.trigger(S.a.AD_PROGRESS,{remaining:t._currentRemaining,duration:t._currentDuration})}))}},{key:"race",value:function(e,t,r){t.forEach((function(n){e.on(n,(function n(){t.forEach((function(t){return e.removeListener(t,n)}));for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];r(a)}))}))}}]),t}(x),F=function(){function e(){c()(this,e)}return f()(e,null,[{key:"create",value:function(e,t){return e.adapter?new e.adapter(t):new N(t)}}]),e}(),U=r(29),B=r(17),j=r.n(B),G=r(30),H=r.n(G),K=r(7)("fpads:macros"),V=/\[([\s\S]+?)\]/g,W=function(){function e(t,r){c()(this,e),this.vars=t,this.pattern=r}return f()(e,null,[{key:"of",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:V;return new e(t,r)}},{key:"run",value:function(e){try{return e()}catch(e){return void console.error(e)}}},{key:"merge",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.reduce((function(e,t){return Object.assign(e,t)}),{})}},{key:"cast",value:function(t){var r=L()(t);return"undefined"===r?"":("function"===r&&(t=e.run(t)),encodeURIComponent(t))}},{key:"normalize",value:function(e){return e.trim()}},{key:"process_obj",value:function(t,r,n){return Object.keys(t).reduce((function(i,a){var s=e.process_str(a,r,n,!0),o=t[a];return null===o?(i[s]=o,i):"object"==L()(o)?(i[s]=e.process_obj(o,r,n),i):"string"==typeof o?(i[s]=e.process_str(o,r,n),i):void console.error(new Error("".concat(o," at ").concat(a," not a handled Macro type")))}),{})}},{key:"process_str",value:function(t,r,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return t.replace(r.pattern,(function(t,r){var a=e.normalize(r);if(!(a in n)||void 0===n[a])return t;var s=n[a],o=i?s:e.cast(s);return K("Macro.replace(raw: %s, macro: %s, value: %s)",i,r,o),o}))}}]),f()(e,[{key:"fork",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.pattern,n=e.merge(this.vars,t);return e.of(n,r)}},{key:"compile",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.merge(this.vars,r),i=t.split("?"),a=j()(i,2),s=a[0],o=a[1],u=H.a.parse(o||"",{strictNullHandling:!0,decoder:function(e){return e}}),l=H.a.stringify(e.process_obj(u,this,n),{encode:!1,strictNullHandling:!0});return e.process_str(s,this,n,!0)+"?"+l}}]),e}();function q(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{width:0,height:0};try{var i=document.createElement("a");i.href=t=window.location!=window.parent.location?document.referrer:document.location.href,r=i.hostname}catch(e){console.error(e)}var a=n.width,s=n.height,o=e||{},l=o.video_source,c="object"==L()(window.__flowplayerAdParameters)?window.__flowplayerAdParameters:{};return u()({random:Date.now(),page_url:t,domain:r,player_width:a,player_height:s,video_url:l,videourl:l},c)}function Y(e){return z.apply(this,arguments)}function z(){return(z=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"==typeof t){e.next=2;break}return e.abrupt("return",t);case 2:return e.prev=2,e.next=5,t();case 5:return e.abrupt("return",e.sent);case 8:return e.prev=8,e.t0=e.catch(2),e.abrupt("return","");case 11:case"end":return e.stop()}}),e,this,[[2,8]])})))).apply(this,arguments)}function X(e){return Q.apply(this,arguments)}function Q(){return(Q=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=L()(t),e.next="function"===e.t0||"string"===e.t0?3:"object"===e.t0?7:8;break;case 3:return e.next=5,Y(t);case 5:return e.t1=e.sent,e.abrupt("return",[e.t1]);case 7:return e.abrupt("return",Array.isArray(t)?Promise.all(t.map(Y)):X(t.adTag||[]));case 8:throw new Error("\n unhandled ads type ".concat(L()(t),":\n ").concat(JSON.stringify(t),"\n can be:\n | Array<string>\n | string\n | function\n | {adTag: Array<string>|string|function}\n "));case 9:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}Object.assign(W,{patterns:{BRACKETS:V,CURLY:/\{([\s\S]+?)\}/g,UNDERSCORE:/__([\s\S]+?)__/g}});var J=Object.prototype,Z=Object.getPrototypeOf;function $(e){return null!==e&&"object"===L()(e)&&Z(e)===J}var ee=r(7)("fpads:ads:state"),te={IDLE:0,INITIALIZING:1,FETCHING_AD:2,AD_AVAILABLE:4,BREAK_ACTIVE:8,PLAYING:16,FATAL_ERROR:32},re=function(){function e(){c()(this,e),this._state=0}return f()(e,null,[{key:"of",value:function(){return new e}}]),f()(e,[{key:"reset",value:function(){this._state=0}},{key:"toString",value:function(){var e=this;return 0==this._state?"AdState(None)":"AdState("+Object.keys(te).reduce((function(t,r){return e.hasAny(te[r])?t+r+": "+!!e.hasAny(te[r])+" ":t}),"").trim()+")"}},{key:"toggleState",value:function(e,t){return void 0===e&&ee(new Error("AdState cannot toggleState for `undefined`")),null==L()(t)?this._state^=e:t?void(this._state|=e):this._state&=~e}},{key:"hasAll",value:function(e){return this._state==(this._state|e)}},{key:"hasAny",value:function(e){return this._state&e}},{key:"state",get:function(){return this._state}}]),e}(),ne=r(7)("fpads:ads"),ie={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10},ae=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return c()(this,t),(e=p()(this,g()(t).call(this))).adapter=F.create(r,_()(_()(e))),e.opts=u()({},ie),e.analytics=void 0,e._state=re.of(),e._schedule=void 0,e._lastAd=void 0,e._macros=W.of(r.parameters||{}),e.wireup(),e}var r,n,a,o,l,d,h,v;return y()(t,e),f()(t,[{key:"reset",value:function(){return this.removeAllListeners(),this.wireup(),this.analytics&&this.analytics.wireup(),this._state.reset(),this.adapter.reset(),this}},{key:"destroy",value:function(){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}},{key:"stop",value:function(){this.adapter&&this.adapter.stop()}},{key:"wireup",value:function(){var e=this,t=function(){return e._state.toggleState(te.PLAYING,!0)};this.on(S.a.AD_PLAY_REQUESTED,t),this.on(S.a.AD_STARTED,t),this.on(S.a.AD_RESUMED,t);var r=function(){return e._state.toggleState(te.PLAYING,!1)};this.on(S.a.AD_BREAK_COMPLETED,r),this.on(S.a.AD_TEARDOWN,r),this.on(S.a.AD_PLAYBACK_ERROR,r),this.on(S.a.AD_REQUEST_ERROR,r),this.on(S.a.AD_PAUSED,r),this.on(S.a.AD_SKIPPED,r),this.on(S.a.AD_COMPLETED,r),this.on(S.a.AD_BREAK_COMPLETED,(function(){e._state.toggleState(te.BREAK_ACTIVE,!1)})),this.on(S.a.ADAPTER_INIT_FAILED,(function(){console.error("Adapter init failed"),r(),e._state.toggleState(te.FATAL_ERROR,!0)})),this.on(S.a.RELOAD_AD_REQUESTED,function(){var t=s()(i.a.mark((function t(n){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(ne("Ads.on(RELOAD_AD_REQUESTED)",n),r(),!n){t.next=4;break}return t.abrupt("return",e._schedule.reset(e._schedule.getAds()));case 4:e._state.hasAny(te.AD_AVAILABLE)&&(e._schedule.decrement(),e._state.toggleState(te.AD_AVAILABLE,!1));case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}())}},{key:"initialize",value:(v=s()(i.a.mark((function e(t){var r,n,a=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},n=a.length>2?a[2]:void 0,ne("Ads.initialize():",t,r,n),this._state.toggleState(te.INITIALIZING,!0),this.opts=Object.assign({},this.opts,r),Array.isArray(t)&&this.setSchedule(t),e.next=8,this.adapter.init(this.opts);case 8:if(this._macros=this._macros.fork(Object.assign({},r.parameters||{},{autoplay:r.autoplay,muted:r.muted})),!this.adapter.isReady()){e.next=12;break}return e.next=12,this.adapterInitialized(n);case 12:return e.abrupt("return",this);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"setVideoTag",value:(h=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ne("Ads.setVideoTag():",t),e.next=3,this.adapter.setVideoTag(t);case 3:if(this.trigger(S.a.AD_VIDEOTAG_ATTACHED,t),!this.adapter.isReady()){e.next=7;break}return e.next=7,this.adapterInitialized();case 7:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"waitForVideoTag",value:function(){var e=this;return new Promise((function(t){var r=e.adapter.videoTag;if(r)return t(r);e.on(S.a.AD_VIDEOTAG_ATTACHED,(function(r){e.once(S.a.AD_INIT,(function(){return t(r)}))}))}))}},{key:"adapterInitialized",value:(d=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ne("Ads.adapterInitialized()"),this._state.toggleState(te.INITIALIZING,!1),this._state.toggleState(te.BREAK_ACTIVE,this.hasPreroll()),e.next=5,this.setCurrentTime(0,t);case 5:this.checkIfBreakComplete(),t&&!this.opts.autoplay||this.trigger(S.a.AD_TEARDOWN);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"fetchNextAd",value:(l=s()(i.a.mark((function e(t){var r,n,a=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>1&&void 0!==a[1]?a[1]:0,this.adapter.isReady()){e.next=3;break}return e.abrupt("return");case 3:if(!(r>50)){e.next=7;break}throw this._state.toggleState(te.FATAL_ERROR,!0),this._state.toggleState(te.FETCHING_AD,!1),new Error("Ads.fetchNextAd() :max_recursion_depth");case 7:if(!(n=this._schedule.getNextAd()||this._schedule.getPostroll())||this.adapter.canDismissNonLinear()||-1===t){e.next=10;break}return e.abrupt("return",!1);case 10:if(!this._schedule.waitForLoad(t,n,this.opts.preload_ads)){e.next=13;break}return this._state.toggleState(te.FETCHING_AD,!1),e.abrupt("return",!1);case 13:if(n===this._schedule.getPostroll()&&this._schedule.setPostrollActive(),this._schedule.isDrained()||this._schedule.increment(),n){e.next=18;break}return this._state.toggleState(te.FETCHING_AD,!1),e.abrupt("return",!1);case 18:return ne("Ads.fetchNextAd",n),this._state.toggleState(te.FETCHING_AD,!0),e.prev=20,e.next=23,this.requestAd(n);case 23:return this._state.toggleState(te.AD_AVAILABLE,!0),this._state.toggleState(te.FETCHING_AD,!1),e.abrupt("return",this);case 28:if(e.prev=28,e.t0=e.catch(20),ne("Ads.fetchNextAd(err: %o, ad: %o)",e.t0,n),this.setLastAd(n),n===this._schedule.getPostroll()){e.next=36;break}return e.next=35,this.fetchNextAd(t,++r);case 35:return e.abrupt("return",e.sent);case 36:case"end":return e.stop()}}),e,this,[[20,28]])}))),function(e){return l.apply(this,arguments)})},{key:"skipAdsOnSeek",value:function(e){for(var t=this._schedule.getNextAd();t&&t.time<e;)this._schedule.increment(),t=this._schedule.getNextAd()}},{key:"setCurrentTime",value:(o=s()(i.a.mark((function e(t,r){var n,a,s=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=s.length>2&&void 0!==s[2]&&s[2],this._schedule){e.next=3;break}return e.abrupt("return");case 3:if(this.adapter.isReady()){e.next=5;break}return e.abrupt("return");case 5:if(!this._state.hasAny(te.FETCHING_AD)){e.next=7;break}return e.abrupt("return");case 7:if(!this._state.hasAny(te.PLAYING)||!this.adapter.adLinear){e.next=9;break}return e.abrupt("return");case 9:if(a=0===t&&0===this._schedule.getNextIndex(),e.prev=10,n&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(t),this._state.hasAny(te.AD_AVAILABLE)){e.next=15;break}return e.next=15,this.fetchNextAd(t);case 15:if(this._state.hasAny(te.AD_AVAILABLE)&&this.shallPlayAd(t)&&!r){e.next=17;break}return e.abrupt("return");case 17:return e.next=19,this.playAd();case 19:return e.next=21,this.setCurrentTime(t);case 21:this.checkIfBreakComplete(),e.next=27;break;case 24:e.prev=24,e.t0=e.catch(10),ne("setCurrentTime: Error(from: setCurrentTime, message: %s)",e.t0.message);case 27:return e.prev=27,a&&this.trigger(S.a.AD_PREROLL_FINSIHED),e.finish(27);case 30:case"end":return e.stop()}}),e,this,[[10,24,27,30]])}))),function(e,t){return o.apply(this,arguments)})},{key:"playAd",value:(a=s()(i.a.mark((function e(){var t;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._state.hasAny(te.AD_AVAILABLE)){e.next=2;break}return e.abrupt("return");case 2:return this._state.toggleState(te.AD_AVAILABLE,!1),this._state.toggleState(te.BREAK_ACTIVE,!0),e.prev=4,t=this._schedule.getCurrentAd(),e.next=8,this.adapter.playAd();case 8:t&&this.setLastAd(t),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),console.error("Ads.playAd: error",e.t0);case 14:case"end":return e.stop()}}),e,this,[[4,11]])}))),function(){return a.apply(this,arguments)})},{key:"checkIfBreakComplete",value:function(){if(!this._state.hasAny(te.BREAK_ACTIVE))return ne("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());ne("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(te.BREAK_ACTIVE,!1),this.adapter.isAdPod()||this.trigger(S.a.AD_BREAK_COMPLETED)}},{key:"resetScheduleCounter",value:function(){this._schedule&&this._schedule.resetCounter()}},{key:"setSchedule",value:function(e,t){if(!isNaN(t)&&this._schedule&&this._schedule.updateContentDuration(t),this._schedule&&this._schedule.getNextIndex()>0)return this._schedule.setAds(e);this._schedule=R.a.of(e,{preload_advance:this.opts.preload_advance,content_duration:isNaN(t)?0:t})}},{key:"toJSON",value:function(){return this._schedule?this._schedule.toJSON():[]}},{key:"trigger",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._state){if(e===S.a.AD_BREAK_COMPLETED&&this._state.hasAny(te.BREAK_ACTIVE)&&!this.adapter.isAdPod())return ne("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if($(t)&&(t=Object.assign({},this.adapter.opts||{},this._schedule.getCurrentAd()||{},{ad_type:this.ad_type},t)).ima_event&&"preroll"===t.ad_type&&(t.ad_type=this.ad_type),this.adapter.videoTag){var r=document.createEvent("Event");r.initEvent(e,!1,!1),r.data=t,this.adapter.videoTag.dispatchEvent(r)}U.EventEmitter.prototype.emit.apply(this,[e,t])}}},{key:"shouldRestartContent",value:function(){var e=this.getLastAd();return!e.outstream&&!1!==e.restart}},{key:"finished",value:(n=s()(i.a.mark((function e(t){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ne("Ads.finished"),!(this.adapter.sharedVideoTag&&this._state.hasAny(te.PLAYING)&&this.adapter.adLinear)){e.next=3;break}return e.abrupt("return");case 3:if(ne("Ads.finished: trying to play postroll"),e.prev=4,this._schedule.getPostroll()){e.next=10;break}return ne("Ads.finished: no postroll found"),e.next=9,this.adapter.contentComplete();case 9:return e.abrupt("return",e.sent);case 10:if(this._state.hasAny(te.AD_AVAILABLE)){e.next=13;break}return e.next=13,this.fetchNextAd(-1);case 13:return e.next=15,this.playAd();case 15:this.adapter.contentComplete(),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(4),ne("Ads.finished: postroll failed:",e.t0);case 21:return e.prev=21,this.trigger(S.a.AD_POSTROLL_FINISHED),this.checkIfBreakComplete(),"function"==typeof t&&t(),e.finish(21);case 26:case"end":return e.stop()}}),e,this,[[4,18,21,26]])}))),function(e){return n.apply(this,arguments)})},{key:"hasPreroll",value:function(){return this._schedule&&R.a.hasPreroll(this._schedule.getAds())}},{key:"shallPlayAd",value:function(e){return(!this.adapter||!this.adapter.isAdPod())&&!(!this._state||this._state.hasAny(te.FATAL_ERROR))&&this._schedule.shallPlayAd(e)}},{key:"setLastAd",value:function(e){return this._lastAd=e,this}},{key:"getLastAd",value:function(){return this._lastAd||{}}},{key:"mergeMacros",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._macros=this._macros.fork(Object.assign({},e)),this}},{key:"pause",value:function(){this.adapter&&this.adapter.pause()}},{key:"resume",value:function(){this.adapter&&this.adapter.resume()}},{key:"resize",value:function(e){this.adapter&&this.adapter.resize(e)}},{key:"requestAd",value:(r=s()(i.a.mark((function e(t){var r,n,a,s,o,u=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:0,n=u.length>2&&void 0!==u[2]?u[2]:this.opts.timeout,this._state){e.next=4;break}return e.abrupt("return");case 4:return ne("Ads.requestAd(ad: %o)",{ad:t,timeout:n,idx:r}),e.next=7,X(t);case 7:if(void 0!==(a=e.sent)[r]){e.next=10;break}return e.abrupt("return",Promise.reject(new Error("Ad failed, no fallbacks left")));case 10:if(a[r]){e.next=14;break}return e.next=13,this.requestAd(a,r+1,n);case 13:return e.abrupt("return",e.sent);case 14:return this.trigger(S.a.AD_REQUESTED,t),s=this._macros.compile(a[r],q(this.opts,this.adapter.dimensions)),e.prev=16,e.next=19,this.adapter.initAd(s,n);case 19:return o=e.sent,e.abrupt("return",{ok:o});case 23:return e.prev=23,e.t0=e.catch(16),ne("Ads.requestAd(:fallback, idx: ".concat(r,", length: ").concat(a.length,", adTag: ").concat(a[r],")\nError "),{adTag:a,err:e.t0}),e.abrupt("return",this.requestAd(a,r+1,n));case 27:case"end":return e.stop()}}),e,this,[[16,23]])}))),function(e){return r.apply(this,arguments)})},{key:"resetSchedule",value:function(e){this._schedule&&this._schedule.reset(e)}},{key:"ad_type",get:function(){return this._schedule&&this._schedule.getCurrentType()}},{key:"paused",get:function(){return this.adapter&&this.adapter.paused}},{key:"adPlaying",get:function(){return this._state&&this._state.hasAny(te.PLAYING)}},{key:"adBreak",get:function(){return this._state&&this._state.hasAny(te.BREAK_ACTIVE)}}]),t}(U.EventEmitter)},function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(t,n)}e.exports=r},function(e,t,r){r(54),e.exports=r(10).Object.assign},function(e,t,r){var n=r(14);n(n.S+n.F,"Object",{assign:r(63)})},function(e,t,r){var n=r(56),i=r(57),a=r(59),s=Object.defineProperty;t.f=r(22)?Object.defineProperty:function(e,t,r){if(n(e),t=a(t,!0),n(r),i)try{return s(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},function(e,t,r){var n=r(15);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,r){e.exports=!r(22)&&!r(23)((function(){return 7!=Object.defineProperty(r(58)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,r){var n=r(15),i=r(13).document,a=n(i)&&n(i.createElement);e.exports=function(e){return a?i.createElement(e):{}}},function(e,t,r){var n=r(15);e.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,r){var n=r(13),i=r(21),a=r(32),s=r(24)("src"),o=Function.toString,u=(""+o).split("toString");r(10).inspectSource=function(e){return o.call(e)},(e.exports=function(e,t,r,o){var l="function"==typeof r;l&&(a(r,"name")||i(r,"name",t)),e[t]!==r&&(l&&(a(r,s)||i(r,s,e[t]?""+e[t]:u.join(String(t)))),e===n?e[t]=r:o?e[t]?e[t]=r:i(e,t,r):(delete e[t],i(e,t,r)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[s]||o.call(this)}))},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,r){var n=r(34),i=r(70),a=r(40),s=r(41),o=r(26),u=Object.assign;e.exports=!u||r(23)((function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=u({},e)[r]||Object.keys(u({},t)).join("")!=n}))?function(e,t){for(var r=s(e),u=arguments.length,l=1,c=i.f,d=a.f;u>l;)for(var f,h=o(arguments[l++]),p=c?n(h).concat(c(h)):n(h),v=p.length,g=0;v>g;)d.call(h,f=p[g++])&&(r[f]=h[f]);return r}:u},function(e,t,r){var n=r(32),i=r(25),a=r(65)(!1),s=r(67)("IE_PROTO");e.exports=function(e,t){var r,o=i(e),u=0,l=[];for(r in o)r!=s&&n(o,r)&&l.push(r);for(;t.length>u;)n(o,r=t[u++])&&(~a(l,r)||l.push(r));return l}},function(e,t,r){var n=r(25),i=r(37),a=r(66);e.exports=function(e){return function(t,r,s){var o,u=n(t),l=i(u.length),c=a(s,l);if(e&&r!=r){for(;l>c;)if((o=u[c++])!=o)return!0}else for(;l>c;c++)if((e||c in u)&&u[c]===r)return e||c||0;return!e&&-1}}},function(e,t,r){var n=r(38),i=Math.max,a=Math.min;e.exports=function(e,t){return(e=n(e))<0?i(e+t,0):a(e,t)}},function(e,t,r){var n=r(39)("keys"),i=r(24);e.exports=function(e){return n[e]||(n[e]=i(e))}},function(e,t){e.exports=!1},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,r){r(72),e.exports=r(10).Object.values},function(e,t,r){var n=r(14),i=r(42)(!1);n(n.S,"Object",{values:function(e){return i(e)}})},function(e,t,r){r(74),e.exports=r(10).Object.entries},function(e,t,r){var n=r(14),i=r(42)(!0);n(n.S,"Object",{entries:function(e){return i(e)}})},function(e,t,r){r(76),e.exports=r(10).Array.find},function(e,t,r){var n=r(14),i=r(77)(5),a=!0;"find"in[]&&Array(1).find((function(){a=!1})),n(n.P+n.F*a,"Array",{find:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),r(81)("find")},function(e,t,r){var n=r(33),i=r(26),a=r(41),s=r(37),o=r(78);e.exports=function(e,t){var r=1==e,u=2==e,l=3==e,c=4==e,d=6==e,f=5==e||d,h=t||o;return function(t,o,p){for(var v,g,m=a(t),y=i(m),E=n(o,p,3),_=s(y.length),T=0,b=r?h(t,_):u?h(t,0):void 0;_>T;T++)if((f||T in y)&&(g=E(v=y[T],T,m),e))if(r)b[T]=g;else if(g)switch(e){case 3:return!0;case 5:return v;case 6:return T;case 2:b.push(v)}else if(c)return!1;return d?-1:l||c?c:b}}},function(e,t,r){var n=r(79);e.exports=function(e,t){return new(n(e))(t)}},function(e,t,r){var n=r(15),i=r(80),a=r(43)("species");e.exports=function(e){var t;return i(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!i(t.prototype)||(t=void 0),n(t)&&null===(t=t[a])&&(t=void 0)),void 0===t?Array:t}},function(e,t,r){var n=r(35);e.exports=Array.isArray||function(e){return"Array"==n(e)}},function(e,t,r){var n=r(43)("unscopables"),i=Array.prototype;null==i[n]&&r(21)(i,n,{}),e.exports=function(e){i[n][e]=!0}},function(e,t,r){var n=function(){return this||"object"==typeof self&&self}()||Function("return this")(),i=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,a=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,e.exports=r(83),i)n.regeneratorRuntime=a;else try{delete n.regeneratorRuntime}catch(e){n.regeneratorRuntime=void 0}},function(e,t){!function(t){var r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag",u="object"==typeof e,l=t.regeneratorRuntime;if(l)u&&(e.exports=l);else{(l=t.regeneratorRuntime=u?e.exports:{}).wrap=v;var c={},d={};d[a]=function(){return this};var f=Object.getPrototypeOf,h=f&&f(f(k([])));h&&h!==r&&n.call(h,a)&&(d=h);var p=E.prototype=m.prototype=Object.create(d);y.prototype=p.constructor=E,E.constructor=y,E[o]=y.displayName="GeneratorFunction",l.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,o in e||(e[o]="GeneratorFunction")),e.prototype=Object.create(p),e},l.awrap=function(e){return{__await:e}},_(T.prototype),T.prototype[s]=function(){return this},l.AsyncIterator=T,l.async=function(e,t,r,n){var i=new T(v(e,t,r,n));return l.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(p),p[o]="Generator",p[a]=function(){return this},p.toString=function(){return"[object Generator]"},l.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},l.values=k,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(o&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,c):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:k(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}}}function v(e,t,r,n){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),s=new L(n||[]);return a._invoke=function(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var o=b(s,r);if(o){if(o===c)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=g(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,s),a}function g(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function m(){}function y(){}function E(){}function _(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function T(e){var t;this._invoke=function(r,i){function a(){return new Promise((function(t,a){!function t(r,i,a,s){var o=g(e[r],e,i);if("throw"!==o.type){var u=o.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?Promise.resolve(l.__await).then((function(e){t("next",e,a,s)}),(function(e){t("throw",e,a,s)})):Promise.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return t("throw",e,a,s)}))}s(o.arg)}(r,i,t,a)}))}return t=t?t.then(a,a):a()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=g(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,c;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function k(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}}(function(){return this||"object"==typeof self&&self}()||Function("return this")())},function(e,t,r){var n=r(8);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=n(e)););return e}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw a}}return r}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t,r){var n=r(44),i=r(45),a={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},s=Date.prototype.toISOString,o={delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,serializeDate:function(e){return s.call(e)},skipNulls:!1,strictNullHandling:!1},u=function e(t,r,i,a,s,u,l,c,d,f,h,p){var v=t;if("function"==typeof l)v=l(r,v);else if(v instanceof Date)v=f(v);else if(null===v){if(a)return u&&!p?u(r,o.encoder):r;v=""}if("string"==typeof v||"number"==typeof v||"boolean"==typeof v||n.isBuffer(v))return u?[h(p?r:u(r,o.encoder))+"="+h(u(v,o.encoder))]:[h(r)+"="+h(String(v))];var g,m=[];if(void 0===v)return m;if(Array.isArray(l))g=l;else{var y=Object.keys(v);g=c?y.sort(c):y}for(var E=0;E<g.length;++E){var _=g[E];s&&null===v[_]||(m=Array.isArray(v)?m.concat(e(v[_],i(r,_),i,a,s,u,l,c,d,f,h,p)):m.concat(e(v[_],r+(d?"."+_:"["+_+"]"),i,a,s,u,l,c,d,f,h,p)))}return m};e.exports=function(e,t){var r=e,s=t?n.assign({},t):{};if(null!==s.encoder&&void 0!==s.encoder&&"function"!=typeof s.encoder)throw new TypeError("Encoder has to be a function.");var l=void 0===s.delimiter?o.delimiter:s.delimiter,c="boolean"==typeof s.strictNullHandling?s.strictNullHandling:o.strictNullHandling,d="boolean"==typeof s.skipNulls?s.skipNulls:o.skipNulls,f="boolean"==typeof s.encode?s.encode:o.encode,h="function"==typeof s.encoder?s.encoder:o.encoder,p="function"==typeof s.sort?s.sort:null,v=void 0!==s.allowDots&&s.allowDots,g="function"==typeof s.serializeDate?s.serializeDate:o.serializeDate,m="boolean"==typeof s.encodeValuesOnly?s.encodeValuesOnly:o.encodeValuesOnly;if(void 0===s.format)s.format=i.default;else if(!Object.prototype.hasOwnProperty.call(i.formatters,s.format))throw new TypeError("Unknown format option provided.");var y,E,_=i.formatters[s.format];"function"==typeof s.filter?r=(E=s.filter)("",r):Array.isArray(s.filter)&&(y=E=s.filter);var T,b=[];if("object"!=typeof r||null===r)return"";T=s.arrayFormat in a?s.arrayFormat:"indices"in s?s.indices?"indices":"repeat":"indices";var S=a[T];y||(y=Object.keys(r)),p&&y.sort(p);for(var A=0;A<y.length;++A){var L=y[A];d&&null===r[L]||(b=b.concat(u(r[L],L,S,c,d,f?h:null,E,p,v,g,_,m)))}var k=b.join(l),w=!0===s.addQueryPrefix?"?":"";return k.length>0?w+k:""}},function(e,t,r){var n=r(44),i=Object.prototype.hasOwnProperty,a={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:n.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},s=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/g,s=/(\[[^[\]]*])/.exec(n),o=s?n.slice(0,s.index):n,u=[];if(o){if(!r.plainObjects&&i.call(Object.prototype,o)&&!r.allowPrototypes)return;u.push(o)}for(var l=0;null!==(s=a.exec(n))&&l<r.depth;){if(l+=1,!r.plainObjects&&i.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(s[1])}return s&&u.push("["+n.slice(s.index)+"]"),function(e,t,r){for(var n=t,i=e.length-1;i>=0;--i){var a,s=e[i];if("[]"===s)a=(a=[]).concat(n);else{a=r.plainObjects?Object.create(null):{};var o="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,u=parseInt(o,10);!isNaN(u)&&s!==o&&String(u)===o&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(a=[])[u]=n:a[o]=n}n=a}return n}(u,t,r)}};e.exports=function(e,t){var r=t?n.assign({},t):{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.ignoreQueryPrefix=!0===r.ignoreQueryPrefix,r.delimiter="string"==typeof r.delimiter||n.isRegExp(r.delimiter)?r.delimiter:a.delimiter,r.depth="number"==typeof r.depth?r.depth:a.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:a.arrayLimit,r.parseArrays=!1!==r.parseArrays,r.decoder="function"==typeof r.decoder?r.decoder:a.decoder,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:a.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:a.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:a.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:a.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:a.strictNullHandling,""===e||null==e)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof e?function(e,t){for(var r={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=n.split(t.delimiter,s),u=0;u<o.length;++u){var l,c,d=o[u],f=d.indexOf("]="),h=-1===f?d.indexOf("="):f+1;-1===h?(l=t.decoder(d,a.decoder),c=t.strictNullHandling?null:""):(l=t.decoder(d.slice(0,h),a.decoder),c=t.decoder(d.slice(h+1),a.decoder)),i.call(r,l)?r[l]=[].concat(r[l]).concat(c):r[l]=c}return r}(e,r):e,u=r.plainObjects?Object.create(null):{},l=Object.keys(o),c=0;c<l.length;++c){var d=l[c],f=s(d,o[d],r);u=n.merge(u,f,r)}return n.compact(u)}},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t,r){var n=r(96);e.exports=function(e,t){if(null==e)return{};var r,i,a=n(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)r=s[i],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}},function(e,t,r){var n=r(52);function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function a(t,r,s){return i()?e.exports=a=Reflect.construct:e.exports=a=function(e,t,r){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return r&&n(a,r.prototype),a},a.apply(null,arguments)}e.exports=a},function(e,t,r){r.r(t),r.d(t,"default",(function(){return oe}));var n={};r.r(n),r.d(n,"STICKY_CONTROLS",(function(){return T})),r.d(n,"NO_FULLSCREEN",(function(){return b})),r.d(n,"NO_AD_INDICATOR",(function(){return S})),r.d(n,"AD_ATTRIBUTION",(function(){return A})),r.d(n,"AD_CHOICES",(function(){return L})),r.d(n,"REMAINING_TIME",(function(){return k})),r.d(n,"VOLUME_BAR",(function(){return w}));var i=r(5),a=r.n(i),s=r(6),o=r.n(s),u=r(93),l=r.n(u),c=r(1),d=r.n(c),f=r(2),h=r.n(f),p=r(4),v=r.n(p),g=r(3),m=r.n(g),y=r(94),E=r.n(y),_=(r(97),r(99),r(101),r(103),r(0)),T=1,b=2,S=4,A=8,L=16,k=32,w=64;function D(e){var t=window.getComputedStyle(e);return"0"!==t.width&&"0"!==t.height&&"0"!==t.opacity&&"none"!==t.display&&"hidden"!==t.visibility}var R=function(){};function O(e,t,r){for(var n=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);n.length;){if(null==e)return r;var i=n.shift();if("string"!=typeof i)return r;e=e[i]}return null==e?r:e}var C="undefined"!=typeof document&&"undefined"!=typeof window&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,I="function"==typeof requestAnimationFrame?requestAnimationFrame:setTimeout,x=function(){var e,t=document.createElement("div");return(e=t.classList).add.apply(e,arguments),t},P=[].forEach,M=r(7)("fpads:native:ui"),N="is-ad-showing",F="is-ad-linear",U="is-ad-nonlinear",B="ad-playing",j="no-fullscreen",G="ad-hide-first-frame",H=function(){function e(t){var r,n,i,a,s=this,o=t.root,u=t.content,l=t.config,c=t.initial,d=t.ads;v()(this,e),Object.assign(this,{root:o,content:u,initial:c,ads:d,config:l}),this.progress={percent:0},this.animation=(r=function(e){if(s.halt_animation())return s.animation.running=!1;s.set_progress_bar(Math.round(s.progress.percent)),requestAnimationFrame(s.animation)},n=Math.ceil(1e3/60),i=0,a=null,function(){var e=Date.now()-i;null===a&&(a=I((function(){a=null,r.apply(this,arguments),i=Date.now()}),n-e))}),d.ui=this,this.render().wireup(),u.on("reap",(function(e){return s.destroy()}))}return m()(e,null,[{key:"of",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return E()(e,r)}},{key:"as_progress",value:function(e){var t=e.remaining,r=e.duration;return{percent:Math.min(100,Math.max(0,(r-t)/r*100))}}},{key:"clone",value:function(e,t,r){var n=t.querySelector(r);if(n){var i=n.cloneNode(!0);return e.append(i),i}}}]),m()(e,[{key:"halt_animation",value:function(){return!this.progress_bar||0==this.content.reaper||!this.wrapper||!this.wrapper.classList.contains(B)}},{key:"animate",value:function(){this.animation.running||function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];e.apply(void 0,r)}(this.animation)}},{key:"resize",value:function(e){if(e.linear)return this.toggle(a()({on:!0},e));M("UI.resize(): ",e),this.adContainer.style.width=e.width+"px",this.wrapper.style.height=e.height+"px";var t=this.root.querySelector(".fp-controls"),r=t?e.height+t.clientHeight:e.height;this.wrapper.style.marginTop="-".concat(r,"px")}},{key:"set_progress_bar",value:function(e){this.progress_bar&&(this.progress_bar.style.width="".concat(e,"%"))}},{key:"reset_styles",value:function(){var e=this;this.progress.percent=0,"height width marginLeft marginTop".split(" ").forEach((function(t){e.wrapper.style[t]="",e.adContainer.style[t]=""}));try{window.emit("resize")}catch(e){}}},{key:"reset",value:function(){return this.wrapper.className="fp-ad-container",this.reset_styles(),this.progress={percent:0},this}},{key:"isShowing",value:function(){return this.root.classList.contains(N)}},{key:"hideFirstFrame",value:function(){return this.root.classList.toggle(G,!0),this}},{key:"showFirstFrame",value:function(){return this.root.classList.toggle(G,!1),this}},{key:"toggle",value:function(e){var t=e.on,r=e.linear;if(this.root)return M("UI.toggle(): ",arguments[0]),this.showFirstFrame(),t||this.reset(),r&&this.reset_styles(),this.root.classList.toggle(N,t),this.root.classList.toggle(F,t&&r),this.root.classList.toggle(U,t&&!r),this}},{key:"addClass",value:function(){var e;this.wrapper&&(e=this.wrapper.classList).add.apply(e,arguments)}},{key:"removeClass",value:function(){var e;this.wrapper&&(e=this.wrapper.classList).remove.apply(e,arguments)}},{key:"render",value:function(){var t=this,r=document.createDocumentFragment(),n=this,i=O(this,"config.ima.flags",O(this,"config.ima.ui",0));return this.wrapper=x("fp-ad-container"),this.ad_wrapper=x("fp-ad-wrapper"),this.adContainer=x("fp-ad"),this.controls=x("fp-ad-controls"),this.progress_wrapper=x("fp-ad-progress-wrapper"),this.progress_bar=x("fp-ad-progress","fp-color"),this.waiting=e.clone(this.wrapper,this.root,".fp-wait"),this.play_btn=e.clone(this.controls,this.root,".fp-btns.fp-small-switch"),this.volume_btn=e.clone(this.controls,this.root,".fp-volumebtn"),this.volume_bar=e.clone(this.controls,this.root,".fp-volume"),this.fs_btn=e.clone(this.controls,this.root,".fp-secondary"),w&i&&(this.root.classList.toggle("ad-volume-bar"),function(e,t){var r,n,i;if("grabbing"in e)return e;e.grabbing=!1,e.touching=!1;var a=t.onseek||R,s=t.onstart||R,o=t.onend||R,u=t.onmouse||R,l=t.ontouch||R,c=t.ontouchend||R,d=t.ctx;function f(t){r=e.offset().left,n=e.clientWidth;var i=(function(e){return"function"==typeof window.TouchEvent&&e instanceof TouchEvent}(t)?t.changedTouches[0].pageX:t.pageX)-r;return i>n&&(i=n),i<0&&(i=0),Math.round(i/n*100)}function h(t){var r=f(t);r!=i&&(a.call(d,r,e),i=r)}function p(e){if(e){var t="";return Array.prototype.forEach.call(e.classList,(function(e){t="."+e})),t}}e.addEventListener("touchstart",(function(t){t.target.closest(p(e))&&(e.touching=!0,D(e.parentElement)&&(t.preventDefault(),e.grabbing=!0,l(d,e),s(d,e),h(t)))})),e.addEventListener("touchmove",(function(t){t.target.closest(p(e))&&D(e.parentElement)&&e.touching&&(t.preventDefault(),h(t),u.call(d,f(t),e))})),e.addEventListener("touchend",(function(t){setTimeout((function(){e.touching=!1,console.debug("Touching to false")}),500),t.target.closest(p(e))&&D(e.parentElement)&&(t.preventDefault(),e.grabbing=!1,c(d,e),o(d,e),n=0)})),e.addEventListener("touchcancel",(function(){e.touching=!1,e.grabbing=!1,n=0})),e.addEventListener("mousedown",(function(t){e.touching||(document.addEventListener("mousemove",h),e.grabbing=!0,s.call(d,e),t.preventDefault(),h(t))})),e.addEventListener("mousemove",(function(t){e.touching||u.call(d,f(t),e)})),document.addEventListener("mouseup",(function(){e.touching||(document.removeEventListener("mousemove",h),e.grabbing=!1,o.call(d,e),n=0)}))}(this.volume_bar,{onseek:function(e){return t.maybe_adapter((function(t){return t.volume(e/100)}))}})),this.fs_btn&&(this.fs_btn.classList.remove("fp-togglable"),P.call(this.fs_btn.childNodes,(function(e){"svg"==e.tagName.toLowerCase()||e.remove()}))),this.root.classList.toggle("is-ad-controls-sticky",T&i),this.root.classList.toggle("is-ad-attribution",A&i),this.root.classList.toggle(j,b&i),C&&this.content.once([_.a.AD_BREAK_COMPLETED,_.a.AD_REQUEST_ERROR,_.a.AD_STARTED],(function(e){t.root.classList.toggle(j,b&i||e.type===_.a.AD_STARTED)})),!O(this,"config.ima.indicator",!0)||S&i||(this.indicator=x("ad-indicator"),this.controls.prepend(this.indicator),this.indicator.classList.add("fp-color-text")),k&i&&(this.remaining=x("fp-ad-remaining"),this.remaining.classList.add("fp-color-text"),this.controls.prepend(this.remaining)),L&i&&(this.root.classList.toggle("is-ad-choices",!0),this.ad_choices=x("fp-ad-choices"),this.ad_choices.textContext="AdChoices",this.ad_choices.addEventListener("click",(function(e){e.preventDefault(),n.ads.pause(),window.open("https://adssettings.google.com","_blank")}))),this.ad_wrapper.append(this.adContainer),this.progress_wrapper.append(this.progress_bar),r.appendChild(this.wrapper),this.wrapper.append(this.ad_wrapper,this.controls,this.progress_wrapper),this.ad_choices&&this.wrapper.appendChild(this.ad_choices),this.content.renderPlugin(r),this}},{key:"ad_loading",value:function(e){M("ad_loading",e),this.wrapper&&this.wrapper.classList.toggle("is-waiting",e)}},{key:"update_time_remaining",value:function(e){this.remaining&&(this.remaining.textContent=function(e){var t,r=Math.floor(e/60);return r+":"+(t=e-=60*r,(t=parseInt(t,10))>=10?t:"0"+t)}(e))}},{key:"update_ad_indicator",value:function(){if(this.indicator){var e=this.maybe_adapter((function(e){return e.getAdPodInfo()}));if(e){M("IMA -> ",e);var t=this.content.i18n("ads.indicator","ADS");this.indicator.textContent="".concat(t," ").concat(e.getAdPosition()," / ").concat(e.getTotalAds())}}}},{key:"wireup",value:function(){var t=this;this.ads.on(_.a.AD_REQUESTED,(function(e){t.ad_loading(!0)})),this.ads.on(_.a.AD_VOLUME_CHANGED,(function(e){M("Event(%s, level: %o)",_.a.AD_VOLUME_CHANGED,e),t.content.muted||(t.content.volume=e),t.adjust_volume_slider(e)})),this.ads.on(_.a.AD_STARTED,(function(e){t.playback_changed(!0),t.update_ad_indicator()})),this.ads.on(_.a.AD_COMPLETED,(function(e){t.set_progress_bar(0)})),this.ads.on(_.a.AD_PAUSED,(function(e){return t.playback_changed(!1)})),this.ads.on(_.a.AD_RESUMED,(function(e){return t.playback_changed(!0)})),this.ads.on(_.a.AD_PROGRESS,(function(r){t.update_time_remaining(r.remaining,r.duration),t.progress=e.as_progress(r)})),this.play_btn&&["click","touchend"].forEach((function(e){return t.play_btn.addEventListener(e,(function(e){return"touchend"==e.type&&e.preventDefault(),t.ads.paused?t.ads.resume():t.ads.pause()}))})),this.fs_btn&&this.fs_btn.addEventListener("click",(function(e){t.content.toggleFullScreen()})),this.volume_btn&&this.volume_btn.addEventListener("click",(function(){return t.maybe_adapter((function(e){t.content.muted=e.volume()>0,e.volume(t.content.muted?0:0==t.content.volume?.1:t.content.volume)}))}))}},{key:"adjust_volume_slider",value:function(e){if(this.volume_bar){var t=[].slice.call(this.volume_bar.querySelectorAll(".fp-tick")),r=Math.round(e*t.length);this.volume_bar.setAttribute("aria-valuenow",e),t.slice(r).forEach((function(e){return e.classList.remove("fp-color")})),t.slice(0,r).forEach((function(e){return e.classList.add("fp-color")}))}}},{key:"playback_changed",value:function(e){this.ad_loading(!1),e&&this.animate(),this.wrapper.classList.toggle(B,e),this.wrapper.classList.toggle("ad-paused",!e),this.wrapper.classList.toggle("ad-ui-disabled",this.maybe_adapter((function(e){return e.isUiDisabled()})))}},{key:"maybe_adapter",value:function(e){return this.ads&&this.ads.adapter?e(this.ads.adapter):0}},{key:"destroy",value:function(){this.ads.ui=this.root=this.content=this.config=this.wrapper=this.adContainer=0}},{key:"classList",get:function(){return this.wrapper.classList}}]),e}();function K(e){return{width:e.clientWidth,height:e.clientHeight}}function V(e,t,r){return"number"==typeof r&&(r+="px"),e.style.setProperty(t,r),e}r(7)("fpads:dom");var W=r(7)("fpads:plugin:native"),q={on:!0},Y={on:!1},z=[_.a.AD_PLAYBACK_ERROR,_.a.AD_TEARDOWN,_.a.AD_BREAK_COMPLETED],X=function(){function e(){v()(this,e)}var t,r,n,i;return m()(e,null,[{key:"user_gesture",value:function(){return flowplayer.events.BEFORE_PLAY}},{key:"snapshot",value:function(e,t){return{muted:!(t||!e.muted),volume:e.volume}}},{key:"start_from_user_gesture",value:function(t){var r=t.content,n=t.ads,i=t.config,a=t.ui,s=t.state,o=t.initial,u=t.adContainer,l=t.ima,c=e.user_gesture();r.once(c,function(){var t=h()(d.a.mark((function t(c){return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r.in_viewport||"touchend"!=c.type){t.next=2;break}return t.abrupt("return");case 2:if(n.shallPlayAd(0)){t.next=4;break}return t.abrupt("return");case 4:return!C&&c.preventDefault(),e.add_time_listeners({ads:n,content:r,ui:a,state:s}),W("LifeCycle.user_gesture(:intercept) -> shallPlayAd(0: %s)",n.shallPlayAd(0)),i.muted=o.muted,t.next=10,e.start({ads:n,content:r,state:s,adContainer:u,ima:l,config:i});case 10:e.update_time({ads:n,content:r,ui:a});case 11:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}())}},{key:"init",value:(i=h()(d.a.mark((function t(r){var n,i,a,s,o,u,l,c,f,h,p,v;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r.config,i=r.root,a=r.content,s=r.ads,o=r.ima,a.autoplay=!1,u=n.autoplay===(flowplayer.autoplay||flowplayer.autoplay_options).AUDIO_REQUIRED,l=e.snapshot(a,u),c=flowplayer,f=c.events,a.on(f.VOLUME_CHANGE,(function(){l.volume=a.volume,l.muted=a.muted})),h=H.of({ads:s,content:a,config:n,initial:l,root:a.root}),p=h.adContainer,v={listening:!1,preload:O(n,"ima.preload_ads",!1)},W("LifeCycle.initial()",{initial:l}),s.setVideoTag(a),!n.autoplay){t.next=18;break}return W("Trying to autoplay"),h.hideFirstFrame(),t.next=16,e.peek_content(a,u);case 16:t.sent?(W("Can autoplay, start ad"),a.opts.autoplay=!0,e.start({ads:s,content:a,state:v,adContainer:p,ima:o,config:n})):(W("cannot autoplay(audioRequired: %s), fallback to poster state",u),n.autoplay=!1,h.showFirstFrame(),a.setState("is-starting",!0));case 18:n.autoplay||s.hasPreroll()&&e.start_from_user_gesture({content:a,ads:s,config:n,ui:h,state:v,initial:l,adContainer:p,ima:o}),!n.autoplay&&s.hasPreroll()&&v.preload&&e.start({ads:s,content:a,state:v,adContainer:p,ima:o,config:n}),e.ui_listeners({config:n,root:i,content:a,ads:s,state:v,adContainer:p,ui:h,ima:o,initial:l}),a.on(f.SOURCE,(function(){a.once(f.BEFORE_PLAY,(function(){return s.resetScheduleCounter()}))}));case 22:case"end":return t.stop()}}),t,this)}))),function(e){return i.apply(this,arguments)})},{key:"start",value:(n=h()(d.a.mark((function e(t){var r,n,i,s,o,u,c,f,h,p,v;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ads,n=t.content,i=t.adContainer,s=t.ima,o=t.state,u=t.config,c=void 0===u?{}:u,!o.started){e.next=3;break}return e.abrupt("return");case 3:return o.started=!0,s.ads,f=l()(s,["ads"]),h=c.dimensions||K(n.root),p=O(c,"muted",n.muted),v=Object.assign(a()({container:i,volume:p?0:O(c,"volume",n.volume),muted:p,autoplay:O(c,"autoplay",!1),video_source:n.original_src,DisableCustomPlaybackForIOS10Plus:O(c,"fake_fullscreen",C),preload_ads:O(c,"ima.preload_ads",!1)},f,h)),W("LifeCycle.start():",v,o),e.next=11,r.initialize(!1,v,o.preload);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"ui_listeners",value:function(t){var r=t.config,n=t.root,i=t.content,s=t.ads,o=t.initial,u=t.adContainer,l=t.state,c=t.ui,f=t.ima;W("LifeCycle.ui_listeners()");var p=flowplayer,v=p.events,g=p.states;i.once(v.PLAYING,function(){var t=h()(d.a.mark((function t(o){return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(s){t.next=2;break}return t.abrupt("return");case 2:if(W("LifeCycle.ui_listeners() -> content started playing"),e.add_time_listeners({ads:s,content:i,ui:c,state:l}),s.shallPlayAd(0)&&s.adapter.adLinear){t.next=9;break}return W("LifeCycle.ui_listeners() -> no more preroll ads -> resume content"),t.next=8,e.start({ads:s,content:i,state:l,adContainer:u,ima:f,config:r});case 8:return t.abrupt("return",t.sent);case 9:return i.pause(),t.next=12,e.start({ads:s,content:i,state:l,adContainer:u,ima:f,config:r});case 12:if(s.shallPlayAd(0)&&s.adapter.adLinear){t.next=14;break}return t.abrupt("return");case 14:c.toggle(a()({},q,{linear:!0})),n.classList.add(g.WAITING),e.update_time({ads:s,content:i,ui:c});case 17:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}()),i.on([v.PORTRAIT,v.LANDSCAPE,v.RESIZE],(function(){if(s){var e=i.clientWidth||i.parentNode.clientWidth||n.clientWidth,t=i.clientHeight||i.parentNode.clientHeight||n.clientHeight;s.resize({height:t,width:e})}})),i.on(v.ENDED,(function(e){s&&(W("LifeCycle.ui_listeners(:%s, event: %o)",e.type,e.data),e.data&&e.data.from===s||(e.preventDefault(),s.finished((function(){i.emit(v.ENDED,{from:s})}))))})),s.on(_.a.AD_REQUESTED,(function(){n.classList.toggle(g.WAITING,!0)})),s.once(_.a.AD_STARTED,(function(){var e=flowplayer.events;i.on([e.BEFORE_PLAY,e.BEFORE_PAUSE],(function(t){if(s.adBreak&&s.adapter.adLinear){t.preventDefault();var r=O(t,"data.forced",!1)?t.type===e.BEFORE_PLAY:!s.adPlaying;r&&s.paused&&s.resume(),r||s.paused||s.pause()}}))})),s.on(_.a.AD_STARTED,(function(e){var t=e.linear,r=e.ad,u=e.ad_type;if(W("Ad[linear: ".concat(t,", currentTime: ").concat(i.currentTime,"] starting"),r),"preroll"==u&&!t&&i.paused&&i.play(),"preroll"==u&&t&&i.currentTime>0&&!i.opt("start_time")&&!i.opt("live")&&(W("Preroll[rewind: true]",i.currentTime),i.currentTime=0),s.resize({width:r.width,height:r.height,linear:t,resize_non_linear:!0}),c.resize({linear:t,resizeContainerAlso:!0,width:t?void 0:r.width,height:t?void 0:r.height}),n.classList.remove(g.WAITING),c.toggle(a()({},q,{linear:t,ad:r})),!t)try{i.togglePlay(!0),i.volume=o.volume,i.muted=o.muted}catch(e){W(e)}})),s.on(_.a.AD_PAUSE_CONTENT,(function(){c.resize({linear:!0,resizeContainerAlso:!0,width:void 0,height:void 0})})),z.forEach((function(t){return s.on(t,(function(r){return e.teardown({root:n,content:i,ui:c,initial:o,err:r,event:t})}))}))}},{key:"add_time_listeners",value:function(t){var r=t.ads,n=t.content,i=t.ui,a=t.state,s=flowplayer.events;a.listening||(n.on([s.TIME_UPDATE,s.SEEKED,s.PLAYING,s.SEEKING],(function(t){r&&(r.adPlaying&&r.adapter.adLinear&&!r.adapter.sharedVideoTag&&!n.paused&&n.pause(),e.update_time({ads:r,content:n,ui:i,seek:t.type===s.SEEKING}))})),a.listening=!0)}},{key:"update_time",value:function(e){var t=e.ads,r=e.content,n=e.seek,i=void 0!==n&&n;t&&t.setCurrentTime(r.currentTime,void 0,i)}},{key:"teardown",value:(r=h()(d.a.mark((function t(r){var n,i,a,s,o,u,l,c,f,h;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r.root,i=r.content,a=r.ui,s=r.event,o=r.err,u=void 0===o?{}:o,a.isShowing()||i.paused){t.next=3;break}return t.abrupt("return",{noop:1});case 3:if(l=flowplayer,c=l.states,n.classList.add("is-seamless"),a.classList.remove("is-vpaid"),n.classList.remove(c.WAITING),W("LifeCycle.teardown(event: %s)",s),u.reason&&W("LifeCycle.teardown(:err, reason: %s) %o",u.reason),a.toggle(Y),f=i.ads,h=f.getLastAd(),f.shouldRestartContent()){t.next=15;break}return W("Lifecycle.teardown(:skip_restart, reason: %s)","Ad prevented restarting content"),t.abrupt("return",e.on_content_playing(n));case 15:if(!(i.currentTime>0&&i.currentTime>=i.duration||"postroll"==f.ad_type||!1===h.restart)){t.next=18;break}return W("Lifecycle.teardown(:skip_restart, reason: %s)","was a postroll ad"),t.abrupt("return",e.on_content_playing(n));case 18:if(""===i.currentSrc&&i.setSrc(i.original_src),!i.paused||!f.shouldRestartContent()){t.next=23;break}return W("Lifecycle.teardown(:toggle_play, %s)","attempting to restart content"),t.next=23,i.togglePlay(!0);case 23:if(i.paused){t.next=26;break}return W("Lifecycle.teardown(:ok)","restarted video content"),t.abrupt("return",e.on_content_playing(n));case 26:case"end":return t.stop()}}),t,this)}))),function(e){return r.apply(this,arguments)})},{key:"on_content_playing",value:function(e){e.classList.remove("is-seamless")}},{key:"maybe_blocked",value:function(e){W("google.ima not found in window"),[].slice.call(document.getElementsByTagName("script")).filter((function(e){return t=e.src,(r=document.createElement("a")).href=t,"imasdk.googleapis.com/js/sdkloader/ima3.js"=="".concat(r.host).concat(r.pathname);var t,r})).length>0&&e.emit(_.a.AD_BLOCKED)}},{key:"peek_content",value:(t=h()(d.a.mark((function t(r,n){var i,a,s,o,u,l;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=[r.muted,r.volume],W("LifeCycle::peek_content(:muted => %s, :volume => %s)",a=i[0],s=i[1]),o=function(){return new Promise((function(e){return setTimeout(e,0,!1)}))},u=function(){return new Promise((function(e){return setTimeout((function(){return e(r.play())}))}))},l=function(){return new Promise((function(e){return setTimeout((function(){return e(r.pause())}))}))},n&&(r.muted=!1,r.volume=r.volume?r.volume:1),t.prev=6,t.next=9,e.wait_for_source(r);case 9:return r.volume&&(r.volume=.01),W("LifeCycle::peek_content::play"),t.next=13,u();case 13:return W("LifeCycle::peek_content::pause"),t.next=16,l();case 16:return r.volume=s,W("LifeCycle::peek_content::true"),t.abrupt("return",!0);case 21:if(t.prev=21,t.t0=t.catch(6),r.volume=s,!n){t.next=30;break}return r.muted=!1,0==r.volume&&(r.volume=1),t.next=29,o();case 29:return t.abrupt("return",t.sent);case 30:if(!a&&s){t.next=35;break}return W("LifeCycle::peek_content::false"),t.next=34,o();case 34:return t.abrupt("return",t.sent);case 35:return W("LifeCycle::peek_content::recover"),r.muted=!0,t.next=39,e.peek_content(r);case 39:if(!t.sent){t.next=41;break}return t.abrupt("return",!0);case 41:return r.muted=a,W("LifeCycle::peek_content::false"),t.next=45,o();case 45:return t.abrupt("return",t.sent);case 46:case"end":return t.stop()}}),t,this,[[6,21]])}))),function(e,r){return t.apply(this,arguments)})},{key:"wait_for_source",value:function(e){return W("LifeCycle::wait_for_source"),new Promise((function(t,r){var n=0,i=setInterval((function(){if(++n>40)return clearInterval(i),r(new Error("No source in ".concat(2e3,"ms, giving up")));e.currentSrc&&(t(),clearInterval(i))}),50)}))}}]),e}();X.TERMINAL_EVENTS=z;var Q=r(51),J=r(20),Z="function"==typeof requestAnimationFrame?requestAnimationFrame:setTimeout;function $(e){var t=0,r=null;return function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var s=Date.now()-t;null===r&&(r=Z((function(){r=null,e.apply(void 0,i),t=Date.now()}),16-s))}}r(105);var ee=r(31),te=r(46),re=r(50),ne=r(7)("fpads:native:outstream"),ie={OUTSTREAM_VISIBLE:"ads-outstream-visible",OUTSTREAM_VIEWPORT_UPDATE:"ads-outstream-viewport-update",OUTSTREAM_TEARDOWN:"ads-outstream-teardown",OUTSTREAM_ENDSCREEN_READY:"ads-outstream-endscreen-ready"},ae=function(){function e(t){var r=this,n=t.ads,i=t.container,a=t.video,s=t.ima;v()(this,e),n.outstream=this,this.video=a,this.ads=n,this.container=i,this.ima=s,this.aspect_ratio=i.aspect_ratio.style.paddingTop,this.dimensions=function(e){if(e.clientWidth>0||e.clientHeight)return K(e);var t={height:e.style.height};V(e,"opacity",0),V(e,"display","absolute"),V(e,"display","inline-block"),V(e,"height","auto");var r=K(e);return V(e,"height",t.height),V(e,"opacity",1),r}(this.container),ne("creating Outstream instance"),this.hide(),this.poll_viewport_exit=e.fps_60_visibilty_checker({outstream:this}),this.setup();var o=Object(re.a)(this.container,function(){var e=h()(d.a.mark((function e(t){return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return o(),e.next=5,r.begin_life_cycle();case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}())}var t;return m()(e,null,[{key:"of",value:function(t){return new e(t)}},{key:"fps_60_visibilty_checker",value:function(e){var t=e.outstream;return $((function(){if(!t.disposed){var e=t.percent_in_viewport();if(t.ads.emit(ie.OUTSTREAM_VIEWPORT_UPDATE,{percent:e}),!(e>.5&&t.ads.adPlaying))return e>.5?t.ads.resume():void t.ads.pause()}}))}}]),m()(e,[{key:"hide",value:function(){return this}},{key:"restore_aspect_ratio",value:function(){return ne("Outstream.restore_aspect_ratio(".concat(this.aspect_ratio,")")),this.container.aspect_ratio.style.paddingTop=this.aspect_ratio,this}},{key:"percent_in_viewport",value:function(){return e=this.video.root.getBoundingClientRect(),t=window.innerHeight,(r=e.y)>t||r+e.height<0?0:e.y<0?(e.height+r)/e.height:t-e.y>e.height?1:Math.abs((t-e.y)/e.height);var e,t,r}},{key:"show",value:function(){this.container.removeClass(e.CLASS.HIDDEN),this.container.addClass(e.CLASS.SHOWING),this.ui.toggle({linear:!0,on:!0})}},{key:"begin_life_cycle",value:(t=h()(d.a.mark((function e(){var t,r,n,i,s,o=this;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ee.a(!1);case 2:return t=e.sent,r=t.error,n=t.result,e.next=7,ee.a(!0);case 7:return i=e.sent,s=i.result,this.attach_ad_listeners(),this.ui.initial={can_autoplay:!(!n&&!s),muted:!n},ne("Outstream.show() :autoplay >> ",this,{error:r,can_autoplay_audio:n}),r&&this.video&&!n&&(this.video.muted=!0,this.video.volume=0),e.next=15,this.ads.setVideoTag(this.video);case 15:return this.ads.on(_.a.AD_PAUSE_CONTENT,(function(e){var t=e.linear;o.ads.resize({width:o.dimensions.width,height:o.dimensions.height,linear:t})})),e.next=18,X.start({ads:this.ads,content:this.video,adContainer:this.adContainer,ima:this.ima,state:{},opts:a()({},this.video.opts,{muted:!0,dimensions:this.dimensions})});case 18:X.update_time({content:this.video,ads:this.ads,ui:this.ui});case 19:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"attach_ad_listeners",value:function(){var e=this,t=this,r=t.ads;r.once(_.a.AD_PAUSE_CONTENT,(function(){t.show(),t.poll_viewport_exit(),document.addEventListener("scroll",t.poll_viewport_exit),window.emit("resize")})),t.ima.always_show_controls||r.on(_.a.VPAID_INIT,(function(){return t.ui.addClass("is-vpaid")}));var n=function r(n){X.TERMINAL_EVENTS.forEach((function(e){return t.ads.removeListener(e,r)}));var i,a,s=(i=ie.OUTSTREAM_TEARDOWN,(a=document.createEvent("Event")).initEvent(i,!1,!0),a);ne("Outstream(:teardown)",s),e.video.dispatchEvent(s)};X.TERMINAL_EVENTS.forEach((function(e){return t.ads.once(e,n)})),this.video.once(ie.OUTSTREAM_TEARDOWN,(function(e){setTimeout((function(){if(e.defaultPrevented)return t.handle_endscreen();t.dispose()}),0)}))}},{key:"handle_endscreen",value:function(){this.reset_ui(),this.ads.reset(),this.ui.wireup(),X.ui_listeners(a()({},this,{content:this.video,root:this.video.root,state:{started:!0},initial:{muted:!0}}))}},{key:"empty_src",value:function(){this.video.setSrc({type:"video/mp4",src:URL.createObjectURL(te.a)})}},{key:"setup",value:function(){this.container.addClass(e.CLASS.IS),this.container.addClass(e.CLASS.HIDDEN),this.empty_src(),this.ui=H.of({root:this.video.root,content:this.video,ads:this.ads,config:this.video.opts}),this.adContainer=this.ui.adContainer}},{key:"poll_viewport_exit",value:function(){this.ads.adPlaying&&this.ads.pause()}},{key:"reset_ui",value:function(){var t=this.container;t.removeClass(e.CLASS.SHOWING),t.removeClass(e.CLASS.IS),document.removeEventListener("scroll",this.poll_viewport_exit),this.ui.toggle({on:!1})}},{key:"dispose",value:function(){if(!this.disposed){var t=this.container,r=this.video;this.reset_ui(),t.addClass(e.CLASS.IS),t.addClass(e.CLASS.DONE),this.video=this.container=this.ads=0,this.disposed=1,r.destroy()}}}]),e}();ae.CLASS={IS:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"},ae.events=ae.EVENT=ie;var se=r(9);function oe(e,t,r){if(!("google"in window))return X.maybe_blocked(r);var i=e.autoplay;r.autoplay=e.autoplay=!1;var s=r.ads=new Q.a,o=s.analytics=Object(J.b)(s),u=!1;s.resize(K(t)),flowplayer.ads||(flowplayer.ads={}),flowplayer.ads.version="1.16.5",flowplayer.ads.commit="97d8e0feaab02bf3b718cc47ac2992e46fe9b188",flowplayer.ads.events=_.a,flowplayer.ads.ui=n,C&&(r.on([flowplayer.events.FULLSCREEN_ENTER,flowplayer.events.FULLSREEN_EXIT,"webkitendfullscreen"],(function(e){var t=e.type===flowplayer.events.FULLSCREEN_ENTER;r.ads.adapter.setIOSPlaysInline(!t)})),s.on(_.a.AD_POSTROLL_FINISHED,(function(){s.adapter.sharedVideoTag&&s.once(_.a.AD_BREAK_COMPLETED,(function(){r.src=r.original_src,r.once(flowplayer.events.CAN_PLAY,(function(e){r.pause()})),r.webkitExitFullscreen()}))}))),flowplayer.Outstream=ae,r.on(flowplayer.events.REAP,(function(){s&&s.destroy(),o=s=void 0})),r.on(flowplayer.events.SOURCE,(function(){s&&s.stop()})),r.on(flowplayer.events.CONFIG,(function(n){var l=n.data,c=l.ima||{};if(Array.isArray(c.ads)){var d=l.duration||r.duration;if(c.ads=function(e,t){return Array.isArray(e)&&e.map((function(e,r){return"number"==typeof e.time||e.lazy?e:isNaN(e.percentage)?(console.warn("Ad[index: ".concat(r,"] passed without 'time' property or 'percentage' properties")),e):isNaN(t)?(console.warn("Ad[index: ".concat(r,"] passed with 'percentage' property but both content and config 'duration' was ").concat(t)),e):"number"==typeof e.percentage?(e.time=Math.floor(e.percentage*t),e):e}),[])}(c.ads,d),s.setSchedule(c.ads,d),l.metadata&&J.a.mergeMetadata(o,l.metadata),l.metadata&&s.mergeMacros(l.metadata),l.metadata&&c.parameters&&(c.parameters=a()({},c.parameters,l.metadata)),J.a.mergeMetadata(o,{muted:l.muted||!1,autoplay:l.autoplay||!1}),!u){if(u=!0,e.lang&&!c.Locale&&(c.Locale=e.lang),se.a.isOutstream(c.ads))return ae.of({container:t,video:r,ads:s,ima:c});X.init({config:a()({},e,{autoplay:i}),root:t,content:r,ads:s,ima:c})}}else void 0!==i?e.autoplay=i:delete e.autoplay}))}Object.assign(_.a,ae.events),window.addEventListener("resize",$((function(){null!=("undefined"==typeof flowplayer?"undefined":o()(flowplayer))&&Array.isArray(flowplayer.instances)&&flowplayer.instances.forEach((function(e){return e.ads&&e.ads.resize(K(e))}))}))),oe.events=_.a,oe.ui=n,oe.Outstream=ae,oe.version="1.16.5",oe.commit="97d8e0feaab02bf3b718cc47ac2992e46fe9b188"},function(e,t){e.exports=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}},function(e,t,r){var n=r(98);"string"==typeof n&&(n=[[e.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(18)(!1)).push([e.i,'.fp-ad-container .fp-color{background-color:#ffd700}.fp-ad-container .fp-color-text{color:#ffd700;font-weight:700;line-height:1.8em}.fp-ad-container{position:absolute;z-index:-1;background:#333;top:0;left:0;right:0;bottom:0;opacity:0}.fp-ad-controls{position:absolute;direction:ltr;top:100%;left:0;margin-top:-3.2em;height:3em;z-index:1000;display:none;padding:0.72em 0em 0.72em 2em;justify-content:space-between;align-items:center;font-weight:500;text-align:right}.fp-ad-controls .fp-volumebtn:after{filter:drop-shadow(0 0 2px rgba(0,0,0,0.4))}.fp-ad-controls .fp-secondary{filter:drop-shadow(0 0 2px rgba(0,0,0,0.4));position:relative;left:0;top:0}.is-small .ad-indicator{display:none}.is-small .fp-ad-controls>*{transform:scale(0.8)}.is-tiny .fp-ad-controls>*{transform:scale(0.7)}.fp-ad-controls .fp-fullscreen,.fp-ad-controls .fp-fullscreen-exit{visibility:visible !important}.fp-ad-controls .fp-fullscreen,.fp-ad-controls .fp-fullscreen-exit,.fp-ad-controls .fp-secondary{height:1.8em;width:auto}.fp-ad-controls .fp-volumebtn{margin-right:2.38em}.fp-ad-controls .fp-btns,.fp-ad-controls .ad-indicator,.fp-ad-controls .fp-volume{margin-right:1em}.no-fullscreen .fp-ad-controls .fp-fullscreen,.no-fullscreen .fp-ad-controls .fp-fullscreen-exit{visibility:hidden !important;height:0;width:0}.fp-ad-controls .ad-indicator:before{margin-right:0.5em}.fp-ad-controls .fp-volumebtn{width:1.12em}.fp-ad-controls .fp-volume{display:none;margin-left:-2.0em}.fp-ad-controls .fp-skip-next{display:none}.ad-volume-bar .fp-volume{display:flex}.fp-ad-controls .fp-volumebtn{height:100%}.fp-ad-controls .fp-volumebtn:after{font-size:230% !important;line-height:inherit !important}.fp-ad-controls .fp-btns{width:1.8em}.fp-ad-container.ad-paused .fp-small-play{display:inline-block}.fp-ad-container.ad-playing .fp-small-pause{display:inline-block}.fp-ad-container.ad-playing .fp-small-play{display:none}.fp-ad-container .fp-volume-mute-unmute{height:100%}.fp-ad-remaining:after{content:"·";margin-left:0.5em;margin-right:0.5em}.fp-ad-progress-wrapper{direction:ltr}.fp-ad-progress{height:0.2em;top:100%;margin-top:-0.2em;width:0%;position:absolute;transition:width .2s}.logo-on-right .fp-secondary>*{margin:0}.fp-ad-choises-icon{display:none}.is-ad-attribution .fp-ad-container::after{content:"Advertisement";position:absolute;width:100%;text-align:center;z-index:10;color:gray;background-color:rgba(255,255,255,0.2);font-size:11px;font-weight:500}.is-ad-choices .fp-ad-choices{position:absolute;width:77px;height:15px;right:0;border-bottom-left-radius:8px;padding-left:5px;color:black;background-color:rgba(255,255,255,0.7);font-size:11px;font-weight:500;z-index:11}.is-ad-choices .fp-ad-choices::after{content:" ";background-image:url("data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjI1MDAiIHZpZXdCb3g9Ii4yIDAgMTkuNCAyMCIgd2lkdGg9IjI0MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0ibTIuMiAyMGMxIDAgMS43LS41IDIuNC0uOS42LS4zIDEuMi0uNyAxLjktMSAzLjItMS43IDYuNC0zLjUgOS42LTUuMyAxLS41IDIuMy0xIDMtMS45LjItLjMuNS0uNy40LTEuMi0uMy0xLjEtMS43LTEuNS0yLjYtMi0yLjItMS4yLTQuNS0yLjUtNi43LTMuNy0uOC0uNS0yLTEuNC0zLS43LS40LjItLjYuNC0uNy43LS4xLjQgMCAuOSAwIDEuM3YzLjJjMCAuOS0uMSAxLjYuNSAyIC4yLjEuNi4yLjkuMSAxLS40LjctMi4yLjctMy42di0xLjFjMS43LjkgMy40IDEuOCA1LjEgMi42LjYuMyAxLjYuNiAxLjggMS40LjIuOS0xLjcgMS42LTIuMyAxLjlsLTYuOSAzLjljLS41LjMtMS44IDEuMy0yLjYgMS0uMy0uMS0uNS0uNC0uNS0uNi0uMS0uNC0uMS0xLS4xLTEuNXYtMy4yLTUuNGMwLS44LS4xLTEuOC4yLTIuMy43LTEgMi4zLjggMi44LS44LjEtLjQtLjEtLjgtLjMtMS0uNC0uNi0yLjItMS41LTIuOS0xLjctLjItLjEtLjctLjItMS0uMi0xLjcuMy0xLjMgMy0xLjMgNXY5LjljMCAxLjUtLjIgMy41LjQgNC40LjMuNS42LjUgMS4yLjd6bTUuMi02LjVjMS41IDAgMS42LTEuOS4yLTIuMi0uOC0uMS0xLjQuNy0xLjIgMS40LjIuNS41LjYgMSAuOHoiIGZpbGw9IiMwMGFlY2QiLz48L3N2Zz4=");background-size:contain;display:inline-block;position:absolute;width:13px;height:13.747px;right:1px;top:1px}.ad-hide-first-frame .fp-wait{opacity:1}.ad-hide-first-frame .fp-engine{display:none}.ad-hide-first-frame>.fp-ui .fp-switch{display:none}\n',""])},function(e,t,r){var n=r(100);"string"==typeof n&&(n=[[e.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(18)(!1)).push([e.i,".is-ad-linear .fp-ad-container{z-index:1;opacity:1}.is-ad-linear.is-hovered .fp-ad div{background-image:linear-gradient(to top, rgba(0,0,0,0.5), transparent 15%),linear-gradient(to bottom, rgba(0,0,0,0.5), transparent 20%)}.is-ad-linear.is-hovered .fp-ad-controls,.is-ad-linear.is-ad-controls-sticky .fp-ad-controls,.is-ad-linear .ad-paused .fp-ad-controls{display:flex}.is-ad-linear .fp-ad-container.ad-ui-disabled .fp-ad-controls,.is-ad-linear .fp-ad-container.ad-ui-disabled .fp-ad-progress{display:none !important}.ad-paused .fp-ad-controls .fp-btns svg.fp-small-play{display:inline}.ad-paused .fp-ad-controls .fp-btns svg.fp-small-pause{display:none}.ad-playing .fp-ad-controls .fp-btns svg.fp-small-pause{display:inline}.ad-playing .fp-ad-controls .fp-btns svg.fp-small-play{display:none}.fp-ad-container.ad-paused .fp-wait,.fp-ad-container.ad-playing .fp-wait{display:none !important}.fp-ad-container.is-waiting .fp-ad-controls,.fp-ad-container.is-waiting .fp-ad-progress{display:none}.fp-ad-container.is-waiting .fp-wait{position:absolute;height:2em;opacity:1;top:50%;z-index:1;width:4em;left:50%;margin-left:-2em;margin-top:-1em}\n",""])},function(e,t,r){var n=r(102);"string"==typeof n&&(n=[[e.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(18)(!1)).push([e.i,".is-ad-nonlinear .fp-ad-controls,.is-ad-nonlinear .fp-ad-progress{display:none}.is-ad-nonlinear .fp-ad-container{background:transparent}.is-ad-nonlinear.is-ad-showing .fp-ad-container{left:0%;top:100%;width:100%;z-index:1;opacity:1}.is-ad-nonlinear.is-ad-showing .fp-ad-wrapper{position:relative}.is-ad-nonlinear.is-ad-showing .fp-ad{margin:0 auto}\n",""])},function(e,t,r){var n=r(104);"string"==typeof n&&(n=[[e.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(18)(!1)).push([e.i,".fp-ad-container.is-vpaid .fp-ad-controls{display:none}\n",""])},function(e,t,r){var n=r(106);"string"==typeof n&&(n=[[e.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(18)(!1)).push([e.i,".flowplayer.is-outstream{background:transparent}.flowplayer.is-outstream .fp-ui{visibility:hidden}.flowplayer.is-outstream-hidden>video,.flowplayer.is-outstream-done>video{display:none}.flowplayer.is-outstream-visible{height:auto}.flowplayer.is-outstream-visible .fp-ad-container{left:0px;top:0px}\n",""])},,,,,function(e,t,r){r(53),r(71),r(73),r(75),e.exports=r(95)}]).default})));const{samsung_tv:In}=r();class xn{init(e,t,r){if(Fe.from_token(e.token||"").is_granted(Fe.permissions.ADS)&&!In)return Cn(e,t,r)}}return Re(window,Object.assign(xn,Cn)),Mr.extensions.push(Qr,Dn,xn),Object.assign(Mr,{hls:Qr,ads:xn,ovp:Dn}),Mr}));