@flowplayer/player 3.0.1-canary.8 → 3.0.2

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.
Files changed (51) hide show
  1. package/core/autoplay-enum.d.ts +5 -0
  2. package/core/autoplay-enum.js +9 -0
  3. package/core/events.d.ts +12 -0
  4. package/core/events.js +9 -0
  5. package/core/quality-enum.d.ts +5 -0
  6. package/core/quality-enum.js +9 -0
  7. package/core.js +2 -2
  8. package/default.js +2 -2
  9. package/drm/constants.d.ts +12 -0
  10. package/drm/constants.js +15 -0
  11. package/drm/types.d.ts +46 -0
  12. package/drm/types.js +3 -0
  13. package/embed.js +93 -93
  14. package/flowplayer.css +1 -1
  15. package/index.d.ts +53 -4
  16. package/package.json +15 -2
  17. package/plugins/ads.js +2 -2
  18. package/plugins/airplay.js +1 -1
  19. package/plugins/analytics.js +1 -1
  20. package/plugins/asel.js +1 -1
  21. package/plugins/audio.js +1 -1
  22. package/plugins/chapters.js +1 -1
  23. package/plugins/chromecast.js +1 -1
  24. package/plugins/context-menu.js +1 -1
  25. package/plugins/cuepoints.js +1 -1
  26. package/plugins/dash.js +2 -2
  27. package/plugins/drm.js +1 -1
  28. package/plugins/endscreen.js +1 -1
  29. package/plugins/fas.js +1 -1
  30. package/plugins/float-on-scroll.js +1 -1
  31. package/plugins/gemius.js +1 -1
  32. package/plugins/google-analytics.js +1 -1
  33. package/plugins/health.js +1 -1
  34. package/plugins/hls.js +2 -2
  35. package/plugins/id3.js +1 -1
  36. package/plugins/iframe.js +1 -1
  37. package/plugins/keyboard.js +1 -1
  38. package/plugins/media-session.js +1 -1
  39. package/plugins/message.js +1 -1
  40. package/plugins/ovp.js +1 -1
  41. package/plugins/playlist.js +1 -1
  42. package/plugins/preview.js +1 -1
  43. package/plugins/qsel.js +1 -1
  44. package/plugins/qul.js +1 -1
  45. package/plugins/share.js +1 -1
  46. package/plugins/speed.js +1 -1
  47. package/plugins/ssai.js +1 -0
  48. package/plugins/subtitles.js +1 -1
  49. package/plugins/thumbnails.js +1 -1
  50. package/util/loader.d.ts +8 -0
  51. package/util/loader.js +43 -0
package/embed.js CHANGED
@@ -1,4 +1,4 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).flowplayer=e()}(this,(function(){"use strict";const t=[],e=[];function r(){const t="undefined"!=typeof document&&"undefined"!=typeof window,e=t?navigator.userAgent:"",r=/iP(hone|od)/i.test(e)&&!/iPad/.test(e)&&!/IEMobile/i.test(e),n=/Android/.test(e)&&!/Firefox/.test(e),i=/^((?!chrome|android).)*safari/i.test(e),a=/SamsungBrowser/.test(e),s=a&&/SMART-TV/.test(e);return{controls:!r,video:function(e){return t&&document.createElement("video").canPlayType(e)},lang:t&&window.navigator.language,android:n,iphone:r,safari:i,ios:t&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:a,samsung_tv:a&&s}}const n="error",i="click",a="dblclick",s="load",o="mouseenter",u="mouseleave",l="touchend",c="resize",d="loadedmetadata",f="loadeddata",h="playing",p="seeked",v="reap",g="config",m="landscape",y="portrait";var E=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:"progress",TIME_UPDATE:"timeupdate",LOAD_START:"loadstart",VOLUME_CHANGE:"volumechange",PAUSE:"pause",PLAYING:h,PLAY:"play",WAITING:"waiting",CAN_PLAY:"canplay",ENDED:"ended",SEEKED:p,SEEKING:"seeking",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:v,CONFIG:g,QUALITIES:"qualities",SET_QUALITY:"quality:set",NON_RECOVERABLE_ERROR:"error:fatal",RECOMMENDATIONS_READY:"recommendationsready",AUDIO_ONLY_SOURCE:"audioonlysource",LANDSCAPE:m,PORTRAIT:y,RENDER_PLUGIN:"renderplugin",DVR:"dvr",LIVE:"live",SEEK_QUEUED:"seek:queued",SEEK_CANCEL:"seek:cancel",PLUGIN_REGISTERED:"plugin:registered"});const T="is-playing",_="is-paused",b="is-loading",A="is-starting",S="is-seeking",L="is-ended",k="is-waiting",w="is-touched";var D=Object.freeze({__proto__:null,PLAYING:T,FULLSCREEN:"is-fullscreen",PAUSED:_,MUTED:"is-muted",LOADED:"is-loaded",LOADING:b,STARTING:A,SEEKING:S,GRABBING:"is-grabbing",DISABLED:"is-disabled",SMALL:"is-small",TINY:"is-tiny",RTL:"is-rtl",ENDED:L,LIVE:"is-live",ERRORED:"is-error",WAITING:k,AUTOPLAY:"is-autoplay",NO_AUTOPLAY:"no-autoplay",SEAMLESS:"is-seamless",TOGGLING:"is-toggling",LIVE_SEEKED:"is-live-seeked",NO_DVR:"no-timeline",HAS_POSTER:"has-poster",MENU_OPENED:"has-menu-opened",TOUCHED:w,HOVERED:"is-hovered",TOUCH_DEVICE:"is-touch-device",WILL_SEEK:"will-seek",SEEKABLE:"is-seekable"});function R(t){this.message=t}R.prototype=new Error,R.prototype.name="InvalidCharacterError";var O="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new R("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,a=0,s="";n=e.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 C=function(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(O(t).replace(/(.)/g,(function(t,e){var r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(e)}catch(t){return O(e)}};function I(t){this.message=t}I.prototype=new Error,I.prototype.name="InvalidTokenError";var x,P=function(t,e){if("string"!=typeof t)throw new I("Invalid token specified");var r=!0===(e=e||{}).header?0:1;try{return JSON.parse(C(t.split(".")[r]))}catch(t){throw new I("Invalid token specified: "+t.message)}};P.InvalidTokenError=I,function(t){t[t.OFF=0]="OFF",t[t.ON=1]="ON",t[t.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(x||(x={}));const M=function(){const t=new Map;return{render:(e,r)=>{const n=t.get(e);if(!n)return;const i=null==n?void 0:n.onrender;"function"==typeof i&&i(...r)},remove:(e,r)=>{const n=t.get(e);if(!n)return;const i=null==n?void 0:n.onremove;"function"==typeof i&&i(...r)}}}();function F(t,e,r){const n="boolean"==typeof r;if("boolean"!=typeof r&&(r=t.paused),function(t,e,r){const n=t.poll(e?"beforeplay":"beforepause",{forced:r});return n&&n.defaultPrevented}(t,r,n))return;if(0==r)return t.pause();if(0==t.reaper)return;const i=t.reaper.get("__pending_play");return 0!=t.paused||i?i?(i.src!==U(t.original_src)&&N(t),i):(function(t){return(0==t.networkState||0==t.readyState)&&t.currentSrc==U(t.original_src)}(t)&&N(t),(t=>t.autoplay&&x.AUDIO_REQUIRED&t.autoplay)(e)?function(t){t.muted=!1,0==t.volume&&(t.volume=1);return t.play().catch(t=>{console.warn("[flowplayer/play] autoplay audio required\n%s",t.message)})}(t):t.play().catch(e=>(console.warn("[flowplayer/play] attempting muted autoplay\n%s",e.message),t.muted=!0,t.volume=0,t.play()))):void 0}function N(t){t.currentSrc.match(/^blob:/)||t.load()}function U(t){const e=document.createElement("a");return e.href=t,e.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",l="mouseleave",u="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",A="seeking",S="reap",L="config",w="landscape",k="portrait";var R=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:l,MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_MOVE:"mousemove",TOUCH_START:"touchstart",TOUCH_MOVE:"touchmove",TOUCH_END:u,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:A,DURATION_CHANGE:"durationchange",BEFORE_PLAY:"beforeplay",BEFORE_PAUSE:"beforepause",STATE:"state",CUEPOINTS:"cuepoints",CUEPOINT_START:"cuepointstart",CUEPOINT_END:"cuepointend",VIEW_ENTER:"viewenter",VIEW_LEAVE:"viewleave",SOURCE:"src",RECOVER:"recover",REAP:S,CONFIG:L,QUALITIES:"qualities",SET_QUALITY:"quality:set",NON_RECOVERABLE_ERROR:"error:fatal",RECOMMENDATIONS_READY:"recommendationsready",AUDIO_ONLY_SOURCE:"audioonlysource",LANDSCAPE:w,PORTRAIT:k,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 D="flowplayer-ui",O="flowplayer-control",C="flowplayer-live-status",I="flowplayer-elapsed-time",x="flowplayer-timeline-bar",P="flowplayer-volume-bar",M="flowplayer-header",F="flowplayer-primary",N="flowplayer-middle",U="flowplayer-middle-zone",B="flowplayer-wait",j="flowplayer-play-icon",G="flowplayer-pause-icon",H="flowplayer-rewind-icon",K="flowplayer-volume-icon",V="flowplayer-live-countdown";var W=Object.freeze({__proto__:null,SUBTITLES_MENU:"flowplayer-subtitles-menu",SHARE_MENU:"flowplayer-share-menu",SPEED_MENU:"flowplayer-speed-menu",QUALITY_MENU:"flowplayer-quality-menu",AUDIO_MENU:"flowplayer-audio-menu",UI:D,CONTROL:O,CONTROL_BUTTONS:"flowplayer-control-buttons",LIVE_STATUS:C,ELAPSED:I,TIMELINE:x,CONTROL_DURATION:"flowplayer-control-duration",VOLUME_CONTROL:"flowplayer-volume-control",VOLUME_BAR:P,HEADER:M,HEADER_LEFT_ZONE:"flowplayer-header-left-zone",HEADER_RIGHT_ZONE:"flowplayer-header-right-zone",PRIMARY:F,HEADER_DURATION:"flowplayer-header-duration",MIDDLE:N,MIDDLE_ZONE:U,WAIT:B,MIDDLE_BUTTONS:"flowplayer-middle-buttons",MIDDLE_LEFT_ZONE:"flowplayer-middle-left-zone",MIDDLE_RIGHT_ZONE:"flowplayer-middle-right-zone",AIRPLAY_ICON:"flowplayer-airplay-icon",CHROMECAST_ICON:"flowplayer-chromecast-icon",SMALL_PLAY_ICON:"flowplayer-small-play-icon",SMALL_PAUSE_ICON:"flowplayer-small-pause-icon",PLAY_ICON:j,PAUSE_ICON:G,FULLSCREEN_ENTER_ICON:"flowplayer-fullscreen-enter-icon",FULLSCREEN_EXIT_ICON:"flowplayer-fullscreen-exit-icon",SKIP_NEXT_ICON:"flowplayer-skip-next-icon",SKIP_PREVIOUS_ICON:"flowplayer-skip-previous-icon",FAST_FORWARD_ICON:"flowplayer-fast-forward-icon",REWIND_ICON:H,SHARE_ICON:"flowplayer-share-icon",VOLUME_ICON:K,MUTE_ICON:"flowplayer-mute-icon",UNMUTE_ICON:"flowplayer-unmute-icon",CLOSE_ICON:"flowplayer-close-icon",FACEBOOK_ICON:"flowplayer-facebook-icon",TWITTER_ICON:"flowplayer-twitter-icon",LINK_ICON:"flowplayer-link-icon",EMBED_ICON:"flowplayer-embed-icon",LIVE_COUNTDOWN:V,PLAYLIST_CONTROLS:"flowplayer-playlist-controls"});const q="is-playing",z="is-paused",Y="is-loading",X="is-starting",Q="is-seeking",Z="is-ended",J="is-waiting",$="is-touched";var ee=Object.freeze({__proto__:null,PLAYING:q,FULLSCREEN:"is-fullscreen",PAUSED:z,MUTED:"is-muted",LOADED:"is-loaded",LOADING:Y,STARTING:X,SEEKING:Q,GRABBING:"is-grabbing",DISABLED:"is-disabled",SMALL:"is-small",TINY:"is-tiny",RTL:"is-rtl",ENDED:Z,LIVE:"is-live",ERRORED:"is-error",WAITING:J,AUTOPLAY:"is-autoplay",NO_AUTOPLAY:"no-autoplay",SEAMLESS:"is-seamless",TOGGLING:"is-toggling",LIVE_SEEKED:"is-live-seeked",NO_DVR:"no-timeline",HAS_POSTER:"has-poster",MENU_OPENED:"has-menu-opened",TOUCHED:$,HOVERED:"is-hovered",TOUCH_DEVICE:"is-touch-device",WILL_SEEK:"will-seek",SEEKABLE:"is-seekable"});function te(e){this.message=e}te.prototype=new Error,te.prototype.name="InvalidCharacterError";var re="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new te("'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 ne=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(re(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 re(t)}};function ie(e){this.message=e}ie.prototype=new Error,ie.prototype.name="InvalidTokenError";var ae,se=function(e,t){if("string"!=typeof e)throw new ie("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(ne(e.split(".")[r]))}catch(e){throw new ie("Invalid token specified: "+e.message)}};se.InvalidTokenError=ie,function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(ae||(ae={}));const oe=new Map,le=(e,t)=>new(((e,t)=>{const r=e.get(t);if(!r)throw new Error(`no flowplayer component with the name ${t} exists`);const n=window.customElements.get(t);if(!n)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(r);return"function"!=typeof i?n:i})(e._customElements,t))(e),ue=(e,t,r)=>{window.customElements.get(t)||window.customElements.define(t,r),e.customElements.get(t)||e.customElements.set(t,t)};var ce;!function(e){e[e.LOW=1]="LOW",e[e.MEDIUM=2]="MEDIUM",e[e.HIGH=4]="HIGH"}(ce||(ce={}));function de(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("is-live-seeked",!0),e.pause();if(0==e.reaper)return;const i=e.reaper.get("__pending_play");return 0!=e.paused||i?i?(i.src!==he(e.original_src)&&fe(e),i):(function(e){return(0==e.networkState||0==e.readyState)&&e.currentSrc==he(e.original_src)}(e)&&fe(e),(e=>e.autoplay&&ae.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 fe(e){e.currentSrc.match(/^blob:/)||e.load()}function he(e){const t=document.createElement("a");return t.href=e,t.href}
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -12,362 +12,362 @@
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 B(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}function j(t){const e=document.createElement("a");e.href=t;const r=e.pathname&&e.pathname.split(".");return r.length>1&&r[r.length-1]}function G(t){switch(t){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return t}}const H=t=>{var{src:e}=t,r=B(t,["src"]);return[Object.assign({src:e,type:e?G("video/"+j(e)):""},r)]};function K(t){return H({src:t})}function V(t){var{src:e,type:r}=t,n=B(t,["src","type"]);return e&&r?[Object.assign({src:e,type:r},n)]:r&&!e?[Object.assign({type:r},n)]:H(Object.assign({src:e},n))}var W;function q(t,e,r,n={safari:!1}){const i=function(t){return"string"==typeof t?K(t):Array.isArray(t)||"object"!=typeof t?t.reduce((function(t,e){return"string"==typeof e&&(e=K(e)),"object"!=typeof e||Array.isArray(e)||(e=V(e)),t.concat(e)}),[]):V(t)}(r);return t.currentSrc&&(t.innerHTML=""),Array(...Array(i.length)).map((t,e)=>e).some(r=>{const a=i[r];if(W.Ok==function(t,e,r){t.emit("src",r),"string"==typeof r.src&&(t.original_src=r.src);const n=function(t,e,r){return t.plugins.filter(t=>{return(e=t)&&"wants"in e;var e}).find(t=>t.wants(r.src||"",r,e))}(t,e,r);return n?(n.onload(e,t.root,t,r),W.Ok):W.Err}(t,e,a)||W.Ok==function(t,e,r,n={safari:!1}){/^audio\//.test(r.type||"")&&t.emit("audioonlysource");e.start_time&&(r.src=r.src+"#t="+e.start_time);if(""==t.canPlayType(r.type||""))return W.Err;if(r.drm&&(!r.drm["com.apple.fps.1_0"]||!n.safari))return W.Err;"string"==typeof r.src&&(t.src=r.src);return W.Ok}(t,e,a,n))return!0;r==i.length-1&&"string"==typeof a.src&&(t.src=a.src)}),function(t,e){(function(t,e){if(!t.currentSrc)return;if("none"==t.opt("preload"))return;if(e.autoplay&&e.autoplay>0)return;t.load()})(t,e),"none"==t.opt("preload")&&t.render()}(t,e),t}!function(t){t[t.Err=0]="Err",t[t.Ok=1]="Ok"}(W||(W={}));const Y=[v,"seeking","src","seek:cancel"];var z;function X(t,e,r){return isNaN(t.duration)||isNaN(t.currentTime)?{}:(e.offset+=r,0==e.offset?Q(t,e):(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((function(){0!=t.reaper&&(t.currentTime=function(t,e,r=0){return Math.max(Math.min(e,t),r)}(t.currentTime+e.offset,t.duration),e.timer=0,Q(t,e))}),1e3),function(t,e){t.setState("will-seek",!0),t.setState(z.BACKWARD,e.offset<0),t.setState(z.FORWARD,e.offset>0)}(t,e),t.emit("seek:queued",e),e))}function Q(t,e){e.timer&&clearTimeout(e.timer),e.timer=e.offset=0,function(t){t.setState(z.FORWARD,!1),t.setState(z.BACKWARD,!1),t.setState("will-seek",!1)}(t)}function J(){if("undefined"==typeof document)return!1;const t=document.documentElement;return t&&"rtl"==t.getAttribute("dir")}function Z(...t){const e=document.createElement("div");return 0==t.length||e.classList.add(...t),e}function $(t,e,r){const n=function(t){return Array.isArray(t)?t.slice(0):t.split(".")}(e);for(;n.length;){if(null==t)return r;const e=n.shift();if("string"!=typeof e)return r;t=t[e]}return null==t?r:t}function tt(t){const e="number"==typeof t?t:parseInt(t,10);return(e>9?"":"0")+e}function et(t){if(isNaN(t)||t>=Number.MAX_SAFE_INTEGER)return"";const e=t<0?"-":"";t=Math.round(Math.abs(t));const r=Math.floor(t/3600);let n=Math.floor(t/60);return t-=60*n,r>=1?(n-=60*r,e+r+":"+tt(n)+":"+tt(t)):e+tt(n)+":"+tt(t)}!function(t){t.FORWARD="forward",t.BACKWARD="backward"}(z||(z={}));const rt=navigator.languages||[navigator.language];function nt(t,e,r){const n={};return r=e.lang||r,t[r]&&(n[r]=t[r]),function(){try{return rt.reduce((t,e)=>~e.indexOf("-")?t.concat(e,e.split("-")[0]):t.concat(e),[])}catch(t){return[]}}().forEach((function(e){t[e]&&!n[e]&&(n[e]=t[e])})),Object.values(n)}!function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}}();const it=["touchstart","touchmove"];function at(t,e){const r=new Event(t);return e&&Object.assign(r,{data:e}),r}function st(t,e,r){const n=at(e,r);return t.dispatchEvent(n),t}function ot(t,e,r){const n=at(e,r);return t.dispatchEvent(n),n}function ut(t,e,r,n){Array.isArray(e)?e.forEach(e=>lt(t,e,r,n)):lt(t,e,r,n)}function lt(t,e,r,n){if(i=e,!~it.indexOf(i))return t.addEventListener(e,r,n),t;var i;const a=Object.assign(n||{},{passive:!0});return t.addEventListener(e,r,a),t}function ct(t,e,r,n){return ut(t,e,r,Object.assign(n||{},{once:!0}))}const dt={preload:"none",rtl:!1,controls:!0},ft=["loop","muted","preload"];function ht(t,n,i){i.toJSON=function(){return{duration:i.duration,volume:i.volume,currentTime:i.currentTime,states:i.root.className}},i.setSrc=function(e){return q(i,t,e,r())},i.playerState=i.playerState||{},i.setState=function(t,e){if(i.playerState[t]===!!e)return i;const r=Object.assign({},i.playerState,{[t]:e});return r[k]&&(r[T]=!1),i.playerState=r,st(i,"state",i.playerState),i},i.hasState=function(t){return!!i.playerState[t]},i.transitionState=function(t,e,r){i.hasState(t)&&(r=0),r&&i.setState("is-toggling",!0),i.setState(e,!1),i.setState(t,!0),r&&setTimeout((function(){i.setState("is-toggling",!1)}),r)},i.render=function(t,e){return"string"==typeof t?M.render(t,e):(st(i,r().ios?d:f),st(i,"canplay"),i)},i.emit=(t,e)=>(st(i,t,e),i),i.on=(t,e)=>(ut(i,t,e),i),i.once=(t,e)=>(ct(i,t,e),i),i.off=(t,e)=>{var r,n;return r=t,n=e,i.removeEventListener(r,n),i},i.poll=(t,e)=>ot(i,t,e),i.togglePlay=function(e){return F(i,t,e)},i.toggleMute=function(t){t=null==t?!i.muted:!!t,i.muted=t,i.muted||i.volume||(i.volume=1),st(i,"volumechange")},i.toggleDisable=function(t){t=null==t?!i.disabled:!!t,i.setState("is-disabled",t),i.disabled=t},i.destroy=function(){i.pause();const t=e.indexOf(i);~t&&e.splice(t,1),setTimeout((function(){i.setSrc([]),i.reaper&&i.reaper.clear(),st(i,v)}),0)},i.setAttrs=function(t){return ft.forEach(e=>{if(!(e in t))return;const r=t[e];r?i.setAttribute(e,r.toString()):i.removeAttribute(e)}),i},i.opt=function(e,r){return r=void 0===r?$(dt,e):r,$(t,e,r)},i.i18n=function(t,e){if(!i.reaper)return"";const r=i.reaper.get("translations");return r?function t(e,r,n,i){return(i=i||0)>=e.length?n:$(e[i],r,t(e,r,n,i+1))}(r,t,e||""):e||""},i.setOpts=function(e){Object.assign(t,e),"disabled"in e&&void 0!==e.disabled&&i.toggleDisable(e.disabled),"muted"in e&&void 0!==e.muted&&i.toggleMute(e.muted);const r=!!t.autoplay&&!i.hasState("no-autoplay");i.setState("is-autoplay",r),i.setState("is-rtl",i.opt("rtl",function(t){if(!t)return J();const e=t.getAttribute("dir");return e?"rtl"==e:J()}(n))),i.setState("is-live",!!t.live),i.setState("no-timeline",!(!t.live||t.dvr)),i.setState("has-poster","string"==typeof t.poster&&t.poster.length>0),i.setState("is-seekable",!!t.seekable),n.style.backgroundImage=i.hasState("has-poster")?"url('"+t.poster+"')":"",st(i,g,t)},i.renderPlugin=function(t){ot(i,"renderplugin",t).defaultPrevented||i.root.appendChild(t)};const a={offset:0,timer:0};var s,o;o=a,(s=i).on(Y,(function(){Q(s,o)})),i.enqueueSeek=function(t){if(0!=i.opts.seekable&&!(1==i.opts.disabled&&t>0))return X(i,a,t)}}function pt(t,e){const r=e.querySelector("video"),n=r||(t._video_element_callback?t._video_element_callback(t):document.createElement("video"));return n.classList.add("fp-engine"),n.playsInline=!0,r||e.append(n),n}function vt(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const r=t.flowplayer;return"function"==typeof r?(r(e),e):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(e)||r.extensions.push(e),e)}function gt(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}}const mt=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io"];function yt(t,e){return!!~mt.indexOf(t)||t.indexOf(e)===t.length-e.length}yt.check_whitelist=function(t){return!!~mt.indexOf(t)};const Et="production";function Tt(t,e){const r={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let n={c:"{}",exp:0};e=e||{};try{n=P(t),r.valid_jwt=!0}catch(t){}return r.raw=t,r.data=JSON.parse(n.c),r.exp=n.exp,e.require_valid_token&&Tt.validate(r),r}function _t(t){try{return Tt.validate(t),{success:!0,message:""}}catch(t){return{success:!1,message:t.message}}}var bt;function At(t){return{grant:t,is_granted:e=>(t&e)===e}}function St(t,e,r){e&&e.destroy(),console.error(new Error(r.details||r.reason)),t.innerHTML="",t.classList.remove("flowplayer"),t.classList.add("flowplayer-fatal"),t.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 Lt(t,e){const r=e.clientWidth;e.classList.toggle("is-small",r<600),e.classList.toggle("is-tiny",r<400)}function kt(t,e,n){let i=!0;e.classList.add("flowplayer"),Lt(0,e),ut(n,["loadstart",c],(function(){Lt(0,e)})),ut(n,"state",(function(){Object.entries(n.playerState).forEach((function([t,r]){e.classList.toggle(t,r)}))})),ut(n,"timeupdate",(function(){n.setState(k,!1)})),ut(n,g,(function(){const r=n.paused&&(!t.autoplay||e.classList.contains("no-autoplay"))&&0==n.currentTime;[b,A].forEach((function(t){n.setState(t,r)}))})),ut(n,"ended",(function(e){setTimeout((function(){e.defaultPrevented||(t.rewind&&!n.loop&&(t.autoplay&&(t.autoplay=0,n.setState("is-autoplay",!1)),n.setState(S,!0),ct(n,p,(function(){n.setState(S,!1),n.pause(),n.setState(A,!0)})),n.currentTime=0),ct(n,"timeupdate",(function(){n.setState(L,!1)})),n.transitionState(L,T,t.loop||t.rewind?0:300))}),0)})),ut(n,["seeking",p],(function(t){n.setState(S,"seeking"==t.type),n.setState(_,n.paused),n.setState(T,!n.paused)})),ut(n,"ended",(function(){i=!0})),ut(n,r().ios?d:f,(function(t){const e="src"!=t.type||"none"!==n.opt("preload");n.setState("is-loaded",e),n.setState(b,!e)})),ut(n,["waiting","canplay","loadstart"],(function(e){if(!n.hasState(S)&&("canplay"!=e.type||t.autoplay||n.setState(k,!1),"loadstart"!=e.type||"none"!=n.opt("preload")||t.autoplay)){if("loadstart"==e.type&&t.autoplay)return ct(n,h,(function(){n.setState(k,!1)}));"waiting"==e.type&&[T,_,A].forEach((function(t){n.setState(t,!1)})),n.setState(L,!1),n.setState(k,"waiting"==e.type)}})),ut(n,[h,"pause"],(function(e){const r=e.type==h,a=n.currentTime==n.duration,s=r&&i&&t.autoplay||n.hasState(k);if(r&&(n.started=!0,i=!1),n.setState(k,!1).setState(A,!1),a||n.hasState(S))return;const o=r?T:_,u=r?_:T;n.transitionState(o,u,s?0:300),r&&n.setState("no-autoplay",!1)}))}function wt(t){const e=function(t){const e=t.getBoundingClientRect(),r=window.innerHeight,n=e.height,i=e.bottom,a=n/5;return e.top<=a&&e.top+n>r-a||i-n+a>=0&&i<r+a}(t.root);return t.in_viewport===e||(t.in_viewport=e,st(t,e?"viewenter":"viewleave")),t}function Dt(t,r,n){wt(n);const a={should_resume:!!t.autoplay,has_user_gesture:!1,locked:!1};[l,i].forEach(t=>ct(n,t,()=>a.has_user_gesture=!0)),ut(n,"play",(function(){a.locked||(a.should_resume=!0)})),ut(n,"pause",(function(){a.locked||(a.should_resume=!1)})),ut(n,"canplay",(function(r){t.autoplay&&!e.filter((function(t){return!t.paused})).length&&n.in_viewport&&n.paused&&a.should_resume&&n.togglePlay(!0)})),t.autopause&&(ut(n,"viewenter",(function(){a.should_resume&&n.togglePlay(!0)})),ut(n,"viewleave",(function(){const t=!n.paused;a.locked=!0,n.pause(),setTimeout((function(){a.should_resume=t,a.locked=!1}),0)})))}Tt.validate=function(t){if("string"==typeof t&&(t=Tt(t)),!t||!t.raw){if(yt.check_whitelist(window.location.hostname)||"dev"===Et.toString())return!0;throw new Error("No token provided in configuration")}if(!t.valid_jwt)throw new Error("Invalid token provided");const e=window.location.hostname,r=yt.bind(null,e);if("dev"!==Et.toString()&&t.data.domain&&t.data.domain.length&&!t.data.domain.some(r))throw new Error("Domain not allowed");if("dev"!==Et.toString()&&1e3*t.exp-Date.now()<0)throw new Error("Expired token");return!0},Tt.id=function(t){if(t)return"string"==typeof t&&(t=Tt(t)),t.data.id},function(t){t[t.ADS=2]="ADS",t[t.ANALYTICS=4]="ANALYTICS",t[t.NO_METERING=8]="NO_METERING",t[t.DEVELOPER_PLAN=16]="DEVELOPER_PLAN"}(bt||(bt={})),At.of=At,At.from_token=function(t){const e=Tt(t,{require_valid_token:!0});return At.of(e.data.acl)},At.permissions=bt,[s,c].forEach(t=>{window.addEventListener(t,(function(){e.forEach((function(t){const e=t.root;e.prevWidth!=e.clientWidth&&(st(t,c),e.prevWidth=e.clientWidth)}))}))}),window.addEventListener("scroll",(function(){e.forEach(wt)}));function Rt(t){if("number"==typeof t&&!isNaN(t))return Number(t);if("string"==typeof t){const e=t.split(":");return Number(e[1])/Number(e[0])}return t}function Ot(t,e,r){const n=document.createElement("div");n.classList.add("fp-ratio"),e.append(n);let i=Rt(t.ratio||.5625);n.style.paddingTop=100*i+"%";const a=[f,d];r.on(a,(function(){const t=r.videoHeight&&r.videoWidth&&r.videoHeight/r.videoWidth;t&&r.setOpts({ratio:t})})),r.on(g,(function(){const e=r.videoHeight&&r.videoWidth&&r.videoHeight/r.videoWidth,a=Rt((null==t?void 0:t.ratio)||e||.5625);i!==a&&(i=a,n.style.paddingTop=100*a+"%")}))}const Ct=function(){const t=gt(),e=t.flowplayer?t.flowplayer:{extensions:[]};return Array.isArray(e.extensions)||(e.extensions=[]),e}();function It(r,n){if("function"==typeof r)return t.push(...[...arguments].filter(t=>"function"==typeof t)),It;"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=_t(n.token);if(!s.success)return St(i,null,{reason:"token",details:s.message});const o=new Map,u=pt(n,i);if(u.reaper=o,Object.defineProperty(u,"token",{value:"string"==typeof n.token?Tt.id(n.token):"",writable:!1}),u.addEventListener(v,()=>{o.clear(),u.reaper=0,delete u.root}),u.root=i,n.token&&At.from_token(n.token).is_granted(At.permissions.DEVELOPER_PLAN))return St(i,null,{reason:"developer_plan",details:"Using developer plan tokens is not currently supported"});!~e.indexOf(u)&&e.push(u),ht(n,i,u),u.plugins=It.extensions.map(t=>new t(It,u)),kt(n,i,u),Dt(n,0,u),Ot(n,i,u),u.plugins.forEach(t=>{try{t.init(n,i,u)}catch(e){console.log("Error(plugin/%s)",t.constructor.name,e)}}),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("canplay"),"none"==u.opt("preload")&&u.paused&&u.currentSrc&&u.render(),u.emit("mount"),u.on("error:fatal",(function(t){St(i,u,t.data||{})})),u}Object.assign(It,Ct),function(n){Array.isArray(n.extensions)&&n.extensions.forEach(e=>t.push(e)),n.components=M,n.version="3.0.0-beta",n.commit="494a2e0586e1a0959f8c5a3399c5464b990bc858",n.instances=e,n.extensions=t,n.support=r,n.events=E,n.states=D,n.jwt=P,n.autoplay=x}(It),"object"==typeof document&&setTimeout(st,0,document,"flowplayer:umd",It);var xt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Pt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Mt(t){var e={exports:{}};return t(e,e.exports),e.exports}var Ft=Mt((function(t,e){var r=xt&&xt.__assign||function(){return(r=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};e.__esModule=!0,e.remove=e.downcase=e.pluck=e.merge=void 0,e.merge=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce((function(t,e){return r(r({},t),e)}),{})},e.pluck=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return Object.keys(t).filter((function(t){return~r.indexOf(t)})).reduce((function(r,n){var i;return e.merge(r,((i={})[n]=t[n],i))}),{})},e.downcase=function(t){return(t||"").toString().toLowerCase()},e.remove=function(t,e){var r=t.lastIndexOf(e);return~r&&t.splice(r,1),t}})),Nt=Mt((function(t,e){var r=xt&&xt.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),n=xt&&xt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=xt&&xt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.hasOwnProperty.call(t,i)&&r(e,t,i);return n(e,t),e};e.__esModule=!0;var a=i(Ft),s=function(){function t(){this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return t.of=function(){return new t},t.is_empty=function(t){return 0==t.pending.length},t.is_high_water=function(e){return e.open.length==t.MAX_OPEN_REQUESTS},t.maybe_spawn_req=function(e){if(t.is_empty(e))return e;if(t.is_high_water(e))return e;try{var r=t.lpop(e);r&&t.request(e,r)}catch(t){}},t.increment_failures=function(e){return e.stats.failures++,e.stats.failures>t.MAX_FAILURE_COUNT&&(e.stats.ttl=Date.now()+t.REQUEST_TTL_MS),e},t.handle_error=function(e,r){t.rm(e,r),t.increment_failures(e)},t.request=function(e,r){var n=r[0],i=r[1],a=r[2];if(!(Date.now()<e.stats.ttl)){var s=new XMLHttpRequest;e.open.push(s),s.timeout=t.REQUEST_TIMEOUT_MS,s.ontimeout=function(){t.handle_error(e,s)},s.onerror=function(r){t.handle_error(e,s)},s.onreadystatechange=function(){s.readyState==XMLHttpRequest.DONE&&t.rm(e,s),Math.floor(s.status/100)},s.onload=function(){t.rm(e,s),e.stats.failures&&e.stats.failures--},s.open(i,n),s.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{s.send(JSON.stringify(a))}catch(t){}}},t.rpush=function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return r.forEach((function(r){e.pending.length>=t.MAX_PENDING||(e.pending.push(r),t.maybe_spawn_req(e))})),e},t.lpop=function(t){return t.pending.shift()},t.rm=function(t,e){return a.remove(t.open,e),t},t.MAX_OPEN_REQUESTS=3,t.MAX_PENDING=5,t.REQUEST_TIMEOUT_MS=4e3,t.REQUEST_TTL_MS=5e3,t.MAX_FAILURE_COUNT=3,t}();e.default=s})),Ut=Mt((function(t,e){var r=xt&&xt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0;var n=r(Nt);e.default=n.default.of()})),Bt=Mt((function(t,e){e.__esModule=!0,e.prepare_url=e.URL_PARAM=void 0,e.URL_PARAM=/:([a-zA-Z_]+)/g,e.prepare_url=function(t,r){return t.url.replace(e.URL_PARAM,(function(e){if((e=e.slice(1,e.length))in r)return r[e].toString();t.log.error(new Error("\n preparing url["+t.url+"] failed\n \n parameter["+e+"] not detected in params:\n \n "+JSON.stringify(r,null,2)+"\n "))}))}})),jt=Mt((function(t,e){e.__esModule=!0,e.Log=void 0;var r=function(){function t(t){this.emitter=t}return t.prepare=function(t,e){var r=document.createEvent("Event");return r.initEvent(t,!1,!0),r.ns=t,r.data=e,r},t.of=function(e){return new t(e)},t.prototype.info=function(e){this.emitter.dispatchEvent(t.prepare(t.NAMESPACE.INFO,e))},t.prototype.error=function(e){this.emitter.dispatchEvent(t.prepare(t.NAMESPACE.ERROR,e))},t.prototype.warn=function(e){this.emitter.dispatchEvent(t.prepare(t.NAMESPACE.WARN,e))},t.NAMESPACE={INFO:"tracker:info",ERROR:"tracker:err",WARN:"tracker:warn"},t}();e.Log=r})),Gt=Mt((function(t,e){var r;e.__esModule=!0,e.Verb=void 0,(r=e.Verb||(e.Verb={})).POST="POST",r.PUT="PUT",r.GET="GET"})),Ht=Mt((function(t,e){var r=xt&&xt.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),n=xt&&xt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=xt&&xt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.hasOwnProperty.call(t,i)&&r(e,t,i);return n(e,t),e},a=xt&&xt.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var a=arguments[e],s=0,o=a.length;s<o;s++,i++)n[i]=a[s];return n},s=xt&&xt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0;var o=s(Ut),u=s(Nt),l=i(Bt),c=i(Ft),d=function(){function t(e,r){var n=this;void 0===r&&(r={});var i=this;if(this.emitter=e,this.url=r.url,this.log=jt.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),t.assert_emitter_api(this.emitter),void 0===t.verb[this.verb])throw new Error("invalid HTTP verb["+this.verb+"] passed");if("string"!=typeof this.url)throw new Error("invalid API url["+this.url+"] passed");t.TRACKERS.push(this),i.events.forEach((function(e){t.create_listener(n,e,(function(r){void 0===r&&(r={});var a=c.merge(i.metadata,{event_type:e},r.data||r),s=l.prepare_url(i,a),o=t.pluck_valid_keys(i,a),d=t.ensure_required_keys(i,o);if(d.length)return i.log.error("Tracker.validate_metadata() failed for \n Event["+e+"]\n missing keys: "+d+"\n payload:\n "+JSON.stringify(o,null,2));u.default.rpush(n.rq,[s,n.verb,o])}))}))}return t.of=function(e,r){return new t(e,r)},t.ensure_required_keys=function(t,e){return t.required_keys.filter((function(t){return!(t in e)}))},t.pluck_valid_keys=function(t,e){return c.pluck.apply(c,a([e],t.valid_keys))},t.merge_metadata=function(e,r){return void 0===r&&(r={}),e.metadata=t.pluck_valid_keys(e,c.merge(e.metadata,r)),e},t.assert_emitter_api=function(t){if("function"!=typeof(t||{}).addEventListener)throw new Error("Tracker() received an emitter that does not implement the addEventListener method");if("function"!=typeof(t||{}).removeEventListener)throw new Error("Tracker() received an emitter that does not implement the removeEventListener method")},t.create_listener=function(t,e,r){t.listeners.push([e,r]),t.emitter.addEventListener(e,r)},t.prototype.destroy=function(){var e=this;this.listeners.forEach((function(t){var r=t[0],n=t[1];return e.emitter.removeEventListener(r,n)})),delete this.rq,delete this.emitter,c.remove(t.TRACKERS,this)},t.prototype.put=function(e){return void 0===e&&(e={}),t.merge_metadata(this,e),this},t.TRACKERS=[],t.QUEUE=o.default,t.verb=Gt.Verb,t}();e.default=d})),Kt=Mt((function(t,e){var r=xt&&xt.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),n=xt&&xt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=xt&&xt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.hasOwnProperty.call(t,i)&&r(e,t,i);return n(e,t),e},a=xt&&xt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};e.__esModule=!0,e.API=e.Tracker=void 0;var s=a(Ht);e.Tracker=s.default;var o=i(Bt);e.API=o})),Vt="ping",Wt="display",qt="view";const Yt={3:!0,5:!0,7:!0,9:!0};var zt,Xt=(zt=Array(16),Array.from({length:16}).map((t,e)=>e).forEach(t=>{let e;0==(3&t)&&(e=4294967296*Math.random()),zt[t]=(e||0)>>>((3&t)<<3)&255}),zt).reduce((function(t,e,r){const n=(e+256).toString(16).substr(1);return t+(r.toString()in Yt?"-":"")+n}),"");const Qt=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],Jt=["created","position"],Zt=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];function $t(t,e){return t.duration/1===t.duration&&Object.assign(e,function(t){const e=t/100;return{segment_duration:e,breakpoints:Array(...Array(100)).map((function(t,r){return Math.floor(r*e*1e3)/1e3}))}}(t.duration))}function te(t,e,r){if(!e.segment_duration&&!$t(t,e))return;const n=function(t,e,r){const n=e.last_idx,i=r?99:ee(t,e);return e.last_idx=i,i<=n?[]:e.breakpoints.slice(n,99==i?100:i).map((function(t){return e.breakpoints.indexOf(t)}))}(t,e,r);0!=n.length&&t.emit(Vt,{position:n})}function ee(t,e){return Math.min(Math.floor(t.currentTime/e.segment_duration),99)}const re="vod",ne="live",ie=[Wt,Vt,qt];function ae(t,e,r){switch(null==e?void 0:e.kind){case"live":return function(t,e){const r=Date.now();r-e.last_tracked_ts<6e4||(e.last_tracked_ts=r,++e.ticks,t.emit(Vt,{position:60*e.ticks}))}(t,e);case"vod":return te(t,e,"boolean"==typeof r&&r)}}function se(t){const e=t.ads;return void 0!==e&&(void 0!==e.schedule&&("function"==typeof e.hasPreroll&&(e.currentRequests?e.currentRequests:!!e.adPlaying||!(!e.hasPreroll()||0!=e.nextIndex))))}function oe(){try{return window.location!==window.parent.location?document.referrer:document.location.href}catch(t){return!1}}class ue{init(t,e,r){if(!At.from_token(t.token||"").is_granted(At.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:()=>{ae(r,n.ticker)}};const a={session_id:Xt,autoplay:r.autoplay,muted:r.muted,player_id:t.player_id,customer_user_id:t.customer_user_id},s=Kt.Tracker.of(r,{verb:Kt.Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:ie,required_keys:Qt,optional_keys:Zt.concat(Jt).slice(0),metadata:a});r.on(v,(function(){s&&s.destroy()})),r.on(g,(function(e){if(!s)return;const i=$(e,"data.metadata",{});if(!i.media_id)return;const a=$(s,"metadata.media_id");if(a&&i.media_id==a)return;const o=$(t,"analytics",{});s.put(i),s.put(o);const u=$(t,"metadata.live_start_time",t.live)?ne:re;s.put({video_type:u,source:t.source||oe()||""}),n.ticker=t.live?{ticks:0,last_tracked_ts:Date.now(),kind:"live"}:{last_idx:0,segment_duration:0,breakpoints:[],kind:"vod"},n.ended=!1,r.emit(Wt)}));let o=0;r.on(h,(function(){if(!s)return;if(o||function(t,e){return t.metadata.media_id&&t.metadata.media_id==e.last_media_id}(s,n))return;s.put({muted:r.muted});const t=se(r);if(t)return o=Promise.resolve(t).then((function(){n.last_media_id=s.metadata.media_id,r.emit(qt),o=0})).catch((function(){o=0}));n.last_media_id=s.metadata.media_id,r.emit(qt)})),r.on("timeupdate",(function(){var e;s&&(o||se(r)||n.ended||(!t.live&&r.currentTime+.25>=r.duration&&ae(r,n.ticker,!0),(e=i).locked||(e.locked=setTimeout((function(){return e.task(),function(t){return t.locked=!1,t}(e)}),e.ttl))))})),r.on(p,(function(){s&&n.ticker&&"vod"==n.ticker.kind&&function(t,e){$t(t,e),e.last_idx=ee(t,e)}(r,n.ticker)})),r.on("ended",(function(){s&&function(t,e){e.ended||(e.ended=!0,ae(t,e.ticker))}(r,n)}))}}function le(t,e,r){!function(t,e,r){let n;"undefined"!=typeof window&&"ontouchstart"in window&&r.setState("is-touch-device",!0),r.setState("is-accessibility",!1);const i=e.querySelector(".fp-middle");i&&i.addEventListener(l,(function(t){0!=t.cancelable&&(t.preventDefault(),r.emit(t.type,{source:t}))})),r.on(l,(function(t){setTimeout((function(){if(t.defaultPrevented)return;if(r.hasState(k))return;if(r.ended)return r.togglePlay(!0);const e=r.hasState(A);n&&clearTimeout(n),(e||r.hasState(w)||r.hasState("no-autoplay"))&&(r.hasState(w)&&(r.setState(w,!1),r.setState("is-hovered",!1)),r.togglePlay(),e)||(r.setState(w,!0),r.paused||(n=setTimeout((function(){n=0,r.setState(w,!1),r.setState("is-hovered",!1)}),2e3)))}),0)}))}(0,e,r)}vt(gt(),ue),"undefined"!=typeof window&&window.matchMedia&&[m,y].forEach((function(t){window.matchMedia("(orientation: "+t+")").addListener((function(r){e.length&&e.forEach((function(e){r.matches&&e.emit(t)}))}))}));const ce={name:"fp-fullscreen",translation_key:"core.fullscreen"},de={name:"fp-fullscreen-exit",translation_key:"core.exit_fullscreen"},fe={name:"fp-play",translation_key:"core.play"},he={name:"fp-pause",translation_key:"core.pause"},pe={translation_key:"core.mute",name:"fp-volume-mute-unmute"},ve={translation_key:"core.play",name:"fp-small-play"},ge={translation_key:"core.pause",name:"fp-small-pause"};function me(t){const e=document.createElement("div");return e.setAttribute("class",t.name),t.title&&e.setAttribute("title",t.title),t.title&&e.setAttribute("aria-label",t.title),e.setAttribute("tabindex","0"),e.setAttribute("focusable","true"),e}function ye(t,e){const r=Z();r.classList.add("fp-secondary","fp-togglable"),function(t,e,r){r.toggleFullScreen=function(t){r.ios_fullscreen_disabled||document.fullscreenEnabled&&("boolean"!=typeof t&&(t=!r.in_fullscreen),t?e.requestFullscreen():document.exitFullscreen())},e.addEventListener("fullscreenchange",(function(){const t=document.fullscreenElement===e||document.fullscreenElement==r;r.in_fullscreen=t,r.emit(t?"fullscreenenter":"fullscreenexit"),r.setState("is-fullscreen",t),r.emit(c)})),!1!==t.doubleclick&&e.addEventListener(a,(function(t){var e;t.target&&(null===(e=t.target)||void 0===e?void 0:e.classList.contains("fp-ui"))&&r.toggleFullScreen()}))}(t,e.root,e);const n=me(ce);n.setAttribute("role","button"),n.setAttribute("aria-label",e.i18n("core.fullscreen"));const s=me(de);return s.setAttribute("role","button"),s.setAttribute("aria-label",e.i18n("core.fullscreen_exit")),n.addEventListener(i,()=>e.toggleFullScreen()),s.addEventListener(i,()=>e.toggleFullScreen()),r.append(n,s),r}function Ee(t,e,r){const n=Z("fp-header"),i=Z("fp-primary"),a=Z("fp-duration"),s=ye(t,r),o={logo:""};r.on(g,(function(t){var e,r,n,s,u;s=a,u=(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.duration)||NaN,s.innerText=isFinite(u)?et(u):"";const l=o.logo,c=(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.logo)||"";l!=c&&(o.logo=c,function(t,e,r){if(t.innerHTML="",!e)return;const n=document.createElement("img");if(n.classList.add("fp-logo"),n.src=e,!r)return t.append(n);const i=document.createElement("a");i.href=r,i.append(n),t.append(i)}(i,c,null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.logo_href))})),n.append(i,a,s),e.append(n),r.reaper&&(r.reaper.set("header",n),r.reaper.set("header.secondary",s))}var Te=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 _e(t,e,r){if(!r.reaper)return;const n=Z("fp-middle"),s=Z("fp-left-zone"),o=Z("fp-middle-zone"),u=Z("fp-right-zone"),c=[s,o,u];!function(t,e){const r=e[0],n=e[1];t.on(p,(function(){e.forEach(Ae)})),t.on("seek:queued",(function(t){const i=t.data;if(!i)return;if("number"!=typeof i.offset)return;const a=i.offset;if(0==a)return e.forEach(Ae);const s=a>0?n:r;return Ae(s==n?r:n),function(t,e){const r=t.querySelector(".fp-zone-seconds");r&&(r.innerText=Math.abs(e)+"")}(s,a)})),t.on("seek:cancel",(function(){e.forEach(Ae)})),e.forEach((function(e){const n=e==r?-1:1,i=document.createElement("span");i.classList.add("fp-zone-seconds");const a=document.createElement("span");a.classList.add("fp-zone-sigil");const s=be(fe).cloneNode(!0);s.setAttribute("class","fp-fast-forward"),a.append(s.cloneNode(!0),s.cloneNode(!0)),e.append(i,a),Ae(e),e.addEventListener(l,(function(e){isNaN(t.duration)||isNaN(t.currentTime)||16384&t.opt("ui")||t.hasState("no-timeline")||!t.hasState("will-seek")&&!t.hasState(w)||t.enqueueSeek(5*n)&&(e.stopPropagation(),e.preventDefault())}))}))}(r,[s,u]),c.forEach((function(t){n.append(t)})),r.reaper.set("middle",n),function(t,e){[i,a].forEach(r=>t.addEventListener(r,(function(t){if(!t.defaultPrevented)return t.preventDefault(),e.emit(t.type),!1}))),e.on(i,(function(t){setTimeout((function(){t.defaultPrevented||e.hasState(k)||e.togglePlay()}),0)})),e.on(a,(function(t){setTimeout((function(){t.defaultPrevented||e.toggleFullScreen()}),0)}))}(n,r),function(t){const e=Z("fp-wait");Array(...Array(4)).map((t,e)=>e).forEach(()=>{e.append(document.createElement("b"))}),t.append(e)}(o);const d=Z("fp-switch");return d.append(...[fe,he].map(be)),o.append(d),e.append(n),n.setAttribute("tabindex","0"),n.setAttribute("role","button"),n.setAttribute("aria-label",r.i18n("core.play")),[h,p].forEach(t=>r.once(t,(function(){n.removeAttribute("tabindex"),n.removeAttribute("role"),n.removeAttribute("aria-label")}))),n}function be(t){const e=me(t);return e.removeAttribute("tabindex"),e}function Ae(t){const e=t.querySelector(".fp-zone-seconds");e&&(e.innerText="")}function Se(){}const Le={passive:!0};var ke;function we(t,e){let r=0,n=-1,i=-1;const a=Math.random().toString(32),s=t.classList;t.id=a,s.remove(ke.GRABBING),s.remove(ke.TOUCHING);const o=e.onseek||Se,u=e.onstart||Se,c=e.onend||Se,d=e.onmouse||Se,f=e.ontouch||Se,h=e.ontouchend||Se;function p(e){!function(){const e=t.getBoundingClientRect();r=e.left,n=e.width}();let i=(function(t){return"function"==typeof window.TouchEvent&&t instanceof TouchEvent}(e)?e.changedTouches[0].pageX:e.pageX)-r;return i>n&&(i=n),i<0&&(i=0),i/n*100}function v(e){const r=p(e);r!=i&&(o(t,r),i=r)}return t.addEventListener("touchstart",(function(e){De(t,e)&&(s.add(ke.TOUCHING),Re(t.parentElement)&&(e.preventDefault(),s.add(ke.GRABBING),f(t,p(e)),u(t,p(e)),v(e)))}),Le),t.addEventListener("touchmove",(function(e){e.preventDefault(),v(e),d(t,p(e))}),Le),t.addEventListener(l,(function(e){setTimeout((function(){s.remove(ke.TOUCHING)}),500),De(t,e)&&(e.preventDefault(),s.remove(ke.GRABBING),h(t,p(e)),c(t,p(e)),n=0)}),Le),t.addEventListener("touchcancel",(function(){s.remove(ke.GRABBING,ke.TOUCHING),n=0}),Le),t.addEventListener("mousedown",(function(e){s.contains(ke.TOUCHING)||(document.addEventListener("mousemove",v),s.add(ke.GRABBING),u(t,p(e)),e.preventDefault(),v(e))})),t.addEventListener("mousemove",(function(e){s.contains(ke.TOUCHING)||d(t,p(e))})),document.addEventListener("mouseup",(function(e){s.contains(ke.TOUCHING)||(document.removeEventListener("mousemove",v),s.contains(ke.GRABBING)&&(s.remove(ke.GRABBING),c(t,p(e)),n=0))})),t}function De(t,e){const r=e.target;return!!r&&(r&&!r.closest(t.id)||!Re(t.parentElement)||!t.classList.contains(ke.TOUCHING))}function Re(t){if(!t)return!1;const e=window.getComputedStyle(t);return"0"!==e.width&&"0"!==e.height&&"0"!==e.opacity&&"none"!==e.display&&"hidden"!==e.visibility}!function(t){t.GRABBING="has-grab",t.TOUCHING="has-touch"}(ke||(ke={}));function Oe(t){if("object"!=typeof t.opts)return{head:0,tail:0};if(0==t.seekable.length)return{head:0,tail:0};const e=t.opt("live_dvr_window",0),r=t.seekable.end(t.seekable.length-1);return{head:r,tail:Math.max(t.seekable.start(0),r-e)}}function Ce(t){return t.opt("live",!1)||t.duration>=Number.MAX_SAFE_INTEGER}function Ie(t){return isFinite(t.duration)?t.duration:0==t.seekable.length?0:t.seekable.end(0)}function xe(t){return function(t){return Oe(t).head}(t)-.5}function Pe(t,e){if(!t.parentElement)return;const r=t.clientWidth/t.parentElement.clientWidth*100/2;t.style.left=e-r+"%",t.style.display="block"}function Me(t,e){if(isNaN(t.duration))return;const r=t.buffered;r.length&&(e.style.width=Math.min(r.end(r.length-1)/t.duration*100,100)+"%")}function Fe(t,e){t.style.width="0",e.style.width="0",e.style.display="none"}function Ne(t,e,r){if(e.seeking||!e.seekable||0==e.seekable.length)return;const n=Ue(e,t/100);Pe(r,t);const i=isFinite(e.duration)?n:e.seekable.start(0)+n;r.innerText=et(i)}function Ue(t,e){if(e>1||e<0)return console.warn("cannot calculate a percent outside of range(0..1)"),0;if(isFinite(t.duration))return Ie(t)*e;const r=t.seekable.start(0);return r+e*(t.seekable.end(0)-r)}function Be(t,e){t.style.width="0",e.style.display="none"}const je=requestAnimationFrame;function Ge(t,e,r){const n=Z("fp-controls","fp-togglable"),a=Z("fp-timeline","fp-bar"),s=Z("fp-btns","fp-small-switch"),o=Z("fp-live-status"),l=Z("fp-live-indicator","fp-color"),c=Z("fp-live-text"),f=Z("fp-buffer"),p=Z("fp-progress","fp-color"),v=Z("fp-hover"),m=Z("fp-timestamp"),y=Z("fp-duration"),E=Z("fp-dragger","fp-color"),T=document.createElement("span");m.style.display="none",T.classList.add("fp-elapsed"),T.innerText=et(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,T,a,y),o.append(l,c);const _=me(ge);_.setAttribute("role","button");const b=me(ve);b.setAttribute("role","button"),_.addEventListener("click",(function(){r.togglePlay(),setTimeout((function(){b.focus&&b.focus()}),100)})),b.addEventListener("click",(function(){r.togglePlay(),setTimeout((function(){_.focus&&_.focus()}),100)})),s.append(_,b),p.append(E),o.addEventListener(i,(function(){!function(t,e){try{if(!t.hasState("is-live-seeked"))return;t.dvr_offset=0;const r=xe(t);t.currentTime=r,t.setState("is-live-seeked",!1),e.style.width="0"}catch(t){console.warn("failed to seek to now: %j",t)}}(r,p)})),r.on(g,(function(e){if(0==r.reaper)return;if(!e.data)return;"seekable"in e.data&&(t.seekable=!0);const n=Ce(r)?NaN:e.data.duration||0;if(isNaN(n)||n>=Number.MAX_SAFE_INTEGER)return y.style.display="none";y.style.display="inline-block",y.innerText=et(n)}));let A=performance.now();const L=()=>{if(0==r.reaper||t.live)return;const e=performance.now();var n;e-A>1e3/30&&(n=r,p.style.width=n.currentTime/n.duration*100+"%",A=e),r.paused||a.classList.contains(ke.GRABBING)||je(L)};r.on(h,()=>je(L)),r.on("timeupdate",(function(){var e;0!=r.reaper&&(je(L),a.setAttribute("aria-valuenow",r.currentTime+""),t.live?function(t,e){e.innerText=et(t.currentTime)}(r,T):(e=r,T.innerText=et(e.currentTime)),t.live||Me(r,f),t.live&&function(t){return!("dvr"in t)||1==t.dvr}(t)&&function(t,e){if(0==e)return!0;const r=Oe(t);return r.head-r.tail>=e}(r,t.seconds_to_dvr||0)&&r.setOpts({dvr:r.seekable.length>0}))})),r.on("progress",(function(){0!=r.reaper&&(t.live||Me(r,f))})),r.on("live",(function(){r.setState("is-live-seeked",!1),p.style.width="0%"})),r.on("dvr",(function(){const t=Ie(r),e=r.seekable.end(0)-r.seekable.start(0),n=(t-r.currentTime)/e*100,i=Math.round(n);r.setState("is-live-seeked",i>0),p.style.width=i+"%"})),r.on("seeking",(function(){if(!Ce(r))return;if(0==r.seekable.length||0==r.played.length)return;if(0==Ie(r))return;const t=xe(r),e=r.currentTime>=t?"live":"dvr";r.emit(e)})),r.on(d,(function(){var e,n;0!=r.reaper&&(r.setOpts({live:Ce(r)}),t.live||(n=y,(e=r).duration&&(n.innerText=et(e.duration)),Me(r,f)))})),r.on("durationchange",(function(t){if(0==r.reaper)return;const e=Ce(r),n=e?Ie(r):t.data||r.duration;isNaN(n)||(r.setOpts({live:e,duration:n}),a.setAttribute("aria-valuemax",n+""),a.setAttribute("aria-valuemin","0"))}));let k=!1;return we(a,{onseek:function(e,n){if(He(r))switch(!!t.live){case!0:Ne(n,r,m);case!1:!function(t,e,r){const n=e.duration*(t/100);if(e.disabled&&n>e.currentTime)return!1;r.style.width=t+"%",e.currentTime=n}(n,r,p),Pe(m,n)}},onstart:function(){He(r)&&(r.emit("timeline/gesture/start"),r.setState(S,!0),t.live||function(t){!function(t){t.style.display="block"}(t)}(m))},onend:function(e,n){je(L),0!=t.seekable&&(r.setState(S,!1),t.live&&function(t,e){t/=100,e.currentTime=Ue(e,t)}(n,r))},ontouch:function(){r.paused||(k=!0,r.pause())},ontouchend:function(){k&&(k=!1,r.play()),t.live?Be(v,m):Fe(v,m)},onmouse:function(e,n){if(He(r)&&!a.classList.contains(ke.GRABBING))switch(r.emit("timeline/gesture/move",{percent:n}),!!t.live){case!0:!function(t,e){e.style.width=function(t){return 100-t}(t)+"%"}(n,v),Ne(n,r,m);case!1:!function(t,e){e.style.width=t+"%"}(n,v),function(t,e,r){if(isNaN(t)||isNaN(e.duration))return;Pe(r,t),r.innerHTML="";const n=document.createElement("span");n.innerText=et(t/100*e.duration),r.append(n)}(n,r,m)}}}),a.addEventListener(u,(function(){r.emit("timeline/gesture/end"),t.live?Be(v,m):Fe(v,m)})),n}function He(t){return 0!=t.opt("opts.seekable",!0)&&!isNaN(t.duration)}function Ke(t){try{return localStorage.getItem(t)}catch(t){return null}}function Ve(t,e){try{localStorage.setItem(t,e)}catch(t){}}function We(t,e){const r=function(t,e){const r=document.createElement("div");r.className="fp-volume";const n=t.classList;let i=10;n.contains("is-small")&&(i=8);n.contains("is-tiny")&&(i=6);const a=Array.from({length:i}).map(()=>{const t=document.createElement("i");return t.className="fp-tick",t});return r.append(...a),we(r,{onseek:e})}(e.root,(t,n)=>{n>0&&(e.muted=!1,function(t){try{localStorage.removeItem(t)}catch(t){}}("mute")),Ve("volume",(e.volume=n/100).toString()),qe(r,e.volume)}),n=document.createElement("div");n.className="fp-volumebtn",n.append(me(pe));const a=0!==e.reaper&&e.reaper.get("ui").querySelector(".fp-controls");a&&a.append(n),n.addEventListener(i,(function(){e.toggleMute()})),r.setAttribute("tabindex","0"),r.setAttribute("role","slider"),r.setAttribute("aria-valuemin","0"),r.setAttribute("aria-valuemax","1"),r.setAttribute("aria-label",e.i18n("core.volume","volume")),e.on("volumechange",(function(){const t=0==e.volume||e.muted;e.setState("is-muted",t),Ve("mute",t.toString()),n.setAttribute("aria-label",t?e.i18n("unmute","unmute"):e.i18n("mute","mute")),t&&qe(r,0),r.classList.contains(ke.GRABBING)||qe(r,e.volume)})),"true"==Ke("mute")&&(e.muted=!0,e.setState("is-muted",e.muted));const s=Ke("volume");return s&&!isNaN(Number(s))&&(e.volume=Number(s)),e.emit("volumechange"),r}function qe(t,e){t.setAttribute("aria-valuenow",e.toString());const r=Array.from(t.querySelectorAll(".fp-tick")),n=Math.round(e*r.length);r.forEach((t,e)=>{t.classList.toggle("fp-color",e<n)})}function Ye(){return"https:"===location.protocol}function ze(t){const e=document.createElement("a");return e.href=t,e}const Xe={"-1":"an unknown error occurred",1:"media playback was aborted",2:"a network error occurred",3:"unable to decode media content",4:"unsupported media type",1001:"cannot load insecure content in a secure context",1002:"no internet connection detected"};function Qe(){return!0===(navigator||{}).onLine}function Je(t,e,r){r.on(n,(function(t){const e=t.data||r.error||new Error,n=t.code||e.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(t.defaultPrevented)return;if("AbortError"==e.name)return;r.setState("is-error",!0),8===n||e.fatal||function(t){const e=t.togglePlay,r=t.root;t.togglePlay=Se,t.once("recover",(function(){t.togglePlay=e,t.setState("is-error",!1);const n=r.querySelector(".fp-error");n&&n.remove()}))}(r);const a=function(t,e,r){switch(e){case"http:0":return function(t){return function(t){try{return Ye()&&"http:"==ze(t).protocol}catch(t){return!1}}(t.original_src)?{code:1001}:Qe()?{code:2}:Qe()?{code:-1}:{code:1002}}(t);case 4:return t.once("loadstart",(function(){t.emit("recover")})),r;default:return r}}(r,n,e),s=function(t,e){if(e.message)return e.message;if(e.stack)return e.stack;const r=(e.code||-1).toString();return t.i18n("media_errors."+r,Xe[r]||Xe[-1])}(r,a);console.error(i,s);const o=r.reaper&&r.reaper.get("ui");return o&&function(t,e,r,n){if(!t)return;const i=document.createElement("div");if(i.classList.add("fp-error"),i.innerText=e,n){const e=t.querySelector("#"+n);e&&t.removeChild(e),i.id=n}if(t.append(i),r){const t=document.createElement("div");t.classList.add("fp-error-details"),t.innerText=r,i.append(t)}}(o,s,e.details)}))}))}function Ze(t,e,r){if(!r.reaper)return;const n=document.createDocumentFragment(),i=Z("fp-ui");n.appendChild(i),r.reaper.set("ui",i),~e.className.indexOf("use-play-")||e.classList.add("use-play-1"),function(t,e,r){const n=Z("fp-footer");e.append(n),r.on(g,(function(t){var e,r;const i=null===(e=t.data)||void 0===e?void 0:e.description,a=null===(r=t.data)||void 0===r?void 0:r.title;if(n.innerHTML="","string"==typeof a){const t=Z("fp-title");t.innerText=a,n.append(t)}if("string"==typeof i){const t=i.split(" "),e=Z("fp-desc");for(e.innerText=t.join(" "),n.append(e);t.length>1&&e.scrollHeight>e.offsetHeight;)t.pop(),e.innerText=t.join(" ")+"..."}}))}(0,e,r),Ee(t,i,r),_e(0,i,r);const a=Ge(t,0,r);i.append(a),a.append(We(0,r)),Je(0,0,r),e.appendChild(n),[o,u].forEach(t=>{e.addEventListener(t,(function(t){r.setState("is-hovered",t.type==o),r.setState("is-accessibility",!1)}))}),r.on(g,(function(t){var r;const n=null===(r=t.data)||void 0===r?void 0:r.ui;if("number"!=typeof n)return;const i=e.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 $e(t,e,r){if(At.from_token(t.token||"").is_granted(At.permissions.NO_METERING))return;const n=Tt.id(t.token||"");n&&r.once(h,()=>function(t,e){fetch("https://pmi.flowplayer.com/in",{method:"POST",body:JSON.stringify({token_id:e,factor:1,rnd:Math.random().toString(36).substring(2)})}).then(e=>{401==e.status&&t.emit("error:fatal",{reason:"token",details:"The token online validation failed"})})}(r,n))}var tr={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 er{init(t,e,r){r.reaper&&r.reaper.set("translations",nt(er,t,"en"))}}er.en=tr;const rr=Date.now(),nr={session_id:Math.random().toString(36).substring(2)+performance.now().toString(36)};class ir{constructor(){this._summary={},this._session_id=nr,this.start_time=rr}increment(t,e){if("string"!=typeof t||"number"!=typeof e)return;const r=this._summary[t]||0;this._summary[t]=r+e}set(t,e){"string"==typeof t&&(this._summary[t]=e)}duration(){return Date.now()-this.start_time}summary(t){return Object.assign("object"==typeof t?t:{},{event:"health_summary"},this._summary,this._session_id,{duration:this.duration()})}sessionize(t){return Object.assign(t,this._session_id)}}function ar(t,e){return function(t,e){return"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(t,e)}(t,JSON.stringify({events:e}))}class sr{constructor(t){this.middleware=t,this._pending=[]}pending(){return this._pending}_run_middleware(t,e){return t=Object.assign({},t),this.middleware.forEach((function(r){const n=r(e);if("object"==typeof n)return Object.assign(t,n);console.warn("KPI::middleware did not return an Object\nreturn: %o\n\nfn: %s",n,r)})),t}push(t,e){t=this._run_middleware(t,e),this.push_finalized(t)}push_finalized(t){this._pending.push(t),this.send()}send(t){if(this._pending.length<20&&!t)return;const e=this._pending.slice(0);this._pending.length=0,ar("https://health.flowplayer.com/v1/health/events",e)}}function or(){return $(window,"navigator.connection.downlink")}function ur(t){const e=t.hls;if(!e)return;const r=e.abrController._bwEstimator;return r?.001*r.getEstimate():void 0}function lr(t){const e=[ur,or];for(;e.length;){const r=e.shift(),n="function"==typeof r&&r(t);if("number"==typeof n)return{downlink_mbs:Number(n.toFixed(2))}}return{}}const cr=document.createElement("a");function dr(t){const e=t.original_src;return"string"!=typeof e?{}:(cr.href=e,"string"==typeof cr.pathname?{media_type:cr.pathname.split(".").pop()}:{})}function fr(t){return{preload:t.opt("preload"),autoplay:t.opt("autoplay",t.autoplay)}}function hr(t){return{player_id:t.opt("metadata.player_id"),media_id:t.opt("metadata.media_id"),site_id:t.opt("metadata.site_id"),category_id:t.opt("metadata.category_id"),sitegroup_id:t.opt("metadata.sitegroup_id"),token:t.token}}function pr(){return{timestamp:Date.now()}}function vr(){return{ua:navigator.userAgent,version:"3.0.0-beta",commit:"494a2e0586e1a0959f8c5a3399c5464b990bc858"}}const gr=[n,"rebuffer"],mr=gr.concat([s,"loadstart",d,f,"error:fatal",h,p,"quality:set","pause","ended","seeking"]);function yr(t,e,r){t.push_finalized(Object.assign(e.summary({}),fr(r),hr(r),pr(),vr())),t.send(!0)}function Er(t){try{return!!new URL(t)}catch(t){return!1}}ct(window,"flowplayer:umd",(function(t){const e=t.data;e&&window.addEventListener("unload",(function(){e.instances.forEach(t=>t.emit("unload"))}))}));class Tr{init(t,e,r){if(r._health)return;const n=r._health=new ir,i=r._kpis=new sr([dr,fr,hr,lr,pr,vr]);gr.forEach(t=>{n.set(t,0)}),function(t){t.on("waiting",(function(e){t.seeking||t.networkState===t.NETWORK_LOADING&&t.readyState!==t.HAVE_NOTHING&&t.emit("rebuffer")}))}(r),r.on(v,(function(){i.send(),r._kpis=r._health=void 0})),r.on("health:summary:increment",(function(t){t.data&&Object.keys(t.data).forEach((function(e){t.data&&n.increment(e,t.data[e])}))})),r.on("health:summary:set",(function(t){t.data&&Object.keys(t.data).forEach((function(e){t.data&&n.set(e,t.data[e])}))})),r.on(gr,(function(t){setTimeout(()=>{t.defaultPrevented||r.emit("health:summary:increment",{[t.type]:1})})})),r.on(mr,(function(t){setTimeout(()=>{t.defaultPrevented||r.emit("health:kpi:track",{event:t.type})},0)})),r.on("health:kpi:track",(function(t){if(!t.data)return;const e=n.sessionize(t.data);i.push(e,r)})),r.on("src",(function(t){const e=t.data&&t.data.src;"string"==typeof e&&Er(r.original_src)&&Er(e)&&e!=r.original_src&&yr(i,n,r)})),r.on("unload",(function(){yr(i,n,r)}))}}vt(window,Tr);It.extensions.unshift.apply(It.extensions,[er,ue,Tr,class{init(t,e,r){$e(t,0,r),le(0,e,r),Ze(t,e,r)}}]);var _r=Object.assign(It,{ui:Te,i18n:er}),br=Pt(Mt((function(t,e){var r;"undefined"!=typeof window&&(r=function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/dist/",r(r.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":
15
+ ***************************************************************************** */function pe(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 ve(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 ge(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const me=e=>{var{src:t}=e,r=pe(e,["src"]);return[Object.assign({src:t,type:t?ge("video/"+ve(t)):""},r)]};function ye(e){return me({src:e})}function Ee(e){var{src:t,type:r}=e,n=pe(e,["src","type"]);return t&&r?[Object.assign({src:t,type:r},n)]:r&&!t?[Object.assign({type:r},n)]:me(Object.assign({src:t},n))}var _e;function Te(e,t,r,n={safari:!1}){const i=function(e){return"string"==typeof e?ye(e):Array.isArray(e)||"object"!=typeof e?e.reduce((function(e,t){return"string"==typeof t&&(t=ye(t)),"object"!=typeof t||Array.isArray(t)||(t=Ee(t)),e.concat(t)}),[]):Ee(e)}(r);return e.currentSrc&&(e.innerHTML=""),Array(...Array(i.length)).map((e,t)=>t).some(r=>{const a=i[r];if(_e.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),_e.Ok):_e.Err}(e,t,a)||_e.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 _e.Err;if(r.drm&&(!r.drm["com.apple.fps.1_0"]||!n.safari))return _e.Err;"string"==typeof r.src&&(e.src=r.src);return _e.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)}(e,t),e}!function(e){e[e.Err=0]="Err",e[e.Ok=1]="Ok"}(_e||(_e={}));const be=[S,A,"src","seek:cancel"];var Ae;function Se(e,t,r){return isNaN(e.duration)||isNaN(e.currentTime)?{}:(t.offset+=r,0==t.offset?Le(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,Le(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 Le(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 we(e,t){const r=e._customElements.get(t);return r&&e.root.querySelector(r)||void 0}function ke(){if("undefined"==typeof document)return!1;const e=document.documentElement;return e&&"rtl"==e.getAttribute("dir")}function Re(...e){const t=document.createElement("div");return 0==e.length||t.classList.add(...e),t}function De(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 Oe(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+":"+Oe(n)+":"+Oe(e)):t+Oe(n)+":"+Oe(e)}!function(e){e.FORWARD="forward",e.BACKWARD="backward"}(Ae||(Ae={}));const Ie=navigator.languages||[navigator.language];function xe(e,t,r){const n={};return r=t.lang||r,e[r]&&(n[r]=e[r]),function(){try{return Ie.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 Pe=[1e7]+""+-1e3+-4e3+-8e3+-1e11,Me=()=>"undefined"==typeof crypto?"":Pe.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));let Fe="";!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 Ne=["touchstart","touchmove"];function Ue(e,t){const r=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(r,"data",{get:()=>t}),r}function Be(e,t,r){const n=Ue(t,r);return e.dispatchEvent(n),e}function je(e,t,r){const n=Ue(t,r);return e.dispatchEvent(n),n}function Ge(e,t,r,n){Array.isArray(t)?t.forEach(t=>He(e,t,r,n)):He(e,t,r,n)}function He(e,t,r,n){if(i=t,!~Ne.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 Ke(e,t,r,n){return Ge(e,t,r,Object.assign(n||{},{once:!0}))}const Ve={preload:"none",rtl:!1,controls:!0},We=["loop","muted","preload"];function qe(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[J]&&(r[q]=!1),i.playerState=r,Be(i,"state",i.playerState),i},i.createComponents=function(...e){return Array.from({length:e.length}).map((t,r)=>le(this,e[r]))},i.hasState=function(e){return!!i.playerState[e]},i.transitionState=function(e,t,r){!i.hasState(e)&&i.hasState(t)||(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.emit=(e,t)=>(Be(i,e,t),i),i.on=(e,t)=>(Ge(i,e,t),i),i.once=(e,t)=>(Ke(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)=>je(i,e,t),i.togglePlay=function(t){return de(i,e,t)},i.toggleMute=function(e){e=null==e?!i.muted:!!e,i.muted=e,i.muted||i.volume||(i.volume=1),Be(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(),Be(i,S)}),0)},i.setAttrs=function(e){return We.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?De(Ve,t):r,De(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:De(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 ke();const t=e.getAttribute("dir");return t?"rtl"==t:ke()}(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+"')":"",Be(i,L,e)},i.renderPlugin=function(e){je(i,"renderplugin",e).defaultPrevented||i.root.appendChild(e)};const a={offset:0,timer:0};var s,o;o=a,(s=i).on(be,(function(){Le(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(Fe)return Fe;try{const e=localStorage.getItem("flowplayer/uuid");if(e)return e;const t=Me();return localStorage.setItem("flowplayer/uuid",t),t}catch(e){return Fe=Me()}}()}}function ze(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 Ye(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 Xe(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}}const Qe=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function Ze(e,t){return!!~Qe.indexOf(e)||e.indexOf(t)===e.length-t.length}Ze.check_whitelist=function(e){return!!~Qe.indexOf(e)};const Je="production";function $e(e,t){const r={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let n={c:"{}",exp:0};t=t||{};try{n=se(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&&$e.validate(r),r}function et(e){try{return $e.validate(e),{success:!0,message:""}}catch(e){return{success:!1,message:e.message}}}var tt;function rt(e){return{grant:e,is_granted:t=>(e&t)===t}}function nt(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 it(e,t){const r=t.clientWidth;t.classList.toggle("is-small",r<600),t.classList.toggle("is-tiny",r<400)}function at(e,t,n){let i=!0;t.classList.add("flowplayer"),it(0,t),Ge(n,[g,c],(function(){it(0,t)})),Ge(n,"state",(function(){Object.entries(n.playerState).forEach((function([e,r]){t.classList.toggle(e,r)}))})),Ge(n,"timeupdate",(function(){n.setState(J,!1)})),Ge(n,L,(function(){const r=n.paused&&(!e.autoplay||t.classList.contains("no-autoplay"))&&0==n.currentTime;[Y,X].forEach((function(e){n.setState(e,r)}))})),Ge(n,T,(function(t){setTimeout((function(){t.defaultPrevented||(e.rewind&&!n.loop&&(e.autoplay&&(e.autoplay=0,n.setState("is-autoplay",!1)),n.setState(Q,!0),Ke(n,b,(function(){n.setState(Q,!1),n.pause(),n.setState(X,!0)})),n.currentTime=0),Ke(n,"timeupdate",(function(){n.setState(Z,!1)})),n.transitionState(Z,q,e.loop||e.rewind?0:300))}),0)})),Ge(n,[A,b],(function(e){n.setState(Q,e.type==A),n.setState(z,n.paused),n.setState(q,!n.paused)})),Ge(n,T,(function(){n.setState(q,!1),i=!0})),Ge(n,r().ios?h:p,(function(e){const t="src"!=e.type||"none"!==n.opt("preload");n.setState("is-loaded",t),n.setState(Y,!t)})),Ge(n,[E,_,g],(function(t){if(!n.hasState(Q)&&(t.type!=_||e.autoplay||n.setState(J,!1),t.type!=g||"none"!=n.opt("preload")||e.autoplay)){if(t.type==g&&e.autoplay)return Ke(n,y,(function(){n.setState(J,!1)}));t.type==E&&[q,z,X].forEach((function(e){n.setState(e,!1)})),n.setState(Z,!1),n.setState(J,t.type==E)}})),Ge(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(J);if(r&&(n.started=!0,i=!1),n.setState(J,!1).setState(X,!1),a||n.hasState(Q))return;const o=r?q:z,l=r?z:q;n.transitionState(o,l,s?0:300),r&&n.setState("no-autoplay",!1)}))}function st(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,Be(e,t?"viewenter":"viewleave")),e}function ot(e,r,n){st(n);const a={should_resume:!!e.autoplay,has_user_gesture:!1,locked:!1};[u,i].forEach(e=>Ke(n,e,()=>a.has_user_gesture=!0)),Ge(n,"play",(function(){a.locked||(a.should_resume=!0)})),Ge(n,m,(function(){a.locked||(a.should_resume=!1)})),Ge(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&&(Ge(n,"viewenter",(function(){a.should_resume&&n.togglePlay(!0)})),Ge(n,"viewleave",(function(){const e=!n.paused;a.locked=!0,n.pause(),setTimeout((function(){a.should_resume=e,a.locked=!1}),0)})))}$e.validate=function(e){if("string"==typeof e&&(e=$e(e)),!e||!e.raw){if(Ze.check_whitelist(window.location.hostname)||"dev"===Je.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=Ze.bind(null,t);if("dev"!==Je.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(r))throw new Error("Domain not allowed");if("dev"!==Je.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},$e.id=function(e){if(e)return"string"==typeof e&&(e=$e(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"}(tt||(tt={})),rt.of=rt,rt.from_token=function(e){const t=$e(e,{require_valid_token:!0});return rt.of(t.data.acl)},rt.permissions=tt,[s,c].forEach(e=>{window.addEventListener(e,(function(){t.forEach((function(e){const t=e.root;t.prevWidth!=t.clientWidth&&(Be(e,c),t.prevWidth=t.clientWidth)}))}))}),window.addEventListener("scroll",(function(){t.forEach(st)}));function lt(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 ut(e,t,r){const n=document.createElement("div");n.classList.add("fp-ratio"),t.append(n);let i=lt(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=lt((null==e?void 0:e.ratio)||t||.5625);i!==a&&(i=a,n.style.paddingTop=100*a+"%")}))}class ExplorerPlan{constructor(){this.cleanUp=this.cleanUp.bind(this),this.render=this.render.bind(this),this.wireUp=this.wireUp.bind(this)}init(e,t,r){this.root=t,this.player=r,this.wireUp()}wireUp(){var e,t;this.cleanUp(),null===(e=this.player)||void 0===e||e.once(y,this.render),null===(t=this.player)||void 0===t||t.once(T,this.wireUp)}cleanUp(){var e,t,r,n;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo),null===(r=this.player)||void 0===r||r.off(y,this.render),null===(n=this.player)||void 0===n||n.off(T,this.wireUp)}render(){var e,t,r;null===(t=null===(e=this._logo)||void 0===e?void 0:e.parentElement)||void 0===t||t.removeChild(this._logo);const n=(null===(r=this.root)||void 0===r?void 0:r.querySelector(".fp-ui"))||this.root;if(!n)return;const i=this._logo=document.createElement("a");i.href="https://explorer.flowplayer.com",i.target="_blank",Object.entries(ct).forEach(([e,t])=>{i.style.setProperty(e,t,"important")}),n.appendChild(i)}}const ct={display:"block",opacity:"1",visibility:"visible",width:"33%","padding-top":"9%",position:"absolute","z-index":"9999",bottom:"25%",left:"10%","background-size":"cover","background-image":"url(https://static.flowplayer.com/explorer/explorer.svg)"},dt="flowplayer/"+y;function ft(e){const t=t=>{t.detail!==e&&!e.opt("multiplay")&&e.pause()};e.on(S,()=>document.removeEventListener(dt,t)),document.addEventListener(dt,t)}const ht=function(){const e=Xe(),t=e.flowplayer?e.flowplayer:{extensions:[]};return Array.isArray(t.extensions)||(t.extensions=[]),t}();function pt(r,n){if("function"==typeof r)return e.push(...[...arguments].filter(e=>"function"==typeof e)),pt;"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=et(n.token);if(!s.success)return nt(i,null,{reason:"token",details:s.message});const o=new Map,l=ze(n,i);l.reaper=o,l._customElements=oe,Object.defineProperty(l,"token",{value:"string"==typeof n.token?$e.id(n.token):"",writable:!1}),l.addEventListener(S,()=>{o.clear(),l.reaper=0,delete l.root}),l.root=i,n.token&&rt.from_token(n.token).is_granted(rt.permissions.DEVELOPER_PLAN)&&e.push(ExplorerPlan),!~t.indexOf(l)&&t.push(l),qe(n,i,l),l.setAttrs(n),l.plugins=pt.extensions.map(e=>new e(pt,l)),at(n,i,l),ot(n,0,l),ut(n,i,l),ft(l),l.plugins.forEach(e=>{try{e.init(n,i,l)}catch(t){console.log("Error(plugin/%s)",e.constructor.name,t)}}),l.setOpts(n),l.opts=n,n.src&&l.setSrc(n.src);const u=l.readyState;return u>0&&l.currentSrc&&l.emit(h),u>2&&l.currentSrc&&l.emit(_),l.emit("mount"),l.on("error:fatal",(function(e){nt(i,l,e.data||{})})),l}Object.assign(pt,ht),function(n){Array.isArray(n.extensions)&&n.extensions.forEach(t=>e.push(t)),n.customElements=oe,n.defaultElements=W,n.version="3.0.2",n.commit="8cb54448b417ccbf511048e11696c74848197191",n.instances=t,n.extensions=e,n.support=r,n.events=R,n.states=ee,n.jwt=se,n.autoplay=ae,n.quality=ce}(pt),"object"==typeof document&&setTimeout(Be,0,document,"flowplayer:umd",pt);var vt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function gt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function mt(e){var t={exports:{}};return e(t,t.exports),t.exports}var yt=mt((function(e,t){var r=vt&&vt.__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}})),Et=mt((function(e,t){var r=vt&&vt.__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=vt&&vt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=vt&&vt.__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(yt),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})),_t=mt((function(e,t){var r=vt&&vt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var n=r(Et);t.default=n.default.of()})),Tt=mt((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 "))}))}})),bt=mt((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})),At=mt((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"})),St=mt((function(e,t){var r=vt&&vt.__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=vt&&vt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=vt&&vt.__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=vt&&vt.__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=vt&&vt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var o=s(_t),l=s(Et),u=i(Tt),c=i(yt),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=bt.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=u.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));l.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=At.Verb,e}();t.default=d})),Lt=mt((function(e,t){var r=vt&&vt.__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=vt&&vt.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=vt&&vt.__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=vt&&vt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0,t.API=t.Tracker=void 0;var s=a(St);t.Tracker=s.default;var o=i(Tt);t.API=o})),wt="ping",kt="display",Rt="view";const Dt=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],Ot=["created","position"],Ct=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];function It(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 xt(e,t,r){if(!t.segment_duration&&!It(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(wt,{position:n})}function Pt(e,t){return Math.min(Math.floor(e.currentTime/t.segment_duration),99)}const Mt="vod",Ft="live",Nt=[kt,wt,Rt];function Ut(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(wt,{position:60*t.ticks}))}(e,t);case"vod":return xt(e,t,"boolean"==typeof r&&r)}}function Bt(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 jt(){try{return window.location!==window.parent.location?document.referrer:document.location.href}catch(e){return!1}}class Analytics{init(e,t,r){if(!rt.from_token(e.token||"").is_granted(rt.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:()=>{Ut(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=Lt.Tracker.of(r,{verb:Lt.Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:Nt,required_keys:Dt,optional_keys:Ct.concat(Ot).slice(0),metadata:a});r.on(S,(function(){s&&s.destroy()})),r.on(L,(function(t){if(!s)return;const i=De(t,"data.metadata",{});if(!i.media_id)return;const a=De(s,"metadata.media_id");if(a&&i.media_id==a)return;const o=De(e,"analytics",{});s.put(i),s.put(o);const l=De(e,"metadata.live_start_time",e.live)?Ft:Mt;s.put({video_type:l,source:e.source||jt()||""}),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(kt)}));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=Bt(r);if(e)return o=Promise.resolve(e).then((function(){n.last_media_id=s.metadata.media_id,r.emit(Rt),o=0})).catch((function(){o=0}));n.last_media_id=s.metadata.media_id,r.emit(Rt)})),r.on("timeupdate",(function(){var t;s&&(o||Bt(r)||n.ended||(!e.live&&r.currentTime+.25>=r.duration&&Ut(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){It(e,t),t.last_idx=Pt(e,t)}(r,n.ticker)})),r.on(T,(function(){s&&function(e,t){t.ended||(t.ended=!0,Ut(e,t.ticker))}(r,n)}))}}var Gt;function Ht(e){switch(e){case Gt.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case Gt.MEDIA_ERR_NETWORK:return"a network error occurred";case Gt.MEDIA_ERR_DECODE:return"unable to decode media content";case Gt.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case Gt.NO_INTERNET:return"no internet connection detected";case Gt.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}function Kt(){}function Vt(){return"https:"===location.protocol}function Wt(e){const t=document.createElement("a");return t.href=e,t}function qt(e){try{return!!new URL(e)}catch(e){return!1}}Ye(Xe(),Analytics),"undefined"!=typeof window&&window.matchMedia&&[w,k].forEach((function(e){window.matchMedia("(orientation: "+e+")").addListener((function(r){t.length&&t.forEach((function(t){r.matches&&t.emit(e)}))}))})),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"}(Gt||(Gt={}));const zt=()=>!0===(navigator||{}).onLine;function Yt(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=Kt,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 Vt()&&"http:"==Wt(e).protocol}catch(e){return!1}}(e.original_src)?{code:Gt.MIXED_CONTENT}:zt()?{code:Gt.MEDIA_ERR_NETWORK}:zt()?{code:Gt.UNKNOWN}:{code:Gt.NO_INTERNET}}(e);case Gt.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=Ht(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)}))}))}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 Qt(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}const s=()=>r.getFullsceenTarget?r.getFullsceenTarget():t;r.toggleFullScreen=function(e,t){if(r.ios_fullscreen_disabled)return;if("boolean"!=typeof e&&(e=!r.hasState("is-fullscreen")),Zt(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($)||e.setState($,!0)}(r,t)),!document.fullscreenEnabled)return;const n=s();e?n.requestFullscreen():document.exitFullscreen()},Zt(r)&&(r.ios_fullscreen_disabled=!0,r.once("beforeplay",(function(){r.ios_fullscreen_disabled=!1})),r.on("webkitendfullscreen",(function(){r.toggleFullScreen(!1,!0)}))),setTimeout(()=>{const e=s();e.addEventListener(i,(function(){const t=n(),i=t===e||t==r;r.emit(i?d:f),r.setState("is-fullscreen",i),r.emit(c)}))},0),!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 Zt(e){return r().ios&&"function"==typeof e.webkitEnterFullScreen&&"function"==typeof e.webkitExitFullScreen}function Jt(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 $t(e){return e.opt("live",!1)||e.duration>=Number.MAX_SAFE_INTEGER}function er(e){return isFinite(e.duration)?e.duration:0==e.seekable.length?0:e.seekable.end(0)}function tr(e){return function(e){return Jt(e).head}(e)-.5}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,r){if(!r.reaper)return;const n=document.createDocumentFragment(),i=le(r,D);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=Re("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=Re("fp-title");e.innerText=a,n.append(e)}if("string"==typeof i){const e=i.split(" "),t=Re("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),Yt(0,0,r),t.appendChild(n),[o,l].forEach(e=>{t.addEventListener(e,(function(e){r.setState("is-hovered",e.type==o),r.setState("is-accessibility",!1)}))}),Qt(e,t,r),r.on("volumechange",(function(){const e=0==r.volume||r.muted;r.setState("is-muted",e),nr("mute",e.toString())})),"true"==rr("mute")&&(r.muted=!0,r.setState("is-muted",r.muted));const a=rr("volume");a&&!isNaN(Number(a))&&(r.volume=Number(a)),r.emit("volumechange"),r.on("timeupdate",(function(){var t;e.live&&(!("dvr"in(t=e))||1==t.dvr)&&function(e,t){if(0==t)return!0;const r=Jt(e);return r.head-r.tail>=t}(r,e.seconds_to_dvr||0)&&r.setOpts({dvr:r.seekable.length>0})})),r.on("live",(function(){r.setState("is-live-seeked",!1)})),r.on("seeking",(function(){if(!$t(r))return;if(0==r.seekable.length||0==r.played.length)return;if(0==er(r))return;const e=tr(r),t=r.currentTime>=e?"live":"dvr";if("live"===t)return r.emit(t);const n=er(r),i=r.seekable.end(0)-r.seekable.start(0),a=(n-r.currentTime)/i*100,s=Math.round(a);r.setState("is-live-seeked",s>0),r.emit(t,{offset:s})})),r.on(h,(function(){r.setOpts({live:$t(r)})})),r.on("durationchange",(function(e){const t=$t(r),n=t?er(r):e.data||r.duration;isNaN(n)||r.setOpts({live:t,duration:n})})),r.on(L,(function(r){var n,i;e.seekable=void 0===(null===(n=null==r?void 0:r.data)||void 0===n?void 0:n.seekable)||r.data.seekable;const a=null===(i=r.data)||void 0===i?void 0:i.ui;if("number"!=typeof a)return;const s=t.classList;s.toggle("use-play-1",!(32&a||64&a)),s.toggle("use-play-2",(32&a)>0),s.toggle("use-play-3",(64&a)>0),s.toggle("use-thin-controlbar",(128&a)>0),s.toggle("no-title",(256&a)>0),s.toggle("no-description",(512&a)>0),s.toggle("logo-on-right",(8&a)>0),s.toggle("use-drag-handle",(16&a)>0),s.toggle("no-controls",(1024&a)>0),s.toggle("no-duration",(2048&a)>0),s.toggle("no-header",(4096&a)>0),s.toggle("no-mute",(4&a)>0),s.toggle("no-volume",(2&a)>0),s.toggle("no-fullscreen",(1&a)>0),s.toggle("no-touch-zones",(16384&a)>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 ar(e,t,r){if(rt.from_token(e.token||"").is_granted(rt.permissions.NO_METERING))return;const n=$e.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 sr={ads:{ad:"Ad",ads:"Ads",advertisement:"Advertisement"},audio:{button_txt:"Audio",menu_title:"Audio"},core:{exit_fullscreen:"Exit fullscreen",fullscreen:"Fullscreen",mute:"Mute",pause:"Pause",play:"Play",unmute:"Unmute",volume:"Volume"},ovp:{starting_in:"Countdown"},playlist:{cancel:"Cancel",up_next:"Up next"},qsel:{menu_title:"Quality"},share:{clipboard_failure:"Access to clipboard failed",clipboard_success:"The text is now on your clipboard",embed:"Embed",link:"Link",menu_title:"Share"},speed:{menu_title:"Speed"}};class I18n{init(e,t,r){r.reaper&&r.reaper.set("translations",xe(I18n,e,"en"))}}I18n.en=sr;const or="rebuffer";var lr=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:or});const ur=navigator;function cr(e){var t,r;const n=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return n?1e-6*n:(null===(r=ur.connection)||void 0===r?void 0:r.downlink)||-1}function dr(e,t){return function(e,t){return"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(e,t)}(e,JSON.stringify({events:t}))}const fr=Me(),hr=[];function pr(e){const t=hr.slice(0);hr.length=0,e.logger.log(`:dispatch events={${t.length}}`),dr("https://health.flowplayer.com/v1/health/events",t)}function vr(e,t,r){hr.push(t),e.logger.log(":enqueue",t.event,t),hr.length<10&&!r||pr(e)}const gr=()=>{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}},mr=(e,t)=>Object.assign(e,{detail:t}),yr=(e,{event:t,media_session_id:r})=>({event:t,media_session_id:r,device_id:e.deviceId(),session_id:fr,timestamp:Date.now(),version:"3.0.2",commit:"8cb54448b417ccbf511048e11696c74848197191",ima_sdk_version:gr(),preload:e.opt("preload"),autoplay:e.opt("autoplay",e.autoplay),source:e.original_src,downlink_mbs:cr(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}),Er=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 _r(e,t,r,n){const i=yr(t,{event:r,media_session_id:e.media_session_id}),{before:a,after:s}=n;vr(e,((e,t,r)=>Object.assign(e,{state:{before:t,after:r}}))(i,Er(a),Er(s)))}const Tr=(e,t)=>{let r=null;return(...n)=>{null!==r&&(clearTimeout(r),r=null),r=setTimeout(()=>t(...n),e)}};class Health{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=Me(),!Health._UNLOAD_SUBSCRIBED){Health._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(or)}))}(r),r.on("health:record",({detail:e})=>{const t=yr(r,{event:e.event,media_session_id:this.media_session_id});Object.assign(t,e.detail||{}),vr(this,t)}),[_,g,s,h,p,v,E,or].forEach(e=>{r.on(e,e=>{vr(this,yr(r,{event:e.type,media_session_id:this.media_session_id}))})}),[y,m,A,b,T,d,f].forEach(e=>{r.on(e,e=>{vr(this,yr(r,{event:e.type,media_session_id:this.media_session_id}))})}),r.on("volumechange",Tr(800,e=>{const t=yr(r,{event:e.type,media_session_id:this.media_session_id});vr(this,mr(t,{volume:parseFloat(r.volume.toFixed(2)),muted:r.muted}))})),r.on(c,Tr(800,e=>{const n=yr(r,{event:e.type,media_session_id:this.media_session_id});vr(this,mr(n,{height:t.clientHeight,width:t.clientWidth}))})),r.on("qualitychange",({type:e,detail:t})=>{switch(t.kind){case"hls":return _r(this,r,e,t)}}),r.addEventListener(n,e=>{const t=yr(r,{event:e.type,media_session_id:this.media_session_id}),n=e.error||r.error;if(!n)return vr(this,t,!0);const i=n.code,a={error_message:n.message||Ht(i),error_code:i,error_stack:n.stack||""};return vr(this,mr(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(!qt(r.original_src))return;if(!qt(n))return;if(n==r.original_src)return;this.media_session_id=Me();vr(this,yr(r,{event:e.type,media_session_id:this.media_session_id})),pr(this)}),r.on("unload",e=>{vr(this,yr(r,{event:e.type,media_session_id:this.media_session_id})),pr(this)})}}var br;function Ar(e,t){if(function(e){return Object.values(br).includes(e)}(t=t||br.Anonymous))return"crossOrigin"in e?e.crossOrigin=t:e.setAttribute("crossorigin",t),e}function Sr(e){const t=document.createElement("a");return t.href=e,t.origin}function Lr(e,t){const r=document.createElement("track");r.className="fp-track renderable",r.kind=t.kind||"captions",r.id=["fp",t.lang].join("-");const n=r.track;return"string"!=typeof t.crossorigin&&function(e,t){try{return e.src.startsWith("blob:"),Sr(e.src)!==Sr(t)}catch(e){return console.error(e),!0}}(e,t.src)&&(Ar(e),t.crossorigin=e.getAttribute("crossorigin")),"crossorigin"in t&&Ar(e,t.crossorigin),Object.keys(t).forEach(e=>{r[e]=t[e]}),n.mode=t.default?"showing":t.mode||"disabled",r.onload=function(){},n.oncuechange=function(t){e.emit(t.type,{track:t.target})},e.appendChild(r),r}Health.events=lr,Health._UNLOAD_SUBSCRIBED=!1,Ye(window,Health),function(e){e.Anonymous="anonymous",e.UseCredentials="use-credentials",e.Empty=""}(br||(br={}));var wr=Object.freeze({__proto__:null,CHAPTER_CHANGED:"chapter:changed",CHAPTERS_NEW:"chapters:new"});class Chapters{constructor(){this._track_added_handler=Kt,this._cue_changed_handler=Kt,this.chapters=[],this.render=this.render.bind(this)}init(e,t,r){this._root=t,this._player=r,this._timeline=we(r,x),this._track_added_handler=this.track_added.bind(this,r),this._cue_changed_handler=this.cue_changed.bind(this,r),r.textTracks.addEventListener("addtrack",this._track_added_handler),this.wireup(r,e),r.chapters=this,r.on(L,e=>{e.data&&this.wireup(r,e.data)}),r.on(S,()=>{this.wiredown(r),r.textTracks.removeEventListener("addtrack",this._track_added_handler),r.off("durationchange",this.render)}),r.on("durationchange",this.render)}track_added(e,t){}cue_changed(e,t){var r;this._current_chapters_track&&(this.current_cue=this._current_chapters_track.track.activeCues?this._current_chapters_track.track.activeCues[0]:void 0,this._timeline&&Be(this._timeline,"chapter:changed",null===(r=this.current_cue)||void 0===r?void 0:r.text))}set_chapters(e){this.chapters=e,this.render()}jump(e){this._player&&this.chapters[e]&&(this._player.currentTime=this.chapters[e].start)}current(){if(this.current_cue)return this.chapters.find(e=>e.cue==this.current_cue)}render(){if(!this._root||!this._player||!this._timeline)return;const e=this._player.duration;isFinite(e)&&(Be(this._timeline,"chapters:new",this.chapters.map(t=>({title:t.label,left:t.start/e*100+"%",width:(t.end-t.start)/e*100+"%"}))),this._root.classList.toggle("has-chapters",!!this.chapters.length))}wireup(e,t){const r=Array.isArray(t.chapters)?t.chapters[0]:t.chapters;r&&r.src!==this._current_chapters_src&&(this.wiredown(e),this._current_chapters_track=Lr(e,Object.assign(Object.assign({},r),{kind:"chapters",mode:"hidden"})),this._current_chapters_track.onload=()=>{var e;(null===(e=this._current_chapters_track)||void 0===e?void 0:e.track.cues)&&this.set_chapters(Array.from(this._current_chapters_track.track.cues).filter(e=>e instanceof VTTCue).map(e=>{const t=e;return{start:e.startTime,end:e.endTime,cue:t,label:t.text}}))},this._current_chapters_src=r.src,this._current_chapters_track.addEventListener("cuechange",this._cue_changed_handler))}wiredown(e){this.set_chapters([]),this._current_chapters_track&&(this._current_chapters_track.removeEventListener("cuechange",this._cue_changed_handler),e.removeChild(this._current_chapters_track))}}Chapters.events=wr,Ye(window,Chapters);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class FlowplayerPrimary extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-primary");const t={logo:""};e.on(L,e=>{var r,n;const i=t.logo,a=(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.logo)||"";i!=a&&(t.logo=a,this.set_logo(a,null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.logo_href))})}set_logo(e,t){if(this.innerHTML="",!e)return;const r=document.createElement("img");if(r.classList.add("fp-logo"),r.src=e,!t)return this.append(r);const n=document.createElement("a");n.href=t,n.append(r),this.append(n)}}class FlowplayerHeaderDuration extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-duration"),e.on(L,e=>{var t;const r=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.duration)||NaN;this.innerText=isFinite(r)?Ce(r):""})}}const kr={name:"fp-fullscreen",translation_key:"core.fullscreen"},Rr={name:"fp-fullscreen-exit",translation_key:"core.exit_fullscreen"},Dr={name:"fp-play",translation_key:"core.play"},Or={name:"fp-pause",translation_key:"core.pause"},Cr={translation_key:"core.mute",name:"fp-volume-mute-unmute"},Ir={translation_key:"core.play",name:"fp-small-play"},xr={translation_key:"core.pause",name:"fp-small-pause"},Pr={name:"fp-fast-forward"},Mr={name:"fp-rewind"};class FlowplayerIcon extends FlowplayerComponent{constructor(e,t){super(e),this.classList.add("fp-icon",t.name),t.title&&this.setAttribute("title",t.title),t.title&&this.setAttribute("aria-label",t.title),this.setAttribute("tabindex","0"),this.setAttribute("focusable","true")}}document.addEventListener(i,(function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(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 Fr={passive:!0};var Nr;function Ur(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(Nr.GRABBING),s.remove(Nr.TOUCHING);const o=t.onseek||Kt,l=t.onstart||Kt,c=t.onend||Kt,d=t.onmouse||Kt,f=t.ontouch||Kt,h=t.ontouchend||Kt;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){Br(e,t)&&(s.add(Nr.TOUCHING),jr(e.parentElement)&&(t.preventDefault(),s.add(Nr.GRABBING),f(e,p(t)),l(e,p(t)),v(t)))}),Fr),e.addEventListener("touchmove",(function(t){t.preventDefault(),v(t),d(e,p(t))}),Fr),e.addEventListener(u,(function(t){setTimeout((function(){s.remove(Nr.TOUCHING)}),500),Br(e,t)&&(t.preventDefault(),s.remove(Nr.GRABBING),h(e,p(t)),c(e,p(t)),n=0)}),Fr),e.addEventListener("touchcancel",(function(){s.remove(Nr.GRABBING,Nr.TOUCHING),n=0}),Fr),e.addEventListener("mousedown",(function(t){s.contains(Nr.TOUCHING)||(document.addEventListener("mousemove",v),s.add(Nr.GRABBING),l(e,p(t)),t.preventDefault(),v(t))})),e.addEventListener("mousemove",(function(t){s.contains(Nr.TOUCHING)||d(e,p(t))})),document.addEventListener("mouseup",(function(t){s.contains(Nr.TOUCHING)||(document.removeEventListener("mousemove",v),s.contains(Nr.GRABBING)&&(s.remove(Nr.GRABBING),c(e,p(t)),n=0))})),e}function Br(e,t){const r=t.target;return!!r&&(r&&!r.closest(e.id)||!jr(e.parentElement)||!e.classList.contains(Nr.TOUCHING))}function jr(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"}(Nr||(Nr={}));class FlowplayerVolumeBar extends FlowplayerComponent{constructor(e){super(e),this.className="fp-volume";const t=e.root.classList,r=t.contains("is-tiny")?6:t.contains("is-small")?8:10,n=Array.from({length:r}).map(()=>{const e=document.createElement("i");return e.className="fp-tick",e});this.append(...n),Ur(this,{onseek:(t,r)=>{r>0&&(e.muted=!1,function(e){try{localStorage.removeItem(e)}catch(e){}}("mute")),nr("volume",(e.volume=r/100).toString()),this.adjustVolumeSlider(e.volume)}}),this.setAttribute("tabindex","0"),this.setAttribute("role","slider"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax","1"),this.setAttribute("aria-label",e.i18n("core.volume","volume")),e.on("volumechange",()=>{(0==e.volume||e.muted)&&this.adjustVolumeSlider(0),this.classList.contains(Nr.GRABBING)||this.adjustVolumeSlider(e.volume)})}adjustVolumeSlider(e){this.setAttribute("aria-valuenow",e.toString());const t=Array.from(this.querySelectorAll(".fp-tick")),r=Math.round(e*t.length);t.forEach((e,t)=>{e.classList.toggle("fp-color",t<r)})}}function Gr(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 Hr(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 Kr(e,t){e.style.width="0",t.style.width="0",t.style.display="none"}function Vr(e,t,r){if(t.seeking||!t.seekable||0==t.seekable.length)return;const n=Wr(t,e/100);Gr(r,e);const i=isFinite(t.duration)?n:t.seekable.start(0)+n;r.innerText=Ce(i)}function Wr(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 er(e)*t;const r=e.seekable.start(0);return r+t*(e.seekable.end(0)-r)}function qr(e,t){e.style.width="0",t.style.display="none"}class FlowplayerTimelineBar extends FlowplayerComponent{constructor(e){let t;super(e),this.bufferEle=Re("fp-buffer"),this.progress=Re("fp-progress","fp-color"),this.tooltipEle=Re("fp-timestamp"),this.proposedSeekBar=Re("fp-hover"),this.dragger=Re("fp-dragger","fp-color"),this.classList.add("fp-timeline","fp-bar"),this.tooltipEle.style.display="none",this.setAttribute("role","slider"),this.setAttribute("tabindex","0"),this.setAttribute("aria-label",e.i18n("timeline","Timeline")),this.progress.append(this.dragger),this.append(this.bufferEle,this.progress,this.proposedSeekBar,this.tooltipEle);let r=!1;const n=requestAnimationFrame;let i=void 0;const a=()=>{var r;0==e.reaper||t.live||(r=e,this.progress.style.width=r.currentTime/r.duration*100+"%",i=void 0,e.paused||this.classList.contains(Nr.GRABBING)||i||(i=setTimeout(a,200)))},s=()=>!!this.player.opt("opts.seekable",!0)&&!isNaN(this.player.duration);Ur(this,{onseek:(r,n)=>{if(s())switch(!!t.live){case!0:Vr(n,e,this.tooltipEle);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,e,this.progress),Gr(this.tooltipEle,n)}},onstart:()=>{s()&&(e.emit("timeline/gesture/start"),e.setState(Q,!0),t.live||function(e){e.style.display="block"}(this.tooltipEle))},onend:function(r,i){n(a),0!=t.seekable&&(e.setState(Q,!1),t.live&&function(e,t){e/=100,t.currentTime=Wr(t,e)}(i,e))},ontouch:function(){e.paused||(r=!0,e.pause())},ontouchend:()=>{r&&(r=!1,e.play()),t.live?qr(this.proposedSeekBar,this.tooltipEle):Kr(this.proposedSeekBar,this.tooltipEle)},onmouse:(r,n)=>{if(s()&&!this.classList.contains(Nr.GRABBING))switch(e.emit("timeline/gesture/move",{percent:n}),!!t.live){case!0:!function(e,t){t.style.width=function(e){return 100-e}(e)+"%"}(n,this.proposedSeekBar),Vr(n,e,this.tooltipEle);break;case!1:!function(e,t){t.style.width=e+"%"}(n,this.proposedSeekBar),function(e,t,r){if(isNaN(e)||isNaN(t.duration))return;Gr(r,e),r.innerHTML="";const n=document.createElement("span");n.innerText=Ce(e/100*t.duration),r.append(n)}(n,e,this.tooltipEle)}}}),e.on(L,(function(e){e.data&&(t=e.data)})),e.on(y,()=>n(a)),e.on("live",()=>{this.progress.style.width="0%"}),e.on(v,()=>{0==e.reaper||t.live||Hr(e,this.bufferEle)}),e.on("dvr",e=>{e.detail&&(this.progress.style.width=e.detail.offset+"%")}),e.on("timeupdate",()=>{0!=e.reaper&&(n(a),this.setAttribute("aria-valuenow",e.currentTime+""),t.live||Hr(e,this.bufferEle))}),e.on(h,()=>{0!=e.reaper&&(t.live||Hr(e,this.bufferEle))}),e.on("durationchange",t=>{if(0==e.reaper)return;const r=$t(e)?er(e):t.data||e.duration;isNaN(r)||(this.setAttribute("aria-valuemax",r+""),this.setAttribute("aria-valuemin","0"))}),this.addEventListener(l,()=>{e.emit("timeline/gesture/end"),t.live?qr(this.proposedSeekBar,this.tooltipEle):Kr(this.proposedSeekBar,this.tooltipEle)})}}class FlowplayerChaptersTimelineBar extends FlowplayerTimelineBar{constructor(e){super(e),this.handleChapters(e)}handleChapters(e){const t=document.createElement("div");let r;this.addEventListener("chapters:new",e=>{t.innerText="",this.querySelectorAll(".fp-chapter").forEach(e=>this.removeChild(e)),e.data&&e.data.forEach(e=>{const n=document.createElement("div");n.className="fp-chapter",n.style.left=e.left,n.style.bottom=n.style.top="0",n.style.width=e.width,n.title=e.title,n.onmouseover=()=>{t.innerText=e.title},n.onmouseleave=()=>{t.innerText=r||""},this.appendChild(n)})}),this.addEventListener("chapter:changed",n=>{var i;const a=n.data;a&&(t.parentNode||(null===(i=we(e,O))||void 0===i||i.insertAdjacentElement("beforebegin",t),t.classList.toggle("fp-togglable",!0),t.classList.toggle("fp-chapter-info",!0)),r=a,t.innerText=a)})}}class FlowplayerLiveStatus extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-live-status");const t=Re("fp-live-text"),r=Re("fp-live-indicator","fp-color");t.innerHTML="live",this.append(r,t),this.addEventListener(i,(function(){!function(e){try{if(!e.hasState("is-live-seeked"))return;e.emit("live"),e.dvr_offset=0,e.currentTime=tr(e)}catch(e){console.warn("failed to seek to now: %j",e)}}(e)}))}}class FlowplayerDuration extends FlowplayerComponent{constructor(e){let t;super(e),this.classList.add("fp-duration"),e.on(L,r=>{if(0==e.reaper||!r.data)return;t=r.data;const n=$t(e)?NaN:r.data.duration||0;if(isNaN(n)||n>=Number.MAX_SAFE_INTEGER)return this.style.display="none";this.style.display="inline-block",this.innerText=Ce(n)}),e.on(h,()=>{var r,n;0==e.reaper||t.live||(n=this,(r=e).duration&&(n.innerText=Ce(r.duration)))})}}class FlowplayerElapsedTime extends FlowplayerComponent{constructor(e){let t;super(e),this.classList.add("fp-elapsed"),this.innerText=Ce(0),e.on(L,e=>{e.data&&(t=e.data)}),e.on("timeupdate",()=>{var r;0!=e.reaper&&(t.live?(r=e,this.innerText=Ce(r.currentTime)):function(e,t){t.innerText=Ce(e.currentTime)}(e,this))})}}class FlowplayerControlButtons extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-btns","fp-small-switch");const t=le(e,"flowplayer-small-pause-icon"),r=le(e,"flowplayer-small-play-icon");t.addEventListener("click",(function(){e.togglePlay(),setTimeout((function(){r.focus&&r.focus()}),100)})),r.addEventListener("click",(function(){e.togglePlay(),setTimeout((function(){t.focus&&t.focus()}),100)})),this.append(t,r)}}class FlowplayerLeftRightZone extends FlowplayerComponent{constructor(e,t){super(e),this.classList.add(t);const r=this.classList.contains("fp-left-zone")?-1:1,n=document.createElement("span"),i=le(e,this.classList.contains("fp-left-zone")?H:"flowplayer-fast-forward-icon");i.removeAttribute("tabindex"),n.classList.add("fp-zone-seconds"),this.append(n,i);e.on(b,()=>{n.innerText=""}),e.on("seek:queued",e=>{const t=e.data;if(!t)return;if("number"!=typeof t.offset)return;const r=t.offset;if(0==r)return this.reset_zone();r>0&&this.classList.contains("fp-right-zone")||r<0&&!this.classList.contains("fp-right-zone")?this.render_zone_state(r):this.reset_zone()}),e.on("seek:cancel",()=>{this.reset_zone()}),this.reset_zone(),this.addEventListener(u,(function(t){isNaN(e.duration)||isNaN(e.currentTime)||16384&e.opt("ui")||e.hasState("no-timeline")||!e.hasState("will-seek")&&!e.hasState($)||e.enqueueSeek(5*r)&&(t.stopPropagation(),t.preventDefault())}))}reset_zone(){const e=this.querySelector(".fp-zone-seconds");e&&(e.innerText="")}render_zone_state(e){const t=this.querySelector(".fp-zone-seconds");t&&(t.innerText=Math.abs(e)+"")}}class FlowplayerHeaderLeftRight extends FlowplayerComponent{constructor(e,t,...r){super(e),this.className=t;const n=e.createComponents(...r);this.append(...n),"fp-left"!==t&&n.forEach(t=>{t.addEventListener(i,()=>e.toggleFullScreen())})}}class FlowplayerMiddleWait extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-wait"),Array(...Array(4)).map((e,t)=>t).forEach(()=>{this.append(document.createElement("b"))})}}class FlowplayerMiddleZone extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-middle-zone");const t=e.createComponents(B,"flowplayer-middle-buttons");this.append(...t)}}class FlowplayerMiddleButtons extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-switch"),[j,G].forEach(t=>{const r=le(e,t);r.removeAttribute("tabindex"),this.append(r)})}}class FlowplayerVolumeControl extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-volume-control");const t=le(e,K);this.append(t),!r().ios&&this.append(le(e,P)),t instanceof FlowplayerIcon&&t.addEventListener(i,(function(){e.toggleMute()}))}}class FlowplayerHeader extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-header"),this.append(...e.createComponents("flowplayer-header-left-zone","flowplayer-header-right-zone")),e.reaper&&e.reaper.set("header",this)}}class FlowplayerControls extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-controls","fp-togglable"),this.append(...e.createComponents("flowplayer-control-buttons",C,I,x,"flowplayer-control-duration","flowplayer-volume-control"))}}class FullscreenIcon extends FlowplayerIcon{constructor(e,t){super(e,t),this.setAttribute("role","button"),this.setAttribute("aria-label",e.i18n(t==kr?"core.fullscreen":"core.fullscreen_exit"))}}class FlowplayerMiddle extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-middle"),this.append(...e.createComponents("flowplayer-middle-left-zone",U,"flowplayer-middle-right-zone")),this.setAttribute("tabindex","0"),this.setAttribute("role","button"),this.setAttribute("aria-label",e.i18n("core.play")),e.reaper&&e.reaper.set("middle",this),this.handleClick(e),this.handleTouch(e),[y,b].forEach(t=>e.once(t,()=>{this.removeAttribute("tabindex"),this.removeAttribute("role"),this.removeAttribute("aria-label")}))}handleClick(e){[i,a].forEach(t=>this.addEventListener(t,(function(t){if(!t.defaultPrevented)return t.preventDefault(),e.emit(t.type),!1}))),e.on(i,(function(t){setTimeout((function(){t.defaultPrevented||e.hasState(J)||e.togglePlay()}),0)})),e.on(a,(function(t){setTimeout((function(){t.defaultPrevented||e.toggleFullScreen()}),0)}))}handleTouch(e){let t=!1;this.addEventListener(u,(function(t){0!=t.cancelable&&(t.preventDefault(),e.emit(t.type,{source:t}))})),e.on(u,(function(r){setTimeout((function(){if(r.defaultPrevented)return;if(e.hasState(J))return;if(e.ended)return e.togglePlay(!0);const n=e.hasState(X);t&&clearTimeout(t),(n||e.hasState($)||e.hasState("no-autoplay"))&&(e.hasState($)&&(e.setState($,!1),e.setState("is-hovered",!1)),e.togglePlay(),n)||(e.setState($,!0),e.paused||(t=setTimeout((function(){t=!1,e.setState($,!1),e.setState("is-hovered",!1)}),2e3)))}),0)}))}}class FlowplayerUi extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-ui"),this.append(...e.createComponents(M,N,O))}}pt.extensions.unshift.apply(pt.extensions,[I18n,Analytics,Health,class Default{constructor(e){ue(e,D,FlowplayerUi),ue(e,O,FlowplayerControls),ue(e,C,FlowplayerLiveStatus),ue(e,"flowplayer-control-duration",FlowplayerDuration),ue(e,x,e.extensions.find(e=>e.name===Chapters.name)?FlowplayerChaptersTimelineBar:FlowplayerTimelineBar),ue(e,I,FlowplayerElapsedTime),ue(e,P,FlowplayerVolumeBar),ue(e,"flowplayer-volume-control",FlowplayerVolumeControl),ue(e,"flowplayer-control-buttons",FlowplayerControlButtons),ue(e,M,FlowplayerHeader),ue(e,F,FlowplayerPrimary),ue(e,"flowplayer-header-duration",FlowplayerHeaderDuration),ue(e,"flowplayer-header-left-zone",class extends FlowplayerHeaderLeftRight{constructor(e){super(e,"fp-left",F,"flowplayer-header-duration")}}),ue(e,"flowplayer-header-right-zone",class extends FlowplayerHeaderLeftRight{constructor(e){super(e,"fp-right fp-togglable","flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon")}}),ue(e,N,FlowplayerMiddle),ue(e,U,FlowplayerMiddleZone),ue(e,B,FlowplayerMiddleWait),ue(e,"flowplayer-middle-buttons",FlowplayerMiddleButtons),ue(e,"flowplayer-middle-right-zone",class extends FlowplayerLeftRightZone{constructor(e){super(e,"fp-right-zone")}}),ue(e,"flowplayer-middle-left-zone",class extends FlowplayerLeftRightZone{constructor(e){super(e,"fp-left-zone")}}),ue(e,"flowplayer-small-play-icon",class extends FlowplayerIcon{constructor(e){super(e,Ir),this.setAttribute("role","button")}}),ue(e,"flowplayer-small-pause-icon",class extends FlowplayerIcon{constructor(e){super(e,xr),this.setAttribute("role","button")}}),ue(e,j,class extends FlowplayerIcon{constructor(e){super(e,Dr)}}),ue(e,G,class extends FlowplayerIcon{constructor(e){super(e,Or)}}),ue(e,"flowplayer-fullscreen-enter-icon",class extends FullscreenIcon{constructor(e){super(e,kr)}}),ue(e,"flowplayer-fullscreen-exit-icon",class extends FullscreenIcon{constructor(e){super(e,Rr)}}),ue(e,"flowplayer-fast-forward-icon",class extends FlowplayerIcon{constructor(e){super(e,Pr)}}),ue(e,H,class extends FlowplayerIcon{constructor(e){super(e,Mr)}}),ue(e,K,class extends FlowplayerIcon{constructor(e){super(e,Cr),this.classList.add("fp-volumebtn"),e.on("volumechange",()=>{const t=0==e.volume||e.muted;this.setAttribute("aria-label",t?e.i18n("unmute","unmute"):e.i18n("mute","mute"))})}})}init(e,t,r){var n;ar(e,0,r),ir(e,t,r),n=r,"undefined"!=typeof window&&"ontouchstart"in window&&n.setState("is-touch-device",!0),n.setState("is-accessibility",!1)}}]);var zr=Object.assign(pt,{ui:Xt,i18n:I18n}),Yr=gt(mt((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
  \*********************************************/
19
- /*! no static exports found */function(t,e,r){var n=Object.prototype.hasOwnProperty,i="~";function a(){}function s(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function o(t,e,r,n,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new s(r,n||t,a),u=i?i+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],o]:t._events[u].push(o):(t._events[u]=o,t._eventsCount++),t}function u(t,e){0==--t._eventsCount?t._events=new a:delete t._events[e]}function l(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(i=!1)),l.prototype.eventNames=function(){var t,e,r=[];if(0===this._eventsCount)return r;for(e in t=this._events)n.call(t,e)&&r.push(i?e.slice(1):e);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},l.prototype.listeners=function(t){var e=i?i+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,a=r.length,s=new Array(a);n<a;n++)s[n]=r[n].fn;return s},l.prototype.listenerCount=function(t){var e=i?i+t:t,r=this._events[e];return r?r.fn?1:r.length:0},l.prototype.emit=function(t,e,r,n,a,s){var o=i?i+t:t;if(!this._events[o])return!1;var u,l,c=this._events[o],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,r),!0;case 4:return c.fn.call(c.context,e,r,n),!0;case 5:return c.fn.call(c.context,e,r,n,a),!0;case 6:return c.fn.call(c.context,e,r,n,a,s),!0}for(l=1,u=new Array(d-1);l<d;l++)u[l-1]=arguments[l];c.fn.apply(c.context,u)}else{var f,h=c.length;for(l=0;l<h;l++)switch(c[l].once&&this.removeListener(t,c[l].fn,void 0,!0),d){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,e);break;case 3:c[l].fn.call(c[l].context,e,r);break;case 4:c[l].fn.call(c[l].context,e,r,n);break;default:if(!u)for(f=1,u=new Array(d-1);f<d;f++)u[f-1]=arguments[f];c[l].fn.apply(c[l].context,u)}}return!0},l.prototype.on=function(t,e,r){return o(this,t,e,r,!1)},l.prototype.once=function(t,e,r){return o(this,t,e,r,!0)},l.prototype.removeListener=function(t,e,r,n){var a=i?i+t:t;if(!this._events[a])return this;if(!e)return u(this,a),this;var s=this._events[a];if(s.fn)s.fn!==e||n&&!s.once||r&&s.context!==r||u(this,a);else{for(var o=0,l=[],c=s.length;o<c;o++)(s[o].fn!==e||n&&!s[o].once||r&&s[o].context!==r)&&l.push(s[o]);l.length?this._events[a]=1===l.length?l[0]:l:u(this,a)}return this},l.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&u(this,e)):(this._events=new a,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=i,l.EventEmitter=l,t.exports=l},"./node_modules/url-toolkit/src/url-toolkit.js":
19
+ /*! no static exports found */function(e,t,r){var n=Object.prototype.hasOwnProperty,i="~";function a(){}function s(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,r,n,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new s(r,n||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new a:delete e._events[t]}function u(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(i=!1)),u.prototype.eventNames=function(){var e,t,r=[];if(0===this._eventsCount)return r;for(t in e=this._events)n.call(e,t)&&r.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},u.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,a=r.length,s=new Array(a);n<a;n++)s[n]=r[n].fn;return s},u.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},u.prototype.emit=function(e,t,r,n,a,s){var o=i?i+e:e;if(!this._events[o])return!1;var l,u,c=this._events[o],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,n),!0;case 5:return c.fn.call(c.context,t,r,n,a),!0;case 6:return c.fn.call(c.context,t,r,n,a,s),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var f,h=c.length;for(u=0;u<h;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,r);break;case 4:c[u].fn.call(c[u].context,t,r,n);break;default:if(!l)for(f=1,l=new Array(d-1);f<d;f++)l[f-1]=arguments[f];c[u].fn.apply(c[u].context,l)}}return!0},u.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},u.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},u.prototype.removeListener=function(e,t,r,n){var a=i?i+e:e;if(!this._events[a])return this;if(!t)return l(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||n&&!s.once||r&&s.context!==r||l(this,a);else{for(var o=0,u=[],c=s.length;o<c;o++)(s[o].fn!==t||n&&!s[o].once||r&&s[o].context!==r)&&u.push(s[o]);u.length?this._events[a]=1===u.length?u[0]:u:l(this,a)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&l(this,t)):(this._events=new a,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=i,u.EventEmitter=u,e.exports=u},"./node_modules/url-toolkit/src/url-toolkit.js":
20
20
  /*!*****************************************************!*\
21
21
  !*** ./node_modules/url-toolkit/src/url-toolkit.js ***!
22
22
  \*****************************************************/
23
- /*! no static exports found */function(t,e,r){var n,i,a,s,o;n=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/,i=/^([^\/?#]*)(.*)$/,a=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var n=o.parseURL(t);if(!n)throw new Error("Error trying to parse base URL.");return n.path=o.normalizePath(n.path),o.buildURLFromParts(n)}var a=o.parseURL(e);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):e;var s=o.parseURL(t);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var u=i.exec(s.path);s.netLoc=u[1],s.path=u[2]}s.netLoc&&!s.path&&(s.path="/");var l={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=s.netLoc,"/"!==a.path[0]))if(a.path){var c=s.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;l.path=o.normalizePath(d)}else l.path=s.path,a.params||(l.params=s.params,a.query||(l.query=s.query));return null===l.path&&(l.path=r.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(l)},parseURL:function(t){var e=n.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(a,"");t.length!==(t=t.replace(s,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=o},"./node_modules/webworkify-webpack/index.js":
23
+ /*! no static exports found */function(e,t,r){var n,i,a,s,o;n=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/,i=/^([^\/?#]*)(.*)$/,a=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var n=o.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=o.normalizePath(n.path),o.buildURLFromParts(n)}var a=o.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):t;var s=o.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var l=i.exec(s.path);s.netLoc=l[1],s.path=l[2]}s.netLoc&&!s.path&&(s.path="/");var u={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(u.netLoc=s.netLoc,"/"!==a.path[0]))if(a.path){var c=s.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;u.path=o.normalizePath(d)}else u.path=s.path,a.params||(u.params=s.params,a.query||(u.query=s.query));return null===u.path&&(u.path=r.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(u)},parseURL:function(e){var t=n.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(a,"");e.length!==(e=e.replace(s,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=o},"./node_modules/webworkify-webpack/index.js":
24
24
  /*!**************************************************!*\
25
25
  !*** ./node_modules/webworkify-webpack/index.js ***!
26
26
  \**************************************************/
27
- /*! no static exports found */function(t,e,r){function n(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=t,r.c=e,r.i=function(t){return t},r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r.oe=function(t){throw console.error(t),t};var n=r(r.s=ENTRY_MODULE);return n.default||n}function i(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(t,e,n){var a={};a[n]=[];var s=e.toString(),o=s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return a;for(var u,l=o[1],c=new RegExp("(\\\\n|\\W)"+i(l)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");u=c.exec(s);)"dll-reference"!==u[3]&&a[n].push(u[3]);for(c=new RegExp("\\("+i(l)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");u=c.exec(s);)t[u[2]]||(a[n].push(u[1]),t[u[2]]=r(u[1]).m),a[u[2]]=a[u[2]]||[],a[u[2]].push(u[4]);for(var d,f=Object.keys(a),h=0;h<f.length;h++)for(var p=0;p<a[f[h]].length;p++)d=a[f[h]][p],isNaN(1*d)||(a[f[h]][p]=1*a[f[h]][p]);return a}function s(t){return Object.keys(t).reduce((function(e,r){return e||t[r].length>0}),!1)}t.exports=function(t,e){e=e||{};var i={main:r.m},o=e.all?{main:Object.keys(i.main)}:function(t,e){for(var r={main:[e]},n={main:[]},i={main:{}};s(r);)for(var o=Object.keys(r),u=0;u<o.length;u++){var l=o[u],c=r[l].pop();if(i[l]=i[l]||{},!i[l][c]&&t[l][c]){i[l][c]=!0,n[l]=n[l]||[],n[l].push(c);for(var d=a(t,t[l][c],l),f=Object.keys(d),h=0;h<f.length;h++)r[f[h]]=r[f[h]]||[],r[f[h]]=r[f[h]].concat(d[f[h]])}}return n}(i,t),u="";Object.keys(o).filter((function(t){return"main"!==t})).forEach((function(t){for(var e=0;o[t][e];)e++;o[t].push(e),i[t][e]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",u=u+"var "+t+" = ("+n.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+o[t].map((function(e){return JSON.stringify(e)+": "+i[t][e].toString()})).join(",")+"});\n"})),u=u+"new (("+n.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+o.main.map((function(t){return JSON.stringify(t)+": "+i.main[t].toString()})).join(",")+"}))(self);";var l=new window.Blob([u],{type:"text/javascript"});if(e.bare)return l;var c=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(l),d=new window.Worker(c);return d.objectURL=c,d}},"./src/config.ts":
27
+ /*! no static exports found */function(e,t,r){function n(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}r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},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.oe=function(e){throw console.error(e),e};var n=r(r.s=ENTRY_MODULE);return n.default||n}function i(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,n){var a={};a[n]=[];var s=t.toString(),o=s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return a;for(var l,u=o[1],c=new RegExp("(\\\\n|\\W)"+i(u)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");l=c.exec(s);)"dll-reference"!==l[3]&&a[n].push(l[3]);for(c=new RegExp("\\("+i(u)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");l=c.exec(s);)e[l[2]]||(a[n].push(l[1]),e[l[2]]=r(l[1]).m),a[l[2]]=a[l[2]]||[],a[l[2]].push(l[4]);for(var d,f=Object.keys(a),h=0;h<f.length;h++)for(var p=0;p<a[f[h]].length;p++)d=a[f[h]][p],isNaN(1*d)||(a[f[h]][p]=1*a[f[h]][p]);return a}function s(e){return Object.keys(e).reduce((function(t,r){return t||e[r].length>0}),!1)}e.exports=function(e,t){t=t||{};var i={main:r.m},o=t.all?{main:Object.keys(i.main)}:function(e,t){for(var r={main:[t]},n={main:[]},i={main:{}};s(r);)for(var o=Object.keys(r),l=0;l<o.length;l++){var u=o[l],c=r[u].pop();if(i[u]=i[u]||{},!i[u][c]&&e[u][c]){i[u][c]=!0,n[u]=n[u]||[],n[u].push(c);for(var d=a(e,e[u][c],u),f=Object.keys(d),h=0;h<f.length;h++)r[f[h]]=r[f[h]]||[],r[f[h]]=r[f[h]].concat(d[f[h]])}}return n}(i,e),l="";Object.keys(o).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;o[e][t];)t++;o[e].push(t),i[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",l=l+"var "+e+" = ("+n.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+o[e].map((function(t){return JSON.stringify(t)+": "+i[e][t].toString()})).join(",")+"});\n"})),l=l+"new (("+n.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+o.main.map((function(e){return JSON.stringify(e)+": "+i.main[e].toString()})).join(",")+"}))(self);";var u=new window.Blob([l],{type:"text/javascript"});if(t.bare)return u;var c=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(u),d=new window.Worker(c);return d.objectURL=c,d}},"./src/config.ts":
28
28
  /*!***********************!*\
29
29
  !*** ./src/config.ts ***!
30
30
  \***********************/
31
- /*! exports provided: hlsDefaultConfig, mergeConfig, enableStreamingMode */function(t,e,r){r.r(e),r.d(e,"hlsDefaultConfig",(function(){return b})),r.d(e,"mergeConfig",(function(){return A})),r.d(e,"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(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function E(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function T(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?E(Object(r),!0).forEach((function(e){_(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):E(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function _(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var b=T(T({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(t,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==e.liveMaxLatencyDurationCount&&(void 0===e.liveSyncDurationCount||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==e.liveMaxLatencyDuration&&(void 0===e.liveSyncDuration||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return y({},t,e)}function S(t){var e=t.loader;e!==p.default&&e!==h.default?(m.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1):Object(p.fetchSupported)()&&(t.loader=p.default,t.progressive=!0,t.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 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"),l=r(/*! ./controller/buffer-controller */"./src/controller/buffer-controller.ts"),u=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:l.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:u.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":
32
32
  /*!******************************************!*\
33
33
  !*** ./src/controller/abr-controller.ts ***!
34
34
  \******************************************/
35
- /*! exports provided: default */function(t,e,r){r.r(e);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(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var d=function(){function t(t){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=t;var e=t.config;this.bwEstimator=new i.default(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate),this.registerListeners()}var e,r,d,f=t.prototype;return f.registerListeners=function(){var t=this.hls;t.on(a.Events.FRAG_LOADING,this.onFragLoading,this),t.on(a.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(a.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var t=this.hls;t.off(a.Events.FRAG_LOADING,this.onFragLoading,this),t.off(a.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.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(t,e){var r,n=e.frag;n.type===u.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=n,this.partCurrent=null!=(r=e.part)?r:null,this.timer=self.setInterval(this.onCheck,100)))},f.onLevelLoaded=function(t,e){var r=this.hls.config;e.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)},f._abandonRulesCheck=function(){var t=this.fragCurrent,e=this.partCurrent,r=this.hls,i=r.autoLevelEnabled,o=r.config,u=r.media;if(t&&u){var c=e?e.stats:t.stats,d=e?e.duration:t.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[t.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,T=u.currentTime,_=(s.BufferHelper.bufferInfo(u,T,o.maxBufferHole).end-T)/h;if(!(_>=2*d/h||E<=_)){var b,A=Number.POSITIVE_INFINITY;for(b=t.level-1;b>v&&!((A=d*p[b].maxBitrate/(6.4*y))<_);b--);if(!(A>=E)){var S=this.bwEstimator.getEstimate();l.logger.warn("Fragment "+t.sn+(e?" part "+e.index:"")+" of level "+t.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: "+_.toFixed(3)+" s"),r.nextLoadLevel=b,this.bwEstimator.sample(f,c.loaded),this.clearTimer(),t.loader&&(this.fragCurrent=this.partCurrent=null,t.loader.abort()),r.trigger(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:e,stats:c})}}}}}},f.onFragLoaded=function(t,e){var r=e.frag,i=e.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(t,e){var r=e.frag,n=e.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(t,e){switch(e.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 t=this.fragCurrent,e=this.partCurrent,r=this.hls,n=r.maxAutoLevel,i=r.config,a=r.minAutoLevel,o=r.media,u=e?e.duration:t?t.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(t,e,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>=e;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,T=void 0;T=g<=c?i*t:a*t;var _=d[g].maxBitrate,b=_*E/T;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},e=t,(r=[{key:"nextAutoLevel",get:function(){var t=this._nextAutoLevel,e=this.bwEstimator;if(!(-1===t||e&&e.canEstimate()))return t;var r=this.getNextABRAutoLevel();return-1!==t&&(r=Math.min(t,r)),r},set:function(t){this._nextAutoLevel=t}}])&&c(e.prototype,r),d&&c(e,d),t}();e.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"),l=r(/*! ../types/loader */"./src/types/loader.ts"),u=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===l.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,l=r.media;if(e&&l){var c=t?t.stats:e.stats,d=t?t.duration:e.duration;if(c.aborted)return u.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);if(i&&!l.paused&&l.playbackRate&&l.readyState){var f=performance.now()-c.loading.start,h=Math.abs(l.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,_=l.currentTime,T=(s.BufferHelper.bufferInfo(l,_,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();u.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===l.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 u=this.hls.levels[r.level],c=(u.loaded?u.loaded.bytes:0)+s.loaded,d=(u.loaded?u.loaded.duration:0)+o;u.loaded={bytes:c,duration:d},u.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===l.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,l=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;u.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var v=l?Math.min(l,i.maxStarvationDelay):i.maxStarvationDelay,g=i.abrBandWidthFactor,m=i.abrBandWidthUpFactor;if(!h){var y=this.bitrateTestDelay;y&&(v=(l?Math.min(l,i.maxLoadingDelay):i.maxLoadingDelay)-y,u.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,l=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=l?l.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=(l?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(u.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(t,e,r){r.r(e);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(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function T(t,e){return(T=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var _=function(t){var e,r;function _(e,r){var n;return(n=t.call(this,e,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=t,(e=_).prototype=Object.create(r.prototype),e.prototype.constructor=e,T(e,r);var b=_.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var t=this.hls;t.on(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(a.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(a.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(a.Events.ERROR,this.onError,this),t.on(a.Events.BUFFER_RESET,this.onBufferReset,this),t.on(a.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var t=this.hls;t.off(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(a.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(a.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(a.Events.ERROR,this.onError,this),t.off(a.Events.BUFFER_RESET,this.onBufferReset,this),t.off(a.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(a.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onInitPtsFound=function(t,e){var r=e.frag,n=e.id,a=e.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(t){if(!this.levels)return this.startPosition=t,void(this.state=i.State.STOPPED);var e=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,e>0&&-1===t?(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),this.state=i.State.IDLE):(this.loadedmetadata=!1,this.state=i.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},b.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_TRACK:var e,r=this.levels,n=this.trackId,a=null==r||null===(e=r[n])||void 0===e?void 0:e.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&&t.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 t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=i.State.IDLE)},b.onTickEnd=function(){var t=this.media;if(t&&t.readyState){var e=(this.mediaBuffer?this.mediaBuffer:t).buffered;!this.loadedmetadata&&e.length&&(this.loadedmetadata=!0),this.lastCurrentTime=t.currentTime}},b.doTickIdle=function(){var t,e,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),T=s.BufferHelper.bufferInfo(m,d,y),_=E.len,b=Math.min(c.maxBufferLength,c.maxMaxBufferLength),A=Math.max(b,T.len),S=this.audioSwitch;if(_>=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===(t=h.decryptdata)||void 0===t?void 0:t.keyFormat)||null!==(e=h.decryptdata)&&void 0!==e&&e.key?this.loadFragment(h,f,p):this.loadKey(h,f)}}}},b.onMediaDetaching=function(){this.videoBuffer=null,t.prototype.onMediaDetaching.call(this)},b.onAudioTracksUpdated=function(t,e){var r=e.audioTracks;this.resetTransmuxer(),this.levels=r.map((function(t){return new u.Level(t)}))},b.onAudioTrackSwitching=function(t,e){var r=!!e.url;this.trackId=e.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(t,e){if(null===this.mainDetails){var r=this.mainDetails=e.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(t,e){var r,n=this.levels,a=e.details,s=e.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(t){var e,r=t.frag,n=t.part,a=t.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===(e=p.initSegment)||void 0===e?void 0:e.data;if(void 0!==m){var T=n?n.index:-1,_=-1!==T,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(e){this.waitingData?this.waitingData.complete=!0:t.prototype._handleFragmentLoadComplete.call(this,e)},b.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},b.onBufferCreated=function(t,e){var r=e.tracks.audio;r&&(this.mediaBuffer=r.buffer),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer)},b.onFragBuffered=function(t,e){var r=e.frag,n=e.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(e,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,t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"))}}},b.onBufferFlushed=function(t,e){var r=e.type;if(r===c.ElementaryStreamTypes.AUDIO){var n=this.mediaBuffer?this.mediaBuffer:this.media;this.afterBufferFlushed(n,r,l.PlaylistLevelType.AUDIO)}},b._handleTransmuxComplete=function(t){var e,r="audio",n=this.hls,s=t.remuxResult,o=t.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,T=f.endDTS;d&&(d.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:g,endPTS:m,startDTS:y,endDTS:T}),l.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,g,m,y,T),this.bufferFragmentData(f,l,d,o)}if(null!=p&&null!==(e=p.samples)&&void 0!==e&&e.length){var _=E({frag:l,id:r},p);n.trigger(a.Events.FRAG_PARSING_METADATA,_)}if(h){var b=E({frag:l,id:r},h);n.trigger(a.Events.FRAG_PARSING_USERDATA,b)}}},b._bufferInitSegment=function(t,e,r){if(this.state===i.State.PARSING){t.video&&delete t.video;var n=t.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,t);var s=n.initSegment;if(null!=s&&s.byteLength){var o={type:"audio",frag:e,part:null,chunkMeta:r,parent:e.type,data:s};this.hls.trigger(a.Events.BUFFER_APPENDING,o)}this.tick()}}},b.loadFragment=function(e,r,a){var s=this.fragmentTracker.getState(e);this.fragCurrent=e,(this.audioSwitch||s===o.FragmentState.NOT_LOADED||s===o.FragmentState.PARTIAL)&&("initSegment"===e.sn?this._loadInitSegment(e):r.live&&!Object(n.isFiniteNumber)(this.initPTS[e.cc])?(this.log("Waiting for video PTS in continuity counter "+e.cc+" of live stream before loading audio fragment "+e.sn+" of level "+this.trackId),this.state=i.State.WAITING_INIT_PTS):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,r,a)))},b.completeAudioSwitch=function(){var e=this.hls,r=this.media,n=this.trackId;r&&(this.log("Switching audio track : flushing all audio"),t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,e.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:n})},_}(i.default);e.default=_},"./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"),l=r(/*! ../types/level */"./src/types/level.ts"),u=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,l=performance.now(),u=this.retryDate;(!u||l>=u||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,l=this.media,u=this.trackId,c=r.config;if(o&&o[u]&&(l||!this.startFragRequested&&c.startFragPrefetch)){var d=this.getLoadPosition();if(Object(n.isFiniteNumber)(d)){var f=o[u].details;if(!f||f.live&&this.levelLastLoaded!==u||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"),l.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 l.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],l=0;if(a.live||null!==(r=o.details)&&void 0!==r&&r.live){var u;if(a.fragments[0]||(a.deltaUpdateFailed=!0),a.deltaUpdateFailed)return;!o.details&&null!==(u=this.mainDetails)&&void 0!==u&&u.hasProgramDateTime&&a.hasProgramDateTime?(Object(v.alignPDT)(a,this.mainDetails),l=a.fragments[0].start):l=this.alignPlaylists(a,o.details)}o.details=a,this.levelLastLoaded=s,this.startFragRequested||!this.mainDetails&&a.live||this.setStartPosition(o.details,l),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,l=this.levels;if(l){var c=l[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,u.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===u.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(u.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,u.PlaylistLevelType.AUDIO)}},b._handleTransmuxComplete=function(e){var t,r="audio",n=this.hls,s=e.remuxResult,o=e.chunkMeta,l=this.getCurrentContext(o);if(!l)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 u=l.frag,d=l.part,f=s.audio,h=s.text,p=s.id3,v=s.initSegment;if(!this.fragContextChanged(u)){if(this.state=i.State.PARSING,this.audioSwitch&&f&&this.completeAudioSwitch(),null!=v&&v.tracks&&(this._bufferInitSegment(v.tracks,u,o),n.trigger(a.Events.FRAG_PARSING_INIT_SEGMENT,{frag:u,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:_}),u.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,g,m,y,_),this.bufferFragmentData(f,u,d,o)}if(null!=p&&null!==(t=p.samples)&&void 0!==t&&t.length){var T=E({frag:u,id:r},p);n.trigger(a.Events.FRAG_PARSING_METADATA,T)}if(h){var b=E({frag:u,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
  \**************************************************/
43
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),s=r(/*! ../types/loader */"./src/types/loader.ts");function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var l=function(t){var e,r;function a(e){var r;return(r=t.call(this,e,"[audio-track-controller]")||this).tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.trackName="",r.selectDefaultTrack=!0,r.registerListeners(),r}r=t,(e=a).prototype=Object.create(r.prototype),e.prototype.constructor=e,u(e,r);var l,c,d,f=a.prototype;return f.registerListeners=function(){var t=this.hls;t.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(n.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(n.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(n.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var t=this.hls;t.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(n.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(n.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(n.Events.ERROR,this.onError,this)},f.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,t.prototype.destroy.call(this)},f.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},f.onManifestParsed=function(t,e){this.tracks=e.audioTracks||[]},f.onAudioTrackLoaded=function(t,e){var r=e.id,n=e.details,i=this.tracksInGroup[r];if(i){var a=i.details;i.details=e.details,this.log("audioTrack "+r+" loaded ["+n.startSN+"-"+n.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,e,a))}else this.warn("Invalid audio track id "+r)},f.onLevelLoading=function(t,e){this.switchLevel(e.level)},f.onLevelSwitching=function(t,e){this.switchLevel(e.level)},f.switchLevel=function(t){var e=this.hls.levels[t];if(null!=e&&e.audioGroupIds){var r=e.audioGroupIds[e.urlId];if(this.groupId!==r){this.groupId=r;var i=this.tracks.filter((function(t){return!r||t.groupId===r}));this.selectDefaultTrack&&!i.some((function(t){return t.default}))&&(this.selectDefaultTrack=!1),this.tracksInGroup=i;var a={audioTracks:i};this.log("Updating audio tracks, "+i.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(n.Events.AUDIO_TRACKS_UPDATED,a),this.selectInitialTrack()}}},f.onError=function(e,r){t.prototype.onError.call(this,e,r),!r.fatal&&r.context&&r.context.type===s.PlaylistContextType.AUDIO_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},f.setAudioTrack=function(t){var e=this.tracksInGroup;if(t<0||t>=e.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var r=e[this.trackId];this.log("Now switching to audio-track index "+t);var i=e[t],a=i.id,s=i.groupId,o=void 0===s?"":s,u=i.name,l=i.type,c=i.url;if(this.trackId=t,this.trackName=u,this.selectDefaultTrack=!1,this.hls.trigger(n.Events.AUDIO_TRACK_SWITCHING,{id:a,groupId:o,name:u,type:l,url:c}),!i.details||i.details.live){var d=this.switchParams(i.url,null==r?void 0:r.details);this.loadPlaylist(d)}}},f.selectInitialTrack=function(){var t=this.tracksInGroup;console.assert(t.length,"Initial audio track should be selected when tracks are known");var e=this.trackName,r=this.findTrackId(e)||this.findTrackId();-1!==r?this.setAudioTrack(r):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},f.findTrackId=function(t){for(var e=this.tracksInGroup,r=0;r<e.length;r++){var n=e[r];if((!this.selectDefaultTrack||n.default)&&(!t||t===n.name))return n.id}return-1},f.loadPlaylist=function(t){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var r=e.id,i=e.groupId,a=e.url;if(t)try{a=t.addDirectives(a)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("loading audio-track playlist for id: "+r),this.clearTimer(),this.hls.trigger(n.Events.AUDIO_TRACK_LOADING,{url:a,id:r,groupId:i,deliveryDirectives:t||null})}},l=a,(c=[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}}])&&o(l.prototype,c),d&&o(l,d),a}(a.default);e.default=l},"./src/controller/base-playlist-controller.ts":
43
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),s=r(/*! ../types/loader */"./src/types/loader.ts");function o(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 l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var u=function(e){var t,r;function a(t){var r;return(r=e.call(this,t,"[audio-track-controller]")||this).tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.trackName="",r.selectDefaultTrack=!0,r.registerListeners(),r}r=e,(t=a).prototype=Object.create(r.prototype),t.prototype.constructor=t,l(t,r);var u,c,d,f=a.prototype;return f.registerListeners=function(){var e=this.hls;e.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(n.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(n.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){var e=this.hls;e.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(n.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(n.Events.ERROR,this.onError,this)},f.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,e.prototype.destroy.call(this)},f.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},f.onManifestParsed=function(e,t){this.tracks=t.audioTracks||[]},f.onAudioTrackLoaded=function(e,t){var r=t.id,n=t.details,i=this.tracksInGroup[r];if(i){var a=i.details;i.details=t.details,this.log("audioTrack "+r+" loaded ["+n.startSN+"-"+n.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,a))}else this.warn("Invalid audio track id "+r)},f.onLevelLoading=function(e,t){this.switchLevel(t.level)},f.onLevelSwitching=function(e,t){this.switchLevel(t.level)},f.switchLevel=function(e){var t=this.hls.levels[e];if(null!=t&&t.audioGroupIds){var r=t.audioGroupIds[t.urlId];if(this.groupId!==r){this.groupId=r;var i=this.tracks.filter((function(e){return!r||e.groupId===r}));this.selectDefaultTrack&&!i.some((function(e){return e.default}))&&(this.selectDefaultTrack=!1),this.tracksInGroup=i;var a={audioTracks:i};this.log("Updating audio tracks, "+i.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(n.Events.AUDIO_TRACKS_UPDATED,a),this.selectInitialTrack()}}},f.onError=function(t,r){e.prototype.onError.call(this,t,r),!r.fatal&&r.context&&r.context.type===s.PlaylistContextType.AUDIO_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},f.setAudioTrack=function(e){var t=this.tracksInGroup;if(e<0||e>=t.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var r=t[this.trackId];this.log("Now switching to audio-track index "+e);var i=t[e],a=i.id,s=i.groupId,o=void 0===s?"":s,l=i.name,u=i.type,c=i.url;if(this.trackId=e,this.trackName=l,this.selectDefaultTrack=!1,this.hls.trigger(n.Events.AUDIO_TRACK_SWITCHING,{id:a,groupId:o,name:l,type:u,url:c}),!i.details||i.details.live){var d=this.switchParams(i.url,null==r?void 0:r.details);this.loadPlaylist(d)}}},f.selectInitialTrack=function(){var e=this.tracksInGroup;console.assert(e.length,"Initial audio track should be selected when tracks are known");var t=this.trackName,r=this.findTrackId(t)||this.findTrackId();-1!==r?this.setAudioTrack(r):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},f.findTrackId=function(e){for(var t=this.tracksInGroup,r=0;r<t.length;r++){var n=t[r];if((!this.selectDefaultTrack||n.default)&&(!e||e===n.name))return n.id}return-1},f.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var r=t.id,i=t.groupId,a=t.url;if(e)try{a=e.addDirectives(a)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("loading audio-track playlist for id: "+r),this.clearTimer(),this.hls.trigger(n.Events.AUDIO_TRACK_LOADING,{url:a,id:r,groupId:i,deliveryDirectives:e||null})}},u=a,(c=[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}}])&&o(u.prototype,c),d&&o(u,d),a}(a.default);t.default=u},"./src/controller/base-playlist-controller.ts":
44
44
  /*!****************************************************!*\
45
45
  !*** ./src/controller/base-playlist-controller.ts ***!
46
46
  \****************************************************/
47
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return u}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../types/level */"./src/types/level.ts"),a=r(/*! ./level-helper */"./src/controller/level-helper.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../errors */"./src/errors.ts"),u=function(){function t(t,e){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=s.logger.log.bind(s.logger,e+":"),this.warn=s.logger.warn.bind(s.logger,e+":"),this.hls=t}var e=t.prototype;return e.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},e.onError=function(t,e){e.fatal&&e.type===o.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},e.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},e.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},e.stopLoad=function(){this.canLoad=!1,this.clearTimer()},e.switchParams=function(t,e){var r=null==e?void 0:e.renditionReports;if(r)for(var a=0;a<r.length;a++){var s=r[a],o=""+s.URI;if(o===t.substr(-o.length)){var u=parseInt(s["LAST-MSN"]),l=parseInt(s["LAST-PART"]);if(e&&this.hls.config.lowLatencyMode){var c=Math.min(e.age-e.partTarget,e.targetduration);void 0!==l&&c>e.partTarget&&(l+=1)}if(Object(n.isFiniteNumber)(u))return new i.HlsUrlParameters(u,Object(n.isFiniteNumber)(l)?l:void 0,i.HlsSkip.No)}}},e.loadPlaylist=function(t){},e.shouldLoadTrack=function(t){return this.canLoad&&t&&!!t.url&&(!t.details||t.details.live)},e.playlistLoaded=function(t,e,r){var n=this,i=e.details,s=e.stats,o=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(i.advancedDateTime=Date.now()-o,i.live||null!=r&&r.live){if(i.reloaded(r),r&&this.log("live playlist "+t+" "+(i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:"MISSED")),r&&i.fragments.length>0&&a.mergeDetails(r,i),!this.canLoad||!i.live)return;var u,l=void 0,c=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var d=this.hls.config.lowLatencyMode,f=i.lastPartSn,h=i.endSN,p=i.lastPartIndex,v=f===h;-1!==p?(l=v?h+1:f,c=v?d?0:p:p+1):l=h+1;var g=i.age,m=g+i.ageHeader,y=Math.min(m-i.partTarget,1.5*i.targetduration);if(y>0){if(r&&y>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+y+" with playlist age: "+i.age),y=0;else{var E=Math.floor(y/i.targetduration);l+=E,void 0!==c&&(c+=Math.round(y%i.targetduration/i.partTarget)),this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+y+" skip sn "+E+" to part "+c)}i.tuneInGoal=y}if(u=this.getDeliveryDirectives(i,e.deliveryDirectives,l,c),d||!v)return void this.loadPlaylist(u)}else u=this.getDeliveryDirectives(i,e.deliveryDirectives,l,c);var T=Object(a.computeReloadInterval)(i,s);void 0!==l&&i.canBlockReload&&(T-=i.partTarget||1),this.log("reload live playlist "+t+" in "+Math.round(T)+" ms"),this.timer=self.setTimeout((function(){return n.loadPlaylist(u)}),T)}else this.clearTimer()},e.getDeliveryDirectives=function(t,e,r,n){var a=Object(i.getSkipValue)(t,r);return null!=e&&e.skip&&t.deltaUpdateFailed&&(r=e.msn,n=e.part,a=i.HlsSkip.No),new i.HlsUrlParameters(r,n,a)},e.retryLoadingOrFail=function(t){var e,r=this,n=this.hls.config,i=this.retryCount<n.levelLoadingMaxRetry;if(i)if(this.retryCount++,t.details.indexOf("LoadTimeOut")>-1&&null!==(e=t.context)&&void 0!==e&&e.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+t.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*n.levelLoadingRetryDelay,n.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout((function(){return r.loadPlaylist()}),a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+t.details+'"')}else this.warn('cannot recover from error "'+t.details+'"'),this.clearTimer(),t.fatal=!0;return i},t}()},"./src/controller/base-stream-controller.ts":
47
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return l}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../types/level */"./src/types/level.ts"),a=r(/*! ./level-helper */"./src/controller/level-helper.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../errors */"./src/errors.ts"),l=function(){function e(e,t){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=s.logger.log.bind(s.logger,t+":"),this.warn=s.logger.warn.bind(s.logger,t+":"),this.hls=e}var t=e.prototype;return t.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},t.onError=function(e,t){t.fatal&&t.type===o.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},t.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},t.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},t.stopLoad=function(){this.canLoad=!1,this.clearTimer()},t.switchParams=function(e,t){var r=null==t?void 0:t.renditionReports;if(r)for(var a=0;a<r.length;a++){var s=r[a],o=""+s.URI;if(o===e.substr(-o.length)){var l=parseInt(s["LAST-MSN"]),u=parseInt(s["LAST-PART"]);if(t&&this.hls.config.lowLatencyMode){var c=Math.min(t.age-t.partTarget,t.targetduration);void 0!==u&&c>t.partTarget&&(u+=1)}if(Object(n.isFiniteNumber)(l))return new i.HlsUrlParameters(l,Object(n.isFiniteNumber)(u)?u:void 0,i.HlsSkip.No)}}},t.loadPlaylist=function(e){},t.shouldLoadTrack=function(e){return this.canLoad&&e&&!!e.url&&(!e.details||e.details.live)},t.playlistLoaded=function(e,t,r){var n=this,i=t.details,s=t.stats,o=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(i.advancedDateTime=Date.now()-o,i.live||null!=r&&r.live){if(i.reloaded(r),r&&this.log("live playlist "+e+" "+(i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:"MISSED")),r&&i.fragments.length>0&&a.mergeDetails(r,i),!this.canLoad||!i.live)return;var l,u=void 0,c=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var d=this.hls.config.lowLatencyMode,f=i.lastPartSn,h=i.endSN,p=i.lastPartIndex,v=f===h;-1!==p?(u=v?h+1:f,c=v?d?0:p:p+1):u=h+1;var g=i.age,m=g+i.ageHeader,y=Math.min(m-i.partTarget,1.5*i.targetduration);if(y>0){if(r&&y>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+y+" with playlist age: "+i.age),y=0;else{var E=Math.floor(y/i.targetduration);u+=E,void 0!==c&&(c+=Math.round(y%i.targetduration/i.partTarget)),this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+y+" skip sn "+E+" to part "+c)}i.tuneInGoal=y}if(l=this.getDeliveryDirectives(i,t.deliveryDirectives,u,c),d||!v)return void this.loadPlaylist(l)}else l=this.getDeliveryDirectives(i,t.deliveryDirectives,u,c);var _=Object(a.computeReloadInterval)(i,s);void 0!==u&&i.canBlockReload&&(_-=i.partTarget||1),this.log("reload live playlist "+e+" in "+Math.round(_)+" ms"),this.timer=self.setTimeout((function(){return n.loadPlaylist(l)}),_)}else this.clearTimer()},t.getDeliveryDirectives=function(e,t,r,n){var a=Object(i.getSkipValue)(e,r);return null!=t&&t.skip&&e.deltaUpdateFailed&&(r=t.msn,n=t.part,a=i.HlsSkip.No),new i.HlsUrlParameters(r,n,a)},t.retryLoadingOrFail=function(e){var t,r=this,n=this.hls.config,i=this.retryCount<n.levelLoadingMaxRetry;if(i)if(this.retryCount++,e.details.indexOf("LoadTimeOut")>-1&&null!==(t=e.context)&&void 0!==t&&t.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+e.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*n.levelLoadingRetryDelay,n.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout((function(){return r.loadPlaylist()}),a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+e.details+'"')}else this.warn('cannot recover from error "'+e.details+'"'),this.clearTimer(),e.fatal=!0;return i},e}()},"./src/controller/base-stream-controller.ts":
48
48
  /*!**************************************************!*\
49
49
  !*** ./src/controller/base-stream-controller.ts ***!
50
50
  \**************************************************/
51
- /*! exports provided: State, default */function(t,e,r){r.r(e),r.d(e,"State",(function(){return _})),r.d(e,"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(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function T(t,e){return(T=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var _={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(t){var e,r;function i(e,r,n){var i;return(i=t.call(this)||this).hls=void 0,i.fragPrevious=null,i.fragCurrent=null,i.fragmentTracker=void 0,i.transmuxer=null,i._state=_.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=e,i.fragmentLoader=new v.default(e.config),i.fragmentTracker=r,i.config=e.config,i.decrypter=new g.default(e,e.config),e.on(u.Events.KEY_LOADED,i.onKeyLoaded,function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(i)),i}r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,T(e,r);var b,A,S,L=i.prototype;return L.doTick=function(){this.onTickEnd()},L.onTickEnd=function(){},L.startLoad=function(t){},L.stopLoad=function(){this.fragmentLoader.abort();var t=this.fragCurrent;t&&this.fragmentTracker.removeFragment(t),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=_.STOPPED},L._streamEnded=function(t,e){var r=this.fragCurrent,n=this.fragmentTracker;if(!e.live&&r&&r.sn===e.endSN&&!t.nextStart){var i=n.getState(r);return i===a.FragmentState.PARTIAL||i===a.FragmentState.OK}return!1},L.onMediaAttached=function(t,e){var r=this.media=this.mediaBuffer=e.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===_.STOPPED&&this.startLoad(n.startPosition)},L.onMediaDetaching=function(){var t=this.media;null!=t&&t.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&(t.removeEventListener("seeking",this.onvseeking),t.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 t=this.config,e=this.fragCurrent,r=this.media,i=this.mediaBuffer,a=this.state,o=r?r.currentTime:0,u=s.BufferHelper.bufferInfo(i||r,o,t.maxBufferHole);if(this.log("media seeking to "+(Object(n.isFiniteNumber)(o)?o.toFixed(3):o)+", state: "+a),a===_.ENDED)this.resetLoadingState();else if(e&&!u.len){var l=t.maxFragLookUpTolerance,c=e.start-l,d=e.start+e.duration+l;(o<c||o>d)&&(e.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),e.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(t,e){if(this.state===_.KEY_LOADING&&e.frag===this.fragCurrent&&this.levels){this.state=_.IDLE;var r=this.levels[e.frag.level].details;r&&this.loadFragment(e.frag,r,e.frag.start)}},L.onHandlerDestroying=function(){this.stopLoad(),t.prototype.onHandlerDestroying.call(this)},L.onHandlerDestroyed=function(){this.state=_.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,t.prototype.onHandlerDestroyed.call(this)},L.loadKey=function(t,e){this.log("Loading key for "+t.sn+" of ["+e.startSN+"-"+e.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+t.level),this.state=_.KEY_LOADING,this.fragCurrent=t,this.hls.trigger(u.Events.KEY_LOADING,{frag:t})},L.loadFragment=function(t,e,r){this._loadFragForPlayback(t,e,r)},L._loadFragForPlayback=function(t,e,r){var n=this;this._doFragLoad(t,e,r,(function(e){if(n.fragContextChanged(t))return n.warn("Fragment "+t.sn+(e.part?" p: "+e.part.index:"")+" of level "+t.level+" was dropped during download."),void n.fragmentTracker.removeFragment(t);t.stats.chunkCount++,n._handleFragmentLoadProgress(e)})).then((function(e){if(e){n.fragLoadError=0;var r=n.state;if(!n.fragContextChanged(t))return"payload"in e&&(n.log("Loaded fragment "+t.sn+" of level "+t.level),n.hls.trigger(u.Events.FRAG_LOADED,e),n.state===_.BACKTRACKING)?(n.fragmentTracker.backtrack(t,e),void n.resetFragmentLoading(t)):void n._handleFragmentLoadComplete(e);(r===_.FRAG_LOADING||r===_.BACKTRACKING||!n.fragCurrent&&r===_.PARSING)&&(n.fragmentTracker.removeFragment(t),n.state=_.IDLE)}})).catch((function(e){n.warn(e),n.resetFragmentLoading(t)}))},L.flushMainBuffer=function(t,e,r){void 0===r&&(r=null);var n={startOffset:t,endOffset:e,type:r};this.fragLoadError=0,this.hls.trigger(u.Events.BUFFER_FLUSHING,n)},L._loadInitSegment=function(t){var e=this;this._doFragLoad(t).then((function(r){if(!r||e.fragContextChanged(t)||!e.levels)throw new Error("init load aborted");return r})).then((function(r){var n=e.hls,i=r.payload,a=t.decryptdata;if(i&&i.byteLength>0&&a&&a.key&&a.iv&&"AES-128"===a.method){var s=self.performance.now();return e.decrypter.webCryptoDecrypt(new Uint8Array(i),a.key.buffer,a.iv.buffer).then((function(e){var i=self.performance.now();return n.trigger(u.Events.FRAG_DECRYPTED,{frag:t,payload:e,stats:{tstart:s,tdecrypt:i}}),r.payload=e,r}))}return r})).then((function(r){var n=e.fragCurrent,i=e.hls,a=e.levels;if(!a)throw new Error("init load aborted, missing levels");var s=a[t.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=t.stats;e.state=_.IDLE,e.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:t.type}),e.tick()})).catch((function(r){e.warn(r),e.resetFragmentLoading(t)}))},L.fragContextChanged=function(t){var e=this.fragCurrent;return!t||!e||t.level!==e.level||t.sn!==e.sn||t.urlId!==e.urlId},L.fragBufferedComplete=function(t,e){var r=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(e?" part: "+e.index:"")+" of "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+t.level+" "+m.default.toString(s.BufferHelper.getBuffered(r))),this.state=_.IDLE,this.tick()},L._handleFragmentLoadComplete=function(t){var e=this.transmuxer;if(e){var r=t.frag,n=t.part,i=t.partsLoaded,a=!i||0===i.length||i.some((function(t){return!t})),s=new d.ChunkMetadata(r.level,r.sn,r.stats.chunkCount+1,0,n?n.index:-1,!a);e.flush(s)}},L._handleFragmentLoadProgress=function(t){},L._doFragLoad=function(t,e,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(t.start,r||0),this.config.lowLatencyMode&&e){var s=e.partList;if(s&&i){r>t.end&&e.fragmentHint&&(t=e.fragmentHint);var o=this.getNextPart(s,t,r);if(o>-1){var l=s[o];return this.log("Loading part sn: "+t.sn+" p: "+l.index+" cc: "+t.cc+" of playlist ["+e.startSN+"-"+e.endSN+"] parts [0-"+o+"-"+(s.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),this.nextLoadPosition=l.start+l.duration,this.state=_.FRAG_LOADING,this.hls.trigger(u.Events.FRAG_LOADING,{frag:t,part:s[o],targetBufferTime:r}),this.doFragPartsLoad(t,s,o,i).catch((function(t){return a.handleFragLoadError(t)}))}if(!t.url||this.loadedEndOfParts(s,r))return Promise.resolve(null)}}return this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(e?"of ["+e.startSN+"-"+e.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),Object(n.isFiniteNumber)(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=_.FRAG_LOADING,this.hls.trigger(u.Events.FRAG_LOADING,{frag:t,targetBufferTime:r}),this.fragmentLoader.load(t,i).catch((function(t){return a.handleFragLoadError(t)}))},L.doFragPartsLoad=function(t,e,r,n){var i=this;return new Promise((function(a,s){var o=[];!function r(l){var c=e[l];i.fragmentLoader.loadPart(t,c,n).then((function(n){o[c.index]=n;var s=n.part;i.hls.trigger(u.Events.FRAG_LOADED,n);var d=e[l+1];if(!d||d.fragment!==t)return a({frag:t,part:s,partsLoaded:o});r(l+1)})).catch(s)}(r)}))},L.handleFragLoadError=function(t){var e=t.data;return e&&e.details===l.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(u.Events.ERROR,e),null},L._handleTransmuxerFlush=function(t){var e=this.getCurrentContext(t);if(e&&this.state===_.PARSING){var r=e.frag,n=e.part,i=e.level,a=self.performance.now();r.stats.parsing.end=a,n&&(n.stats.parsing.end=a),this.updateLevelTiming(r,n,i,t.partial)}else this.fragCurrent||(this.state=_.IDLE)},L.getCurrentContext=function(t){var e=this.levels,r=t.level,n=t.sn,i=t.part;if(!e||!e[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=e[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(t,e,r,n){if(t&&this.state===_.PARSING){var i=t.data1,a=t.data2,s=i;if(i&&a&&(s=Object(f.appendUint8Array)(i,a)),s&&s.length){var o={type:t.type,frag:e,part:r,chunkMeta:n,parent:e.type,data:s};this.hls.trigger(u.Events.BUFFER_APPENDING,o),t.dropped&&t.independent&&!r&&this.flushBufferGap(e)}}},L.flushBufferGap=function(t){var e=this.media;if(e)if(s.BufferHelper.isBuffered(e,e.currentTime)){var r=e.currentTime,n=s.BufferHelper.bufferInfo(e,r,0),i=t.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),o=Math.max(Math.min(t.start-a,n.end-a),r+a);t.start-o>a&&this.flushMainBuffer(o,t.start)}else this.flushMainBuffer(0,t.start)},L.reduceMaxBufferLength=function(t){var e=this.config,r=t||e.maxBufferLength;return e.maxMaxBufferLength>=r&&(e.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+e.maxMaxBufferLength+"s"),!0)},L.getNextFragment=function(t,e){var r=e.fragments,n=r.length;if(!n)return null;var i,a=this.config,s=r[0].start;if(!e.initSegment||e.initSegment.data||this.bitrateTest)if(e.live){var o=a.initialLiveManifestSize;if(n<o)return this.warn("Not enough fragments to start playback (have: "+n+", need: "+o+")"),null;e.PTSKnown||this.startFragRequested||-1!==this.startPosition||(i=this.getInitialLiveFragment(e,r),this.startPosition=i?this.hls.liveSyncPosition||i.start:t)}else t<=s&&(i=r[0]);else i=e.initSegment;if(!i){var u=a.lowLatencyMode?e.partEnd:e.fragmentEnd;i=this.getFragmentAtPosition(t,u,e)}return i},L.getNextPart=function(t,e,r){for(var n=-1,i=!1,a=!0,s=0,o=t.length;s<o;s++){var u=t[s];if(a=a&&!u.independent,n>-1&&r<u.start)break;var l=u.loaded;!l&&(i||u.independent||a)&&u.fragment===e&&(n=s),i=l}return n},L.loadedEndOfParts=function(t,e){var r=t[t.length-1];return r&&e>r.start&&r.loaded},L.getInitialLiveFragment=function(t,e){var r=this.fragPrevious,n=null;if(r){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),n=Object(p.findFragmentByPDT)(e,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){var i=r.sn+1;if(i>=t.startSN&&i<=t.endSN){var a=e[i-t.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)(e,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?t.fragmentEnd:t.edge,t))}return n},L.getFragmentAtPosition=function(t,e,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),t<e){var f=t>e-c?0:c;n=Object(p.findFragmentByPTS)(s,o,t,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(t){var e=this.config,r=this.media;if(r){var n=this.hls.liveSyncPosition,i=r.currentTime,a=t.fragments[0].start,s=t.edge,o=i>=a-e.maxFragLookUpTolerance&&i<=s;if(null!==n&&r.duration>n&&(i<n||!o)){var u=void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:e.liveMaxLatencyDurationCount*t.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(t,e){var r=this.levels,i=this.levelLastLoaded,a=null!==i?r[i]:null,s=0;return e&&t.fragments.length>0?(s=t.fragments[0].start,t.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,t))):(this.log("Live playlist - first load, unknown sliding"),Object(h.alignStream)(this.fragPrevious,a,t)),s},L.waitForCdnTuneIn=function(t){return t.live&&t.canBlockReload&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)},L.setStartPosition=function(t,e){var r=this.startPosition;if(-1===this.startPosition||-1===this.lastCurrentTime){var i=t.startTimeOffset;Object(n.isFiniteNumber)(i)?(i<0&&(this.log("Negative start time offset "+i+", count from end of last fragment"),i=e+t.totalduration+i),this.log("Start time offset found in playlist, adjust startPosition to "+i),this.startPosition=r=i):t.live?r=this.hls.liveSyncPosition||e:this.startPosition=r=0,this.lastCurrentTime=r}this.nextLoadPosition=r},L.getLoadPosition=function(){var t=this.media,e=0;return this.loadedmetadata?e=t.currentTime:this.nextLoadPosition&&(e=this.nextLoadPosition),e},L.handleFragLoadAborted=function(t,e){this.transmuxer&&"initSegment"!==t.sn&&(this.warn("Fragment "+t.sn+(e?" part"+e.index:"")+" of level "+t.level+" was aborted"),this.resetFragmentLoading(t))},L.resetFragmentLoading=function(t){this.fragCurrent&&this.fragContextChanged(t)||(this.state=_.IDLE)},L.onFragmentOrKeyLoadError=function(t,e){if(!e.fatal){var r=e.frag;if(r&&r.type===t){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 "+t+" "+r.level+" failed to load, retrying in "+a+"ms"),this.retryDate=self.performance.now()+a,this.fragLoadError++,this.state=_.FRAG_LOADING_WAITING_RETRY}else e.levelRetry?(t===y.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=_.IDLE):(o.logger.error(e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.hls.stopLoad(),this.state=_.ERROR)}}},L.afterBufferFlushed=function(t,e,r){if(t){var n=s.BufferHelper.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,n,r),this.state===_.ENDED&&this.resetLoadingState()}},L.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=_.IDLE},L.resetLiveStartWhenNotLoaded=function(t){if(!this.loadedmetadata){this.startFragRequested=!1;var e=this.levels?this.levels[t].details:null;if(null!=e&&e.live)return this.startPosition=-1,this.setStartPosition(e,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},L.updateLevelTiming=function(t,e,r,n){var i=this,a=r.details;console.assert(!!a,"level.details must be defined"),Object.keys(t.elementaryStreams).reduce((function(e,s){var o=t.elementaryStreams[s];if(o){var l=o.endPTS-o.startPTS;if(l<=0)return i.warn("Could not parse fragment "+t.sn+" "+s+" duration reliably ("+l+") resetting transmuxer to fallback to playlist timing"),i.resetTransmuxer(),e||!1;var d=n?0:c.updateFragPTSDTS(a,t,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:t,start:o.startPTS,end:o.endPTS}),!0}return e}),!1)?(this.state=_.PARSED,this.hls.trigger(u.Events.FRAG_PARSED,{frag:t,part:e})):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(t){var e=this._state;e!==t&&(this._state=t,this.log(e+"->"+t))}}])&&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"),l=r(/*! ../events */"./src/events.ts"),u=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(l.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,l=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&&!l.len){var u=e.maxFragLookUpTolerance,c=t.start-u,d=t.start+t.duration+u;(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||l.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(l.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(l.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(l.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(l.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(l.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 u=e.stats;t.state=T.IDLE,t.fragLoadError=0,o.data=new Uint8Array(r.payload),u.parsing.start=u.buffering.start=self.performance.now(),u.parsing.end=u.buffering.end=self.performance.now(),r.frag===n&&i.trigger(l.Events.FRAG_BUFFERED,{stats:u,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 u=s[o];return this.log("Loading part sn: "+e.sn+" p: "+u.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=u.start+u.duration,this.state=T.FRAG_LOADING,this.hls.trigger(l.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(l.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(u){var c=t[u];i.fragmentLoader.loadPart(e,c,n).then((function(n){o[c.index]=n;var s=n.part;i.hls.trigger(l.Events.FRAG_LOADED,n);var d=t[u+1];if(!d||d.fragment!==e)return a({frag:e,part:s,partsLoaded:o});r(u+1)})).catch(s)}(r)}))},L.handleFragLoadError=function(e){var t=e.data;return t&&t.details===u.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(l.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(l.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 l=a.lowLatencyMode?t.partEnd:t.fragmentEnd;i=this.getFragmentAtPosition(e,l,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 l=e[s];if(a=a&&!l.independent,n>-1&&r<l.start)break;var u=l.loaded;!u&&(i||l.independent||a)&&l.fragment===t&&(n=s),i=u}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,l=r.endSN,u=r.fragmentHint,c=i.maxFragLookUpTolerance,d=!!(i.lowLatencyMode&&r.partList&&u);if(d&&u&&!this.bitrateTest&&(o=o.concat(u),l=u.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<l&&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 l=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!o&&r.readyState<4||i<s-l)&&(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 u=o.endPTS-o.startPTS;if(u<=0)return i.warn("Could not parse fragment "+e.sn+" "+s+" duration reliably ("+u+") 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(l.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(l.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":
52
52
  /*!*********************************************!*\
53
53
  !*** ./src/controller/buffer-controller.ts ***!
54
54
  \*********************************************/
55
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return h}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ../errors */"./src/errors.ts"),o=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),u=r(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),l=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),c=r(/*! ./buffer-operation-queue */"./src/controller/buffer-operation-queue.ts"),d=Object(u.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,h=function(){function t(t){var e=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var t=e.hls,r=e.media,n=e.mediaSource;a.logger.log("[buffer-controller]: Media source opened"),r&&(e.updateMediaElementDuration(),t.trigger(i.Events.MEDIA_ATTACHED,{media:r})),n&&n.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){a.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){a.logger.log("[buffer-controller]: Media source ended")},this.hls=t,this._initSourceBuffer(),this.registerListeners()}var e=t.prototype;return e.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},e.destroy=function(){this.unregisterListeners(),this.details=null},e.registerListeners=function(){var t=this.hls;t.on(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(i.Events.BUFFER_RESET,this.onBufferReset,this),t.on(i.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.on(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(i.Events.BUFFER_EOS,this.onBufferEos,this),t.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(i.Events.FRAG_PARSED,this.onFragParsed,this),t.on(i.Events.FRAG_CHANGED,this.onFragChanged,this)},e.unregisterListeners=function(){var t=this.hls;t.off(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(i.Events.BUFFER_RESET,this.onBufferReset,this),t.off(i.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.off(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(i.Events.BUFFER_EOS,this.onBufferEos,this),t.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(i.Events.FRAG_PARSED,this.onFragParsed,this),t.off(i.Events.FRAG_CHANGED,this.onFragChanged,this)},e._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new c.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},e.onManifestParsed=function(t,e){var r=2;(e.audio&&!e.video||!e.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.details=null,a.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},e.onMediaAttaching=function(t,e){var r=this.media=e.media;if(r&&d){var n=this.mediaSource=new d;n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),r.src=self.URL.createObjectURL(n),this._objectUrl=r.src}},e.onMediaDetaching=function(){var t=this.media,e=this.mediaSource,r=this._objectUrl;if(e){if(a.logger.log("[buffer-controller]: media source detaching"),"open"===e.readyState)try{e.endOfStream()}catch(t){a.logger.warn("[buffer-controller]: onMediaDetaching: "+t.message+" while calling endOfStream")}this.onBufferReset(),e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),t&&(r&&self.URL.revokeObjectURL(r),t.src===r?(t.removeAttribute("src"),t.load()):a.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(i.Events.MEDIA_DETACHED,void 0)},e.onBufferReset=function(){var t=this,e=this.sourceBuffer;this.getSourceBufferTypes().forEach((function(r){var n=e[r];try{n&&(t.removeBufferListeners(r),t.mediaSource&&t.mediaSource.removeSourceBuffer(n),e[r]=void 0)}catch(t){a.logger.warn("[buffer-controller]: Failed to reset the "+r+" buffer",t)}})),this._initSourceBuffer()},e.onBufferCodecs=function(t,e){var r=this,n=Object.keys(this.sourceBuffer).length;Object.keys(e).forEach((function(t){if(n){var i=r.tracks[t];if(i&&"function"==typeof i.buffer.changeType){var a=e[t],s=a.codec,o=a.levelCodec,u=a.container;if((i.levelCodec||i.codec).replace(f,"$1")!==(o||s).replace(f,"$1")){var l=u+";codecs="+(o||s);r.appendChangeType(t,l)}}}else r.pendingTracks[t]=e[t]})),n||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},e.appendChangeType=function(t,e){var r=this,n=this.operationQueue,i={execute:function(){var i=r.sourceBuffer[t];i&&(a.logger.log("[buffer-controller]: changing "+t+" sourceBuffer type to "+e),i.changeType(e)),n.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(e){a.logger.warn("[buffer-controller]: Failed to change "+t+" SourceBuffer type",e)}};n.append(i,t)},e.onBufferAppending=function(t,e){var r=this,n=this.hls,u=this.operationQueue,l=this.tracks,c=e.data,d=e.type,f=e.frag,h=e.part,p=e.chunkMeta,v=p.buffering[d],g=self.performance.now();v.start=g;var m=f.stats.buffering,y=h?h.stats.buffering:null;0===m.start&&(m.start=g),y&&0===y.start&&(y.start=g);var E=l.audio,T="audio"===d&&1===p.id&&"audio/mpeg"===(null==E?void 0:E.container),_={execute:function(){if(v.executeStart=self.performance.now(),T){var t=r.sourceBuffer[d];if(t){var e=f.start-t.timestampOffset;Math.abs(e)>=.1&&(a.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+e+") sn: "+f.sn+")"),t.timestampOffset=f.start)}}r.appendExecutor(c,d)},onStart:function(){},onComplete:function(){var t=self.performance.now();v.executeEnd=v.end=t,0===m.first&&(m.first=t),y&&0===y.first&&(y.first=t);var e=r.sourceBuffer,n={};for(var a in e)n[a]=o.BufferHelper.getBuffered(e[a]);r.appendError=0,r.hls.trigger(i.Events.BUFFER_APPENDED,{type:d,frag:f,part:h,chunkMeta:p,parent:f.type,timeRanges:n})},onError:function(t){a.logger.error("[buffer-controller]: Error encountered while trying to append to the "+d+" SourceBuffer",t);var e={type:s.ErrorTypes.MEDIA_ERROR,parent:f.type,details:s.ErrorDetails.BUFFER_APPEND_ERROR,err:t,fatal:!1};t.code===DOMException.QUOTA_EXCEEDED_ERR?e.details=s.ErrorDetails.BUFFER_FULL_ERROR:(r.appendError++,e.details=s.ErrorDetails.BUFFER_APPEND_ERROR,r.appendError>n.config.appendErrorMaxRetry&&(a.logger.error("[buffer-controller]: Failed "+n.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),e.fatal=!0)),n.trigger(i.Events.ERROR,e)}};u.append(_,d)},e.onBufferFlushing=function(t,e){var r=this,n=this.operationQueue,s=function(t){return{execute:r.removeExecutor.bind(r,t,e.startOffset,e.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(i.Events.BUFFER_FLUSHED,{type:t})},onError:function(e){a.logger.warn("[buffer-controller]: Failed to remove from "+t+" SourceBuffer",e)}}};e.type?n.append(s(e.type),e.type):(n.append(s("audio"),"audio"),n.append(s("video"),"video"))},e.onFragParsed=function(t,e){var r=this,n=e.frag,s=e.part,o=[],u=s?s.elementaryStreams:n.elementaryStreams;u[l.ElementaryStreamTypes.AUDIOVIDEO]?o.push("audiovideo"):(u[l.ElementaryStreamTypes.AUDIO]&&o.push("audio"),u[l.ElementaryStreamTypes.VIDEO]&&o.push("video")),0===o.length&&a.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+n.type+" level: "+n.level+" sn: "+n.sn),this.blockBuffers((function(){var t=self.performance.now();n.stats.buffering.end=t,s&&(s.stats.buffering.end=t);var e=s?s.stats:n.stats;r.hls.trigger(i.Events.FRAG_BUFFERED,{frag:n,part:s,stats:e,id:n.type})}),o)},e.onFragChanged=function(t,e){this.flushBackBuffer()},e.onBufferEos=function(t,e){var r=this;this.getSourceBufferTypes().reduce((function(t,n){var i=r.sourceBuffer[n];return e.type&&e.type!==n||i&&!i.ended&&(i.ended=!0,a.logger.log("[buffer-controller]: "+n+" sourceBuffer now EOS")),t&&!(i&&!i.ended)}),!0)&&this.blockBuffers((function(){var t=r.mediaSource;t&&"open"===t.readyState&&t.endOfStream()}))},e.onLevelUpdated=function(t,e){var r=e.details;r.fragments.length&&(this.details=r,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},e.flushBackBuffer=function(){var t=this.hls,e=this.details,r=this.media,a=this.sourceBuffer;if(r&&null!==e){var s=this.getSourceBufferTypes();if(s.length){var u=e.live&&null!==t.config.liveBackBufferLength?t.config.liveBackBufferLength:t.config.backBufferLength;if(Object(n.isFiniteNumber)(u)&&!(u<0)){var l=r.currentTime,c=e.levelTargetDuration,d=Math.max(u,c),f=Math.floor(l/c)*c-d;s.forEach((function(r){var n=a[r];if(n){var s=o.BufferHelper.getBuffered(n);s.length>0&&f>s.start(0)&&(t.trigger(i.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),e.live&&t.trigger(i.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),t.trigger(i.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:r}))}}))}}}},e.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var t=this.details,e=this.hls,r=this.media,i=this.mediaSource,s=t.fragments[0].start+t.totalduration,o=r.duration,u=Object(n.isFiniteNumber)(i.duration)?i.duration:0;t.live&&e.config.liveDurationInfinity?(a.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(t)):(s>u&&s>o||!Object(n.isFiniteNumber)(o))&&(a.logger.log("[buffer-controller]: Updating Media Source duration to "+s.toFixed(3)),i.duration=s)}},e.updateSeekableRange=function(t){var e=this.mediaSource,r=t.fragments;if(r.length&&t.live&&null!=e&&e.setLiveSeekableRange){var n=Math.max(0,r[0].start),i=Math.max(n,n+t.totalduration);e.setLiveSeekableRange(n,i)}},e.checkPendingTracks=function(){var t=this.bufferCodecEventsExpected,e=this.operationQueue,r=this.pendingTracks,n=Object.keys(r).length;if(n&&!t||2===n){this.createSourceBuffers(r),this.pendingTracks={};var a=Object.keys(this.sourceBuffer);if(0===a.length)return void this.hls.trigger(i.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});a.forEach((function(t){e.executeNext(t)}))}},e.createSourceBuffers=function(t){var e=this.sourceBuffer,r=this.mediaSource;if(!r)throw Error("createSourceBuffers called when mediaSource was null");var n=0;for(var o in t)if(!e[o]){var u=t[o];if(!u)throw Error("source buffer exists for track "+o+", however track does not");var l=u.levelCodec||u.codec,c=u.container+";codecs="+l;a.logger.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var d=e[o]=r.addSourceBuffer(c),f=o;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[o]={buffer:d,codec:l,container:u.container,levelCodec:u.levelCodec,id:u.id},n++}catch(t){a.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+t.message),this.hls.trigger(i.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,mimeType:c})}}n&&this.hls.trigger(i.Events.BUFFER_CREATED,{tracks:this.tracks})},e._onSBUpdateStart=function(t){this.operationQueue.current(t).onStart()},e._onSBUpdateEnd=function(t){var e=this.operationQueue;e.current(t).onComplete(),e.shiftAndExecuteNext(t)},e._onSBUpdateError=function(t,e){a.logger.error("[buffer-controller]: "+t+" SourceBuffer error",e),this.hls.trigger(i.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var r=this.operationQueue.current(t);r&&r.onError(e)},e.removeExecutor=function(t,e,r){var i=this.media,s=this.mediaSource,o=this.operationQueue,u=this.sourceBuffer[t];if(!i||!s||!u)return a.logger.warn("[buffer-controller]: Attempting to remove from the "+t+" SourceBuffer, but it does not exist"),void o.shiftAndExecuteNext(t);var l=Object(n.isFiniteNumber)(i.duration)?i.duration:1/0,c=Object(n.isFiniteNumber)(s.duration)?s.duration:1/0,d=Math.max(0,e),f=Math.min(r,l,c);f>d?(a.logger.log("[buffer-controller]: Removing ["+d+","+f+"] from the "+t+" SourceBuffer"),console.assert(!u.updating,t+" sourceBuffer must not be updating"),u.remove(d,f)):o.shiftAndExecuteNext(t)},e.appendExecutor=function(t,e){var r=this.operationQueue,n=this.sourceBuffer[e];if(!n)return a.logger.warn("[buffer-controller]: Attempting to append to the "+e+" SourceBuffer, but it does not exist"),void r.shiftAndExecuteNext(e);n.ended=!1,console.assert(!n.updating,e+" sourceBuffer must not be updating"),n.appendBuffer(t)},e.blockBuffers=function(t,e){var r=this;if(void 0===e&&(e=this.getSourceBufferTypes()),e.length){var n=this.operationQueue,i=e.map((function(t){return n.appendBlocker(t)}));Promise.all(i).then((function(){t(),e.forEach((function(t){var e=r.sourceBuffer[t];e&&e.updating||n.shiftAndExecuteNext(t)}))}))}else a.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist")},e.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},e.addBufferListener=function(t,e,r){var n=this.sourceBuffer[t];if(n){var i=r.bind(this,t);this.listeners[t].push({event:e,listener:i}),n.addEventListener(e,i)}},e.removeBufferListeners=function(t){var e=this.sourceBuffer[t];e&&this.listeners[t].forEach((function(t){e.removeEventListener(t.event,t.listener)}))},t}()},"./src/controller/buffer-operation-queue.ts":
55
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return h}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ../errors */"./src/errors.ts"),o=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),l=r(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),u=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),c=r(/*! ./buffer-operation-queue */"./src/controller/buffer-operation-queue.ts"),d=Object(l.getMediaSource)(),f=/([ha]vc.)(?:\.[^.,]+)+/,h=function(){function e(e){var t=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var e=t.hls,r=t.media,n=t.mediaSource;a.logger.log("[buffer-controller]: Media source opened"),r&&(t.updateMediaElementDuration(),e.trigger(i.Events.MEDIA_ATTACHED,{media:r})),n&&n.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){a.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){a.logger.log("[buffer-controller]: Media source ended")},this.hls=e,this._initSourceBuffer(),this.registerListeners()}var t=e.prototype;return t.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},t.destroy=function(){this.unregisterListeners(),this.details=null},t.registerListeners=function(){var e=this.hls;e.on(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(i.Events.BUFFER_RESET,this.onBufferReset,this),e.on(i.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.on(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(i.Events.BUFFER_EOS,this.onBufferEos,this),e.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(i.Events.FRAG_PARSED,this.onFragParsed,this),e.on(i.Events.FRAG_CHANGED,this.onFragChanged,this)},t.unregisterListeners=function(){var e=this.hls;e.off(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(i.Events.BUFFER_RESET,this.onBufferReset,this),e.off(i.Events.BUFFER_APPENDING,this.onBufferAppending,this),e.off(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(i.Events.BUFFER_EOS,this.onBufferEos,this),e.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(i.Events.FRAG_PARSED,this.onFragParsed,this),e.off(i.Events.FRAG_CHANGED,this.onFragChanged,this)},t._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new c.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},t.onManifestParsed=function(e,t){var r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.details=null,a.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},t.onMediaAttaching=function(e,t){var r=this.media=t.media;if(r&&d){var n=this.mediaSource=new d;n.addEventListener("sourceopen",this._onMediaSourceOpen),n.addEventListener("sourceended",this._onMediaSourceEnded),n.addEventListener("sourceclose",this._onMediaSourceClose),r.src=self.URL.createObjectURL(n),this._objectUrl=r.src}},t.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,r=this._objectUrl;if(t){if(a.logger.log("[buffer-controller]: media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){a.logger.warn("[buffer-controller]: onMediaDetaching: "+e.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),e&&(r&&self.URL.revokeObjectURL(r),e.src===r?(e.removeAttribute("src"),e.load()):a.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(i.Events.MEDIA_DETACHED,void 0)},t.onBufferReset=function(){var e=this,t=this.sourceBuffer;this.getSourceBufferTypes().forEach((function(r){var n=t[r];try{n&&(e.removeBufferListeners(r),e.mediaSource&&e.mediaSource.removeSourceBuffer(n),t[r]=void 0)}catch(e){a.logger.warn("[buffer-controller]: Failed to reset the "+r+" buffer",e)}})),this._initSourceBuffer()},t.onBufferCodecs=function(e,t){var r=this,n=Object.keys(this.sourceBuffer).length;Object.keys(t).forEach((function(e){if(n){var i=r.tracks[e];if(i&&"function"==typeof i.buffer.changeType){var a=t[e],s=a.codec,o=a.levelCodec,l=a.container;if((i.levelCodec||i.codec).replace(f,"$1")!==(o||s).replace(f,"$1")){var u=l+";codecs="+(o||s);r.appendChangeType(e,u)}}}else r.pendingTracks[e]=t[e]})),n||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},t.appendChangeType=function(e,t){var r=this,n=this.operationQueue,i={execute:function(){var i=r.sourceBuffer[e];i&&(a.logger.log("[buffer-controller]: changing "+e+" sourceBuffer type to "+t),i.changeType(t)),n.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){a.logger.warn("[buffer-controller]: Failed to change "+e+" SourceBuffer type",t)}};n.append(i,e)},t.onBufferAppending=function(e,t){var r=this,n=this.hls,l=this.operationQueue,u=this.tracks,c=t.data,d=t.type,f=t.frag,h=t.part,p=t.chunkMeta,v=p.buffering[d],g=self.performance.now();v.start=g;var m=f.stats.buffering,y=h?h.stats.buffering:null;0===m.start&&(m.start=g),y&&0===y.start&&(y.start=g);var E=u.audio,_="audio"===d&&1===p.id&&"audio/mpeg"===(null==E?void 0:E.container),T={execute:function(){if(v.executeStart=self.performance.now(),_){var e=r.sourceBuffer[d];if(e){var t=f.start-e.timestampOffset;Math.abs(t)>=.1&&(a.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+t+") sn: "+f.sn+")"),e.timestampOffset=f.start)}}r.appendExecutor(c,d)},onStart:function(){},onComplete:function(){var e=self.performance.now();v.executeEnd=v.end=e,0===m.first&&(m.first=e),y&&0===y.first&&(y.first=e);var t=r.sourceBuffer,n={};for(var a in t)n[a]=o.BufferHelper.getBuffered(t[a]);r.appendError=0,r.hls.trigger(i.Events.BUFFER_APPENDED,{type:d,frag:f,part:h,chunkMeta:p,parent:f.type,timeRanges:n})},onError:function(e){a.logger.error("[buffer-controller]: Error encountered while trying to append to the "+d+" SourceBuffer",e);var t={type:s.ErrorTypes.MEDIA_ERROR,parent:f.type,details:s.ErrorDetails.BUFFER_APPEND_ERROR,err:e,fatal:!1};e.code===DOMException.QUOTA_EXCEEDED_ERR?t.details=s.ErrorDetails.BUFFER_FULL_ERROR:(r.appendError++,t.details=s.ErrorDetails.BUFFER_APPEND_ERROR,r.appendError>n.config.appendErrorMaxRetry&&(a.logger.error("[buffer-controller]: Failed "+n.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),t.fatal=!0)),n.trigger(i.Events.ERROR,t)}};l.append(T,d)},t.onBufferFlushing=function(e,t){var r=this,n=this.operationQueue,s=function(e){return{execute:r.removeExecutor.bind(r,e,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(i.Events.BUFFER_FLUSHED,{type:e})},onError:function(t){a.logger.warn("[buffer-controller]: Failed to remove from "+e+" SourceBuffer",t)}}};t.type?n.append(s(t.type),t.type):(n.append(s("audio"),"audio"),n.append(s("video"),"video"))},t.onFragParsed=function(e,t){var r=this,n=t.frag,s=t.part,o=[],l=s?s.elementaryStreams:n.elementaryStreams;l[u.ElementaryStreamTypes.AUDIOVIDEO]?o.push("audiovideo"):(l[u.ElementaryStreamTypes.AUDIO]&&o.push("audio"),l[u.ElementaryStreamTypes.VIDEO]&&o.push("video")),0===o.length&&a.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+n.type+" level: "+n.level+" sn: "+n.sn),this.blockBuffers((function(){var e=self.performance.now();n.stats.buffering.end=e,s&&(s.stats.buffering.end=e);var t=s?s.stats:n.stats;r.hls.trigger(i.Events.FRAG_BUFFERED,{frag:n,part:s,stats:t,id:n.type})}),o)},t.onFragChanged=function(e,t){this.flushBackBuffer()},t.onBufferEos=function(e,t){var r=this;this.getSourceBufferTypes().reduce((function(e,n){var i=r.sourceBuffer[n];return t.type&&t.type!==n||i&&!i.ended&&(i.ended=!0,a.logger.log("[buffer-controller]: "+n+" sourceBuffer now EOS")),e&&!(i&&!i.ended)}),!0)&&this.blockBuffers((function(){var e=r.mediaSource;e&&"open"===e.readyState&&e.endOfStream()}))},t.onLevelUpdated=function(e,t){var r=t.details;r.fragments.length&&(this.details=r,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},t.flushBackBuffer=function(){var e=this.hls,t=this.details,r=this.media,a=this.sourceBuffer;if(r&&null!==t){var s=this.getSourceBufferTypes();if(s.length){var l=t.live&&null!==e.config.liveBackBufferLength?e.config.liveBackBufferLength:e.config.backBufferLength;if(Object(n.isFiniteNumber)(l)&&!(l<0)){var u=r.currentTime,c=t.levelTargetDuration,d=Math.max(l,c),f=Math.floor(u/c)*c-d;s.forEach((function(r){var n=a[r];if(n){var s=o.BufferHelper.getBuffered(n);s.length>0&&f>s.start(0)&&(e.trigger(i.Events.BACK_BUFFER_REACHED,{bufferEnd:f}),t.live&&e.trigger(i.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:f}),e.trigger(i.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:f,type:r}))}}))}}}},t.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var e=this.details,t=this.hls,r=this.media,i=this.mediaSource,s=e.fragments[0].start+e.totalduration,o=r.duration,l=Object(n.isFiniteNumber)(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(a.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(e)):(s>l&&s>o||!Object(n.isFiniteNumber)(o))&&(a.logger.log("[buffer-controller]: Updating Media Source duration to "+s.toFixed(3)),i.duration=s)}},t.updateSeekableRange=function(e){var t=this.mediaSource,r=e.fragments;if(r.length&&e.live&&null!=t&&t.setLiveSeekableRange){var n=Math.max(0,r[0].start),i=Math.max(n,n+e.totalduration);t.setLiveSeekableRange(n,i)}},t.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,r=this.pendingTracks,n=Object.keys(r).length;if(n&&!e||2===n){this.createSourceBuffers(r),this.pendingTracks={};var a=Object.keys(this.sourceBuffer);if(0===a.length)return void this.hls.trigger(i.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});a.forEach((function(e){t.executeNext(e)}))}},t.createSourceBuffers=function(e){var t=this.sourceBuffer,r=this.mediaSource;if(!r)throw Error("createSourceBuffers called when mediaSource was null");var n=0;for(var o in e)if(!t[o]){var l=e[o];if(!l)throw Error("source buffer exists for track "+o+", however track does not");var u=l.levelCodec||l.codec,c=l.container+";codecs="+u;a.logger.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var d=t[o]=r.addSourceBuffer(c),f=o;this.addBufferListener(f,"updatestart",this._onSBUpdateStart),this.addBufferListener(f,"updateend",this._onSBUpdateEnd),this.addBufferListener(f,"error",this._onSBUpdateError),this.tracks[o]={buffer:d,codec:u,container:l.container,levelCodec:l.levelCodec,id:l.id},n++}catch(e){a.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+e.message),this.hls.trigger(i.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,mimeType:c})}}n&&this.hls.trigger(i.Events.BUFFER_CREATED,{tracks:this.tracks})},t._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},t._onSBUpdateEnd=function(e){var t=this.operationQueue;t.current(e).onComplete(),t.shiftAndExecuteNext(e)},t._onSBUpdateError=function(e,t){a.logger.error("[buffer-controller]: "+e+" SourceBuffer error",t),this.hls.trigger(i.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var r=this.operationQueue.current(e);r&&r.onError(t)},t.removeExecutor=function(e,t,r){var i=this.media,s=this.mediaSource,o=this.operationQueue,l=this.sourceBuffer[e];if(!i||!s||!l)return a.logger.warn("[buffer-controller]: Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void o.shiftAndExecuteNext(e);var u=Object(n.isFiniteNumber)(i.duration)?i.duration:1/0,c=Object(n.isFiniteNumber)(s.duration)?s.duration:1/0,d=Math.max(0,t),f=Math.min(r,u,c);f>d?(a.logger.log("[buffer-controller]: Removing ["+d+","+f+"] from the "+e+" SourceBuffer"),console.assert(!l.updating,e+" sourceBuffer must not be updating"),l.remove(d,f)):o.shiftAndExecuteNext(e)},t.appendExecutor=function(e,t){var r=this.operationQueue,n=this.sourceBuffer[t];if(!n)return a.logger.warn("[buffer-controller]: Attempting to append to the "+t+" SourceBuffer, but it does not exist"),void r.shiftAndExecuteNext(t);n.ended=!1,console.assert(!n.updating,t+" sourceBuffer must not be updating"),n.appendBuffer(e)},t.blockBuffers=function(e,t){var r=this;if(void 0===t&&(t=this.getSourceBufferTypes()),!t.length)return a.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve(e);var n=this.operationQueue,i=t.map((function(e){return n.appendBlocker(e)}));Promise.all(i).then((function(){e(),t.forEach((function(e){var t=r.sourceBuffer[e];t&&t.updating||n.shiftAndExecuteNext(e)}))}))},t.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},t.addBufferListener=function(e,t,r){var n=this.sourceBuffer[e];if(n){var i=r.bind(this,e);this.listeners[e].push({event:t,listener:i}),n.addEventListener(t,i)}},t.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach((function(e){t.removeEventListener(e.event,e.listener)}))},e}()},"./src/controller/buffer-operation-queue.ts":
56
56
  /*!**************************************************!*\
57
57
  !*** ./src/controller/buffer-operation-queue.ts ***!
58
58
  \**************************************************/
59
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return i}));var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=function(){function t(t){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=t}var e=t.prototype;return e.append=function(t,e){var r=this.queues[e];r.push(t),1===r.length&&this.buffers[e]&&this.executeNext(e)},e.insertAbort=function(t,e){this.queues[e].unshift(t),this.executeNext(e)},e.appendBlocker=function(t){var e,r=new Promise((function(t){e=t})),n={execute:e,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(n,t),r},e.executeNext=function(t){var e=this.buffers,r=this.queues,i=e[t],a=r[t];if(a.length){var s=a[0];try{s.execute()}catch(t){n.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),s.onError(t),i&&i.updating||a.shift()}}},e.shiftAndExecuteNext=function(t){this.queues[t].shift(),this.executeNext(t)},e.current=function(t){return this.queues[t][0]},t}()},"./src/controller/cap-level-controller.ts":
59
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return i}));var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=function(){function e(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var t=e.prototype;return t.append=function(e,t){var r=this.queues[t];r.push(e),1===r.length&&this.buffers[t]&&this.executeNext(t)},t.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},t.appendBlocker=function(e){var t,r=new Promise((function(e){t=e})),n={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(n,e),r},t.executeNext=function(e){var t=this.buffers,r=this.queues,i=t[e],a=r[e];if(a.length){var s=a[0];try{s.execute()}catch(e){n.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),s.onError(e),i&&i.updating||a.shift()}}},t.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},t.current=function(e){return this.queues[e][0]},e}()},"./src/controller/cap-level-controller.ts":
60
60
  /*!************************************************!*\
61
61
  !*** ./src/controller/cap-level-controller.ts ***!
62
62
  \************************************************/
63
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ../events */"./src/events.ts");function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=function(){function t(t){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var e,r,a,s=t.prototype;return s.setStreamController=function(t){this.streamController=t},s.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},s.registerListeners=function(){var t=this.hls;t.on(n.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},s.unregisterListener=function(){var t=this.hls;t.off(n.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},s.onFpsDropLevelCapping=function(e,r){t.isLevelAllowed(r.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(r.droppedLevel)},s.onMediaAttaching=function(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null},s.onManifestParsed=function(t,e){var r=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,r.config.capLevelToPlayerSize&&e.video&&this.startCapping()},s.onBufferCodecs=function(t,e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()},s.onMediaDetaching=function(){this.stopCapping()},s.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var t=this.hls.levels;if(t.length){var e=this.hls;e.autoLevelCapping=this.getMaxLevel(t.length-1),e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}},s.getMaxLevel=function(e){var r=this,n=this.hls.levels;if(!n.length)return-1;var i=n.filter((function(n,i){return t.isLevelAllowed(i,r.restrictedLevels)&&i<=e}));return this.clientRect=null,t.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)},s.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},s.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},s.getDimensions=function(){if(this.clientRect)return this.clientRect;var t=this.media,e={width:0,height:0};if(t){var r=t.getBoundingClientRect();e.width=r.width,e.height=r.height,e.width||e.height||(e.width=r.right-r.left||t.width||0,e.height=r.bottom-r.top||t.height||0)}return this.clientRect=e,e},t.isLevelAllowed=function(t,e){return void 0===e&&(e=[]),-1===e.indexOf(t)},t.getMaxLevelByMediaSize=function(t,e,r){if(!t||!t.length)return-1;for(var n,i,a=t.length-1,s=0;s<t.length;s+=1){var o=t[s];if((o.width>=e||o.height>=r)&&(n=o,!(i=t[s+1])||n.width!==i.width||n.height!==i.height)){a=s;break}}return a},e=t,a=[{key:"contentScaleFactor",get:function(){var t=1;try{t=self.devicePixelRatio}catch(t){}return t}}],(r=[{key:"mediaWidth",get:function(){return this.getDimensions().width*t.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*t.contentScaleFactor}}])&&i(e.prototype,r),a&&i(e,a),t}();e.default=a},"./src/controller/eme-controller.ts":
63
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../events */"./src/events.ts");function i(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 a=function(){function e(e){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var t,r,a,s=e.prototype;return s.setStreamController=function(e){this.streamController=e},s.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},s.registerListeners=function(){var e=this.hls;e.on(n.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},s.unregisterListener=function(){var e=this.hls;e.off(n.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},s.onFpsDropLevelCapping=function(t,r){e.isLevelAllowed(r.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(r.droppedLevel)},s.onMediaAttaching=function(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null},s.onManifestParsed=function(e,t){var r=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,r.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onBufferCodecs=function(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()},s.onMediaDetaching=function(){this.stopCapping()},s.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var e=this.hls.levels;if(e.length){var t=this.hls;t.autoLevelCapping=this.getMaxLevel(e.length-1),t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},s.getMaxLevel=function(t){var r=this,n=this.hls.levels;if(!n.length)return-1;var i=n.filter((function(n,i){return e.isLevelAllowed(i,r.restrictedLevels)&&i<=t}));return this.clientRect=null,e.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)},s.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},s.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},s.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,t.width||t.height||(t.width=r.right-r.left||e.width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t},e.isLevelAllowed=function(e,t){return void 0===t&&(t=[]),-1===t.indexOf(e)},e.getMaxLevelByMediaSize=function(e,t,r){if(!e||!e.length)return-1;for(var n,i,a=e.length-1,s=0;s<e.length;s+=1){var o=e[s];if((o.width>=t||o.height>=r)&&(n=o,!(i=e[s+1])||n.width!==i.width||n.height!==i.height)){a=s;break}}return a},t=e,a=[{key:"contentScaleFactor",get:function(){var e=1;try{e=self.devicePixelRatio}catch(e){}return e}}],(r=[{key:"mediaWidth",get:function(){return this.getDimensions().width*e.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*e.contentScaleFactor}}])&&i(t.prototype,r),a&&i(t,a),e}();t.default=a},"./src/controller/eme-controller.ts":
64
64
  /*!******************************************!*\
65
65
  !*** ./src/controller/eme-controller.ts ***!
66
66
  \******************************************/
67
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ../utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts");function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var u=function(){function t(t){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=t,this._config=t.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var e,r,u,l=t.prototype;return l.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},l._registerListeners=function(){this.hls.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(n.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this)},l._unregisterListeners=function(){this.hls.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(n.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this)},l.getLicenseServerUrl=function(t){switch(t){case s.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+t+'"')},l._attemptKeySystemAccess=function(t,e,r){var n=this,i=function(t,e,r,n){switch(t){case s.KeySystems.WIDEVINE:return function(t,e,r){var n={audioCapabilities:[],videoCapabilities:[]};return t.forEach((function(t){n.audioCapabilities.push({contentType:'audio/mp4; codecs="'+t+'"',robustness:r.audioRobustness||""})})),e.forEach((function(t){n.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"',robustness:r.videoRobustness||""})})),[n]}(e,r,n);default:throw new Error("Unknown key-system: "+t)}}(t,e,r,this._drmSystemOptions);a.logger.log("Requesting encrypted media key-system access");var o=this.requestMediaKeySystemAccess(t,i);this.mediaKeysPromise=o.then((function(e){return n._onMediaKeySystemAccessObtained(t,e)})),o.catch((function(e){a.logger.error('Failed to obtain key-system "'+t+'" access:',e)}))},l._onMediaKeySystemAccessObtained=function(t,e){var r=this;a.logger.log('Access for key-system "'+t+'" obtained');var n={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:t};this._mediaKeysList.push(n);var i=Promise.resolve().then((function(){return e.createMediaKeys()})).then((function(e){return n.mediaKeys=e,a.logger.log('Media-keys created for key-system "'+t+'"'),r._onMediaKeysCreated(),e}));return i.catch((function(t){a.logger.error("Failed to create media-keys:",t)})),i},l._onMediaKeysCreated=function(){var t=this;this._mediaKeysList.forEach((function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),t._onNewMediaKeySession(e.mediaKeysSession))}))},l._onNewMediaKeySession=function(t){var e=this;a.logger.log("New key-system session "+t.sessionId),t.addEventListener("message",(function(r){e._onKeySessionMessage(t,r.message)}),!1)},l._onKeySessionMessage=function(t,e){a.logger.log("Got EME message event, creating license request"),this._requestLicense(e,(function(e){a.logger.log("Received license data (length: "+(e?e.byteLength:e)+"), updating key-session"),t.update(e)}))},l.onMediaEncrypted=function(t){var e=this;if(a.logger.log('Media is encrypted using "'+t.initDataType+'" init data type'),!this.mediaKeysPromise)return a.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});var r=function(r){e._media&&(e._attemptSetMediaKeys(r),e._generateRequestWithPreferredKeySession(t.initDataType,t.initData))};this.mediaKeysPromise.then(r).catch(r)},l._attemptSetMediaKeys=function(t){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var e=this._mediaKeysList[0];if(!e||!e.mediaKeys)return a.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});a.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},l._generateRequestWithPreferredKeySession=function(t,e){var r=this,s=this._mediaKeysList[0];if(!s)return a.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(s.mediaKeysSessionInitialized)a.logger.warn("Key-Session already initialized but requested again");else{var o=s.mediaKeysSession;if(!o)return a.logger.error("Fatal: Media is encrypted but no key-session existing"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});if(!e)return a.logger.warn("Fatal: initData required for generating a key session is null"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});a.logger.log('Generating key-session request for "'+t+'" init data type'),s.mediaKeysSessionInitialized=!0,o.generateRequest(t,e).then((function(){a.logger.debug("Key-session generation succeeded")})).catch((function(t){a.logger.error("Error generating key-session request:",t),r.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))}},l._createLicenseXhr=function(t,e,r){var n=new XMLHttpRequest;n.responseType="arraybuffer",n.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,n,t,e,r);var i=this._licenseXhrSetup;if(i)try{i.call(this.hls,n,t),i=void 0}catch(t){a.logger.error(t)}try{n.readyState||n.open("POST",t,!0),i&&i.call(this.hls,n,t)}catch(t){throw new Error("issue setting up KeySystem license XHR "+t)}return n},l._onLicenseRequestReadyStageChange=function(t,e,r,s){switch(t.readyState){case 4:if(200===t.status){this._requestLicenseFailureCount=0,a.logger.log("License request succeeded");var o=t.response,u=this._licenseResponseCallback;if(u)try{o=u.call(this.hls,t,e)}catch(t){a.logger.error(t)}s(o)}else{if(a.logger.error("License Request XHR failed ("+e+"). Status: "+t.status+" ("+t.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>3)return void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var l=3-this._requestLicenseFailureCount+1;a.logger.warn("Retrying license request, "+l+" attempts left"),this._requestLicense(r,s)}}},l._generateLicenseRequestChallenge=function(t,e){switch(t.mediaKeySystemDomain){case s.KeySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+t.mediaKeySystemDomain)},l._requestLicense=function(t,e){a.logger.log("Requesting content license for key-system");var r=this._mediaKeysList[0];if(!r)return a.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var s=this.getLicenseServerUrl(r.mediaKeySystemDomain),o=this._createLicenseXhr(s,t,e);a.logger.log("Sending license request to URL: "+s);var u=this._generateLicenseRequestChallenge(r,t);o.send(u)}catch(t){a.logger.error("Failure requesting DRM license: "+t),this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},l.onMediaAttached=function(t,e){if(this._emeEnabled){var r=e.media;this._media=r,r.addEventListener("encrypted",this._onMediaEncrypted)}},l.onMediaDetached=function(){var t=this._media,e=this._mediaKeysList;t&&(t.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(e.map((function(t){if(t.mediaKeysSession)return t.mediaKeysSession.close().catch((function(){}))}))).then((function(){return t.setMediaKeys(null)})).catch((function(){})))},l.onManifestParsed=function(t,e){if(this._emeEnabled){var r=e.levels.map((function(t){return t.audioCodec})).filter((function(t){return!!t})),n=e.levels.map((function(t){return t.videoCodec})).filter((function(t){return!!t}));this._attemptKeySystemAccess(s.KeySystems.WIDEVINE,r,n)}},e=t,(r=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&o(e.prototype,r),u&&o(e,u),t}();e.default=u},"./src/controller/fps-controller.ts":
67
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ../utils/mediakeys-helper */"./src/utils/mediakeys-helper.ts");function o(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 l=function(){function e(e){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=e,this._config=e.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var t,r,l,u=e.prototype;return u.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},u._registerListeners=function(){this.hls.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(n.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this)},u._unregisterListeners=function(){this.hls.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(n.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this)},u.getLicenseServerUrl=function(e){switch(e){case s.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+e+'"')},u._attemptKeySystemAccess=function(e,t,r){var n=this,i=function(e,t,r,n){switch(e){case s.KeySystems.WIDEVINE:return function(e,t,r){var n={audioCapabilities:[],videoCapabilities:[]};return e.forEach((function(e){n.audioCapabilities.push({contentType:'audio/mp4; codecs="'+e+'"',robustness:r.audioRobustness||""})})),t.forEach((function(e){n.videoCapabilities.push({contentType:'video/mp4; codecs="'+e+'"',robustness:r.videoRobustness||""})})),[n]}(t,r,n);default:throw new Error("Unknown key-system: "+e)}}(e,t,r,this._drmSystemOptions);a.logger.log("Requesting encrypted media key-system access");var o=this.requestMediaKeySystemAccess(e,i);this.mediaKeysPromise=o.then((function(t){return n._onMediaKeySystemAccessObtained(e,t)})),o.catch((function(t){a.logger.error('Failed to obtain key-system "'+e+'" access:',t)}))},u._onMediaKeySystemAccessObtained=function(e,t){var r=this;a.logger.log('Access for key-system "'+e+'" obtained');var n={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:t,mediaKeySystemDomain:e};this._mediaKeysList.push(n);var i=Promise.resolve().then((function(){return t.createMediaKeys()})).then((function(t){return n.mediaKeys=t,a.logger.log('Media-keys created for key-system "'+e+'"'),r._onMediaKeysCreated(),t}));return i.catch((function(e){a.logger.error("Failed to create media-keys:",e)})),i},u._onMediaKeysCreated=function(){var e=this;this._mediaKeysList.forEach((function(t){t.mediaKeysSession||(t.mediaKeysSession=t.mediaKeys.createSession(),e._onNewMediaKeySession(t.mediaKeysSession))}))},u._onNewMediaKeySession=function(e){var t=this;a.logger.log("New key-system session "+e.sessionId),e.addEventListener("message",(function(r){t._onKeySessionMessage(e,r.message)}),!1)},u._onKeySessionMessage=function(e,t){a.logger.log("Got EME message event, creating license request"),this._requestLicense(t,(function(t){a.logger.log("Received license data (length: "+(t?t.byteLength:t)+"), updating key-session"),e.update(t)}))},u.onMediaEncrypted=function(e){var t=this;if(a.logger.log('Media is encrypted using "'+e.initDataType+'" init data type'),!this.mediaKeysPromise)return a.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});var r=function(r){t._media&&(t._attemptSetMediaKeys(r),t._generateRequestWithPreferredKeySession(e.initDataType,e.initData))};this.mediaKeysPromise.then(r).catch(r)},u._attemptSetMediaKeys=function(e){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var t=this._mediaKeysList[0];if(!t||!t.mediaKeys)return a.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});a.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(t.mediaKeys),this._hasSetMediaKeys=!0}},u._generateRequestWithPreferredKeySession=function(e,t){var r=this,s=this._mediaKeysList[0];if(!s)return a.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(s.mediaKeysSessionInitialized)a.logger.warn("Key-Session already initialized but requested again");else{var o=s.mediaKeysSession;if(!o)return a.logger.error("Fatal: Media is encrypted but no key-session existing"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});if(!t)return a.logger.warn("Fatal: initData required for generating a key session is null"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});a.logger.log('Generating key-session request for "'+e+'" init data type'),s.mediaKeysSessionInitialized=!0,o.generateRequest(e,t).then((function(){a.logger.debug("Key-session generation succeeded")})).catch((function(e){a.logger.error("Error generating key-session request:",e),r.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))}},u._createLicenseXhr=function(e,t,r){var n=new XMLHttpRequest;n.responseType="arraybuffer",n.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,n,e,t,r);var i=this._licenseXhrSetup;if(i)try{i.call(this.hls,n,e),i=void 0}catch(e){a.logger.error(e)}try{n.readyState||n.open("POST",e,!0),i&&i.call(this.hls,n,e)}catch(e){throw new Error("issue setting up KeySystem license XHR "+e)}return n},u._onLicenseRequestReadyStageChange=function(e,t,r,s){switch(e.readyState){case 4:if(200===e.status){this._requestLicenseFailureCount=0,a.logger.log("License request succeeded");var o=e.response,l=this._licenseResponseCallback;if(l)try{o=l.call(this.hls,e,t)}catch(e){a.logger.error(e)}s(o)}else{if(a.logger.error("License Request XHR failed ("+t+"). Status: "+e.status+" ("+e.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>3)return void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var u=3-this._requestLicenseFailureCount+1;a.logger.warn("Retrying license request, "+u+" attempts left"),this._requestLicense(r,s)}}},u._generateLicenseRequestChallenge=function(e,t){switch(e.mediaKeySystemDomain){case s.KeySystems.WIDEVINE:return t}throw new Error("unsupported key-system: "+e.mediaKeySystemDomain)},u._requestLicense=function(e,t){a.logger.log("Requesting content license for key-system");var r=this._mediaKeysList[0];if(!r)return a.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var s=this.getLicenseServerUrl(r.mediaKeySystemDomain),o=this._createLicenseXhr(s,e,t);a.logger.log("Sending license request to URL: "+s);var l=this._generateLicenseRequestChallenge(r,e);o.send(l)}catch(e){a.logger.error("Failure requesting DRM license: "+e),this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},u.onMediaAttached=function(e,t){if(this._emeEnabled){var r=t.media;this._media=r,r.addEventListener("encrypted",this._onMediaEncrypted)}},u.onMediaDetached=function(){var e=this._media,t=this._mediaKeysList;e&&(e.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(t.map((function(e){if(e.mediaKeysSession)return e.mediaKeysSession.close().catch((function(){}))}))).then((function(){return e.setMediaKeys(null)})).catch((function(){})))},u.onManifestParsed=function(e,t){if(this._emeEnabled){var r=t.levels.map((function(e){return e.audioCodec})).filter((function(e){return!!e})),n=t.levels.map((function(e){return e.videoCodec})).filter((function(e){return!!e}));this._attemptKeySystemAccess(s.KeySystems.WIDEVINE,r,n)}},t=e,(r=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&o(t.prototype,r),l&&o(t,l),e}();t.default=l},"./src/controller/fps-controller.ts":
68
68
  /*!******************************************!*\
69
69
  !*** ./src/controller/fps-controller.ts ***!
70
70
  \******************************************/
71
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/logger */"./src/utils/logger.ts"),a=function(){function t(t){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=t,this.registerListeners()}var e=t.prototype;return e.setStreamController=function(t){this.streamController=t},e.registerListeners=function(){this.hls.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},e.unregisterListeners=function(){this.hls.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching)},e.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},e.onMediaAttaching=function(t,e){var r=this.hls.config;if(r.capLevelOnFPSDrop){var n=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=n,n&&"function"==typeof n.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}},e.checkFPS=function(t,e,r){var a=performance.now();if(e){if(this.lastTime){var s=a-this.lastTime,o=r-this.lastDroppedFrames,u=e-this.lastDecodedFrames,l=1e3*o/s,c=this.hls;if(c.trigger(n.Events.FPS_DROP,{currentDropped:o,currentDecoded:u,totalDroppedFrames:r}),l>0&&o>c.config.fpsDroppedMonitoringThreshold*u){var d=c.currentLevel;i.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(-1===c.autoLevelCapping||c.autoLevelCapping>=d)&&(d-=1,c.trigger(n.Events.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:c.currentLevel}),c.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=a,this.lastDroppedFrames=r,this.lastDecodedFrames=e}},e.checkFPSInterval=function(){var t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){var e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)},t}();e.default=a},"./src/controller/fragment-finders.ts":
71
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/logger */"./src/utils/logger.ts"),a=function(){function e(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.registerListeners=function(){this.hls.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.unregisterListeners=function(){this.hls.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching)},t.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},t.onMediaAttaching=function(e,t){var r=this.hls.config;if(r.capLevelOnFPSDrop){var n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&"function"==typeof n.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}},t.checkFPS=function(e,t,r){var a=performance.now();if(t){if(this.lastTime){var s=a-this.lastTime,o=r-this.lastDroppedFrames,l=t-this.lastDecodedFrames,u=1e3*o/s,c=this.hls;if(c.trigger(n.Events.FPS_DROP,{currentDropped:o,currentDecoded:l,totalDroppedFrames:r}),u>0&&o>c.config.fpsDroppedMonitoringThreshold*l){var d=c.currentLevel;i.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(-1===c.autoLevelCapping||c.autoLevelCapping>=d)&&(d-=1,c.trigger(n.Events.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:c.currentLevel}),c.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=a,this.lastDroppedFrames=r,this.lastDecodedFrames=t}},t.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},e}();t.default=a},"./src/controller/fragment-finders.ts":
72
72
  /*!********************************************!*\
73
73
  !*** ./src/controller/fragment-finders.ts ***!
74
74
  \********************************************/
75
- /*! exports provided: findFragmentByPDT, findFragmentByPTS, fragmentWithinToleranceTest, pdtWithinToleranceTest, findFragWithCC */function(t,e,r){r.r(e),r.d(e,"findFragmentByPDT",(function(){return a})),r.d(e,"findFragmentByPTS",(function(){return s})),r.d(e,"fragmentWithinToleranceTest",(function(){return o})),r.d(e,"pdtWithinToleranceTest",(function(){return u})),r.d(e,"findFragWithCC",(function(){return l}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/binary-search */"./src/utils/binary-search.ts");function a(t,e,r){if(null===e||!Array.isArray(t)||!t.length||!Object(n.isFiniteNumber)(e))return null;if(e<(t[0].programDateTime||0))return null;if(e>=(t[t.length-1].endProgramDateTime||0))return null;r=r||0;for(var i=0;i<t.length;++i){var a=t[i];if(u(e,r,a))return a}return null}function s(t,e,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var a=null;if(t?a=e[t.sn-e[0].sn+1]:0===r&&0===e[0].start&&(a=e[0]),a&&0===o(r,n,a))return a;var s=i.default.search(e,o.bind(null,r,n));return s||a}function o(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0);var n=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-n<=t?1:r.start-n>t&&r.start?-1:0}function u(t,e,r){var n=1e3*Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-n>t}function l(t,e){return i.default.search(t,(function(t){return t.cc<e?1:t.cc>e?-1:0}))}},"./src/controller/fragment-tracker.ts":
75
+ /*! exports provided: findFragmentByPDT, findFragmentByPTS, fragmentWithinToleranceTest, pdtWithinToleranceTest, findFragWithCC */function(e,t,r){r.r(t),r.d(t,"findFragmentByPDT",(function(){return a})),r.d(t,"findFragmentByPTS",(function(){return s})),r.d(t,"fragmentWithinToleranceTest",(function(){return o})),r.d(t,"pdtWithinToleranceTest",(function(){return l})),r.d(t,"findFragWithCC",(function(){return u}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/binary-search */"./src/utils/binary-search.ts");function a(e,t,r){if(null===t||!Array.isArray(e)||!e.length||!Object(n.isFiniteNumber)(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;r=r||0;for(var i=0;i<e.length;++i){var a=e[i];if(l(t,r,a))return a}return null}function s(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var a=null;if(e?a=t[e.sn-t[0].sn+1]:0===r&&0===t[0].start&&(a=t[0]),a&&0===o(r,n,a))return a;var s=i.default.search(t,o.bind(null,r,n));return s||a}function o(e,t,r){void 0===e&&(e=0),void 0===t&&(t=0);var n=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-n<=e?1:r.start-n>e&&r.start?-1:0}function l(e,t,r){var n=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-n>e}function u(e,t){return i.default.search(e,(function(e){return e.cc<t?1:e.cc>t?-1:0}))}},"./src/controller/fragment-tracker.ts":
76
76
  /*!********************************************!*\
77
77
  !*** ./src/controller/fragment-tracker.ts ***!
78
78
  \********************************************/
79
- /*! exports provided: FragmentState, FragmentTracker */function(t,e,r){r.r(e),r.d(e,"FragmentState",(function(){return n})),r.d(e,"FragmentTracker",(function(){return s}));var n,i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../types/loader */"./src/types/loader.ts");!function(t){t.NOT_LOADED="NOT_LOADED",t.BACKTRACKED="BACKTRACKED",t.APPENDING="APPENDING",t.PARTIAL="PARTIAL",t.OK="OK"}(n||(n={}));var s=function(){function t(t){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=t,this._registerListeners()}var e=t.prototype;return e._registerListeners=function(){var t=this.hls;t.on(i.Events.BUFFER_APPENDED,this.onBufferAppended,this),t.on(i.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.on(i.Events.FRAG_LOADED,this.onFragLoaded,this)},e._unregisterListeners=function(){var t=this.hls;t.off(i.Events.BUFFER_APPENDED,this.onBufferAppended,this),t.off(i.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.off(i.Events.FRAG_LOADED,this.onFragLoaded,this)},e.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},e.getAppendedFrag=function(t,e){if(e===a.PlaylistLevelType.MAIN){var r=this.activeFragment,n=this.activeParts;if(!r)return null;if(n)for(var i=n.length;i--;){var s=n[i],o=s?s.end:r.appendedPTS;if(s.start<=t&&void 0!==o&&t<=o)return i>9&&(this.activeParts=n.slice(i-9)),s}else if(r.start<=t&&void 0!==r.appendedPTS&&t<=r.appendedPTS)return r}return this.getBufferedFrag(t,e)},e.getBufferedFrag=function(t,e){for(var r=this.fragments,n=Object.keys(r),i=n.length;i--;){var a=r[n[i]];if((null==a?void 0:a.body.type)===e&&a.buffered){var s=a.body;if(s.start<=t&&t<=s.end)return s}}return null},e.detectEvictedFragments=function(t,e,r){var n=this;Object.keys(this.fragments).forEach((function(i){var a=n.fragments[i];if(a)if(a.buffered){var s=a.range[t];s&&s.time.some((function(t){var r=!n.isTimeBuffered(t.startPTS,t.endPTS,e);return r&&n.removeFragment(a.body),r}))}else a.body.type===r&&n.removeFragment(a.body)}))},e.detectPartialFragments=function(t){var e=this,r=this.timeRanges,n=t.frag,i=t.part;if(r&&"initSegment"!==n.sn){var a=u(n),s=this.fragments[a];s&&(Object.keys(r).forEach((function(t){var a=n.elementaryStreams[t];if(a){var o=r[t],u=null!==i||!0===a.partial;s.range[t]=e.getBufferedTimes(n,i,u,o)}})),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body))}},e.getBufferedTimes=function(t,e,r,n){for(var i={time:[],partial:r},a=e?e.start:t.start,s=e?e.end:t.end,o=t.minEndPTS||s,u=t.maxStartPTS||a,l=0;l<n.length;l++){var c=n.start(l)-this.bufferPadding,d=n.end(l)+this.bufferPadding;if(u>=c&&o<=d){i.time.push({startPTS:Math.max(a,n.start(l)),endPTS:Math.min(s,n.end(l))});break}if(a<d&&s>c)i.partial=!0,i.time.push({startPTS:Math.max(a,n.start(l)),endPTS:Math.min(s,n.end(l))});else if(s<=c)break}return i},e.getPartialFragment=function(t){var e,r,n,i=null,a=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach((function(l){var c=u[l];c&&o(c)&&(r=c.body.start-s,n=c.body.end+s,t>=r&&t<=n&&(e=Math.min(t-r,n-t),a<=e&&(i=c.body,a=e)))})),i},e.getState=function(t){var e=u(t),r=this.fragments[e];return r?r.buffered?o(r)?n.PARTIAL:n.OK:r.backtrack?n.BACKTRACKED:n.APPENDING:n.NOT_LOADED},e.backtrack=function(t,e){var r=u(t),n=this.fragments[r];if(!n||n.backtrack)return null;var i=n.backtrack=e||n.loaded;return n.loaded=null,i},e.getBacktrackData=function(t){var e=u(t),r=this.fragments[e];if(r){var n,i=r.backtrack;if(null!=i&&null!==(n=i.payload)&&void 0!==n&&n.byteLength)return i;this.removeFragment(t)}return null},e.isTimeBuffered=function(t,e,r){for(var n,i,a=0;a<r.length;a++){if(n=r.start(a)-this.bufferPadding,i=r.end(a)+this.bufferPadding,t>=n&&e<=i)return!0;if(e<=n)return!1}return!1},e.onFragLoaded=function(t,e){var r=e.frag,n=e.part;if("initSegment"!==r.sn&&!r.bitrateTest&&!n){var i=u(r);this.fragments[i]={body:r,loaded:e,backtrack:null,buffered:!1,range:Object.create(null)}}},e.onBufferAppended=function(t,e){var r=this,n=e.frag,i=e.part,s=e.timeRanges;if(n.type===a.PlaylistLevelType.MAIN)if(this.activeFragment=n,i){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(i)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach((function(t){var e=s[t];if(r.detectEvictedFragments(t,e),!i)for(var a=0;a<e.length;a++)n.appendedPTS=Math.max(e.end(a),n.appendedPTS||0)}))},e.onFragBuffered=function(t,e){this.detectPartialFragments(e)},e.hasFragment=function(t){var e=u(t);return!!this.fragments[e]},e.removeFragment=function(t){var e=u(t);t.stats.loaded=0,t.clearElementaryStreamInfo(),delete this.fragments[e]},e.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},t}();function o(t){var e,r;return t.buffered&&((null===(e=t.range.video)||void 0===e?void 0:e.partial)||(null===(r=t.range.audio)||void 0===r?void 0:r.partial))}function u(t){return t.type+"_"+t.level+"_"+t.urlId+"_"+t.sn}},"./src/controller/gap-controller.ts":
79
+ /*! exports provided: FragmentState, FragmentTracker */function(e,t,r){r.r(t),r.d(t,"FragmentState",(function(){return n})),r.d(t,"FragmentTracker",(function(){return s}));var n,i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../types/loader */"./src/types/loader.ts");!function(e){e.NOT_LOADED="NOT_LOADED",e.BACKTRACKED="BACKTRACKED",e.APPENDING="APPENDING",e.PARTIAL="PARTIAL",e.OK="OK"}(n||(n={}));var s=function(){function e(e){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=e,this._registerListeners()}var t=e.prototype;return t._registerListeners=function(){var e=this.hls;e.on(i.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(i.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(i.Events.FRAG_LOADED,this.onFragLoaded,this)},t._unregisterListeners=function(){var e=this.hls;e.off(i.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(i.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(i.Events.FRAG_LOADED,this.onFragLoaded,this)},t.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},t.getAppendedFrag=function(e,t){if(t===a.PlaylistLevelType.MAIN){var r=this.activeFragment,n=this.activeParts;if(!r)return null;if(n)for(var i=n.length;i--;){var s=n[i],o=s?s.end:r.appendedPTS;if(s.start<=e&&void 0!==o&&e<=o)return i>9&&(this.activeParts=n.slice(i-9)),s}else if(r.start<=e&&void 0!==r.appendedPTS&&e<=r.appendedPTS)return r}return this.getBufferedFrag(e,t)},t.getBufferedFrag=function(e,t){for(var r=this.fragments,n=Object.keys(r),i=n.length;i--;){var a=r[n[i]];if((null==a?void 0:a.body.type)===t&&a.buffered){var s=a.body;if(s.start<=e&&e<=s.end)return s}}return null},t.detectEvictedFragments=function(e,t,r){var n=this;Object.keys(this.fragments).forEach((function(i){var a=n.fragments[i];if(a)if(a.buffered){var s=a.range[e];s&&s.time.some((function(e){var r=!n.isTimeBuffered(e.startPTS,e.endPTS,t);return r&&n.removeFragment(a.body),r}))}else a.body.type===r&&n.removeFragment(a.body)}))},t.detectPartialFragments=function(e){var t=this,r=this.timeRanges,n=e.frag,i=e.part;if(r&&"initSegment"!==n.sn){var a=l(n),s=this.fragments[a];s&&(Object.keys(r).forEach((function(e){var a=n.elementaryStreams[e];if(a){var o=r[e],l=null!==i||!0===a.partial;s.range[e]=t.getBufferedTimes(n,i,l,o)}})),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body))}},t.getBufferedTimes=function(e,t,r,n){for(var i={time:[],partial:r},a=t?t.start:e.start,s=t?t.end:e.end,o=e.minEndPTS||s,l=e.maxStartPTS||a,u=0;u<n.length;u++){var c=n.start(u)-this.bufferPadding,d=n.end(u)+this.bufferPadding;if(l>=c&&o<=d){i.time.push({startPTS:Math.max(a,n.start(u)),endPTS:Math.min(s,n.end(u))});break}if(a<d&&s>c)i.partial=!0,i.time.push({startPTS:Math.max(a,n.start(u)),endPTS:Math.min(s,n.end(u))});else if(s<=c)break}return i},t.getPartialFragment=function(e){var t,r,n,i=null,a=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach((function(u){var c=l[u];c&&o(c)&&(r=c.body.start-s,n=c.body.end+s,e>=r&&e<=n&&(t=Math.min(e-r,n-e),a<=t&&(i=c.body,a=t)))})),i},t.getState=function(e){var t=l(e),r=this.fragments[t];return r?r.buffered?o(r)?n.PARTIAL:n.OK:r.backtrack?n.BACKTRACKED:n.APPENDING:n.NOT_LOADED},t.backtrack=function(e,t){var r=l(e),n=this.fragments[r];if(!n||n.backtrack)return null;var i=n.backtrack=t||n.loaded;return n.loaded=null,i},t.getBacktrackData=function(e){var t=l(e),r=this.fragments[t];if(r){var n,i=r.backtrack;if(null!=i&&null!==(n=i.payload)&&void 0!==n&&n.byteLength)return i;this.removeFragment(e)}return null},t.isTimeBuffered=function(e,t,r){for(var n,i,a=0;a<r.length;a++){if(n=r.start(a)-this.bufferPadding,i=r.end(a)+this.bufferPadding,e>=n&&t<=i)return!0;if(t<=n)return!1}return!1},t.onFragLoaded=function(e,t){var r=t.frag,n=t.part;if("initSegment"!==r.sn&&!r.bitrateTest&&!n){var i=l(r);this.fragments[i]={body:r,loaded:t,backtrack:null,buffered:!1,range:Object.create(null)}}},t.onBufferAppended=function(e,t){var r=this,n=t.frag,i=t.part,s=t.timeRanges;if(n.type===a.PlaylistLevelType.MAIN)if(this.activeFragment=n,i){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(i)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach((function(e){var t=s[e];if(r.detectEvictedFragments(e,t),!i)for(var a=0;a<t.length;a++)n.appendedPTS=Math.max(t.end(a),n.appendedPTS||0)}))},t.onFragBuffered=function(e,t){this.detectPartialFragments(t)},t.hasFragment=function(e){var t=l(e);return!!this.fragments[t]},t.removeFragment=function(e){var t=l(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),delete this.fragments[t]},t.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},e}();function o(e){var t,r;return e.buffered&&((null===(t=e.range.video)||void 0===t?void 0:t.partial)||(null===(r=e.range.audio)||void 0===r?void 0:r.partial))}function l(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn}},"./src/controller/gap-controller.ts":
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(t,e,r){r.r(e),r.d(e,"STALL_MINIMUM_DURATION_MS",(function(){return o})),r.d(e,"MAX_START_GAP_JUMP",(function(){return u})),r.d(e,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return l})),r.d(e,"SKIP_BUFFER_RANGE_START",(function(){return c})),r.d(e,"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 t(t,e,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=t,this.media=e,this.fragmentTracker=r,this.hls=n}var e=t.prototype;return e.destroy=function(){this.hls=this.fragmentTracker=this.media=null},e.poll=function(t){var e=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===t){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,T=(null==E||null===(m=E.details)||void 0===m?void 0:m.live)?2*E.details.targetduration:u;if(y>0&&y<=T)return void this._trySkipBufferHole(null)}var _=self.performance.now();if(null!==i){var b=_-i;!l&&b>=o&&this._reportStall(f.len);var A=n.BufferHelper.bufferInfo(r,a,e.maxBufferHole);this._tryFixBufferStall(A,b)}else this.stalled=_}}}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}},e._tryFixBufferStall=function(t,e){var r=this.config,n=this.fragmentTracker,i=this.media.currentTime,a=n.getPartialFragment(i);a&&this._trySkipBufferHole(a)||t.len>r.maxBufferHole&&e>1e3*r.highBufferWatchdogPeriod&&(s.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},e._reportStall=function(t){var e=this.hls,r=this.media;this.stallReported||(this.stallReported=!0,s.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+t+")"),e.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:t}))},e._trySkipBufferHole=function(t){for(var e=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+e.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,t&&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:t}),v}d=f.end(h)}return 0},e._tryNudgeBuffer=function(){var t=this.config,e=this.hls,r=this.media,n=r.currentTime,o=(this.nudgeRetry||0)+1;if(this.nudgeRetry=o,o<t.nudgeMaxRetry){var u=n+o*t.nudgeOffset;s.logger.warn("Nudging 'currentTime' from "+n+" to "+u),r.currentTime=u,e.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 "+t.nudgeMaxRetry+" nudges"),e.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},t}()},"./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 l})),r.d(t,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return u})),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,l=2,u=.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,u=r.seeking,c=this.seeking&&!u,d=!this.seeking&&u;if(this.seeking=u,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(u){var v=f.len>l,g=!p||p-a>l&&!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:l;if(y>0&&y<=_)return void this._trySkipBufferHole(null)}var T=self.performance.now();if(null!==i){var b=T-i;!u&&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,l=o.currentTime,d=0,f=n.BufferHelper.getBuffered(o),h=0;h<f.length;h++){var p=f.start(h);if(l+t.maxBufferHole>=d&&l<p){var v=Math.max(p+c,o.currentTime+u);return s.logger.warn("skipping hole, adjusting currentTime from "+l+" 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 "+l+" 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 l=n+o*e.nudgeOffset;s.logger.warn("Nudging 'currentTime' from "+n+" to "+l),r.currentTime=l,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
  \************************************************/
87
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),a=r(/*! ../demux/id3 */"./src/demux/id3.ts"),s=function(){function t(t){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=t,this._registerListeners()}var e=t.prototype;return e.destroy=function(){this._unregisterListeners()},e._registerListeners=function(){var t=this.hls;t.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(n.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},e._unregisterListeners=function(){var t=this.hls;t.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(n.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},e.onMediaAttached=function(t,e){this.media=e.media},e.onMediaDetaching=function(){this.id3Track&&(Object(i.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null)},e.getID3Track=function(t){if(this.media){for(var e=0;e<t.length;e++){var r=t[e];if("metadata"===r.kind&&"id3"===r.label)return Object(i.sendAddTrackEvent)(r,this.media),r}return this.media.addTextTrack("metadata","id3")}},e.onFragParsingMetadata=function(t,e){if(this.media){var r=e.frag,n=e.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var i=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<n.length;s++){var o=a.getID3Frames(n[s].data);if(o){var u=n[s].pts,l=s<n.length-1?n[s+1].pts:r.end;l-u<=0&&(l=u+.25);for(var c=0;c<o.length;c++){var d=o[c];if(!a.isTimeStampFrame(d)){var f=new i(u,l,"");f.value=d,this.id3Track.addCue(f)}}}}}},e.onBufferFlushing=function(t,e){var r=e.startOffset,n=e.endOffset,a=e.type;if(!a||"audio"===a){var s=this.id3Track;s&&Object(i.removeCuesInRange)(s,r,n)}},t}();e.default=s},"./src/controller/latency-controller.ts":
87
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),a=r(/*! ../demux/id3 */"./src/demux/id3.ts"),s=function(){function e(e){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=e,this._registerListeners()}var t=e.prototype;return t.destroy=function(){this._unregisterListeners()},t._registerListeners=function(){var e=this.hls;e.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(n.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},t._unregisterListeners=function(){var e=this.hls;e.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(n.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},t.onMediaAttached=function(e,t){this.media=t.media},t.onMediaDetaching=function(){this.id3Track&&(Object(i.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null)},t.getID3Track=function(e){if(this.media){for(var t=0;t<e.length;t++){var r=e[t];if("metadata"===r.kind&&"id3"===r.label)return Object(i.sendAddTrackEvent)(r,this.media),r}return this.media.addTextTrack("metadata","id3")}},t.onFragParsingMetadata=function(e,t){if(this.media){var r=t.frag,n=t.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var i=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<n.length;s++){var o=a.getID3Frames(n[s].data);if(o){var l=n[s].pts,u=s<n.length-1?n[s+1].pts:r.end;u-l<=0&&(u=l+.25);for(var c=0;c<o.length;c++){var d=o[c];if(!a.isTimeStampFrame(d)){var f=new i(l,u,"");f.value=d,this.id3Track.addCue(f)}}}}}},t.onBufferFlushing=function(e,t){var r=t.startOffset,n=t.endOffset,a=t.type;if(!a||"audio"===a){var s=this.id3Track;s&&Object(i.removeCuesInRange)(s,r,n)}},e}();t.default=s},"./src/controller/latency-controller.ts":
88
88
  /*!**********************************************!*\
89
89
  !*** ./src/controller/latency-controller.ts ***!
90
90
  \**********************************************/
91
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return o}));var n=r(/*! ../errors */"./src/errors.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts");function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var o=function(){function t(t){var e=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return e.timeupdate()},this.hls=t,this.config=t.config,this.registerListeners()}var e,r,o,u=t.prototype;return u.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},u.registerListeners=function(){this.hls.on(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(i.Events.ERROR,this.onError,this)},u.unregisterListeners=function(){this.hls.off(i.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(i.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(i.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(i.Events.ERROR,this.onError)},u.onMediaAttached=function(t,e){this.media=e.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},u.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},u.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},u.onLevelUpdated=function(t,e){var r=e.details;this.levelDetails=r,r.advanced&&this.timeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},u.onError=function(t,e){e.details===n.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,a.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},u.timeupdate=function(){var t=this.media,e=this.levelDetails;if(t&&e){this.currentTime=t.currentTime;var r=this.computeLatency();if(null!==r){this._latency=r;var n=this.config,i=n.lowLatencyMode,a=n.maxLiveSyncPlaybackRate;if(i&&1!==a){var s=this.targetLatency;if(null!==s){var o=r-s,u=o<Math.min(this.maxLatency,s+e.targetduration);if(e.live&&u&&o>.05&&this.forwardBufferLength>1){var l=Math.min(2,Math.max(1,a)),c=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;t.playbackRate=Math.min(l,Math.max(1,c))}else 1!==t.playbackRate&&0!==t.playbackRate&&(t.playbackRate=1)}}}}},u.estimateLiveEdge=function(){var t=this.levelDetails;return null===t?null:t.edge+t.age},u.computeLatency=function(){var t=this.estimateLiveEdge();return null===t?null:t-this.currentTime},e=t,(r=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var t=this.config,e=this.levelDetails;return void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:e?t.liveMaxLatencyDurationCount*e.targetduration:0}},{key:"targetLatency",get:function(){var t=this.levelDetails;if(null===t)return null;var e=t.holdBack,r=t.partHoldBack,n=t.targetduration,i=this.config,a=i.liveSyncDuration,s=i.liveSyncDurationCount,o=i.lowLatencyMode,u=this.hls.userConfig,l=o&&r||e;(u.liveSyncDuration||u.liveSyncDurationCount||0===l)&&(l=void 0!==a?a:s*n);var c=n;return l+Math.min(1*this.stallCount,c)}},{key:"liveSyncPosition",get:function(){var t=this.estimateLiveEdge(),e=this.targetLatency,r=this.levelDetails;if(null===t||null===e||null===r)return null;var n=r.edge,i=t-e-this.edgeStalled,a=n-r.totalduration,s=n-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(a,i),s)}},{key:"drift",get:function(){var t=this.levelDetails;return null===t?1:t.drift}},{key:"edgeStalled",get:function(){var t=this.levelDetails;if(null===t)return 0;var e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-e,0)}},{key:"forwardBufferLength",get:function(){var t=this.media,e=this.levelDetails;if(!t||!e)return 0;var r=t.buffered.length;return r?t.buffered.end(r-1):e.edge-this.currentTime}}])&&s(e.prototype,r),o&&s(e,o),t}()},"./src/controller/level-controller.ts":
91
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return o}));var n=r(/*! ../errors */"./src/errors.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts");function s(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 o=function(){function e(e){var t=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return t.timeupdate()},this.hls=e,this.config=e.config,this.registerListeners()}var t,r,o,l=e.prototype;return l.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},l.registerListeners=function(){this.hls.on(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(i.Events.ERROR,this.onError,this)},l.unregisterListeners=function(){this.hls.off(i.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(i.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(i.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(i.Events.ERROR,this.onError)},l.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},l.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},l.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},l.onLevelUpdated=function(e,t){var r=t.details;this.levelDetails=r,r.advanced&&this.timeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},l.onError=function(e,t){t.details===n.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,a.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},l.timeupdate=function(){var e=this.media,t=this.levelDetails;if(e&&t){this.currentTime=e.currentTime;var r=this.computeLatency();if(null!==r){this._latency=r;var n=this.config,i=n.lowLatencyMode,a=n.maxLiveSyncPlaybackRate;if(i&&1!==a){var s=this.targetLatency;if(null!==s){var o=r-s,l=o<Math.min(this.maxLatency,s+t.targetduration);if(t.live&&l&&o>.05&&this.forwardBufferLength>1){var u=Math.min(2,Math.max(1,a)),c=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(u,Math.max(1,c))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}}}}},l.estimateLiveEdge=function(){var e=this.levelDetails;return null===e?null:e.edge+e.age},l.computeLatency=function(){var e=this.estimateLiveEdge();return null===e?null:e-this.currentTime},t=e,(r=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e=this.levelDetails;if(null===e)return null;var t=e.holdBack,r=e.partHoldBack,n=e.targetduration,i=this.config,a=i.liveSyncDuration,s=i.liveSyncDurationCount,o=i.lowLatencyMode,l=this.hls.userConfig,u=o&&r||t;(l.liveSyncDuration||l.liveSyncDurationCount||0===u)&&(u=void 0!==a?a:s*n);var c=n;return u+Math.min(1*this.stallCount,c)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,r=this.levelDetails;if(null===e||null===t||null===r)return null;var n=r.edge,i=e-t-this.edgeStalled,a=n-r.totalduration,s=n-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(a,i),s)}},{key:"drift",get:function(){var e=this.levelDetails;return null===e?1:e.drift}},{key:"edgeStalled",get:function(){var e=this.levelDetails;if(null===e)return 0;var t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:"forwardBufferLength",get:function(){var e=this.media,t=this.levelDetails;if(!e||!t)return 0;var r=e.buffered.length;return r?e.buffered.end(r-1):t.edge-this.currentTime}}])&&s(t.prototype,r),o&&s(t,o),e}()},"./src/controller/level-controller.ts":
92
92
  /*!********************************************!*\
93
93
  !*** ./src/controller/level-controller.ts ***!
94
94
  \********************************************/
95
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return p}));var n=r(/*! ../types/level */"./src/types/level.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../errors */"./src/errors.ts"),s=r(/*! ../utils/codecs */"./src/utils/codecs.ts"),o=r(/*! ./level-helper */"./src/controller/level-helper.ts"),u=r(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),l=r(/*! ../types/loader */"./src/types/loader.ts");function c(){return(c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function d(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function f(t,e){return(f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var h=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),p=function(t){var e,r;function u(e){var r;return(r=t.call(this,e,"[level-controller]")||this)._levels=[],r._firstLevel=-1,r._startLevel=void 0,r.currentLevelIndex=-1,r.manualLevelIndex=-1,r.onParsedComplete=void 0,r._registerListeners(),r}r=t,(e=u).prototype=Object.create(r.prototype),e.prototype.constructor=e,f(e,r);var p,v,g,m=u.prototype;return m._registerListeners=function(){var t=this.hls;t.on(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(i.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(i.Events.ERROR,this.onError,this)},m._unregisterListeners=function(){var t=this.hls;t.off(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(i.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(i.Events.ERROR,this.onError,this)},m.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,t.prototype.destroy.call(this)},m.startLoad=function(){this._levels.forEach((function(t){t.loadError=0})),t.prototype.startLoad.call(this)},m.onManifestLoaded=function(t,e){var r,u,l=[],c=[],d=[],f={},p=!1,v=!1,g=!1;if(e.levels.forEach((function(t){var e=t.attrs;p=p||!(!t.width||!t.height),v=v||!!t.videoCodec,g=g||!!t.audioCodec,h&&t.audioCodec&&-1!==t.audioCodec.indexOf("mp4a.40.34")&&(t.audioCodec=void 0),(u=f[t.bitrate])?u.url.push(t.url):(u=new n.Level(t),f[t.bitrate]=u,l.push(u)),e&&(e.AUDIO&&Object(o.addGroupId)(u,"audio",e.AUDIO),e.SUBTITLES&&Object(o.addGroupId)(u,"text",e.SUBTITLES))})),(p||v)&&g&&(l=l.filter((function(t){var e=t.videoCodec,r=t.width,n=t.height;return!!e||!(!r||!n)}))),l=l.filter((function(t){var e=t.audioCodec,r=t.videoCodec;return(!e||Object(s.isCodecSupportedInMp4)(e,"audio"))&&(!r||Object(s.isCodecSupportedInMp4)(r,"video"))})),e.audioTracks&&(c=e.audioTracks.filter((function(t){return!t.audioCodec||Object(s.isCodecSupportedInMp4)(t.audioCodec,"audio")})),Object(o.assignTrackIdsByGroup)(c)),e.subtitles&&(d=e.subtitles,Object(o.assignTrackIdsByGroup)(d)),l.length>0){r=l[0].bitrate,l.sort((function(t,e){return t.bitrate-e.bitrate})),this._levels=l;for(var m=0;m<l.length;m++)if(l[m].bitrate===r){this._firstLevel=m,this.log("manifest loaded, "+l.length+" level(s) found, first bitrate: "+r);break}var y=g&&!v,E={levels:l,audioTracks:c,subtitleTracks:d,firstLevel:this._firstLevel,stats:e.stats,audio:g,video:v,altAudio:!y&&c.some((function(t){return!!t.url}))};this.hls.trigger(i.Events.MANIFEST_PARSED,E),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:e.url,reason:"no level with compatible codecs found in manifest"})},m.onError=function(e,r){if(t.prototype.onError.call(this,e,r),!r.fatal){var n=r.context,i=this._levels[this.currentLevelIndex];if(n&&(n.type===l.PlaylistContextType.AUDIO_TRACK&&i.audioGroupIds&&n.groupId===i.audioGroupIds[i.urlId]||n.type===l.PlaylistContextType.SUBTITLE_TRACK&&i.textGroupIds&&n.groupId===i.textGroupIds[i.urlId]))this.redundantFailover(this.currentLevelIndex);else{var s,o=!1,u=!0;switch(r.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:if(r.frag){var c=this._levels[r.frag.level];c?(c.fragmentError++,c.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=r.frag.level)):s=r.frag.level}break;case a.ErrorDetails.LEVEL_LOAD_ERROR:case a.ErrorDetails.LEVEL_LOAD_TIMEOUT:n&&(n.deliveryDirectives&&(u=!1),s=n.level),o=!0;break;case a.ErrorDetails.REMUX_ALLOC_ERROR:s=r.level,o=!0}void 0!==s&&this.recoverLevel(r,s,o,u)}}},m.recoverLevel=function(t,e,r,n){var i=t.details,a=this._levels[e];if(a.loadError++,r){if(!this.retryLoadingOrFail(t))return void(this.currentLevelIndex=-1);t.levelRetry=!0}if(n){var s=a.url.length;if(s>1&&a.loadError<s)t.levelRetry=!0,this.redundantFailover(e);else if(-1===this.manualLevelIndex){var o=0===e?this._levels.length-1:e-1;this.currentLevelIndex!==o&&0===this._levels[o].loadError&&(this.warn(i+": switch to "+o),t.levelRetry=!0,this.hls.nextAutoLevel=o)}}},m.redundantFailover=function(t){var e=this._levels[t],r=e.url.length;if(r>1){var n=(e.urlId+1)%r;this.warn("Switching to redundant URL-id "+n),this._levels.forEach((function(t){t.urlId=n})),this.level=t}},m.onFragLoaded=function(t,e){var r=e.frag;if(void 0!==r&&r.type===l.PlaylistLevelType.MAIN){var n=this._levels[r.level];void 0!==n&&(n.fragmentError=0,n.loadError=0)}},m.onLevelLoaded=function(t,e){var r,n,i=e.level,a=e.details,s=this._levels[i];if(!s)return this.warn("Invalid level index "+i),void(null!==(n=e.deliveryDirectives)&&void 0!==n&&n.skip&&(a.deltaUpdateFailed=!0));i===this.currentLevelIndex?(0===s.fragmentError&&(s.loadError=0,this.retryCount=0),this.playlistLoaded(i,e,s.details)):null!==(r=e.deliveryDirectives)&&void 0!==r&&r.skip&&(a.deltaUpdateFailed=!0)},m.onAudioTrackSwitched=function(t,e){var r=this.hls.levels[this.currentLevelIndex];if(r&&r.audioGroupIds){for(var n=-1,i=this.hls.audioTracks[e.id].groupId,a=0;a<r.audioGroupIds.length;a++)if(r.audioGroupIds[a]===i){n=a;break}n!==r.urlId&&(r.urlId=n,this.startLoad())}},m.loadPlaylist=function(t){var e=this.currentLevelIndex,r=this._levels[e];if(this.canLoad&&r&&r.url.length>0){var n=r.urlId,a=r.url[n];if(t)try{a=t.addDirectives(a)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Attempt loading level index "+e+(t?" at sn "+t.msn+" part "+t.part:"")+" with URL-id "+n+" "+a),this.clearTimer(),this.hls.trigger(i.Events.LEVEL_LOADING,{url:a,level:e,id:n,deliveryDirectives:t||null})}},m.removeLevel=function(t,e){var r=function(t,r){return r!==e},n=this._levels.filter((function(n,i){return i!==t||n.url.length>1&&void 0!==e&&(n.url=n.url.filter(r),n.audioGroupIds&&(n.audioGroupIds=n.audioGroupIds.filter(r)),n.textGroupIds&&(n.textGroupIds=n.textGroupIds.filter(r)),n.urlId=0,!0)})).map((function(t,e){var r=t.details;return null!=r&&r.fragments&&r.fragments.forEach((function(t){t.level=e})),t}));this._levels=n,this.hls.trigger(i.Events.LEVELS_UPDATED,{levels:n})},p=u,(v=[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var e,r=this._levels;if(0!==r.length&&(this.currentLevelIndex!==t||null===(e=r[t])||void 0===e||!e.details)){if(t<0||t>=r.length){var n=t<0;if(this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.OTHER_ERROR,details:a.ErrorDetails.LEVEL_SWITCH_ERROR,level:t,fatal:n,reason:"invalid level idx"}),n)return;t=Math.min(t,r.length-1)}this.clearTimer();var s=this.currentLevelIndex,o=r[s],u=r[t];this.log("switching to level "+t+" from "+s),this.currentLevelIndex=t;var l=c({},u,{level:t,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete l._urlId,this.hls.trigger(i.Events.LEVEL_SWITCHING,l);var d=u.details;if(!d||d.live){var f=this.switchParams(u.uri,null==o?void 0:o.details);this.loadPlaylist(f)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var t=this.hls.config.startLevel;return void 0!==t?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}}])&&d(p.prototype,v),g&&d(p,g),u}(u.default)},"./src/controller/level-helper.ts":
95
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return p}));var n=r(/*! ../types/level */"./src/types/level.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../errors */"./src/errors.ts"),s=r(/*! ../utils/codecs */"./src/utils/codecs.ts"),o=r(/*! ./level-helper */"./src/controller/level-helper.ts"),l=r(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),u=r(/*! ../types/loader */"./src/types/loader.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)}function d(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 f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),p=function(e){var t,r;function l(t){var r;return(r=e.call(this,t,"[level-controller]")||this)._levels=[],r._firstLevel=-1,r._startLevel=void 0,r.currentLevelIndex=-1,r.manualLevelIndex=-1,r.onParsedComplete=void 0,r._registerListeners(),r}r=e,(t=l).prototype=Object.create(r.prototype),t.prototype.constructor=t,f(t,r);var p,v,g,m=l.prototype;return m._registerListeners=function(){var e=this.hls;e.on(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.on(i.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(i.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(i.Events.ERROR,this.onError,this)},m._unregisterListeners=function(){var e=this.hls;e.off(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),e.off(i.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(i.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(i.Events.ERROR,this.onError,this)},m.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,e.prototype.destroy.call(this)},m.startLoad=function(){this._levels.forEach((function(e){e.loadError=0})),e.prototype.startLoad.call(this)},m.onManifestLoaded=function(e,t){var r,l,u=[],c=[],d=[],f={},p=!1,v=!1,g=!1;if(t.levels.forEach((function(e){var t=e.attrs;p=p||!(!e.width||!e.height),v=v||!!e.videoCodec,g=g||!!e.audioCodec,h&&e.audioCodec&&-1!==e.audioCodec.indexOf("mp4a.40.34")&&(e.audioCodec=void 0),(l=f[e.bitrate])?l.url.push(e.url):(l=new n.Level(e),f[e.bitrate]=l,u.push(l)),t&&(t.AUDIO&&Object(o.addGroupId)(l,"audio",t.AUDIO),t.SUBTITLES&&Object(o.addGroupId)(l,"text",t.SUBTITLES))})),(p||v)&&g&&(u=u.filter((function(e){var t=e.videoCodec,r=e.width,n=e.height;return!!t||!(!r||!n)}))),u=u.filter((function(e){var t=e.audioCodec,r=e.videoCodec;return(!t||Object(s.isCodecSupportedInMp4)(t,"audio"))&&(!r||Object(s.isCodecSupportedInMp4)(r,"video"))})),t.audioTracks&&(c=t.audioTracks.filter((function(e){return!e.audioCodec||Object(s.isCodecSupportedInMp4)(e.audioCodec,"audio")})),Object(o.assignTrackIdsByGroup)(c)),t.subtitles&&(d=t.subtitles,Object(o.assignTrackIdsByGroup)(d)),u.length>0){r=u[0].bitrate,u.sort((function(e,t){return e.bitrate-t.bitrate})),this._levels=u;for(var m=0;m<u.length;m++)if(u[m].bitrate===r){this._firstLevel=m,this.log("manifest loaded, "+u.length+" level(s) found, first bitrate: "+r);break}var y=g&&!v,E={levels:u,audioTracks:c,subtitleTracks:d,firstLevel:this._firstLevel,stats:t.stats,audio:g,video:v,altAudio:!y&&c.some((function(e){return!!e.url}))};this.hls.trigger(i.Events.MANIFEST_PARSED,E),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,reason:"no level with compatible codecs found in manifest"})},m.onError=function(t,r){if(e.prototype.onError.call(this,t,r),!r.fatal){var n=r.context,i=this._levels[this.currentLevelIndex];if(n&&(n.type===u.PlaylistContextType.AUDIO_TRACK&&i.audioGroupIds&&n.groupId===i.audioGroupIds[i.urlId]||n.type===u.PlaylistContextType.SUBTITLE_TRACK&&i.textGroupIds&&n.groupId===i.textGroupIds[i.urlId]))this.redundantFailover(this.currentLevelIndex);else{var s,o=!1,l=!0;switch(r.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:if(r.frag){var c=this._levels[r.frag.level];c?(c.fragmentError++,c.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=r.frag.level)):s=r.frag.level}break;case a.ErrorDetails.LEVEL_LOAD_ERROR:case a.ErrorDetails.LEVEL_LOAD_TIMEOUT:n&&(n.deliveryDirectives&&(l=!1),s=n.level),o=!0;break;case a.ErrorDetails.REMUX_ALLOC_ERROR:s=r.level,o=!0}void 0!==s&&this.recoverLevel(r,s,o,l)}}},m.recoverLevel=function(e,t,r,n){var i=e.details,a=this._levels[t];if(a.loadError++,r){if(!this.retryLoadingOrFail(e))return void(this.currentLevelIndex=-1);e.levelRetry=!0}if(n){var s=a.url.length;if(s>1&&a.loadError<s)e.levelRetry=!0,this.redundantFailover(t);else if(-1===this.manualLevelIndex){var o=0===t?this._levels.length-1:t-1;this.currentLevelIndex!==o&&0===this._levels[o].loadError&&(this.warn(i+": switch to "+o),e.levelRetry=!0,this.hls.nextAutoLevel=o)}}},m.redundantFailover=function(e){var t=this._levels[e],r=t.url.length;if(r>1){var n=(t.urlId+1)%r;this.warn("Switching to redundant URL-id "+n),this._levels.forEach((function(e){e.urlId=n})),this.level=e}},m.onFragLoaded=function(e,t){var r=t.frag;if(void 0!==r&&r.type===u.PlaylistLevelType.MAIN){var n=this._levels[r.level];void 0!==n&&(n.fragmentError=0,n.loadError=0)}},m.onLevelLoaded=function(e,t){var r,n,i=t.level,a=t.details,s=this._levels[i];if(!s)return this.warn("Invalid level index "+i),void(null!==(n=t.deliveryDirectives)&&void 0!==n&&n.skip&&(a.deltaUpdateFailed=!0));i===this.currentLevelIndex?(0===s.fragmentError&&(s.loadError=0,this.retryCount=0),this.playlistLoaded(i,t,s.details)):null!==(r=t.deliveryDirectives)&&void 0!==r&&r.skip&&(a.deltaUpdateFailed=!0)},m.onAudioTrackSwitched=function(e,t){var r=this.hls.levels[this.currentLevelIndex];if(r&&r.audioGroupIds){for(var n=-1,i=this.hls.audioTracks[t.id].groupId,a=0;a<r.audioGroupIds.length;a++)if(r.audioGroupIds[a]===i){n=a;break}n!==r.urlId&&(r.urlId=n,this.startLoad())}},m.loadPlaylist=function(e){var t=this.currentLevelIndex,r=this._levels[t];if(this.canLoad&&r&&r.url.length>0){var n=r.urlId,a=r.url[n];if(e)try{a=e.addDirectives(a)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Attempt loading level index "+t+(e?" at sn "+e.msn+" part "+e.part:"")+" with URL-id "+n+" "+a),this.clearTimer(),this.hls.trigger(i.Events.LEVEL_LOADING,{url:a,level:t,id:n,deliveryDirectives:e||null})}},m.removeLevel=function(e,t){var r=function(e,r){return r!==t},n=this._levels.filter((function(n,i){return i!==e||n.url.length>1&&void 0!==t&&(n.url=n.url.filter(r),n.audioGroupIds&&(n.audioGroupIds=n.audioGroupIds.filter(r)),n.textGroupIds&&(n.textGroupIds=n.textGroupIds.filter(r)),n.urlId=0,!0)})).map((function(e,t){var r=e.details;return null!=r&&r.fragments&&r.fragments.forEach((function(e){e.level=t})),e}));this._levels=n,this.hls.trigger(i.Events.LEVELS_UPDATED,{levels:n})},p=l,(v=[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t,r=this._levels;if(0!==r.length&&(this.currentLevelIndex!==e||null===(t=r[e])||void 0===t||!t.details)){if(e<0||e>=r.length){var n=e<0;if(this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.OTHER_ERROR,details:a.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:n,reason:"invalid level idx"}),n)return;e=Math.min(e,r.length-1)}this.clearTimer();var s=this.currentLevelIndex,o=r[s],l=r[e];this.log("switching to level "+e+" from "+s),this.currentLevelIndex=e;var u=c({},l,{level:e,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete u._urlId,this.hls.trigger(i.Events.LEVEL_SWITCHING,u);var d=l.details;if(!d||d.live){var f=this.switchParams(l.uri,null==o?void 0:o.details);this.loadPlaylist(f)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this._firstLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}])&&d(p.prototype,v),g&&d(p,g),l}(l.default)},"./src/controller/level-helper.ts":
96
96
  /*!****************************************!*\
97
97
  !*** ./src/controller/level-helper.ts ***!
98
98
  \****************************************/
99
- /*! exports provided: addGroupId, assignTrackIdsByGroup, updatePTS, updateFragPTSDTS, mergeDetails, mapPartIntersection, mapFragmentIntersection, adjustSliding, computeReloadInterval, getFragmentWithSN, getPartWith */function(t,e,r){r.r(e),r.d(e,"addGroupId",(function(){return a})),r.d(e,"assignTrackIdsByGroup",(function(){return s})),r.d(e,"updatePTS",(function(){return o})),r.d(e,"updateFragPTSDTS",(function(){return l})),r.d(e,"mergeDetails",(function(){return c})),r.d(e,"mapPartIntersection",(function(){return d})),r.d(e,"mapFragmentIntersection",(function(){return f})),r.d(e,"adjustSliding",(function(){return h})),r.d(e,"computeReloadInterval",(function(){return p})),r.d(e,"getFragmentWithSN",(function(){return v})),r.d(e,"getPartWith",(function(){return g}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/logger */"./src/utils/logger.ts");function a(t,e,r){switch(e){case"audio":t.audioGroupIds||(t.audioGroupIds=[]),t.audioGroupIds.push(r);break;case"text":t.textGroupIds||(t.textGroupIds=[]),t.textGroupIds.push(r)}}function s(t){var e={};t.forEach((function(t){var r=t.groupId||"";t.id=e[r]=e[r]||0,e[r]++}))}function o(t,e,r){u(t[e],t[r])}function u(t,e){var r=e.startPTS;if(Object(n.isFiniteNumber)(r)){var i,a=0;e.sn>t.sn?(a=r-t.start,i=t):(a=t.start-r,i=e),i.duration!==a&&(i.duration=a)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.start=t.start+(t.minEndPTS-t.start):e.start=t.start+t.duration:e.start=Math.max(t.start-e.duration,0)}function l(t,e,r,a,s,o){a-r<=0&&(i.logger.warn("Fragment should have a positive duration",e),a=r+e.duration,o=s+e.duration);var l=r,c=a,d=e.startPTS,f=e.endPTS;if(Object(n.isFiniteNumber)(d)){var h=Math.abs(d-r);Object(n.isFiniteNumber)(e.deltaPTS)?e.deltaPTS=Math.max(h,e.deltaPTS):e.deltaPTS=h,l=Math.max(r,d),r=Math.min(r,d),s=Math.min(s,e.startDTS),c=Math.min(a,f),a=Math.max(a,f),o=Math.max(o,e.endDTS)}e.duration=a-r;var p=r-e.start;e.appendedPTS=a,e.start=e.startPTS=r,e.maxStartPTS=l,e.startDTS=s,e.endPTS=a,e.minEndPTS=c,e.endDTS=o;var v,g=e.sn;if(!t||g<t.startSN||g>t.endSN)return 0;var m=g-t.startSN,y=t.fragments;for(y[m]=e,v=m;v>0;v--)u(y[v],y[v-1]);for(v=m;v<y.length-1;v++)u(y[v],y[v+1]);return t.fragmentHint&&u(y[y.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,p}function c(t,e){e.initSegment&&t.initSegment&&(e.initSegment=t.initSegment),t.fragmentHint&&delete t.fragmentHint.endPTS;var r,a=0;if(f(t,e,(function(t,i){t.relurl&&(a=t.cc-i.cc),Object(n.isFiniteNumber)(t.startPTS)&&Object(n.isFiniteNumber)(t.endPTS)&&(i.start=i.startPTS=t.startPTS,i.startDTS=t.startDTS,i.appendedPTS=t.appendedPTS,i.maxStartPTS=t.maxStartPTS,i.endPTS=t.endPTS,i.endDTS=t.endDTS,i.minEndPTS=t.minEndPTS,i.duration=t.endPTS-t.startPTS,i.duration&&(r=i),e.PTSKnown=e.alignedSliding=!0),i.elementaryStreams=t.elementaryStreams,i.loader=t.loader,i.stats=t.stats,i.urlId=t.urlId})),e.skippedSegments&&(e.deltaUpdateFailed=e.fragments.some((function(t){return!t})),e.deltaUpdateFailed)){i.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=e.skippedSegments;s--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}var o=e.fragments;if(a){i.logger.warn("discontinuity sliding from playlist, take drift into account");for(var u=0;u<o.length;u++)o[u].cc+=a}e.skippedSegments&&(e.initSegment||(e.initSegment=t.initSegment),e.startCC=e.fragments[0].cc),d(t.partList,e.partList,(function(t,e){e.elementaryStreams=t.elementaryStreams,e.stats=t.stats})),r?l(e,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):h(t,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;var c=e.advancedDateTime;if(e.advanced&&c){var p=e.edge;e.driftStart||(e.driftStartTime=c,e.driftStart=p),e.driftEndTime=c,e.driftEnd=p}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime}function d(t,e,r){if(t&&e)for(var n=0,i=0,a=t.length;i<=a;i++){var s=t[i],o=e[i+n];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?r(s,o):n--}}function f(t,e,r){for(var n=e.skippedSegments,i=Math.max(t.startSN,e.startSN)-e.startSN,a=(t.fragmentHint?1:0)+(n?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,s=e.startSN-t.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,u=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=i;l<=a;l++){var c=u[s+l],d=o[l];n&&!d&&l<n&&(d=e.fragments[l]=c),c&&d&&r(c,d)}}function h(t,e){var r=e.startSN+e.skippedSegments-t.startSN,n=t.fragments,i=e.fragments;if(!(r<0||r>=n.length)){var a=n[r].start;if(a){for(var s=e.skippedSegments;s<i.length;s++)i[s].start+=a;e.fragmentHint&&(e.fragmentHint.start+=a)}}}function p(t,e){var r,n=1e3*t.levelTargetDuration,i=n/2,a=t.age,s=a>0&&a<3*n,o=e.loading.end-e.loading.start,u=t.availabilityDelay;if(!1===t.updated)if(s){var l=333*t.misses;r=Math.max(Math.min(i,2*o),l),t.availabilityDelay=(t.availabilityDelay||0)+r}else r=i;else s?(u=Math.min(u||n/2,a),t.availabilityDelay=u,r=u+n-a):r=n-o;return Math.round(r)}function v(t,e){if(!t||!t.details)return null;var r=t.details,n=r.fragments[e-r.startSN];return n||((n=r.fragmentHint)&&n.sn===e?n:null)}function g(t,e,r){if(!t||!t.details)return null;var n=t.details.partList;if(n)for(var i=n.length;i--;){var a=n[i];if(a.index===r&&a.fragment.sn===e)return a}return null}},"./src/controller/stream-controller.ts":
99
+ /*! exports provided: addGroupId, assignTrackIdsByGroup, updatePTS, updateFragPTSDTS, mergeDetails, mapPartIntersection, mapFragmentIntersection, adjustSliding, computeReloadInterval, getFragmentWithSN, getPartWith */function(e,t,r){r.r(t),r.d(t,"addGroupId",(function(){return a})),r.d(t,"assignTrackIdsByGroup",(function(){return s})),r.d(t,"updatePTS",(function(){return o})),r.d(t,"updateFragPTSDTS",(function(){return u})),r.d(t,"mergeDetails",(function(){return c})),r.d(t,"mapPartIntersection",(function(){return d})),r.d(t,"mapFragmentIntersection",(function(){return f})),r.d(t,"adjustSliding",(function(){return h})),r.d(t,"computeReloadInterval",(function(){return p})),r.d(t,"getFragmentWithSN",(function(){return v})),r.d(t,"getPartWith",(function(){return g}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/logger */"./src/utils/logger.ts");function a(e,t,r){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(r);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(r)}}function s(e){var t={};e.forEach((function(e){var r=e.groupId||"";e.id=t[r]=t[r]||0,t[r]++}))}function o(e,t,r){l(e[t],e[r])}function l(e,t){var r=t.startPTS;if(Object(n.isFiniteNumber)(r)){var i,a=0;t.sn>e.sn?(a=r-e.start,i=e):(a=e.start-r,i=t),i.duration!==a&&(i.duration=a)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function u(e,t,r,a,s,o){a-r<=0&&(i.logger.warn("Fragment should have a positive duration",t),a=r+t.duration,o=s+t.duration);var u=r,c=a,d=t.startPTS,f=t.endPTS;if(Object(n.isFiniteNumber)(d)){var h=Math.abs(d-r);Object(n.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(h,t.deltaPTS):t.deltaPTS=h,u=Math.max(r,d),r=Math.min(r,d),s=Math.min(s,t.startDTS),c=Math.min(a,f),a=Math.max(a,f),o=Math.max(o,t.endDTS)}t.duration=a-r;var p=r-t.start;t.appendedPTS=a,t.start=t.startPTS=r,t.maxStartPTS=u,t.startDTS=s,t.endPTS=a,t.minEndPTS=c,t.endDTS=o;var v,g=t.sn;if(!e||g<e.startSN||g>e.endSN)return 0;var m=g-e.startSN,y=e.fragments;for(y[m]=t,v=m;v>0;v--)l(y[v],y[v-1]);for(v=m;v<y.length-1;v++)l(y[v],y[v+1]);return e.fragmentHint&&l(y[y.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,p}function c(e,t){t.initSegment&&e.initSegment&&(t.initSegment=e.initSegment),e.fragmentHint&&delete e.fragmentHint.endPTS;var r,a=0;if(f(e,t,(function(e,i){e.relurl&&(a=e.cc-i.cc),Object(n.isFiniteNumber)(e.startPTS)&&Object(n.isFiniteNumber)(e.endPTS)&&(i.start=i.startPTS=e.startPTS,i.startDTS=e.startDTS,i.appendedPTS=e.appendedPTS,i.maxStartPTS=e.maxStartPTS,i.endPTS=e.endPTS,i.endDTS=e.endDTS,i.minEndPTS=e.minEndPTS,i.duration=e.endPTS-e.startPTS,i.duration&&(r=i),t.PTSKnown=t.alignedSliding=!0),i.elementaryStreams=e.elementaryStreams,i.loader=e.loader,i.stats=e.stats,i.urlId=e.urlId})),t.skippedSegments&&(t.deltaUpdateFailed=t.fragments.some((function(e){return!e})),t.deltaUpdateFailed)){i.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=t.skippedSegments;s--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}var o=t.fragments;if(a){i.logger.warn("discontinuity sliding from playlist, take drift into account");for(var l=0;l<o.length;l++)o[l].cc+=a}t.skippedSegments&&(t.initSegment||(t.initSegment=e.initSegment),t.startCC=t.fragments[0].cc),d(e.partList,t.partList,(function(e,t){t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),r?u(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):h(e,t),o.length&&(t.totalduration=t.edge-o[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;var c=t.advancedDateTime;if(t.advanced&&c){var p=t.edge;t.driftStart||(t.driftStartTime=c,t.driftStart=p),t.driftEndTime=c,t.driftEnd=p}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}function d(e,t,r){if(e&&t)for(var n=0,i=0,a=e.length;i<=a;i++){var s=e[i],o=t[i+n];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?r(s,o):n--}}function f(e,t,r){for(var n=t.skippedSegments,i=Math.max(e.startSN,t.startSN)-t.startSN,a=(e.fragmentHint?1:0)+(n?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,s=t.startSN-e.startSN,o=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,u=i;u<=a;u++){var c=l[s+u],d=o[u];n&&!d&&u<n&&(d=t.fragments[u]=c),c&&d&&r(c,d)}}function h(e,t){var r=t.startSN+t.skippedSegments-e.startSN,n=e.fragments,i=t.fragments;if(!(r<0||r>=n.length)){var a=n[r].start;if(a){for(var s=t.skippedSegments;s<i.length;s++)i[s].start+=a;t.fragmentHint&&(t.fragmentHint.start+=a)}}}function p(e,t){var r,n=1e3*e.levelTargetDuration,i=n/2,a=e.age,s=a>0&&a<3*n,o=t.loading.end-t.loading.start,l=e.availabilityDelay;if(!1===e.updated)if(s){var u=333*e.misses;r=Math.max(Math.min(i,2*o),u),e.availabilityDelay=(e.availabilityDelay||0)+r}else r=i;else s?(l=Math.min(l||n/2,a),e.availabilityDelay=l,r=l+n-a):r=n-o;return Math.round(r)}function v(e,t){if(!e||!e.details)return null;var r=e.details,n=r.fragments[t-r.startSN];return n||((n=r.fragmentHint)&&n.sn===t?n:null)}function g(e,t,r){if(!e||!e.details)return null;var n=e.details.partList;if(n)for(var i=n.length;i--;){var a=n[i];if(a.index===r&&a.fragment.sn===t)return a}return null}},"./src/controller/stream-controller.ts":
100
100
  /*!*********************************************!*\
101
101
  !*** ./src/controller/stream-controller.ts ***!
102
102
  \*********************************************/
103
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"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(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function m(t,e){return(m=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var y=function(t){var e,r;function y(e,r){var n;return(n=t.call(this,e,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=t,(e=y).prototype=Object.create(r.prototype),e.prototype.constructor=e,m(e,r);var E,T,_,b=y.prototype;return b._registerListeners=function(){var t=this.hls;t.on(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(s.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(s.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(s.Events.ERROR,this.onError,this),t.on(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(s.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(s.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(s.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var t=this.hls;t.off(s.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(s.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(s.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(s.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(s.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(s.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(s.Events.ERROR,this.onError,this),t.off(s.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(s.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(s.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(s.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(s.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(s.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},b.startLoad=function(t){if(this.levels){var e=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}e>0&&-1===t&&(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=i.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=i.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,t.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_LEVEL:var t,e=this.levels,r=this.level,n=null==e||null===(t=e[r])||void 0===t?void 0:t.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(){t.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var t,e,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,T=p.maxBitrate;E=T?Math.max(8*d.maxBufferSize/T,d.maxBufferLength):d.maxBufferLength,E=Math.min(E,d.maxMaxBufferLength);var _=g<d.maxBufferHole?Math.max(h.MAX_START_GAP_JUMP,d.maxBufferHole):d.maxBufferHole,b=o.BufferHelper.bufferInfo(this.mediaBuffer?this.mediaBuffer:c,g,_);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===(t=m.decryptdata)||void 0===t?void 0:t.keyFormat)||null!==(e=m.decryptdata)&&void 0!==e&&e.key?this.loadFragment(m,v,y):this.loadKey(m,v)}}}},b.loadFragment=function(e,r,n){var i,a=this.fragmentTracker.getState(e);if(this.fragCurrent=e,a===u.FragmentState.BACKTRACKED){var s=this.fragmentTracker.getBacktrackData(e);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"===e.sn?this._loadInitSegment(e):this.bitrateTest?(e.bitrateTest=!0,this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e)):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,r,n)):a===u.FragmentState.APPENDING?this.reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e):0===(null===(i=this.media)||void 0===i?void 0:i.buffered.length)&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(t){var e=this.fragmentTracker.getAppendedFrag(t,l.PlaylistLevelType.MAIN);return e&&"fragment"in e?e.fragment:e},b.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,l.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var t=this.levels,e=this.media;if(null!=e&&e.readyState){var r,n=this.getAppendedFrag(e.currentTime);if(n&&n.start>1&&this.flushMainBuffer(0,n.start-1),!e.paused&&t){var i=t[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(e.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 t=this.fragCurrent;this.fragCurrent=null,null!=t&&t.loader&&t.loader.abort(),this.state===i.State.KEY_LOADING&&(this.state=i.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(e,r){t.prototype.flushMainBuffer.call(this,e,r,this.altAudio?"video":null)},b.onMediaAttached=function(e,r){t.prototype.onMediaAttached.call(this,e,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 e=this.media;e&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),t.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var t=this.media,e=t?t.currentTime:null;Object(n.isFiniteNumber)(e)&&this.log("Media seeked to "+e.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(t,e){var r,n=!1,i=!1;e.levels.forEach((function(t){(r=t.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=e.levels,this.startFragRequested=!1},b.onLevelLoading=function(t,e){var r=this.levels;if(r&&this.state===i.State.IDLE){var n=r[e.level];(!n.details||n.details.live&&this.levelLastLoaded!==e.level||this.waitForCdnTuneIn(n.details))&&(this.state=i.State.WAITING_LEVEL)}},b.onLevelLoaded=function(t,e){var r,n=this.levels,a=e.level,o=e.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!==e.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(t){var e,r=t.frag,n=t.part,i=t.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===(e=o.initSegment)||void 0===e?void 0:e.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(t,e){var r=this.altAudio,n=!!e.url,i=e.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(t,e){var r=e.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(t,e){var r,n,i=e.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(t,e){var r=e.frag,n=e.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(t,e){switch(e.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,e);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==i.State.ERROR&&(e.fatal?(this.warn(""+e.details),this.state=i.State.ERROR):e.levelRetry||this.state!==i.State.WAITING_LEVEL||(this.state=i.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:"main"!==e.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 t=this.media,e=this.gapController;if(t&&e&&t.readyState){var r=o.BufferHelper.getBuffered(t);!this.loadedmetadata&&r.length?(this.loadedmetadata=!0,this.seekToStartPos()):e.poll(this.lastCurrentTime),this.lastCurrentTime=t.currentTime}},b.onFragLoadEmergencyAborted=function(){this.state=i.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tick()},b.onBufferFlushed=function(t,e){var r=e.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(t,e){this.levels=e.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var t=this.media,e=t.currentTime,r=this.startPosition;if(r>=0&&e<r){if(t.seeking)return void v.logger.log("could not seek to "+r+", already seeking at "+e);var n=o.BufferHelper.getBuffered(t),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 "+e),t.currentTime=r}},b._getAudioCodec=function(t){var e=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),e},b._loadBitrateTestFrag=function(t){var e=this;this._doFragLoad(t).then((function(r){var n=e.hls;if(r&&!n.nextLoadLevel&&!e.fragContextChanged(t)){e.fragLoadError=0,e.state=i.State.IDLE,e.startFragRequested=!1,e.bitrateTest=!1;var a=t.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(t){var e,r="main",a=this.hls,o=t.remuxResult,u=t.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,T=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:T}))}if(p&&!1!==o.independent){if(h.details){var _=p.startPTS,b=p.endPTS,A=p.startDTS,S=p.endDTS;if(f)f.elementaryStreams[p.type]={startPTS:_,endPTS:b,startDTS:A,endDTS:S};else if(p.dropped&&p.independent){if(this.getLoadPosition()+this.config.maxBufferHole<_)return void this.backtrack(d);d.setElementaryStreamInfo(p.type,d.start,b,d.start,S,!0)}d.setElementaryStreamInfo(p.type,_,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!==(e=g.samples)&&void 0!==e&&e.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(t,e,r,n){var a=this;if(this.state===i.State.PARSING){this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;var o=e.audio,u=e.video,l=e.audiovideo;if(o){var c=t.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)),t.audioCodec&&t.audioCodec!==c&&this.log('Swapping manifest audio codec "'+t.audioCodec+'" for "'+c+'"'),o.levelCodec=c,o.id="main",this.log("Init audio buffer, container:"+o.container+", codecs[selected/level/parsed]=["+(c||"")+"/"+(t.audioCodec||"")+"/"+o.codec+"]")}u&&(u.levelCodec=t.videoCodec,u.id="main",this.log("Init video buffer, container:"+u.container+", codecs[level/parsed]=["+(t.videoCodec||"")+"/"+u.codec+"]")),l&&this.log("Init audiovideo buffer, container:"+l.container+", codecs[level/parsed]=["+(t.attrs.CODECS||"")+"/"+l.codec+"]"),this.hls.trigger(s.Events.BUFFER_CODECS,e),Object.keys(e).forEach((function(t){var i=e[t].initSegment;null!=i&&i.byteLength&&a.hls.trigger(s.Events.BUFFER_APPENDING,{type:t,data:i,frag:r,part:null,chunkMeta:n,parent:r.type})})),this.tick()}},b.backtrack=function(t){this.resetTransmuxer(),this.flushBufferGap(t);var e=this.fragmentTracker.backtrack(t);this.fragPrevious=null,this.nextLoadPosition=t.start,e?this.resetFragmentLoading(t):this.state=i.State.BACKTRACKING},b.checkFragmentChanged=function(){var t=this.media,e=null;if(t&&t.readyState>1&&!1===t.seeking){var r=t.currentTime;if(o.BufferHelper.isBuffered(t,r)?e=this.getAppendedFrag(r):o.BufferHelper.isBuffered(t,r+.1)&&(e=this.getAppendedFrag(r+.1)),e){var n=this.fragPlaying,i=e.level;n&&e.sn===n.sn&&n.level===i&&e.urlId===n.urlId||(this.hls.trigger(s.Events.FRAG_CHANGED,{frag:e}),n&&n.level===i||this.hls.trigger(s.Events.LEVEL_SWITCHED,{level:i}),this.fragPlaying=e)}}},E=y,(T=[{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"currentLevel",get:function(){var t=this.media;if(t){var e=this.getAppendedFrag(t.currentTime);if(e)return e.level}return-1}},{key:"nextBufferedFrag",get:function(){var t=this.media;if(t){var e=this.getAppendedFrag(t.currentTime);return this.followingBufferedFrag(e)}return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&g(E.prototype,T),_&&g(E,_),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"),l=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),u=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,u=this.levels,c=this.media,d=r.config,f=r.nextLoadLevel;if(null!==a&&(c||!this.startFragRequested&&d.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&u&&u[f]){var p=u[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)===l.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===l.FragmentState.BACKTRACKED){var s=this.fragmentTracker.getBacktrackData(t);if(s)return this._handleFragmentLoadProgress(s),void this._handleFragmentLoadComplete(s);a=l.FragmentState.NOT_LOADED}a===l.FragmentState.NOT_LOADED||a===l.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===l.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,u.PlaylistLevelType.MAIN);return t&&"fragment"in t?t.fragment:t},b.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,u.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 l=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,c=Math.max(s.end,l+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,.5*u),.75*u));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,l=o.totalduration;if(n){this.log("Level "+a+" loaded ["+o.startSN+","+o.endSN+"], cc ["+o.startCC+", "+o.endCC+"] duration:"+l);var u=this.fragCurrent;!u||this.state!==i.State.FRAG_LOADING&&this.state!==i.State.FRAG_LOADING_WAITING_RETRY||u.level!==t.level&&u.loader&&(this.state=i.State.IDLE,u.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 l=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,u.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,l,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 l=i[s];l&&(this.videoBuffer=l.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===u.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(u.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,u.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,l=e.chunkMeta,u=this.getCurrentContext(l);if(!u)return this.warn("The loading context changed while buffering fragment "+l.sn+" of level "+l.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(l.level);var d=u.frag,f=u.part,h=u.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,l),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,l)}}else if(!1===o.independent)return void this.backtrack(d);if(y){var L=y.startPTS,w=y.endPTS,k=y.startDTS,R=y.endDTS;f&&(f.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:L,endPTS:w,startDTS:k,endDTS:R}),d.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,L,w,k,R),this.bufferFragmentData(y,d,f,l)}if(null!=g&&null!==(t=g.samples)&&void 0!==t&&t.length){var D={frag:d,id:r,samples:g.samples};a.trigger(s.Events.FRAG_PARSING_METADATA,D)}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,l=t.video,u=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+"]")}l&&(l.levelCodec=e.videoCodec,l.id="main",this.log("Init video buffer, container:"+l.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+l.codec+"]")),u&&this.log("Init audiovideo buffer, container:"+u.container+", codecs[level/parsed]=["+(e.attrs.CODECS||"")+"/"+u.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
  \******************************************************/
107
- /*! exports provided: SubtitleStreamController */function(t,e,r){r.r(e),r.d(e,"SubtitleStreamController",(function(){return h}));var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/logger */"./src/utils/logger.ts"),a=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),s=r(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),o=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),u=r(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),l=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../types/level */"./src/types/level.ts");function d(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function f(t,e){return(f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var h=function(t){var e,r;function h(e,r){var n;return(n=t.call(this,e,r,"[subtitle-stream-controller]")||this).levels=[],n.currentTrackId=-1,n.tracksBuffered=void 0,n.config=e.config,n.fragCurrent=null,n.fragPrevious=null,n.media=null,n.mediaBuffer=null,n.state=u.State.STOPPED,n.tracksBuffered=[],n._registerListeners(),n}r=t,(e=h).prototype=Object.create(r.prototype),e.prototype.constructor=e,f(e,r);var p,v,g,m=h.prototype;return m._registerListeners=function(){var t=this.hls;t.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(n.Events.ERROR,this.onError,this),t.on(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(n.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(n.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this)},m._unregisterListeners=function(){var t=this.hls;t.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(n.Events.ERROR,this.onError,this),t.off(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(n.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(n.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this)},m.startLoad=function(){this.stopLoad(),this.state=u.State.IDLE;var t=this.levels[this.currentTrackId];null!=t&&t.details&&(this.setInterval(500),this.tick())},m.onHandlerDestroyed=function(){this.state=u.State.STOPPED,this._unregisterListeners(),t.prototype.onHandlerDestroyed.call(this)},m.onSubtitleFragProcessed=function(t,e){var r=e.frag,n=e.success;if(this.fragPrevious=r,this.state=u.State.IDLE,n){var i=this.tracksBuffered[this.currentTrackId];if(i){for(var a,s=r.start,o=0;o<i.length;o++)if(s>=i[o].start&&s<=i[o].end){a=i[o];break}var l=r.start+r.duration;a?a.end=l:(a={start:s,end:l},i.push(a))}}},m.onMediaAttached=function(t,e){var r=e.media;this.media=r,this.state=u.State.IDLE},m.onMediaDetaching=function(){var t=this;this.media&&(this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.currentTrackId=-1,this.levels.forEach((function(e){t.tracksBuffered[e.id]=[]})),this.media=null,this.mediaBuffer=null,this.state=u.State.STOPPED)},m.onError=function(t,e){var r,n=e.frag;n&&n.type===l.PlaylistLevelType.SUBTITLE&&(null!==(r=this.fragCurrent)&&void 0!==r&&r.loader&&this.fragCurrent.loader.abort(),this.state=u.State.IDLE)},m.onSubtitleTracksUpdated=function(t,e){var r=this,n=e.subtitleTracks;this.tracksBuffered=[],this.levels=n.map((function(t){return new c.Level(t)})),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach((function(t){r.tracksBuffered[t.id]=[]})),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(t,e){if(this.currentTrackId=e.id,this.levels.length&&-1!==this.currentTrackId){var r=this.levels[this.currentTrackId];null!=r&&r.details?(this.mediaBuffer=this.mediaBufferTimeRanges,this.setInterval(500)):this.mediaBuffer=null}else this.clearInterval()},m.onSubtitleTrackLoaded=function(t,e){var r,n=e.id,i=e.details,a=this.currentTrackId,s=this.levels;if(s.length&&i){var o=s[a];if(!(n>=s.length||n!==a)&&o){if(this.mediaBuffer=this.mediaBufferTimeRanges,i.live||null!==(r=o.details)&&void 0!==r&&r.live){if(i.deltaUpdateFailed)return;this.alignPlaylists(i,o.details)}o.details=i,this.levelLastLoaded=n,this.setInterval(500)}}},m._handleFragmentLoadComplete=function(t){var e=t.frag,r=t.payload,i=e.decryptdata,a=this.hls;if(!this.fragContextChanged(e)&&r&&r.byteLength>0&&i&&i.key&&i.iv&&"AES-128"===i.method){var s=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(r),i.key.buffer,i.iv.buffer).then((function(t){var r=performance.now();a.trigger(n.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:s,tdecrypt:r}})}))}},m.doTick=function(){if(this.media){if(this.state===u.State.IDLE){var t,e=this.config,r=this.currentTrackId,l=this.fragmentTracker,c=this.media,d=this.levels;if(!d.length||!d[r]||!d[r].details)return;var f=e.maxBufferHole,h=e.maxFragLookUpTolerance,p=Math.min(e.maxBufferLength,e.maxMaxBufferLength),v=a.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,c.currentTime,f),g=v.end;if(v.len>p)return;var m=d[r].details;console.assert(m,"Subtitle track details are defined on idle subtitle stream controller tick");var y,E=m.fragments,T=E.length,_=E[T-1].start+E[T-1].duration,b=this.fragPrevious;g<_?(b&&m.hasProgramDateTime&&(y=Object(s.findFragmentByPDT)(E,b.endProgramDateTime,h)),y||(y=Object(s.findFragmentByPTS)(b,E,g,h))):y=E[T-1],null!==(t=y)&&void 0!==t&&t.encrypted?(i.logger.log("Loading key for "+y.sn),this.state=u.State.KEY_LOADING,this.hls.trigger(n.Events.KEY_LOADING,{frag:y})):y&&l.getState(y)===o.FragmentState.NOT_LOADED&&this.loadFragment(y,m,g)}}else this.state=u.State.IDLE},m.loadFragment=function(e,r,n){this.fragCurrent=e,t.prototype.loadFragment.call(this,e,r,n)},m.stopLoad=function(){this.fragPrevious=null,t.prototype.stopLoad.call(this)},p=h,(v=[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}])&&d(p.prototype,v),g&&d(p,g),h}(u.default)},"./src/controller/subtitle-track-controller.ts":
107
+ /*! exports provided: SubtitleStreamController */function(e,t,r){r.r(t),r.d(t,"SubtitleStreamController",(function(){return h}));var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/logger */"./src/utils/logger.ts"),a=r(/*! ../utils/buffer-helper */"./src/utils/buffer-helper.ts"),s=r(/*! ./fragment-finders */"./src/controller/fragment-finders.ts"),o=r(/*! ./fragment-tracker */"./src/controller/fragment-tracker.ts"),l=r(/*! ./base-stream-controller */"./src/controller/base-stream-controller.ts"),u=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../types/level */"./src/types/level.ts");function d(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 f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h=function(e){var t,r;function h(t,r){var n;return(n=e.call(this,t,r,"[subtitle-stream-controller]")||this).levels=[],n.currentTrackId=-1,n.tracksBuffered=void 0,n.config=t.config,n.fragCurrent=null,n.fragPrevious=null,n.media=null,n.mediaBuffer=null,n.state=l.State.STOPPED,n.tracksBuffered=[],n._registerListeners(),n}r=e,(t=h).prototype=Object.create(r.prototype),t.prototype.constructor=t,f(t,r);var p,v,g,m=h.prototype;return m._registerListeners=function(){var e=this.hls;e.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(n.Events.ERROR,this.onError,this),e.on(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(n.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(n.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this)},m._unregisterListeners=function(){var e=this.hls;e.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(n.Events.ERROR,this.onError,this),e.off(n.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(n.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(n.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this)},m.startLoad=function(){this.stopLoad(),this.state=l.State.IDLE;var e=this.levels[this.currentTrackId];null!=e&&e.details&&(this.setInterval(500),this.tick())},m.onHandlerDestroyed=function(){this.state=l.State.STOPPED,this._unregisterListeners(),e.prototype.onHandlerDestroyed.call(this)},m.onSubtitleFragProcessed=function(e,t){var r=t.frag,n=t.success;if(this.fragPrevious=r,this.state=l.State.IDLE,n){var i=this.tracksBuffered[this.currentTrackId];if(i){for(var a,s=r.start,o=0;o<i.length;o++)if(s>=i[o].start&&s<=i[o].end){a=i[o];break}var u=r.start+r.duration;a?a.end=u:(a={start:s,end:u},i.push(a))}}},m.onMediaAttached=function(e,t){var r=t.media;this.media=r,this.state=l.State.IDLE},m.onMediaDetaching=function(){var e=this;this.media&&(this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.currentTrackId=-1,this.levels.forEach((function(t){e.tracksBuffered[t.id]=[]})),this.media=null,this.mediaBuffer=null,this.state=l.State.STOPPED)},m.onError=function(e,t){var r,n=t.frag;n&&n.type===u.PlaylistLevelType.SUBTITLE&&(null!==(r=this.fragCurrent)&&void 0!==r&&r.loader&&this.fragCurrent.loader.abort(),this.state=l.State.IDLE)},m.onSubtitleTracksUpdated=function(e,t){var r=this,n=t.subtitleTracks;this.tracksBuffered=[],this.levels=n.map((function(e){return new c.Level(e)})),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach((function(e){r.tracksBuffered[e.id]=[]})),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(e,t){if(this.currentTrackId=t.id,this.levels.length&&-1!==this.currentTrackId){var r=this.levels[this.currentTrackId];null!=r&&r.details?(this.mediaBuffer=this.mediaBufferTimeRanges,this.setInterval(500)):this.mediaBuffer=null}else this.clearInterval()},m.onSubtitleTrackLoaded=function(e,t){var r,n=t.id,i=t.details,a=this.currentTrackId,s=this.levels;if(s.length&&i){var o=s[a];if(!(n>=s.length||n!==a)&&o){if(this.mediaBuffer=this.mediaBufferTimeRanges,i.live||null!==(r=o.details)&&void 0!==r&&r.live){if(i.deltaUpdateFailed)return;this.alignPlaylists(i,o.details)}o.details=i,this.levelLastLoaded=n,this.setInterval(500)}}},m._handleFragmentLoadComplete=function(e){var t=e.frag,r=e.payload,i=t.decryptdata,a=this.hls;if(!this.fragContextChanged(t)&&r&&r.byteLength>0&&i&&i.key&&i.iv&&"AES-128"===i.method){var s=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(r),i.key.buffer,i.iv.buffer).then((function(e){var r=performance.now();a.trigger(n.Events.FRAG_DECRYPTED,{frag:t,payload:e,stats:{tstart:s,tdecrypt:r}})}))}},m.doTick=function(){if(this.media){if(this.state===l.State.IDLE){var e,t=this.config,r=this.currentTrackId,u=this.fragmentTracker,c=this.media,d=this.levels;if(!d.length||!d[r]||!d[r].details)return;var f=t.maxBufferHole,h=t.maxFragLookUpTolerance,p=Math.min(t.maxBufferLength,t.maxMaxBufferLength),v=a.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,c.currentTime,f),g=v.end;if(v.len>p)return;var m=d[r].details;console.assert(m,"Subtitle track details are defined on idle subtitle stream controller tick");var y,E=m.fragments,_=E.length,T=E[_-1].start+E[_-1].duration,b=this.fragPrevious;g<T?(b&&m.hasProgramDateTime&&(y=Object(s.findFragmentByPDT)(E,b.endProgramDateTime,h)),y||(y=Object(s.findFragmentByPTS)(b,E,g,h))):y=E[_-1],null!==(e=y)&&void 0!==e&&e.encrypted?(i.logger.log("Loading key for "+y.sn),this.state=l.State.KEY_LOADING,this.hls.trigger(n.Events.KEY_LOADING,{frag:y})):y&&u.getState(y)===o.FragmentState.NOT_LOADED&&this.loadFragment(y,m,g)}}else this.state=l.State.IDLE},m.loadFragment=function(t,r,n){this.fragCurrent=t,e.prototype.loadFragment.call(this,t,r,n)},m.stopLoad=function(){this.fragPrevious=null,e.prototype.stopLoad.call(this)},p=h,(v=[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}])&&d(p.prototype,v),g&&d(p,g),h}(l.default)},"./src/controller/subtitle-track-controller.ts":
108
108
  /*!*****************************************************!*\
109
109
  !*** ./src/controller/subtitle-track-controller.ts ***!
110
110
  \*****************************************************/
111
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),a=r(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),s=r(/*! ../types/loader */"./src/types/loader.ts");function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var l=function(t){var e,r;function a(e){var r;return(r=t.call(this,e,"[subtitle-track-controller]")||this).media=null,r.tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.trackChangeListener=function(){return r.onTextTracksChanged()},r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r.subtitleDisplay=!0,r.registerListeners(),r}r=t,(e=a).prototype=Object.create(r.prototype),e.prototype.constructor=e,u(e,r);var l,d,f,h=a.prototype;return h.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=null,t.prototype.destroy.call(this)},h.registerListeners=function(){var t=this.hls;t.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(n.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(n.Events.ERROR,this.onError,this)},h.unregisterListeners=function(){var t=this.hls;t.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(n.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(n.Events.ERROR,this.onError,this)},h.onMediaAttached=function(t,e){var r=this;this.media=e.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?(self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval((function(){r.trackChangeListener()}),500)):this.media.textTracks.addEventListener("change",this.trackChangeListener))},h.onMediaDetaching=function(){this.media&&(this.useTextTrackPolling?self.clearInterval(this.subtitlePollingInterval):this.media.textTracks.removeEventListener("change",this.trackChangeListener),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),c(this.media.textTracks).forEach((function(t){Object(i.clearCurrentCues)(t)})),this.subtitleTrack=-1,this.media=null)},h.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},h.onManifestParsed=function(t,e){this.tracks=e.subtitleTracks},h.onSubtitleTrackLoaded=function(t,e){var r=e.id,n=e.details,i=this.trackId,a=this.tracksInGroup[i];if(a){var s=a.details;a.details=e.details,this.log("subtitle track "+r+" loaded ["+n.startSN+"-"+n.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,e,s))}else this.warn("Invalid subtitle track id "+r)},h.onLevelLoading=function(t,e){this.switchLevel(e.level)},h.onLevelSwitching=function(t,e){this.switchLevel(e.level)},h.switchLevel=function(t){var e=this.hls.levels[t];if(null!=e&&e.textGroupIds){var r=e.textGroupIds[e.urlId];if(this.groupId!==r){var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,a=this.tracks.filter((function(t){return!r||t.groupId===r}));this.tracksInGroup=a;var s=this.findTrackId(null==i?void 0:i.name)||this.findTrackId();this.groupId=r;var o={subtitleTracks:a};this.log("Updating subtitle tracks, "+a.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(n.Events.SUBTITLE_TRACKS_UPDATED,o),-1!==s&&this.setSubtitleTrack(s,i)}}},h.findTrackId=function(t){for(var e=this.tracksInGroup,r=0;r<e.length;r++){var n=e[r];if((!this.selectDefaultTrack||n.default)&&(!t||t===n.name))return n.id}return-1},h.onError=function(e,r){t.prototype.onError.call(this,e,r),!r.fatal&&r.context&&r.context.type===s.PlaylistContextType.SUBTITLE_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},h.loadPlaylist=function(t){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var r=e.id,i=e.groupId,a=e.url;if(t)try{a=t.addDirectives(a)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Loading subtitle playlist for id "+r),this.hls.trigger(n.Events.SUBTITLE_TRACK_LOADING,{url:a,id:r,groupId:i,deliveryDirectives:t||null})}},h.toggleTrackModes=function(t){var e=this,r=this.media,n=this.subtitleDisplay,i=this.trackId;if(r){var a=c(r.textTracks),s=a.filter((function(t){return t.groupId===e.groupId}));if(-1===t)[].slice.call(a).forEach((function(t){t.mode="disabled"}));else{var o=s[i];o&&(o.mode="disabled")}var u=s[t];u&&(u.mode=n?"showing":"hidden")}},h.setSubtitleTrack=function(t,e){var r,i=this.tracksInGroup;if(this.media){if(this.trackId!==t&&this.toggleTrackModes(t),!(this.trackId===t&&(-1===t||null!==(r=i[t])&&void 0!==r&&r.details)||t<-1||t>=i.length)){this.clearTimer();var a=i[t];if(this.log("Switching to subtitle track "+t),this.trackId=t,a){var s=a.id,o=a.groupId,u=void 0===o?"":o,l=a.name,c=a.type,d=a.url;this.hls.trigger(n.Events.SUBTITLE_TRACK_SWITCH,{id:s,groupId:u,name:l,type:c,url:d});var f=this.switchParams(a.url,null==e?void 0:e.details);this.loadPlaylist(f)}else this.hls.trigger(n.Events.SUBTITLE_TRACK_SWITCH,{id:t})}}else this.queuedDefaultTrack=t},h.onTextTracksChanged=function(){if(this.media&&this.hls.config.renderTextTracksNatively){for(var t=-1,e=c(this.media.textTracks),r=0;r<e.length;r++)if("hidden"===e[r].mode)t=r;else if("showing"===e[r].mode){t=r;break}this.subtitleTrack=t}},l=a,(d=[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var e=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,e)}}])&&o(l.prototype,d),f&&o(l,f),a}(a.default);function c(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];"subtitles"===n.kind&&n.label&&e.push(t[r])}return e}e.default=l},"./src/controller/timeline-controller.ts":
111
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),a=r(/*! ./base-playlist-controller */"./src/controller/base-playlist-controller.ts"),s=r(/*! ../types/loader */"./src/types/loader.ts");function o(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 l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var u=function(e){var t,r;function a(t){var r;return(r=e.call(this,t,"[subtitle-track-controller]")||this).media=null,r.tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.trackChangeListener=function(){return r.onTextTracksChanged()},r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r.subtitleDisplay=!0,r.registerListeners(),r}r=e,(t=a).prototype=Object.create(r.prototype),t.prototype.constructor=t,l(t,r);var u,d,f,h=a.prototype;return h.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=null,e.prototype.destroy.call(this)},h.registerListeners=function(){var e=this.hls;e.on(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.on(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(n.Events.ERROR,this.onError,this)},h.unregisterListeners=function(){var e=this.hls;e.off(n.Events.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),e.off(n.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(n.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(n.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(n.Events.ERROR,this.onError,this)},h.onMediaAttached=function(e,t){var r=this;this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?(self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval((function(){r.trackChangeListener()}),500)):this.media.textTracks.addEventListener("change",this.trackChangeListener))},h.onMediaDetaching=function(){this.media&&(this.useTextTrackPolling?self.clearInterval(this.subtitlePollingInterval):this.media.textTracks.removeEventListener("change",this.trackChangeListener),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),c(this.media.textTracks).forEach((function(e){Object(i.clearCurrentCues)(e)})),this.subtitleTrack=-1,this.media=null)},h.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},h.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},h.onSubtitleTrackLoaded=function(e,t){var r=t.id,n=t.details,i=this.trackId,a=this.tracksInGroup[i];if(a){var s=a.details;a.details=t.details,this.log("subtitle track "+r+" loaded ["+n.startSN+"-"+n.endSN+"]"),r===this.trackId&&(this.retryCount=0,this.playlistLoaded(r,t,s))}else this.warn("Invalid subtitle track id "+r)},h.onLevelLoading=function(e,t){this.switchLevel(t.level)},h.onLevelSwitching=function(e,t){this.switchLevel(t.level)},h.switchLevel=function(e){var t=this.hls.levels[e];if(null!=t&&t.textGroupIds){var r=t.textGroupIds[t.urlId];if(this.groupId!==r){var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,a=this.tracks.filter((function(e){return!r||e.groupId===r}));this.tracksInGroup=a;var s=this.findTrackId(null==i?void 0:i.name)||this.findTrackId();this.groupId=r;var o={subtitleTracks:a};this.log("Updating subtitle tracks, "+a.length+' track(s) found in "'+r+'" group-id'),this.hls.trigger(n.Events.SUBTITLE_TRACKS_UPDATED,o),-1!==s&&this.setSubtitleTrack(s,i)}}},h.findTrackId=function(e){for(var t=this.tracksInGroup,r=0;r<t.length;r++){var n=t[r];if((!this.selectDefaultTrack||n.default)&&(!e||e===n.name))return n.id}return-1},h.onError=function(t,r){e.prototype.onError.call(this,t,r),!r.fatal&&r.context&&r.context.type===s.PlaylistContextType.SUBTITLE_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},h.loadPlaylist=function(e){var t=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(t)){var r=t.id,i=t.groupId,a=t.url;if(e)try{a=e.addDirectives(a)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Loading subtitle playlist for id "+r),this.hls.trigger(n.Events.SUBTITLE_TRACK_LOADING,{url:a,id:r,groupId:i,deliveryDirectives:e||null})}},h.toggleTrackModes=function(e){var t=this,r=this.media,n=this.subtitleDisplay,i=this.trackId;if(r){var a=c(r.textTracks),s=a.filter((function(e){return e.groupId===t.groupId}));if(-1===e)[].slice.call(a).forEach((function(e){e.mode="disabled"}));else{var o=s[i];o&&(o.mode="disabled")}var l=s[e];l&&(l.mode=n?"showing":"hidden")}},h.setSubtitleTrack=function(e,t){var r,i=this.tracksInGroup;if(this.media){if(this.trackId!==e&&this.toggleTrackModes(e),!(this.trackId===e&&(-1===e||null!==(r=i[e])&&void 0!==r&&r.details)||e<-1||e>=i.length)){this.clearTimer();var a=i[e];if(this.log("Switching to subtitle track "+e),this.trackId=e,a){var s=a.id,o=a.groupId,l=void 0===o?"":o,u=a.name,c=a.type,d=a.url;this.hls.trigger(n.Events.SUBTITLE_TRACK_SWITCH,{id:s,groupId:l,name:u,type:c,url:d});var f=this.switchParams(a.url,null==t?void 0:t.details);this.loadPlaylist(f)}else this.hls.trigger(n.Events.SUBTITLE_TRACK_SWITCH,{id:e})}}else this.queuedDefaultTrack=e},h.onTextTracksChanged=function(){if(this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=c(this.media.textTracks),r=0;r<t.length;r++)if("hidden"===t[r].mode)e=r;else if("showing"===t[r].mode){e=r;break}this.subtitleTrack=e}},u=a,(d=[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1;var t=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(e,t)}}])&&o(u.prototype,d),f&&o(u,f),a}(a.default);function c(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];"subtitles"===n.kind&&n.label&&t.push(e[r])}return t}t.default=u},"./src/controller/timeline-controller.ts":
112
112
  /*!***********************************************!*\
113
113
  !*** ./src/controller/timeline-controller.ts ***!
114
114
  \***********************************************/
115
- /*! exports provided: TimelineController */function(t,e,r){r.r(e),r.d(e,"TimelineController",(function(){return f}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/cea-608-parser */"./src/utils/cea-608-parser.ts"),s=r(/*! ../utils/output-filter */"./src/utils/output-filter.ts"),o=r(/*! ../utils/webvtt-parser */"./src/utils/webvtt-parser.ts"),u=r(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),l=r(/*! ../utils/imsc1-ttml-parser */"./src/utils/imsc1-ttml-parser.ts"),c=r(/*! ../types/loader */"./src/types/loader.ts"),d=r(/*! ../utils/logger */"./src/utils/logger.ts"),f=function(){function t(t){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var e=new s.default(this,"textTrack1"),r=new s.default(this,"textTrack2"),n=new s.default(this,"textTrack3"),o=new s.default(this,"textTrack4");this.cea608Parser1=new a.default(1,e,r),this.cea608Parser2=new a.default(3,n,o)}t.on(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(i.Events.FRAG_LOADING,this.onFragLoading,this),t.on(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(i.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(i.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(i.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(i.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=t.prototype;return e.destroy=function(){var t=this.hls;t.off(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(i.Events.FRAG_LOADING,this.onFragLoading,this),t.off(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(i.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(i.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(i.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(i.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(t,e,r,n,a){for(var s,o,u,l,c=!1,d=a.length;d--;){var f=a[d],h=(s=f[0],o=f[1],u=e,l=r,Math.min(o,l)-Math.max(s,u));if(h>=0&&(f[0]=Math.min(f[0],e),f[1]=Math.max(f[1],r),c=!0,h/(r-e)>.5))return}if(c||a.push([e,r]),this.config.renderTextTracksNatively){var p=this.captionsTracks[t];this.Cues.newCue(p,e,r,n)}else{var v=this.Cues.newCue(null,e,r,n);this.hls.trigger(i.Events.CUES_PARSED,{type:"captions",cues:v,track:t})}},e.onInitPtsFound=function(t,e){var r=this,n=e.frag,a=e.id,s=e.initPTS,o=e.timescale,u=this.unparsedVttFrags;"main"===a&&(this.initPTS[n.cc]=s,this.timescale[n.cc]=o),u.length&&(this.unparsedVttFrags=[],u.forEach((function(t){r.onFragLoaded(i.Events.FRAG_LOADED,t)})))},e.getExistingTrack=function(t){var e=this.media;if(e)for(var r=0;r<e.textTracks.length;r++){var n=e.textTracks[r];if(n[t])return n}return null},e.createCaptionsTrack=function(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)},e.createNativeTrack=function(t){if(!this.captionsTracks[t]){var e=this.captionsProperties,r=this.captionsTracks,n=this.media,i=e[t],a=i.label,s=i.languageCode,o=this.getExistingTrack(t);if(o)r[t]=o,Object(u.clearCurrentCues)(r[t]),Object(u.sendAddTrackEvent)(r[t],n);else{var l=this.createTextTrack("captions",a,s);l&&(l[t]=!0,r[t]=l)}}},e.createNonNativeTrack=function(t){if(!this.nonNativeCaptionsTracks[t]){var e=this.captionsProperties[t];if(e){var r={_id:t,label:e.label,kind:"captions",default:!!e.media&&!!e.media.default,closedCaptions:e.media};this.nonNativeCaptionsTracks[t]=r,this.hls.trigger(i.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}}},e.createTextTrack=function(t,e,r){var n=this.media;if(n)return n.addTextTrack(t,e,r)},e.onMediaAttaching=function(t,e){this.media=e.media,this._cleanTracks()},e.onMediaDetaching=function(){var t=this.captionsTracks;Object.keys(t).forEach((function(e){Object(u.clearCurrentCues)(t[e]),delete t[e]})),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},e._cleanTracks=function(){var t=this.media;if(t){var e=t.textTracks;if(e)for(var r=0;r<e.length;r++)Object(u.clearCurrentCues)(e[r])}},e.onSubtitleTracksUpdated=function(t,e){var r=this;this.textTracks=[];var n=e.subtitleTracks||[],a=n.some((function(t){return t.textCodec===l.IMSC1_CODEC}));if(this.config.enableWebVTT||a&&this.config.enableIMSC1){var s=this.tracks&&n&&this.tracks.length===n.length;if(this.tracks=n||[],this.config.renderTextTracksNatively){var o=this.media?this.media.textTracks:[];this.tracks.forEach((function(t,e){var n;if(e<o.length){for(var i=null,a=0;a<o.length;a++)if(h(o[a],t)){i=o[a];break}i&&(n=i)}n?Object(u.clearCurrentCues)(n):(n=r.createTextTrack("subtitles",t.name,t.lang))&&(n.mode="disabled"),n&&(n.groupId=t.groupId,r.textTracks.push(n))}))}else if(!s&&this.tracks&&this.tracks.length){var c=this.tracks.map((function(t){return{label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}}));this.hls.trigger(i.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},e.onManifestLoaded=function(t,e){var r=this;this.config.enableCEA708Captions&&e.captions&&e.captions.forEach((function(t){var e=/(?:CC|SERVICE)([1-4])/.exec(t.instreamId);if(e){var n="textTrack"+e[1],i=r.captionsProperties[n];i&&(i.label=t.name,t.lang&&(i.languageCode=t.lang),i.media=t)}}))},e.onFragLoading=function(t,e){var r=this.cea608Parser1,n=this.cea608Parser2,i=this.lastSn;if(this.enabled&&r&&n&&e.frag.type===c.PlaylistLevelType.MAIN){var a=e.frag.sn;a!==i+1&&(r.reset(),n.reset()),this.lastSn=a}},e.onFragLoaded=function(t,e){var r=e.frag,a=e.payload,s=this.initPTS,o=this.unparsedVttFrags;if(r.type===c.PlaylistLevelType.SUBTITLE)if(a.byteLength){if(!Object(n.isFiniteNumber)(s[r.cc]))return o.push(e),void(s.length&&this.hls.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Missing initial subtitle PTS")}));var u=r.decryptdata;if(null==u||null==u.key||"AES-128"!==u.method){var d=this.tracks[r.level],f=this.vttCCs;f[r.cc]||(f[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),d&&d.textCodec===l.IMSC1_CODEC?this._parseIMSC1(r,a):this._parseVTTs(r,a,f)}}else this.hls.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(t,e){var r=this,n=this.hls;Object(l.parseIMSC1)(e,this.initPTS[t.cc],this.timescale[t.cc],(function(e){r._appendCues(e,t.level),n.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(function(e){d.logger.log("Failed to parse IMSC1: "+e),n.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})}))},e._parseVTTs=function(t,e,r){var n=this,a=this.hls;Object(o.parseWebVTT)(e,this.initPTS[t.cc],this.timescale[t.cc],r,t.cc,t.start,(function(e){n._appendCues(e,t.level),a.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(function(r){n._fallbackToIMSC1(t,e),d.logger.log("Failed to parse VTT cue: "+r),a.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:r})}))},e._fallbackToIMSC1=function(t,e){var r=this,n=this.tracks[t.level];n.textCodec||Object(l.parseIMSC1)(e,this.initPTS[t.cc],this.timescale[t.cc],(function(){n.textCodec=l.IMSC1_CODEC,r._parseIMSC1(t,e)}),(function(){n.textCodec="wvtt"}))},e._appendCues=function(t,e){var r=this.hls;if(this.config.renderTextTracksNatively){var n=this.textTracks[e];if("disabled"===n.mode)return;t.forEach((function(t){return Object(u.addCueToTrack)(n,t)}))}else{var a=this.tracks[e].default?"default":"subtitles"+e;r.trigger(i.Events.CUES_PARSED,{type:"subtitles",cues:t,track:a})}},e.onFragDecrypted=function(t,e){var r=e.frag;if(r.type===c.PlaylistLevelType.SUBTITLE){if(!Object(n.isFiniteNumber)(this.initPTS[r.cc]))return void this.unparsedVttFrags.push(e);this.onFragLoaded(i.Events.FRAG_LOADED,e)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(t,e){var r=this.cea608Parser1,n=this.cea608Parser2;if(this.enabled&&r&&n)for(var i=0;i<e.samples.length;i++){var a=e.samples[i].bytes;if(a){var s=this.extractCea608Data(a);r.addData(e.samples[i].pts,s[0]),n.addData(e.samples[i].pts,s[1])}}},e.onBufferFlushing=function(t,e){var r=e.startOffset,n=e.endOffset,i=e.type;if(!i||"video"===i){var a=this.media;if(!a||a.currentTime<n)return;var s=this.captionsTracks;Object.keys(s).forEach((function(t){return Object(u.removeCuesInRange)(s[t],r,n)}))}},e.extractCea608Data=function(t){for(var e=31&t[0],r=2,n=[[],[]],i=0;i<e;i++){var a=t[r++],s=127&t[r++],o=127&t[r++],u=3&a;0===s&&0===o||0!=(4&a)&&(0!==u&&1!==u||(n[u].push(s),n[u].push(o)))}return n},t}();function h(t,e){return t&&t.label===e.name&&!(t.textTrack1||t.textTrack2)}},"./src/crypt/aes-crypto.ts":
115
+ /*! exports provided: TimelineController */function(e,t,r){r.r(t),r.d(t,"TimelineController",(function(){return f}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/cea-608-parser */"./src/utils/cea-608-parser.ts"),s=r(/*! ../utils/output-filter */"./src/utils/output-filter.ts"),o=r(/*! ../utils/webvtt-parser */"./src/utils/webvtt-parser.ts"),l=r(/*! ../utils/texttrack-utils */"./src/utils/texttrack-utils.ts"),u=r(/*! ../utils/imsc1-ttml-parser */"./src/utils/imsc1-ttml-parser.ts"),c=r(/*! ../types/loader */"./src/types/loader.ts"),d=r(/*! ../utils/logger */"./src/utils/logger.ts"),f=function(){function e(e){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var t=new s.default(this,"textTrack1"),r=new s.default(this,"textTrack2"),n=new s.default(this,"textTrack3"),o=new s.default(this,"textTrack4");this.cea608Parser1=new a.default(1,t,r),this.cea608Parser2=new a.default(3,n,o)}e.on(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(i.Events.FRAG_LOADING,this.onFragLoading,this),e.on(i.Events.FRAG_LOADED,this.onFragLoaded,this),e.on(i.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(i.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(i.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(i.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var t=e.prototype;return t.destroy=function(){var e=this.hls;e.off(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(i.Events.FRAG_LOADING,this.onFragLoading,this),e.off(i.Events.FRAG_LOADED,this.onFragLoaded,this),e.off(i.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(i.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(i.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(i.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},t.addCues=function(e,t,r,n,a){for(var s,o,l,u,c=!1,d=a.length;d--;){var f=a[d],h=(s=f[0],o=f[1],l=t,u=r,Math.min(o,u)-Math.max(s,l));if(h>=0&&(f[0]=Math.min(f[0],t),f[1]=Math.max(f[1],r),c=!0,h/(r-t)>.5))return}if(c||a.push([t,r]),this.config.renderTextTracksNatively){var p=this.captionsTracks[e];this.Cues.newCue(p,t,r,n)}else{var v=this.Cues.newCue(null,t,r,n);this.hls.trigger(i.Events.CUES_PARSED,{type:"captions",cues:v,track:e})}},t.onInitPtsFound=function(e,t){var r=this,n=t.frag,a=t.id,s=t.initPTS,o=t.timescale,l=this.unparsedVttFrags;"main"===a&&(this.initPTS[n.cc]=s,this.timescale[n.cc]=o),l.length&&(this.unparsedVttFrags=[],l.forEach((function(e){r.onFragLoaded(i.Events.FRAG_LOADED,e)})))},t.getExistingTrack=function(e){var t=this.media;if(t)for(var r=0;r<t.textTracks.length;r++){var n=t.textTracks[r];if(n[e])return n}return null},t.createCaptionsTrack=function(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)},t.createNativeTrack=function(e){if(!this.captionsTracks[e]){var t=this.captionsProperties,r=this.captionsTracks,n=this.media,i=t[e],a=i.label,s=i.languageCode,o=this.getExistingTrack(e);if(o)r[e]=o,Object(l.clearCurrentCues)(r[e]),Object(l.sendAddTrackEvent)(r[e],n);else{var u=this.createTextTrack("captions",a,s);u&&(u[e]=!0,r[e]=u)}}},t.createNonNativeTrack=function(e){if(!this.nonNativeCaptionsTracks[e]){var t=this.captionsProperties[e];if(t){var r={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(i.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}}},t.createTextTrack=function(e,t,r){var n=this.media;if(n)return n.addTextTrack(e,t,r)},t.onMediaAttaching=function(e,t){this.media=t.media,this._cleanTracks()},t.onMediaDetaching=function(){var e=this.captionsTracks;Object.keys(e).forEach((function(t){Object(l.clearCurrentCues)(e[t]),delete e[t]})),this.nonNativeCaptionsTracks={}},t.onManifestLoading=function(){this.lastSn=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},t._cleanTracks=function(){var e=this.media;if(e){var t=e.textTracks;if(t)for(var r=0;r<t.length;r++)Object(l.clearCurrentCues)(t[r])}},t.onSubtitleTracksUpdated=function(e,t){var r=this;this.textTracks=[];var n=t.subtitleTracks||[],a=n.some((function(e){return e.textCodec===u.IMSC1_CODEC}));if(this.config.enableWebVTT||a&&this.config.enableIMSC1){var s=this.tracks&&n&&this.tracks.length===n.length;if(this.tracks=n||[],this.config.renderTextTracksNatively){var o=this.media?this.media.textTracks:[];this.tracks.forEach((function(e,t){var n;if(t<o.length){for(var i=null,a=0;a<o.length;a++)if(h(o[a],e)){i=o[a];break}i&&(n=i)}n?Object(l.clearCurrentCues)(n):(n=r.createTextTrack("subtitles",e.name,e.lang))&&(n.mode="disabled"),n&&(n.groupId=e.groupId,r.textTracks.push(n))}))}else if(!s&&this.tracks&&this.tracks.length){var c=this.tracks.map((function(e){return{label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}}));this.hls.trigger(i.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},t.onManifestLoaded=function(e,t){var r=this;this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((function(e){var t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(t){var n="textTrack"+t[1],i=r.captionsProperties[n];i&&(i.label=e.name,e.lang&&(i.languageCode=e.lang),i.media=e)}}))},t.onFragLoading=function(e,t){var r=this.cea608Parser1,n=this.cea608Parser2,i=this.lastSn;if(this.enabled&&r&&n&&t.frag.type===c.PlaylistLevelType.MAIN){var a=t.frag.sn;a!==i+1&&(r.reset(),n.reset()),this.lastSn=a}},t.onFragLoaded=function(e,t){var r=t.frag,a=t.payload,s=this.initPTS,o=this.unparsedVttFrags;if(r.type===c.PlaylistLevelType.SUBTITLE)if(a.byteLength){if(!Object(n.isFiniteNumber)(s[r.cc]))return o.push(t),void(s.length&&this.hls.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Missing initial subtitle PTS")}));var l=r.decryptdata;if(null==l||null==l.key||"AES-128"!==l.method){var d=this.tracks[r.level],f=this.vttCCs;f[r.cc]||(f[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),d&&d.textCodec===u.IMSC1_CODEC?this._parseIMSC1(r,a):this._parseVTTs(r,a,f)}}else this.hls.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})},t._parseIMSC1=function(e,t){var r=this,n=this.hls;Object(u.parseIMSC1)(t,this.initPTS[e.cc],this.timescale[e.cc],(function(t){r._appendCues(t,e.level),n.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(t){d.logger.log("Failed to parse IMSC1: "+t),n.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))},t._parseVTTs=function(e,t,r){var n=this,a=this.hls;Object(o.parseWebVTT)(t,this.initPTS[e.cc],this.timescale[e.cc],r,e.cc,e.start,(function(t){n._appendCues(t,e.level),a.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(function(r){n._fallbackToIMSC1(e,t),d.logger.log("Failed to parse VTT cue: "+r),a.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})}))},t._fallbackToIMSC1=function(e,t){var r=this,n=this.tracks[e.level];n.textCodec||Object(u.parseIMSC1)(t,this.initPTS[e.cc],this.timescale[e.cc],(function(){n.textCodec=u.IMSC1_CODEC,r._parseIMSC1(e,t)}),(function(){n.textCodec="wvtt"}))},t._appendCues=function(e,t){var r=this.hls;if(this.config.renderTextTracksNatively){var n=this.textTracks[t];if("disabled"===n.mode)return;e.forEach((function(e){return Object(l.addCueToTrack)(n,e)}))}else{var a=this.tracks[t].default?"default":"subtitles"+t;r.trigger(i.Events.CUES_PARSED,{type:"subtitles",cues:e,track:a})}},t.onFragDecrypted=function(e,t){var r=t.frag;if(r.type===c.PlaylistLevelType.SUBTITLE){if(!Object(n.isFiniteNumber)(this.initPTS[r.cc]))return void this.unparsedVttFrags.push(t);this.onFragLoaded(i.Events.FRAG_LOADED,t)}},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(e,t){var r=this.cea608Parser1,n=this.cea608Parser2;if(this.enabled&&r&&n)for(var i=0;i<t.samples.length;i++){var a=t.samples[i].bytes;if(a){var s=this.extractCea608Data(a);r.addData(t.samples[i].pts,s[0]),n.addData(t.samples[i].pts,s[1])}}},t.onBufferFlushing=function(e,t){var r=t.startOffset,n=t.endOffset,i=t.type;if(!i||"video"===i){var a=this.media;if(!a||a.currentTime<n)return;var s=this.captionsTracks;Object.keys(s).forEach((function(e){return Object(l.removeCuesInRange)(s[e],r,n)}))}},t.extractCea608Data=function(e){for(var t=31&e[0],r=2,n=[[],[]],i=0;i<t;i++){var a=e[r++],s=127&e[r++],o=127&e[r++],l=3&a;0===s&&0===o||0!=(4&a)&&(0!==l&&1!==l||(n[l].push(s),n[l].push(o)))}return n},e}();function h(e,t){return e&&e.label===t.name&&!(e.textTrack1||e.textTrack2)}},"./src/crypt/aes-crypto.ts":
116
116
  /*!*********************************!*\
117
117
  !*** ./src/crypt/aes-crypto.ts ***!
118
118
  \*********************************/
119
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return n}));var n=function(){function t(t,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=t,this.aesIV=e}return t.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},t}()},"./src/crypt/aes-decryptor.ts":
119
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return n}));var n=function(){function e(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}return e.prototype.decrypt=function(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)},e}()},"./src/crypt/aes-decryptor.ts":
120
120
  /*!************************************!*\
121
121
  !*** ./src/crypt/aes-decryptor.ts ***!
122
122
  \************************************/
123
- /*! exports provided: removePadding, default */function(t,e,r){r.r(e),r.d(e,"removePadding",(function(){return i})),r.d(e,"default",(function(){return a}));var n=r(/*! ../utils/typed-array */"./src/utils/typed-array.ts");function i(t){var e=t.byteLength,r=e&&new DataView(t.buffer).getUint8(e-1);return r?Object(n.sliceUint8)(t,0,e-r):t}var a=function(){function t(){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 e=t.prototype;return e.uint8ArrayToUint32Array_=function(t){for(var e=new DataView(t),r=new Uint32Array(4),n=0;n<4;n++)r[n]=e.getUint32(4*n);return r},e.initTable=function(){var t=this.sBox,e=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,t[h]=g,e[g]=h;var m=f[h],y=f[m],E=f[y],T=257*f[g]^16843008*g;n[h]=T<<24|T>>>8,i[h]=T<<16|T>>>16,a[h]=T<<8|T>>>24,s[h]=T,T=16843009*E^65537*y^257*m^16843008*h,u[g]=T<<24|T>>>8,l[g]=T<<16|T>>>16,c[g]=T<<8|T>>>24,d[g]=T,h?(h=m^f[f[f[E^m]]],p^=f[f[p]]):h=p=1}},e.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),r=!0,n=0;n<e.length&&r;)r=e[n]===this.key[n],n++;if(!r){this.key=e;var i=this.keySize=e.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]=e[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}},e.networkToHostOrderSwap=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},e.decrypt=function(t,e,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,T=this.invSubMix,_=T[0],b=T[1],A=T[2],S=T[3],L=this.uint8ArrayToUint32Array_(r),k=L[0],w=L[1],D=L[2],R=L[3],O=new Int32Array(t),C=new Int32Array(O.length),I=this.networkToHostOrderSwap;e<O.length;){for(d=I(O[e]),f=I(O[e+1]),h=I(O[e+2]),p=I(O[e+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=_[o>>>24]^b[u>>16&255]^A[l>>8&255]^S[255&c]^y[v],i=_[u>>>24]^b[l>>16&255]^A[c>>8&255]^S[255&o]^y[v+1],a=_[l>>>24]^b[c>>16&255]^A[o>>8&255]^S[255&u]^y[v+2],s=_[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[e]=I(n^k),C[e+1]=I(s^w),C[e+2]=I(a^D),C[e+3]=I(i^R),k=d,w=f,D=h,R=p,e+=4}return C.buffer},t}()},"./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,l=o[0],u=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,l[g]=_<<24|_>>>8,u[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,l,u=this.ksRows=4*(i+6+1),c=this.keySchedule=new Uint32Array(u),d=this.invKeySchedule=new Uint32Array(u),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<u;a++)a<i?o=c[a]=t[a]:(l=o,a%i==0?(l=f[(l=l<<8|l>>>24)>>>24]<<24|f[l>>>16&255]<<16|f[l>>>8&255]<<8|f[255&l],l^=h[a/i|0]<<24):i>6&&a%i==4&&(l=f[l>>>24]<<24|f[l>>>16&255]<<16|f[l>>>8&255]<<8|f[255&l]),c[a]=o=(c[a-i]^l)>>>0);for(s=0;s<u;s++)a=u-s,l=3&s?c[a]:c[a-4],d[s]=s<4||a<=4?l:v[f[l>>>24]]^g[f[l>>>16&255]]^m[f[l>>>8&255]]^y[f[255&l]],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,l,u,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),w=L[0],k=L[1],R=L[2],D=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],l=p^y[1],u=h^y[2],c=f^y[3],v=4,g=1;g<m;g++)n=T[o>>>24]^b[l>>16&255]^A[u>>8&255]^S[255&c]^y[v],i=T[l>>>24]^b[u>>16&255]^A[c>>8&255]^S[255&o]^y[v+1],a=T[u>>>24]^b[c>>16&255]^A[o>>8&255]^S[255&l]^y[v+2],s=T[c>>>24]^b[o>>16&255]^A[l>>8&255]^S[255&u]^y[v+3],o=n,l=i,u=a,c=s,v+=4;n=E[o>>>24]<<24^E[l>>16&255]<<16^E[u>>8&255]<<8^E[255&c]^y[v],i=E[l>>>24]<<24^E[u>>16&255]<<16^E[c>>8&255]<<8^E[255&o]^y[v+1],a=E[u>>>24]<<24^E[c>>16&255]<<16^E[o>>8&255]<<8^E[255&l]^y[v+2],s=E[c>>>24]<<24^E[o>>16&255]<<16^E[l>>8&255]<<8^E[255&u]^y[v+3],C[t]=I(n^w),C[t+1]=I(s^k),C[t+2]=I(a^R),C[t+3]=I(i^D),w=d,k=f,R=h,D=p,t+=4}return C.buffer},e}()},"./src/crypt/decrypter.ts":
124
124
  /*!********************************!*\
125
125
  !*** ./src/crypt/decrypter.ts ***!
126
126
  \********************************/
127
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return l}));var n=r(/*! ./aes-crypto */"./src/crypt/aes-crypto.ts"),i=r(/*! ./fast-aes-key */"./src/crypt/fast-aes-key.ts"),a=r(/*! ./aes-decryptor */"./src/crypt/aes-decryptor.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),u=r(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),l=function(){function t(t,e,r){var n=(void 0===r?{}:r).removePKCS7Padding,i=void 0===n||n;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=t,this.config=e,this.removePKCS7Padding=i,i)try{var a=self.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(t){}null===this.subtle&&(this.config.enableSoftwareAES=!0)}var e=t.prototype;return e.destroy=function(){this.observer=null},e.isSync=function(){return this.config.enableSoftwareAES},e.flush=function(){var t=this.currentResult;if(t){var e=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?Object(a.removePadding)(e):e}this.reset()},e.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},e.decrypt=function(t,e,r,n){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(t),e,r);var i=this.flush();i&&n(i.buffer)}else this.webCryptoDecrypt(new Uint8Array(t),e,r).then(n)},e.softwareDecrypt=function(t,e,r){var n=this.currentIV,i=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(t=Object(o.appendUint8Array)(s,t),this.remainderData=null);var l=this.getValidChunk(t);if(!l.length)return null;n&&(r=n);var c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new a.default),c.expandKey(e);var d=i;return this.currentResult=c.decrypt(l.buffer,0,r),this.currentIV=Object(u.sliceUint8)(l,-16).buffer,d||null},e.webCryptoDecrypt=function(t,e,r){var a=this,s=this.subtle;return this.key===e&&this.fastAesKey||(this.key=e,this.fastAesKey=new i.default(s,e)),this.fastAesKey.expandKey().then((function(e){return s?new n.default(s,r).decrypt(t.buffer,e):Promise.reject(new Error("web crypto not initialized"))})).catch((function(n){return a.onWebCryptoError(n,t,e,r)}))},e.onWebCryptoError=function(t,e,r,n){return s.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",t),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(e,r,n)},e.getValidChunk=function(t){var e=t,r=t.length-t.length%16;return r!==t.length&&(e=Object(u.sliceUint8)(t,0,r),this.remainderData=Object(u.sliceUint8)(t,r)),e},e.logOnce=function(t){this.logEnabled&&(s.logger.log("[decrypter.ts]: "+t),this.logEnabled=!1)},t}()},"./src/crypt/fast-aes-key.ts":
127
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return u}));var n=r(/*! ./aes-crypto */"./src/crypt/aes-crypto.ts"),i=r(/*! ./fast-aes-key */"./src/crypt/fast-aes-key.ts"),a=r(/*! ./aes-decryptor */"./src/crypt/aes-decryptor.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),l=r(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),u=function(){function e(e,t,r){var n=(void 0===r?{}:r).removePKCS7Padding,i=void 0===n||n;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=e,this.config=t,this.removePKCS7Padding=i,i)try{var a=self.crypto;a&&(this.subtle=a.subtle||a.webkitSubtle)}catch(e){}null===this.subtle&&(this.config.enableSoftwareAES=!0)}var t=e.prototype;return t.destroy=function(){this.observer=null},t.isSync=function(){return this.config.enableSoftwareAES},t.flush=function(){var e=this.currentResult;if(e){var t=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Object(a.removePadding)(t):t}this.reset()},t.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},t.decrypt=function(e,t,r,n){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(e),t,r);var i=this.flush();i&&n(i.buffer)}else this.webCryptoDecrypt(new Uint8Array(e),t,r).then(n)},t.softwareDecrypt=function(e,t,r){var n=this.currentIV,i=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(e=Object(o.appendUint8Array)(s,e),this.remainderData=null);var u=this.getValidChunk(e);if(!u.length)return null;n&&(r=n);var c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new a.default),c.expandKey(t);var d=i;return this.currentResult=c.decrypt(u.buffer,0,r),this.currentIV=Object(l.sliceUint8)(u,-16).buffer,d||null},t.webCryptoDecrypt=function(e,t,r){var a=this,s=this.subtle;return this.key===t&&this.fastAesKey||(this.key=t,this.fastAesKey=new i.default(s,t)),this.fastAesKey.expandKey().then((function(t){return s?new n.default(s,r).decrypt(e.buffer,t):Promise.reject(new Error("web crypto not initialized"))})).catch((function(n){return a.onWebCryptoError(n,e,t,r)}))},t.onWebCryptoError=function(e,t,r,n){return s.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",e),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(t,r,n)},t.getValidChunk=function(e){var t=e,r=e.length-e.length%16;return r!==e.length&&(t=Object(l.sliceUint8)(e,0,r),this.remainderData=Object(l.sliceUint8)(e,r)),t},t.logOnce=function(e){this.logEnabled&&(s.logger.log("[decrypter.ts]: "+e),this.logEnabled=!1)},e}()},"./src/crypt/fast-aes-key.ts":
128
128
  /*!***********************************!*\
129
129
  !*** ./src/crypt/fast-aes-key.ts ***!
130
130
  \***********************************/
131
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return n}));var n=function(){function t(t,e){this.subtle=void 0,this.key=void 0,this.subtle=t,this.key=e}return t.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},t}()},"./src/demux/aacdemuxer.ts":
131
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return n}));var n=function(){function e(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}return e.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},e}()},"./src/demux/aacdemuxer.ts":
132
132
  /*!*********************************!*\
133
133
  !*** ./src/demux/aacdemuxer.ts ***!
134
134
  \*********************************/
135
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),i=r(/*! ./adts */"./src/demux/adts.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ../demux/id3 */"./src/demux/id3.ts");function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var u=function(t){var e,r;function n(e,r){var n;return(n=t.call(this)||this).observer=void 0,n.config=void 0,n.observer=e,n.config=r,n}r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,o(e,r);var u=n.prototype;return u.resetInitSegment=function(e,r,n){t.prototype.resetInitSegment.call(this,e,r,n),this._audioTrack={container:"audio/adts",type:"audio",id:0,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:e,duration:n,inputTimeScale:9e4,dropped:0}},n.probe=function(t){if(!t)return!1;for(var e=(s.getID3Data(t,0)||[]).length,r=t.length;e<r;e++)if(i.probe(t,e))return a.logger.log("ADTS sync word found !"),!0;return!1},u.canParse=function(t,e){return i.canParse(t,e)},u.appendFrame=function(t,e,r){return i.initTrackConfig(t,this.observer,e,r,t.manifestCodec),i.appendFrame(t,e,r,this.initPTS,this.frameIndex)},n}(n.default);u.minProbeByteLength=9,e.default=u},"./src/demux/adts.ts":
135
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),i=r(/*! ./adts */"./src/demux/adts.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ../demux/id3 */"./src/demux/id3.ts");function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l=function(e){var t,r;function n(t,r){var n;return(n=e.call(this)||this).observer=void 0,n.config=void 0,n.observer=t,n.config=r,n}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,o(t,r);var l=n.prototype;return l.resetInitSegment=function(t,r,n){e.prototype.resetInitSegment.call(this,t,r,n),this._audioTrack={container:"audio/adts",type:"audio",id:0,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}},n.probe=function(e){if(!e)return!1;for(var t=(s.getID3Data(e,0)||[]).length,r=e.length;t<r;t++)if(i.probe(e,t))return a.logger.log("ADTS sync word found !"),!0;return!1},l.canParse=function(e,t){return i.canParse(e,t)},l.appendFrame=function(e,t,r){return i.initTrackConfig(e,this.observer,t,r,e.manifestCodec),i.appendFrame(e,t,r,this.initPTS,this.frameIndex)},n}(n.default);l.minProbeByteLength=9,t.default=l},"./src/demux/adts.ts":
136
136
  /*!***************************!*\
137
137
  !*** ./src/demux/adts.ts ***!
138
138
  \***************************/
139
- /*! exports provided: getAudioConfig, isHeaderPattern, getHeaderLength, getFullFrameLength, canGetFrameLength, isHeader, canParse, probe, initTrackConfig, getFrameDuration, parseFrameHeader, appendFrame */function(t,e,r){r.r(e),r.d(e,"getAudioConfig",(function(){return s})),r.d(e,"isHeaderPattern",(function(){return o})),r.d(e,"getHeaderLength",(function(){return u})),r.d(e,"getFullFrameLength",(function(){return l})),r.d(e,"canGetFrameLength",(function(){return c})),r.d(e,"isHeader",(function(){return d})),r.d(e,"canParse",(function(){return f})),r.d(e,"probe",(function(){return h})),r.d(e,"initTrackConfig",(function(){return p})),r.d(e,"getFrameDuration",(function(){return v})),r.d(e,"parseFrameHeader",(function(){return g})),r.d(e,"appendFrame",(function(){return m}));var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../events */"./src/events.ts");function s(t,e,r,s){var o,u,l,c,d=navigator.userAgent.toLowerCase(),f=s,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];o=1+((192&e[r+2])>>>6);var p=(60&e[r+2])>>>2;if(!(p>h.length-1))return l=(1&e[r+2])<<2,l|=(192&e[r+3])>>>6,n.logger.log("manifest codec:"+s+", ADTS type:"+o+", samplingIndex:"+p),/firefox/i.test(d)?p>=6?(o=5,c=new Array(4),u=p-3):(o=2,c=new Array(2),u=p):-1!==d.indexOf("android")?(o=2,c=new Array(2),u=p):(o=5,c=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&p>=6?u=p-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(p>=6&&1===l||/vivaldi/i.test(d))||!s&&1===l)&&(o=2,c=new Array(2)),u=p)),c[0]=o<<3,c[0]|=(14&p)>>1,c[1]|=(1&p)<<7,c[1]|=l<<3,5===o&&(c[1]|=(14&u)>>1,c[2]=(1&u)<<7,c[2]|=8,c[3]=0),{config:c,samplerate:h[p],channelCount:l,codec:"mp4a.40."+o,manifestCodec:f};t.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+p})}function o(t,e){return 255===t[e]&&240==(246&t[e+1])}function u(t,e){return 1&t[e+1]?7:9}function l(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function c(t,e){return e+5<t.length}function d(t,e){return e+1<t.length&&o(t,e)}function f(t,e){return c(t,e)&&o(t,e)&&l(t,e)<=t.length-e}function h(t,e){if(d(t,e)){var r=u(t,e);if(e+r>=t.length)return!1;var n=l(t,e);if(n<=r)return!1;var i=e+n;return i===t.length||d(t,i)}return!1}function p(t,e,r,i,a){if(!t.samplerate){var o=s(e,r,i,a);if(!o)return;t.config=o.config,t.samplerate=o.samplerate,t.channelCount=o.channelCount,t.codec=o.codec,t.manifestCodec=o.manifestCodec,n.logger.log("parsed codec:"+t.codec+", rate:"+o.samplerate+", channels:"+o.channelCount)}}function v(t){return 9216e4/t}function g(t,e,r,n,i){var a=t.length,s=u(t,e),o=l(t,e);if((o-=s)>0&&e+s+o<=a)return{headerLength:s,frameLength:o,stamp:r+n*i}}function m(t,e,r,n,i){var a=g(e,r,n,i,v(t.samplerate));if(a){var s=a.stamp,o=a.headerLength,u=a.frameLength,l={unit:e.subarray(r+o,r+o+u),pts:s,dts:s};return t.samples.push(l),{sample:l,length:u+o}}}},"./src/demux/base-audio-demuxer.ts":
139
+ /*! exports provided: getAudioConfig, isHeaderPattern, getHeaderLength, getFullFrameLength, canGetFrameLength, isHeader, canParse, probe, initTrackConfig, getFrameDuration, parseFrameHeader, appendFrame */function(e,t,r){r.r(t),r.d(t,"getAudioConfig",(function(){return s})),r.d(t,"isHeaderPattern",(function(){return o})),r.d(t,"getHeaderLength",(function(){return l})),r.d(t,"getFullFrameLength",(function(){return u})),r.d(t,"canGetFrameLength",(function(){return c})),r.d(t,"isHeader",(function(){return d})),r.d(t,"canParse",(function(){return f})),r.d(t,"probe",(function(){return h})),r.d(t,"initTrackConfig",(function(){return p})),r.d(t,"getFrameDuration",(function(){return v})),r.d(t,"parseFrameHeader",(function(){return g})),r.d(t,"appendFrame",(function(){return m}));var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../events */"./src/events.ts");function s(e,t,r,s){var o,l,u,c,d=navigator.userAgent.toLowerCase(),f=s,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];o=1+((192&t[r+2])>>>6);var p=(60&t[r+2])>>>2;if(!(p>h.length-1))return u=(1&t[r+2])<<2,u|=(192&t[r+3])>>>6,n.logger.log("manifest codec:"+s+", ADTS type:"+o+", samplingIndex:"+p),/firefox/i.test(d)?p>=6?(o=5,c=new Array(4),l=p-3):(o=2,c=new Array(2),l=p):-1!==d.indexOf("android")?(o=2,c=new Array(2),l=p):(o=5,c=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&p>=6?l=p-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(p>=6&&1===u||/vivaldi/i.test(d))||!s&&1===u)&&(o=2,c=new Array(2)),l=p)),c[0]=o<<3,c[0]|=(14&p)>>1,c[1]|=(1&p)<<7,c[1]|=u<<3,5===o&&(c[1]|=(14&l)>>1,c[2]=(1&l)<<7,c[2]|=8,c[3]=0),{config:c,samplerate:h[p],channelCount:u,codec:"mp4a.40."+o,manifestCodec:f};e.trigger(a.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+p})}function o(e,t){return 255===e[t]&&240==(246&e[t+1])}function l(e,t){return 1&e[t+1]?7:9}function u(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function c(e,t){return t+5<e.length}function d(e,t){return t+1<e.length&&o(e,t)}function f(e,t){return c(e,t)&&o(e,t)&&u(e,t)<=e.length-t}function h(e,t){if(d(e,t)){var r=l(e,t);if(t+r>=e.length)return!1;var n=u(e,t);if(n<=r)return!1;var i=t+n;return i===e.length||d(e,i)}return!1}function p(e,t,r,i,a){if(!e.samplerate){var o=s(t,r,i,a);if(!o)return;e.config=o.config,e.samplerate=o.samplerate,e.channelCount=o.channelCount,e.codec=o.codec,e.manifestCodec=o.manifestCodec,n.logger.log("parsed codec:"+e.codec+", rate:"+o.samplerate+", channels:"+o.channelCount)}}function v(e){return 9216e4/e}function g(e,t,r,n,i){var a=e.length,s=l(e,t),o=u(e,t);if((o-=s)>0&&t+s+o<=a)return{headerLength:s,frameLength:o,stamp:r+n*i}}function m(e,t,r,n,i){var a=g(t,r,n,i,v(e.samplerate));if(a){var s=a.stamp,o=a.headerLength,l=a.frameLength,u={unit:t.subarray(r+o,r+o+l),pts:s,dts:s};return e.samples.push(u),{sample:u,length:l+o}}}},"./src/demux/base-audio-demuxer.ts":
140
140
  /*!*****************************************!*\
141
141
  !*** ./src/demux/base-audio-demuxer.ts ***!
142
142
  \*****************************************/
143
- /*! exports provided: initPTSFn, default */function(t,e,r){r.r(e),r.d(e,"initPTSFn",(function(){return l}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../demux/id3 */"./src/demux/id3.ts"),a=r(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),s=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),o=r(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),u=function(){function t(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var e=t.prototype;return e.resetInitSegment=function(t,e,r){this._id3Track={type:"id3",id:0,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},e.resetTimeStamp=function(){},e.resetContiguity=function(){},e.canParse=function(t,e){return!1},e.appendFrame=function(t,e,r){},e.demux=function(t,e){this.cachedData&&(t=Object(s.appendUint8Array)(this.cachedData,t),this.cachedData=null);var r,n,u=i.getID3Data(t,0),c=u?u.length:0,d=this._audioTrack,f=this._id3Track,h=u?i.getTimeStamp(u):void 0,p=t.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=l(h,e)),u&&u.length>0&&f.samples.push({pts:this.initPTS,dts:this.initPTS,data:u}),n=this.initPTS;c<p;){if(this.canParse(t,c)){var v=this.appendFrame(d,t,c);v?(this.frameIndex++,n=v.sample.pts,r=c+=v.length):c=p}else i.canParse(t,c)?(u=i.getID3Data(t,c),f.samples.push({pts:n,dts:n,data:u}),r=c+=u.length):c++;if(c===p&&r!==p){var g=Object(o.sliceUint8)(t,r);this.cachedData?this.cachedData=Object(s.appendUint8Array)(this.cachedData,g):this.cachedData=g}}return{audioTrack:d,avcTrack:Object(a.dummyTrack)(),id3Track:f,textTrack:Object(a.dummyTrack)()}},e.demuxSampleAes=function(t,e,r){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},e.flush=function(t){var e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(a.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(a.dummyTrack)()}},e.destroy=function(){},t}(),l=function(t,e){return Object(n.isFiniteNumber)(t)?90*t:9e4*e};e.default=u},"./src/demux/chunk-cache.ts":
143
+ /*! exports provided: initPTSFn, default */function(e,t,r){r.r(t),r.d(t,"initPTSFn",(function(){return u}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../demux/id3 */"./src/demux/id3.ts"),a=r(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),s=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),o=r(/*! ../utils/typed-array */"./src/utils/typed-array.ts"),l=function(){function e(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var t=e.prototype;return t.resetInitSegment=function(e,t,r){this._id3Track={type:"id3",id:0,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},t.resetTimeStamp=function(){},t.resetContiguity=function(){},t.canParse=function(e,t){return!1},t.appendFrame=function(e,t,r){},t.demux=function(e,t){this.cachedData&&(e=Object(s.appendUint8Array)(this.cachedData,e),this.cachedData=null);var r,n,l=i.getID3Data(e,0),c=l?l.length:0,d=this._audioTrack,f=this._id3Track,h=l?i.getTimeStamp(l):void 0,p=e.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=u(h,t)),l&&l.length>0&&f.samples.push({pts:this.initPTS,dts:this.initPTS,data:l}),n=this.initPTS;c<p;){if(this.canParse(e,c)){var v=this.appendFrame(d,e,c);v?(this.frameIndex++,n=v.sample.pts,r=c+=v.length):c=p}else i.canParse(e,c)?(l=i.getID3Data(e,c),f.samples.push({pts:n,dts:n,data:l}),r=c+=l.length):c++;if(c===p&&r!==p){var g=Object(o.sliceUint8)(e,r);this.cachedData?this.cachedData=Object(s.appendUint8Array)(this.cachedData,g):this.cachedData=g}}return{audioTrack:d,avcTrack:Object(a.dummyTrack)(),id3Track:f,textTrack:Object(a.dummyTrack)()}},t.demuxSampleAes=function(e,t,r){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},t.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(a.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(a.dummyTrack)()}},t.destroy=function(){},e}(),u=function(e,t){return Object(n.isFiniteNumber)(e)?90*e:9e4*t};t.default=l},"./src/demux/chunk-cache.ts":
144
144
  /*!**********************************!*\
145
145
  !*** ./src/demux/chunk-cache.ts ***!
146
146
  \**********************************/
147
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return n}));var n=function(){function t(){this.chunks=[],this.dataLength=0}var e=t.prototype;return e.push=function(t){this.chunks.push(t),this.dataLength+=t.length},e.flush=function(){var t,e=this.chunks,r=this.dataLength;return e.length?(t=1===e.length?e[0]:function(t,e){for(var r=new Uint8Array(e),n=0,i=0;i<t.length;i++){var a=t[i];r.set(a,n),n+=a.length}return r}(e,r),this.reset(),t):new Uint8Array(0)},e.reset=function(){this.chunks.length=0,this.dataLength=0},t}()},"./src/demux/dummy-demuxed-track.ts":
147
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return n}));var n=function(){function e(){this.chunks=[],this.dataLength=0}var t=e.prototype;return t.push=function(e){this.chunks.push(e),this.dataLength+=e.length},t.flush=function(){var e,t=this.chunks,r=this.dataLength;return t.length?(e=1===t.length?t[0]:function(e,t){for(var r=new Uint8Array(t),n=0,i=0;i<e.length;i++){var a=e[i];r.set(a,n),n+=a.length}return r}(t,r),this.reset(),e):new Uint8Array(0)},t.reset=function(){this.chunks.length=0,this.dataLength=0},e}()},"./src/demux/dummy-demuxed-track.ts":
148
148
  /*!******************************************!*\
149
149
  !*** ./src/demux/dummy-demuxed-track.ts ***!
150
150
  \******************************************/
151
- /*! exports provided: dummyTrack */function(t,e,r){function n(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}r.r(e),r.d(e,"dummyTrack",(function(){return n}))},"./src/demux/exp-golomb.ts":
151
+ /*! exports provided: dummyTrack */function(e,t,r){function n(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}r.r(t),r.d(t,"dummyTrack",(function(){return n}))},"./src/demux/exp-golomb.ts":
152
152
  /*!*********************************!*\
153
153
  !*** ./src/demux/exp-golomb.ts ***!
154
154
  \*********************************/
155
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=function(){function t(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}var e=t.prototype;return e.loadWord=function(){var t=this.data,e=this.bytesAvailable,r=t.byteLength-e,n=new Uint8Array(4),i=Math.min(4,e);if(0===i)throw new Error("no bytes available");n.set(t.subarray(r,r+i)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i},e.skipBits=function(t){var e;this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,t-=(e=t>>3)>>3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)},e.readBits=function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&n.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),(e=t-e)>0&&this.bitsAvailable?r<<e|this.readBits(e):r},e.skipLZ=function(){var t;for(t=0;t<this.bitsAvailable;++t)if(0!=(this.word&2147483648>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()},e.skipUEG=function(){this.skipBits(1+this.skipLZ())},e.skipEG=function(){this.skipBits(1+this.skipLZ())},e.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},e.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},e.readBoolean=function(){return 1===this.readBits(1)},e.readUByte=function(){return this.readBits(8)},e.readUShort=function(){return this.readBits(16)},e.readUInt=function(){return this.readBits(32)},e.skipScalingList=function(t){for(var e=8,r=8,n=0;n<t;n++)0!==r&&(r=(e+this.readEG()+256)%256),e=0===r?e:r},e.readSPS=function(){var t,e,r,n=0,i=0,a=0,s=0,o=this.readUByte.bind(this),u=this.readBits.bind(this),l=this.readUEG.bind(this),c=this.readBoolean.bind(this),d=this.skipBits.bind(this),f=this.skipEG.bind(this),h=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);o();var v=o();if(u(5),d(3),o(),h(),100===v||110===v||122===v||244===v||44===v||83===v||86===v||118===v||128===v){var g=l();if(3===g&&d(1),h(),h(),d(1),c())for(e=3!==g?8:12,r=0;r<e;r++)c()&&p(r<6?16:64)}h();var m=l();if(0===m)l();else if(1===m)for(d(1),f(),f(),t=l(),r=0;r<t;r++)f();h(),d(1);var y=l(),E=l(),T=u(1);0===T&&d(1),d(1),c()&&(n=l(),i=l(),a=l(),s=l());var _=[1,1];if(c()&&c())switch(o()){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:_=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(y+1)-2*n-2*i),height:(2-T)*(E+1)*16-(T?2:4)*(a+s),pixelRatio:_}},e.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},t}();e.default=i},"./src/demux/id3.ts":
155
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i=function(){function e(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,r=e.byteLength-t,n=new Uint8Array(4),i=Math.min(4,t);if(0===i)throw new Error("no bytes available");n.set(e.subarray(r,r+i)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i},t.skipBits=function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return e>32&&n.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),(t=e-t)>0&&this.bitsAvailable?r<<t|this.readBits(t):r},t.skipLZ=function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!=(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){for(var t=8,r=8,n=0;n<e;n++)0!==r&&(r=(t+this.readEG()+256)%256),t=0===r?t:r},t.readSPS=function(){var e,t,r,n=0,i=0,a=0,s=0,o=this.readUByte.bind(this),l=this.readBits.bind(this),u=this.readUEG.bind(this),c=this.readBoolean.bind(this),d=this.skipBits.bind(this),f=this.skipEG.bind(this),h=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);o();var v=o();if(l(5),d(3),o(),h(),100===v||110===v||122===v||244===v||44===v||83===v||86===v||118===v||128===v){var g=u();if(3===g&&d(1),h(),h(),d(1),c())for(t=3!==g?8:12,r=0;r<t;r++)c()&&p(r<6?16:64)}h();var m=u();if(0===m)u();else if(1===m)for(d(1),f(),f(),e=u(),r=0;r<e;r++)f();h(),d(1);var y=u(),E=u(),_=l(1);0===_&&d(1),d(1),c()&&(n=u(),i=u(),a=u(),s=u());var T=[1,1];if(c()&&c())switch(o()){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:T=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(y+1)-2*n-2*i),height:(2-_)*(E+1)*16-(_?2:4)*(a+s),pixelRatio:T}},t.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},e}();t.default=i},"./src/demux/id3.ts":
156
156
  /*!**************************!*\
157
157
  !*** ./src/demux/id3.ts ***!
158
158
  \**************************/
159
- /*! exports provided: isHeader, isFooter, getID3Data, canParse, getTimeStamp, isTimeStampFrame, getID3Frames, decodeFrame, utf8ArrayToStr, testables */function(t,e,r){r.r(e),r.d(e,"isHeader",(function(){return i})),r.d(e,"isFooter",(function(){return a})),r.d(e,"getID3Data",(function(){return s})),r.d(e,"canParse",(function(){return u})),r.d(e,"getTimeStamp",(function(){return l})),r.d(e,"isTimeStampFrame",(function(){return c})),r.d(e,"getID3Frames",(function(){return f})),r.d(e,"decodeFrame",(function(){return h})),r.d(e,"utf8ArrayToStr",(function(){return y})),r.d(e,"testables",(function(){return E}));var n,i=function(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},a=function(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},s=function(t,e){for(var r=e,n=0;i(t,e);)n+=10,n+=o(t,e+6),a(t,e+10)&&(n+=10),e+=n;if(n>0)return t.subarray(r,r+n)},o=function(t,e){var r=0;return r=(127&t[e])<<21,r|=(127&t[e+1])<<14,r|=(127&t[e+2])<<7,r|=127&t[e+3]},u=function(t,e){return i(t,e)&&o(t,e+6)+10<=t.length-e},l=function(t){for(var e=f(t),r=0;r<e.length;r++){var n=e[r];if(c(n))return m(n)}},c=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},d=function(t){var e=String.fromCharCode(t[0],t[1],t[2],t[3]),r=o(t,4);return{type:e,size:r,data:t.subarray(10,10+r)}},f=function(t){for(var e=0,r=[];i(t,e);){for(var n=o(t,e+6),s=(e+=10)+n;e+8<s;){var u=d(t.subarray(e)),l=h(u);l&&r.push(l),e+=u.size+10}a(t,e)&&(e+=10)}return r},h=function(t){return"PRIV"===t.type?p(t):"W"===t.type[0]?g(t):v(t)},p=function(t){if(!(t.size<2)){var e=y(t.data,!0),r=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:r.buffer}}},v=function(t){if(!(t.size<2)){if("TXXX"===t.type){var e=1,r=y(t.data.subarray(e),!0);e+=r.length+1;var n=y(t.data.subarray(e));return{key:t.type,info:r,data:n}}var i=y(t.data.subarray(1));return{key:t.type,data:i}}},g=function(t){if("WXXX"===t.type){if(t.size<2)return;var e=1,r=y(t.data.subarray(e),!0);e+=r.length+1;var n=y(t.data.subarray(e));return{key:t.type,info:r,data:n}}var i=y(t.data);return{key:t.type,data:i}},m=function(t){if(8===t.data.byteLength){var e=new Uint8Array(t.data),r=1&e[3],n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,r&&(n+=47721858.84),Math.round(n)}},y=function(t,e){void 0===e&&(e=!1);var r=T();if(r){var n=r.decode(t);if(e){var i=n.indexOf("\0");return-1!==i?n.substring(0,i):n}return n.replace(/\0/g,"")}for(var a,s,o,u=t.length,l="",c=0;c<u;){if(0===(a=t[c++])&&e)return l;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(a);break;case 12:case 13:s=t[c++],l+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=t[c++],o=t[c++],l+=String.fromCharCode((15&a)<<12|(63&s)<<6|(63&o)<<0)}}return l},E={decodeTextFrame:v};function T(){return n||void 0===self.TextDecoder||(n=new self.TextDecoder("utf-8")),n}},"./src/demux/mp3demuxer.ts":
159
+ /*! exports provided: isHeader, isFooter, getID3Data, canParse, getTimeStamp, isTimeStampFrame, getID3Frames, decodeFrame, utf8ArrayToStr, testables */function(e,t,r){r.r(t),r.d(t,"isHeader",(function(){return i})),r.d(t,"isFooter",(function(){return a})),r.d(t,"getID3Data",(function(){return s})),r.d(t,"canParse",(function(){return l})),r.d(t,"getTimeStamp",(function(){return u})),r.d(t,"isTimeStampFrame",(function(){return c})),r.d(t,"getID3Frames",(function(){return f})),r.d(t,"decodeFrame",(function(){return h})),r.d(t,"utf8ArrayToStr",(function(){return y})),r.d(t,"testables",(function(){return E}));var n,i=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},a=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},s=function(e,t){for(var r=t,n=0;i(e,t);)n+=10,n+=o(e,t+6),a(e,t+10)&&(n+=10),t+=n;if(n>0)return e.subarray(r,r+n)},o=function(e,t){var r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,r|=(127&e[t+2])<<7,r|=127&e[t+3]},l=function(e,t){return i(e,t)&&o(e,t+6)+10<=e.length-t},u=function(e){for(var t=f(e),r=0;r<t.length;r++){var n=t[r];if(c(n))return m(n)}},c=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},d=function(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),r=o(e,4);return{type:t,size:r,data:e.subarray(10,10+r)}},f=function(e){for(var t=0,r=[];i(e,t);){for(var n=o(e,t+6),s=(t+=10)+n;t+8<s;){var l=d(e.subarray(t)),u=h(l);u&&r.push(u),t+=l.size+10}a(e,t)&&(t+=10)}return r},h=function(e){return"PRIV"===e.type?p(e):"W"===e.type[0]?g(e):v(e)},p=function(e){if(!(e.size<2)){var t=y(e.data,!0),r=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:r.buffer}}},v=function(e){if(!(e.size<2)){if("TXXX"===e.type){var t=1,r=y(e.data.subarray(t),!0);t+=r.length+1;var n=y(e.data.subarray(t));return{key:e.type,info:r,data:n}}var i=y(e.data.subarray(1));return{key:e.type,data:i}}},g=function(e){if("WXXX"===e.type){if(e.size<2)return;var t=1,r=y(e.data.subarray(t),!0);t+=r.length+1;var n=y(e.data.subarray(t));return{key:e.type,info:r,data:n}}var i=y(e.data);return{key:e.type,data:i}},m=function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),r=1&t[3],n=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return n/=45,r&&(n+=47721858.84),Math.round(n)}},y=function(e,t){void 0===t&&(t=!1);var r=_();if(r){var n=r.decode(e);if(t){var i=n.indexOf("\0");return-1!==i?n.substring(0,i):n}return n.replace(/\0/g,"")}for(var a,s,o,l=e.length,u="",c=0;c<l;){if(0===(a=e[c++])&&t)return u;if(0!==a&&3!==a)switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:u+=String.fromCharCode(a);break;case 12:case 13:s=e[c++],u+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=e[c++],o=e[c++],u+=String.fromCharCode((15&a)<<12|(63&s)<<6|(63&o)<<0)}}return u},E={decodeTextFrame:v};function _(){return n||void 0===self.TextDecoder||(n=new self.TextDecoder("utf-8")),n}},"./src/demux/mp3demuxer.ts":
160
160
  /*!*********************************!*\
161
161
  !*** ./src/demux/mp3demuxer.ts ***!
162
162
  \*********************************/
163
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),i=r(/*! ../demux/id3 */"./src/demux/id3.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ./mpegaudio */"./src/demux/mpegaudio.ts");function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var u=function(t){var e,r;function n(){return t.apply(this,arguments)||this}r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,o(e,r);var u=n.prototype;return u.resetInitSegment=function(e,r,n){t.prototype.resetInitSegment.call(this,e,r,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:0,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:e,duration:n,inputTimeScale:9e4,dropped:0}},n.probe=function(t){if(!t)return!1;for(var e=(i.getID3Data(t,0)||[]).length,r=t.length;e<r;e++)if(s.probe(t,e))return a.logger.log("MPEG Audio sync word found !"),!0;return!1},u.canParse=function(t,e){return s.canParse(t,e)},u.appendFrame=function(t,e,r){if(null!==this.initPTS)return s.appendFrame(t,e,r,this.initPTS,this.frameIndex)},n}(n.default);u.minProbeByteLength=4,e.default=u},"./src/demux/mp4demuxer.ts":
163
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ./base-audio-demuxer */"./src/demux/base-audio-demuxer.ts"),i=r(/*! ../demux/id3 */"./src/demux/id3.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! ./mpegaudio */"./src/demux/mpegaudio.ts");function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l=function(e){var t,r;function n(){return e.apply(this,arguments)||this}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,o(t,r);var l=n.prototype;return l.resetInitSegment=function(t,r,n){e.prototype.resetInitSegment.call(this,t,r,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:0,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}},n.probe=function(e){if(!e)return!1;for(var t=(i.getID3Data(e,0)||[]).length,r=e.length;t<r;t++)if(s.probe(e,t))return a.logger.log("MPEG Audio sync word found !"),!0;return!1},l.canParse=function(e,t){return s.canParse(e,t)},l.appendFrame=function(e,t,r){if(null!==this.initPTS)return s.appendFrame(e,t,r,this.initPTS,this.frameIndex)},n}(n.default);l.minProbeByteLength=4,t.default=l},"./src/demux/mp4demuxer.ts":
164
164
  /*!*********************************!*\
165
165
  !*** ./src/demux/mp4demuxer.ts ***!
166
166
  \*********************************/
167
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),i=r(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),a=function(){function t(t,e){this.remainderData=null,this.config=void 0,this.config=e}var e=t.prototype;return e.resetTimeStamp=function(){},e.resetInitSegment=function(){},e.resetContiguity=function(){},t.probe=function(t){return Object(n.findBox)({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0},e.demux=function(t){var e=t,r=Object(i.dummyTrack)();if(this.config.progressive){this.remainderData&&(e=Object(n.appendUint8Array)(this.remainderData,t));var a=Object(n.segmentValidRange)(e);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=e;return{audioTrack:Object(i.dummyTrack)(),avcTrack:r,id3Track:Object(i.dummyTrack)(),textTrack:Object(i.dummyTrack)()}},e.flush=function(){var t=Object(i.dummyTrack)();return t.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(i.dummyTrack)(),avcTrack:t,id3Track:Object(i.dummyTrack)(),textTrack:Object(i.dummyTrack)()}},e.demuxSampleAes=function(t,e,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},e.destroy=function(){},t}();a.minProbeByteLength=1024,e.default=a},"./src/demux/mpegaudio.ts":
167
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),i=r(/*! ./dummy-demuxed-track */"./src/demux/dummy-demuxed-track.ts"),a=function(){function e(e,t){this.remainderData=null,this.config=void 0,this.config=t}var t=e.prototype;return t.resetTimeStamp=function(){},t.resetInitSegment=function(){},t.resetContiguity=function(){},e.probe=function(e){return Object(n.findBox)({data:e,start:0,end:Math.min(e.length,16384)},["moof"]).length>0},t.demux=function(e){var t=e,r=Object(i.dummyTrack)();if(this.config.progressive){this.remainderData&&(t=Object(n.appendUint8Array)(this.remainderData,e));var a=Object(n.segmentValidRange)(t);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=t;return{audioTrack:Object(i.dummyTrack)(),avcTrack:r,id3Track:Object(i.dummyTrack)(),textTrack:Object(i.dummyTrack)()}},t.flush=function(){var e=Object(i.dummyTrack)();return e.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(i.dummyTrack)(),avcTrack:e,id3Track:Object(i.dummyTrack)(),textTrack:Object(i.dummyTrack)()}},t.demuxSampleAes=function(e,t,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},t.destroy=function(){},e}();a.minProbeByteLength=1024,t.default=a},"./src/demux/mpegaudio.ts":
168
168
  /*!********************************!*\
169
169
  !*** ./src/demux/mpegaudio.ts ***!
170
170
  \********************************/
171
- /*! exports provided: appendFrame, parseHeader, isHeaderPattern, isHeader, canParse, probe */function(t,e,r){r.r(e),r.d(e,"appendFrame",(function(){return u})),r.d(e,"parseHeader",(function(){return l})),r.d(e,"isHeaderPattern",(function(){return c})),r.d(e,"isHeader",(function(){return d})),r.d(e,"canParse",(function(){return f})),r.d(e,"probe",(function(){return h}));var n=null,i=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],a=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],s=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],o=[0,1,1,4];function u(t,e,r,n,i){if(!(r+24>e.length)){var a=l(e,r);if(a&&r+a.frameLength<=e.length){var s=n+i*(9e4*a.samplesPerFrame/a.sampleRate),o={unit:e.subarray(r,r+a.frameLength),pts:s,dts:s};return t.config=[],t.channelCount=a.channelCount,t.samplerate=a.sampleRate,t.samples.push(o),{sample:o,length:a.frameLength}}}}function l(t,e){var r=t[e+1]>>3&3,u=t[e+1]>>1&3,l=t[e+2]>>4&15,c=t[e+2]>>2&3;if(1!==r&&0!==l&&15!==l&&3!==c){var d=t[e+2]>>1&1,f=t[e+3]>>6,h=1e3*i[14*(3===r?3-u:3===u?3:4)+l-1],p=a[3*(3===r?0:2===r?1:2)+c],v=3===f?1:2,g=s[r][u],m=o[u],y=8*g*m,E=Math.floor(g*h/p+d)*m;if(null===n){var T=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);n=T?parseInt(T[1]):0}return!!n&&n<=87&&2===u&&h>=224e3&&0===f&&(t[e+3]=128|t[e+3]),{sampleRate:p,channelCount:v,frameLength:E,samplesPerFrame:y}}}function c(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])}function d(t,e){return e+1<t.length&&c(t,e)}function f(t,e){return c(t,e)&&4<=t.length-e}function h(t,e){if(e+1<t.length&&c(t,e)){var r=l(t,e),n=4;null!=r&&r.frameLength&&(n=r.frameLength);var i=e+n;return i===t.length||d(t,i)}return!1}},"./src/demux/sample-aes.ts":
171
+ /*! exports provided: appendFrame, parseHeader, isHeaderPattern, isHeader, canParse, probe */function(e,t,r){r.r(t),r.d(t,"appendFrame",(function(){return l})),r.d(t,"parseHeader",(function(){return u})),r.d(t,"isHeaderPattern",(function(){return c})),r.d(t,"isHeader",(function(){return d})),r.d(t,"canParse",(function(){return f})),r.d(t,"probe",(function(){return h}));var n=null,i=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],a=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],s=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],o=[0,1,1,4];function l(e,t,r,n,i){if(!(r+24>t.length)){var a=u(t,r);if(a&&r+a.frameLength<=t.length){var s=n+i*(9e4*a.samplesPerFrame/a.sampleRate),o={unit:t.subarray(r,r+a.frameLength),pts:s,dts:s};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(o),{sample:o,length:a.frameLength}}}}function u(e,t){var r=e[t+1]>>3&3,l=e[t+1]>>1&3,u=e[t+2]>>4&15,c=e[t+2]>>2&3;if(1!==r&&0!==u&&15!==u&&3!==c){var d=e[t+2]>>1&1,f=e[t+3]>>6,h=1e3*i[14*(3===r?3-l:3===l?3:4)+u-1],p=a[3*(3===r?0:2===r?1:2)+c],v=3===f?1:2,g=s[r][l],m=o[l],y=8*g*m,E=Math.floor(g*h/p+d)*m;if(null===n){var _=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);n=_?parseInt(_[1]):0}return!!n&&n<=87&&2===l&&h>=224e3&&0===f&&(e[t+3]=128|e[t+3]),{sampleRate:p,channelCount:v,frameLength:E,samplesPerFrame:y}}}function c(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function d(e,t){return t+1<e.length&&c(e,t)}function f(e,t){return c(e,t)&&4<=e.length-t}function h(e,t){if(t+1<e.length&&c(e,t)){var r=u(e,t),n=4;null!=r&&r.frameLength&&(n=r.frameLength);var i=t+n;return i===e.length||d(e,i)}return!1}},"./src/demux/sample-aes.ts":
172
172
  /*!*********************************!*\
173
173
  !*** ./src/demux/sample-aes.ts ***!
174
174
  \*********************************/
175
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),i=r(/*! ./tsdemuxer */"./src/demux/tsdemuxer.ts"),a=function(){function t(t,e,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new n.default(t,e,{removePKCS7Padding:!1})}var e=t.prototype;return e.decryptBuffer=function(t,e){this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,e)},e.decryptAacSample=function(t,e,r,n){var i=t[e].unit,a=i.subarray(16,i.length-i.length%16),s=a.buffer.slice(a.byteOffset,a.byteOffset+a.length),o=this;this.decryptBuffer(s,(function(a){var s=new Uint8Array(a);i.set(s,16),n||o.decryptAacSamples(t,e+1,r)}))},e.decryptAacSamples=function(t,e,r){for(;;e++){if(e>=t.length)return void r();if(!(t[e].unit.length<32)){var n=this.decrypter.isSync();if(this.decryptAacSample(t,e,r,n),!n)return}}},e.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e),n=0,i=32;i<=t.length-16;i+=160,n+=16)r.set(t.subarray(i,i+16),n);return r},e.getAvcDecryptedUnit=function(t,e){for(var r=new Uint8Array(e),n=0,i=32;i<=t.length-16;i+=160,n+=16)t.set(r.subarray(n,n+16),i);return t},e.decryptAvcSample=function(t,e,r,n,a,s){var o=Object(i.discardEPB)(a.data),u=this.getAvcEncryptedData(o),l=this;this.decryptBuffer(u.buffer,(function(i){a.data=l.getAvcDecryptedUnit(o,i),s||l.decryptAvcSamples(t,e,r+1,n)}))},e.decryptAvcSamples=function(t,e,r,n){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,r=0){if(e>=t.length)return void n();for(var i=t[e].units;!(r>=i.length);r++){var a=i[r];if(!(a.data.length<=48||1!==a.type&&5!==a.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(t,e,r,n,a,s),!s)return}}}},t}();e.default=a},"./src/demux/transmuxer-interface.ts":
175
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../crypt/decrypter */"./src/crypt/decrypter.ts"),i=r(/*! ./tsdemuxer */"./src/demux/tsdemuxer.ts"),a=function(){function e(e,t,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new n.default(e,t,{removePKCS7Padding:!1})}var t=e.prototype;return t.decryptBuffer=function(e,t){this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,t)},t.decryptAacSample=function(e,t,r,n){var i=e[t].unit,a=i.subarray(16,i.length-i.length%16),s=a.buffer.slice(a.byteOffset,a.byteOffset+a.length),o=this;this.decryptBuffer(s,(function(a){var s=new Uint8Array(a);i.set(s,16),n||o.decryptAacSamples(e,t+1,r)}))},t.decryptAacSamples=function(e,t,r){for(;;t++){if(t>=e.length)return void r();if(!(e[t].unit.length<32)){var n=this.decrypter.isSync();if(this.decryptAacSample(e,t,r,n),!n)return}}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,r=new Int8Array(t),n=0,i=32;i<=e.length-16;i+=160,n+=16)r.set(e.subarray(i,i+16),n);return r},t.getAvcDecryptedUnit=function(e,t){for(var r=new Uint8Array(t),n=0,i=32;i<=e.length-16;i+=160,n+=16)e.set(r.subarray(n,n+16),i);return e},t.decryptAvcSample=function(e,t,r,n,a,s){var o=Object(i.discardEPB)(a.data),l=this.getAvcEncryptedData(o),u=this;this.decryptBuffer(l.buffer,(function(i){a.data=u.getAvcDecryptedUnit(o,i),s||u.decryptAvcSamples(e,t,r+1,n)}))},t.decryptAvcSamples=function(e,t,r,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,r=0){if(t>=e.length)return void n();for(var i=e[t].units;!(r>=i.length);r++){var a=i[r];if(!(a.data.length<=48||1!==a.type&&5!==a.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(e,t,r,n,a,s),!s)return}}}},e}();t.default=a},"./src/demux/transmuxer-interface.ts":
176
176
  /*!*******************************************!*\
177
177
  !*** ./src/demux/transmuxer-interface.ts ***!
178
178
  \*******************************************/
179
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"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 t(t,e,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=t,this.id=e,this.onTransmuxComplete=r,this.onFlush=u;var f=t.config,h=function(e,r){(r=r||{}).frag=d.frag,r.id=d.id,t.trigger(e,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(e){t.trigger(i.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(e.message+" ("+e.filename+":"+e.lineno+")")})},g.postMessage({cmd:"init",typeSupported:p,vendor:v,id:e,config:JSON.stringify(f)})}catch(t){s.logger.warn("Error in worker:",t),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 e=t.prototype;return e.destroy=function(){var t=this.worker;if(t)t.removeEventListener("message",this.onwmsg),t.terminate(),this.worker=null;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var r=this.observer;r&&r.removeAllListeners(),this.observer=null},e.push=function(t,e,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),T=m?c.sn-m.sn:-1,_=this.part?c.part-this.part.index:1,b=!E&&(1===T||0===T&&1===_),A=self.performance.now();(E||T||0===i.stats.parsing.start)&&(i.stats.parsing.start=A),!o||!_&&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,e,u,d);this.configureTransmuxer(L)}if(this.frag=i,this.part=o,p)p.postMessage({cmd:"demux",data:t,decryptdata:g,chunkMeta:c,state:S},t instanceof ArrayBuffer?[t]:[]);else if(h){var k=h.push(t,g,c,S);Object(a.isPromise)(k)?k.then((function(t){f.handleTransmuxComplete(t)})):this.handleTransmuxComplete(k)}},e.flush=function(t){var e=this;t.transmuxing.start=self.performance.now();var r=this.transmuxer,n=this.worker;if(n)n.postMessage({cmd:"flush",chunkMeta:t});else if(r){var i=r.flush(t);Object(a.isPromise)(i)?i.then((function(r){e.handleFlushResult(r,t)})):this.handleFlushResult(i,t)}},e.handleFlushResult=function(t,e){var r=this;t.forEach((function(t){r.handleTransmuxComplete(t)})),this.onFlush(e)},e.onWorkerMessage=function(t){var e=t.data,r=this.hls;switch(e.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,r.trigger(e.event,e.data)}},e.configureTransmuxer=function(t){var e=this.worker,r=this.transmuxer;e?e.postMessage({cmd:"configure",config:t}):r&&r.configure(t)},e.handleTransmuxComplete=function(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)},t}()},"./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"),l=r(/*! ../utils/mediasource-helper */"./src/utils/mediasource-helper.ts"),u=r(/*! eventemitter3 */"./node_modules/eventemitter3/index.js"),c=Object(l.getMediaSource)()||{isTypeSupported:function(){return!1}},d=function(){function e(e,t,r,l){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=l;var f=e.config,h=function(t,r){(r=r||{}).frag=d.frag,r.id=d.id,e.trigger(t,r)};this.observer=new u.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,l,u,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,u,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: "+u+"\n timeOffset: "+v);var L=new a.TransmuxConfig(r,n,t,l,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 w=h.push(e,g,c,S);Object(a.isPromise)(w)?w.then((function(e){f.handleTransmuxComplete(e)})):this.handleTransmuxComplete(w)}},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
  \****************************************/
183
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return o}));var n=r(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! eventemitter3 */"./node_modules/eventemitter3/index.js");function o(t){var e=new s.EventEmitter,r=function(e,r){t.postMessage({event:e,data:r})};e.on(i.Events.FRAG_DECRYPTED,r),e.on(i.Events.ERROR,r),t.addEventListener("message",(function(i){var s=i.data;switch(s.cmd){case"init":var o=JSON.parse(s.config);t.transmuxer=new n.default(e,s.typeSupported,o,s.vendor),Object(a.enableLogs)(o.debug),r("init",null);break;case"configure":t.transmuxer.configure(s.config);break;case"demux":var l=t.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(n.isPromise)(l)?l.then((function(e){u(t,e)})):u(t,l);break;case"flush":var d=s.chunkMeta,f=t.transmuxer.flush(d);Object(n.isPromise)(f)?f.then((function(e){c(t,e,d)})):c(t,f,d)}}))}function u(t,e){if((r=e.remuxResult).audio||r.video||r.text||r.id3||r.initSegment){var r,n=[],i=e.remuxResult,a=i.audio,s=i.video;a&&l(n,a),s&&l(n,s),t.postMessage({event:"transmuxComplete",data:e},n)}}function l(t,e){e.data1&&t.push(e.data1.buffer),e.data2&&t.push(e.data2.buffer)}function c(t,e,r){e.forEach((function(e){u(t,e)})),t.postMessage({event:"flush",data:r})}},"./src/demux/transmuxer.ts":
183
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return o}));var n=r(/*! ../demux/transmuxer */"./src/demux/transmuxer.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=r(/*! eventemitter3 */"./node_modules/eventemitter3/index.js");function o(e){var t=new s.EventEmitter,r=function(t,r){e.postMessage({event:t,data:r})};t.on(i.Events.FRAG_DECRYPTED,r),t.on(i.Events.ERROR,r),e.addEventListener("message",(function(i){var s=i.data;switch(s.cmd){case"init":var o=JSON.parse(s.config);e.transmuxer=new n.default(t,s.typeSupported,o,s.vendor),Object(a.enableLogs)(o.debug),r("init",null);break;case"configure":e.transmuxer.configure(s.config);break;case"demux":var u=e.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(n.isPromise)(u)?u.then((function(t){l(e,t)})):l(e,u);break;case"flush":var d=s.chunkMeta,f=e.transmuxer.flush(d);Object(n.isPromise)(f)?f.then((function(t){c(e,t,d)})):c(e,f,d)}}))}function l(e,t){if((r=t.remuxResult).audio||r.video||r.text||r.id3||r.initSegment){var r,n=[],i=t.remuxResult,a=i.audio,s=i.video;a&&u(n,a),s&&u(n,s),e.postMessage({event:"transmuxComplete",data:t},n)}}function u(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function c(e,t,r){t.forEach((function(t){l(e,t)})),e.postMessage({event:"flush",data:r})}},"./src/demux/transmuxer.ts":
184
184
  /*!*********************************!*\
185
185
  !*** ./src/demux/transmuxer.ts ***!
186
186
  \*********************************/
187
- /*! exports provided: default, isPromise, TransmuxConfig, TransmuxState */function(t,e,r){r.r(e),r.d(e,"default",(function(){return y})),r.d(e,"isPromise",(function(){return T})),r.d(e,"TransmuxConfig",(function(){return _})),r.d(e,"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(t){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(t){var e=t.demux;m=Math.max(m,e.minProbeByteLength)}));var y=function(){function t(t,e,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=t,this.typeSupported=e,this.config=r,this.vendor=n}var e=t.prototype;return e.configure=function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()},e.push=function(t,e,r,i){var a=this,s=r.transmuxing;s.executeStart=n();var o=new Uint8Array(t),u=this.cache,l=this.config,c=this.currentTransmuxState,d=this.transmuxConfig;i&&(this.currentTransmuxState=i);var f=function(t,e){var r=null;return t.byteLength>0&&null!=e&&null!=e.key&&null!==e.iv&&null!=e.method&&(r=e),r}(o,e);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(t){var e=a.push(t,null,r);return a.decryptionPromise=null,e})),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,T=g.trackSwitch,_=g.accurateTimeOffset,b=g.timeOffset,A=d.audioCodec,S=d.videoCodec,L=d.defaultInitPts,k=d.duration,w=d.initSegmentData;if((y||T)&&this.resetInitSegment(w,A,S,k),y&&this.resetInitialTimestamp(L),m||this.resetContiguity(),this.needsProbing(o,y,T)){if(u.dataLength){var D=u.flush();o=Object(p.appendUint8Array)(D,o)}this.configureTransmuxer(o,d)}var R=this.transmux(o,f,b,_,r),O=this.currentTransmuxState;return O.contiguous=!0,O.discontinuity=!1,O.trackSwitch=!1,s.executeEnd=n(),R},e.flush=function(t){var e=this,r=t.transmuxing;r.executeStart=n();var s=this.decrypter,o=this.cache,u=this.currentTransmuxState,l=this.decryptionPromise;if(l)return l.then((function(){return e.flush(t)}));var c=[],d=u.timeOffset;if(s){var f=s.flush();f&&c.push(this.push(f,null,t))}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(t)];var g=p.flush(d);return T(g)?g.then((function(r){return e.flushRemux(c,r,t),c})):(this.flushRemux(c,g,t),c)},e.flushRemux=function(t,e,r){var i=e.audioTrack,a=e.avcTrack,s=e.id3Track,o=e.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);t.push({remuxResult:d,chunkMeta:r}),r.transmuxing.executeEnd=n()},e.resetInitialTimestamp=function(t){var e=this.demuxer,r=this.remuxer;e&&r&&(e.resetTimeStamp(t),r.resetTimeStamp(t))},e.resetContiguity=function(){var t=this.demuxer,e=this.remuxer;t&&e&&(t.resetContiguity(),e.resetNextTimestamp())},e.resetInitSegment=function(t,e,r,n){var i=this.demuxer,a=this.remuxer;i&&a&&(i.resetInitSegment(e,r,n),a.resetInitSegment(t,e,r))},e.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},e.transmux=function(t,e,r,n,i){return e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,r,n,i):this.transmuxUnencrypted(t,r,n,i)},e.transmuxUnencrypted=function(t,e,r,n){var i=this.demuxer.demux(t,e,!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,e,r,!1),chunkMeta:n}},e.transmuxSampleAes=function(t,e,r,n,i){var a=this;return this.demuxer.demuxSampleAes(t,e,r).then((function(t){return{remuxResult:a.remuxer.remux(t.audioTrack,t.avcTrack,t.id3Track,t.textTrack,r,n,!1),chunkMeta:i}}))},e.configureTransmuxer=function(t,e){for(var r,n=this.config,i=this.observer,a=this.typeSupported,s=this.vendor,o=e.audioCodec,l=e.defaultInitPts,c=e.duration,d=e.initSegmentData,h=e.videoCodec,p=0,m=g.length;p<m;p++)if(g[p].demux.probe(t)){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,T=r.remux,_=r.demux;E&&E instanceof T||(this.remuxer=new T(i,n,a,s)),y&&y instanceof _||(this.demuxer=new _(i,n,a),this.probe=_.probe),this.resetInitSegment(d,o,h,c),this.resetInitialTimestamp(l)},e.needsProbing=function(t,e,r){return!this.demuxer||!this.remuxer||e||r},e.getDecrypter=function(){var t=this.decrypter;return t||(t=this.decrypter=new s.default(this.observer,this.config)),t},t}(),E=function(t){return{remuxResult:{},chunkMeta:t}};function T(t){return"then"in t&&t.then instanceof Function}var _=function(t,e,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=t,this.videoCodec=e,this.initSegmentData=r,this.duration=n,this.defaultInitPts=i},b=function(t,e,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=t,this.contiguous=e,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"),l=r(/*! ../demux/mp4demuxer */"./src/demux/mp4demuxer.ts"),u=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:u.default,remux:d.default},{demux:l.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),l=this.cache,u=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(!u.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,w=d.duration,k=d.initSegmentData;if((y||_)&&this.resetInitSegment(k,A,S,w),y&&this.resetInitialTimestamp(L),m||this.resetContiguity(),this.needsProbing(o,y,_)){if(l.dataLength){var R=l.flush();o=Object(p.appendUint8Array)(R,o)}this.configureTransmuxer(o,d)}var D=this.transmux(o,f,b,T,r),O=this.currentTransmuxState;return O.contiguous=!0,O.discontinuity=!1,O.trackSwitch=!1,s.executeEnd=n(),D},t.flush=function(e){var t=this,r=e.transmuxing;r.executeStart=n();var s=this.decrypter,o=this.cache,l=this.currentTransmuxState,u=this.decryptionPromise;if(u)return u.then((function(){return t.flush(e)}));var c=[],d=l.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,l=this.currentTransmuxState,u=l.accurateTimeOffset,c=l.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,u,!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,l=i.textTrack;return{remuxResult:this.remuxer.remux(a,s,o,l,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,u=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:l.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(u)},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(t,e,r){r.r(e),r.d(e,"discardEPB",(function(){return T}));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 t(t,e,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=t,this.config=e,this.typeSupported=r}t.probe=function(e){var r=t.syncOffset(e);return!(r<0||(r&&c.logger.warn("MPEG2-TS detected but first sync word found @ offset "+r+", junk ahead ?"),0))},t.syncOffset=function(t){for(var e=Math.min(1e3,t.length-564),r=0;r<e;){if(71===t[r]&&71===t[r+188]&&71===t[r+376])return r;r++}return-1},t.createTrack=function(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:f[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===t?e:void 0}};var e=t.prototype;return e.resetInitSegment=function(e,r,n){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=t.createTrack("video",n),this._audioTrack=t.createTrack("audio",n),this._id3Track=t.createTrack("id3",n),this._txtTrack=t.createTrack("text",n),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=e,this.videoCodec=r,this._duration=n},e.resetTimeStamp=function(){},e.resetContiguity=function(){var t=this._audioTrack,e=this._avcTrack,r=this._id3Track;t&&(t.pesData=null),e&&(e.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},e.demux=function(e,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,T=o.pesData,_=f.pesData,b=!1,A=this.pmtParsed,S=this._pmtId,L=e.length;if(this.remainderData&&(L=(e=Object(l.appendUint8Array)(this.remainderData,e)).length,this.remainderData=null),L<188&&!i)return this.remainderData=e,{audioTrack:o,avcTrack:s,id3Track:f,textTrack:this._txtTrack};var k=Math.max(0,t.syncOffset(e));(L-=(L+k)%188)<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,L,e.buffer.byteLength-L));for(var w=k;w<L;w+=188)if(71===e[w]){var D=!!(64&e[w+1]),R=((31&e[w+1])<<8)+e[w+2],O=void 0;if((48&e[w+3])>>4>1){if((O=w+5+e[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(e.subarray(O,w+188)),p.size+=w+188-O);break;case y:D&&(T&&(a=m(T))&&(o.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),T={data:[],size:0}),T&&(T.data.push(e.subarray(O,w+188)),T.size+=w+188-O);break;case E:D&&(_&&(a=m(_))&&this.parseID3PES(a),_={data:[],size:0}),_&&(_.data.push(e.subarray(O,w+188)),_.size+=w+188-O);break;case 0:D&&(O+=e[O]+1),S=this._pmtId=v(e,O);break;case S:D&&(O+=e[O]+1);var C=g(e,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=T,f.pesData=_;var I={audioTrack:o,avcTrack:s,id3Track:f,textTrack:this._txtTrack};return i&&this.extractRemainingSamples(I),I},e.flush=function(){var t,e=this.remainderData;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t},e.extractRemainingSamples=function(t){var e,r=t.audioTrack,n=t.avcTrack,i=t.id3Track,a=n.pesData,s=r.pesData,o=i.pesData;a&&(e=m(a))?(this.parseAVCPES(e,!0),n.pesData=null):n.pesData=a,s&&(e=m(s))?(r.isAAC?this.parseAACPES(e):this.parseMPEGPES(e),r.pesData=null):(null!=s&&s.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=s),o&&(e=m(o))?(this.parseID3PES(e),i.pesData=null):i.pesData=o},e.demuxSampleAes=function(t,e,r){var n=this.demux(t,r,!0,!this.config.progressive),i=this.sampleAes=new o.default(this.observer,this.config,e);return this.decrypt(n,i)},e.decrypt=function(t,e){return new Promise((function(r){var n=t.audioTrack,i=t.avcTrack;n.samples&&n.isAAC?e.decryptAacSamples(n.samples,0,(function(){i.samples?e.decryptAvcSamples(i.samples,0,0,(function(){r(t)})):r(t)})):i.samples&&e.decryptAvcSamples(i.samples,0,0,(function(){r(t)}))}))},e.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},e.parseAVCPES=function(t,e){var r,n=this,i=this._avcTrack,o=this.parseAVCNALu(t.data),u=this.avcSample,l=!1;t.data=null,u&&o.length&&!i.audFound&&(y(u,i),u=this.avcSample=p(!1,t.pts,t.dts,"")),o.forEach((function(e){switch(e.type){case 1:r=!0,u||(u=n.avcSample=p(!0,t.pts,t.dts,"")),u.frame=!0;var o=e.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,t.pts,t.dts,"")),u.key=!0,u.frame=!0;break;case 6:r=!0;var d=new a.default(T(e.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(),_=31&m,b=[m,d.readUByte()],A=0;A<_;A++)b.push(d.readUByte()),b.push(d.readUByte()),b.push(d.readUByte());E(n._txtTrack.samples,{type:3,pts:t.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:t.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(e.data).readSPS();i.width=O.width,i.height=O.height,i.pixelRatio=O.pixelRatio,i.sps=[e.data],i.duration=n._duration;for(var C=e.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=[e.data]);break;case 9:r=!1,i.audFound=!0,u&&y(u,i),u=n.avcSample=p(!1,t.pts,t.dts,"");break;case 12:r=!1;break;default:r=!1,u&&(u.debug+="unknown NAL "+e.type+" ")}u&&r&&u.units.push(e)})),e&&u&&(y(u,i),this.avcSample=null)},e.getLastNalUnit=function(){var t,e,r=this.avcSample;if(!r||0===r.units.length){var n=this._avcTrack.samples;r=n[n.length-1]}if(null!==(t=r)&&void 0!==t&&t.units){var i=r.units;e=i[i.length-1]}return e},e.parseAVCNALu=function(t){var e,r,n=t.byteLength,i=this._avcTrack,a=i.naluState||0,s=a,o=[],u=0,l=-1,c=0;for(-1===a&&(l=0,c=31&t[0],a=0,u=1);u<n;)if(e=t[u++],a)if(1!==a)if(e)if(1===e){if(l>=0){var d={data:t.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(t.subarray(0,r),f.data.byteLength),f.data=h}}u<n?(l=u,c=31&t[u],a=0):a=-1}else a=0;else a=3;else a=e?0:2;else a=e?0:1;if(l>=0&&a>=0){var p={data:t.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+t.byteLength);g.set(v.data,0),g.set(t,v.data.byteLength),v.data=g}}return i.naluState=a,o},e.parseAACPES=function(t){var e,r,i,a,s=this._audioTrack,o=this.aacLastPTS,l=this.aacOverFlow,f=t.data;if(l){var h=new Uint8Array(l.byteLength+f.byteLength);h.set(l,0),h.set(f,l.byteLength),f=h}for(e=0,r=f.length;e<r-1&&!n.isHeader(f,e);e++);if(!e||(e<r-1?(i="AAC PES did not start with ADTS header,offset:"+e,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,e,this.audioCodec);var p,v=0,g=n.getFrameDuration(s.samplerate);if(void 0!==t.pts)p=t.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;e<r;){if(n.isHeader(f,e)){if(e+5<r){var E=n.appendFrame(s,f,e,p,v);if(E){e+=E.length,y=E.sample.pts,v++;continue}}break}e++}this.aacOverFlow=e<r?f.subarray(e,r):null,this.aacLastPTS=y}},e.parseMPEGPES=function(t){var e=t.data,r=e.length,n=0,a=0,s=t.pts;if(void 0!==s)for(;a<r;)if(i.isHeader(e,a)){var o=i.appendFrame(this._audioTrack,e,a,s,n);if(!o)break;a+=o.length,n++}else a++;else c.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},e.parseID3PES=function(t){void 0!==t.pts?this._id3Track.samples.push(t):c.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},t}();function p(t,e,r,n){return{key:t,frame:!1,pts:e,dts:r,units:[],debug:n,length:0}}function v(t,e){return(31&t[e+10])<<8|t[e+11]}function g(t,e,r,n){var i={audio:-1,avc:-1,id3:-1,isAAC:!0},a=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<a;){var s=(31&t[e+1])<<8|t[e+2];switch(t[e]){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")}e+=5+((15&t[e+3])<<8|t[e+4])}return i}function m(t){var e,r,n,i,a,s=0,o=t.data;if(!t||0===t.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===((e=o[0])[0]<<16)+(e[1]<<8)+e[2]){if((r=(e[4]<<8)+e[5])&&r>t.size-6)return null;var l=e[7];192&l&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&l?i-(a=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[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=e[8])+9;if(t.size<=d)return null;t.size-=d;for(var f=new Uint8Array(t.size),h=0,p=o.length;h<p;h++){var v=(e=o[h]).byteLength;if(d){if(d>v){d-=v;continue}e=e.subarray(d),v-=d,d=0}f.set(e,s),s+=v}return r&&(r-=n+3),{data:f,pts:i,dts:a,len:r}}return null}function y(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){var r=e.samples,n=r.length;if(!n)return void e.dropped++;var i=r[n-1];t.pts=i.pts,t.dts=i.dts}e.samples.push(t)}t.debug.length&&c.logger.log(t.pts+"/"+t.dts+":"+t.debug)}function E(t,e){var r=t.length;if(r>0){if(e.pts>=t[r-1].pts)t.push(e);else for(var n=r-1;n>=0;n--)if(e.pts<t[n].pts){t.splice(n,0,e);break}}else t.push(e)}function T(t){for(var e=t.byteLength,r=[],n=1;n<e-2;)0===t[n]&&0===t[n+1]&&3===t[n+2]?(r.push(n+2),n+=2):n++;if(0===r.length)return t;var i=e-r.length,a=new Uint8Array(i),s=0;for(n=0;n<i;s++,n++)s===r[0]&&(s++,r.shift()),a[n]=t[s];return a}h.minProbeByteLength=188,e.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"),l=r(/*! ../events */"./src/events.ts"),u=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(u.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 w=Math.max(0,e.syncOffset(t));(L-=(L+w)%188)<t.byteLength&&!i&&(this.remainderData=new Uint8Array(t.buffer,L,t.buffer.byteLength-L));for(var k=w;k<L;k+=188)if(71===t[k]){var R=!!(64&t[k+1]),D=((31&t[k+1])<<8)+t[k+2],O=void 0;if((48&t[k+3])>>4>1){if((O=k+5+t[k+4])===k+188)continue}else O=k+4;switch(D){case h:R&&(p&&(a=m(p))&&this.parseAVCPES(a,!1),p={data:[],size:0}),p&&(p.data.push(t.subarray(O,k+188)),p.size+=k+188-O);break;case y:R&&(_&&(a=m(_))&&(o.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),_={data:[],size:0}),_&&(_.data.push(t.subarray(O,k+188)),_.size+=k+188-O);break;case E:R&&(T&&(a=m(T))&&this.parseID3PES(a),T={data:[],size:0}),T&&(T.data.push(t.subarray(O,k+188)),T.size+=k+188-O);break;case 0:R&&(O+=t[O]+1),S=this._pmtId=v(t,O);break;case S:R&&(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,k=w-188),A=this.pmtParsed=!0;break;case 17:case 8191:break;default:b=!0}}else this.observer.emit(l.Events.ERROR,l.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),l=this.avcSample,u=!1;e.data=null,l&&o.length&&!i.audFound&&(y(l,i),l=this.avcSample=p(!1,e.pts,e.dts,"")),o.forEach((function(t){switch(t.type){case 1:r=!0,l||(l=n.avcSample=p(!0,e.pts,e.dts,"")),l.frame=!0;var o=t.data;if(u&&o.length>4){var c=new a.default(o).readSliceType();2!==c&&4!==c&&7!==c&&9!==c||(l.key=!0)}break;case 5:r=!0,l||(l=n.avcSample=p(!0,e.pts,e.dts,"")),l.key=!0,l.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 w=h-16,k=new Uint8Array(w),R=0;R<w;R++)k[R]=d.readUByte();E(n._txtTrack.samples,{pts:e.pts,payloadType:f,uuid:S.join(""),userData:Object(s.utf8ArrayToStr)(k),userDataBytes:k})}}else if(h<d.bytesAvailable)for(var D=0;D<h;D++)d.readUByte()}break;case 7:if(r=!0,u=!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,l&&y(l,i),l=n.avcSample=p(!1,e.pts,e.dts,"");break;case 12:r=!1;break;default:r=!1,l&&(l.debug+="unknown NAL "+t.type+" ")}l&&r&&l.units.push(t)})),t&&l&&(y(l,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=[],l=0,u=-1,c=0;for(-1===a&&(u=0,c=31&e[0],a=0,l=1);l<n;)if(t=e[l++],a)if(1!==a)if(t)if(1===t){if(u>=0){var d={data:e.subarray(u,l-a-1),type:c};o.push(d)}else{var f=this.getLastNalUnit();if(f&&(s&&l<=4-s&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-s)),(r=l-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}}l<n?(u=l,c=31&e[l],a=0):a=-1}else a=0;else a=3;else a=t?0:2;else a=t?0:1;if(u>=0&&a>=0){var p={data:e.subarray(u,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,u=this.aacOverFlow,f=e.data;if(u){var h=new Uint8Array(u.byteLength+f.byteLength);h.set(u,0),h.set(f,u.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(l.Events.ERROR,l.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(u&&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 l=new Uint8Array(o[0].length+o[1].length);l.set(o[0]),l.set(o[1],o[0].length),o[0]=l,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 u=t[7];192&u&&(i=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&u?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
  \***********************/
195
- /*! exports provided: ErrorTypes, ErrorDetails */function(t,e,r){var n,i;r.r(e),r.d(e,"ErrorTypes",(function(){return n})),r.d(e,"ErrorDetails",(function(){return i})),function(t){t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError"}(n||(n={})),function(t){t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.UNKNOWN="unknown"}(i||(i={}))},"./src/events.ts":
195
+ /*! exports provided: ErrorTypes, ErrorDetails */function(e,t,r){var n,i;r.r(t),r.d(t,"ErrorTypes",(function(){return n})),r.d(t,"ErrorDetails",(function(){return i})),function(e){e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError"}(n||(n={})),function(e){e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.UNKNOWN="unknown"}(i||(i={}))},"./src/events.ts":
196
196
  /*!***********************!*\
197
197
  !*** ./src/events.ts ***!
198
198
  \***********************/
199
- /*! exports provided: Events */function(t,e,r){var n;r.r(e),r.d(e,"Events",(function(){return n})),function(t){t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached"}(n||(n={}))},"./src/hls.ts":
199
+ /*! exports provided: Events */function(e,t,r){var n;r.r(t),r.d(t,"Events",(function(){return n})),function(e){e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached"}(n||(n={}))},"./src/hls.ts":
200
200
  /*!********************!*\
201
201
  !*** ./src/hls.ts ***!
202
202
  \********************/
203
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"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(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var y=function(){function t(e){void 0===e&&(e={}),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)(t.DefaultConfig,e);this.userConfig=e,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),T=new g(this),_=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),T.setStreamController(k);var w=[S,k];this.networkControllers=w;var D=[_,b,m,y,E,T,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}t.isSupported=function(){return Object(d.isSupported)()};var e,r,y,E=t.prototype;return E.createController=function(t,e,r){if(t){var n=e?new t(this,e):new t(this);return r&&r.push(n),n}return null},E.on=function(t,e,r){void 0===r&&(r=this),this._emitter.on(t,e,r)},E.once=function(t,e,r){void 0===r&&(r=this),this._emitter.once(t,e,r)},E.removeAllListeners=function(t){this._emitter.removeAllListeners(t)},E.off=function(t,e,r,n){void 0===r&&(r=this),this._emitter.off(t,e,r,n)},E.listeners=function(t){return this._emitter.listeners(t)},E.emit=function(t,e,r){return this._emitter.emit(t,e,r)},E.trigger=function(t,e){if(this.config.debug)return this.emit(t,t,e);try{return this.emit(t,t,e)}catch(e){f.logger.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),this.trigger(v.Events.ERROR,{type:g.ErrorTypes.OTHER_ERROR,details:g.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:t,error:e})}return!1},E.listenerCount=function(t){return this._emitter.listenerCount(t)},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(t){return t.destroy()})),this.networkControllers.length=0,this.coreComponents.forEach((function(t){return t.destroy()})),this.coreComponents.length=0},E.attachMedia=function(t){f.logger.log("attachMedia"),this._media=t,this.trigger(v.Events.MEDIA_ATTACHING,{media:t})},E.detachMedia=function(){f.logger.log("detachMedia"),this.trigger(v.Events.MEDIA_DETACHING,void 0),this._media=null},E.loadSource=function(t){this.stopLoad();var e=this.media,r=this.url,i=this.url=n.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});f.logger.log("loadSource:"+i),e&&r&&r!==i&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(e)),this.trigger(v.Events.MANIFEST_LOADING,{url:t})},E.startLoad=function(t){void 0===t&&(t=-1),f.logger.log("startLoad("+t+")"),this.networkControllers.forEach((function(e){e.startLoad(t)}))},E.stopLoad=function(){f.logger.log("stopLoad"),this.networkControllers.forEach((function(t){t.stopLoad()}))},E.swapAudioCodec=function(){f.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},E.recoverMediaError=function(){f.logger.log("recoverMediaError");var t=this._media;this.detachMedia(),t&&this.attachMedia(t)},E.removeLevel=function(t,e){void 0===e&&(e=0),this.levelController.removeLevel(t,e)},e=t,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 t.defaultConfig?t.defaultConfig:h.hlsDefaultConfig},set:function(e){t.defaultConfig=e}}],(r=[{key:"levels",get:function(){var t=this.levelController.levels;return t||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){f.logger.log("set currentLevel:"+t),this.loadLevel=t,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){f.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){f.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){f.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){f.logger.log("set startLevel:"+t),-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(t){var e=!!t;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){this._autoLevelCapping!==t&&(f.logger.log("set autoLevelCapping:"+t),this._autoLevelCapping=t)}},{key:"bandwidthEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var t=this.levels,e=this.config.minAutoBitrate;if(!t)return 0;for(var r=t.length,n=0;n<r;n++)if(t[n].maxBitrate>e)return n;return 0}},{key:"maxAutoLevel",get:function(){var t=this.levels,e=this.autoLevelCapping;return-1===e&&t&&t.length?t.length-1:e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return!!t&&t.subtitleDisplay},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(t){this.config.lowLatencyMode=t}},{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(e.prototype,r),y&&m(e,y),t}();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"),l=r(/*! ./controller/level-controller */"./src/controller/level-controller.ts"),u=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 l.default(this),L=new u.FragmentTracker(this),w=this.streamController=new c.default(this,L);E.setStreamController(w),_.setStreamController(w);var k=[S,w];this.networkControllers=k;var R=[T,b,m,y,E,_,A,L];this.audioTrackController=this.createController(r.audioTrackController,null,k),this.createController(r.audioStreamController,L,k),this.subtitleTrackController=this.createController(r.subtitleTrackController,null,k),this.createController(r.subtitleStreamController,L,k),this.createController(r.timelineController,null,R),this.emeController=this.createController(r.emeController,null,R),this.latencyController=this.createController(o.default,null,R),this.coreComponents=R}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
  \*****************************/
207
- /*! exports provided: isSupported, changeTypeSupported */function(t,e,r){r.r(e),r.d(e,"isSupported",(function(){return a})),r.d(e,"changeTypeSupported",(function(){return s}));var n=r(/*! ./utils/mediasource-helper */"./src/utils/mediasource-helper.ts");function i(){return self.SourceBuffer||self.WebKitSourceBuffer}function a(){var t=Object(n.getMediaSource)();if(!t)return!1;var e=i(),r=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),a=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove;return!!r&&!!a}function s(){var t,e=i();return"function"==typeof(null==e||null===(t=e.prototype)||void 0===t?void 0:t.changeType)}},"./src/loader/fragment-loader.ts":
207
+ /*! exports provided: isSupported, changeTypeSupported */function(e,t,r){r.r(t),r.d(t,"isSupported",(function(){return a})),r.d(t,"changeTypeSupported",(function(){return s}));var n=r(/*! ./utils/mediasource-helper */"./src/utils/mediasource-helper.ts");function i(){return self.SourceBuffer||self.WebKitSourceBuffer}function a(){var e=Object(n.getMediaSource)();if(!e)return!1;var t=i(),r=e&&"function"==typeof e.isTypeSupported&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),a=!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove;return!!r&&!!a}function s(){var e,t=i();return"function"==typeof(null==t||null===(e=t.prototype)||void 0===e?void 0:e.changeType)}},"./src/loader/fragment-loader.ts":
208
208
  /*!***************************************!*\
209
209
  !*** ./src/loader/fragment-loader.ts ***!
210
210
  \***************************************/
211
- /*! exports provided: default, LoadError */function(t,e,r){r.r(e),r.d(e,"default",(function(){return d})),r.d(e,"LoadError",(function(){return h}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../errors */"./src/errors.ts");function a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return s(t,arguments,l(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),u(n,t)})(t)}function s(t,e,r){return(s=o()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&u(i,r.prototype),i}).apply(null,arguments)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=Math.pow(2,17),d=function(){function t(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}var e=t.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(t,e){var r=this,n=t.url;if(!n)return Promise.reject(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,networkDetails:null},"Fragment does not have a "+(n?"part list":"url")));this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(n,u){r.loader&&r.loader.destroy();var l=r.loader=t.loader=s?new s(a):new o(a),d=f(t),p={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:c};t.stats=l.stats,l.load(d,p,{onSuccess:function(e,i,a,s){r.resetLoader(t,l),n({frag:t,part:null,payload:e.data,networkDetails:s})},onError:function(e,n,a){r.resetLoader(t,l),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:e,networkDetails:a}))},onAbort:function(e,n,a){r.resetLoader(t,l),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,networkDetails:a}))},onTimeout:function(e,n,a){r.resetLoader(t,l),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,networkDetails:a}))},onProgress:function(r,n,i,a){e&&e({frag:t,part:null,payload:i,networkDetails:a})}})}))},e.loadPart=function(t,e,r){var n=this;this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(u,l){n.loader&&n.loader.destroy();var d=n.loader=t.loader=s?new s(a):new o(a),p=f(t,e),v={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:c};e.stats=d.stats,d.load(p,v,{onSuccess:function(i,a,s,o){n.resetLoader(t,d),n.updateStatsFromPart(t,e);var l={frag:t,part:e,payload:i.data,networkDetails:o};r(l),u(l)},onError:function(r,a,s){n.resetLoader(t,d),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:r,networkDetails:s}))},onAbort:function(r,a,s){t.stats.aborted=e.stats.aborted,n.resetLoader(t,d),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,networkDetails:s}))},onTimeout:function(r,a,s){n.resetLoader(t,d),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,networkDetails:s}))}})}))},e.updateStatsFromPart=function(t,e){var r=t.stats,n=e.stats,i=n.total;if(r.loaded+=n.loaded,i){var a=Math.round(t.duration/e.duration),s=Math.min(Math.round(r.loaded/i),a),o=(a-s)*Math.round(r.loaded/s);r.total=r.loaded+o}else r.total=Math.max(r.loaded,r.total);var u=r.loading,l=n.loading;u.start?u.first+=l.first-l.start:(u.start=l.start,u.first=l.first),u.end=l.end},e.resetLoader=function(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()},t}();function f(t,e){void 0===e&&(e=null);var r=e||t,i={frag:t,part:e,responseType:"arraybuffer",url:r.url,rangeStart:0,rangeEnd:0},a=r.byteRangeStartOffset,s=r.byteRangeEndOffset;return Object(n.isFiniteNumber)(a)&&Object(n.isFiniteNumber)(s)&&(i.rangeStart=a,i.rangeEnd=s),i}var h=function(t){var e,r;function n(e){for(var r,n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];return(r=t.call.apply(t,[this].concat(i))||this).data=void 0,r.data=e,r}return r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,u(e,r),n}(a(Error))},"./src/loader/fragment.ts":
211
+ /*! exports provided: default, LoadError */function(e,t,r){r.r(t),r.d(t,"default",(function(){return d})),r.d(t,"LoadError",(function(){return h}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../errors */"./src/errors.ts");function a(e){var t="function"==typeof Map?new Map:void 0;return(a=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return s(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,e)})(e)}function s(e,t,r){return(s=o()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&l(i,r.prototype),i}).apply(null,arguments)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=Math.pow(2,17),d=function(){function e(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}var t=e.prototype;return t.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(e,t){var r=this,n=e.url;if(!n)return Promise.reject(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,networkDetails:null},"Fragment does not have a "+(n?"part list":"url")));this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(n,l){r.loader&&r.loader.destroy();var u=r.loader=e.loader=s?new s(a):new o(a),d=f(e),p={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:c};e.stats=u.stats,u.load(d,p,{onSuccess:function(t,i,a,s){r.resetLoader(e,u),n({frag:e,part:null,payload:t.data,networkDetails:s})},onError:function(t,n,a){r.resetLoader(e,u),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:t,networkDetails:a}))},onAbort:function(t,n,a){r.resetLoader(e,u),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,networkDetails:a}))},onTimeout:function(t,n,a){r.resetLoader(e,u),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,networkDetails:a}))},onProgress:function(r,n,i,a){t&&t({frag:e,part:null,payload:i,networkDetails:a})}})}))},t.loadPart=function(e,t,r){var n=this;this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(l,u){n.loader&&n.loader.destroy();var d=n.loader=e.loader=s?new s(a):new o(a),p=f(e,t),v={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:c};t.stats=d.stats,d.load(p,v,{onSuccess:function(i,a,s,o){n.resetLoader(e,d),n.updateStatsFromPart(e,t);var u={frag:e,part:t,payload:i.data,networkDetails:o};r(u),l(u)},onError:function(r,a,s){n.resetLoader(e,d),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:r,networkDetails:s}))},onAbort:function(r,a,s){e.stats.aborted=t.stats.aborted,n.resetLoader(e,d),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,networkDetails:s}))},onTimeout:function(r,a,s){n.resetLoader(e,d),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,networkDetails:s}))}})}))},t.updateStatsFromPart=function(e,t){var r=e.stats,n=t.stats,i=n.total;if(r.loaded+=n.loaded,i){var a=Math.round(e.duration/t.duration),s=Math.min(Math.round(r.loaded/i),a),o=(a-s)*Math.round(r.loaded/s);r.total=r.loaded+o}else r.total=Math.max(r.loaded,r.total);var l=r.loading,u=n.loading;l.start?l.first+=u.first-u.start:(l.start=u.start,l.first=u.first),l.end=u.end},t.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},e}();function f(e,t){void 0===t&&(t=null);var r=t||e,i={frag:e,part:t,responseType:"arraybuffer",url:r.url,rangeStart:0,rangeEnd:0},a=r.byteRangeStartOffset,s=r.byteRangeEndOffset;return Object(n.isFiniteNumber)(a)&&Object(n.isFiniteNumber)(s)&&(i.rangeStart=a,i.rangeEnd=s),i}var h=function(e){var t,r;function n(t){for(var r,n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];return(r=e.call.apply(e,[this].concat(i))||this).data=void 0,r.data=t,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,l(t,r),n}(a(Error))},"./src/loader/fragment.ts":
212
212
  /*!********************************!*\
213
213
  !*** ./src/loader/fragment.ts ***!
214
214
  \********************************/
215
- /*! exports provided: ElementaryStreamTypes, BaseSegment, Fragment, Part */function(t,e,r){r.r(e),r.d(e,"ElementaryStreamTypes",(function(){return n})),r.d(e,"BaseSegment",(function(){return h})),r.d(e,"Fragment",(function(){return p})),r.d(e,"Part",(function(){return v}));var n,i=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),a=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ./level-key */"./src/loader/level-key.ts"),u=r(/*! ./load-stats */"./src/loader/load-stats.ts");function l(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,c(t,e)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function f(t,e,r){return e&&d(t.prototype,e),r&&d(t,r),t}!function(t){t.AUDIO="audio",t.VIDEO="video",t.AUDIOVIDEO="audiovideo"}(n||(n={}));var h=function(){function t(t){var e;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((e={})[n.AUDIO]=null,e[n.VIDEO]=null,e[n.AUDIOVIDEO]=null,e),this.baseurl=t}return t.prototype.setByteRange=function(t,e){var r=t.split("@",2),n=[];1===r.length?n[0]=e?e.byteRangeEndOffset:0:n[0]=parseInt(r[1]),n[1]=parseInt(r[0])+n[0],this._byteRange=n},f(t,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(a.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(t){this._url=t}}]),t}(),p=function(t){function e(e,r){var n;return(n=t.call(this,r)||this)._decryptdata=null,n.rawProgramDateTime=null,n.programDateTime=null,n.tagList=[],n.duration=0,n.sn=0,n.levelkey=void 0,n.type=void 0,n.loader=null,n.level=-1,n.cc=0,n.startPTS=void 0,n.endPTS=void 0,n.appendedPTS=void 0,n.startDTS=void 0,n.endDTS=void 0,n.start=0,n.deltaPTS=void 0,n.maxStartPTS=void 0,n.minEndPTS=void 0,n.stats=new u.LoadStats,n.urlId=0,n.data=void 0,n.bitrateTest=!1,n.title=null,n.type=e,n}l(e,t);var r=e.prototype;return r.createInitializationVector=function(t){for(var e=new Uint8Array(16),r=12;r<16;r++)e[r]=t>>8*(15-r)&255;return e},r.setDecryptDataFromLevelKey=function(t,e){var r=t;return"AES-128"===(null==t?void 0:t.method)&&t.uri&&!t.iv&&((r=o.LevelKey.fromURI(t.uri)).method=t.method,r.iv=this.createInitializationVector(e),r.keyFormat="identity"),r},r.setElementaryStreamInfo=function(t,e,r,n,i,a){void 0===a&&(a=!1);var s=this.elementaryStreams,o=s[t];o?(o.startPTS=Math.min(o.startPTS,e),o.endPTS=Math.max(o.endPTS,r),o.startDTS=Math.min(o.startDTS,n),o.endDTS=Math.max(o.endDTS,i)):s[t]={startPTS:e,endPTS:r,startDTS:n,endDTS:i,partial:a}},r.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[n.AUDIO]=null,t[n.VIDEO]=null,t[n.AUDIOVIDEO]=null},f(e,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var t=this.sn;"number"!=typeof t&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&s.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),t=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,t)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(i.isFiniteNumber)(this.programDateTime))return null;var t=Object(i.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*t}},{key:"encrypted",get:function(){var t;return!(null===(t=this.decryptdata)||void 0===t||!t.keyFormat||!this.decryptdata.uri)}}]),e}(h),v=function(t){function e(e,r,n,i,a){var s;(s=t.call(this,n)||this).fragOffset=0,s.duration=0,s.gap=!1,s.independent=!1,s.relurl=void 0,s.fragment=void 0,s.index=void 0,s.stats=new u.LoadStats,s.duration=e.decimalFloatingPoint("DURATION"),s.gap=e.bool("GAP"),s.independent=e.bool("INDEPENDENT"),s.relurl=e.enumeratedString("URI"),s.fragment=r,s.index=i;var o=e.enumeratedString("BYTERANGE");return o&&s.setByteRange(o,a),a&&(s.fragOffset=a.fragOffset+a.duration),s}return l(e,t),f(e,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var t=this.elementaryStreams;return!!(t.audio||t.video||t.audiovideo)}}]),e}(h)},"./src/loader/key-loader.ts":
215
+ /*! exports provided: ElementaryStreamTypes, BaseSegment, Fragment, Part */function(e,t,r){r.r(t),r.d(t,"ElementaryStreamTypes",(function(){return n})),r.d(t,"BaseSegment",(function(){return h})),r.d(t,"Fragment",(function(){return p})),r.d(t,"Part",(function(){return v}));var n,i=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),a=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ./level-key */"./src/loader/level-key.ts"),l=r(/*! ./load-stats */"./src/loader/load-stats.ts");function u(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,c(e,t)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(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 f(e,t,r){return t&&d(e.prototype,t),r&&d(e,r),e}!function(e){e.AUDIO="audio",e.VIDEO="video",e.AUDIOVIDEO="audiovideo"}(n||(n={}));var h=function(){function e(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[n.AUDIO]=null,t[n.VIDEO]=null,t[n.AUDIOVIDEO]=null,t),this.baseurl=e}return e.prototype.setByteRange=function(e,t){var r=e.split("@",2),n=[];1===r.length?n[0]=t?t.byteRangeEndOffset:0:n[0]=parseInt(r[1]),n[1]=parseInt(r[0])+n[0],this._byteRange=n},f(e,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(a.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}]),e}(),p=function(e){function t(t,r){var n;return(n=e.call(this,r)||this)._decryptdata=null,n.rawProgramDateTime=null,n.programDateTime=null,n.tagList=[],n.duration=0,n.sn=0,n.levelkey=void 0,n.type=void 0,n.loader=null,n.level=-1,n.cc=0,n.startPTS=void 0,n.endPTS=void 0,n.appendedPTS=void 0,n.startDTS=void 0,n.endDTS=void 0,n.start=0,n.deltaPTS=void 0,n.maxStartPTS=void 0,n.minEndPTS=void 0,n.stats=new l.LoadStats,n.urlId=0,n.data=void 0,n.bitrateTest=!1,n.title=null,n.type=t,n}u(t,e);var r=t.prototype;return r.createInitializationVector=function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t},r.setDecryptDataFromLevelKey=function(e,t){var r=e;return"AES-128"===(null==e?void 0:e.method)&&e.uri&&!e.iv&&((r=o.LevelKey.fromURI(e.uri)).method=e.method,r.iv=this.createInitializationVector(t),r.keyFormat="identity"),r},r.setElementaryStreamInfo=function(e,t,r,n,i,a){void 0===a&&(a=!1);var s=this.elementaryStreams,o=s[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,r),o.startDTS=Math.min(o.startDTS,n),o.endDTS=Math.max(o.endDTS,i)):s[e]={startPTS:t,endPTS:r,startDTS:n,endDTS:i,partial:a}},r.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[n.AUDIO]=null,e[n.VIDEO]=null,e[n.AUDIOVIDEO]=null},f(t,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var e=this.sn;"number"!=typeof e&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&s.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(i.isFiniteNumber)(this.programDateTime))return null;var e=Object(i.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){var e;return!(null===(e=this.decryptdata)||void 0===e||!e.keyFormat||!this.decryptdata.uri)}}]),t}(h),v=function(e){function t(t,r,n,i,a){var s;(s=e.call(this,n)||this).fragOffset=0,s.duration=0,s.gap=!1,s.independent=!1,s.relurl=void 0,s.fragment=void 0,s.index=void 0,s.stats=new l.LoadStats,s.duration=t.decimalFloatingPoint("DURATION"),s.gap=t.bool("GAP"),s.independent=t.bool("INDEPENDENT"),s.relurl=t.enumeratedString("URI"),s.fragment=r,s.index=i;var o=t.enumeratedString("BYTERANGE");return o&&s.setByteRange(o,a),a&&(s.fragOffset=a.fragOffset+a.duration),s}return u(t,e),f(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),t}(h)},"./src/loader/key-loader.ts":
216
216
  /*!**********************************!*\
217
217
  !*** ./src/loader/key-loader.ts ***!
218
218
  \**********************************/
219
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return s}));var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=function(){function t(t){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=t,this._registerListeners()}var e=t.prototype;return e._registerListeners=function(){this.hls.on(n.Events.KEY_LOADING,this.onKeyLoading,this)},e._unregisterListeners=function(){this.hls.off(n.Events.KEY_LOADING,this.onKeyLoading)},e.destroy=function(){for(var t in this._unregisterListeners(),this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={}},e.onKeyLoading=function(t,e){var r=e.frag,i=r.type,s=this.loaders[i];if(r.decryptdata){var o=r.decryptdata.uri;if(o!==this.decrypturl||null===this.decryptkey){var u=this.hls.config;if(s&&(a.logger.warn("abort previous key loader for type:"+i),s.abort()),!o)return void a.logger.warn("key uri is falsy");var l=u.loader,c=r.loader=this.loaders[i]=new l(u);this.decrypturl=o,this.decryptkey=null;var d={url:o,frag:r,responseType:"arraybuffer"},f={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},h={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};c.load(d,f,h)}else this.decryptkey&&(r.decryptdata.key=this.decryptkey,this.hls.trigger(n.Events.KEY_LOADED,{frag:r}))}else a.logger.warn("Missing decryption data on fragment in onKeyLoading")},e.loadsuccess=function(t,e,r){var i=r.frag;i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(t.data),i.loader=null,delete this.loaders[i.type],this.hls.trigger(n.Events.KEY_LOADED,{frag:i})):a.logger.error("after key load, decryptdata unset")},e.loaderror=function(t,e){var r=e.frag,a=r.loader;a&&a.abort(),delete this.loaders[r.type],this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:r,response:t})},e.loadtimeout=function(t,e){var r=e.frag,a=r.loader;a&&a.abort(),delete this.loaders[r.type],this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},t}()},"./src/loader/level-details.ts":
219
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return s}));var n=r(/*! ../events */"./src/events.ts"),i=r(/*! ../errors */"./src/errors.ts"),a=r(/*! ../utils/logger */"./src/utils/logger.ts"),s=function(){function e(e){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=e,this._registerListeners()}var t=e.prototype;return t._registerListeners=function(){this.hls.on(n.Events.KEY_LOADING,this.onKeyLoading,this)},t._unregisterListeners=function(){this.hls.off(n.Events.KEY_LOADING,this.onKeyLoading)},t.destroy=function(){for(var e in this._unregisterListeners(),this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={}},t.onKeyLoading=function(e,t){var r=t.frag,i=r.type,s=this.loaders[i];if(r.decryptdata){var o=r.decryptdata.uri;if(o!==this.decrypturl||null===this.decryptkey){var l=this.hls.config;if(s&&(a.logger.warn("abort previous key loader for type:"+i),s.abort()),!o)return void a.logger.warn("key uri is falsy");var u=l.loader,c=r.loader=this.loaders[i]=new u(l);this.decrypturl=o,this.decryptkey=null;var d={url:o,frag:r,responseType:"arraybuffer"},f={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},h={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};c.load(d,f,h)}else this.decryptkey&&(r.decryptdata.key=this.decryptkey,this.hls.trigger(n.Events.KEY_LOADED,{frag:r}))}else a.logger.warn("Missing decryption data on fragment in onKeyLoading")},t.loadsuccess=function(e,t,r){var i=r.frag;i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=null,delete this.loaders[i.type],this.hls.trigger(n.Events.KEY_LOADED,{frag:i})):a.logger.error("after key load, decryptdata unset")},t.loaderror=function(e,t){var r=t.frag,a=r.loader;a&&a.abort(),delete this.loaders[r.type],this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:r,response:e})},t.loadtimeout=function(e,t){var r=t.frag,a=r.loader;a&&a.abort(),delete this.loaders[r.type],this.hls.trigger(n.Events.ERROR,{type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:r})},e}()},"./src/loader/level-details.ts":
220
220
  /*!*************************************!*\
221
221
  !*** ./src/loader/level-details.ts ***!
222
222
  \*************************************/
223
- /*! exports provided: LevelDetails */function(t,e,r){r.r(e),r.d(e,"LevelDetails",(function(){return a}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts");function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=function(){function t(t){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.initSegment=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=t}var e,r,a;return t.prototype.reloaded=function(t){if(!t)return this.advanced=!0,void(this.updated=!0);var e=this.lastPartSn-t.lastPartSn,r=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!r||!!e,this.advanced=this.endSN>t.endSN||e>0||0===e&&r>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1,this.availabilityDelay=t.availabilityDelay},e=t,(r=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&Object(n.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var t=this.driftEndTime-this.driftStartTime;return t>0?1e3*(this.driftEnd-this.driftStart)/t:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var t;return null!==(t=this.fragments)&&void 0!==t&&t.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&i(e.prototype,r),a&&i(e,a),t}()},"./src/loader/level-key.ts":
223
+ /*! exports provided: LevelDetails */function(e,t,r){r.r(t),r.d(t,"LevelDetails",(function(){return a}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts");function i(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 a=function(){function e(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.initSegment=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=e}var t,r,a;return e.prototype.reloaded=function(e){if(!e)return this.advanced=!0,void(this.updated=!0);var t=this.lastPartSn-e.lastPartSn,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!t,this.advanced=this.endSN>e.endSN||t>0||0===t&&r>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay},t=e,(r=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&Object(n.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!==(e=this.partList)&&void 0!==e&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var e;return null!==(e=this.fragments)&&void 0!==e&&e.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var e;return null!==(e=this.partList)&&void 0!==e&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var e;return null!==(e=this.partList)&&void 0!==e&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&i(t.prototype,r),a&&i(t,a),e}()},"./src/loader/level-key.ts":
224
224
  /*!*********************************!*\
225
225
  !*** ./src/loader/level-key.ts ***!
226
226
  \*********************************/
227
- /*! exports provided: LevelKey */function(t,e,r){r.r(e),r.d(e,"LevelKey",(function(){return a}));var n=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js");function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var a=function(){function t(t,e){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,this._uri=e?Object(n.buildAbsoluteURL)(t,e,{alwaysNormalize:!0}):t}var e,r,a;return t.fromURL=function(e,r){return new t(e,r)},t.fromURI=function(e){return new t(e)},e=t,(r=[{key:"uri",get:function(){return this._uri}}])&&i(e.prototype,r),a&&i(e,a),t}()},"./src/loader/load-stats.ts":
227
+ /*! exports provided: LevelKey */function(e,t,r){r.r(t),r.d(t,"LevelKey",(function(){return a}));var n=r(/*! url-toolkit */"./node_modules/url-toolkit/src/url-toolkit.js");function i(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 a=function(){function e(e,t){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,this._uri=t?Object(n.buildAbsoluteURL)(e,t,{alwaysNormalize:!0}):e}var t,r,a;return e.fromURL=function(t,r){return new e(t,r)},e.fromURI=function(t){return new e(t)},t=e,(r=[{key:"uri",get:function(){return this._uri}}])&&i(t.prototype,r),a&&i(t,a),e}()},"./src/loader/load-stats.ts":
228
228
  /*!**********************************!*\
229
229
  !*** ./src/loader/load-stats.ts ***!
230
230
  \**********************************/
231
- /*! exports provided: LoadStats */function(t,e,r){r.r(e),r.d(e,"LoadStats",(function(){return n}));var n=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":
231
+ /*! exports provided: LoadStats */function(e,t,r){r.r(t),r.d(t,"LoadStats",(function(){return n}));var n=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":
232
232
  /*!***********************************!*\
233
233
  !*** ./src/loader/m3u8-parser.ts ***!
234
234
  \***********************************/
235
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"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 t(){}return t.findGroup=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(n.id===e)return n}},t.convertAVC1ToAVCOTI=function(t){var e=t.split(".");if(e.length>2){var r=e.shift()+".";return r+=parseInt(e.shift()).toString(16),r+=("000"+parseInt(e.shift()).toString(16)).substr(-4)}return t},t.resolve=function(t,e){return i.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},t.parseMasterPlaylist=function(e,r){var n,i=[],a={},s=!1;for(d.lastIndex=0;null!=(n=d.exec(e));)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:t.resolve(n[2],r)},c=o.decimalResolution("RESOLUTION");c&&(l.width=c.width,l.height=c.height),m((o.CODECS||"").split(/[ ,]+/).filter((function(t){return t})),l),l.videoCodec&&-1!==l.videoCodec.indexOf("avc1")&&(l.videoCodec=t.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}},t.parseMasterPlaylistMedia=function(e,r,n,i){var a;void 0===i&&(i=[]);var s=[],o=0;for(f.lastIndex=0;null!==(a=f.exec(e));){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?t.resolve(l.URI,r):""};if(i.length){var d=t.findGroup(i,c.groupId)||i[0];y(c,d,"audioCodec"),y(c,d,"textCodec")}s.push(c)}}return s},t.parseLevelPlaylist=function(t,e,r,c,d){var f,g,m,y=new s.LevelDetails(e),T=y.fragments,_=0,b=0,A=0,S=0,L=null,k=new a.Fragment(c,e),w=-1;for(h.lastIndex=0,y.m3u8=t;null!==(f=h.exec(t));){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=_,k.level=r,k.cc=S,k.urlId=d,T.push(k),k.relurl=(" "+f[3]).slice(1),E(k,L),L=k,A+=k.duration,_++,b=0,(k=new a.Fragment(c,e)).start=A,k.sn=_,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=T.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":_=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 F=M;F--;)T.unshift(null);_+=M}var N=P.enumeratedString("RECENTLY-REMOVED-DATERANGES");N&&(y.recentlyRemovedDateranges=N.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(e,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,e)).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,e,Z,J);Q.push($),k.duration+=$.duration;break;case"PRELOAD-HINT":var tt=new u.AttrList(I);y.preloadHint=tt;break;case"RENDITION-REPORT":var et=new u.AttrList(I);y.renditionReports=y.renditionReports||[],y.renditionReports.push(et);break;default:l.logger.warn("line parsed but not handled: "+f)}}}L&&!L.relurl?(T.pop(),A-=L.duration,y.partList&&(y.fragmentHint=L)):y.partList&&(E(k,L),k.cc=S,y.fragmentHint=k);var rt=T.length,nt=T[0],it=T[rt-1];if((A+=y.skippedSegments*y.targetduration)>0&&rt&&it){y.averagetargetduration=A/rt;var at=it.sn;y.endSN="initSegment"!==at?at:0,nt&&(y.startCC=nt.cc,y.initSegment||y.fragments.every((function(t){return t.relurl&&function(t){var e,r;return v.test(null!=(e=null===(r=i.parseURL(t))||void 0===r?void 0:r.path)?e:"")}(t.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,e)).relurl=it.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(t,e){for(var r=t[e],n=e;n--;){var i=t[n];if(!i)return;i.programDateTime=r.programDateTime-1e3*i.duration,r=i}}(T,w),y},t}();function m(t,e){["video","audio","text"].forEach((function(r){var n=t.filter((function(t){return Object(c.isCodecType)(t,r)}));if(n.length){var i=n.filter((function(t){return 0===t.lastIndexOf("avc1",0)||0===t.lastIndexOf("mp4a",0)}));e[r+"Codec"]=i.length>0?i[0]:n[0],t=t.filter((function(t){return-1===n.indexOf(t)}))}})),e.unknownCodecs=t}function y(t,e,r){var n=e[r];n&&(t[r]=n)}function E(t,e){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime),Object(n.isFiniteNumber)(t.programDateTime)||(t.programDateTime=null,t.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"),l=r(/*! ../utils/attr-list */"./src/utils/attr-list.ts"),u=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 l.AttrList(n[1]),u={attrs:o,bitrate:o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),name:o.NAME,url:e.resolve(n[2],r)},c=o.decimalResolution("RESOLUTION");c&&(u.width=c.width,u.height=c.height),m((o.CODECS||"").split(/[ ,]+/).filter((function(e){return e})),u),u.videoCodec&&-1!==u.videoCodec.indexOf("avc1")&&(u.videoCodec=e.convertAVC1ToAVCOTI(u.videoCodec)),i.push(u)}else if(n[3]){var f=new l.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 u=new l.AttrList(a[1]);if(u.TYPE===n){var c={attrs:u,bitrate:0,id:o++,groupId:u["GROUP-ID"],instreamId:u["INSTREAM-ID"],name:u.NAME||u.LANGUAGE||"",type:n,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:u.LANGUAGE,url:u.URI?e.resolve(u.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,w=new a.Fragment(c,t),k=-1;for(h.lastIndex=0,y.m3u8=e;null!==(f=h.exec(e));){var R=f[1];if(R){w.duration=parseFloat(R);var D=(" "+f[2]).slice(1);w.title=D||null,w.tagList.push(D?["INF",R,D]:["INF",R])}else if(f[3])Object(n.isFiniteNumber)(w.duration)&&(w.start=A,m&&(w.levelkey=m),w.sn=T,w.level=r,w.cc=S,w.urlId=d,_.push(w),w.relurl=(" "+f[3]).slice(1),E(w,L),L=w,A+=w.duration,T++,b=0,(w=new a.Fragment(c,t)).start=A,w.sn=T,w.cc=S,w.level=r);else if(f[4]){var O=(" "+f[4]).slice(1);L?w.setByteRange(O,L):w.setByteRange(O)}else if(f[5])w.rawProgramDateTime=(" "+f[5]).slice(1),w.tagList.push(["PROGRAM-DATE-TIME",w.rawProgramDateTime]),-1===k&&(k=_.length);else{if(!(f=f[0].match(p))){u.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 l.AttrList(I),M=P.decimalInteger("SKIPPED-SEGMENTS");if(Object(n.isFiniteNumber)(M)){y.skippedSegments=M;for(var F=M;F--;)_.unshift(null);T+=M}var N=P.enumeratedString("RECENTLY-REMOVED-DATERANGES");N&&(y.recentlyRemovedDateranges=N.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)&&w.tagList.push(x?[I,x]:[I]);break;case"DIS":S++;case"GAP":w.tagList.push([C]);break;case"BITRATE":w.tagList.push([C,I]);break;case"DISCONTINUITY-SEQ":S=parseInt(I);break;case"KEY":var U,B=new l.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){u.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 l.AttrList(I).decimalFloatingPoint("TIME-OFFSET");Object(n.isFiniteNumber)(q)&&(y.startTimeOffset=q);break;case"MAP":var z=new l.AttrList(I);w.relurl=z.URI,z.BYTERANGE&&w.setByteRange(z.BYTERANGE),w.level=r,w.sn="initSegment",m&&(w.levelkey=m),y.initSegment=w,(w=new a.Fragment(c,t)).rawProgramDateTime=y.initSegment.rawProgramDateTime;break;case"SERVER-CONTROL":var Y=new l.AttrList(I);y.canBlockReload=Y.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Y.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Y.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Y.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Y.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var X=new l.AttrList(I);y.partTarget=X.decimalFloatingPoint("PART-TARGET");break;case"PART":var Q=y.partList;Q||(Q=y.partList=[]);var Z=b>0?Q[Q.length-1]:void 0,J=b++,$=new a.Part(new l.AttrList(I),w,t,J,Z);Q.push($),w.duration+=$.duration;break;case"PRELOAD-HINT":var ee=new l.AttrList(I);y.preloadHint=ee;break;case"RENDITION-REPORT":var te=new l.AttrList(I);y.renditionReports=y.renditionReports||[],y.renditionReports.push(te);break;default:u.logger.warn("line parsed but not handled: "+f)}}}L&&!L.relurl?(_.pop(),A-=L.duration,y.partList&&(y.fragmentHint=L)):y.partList&&(E(w,L),w.cc=S,y.fragmentHint=w);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)}))&&(u.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(w=new a.Fragment(c,t)).relurl=ie.relurl,w.level=r,w.sn="initSegment",y.initSegment=w,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(A+=y.fragmentHint.duration),y.totalduration=A,y.endCC=S,k>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}}(_,k),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
  \***************************************/
239
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../errors */"./src/errors.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),u=r(/*! ./m3u8-parser */"./src/loader/m3u8-parser.ts"),l=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../utils/attr-list */"./src/utils/attr-list.ts");function d(t,e){var r=t.url;return void 0!==r&&0!==r.indexOf("data:")||(r=e.url),r}var f=function(){function t(t){this.hls=void 0,this.loaders=Object.create(null),this.hls=t,this.registerListeners()}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(i.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(i.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(i.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.unregisterListeners=function(){var t=this.hls;t.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(i.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(i.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(i.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.createInternalLoader=function(t){var e=this.hls.config,r=e.pLoader,n=e.loader,i=new(r||n)(e);return t.loader=i,this.loaders[t.type]=i,i},e.getInternalLoader=function(t){return this.loaders[t.type]},e.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},e.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}},e.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},e.onManifestLoading=function(t,e){var r=e.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:l.PlaylistContextType.MANIFEST,url:r,deliveryDirectives:null})},e.onLevelLoading=function(t,e){var r=e.id,n=e.level,i=e.url,a=e.deliveryDirectives;this.load({id:r,groupId:null,level:n,responseType:"text",type:l.PlaylistContextType.LEVEL,url:i,deliveryDirectives:a})},e.onAudioTrackLoading=function(t,e){var r=e.id,n=e.groupId,i=e.url,a=e.deliveryDirectives;this.load({id:r,groupId:n,level:null,responseType:"text",type:l.PlaylistContextType.AUDIO_TRACK,url:i,deliveryDirectives:a})},e.onSubtitleTrackLoading=function(t,e){var r=e.id,n=e.groupId,i=e.url,a=e.deliveryDirectives;this.load({id:r,groupId:n,level:null,responseType:"text",type:l.PlaylistContextType.SUBTITLE_TRACK,url:i,deliveryDirectives:a})},e.load=function(t){var e,r,n,i,a,o,u=this.hls.config,c=this.getInternalLoader(t);if(c){var d=c.context;if(d&&d.url===t.url)return void s.logger.trace("[playlist-loader]: playlist request ongoing");s.logger.log("[playlist-loader]: aborting previous loader for type: "+t.type),c.abort()}switch(t.type){case l.PlaylistContextType.MANIFEST:r=u.manifestLoadingMaxRetry,n=u.manifestLoadingTimeOut,i=u.manifestLoadingRetryDelay,a=u.manifestLoadingMaxRetryTimeout;break;case l.PlaylistContextType.LEVEL:case l.PlaylistContextType.AUDIO_TRACK:case l.PlaylistContextType.SUBTITLE_TRACK:r=0,n=u.levelLoadingTimeOut;break;default:r=u.levelLoadingMaxRetry,n=u.levelLoadingTimeOut,i=u.levelLoadingRetryDelay,a=u.levelLoadingMaxRetryTimeout}if(c=this.createInternalLoader(t),null!==(e=t.deliveryDirectives)&&void 0!==e&&e.part&&(t.type===l.PlaylistContextType.LEVEL&&null!==t.level?o=this.hls.levels[t.level].details:t.type===l.PlaylistContextType.AUDIO_TRACK&&null!==t.id?o=this.hls.audioTracks[t.id].details:t.type===l.PlaylistContextType.SUBTITLE_TRACK&&null!==t.id&&(o=this.hls.subtitleTracks[t.id].details),o)){var f=o.partTarget,h=o.targetduration;f&&h&&(n=Math.min(1e3*Math.max(3*f,.8*h),n))}var p={timeout:n,maxRetry:r,retryDelay:i,maxRetryDelay:a,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};c.load(t,p,v)},e.loadsuccess=function(t,e,r,n){if(void 0===n&&(n=null),r.isSidxRequest)return this.handleSidxRequest(t,r),void this.handlePlaylistLoaded(t,e,r,n);this.resetInternalLoader(r.type);var i=t.data;0===i.indexOf("#EXTM3U")?(e.parsing.start=performance.now(),i.indexOf("#EXTINF:")>0||i.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(t,e,r,n):this.handleMasterPlaylist(t,e,r,n)):this.handleManifestParsingError(t,r,"no EXTM3U delimiter",n)},e.loaderror=function(t,e,r){void 0===r&&(r=null),this.handleNetworkError(e,r,!1,t)},e.loadtimeout=function(t,e,r){void 0===r&&(r=null),this.handleNetworkError(e,r,!0)},e.handleMasterPlaylist=function(t,e,r,n){var a=this.hls,o=t.data,l=d(t,r),f=u.default.parseMasterPlaylist(o,l),h=f.levels,p=f.sessionData;if(h.length){var v=h.map((function(t){return{id:t.attrs.AUDIO,audioCodec:t.audioCodec}})),g=h.map((function(t){return{id:t.attrs.SUBTITLES,textCodec:t.textCodec}})),m=u.default.parseMasterPlaylistMedia(o,l,"AUDIO",v),y=u.default.parseMasterPlaylistMedia(o,l,"SUBTITLES",g),E=u.default.parseMasterPlaylistMedia(o,l,"CLOSED-CAPTIONS");m.length&&(m.some((function(t){return!t.url}))||!h[0].audioCodec||h[0].attrs.AUDIO||(s.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new c.AttrList({}),bitrate:0,url:""}))),a.trigger(i.Events.MANIFEST_LOADED,{levels:h,audioTracks:m,subtitles:y,captions:E,url:l,stats:e,networkDetails:n,sessionData:p})}else this.handleManifestParsingError(t,r,"no level found in manifest",n)},e.handleTrackOrLevelPlaylist=function(t,e,r,s){var o=this.hls,f=r.id,h=r.level,p=r.type,v=d(t,r),g=Object(n.isFiniteNumber)(f)?f:0,m=Object(n.isFiniteNumber)(h)?h:g,y=function(t){switch(t.type){case l.PlaylistContextType.AUDIO_TRACK:return l.PlaylistLevelType.AUDIO;case l.PlaylistContextType.SUBTITLE_TRACK:return l.PlaylistLevelType.SUBTITLE;default:return l.PlaylistLevelType.MAIN}}(r),E=u.default.parseLevelPlaylist(t.data,v,m,y,g);if(E.fragments.length){if(p===l.PlaylistContextType.MANIFEST){var T={attrs:new c.AttrList({}),bitrate:0,details:E,name:"",url:v};o.trigger(i.Events.MANIFEST_LOADED,{levels:[T],audioTracks:[],url:v,stats:e,networkDetails:s,sessionData:null})}if(e.parsing.end=performance.now(),E.needSidxRanges){var _=E.initSegment.url;this.load({url:_,isSidxRequest:!0,type:p,level:h,levelDetails:E,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null})}else r.levelDetails=E,this.handlePlaylistLoaded(t,e,r,s)}else o.trigger(i.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:v,reason:"no fragments found in level",level:"number"==typeof r.level?r.level:void 0})},e.handleSidxRequest=function(t,e){var r=Object(o.parseSegmentIndex)(new Uint8Array(t.data));if(r){var n=r.references,i=e.levelDetails;n.forEach((function(t,e){var r=t.info,n=i.fragments[e];0===n.byteRange.length&&n.setByteRange(String(1+r.end-r.start)+"@"+String(r.start))})),i.initSegment.setByteRange(String(r.moovEndOffset)+"@0")}},e.handleManifestParsingError=function(t,e,r,n){this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:e.type===l.PlaylistContextType.MANIFEST,url:t.url,reason:r,response:t,context:e,networkDetails:n})},e.handleNetworkError=function(t,e,r,n){void 0===r&&(r=!1),s.logger.warn("[playlist-loader]: A network "+(r?"timeout":"error")+" occurred while loading "+t.type+" level: "+t.level+" id: "+t.id+' group-id: "'+t.groupId+'"');var o=a.ErrorDetails.UNKNOWN,u=!1,c=this.getInternalLoader(t);switch(t.type){case l.PlaylistContextType.MANIFEST:o=r?a.ErrorDetails.MANIFEST_LOAD_TIMEOUT:a.ErrorDetails.MANIFEST_LOAD_ERROR,u=!0;break;case l.PlaylistContextType.LEVEL:o=r?a.ErrorDetails.LEVEL_LOAD_TIMEOUT:a.ErrorDetails.LEVEL_LOAD_ERROR,u=!1;break;case l.PlaylistContextType.AUDIO_TRACK:o=r?a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case l.PlaylistContextType.SUBTITLE_TRACK:o=r?a.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:a.ErrorDetails.SUBTITLE_LOAD_ERROR,u=!1}c&&this.resetInternalLoader(t.type);var d={type:a.ErrorTypes.NETWORK_ERROR,details:o,fatal:u,url:t.url,loader:c,context:t,networkDetails:e};n&&(d.response=n),this.hls.trigger(i.Events.ERROR,d)},e.handlePlaylistLoaded=function(t,e,r,n){var a=r.type,s=r.level,o=r.id,u=r.groupId,c=r.loader,d=r.levelDetails,f=r.deliveryDirectives;if(null!=d&&d.targetduration){if(c)switch(d.live&&(c.getCacheAge&&(d.ageHeader=c.getCacheAge()||0),c.getCacheAge&&!isNaN(d.ageHeader)||(d.ageHeader=0)),a){case l.PlaylistContextType.MANIFEST:case l.PlaylistContextType.LEVEL:this.hls.trigger(i.Events.LEVEL_LOADED,{details:d,level:s||0,id:o||0,stats:e,networkDetails:n,deliveryDirectives:f});break;case l.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(i.Events.AUDIO_TRACK_LOADED,{details:d,id:o||0,groupId:u||"",stats:e,networkDetails:n,deliveryDirectives:f});break;case l.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(i.Events.SUBTITLE_TRACK_LOADED,{details:d,id:o||0,groupId:u||"",stats:e,networkDetails:n,deliveryDirectives:f})}}else this.handleManifestParsingError(t,r,"invalid target duration",n)},t}();e.default=f},"./src/polyfills/number.ts":
239
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../events */"./src/events.ts"),a=r(/*! ../errors */"./src/errors.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),l=r(/*! ./m3u8-parser */"./src/loader/m3u8-parser.ts"),u=r(/*! ../types/loader */"./src/types/loader.ts"),c=r(/*! ../utils/attr-list */"./src/utils/attr-list.ts");function d(e,t){var r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r}var f=function(){function e(e){this.hls=void 0,this.loaders=Object.create(null),this.hls=e,this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.on(i.Events.LEVEL_LOADING,this.onLevelLoading,this),e.on(i.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(i.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.unregisterListeners=function(){var e=this.hls;e.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),e.off(i.Events.LEVEL_LOADING,this.onLevelLoading,this),e.off(i.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(i.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.createInternalLoader=function(e){var t=this.hls.config,r=t.pLoader,n=t.loader,i=new(r||n)(t);return e.loader=i,this.loaders[e.type]=i,i},t.getInternalLoader=function(e){return this.loaders[e.type]},t.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},t.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},t.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},t.onManifestLoading=function(e,t){var r=t.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:u.PlaylistContextType.MANIFEST,url:r,deliveryDirectives:null})},t.onLevelLoading=function(e,t){var r=t.id,n=t.level,i=t.url,a=t.deliveryDirectives;this.load({id:r,groupId:null,level:n,responseType:"text",type:u.PlaylistContextType.LEVEL,url:i,deliveryDirectives:a})},t.onAudioTrackLoading=function(e,t){var r=t.id,n=t.groupId,i=t.url,a=t.deliveryDirectives;this.load({id:r,groupId:n,level:null,responseType:"text",type:u.PlaylistContextType.AUDIO_TRACK,url:i,deliveryDirectives:a})},t.onSubtitleTrackLoading=function(e,t){var r=t.id,n=t.groupId,i=t.url,a=t.deliveryDirectives;this.load({id:r,groupId:n,level:null,responseType:"text",type:u.PlaylistContextType.SUBTITLE_TRACK,url:i,deliveryDirectives:a})},t.load=function(e){var t,r,n,i,a,o,l=this.hls.config,c=this.getInternalLoader(e);if(c){var d=c.context;if(d&&d.url===e.url)return void s.logger.trace("[playlist-loader]: playlist request ongoing");s.logger.log("[playlist-loader]: aborting previous loader for type: "+e.type),c.abort()}switch(e.type){case u.PlaylistContextType.MANIFEST:r=l.manifestLoadingMaxRetry,n=l.manifestLoadingTimeOut,i=l.manifestLoadingRetryDelay,a=l.manifestLoadingMaxRetryTimeout;break;case u.PlaylistContextType.LEVEL:case u.PlaylistContextType.AUDIO_TRACK:case u.PlaylistContextType.SUBTITLE_TRACK:r=0,n=l.levelLoadingTimeOut;break;default:r=l.levelLoadingMaxRetry,n=l.levelLoadingTimeOut,i=l.levelLoadingRetryDelay,a=l.levelLoadingMaxRetryTimeout}if(c=this.createInternalLoader(e),null!==(t=e.deliveryDirectives)&&void 0!==t&&t.part&&(e.type===u.PlaylistContextType.LEVEL&&null!==e.level?o=this.hls.levels[e.level].details:e.type===u.PlaylistContextType.AUDIO_TRACK&&null!==e.id?o=this.hls.audioTracks[e.id].details:e.type===u.PlaylistContextType.SUBTITLE_TRACK&&null!==e.id&&(o=this.hls.subtitleTracks[e.id].details),o)){var f=o.partTarget,h=o.targetduration;f&&h&&(n=Math.min(1e3*Math.max(3*f,.8*h),n))}var p={timeout:n,maxRetry:r,retryDelay:i,maxRetryDelay:a,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};c.load(e,p,v)},t.loadsuccess=function(e,t,r,n){if(void 0===n&&(n=null),r.isSidxRequest)return this.handleSidxRequest(e,r),void this.handlePlaylistLoaded(e,t,r,n);this.resetInternalLoader(r.type);var i=e.data;0===i.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),i.indexOf("#EXTINF:")>0||i.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(e,t,r,n):this.handleMasterPlaylist(e,t,r,n)):this.handleManifestParsingError(e,r,"no EXTM3U delimiter",n)},t.loaderror=function(e,t,r){void 0===r&&(r=null),this.handleNetworkError(t,r,!1,e)},t.loadtimeout=function(e,t,r){void 0===r&&(r=null),this.handleNetworkError(t,r,!0)},t.handleMasterPlaylist=function(e,t,r,n){var a=this.hls,o=e.data,u=d(e,r),f=l.default.parseMasterPlaylist(o,u),h=f.levels,p=f.sessionData;if(h.length){var v=h.map((function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}})),g=h.map((function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}})),m=l.default.parseMasterPlaylistMedia(o,u,"AUDIO",v),y=l.default.parseMasterPlaylistMedia(o,u,"SUBTITLES",g),E=l.default.parseMasterPlaylistMedia(o,u,"CLOSED-CAPTIONS");m.length&&(m.some((function(e){return!e.url}))||!h[0].audioCodec||h[0].attrs.AUDIO||(s.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),m.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new c.AttrList({}),bitrate:0,url:""}))),a.trigger(i.Events.MANIFEST_LOADED,{levels:h,audioTracks:m,subtitles:y,captions:E,url:u,stats:t,networkDetails:n,sessionData:p})}else this.handleManifestParsingError(e,r,"no level found in manifest",n)},t.handleTrackOrLevelPlaylist=function(e,t,r,s){var o=this.hls,f=r.id,h=r.level,p=r.type,v=d(e,r),g=Object(n.isFiniteNumber)(f)?f:0,m=Object(n.isFiniteNumber)(h)?h:g,y=function(e){switch(e.type){case u.PlaylistContextType.AUDIO_TRACK:return u.PlaylistLevelType.AUDIO;case u.PlaylistContextType.SUBTITLE_TRACK:return u.PlaylistLevelType.SUBTITLE;default:return u.PlaylistLevelType.MAIN}}(r),E=l.default.parseLevelPlaylist(e.data,v,m,y,g);if(E.fragments.length){if(p===u.PlaylistContextType.MANIFEST){var _={attrs:new c.AttrList({}),bitrate:0,details:E,name:"",url:v};o.trigger(i.Events.MANIFEST_LOADED,{levels:[_],audioTracks:[],url:v,stats:t,networkDetails:s,sessionData:null})}if(t.parsing.end=performance.now(),E.needSidxRanges){var T=E.initSegment.url;this.load({url:T,isSidxRequest:!0,type:p,level:h,levelDetails:E,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null})}else r.levelDetails=E,this.handlePlaylistLoaded(e,t,r,s)}else o.trigger(i.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:v,reason:"no fragments found in level",level:"number"==typeof r.level?r.level:void 0})},t.handleSidxRequest=function(e,t){var r=Object(o.parseSegmentIndex)(new Uint8Array(e.data));if(r){var n=r.references,i=t.levelDetails;n.forEach((function(e,t){var r=e.info,n=i.fragments[t];0===n.byteRange.length&&n.setByteRange(String(1+r.end-r.start)+"@"+String(r.start))})),i.initSegment.setByteRange(String(r.moovEndOffset)+"@0")}},t.handleManifestParsingError=function(e,t,r,n){this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:t.type===u.PlaylistContextType.MANIFEST,url:e.url,reason:r,response:e,context:t,networkDetails:n})},t.handleNetworkError=function(e,t,r,n){void 0===r&&(r=!1),s.logger.warn("[playlist-loader]: A network "+(r?"timeout":"error")+" occurred while loading "+e.type+" level: "+e.level+" id: "+e.id+' group-id: "'+e.groupId+'"');var o=a.ErrorDetails.UNKNOWN,l=!1,c=this.getInternalLoader(e);switch(e.type){case u.PlaylistContextType.MANIFEST:o=r?a.ErrorDetails.MANIFEST_LOAD_TIMEOUT:a.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case u.PlaylistContextType.LEVEL:o=r?a.ErrorDetails.LEVEL_LOAD_TIMEOUT:a.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case u.PlaylistContextType.AUDIO_TRACK:o=r?a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case u.PlaylistContextType.SUBTITLE_TRACK:o=r?a.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:a.ErrorDetails.SUBTITLE_LOAD_ERROR,l=!1}c&&this.resetInternalLoader(e.type);var d={type:a.ErrorTypes.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:c,context:e,networkDetails:t};n&&(d.response=n),this.hls.trigger(i.Events.ERROR,d)},t.handlePlaylistLoaded=function(e,t,r,n){var a=r.type,s=r.level,o=r.id,l=r.groupId,c=r.loader,d=r.levelDetails,f=r.deliveryDirectives;if(null!=d&&d.targetduration){if(c)switch(d.live&&(c.getCacheAge&&(d.ageHeader=c.getCacheAge()||0),c.getCacheAge&&!isNaN(d.ageHeader)||(d.ageHeader=0)),a){case u.PlaylistContextType.MANIFEST:case u.PlaylistContextType.LEVEL:this.hls.trigger(i.Events.LEVEL_LOADED,{details:d,level:s||0,id:o||0,stats:t,networkDetails:n,deliveryDirectives:f});break;case u.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(i.Events.AUDIO_TRACK_LOADED,{details:d,id:o||0,groupId:l||"",stats:t,networkDetails:n,deliveryDirectives:f});break;case u.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(i.Events.SUBTITLE_TRACK_LOADED,{details:d,id:o||0,groupId:l||"",stats:t,networkDetails:n,deliveryDirectives:f})}}else this.handleManifestParsingError(e,r,"invalid target duration",n)},e}();t.default=f},"./src/polyfills/number.ts":
240
240
  /*!*********************************!*\
241
241
  !*** ./src/polyfills/number.ts ***!
242
242
  \*********************************/
243
- /*! exports provided: isFiniteNumber, MAX_SAFE_INTEGER */function(t,e,r){r.r(e),r.d(e,"isFiniteNumber",(function(){return n})),r.d(e,"MAX_SAFE_INTEGER",(function(){return i}));var n=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},i=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":
243
+ /*! exports provided: isFiniteNumber, MAX_SAFE_INTEGER */function(e,t,r){r.r(t),r.d(t,"isFiniteNumber",(function(){return n})),r.d(t,"MAX_SAFE_INTEGER",(function(){return i}));var n=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},i=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":
244
244
  /*!*********************************!*\
245
245
  !*** ./src/remux/aac-helper.ts ***!
246
246
  \*********************************/
247
- /*! exports provided: default */function(t,e,r){r.r(e);var n=function(){function t(){}return t.getSilentFrame=function(t,e){switch(t){case"mp4a.40.2":if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(1===e)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===e)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===e)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}},t}();e.default=n},"./src/remux/mp4-generator.ts":
247
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=function(){function e(){}return e.getSilentFrame=function(e,t){switch(e){case"mp4a.40.2":if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}},e}();t.default=n},"./src/remux/mp4-generator.ts":
248
248
  /*!************************************!*\
249
249
  !*** ./src/remux/mp4-generator.ts ***!
250
250
  \************************************/
251
- /*! exports provided: default */function(t,e,r){r.r(e);var n=Math.pow(2,32)-1,i=function(){function t(){}return t.init=function(){var e;for(e in t.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},t.types)t.types.hasOwnProperty(e)&&(t.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([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]);t.HDLR_TYPES={video:r,audio:n};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);t.STTS=t.STSC=t.STCO=a,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);t.FTYP=t.box(t.types.ftyp,s,u,s,o),t.DINF=t.box(t.types.dinf,t.box(t.types.dref,i))},t.box=function(t){for(var e=8,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=n.length,s=a;a--;)e+=n[a].byteLength;var o=new Uint8Array(e);for(o[0]=e>>24&255,o[1]=e>>16&255,o[2]=e>>8&255,o[3]=255&e,o.set(t,4),a=0,e=8;a<s;a++)o.set(n[a],e),e+=n[a].byteLength;return o},t.hdlr=function(e){return t.box(t.types.hdlr,t.HDLR_TYPES[e])},t.mdat=function(e){return t.box(t.types.mdat,e)},t.mdhd=function(e,r){r*=e;var i=Math.floor(r/(n+1)),a=Math.floor(r%(n+1));return t.box(t.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,85,196,0,0]))},t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))},t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},t.minf=function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))},t.moof=function(e,r,n){return t.box(t.types.moof,t.mfhd(e),t.traf(n,r))},t.moov=function(e){for(var r=e.length,n=[];r--;)n[r]=t.trak(e[r]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(n).concat(t.mvex(e)))},t.mvex=function(e){for(var r=e.length,n=[];r--;)n[r]=t.trex(e[r]);return t.box.apply(null,[t.types.mvex].concat(n))},t.mvhd=function(e,r){r*=e;var i=Math.floor(r/(n+1)),a=Math.floor(r%(n+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,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,255,255,255,255]);return t.box(t.types.mvhd,s)},t.sdtp=function(e){var r,n,i=e.samples||[],a=new Uint8Array(4+i.length);for(r=0;r<i.length;r++)n=i[r].flags,a[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return t.box(t.types.sdtp,a)},t.stbl=function(e){return t.box(t.types.stbl,t.stsd(e),t.box(t.types.stts,t.STTS),t.box(t.types.stsc,t.STSC),t.box(t.types.stsz,t.STSZ),t.box(t.types.stco,t.STCO))},t.avc1=function(e){var r,n,i,a=[],s=[];for(r=0;r<e.sps.length;r++)i=(n=e.sps[r]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)i=(n=e.pps[r]).byteLength,s.push(i>>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(n));var o=t.box(t.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|e.sps.length].concat(a).concat([e.pps.length]).concat(s))),u=e.width,l=e.height,c=e.pixelRatio[0],d=e.pixelRatio[1];return t.box(t.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,255&u,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,d>>24,d>>16&255,d>>8&255,255&d])))},t.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},t.mp4a=function(e){var r=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){var r=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))},t.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.mp3(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))},t.tkhd=function(e){var r=e.id,i=e.duration*e.timescale,a=e.width,s=e.height,o=Math.floor(i/(n+1)),u=Math.floor(i%(n+1));return t.box(t.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,u>>24,u>>16&255,u>>8&255,255&u,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,s>>8&255,255&s,0,0]))},t.traf=function(e,r){var i=t.sdtp(e),a=e.id,s=Math.floor(r/(n+1)),o=Math.floor(r%(n+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o])),t.trun(e,i.length+16+20+8+16+8+8),i)},t.trak=function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))},t.trex=function(e){var r=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},t.trun=function(e,r){var n,i,a,s,o,u,l=e.samples||[],c=l.length,d=12+16*c,f=new Uint8Array(d);for(r+=8+d,f.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),n=0;n<c;n++)a=(i=l[n]).duration,s=i.size,o=i.flags,u=i.cts,f.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*n);return t.box(t.types.trun,f)},t.initSegment=function(e){t.types||t.init();var r=t.moov(e),n=new Uint8Array(t.FTYP.byteLength+r.byteLength);return n.set(t.FTYP),n.set(r,t.FTYP.byteLength),n},t}();i.types=void 0,i.HDLR_TYPES=void 0,i.STTS=void 0,i.STSC=void 0,i.STCO=void 0,i.STSZ=void 0,i.VMHD=void 0,i.SMHD=void 0,i.STSD=void 0,i.FTYP=void 0,i.DINF=void 0,e.default=i},"./src/remux/mp4-remuxer.ts":
251
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=Math.pow(2,32)-1,i=function(){function e(){}return e.init=function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),n=new Uint8Array([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]);e.HDLR_TYPES={video:r,audio:n};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,s,l,s,o),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,i))},e.box=function(e){for(var t=8,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=n.length,s=a;a--;)t+=n[a].byteLength;var o=new Uint8Array(t);for(o[0]=t>>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=255&t,o.set(e,4),a=0,t=8;a<s;a++)o.set(n[a],t),t+=n[a].byteLength;return o},e.hdlr=function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])},e.mdat=function(t){return e.box(e.types.mdat,t)},e.mdhd=function(t,r){r*=t;var i=Math.floor(r/(n+1)),a=Math.floor(r%(n+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,r,n){return e.box(e.types.moof,e.mfhd(t),e.traf(n,r))},e.moov=function(t){for(var r=t.length,n=[];r--;)n[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(n).concat(e.mvex(t)))},e.mvex=function(t){for(var r=t.length,n=[];r--;)n[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(n))},e.mvhd=function(t,r){r*=t;var i=Math.floor(r/(n+1)),a=Math.floor(r%(n+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,a>>24,a>>16&255,a>>8&255,255&a,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,255,255,255,255]);return e.box(e.types.mvhd,s)},e.sdtp=function(t){var r,n,i=t.samples||[],a=new Uint8Array(4+i.length);for(r=0;r<i.length;r++)n=i[r].flags,a[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return e.box(e.types.sdtp,a)},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))},e.avc1=function(t){var r,n,i,a=[],s=[];for(r=0;r<t.sps.length;r++)i=(n=t.sps[r]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(n));for(r=0;r<t.pps.length;r++)i=(n=t.pps[r]).byteLength,s.push(i>>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(n));var o=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(s))),l=t.width,u=t.height,c=t.pixelRatio[0],d=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,d>>24,d>>16&255,d>>8&255,255&d])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.mp4a=function(t){var r=t.samplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){var r=t.samplerate;return e.box(e.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]))},e.stsd=function(t){return"audio"===t.type?t.isAAC||"mp3"!==t.codec?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.mp3(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var r=t.id,i=t.duration*t.timescale,a=t.width,s=t.height,o=Math.floor(i/(n+1)),l=Math.floor(i%(n+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,l>>24,l>>16&255,l>>8&255,255&l,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,s>>8&255,255&s,0,0]))},e.traf=function(t,r){var i=e.sdtp(t),a=t.id,s=Math.floor(r/(n+1)),o=Math.floor(r%(n+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o])),e.trun(t,i.length+16+20+8+16+8+8),i)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,r){var n,i,a,s,o,l,u=t.samples||[],c=u.length,d=12+16*c,f=new Uint8Array(d);for(r+=8+d,f.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),n=0;n<c;n++)a=(i=u[n]).duration,s=i.size,o=i.flags,l=i.cts,f.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*n);return e.box(e.types.trun,f)},e.initSegment=function(t){e.types||e.init();var r=e.moov(t),n=new Uint8Array(e.FTYP.byteLength+r.byteLength);return n.set(e.FTYP),n.set(r,e.FTYP.byteLength),n},e}();i.types=void 0,i.HDLR_TYPES=void 0,i.STTS=void 0,i.STSC=void 0,i.STCO=void 0,i.STSZ=void 0,i.VMHD=void 0,i.SMHD=void 0,i.STSD=void 0,i.FTYP=void 0,i.DINF=void 0,t.default=i},"./src/remux/mp4-remuxer.ts":
252
252
  /*!**********************************!*\
253
253
  !*** ./src/remux/mp4-remuxer.ts ***!
254
254
  \**********************************/
255
- /*! exports provided: default, normalizePts */function(t,e,r){r.r(e),r.d(e,"default",(function(){return p})),r.d(e,"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(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}var d=null,f=null,h=!1,p=function(){function t(t,e,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=t,this.config=e,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 e=t.prototype;return e.destroy=function(){},e.resetTimeStamp=function(t){u.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=t},e.resetNextTimestamp=function(){u.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},e.resetInitSegment=function(){u.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},e.getVideoStartPts=function(t){var e=!1,r=t.reduce((function(t,r){var n=r.pts-t;return n<-4294967296?(e=!0,v(t,r.pts)):n>0?t:r.pts}),t[0].pts);return e&&u.logger.debug("PTS rollover detected"),r},e.remux=function(t,e,r,n,i,a,s){var o,l,c,d,f,h,p=i,g=i,m=t.pid>-1,y=e.pid>-1,E=t.samples.length>0,T=e.samples.length>1;if((!m||E)&&(!y||T)||this.ISGenerated||s){this.ISGenerated||(c=this.generateIS(t,e,i));var _=this.isVideoContiguous;if(T&&!_&&this.config.forceKeyFrameOnDiscontinuity){var b=e.samples.length,A=function(t){for(var e=0;e<t.length;e++)if(t[e].key)return e;return-1}(e.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(e.samples);e.samples=e.samples.slice(A),e.dropped+=A,g+=(e.samples[0].pts-S)/(e.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&&T){var L=this.getVideoStartPts(e.samples),k=(v(t.samples[0].pts,L)-L)/e.inputTimeScale;p+=Math.max(0,k),g+=Math.max(0,-k)}if(E){if(t.samplerate||(u.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),delete(c=this.generateIS(t,e,i)).video),l=this.remuxAudio(t,p,this.isAudioContiguous,a,T?g:void 0),T){var w=l?l.endPTS-l.startPTS:0;e.inputTimeScale||(u.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(t,e,i)),o=this.remuxVideo(e,g,_,w)}}else T&&(o=this.remuxVideo(e,g,_,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}},e.generateIS=function(t,e,r){var i,s,o,u=t.samples,l=e.samples,c=this.typeSupported,d={},f=!Object(n.isFiniteNumber)(this._initPTS),h="audio/mp4";if(f&&(i=s=1/0),t.config&&u.length&&(t.timescale=t.samplerate,t.isAAC||(c.mpeg?(h="audio/mpeg",t.codec=""):c.mp3&&(t.codec="mp3")),d.audio={id:"audio",container:h,codec:t.codec,initSegment:!t.isAAC&&c.mpeg?new Uint8Array(0):a.default.initSegment([t]),metadata:{channelCount:t.channelCount}},f&&(o=t.inputTimeScale,i=s=u[0].pts-Math.round(o*r))),e.sps&&e.pps&&l.length&&(e.timescale=e.inputTimeScale,d.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:a.default.initSegment([e]),metadata:{width:e.width,height:e.height}},f)){o=e.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}},e.remuxVideo=function(t,e,r,n){var i,f,p,m=t.inputTimeScale,y=t.samples,E=[],T=y.length,_=this._initPTS,b=this.nextAvcDts,A=8,S=Number.POSITIVE_INFINITY,L=Number.NEGATIVE_INFINITY,k=0,w=!1;r&&null!==b||(b=e*m-(y[0].pts-v(y[0].dts,y[0].pts)));for(var D=0;D<T;D++){var R=y[D];R.pts=v(R.pts-_,b),R.dts=v(R.dts-_,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(t,e){var r=t.dts-e.dts,n=t.pts-e.pts;return r||n})),f=y[0].dts,p=y[y.length-1].dts;var O=Math.round((p-f)/(T-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<T;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<T;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 F=y[0].pts-P;y[0].dts=f,y[0].pts=F,u.logger.log("Video: First PTS/DTS adjusted: "+Object(l.toMsFromMpegTsClock)(F,!0)+"/"+Object(l.toMsFromMpegTsClock)(f,!0)+", delta: "+Object(l.toMsFromMpegTsClock)(P,!0)+" ms")}}h&&(f=Math.max(0,f));for(var N=0,U=0,B=0;B<T;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,N+=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[T-1].dts;var W,q=U+4*N+8;try{W=new Uint8Array(q)}catch(t){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<T;z++){for(var X=y[z],Q=X.units,J=0,Z=0,$=Q.length;Z<$;Z++){var tt=Q[Z],et=tt.data,rt=tt.data.byteLength;Y.setUint32(A,rt),A+=4,W.set(et,A),A+=rt,J+=4+rt}if(z<T-1)i=y[z+1].dts-X.dts;else{var nt=this.config,it=X.dts-y[z>0?z-1:z].dts;if(nt.stretchShortVideoTrack&&null!==this.nextAudioPts){var at=Math.floor(nt.maxBufferHole*m),st=(n?S+n*m:this.nextAudioPts)-X.pts;st>at?((i=st-it)<0&&(i=it),u.logger.log("[mp4-remuxer]: It is approximately "+st/90+" ms to the next segment; using duration "+i/90+" ms for the last video frame.")):i=it}else i=it}var ot=Math.round(X.pts-X.dts);E.push(new g(X.key,i,J,ot))}if(E.length&&d&&d<70){var ut=E[0].flags;ut.dependsOn=2,ut.isNonSync=0}console.assert(void 0!==i,"mp4SampleDuration must be computed"),this.nextAvcDts=b=p+i,this.isVideoContiguous=!0;var lt={data1:a.default.moof(t.sequenceNumber++,f,c({},t,{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:t.dropped};return t.samples=[],t.dropped=0,console.assert(W.length,"MDAT length must not be zero"),lt},e.remuxAudio=function(t,e,r,n,l){var d,f=t.inputTimeScale,h=f/(t.samplerate?t.samplerate:f),p=t.isAAC?1024:1152,m=p*h,y=this._initPTS,E=!t.isAAC&&this.typeSupported.mpeg,T=[],_=t.samples,b=E?0:8,A=this.nextAudioPts||-1,S=e*f;if(this.isAudioContiguous=r=r||_.length&&A>0&&(n&&Math.abs(S-A)<9e3||Math.abs(v(_[0].pts-y,S)-A)<20*m),_.forEach((function(t){t.pts=t.dts=v(t.pts-y,S)})),!r||A<0){if(!(_=_.filter((function(t){return t.pts>=0}))).length)return;A=0===l?0:n?Math.max(0,S):_[0].pts}if(t.isAAC)for(var L=this.config.maxAudioFramesDrift,k=0,w=A;k<_.length;){var D=_[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."),_.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(t.manifestCodec||t.codec,t.channelCount))||(u.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),d=D.unit.subarray()),_.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,F=null,N=null,U=0,B=_.length;B--;)U+=_[B].unit.byteLength;for(var j=0,G=_.length;j<G;j++){var H=_[j],K=H.unit,V=H.pts;if(null!==N)T[j-1].duration=Math.round((V-N)/h);else{var W=Math.round(1e3*(V-A)/f),q=0;if(r&&t.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(t.manifestCodec||t.codec,t.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(F=V,!(U>0))return;U+=b;try{M=new Uint8Array(U)}catch(t){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(t.manifestCodec||t.codec,t.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,T.push(new g(!0,1024,d.byteLength,0))}M.set(K,b);var z=K.byteLength;b+=z,T.push(new g(!0,p,z,0)),N=V}var X=T.length;if(X){var Q=T[T.length-1];this.nextAudioPts=A=N+h*Q.duration;var J=E?new Uint8Array(0):a.default.moof(t.sequenceNumber++,F/h,c({},t,{samples:T}));t.samples=[];var Z=F/f,$=A/f,tt={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"),tt}},e.remuxEmptyAudio=function(t,e,r,n){var a=t.inputTimeScale,s=a/(t.samplerate?t.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(t.manifestCodec||t.codec,t.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 t.samples=p,this.remuxAudio(t,e,r,!1)}u.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},e.remuxID3=function(t,e){var r=t.samples.length;if(r){for(var n=t.inputTimeScale,i=this._initPTS,a=this._initDTS,s=0;s<r;s++){var o=t.samples[s];o.pts=v(o.pts-i,e*n)/n,o.dts=v(o.dts-a,e*n)/n}var u=t.samples;return t.samples=[],{samples:u}}},e.remuxText=function(t,e){var r=t.samples.length;if(r){for(var n=t.inputTimeScale,i=this._initPTS,a=0;a<r;a++){var s=t.samples[a];s.pts=v(s.pts-i,e*n)/n}t.samples.sort((function(t,e){return t.pts-e.pts}));var o=t.samples;return t.samples=[],{samples:o}}},t}();function v(t,e){var r;if(null===e)return t;for(r=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=r;return t}var g=function(t,e,r,n){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=e,this.size=r,this.cts=n,this.flags=new m(t)},m=function(t){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=t?2:1,this.isNonSync=t?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"),l=r(/*! ../utils/logger */"./src/utils/logger.ts"),u=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){l.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){l.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){l.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&&l.logger.debug("PTS rollover detected"),r},t.remux=function(e,t,r,n,i,a,s){var o,u,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){l.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&&(l.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),w=(v(e.samples[0].pts,L)-L)/t.inputTimeScale;p+=Math.max(0,w),g+=Math.max(0,-w)}if(E){if(e.samplerate||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),delete(c=this.generateIS(e,t,i)).video),u=this.remuxAudio(e,p,this.isAudioContiguous,a,_?g:void 0),_){var k=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(e,t,i)),o=this.remuxVideo(t,g,T,k)}}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:u,video:o,initSegment:c,independent:h,text:d,id3:f}},t.generateIS=function(e,t,r){var i,s,o,l=e.samples,u=t.samples,c=this.typeSupported,d={},f=!Object(n.isFiniteNumber)(this._initPTS),h="audio/mp4";if(f&&(i=s=1/0),e.config&&l.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=l[0].pts-Math.round(o*r))),t.sps&&t.pps&&u.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(u),g=Math.round(o*r);s=Math.min(s,v(u[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,w=0,k=!1;r&&null!==b||(b=t*m-(y[0].pts-v(y[0].dts,y[0].pts)));for(var R=0;R<_;R++){var D=y[R];D.pts=v(D.pts-T,b),D.dts=v(D.dts-T,b),D.dts>D.pts&&(w=Math.max(Math.min(w,D.pts-D.dts),-18e3)),D.dts<y[R>0?R-1:R].dts&&(k=!0)}k&&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(w<0){if(w<-2*O){l.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(u.toMsFromMpegTsClock)(-O,!0)+" ms");for(var C=w,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{l.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(u.toMsFromMpegTsClock)(w,!0)+" ms to overcome this issue");for(var x=0;x<_;x++)y[x].dts=y[x].dts+w}f=y[0].dts}if(r){var P=f-b,M=P>O;if(M||P<-1){M?l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(P,!0)+" ms ("+P+"dts) hole between fragments detected, filling it"):l.logger.warn("AVC: "+Object(u.toMsFromMpegTsClock)(-P,!0)+" ms ("+P+"dts) overlapping between fragments detected"),f=b;var F=y[0].pts-P;y[0].dts=f,y[0].pts=F,l.logger.log("Video: First PTS/DTS adjusted: "+Object(u.toMsFromMpegTsClock)(F,!0)+"/"+Object(u.toMsFromMpegTsClock)(f,!0)+", delta: "+Object(u.toMsFromMpegTsClock)(P,!0)+" ms")}}h&&(f=Math.max(0,f));for(var N=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,N+=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*N+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 z=new DataView(W.buffer);z.setUint32(0,q),W.set(a.default.types.mdat,4);for(var Y=0;Y<_;Y++){for(var X=y[Y],Q=X.units,Z=0,J=0,$=Q.length;J<$;J++){var ee=Q[J],te=ee.data,re=ee.data.byteLength;z.setUint32(A,re),A+=4,W.set(te,A),A+=re,Z+=4+re}if(Y<_-1)i=y[Y+1].dts-X.dts;else{var ne=this.config,ie=X.dts-y[Y>0?Y-1:Y].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),l.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,Z,oe))}if(E.length&&d&&d<70){var le=E[0].flags;le.dependsOn=2,le.isNonSync=0}console.assert(void 0!==i,"mp4SampleDuration must be computed"),this.nextAvcDts=b=p+i,this.isVideoContiguous=!0;var ue={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"),ue},t.remuxAudio=function(e,t,r,n,u){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===u?0:n?Math.max(0,S):T[0].pts}if(e.isAAC)for(var L=this.config.maxAudioFramesDrift,w=0,k=A;w<T.length;){var R=T[w],D=R.pts,O=D-k,C=Math.abs(1e3*O/f);if(O<=-L*m&&void 0!==u)r||w>0?(l.logger.warn("[mp4-remuxer]: Dropping 1 audio frame @ "+(k/f).toFixed(3)+"s due to "+Math.round(C)+" ms overlap."),T.splice(w,1)):(l.logger.warn("Audio frame @ "+(D/f).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*O/f)+" ms."),k=D+m,w++);else if(O>=L*m&&C<1e4&&void 0!==u){var I=Math.floor(O/m);k=D-I*m,l.logger.warn("[mp4-remuxer]: Injecting "+I+" audio frame @ "+(k/f).toFixed(3)+"s due to "+Math.round(1e3*O/f)+" ms gap.");for(var x=0;x<I;x++){var P=Math.max(k,0);(d=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(l.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),d=R.unit.subarray()),T.splice(w,0,{unit:d,pts:P,dts:P}),k+=m,w++}R.pts=R.dts=k,k+=m,w++}else R.pts=R.dts=k,k+=m,w++}for(var M,F=null,N=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!==N)_[j-1].duration=Math.round((V-N)/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),l.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){l.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(F=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 z=0;z<q;z++)(d=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount))||(l.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 Y=K.byteLength;b+=Y,_.push(new g(!0,p,Y,0)),N=V}var X=_.length;if(X){var Q=_[_.length-1];this.nextAudioPts=A=N+h*Q.duration;var Z=E?new Uint8Array(0):a.default.moof(e.sequenceNumber++,F/h,c({},e,{samples:_}));e.samples=[];var J=F/f,$=A/f,ee={data1:Z,data2:M,startPTS:J,endPTS:$,startDTS:J,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,u=(null!==o?o:n.startDTS*a)+this._initDTS,c=n.endDTS*a+this._initDTS,d=1024*s,f=Math.ceil((c-u)/d),h=i.default.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(l.logger.warn("[mp4-remuxer]: remux empty Audio"),h){for(var p=[],v=0;v<f;v++){var g=u+v*d;p.push({unit:h,pts:g,dts:g})}return e.samples=p,this.remuxAudio(e,t,r,!1)}l.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 l=e.samples;return e.samples=[],{samples:l}}},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
  \******************************************/
259
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),a=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=function(){function t(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var e=t.prototype;return e.destroy=function(){},e.resetTimeStamp=function(t){this.initPTS=t,this.lastEndDTS=null},e.resetNextTimestamp=function(){this.lastEndDTS=null},e.resetInitSegment=function(t,e,r){this.audioCodec=e,this.videoCodec=r,this.generateInitSegment(t),this.emitInitSegment=!0},e.generateInitSegment=function(t){var e=this.audioCodec,r=this.videoCodec;if(!t||!t.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var n=this.initData=Object(i.parseInitSegment)(t);e||(e=l(n.audio,a.ElementaryStreamTypes.AUDIO)),r||(r=l(n.video,a.ElementaryStreamTypes.VIDEO));var o={};n.audio&&n.video?o.audiovideo={container:"video/mp4",codec:e+","+r,initSegment:t,id:"main"}:n.audio?o.audio={container:"audio/mp4",codec:e,initSegment:t,id:"audio"}:n.video?o.video={container:"video/mp4",codec:r,initSegment:t,id:"main"}:s.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},e.remux=function(t,e,r,a,o){var l=this.initPTS,c=this.lastEndDTS,d={audio:void 0,video:void 0,text:a,id3:r,initSegment:void 0};Object(n.isFiniteNumber)(c)||(c=this.lastEndDTS=o||0);var f=e.samples;if(!f||!f.length)return d;var h={initPTS:void 0,timescale:1},p=this.initData;if(p&&p.length||(this.generateInitSegment(f),p=this.initData),!p||!p.length)return s.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),d;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(n.isFiniteNumber)(l)||(this.initPTS=h.initPTS=l=u(p,f,c));var v=Object(i.getDuration)(f,p),g=c,m=v+g;Object(i.offsetStartDTS)(p,f,l),v>0?this.lastEndDTS=m:(s.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var y=!!p.audio,E=!!p.video,T="";y&&(T+="audio"),E&&(T+="video");var _={data1:f,startPTS:g,startDTS:g,endPTS:m,endDTS:m,type:T,hasAudio:y,hasVideo:E,nb:1,dropped:0};return d.audio="audio"===_.type?_:void 0,d.video="audio"!==_.type?_:void 0,d.text=a,d.id3=r,d.initSegment=h,d},t}(),u=function(t,e,r){return Object(i.getStartDTS)(t,e)-r};function l(t,e){var r=null==t?void 0:t.codec;return r&&r.length>4?r:"hvc1"===r?"hvc1.1.c.L120.90":"av01"===r?"av01.0.04M.08":"avc1"===r||e===a.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}e.default=o},"./src/task-loop.ts":
259
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../utils/mp4-tools */"./src/utils/mp4-tools.ts"),a=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),s=r(/*! ../utils/logger */"./src/utils/logger.ts"),o=function(){function e(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var t=e.prototype;return t.destroy=function(){},t.resetTimeStamp=function(e){this.initPTS=e,this.lastEndDTS=null},t.resetNextTimestamp=function(){this.lastEndDTS=null},t.resetInitSegment=function(e,t,r){this.audioCodec=t,this.videoCodec=r,this.generateInitSegment(e),this.emitInitSegment=!0},t.generateInitSegment=function(e){var t=this.audioCodec,r=this.videoCodec;if(!e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var n=this.initData=Object(i.parseInitSegment)(e);t||(t=u(n.audio,a.ElementaryStreamTypes.AUDIO)),r||(r=u(n.video,a.ElementaryStreamTypes.VIDEO));var o={};n.audio&&n.video?o.audiovideo={container:"video/mp4",codec:t+","+r,initSegment:e,id:"main"}:n.audio?o.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:n.video?o.video={container:"video/mp4",codec:r,initSegment:e,id:"main"}:s.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},t.remux=function(e,t,r,a,o){var u=this.initPTS,c=this.lastEndDTS,d={audio:void 0,video:void 0,text:a,id3:r,initSegment:void 0};Object(n.isFiniteNumber)(c)||(c=this.lastEndDTS=o||0);var f=t.samples;if(!f||!f.length)return d;var h={initPTS:void 0,timescale:1},p=this.initData;if(p&&p.length||(this.generateInitSegment(f),p=this.initData),!p||!p.length)return s.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),d;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(n.isFiniteNumber)(u)||(this.initPTS=h.initPTS=u=l(p,f,c));var v=Object(i.getDuration)(f,p),g=c,m=v+g;Object(i.offsetStartDTS)(p,f,u),v>0?this.lastEndDTS=m:(s.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var y=!!p.audio,E=!!p.video,_="";y&&(_+="audio"),E&&(_+="video");var T={data1:f,startPTS:g,startDTS:g,endPTS:m,endDTS:m,type:_,hasAudio:y,hasVideo:E,nb:1,dropped:0};return d.audio="audio"===T.type?T:void 0,d.video="audio"!==T.type?T:void 0,d.text=a,d.id3=r,d.initSegment=h,d},e}(),l=function(e,t,r){return Object(i.getStartDTS)(e,t)-r};function u(e,t){var r=null==e?void 0:e.codec;return r&&r.length>4?r:"hvc1"===r?"hvc1.1.c.L120.90":"av01"===r?"av01.0.04M.08":"avc1"===r||t===a.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}t.default=o},"./src/task-loop.ts":
260
260
  /*!**************************!*\
261
261
  !*** ./src/task-loop.ts ***!
262
262
  \**************************/
263
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return n}));var n=function(){function t(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var e=t.prototype;return e.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},e.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},e.onHandlerDestroyed=function(){},e.hasInterval=function(){return!!this._tickInterval},e.hasNextTick=function(){return!!this._tickTimer},e.setInterval=function(t){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,t),!0)},e.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},e.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},e.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&(this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)),this._tickCallCount=0)},e.doTick=function(){},t}()},"./src/types/level.ts":
263
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return n}));var n=function(){function e(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var t=e.prototype;return t.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},t.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},t.onHandlerDestroyed=function(){},t.hasInterval=function(){return!!this._tickInterval},t.hasNextTick=function(){return!!this._tickTimer},t.setInterval=function(e){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,e),!0)},t.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},t.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},t.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&(this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)),this._tickCallCount=0)},t.doTick=function(){},e}()},"./src/types/level.ts":
264
264
  /*!****************************!*\
265
265
  !*** ./src/types/level.ts ***!
266
266
  \****************************/
267
- /*! exports provided: HlsSkip, getSkipValue, HlsUrlParameters, Level */function(t,e,r){function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var i;function a(t,e){var r=t.canSkipUntil,n=t.canSkipDateRanges,a=t.endSN;return r&&(void 0!==e?e-a:0)<r?n?i.v2:i.Yes:i.No}r.r(e),r.d(e,"HlsSkip",(function(){return i})),r.d(e,"getSkipValue",(function(){return a})),r.d(e,"HlsUrlParameters",(function(){return s})),r.d(e,"Level",(function(){return o})),function(t){t.No="",t.Yes="YES",t.v2="v2"}(i||(i={}));var s=function(){function t(t,e,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=e,this.skip=r}return t.prototype.addDirectives=function(t){var e=new self.URL(t);return void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.toString()},t}(),o=function(){function t(t){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[t.url],this.attrs=t.attrs,this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.unknownCodecs=t.unknownCodecs,this.codecSet=[t.videoCodec,t.audioCodec].filter((function(t){return t})).join(",").replace(/\.[^.,]+/g,"")}var e,r,i;return e=t,(r=[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(t){var e=t%this.url.length;this._urlId!==e&&(this.details=void 0,this._urlId=e)}}])&&n(e.prototype,r),i&&n(e,i),t}()},"./src/types/loader.ts":
267
+ /*! exports provided: HlsSkip, getSkipValue, HlsUrlParameters, Level */function(e,t,r){function n(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 i;function a(e,t){var r=e.canSkipUntil,n=e.canSkipDateRanges,a=e.endSN;return r&&(void 0!==t?t-a:0)<r?n?i.v2:i.Yes:i.No}r.r(t),r.d(t,"HlsSkip",(function(){return i})),r.d(t,"getSkipValue",(function(){return a})),r.d(t,"HlsUrlParameters",(function(){return s})),r.d(t,"Level",(function(){return o})),function(e){e.No="",e.Yes="YES",e.v2="v2"}(i||(i={}));var s=function(){function e(e,t,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=r}return e.prototype.addDirectives=function(e){var t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.toString()},e}(),o=function(){function e(e){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[e.url],this.attrs=e.attrs,this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.unknownCodecs=e.unknownCodecs,this.codecSet=[e.videoCodec,e.audioCodec].filter((function(e){return e})).join(",").replace(/\.[^.,]+/g,"")}var t,r,i;return t=e,(r=[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(e){var t=e%this.url.length;this._urlId!==t&&(this.details=void 0,this._urlId=t)}}])&&n(t.prototype,r),i&&n(t,i),e}()},"./src/types/loader.ts":
268
268
  /*!*****************************!*\
269
269
  !*** ./src/types/loader.ts ***!
270
270
  \*****************************/
271
- /*! exports provided: PlaylistContextType, PlaylistLevelType */function(t,e,r){var n,i;r.r(e),r.d(e,"PlaylistContextType",(function(){return n})),r.d(e,"PlaylistLevelType",(function(){return i})),function(t){t.MANIFEST="manifest",t.LEVEL="level",t.AUDIO_TRACK="audioTrack",t.SUBTITLE_TRACK="subtitleTrack"}(n||(n={})),function(t){t.MAIN="main",t.AUDIO="audio",t.SUBTITLE="subtitle"}(i||(i={}))},"./src/types/transmuxer.ts":
271
+ /*! exports provided: PlaylistContextType, PlaylistLevelType */function(e,t,r){var n,i;r.r(t),r.d(t,"PlaylistContextType",(function(){return n})),r.d(t,"PlaylistLevelType",(function(){return i})),function(e){e.MANIFEST="manifest",e.LEVEL="level",e.AUDIO_TRACK="audioTrack",e.SUBTITLE_TRACK="subtitleTrack"}(n||(n={})),function(e){e.MAIN="main",e.AUDIO="audio",e.SUBTITLE="subtitle"}(i||(i={}))},"./src/types/transmuxer.ts":
272
272
  /*!*********************************!*\
273
273
  !*** ./src/types/transmuxer.ts ***!
274
274
  \*********************************/
275
- /*! exports provided: ChunkMetadata */function(t,e,r){r.r(e),r.d(e,"ChunkMetadata",(function(){return n}));var n=function(t,e,r,n,i,a){void 0===n&&(n=0),void 0===i&&(i=-1),void 0===a&&(a=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=t,this.sn=e,this.id=r,this.size=n,this.part=i,this.partial=a}},"./src/utils/attr-list.ts":
275
+ /*! exports provided: ChunkMetadata */function(e,t,r){r.r(t),r.d(t,"ChunkMetadata",(function(){return n}));var n=function(e,t,r,n,i,a){void 0===n&&(n=0),void 0===i&&(i=-1),void 0===a&&(a=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=e,this.sn=t,this.id=r,this.size=n,this.part=i,this.partial=a}},"./src/utils/attr-list.ts":
276
276
  /*!********************************!*\
277
277
  !*** ./src/utils/attr-list.ts ***!
278
278
  \********************************/
279
- /*! exports provided: AttrList */function(t,e,r){r.r(e),r.d(e,"AttrList",(function(){return a}));var n=/^(\d+)x(\d+)$/,i=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,a=function(){function t(e){for(var r in"string"==typeof e&&(e=t.parseAttrList(e)),e)e.hasOwnProperty(r)&&(this[r]=e[r])}var e=t.prototype;return e.decimalInteger=function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},e.hexadecimalInteger=function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var r=new Uint8Array(e.length/2),n=0;n<e.length/2;n++)r[n]=parseInt(e.slice(2*n,2*n+2),16);return r}return null},e.hexadecimalIntegerAsNumber=function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e},e.decimalFloatingPoint=function(t){return parseFloat(this[t])},e.optionalFloat=function(t,e){var r=this[t];return r?parseFloat(r):e},e.enumeratedString=function(t){return this[t]},e.bool=function(t){return"YES"===this[t]},e.decimalResolution=function(t){var e=n.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},t.parseAttrList=function(t){var e,r={};for(i.lastIndex=0;null!==(e=i.exec(t));){var n=e[2];0===n.indexOf('"')&&n.lastIndexOf('"')===n.length-1&&(n=n.slice(1,-1)),r[e[1]]=n}return r},t}()},"./src/utils/binary-search.ts":
279
+ /*! exports provided: AttrList */function(e,t,r){r.r(t),r.d(t,"AttrList",(function(){return a}));var n=/^(\d+)x(\d+)$/,i=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,a=function(){function e(t){for(var r in"string"==typeof t&&(t=e.parseAttrList(t)),t)t.hasOwnProperty(r)&&(this[r]=t[r])}var t=e.prototype;return t.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),n=0;n<t.length/2;n++)r[n]=parseInt(t.slice(2*n,2*n+2),16);return r}return null},t.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){var r=this[e];return r?parseFloat(r):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){var t=n.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,r={};for(i.lastIndex=0;null!==(t=i.exec(e));){var n=t[2];0===n.indexOf('"')&&n.lastIndexOf('"')===n.length-1&&(n=n.slice(1,-1)),r[t[1]]=n}return r},e}()},"./src/utils/binary-search.ts":
280
280
  /*!************************************!*\
281
281
  !*** ./src/utils/binary-search.ts ***!
282
282
  \************************************/
283
- /*! exports provided: default */function(t,e,r){r.r(e),e.default={search:function(t,e){for(var r=0,n=t.length-1,i=null,a=null;r<=n;){var s=e(a=t[i=(r+n)/2|0]);if(s>0)r=i+1;else{if(!(s<0))return a;n=i-1}}return null}}},"./src/utils/buffer-helper.ts":
283
+ /*! exports provided: default */function(e,t,r){r.r(t),t.default={search:function(e,t){for(var r=0,n=e.length-1,i=null,a=null;r<=n;){var s=t(a=e[i=(r+n)/2|0]);if(s>0)r=i+1;else{if(!(s<0))return a;n=i-1}}return null}}},"./src/utils/buffer-helper.ts":
284
284
  /*!************************************!*\
285
285
  !*** ./src/utils/buffer-helper.ts ***!
286
286
  \************************************/
287
- /*! exports provided: BufferHelper */function(t,e,r){r.r(e),r.d(e,"BufferHelper",(function(){return a}));var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i={length:0,start:function(){return 0},end:function(){return 0}},a=function(){function t(){}return t.isBuffered=function(e,r){try{if(e)for(var n=t.getBuffered(e),i=0;i<n.length;i++)if(r>=n.start(i)&&r<=n.end(i))return!0}catch(t){}return!1},t.bufferInfo=function(e,r,n){try{if(e){var i,a=t.getBuffered(e),s=[];for(i=0;i<a.length;i++)s.push({start:a.start(i),end:a.end(i)});return this.bufferedInfo(s,r,n)}}catch(t){}return{len:0,start:r,end:r,nextStart:void 0}},t.bufferedInfo=function(t,e,r){t.sort((function(t,e){var r=t.start-e.start;return r||e.end-t.end}));var n=[];if(r)for(var i=0;i<t.length;i++){var a=n.length;if(a){var s=n[a-1].end;t[i].start-s<r?t[i].end>s&&(n[a-1].end=t[i].end):n.push(t[i])}else n.push(t[i])}else n=t;for(var o,u=0,l=e,c=e,d=0;d<n.length;d++){var f=n[d].start,h=n[d].end;if(e+r>=f&&e<h)l=f,u=(c=h)-e;else if(e+r<f){o=f;break}}return{len:u,start:l||0,end:c||0,nextStart:o}},t.getBuffered=function(t){try{return t.buffered}catch(t){return n.logger.log("failed to get media.buffered",t),i}},t}()},"./src/utils/cea-608-parser.ts":
287
+ /*! exports provided: BufferHelper */function(e,t,r){r.r(t),r.d(t,"BufferHelper",(function(){return a}));var n=r(/*! ../utils/logger */"./src/utils/logger.ts"),i={length:0,start:function(){return 0},end:function(){return 0}},a=function(){function e(){}return e.isBuffered=function(t,r){try{if(t)for(var n=e.getBuffered(t),i=0;i<n.length;i++)if(r>=n.start(i)&&r<=n.end(i))return!0}catch(e){}return!1},e.bufferInfo=function(t,r,n){try{if(t){var i,a=e.getBuffered(t),s=[];for(i=0;i<a.length;i++)s.push({start:a.start(i),end:a.end(i)});return this.bufferedInfo(s,r,n)}}catch(e){}return{len:0,start:r,end:r,nextStart:void 0}},e.bufferedInfo=function(e,t,r){e.sort((function(e,t){var r=e.start-t.start;return r||t.end-e.end}));var n=[];if(r)for(var i=0;i<e.length;i++){var a=n.length;if(a){var s=n[a-1].end;e[i].start-s<r?e[i].end>s&&(n[a-1].end=e[i].end):n.push(e[i])}else n.push(e[i])}else n=e;for(var o,l=0,u=t,c=t,d=0;d<n.length;d++){var f=n[d].start,h=n[d].end;if(t+r>=f&&t<h)u=f,l=(c=h)-t;else if(t+r<f){o=f;break}}return{len:l,start:u||0,end:c||0,nextStart:o}},e.getBuffered=function(e){try{return e.buffered}catch(e){return n.logger.log("failed to get media.buffered",e),i}},e}()},"./src/utils/cea-608-parser.ts":
288
288
  /*!*************************************!*\
289
289
  !*** ./src/utils/cea-608-parser.ts ***!
290
290
  \*************************************/
291
- /*! exports provided: Row, CaptionScreen, default */function(t,e,r){r.r(e),r.d(e,"Row",(function(){return g})),r.d(e,"CaptionScreen",(function(){return m}));var n,i=r(/*! ../utils/logger */"./src/utils/logger.ts"),a={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},s=function(t){var e=t;return a.hasOwnProperty(t)&&(e=a[t]),String.fromCharCode(e)},o={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},u={17:2,18:4,21:6,22:8,23:10,19:13,20:15},l={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},c={25:2,26:4,29:6,30:8,31:10,27:13,28:15},d=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];!function(t){t[t.ERROR=0]="ERROR",t[t.TEXT=1]="TEXT",t[t.WARNING=2]="WARNING",t[t.INFO=2]="INFO",t[t.DEBUG=3]="DEBUG",t[t.DATA=3]="DATA"}(n||(n={}));var f=function(){function t(){this.time=null,this.verboseLevel=n.ERROR}return t.prototype.log=function(t,e){this.verboseLevel>=t&&i.logger.log(this.time+" ["+t+"] "+e)},t}(),h=function(t){for(var e=[],r=0;r<t.length;r++)e.push(t[r].toString(16));return e},p=function(){function t(t,e,r,n,i){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=t||"white",this.underline=e||!1,this.italics=r||!1,this.background=n||"black",this.flash=i||!1}var e=t.prototype;return e.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},e.setStyles=function(t){for(var e=["foreground","underline","italics","background","flash"],r=0;r<e.length;r++){var n=e[r];t.hasOwnProperty(n)&&(this[n]=t[n])}},e.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},e.equals=function(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash},e.copy=function(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash},e.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},t}(),v=function(){function t(t,e,r,n,i,a){this.uchar=void 0,this.penState=void 0,this.uchar=t||" ",this.penState=new p(e,r,n,i,a)}var e=t.prototype;return e.reset=function(){this.uchar=" ",this.penState.reset()},e.setChar=function(t,e){this.uchar=t,this.penState.copy(e)},e.setPenState=function(t){this.penState.copy(t)},e.equals=function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)},e.copy=function(t){this.uchar=t.uchar,this.penState.copy(t.penState)},e.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},t}(),g=function(){function t(t){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var e=0;e<100;e++)this.chars.push(new v);this.logger=t,this.pos=0,this.currPenState=new p}var e=t.prototype;return e.equals=function(t){for(var e=!0,r=0;r<100;r++)if(!this.chars[r].equals(t.chars[r])){e=!1;break}return e},e.copy=function(t){for(var e=0;e<100;e++)this.chars[e].copy(t.chars[e])},e.isEmpty=function(){for(var t=!0,e=0;e<100;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t},e.setCursor=function(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(n.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(this.logger.log(n.DEBUG,"Too large cursor position "+this.pos),this.pos=100)},e.moveCursor=function(t){var e=this.pos+t;if(t>1)for(var r=this.pos+1;r<e+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(e)},e.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},e.insertChar=function(t){t>=144&&this.backSpace();var e=s(t);this.pos>=100?this.logger.log(n.ERROR,"Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))},e.clearFromPos=function(t){var e;for(e=t;e<100;e++)this.chars[e].reset()},e.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},e.clearToEndOfRow=function(){this.clearFromPos(this.pos)},e.getTextString=function(){for(var t=[],e=!0,r=0;r<100;r++){var n=this.chars[r].uchar;" "!==n&&(e=!1),t.push(n)}return e?"":t.join("")},e.setPenStyles=function(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)},t}(),m=function(){function t(t){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var e=0;e<15;e++)this.rows.push(new g(t));this.logger=t,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var e=t.prototype;return e.reset=function(){for(var t=0;t<15;t++)this.rows[t].clear();this.currRow=14},e.equals=function(t){for(var e=!0,r=0;r<15;r++)if(!this.rows[r].equals(t.rows[r])){e=!1;break}return e},e.copy=function(t){for(var e=0;e<15;e++)this.rows[e].copy(t.rows[e])},e.isEmpty=function(){for(var t=!0,e=0;e<15;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t},e.backSpace=function(){this.rows[this.currRow].backSpace()},e.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},e.insertChar=function(t){this.rows[this.currRow].insertChar(t)},e.setPen=function(t){this.rows[this.currRow].setPenStyles(t)},e.moveCursor=function(t){this.rows[this.currRow].moveCursor(t)},e.setCursor=function(t){this.logger.log(n.INFO,"setCursor: "+t),this.rows[this.currRow].setCursor(t)},e.setPAC=function(t){this.logger.log(n.INFO,"pacData = "+JSON.stringify(t));var e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(var r=0;r<15;r++)this.rows[r].clear();var i=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){var s=a.rows[i].cueStartTime,o=this.logger.time;if(s&&null!==o&&s<o)for(var u=0;u<this.nrRollUpRows;u++)this.rows[e-this.nrRollUpRows+u+1].copy(a.rows[i+u])}}this.currRow=e;var l=this.rows[this.currRow];if(null!==t.indent){var c=t.indent,d=Math.max(c-1,0);l.setCursor(t.indent),t.color=l.chars[d].penState.foreground}var f={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(f)},e.setBkgData=function(t){this.logger.log(n.INFO,"bkgData = "+JSON.stringify(t)),this.backSpace(),this.setPen(t),this.insertChar(32)},e.setRollUpRows=function(t){this.nrRollUpRows=t},e.rollUp=function(){if(null!==this.nrRollUpRows){this.logger.log(n.TEXT,this.getDisplayText());var t=this.currRow+1-this.nrRollUpRows,e=this.rows.splice(t,1)[0];e.clear(),this.rows.splice(this.currRow,0,e),this.logger.log(n.INFO,"Rolling up")}else this.logger.log(n.DEBUG,"roll_up but nrRollUpRows not set yet")},e.getDisplayText=function(t){t=t||!1;for(var e=[],r="",n=-1,i=0;i<15;i++){var a=this.rows[i].getTextString();a&&(n=i+1,t?e.push("Row "+n+": '"+a+"'"):e.push(a.trim()))}return e.length>0&&(r=t?"["+e.join(" | ")+"]":e.join("\n")),r},e.getTextAndFormat=function(){return this.rows},t}(),y=function(){function t(t,e,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new m(r),this.nonDisplayedMemory=new m(r),this.lastOutputScreen=new m(r),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}var e=t.prototype;return e.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},e.getHandler=function(){return this.outputFilter},e.setHandler=function(t){this.outputFilter=t},e.setPAC=function(t){this.writeScreen.setPAC(t)},e.setBkgData=function(t){this.writeScreen.setBkgData(t)},e.setMode=function(t){t!==this.mode&&(this.mode=t,this.logger.log(n.INFO,"MODE="+t),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)},e.insertChars=function(t){for(var e=0;e<t.length;e++)this.writeScreen.insertChar(t[e]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(n.INFO,r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(n.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},e.ccRCL=function(){this.logger.log(n.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},e.ccBS=function(){this.logger.log(n.INFO,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},e.ccAOF=function(){},e.ccAON=function(){},e.ccDER=function(){this.logger.log(n.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},e.ccRU=function(t){this.logger.log(n.INFO,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)},e.ccFON=function(){this.logger.log(n.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},e.ccRDC=function(){this.logger.log(n.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},e.ccTR=function(){this.logger.log(n.INFO,"TR"),this.setMode("MODE_TEXT")},e.ccRTD=function(){this.logger.log(n.INFO,"RTD"),this.setMode("MODE_TEXT")},e.ccEDM=function(){this.logger.log(n.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},e.ccCR=function(){this.logger.log(n.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},e.ccENM=function(){this.logger.log(n.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},e.ccEOC=function(){if(this.logger.log(n.INFO,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(n.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},e.ccTO=function(t){this.logger.log(n.INFO,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)},e.ccMIDROW=function(t){var e={flash:!1};if(e.underline=t%2==1,e.italics=t>=46,e.italics)e.foreground="white";else{var r=Math.floor(t/2)-16;e.foreground=["white","green","blue","cyan","red","yellow","magenta"][r]}this.logger.log(n.INFO,"MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)},e.outputDataUpdate=function(t){void 0===t&&(t=!1);var e=this.logger.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},e.cueSplitAtTime=function(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))},t}(),E=function(){function t(t,e,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var n=new f;this.channels=[null,new y(t,e,n),new y(t+1,r,n)],this.cmdHistory={a:null,b:null},this.logger=n}var e=t.prototype;return e.getHandler=function(t){return this.channels[t].getHandler()},e.setHandler=function(t,e){this.channels[t].setHandler(e)},e.addData=function(t,e){var r,i,a,s=!1;this.logger.time=t;for(var o=0;o<e.length;o+=2)if(i=127&e[o],a=127&e[o+1],0!==i||0!==a){if(this.logger.log(n.DATA,"["+h([e[o],e[o+1]])+"] -> ("+h([i,a])+")"),(r=this.parseCmd(i,a))||(r=this.parseMidrow(i,a)),r||(r=this.parsePAC(i,a)),r||(r=this.parseBackgroundAttributes(i,a)),!r&&(s=this.parseChars(i,a))){var u=this.currentChannel;u&&u>0?this.channels[u].insertChars(s):this.logger.log(n.WARNING,"No channel found yet. TEXT-MODE?")}r||s||this.logger.log(n.WARNING,"Couldn't parse cleaned data "+h([i,a])+" orig: "+h([e[o],e[o+1]]))}},e.parseCmd=function(t,e){var r=this.cmdHistory;if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=33&&e<=35))return!1;if(_(t,e,r))return T(null,null,r),this.logger.log(n.DEBUG,"Repeated command ("+h([t,e])+") is dropped"),!0;var i=20===t||21===t||23===t?1:2,a=this.channels[i];return 20===t||21===t||28===t||29===t?32===e?a.ccRCL():33===e?a.ccBS():34===e?a.ccAOF():35===e?a.ccAON():36===e?a.ccDER():37===e?a.ccRU(2):38===e?a.ccRU(3):39===e?a.ccRU(4):40===e?a.ccFON():41===e?a.ccRDC():42===e?a.ccTR():43===e?a.ccRTD():44===e?a.ccEDM():45===e?a.ccCR():46===e?a.ccENM():47===e&&a.ccEOC():a.ccTO(e-32),T(t,e,r),this.currentChannel=i,!0},e.parseMidrow=function(t,e){var r=0;if((17===t||25===t)&&e>=32&&e<=47){if((r=17===t?1:2)!==this.currentChannel)return this.logger.log(n.ERROR,"Mismatch channel in midrow parsing"),!1;var i=this.channels[r];return!!i&&(i.ccMIDROW(e),this.logger.log(n.DEBUG,"MIDROW ("+h([t,e])+")"),!0)}return!1},e.parsePAC=function(t,e){var r,n=this.cmdHistory;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127||(16===t||24===t)&&e>=64&&e<=95))return!1;if(_(t,e,n))return T(null,null,n),!0;var i=t<=23?1:2;r=e>=64&&e<=95?1===i?o[t]:l[t]:1===i?u[t]:c[t];var a=this.channels[i];return!!a&&(a.setPAC(this.interpretPAC(r,e)),T(t,e,n),this.currentChannel=i,!0)},e.interpretPAC=function(t,e){var r,n={color:null,italics:!1,indent:null,underline:!1,row:t};return r=e>95?e-96:e-64,n.underline=1==(1&r),r<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((r-16)/2),n},e.parseChars=function(t,e){var r,i,a=null,o=null;if(t>=25?(r=2,o=t-8):(r=1,o=t),o>=17&&o<=19?(i=17===o?e+80:18===o?e+112:e+144,this.logger.log(n.INFO,"Special char '"+s(i)+"' in channel "+r),a=[i]):t>=32&&t<=127&&(a=0===e?[t]:[t,e]),a){var u=h(a);this.logger.log(n.DEBUG,"Char codes = "+u.join(",")),T(t,e,this.cmdHistory)}return a},e.parseBackgroundAttributes=function(t,e){var r;if(!((16===t||24===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=45&&e<=47))return!1;var n={};16===t||24===t?(r=Math.floor((e-32)/2),n.background=d[r],e%2==1&&(n.background=n.background+"_semi")):45===e?n.background="transparent":(n.foreground="black",47===e&&(n.underline=!0));var i=t<=23?1:2;return this.channels[i].setBkgData(n),T(t,e,this.cmdHistory),!0},e.reset=function(){for(var t=0;t<Object.keys(this.channels).length;t++){var e=this.channels[t];e&&e.reset()}this.cmdHistory={a:null,b:null}},e.cueSplitAtTime=function(t){for(var e=0;e<this.channels.length;e++){var r=this.channels[e];r&&r.cueSplitAtTime(t)}},t}();function T(t,e,r){r.a=t,r.b=e}function _(t,e,r){return r.a===t&&r.b===e}e.default=E},"./src/utils/codecs.ts":
291
+ /*! exports provided: Row, CaptionScreen, default */function(e,t,r){r.r(t),r.d(t,"Row",(function(){return g})),r.d(t,"CaptionScreen",(function(){return m}));var n,i=r(/*! ../utils/logger */"./src/utils/logger.ts"),a={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},s=function(e){var t=e;return a.hasOwnProperty(e)&&(t=a[e]),String.fromCharCode(t)},o={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},l={17:2,18:4,21:6,22:8,23:10,19:13,20:15},u={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},c={25:2,26:4,29:6,30:8,31:10,27:13,28:15},d=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];!function(e){e[e.ERROR=0]="ERROR",e[e.TEXT=1]="TEXT",e[e.WARNING=2]="WARNING",e[e.INFO=2]="INFO",e[e.DEBUG=3]="DEBUG",e[e.DATA=3]="DATA"}(n||(n={}));var f=function(){function e(){this.time=null,this.verboseLevel=n.ERROR}return e.prototype.log=function(e,t){this.verboseLevel>=e&&i.logger.log(this.time+" ["+e+"] "+t)},e}(),h=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].toString(16));return t},p=function(){function e(e,t,r,n,i){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=e||"white",this.underline=t||!1,this.italics=r||!1,this.background=n||"black",this.flash=i||!1}var t=e.prototype;return t.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},t.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],r=0;r<t.length;r++){var n=t[r];e.hasOwnProperty(n)&&(this[n]=e[n])}},t.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},t.equals=function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},t.copy=function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},t.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},e}(),v=function(){function e(e,t,r,n,i,a){this.uchar=void 0,this.penState=void 0,this.uchar=e||" ",this.penState=new p(t,r,n,i,a)}var t=e.prototype;return t.reset=function(){this.uchar=" ",this.penState.reset()},t.setChar=function(e,t){this.uchar=e,this.penState.copy(t)},t.setPenState=function(e){this.penState.copy(e)},t.equals=function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},t.copy=function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},t.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},e}(),g=function(){function e(e){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var t=0;t<100;t++)this.chars.push(new v);this.logger=e,this.pos=0,this.currPenState=new p}var t=e.prototype;return t.equals=function(e){for(var t=!0,r=0;r<100;r++)if(!this.chars[r].equals(e.chars[r])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<100;t++)this.chars[t].copy(e.chars[t])},t.isEmpty=function(){for(var e=!0,t=0;t<100;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},t.setCursor=function(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(n.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(this.logger.log(n.DEBUG,"Too large cursor position "+this.pos),this.pos=100)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var r=this.pos+1;r<t+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(t)},t.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},t.insertChar=function(e){e>=144&&this.backSpace();var t=s(e);this.pos>=100?this.logger.log(n.ERROR,"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){var t;for(t=e;t<100;t++)this.chars[t].reset()},t.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},t.clearToEndOfRow=function(){this.clearFromPos(this.pos)},t.getTextString=function(){for(var e=[],t=!0,r=0;r<100;r++){var n=this.chars[r].uchar;" "!==n&&(t=!1),e.push(n)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e}(),m=function(){function e(e){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var t=0;t<15;t++)this.rows.push(new g(e));this.logger=e,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var t=e.prototype;return t.reset=function(){for(var e=0;e<15;e++)this.rows[e].clear();this.currRow=14},t.equals=function(e){for(var t=!0,r=0;r<15;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t},t.copy=function(e){for(var t=0;t<15;t++)this.rows[t].copy(e.rows[t])},t.isEmpty=function(){for(var e=!0,t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},t.backSpace=function(){this.rows[this.currRow].backSpace()},t.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},t.insertChar=function(e){this.rows[this.currRow].insertChar(e)},t.setPen=function(e){this.rows[this.currRow].setPenStyles(e)},t.moveCursor=function(e){this.rows[this.currRow].moveCursor(e)},t.setCursor=function(e){this.logger.log(n.INFO,"setCursor: "+e),this.rows[this.currRow].setCursor(e)},t.setPAC=function(e){this.logger.log(n.INFO,"pacData = "+JSON.stringify(e));var t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(var r=0;r<15;r++)this.rows[r].clear();var i=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){var s=a.rows[i].cueStartTime,o=this.logger.time;if(s&&null!==o&&s<o)for(var l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(a.rows[i+l])}}this.currRow=t;var u=this.rows[this.currRow];if(null!==e.indent){var c=e.indent,d=Math.max(c-1,0);u.setCursor(e.indent),e.color=u.chars[d].penState.foreground}var f={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(f)},t.setBkgData=function(e){this.logger.log(n.INFO,"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},t.setRollUpRows=function(e){this.nrRollUpRows=e},t.rollUp=function(){if(null!==this.nrRollUpRows){this.logger.log(n.TEXT,this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(n.INFO,"Rolling up")}else this.logger.log(n.DEBUG,"roll_up but nrRollUpRows not set yet")},t.getDisplayText=function(e){e=e||!1;for(var t=[],r="",n=-1,i=0;i<15;i++){var a=this.rows[i].getTextString();a&&(n=i+1,e?t.push("Row "+n+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r},t.getTextAndFormat=function(){return this.rows},e}(),y=function(){function e(e,t,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new m(r),this.nonDisplayedMemory=new m(r),this.lastOutputScreen=new m(r),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(n.INFO,"MODE="+e),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(n.INFO,r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(n.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},t.ccRCL=function(){this.logger.log(n.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},t.ccBS=function(){this.logger.log(n.INFO,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},t.ccAOF=function(){},t.ccAON=function(){},t.ccDER=function(){this.logger.log(n.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},t.ccRU=function(e){this.logger.log(n.INFO,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},t.ccFON=function(){this.logger.log(n.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},t.ccRDC=function(){this.logger.log(n.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},t.ccTR=function(){this.logger.log(n.INFO,"TR"),this.setMode("MODE_TEXT")},t.ccRTD=function(){this.logger.log(n.INFO,"RTD"),this.setMode("MODE_TEXT")},t.ccEDM=function(){this.logger.log(n.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},t.ccCR=function(){this.logger.log(n.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},t.ccENM=function(){this.logger.log(n.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},t.ccEOC=function(){if(this.logger.log(n.INFO,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(n.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},t.ccTO=function(e){this.logger.log(n.INFO,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},t.ccMIDROW=function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var r=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][r]}this.logger.log(n.INFO,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},e}(),E=function(){function e(e,t,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var n=new f;this.channels=[null,new y(e,t,n),new y(e+1,r,n)],this.cmdHistory={a:null,b:null},this.logger=n}var t=e.prototype;return t.getHandler=function(e){return this.channels[e].getHandler()},t.setHandler=function(e,t){this.channels[e].setHandler(t)},t.addData=function(e,t){var r,i,a,s=!1;this.logger.time=e;for(var o=0;o<t.length;o+=2)if(i=127&t[o],a=127&t[o+1],0!==i||0!==a){if(this.logger.log(n.DATA,"["+h([t[o],t[o+1]])+"] -> ("+h([i,a])+")"),(r=this.parseCmd(i,a))||(r=this.parseMidrow(i,a)),r||(r=this.parsePAC(i,a)),r||(r=this.parseBackgroundAttributes(i,a)),!r&&(s=this.parseChars(i,a))){var l=this.currentChannel;l&&l>0?this.channels[l].insertChars(s):this.logger.log(n.WARNING,"No channel found yet. TEXT-MODE?")}r||s||this.logger.log(n.WARNING,"Couldn't parse cleaned data "+h([i,a])+" orig: "+h([t[o],t[o+1]]))}},t.parseCmd=function(e,t){var r=this.cmdHistory;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;if(T(e,t,r))return _(null,null,r),this.logger.log(n.DEBUG,"Repeated command ("+h([e,t])+") is dropped"),!0;var i=20===e||21===e||23===e?1:2,a=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?a.ccRCL():33===t?a.ccBS():34===t?a.ccAOF():35===t?a.ccAON():36===t?a.ccDER():37===t?a.ccRU(2):38===t?a.ccRU(3):39===t?a.ccRU(4):40===t?a.ccFON():41===t?a.ccRDC():42===t?a.ccTR():43===t?a.ccRTD():44===t?a.ccEDM():45===t?a.ccCR():46===t?a.ccENM():47===t&&a.ccEOC():a.ccTO(t-32),_(e,t,r),this.currentChannel=i,!0},t.parseMidrow=function(e,t){var r=0;if((17===e||25===e)&&t>=32&&t<=47){if((r=17===e?1:2)!==this.currentChannel)return this.logger.log(n.ERROR,"Mismatch channel in midrow parsing"),!1;var i=this.channels[r];return!!i&&(i.ccMIDROW(t),this.logger.log(n.DEBUG,"MIDROW ("+h([e,t])+")"),!0)}return!1},t.parsePAC=function(e,t){var r,n=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;if(T(e,t,n))return _(null,null,n),!0;var i=e<=23?1:2;r=t>=64&&t<=95?1===i?o[e]:u[e]:1===i?l[e]:c[e];var a=this.channels[i];return!!a&&(a.setPAC(this.interpretPAC(r,t)),_(e,t,n),this.currentChannel=i,!0)},t.interpretPAC=function(e,t){var r,n={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,n.underline=1==(1&r),r<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((r-16)/2),n},t.parseChars=function(e,t){var r,i,a=null,o=null;if(e>=25?(r=2,o=e-8):(r=1,o=e),o>=17&&o<=19?(i=17===o?t+80:18===o?t+112:t+144,this.logger.log(n.INFO,"Special char '"+s(i)+"' in channel "+r),a=[i]):e>=32&&e<=127&&(a=0===t?[e]:[e,t]),a){var l=h(a);this.logger.log(n.DEBUG,"Char codes = "+l.join(",")),_(e,t,this.cmdHistory)}return a},t.parseBackgroundAttributes=function(e,t){var r;if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;var n={};16===e||24===e?(r=Math.floor((t-32)/2),n.background=d[r],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0));var i=e<=23?1:2;return this.channels[i].setBkgData(n),_(e,t,this.cmdHistory),!0},t.reset=function(){for(var e=0;e<Object.keys(this.channels).length;e++){var t=this.channels[e];t&&t.reset()}this.cmdHistory={a:null,b:null}},t.cueSplitAtTime=function(e){for(var t=0;t<this.channels.length;t++){var r=this.channels[t];r&&r.cueSplitAtTime(e)}},e}();function _(e,t,r){r.a=e,r.b=t}function T(e,t,r){return r.a===e&&r.b===t}t.default=E},"./src/utils/codecs.ts":
292
292
  /*!*****************************!*\
293
293
  !*** ./src/utils/codecs.ts ***!
294
294
  \*****************************/
295
- /*! exports provided: isCodecType, isCodecSupportedInMp4 */function(t,e,r){r.r(e),r.d(e,"isCodecType",(function(){return i})),r.d(e,"isCodecSupportedInMp4",(function(){return a}));var n={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function i(t,e){var r=n[e];return!!r&&!0===r[t.slice(0,4)]}function a(t,e){return MediaSource.isTypeSupported((e||"video")+'/mp4;codecs="'+t+'"')}},"./src/utils/cues.ts":
295
+ /*! exports provided: isCodecType, isCodecSupportedInMp4 */function(e,t,r){r.r(t),r.d(t,"isCodecType",(function(){return i})),r.d(t,"isCodecSupportedInMp4",(function(){return a}));var n={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function i(e,t){var r=n[t];return!!r&&!0===r[e.slice(0,4)]}function a(e,t){return MediaSource.isTypeSupported((t||"video")+'/mp4;codecs="'+e+'"')}},"./src/utils/cues.ts":
296
296
  /*!***************************!*\
297
297
  !*** ./src/utils/cues.ts ***!
298
298
  \***************************/
299
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ./vttparser */"./src/utils/vttparser.ts"),i=r(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts"),a=r(/*! ./texttrack-utils */"./src/utils/texttrack-utils.ts"),s=/\s/,o={newCue:function(t,e,r,o){for(var u,l,c,d,f,h=[],p=self.VTTCue||self.TextTrackCue,v=0;v<o.rows.length;v++)if(c=!0,d=0,f="",!(u=o.rows[v]).isEmpty()){for(var g=0;g<u.chars.length;g++)s.test(u.chars[g].uchar)&&c?d++:(f+=u.chars[g].uchar,c=!1);u.cueStartTime=e,e===r&&(r+=1e-4),d>=16?d--:d++;var m=Object(n.fixLineBreaks)(f.trim()),y=Object(i.generateCueId)(e,r,m);t&&t.cues&&t.cues.getCueById(y)||((l=new p(e,r,m)).id=y,l.line=v+1,l.align="left",l.position=10+Math.min(80,10*Math.floor(8*d/32)),h.push(l))}return t&&h.length&&(h.sort((function(t,e){return"auto"===t.line||"auto"===e.line?0:t.line>8&&e.line>8?e.line-t.line:t.line-e.line})),h.forEach((function(e){return Object(a.addCueToTrack)(t,e)}))),h}};e.default=o},"./src/utils/discontinuities.ts":
299
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ./vttparser */"./src/utils/vttparser.ts"),i=r(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts"),a=r(/*! ./texttrack-utils */"./src/utils/texttrack-utils.ts"),s=/\s/,o={newCue:function(e,t,r,o){for(var l,u,c,d,f,h=[],p=self.VTTCue||self.TextTrackCue,v=0;v<o.rows.length;v++)if(c=!0,d=0,f="",!(l=o.rows[v]).isEmpty()){for(var g=0;g<l.chars.length;g++)s.test(l.chars[g].uchar)&&c?d++:(f+=l.chars[g].uchar,c=!1);l.cueStartTime=t,t===r&&(r+=1e-4),d>=16?d--:d++;var m=Object(n.fixLineBreaks)(f.trim()),y=Object(i.generateCueId)(t,r,m);e&&e.cues&&e.cues.getCueById(y)||((u=new p(t,r,m)).id=y,u.line=v+1,u.align="left",u.position=10+Math.min(80,10*Math.floor(8*d/32)),h.push(u))}return e&&h.length&&(h.sort((function(e,t){return"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line})),h.forEach((function(t){return Object(a.addCueToTrack)(e,t)}))),h}};t.default=o},"./src/utils/discontinuities.ts":
300
300
  /*!**************************************!*\
301
301
  !*** ./src/utils/discontinuities.ts ***!
302
302
  \**************************************/
303
- /*! exports provided: findFirstFragWithCC, shouldAlignOnDiscontinuities, findDiscontinuousReferenceFrag, adjustSlidingStart, alignStream, alignPDT */function(t,e,r){r.r(e),r.d(e,"findFirstFragWithCC",(function(){return s})),r.d(e,"shouldAlignOnDiscontinuities",(function(){return o})),r.d(e,"findDiscontinuousReferenceFrag",(function(){return u})),r.d(e,"adjustSlidingStart",(function(){return c})),r.d(e,"alignStream",(function(){return d})),r.d(e,"alignPDT",(function(){return f}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./logger */"./src/utils/logger.ts"),a=r(/*! ../controller/level-helper */"./src/controller/level-helper.ts");function s(t,e){for(var r=null,n=0,i=t.length;n<i;n++){var a=t[n];if(a&&a.cc===e){r=a;break}}return r}function o(t,e,r){return!(!e.details||!(r.endCC>r.startCC||t&&t.cc<r.startCC))}function u(t,e){var r=t.fragments,n=e.fragments;if(n.length&&r.length){var a=s(r,n[0].cc);if(a&&(!a||a.startPTS))return a;i.logger.log("No frag in previous level to align on")}else i.logger.log("No fragments to align")}function l(t,e){if(t){var r=t.start+e;t.start=t.startPTS=r,t.endPTS=r+t.duration}}function c(t,e){for(var r=e.fragments,n=0,i=r.length;n<i;n++)l(r[n],t);e.fragmentHint&&l(e.fragmentHint,t),e.alignedSliding=!0}function d(t,e,r){e&&(function(t,e,r){if(o(t,r,e)){var a=u(r.details,e);a&&Object(n.isFiniteNumber)(a.start)&&(i.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),c(a.start,e))}}(t,r,e),!r.alignedSliding&&e.details&&f(r,e.details),r.alignedSliding||!e.details||r.skippedSegments||Object(a.adjustSliding)(e.details,r))}function f(t,e){if(e.fragments.length&&t.hasProgramDateTime&&e.hasProgramDateTime){var r=e.fragments[0].programDateTime,a=t.fragments[0].programDateTime,s=(a-r)/1e3+e.fragments[0].start;s&&Object(n.isFiniteNumber)(s)&&(i.logger.log("Adjusting PTS using programDateTime delta "+(a-r)+"ms, sliding:"+s.toFixed(3)+" "+t.url+" "),c(s,t))}}},"./src/utils/ewma-bandwidth-estimator.ts":
303
+ /*! exports provided: findFirstFragWithCC, shouldAlignOnDiscontinuities, findDiscontinuousReferenceFrag, adjustSlidingStart, alignStream, alignPDT */function(e,t,r){r.r(t),r.d(t,"findFirstFragWithCC",(function(){return s})),r.d(t,"shouldAlignOnDiscontinuities",(function(){return o})),r.d(t,"findDiscontinuousReferenceFrag",(function(){return l})),r.d(t,"adjustSlidingStart",(function(){return c})),r.d(t,"alignStream",(function(){return d})),r.d(t,"alignPDT",(function(){return f}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ./logger */"./src/utils/logger.ts"),a=r(/*! ../controller/level-helper */"./src/controller/level-helper.ts");function s(e,t){for(var r=null,n=0,i=e.length;n<i;n++){var a=e[n];if(a&&a.cc===t){r=a;break}}return r}function o(e,t,r){return!(!t.details||!(r.endCC>r.startCC||e&&e.cc<r.startCC))}function l(e,t){var r=e.fragments,n=t.fragments;if(n.length&&r.length){var a=s(r,n[0].cc);if(a&&(!a||a.startPTS))return a;i.logger.log("No frag in previous level to align on")}else i.logger.log("No fragments to align")}function u(e,t){if(e){var r=e.start+t;e.start=e.startPTS=r,e.endPTS=r+e.duration}}function c(e,t){for(var r=t.fragments,n=0,i=r.length;n<i;n++)u(r[n],e);t.fragmentHint&&u(t.fragmentHint,e),t.alignedSliding=!0}function d(e,t,r){t&&(function(e,t,r){if(o(e,r,t)){var a=l(r.details,t);a&&Object(n.isFiniteNumber)(a.start)&&(i.logger.log("Adjusting PTS using last level due to CC increase within current level "+t.url),c(a.start,t))}}(e,r,t),!r.alignedSliding&&t.details&&f(r,t.details),r.alignedSliding||!t.details||r.skippedSegments||Object(a.adjustSliding)(t.details,r))}function f(e,t){if(t.fragments.length&&e.hasProgramDateTime&&t.hasProgramDateTime){var r=t.fragments[0].programDateTime,a=e.fragments[0].programDateTime,s=(a-r)/1e3+t.fragments[0].start;s&&Object(n.isFiniteNumber)(s)&&(i.logger.log("Adjusting PTS using programDateTime delta "+(a-r)+"ms, sliding:"+s.toFixed(3)+" "+e.url+" "),c(s,e))}}},"./src/utils/ewma-bandwidth-estimator.ts":
304
304
  /*!***********************************************!*\
305
305
  !*** ./src/utils/ewma-bandwidth-estimator.ts ***!
306
306
  \***********************************************/
307
- /*! exports provided: default */function(t,e,r){r.r(e);var n=r(/*! ../utils/ewma */"./src/utils/ewma.ts"),i=function(){function t(t,e,r){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new n.default(t),this.fast_=new n.default(e)}var e=t.prototype;return e.update=function(t,e){var r=this.slow_,i=this.fast_;this.slow_.halfLife!==t&&(this.slow_=new n.default(t,r.getEstimate(),r.getTotalWeight())),this.fast_.halfLife!==e&&(this.fast_=new n.default(e,i.getEstimate(),i.getTotalWeight()))},e.sample=function(t,e){var r=(t=Math.max(t,this.minDelayMs_))/1e3,n=8*e/r;this.fast_.sample(r,n),this.slow_.sample(r,n)},e.canEstimate=function(){var t=this.fast_;return t&&t.getTotalWeight()>=this.minWeight_},e.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},e.destroy=function(){},t}();e.default=i},"./src/utils/ewma.ts":
307
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=r(/*! ../utils/ewma */"./src/utils/ewma.ts"),i=function(){function e(e,t,r){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new n.default(e),this.fast_=new n.default(t)}var t=e.prototype;return t.update=function(e,t){var r=this.slow_,i=this.fast_;this.slow_.halfLife!==e&&(this.slow_=new n.default(e,r.getEstimate(),r.getTotalWeight())),this.fast_.halfLife!==t&&(this.fast_=new n.default(t,i.getEstimate(),i.getTotalWeight()))},t.sample=function(e,t){var r=(e=Math.max(e,this.minDelayMs_))/1e3,n=8*t/r;this.fast_.sample(r,n),this.slow_.sample(r,n)},t.canEstimate=function(){var e=this.fast_;return e&&e.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.destroy=function(){},e}();t.default=i},"./src/utils/ewma.ts":
308
308
  /*!***************************!*\
309
309
  !*** ./src/utils/ewma.ts ***!
310
310
  \***************************/
311
- /*! exports provided: default */function(t,e,r){r.r(e);var n=function(){function t(t,e,r){void 0===e&&(e=0),void 0===r&&(r=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=e,this.totalWeight_=r}var e=t.prototype;return e.sample=function(t,e){var r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_,this.totalWeight_+=t},e.getTotalWeight=function(){return this.totalWeight_},e.getEstimate=function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_},t}();e.default=n},"./src/utils/fetch-loader.ts":
311
+ /*! exports provided: default */function(e,t,r){r.r(t);var n=function(){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=r}var t=e.prototype;return t.sample=function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},e}();t.default=n},"./src/utils/fetch-loader.ts":
312
312
  /*!***********************************!*\
313
313
  !*** ./src/utils/fetch-loader.ts ***!
314
314
  \***********************************/
315
- /*! exports provided: fetchSupported, default */function(t,e,r){r.r(e),r.d(e,"fetchSupported",(function(){return d}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),a=r(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts");function s(t){var e="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return o(t,arguments,c(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),l(n,t)})(t)}function o(t,e,r){return(o=u()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&l(i,r.prototype),i}).apply(null,arguments)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(t){}return!1}var f=function(){function t(t){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=t.fetchSetup||h,this.controller=new self.AbortController,this.stats=new i.LoadStats}var e=t.prototype;return e.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},e.abortInternal=function(){var t=this.response;t&&t.ok||(this.stats.aborted=!0,this.controller.abort())},e.abort=function(){var t;this.abortInternal(),null!==(t=this.callbacks)&&void 0!==t&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},e.load=function(t,e,r){var i=this,a=this.stats;if(a.loading.start)throw new Error("Loader can only be used once.");a.loading.start=self.performance.now();var s=function(t,e){var r={method:"GET",mode:"cors",credentials:"same-origin",signal:e};return t.rangeEnd&&(r.headers=new self.Headers({Range:"bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)})),r}(t,this.controller.signal),o=r.onProgress,u="arraybuffer"===t.responseType,l=u?"byteLength":"length";this.context=t,this.config=e,this.callbacks=r,this.request=this.fetchSetup(t,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout((function(){i.abortInternal(),r.onTimeout(a,t,i.response)}),e.timeout),self.fetch(this.request).then((function(r){if(i.response=i.loader=r,!r.ok){var s=r.status,l=r.statusText;throw new p(l||"fetch, bad network response",s,r)}return a.loading.first=Math.max(self.performance.now(),a.loading.start),a.total=parseInt(r.headers.get("Content-Length")||"0"),o&&Object(n.isFiniteNumber)(e.highWaterMark)?i.loadProgressively(r,a,t,e.highWaterMark,o):u?r.arrayBuffer():r.text()})).then((function(s){var u=i.response;self.clearTimeout(i.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first),a.loaded=a.total=s[l];var c={url:u.url,data:s};o&&!Object(n.isFiniteNumber)(e.highWaterMark)&&o(a,t,s,u),r.onSuccess(c,a,t,u)})).catch((function(e){if(self.clearTimeout(i.requestTimeout),!a.aborted){var n=e.code||0;r.onError({code:n,text:e.message},t,e.details)}}))},e.getCacheAge=function(){var t=null;if(this.response){var e=this.response.headers.get("age");t=e?parseFloat(e):null}return t},e.loadProgressively=function(t,e,r,n,i){void 0===n&&(n=0);var s=new a.default,o=t.body.getReader();return function a(){return o.read().then((function(o){if(o.done)return s.dataLength&&i(e,r,s.flush(),t),Promise.resolve(new ArrayBuffer(0));var u=o.value,l=u.length;return e.loaded+=l,l<n||s.dataLength?(s.push(u),s.dataLength>=n&&i(e,r,s.flush(),t)):i(e,r,u,t),a()})).catch((function(){return Promise.reject()}))}()},t}();function h(t,e){return new self.Request(t.url,e)}var p=function(t){var e,r;function n(e,r,n){var i;return(i=t.call(this,e)||this).code=void 0,i.details=void 0,i.code=r,i.details=n,i}return r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,l(e,r),n}(s(Error));e.default=f},"./src/utils/imsc1-ttml-parser.ts":
315
+ /*! exports provided: fetchSupported, default */function(e,t,r){r.r(t),r.d(t,"fetchSupported",(function(){return d}));var n=r(/*! ./src/polyfills/number */"./src/polyfills/number.ts"),i=r(/*! ../loader/load-stats */"./src/loader/load-stats.ts"),a=r(/*! ../demux/chunk-cache */"./src/demux/chunk-cache.ts");function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return o(e,arguments,c(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),u(n,e)})(e)}function o(e,t,r){return(o=l()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&u(i,r.prototype),i}).apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}var f=function(){function e(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||h,this.controller=new self.AbortController,this.stats=new i.LoadStats}var t=e.prototype;return t.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},t.abortInternal=function(){var e=this.response;e&&e.ok||(this.stats.aborted=!0,this.controller.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.response)},t.load=function(e,t,r){var i=this,a=this.stats;if(a.loading.start)throw new Error("Loader can only be used once.");a.loading.start=self.performance.now();var s=function(e,t){var r={method:"GET",mode:"cors",credentials:"same-origin",signal:t};return e.rangeEnd&&(r.headers=new self.Headers({Range:"bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)})),r}(e,this.controller.signal),o=r.onProgress,l="arraybuffer"===e.responseType,u=l?"byteLength":"length";this.context=e,this.config=t,this.callbacks=r,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout((function(){i.abortInternal(),r.onTimeout(a,e,i.response)}),t.timeout),self.fetch(this.request).then((function(r){if(i.response=i.loader=r,!r.ok){var s=r.status,u=r.statusText;throw new p(u||"fetch, bad network response",s,r)}return a.loading.first=Math.max(self.performance.now(),a.loading.start),a.total=parseInt(r.headers.get("Content-Length")||"0"),o&&Object(n.isFiniteNumber)(t.highWaterMark)?i.loadProgressively(r,a,e,t.highWaterMark,o):l?r.arrayBuffer():r.text()})).then((function(s){var l=i.response;self.clearTimeout(i.requestTimeout),a.loading.end=Math.max(self.performance.now(),a.loading.first),a.loaded=a.total=s[u];var c={url:l.url,data:s};o&&!Object(n.isFiniteNumber)(t.highWaterMark)&&o(a,e,s,l),r.onSuccess(c,a,e,l)})).catch((function(t){if(self.clearTimeout(i.requestTimeout),!a.aborted){var n=t.code||0;r.onError({code:n,text:t.message},e,t.details)}}))},t.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},t.loadProgressively=function(e,t,r,n,i){void 0===n&&(n=0);var s=new a.default,o=e.body.getReader();return function a(){return o.read().then((function(o){if(o.done)return s.dataLength&&i(t,r,s.flush(),e),Promise.resolve(new ArrayBuffer(0));var l=o.value,u=l.length;return t.loaded+=u,u<n||s.dataLength?(s.push(l),s.dataLength>=n&&i(t,r,s.flush(),e)):i(t,r,l,e),a()})).catch((function(){return Promise.reject()}))}()},e}();function h(e,t){return new self.Request(e.url,t)}var p=function(e){var t,r;function n(t,r,n){var i;return(i=e.call(this,t)||this).code=void 0,i.details=void 0,i.code=r,i.details=n,i}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,u(t,r),n}(s(Error));t.default=f},"./src/utils/imsc1-ttml-parser.ts":
316
316
  /*!****************************************!*\
317
317
  !*** ./src/utils/imsc1-ttml-parser.ts ***!
318
318
  \****************************************/
319
- /*! exports provided: IMSC1_CODEC, parseIMSC1 */function(t,e,r){r.r(e),r.d(e,"IMSC1_CODEC",(function(){return c})),r.d(e,"parseIMSC1",(function(){return p}));var n=r(/*! ./mp4-tools */"./src/utils/mp4-tools.ts"),i=r(/*! ./vttparser */"./src/utils/vttparser.ts"),a=r(/*! ./vttcue */"./src/utils/vttcue.ts"),s=r(/*! ../demux/id3 */"./src/demux/id3.ts"),o=r(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),u=r(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts");function l(){return(l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}var c="stpp.ttml.im1t",d=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,f=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,h={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(t,e,r,i,c){var d=Object(n.findBox)(new Uint8Array(t),["mdat"]);if(0!==d.length){var f=d[0],p=Object(s.utf8ArrayToStr)(new Uint8Array(t,f.start,f.end-f.start)),T=Object(o.toTimescaleFromScale)(e,1,r);try{i(function(t,e){var r=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");var n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},i=Object.keys(n).reduce((function(t,e){return t[e]=r.getAttribute("ttp:"+e)||n[e],t}),{}),s="preserve"!==r.getAttribute("xml:space"),o=g(v(r,"styling","style")),c=g(v(r,"layout","region")),d=v(r,"body","[begin]");return[].map.call(d,(function(t){var r=function t(e,r){return[].slice.call(e.childNodes).reduce((function(e,n,i){var a;return"br"===n.nodeName&&i?e+"\n":null!==(a=n.childNodes)&&void 0!==a&&a.length?t(n,r):r?e+n.textContent.trim().replace(/\s+/g," "):e+n.textContent}),"")}(t,s);if(!r||!t.hasAttribute("begin"))return null;var n=E(t.getAttribute("begin"),i),d=E(t.getAttribute("dur"),i),f=E(t.getAttribute("end"),i);if(null===n)throw y(t);if(null===f){if(null===d)throw y(t);f=n+d}var p=new a.default(n-e,f-e,r);p.id=Object(u.generateCueId)(p.startTime,p.endTime,p.text);var v=c[t.getAttribute("region")],g=o[t.getAttribute("style")];p.position=10,p.size=80;var T=function(t,e){var r="http://www.w3.org/ns/ttml#styling";return["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((function(n,i){var a=m(e,r,i)||m(t,r,i);return a&&(n[i]=a),n}),{})}(v,g),_=T.textAlign;if(_){var b=h[_];b&&(p.lineAlign=b),p.align=_}return l(p,T),p})).filter((function(t){return null!==t}))}(p,T))}catch(t){c(t)}}else c(new Error("Could not parse IMSC1 mdat"))}function v(t,e,r){var n=t.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(r)):[]}function g(t){return t.reduce((function(t,e){var r=e.getAttribute("xml:id");return r&&(t[r]=e),t}),{})}function m(t,e,r){return t.hasAttributeNS(e,r)?t.getAttributeNS(e,r):null}function y(t){return new Error("Could not parse ttml timestamp "+t)}function E(t,e){if(!t)return null;var r=Object(i.parseTimeStamp)(t);return null===r&&(d.test(t)?r=function(t,e){var r=d.exec(t),n=(0|r[4])+(0|r[5])/e.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+n/e.frameRate}(t,e):f.test(t)&&(r=function(t,e){var r=f.exec(t),n=Number(r[1]);switch(r[2]){case"h":return 3600*n;case"m":return 60*n;case"ms":return 1e3*n;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}(t,e))),r}},"./src/utils/logger.ts":
319
+ /*! exports provided: IMSC1_CODEC, parseIMSC1 */function(e,t,r){r.r(t),r.d(t,"IMSC1_CODEC",(function(){return c})),r.d(t,"parseIMSC1",(function(){return p}));var n=r(/*! ./mp4-tools */"./src/utils/mp4-tools.ts"),i=r(/*! ./vttparser */"./src/utils/vttparser.ts"),a=r(/*! ./vttcue */"./src/utils/vttcue.ts"),s=r(/*! ../demux/id3 */"./src/demux/id3.ts"),o=r(/*! ./timescale-conversion */"./src/utils/timescale-conversion.ts"),l=r(/*! ./webvtt-parser */"./src/utils/webvtt-parser.ts");function u(){return(u=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 c="stpp.ttml.im1t",d=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,f=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,h={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(e,t,r,i,c){var d=Object(n.findBox)(new Uint8Array(e),["mdat"]);if(0!==d.length){var f=d[0],p=Object(s.utf8ArrayToStr)(new Uint8Array(e,f.start,f.end-f.start)),_=Object(o.toTimescaleFromScale)(t,1,r);try{i(function(e,t){var r=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");var n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},i=Object.keys(n).reduce((function(e,t){return e[t]=r.getAttribute("ttp:"+t)||n[t],e}),{}),s="preserve"!==r.getAttribute("xml:space"),o=g(v(r,"styling","style")),c=g(v(r,"layout","region")),d=v(r,"body","[begin]");return[].map.call(d,(function(e){var r=function e(t,r){return[].slice.call(t.childNodes).reduce((function(t,n,i){var a;return"br"===n.nodeName&&i?t+"\n":null!==(a=n.childNodes)&&void 0!==a&&a.length?e(n,r):r?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent}),"")}(e,s);if(!r||!e.hasAttribute("begin"))return null;var n=E(e.getAttribute("begin"),i),d=E(e.getAttribute("dur"),i),f=E(e.getAttribute("end"),i);if(null===n)throw y(e);if(null===f){if(null===d)throw y(e);f=n+d}var p=new a.default(n-t,f-t,r);p.id=Object(l.generateCueId)(p.startTime,p.endTime,p.text);var v=c[e.getAttribute("region")],g=o[e.getAttribute("style")];p.position=10,p.size=80;var _=function(e,t){var r="http://www.w3.org/ns/ttml#styling";return["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((function(n,i){var a=m(t,r,i)||m(e,r,i);return a&&(n[i]=a),n}),{})}(v,g),T=_.textAlign;if(T){var b=h[T];b&&(p.lineAlign=b),p.align=T}return u(p,_),p})).filter((function(e){return null!==e}))}(p,_))}catch(e){c(e)}}else c(new Error("Could not parse IMSC1 mdat"))}function v(e,t,r){var n=e.getElementsByTagName(t)[0];return n?[].slice.call(n.querySelectorAll(r)):[]}function g(e){return e.reduce((function(e,t){var r=t.getAttribute("xml:id");return r&&(e[r]=t),e}),{})}function m(e,t,r){return e.hasAttributeNS(t,r)?e.getAttributeNS(t,r):null}function y(e){return new Error("Could not parse ttml timestamp "+e)}function E(e,t){if(!e)return null;var r=Object(i.parseTimeStamp)(e);return null===r&&(d.test(e)?r=function(e,t){var r=d.exec(e),n=(0|r[4])+(0|r[5])/t.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+n/t.frameRate}(e,t):f.test(e)&&(r=function(e,t){var r=f.exec(e),n=Number(r[1]);switch(r[2]){case"h":return 3600*n;case"m":return 60*n;case"ms":return 1e3*n;case"f":return n/t.frameRate;case"t":return n/t.tickRate}return n}(e,t))),r}},"./src/utils/logger.ts":
320
320
  /*!*****************************!*\
321
321
  !*** ./src/utils/logger.ts ***!
322
322
  \*****************************/
323
- /*! exports provided: enableLogs, logger */function(t,e,r){r.r(e),r.d(e,"enableLogs",(function(){return o})),r.d(e,"logger",(function(){return u}));var n=function(){},i={trace:n,debug:n,log:n,warn:n,info:n,error:n},a=i;function s(t){var e=self.console[t];return e?e.bind(self.console,"["+t+"] >"):n}function o(t){if(self.console&&!0===t||"object"==typeof t){!function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];r.forEach((function(e){a[e]=t[e]?t[e].bind(t):s(e)}))}(t,"debug","log","info","warn","error");try{a.log()}catch(t){a=i}}else a=i}var u=i},"./src/utils/mediakeys-helper.ts":
323
+ /*! exports provided: enableLogs, logger */function(e,t,r){r.r(t),r.d(t,"enableLogs",(function(){return o})),r.d(t,"logger",(function(){return l}));var n=function(){},i={trace:n,debug:n,log:n,warn:n,info:n,error:n},a=i;function s(e){var t=self.console[e];return t?t.bind(self.console,"["+e+"] >"):n}function o(e){if(self.console&&!0===e||"object"==typeof e){!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];r.forEach((function(t){a[t]=e[t]?e[t].bind(e):s(t)}))}(e,"debug","log","info","warn","error");try{a.log()}catch(e){a=i}}else a=i}var l=i},"./src/utils/mediakeys-helper.ts":
324
324
  /*!***************************************!*\
325
325
  !*** ./src/utils/mediakeys-helper.ts ***!
326
326
  \***************************************/
327
- /*! exports provided: KeySystems, requestMediaKeySystemAccess */function(t,e,r){var n;r.r(e),r.d(e,"KeySystems",(function(){return n})),r.d(e,"requestMediaKeySystemAccess",(function(){return i})),function(t){t.WIDEVINE="com.widevine.alpha",t.PLAYREADY="com.microsoft.playready"}(n||(n={}));var i="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null},"./src/utils/mediasource-helper.ts":
327
+ /*! exports provided: KeySystems, requestMediaKeySystemAccess */function(e,t,r){var n;r.r(t),r.d(t,"KeySystems",(function(){return n})),r.d(t,"requestMediaKeySystemAccess",(function(){return i})),function(e){e.WIDEVINE="com.widevine.alpha",e.PLAYREADY="com.microsoft.playready"}(n||(n={}));var i="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null},"./src/utils/mediasource-helper.ts":
328
328
  /*!*****************************************!*\
329
329
  !*** ./src/utils/mediasource-helper.ts ***!
330
330
  \*****************************************/
331
- /*! exports provided: getMediaSource */function(t,e,r){function n(){return self.MediaSource||self.WebKitMediaSource}r.r(e),r.d(e,"getMediaSource",(function(){return n}))},"./src/utils/mp4-tools.ts":
331
+ /*! exports provided: getMediaSource */function(e,t,r){function n(){return self.MediaSource||self.WebKitMediaSource}r.r(t),r.d(t,"getMediaSource",(function(){return n}))},"./src/utils/mp4-tools.ts":
332
332
  /*!********************************!*\
333
333
  !*** ./src/utils/mp4-tools.ts ***!
334
334
  \********************************/
335
- /*! exports provided: bin2str, readUint16, readUint32, writeUint32, findBox, parseSegmentIndex, parseInitSegment, getStartDTS, getDuration, computeRawDurationFromSamples, offsetStartDTS, segmentValidRange, appendUint8Array */function(t,e,r){r.r(e),r.d(e,"bin2str",(function(){return o})),r.d(e,"readUint16",(function(){return u})),r.d(e,"readUint32",(function(){return l})),r.d(e,"writeUint32",(function(){return c})),r.d(e,"findBox",(function(){return d})),r.d(e,"parseSegmentIndex",(function(){return f})),r.d(e,"parseInitSegment",(function(){return h})),r.d(e,"getStartDTS",(function(){return p})),r.d(e,"getDuration",(function(){return v})),r.d(e,"computeRawDurationFromSamples",(function(){return g})),r.d(e,"offsetStartDTS",(function(){return m})),r.d(e,"segmentValidRange",(function(){return y})),r.d(e,"appendUint8Array",(function(){return E}));var n=r(/*! ./typed-array */"./src/utils/typed-array.ts"),i=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),a=Math.pow(2,32)-1,s=[].push;function o(t){return String.fromCharCode.apply(null,t)}function u(t,e){"data"in t&&(e+=t.start,t=t.data);var r=t[e]<<8|t[e+1];return r<0?65536+r:r}function l(t,e){"data"in t&&(e+=t.start,t=t.data);var r=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return r<0?4294967296+r:r}function c(t,e,r){"data"in t&&(e+=t.start,t=t.data),t[e]=r>>24,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r}function d(t,e){var r,n,i,a=[];if(!e.length)return a;"data"in t?(r=t.data,n=t.start,i=t.end):(n=0,i=(r=t).byteLength);for(var u=n;u<i;){var c=l(r,u),f=c>1?u+c:i;if(o(r.subarray(u+4,u+8))===e[0])if(1===e.length)a.push({data:r,start:u+8,end:f});else{var h=d({data:r,start:u+8,end:f},e.slice(1));h.length&&s.apply(a,h)}u=f}return a}function f(t){var e=d(t,["moov"])[0],r=e?e.end:null,n=d(t,["sidx"]);if(!n||!n[0])return null;var i=[],a=n[0],s=a.data[0],o=0===s?8:16,c=l(a,o);o+=4,o+=0===s?8:16,o+=2;var f=a.end+0,h=u(a,o);o+=2;for(var p=0;p<h;p++){var v=o,g=l(a,v);v+=4;var m=2147483647&g;if(1==(2147483648&g)>>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;var y=l(a,v);v+=4,i.push({referenceSize:m,subsegmentDuration:y,info:{duration:y/c,start:f,end:f+m-1}}),f+=m,o=v+=4}return{earliestPresentationTime:0,timescale:c,version:s,referencesCount:h,references:i,moovEndOffset:r}}function h(t){for(var e=[],r=d(t,["moov","trak"]),n=0;n<r.length;n++){var a=r[n],s=d(a,["tkhd"])[0];if(s){var u=s.data[s.start],c=0===u?12:20,f=l(s,c),h=d(a,["mdia","mdhd"])[0];if(h){var p=l(h,c=0===(u=h.data[h.start])?12:20),v=d(a,["mdia","hdlr"])[0];if(v){var g=o(v.data.subarray(v.start+8,v.start+12)),m={soun:i.ElementaryStreamTypes.AUDIO,vide:i.ElementaryStreamTypes.VIDEO}[g];if(m){var y=d(a,["mdia","minf","stbl","stsd"])[0],E=void 0;y&&(E=o(y.data.subarray(y.start+12,y.start+16))),e[f]={timescale:p,type:m},e[m]={timescale:p,id:f,codec:E}}}}}}return d(t,["moov","mvex","trex"]).forEach((function(t){var r=l(t,4),n=e[r];n&&(n.default={duration:l(t,12),flags:l(t,20)})})),e}function p(t,e){return d(e,["moof","traf"]).reduce((function(e,r){var n=d(r,["tfdt"])[0],i=n.data[n.start],a=d(r,["tfhd"]).reduce((function(e,r){var a=l(r,4),s=t[a];if(s){var o=l(n,4);1===i&&(o*=Math.pow(2,32),o+=l(n,8));var u=o/(s.timescale||9e4);if(isFinite(u)&&(null===e||u<e))return u}return e}),null);return null!==a&&isFinite(a)&&(null===e||a<e)?a:e}),null)||0}function v(t,e){for(var r=0,n=0,a=0,s=d(t,["moof","traf"]),o=0;o<s.length;o++){var u=s[o],c=d(u,["tfhd"])[0],h=e[l(c,4)];if(h){var p=h.default,v=l(c,0)|(null==p?void 0:p.flags),m=null==p?void 0:p.duration;8&v&&(m=l(c,2&v?12:8));for(var y=h.timescale||9e4,E=d(u,["trun"]),T=0;T<E.length;T++)r=m?m*l(E[T],4):g(E[T]),h.type===i.ElementaryStreamTypes.VIDEO?n+=r/y:h.type===i.ElementaryStreamTypes.AUDIO&&(a+=r/y)}}if(0===n&&0===a){var _=f(t);if(null!=_&&_.references)return _.references.reduce((function(t,e){return t+e.info.duration||0}),0)}return n||a}function g(t){var e=l(t,0),r=8;1&e&&(r+=4),4&e&&(r+=4);for(var n=0,i=l(t,4),a=0;a<i;a++)256&e&&(n+=l(t,r),r+=4),512&e&&(r+=4),1024&e&&(r+=4),2048&e&&(r+=4);return n}function m(t,e,r){d(e,["moof","traf"]).forEach((function(e){d(e,["tfhd"]).forEach((function(n){var i=l(n,4),s=t[i];if(s){var o=s.timescale||9e4;d(e,["tfdt"]).forEach((function(t){var e=t.data[t.start],n=l(t,4);if(0===e)c(t,4,n-r*o);else{n*=Math.pow(2,32),n+=l(t,8),n-=r*o,n=Math.max(n,0);var i=Math.floor(n/(a+1)),s=Math.floor(n%(a+1));c(t,4,i),c(t,8,s)}}))}}))}))}function y(t){var e={valid:null,remainder:null},r=d(t,["moof"]);if(!r)return e;if(r.length<2)return e.remainder=t,e;var i=r[r.length-1];return e.valid=Object(n.sliceUint8)(t,0,i.start-8),e.remainder=Object(n.sliceUint8)(t,i.start-8),e}function E(t,e){var r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}},"./src/utils/output-filter.ts":
335
+ /*! exports provided: bin2str, readUint16, readUint32, writeUint32, findBox, parseSegmentIndex, parseInitSegment, getStartDTS, getDuration, computeRawDurationFromSamples, offsetStartDTS, segmentValidRange, appendUint8Array */function(e,t,r){r.r(t),r.d(t,"bin2str",(function(){return o})),r.d(t,"readUint16",(function(){return l})),r.d(t,"readUint32",(function(){return u})),r.d(t,"writeUint32",(function(){return c})),r.d(t,"findBox",(function(){return d})),r.d(t,"parseSegmentIndex",(function(){return f})),r.d(t,"parseInitSegment",(function(){return h})),r.d(t,"getStartDTS",(function(){return p})),r.d(t,"getDuration",(function(){return v})),r.d(t,"computeRawDurationFromSamples",(function(){return g})),r.d(t,"offsetStartDTS",(function(){return m})),r.d(t,"segmentValidRange",(function(){return y})),r.d(t,"appendUint8Array",(function(){return E}));var n=r(/*! ./typed-array */"./src/utils/typed-array.ts"),i=r(/*! ../loader/fragment */"./src/loader/fragment.ts"),a=Math.pow(2,32)-1,s=[].push;function o(e){return String.fromCharCode.apply(null,e)}function l(e,t){"data"in e&&(t+=e.start,e=e.data);var r=e[t]<<8|e[t+1];return r<0?65536+r:r}function u(e,t){"data"in e&&(t+=e.start,e=e.data);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return r<0?4294967296+r:r}function c(e,t,r){"data"in e&&(t+=e.start,e=e.data),e[t]=r>>24,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r}function d(e,t){var r,n,i,a=[];if(!t.length)return a;"data"in e?(r=e.data,n=e.start,i=e.end):(n=0,i=(r=e).byteLength);for(var l=n;l<i;){var c=u(r,l),f=c>1?l+c:i;if(o(r.subarray(l+4,l+8))===t[0])if(1===t.length)a.push({data:r,start:l+8,end:f});else{var h=d({data:r,start:l+8,end:f},t.slice(1));h.length&&s.apply(a,h)}l=f}return a}function f(e){var t=d(e,["moov"])[0],r=t?t.end:null,n=d(e,["sidx"]);if(!n||!n[0])return null;var i=[],a=n[0],s=a.data[0],o=0===s?8:16,c=u(a,o);o+=4,o+=0===s?8:16,o+=2;var f=a.end+0,h=l(a,o);o+=2;for(var p=0;p<h;p++){var v=o,g=u(a,v);v+=4;var m=2147483647&g;if(1==(2147483648&g)>>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;var y=u(a,v);v+=4,i.push({referenceSize:m,subsegmentDuration:y,info:{duration:y/c,start:f,end:f+m-1}}),f+=m,o=v+=4}return{earliestPresentationTime:0,timescale:c,version:s,referencesCount:h,references:i,moovEndOffset:r}}function h(e){for(var t=[],r=d(e,["moov","trak"]),n=0;n<r.length;n++){var a=r[n],s=d(a,["tkhd"])[0];if(s){var l=s.data[s.start],c=0===l?12:20,f=u(s,c),h=d(a,["mdia","mdhd"])[0];if(h){var p=u(h,c=0===(l=h.data[h.start])?12:20),v=d(a,["mdia","hdlr"])[0];if(v){var g=o(v.data.subarray(v.start+8,v.start+12)),m={soun:i.ElementaryStreamTypes.AUDIO,vide:i.ElementaryStreamTypes.VIDEO}[g];if(m){var y=d(a,["mdia","minf","stbl","stsd"])[0],E=void 0;y&&(E=o(y.data.subarray(y.start+12,y.start+16))),t[f]={timescale:p,type:m},t[m]={timescale:p,id:f,codec:E}}}}}}return d(e,["moov","mvex","trex"]).forEach((function(e){var r=u(e,4),n=t[r];n&&(n.default={duration:u(e,12),flags:u(e,20)})})),t}function p(e,t){return d(t,["moof","traf"]).reduce((function(t,r){var n=d(r,["tfdt"])[0],i=n.data[n.start],a=d(r,["tfhd"]).reduce((function(t,r){var a=u(r,4),s=e[a];if(s){var o=u(n,4);1===i&&(o*=Math.pow(2,32),o+=u(n,8));var l=o/(s.timescale||9e4);if(isFinite(l)&&(null===t||l<t))return l}return t}),null);return null!==a&&isFinite(a)&&(null===t||a<t)?a:t}),null)||0}function v(e,t){for(var r=0,n=0,a=0,s=d(e,["moof","traf"]),o=0;o<s.length;o++){var l=s[o],c=d(l,["tfhd"])[0],h=t[u(c,4)];if(h){var p=h.default,v=u(c,0)|(null==p?void 0:p.flags),m=null==p?void 0:p.duration;8&v&&(m=u(c,2&v?12:8));for(var y=h.timescale||9e4,E=d(l,["trun"]),_=0;_<E.length;_++)r=m?m*u(E[_],4):g(E[_]),h.type===i.ElementaryStreamTypes.VIDEO?n+=r/y:h.type===i.ElementaryStreamTypes.AUDIO&&(a+=r/y)}}if(0===n&&0===a){var T=f(e);if(null!=T&&T.references)return T.references.reduce((function(e,t){return e+t.info.duration||0}),0)}return n||a}function g(e){var t=u(e,0),r=8;1&t&&(r+=4),4&t&&(r+=4);for(var n=0,i=u(e,4),a=0;a<i;a++)256&t&&(n+=u(e,r),r+=4),512&t&&(r+=4),1024&t&&(r+=4),2048&t&&(r+=4);return n}function m(e,t,r){d(t,["moof","traf"]).forEach((function(t){d(t,["tfhd"]).forEach((function(n){var i=u(n,4),s=e[i];if(s){var o=s.timescale||9e4;d(t,["tfdt"]).forEach((function(e){var t=e.data[e.start],n=u(e,4);if(0===t)c(e,4,n-r*o);else{n*=Math.pow(2,32),n+=u(e,8),n-=r*o,n=Math.max(n,0);var i=Math.floor(n/(a+1)),s=Math.floor(n%(a+1));c(e,4,i),c(e,8,s)}}))}}))}))}function y(e){var t={valid:null,remainder:null},r=d(e,["moof"]);if(!r)return t;if(r.length<2)return t.remainder=e,t;var i=r[r.length-1];return t.valid=Object(n.sliceUint8)(e,0,i.start-8),t.remainder=Object(n.sliceUint8)(e,i.start-8),t}function E(e,t){var r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}},"./src/utils/output-filter.ts":
336
336
  /*!************************************!*\
337
337
  !*** ./src/utils/output-filter.ts ***!
338
338
  \************************************/
339
- /*! exports provided: default */function(t,e,r){r.r(e),r.d(e,"default",(function(){return n}));var n=function(){function t(t,e){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=e}var e=t.prototype;return e.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},e.newCue=function(t,e,r){(null===this.startTime||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)},e.reset=function(){this.cueRanges=[]},t}()},"./src/utils/texttrack-utils.ts":
339
+ /*! exports provided: default */function(e,t,r){r.r(t),r.d(t,"default",(function(){return n}));var n=function(){function e(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}var t=e.prototype;return t.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},t.newCue=function(e,t,r){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)},t.reset=function(){this.cueRanges=[]},e}()},"./src/utils/texttrack-utils.ts":
340
340
  /*!**************************************!*\
341
341
  !*** ./src/utils/texttrack-utils.ts ***!
342
342
  \**************************************/
343
- /*! exports provided: sendAddTrackEvent, addCueToTrack, clearCurrentCues, removeCuesInRange, getCuesInRange */function(t,e,r){r.r(e),r.d(e,"sendAddTrackEvent",(function(){return i})),r.d(e,"addCueToTrack",(function(){return a})),r.d(e,"clearCurrentCues",(function(){return s})),r.d(e,"removeCuesInRange",(function(){return o})),r.d(e,"getCuesInRange",(function(){return u}));var n=r(/*! ./logger */"./src/utils/logger.ts");function i(t,e){var r;try{r=new Event("addtrack")}catch(t){(r=document.createEvent("Event")).initEvent("addtrack",!1,!1)}r.track=t,e.dispatchEvent(r)}function a(t,e){var r=t.mode;if("disabled"===r&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error("addCue is failed for: "+e)}catch(r){n.logger.debug("[texttrack-utils]: "+r);var i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,t.addCue(i)}"disabled"===r&&(t.mode=r)}function s(t){var e=t.mode;if("disabled"===e&&(t.mode="hidden"),t.cues){for(var r=t.cues.length;r--;)t.removeCue(t.cues[r]);"disabled"===e&&(t.mode=e)}}function o(t,e,r){var n=t.mode;if("disabled"===n&&(t.mode="hidden"),t.cues&&t.cues.length){for(var i=u(t.cues,e,r),a=0;a<i.length;a++)t.removeCue(i[a]);"disabled"===n&&(t.mode=n)}}function u(t,e,r){var n=[],i=function(t,e){if(e<t[0].startTime)return 0;var r=t.length-1;if(e>t[r].endTime)return-1;for(var n=0,i=r;n<=i;){var a=Math.floor((i+n)/2);if(e<t[a].startTime)i=a-1;else{if(!(e>t[a].startTime&&n<r))return a;n=a+1}}return t[n].startTime-e<e-t[i].startTime?n:i}(t,e);if(i>-1)for(var a=i,s=t.length;a<s;a++){var o=t[a];if(o.startTime>=e&&o.endTime<=r)n.push(o);else if(o.startTime>r)return n}return n}},"./src/utils/time-ranges.ts":
343
+ /*! exports provided: sendAddTrackEvent, addCueToTrack, clearCurrentCues, removeCuesInRange, getCuesInRange */function(e,t,r){r.r(t),r.d(t,"sendAddTrackEvent",(function(){return i})),r.d(t,"addCueToTrack",(function(){return a})),r.d(t,"clearCurrentCues",(function(){return s})),r.d(t,"removeCuesInRange",(function(){return o})),r.d(t,"getCuesInRange",(function(){return l}));var n=r(/*! ./logger */"./src/utils/logger.ts");function i(e,t){var r;try{r=new Event("addtrack")}catch(e){(r=document.createEvent("Event")).initEvent("addtrack",!1,!1)}r.track=e,t.dispatchEvent(r)}function a(e,t){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(r){n.logger.debug("[texttrack-utils]: "+r);var i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}"disabled"===r&&(e.mode=r)}function s(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues){for(var r=e.cues.length;r--;)e.removeCue(e.cues[r]);"disabled"===t&&(e.mode=t)}}function o(e,t,r){var n=e.mode;if("disabled"===n&&(e.mode="hidden"),e.cues&&e.cues.length){for(var i=l(e.cues,t,r),a=0;a<i.length;a++)e.removeCue(i[a]);"disabled"===n&&(e.mode=n)}}function l(e,t,r){var n=[],i=function(e,t){if(t<e[0].startTime)return 0;var r=e.length-1;if(t>e[r].endTime)return-1;for(var n=0,i=r;n<=i;){var a=Math.floor((i+n)/2);if(t<e[a].startTime)i=a-1;else{if(!(t>e[a].startTime&&n<r))return a;n=a+1}}return e[n].startTime-t<t-e[i].startTime?n:i}(e,t);if(i>-1)for(var a=i,s=e.length;a<s;a++){var o=e[a];if(o.startTime>=t&&o.endTime<=r)n.push(o);else if(o.startTime>r)return n}return n}},"./src/utils/time-ranges.ts":
344
344
  /*!**********************************!*\
345
345
  !*** ./src/utils/time-ranges.ts ***!
346
346
  \**********************************/
347
- /*! exports provided: default */function(t,e,r){r.r(e),e.default={toString:function(t){for(var e="",r=t.length,n=0;n<r;n++)e+="["+t.start(n).toFixed(3)+","+t.end(n).toFixed(3)+"]";return e}}},"./src/utils/timescale-conversion.ts":
347
+ /*! exports provided: default */function(e,t,r){r.r(t),t.default={toString:function(e){for(var t="",r=e.length,n=0;n<r;n++)t+="["+e.start(n).toFixed(3)+","+e.end(n).toFixed(3)+"]";return t}}},"./src/utils/timescale-conversion.ts":
348
348
  /*!*******************************************!*\
349
349
  !*** ./src/utils/timescale-conversion.ts ***!
350
350
  \*******************************************/
351
- /*! exports provided: toTimescaleFromBase, toTimescaleFromScale, toMsFromMpegTsClock, toMpegTsClockFromTimescale */function(t,e,r){function n(t,e,r,n){void 0===r&&(r=1),void 0===n&&(n=!1);var i=t*e*r;return n?Math.round(i):i}function i(t,e,r,i){return void 0===r&&(r=1),void 0===i&&(i=!1),n(t,e,1/r,i)}function a(t,e){return void 0===e&&(e=!1),n(t,1e3,1/9e4,e)}function s(t,e){return void 0===e&&(e=1),n(t,9e4,1/e)}r.r(e),r.d(e,"toTimescaleFromBase",(function(){return n})),r.d(e,"toTimescaleFromScale",(function(){return i})),r.d(e,"toMsFromMpegTsClock",(function(){return a})),r.d(e,"toMpegTsClockFromTimescale",(function(){return s}))},"./src/utils/typed-array.ts":
351
+ /*! exports provided: toTimescaleFromBase, toTimescaleFromScale, toMsFromMpegTsClock, toMpegTsClockFromTimescale */function(e,t,r){function n(e,t,r,n){void 0===r&&(r=1),void 0===n&&(n=!1);var i=e*t*r;return n?Math.round(i):i}function i(e,t,r,i){return void 0===r&&(r=1),void 0===i&&(i=!1),n(e,t,1/r,i)}function a(e,t){return void 0===t&&(t=!1),n(e,1e3,1/9e4,t)}function s(e,t){return void 0===t&&(t=1),n(e,9e4,1/t)}r.r(t),r.d(t,"toTimescaleFromBase",(function(){return n})),r.d(t,"toTimescaleFromScale",(function(){return i})),r.d(t,"toMsFromMpegTsClock",(function(){return a})),r.d(t,"toMpegTsClockFromTimescale",(function(){return s}))},"./src/utils/typed-array.ts":
352
352
  /*!**********************************!*\
353
353
  !*** ./src/utils/typed-array.ts ***!
354
354
  \**********************************/
355
- /*! exports provided: sliceUint8 */function(t,e,r){function n(t,e,r){return Uint8Array.prototype.slice?t.slice(e,r):new Uint8Array(Array.prototype.slice.call(t,e,r))}r.r(e),r.d(e,"sliceUint8",(function(){return n}))},"./src/utils/vttcue.ts":
355
+ /*! exports provided: sliceUint8 */function(e,t,r){function n(e,t,r){return Uint8Array.prototype.slice?e.slice(t,r):new Uint8Array(Array.prototype.slice.call(e,t,r))}r.r(t),r.d(t,"sliceUint8",(function(){return n}))},"./src/utils/vttcue.ts":
356
356
  /*!*****************************!*\
357
357
  !*** ./src/utils/vttcue.ts ***!
358
358
  \*****************************/
359
- /*! exports provided: default */function(t,e,r){r.r(e),e.default=function(){if("undefined"!=typeof self&&self.VTTCue)return self.VTTCue;var t=["","lr","rl"],e=["start","middle","end","left","right"];function r(t,e){if("string"!=typeof e)return!1;if(!Array.isArray(t))return!1;var r=e.toLowerCase();return!!~t.indexOf(r)&&r}function n(t){return r(e,t)}function i(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];for(var i=1;i<arguments.length;i++){var a=arguments[i];for(var s in a)t[s]=a[s]}return t}function a(e,a,s){var o=this,u={enumerable:!0};o.hasBeenReset=!1;var l="",c=!1,d=e,f=a,h=s,p=null,v="",g=!0,m="auto",y="start",E=50,T="middle",_=50,b="middle";Object.defineProperty(o,"id",i({},u,{get:function(){return l},set:function(t){l=""+t}})),Object.defineProperty(o,"pauseOnExit",i({},u,{get:function(){return c},set:function(t){c=!!t}})),Object.defineProperty(o,"startTime",i({},u,{get:function(){return d},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");d=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",i({},u,{get:function(){return f},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");f=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",i({},u,{get:function(){return h},set:function(t){h=""+t,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",i({},u,{get:function(){return p},set:function(t){p=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",i({},u,{get:function(){return v},set:function(e){var n=function(e){return r(t,e)}(e);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");v=n,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",i({},u,{get:function(){return g},set:function(t){g=!!t,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",i({},u,{get:function(){return m},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",i({},u,{get:function(){return y},set:function(t){var e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",i({},u,{get:function(){return E},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");E=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",i({},u,{get:function(){return T},set:function(t){var e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");T=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",i({},u,{get:function(){return _},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");_=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",i({},u,{get:function(){return b},set:function(t){var e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");b=e,this.hasBeenReset=!0}})),o.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}()},"./src/utils/vttparser.ts":
359
+ /*! exports provided: default */function(e,t,r){r.r(t),t.default=function(){if("undefined"!=typeof self&&self.VTTCue)return self.VTTCue;var e=["","lr","rl"],t=["start","middle","end","left","right"];function r(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;var r=t.toLowerCase();return!!~e.indexOf(r)&&r}function n(e){return r(t,e)}function i(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i=1;i<arguments.length;i++){var a=arguments[i];for(var s in a)e[s]=a[s]}return e}function a(t,a,s){var o=this,l={enumerable:!0};o.hasBeenReset=!1;var u="",c=!1,d=t,f=a,h=s,p=null,v="",g=!0,m="auto",y="start",E=50,_="middle",T=50,b="middle";Object.defineProperty(o,"id",i({},l,{get:function(){return u},set:function(e){u=""+e}})),Object.defineProperty(o,"pauseOnExit",i({},l,{get:function(){return c},set:function(e){c=!!e}})),Object.defineProperty(o,"startTime",i({},l,{get:function(){return d},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");d=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",i({},l,{get:function(){return f},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");f=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",i({},l,{get:function(){return h},set:function(e){h=""+e,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",i({},l,{get:function(){return p},set:function(e){p=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",i({},l,{get:function(){return v},set:function(t){var n=function(t){return r(e,t)}(t);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");v=n,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",i({},l,{get:function(){return g},set:function(e){g=!!e,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",i({},l,{get:function(){return m},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("An invalid number or illegal string was specified.");m=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",i({},l,{get:function(){return y},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");y=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",i({},l,{get:function(){return E},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",i({},l,{get:function(){return _},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");_=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",i({},l,{get:function(){return T},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");T=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",i({},l,{get:function(){return b},set:function(e){var t=n(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");b=t,this.hasBeenReset=!0}})),o.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}()},"./src/utils/vttparser.ts":
360
360
  /*!********************************!*\
361
361
  !*** ./src/utils/vttparser.ts ***!
362
362
  \********************************/
363
- /*! exports provided: parseTimeStamp, fixLineBreaks, VTTParser */function(t,e,r){r.r(e),r.d(e,"parseTimeStamp",(function(){return a})),r.d(e,"fixLineBreaks",(function(){return d})),r.d(e,"VTTParser",(function(){return f}));var n=r(/*! ./vttcue */"./src/utils/vttcue.ts"),i=function(){function t(){}return t.prototype.decode=function(t,e){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))},t}();function a(t){function e(t,e,r,n){return 3600*(0|t)+60*(0|e)+(0|r)+parseFloat(n||0)}var r=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?e(r[2],r[3],0,r[4]):e(r[1],r[2],r[3],r[4]):null}var s=function(){function t(){this.values=Object.create(null)}var e=t.prototype;return e.set=function(t,e){this.get(t)||""===e||(this.values[t]=e)},e.get=function(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e},e.has=function(t){return t in this.values},e.alt=function(t,e,r){for(var n=0;n<r.length;++n)if(e===r[n]){this.set(t,e);break}},e.integer=function(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))},e.percent=function(t,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var r=parseFloat(e);if(r>=0&&r<=100)return this.set(t,r),!0}return!1},t}();function o(t,e,r,n){var i=n?t.split(n):[t];for(var a in i)if("string"==typeof i[a]){var s=i[a].split(r);2===s.length&&e(s[0],s[1])}}var u=new n.default(0,0,""),l="middle"===u.align?"middle":"center";function c(t,e,r){var n=t;function i(){var e=a(t);if(null===e)throw new Error("Malformed timestamp: "+n);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function c(){t=t.replace(/^\s+/,"")}if(c(),e.startTime=i(),c(),"--\x3e"!==t.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);t=t.substr(3),c(),e.endTime=i(),c(),function(t,e){var n=new s;o(t,(function(t,e){var i;switch(t){case"region":for(var a=r.length-1;a>=0;a--)if(r[a].id===e){n.set(t,r[a].region);break}break;case"vertical":n.alt(t,e,["rl","lr"]);break;case"line":i=e.split(","),n.integer(t,i[0]),n.percent(t,i[0])&&n.set("snapToLines",!1),n.alt(t,i[0],["auto"]),2===i.length&&n.alt("lineAlign",i[1],["start",l,"end"]);break;case"position":i=e.split(","),n.percent(t,i[0]),2===i.length&&n.alt("positionAlign",i[1],["start",l,"end","line-left","line-right","auto"]);break;case"size":n.percent(t,e);break;case"align":n.alt(t,e,["start",l,"end","left","right"])}}),/:/,/\s/),e.region=n.get("region",null),e.vertical=n.get("vertical","");var i=n.get("line","auto");"auto"===i&&-1===u.line&&(i=-1),e.line=i,e.lineAlign=n.get("lineAlign","start"),e.snapToLines=n.get("snapToLines",!0),e.size=n.get("size",100),e.align=n.get("align",l);var a=n.get("position","auto");"auto"===a&&50===u.position&&(a="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=a}(t,e)}function d(t){return t.replace(/<br(?: \/)?>/gi,"\n")}var f=function(){function t(){this.state="INITIAL",this.buffer="",this.decoder=new i,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var e=t.prototype;return e.parse=function(t){var e=this;function r(){var t=e.buffer,r=0;for(t=d(t);r<t.length&&"\r"!==t[r]&&"\n"!==t[r];)++r;var n=t.substr(0,r);return"\r"===t[r]&&++r,"\n"===t[r]&&++r,e.buffer=t.substr(r),n}t&&(e.buffer+=e.decoder.decode(t,{stream:!0}));try{var i="";if("INITIAL"===e.state){if(!/\r\n|\n/.test(e.buffer))return this;var a=(i=r()).match(/^()?WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var s=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(s?s=!1:i=r(),e.state){case"HEADER":/:/.test(i)?o(i,(function(t,e){}),/:/):i||(e.state="ID");continue;case"NOTE":i||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){e.state="NOTE";break}if(!i)continue;if(e.cue=new n.default(0,0,""),e.state="CUE",-1===i.indexOf("--\x3e")){e.cue.id=i;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{c(i,e.cue,e.regionList)}catch(t){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var u=-1!==i.indexOf("--\x3e");if(!i||u&&(s=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(null===e.cue)continue;e.cue.text&&(e.cue.text+="\n"),e.cue.text+=i;continue;case"BADCUE":i||(e.state="ID")}}}catch(t){"CUETEXT"===e.state&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state="INITIAL"===e.state?"BADWEBVTT":"BADCUE"}return this},e.flush=function(){try{if((this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state||"BADWEBVTT"===this.state)throw new Error("Malformed WebVTT signature.")}catch(t){this.onparsingerror&&this.onparsingerror(t)}return this.onflush&&this.onflush(),this},t}()},"./src/utils/webvtt-parser.ts":
363
+ /*! exports provided: parseTimeStamp, fixLineBreaks, VTTParser */function(e,t,r){r.r(t),r.d(t,"parseTimeStamp",(function(){return a})),r.d(t,"fixLineBreaks",(function(){return d})),r.d(t,"VTTParser",(function(){return f}));var n=r(/*! ./vttcue */"./src/utils/vttcue.ts"),i=function(){function e(){}return e.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},e}();function a(e){function t(e,t,r,n){return 3600*(0|e)+60*(0|t)+(0|r)+parseFloat(n||0)}var r=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?t(r[2],r[3],0,r[4]):t(r[1],r[2],r[3],r[4]):null}var s=function(){function e(){this.values=Object.create(null)}var t=e.prototype;return t.set=function(e,t){this.get(e)||""===t||(this.values[e]=t)},t.get=function(e,t,r){return r?this.has(e)?this.values[e]:t[r]:this.has(e)?this.values[e]:t},t.has=function(e){return e in this.values},t.alt=function(e,t,r){for(var n=0;n<r.length;++n)if(t===r[n]){this.set(e,t);break}},t.integer=function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},t.percent=function(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){var r=parseFloat(t);if(r>=0&&r<=100)return this.set(e,r),!0}return!1},e}();function o(e,t,r,n){var i=n?e.split(n):[e];for(var a in i)if("string"==typeof i[a]){var s=i[a].split(r);2===s.length&&t(s[0],s[1])}}var l=new n.default(0,0,""),u="middle"===l.align?"middle":"center";function c(e,t,r){var n=e;function i(){var t=a(e);if(null===t)throw new Error("Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function c(){e=e.replace(/^\s+/,"")}if(c(),t.startTime=i(),c(),"--\x3e"!==e.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),c(),t.endTime=i(),c(),function(e,t){var n=new s;o(e,(function(e,t){var i;switch(e){case"region":for(var a=r.length-1;a>=0;a--)if(r[a].id===t){n.set(e,r[a].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":i=t.split(","),n.integer(e,i[0]),n.percent(e,i[0])&&n.set("snapToLines",!1),n.alt(e,i[0],["auto"]),2===i.length&&n.alt("lineAlign",i[1],["start",u,"end"]);break;case"position":i=t.split(","),n.percent(e,i[0]),2===i.length&&n.alt("positionAlign",i[1],["start",u,"end","line-left","line-right","auto"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start",u,"end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");var i=n.get("line","auto");"auto"===i&&-1===l.line&&(i=-1),t.line=i,t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100),t.align=n.get("align",u);var a=n.get("position","auto");"auto"===a&&50===l.position&&(a="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=a}(e,t)}function d(e){return e.replace(/<br(?: \/)?>/gi,"\n")}var f=function(){function e(){this.state="INITIAL",this.buffer="",this.decoder=new i,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var t=e.prototype;return t.parse=function(e){var t=this;function r(){var e=t.buffer,r=0;for(e=d(e);r<e.length&&"\r"!==e[r]&&"\n"!==e[r];)++r;var n=e.substr(0,r);return"\r"===e[r]&&++r,"\n"===e[r]&&++r,t.buffer=e.substr(r),n}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var i="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var a=(i=r()).match(/^()?WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new Error("Malformed WebVTT signature.");t.state="HEADER"}for(var s=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:i=r(),t.state){case"HEADER":/:/.test(i)?o(i,(function(e,t){}),/:/):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;if(t.cue=new n.default(0,0,""),t.state="CUE",-1===i.indexOf("--\x3e")){t.cue.id=i;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{c(i,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var l=-1!==i.indexOf("--\x3e");if(!i||l&&(s=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=i;continue;case"BADCUE":i||(t.state="ID")}}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},t.flush=function(){try{if((this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state||"BADWEBVTT"===this.state)throw new Error("Malformed WebVTT signature.")}catch(e){this.onparsingerror&&this.onparsingerror(e)}return this.onflush&&this.onflush(),this},e}()},"./src/utils/webvtt-parser.ts":
364
364
  /*!************************************!*\
365
365
  !*** ./src/utils/webvtt-parser.ts ***!
366
366
  \************************************/
367
- /*! exports provided: generateCueId, parseWebVTT */function(t,e,r){r.r(e),r.d(e,"generateCueId",(function(){return d})),r.d(e,"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(t,e,r){return void 0===r&&(r=0),t.substr(r,e.length)===e},c=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return(e>>>0).toString()};function d(t,e,r){return c(t.toString())+c(e.toString())+c(r)}function f(t,e,r,c,f,h,p,v){var g,m=new i.VTTParser,y=Object(a.utf8ArrayToStr)(new Uint8Array(t)).trim().replace(u,"\n").split("\n"),E=[],T=Object(s.toMpegTsClockFromTimescale)(e,r),_="00:00.000",b=0,A=0,S=!0,L=!1;m.oncue=function(t){var e=c[f],r=c.ccOffset,n=(b-T)/9e4;if(null!=e&&e.new&&(void 0!==A?r=c.ccOffset=e.start:function(t,e,r){var n=t[e],i=t[n.prevCC];if(!i||!i.new&&n.new)return t.ccOffset=t.presentationOffset=n.start,void(n.new=!1);for(;null!==(a=i)&&void 0!==a&&a.new;){var a;t.ccOffset+=n.start-i.start,n.new=!1,i=t[(n=i).prevCC]}t.presentationOffset=r}(c,f,n)),n&&(r=n-c.presentationOffset),L){var i=t.endTime-t.startTime,a=Object(o.normalizePts)(9e4*(t.startTime+r-A),9e4*h)/9e4;t.startTime=a,t.endTime=a+i}var s=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(s)),t.id||(t.id=d(t.startTime,t.endTime,s)),t.endTime>0&&E.push(t)},m.onparsingerror=function(t){g=t},m.onflush=function(){g?v(g):p(E)},y.forEach((function(t){if(S){if(l(t,"X-TIMESTAMP-MAP=")){S=!1,L=!0,t.substr(16).split(",").forEach((function(t){l(t,"LOCAL:")?_=t.substr(6):l(t,"MPEGTS:")&&(b=parseInt(t.substr(7)))}));try{A=function(t){var e=parseInt(t.substr(-3)),r=parseInt(t.substr(-6,2)),i=parseInt(t.substr(-9,2)),a=t.length>9?parseInt(t.substr(0,t.indexOf(":"))):0;if(!(Object(n.isFiniteNumber)(e)&&Object(n.isFiniteNumber)(r)&&Object(n.isFiniteNumber)(i)&&Object(n.isFiniteNumber)(a)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+t);return e+=1e3*r,e+=6e4*i,e+=36e5*a}(_)/1e3}catch(t){L=!1,g=t}return}""===t&&(S=!1)}m.parse(t+"\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"),l=/\r\n|\n\r|\n|\r/g,u=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(l,"\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(u(e,"X-TIMESTAMP-MAP=")){S=!1,L=!0,e.substr(16).split(",").forEach((function(e){u(e,"LOCAL:")?T=e.substr(6):u(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":
368
368
  /*!*********************************!*\
369
369
  !*** ./src/utils/xhr-loader.ts ***!
370
370
  \*********************************/
371
- /*! exports provided: default */function(t,e,r){r.r(e);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 t(t){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=t?t.xhrSetup:null,this.stats=new i.LoadStats,this.retryDelay=0}var e=t.prototype;return e.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},e.abortInternal=function(){var t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))},e.abort=function(){var t;this.abortInternal(),null!==(t=this.callbacks)&&void 0!==t&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},e.load=function(t,e,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=r,this.retryDelay=e.retryDelay,this.loadInternal()},e.loadInternal=function(){var t=this.config,e=this.context;if(t){var r=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0;var i=this.xhrSetup;try{if(i)try{i(r,e.url)}catch(t){r.open("GET",e.url,!0),i(r,e.url)}r.readyState||r.open("GET",e.url,!0)}catch(t){return void this.callbacks.onError({code:r.status,text:t.message},e,r)}e.rangeEnd&&r.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),r.onreadystatechange=this.readystatechange.bind(this),r.onprogress=this.loadprogress.bind(this),r.responseType=e.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),t.timeout),r.send()}},e.readystatechange=function(){var t=this.context,e=this.loader,r=this.stats;if(t&&e){var i=e.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){e.onreadystatechange=null,e.onprogress=null;var s=e.status;if(s>=200&&s<300){var o,u;if(r.loading.end=Math.max(self.performance.now(),r.loading.first),u="arraybuffer"===t.responseType?(o=e.response).byteLength:(o=e.responseText).length,r.loaded=r.total=u,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(r,t,o,e),!this.callbacks)return;var c={url:e.responseURL,data:o};this.callbacks.onSuccess(c,r,t,e)}else r.retry>=a.maxRetry||s>=400&&s<499?(n.logger.error(s+" while loading "+t.url),this.callbacks.onError({code:s,text:e.statusText},t,e)):(n.logger.warn(s+" while loading "+t.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),r.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout)}},e.loadtimeout=function(){n.logger.warn("timeout while loading "+this.context.url);var t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))},e.loadprogress=function(t){var e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)},e.getCacheAge=function(){var t=null;if(this.loader&&a.test(this.loader.getAllResponseHeaders())){var e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t},t}();e.default=s}}).default},t.exports=r())})));var Ar=Object.freeze({__proto__:null,ATTACHED:"hls:attached"});const Sr="com.widevine.alpha";const Lr="application/vnd.apple.mpegURL",kr=[Lr,"application/x-mpegurl"],wr=document.createElement("video").canPlayType(Lr);function Dr({src:t="",type:e="",drm:r},n){const i=(null==n?void 0:n.hls)||{},a="native"in i&&i.native;return(!wr||!a)&&(!(r&&!Object.keys(r).find(t=>{return e=t,[Sr].filter((function(t){return t===e})).length;var e}))&&(!(!e||!kr.includes(e))||function(t){const{pathname:e}=ze(t);return e.endsWith(".m3u8")}(t)))}var Rr="audio:set",Or="audio:update",Cr="audio:tracks";const Ir=[br.Events.SUBTITLE_TRACKS_UPDATED,br.Events.SUBTITLE_TRACK_SWITCH,br.Events.LEVEL_SWITCHED];function xr(t,e){Ir.forEach((function(r){t.on(r,(function(){!function(t,e){var r;const n=t.levels[t.currentLevel];if(!n||!t.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 e.emit("tracks:text:all",[]);const a=t.subtitleTracks.filter((function(t){return t.groupId==i})).map((function(t){return e.textTracks[t.id]}));e.emit("tracks:text:all",a)}(t,e)}))}))}var Pr=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 Mr(t,e,r){if(!t.reaper||!r.src)return;t.hls&&(t.emit("recover",{type:"hls"}),t.hls.destroy());const i="live"in e==0;if(r.drm&&!Ye()&&"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname)return t.emit(n,{message:"Secure page required for DRM"});const a=t.hls=new br(Object.assign(Object.assign({},e.hls),{startPosition:e.start_time||-1}));a.attachMedia(t),a.loadSource(r.src),t.emit("hls:attached",{hls:a}),function(t,e){t.on(br.Events.AUDIO_TRACKS_UPDATED,(function(t,r){e.emit(Cr,r.audioTracks)})),t.on(br.Events.AUDIO_TRACK_SWITCHING,(function(t,r){e.emit(Or,r)})),t.on(br.Events.MANIFEST_PARSED,(function(t,r){r.audioTracks&&e.emit(Cr,r.audioTracks)})),t.on(br.Events.LEVEL_SWITCHED,(function(r,n){const i=t.levels[n.level];i&&e.emit(Cr,t.audioTracks.filter((function(t){return t.groupId&&~(i.audioGroupIds||[]).indexOf(t.groupId)})))}))}(a,t),xr(a,t);const s=function(t){var e;const r=null===(e=t.data)||void 0===e?void 0:e.level;"number"==typeof r&&(a.levels[r]||-1===r?a.nextLevel=r:console.error(new Error("skipping invalid quality: "+t.data)))},o=function(t){var e;const r=null===(e=t.data)||void 0===e?void 0:e.id;"number"==typeof r&&r!=a.audioTrack&&setTimeout((function(){a.audioTrack=r}),0)};t.on("quality:set",s),t.on(Rr,o),t.on("src",(function(){t.hls&&t.hls.destroy(),t.off("quality:set",s),t.off(Rr,o)})),t.on("audioonlysource",(function(){})),t.on(v,(function(){a&&a.destroy()})),i&&a.on(br.Events.LEVEL_LOADED,(function(e,r){t.setOpts({live:r.details.live})})),a.on(br.Events.MANIFEST_PARSED,(function(e,r){const n=r.levels.slice(0).reduce((t,e,r)=>[...t,{level:r,text:e.name||e.width+"",width:e.width,height:e.height,videoCodec:e.videoCodec||""}],[{text:"AUTO",level:-1,width:0,height:0,videoCodec:""}]).sort((t,e)=>e.width-t.width);t.emit("qualities",n);const i=n.find(t=>!!t.videoCodec);i||t.emit("audioonlysource"),!t.opt("ratio")&&i&&0!=i.width&&0!=i.height&&t.setOpts({ratio:i.width+":"+i.height})})),a.on(br.Events.LEVEL_LOADED,(t,e)=>{console.log(t,e)}),a.on(br.Events.INIT_PTS_FOUND,(function(t,e){e.frag.duration})),a.on(br.Events.ERROR,(function(e,r){!function(t,e,r,i){if(0==t.reaper)return;if(0==e.fatal)return;switch(e.type){case br.ErrorTypes.MEDIA_ERROR:return function(t,e){var r;t.emit(n,{fatal:!0,message:"Unrecoverable error occurred while playing media"}),null===(r=t.hls)||void 0===r||r.destroy()}(t);case br.ErrorTypes.NETWORK_ERROR:return function(t,e){var r;const i=null===(r=e.networkDetails)||void 0===r?void 0:r.status;t.emit(n,{fatal:!0,code:"http:"+i.toString(),message:Pr[i]||"an error occurred while loading this video"})}(t,e);case br.ErrorTypes.KEY_SYSTEM_ERROR:(function(t,e){var r;t.emit(n,{fatal:!0,message:Pr[e.details]||"an error occurred while accessing this video"}),null===(r=t.hls)||void 0===r||r.destroy()})(t,e)}}(t,r,t.original_src)}));const u=t.opt("start_time");u&&t.once(d,(function(){t.currentTime=u})),t.on("loadstart",(function(){u&&a.startLoad(u)}))}class Fr{init(){}onload(t,e,r,n){Mr(r,t,n)}wants(t,e,r){return br.isSupported()&&Dr(e,r)}}Fr.events=Ar,Fr.version=br.version,vt(window,Fr);const Nr=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),Ur=(...t)=>t.reduce((t,e)=>Nr(e)?(Object.keys(e).forEach(r=>{if(Nr(t[r])&&Nr(e[r]))return t[r]=Ur(t[r],e[r]);t[r]=e[r]}),t):t,{});class Br{constructor(t){this.data=t}static of(t){return new Br(t)}static maybe(t,e,...r){return null==t?t:e.apply(t,[t,...r])}tap(t,...e){return t.apply(this,[this.data,...e]),new Br(this.data)}fmap(t,...e){const r=t.apply(this,[this.data,...e]);return new Br(r)}unwrap(){return this.data}}function jr(t){return fetch(t).then(t=>t.json())}function Gr(){let t=[].join.call(arguments,"/");return"/"!==t[0]&&(t="/"+t),Hr()+"/web/public/native/config"+t}const Hr=()=>"https://ljsp.lwcdn.com";function Kr(t){return~t.indexOf("/")?t:"/media/"+t}var Vr={404:"media not found",402:"invalid subscription",400:"bad request",415:"unsupported media type"};function Wr(t){const e=t.ima,r=t.duration;if(!e||!r)return t;const n=null==e?void 0:e.ads;return Array.isArray(n)&&(e.ads=n.map((function(t){return"number"==typeof t.percentage&&(t.time=t.percentage*r),t}))),t}function qr(t,e){var r,n;e="object"==typeof e?e:{};const i={title:null===(r=null==t?void 0:t.metadata)||void 0===r?void 0:r.title,description:null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.description},a={ima:{parameters:function({media_id:t,duration:e,title:r,tags:n,category_name:i,ad_keywords:a}){return{ad_keywords:a||"",media_id:t||"",category:i||"",media_name:r||"",media_tags:n||"",media_duration:e||-1}}((null==t?void 0:t.metadata)||{})}},s=e.embed||{};return delete s.src,Ur(a,i,t,(delete(o=e).src,delete o.metadata,delete o.title,delete o.description,delete o.duration,delete o.poster,o),s);var o}const Yr=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;function zr(t){return"object"==typeof t&&"ovp/base64"==t.type}function Xr(t,e){return function(t,e){return!(~t.indexOf(".")||!Yr.test(t))&&(e.type="video/ovp",!0)}(t,e)||zr(e)}function Qr(t){try{return function(t){return null===t?{}:JSON.parse(t)}(decodeURIComponent(atob(t).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return{err:t.message}}}function Jr(t){const e=t.split(/[^0-9]/).map(t=>parseInt(t,10));return Date.UTC(e[0],e[1]-1,e[2],e[3],e[4],e[5])}function Zr(t){return t.live}var $r=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 tn(t,e){const r=null==e?void 0:e.src;if(zr(e))return function(t,e){const r=Qr(e.src||"");if(function(t){return"string"==typeof t.err}(r))return console.error(r.err);en(t,r)}(t,e);r&&Br.of(r).fmap(Kr).fmap(Gr).fmap(t=>fetch(t)).fmap(e=>e.then(t=>Promise.all([t.status,t.json()])).then(([e,r])=>200==e?en(t,r):rn(t,r)))}function en(t,e){return t.emit("ovp:media:changed",e),function(t){return Array.isArray(t.playlist)}(e)?function(t,e){if("function"!=typeof window.flowplayer.playlist)return console.warn("OVP responded with Playlist media but the playlist plugin does not exist"),rn(t,{status:415});t.emit("ovp:request:playlist:complete",function(t,e){const r=Object.assign({},t),n=(null==t?void 0:t.playlist)||{},i=Ur(e,n),a=((null==i?void 0:i.playlist)||[]).map(t=>qr(t,r));return Object.assign(i,{playlist:a})}(t.opts,e))}(t,e):Zr(e)?function(t,e){var r,n;const i=(null===(r=null==e?void 0:e.metadata)||void 0===r?void 0:r.live_start_time)||(null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.starttime);i&&(e.live_start_time=Br.of(i).fmap(Jr).unwrap());t.emit("ovp:live:countdown:start",Br.of(e).fmap(qr,t.opts).fmap(Wr).unwrap())}(t,e):function(t,e){t.emit("ovp:request:media:complete",Br.of(e).fmap(qr,t.opts).fmap(Wr).unwrap())}(t,e)}function rn(t,e){return e.message?t.emit("ovp:error",e):e.status?t.emit("ovp:error",new Error(Vr[e.status])):t.emit("ovp:error",e)}const nn={};function an(t,e,r){"object"!=typeof nn[e]&&(nn[e]=r);const n=t.opts,i=(null==n?void 0:n.metadata)||{};i.player_id=e,n.metadata=i,r.title&&delete r.title,r.description&&delete r.description;const a=Object.assign(n,r);t.setOpts(a),r.autoplay&&t.togglePlay(!0)}let sn=!1;function on(t,e,r){un()||Br.of("recommendation").fmap(Gr,e,r).fmap(jr).fmap(e=>e.then(e=>function(t,e){const r=e.playlist;if(t.opts.recommendations=r,!r.length)return;t.emit("recommendationsready",{playlist:r.map((function(t){var e;return{poster:t.poster,src:t.src,title:null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.title,metadata:t.metadata||{}}}))})}(t,e)).catch(ln))}function un(){return sn}function ln(t){sn=!0,console.error("Failed to load recommendations: %j",t)}class cn{constructor(t){this.manualDisconnect=!1,this.video=t,this.onClose=this.onClose.bind(this),this.onMessage=this.onMessage.bind(this)}static of(t){return new cn(t)}connect(t){this.client=new WebSocket("wss://player.ws.flowplayer.com?mediaId="+t),this.current_media_id=t,this.wireup()}onClose(){this.manualDisconnect?this.manualDisconnect=!1:this.current_media_id&&this.reconnect(this.current_media_id)}onMessage(t){JSON.parse(t.data).forEach(t=>{this.video.emit("ovp:message:realtime",t)})}reconnect(t){this.cleanup(),this.connect(t)}wireup(){this.client&&(this.client.addEventListener("message",this.onMessage),this.client.addEventListener("close",this.onClose))}cleanup(){this.client&&(this.client.removeEventListener("message",this.onMessage),this.client.removeEventListener("close",this.onClose),this.client=void 0)}disconnect(){this.client&&(this.manualDisconnect=!0,this.client.close())}}class dn{onload(t,e,r,n){if("string"==typeof n.src)return"string"!=typeof t.player_id||0===n.src.indexOf(t.player_id)||zr(n)||(n.src=[t.player_id,n.src].join("/")),tn(r,n)}wants(t,e,r){return Xr(t,e)}init(t,e,r){const i=new cn(r);let a=Object.assign({},t);const s=function(t){if(!a)return t;delete a.src;const e=Ur(t,a);return a=!1,e};r.on("ovp:error",(function(t){r.emit(n,t.data)})),r.on("ovp:request:start",(function(){r.setState(k,!0),t.recommendations&&(t.recommendations=!1)})),r.on("ovp:media:changed",(function({data:t}){var e;const r=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.media_id;(null==t?void 0:t.live)&&r&&(i.disconnect(),i.connect(r))})),r.on("ovp:message:realtime",(function({data:e}){var n;const i=null==e?void 0:e.event,a=null==e?void 0:e.value,s=r.opt("metadata",{live_start_time:""});switch(i){case"METADATA":{const e=Object.assign(s,a),i=Object.assign(t,{metadata:e});i.live&&(null===(n=null==i?void 0:i.metadata)||void 0===n?void 0:n.live_start_time)&&(i.live_start_time=Jr(i.metadata.live_start_time)),r.setOpts(i);break}}})),r.on("beforeplay",(function(e){const r=t;if(Zr(r)){if(fn(r))return;e.preventDefault()}})),r.on("ovp:request:media:complete",(function(t){const e=t.data;if(!e)return;if(0==r.reaper||"object"!=typeof t.data||function(t){return t&&t.live_start_time&&t.live_start_time-Date.now()>0}(t.data))return;const n=s(e);r.setOpts(n),n.src&&r.setSrc(n.src),n.autoplay&&r.togglePlay(!0)})),r.on(g,(function({data:n}){var i;const a=null==n?void 0:n.brand_color;if(a&&function(t,e){t.style.setProperty("--fp-brand-color",e)}(e,a),!("string"==typeof t.src&&Xr(t.src,{})||t.src&&hn(t.src)))return"string"==typeof t.player_id&&(null===(i=null==t?void 0:t.metadata)||void 0===i?void 0:i.player_id)!==t.player_id?function(t,e){if("object"==typeof nn[e])return console.debug("using Cache(%s)",e),an(t,e,nn[e]);Br.of(e).fmap(Gr).fmap(jr).fmap(r=>r.then(r=>an(t,e,r)).catch(console.error))}(r,t.player_id):void 0})),r.on("ovp:request:playlist:complete",(function(t){const e=t.data;if(!e||0==r.reaper)return;const{playlist:n}=e,i=B(e,["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.render("live/countdown",[t,e,r])})),r.on("timeupdate",(function(){var e,n,i;const a=t;Zr(a)?fn(a)||(r.togglePlay(!1),r.emit("ended")):t.recommendations&&((null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.media_id)||Array.isArray(t.recommendations)||r.currentTime/r.duration<.8||un()||(null===(n=null==t?void 0:t.metadata)||void 0===n?void 0:n.media_id)&&(null===(i=null==t?void 0:t.metadata)||void 0===i?void 0:i.player_id)&&on(r,t.metadata.media_id,t.metadata.player_id))})),r.on(v,(function(){i.disconnect()}))}}function fn(t){var e,r;const n=null===(e=null==t?void 0:t.metadata)||void 0===e?void 0:e.live_stop_time;if(!n)return;return(null===(r=null==t?void 0:t.metadata)||void 0===r?void 0:r.allow_after_stop_time)?void 0:Jr(n)>Date.now()}dn.events=$r;const hn=t=>{var e;if(t&&Array.isArray(t))return"object"==typeof t[0]&&"ovp/base64"===(null===(e=t[0])||void 0===e?void 0:e.type)};vt(window,dn);
372
- /*! native-plugin.js / 1.15.2 / a9d7ab1a38c8f15915cf945951e7a499448c211e / 2021-08-05T12:35:30+03:00 / (c) Flowplayer AB */
373
- var pn=Pt(Mt((function(t,e){window,t.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=111)}([function(t,e,r){e.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(t,e,r){t.exports=r(82)},function(t,e){function r(t,e,r,n,i,a,s){try{var o=t[a](s),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(n,i)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(i,a){var s=t.apply(e,n);function o(t){r(s,i,a,o,u,"next",t)}function u(t){r(s,i,a,o,u,"throw",t)}o(void 0)}))}}},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e,r){var n=r(27);t.exports=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},i=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),i.forEach((function(e){n(t,e,r[e])}))}return t}},function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(e){return"function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?t.exports=n=function(t){return r(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":r(t)},n(e)}t.exports=n},function(t,e,r){var n,i,a,s;function o(t){return function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}s=function(){return function t(e,r,n){function i(s,o){if(!r[s]){if(!e[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:{}};e[s][0].call(l.exports,(function(t){return i(e[s][1][t]||t)}),l,l.exports,t,e,r,n)}return r[s].exports}for(var a=!1,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,r){var n=1e3,i=6e4,a=60*i,s=24*a;function o(t,e,r,n){var i=e>=1.5*r;return Math.round(t/r)+" "+n+(i?"s":"")}e.exports=function(t,e){e=e||{};var r,l,c=u(t);if("string"===c&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var e=/^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]);switch((e[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}}}}(t);if("number"===c&&!1===isNaN(t))return e.long?(r=t,(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(t){var e=Math.abs(t);return e>=s?Math.round(t/s)+"d":e>=a?Math.round(t/a)+"h":e>=i?Math.round(t/i)+"m":e>=n?Math.round(t/n)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},{}],2:[function(t,e,r){var n,i,a=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(t){n=s}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){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 t=u(h);d=!0;for(var e=c.length;e;){for(l=c,c=[];++f<e;)l&&l[f].run();f=-1,e=c.length}l=null,d=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function v(t,e){this.fun=t,this.array=e}function g(){}a.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new v(t,e)),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(t){return[]},a.binding=function(t){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(t){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],3:[function(t,e,r){e.exports=function(e){function r(t){for(var e=0,r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return n.colors[Math.abs(e)%n.colors.length]}function n(t){var e;function s(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];if(s.enabled){var a=s,o=Number(new Date),u=o-(e||o);a.diff=u,a.prev=e,a.curr=o,e=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(t,e){if("%%"===t)return t;l++;var i=n.formatters[e];if("function"==typeof i){var s=r[l];t=i.call(a,s),r.splice(l,1),l--}return t})),n.formatArgs.call(a,r);var c=a.log||n.log;c.apply(a,r)}}return s.namespace=t,s.enabled=n.enabled(t),s.useColors=n.useColors(),s.color=r(t),s.destroy=i,s.extend=a,"function"==typeof n.init&&n.init(s),n.instances.push(s),s}function i(){var t=n.instances.indexOf(this);return-1!==t&&(n.instances.splice(t,1),!0)}function a(t,e){var r=n(this.namespace+(void 0===e?":":e)+t);return r.log=this.log,r}function s(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(t){return t instanceof Error?t.stack||t.message:t},n.disable=function(){var t=[].concat(o(n.names.map(s)),o(n.skips.map(s).map((function(t){return"-"+t})))).join(",");return n.enable(""),t},n.enable=function(t){var e;n.save(t),n.names=[],n.skips=[];var r=("string"==typeof t?t:"").split(/[\s,]+/),i=r.length;for(e=0;e<i;e++)r[e]&&("-"===(t=r[e].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+t.substr(1)+"$")):n.names.push(new RegExp("^"+t+"$")));for(e=0;e<n.instances.length;e++){var a=n.instances[e];a.enabled=n.enabled(a.namespace)}},n.enabled=function(t){if("*"===t[t.length-1])return!0;var e,r;for(e=0,r=n.skips.length;e<r;e++)if(n.skips[e].test(t))return!1;for(e=0,r=n.names.length;e<r;e++)if(n.names[e].test(t))return!0;return!1},n.humanize=t("ms"),Object.keys(e).forEach((function(t){n[t]=e[t]})),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=r,n.enable(n.load()),n}},{ms:1}],4:[function(t,e,r){(function(n){r.log=function(){var t;return"object"===("undefined"==typeof console?"undefined":u(console))&&console.log&&(t=console).log.apply(t,arguments)},r.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),this.useColors){var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(function(t){"%%"!==t&&(n++,"%c"===t&&(i=n))})),t.splice(i,0,r)}},r.save=function(t){try{t?r.storage.setItem("debug",t):r.storage.removeItem("debug")}catch(t){}},r.load=function(){var t;try{t=r.storage.getItem("debug")}catch(t){}return!t&&void 0!==n&&"env"in n&&(t=n.env.DEBUG),t},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(t){}}(),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"],e.exports=t("./common")(r),e.exports.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,t("_process"))},{"./common":3,_process:2}]},{},[4])(4)},"object"===u(e)&&void 0!==t?t.exports=s():(i=[],void 0===(a="function"==typeof(n=s)?n.apply(e,i):n)||(t.exports=a))},function(t,e){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},r(e)}t.exports=r},function(t,e,r){r.d(e,"a",(function(){return o}));var n=r(4),i=r.n(n),a=r(3),s=r.n(a),o=function(){function t(e,r){i()(this,t),this._nextIndex=0,this._postroll=0,this._loadPending=!1,this._opts=r||{},this.reset(e)}return s()(t,null,[{key:"of",value:function(e,r){return new t(e,r)}}]),s()(t,[{key:"toJSON",value:function(){var t=(this._ads||[]).slice(this._nextIndex);return this._postroll&&t.push(this._postroll),t}},{key:"reset",value:function(t){this.setAds(t),this._nextIndex=0,this._postrollActive=!1}},{key:"resetCounter",value:function(){this._nextIndex=0,this._postrollActive=!1}},{key:"setAds",value:function(t){this._ads=t||[],this.sort()}},{key:"getAds",value:function(){return this._ads}},{key:"getNextAd",value:function(t){return this._ads[this._nextIndex]||t}},{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(t){this._opts.content_duration=t}},{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()&&t.kindOf(this.getCurrentAd().time)}},{key:"sort",value:function(){var t=this;this._postroll=this._ads.filter((function(t){return-1===t.time}))[0],this._ads=this._ads.filter((function(e){return e!==t._postroll})).sort((function(e,r){return e.time===r.time?t._ads.indexOf(e)-t._ads.indexOf(r):e.time-r.time}))}},{key:"shallPlayAd",value:function(t){if(this._loadPending)return!1;var e=this.getCurrentAd()||this.getNextAd();return!!(e&&e.time<=t&&-1!==e.time)}},{key:"shallPlayNext",value:function(){var t=this.getNextAd(),e=this.getCurrentAd();return!(!t||!e||t.time!==e.time)}},{key:"waitForLoad",value:function(t,e,r){if(this._loadPending=!1,!e)return!1;var n=r?this._opts.preload_advance:0;return e.time>=0?this._loadPending=t<e.time-n:-1===e.time&&(this._loadPending=this._opts.content_duration>0&&-1!==t?t<this._opts.content_duration-n:-1!==t),this._loadPending}}],[{key:"hasPreroll",value:function(t){return!!t.find((function(t){return 0===t.time}))}},{key:"isOutstream",value:function(e){return t.hasPreroll(e)&&!!e[0].outstream}},{key:"kindOf",value:function(t){switch(t){case 0:return"preroll";case-1:return"postroll";default:return"midroll"}}}]),t}()},function(t,e){var r=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=r)},function(t,e,r){var n=r(6),i=r(16);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?i(t):e}},function(t,e,r){var n=r(52);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}},function(t,e){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,e,r){var n=r(13),i=r(10),a=r(21),s=r(61),o=r(33),u=function(t,e,r){var l,c,d,f,h=t&u.F,p=t&u.G,v=t&u.S,g=t&u.P,m=t&u.B,y=p?n:v?n[e]||(n[e]={}):(n[e]||{}).prototype,E=p?i:i[e]||(i[e]={}),T=E.prototype||(E.prototype={});for(l in p&&(r=e),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,t&u.U),E[l]!=d&&a(E,l,f),g&&T[l]!=d&&(T[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,t.exports=u},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e,r){var n=r(85),i=r(86),a=r(87);t.exports=function(t,e){return n(t)||i(t,e)||a()}},function(t,e,r){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r=function(t,e){var r,n,i,a=t[1]||"",s=t[3];if(!s)return a;if(e&&"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(t){return"/*# sourceURL=".concat(s.sourceRoot).concat(t," */")}));return[a].concat(u).concat([o]).join("\n")}return[a].join("\n")}(e,t);return e[2]?"@media ".concat(e[2],"{").concat(r,"}"):r})).join("")},e.i=function(t,r){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},i=0;i<this.length;i++){var a=this[i][0];null!=a&&(n[a]=!0)}for(var s=0;s<t.length;s++){var o=t[s];null!=o[0]&&n[o[0]]||(r&&!o[2]?o[2]=r:r&&(o[2]="(".concat(o[2],") and (").concat(r,")")),e.push(o))}},e}},function(t,e,r){var n,i={},a=function(){var t={};return function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}t[e]=r}return t[e]}}();function s(t,e){for(var r=[],n={},i=0;i<t.length;i++){var a=t[i],s=e.base?a[0]+e.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(t,e){for(var r=0;r<t.length;r++){var n=t[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],e))}else{for(var o=[];s<n.parts.length;s++)o.push(v(n.parts[s],e));i[n.id]={id:n.id,refs:1,parts:o}}}}function u(t){var e=document.createElement("style");if(void 0===t.attributes.nonce){var n=r.nc;n&&(t.attributes.nonce=n)}if(Object.keys(t.attributes).forEach((function(r){e.setAttribute(r,t.attributes[r])})),"function"==typeof t.insert)t.insert(e);else{var i=a(t.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(e)}return e}var l,c=(l=[],function(t,e){return l[t]=e,l.filter(Boolean).join("\n")});function d(t,e,r,n){var i=r?"":n.css;if(t.styleSheet)t.styleSheet.cssText=c(e,i);else{var a=document.createTextNode(i),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(a,s[e]):t.appendChild(a)}}function f(t,e,r){var n=r.css,i=r.media,a=r.sourceMap;if(i&&t.setAttribute("media",i),a&&btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var h=null,p=0;function v(t,e){var r,n,i;if(e.singleton){var a=p++;r=h||(h=u(e)),n=d.bind(null,r,a,!1),i=d.bind(null,r,a,!0)}else r=u(e),n=f.bind(null,r,e),i=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(r)};return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else i()}}t.exports=function(t,e){(e=e||{}).attributes="object"==typeof e.attributes?e.attributes:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=(void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n));var r=s(t,e);return o(r,e),function(t){for(var n=[],a=0;a<r.length;a++){var u=r[a],l=i[u.id];l&&(l.refs--,n.push(l))}t&&o(s(t,e),e);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(t,e,r){r.d(e,"b",(function(){return U})),r.d(e,"a",(function(){return N}));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 t(){s()(this,t),this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return u()(t,null,[{key:"of",value:function(){return new t}},{key:"is_empty",value:function(t){return 0==t.pending.size}},{key:"is_high_water",value:function(e){return e.open.size==t.MAX_OPEN_REQUESTS}},{key:"maybe_spawn_req",value:function(e){if(t.is_empty(e))return v.ok("maybe_spawn_req called Queue that is EMPTY"),e;if(t.is_high_water(e))return v.warn("maybe_spawn_req called on Queue that is HIGH_WATER"),e;try{t.request(e,t.lpop(e))}catch(t){v.err(t)}}},{key:"increment_failures",value:function(e){return e.stats.failures++,e.stats.failures>t.MAX_FAILURE_COUNT&&(e.stats.ttl=Date.now()+t.REQUEST_TTL_MS),e}},{key:"handle_error",value:function(e,r){t.rm(e,r),t.increment_failures(e)}},{key:"request",value:function(e,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,e.stats),Date.now()<e.stats.ttl)return v.warn("Request[".concat(s.event_type,"] skipping because too many errors too quickly"),e.stats);var o=new XMLHttpRequest;e.open.push(o),o.timeout=t.REQUEST_TIMEOUT_MS,o.ontimeout=function(){t.handle_error(e,o),v.warn("Request[".concat(s.event_type,"] timed out in ").concat(o.timeout,"ms"),e.stats)},o.onerror=function(r){t.handle_error(e,o),r&&v.err(r),v.warn("Request[".concat(s.event_type,"] encountered an Error"),o.responseText,e.stats)},o.onreadystatechange=function(){o.readyState==XMLHttpRequest.DONE&&t.rm(e,o),Math.floor(o.status/100)},o.onload=function(){t.rm(e,o),e.stats.failures&&e.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(t){v.err(t)}}},{key:"rpush",value:function(e){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(e.pending.length>=t.HIGH_WATER_PENDING)return v.warn("Too many open requests, skipping",e.stats);e.pending.push(r),t.maybe_spawn_req(e)})),e}},{key:"lpop",value:function(t){return t.pending.shift()}},{key:"rm",value:function(t,e){var r=t.open.lastIndexOf(e);return~r&&t.open.splice(r,1),t}}]),t}();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),T=r(7)("fpads:device"),_=y.a.parse(window.navigator.userAgent),b=_.platform,A=_.os,S=_.browser;T(_);var L=function(t){return t&&t.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 t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Object.assign.apply(Object,[{}].concat(e))},F=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Object.keys(t).filter((function(t){return~r.indexOf(t)})).reduce((function(e,r){return Object.assign(e,c()({},r,t[r]))}),{})},N=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s()(this,t),this.metadata=M(k,r.metadata||{}),this.emitter=e,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()(t,null,[{key:"of",value:function(e,r){return new t(e,r)}},{key:"ensure_required_keys",value:function(t,e){return t.required_keys.filter((function(t){return!(t in e)}))}},{key:"pluck_valid_keys",value:function(t,e){return F.apply(void 0,[e].concat(i()(t.valid_keys)))}},{key:"mergeMetadata",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.metadata=t.pluck_valid_keys(e,M(e.metadata,r,{player_version:window.flowplayer.version})),e}}]),u()(t,[{key:"wireup",value:function(){var e=this;e.events.forEach((function(r){e.emitter.on(r,(function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=M(e.metadata,{event_type:r},n),a=t.pluck_valid_keys(e,i),s=t.ensure_required_keys(e,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}}]),t}(),U=function(t){return N.of(t,{required_keys:C,optional_keys:I,events:O})}},function(t,e,r){var n=r(55),i=r(60);t.exports=r(22)?function(t,e,r){return n.f(t,e,i(1,r))}:function(t,e,r){return t[e]=r,t}},function(t,e,r){t.exports=!r(23)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var r=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+n).toString(36))}},function(t,e,r){var n=r(26),i=r(36);t.exports=function(t){return n(i(t))}},function(t,e,r){var n=r(35);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==n(t)?t.split(""):Object(t)}},function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},function(t,e,r){r(8);var n=r(84);function i(e,r,a){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=i=Reflect.get:t.exports=i=function(t,e,r){var i=n(t,e);if(i){var a=Object.getOwnPropertyDescriptor(i,e);return a.get?a.get.call(r):a.value}},i(e,r,a||e)}t.exports=i},function(t,e,r){var n,i="object"==typeof Reflect?Reflect:null,a=i&&"function"==typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(r,n){function i(){void 0!==a&&t.removeListener("error",a),r([].slice.call(arguments))}var a;"error"!==e&&(a=function(r){t.removeListener(e,i),n(r)},t.once("error",a)),t.once(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var u=10;function l(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function d(t,e,r,n){var i,a,s,o;if(l(r),void 0===(a=t._events)?(a=t._events=Object.create(null),t._eventsCount=0):(void 0!==a.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),a=t._events),s=a[e]),void 0===s)s=a[e]=r,++t._eventsCount;else if("function"==typeof s?s=a[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(t))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,o=u,console&&console.warn&&console.warn(o)}return t}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(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function p(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):g(i,i.length)}function v(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),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(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)a(u,this,e);else{var l=u.length,c=g(u,l);for(r=0;r<l;++r)a(c[r],this,e)}return!0},o.prototype.addListener=function(t,e){return d(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return d(this,t,e,!0)},o.prototype.once=function(t,e){return l(e),this.on(t,h(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return l(e),this.prependListener(t,h(this,t,e)),this},o.prototype.removeListener=function(t,e){var r,n,i,a,s;if(l(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,a=r.length-1;a>=0;a--)if(r[a]===e||r[a].listener===e){s=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,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[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),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(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},o.prototype.listeners=function(t){return p(this,t,!0)},o.prototype.rawListeners=function(t){return p(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):v.call(t,e)},o.prototype.listenerCount=v,o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(t,e,r){var n=r(88),i=r(89),a=r(45);t.exports={formats:a,parse:i,stringify:n}},function(t,e,r){r.d(e,"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(t){return Object.assign({muted:!1,timeout:250,inline:!1},t)}function l(t,e){var r=t.muted,n=t.timeout,i=t.inline,a=e(),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(t){u=s.play(),l=setTimeout((function(){c(!1,new Error("Timeout "+n+" ms has been reached"))}),n),c=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;clearTimeout(l),t({result:e,error:r})},void 0!==u?u.then((function(){return c(!0)})).catch((function(t){return c(!1,t)})):c(!0)}))}var c=function(t){return l(t=u(t),(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 t(){var e,r=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=!(r.length>0&&void 0!==r[0])||r[0],!d){t.next=3;break}return t.abrupt("return",d);case 3:return t.next=5,c({timeout:500,muted:e});case 5:return d=t.sent,t.abrupt("return",d);case 7:case"end":return t.stop()}}),t,this)})))).apply(this,arguments)}},function(t,e){var r={}.hasOwnProperty;t.exports=function(t,e){return r.call(t,e)}},function(t,e,r){var n=r(62);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,i){return t.call(e,r,n,i)}}return function(){return t.apply(e,arguments)}}},function(t,e,r){var n=r(64),i=r(69);t.exports=Object.keys||function(t){return n(t,i)}},function(t,e){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,r){var n=r(38),i=Math.min;t.exports=function(t){return t>0?i(n(t),9007199254740991):0}},function(t,e){var r=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:r)(t)}},function(t,e,r){var n=r(10),i=r(13),a=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(t.exports=function(t,e){return a[t]||(a[t]=void 0!==e?e:{})})("versions",[]).push({version:n.version,mode:r(68)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,r){var n=r(36);t.exports=function(t){return Object(n(t))}},function(t,e,r){var n=r(34),i=r(25),a=r(40).f;t.exports=function(t){return function(e){for(var r,s=i(e),o=n(s),u=o.length,l=0,c=[];u>l;)a.call(s,r=o[l++])&&c.push(t?[r,s[r]]:s[r]);return c}}},function(t,e,r){var n=r(39)("wks"),i=r(24),a=r(13).Symbol,s="function"==typeof a;(t.exports=function(t){return n[t]||(n[t]=s&&a[t]||(s?a:i)("Symbol."+t))}).store=n},function(t,e,r){var n=Object.prototype.hasOwnProperty,i=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),a=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},n=0;n<t.length;++n)void 0!==t[n]&&(r[n]=t[n]);return r};t.exports={arrayToObject:a,assign:function(t,e){return Object.keys(e).reduce((function(t,r){return t[r]=e[r],t}),t)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],n=0;n<e.length;++n)for(var i=e[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)&&(e.push({obj:a,prop:u}),r.push(l))}return function(t){for(var e;t.length;){var r=t.pop();if(e=r.obj[r.prop],Array.isArray(e)){for(var n=[],i=0;i<e.length;++i)void 0!==e[i]&&n.push(e[i]);r.obj[r.prop]=n}}return e}(e)},decode:function(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t}},encode:function(t){if(0===t.length)return t;for(var e="string"==typeof t?t:String(t),r="",n=0;n<e.length;++n){var a=e.charCodeAt(n);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?r+=e.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&e.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(t){return null!=t&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},merge:function t(e,r,i){if(!r)return e;if("object"!=typeof r){if(Array.isArray(e))e.push(r);else{if("object"!=typeof e)return[e,r];(i.plainObjects||i.allowPrototypes||!n.call(Object.prototype,r))&&(e[r]=!0)}return e}if("object"!=typeof e)return[e].concat(r);var s=e;return Array.isArray(e)&&!Array.isArray(r)&&(s=a(e,i)),Array.isArray(e)&&Array.isArray(r)?(r.forEach((function(r,a){n.call(e,a)?e[a]&&"object"==typeof e[a]?e[a]=t(e[a],r,i):e.push(r):e[a]=r})),e):Object.keys(r).reduce((function(e,a){var s=r[a];return n.call(e,a)?e[a]=t(e[a],s,i):e[a]=s,e}),s)}}},function(t,e,r){var n=String.prototype.replace,i=/%20/g;t.exports={default:"RFC3986",formatters:{RFC1738:function(t){return n.call(t,i,"+")},RFC3986:function(t){return t}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(t,e,r){r.d(e,"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(t,e,r){var n=r(90),i=r(91),a=r(92);t.exports=function(t){return n(t)||i(t)||a()}},function(t,e,r){t.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=90)}({17:function(t,e,r){e.__esModule=!0,e.default=void 0;var n=r(18),i=function(){function t(){}return t.getFirstMatch=function(t,e){var r=e.match(t);return r&&r.length>0&&r[1]||""},t.getSecondMatch=function(t,e){var r=e.match(t);return r&&r.length>1&&r[2]||""},t.matchAndReturnConst=function(t,e,r){if(t.test(e))return r},t.getWindowsVersionName=function(t){switch(t){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},t.getMacOSVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),10===e[0])switch(e[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},t.getAndroidVersionName=function(t){var e=t.split(".").splice(0,2).map((function(t){return parseInt(t,10)||0}));if(e.push(0),!(1===e[0]&&e[1]<5))return 1===e[0]&&e[1]<6?"Cupcake":1===e[0]&&e[1]>=6?"Donut":2===e[0]&&e[1]<2?"Eclair":2===e[0]&&2===e[1]?"Froyo":2===e[0]&&e[1]>2?"Gingerbread":3===e[0]?"Honeycomb":4===e[0]&&e[1]<1?"Ice Cream Sandwich":4===e[0]&&e[1]<4?"Jelly Bean":4===e[0]&&e[1]>=4?"KitKat":5===e[0]?"Lollipop":6===e[0]?"Marshmallow":7===e[0]?"Nougat":8===e[0]?"Oreo":9===e[0]?"Pie":void 0},t.getVersionPrecision=function(t){return t.split(".").length},t.compareVersions=function(e,r,n){void 0===n&&(n=!1);var i=t.getVersionPrecision(e),a=t.getVersionPrecision(r),s=Math.max(i,a),o=0,u=t.map([e,r],(function(e){var r=s-t.getVersionPrecision(e),n=e+new Array(r+1).join(".0");return t.map(n.split("."),(function(t){return new Array(20-t.length).join("0")+t})).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}},t.map=function(t,e){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(t,e);for(r=0;r<t.length;r+=1)n.push(e(t[r]));return n},t.getBrowserAlias=function(t){return n.BROWSER_ALIASES_MAP[t]},t.getBrowserTypeByAlias=function(t){return n.BROWSER_MAP[t]||""},t}();e.default=i,t.exports=e.default},18:function(t,e,r){e.__esModule=!0,e.ENGINE_MAP=e.OS_MAP=e.PLATFORMS_MAP=e.BROWSER_MAP=e.BROWSER_ALIASES_MAP=void 0,e.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"},e.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"},e.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},e.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"},e.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(t,e,r){e.__esModule=!0,e.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},a=r(18),s=function(){function t(){}var e;return t.getParser=function(t,e){if(void 0===e&&(e=!1),"string"!=typeof t)throw new Error("UserAgent should be a string");return new i.default(t,e)},t.parse=function(t){return new i.default(t).getResult()},(e=[{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(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t,e),t}();e.default=s,t.exports=e.default},91:function(t,e,r){e.__esModule=!0,e.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(t){return t&&t.__esModule?t:{default:t}}var l=function(){function t(t,e){if(void 0===e&&(e=!1),null==t||""===t)throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},!0!==e&&this.parse()}var e=t.prototype;return e.getUA=function(){return this._ua},e.test=function(t){return t.test(this._ua)},e.parseBrowser=function(){var t=this;this.parsedResult.browser={};var e=n.default.find((function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser},e.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},e.getBrowserName=function(t){return t?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},e.getBrowserVersion=function(){return this.getBrowser().version},e.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},e.parseOS=function(){var t=this;this.parsedResult.os={};var e=i.default.find((function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os},e.getOSName=function(t){var e=this.getOS().name;return t?String(e).toLowerCase()||"":e||""},e.getOSVersion=function(){return this.getOS().version},e.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},e.getPlatformType=function(t){void 0===t&&(t=!1);var e=this.getPlatform().type;return t?String(e).toLowerCase()||"":e||""},e.parsePlatform=function(){var t=this;this.parsedResult.platform={};var e=a.default.find((function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform},e.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},e.getEngineName=function(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},e.parseEngine=function(){var t=this;this.parsedResult.engine={};var e=s.default.find((function(e){if("function"==typeof e.test)return e.test(t);if(e.test instanceof Array)return e.test.some((function(e){return t.test(e)}));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine},e.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},e.getResult=function(){return Object.assign({},this.parsedResult)},e.satisfies=function(t){var e=this,r={},n=0,i={},a=0;if(Object.keys(t).forEach((function(e){var s=t[e];"string"==typeof s?(i[e]=s,a+=1):"object"==typeof s&&(r[e]=s,n+=1)})),n>0){var s=Object.keys(r),o=s.find((function(t){return e.isOS(t)}));if(o){var u=this.satisfies(r[o]);if(void 0!==u)return u}var l=s.find((function(t){return e.isPlatform(t)}));if(l){var c=this.satisfies(r[l]);if(void 0!==c)return c}}if(a>0){var d=Object.keys(i).find((function(t){return e.isBrowser(t,!0)}));if(void 0!==d)return this.compareVersion(i[d])}},e.isBrowser=function(t,e){void 0===e&&(e=!1);var r=this.getBrowserName().toLowerCase(),n=t.toLowerCase(),i=o.default.getBrowserTypeByAlias(n);return e&&i&&(n=i.toLowerCase()),n===r},e.compareVersion=function(t){var e=[0],r=t,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===t[0]||"<"===t[0]?(r=t.substr(1),"="===t[1]?(n=!0,r=t.substr(2)):e=[],">"===t[0]?e.push(1):e.push(-1)):"="===t[0]?r=t.substr(1):"~"===t[0]&&(n=!0,r=t.substr(1)),e.indexOf(o.default.compareVersions(i,r,n))>-1},e.isOS=function(t){return this.getOSName(!0)===String(t).toLowerCase()},e.isPlatform=function(t){return this.getPlatformType(!0)===String(t).toLowerCase()},e.isEngine=function(t){return this.getEngineName(!0)===String(t).toLowerCase()},e.is=function(t){return this.isBrowser(t)||this.isOS(t)||this.isPlatform(t)},e.some=function(t){var e=this;return void 0===t&&(t=[]),t.some((function(t){return e.is(t)}))},t}();e.default=l,t.exports=e.default},92:function(t,e,r){e.__esModule=!0,e.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(t){var e={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/opera/i],describe:function(t){var e={name:"Opera"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/opr\/|opios/i],describe:function(t){var e={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/SamsungBrowser/i],describe:function(t){var e={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Whale/i],describe:function(t){var e={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/MZBrowser/i],describe:function(t){var e={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/focus/i],describe:function(t){var e={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/swing/i],describe:function(t){var e={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/coast/i],describe:function(t){var e={name:"Opera Coast"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/yabrowser/i],describe:function(t){var e={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/ucbrowser/i],describe:function(t){var e={name:"UC Browser"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/Maxthon|mxios/i],describe:function(t){var e={name:"Maxthon"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/epiphany/i],describe:function(t){var e={name:"Epiphany"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/puffin/i],describe:function(t){var e={name:"Puffin"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sleipnir/i],describe:function(t){var e={name:"Sleipnir"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/k-meleon/i],describe:function(t){var e={name:"K-Meleon"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/micromessenger/i],describe:function(t){var e={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/qqbrowser/i],describe:function(t){var e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/msie|trident/i],describe:function(t){var e={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/\sedg\//i],describe:function(t){var e={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/edg([ea]|ios)/i],describe:function(t){var e={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/vivaldi/i],describe:function(t){var e={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/seamonkey/i],describe:function(t){var e={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/sailfish/i],describe:function(t){var e={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return r&&(e.version=r),e}},{test:[/silk/i],describe:function(t){var e={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/phantom/i],describe:function(t){var e={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/slimerjs/i],describe:function(t){var e={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e={name:"BlackBerry"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e={name:"WebOS Browser"},r=i.default.getFirstMatch(a,t)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/bada/i],describe:function(t){var e={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/tizen/i],describe:function(t){var e={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/qupzilla/i],describe:function(t){var e={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/firefox|iceweasel|fxios/i],describe:function(t){var e={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/chromium/i],describe:function(t){var e={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/chrome|crios|crmo/i],describe:function(t){var e={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/GSA/i],describe:function(t){var e={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:function(t){var e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe:function(t){var e={name:"Android Browser"},r=i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/playstation 4/i],describe:function(t){var e={name:"PlayStation 4"},r=i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/safari|applewebkit/i],describe:function(t){var e={name:"Safari"},r=i.default.getFirstMatch(a,t);return r&&(e.version=r),e}},{test:[/.*/i],describe:function(t){var e=-1!==t.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(e,t),version:i.default.getSecondMatch(e,t)}}}];e.default=s,t.exports=e.default},93:function(t,e,r){e.__esModule=!0,e.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=r(18),s=[{test:[/Roku\/DVP/],describe:function(t){var e=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:a.OS_MAP.Roku,version:e}}},{test:[/windows phone/i],describe:function(t){var e=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:a.OS_MAP.WindowsPhone,version:e}}},{test:[/windows/i],describe:function(t){var e=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),r=i.default.getWindowsVersionName(e);return{name:a.OS_MAP.Windows,version:e,versionName:r}}},{test:[/macintosh/i],describe:function(t){var e=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(e),n={name:a.OS_MAP.MacOS,version:e};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(t){var e=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:a.OS_MAP.iOS,version:e}}},{test:function(t){var e=!t.test(/like android/i),r=t.test(/android/i);return e&&r},describe:function(t){var e=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),r=i.default.getAndroidVersionName(e),n={name:a.OS_MAP.Android,version:e};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(t){var e=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),r={name:a.OS_MAP.WebOS};return e&&e.length&&(r.version=e),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(t){var e=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||i.default.getFirstMatch(/\bbb(\d+)/i,t);return{name:a.OS_MAP.BlackBerry,version:e}}},{test:[/bada/i],describe:function(t){var e=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:a.OS_MAP.Bada,version:e}}},{test:[/tizen/i],describe:function(t){var e=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:a.OS_MAP.Tizen,version:e}}},{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(t){var e=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:a.OS_MAP.PlayStation4,version:e}}}];e.default=s,t.exports=e.default},94:function(t,e,r){e.__esModule=!0,e.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(t){var e=i.default.getFirstMatch(/(can-l01)/i,t)&&"Nova",r={type:a.PLATFORMS_MAP.mobile,vendor:"Huawei"};return e&&(r.model=e),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(t){var e=t.test(/ipod|iphone/i),r=t.test(/like (ipod|iphone)/i);return e&&!r},describe:function(t){var e=i.default.getFirstMatch(/(ipod|iphone)/i,t);return{type:a.PLATFORMS_MAP.mobile,vendor:"Apple",model:e}}},{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(t){return"blackberry"===t.getBrowserName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(t){return"bada"===t.getBrowserName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(t){return"windows phone"===t.getBrowserName()},describe:function(){return{type:a.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(t){var e=Number(String(t.getOSVersion()).split(".")[0]);return"android"===t.getOSName(!0)&&e>=3},describe:function(){return{type:a.PLATFORMS_MAP.tablet}}},{test:function(t){return"android"===t.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.mobile}}},{test:function(t){return"macos"===t.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(t){return"windows"===t.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop}}},{test:function(t){return"linux"===t.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.desktop}}},{test:function(t){return"playstation 4"===t.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.tv}}},{test:function(t){return"roku"===t.getOSName(!0)},describe:function(){return{type:a.PLATFORMS_MAP.tv}}}];e.default=s,t.exports=e.default},95:function(t,e,r){e.__esModule=!0,e.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},a=r(18),s=[{test:function(t){return"microsoft edge"===t.getBrowserName(!0)},describe:function(t){if(/\sedg\//i.test(t))return{name:a.ENGINE_MAP.Blink};var e=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:a.ENGINE_MAP.EdgeHTML,version:e}}},{test:[/trident/i],describe:function(t){var e={name:a.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:function(t){return t.test(/presto/i)},describe:function(t){var e={name:a.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:function(t){var e=t.test(/gecko/i),r=t.test(/like gecko/i);return e&&!r},describe:function(t){var e={name:a.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:a.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(t){var e={name:a.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return r&&(e.version=r),e}}];e.default=s,t.exports=e.default}})},function(t){t.exports=JSON.parse('{"name":"@flowplayer/ads","version":"1.15.2","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.5.3","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(t,e,r){function n(t,e){var r=!1,n=function(){var n,i=(n=t.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&&e(i),r=i};return setTimeout(n),document.addEventListener("scroll",n),function(){return document.removeEventListener("scroll",n)}}r.d(e,"a",(function(){return n}))},function(t,e,r){r.d(e,"a",(function(){return at}));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),T=r.n(E),_=r(28),b=r.n(_),A=r(0),S=r(6),L=r.n(S),k=r(7)("fpads:timers"),w=-1,D=function(){function t(){c()(this,t),this.intervals={},this.timers={}}return f()(t,null,[{key:"of",value:function(){return new t}},{key:"id",value:function(){return++w}},{key:"createTimeout",value:function(e,r,n){var i=setTimeout((function(){delete e.timers[i],n()}),r);if(k("TimerRegistry.createTimeout() -> ".concat(i),e.timers),"object"==L()(i)){var a=t.id();return e.timers[a]=i,a}return e.timers[i]=i,i}},{key:"removeTimeout",value:function(t,e){return k("TimerRegistry.removeTimeout() -> ".concat(e),t.timers),clearTimeout(t.timers[e]),delete t.timers[e],t}},{key:"createInterval",value:function(e,r,n){var i=setInterval(n,r);if(k("TimerRegistry.createInterval() -> ".concat(i),e.intervals),"object"==L()(i)){var a=t.id();return e.intervals[a]=i,a}return e.intervals[i]=i,i}},{key:"removeInterval",value:function(t,e){return k("TimerRegistry.removeInterval() -> ".concat(e),t.intervals),clearInterval(t.intervals[e]),delete t.intervals[e],t}},{key:"empty",value:function(e){if(e)return k("TimerRegistry.empty()",Object.keys(e.timers),Object.keys(e.intervals)),Object.keys(e.intervals).forEach((function(r){return t.removeInterval(e,r)})),Object.keys(e.timers).forEach((function(r){return t.removeTimeout(e,r)})),e}}]),t}(),R=r(9),O=function(t,e){var r="".concat(t,"() not implemented by the adapter");if(e)throw new Error(r);console.warning(r)},C=function(){function t(){c()(this,t)}var e,r,n;return f()(t,[{key:"initialize",value:function(t){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 t(e,r){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:O("initAd",!0);case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"playAd",value:(r=s()(i.a.mark((function t(){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:O("playAd",!0);case 1:case"end":return t.stop()}}),t,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(t){O("volume",!1)}},{key:"contentComplete",value:(e=s()(i.a.mark((function t(){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:O("contentComplete",!1);case 1:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"onResize",value:function(t){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}}]),t}(),I=r(7)("fpads:adapter:base"),x=function(t){function e(t){var r;return c()(this,e),(r=p()(this,g()(e).call(this))).eventHandler=t,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()(e,t),f()(e,[{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 t(e){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(I("init",this._videoTag,e),this.opts=e,this._dimensions={width:e.width,height:e.height},this._prepared=!0,this._initialized||!this._videoTag){t.next=7;break}return t.next=7,this.initAdapter();case 7:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"setVideoTag",value:(n=s()(i.a.mark((function t(e){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._videoTag=e,this._initialized||!this._prepared){t.next=4;break}return t.next=4,this.initAdapter();case 4:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"initAdapter",value:(r=s()(i.a.mark((function t(){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return I("initAdapter",this.opts),t.prev=1,t.next=4,this.initialize(this.opts);case 4:this._initialized=!0,t.next=12;break;case 7:t.prev=7,t.t0=t.catch(1),I("initAdapter failed:",t.t0),this._prepared=!1,this.eventHandler.trigger(A.a.ADAPTER_INIT_FAILED);case 12:case"end":return t.stop()}}),t,this,[[1,7]])}))),function(){return r.apply(this,arguments)})},{key:"setIOSPlaysInline",value:function(t){I("setIOSPlaysInline",t),this._sharedVideoTag=!t,this.initialize(u()({},this.opts,{DisableCustomPlaybackForIOS10Plus:t}))}},{key:"resize",value:function(t){var e=t.width,r=t.height,n=t.linear,i=t.silent,a=t.resize_non_linear;!1===n&&(e+=10,r+=10),this._adLinear=void 0===n?this._adLinear:n,this.onResize({width:e,height:r,linear:this._adLinear,silent:i,resize_non_linear:a}),this._dimensions={width:e,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}}]),e}(C);function P(t){try{return t.getAdPodInfo().getPodIndex()}catch(t){return}}var M=r(7)("fpads:adapter:ima"),F=function(t){function e(t){var r;return c()(this,e),(r=p()(this,g()(e).call(this,t)))._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()(e,t),f()(e,[{key:"destroy",value:function(){b()(g()(e.prototype),"destroy",this).call(this),D.empty(this._timers),this._adHandlers&&this._adHandlers.forEach((function(t){return t()})),this._adHandlers=void 0,this._adDisplayContainer&&this._adDisplayContainer.destroy(),this._adDisplayContainer=void 0,this._adsLoader&&this._adsLoader.destroy(),this._adsLoader=void 0,this._adsManager&&this._adsManager.destroy(),this._adsManager=void 0}},{key:"stop",value:function(){b()(g()(e.prototype),"stop",this).call(this),this._adsManager&&this._adsManager.stop()}},{key:"initialize",value:function(t){var r=this,n=this.isAdPod(),i=this._adLoaded||n;this.cleanup();var a=this;this.opts=t,this._volumeLevel=t.volume;var s=google.ima.settings;t.NumRedirects=t.NumRedirects||t.redirects,Object.keys(t).forEach((function(e){void 0!==s["set".concat(e)]&&s["set".concat(e)](t[e])}));var o={VpaidMode:google.ima.ImaSdkSettings.VpaidMode.INSECURE,DisableCustomPlaybackForIOS10Plus:!0};Object.keys(o).filter((function(e){return void 0===t[e]})).forEach((function(t){return s["set".concat(t)](o[t])})),this._adDisplayContainer=new google.ima.AdDisplayContainer(t.container,this.videoTag),this._adDisplayContainer.initialize(),this._adsLoader=new google.ima.AdsLoader(this._adDisplayContainer),M("ima.initialise(:wait -> ADS_MANAGER_LOADED)",u()({},t,{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()({},t,{volume:r.videoTag.volume,muted:r.videoTag.muted}));var i=new google.ima.AdsRenderingSettings;M("ima.rendering(preload: %s)",!!t.preload_ads),i.useStyledNonLinearAds=!0,i.enablePreloading=!!t.preload_ads,"number"==typeof t.media_timeout&&(i.loadVideoTimeout=t.media_timeout),i.restoreCustomPlaybackStateOnAdBreakComplete=!t.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(t){a.debugEvent(t);var n=t.getAd();a._currentDuration=n.getDuration(),a._currentDisplayTs=Date.now(),r.emitWithAd(A.a.AD_STARTED,n),n.isLinear()&&e.pollRemaining({ima:a,adsManager:s})})),s.addEventListener(google.ima.AdEvent.Type.COMPLETE,(function(t){a.debugEvent(t),a.emitWithAd(A.a.AD_COMPLETED,t.getAd()),D.empty(r._timers)})),s.addEventListener(google.ima.AdEvent.Type.SKIPPED,(function(t){a.debugEvent(t),a.emitWithAd(A.a.AD_SKIPPED,t.getAd())})),s.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,(function(t){a.debugEvent(t),a.emitWithAd(A.a.AD_PAUSE_CONTENT,t.getAd())})),s.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,(function(t){a.debugEvent(t),a._started=!1,a._currentDisplayTs=0,a.eventHandler.trigger(A.a.AD_BREAK_COMPLETED)})),s.addEventListener(google.ima.AdEvent.Type.VOLUME_CHANGED,(function(t){M("IMA::volume(type: %s, event: %o)",t.type,t);var e=s.getVolume();a._volumeLevel=e,a.eventHandler.trigger(A.a.AD_VOLUME_CHANGED,e)}));var o=function(t){a._paused=t,a.eventHandler.trigger(t?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(t){M("IMA::volume(type: %s, event: %o)",t.type,t),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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"unknown";if(!this._adsManager)return M("ima::destroyManager(:skip, label: %s)",t);M("ima::destroyManager(:ok, label: %s)",t),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 t=this;return new Promise((function(e){M("ima.waitForAdsManager:",t._adsManager),t.once(t._adsLoader,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,(function(){setTimeout((function(){M("ima.waitForAdsManager(:ok)",t._adsManager),e(t._adsManager)}))}))}))}},{key:"initAd",value:(o=s()(i.a.mark((function t(e){var r,n=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:5e3,M("ima.initAd(adTag: ".concat(e,", timeout: ").concat(r,")")),t.prev=2,t.next=5,this.requestAd(e,r);case 5:this._adLoaded=!0,t.next=13;break;case 8:throw t.prev=8,t.t0=t.catch(2),M("ima.initAd:",t.t0),this._adLoaded=!1,t.t0;case 13:return t.prev=13,D.empty(this._timers),t.finish(13);case 16:case"end":return t.stop()}}),t,this,[[2,8,13,16]])}))),function(t){return o.apply(this,arguments)})},{key:"requestAd",value:(a=s()(i.a.mark((function t(e,r){var n,a,o,l,c,d,f,h,p,v=this;return i.a.wrap((function(t){for(;;)switch(t.prev=t.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:e,_volumeLevel:this._volumeLevel,manager:this._adsManager})),this.clearAdHandlers(),(h=new google.ima.AdsRequest).adTagUrl=e,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 t=s()(i.a.mark((function t(e,s){var o,u,l,d,h;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=function(){clearTimeout(l),e.apply(void 0,arguments)},u=function(){clearTimeout(l),s.apply(void 0,arguments)},v.once(v._adsLoader,google.ima.AdErrorEvent.Type.AD_ERROR,(function(t){v.emitError(A.a.AD_REQUEST_ERROR,t),u(new Error("Ad load failed"))})),l=setTimeout((function(){var t=new Error("Ad internal timeout reached");v.eventHandler.trigger(A.a.AD_TIMEOUT,t),s(t)}),1.5*(r+(v.opts.media_timeout||5e3))),t.next=6,n.waitForAdsManager();case 6:if(d=t.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]){t.next=12;break}return t.abrupt("return",o({ad:!1,adsManager:d}));case 12:v.once(d,google.ima.AdErrorEvent.Type.AD_ERROR,(function(t){v.emitError(A.a.AD_PLAYBACK_ERROR,t),u(t)})),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(t){v.eventHandler.trigger(A.a.AD_REQUEST_COMPLETED,{request_load_time:Date.now()-c}),a=t.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 t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}()),t.abrupt("return",p);case 23:case"end":return t.stop()}}),t,this)}))),function(t,e){return a.apply(this,arguments)})},{key:"playAd",value:(n=s()(i.a.mark((function t(){var e;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(M("ima.playAd()",this),this._adsManager&&this._adLoaded){t.next=3;break}return t.abrupt("return");case 3:if(e=this._adsManager.getCurrentAd()){t.next=6;break}return t.abrupt("return");case 6:if(!this.sharedVideoTag||e.isLinear()){t.next=8;break}return t.abrupt("return");case 8:return t.prev=8,t.next=11,this.startAndWaitForAdCompletion(this._adsManager,e.isLinear());case 11:t.next=17;break;case 13:throw t.prev=13,t.t0=t.catch(8),M("ima.playAd",t.t0),t.t0;case 17:return t.prev=17,this._adLoaded=!1,D.empty(this._timers),t.finish(17);case 21:case"end":return t.stop()}}),t,this,[[8,13,17,21]])}))),function(){return n.apply(this,arguments)})},{key:"startAndWaitForAdCompletion",value:function(t,r){var n=this;if(!this._started){M("ima.startAndWaitForAdCompletion(manager: %o)",{volume:t.getVolume()});var a=this;return new Promise((function(o,u){var l=!1;a.once(t,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(t,google.ima.AdErrorEvent.Type.AD_ERROR,function(){var t=s()(i.a.mark((function t(r){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return M("ima.startAndWaitForAdCompletion: beginning error recovery ->",r),l=!0,t.prev=2,t.next=5,e.pollForFatalError({err:r,ima:a});case 5:t.sent.ok&&(l=!1),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(2),a._started=!1,u(r);case 14:case"end":return t.stop()}}),t,this,[[2,10]])})));return function(e){return t.apply(this,arguments)}}()),r&&(n._started=!0),t.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(t){try{return arguments.length>0&&"number"==typeof t&&this._adsManager.setVolume(t),this._volumeLevel=this._adsManager.getVolume()}catch(t){M("ima.volume() failed (%o)",t)}}},{key:"onResize",value:function(t){var e=t.width,r=t.height,n=t.linear,i=t.silent,a=t.resize_non_linear;this.opts&&(e||r)&&(n&&(this.opts.width=e,this.opts.height=r),this._adsManager&&(n||a)&&(i||M("ima.onResize %s x %s",e,r),this._adsManager.resize(e,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 t(){var r=this;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(M("ima.contentComplete() -> ",this),this._adsLoader&&this._adsLoader.contentComplete(),this.cuepoints()&&-1!==this.cuepoints().indexOf(-1)){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,new Promise((function(t){e.race(r.eventHandler,[A.a.AD_BREAK_COMPLETED,A.a.AD_ERROR],t)}));case 6:case"end":return t.stop()}}),t,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(t){return null}}},{key:"canDismissNonLinear",value:function(){var t=this.currentAd();if(!t||t.isLinear()||!this._adsManager||!this._currentDisplayTs)return!0;var e=Date.now(),r=t.getMinSuggestedDuration();return e-this._currentDisplayTs>1e3*r}},{key:"once",value:function(t,e,r){this._adHandlers.push(function(t,e,r){var n=function n(i){r(i),t.removeEventListener(e,n)};return t.addEventListener(e,n),function(){return t.removeEventListener(e,n)}}(t,e,r))}},{key:"clearAdHandlers",value:function(){M("ima.clearAdHandlers"),this._adHandlers.forEach((function(t){return t()})),this._adHandlers=[]}},{key:"emitWithAd",value:function(t,e){var r={ad_type:R.a.kindOf(P(e)),ad:{duration:e.getDuration(),width:e.getWidth(),height:e.getHeight()},volume:this._adsManager.getVolume(),vast_ad_id:e.getAdId(),linear:e.isLinear(),mime_type:e.getContentType(),ima_event:!0};M("emitWithAd::event(name: ".concat(t,", data: %o, ad: %o)"),r,e),this.eventHandler.trigger(t,r)}},{key:"emitError",value:function(t,e){var r={vast_error_type:e.getError().getType(),reason:e.getError().getMessage(),vast_error:e.getError().getErrorCode()};M("ima.error(".concat(t,")"),r),this.eventHandler.trigger(t,r)}},{key:"debugEvent",value:function(t){try{var e=t.getAd();if(!e)return;M("ima.event.".concat(t.type," ->"),{event:t,data:t.getAdData(),position:P(e),ad:e})}catch(t){}}}],[{key:"unwrapError",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return"function"==typeof t.getMessage?t.getMessage():t.message?t.message:e}},{key:"pollForFatalError",value:function(t){var r,n=t.err,i=t.ima;try{var a=n.getError(),s=e.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(t,e){var n=setTimeout((function(){M("ima.pollForFatalError: Ad errored and not progressing, reject"),i.eventHandler&&i.eventHandler.trigger(A.a.AD_PLAYBACK_ERROR,r),e(new Error("Ad not progressing"))}),2500);i.eventHandler.once(A.a.AD_PROGRESS,(function(e){-1!==e.remaining&&e.remaining<o&&(M("ima.pollForFatalError: Ad still progressing even though errored, skip error rejection"),clearTimeout(n),t({ok:1}))}))}))}},{key:"pollRemaining",value:function(t){var e=t.ima,r=t.adsManager;return M("ima.pollRemaining"),D.createInterval(e._timers,250,(function(){e._currentRemaining=r.getRemainingTime(),e.eventHandler.trigger(A.a.AD_PROGRESS,{remaining:e._currentRemaining,duration:e._currentDuration})}))}},{key:"race",value:function(t,e,r){e.forEach((function(n){t.on(n,(function n(){e.forEach((function(e){return t.removeListener(e,n)}));for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];r(a)}))}))}}]),e}(x),N=function(){function t(){c()(this,t)}return f()(t,null,[{key:"create",value:function(t,e){return t.adapter?new t.adapter(e):new F(e)}}]),t}(),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 t(e,r){c()(this,t),this.vars=e,this.pattern=r}return f()(t,null,[{key:"of",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:V;return new t(e,r)}},{key:"run",value:function(t){try{return t()}catch(t){return void console.error(t)}}},{key:"merge",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.reduce((function(t,e){return Object.assign(t,e)}),{})}},{key:"cast",value:function(e){var r=L()(e);return"undefined"===r?"":("function"===r&&(e=t.run(e)),encodeURIComponent(e))}},{key:"normalize",value:function(t){return t.trim()}},{key:"process_obj",value:function(e,r,n){return Object.keys(e).reduce((function(i,a){var s=t.process_str(a,r,n,!0),o=e[a];return null===o?(i[s]=o,i):"object"==L()(o)?(i[s]=t.process_obj(o,r,n),i):"string"==typeof o?(i[s]=t.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(e,r,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return e.replace(r.pattern,(function(e,r){var a=t.normalize(r);if(!(a in n)||void 0===n[a])return e;var s=n[a],o=i?s:t.cast(s);return K("Macro.replace(raw: %s, macro: %s, value: %s)",i,r,o),o}))}}]),f()(t,[{key:"fork",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.pattern,n=t.merge(this.vars,e);return t.of(n,r)}},{key:"compile",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.merge(this.vars,r),i=e.split("?"),a=j()(i,2),s=a[0],o=a[1],u=H.a.parse(o||"",{strictNullHandling:!0,decoder:function(t){return t}}),l=H.a.stringify(t.process_obj(u,this,n),{encode:!1,strictNullHandling:!0});return t.process_str(s,this,n,!0)+"?"+l}}]),t}();function q(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{width:0,height:0};try{var i=document.createElement("a");i.href=e=window.location!=window.parent.location?document.referrer:document.location.href,r=i.hostname}catch(t){console.error(t)}var a=n.width,s=n.height,o=t||{},l=o.video_source,c="object"==L()(window.__flowplayerAdParameters)?window.__flowplayerAdParameters:{};return u()({random:Date.now(),page_url:e,domain:r,player_width:a,player_height:s,video_url:l,videourl:l},c)}function Y(t){return z.apply(this,arguments)}function z(){return(z=s()(i.a.mark((function t(e){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("function"==typeof e){t.next=2;break}return t.abrupt("return",e);case 2:return t.prev=2,t.next=5,e();case 5:return t.abrupt("return",t.sent);case 8:return t.prev=8,t.t0=t.catch(2),t.abrupt("return","");case 11:case"end":return t.stop()}}),t,this,[[2,8]])})))).apply(this,arguments)}function X(t){return Q.apply(this,arguments)}function Q(){return(Q=s()(i.a.mark((function t(e){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=L()(e),t.next="function"===t.t0||"string"===t.t0?3:"object"===t.t0?7:8;break;case 3:return t.next=5,Y(e);case 5:return t.t1=t.sent,t.abrupt("return",[t.t1]);case 7:return t.abrupt("return",Array.isArray(e)?Promise.all(e.map(Y)):X(e.adTag||[]));case 8:throw new Error("\n unhandled ads type ".concat(L()(e),":\n ").concat(JSON.stringify(e),"\n can be:\n | Array<string>\n | string\n | function\n | {adTag: Array<string>|string|function}\n "));case 9:case"end":return t.stop()}}),t,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 $(t){return null!==t&&"object"===L()(t)&&Z(t)===J}var tt=r(7)("fpads:ads:state"),et={IDLE:0,INITIALIZING:1,FETCHING_AD:2,AD_AVAILABLE:4,BREAK_ACTIVE:8,PLAYING:16,FATAL_ERROR:32},rt=function(){function t(){c()(this,t),this._state=0}return f()(t,null,[{key:"of",value:function(){return new t}}]),f()(t,[{key:"reset",value:function(){this._state=0}},{key:"toString",value:function(){var t=this;return 0==this._state?"AdState(None)":"AdState("+Object.keys(et).reduce((function(e,r){return t.hasAny(et[r])?e+r+": "+!!t.hasAny(et[r])+" ":e}),"").trim()+")"}},{key:"toggleState",value:function(t,e){return void 0===t&&tt(new Error("AdState cannot toggleState for `undefined`")),null==L()(e)?this._state^=t:e?void(this._state|=t):this._state&=~t}},{key:"hasAll",value:function(t){return this._state==(this._state|t)}},{key:"hasAny",value:function(t){return this._state&t}},{key:"state",get:function(){return this._state}}]),t}(),nt=r(7)("fpads:ads"),it={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10},at=function(t){function e(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return c()(this,e),(t=p()(this,g()(e).call(this))).adapter=N.create(r,T()(T()(t))),t.opts=u()({},it),t.analytics=void 0,t._state=rt.of(),t._schedule=void 0,t._lastAd=void 0,t._macros=W.of(r.parameters||{}),t.wireup(),t}var r,n,a,o,l,d,h,v;return y()(e,t),f()(e,[{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 t=this,e=function(){return t._state.toggleState(et.PLAYING,!0)};this.on(A.a.AD_PLAY_REQUESTED,e),this.on(A.a.AD_STARTED,e),this.on(A.a.AD_RESUMED,e);var r=function(){return t._state.toggleState(et.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(){t._state.toggleState(et.BREAK_ACTIVE,!1)})),this.on(A.a.ADAPTER_INIT_FAILED,(function(){console.error("Adapter init failed"),r(),t._state.toggleState(et.FATAL_ERROR,!0)})),this.on(A.a.RELOAD_AD_REQUESTED,function(){var e=s()(i.a.mark((function e(n){return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(nt("Ads.on(RELOAD_AD_REQUESTED)",n),r(),!n){e.next=4;break}return e.abrupt("return",t._schedule.reset(t._schedule.getAds()));case 4:t._state.hasAny(et.AD_AVAILABLE)&&(t._schedule.decrement(),t._state.toggleState(et.AD_AVAILABLE,!1));case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}())}},{key:"initialize",value:(v=s()(i.a.mark((function t(e){var r,n,a=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},n=a.length>2?a[2]:void 0,nt("Ads.initialize():",e,r,n),this._state.toggleState(et.INITIALIZING,!0),this.opts=Object.assign({},this.opts,r),Array.isArray(e)&&this.setSchedule(e),t.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()){t.next=12;break}return t.next=12,this.adapterInitialized(n);case 12:return t.abrupt("return",this);case 13:case"end":return t.stop()}}),t,this)}))),function(t){return v.apply(this,arguments)})},{key:"setVideoTag",value:(h=s()(i.a.mark((function t(e){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return nt("Ads.setVideoTag():",e),t.next=3,this.adapter.setVideoTag(e);case 3:if(this.trigger(A.a.AD_VIDEOTAG_ATTACHED,e),!this.adapter.isReady()){t.next=7;break}return t.next=7,this.adapterInitialized();case 7:case"end":return t.stop()}}),t,this)}))),function(t){return h.apply(this,arguments)})},{key:"waitForVideoTag",value:function(){var t=this;return new Promise((function(e){var r=t.adapter.videoTag;if(r)return e(r);t.on(A.a.AD_VIDEOTAG_ATTACHED,(function(r){t.once(A.a.AD_INIT,(function(){return e(r)}))}))}))}},{key:"adapterInitialized",value:(d=s()(i.a.mark((function t(e){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return nt("Ads.adapterInitialized()"),this._state.toggleState(et.INITIALIZING,!1),this._state.toggleState(et.BREAK_ACTIVE,this.hasPreroll()),t.next=5,this.setCurrentTime(0,e);case 5:this.checkIfBreakComplete(),e&&!this.opts.autoplay||this.trigger(A.a.AD_TEARDOWN);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return d.apply(this,arguments)})},{key:"fetchNextAd",value:(l=s()(i.a.mark((function t(e){var r,n,a=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=a.length>1&&void 0!==a[1]?a[1]:0,this.adapter.isReady()){t.next=3;break}return t.abrupt("return");case 3:if(!(r>50)){t.next=7;break}throw this._state.toggleState(et.FATAL_ERROR,!0),this._state.toggleState(et.FETCHING_AD,!1),new Error("Ads.fetchNextAd() :max_recursion_depth");case 7:if(!(n=this._schedule.getNextAd()||this._schedule.getPostroll())||this.adapter.canDismissNonLinear()||-1===e){t.next=10;break}return t.abrupt("return",!1);case 10:if(!this._schedule.waitForLoad(e,n,this.opts.preload_ads)){t.next=13;break}return this._state.toggleState(et.FETCHING_AD,!1),t.abrupt("return",!1);case 13:if(n===this._schedule.getPostroll()&&this._schedule.setPostrollActive(),this._schedule.isDrained()||this._schedule.increment(),n){t.next=18;break}return this._state.toggleState(et.FETCHING_AD,!1),t.abrupt("return",!1);case 18:return nt("Ads.fetchNextAd",n),this._state.toggleState(et.FETCHING_AD,!0),t.prev=20,t.next=23,this.requestAd(n);case 23:return this._state.toggleState(et.AD_AVAILABLE,!0),this._state.toggleState(et.FETCHING_AD,!1),t.abrupt("return",this);case 28:if(t.prev=28,t.t0=t.catch(20),nt("Ads.fetchNextAd(err: %o, ad: %o)",t.t0,n),this.setLastAd(n),n===this._schedule.getPostroll()){t.next=36;break}return t.next=35,this.fetchNextAd(e,++r);case 35:return t.abrupt("return",t.sent);case 36:case"end":return t.stop()}}),t,this,[[20,28]])}))),function(t){return l.apply(this,arguments)})},{key:"skipAdsOnSeek",value:function(t){for(var e=this._schedule.getNextAd();e&&e.time<t;)this._schedule.increment(),e=this._schedule.getNextAd()}},{key:"setCurrentTime",value:(o=s()(i.a.mark((function t(e,r){var n,a,s=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=s.length>2&&void 0!==s[2]&&s[2],this._schedule){t.next=3;break}return t.abrupt("return");case 3:if(this.adapter.isReady()){t.next=5;break}return t.abrupt("return");case 5:if(!this._state.hasAny(et.FETCHING_AD)){t.next=7;break}return t.abrupt("return");case 7:if(!this._state.hasAny(et.PLAYING)||!this.adapter.adLinear){t.next=9;break}return t.abrupt("return");case 9:if(a=0===e&&0===this._schedule.getNextIndex(),t.prev=10,n&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(e),this._state.hasAny(et.AD_AVAILABLE)){t.next=15;break}return t.next=15,this.fetchNextAd(e);case 15:if(this._state.hasAny(et.AD_AVAILABLE)&&this.shallPlayAd(e)&&!r){t.next=17;break}return t.abrupt("return");case 17:return t.next=19,this.playAd();case 19:return t.next=21,this.setCurrentTime(e);case 21:this.checkIfBreakComplete(),t.next=27;break;case 24:t.prev=24,t.t0=t.catch(10),nt("setCurrentTime: Error(from: setCurrentTime, message: %s)",t.t0.message);case 27:return t.prev=27,a&&this.trigger(A.a.AD_PREROLL_FINSIHED),t.finish(27);case 30:case"end":return t.stop()}}),t,this,[[10,24,27,30]])}))),function(t,e){return o.apply(this,arguments)})},{key:"playAd",value:(a=s()(i.a.mark((function t(){var e;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._state.hasAny(et.AD_AVAILABLE)){t.next=2;break}return t.abrupt("return");case 2:return this._state.toggleState(et.AD_AVAILABLE,!1),this._state.toggleState(et.BREAK_ACTIVE,!0),t.prev=4,e=this._schedule.getCurrentAd(),t.next=8,this.adapter.playAd();case 8:e&&this.setLastAd(e),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(4),console.error("Ads.playAd: error",t.t0);case 14:case"end":return t.stop()}}),t,this,[[4,11]])}))),function(){return a.apply(this,arguments)})},{key:"checkIfBreakComplete",value:function(){if(!this._state.hasAny(et.BREAK_ACTIVE))return nt("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());nt("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(et.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(t,e){if(!isNaN(e)&&this._schedule&&this._schedule.updateContentDuration(e),this._schedule&&this._schedule.getNextIndex()>0)return this._schedule.setAds(t);this._schedule=R.a.of(t,{preload_advance:this.opts.preload_advance,content_duration:isNaN(e)?0:e})}},{key:"toJSON",value:function(){return this._schedule?this._schedule.toJSON():[]}},{key:"trigger",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._state){if(t===A.a.AD_BREAK_COMPLETED&&this._state.hasAny(et.BREAK_ACTIVE)&&!this.adapter.isAdPod())return nt("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if($(e)&&(e=Object.assign({},this.adapter.opts||{},this._schedule.getCurrentAd()||{},{ad_type:this.ad_type},e)).ima_event&&"preroll"===e.ad_type&&(e.ad_type=this.ad_type),this.adapter.videoTag){var r=document.createEvent("Event");r.initEvent(t,!1,!1),r.data=e,this.adapter.videoTag.dispatchEvent(r)}U.EventEmitter.prototype.emit.apply(this,[t,e])}}},{key:"shouldRestartContent",value:function(){var t=this.getLastAd();return!t.outstream&&!1!==t.restart}},{key:"finished",value:(n=s()(i.a.mark((function t(e){return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(nt("Ads.finished"),!(this.adapter.sharedVideoTag&&this._state.hasAny(et.PLAYING)&&this.adapter.adLinear)){t.next=3;break}return t.abrupt("return");case 3:if(nt("Ads.finished: trying to play postroll"),t.prev=4,this._schedule.getPostroll()){t.next=10;break}return nt("Ads.finished: no postroll found"),t.next=9,this.adapter.contentComplete();case 9:return t.abrupt("return",t.sent);case 10:if(this._state.hasAny(et.AD_AVAILABLE)){t.next=13;break}return t.next=13,this.fetchNextAd(-1);case 13:return t.next=15,this.playAd();case 15:this.adapter.contentComplete(),t.next=21;break;case 18:t.prev=18,t.t0=t.catch(4),nt("Ads.finished: postroll failed:",t.t0);case 21:return t.prev=21,this.trigger(A.a.AD_POSTROLL_FINISHED),this.checkIfBreakComplete(),"function"==typeof e&&e(),t.finish(21);case 26:case"end":return t.stop()}}),t,this,[[4,18,21,26]])}))),function(t){return n.apply(this,arguments)})},{key:"hasPreroll",value:function(){return this._schedule&&R.a.hasPreroll(this._schedule.getAds())}},{key:"shallPlayAd",value:function(t){return(!this.adapter||!this.adapter.isAdPod())&&!(!this._state||this._state.hasAny(et.FATAL_ERROR))&&this._schedule.shallPlayAd(t)}},{key:"setLastAd",value:function(t){return this._lastAd=t,this}},{key:"getLastAd",value:function(){return this._lastAd||{}}},{key:"mergeMacros",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._macros=this._macros.fork(Object.assign({},t)),this}},{key:"pause",value:function(){this.adapter&&this.adapter.pause()}},{key:"resume",value:function(){this.adapter&&this.adapter.resume()}},{key:"resize",value:function(t){this.adapter&&this.adapter.resize(t)}},{key:"requestAd",value:(r=s()(i.a.mark((function t(e){var r,n,a,s,o,u=arguments;return i.a.wrap((function(t){for(;;)switch(t.prev=t.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){t.next=4;break}return t.abrupt("return");case 4:return nt("Ads.requestAd(ad: %o)",{ad:e,timeout:n,idx:r}),t.next=7,X(e);case 7:if(void 0!==(a=t.sent)[r]){t.next=10;break}return t.abrupt("return",Promise.reject(new Error("Ad failed, no fallbacks left")));case 10:if(a[r]){t.next=14;break}return t.next=13,this.requestAd(a,r+1,n);case 13:return t.abrupt("return",t.sent);case 14:return this.trigger(A.a.AD_REQUESTED,e),s=this._macros.compile(a[r],q(this.opts,this.adapter.dimensions)),t.prev=16,t.next=19,this.adapter.initAd(s,n);case 19:return o=t.sent,t.abrupt("return",{ok:o});case 23:return t.prev=23,t.t0=t.catch(16),nt("Ads.requestAd(:fallback, idx: ".concat(r,", length: ").concat(a.length,", adTag: ").concat(a[r],")\nError "),{adTag:a,err:t.t0}),t.abrupt("return",this.requestAd(a,r+1,n));case 27:case"end":return t.stop()}}),t,this,[[16,23]])}))),function(t){return r.apply(this,arguments)})},{key:"resetSchedule",value:function(t){this._schedule&&this._schedule.reset(t)}},{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(et.PLAYING)}},{key:"adBreak",get:function(){return this._state&&this._state.hasAny(et.BREAK_ACTIVE)}}]),e}(U.EventEmitter)},function(t,e){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(e,n)}t.exports=r},function(t,e,r){r(54),t.exports=r(10).Object.assign},function(t,e,r){var n=r(14);n(n.S+n.F,"Object",{assign:r(63)})},function(t,e,r){var n=r(56),i=r(57),a=r(59),s=Object.defineProperty;e.f=r(22)?Object.defineProperty:function(t,e,r){if(n(t),e=a(e,!0),n(r),i)try{return s(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t}},function(t,e,r){var n=r(15);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t,e,r){t.exports=!r(22)&&!r(23)((function(){return 7!=Object.defineProperty(r(58)("div"),"a",{get:function(){return 7}}).a}))},function(t,e,r){var n=r(15),i=r(13).document,a=n(i)&&n(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},function(t,e,r){var n=r(15);t.exports=function(t,e){if(!n(t))return t;var r,i;if(e&&"function"==typeof(r=t.toString)&&!n(i=r.call(t)))return i;if("function"==typeof(r=t.valueOf)&&!n(i=r.call(t)))return i;if(!e&&"function"==typeof(r=t.toString)&&!n(i=r.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,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(t){return o.call(t)},(t.exports=function(t,e,r,o){var l="function"==typeof r;l&&(a(r,"name")||i(r,"name",e)),t[e]!==r&&(l&&(a(r,s)||i(r,s,t[e]?""+t[e]:u.join(String(e)))),t===n?t[e]=r:o?t[e]?t[e]=r:i(t,e,r):(delete t[e],i(t,e,r)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[s]||o.call(this)}))},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,r){var n=r(34),i=r(70),a=r(40),s=r(41),o=r(26),u=Object.assign;t.exports=!u||r(23)((function(){var t={},e={},r=Symbol(),n="abcdefghijklmnopqrst";return t[r]=7,n.split("").forEach((function(t){e[t]=t})),7!=u({},t)[r]||Object.keys(u({},e)).join("")!=n}))?function(t,e){for(var r=s(t),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(t,e,r){var n=r(32),i=r(25),a=r(65)(!1),s=r(67)("IE_PROTO");t.exports=function(t,e){var r,o=i(t),u=0,l=[];for(r in o)r!=s&&n(o,r)&&l.push(r);for(;e.length>u;)n(o,r=e[u++])&&(~a(l,r)||l.push(r));return l}},function(t,e,r){var n=r(25),i=r(37),a=r(66);t.exports=function(t){return function(e,r,s){var o,u=n(e),l=i(u.length),c=a(s,l);if(t&&r!=r){for(;l>c;)if((o=u[c++])!=o)return!0}else for(;l>c;c++)if((t||c in u)&&u[c]===r)return t||c||0;return!t&&-1}}},function(t,e,r){var n=r(38),i=Math.max,a=Math.min;t.exports=function(t,e){return(t=n(t))<0?i(t+e,0):a(t,e)}},function(t,e,r){var n=r(39)("keys"),i=r(24);t.exports=function(t){return n[t]||(n[t]=i(t))}},function(t,e){t.exports=!1},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,r){r(72),t.exports=r(10).Object.values},function(t,e,r){var n=r(14),i=r(42)(!1);n(n.S,"Object",{values:function(t){return i(t)}})},function(t,e,r){r(74),t.exports=r(10).Object.entries},function(t,e,r){var n=r(14),i=r(42)(!0);n(n.S,"Object",{entries:function(t){return i(t)}})},function(t,e,r){r(76),t.exports=r(10).Array.find},function(t,e,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(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),r(81)("find")},function(t,e,r){var n=r(33),i=r(26),a=r(41),s=r(37),o=r(78);t.exports=function(t,e){var r=1==t,u=2==t,l=3==t,c=4==t,d=6==t,f=5==t||d,h=e||o;return function(e,o,p){for(var v,g,m=a(e),y=i(m),E=n(o,p,3),T=s(y.length),_=0,b=r?h(e,T):u?h(e,0):void 0;T>_;_++)if((f||_ in y)&&(g=E(v=y[_],_,m),t))if(r)b[_]=g;else if(g)switch(t){case 3:return!0;case 5:return v;case 6:return _;case 2:b.push(v)}else if(c)return!1;return d?-1:l||c?c:b}}},function(t,e,r){var n=r(79);t.exports=function(t,e){return new(n(t))(e)}},function(t,e,r){var n=r(15),i=r(80),a=r(43)("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),n(e)&&null===(e=e[a])&&(e=void 0)),void 0===e?Array:e}},function(t,e,r){var n=r(35);t.exports=Array.isArray||function(t){return"Array"==n(t)}},function(t,e,r){var n=r(43)("unscopables"),i=Array.prototype;null==i[n]&&r(21)(i,n,{}),t.exports=function(t){i[n][t]=!0}},function(t,e,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,t.exports=r(83),i)n.regeneratorRuntime=a;else try{delete n.regeneratorRuntime}catch(t){n.regeneratorRuntime=void 0}},function(t,e){!function(e){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 t,l=e.regeneratorRuntime;if(l)u&&(t.exports=l);else{(l=e.regeneratorRuntime=u?t.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(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},l.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,o in t||(t[o]="GeneratorFunction")),t.prototype=Object.create(p),t},l.awrap=function(t){return{__await:t}},T(_.prototype),_.prototype[s]=function(){return this},l.AsyncIterator=_,l.async=function(t,e,r,n){var i=new _(v(t,e,r,n));return l.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},T(p),p[o]="Generator",p[a]=function(){return this},p.toString=function(){return"[object Generator]"},l.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},l.values=k,L.prototype={constructor:L,reset:function(t){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),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return s.type="throw",s.arg=t,e.next=r,n&&(e.method="next",e.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(t,e){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"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=t,s.arg=e,a?(this.method="next",this.next=a.finallyLoc,c):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),c}}}function v(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),s=new L(n||[]);return a._invoke=function(t,e,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(t,e,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)}}}(t,r,s),a}function g(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function m(){}function y(){}function E(){}function T(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function _(t){var e;this._invoke=function(r,i){function a(){return new Promise((function(e,a){!function e(r,i,a,s){var o=g(t[r],t,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(t){e("next",t,a,s)}),(function(t){e("throw",t,a,s)})):Promise.resolve(l).then((function(t){u.value=t,a(u)}),(function(t){return e("throw",t,a,s)}))}s(o.arg)}(r,i,e,a)}))}return e=e?e.then(a,a):a()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var n=g(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,c;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};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(t,e,r){var n=r(8);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=n(t)););return t}},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var s,o=t[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!e||r.length!==e);n=!0);}catch(t){i=!0,a=t}finally{try{n||null==o.return||o.return()}finally{if(i)throw a}}return r}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e,r){var n=r(44),i=r(45),a={brackets:function(t){return t+"[]"},indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},s=Date.prototype.toISOString,o={delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,serializeDate:function(t){return s.call(t)},skipNulls:!1,strictNullHandling:!1},u=function t(e,r,i,a,s,u,l,c,d,f,h,p){var v=e;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 T=g[E];s&&null===v[T]||(m=Array.isArray(v)?m.concat(t(v[T],i(r,T),i,a,s,u,l,c,d,f,h,p)):m.concat(t(v[T],r+(d?"."+T:"["+T+"]"),i,a,s,u,l,c,d,f,h,p)))}return m};t.exports=function(t,e){var r=t,s=e?n.assign({},e):{};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,T=i.formatters[s.format];"function"==typeof s.filter?r=(E=s.filter)("",r):Array.isArray(s.filter)&&(y=E=s.filter);var _,b=[];if("object"!=typeof r||null===r)return"";_=s.arrayFormat in a?s.arrayFormat:"indices"in s?s.indices?"indices":"repeat":"indices";var A=a[_];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,T,m)))}var k=b.join(l),w=!0===s.addQueryPrefix?"?":"";return k.length>0?w+k:""}},function(t,e,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(t,e,r){if(t){var n=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,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(t,e,r){for(var n=e,i=t.length-1;i>=0;--i){var a,s=t[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,e,r)}};t.exports=function(t,e){var r=e?n.assign({},e):{};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,""===t||null==t)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof t?function(t,e){for(var r={},n=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,s=e.parameterLimit===1/0?void 0:e.parameterLimit,o=n.split(e.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=e.decoder(d,a.decoder),c=e.strictNullHandling?null:""):(l=e.decoder(d.slice(0,h),a.decoder),c=e.decoder(d.slice(h+1),a.decoder)),i.call(r,l)?r[l]=[].concat(r[l]).concat(c):r[l]=c}return r}(t,r):t,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(t,e){t.exports=function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}},function(t,e){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,e,r){var n=r(96);t.exports=function(t,e){if(null==t)return{};var r,i,a=n(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}},function(t,e,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(t){return!1}}function a(e,r,s){return i()?t.exports=a=Reflect.construct:t.exports=a=function(t,e,r){var i=[null];i.push.apply(i,e);var a=new(Function.bind.apply(t,i));return r&&n(a,r.prototype),a},a.apply(null,arguments)}t.exports=a},function(t,e,r){r.r(e),r.d(e,"default",(function(){return it}));var n={};r.r(n),r.d(n,"STICKY_CONTROLS",(function(){return _})),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),T=(r(97),r(99),r(101),r(103),r(0)),_=1,b=2,A=4,S=8,L=16,k=32,w=64;function D(t){var e=window.getComputedStyle(t);return"0"!==e.width&&"0"!==e.height&&"0"!==e.opacity&&"none"!==e.display&&"hidden"!==e.visibility}var R=function(){},O="function"==typeof requestAnimationFrame?requestAnimationFrame:setTimeout,C=[].forEach,I=r(7)("fpads:native:ui"),x="is-ad-showing",P="is-ad-linear",M="is-ad-nonlinear",F="ad-playing",N="no-fullscreen",U="ad-hide-first-frame",B=function(){function t(e){var r,n,i,a,s=this,o=e.root,u=e.content,l=e.config,c=e.initial,d=e.ads;v()(this,t),Object.assign(this,{root:o,content:u,initial:c,ads:d,config:l}),this.progress={percent:0},this.animation=(r=function(t){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 t=Date.now()-i;null===a&&(a=O((function(){a=null,r.apply(this,arguments),i=Date.now()}),n-t))}),d.ui=this,this.render().wireup(),u.on(flowplayer.events.REAP,(function(t){return s.destroy()}))}return m()(t,null,[{key:"of",value:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return E()(t,r)}},{key:"as_progress",value:function(t){var e=t.remaining,r=t.duration;return{percent:Math.min(100,Math.max(0,(r-e)/r*100))}}},{key:"clone",value:function(t,e,r){var n=e.querySelector(r);if(n){var i=flowplayer.mq(n.cloneNode(!0));return flowplayer.mq(i),t.appendChild(i),i}}}]),m()(t,[{key:"halt_animation",value:function(){return!this.progress_bar||0==this.content.reaper||!this.wrapper||!this.wrapper.hasClass(F)}},{key:"animate",value:function(){this.animation.running||function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];t.apply(void 0,r)}(this.animation)}},{key:"resize",value:function(t){if(t.linear)return this.toggle(a()({on:!0},t));I("UI.resize(): ",t),this.adContainer.css({width:t.width}),this.wrapper.css({height:t.height,marginTop:"-".concat(t.height+this.root.controls.clientHeight,"px")})}},{key:"set_progress_bar",value:function(t){this.progress_bar&&this.progress_bar.css("width","".concat(t,"%"))}},{key:"reset_styles",value:function(){var t=this;this.progress.percent=0,"height width marginLeft marginTop".split(" ").forEach((function(e){t.wrapper.style[e]="",t.adContainer.style[e]=""}));try{window.emit("resize")}catch(t){}}},{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.hasClass(x)}},{key:"hideFirstFrame",value:function(){return this.root.toggleClass(U,!0),this}},{key:"showFirstFrame",value:function(){return this.root.toggleClass(U,!1),this}},{key:"toggle",value:function(t){var e=t.on,r=t.linear;if(this.root)return I("UI.toggle(): ",arguments[0]),this.showFirstFrame(),e||this.reset(),r&&this.reset_styles(),this.root.toggleClass(x,e),this.root.toggleClass(P,e&&r),this.root.toggleClass(M,e&&!r),this}},{key:"addClass",value:function(){var t;this.wrapper&&(t=this.wrapper).addClass.apply(t,arguments)}},{key:"removeClass",value:function(){var t;this.wrapper&&(t=this.wrapper).removeClass.apply(t,arguments)}},{key:"render",value:function(){var e=this,r=flowplayer.mq,n=document.createDocumentFragment(),i=this,a=flowplayer.util.lens(this,"config.ima.flags",flowplayer.util.lens(this,"config.ima.ui",0));return this.wrapper=r.div("fp-ad-container"),this.ad_wrapper=r.div("fp-ad-wrapper"),this.adContainer=r.div("fp-ad"),this.controls=r.div("fp-ad-controls"),this.progress_wrapper=r.div("fp-ad-progress-wrapper"),this.progress_bar=r.div("fp-ad-progress fp-color"),this.waiting=t.clone(this.wrapper,this.root,".fp-wait"),this.play_btn=t.clone(this.controls,this.root,".fp-btns.fp-small-switch"),this.volume_btn=t.clone(this.controls,this.root,".fp-volumebtn"),this.volume_bar=t.clone(this.controls,this.root,".fp-volume"),this.fs_btn=t.clone(this.controls,this.root,".fp-secondary"),w&a&&(this.root.toggleClass("ad-volume-bar"),function(t,e){var r,n,i;if("grabbing"in t)return t;t.grabbing=!1,t.touching=!1;var a=e.onseek||R,s=e.onstart||R,o=e.onend||R,u=e.onmouse||R,l=e.ontouch||R,c=e.ontouchend||R,d=e.ctx;function f(e){r=t.offset().left,n=t.clientWidth;var i=(function(t){return"function"==typeof window.TouchEvent&&t instanceof TouchEvent}(e)?e.changedTouches[0].pageX:e.pageX)-r;return i>n&&(i=n),i<0&&(i=0),Math.round(i/n*100)}function h(e){var r=f(e);r!=i&&(a.call(d,r,t),i=r)}function p(t){if(t){var e="";return Array.prototype.forEach.call(t.classList,(function(t){e="."+t})),e}}t.addEventListener("touchstart",(function(e){e.target.closest(p(t))&&(t.touching=!0,D(t.parentElement)&&(e.preventDefault(),t.grabbing=!0,l(d,t),s(d,t),h(e)))})),t.addEventListener("touchmove",(function(e){e.target.closest(p(t))&&D(t.parentElement)&&t.touching&&(e.preventDefault(),h(e),u.call(d,f(e),t))})),t.addEventListener("touchend",(function(e){setTimeout((function(){t.touching=!1,console.debug("Touching to false")}),500),e.target.closest(p(t))&&D(t.parentElement)&&(e.preventDefault(),t.grabbing=!1,c(d,t),o(d,t),n=0)})),t.addEventListener("touchcancel",(function(){t.touching=!1,t.grabbing=!1,n=0})),t.addEventListener("mousedown",(function(e){t.touching||(document.addEventListener("mousemove",h),t.grabbing=!0,s.call(d,t),e.preventDefault(),h(e))})),t.addEventListener("mousemove",(function(e){t.touching||u.call(d,f(e),t)})),document.addEventListener("mouseup",(function(){t.touching||(document.removeEventListener("mousemove",h),t.grabbing=!1,o.call(d,t),n=0)}))}(this.volume_bar,{onseek:function(t){return e.maybe_adapter((function(e){return e.volume(t/100)}))}})),this.fs_btn&&(this.fs_btn.removeClass("fp-togglable"),C.call(this.fs_btn.childNodes,(function(t){"svg"==t.tagName.toLowerCase()||t.remove()}))),this.root.toggleClass("is-ad-controls-sticky",_&a),this.root.toggleClass("is-ad-attribution",S&a),this.root.toggleClass(N,b&a),flowplayer.support().ios&&this.content.one([T.a.AD_BREAK_COMPLETED,T.a.AD_REQUEST_ERROR,T.a.AD_STARTED],(function(t){e.root.toggleClass(N,b&a||t.type===T.a.AD_STARTED)})),!flowplayer.util.lens(this,"config.ima.indicator",!0)||A&a||(this.indicator=this.controls.prepend(r.div("ad-indicator")),this.indicator.addClass("fp-color-text")),k&a&&(this.remaining=r.div("fp-ad-remaining"),this.remaining.addClass("fp-color-text"),this.controls.prepend(this.remaining)),L&a&&(this.root.toggleClass("is-ad-choices",!0),this.ad_choices=r.div("fp-ad-choices").txt("AdChoices"),this.ad_choices.on("click",(function(t){t.preventDefault(),i.ads.pause(),window.open("https://adssettings.google.com","_blank")}))),this.ad_wrapper.append(this.adContainer),this.progress_wrapper.append(this.progress_bar),n.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(n),this}},{key:"ad_loading",value:function(t){I("ad_loading",t),this.wrapper&&this.wrapper.toggleClass("is-waiting",t)}},{key:"update_time_remaining",value:function(t){this.remaining&&this.remaining.txt(function(t){var e,r=Math.floor(t/60);return r+":"+(e=t-=60*r,(e=parseInt(e,10))>=10?e:"0"+e)}(t))}},{key:"update_ad_indicator",value:function(){if(this.indicator){var t=this.maybe_adapter((function(t){return t.getAdPodInfo()}));if(t){I("IMA -> ",t);var e=this.content._t("ads.indicator","ADS");this.indicator.txt("".concat(e," ").concat(t.getAdPosition()," / ").concat(t.getTotalAds()))}}}},{key:"wireup",value:function(){var e=this;this.ads.on(T.a.AD_REQUESTED,(function(t){e.ad_loading(!0)})),this.ads.on(T.a.AD_VOLUME_CHANGED,(function(t){I("Event(%s, level: %o)",T.a.AD_VOLUME_CHANGED,t),e.content.muted||(e.content.volume=t),e.adjust_volume_slider(t)})),this.ads.on(T.a.AD_STARTED,(function(t){e.playback_changed(!0),e.update_ad_indicator()})),this.ads.on(T.a.AD_COMPLETED,(function(t){e.set_progress_bar(0)})),this.ads.on(T.a.AD_PAUSED,(function(t){return e.playback_changed(!1)})),this.ads.on(T.a.AD_RESUMED,(function(t){return e.playback_changed(!0)})),this.ads.on(T.a.AD_PROGRESS,(function(r){e.update_time_remaining(r.remaining,r.duration),e.progress=t.as_progress(r)})),this.play_btn&&this.play_btn.on("click touchend",(function(t){return"touchend"==t.type&&t.preventDefault(),e.ads.paused?e.ads.resume():e.ads.pause()})),this.fs_btn&&this.fs_btn.on("click",(function(t){e.content.toggleFullScreen()})),this.volume_btn&&this.volume_btn.on("click",(function(){return e.maybe_adapter((function(t){e.content.muted=t.volume()>0,t.volume(e.content.muted?0:0==e.content.volume?.1:e.content.volume)}))}))}},{key:"adjust_volume_slider",value:function(t){if(this.volume_bar){var e=[].slice.call(this.volume_bar.querySelectorAll(".fp-tick")),r=Math.round(t*e.length);this.volume_bar.attr("aria-valuenow",t),e.slice(r).forEach((function(t){return t.classList.remove("fp-color")})),e.slice(0,r).forEach((function(t){return t.classList.add("fp-color")}))}}},{key:"playback_changed",value:function(t){this.ad_loading(!1),t&&this.animate(),this.wrapper.toggleClass(F,t),this.wrapper.toggleClass("ad-paused",!t),this.wrapper.toggleClass("ad-ui-disabled",this.maybe_adapter((function(t){return t.isUiDisabled()})))}},{key:"maybe_adapter",value:function(t){return this.ads&&this.ads.adapter?t(this.ads.adapter):0}},{key:"destroy",value:function(){this.ads.ui=this.root=this.content=this.config=this.wrapper=this.adContainer=0}}]),t}();function j(t){return{width:t.clientWidth,height:t.clientHeight}}function G(t,e,r){return"number"==typeof r&&(r+="px"),t.style.setProperty(e,r),t}r(7)("fpads:dom");var H=r(7)("fpads:plugin:native"),K={on:!0},V={on:!1},W=[T.a.AD_PLAYBACK_ERROR,T.a.AD_TEARDOWN,T.a.AD_BREAK_COMPLETED],q=function(){function t(){v()(this,t)}var e,r,n,i;return m()(t,null,[{key:"user_gesture",value:function(){return flowplayer.events.BEFORE_PLAY}},{key:"snapshot",value:function(t,e){return{muted:!(e||!t.muted),volume:t.volume}}},{key:"start_from_user_gesture",value:function(e){var r=e.content,n=e.ads,i=e.config,a=e.ui,s=e.state,o=e.initial,u=e.adContainer,l=e.ima,c=t.user_gesture();r.one(c,function(){var e=h()(d.a.mark((function e(c){return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.in_viewport||"touchend"!=c.type){e.next=2;break}return e.abrupt("return");case 2:if(n.shallPlayAd(0)){e.next=4;break}return e.abrupt("return");case 4:return!flowplayer.support().ios&&c.preventDefault(),t.add_time_listeners({ads:n,content:r,ui:a,state:s}),H("LifeCycle.user_gesture(:intercept) -> shallPlayAd(0: %s)",n.shallPlayAd(0)),i.muted=o.muted,e.next=10,t.start({ads:n,content:r,state:s,adContainer:u,ima:l,config:i});case 10:t.update_time({ads:n,content:r,ui:a});case 11:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}())}},{key:"init",value:(i=h()(d.a.mark((function e(r){var n,i,a,s,o,u,l,c,f,h,p,v,g;return d.a.wrap((function(e){for(;;)switch(e.prev=e.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=t.snapshot(a,u),c=flowplayer.util.lens,f=flowplayer,h=f.events,a.on(h.VOLUME_CHANGE,(function(){l.volume=a.volume,l.muted=a.muted})),p=B.of({ads:s,content:a,config:n,initial:l,root:a.root}),v=p.adContainer,g={listening:!1,preload:c(n,"ima.preload_ads",!1)},H("LifeCycle.initial()",{initial:l}),s.setVideoTag(a),!n.autoplay){e.next=19;break}return H("Trying to autoplay"),p.hideFirstFrame(),e.next=17,t.peek_content(a,u);case 17:e.sent?(H("Can autoplay, start ad"),a.opts.autoplay=!0,t.start({ads:s,content:a,state:g,adContainer:v,ima:o,config:n})):(H("cannot autoplay(audioRequired: %s), fallback to poster state",u),n.autoplay=!1,p.showFirstFrame(),a.setState("is-starting",!0));case 19:n.autoplay||s.hasPreroll()&&t.start_from_user_gesture({content:a,ads:s,config:n,ui:p,state:g,initial:l,adContainer:v,ima:o}),!n.autoplay&&s.hasPreroll()&&g.preload&&t.start({ads:s,content:a,state:g,adContainer:v,ima:o,config:n}),t.ui_listeners({config:n,root:i,content:a,ads:s,state:g,adContainer:v,ui:p,ima:o,initial:l}),a.on(h.SOURCE,(function(){a.one(h.BEFORE_PLAY,(function(){return s.resetScheduleCounter()}))}));case 23:case"end":return e.stop()}}),e,this)}))),function(t){return i.apply(this,arguments)})},{key:"start",value:(n=h()(d.a.mark((function t(e){var r,n,i,s,o,u,c,f,h,p,v,g,m,y;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.ads,n=e.content,i=e.adContainer,s=e.ima,o=e.state,u=e.config,c=void 0===u?{}:u,!o.started){t.next=3;break}return t.abrupt("return");case 3:return o.started=!0,f=flowplayer,h=f.support,p=flowplayer.util.lens,s.ads,v=l()(s,["ads"]),g=c.dimensions||j(n.root),m=p(c,"muted",n.muted),y=Object.assign(a()({container:i,volume:m?0:p(c,"volume",n.volume),muted:m,autoplay:p(c,"autoplay",!1),video_source:n.original_src,DisableCustomPlaybackForIOS10Plus:p(c,"fake_fullscreen",h().ios),preload_ads:p(c,"ima.preload_ads",!1)},v,g)),H("LifeCycle.start():",y,o),t.next=13,r.initialize(!1,y,o.preload);case 13:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"ui_listeners",value:function(e){var r=e.config,n=e.root,i=e.content,s=e.ads,o=e.initial,u=e.adContainer,l=e.state,c=e.ui,f=e.ima;H("LifeCycle.ui_listeners()");var p=flowplayer,v=p.events,g=p.states;i.one(v.PLAYING,function(){var e=h()(d.a.mark((function e(o){return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s){e.next=2;break}return e.abrupt("return");case 2:if(H("LifeCycle.ui_listeners() -> content started playing"),t.add_time_listeners({ads:s,content:i,ui:c,state:l}),s.shallPlayAd(0)&&s.adapter.adLinear){e.next=9;break}return H("LifeCycle.ui_listeners() -> no more preroll ads -> resume content"),e.next=8,t.start({ads:s,content:i,state:l,adContainer:u,ima:f,config:r});case 8:return e.abrupt("return",e.sent);case 9:return i.pause(),e.next=12,t.start({ads:s,content:i,state:l,adContainer:u,ima:f,config:r});case 12:if(s.shallPlayAd(0)&&s.adapter.adLinear){e.next=14;break}return e.abrupt("return");case 14:c.toggle(a()({},K,{linear:!0})),n.addClass(g.WAITING),t.update_time({ads:s,content:i,ui:c});case 17:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()),i.on([v.PORTRAIT,v.LANDSCAPE,v.RESIZE],(function(){if(s){var t=i.clientWidth||i.parentNode.clientWidth||n.clientWidth,e=i.clientHeight||i.parentNode.clientHeight||n.clientHeight;s.resize({height:e,width:t})}})),i.on(v.ENDED,(function(t){s&&(H("LifeCycle.ui_listeners(:%s, event: %o)",t.type,t.data),t.data&&t.data.from===s||(t.preventDefault(),s.finished((function(){i.emit(v.ENDED,{from:s})}))))})),s.on(T.a.AD_REQUESTED,(function(){n.classList.toggle(g.WAITING,!0)})),s.once(T.a.AD_STARTED,(function(){var t=flowplayer.events,e=flowplayer.util.lens;i.on([t.BEFORE_PLAY,t.BEFORE_PAUSE],(function(r){if(s.adBreak&&s.adapter.adLinear){r.preventDefault();var n=e(r,"data.forced",!1)?r.type===t.BEFORE_PLAY:!s.adPlaying;n&&s.paused&&s.resume(),n||s.paused||s.pause()}}))})),s.on(T.a.AD_STARTED,(function(t){var e=t.linear,r=t.ad;if(H("Ad[linear: ".concat(e,", currentTime: ").concat(i.currentTime,"] starting"),r),"preroll"==s.ad_type&&!e&&i.paused&&i.play(),"preroll"==s.ad_type&&e&&i.currentTime>0&&!i.opt("start_time")&&!i.opt("live")&&(H("Preroll[rewind: true]",i.currentTime),i.currentTime=0),s.resize({width:r.width,height:r.height,linear:e,resize_non_linear:!0}),c.resize({linear:e,resizeContainerAlso:!0,width:e?void 0:r.width,height:e?void 0:r.height}),n.removeClass(g.WAITING),c.toggle(a()({},K,{linear:e,ad:r})),!e)try{i.togglePlay(!0),i.volume=o.volume,i.muted=o.muted}catch(t){H(t)}})),s.on(T.a.AD_PAUSE_CONTENT,(function(){c.resize({linear:!0,resizeContainerAlso:!0,width:void 0,height:void 0})})),W.forEach((function(e){return s.on(e,(function(r){return t.teardown({root:n,content:i,ui:c,initial:o,err:r,event:e})}))}))}},{key:"add_time_listeners",value:function(e){var r=e.ads,n=e.content,i=e.ui,a=e.state,s=flowplayer.events;a.listening||(n.on([s.TIME_UPDATE,s.SEEKED,s.PLAYING,s.SEEKING],(function(e){r&&(r.adPlaying&&r.adapter.adLinear&&!r.adapter.sharedVideoTag&&!n.paused&&n.pause(),t.update_time({ads:r,content:n,ui:i,seek:e.type===s.SEEKING}))})),a.listening=!0)}},{key:"update_time",value:function(t){var e=t.ads,r=t.content,n=t.seek,i=void 0!==n&&n;e&&e.setCurrentTime(r.currentTime,void 0,i)}},{key:"teardown",value:(r=h()(d.a.mark((function e(r){var n,i,a,s,o,u,l,c,f,h;return d.a.wrap((function(e){for(;;)switch(e.prev=e.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){e.next=3;break}return e.abrupt("return",{noop:1});case 3:if(l=flowplayer,c=l.states,n.addClass("is-seamless"),a.removeClass("is-vpaid"),n.removeClass(c.WAITING),H("LifeCycle.teardown(event: %s)",s),u.reason&&H("LifeCycle.teardown(:err, reason: %s) %o",u.reason),a.toggle(V),f=i.ads,h=f.getLastAd(),f.shouldRestartContent()){e.next=15;break}return H("Lifecycle.teardown(:skip_restart, reason: %s)","Ad prevented restarting content"),e.abrupt("return",t.on_content_playing(n));case 15:if(!(i.currentTime>0&&i.currentTime>=i.duration||"postroll"==f.ad_type||!1===h.restart)){e.next=18;break}return H("Lifecycle.teardown(:skip_restart, reason: %s)","was a postroll ad"),e.abrupt("return",t.on_content_playing(n));case 18:if(""===i.currentSrc&&i.setSrc(i.original_src),!i.paused||!f.shouldRestartContent()){e.next=23;break}return H("Lifecycle.teardown(:toggle_play, %s)","attempting to restart content"),e.next=23,i.togglePlay(!0);case 23:if(i.paused){e.next=26;break}return H("Lifecycle.teardown(:ok)","restarted video content"),e.abrupt("return",t.on_content_playing(n));case 26:case"end":return e.stop()}}),e,this)}))),function(t){return r.apply(this,arguments)})},{key:"on_content_playing",value:function(t){t.removeClass("is-seamless")}},{key:"maybe_blocked",value:function(t){H("google.ima not found in window"),[].slice.call(document.getElementsByTagName("script")).filter((function(t){return e=t.src,(r=document.createElement("a")).href=e,"imasdk.googleapis.com/js/sdkloader/ima3.js"=="".concat(r.host).concat(r.pathname);var e,r})).length>0&&t.emit(T.a.AD_BLOCKED)}},{key:"peek_content",value:(e=h()(d.a.mark((function e(r,n){var i,a,s,o,u,l;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[r.muted,r.volume],H("LifeCycle::peek_content(:muted => %s, :volume => %s)",a=i[0],s=i[1]),o=function(){return new Promise((function(t){return setTimeout(t,0,!1)}))},u=function(){return new Promise((function(t){return setTimeout((function(){return t(r.play())}))}))},l=function(){return new Promise((function(t){return setTimeout((function(){return t(r.pause())}))}))},n&&(r.muted=!1,r.volume=r.volume?r.volume:1),e.prev=6,e.next=9,t.wait_for_source(r);case 9:return r.volume&&(r.volume=.01),H("LifeCycle::peek_content::play"),e.next=13,u();case 13:return H("LifeCycle::peek_content::pause"),e.next=16,l();case 16:return r.volume=s,H("LifeCycle::peek_content::true"),e.abrupt("return",!0);case 21:if(e.prev=21,e.t0=e.catch(6),r.volume=s,!n){e.next=30;break}return r.muted=!1,0==r.volume&&(r.volume=1),e.next=29,o();case 29:return e.abrupt("return",e.sent);case 30:if(!a&&s){e.next=35;break}return H("LifeCycle::peek_content::false"),e.next=34,o();case 34:return e.abrupt("return",e.sent);case 35:return H("LifeCycle::peek_content::recover"),r.muted=!0,e.next=39,t.peek_content(r);case 39:if(!e.sent){e.next=41;break}return e.abrupt("return",!0);case 41:return r.muted=a,H("LifeCycle::peek_content::false"),e.next=45,o();case 45:return e.abrupt("return",e.sent);case 46:case"end":return e.stop()}}),e,this,[[6,21]])}))),function(t,r){return e.apply(this,arguments)})},{key:"wait_for_source",value:function(t){return H("LifeCycle::wait_for_source"),new Promise((function(e,r){var n=0,i=setInterval((function(){if(++n>40)return clearInterval(i),r(new Error("No source in ".concat(2e3,"ms, giving up")));t.currentSrc&&(e(),clearInterval(i))}),50)}))}}]),t}();q.TERMINAL_EVENTS=W;var Y=r(51),z=r(20),X="function"==typeof requestAnimationFrame?requestAnimationFrame:setTimeout;function Q(t){var e=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()-e;null===r&&(r=X((function(){r=null,t.apply(void 0,i),e=Date.now()}),16-s))}}r(105);var J=r(31),Z=r(46),$=r(50),tt=r(7)("fpads:native:outstream"),et={OUTSTREAM_VISIBLE:"ads-outstream-visible",OUTSTREAM_VIEWPORT_UPDATE:"ads-outstream-viewport-update",OUTSTREAM_TEARDOWN:"ads-outstream-teardown",OUTSTREAM_ENDSCREEN_READY:"ads-outstream-endscreen-ready"},rt=function(){function t(e){var r=this,n=e.ads,i=e.container,a=e.video,s=e.ima;v()(this,t),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(t){if(t.clientWidth>0||t.clientHeight)return j(t);var e={height:t.style.height};G(t,"opacity",0),G(t,"display","absolute"),G(t,"display","inline-block"),G(t,"height","auto");var r=j(t);return G(t,"height",e.height),G(t,"opacity",1),r}(this.container),tt("creating Outstream instance"),this.hide(),this.poll_viewport_exit=t.fps_60_visibilty_checker({outstream:this}),this.setup();var o=Object($.a)(this.container,function(){var t=h()(d.a.mark((function t(e){return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}return t.abrupt("return");case 2:return o(),t.next=5,r.begin_life_cycle();case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}())}var e;return m()(t,null,[{key:"of",value:function(e){return new t(e)}},{key:"fps_60_visibilty_checker",value:function(t){var e=t.outstream;return Q((function(){if(!e.disposed){var t=e.percent_in_viewport();if(e.ads.emit(et.OUTSTREAM_VIEWPORT_UPDATE,{percent:t}),!(t>.5&&e.ads.adPlaying))return t>.5?e.ads.resume():void e.ads.pause()}}))}}]),m()(t,[{key:"hide",value:function(){return this}},{key:"restore_aspect_ratio",value:function(){return tt("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 t=this.video.root.getBoundingClientRect(),e=window.innerHeight,(r=t.y)>e||r+t.height<0?0:t.y<0?(t.height+r)/t.height:e-t.y>t.height?1:Math.abs((e-t.y)/t.height);var t,e,r}},{key:"show",value:function(){this.container.removeClass(t.CLASS.HIDDEN),this.container.addClass(t.CLASS.SHOWING),this.ui.toggle({linear:!0,on:!0})}},{key:"begin_life_cycle",value:(e=h()(d.a.mark((function t(){var e,r,n,i,s,o=this;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,J.a(!1);case 2:return e=t.sent,r=e.error,n=e.result,t.next=7,J.a(!0);case 7:return i=t.sent,s=i.result,this.attach_ad_listeners(),this.ui.initial={can_autoplay:!(!n&&!s),muted:!n},tt("Outstream.show() :autoplay >> ",this,{error:r,can_autoplay_audio:n}),r&&this.video&&!n&&(this.video.muted=!0,this.video.volume=0),t.next=15,this.ads.setVideoTag(this.video);case 15:return this.ads.on(T.a.AD_PAUSE_CONTENT,(function(t){var e=t.linear;o.ads.resize({width:o.dimensions.width,height:o.dimensions.height,linear:e})})),t.next=18,q.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:q.update_time({content:this.video,ads:this.ads,ui:this.ui});case 19:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"attach_ad_listeners",value:function(){var t=this,e=this,r=e.ads;r.once(T.a.AD_PAUSE_CONTENT,(function(){e.show(),e.poll_viewport_exit(),document.addEventListener("scroll",e.poll_viewport_exit),window.emit("resize")})),e.ima.always_show_controls||r.on(T.a.VPAID_INIT,(function(){return e.ui.addClass("is-vpaid")}));var n=function r(n){q.TERMINAL_EVENTS.forEach((function(t){return e.ads.removeListener(t,r)}));var i,a,s=(i=et.OUTSTREAM_TEARDOWN,(a=document.createEvent("Event")).initEvent(i,!1,!0),a);tt("Outstream(:teardown)",s),t.video.dispatchEvent(s)};q.TERMINAL_EVENTS.forEach((function(t){return e.ads.once(t,n)})),this.video.one(et.OUTSTREAM_TEARDOWN,(function(t){setTimeout((function(){if(t.defaultPrevented)return e.handle_endscreen();e.dispose()}),0)}))}},{key:"handle_endscreen",value:function(){this.reset_ui(),this.ads.reset(),this.ui.wireup(),q.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(Z.a)})}},{key:"setup",value:function(){this.container.addClass(t.CLASS.IS),this.container.addClass(t.CLASS.HIDDEN),this.empty_src(),this.ui=B.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 e=this.container;e.removeClass(t.CLASS.SHOWING),e.removeClass(t.CLASS.IS),document.removeEventListener("scroll",this.poll_viewport_exit),this.ui.toggle({on:!1})}},{key:"dispose",value:function(){if(!this.disposed){var e=this.container,r=this.video;this.reset_ui(),e.addClass(t.CLASS.IS),e.addClass(t.CLASS.DONE),this.video=this.container=this.ads=0,this.disposed=1,r.destroy()}}}]),t}();rt.CLASS={IS:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"},rt.events=rt.EVENT=et;var nt=r(9);function it(t,e,r){if(!("google"in window))return q.maybe_blocked(r);var i=t.autoplay;r.autoplay=t.autoplay=!1;var s=r.ads=new Y.a,o=s.analytics=Object(z.b)(s),u=!1;s.resize(j(e)),flowplayer.ads||(flowplayer.ads={}),flowplayer.ads.version="1.15.2",flowplayer.ads.commit="a9d7ab1a38c8f15915cf945951e7a499448c211e",flowplayer.ads.events=T.a,flowplayer.ads.ui=n,flowplayer.support().ios&&(r.on([flowplayer.events.FULLSCREEN_ENTER,flowplayer.events.FULLSREEN_EXIT,"webkitendfullscreen"],(function(t){var e=t.type===flowplayer.events.FULLSCREEN_ENTER;r.ads.adapter.setIOSPlaysInline(!e)})),s.on(T.a.AD_POSTROLL_FINISHED,(function(){s.adapter.sharedVideoTag&&s.once(T.a.AD_BREAK_COMPLETED,(function(){r.src=r.original_src,r.one(flowplayer.events.CAN_PLAY,(function(t){r.pause()})),r.webkitExitFullscreen()}))}))),flowplayer.Outstream=rt,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))return t.autoplay=i;var d=l.duration||r.duration;if(c.ads=function(t,e){return Array.isArray(t)&&t.map((function(t,r){return"number"==typeof t.time||t.lazy?t:isNaN(t.percentage)?(console.warn("Ad[index: ".concat(r,"] passed without 'time' property or 'percentage' properties")),t):isNaN(e)?(console.warn("Ad[index: ".concat(r,"] passed with 'percentage' property but both content and config 'duration' was ").concat(e)),t):"number"==typeof t.percentage?(t.time=Math.floor(t.percentage*e),t):t}),[])}(c.ads,d),s.setSchedule(c.ads,d),l.metadata&&z.a.mergeMetadata(o,l.metadata),l.metadata&&s.mergeMacros(l.metadata),l.metadata&&c.parameters&&(c.parameters=a()({},c.parameters,l.metadata)),z.a.mergeMetadata(o,{muted:l.muted||!1,autoplay:l.autoplay||!1}),!u){if(u=!0,t.lang&&!c.Locale&&(c.Locale=t.lang),nt.a.isOutstream(c.ads))return rt.of({container:e,video:r,ads:s,ima:c});q.init({config:a()({},t,{autoplay:i}),root:e,content:r,ads:s,ima:c})}}))}Object.assign(T.a,rt.events),window.addEventListener("resize",Q((function(){null!=("undefined"==typeof flowplayer?"undefined":o()(flowplayer))&&Array.isArray(flowplayer.instances)&&flowplayer.instances.forEach((function(t){return t.ads&&t.ads.resize(j(t))}))}))),it.events=T.a,it.ui=n,it.Outstream=rt,it.version="1.15.2",it.commit="a9d7ab1a38c8f15915cf945951e7a499448c211e"},function(t,e){t.exports=function(t,e){if(null==t)return{};var r,n,i={},a=Object.keys(t);for(n=0;n<a.length;n++)r=a[n],e.indexOf(r)>=0||(i[r]=t[r]);return i}},function(t,e,r){var n=r(98);"string"==typeof n&&(n=[[t.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(t.exports=n.locals)},function(t,e,r){(t.exports=r(18)(!1)).push([t.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}.ad-volume-bar .fp-volume{display:flex}.fp-ad-controls .fp-volumebtn svg{height:1.8em}.fp-ad-controls .fp-volumebtn:after{font-size:230% !important;line-height:inherit !important}.fp-ad-controls .fp-btns{width:1.8em}.fp-ad-controls .fp-btns>svg{display:none}.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(t,e,r){var n=r(100);"string"==typeof n&&(n=[[t.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(t.exports=n.locals)},function(t,e,r){(t.exports=r(18)(!1)).push([t.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(t,e,r){var n=r(102);"string"==typeof n&&(n=[[t.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(t.exports=n.locals)},function(t,e,r){(t.exports=r(18)(!1)).push([t.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(t,e,r){var n=r(104);"string"==typeof n&&(n=[[t.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(t.exports=n.locals)},function(t,e,r){(t.exports=r(18)(!1)).push([t.i,".fp-ad-container.is-vpaid .fp-ad-controls{display:none}\n",""])},function(t,e,r){var n=r(106);"string"==typeof n&&(n=[[t.i,n,""]]),r(19)(n,{insert:"head",singleton:!1}),n.locals&&(t.exports=n.locals)},function(t,e,r){(t.exports=r(18)(!1)).push([t.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(t,e,r){r(53),r(71),r(73),r(75),t.exports=r(95)}]).default})));const{samsung_tv:vn}=r();class gn{init(t,e,r){if(At.from_token(t.token||"").is_granted(At.permissions.ADS)&&!vn)return pn(t,e,r)}}return vt(window,Object.assign(gn,pn)),_r.extensions.push(Fr,dn,gn),Object.assign(_r,{hls:Fr,ads:gn,ovp:dn}),_r}));
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,l;if(r.loading.end=Math.max(self.performance.now(),r.loading.first),l="arraybuffer"===e.responseType?(o=t.response).byteLength:(o=t.responseText).length,r.loaded=r.total=l,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(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 Qr="com.widevine.alpha";const Zr="application/vnd.apple.mpegURL",Jr=[Zr,"application/x-mpegurl"],$r=document.createElement("video").canPlayType(Zr);function en({src:e="",type:t="",drm:r},n){const i=(null==n?void 0:n.hls)||{},a="native"in i&&i.native;return(!$r||!a)&&(!(r&&!Object.keys(r).find(e=>{return t=e,[Qr].filter((function(e){return e===t})).length;var t}))&&(!(!t||!Jr.includes(t))||function(e){const{pathname:t}=Wt(e);return t.endsWith(".m3u8")}(e)))}var tn="audio:set",rn="audio:update",nn="audio:tracks";const an=[Yr.Events.SUBTITLE_TRACKS_UPDATED,Yr.Events.SUBTITLE_TRACK_SWITCH,Yr.Events.LEVEL_SWITCHED];function sn(e,t){an.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 on=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 ln(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&&!Vt()&&"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname)return e.emit(n,{message:"Secure page required for DRM"});const a=e.hls=new Yr(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(Yr.Events.AUDIO_TRACKS_UPDATED,(function(e,r){t.emit(nn,r.audioTracks)})),e.on(Yr.Events.AUDIO_TRACK_SWITCHING,(function(e,r){t.emit(rn,r)})),e.on(Yr.Events.MANIFEST_PARSED,(function(e,r){r.audioTracks&&t.emit(nn,r.audioTracks)})),e.on(Yr.Events.LEVEL_SWITCHED,(function(r,n){const i=e.levels[n.level];i&&t.emit(nn,e.audioTracks.filter((function(e){return e.groupId&&~(i.audioGroupIds||[]).indexOf(e.groupId)})))}))}(a,e),sn(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(tn,o),e.on("src",(function(){e.hls&&e.hls.destroy(),e.off("quality:set",s),e.off(tn,o)})),e.on("audioonlysource",(function(){})),e.on(S,(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(Yr.Events.LEVEL_LOADED,(function(t,r){e.setOpts({live:r.details.live})})),a.on(Yr.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&&(ce.HIGH&t.start_quality&&(e.hls.startLevel=r[0].level),ce.LOW&t.start_quality&&(e.hls.startLevel=r[r.length-1].level),ce.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(Yr.Events.INIT_PTS_FOUND,(function(e,t){t.frag.duration})),a.on(Yr.Events.ERROR,(function(t,r){!function(e,t,r,i){if(0==e.reaper)return;if(0==t.fatal)return;switch(t.type){case Yr.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 Yr.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:on[i]||"an error occurred while loading this video"})}(e,t);case Yr.ErrorTypes.KEY_SYSTEM_ERROR:(function(e,t){var r;e.emit(n,{fatal:!0,message:on[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.config)})),a.on(Yr.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 l=e.opt("start_time");l&&e.once(h,(function(){e.currentTime=l})),"none"===t.preload&&e.once("beforeplay",()=>{a.startLoad(t.start_time||-1)})}class HLS{init(){}onload(e,t,r,n){ln(r,e,n)}wants(e,t,r){return Yr.isSupported()&&en(t,r)}}HLS.events=Xr,HLS.version=Yr.version,Ye(window,HLS);const un=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),cn=(...e)=>e.reduce((e,t)=>un(t)?(Object.keys(t).forEach(r=>{if(un(e[r])&&un(t[r]))return e[r]=cn(e[r],t[r]);e[r]=t[r]}),e):e,{});class Pipe{constructor(e){this.data=e}static of(e){return new Pipe(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 Pipe(this.data)}fmap(e,...t){const r=e.apply(this,[this.data,...t]);return new Pipe(r)}unwrap(){return this.data}}function dn(e){return fetch(e).then(e=>e.json())}function fn(){let e=[].join.call(arguments,"/");return"/"!==e[0]&&(e="/"+e),hn()+"/web/public/native/config"+e}const hn=()=>"https://ljsp.lwcdn.com";function pn(e){return~e.indexOf("/")?e:"/media/"+e}var vn={404:"media not found",402:"invalid subscription",400:"bad request",415:"unsupported media type"};function gn(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 mn(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,cn(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 yn=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;function En(e){return"object"==typeof e&&"ovp/base64"==e.type}function _n(e,t){return function(e,t){return!(~e.indexOf(".")||!yn.test(e))&&(t.type="video/ovp",!0)}(e,t)||En(t)}function Tn(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 bn(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 An(e){return e.live}var Sn=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 Ln(e,t){const r=null==t?void 0:t.src;if(En(t))return function(e,t){const r=Tn(t.src||"");if(function(e){return"string"==typeof e.err}(r))return console.error(r.err);wn(e,r)}(e,t);r&&Pipe.of(r).fmap(pn).fmap(fn).fmap(e=>fetch(e)).fmap(t=>t.then(e=>Promise.all([e.status,e.json()])).then(([t,r])=>200==t?wn(e,r):kn(e,r)))}function wn(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"),kn(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=cn(t,n),a=((null==i?void 0:i.playlist)||[]).map(e=>mn(e,r));return Object.assign(i,{playlist:a})}(e.opts,t))}(e,t):An(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=Pipe.of(i).fmap(bn).unwrap());e.emit("ovp:live:countdown:start",Pipe.of(t).fmap(mn,e.opts).fmap(gn).unwrap())}(e,t):function(e,t){e.emit("ovp:request:media:complete",Pipe.of(t).fmap(mn,e.opts).fmap(gn).unwrap())}(e,t)}function kn(e,t){return t.message?e.emit("ovp:error",t):t.status?e.emit("ovp:error",new Error(vn[t.status])):e.emit("ovp:error",t)}const Rn={};function Dn(e,t,r){"object"!=typeof Rn[t]&&(Rn[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 On=!1;function Cn(e,t,r){In()||Pipe.of("recommendation").fmap(fn,t,r).fmap(dn).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(xn))}function In(){return On}function xn(e){On=!0,console.error("Failed to load recommendations: %j",e)}function Pn(e){return e&&e.live_start_time&&e.live_start_time-Date.now()>0}function Mn(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 i=n();if(i<0||isNaN(i)||0===e.reaper)return clearInterval(r),function(e,t){e.emit("ovp:live:countdown:complete");const r=we(e,V);r&&r.remove(),e.root.classList.remove("is-livecountdown"),e.emit("ovp:request:media:complete",t)}(e,t);!function(e,t,r,n){r.classList.add("is-livecountdown"),t.emit("ovp:live:countdown:tick",{remaining_time:Fn(n+1)}),t.hasState(X)||t.setState(X,!0)}(0,e,e.root,i)}var a;a=t,dn(hn()+"/web/public/countdown/time.json").then(e=>Object.assign(a,{server_time_offset:Date.now()-e.millisUtc})),i(),r=setInterval(i,250)}function Fn(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="";return t.days&&(r+=t.days+":"),r+Oe(t.hours)+":"+Oe(t.minutes)+":"+Oe(t.seconds)}class WebsocketBridge{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 WebsocketBridge(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 FlowplayerLiveCountdown extends FlowplayerComponent{constructor(e){super(e),this.classList.add("fp-livecountdown");const t=Re("fp-inner");this.append(t);const r=document.createElement("p");r.innerText=e.i18n("ovp.starting_in"),t.append(r);const n=document.createElement("p");n.classList.add("fp-countdown"),t.append(n),e.on("ovp:live:countdown:tick",t=>{const r=t.detail.remaining_time;e.root.classList.add("is-livecountdown"),n.innerText=r})}}class OVP{constructor(e){ue(e,V,FlowplayerLiveCountdown)}onload(e,t,r,n){if("string"==typeof n.src)return"string"!=typeof e.player_id||0===n.src.indexOf(e.player_id)||En(n)||(n.src=[e.player_id,n.src].join("/")),Ln(r,n)}wants(e,t,r){return _n(e,t)}init(e,t,r){const i=new WebsocketBridge(r);let a=Object.assign({},e);const s=function(e){if(!a)return e;delete a.src;const t=cn(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(J,!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=bn(i.metadata.live_start_time)),r.setOpts(i);break}}})),r.on("beforeplay",(function(t){const r=e;if(An(r)){if(Nn(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||Pn(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&&_n(e.src,{}))return;if(e.src&&Un(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 Rn[t])return console.debug("using Cache(%s)",t),Dn(e,t,Rn[t]);Pipe.of(t).fmap(fn).fmap(dn).fmap(r=>r.then(r=>Dn(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=pe(t,["playlist"]),a=s({playlist:i});Array.isArray(a.playlist)&&(a.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);if(r.setOpts(a),r.setAttrs(a),!Pn(i))return r.emit("ovp:request:media:complete",i);we(r,V)||(t.appendChild(le(r,V)),Mn(r,e))})),r.on("timeupdate",(function(){var t,n,i;const a=e;An(a)?Nn(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||In()||(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)&&Cn(r,e.metadata.media_id,e.metadata.player_id))})),r.on(S,(function(){i.disconnect()}))}}function Nn(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)||bn(n)>Date.now()}OVP.events=Sn;const Un=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)};Ye(window,OVP);
372
+ /*! native-plugin.js / 1.16.7 / 8017b3e4c408cd0f212db2300242817be04b6d2c / 2022-02-21T14:19:14+02:00 / (c) Flowplayer AB */
373
+ var Bn=gt(mt((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=112)}([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(83)},function(e,t){function r(e,t,r,n,i,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).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,l,"next",e)}function l(e){r(s,i,a,o,l,"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(28);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 l(e){return(l="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 l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[s]={exports:{}};t[s][0].call(u.exports,(function(e){return i(t[s][1][e]||e)}),u,u.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,u,c=l(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,(u=Math.abs(r))>=s?o(r,u,s,"day"):u>=a?o(r,u,a,"hour"):u>=i?o(r,u,i,"minute"):u>=n?o(r,u,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 l(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 u,c=[],d=!1,f=-1;function h(){d&&u&&(d=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!d){var e=l(h);d=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=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||l(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),l=o-(t||o);a.diff=l,a.prev=t,a.curr=o,t=o,r[0]=n.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var u=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(function(e,t){if("%%"===e)return e;u++;var i=n.formatters[t];if("function"==typeof i){var s=r[u];e=i.call(a,s),r.splice(u,1),u--}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":l(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"===l(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.6.11"};"number"==typeof __e&&(__e=r)},function(e,t,r){var n=r(6),i=r(17);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){e.exports=!r(23)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t,r){var n=r(13),i=r(10),a=r(22),s=r(61),o=r(34),l=function(e,t,r){var u,c,d,f,h=e&l.F,p=e&l.G,v=e&l.S,g=e&l.P,m=e&l.B,y=p?n:v?n[t]||(n[t]={}):(n[t]||{}).prototype,E=p?i:i[t]||(i[t]={}),_=E.prototype||(E.prototype={});for(u in p&&(r=t),r)d=((c=!h&&y&&void 0!==y[u])?y:r)[u],f=m&&c?o(d,n):g&&"function"==typeof d?o(Function.call,d):d,y&&s(y,u,d,e&l.U),E[u]!=d&&a(E,u,f),g&&_[u]!=d&&(_[u]=d)};n.core=i,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},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(86),i=r(87),a=r(88);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," */")),l=s.sources.map((function(e){return"/*# sourceURL=".concat(s.sourceRoot).concat(e," */")}));return[a].concat(l).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 l(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 u,c=(u=[],function(e,t){return u[e]=t,u.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=l(t)),n=d.bind(null,r,a,!1),i=d.bind(null,r,a,!0)}else r=l(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 l=r[a],u=i[l.id];u&&(u.refs--,n.push(u))}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 N}));var n=r(47),i=r.n(n),a=r(4),s=r.n(a),o=r(3),l=r.n(o),u=r(28),c=r.n(u),d=r(7),f=r.n(d),h=r(18),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 l()(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()},w={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},k=r(0),R="https://fp-eu-w1-aai.flowplayer.com/in",D="POST",O=[k.a.AD_REQUESTED,k.a.AD_REQUEST_ERROR,k.a.AD_REQUEST_COMPLETED,k.a.AD_COMPLETED,k.a.AD_STARTED,k.a.AD_ERROR,k.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))},F=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]))}),{})},N=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};s()(this,e),this.metadata=M(w,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 l()(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 F.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}}]),l()(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,[R,D,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 N.of(e,{required_keys:C,optional_keys:I,events:O})}},function(e,t,r){var n=r(55),i=r(60);e.exports=r(14)?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},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(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(63)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t,r){var n=r(27),i=r(37);e.exports=function(e){return n(i(e))}},function(e,t,r){var n=r(36);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(85);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 l=10;function u(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(u(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 l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,o=l,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 l},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+".");l=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 l=i[e];if(void 0===l)return!1;if("function"==typeof l)a(l,this,t);else{var u=l.length,c=g(l,u);for(r=0;r<u;++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 u(t),this.on(e,h(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,h(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,a,s;if(u(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(89),i=r(90),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 l(e){return Object.assign({muted:!1,timeout:250,inline:!1},e)}function u(e,t){var r=e.muted,n=e.timeout,i=e.inline,a=t(),s=a.element,o=a.source,l=void 0,u=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){l=s.play(),u=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(u),e({result:t,error:r})},void 0!==l?l.then((function(){return c(!0)})).catch((function(e){return c(!1,e)})):c(!0)}))}var c=function(e){return u(e=l(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(64);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(66),i=r(70);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(39),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){t.f={}.propertyIsEnumerable},function(e,t,r){var n=r(37);e.exports=function(e){return Object(n(e))}},function(e,t,r){var n=r(14),i=r(35),a=r(26),s=r(40).f;e.exports=function(e){return function(t){for(var r,o=a(t),l=i(o),u=l.length,c=0,d=[];u>c;)r=l[c++],n&&!s.call(o,r)||d.push(e?[r,o[r]]:o[r]);return d}}},function(e,t,r){var n=r(25)("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 l=s[o],u=a[l];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:a,prop:l}),r.push(u))}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(91),i=r(92),a=r(93);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,l=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(l[0][s]>l[1][s])return 1;if(l[0][s]===l[1][s]){if(s===o)return 0;s-=1}else if(l[0][s]<l[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=l(r(92)),i=l(r(93)),a=l(r(94)),s=l(r(95)),o=l(r(17));function l(e){return e&&e.__esModule?e:{default:e}}var u=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 l=this.satisfies(r[o]);if(void 0!==l)return l}var u=s.find((function(e){return t.isPlatform(e)}));if(u){var c=this.satisfies(r[u]);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=u,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.7","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","sass":"^1.49.0","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),l=r.n(o),u=r(4),c=r.n(u),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(17),_=r.n(E),T=r(29),b=r.n(T),A=r(0),S=r(6),L=r.n(S),w=r(7)("fpads:timers"),k=-1,R=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++k}},{key:"createTimeout",value:function(t,r,n){var i=setTimeout((function(){delete t.timers[i],n()}),r);if(w("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 w("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(w("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 w("TimerRegistry.removeInterval() -> ".concat(t),e.intervals),clearInterval(e.intervals[t]),delete e.intervals[t],e}},{key:"empty",value:function(t){if(t)return w("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}(),D=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(l()({},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"),F=function(e){function t(e){var r;return c()(this,t),(r=p()(this,g()(t).call(this,e)))._adHandlers=[],r._timers=R.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),R.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)",l()({},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",l()({},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()),R.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"),R.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,R.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,u,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,u=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)",l()({},this.opts,{autoplay:u,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(u),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,l,u,d,h;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(){clearTimeout(u),t.apply(void 0,arguments)},l=function(){clearTimeout(u),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),l(new Error("Ad load failed"))})),u=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),l(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,R.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,l){var u=!1;a.once(e,google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,(function(){if(M("ima.startAndWaitForAdCompletion: CONTENT_RESUME_REQUESTED <<< happened"),a._started=!1,u)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),u=!0,e.prev=2,e.next=5,t.pollForFatalError({err:r,ima:a});case 5:e.sent.ok&&(u=!1),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(2),a._started=!1,l(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:D.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"),R.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),N=function(){function e(){c()(this,e)}return f()(e,null,[{key:"create",value:function(e,t){return e.adapter?new e.adapter(t):new F(t)}}]),e}(),U=r(30),B=r(18),j=r.n(B),G=r(31),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],l=H.a.parse(o||"",{strictNullHandling:!0,decoder:function(e){return e}}),u=H.a.stringify(e.process_obj(l,this,n),{encode:!1,strictNullHandling:!0});return e.process_str(s,this,n,!0)+"?"+u}}]),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||{},u=o.video_source,c="object"==L()(window.__flowplayerAdParameters)?window.__flowplayerAdParameters:{};return l()({random:Date.now(),page_url:t,domain:r,player_width:a,player_height:s,video_url:u,videourl:u},c)}function z(e){return Y.apply(this,arguments)}function Y(){return(Y=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,z(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(z)):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 Z=Object.prototype,J=Object.getPrototypeOf;function $(e){return null!==e&&"object"===L()(e)&&J(e)===Z}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=N.create(r,_()(_()(e))),e.opts=l()({},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,u,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:(u=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 u.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=D.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&&D.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,l=arguments;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:0,n=l.length>2&&void 0!==l[2]?l[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(15);n(n.S+n.F,"Object",{assign:r(65)})},function(e,t,r){var n=r(56),i=r(57),a=r(59),s=Object.defineProperty;t.f=r(14)?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(16);e.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},function(e,t,r){e.exports=!r(14)&&!r(23)((function(){return 7!=Object.defineProperty(r(58)("div"),"a",{get:function(){return 7}}).a}))},function(e,t,r){var n=r(16),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(16);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(22),a=r(33),s=r(24)("src"),o=r(62),l=(""+o).split("toString");r(10).inspectSource=function(e){return o.call(e)},(e.exports=function(e,t,r,o){var u="function"==typeof r;u&&(a(r,"name")||i(r,"name",t)),e[t]!==r&&(u&&(a(r,s)||i(r,s,e[t]?""+e[t]:l.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,r){e.exports=r(25)("native-function-to-string",Function.toString)},function(e,t){e.exports=!1},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(14),i=r(35),a=r(71),s=r(40),o=r(41),l=r(27),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=o(e),u=arguments.length,c=1,d=a.f,f=s.f;u>c;)for(var h,p=l(arguments[c++]),v=d?i(p).concat(d(p)):i(p),g=v.length,m=0;g>m;)h=v[m++],n&&!f.call(p,h)||(r[h]=p[h]);return r}:u},function(e,t,r){var n=r(33),i=r(26),a=r(67)(!1),s=r(69)("IE_PROTO");e.exports=function(e,t){var r,o=i(e),l=0,u=[];for(r in o)r!=s&&n(o,r)&&u.push(r);for(;t.length>l;)n(o,r=t[l++])&&(~a(u,r)||u.push(r));return u}},function(e,t,r){var n=r(26),i=r(38),a=r(68);e.exports=function(e){return function(t,r,s){var o,l=n(t),u=i(l.length),c=a(s,u);if(e&&r!=r){for(;u>c;)if((o=l[c++])!=o)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===r)return e||c||0;return!e&&-1}}},function(e,t,r){var n=r(39),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(25)("keys"),i=r(24);e.exports=function(e){return n[e]||(n[e]=i(e))}},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(73),e.exports=r(10).Object.values},function(e,t,r){var n=r(15),i=r(42)(!1);n(n.S,"Object",{values:function(e){return i(e)}})},function(e,t,r){r(75),e.exports=r(10).Object.entries},function(e,t,r){var n=r(15),i=r(42)(!0);n(n.S,"Object",{entries:function(e){return i(e)}})},function(e,t,r){r(77),e.exports=r(10).Array.find},function(e,t,r){var n=r(15),i=r(78)(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(82)("find")},function(e,t,r){var n=r(34),i=r(27),a=r(41),s=r(38),o=r(79);e.exports=function(e,t){var r=1==e,l=2==e,u=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,_):l?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:u||c?c:b}}},function(e,t,r){var n=r(80);e.exports=function(e,t){return new(n(e))(t)}},function(e,t,r){var n=r(16),i=r(81),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(36);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(22)(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(84),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",l="object"==typeof e,u=t.regeneratorRuntime;if(u)l&&(e.exports=u);else{(u=t.regeneratorRuntime=l?e.exports:{}).wrap=v;var c={},d={};d[a]=function(){return this};var f=Object.getPrototypeOf,h=f&&f(f(w([])));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",u.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},u.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},u.awrap=function(e){return{__await:e}},_(T.prototype),T.prototype[s]=function(){return this},u.AsyncIterator=T,u.async=function(e,t,r,n){var i=new T(v(e,t,r,n));return u.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]"},u.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}},u.values=w,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"),l=n.call(a,"finallyLoc");if(o&&l){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(!l)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:w(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 l=g(e,t,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===c)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.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 l=o.arg,u=l.value;return u&&"object"==typeof u&&n.call(u,"__await")?Promise.resolve(u.__await).then((function(e){t("next",e,a,s)}),(function(e){t("throw",e,a,s)})):Promise.resolve(u).then((function(e){l.value=e,a(l)}),(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 w(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:k}}function k(){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},l=function e(t,r,i,a,s,l,u,c,d,f,h,p){var v=t;if("function"==typeof u)v=u(r,v);else if(v instanceof Date)v=f(v);else if(null===v){if(a)return l&&!p?l(r,o.encoder):r;v=""}if("string"==typeof v||"number"==typeof v||"boolean"==typeof v||n.isBuffer(v))return l?[h(p?r:l(r,o.encoder))+"="+h(l(v,o.encoder))]:[h(r)+"="+h(String(v))];var g,m=[];if(void 0===v)return m;if(Array.isArray(u))g=u;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,l,u,c,d,f,h,p)):m.concat(e(v[_],r+(d?"."+_:"["+_+"]"),i,a,s,l,u,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 u=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(l(r[L],L,A,c,d,f?h:null,E,p,v,g,_,m)))}var w=b.join(u),k=!0===s.addQueryPrefix?"?":"";return w.length>0?k+w:""}},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,l=[];if(o){if(!r.plainObjects&&i.call(Object.prototype,o)&&!r.allowPrototypes)return;l.push(o)}for(var u=0;null!==(s=a.exec(n))&&u<r.depth;){if(u+=1,!r.plainObjects&&i.call(Object.prototype,s[1].slice(1,-1))&&!r.allowPrototypes)return;l.push(s[1])}return s&&l.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,l=parseInt(o,10);!isNaN(l)&&s!==o&&String(l)===o&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(a=[])[l]=n:a[o]=n}n=a}return n}(l,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),l=0;l<o.length;++l){var u,c,d=o[l],f=d.indexOf("]="),h=-1===f?d.indexOf("="):f+1;-1===h?(u=t.decoder(d,a.decoder),c=t.strictNullHandling?null:""):(u=t.decoder(d.slice(0,h),a.decoder),c=t.decoder(d.slice(h+1),a.decoder)),i.call(r,u)?r[u]=[].concat(r[u]).concat(c):r[u]=c}return r}(e,r):e,l=r.plainObjects?Object.create(null):{},u=Object.keys(o),c=0;c<u.length;++c){var d=u[c],f=s(d,o[d],r);l=n.merge(l,f,r)}return n.compact(l)}},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(97);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 ie}));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 w})),r.d(n,"VOLUME_BAR",(function(){return k}));var i=r(5),a=r.n(i),s=r(6),o=r.n(s),l=r(94),u=r.n(l),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(95),E=r.n(y),_=(r(98),r(100),r(102),r(104),r(0)),T=1,b=2,A=4,S=8,L=16,w=32,k=64;function R(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 D="undefined"!=typeof document&&"undefined"!=typeof window&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,O="function"==typeof requestAnimationFrame?requestAnimationFrame:setTimeout,C=function(){var e,t=document.createElement("div");return(e=t.classList).add.apply(e,arguments),t},I=r(7)("fpads:native:ui"),x="is-ad-showing",P="is-ad-linear",M="is-ad-nonlinear",F="ad-playing",N="no-fullscreen",U="ad-hide-first-frame",B=function(){function e(t){var r,n,i,a,s=this,o=t.root,l=t.content,u=t.config,c=t.initial,d=t.ads;v()(this,e),Object.assign(this,{root:o,content:l,initial:c,ads:d,config:u}),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=O((function(){a=null,r.apply(this,arguments),i=Date.now()}),n-e))}),d.ui=this,this.render().wireup(),l.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}}},{key:"createCustomElement",value:function(e,t,r){var n=new(window.customElements.get(r))(t);return e.append(n),n}}]),m()(e,[{key:"halt_animation",value:function(){return!this.progress_bar||0==this.content.reaper||!this.wrapper||!this.wrapper.classList.contains(F)}},{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));I("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(x)}},{key:"hideFirstFrame",value:function(){return this.root.classList.toggle(U,!0),this}},{key:"showFirstFrame",value:function(){return this.root.classList.toggle(U,!1),this}},{key:"toggle",value:function(e){var t=e.on,r=e.linear;if(this.root)return I("UI.toggle(): ",arguments[0]),this.showFirstFrame(),t||this.reset(),r&&this.reset_styles(),this.root.classList.toggle(x,t),this.root.classList.toggle(P,t&&r),this.root.classList.toggle(M,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=R(this,"config.ima.flags",R(this,"config.ima.ui",0));return this.wrapper=C("fp-ad-container"),this.ad_wrapper=C("fp-ad-wrapper"),this.adContainer=C("fp-ad"),this.controls=C("fp-ad-controls"),this.progress_wrapper=C("fp-ad-progress-wrapper"),this.progress_bar=C("fp-ad-progress","fp-color"),this.waiting=e.createCustomElement(this.wrapper,this.content,"flowplayer-wait"),this.play_btn=e.createCustomElement(this.controls,this.content,"flowplayer-control-buttons"),this.volume_btn=e.createCustomElement(this.controls,this.content,"flowplayer-volume-icon"),this.volume_bar=e.createCustomElement(this.controls,this.content,"flowplayer-volume-bar"),this.fs_btn=e.createCustomElement(this.controls,this.content,"flowplayer-header-right-zone"),k&i&&this.root.classList.toggle("ad-volume-bar"),this.fs_btn&&this.fs_btn.classList.remove("fp-togglable"),this.root.classList.toggle("is-ad-controls-sticky",T&i),this.root.classList.toggle("is-ad-attribution",S&i),this.root.classList.toggle(N,b&i),D&&this.content.once([_.a.AD_BREAK_COMPLETED,_.a.AD_REQUEST_ERROR,_.a.AD_STARTED],(function(e){t.root.classList.toggle(N,b&i||e.type===_.a.AD_STARTED)})),!R(this,"config.ima.indicator",!0)||A&i||(this.indicator=C("ad-indicator"),this.controls.prepend(this.indicator),this.indicator.classList.add("fp-color-text")),w&i&&(this.remaining=C("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=C("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){I("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){I("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){I("Event(%s, level: %o)",_.a.AD_VOLUME_CHANGED,e),t.content.muted||(t.content.volume=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.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:"playback_changed",value:function(e){this.ad_loading(!1),e&&this.animate(),this.wrapper.classList.toggle(F,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 j(e){return{width:e.clientWidth,height:e.clientHeight}}function G(e,t,r){return"number"==typeof r&&(r+="px"),e.style.setProperty(t,r),e}r(7)("fpads:dom");var H=r(7)("fpads:plugin:native"),K={on:!0},V={on:!1},W=[_.a.AD_PLAYBACK_ERROR,_.a.AD_TEARDOWN,_.a.AD_BREAK_COMPLETED],q=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,l=t.adContainer,u=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!D&&c.preventDefault(),e.add_time_listeners({ads:n,content:r,ui:a,state:s}),H("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:l,ima:u,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,l,u,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,l=n.autoplay===(flowplayer.autoplay||flowplayer.autoplay_options).AUDIO_REQUIRED,u=e.snapshot(a,l),c=flowplayer,f=c.events,a.on(f.VOLUME_CHANGE,(function(){u.volume=a.volume,u.muted=a.muted})),h=B.of({ads:s,content:a,config:n,initial:u,root:a.root}),p=h.adContainer,v={listening:!1,preload:R(n,"ima.preload_ads",!1)},H("LifeCycle.initial()",{initial:u}),s.setVideoTag(a),!n.autoplay){t.next=18;break}return H("Trying to autoplay"),h.hideFirstFrame(),t.next=16,e.peek_content(a,l);case 16:t.sent?(H("Can autoplay, start ad"),a.opts.autoplay=!0,e.start({ads:s,content:a,state:v,adContainer:p,ima:o,config:n})):(H("cannot autoplay(audioRequired: %s), fallback to poster state",l),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:u,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:u}),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,l,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,l=t.config,c=void 0===l?{}:l,!o.started){e.next=3;break}return e.abrupt("return");case 3:return o.started=!0,s.ads,f=u()(s,["ads"]),h=c.dimensions||j(n.root),p=R(c,"muted",n.muted),v=Object.assign(a()({container:i,volume:p?0:R(c,"volume",n.volume),muted:p,autoplay:R(c,"autoplay",!1),video_source:n.original_src,DisableCustomPlaybackForIOS10Plus:R(c,"fake_fullscreen",D),preload_ads:R(c,"ima.preload_ads",!1)},f,h)),H("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,l=t.adContainer,u=t.state,c=t.ui,f=t.ima;H("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(H("LifeCycle.ui_listeners() -> content started playing"),e.add_time_listeners({ads:s,content:i,ui:c,state:u}),s.shallPlayAd(0)&&s.adapter.adLinear){t.next=9;break}return H("LifeCycle.ui_listeners() -> no more preroll ads -> resume content"),t.next=8,e.start({ads:s,content:i,state:u,adContainer:l,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:u,adContainer:l,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()({},K,{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&&(H("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=R(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,l=e.ad_type;if(H("Ad[linear: ".concat(t,", currentTime: ").concat(i.currentTime,"] starting"),r),"preroll"==l&&!t&&i.paused&&i.play(),"preroll"==l&&t&&i.currentTime>0&&!i.opt("start_time")&&!i.opt("live")&&(H("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()({},K,{linear:t,ad:r})),!t)try{i.togglePlay(!0),i.volume=o.volume,i.muted=o.muted}catch(e){H(e)}})),s.on(_.a.AD_PAUSE_CONTENT,(function(){c.resize({linear:!0,resizeContainerAlso:!0,width:void 0,height:void 0})})),W.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,l,u,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,l=void 0===o?{}:o,a.isShowing()||i.paused){t.next=3;break}return t.abrupt("return",{noop:1});case 3:if(u=flowplayer,c=u.states,n.classList.add("is-seamless"),a.classList.remove("is-vpaid"),n.classList.remove(c.WAITING),H("LifeCycle.teardown(event: %s)",s),l.reason&&H("LifeCycle.teardown(:err, reason: %s) %o",l.reason),a.toggle(V),f=i.ads,h=f.getLastAd(),f.shouldRestartContent()){t.next=15;break}return H("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 H("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 H("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 H("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){H("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,l,u;return d.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=[r.muted,r.volume],H("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)}))},l=function(){return new Promise((function(e){return setTimeout((function(){return e(r.play())}))}))},u=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),H("LifeCycle::peek_content::play"),t.next=13,l();case 13:return H("LifeCycle::peek_content::pause"),t.next=16,u();case 16:return r.volume=s,H("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 H("LifeCycle::peek_content::false"),t.next=34,o();case 34:return t.abrupt("return",t.sent);case 35:return H("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,H("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 H("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}();q.TERMINAL_EVENTS=W;var z=r(51),Y=r(21),X="function"==typeof requestAnimationFrame?requestAnimationFrame:setTimeout;function Q(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=X((function(){r=null,e.apply(void 0,i),t=Date.now()}),16-s))}}r(106);var Z=r(32),J=r(46),$=r(50),ee=r(7)("fpads:native:outstream"),te={OUTSTREAM_VISIBLE:"ads-outstream-visible",OUTSTREAM_VIEWPORT_UPDATE:"ads-outstream-viewport-update",OUTSTREAM_TEARDOWN:"ads-outstream-teardown",OUTSTREAM_ENDSCREEN_READY:"ads-outstream-endscreen-ready"},re=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 j(e);var t={height:e.style.height};G(e,"opacity",0),G(e,"display","absolute"),G(e,"display","inline-block"),G(e,"height","auto");var r=j(e);return G(e,"height",t.height),G(e,"opacity",1),r}(this.container),ee("creating Outstream instance"),this.hide(),this.poll_viewport_exit=e.fps_60_visibilty_checker({outstream:this}),this.setup();var o=Object($.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 Q((function(){if(!t.disposed){var e=t.percent_in_viewport();if(t.ads.emit(te.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 ee("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,Z.a(!1);case 2:return t=e.sent,r=t.error,n=t.result,e.next=7,Z.a(!0);case 7:return i=e.sent,s=i.result,this.attach_ad_listeners(),this.ui.initial={can_autoplay:!(!n&&!s),muted:!n},ee("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,q.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:q.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){q.TERMINAL_EVENTS.forEach((function(e){return t.ads.removeListener(e,r)}));var i,a,s=(i=te.OUTSTREAM_TEARDOWN,(a=document.createEvent("Event")).initEvent(i,!1,!0),a);ee("Outstream(:teardown)",s),e.video.dispatchEvent(s)};q.TERMINAL_EVENTS.forEach((function(e){return t.ads.once(e,n)})),this.video.once(te.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(),q.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(J.a)})}},{key:"setup",value:function(){this.container.addClass(e.CLASS.IS),this.container.addClass(e.CLASS.HIDDEN),this.empty_src(),this.ui=B.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}();re.CLASS={IS:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"},re.events=re.EVENT=te;var ne=r(9);function ie(e,t,r){if(!("google"in window))return q.maybe_blocked(r);var i=e.autoplay;r.autoplay=e.autoplay=!1;var s=r.ads=new z.a,o=s.analytics=Object(Y.b)(s),l=!1;s.resize(j(t)),flowplayer.ads||(flowplayer.ads={}),flowplayer.ads.version="1.16.7",flowplayer.ads.commit="8017b3e4c408cd0f212db2300242817be04b6d2c",flowplayer.ads.events=_.a,flowplayer.ads.ui=n,D&&(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=re,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 u=n.data,c=u.ima||{};if(Array.isArray(c.ads)){var d=u.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),u.metadata&&Y.a.mergeMetadata(o,u.metadata),u.metadata&&s.mergeMacros(u.metadata),u.metadata&&c.parameters&&(c.parameters=a()({},c.parameters,u.metadata)),Y.a.mergeMetadata(o,{muted:u.muted||!1,autoplay:u.autoplay||!1}),!l){if(l=!0,e.lang&&!c.Locale&&(c.Locale=e.lang),ne.a.isOutstream(c.ads))return re.of({container:t,video:r,ads:s,ima:c});q.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,re.events),window.addEventListener("resize",Q((function(){null!=("undefined"==typeof flowplayer?"undefined":o()(flowplayer))&&Array.isArray(flowplayer.instances)&&flowplayer.instances.forEach((function(e){return e.ads&&e.ads.resize(j(e))}))}))),ie.events=_.a,ie.ui=n,ie.Outstream=re,ie.version="1.16.7",ie.commit="8017b3e4c408cd0f212db2300242817be04b6d2c"},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(99);"string"==typeof n&&(n=[[e.i,n,""]]),r(20)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(19)(!1)).push([e.i,'.fp-ad-container .fp-color{background-color:gold}.fp-ad-container .fp-color-text{color:gold;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:.72em 0em .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;position:relative;top:.2em}.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:.5em}.fp-ad-controls .fp-volumebtn{width:1.12em}.fp-ad-controls .fp-volume{display:none;margin-left:-2em}.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:.5em;margin-right:.5em}.fp-ad-progress-wrapper{direction:ltr}.fp-ad-progress{height:.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,.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:#000;background-color:rgba(255,255,255,.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}',""])},function(e,t,r){var n=r(101);"string"==typeof n&&(n=[[e.i,n,""]]),r(20)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(19)(!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}",""])},function(e,t,r){var n=r(103);"string"==typeof n&&(n=[[e.i,n,""]]),r(20)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(19)(!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}",""])},function(e,t,r){var n=r(105);"string"==typeof n&&(n=[[e.i,n,""]]),r(20)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(19)(!1)).push([e.i,".fp-ad-container.is-vpaid .fp-ad-controls{display:none}",""])},function(e,t,r){var n=r(107);"string"==typeof n&&(n=[[e.i,n,""]]),r(20)(n,{insert:"head",singleton:!1}),n.locals&&(e.exports=n.locals)},function(e,t,r){(e.exports=r(19)(!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}",""])},,,,,function(e,t,r){r(53),r(72),r(74),r(76),e.exports=r(96)}]).default})));const{samsung_tv:jn}=r();class Ads{init(e,t,r){if(rt.from_token(e.token||"").is_granted(rt.permissions.ADS)&&!jn)return Bn(e,t,r)}}return Ye(window,Object.assign(Ads,Bn)),zr.extensions.push(HLS,OVP,Ads),Object.assign(zr,{hls:HLS,ads:Ads,ovp:OVP}),zr}));