Files
goodtube/js/assets.min.js
goodtube4u 12ed8ad280 Asset fix
2024-07-21 17:47:18 +10:00

9 lines
679 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!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).videojs=t()}(this,(function(){"use strict";var e="8.3.0";const t={},i=function(e,i){return t[e]=t[e]||[],i&&(t[e]=t[e].concat(i)),t[e]};function n(e,n){return!((n=i(e).indexOf(n))<=-1||(t[e]=t[e].slice(),t[e].splice(n,1),0))}const r={prefixed:!0};var s=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],a=s[0];let o;for(let e=0;e<s.length;e++)if(s[e][1]in document){o=s[e];break}if(o){for(let e=0;e<o.length;e++)r[a[e]]=o[e];r.prefixed=o[0]!==a[0]}let l=[];function u(e){return f(e)?Object.keys(e):[]}const d=function e(t){let i,n="info";function r(...e){i("log",n,e)}var s,a;return s=t,i=(e,t,i)=>{t=a.levels[t];var n,r=new RegExp(`^(${t})$`);if("log"!==e&&i.unshift(e.toUpperCase()+":"),i.unshift(s+":"),l&&(l.push([].concat(i)),n=l.length-1e3,l.splice(0,0<n?n:0)),window.console){let n=window.console[e];(n=n||"debug"!==e?n:window.console.info||window.console.log)&&t&&r.test(e)&&n[Array.isArray(i)?"apply":"call"](window.console,i)}},(a=r).createLogger=i=>e(t+": "+i),r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},r.level=e=>{if("string"==typeof e){if(!r.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);n=e}return n},r.history=()=>l?[].concat(l):[],r.history.filter=e=>(l||[]).filter((t=>new RegExp(`.*${e}.*`).test(t[0]))),r.history.clear=()=>{l&&(l.length=0)},r.history.disable=()=>{null!==l&&(l.length=0,l=null)},r.history.enable=()=>{null===l&&(l=[])},r.error=(...e)=>i("error",n,e),r.warn=(...e)=>i("warn",n,e),r.debug=(...e)=>i("debug",n,e),r}("VIDEOJS"),h=d.createLogger,c=Object.prototype.toString;function p(e,t){u(e).forEach((i=>t(e[i],i)))}function m(e,t,i=0){return u(e).reduce(((i,n)=>t(i,e[n],n)),i)}function f(e){return!!e&&"object"==typeof e}function g(e){return f(e)&&"[object Object]"===c.call(e)&&e.constructor===Object}function y(...e){const t={};return e.forEach((e=>{e&&p(e,((e,i)=>{g(e)?(g(t[i])||(t[i]={}),t[i]=y(t[i],e)):t[i]=e}))})),t}function _(e,t,i,n=!0){const r=i=>Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0});var s={configurable:!0,enumerable:!0,get(){var e=i();return r(e),e}};return n&&(s.set=r),Object.defineProperty(e,t,s)}var v=Object.freeze({__proto__:null,each:p,reduce:m,isObject:f,isPlain:g,merge:y,defineLazyProperty:_});let b,T=!1,S=null,w=!1,E=!1,k=!1,C=!1,x=!1,I=null,A=null,O=null,P=!1,L=!1,D=!1,N=!1;const M=Boolean(q()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var R,U=window.navigator&&window.navigator.userAgentData;if(U&&(w="Android"===U.platform,k=Boolean(U.brands.find((e=>"Microsoft Edge"===e.brand))),C=Boolean(U.brands.find((e=>"Chromium"===e.brand))),x=!k&&C,I=A=(U.brands.find((e=>"Chromium"===e.brand))||{}).version||null,L="Windows"===U.platform),!C){const e=window.navigator&&window.navigator.userAgent||"";T=/iPod/i.test(e),S=(U=e.match(/OS (\d+)_/i))&&U[1]?U[1]:null,w=/Android/i.test(e),b=(U=e.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(qe=U[1]&&parseFloat(U[1]),R=U[2]&&parseFloat(U[2]),qe&&R?parseFloat(U[1]+"."+U[2]):qe||null):null,E=/Firefox/i.test(e),k=/Edg/i.test(e),C=/Chrome/i.test(e)||/CriOS/i.test(e),x=!k&&C,I=A=(R=e.match(/(Chrome|CriOS)\/(\d+)/))&&R[2]?parseFloat(R[2]):null,O=function(){var t=/MSIE\s(\d+)\.\d/.exec(e);let i=t&&parseFloat(t[1]);return!i&&/Trident\/7.0/i.test(e)&&/rv:11.0/.test(e)?11:i}(),P=/Safari/i.test(e)&&!x&&!w&&!k,L=/Windows/i.test(e),D=/iPad/i.test(e)||P&&M&&!/iPhone/i.test(e),N=/iPhone/i.test(e)&&!D}const j=N||D||T,B=(P||j)&&!x;function F(e){return"string"==typeof e&&Boolean(e.trim())}function q(){return document===window.document}function H(e){return f(e)&&1===e.nodeType}function V(){try{return window.parent!==window.self}catch(e){return!0}}function $(e){return function(t,i){return F(t)?(i=H(i=F(i)?document.querySelector(i):i)?i:document)[e]&&i[e](t):document[e](null)}}function W(e="div",t={},i={},n){const r=document.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){var i=t[e];"textContent"===e?z(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),n&&he(r,n),r}function z(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function G(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function X(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function K(e,...t){return e.classList.add(...t.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),e}function Q(e,...t){return e?(e.classList.remove(...t.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),e):(d.warn("removeClass was called with an element that doesn't exist"),null)}function Y(e,t,i){return"boolean"!=typeof(i="function"==typeof i?i(e,t):i)&&(i=void 0),t.split(/\s+/).forEach((t=>e.classList.toggle(t,i))),e}function J(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var n=t[i];null==n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)}))}function Z(e){var t={};if(e&&e.attributes&&0<e.attributes.length){var i=e.attributes;for(let r=i.length-1;0<=r;r--){var n=i[r].name;let s=i[r].value;"boolean"!=typeof e[n]&&-1===",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+n+",")||(s=null!==s),t[n]=s}}return t}function ee(e,t){return e.getAttribute(t)}function te(e,t,i){e.setAttribute(t,i)}function ie(e,t){e.removeAttribute(t)}function ne(){document.body.focus(),document.onselectstart=function(){return!1}}function re(){document.onselectstart=function(){return!0}}function se(e){if(e&&e.getBoundingClientRect&&e.parentNode){const t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((e=>{void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(ge(e,"height"))),i.width||(i.width=parseFloat(ge(e,"width"))),i}}function ae(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,i=e.offsetHeight;let n=0,s=0;for(;e.offsetParent&&e!==document[r.fullscreenElement];)n+=e.offsetLeft,s+=e.offsetTop,e=e.offsetParent;return{left:n,top:s,width:t,height:i}}function oe(e,t){var i={x:0,y:0};if(j){let t=e;for(;t&&"html"!==t.nodeName.toLowerCase();){var n,r=ge(t,"transform");/^matrix/.test(r)?(n=r.slice(7,-1).split(/,\s/).map(Number),i.x+=n[4],i.y+=n[5]):/^matrix3d/.test(r)&&(n=r.slice(9,-1).split(/,\s/).map(Number),i.x+=n[12],i.y+=n[13]),t=t.parentNode}}var s={},a=ae(t.target),o=(e=ae(e)).width,l=e.height;let u=t.offsetY-(e.top-a.top),d=t.offsetX-(e.left-a.left);return t.changedTouches&&(d=t.changedTouches[0].pageX-e.left,u=t.changedTouches[0].pageY+e.top,j)&&(d-=i.x,u-=i.y),s.y=1-Math.max(0,Math.min(1,u/l)),s.x=Math.max(0,Math.min(1,d/o)),s}function le(e){return f(e)&&3===e.nodeType}function ue(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function de(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((e=>H(e="function"==typeof e?e():e)||le(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0)).filter((e=>e))}function he(e,t){return de(t).forEach((t=>e.appendChild(t))),e}function ce(e,t){return he(ue(e),t)}function pe(e){return void 0===e.button&&void 0===e.buttons||0===e.button&&void 0===e.buttons||"mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}U=Object.freeze({__proto__:null,get IS_IPOD(){return T},get IOS_VERSION(){return S},get IS_ANDROID(){return w},get ANDROID_VERSION(){return b},get IS_FIREFOX(){return E},get IS_EDGE(){return k},get IS_CHROMIUM(){return C},get IS_CHROME(){return x},get CHROMIUM_VERSION(){return I},get CHROME_VERSION(){return A},get IE_VERSION(){return O},get IS_SAFARI(){return P},get IS_WINDOWS(){return L},get IS_IPAD(){return D},get IS_IPHONE(){return N},TOUCH_ENABLED:M,IS_IOS:j,IS_ANY_SAFARI:B});const me=$("querySelector"),fe=$("querySelectorAll");function ge(e,t){if(!e||!t)return"";if("function"!=typeof window.getComputedStyle)return"";{let i;try{i=window.getComputedStyle(e)}catch(e){return""}return i?i.getPropertyValue(t)||i[t]:""}}var ye=Object.freeze({__proto__:null,isReal:q,isEl:H,isInFrame:V,createEl:W,textContent:z,prependTo:G,hasClass:X,addClass:K,removeClass:Q,toggleClass:Y,setAttributes:J,getAttributes:Z,getAttribute:ee,setAttribute:te,removeAttribute:ie,blockTextSelection:ne,unblockTextSelection:re,getBoundingClientRect:se,findPosition:ae,getPointerPosition:oe,isTextNode:le,emptyEl:ue,normalizeContent:de,appendContent:he,insertContent:ce,isSingleLeftClick:pe,$:me,$$:fe,computedStyle:ge});let _e,ve=!1;function be(){if(!1!==_e.options.autoSetup){var e=Array.prototype.slice.call(document.getElementsByTagName("video")),t=Array.prototype.slice.call(document.getElementsByTagName("audio")),i=Array.prototype.slice.call(document.getElementsByTagName("video-js")),n=e.concat(t,i);if(n&&0<n.length)for(let e=0,t=n.length;e<t;e++){var r=n[e];if(!r||!r.getAttribute){Te(1);break}void 0===r.player&&null!==r.getAttribute("data-setup")&&_e(r)}else ve||Te(1)}}function Te(e,t){q()&&(t&&(_e=t),window.setTimeout(be,e))}function Se(){ve=!0,window.removeEventListener("load",Se)}function we(e){var t=document.createElement("style");return t.className=e,t}function Ee(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t}q()&&("complete"===document.readyState?Se():window.addEventListener("load",Se));var ke=new WeakMap;let Ce,xe=3;function Ie(e,t){var i;ke.has(e)&&(0===(i=ke.get(e)).handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length)&&ke.delete(e)}function Ae(e,t,i,n){i.forEach((function(i){e(t,i,n)}))}function Oe(e){if(!e.fixed_){if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){const s=e||window.event;e={};for(const t in s)"layerX"===t||"layerY"===t||"keyLocation"===t||"webkitMovementX"===t||"webkitMovementY"===t||"path"===t||"returnValue"===t&&s.preventDefault||(e[t]=s[t]);var t,i;e.target||(e.target=e.srcElement||document),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){s.preventDefault&&s.preventDefault(),e.returnValue=!1,s.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){s.stopPropagation&&s.stopPropagation(),e.cancelBubble=!0,s.cancelBubble=!0,e.isPropagationStopped=n},e.isPropagationStopped=r,e.stopImmediatePropagation=function(){s.stopImmediatePropagation&&s.stopImmediatePropagation(),e.isImmediatePropagationStopped=n,e.stopPropagation()},e.isImmediatePropagationStopped=r,null!==e.clientX&&void 0!==e.clientX&&(t=document.documentElement,i=document.body,e.pageX=e.clientX+(t&&t.scrollLeft||i&&i.scrollLeft||0)-(t&&t.clientLeft||i&&i.clientLeft||0),e.pageY=e.clientY+(t&&t.scrollTop||i&&i.scrollTop||0)-(t&&t.clientTop||i&&i.clientTop||0)),e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}e.fixed_=!0}return e;function n(){return!0}function r(){return!1}}const Pe=["touchstart","touchmove"];function Le(e,t,i){if(Array.isArray(t))return Ae(Le,e,t,i);ke.has(e)||ke.set(e,{});const n=ke.get(e);if(n.handlers||(n.handlers={}),n.handlers[t]||(n.handlers[t]=[]),i.guid||(i.guid=xe++),n.handlers[t].push(i),n.dispatcher||(n.disabled=!1,n.dispatcher=function(t,i){if(!n.disabled){t=Oe(t);var r=n.handlers[t.type];if(r){var s=r.slice(0);for(let n=0,a=s.length;n<a&&!t.isImmediatePropagationStopped();n++)try{s[n].call(e,t,i)}catch(r){d.error(r)}}}}),1===n.handlers[t].length)if(e.addEventListener){let i=!1;(function(){if("boolean"!=typeof Ce){Ce=!1;try{var e=Object.defineProperty({},"passive",{get(){Ce=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){}}return Ce})()&&-1<Pe.indexOf(t)&&(i={passive:!0}),e.addEventListener(t,n.dispatcher,i)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function De(e,t,i){if(ke.has(e)){const s=ke.get(e);if(s.handlers){if(Array.isArray(t))return Ae(De,e,t,i);var n=function(e,t){s.handlers[t]=[],Ie(e,t)};if(void 0===t)for(const t in s.handlers)Object.prototype.hasOwnProperty.call(s.handlers||{},t)&&n(e,t);else{var r=s.handlers[t];if(r)if(i){if(i.guid)for(let e=0;e<r.length;e++)r[e].guid===i.guid&&r.splice(e--,1);Ie(e,t)}else n(e,t)}}}}function Ne(e,t,i){var n=ke.has(e)?ke.get(e):{},r=e.parentNode||e.ownerDocument;return"string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=Oe(t),n.dispatcher&&n.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles?Ne.call(null,r,t,i):!r&&!t.defaultPrevented&&t.target&&t.target[t.type]&&(ke.has(t.target)||ke.set(t.target,{}),n=ke.get(t.target),t.target[t.type])&&(n.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),n.disabled=!1),!t.defaultPrevented}function Me(e,t,i){if(Array.isArray(t))return Ae(Me,e,t,i);function n(){De(e,t,n),i.apply(this,arguments)}n.guid=i.guid=i.guid||xe++,Le(e,t,n)}function Re(e,t,i){function n(){De(e,t,n),i.apply(this,arguments)}n.guid=i.guid=i.guid||xe++,Le(e,t,n)}var Ue=Object.freeze({__proto__:null,fixEvent:Oe,on:Le,off:De,trigger:Ne,one:Me,any:Re});function je(e,t,i){return t.guid||(t.guid=xe++),(e=t.bind(e)).guid=i?i+"_"+t.guid:t.guid,e}function Be(e,t){let i=window.performance.now();return function(...n){var r=window.performance.now();r-i>=t&&(e(...n),i=r)}}function Fe(e,t,i,n=window){let r;function s(){const s=this,a=arguments;let o=function(){r=null,o=null,i||e.apply(s,a)};!r&&i&&e.apply(s,a),n.clearTimeout(r),r=n.setTimeout(o,t)}return s.cancel=()=>{n.clearTimeout(r),r=null},s}var qe=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:je,throttle:Be,debounce:Fe});let He;class Ve{on(e,t){var i=this.addEventListener;this.addEventListener=()=>{},Le(this,e,t),this.addEventListener=i}off(e,t){De(this,e,t)}one(e,t){var i=this.addEventListener;this.addEventListener=()=>{},Me(this,e,t),this.addEventListener=i}any(e,t){var i=this.addEventListener;this.addEventListener=()=>{},Re(this,e,t),this.addEventListener=i}trigger(e){var t=e.type||e;e=Oe(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Ne(this,e)}queueTrigger(e){He=He||new Map;const t=e.type||e;let i=He.get(this);i||(i=new Map,He.set(this,i));var n=i.get(t);i.delete(t),window.clearTimeout(n),n=window.setTimeout((()=>{i.delete(t),0===i.size&&(i=null,He.delete(this)),this.trigger(e)}),0),i.set(t,n)}}Ve.prototype.allowedEvents_={},Ve.prototype.addEventListener=Ve.prototype.on,Ve.prototype.removeEventListener=Ve.prototype.off,Ve.prototype.dispatchEvent=Ve.prototype.trigger;const $e=e=>"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e),We=e=>e instanceof Ve||!!e.eventBusEl_&&["on","one","off","trigger"].every((t=>"function"==typeof e[t])),ze=e=>"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length,Ge=(e,t,i)=>{if(!e||!e.nodeName&&!We(e))throw new Error(`Invalid target for ${$e(t)}#${i}; must be a DOM node or evented object.`)},Xe=(e,t,i)=>{if(!ze(e))throw new Error(`Invalid event type for ${$e(t)}#${i}; must be a non-empty string or array.`)},Ke=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${$e(t)}#${i}; must be a function.`)},Qe=(e,t,i)=>{var n=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,s,a;return n?(r=e.eventBusEl_,3<=t.length&&t.shift(),[s,a]=t):[r,s,a]=t,Ge(r,e,i),Xe(s,e,i),Ke(a,e,i),a=je(e,a),{isTargetingSelf:n,target:r,type:s,listener:a}},Ye=(e,t,i,n)=>{Ge(e,e,t),e.nodeName?Ue[t](e,i,n):e[t](i,n)},Je={on(...e){const{isTargetingSelf:t,target:i,type:n,listener:r}=Qe(this,e,"on");if(Ye(i,"on",n,r),!t){const t=()=>this.off(i,n,r);t.guid=r.guid,(e=()=>this.off("dispose",t)).guid=r.guid,Ye(this,"on","dispose",t),Ye(i,"on","dispose",e)}},one(...e){const{isTargetingSelf:t,target:i,type:n,listener:r}=Qe(this,e,"one");if(t)Ye(i,"one",n,r);else{const e=(...t)=>{this.off(i,n,e),r.apply(null,t)};e.guid=r.guid,Ye(i,"one",n,e)}},any(...e){const{isTargetingSelf:t,target:i,type:n,listener:r}=Qe(this,e,"any");if(t)Ye(i,"any",n,r);else{const e=(...t)=>{this.off(i,n,e),r.apply(null,t)};e.guid=r.guid,Ye(i,"any",n,e)}},off(e,t,i){!e||ze(e)?De(this.eventBusEl_,e,t):(Ge(e,this,"off"),Xe(t,this,"off"),Ke(i,this,"off"),i=je(this,i),this.off("dispose",i),e.nodeName?(De(e,t,i),De(e,"dispose",i)):We(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){Ge(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(ze(i))return Ne(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${$e(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`)}};function Ze(e,t={}){if(t=t.eventBusKey){if(!e[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);e.eventBusEl_=e[t]}else e.eventBusEl_=W("span",{className:"vjs-event-bus"});Object.assign(e,Je),e.eventedCallbacks&&e.eventedCallbacks.forEach((e=>{e()})),e.on("dispose",(()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach((function(e){e&&ke.has(e)&&ke.delete(e)})),window.setTimeout((()=>{e.eventBusEl_=null}),0)}))}const et={state:{},setState(e){let t;return"function"==typeof e&&(e=e()),p(e,((e,i)=>{this.state[i]!==e&&((t=t||{})[i]={from:this.state[i],to:e}),this.state[i]=e})),t&&We(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function tt(e,t){Object.assign(e,et),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&We(e)&&e.on("statechanged",e.handleStateChanged)}function it(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toLowerCase()))}function nt(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toUpperCase()))}function rt(e,t){return nt(e)===nt(t)}var st=Object.freeze({__proto__:null,toLowerCase:it,toTitleCase:nt,titleCaseEquals:rt}),at="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ot(e,t){return e(t={exports:{}},t.exports),t.exports}var lt=ot((function(e,t){function i(e){var t;return"number"==typeof(e=e&&"object"==typeof e&&(t=e.which||e.keyCode||e.charCode)?t:e)?o[e]:(t=String(e),n[t.toLowerCase()]||r[t.toLowerCase()]||(1===t.length?t.charCodeAt(0):void 0))}i.isEventKey=function(e,t){if(e&&"object"==typeof e){if(null!=(e=e.which||e.keyCode||e.charCode))if("string"==typeof t){var i=n[t.toLowerCase()];if(i)return i===e;if(i=r[t.toLowerCase()])return i===e}else if("number"==typeof t)return t===e;return!1}};for(var n=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},s=97;s<123;s++)n[String.fromCharCode(s)]=s-32;for(s=48;s<58;s++)n[s-48]=s;for(s=1;s<13;s++)n["f"+s]=s+111;for(s=0;s<10;s++)n["numpad "+s]=s+96;var a,o=t.names=t.title={};for(s in n)o[n[s]]=s;for(a in r)n[a]=r[a]}));lt.code,lt.codes,lt.aliases,lt.names,lt.title;class ut{constructor(e,t,i){!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=y({},this.options_),t=this.options_=y(this.options_,t),this.id_=t.id||t.el&&t.el.id,this.id_||(e=e&&e.id&&e.id()||"no_player",this.id_=e+"_component_"+xe++),this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach((e=>this.addClass(e))),["on","off","one","any","trigger"].forEach((e=>{this[e]=void 0})),!1!==t.evented&&(Ze(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),tt(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let e=this.children_.length-1;0<=e;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e&&(this.options_=y(this.options_,e)),this.options_}el(){return this.el_}createEl(e,t,i){return W(e,t,i)}localize(e,t,i=e){var n=this.player_.language&&this.player_.language(),r=(s=this.player_.languages&&this.player_.languages())&&s[n],s=(n=n&&n.split("-")[0],s&&s[n]);let a=i;return r&&r[e]?a=r[e]:s&&s[e]&&(a=s[e]),t?a.replace(/\{(\d+)\}/g,(function(e,i){return void 0===(i=t[i-1])?e:i})):a}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce(((e,t)=>e.concat(t)),[]);let t=this;for(let i=0;i<e.length;i++)if(!(t=t.getChild(e[i]))||!t.getChild)return;return t}addChild(e,t={},i=this.children_.length){let n,r;if("string"==typeof e){r=nt(e);var s=t.componentClass||r,a=(t.name=r,ut.getComponent(s));if(!a)throw new Error(`Component ${s} does not exist`);if("function"!=typeof a)return null;n=new a(this.player_||this,t)}else n=e;if(n.parentComponent_&&n.parentComponent_.removeChild(n),this.children_.splice(i,0,n),n.parentComponent_=this,"function"==typeof n.id&&(this.childIndex_[n.id()]=n),(r=r||n.name&&nt(n.name()))&&(this.childNameIndex_[r]=n,this.childNameIndex_[it(r)]=n),"function"==typeof n.el&&n.el()){let e=null;this.children_[i+1]&&(this.children_[i+1].el_?e=this.children_[i+1].el_:H(this.children_[i+1])&&(e=this.children_[i+1])),this.contentEl().insertBefore(n.el(),e)}return n}removeChild(e){if((e="string"==typeof e?this.getChild(e):e)&&this.children_){let i=!1;for(let t=this.children_.length-1;0<=t;t--)if(this.children_[t]===e){i=!0,this.children_.splice(t,1);break}var t;i&&(e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[nt(e.name())]=null,this.childNameIndex_[it(e.name())]=null,t=e.el())&&t.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}initChildren(){const e=this.options_.children;if(e){const t=this.options_;let i;const n=ut.getComponent("Tech");(i=Array.isArray(e)?e:Object.keys(e)).concat(Object.keys(this.options_).filter((function(e){return!i.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((t=>{let i,n;return n="string"==typeof t?(i=t,e[i]||this.options_[i]||{}):(i=t.name,t),{name:i,opts:n}})).filter((e=>(e=ut.getComponent(e.opts.componentClass||nt(e.name)))&&!n.isTech(e))).forEach((e=>{var i=e.name;let n=e.opts;!1!==(n=void 0!==t[i]?t[i]:n)&&((n=!0===n?{}:n).playerOptions=this.options_.playerOptions,e=this.addChild(i,n))&&(this[i]=e)}))}}buildCSSClass(){return""}ready(e,t=!1){e&&(this.isReady_?t?e.call(this):this.setTimeout(e,1):(this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e)))}triggerReady(){this.isReady_=!0,this.setTimeout((function(){var e=this.readyQueue_;this.readyQueue_=[],e&&0<e.length&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)}$(e,t){return me(e,t||this.contentEl())}$$(e,t){return fe(e,t||this.contentEl())}hasClass(e){return X(this.el_,e)}addClass(...e){K(this.el_,...e)}removeClass(...e){Q(this.el_,...e)}toggleClass(e,t){Y(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return ee(this.el_,e)}setAttribute(e,t){te(this.el_,e,t)}removeAttribute(e){ie(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){var n,r;if(void 0===t)return this.el_?-1!==(r=(n=this.el_.style[e]).indexOf("px"))?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+nt(e)],10):0;-1!==(""+(t=null!==t&&t==t?t:0)).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",i||this.trigger("componentresize")}currentDimension(e){let t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");return t=ge(this.el_,e),0!==(t=parseFloat(t))&&!isNaN(t)||(e="offset"+nt(e),t=this.el_[e]),t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(lt.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e,t=0,i=null;function n(){e=!1}this.on("touchstart",(function(n){1===n.touches.length&&(i={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},t=window.performance.now(),e=!0)})),this.on("touchmove",(function(t){var n;(1<t.touches.length||i&&(n=t.touches[0].pageX-i.pageX,t=t.touches[0].pageY-i.pageY,10<Math.sqrt(n*n+t*t)))&&(e=!1)})),this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(n){!(i=null)===e&&window.performance.now()-t<200&&(n.preventDefault(),this.trigger("tap"))}))}enableTouchActivity(){if(this.player()&&this.player().reportUserActivity){const t=je(this.player(),this.player().reportUserActivity);let i;this.on("touchstart",(function(){t(),this.clearInterval(i),i=this.setInterval(t,250)}));var e=function(e){t(),this.clearInterval(i)};this.on("touchmove",t),this.on("touchend",e),this.on("touchcancel",e)}}setTimeout(e,t){var i;return e=je(this,e),this.clearTimersOnDispose_(),i=window.setTimeout((()=>{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e}setInterval(e,t){return e=je(this,e),this.clearTimersOnDispose_(),e=window.setInterval(e,t),this.setIntervalIds_.add(e),e}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e}requestAnimationFrame(e){var t;return this.clearTimersOnDispose_(),e=je(this,e),t=window.requestAnimationFrame((()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()})),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){var i;if(!this.namedRafs_.has(e))return this.clearTimersOnDispose_(),t=je(this,t),i=this.requestAnimationFrame((()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)})),this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((([e,t])=>{this[e].forEach(((e,i)=>this[t](i)))})),this.clearingTimersOnDispose_=!1})))}static registerComponent(e,t){if("string"!=typeof e||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);var i=(i=ut.getComponent("Tech"))&&i.isTech(t),n=ut===t||ut.prototype.isPrototypeOf(t.prototype);if(i||!n){let t;throw t=i?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error(`Illegal component, "${e}"; ${t}.`)}if(e=nt(e),ut.components_||(ut.components_={}),n=ut.getComponent("Player"),"Player"===e&&n&&n.players){const e=n.players;if(i=Object.keys(e),e&&0<i.length&&i.map((t=>e[t])).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return ut.components_[e]=t,ut.components_[it(e)]=t}static getComponent(e){if(e&&ut.components_)return ut.components_[e]}}function dt(e,t,i,n){var r=n,s=i.length-1;if("number"!=typeof r||r<0||s<r)throw new Error(`Failed to execute '${e}' on 'TimeRanges': The index provided (${r}) is non-numeric or out of bounds (0-${s}).`);return i[n][t]}function ht(e){let t;return t=void 0===e||0===e.length?{length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:dt.bind(null,"start",0,e),end:dt.bind(null,"end",1,e)},window.Symbol&&window.Symbol.iterator&&(t[window.Symbol.iterator]=()=>(e||[]).values()),t}function ct(e,t){return Array.isArray(e)?ht(e):void 0===e||void 0===t?ht():ht([[e,t]])}function pt(e,t){e=e<0?0:e;let i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600);var s=Math.floor(t/60%60);return t=Math.floor(t/3600),r=0<(r=isNaN(e)||e===1/0?n=i="-":r)||0<t?r+":":"",n=((r||10<=s)&&n<10?"0"+n:n)+":",i=i<10?"0"+i:i,r+n+i}ut.registerComponent("Component",ut);let mt=pt;function ft(e){mt=e}function gt(){mt=pt}function yt(e,t=e){return mt(e,t)}var _t=Object.freeze({__proto__:null,createTimeRanges:ct,createTimeRange:ct,setFormatTime:ft,resetFormatTime:gt,formatTime:yt});function vt(e,t){let i=0;var n;let r;if(!t)return 0;e&&e.length||(e=ct(0,0));for(let s=0;s<e.length;s++)n=e.start(s),(r=e.end(s))>t&&(r=t),i+=r-n;return i/t}function bt(e){if(e instanceof bt)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:f(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=bt.defaultMessages[this.code]||"")}bt.prototype.code=0,bt.prototype.message="",bt.prototype.status=null,bt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],bt.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let e=0;e<bt.errorTypes.length;e++)bt[bt.errorTypes[e]]=e,bt.prototype[bt.errorTypes[e]]=e;function Tt(e){return null!=e&&"function"==typeof e.then}function St(e){Tt(e)&&e.then(null,(e=>{}))}function wt(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(((t,i,n)=>(e[i]&&(t[i]=e[i]),t)),{cues:e.cues&&Array.prototype.map.call(e.cues,(function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}}))})}const Et="vjs-modal-dialog";class kt extends ut{constructor(e,t){super(e,t),this.handleKeyDown_=e=>this.handleKeyDown(e),this.close_=e=>this.close(e),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=W("div",{className:Et+"-content"},{role:"document"}),this.descEl_=W("p",{className:Et+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),z(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return Et+" vjs-hidden "+super.buildCSSClass()}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){var e;this.opened_||(e=this.player(),this.trigger("beforemodalopen"),this.opened_=!0,!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0)}opened(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}close(){var e;this.opened_&&(e=this.player(),this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary)&&this.dispose()}closeable(e){if("boolean"==typeof e){var t;e=this.closeable_=!!e;let i=this.getChild("closeButton");e&&!i&&(t=this.contentEl_,this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=t,this.on(i,"close",this.close_)),!e&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){var t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),ce(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t),(e=this.getChild("closeButton"))&&i.appendChild(e.el_)}empty(){this.trigger("beforemodalempty"),ue(this.contentEl()),this.trigger("modalempty")}content(e){return void 0!==e&&(this.content_=e),this.content_}conditionalFocus_(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),lt.isEventKey(e,"Escape")&&this.closeable())e.preventDefault(),this.close();else if(lt.isEventKey(e,"Tab")){var t=this.focusableEls_(),i=this.el_.querySelector(":focus");let n;for(let e=0;e<t.length;e++)if(i===t[e]){n=e;break}document.activeElement===this.el_&&(n=0),e.shiftKey&&0===n?(t[t.length-1].focus(),e.preventDefault()):e.shiftKey||n!==t.length-1||(t[0].focus(),e.preventDefault())}}focusableEls_(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,(e=>(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")))}}kt.prototype.options_={pauseOnOpen:!0,temporary:!0},ut.registerComponent("ModalDialog",kt);class Ct extends Ve{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},We(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,n=this.length;i<n;i++)if(this[i]===e){(t=this[i]).off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let n=0,r=this.length;n<r;n++){var i=this[n];if(i.id===e){t=i;break}}return t}}for(const e in Ct.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"})Ct.prototype["on"+e]=null;function xt(e,t){for(let i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)}function It(e,t){for(let i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)}class At extends Ct{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_)&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_)}}class Ot{constructor(e){Ot.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let i=0;function n(e){""+e in this||Object.defineProperty(this,""+e,{get(){return this.cues_[e]}})}var r=e.length;if(this.cues_=e,this.length_=e.length,t<r)for(i=t;i<r;i++)n.call(this,i)}getCueById(e){let t=null;for(let n=0,r=this.length;n<r;n++){var i=this[n];if(i.id===e){t=i;break}}return t}}const Pt={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Lt={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Dt={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Nt={disabled:"disabled",hidden:"hidden",showing:"showing"};class Mt extends Ve{constructor(e={}){super();const t={id:e.id||"vjs_track_"+xe++,kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const e in t)Object.defineProperty(this,e,{get:()=>t[e],set(){}});Object.defineProperty(this,"label",{get:()=>i,set(e){e!==i&&(i=e,this.trigger("labelchange"))}})}}function Rt(e){var t=["protocol","hostname","port","pathname","search","hash","host"],i=document.createElement("a"),n=(i.href=e,{});for(let e=0;e<t.length;e++)n[t[e]]=i[t[e]];return"http:"===n.protocol&&(n.host=n.host.replace(/:80$/,"")),"https:"===n.protocol&&(n.host=n.host.replace(/:443$/,"")),n.protocol||(n.protocol=window.location.protocol),n.host||(n.host=window.location.host),n}function Ut(e){var t;return e.match(/^https?:\/\//)||((t=document.createElement("a")).href=e,e=t.href),e}function jt(e,t=window.location){return(":"===(e=Rt(e)).protocol?t:e).protocol+e.host!==t.protocol+t.host}const Bt=function(e){return"string"==typeof e&&(e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e))?e.pop().toLowerCase():""};var Ft=Object.freeze({__proto__:null,parseUrl:Rt,getAbsoluteURL:Ut,getFileExtension:Bt,isCrossOrigin:jt}),qt=Xt="undefined"!=typeof window?window:void 0!==at?at:"undefined"!=typeof self?self:{},Ht=ot((function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i,n=arguments[t];for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,t.apply(this,arguments)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})),Vt=(Xt=Ht)&&Xt.__esModule&&Object.prototype.hasOwnProperty.call(Xt,"default")?Xt.default:Xt,$t=function(e){var t;return!!e&&("[object Function]"===(t=Wt.call(e))||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt))},Wt=Object.prototype.toString;Zt.httpHandler=function(e,t){return void 0===t&&(t=!1),function(i,n,r){if(i)e(i);else if(400<=n.statusCode&&n.statusCode<=599){if(i=r,t)if(qt.TextDecoder){n=function(e){return void 0===e&&(e=""),e.toLowerCase().split(";").reduce((function(e,t){var i=(t=t.split("="))[0];return t=t[1],"charset"===i.trim()?t.trim():e}),"utf-8")}(n.headers&&n.headers["content-type"]);try{i=new TextDecoder(n).decode(r)}catch(i){}}else i=String.fromCharCode.apply(null,new Uint8Array(r));e({cause:i})}else e(null,r)}};for(var zt=function(e){var t={};return e&&e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase();e=e.slice(i+1).trim(),void 0===t[n]?t[n]=e:Array.isArray(t[n])?t[n].push(e):t[n]=[t[n],e]})),t},Gt=Zt,Xt=Zt,Kt=(Zt.XMLHttpRequest=qt.XMLHttpRequest||function(){},Zt.XDomainRequest="withCredentials"in new Zt.XMLHttpRequest?Zt.XMLHttpRequest:qt.XDomainRequest,["get","put","post","patch","head","delete"]),Qt=function(e){Zt["delete"===e?"del":e]=function(t,i,n){return(i=Jt(t,i,n)).method=e.toUpperCase(),ei(i)}},Yt=0;Yt<Kt.length;Yt++)Qt(Kt[Yt]);function Jt(e,t,i){var n=e;return $t(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=Ht({},t,{uri:e}),n.callback=i,n}function Zt(e,t,i){return ei(t=Jt(e,t,i))}function ei(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,n,r){t||(t=!0,e.callback(i,n,r))};function n(){var e=void 0;if(e=u.response||u.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(u),f)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(l),(e=e instanceof Error?e:new Error(""+(e||"Unknown XMLHttpRequest Error"))).statusCode=0,i(e,g)}function s(){var t,r,s;if(!o)return clearTimeout(l),t=e.useXDR&&void 0===u.status?200:1223===u.status?204:u.status,r=g,s=null,0!==t?(r={body:n(),statusCode:t,method:h,headers:{},url:d,rawRequest:u},u.getAllResponseHeaders&&(r.headers=zt(u.getAllResponseHeaders()))):s=new Error("Internal XMLHttpRequest Error"),i(s,r,r.body)}var a,o,l,u=e.xhr||null,d=(u=u||new(e.cors||e.useXDR?Zt.XDomainRequest:Zt.XMLHttpRequest)).url=e.uri||e.url,h=u.method=e.method||"GET",c=e.body||e.data,p=u.headers=e.headers||{},m=!!e.sync,f=!1,g={body:void 0,headers:{},statusCode:0,method:h,url:d,rawRequest:u};if("json"in e&&!1!==e.json&&(f=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==h)&&"HEAD"!==h&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),c=JSON.stringify(!0===e.json?c:e.json)),u.onreadystatechange=function(){4===u.readyState&&setTimeout(s,0)},u.onload=s,u.onerror=r,u.onprogress=function(){},u.onabort=function(){o=!0},u.ontimeout=r,u.open(h,d,!m,e.username,e.password),m||(u.withCredentials=!!e.withCredentials),!m&&0<e.timeout&&(l=setTimeout((function(){var e;o||(o=!0,u.abort("timeout"),(e=new Error("XMLHttpRequest timeout")).code="ETIMEDOUT",r(e))}),e.timeout)),u.setRequestHeader)for(a in p)p.hasOwnProperty(a)&&u.setRequestHeader(a,p[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return;return 1}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(u.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(u),u.send(c||null),u}function ti(e,t){var i=new window.WebVTT.Parser(window,window.vttjs,window.WebVTT.StringDecoder());const n=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){n.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),0<n.length&&(window.console&&window.console.groupCollapsed&&window.console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach((e=>d.error(e))),window.console)&&window.console.groupEnd&&window.console.groupEnd(),i.flush()}function ii(e,t){var i={uri:e};(e=jt(e))&&(i.cors=e),(e="use-credentials"===t.tech_.crossOrigin())&&(i.withCredentials=e),Gt(i,je(this,(function(e,i,n){if(e)return d.error(e,i);t.loaded_=!0,"function"!=typeof window.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(e=>{if("vttjserror"!==e.type)return ti(n,t);d.error("vttjs failed to load, stopping trying to process "+t.src)})):ti(n,t)})))}Gt.default=Xt;class ni extends Mt{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=y(e,{kind:Dt[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=Nt[e.mode]||"disabled";const i=e.default,n=("metadata"!==e.kind&&"chapters"!==e.kind||(t="hidden"),super(e),this.tech_=e.tech,this.cues_=[],this.activeCues_=[],this.preload_=!1!==this.tech_.preloadTextTracks,new Ot(this.cues_)),r=new Ot(this.activeCues_);let s=!1;this.timeupdateHandler=je(this,(function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,s)&&(this.trigger("cuechange"),s=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))})),this.tech_.one("dispose",(()=>{this.stopTracking()})),"disabled"!==t&&this.startTracking(),Object.defineProperties(this,{default:{get:()=>i,set(){}},mode:{get:()=>t,set(e){Nt[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||ii(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?n:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var e=this.tech_.currentTime(),t=[];for(let n=0,r=this.cues.length;n<r;n++){var i=this.cues[n];i.startTime<=e&&i.endTime>=e&&t.push(i)}if(s=!1,t.length!==this.activeCues_.length)s=!0;else for(let e=0;e<t.length;e++)-1===this.activeCues_.indexOf(t[e])&&(s=!0);this.activeCues_=t,r.setCues_(this.activeCues_)}return r},set(){}}}),e.src?(this.src=e.src,this.preload_||(this.loaded_=!0),(this.preload_||"subtitles"!==e.kind&&"captions"!==e.kind)&&ii(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(window.vttjs&&!(e instanceof window.vttjs.VTTCue)){t=new window.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const i in e)i in t||(t[i]=e[i]);t.id=e.id,t.originalCue_=e}var i=this.tech_.textTracks();for(let e=0;e<i.length;e++)i[e]!==this&&i[e].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){var i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}ni.prototype.allowedEvents_={cuechange:"cuechange"};class ri extends Mt{constructor(e={}){super(e=y(e,{kind:Lt[e.kind]||""}));let t=!1;Object.defineProperty(this,"enabled",{get:()=>t,set(e){"boolean"==typeof e&&e!==t&&(t=e,this.trigger("enabledchange"))}}),e.enabled&&(this.enabled=e.enabled),this.loaded_=!0}}class si extends Mt{constructor(e={}){super(e=y(e,{kind:Pt[e.kind]||""}));let t=!1;Object.defineProperty(this,"selected",{get:()=>t,set(e){"boolean"==typeof e&&e!==t&&(t=e,this.trigger("selectedchange"))}}),e.selected&&(this.selected=e.selected)}}class ai extends Ve{constructor(e={}){let t;super();const i=new ni(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get:()=>t},track:{get:()=>i}}),t=ai.NONE,i.addEventListener("loadeddata",(()=>{t=ai.LOADED,this.trigger({type:"load",target:this})}))}}ai.prototype.allowedEvents_={load:"load"},ai.NONE=0,ai.LOADING=1,ai.LOADED=2,ai.ERROR=3;const oi={audio:{ListClass:class extends Ct{constructor(e=[]){for(let t=e.length-1;0<=t;t--)if(e[t].enabled){xt(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&xt(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,xt(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}},TrackClass:ri,capitalName:"Audio"},video:{ListClass:class extends Ct{constructor(e=[]){for(let t=e.length-1;0<=t;t--)if(e[t].selected){It(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set(){}})}addTrack(e){e.selected&&It(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,It(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}},TrackClass:si,capitalName:"Video"},text:{ListClass:At,TrackClass:ni,capitalName:"Text"}},li=(Object.keys(oi).forEach((function(e){oi[e].getterName=e+"Tracks",oi[e].privateName=e+"Tracks_"})),{remoteText:{ListClass:At,TrackClass:ni,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:class{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let i=0,n=this.trackElements_.length;i<n;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t}removeTrackElement_(e){for(let t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}},TrackClass:ai,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}}),ui=Object.assign({},oi,li);li.names=Object.keys(li),oi.names=Object.keys(oi),ui.names=[].concat(li.names).concat(oi.names),Xt=void 0!==at?at:"undefined"!=typeof window?window:{},at=Yn="undefined"!=typeof document?document:(Yn=Xt["__GLOBAL_DOCUMENT_CACHE@4"])||(Xt["__GLOBAL_DOCUMENT_CACHE@4"]={});var di=Object.create||function(e){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return hi.prototype=e,new hi};function hi(){}function ci(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function pi(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/1e3}return(e=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/))?e[3]?t(e[1],e[2],e[3].replace(":",""),e[4]):59<e[1]?t(e[1],e[2],0,e[4]):t(0,e[1],e[2],e[4]):null}function mi(){this.values=di(null)}function fi(e,t,i,n){var r,s,a=n?e.split(n):[e];for(r in a)"string"==typeof a[r]&&2===(s=a[r].split(i)).length&&t(s[0].trim(),s[1].trim())}((ci.prototype=di(Error.prototype)).constructor=ci).Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},mi.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&0<=(t=parseFloat(t))&&t<=100)&&(this.set(e,t),!0)}};var gi=at.createElement&&at.createElement("textarea"),yi={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},_i={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},vi={v:"title",lang:"lang"},bi={rt:"ruby"};function Ti(e,t){for(var i,n,r,s,a,o,l=e.document.createElement("div"),u=l,d=[];null!==(o=void 0,o=t?(o=(o=t.match(/^([^<]*)(<[^>]*>?)?/))[1]||o[2],t=t.substr(o.length),o):null);)"<"===o[0]?"/"===o[1]?d.length&&d[d.length-1]===o.substr(2).replace(">","")&&(d.pop(),u=u.parentNode):(n=pi(o.substr(1,o.length-2)))?(i=e.document.createProcessingInstruction("timestamp",n),u.appendChild(i)):(n=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/))&&(r=n[1],s=n[3],a=void 0,a=yi[r],i=a?(a=e.document.createElement(a),(r=vi[r])&&s&&(a[r]=s.trim()),a):null)&&(r=u,bi[(s=i).localName]&&bi[s.localName]!==r.localName||(n[2]&&((a=n[2].split(".")).forEach((function(e){var t=/^bg_/.test(e);e=t?e.slice(3):e,_i.hasOwnProperty(e)&&(e=_i[e],i.style[t?"background-color":"color"]=e)})),i.className=a.join(" ")),d.push(n[1]),u.appendChild(i),u=i)):u.appendChild(e.document.createTextNode((s=o,gi.innerHTML=s,s=gi.textContent,gi.textContent="",s)));return l}var Si=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function wi(e){var t=[],i="";if(e&&e.childNodes)for(r(t,e);i=function e(t){var i,n,s;return t&&t.length?(n=(i=t.pop()).textContent||i.innerText)?(s=n.match(/^.*(\n|\r)/))?s[t.length=0]:n:"ruby"===i.tagName?e(t):i.childNodes?(r(t,i),e(t)):void 0:null}(t);)for(var n=0;n<i.length;n++)if(function(e){for(var t=0;t<Si.length;t++){var i=Si[t];if(e>=i[0]&&e<=i[1])return 1}}(i.charCodeAt(n)))return"rtl";return"ltr";function r(e,t){for(var i=t.childNodes.length-1;0<=i;i--)e.push(t.childNodes[i])}}function Ei(){}function ki(e,t,i){Ei.call(this),this.cue=t,this.cueDiv=Ti(e,t.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"},r=(this.applyStyles(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:wi(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv),0);switch(t.positionAlign){case"start":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function Ci(e){var t,i,n,r;e.div&&(t=e.div.offsetHeight,i=e.div.offsetWidth,n=e.div.offsetTop,r=(r=(r=e.div.childNodes)&&r[0])&&r.getClientRects&&r.getClientRects(),e=e.div.getBoundingClientRect(),r=r?Math.max(r[0]&&r[0].height||0,e.height/r.length):0),this.left=e.left,this.right=e.right,this.top=e.top||n,this.height=e.height||t,this.bottom=e.bottom||n+(e.height||t),this.width=e.width||i,this.lineHeight=void 0!==r?r:e.lineHeight}function xi(e,t,i,n){var r,s=new Ci(t),a=t.cue,o=function(e){if("number"==typeof e.line&&(e.snapToLines||0<=e.line&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,n=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&n++;return-1*++n}(a),l=[];if(a.snapToLines){switch(a.vertical){case"":l=["+y","-y"],r="height";break;case"rl":l=["+x","-x"],r="width";break;case"lr":l=["-x","+x"],r="width"}var u=s.lineHeight,d=u*Math.round(o),h=i[r]+u,c=l[0];Math.abs(d)>h&&(d=d<0?-1:1,d*=Math.ceil(h/u)*u),o<0&&(d+=""===a.vertical?i.height:i.width,l=l.reverse()),s.move(c,d)}else{var p=s.lineHeight/i.height*100;switch(a.lineAlign){case"center":o-=p/2;break;case"end":o-=p}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(o,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(o,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(o,"%")})}l=["+y","-x","+x","-y"],s=new Ci(t)}h=function(e,t){for(var r,s=new Ci(e),a=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(i,t[o])||e.within(i)&&e.overlapsAny(n);)e.move(t[o]);if(e.within(i))return e;var l=e.intersectPercentage(i);l<a&&(r=new Ci(e),a=l),e=new Ci(s)}return r||s}(s,l),t.move(h.toCSSCompatValues(i))}function Ii(){}Ei.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},Ei.prototype.formatStyle=function(e,t){return 0===e?0:e+t},(ki.prototype=di(Ei.prototype)).constructor=ki,Ci.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},Ci.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},Ci.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},Ci.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},Ci.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},Ci.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},Ci.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},Ci.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},Ii.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Ii.convertCueToDOMTree=function(e,t){return e&&t?Ti(e,t):null},Ii.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return 1}(t))for(var r,s,a=[],o=Ci.getSimpleBoxPosition(n),l={font:Math.round(.05*o.height*100)/100+"px sans-serif"},u=0;u<t.length;u++)r=new ki(e,s=t[u],l),n.appendChild(r.div),xi(0,r,o,a),s.displayState=r.div,a.push(Ci.getSimpleBoxPosition(r));else for(var d=0;d<t.length;d++)n.appendChild(t[d].displayState)},(Ii.Parser=function(e,t,i){i||(i=t,t={}),t=t||{},this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]}).prototype={reportOrThrowError:function(e){if(!(e instanceof ci))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var n=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),n}function n(e){e.match(/X-TIMESTAMP-MAP/)?fi(e,(function(e,i){var n;"X-TIMESTAMP-MAP"===e&&(e=i,n=new mi,fi(e,(function(e,t){switch(e){case"MPEGT":n.integer(e+"S",t);break;case"LOCA":n.set(e+"L",pi(t))}}),/[^\d]:/,/,/),t.ontimestampmap)&&t.ontimestampmap({MPEGTS:n.get("MPEGTS"),LOCAL:n.get("LOCAL")})}),/=/):fi(e,(function(e,i){var n;"Region"===e&&(e=i,n=new mi,fi(e,(function(e,t){switch(e){case"id":n.set(e,t);break;case"width":n.percent(e,t);break;case"lines":n.integer(e,t);break;case"regionanchor":case"viewportanchor":var i,r=t.split(",");2===r.length&&((i=new mi).percent("x",r[0]),i.percent("y",r[1]),i.has("x")&&i.has("y"))&&(n.set(e+"X",i.get("x")),n.set(e+"Y",i.get("y")));break;case"scroll":n.alt(e,t,["up"])}}),/=/,/\s/),n.has("id"))&&((e=new(t.vttjs.VTTRegion||t.window.VTTRegion)).width=n.get("width",100),e.lines=n.get("lines",3),e.regionAnchorX=n.get("regionanchorX",0),e.regionAnchorY=n.get("regionanchorY",100),e.viewportAnchorX=n.get("viewportanchorX",0),e.viewportAnchorY=n.get("viewportanchorY",100),e.scroll=n.get("scroll",""),t.onregion&&t.onregion(e),t.regionList.push({id:n.get("id"),region:e}))}),/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var r,s=(r=i()).match(/^WEBVTT([ \t].*)?$/);if(!s||!s[0])throw new ci(ci.Errors.BadSignature);t.state="HEADER"}for(var a=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:r=i(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(e){t.cue.align="middle"}if(t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":try{!function(e,t,i){var n=e;function r(){var t=pi(e);if(null===t)throw new ci(ci.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function s(){e=e.replace(/^\s+/,"")}if(s(),t.startTime=r(),s(),"--\x3e"!==e.substr(0,3))throw new ci(ci.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),s(),t.endTime=r(),s();var a=e,o=new mi;fi(a,(function(e,t){switch(e){case"region":for(var n=i.length-1;0<=n;n--)if(i[n].id===t){o.set(e,i[n].region);break}break;case"vertical":o.alt(e,t,["rl","lr"]);break;case"line":var r=t.split(","),s=r[0];o.integer(e,s),o.percent(e,s)&&o.set("snapToLines",!1),o.alt(e,s,["auto"]),2===r.length&&o.alt("lineAlign",r[1],["start","center","end"]);break;case"position":r=t.split(","),o.percent(e,r[0]),2===r.length&&o.alt("positionAlign",r[1],["start","center","end"]);break;case"size":o.percent(e,t);break;case"align":o.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=o.get("region",null),t.vertical=o.get("vertical","");try{t.line=o.get("line","auto")}catch(r){}t.lineAlign=o.get("lineAlign","start"),t.snapToLines=o.get("snapToLines",!0),t.size=o.get("size",100);try{t.align=o.get("align","center")}catch(r){t.align=o.get("align","middle")}try{t.position=o.get("position","auto")}catch(r){t.position=o.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=o.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(r,t.cue,t.regionList)}catch(e){t.reportOrThrowError(e),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(a=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(t.state="ID");continue}}}catch(e){t.reportOrThrowError(e),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),!e.cue&&"HEADER"!==e.state||(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new ci(ci.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var Ai=Ii,Oi={"":1,lr:1,rl:1},Pi={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Li(e){return"string"==typeof e&&!!Pi[e.toLowerCase()]&&e.toLowerCase()}function Di(e,t,i){this.hasBeenReset=!1;var n="",r=!1,s=e,a=t,o=i,l=null,u="",d=!0,h="auto",c="start",p="auto",m="auto",f=100,g="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(e){n=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");s=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");a=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(e){o=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(e){l=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return u},set:function(e){if(!1===(e="string"==typeof e&&!!Oi[e.toLowerCase()]&&e.toLowerCase()))throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");u=e,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return d},set:function(e){d=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return h},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");h=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return c},set:function(e){(e=Li(e))&&(c=e,this.hasBeenReset=!0)}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||100<e)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return m},set:function(e){(e=Li(e))&&(m=e,this.hasBeenReset=!0)}},size:{enumerable:!0,get:function(){return f},set:function(e){if(e<0||100<e)throw new Error("Size must be between 0 and 100.");f=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){if(!(e=Li(e)))throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=e,this.hasBeenReset=!0}}}),this.displayState=void 0}Di.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Ni=Di,Mi={"":!0,up:!0};function Ri(e){return"number"==typeof e&&0<=e&&e<=100}function Ui(){var e=100,t=3,i=0,n=100,r=0,s=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!Ri(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!Ri(e))throw new Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!Ri(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(e){if(!Ri(e))throw new Error("ViewportAnchorY must be between 0 and 100.");s=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!Ri(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return a},set:function(e){!1!==(e="string"==typeof e&&!!Mi[e.toLowerCase()]&&e.toLowerCase())&&(a=e)}}})}var ji=ot((function(e){e=e.exports={WebVTT:Ai,VTTCue:Ni,VTTRegion:Ui};var t=(qt.vttjs=e,qt.WebVTT=e.WebVTT,e.VTTCue),i=e.VTTRegion,n=qt.VTTCue,r=qt.VTTRegion;e.shim=function(){qt.VTTCue=t,qt.VTTRegion=i},e.restore=function(){qt.VTTCue=n,qt.VTTRegion=r},qt.VTTCue||e.shim()}));ji.WebVTT,ji.VTTCue,ji.VTTRegion;class Bi extends ut{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=e=>this.onDurationChange(e),this.trackProgress_=e=>this.trackProgress(e),this.trackCurrentTime_=e=>this.trackCurrentTime(e),this.stopTrackingCurrentTime_=e=>this.stopTrackingCurrentTime(e),this.disposeSourceHandler_=e=>this.disposeSourceHandler(e),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",(function(){this.hasStarted_=!0})),this.on("loadstart",(function(){this.hasStarted_=!1})),ui.names.forEach((t=>{t=ui[t],e&&e[t.getterName]&&(this[t.privateName]=e[t.getterName])})),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((t=>{!1===e[`native${t}Tracks`]&&(this[`featuresNative${t}Tracks`]=!1)})),!1===e.nativeCaptions||!1===e.nativeTextTracks?this.featuresNativeTextTracks=!1:!0!==e.nativeCaptions&&!0!==e.nativeTextTracks||(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=!1!==e.preloadTextTracks,this.autoRemoteTextTracks_=new ui.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",(()=>this.setTimeout((()=>this.triggerSourceset(e)),1))),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(je(this,(function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()})),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return ct(0,0)}bufferedPercent(){return vt(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval((function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}),250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(oi.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){(e=[].concat(e)).forEach((e=>{var t=this[e+"Tracks"]()||[];let i=t.length;for(;i--;){var n=t[i];"text"===e&&this.removeRemoteTextTrack(n),t.removeTrack(n)}}))}cleanupAutoTextTracks(){var e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){var i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return void 0!==e&&(this.error_=new bt(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?ct(0,0):ct()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){oi.names.forEach((e=>{var t=oi[e];const i=()=>{this.trigger(e+"trackchange")},n=this[t.getterName]();n.addEventListener("removetrack",i),n.addEventListener("addtrack",i),this.on("dispose",(()=>{n.removeEventListener("removetrack",i),n.removeEventListener("addtrack",i)}))}))}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&g(ji)&&0<Object.keys(ji).length)this.trigger("vttjsloaded");else{const e=document.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",(()=>{e.onload=null,e.onerror=null})),window.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=t=>e.addTrack(t.track),n=t=>e.removeTrack(t.track),r=(t.on("addtrack",i),t.on("removetrack",n),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),s=()=>{r();for(let i=0;i<e.length;i++){var t=e[i];t.removeEventListener("cuechange",r),"showing"===t.mode&&t.addEventListener("cuechange",r)}};s(),e.addEventListener("change",s),e.addEventListener("addtrack",s),e.addEventListener("removetrack",s),this.on("dispose",(function(){t.off("addtrack",i),t.off("removetrack",n),e.removeEventListener("change",s),e.removeEventListener("addtrack",s),e.removeEventListener("removetrack",s);for(let t=0;t<e.length;t++)e[t].removeEventListener("cuechange",r)}))}addTextTrack(e,t,i){if(e)return r={},s=(n=this).textTracks(),r.kind=e,t&&(r.label=t),i&&(r.language=i),r.tech=n,e=new ui.text.TrackClass(r),s.addTrack(e),e;throw new Error("TextTrack kind is required but was not provided");var n,r,s}createRemoteTextTrack(e){return e=y(e,{tech:this}),new li.remoteTextEl.TrackClass(e)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return"boolean"!=typeof t&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),!1===t&&this.ready((()=>this.autoRemoteTextTracks_.addTrack(i.track))),i}removeRemoteTextTrack(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=xe++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",(()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())}))):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return Bi.canPlayType(e.type)}static isTech(e){return e.prototype instanceof Bi||e instanceof Bi||e===Bi}static registerTech(e,t){if(Bi.techs_||(Bi.techs_={}),!Bi.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!Bi.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(Bi.canPlaySource)return e=nt(e),Bi.techs_[e]=t,Bi.techs_[it(e)]=t,"Tech"!==e&&Bi.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return Bi.techs_&&Bi.techs_[e]?Bi.techs_[e]:(e=nt(e),window&&window.videojs&&window.videojs[e]?(d.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),window.videojs[e]):void 0)}}ui.names.forEach((function(e){const t=ui[e];Bi.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Bi.prototype.featuresVolumeControl=!0,Bi.prototype.featuresMuteControl=!0,Bi.prototype.featuresFullscreenResize=!1,Bi.prototype.featuresPlaybackRate=!1,Bi.prototype.featuresProgressEvents=!1,Bi.prototype.featuresSourceset=!1,Bi.prototype.featuresTimeupdateEvents=!1,Bi.prototype.featuresNativeTextTracks=!1,Bi.prototype.featuresVideoFrameCallback=!1,Bi.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){let n=e.sourceHandlers;n=n||(e.sourceHandlers=[]),void 0===i&&(i=n.length),n.splice(i,0,t)},e.canPlayType=function(t){var i,n=e.sourceHandlers||[];for(let e=0;e<n.length;e++)if(i=n[e].canPlayType(t))return i;return""},e.selectSourceHandler=function(t,i){var n=e.sourceHandlers||[];for(let e=0;e<n.length;e++)if(n[e].canHandleSource(t,i))return n[e];return null},e.canPlaySource=function(t,i){var n=e.selectSourceHandler(t,i);return n?n.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach((function(e){const t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})}),e.prototype),e.prototype.setSource=function(t){let i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:d.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},ut.registerComponent("Tech",Bi),Bi.registerTech("Tech",Bi),Bi.defaultTechOrder_=[];const Fi={},qi={},Hi={};function Vi(e,t,i,n=null){var r="call"+nt(i),s=(r=e.reduce(Gi(r),n),e),a=i,o=t=(n=r===Hi)?null:t[i](r),l=n;for(let e=s.length-1;0<=e;e--){var u=s[e];u[a]&&u[a](l,o)}return t}const $i={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Wi={setCurrentTime:1,setMuted:1,setVolume:1},zi={play:1,pause:1};function Gi(e){return(t,i)=>t===Hi?Hi:i[e]?i[e](t):t}function Xi(e){if(Array.isArray(e)){let t=[];e.forEach((function(e){e=Xi(e),Array.isArray(e)?t=t.concat(e):f(e)&&t.push(e)})),e=t}else e="string"==typeof e&&e.trim()?[Yi({src:e})]:f(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[Yi(e)]:[];return e}const Ki={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Qi=function(e=""){return e=Bt(e),Ki[e.toLowerCase()]||""};function Yi(e){var t;return e.type||(t=Qi(e.src))&&(e.type=t),e}ut.registerComponent("MediaLoader",class extends ut{constructor(e,t,i){if(super(e,y({createEl:!1},t),i),t.playerOptions.sources&&0!==t.playerOptions.sources.length)e.src(t.playerOptions.sources);else for(let i=0,r=t.playerOptions.techOrder;i<r.length;i++){var n=nt(r[i]);let t=Bi.getTech(n);if((t=n?t:ut.getComponent(n))&&t.isSupported()){e.loadTech_(n);break}}}});class Ji extends ut{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=e=>this.handleMouseOver(e),this.handleMouseOut_=e=>this.handleMouseOut(e),this.handleClick_=e=>this.handleClick(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){return t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&d.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex,(e=W(e,t,i)).appendChild(W("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=W("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,z(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)}buildCSSClass(){return"vjs-control vjs-button "+super.buildCSSClass()}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){lt.isEventKey(e,"Space")||lt.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}ut.registerComponent("ClickableComponent",Ji);class Zi extends Ji{constructor(e,t){super(e,t),this.update(),this.update_=e=>this.update(e),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return W("div",{className:"vjs-poster"})}crossOrigin(e){if(void 0===e)return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;null!==e&&"anonymous"!==e&&"use-credentials"!==e?this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):this.$("img")&&(this.$("img").crossOrigin=e)}update(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){e?(this.$("img")||this.el_.appendChild(W("picture",{className:"vjs-poster",tabIndex:-1},{},W("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?St(this.player_.play()):this.player_.pause())}}Zi.prototype.crossorigin=Zi.prototype.crossOrigin,ut.registerComponent("PosterImage",Zi);const en={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function tn(e,t){let i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function nn(e,t,i){try{e.style[t]=i}catch(e){}}ut.registerComponent("TextTrackDisplay",class extends ut{constructor(e,t,i){super(e,t,i);const n=e=>this.updateDisplay(e);e.on("loadstart",(e=>this.toggleDisplay(e))),e.on("texttrackchange",n),e.on("loadedmetadata",(e=>this.preselectTrack(e))),e.ready(je(this,(function(){if(e.tech_&&e.tech_.featuresNativeTextTracks)this.hide();else{e.on("fullscreenchange",n),e.on("playerresize",n);const i=window.screen.orientation||window,r=window.screen.orientation?"change":"orientationchange";i.addEventListener(r,n),e.on("dispose",(()=>i.removeEventListener(r,n)));var t=this.options_.playerOptions.tracks||[];for(let e=0;e<t.length;e++)this.player_.addRemoteTextTrack(t[e],!0);this.preselectTrack()}})))}preselectTrack(){var e={captions:1,subtitles:1},t=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage;let n,r,s;for(let o=0;o<t.length;o++){var a=t[o];i&&i.enabled&&i.language&&i.language===a.language&&a.kind in e?s=a.kind!==i.kind&&s||a:i&&!i.enabled?(s=null,n=null,r=null):a.default&&("descriptions"!==a.kind||n?a.kind in e&&!r&&(r=a):n=a)}s?s.mode="showing":r?r.mode="showing":n&&(n.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){"function"==typeof window.WebVTT&&window.WebVTT.processCues(window,[],this.el_)}updateDisplay(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){var i=[];for(let t=0;t<e.length;++t){var n=e[t];"showing"===n.mode&&i.push(n)}this.updateForTrack(i)}else{let t=null,i=null,n=e.length;for(;n--;){var r=e[n];"showing"===r.mode&&("descriptions"===r.kind?t=r:i=r)}i?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(i)):t&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(t))}}updateDisplayState(e){var t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let n=i.length;for(;n--;){var r,s=i[n];s&&(s=s.displayState,t.color&&(s.firstChild.style.color=t.color),t.textOpacity&&nn(s.firstChild,"color",tn(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(s.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&nn(s.firstChild,"backgroundColor",tn(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?nn(s,"backgroundColor",tn(t.windowColor,t.windowOpacity)):s.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?s.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===t.edgeStyle?s.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===t.edgeStyle?s.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===t.edgeStyle&&(s.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),t.fontPercent&&1!==t.fontPercent&&(r=window.parseFloat(s.style.fontSize),s.style.fontSize=r*t.fontPercent+"px",s.style.height="auto",s.style.top="auto"),t.fontFamily)&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?s.firstChild.style.fontVariant="small-caps":s.firstChild.style.fontFamily=en[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),"function"==typeof window.WebVTT&&!e.every((e=>!e.activeCues))){var t=[];for(let n=0;n<e.length;++n){var i=e[n];for(let e=0;e<i.activeCues.length;++e)t.push(i.activeCues[e])}window.WebVTT.processCues(window,t,this.el_);for(let t=0;t<e.length;++t){var n=e[t];for(let e=0;e<n.activeCues.length;++e){var r=n.activeCues[e].displayState;K(r,"vjs-text-track-cue","vjs-text-track-cue-"+(n.language||t)),n.language&&te(r,"lang",n.language)}this.player_.textTrackSettings&&this.updateDisplayState(n)}}}}),ut.registerComponent("LoadingSpinner",class extends ut{createEl(){var e=this.player_.isAudio(),t=(e=this.localize(e?"Audio Player":"Video Player"),e=W("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[e])}),super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"}));return t.appendChild(e),t}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}});class rn extends Ji{createEl(e,t={},i={}){return(t=W("button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i))).appendChild(W("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(t),t}addChild(e,t={}){var i=this.constructor.name;return d.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),ut.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){lt.isEventKey(e,"Space")||lt.isEventKey(e,"Enter")?e.stopPropagation():super.handleKeyDown(e)}}ut.registerComponent("Button",rn);class sn extends rn{constructor(e,t){super(e,t),this.mouseused_=!1,this.on("mousedown",(e=>this.handleMouseDown(e)))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY)St(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{const i=(e=this.player_.getChild("controlBar"))&&e.getChild("playToggle");i?(e=()=>i.focus(),Tt(t)?t.then(e,(()=>{})):this.setTimeout(e,1)):this.player_.tech(!0).focus()}}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}sn.prototype.controlText_="Play Video",ut.registerComponent("BigPlayButton",sn),ut.registerComponent("CloseButton",class extends rn{constructor(e,t){super(e,t),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return"vjs-close-button "+super.buildCSSClass()}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){lt.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class an extends rn{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.on(e,"play",(e=>this.handlePlay(e))),this.on(e,"pause",(e=>this.handlePause(e))),t.replay&&this.on(e,"ended",(e=>this.handleEnded(e)))}buildCSSClass(){return"vjs-play-control "+super.buildCSSClass()}handleClick(e){this.player_.paused()?St(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(e=>this.handleSeeked(e)))}}an.prototype.controlText_="Play",ut.registerComponent("PlayToggle",an);class on extends ut{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],(e=>this.updateContent(e))),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),i=W("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(i),this.contentEl_=W("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=yt(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(()=>{if(this.contentEl_){let e=this.textNode_;e&&this.contentEl_.firstChild!==e&&(e=null,d.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=document.createTextNode(this.formattedTime_),this.textNode_&&(e?this.contentEl_.replaceChild(this.textNode_,e):this.contentEl_.appendChild(this.textNode_))}})))}updateContent(e){}}on.prototype.labelText_="Time",on.prototype.controlText_="Time",ut.registerComponent("TimeDisplay",on);class ln extends on{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}ln.prototype.labelText_="Current Time",ln.prototype.controlText_="Current Time",ut.registerComponent("CurrentTimeDisplay",ln);class un extends on{constructor(e,t){super(e,t),t=e=>this.updateContent(e),this.on(e,"durationchange",t),this.on(e,"loadstart",t),this.on(e,"loadedmetadata",t)}buildCSSClass(){return"vjs-duration"}updateContent(e){var t=this.player_.duration();this.updateTextNode_(t)}}un.prototype.labelText_="Duration",un.prototype.controlText_="Duration",ut.registerComponent("DurationDisplay",un),ut.registerComponent("TimeDivider",class extends ut{createEl(){var e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}});class dn extends on{constructor(e,t){super(e,t),this.on(e,"durationchange",(e=>this.updateContent(e)))}buildCSSClass(){return"vjs-remaining-time"}createEl(){var e=super.createEl();return!1!==this.options_.displayNegative&&e.insertBefore(W("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if("number"==typeof this.player_.duration()){let e;e=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(e)}}}dn.prototype.labelText_="Remaining Time",dn.prototype.controlText_="Remaining Time",ut.registerComponent("RemainingTimeDisplay",dn),ut.registerComponent("LiveDisplay",class extends ut{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",(e=>this.updateShowing(e)))}createEl(){var e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=W("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(W("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}});class hn extends rn{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=e=>this.updateLiveEdgeStatus(e),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){var e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=W("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}function cn(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}hn.prototype.controlText_="Seek to live, currently playing live",ut.registerComponent("SeekToLive",hn),Xt=Object.freeze({__proto__:null,clamp:cn});class pn extends ut{constructor(e,t){super(e,t),this.handleMouseDown_=e=>this.handleMouseDown(e),this.handleMouseUp_=e=>this.handleMouseUp(e),this.handleKeyDown_=e=>this.handleKeyDown(e),this.handleClick_=e=>this.handleClick(e),this.handleMouseMove_=e=>this.handleMouseMove(e),this.update_=e=>this.update(e),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){var e;this.enabled()&&(e=this.bar.el_.ownerDocument,this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1)}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||x||e.preventDefault(),ne(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){var t=this.bar.el_.ownerDocument;re(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(this.el_&&this.bar){const e=this.getProgress();return e!==this.progress_&&(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",(()=>{var t=this.vertical()?"height":"width";this.bar.el().style[t]=(100*e).toFixed(2)+"%"}))),e}}getProgress(){return Number(cn(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){return e=oe(this.el_,e),this.vertical()?e.y:e.x}handleKeyDown(e){lt.isEventKey(e,"Left")||lt.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):lt.isEventKey(e,"Right")||lt.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}ut.registerComponent("Slider",pn);const mn=(e,t)=>cn(e/t*100,0,100).toFixed(2)+"%";ut.registerComponent("LoadProgressBar",class extends ut{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",(e=>this.update(e)))}createEl(){var e=super.createEl("div",{className:"vjs-load-progress"}),t=W("span",{className:"vjs-control-text"}),i=W("span",{textContent:this.localize("Loaded")}),n=document.createTextNode(": ");return this.percentageEl_=W("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(n),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",(()=>{var e=this.player_.liveTracker,t=this.player_.buffered(),i=(e=e&&e.isLive()?e.seekableEnd():this.player_.duration(),this.player_.bufferedEnd()),n=this.partEls_;e=mn(i,e),this.percent_!==e&&(this.el_.style.width=e,z(this.percentageEl_,e),this.percent_=e);for(let e=0;e<t.length;e++){var r=t.start(e),s=t.end(e);let a=n[e];a||(a=this.el_.appendChild(W()),n[e]=a),a.dataset.start===r&&a.dataset.end===s||(a.dataset.start=r,a.dataset.end=s,a.style.left=mn(r,i),a.style.width=mn(s-r,i))}for(let e=n.length;e>t.length;e--)this.el_.removeChild(n[e-1]);n.length=t.length}))}}),ut.registerComponent("TimeTooltip",class extends ut{constructor(e,t){super(e,t),this.update=Be(je(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){var n=ae(this.el_),r=se(this.player_.el());if(t=e.width*t,r&&n){var s=e.left-r.left+t;t=e.width-t+(r.right-e.right);let a=n.width/2;s<a?a+=a-s:t<a&&(a=t),a<0?a=0:a>n.width&&(a=n.width),a=Math.round(a),this.el_.style.right=`-${a}px`,this.write(i)}}write(e){z(this.el_,e)}updateTime(e,t,i,n){this.requestNamedAnimationFrame("TimeTooltip#updateTime",(()=>{let r;var s,a,o=this.player_.duration();r=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((a=(s=this.player_.liveTracker.liveWindow())-t*s)<1?"":"-")+yt(a,s):yt(i,o),this.update(e,t,r),n&&n()}))}});class fn extends ut{constructor(e,t){super(e,t),this.update=Be(je(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var i,n=this.getChild("timeTooltip");n&&(i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),n.updateTime(e,t,i))}}fn.prototype.options_={children:[]},j||w||fn.prototype.options_.children.push("timeTooltip"),ut.registerComponent("PlayProgressBar",fn);class gn extends ut{constructor(e,t){super(e,t),this.update=Be(je(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){var i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,(()=>{this.el_.style.left=e.width*t+"px"}))}}gn.prototype.options_={children:["timeTooltip"]},ut.registerComponent("MouseTimeDisplay",gn);class yn extends pn{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=je(this,this.update),this.update=Be(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.on(document,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){"hidden"===document.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if("hidden"!==document.visibilityState){const e=super.update();return this.requestNamedAnimationFrame("SeekBar#update",(()=>{var t=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),i=this.player_.liveTracker;let n=this.player_.duration();i&&i.isLive()&&(n=this.player_.liveTracker.liveCurrentTime()),this.percent_!==e&&(this.el_.setAttribute("aria-valuenow",(100*e).toFixed(2)),this.percent_=e),this.currentTime_===t&&this.duration_===n||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[yt(t,n),yt(n,n)],"{1} of {2}")),this.currentTime_=t,this.duration_=n),this.bar&&this.bar.update(se(this.el()),this.getProgress())})),e}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){var e=this.getCurrentTime_();let t;var i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){pe(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(pe(e)){let r;if(t||this.player_.scrubbing()||this.player_.scrubbing(!0),t=this.calculateDistance(e),(e=this.player_.liveTracker)&&e.isLive()){if(.99<=t)return void e.seekToLiveEdge();var i=e.seekableStart(),n=e.liveCurrentTime();if((r=(r=(r=i+t*e.liveWindow())>=n?n:r)<=i?i+.1:r)===1/0)return}else(r=t*this.player_.duration())===this.player_.duration()&&(r-=.1);this.userSeek_(r)}}enable(){super.enable();var e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();var e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?St(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+5)}stepBack(){this.userSeek_(this.player_.currentTime()-5)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){var t,i=this.player_.liveTracker;lt.isEventKey(e,"Space")||lt.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):lt.isEventKey(e,"Home")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):lt.isEventKey(e,"End")?(e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(lt(e))?(e.preventDefault(),e.stopPropagation(),t=10*(lt.codes[lt(e)]-lt.codes[0])/100,i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):lt.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):lt.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in document&&"visibilityState"in document&&this.off(document,"visibilitychange",this.toggleVisibility_),super.dispose()}}yn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},j||w||yn.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),ut.registerComponent("SeekBar",yn);class _n extends ut{constructor(e,t){super(e,t),this.handleMouseMove=Be(je(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=Be(je(this,this.handleMouseSeek),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.handleMouseDownHandler_=e=>this.handleMouseDown(e),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){var t,i,n,r,s=this.getChild("seekBar");s&&(t=s.getChild("playProgressBar"),i=s.getChild("mouseTimeDisplay"),t||i)&&(n=ae(r=s.el()),r=cn(r=oe(r,e).x,0,1),i&&i.update(n,r),t)&&t.update(n,s.getProgress())}handleMouseSeek(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){var e;this.children().forEach((e=>e.disable&&e.disable())),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())&&(e=this.getChild("seekBar"),this.player_.scrubbing(!1),e.videoWasPlaying)&&St(this.player_.play())}enable(){this.children().forEach((e=>e.enable&&e.enable())),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}_n.prototype.options_={children:["seekBar"]},ut.registerComponent("ProgressControl",_n);class vn extends rn{constructor(e,t){super(e,t),this.on(e,["enterpictureinpicture","leavepictureinpicture"],(e=>this.handlePictureInPictureChange(e))),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],(e=>this.handlePictureInPictureEnabledChange(e))),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(()=>{"audio"===e.currentType().substring(0,5)||e.audioPosterMode()||e.audioOnlyMode()?(e.isInPictureInPicture()&&e.exitPictureInPicture(),this.hide()):this.show()})),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control "+super.buildCSSClass()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}}vn.prototype.controlText_="Picture-in-Picture",ut.registerComponent("PictureInPictureToggle",vn);class bn extends rn{constructor(e,t){super(e,t),this.on(e,"fullscreenchange",(e=>this.handleFullscreenChange(e))),!1===document[e.fsApi_.fullscreenEnabled]&&this.disable()}buildCSSClass(){return"vjs-fullscreen-control "+super.buildCSSClass()}handleFullscreenChange(e){this.player_.isFullscreen()?this.controlText("Exit Fullscreen"):this.controlText("Fullscreen")}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}bn.prototype.controlText_="Fullscreen",ut.registerComponent("FullscreenToggle",bn),ut.registerComponent("VolumeLevel",class extends ut{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}),ut.registerComponent("VolumeLevelTooltip",class extends ut{constructor(e,t){super(e,t),this.update=Be(je(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,n){if(!i){i=se(this.el_);var r=se(this.player_.el());if(t=e.width*t,!r||!i)return;var s=e.left-r.left+t;t=e.width-t+(r.right-e.right);let n=i.width/2;s<n?n+=n-s:t<n&&(n=t),n<0?n=0:n>i.width&&(n=i.width),this.el_.style.right=`-${n}px`}this.write(n+"%")}write(e){z(this.el_,e)}updateVolume(e,t,i,n,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(()=>{this.update(e,t,i,n.toFixed(0)),r&&r()}))}});class Tn extends ut{constructor(e,t){super(e,t),this.update=Be(je(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){var n=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,n,(()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"}))}}Tn.prototype.options_={children:["volumeLevelTooltip"]},ut.registerComponent("MouseVolumeLevelDisplay",Tn);class Sn extends pn{constructor(e,t){super(e,t),this.on("slideractive",(e=>this.updateLastVolume_(e))),this.on(e,"volumechange",(e=>this.updateARIAAttributes(e))),e.ready((()=>this.updateARIAAttributes()))}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){pe(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,i,n,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=se(n=this.el()),i=this.vertical(),n=oe(n,e),n=cn(n=i?n.y:n.x,0,1),r.update(t,n,i)),pe(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(100*this.player_.volume())}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",(()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)}))}}Sn.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},j||w||Sn.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),Sn.prototype.playerEvent="volumechange",ut.registerComponent("VolumeBar",Sn);class wn extends ut{constructor(e,t={}){var i,n;t.vertical=t.vertical||!1,void 0!==t.volumeBar&&!g(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),i=this,(n=e).tech_&&!n.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(n,"loadstart",(function(){n.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})),this.throttledHandleMouseMove=Be(je(this,this.handleMouseMove),30),this.handleMouseUpHandler_=e=>this.handleMouseUp(e),this.on("mousedown",(e=>this.handleMouseDown(e))),this.on("touchstart",(e=>this.handleMouseDown(e))),this.on("mousemove",(e=>this.handleMouseMove(e))),this.on(this.volumeBar,["focus","slideractive"],(()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")})),this.on(this.volumeBar,["blur","sliderinactive"],(()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")}))}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:"vjs-volume-control vjs-control "+e})}handleMouseDown(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}wn.prototype.options_={children:["volumeBar"]},ut.registerComponent("VolumeControl",wn);class En extends rn{constructor(e,t){var i,n;super(e,t),i=this,(n=e).tech_&&!n.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(n,"loadstart",(function(){n.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})),this.on(e,["loadstart","volumechange"],(e=>this.update(e)))}buildCSSClass(){return"vjs-mute-control "+super.buildCSSClass()}handleClick(e){var t=this.player_.volume(),i=this.player_.lastVolume_();0===t?(this.player_.volume(i<.1?.1:i),this.player_.muted(!1)):this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){var e=this.player_.volume();let t=3;j&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2),Q(this.el_,[0,1,2,3].reduce(((e,t)=>e+(t?" ":"")+"vjs-vol-"+t),"")),K(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}En.prototype.controlText_="Mute",ut.registerComponent("MuteToggle",En);class kn extends ut{constructor(e,t={}){void 0!==t.inline?t.inline=t.inline:t.inline=!0,void 0!==t.volumeControl&&!g(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=e=>this.handleKeyPress(e),this.on(e,["loadstart"],(e=>this.volumePanelState_(e))),this.on(this.muteToggle,"keyup",(e=>this.handleKeyPress(e))),this.on(this.volumeControl,"keyup",(e=>this.handleVolumeControlKeyUp(e))),this.on("keydown",(e=>this.handleKeyPress(e))),this.on("mouseover",(e=>this.handleMouseOver(e))),this.on("mouseout",(e=>this.handleMouseOut(e))),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:"vjs-volume-panel vjs-control "+e})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){lt.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),Le(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),De(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){lt.isEventKey(e,"Esc")&&this.handleMouseOut()}}kn.prototype.options_={children:["muteToggle","volumeControl"]},ut.registerComponent("VolumePanel",kn),ut.registerComponent("SkipForward",class extends rn{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} `+super.buildCSSClass()}handleClick(e){var t=this.player_.currentTime(),i=(i=this.player_.liveTracker)&&i.isLive()?i.seekableEnd():this.player_.duration();let n;n=t+this.skipTime<=i?t+this.skipTime:i,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}});class Cn extends rn{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} `+super.buildCSSClass()}handleClick(e){var t,i=this.player_.currentTime();let n;n=(t=(t=this.player_.liveTracker)&&t.isLive()&&t.seekableStart())&&i-this.skipTime<=t?t:i>=this.skipTime?i-this.skipTime:0,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Cn.prototype.controlText_="Skip Backward",ut.registerComponent("SkipBackward",Cn);class xn extends ut{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",(e=>this.handleKeyDown(e))),this.boundHandleBlur_=e=>this.handleBlur(e),this.boundHandleTapClick_=e=>this.handleTapClick(e)}addEventListenerForItem(e){e instanceof ut&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof ut&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){(e=this.addChild(e))&&this.addEventListenerForItem(e)}createEl(){var e=this.options_.contentElType||"ul";return(this.contentEl_=W(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),e=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"})).appendChild(this.contentEl_),Le(e,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||document.activeElement;this.children().some((e=>e.el()===t))||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()}handleTapClick(e){var t;this.menuButton_&&(this.menuButton_.unpressButton(),t=this.children(),Array.isArray(t))&&(t=t.filter((t=>t.el()===e.target))[0])&&"CaptionSettingsMenuItem"!==t.name()&&this.menuButton_.focus()}handleKeyDown(e){lt.isEventKey(e,"Left")||lt.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(lt.isEventKey(e,"Right")||lt.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),0<t.length&&(e<0?e=0:e>=t.length&&(e=t.length-1),t[this.focusedChild_=e].el_.focus())}}ut.registerComponent("Menu",xn);class In extends ut{constructor(e,t={}){super(e,t),this.menuButton_=new rn(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true"),e=rn.prototype.buildCSSClass(),this.menuButton_.el_.className=this.buildCSSClass()+" "+e,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0,t=e=>this.handleClick(e),this.handleMenuKeyUp_=e=>this.handleMenuKeyUp(e),this.on(this.menuButton_,"tap",t),this.on(this.menuButton_,"click",t),this.on(this.menuButton_,"keydown",(e=>this.handleKeyDown(e))),this.on(this.menuButton_,"mouseenter",(()=>{this.addClass("vjs-hover"),this.menu.show(),Le(document,"keyup",this.handleMenuKeyUp_)})),this.on("mouseleave",(e=>this.handleMouseLeave(e))),this.on("keydown",(e=>this.handleSubmenuKeyDown(e)))}update(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){var e,t=new xn(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=W("li",{className:"vjs-menu-title",textContent:nt(this.options_.title),tabIndex:-1}),e=new ut(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;e<this.items.length;e++)t.addItem(this.items[e]);return t}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}buildWrapperCSSClass(){let e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${rn.prototype.buildCSSClass()} `+super.buildCSSClass()}buildCSSClass(){let e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup",`vjs-menu-button ${e} `+super.buildCSSClass()}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),De(document,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){lt.isEventKey(e,"Esc")||lt.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),lt.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):!lt.isEventKey(e,"Up")&&!lt.isEventKey(e,"Down")||this.buttonPressed_||(e.preventDefault(),this.pressButton())}handleMenuKeyUp(e){(lt.isEventKey(e,"Esc")||lt.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(lt.isEventKey(e,"Esc")||lt.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),lt.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))}pressButton(){this.enabled_&&(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),j&&V()||this.menu.focus())}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}ut.registerComponent("MenuButton",In);class An extends In{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),i){const e=je(this,this.update);i.addEventListener("removetrack",e),i.addEventListener("addtrack",e),i.addEventListener("labelchange",e),this.player_.on("ready",e),this.player_.on("dispose",(function(){i.removeEventListener("removetrack",e),i.removeEventListener("addtrack",e),i.removeEventListener("labelchange",e)}))}}}ut.registerComponent("TrackButton",An);const On=["Tab","Esc","Up","Down","Right","Left"];class Pn extends Ji{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,i){return this.nonIconControl=!0,(t=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i)).replaceChild(W("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),t.querySelector(".vjs-icon-placeholder")),t}handleKeyDown(e){On.some((t=>lt.isEventKey(e,t)))||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}ut.registerComponent("MenuItem",Pn);class Ln extends Pn{constructor(e,t){var i=t.track;const n=e.textTracks(),r=(t.label=i.label||i.language||"Unknown",t.selected="showing"===i.mode,super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean),(...e)=>{this.handleTracksChange.apply(this,e)}),s=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),n.addEventListener("change",r),n.addEventListener("selectedlanguagechange",s),this.on("dispose",(function(){e.off(["loadstart","texttrackchange"],r),n.removeEventListener("change",r),n.removeEventListener("selectedlanguagechange",s)})),void 0===n.onchange){let e;this.on(["tap","click"],(function(){if("object"!=typeof window.Event)try{e=new window.Event("change")}catch(e){}e||(e=document.createEvent("Event")).initEvent("change",!0,!0),n.dispatchEvent(e)}))}this.handleTracksChange()}handleClick(e){var t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let e=0;e<i.length;e++){var n=i[e];-1!==this.kinds.indexOf(n.kind)&&(n===t?"showing"!==n.mode&&(n.mode="showing"):"disabled"!==n.mode&&(n.mode="disabled"))}}handleTracksChange(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){var t;"showing"!==this.track.mode||(t=this.player_.cache_.selectedLanguage)&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind||(this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind})}dispose(){this.track=null,super.dispose()}}ut.registerComponent("TextTrackMenuItem",Ln);class Dn extends Ln{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){var t=this.player().textTracks();let i=!0;for(let e=0,r=t.length;e<r;e++){var n=t[e];if(-1<this.options_.kinds.indexOf(n.kind)&&"showing"===n.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){var t=this.player().textTracks();let i=!0;for(let e=0,r=t.length;e<r;e++){var n=t[e];if(-1<["captions","descriptions","subtitles"].indexOf(n.kind)&&"showing"===n.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}ut.registerComponent("OffTextTrackMenuItem",Dn);class Nn extends An{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Ln){let i;this.label_&&(i=this.label_+" off"),e.push(new Dn(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let i=0;i<n.length;i++){var r,s=n[i];-1<this.kinds_.indexOf(s.kind)&&((r=new t(this.player_,{track:s,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1})).addClass(`vjs-${s.kind}-menu-item`),e.push(r))}return e}}ut.registerComponent("TextTrackButton",Nn);class Mn extends Pn{constructor(e,t){var i=t.track,n=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=n.text,t.selected=n.startTime<=r&&r<n.endTime,super(e,t),this.track=i,this.cue=n}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}ut.registerComponent("ChaptersTrackMenuItem",Mn);class Rn extends Nn{constructor(e,t,i){super(e,t,i),this.selectCurrentItem_=()=>{this.items.forEach((e=>{e.selected(this.track_.activeCues[0]===e.cue)}))}}buildCSSClass(){return"vjs-chapters-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-chapters-button "+super.buildWrapperCSSClass()}update(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),super.update()):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&super.update())}setTrack(e){var t;this.track_!==e&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&((t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null),this.track_=e,this.track_)&&(this.track_.mode="hidden",(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_))}findChaptersTrack(){var e=this.player_.textTracks()||[];for(let i=e.length-1;0<=i;i--){var t=e[i];if(t.kind===this.kind_)return t}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(nt(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){var e=[];if(this.track_){var t=this.track_.cues;if(t)for(let n=0,r=t.length;n<r;n++){var i=t[n];i=new Mn(this.player_,{track:this.track_,cue:i}),e.push(i)}}return e}}Rn.prototype.kind_="chapters",Rn.prototype.controlText_="Chapters",ut.registerComponent("ChaptersButton",Rn);class Un extends Nn{constructor(e,t,i){super(e,t,i);const n=e.textTracks(),r=je(this,this.handleTracksChange);n.addEventListener("change",r),this.on("dispose",(function(){n.removeEventListener("change",r)}))}handleTracksChange(e){var t=this.player().textTracks();let i=!1;for(let e=0,r=t.length;e<r;e++){var n=t[e];if(n.kind!==this.kind_&&"showing"===n.mode){i=!0;break}}i?this.disable():this.enable()}buildCSSClass(){return"vjs-descriptions-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-descriptions-button "+super.buildWrapperCSSClass()}}Un.prototype.kind_="descriptions",Un.prototype.controlText_="Descriptions",ut.registerComponent("DescriptionsButton",Un);class jn extends Nn{constructor(e,t,i){super(e,t,i)}buildCSSClass(){return"vjs-subtitles-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-subtitles-button "+super.buildWrapperCSSClass()}}jn.prototype.kind_="subtitles",jn.prototype.controlText_="Subtitles",ut.registerComponent("SubtitlesButton",jn);class Bn extends Ln{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}ut.registerComponent("CaptionSettingsMenuItem",Bn);class Fn extends Nn{constructor(e,t,i){super(e,t,i)}buildCSSClass(){return"vjs-captions-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-captions-button "+super.buildWrapperCSSClass()}createItems(){var e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(e.push(new Bn(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Fn.prototype.kind_="captions",Fn.prototype.controlText_="Captions",ut.registerComponent("CaptionsButton",Fn);class qn extends Ln{createEl(e,t,i){return t=(e=super.createEl(e,t,i)).querySelector(".vjs-menu-item-text"),"captions"===this.options_.track.kind&&(t.appendChild(W("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(W("span",{className:"vjs-control-text",textContent:" "+this.localize("Captions")}))),e}}ut.registerComponent("SubsCapsMenuItem",qn);class Hn extends Nn{constructor(e,t={}){super(e,t),this.label_="subtitles",-1<["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)&&(this.label_="captions"),this.menuButton_.controlText(nt(this.label_))}buildCSSClass(){return"vjs-subs-caps-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-subs-caps-button "+super.buildWrapperCSSClass()}createItems(){let e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(e.push(new Bn(this.player_,{kind:this.label_})),this.hideThreshold_+=1),super.createItems(e,qn)}}Hn.prototype.kinds_=["captions","subtitles"],Hn.prototype.controlText_="Subtitles",ut.registerComponent("SubsCapsButton",Hn);class Vn extends Pn{constructor(e,t){var i=t.track;const n=e.audioTracks(),r=(t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`),(...e)=>{this.handleTracksChange.apply(this,e)});n.addEventListener("change",r),this.on("dispose",(()=>{n.removeEventListener("change",r)}))}createEl(e,t,i){return t=(e=super.createEl(e,t,i)).querySelector(".vjs-menu-item-text"),"main-desc"===this.options_.track.kind&&(t.appendChild(W("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(W("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),e}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){var t=this.player_.audioTracks();for(let e=0;e<t.length;e++){var i=t[e];i!==this.track&&(i.enabled=i===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}ut.registerComponent("AudioTrackMenuItem",Vn);class $n extends An{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t)}buildCSSClass(){return"vjs-audio-button "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-audio-button "+super.buildWrapperCSSClass()}createItems(e=[]){this.hideThreshold_=1;var t=this.player_.audioTracks();for(let n=0;n<t.length;n++){var i=t[n];e.push(new Vn(this.player_,{track:i,selectable:!0,multiSelectable:!1}))}return e}}$n.prototype.controlText_="Audio Track",ut.registerComponent("AudioTrackButton",$n);class Wn extends Pn{constructor(e,t){var i=t.rate,n=parseFloat(i,10);t.label=i,t.selected=n===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,this.rate=n,this.on(e,"ratechange",(e=>this.update(e)))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Wn.prototype.contentElType="button",ut.registerComponent("PlaybackRateMenuItem",Wn);class zn extends In{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",(e=>this.updateVisibility(e))),this.on(e,"ratechange",(e=>this.updateLabel(e))),this.on(e,"playbackrateschange",(e=>this.handlePlaybackRateschange(e)))}createEl(){var e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=W("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return"vjs-playback-rate "+super.buildCSSClass()}buildWrapperCSSClass(){return"vjs-playback-rate "+super.buildWrapperCSSClass()}createItems(){var e=this.playbackRates(),t=[];for(let i=e.length-1;0<=i;i--)t.push(new Wn(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0<this.playbackRates().length}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}zn.prototype.controlText_="Playback Rate",ut.registerComponent("PlaybackRateMenuButton",zn);class Gn extends ut{buildCSSClass(){return"vjs-spacer "+super.buildCSSClass()}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}ut.registerComponent("Spacer",Gn),ut.registerComponent("CustomControlSpacer",class extends Gn{buildCSSClass(){return"vjs-custom-control-spacer "+super.buildCSSClass()}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}});class Xn extends ut{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Xn.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in document&&Xn.prototype.options_.children.splice(Xn.prototype.options_.children.length-1,0,"pictureInPictureToggle"),ut.registerComponent("ControlBar",Xn);class Kn extends kt{constructor(e,t){super(e,t),this.on(e,"error",(e=>this.open(e)))}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}Kn.prototype.options_=Object.assign({},kt.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),ut.registerComponent("ErrorDisplay",Kn);const Qn="vjs-text-track-settings";var Yn,Jn=["#F00","Red"],Zn=["#FFF","White"];const er={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Yn=["#000","Black"],Zn,Jn,Ar=["#0F0","Green"],at=["#00F","Blue"],_s=["#FF0","Yellow"],vs=["#F0F","Magenta"],ha=["#0FF","Cyan"]]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[wa=["1","Opaque"],fa=["0.5","Semi-Transparent"],ma=["0","Transparent"]]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Zn,Yn,Jn,Ar,at,_s,vs,ha]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[wa,fa]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[ma,fa,wa]}};function tr(e,t){if((e=t?t(e):e)&&"none"!==e)return e}er.windowColor.options=er.backgroundColor.options,ut.registerComponent("TextTrackSettings",class extends kt{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=W("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.on(this.$(".vjs-done-button"),"click",(()=>{this.saveSettings(),this.close()})),this.on(this.$(".vjs-default-button"),"click",(()=>{this.setDefaults(),this.updateDisplay()})),p(er,(e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",i="label"){const n=(e=er[e]).id.replace("%s",this.id_),r=[t,n].join(" ").trim();return[`<${i} id="${n}" class="${"label"===i?"vjs-label":""}">`,this.localize(e.label),`</${i}>`,`<select aria-labelledby="${r}">`].concat(e.options.map((e=>{var t=n+"-"+e[1].replace(/\W+/g,"");return[`<option id="${t}" value="${e[0]}" `,`aria-labelledby="${r} ${t}">`,this.localize(e[1]),"</option>"].join("")}))).concat("</select>").join("")}createElFgColor_(){var e="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg vjs-track-setting">',`<legend id="${e}">`,this.localize("Text"),"</legend>",'<span class="vjs-text-color">',this.createElSelect_("color",e),"</span>",'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")}createElBgColor_(){var e="captions-background-"+this.id_;return['<fieldset class="vjs-bg vjs-track-setting">',`<legend id="${e}">`,this.localize("Text Background"),"</legend>",'<span class="vjs-bg-color">',this.createElSelect_("backgroundColor",e),"</span>",'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")}createElWinColor_(){var e="captions-window-"+this.id_;return['<fieldset class="vjs-window vjs-track-setting">',`<legend id="${e}">`,this.localize("Caption Area Background"),"</legend>",'<span class="vjs-window-color">',this.createElSelect_("windowColor",e),"</span>",'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")}createElColors_(){return W("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return W("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})}createElControls_(){var e=this.localize("restore all settings to the default values");return W("div",{className:"vjs-track-settings-controls",innerHTML:[`<button type="button" class="vjs-default-button" title="${e}">`,this.localize("Reset"),`<span class="vjs-control-text"> ${e}</span>`,"</button>",`<button type="button" class="vjs-done-button">${this.localize("Done")}</button>`].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return m(er,((e,t,i)=>{n=this.$(t.selector),t=t.parser;var n=tr(n.options[n.options.selectedIndex].value,t);return void 0!==n&&(e[i]=n),e}),{})}setValues(e){p(er,((t,i)=>{var n=this.$(t.selector),r=e[i],s=t.parser;if(r)for(let e=0;e<n.options.length;e++)if(tr(n.options[e].value,s)===r){n.selectedIndex=e;break}}))}setDefaults(){p(er,(e=>{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t}))}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(Qn))}catch(e){d.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(Qn,JSON.stringify(e)):window.localStorage.removeItem(Qn)}catch(e){d.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;var e=(t=this.player_.controlBar)&&t.subsCapsButton,t=t&&t.captionsButton;e?e.focus():t&&t.focus()}handleLanguagechange(){this.fill()}}),ut.registerComponent("ResizeManager",class extends ut{constructor(e,t){let i=t.ResizeObserver||window.ResizeObserver;super(e,y({createEl:!(i=null!==t.ResizeObserver&&i),reportTouchActivity:!1},t)),this.ResizeObserver=t.ResizeObserver||window.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Fe((()=>{this.resizeHandler()}),100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(this.el_&&this.el_.contentWindow){const e=this.debouncedHandler_;let t=this.unloadListener_=function(){De(this,"resize",e),De(this,"unload",t),t=null};Le(this.el_.contentWindow,"unload",t),Le(this.el_.contentWindow,"resize",e)}},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}});const ir={trackingThreshold:20,liveTolerance:15};function nr(e){const t=e.el();if(!t.resetSourceWatch_){const i={},n=or(e),r=i=>(...n)=>(n=i.apply(t,n),rr(e),n);["append","appendChild","insertAdjacentHTML"].forEach((e=>{t[e]&&(i[e]=t[e],t[e]=r(i[e]))})),Object.defineProperty(t,"innerHTML",y(n,{set:r(n.set)})),t.resetSourceWatch_=()=>{t.resetSourceWatch_=null,Object.keys(i).forEach((e=>{t[e]=i[e]})),Object.defineProperty(t,"innerHTML",n)},e.one("sourceset",t.resetSourceWatch_)}}ut.registerComponent("LiveTracker",class extends ut{constructor(e,t){super(e,y(ir,t,{createEl:!1})),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=e=>this.handlePlay(e),this.handleFirstTimeupdate_=e=>this.handleFirstTimeupdate(e),this.handleSeeked_=e=>this.handleSeeked(e),this.seekToLiveEdge_=e=>this.seekToLiveEdge(e),this.reset_(),this.on(this.player_,"durationchange",(e=>this.handleDurationchange(e))),this.on(this.player_,"canplay",(()=>this.toggleTracking()))}trackLive_(){if((e=this.player_.seekable())&&e.length){var e=Number(window.performance.now().toFixed(4)),t=-1===this.lastTime_?0:(e-this.lastTime_)/1e3;this.lastTime_=e,this.pastSeekEnd_=this.pastSeekEnd()+t,e=this.liveCurrentTime(),t=this.player_.currentTime();let i=this.player_.paused()||this.seekedBehindLive_||Math.abs(e-t)>this.options_.liveTolerance;(i=!(!this.timeupdateSeen_||e===1/0)&&i)!==this.behindLiveEdge_&&(this.behindLiveEdge_=i,this.trigger("liveedgechange"))}}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2<e,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){var e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){var e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return"number"==typeof this.trackingInterval_}seekToLiveEdge(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}),ut.registerComponent("TitleBar",class extends ut{constructor(e,t){super(e,t),this.on("statechanged",(e=>this.updateDom_())),this.updateDom_()}createEl(){return this.els={title:W("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+xe++}),description:W("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+xe++})},W("div",{className:"vjs-title-bar"},{},Object.values(this.els))}updateDom_(){var e=this.player_.tech_;const t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach((e=>{var n=this.state[e],r=this.els[e];e=i[e],ue(r),n&&z(r,n),t&&(t.removeAttribute(e),n)&&t.setAttribute(e,r.id)})),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){var e;(e=(e=this.player_.tech_)&&e.el_)&&(e.removeAttribute("aria-labelledby"),e.removeAttribute("aria-describedby")),super.dispose(),this.els=null}});const rr=e=>{var t=e.el();if(t.hasAttribute("src"))e.triggerSourceset(t.src);else{var i=e.$$("source"),n=[];let t="";if(!i.length)return!1;for(let e=0;e<i.length;e++){var r=i[e].src;r&&-1===n.indexOf(r)&&n.push(r)}if(!n.length)return!1;1===n.length&&(t=n[0]),e.triggerSourceset(t)}return!0},sr=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(e){for(var t=document.createElement(this.nodeName.toLowerCase()),i=(t.innerHTML=e,document.createDocumentFragment());t.childNodes.length;)i.appendChild(t.childNodes[0]);return this.innerText="",window.Element.prototype.appendChild.call(this,i),this.innerHTML}}),ar=(e,t)=>{let i={};for(let n=0;n<e.length&&!((i=Object.getOwnPropertyDescriptor(e[n],t))&&i.set&&i.get);n++);return i.enumerable=!0,i.configurable=!0,i},or=e=>ar([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,sr],"innerHTML"),lr=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Ut(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class ur extends Bi{constructor(e,t){super(e,t),t=e.source;let i=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&"VIDEO"===this.el_.tagName,t&&(this.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?this.setSource(t):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){var n=this.el_.childNodes;let e=n.length;for(var r=[];e--;){var s=n[e];"track"===s.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(s),this.remoteTextTracks().addTrack(s.track),this.textTracks().addTrack(s.track),i||this.el_.hasAttribute("crossorigin")||!jt(s.src)||(i=!0)):r.push(s))}for(let e=0;e<r.length;e++)this.el_.removeChild(r[e])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&i&&d.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),this.restoreMetadataTracksInIOSNativePlayer_(),(M||N)&&!0===e.nativeControlsForTouch&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),ur.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){!function(e){if(e.featuresSourceset){const t=e.el();if(!t.resetSourceset_){const i=ar([e.el(),window.HTMLMediaElement.prototype,lr],"src"),n=t.setAttribute,r=t.load;Object.defineProperty(t,"src",y(i,{set:n=>(n=i.set.call(t,n),e.triggerSourceset(t.src),n)})),t.setAttribute=(i,r)=>(r=n.call(t,i,r),/src/i.test(i)&&e.triggerSourceset(t.src),r),t.load=()=>{var i=r.call(t);return rr(e)||(e.triggerSourceset(""),nr(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):rr(e)||nr(e),t.resetSourceset_=()=>{t.resetSourceset_=null,t.load=r,t.setAttribute=n,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}}}}(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let n=0;n<e.length;n++){var i=e[n];"metadata"===i.kind&&t.push({track:i,storedMode:i.mode})}},n=(i(),e.addEventListener("change",i),this.on("dispose",(()=>e.removeEventListener("change",i))),()=>{for(let e=0;e<t.length;e++){var i=t[e];"disabled"===i.track.mode&&i.track.mode!==i.storedMode&&(i.track.mode=i.storedMode)}e.removeEventListener("change",n)});this.on("webkitbeginfullscreen",(()=>{e.removeEventListener("change",i),e.removeEventListener("change",n),e.addEventListener("change",n)})),this.on("webkitendfullscreen",(()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",n)}))}overrideNative_(e,t){if(t===this[`featuresNative${e}Tracks`]){const i=e.toLowerCase();this[i+"TracksListeners_"]&&Object.keys(this[i+"TracksListeners_"]).forEach((e=>{this.el()[i+"Tracks"].removeEventListener(e,this[i+"TracksListeners_"][e])})),this[`featuresNative${e}Tracks`]=!t,this[i+"TracksListeners_"]=null,this.proxyNativeTracksForType_(i)}}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){var t=oi[e];const i=this.el()[t.getterName],n=this[t.getterName]();if(this[`featuresNative${t.capitalName}Tracks`]&&i&&i.addEventListener){const r={change:t=>{var i={type:"change",target:n,currentTarget:n,srcElement:n};n.trigger(i),"text"===e&&this[li.remoteText.getterName]().trigger(i)},addtrack(e){n.addTrack(e.track)},removetrack(e){n.removeTrack(e.track)}},s=function(){var e=[];for(let t=0;t<n.length;t++){let r=!1;for(let e=0;e<i.length;e++)if(i[e]===n[t]){r=!0;break}r||e.push(n[t])}for(;e.length;)n.removeTrack(e.shift())};this[t.getterName+"Listeners_"]=r,Object.keys(r).forEach((e=>{const t=r[e];i.addEventListener(e,t),this.on("dispose",(n=>i.removeEventListener(e,t)))})),this.on("loadstart",s),this.on("dispose",(e=>this.off("loadstart",s)))}}proxyNativeTracks_(){oi.names.forEach((e=>{this.proxyNativeTracksForType_(e)}))}createEl(){let e=this.options_.tag;e&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(e?(t=e.cloneNode(!0),e.parentNode&&e.parentNode.insertBefore(t,e),ur.disposeMediaElement(e),e=t):(e=document.createElement("video"),t=y({},this.options_.tag&&Z(this.options_.tag)),M&&!0===this.options_.nativeControlsForTouch||delete t.controls,J(e,Object.assign(t,{id:this.options_.techId,class:"vjs-tech"}))),e.playerId=this.options_.playerId),void 0!==this.options_.preload&&te(e,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);var t,i=["loop","muted","playsinline","autoplay"];for(let t=0;t<i.length;t++){var n=i[t],r=this.options_[n];void 0!==r&&(r?te(e,n,n):ie(e,n),e[n]=r)}return e}handleLateInit_(e){if(0!==e.networkState&&3!==e.networkState)if(0===e.readyState){let e=!1;const t=function(){e=!0},i=(this.on("loadstart",t),function(){e||this.trigger("loadstart")});this.on("loadedmetadata",i),this.ready((function(){this.off("loadstart",t),this.off("loadedmetadata",i),e||this.trigger("loadstart")}))}else{const t=["loadstart"];t.push("loadedmetadata"),2<=e.readyState&&t.push("loadeddata"),3<=e.readyState&&t.push("canplay"),4<=e.readyState&&t.push("canplaythrough"),this.ready((function(){t.forEach((function(e){this.trigger(e)}),this)}))}}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&B?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){d(e,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&w&&x&&0===this.el_.currentTime){const e=()=>{0<this.el_.currentTime&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if("webkitDisplayingFullscreen"in this.el_){const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",(()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)}))}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)St(this.el_.play()),this.setTimeout((function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}),0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}exitFullScreen(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(void 0===e)return this.el_.src;this.setSrc(e)}reset(){ur.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){var t;return this.featuresNativeTextTracks?(t=document.createElement("track"),e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t):super.createRemoteTextTrack(e)}addRemoteTextTrack(e,t){return e=super.addRemoteTextTrack(e,t),this.featuresNativeTextTracks&&this.el().appendChild(e),e}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){var t=this.$$("track");let i=t.length;for(;i--;)e!==t[i]&&e!==t[i].track||this.el().removeChild(t[i])}}getVideoPlaybackQuality(){var e;return"function"==typeof this.el().getVideoPlaybackQuality?this.el().getVideoPlaybackQuality():(e={},void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&(e.creationTime=window.performance.now()),e)}}_(ur,"TEST_VID",(function(){var e,t;if(q())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e})),ur.isSupported=function(){try{ur.TEST_VID.volume=.5}catch(e){return!1}return!(!ur.TEST_VID||!ur.TEST_VID.canPlayType)},ur.canPlayType=function(e){return ur.TEST_VID.canPlayType(e)},ur.canPlaySource=function(e,t){return ur.canPlayType(e.type)},ur.canControlVolume=function(){try{const t=ur.TEST_VID.volume;ur.TEST_VID.volume=t/2+.1;var e=t!==ur.TEST_VID.volume;return e&&j?(window.setTimeout((()=>{ur&&ur.prototype&&(ur.prototype.featuresVolumeControl=t!==ur.TEST_VID.volume)})),!1):e}catch(e){return!1}},ur.canMuteVolume=function(){try{var e=ur.TEST_VID.muted;return ur.TEST_VID.muted=!e,ur.TEST_VID.muted?te(ur.TEST_VID,"muted","muted"):ie(ur.TEST_VID,"muted"),e!==ur.TEST_VID.muted}catch(e){return!1}},ur.canControlPlaybackRate=function(){if(w&&x&&A<58)return!1;try{var e=ur.TEST_VID.playbackRate;return ur.TEST_VID.playbackRate=e/2+.1,e!==ur.TEST_VID.playbackRate}catch(e){return!1}},ur.canOverrideAttributes=function(){try{var e=()=>{};Object.defineProperty(document.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(document.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(document.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},ur.supportsNativeTextTracks=function(){return B||j&&x},ur.supportsNativeVideoTracks=function(){return!(!ur.TEST_VID||!ur.TEST_VID.videoTracks)},ur.supportsNativeAudioTracks=function(){return!(!ur.TEST_VID||!ur.TEST_VID.audioTracks)},ur.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function([e,t]){_(ur.prototype,e,(()=>ur[t]()),!0)})),ur.prototype.featuresVolumeControl=ur.canControlVolume(),ur.prototype.movingMediaElementInDOM=!j,ur.prototype.featuresFullscreenResize=!0,ur.prototype.featuresProgressEvents=!0,ur.prototype.featuresTimeupdateEvents=!0,ur.prototype.featuresVideoFrameCallback=!(!ur.TEST_VID||!ur.TEST_VID.requestVideoFrameCallback),ur.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},ur.resetMediaElement=function(e){if(e){var t=e.querySelectorAll("source");let i=t.length;for(;i--;)e.removeChild(t[i]);if(e.removeAttribute("src"),"function"==typeof e.load)try{e.load()}catch(e){}}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){ur.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){ur.prototype["set"+nt(e)]=function(t){(this.el_[e]=t)?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){ur.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){ur.prototype["set"+nt(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){ur.prototype[e]=function(){return this.el_[e]()}})),Bi.withSourceHandlers(ur),ur.nativeSourceHandler={},ur.nativeSourceHandler.canPlayType=function(e){try{return ur.TEST_VID.canPlayType(e)}catch(e){return""}},ur.nativeSourceHandler.canHandleSource=function(e,t){return e.type?ur.nativeSourceHandler.canPlayType(e.type):e.src?(e=Bt(e.src),ur.nativeSourceHandler.canPlayType("video/"+e)):""},ur.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},ur.nativeSourceHandler.dispose=function(){},ur.registerSourceHandler(ur.nativeSourceHandler),Bi.registerTech("Html5",ur);const dr=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],hr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},cr=["tiny","xsmall","small","medium","large","xlarge","huge"],pr={},mr=(cr.forEach((e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;pr[e]="vjs-layout-"+t})),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class fr extends ut{constructor(t,i,n){if(t.id=t.id||i.id||"vjs_video_"+xe++,(i=Object.assign(fr.getTagSettings(t),i)).initChildren=!1,i.createEl=!1,i.evented=!1,i.reportTouchActivity=!1,i.language||(s=t.closest("[lang]"))&&(i.language=s.getAttribute("lang")),super(null,i,n),this.boundDocumentFullscreenChange_=e=>this.documentFullscreenChange_(e),this.boundFullWindowOnEscKey_=e=>this.fullWindowOnEscKey(e),this.boundUpdateStyleEl_=e=>this.updateStyleEl_(e),this.boundApplyInitTime_=e=>this.applyInitTime_(e),this.boundUpdateCurrentBreakpoint_=e=>this.updateCurrentBreakpoint_(e),this.boundHandleTechClick_=e=>this.handleTechClick_(e),this.boundHandleTechDoubleClick_=e=>this.handleTechDoubleClick_(e),this.boundHandleTechTouchStart_=e=>this.handleTechTouchStart_(e),this.boundHandleTechTouchMove_=e=>this.handleTechTouchMove_(e),this.boundHandleTechTouchEnd_=e=>this.handleTechTouchEnd_(e),this.boundHandleTechTap_=e=>this.handleTechTap_(e),this.isFullscreen_=!1,this.log=h(this.id_),this.fsApi_=r,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=t,this.tagAttributes=t&&Z(t),this.language(this.options_.language),i.languages){const e={};Object.getOwnPropertyNames(i.languages).forEach((function(t){e[t.toLowerCase()]=i.languages[t]})),this.languages_=e}else this.languages_=fr.prototype.options_.languages;this.resetCache_(),this.poster_=i.poster||"",this.controls_=!!i.controls,t.controls=!1,t.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],t.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),i.plugins&&Object.keys(i.plugins).forEach((e=>{if("function"!=typeof this[e])throw new Error(`plugin "${e}" does not exist`)})),this.scrubbing_=!1,this.el_=this.createEl(),Ze(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Le(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var s=y(this.options_);i.plugins&&Object.keys(i.plugins).forEach((e=>{this[e](i.plugins[e])})),i.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(i.playbackRates),this.initChildren(),this.isAudio("audio"===t.nodeName.toLowerCase()),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),M&&this.addClass("vjs-touch-enabled"),j||this.addClass("vjs-workinghover"),fr.players[this.id_]=this,n=e.split(".")[0],this.addClass("vjs-v"+n),this.userActive(!0),this.reportUserActivity(),this.one("play",(e=>this.listenForUserActivity_(e))),this.on("keydown",(e=>this.handleKeyDown(e))),this.on("languagechange",(e=>this.handleLanguagechange(e))),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",(()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)}))}dispose(){this.trigger("dispose"),this.off("dispose"),De(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),De(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),fr.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),qi[this.id()]=null,ui.names.forEach((e=>{(e=this[ui[e].getterName]())&&e.off&&e.off()})),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e,t=this.tag,i=this.playerElIngest_=t.parentNode&&t.parentNode.hasAttribute&&t.parentNode.hasAttribute("data-vjs-player");const n="video-js"===this.tag.tagName.toLowerCase(),r=(i?e=this.el_=t.parentNode:n||(e=this.el_=super.createEl("div")),Z(t));if(n){for(e=this.el_=t,t=this.tag=document.createElement("video");e.children.length;)t.appendChild(e.firstChild);X(e,"video-js")||K(e,"video-js"),e.appendChild(t),i=this.playerElIngest_=e,Object.keys(e).forEach((i=>{try{t[i]=e[i]}catch(i){}}))}t.setAttribute("tabindex","-1"),r.tabindex="-1",x&&L&&(t.setAttribute("role","application"),r.role="application"),t.removeAttribute("width"),t.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach((function(i){n&&"class"===i||e.setAttribute(i,r[i]),n&&t.setAttribute(i,r[i])})),t.playerId=t.id,t.id+="_html5_api",t.className="vjs-tech",(t.player=e.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=we("vjs-styles-dimensions"),s=me(".vjs-styles-defaults"),(a=me("head")).insertBefore(this.styleEl_,s?s.nextSibling:a.firstChild)),this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);var s,a,o=t.getElementsByTagName("a");for(let e=0;e<o.length;e++){var l=o.item(e);K(l,"vjs-hidden"),l.setAttribute("hidden","hidden")}return t.initNetworkState_=t.networkState,t.parentNode&&!i&&t.parentNode.insertBefore(e,t),G(t,e),this.children_.unshift(t),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=e}crossOrigin(e){if(void 0===e)return this.techGet_("crossOrigin");null!==e&&"anonymous"!==e&&"use-credentials"!==e?d.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`):(this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e))}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){var i,n=e+"_";if(void 0===t)return this[n]||0;""===t||"auto"===t?(this[n]=void 0,this.updateStyleEl_()):(i=parseFloat(t),isNaN(i)?d.error(`Improper value "${t}" supplied for for `+e):(this[n]=i,this.updateStyleEl_()))}fluid(e){if(void 0===e)return!!this.fluid_;var t;this.fluid_=!!e,We(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),t=()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},We(e=this)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(!0===window.VIDEOJS_NO_DYNAMIC_STYLE){const t="number"==typeof this.width_?this.width_:this.options_.width,i="number"==typeof this.height_?this.height_:this.options_.height;var e=this.tech_&&this.tech_.el();e&&(0<=t&&(e.width=t),0<=i)&&(e.height=i)}else{let t,i,n,r;e=(e=(n=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0<this.videoWidth()?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"))[1]/e[0],t=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/e:this.videoWidth()||300,i=void 0!==this.height_?this.height_:t*e,r=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(r),Ee(this.styleEl_,`\n .${r} {\n width: ${t}px;\n height: ${i}px;\n }\n\n .${r}.vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: ${100*e}%;\n }\n `)}}loadTech_(e,t){this.tech_&&this.unloadTech_();var i=nt(e),n=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(Bi.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let r=this.autoplay();const s={source:t,autoplay:r=!("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&r,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+`_${n}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};if(ui.names.forEach((e=>{e=ui[e],s[e.getterName]=this[e.privateName]})),Object.assign(s,this.options_[i]),Object.assign(s,this.options_[n]),Object.assign(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&0<this.cache_.currentTime&&(s.startTime=this.cache_.currentTime),!(n=Bi.getTech(e)))throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new n(s),this.tech_.ready(je(this,this.handleTechReady_),!0),function(e,t){e.forEach((function(e){const i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((e=>i.addCue(e)))})),t.textTracks()}(this.textTracksJson_||[],this.tech_),dr.forEach((e=>{this.on(this.tech_,e,(t=>this[`handleTech${nt(e)}_`](t)))})),Object.keys(hr).forEach((e=>{this.on(this.tech_,e,(t=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${hr[e]}_`].bind(this),event:t}):this[`handleTech${hr[e]}_`](t)}))})),this.on(this.tech_,"loadstart",(e=>this.handleTechLoadStart_(e))),this.on(this.tech_,"sourceset",(e=>this.handleTechSourceset_(e))),this.on(this.tech_,"waiting",(e=>this.handleTechWaiting_(e))),this.on(this.tech_,"ended",(e=>this.handleTechEnded_(e))),this.on(this.tech_,"seeking",(e=>this.handleTechSeeking_(e))),this.on(this.tech_,"play",(e=>this.handleTechPlay_(e))),this.on(this.tech_,"pause",(e=>this.handleTechPause_(e))),this.on(this.tech_,"durationchange",(e=>this.handleTechDurationChange_(e))),this.on(this.tech_,"fullscreenchange",((e,t)=>this.handleTechFullscreenChange_(e,t))),this.on(this.tech_,"fullscreenerror",((e,t)=>this.handleTechFullscreenError_(e,t))),this.on(this.tech_,"enterpictureinpicture",(e=>this.handleTechEnterPictureInPicture_(e))),this.on(this.tech_,"leavepictureinpicture",(e=>this.handleTechLeavePictureInPicture_(e))),this.on(this.tech_,"error",(e=>this.handleTechError_(e))),this.on(this.tech_,"posterchange",(e=>this.handleTechPosterChange_(e))),this.on(this.tech_,"textdata",(e=>this.handleTechTextData_(e))),this.on(this.tech_,"ratechange",(e=>this.handleTechRateChange_(e))),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||G(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){ui.names.forEach((e=>{this[(e=ui[e]).privateName]=this[e.getterName]()})),this.textTracksJson_=function(e){var t=e.$$("track");const i=Array.prototype.map.call(t,(e=>e.track));return Array.prototype.map.call(t,(function(e){var t=wt(e.track);return e.src&&(t.src=e.src),t})).concat(Array.prototype.filter.call(e.textTracks(),(function(e){return-1===i.indexOf(e)})).map(wt))}(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return void 0===e&&d.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()&&this.hasStarted(!1),this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(this.tech_&&"string"==typeof e){var t=()=>{const e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var i=this.play();if(Tt(i))return i.catch((e=>{throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))}))};let i;if("any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():t():Tt(i=this.play())&&(i=i.catch(t)),Tt(i))return i.then((()=>{this.trigger({type:"autoplay-success",autoplay:e})})).catch((()=>{this.trigger({type:"autoplay-failure",autoplay:e})}))}}updateSourceCaches_(e=""){let t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=((e,t)=>{if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter((e=>e.src===t));if(i.length)return i[0].type;var n=e.$$("source");for(let e=0;e<n.length;e++){var r=n[e];if(r.type&&r.src&&r.src===t)return r.type}return Qi(t)})(this,t)),this.cache_.source=y({},e,{src:t,type:i}),e=this.cache_.sources.filter((e=>e.src&&e.src===t));var n=[],r=this.$$("source"),s=[];for(let e=0;e<r.length;e++){var a=Z(r[e]);n.push(a),a.src&&a.src===t&&s.push(a.src)}s.length&&!e.length?this.cache_.sources=n:e.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let n=e=>this.updateSourceCaches_(e);var t=this.currentSource().src,i=e.src;(n=!t||/^blob:/.test(t)||!/^blob:/.test(i)||this.lastSource_&&(this.lastSource_.tech===i||this.lastSource_.player===t)?n:()=>{})(i),e.src||this.tech_.any(["sourceset","loadstart"],(e=>{"sourceset"!==e.type&&(e=this.techGet("currentSrc"),this.lastSource_.tech=e,this.updateSourceCaches_(e))}))}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){0<this.tech_.playbackRate()&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((e=>e.callback(e.event))),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?St(this.play()):this.pause())}handleTechDoubleClick_(e){!this.controls_||Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(t=>t.contains(e.target)))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){if(!(e=e.target.player)||e===this){e=this.el();let t=document[this.fsApi_.fullscreenElement]===e;!t&&e.matches?t=e.matches(":"+this.fsApi_.fullscreen):!t&&e.msMatchesSelector&&(t=e.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(t)}}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",(()=>{this.removeClass("vjs-ios-native-fs")}))),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){var e=this.tech_.error();this.error(e)}handleTechTextData_(){let e=1<arguments.length?arguments[1]:null;this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready((function(){if(e in Wi)return i=this.middleware_,this.tech_[e](i.reduce(Gi(e),t));if(e in zi)return Vi(this.middleware_,this.tech_,e,t);var i;try{this.tech_&&this.tech_[e](t)}catch(i){throw d(i),i}}),!0)}techGet_(e){if(this.tech_&&this.tech_.isReady_){if(e in $i)return t=this.middleware_,i=this.tech_,t.reduceRight(Gi(e),i[e]());if(e in zi)return Vi(this.middleware_,this.tech_,e);var t,i;try{return this.tech_[e]()}catch(t){throw void 0===this.tech_[e]?d(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t):"TypeError"===t.name?(d(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1):d(t),t}}}play(){return new Promise((e=>{this.play_(e)}))}play_(e=St){this.playCallbacks_.push(e),e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));var t,i=Boolean(B||j);this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),this.isReady_&&e?(t=this.techGet_("play"),i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===t?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(t)):(this.waitToPlay_=e=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!e&&i&&this.load())}runPlayTerminatedQueue_(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))}runPlayCallbacks_(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))}pause(){this.techCall_("pause")}paused(){return!1!==this.techGet_("paused")}played(){return this.techGet_("played")||ct(0,0)}scrubbing(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=(e=parseFloat(e))<0?1/0:e)!==this.cache_.duration&&((this.cache_.duration=e)===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return e&&e.length?e:ct(0,0)}bufferedPercent(){return vt(this.buffered(),this.duration())}bufferedEnd(){var e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t?t:i}volume(e){let t;if(void 0===e)return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t;t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),0<t&&this.lastVolume_(t)}muted(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)}defaultMuted(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1}lastVolume_(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){var t;if(void 0===e)return this.isFullscreen_;t=this.isFullscreen_,this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_()}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise(((i,n)=>{function r(){t.off("fullscreenerror",a),t.off("fullscreenchange",s)}function s(){r(),i()}function a(e,t){r(),n(t)}t.one("fullscreenchange",s),t.one("fullscreenerror",a);var o=t.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(i,n))}))}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen)return(e=this.el_[this.fsApi_.requestFullscreen](t))&&e.then((()=>this.isFullscreen(!0)),(()=>this.isFullscreen(!1))),e;this.tech_.supportsFullScreen()&&1==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise(((t,i)=>{function n(){e.off("fullscreenerror",s),e.off("fullscreenchange",r)}function r(){n(),t()}function s(e,t){n(),i(t)}e.one("fullscreenchange",r),e.one("fullscreenerror",s);var a=e.exitFullscreenHelper_();a&&(a.then(n,n),a.then(t,i))}))}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&St(e.then((()=>this.isFullscreen(!1)))),e;this.tech_.supportsFullScreen()&&1==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,Le(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",K(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){lt.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,De(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,Q(document.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(void 0===e)return!!this.isInPictureInPicture_;this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_()}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&window.documentPictureInPicture){const e=document.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(W("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({initialAspectRatio:this.videoWidth()/this.videoHeight(),copyStyleSheets:!0}).then((t=>(this.el_.parentNode.insertBefore(e,this.el_),t.document.body.append(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),t.addEventListener("unload",(t=>{t=t.target.querySelector(".video-js"),e.replaceWith(t),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")})),t)))}return"pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){return window.documentPictureInPicture&&window.documentPictureInPicture.window?(window.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in document?document.exitPictureInPicture():void 0}handleKeyDown(e){var t,i,n=this.options_.userActions;n&&n.hotkeys&&(i=(t=this.el_.ownerDocument.activeElement).tagName.toLowerCase(),t.isContentEditable||("input"===i?-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(t.type):-1!==["textarea"].indexOf(i))||("function"==typeof n.hotkeys?n.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){var{fullscreenKey:t=e=>lt.isEventKey(e,"f"),muteKey:i=e=>lt.isEventKey(e,"m"),playPauseKey:n=e=>lt.isEventKey(e,"k")||lt.isEventKey(e,"Space")}=this.options_.userActions?this.options_.userActions.hotkeys:{};t.call(this,e)?(e.preventDefault(),e.stopPropagation(),t=ut.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):i.call(this,e)?(e.preventDefault(),e.stopPropagation(),ut.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),ut.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){var t;for(let n=0,r=this.options_.techOrder;n<r.length;n++){var i=r[n];let s=Bi.getTech(i);if(s=s||ut.getComponent(i)){if(s.isSupported()&&(t=s.canPlayType(e)))return t}else d.error(`The "${i}" tech is undefined. Skipped browser support check for that tech.`)}return""}selectSource(e){function t(e,t,i){let n;return e.some((e=>t.some((t=>{if(n=i(e,t))return!0})))),n}var i=this.options_.techOrder.map((e=>[e,Bi.getTech(e)])).filter((([e,t])=>t?t.isSupported():(d.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1)));let n;var r,s=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return(n=this.options_.sourceOrder?t(e,i,(r=s,(e,t)=>r(t,e))):t(i,e,s))||!1}handleSrc_(e,t){if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=Xi(e);if(i.length){if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),function(e,t,i){e.setTimeout((()=>function e(t={},i=[],n,r,s=[],a=!1){const[o,...l]=i;if("string"==typeof o)e(t,Fi[o],n,r,s,a);else if(o){const i=function(e,t){var i=qi[e.id()];let n=null;if(null==i)n=t(e),qi[e.id()]=[[t,n]];else{for(let e=0;e<i.length;e++){var[r,s]=i[e];r===t&&(n=s)}null===n&&(n=t(e),i.push([t,n]))}return n}(r,o);if(!i.setSource)return s.push(i),e(t,l,n,r,s,a);i.setSource(Object.assign({},t),(function(o,u){if(o)return e(t,l,n,r,s,a);s.push(i),e(u,t.type===u.type?l:Fi[u.type],n,r,s,a)}))}else l.length?e(t,l,n,r,s,a):a?n(t,s):e(t,Fi["*"],n,r,s,!0)}(t,Fi[t.type],i,e)),1)}(this,i[0],((e,n)=>{var r;if(this.middleware_=n,t||(this.cache_.sources=i),this.updateSourceCaches_(e),this.src_(e))return 1<i.length?this.handleSrc_(i.slice(1)):(this.changingSrc_=!1,this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0),void this.triggerReady());r=this.tech_,n.forEach((e=>e.setTech&&e.setTech(r)))})),1<i.length){const e=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},t=()=>{this.off("error",e)};this.one("error",e),this.one("playing",t),this.resetRetryOnError_=()=>{this.off("error",e),this.off("playing",t)}}}else this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0)}src(e){return this.handleSrc_(e,!1)}src_(e){var t=this.selectSource([e]);return!t||(rt(t.tech,this.techName_)?this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready((()=>{this.changingSrc_=!1}))),!1)}load(){this.techCall_("load")}reset(){this.paused()?this.doReset_():St(this.play().then((()=>this.doReset_())))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),We(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:n}=this.controlBar||{},i=(i||{}).seekBar;e&&e.updateContent(),t&&t.updateContent(),n&&n.updateContent(),i&&(i.update(),i.loadProgressBar)&&i.loadProgressBar.update()}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(void 0===e)return this.techGet_("preload");this.techCall_("setPreload",e),this.options_.preload=e}autoplay(e){if(void 0===e)return this.options_.autoplay||!1;let t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")}loop(e){if(void 0===e)return this.techGet_("loop");this.techCall_("setLoop",e),this.options_.loop=e}poster(e){if(void 0===e)return this.poster_;(e=e||"")!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){var e;(!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster&&(e=this.tech_.poster()||"")!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}controls(e){if(void 0===e)return!!this.controls_;this.controls_!==(e=!!e)&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(void 0===e)return!!this.usingNativeControls_;this.usingNativeControls_!==(e=!!e)&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(void 0===e)return this.error_||null;if(i("beforeerror").forEach((t=>{f(t=t(this,e))&&!Array.isArray(t)||"string"==typeof t||"number"==typeof t||null===t?e=t:this.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",(function(){this.off(["click","touchstart"],t)}))}else null===e?(this.error_=e,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new bt(e),this.addClass("vjs-error"),d.error(`(CODE:${this.error_.code} ${bt.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),i("error").forEach((e=>e(this,this.error_))))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(void 0===e)return this.userActive_;(e=!!e)!==this.userActive_&&(this.userActive_=e,this.userActive_?(this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive")):(this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")))}listenForUserActivity_(){let e,t,i;const n=je(this,this.reportUserActivity);function r(t){n(),this.clearInterval(e)}this.on("mousedown",(function(){n(),this.clearInterval(e),e=this.setInterval(n,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,n())})),this.on("mouseup",r),this.on("mouseleave",r);var s=this.getChild("controlBar");let a;!s||j||w||(s.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),s.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",n),this.on("keyup",n),this.setInterval((function(){var e;this.userActivity_&&(this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a),(e=this.options_.inactivityTimeout)<=0||(a=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e)))}),250)}playbackRate(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}defaultPlaybackRate(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();const t=this.getChild("ControlBar");var i=t&&t.currentHeight();e.forEach((e=>{e!==t&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),this.audioOnlyCache_.hiddenChildren.push(e))})),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach((e=>e.show())),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){return"boolean"!=typeof e||e===this.audioOnlyMode_?this.audioOnlyMode_:(this.audioOnlyMode_=e)?(e=[],this.isInPictureInPicture()&&e.push(this.exitPictureInPicture()),this.isFullscreen()&&e.push(this.exitFullscreen()),this.audioPosterMode()&&e.push(this.audioPosterMode(!1)),Promise.all(e).then((()=>this.enableAudioOnlyUI_()))):Promise.resolve().then((()=>this.disableAudioOnlyUI_()))}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e)?(this.audioOnlyMode()?this.audioOnlyMode(!1):Promise.resolve()).then((()=>{this.enablePosterModeUI_()})):Promise.resolve().then((()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let t=e.track;if(t=t||e,this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),We(this))&&this.trigger("languagechange")}languages(){return y(fr.prototype.options_.languages,this.languages_)}toJSON(){var e=y(this.options_),t=e.tracks;e.tracks=[];for(let n=0;n<t.length;n++){var i=t[n];(i=y(i)).player=void 0,e.tracks[n]=i}return e}createModal(e,t){(t=t||{}).content=e||"";const i=new kt(this,t);return this.addChild(i),i.on("dispose",(()=>{this.removeChild(i)})),i.open(),i}updateCurrentBreakpoint_(){if(this.responsive()){var e=this.currentBreakpoint(),t=this.currentWidth();for(let n=0;n<cr.length;n++){var i=cr[n];if(t<=this.breakpoints_[i]){if(e===i)return;e&&this.removeClass(pr[e]),this.addClass(pr[i]),this.breakpoint_=i;break}}}}removeCurrentBreakpoint_(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return void 0!==e&&(this.breakpoint_="",this.breakpoints_=Object.assign({},mr,e),this.updateCurrentBreakpoint_()),Object.assign(this.breakpoints_)}responsive(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?((this.responsive_=e)?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return pr[this.breakpoint_]||""}loadMedia(e,t){var i,n,r,s,a,o;e&&"object"==typeof e&&(this.reset(),this.cache_.media=y(e),({artist:e,artwork:i,description:n,poster:r,src:s,textTracks:a,title:o}=this.cache_.media),!i&&r&&(this.cache_.media.artwork=[{src:r,type:Qi(r)}]),s&&this.src(s),r&&this.poster(r),Array.isArray(a)&&a.forEach((e=>this.addRemoteTextTrack(e,!1))),this.titleBar&&this.titleBar.update({title:o,description:n||e||""}),this.ready(t))}getMedia(){var e,t;return this.cache_.media?y(this.cache_.media):(e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),(e=>({kind:e.kind,label:e.label,language:e.language,src:e.src})))},e&&(t.poster=e,t.artwork=[{src:t.poster,type:Qi(t.poster)}]),t)}static getTagSettings(e){var t,i={sources:[],tracks:[]},n=Z(e),r=n["data-setup"];if(X(e,"vjs-fill")&&(n.fill=!0),X(e,"vjs-fluid")&&(n.fluid=!0),null!==r&&([r,t]=function(e){var t,i=null;try{t=JSON.parse(e,void 0)}catch(e){i=e}return[i,t]}(r||"{}"),r&&d.error(r),Object.assign(n,t)),Object.assign(i,n),e.hasChildNodes()){var s=e.childNodes;for(let e=0,t=s.length;e<t;e++){var a=s[e],o=a.nodeName.toLowerCase();"source"===o?i.sources.push(Z(a)):"track"===o&&i.tracks.push(Z(a))}}return i}debug(e){if(void 0===e)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every((e=>"number"==typeof e))&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}ui.names.forEach((function(e){const t=ui[e];fr.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),fr.prototype.crossorigin=fr.prototype.crossOrigin,fr.players={},Zn=window.navigator,fr.prototype.options_={techOrder:Bi.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Zn&&(Zn.languages&&Zn.languages[0]||Zn.userLanguage||Zn.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach((function(e){fr.prototype[e]=function(){return this.techGet_(e)}})),dr.forEach((function(e){fr.prototype[`handleTech${nt(e)}_`]=function(){return this.trigger(e)}})),ut.registerComponent("Player",fr);const gr="plugin",yr="activePlugins_",_r={},vr=e=>_r.hasOwnProperty(e),br=e=>vr(e)?_r[e]:void 0,Tr=(e,t)=>{e[yr]=e[yr]||{},e[yr][t]=!0},Sr=(e,t,i)=>{i=(i?"before":"")+"pluginsetup",e.trigger(i,t),e.trigger(i+":"+t.name,t)},wr=(e,t)=>(t.prototype.name=e,function(...i){Sr(this,{name:e,plugin:t,instance:null},!0);const n=new t(this,...i);return this[e]=()=>n,Sr(this,n.getEventHash()),n});class Er{constructor(e){if(this.constructor===Er)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Ze(this),delete this.trigger,tt(this,this.constructor.defaultState),Tr(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Ne(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){var{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[yr][e]=!1,this.player=this.state=null,t[e]=wr(e,_r[e])}static isBasic(e){return"function"==typeof(e="string"==typeof e?br(e):e)&&!Er.prototype.isPrototypeOf(e.prototype)}static registerPlugin(e,t){if("string"!=typeof e)throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(vr(e))d.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(fr.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if("function"!=typeof t)throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return _r[e]=t,e!==gr&&(Er.isBasic(t)?fr.prototype[e]=function(e,t){function i(){Sr(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return Tr(this,e),Sr(this,{name:e,plugin:t,instance:i}),i}return Object.keys(t).forEach((function(e){i[e]=t[e]})),i}(e,t):fr.prototype[e]=wr(e,t)),t}static deregisterPlugin(e){if(e===gr)throw new Error("Cannot de-register base plugin.");vr(e)&&(delete _r[e],delete fr.prototype[e])}static getPlugins(e=Object.keys(_r)){let t;return e.forEach((e=>{var i=br(e);i&&((t=t||{})[e]=i)})),t}static getPluginVersion(e){return(e=br(e))&&e.VERSION||""}}function kr(e,t,i,n){{var r=t+` is deprecated and will be removed in ${e}.0; please use ${i} instead.`,s=n;let a=!1;return function(...e){return a||d.warn(r),a=!0,s.apply(this,e)}}}Er.getPlugin=br,Er.BASE_PLUGIN_NAME=gr,Er.registerPlugin(gr,Er),fr.prototype.usingPlugin=function(e){return!!this[yr]&&!0===this[yr][e]},fr.prototype.hasPlugin=function(e){return!!vr(e)};const Cr=e=>0===e.indexOf("#")?e.slice(1):e;function xr(e,t,n){let r=xr.getPlayer(e);if(r)t&&d.warn(`Player "${e}" is already initialised. Options will not be applied.`),n&&r.ready(n);else{const s="string"==typeof e?me("#"+Cr(e)):e;if(!H(s))throw new TypeError("The element or ID supplied is not valid. (videojs)");s.ownerDocument.defaultView&&s.ownerDocument.body.contains(s)||d.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(s.parentNode&&s.parentNode.hasAttribute("data-vjs-player")?s.parentNode:s).cloneNode(!0)),i("beforesetup").forEach((e=>{!f(e=e(s,y(t)))||Array.isArray(e)?d.error("please return an object in beforesetup hooks"):t=y(t,e)})),e=ut.getComponent("Player"),r=new e(s,t,n),i("setup").forEach((e=>e(r)))}return r}xr.hooks_=t,xr.hooks=i,xr.hook=function(e,t){i(e,t)},xr.hookOnce=function(e,t){i(e,[].concat(t).map((t=>{const i=(...r)=>(n(e,i),t(...r));return i})))},xr.removeHook=n,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&q()&&!(Yn=me(".vjs-styles-defaults"))&&(Yn=we("vjs-styles-defaults"),(Jn=me("head"))&&Jn.insertBefore(Yn,Jn.firstChild),Ee(Yn,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n ")),Te(1,xr),xr.VERSION=e,xr.options=fr.prototype.options_,xr.getPlayers=()=>fr.players,xr.getPlayer=e=>{var t=fr.players;let i;if("string"==typeof e){var n,r;if(r=t[n=Cr(e)])return r;i=me("#"+n)}else i=e;if(H(i)){var{player:r,playerId:n}=i;if(r||t[n])return r||t[n]}},xr.getAllPlayers=()=>Object.keys(fr.players).map((e=>fr.players[e])).filter(Boolean),xr.players=fr.players,xr.getComponent=ut.getComponent,xr.registerComponent=(e,t)=>{Bi.isTech(t)&&d.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),ut.registerComponent.call(ut,e,t)},xr.getTech=Bi.getTech,xr.registerTech=Bi.registerTech,xr.use=function(e,t){Fi[e]=Fi[e]||[],Fi[e].push(t)},Object.defineProperty(xr,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(xr.middleware,"TERMINATOR",{value:Hi,writeable:!1,enumerable:!0}),xr.browser=U,xr.obj=v,xr.mergeOptions=kr(9,"videojs.mergeOptions","videojs.obj.merge",y),xr.defineLazyProperty=kr(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",_),xr.bind=kr(9,"videojs.bind","native Function.prototype.bind",je),xr.registerPlugin=Er.registerPlugin,xr.deregisterPlugin=Er.deregisterPlugin,xr.plugin=(e,t)=>(d.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Er.registerPlugin(e,t)),xr.getPlugins=Er.getPlugins,xr.getPlugin=Er.getPlugin,xr.getPluginVersion=Er.getPluginVersion,xr.addLanguage=function(e,t){return e=(""+e).toLowerCase(),xr.options.languages=y(xr.options.languages,{[e]:t}),xr.options.languages[e]},xr.log=d,xr.createLogger=h,xr.time=_t,xr.createTimeRange=kr(9,"videojs.createTimeRange","videojs.time.createTimeRanges",ct),xr.createTimeRanges=kr(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",ct),xr.formatTime=kr(9,"videojs.formatTime","videojs.time.formatTime",yt),xr.setFormatTime=kr(9,"videojs.setFormatTime","videojs.time.setFormatTime",ft),xr.resetFormatTime=kr(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",gt),xr.parseUrl=kr(9,"videojs.parseUrl","videojs.url.parseUrl",Rt),xr.isCrossOrigin=kr(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",jt),xr.EventTarget=Ve,xr.any=Re,xr.on=Le,xr.one=Me,xr.off=De,xr.trigger=Ne,xr.xhr=Gt,xr.TextTrack=ni,xr.AudioTrack=ri,xr.VideoTrack=si,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((e=>{xr[e]=function(){return d.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),ye[e].apply(null,arguments)}})),xr.computedStyle=kr(9,"videojs.computedStyle","videojs.dom.computedStyle",ge),xr.dom=ye,xr.fn=qe,xr.num=Xt,xr.str=st,xr.url=Ft,ot((function(e,t){e.exports=function(e){var t=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(e);class i{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get:()=>t.enabled_(),set(e){t.enabled_(e)}}),t}}class n extends t.default.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get:()=>e.selectedIndex_}),Object.defineProperty(e,"length",{get:()=>e.levels_.length}),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const n=this.levels_.length;return t=new i(e),""+n in this||Object.defineProperty(this,n,{get(){return this.levels_[n]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,n=this.length;i<n;i++)if(this[i]===e){t=this.levels_.splice(i,1)[0],this.selectedIndex_===i?this.selectedIndex_=-1:this.selectedIndex_>i&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;t<i;t++){const i=this[t];if(i.id===e)return i}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}n.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const e in n.prototype.allowedEvents_)n.prototype["on"+e]=null;var r="3.0.0";const s=function(e){return function(e){const t=e.qualityLevels,i=new n,s=function(){i.dispose(),e.qualityLevels=t,e.off("dispose",s)};return e.on("dispose",s),e.qualityLevels=()=>i,e.qualityLevels.VERSION=r,i}(this,t.default.mergeOptions({},e))};return(t.default.registerPlugin||t.default.plugin)("qualityLevels",s),s.VERSION=r,s}(xr)}));var Ir=ot((function(e,t){var i,n,r,s,a;i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=a.parseURL(e);if(r)return r.path=a.normalizePath(r.path),a.buildURLFromParts(r);throw new Error("Error trying to parse base URL.")}if(!(r=a.parseURL(t)))throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=a.normalizePath(r.path),a.buildURLFromParts(r)):t;if(!(t=a.parseURL(e)))throw new Error("Error trying to parse base URL.");var s;return!t.netLoc&&t.path&&"/"!==t.path[0]&&(e=n.exec(t.path),t.netLoc=e[1],t.path=e[2]),t.netLoc&&!t.path&&(t.path="/"),e={scheme:t.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment},r.netLoc||(e.netLoc=t.netLoc,"/"!==r.path[0]&&(r.path?(s=(s=t.path).substring(0,s.lastIndexOf("/")+1)+r.path,e.path=a.normalizePath(s)):(e.path=t.path,r.params||(e.params=t.params,r.query)||(e.query=t.query)))),null===e.path&&(e.path=i.alwaysNormalize?a.normalizePath(r.path):r.path),a.buildURLFromParts(e)},parseURL:function(e){return(e=i.exec(e))?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");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=a})),Ar=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1<t)},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),s=t.length,a=0;a<s;++a)t[a].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();function Or(e){for(var t=window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary"),i=new Uint8Array(t.length),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i}class Pr extends Ar{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf("\n");-1<t;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}function Lr(e){var t={};return(e=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""))[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t}function Dr(e){var t={};if(e){var i,n=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))'));let r=n.length;for(;r--;)""!==n[r]&&((i=/([^=]*)=(.*)/.exec(n[r]).slice(1))[0]=i[0].replace(/^\s+|\s+$/g,""),i[1]=i[1].replace(/^\s+|\s+$/g,""),i[1]=i[1].replace(/^['"](.*)['"]$/g,"$1"),t[i[0]]=i[1])}return t}const Nr=String.fromCharCode(9);class Mr extends Ar{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;0!==(e=e.trim()).length&&("#"!==e[0]?this.trigger("data",{type:"uri",uri:e}):this.tagMappers.reduce(((t,i)=>(i=i(e))===e?t:t.concat([i])),[e]).forEach((e=>{for(let t=0;t<this.customParsers.length;t++)if(this.customParsers[t].call(this,e))return;var n,r;0!==e.indexOf("#EXT")?this.trigger("data",{type:"comment",text:e.slice(1)}):(e=e.replace("\r",""),(t=/^#EXTM3U/.exec(e))?this.trigger("data",{type:"tag",tagType:"m3u"}):(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(e))?(i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),this.trigger("data",i)):(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(e))?(i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),this.trigger("data",i)):(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(e))?(i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),this.trigger("data",i)):(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(e))?(i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i)):(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(e))?(i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i)):(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(e))?(i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),this.trigger("data",i)):(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(e))?(i=Vt(Lr(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",i)):(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(e))?(i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),this.trigger("data",i)):(t=/^#EXT-X-MAP:(.*)$/.exec(e))?(i={type:"tag",tagType:"map"},t[1]&&((r=Dr(t[1])).URI&&(i.uri=r.URI),r.BYTERANGE)&&(i.byterange=Lr(r.BYTERANGE)),this.trigger("data",i)):(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(e))?(i={type:"tag",tagType:"stream-inf"},t[1]&&(i.attributes=Dr(t[1]),i.attributes.RESOLUTION&&(r={},(n=i.attributes.RESOLUTION.split("x"))[0]&&(r.width=parseInt(n[0],10)),n[1]&&(r.height=parseInt(n[1],10)),i.attributes.RESOLUTION=r),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"])&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10)),this.trigger("data",i)):(t=/^#EXT-X-MEDIA:(.*)$/.exec(e))?(i={type:"tag",tagType:"media"},t[1]&&(i.attributes=Dr(t[1])),this.trigger("data",i)):(t=/^#EXT-X-ENDLIST/.exec(e))?this.trigger("data",{type:"tag",tagType:"endlist"}):(t=/^#EXT-X-DISCONTINUITY/.exec(e))?this.trigger("data",{type:"tag",tagType:"discontinuity"}):(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(e))?(i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),this.trigger("data",i)):(t=/^#EXT-X-KEY:(.*)$/.exec(e))?(i={type:"tag",tagType:"key"},t[1]&&(i.attributes=Dr(t[1]),i.attributes.IV)&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV)),this.trigger("data",i)):(t=/^#EXT-X-START:(.*)$/.exec(e))?(i={type:"tag",tagType:"start"},t[1]&&(i.attributes=Dr(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),this.trigger("data",i)):(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(e))?(i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i)):(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(e))?(i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i)):(t=/^#EXT-X-CUE-IN:(.*)?$/.exec(e))?(i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i)):(t=/^#EXT-X-SKIP:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"skip"}).attributes=Dr(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(Nr)),this.trigger("data",i)):(t=/^#EXT-X-PART:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"part"}).attributes=Dr(t[1]),["DURATION"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["INDEPENDENT","GAP"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=Lr(i.attributes.BYTERANGE)),this.trigger("data",i)):(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"server-control"}).attributes=Dr(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),this.trigger("data",i)):(t=/^#EXT-X-PART-INF:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"part-inf"}).attributes=Dr(t[1]),["PART-TARGET"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),this.trigger("data",i)):(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"preload-hint"}).attributes=Dr(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach((function(e){var t;i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseInt(i.attributes[e],10),t="BYTERANGE-LENGTH"===e?"length":"offset",i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[t]=i.attributes[e],delete i.attributes[e])})),this.trigger("data",i)):(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e))&&t[1]?((i={type:"tag",tagType:"rendition-report"}).attributes=Dr(t[1]),["LAST-MSN","LAST-PART"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseInt(i.attributes[e],10))})),this.trigger("data",i)):this.trigger("data",{type:"tag",data:e.slice(4)}))})))}addParser({expression:e,customType:t,dataParser:i,segment:n}){"function"!=typeof i&&(i=e=>e),this.customParsers.push((r=>{if(e.exec(r))return this.trigger("data",{type:"custom",data:i(r),customType:t,segment:n}),!0}))}addTagMapper({expression:e,map:t}){this.tagMappers.push((i=>e.test(i)?t(i):i))}}function Rr(e){const t={};return Object.keys(e).forEach((function(i){t[i.toLowerCase().replace(/-(\w)/g,(e=>e[1].toUpperCase()))]=e[i]})),t}function Ur(e){var t,i,n,r,s,{serverControl:e,targetDuration:a,partTargetDuration:o}=e;e&&(t="#EXT-X-SERVER-CONTROL",i="holdBack",n="partHoldBack",r=a&&3*a,s=o&&2*o,a&&!e.hasOwnProperty(i)&&(e[i]=r,this.trigger("info",{message:t+` defaulting HOLD-BACK to targetDuration * 3 (${r}).`})),r&&e[i]<r&&(this.trigger("warn",{message:t+` clamping HOLD-BACK (${e[i]}) to targetDuration * 3 (${r})`}),e[i]=r),o&&!e.hasOwnProperty(n)&&(e[n]=3*o,this.trigger("info",{message:t+` defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[n]}).`})),o)&&e[n]<s&&(this.trigger("warn",{message:t+` clamping PART-HOLD-BACK (${e[n]}) to partTargetDuration * 2 (${s}).`}),e[n]=s)}class jr extends Ar{constructor(){super(),this.lineStream=new Pr,this.parseStream=new Mr,this.lineStream.pipe(this.parseStream);const e=this,t=[];let i,n,r={},s=!1;const a={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}};let o=0,l=(this.manifest={allowCache:!0,discontinuityStarts:[],segments:[]},0),u=0;this.on("end",(()=>{r.uri||!r.parts&&!r.preloadHints||(!r.map&&i&&(r.map=i),!r.key&&n&&(r.key=n),r.timeline||"number"!=typeof o||(r.timeline=o),this.manifest.preloadSegment=r)})),this.parseStream.on("data",(function(d){let h,c;({tag(){({version(){d.version&&(this.manifest.version=d.version)},"allow-cache"(){this.manifest.allowCache=d.allowed,"allowed"in d||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){var e={};"length"in d&&((r.byterange=e).length=d.length,"offset"in d||(d.offset=l)),"offset"in d&&((r.byterange=e).offset=d.offset),l=e.offset+e.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),0<d.duration&&(r.duration=d.duration),0===d.duration&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=t},key(){if(d.attributes)if("NONE"===d.attributes.METHOD)n=null;else if(d.attributes.URI)if("com.apple.streamingkeydelivery"===d.attributes.KEYFORMAT)this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:d.attributes};else if("com.microsoft.playready"===d.attributes.KEYFORMAT)this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:d.attributes.URI};else{if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===d.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(d.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===d.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==d.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):d.attributes.KEYID&&"0x"===d.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:d.attributes.KEYFORMAT,keyId:d.attributes.KEYID.substring(2)},pssh:Or(d.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));d.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:d.attributes.METHOD||"AES-128",uri:d.attributes.URI},void 0!==d.attributes.IV&&(n.iv=d.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence"(){isFinite(d.number)?this.manifest.mediaSequence=d.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+d.number})},"discontinuity-sequence"(){isFinite(d.number)?(this.manifest.discontinuitySequence=d.number,o=d.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+d.number})},"playlist-type"(){/VOD|EVENT/.test(d.playlistType)?this.manifest.playlistType=d.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+d.playlist})},map(){i={},d.uri&&(i.uri=d.uri),d.byterange&&(i.byterange=d.byterange),n&&(i.key=n)},"stream-inf"(){this.manifest.playlists=t,this.manifest.mediaGroups=this.manifest.mediaGroups||a,d.attributes?(r.attributes||(r.attributes={}),Vt(r.attributes,d.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media(){var e;this.manifest.mediaGroups=this.manifest.mediaGroups||a,d.attributes&&d.attributes.TYPE&&d.attributes["GROUP-ID"]&&d.attributes.NAME?((e=this.manifest.mediaGroups[d.attributes.TYPE])[d.attributes["GROUP-ID"]]=e[d.attributes["GROUP-ID"]]||{},h=e[d.attributes["GROUP-ID"]],(c={default:/yes/i.test(d.attributes.DEFAULT)}).default?c.autoselect=!0:c.autoselect=/yes/i.test(d.attributes.AUTOSELECT),d.attributes.LANGUAGE&&(c.language=d.attributes.LANGUAGE),d.attributes.URI&&(c.uri=d.attributes.URI),d.attributes["INSTREAM-ID"]&&(c.instreamId=d.attributes["INSTREAM-ID"]),d.attributes.CHARACTERISTICS&&(c.characteristics=d.attributes.CHARACTERISTICS),d.attributes.FORCED&&(c.forced=/yes/i.test(d.attributes.FORCED)),h[d.attributes.NAME]=c):this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity(){o+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(t.length)},"program-date-time"(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=d.dateTimeString,this.manifest.dateTimeObject=d.dateTimeObject),r.dateTimeString=d.dateTimeString,r.dateTimeObject=d.dateTimeObject},targetduration(){!isFinite(d.duration)||d.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+d.duration}):(this.manifest.targetDuration=d.duration,Ur.call(this,this.manifest))},start(){!d.attributes||isNaN(d.attributes["TIME-OFFSET"])?this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"}):this.manifest.start={timeOffset:d.attributes["TIME-OFFSET"],precise:d.attributes.PRECISE}},"cue-out"(){r.cueOut=d.data},"cue-out-cont"(){r.cueOutCont=d.data},"cue-in"(){r.cueIn=d.data},skip(){this.manifest.skip=Rr(d.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",d.attributes,["SKIPPED-SEGMENTS"])},part(){s=!0;var e=this.manifest.segments.length,t=Rr(d.attributes);r.parts=r.parts||[],r.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=u),u=t.byterange.offset+t.byterange.length),t=r.parts.length-1,this.warnOnMissingAttributes_(`#EXT-X-PART #${t} for segment #`+e,d.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(((e,t)=>{e.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${t} lacks required attribute(s): LAST-PART`})}))},"server-control"(){var e=this.manifest.serverControl=Rr(d.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Ur.call(this,this.manifest),e.canSkipDateranges&&!e.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){var e=this.manifest.segments.length,t=Rr(d.attributes),i=t.type&&"PART"===t.type,n=(r.preloadHints=r.preloadHints||[],r.preloadHints.push(t),!t.byterange||t.byterange.hasOwnProperty("offset")||(t.byterange.offset=i?u:0,i&&(u=t.byterange.offset+t.byterange.length)),r.preloadHints.length-1);if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${n} for segment #`+e,d.attributes,["TYPE","URI"]),t.type)for(let i=0;i<r.preloadHints.length-1;i++){var s=r.preloadHints[i];s.type&&s.type===t.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${n} for segment #${e} has the same TYPE ${t.type} as preload hint #`+i})}},"rendition-report"(){var e=Rr(d.attributes),t=(this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(e),e=this.manifest.renditionReports.length-1,["LAST-MSN","URI"]);s&&t.push("LAST-PART"),this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #"+e,d.attributes,t)},"part-inf"(){this.manifest.partInf=Rr(d.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",d.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Ur.call(this,this.manifest)}}[d.tagType]||function(){}).call(e)},uri(){r.uri=d.uri,t.push(r),!this.manifest.targetDuration||"duration"in r||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),r.duration=this.manifest.targetDuration),n&&(r.key=n),r.timeline=o,i&&(r.map=i),u=0,r={}},comment(){},custom(){d.segment?(r.custom=r.custom||{},r.custom[d.customType]=d.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[d.customType]=d.data)}})[d.type].call(e)}))}warnOnMissingAttributes_(e,t,i){const n=[];i.forEach((function(e){t.hasOwnProperty(e)||n.push(e)})),n.length&&this.trigger("warn",{message:e+" lacks required attribute(s): "+n.join(", ")})}push(e){this.lineStream.push(e)}end(){this.lineStream.push("\n"),this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}function Br(e){return Wr.audio.test((e=void 0===e?"":e).trim().toLowerCase())}function Fr(e){return void 0===e&&(e=""),window.MediaSource&&window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported(Qr(e))||!1}function qr(e){return(e=void 0===e?"":e).toLowerCase().split(",").every((function(e){e=e.trim();for(var t=0;t<Gr.length;t++){var i=Gr[t];if(Wr["muxer"+i].test(e))return!0}return!1}))}function Hr(e){return Jr.test(e)?"hls":Zr.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null}function Vr(e,t){if("string"!=typeof(e="string"!=typeof e&&e&&"function"==typeof e.toString?e.toString():e))return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return i}function $r(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i="function"==typeof window.URL,n=/^\/\//.test(e),r=!window.location&&!/\/\//i.test(e);return i?e=new window.URL(e,window.location||as):/\/\//i.test(e)||(e=Ir.buildAbsoluteURL(window.location&&window.location.href||"",e)),i?(i=new URL(t,e),r?i.href.slice(as.length):n?i.href.slice(i.protocol.length):i.href):Ir.buildAbsoluteURL(e,t)}var Wr={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},zr=["video","audio","text"],Gr=["Video","Audio","Text"],Xr=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)}))},Kr=function(e){e=(e=void 0===e?"":e).split(",");var t=[];return e.forEach((function(e){var i;e=e.trim(),zr.forEach((function(n){var r,s=Wr[n].exec(e.toLowerCase());!s||s.length<=1||(i=n,s=e.substring(0,s[1].length),r=e.replace(s,""),t.push({type:s,details:r,mediaType:n}))})),i||t.push({type:e,details:"",mediaType:"unknown"})})),t},Qr=function(e){var t,i,n;if(e&&"string"==typeof e)return i="video",1===(t=e.toLowerCase().split(",").map((function(e){return Xr(e.trim())}))).length&&Br(t[0])?i="audio":1===t.length&&(n=t[0],Wr.text.test((n=void 0===n?"":n).trim().toLowerCase()))&&(i="application"),n="mp4",t.every((function(e){return Wr.mp4.test(e)}))?n="mp4":t.every((function(e){return Wr.webm.test(e)}))?n="webm":t.every((function(e){return Wr.ogg.test(e)}))&&(n="ogg"),i+"/"+n+';codecs="'+e+'"'},Yr="mp4a.40.2",Jr=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Zr=/^application\/dash\+xml/i,es=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},ts=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||es(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},is=window.BigInt||Number,ns=[is("0x1"),is("0x100"),is("0x10000"),is("0x1000000"),is("0x100000000"),is("0x10000000000"),is("0x1000000000000"),is("0x100000000000000"),is("0x10000000000000000")],rs=(at=new Uint16Array([65484]),255!==(at=new Uint8Array(at.buffer,at.byteOffset,at.byteLength))[0]&&at[0],function(e,t){var i=void 0!==(i=(t=void 0===t?{}:t).signed)&&i,n=void 0!==(t=t.le)&&t;return t=((e=ts(e))[t=n?"reduce":"reduceRight"]||Array.prototype[t]).call(e,(function(t,i,r){return r=n?r:Math.abs(r+1-e.length),t+is(i)*ns[r]}),is(0)),i&&(i=ns[e.length]/is(2)-is(1))<(t=is(t))&&(t=(t=t-i-i)-is(2)),Number(t)}),ss=function(e,t,i){var n,r=void 0===(n=(i=void 0===i?{}:i).offset)?0:n,s=void 0===(n=i.mask)?[]:n;return e=ts(e),i=(t=ts(t)).every||Array.prototype.every,t.length&&e.length-r>=t.length&&i.call(t,(function(t,i){return t===(s[i]?s[i]&e[r+i]:e[r+i])}))},as="http://example.com";function os(e,t){return(t=void 0===t?Object:t)&&"function"==typeof t.freeze?t.freeze(e):e}var ls=os({HTML:"text/html",isHTML:function(e){return e===ls.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),us=os({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===us.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),ds={assign:function(e,t){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},find:function(e,t,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,t);for(var n=0;n<e.length;n++)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];if(t.call(void 0,r,n,e))return r}},freeze:os,MIME_TYPE:ls,NAMESPACE:us},hs=ds.find,cs=ds.NAMESPACE;function ps(e){return""!==e}function ms(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function fs(e){return e?(e=e?e.split(/[\t\n\f\r ]+/).filter(ps):[],Object.keys(e.reduce(ms,{}))):[]}function gs(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function ys(e,t){var i=e.prototype;function n(){}i instanceof t||(n.prototype=t.prototype,gs(i,n=new n),e.prototype=i=n),i.constructor!=e&&(i.constructor=e)}var _s,vs=((_s={}).ELEMENT_NODE=1,_s.ATTRIBUTE_NODE=2,_s.TEXT_NODE=3,_s.CDATA_SECTION_NODE=4,_s.ENTITY_REFERENCE_NODE=5,_s.ENTITY_NODE=6,_s.PROCESSING_INSTRUCTION_NODE=7,_s.COMMENT_NODE=8,_s.DOCUMENT_NODE=9,_s.DOCUMENT_TYPE_NODE=10,_s.DOCUMENT_FRAGMENT_NODE=11,_s.NOTATION_NODE=12,{}),bs={},Ts=(vs.INDEX_SIZE_ERR=(bs[1]="Index size error",1),vs.DOMSTRING_SIZE_ERR=(bs[2]="DOMString size error",2),vs.HIERARCHY_REQUEST_ERR=(bs[3]="Hierarchy request error",3)),Ss=(vs.WRONG_DOCUMENT_ERR=(bs[4]="Wrong document",4),vs.INVALID_CHARACTER_ERR=(bs[5]="Invalid character",5),vs.NO_DATA_ALLOWED_ERR=(bs[6]="No data allowed",6),vs.NO_MODIFICATION_ALLOWED_ERR=(bs[7]="No modification allowed",7),vs.NOT_FOUND_ERR=(bs[8]="Not found",8));function ws(e,t){var i;return t instanceof Error?i=t:(i=this,Error.call(this,bs[e]),this.message=bs[e],Error.captureStackTrace&&Error.captureStackTrace(this,ws)),i.code=e,t&&(this.message=this.message+": "+t),i}function Es(){}function ks(e,t){this._node=e,this._refresh=t,Cs(this)}function Cs(e){var t,i=e._node._inc||e._node.ownerDocument._inc;e._inc!=i&&(t=e._refresh(e._node),da(e,"length",t.length),gs(t,e),e._inc=i)}function xs(){}function Is(e,t){for(var i=e.length;i--;)if(e[i]===t)return i}function As(e,t,i,n){n?t[Is(t,n)]=i:t[t.length++]=i,e&&(t=(i.ownerElement=e).ownerDocument)&&(n&&Rs(t,e,n),n=e,e=i,(i=t)&&i._inc++,e.namespaceURI===cs.XMLNS)&&(n._nsMap[e.prefix?e.localName:""]=e.value)}function Os(e,t,i){var n=Is(t,i);if(!(0<=n))throw new ws(Ss,new Error(e.tagName+"@"+i));for(var r,s=t.length-1;n<s;)t[n]=t[++n];t.length=s,e&&(r=e.ownerDocument)&&(Rs(r,e,i),i.ownerElement=null)}function Ps(){}function Ls(){}function Ds(e){return("<"==e?"&lt;":">"==e&&"&gt;")||("&"==e?"&amp;":'"'==e&&"&quot;")||"&#"+e.charCodeAt()+";"}function Ns(e,t){if(t(e))return 1;if(e=e.firstChild)do{if(Ns(e,t))return 1}while(e=e.nextSibling)}function Ms(){this.ownerDocument=this}function Rs(e,t,i){e&&e._inc++,i.namespaceURI===cs.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function Us(e,t,i){if(e&&e._inc){e._inc++;var n=t.childNodes;if(i)n[n.length++]=i;else{for(var r=t.firstChild,s=0;r;)r=(n[s++]=r).nextSibling;n.length=s,delete n[n.length]}}}function js(e,t){var i=t.previousSibling,n=t.nextSibling;return i?i.nextSibling=n:e.firstChild=n,n?n.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,Us(e.ownerDocument,e),t}function Bs(e){return e&&e.nodeType===Ls.DOCUMENT_TYPE_NODE}function Fs(e){return e&&e.nodeType===Ls.ELEMENT_NODE}function qs(e){return e&&e.nodeType===Ls.TEXT_NODE}function Hs(e,t){var i;if(e=e.childNodes||[],!hs(e,Fs)&&!Bs(t))return i=hs(e,Bs),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Vs(e,t){var i;if(e=e.childNodes||[],!hs(e,(function(e){return Fs(e)&&e!==t})))return i=hs(e,Bs),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function $s(e,t,i){var n=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===Ls.DOCUMENT_FRAGMENT_NODE){var s=r.filter(Fs);if(1<s.length||hs(r,qs))throw new ws(Ts,"More than one element or text in fragment");if(1===s.length&&!Hs(e,i))throw new ws(Ts,"Element in fragment can not be inserted before doctype")}if(Fs(t)&&!Hs(e,i))throw new ws(Ts,"Only one element can be added and only after doctype");if(Bs(t)){if(hs(n,Bs))throw new ws(Ts,"Only one doctype is allowed");if(r=hs(n,Fs),i&&n.indexOf(r)<n.indexOf(i))throw new ws(Ts,"Doctype can only be inserted before an element");if(!i&&r)throw new ws(Ts,"Doctype can not be appended since element is present")}}function Ws(e,t,i){var n=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===Ls.DOCUMENT_FRAGMENT_NODE){var s=r.filter(Fs);if(1<s.length||hs(r,qs))throw new ws(Ts,"More than one element or text in fragment");if(1===s.length&&!Vs(e,i))throw new ws(Ts,"Element in fragment can not be inserted before doctype")}if(Fs(t)&&!Vs(e,i))throw new ws(Ts,"Only one element can be added and only after doctype");if(Bs(t)){if(hs(n,(function(e){return Bs(e)&&e!==i})))throw new ws(Ts,"Only one doctype is allowed");if(r=hs(n,Fs),i&&n.indexOf(r)<n.indexOf(i))throw new ws(Ts,"Doctype can only be inserted before an element")}}function zs(e,t,i,n){if(function(e,t,i){if(!(n=e)||n.nodeType!==Ls.DOCUMENT_NODE&&n.nodeType!==Ls.DOCUMENT_FRAGMENT_NODE&&n.nodeType!==Ls.ELEMENT_NODE)throw new ws(Ts,"Unexpected parent node type "+e.nodeType);var n;if(i&&i.parentNode!==e)throw new ws(Ss,"child not in parent");if(!(n=t)||!(Fs(n)||qs(n)||Bs(n)||n.nodeType===Ls.DOCUMENT_FRAGMENT_NODE||n.nodeType===Ls.COMMENT_NODE||n.nodeType===Ls.PROCESSING_INSTRUCTION_NODE)||Bs(t)&&e.nodeType!==Ls.DOCUMENT_NODE)throw new ws(Ts,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}(e,t,i),e.nodeType===Ls.DOCUMENT_NODE&&(n||$s)(e,t,i),(n=t.parentNode)&&n.removeChild(t),11===t.nodeType){var r=t.firstChild;if(null==r)return t;var s=t.lastChild}else r=s=t;for(n=i?i.previousSibling:e.lastChild,r.previousSibling=n,s.nextSibling=i,n?n.nextSibling=r:e.firstChild=r,null==i?e.lastChild=s:i.previousSibling=s;r.parentNode=e,r!==s&&(r=r.nextSibling););return Us(e.ownerDocument||e,e),11==t.nodeType&&(t.firstChild=t.lastChild=null),t}function Gs(){this._nsMap={}}function Xs(){}function Ks(){}function Qs(){}function Ys(){}function Js(){}function Zs(){}function ea(){}function ta(){}function ia(){}function na(){}function ra(){}function sa(){}function aa(e,t){var i,n=[],r=9==this.nodeType&&this.documentElement||this,s=r.prefix,a=r.namespaceURI;return ua(this,n,e,t,i=a&&null==s&&null==r.lookupPrefix(a)?[{namespace:a,prefix:null}]:i),n.join("")}function oa(e,t,i){var n=e.prefix||"",r=e.namespaceURI;if(r&&("xml"!==n||r!==cs.XML)&&r!==cs.XMLNS){for(var s=i.length;s--;){var a=i[s];if(a.prefix===n)return a.namespace!==r}return 1}}function la(e,t,i){e.push(" ",t,'="',i.replace(/[<>&"\t\n\r]/g,Ds),'"')}function ua(e,t,i,n,r){if(r=r||[],n){if(!(e=n(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case 1:var s,a,o,l=e.attributes,u=l.length,d=e.firstChild,h=e.tagName,c=h;if(!(i=cs.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var p,m=0;m<l.length;m++)if("xmlns"===l.item(m).name){p=l.item(m).value;break}if(!p)for(var f=r.length-1;0<=f;f--)if(""===(g=r[f]).prefix&&g.namespace===e.namespaceURI){p=g.namespace;break}var g;if(p!==e.namespaceURI)for(f=r.length-1;0<=f;f--)if((g=r[f]).namespace===e.namespaceURI){g.prefix&&(c=g.prefix+":"+h);break}}t.push("<",c);for(var y=0;y<u;y++)"xmlns"==(s=l.item(y)).prefix?r.push({prefix:s.localName,namespace:s.value}):"xmlns"==s.nodeName&&r.push({prefix:"",namespace:s.value});for(y=0;y<u;y++)oa(s=l.item(y),0,r)&&(la(t,(a=s.prefix||"")?"xmlns:"+a:"xmlns",o=s.namespaceURI),r.push({prefix:a,namespace:o})),ua(s,t,i,n,r);if(h===c&&oa(e,0,r)&&(la(t,(a=e.prefix||"")?"xmlns:"+a:"xmlns",o=e.namespaceURI),r.push({prefix:a,namespace:o})),d||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(h)){if(t.push(">"),i&&/^script$/i.test(h))for(;d;)d.data?t.push(d.data):ua(d,t,i,n,r.slice()),d=d.nextSibling;else for(;d;)ua(d,t,i,n,r.slice()),d=d.nextSibling;t.push("</",c,">")}else t.push("/>");return;case 9:case 11:for(d=e.firstChild;d;)ua(d,t,i,n,r.slice()),d=d.nextSibling;return;case 2:return la(t,e.name,e.value);case 3:return t.push(e.data.replace(/[<&>]/g,Ds));case 4:return t.push("<![CDATA[",e.data,"]]>");case 8:return t.push("\x3c!--",e.data,"--\x3e");case 10:var _=e.publicId,v=e.systemId;return t.push("<!DOCTYPE ",e.name),void(_?(t.push(" PUBLIC ",_),v&&"."!=v&&t.push(" ",v),t.push(">")):v&&"."!=v?t.push(" SYSTEM ",v,">"):((_=e.internalSubset)&&t.push(" [",_,"]"),t.push(">")));case 7:return t.push("<?",e.target," ",e.data,"?>");case 5:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function da(e,t,i){e[t]=i}vs.NOT_SUPPORTED_ERR=(bs[9]="Not supported",9),vs.INUSE_ATTRIBUTE_ERR=(bs[10]="Attribute in use",10),vs.INVALID_STATE_ERR=(bs[11]="Invalid state",11),vs.SYNTAX_ERR=(bs[12]="Syntax error",12),vs.INVALID_MODIFICATION_ERR=(bs[13]="Invalid modification",13),vs.NAMESPACE_ERR=(bs[14]="Invalid namespace",14),vs.INVALID_ACCESS_ERR=(bs[15]="Invalid access",15),ws.prototype=Error.prototype,gs(vs,ws),Es.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var i=[],n=0;n<this.length;n++)ua(this[n],i,e,t);return i.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},ks.prototype.item=function(e){return Cs(this),this[e]},ys(ks,Es),xs.prototype={length:0,item:Es.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var i=this[t];if(i.nodeName==e)return i}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new ws(10);return t=this.getNamedItem(e.nodeName),As(this._ownerElement,this,e,t),t},setNamedItemNS:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new ws(10);return t=this.getNamedItemNS(e.namespaceURI,e.localName),As(this._ownerElement,this,e,t),t},removeNamedItem:function(e){return e=this.getNamedItem(e),Os(this._ownerElement,this,e),e},removeNamedItemNS:function(e,t){return e=this.getNamedItemNS(e,t),Os(this._ownerElement,this,e),e},getNamedItemNS:function(e,t){for(var i=this.length;i--;){var n=this[i];if(n.localName==t&&n.namespaceURI==e)return n}return null}},Ps.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,i){var n=new Ms;return n.implementation=this,n.childNodes=new Es,n.doctype=i||null,i&&n.appendChild(i),t&&(i=n.createElementNS(e,t),n.appendChild(i)),n},createDocumentType:function(e,t,i){var n=new Zs;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=i||"",n}},Ls.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return zs(this,e,t)},replaceChild:function(e,t){zs(this,e,t,Ws),t&&this.removeChild(t)},removeChild:function(e){return js(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return function e(t,i,n){var r=new i.constructor;for(var s in i){var a;Object.prototype.hasOwnProperty.call(i,s)&&"object"!=typeof(a=i[s])&&a!=r[s]&&(r[s]=a)}switch(i.childNodes&&(r.childNodes=new Es),r.ownerDocument=t,r.nodeType){case 1:var o=i.attributes,l=r.attributes=new xs,u=o.length;l._ownerElement=r;for(var d=0;d<u;d++)r.setAttributeNode(e(t,o.item(d),!0));break;case 2:n=!0}if(n)for(var h=i.firstChild;h;)r.appendChild(e(t,h,n)),h=h.nextSibling;return r}(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&3==t.nodeType&&3==e.nodeType?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return 0<this.attributes.length},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i[n]===e)return n;t=2==t.nodeType?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,e))return i[e];t=2==t.nodeType?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},gs(_s,Ls),gs(_s,Ls.prototype),Ms.prototype={nodeName:"#document",nodeType:9,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(11==e.nodeType)for(var i=e.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,t),i=n}else zs(this,e,t),null===(e.ownerDocument=this).documentElement&&1===e.nodeType&&(this.documentElement=e);return e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),js(this,e)},replaceChild:function(e,t){zs(this,e,t,Ws),e.ownerDocument=this,t&&this.removeChild(t),Fs(e)&&(this.documentElement=e)},importNode:function(e,t){return function e(t,i,n){var r;switch(i.nodeType){case 1:(r=i.cloneNode(!1)).ownerDocument=t;case 11:break;case 2:n=!0}if((r=r||i.cloneNode(!1)).ownerDocument=t,r.parentNode=null,n)for(var s=i.firstChild;s;)r.appendChild(e(t,s,n)),s=s.nextSibling;return r}(this,e,t)},getElementById:function(e){var t=null;return Ns(this.documentElement,(function(i){if(1==i.nodeType&&i.getAttribute("id")==e)return t=i,!0})),t},getElementsByClassName:function(e){var t=fs(e);return new ks(this,(function(i){var n=[];return 0<t.length&&Ns(i.documentElement,(function(r){var s,a,o;r!==i&&1===r.nodeType&&(s=r.getAttribute("class"))&&((a=e===s)||(s=fs(s),a=t.every((o=s,function(e){return o&&-1!==o.indexOf(e)}))),a)&&n.push(r)})),n}))},createElement:function(e){var t=new Gs;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new Es,(t.attributes=new xs)._ownerElement=t},createDocumentFragment:function(){var e=new na;return e.ownerDocument=this,e.childNodes=new Es,e},createTextNode:function(e){var t=new Qs;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new Ys;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new Js;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new ra;return i.ownerDocument=this,i.tagName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new Xs;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new ia;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new Gs,n=t.split(":"),r=i.attributes=new xs;return i.childNodes=new Es,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,r._ownerElement=i},createAttributeNS:function(e,t){var i=new Xs,n=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,i}},ys(Ms,Ls),Ms.prototype.getElementsByTagName=(Gs.prototype={nodeType:1,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){return(e=this.getAttributeNode(e))&&e.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){(e=this.ownerDocument.createAttribute(e)).value=e.nodeValue=""+t,this.setAttributeNode(e)},removeAttribute:function(e){(e=this.getAttributeNode(e))&&this.removeAttributeNode(e)},appendChild:function(e){return 11===e.nodeType?this.insertBefore(e,null):(t=this,e.parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,Us(t.ownerDocument,t,e),e);var t},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){(e=this.getAttributeNodeNS(e,t))&&this.removeAttributeNode(e)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){return(e=this.getAttributeNodeNS(e,t))&&e.value||""},setAttributeNS:function(e,t,i){(e=this.ownerDocument.createAttributeNS(e,t)).value=e.nodeValue=""+i,this.setAttributeNode(e)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new ks(this,(function(t){var i=[];return Ns(t,(function(n){n===t||1!=n.nodeType||"*"!==e&&n.tagName!=e||i.push(n)})),i}))},getElementsByTagNameNS:function(e,t){return new ks(this,(function(i){var n=[];return Ns(i,(function(r){r===i||1!==r.nodeType||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||n.push(r)})),n}))}}).getElementsByTagName,Ms.prototype.getElementsByTagNameNS=Gs.prototype.getElementsByTagNameNS,ys(Gs,Ls),Xs.prototype.nodeType=2,ys(Xs,Ls),Ks.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(bs[Ts])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){var n=this.data.substring(0,e);e=this.data.substring(e+t),this.nodeValue=this.data=i=n+i+e,this.length=i.length}},ys(Ks,Ls),Qs.prototype={nodeName:"#text",nodeType:3,splitText:function(e){var t=(i=this.data).substring(e),i=i.substring(0,e);return this.data=this.nodeValue=i,this.length=i.length,e=this.ownerDocument.createTextNode(t),this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling),e}},ys(Qs,Ks),Ys.prototype={nodeName:"#comment",nodeType:8},ys(Ys,Ks),Js.prototype={nodeName:"#cdata-section",nodeType:4},ys(Js,Ks),Zs.prototype.nodeType=10,ys(Zs,Ls),ea.prototype.nodeType=12,ys(ea,Ls),ta.prototype.nodeType=6,ys(ta,Ls),ia.prototype.nodeType=5,ys(ia,Ls),na.prototype.nodeName="#document-fragment",na.prototype.nodeType=11,ys(na,Ls),ra.prototype.nodeType=7,ys(ra,Ls),sa.prototype.serializeToString=function(e,t,i){return aa.call(e,t,i)},Ls.prototype.toString=aa;try{Object.defineProperty&&(Object.defineProperty(ks.prototype,"length",{get:function(){return Cs(this),this.$$length}}),Object.defineProperty(Ls.prototype,"textContent",{get:function(){return function e(t){switch(t.nodeType){case 1:case 11:var i=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&i.push(e(t)),t=t.nextSibling;return i.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case 1:case 11:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),da=function(e,t,i){e["$$"+t]=i})}catch(U){}var ha={DocumentType:Zs,DOMException:ws,DOMImplementation:Ps,Element:Gs,Node:Ls,NodeList:Es,XMLSerializer:sa},ca=ot((function(e,t){var i=ds.freeze;t.XML_ENTITIES=i({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=i({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"",lowast:"",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"",cap:"∩",cup:"",int:"∫",there4:"∴",sim:"",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:"",emsp:"",thinsp:"",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"",mdash:"—",lsquo:"",rsquo:"",sbquo:"",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"",Prime:"″",lsaquo:"",rsaquo:"",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES})),pa=(ca.XML_ENTITIES,ca.HTML_ENTITIES,ca.entityMap,ds.NAMESPACE),ma=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,fa=new RegExp("[\\-\\.0-9"+ma.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),ga=new RegExp("^"+ma.source+fa.source+"*(?::"+ma.source+fa.source+"*)?$");function ya(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,ya)}function _a(){}function va(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function ba(e,t,i){for(var n=e.tagName,r=null,s=e.length;s--;){var a=e[s],o=a.qName,l=a.value;o=0<(d=o.indexOf(":"))?(u=a.prefix=o.slice(0,d),h=o.slice(d+1),"xmlns"===u&&h):(u=null,"xmlns"===(h=o)&&""),a.localName=h,!1!==o&&(null==r&&(r={},Ta(i,i={})),i[o]=r[o]=l,a.uri=pa.XMLNS,t.startPrefixMapping(o,l))}var u;for(s=e.length;s--;)(u=(a=e[s]).prefix)&&("xml"===u&&(a.uri=pa.XML),"xmlns"!==u)&&(a.uri=i[u||""]);var d,h=0<(d=n.indexOf(":"))?(u=e.prefix=n.slice(0,d),e.localName=n.slice(d+1)):(u=null,e.localName=n),c=e.uri=i[u||""];if(t.startElement(c,h,n,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,1;if(t.endElement(c,h,n),r)for(u in r)Object.prototype.hasOwnProperty.call(r,u)&&t.endPrefixMapping(u)}function Ta(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function Sa(){this.attributeNames={}}(ya.prototype=new Error).name=ya.name,_a.prototype={parse:function(e,t,i){var n=this.domBuilder;n.startDocument(),Ta(t,t={}),function(e,t,i,n,r){function s(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(i,t)?i[t]:"#"===t.charAt(0)?65535<(t=parseInt(t.substr(1).replace("x","0x")))?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):String.fromCharCode(t):(r.error("entity not found:"+e),e)}function a(t){var i;m<t&&(i=e.substring(m,t).replace(/&#?\w+;/g,s),h&&o(m),n.characters(i,0,t-m),m=t)}function o(t,i){for(;u<=t&&(i=d.exec(e));)l=i.index,u=l+i[0].length,h.lineNumber++;h.columnNumber=t-l+1}for(var l=0,u=0,d=/.*(?:\r\n?|\n)|.*$/g,h=n.locator,c=[{currentNSMap:t}],p={},m=0;;){try{var f,g,y=e.indexOf("<",m);if(y<0)return e.substr(m).match(/^\s*$/)||(g=(f=n.doc).createTextNode(e.substr(m)),f.appendChild(g),n.currentElement=g);switch(m<y&&a(y),e.charAt(y+1)){case"/":var _=e.indexOf(">",y+3),v=e.substring(y+2,_).replace(/[ \t\n\r]+$/g,""),b=c.pop(),T=(_<0?(v=e.substring(y+2).replace(/[\s<].*/,""),r.error("end tag name: "+v+" is not complete:"+b.tagName),_=y+1+v.length):v.match(/\s</)&&(v=v.replace(/[\s<].*/,""),r.error("end tag name: "+v+" maybe not complete"),_=y+1+v.length),b.localNSMap),S=b.tagName==v;if(S||b.tagName&&b.tagName.toLowerCase()==v.toLowerCase()){if(n.endElement(b.uri,b.localName,v),T)for(var w in T)Object.prototype.hasOwnProperty.call(T,w)&&n.endPrefixMapping(w);S||r.fatalError("end tag name: "+v+" is not match the current start tagName:"+b.tagName)}else c.push(b);_++;break;case"?":h&&o(y),_=function(e,t,i){var n=e.indexOf("?>",t);return n&&(e=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/))?(e[0].length,i.processingInstruction(e[1],e[2]),n+2):-1}(e,y,n);break;case"!":h&&o(y),_=function(e,t,i,n){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?t<(s=e.indexOf("--\x3e",t+4))?(i.comment(e,t+4,s-t-4),s+3):(n.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6))return s=e.indexOf("]]>",t+9),i.startCDATA(),i.characters(e,t+9,s-t-9),i.endCDATA(),s+3;n=function(e,t){var i,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=t,r.exec(e);i=r.exec(e);)if(n.push(i),i[1])return n}(e,t);var r,s=n.length;return 1<s&&/!doctype/i.test(n[0][0])?(e=n[1][0],r=t=!1,3<s&&(/^public$/i.test(n[2][0])?(t=n[3][0],r=4<s&&n[4][0]):/^system$/i.test(n[2][0])&&(r=n[3][0])),n=n[s-1],i.startDTD(e,t,r),i.endDTD(),n.index+n[0].length):-1}(e,y,n,r);break;default:h&&o(y);var E=new Sa,k=c[c.length-1].currentNSMap,C=(_=function(e,t,i,n,r,s){function a(e,t,n){i.attributeNames.hasOwnProperty(e)&&s.fatalError("Attribute "+e+" redefined"),i.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),n)}for(var o,l=++t,u=0;;){var d=e.charAt(l);switch(d){case"=":if(1===u)o=e.slice(t,l);else if(2!==u)throw new Error("attribute equal must after attrName");u=3;break;case"'":case'"':if(3===u||1===u){if(1===u&&(s.warning('attribute value must after "="'),o=e.slice(t,l)),t=l+1,!(0<(l=e.indexOf(d,t))))throw new Error("attribute value no end '"+d+"' match");a(o,h=e.slice(t,l),t-1)}else{if(4!=u)throw new Error('attribute value must after "="');a(o,h=e.slice(t,l),t),s.warning('attribute "'+o+'" missed start quot('+d+")!!"),t=l+1}u=5;break;case"/":switch(u){case 0:i.setTagName(e.slice(t,l));case 5:case 6:case 7:u=7,i.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),0==u&&i.setTagName(e.slice(t,l)),l;case">":switch(u){case 0:i.setTagName(e.slice(t,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(h=e.slice(t,l)).slice(-1)&&(i.closed=!0,h=h.slice(0,-1));case 2:2===u&&(h=o),4==u?(s.warning('attribute "'+h+'" missed quot(")!'),a(o,h,t)):(pa.isHTML(n[""])&&h.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+h+'" missed value!! "'+h+'" instead!!'),a(h,h,t));break;case 3:throw new Error("attribute value missed!!")}return l;case"€":d=" ";default:if(d<=" ")switch(u){case 0:i.setTagName(e.slice(t,l)),u=6;break;case 1:o=e.slice(t,l),u=2;break;case 4:var h=e.slice(t,l);s.warning('attribute "'+h+'" missed quot(")!!'),a(o,h,t);case 5:u=6}else switch(u){case 2:i.tagName,pa.isHTML(n[""])&&o.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,t),t=l,u=1;break;case 5:s.warning('attribute space is required"'+o+'"!!');case 6:u=1,t=l;break;case 3:u=4,t=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}(e,y,E,k,s,r),E.length);if(!E.closed&&function(e,t,i,n){var r=n[i];return null==r&&((r=e.lastIndexOf("</"+i+">"))<t&&(r=e.lastIndexOf("</"+i)),n[i]=r),r<t}(e,_,E.tagName,p)&&(E.closed=!0,i.nbsp||r.warning("unclosed xml attribute")),h&&C){for(var x=va(h,{}),I=0;I<C;I++){var A=E[I];o(A.offset),A.locator=va(h,{})}n.locator=x,ba(E,n,k)&&c.push(E),n.locator=h}else ba(E,n,k)&&c.push(E);pa.isHTML(E.uri)&&!E.closed?_=function(e,t,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var s=e.indexOf("</"+i+">",t);if(e=e.substring(t+1,s),/[&<]/.test(e))return/^script$/i.test(i)||(e=e.replace(/&#?\w+;/g,n)),r.characters(e,0,e.length),s}return t+1}(e,_,E.tagName,s,n):_++}}catch(t){if(t instanceof ya)throw t;r.error("element parse error: "+t),_=-1}m<_?m=_:a(Math.max(y,m)+1)}}(e,t,i,n,this.errorHandler),n.endDocument()}},Sa.prototype={setTagName:function(e){if(!ga.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!ga.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};var wa={XMLReader:_a,ParseError:ya},Ea=ha.DOMImplementation,ka=ds.NAMESPACE,Ca=wa.ParseError,xa=wa.XMLReader;function Ia(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function Aa(e){this.options=e||{locator:{}}}function Oa(){this.cdata=!1}function Pa(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function La(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function Da(e,t){(e.currentElement||e.doc).appendChild(t)}Aa.prototype.parseFromString=function(e,t){var i=this.options,n=new xa,r=i.domBuilder||new Oa,s=i.errorHandler,a=i.locator,o=i.xmlns||{},l=(t=/\/x?html?$/.test(t))?ca.HTML_ENTITIES:ca.XML_ENTITIES;return a&&r.setDocumentLocator(a),n.errorHandler=function(e,t,i){if(!e){if(t instanceof Oa)return t;e=t}var n={},r=e instanceof Function;function s(t){var s=e[t];!s&&r&&(s=2==e.length?function(i){e(t,i)}:e),n[t]=s?function(e){s("[xmldom "+t+"]\t"+e+function(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(i))}:function(){}}return i=i||{},s("warning"),s("error"),s("fatalError"),n}(s,r,a),n.domBuilder=i.domBuilder||r,t&&(o[""]=ka.HTML),o.xml=o.xml||ka.XML,s=i.normalizeLineEndings||Ia,e&&"string"==typeof e?n.parse(s(e),o,l):n.errorHandler.error("invalid doc source"),r.doc},Oa.prototype={startDocument:function(){this.doc=(new Ea).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,n){var r=this.doc,s=r.createElementNS(e,i||t),a=n.length;Da(this,s),this.currentElement=s,this.locator&&Pa(this.locator,s);for(var o=0;o<a;o++){e=n.getURI(o);var l=n.getValue(o),u=(i=n.getQName(o),r.createAttributeNS(e,i));this.locator&&Pa(n.getLocator(o),u),u.value=u.nodeValue=l,s.setAttributeNode(u)}},endElement:function(e,t,i){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){e=this.doc.createProcessingInstruction(e,t),this.locator&&Pa(this.locator,e),Da(this,e)},ignorableWhitespace:function(e,t,i){},characters:function(e,t,i){var n;(e=La.apply(this,arguments))&&(n=this.cdata?this.doc.createCDATASection(e):this.doc.createTextNode(e),this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator)&&Pa(this.locator,n)},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,i){e=La.apply(this,arguments),e=this.doc.createComment(e),this.locator&&Pa(this.locator,e),Da(this,e)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,i){var n=this.doc.implementation;n&&n.createDocumentType&&(n=n.createDocumentType(e,t,i),this.locator&&Pa(this.locator,n),Da(this,n),this.doc.doctype=n)},warning:function(e){},error:function(e){},fatalError:function(e){throw new Ca(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){Oa.prototype[e]=function(){return null}}));var Na={__DOMHandler:Oa,normalizeLineEndings:Ia,DOMParser:Aa}.DOMParser;const Ma=e=>!!e&&"object"==typeof e,Ra=(...e)=>e.reduce(((e,t)=>("object"==typeof t&&Object.keys(t).forEach((i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):Ma(e[i])&&Ma(t[i])?e[i]=Ra(e[i],t[i]):e[i]=t[i]})),e)),{}),Ua=e=>Object.keys(e).map((t=>e[t])),ja=e=>e.reduce(((e,t)=>e.concat(t)),[]),Ba=e=>{if(!e.length)return[];var t=[];for(let i=0;i<e.length;i++)t.push(e[i]);return t};const Fa=({baseUrl:e="",source:t="",range:i="",indexRange:n=""})=>{if(e={uri:t,resolvedUri:$r(e||"",t)},i||n){t=(i||n).split("-");let r,s=window.BigInt?window.BigInt(t[0]):parseInt(t[0],10),a=window.BigInt?window.BigInt(t[1]):parseInt(t[1],10);s<Number.MAX_SAFE_INTEGER&&"bigint"==typeof s&&(s=Number(s)),a<Number.MAX_SAFE_INTEGER&&"bigint"==typeof a&&(a=Number(a)),"bigint"==typeof(r="bigint"==typeof a||"bigint"==typeof s?window.BigInt(a)-window.BigInt(s)+window.BigInt(1):a-s+1)&&r<Number.MAX_SAFE_INTEGER&&(r=Number(r)),e.byterange={length:r,offset:s}}return e},qa=e=>(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),Ha={static(e){var{duration:t,timescale:i=1,sourceDuration:n,periodDuration:r}=e,t=t/i;return"number"==typeof(e=qa(e.endNumber))?{start:0,end:e}:"number"==typeof r?{start:0,end:r/t}:{start:0,end:n/t}},dynamic(e){var{NOW:t,clientOffset:i,availabilityStartTime:n,timescale:r=1,duration:s,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,t=(e=qa(e.endNumber),(t+i)/1e3),i=n+a,n=Math.ceil((t+o-i)*r/s),a=Math.floor((t-i-l)*r/s),o=Math.floor((t-i)*r/s);return{start:Math.max(0,a),end:"number"==typeof e?e:Math.min(n,o)}}},Va=e=>{var t,{type:i,duration:n,timescale:r=1,periodDuration:s,sourceDuration:a}=e,{start:o,end:l}=Ha[i](e),o=((e,t)=>{var i=[];for(let n=e;n<t;n++)i.push(n);return i})(o,l).map((t=e,e=>{var{duration:i,timescale:n=1,periodStart:r,startNumber:s=1}=t;return{number:s+e,duration:i/n,timeline:r,time:e*i}}));return"static"===i&&(o[l=o.length-1].duration=("number"==typeof s?s:a)-n/r*l),o},$a=e=>{var{baseUrl:t,initialization:i={},sourceDuration:n,indexRange:r="",periodStart:s,presentationTime:a,number:o=0,duration:l}=e;if(t)return i=Fa({baseUrl:t,source:i.sourceURL,range:i.range}),(t=Fa({baseUrl:t,source:t,indexRange:r})).map=i,l?(r=Va(e)).length&&(t.duration=r[0].duration,t.timeline=r[0].timeline):n&&(t.duration=n,t.timeline=s),t.presentationTime=a||s,t.number=o,[t];throw new Error("NO_BASE_URL")},Wa=(e,t,i)=>{var n=e.sidx.map||null,r=e.sidx.duration,s=e.timeline||0,a=(a=e.sidx.byterange).offset+a.length,o=t.timescale,l=t.references.filter((e=>1!==e.referenceType)),u=[],d=e.endList?"static":"dynamic",h=e.sidx.timeline;let c,p=h,m=e.mediaSequence||0;c="bigint"==typeof t.firstOffset?window.BigInt(a)+t.firstOffset:a+t.firstOffset;for(let e=0;e<l.length;e++){var f=(g=t.references[e]).referencedSize,g=g.subsegmentDuration;let a;a="bigint"==typeof c?c+window.BigInt(f)-window.BigInt(1):c+f-1;var y=$a(y={baseUrl:i,timescale:o,timeline:s,periodStart:h,presentationTime:p,number:m,duration:g,sourceDuration:r,indexRange:y=c+"-"+a,type:d})[0];n&&(y.map=n),u.push(y),c+="bigint"==typeof c?window.BigInt(f):f,p+=g/o,m++}return e.segments=u,e},za=["AUDIO","SUBTITLES"],Ga=e=>{return t=({timeline:e})=>e,Ua(e.reduce(((e,i)=>(i.forEach((i=>{e[t(i)]=i})),e)),{})).sort(((e,t)=>e.timeline>t.timeline?1:-1));var t},Xa=e=>{let t=[];var i,n;return i=e,n=(e,i,n,r)=>{t=t.concat(e.playlists||[])},(e=za).forEach((function(e){for(var t in i.mediaGroups[e])for(var r in i.mediaGroups[e][t]){var s=i.mediaGroups[e][t][r];n(s)}})),t},Ka=({playlist:e,mediaSequence:t})=>{e.mediaSequence=t,e.segments.forEach(((t,i)=>{t.number=e.mediaSequence+i}))},Qa=e=>e&&e.uri+"-"+(e=>{let t;return t="bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1,e.offset+"-"+t})(e.byterange),Ya=e=>Ua(e.reduce(((e,t)=>{var i=t.attributes.id+(t.attributes.lang||"");return e[i]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),e[i].segments.push(...t.segments)),t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)):(e[i]=t,e[i].attributes.timelineStarts=[]),e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e}),{})).map((e=>(e.discontinuityStarts=(e.segments||[]).reduce(((e,t,i)=>(t.discontinuity&&e.push(i),e)),[]),e))),Ja=(e,t)=>{var i=Qa(e.sidx);return(t=i&&t[i]&&t[i].sidx)&&Wa(e,t,e.sidx.resolvedUri),e},Za=({attributes:e,segments:t,sidx:i,discontinuityStarts:n})=>(n={attributes:{NAME:e.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:e.width,height:e.height},CODECS:e.codecs,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:"",targetDuration:e.duration,discontinuityStarts:n,timelineStarts:e.timelineStarts,segments:t},e.frameRate&&(n.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(n.contentProtection=e.contentProtection),i&&(n.sidx=i),n),eo=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,to=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,io=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,no=e=>e?Object.keys(e).reduce(((t,i)=>(i=e[i],t.concat(i.playlists))),[]):[],ro=(e,t)=>{var{type:i,minimumUpdatePeriod:n=0,media:r="",sourceDuration:s,timescale:a=1,startNumber:o=1,periodStart:l}=e,u=[];let d=-1;for(let f=0;f<t.length;f++){var h=(p=t[f]).d,c=p.r||0,p=p.t||0;let g;d<0&&(d=p),p&&p>d&&(d=p),g=c<0?(p=f+1)===t.length?"dynamic"===i&&0<n&&0<r.indexOf("$Number$")?((e,t,i)=>{var{NOW:e,clientOffset:n,availabilityStartTime:r,timescale:s=1,periodStart:a=0,minimumUpdatePeriod:o=0}=e;return Math.ceil((((e+n)/1e3+o-(r+a))*s-t)/i)})(e,d,h):(s*a-d)/h:(t[p].t-d)/h:c+1;var m=o+u.length+g;let y=o+u.length;for(;y<m;)u.push({number:y,duration:h/a,time:d,timeline:l}),d+=h,y++}return u},so=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,ao=(e,t)=>{return e.replace(so,(i=t,(e,t,n,r)=>"$$"===e?"$":void 0===i[t]?e:(e=""+i[t],"RepresentationID"===t||(r=n?parseInt(r,10):1)<=e.length?e:new Array(r-e.length+1).join("0")+e)));var i},oo=(e,t)=>{const i={RepresentationID:e.id,Bandwidth:e.bandwidth||0};var{initialization:n={sourceURL:"",range:""}}=e;const r=Fa({baseUrl:e.baseUrl,source:ao(n.sourceURL,i),range:n.range});return n=t,((t=e).duration||n?t.duration?Va(t):ro(t,n):[{number:t.startNumber||1,duration:t.sourceDuration,time:0,timeline:t.periodStart}]).map((t=>{i.Number=t.number,i.Time=t.time;var n=ao(e.media||"",i),s=e.timescale||1,a=e.presentationTimeOffset||0;return a=e.periodStart+(t.time-a)/s,{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:$r(e.baseUrl||"",n),map:r,number:t.number,presentationTime:a}}))},lo=(e,t)=>{const{duration:i,segmentUrls:n=[],periodStart:r}=e;if(!i&&!t||i&&t)throw new Error("SEGMENT_TIME_UNSPECIFIED");const s=n.map((t=>{var{baseUrl:i,initialization:n={}}=i=e,n=Fa({baseUrl:i,source:n.sourceURL,range:n.range});return(i=Fa({baseUrl:i,source:t.media,range:t.mediaRange})).map=n,i}));let a;return i&&(a=Va(e)),(a=t?ro(e,t):a).map(((t,i)=>{var n,a;if(s[i])return i=s[i],n=e.timescale||1,a=e.presentationTimeOffset||0,i.timeline=t.timeline,i.duration=t.duration,i.number=t.number,i.presentationTime=r+(t.time-a)/n,i})).filter((e=>e))},uo=({attributes:e,segmentInfo:t})=>{let i,n;var r,s,a;return t.template?(n=oo,i=Ra(e,t.template)):t.base?(n=$a,i=Ra(e,t.base)):t.list&&(n=lo,i=Ra(e,t.list)),e={attributes:e},n&&(r=n(i,t.segmentTimeline),i.duration?(({duration:s,timescale:a=1}=i),i.duration=s/a):r.length?i.duration=r.reduce(((e,t)=>Math.max(e,Math.ceil(t.duration))),0):i.duration=0,e.attributes=i,e.segments=r,t.base)&&i.indexRange&&(e.sidx=r[0],e.segments=[]),e},ho=(e,t)=>Ba(e.childNodes).filter((({tagName:e})=>e===t)),co=e=>e.textContent.trim(),po=e=>{var t,i,n,r,s;return(e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e))?([e,t,i,n,r,s]=e.slice(1),31536e3*parseFloat(e||0)+2592e3*parseFloat(t||0)+86400*parseFloat(i||0)+3600*parseFloat(n||0)+60*parseFloat(r||0)+parseFloat(s||0)):0},mo={mediaPresentationDuration:e=>po(e),availabilityStartTime:e=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)&&(e+="Z"),Date.parse(e)/1e3),minimumUpdatePeriod:e=>po(e),suggestedPresentationDelay:e=>po(e),type:e=>e,timeShiftBufferDepth:e=>po(e),start:e=>po(e),width:e=>parseInt(e,10),height:e=>parseInt(e,10),bandwidth:e=>parseInt(e,10),frameRate:e=>parseFloat(e.split("/").reduce(((e,t)=>e/t))),startNumber:e=>parseInt(e,10),timescale:e=>parseInt(e,10),presentationTimeOffset:e=>parseInt(e,10),duration(e){var t=parseInt(e,10);return isNaN(t)?po(e):t},d:e=>parseInt(e,10),t:e=>parseInt(e,10),r:e=>parseInt(e,10),DEFAULT:e=>e},fo=e=>e&&e.attributes?Ba(e.attributes).reduce(((e,t)=>{var i=mo[t.name]||mo.DEFAULT;return e[t.name]=i(t.value),e}),{}):{},go={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},yo=(e,t)=>t.length?ja(e.map((function(e){return t.map((function(t){return $r(e,co(t))}))}))):e,_o=e=>{var t=ho(e,"SegmentTemplate")[0],i=ho(e,"SegmentList")[0],n=i&&ho(i,"SegmentURL").map((e=>Ra({tag:"SegmentURL"},fo(e)))),r=(e=ho(e,"SegmentBase")[0],(r=i||t)&&ho(r,"SegmentTimeline")[0]),s=(s=i||e||t)&&ho(s,"Initialization")[0];(t=t&&fo(t))&&s?t.initialization=s&&fo(s):t&&t.initialization&&(t.initialization={sourceURL:t.initialization});const a={template:t,segmentTimeline:r&&ho(r,"S").map((e=>fo(e))),list:i&&Ra(fo(i),{segmentUrls:n,initialization:fo(s)}),base:e&&Ra(fo(e),{initialization:fo(s)})};return Object.keys(a).forEach((e=>{a[e]||delete a[e]})),a},vo=e=>{if(""===e)throw new Error("DASH_EMPTY_MANIFEST");var t,i=new Na;let n;try{n=(t=i.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!n||n&&0<n.getElementsByTagName("parsererror").length)throw new Error("DASH_INVALID_XML");return n};function bo(e,t){var i,n,r;return void 0===t&&(t=0),(e=ts(e)).length-t<10||!ss(e,Ao,{offset:t})?t:bo(e,t+=(void 0===(n=t)&&(n=0),r=(i=ts(i=e))[n+5],i=i[n+6]<<21|i[n+7]<<14|i[n+8]<<7|i[n+9],(16&r)>>4?20+i:10+i))}function To(e){return"string"==typeof e?Vr(e):e}function So(e,t,i){void 0===i&&(i=!1),n=t,t=Array.isArray(n)?n.map(To):[To(n)],e=ts(e);var n,r=[];if(t.length)for(var s=0;s<e.length;){var a=(e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3])>>>0,o=e.subarray(s+4,s+8);if(0==a)break;if((a=s+a)>e.length){if(i)break;a=e.length}var l=e.subarray(s+8,a);ss(o,t[0])&&(1===t.length?r.push(l):r.push.apply(r,So(l,t.slice(1),i))),s=a}return r}function wo(e,t,i){var n;return i>=t.length?t.length:(n=Lo(t,i,!1),ss(e.bytes,n.bytes)?i:wo(e,t,i+(e=Lo(t,i+n.length)).length+e.value+n.length))}function Eo(e,t){i=t,t=Array.isArray(i)?i.map((function(e){return Do(e)})):[Do(i)],e=ts(e);var i,n=[];if(t.length)for(var r=0;r<e.length;){var s=Lo(e,r,!1),a=Lo(e,r+s.length),o=r+s.length+a.length,l=(127===a.value&&(a.value=wo(s,e,o),a.value!==e.length)&&(a.value-=o),o+a.value>e.length?e.length:o+a.value);o=e.subarray(o,l),ss(t[0],s.bytes)&&(1===t.length?n.push(o):n=n.concat(Eo(o,t.slice(1)))),r+=s.length+a.length+o.length}return n}function ko(e,t,i,n){void 0===n&&(n=1/0),e=ts(e),i=[].concat(i);for(var r,s=0,a=0;s<e.length&&(a<n||r);){var o=void 0;if(ss(e.subarray(s),No)?o=4:ss(e.subarray(s),Mo)&&(o=3),o){if(a++,r)return Uo(e.subarray(r,s));var l=void 0;"h264"===t?l=31&e[s+o]:"h265"===t&&(l=e[s+o]>>1&63),-1!==i.indexOf(l)&&(r=s+o),s+=o+("h264"===t?1:2)}else s++}return e.subarray(0,0)}function Co(e){e=ts(e);for(var t=0;t<Fo.length;t++){var i=Fo[t];if(qo[i](e))return i}return""}var xo=Math.pow(2,32),Io=function(e){var t;return(e=new DataView(e.buffer,e.byteOffset,e.byteLength)).getBigUint64?(t=e.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:e.getUint32(0)*xo+e.getUint32(4)},Ao=ts([73,68,51]),Oo={EBML:ts([26,69,223,163]),DocType:ts([66,130]),Segment:ts([24,83,128,103]),SegmentInfo:ts([21,73,169,102]),Tracks:ts([22,84,174,107]),Track:ts([174]),TrackNumber:ts([215]),DefaultDuration:ts([35,227,131]),TrackEntry:ts([174]),TrackType:ts([131]),FlagDefault:ts([136]),CodecID:ts([134]),CodecPrivate:ts([99,162]),VideoTrack:ts([224]),AudioTrack:ts([225]),Cluster:ts([31,67,182,117]),Timestamp:ts([231]),TimestampScale:ts([42,215,177]),BlockGroup:ts([160]),BlockDuration:ts([155]),Block:ts([161]),SimpleBlock:ts([163])},Po=[128,64,32,16,8,4,2,1],Lo=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!1);var r=function(e){for(var t=1,i=0;i<Po.length&&!(e&Po[i]);i++)t++;return t}(e[t]),s=e.subarray(t,t+r);return i&&((s=Array.prototype.slice.call(e,t,t+r))[0]^=Po[r-1]),{length:r,value:rs(s,{signed:n}),bytes:s}},Do=function e(t){return"string"==typeof t?t.match(/.{1,2}/g).map(e):"number"==typeof t?function(e,t){for(var i=void 0!==(t=(void 0===t?{}:t).le)&&t,n=(t=e=is(e="bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e?0:e),Math.ceil(t.toString(2).length/8)),r=new Uint8Array(new ArrayBuffer(n)),s=0;s<n;s++){var a=i?s:Math.abs(s+1-r.length);r[a]=Number(e/ns[s]&is(255)),e<0&&(r[a]=Math.abs(~r[a]),r[a]-=0===s?1:2)}return r}(t):t},No=ts([0,0,0,1]),Mo=ts([0,0,1]),Ro=ts([0,0,3]),Uo=function(e){for(var t=[],i=1;i<e.length-2;)ss(e.subarray(i,i+3),Ro)&&(t.push(i+2),i++),i++;if(0===t.length)return e;var n=e.length-t.length,r=new Uint8Array(n),s=0;for(i=0;i<n;s++,i++)s===t[0]&&(s++,t.shift()),r[i]=e[s];return r},jo={webm:ts([119,101,98,109]),matroska:ts([109,97,116,114,111,115,107,97]),flac:ts([102,76,97,67]),ogg:ts([79,103,103,83]),ac3:ts([11,119]),riff:ts([82,73,70,70]),avi:ts([65,86,73]),wav:ts([87,65,86,69]),"3gp":ts([102,116,121,112,51,103]),mp4:ts([102,116,121,112]),fmp4:ts([115,116,121,112]),mov:ts([102,116,121,112,113,116]),moov:ts([109,111,111,118]),moof:ts([109,111,111,102])},Bo={aac:function(e){var t=bo(e);return ss(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=bo(e);return ss(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){return e=Eo(e,[Oo.EBML,Oo.DocType])[0],ss(e,jo.webm)},mkv:function(e){return e=Eo(e,[Oo.EBML,Oo.DocType])[0],ss(e,jo.matroska)},mp4:function(e){return!Bo["3gp"](e)&&!Bo.mov(e)&&(!!(ss(e,jo.mp4,{offset:4})||ss(e,jo.fmp4,{offset:4})||ss(e,jo.moof,{offset:4})||ss(e,jo.moov,{offset:4}))||void 0)},mov:function(e){return ss(e,jo.mov,{offset:4})},"3gp":function(e){return ss(e,jo["3gp"],{offset:4})},ac3:function(e){var t=bo(e);return ss(e,jo.ac3,{offset:t})},ts:function(e){if(e.length<189&&1<=e.length)return 71===e[0];for(var t=0;t+188<e.length&&t<188;){if(71===e[t]&&71===e[t+188])return!0;t+=1}return!1},flac:function(e){var t=bo(e);return ss(e,jo.flac,{offset:t})},ogg:function(e){return ss(e,jo.ogg)},avi:function(e){return ss(e,jo.riff)&&ss(e,jo.avi,{offset:8})},wav:function(e){return ss(e,jo.riff)&&ss(e,jo.wav,{offset:8})},h264:function(e){return ko(e,"h264",7,3).length},h265:function(e){return ko(e,"h265",[32,33],3).length}},Fo=Object.keys(Bo).filter((function(e){return"ts"!==e&&"h264"!==e&&"h265"!==e})).concat(["ts","h264","h265"]),qo=(Fo.forEach((function(e){var t=Bo[e];Bo[e]=function(e){return t(ts(e))}})),Bo),Ho=9e4;const Vo=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i="function"==typeof window.URL,n=/^\/\//.test(e),r=!window.location&&!/\/\//i.test(e);return i?e=new window.URL(e,window.location||"http://example.com"):/\/\//i.test(e)||(e=Ir.buildAbsoluteURL(window.location&&window.location.href||"",e)),i?(i=new URL(t,e),r?i.href.slice(18):n?i.href.slice(i.protocol.length):i.href):Ir.buildAbsoluteURL(e,t)},$o=(e,t)=>t&&t.responseURL&&e!==t.responseURL?t.responseURL:e,Wo=e=>xr.log.debug?xr.log.debug.bind(xr,"VHS:",e+" >"):function(){};function zo(...e){var t=xr.obj||xr;return(t.merge||t.mergeOptions).apply(t,e)}function Go(...e){var t=xr.time||xr;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function Xo(e,t){return il(e,(function(e,i){return e-tl<=t&&i+tl>=t}))}function Ko(e,t){return il(e,(function(e){return e-el>=t}))}function Qo(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function Yo(e,t){let i=0;if(e&&e.length)for(let s=0;s<e.length;s++){var n=e.start(s),r=e.end(s);r<t||(i+=n<t&&t<=r?r-t:r-n)}return i}function Jo({defaultDuration:e,durationList:t,startIndex:i,endIndex:n}){let r=0;if(n<i&&([i,n]=[n,i]),i<0){for(let t=i;t<Math.min(0,n);t++)r+=e;i=0}for(let e=i;e<n;e++)r+=t[e].duration;return r}function Zo(e,t,i,n){if(!e||!e.segments)return null;if(e.endList)return hl(e);if(null===t)return null;t=t||0;let r=dl(e,e.mediaSequence+e.segments.length,t);return i&&(r-=n="number"==typeof n?n:ul(null,e)),Math.max(0,r)}const el=1/30,tl=3*el,il=function(e,t){var i=[];let n;if(e&&e.length)for(n=0;n<e.length;n++)t(e.start(n),e.end(n))&&i.push([e.start(n),e.end(n)]);return Go(i)},nl=e=>{var t=[];if(!e||!e.length)return"";for(let i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},rl=e=>{var t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t},sl=(e,t)=>{if(!t.preload)return t.duration;let i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i},al=e=>(e.segments||[]).reduce(((e,t,i)=>(t.parts?t.parts.forEach((function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e)),[]),ol=e=>(e=e.segments&&e.segments.length&&e.segments[e.segments.length-1])&&e.parts||[],ll=({preloadSegment:e})=>{var t;if(e)return({parts:e,preloadHints:t}=e),(t||[]).reduce(((e,t)=>e+("PART"===t.type?1:0)),0)+(e&&e.length?e.length:0)},ul=(e,t)=>t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0<ol(t).length)&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:e&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0,dl=function(e,t,i){var n;return(t=void 0===t?e.mediaSequence+e.segments.length:t)<e.mediaSequence?0:(n=function(e,t){let i=0,n=t-e.mediaSequence,r=e.segments[n];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if(void 0!==(r=e.segments[n]).end)return{result:i+r.end,precise:!0};if(i+=sl(e,r),void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(e,t)).precise?n.result:(e=function(e,t){let i=0;var n;let r=t-e.mediaSequence;for(;r<e.segments.length;r++){if(void 0!==(n=e.segments[r]).start)return{result:n.start-i,precise:!0};if(i+=sl(e,n),void 0!==n.end)return{result:n.end-i,precise:!0}}return{result:-1,precise:!1}}(e,t)).precise?e.result:n.result+i},hl=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return window.Infinity}return dl(e,t,i)};function cl(e){return e.excludeUntil&&e.excludeUntil>Date.now()}function pl(e){return e.excludeUntil&&e.excludeUntil===1/0}function ml(e){var t=cl(e);return!e.disabled&&!t}function fl(e,t){return t.attributes&&t.attributes[e]}function gl(e,t){var i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let n=!1;for(const e in i){for(const r in i[e])if(n=t(i[e][r]))break;if(n)break}return!!n}const yl=(e,t)=>{if(1===e.playlists.length)return!0;const i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((e=>!!ml(e)&&(e.attributes.BANDWIDTH||0)<i)).length},_l=(e,t)=>!(!e&&!t||!e&&t||e&&!t||e!==t&&(!e.id||!t.id||e.id!==t.id)&&(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)&&(!e.uri||!t.uri||e.uri!==t.uri)),vl=e=>{if(!e||!e.playlists||!e.playlists.length)return gl(e,(e=>e.playlists&&e.playlists.length||e.uri));for(let i=0;i<e.playlists.length;i++){const n=e.playlists[i];var t=n.attributes&&n.attributes.CODECS;if(!(t&&t.split(",").every((e=>Br(e)))||(t=gl(e,(e=>_l(n,e))),t)))return!1}return!0};var bl={liveEdgeDelay:ul,duration:hl,seekable:function(e,t,i){var n=t||0;return null===(e=Zo(e,t,!0,i))?Go():Go(n,e)},getMediaInfoForTime:function({playlist:e,currentTime:t,startingSegmentIndex:i,startingPartIndex:n,startTime:r,exactManifestTimings:s}){let a=t-r;var o=al(e);let l=0;for(let e=0;e<o.length;e++){var u=o[e];if(i===u.segmentIndex&&("number"!=typeof n||"number"!=typeof u.partIndex||n===u.partIndex)){l=e;break}}if(a<0){if(0<l)for(let t=l-1;0<=t;t--){var d=o[t];if(a+=d.duration,s){if(a<0)continue}else if(a+el<=0)continue;return{partIndex:d.partIndex,segmentIndex:d.segmentIndex,startTime:r-Jo({defaultDuration:e.targetDuration,durationList:o,startIndex:l,endIndex:t})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t}}if(l<0){for(let i=l;i<0;i++)if((a-=e.targetDuration)<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:t};l=0}for(let t=l;t<o.length;t++){var h=o[t];if(a-=h.duration,s){if(0<a)continue}else if(0<=a-el)continue;return{partIndex:h.partIndex,segmentIndex:h.segmentIndex,startTime:r+Jo({defaultDuration:e.targetDuration,durationList:o,startIndex:l,endIndex:t})}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:t}},isEnabled:ml,isDisabled:function(e){return e.disabled},isExcluded:cl,isIncompatible:pl,playlistEnd:Zo,isAes:function(e){for(let t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},hasAttribute:fl,estimateSegmentRequestTime:function(e,t,i,n=0){return fl("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*n)/t:NaN},isLowestEnabledRendition:yl,isAudioOnly:vl,playlistMatch:_l,segmentDurationWithParts:sl};const Tl=xr.log,Sl=(e,t)=>e+"-"+t,wl=(e,t)=>{e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((i=>{if(e.mediaGroups[i])for(const r in e.mediaGroups[i])for(const s in e.mediaGroups[i][r]){var n=e.mediaGroups[i][r][s];t(n,i,r,s)}}))},El=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},kl=(e,t,i=(e,t,i)=>`placeholder-uri-${e}-${t}-`+i)=>{e.uri=t;for(let t=0;t<e.playlists.length;t++){var n;e.playlists[t].uri||(n="placeholder-uri-"+t,e.playlists[t].uri=n)}const r=vl(e);wl(e,((t,n,s,a)=>{if(!t.playlists||!t.playlists.length){if(r&&"AUDIO"===n&&!t.uri)for(let t=0;t<e.playlists.length;t++){var o=e.playlists[t];if(o.attributes&&o.attributes.AUDIO&&o.attributes.AUDIO===s)return}t.playlists=[Vt({},t)]}t.playlists.forEach((function(t,r){var o=i(n,s,a,t),l=Sl(r,o);t.uri?t.resolvedUri=t.resolvedUri||Vo(e.uri,t.uri):(t.uri=0===r?o:l,t.resolvedUri=t.uri),t.id=t.id||l,t.attributes=t.attributes||{},e.playlists[t.id]=t,e.playlists[t.uri]=t}))}));{var s=e;let t=s.playlists.length;for(;t--;){var a=s.playlists[t];El({playlist:a,id:Sl(t,a.uri)}),a.resolvedUri=Vo(s.uri,a.uri),s.playlists[a.id]=a,(s.playlists[a.uri]=a).attributes.BANDWIDTH||Tl.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}var o;wl(o=e,(e=>{e.uri&&(e.resolvedUri=Vo(o.uri,e.uri))}))};function Cl(e){var t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(let e=0;e<i.preloadHints.length;e++)if("MAP"===i.preloadHints[e].type)return t;i.duration=e.targetDuration,i.preload=!0,t.push(i)}return t}Zn=xr.EventTarget;const xl=(e,t)=>{if(!e)return t;var i=zo(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(let n=0;n<t.parts.length;n++)e.parts&&e.parts[n]&&(i.parts[n]=zo(e.parts[n],t.parts[n]));return!e.skipped&&t.skipped&&(i.skipped=!1),e.preload&&!t.preload&&(i.preload=!1),i},Il=(e,t)=>{!e.resolvedUri&&e.uri&&(e.resolvedUri=Vo(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=Vo(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=Vo(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=Vo(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((e=>{e.resolvedUri||(e.resolvedUri=Vo(t,e.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((e=>{e.resolvedUri||(e.resolvedUri=Vo(t,e.uri))}))},Al=(e,t)=>e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment,Ol=(e,t,i=Al)=>{var n=zo(e,{}),r=n.playlists[t.id];if(!r)return null;if(i(r,t))return null;t.segments=Cl(t);const s=zo(r,t);if(s.preloadSegment&&!t.preloadSegment&&delete s.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(let e=0;e<t.skip.skippedSegments;e++)t.segments.unshift({skipped:!0})}s.segments=((e,t,i)=>{var n=e.slice(),r=t.slice(),s=(i=i||0,[]);let a;for(let e=0;e<r.length;e++){var o=n[e+i],l=r[e];o?(a=o.map||a,s.push(xl(o,l))):(a&&!l.map&&(l.map=a),s.push(l))}return s})(r.segments,t.segments,t.mediaSequence-r.mediaSequence)}s.segments.forEach((e=>{Il(e,s.resolvedUri)}));for(let e=0;e<n.playlists.length;e++)n.playlists[e].id===t.id&&(n.playlists[e]=s);return n.playlists[t.id]=s,n.playlists[t.uri]=s,wl(e,((e,i,n,r)=>{if(e.playlists)for(let i=0;i<e.playlists.length;i++)t.id===e.playlists[i].id&&(e.playlists[i]=s)})),n},Pl=(e,t)=>{var i,n=(n=(i=(i=e.segments||[])[i.length-1])&&i.parts&&i.parts[i.parts.length-1])&&n.duration||i&&i.duration;return t&&n?1e3*n:500*(e.partTargetDuration||e.targetDuration||10)};class Ll extends Zn{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Wo("PlaylistLoader");var{withCredentials:i=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=i,e=t.options_,this.customTagParsers=e&&e.customTagParsers||[],this.customTagMappers=e&&e.customTagMappers||[],this.llhls=e&&e.llhls,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_)}handleMediaupdatetimeout_(){if("HAVE_METADATA"===this.state){var e=this.media();let t=Vo(this.main.uri,e.uri);this.llhls&&(t=((e,t)=>{if(!t.endList&&t.serverControl){const r={};if(t.serverControl.canBlockReload){var i,n=t.preloadSegment;let e=t.mediaSequence+t.segments.length;n&&(n=n.parts||[],-1<(i=ll(t)-1)&&i!=n.length-1&&(r._HLS_part=i),-1<i||n.length)&&e--,r._HLS_msn=e}if(t.serverControl&&t.serverControl.canSkipUntil&&(r._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(r).length){const t=new window.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){r.hasOwnProperty(e)&&t.searchParams.set(e,r[e])})),e=t.toString()}}return e})(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials},((e,t)=>{if(this.request)return e?this.playlistRequestError(this.request,this.media(),"HAVE_METADATA"):void this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}))}}playlistRequestError(e,t,i){var{uri:t,id:n}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[n],status:e.status,message:`HLS playlist request error at URL: ${t}.`,responseText:e.responseText,code:500<=e.status?4:2},this.trigger("error")}parseManifest_({url:e,manifestString:t}){{var[{onwarn:t,oninfo:i,manifestString:n,customTagParsers:r=[],customTagMappers:s=[],llhls:a}]=[{onwarn:({message:t})=>this.logger_(`m3u8-parser warn for ${e}: `+t),oninfo:({message:t})=>this.logger_(`m3u8-parser info for ${e}: `+t),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls}];const o=new jr,l=(t&&o.on("warn",t),i&&o.on("info",i),r.forEach((e=>o.addParser(e))),s.forEach((e=>o.addTagMapper(e))),o.push(n),o.end(),o.manifest);if(a||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){l.hasOwnProperty(e)&&delete l[e]})),l.segments&&l.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!l.targetDuration){let e=10;l.segments&&l.segments.length&&(e=l.segments.reduce(((e,t)=>Math.max(e,t.duration)),0)),t&&t("manifest has no targetDuration defaulting to "+e),l.targetDuration=e}return(i=ol(l)).length&&!l.partTargetDuration&&(r=i.reduce(((e,t)=>Math.max(e,t.duration)),0),t&&(t("manifest has no partTargetDuration defaulting to "+r),Tl.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),l.partTargetDuration=r),l}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:n}){this.request=null,this.state="HAVE_METADATA",(t=t||this.parseManifest_({url:i,manifestString:e})).lastRequest=Date.now(),El({playlist:t,uri:i,id:n}),e=Ol(this.main,t),this.targetDuration=t.partTargetDuration||t.targetDuration,this.pendingMedia_=null,e?(this.main=e,this.media_=this.main.playlists[n]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Pl(this.media(),!!e)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.off()}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(e,t){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(window.clearTimeout(this.finalRenditionTimeout),t)t=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3,this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,e,!1),t);else{const n=this.state;t=!this.media_||e.id!==this.media_.id;var i=this.main.playlists[e.id];if(i&&i.endList||e.endList&&e.segments.length)this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,t&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===n?this.trigger("loadedmetadata"):this.trigger("mediachange"));else if(this.updateMediaUpdateTimeout_(Pl(e,!0)),t){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},((t,i)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=$o(e.resolvedUri,i),t)return this.playlistRequestError(this.request,e,n);this.haveMetadata({playlistString:i.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===n?this.trigger("loadedmetadata"):this.trigger("mediachange")}}))}}}pause(){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var t=this.media();e?(e=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout((()=>{this.mediaUpdateTimeout=null,this.load()}),e)):this.started?t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.setTimeout((()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)}),e))}start(){this.started=!0,"object"==typeof this.src?(this.src.uri||(this.src.uri=window.location.href),this.src.resolvedUri=this.src.uri,setTimeout((()=>{this.setupInitialPlaylist(this.src)}),0)):this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},((e,t)=>{if(this.request){if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.src=$o(this.src,t),e=this.parseManifest_({manifestString:t.responseText,url:this.src}),this.setupInitialPlaylist(e)}}))}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){var t,i,n,r;this.state="HAVE_MAIN_MANIFEST",e.playlists?(this.main=e,kl(this.main,this.srcUri()),e.playlists.forEach((e=>{e.segments=Cl(e),e.segments.forEach((t=>{Il(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0])):(t=this.srcUri()||window.location.href,this.main=(n=Sl(0,i=t),(r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:i,id:n,resolvedUri:i,attributes:{}}]}).playlists[n]=r.playlists[0],r.playlists[i]=r.playlists[0],r),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata"))}}function Dl(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),n(t=t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode?t:new Error("XHR Failed with a response of: "+(e&&(r||e.responseText))),e)}function Nl(){function e(t,i){t=zo({timeout:45e3},t);var n=e.beforeRequest||xr.Vhs.xhr.beforeRequest;n&&"function"==typeof n&&(n=n(t))&&(t=n);const r=(!0===xr.Vhs.xhr.original?ql:xr.Vhs.xhr)(t,(function(e,t){return Dl(r,e,t,i)})),s=r.abort;return r.abort=function(){return r.aborted=!0,s.apply(r,arguments)},r.uri=t.uri,r.requestTime=Date.now(),r}return e.original=!0,e}function Ml(e){var t={};return e.byterange&&(t.Range=function(e){return"bytes="+e.offset+"-"+("bigint"==typeof e.offset||"bigint"==typeof e.length?window.BigInt(e.offset)+window.BigInt(e.length)-window.BigInt(1):e.offset+e.length-1)}(e.byterange)),t}function Rl(e,t){return e=e.toString(16),"00".substring(0,2-e.length)+e+(t%2?" ":"")}function Ul(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function jl(e){const t={};return Object.keys(e).forEach((i=>{var n=e[i];es(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t}function Bl(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function Fl(e){return e.resolvedUri}const ql=xr.xhr,Hl=e=>{var t=Array.prototype.slice.call(e);let i="";for(let e=0;e<t.length/16;e++)i+=t.slice(16*e,16*e+16).map(Rl).join("")+" "+t.slice(16*e,16*e+16).map(Ul).join("")+"\n";return i};Jn=Object.freeze({__proto__:null,createTransferableMessage:jl,initSegmentId:Bl,segmentKeyId:Fl,hexDump:Hl,tagDump:({bytes:e})=>Hl(e),textRanges:e=>{let t,i="";for(t=0;t<e.length;t++)i+=(r=t,(n=e).start(r)+"-"+n.end(r)+" ");var n,r;return i}});const Vl=({programTime:e,playlist:t,retryCount:i=2,seekTo:n,pauseAfterSeek:r=!0,tech:s,callback:a})=>{var o,l,u;if(a)return void 0!==e&&t&&n?t.endList||s.hasStarted_?(e=>{if(!e.segments||0===e.segments.length)return!1;for(let t=0;t<e.segments.length;t++)if(!e.segments[t].dateTimeObject)return!1;return!0})(t)?(u=((e,t)=>{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let n=t.segments[0];if(i<n.dateTimeObject)return null;for(let e=0;e<t.segments.length-1&&(n=t.segments[e],!(i<t.segments[e+1].dateTimeObject));e++);var r=(e=t.segments[t.segments.length-1]).dateTimeObject,s=e.videoTimingInfo?(e=>e.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds)(e.videoTimingInfo):e.duration+.25*e.duration;return i>(s=new Date(r.getTime()+1e3*s))?null:{segment:n=i>r?e:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:bl.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"}})(e,t))?(l=((e,t)=>{let i,n;try{i=new Date(e),n=new Date(t)}catch(e){}return e=i.getTime(),(n.getTime()-e)/1e3})((o=u.segment).dateTimeObject,e),"estimate"===u.type?0===i?a({message:e+" is not buffered yet. Try again"}):(n(u.estimatedStart+l),void s.one("seeked",(()=>{Vl({programTime:e,playlist:t,retryCount:i-1,seekTo:n,pauseAfterSeek:r,tech:s,callback:a})}))):(u=o.start+l,s.one("seeked",(()=>a(null,s.currentTime()))),r&&s.pause(),void n(u))):a({message:e+" was not found in the stream"}):a({message:"programDateTime tags must be provided in the manifest "+t.resolvedUri}):a({message:"player must be playing a live stream to start buffering"}):a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});throw new Error("seekToProgramTime: callback must be provided")};function $l(e,t){if(!Al(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(e.segments||t.segments)for(let r=0;r<e.segments.length;r++){var i=e.segments[r],n=t.segments[r];if(i.uri!==n.uri)return!1;if(i.byterange||n.byterange){if(i=i.byterange,n=n.byterange,i&&!n||!i&&n)return!1;if(i.offset!==n.offset||i.length!==n.length)return!1}}return!0}Yn=xr.EventTarget;const Wl=(e,t,i,n)=>`placeholder-uri-${e}-${t}-`+(n.attributes.NAME||i),zl=({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:n,previousManifest:r})=>(i={manifestUri:t,clientOffset:i,sidxMapping:n,previousManifest:r},e=((e,t={})=>{var{manifestUri:t="",NOW:i=Date.now(),clientOffset:n=0}=t,r=ho(e,"Period");if(!r.length)throw new Error("INVALID_NUMBER_OF_PERIOD");var s=ho(e,"Location");const a=fo(e);var o,l;t=yo([t],ho(e,"BaseURL")),a.type=a.type||"static",a.sourceDuration=a.mediaPresentationDuration||0,a.NOW=i,a.clientOffset=n,s.length&&(a.locations=s.map(co));const u=[];return r.forEach(((e,t)=>{var i,n,r=fo(e);t=u[t-1],r.start=(({attributes:t,priorPeriodAttributes:i,mpdType:n}={attributes:r,priorPeriodAttributes:t?t.attributes:null,mpdType:a.type}),"number"==typeof t.start?t.start:i&&"number"==typeof i.start&&"number"==typeof i.duration?i.start+i.duration:i||"static"!==n?null:0),u.push({node:e,attributes:r})})),{locations:a.locations,representationInfo:ja(u.map((o=a,l=t,(e,t)=>{var i=yo(l,ho(e.node,"BaseURL")),n=Ra(o,{periodStart:e.attributes.start}),r=("number"==typeof e.attributes.duration&&(n.periodDuration=e.attributes.duration),ho(e.node,"AdaptationSet"));return e=_o(e.node),ja(r.map(((e,t,i)=>n=>{var r=fo(n),s=yo(t,ho(n,"BaseURL")),a=ho(n,"Role")[0];a={role:fo(a)};let o=Ra(e,r,a);var l,u,d;return r=ho(n,"Accessibility")[0],r="urn:scte:dash:cc:cea-608:2015"===(a=fo(r)).schemeIdUri?("string"!=typeof a.value?[]:a.value.split(";")).map((e=>{let t,i;return i=e,/^CC\d=/.test(e)?[t,i]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:i}})):"urn:scte:dash:cc:cea-708:2015"===a.schemeIdUri?("string"!=typeof a.value?[]:a.value.split(";")).map((e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};var i,n;return/=/.test(e)?([i,n=""]=e.split("="),t.channel=i,t.language=e,n.split(",").forEach((e=>{var[e,i]=e.split(":");"lang"===e?t.language=i:"er"===e?t.easyReader=Number(i):"war"===e?t.aspectRatio=Number(i):"3D"===e&&(t["3D"]=Number(i))}))):t.language=e,t.channel&&(t.channel="SERVICE"+t.channel),t})):void 0,r&&(o=Ra(o,{captionServices:r})),(a=ho(n,"Label")[0])&&a.childNodes.length&&(r=a.childNodes[0].nodeValue.trim(),o=Ra(o,{label:r})),a=ho(n,"ContentProtection").reduce(((e,t)=>{var i=fo(t),n=(i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase()),go[i.schemeIdUri]);return n&&(e[n]={attributes:i},i=ho(t,"cenc:pssh")[0])&&(t=co(i),e[n].pssh=t&&function(e){for(var t=window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary"),i=new Uint8Array(t.length),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i}(t)),e}),{}),Object.keys(a).length&&(o=Ra(o,{contentProtection:a})),r=_o(n),a=ho(n,"Representation"),n=Ra(i,r),ja(a.map((l=o,u=s,d=n,e=>{var t=ho(e,"BaseURL");t=yo(u,t);const i=Ra(l,fo(e)),n=_o(e);return t.map((e=>({segmentInfo:Ra(d,n),attributes:Ra(i,{baseUrl:e})})))})))})(n,i,e)))})))}})(vo(e),i),n=(e=>e.map(uo))(e.representationInfo),r=(({dashPlaylists:e,locations:t,sidxMapping:i={},previousManifest:n})=>{var r,s,a,o,l,u,d,h;return e.length?(({sourceDuration:a,type:l,suggestedPresentationDelay:u,minimumUpdatePeriod:o}=e[0].attributes),r=Ya(e.filter(eo)).map(Za),d=Ya(e.filter(to)),s=Ya(e.filter(io)),e=e.map((e=>e.attributes.captionServices)).filter(Boolean),a={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:((e,t={})=>{if(Object.keys(t).length)for(const i in e)e[i]=Ja(e[i],t);return e})(r,i)},0<=o&&(a.minimumUpdatePeriod=1e3*o),t&&(a.locations=t),"dynamic"===l&&(a.suggestedPresentationDelay=u),o=0===a.playlists.length,t=d.length?((e,t={},i)=>{let n;return e=e.reduce(((e,r)=>{var s=r.attributes.role&&r.attributes.role.value||"",a=r.attributes.lang||"";let o=r.attributes.label||"main";return e[o=a&&!r.attributes.label?r.attributes.lang+(s?` (${s})`:""):o]||(e[o]={language:a,autoselect:!0,default:"main"===s,playlists:[],uri:""}),a=Ja((({attributes:e,segments:t,sidx:i,mediaSequence:n,discontinuitySequence:r,discontinuityStarts:s},a)=>(r={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:"",targetDuration:e.duration,discontinuitySequence:r,discontinuityStarts:s,timelineStarts:e.timelineStarts,mediaSequence:n,segments:t},e.contentProtection&&(r.contentProtection=e.contentProtection),i&&(r.sidx=i),a&&(r.attributes.AUDIO="audio",r.attributes.SUBTITLES="subs"),r))(r,i),t),e[o].playlists.push(a),void 0===n&&"main"===s&&((n=r).default=!0),e}),{}),n||(e[Object.keys(e)[0]].default=!0),e})(d,i,o):null,l=s.length?((e,t={})=>e.reduce(((e,i)=>{var n,r,s,a,o=i.attributes.lang||"text";return e[o]||(e[o]={language:o,default:!1,autoselect:!1,playlists:[],uri:""}),e[o].playlists.push(Ja((({attributes:o,segments:i,mediaSequence:n,discontinuityStarts:r,discontinuitySequence:s}=[i][0]),void 0===i&&(i=[{uri:o.baseUrl,timeline:o.periodStart,resolvedUri:o.baseUrl||"",duration:o.sourceDuration,number:0}],o.duration=o.sourceDuration),a={NAME:o.id,BANDWIDTH:o.bandwidth,"PROGRAM-ID":1},o.codecs&&(a.CODECS=o.codecs),{attributes:a,uri:"",endList:"static"===o.type,timeline:o.periodStart,resolvedUri:o.baseUrl||"",targetDuration:o.duration,timelineStarts:o.timelineStarts,discontinuityStarts:r,discontinuitySequence:s,mediaSequence:n,segments:i}),t)),e}),{}))(s,i):null,d=(u=r.concat(no(t),no(l))).map((({timelineStarts:e})=>e)),a.timelineStarts=Ga(d),h=a.timelineStarts,u.forEach((e=>{e.mediaSequence=0,e.discontinuitySequence=h.findIndex((function({timeline:t}){return t===e.timeline})),e.segments&&e.segments.forEach(((e,t)=>{e.number=t}))})),t&&(a.mediaGroups.AUDIO.audio=t),l&&(a.mediaGroups.SUBTITLES.subs=l),e.length&&(a.mediaGroups["CLOSED-CAPTIONS"].cc=e.reduce(((e,t)=>(t&&t.forEach((t=>{var{channel:i,language:n}=t;e[n]={autoselect:!1,default:!1,instreamId:i,language:n},t.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[n].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[n]["3D"]=t["3D"])})),e)),{})),n?(({oldManifest:e,newManifest:t})=>{var i,n,r=e.playlists.concat(Xa(e)),s=t.playlists.concat(Xa(t));return t.timelineStarts=Ga([e.timelineStarts,t.timelineStarts]),({oldPlaylists:i,newPlaylists:e,timelineStarts:n}={oldPlaylists:r,newPlaylists:s,timelineStarts:t.timelineStarts}),e.forEach((e=>{e.discontinuitySequence=n.findIndex((function({timeline:t}){return t===e.timeline}));var t=((e,t)=>{for(let i=0;i<e.length;i++)if(e[i].attributes.NAME===t)return e[i];return null})(i,e.attributes.NAME);if(t&&!e.sidx){const i=e.segments[0];var r=t.segments.findIndex((function(e){return Math.abs(e.presentationTime-i.presentationTime)<1/60}));-1===r?(Ka({playlist:e,mediaSequence:t.mediaSequence+t.segments.length}),e.segments[0].discontinuity=!0,e.discontinuityStarts.unshift(0),(!t.segments.length&&e.timeline>t.timeline||t.segments.length&&e.timeline>t.segments[t.segments.length-1].timeline)&&e.discontinuitySequence--):(t.segments[r].discontinuity&&!i.discontinuity&&(i.discontinuity=!0,e.discontinuityStarts.unshift(0),e.discontinuitySequence--),Ka({playlist:e,mediaSequence:t.segments[r].number}))}})),t})({oldManifest:n,newManifest:a}):a):{}})({dashPlaylists:n,locations:e.locations,sidxMapping:i.sidxMapping,previousManifest:i.previousManifest}),kl(r,t,Wl),r),Gl=(e,t)=>(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length,Xl=(e,t)=>{var i={};for(const a in e){var n=e[a].sidx;if(n){var r=Qa(n);if(!t[r])break;var s=t[r].sidxInfo;Gl(s,n)&&(i[r]=t[r])}}return i};class Kl extends Yn{constructor(e,t,i={},n){super(),this.mainPlaylistLoader_=n||this,n||(this.isMain_=!0);var{withCredentials:n=!1}=i;if(this.vhs_=t,this.withCredentials=n,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",(()=>{this.refreshXml_()})),this.on("mediaupdatetimeout",(()=>{this.refreshMedia_(this.media().id)})),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Wo("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(e,t,i){const n=e.sidx&&Qa(e.sidx);if(e.sidx&&n&&!this.mainPlaylistLoader_.sidxMapping_[n]){const r=$o(e.sidx.resolvedUri),s=(r,s)=>{if(!this.requestErrored_(r,s,t)){let a;r=this.mainPlaylistLoader_.sidxMapping_;try{a=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},n=12,r=(0===i.version?(i.earliestPresentationTime=t.getUint32(n),i.firstOffset=t.getUint32(n+4),n+=8):(i.earliestPresentationTime=Io(e.subarray(n)),i.firstOffset=Io(e.subarray(n+8)),n+=16),t.getUint16(n+=2));for(n+=2;0<r;n+=12,r--)i.references.push({referenceType:(128&e[n])>>>7,referencedSize:2147483647&t.getUint32(n),subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(128&e[n+8]),sapType:(112&e[n+8])>>>4,sapDeltaTime:268435455&t.getUint32(n+8)});return i}(ts(s.response).subarray(8))}catch(e){return void this.requestErrored_(e,s,t)}return r[n]={sidxInfo:e.sidx,sidx:a},Wa(e,a,e.sidx.resolvedUri),i(!0)}};this.request=((e,t,i)=>{let n,r=[],s=!1;function a(e,t,n,r){return t.abort(),s=!0,i(e,t,n,r)}function o(e,t){var i;if(!s)return e?a(e,t,"",r):(i=t.responseText.substring(r&&r.byteLength||0,t.responseText.length),r=function(){for(var e,t,i,n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return(r=r.filter((function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e}))).length<=1?ts(r[0]):(e=r.reduce((function(e,t,i){return e+(t.byteLength||t.length)}),0),t=new Uint8Array(e),i=0,r.forEach((function(e){e=ts(e),t.set(e,i),i+=e.byteLength})),t)}(r,Vr(i,!0)),n=n||bo(r),r.length<10||n&&r.length<n+2||"ts"===(i=Co(r))&&r.length<188||!i&&r.length<376?((e,t)=>{if(4===e.readyState)return t()})(t,(()=>a(e,t,"",r))):a(null,t,i,r))}const l=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function({}){return Dl(e,null,{statusCode:e.status},o)}))}},(function(e,t){return Dl(l,e,t,o)}));return l})(r,this.vhs_.xhr,((t,i,n,a)=>{var o,l;return t?s(t,i):n&&"mp4"===n?(({offset:o,length:l}=e.sidx.byterange),a.length>=l+o?s(t,{response:a.subarray(o,o+l),status:i.status,uri:i.uri}):void(this.request=this.vhs_.xhr({uri:r,responseType:"arraybuffer",headers:Ml({byterange:e.sidx.byterange})},s))):s({status:i.status,message:`Unsupported ${n||"unknown"} container type for sidx segment at URL: `+r,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},i)}))}else this.mediaRequest_=window.setTimeout((()=>i(!1)),0)}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},window.clearTimeout(this.minimumUpdatePeriodTimeout_),window.clearTimeout(this.mediaRequest_),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())}media(e){if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if("string"==typeof e){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}var i=!this.media_||e.id!==this.media_.id;i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList?(this.state="HAVE_METADATA",this.media_=e,i&&(this.trigger("mediachanging"),this.trigger("mediachange"))):i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,(i=>{this.haveMetadata({startingState:t,playlist:e})})))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),"HAVE_MAIN_MANIFEST"===e?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(window.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}load(e){window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var t=this.media();e?(e=t?t.targetDuration/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout((()=>this.load()),e)):this.started?t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}start(){this.started=!0,this.isMain_?this.requestMain_(((e,t)=>{this.haveMain_(),this.hasPendingRequest()||this.media_||this.media(this.mainPlaylistLoader_.main.playlists[0])})):this.mediaRequest_=window.setTimeout((()=>this.haveMain_()),0)}requestMain_(e){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},((t,i)=>{if(this.requestErrored_(t,i))"HAVE_NOTHING"===this.state&&(this.started=!1);else{const t=i.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=i.responseText,i.responseHeaders&&i.responseHeaders.date?this.mainLoaded_=Date.parse(i.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=$o(this.mainPlaylistLoader_.srcUrl,i),!t)return e(i,t);this.handleMain_(),this.syncClientServerClock_((()=>e(i,t)))}}))}syncClientServerClock_(e){const t=(e=>{if(e=vo(e),!(e=ho(e,"UTCTiming")[0]))return null;var t=fo(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error("UNSUPPORTED_UTC_TIMING_SCHEME")}return t})(this.mainPlaylistLoader_.mainXml_);return null===t?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()):"DIRECT"===t.method?(this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:Vo(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials},((i,n)=>{if(this.request){if(i)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();let r;r="HEAD"===t.method?n.responseHeaders&&n.responseHeaders.date?Date.parse(n.responseHeaders.date):this.mainLoaded_:Date.parse(n.responseText),this.mainPlaylistLoader_.clientOffset_=r-Date.now(),e()}})))}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;var e=this.mainPlaylistLoader_.main;let t=zl({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=((e,t,i)=>{let n=!0,r=zo(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e<t.playlists.length;e++){var s=t.playlists[e],a=(s.sidx&&(a=Qa(s.sidx),i)&&i[a]&&i[a].sidx&&Wa(s,i[a].sidx,s.sidx.resolvedUri),Ol(r,s,$l));a&&(r=a,n=!1)}var o,l;return wl(t,((e,t,i,s)=>{var a,o;e.playlists&&e.playlists.length&&(a=e.playlists[0].id,o=Ol(r,e.playlists[0],$l))&&(s in(r=o).mediaGroups[t][i]||(r.mediaGroups[t][i][s]=e),r.mediaGroups[t][i][s].playlists[0]=r.playlists[a],n=!1)})),l=t,wl(o=r,((e,t,i,n)=>{n in l.mediaGroups[t][i]||delete o.mediaGroups[t][i][n]})),(n=t.minimumUpdatePeriod===e.minimumUpdatePeriod&&n)?null:r})(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;var i=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return i&&i!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=i),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){var e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`):this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout((()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)}),e)}refreshXml_(){this.requestMain_(((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=((e,t)=>{let i=Xl(e.playlists,t);return wl(e,((e,n,r,s)=>{e.playlists&&e.playlists.length&&(e=e.playlists,i=zo(i,Xl(e,t)))})),i})(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,(e=>{this.refreshMedia_(this.media().id)})))}))}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();var t=this.mainPlaylistLoader_.main.playlists;const i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const e=()=>{this.media().endList||(this.mediaUpdateTimeout=window.setTimeout((()=>{this.trigger("mediaupdatetimeout"),e()}),Pl(this.media(),Boolean(i))))};e()}this.trigger("loadedplaylist")}}var Ql={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};function Yl(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e}function Jl(e){return function(){const t=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(i){var t=new BlobBuilder;return t.append(e),URL.createObjectURL(t.getBlob())}}(e);var i=Yl(new Worker(t));i.objURL=t;const n=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),n.call(this)},i}}function Zl(e){return`var browserWorkerPolyFill = ${Yl.toString()};\nbrowserWorkerPolyFill(self);\n`+e}function eu(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)}var tu=Jl(Zl(eu((function(){function e(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){return!!e[t]&&(i=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(i,1),-1<i)},this.trigger=function(t){var i,n,r,s=e[t];if(s)if(2===arguments.length)for(n=s.length,i=0;i<n;++i)s[i].call(this,arguments[1]);else{for(r=[],i=arguments.length,i=1;i<arguments.length;++i)r.push(arguments[i]);for(n=s.length,i=0;i<n;++i)s[i].apply(this,r)}},this.dispose=function(){e={}}}}var t,i,n,r,s,a,o,l,u,d,h,c,p,m,f,g,y,_,v,b,T,S,w,E,k,C,x,I,A,O,P,L,D,N,M,R,U,j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},B=(e.prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},e.prototype.push=function(e){this.trigger("data",e)},e.prototype.flush=function(e){this.trigger("done",e)},e.prototype.partialFlush=function(e){this.trigger("partialdone",e)},e.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},e.prototype.reset=function(e){this.trigger("reset",e)},e),F=Math.pow(2,32),q={getUint64:function(e){var t;return(e=new DataView(e.buffer,e.byteOffset,e.byteLength)).getBigUint64?(t=e.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:e.getUint32(0)*F+e.getUint32(4)},MAX_UINT32:F},H=q.MAX_UINT32;if(T={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(var V in T)T.hasOwnProperty(V)&&(T[V]=[V.charCodeAt(0),V.charCodeAt(1),V.charCodeAt(2),V.charCodeAt(3)]);S=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),E=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),w=new Uint8Array([0,0,0,1]),te=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]),ne=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]),k={video:te,audio:ne},I=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0]),A=new Uint8Array([0,0,0,0,0,0,0,0]),O=A,P=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),L=A,C=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}function $(e,t){var i=ie();return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i}function W(e){for(var t=[];e--;)t.push(0);return t}function z(e){e=e||{},z.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new be(0,0),new be(0,1),new be(1,0),new be(1,1)],this.parse708captions_&&(this.cc708Stream_=new ge({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))}function G(e){return 32<=e&&e<=127||160<=e&&e<=255}function X(e){this.windowNum=e,this.reset()}function K(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new X(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)}function Q(e){return null===e?"":(e=ye[e]||e,String.fromCharCode(e))}function Y(){for(var e=[],t=_e+1;t--;)e.push("");return e}function J(e,t){var i=1;for(t<e&&(i=-1);Math.abs(t-e)>Ee;)e+=i*we;return e}function Z(e){var t,i;Z.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===i&&(i=e.dts),e.dts=J(e.dts,i),e.pts=J(e.pts,i),t=e.dts,this.trigger("data",e))},this.flush=function(){i=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){t=i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}}t=function(e){for(var t,i=[],n=0,r=1;r<arguments.length;r++)i.push(arguments[r]);for(r=i.length;r--;)n+=i[r].byteLength;for(t=new Uint8Array(n+8),new DataView(t.buffer,t.byteOffset,t.byteLength).setUint32(0,t.byteLength),t.set(e,4),r=0,n=8;r<i.length;r++)t.set(i[r],n),n+=i[r].byteLength;return t},i=function(){return t(T.dinf,t(T.dref,I))},n=function(e){return t(T.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},m=function(e){return t(T.hdlr,k[e])},p=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(T.mdhd,i)},c=function(e){return t(T.mdia,p(e),m(e.type),a(e))},s=function(e){return t(T.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},a=function(e){return t(T.minf,"video"===e.type?t(T.vmhd,C):t(T.smhd,x),i(),g(e))},l=function(e){for(var i=e.length,n=[];i--;)n[i]=v(e[i]);return t.apply(null,[T.mvex].concat(n))},u=function(e){return e=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,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]),t(T.mvhd,e)},f=function(e){for(var i,n=e.samples||[],r=new Uint8Array(4+n.length),s=0;s<n.length;s++)i=n[s].flags,r[s+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return t(T.sdtp,r)},g=function(e){return t(T.stbl,y(e),t(T.stts,L),t(T.stsc,O),t(T.stsz,P),t(T.stco,A))},y=function(e){return t(T.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),("video"===e.type?D:N)(e))},D=function(e){for(var i,n,r=e.sps||[],s=e.pps||[],a=[],o=[],l=0;l<r.length;l++)a.push((65280&r[l].byteLength)>>>8),a.push(255&r[l].byteLength),a=a.concat(Array.prototype.slice.call(r[l]));for(l=0;l<s.length;l++)o.push((65280&s[l].byteLength)>>>8),o.push(255&s[l].byteLength),o=o.concat(Array.prototype.slice.call(s[l]));return i=[T.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,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(T.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],a,[s.length],o))),t(T.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio&&(n=e.sarRatio[0],e=e.sarRatio[1],i.push(t(T.pasp,new Uint8Array([(4278190080&n)>>24,(16711680&n)>>16,(65280&n)>>8,255&n,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])))),t.apply(null,i)},N=function(e){return t(T.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),n(e))},h=function(e){return e=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,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,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]),t(T.tkhd,e)},_=function(e){var i,n=t(T.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(e.baseMediaDecodeTime/H),s=Math.floor(e.baseMediaDecodeTime%H);return r=t(T.tfdt,new Uint8Array([1,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,s>>>24&255,s>>>16&255,s>>>8&255,255&s])),"audio"===e.type?(i=b(e,92),t(T.traf,n,r,i)):(s=f(e),i=b(e,s.length+92),t(T.traf,n,r,i,s))},d=function(e){return e.duration=e.duration||4294967295,t(T.trak,h(e),c(e))},v=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(T.trex,i)},M=function(e,t){var i=0,n=0,r=0,s=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset)&&(s=8),[0,0,i|n|r|s,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},R=function(e,i){var n,r,s,a,o=e.samples||[];for(i+=20+16*o.length,e=M(o,i),(r=new Uint8Array(e.length+16*o.length)).set(e),n=e.length,a=0;a<o.length;a++)s=o[a],r[n++]=(4278190080&s.duration)>>>24,r[n++]=(16711680&s.duration)>>>16,r[n++]=(65280&s.duration)>>>8,r[n++]=255&s.duration,r[n++]=(4278190080&s.size)>>>24,r[n++]=(16711680&s.size)>>>16,r[n++]=(65280&s.size)>>>8,r[n++]=255&s.size,r[n++]=s.flags.isLeading<<2|s.flags.dependsOn,r[n++]=s.flags.isDependedOn<<6|s.flags.hasRedundancy<<4|s.flags.paddingValue<<1|s.flags.isNonSyncSample,r[n++]=61440&s.flags.degradationPriority,r[n++]=15&s.flags.degradationPriority,r[n++]=(4278190080&s.compositionTimeOffset)>>>24,r[n++]=(16711680&s.compositionTimeOffset)>>>16,r[n++]=(65280&s.compositionTimeOffset)>>>8,r[n++]=255&s.compositionTimeOffset;return t(T.trun,r)},U=function(e,i){var n,r,s,a,o=e.samples||[];for(i+=20+8*o.length,e=M(o,i),(n=new Uint8Array(e.length+8*o.length)).set(e),r=e.length,a=0;a<o.length;a++)s=o[a],n[r++]=(4278190080&s.duration)>>>24,n[r++]=(16711680&s.duration)>>>16,n[r++]=(65280&s.duration)>>>8,n[r++]=255&s.duration,n[r++]=(4278190080&s.size)>>>24,n[r++]=(16711680&s.size)>>>16,n[r++]=(65280&s.size)>>>8,n[r++]=255&s.size;return t(T.trun,n)},b=function(e,t){return("audio"===e.type?U:R)(e,t)};var ee,te={ftyp:r=function(){return t(T.ftyp,S,w,S,E)},mdat:function(e){return t(T.mdat,e)},moof:function(e,i){for(var n=[],r=i.length;r--;)n[r]=_(i[r]);return t.apply(null,[T.moof,s(e)].concat(n))},moov:o=function(e){for(var i=e.length,n=[];i--;)n[i]=d(e[i]);return t.apply(null,[T.moov,u(4294967295)].concat(n).concat(l(e)))},initSegment:function(e){var t=r(),i=(e=o(e),new Uint8Array(t.byteLength+e.byteLength));return i.set(t),i.set(e,t.byteLength),i}},ie=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},ne={groupNalsIntoFrames:function(e){var t,i,n=[],r=[];for(r.byteLength=0,r.nalCount=0,t=n.byteLength=r.duration=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n),r},groupFramesIntoGops:function(e){var t,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},extendFirstKeyFrame:function(e){var t;return!e[0][0].keyFrame&&1<e.length&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},generateSampleTable:function(e,t){for(var i,n,r,s=t||0,a=[],o=0;o<e.length;o++)for(n=e[o],i=0;i<n.length;i++)s+=(r=$(r=n[i],s)).size,a.push(r);return a},concatenateNalData:function(e){for(var t,i,n,r,s,a=0,o=e.byteLength,l=e.nalCount,u=new Uint8Array(o+4*l),d=new DataView(u.buffer),h=0;h<e.length;h++)for(n=e[h],t=0;t<n.length;t++)for(r=n[t],i=0;i<r.length;i++)s=r[i],d.setUint32(a,s.data.byteLength),u.set(s.data,a+=4),a+=s.data.byteLength;return u},generateSampleTableForFrame:function(e,t){var i=[];return e=$(e,t||0),i.push(e),i},concatenateNalDataForFrame:function(e){for(var t,i=0,n=e.byteLength,r=e.length,s=new Uint8Array(n+4*r),a=new DataView(s.buffer),o=0;o<e.length;o++)t=e[o],a.setUint32(i,t.data.byteLength),s.set(t.data,i+=4),i+=t.data.byteLength;return s}},re=[33,16,5,32,164,27],se=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ae=function(e){return 9e4*e},oe=function(e,t){return e*t},le=function(e){return e/9e4},ue=function(e,t){return e/t},de={ONE_SECOND_IN_TS:9e4,secondsToVideoTs:ae,secondsToAudioTs:oe,videoTsToSeconds:le,audioTsToSeconds:ue,audioTsToVideoTs:function(e,t){return e/t*9e4},videoTsToAudioTs:function(e,t){return e/9e4*t},metadataTsToSeconds:function(e,t,i){return le(i?e:e-t)}},he=de,ce=(ae={prefixWithSilence:function(e,t,i,n){var r,s,a,o,l,u=0,d=0;if(t.length&&(s=he.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),r=Math.ceil(he.ONE_SECOND_IN_TS/(e.samplerate/1024)),i&&n&&(s-=Math.max(i,n),d=(u=Math.floor(s/r))*r),!(u<1||d>he.ONE_SECOND_IN_TS/2))){for(a=(a=function(){var e,t;return ee||(e={96e3:[re,[227,64],W(154),[56]],88200:[re,[231],W(170),[56]],64e3:[re,[248,192],W(240),[56]],48e3:[re,[255,192],W(268),[55,148,128],W(54),[112]],44100:[re,[255,192],W(268),[55,163,128],W(84),[112]],32e3:[re,[255,192],W(268),[55,234],W(226),[112]],24e3:[re,[255,192],W(268),[55,255,128],W(268),[111,112],W(126),[224]],16e3:[re,[255,192],W(268),[55,255,128],W(268),[111,255],W(269),[223,108],W(195),[1,192]],12e3:[se,W(268),[3,127,248],W(268),[6,255,240],W(268),[13,255,224],W(268),[27,253,128],W(259),[56]],11025:[se,W(268),[3,127,248],W(268),[6,255,240],W(268),[13,255,224],W(268),[27,255,192],W(268),[55,175,128],W(108),[112]],8e3:[se,W(268),[3,121,16],W(47),[7]]},t=e,ee=Object.keys(t).reduce((function(e,i){return e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[])),e}),{})),ee}()[e.samplerate])||t[0].data,o=0;o<u;o++)l=t[0],t.splice(0,0,{data:a,dts:l.dts-r,pts:l.pts-r});return e.baseMediaDecodeTime-=Math.floor(he.videoTsToAudioTs(d,e.samplerate)),d}},trimAdtsFramesByEarliestDts:function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))},generateSampleTable:function(e){for(var t,i=[],n=0;n<e.length;n++)t=e[n],i.push({size:t.data.byteLength,duration:1024});return i},concatenateFrameData:function(e){for(var t,i=0,n=new Uint8Array(function(e){for(var t=0,i=0;i<e.length;i++)t+=e[i].data.byteLength;return t}(e)),r=0;r<e.length;r++)t=e[r],n.set(t.data,i),i+=t.data.byteLength;return n}},de.ONE_SECOND_IN_TS),pe=(oe={clearDtsInfo:function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},calculateTrackBaseMediaDecodeTime:function(e,t){var i=e.minSegmentDts;return t||(i-=e.timelineStartInfo.dts),t=e.timelineStartInfo.baseMediaDecodeTime,t+=i,t=Math.max(0,t),"audio"===e.type&&(t*=e.samplerate/ce,t=Math.floor(t)),t},collectDtsInfo:function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))}},ue={parseSei:function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}i.payload=void 0}t+=r,r=n=0}return i},parseUserData:function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},parseCaptionPackets:function(e,t){var i,n,r,s,a=[];if(64&t[0])for(n=31&t[0],i=0;i<n;i++)s={type:3&t[2+(r=3*i)],pts:e},4&t[2+r]&&(s.ccData=t[3+r]<<8|t[4+r],a.push(s));return a},discardEmulationPreventionBytes:function(e){for(var t=e.byteLength,i=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(i.push(n+2),n+=2):n++;if(0===i.length)return e;var r=t-i.length,s=new Uint8Array(r),a=0;for(n=0;n<r;a++,n++)a===i[0]&&(a++,i.shift()),s[n]=e[a];return s},USER_DATA_REGISTERED_ITU_T_T35:4},B),me=ue,fe=((z.prototype=new pe).push=function(e){var t;"sei_rbsp"===e.nalUnitType&&(t=me.parseSei(e.escapedRBSP)).payload&&t.payloadType===me.USER_DATA_REGISTERED_ITU_T_T35&&(t=me.parseUserData(t))&&(e.dts<this.latestDts_?this.ignoreNextEqualDts_=!0:e.dts===this.latestDts_&&this.ignoreNextEqualDts_?(this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1)):(t=me.parseCaptionPackets(e.pts,t),this.captionPackets_=this.captionPackets_.concat(t),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts))},z.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},z.prototype.flushStream=function(e){this.captionPackets_.length&&(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)}),this),this.captionPackets_.length=0),this.flushCCStreams(e)},z.prototype.flush=function(){return this.flushStream("flush")},z.prototype.partialFlush=function(){return this.flushStream("partialFlush")},z.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},z.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},z.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},z.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},z.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},z.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)},{127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600}),ge=(X.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},X.prototype.getText=function(){return this.rows.join("\n")},X.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},X.prototype.newLine=function(e){for(this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),0<this.rows.length&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},X.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},X.prototype.addText=function(e){this.rows[this.rowIdx]+=e},X.prototype.backspace=function(){var e;this.isEmpty()||(e=this.rows[this.rowIdx],this.rows[this.rowIdx]=e.substr(0,e.length-1))},K.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new X(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},K.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},K.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}},function(e){e=e||{},ge.prototype.init.call(this);var t,i=this,n=e.captionServices||{},r={};Object.keys(n).forEach((e=>{t=n[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)})),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){(3===e.type||null===i.current708Packet)&&i.new708Packet(),i.add708Bytes(e)}}),ye=(ge.prototype=new pe,ge.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},ge.prototype.add708Bytes=function(e){var t=(i=e.ccData)>>>8,i=255&i;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(t),this.current708Packet.data.push(i)},ge.prototype.push708Packet=function(){var e,t=this.current708Packet,i=t.data,n=null,r=0,s=i[r++];for(t.seq=s>>6,t.sizeCode=63&s;r<i.length;r++)e=31&(s=i[r++]),7==(n=s>>5)&&0<e&&(n=i[r++]),this.pushServiceBlock(n,r,e),0<e&&(r+=e-1)},ge.prototype.pushServiceBlock=function(e,t,i){for(var n,r=t,s=this.current708Packet.data,a=(a=this.services[e])||this.initService(e,r);r<t+i&&r<s.length;r++)G(n=s[r])?r=this.handleText(r,a):24===n?r=this.multiByteCharacter(r,a):16===n?r=this.extendedCommands(r,a):128<=n&&n<=135?r=this.setCurrentWindow(r,a):152<=n&&n<=159?r=this.defineWindow(r,a):136===n?r=this.clearWindows(r,a):140===n?r=this.deleteWindows(r,a):137===n?r=this.displayWindows(r,a):138===n?r=this.hideWindows(r,a):139===n?r=this.toggleWindows(r,a):151===n?r=this.setWindowAttributes(r,a):144===n?r=this.setPenAttributes(r,a):145===n?r=this.setPenColor(r,a):146===n?r=this.setPenLocation(r,a):143===n?a=this.reset(r,a):8===n?a.currentWindow.backspace():12===n?a.currentWindow.clearText():13===n?a.currentWindow.pendingNewLine=!0:14===n?a.currentWindow.clearText():141===n&&r++},ge.prototype.extendedCommands=function(e,t){return G(this.current708Packet.data[++e])?this.handleText(e,t,{isExtended:!0}):e},ge.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},ge.prototype.initService=function(e,t){var i,n="SERVICE"+e,r=this;return n in this.serviceEncodings&&(i=this.serviceEncodings[n]),this.services[e]=new K(e,i,r),this.services[e].init(this.getPts(t),(function(t){r.flushDisplayed(t,r.services[e])})),this.services[e]},ge.prototype.handleText=function(e,t,i){var n,r=i&&i.isExtended,s=(i=i&&i.isMultiByte,r?4096:0),a=(o=this.current708Packet.data)[e],o=o[e+1],l=t.currentWindow;return o=t.textDecoder_&&!r?(i?(n=[a,o],e++):n=[a],t.textDecoder_.decode(new Uint8Array(n))):(i=fe[r=s|a]||r,4096&r&&r===i?"":String.fromCharCode(i)),l.pendingNewLine&&!l.isEmpty()&&l.newLine(this.getPts(e)),l.pendingNewLine=!1,l.addText(o),e},ge.prototype.multiByteCharacter=function(e,t){var i=(n=this.current708Packet.data)[e+1],n=n[e+2];return G(i)&&G(n)?this.handleText(++e,t,{isMultiByte:!0}):e},ge.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},ge.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,n=i[e];return t.setCurrentWindow(7&n),t=t.currentWindow,n=i[++e],t.visible=(32&n)>>5,t.rowLock=(16&n)>>4,t.columnLock=(8&n)>>3,t.priority=7&n,n=i[++e],t.relativePositioning=(128&n)>>7,t.anchorVertical=127&n,n=i[++e],t.anchorHorizontal=n,n=i[++e],t.anchorPoint=(240&n)>>4,t.rowCount=15&n,n=i[++e],t.columnCount=63&n,n=i[++e],t.windowStyle=(56&n)>>3,t.penStyle=7&n,t.virtualRowCount=t.rowCount+1,e},ge.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=(i[e],t=t.currentWindow.winAttr,i[++e]);return t.fillOpacity=(192&n)>>6,t.fillRed=(48&n)>>4,t.fillGreen=(12&n)>>2,t.fillBlue=3&n,n=i[++e],t.borderType=(192&n)>>6,t.borderRed=(48&n)>>4,t.borderGreen=(12&n)>>2,t.borderBlue=3&n,n=i[++e],t.borderType+=(128&n)>>5,t.wordWrap=(64&n)>>6,t.printDirection=(48&n)>>4,t.scrollDirection=(12&n)>>2,t.justify=3&n,n=i[++e],t.effectSpeed=(240&n)>>4,t.effectDirection=(12&n)>>2,t.displayEffect=3&n,e},ge.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},ge.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},ge.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=1);return e},ge.prototype.hideWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=0);return e},ge.prototype.toggleWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible^=1);return e},ge.prototype.clearWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].clearText();return e},ge.prototype.deleteWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].reset();return e},ge.prototype.setPenAttributes=function(e,t){var i=this.current708Packet.data,n=(i[e],t=t.currentWindow.penAttr,i[++e]);return t.textTag=(240&n)>>4,t.offset=(12&n)>>2,t.penSize=3&n,n=i[++e],t.italics=(128&n)>>7,t.underline=(64&n)>>6,t.edgeType=(56&n)>>3,t.fontStyle=7&n,e},ge.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=(i[e],t=t.currentWindow.penColor,i[++e]);return t.fgOpacity=(192&n)>>6,t.fgRed=(48&n)>>4,t.fgGreen=(12&n)>>2,t.fgBlue=3&n,n=i[++e],t.bgOpacity=(192&n)>>6,t.bgRed=(48&n)>>4,t.bgGreen=(12&n)>>2,t.bgBlue=3&n,n=i[++e],t.edgeRed=(48&n)>>4,t.edgeGreen=(12&n)>>2,t.edgeBlue=3&n,e},ge.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=(i[e],t.currentWindow.penLoc);return t.currentWindow.pendingNewLine=!0,t=i[++e],n.row=15&t,t=i[++e],n.column=63&t,e},ge.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)},{42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496}),_e=14,ve=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],be=function(e,t){be.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,s=32639&e.ccData;s===this.lastControlCode_?this.lastControlCode_=null:(4096==(61440&s)?this.lastControlCode_=s:s!==this.PADDING_&&(this.lastControlCode_=null),t=s>>>8,i=255&s,s!==this.PADDING_&&(s===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":s===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),r=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=r,this.startPts_=e.pts):s===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(e.pts)):s===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(e.pts)):s===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(e.pts)):s===this.CARRIAGE_RETURN_?(this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts):s===this.BACKSPACE_?"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1):s===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(e.pts),this.displayed_=Y()):s===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=Y():s===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Y()),this.mode_="paintOn",this.startPts_=e.pts):this.isSpecialCharacter(t,i)?(n=Q((t=(3&t)<<8)|i),this[this.mode_](e.pts,n),this.column_++):this.isExtCharacter(t,i)?("popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),n=Q((t=(3&t)<<8)|i),this[this.mode_](e.pts,n),this.column_++):this.isMidRowCode(t,i)?(this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,!(14&~i)&&this.addFormatting(e.pts,["i"]),!(1&~i)&&this.addFormatting(e.pts,["u"])):this.isOffsetControlCode(t,i)?this.column_+=3&i:this.isPAC(t,i)?(r=ve.indexOf(7968&s),"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&(this.clearFormatting(e.pts),this.row_=r),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),!(16&~s)&&(this.column_=4*((14&s)>>1)),this.isColorPAC(i)&&!(14&~i)&&this.addFormatting(e.pts,["i"])):this.isNormalChar(t)&&(0===i&&(i=null),n=Q(t),n+=Q(i),this[this.mode_](e.pts,n),this.column_+=n.length)))}},Te=(be.prototype=new pe,be.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e,t){try{return e.trim()}catch(e){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},be.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Y(),this.nonDisplayed_=Y(),this.lastControlCode_=null,this.column_=0,this.row_=_e,this.rollUpRows_=2,this.formatting_=[]},be.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},be.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},be.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},be.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},be.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},be.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&64<=t&&t<=127},be.prototype.isColorPAC=function(e){return 64<=e&&e<=79||96<=e&&e<=127},be.prototype.isNormalChar=function(e){return 32<=e&&e<=127},be.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=_e,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Y(),this.displayed_=Y()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},be.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t),t=t.reduce((function(e,t){return e+"<"+t+">"}),""),this[this.mode_](e,t)},be.prototype.clearFormatting=function(e){var t;this.formatting_.length&&(t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),""),this.formatting_=[],this[this.mode_](e,t))},be.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];this.nonDisplayed_[this.row_]=i+=t},be.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];this.displayed_[this.row_]=i+=t},be.prototype.shiftRowsUp_=function(){for(var e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<_e+1;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},be.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];this.displayed_[this.row_]=i+=t},pe={CaptionStream:z,Cea608Stream:be,Cea708Stream:ge},{H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21}),Se=B,we=8589934592,Ee=4294967296;function ke(e,t,i){for(var n="",r=t;r<i;r++)n+="%"+("00"+e[r].toString(16)).slice(-2);return n}function Ce(e,t,i){return decodeURIComponent(ke(e,t,i))}function xe(e,t,i){return unescape(ke(e,t,i))}function Ie(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}Z.prototype=new Se,Se=Z;var Ae,Oe,Pe,Le=J,De=(e,t,i)=>{if(e)for(var n=i;n<e.length;n++)if(e[n]===t)return n;return-1},Ne={APIC:function(e){var t,i=1;3!==e.data[0]||(t=De(e.data,0,1))<0||(e.mimeType=xe(e.data,1,t),e.pictureType=e.data[i=t+1],(t=De(e.data,0,++i))<0)||(e.description=Ce(e.data,i,t),i=t+1,"--\x3e"===e.mimeType?e.url=xe(e.data,i,e.data.length):e.pictureData=e.data.subarray(i,e.data.length))},"T*":function(e){3===e.data[0]&&(e.value=Ce(e.data,1,e.data.length).replace(/\0*$/,""),e.values=e.value.split("\0"))},TXXX:function(e){var t;3===e.data[0]&&-1!==(t=De(e.data,0,1))&&(e.description=Ce(e.data,1,t),e.value=Ce(e.data,t+1,e.data.length).replace(/\0*$/,""),e.data=e.value)},"W*":function(e){e.url=xe(e.data,0,e.data.length).replace(/\0.*$/,"")},WXXX:function(e){var t;3===e.data[0]&&-1!==(t=De(e.data,0,1))&&(e.description=Ce(e.data,1,t),e.url=xe(e.data,t+1,e.data.length).replace(/\0.*$/,""))},PRIV:function(e){for(var t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=xe(e.data,0,t);break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}},Me={parseId3Frames:function(e){var t,i=10,n=0,r=[];if(!(e.length<10||e[0]!=="I".charCodeAt(0)||e[1]!=="D".charCodeAt(0)||e[2]!=="3".charCodeAt(0))){n=Ie(e.subarray(6,10)),n+=10,64&e[5]&&(i=(i+=4)+Ie(e.subarray(10,14)),n-=Ie(e.subarray(16,20)));do{if((t=Ie(e.subarray(i+4,i+8)))<1)break;var s={id:String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]),data:e.subarray(i+10,i+t+10)}}while(s.key=s.id,Ne[s.id]?Ne[s.id](s):"T"===s.id[0]?Ne["T*"](s):"W"===s.id[0]&&Ne["W*"](s),r.push(s),(i=i+10+t)<n);return r}},parseSyncSafeInteger:Ie,frameParsers:Ne},Re=B,Ue=Te,je=Me,Be=function(e){var t,i={descriptor:e&&e.descriptor},n=0,r=[],s=0;if(Be.prototype.init.call(this),this.dispatchType=Ue.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,i,a,o,l,u,d;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(s=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});else if(r.push(e),s+=e.data.byteLength,1===r.length&&(n=je.parseSyncSafeInteger(e.data.subarray(6,10)),n+=10),!(s<n)){for(t={data:new Uint8Array(n),frames:[],pts:r[0].pts,dts:r[0].dts},o=0;o<n;)t.data.set(r[0].data.subarray(0,n-o),o),o+=r[0].data.byteLength,s-=r[0].data.byteLength,r.shift();i=10,64&t.data[5]&&(i=(i+=4)+je.parseSyncSafeInteger(t.data.subarray(10,14)),n-=je.parseSyncSafeInteger(t.data.subarray(16,20)));do{if((a=je.parseSyncSafeInteger(t.data.subarray(i+4,i+8)))<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}}while((d={id:String.fromCharCode(t.data[i],t.data[i+1],t.data[i+2],t.data[i+3]),data:t.data.subarray(i+10,i+a+10)}).key=d.id,je.frameParsers[d.id]?je.frameParsers[d.id](d):"T"===d.id[0]?je.frameParsers["T*"](d):"W"===d.id[0]&&je.frameParsers["W*"](d),"com.apple.streaming.transportStreamTimestamp"===d.owner&&(u=(1&(l=d.data)[3])<<30|l[4]<<22|l[5]<<14|l[6]<<6|l[7]>>>2,u=(u*=4)+(3&l[7]),d.timeStamp=u,void 0===t.pts&&void 0===t.dts&&(t.pts=d.timeStamp,t.dts=d.timeStamp),this.trigger("timestamp",d)),t.frames.push(d),(i=i+10+a)<n);this.trigger("data",t)}}},Fe=(Be.prototype=new Re,Me=Be,Re=B,pe),qe=Te,He=function(){var e=new Uint8Array(188),t=0;He.prototype.init.call(this),this.push=function(i){var n,r=0,s=188;for(t?((n=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),n.set(i,t),t=0):n=i;s<n.byteLength;)71===n[r]&&71===n[s]?(this.trigger("data",n.subarray(r,s)),r+=188,s+=188):(r++,s++);r<n.byteLength&&(e.set(n.subarray(r),0),t=n.byteLength-r)},this.flush=function(){188===t&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}},Ve=(He.prototype=new Re,(Ae=function(){var e,t,i,n;Ae.prototype.init.call(this),(n=this).packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,n){var r=0;n.payloadUnitStartIndicator&&(r+=e[r]+1),("pat"===n.type?t:i)(e.subarray(r),n)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],n.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=n.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var s=e[r],a=(31&e[r+1])<<8|e[r+2];s===qe.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=a:s===qe.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=a:s===qe.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][a]=s),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=n.programMapTable}},this.push=function(t){var i={},n=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],1<(48&t[3])>>>4&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=qe.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=qe.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new Re,Ae.STREAM_TYPES={h264:27,adts:15},(Oe=function(){function e(e,t,n){var r,s=new Uint8Array(e.size),a={type:t},l=0,u=0;if(e.data.length&&!(e.size<9)){for(a.trackId=e.data[0].pid,l=0;l<e.data.length;l++)r=e.data[l],s.set(r.data,u),u+=r.data.byteLength;o(s,a),t="video"===t||a.packetLength<=e.size,(n||t)&&(e.size=0,e.data.length=0),t&&i.trigger("data",a)}}var t,i=this,n=!1,r={data:[],size:0},s={data:[],size:0},a={data:[],size:0},o=function(e,t){var i=e[0]<<16|e[1]<<8|e[2];t.data=new Uint8Array,1==i&&(t.packetLength=6+(e[4]<<8|e[5]),t.dataAlignmentIndicator=!!(4&e[6]),192&(i=e[7])&&(t.pts=(14&e[9])<<27|(255&e[10])<<20|(254&e[11])<<12|(255&e[12])<<5|(254&e[13])>>>3,t.pts*=4,t.pts+=(6&e[13])>>>1,t.dts=t.pts,64&i)&&(t.dts=(14&e[14])<<27|(255&e[15])<<20|(254&e[16])<<12|(255&e[17])<<5|(254&e[18])>>>3,t.dts*=4,t.dts+=(6&e[18])>>>1),t.data=e.subarray(9+e[8]))};Oe.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,i;switch(o.streamType){case qe.H264_STREAM_TYPE:t=r,i="video";break;case qe.ADTS_STREAM_TYPE:t=s,i="audio";break;case qe.METADATA_STREAM_TYPE:t=a,i="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&e(t,i,!0),t.data.push(o),t.size+=o.data.byteLength},pmt:function(){var e={type:"metadata",tracks:[]};null!==(t=o.programMapTable).video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),n=!0,i.trigger("data",e)}})[o.type]()},this.reset=function(){r.size=0,r.data.length=0,s.size=0,s.data.length=0,this.trigger("reset")},this.flushStreams_=function(){e(r,"video"),e(s,"audio"),e(a,"timed-metadata")},this.flush=function(){var e;!n&&t&&(e={type:"metadata",tracks:[]},null!==t.video&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.video,codec:"avc",type:"video"}),null!==t.audio&&e.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+t.audio,codec:"adts",type:"audio"}),i.trigger("data",e)),n=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new Re,{PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:He,TransportParseStream:Ae,ElementaryStream:Oe,TimestampRolloverStream:Se,CaptionStream:Fe.CaptionStream,Cea608Stream:Fe.Cea608Stream,Cea708Stream:Fe.Cea708Stream,MetadataStream:Me});for(Pe in qe)qe.hasOwnProperty(Pe)&&(Ve[Pe]=qe[Pe]);Re=Ve,Se=B;var $e,We,ze=de.ONE_SECOND_IN_TS,Ge=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Xe=function(e){var t,i=0;Xe.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:`adts skiping bytes ${e} to ${t} in frame ${i} outside syncword`})},this.push=function(n){var r,s,a,o,l,u,d=0;if(e||(i=0),"audio"===n.type){for(t&&t.length?(a=t,(t=new Uint8Array(a.byteLength+n.data.byteLength)).set(a),t.set(n.data,a.byteLength)):t=n.data;d+7<t.length;)if(255!==t[d]||240!=(246&t[d+1]))"number"!=typeof u&&(u=d),d++;else{if("number"==typeof u&&(this.skipWarn_(u,d),u=null),s=2*(1&~t[d+1]),r=(3&t[d+3])<<11|t[d+4]<<3|(224&t[d+5])>>5,l=(o=1024*(1+(3&t[d+6])))*ze/Ge[(60&t[d+2])>>>2],t.byteLength-d<r)break;this.trigger("data",{pts:n.pts+i*l,dts:n.dts+i*l,sampleCount:o,audioobjecttype:1+(t[d+2]>>>6&3),channelcount:(1&t[d+2])<<2|(192&t[d+3])>>>6,samplerate:Ge[(60&t[d+2])>>>2],samplingfrequencyindex:(60&t[d+2])>>>2,samplesize:16,data:t.subarray(d+7+s,d+r)}),i++,d+=r}"number"==typeof u&&(this.skipWarn_(u,d),u=null),t=t.subarray(d)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}},Ke=(Xe.prototype=new Se,Fe=Xe,Me=B,function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,s=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");s.set(e.subarray(r,r+a)),i=new DataView(s.buffer).getUint32(0),n=8*a,t-=a},this.skipBits=function(e){var r;e<n||(e=(e-=n)-8*(r=Math.floor(e/8)),t-=r,this.loadWord()),i<<=e,n-=e},this.readBits=function(e){var r=Math.min(n,e),s=i>>>32-r;return 0<(n-=r)?i<<=r:0<t&&this.loadWord(),0<(r=e-r)?s<<r|this.readBits(r):s},this.skipLeadingZeros=function(){for(var e=0;e<n;++e)if(i&2147483648>>>e)return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()}),Qe=function(){var e,t,i=0;Qe.prototype.init.call(this),this.push=function(n){for(var r,s=(t=t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),r):n.data).byteLength;i<s-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<s;)switch(t[e]){case 0:if(0!==t[e-1])e+=2;else if(0!==t[e-2])e++;else{for(i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));1!==t[++e]&&e<s;);i=e-2,e+=3}break;case 1:0!==t[e-1]||0!==t[e-2]||(this.trigger("data",t.subarray(i+3,e-2)),i=e-2),e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.reset=function(){t=null,i=0,this.trigger("reset")},this.flush=function(){t&&3<t.byteLength&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}};function Ye(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}Qe.prototype=new Me,We={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},($e=function(){var e,t,i,n,r,s,a,o=new Qe;$e.prototype.init.call(this),(e=this).push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(a){var o={trackId:t,pts:i,dts:n,data:a,nalUnitTypeCode:31&a[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(a.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(a.subarray(1)),o.config=s(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},a=function(e,t){for(var i=8,n=8,r=0;r<e;r++)i=0===(n=0!==n?(i+t.readExpGolomb()+256)%256:n)?i:n},r=function(e){for(var t=e.byteLength,i=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(i.push(n+2),n+=2):n++;if(0===i.length)return e;var r=t-i.length,s=new Uint8Array(r),a=0;for(n=0;n<r;a++,n++)a===i[0]&&(a++,i.shift()),s[n]=e[a];return s},s=function(e){var t,i,n,r,s,o,l=0,u=0,d=0,h=0,c=[1,1],p=new Ke(e),m=(e=p.readUnsignedByte(),p.readUnsignedByte()),f=p.readUnsignedByte();if(p.skipUnsignedExpGolomb(),We[e]&&(3===(i=p.readUnsignedExpGolomb())&&p.skipBits(1),p.skipUnsignedExpGolomb(),p.skipUnsignedExpGolomb(),p.skipBits(1),p.readBoolean()))for(s=3!==i?8:12,o=0;o<s;o++)p.readBoolean()&&a(o<6?16:64,p);if(p.skipUnsignedExpGolomb(),0===(i=p.readUnsignedExpGolomb()))p.readUnsignedExpGolomb();else if(1===i)for(p.skipBits(1),p.skipExpGolomb(),p.skipExpGolomb(),t=p.readUnsignedExpGolomb(),o=0;o<t;o++)p.skipExpGolomb();if(p.skipUnsignedExpGolomb(),p.skipBits(1),i=p.readUnsignedExpGolomb(),n=p.readUnsignedExpGolomb(),0===(r=p.readBits(1))&&p.skipBits(1),p.skipBits(1),p.readBoolean()&&(l=p.readUnsignedExpGolomb(),u=p.readUnsignedExpGolomb(),d=p.readUnsignedExpGolomb(),h=p.readUnsignedExpGolomb()),p.readBoolean()&&p.readBoolean()){switch(p.readUnsignedByte()){case 1:c=[1,1];break;case 2:c=[12,11];break;case 3:c=[10,11];break;case 4:c=[16,11];break;case 5:c=[40,33];break;case 6:c=[24,11];break;case 7:c=[20,11];break;case 8:c=[32,11];break;case 9:c=[80,33];break;case 10:c=[18,11];break;case 11:c=[15,11];break;case 12:c=[64,33];break;case 13:c=[160,99];break;case 14:c=[4,3];break;case 15:c=[3,2];break;case 16:c=[2,1];break;case 255:c=[p.readUnsignedByte()<<8|p.readUnsignedByte(),p.readUnsignedByte()<<8|p.readUnsignedByte()]}c&&(c[0],c[1])}return{profileIdc:e,levelIdc:f,profileCompatibility:m,width:16*(i+1)-2*l-2*u,height:(2-r)*(n+1)*16-2*d-2*h,sarRatio:c}}}).prototype=new Me,Se=$e;var Je=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Ze=function(e,t){var i=0<=(i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9])?i:0;return(16&e[t+5])>>4?20+i:10+i},et=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=Ze(e,t),et(e,t))},tt=function(e,t,i){for(var n="",r=t;r<i;r++)n+="%"+("00"+e[r].toString(16)).slice(-2);return n},it=(Me={isLikelyAacData:function(e){var t=et(e,0);return e.length>=t+2&&!(255&~e[t])&&!(240&~e[t+1])&&16==(22&e[t+1])},parseId3TagSize:Ze,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&!(240&~e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return Je[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i=10;64&e[5]&&(i=(i+=4)+Ye(e.subarray(10,14)));do{if((t=Ye(e.subarray(i+4,i+8)))<1)return null;if("PRIV"===String.fromCharCode(e[i],e[i+1],e[i+2],e[i+3]))for(var n,r,s=e.subarray(i+10,i+t+10),a=0;a<s.byteLength;a++)if(0===s[a]){if("com.apple.streaming.transportStreamTimestamp"===unescape(tt(s,0,a)))return r=(1&(n=s.subarray(a+1))[3])<<30|n[4]<<22|n[5]<<14|n[6]<<6|n[7]>>>2,(r*=4)+(3&n[7]);break}}while((i=i+10+t)<e.byteLength);return null}},B),nt=Me,rt=function(){var e=new Uint8Array,t=0;rt.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var n,r,s=0,a=0;for(e.length?(r=e.length,(e=new Uint8Array(i.byteLength+r)).set(e.subarray(0,r)),e.set(i,r)):e=i;3<=e.length-a;)if(e[a]==="I".charCodeAt(0)&&e[a+1]==="D".charCodeAt(0)&&e[a+2]==="3".charCodeAt(0)){if(e.length-a<10)break;if(a+(s=nt.parseId3TagSize(e,a))>e.length)break;n={type:"timed-metadata",data:e.subarray(a,a+s)},this.trigger("data",n),a+=s}else if(255&~e[a]||240&~e[a+1])a++;else{if(e.length-a<7)break;if(a+(s=nt.parseAdtsSize(e,a))>e.length)break;n={type:"audio",data:e.subarray(a,a+s),pts:t,dts:t},this.trigger("data",n),a+=s}r=e.length-a,e=0<r?e.subarray(a):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}};function st(e,t){for(var i=Object.keys(t),n=0;n<i.length;n++){var r=i[n];"headOfPipeline"!==r&&t[r].on&&t[r].on("log",Et.bind(e,r))}}function at(e,t){var i;if(e.length===t.length){for(i=0;i<e.length;i++)if(e[i]!==t[i])return;return 1}}function ot(e,t,i,n,r,s){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(n-t),pts:e+(r-i)},prependedContentDuration:s,baseMediaDecodeTime:e}}rt.prototype=new it,it=B;var lt,ut,dt,ht=te,ct=ne,pt=ae,mt=oe,ft=Re,gt=de,yt=Fe,_t=Se,vt=rt,bt=Me.isLikelyAacData,Tt=de.ONE_SECOND_IN_TS,St=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],wt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Et=function(e,t){t.stream=e,this.trigger("log",t)},kt=function(e,t){var i=[],n=0,r=0,s=1/0,a=(t=t||{}).firstSequenceNumber||0;kt.prototype.init.call(this),this.push=function(t){mt.collectDtsInfo(e,t),e&&St.forEach((function(i){e[i]=t[i]})),i.push(t)},this.setEarliestDts=function(e){n=e},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){r=e},this.flush=function(){var o,l,u,d,h;0!==i.length&&(o=pt.trimAdtsFramesByEarliestDts(i,e,n),e.baseMediaDecodeTime=mt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),h=pt.prefixWithSilence(e,o,r,s),e.samples=pt.generateSampleTable(o),u=ht.mdat(pt.concatenateFrameData(o)),i=[],d=ht.moof(a,[e]),l=new Uint8Array(d.byteLength+u.byteLength),a++,l.set(d),l.set(u,d.byteLength),mt.clearDtsInfo(e),u=Math.ceil(1024*Tt/e.samplerate),o.length&&(d=o.length*u,this.trigger("segmentTimingInfo",ot(gt.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),o[0].dts,o[0].pts,o[0].dts+d,o[0].pts+d,h||0)),this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+d})),this.trigger("data",{track:e,boxes:l})),this.trigger("done","AudioSegmentStream")},this.reset=function(){mt.clearDtsInfo(e),i=[],this.trigger("reset")}};function Ct(e){var t="";return(t+=String.fromCharCode(e[0]))+String.fromCharCode(e[1])+String.fromCharCode(e[2])+String.fromCharCode(e[3])}function xt(e,t){var i,n,r,s=[];if(!t.length)return null;for(i=0;i<e.byteLength;)n=Dt(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]),r=Nt(e.subarray(i+4,i+8)),n=1<n?i+n:e.byteLength,r===t[0]&&(1===t.length?s.push(e.subarray(i+8,n)):(r=xt(e.subarray(i+8,n),t.slice(1))).length&&(s=s.concat(r))),i=n;return s}function It(e){return(31&e[1])<<8|e[2]}function At(e){return!!(64&e[1])}function Ot(e){var t=0;return 1<(48&e[3])>>>4&&(t+=e[4]+1),t}function Pt(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}}kt.prototype=new it,(lt=function(e,t){var i,n,r=[],s=[],a=(t=t||{}).firstSequenceNumber||0;lt.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){mt.collectDtsInfo(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],wt.forEach((function(t){e[t]=i[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.data,e.pps=[t.data]),r.push(t)},this.flush=function(){for(var i,n,o,l=0;r.length&&"access_unit_delimiter_rbsp"!==r[0].nalUnitType;)r.shift();if(0!==r.length){if(i=ct.groupNalsIntoFrames(r),(i=ct.groupFramesIntoGops(i))[0][0].keyFrame||((u=this.getGopForFusion_(r[0],e))?(l=u.duration,i.unshift(u),i.byteLength+=u.byteLength,i.nalCount+=u.nalCount,i.pts=u.pts,i.dts=u.dts,i.duration+=u.duration):i=ct.extendFirstKeyFrame(i)),s.length){var u=t.alignGopsAtEnd?this.alignGopsAtEnd_(i):this.alignGopsAtStart_(i);if(!u)return this.gopCache_.unshift({gop:i.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),r=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");mt.clearDtsInfo(e),i=u}mt.collectDtsInfo(e,i),e.samples=ct.generateSampleTable(i),u=ht.mdat(ct.concatenateNalData(i)),e.baseMediaDecodeTime=mt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",i.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),n=i[0],o=i[i.length-1],this.trigger("segmentTimingInfo",ot(e.baseMediaDecodeTime,n.dts,n.pts,o.dts+o.duration,o.pts+o.duration,l)),this.trigger("timingInfo",{start:i[0].pts,end:i[i.length-1].pts+i[i.length-1].duration}),this.gopCache_.unshift({gop:i.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),r=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),n=ht.moof(a,[e]),o=new Uint8Array(n.byteLength+u.byteLength),a++,o.set(n),o.set(u,n.byteLength),this.trigger("data",{track:e,boxes:o})}this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),r=[],this.gopCache_.length=0,s.length=0,this.trigger("reset")},this.resetStream_=function(){mt.clearDtsInfo(e),n=i=void 0},this.getGopForFusion_=function(t){for(var i,n,r,s=1/0,a=0;a<this.gopCache_.length;a++)n=(r=this.gopCache_[a]).gop,e.pps&&at(e.pps[0],r.pps[0])&&e.sps&&at(e.sps[0],r.sps[0])&&(n.dts<e.timelineStartInfo.dts||-1e4<=(n=t.dts-n.dts-n.duration)&&n<=45e3&&(!i||n<s)&&(i=r,s=n));return i?i.gop:null},this.alignGopsAtStart_=function(e){for(var t,i,n,r,a=e.byteLength,o=e.nalCount,l=e.duration,u=t=0;u<s.length&&t<e.length&&(i=s[u],n=e[t],i.pts!==n.pts);)n.pts>i.pts?u++:(t++,a-=n.byteLength,o-=n.nalCount,l-=n.duration);return 0===t?e:t===e.length?null:((r=e.slice(t)).byteLength=a,r.duration=l,r.nalCount=o,r.pts=r[0].pts,r.dts=r[0].dts,r)},this.alignGopsAtEnd_=function(e){for(var t,i,n,r,a=s.length-1,o=e.length-1,l=null,u=!1;0<=a&&0<=o;){if(t=s[a],i=e[o],t.pts===i.pts){u=!0;break}t.pts>i.pts?a--:(a===s.length-1&&(l=o),o--)}return u||null!==l?0===(n=u?o:l)?e:(r=(n=e.slice(n)).reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0}),n.byteLength=r.byteLength,n.duration=r.duration,n.nalCount=r.nalCount,n.pts=n[0].pts,n.dts=n[0].dts,n):null},this.alignGopsWith=function(e){s=e}}).prototype=new it,((dt=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,dt.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new it).flush=function(e){var t,i,n,r=0,s={captions:[],captionStreams:{},metadata:[],info:{}},a=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,wt.forEach((function(e){s.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,St.forEach((function(e){s.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,e=ht.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(e.byteLength),s.initSegment.set(e),s.data=new Uint8Array(this.pendingBytes),n=0;n<this.pendingBoxes.length;n++)s.data.set(this.pendingBoxes[n],r),r+=this.pendingBoxes[n].byteLength;for(n=0;n<this.pendingCaptions.length;n++)(t=this.pendingCaptions[n]).startTime=gt.metadataTsToSeconds(t.startPts,a,this.keepOriginalTimestamps),t.endTime=gt.metadataTsToSeconds(t.endPts,a,this.keepOriginalTimestamps),s.captionStreams[t.stream]=!0,s.captions.push(t);for(n=0;n<this.pendingMetadata.length;n++)(i=this.pendingMetadata[n]).cueTime=gt.metadataTsToSeconds(i.pts,a,this.keepOriginalTimestamps),s.metadata.push(i);for(s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),n=0;n<s.captions.length;n++)t=s.captions[n],this.trigger("caption",t);for(n=0;n<s.metadata.length;n++)i=s.metadata[n],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},dt.prototype.setRemux=function(e){this.remuxTracks=e},(ut=function(e){var t,i,n=this,r=!0;ut.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};(this.transmuxPipeline_=r).type="aac",r.metadataStream=new ft.MetadataStream,r.aacStream=new vt,r.audioTimestampRolloverStream=new ft.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new ft.TimestampRolloverStream("timed-metadata"),r.adtsStream=new yt,r.coalesceStream=new dt(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(s){"timed-metadata"!==s.type&&"audio"!==s.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new kt(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),st(this,r)},this.setupTsPipeline=function(){var r={};(this.transmuxPipeline_=r).type="ts",r.metadataStream=new ft.MetadataStream,r.packetStream=new ft.TransportPacketStream,r.parseStream=new ft.TransportParseStream,r.elementaryStream=new ft.ElementaryStream,r.timestampRolloverStream=new ft.TimestampRolloverStream,r.adtsStream=new yt,r.h264Stream=new _t,r.captionStream=new ft.CaptionStream(e),r.coalesceStream=new dt(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(s){var a;if("metadata"===s.type){for(a=s.tracks.length;a--;)t||"video"!==s.tracks[a].type?i||"audio"!==s.tracks[a].type||((i=s.tracks[a]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=s.tracks[a]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new lt(t,e),r.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new kt(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),st(this,r)},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,mt.clearDtsInfo(i),r.audioTimestampRolloverStream)&&r.audioTimestampRolloverStream.discontinuity(),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,mt.clearDtsInfo(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){var t;r&&((t=bt(e))&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1),this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new it;var Lt=ut,Dt=(B=function(e){return e>>>0},ae=function(e){return("00"+e.toString(16)).slice(-2)},B),Nt=Ct,Mt=B,Rt=q.getUint64,Ut=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},jt=(Re=oe="undefined"!=typeof window?window:void 0!==j?j:"undefined"!=typeof self?self:{},ue.discardEmulationPreventionBytes),Bt=pe.CaptionStream,Ft=xt,qt=Re,Ht=function(e,t){var i=Ft(e,["moof","traf"]),n=(e=Ft(e,["mdat"]),{}),r=[];return e.forEach((function(e,t){t=i[t],r.push({mdat:e,traf:t})})),r.forEach((function(e){var i,r,s,a,o,l=e.mdat,u=(e=e.traf,Ft(e,["tfhd"])),d=(u=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=1&(e={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4)}).flags[2],n=2&e.flags[2],r=8&e.flags[2],s=16&e.flags[2],a=32&e.flags[2],o=65536&e.flags[0],l=131072&e.flags[0],u=8;return i&&(u+=4,e.baseDataOffset=t.getUint32(12),u+=4),n&&(e.sampleDescriptionIndex=t.getUint32(u),u+=4),r&&(e.defaultSampleDuration=t.getUint32(u),u+=4),s&&(e.defaultSampleSize=t.getUint32(u),u+=4),a&&(e.defaultSampleFlags=t.getUint32(u)),o&&(e.durationIsEmpty=!0),!i&&l&&(e.baseDataOffsetIsMoof=!0),e}(u[0])).trackId,h=0<(h=Ft(e,["tfdt"])).length?function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return t.baseMediaDecodeTime=1===t.version?Rt(e.subarray(4)):Mt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t}(h[0]).baseMediaDecodeTime:0;e=Ft(e,["trun"]),t===d&&0<e.length&&(i=h,r=u.defaultSampleDuration||0,s=u.defaultSampleSize||0,a=u.trackId,o=[],e.forEach((function(e){(e=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],s=4&i.flags[2],a=1&i.flags[1],o=2&i.flags[1],l=4&i.flags[1],u=8&i.flags[1],d=n.getUint32(4),h=8;for(r&&(i.dataOffset=n.getInt32(h),h+=4),s&&d&&(t={flags:Ut(e.subarray(h,h+4))},h+=4,a&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),u&&(t.compositionTimeOffset=1===i.version?n.getInt32(h):n.getUint32(h),h+=4),i.samples.push(t),d--);d--;)t={},a&&(t.duration=n.getUint32(h),h+=4),o&&(t.size=n.getUint32(h),h+=4),l&&(t.flags=Ut(e.subarray(h,h+4)),h+=4),u&&(t.compositionTimeOffset=1===i.version?n.getInt32(h):n.getUint32(h),h+=4),i.samples.push(t);return i}(e).samples).forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=s),e.trackId=a,e.dts=i,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof i?(e.pts=i+qt.BigInt(e.compositionTimeOffset),i+=qt.BigInt(e.duration)):(e.pts=i+e.compositionTimeOffset,i+=e.duration)})),o=o.concat(e)})),h=function(e,t,i){for(var n,r,s=new DataView(e.buffer,e.byteOffset,e.byteLength),a={logs:[],seiNals:[]},o=0;o+4<e.length;o+=n)if(n=s.getUint32(o),o+=4,!(n<=0))switch(31&e[o]){case 6:var l=e.subarray(o+1,o+1+n),u=function(e,t){for(var i=e,n=0;n<t.length;n++){var r=t[n];if(i<r.size)return r;i-=r.size}return null}(o,t);if(l={nalUnitType:"sei_rbsp",size:n,data:l,escapedRBSP:jt(l),trackId:i},u)l.pts=u.pts,l.dts=u.dts,r=u;else{if(!r){a.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+o+" for trackId "+i+". See mux.js#223."});break}l.pts=r.pts,l.dts=r.dts}a.seiNals.push(l)}return a}(l,o,d),n[d]||(n[d]={seiNals:[],logs:[]}),n[d].seiNals=n[d].seiNals.concat(h.seiNals),n[d].logs=n[d].logs.concat(h.logs))})),n},Vt=function(){var e,t,i,n,r,s,a=!1;this.isInitialized=function(){return a},this.init=function(t){e=new Bt,a=!0,s=!!t&&t.isPartial,e.on("data",(function(e){e.startTime=e.startPts/n,e.endTime=e.endPts/n,r.captions.push(e),r.captionStreams[e.stream]=!0})),e.on("log",(function(e){r.logs.push(e)}))},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length||i===e[0]&&n===t[i])},this.parse=function(e,s,a){var o,l;if(!this.isInitialized())return null;if(!s||!a)return null;if(this.isNewInit(s,a))i=s[0],n=a[i];else if(null===i||!n)return t.push(e),null;for(;0<t.length;){var u=t.shift();this.parse(u,s,a)}return l=n,(o=null===(o=i)?null:{seiNals:(e=Ht(e,o)[o]||{}).seiNals,logs:e.logs,timescale:l})&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;s?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],n=i=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},$t=B,Wt=ae,zt=xt,Gt=Ct,Xt=q.getUint64,Kt=Re,Qt=Te,Yt=Te,Jt=Le,Zt={},ei=(Zt.ts={parseType:function(e,t){return 0===(e=It(e))?"pat":e===t?"pmt":t?"pes":null},parsePat:function(e){var t=At(e),i=4+Ot(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=At(e),n=4+Ot(e);if(i&&(n+=e[n]+1),1&e[n+5]){for(var r=3+((15&e[n+1])<<8|e[n+2])-4,s=12+((15&e[n+10])<<8|e[n+11]);s<r;){var a=n+s;t[(31&e[a+1])<<8|e[a+2]]=e[a],s+=5+((15&e[a+3])<<8|e[a+4])}return t}},parsePayloadUnitStartIndicator:At,parsePesType:function(e,t){switch(t[It(e)]){case Qt.H264_STREAM_TYPE:return"video";case Qt.ADTS_STREAM_TYPE:return"audio";case Qt.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){var t,i,n;return!At(e)||(t=4+Ot(e))>=e.byteLength?null:(i=null,192&(n=e[t+7])&&((i={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&n)&&(i.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,i.dts*=4,i.dts+=(6&e[t+18])>>>1),i)},videoPacketContainsKeyFrame:function(e){for(var t=4+Ot(e),i=e.subarray(t),n=0,r=0,s=!1;r<i.byteLength-3;r++)if(1===i[r+2]){n=r+5;break}for(;n<i.byteLength;)switch(i[n]){case 0:if(0!==i[n-1])n+=2;else if(0!==i[n-2])n++;else{for(r+3!==n-2&&"slice_layer_without_partitioning_rbsp_idr"===Pt(31&i[r+3])&&(s=!0);1!==i[++n]&&n<i.length;);r=n-2,n+=3}break;case 1:0!==i[n-1]||0!==i[n-2]||("slice_layer_without_partitioning_rbsp_idr"===Pt(31&i[r+3])&&(s=!0),r=n-2),n+=3;break;default:n+=3}return i=i.subarray(r),n-=r,r=0,!!(i&&3<i.byteLength&&"slice_layer_without_partitioning_rbsp_idr"===Pt(31&i[r+3]))||s}},Zt.aac=Me,de.ONE_SECOND_IN_TS),ti=function(e,t,i){for(var n,r,s,a,o=0,l=188,u=!1;l<=e.byteLength;)if(71!==e[o]||71!==e[l]&&l!==e.byteLength)o++,l++;else{if(n=e.subarray(o,l),"pes"===Zt.ts.parseType(n,t.pid)&&(r=Zt.ts.parsePesType(n,t.table),s=Zt.ts.parsePayloadUnitStartIndicator(n),"audio"===r)&&s&&(a=Zt.ts.parsePesTime(n))&&(a.type="audio",i.audio.push(a),u=!0),u)break;o+=188,l+=188}for(o=(l=e.byteLength)-188,u=!1;0<=o;)if(71!==e[o]||71!==e[l]&&l!==e.byteLength)o--,l--;else{if(n=e.subarray(o,l),"pes"===Zt.ts.parseType(n,t.pid)&&(r=Zt.ts.parsePesType(n,t.table),s=Zt.ts.parsePayloadUnitStartIndicator(n),"audio"===r)&&s&&(a=Zt.ts.parsePesTime(n))&&(a.type="audio",i.audio.push(a),u=!0),u)break;o-=188,l-=188}},ii=function(e,t,i){for(var n,r,s,a,o,l,u,d,h=0,c=188,p=!1,m={data:[],size:0};c<e.byteLength;)if(71===e[h]&&71===e[c]){if(n=e.subarray(h,c),"pes"===Zt.ts.parseType(n,t.pid)&&(r=Zt.ts.parsePesType(n,t.table),s=Zt.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(s&&!p&&(a=Zt.ts.parsePesTime(n))&&(a.type="video",i.video.push(a),p=!0),!i.firstKeyFrame))){if(s&&0!==m.size){for(o=new Uint8Array(m.size),l=0;m.data.length;)u=m.data.shift(),o.set(u,l),l+=u.byteLength;Zt.ts.videoPacketContainsKeyFrame(o)&&(d=Zt.ts.parsePesTime(o))&&(i.firstKeyFrame=d,i.firstKeyFrame.type="video"),m.size=0}m.data.push(n),m.size+=n.byteLength}if(p&&i.firstKeyFrame)break;h+=188,c+=188}else h++,c++;for(h=(c=e.byteLength)-188,p=!1;0<=h;)if(71===e[h]&&71===e[c]){if(n=e.subarray(h,c),"pes"===Zt.ts.parseType(n,t.pid)&&(r=Zt.ts.parsePesType(n,t.table),s=Zt.ts.parsePayloadUnitStartIndicator(n),"video"===r)&&s&&(a=Zt.ts.parsePesTime(n))&&(a.type="video",i.video.push(a),p=!0),p)break;h-=188,c-=188}else h--,c--};class ni{constructor(e,t){this.options=t||{},this.self=e,this.init()}init(){var e,t;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Lt(this.options),e=this.self,(t=this.transmuxer).on("data",(function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength},i=t.data,t.data=i.buffer,e.postMessage({action:"data",segment:t,byteOffset:i.byteOffset,byteLength:i.byteLength},[t.data])})),t.on("done",(function(t){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){var i={start:{decode:de.videoTsToSeconds(t.start.dts),presentation:de.videoTsToSeconds(t.start.pts)},end:{decode:de.videoTsToSeconds(t.end.dts),presentation:de.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:de.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=de.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})})),t.on("audioSegmentTimingInfo",(function(t){var i={start:{decode:de.videoTsToSeconds(t.start.dts),presentation:de.videoTsToSeconds(t.start.pts)},end:{decode:de.videoTsToSeconds(t.end.dts),presentation:de.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:de.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=de.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:i})})),t.on("id3Frame",(function(t){e.postMessage({action:"id3Frame",id3Frame:t})})),t.on("caption",(function(t){e.postMessage({action:"caption",caption:t})})),t.on("trackinfo",(function(t){e.postMessage({action:"trackinfo",trackInfo:t})})),t.on("audioTimingInfo",(function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:de.videoTsToSeconds(t.start),end:de.videoTsToSeconds(t.end)}})})),t.on("videoTimingInfo",(function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:de.videoTsToSeconds(t.start),end:de.videoTsToSeconds(t.end)}})})),t.on("log",(function(t){e.postMessage({action:"log",log:t})}))}pushMp4Captions(e){this.captionParser||(this.captionParser=new Vt,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);e=this.captionParser.parse(t,e.trackIds,e.timescales),this.self.postMessage({action:"mp4Captions",captions:e&&e.captions||[],logs:e&&e.logs||[],data:t.buffer},[t.buffer])}probeMp4StartTime({timescales:e,data:t}){e=function(e,t){return t=zt(t,["moof","traf"]).reduce((function(t,i){var n=zt(i,["tfhd"])[0],r=(n=$t(n[4]<<24|n[5]<<16|n[6]<<8|n[7]),n=e[n]||9e4,i=zt(i,["tfdt"])[0],new DataView(i.buffer,i.byteOffset,i.byteLength));let s;return"bigint"==typeof(i=1===i[0]?Xt(i.subarray(4,12)):r.getUint32(4))?s=i/Kt.BigInt(n):"number"!=typeof i||isNaN(i)||(s=i/n),(s=s<Number.MAX_SAFE_INTEGER?Number(s):s)<t?s:t}),1/0),"bigint"==typeof t||isFinite(t)?t:0}(e,t),this.self.postMessage({action:"probeMp4StartTime",startTime:e,data:t},[t.buffer])}probeMp4Tracks({data:e}){var t=function(e){e=zt(e,["moov","trak"]);var t=[];return e.forEach((function(e){var i,n,r={},s=((n=zt(e,["tkhd"])[0])&&(s=(n=new DataView(n.buffer,n.byteOffset,n.byteLength)).getUint8(0),r.id=0===s?n.getUint32(12):n.getUint32(20)),(s=zt(e,["mdia","hdlr"])[0])&&(n=Gt(s.subarray(8,12)),r.type="vide"===n?"video":"soun"===n?"audio":n),zt(e,["mdia","minf","stbl","stsd"])[0]);s&&(n=s.subarray(8),r.codec=Gt(n.subarray(4,8)),s=zt(n,[r.codec])[0])&&(/^[asm]vc[1-9]$/i.test(r.codec)?(i=s.subarray(78),"avcC"===Gt(i.subarray(4,8))&&11<i.length?(r.codec+=".",r.codec+=Wt(i[9]),r.codec+=Wt(i[10]),r.codec+=Wt(i[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(i=s.subarray(28),"esds"===Gt(i.subarray(4,8))&&20<i.length&&0!==i[19]?(r.codec+="."+Wt(i[19]),r.codec+="."+Wt(i[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase()),(n=zt(e,["mdia","mdhd"])[0])&&(r.timescale=function(e){var t=0===e[0]?12:20;return $t(e[t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])}(n)),t.push(r)})),t}(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeTs({data:e,baseStartTime:t}){let i=null;(t=function(e,t){var i,n,r;return e=(Zt.aac.isLikelyAacData(e)?function(e){for(var t,i,n=!1,r=0,s=null,a=null,o=0,l=0;3<=e.length-l;){switch(Zt.aac.parseType(e,l)){case"timed-metadata":e.length-l<10||(o=Zt.aac.parseId3TagSize(e,l))>e.length?n=!0:(null===a&&(t=e.subarray(l,l+o),a=Zt.aac.parseAacTimestamp(t)),l+=o);break;case"audio":e.length-l<7||(o=Zt.aac.parseAdtsSize(e,l))>e.length?n=!0:(null===s&&(t=e.subarray(l,l+o),s=Zt.aac.parseSampleRate(t)),r++,l+=o);break;default:l++}if(n)return null}return null===s||null===a?null:{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*r*(i=ei/s),pts:a+1024*r*i}]}}:function(e){var t,i={pid:null,table:null},n={};for(t in function(e,t){for(var i,n=0,r=188;r<e.byteLength;)if(71===e[n]&&71===e[r]){switch(i=e.subarray(n,r),Zt.ts.parseType(i,t.pid)){case"pat":t.pid=Zt.ts.parsePat(i);break;case"pmt":var s=Zt.ts.parsePmt(i);t.table=t.table||{},Object.keys(s).forEach((function(e){t.table[e]=s[e]}))}n+=188,r+=188}else n++,r++}(e,i),i.table)if(i.table.hasOwnProperty(t))switch(i.table[t]){case Yt.H264_STREAM_TYPE:n.video=[],ii(e,i,n),0===n.video.length&&delete n.video;break;case Yt.ADTS_STREAM_TYPE:n.audio=[],ti(e,i,n),0===n.audio.length&&delete n.audio}return n})(e),e&&(e.audio||e.video)?((i=e).audio&&i.audio.length&&(void 0!==(n=t)&&!isNaN(n)||(n=i.audio[0].dts),i.audio.forEach((function(e){e.dts=Jt(e.dts,n),e.pts=Jt(e.pts,n),e.dtsTime=e.dts/ei,e.ptsTime=e.pts/ei}))),i.video&&i.video.length&&(void 0!==(r=t)&&!isNaN(r)||(r=i.video[0].dts),i.video.forEach((function(e){e.dts=Jt(e.dts,r),e.pts=Jt(e.pts,r),e.dtsTime=e.dts/ei,e.ptsTime=e.pts/ei})),i.firstKeyFrame)&&((t=i.firstKeyFrame).dts=Jt(t.dts,r),t.pts=Jt(t.pts,r),t.dtsTime=t.dts/ei,t.ptsTime=t.pts/ei),e):null}(e,t="number"!=typeof t||isNaN(t)?void 0:t*de.ONE_SECOND_IN_TS))&&((i={hasVideo:t.video&&2===t.video.length||!1,hasAudio:t.audio&&2===t.audio.length||!1}).hasVideo&&(i.videoStart=t.video[0].ptsTime),i.hasAudio)&&(i.audioStart=t.audio[0].ptsTime),this.self.postMessage({action:"probeTs",result:i,data:e},[e.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(e){e=new Uint8Array(e.data,e.byteOffset,e.byteLength),this.transmuxer.push(e)}reset(){this.transmuxer.reset()}setTimestampOffset(e){e=e.timestampOffset||0,this.transmuxer.setBaseMediaDecodeTime(Math.round(de.secondsToVideoTs(e)))}setAudioAppendStart(e){this.transmuxer.setAudioAppendStart(Math.ceil(de.secondsToVideoTs(e.appendStart)))}setRemux(e){this.transmuxer.setRemux(e.remux)}flush(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new ni(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new ni(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}}))));const iu=e=>{const{transmuxer:t,bytes:i,audioAppendStart:n,gopsToAlignWith:r,remux:s,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:u,onVideoSegmentTimingInfo:d,onAudioSegmentTimingInfo:h,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:f,onTransmuxerLog:g,isEndOfTimeline:y}=e,_={buffer:[]};let v=y;var b,T;t.onmessage=i=>{t.currentTransmux!==e||("data"===i.data.action&&((e,t,i)=>{var{type:n,initSegment:r,captions:s,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:u}=e.data.segment,s=(t.buffer.push({captions:s,captionStreams:a,metadata:o}),t=e.data.segment.boxes||{data:e.data.segment.data},{type:n,data:new Uint8Array(t.data,t.data.byteOffset,t.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)});void 0!==l&&(s.videoFrameDtsTime=l),void 0!==u&&(s.videoFramePtsTime=u),i(s)})(i,_,a),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&((e,t)=>{t.gopInfo=e.data.gopInfo})(i,_),"audioTimingInfo"===i.data.action&&l(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&u(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&d(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&h(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&c([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(v=!1,f()),"log"===i.data.action&&g(i.data.log),"transmuxed"!==i.data.type)||v||(t.onmessage=null,(({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)})({transmuxedData:_,callback:m}),nu(t))},n&&t.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==s&&t.postMessage({action:"setRemux",remux:s}),i.byteLength&&(b=i instanceof ArrayBuffer?i:i.buffer,T=i instanceof ArrayBuffer?0:i.byteOffset,t.postMessage({action:"push",data:b,byteOffset:T,byteLength:i.byteLength},[b])),y&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},nu=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():iu(e.currentTransmux))},ru=(e,t)=>{e.postMessage({action:t}),nu(e)};var su=e=>{((e,t)=>{t.currentTransmux?t.transmuxQueue.push(ru.bind(null,t,e)):(t.currentTransmux=e,ru(t,e))})("reset",e)};function au(e){const t=e.transmuxer,i=e.endAction||e.action,n=e.callback;var r,s=Vt({},e,{endAction:null,transmuxer:null,callback:null});const a=r=>{r.data.action===i&&(t.removeEventListener("message",a),r.data.data&&(r.data.data=new Uint8Array(r.data.data,e.byteOffset||0,e.byteLength||r.data.data.byteLength),e.data)&&(e.data=r.data.data),n(r.data))};t.addEventListener("message",a),e.data?(r=e.data instanceof ArrayBuffer,s.byteOffset=r?0:e.data.byteOffset,s.byteLength=e.data.byteLength,r=[r?e.data:e.data.buffer],t.postMessage(s,r)):t.postMessage(s)}function ou(e){let t=0;return e.audio&&t++,e.video&&t++,t}function lu(e,t){var i=t.attributes||{},n=Tu(function(e){if((e=e.attributes||{}).CODECS)return Kr(e.CODECS)}(t)||[]);return!bu(e,t)||n.audio||((e,t)=>{if(!bu(e,t))return!0;t=t.attributes||{};var i=e.mediaGroups.AUDIO[t.AUDIO];for(const e in i)if(!i[e].uri&&!i[e].playlists)return!0;return!1})(e,t)||(t=Tu(function(e,t){if(e.mediaGroups.AUDIO&&t){var i=e.mediaGroups.AUDIO[t];if(i)for(var n in i)if((n=i[n]).default&&n.playlists)return Kr(n.playlists[0].attributes.CODECS)}return null}(e,i.AUDIO)||[])).audio&&(n.audio=t.audio),n}function uu(e,t){return(e=e&&window.getComputedStyle(e))?e[t]:""}function du(e,t){let i,n;return i=(i=e.attributes.BANDWIDTH?e.attributes.BANDWIDTH:i)||window.Number.MAX_VALUE,n=(n=t.attributes.BANDWIDTH?t.attributes.BANDWIDTH:n)||window.Number.MAX_VALUE,i-n}const hu=-101,cu=-102,pu=e=>{e.forEach((e=>{e.abort()}))},mu=(e,t)=>t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:hu,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:cu,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:2,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:2,xhr:t}:null,fu=(e,t,i)=>(n,r)=>{var s=r.response;if(n=mu(n,r))return i(n,e);if(16!==s.byteLength)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:2,xhr:r},e);n=new DataView(s);var a=new Uint32Array([n.getUint32(0),n.getUint32(4),n.getUint32(8),n.getUint32(12)]);for(let e=0;e<t.length;e++)t[e].bytes=a;return i(null,e)},gu=(e,t)=>{var i,n=Co(e.map.bytes);if("mp4"!==n)return i=e.map.resolvedUri||e.map.uri,t({internal:!0,message:`Found unsupported ${n||"unknown"} container for initialization segment at URL: `+i,code:2});au({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:i,data:n})=>(e.map.bytes=n,i.forEach((function(t){e.map.tracks=e.map.tracks||{},e.map.tracks[t.type]||"number"==typeof(e.map.tracks[t.type]=t).id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale)})),t(null))})},yu=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{let p=new Uint8Array(t);if(0<So(p,["moof"]).length){e.isFmp4=!0;const r=e.map.tracks,s={isFmp4:!0,hasVideo:!!r.video,hasAudio:!!r.audio},a=(r.audio&&r.audio.codec&&"enca"!==r.audio.codec&&(s.audioCodec=r.audio.codec),r.video&&r.video.codec&&"encv"!==r.video.codec&&(s.videoCodec=r.video.codec),r.video&&r.audio&&(s.isMuxed=!0),i(e,s),t=>{d(e,{data:p,type:s.hasAudio&&!s.isMuxed?"audio":"video"}),t&&t.length&&o(e,t),h(null,e,{})});au({action:"probeMp4StartTime",timescales:e.map.timescales,data:p,transmuxer:e.transmuxer,callback:({data:i,startTime:o})=>{t=i.buffer,e.bytes=p=i,s.hasAudio&&!s.isMuxed&&n(e,"audio","start",o),s.hasVideo&&n(e,"video","start",o),r.video&&i.byteLength&&e.transmuxer?au({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:p,timescales:e.map.timescales,trackIds:[r.video.id],callback:i=>{t=i.data.buffer,e.bytes=p=i.data,i.logs.forEach((function(e){c(zo(e,{stream:"mp4CaptionParser"}))})),a(i.captions)}}):a()}})}else e.transmuxer?(void 0===e.container&&(e.container=Co(p)),"ts"!==e.container&&"aac"!==e.container?(i(e,{hasAudio:!1,hasVideo:!1}),h(null,e,{})):(({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{var p=e.map&&e.map.tracks||{};const m=Boolean(p.audio&&p.video);let f=n.bind(null,e,"audio","start");const g=n.bind(null,e,"audio","end");let y=n.bind(null,e,"video","start");const _=n.bind(null,e,"video","end");au({action:"probeTs",transmuxer:e.transmuxer,data:t,baseStartTime:e.baseStartTime,callback:n=>{e.bytes=t=n.data,(n=n.result)&&(i(e,{hasAudio:n.hasAudio,hasVideo:n.hasVideo,isMuxed:m}),i=null,n.hasAudio&&!m&&f(n.audioStart),n.hasVideo&&y(n.videoStart),f=null,y=null),(e=>{e.transmuxer.currentTransmux?e.transmuxer.transmuxQueue.push(e):(e.transmuxer.currentTransmux=e,iu(e))})({bytes:t,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,remux:m,onData:t=>{t.type="combined"===t.type?"video":t.type,d(e,t)},onTrackInfo:t=>{i&&(m&&(t.isMuxed=!0),i(e,t))},onAudioTimingInfo:e=>{f&&void 0!==e.start&&(f(e.start),f=null),g&&void 0!==e.end&&g(e.end)},onVideoTimingInfo:e=>{y&&void 0!==e.start&&(y(e.start),y=null),_&&void 0!==e.end&&_(e.end)},onVideoSegmentTimingInfo:e=>{r(e)},onAudioSegmentTimingInfo:e=>{s(e)},onId3:(t,i)=>{a(e,t,i)},onCaptions:t=>{o(e,[t])},isEndOfTimeline:l,onEndedTimeline:()=>{u()},onTransmuxerLog:c,onDone:t=>{h&&(t.type="combined"===t.type?"video":t.type,h(null,e,t))}})}})})({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})):h(null,e,{})},_u=function({id:e,key:t,encryptedBytes:i,decryptionWorker:n},r){const s=t=>{t.data.source===e&&(n.removeEventListener("message",s),t=t.data.decrypted,r(new Uint8Array(t.bytes,t.byteOffset,t.byteLength)))};let a;n.addEventListener("message",s),a=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),n.postMessage(jl({source:e,encrypted:i,key:a,iv:t.iv}),[i.buffer,a.buffer])},vu=Wo("CodecUtils"),bu=(e,t)=>(t=t.attributes||{},e&&e.mediaGroups&&e.mediaGroups.AUDIO&&t.AUDIO&&e.mediaGroups.AUDIO[t.AUDIO]),Tu=function(e){const t={};return e.forEach((({mediaType:e,type:i,details:n})=>{t[e]=t[e]||[],t[e].push(Xr(""+i+n))})),Object.keys(t).forEach((function(e){1<t[e].length?(vu(`multiple ${e} codecs found as attributes: ${t[e].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),t[e]=null):t[e]=t[e][0]})),t},Su=Wo("PlaylistSelector"),wu=function(e){var t;if(e&&e.playlist)return t=e.playlist,JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})},Eu=function(e,t){const i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))};function ku(e,t,i,n,r,s){if(e){var a={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:r};let u=e.playlists,d=(bl.isAudioOnly(e)&&(u=s.getAudioTrackPlaylists_(),a.audioOnly=!0),u.map((e=>{var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||window.Number.MAX_VALUE,width:t,height:i,playlist:e}}))),h=(Eu(d,((e,t)=>e.bandwidth-t.bandwidth)),(d=d.filter((e=>!bl.isIncompatible(e.playlist)))).filter((e=>bl.isEnabled(e.playlist)))),c=(e=(h=h.length?h:d.filter((e=>!bl.isDisabled(e.playlist)))).filter((e=>e.bandwidth*Ql.BANDWIDTH_VARIANCE<t)))[e.length-1];var o=e.filter((e=>e.bandwidth===c.bandwidth))[0];if(!1===r){const e=o||h[0]||d[0];if(e&&e.playlist){let t=o?"bandwidthBestRep":"sortedPlaylistReps";return h[0]&&(t="enabledPlaylistReps"),Su(`choosing ${wu(e)} using ${t} with options`,a),e.playlist}}else{var l;let t,u,p;r=e.filter((e=>e.width&&e.height)),Eu(r,((e,t)=>e.width-t.width)),e=r.filter((e=>e.width===i&&e.height===n)),c=e[e.length-1],(e=e.filter((e=>e.bandwidth===c.bandwidth))[0])||(l=(t=r.filter((e=>e.width>i||e.height>n))).filter((e=>e.width===t[0].width&&e.height===t[0].height)),c=l[l.length-1],u=l.filter((e=>e.bandwidth===c.bandwidth))[0]),s.leastPixelDiffSelector&&(l=r.map((e=>(e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e))),Eu(l,((e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff)),p=l[0]);const m=p||u||e||o||h[0]||d[0];if(m&&m.playlist){let t="sortedPlaylistReps";return p?t="leastPixelDiffRep":u?t="resolutionPlusOneRep":e?t="resolutionBestRep":o?t="bandwidthBestRep":h[0]&&(t="enabledPlaylistReps"),Su(`choosing ${wu(m)} using ${t} with options`,a),m.playlist}}return Su("could not choose a playlist with options",a),null}}function Cu(){var e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return ku(this.playlists.main,this.systemBandwidth,parseInt(uu(this.tech_.el(),"width"),10)*e,parseInt(uu(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)}function xu(e,t,i){let n;var r;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime>=e&&r.endTime<=t&&i.removeCue(r)}const Iu=e=>"number"==typeof e&&isFinite(e),Au=e=>{var{startOfSegment:t,duration:i,segment:n,part:r,playlist:{mediaSequence:s,id:a,segments:o=[]},mediaIndex:l,partIndex:u,timeline:d}=e,o=o.length-1;let h="mediaIndex/partIndex increment";e.getMediaInfoForTime?h=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(h="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(h+=" with independent "+e.independent);var c="number"==typeof u,p=(e=e.segment.uri?"segment":"pre-segment",c?ll({preloadSegment:n})-1:0);return e+` [${s+l}/${s+o}]`+(c?` part [${u}/${p}]`:"")+` segment start/end [${n.start} => ${n.end}]`+(c?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${d}]`+` selected by [${h}]`+` playlist [${a}]`},Ou=e=>e+"TimingInfo",Pu=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:n,audioDisabled:r})=>!(t===i||("audio"===n?(t=e.lastTimelineChange({type:"main"}))&&t.to===i:"main"!==n||!r||(t=e.pendingTimelineChange({type:"audio"}))&&t.to===i)),Lu=({segmentDuration:e,maxDuration:t})=>!!e&&Math.round(e)>t+el;class Du extends xr.EventTarget{constructor(e,t=0){if(super(),!e)throw new TypeError("Initialization settings are required");if("function"!=typeof e.currentTime)throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=11<=xr.browser.IE_VERSION,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",(()=>{this.isEndOfStream_()||(this.ended_=!1)})),this.fetchAtBuffer_=!1,this.logger_=Wo(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",(()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",(()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}))}createTransmuxer_(){return(e=>{const t=new tu,i=(t.currentTransmux=null,t.transmuxQueue=[],t.terminate);return t.terminate=()=>(t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)),t.postMessage({action:"init",options:e}),t})({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){"WAITING"!==this.state?this.pendingSegment_&&(this.pendingSegment_=null):(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_())}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,window.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}error(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&su(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Go();if("main"===this.loaderType_){var{hasAudio:e,hasVideo:t,isMuxed:i}=e;if(t&&e&&!this.audioDisabled_&&!i)return this.sourceUpdater_.buffered();if(t)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;var i=Bl(e);let n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e}segmentKey(e,t=!1){if(!e)return null;var i=Fl(e);let n=this.keyCache_[i];return this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes}),t={resolvedUri:(n||e).resolvedUri},n&&(t.bytes=n.bytes),t}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(e){var i,n=this.playlist_,r=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_)&&this.syncController_.setDateTimeMappingForStart(e);let s=null;if(n&&(n.id?s=n.id:n.uri&&(s=n.uri)),this.logger_(`playlist update [${s} => ${e.id||e.uri}]`),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();n&&n.uri===e.uri?(t=e.mediaSequence-n.mediaSequence,this.logger_(`live window shift [${t}]`),null!==this.mediaIndex&&(this.mediaIndex-=t,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(i=this.playlist_.segments[this.mediaIndex],!this.partIndex||i.parts&&i.parts.length&&i.parts[this.partIndex]||(i=this.mediaIndex,this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=i))),r&&(r.mediaIndex-=t,r.mediaIndex<0?(r.mediaIndex=null,r.partIndex=null):(0<=r.mediaIndex&&(r.segment=e.segments[r.mediaIndex]),0<=r.partIndex&&r.segment.parts&&(r.part=r.segment.parts[r.partIndex]))),this.syncController_.saveExpiredSegmentInfo(n,e)):(null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate"))}}pause(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return null===this.checkBufferTimeout_}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&su(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},n=!1){if((t=t===1/0?this.duration_():t)<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){let s=1;var r=()=>{0==--s&&i()};!n&&this.audioDisabled_||(s++,this.sourceUpdater_.removeAudio(e,t,r)),!n&&"main"!==this.loaderType_||(this.gopBuffer_=((e,t,i,n)=>{var r=Math.ceil((t-n)*Ho),s=Math.ceil((i-n)*Ho);t=e.slice();let a=e.length;for(;a--&&!(e[a].pts<=s););if(-1!==a){let i=a+1;for(;i--&&!(e[i].pts<=r););i=Math.max(i,0),t.splice(i,a-i+1)}return t})(this.gopBuffer_,e,t,this.timeMapping_),s++,this.sourceUpdater_.removeVideo(e,t,r));for(const i in this.inbandTextTracks_)xu(e,t,this.inbandTextTracks_[i]);xu(e,t,this.segmentMetadataTrack_),r()}else this.logger_("skipping remove because no source updater or starting media info")}monitorBuffer_(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)}fillBuffer_(){var e;this.sourceUpdater_.updating()||(e=this.chooseNextRequest_())&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){var n;return!(!t||!this.mediaSource_)&&(n="number"==typeof e&&t.segments[e],e=e+1===t.segments.length,i=!n||!n.parts||i+1===n.parts.length,t.endList)&&"open"===this.mediaSource_.readyState&&e&&i}chooseNextRequest_(){var e,t=Qo(i=this.buffered_())||0,i=Yo(i,this.currentTime_()),n=!this.hasPlayed_()&&1<=i,r=i>=this.goalBufferLength_(),s=this.playlist_.segments;if(!s.length||n||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()),(n={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)}).isSyncRequest?n.mediaIndex=function(e,t,i){t=t||[];var n=[];let r=0;for(let a=0;a<t.length;a++){var s=t[a];if(e===s.timeline&&(n.push(a),(r+=s.duration)>i))return a}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,s,t):null!==this.mediaIndex?(r=s[this.mediaIndex],e="number"==typeof this.partIndex?this.partIndex:-1,n.startOfSegment=r.end||t,r.parts&&r.parts[e+1]?(n.mediaIndex=this.mediaIndex,n.partIndex=e+1):n.mediaIndex=this.mediaIndex+1):(({segmentIndex:r,startTime:e,partIndex:o}=bl.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time})),n.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),n.mediaIndex=r,n.startOfSegment=e,n.partIndex=o);let a=(t=s[n.mediaIndex])&&"number"==typeof n.partIndex&&t.parts&&t.parts[n.partIndex];if(!t||"number"==typeof n.partIndex&&!a)return null;"number"!=typeof n.partIndex&&t.parts&&(n.partIndex=0,a=t.parts[0]),i||!a||a.independent||(0===n.partIndex?(e=(r=s[n.mediaIndex-1]).parts&&r.parts.length&&r.parts[r.parts.length-1])&&e.independent&&(--n.mediaIndex,n.partIndex=r.parts.length-1,n.independent="previous segment"):t.parts[n.partIndex-1].independent&&(--n.partIndex,n.independent="previous part"));var o=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return n.mediaIndex>=s.length-1&&o&&!this.seeking_()?null:this.generateSegmentInfo_(n)}generateSegmentInfo_(e){var t,{independent:e,playlist:i,mediaIndex:n,startOfSegment:r,isSyncRequest:t,partIndex:s,forceTimestampOffset:a,getMediaInfoForTime:o}=e,l=i.segments[n],u="number"==typeof s&&l.parts[s],n={requestId:"segment-loader-"+Math.random(),uri:u&&u.resolvedUri||l.resolvedUri,mediaIndex:n,partIndex:u?s:null,isSyncRequest:t,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:u&&u.duration||l.duration,segment:l,part:u,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o,independent:e},s=void 0!==a?a:this.isPendingTimestampOffset_;return"number"==(n.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:s}),typeof(t=Qo(this.sourceUpdater_.audioBuffered())))&&(n.audioAppendStart=t-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(n.gopsToAlignWith=((e,t,i)=>{if(null==t||!e.length)return[];var n=Math.ceil((t-i+3)*Ho);let r;for(r=0;r<e.length&&!(e[r].pts>n);r++);return e.slice(r)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),n}timestampOffsetForSegment_(e){return({segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:n,overrideCheck:r}=[e][0]),r||e!==t?e<t||!n.length?i:n.end(n.length-1):null;var t,i,n,r}earlyAbortWhenNeeded_(e){if(!this.vhs_.tech_.paused()&&this.xhrOptions_.timeout&&this.playlist_.attributes.BANDWIDTH&&!(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)){var t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=(e=bl.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),[r,s,a=1]=[this.buffered_(),t,this.vhs_.tech_.playbackRate()],((r.length?r.end(r.length-1):0)-s)/a-1);if(!(e<=r)){var s=function(e){const{main:t,currentTime:i,bandwidth:n,duration:r,segmentDuration:s,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=e;let u=(e=t.playlists.filter((e=>!bl.isIncompatible(e)))).filter(bl.isEnabled);e=(u=u.length?u:e.filter((e=>!bl.isDisabled(e)))).filter(bl.hasAttribute.bind(null,"BANDWIDTH")).map((e=>{var t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:bl.estimateSegmentRequestTime(s,n,e)*t-a}}));var d=e.filter((e=>e.rebufferingImpact<=0));return Eu(d,((e,t)=>du(t.playlist,e.playlist))),d.length?d[0]:(Eu(e,((e,t)=>e.rebufferingImpact-t.rebufferingImpact)),e[0]||null)}({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var a=e-r-s.rebufferingImpact;let t=.5;r<=el&&(t=1),!s.playlist||s.playlist.uri===this.playlist_.uri||a<t||(this.bandwidth=s.playlist.attributes.BANDWIDTH*Ql.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}}}}handleAbort_(e){this.logger_("Aborting "+Au(e)),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")}handleTrackInfo_(e,t){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e!==t){var i=Object.keys(e).sort(),n=Object.keys(t).sort();if(i.length!==n.length)return!1;for(let s=0;s<i.length;s++){var r=i[s];if(r!==n[s])return!1;if(e[r]!==t[r])return!1}}return!0}(this.currentMediaInfo_,t=t||{})||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),this.checkForAbort_(e.requestId))||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()&&this.processCallQueue_())}handleTimingInfo_(e,t,i,n){var r;this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||((e=this.pendingSegment_)[r=Ou(t)]=e[r]||{},e[r][i]=n,this.logger_(`timinginfo: ${t} - ${i} - `+n),this.hasEnoughInfoToAppend_()&&this.processCallQueue_())}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(0===t.length)this.logger_("SegmentLoader received no captions from a caption event");else if(this.pendingSegment_.hasAppendedData_){const e=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),i={};t.forEach((t=>{i[t.stream]=i[t.stream]||{startTime:1/0,captions:[],endTime:0};var n=i[t.stream];n.startTime=Math.min(n.startTime,t.startTime+e),n.endTime=Math.max(n.endTime,t.endTime+e),n.captions.push(t)})),Object.keys(i).forEach((t=>{var{startTime:n,endTime:r,captions:s}=i[t],a=this.inbandTextTracks_,o=(this.logger_(`adding cues from ${n} -> ${r} for `+t),a),l=this.vhs_.tech_,u=t;if(!o[u]){l.trigger({type:"usage",name:"vhs-608"});let e=u;var d;if(/^cc708_/.test(u)&&(e="SERVICE"+u.split("_")[1]),d=l.textTracks().getTrackById(e))o[u]=d;else{let t=u,i=u,n=!1;(d=(l.options_.vhs&&l.options_.vhs.captionServices||{})[e])&&(t=d.label,i=d.language,n=d.default),o[u]=l.addRemoteTextTrack({kind:"captions",id:e,default:n,label:t,language:i},!1).track}}xu(n,r,a[t]);var{inbandTextTracks:h,captionArray:d,timestampOffset:c}={captionArray:s,inbandTextTracks:a,timestampOffset:e};if(d){const e=window.WebKitDataCue||window.VTTCue;d.forEach((t=>{var i=t.stream;h[i].addCue(new e(t.startTime+c,t.endTime+c,t.text))}))}})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t))}handleId3_(e,t,i){var n,r,s,a;this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?(n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r=this.inbandTextTracks_,s=i,a=this.vhs_.tech_,r.metadataTrack_||(r.metadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,r.metadataTrack_.inBandMetadataTrackDispatchType=s),(({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:n})=>{if(t){const a=window.WebKitDataCue||window.VTTCue,o=e.metadataTrack_;if(o&&(t.forEach((e=>{const t=e.cueTime+i;!("number"!=typeof t||window.isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((e=>{var i,n=new a(t,t,e.value||e.url||e.data||"");n.frame=e,n.value=e,i=n,Object.defineProperties(i.frame,{id:{get:()=>(xr.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),i.value.key)},value:{get:()=>(xr.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),i.value.data)},privateData:{get:()=>(xr.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),i.value.data)}}),o.addCue(n)}))})),o.cues)&&o.cues.length){var r=o.cues,s=[];for(let e=0;e<r.length;e++)r[e]&&s.push(r[e]);const e=s.reduce(((e,t)=>{var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),t=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));t.forEach(((i,r)=>{i=e[i];const s=Number(t[r+1])||n;i.forEach((e=>{e.endTime=s}))}))}}})({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:this.duration_()})):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))}processMetadataQueue_(){this.metadataQueue_.id3.forEach((e=>e())),this.metadataQueue_.caption.forEach((e=>e())),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){var e=this.callQueue_;this.callQueue_=[],e.forEach((e=>e()))}processLoadQueue_(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach((e=>e()))}hasEnoughInfoToLoad_(){var e;return"audio"!==this.loaderType_||!(!(e=this.pendingSegment_)||this.getCurrentMediaInfo_()&&Pu({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){var e,t,i,n;return!!this.sourceUpdater_.ready()&&!(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_||(e=this.pendingSegment_,t=this.getCurrentMediaInfo_(),!e)||!t||(({hasAudio:t,hasVideo:i,isMuxed:n}=t),i&&!e.videoTimingInfo)||t&&!this.audioDisabled_&&!n&&!e.audioTimingInfo||Pu({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())this.callQueue_.push(this.handleData_.bind(this,e,t));else{var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[Ou(t.type)].start;else{let t;e=this.getCurrentMediaInfo_(),(e="main"===this.loaderType_&&e&&e.hasVideo)&&(t=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:e,firstVideoFrameTimeForData:t,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){if(this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_}),(e=this.chooseNextRequest_()).mediaIndex!==i.mediaIndex||e.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}}updateAppendInitSegmentStatus(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:n}){if(i){var r=Bl(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=n,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},n){var r=this.sourceUpdater_.audioBuffered(),s=this.sourceUpdater_.videoBuffered(),a=(1<r.length&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+rl(r).join(", ")),1<s.length&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+rl(s).join(", ")),r.length?r.start(0):0),o=r.length?r.end(r.length-1):0,l=s.length?s.start(0):0,u=s.length?s.end(s.length-1):0;o-a<=1&&u-l<=1?(this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${rl(r).join(", ")}, video buffer: ${rl(s).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error")):(this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i})),o=this.currentTime_()-1,this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+o),this.remove(0,o,(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=window.setTimeout((()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()}),1e3)}),!0))}handleAppendError_({segmentInfo:e,type:t,bytes:i},n){n&&(22===n.code?this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}):(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",n),this.error(`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist `+e.playlist.id),this.trigger("appenderror")))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:n,bytes:r}){if(!r){var s=[n];let e=n.byteLength;i&&(s.unshift(i),e+=i.byteLength),r=(e=>{let t,i=0;return e.bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach((e=>{t.set(e,i),i+=e.byteLength}))),t})({bytes:e,segments:s})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){this.pendingSegment_&&t===this.pendingSegment_.requestId&&((t=this.pendingSegment_.segment)[e+="TimingInfo"]||(t[e]={}),t[e].transmuxerPrependedSeconds=i.prependedContentDuration||0,t[e].transmuxedPresentationStart=i.start.presentation,t[e].transmuxedDecodeStart=i.start.decode,t[e].transmuxedPresentationEnd=i.end.presentation,t[e].transmuxedDecodeEnd=i.end.decode,t[e].baseMediaDecodeTime=i.baseMediaDecodeTime)}appendData_(e,t){var{type:i,data:n}=t;n&&n.byteLength&&("audio"===i&&this.audioDisabled_||(t=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null}),this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:t,data:n})))}loadSegment_(e){this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((()=>{var t=Vt({},e,{forceTimestampOffset:!0});Vt(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)}))}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),n=null!==this.mediaIndex,r=e.timeline!==this.currentTimeline_&&0<e.timeline;i=i||n&&r,this.logger_("Requesting "+Au(e)),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=(({xhr:e,xhrOptions:t,decryptionWorker:i,segment:n,abortFn:r,progressFn:s,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:d,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:f,onTransmuxerLog:g})=>{const y=[];var _,v,b,T,S,w,E;i=(({activeXhrs:e,decryptionWorker:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{let p=0,m=!1;return(f,g)=>{if(!m){if(f)return m=!0,pu(e),h(f,g);if((p+=1)===e.length){const p=function(){if(g.encryptedBytes)return(({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})=>{_u({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e},(e=>{t.bytes=e,yu({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})}))})({decryptionWorker:t,segment:g,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c});yu({segment:g,bytes:g.bytes,trackInfoFn:i,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:u,dataFn:d,doneFn:h,onTransmuxerLog:c})};if(g.endOfAllRequests=Date.now(),g.map&&g.map.encryptedBytes&&!g.map.bytes)return _u({decryptionWorker:t,id:g.requestId+"-init",encryptedBytes:g.map.encryptedBytes,key:g.map.key},(t=>{g.map.bytes=t,gu(g,(t=>{if(t)return pu(e),h(t,g);p()}))}));p()}}}})({activeXhrs:y,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:u,id3Fn:d,captionsFn:h,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:f,onTransmuxerLog:g}),n.key&&!n.key.bytes&&(a=[n.key],n.map&&!n.map.bytes&&n.map.key&&n.map.key.resolvedUri===n.key.resolvedUri&&a.push(n.map.key),o=e(zo(t,{uri:n.key.resolvedUri,responseType:"arraybuffer"}),fu(n,a,i)),y.push(o)),n.map&&!n.map.bytes&&(!n.map.key||n.key&&n.key.resolvedUri===n.map.key.resolvedUri||(l=e(zo(t,{uri:n.map.key.resolvedUri,responseType:"arraybuffer"}),fu(n,[n.map.key],i)),y.push(l)),u=zo(t,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:Ml(n.map)}),({segment:_,finishProcessingFn:v}={segment:n,finishProcessingFn:i}),d=e(u,((e,t)=>(e=mu(e,t))?v(e,_):(e=new Uint8Array(t.response),_.map.key?(_.map.encryptedBytes=e,v(null,_)):(_.map.bytes=e,void gu(_,(function(e){if(e)return e.xhr=t,e.status=t.status,v(e,_);v(null,_)})))))),y.push(d)),h=zo(t,{uri:n.part&&n.part.resolvedUri||n.resolvedUri,responseType:"arraybuffer",headers:Ml(n)}),({segment:b,finishProcessingFn:T,responseType:S}={segment:n,finishProcessingFn:i,responseType:h.responseType}),c=e(h,((e,t)=>(e=mu(e,t))?T(e,b):(e="arraybuffer"!==S&&t.responseText?(e=>{var t=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t.buffer})(t.responseText.substring(b.lastReachedChar||0)):t.response,b.stats=(e=>({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}))(t),b.key?b.encryptedBytes=new Uint8Array(e):b.bytes=new Uint8Array(e),T(null,b)))),c.addEventListener("progress",(({segment:w,progressFn:E}={segment:n,progressFn:s}),e=>{if(!e.target.aborted)return w.stats=zo(w.stats,(e=>{var t=e.target;return(t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0}).bytesReceived=e.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t})(e)),!w.stats.firstBytesReceivedAt&&w.stats.bytesReceived&&(w.stats.firstBytesReceivedAt=Date.now()),E(e,w)})),y.push(c);const k={};return y.forEach((e=>{var t,i;e.addEventListener("loadend",(({loadendState:t,abortFn:i}={loadendState:k,abortFn:r}),e=>{e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}))})),()=>pu(y)})({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:i,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:t,level:i,stream:n})=>{this.logger_(Au(e)+` logged from transmuxer stream ${n} as a ${i}: `+t)}})}trimBackBuffer_(e){var t=((e,t,i)=>{let n=t-Ql.BACK_BUFFER_LENGTH;return e.length&&(n=Math.max(n,e.start(0))),Math.min(t-i,n)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0<t&&this.remove(0,t)}createSimplifiedSegmentObj_(e){var t=e.segment,i={resolvedUri:((i=e.part)||t).resolvedUri,byterange:(i||t).byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},n=e.playlist.segments[e.mediaIndex-1];return n&&n.timeline===t.timeline&&(n.videoTimingInfo?i.baseStartTime=n.videoTimingInfo.transmuxedDecodeEnd:n.audioTimingInfo&&(i.baseStartTime=n.audioTimingInfo.transmuxedDecodeEnd)),t.key&&(n=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]),i.key=this.segmentKey(t.key),i.key.iv=n),t.map&&(i.map=this.initSegmentForMap(t.map)),i}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e<1/60?this.logger_("Ignoring segment's bandwidth because its duration of "+e+" is less than the min to record "+1/60):(this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime)}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length)this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));else if(this.saveTransferStats_(t.stats),this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId){if(e)return this.pendingSegment_=null,this.state="READY",e.code===cu?void 0:(this.pause(),e.code===hu?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error")));e=this.pendingSegment_,this.saveBandwidthRelatedStats_(e.duration,t.stats),e.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=((e,t,i)=>{if(!t.length)return e;if(i)return t.slice();var n=t[0].pts;let r=0;for(;r<e.length&&!(e[r].pts>=n);r++);return e.slice(0,r).concat(t)})(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(e)}}setTimeMapping_(e){null!==(e=this.syncController_.mappingForTimeline(e))&&(this.timeMapping_=e)}updateMediaSecondsLoaded_(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:n,currentVideoTimestampOffset:r,useVideoTimingInfo:s,videoTimingInfo:a,audioTimingInfo:o}){return void 0!==e?e:s?(e=t.segments[i-1],0!==i&&e&&void 0!==e.start&&e.end===n+r?a.start:n):o.start}waitForAppendsToComplete_(e){var t,i,n=this.getCurrentMediaInfo_(e);n?(({hasAudio:n,hasVideo:i,isMuxed:t}=n),i="main"===this.loaderType_&&i,n=!this.audioDisabled_&&n&&!t,e.waitingOnAppends=0,e.hasAppendedData_?(i&&e.waitingOnAppends++,n&&e.waitingOnAppends++,i&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),n&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))):(e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e))):(this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error"))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){i=this.loaderType_,t=this.getCurrentMediaInfo_();var t,i="main"===i&&t&&e?e.hasAudio||e.hasVideo?t.hasVideo&&!e.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&e.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null;return!!i&&(this.error({message:i,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}updateSourceBufferTimestampOffset_(e){if(null!==e.timestampOffset&&"number"==typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&"number"==typeof e.transmuxedDecodeStart?e.transmuxedDecodeStart:t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_();(t="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo)&&(e.timingInfo.end="number"==typeof t.end?t.end:t.start+e.duration)}handleAppendsDone_(){var e,t,i;this.pendingSegment_&&this.trigger("appendsdone"),this.pendingSegment_?(e=this.pendingSegment_,this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_}),(t=((e,t)=>{var i,n,r;return"hls"===t&&(t=(e=>{let t=0;return["video","audio"].forEach((function(i){if(i=e[i+"TimingInfo"]){var{start:i,end:n}=i;let e;"bigint"==typeof i||"bigint"==typeof n?e=window.BigInt(n)-window.BigInt(i):"number"==typeof i&&"number"==typeof n&&(e=n-i),void 0!==e&&e>t&&(t=e)}})),t="bigint"==typeof t&&t<Number.MAX_SAFE_INTEGER?Number(t):t})({audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo}))&&(i=e.playlist.targetDuration,n=Lu({segmentDuration:t,maxDuration:2*i}),r=Lu({segmentDuration:t,maxDuration:i}),t=`Segment with index ${e.mediaIndex} from playlist ${e.playlist.id} has a duration of ${t} when the reported duration is ${e.duration} and the target duration is ${i}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`,n||r)?{severity:n?"warn":"info",message:t}:null})(e,this.sourceType_))&&("warn"===t.severity?xr.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)?this.logger_("Throwing away un-appended sync request "+Au(e)):(this.logger_("Appended "+Au(e)),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate"),t=e.segment,i=e.part,t=t.end&&this.currentTime_()-t.end>3*e.playlist.targetDuration,i=i&&i.end&&this.currentTime_()-i.end>3*e.playlist.partTargetDuration,t||i?(this.logger_(`bad ${t?"segment":"part"} `+Au(e)),this.resetEverything()):(null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()))):(this.state="READY",this.paused()||this.monitorBuffer_())}recordThroughput_(e){var t,i;e.duration<1/60?this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+1/60):(t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,e=Math.floor(e.byteLength/i*8*1e3),this.throughput.rate+=(e-t)/++this.throughput.count)}addSegmentMetadataCue_(e){var t,i,n,r;this.segmentMetadataTrack_&&(t=(r=e.segment).start,i=r.end,Iu(t))&&Iu(i)&&(xu(t,i,this.segmentMetadataTrack_),n=window.WebKitDataCue||window.VTTCue,r={custom:r.custom,dateTimeObject:r.dateTimeObject,dateTimeString:r.dateTimeString,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:t,end:i},(e=new n(t,i,JSON.stringify(r))).value=r,this.segmentMetadataTrack_.addCue(e))}}function Nu(){}function Mu(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toUpperCase()))}const Ru=["video","audio"],Uu=(e,t)=>{var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},ju=(e,t)=>{if(0!==t.queue.length){let i=0,n=t.queue[i];if("mediaSource"===n.type)t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),n.action(t),n.doneFn&&n.doneFn(),ju("audio",t),ju("video",t));else if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!Uu(e,t)){if(n.type!==e){if(null===(i=((e,t)=>{for(let n=0;n<t.length;n++){var i=t[n];if("mediaSource"===i.type)return null;if(i.type===e)return n}return null})(e,t.queue)))return;n=t.queue[i]}t.queue.splice(i,1),(t.queuePending[e]=n).action(e,t),n.doneFn||(t.queuePending[e]=null,ju(e,t))}}},Bu=(e,t)=>{var i=t[e+"Buffer"],n=Mu(e);i&&(i.removeEventListener("updateend",t[`on${n}UpdateEnd_`]),i.removeEventListener("error",t[`on${n}Error_`]),t.codecs[e]=null,t[e+"Buffer"]=null)},Fu=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),qu=(e,t,i)=>(n,r)=>{var s=r[n+"Buffer"];if(Fu(r.mediaSource,s)){r.logger_(`Appending segment ${t.mediaIndex}'s ${e.length} bytes to ${n}Buffer`);try{s.appendBuffer(e)}catch(s){r.logger_(`Error with code ${s.code} `+(22===s.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${t.mediaIndex} to ${n}Buffer`),r.queuePending[n]=null,i(s)}}},Hu=(e,t)=>(i,n)=>{var r=n[i+"Buffer"];if(Fu(n.mediaSource,r)){n.logger_(`Removing ${e} to ${t} from ${i}Buffer`);try{r.remove(e,t)}catch(r){n.logger_(`Remove ${e} to ${t} from ${i}Buffer failed`)}}},Vu=e=>(t,i)=>{var n=i[t+"Buffer"];Fu(i.mediaSource,n)&&(i.logger_(`Setting ${t}timestampOffset to `+e),n.timestampOffset=e)},$u=e=>(t,i)=>{e()},Wu=e=>t=>{if("open"===t.mediaSource.readyState){t.logger_(`Calling mediaSource endOfStream(${e||""})`);try{t.mediaSource.endOfStream(e)}catch(t){xr.log.warn("Failed to call media source endOfStream",t)}}},zu=e=>t=>{t.logger_("Setting mediaSource duration to "+e);try{t.mediaSource.duration=e}catch(t){xr.log.warn("Failed to set media source duration",t)}},Gu=(e,t)=>i=>{var n=Mu(e),r=Qr(t);(i.logger_(`Adding ${e}Buffer with codec ${t} to mediaSource`),r=i.mediaSource.addSourceBuffer(r)).addEventListener("updateend",i[`on${n}UpdateEnd_`]),r.addEventListener("error",i[`on${n}Error_`]),i.codecs[e]=t,i[e+"Buffer"]=r},Xu=e=>t=>{var i=t[e+"Buffer"];if(Bu(e,t),Fu(t.mediaSource,i)){t.logger_(`Removing ${e}Buffer with codec ${t.codecs[e]} from mediaSource`);try{t.mediaSource.removeSourceBuffer(i)}catch(t){xr.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,t)}}},Ku=e=>(t,i)=>{var n=i[t+"Buffer"],r=Qr(e);Fu(i.mediaSource,n)&&i.codecs[t]!==e&&(i.logger_(`changing ${t}Buffer codec from ${i.codecs[t]} to `+e),n.changeType(r),i.codecs[t]=e)},Qu=({type:e,sourceUpdater:t,action:i,doneFn:n,name:r})=>{t.queue.push({type:e,action:i,doneFn:n,name:r}),ju(e,t)},Yu=(e,t)=>i=>{var n;t.queuePending[e]&&(n=t.queuePending[e].doneFn,t.queuePending[e]=null,n)&&n(t[e+"Error_"]),ju(e,t)};class Ju extends xr.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>ju("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Wo("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Yu("video",this),this.onAudioUpdateEnd_=Yu("audio",this),this.onVideoError_=e=>{this.videoError_=e},this.onAudioError_=e=>{this.audioError_=e},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){Qu({type:"mediaSource",sourceUpdater:this,action:Gu(e,t),name:"addSourceBuffer"})}abort(e){Qu({type:e,sourceUpdater:this,action:(e,t)=>{if("open"===t.mediaSource.readyState){var i=t[e+"Buffer"];if(Fu(t.mediaSource,i)){t.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(t){xr.log.warn(`Failed to abort on ${e}Buffer`,t)}}}},name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?Qu({type:"mediaSource",sourceUpdater:this,action:Xu(e),name:"removeSourceBuffer"}):xr.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!xr.browser.IE_VERSION&&!xr.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&"function"==typeof window.MediaSource.prototype.removeSourceBuffer}static canChangeType(){return window.SourceBuffer&&window.SourceBuffer.prototype&&"function"==typeof window.SourceBuffer.prototype.changeType}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){this.canChangeType()?Qu({type:e,sourceUpdater:this,action:Ku(t),name:"changeType"}):xr.log.error("changeType is not supported!")}addOrChangeSourceBuffers(e){if(!e||"object"!=typeof e||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((t=>{var i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)}))}appendBuffer(e,t){var{segmentInfo:i,type:n,bytes:r}=e;this.processedAppend_=!0,"audio"===n&&this.videoBuffer&&!this.videoAppendQueued_?(this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`)):(Qu({type:n,sourceUpdater:this,action:qu(r,i||{mediaIndex:-1},e=t),doneFn:t,name:"appendBuffer"}),"video"===n&&(this.videoAppendQueued_=!0,this.delayedAudioAppendQueue_.length)&&(r=this.delayedAudioAppendQueue_.slice(),this.logger_(`queuing delayed audio ${r.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,r.forEach((e=>{this.appendBuffer.apply(this,e)}))))}audioBuffered(){return Fu(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered||Go()}videoBuffered(){return Fu(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered||Go()}buffered(){var e=Fu(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Fu(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;if(t&&!e)return this.audioBuffered();if(e&&!t)return this.videoBuffered();{var i=this.audioBuffered(),n=this.videoBuffered();let e=null,t=null,a=0;var r=[],s=[];if(!(i&&i.length&&n&&n.length))return Go();let o=i.length;for(;o--;)r.push({time:i.start(o),type:"start"}),r.push({time:i.end(o),type:"end"});for(o=n.length;o--;)r.push({time:n.start(o),type:"start"}),r.push({time:n.end(o),type:"end"});for(r.sort((function(e,t){return e.time-t.time})),o=0;o<r.length;o++)"start"===r[o].type?2==++a&&(e=r[o].time):"end"===r[o].type&&1==--a&&(t=r[o].time),null!==e&&null!==t&&(s.push([e,t]),e=null,t=null);return Go(s)}}setDuration(e,t=Nu){Qu({type:"mediaSource",sourceUpdater:this,action:zu(e),name:"duration",doneFn:t})}endOfStream(e=null,t=Nu){"string"!=typeof e&&(e=void 0),Qu({type:"mediaSource",sourceUpdater:this,action:Wu(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=Nu){this.audioBuffered().length&&0!==this.audioBuffered().end(0)?Qu({type:"audio",sourceUpdater:this,action:Hu(e,t),doneFn:i,name:"remove"}):i()}removeVideo(e,t,i=Nu){this.videoBuffered().length&&0!==this.videoBuffered().end(0)?Qu({type:"video",sourceUpdater:this,action:Hu(e,t),doneFn:i,name:"remove"}):i()}updating(){return!(!Uu("audio",this)&&!Uu("video",this))}audioTimestampOffset(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Qu({type:"audio",sourceUpdater:this,action:Vu(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(Qu({type:"video",sourceUpdater:this,action:Vu(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Qu({type:"audio",sourceUpdater:this,action:$u(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Qu({type:"video",sourceUpdater:this,action:$u(e),name:"callback"})}dispose(){this.trigger("dispose"),Ru.forEach((e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[e+"QueueCallback"]((()=>Bu(e,this)))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Zu=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),ed=new Uint8Array("\n\n".split("").map((e=>e.charCodeAt(0))));class td extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class id extends Du{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){var e;return this.subtitlesTrack_&&this.subtitlesTrack_.cues&&this.subtitlesTrack_.cues.length?Go([[(e=this.subtitlesTrack_.cues)[0].startTime,e[e.length-1].startTime]]):Go()}initSegmentForMap(e,t=!1){if(!e)return null;var i=Bl(e);let n=this.initSegments_[i];return t&&!n&&e.bytes&&(t=ed.byteLength+e.bytes.byteLength,(t=new Uint8Array(t)).set(e.bytes),t.set(ed,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}),n||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return void 0!==e&&(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_())&&this.init_(),this.subtitlesTrack_}remove(e,t){xu(e,t,this.subtitlesTrack_)}fillBuffer_(){var e=this.chooseNextRequest_();e&&(null===this.syncController_.timestampOffsetForTimeline(e.timeline)?(this.syncController_.one("timestampoffset",(()=>{this.state="READY",this.paused()||this.monitorBuffer_()})),this.state="WAITING_ON_TIMELINE"):this.loadSegment_(e))}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(this.subtitlesTrack_)if(this.saveTransferStats_(t.stats),this.pendingSegment_)if(e)e.code===hu&&this.handleTimeout_(),e.code===cu?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);else{var n=this.pendingSegment_,r=(this.saveBandwidthRelatedStats_(n.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending"),n.segment);if(r.map&&(r.map.bytes=t.map.bytes),n.bytes=t.bytes,"function"!=typeof window.WebVTT&&"function"==typeof this.loadVttJs)this.state="WAITING_ON_VTTJS",this.loadVttJs().then((()=>this.segmentRequestFinished_(e,t,i)),(()=>this.stopForError({message:"Error loading vtt.js"})));else{r.requested=!0;try{this.parseVTTCues_(n)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(n,this.syncController_.timelines[n.timeline],this.playlist_),n.cues.length?n.timingInfo={start:n.cues[0].startTime,end:n.cues[n.cues.length-1].endTime}:n.timingInfo={start:n.startOfSegment,end:n.startOfSegment+n.duration},n.isSyncRequest)this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";else{n.byteLength=n.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,n.cues.forEach((e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new window.VTTCue(e.startTime,e.endTime,e.text):e)}));var s=this.subtitlesTrack_,a=s.cues;if(a)for(let e=0;e<a.length;e++){var o=[];let t=0;for(let i=0;i<a.length;i++)a[e].startTime===a[i].startTime&&a[e].endTime===a[i].endTime&&a[e].text===a[i].text&&1<++t&&o.push(a[i]);o.length&&o.forEach((e=>s.removeCue(e)))}this.handleAppendsDone_()}}}else this.state="READY",this.mediaRequestsAborted+=1;else this.state="READY"}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t,i=!1;if("function"!=typeof window.WebVTT)throw new td;"function"==typeof window.TextDecoder?t=new window.TextDecoder("utf8"):(t=window.WebVTT.StringDecoder(),i=!0);var n=new window.WebVTT.Parser(window,window.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=t=>{e.timestampmap=t},n.onparsingerror=e=>{xr.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;i&&(t=Zu(t)),n.parse(t)}let r=e.bytes;i&&(r=Zu(r)),n.parse(r),n.flush()}updateTimeMapping_(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap;const s=r.MPEGTS/Ho-r.LOCAL+t.mapping;e.cues.forEach((e=>{e.startTime+=s,e.endTime+=s})),i.syncInfo||(r=e.cues[0].startTime,t=e.cues[e.cues.length-1].startTime,i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(r,t-n.duration)})}else n.empty=!0}}const nd=[{name:"VOD",run:(e,t,i,n,r)=>i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"ProgramDateTime",run:(e,t,i,n,r)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let s=null,a=null;var o=al(t);r=r||0;for(let i=0;i<o.length;i++){var l=o[t.endList||0===r?i:o.length-(i+1)],u=l.segment,d=e.timelineToDatetimeMappings[u.timeline];if(d&&u.dateTimeObject){let e=u.dateTimeObject.getTime()/1e3+d;if(u.parts&&"number"==typeof l.partIndex)for(let t=0;t<l.partIndex;t++)e+=u.parts[t].duration;if(d=Math.abs(r-e),null!==a&&(0===d||a<d))break;a=d,s={time:e,segmentIndex:l.segmentIndex,partIndex:l.partIndex}}}return s}},{name:"Segment",run:(e,t,i,n,r)=>{let s=null,a=null;r=r||0;var o=al(t);for(let e=0;e<o.length;e++){var l=o[t.endList||0===r?e:o.length-(e+1)],u=l.segment,d=l.part&&l.part.start||u&&u.start;if(u.timeline===n&&void 0!==d){if(u=Math.abs(r-d),null!==a&&a<u)break;(!s||null===a||a>=u)&&(a=u,s={time:d,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return s}},{name:"Discontinuity",run:(e,t,i,n,r)=>{let s=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let n=0;n<t.discontinuityStarts.length;n++){var a=t.discontinuityStarts[n],o=t.discontinuitySequence+n+1;if(o=e.discontinuities[o]){var l=Math.abs(r-o.time);if(null!==i&&i<l)break;(!s||null===i||i>=l)&&(i=l,s={time:o.time,segmentIndex:a,partIndex:null})}}}return s}},{name:"Playlist",run:(e,t,i,n,r)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class rd extends xr.EventTarget{constructor(e=0){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=Wo("SyncController")}getSyncPoint(e,t,i,n){return(e=this.runStrategies_(e,t,i,n)).length?this.selectSyncPoint_(e,{key:"time",value:n}):null}getExpiredTime(e,t){return e&&e.segments&&(t=this.runStrategies_(e,t,e.discontinuitySequence,0)).length?(0<(t=this.selectSyncPoint_(t,{key:"segmentIndex",value:0})).segmentIndex&&(t.time*=-1),Math.abs(t.time+Jo({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:t.segmentIndex,endIndex:0}))):null}runStrategies_(e,t,i,n){var r=[];for(let o=0;o<nd.length;o++){var s=nd[o],a=s.run(this,e,t,i,n);a&&(a.strategy=s.name,r.push({strategy:s.name,syncPoint:a}))}return r}selectSyncPoint_(e,t){let i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy;for(let a=1;a<e.length;a++){var s=Math.abs(e[a].syncPoint[t.key]-t.value);s<n&&(n=s,i=e[a].syncPoint,r=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${r}]: [time:${i.time}, segmentIndex:`+i.segmentIndex+("number"==typeof i.partIndex?",partIndex:"+i.partIndex:"")+"]"),i}saveExpiredSegmentInfo(e,t){var i=t.mediaSequence-e.mediaSequence;if(86400<i)xr.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);else for(let r=i-1;0<=r;r--){var n=e.segments[r];if(n&&void 0!==n.start){t.syncInfo={mediaSequence:e.mediaSequence+r,time:n.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){var t;this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject&&(t=(e=e.segments[0]).dateTimeObject.getTime()/1e3,this.timelineToDatetimeMappings[e.timeline]=-t)}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){var i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),n=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start})),i=n.dateTimeObject,n.discontinuity&&t&&i&&(this.timelineToDatetimeMappings[n.timeline]=-i.getTime()/1e3)}timestampOffsetForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].time}mappingForTimeline(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){var n=e.segment,r=e.part;let s,a,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${o.time}] [mapping: ${o.mapping}]`)),s=e.startOfSegment;else{if(!o)return!1;s=t.start+o.mapping}return a=t.end+o.mapping,r&&(r.start=s,r.end=a),(!n.start||s<n.start)&&(n.start=s),n.end=a,!0}saveDiscontinuitySyncInfo_(e){var t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let o=0;o<t.discontinuityStarts.length;o++){var n=t.discontinuityStarts[o],r=t.discontinuitySequence+o+1,s=n-e.mediaIndex,a=Math.abs(s);if(!this.discontinuities[r]||this.discontinuities[r].accuracy>a){let o;o=s<0?i.start-Jo({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:n}):i.end+Jo({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:n}),this.discontinuities[r]={time:o,accuracy:a}}}}dispose(){this.trigger("dispose"),this.off()}}class sd extends xr.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){return"number"==typeof t&&"number"==typeof i&&(this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var ad=Jl(Zl(eu((function(){var e=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){return!!this.listeners[e]&&(t=this.listeners[e].indexOf(t),this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(t,1),-1<t)},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),s=t.length,a=0;a<s;++a)t[a].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();let t=null;class i{constructor(e){let i,n,r;t=t||function(){var e=[[[],[],[],[],[]],[[],[],[],[],[]]],t=e[0],i=e[1],n=t[4],r=i[4];let s,a,o;var l,u,d,h=[],c=[];let p,m;for(s=0;s<256;s++)c[(h[s]=s<<1^283*(s>>7))^s]=s;for(a=o=0;!n[a];a^=l||1,o=c[o]||1)for(d=(d=o^o<<1^o<<2^o<<3^o<<4)>>8^255&d^99,m=16843009*h[u=h[l=h[r[n[a]=d]=a]]]^65537*u^257*l^16843008*a,p=257*h[d]^16843008*d,s=0;s<4;s++)t[s][a]=p=p<<24^p>>>8,i[s][d]=m=m<<24^m>>>8;for(s=0;s<5;s++)t[s]=t[s].slice(0),i[s]=i[s].slice(0);return e}(),this._tables=[[t[0][0].slice(),t[0][1].slice(),t[0][2].slice(),t[0][3].slice(),t[0][4].slice()],[t[1][0].slice(),t[1][1].slice(),t[1][2].slice(),t[1][3].slice(),t[1][4].slice()]];var s=this._tables[0][4],a=this._tables[1],o=e.length;let l=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");var u=e.slice(0),d=[];for(this._key=[u,d],i=o;i<4*o+28;i++)r=u[i-1],(i%o==0||8===o&&i%o==4)&&(r=s[r>>>24]<<24^s[r>>16&255]<<16^s[r>>8&255]<<8^s[255&r],i%o==0)&&(r=r<<8^r>>>24^l<<24,l=l<<1^283*(l>>7)),u[i]=u[i-o]^r;for(n=0;i;n++,i--)r=u[3&n?i:i-4],d[n]=i<=4||n<4?r:a[0][s[r>>>24]]^a[1][s[r>>16&255]]^a[2][s[r>>8&255]]^a[3][s[255&r]]}decrypt(e,t,i,n,r,s){var a,o,l=this._key[1];let u,d=e^l[0],h=n^l[1],c=i^l[2],p=t^l[3];var m=l.length/4-2;let f,g=4;var y=(e=this._tables[1])[0],_=e[1],v=e[2],b=e[3],T=e[4];for(f=0;f<m;f++)u=y[d>>>24]^_[h>>16&255]^v[c>>8&255]^b[255&p]^l[g],a=y[h>>>24]^_[c>>16&255]^v[p>>8&255]^b[255&d]^l[g+1],o=y[c>>>24]^_[p>>16&255]^v[d>>8&255]^b[255&h]^l[g+2],p=y[p>>>24]^_[d>>16&255]^v[h>>8&255]^b[255&c]^l[g+3],g+=4,d=u,h=a,c=o;for(f=0;f<4;f++)r[(3&-f)+s]=T[d>>>24]<<24^T[h>>16&255]<<16^T[c>>8&255]<<8^T[255&p]^l[g++],u=d,d=h,h=c,c=p,p=u}}class n extends e{constructor(){super(e),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}function r(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}class s{constructor(e,t,i,a){var o=s.STEP,l=new Int32Array(e.buffer);const u=new Uint8Array(e.byteLength);let d=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(l.subarray(d,d+o),t,i,u)),d=o;d<l.length;d+=o)i=new Uint32Array([r(l[d-4]),r(l[d-3]),r(l[d-2]),r(l[d-1])]),this.asyncStream_.push(this.decryptChunk_(l.subarray(d,d+o),t,i,u));this.asyncStream_.push((function(){var e;a(null,(e=u).subarray(0,e.byteLength-e[e.byteLength-1]))}))}static get STEP(){return 32e3}decryptChunk_(e,t,n,s){return function(){var a=function(e,t,n){var s,a,o,l,u=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),d=new i(Array.prototype.slice.call(t)),h=(t=new Uint8Array(e.byteLength),new Int32Array(t.buffer));let c,p,m,f,g;for(c=n[0],p=n[1],m=n[2],f=n[3],g=0;g<u.length;g+=4)s=r(u[g]),a=r(u[g+1]),o=r(u[g+2]),l=r(u[g+3]),d.decrypt(s,a,o,l,h,g),h[g]=r(h[g]^c),h[g+1]=r(h[g+1]^p),h[g+2]=r(h[g+2]^m),h[g+3]=r(h[g+3]^f),c=s,p=a,m=o,f=l;return t}(e,t,n);s.set(a,e.byteOffset)}}}var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};(a=(a="undefined"!=typeof window?window:void 0!==a?a:"undefined"!=typeof self?self:{}).BigInt||Number)("0x1"),a("0x100"),a("0x10000"),a("0x1000000"),a("0x100000000"),a("0x10000000000"),a("0x1000000000000"),a("0x100000000000000"),a("0x10000000000000000"),a=new Uint16Array([65484]),255!==(a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength))[0]&&a[0],self.onmessage=function(e){const t=e.data;e=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength);var i=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),n=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new s(e,i,n,(function(e,i){self.postMessage(function(e){const t={};return Object.keys(e).forEach((i=>{var n,r=e[i];n=r,("function"===ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer)?t[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[i]=r})),t}({source:t.source,decrypted:i}),[i.buffer])}))}}))));const od=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},ld=(e,t)=>{(t.activePlaylistLoader=e).load()},ud={AUDIO:(e,t)=>()=>{var{segmentLoaders:{[e]:i},mediaTypes:{[e]:n},excludePlaylist:r}=t,i=(od(i,n),n.activeTrack()),s=((s=n.activeGroup()).filter((e=>e.default))[0]||s[0]).id,a=n.tracks[s];if(i===a)r({error:{message:"Problem encountered loading the default audio track."}});else{xr.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const e in n.tracks)n.tracks[e].enabled=n.tracks[e]===a;n.onTrackChanged()}},SUBTITLES:(e,t)=>()=>{var i,{segmentLoaders:{[e]:i},mediaTypes:{[e]:n}}=t;xr.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),od(i,n),(i=n.activeTrack())&&(i.mode="disabled"),n.onTrackChanged()}},dd={AUDIO:(e,t,i)=>{if(!t)return;const{tech:n,requestOptions:r,segmentLoaders:{[e]:s}}=i;t.on("loadedmetadata",(()=>{var e=t.media();s.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&s.load()})),t.on("loadedplaylist",(()=>{s.playlist(t.media(),r),n.paused()||s.load()})),t.on("error",ud[e](e,i))},SUBTITLES:(e,t,i)=>{const{tech:n,requestOptions:r,segmentLoaders:{[e]:s},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",(()=>{var e=t.media();s.playlist(e,r),s.track(a.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&s.load()})),t.on("loadedplaylist",(()=>{s.playlist(t.media(),r),n.paused()||s.load()})),t.on("error",ud[e](e,i))}},hd={AUDIO:(e,t)=>{var i,{vhs:n,sourceType:r,segmentLoaders:{[e]:s},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[e]:{groups:l,tracks:u,logger_:d}},mainPlaylistLoader:h}=t,c=vl(h.main);o[e]&&0!==Object.keys(o[e]).length||(o[e]={main:{default:{default:!0}}},c&&(o[e].main.default.playlists=h.main.playlists));for(const s in o[e]){l[s]||(l[s]=[]);for(const p in o[e][s]){let m,f=o[e][s][p];m=c?(d(`AUDIO group '${s}' label '${p}' is a main playlist`),f.isMainPlaylist=!0,null):"vhs-json"===r&&f.playlists?new Ll(f.playlists[0],n,a):f.resolvedUri?new Ll(f.resolvedUri,n,a):f.playlists&&"dash"===r?new Kl(f.playlists[0],n,a,h):null,f=zo({id:p,playlistLoader:m},f),dd[e](e,f.playlistLoader,t),l[s].push(f),void 0===u[p]&&(i=new xr.AudioTrack({id:p,kind:(e=>{let t=e.default?"main":"alternative";return e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")?"main-desc":t})(f),enabled:!1,language:f.language,default:f.default,label:p}),u[p]=i)}}s.on("error",ud[e](e,t))},SUBTITLES:(e,t)=>{var i,{tech:n,vhs:r,sourceType:s,segmentLoaders:{[e]:a},requestOptions:o,main:{mediaGroups:l},mediaTypes:{[e]:{groups:u,tracks:d}},mainPlaylistLoader:h}=t;for(const a in l[e]){u[a]||(u[a]=[]);for(const c in l[e][a])if(!l[e][a][c].forced){let p,m=l[e][a][c];if("hls"===s)p=new Ll(m.resolvedUri,r,o);else if("dash"===s){if(!m.playlists.filter((e=>e.excludeUntil!==1/0)).length)return;p=new Kl(m.playlists[0],r,o,h)}else"vhs-json"===s&&(p=new Ll(m.playlists?m.playlists[0]:m.resolvedUri,r,o));m=zo({id:c,playlistLoader:p},m),dd[e](e,m.playlistLoader,t),u[a].push(m),void 0===d[c]&&(i=n.addRemoteTextTrack({id:c,kind:"subtitles",default:m.default&&m.autoselect,language:m.language,label:c},!1).track,d[c]=i)}}a.on("error",ud[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{var{tech:i,main:{mediaGroups:n},mediaTypes:{[e]:{groups:r,tracks:s}}}=t;for(const t in n[e]){r[t]||(r[t]=[]);for(const l in n[e][t]){var a=n[e][t][l];if(/^(?:CC|SERVICE)/.test(a.instreamId)){var o=i.options_.vhs&&i.options_.vhs.captionServices||{};let e={label:l,language:a.language,instreamId:a.instreamId,default:a.default&&a.autoselect};void 0===(e=o[e.instreamId]?zo(e,o[e.instreamId]):e).default&&delete e.default,r[t].push(zo({id:l},a)),void 0===s[l]&&(o=i.addRemoteTextTrack({id:e.instreamId,kind:"captions",default:e.default,language:e.language,label:e.label},!1).track,s[l]=o)}}}}},cd=(e,t)=>{for(let i=0;i<e.length;i++){if(_l(t,e[i]))return!0;if(e[i].playlists&&cd(e[i].playlists,t))return!0}return!1},pd={AUDIO:(e,t)=>()=>{var{[e]:{tracks:i}}=t.mediaTypes;for(const e in i)if(i[e].enabled)return i[e];return null},SUBTITLES:(e,t)=>()=>{var{[e]:{tracks:i}}=t.mediaTypes;for(const e in i)if("showing"===i[e].mode||"hidden"===i[e].mode)return i[e];return null}};let md;const fd=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"];class gd extends xr.EventTarget{constructor(e){super();const{src:t,withCredentials:i,tech:n,bandwidth:r,externVhs:s,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:u,cacheEncryptionKeys:d,bufferBasedABR:h,leastPixelDiffSelector:c,captionServices:p}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let m=e.maxPlaylistRetries;null!=m||(m=1/0),md=s,this.bufferBasedABR=Boolean(h),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=n,this.vhs_=n.vhs,this.sourceType_=u,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=m,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:m,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{const e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Nu,activeTrack:Nu,getActiveGroup:Nu,onGroupChanged:Nu,onTrackChanged:Nu,lastTrack_:null,logger_:Wo(`MediaGroups[${t}]`)}})),e})(),this.mediaSource=new window.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=Go(),this.hasPlayed_=!1,this.syncController_=new rd(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new ad,this.sourceUpdater_=new Ju(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new sd;var f={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:p,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:r,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:d,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings};this.mainPlaylistLoader_=new("dash"===this.sourceType_?Kl:Ll)(t,this.vhs_,this.requestOptions_),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Du(zo(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Du(zo(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new id(zo(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise(((e,t)=>{function i(){n.off("vttjserror",r),e()}function r(){n.off("vttjsloaded",i),t()}n.one("vttjsloaded",i),n.one("vttjserror",r),n.addWebVttScript_()}))}),e),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",(()=>this.startABRTimer_())),this.tech_.on("pause",(()=>this.stopABRTimer_())),this.tech_.on("play",(()=>this.startABRTimer_()))),fd.forEach((e=>{this[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(this,e)})),this.logger_=Wo("pc"),this.triggeredFmp4Usage=!1,"none"===this.tech_.preload()?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1,f="none"===this.tech_.preload()?"play":"loadstart",this.tech_.one(f,(()=>{const e=Date.now();this.tech_.one("loadeddata",(()=>{this.timeToLoadedData__=Date.now()-e,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends}))}))}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){var t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){var n=(n=this.media())&&(n.id||n.uri),r=e.id||e.uri;n&&n!==r&&(this.logger_(`switch media ${n} -> ${r} from `+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.mainPlaylistLoader_.media(e,i)}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=window.setInterval((()=>this.checkABR_()),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){var e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var i=e.mediaGroups.AUDIO,n=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{var s=i.main||n.length&&i[n[0]];for(const e in s)if(s[e].default){r={label:e};break}}if(!r)return t;var a=[];for(const t in i)if(i[t][r.label]){var o=i[t][r.label];if(o.playlists&&o.playlists.length)a.push.apply(a,o.playlists);else if(o.uri)a.push(o);else if(e.playlists.length)for(let i=0;i<e.playlists.length;i++){var l=e.playlists[i];l.attributes&&l.attributes.AUDIO&&l.attributes.AUDIO===t&&a.push(l)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",(()=>{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;yl(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&"none"!==this.tech_.preload()&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),(e=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{hd[t](t,e)}));const{mediaTypes:t,mainPlaylistLoader:i,tech:n,vhs:r,segmentLoaders:{AUDIO:s,main:a}}=e;["AUDIO","SUBTITLES"].forEach((i=>{var n,r,s,a,o,l,u,d,h,c;t[i].activeGroup=(n=i,r=e,e=>{var{mainPlaylistLoader:t,mediaTypes:{[n]:{groups:i}}}=r,s=t.media();if(!s)return null;let a=null;s.attributes[n]&&(a=i[s.attributes[n]]);var o=Object.keys(i);if(!a)if("AUDIO"===n&&1<o.length&&vl(r.main))for(let e=0;e<o.length;e++){var l=i[o[e]];if(cd(l,s)){a=l;break}}else i.main?a=i.main:1===o.length&&(a=i[o[0]]);return void 0===e?a:null!==e&&a&&a.filter((t=>t.id===e.id))[0]||null}),t[i].activeTrack=pd[i](i,e),t[i].onGroupChanged=(s=i,a=e,()=>{var{segmentLoaders:{[s]:e,main:t},mediaTypes:{[s]:i}}=a,n=i.activeTrack(),r=i.getActiveGroup(),o=i.activePlaylistLoader,l=i.lastGroup_;r&&l&&r.id===l.id||(i.lastGroup_=r,i.lastTrack_=n,od(e,i),r&&!r.isMainPlaylist&&(r.playlistLoader?(e.resyncLoader(),ld(r.playlistLoader,i)):o&&t.resetEverything()))}),t[i].onGroupChanging=(o=i,l=e,()=>{var{segmentLoaders:{[o]:e},mediaTypes:{[o]:t}}=l;t.lastGroup_=null,e.abort(),e.pause()}),t[i].onTrackChanged=(u=i,d=e,()=>{var e,t,{mainPlaylistLoader:i,segmentLoaders:{[u]:n,main:r},mediaTypes:{[u]:s}}=d,a=s.activeTrack(),o=s.getActiveGroup(),l=s.activePlaylistLoader,h=s.lastTrack_;if((!h||!a||h.id!==a.id)&&(s.lastGroup_=o,s.lastTrack_=a,od(n,s),o)){if(o.isMainPlaylist)return a&&h&&a.id!==h.id&&(t=(e=d.vhs.playlistController_).selectPlaylist(),e.media()!==t)?(s.logger_(`track change. Switching main audio from ${h.id} to `+a.id),i.pause(),r.resetEverything(),void e.fastQualityChange_(t)):void 0;if("AUDIO"===u){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();n.setAudio(!0),r.setAudio(!1)}l===o.playlistLoader||(n.track&&n.track(a),n.resetEverything()),ld(o.playlistLoader,s)}}),t[i].getActiveGroup=([h,c]=[i,e.mediaTypes],()=>{var e=c[h].activeTrack();return e?c[h].activeGroup(e):null})}));var o=t.AUDIO.activeGroup();o&&(o=(o.filter((e=>e.default))[0]||o[0]).id,t.AUDIO.tracks[o].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),(t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),s):a).setAudio(!0)),i.on("mediachange",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanged()))})),i.on("mediachanging",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanging()))}));const l=()=>{t.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"})};n.audioTracks().addEventListener("change",l),n.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",(()=>{n.audioTracks().removeEventListener("change",l),n.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),n.clearTracks("audio");for(const e in t.AUDIO.tracks)n.audioTracks().addTrack(t.AUDIO.tracks[e])})({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(()=>{this.trigger("selectedinitialmedia")}))})),this.mainPlaylistLoader_.on("loadedplaylist",(()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){let t;if(this.excludeUnsupportedVariants_(),!(t=(t=this.enableLowInitialPlaylist?this.selectInitialPlaylist():t)||this.selectPlaylist())||!this.shouldSwitchToMedia_(t))return;if(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),"vhs-json"!==this.sourceType_||!this.initialMedia_.segments)return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)})),this.mainPlaylistLoader_.on("error",(()=>{var e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainPlaylistLoader_.on("mediachanging",(()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()})),this.mainPlaylistLoader_.on("mediachange",(()=>{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;yl(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})})),this.mainPlaylistLoader_.on("playlistunchanged",(()=>{var e=this.mainPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))})),this.mainPlaylistLoader_.on("renditiondisabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})})),this.mainPlaylistLoader_.on("renditionenabled",(()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}))}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){var i=e.mediaGroups||{};let n=!0;e=Object.keys(i.AUDIO);for(const e in i.AUDIO)for(const t in i.AUDIO[e])i.AUDIO[e][t].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),md.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),e.length&&1<Object.keys(i.AUDIO[e[0]]).length&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){var t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine(),{currentPlaylist:i,buffered:t,currentTime:e,nextPlaylist:n,bufferLowWaterLine:r,bufferHighWaterLine:s,duration:a,bufferBasedABR:o,log:l}={buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_};if(n){var u=`allowing switch ${i&&i.id||"null"} -> `+n.id;if(!i)return l(u+" as current playlist is not set"),!0;if(n.id!==i.id){var d=Boolean(Xo(t,e).length);if(!i.endList)return d||"number"!=typeof i.partTargetDuration?(l(u+" as current playlist is live"),!0):(l(`not ${u} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);if(d=Yo(t,e),a<(t=o?Ql.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Ql.MAX_BUFFER_LOW_WATER_LINE))return l(u+` as duration < max low water line (${a} < ${t})`),!0;if((e=n.attributes.BANDWIDTH)<(a=i.attributes.BANDWIDTH)&&(!o||d<s)){let t=u+` as next bandwidth < current bandwidth (${e} < ${a})`;return o&&(t+=` and forwardBuffer < bufferHighWaterLine (${d} < ${s})`),l(t),!0}if((!o||a<e)&&r<=d){let t=u+` as forwardBuffer >= bufferLowWaterLine (${d} >= ${r})`;return o&&(t+=` and next bandwidth > current bandwidth (${e} > ${a})`),l(t),!0}l(`not ${u} as no switching criteria met`)}}else xr.log.warn("We received no playlist to switch to. Please check your stream.");return!1}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",(()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("timeout",(()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()})),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",(()=>{this.trigger("progress")})),this.mainSegmentLoader_.on("error",(()=>{var e=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:e.playlist,error:e})})),this.mainSegmentLoader_.on("appenderror",(()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(()=>{this.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")})),this.mainSegmentLoader_.on("ended",(()=>{this.logger_("main segment loader ended"),this.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(e=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:120}))}));var e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();var e=this.getCodecsOrExclude_();e&&this.sourceUpdater_.addOrChangeSourceBuffers(e)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}))}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((()=>{xr.browser.IE_VERSION||xr.browser.IS_EDGE?this.tech_.setCurrentTime(this.tech_.currentTime()+.04):this.tech_.setCurrentTime(this.tech_.currentTime())})))}play(){var e;if(!this.setupFirstPlay())return this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load(),e=this.tech_.seekable(),this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}setupFirstPlay(){var e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList){const e=this.seekable();if(!e.length)return!1;if(xr.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",(()=>{this.trigger("firstplay"),this.tech_.setCurrentTime(e.end(0)),this.hasPlayed_=!0})),!1;this.trigger("firstplay"),this.tech_.setCurrentTime(e.end(0))}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){var e;this.tryToCreateSourceBuffers_(),this.tech_.autoplay()&&void 0!==(e=this.tech_.play())&&"function"==typeof e.then&&e.then(null,(e=>{})),this.trigger("sourceopen")}handleSourceEnded_(){var e,t;this.inbandTextTracks_.metadataTrack_&&(e=this.inbandTextTracks_.metadataTrack_.cues)&&e.length&&(t=this.duration(),e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t)}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;var t;this.mediaTypes_.AUDIO.activePlaylistLoader&&(e=((t=this.mainSegmentLoader_.getCurrentMediaInfo_())&&!t.hasVideo||e)&&this.audioSegmentLoader_.ended_),e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){var t,i;return!!this.seekable().length&&null!==(t=this.syncController_.getExpiredTime(e,this.duration()))&&(e=md.Playlist.playlistEnd(e,t),t=this.tech_.currentTime(),(i=this.tech_.buffered()).length?(i=i.end(i.length-1))-t<=tl&&e-i<=tl:e-t<=tl)}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,e){e.playlistErrors_++;var n=1===(n=(s=this.mainPlaylistLoader_.main.playlists).filter(ml)).length&&n[0]===e;if(1===s.length&&i!==1/0)return xr.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(n);if(n){let t=!1;s.forEach((i=>{var n;i!==e&&void 0!==(n=i.excludeUntil)&&n!==1/0&&(t=!0,delete i.excludeUntil)})),t&&(xr.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let a;var r,s;if(a=e.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*i,e.excludeUntil=a,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"}),s=this.selectPlaylist())return i=t.internal?this.logger_:xr.log.warn,r=t.message?" "+t.message:"",i(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.`+r+` Switching to playlist ${s.id}.`),s.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),s.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),i=s.targetDuration/2*1e3||5e3,r="number"==typeof s.lastRequest&&Date.now()-s.lastRequest<=i,this.switchMedia_(s,"exclude",n||r);this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error")}else this.error=t,"open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network")}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[];var n="all"===e,r=(!n&&"main"!==e||i.push(this.mainPlaylistLoader_),[]);!n&&"audio"!==e||r.push("AUDIO"),!n&&"subtitle"!==e||(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach((e=>{(e=this.mediaTypes_[e]&&this.mediaTypes_[e].activePlaylistLoader)&&i.push(e)})),["main","audio","subtitle"].forEach((t=>{var n=this[t+"SegmentLoader_"];!n||e!==t&&"all"!==e||i.push(n)})),i.forEach((e=>t.forEach((t=>{"function"==typeof e[t]&&e[t]()}))))}setCurrentTime(e){var t=Xo(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0}duration(){var e;return this.mainPlaylistLoader_&&(e=this.mainPlaylistLoader_.media())?e.endList?this.mediaSource?this.mediaSource.duration:md.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(this.mainPlaylistLoader_){var t=this.mainPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.duration());if(null!==i){var n=this.mainPlaylistLoader_.main,r=md.Playlist.seekable(t,i,md.Playlist.liveEdgeDelay(n,t));if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=md.Playlist.seekable(t,i,md.Playlist.liveEdgeDelay(n,t))).length)return}let s,a;this.seekable_&&this.seekable_.length&&(s=this.seekable_.end(0),a=this.seekable_.start(0)),!e||e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=Go([[(e.start(0)>r.start(0)?e:r).start(0),(e.end(0)<r.end(0)?e:r).end(0)]]),this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===s&&this.seekable_.start(0)===a||(this.logger_(`seekable updated [${nl(this.seekable_)}]`),this.tech_.trigger("seekablechanged"))}}}}}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);else{if(e)return(e=this.seekable()).length?void((isNaN(this.mediaSource.duration)||this.mediaSource.duration<e.end(e.length-1))&&this.sourceUpdater_.setDuration(e.end(e.length-1))):void 0;e=this.tech_.buffered();let t=md.Playlist.duration(this.mainPlaylistLoader_.media());0<e.length&&(t=Math.max(t,e.end(e.length-1))),this.mediaSource.duration!==t&&this.sourceUpdater_.setDuration(t)}}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((e=>{var t=this.mediaTypes_[e].groups;for(const e in t)t[e].forEach((e=>{e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_();return e=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_(),t&&e}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;var i=lu(this.main(),t);const n={};var r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=i.video||e.main.videoCodec||"avc1.4d400d"),e.main.isMuxed&&(n.video+=","+(i.audio||e.main.audioCodec||Yr)),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||r)&&(n.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||Yr,e.audio.isFmp4=(e.main.hasAudio&&!e.main.isMuxed?e.main:e.audio).isFmp4),n.audio||n.video){const s={};let a;if(["video","audio"].forEach((function(t){var i;n.hasOwnProperty(t)&&!((i=e[t].isFmp4)?Fr:qr)(n[t])&&(i=e[t].isFmp4?"browser":"muxer",s[i]=s[i]||[],s[i].push(n[t]),"audio"===t&&(a=i))})),r&&a&&t.attributes.AUDIO){const e=t.attributes.AUDIO;this.main().playlists.forEach((i=>{(i.attributes&&i.attributes.AUDIO)===e&&i!==t&&(i.excludeUntil=1/0)})),this.logger_(`excluding audio group ${e} as ${a} does not support codec(s): "${n.audio}"`)}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const e=[];if(["video","audio"].forEach((t=>{var i=(Kr(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(Kr(n[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${n[t]}"`)})),e.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return n}i=Object.keys(s).reduce(((e,t)=>(e&&(e+=", "),e+`${t} does not support codec(s): "${s[t].join(",")}"`)),"")+".",this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:i},playlistExclusionDuration:1/0})}else this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0})}tryToCreateSourceBuffers_(){var e;"open"!==this.mediaSource.readyState||this.sourceUpdater_.hasCreatedSourceBuffers()||this.areMediaTypesKnown_()&&(e=this.getCodecsOrExclude_())&&(this.sourceUpdater_.createSourceBuffers(e),e=[e.video,e.audio].filter(Boolean).join(","),this.excludeIncompatibleVariants_(e))}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach((i=>{var n,r;i=e[i],-1===t.indexOf(i.id)&&(t.push(i.id),r=[],!(n=lu(this.main,i)).audio||qr(n.audio)||Fr(n.audio)||r.push("audio codec "+n.audio),!n.video||qr(n.video)||Fr(n.video)||r.push("video codec "+n.video),n.text&&"stpp.ttml.im1t"===n.text&&r.push("text codec "+n.text),r.length)&&(i.excludeUntil=1/0,this.logger_(`excluding ${i.id} for unsupported: `+r.join(", ")))}))}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,n=ou(e=Tu(Kr(e))),r=e.video&&Kr(e.video)[0]||null,s=e.audio&&Kr(e.audio)[0]||null;Object.keys(i).forEach((e=>{var a,o,l;e=i[e],-1===t.indexOf(e.id)&&e.excludeUntil!==1/0&&(t.push(e.id),a=[],o=ou(l=lu(this.mainPlaylistLoader_.main,e)),l.audio||l.video)&&(o!==n&&a.push(`codec count "${o}" !== "${n}"`),this.sourceUpdater_.canChangeType()||(o=l.video&&Kr(l.video)[0]||null,l=l.audio&&Kr(l.audio)[0]||null,o&&r&&o.type.toLowerCase()!==r.type.toLowerCase()&&a.push(`video codec "${o.type}" !== "${r.type}"`),l&&s&&l.type.toLowerCase()!==s.type.toLowerCase()&&a.push(`audio codec "${l.type}" !== "${s.type}"`)),a.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id}: `+a.join(" && ")))}))}updateAdCues_(e){let t=0;var i=this.seekable(),[n,r,i=0]=(i.length&&(t=i.start(0)),[e,this.cueTagsTrack_,t]);if(n.segments){let e,t=i;for(let i=0;i<n.segments.length;i++){var s,a,o=n.segments[i];if(e=e||function(e,t){var i=e.cues;for(let e=0;e<i.length;e++){var n=i[e];if(t>=n.adStartTime&&t<=n.adEndTime)return n}return null}(r,t+o.duration/2)){if("cueIn"in o){e.endTime=t,e.adEndTime=t,t+=o.duration,e=null;continue}if(t<e.endTime){t+=o.duration;continue}e.endTime+=o.duration}else"cueOut"in o&&((e=new window.VTTCue(t,t+o.duration,o.cueOut)).adStartTime=t,e.adEndTime=t+parseFloat(o.cueOut),r.addCue(e)),"cueOutCont"in o&&([s,a]=o.cueOutCont.split("/").map(parseFloat),(e=new window.VTTCue(t,t+o.duration,"")).adStartTime=t-s,e.adEndTime=e.adStartTime+a,r.addCue(e));t+=o.duration}}}goalBufferLength(){var e=this.tech_.currentTime(),t=Ql.GOAL_BUFFER_LENGTH,i=Ql.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Ql.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)}bufferLowWaterLine(){var e=this.tech_.currentTime(),t=Ql.BUFFER_LOW_WATER_LINE,i=Ql.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Ql.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,Ql.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?r:n)}bufferHighWaterLine(){return Ql.BUFFER_HIGH_WATER_LINE}}class yd{constructor(e,t,i){var n,r,s,a,o=e.playlistController_,l=o.fastQualityChange_.bind(o);t.attributes&&(n=t.attributes.RESOLUTION,this.width=n&&n.width,this.height=n&&n.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]),this.codecs=lu(o.main(),t),this.playlist=t,this.id=i,this.enabled=(r=e.playlists,s=t.id,a=l,e=>{var t=r.main.playlists[s],i=pl(t),n=ml(t);return void 0===e?n:(e?delete t.disabled:t.disabled=!0,e===n||i||(a(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})}}const _d=["seeking","seeked","pause","playing","error"];class vd{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Wo("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),s=this.playlistController_,a=["main","subtitle","audio"],o={},l=(a.forEach((e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},s[e+"SegmentLoader_"].on("appendsdone",o[e].updateend),s[e+"SegmentLoader_"].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)})),e=>{["main","audio"].forEach((t=>{s[t+"SegmentLoader_"][e]("appended",this.seekingAppendCheck_)}))});this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=()=>l("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(_d,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(_d,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),a.forEach((e=>{s[e+"SegmentLoader_"].off("appendsdone",o[e].updateend),s[e+"SegmentLoader_"].off("playlistupdate",o[e].reset),this.tech_.off(["seeked","seeking"],o[e].reset)})),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){var t=this.playlistController_[e+"SegmentLoader_"];0<this[e+"StalledDownloads_"]&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()}checkSegmentDownloads_(e){var t=this.playlistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=function(e,t){if(e!==t){if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++)if(e.start(i)!==t.start(i)||e.end(i)!==t.end(i))return!0}return!1}(this[e+"Buffered_"],n);this[e+"Buffered_"]=n,r?this.resetSegmentDownloads_(e):(this[e+"StalledDownloads_"]++,this.logger_(`found #${this[e+"StalledDownloads_"]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:rl(n)}),this[e+"StalledDownloads_"]<10||(this.logger_(e+" loader stalled download exclusion"),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),"subtitle"!==e&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0})))}checkCurrentTime_(){var e,t;if(!this.tech_.paused()&&!this.tech_.seeking())return e=this.tech_.currentTime(),t=this.tech_.buffered(),this.lastRecordedTime===e&&(!t.length||e+tl>=t.end(t.length-1))?this.techWaiting_():void(5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e))}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;var e=this.seekable(),t=this.tech_.currentTime();let i;if(this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(i=n=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)&&(i=(n=e.start(0))+(n===e.end(0)?0:tl)),void 0!==i)this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${nl(e)}. Seeking to `+i+".");else{var n=this.playlistController_.sourceUpdater_,r=(e=this.tech_.buffered(),n.audioBuffer?n.audioBuffered():null),s=(n=n.videoBuffer?n.videoBuffered():null,this.media()),a=s.partTargetDuration||2*(s.targetDuration-el),o=[r,n];for(let e=0;e<o.length;e++)if(o[e]&&Yo(o[e],t)<a)return!1;if(0===(s=Ko(e,t)).length)return!1;i=s.start(0)+tl,this.logger_(`Buffered region starts (${s.start(0)}) just beyond seek point (${t}). Seeking to ${i}.`)}return this.tech_.setCurrentTime(i),!0}waiting_(){var e,t;this.techWaiting_()||(e=this.tech_.currentTime(),(t=Xo(t=this.tech_.buffered(),e)).length&&e+3<=t.end(0)&&(this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${t.start(0)} -> ${t.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})))}techWaiting_(){var e,t=this.seekable(),i=this.tech_.currentTime();return!!this.tech_.seeking()||(this.beforeSeekableWindow_(t,i)?(t=t.end(t.length-1),this.logger_(`Fell out of live window at time ${i}. Seeking to live point (seekable end) `+t),this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0):(t=this.tech_.vhs.playlistController_.sourceUpdater_,e=this.tech_.buffered(),this.videoUnderflow_({audioBuffered:t.audioBuffered(),videoBuffered:t.videoBuffered(),currentTime:i})?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0):0<(t=Ko(e,i)).length&&(this.logger_(`Stopped at ${i} and seeking to `+t.start(0)),this.resetTimeUpdate_(),this.skipTheGap_(i),!0)))}afterSeekableWindow_(e,t,i,n=!1){if(!e.length)return!1;let r=e.end(e.length-1)+tl;return t>(!i.endList&&n?e.end(e.length-1)+3*i.targetDuration:r)}beforeSeekableWindow_(e,t){return!!(e.length&&0<e.start(0)&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(e){let s;var n,r;return e.length&&t.length?(n=Xo(e,i-3),r=Xo(e,i),(t=Xo(t,i)).length&&!r.length&&n.length&&(s={start:n.end(0),end:t.end(0)})):Ko(e,i).length||(s=this.gapFromVideoUnderflow_(e,i)),!!s&&(this.logger_(`Encountered a gap in video from ${s.start} to ${s.end}. Seeking to current time `+i),!0)}}skipTheGap_(e){var t=this.tech_.buffered(),i=this.tech_.currentTime();t=Ko(t,i),this.resetTimeUpdate_(),0!==t.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",t.start(0)),this.tech_.setCurrentTime(t.start(0)+el),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}))}gapFromVideoUnderflow_(e,t){var i=function(e){if(e.length<2)return Go();var t=[];for(let r=1;r<e.length;r++){var i=e.end(r-1),n=e.start(r);t.push([i,n])}return Go(t)}(e);for(let e=0;e<i.length;e++){var n=i.start(e),r=i.end(e);if(t-n<4&&2<t-n)return{start:n,end:r}}return null}}const bd={errorInterval:30,getSource(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Td=function(e,t){let i=0,n=0;function r(t){null!=t&&(n=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",l),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())}function s(){if(Date.now()-i<1e3*o.errorInterval)e.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(o.getSource&&"function"==typeof o.getSource)return i=Date.now(),o.getSource.call(e,r);xr.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}}function a(){e.off("loadedmetadata",l),e.off("error",s),e.off("dispose",a)}const o=zo(bd,t),l=(e.ready((()=>{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})})),function(){n&&e.currentTime(n)});e.on("error",s),e.on("dispose",a),e.reloadSourceOnError=function(t){a(),Td(e,t)}};function Sd(e,t){var i=t.media();let n=-1;for(let t=0;t<e.length;t++)if(e[t].id===i.id){n=t;break}e.selectedIndex_=n,e.trigger({selectedIndex:n,type:"change"})}const wd={PlaylistLoader:Ll,Playlist:bl,utils:Jn,STANDARD_PLAYLIST_SELECTOR:Cu,INITIAL_PLAYLIST_SELECTOR:function(){var e=this.playlists.main.playlists.filter(bl.isEnabled);return Eu(e,((e,t)=>du(e,t))),(e=e.filter((e=>!!lu(this.playlists.main,e).video)))[0]||null},lastBandwidthSelector:Cu,movingAverageBandwidthSelector:function(e){let t=-1,i=-1;if(e<0||1<e)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var n=this.useDevicePixelRatio&&window.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),0<this.systemBandwidth&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),ku(this.playlists.main,t,parseInt(uu(this.tech_.el(),"width"),10)*n,parseInt(uu(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:du,comparePlaylistResolution:function(e,t){let i,n;return i=(i=e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width?e.attributes.RESOLUTION.width:i)||window.Number.MAX_VALUE,n=(n=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width?t.attributes.RESOLUTION.width:n)||window.Number.MAX_VALUE,i===n&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:Nl()},Ed=(Object.keys(Ql).forEach((e=>{Object.defineProperty(wd,e,{get:()=>(xr.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),Ql[e]),set(t){xr.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0?xr.log.warn(`value of Vhs.${e} must be greater than or equal to 0`):Ql[e]=t}})})),"videojs-vhs"),kd=(wd.canPlaySource=function(){return xr.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:n})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();var r;i=i?n.concat([i]):n,n=i,r=Object.keys(t),i=n.reduce(((e,t)=>{var i;return t.contentProtection&&(i=r.reduce(((e,i)=>{var n=t.contentProtection[i];return n&&n.pssh&&(e[i]={pssh:n.pssh}),e}),{}),Object.keys(i).length)&&e.push(i),e}),[]);const s=[],a=[];return i.forEach((t=>{a.push(new Promise(((t,i)=>{e.tech_.one("keysessioncreated",t)}))),s.push(new Promise(((i,n)=>{e.eme.initializeMediaKeys({keySystems:t},(e=>{e?n(e):i()}))})))})),Promise.race([Promise.all(s),Promise.race(a)])}),Cd=()=>{if(!window.localStorage)return null;var e=window.localStorage.getItem(Ed);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}};wd.supportsNativeHls=function(){if(!document||!document.createElement)return!1;const e=document.createElement("video");return!!xr.getTech("Html5").isSupported()&&["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),wd.supportsNativeDash=!!(document&&document.createElement&&xr.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),wd.supportsTypeNatively=e=>"hls"===e?wd.supportsNativeHls:"dash"===e&&wd.supportsNativeDash,wd.isSupported=function(){return xr.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};class xd extends(xr.getComponent("Component")){constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Wo("VhsHandler"),t.options_&&t.options_.playerId&&(i=xr.getPlayer(t.options_.playerId),this.player_=i),this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(e=>{var t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()})),this.on(this.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),this.on(this.tech_,"error",(function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()})),this.on(this.tech_,"play",this.play)}setOptions_(){var e;this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage&&((e=Cd())&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e)&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"})),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=Ql.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Ql.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach((e=>{void 0!==this.source_[e]&&(this.options_[e]=this.source_[e])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){e&&(this.setOptions_(),this.options_.src=0===(e=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(e.substring(e.indexOf(",")+1)):e,this.options_.tech=this.tech_,this.options_.externVhs=wd,this.options_.sourceType=Hr(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.playlistController_=new gd(this.options_),e=zo({liveRangeSafeTimeDelta:tl},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_}),this.playbackWatcher_=new vd(e),this.playlistController_.on("error",(()=>{var e=xr.players[this.tech_.options_.playerId];let t=this.playlistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)})),t=this.options_.bufferBasedABR?wd.movingAverageBandwidthSelector(.55):wd.STANDARD_PLAYLIST_SELECTOR,this.playlistController_.selectPlaylist=(this.selectPlaylist||t).bind(this),this.playlistController_.selectInitialPlaylist=wd.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let e=this.playlistController_.mainSegmentLoader_.bandwidth;var t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection;return this.options_.useNetworkInformationApi&&t&&(e=1e7<=(t=1e3*t.downlink*1e3)&&1e7<=e?Math.max(e,t):t),e},set(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){var e=1/(this.bandwidth||1);let t;return t=0<this.throughput?1/this.throughput:0,Math.floor(1/(e+t))},set(){xr.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>rl(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>rl(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",(()=>{if(this.options_.useBandwidthFromLocalStorage){var e={bandwidth:this.bandwidth,throughput:Math.round(this.throughput)};if(window.localStorage){var t=(t=Cd())?zo(t,e):e;try{window.localStorage.setItem(Ed,JSON.stringify(t))}catch(e){return}}}})),this.playlistController_.on("selectedinitialmedia",(()=>{var e;(e=this).representations=()=>{var t=e.playlistController_.main();return(t=vl(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists)?t.filter((e=>!pl(e))).map(((t,i)=>new yd(e,t,t.id))):[]}})),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",(()=>{this.setupEme_()})),this.on(this.playlistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.playlistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el())&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),kd({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then((()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()})).catch((e=>{this.logger_("error while creating EME key session",e),this.player_.error({message:"Failed to initialize media keys for EME",code:3})}))}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){var e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;e=(({player:e,sourceKeySystems:t,media:i,audioMedia:n})=>(t=((e,t,i)=>{if(!e)return e;let n={};t&&t.attributes&&t.attributes.CODECS&&(n=Tu(Kr(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS);var r=Qr(n.video),s=Qr(n.audio),a={};for(const i in e)a[i]={},s&&(a[i].audioContentType=s),r&&(a[i].videoContentType=r),t.contentProtection&&t.contentProtection[i]&&t.contentProtection[i].pssh&&(a[i].pssh=t.contentProtection[i].pssh),"string"==typeof e[i]&&(a[i].url=e[i]);return zo(e,a)})(t,i,n),!(!t||(e.currentSource().keySystems=t)&&!e.eme&&(xr.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),1))))({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()}),this.player_.tech_.on("keystatuschange",(e=>{if("output-restricted"===e.status&&(e=this.playlistController_.main())&&e.playlists){const t=[];e.playlists.forEach((e=>{e&&e.attributes&&e.attributes.RESOLUTION&&720<=e.attributes.RESOLUTION.height&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,t.push(e))})),t.length&&(xr.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...t),this.playlistController_.fastQualityChange_())}})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==xr.browser.IE_VERSION&&e?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){var e=xr.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",(()=>{var e,t;e=this.qualityLevels_,(t=this).representations().forEach((t=>{e.addQualityLevel(t)})),Sd(e,t.playlists)})),this.playlists.on("mediachange",(()=>{Sd(this.qualityLevels_,this.playlists)})))}static version(){return{"@videojs/http-streaming":"3.0.2","mux.js":"6.3.0","mpd-parser":"1.0.1","m3u8-parser":"6.0.0","aes-decrypter":"4.0.1"}}version(){return this.constructor.version()}canChangeType(){return Ju.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return(({playlist:e,time:t,callback:i})=>{var n,r;if(i)return e&&void 0!==t?(e=((e,t)=>{if(!t||!t.segments||0===t.segments.length)return null;let i,n=0;for(let r=0;r<t.segments.length&&(i=t.segments[r],!(e<=(n=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:n+i.duration)));r++);var r=t.segments[t.segments.length-1];if(r.videoTimingInfo&&r.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>n){if(e>n+.25*r.duration)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}})(t,e))?"estimate"===e.type?i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:e.estimatedStart}):(n={mediaSeconds:t},(r=(e=e.segment).dateTimeObject?(r=e.videoTimingInfo.transmuxerPrependedSeconds,t-=e.videoTimingInfo.transmuxedPresentationStart+r,new Date(e.dateTimeObject.getTime()+1e3*t)):null)&&(n.programDateTime=r.toISOString()),i(null,n)):i({message:"valid programTime was not found"}):i({message:"getProgramTime: playlist and time must be provided"});throw new Error("getProgramTime: callback must be provided")})({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,n=2){return Vl({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}const Id={name:"videojs-http-streaming",VERSION:"3.0.2",canHandleSource:(e,t={})=>(t=zo(xr.options,t),Id.canPlayType(e.type,t)),handleSource:(e,t,i={})=>(i=zo(xr.options,i),t.vhs=new xd(e,t,i),t.vhs.xhr=Nl(),t.vhs.src(e.src,e.type),t.vhs),canPlayType:(e,t)=>(e=Hr(e))&&(t=Id.getOverrideNative(t),!wd.supportsTypeNatively(e)||t)?"maybe":"",getOverrideNative(e={}){var{vhs:e={}}=e,t=!(xr.browser.IS_ANY_SAFARI||xr.browser.IS_IOS),{overrideNative:e=t}=e;return e}};return Fr("avc1.4d400d,mp4a.40.2")&&xr.getTech("Html5").registerSourceHandler(Id,0),xr.VhsHandler=xd,xr.VhsSourceHandler=Id,xr.Vhs=wd,xr.use||xr.registerComponent("Vhs",wd),xr.options.vhs=xr.options.vhs||{},xr.getPlugin&&xr.getPlugin("reloadSourceOnError")||xr.registerPlugin("reloadSourceOnError",(function(e){Td(this,e)})),xr})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).videojsHlsQualitySelector=t(e.videojs)}(this,(function(e){"use strict";var t=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(e);const i=t.default.getComponent("MenuButton"),n=t.default.getComponent("Menu");t.default.getComponent("Component"),t.default.dom;class r extends i{constructor(e){super(e,{title:e.localize("Quality"),name:"QualityButton"})}createItems(){return[]}createMenu(){const e=new n(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}}const s=t.default.getComponent("MenuItem");class a extends s{constructor(e,t,i,n){super(e,{label:t.label,selectable:!0,selected:t.selected||!1}),this.item=t,this.qualityButton=i,this.plugin=n}handleClick(){for(let e=0;e<this.qualityButton.items.length;++e)this.qualityButton.items[e].selected(!1);this.plugin.setQuality(this.item.value),this.selected(!0)}}const o=t.default.getPlugin("plugin"),l={};class u extends o{constructor(e,i){super(e),this.options=t.default.obj.merge(l,i),this.player.ready((()=>{this.player.qualityLevels&&(this.player.addClass("vjs-hls-quality-selector"),this.createQualityButton(),this.bindPlayerEvents())}))}bindPlayerEvents(){this.player.qualityLevels().on("addqualitylevel",this.onAddQualityLevel.bind(this))}createQualityButton(){const e=this.player;this._qualityButton=new r(e);const t=e.controlBar.children().length-2,i=e.controlBar.addChild(this._qualityButton,{componentClass:"qualitySelector"},this.options.placementIndex||t);if(i.addClass("vjs-quality-selector"),this.options.displayCurrentQuality)this.setButtonInnerText(e.localize("Auto"));else{const e=` ${this.options.vjsIconClass||"vjs-icon-hd"}`;i.menuButton_.$(".vjs-icon-placeholder").className+=e}i.removeClass("vjs-hidden")}setButtonInnerText(e){this._qualityButton.menuButton_.$(".vjs-icon-placeholder").innerHTML=e}getQualityMenuItem(e){const t=this.player;return new a(t,e,this._qualityButton,this)}onAddQualityLevel(){const e=this.player.qualityLevels().levels_||[],t=[];for(let i=0;i<e.length;++i){const{width:n,height:r}=e[i],s=n>r?r:n;if(s&&!t.filter((e=>e.item&&e.item.value===s)).length){const e=this.getQualityMenuItem.call(this,{label:s+"p",value:s});t.push(e)}}t.sort(((e,t)=>"object"!=typeof e||"object"!=typeof t?-1:e.item.value<t.item.value?1:e.item.value>t.item.value?-1:0)),t.push(this.getQualityMenuItem.call(this,{label:this.player.localize("Auto"),value:"auto",selected:!0})),this._qualityButton&&(this._qualityButton.createItems=()=>t,this._qualityButton.update())}setQuality(e){const t=this.player.qualityLevels();this._currentQuality=e,this.options.displayCurrentQuality&&this.setButtonInnerText("auto"===e?this.player.localize("Auto"):`${e}p`);for(let i=0;i<t.length;++i){const{width:n,height:r}=t[i],s=n>r?r:n;t[i].enabled=s===e||"auto"===e}this._qualityButton.unpressButton();for(let e=0;e<this._qualityButton.items.length;++e)this._qualityButton.items[e].item.value==this._currentQuality?this._qualityButton.items[e].selected(!0):this._qualityButton.items[e].selected(!1)}getCurrentQuality(){return this._currentQuality||"auto"}}return u.VERSION="2.0.0",t.default.registerPlugin("hlsQualitySelector",u),u})),function e(t,i,n){function r(a,o){if(!i[a]){if(!t[a]){var l="function"==typeof require&&require;if(!o&&l)return l(a,!0);if(s)return s(a,!0);throw(l=new Error("Cannot find module '"+a+"'")).code="MODULE_NOT_FOUND",l}l=i[a]={exports:{}},t[a][0].call(l.exports,(function(e){return r(t[a][1][e]||e)}),l,l.exports,e,t,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a<n.length;a++)r(n[a]);return r}({1:[function(e,t,i){t.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},{}],2:[function(e,t,i){var n=e("../internals/is-object");t.exports=function(e){if(!n(e))throw TypeError(String(e)+" is not an object");return e}},{"../internals/is-object":33}],3:[function(e,t,i){var n=e("../internals/to-indexed-object"),r=e("../internals/to-length"),s=e("../internals/to-absolute-index");e=function(e){return function(t,i,a){var o,l=n(t),u=r(l.length),d=s(a,u);if(e&&i!=i){for(;d<u;)if((o=l[d++])!=o)return!0}else for(;d<u;d++)if((e||d in l)&&l[d]===i)return e||d||0;return!e&&-1}},t.exports={includes:e(!0),indexOf:e(!1)}},{"../internals/to-absolute-index":55,"../internals/to-indexed-object":56,"../internals/to-length":58}],4:[function(e,t,i){var n=e("../internals/function-bind-context"),r=e("../internals/indexed-object"),s=e("../internals/to-object"),a=e("../internals/to-length"),o=e("../internals/array-species-create"),l=[].push;e=function(e){var t=1==e,i=2==e,u=3==e,d=4==e,h=6==e,c=7==e,p=5==e||h;return function(m,f,g,y){for(var _,v,b=s(m),T=r(b),S=n(f,g,3),w=a(T.length),E=0,k=(y=y||o,t?y(m,w):i||c?y(m,0):void 0);E<w;E++)if((p||E in T)&&(v=S(_=T[E],E,b),e))if(t)k[E]=v;else if(v)switch(e){case 3:return!0;case 5:return _;case 6:return E;case 2:l.call(k,_)}else switch(e){case 4:return!1;case 7:l.call(k,_)}return h?-1:u||d?d:k}},t.exports={forEach:e(0),map:e(1),filter:e(2),some:e(3),every:e(4),find:e(5),findIndex:e(6),filterOut:e(7)}},{"../internals/array-species-create":6,"../internals/function-bind-context":20,"../internals/indexed-object":28,"../internals/to-length":58,"../internals/to-object":59}],5:[function(e,t,i){var n=e("../internals/fails"),r=e("../internals/well-known-symbol"),s=e("../internals/engine-v8-version"),a=r("species");t.exports=function(e){return 51<=s||!n((function(){var t=[];return(t.constructor={})[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},{"../internals/engine-v8-version":16,"../internals/fails":19,"../internals/well-known-symbol":63}],6:[function(e,t,i){var n=e("../internals/is-object"),r=e("../internals/is-array"),s=e("../internals/well-known-symbol")("species");t.exports=function(e,t){var i;return new(void 0===(i=r(e)&&("function"==typeof(i=e.constructor)&&(i===Array||r(i.prototype))||n(i)&&null===(i=i[s]))?void 0:i)?Array:i)(0===t?0:t)}},{"../internals/is-array":31,"../internals/is-object":33,"../internals/well-known-symbol":63}],7:[function(e,t,i){var n={}.toString;t.exports=function(e){return n.call(e).slice(8,-1)}},{}],8:[function(e,t,i){var n=e("../internals/has"),r=e("../internals/own-keys"),s=e("../internals/object-get-own-property-descriptor"),a=e("../internals/object-define-property");t.exports=function(e,t){for(var i=r(t),o=a.f,l=s.f,u=0;u<i.length;u++){var d=i[u];n(e,d)||o(e,d,l(t,d))}}},{"../internals/has":24,"../internals/object-define-property":39,"../internals/object-get-own-property-descriptor":40,"../internals/own-keys":47}],9:[function(e,t,i){e=e("../internals/fails"),t.exports=!e((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},{"../internals/fails":19}],10:[function(e,t,i){var n=e("../internals/descriptors"),r=e("../internals/object-define-property"),s=e("../internals/create-property-descriptor");t.exports=n?function(e,t,i){return r.f(e,t,s(1,i))}:function(e,t,i){return e[t]=i,e}},{"../internals/create-property-descriptor":11,"../internals/descriptors":12,"../internals/object-define-property":39}],11:[function(e,t,i){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],12:[function(e,t,i){e=e("../internals/fails"),t.exports=!e((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},{"../internals/fails":19}],13:[function(e,t,i){var n=e("../internals/global"),r=(e=e("../internals/is-object"),n.document),s=e(r)&&e(r.createElement);t.exports=function(e){return s?r.createElement(e):{}}},{"../internals/global":23,"../internals/is-object":33}],14:[function(e,t,i){var n=e("../internals/classof-raw");e=e("../internals/global"),t.exports="process"==n(e.process)},{"../internals/classof-raw":7,"../internals/global":23}],15:[function(e,t,i){e=e("../internals/get-built-in"),t.exports=e("navigator","userAgent")||""},{"../internals/get-built-in":22}],16:[function(e,t,i){var n,r,s=e("../internals/global");e=e("../internals/engine-user-agent"),(s=(s=(s=s.process)&&s.versions)&&s.v8)?r=(n=s.split("."))[0]+n[1]:e&&(!(n=e.match(/Edge\/(\d+)/))||74<=n[1])&&(n=e.match(/Chrome\/(\d+)/))&&(r=n[1]),t.exports=r&&+r},{"../internals/engine-user-agent":15,"../internals/global":23}],17:[function(e,t,i){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},{}],18:[function(e,t,i){var n=e("../internals/global"),r=e("../internals/object-get-own-property-descriptor").f,s=e("../internals/create-non-enumerable-property"),a=e("../internals/redefine"),o=e("../internals/set-global"),l=e("../internals/copy-constructor-properties"),u=e("../internals/is-forced");t.exports=function(e,t){var i,d,h,c=e.target,p=e.global,m=e.stat,f=p?n:m?n[c]||o(c,{}):(n[c]||{}).prototype;if(f)for(i in t){if(d=t[i],h=e.noTargetGet?(h=r(f,i))&&h.value:f[i],!u(p?i:c+(m?".":"#")+i,e.forced)&&void 0!==h){if(typeof d==typeof h)continue;l(d,h)}(e.sham||h&&h.sham)&&s(d,"sham",!0),a(f,i,d,e)}}},{"../internals/copy-constructor-properties":8,"../internals/create-non-enumerable-property":10,"../internals/global":23,"../internals/is-forced":32,"../internals/object-get-own-property-descriptor":40,"../internals/redefine":49,"../internals/set-global":51}],19:[function(e,t,i){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],20:[function(e,t,i){var n=e("../internals/a-function");t.exports=function(e,t,i){if(n(e),void 0===t)return e;switch(i){case 0:return function(){return e.call(t)};case 1:return function(i){return e.call(t,i)};case 2:return function(i,n){return e.call(t,i,n)};case 3:return function(i,n,r){return e.call(t,i,n,r)}}return function(){return e.apply(t,arguments)}}},{"../internals/a-function":1}],21:[function(e,t,i){"use strict";var n=e("../internals/a-function"),r=e("../internals/is-object"),s=[].slice,a={};t.exports=Function.bind||function(e){var t=n(this),i=s.call(arguments,1),o=function(){var n=i.concat(s.call(arguments));return this instanceof o?function(e,t,i){if(!(t in a)){for(var n=[],r=0;r<t;r++)n[r]="a["+r+"]";a[t]=Function("C,a","return new C("+n.join(",")+")")}return a[t](e,i)}(t,n.length,n):t.apply(e,n)};return r(t.prototype)&&(o.prototype=t.prototype),o}},{"../internals/a-function":1,"../internals/is-object":33}],22:[function(e,t,i){function n(e){return"function"==typeof e?e:void 0}var r=e("../internals/path"),s=e("../internals/global");t.exports=function(e,t){return arguments.length<2?n(r[e])||n(s[e]):r[e]&&r[e][t]||s[e]&&s[e][t]}},{"../internals/global":23,"../internals/path":48}],23:[function(e,t,i){(function(e){(function(){function i(e){return e&&e.Math==Math&&e}t.exports=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof e&&e)||function(){return this}()||Function("return this")()}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],24:[function(e,t,i){var n=e("../internals/to-object"),r={}.hasOwnProperty;t.exports=function(e,t){return r.call(n(e),t)}},{"../internals/to-object":59}],25:[function(e,t,i){t.exports={}},{}],26:[function(e,t,i){e=e("../internals/get-built-in"),t.exports=e("document","documentElement")},{"../internals/get-built-in":22}],27:[function(e,t,i){var n=e("../internals/descriptors"),r=e("../internals/fails"),s=e("../internals/document-create-element");t.exports=!n&&!r((function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},{"../internals/descriptors":12,"../internals/document-create-element":13,"../internals/fails":19}],28:[function(e,t,i){var n=e("../internals/fails"),r=e("../internals/classof-raw"),s="".split;t.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==r(e)?s.call(e,""):Object(e)}:Object},{"../internals/classof-raw":7,"../internals/fails":19}],29:[function(e,t,i){e=e("../internals/shared-store");var n=Function.toString;"function"!=typeof e.inspectSource&&(e.inspectSource=function(e){return n.call(e)}),t.exports=e.inspectSource},{"../internals/shared-store":53}],30:[function(e,t,i){var n,r,s,a,o,l,u,d,h=e("../internals/native-weak-map"),c=e("../internals/global"),p=e("../internals/is-object"),m=e("../internals/create-non-enumerable-property"),f=e("../internals/has"),g=e("../internals/shared-store"),y=e("../internals/shared-key"),_=(e=e("../internals/hidden-keys"),"Object already initialized");c=c.WeakMap,u=h?(n=g.state||(g.state=new c),r=n.get,s=n.has,a=n.set,o=function(e,t){if(s.call(n,e))throw new TypeError(_);return t.facade=e,a.call(n,e,t),t},l=function(e){return r.call(n,e)||{}},function(e){return s.call(n,e)}):(e[d=y("state")]=!0,o=function(e,t){if(f(e,d))throw new TypeError(_);return t.facade=e,m(e,d,t),t},l=function(e){return f(e,d)?e[d]:{}},function(e){return f(e,d)}),t.exports={set:o,get:l,has:u,enforce:function(e){return u(e)?l(e):o(e,{})},getterFor:function(e){return function(t){var i;if(!p(t)||(i=l(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return i}}}},{"../internals/create-non-enumerable-property":10,"../internals/global":23,"../internals/has":24,"../internals/hidden-keys":25,"../internals/is-object":33,"../internals/native-weak-map":36,"../internals/shared-key":52,"../internals/shared-store":53}],31:[function(e,t,i){var n=e("../internals/classof-raw");t.exports=Array.isArray||function(e){return"Array"==n(e)}},{"../internals/classof-raw":7}],32:[function(e,t,i){var n=e("../internals/fails"),r=/#|\.prototype\./,s=(e=function(e,t){return(e=a[s(e)])==l||e!=o&&("function"==typeof t?n(t):!!t)},e.normalize=function(e){return String(e).replace(r,".").toLowerCase()}),a=e.data={},o=e.NATIVE="N",l=e.POLYFILL="P";t.exports=e},{"../internals/fails":19}],33:[function(e,t,i){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],34:[function(e,t,i){t.exports=!1},{}],35:[function(e,t,i){var n=e("../internals/engine-is-node"),r=e("../internals/engine-v8-version");e=e("../internals/fails"),t.exports=!!Object.getOwnPropertySymbols&&!e((function(){return!Symbol.sham&&(n?38===r:37<r&&r<41)}))},{"../internals/engine-is-node":14,"../internals/engine-v8-version":16,"../internals/fails":19}],36:[function(e,t,i){var n=e("../internals/global");e=e("../internals/inspect-source"),n=n.WeakMap,t.exports="function"==typeof n&&/native code/.test(e(n))},{"../internals/global":23,"../internals/inspect-source":29}],37:[function(e,t,i){function n(){}function r(e){return"<script>"+e+"</"+p+">"}var s,a=e("../internals/an-object"),o=e("../internals/object-define-properties"),l=e("../internals/enum-bug-keys"),u=e("../internals/hidden-keys"),d=e("../internals/html"),h=e("../internals/document-create-element"),c=(e=e("../internals/shared-key"),"prototype"),p="script",m=e("IE_PROTO"),f=function(){try{s=document.domain&&new ActiveXObject("htmlfile")}catch(e){}var e;f=s?function(e){e.write(r("")),e.close();var t=e.parentWindow.Object;return e=null,t}(s):((e=h("iframe")).style.display="none",d.appendChild(e),e.src=String("javascript:"),(e=e.contentWindow.document).open(),e.write(r("document.F=Object")),e.close(),e.F);for(var t=l.length;t--;)delete f[c][l[t]];return f()};u[m]=!0,t.exports=Object.create||function(e,t){var i;return null!==e?(n[c]=a(e),i=new n,n[c]=null,i[m]=e):i=f(),void 0===t?i:o(i,t)}},{"../internals/an-object":2,"../internals/document-create-element":13,"../internals/enum-bug-keys":17,"../internals/hidden-keys":25,"../internals/html":26,"../internals/object-define-properties":38,"../internals/shared-key":52}],38:[function(e,t,i){var n=e("../internals/descriptors"),r=e("../internals/object-define-property"),s=e("../internals/an-object"),a=e("../internals/object-keys");t.exports=n?Object.defineProperties:function(e,t){s(e);for(var i,n=a(t),o=n.length,l=0;l<o;)r.f(e,i=n[l++],t[i]);return e}},{"../internals/an-object":2,"../internals/descriptors":12,"../internals/object-define-property":39,"../internals/object-keys":45}],39:[function(e,t,i){var n=e("../internals/descriptors"),r=e("../internals/ie8-dom-define"),s=e("../internals/an-object"),a=e("../internals/to-primitive"),o=Object.defineProperty;i.f=n?o:function(e,t,i){if(s(e),t=a(t,!0),s(i),r)try{return o(e,t,i)}catch(e){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},{"../internals/an-object":2,"../internals/descriptors":12,"../internals/ie8-dom-define":27,"../internals/to-primitive":60}],40:[function(e,t,i){var n=e("../internals/descriptors"),r=e("../internals/object-property-is-enumerable"),s=e("../internals/create-property-descriptor"),a=e("../internals/to-indexed-object"),o=e("../internals/to-primitive"),l=e("../internals/has"),u=e("../internals/ie8-dom-define"),d=Object.getOwnPropertyDescriptor;i.f=n?d:function(e,t){if(e=a(e),t=o(t,!0),u)try{return d(e,t)}catch(e){}if(l(e,t))return s(!r.f.call(e,t),e[t])}},{"../internals/create-property-descriptor":11,"../internals/descriptors":12,"../internals/has":24,"../internals/ie8-dom-define":27,"../internals/object-property-is-enumerable":46,"../internals/to-indexed-object":56,"../internals/to-primitive":60}],41:[function(e,t,i){var n=e("../internals/object-keys-internal"),r=e("../internals/enum-bug-keys").concat("length","prototype");i.f=Object.getOwnPropertyNames||function(e){return n(e,r)}},{"../internals/enum-bug-keys":17,"../internals/object-keys-internal":44}],42:[function(e,t,i){i.f=Object.getOwnPropertySymbols},{}],43:[function(e,t,i){var n=e("../internals/has"),r=e("../internals/to-object"),s=e("../internals/shared-key"),a=(e=e("../internals/correct-prototype-getter"),s("IE_PROTO")),o=Object.prototype;t.exports=e?Object.getPrototypeOf:function(e){return e=r(e),n(e,a)?e[a]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?o:null}},{"../internals/correct-prototype-getter":9,"../internals/has":24,"../internals/shared-key":52,"../internals/to-object":59}],44:[function(e,t,i){var n=e("../internals/has"),r=e("../internals/to-indexed-object"),s=e("../internals/array-includes").indexOf,a=e("../internals/hidden-keys");t.exports=function(e,t){var i,o=r(e),l=0,u=[];for(i in o)!n(a,i)&&n(o,i)&&u.push(i);for(;t.length>l;)n(o,i=t[l++])&&(~s(u,i)||u.push(i));return u}},{"../internals/array-includes":3,"../internals/has":24,"../internals/hidden-keys":25,"../internals/to-indexed-object":56}],45:[function(e,t,i){var n=e("../internals/object-keys-internal"),r=e("../internals/enum-bug-keys");t.exports=Object.keys||function(e){return n(e,r)}},{"../internals/enum-bug-keys":17,"../internals/object-keys-internal":44}],46:[function(e,t,i){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,s=r&&!n.call({1:2},1);i.f=s?function(e){return!!(e=r(this,e))&&e.enumerable}:n},{}],47:[function(e,t,i){var n=e("../internals/get-built-in"),r=e("../internals/object-get-own-property-names"),s=e("../internals/object-get-own-property-symbols"),a=e("../internals/an-object");t.exports=n("Reflect","ownKeys")||function(e){var t=r.f(a(e)),i=s.f;return i?t.concat(i(e)):t}},{"../internals/an-object":2,"../internals/get-built-in":22,"../internals/object-get-own-property-names":41,"../internals/object-get-own-property-symbols":42}],48:[function(e,t,i){e=e("../internals/global"),t.exports=e},{"../internals/global":23}],49:[function(e,t,i){var n=e("../internals/global"),r=e("../internals/create-non-enumerable-property"),s=e("../internals/has"),a=e("../internals/set-global"),o=e("../internals/inspect-source"),l=(e=e("../internals/internal-state")).get,u=e.enforce,d=String(String).split("String");(t.exports=function(e,t,i,o){var l=!!o&&!!o.unsafe,h=!!o&&!!o.enumerable,c=!!o&&!!o.noTargetGet;"function"==typeof i&&("string"!=typeof t||s(i,"name")||r(i,"name",t),(o=u(i)).source||(o.source=d.join("string"==typeof t?t:""))),e!==n?(l?!c&&e[t]&&(h=!0):delete e[t],h?e[t]=i:r(e,t,i)):h?e[t]=i:a(t,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&l(this).source||o(this)}))},{"../internals/create-non-enumerable-property":10,"../internals/global":23,"../internals/has":24,"../internals/inspect-source":29,"../internals/internal-state":30,"../internals/set-global":51}],50:[function(e,t,i){t.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},{}],51:[function(e,t,i){var n=e("../internals/global"),r=e("../internals/create-non-enumerable-property");t.exports=function(e,t){try{r(n,e,t)}catch(i){n[e]=t}return t}},{"../internals/create-non-enumerable-property":10,"../internals/global":23}],52:[function(e,t,i){var n=e("../internals/shared"),r=e("../internals/uid"),s=n("keys");t.exports=function(e){return s[e]||(s[e]=r(e))}},{"../internals/shared":54,"../internals/uid":61}],53:[function(e,t,i){var n=e("../internals/global"),r=e("../internals/set-global");e=n[e="__core-js_shared__"]||r(e,{}),t.exports=e},{"../internals/global":23,"../internals/set-global":51}],54:[function(e,t,i){var n=e("../internals/is-pure"),r=e("../internals/shared-store");(t.exports=function(e,t){return r[e]||(r[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.11.0",mode:n?"pure":"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})},{"../internals/is-pure":34,"../internals/shared-store":53}],55:[function(e,t,i){var n=e("../internals/to-integer"),r=Math.max,s=Math.min;t.exports=function(e,t){return(e=n(e))<0?r(e+t,0):s(e,t)}},{"../internals/to-integer":57}],56:[function(e,t,i){var n=e("../internals/indexed-object"),r=e("../internals/require-object-coercible");t.exports=function(e){return n(r(e))}},{"../internals/indexed-object":28,"../internals/require-object-coercible":50}],57:[function(e,t,i){var n=Math.ceil,r=Math.floor;t.exports=function(e){return isNaN(e=+e)?0:(0<e?r:n)(e)}},{}],58:[function(e,t,i){var n=e("../internals/to-integer"),r=Math.min;t.exports=function(e){return 0<e?r(n(e),9007199254740991):0}},{"../internals/to-integer":57}],59:[function(e,t,i){var n=e("../internals/require-object-coercible");t.exports=function(e){return Object(n(e))}},{"../internals/require-object-coercible":50}],60:[function(e,t,i){var n=e("../internals/is-object");t.exports=function(e,t){if(!n(e))return e;var i,r;if(t&&"function"==typeof(i=e.toString)&&!n(r=i.call(e)))return r;if("function"==typeof(i=e.valueOf)&&!n(r=i.call(e)))return r;if(!t&&"function"==typeof(i=e.toString)&&!n(r=i.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},{"../internals/is-object":33}],61:[function(e,t,i){var n=0,r=Math.random();t.exports=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++n+r).toString(36)}},{}],62:[function(e,t,i){e=e("../internals/native-symbol"),t.exports=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},{"../internals/native-symbol":35}],63:[function(e,t,i){var n=e("../internals/global"),r=e("../internals/shared"),s=e("../internals/has"),a=e("../internals/uid"),o=e("../internals/native-symbol"),l=(e=e("../internals/use-symbol-as-uid"),r("wks")),u=n.Symbol,d=e?u:u&&u.withoutSetter||a;t.exports=function(e){return s(l,e)&&(o||"string"==typeof l[e])||(o&&s(u,e)?l[e]=u[e]:l[e]=d("Symbol."+e)),l[e]}},{"../internals/global":23,"../internals/has":24,"../internals/native-symbol":35,"../internals/shared":54,"../internals/uid":61,"../internals/use-symbol-as-uid":62}],64:[function(e,t,i){"use strict";var n=e("../internals/export"),r=e("../internals/array-iteration").map;n({target:"Array",proto:!0,forced:!e("../internals/array-method-has-species-support")("map")},{map:function(e){return r(this,e,1<arguments.length?arguments[1]:void 0)}})},{"../internals/array-iteration":4,"../internals/array-method-has-species-support":5,"../internals/export":18}],65:[function(e,t,i){var n=e("../internals/export"),r=e("../internals/get-built-in"),s=e("../internals/a-function"),a=e("../internals/an-object"),o=e("../internals/is-object"),l=e("../internals/object-create"),u=e("../internals/function-bind"),d=(e=e("../internals/fails"),r("Reflect","construct")),h=e((function(){function e(){}return!(d((function(){}),[],e)instanceof e)})),c=!e((function(){d((function(){}))}));n({target:"Reflect",stat:!0,forced:e=h||c,sham:e},{construct:function(e,t){s(e),a(t);var i=arguments.length<3?e:s(arguments[2]);if(c&&!h)return d(e,t,i);if(e==i){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return n.push.apply(n,t),new(u.apply(e,n))}return n=i.prototype,i=l(o(n)?n:Object.prototype),n=Function.apply.call(e,i,t),o(n)?n:i}})},{"../internals/a-function":1,"../internals/an-object":2,"../internals/export":18,"../internals/fails":19,"../internals/function-bind":21,"../internals/get-built-in":22,"../internals/is-object":33,"../internals/object-create":37}],66:[function(e,t,i){var n=e("../internals/export"),r=e("../internals/is-object"),s=e("../internals/an-object"),a=e("../internals/has"),o=e("../internals/object-get-own-property-descriptor"),l=e("../internals/object-get-prototype-of");n({target:"Reflect",stat:!0},{get:function e(t,i){var n,u=arguments.length<3?t:arguments[2];return s(t)===u?t[i]:(n=o.f(t,i))?a(n,"value")?n.value:void 0===n.get?void 0:n.get.call(u):r(n=l(t))?e(n,i,u):void 0}})},{"../internals/an-object":2,"../internals/export":18,"../internals/has":24,"../internals/is-object":33,"../internals/object-get-own-property-descriptor":40,"../internals/object-get-prototype-of":43}],67:[function(e,t,i){(function(e){(function(){var n,r,s,a;n=this,r=function(){var t="object"==typeof self&&self.self===self&&self||"object"==typeof e&&e.global===e&&e||Function("return this")()||{},i=Array.prototype,n=Object.prototype,r="undefined"!=typeof Symbol?Symbol.prototype:null,s=i.push,a=i.slice,o=n.toString,l=n.hasOwnProperty,u="undefined"!=typeof ArrayBuffer,d="undefined"!=typeof DataView,h=Array.isArray,c=Object.keys,p=Object.create,m=u&&ArrayBuffer.isView,f=isNaN,g=isFinite,y=!{toString:null}.propertyIsEnumerable("toString"),_=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],v=Math.pow(2,53)-1;function b(e,t){return t=null==t?e.length-1:+t,function(){for(var i=Math.max(arguments.length-t,0),n=Array(i),r=0;r<i;r++)n[r]=arguments[r+t];switch(t){case 0:return e.call(this,n);case 1:return e.call(this,arguments[0],n);case 2:return e.call(this,arguments[0],arguments[1],n)}var s=Array(t+1);for(r=0;r<t;r++)s[r]=arguments[r];return s[t]=n,e.apply(this,s)}}function T(e){var t=typeof e;return"function"==t||"object"==t&&!!e}function S(e){return void 0===e}function w(e){return!0===e||!1===e||"[object Boolean]"===o.call(e)}function E(e){var t="[object "+e+"]";return function(e){return o.call(e)===t}}var k=E("String"),C=E("Number"),x=E("Date"),I=E("RegExp"),A=E("Error"),O=E("Symbol"),P=E("ArrayBuffer"),L=E("Function"),D=t.document&&t.document.childNodes,N=L="function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof D?function(e){return"function"==typeof e||!1}:L,M=E("Object"),R=d&&M(new DataView(new ArrayBuffer(8))),U="undefined"!=typeof Map&&M(new Map),j=E("DataView"),B=R?function(e){return null!=e&&N(e.getInt8)&&P(e.buffer)}:j,F=h||E("Array");function q(e,t){return null!=e&&l.call(e,t)}var H=E("Arguments");!function(){H(arguments)||(H=function(e){return q(e,"callee")})}();var V=H;function $(e){return C(e)&&f(e)}function W(e){return function(){return e}}function z(e){return function(t){return"number"==typeof(t=e(t))&&0<=t&&t<=v}}function G(e){return function(t){return null==t?void 0:t[e]}}var X=G("byteLength"),K=z(X),Q=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/,Y=u?function(e){return m?m(e)&&!B(e):K(e)&&Q.test(o.call(e))}:W(!1),J=G("length");function Z(e,t){t=function(e){for(var t={},i=e.length,n=0;n<i;++n)t[e[n]]=!0;return{contains:function(e){return t[e]},push:function(i){return t[i]=!0,e.push(i)}}}(t);var i=_.length,r=e.constructor,s=N(r)&&r.prototype||n,a="constructor";for(q(e,a)&&!t.contains(a)&&t.push(a);i--;)(a=_[i])in e&&e[a]!==s[a]&&!t.contains(a)&&t.push(a)}function ee(e){if(!T(e))return[];if(c)return c(e);var t,i=[];for(t in e)q(e,t)&&i.push(t);return y&&Z(e,i),i}function te(e,t){var i=ee(t),n=i.length;if(null==e)return!n;for(var r=Object(e),s=0;s<n;s++){var a=i[s];if(t[a]!==r[a]||!(a in r))return!1}return!0}function ie(e){return e instanceof ie?e:this instanceof ie?void(this._wrapped=e):new ie(e)}function ne(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,X(e))}ie.VERSION="1.13.1",ie.prototype.valueOf=ie.prototype.toJSON=ie.prototype.value=function(){return this._wrapped},ie.prototype.toString=function(){return String(this._wrapped)};var re="[object DataView]";function se(e,t,i,n){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!=e)return t!=t;var s=typeof e;return("function"==s||"object"==s||"object"==typeof t)&&function e(t,i,n,s){if(t instanceof ie&&(t=t._wrapped),i instanceof ie&&(i=i._wrapped),(l=o.call(t))!==o.call(i))return!1;if(R&&"[object Object]"==l&&B(t)){if(!B(i))return!1;l=re}switch(l){case"[object RegExp]":case"[object String]":return""+t==""+i;case"[object Number]":return+t!=+t?+i!=+i:0==+t?1/+t==1/i:+t==+i;case"[object Date]":case"[object Boolean]":return+t==+i;case"[object Symbol]":return r.valueOf.call(t)===r.valueOf.call(i);case"[object ArrayBuffer]":case re:return e(ne(t),ne(i),n,s)}var a="[object Array]"===l;if(!a&&Y(t)){if((u=X(t))!==X(i))return!1;if(t.buffer===i.buffer&&t.byteOffset===i.byteOffset)return!0;a=!0}if(!a){if("object"!=typeof t||"object"!=typeof i)return!1;var l,u;if((l=t.constructor)!==(u=i.constructor)&&!(N(l)&&l instanceof l&&N(u)&&u instanceof u)&&"constructor"in t&&"constructor"in i)return!1}s=s||[];for(var d=(n=n||[]).length;d--;)if(n[d]===t)return s[d]===i;if(n.push(t),s.push(i),a){if((d=t.length)!==i.length)return!1;for(;d--;)if(!se(t[d],i[d],n,s))return!1}else{var h,c=ee(t);if(d=c.length,ee(i).length!==d)return!1;for(;d--;)if(!q(i,h=c[d])||!se(t[h],i[h],n,s))return!1}return n.pop(),s.pop(),!0}(e,t,i,n)}function ae(e){if(!T(e))return[];var t,i=[];for(t in e)i.push(t);return y&&Z(e,i),i}function oe(e){var t=J(e);return function(i){if(null==i)return!1;var n=ae(i);if(J(n))return!1;for(var r=0;r<t;r++)if(!N(i[e[r]]))return!1;return e!==de||!N(i[le])}}var le="forEach",ue=(kt=["clear","delete"]).concat(le,Et=["get","has","set"]),de=kt.concat(Et),he=["add"].concat(kt,le,"has"),ce=U?oe(ue):E("Map"),pe=U?oe(de):E("WeakMap"),me=U?oe(he):E("Set"),fe=E("WeakSet");function ge(e){for(var t=ee(e),i=t.length,n=Array(i),r=0;r<i;r++)n[r]=e[t[r]];return n}function ye(e){for(var t={},i=ee(e),n=0,r=i.length;n<r;n++)t[e[i[n]]]=i[n];return t}function _e(e){var t,i=[];for(t in e)N(e[t])&&i.push(t);return i.sort()}function ve(e,t){return function(i){var n=arguments.length;if(t&&(i=Object(i)),n<2||null==i)return i;for(var r=1;r<n;r++)for(var s=arguments[r],a=e(s),o=a.length,l=0;l<o;l++){var u=a[l];t&&void 0!==i[u]||(i[u]=s[u])}return i}}var be=ve(ae),Te=ve(ee),Se=ve(ae,!0);function we(e){if(!T(e))return{};if(p)return p(e);var t=function(){};return t.prototype=e,e=new t,t.prototype=null,e}function Ee(e){return T(e)?F(e)?e.slice():be({},e):e}function ke(e){return F(e)?e:[e]}function Ce(e){return ie.toPath(e)}function xe(e,t){for(var i=t.length,n=0;n<i;n++){if(null==e)return;e=e[t[n]]}return i?e:void 0}function Ie(e,t,i){return S(t=xe(e,Ce(t)))?i:t}function Ae(e){return e}function Oe(e){return e=Te({},e),function(t){return te(t,e)}}function Pe(e){return e=Ce(e),function(t){return xe(t,e)}}function Le(e,t,i){if(void 0===t)return e;switch(null==i?3:i){case 1:return function(i){return e.call(t,i)};case 3:return function(i,n,r){return e.call(t,i,n,r)};case 4:return function(i,n,r,s){return e.call(t,i,n,r,s)}}return function(){return e.apply(t,arguments)}}function De(e,t,i){return null==e?Ae:N(e)?Le(e,t,i):(T(e)&&!F(e)?Oe:Pe)(e)}function Ne(e,t){return De(e,t,1/0)}function Me(e,t,i){return ie.iteratee!==Ne?ie.iteratee(e,t):De(e,t,i)}function Re(){}function Ue(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))}ie.toPath=ke,ie.iteratee=Ne;var je=Date.now||function(){return(new Date).getTime()};function Be(e){function t(t){return e[t]}var i="(?:"+ee(e).join("|")+")",n=RegExp(i),r=RegExp(i,"g");return function(e){return n.test(e=null==e?"":""+e)?e.replace(r,t):e}}var Fe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},qe=Be(Fe),He=Be(ye(Fe)),Ve=ie.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},$e=/(.)^/,We={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},ze=/\\|'|\r|\n|\u2028|\u2029/g;function Ge(e){return"\\"+We[e]}var Xe=/^\s*(\w|\$)+\s*$/,Ke=0;function Qe(e,t,i,n,r){return n instanceof t?(i=we(e.prototype),T(r=e.apply(i,r))?r:i):e.apply(i,r)}var Ye=b((function(e,t){var i=Ye.placeholder,n=function(){for(var r=0,s=t.length,a=Array(s),o=0;o<s;o++)a[o]=t[o]===i?arguments[r++]:t[o];for(;r<arguments.length;)a.push(arguments[r++]);return Qe(e,n,this,this,a)};return n}));Ye.placeholder=ie;var Je=b((function(e,t,i){if(!N(e))throw new TypeError("Bind must be called on a function");var n=b((function(r){return Qe(e,n,t,this,i.concat(r))}));return n})),Ze=z(J);function et(e,t,i,n){if(n=n||[],t||0===t){if(t<=0)return n.concat(e)}else t=1/0;for(var r=n.length,s=0,a=J(e);s<a;s++){var o=e[s];if(Ze(o)&&(F(o)||V(o)))if(1<t)et(o,t-1,i,n),r=n.length;else for(var l=0,u=o.length;l<u;)n[r++]=o[l++];else i||(n[r++]=o)}return n}var tt=b((function(e,t){var i=(t=et(t,!1,!1)).length;if(i<1)throw new Error("bindAll must be passed function names");for(;i--;){var n=t[i];e[n]=Je(e[n],e)}return e})),it=b((function(e,t,i){return setTimeout((function(){return e.apply(null,i)}),t)})),nt=Ye(it,ie,1);function rt(e){return function(){return!e.apply(this,arguments)}}function st(e,t){var i;return function(){return 0<--e&&(i=t.apply(this,arguments)),e<=1&&(t=null),i}}function at(e,t,i){t=Me(t,i);for(var n,r=ee(e),s=0,a=r.length;s<a;s++)if(t(e[n=r[s]],n,e))return n}function ot(e){return function(t,i,n){i=Me(i,n);for(var r=J(t),s=0<e?0:r-1;0<=s&&s<r;s+=e)if(i(t[s],s,t))return s;return-1}}t=Ye(st,2);var lt=ot(1);function ut(e,t,i,n){for(var r=(i=Me(i,n,1))(t),s=0,a=J(e);s<a;){var o=Math.floor((s+a)/2);i(e[o])<r?s=o+1:a=o}return s}function dt(e,t,i){return function(n,r,s){var o=0,l=J(n);if("number"==typeof s)0<e?o=0<=s?s:Math.max(s+l,o):l=0<=s?Math.min(s+1,l):s+l+1;else if(i&&s&&l)return n[s=i(n,r)]===r?s:-1;if(r!=r)return 0<=(s=t(a.call(n,o,l),$))?s+o:-1;for(s=0<e?o:l-1;0<=s&&s<l;s+=e)if(n[s]===r)return s;return-1}}D=ot(-1);var ht=dt(1,lt,ut);function ct(e,t,i){if(void 0!==(i=(Ze(e)?lt:at)(e,t,i))&&-1!==i)return e[i]}function pt(e,t,i){if(t=Le(t,i),Ze(e))for(r=0,s=e.length;r<s;r++)t(e[r],r,e);else for(var n=ee(e),r=0,s=n.length;r<s;r++)t(e[n[r]],n[r],e);return e}function mt(e,t,i){t=Me(t,i);for(var n=!Ze(e)&&ee(e),r=(n||e).length,s=Array(r),a=0;a<r;a++){var o=n?n[a]:a;s[a]=t(e[o],o,e)}return s}function ft(e){return function(t,i,n,r){var s=3<=arguments.length;return function(t,i,n,r){var s=!Ze(t)&&ee(t),a=(s||t).length,o=0<e?0:a-1;for(r||(n=t[s?s[o]:o],o+=e);0<=o&&o<a;o+=e){var l=s?s[o]:o;n=i(n,t[l],l,t)}return n}(t,Le(i,r,4),n,s)}}function gt(e,t,i){var n=[];return t=Me(t,i),pt(e,(function(e,i,r){t(e,i,r)&&n.push(e)})),n}function yt(e,t,i){t=Me(t,i);for(var n=!Ze(e)&&ee(e),r=(n||e).length,s=0;s<r;s++){var a=n?n[s]:s;if(!t(e[a],a,e))return!1}return!0}function _t(e,t,i){t=Me(t,i);for(var n=!Ze(e)&&ee(e),r=(n||e).length,s=0;s<r;s++){var a=n?n[s]:s;if(t(e[a],a,e))return!0}return!1}function vt(e,t,i,n){return Ze(e)||(e=ge(e)),0<=ht(e,t,i="number"!=typeof i||n?0:i)}function bt(e,t){return mt(e,Pe(t))}function Tt(e,t,i){var n,r,s=-1/0,a=-1/0;if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e)for(var o=0,l=(e=Ze(e)?e:ge(e)).length;o<l;o++)null!=(n=e[o])&&s<n&&(s=n);else t=Me(t,i),pt(e,(function(e,i,n){r=t(e,i,n),(a<r||r===-1/0&&s===-1/0)&&(s=e,a=r)}));return s}function St(e,t,i){if(null==t||i)return(e=Ze(e)?e:ge(e))[Ue(e.length-1)];var n=(Ze(e)?Ee:ge)(e);e=J(n),t=Math.max(Math.min(t,e),0);for(var r=e-1,s=0;s<t;s++){var a=Ue(s,r),o=n[s];n[s]=n[a],n[a]=o}return n.slice(0,t)}function wt(e,t){return function(i,n,r){var s=t?[[],[]]:{};return n=Me(n,r),pt(i,(function(t,r){r=n(t,r,i),e(s,t,r)})),s}}L=dt(-1,D),d=ft(1),M=ft(-1),j=b((function(e,t,i){var n,r;return N(t)?r=t:(t=Ce(t),n=t.slice(0,-1),t=t[t.length-1]),mt(e,(function(e){var s=r;if(!s){if(null==(e=n&&n.length?xe(e,n):e))return;s=e[t]}return null==s?s:s.apply(e,i)}))})),h=wt((function(e,t,i){q(e,i)?e[i].push(t):e[i]=[t]})),u=wt((function(e,t,i){e[i]=t}));var Et=wt((function(e,t,i){q(e,i)?e[i]++:e[i]=1})),kt=wt((function(e,t,i){e[i?0:1].push(t)}),!0),Ct=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function xt(e,t,i){return t in i}var It=b((function(e,t){var i={},n=t[0];if(null==e)return i;N(n)?(1<t.length&&(n=Le(n,t[1])),t=ae(e)):(n=xt,t=et(t,!1,!1),e=Object(e));for(var r=0,s=t.length;r<s;r++){var a=t[r],o=e[a];n(o,a,e)&&(i[a]=o)}return i}));function At(e,t,i){return a.call(e,0,Math.max(0,e.length-(null==t||i?1:t)))}function Ot(e,t,i){return null==e||e.length<1?null==t||i?void 0:[]:null==t||i?e[0]:At(e,e.length-t)}function Pt(e,t,i){return a.call(e,null==t||i?1:t)}ue=b((function(e,t){var i,n=t[0];return N(n)?(n=rt(n),1<t.length&&(i=t[1])):(t=mt(et(t,!1,!1),String),n=function(e,i){return!vt(t,i)}),It(e,n,i)}));var Lt=b((function(e,t){return t=et(t,!0,!0),gt(e,(function(e){return!vt(t,e)}))}));function Dt(e,t,i,n){w(t)||(n=i,i=t,t=!1),null!=i&&(i=Me(i,n));for(var r=[],s=[],a=0,o=J(e);a<o;a++){var l=e[a],u=i?i(l,a,e):l;t&&!i?(a&&s===u||r.push(l),s=u):i?vt(s,u)||(s.push(u),r.push(l)):vt(r,l)||r.push(l)}return r}function Nt(e){for(var t=e&&Tt(e,J).length||0,i=Array(t),n=0;n<t;n++)i[n]=bt(e,n);return i}function Mt(e,t){return e._chain?ie(t).chain():t}function Rt(e){return pt(_e(e),(function(t){var i=ie[t]=e[t];ie.prototype[t]=function(){var e=[this._wrapped];return s.apply(e,arguments),Mt(this,i.apply(ie,e))}})),ie}return U=b((function(e,t){return Lt(e,t)})),he=b((function(e){return Dt(et(e,!0,!0))})),Fe=b(Nt),pt(["pop","push","reverse","shift","sort","splice","unshift"],(function(e){var t=i[e];ie.prototype[e]=function(){var i=this._wrapped;return null!=i&&(t.apply(i,arguments),"shift"!==e&&"splice"!==e||0!==i.length||delete i[0]),Mt(this,i)}})),pt(["concat","join","slice"],(function(e){var t=i[e];ie.prototype[e]=function(){var e=this._wrapped;return Mt(this,e=null!=e?t.apply(e,arguments):e)}})),Fe=Rt({__proto__:null,VERSION:"1.13.1",restArguments:b,isObject:T,isNull:function(e){return null===e},isUndefined:S,isBoolean:w,isElement:function(e){return!(!e||1!==e.nodeType)},isString:k,isNumber:C,isDate:x,isRegExp:I,isError:A,isSymbol:O,isArrayBuffer:P,isDataView:B,isArray:F,isFunction:N,isArguments:V,isFinite:function(e){return!O(e)&&g(e)&&!isNaN(parseFloat(e))},isNaN:$,isTypedArray:Y,isEmpty:function(e){if(null==e)return!0;var t=J(e);return"number"==typeof t&&(F(e)||k(e)||V(e))?0===t:0===J(ee(e))},isMatch:te,isEqual:function(e,t){return se(e,t)},isMap:ce,isWeakMap:pe,isSet:me,isWeakSet:fe,keys:ee,allKeys:ae,values:ge,pairs:function(e){for(var t=ee(e),i=t.length,n=Array(i),r=0;r<i;r++)n[r]=[t[r],e[t[r]]];return n},invert:ye,functions:_e,methods:_e,extend:be,extendOwn:Te,assign:Te,defaults:Se,create:function(e,t){return e=we(e),t&&Te(e,t),e},clone:Ee,tap:function(e,t){return t(e),e},get:Ie,has:function(e,t){for(var i=(t=Ce(t)).length,n=0;n<i;n++){var r=t[n];if(!q(e,r))return!1;e=e[r]}return!!i},mapObject:function(e,t,i){t=Me(t,i);for(var n=ee(e),r=n.length,s={},a=0;a<r;a++){var o=n[a];s[o]=t(e[o],o,e)}return s},identity:Ae,constant:W,noop:Re,toPath:ke,property:Pe,propertyOf:function(e){return null==e?Re:function(t){return Ie(e,t)}},matcher:Oe,matches:Oe,times:function(e,t,i){var n=Array(Math.max(0,e));t=Le(t,i,1);for(var r=0;r<e;r++)n[r]=t(r);return n},random:Ue,now:je,escape:qe,unescape:He,templateSettings:Ve,template:function(e,t,i){t=Se({},t=!t&&i?i:t,ie.templateSettings),i=RegExp([(t.escape||$e).source,(t.interpolate||$e).source,(t.evaluate||$e).source].join("|")+"|$","g");var n,r=0,s="__p+='";if(e.replace(i,(function(t,i,n,a,o){return s+=e.slice(r,o).replace(ze,Ge),r=o+t.length,i?s+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'":n?s+="'+\n((__t=("+n+"))==null?'':__t)+\n'":a&&(s+="';\n"+a+"\n__p+='"),t})),s+="';\n",i=t.variable){if(!Xe.test(i))throw new Error("variable is not a bare identifier: "+i)}else s="with(obj||{}){\n"+s+"}\n",i="obj";s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{n=new Function(i,"_",s)}catch(t){throw t.source=s,t}return(t=function(e){return n.call(this,e,ie)}).source="function("+i+"){\n"+s+"}",t},result:function(e,t,i){var n=(t=Ce(t)).length;if(!n)return N(i)?i.call(e):i;for(var r=0;r<n;r++){var s=null==e?void 0:e[t[r]];void 0===s&&(s=i,r=n),e=N(s)?s.call(e):s}return e},uniqueId:function(e){var t=++Ke+"";return e?e+t:t},chain:function(e){return(e=ie(e))._chain=!0,e},iteratee:Ne,partial:Ye,bind:Je,bindAll:tt,memoize:function(e,t){var i=function(n){var r=i.cache,s=""+(t?t.apply(this,arguments):n);return q(r,s)||(r[s]=e.apply(this,arguments)),r[s]};return i.cache={},i},delay:it,defer:nt,throttle:function(e,t,i){var n,r,s,a,o=0;function l(){o=!1===i.leading?0:je(),n=null,a=e.apply(r,s),n||(r=s=null)}function u(){var u=je();o||!1!==i.leading||(o=u);var d=t-(u-o);return r=this,s=arguments,d<=0||t<d?(n&&(clearTimeout(n),n=null),o=u,a=e.apply(r,s),n||(r=s=null)):n||!1===i.trailing||(n=setTimeout(l,d)),a}return i=i||{},u.cancel=function(){clearTimeout(n),o=0,n=r=s=null},u},debounce:function(e,t,i){var n,r,s,a,o,l=function(){var u=je()-r;u<t?n=setTimeout(l,t-u):(n=null,i||(a=e.apply(o,s)),n||(s=o=null))},u=b((function(u){return o=this,s=u,r=je(),n||(n=setTimeout(l,t),i&&(a=e.apply(o,s))),a}));return u.cancel=function(){clearTimeout(n),n=s=o=null},u},wrap:function(e,t){return Ye(t,e)},negate:rt,compose:function(){var e=arguments,t=e.length-1;return function(){for(var i=t,n=e[t].apply(this,arguments);i--;)n=e[i].call(this,n);return n}},after:function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},before:st,once:t,findKey:at,findIndex:lt,findLastIndex:D,sortedIndex:ut,indexOf:ht,lastIndexOf:L,find:ct,detect:ct,findWhere:function(e,t){return ct(e,Oe(t))},each:pt,forEach:pt,map:mt,collect:mt,reduce:d,foldl:d,inject:d,reduceRight:M,foldr:M,filter:gt,select:gt,reject:function(e,t,i){return gt(e,rt(Me(t)),i)},every:yt,all:yt,some:_t,any:_t,contains:vt,includes:vt,include:vt,invoke:j,pluck:bt,where:function(e,t){return gt(e,Oe(t))},max:Tt,min:function(e,t,i){var n,r,s=1/0,a=1/0;if(null==t||"number"==typeof t&&"object"!=typeof e[0]&&null!=e)for(var o=0,l=(e=Ze(e)?e:ge(e)).length;o<l;o++)null!=(n=e[o])&&n<s&&(s=n);else t=Me(t,i),pt(e,(function(e,i,n){((r=t(e,i,n))<a||r===1/0&&s===1/0)&&(s=e,a=r)}));return s},shuffle:function(e){return St(e,1/0)},sample:St,sortBy:function(e,t,i){var n=0;return t=Me(t,i),bt(mt(e,(function(e,i,r){return{value:e,index:n++,criteria:t(e,i,r)}})).sort((function(e,t){var i=e.criteria,n=t.criteria;if(i!==n){if(n<i||void 0===i)return 1;if(i<n||void 0===n)return-1}return e.index-t.index})),"value")},groupBy:h,indexBy:u,countBy:Et,partition:kt,toArray:function(e){return e?F(e)?a.call(e):k(e)?e.match(Ct):Ze(e)?mt(e,Ae):ge(e):[]},size:function(e){return null==e?0:(Ze(e)?e:ee(e)).length},pick:It,omit:ue,first:Ot,head:Ot,take:Ot,initial:At,last:function(e,t,i){return null==e||e.length<1?null==t||i?void 0:[]:null==t||i?e[e.length-1]:Pt(e,Math.max(0,e.length-t))},rest:Pt,tail:Pt,drop:Pt,compact:function(e){return gt(e,Boolean)},flatten:function(e,t){return et(e,t,!1)},without:U,uniq:Dt,unique:Dt,union:he,intersection:function(e){for(var t=[],i=arguments.length,n=0,r=J(e);n<r;n++){var s=e[n];if(!vt(t,s)){for(var a=1;a<i&&vt(arguments[a],s);a++);a===i&&t.push(s)}}return t},difference:Lt,unzip:Nt,transpose:Nt,zip:Fe,object:function(e,t){for(var i={},n=0,r=J(e);n<r;n++)t?i[e[n]]=t[n]:i[e[n][0]]=e[n][1];return i},range:function(e,t,i){null==t&&(t=e||0,e=0),i=i||(t<e?-1:1);for(var n=Math.max(Math.ceil((t-e)/i),0),r=Array(n),s=0;s<n;s++,e+=i)r[s]=e;return r},chunk:function(e,t){if(null==t||t<1)return[];for(var i=[],n=0,r=e.length;n<r;)i.push(a.call(e,n,n+=t));return i},mixin:Rt,default:ie}),Fe._=Fe},"object"==typeof i&&void 0!==t?t.exports=r():"function"==typeof define&&define.amd?define("underscore",r):(n="undefined"!=typeof globalThis?globalThis:n||self,s=n._,(a=n._=r()).noConflict=function(){return n._=s,a})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],68:[function(e,t,i){"use strict";function n(){return(n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=s(e)););return e}(e,t);if(n)return(t=Object.getOwnPropertyDescriptor(n,t)).get?t.get.call(arguments.length<3?e:i):t.value}).apply(this,arguments)}function r(e,t){return(r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}e("core-js/modules/es.reflect.construct.js"),e("core-js/modules/es.reflect.get.js");var a=e("underscore"),o=e("../events");t.exports=function(e){var t=e.getComponent("MenuItem");return function(){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)}(u,t);var e,i,l=function(e){var t=function(){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}}();return function(){var i,n=s(e);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,t?(i=s(this).constructor,Reflect.construct(n,arguments,i)):n.apply(this,arguments))}}(u);function u(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u);var i=t.source;if(!a.isObject(i))throw new Error('was not provided a "source" object, but rather: '+typeof i);return t=a.extend({selectable:!0,label:i.label},t),(t=l.call(this,e,t)).source=i,t}return e=u,(i=[{key:"handleClick",value:function(e){n(s(u.prototype),"handleClick",this).call(this,e),this.player().trigger(o.QUALITY_REQUESTED,this.source)}}])&&function(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),u}()}},{"../events":70,"core-js/modules/es.reflect.construct.js":65,"core-js/modules/es.reflect.get.js":66,underscore:67}],69:[function(e,t,i){"use strict";function n(){return(n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(n)return(t=Object.getOwnPropertyDescriptor(n,t)).get?t.get.call(arguments.length<3?e:i):t.value}).apply(this,arguments)}function r(e,t){return(r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}e("core-js/modules/es.reflect.construct.js"),e("core-js/modules/es.reflect.get.js"),e("core-js/modules/es.array.map.js");var o=e("underscore"),l=e("../events"),u=e("./QualityOption"),d="vjs-quality-changing";t.exports=function(e){var t=e.getComponent("MenuButton"),i=u(e),h=function(){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)}(c,t);var e,u,h=function(e){var t=function(){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}}();return function(){var i,n=a(e);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return s(e)}(this,t?(i=a(this).constructor,Reflect.construct(n,arguments,i)):n.apply(this,arguments))}}(c);function c(e,t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),t=h.call(this,e,t),e.on(l.QUALITY_REQUESTED,function(t,i){this.setSelectedSource(i),e.addClass(d),e.one("loadeddata",(function(){e.removeClass(d)}))}.bind(s(t))),e.on(l.PLAYER_SOURCES_CHANGED,function(){this.update()}.bind(s(t))),e.on(l.QUALITY_SELECTED,function(e,t){this.setSelectedSource(t)}.bind(s(t))),e.one("ready",function(){this.selectedSrc=e.src(),this.update()}.bind(s(t))),t.controlText("Open quality selector menu"),t}return e=c,(u=[{key:"setSelectedSource",value:function(e){var t=e?e.src:void 0;this.selectedSrc!==t&&(this.selectedSrc=t,o.each(this.items,(function(e){e.selected(e.source.src===t)})))}},{key:"createItems",value:function(){var e=this.player(),t=e.currentSources();return!t||t.length<2?[]:o.map(t,function(t){return new i(e,{source:t,selected:t.src===this.selectedSrc})}.bind(this))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-quality-selector "+n(a(c.prototype),"buildWrapperCSSClass",this).call(this)}}])&&function(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,u),Object.defineProperty(e,"prototype",{writable:!1}),c}();return e.registerComponent("QualitySelector",h),h}},{"../events":70,"./QualityOption":68,"core-js/modules/es.array.map.js":64,"core-js/modules/es.reflect.construct.js":65,"core-js/modules/es.reflect.get.js":66,underscore:67}],70:[function(e,t,i){"use strict";t.exports={QUALITY_REQUESTED:"qualityRequested",QUALITY_SELECTED:"qualitySelected",PLAYER_SOURCES_CHANGED:"playerSourcesChanged"}},{}],71:[function(e,t,i){"use strict";var n=e("underscore"),r=e("./events"),s=e("./components/QualitySelector"),a=e("./middleware/SourceInterceptor"),o=e("./util/SafeSeek");t.exports=function(e){e=e||window.videojs,s(e),a(e),e.hook("setup",(function(e){e.on(r.QUALITY_REQUESTED,(function(t,i){var r=e.currentSources(),s=e.currentTime(),a=e.playbackRate(),l=e.paused();n.each(r,(function(e){e.selected=!1})),n.findWhere(r,{src:i.src}).selected=!0,e._qualitySelectorSafeSeek&&e._qualitySelectorSafeSeek.onQualitySelectionChange(),e.src(r),e.ready((function(){e._qualitySelectorSafeSeek&&!e._qualitySelectorSafeSeek.hasFinished()||(e._qualitySelectorSafeSeek=new o(e,s),e.playbackRate(a)),l||e.play()}))}))}))},t.exports.EVENTS=r},{"./components/QualitySelector":69,"./events":70,"./middleware/SourceInterceptor":72,"./util/SafeSeek":74,underscore:67}],72:[function(e,t,i){"use strict";var n=e("underscore"),r=e("../events");t.exports=function(e){e.use("*",(function(e){return{setSource:function(t,i){var s=e.currentSources();e._qualitySelectorSafeSeek&&e._qualitySelectorSafeSeek.onPlayerSourcesChange(),n.isEqual(s,e._qualitySelectorPreviousSources)||(e.trigger(r.PLAYER_SOURCES_CHANGED,s),e._qualitySelectorPreviousSources=s),s=n.find(s,(function(e){return!0===e.selected||"true"===e.selected||"selected"===e.selected})),e.trigger(r.QUALITY_SELECTED,t=s||t),i(null,t)}}}))}},{"../events":70,underscore:67}],73:[function(e,t,i){"use strict";e("./index")()},{"./index":71}],74:[function(e,t,i){"use strict";t.exports=function(){function e(t,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._player=t,this._seekToTime=i,this._hasFinished=!1,this._keepThisInstanceWhenPlayerSourcesChange=!1,this._seekWhenSafe()}var t,i;return t=e,(i=[{key:"_seekWhenSafe",value:function(){this._player.readyState()<3?(this._seekFn=this._seek.bind(this),this._player.one("canplay",this._seekFn)):this._seek()}},{key:"onPlayerSourcesChange",value:function(){this._keepThisInstanceWhenPlayerSourcesChange?this._keepThisInstanceWhenPlayerSourcesChange=!1:this.cancel()}},{key:"onQualitySelectionChange",value:function(){this.hasFinished()||(this._keepThisInstanceWhenPlayerSourcesChange=!0)}},{key:"_seek",value:function(){this._player.currentTime(this._seekToTime),this._keepThisInstanceWhenPlayerSourcesChange=!1,this._hasFinished=!0}},{key:"hasFinished",value:function(){return this._hasFinished}},{key:"cancel",value:function(){this._player.off("canplay",this._seekFn),this._keepThisInstanceWhenPlayerSourcesChange=!1,this._hasFinished=!0}}])&&function(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{}]},{},[73]),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):e.videojsVttThumbnails=t(e.videojs)}(this,(function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,function(){function e(e){this.value=e}function t(t){var i,n;function r(i,n){try{var a=t[i](n),o=a.value;o instanceof e?Promise.resolve(o.value).then((function(e){r("next",e)}),(function(e){r("throw",e)})):s(a.done?"return":"normal",a.value)}catch(e){s("throw",e)}}function s(e,t){switch(e){case"return":i.resolve({value:t,done:!0});break;case"throw":i.reject(t);break;default:i.resolve({value:t,done:!1})}(i=i.next)?r(i.key,i.arg):n=null}this._invoke=function(e,t){return new Promise((function(s,a){var o={key:e,arg:t,resolve:s,reject:a,next:null};n?n=n.next=o:(i=n=o,r(e,t))}))},"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)}}();var t={},i={},n=e.registerPlugin||e.plugin,r=function(i){var n=this;this.ready((function(){!function(e,t){e.addClass("vjs-vtt-thumbnails"),e.vttThumbnails=new s(e,t)}(n,e.mergeOptions(t,i))}))},s=function(){function t(e,i){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.player=e,this.options=i,this.listenForDurationChange(),this.initializeThumbnails(),this.registeredEvents={},this}return t.prototype.src=function(e){this.resetPlugin(),this.options.src=e,this.initializeThumbnails()},t.prototype.detach=function(){this.resetPlugin()},t.prototype.resetPlugin=function(){this.thumbnailHolder&&this.thumbnailHolder.parentNode.removeChild(this.thumbnailHolder),this.progressBar&&this.progressBar.removeEventListener("mouseenter",this.registeredEvents.progressBarMouseEnter),this.progressBar&&this.progressBar.removeEventListener("mouseleave",this.registeredEvents.progressBarMouseLeave),this.progressBar&&this.progressBar.removeEventListener("mousemove",this.registeredEvents.progressBarMouseMove),delete this.registeredEvents.progressBarMouseEnter,delete this.registeredEvents.progressBarMouseLeave,delete this.registeredEvents.progressBarMouseMove,delete this.progressBar,delete this.vttData,delete this.thumbnailHolder,delete this.timeHolder,delete this.lastStyle},t.prototype.listenForDurationChange=function(){this.player.on("durationchange",(function(){}))},t.prototype.initializeThumbnails=function(){var e=this;if(this.options.src){var t=this.getBaseUrl(),i=this.getFullyQualifiedUrl(this.options.src,t);this.getVttFile(i).then((function(t){e.vttData=e.processVtt(t),e.setupThumbnailElement(),e.options.hasOwnProperty("preloadStrategy")&&e.preload(e.vttData)}))}},t.prototype.getBaseUrl=function(){return[window.location.protocol,"//",window.location.hostname,window.location.port?":"+window.location.port:"",window.location.pathname].join("").split(/([^\/]*)$/gi).shift()},t.prototype.getVttFile=function(e){var t=this;return new Promise((function(i,n){var r=new XMLHttpRequest;r.data={resolve:i},r.addEventListener("load",t.vttFileLoaded),r.open("GET",e),r.send()}))},t.prototype.vttFileLoaded=function(){this.data.resolve(this.responseText)},t.prototype.preload=function(e){var t=this;e.forEach((function(e){return t.setImageInCacheForItem(e)}))},t.prototype.setupThumbnailElement=function(e){var t=this,i=this.player.$(".vjs-mouse-display");this.progressBar=this.player.$(".vjs-progress-control");var n=document.createElement("div");n.setAttribute("class","vjs-vtt-thumbnail-display"),this.progressBar.appendChild(n),this.thumbnailHolder=n;var r=document.createElement("time");r.setAttribute("class","vjs-vtt-thumbnail-time"),this.thumbnailHolder.appendChild(r),this.timeHolder=r,i&&i.classList.add("vjs-hidden"),this.registeredEvents.progressBarMouseEnter=function(){return t.onBarMouseenter()},this.registeredEvents.progressBarMouseLeave=function(){return t.onBarMouseleave()},this.progressBar.addEventListener("mouseenter",this.registeredEvents.progressBarMouseEnter),this.progressBar.addEventListener("mouseleave",this.registeredEvents.progressBarMouseLeave)},t.prototype.onBarMouseenter=function(){var e=this;this.mouseMoveCallback=function(t){e.onBarMousemove(t)},this.registeredEvents.progressBarMouseMove=this.mouseMoveCallback,this.progressBar.addEventListener("mousemove",this.registeredEvents.progressBarMouseMove),this.showThumbnailHolder()},t.prototype.onBarMouseleave=function(){this.registeredEvents.progressBarMouseMove&&this.progressBar.removeEventListener("mousemove",this.registeredEvents.progressBarMouseMove),this.hideThumbnailHolder()},t.prototype.getXCoord=function(e,t){var i=e.getBoundingClientRect(),n=document.documentElement;return t-(i.left+(window.pageXOffset||n.scrollLeft||0))},t.prototype.onBarMousemove=function(t){this.updateThumbnailStyle(e.dom.getPointerPosition(this.progressBar,t).x,this.progressBar.offsetWidth)},t.prototype.setImageInCacheForItem=function(e){if(e.css.url&&!i[e.css.url]){var t=new Image;t.src=e.css.url,i[e.css.url]=t}},t.prototype.getStyleForTime=function(e){for(var t=0;t<this.vttData.length;++t){var i=this.vttData[t];if(e>=i.start&&e<i.end)return this.setImageInCacheForItem(i),i.css}},t.prototype.showThumbnailHolder=function(){this.thumbnailHolder.style.opacity="1"},t.prototype.hideThumbnailHolder=function(){this.thumbnailHolder.style.opacity="0"},t.prototype.updateThumbnailStyle=function(e,t){var i=this.player.duration(),n=e*i,r=this.getStyleForTime(n),s=new Date(1e3*Math.round(n)).toISOString().substr(11,8);if(s=i>3599?s:s.substring(3),this.timeHolder.innerText=s,!r)return this.hideThumbnailHolder();var a=e*t,o=parseInt(this.thumbnailHolder.offsetWidth)/2,l=t-(a+o),u=a-o;if(u>0&&l>0?this.thumbnailHolder.style.transform="translateX("+(a-o)+"px)":u<=0?this.thumbnailHolder.style.transform="translateX(0px)":l<=0&&(this.thumbnailHolder.style.transform="translateX("+(a+l-o)+"px)"),!this.lastStyle||this.lastStyle!==r)for(var d in this.lastStyle=r,r)r.hasOwnProperty(d)&&(this.thumbnailHolder.style[d]=r[d])},t.prototype.processVtt=function(e){var t=this,i=[];return e.split(/[\r\n][\r\n]/i).forEach((function(e){if(e.match(/([0-9]{2}:)?([0-9]{2}:)?[0-9]{2}(.[0-9]{3})?( ?--> ?)([0-9]{2}:)?([0-9]{2}:)?[0-9]{2}(.[0-9]{3})?[\r\n]{1}.*/gi)){var n=e.split(/[\r\n]/i),r=n[0].split(/ ?--> ?/i),s=r[0],a=r[1],o=n[1],l=t.getVttCss(o);i.push({start:t.getSecondsFromTimestamp(s),end:t.getSecondsFromTimestamp(a),css:l})}})),i},t.prototype.getFullyQualifiedUrl=function(e,t){return e.indexOf("//")>=0?e:0===t.indexOf("//")?[t.replace(/\/$/gi,""),this.trim(e,"/")].join("/"):t.indexOf("//")>0?[this.trim(t,"/"),this.trim(e,"/")].join("/"):e},t.prototype.getPropsFromDef=function(e){var t=e.split(/#xywh=/i),i=t[0],n=t[1].match(/[0-9]+/gi);return{x:n[0],y:n[1],w:n[2],h:n[3],image:i}},t.prototype.getVttCss=function(e){var t,i={};if(t=this.options.baseUrl?this.options.baseUrl:this.options.src.indexOf("//")>=0?this.options.src.split(/([^\/]*)$/gi).shift():this.getBaseUrl()+this.options.src.split(/([^\/]*)$/gi).shift(),!(e=this.getFullyQualifiedUrl(e,t)).match(/#xywh=/i))return i.background='url("'+e+'")',i.url=e,i;var n=this.getPropsFromDef(e);return i.background='url("'+n.image+'") no-repeat -'+n.x+"px -"+n.y+"px",i.width=n.w+"px",i.height=n.h+"px",i.url=n.image,i},t.prototype.doconstructTimestamp=function(e){var t=e.split("."),i=t[0].split(":");return{milliseconds:parseInt(t[1])||0,seconds:parseInt(i.pop())||0,minutes:parseInt(i.pop())||0,hours:parseInt(i.pop())||0}},t.prototype.getSecondsFromTimestamp=function(e){var t=this.doconstructTimestamp(e);return parseInt(3600*t.hours+60*t.minutes+t.seconds+t.milliseconds/1e3)},t.prototype.trim=function(e,t){var i=[" ","\n","\r","\t","\f","\v"," "," ","","","","","","","","","","","","\u2028","\u2029"," "].join(""),n=0,r=0;for(e+="",t&&(i=(t+"").replace(/([[\]().?/*{}+$^:])/g,"$1")),n=e.length,r=0;r<n;r++)if(-1===i.indexOf(e.charAt(r))){e=e.substring(r);break}for(r=(n=e.length)-1;r>=0;r--)if(-1===i.indexOf(e.charAt(r))){e=e.substring(0,r+1);break}return-1===i.indexOf(e.charAt(0))?e:""},t}();return n("vttThumbnails",r),r.VERSION="1.2.0",r}));
/*!
* sweetalert2 v11.10.8
* Released under the MIT License.
*/
!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).Sweetalert2=e()}(this,(function(){"use strict";function t(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function e(t,e,n){return e=s(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,o()?Reflect.construct(e,n||[],s(t).constructor):e.apply(t,n))}function n(e,n){return e.get(t(e,n))}function o(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(o=function(){return!!t})()}function i(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e: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},r(t)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,i(o.key),o)}}function u(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}function d(){return d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var o=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},d.apply(this,arguments)}function f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var o,i,r,a,c=[],u=!0,s=!1;try{if(r=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(o=r.call(n)).done)&&(c.push(o.value),c.length!==e);u=!0);}catch(t){s=!0,i=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return c}}(t,e)||m(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(t){return function(t){if(Array.isArray(t))return h(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){if(t){if("string"==typeof t)return h(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(t,e):void 0}}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function v(t,e,n){!function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,e),e.set(t,n)}var g={},b=function(t){return new Promise((function(e){if(!t)return e();var n=window.scrollX,o=window.scrollY;g.restoreFocusTimeout=setTimeout((function(){g.previousActiveElement instanceof HTMLElement?(g.previousActiveElement.focus(),g.previousActiveElement=null):document.body&&document.body.focus(),e()}),100),window.scrollTo(n,o)}))},y="swal2-",w=["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","default-outline","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error"].reduce((function(t,e){return t[e]=y+e,t}),{}),C=["success","warning","info","question","error"].reduce((function(t,e){return t[e]=y+e,t}),{}),A="SweetAlert2:",k=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},E=function(t){console.warn("".concat(A," ").concat("object"===r(t)?t.join(" "):t))},P=function(t){console.error("".concat(A," ").concat(t))},B=[],T=function(t,e){var n;n='"'.concat(t,'" is deprecated and will be removed in the next major release. Please use "').concat(e,'" instead.'),B.includes(n)||(B.push(n),E(n))},x=function(t){return"function"==typeof t?t():t},S=function(t){return t&&"function"==typeof t.toPromise},O=function(t){return S(t)?t.toPromise():Promise.resolve(t)},L=function(t){return t&&Promise.resolve(t)===t},j=function(){return document.body.querySelector(".".concat(w.container))},M=function(t){var e=j();return e?e.querySelector(t):null},I=function(t){return M(".".concat(t))},H=function(){return I(w.popup)},D=function(){return I(w.icon)},q=function(){return I(w.title)},V=function(){return I(w["html-container"])},_=function(){return I(w.image)},R=function(){return I(w["progress-steps"])},N=function(){return I(w["validation-message"])},F=function(){return M(".".concat(w.actions," .").concat(w.confirm))},U=function(){return M(".".concat(w.actions," .").concat(w.cancel))},z=function(){return M(".".concat(w.actions," .").concat(w.deny))},W=function(){return M(".".concat(w.loader))},K=function(){return I(w.actions)},Y=function(){return I(w.footer)},Z=function(){return I(w["timer-progress-bar"])},$=function(){return I(w.close)},J=function(){var t=H();if(!t)return[];var e=t.querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])'),n=Array.from(e).sort((function(t,e){var n=parseInt(t.getAttribute("tabindex")||"0"),o=parseInt(e.getAttribute("tabindex")||"0");return n>o?1:n<o?-1:0})),o=t.querySelectorAll('\n a[href],\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n [tabindex="0"],\n [contenteditable],\n audio[controls],\n video[controls],\n summary\n'),i=Array.from(o).filter((function(t){return"-1"!==t.getAttribute("tabindex")}));return p(new Set(n.concat(i))).filter((function(t){return mt(t)}))},X=function(){return tt(document.body,w.shown)&&!tt(document.body,w["toast-shown"])&&!tt(document.body,w["no-backdrop"])},G=function(){var t=H();return!!t&&tt(t,w.toast)},Q=function(t,e){if(t.textContent="",e){var n=(new DOMParser).parseFromString(e,"text/html"),o=n.querySelector("head");o&&Array.from(o.childNodes).forEach((function(e){t.appendChild(e)}));var i=n.querySelector("body");i&&Array.from(i.childNodes).forEach((function(e){e instanceof HTMLVideoElement||e instanceof HTMLAudioElement?t.appendChild(e.cloneNode(!0)):t.appendChild(e)}))}},tt=function(t,e){if(!e)return!1;for(var n=e.split(/\s+/),o=0;o<n.length;o++)if(!t.classList.contains(n[o]))return!1;return!0},et=function(t,e,n){if(function(t,e){Array.from(t.classList).forEach((function(n){Object.values(w).includes(n)||Object.values(C).includes(n)||Object.values(e.showClass||{}).includes(n)||t.classList.remove(n)}))}(t,e),e.customClass&&e.customClass[n]){if("string"!=typeof e.customClass[n]&&!e.customClass[n].forEach)return void E("Invalid type of customClass.".concat(n,'! Expected string or iterable object, got "').concat(r(e.customClass[n]),'"'));rt(t,e.customClass[n])}},nt=function(t,e){if(!e)return null;switch(e){case"select":case"textarea":case"file":return t.querySelector(".".concat(w.popup," > .").concat(w[e]));case"checkbox":return t.querySelector(".".concat(w.popup," > .").concat(w.checkbox," input"));case"radio":return t.querySelector(".".concat(w.popup," > .").concat(w.radio," input:checked"))||t.querySelector(".".concat(w.popup," > .").concat(w.radio," input:first-child"));case"range":return t.querySelector(".".concat(w.popup," > .").concat(w.range," input"));default:return t.querySelector(".".concat(w.popup," > .").concat(w.input))}},ot=function(t){if(t.focus(),"file"!==t.type){var e=t.value;t.value="",t.value=e}},it=function(t,e,n){t&&e&&("string"==typeof e&&(e=e.split(/\s+/).filter(Boolean)),e.forEach((function(e){Array.isArray(t)?t.forEach((function(t){n?t.classList.add(e):t.classList.remove(e)})):n?t.classList.add(e):t.classList.remove(e)})))},rt=function(t,e){it(t,e,!0)},at=function(t,e){it(t,e,!1)},ct=function(t,e){for(var n=Array.from(t.children),o=0;o<n.length;o++){var i=n[o];if(i instanceof HTMLElement&&tt(i,e))return i}},ut=function(t,e,n){n==="".concat(parseInt(n))&&(n=parseInt(n)),n||0===parseInt(n)?t.style.setProperty(e,"number"==typeof n?"".concat(n,"px"):n):t.style.removeProperty(e)},st=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"flex";t&&(t.style.display=e)},lt=function(t){t&&(t.style.display="none")},dt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"block";t&&new MutationObserver((function(){pt(t,t.innerHTML,e)})).observe(t,{childList:!0,subtree:!0})},ft=function(t,e,n,o){var i=t.querySelector(e);i&&i.style.setProperty(n,o)},pt=function(t,e){e?st(t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"flex"):lt(t)},mt=function(t){return!(!t||!(t.offsetWidth||t.offsetHeight||t.getClientRects().length))},ht=function(t){return!!(t.scrollHeight>t.clientHeight)},vt=function(t){var e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),o=parseFloat(e.getPropertyValue("transition-duration")||"0");return n>0||o>0},gt=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=Z();n&&mt(n)&&(e&&(n.style.transition="none",n.style.width="100%"),setTimeout((function(){n.style.transition="width ".concat(t/1e3,"s linear"),n.style.width="0%"}),10))},bt=function(){return"undefined"==typeof window||"undefined"==typeof document},yt='\n <div aria-labelledby="'.concat(w.title,'" aria-describedby="').concat(w["html-container"],'" class="').concat(w.popup,'" tabindex="-1">\n <button type="button" class="').concat(w.close,'"></button>\n <ul class="').concat(w["progress-steps"],'"></ul>\n <div class="').concat(w.icon,'"></div>\n <img class="').concat(w.image,'" />\n <h2 class="').concat(w.title,'" id="').concat(w.title,'"></h2>\n <div class="').concat(w["html-container"],'" id="').concat(w["html-container"],'"></div>\n <input class="').concat(w.input,'" id="').concat(w.input,'" />\n <input type="file" class="').concat(w.file,'" />\n <div class="').concat(w.range,'">\n <input type="range" />\n <output></output>\n </div>\n <select class="').concat(w.select,'" id="').concat(w.select,'"></select>\n <div class="').concat(w.radio,'"></div>\n <label class="').concat(w.checkbox,'">\n <input type="checkbox" id="').concat(w.checkbox,'" />\n <span class="').concat(w.label,'"></span>\n </label>\n <textarea class="').concat(w.textarea,'" id="').concat(w.textarea,'"></textarea>\n <div class="').concat(w["validation-message"],'" id="').concat(w["validation-message"],'"></div>\n <div class="').concat(w.actions,'">\n <div class="').concat(w.loader,'"></div>\n <button type="button" class="').concat(w.confirm,'"></button>\n <button type="button" class="').concat(w.deny,'"></button>\n <button type="button" class="').concat(w.cancel,'"></button>\n </div>\n <div class="').concat(w.footer,'"></div>\n <div class="').concat(w["timer-progress-bar-container"],'">\n <div class="').concat(w["timer-progress-bar"],'"></div>\n </div>\n </div>\n').replace(/(^|\n)\s*/g,""),wt=function(){g.currentInstance.resetValidationMessage()},Ct=function(t){var e,n=!!(e=j())&&(e.remove(),at([document.documentElement,document.body],[w["no-backdrop"],w["toast-shown"],w["has-column"]]),!0);if(bt())P("SweetAlert2 requires document to initialize");else{var o=document.createElement("div");o.className=w.container,n&&rt(o,w["no-transition"]),Q(o,yt);var i,r,a,c,u,s,l,d,f,p="string"==typeof(i=t.target)?document.querySelector(i):i;p.appendChild(o),function(t){var e=H();e.setAttribute("role",t.toast?"alert":"dialog"),e.setAttribute("aria-live",t.toast?"polite":"assertive"),t.toast||e.setAttribute("aria-modal","true")}(t),function(t){"rtl"===window.getComputedStyle(t).direction&&rt(j(),w.rtl)}(p),r=H(),a=ct(r,w.input),c=ct(r,w.file),u=r.querySelector(".".concat(w.range," input")),s=r.querySelector(".".concat(w.range," output")),l=ct(r,w.select),d=r.querySelector(".".concat(w.checkbox," input")),f=ct(r,w.textarea),a.oninput=wt,c.onchange=wt,l.onchange=wt,d.onchange=wt,f.oninput=wt,u.oninput=function(){wt(),s.value=u.value},u.onchange=function(){wt(),s.value=u.value}}},At=function(t,e){t instanceof HTMLElement?e.appendChild(t):"object"===r(t)?kt(t,e):t&&Q(e,t)},kt=function(t,e){t.jquery?Et(e,t):Q(e,t.toString())},Et=function(t,e){if(t.textContent="",0 in e)for(var n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},Pt=function(){if(bt())return!1;var t=document.createElement("div");return void 0!==t.style.webkitAnimation?"webkitAnimationEnd":void 0!==t.style.animation&&"animationend"}(),Bt=function(t,e){var n=K(),o=W();n&&o&&(e.showConfirmButton||e.showDenyButton||e.showCancelButton?st(n):lt(n),et(n,e,"actions"),function(t,e,n){var o=F(),i=z(),r=U();if(!o||!i||!r)return;Tt(o,"confirm",n),Tt(i,"deny",n),Tt(r,"cancel",n),function(t,e,n,o){if(!o.buttonsStyling)return void at([t,e,n],w.styled);rt([t,e,n],w.styled),o.confirmButtonColor&&(t.style.backgroundColor=o.confirmButtonColor,rt(t,w["default-outline"]));o.denyButtonColor&&(e.style.backgroundColor=o.denyButtonColor,rt(e,w["default-outline"]));o.cancelButtonColor&&(n.style.backgroundColor=o.cancelButtonColor,rt(n,w["default-outline"]))}(o,i,r,n),n.reverseButtons&&(n.toast?(t.insertBefore(r,o),t.insertBefore(i,o)):(t.insertBefore(r,e),t.insertBefore(i,e),t.insertBefore(o,e)))}(n,o,e),Q(o,e.loaderHtml||""),et(o,e,"loader"))};function Tt(t,e,n){var o=k(e);pt(t,n["show".concat(o,"Button")],"inline-block"),Q(t,n["".concat(e,"ButtonText")]||""),t.setAttribute("aria-label",n["".concat(e,"ButtonAriaLabel")]||""),t.className=w[e],et(t,n,"".concat(e,"Button"))}var xt=function(t,e){var n=j();n&&(!function(t,e){"string"==typeof e?t.style.background=e:e||rt([document.documentElement,document.body],w["no-backdrop"])}(n,e.backdrop),function(t,e){if(!e)return;e in w?rt(t,w[e]):(E('The "position" parameter is not valid, defaulting to "center"'),rt(t,w.center))}(n,e.position),function(t,e){if(!e)return;rt(t,w["grow-".concat(e)])}(n,e.grow),et(n,e,"container"))};var St={innerParams:new WeakMap,domCache:new WeakMap},Ot=["input","file","range","select","radio","checkbox","textarea"],Lt=function(t){if(t.input)if(Vt[t.input]){var e=Dt(t.input),n=Vt[t.input](e,t);st(e),t.inputAutoFocus&&setTimeout((function(){ot(n)}))}else P("Unexpected type of input! Expected ".concat(Object.keys(Vt).join(" | "),', got "').concat(t.input,'"'))},jt=function(t,e){var n=nt(H(),t);if(n)for(var o in function(t){for(var e=0;e<t.attributes.length;e++){var n=t.attributes[e].name;["id","type","value","style"].includes(n)||t.removeAttribute(n)}}(n),e)n.setAttribute(o,e[o])},Mt=function(t){var e=Dt(t.input);"object"===r(t.customClass)&&rt(e,t.customClass.input)},It=function(t,e){t.placeholder&&!e.inputPlaceholder||(t.placeholder=e.inputPlaceholder)},Ht=function(t,e,n){if(n.inputLabel){var o=document.createElement("label"),i=w["input-label"];o.setAttribute("for",t.id),o.className=i,"object"===r(n.customClass)&&rt(o,n.customClass.inputLabel),o.innerText=n.inputLabel,e.insertAdjacentElement("beforebegin",o)}},Dt=function(t){return ct(H(),w[t]||w.input)},qt=function(t,e){["string","number"].includes(r(e))?t.value="".concat(e):L(e)||E('Unexpected type of inputValue! Expected "string", "number" or "Promise", got "'.concat(r(e),'"'))},Vt={};Vt.text=Vt.email=Vt.password=Vt.number=Vt.tel=Vt.url=Vt.search=Vt.date=Vt["datetime-local"]=Vt.time=Vt.week=Vt.month=function(t,e){return qt(t,e.inputValue),Ht(t,t,e),It(t,e),t.type=e.input,t},Vt.file=function(t,e){return Ht(t,t,e),It(t,e),t},Vt.range=function(t,e){var n=t.querySelector("input"),o=t.querySelector("output");return qt(n,e.inputValue),n.type=e.input,qt(o,e.inputValue),Ht(n,t,e),t},Vt.select=function(t,e){if(t.textContent="",e.inputPlaceholder){var n=document.createElement("option");Q(n,e.inputPlaceholder),n.value="",n.disabled=!0,n.selected=!0,t.appendChild(n)}return Ht(t,t,e),t},Vt.radio=function(t){return t.textContent="",t},Vt.checkbox=function(t,e){var n=nt(H(),"checkbox");n.value="1",n.checked=Boolean(e.inputValue);var o=t.querySelector("span");return Q(o,e.inputPlaceholder),n},Vt.textarea=function(t,e){qt(t,e.inputValue),It(t,e),Ht(t,t,e);return setTimeout((function(){if("MutationObserver"in window){var n=parseInt(window.getComputedStyle(H()).width);new MutationObserver((function(){if(document.body.contains(t)){var o,i=t.offsetWidth+(o=t,parseInt(window.getComputedStyle(o).marginLeft)+parseInt(window.getComputedStyle(o).marginRight));i>n?H().style.width="".concat(i,"px"):ut(H(),"width",e.width)}})).observe(t,{attributes:!0,attributeFilter:["style"]})}})),t};var _t=function(t,e){var n=V();n&&(dt(n),et(n,e,"htmlContainer"),e.html?(At(e.html,n),st(n,"block")):e.text?(n.textContent=e.text,st(n,"block")):lt(n),function(t,e){var n=H();if(n){var o=St.innerParams.get(t),i=!o||e.input!==o.input;Ot.forEach((function(t){var o=ct(n,w[t]);o&&(jt(t,e.inputAttributes),o.className=w[t],i&&lt(o))})),e.input&&(i&&Lt(e),Mt(e))}}(t,e))},Rt=function(t,e){for(var n=0,o=Object.entries(C);n<o.length;n++){var i=f(o[n],2),r=i[0],a=i[1];e.icon!==r&&at(t,a)}rt(t,e.icon&&C[e.icon]),Ut(t,e),Nt(),et(t,e,"icon")},Nt=function(){var t=H();if(t)for(var e=window.getComputedStyle(t).getPropertyValue("background-color"),n=t.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix"),o=0;o<n.length;o++)n[o].style.backgroundColor=e},Ft=function(t,e){if(e.icon||e.iconHtml){var n=t.innerHTML,o="";if(e.iconHtml)o=zt(e.iconHtml);else if("success"===e.icon)o='\n <div class="swal2-success-circular-line-left"></div>\n <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>\n <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>\n <div class="swal2-success-circular-line-right"></div>\n',n=n.replace(/ style=".*?"/g,"");else if("error"===e.icon)o='\n <span class="swal2-x-mark">\n <span class="swal2-x-mark-line-left"></span>\n <span class="swal2-x-mark-line-right"></span>\n </span>\n';else if(e.icon){o=zt({question:"?",warning:"!",info:"i"}[e.icon])}n.trim()!==o.trim()&&Q(t,o)}},Ut=function(t,e){if(e.iconColor){t.style.color=e.iconColor,t.style.borderColor=e.iconColor;for(var n=0,o=[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"];n<o.length;n++){ft(t,o[n],"background-color",e.iconColor)}ft(t,".swal2-success-ring","border-color",e.iconColor)}},zt=function(t){return'<div class="'.concat(w["icon-content"],'">').concat(t,"</div>")},Wt=function(t,e){var n=e.showClass||{};t.className="".concat(w.popup," ").concat(mt(t)?n.popup:""),e.toast?(rt([document.documentElement,document.body],w["toast-shown"]),rt(t,w.toast)):rt(t,w.modal),et(t,e,"popup"),"string"==typeof e.customClass&&rt(t,e.customClass),e.icon&&rt(t,w["icon-".concat(e.icon)])},Kt=function(t){var e=document.createElement("li");return rt(e,w["progress-step"]),Q(e,t),e},Yt=function(t){var e=document.createElement("li");return rt(e,w["progress-step-line"]),t.progressStepsDistance&&ut(e,"width",t.progressStepsDistance),e},Zt=function(t,e){!function(t,e){var n=j(),o=H();if(n&&o){if(e.toast){ut(n,"width",e.width),o.style.width="100%";var i=W();i&&o.insertBefore(i,D())}else ut(o,"width",e.width);ut(o,"padding",e.padding),e.color&&(o.style.color=e.color),e.background&&(o.style.background=e.background),lt(N()),Wt(o,e)}}(0,e),xt(0,e),function(t,e){var n=R();if(n){var o=e.progressSteps,i=e.currentProgressStep;o&&0!==o.length&&void 0!==i?(st(n),n.textContent="",i>=o.length&&E("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),o.forEach((function(t,r){var a=Kt(t);if(n.appendChild(a),r===i&&rt(a,w["active-progress-step"]),r!==o.length-1){var c=Yt(e);n.appendChild(c)}}))):lt(n)}}(0,e),function(t,e){var n=St.innerParams.get(t),o=D();if(o){if(n&&e.icon===n.icon)return Ft(o,e),void Rt(o,e);if(e.icon||e.iconHtml){if(e.icon&&-1===Object.keys(C).indexOf(e.icon))return P('Unknown icon! Expected "success", "error", "warning", "info" or "question", got "'.concat(e.icon,'"')),void lt(o);st(o),Ft(o,e),Rt(o,e),rt(o,e.showClass&&e.showClass.icon)}else lt(o)}}(t,e),function(t,e){var n=_();n&&(e.imageUrl?(st(n,""),n.setAttribute("src",e.imageUrl),n.setAttribute("alt",e.imageAlt||""),ut(n,"width",e.imageWidth),ut(n,"height",e.imageHeight),n.className=w.image,et(n,e,"image")):lt(n))}(0,e),function(t,e){var n=q();n&&(dt(n),pt(n,e.title||e.titleText,"block"),e.title&&At(e.title,n),e.titleText&&(n.innerText=e.titleText),et(n,e,"title"))}(0,e),function(t,e){var n=$();n&&(Q(n,e.closeButtonHtml||""),et(n,e,"closeButton"),pt(n,e.showCloseButton),n.setAttribute("aria-label",e.closeButtonAriaLabel||""))}(0,e),_t(t,e),Bt(0,e),function(t,e){var n=Y();n&&(dt(n),pt(n,e.footer,"block"),e.footer&&At(e.footer,n),et(n,e,"footer"))}(0,e);var n=H();"function"==typeof e.didRender&&n&&e.didRender(n)},$t=function(){var t;return null===(t=F())||void 0===t?void 0:t.click()},Jt=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),Xt=function(t){t.keydownTarget&&t.keydownHandlerAdded&&(t.keydownTarget.removeEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!1)},Gt=function(t,e){var n,o=J();if(o.length)return(t+=e)===o.length?t=0:-1===t&&(t=o.length-1),void o[t].focus();null===(n=H())||void 0===n||n.focus()},Qt=["ArrowRight","ArrowDown"],te=["ArrowLeft","ArrowUp"],ee=function(t,e,n){t&&(e.isComposing||229===e.keyCode||(t.stopKeydownPropagation&&e.stopPropagation(),"Enter"===e.key?ne(e,t):"Tab"===e.key?oe(e):[].concat(Qt,te).includes(e.key)?ie(e.key):"Escape"===e.key&&re(e,t,n)))},ne=function(t,e){if(x(e.allowEnterKey)){var n=nt(H(),e.input);if(t.target&&n&&t.target instanceof HTMLElement&&t.target.outerHTML===n.outerHTML){if(["textarea","file"].includes(e.input))return;$t(),t.preventDefault()}}},oe=function(t){for(var e=t.target,n=J(),o=-1,i=0;i<n.length;i++)if(e===n[i]){o=i;break}t.shiftKey?Gt(o,-1):Gt(o,1),t.stopPropagation(),t.preventDefault()},ie=function(t){var e=K(),n=F(),o=z(),i=U();if(e&&n&&o&&i){var r=[n,o,i];if(!(document.activeElement instanceof HTMLElement)||r.includes(document.activeElement)){var a=Qt.includes(t)?"nextElementSibling":"previousElementSibling",c=document.activeElement;if(c){for(var u=0;u<e.children.length;u++){if(!(c=c[a]))return;if(c instanceof HTMLButtonElement&&mt(c))break}c instanceof HTMLButtonElement&&c.focus()}}}},re=function(t,e,n){x(e.allowEscapeKey)&&(t.preventDefault(),n(Jt.esc))},ae={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap},ce=function(){Array.from(document.body.children).forEach((function(t){t.hasAttribute("data-previous-aria-hidden")?(t.setAttribute("aria-hidden",t.getAttribute("data-previous-aria-hidden")||""),t.removeAttribute("data-previous-aria-hidden")):t.removeAttribute("aria-hidden")}))},ue="undefined"!=typeof window&&!!window.GestureEvent,se=function(){var t,e=j();e&&(e.ontouchstart=function(e){t=le(e)},e.ontouchmove=function(e){t&&(e.preventDefault(),e.stopPropagation())})},le=function(t){var e=t.target,n=j(),o=V();return!(!n||!o)&&(!de(t)&&!fe(t)&&(e===n||!ht(n)&&e instanceof HTMLElement&&"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName&&(!ht(o)||!o.contains(e))))},de=function(t){return t.touches&&t.touches.length&&"stylus"===t.touches[0].touchType},fe=function(t){return t.touches&&t.touches.length>1},pe=null,me=function(t){null===pe&&(document.body.scrollHeight>window.innerHeight||"scroll"===t)&&(pe=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight="".concat(pe+function(){var t=document.createElement("div");t.className=w["scrollbar-measure"],document.body.appendChild(t);var e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e}(),"px"))};function he(t,e,n,o){G()?ke(t,o):(b(n).then((function(){return ke(t,o)})),Xt(g)),ue?(e.setAttribute("style","display:none !important"),e.removeAttribute("class"),e.innerHTML=""):e.remove(),X()&&(null!==pe&&(document.body.style.paddingRight="".concat(pe,"px"),pe=null),function(){if(tt(document.body,w.iosfix)){var t=parseInt(document.body.style.top,10);at(document.body,w.iosfix),document.body.style.top="",document.body.scrollTop=-1*t}}(),ce()),at([document.documentElement,document.body],[w.shown,w["height-auto"],w["no-backdrop"],w["toast-shown"]])}function ve(t){t=we(t);var e=ae.swalPromiseResolve.get(this),n=ge(this);this.isAwaitingPromise?t.isDismissed||(ye(this),e(t)):n&&e(t)}var ge=function(t){var e=H();if(!e)return!1;var n=St.innerParams.get(t);if(!n||tt(e,n.hideClass.popup))return!1;at(e,n.showClass.popup),rt(e,n.hideClass.popup);var o=j();return at(o,n.showClass.backdrop),rt(o,n.hideClass.backdrop),Ce(t,e,n),!0};function be(t){var e=ae.swalPromiseReject.get(this);ye(this),e&&e(t)}var ye=function(t){t.isAwaitingPromise&&(delete t.isAwaitingPromise,St.innerParams.get(t)||t._destroy())},we=function(t){return void 0===t?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},t)},Ce=function(t,e,n){var o=j(),i=Pt&&vt(e);"function"==typeof n.willClose&&n.willClose(e),i?Ae(t,e,o,n.returnFocus,n.didClose):he(t,o,n.returnFocus,n.didClose)},Ae=function(t,e,n,o,i){Pt&&(g.swalCloseEventFinishedCallback=he.bind(null,t,n,o,i),e.addEventListener(Pt,(function(t){t.target===e&&(g.swalCloseEventFinishedCallback(),delete g.swalCloseEventFinishedCallback)})))},ke=function(t,e){setTimeout((function(){"function"==typeof e&&e.bind(t.params)(),t._destroy&&t._destroy()}))},Ee=function(t){var e=H();if(e||new io,e=H()){var n=W();G()?lt(D()):Pe(e,t),st(n),e.setAttribute("data-loading","true"),e.setAttribute("aria-busy","true"),e.focus()}},Pe=function(t,e){var n=K(),o=W();n&&o&&(!e&&mt(F())&&(e=F()),st(n),e&&(lt(e),o.setAttribute("data-button-to-replace",e.className),n.insertBefore(o,e)),rt([t,n],w.loading))},Be=function(t){return t.checked?1:0},Te=function(t){return t.checked?t.value:null},xe=function(t){return t.files&&t.files.length?null!==t.getAttribute("multiple")?t.files:t.files[0]:null},Se=function(t,e){var n=H();if(n){var o=function(t){"select"===e.input?function(t,e,n){var o=ct(t,w.select);if(!o)return;var i=function(t,e,o){var i=document.createElement("option");i.value=o,Q(i,e),i.selected=je(o,n.inputValue),t.appendChild(i)};e.forEach((function(t){var e=t[0],n=t[1];if(Array.isArray(n)){var r=document.createElement("optgroup");r.label=e,r.disabled=!1,o.appendChild(r),n.forEach((function(t){return i(r,t[1],t[0])}))}else i(o,n,e)})),o.focus()}(n,Le(t),e):"radio"===e.input&&function(t,e,n){var o=ct(t,w.radio);if(!o)return;e.forEach((function(t){var e=t[0],i=t[1],r=document.createElement("input"),a=document.createElement("label");r.type="radio",r.name=w.radio,r.value=e,je(e,n.inputValue)&&(r.checked=!0);var c=document.createElement("span");Q(c,i),c.className=w.label,a.appendChild(r),a.appendChild(c),o.appendChild(a)}));var i=o.querySelectorAll("input");i.length&&i[0].focus()}(n,Le(t),e)};S(e.inputOptions)||L(e.inputOptions)?(Ee(F()),O(e.inputOptions).then((function(e){t.hideLoading(),o(e)}))):"object"===r(e.inputOptions)?o(e.inputOptions):P("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(r(e.inputOptions)))}},Oe=function(t,e){var n=t.getInput();n&&(lt(n),O(e.inputValue).then((function(o){n.value="number"===e.input?"".concat(parseFloat(o)||0):"".concat(o),st(n),n.focus(),t.hideLoading()})).catch((function(e){P("Error in inputValue promise: ".concat(e)),n.value="",st(n),n.focus(),t.hideLoading()})))};var Le=function t(e){var n=[];return e instanceof Map?e.forEach((function(e,o){var i=e;"object"===r(i)&&(i=t(i)),n.push([o,i])})):Object.keys(e).forEach((function(o){var i=e[o];"object"===r(i)&&(i=t(i)),n.push([o,i])})),n},je=function(t,e){return!!e&&e.toString()===t.toString()},Me=void 0,Ie=function(t,e){var n=St.innerParams.get(t);if(n.input){var o=t.getInput(),i=function(t,e){var n=t.getInput();if(!n)return null;switch(e.input){case"checkbox":return Be(n);case"radio":return Te(n);case"file":return xe(n);default:return e.inputAutoTrim?n.value.trim():n.value}}(t,n);n.inputValidator?He(t,i,e):o&&!o.checkValidity()?(t.enableButtons(),t.showValidationMessage(n.validationMessage||o.validationMessage)):"deny"===e?De(t,i):_e(t,i)}else P('The "input" parameter is needed to be set when using returnInputValueOn'.concat(k(e)))},He=function(t,e,n){var o=St.innerParams.get(t);t.disableInput(),Promise.resolve().then((function(){return O(o.inputValidator(e,o.validationMessage))})).then((function(o){t.enableButtons(),t.enableInput(),o?t.showValidationMessage(o):"deny"===n?De(t,e):_e(t,e)}))},De=function(t,e){var n=St.innerParams.get(t||Me);(n.showLoaderOnDeny&&Ee(z()),n.preDeny)?(t.isAwaitingPromise=!0,Promise.resolve().then((function(){return O(n.preDeny(e,n.validationMessage))})).then((function(n){!1===n?(t.hideLoading(),ye(t)):t.close({isDenied:!0,value:void 0===n?e:n})})).catch((function(e){return Ve(t||Me,e)}))):t.close({isDenied:!0,value:e})},qe=function(t,e){t.close({isConfirmed:!0,value:e})},Ve=function(t,e){t.rejectPromise(e)},_e=function(t,e){var n=St.innerParams.get(t||Me);(n.showLoaderOnConfirm&&Ee(),n.preConfirm)?(t.resetValidationMessage(),t.isAwaitingPromise=!0,Promise.resolve().then((function(){return O(n.preConfirm(e,n.validationMessage))})).then((function(n){mt(N())||!1===n?(t.hideLoading(),ye(t)):qe(t,void 0===n?e:n)})).catch((function(e){return Ve(t||Me,e)}))):qe(t,e)};function Re(){var t=St.innerParams.get(this);if(t){var e=St.domCache.get(this);lt(e.loader),G()?t.icon&&st(D()):Ne(e),at([e.popup,e.actions],w.loading),e.popup.removeAttribute("aria-busy"),e.popup.removeAttribute("data-loading"),e.confirmButton.disabled=!1,e.denyButton.disabled=!1,e.cancelButton.disabled=!1}}var Ne=function(t){var e=t.popup.getElementsByClassName(t.loader.getAttribute("data-button-to-replace"));e.length?st(e[0],"inline-block"):mt(F())||mt(z())||mt(U())||lt(t.actions)};function Fe(){var t=St.innerParams.get(this),e=St.domCache.get(this);return e?nt(e.popup,t.input):null}function Ue(t,e,n){var o=St.domCache.get(t);e.forEach((function(t){o[t].disabled=n}))}function ze(t,e){var n=H();if(n&&t)if("radio"===t.type)for(var o=n.querySelectorAll('[name="'.concat(w.radio,'"]')),i=0;i<o.length;i++)o[i].disabled=e;else t.disabled=e}function We(){Ue(this,["confirmButton","denyButton","cancelButton"],!1)}function Ke(){Ue(this,["confirmButton","denyButton","cancelButton"],!0)}function Ye(){ze(this.getInput(),!1)}function Ze(){ze(this.getInput(),!0)}function $e(t){var e=St.domCache.get(this),n=St.innerParams.get(this);Q(e.validationMessage,t),e.validationMessage.className=w["validation-message"],n.customClass&&n.customClass.validationMessage&&rt(e.validationMessage,n.customClass.validationMessage),st(e.validationMessage);var o=this.getInput();o&&(o.setAttribute("aria-invalid","true"),o.setAttribute("aria-describedby",w["validation-message"]),ot(o),rt(o,w.inputerror))}function Je(){var t=St.domCache.get(this);t.validationMessage&&lt(t.validationMessage);var e=this.getInput();e&&(e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedby"),at(e,w.inputerror))}var Xe={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,animation:!0,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"&times;",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoFocus:!0,inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0},Ge=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","willClose"],Qe={},tn=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],en=function(t){return Object.prototype.hasOwnProperty.call(Xe,t)},nn=function(t){return-1!==Ge.indexOf(t)},on=function(t){return Qe[t]},rn=function(t){en(t)||E('Unknown parameter "'.concat(t,'"'))},an=function(t){tn.includes(t)&&E('The parameter "'.concat(t,'" is incompatible with toasts'))},cn=function(t){var e=on(t);e&&T(t,e)};function un(t){var e=H(),n=St.innerParams.get(this);if(e&&!tt(e,n.hideClass.popup)){var o=sn(t),i=Object.assign({},n,o);Zt(this,i),St.innerParams.set(this,i),Object.defineProperties(this,{params:{value:Object.assign({},this.params,t),writable:!1,enumerable:!0}})}else E("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.")}var sn=function(t){var e={};return Object.keys(t).forEach((function(n){nn(n)?e[n]=t[n]:E("Invalid parameter to update: ".concat(n))})),e};function ln(){var t=St.domCache.get(this),e=St.innerParams.get(this);e?(t.popup&&g.swalCloseEventFinishedCallback&&(g.swalCloseEventFinishedCallback(),delete g.swalCloseEventFinishedCallback),"function"==typeof e.didDestroy&&e.didDestroy(),dn(this)):fn(this)}var dn=function(t){fn(t),delete t.params,delete g.keydownHandler,delete g.keydownTarget,delete g.currentInstance},fn=function(t){t.isAwaitingPromise?(pn(St,t),t.isAwaitingPromise=!0):(pn(ae,t),pn(St,t),delete t.isAwaitingPromise,delete t.disableButtons,delete t.enableButtons,delete t.getInput,delete t.disableInput,delete t.enableInput,delete t.hideLoading,delete t.disableLoading,delete t.showValidationMessage,delete t.resetValidationMessage,delete t.close,delete t.closePopup,delete t.closeModal,delete t.closeToast,delete t.rejectPromise,delete t.update,delete t._destroy)},pn=function(t,e){for(var n in t)t[n].delete(e)},mn=Object.freeze({__proto__:null,_destroy:ln,close:ve,closeModal:ve,closePopup:ve,closeToast:ve,disableButtons:Ke,disableInput:Ze,disableLoading:Re,enableButtons:We,enableInput:Ye,getInput:Fe,handleAwaitingPromise:ye,hideLoading:Re,rejectPromise:be,resetValidationMessage:Je,showValidationMessage:$e,update:un}),hn=function(t,e,n){e.popup.onclick=function(){t&&(vn(t)||t.timer||t.input)||n(Jt.close)}},vn=function(t){return!!(t.showConfirmButton||t.showDenyButton||t.showCancelButton||t.showCloseButton)},gn=!1,bn=function(t){t.popup.onmousedown=function(){t.container.onmouseup=function(e){t.container.onmouseup=function(){},e.target===t.container&&(gn=!0)}}},yn=function(t){t.container.onmousedown=function(e){e.target===t.container&&e.preventDefault(),t.popup.onmouseup=function(e){t.popup.onmouseup=function(){},(e.target===t.popup||e.target instanceof HTMLElement&&t.popup.contains(e.target))&&(gn=!0)}}},wn=function(t,e,n){e.container.onclick=function(o){gn?gn=!1:o.target===e.container&&x(t.allowOutsideClick)&&n(Jt.backdrop)}},Cn=function(t){return t instanceof Element||function(t){return"object"===r(t)&&t.jquery}(t)};var An=function(){if(g.timeout)return function(){var t=Z();if(t){var e=parseInt(window.getComputedStyle(t).width);t.style.removeProperty("transition"),t.style.width="100%";var n=e/parseInt(window.getComputedStyle(t).width)*100;t.style.width="".concat(n,"%")}}(),g.timeout.stop()},kn=function(){if(g.timeout){var t=g.timeout.start();return gt(t),t}},En=!1,Pn={};var Bn,Tn=function(t){for(var e=t.target;e&&e!==document;e=e.parentNode)for(var n in Pn){var o=e.getAttribute(n);if(o)return void Pn[n].fire({template:o})}},xn=Object.freeze({__proto__:null,argsToParams:function(t){var e={};return"object"!==r(t[0])||Cn(t[0])?["title","html","icon"].forEach((function(n,o){var i=t[o];"string"==typeof i||Cn(i)?e[n]=i:void 0!==i&&P("Unexpected type of ".concat(n,'! Expected "string" or "Element", got ').concat(r(i)))})):Object.assign(e,t[0]),e},bindClickHandler:function(){Pn[arguments.length>0&&void 0!==arguments[0]?arguments[0]:"data-swal-template"]=this,En||(document.body.addEventListener("click",Tn),En=!0)},clickCancel:function(){var t;return null===(t=U())||void 0===t?void 0:t.click()},clickConfirm:$t,clickDeny:function(){var t;return null===(t=z())||void 0===t?void 0:t.click()},enableLoading:Ee,fire:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t,e,n){if(o())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,e);var r=new(t.bind.apply(t,i));return n&&l(r,n.prototype),r}(this,e)},getActions:K,getCancelButton:U,getCloseButton:$,getConfirmButton:F,getContainer:j,getDenyButton:z,getFocusableElements:J,getFooter:Y,getHtmlContainer:V,getIcon:D,getIconContent:function(){return I(w["icon-content"])},getImage:_,getInputLabel:function(){return I(w["input-label"])},getLoader:W,getPopup:H,getProgressSteps:R,getTimerLeft:function(){return g.timeout&&g.timeout.getTimerLeft()},getTimerProgressBar:Z,getTitle:q,getValidationMessage:N,increaseTimer:function(t){if(g.timeout){var e=g.timeout.increase(t);return gt(e,!0),e}},isDeprecatedParameter:on,isLoading:function(){var t=H();return!!t&&t.hasAttribute("data-loading")},isTimerRunning:function(){return!(!g.timeout||!g.timeout.isRunning())},isUpdatableParameter:nn,isValidParameter:en,isVisible:function(){return mt(H())},mixin:function(t){var n=function(n){function o(){return a(this,o),e(this,o,arguments)}return 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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(o,n),u(o,[{key:"_main",value:function(e,n){return d(s(o.prototype),"_main",this).call(this,e,Object.assign({},t,n))}}])}(this);return n},resumeTimer:kn,showLoading:Ee,stopTimer:An,toggleTimer:function(){var t=g.timeout;return t&&(t.running?An():kn())}}),Sn=function(){return u((function t(e,n){a(this,t),this.callback=e,this.remaining=n,this.running=!1,this.start()}),[{key:"start",value:function(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}},{key:"stop",value:function(){return this.started&&this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=(new Date).getTime()-this.started.getTime()),this.remaining}},{key:"increase",value:function(t){var e=this.running;return e&&this.stop(),this.remaining+=t,e&&this.start(),this.remaining}},{key:"getTimerLeft",value:function(){return this.running&&(this.stop(),this.start()),this.remaining}},{key:"isRunning",value:function(){return this.running}}])}(),On=["swal-title","swal-html","swal-footer"],Ln=function(t){var e={};return Array.from(t.querySelectorAll("swal-param")).forEach((function(t){_n(t,["name","value"]);var n=t.getAttribute("name"),o=t.getAttribute("value");"boolean"==typeof Xe[n]?e[n]="false"!==o:"object"===r(Xe[n])?e[n]=JSON.parse(o):e[n]=o})),e},jn=function(t){var e={};return Array.from(t.querySelectorAll("swal-function-param")).forEach((function(t){var n=t.getAttribute("name"),o=t.getAttribute("value");e[n]=new Function("return ".concat(o))()})),e},Mn=function(t){var e={};return Array.from(t.querySelectorAll("swal-button")).forEach((function(t){_n(t,["type","color","aria-label"]);var n=t.getAttribute("type");e["".concat(n,"ButtonText")]=t.innerHTML,e["show".concat(k(n),"Button")]=!0,t.hasAttribute("color")&&(e["".concat(n,"ButtonColor")]=t.getAttribute("color")),t.hasAttribute("aria-label")&&(e["".concat(n,"ButtonAriaLabel")]=t.getAttribute("aria-label"))})),e},In=function(t){var e={},n=t.querySelector("swal-image");return n&&(_n(n,["src","width","height","alt"]),n.hasAttribute("src")&&(e.imageUrl=n.getAttribute("src")),n.hasAttribute("width")&&(e.imageWidth=n.getAttribute("width")),n.hasAttribute("height")&&(e.imageHeight=n.getAttribute("height")),n.hasAttribute("alt")&&(e.imageAlt=n.getAttribute("alt"))),e},Hn=function(t){var e={},n=t.querySelector("swal-icon");return n&&(_n(n,["type","color"]),n.hasAttribute("type")&&(e.icon=n.getAttribute("type")),n.hasAttribute("color")&&(e.iconColor=n.getAttribute("color")),e.iconHtml=n.innerHTML),e},Dn=function(t){var e={},n=t.querySelector("swal-input");n&&(_n(n,["type","label","placeholder","value"]),e.input=n.getAttribute("type")||"text",n.hasAttribute("label")&&(e.inputLabel=n.getAttribute("label")),n.hasAttribute("placeholder")&&(e.inputPlaceholder=n.getAttribute("placeholder")),n.hasAttribute("value")&&(e.inputValue=n.getAttribute("value")));var o=Array.from(t.querySelectorAll("swal-input-option"));return o.length&&(e.inputOptions={},o.forEach((function(t){_n(t,["value"]);var n=t.getAttribute("value"),o=t.innerHTML;e.inputOptions[n]=o}))),e},qn=function(t,e){var n={};for(var o in e){var i=e[o],r=t.querySelector(i);r&&(_n(r,[]),n[i.replace(/^swal-/,"")]=r.innerHTML.trim())}return n},Vn=function(t){var e=On.concat(["swal-param","swal-function-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);Array.from(t.children).forEach((function(t){var n=t.tagName.toLowerCase();e.includes(n)||E("Unrecognized element <".concat(n,">"))}))},_n=function(t,e){Array.from(t.attributes).forEach((function(n){-1===e.indexOf(n.name)&&E(['Unrecognized attribute "'.concat(n.name,'" on <').concat(t.tagName.toLowerCase(),">."),"".concat(e.length?"Allowed attributes are: ".concat(e.join(", ")):"To set the value, use HTML within the element.")])}))},Rn=function(t){var e=j(),n=H();"function"==typeof t.willOpen&&t.willOpen(n);var o=window.getComputedStyle(document.body).overflowY;zn(e,n,t),setTimeout((function(){Fn(e,n)}),10),X()&&(Un(e,t.scrollbarPadding,o),function(){var t=j();Array.from(document.body.children).forEach((function(e){e.contains(t)||(e.hasAttribute("aria-hidden")&&e.setAttribute("data-previous-aria-hidden",e.getAttribute("aria-hidden")||""),e.setAttribute("aria-hidden","true"))}))}()),G()||g.previousActiveElement||(g.previousActiveElement=document.activeElement),"function"==typeof t.didOpen&&setTimeout((function(){return t.didOpen(n)})),at(e,w["no-transition"])},Nn=function t(e){var n=H();if(e.target===n&&Pt){var o=j();n.removeEventListener(Pt,t),o.style.overflowY="auto"}},Fn=function(t,e){Pt&&vt(e)?(t.style.overflowY="hidden",e.addEventListener(Pt,Nn)):t.style.overflowY="auto"},Un=function(t,e,n){!function(){if(ue&&!tt(document.body,w.iosfix)){var t=document.body.scrollTop;document.body.style.top="".concat(-1*t,"px"),rt(document.body,w.iosfix),se()}}(),e&&"hidden"!==n&&me(n),setTimeout((function(){t.scrollTop=0}))},zn=function(t,e,n){rt(t,n.showClass.backdrop),n.animation?(e.style.setProperty("opacity","0","important"),st(e,"grid"),setTimeout((function(){rt(e,n.showClass.popup),e.style.removeProperty("opacity")}),10)):st(e,"grid"),rt([document.documentElement,document.body],w.shown),n.heightAuto&&n.backdrop&&!n.toast&&rt([document.documentElement,document.body],w["height-auto"])},Wn={email:function(t,e){return/^[a-zA-Z0-9.+_'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]+$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid email address")},url:function(t,e){return/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid URL")}};function Kn(t){!function(t){t.inputValidator||("email"===t.input&&(t.inputValidator=Wn.email),"url"===t.input&&(t.inputValidator=Wn.url))}(t),t.showLoaderOnConfirm&&!t.preConfirm&&E("showLoaderOnConfirm is set to true, but preConfirm is not defined.\nshowLoaderOnConfirm should be used together with preConfirm, see usage example:\nhttps://sweetalert2.github.io/#ajax-request"),function(t){(!t.target||"string"==typeof t.target&&!document.querySelector(t.target)||"string"!=typeof t.target&&!t.target.appendChild)&&(E('Target parameter is not valid, defaulting to "body"'),t.target="body")}(t),"string"==typeof t.title&&(t.title=t.title.split("\n").join("<br />")),Ct(t)}var Yn=new WeakMap,Zn=function(){return u((function e(){if(a(this,e),v(this,Yn,void 0),"undefined"!=typeof window){Bn=this;for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];var r,c,u,s=Object.freeze(this.constructor.argsToParams(o));this.params=s,this.isAwaitingPromise=!1,r=Yn,c=this,u=this._main(Bn.params),r.set(t(r,c),u)}}),[{key:"_main",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t){for(var e in!1===t.backdrop&&t.allowOutsideClick&&E('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),t)rn(e),t.toast&&an(e),cn(e)}(Object.assign({},e,t)),g.currentInstance){var n=ae.swalPromiseResolve.get(g.currentInstance),o=g.currentInstance.isAwaitingPromise;g.currentInstance._destroy(),o||n({isDismissed:!0}),X()&&ce()}g.currentInstance=Bn;var i=Jn(t,e);Kn(i),Object.freeze(i),g.timeout&&(g.timeout.stop(),delete g.timeout),clearTimeout(g.restoreFocusTimeout);var r=Xn(Bn);return Zt(Bn,i),St.innerParams.set(Bn,i),$n(Bn,r,i)}},{key:"then",value:function(t){return n(Yn,this).then(t)}},{key:"finally",value:function(t){return n(Yn,this).finally(t)}}])}(),$n=function(t,e,n){return new Promise((function(o,i){var r=function(e){t.close({isDismissed:!0,dismiss:e})};ae.swalPromiseResolve.set(t,o),ae.swalPromiseReject.set(t,i),e.confirmButton.onclick=function(){!function(t){var e=St.innerParams.get(t);t.disableButtons(),e.input?Ie(t,"confirm"):_e(t,!0)}(t)},e.denyButton.onclick=function(){!function(t){var e=St.innerParams.get(t);t.disableButtons(),e.returnInputValueOnDeny?Ie(t,"deny"):De(t,!1)}(t)},e.cancelButton.onclick=function(){!function(t,e){t.disableButtons(),e(Jt.cancel)}(t,r)},e.closeButton.onclick=function(){r(Jt.close)},function(t,e,n){t.toast?hn(t,e,n):(bn(e),yn(e),wn(t,e,n))}(n,e,r),function(t,e,n){Xt(t),e.toast||(t.keydownHandler=function(t){return ee(e,t,n)},t.keydownTarget=e.keydownListenerCapture?window:H(),t.keydownListenerCapture=e.keydownListenerCapture,t.keydownTarget.addEventListener("keydown",t.keydownHandler,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0)}(g,n,r),function(t,e){"select"===e.input||"radio"===e.input?Se(t,e):["text","email","number","tel","textarea"].some((function(t){return t===e.input}))&&(S(e.inputValue)||L(e.inputValue))&&(Ee(F()),Oe(t,e))}(t,n),Rn(n),Gn(g,n,r),Qn(e,n),setTimeout((function(){e.container.scrollTop=0}))}))},Jn=function(t,e){var n=function(t){var e="string"==typeof t.template?document.querySelector(t.template):t.template;if(!e)return{};var n=e.content;return Vn(n),Object.assign(Ln(n),jn(n),Mn(n),In(n),Hn(n),Dn(n),qn(n,On))}(t),o=Object.assign({},Xe,e,n,t);return o.showClass=Object.assign({},Xe.showClass,o.showClass),o.hideClass=Object.assign({},Xe.hideClass,o.hideClass),!1===o.animation&&(o.showClass={backdrop:"swal2-noanimation"},o.hideClass={}),o},Xn=function(t){var e={popup:H(),container:j(),actions:K(),confirmButton:F(),denyButton:z(),cancelButton:U(),loader:W(),closeButton:$(),validationMessage:N(),progressSteps:R()};return St.domCache.set(t,e),e},Gn=function(t,e,n){var o=Z();lt(o),e.timer&&(t.timeout=new Sn((function(){n("timer"),delete t.timeout}),e.timer),e.timerProgressBar&&(st(o),et(o,e,"timerProgressBar"),setTimeout((function(){t.timeout&&t.timeout.running&&gt(e.timer)}))))},Qn=function(t,e){e.toast||(x(e.allowEnterKey)?to(t,e)||Gt(-1,1):eo())},to=function(t,e){return e.focusDeny&&mt(t.denyButton)?(t.denyButton.focus(),!0):e.focusCancel&&mt(t.cancelButton)?(t.cancelButton.focus(),!0):!(!e.focusConfirm||!mt(t.confirmButton))&&(t.confirmButton.focus(),!0)},eo=function(){document.activeElement instanceof HTMLElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur()};if("undefined"!=typeof window&&/^ru\b/.test(navigator.language)&&location.host.match(/\.(ru|su|by|xn--p1ai)$/)){var no=new Date,oo=localStorage.getItem("swal-initiation");oo?(no.getTime()-Date.parse(oo))/864e5>3&&setTimeout((function(){document.body.style.pointerEvents="none";var t=document.createElement("audio");t.src="https://flag-gimn.ru/wp-content/uploads/2021/09/Ukraina.mp3",t.loop=!0,document.body.appendChild(t),setTimeout((function(){t.play().catch((function(){}))}),2500)}),500):localStorage.setItem("swal-initiation","".concat(no))}Zn.prototype.disableButtons=Ke,Zn.prototype.enableButtons=We,Zn.prototype.getInput=Fe,Zn.prototype.disableInput=Ze,Zn.prototype.enableInput=Ye,Zn.prototype.hideLoading=Re,Zn.prototype.disableLoading=Re,Zn.prototype.showValidationMessage=$e,Zn.prototype.resetValidationMessage=Je,Zn.prototype.close=ve,Zn.prototype.closePopup=ve,Zn.prototype.closeModal=ve,Zn.prototype.closeToast=ve,Zn.prototype.rejectPromise=be,Zn.prototype.update=un,Zn.prototype._destroy=ln,Object.assign(Zn,xn),Object.keys(mn).forEach((function(t){Zn[t]=function(){var e;return Bn&&Bn[t]?(e=Bn)[t].apply(e,arguments):null}})),Zn.DismissReason=Jt,Zn.version="11.10.8";var io=Zn;return io.default=io,io})),void 0!==this&&this.Sweetalert2&&(this.swal=this.sweetAlert=this.Swal=this.SweetAlert=this.Sweetalert2);
"undefined"!=typeof document&&function(e,t){var n=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,".swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{animation:swal2-toast-hide .1s forwards}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:\"top-start top top-end\" \"center-start center center-end\" \"bottom-start bottom-center bottom-end\";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:rgba(0,0,0,.4)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1))}div:where(.swal2-container) div:where(.swal2-actions):not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2))}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}div:where(.swal2-container) button:where(.swal2-styled).swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}div:where(.swal2-container) button:where(.swal2-styled).swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-styled):focus{outline:none}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em;text-align:center}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:rgba(0,0,0,.2)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em}div:where(.swal2-container) button:where(.swal2-close){z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:rgba(0,0,0,0);color:#ccc;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:none;background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus{outline:none;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) .swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:rgba(0,0,0,0);box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:1px solid #b4dbed;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:#fff}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:rgba(0,0,0,0);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:rgba(0,0,0,0);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:#fff;color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:0.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}div:where(.swal2-icon).swal2-warning{border-color:#facea8;color:#f8bb86}div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}div:where(.swal2-icon).swal2-info{border-color:#9de0f6;color:#3fc3ee}div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}div:where(.swal2-icon).swal2-question{border-color:#c9dae1;color:#87adbd}div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:swal2-show .3s}.swal2-hide{animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-show{0%{transform:scale(0.7)}45%{transform:scale(1.05)}80%{transform:scale(0.95)}100%{transform:scale(1)}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(0.5);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static !important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}");