/*! For license information please see video.min.js.LICENSE.txt */ !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(){var e="8.18.1";let t={},i=function(e,i){return t[e]=t[e]||[],i&&(t[e]=t[e].concat(i)),t[e]};function s(e,s){return!((s=i(e).indexOf(s))<=-1||(t[e]=t[e].slice(),t[e].splice(s,1),0))}let r={prefixed:!0};var n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],a=n[0];let o;for(let e=0;e{t=d.levels[t];var s,r=new RegExp(`^(${t})$`);let n=o;if("log"!==e&&i.unshift(e.toUpperCase()+":"),h&&(n="%c"+o,i.unshift(h)),i.unshift(n+":"),l&&(l.push([].concat(i)),s=l.length-1e3,l.splice(0,0e(t+` ${n=void 0!==n?n:i} `+r,n,void 0!==a?a:s),a.createNewLogger=(t,i,s)=>e(t,i,s),a.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},a.level=e=>{if("string"==typeof e){if(!a.levels.hasOwnProperty(e))throw new Error(`"${e}" in not a valid log level`);n=e}return n},(a.history=()=>l?[].concat(l):[]).filter=e=>(l||[]).filter((t=>new RegExp(`.*${e}.*`).test(t[0]))),a.history.clear=()=>{l&&(l.length=0)},a.history.disable=()=>{null!==l&&(l.length=0,l=null)},a.history.enable=()=>{null===l&&(l=[])},a.error=(...e)=>r("error",n,e),a.warn=(...e)=>r("warn",n,e),a.debug=(...e)=>r("debug",n,e),a}("VIDEOJS"),u=h.createLogger,c=Object.prototype.toString;function p(e,t){d(e).forEach((i=>t(e[i],i)))}function m(e,t,i=0){return d(e).reduce(((i,s)=>t(i,e[s],s)),i)}function g(e){return!!e&&"object"==typeof e}function f(e){return g(e)&&"[object Object]"===c.call(e)&&e.constructor===Object}function y(...e){let t={};return e.forEach((e=>{e&&p(e,((e,i)=>{f(e)?(f(t[i])||(t[i]={}),t[i]=y(t[i],e)):t[i]=e}))})),t}function _(e={}){var t,i,s=[];for(t in e)e.hasOwnProperty(t)&&(i=e[t],s.push(i));return s}function v(e,t,i,s=!0){let r=i=>Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0});var n={configurable:!0,enumerable:!0,get(){var e=i();return r(e),e}};return s&&(n.set=r),Object.defineProperty(e,t,n)}let b,T=Object.freeze({__proto__:null,each:p,reduce:m,isObject:g,isPlain:f,merge:y,values:_,defineLazyProperty:v}),S=!1,w=null,E=!1,C=!1,k=!1,I=!1,x=!1,A=null,D=null;var P=Boolean(window.cast&&window.cast.framework&&window.cast.framework.CastReceiverContext);let L=null,O=!1,R=!1,N=!1,M=!1,U=!1,B=!1,F=!1,q=Boolean(G()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch));var j,H=window.navigator&&window.navigator.userAgentData;if(H&&H.platform&&H.brands&&(E="Android"===H.platform,k=Boolean(H.brands.find((e=>"Microsoft Edge"===e.brand))),I=Boolean(H.brands.find((e=>"Chromium"===e.brand))),x=!k&&I,A=D=(H.brands.find((e=>"Chromium"===e.brand))||{}).version||null,R="Windows"===H.platform),!I){let e=window.navigator&&window.navigator.userAgent||"";S=/iPod/i.test(e),w=(H=e.match(/OS (\d+)_/i))&&H[1]?H[1]:null,E=/Android/i.test(e),b=(H=e.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?($t=H[1]&&parseFloat(H[1]),j=H[2]&&parseFloat(H[2]),$t&&j?parseFloat(H[1]+"."+H[2]):$t||null):null,C=/Firefox/i.test(e),k=/Edg/i.test(e),I=/Chrome/i.test(e)||/CriOS/i.test(e),x=!k&&I,A=D=(j=e.match(/(Chrome|CriOS)\/(\d+)/))&&j[2]?parseFloat(j[2]):null,L=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}(),U=/Tizen/i.test(e),B=/Web0S/i.test(e),F=U||B,O=/Safari/i.test(e)&&!x&&!E&&!k&&!F,R=/Windows/i.test(e),N=/iPad/i.test(e)||O&&q&&!/iPhone/i.test(e),M=/iPhone/i.test(e)&&!N}let V=M||N||S,z=(O||V)&&!x;var $=Object.freeze({__proto__:null,get IS_IPOD(){return S},get IOS_VERSION(){return w},get IS_ANDROID(){return E},get ANDROID_VERSION(){return b},get IS_FIREFOX(){return C},get IS_EDGE(){return k},get IS_CHROMIUM(){return I},get IS_CHROME(){return x},get CHROMIUM_VERSION(){return A},get CHROME_VERSION(){return D},IS_CHROMECAST_RECEIVER:P,get IE_VERSION(){return L},get IS_SAFARI(){return O},get IS_WINDOWS(){return R},get IS_IPAD(){return N},get IS_IPHONE(){return M},get IS_TIZEN(){return U},get IS_WEBOS(){return B},get IS_SMART_TV(){return F},TOUCH_ENABLED:q,IS_IOS:V,IS_ANY_SAFARI:z});function W(e){return"string"==typeof e&&Boolean(e.trim())}function G(){return document===window.document}function X(e){return g(e)&&1===e.nodeType}function K(){try{return window.parent!==window.self}catch(e){return!0}}function Y(e){return function(t,i){return W(t)?(i=X(i=W(i)?document.querySelector(i):i)?i:document)[e]&&i[e](t):document[e](null)}}function Q(e="div",t={},i={},s){let r=document.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){var i=t[e];"textContent"===e?J(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),s&&ye(r,s),r}function J(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function Z(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function ee(e,t){if(0<=t.indexOf(" "))throw new Error("class has illegal whitespace characters");return e.classList.contains(t)}function te(e,...t){return e.classList.add(...t.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),e}function ie(e,...t){return e?(e.classList.remove(...t.reduce(((e,t)=>e.concat(t.split(/\s+/))),[])),e):(h.warn("removeClass was called with an element that doesn't exist"),null)}function se(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 re(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var s=t[i];null==s||!1===s?e.removeAttribute(i):e.setAttribute(i,!0===s?"":s)}))}function ne(e){var t={},i=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&0{void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(Se(e,"height"))),i.width||(i.width=parseFloat(Se(e,"width"))),i}}function ce(e){if(!e||!e.offsetParent)return{left:0,top:0,width:0,height:0};var t=e.offsetWidth,i=e.offsetHeight;let s=0,n=0;for(;e.offsetParent&&e!==document[r.fullscreenElement];)s+=e.offsetLeft,n+=e.offsetTop,e=e.offsetParent;return{left:s,top:n,width:t,height:i}}function pe(e,t){var i={x:0,y:0};if(V){let t=e;for(;t&&"html"!==t.nodeName.toLowerCase();){var s,r=Se(t,"transform");/^matrix/.test(r)?(s=r.slice(7,-1).split(/,\s/).map(Number),i.x+=s[4],i.y+=s[5]):/^matrix3d/.test(r)&&(s=r.slice(9,-1).split(/,\s/).map(Number),i.x+=s[12],i.y+=s[13]),t.assignedSlot&&t.assignedSlot.parentElement&&window.WebKitCSSMatrix&&(r=window.getComputedStyle(t.assignedSlot.parentElement).transform,r=new window.WebKitCSSMatrix(r),i.x+=r.m41,i.y+=r.m42),t=t.parentNode||t.host}}var n={},a=ce(t.target),o=(e=ce(e)).width,l=e.height;let d=t.offsetY-(e.top-a.top),h=t.offsetX-(e.left-a.left);return t.changedTouches&&(h=t.changedTouches[0].pageX-e.left,d=t.changedTouches[0].pageY+e.top,V)&&(h-=i.x,d-=i.y),n.y=1-Math.max(0,Math.min(1,d/l)),n.x=Math.max(0,Math.min(1,h/o)),n}function me(e){return g(e)&&3===e.nodeType}function ge(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function fe(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((e=>X(e="function"==typeof e?e():e)||me(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0)).filter((e=>e))}function ye(e,t){return fe(t).forEach((t=>e.appendChild(t))),e}function _e(e,t){return ye(ge(e),t)}function ve(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||"mousedown"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons}let be=Y("querySelector"),Te=Y("querySelectorAll");function Se(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]:""}}function we(e){[...document.styleSheets].forEach((t=>{try{var i=[...t.cssRules].map((e=>e.cssText)).join(""),s=document.createElement("style");s.textContent=i,e.document.head.appendChild(s)}catch(s){(i=document.createElement("link")).rel="stylesheet",i.type=t.type,i.media=t.media.mediaText,i.href=t.href,e.document.head.appendChild(i)}}))}var Ee=Object.freeze({__proto__:null,isReal:G,isEl:X,isInFrame:K,createEl:Q,textContent:J,prependTo:Z,hasClass:ee,addClass:te,removeClass:ie,toggleClass:se,setAttributes:re,getAttributes:ne,getAttribute:ae,setAttribute:oe,removeAttribute:le,blockTextSelection:de,unblockTextSelection:he,getBoundingClientRect:ue,findPosition:ce,getPointerPosition:pe,isTextNode:me,emptyEl:ge,normalizeContent:fe,appendContent:ye,insertContent:_e,isSingleLeftClick:ve,$:be,$$:Te,computedStyle:Se,copyStyleSheetsToWindow:we});function Ce(){if(!1!==ke.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")),s=e.concat(t,i);if(s&&0=t&&(e(...s),i=r)}}function Ge(e,t,i,s=window){let r;function n(){let n=this,a=arguments,o=function(){r=null,o=null,i||e.apply(n,a)};!r&&i&&e.apply(n,a),s.clearTimeout(r),r=s.setTimeout(o,t)}return n.cancel=()=>{s.clearTimeout(r),r=null},n}let Xe,Ke=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:30,bind_:$e,throttle:We,debounce:Ge});class Ye{on(e,t){var i=this.addEventListener;this.addEventListener=()=>{},Fe(this,e,t),this.addEventListener=i}off(e,t){qe(this,e,t)}one(e,t){var i=this.addEventListener;this.addEventListener=()=>{},He(this,e,t),this.addEventListener=i}any(e,t){var i=this.addEventListener;this.addEventListener=()=>{},Ve(this,e,t),this.addEventListener=i}trigger(e){var t=e.type||e;e=Me(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),je(this,e)}queueTrigger(e){Xe=Xe||new Map;let t=e.type||e,i=Xe.get(this);i||(i=new Map,Xe.set(this,i));var s=i.get(t);i.delete(t),window.clearTimeout(s),s=window.setTimeout((()=>{i.delete(t),0===i.size&&(i=null,Xe.delete(this)),this.trigger(e)}),0),i.set(t,s)}}Ye.prototype.allowedEvents_={},Ye.prototype.addEventListener=Ye.prototype.on,Ye.prototype.removeEventListener=Ye.prototype.off,Ye.prototype.dispatchEvent=Ye.prototype.trigger;let Qe=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),Je=e=>e instanceof Ye||!!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,et=(e,t,i)=>{if(!e||!e.nodeName&&!Je(e))throw new Error(`Invalid target for ${Qe(t)}#${i}; must be a DOM node or evented object.`)},tt=(e,t,i)=>{if(!Ze(e))throw new Error(`Invalid event type for ${Qe(t)}#${i}; must be a non-empty string or array.`)},it=(e,t,i)=>{if("function"!=typeof e)throw new Error(`Invalid listener for ${Qe(t)}#${i}; must be a function.`)},st=(e,t,i)=>{var s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;let r,n,a;return s?(r=e.eventBusEl_,3<=t.length&&t.shift(),[n,a]=t):(r=t[0],n=t[1],a=t[2]),et(r,e,i),tt(n,e,i),it(a,e,i),a=$e(e,a),{isTargetingSelf:s,target:r,type:n,listener:a}},rt=(e,t,i,s)=>{et(e,e,t),e.nodeName?ze[t](e,i,s):e[t](i,s)},nt={on(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=st(this,e,"on");if(rt(i,"on",s,r),!t){let t=()=>this.off(i,s,r);t.guid=r.guid,(e=()=>this.off("dispose",t)).guid=r.guid,rt(this,"on","dispose",t),rt(i,"on","dispose",e)}},one(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=st(this,e,"one");if(t)rt(i,"one",s,r);else{let e=(...t)=>{this.off(i,s,e),r.apply(null,t)};e.guid=r.guid,rt(i,"one",s,e)}},any(...e){let{isTargetingSelf:t,target:i,type:s,listener:r}=st(this,e,"any");if(t)rt(i,"any",s,r);else{let e=(...t)=>{this.off(i,s,e),r.apply(null,t)};e.guid=r.guid,rt(i,"any",s,e)}},off(e,t,i){!e||Ze(e)?qe(this.eventBusEl_,e,t):(t=t,et(e=e,this,"off"),tt(t,this,"off"),it(i,this,"off"),i=$e(this,i),this.off("dispose",i),e.nodeName?(qe(e,t,i),qe(e,"dispose",i)):Je(e)&&(e.off(t,i),e.off("dispose",i)))},trigger(e,t){et(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(Ze(i))return je(this.eventBusEl_,e,t);throw new Error(`Invalid event type for ${Qe(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`)}};function at(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_=Q("span",{className:"vjs-event-bus"});Object.assign(e,nt),e.eventedCallbacks&&e.eventedCallbacks.forEach((e=>{e()})),e.on("dispose",(()=>{e.off(),[e,e.el_,e.eventBusEl_].forEach((function(e){e&&Le.has(e)&&Le.delete(e)})),window.setTimeout((()=>{e.eventBusEl_=null}),0)}))}let ot={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&&Je(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function lt(e,t){Object.assign(e,ot),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&Je(e)&&e.on("statechanged",e.handleStateChanged)}function dt(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toLowerCase()))}function ht(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toUpperCase()))}function ut(e,t){return ht(e)===ht(t)}let ct=Object.freeze({__proto__:null,toLowerCase:dt,toTitleCase:ht,titleCaseEquals:ut});class pt{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_"+Oe++),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&&(at(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),lt(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()}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 Q(e,t,i)}localize(e,t,i=e){var s=this.player_.language&&this.player_.language(),r=(n=this.player_.languages&&this.player_.languages())&&n[s],n=(s=s&&s.split("-")[0],n&&n[s]);let a=i;return r&&r[e]?a=r[e]:n&&n[e]&&(a=n[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{let i,s;return s="string"==typeof t?(i=t,e[i]||this.options_[i]||{}):(i=t.name,t),{name:i,opts:s}})).filter((e=>(e=pt.getComponent(e.opts.componentClass||ht(e.name)))&&!s.isTech(e))).forEach((e=>{var t=e.name;let s=e.opts;!1!==(s=void 0!==i[t]?i[t]:s)&&((s=!0===s?{}:s).playerOptions=this.options_.playerOptions,e=this.addChild(t,s))&&(this[t]=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{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=$e(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=$e(this,e),t=window.requestAnimationFrame((()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()})),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=$e(this,t);var i=this.requestAnimationFrame((()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)}));return 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})))}getIsDisabled(){return Boolean(this.el_.disabled)}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return 0<=(e||this.el_).tabIndex&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(e){var t=(e=window.getComputedStyle(e,null)).getPropertyValue("visibility");return"none"!==e.getPropertyValue("display")&&!["hidden","collapse"].includes(t)}var i;return!(!function(e){if(e.offsetWidth+e.offsetHeight+e.getBoundingClientRect().height+e.getBoundingClientRect().width!==0){var t={x:e.getBoundingClientRect().left+e.offsetWidth/2,y:e.getBoundingClientRect().top+e.offsetHeight/2};if(!(t.x<0||t.x>(document.documentElement.clientWidth||window.innerWidth)||t.y<0||t.y>(document.documentElement.clientHeight||window.innerHeight))){let i=document.elementFromPoint(t.x,t.y);for(;i;){if(i===e)return 1;if(!i.parentNode)return;i=i.parentNode}}}}(e=e||this.el())||!t((i=e).parentElement)||!t(i)||"0"===i.style.opacity||"0px"===window.getComputedStyle(i).height||"0px"===window.getComputedStyle(i).width||e.parentElement&&!(0<=e.tabIndex))}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=pt.getComponent("Tech"))&&i.isTech(t),s=pt===t||pt.prototype.isPrototypeOf(t.prototype);if(i||!s){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=ht(e),pt.components_||(pt.components_={}),s=pt.getComponent("Player"),"Player"===e&&s&&s.players){let e=s.players;if(i=Object.keys(e),e&&0e[t])).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return pt.components_[e]=t,pt.components_[dt(e)]=t}static getComponent(e){if(e&&pt.components_)return pt.components_[e]}}function mt(e,t,i,s){var r=s,n=i.length-1;if("number"!=typeof r||r<0||n(e||[]).values()),t}function ft(e,t){return Array.isArray(e)?gt(e):void 0===e||void 0===t?gt():gt([[e,t]])}function yt(e,t){e=e<0?0:e;let i=Math.floor(e%60),s=Math.floor(e/60%60),r=Math.floor(e/3600);var n=Math.floor(t/60%60);return t=Math.floor(t/3600),r=0<(r=isNaN(e)||e===1/0?s=i="-":r)||0t&&(r=t),i+=r-s;return i/t}function wt(e){if(e instanceof wt)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:g(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=wt.defaultMessages[this.code]||"")}function Et(e){return null!=e&&"function"==typeof e.then}function Ct(e){Et(e)&&e.then(null,(e=>{}))}function kt(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(((t,i,s)=>(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}}))})}var It;H=Object.freeze({__proto__:null,createTimeRanges:ft,createTimeRange:ft,setFormatTime:vt,resetFormatTime:bt,formatTime:Tt}),wt.prototype.code=0,wt.prototype.message="",wt.prototype.status=null,wt.prototype.metadata=null,wt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],wt.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."},wt.MEDIA_ERR_CUSTOM=0,wt.prototype.MEDIA_ERR_CUSTOM=0,wt.MEDIA_ERR_ABORTED=1,wt.prototype.MEDIA_ERR_ABORTED=1,wt.MEDIA_ERR_NETWORK=2,wt.prototype.MEDIA_ERR_NETWORK=2,wt.MEDIA_ERR_DECODE=3,wt.prototype.MEDIA_ERR_DECODE=3,wt.MEDIA_ERR_SRC_NOT_SUPPORTED=4,wt.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4,wt.MEDIA_ERR_ENCRYPTED=5,wt.prototype.MEDIA_ERR_ENCRYPTED=5;let xt="vjs-modal-dialog";class At extends pt{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_=Q("div",{className:xt+"-content"},{role:"document"}),this.descEl_=Q("p",{className:xt+"-description vjs-control-text",id:this.el().getAttribute("aria-describedby")}),J(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","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return xt+" 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_?this.options_.fillAlways&&this.fill():(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({type:"modalclose",bubbles:!0}),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,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),_e(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t),(e=this.getChild("closeButton"))&&i.appendChild(e.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),ge(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(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),"Escape"===e.key&&this.closeable())e.preventDefault(),this.close();else if("Tab"===e.key){var t=this.focusableEls_(),i=this.el_.querySelector(":focus");let s;for(let e=0;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")))}}At.prototype.options_={pauseOnOpen:!0,temporary:!0},pt.registerComponent("ModalDialog",At);class Dt extends Ye{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t{this.trigger({track:e,type:"labelchange",target:this})},Je(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,s=this.length;ithis.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 Rt{constructor(e){Rt.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){var t=this.length||0;let i=0;function s(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,tt[e],set(){}});Object.defineProperty(this,"label",{get:()=>i,set(e){e!==i&&(i=e,this.trigger("labelchange"))}})}}function qt(e){return new URL(e,document.baseURI)}function jt(e){return new URL(e,document.baseURI).href}function Ht(e,t=window.location){return qt(e).origin!==t.origin}let Vt=function(e){return"string"==typeof e&&(e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e))?e.pop().toLowerCase():""},zt=Object.freeze({__proto__:null,parseUrl:qt,getAbsoluteURL:jt,getFileExtension:Vt,isCrossOrigin:Ht});var $t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Wt(e,t){return e(t={exports:{}},t.exports),t.exports}var Gt="undefined"!=typeof window?window:void 0!==$t?$t:"undefined"!=typeof self?self:{},Xt=Wt((function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var i=0,s=new Array(t);i=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(this.getForType(e));!(s=i()).done;){var s=s.value;try{t=s(t)}catch(e){}}return t},e}();var Jt=function(){function e(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var t=e.prototype;return t.getIsEnabled=function(){return this.enabled_},t.enable=function(){this.enabled_=!0},t.disable=function(){this.enabled_=!1},t.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},t.getMaxAttempts=function(){return this.maxAttempts_},t.setMaxAttempts=function(e){this.maxAttempts_=e},t.getDelayFactor=function(){return this.delayFactor_},t.setDelayFactor=function(e){this.delayFactor_=e},t.getFuzzFactor=function(){return this.fuzzFactor_},t.setFuzzFactor=function(e){this.fuzzFactor_=e},t.getInitialDelay=function(){return this.initialDelay_},t.setInitialDelay=function(e){this.initialDelay_=e},t.createRetry=function(e){var t=(e=void 0===e?{}:e).maxAttempts;return new Zt({maxAttempts:t||this.maxAttempts_,delayFactor:e.delayFactor||this.delayFactor_,fuzzFactor:e.fuzzFactor||this.fuzzFactor_,initialDelay:e.initialDelay||this.initialDelay_})},e}(),Zt=function(){function e(e){this.maxAttempts_=e.maxAttempts,this.delayFactor_=e.delayFactor,this.fuzzFactor_=e.fuzzFactor,this.currentDelay_=e.initialDelay,this.currentAttempt_=1}var t=e.prototype;return t.moveToNextAttempt=function(){this.currentAttempt_++;var e=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+e},t.shouldRetry=function(){return this.currentAttempt_h.error(e))),window.console)&&window.console.groupEnd&&window.console.groupEnd(),i.flush()}function li(e,t){var i={uri:e};(e=Ht(e))&&(i.cors=e),(e="use-credentials"===t.tech_.crossOrigin())&&(i.withCredentials=e),ei(i,$e(this,(function(e,i,s){if(e)return h.error(e,i);t.loaded_=!0,"function"!=typeof window.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(e=>{if("vttjserror"!==e.type)return oi(s,t);h.error("vttjs failed to load, stopping trying to process "+t.src)})):oi(s,t)})))}ei.default=P;class di extends Ft{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");e=y(e,{kind:Ut[e.kind]||"subtitles",language:e.language||e.srclang||""});let t=Bt[e.mode]||"disabled",i=e.default,s=("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 Rt(this.cues_)),r=new Rt(this.activeCues_),n=!1;this.timeupdateHandler=$e(this,(function(e={}){this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,n)&&(this.trigger("cuechange"),n=!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){Bt[e]&&t!==e&&(t=e,this.preload_||"disabled"===t||0!==this.cues.length||li(this.src,this),this.stopTracking(),"disabled"!==t&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(0!==this.cues.length){var e=this.tech_.currentTime(),t=[];for(let s=0,r=this.cues.length;st,set(e){"boolean"==typeof e&&e!==t&&(t=e,this.trigger("enabledchange"))}}),e.enabled&&(this.enabled=e.enabled),this.loaded_=!0}}class ui extends Ft{constructor(e={}){super(e=y(e,{kind:Nt[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 ci extends Ye{constructor(e={}){super();let t,i=new di(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=ci.NONE,i.addEventListener("loadeddata",(()=>{t=ci.LOADED,this.trigger({type:"load",target:this})}))}}ci.prototype.allowedEvents_={load:"load"},ci.NONE=0,ci.LOADING=1,ci.LOADED=2,ci.ERROR=3;let pi={audio:{ListClass:class extends Dt{constructor(e=[]){for(let t=e.length-1;0<=t;t--)if(e[t].enabled){Pt(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Pt(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Pt(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:hi,capitalName:"Audio"},video:{ListClass:class extends Dt{constructor(e=[]){for(let t=e.length-1;0<=t;t--)if(e[t].selected){Lt(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let e=0;e{this.changing_||(this.changing_=!0,Lt(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:ui,capitalName:"Video"},text:{ListClass:Ot,TrackClass:di,capitalName:"Text"}},mi=(Object.keys(pi).forEach((function(e){pi[e].getterName=e+"Tracks",pi[e].privateName=e+"Tracks_"})),{remoteText:{ListClass:Ot,TrackClass:di,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]*>?)?/))[1]||o[2],t=t.substr(o.length),o):null);)"<"===o[0]?"/"===o[1]?h.length&&h[h.length-1]===o.substr(2).replace(">","")&&(h.pop(),d=d.parentNode):(s=bi(o.substr(1,o.length-2)))?(i=e.document.createProcessingInstruction("timestamp",s),d.appendChild(i)):(s=o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/))&&(r=s[1],n=s[3],a=void 0,i=(a=Ei[r])?(a=e.document.createElement(a),(r=ki[r])&&n&&(a[r]=n.trim()),a):null)&&(r=d,Ii[(n=i).localName]&&Ii[n.localName]!==r.localName||(s[2]&&((a=s[2].split(".")).forEach((function(e){var t=/^bg_/.test(e);e=t?e.slice(3):e,Ci.hasOwnProperty(e)&&(e=Ci[e],i.style[t?"background-color":"color"]=e)})),i.className=a.join(" ")),h.push(s[1]),d.appendChild(i),d=i)):d.appendChild(e.document.createTextNode((n=o,wi.innerHTML=n,n=wi.textContent,wi.textContent="",n)));return l}var Ai=[[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 Di(e){var t=[],i="";if(e&&e.childNodes)for(r(t,e);i=function e(t){var i,s,n;return t&&t.length?(s=(i=t.pop()).textContent||i.innerText)?(n=s.match(/^.*(\n|\r)/))?n[t.length=0]:s:"ruby"===i.tagName?e(t):i.childNodes?(r(t,i),e(t)):void 0:null}(t);)for(var s=0;s=i[0]&&e<=i[1])return 1}}(i.charCodeAt(s)))return"rtl";return"ltr";function r(e,t){for(var i=t.childNodes.length-1;0<=i;i--)e.push(t.childNodes[i])}}function Pi(){}function Li(e,t,i){Pi.call(this),this.cue=t,this.cueDiv=xi(e,t.text),this.applyStyles({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"},this.cueDiv),this.div=e.document.createElement("div"),e={direction:Di(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(e),this.div.appendChild(this.cueDiv);var s=0;switch(t.positionAlign){case"start":case"line-left":s=t.position;break;case"center":s=t.position-t.size/2;break;case"end":case"line-right":s=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(s,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(s,"%"),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 Oi(e){var t,i,s,r;e.div&&(t=e.div.offsetHeight,i=e.div.offsetWidth,s=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||s,this.height=e.height||t,this.bottom=e.bottom||s+(e.height||t),this.width=e.width||i,this.lineHeight=void 0!==r?r:e.lineHeight}function Ri(e,t,i,s){var r,n=new Oi(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,s=0,r=0;ru&&(h=h<0?-1:1,h*=Math.ceil(u/d)*d),o<0&&(h+=""===a.vertical?i.height:i.width,l=l.reverse()),n.move(c,h)}else{var p=n.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"],n=new Oi(t)}u=function(e,t){for(var r,n=new Oi(e),a=1,o=0;oe.left&&this.tope.top},Oi.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},Oi.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},Oi.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)},Oi.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}},Oi.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,s=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||s,height:e.height||t,bottom:e.bottom||s+(e.height||t),width:e.width||i}},Ni.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Ni.convertCueToDOMTree=function(e,t){return e&&t?xi(e,t):null},Ni.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var s=e.document.createElement("div");if(s.style.position="absolute",s.style.left="0",s.style.right="0",s.style.top="0",s.style.bottom="0",s.style.margin="1.5%",i.appendChild(s),function(e){for(var t=0;tthis.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})),gi.names.forEach((t=>{t=gi[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 gi.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($e(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 ft(0,0)}bufferedPercent(){return St(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(pi.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 s=t[i];"text"===e&&this.removeRemoteTextTrack(s),t.removeTrack(s)}}))}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 wt(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?ft(0,0):ft()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){pi.names.forEach((e=>{var t=pi[e];let i=()=>{this.trigger(e+"trackchange")},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",(()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)}))}))}addWebVttScript_(){if(!window.WebVTT)if(document.body.contains(this.el()))if(!this.options_["vtt.js"]&&f($i)&&0{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(){let e=this.textTracks(),t=this.remoteTextTracks(),i=t=>e.addTrack(t.track),s=t=>e.removeTrack(t.track),r=(t.on("addtrack",i),t.on("removetrack",s),this.addWebVttScript_(),()=>this.trigger("texttrackchange")),n=()=>{r();for(let i=0;ithis.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){let t=Oe++;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 Wi.canPlayType(e.type)}static isTech(e){return e.prototype instanceof Wi||e instanceof Wi||e===Wi}static registerTech(e,t){if(Wi.techs_||(Wi.techs_={}),!Wi.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!Wi.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(Wi.canPlaySource)return e=ht(e),Wi.techs_[e]=t,Wi.techs_[dt(e)]=t,"Tech"!==e&&Wi.defaultTechOrder_.push(e),t;throw new Error("Techs must have a static canPlaySource method on them")}static getTech(e){if(e)return Wi.techs_&&Wi.techs_[e]?Wi.techs_[e]:(e=ht(e),window&&window.videojs&&window.videojs[e]?(h.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)}}gi.names.forEach((function(e){let t=gi[e];Wi.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Wi.prototype.featuresVolumeControl=!0,Wi.prototype.featuresMuteControl=!0,Wi.prototype.featuresFullscreenResize=!1,Wi.prototype.featuresPlaybackRate=!1,Wi.prototype.featuresProgressEvents=!1,Wi.prototype.featuresSourceset=!1,Wi.prototype.featuresTimeupdateEvents=!1,Wi.prototype.featuresNativeTextTracks=!1,Wi.prototype.featuresVideoFrameCallback=!1,Wi.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){let s=e.sourceHandlers;s=s||(e.sourceHandlers=[]),void 0===i&&(i=s.length),s.splice(i,0,t)},e.canPlayType=function(t){var i,s=e.sourceHandlers||[];for(let e=0;et===Ki?Ki:i[e]?i[e](t):t}function ts(e){if(Array.isArray(e)){let t=[];e.forEach((function(e){e=ts(e),Array.isArray(e)?t=t.concat(e):g(e)&&t.push(e)})),e=t}else e="string"==typeof e&&e.trim()?[rs({src:e})]:g(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[rs(e)]:[];return e}let is={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"},ss=function(e=""){return e=Vt(e),is[e.toLowerCase()]||""};function rs(e){var t;return e.type||(t=ss(e.src))&&(e.type=t),e}let ns={codes:{play:415,pause:19,ff:417,rw:412,back:Jt=U?10009:B?461:8},names:{415:"play",19:"pause",417:"ff",412:"rw",[Jt]:"back"},isEventKey(e,t){return t=t.toLowerCase(),!(!this.names[e.keyCode]||this.names[e.keyCode]!==t)},getEventName(e){return this.names[e.keyCode]||(this.codes[e.code]?(e=this.codes[e.code],this.names[e]):null)}};class as extends Ye{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",(()=>{this.focus(this.updateFocusableComponents()[0])})),this.player_.on("modalclose",(()=>{this.refocusComponent()})),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",(()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(1{if(e.hasOwnProperty("el_")){if(e.getIsFocusable&&e.getIsAvailableToBeFocused&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el()))return void t.push(e);e.hasOwnProperty("children_")&&0{t.push({name:()=>"ModalButton"+(i+1),el:()=>e,getPositions:()=>{var t=e.getBoundingClientRect();return{boundingClientRect:{x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left},center:{x:t.left+t.width/2,y:t.top+t.height/2,width:0,height:0,top:t.top+t.height/2,right:t.left+t.width/2,bottom:t.top+t.height/2,left:t.left+t.width/2}}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:e=>!0,focus:()=>e.focus()})}))})),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){return e.el()?function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let e=0;ei!==t&&this.isInDirection_(s.boundingClientRect,i.getPositions().boundingClientRect,e)));(i=this.findBestCandidate_(s.center,i,e))?this.focus(i):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}}findBestCandidate_(e,t,i){let s=1/0,r=null;for(var n of t){var a=n.getPositions().center;(a=this.calculateDistance_(e,a,i))=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;ethis.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&&h.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=Q(e,t,i),this.player_.options_.experimentalSvgIcons||e.appendChild(Q("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(e),e}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=Q("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,J(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){" "===e.key||"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}pt.registerComponent("ClickableComponent",os);class ls extends os{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 Q("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(Q("picture",{className:"vjs-poster",tabIndex:-1},{},Q("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()?Ct(this.player_.play()):this.player_.pause())}}ls.prototype.crossorigin=ls.prototype.crossOrigin,pt.registerComponent("PosterImage",ls);let ds={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 hs(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 us(e,t,i){try{e.style[t]=i}catch(e){}}function cs(e){return e?e+"px":""}pt.registerComponent("TextTrackDisplay",class extends pt{constructor(e,t,i){super(e,t,i);let s=e=>{this.updateDisplayOverlay(),this.updateDisplay(e)};e.on("loadstart",(e=>this.toggleDisplay(e))),e.on("texttrackchange",(e=>this.updateDisplay(e))),e.on("loadedmetadata",(e=>{this.updateDisplayOverlay(),this.preselectTrack(e)})),e.ready($e(this,(function(){if(e.tech_&&e.tech_.featuresNativeTextTracks)this.hide();else{e.on("fullscreenchange",s),e.on("playerresize",s);let i=window.screen.orientation||window,r=window.screen.orientation?"change":"orientationchange";i.addEventListener(r,s),e.on("dispose",(()=>i.removeEventListener(r,s)));var t=this.options_.playerOptions.tracks||[];for(let e=0;e{var t;e.style.inset&&3===(t=e.style.inset.split(" ")).length&&Object.assign(e.style,{top:t[0],right:t[1],bottom:t[2],left:"unset"})})))}}updateDisplayOverlay(){if(this.player_.videoHeight()&&window.CSS.supports("inset-inline: 10px")){var e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,s=this.player_.videoWidth()/this.player_.videoHeight();let r=0,n=0;.1!e.activeCues))){var t=[];for(let s=0;sthis.handleMouseDown(e)))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){var t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e)Ct(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();else{let i=(e=this.player_.getChild("controlBar"))&&e.getChild("playToggle");i?(e=()=>i.focus(),Et(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}}ms.prototype.controlText_="Play Video",pt.registerComponent("BigPlayButton",ms),pt.registerComponent("CloseButton",class extends ps{constructor(e,t){super(e,t),this.setIcon("cancel"),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){"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}});class gs extends ps{constructor(e,t={}){super(e,t),t.replay=void 0===t.replay||t.replay,this.setIcon("play"),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()?Ct(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.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",(e=>this.handleSeeked(e)))}}gs.prototype.controlText_="Play",pt.registerComponent("PlayToggle",gs);class fs extends pt{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],(e=>this.update(e))),this.updateTextNode_()}createEl(){var e=this.buildCSSClass(),t=super.createEl("div",{className:e+" vjs-time-control vjs-control"}),i=Q("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(i),this.contentEl_=Q("span",{className:e+"-display"},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&"seeking"===e.type||this.updateContent(e)}updateTextNode_(e=0){e=Tt(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,h.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){}}fs.prototype.labelText_="Time",fs.prototype.controlText_="Time",pt.registerComponent("TimeDisplay",fs);class ys extends fs{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)}}ys.prototype.labelText_="Current Time",ys.prototype.controlText_="Current Time",pt.registerComponent("CurrentTimeDisplay",ys);class _s extends fs{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)}}_s.prototype.labelText_="Duration",_s.prototype.controlText_="Duration",pt.registerComponent("DurationDisplay",_s),pt.registerComponent("TimeDivider",class extends pt{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 vs extends fs{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(Q("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)}}}vs.prototype.labelText_="Remaining Time",vs.prototype.controlText_="Remaining Time",pt.registerComponent("RemainingTimeDisplay",vs),pt.registerComponent("LiveDisplay",class extends pt{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_=Q("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(Q("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 bs extends ps{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.setIcon("circle",e),this.textEl_=Q("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 Ts(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}bs.prototype.controlText_="Seek to live, currently playing live",pt.registerComponent("SeekToLive",bs),fi=Object.freeze({__proto__:null,clamp:Ts});class Ss extends pt{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(),de(),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;he(),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){let 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(Ts(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){return e=pe(this.el_,e),this.vertical()?e.y:e.x}handleKeyDown(e){var t=(i=this.options_.playerOptions.spatialNavigation)&&i.enabled,i=i&&i.horizontalSeek;t?i&&"ArrowLeft"===e.key||!i&&"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepBack()):i&&"ArrowRight"===e.key||!i&&"ArrowUp"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e):"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepBack()):"ArrowUp"===e.key||"ArrowRight"===e.key?(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")}}pt.registerComponent("Slider",Ss);let ws=(e,t)=>Ts(e/t*100,0,100).toFixed(2)+"%";pt.registerComponent("LoadProgressBar",class extends pt{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=Q("span",{className:"vjs-control-text"}),i=Q("span",{textContent:this.localize("Loaded")}),s=document.createTextNode(": ");return this.percentageEl_=Q("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(s),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()),s=this.partEls_;e=ws(i,e),this.percent_!==e&&(this.el_.style.width=e,J(this.percentageEl_,e),this.percent_=e);for(let e=0;et.length;e--)this.el_.removeChild(s[e-1]);s.length=t.length}))}}),pt.registerComponent("TimeTooltip",class extends pt{constructor(e,t){super(e,t),this.update=We($e(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){var s=ce(this.el_),r=ue(this.player_.el());if(t=e.width*t,r&&s){let n=e.left-r.left+t,a=e.width-t+(r.right-e.right),o=(a||(a=e.width-t,n=t),s.width/2);ns.width&&(o=s.width),o=Math.round(o),this.el_.style.right=`-${o}px`,this.write(i)}}write(e){J(this.el_,e)}updateTime(e,t,i,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",(()=>{let r;var n,a,o=this.player_.duration();r=this.player_.liveTracker&&this.player_.liveTracker.isLive()?((a=(n=this.player_.liveTracker.liveWindow())-t*n)<1?"":"-")+Tt(a,n):Tt(i,o),this.update(e,t,r),s&&s()}))}});class Es extends pt{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=We($e(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){var i,s=this.getChild("timeTooltip");s&&(i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),s.updateTime(e,t,i))}}Es.prototype.options_={children:[]},V||E||Es.prototype.options_.children.push("timeTooltip"),pt.registerComponent("PlayProgressBar",Es);class Cs extends pt{constructor(e,t){super(e,t),this.update=We($e(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"}))}}Cs.prototype.options_={children:["timeTooltip"]},pt.registerComponent("MouseTimeDisplay",Cs);class ks extends Ss{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=$e(this,this.update),this.update=We(this.update_,30),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],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){let e=super.update();return this.requestNamedAnimationFrame("SeekBar#update",(()=>{var t=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),i=this.player_.liveTracker;let s=this.player_.duration();i&&i.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==e&&(this.el_.setAttribute("aria-valuenow",(100*e).toFixed(2)),this.percent_=e),this.currentTime_===t&&this.duration_===s||(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Tt(t,s),Tt(s,s)],"{1} of {2}")),this.currentTime_=t,this.duration_=s),this.bar&&this.bar.update(ue(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){ve(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(ve(e)&&!isNaN(this.player_.duration())){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(),s=e.liveCurrentTime();if((r=(r=(r=i+t*e.liveWindow())>=s?s:r)<=i?i+.1:r)===1/0)return}else(r=t*this.player_.duration())===this.player_.duration()&&(r-=.1);this.userSeek_(r),this.player_.options_.enableSmoothSeeking&&this.update()}}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?Ct(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;" "===e.key||"Enter"===e.key?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):"Home"===e.key?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):"End"===e.key?(e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(e.key)?(e.preventDefault(),e.stopPropagation(),t=.1*parseInt(e.key,10),i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):"PageDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):"PageUp"===e.key?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],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()}}ks.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},V||E||ks.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),pt.registerComponent("SeekBar",ks);class Is extends pt{constructor(e,t){super(e,t),this.handleMouseMove=We($e(this,this.handleMouseMove),30),this.throttledHandleMouseSeek=We($e(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,s,r,n=this.getChild("seekBar");n&&(t=n.getChild("playProgressBar"),i=n.getChild("mouseTimeDisplay"),t||i)&&(s=ce(r=n.el()),r=Ts(r=pe(r,e).x,0,1),i&&i.update(s,r),t)&&t.update(s,n.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)&&Ct(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()}}Is.prototype.options_={children:["seekBar"]},pt.registerComponent("ProgressControl",Is);class xs extends ps{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],(e=>this.handlePictureInPictureChange(e))),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],(e=>this.handlePictureInPictureEnabledChange(e))),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(()=>this.handlePictureInPictureAudioModeChange())),this.disable()}buildCSSClass(){return"vjs-picture-in-picture-control vjs-hidden "+super.buildCSSClass()}handlePictureInPictureAudioModeChange(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}handlePictureInPictureEnabledChange(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in window?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){"function"==typeof document.exitPictureInPicture&&super.show()}}xs.prototype.controlText_="Picture-in-Picture",pt.registerComponent("PictureInPictureToggle",xs);class As extends ps{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),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.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}As.prototype.controlText_="Fullscreen",pt.registerComponent("FullscreenToggle",As),pt.registerComponent("VolumeLevel",class extends pt{createEl(){var e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}),pt.registerComponent("VolumeLevelTooltip",class extends pt{constructor(e,t){super(e,t),this.update=We($e(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,s){if(!i){i=ue(this.el_);var r=ue(this.player_.el());if(t=e.width*t,!r||!i)return;var n=e.left-r.left+t;t=e.width-t+(r.right-e.right);let s=i.width/2;ni.width&&(s=i.width),this.el_.style.right=`-${s}px`}this.write(s+"%")}write(e){J(this.el_,e)}updateVolume(e,t,i,s,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(()=>{this.update(e,t,i,s.toFixed(0)),r&&r()}))}});class Ds extends pt{constructor(e,t){super(e,t),this.update=We($e(this,this.update),30)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){var s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,(()=>{i?this.el_.style.bottom=e.height*t+"px":this.el_.style.left=e.width*t+"px"}))}}Ds.prototype.options_={children:["volumeLevelTooltip"]},pt.registerComponent("MouseVolumeLevelDisplay",Ds);class Ps extends Ss{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){ve(e)&&super.handleMouseDown(e)}handleMouseMove(e){var t,i,s,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=ue(s=this.el()),i=this.vertical(),s=pe(s,e),s=Ts(s=i?s.y:s.x,0,1),r.update(t,s,i)),ve(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_(){let e=this.player_.volume();this.one("sliderinactive",(()=>{0===this.player_.volume()&&this.player_.lastVolume_(e)}))}}Ps.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},V||E||Ps.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),Ps.prototype.playerEvent="volumechange",pt.registerComponent("VolumeBar",Ps);class Ls extends pt{constructor(e,t={}){var i,s;t.vertical=t.vertical||!1,void 0!==t.volumeBar&&!f(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",(function(){s.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})),this.throttledHandleMouseMove=We($e(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)}}Ls.prototype.options_={children:["volumeBar"]},pt.registerComponent("VolumeControl",Ls);class Os extends ps{constructor(e,t){var i,s;super(e,t),i=this,(s=e).tech_&&!s.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(s,"loadstart",(function(){s.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;this.setIcon("volume-high"),V&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),ie(this.el_,[0,1,2,3].reduce(((e,t)=>e+(t?" ":"")+"vjs-vol-"+t),"")),te(this.el_,"vjs-vol-"+t)}updateControlText_(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}Os.prototype.controlText_="Mute",pt.registerComponent("MuteToggle",Os);class Rs extends pt{constructor(e,t={}){void 0!==t.inline?t.inline=t.inline:t.inline=!0,void 0!==t.volumeControl&&!f(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){"Escape"===e.key&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),Fe(document,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),qe(document,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){"Escape"===e.key&&this.handleMouseOut()}}Rs.prototype.options_={children:["muteToggle","volumeControl"]},pt.registerComponent("VolumePanel",Rs);class Ns extends ps{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("forward-"+this.skipTime),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),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){if(!isNaN(this.player_.duration())){var t=this.player_.currentTime(),i=(i=this.player_.liveTracker)&&i.isLive()?i.seekableEnd():this.player_.duration();let e;e=t+this.skipTime<=i?t+this.skipTime:i,this.player_.currentTime(e)}}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}Ns.prototype.controlText_="Skip Forward",pt.registerComponent("SkipForward",Ns);class Ms extends ps{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon("replay-"+this.skipTime),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),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 s;s=(t=(t=this.player_.liveTracker)&&t.isLive()&&t.seekableStart())&&i-this.skipTime<=t?t:i>=this.skipTime?i-this.skipTime:0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Ms.prototype.controlText_="Skip Backward",pt.registerComponent("SkipBackward",Ms);class Us extends pt{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 pt&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof pt&&(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_=Q(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),e=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"})).appendChild(this.contentEl_),Fe(e,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),e}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){let 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){"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(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(),0this.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(),Fe(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 Us(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=Q("li",{className:"vjs-menu-title",textContent:ht(this.options_.title),tabIndex:-1}),e=new pt(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(let e=0;e{this.handleTracksChange.apply(this,e)}),n=(...e)=>{this.handleSelectedLanguageChange.apply(this,e)};if(e.on(["loadstart","texttrackchange"],r),s.addEventListener("change",r),s.addEventListener("selectedlanguagechange",n),this.on("dispose",(function(){e.off(["loadstart","texttrackchange"],r),s.removeEventListener("change",r),s.removeEventListener("selectedlanguagechange",n)})),void 0===s.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),s.dispatchEvent(e)}))}this.handleTracksChange()}handleClick(e){var t=this.track,i=this.player_.textTracks();if(super.handleClick(e),i)for(let e=0;e{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(ht(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 s=0,r=t.length;s{this.handleTracksChange.apply(this,e)});s.addEventListener("change",r),this.on("dispose",(()=>{s.removeEventListener("change",r)}))}createEl(e,t,i){return t=(e=super.createEl(e,t,i)).querySelector(".vjs-menu-item-text"),0<=["main-desc","descriptions"].indexOf(this.options_.track.kind)&&(t.appendChild(Q("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),t.appendChild(Q("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;ethis.update(e)))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}er.prototype.contentElType="button",pt.registerComponent("PlaybackRateMenuItem",er);class tr extends Bs{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_=Q("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 er(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.open(e)}))}buildCSSClass(){return"vjs-error-display "+super.buildCSSClass()}content(){var e=this.player().error();return e?this.localize(e.message):""}}rr.prototype.options_=Object.assign({},At.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),pt.registerComponent("ErrorDisplay",rr);class nr extends pt{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),Q("select",{id:this.options_.id},{},this.options_.SelectOptions.map((e=>{var t=(this.options_.labelId||"vjs-track-option-"+Oe++)+"-"+e[1].replace(/\W+/g,"");return(e=Q("option",{id:t,value:this.localize(e[0]),textContent:e[1]})).setAttribute("aria-labelledby",this.selectLabelledbyIds+" "+t),e})))}}pt.registerComponent("TextTrackSelect",nr);class ar extends pt{constructor(e,t={}){var i;for(i of(super(e,t),t=Q("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId}),this.el().appendChild(t),t=this.options_.selects)){var s=this.options_.selectConfigs[i],r=s.className,n=s.id.replace("%s",this.options_.id_);let t=null;var a="vjs_select_"+Oe++;"colors"===this.options_.type&&(t=Q("span",{className:r}),(r=Q("label",{id:n,className:"vjs-label",textContent:s.label})).setAttribute("for",a),t.appendChild(r)),r=new nr(e,{SelectOptions:s.options,legendId:this.options_.legendId,id:a,labelId:n}),this.addChild(r),"colors"===this.options_.type&&(t.appendChild(r.el()),this.el().appendChild(t))}}createEl(){return Q("fieldset",{className:this.options_.className})}}pt.registerComponent("TextTrackFieldset",ar);class or extends pt{constructor(e,t={}){super(e,t),t=this.options_.textTrackComponentid;var i=new ar(e,{id_:t,legendId:"captions-text-legend-"+t,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(i),i=new ar(e,{id_:t,legendId:"captions-background-"+t,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"}),this.addChild(i),i=new ar(e,{id_:t,legendId:"captions-window-"+t,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"}),this.addChild(i)}createEl(){return Q("div",{className:"vjs-track-settings-colors"})}}pt.registerComponent("TextTrackSettingsColors",or);class lr extends pt{constructor(e,t={}){super(e,t),t=this.options_.textTrackComponentid;var i=new ar(e,{id_:t,legendId:"captions-font-size-"+t,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(i),i=new ar(e,{id_:t,legendId:"captions-edge-style-"+t,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"}),this.addChild(i),i=new ar(e,{id_:t,legendId:"captions-font-family-"+t,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"}),this.addChild(i)}createEl(){return Q("div",{className:"vjs-track-settings-font"})}}pt.registerComponent("TextTrackSettingsFont",lr);class dr extends pt{constructor(e,t={}){var i;super(e,t),t=this.localize("restore all settings to the default values"),((i=new ps(e,{controlText:t,className:"vjs-default-button"})).el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i),i=new ps(e,{controlText:t,className:"vjs-done-button"})).el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Done"),this.addChild(i)}createEl(){return Q("div",{className:"vjs-track-settings-controls"})}}pt.registerComponent("TrackSettingsControls",dr);let hr="vjs-text-track-settings";var ur=["#F00","Red"],cr=["#FFF","White"];let pr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[P=["#000","Black"],cr,ur,zr=["#0F0","Green"],Jt=["#00F","Blue"],On=["#FF0","Yellow"],Rn=["#F0F","Magenta"],ka=["#0FF","Cyan"]],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Ba=["1","Opaque"],Da=["0.5","Semi-Transparent"],Aa=["0","Transparent"]],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[cr,P,ur,zr,Jt,On,Rn,ka],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",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:"",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:[Ba,Da],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[Aa,Da,Ba],className:"vjs-window-opacity vjs-opacity"}};function mr(e,t){if((e=t?t(e):e)&&"none"!==e)return e}pr.windowColor.options=pr.backgroundColor.options,pt.registerComponent("TextTrackSettings",class extends At{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=Q("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.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){var t=new or(e,{textTrackComponentid:this.id_,selectConfigs:pr,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t),t=new lr(e,{textTrackComponentid:this.id_,selectConfigs:pr,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]}),this.addChild(t),t=new dr(e),this.addChild(t)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],(()=>{this.saveSettings(),this.close()})),this.on(this.$(".vjs-default-button"),["click","tap"],(()=>{this.setDefaults(),this.updateDisplay()})),p(pr,(e=>{this.on(this.$(e.selector),"change",this.updateDisplay)}))}dispose(){this.endDialog=null,super.dispose()}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(pr,((e,t,i)=>{s=this.$(t.selector),t=t.parser;var s=mr(s.options[s.options.selectedIndex].value,t);return void 0!==s&&(e[i]=s),e}),{})}setValues(e){p(pr,((t,i)=>{var s=this.$(t.selector),r=e[i],n=t.parser;if(r)for(let e=0;e{var t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t}))}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(hr))}catch(e){h.warn(e)}e&&this.setValues(e)}saveSettings(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(hr,JSON.stringify(e)):window.localStorage.removeItem(hr)}catch(e){h.warn(e)}}}updateDisplay(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}),pt.registerComponent("ResizeManager",class extends pt{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_=Ge((()=>{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){let e=this.debouncedHandler_,t=this.unloadListener_=function(){qe(this,"resize",e),qe(this,"unload",t),t=null};Fe(this.el_.contentWindow,"unload",t),Fe(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()}});let gr={trackingThreshold:20,liveTolerance:15};pt.registerComponent("LiveTracker",class extends pt{constructor(e,t){super(e,y(gr,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_&&2this.updateDom_())),this.updateDom_()}createEl(){return this.els={title:Q("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-"+Oe++}),description:Q("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-"+Oe++})},Q("div",{className:"vjs-title-bar"},{},_(this.els))}updateDom_(){var e=this.player_.tech_;let t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach((e=>{var s=this.state[e],r=this.els[e];e=i[e],ge(r),s&&J(r,s),t&&(t.removeAttribute(e),s)&&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}});let fr={initialDisplay:4e3,position:[],takeFocus:!1};function yr(e){let t=e.el();if(!t.resetSourceWatch_){let i={},s=Tr(e),r=i=>(...s)=>(s=i.apply(t,s),_r(e),s);["append","appendChild","insertAdjacentHTML"].forEach((e=>{t[e]&&(i[e]=t[e],t[e]=r(i[e]))})),Object.defineProperty(t,"innerHTML",y(s,{set:r(s.set)})),t.resetSourceWatch_=()=>{t.resetSourceWatch_=null,Object.keys(i).forEach((e=>{t[e]=i[e]})),Object.defineProperty(t,"innerHTML",s)},e.one("sourceset",t.resetSourceWatch_)}}pt.registerComponent("TransientButton",class extends ps{constructor(e,t){super(e,t=y(fr,t)),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],(e=>{this.removeClass("force-display")}))}buildCSSClass(){return"vjs-transient-button focus-visible "+this.options_.position.map((e=>"vjs-"+e)).join(" ")}createEl(){var e=Q("button",{},{type:"button",class:this.buildCSSClass()},Q("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout((()=>{this.removeClass("force-display")}),this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}});let _r=e=>{var t=e.el();if(t.hasAttribute("src"))e.triggerSourceset(t.src);else{var i=e.$$("source"),s=[];let t="";if(!i.length)return!1;for(let e=0;e{let i={};for(let s=0;sbr([e.el(),window.HTMLMediaElement.prototype,window.Element.prototype,vr],"innerHTML"),Sr=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?jt(window.Element.prototype.getAttribute.call(this,"src")):""},set(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}});class wr extends Wi{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 s=this.el_.childNodes;let e=s.length;for(var r=[];e--;){var n=s[e];"track"===n.nodeName.toLowerCase()&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),this.textTracks().addTrack(n.track),i||this.el_.hasAttribute("crossorigin")||!Ht(n.src)||(i=!0)):r.push(n))}for(let e=0;e(s=i.set.call(t,s),e.triggerSourceset(t.src),s)})),t.setAttribute=(i,r)=>(r=s.call(t,i,r),/src/i.test(i)&&e.triggerSourceset(t.src),r),t.load=()=>{var i=r.call(t);return _r(e)||(e.triggerSourceset(""),yr(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):_r(e)||yr(e),t.resetSourceset_=()=>{t.resetSourceset_=null,t.load=r,t.setAttribute=s,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}}}}(this)}restoreMetadataTracksInIOSNativePlayer_(){let e,t=this.textTracks(),i=()=>{e=[];for(let s=0;st.removeEventListener("change",i))),()=>{for(let t=0;t{t.removeEventListener("change",i),t.removeEventListener("change",s),t.addEventListener("change",s)})),this.on("webkitendfullscreen",(()=>{t.removeEventListener("change",i),t.addEventListener("change",i),t.removeEventListener("change",s)}))}overrideNative_(e,t){if(t===this[`featuresNative${e}Tracks`]){let 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=pi[e];let i=this.el()[t.getterName],s=this[t.getterName]();if(this[`featuresNative${t.capitalName}Tracks`]&&i&&i.addEventListener){let r={change:t=>{var i={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(i),"text"===e&&this[mi.remoteText.getterName]().trigger(i)},addtrack(e){s.addTrack(e.track)},removetrack(e){s.removeTrack(e.track)}},n=function(){var e=[];for(let t=0;t{let t=r[e];i.addEventListener(e,t),this.on("dispose",(s=>i.removeEventListener(e,t)))})),this.on("loadstart",n),this.on("dispose",(e=>this.off("loadstart",n)))}}proxyNativeTracks_(){pi.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),wr.disposeMediaElement(e),e=t):(e=document.createElement("video"),t=y({},this.options_.tag&&ne(this.options_.tag)),q&&!0===this.options_.nativeControlsForTouch||delete t.controls,re(e,Object.assign(t,{id:this.options_.techId,class:"vjs-tech"}))),e.playerId=this.options_.playerId),void 0!==this.options_.preload&&oe(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{0{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)}))}}supportsFullScreen(){return"function"==typeof this.el_.webkitEnterFullScreen}enterFullScreen(){let e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Ct(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(){wr.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)}}v(wr,"TEST_VID",(function(){var e,t;if(G())return e=document.createElement("video"),(t=document.createElement("track")).kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e})),wr.isSupported=function(){try{wr.TEST_VID.volume=.5}catch(e){return!1}return!(!wr.TEST_VID||!wr.TEST_VID.canPlayType)},wr.canPlayType=function(e){return wr.TEST_VID.canPlayType(e)},wr.canPlaySource=function(e,t){return wr.canPlayType(e.type)},wr.canControlVolume=function(){try{let t=wr.TEST_VID.volume;wr.TEST_VID.volume=t/2+.1;var e=t!==wr.TEST_VID.volume;return e&&V?(window.setTimeout((()=>{wr&&wr.prototype&&(wr.prototype.featuresVolumeControl=t!==wr.TEST_VID.volume)})),!1):e}catch(e){return!1}},wr.canMuteVolume=function(){try{var e=wr.TEST_VID.muted;return wr.TEST_VID.muted=!e,wr.TEST_VID.muted?oe(wr.TEST_VID,"muted","muted"):le(wr.TEST_VID,"muted"),e!==wr.TEST_VID.muted}catch(e){return!1}},wr.canControlPlaybackRate=function(){if(E&&x&&D<58)return!1;try{var e=wr.TEST_VID.playbackRate;return wr.TEST_VID.playbackRate=e/2+.1,e!==wr.TEST_VID.playbackRate}catch(e){return!1}},wr.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},wr.supportsNativeTextTracks=function(){return z||V&&x},wr.supportsNativeVideoTracks=function(){return!(!wr.TEST_VID||!wr.TEST_VID.videoTracks)},wr.supportsNativeAudioTracks=function(){return!(!wr.TEST_VID||!wr.TEST_VID.audioTracks)},wr.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]){v(wr.prototype,e,(()=>wr[t]()),!0)})),wr.prototype.featuresVolumeControl=wr.canControlVolume(),wr.prototype.movingMediaElementInDOM=!V,wr.prototype.featuresFullscreenResize=!0,wr.prototype.featuresProgressEvents=!0,wr.prototype.featuresTimeupdateEvents=!0,wr.prototype.featuresVideoFrameCallback=!(!wr.TEST_VID||!wr.TEST_VID.requestVideoFrameCallback),wr.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){}}},wr.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){wr.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){wr.prototype["set"+ht(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){wr.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){wr.prototype["set"+ht(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){wr.prototype[e]=function(){return this.el_[e]()}})),Wi.withSourceHandlers(wr),wr.nativeSourceHandler={},wr.nativeSourceHandler.canPlayType=function(e){try{return wr.TEST_VID.canPlayType(e)}catch(e){return""}},wr.nativeSourceHandler.canHandleSource=function(e,t){return e.type?wr.nativeSourceHandler.canPlayType(e.type):e.src?(e=Vt(e.src),wr.nativeSourceHandler.canPlayType("video/"+e)):""},wr.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},wr.nativeSourceHandler.dispose=function(){},wr.registerSourceHandler(wr.nativeSourceHandler),Wi.registerTech("Html5",wr);let Er=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Cr={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},kr=["tiny","xsmall","small","medium","large","xlarge","huge"],Ir={},xr=(kr.forEach((e=>{var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Ir[e]="vjs-layout-"+t})),{tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0});class Ar extends pt{constructor(t,i,s){if(t.id=t.id||i.id||"vjs_video_"+Oe++,(i=Object.assign(Ar.getTagSettings(t),i)).initChildren=!1,i.createEl=!1,i.evented=!1,i.reportTouchActivity=!1,i.language||(n=t.closest("[lang]"))&&(i.language=n.getAttribute("lang")),super(null,i,s),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.boundUpdatePlayerHeightOnAudioOnlyMode_=e=>this.updatePlayerHeightOnAudioOnlyMode_(e),this.isFullscreen_=!1,this.log=u(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_={controlBarHeight:null,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&&ne(t),this.language(this.options_.language),i.languages){let e={};Object.getOwnPropertyNames(i.languages).forEach((function(t){e[t.toLowerCase()]=i.languages[t]})),this.languages_=e}else this.languages_=Ar.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(),at(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Fe(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);var n=y(this.options_);i.plugins&&Object.keys(i.plugins).forEach((e=>{this[e](i.plugins[e])})),i.debug&&this.debug(!0),this.options_.playerOptions=n,this.middleware_=[],this.playbackRates(i.playbackRates),i.experimentalSvgIcons&&((s=(new window.DOMParser).parseFromString('\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',"image/svg+xml")).querySelector("parsererror")?(h.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null):((n=s.documentElement).style.display="none",this.el_.appendChild(n),this.addClass("vjs-svg-icons-enabled"))),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"),i.spatialNavigation&&i.spatialNavigation.enabled&&(this.spatialNavigation=new as(this),this.addClass("vjs-spatial-navigation-enabled")),q&&this.addClass("vjs-touch-enabled"),V||this.addClass("vjs-workinghover"),Ar.players[this.id_]=this,s=e.split(".")[0],this.addClass("vjs-v"+s),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"),qe(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),qe(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ar.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),Xi.hasOwnProperty(this.id())&&delete Xi[this.id()],gi.names.forEach((e=>{(e=this[gi[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"),s="video-js"===this.tag.tagName.toLowerCase(),r=(i?e=this.el_=t.parentNode:s||(e=this.el_=super.createEl("div")),ne(t));if(s){for(e=this.el_=t,t=this.tag=document.createElement("video");e.children.length;)t.appendChild(e.firstChild);ee(e,"video-js")||te(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&&R&&(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){s&&"class"===i||e.setAttribute(i,r[i]),s&&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");var n,a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter((e=>$[e])).map((e=>"vjs-device-"+e.substring(3).toLowerCase().replace(/\_/g,"-"))),o=(this.addClass(...a),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=De("vjs-styles-dimensions"),a=be(".vjs-styles-defaults"),(n=be("head")).insertBefore(this.styleEl_,a?a.nextSibling:n.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),t.getElementsByTagName("a"));for(let e=0;e{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)},Je(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){let 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,s,r;e=(e=(s=void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0{e=gi[e],n[e.getterName]=this[e.privateName]})),Object.assign(n,this.options_[i]),Object.assign(n,this.options_[s]),Object.assign(n,this.options_[e.toLowerCase()]),this.tag&&(n.tag=this.tag),t&&t.src===this.cache_.src&&0i.addCue(e)))})),t.textTracks()}(this.textTracksJson_||[],this.tech_),Er.forEach((e=>{this.on(this.tech_,e,(t=>this[`handleTech${ht(e)}_`](t)))})),Object.keys(Cr).forEach((e=>{this.on(this.tech_,e,(t=>{0===this.tech_.playbackRate()&&this.tech_.seeking()?this.queuedCallbacks_.push({callback:this[`handleTech${Cr[e]}_`].bind(this),event:t}):this[`handleTech${Cr[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||Z(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){gi.names.forEach((e=>{this[(e=gi[e]).privateName]=this[e.getterName]()})),this.textTracksJson_=function(e){var t=e.$$("track");let i=Array.prototype.map.call(t,(e=>e.track));return Array.prototype.map.call(t,(function(e){var t=kt(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(kt))}(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&&h.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_}version(){return{"video.js":e}}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=()=>{let e=this.muted(),t=(this.muted(!0),()=>{this.muted(e)});this.playTerminatedQueue_.push(t);var i=this.play();if(Et(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():Et(i=this.play())&&(i=i.catch(t)),Et(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 s=e.$$("source");for(let e=0;ee.src&&e.src===t));var s=[],r=this.$$("source"),n=[];for(let e=0;ethis.updateSourceCaches_(e);var t=this.currentSource().src,i=e.src;(s=!t||/^blob:/.test(t)||!/^blob:/.test(i)||this.lastSource_&&(this.lastSource_.tech===i||this.lastSource_.player===t)?s:()=>{})(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_(){0e.callback(e.event))),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");let 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()?Ct(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)),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();e&&this.error(e)}handleTechTextData_(){let e=1{this.play_(e)}))}play_(e=Ct){this.playCallbacks_.push(e),e=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));var t,i=Boolean(z||V);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")||ft(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){if(void 0===e)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_))}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:ft(0,0)}seekable(){let e=this.techGet_("seekable");return e&&e.length?e:ft(0,0)}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return St(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,e)),this.cache_.volume=t,this.techCall_("setVolume",t),0{function r(){t.off("fullscreenerror",a),t.off("fullscreenchange",n)}function n(){r(),i()}function a(e,t){r(),s(t)}t.one("fullscreenchange",n),t.one("fullscreenerror",a);var o=t.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(i,s))}))}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(){let e=this;return new Promise(((t,i)=>{function s(){e.off("fullscreenerror",n),e.off("fullscreenchange",r)}function r(){s(),t()}function n(e,t){s(),i(t)}e.one("fullscreenchange",r),e.one("fullscreenerror",n);var a=e.exitFullscreenHelper_();a&&(a.then(s,s),a.then(t,i))}))}exitFullscreenHelper_(){var e;if(this.fsApi_.requestFullscreen)return(e=document[this.fsApi_.exitFullscreen]())&&Ct(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,Fe(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",te(document.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){"Escape"===e.key&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,qe(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,ie(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){let 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(Q("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),window.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then((t=>(we(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",(t=>{t=t.target.querySelector(".video-js"),e.parentNode.replaceChild(t,e),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,s=this.options_.userActions;s&&s.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 s.hotkeys?s.hotkeys.call(this,e):this.handleHotkeys(e)))}handleHotkeys(e){var{fullscreenKey:t=(t=>"f"===e.key.toLowerCase()),muteKey:i=(t=>"m"===e.key.toLowerCase()),playPauseKey:s=(t=>"k"===e.key.toLowerCase()||" "===e.key.toLowerCase())}=this.options_.userActions?this.options_.userActions.hotkeys:{};t.call(this,e)?(e.preventDefault(),e.stopPropagation(),t=pt.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&t.prototype.handleClick.call(this,e)):i.call(this,e)?(e.preventDefault(),e.stopPropagation(),pt.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),pt.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){var t;for(let s=0,r=this.options_.techOrder;st.some((t=>{if(s=i(e,t))return!0})))),s}var i=this.options_.techOrder.map((e=>[e,Wi.getTech(e)])).filter((([e,t])=>t?t.isSupported():(h.error(`The "${e}" tech is undefined. Skipped browser support check for that tech.`),!1)));let s;var r,n=([e,t],i)=>{if(t.canPlaySource(i,this.options_[e.toLowerCase()]))return{source:i,tech:e}};return(s=this.options_.sourceOrder?t(e,i,(r=n,(e,t)=>r(t,e))):t(i,e,n))||!1}handleSrc_(e,t){if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();let i=ts(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=[],s,r,n=[],a=!1){let[o,...l]=i;if("string"==typeof o)e(t,Gi[o],s,r,n,a);else if(o){let i=function(e,t){var i=Xi[e.id()];let s=null;if(null==i)s=t(e),Xi[e.id()]=[[t,s]];else{for(let e=0;e{var r;if(this.middleware_=s,t||(this.cache_.sources=i),this.updateSourceCaches_(e),this.src_(e))return 1e.setTech&&e.setTech(r)))})),1{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||(ut(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.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}reset(){this.paused()?this.doReset_():Ct(this.play().then((()=>this.doReset_())))}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),Je(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);var{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},i=(i||{}).seekBar;e&&e.updateContent(),t&&t.updateContent(),s&&s.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.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=>{g(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){let 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_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close()):(this.error_=new wt(e),this.addClass("vjs-error"),h.error(`(CODE:${this.error_.code} ${wt.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,s=$e(this,this.reportUserActivity);function r(t){s(),this.clearInterval(e)}this.on("mousedown",(function(){s(),this.clearInterval(e),e=this.setInterval(s,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,s())})),this.on("mouseup",r),this.on("mouseleave",r);var n=this.getChild("controlBar");let a;!n||V||E||(n.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),n.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",s),this.on("keyup",s),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}updatePlayerHeightOnAudioOnlyMode_(){var e=this.getChild("ControlBar");e&&this.audioOnlyCache_.controlBarHeight!==e.currentHeight()&&(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");var e=this.children();let 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.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),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(),Je(this))&&this.trigger("languagechange")}languages(){return y(Ar.prototype.options_.languages,this.languages_)}toJSON(){var e=y(this.options_),t=e.tracks;e.tracks=[];for(let s=0;s{this.removeChild(i)})),i.open(),i}updateCurrentBreakpoint_(){if(this.responsive()){var e=this.currentBreakpoint(),t=this.currentWidth();for(let s=0;sthis.addRemoteTextTrack(e,!1))),this.titleBar&&this.titleBar.update({title:l,description:r||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:ss(t.poster)}]),t)}static getTagSettings(e){var t={sources:[],tracks:[]},i=ne(e),s=i["data-setup"];if(ee(e,"vjs-fill")&&(i.fill=!0),ee(e,"vjs-fluid")&&(i.fluid=!0),null!==s)try{Object.assign(i,JSON.parse(s||"{}"))}catch(e){h.error("data-setup",e)}if(Object.assign(t,i),e.hasChildNodes()){var r=e.childNodes;for(let e=0,i=r.length;e"number"==typeof e))&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}gi.names.forEach((function(e){let t=gi[e];Ar.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),Ar.prototype.crossorigin=Ar.prototype.crossOrigin,Ar.players={},cr=window.navigator,Ar.prototype.options_={techOrder:Wi.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:cr&&(cr.languages&&cr.languages[0]||cr.userLanguage||cr.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,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1},Er.forEach((function(e){Ar.prototype[`handleTech${ht(e)}_`]=function(){return this.trigger(e)}})),pt.registerComponent("Player",Ar);let Dr="plugin",Pr="activePlugins_",Lr={},Or=e=>Lr.hasOwnProperty(e),Rr=e=>Or(e)?Lr[e]:void 0,Nr=(e,t)=>{e[Pr]=e[Pr]||{},e[Pr][t]=!0},Mr=(e,t,i)=>{i=(i?"before":"")+"pluginsetup",e.trigger(i,t),e.trigger(i+":"+t.name,t)},Ur=(e,t)=>(t.prototype.name=e,function(...i){Mr(this,{name:e,plugin:t,instance:null},!0);let s=new t(this,...i);return this[e]=()=>s,Mr(this,s.getEventHash()),s});class Br{constructor(e){if(this.constructor===Br)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),at(this),delete this.trigger,lt(this,this.constructor.defaultState),Nr(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 je(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[Pr][e]=!1,this.player=this.state=null,t[e]=Ur(e,Lr[e])}static isBasic(e){return"function"==typeof(e="string"==typeof e?Rr(e):e)&&!Br.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(Or(e))h.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ar.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 Lr[e]=t,e!==Dr&&(Br.isBasic(t)?Ar.prototype[e]=function(e,t){function i(){Mr(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return Nr(this,e),Mr(this,{name:e,plugin:t,instance:i}),i}return Object.keys(t).forEach((function(e){i[e]=t[e]})),i}(e,t):Ar.prototype[e]=Ur(e,t)),t}static deregisterPlugin(e){if(e===Dr)throw new Error("Cannot de-register base plugin.");Or(e)&&(delete Lr[e],delete Ar.prototype[e])}static getPlugins(e=Object.keys(Lr)){let t;return e.forEach((e=>{var i=Rr(e);i&&((t=t||{})[e]=i)})),t}static getPluginVersion(e){return(e=Rr(e))&&e.VERSION||""}}function Fr(e,t,i,s){{var r=t+` is deprecated and will be removed in ${e}.0; please use ${i} instead.`,n=s;let a=!1;return function(...e){return a||h.warn(r),a=!0,n.apply(this,e)}}}Br.getPlugin=Rr,Br.BASE_PLUGIN_NAME=Dr,Br.registerPlugin(Dr,Br),Ar.prototype.usingPlugin=function(e){return!!this[Pr]&&!0===this[Pr][e]},Ar.prototype.hasPlugin=function(e){return!!Or(e)};let qr=e=>0===e.indexOf("#")?e.slice(1):e;function jr(e,t,s){let r=jr.getPlayer(e);if(r)t&&h.warn(`Player "${e}" is already initialised. Options will not be applied.`),s&&r.ready(s);else{let n="string"==typeof e?be("#"+qr(e)):e;if(!X(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");e="getRootNode"in n&&n.getRootNode()instanceof window.ShadowRoot?n.getRootNode():n.ownerDocument.body,n.ownerDocument.defaultView&&e.contains(n)||h.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player")?n.parentNode:n).cloneNode(!0)),i("beforesetup").forEach((e=>{!g(e=e(n,y(t)))||Array.isArray(e)?h.error("please return an object in beforesetup hooks"):t=y(t,e)})),e=pt.getComponent("Player"),r=new e(n,t,s),i("setup").forEach((e=>e(r)))}return r}jr.hooks_=t,jr.hooks=i,jr.hook=function(e,t){i(e,t)},jr.hookOnce=function(e,t){i(e,[].concat(t).map((t=>{let i=(...r)=>(s(e,i),t(...r));return i})))},jr.removeHook=s,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&G()&&!(P=be(".vjs-styles-defaults"))&&(P=De("vjs-styles-defaults"),(ur=be("head"))&&ur.insertBefore(P,ur.firstChild),Pe(P,"\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 ")),xe(1,jr),jr.VERSION=e,jr.options=Ar.prototype.options_,jr.getPlayers=()=>Ar.players,jr.getPlayer=e=>{var t=Ar.players;let i;if("string"==typeof e){var s,r;if(r=t[s=qr(e)])return r;i=be("#"+s)}else i=e;if(X(i)){var{player:r,playerId:s}=i;if(r||t[s])return r||t[s]}},jr.getAllPlayers=()=>Object.keys(Ar.players).map((e=>Ar.players[e])).filter(Boolean),jr.players=Ar.players,jr.getComponent=pt.getComponent,jr.registerComponent=(e,t)=>(Wi.isTech(t)&&h.warn(`The ${e} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),pt.registerComponent.call(pt,e,t)),jr.getTech=Wi.getTech,jr.registerTech=Wi.registerTech,jr.use=function(e,t){Gi[e]=Gi[e]||[],Gi[e].push(t)},Object.defineProperty(jr,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(jr.middleware,"TERMINATOR",{value:Ki,writeable:!1,enumerable:!0}),jr.browser=$,jr.obj=T,jr.mergeOptions=Fr(9,"videojs.mergeOptions","videojs.obj.merge",y),jr.defineLazyProperty=Fr(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",v),jr.bind=Fr(9,"videojs.bind","native Function.prototype.bind",$e),jr.registerPlugin=Br.registerPlugin,jr.deregisterPlugin=Br.deregisterPlugin,jr.plugin=(e,t)=>(h.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Br.registerPlugin(e,t)),jr.getPlugins=Br.getPlugins,jr.getPlugin=Br.getPlugin,jr.getPluginVersion=Br.getPluginVersion,jr.addLanguage=function(e,t){return e=(""+e).toLowerCase(),jr.options.languages=y(jr.options.languages,{[e]:t}),jr.options.languages[e]},jr.log=h,jr.createLogger=u,jr.time=H,jr.createTimeRange=Fr(9,"videojs.createTimeRange","videojs.time.createTimeRanges",ft),jr.createTimeRanges=Fr(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",ft),jr.formatTime=Fr(9,"videojs.formatTime","videojs.time.formatTime",Tt),jr.setFormatTime=Fr(9,"videojs.setFormatTime","videojs.time.setFormatTime",vt),jr.resetFormatTime=Fr(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",bt),jr.parseUrl=Fr(9,"videojs.parseUrl","videojs.url.parseUrl",qt),jr.isCrossOrigin=Fr(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Ht),jr.EventTarget=Ye,jr.any=Ve,jr.on=Fe,jr.one=He,jr.off=qe,jr.trigger=je,jr.xhr=ei,jr.TextTrack=di,jr.AudioTrack=hi,jr.VideoTrack=ui,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((e=>{jr[e]=function(){return h.warn(`videojs.${e}() is deprecated; use videojs.dom.${e}() instead`),Ee[e].apply(null,arguments)}})),jr.computedStyle=Fr(9,"videojs.computedStyle","videojs.dom.computedStyle",Se),jr.dom=Ee,jr.fn=Ke,jr.num=fi,jr.str=ct,jr.url=zt,jr.Error={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"},Wt((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 s 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[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const s=this.levels_.length;return t=new i(e),""+s in this||Object.defineProperty(this,s,{get(){return this.levels_[s]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,s=this.length;ii&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;tn,e.qualityLevels.VERSION=r,n}(this,t.default.obj.merge({},e))};return t.default.registerPlugin("qualityLevels",n),n.VERSION=r,n}(jr)}));var Hr="https://example.com",Vr=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");var i=/^\/\//.test(e),s=!window.location&&!/\/\//i.test(e);return e=new window.URL(e,window.location||Hr),t=new URL(t,e),s?t.href.slice(Hr.length):i?t.href.slice(t.protocol.length):t.href},zr=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{var t={};return(e=e.split("x"))[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class Qr extends zr{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;te),this.customParsers.push((r=>{if(e.exec(r))return this.trigger("data",{type:"custom",data:i(r),customType:t,segment:s}),!0}))}addTagMapper({expression:e,map:t}){this.tagMappers.push((i=>e.test(i)?t(i):i))}}function Jr(e){let t={};return Object.keys(e).forEach((function(i){t[i.toLowerCase().replace(/-(\w)/g,(e=>e[1].toUpperCase()))]=e[i]})),t}function Zr(e){var t,i,s,r,n,{serverControl:e,targetDuration:a,partTargetDuration:o}=e;e&&(t="#EXT-X-SERVER-CONTROL",i="holdBack",s="partHoldBack",r=a&&3*a,n=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]{n.uri||!n.parts&&!n.preloadHints||(!n.map&&t&&(n.map=t),!n.key&&i&&(n.key=i),n.timeline||"number"!=typeof l||(n.timeline=l),this.manifest.preloadSegment=n)})),this.parseStream.on("data",(function(e){let c,p;if(s.manifest.definitions)for(var m in s.manifest.definitions)if(e.uri&&(e.uri=e.uri.replace(`{$${m}}`,s.manifest.definitions[m])),e.attributes)for(var g in e.attributes)"string"==typeof e.attributes[g]&&(e.attributes[g]=e.attributes[g].replace(`{$${m}}`,s.manifest.definitions[m]));({tag(){({version(){e.version&&(this.manifest.version=e.version)},"allow-cache"(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){var t={};"length"in e&&((n.byterange=t).length=e.length,"offset"in e||(e.offset=d)),"offset"in e&&((n.byterange=t).offset=e.offset),d=t.offset+t.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"})),e.title&&(n.title=e.title),0(t.programDateTime=e-1e3*t.duration,t.programDateTime)),this.lastProgramDateTime)},targetduration(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,Zr.call(this,this.manifest))},start(){!e.attributes||isNaN(e.attributes["TIME-OFFSET"])?this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"}):this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}},"cue-out"(){n.cueOut=e.data},"cue-out-cont"(){n.cueOutCont=e.data},"cue-in"(){n.cueIn=e.data},skip(){this.manifest.skip=Jr(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part(){a=!0;var t=this.manifest.segments.length,i=Jr(e.attributes);n.parts=n.parts||[],n.parts.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=h),h=i.byterange.offset+i.byterange.length),i=n.parts.length-1,this.warnOnMissingAttributes_(`#EXT-X-PART #${i} for segment #`+t,e.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 t=this.manifest.serverControl=Jr(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Zr.call(this,this.manifest),t.canSkipDateranges&&!t.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 t=this.manifest.segments.length,i=Jr(e.attributes),s=i.type&&"PART"===i.type,r=(n.preloadHints=n.preloadHints||[],n.preloadHints.push(i),!i.byterange||i.byterange.hasOwnProperty("offset")||(i.byterange.offset=s?h:0,s&&(h=i.byterange.offset+i.byterange.length)),n.preloadHints.length-1);if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${r} for segment #`+t,e.attributes,["TYPE","URI"]),i.type)for(let e=0;ee.id===i.id)),this.manifest.dateRanges[t]=Kt(this.manifest.dateRanges[t],i),u[i.id]=Kt(u[i.id],i),this.manifest.dateRanges.pop()}else u[i.id]=i},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=Jr(e.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",e.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};var t,i=(e,t)=>{e in this.manifest.definitions?this.trigger("error",{message:"EXT-X-DEFINE: Duplicate name "+e}):this.manifest.definitions[e]=t};return"QUERYPARAM"in e.attributes?"NAME"in e.attributes||"IMPORT"in e.attributes?void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"}):(t=this.params.get(e.attributes.QUERYPARAM))?void i(e.attributes.QUERYPARAM,decodeURIComponent(t)):void this.trigger("error",{message:"EXT-X-DEFINE: No query param "+e.attributes.QUERYPARAM}):"NAME"in e.attributes?"IMPORT"in e.attributes?void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"}):"VALUE"in e.attributes&&"string"==typeof e.attributes.VALUE?void i(e.attributes.NAME,e.attributes.VALUE):void this.trigger("error",{message:"EXT-X-DEFINE: No value for "+e.attributes.NAME}):"IMPORT"in e.attributes?this.mainDefinitions[e.attributes.IMPORT]?void i(e.attributes.IMPORT,this.mainDefinitions[e.attributes.IMPORT]):void this.trigger("error",{message:`EXT-X-DEFINE: No value ${e.attributes.IMPORT} to import, or IMPORT used on main playlist`}):void this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:e.attributes,uri:e.uri,timeline:l}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",e.attributes,["BANDWIDTH","URI"])}}[e.tagType]||function(){}).call(s)},uri(){n.uri=e.uri,r.push(n),!this.manifest.targetDuration||"duration"in n||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),n.duration=this.manifest.targetDuration),i&&(n.key=i),n.timeline=l,t&&(n.map=t),h=0,null!==this.lastProgramDateTime&&(n.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*n.duration),n={}},comment(){},custom(){e.segment?(n.custom=n.custom||{},n.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(s)}))}requiredCompatibilityversion(e,t){(e=t.length&&i.call(t,(function(t,i){return t===(n[i]?n[i]&e[r+i]:e[r+i])}))};function Sn(e,t){return(t=void 0===t?Object:t)&&"function"==typeof t.freeze?t.freeze(e):e}var wn=Sn({HTML:"text/html",isHTML:function(e){return e===wn.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),En=Sn({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===En.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),Cn={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 s=0;s"==e&&">")||("&"==e?"&":'"'==e&&""")||"&#"+e.charCodeAt()+";"}function Kn(e,t){if(t(e))return 1;if(e=e.firstChild)do{if(Kn(e,t))return 1}while(e=e.nextSibling)}function Yn(){this.ownerDocument=this}function Qn(e,t,i){e&&e._inc++,i.namespaceURI===In.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function Jn(e,t,i){if(e&&e._inc){e._inc++;var s=t.childNodes;if(i)s[s.length++]=i;else{for(var r=t.firstChild,n=0;r;)r=(s[n++]=r).nextSibling;s.length=n,delete s[s.length]}}}function Zn(e,t){var i=t.previousSibling,s=t.nextSibling;return i?i.nextSibling=s:e.firstChild=s,s?s.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,Jn(e.ownerDocument,e),t}function ea(e){return e&&e.nodeType===Gn.DOCUMENT_TYPE_NODE}function ta(e){return e&&e.nodeType===Gn.ELEMENT_NODE}function ia(e){return e&&e.nodeType===Gn.TEXT_NODE}function sa(e,t){var i;if(e=e.childNodes||[],!kn(e,ta)&&!ea(t))return i=kn(e,ea),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function ra(e,t){var i;if(e=e.childNodes||[],!kn(e,(function(e){return ta(e)&&e!==t})))return i=kn(e,ea),!(t&&i&&e.indexOf(i)>e.indexOf(t))}function na(e,t,i){var s=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===Gn.DOCUMENT_FRAGMENT_NODE){var n=r.filter(ta);if(1"),i&&/^script$/i.test(u))for(;h;)h.data?t.push(h.data):Ea(h,t,i,s,r.slice()),h=h.nextSibling;else for(;h;)Ea(h,t,i,s,r.slice()),h=h.nextSibling;t.push("")}else t.push("/>");return;case 9:case 11:for(h=e.firstChild;h;)Ea(h,t,i,s,r.slice()),h=h.nextSibling;return;case 2:return wa(t,e.name,e.value);case 3:return t.push(e.data.replace(/[<&>]/g,Xn));case 4:return t.push("");case 8:return t.push("\x3c!--",e.data,"--\x3e");case 10:var _=e.publicId,v=e.systemId;return t.push("")):v&&"."!=v?t.push(" SYSTEM ",v,">"):((_=e.internalSubset)&&t.push(" [",_,"]"),t.push(">")));case 7:return t.push("");case 5:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Ca(e,t,i){e[t]=i}Rn.NOT_SUPPORTED_ERR=(Nn[9]="Not supported",9),Rn.INUSE_ATTRIBUTE_ERR=(Nn[10]="Attribute in use",10),Rn.INVALID_STATE_ERR=(Nn[11]="Invalid state",11),Rn.SYNTAX_ERR=(Nn[12]="Syntax error",12),Rn.INVALID_MODIFICATION_ERR=(Nn[13]="Invalid modification",13),Rn.NAMESPACE_ERR=(Nn[14]="Invalid namespace",14),Rn.INVALID_ACCESS_ERR=(Nn[15]="Invalid access",15),Bn.prototype=Error.prototype,Pn(Rn,Bn),Fn.prototype={length:0,item:function(e){return 0<=e&&e",lt:"<",quot:'"'}),t.HTML_ENTITIES=i({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES})),xa=(Ia.XML_ENTITIES,Cn.NAMESPACE),Aa=/[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]/,Da=new RegExp("[\\-\\.0-9"+Aa.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Pa=new RegExp("^"+Aa.source+Da.source+"*(?::"+Aa.source+Da.source+"*)?$");function La(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,La)}function Oa(){}function Ra(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Na(e,t,i){for(var s=e.tagName,r=null,n=e.length;n--;){var a=e[n],o=a.qName,l=a.value;o=0<(h=o.indexOf(":"))?(d=a.prefix=o.slice(0,h),u=o.slice(h+1),"xmlns"===d&&u):(d=null,"xmlns"===(u=o)&&""),a.localName=u,!1!==o&&(null==r&&(r={},Ma(i,i={})),i[o]=r[o]=l,a.uri=xa.XMLNS,t.startPrefixMapping(o,l))}var d;for(n=e.length;n--;)(d=(a=e[n]).prefix)&&("xml"===d&&(a.uri=xa.XML),"xmlns"!==d)&&(a.uri=i[d||""]);var h,u=0<(h=s.indexOf(":"))?(d=e.prefix=s.slice(0,h),e.localName=s.slice(h+1)):(d=null,e.localName=s),c=e.uri=i[d||""];if(t.startElement(c,u,s,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,1;if(t.endElement(c,u,s),r)for(d in r)Object.prototype.hasOwnProperty.call(r,d)&&t.endPrefixMapping(d)}function Ma(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function Ua(){this.attributeNames={}}(La.prototype=new Error).name=La.name,Oa.prototype={parse:function(e,t,i){var s=this.domBuilder;s.startDocument(),Ma(t,t={}),function(e,t,i,s,r){function n(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",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",t);return s&&(e=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/))?(e[0].length,i.processingInstruction(e[1],e[2]),s+2):-1}(e,y,s);break;case"!":u&&o(y),_=function(e,t,i,s){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?t<(n=e.indexOf("--\x3e",t+4))?(i.comment(e,t+4,n-t-4),n+3):(s.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6))return n=e.indexOf("]]>",t+9),i.startCDATA(),i.characters(e,t+9,n-t-9),i.endCDATA(),n+3;var r,n=(s=function(e,t){var i,s=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=t,r.exec(e);i=r.exec(e);)if(s.push(i),i[1])return s}(e,t)).length;return 1":switch(d){case 0:i.setTagName(e.slice(t,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(u=e.slice(t,l)).slice(-1)&&(i.closed=!0,u=u.slice(0,-1));case 2:2===d&&(u=o),4==d?(n.warning('attribute "'+u+'" missed quot(")!'),a(o,u,t)):(xa.isHTML(s[""])&&u.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,t));break;case 3:throw new Error("attribute value missed!!")}return l;case"€":h=" ";default:if(h<=" ")switch(d){case 0:i.setTagName(e.slice(t,l)),d=6;break;case 1:o=e.slice(t,l),d=2;break;case 4:var u=e.slice(t,l);n.warning('attribute "'+u+'" missed quot(")!!'),a(o,u,t);case 5:d=6}else switch(d){case 2:i.tagName,xa.isHTML(s[""])&&o.match(/^(?:disabled|checked|selected)$/i)||n.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,t),t=l,d=1;break;case 5:n.warning('attribute space is required"'+o+'"!!');case 6:d=1,t=l;break;case 3:d=4,t=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}(e,y,E,C,n,r),E.length);if(!E.closed&&function(e,t,i,s){var r=s[i];return null==r&&((r=e.lastIndexOf(""))",t);if(e=e.substring(t+1,n),/[&<]/.test(e))return/^script$/i.test(i)||(e=e.replace(/&#?\w+;/g,s)),r.characters(e,0,e.length),n}return t+1}(e,_,E.tagName,n,s):_++}}catch(t){if(t instanceof La)throw t;r.error("element parse error: "+t),_=-1}m<_?m=_:a(Math.max(y,m)+1)}}(e,t,i,s,this.errorHandler),s.endDocument()}},Ua.prototype={setTagName:function(e){if(!Pa.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!Pa.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 Ba={XMLReader:Oa,ParseError:La},Fa=ka.DOMImplementation,qa=Cn.NAMESPACE,ja=Ba.ParseError,Ha=Ba.XMLReader;function Va(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function za(e){this.options=e||{locator:{}}}function $a(){this.cdata=!1}function Wa(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Ga(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 Xa(e,t){(e.currentElement||e.doc).appendChild(t)}za.prototype.parseFromString=function(e,t){var i=this.options,s=new Ha,r=i.domBuilder||new $a,n=i.errorHandler,a=i.locator,o=i.xmlns||{},l=(t=/\/x?html?$/.test(t))?Ia.HTML_ENTITIES:Ia.XML_ENTITIES;return a&&r.setDocumentLocator(a),s.errorHandler=function(e,t,i){if(!e){if(t instanceof $a)return t;e=t}var s={},r=e instanceof Function;function n(t){var n=e[t];!n&&r&&(n=2==e.length?function(i){e(t,i)}:e),s[t]=n?function(e){n("[xmldom "+t+"]\t"+e+function(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(i))}:function(){}}return i=i||{},n("warning"),n("error"),n("fatalError"),s}(n,r,a),s.domBuilder=i.domBuilder||r,t&&(o[""]=qa.HTML),o.xml=o.xml||qa.XML,n=i.normalizeLineEndings||Va,e&&"string"==typeof e?s.parse(n(e),o,l):s.errorHandler.error("invalid doc source"),r.doc},$a.prototype={startDocument:function(){this.doc=(new Fa).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,s){var r=this.doc,n=r.createElementNS(e,i||t),a=s.length;Xa(this,n),this.currentElement=n,this.locator&&Wa(this.locator,n);for(var o=0;o!!e&&"object"==typeof e,Qa=(...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]):Ya(e[i])&&Ya(t[i])?e[i]=Qa(e[i],t[i]):e[i]=t[i]})),e)),{}),Ja=e=>Object.keys(e).map((t=>e[t])),Za=e=>e.reduce(((e,t)=>e.concat(t)),[]),eo=e=>{if(!e.length)return[];var t=[];for(let i=0;i{if(e={uri:t,resolvedUri:Vr(e||"",t)},i||s){t=(i||s).split("-");let r,n=window.BigInt?window.BigInt(t[0]):parseInt(t[0],10),a=window.BigInt?window.BigInt(t[1]):parseInt(t[1],10);n(e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e),so={static(e){var{duration:t,timescale:i=1,sourceDuration:s,periodDuration:r}=e,t=t/i;return"number"==typeof(e=io(e.endNumber))?{start:0,end:e}:"number"==typeof r?{start:0,end:r/t}:{start:0,end:s/t}},dynamic(e){var{NOW:t,clientOffset:i,availabilityStartTime:s,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=e,t=(e=io(e.endNumber),(t+i)/1e3),i=s+a,s=Math.ceil((t+o-i)*r/n),a=Math.floor((t-i-l)*r/n),o=Math.floor((t-i)*r/n);return{start:Math.max(0,a),end:"number"==typeof e?e:Math.min(s,o)}}},ro=e=>{var{type:t,duration:i,timescale:s=1,periodDuration:r,sourceDuration:n}=e,{start:a,end:o}=so[t](e),a=((e,t)=>{var i=[];for(let s=e;st=>{var{duration:i,timescale:s=1,periodStart:r,startNumber:n=1}=e;return{number:n+t,duration:i/s,timeline:r,time:t*i}})(e));return"static"===t&&(a[o=a.length-1].duration=("number"==typeof r?r:n)-i/s*o),a},no=e=>{var{baseUrl:t,initialization:i={},sourceDuration:s,indexRange:r="",periodStart:n,presentationTime:a,number:o=0,duration:l}=e;if(t)return i=to({baseUrl:t,source:i.sourceURL,range:i.range}),(t=to({baseUrl:t,source:t,indexRange:r})).map=i,l?(r=ro(e)).length&&(t.duration=r[0].duration,t.timeline=r[0].timeline):s&&(t.duration=s,t.timeline=n),t.presentationTime=a||n,t.number=o,[t];throw new Error("NO_BASE_URL")},ao=(e,t,i)=>{var s=e.sidx.map||null,r=e.sidx.duration,n=e.timeline||0,a=(a=e.sidx.byterange).offset+a.length,o=t.timescale,l=t.references.filter((e=>1!==e.referenceType)),d=[],h=e.endList?"static":"dynamic",u=e.sidx.timeline;let c,p=u,m=e.mediaSequence||0;c="bigint"==typeof t.firstOffset?window.BigInt(a)+t.firstOffset:a+t.firstOffset;for(let e=0;e((e,t)=>Ja(e.reduce(((e,t)=>(t.forEach((t=>{e[(({timeline:e})=>e)(t)]=t})),e)),{})))(e).sort(((e,t)=>e.timeline>t.timeline?1:-1)),ho=e=>{let t=[];return function(e,t,i){t.forEach((function(t){for(var s in e.mediaGroups[t])for(var r in e.mediaGroups[t][s]){var n=e.mediaGroups[t][s][r];i(n)}}))}(e,oo,((e,i,s,r)=>{t=t.concat(e.playlists||[])})),t},uo=({playlist:e,mediaSequence:t})=>{e.mediaSequence=t,e.segments.forEach(((t,i)=>{t.number=e.mediaSequence+i}))},co=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),po=e=>{e=e.reduce((function(e,t){return e[t.attributes.baseUrl]||(e[t.attributes.baseUrl]=[]),e[t.attributes.baseUrl].push(t),e}),{});let t=[];return Object.values(e).forEach((e=>{e=Ja(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}),{})),t=t.concat(e)})),t.map((e=>(e.discontinuityStarts=((e,t)=>e.reduce(((e,t,i)=>(t.discontinuity&&e.push(i),e)),[]))(e.segments||[]),e)))},mo=(e,t)=>{var i=co(e.sidx);return(t=i&&t[i]&&t[i].sidx)&&ao(e,t,e.sidx.resolvedUri),e},go=(e,t={})=>{if(Object.keys(t).length)for(var i in e)e[i]=mo(e[i],t);return e},fo=({attributes:e,segments:t,sidx:i,discontinuityStarts:s})=>(s={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:e.baseUrl||"",targetDuration:e.duration,discontinuityStarts:s,timelineStarts:e.timelineStarts,segments:t},e.frameRate&&(s.attributes["FRAME-RATE"]=e.frameRate),e.contentProtection&&(s.contentProtection=e.contentProtection),e.serviceLocation&&(s.attributes.serviceLocation=e.serviceLocation),i&&(s.sidx=i),s),yo=({attributes:e})=>"video/mp4"===e.mimeType||"video/webm"===e.mimeType||"video"===e.contentType,_o=({attributes:e})=>"audio/mp4"===e.mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType,vo=({attributes:e})=>"text/vtt"===e.mimeType||"text"===e.contentType,bo=e=>e?Object.keys(e).reduce(((t,i)=>(i=e[i],t.concat(i.playlists))),[]):[],To=({dashPlaylists:e,locations:t,contentSteering:i,sidxMapping:s={},previousManifest:r,eventStream:n})=>{var a,o,l,d,h,u,c;return e.length?(({sourceDuration:d,type:u,suggestedPresentationDelay:c,minimumUpdatePeriod:h}=e[0].attributes),a=po(e.filter(yo)).map(fo),o=po(e.filter(_o)),l=po(e.filter(vo)),e=e.map((e=>e.attributes.captionServices)).filter(Boolean),d={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:d,playlists:go(a,s)},0<=h&&(d.minimumUpdatePeriod=1e3*h),t&&(d.locations=t),i&&(d.contentSteering=i),"dynamic"===u&&(d.suggestedPresentationDelay=c),n&&0{let s;return e=e.reduce(((e,r)=>{var n=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+(n?` (${n})`:""):o]||(e[o]={language:a,autoselect:!0,default:"main"===n,playlists:[],uri:""}),a=mo((({attributes:e,segments:t,sidx:i,mediaSequence:s,discontinuitySequence:r,discontinuityStarts:n},a)=>(r={attributes:{NAME:e.id,BANDWIDTH:e.bandwidth,CODECS:e.codecs,"PROGRAM-ID":1},uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,discontinuitySequence:r,discontinuityStarts:n,timelineStarts:e.timelineStarts,mediaSequence:s,segments:t},e.contentProtection&&(r.contentProtection=e.contentProtection),e.serviceLocation&&(r.attributes.serviceLocation=e.serviceLocation),i&&(r.sidx=i),a&&(r.attributes.AUDIO="audio",r.attributes.SUBTITLES="subs"),r))(r,i),t),e[o].playlists.push(a),void 0===s&&"main"===n&&((s=r).default=!0),e}),{}),s||(e[Object.keys(e)[0]].default=!0),e})(o,s,h):null,i=l.length?((e,t={})=>e.reduce(((e,i)=>{var s=i.attributes.label||i.attributes.lang||"text";return e[s]||(e[s]={language:s,default:!1,autoselect:!1,playlists:[],uri:""}),e[s].playlists.push(mo((({attributes:e,segments:t,mediaSequence:i,discontinuityStarts:s,discontinuitySequence:r})=>{void 0===t&&(t=[{uri:e.baseUrl,timeline:e.periodStart,resolvedUri:e.baseUrl||"",duration:e.sourceDuration,number:0}],e.duration=e.sourceDuration);var n={NAME:e.id,BANDWIDTH:e.bandwidth,"PROGRAM-ID":1};return e.codecs&&(n.CODECS=e.codecs),n={attributes:n,uri:"",endList:"static"===e.type,timeline:e.periodStart,resolvedUri:e.baseUrl||"",targetDuration:e.duration,timelineStarts:e.timelineStarts,discontinuityStarts:s,discontinuitySequence:r,mediaSequence:i,segments:t},e.serviceLocation&&(n.attributes.serviceLocation=e.serviceLocation),n})(i),t)),e}),{}))(l,s):null,c=(u=a.concat(bo(t),bo(i))).map((({timelineStarts:e})=>e)),d.timelineStarts=lo(c),((e,t)=>{e.forEach((e=>{e.mediaSequence=0,e.discontinuitySequence=t.findIndex((function({timeline:t}){return t===e.timeline})),e.segments&&e.segments.forEach(((e,t)=>{e.number=t}))}))})(u,d.timelineStarts),t&&(d.mediaGroups.AUDIO.audio=t),i&&(d.mediaGroups.SUBTITLES.subs=i),e.length&&(d.mediaGroups["CLOSED-CAPTIONS"].cc=(e=>e.reduce(((e,t)=>(t&&t.forEach((t=>{var{channel:i,language:s}=t;e[s]={autoselect:!1,default:!1,instreamId:i,language:s},t.hasOwnProperty("aspectRatio")&&(e[s].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[s].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[s]["3D"]=t["3D"])})),e)),{}))(e)),r?(({oldManifest:e,newManifest:t})=>{var i=e.playlists.concat(ho(e)),s=t.playlists.concat(ho(t));return t.timelineStarts=lo([e.timelineStarts,t.timelineStarts]),(({oldPlaylists:e,newPlaylists:t,timelineStarts:i})=>{t.forEach((t=>{t.discontinuitySequence=i.findIndex((function({timeline:e}){return e===t.timeline}));var s=((e,t)=>{for(let i=0;is.timeline||s.segments.length&&t.timeline>s.segments[s.segments.length-1].timeline)&&t.discontinuitySequence--):(s.segments[r].discontinuity&&!e.discontinuity&&(e.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),uo({playlist:t,mediaSequence:s.segments[r].number}))}}))})({oldPlaylists:i,newPlaylists:s,timelineStarts:t.timelineStarts}),t})({oldManifest:r,newManifest:d}):d):{}},So=(e,t,i)=>{var{NOW:e,clientOffset:s,availabilityStartTime:r,timescale:n=1,periodStart:a=0,minimumUpdatePeriod:o=0}=e;return Math.ceil((((e+s)/1e3+o-(r+a))*n-t)/i)},wo=(e,t)=>{var{type:i,minimumUpdatePeriod:s=0,media:r="",sourceDuration:n,timescale:a=1,startNumber:o=1,periodStart:l}=e,d=[];let h=-1;for(let g=0;gh&&(h=p),f=c<0?(p=g+1)===t.length?"dynamic"===i&&0e.replace(Eo,(e=>(t,i,s,r)=>"$$"===t?"$":void 0===e[i]?t:(t=""+e[i],"RepresentationID"===i||(r=s?parseInt(r,10):1)<=t.length?t:new Array(r-t.length+1).join("0")+t))(t)),ko=(e,t)=>{let i={RepresentationID:e.id,Bandwidth:e.bandwidth||0};var{initialization:s={sourceURL:"",range:""}}=e;let r=to({baseUrl:e.baseUrl,source:Co(s.sourceURL,i),range:s.range});return((e,t)=>e.duration||t?e.duration?ro(e):wo(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}])(e,t).map((t=>{i.Number=t.number,i.Time=t.time;var s=Co(e.media||"",i),n=e.timescale||1;return n=e.periodStart+(t.time-(e.presentationTimeOffset||0))/n,{uri:s,timeline:t.timeline,duration:t.duration,resolvedUri:Vr(e.baseUrl||"",s),map:r,number:t.number,presentationTime:n}}))},Io=(e,t)=>{let{duration:i,segmentUrls:s=[],periodStart:r}=e;if(!i&&!t||i&&t)throw new Error("SEGMENT_TIME_UNSPECIFIED");let n,a=s.map((t=>((e,t)=>{var{baseUrl:e,initialization:i={}}=e,i=to({baseUrl:e,source:i.sourceURL,range:i.range});return(e=to({baseUrl:e,source:t.media,range:t.mediaRange})).map=i,e})(e,t)));return i&&(n=ro(e)),(n=t?wo(e,t):n).map(((t,i)=>{var s,n;if(a[i])return i=a[i],s=e.timescale||1,n=e.presentationTimeOffset||0,i.timeline=t.timeline,i.duration=t.duration,i.number=t.number,i.presentationTime=r+(t.time-n)/s,i})).filter((e=>e))},xo=({attributes:e,segmentInfo:t})=>{let i,s;var r,n,a;return t.template?(s=ko,i=Qa(e,t.template)):t.base?(s=no,i=Qa(e,t.base)):t.list&&(s=Io,i=Qa(e,t.list)),e={attributes:e},s&&(r=s(i,t.segmentTimeline),i.duration?(({duration:n,timescale:a=1}=i),i.duration=n/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},Ao=(e,t)=>eo(e.childNodes).filter((({tagName:e})=>e===t)),Do=e=>e.textContent.trim(),Po=e=>{var t,i,s,r,n;return(e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e))?([e,t,i,s,r,n]=e.slice(1),31536e3*parseFloat(e||0)+2592e3*parseFloat(t||0)+86400*parseFloat(i||0)+3600*parseFloat(s||0)+60*parseFloat(r||0)+parseFloat(n||0)):0},Lo={mediaPresentationDuration:e=>Po(e),availabilityStartTime:e=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e=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),presentationTime:e=>parseInt(e,10),DEFAULT:e=>e},Oo=e=>e&&e.attributes?eo(e.attributes).reduce(((e,t)=>{var i=Lo[t.name]||Lo.DEFAULT;return e[t.name]=i(t.value),e}),{}):{},Ro={"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","urn:mpeg:dash:mp4protection:2011":"mp4protection"},No=(e,t)=>t.length?Za(e.map((function(e){return t.map((function(t){var i=Do(t),s=Vr(e.baseUrl,i);return t=Qa(Oo(t),{baseUrl:s}),s!==i&&!t.serviceLocation&&e.serviceLocation&&(t.serviceLocation=e.serviceLocation),t}))}))):e,Mo=e=>{var t=Ao(e,"SegmentTemplate")[0],i=Ao(e,"SegmentList")[0],s=i&&Ao(i,"SegmentURL").map((e=>Qa({tag:"SegmentURL"},Oo(e)))),r=(e=Ao(e,"SegmentBase")[0],(r=i||t)&&Ao(r,"SegmentTimeline")[0]),n=(n=i||e||t)&&Ao(n,"Initialization")[0];(t=t&&Oo(t))&&n?t.initialization=n&&Oo(n):t&&t.initialization&&(t.initialization={sourceURL:t.initialization});let a={template:t,segmentTimeline:r&&Ao(r,"S").map((e=>Oo(e))),list:i&&Qa(Oo(i),{segmentUrls:s,initialization:Oo(n)}),base:e&&Qa(Oo(e),{initialization:Oo(n)})};return Object.keys(a).forEach((e=>{a[e]||delete a[e]})),a},Uo=e=>Za(Ao(e.node,"EventStream").map((t=>{let i=Oo(t),s=i.schemeIdUri;return Ao(t,"Event").map((t=>{var r=Oo(t),n=r.presentationTime||0,a=i.timescale||1,o=r.duration||0;return n=n/a+e.attributes.start,{schemeIdUri:s,value:i.value,id:r.id,start:n,end:n+o/a,messageData:Do(t)||r.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}}))}))),Bo=(e,t)=>(i,s)=>{var r=No(t,Ao(i.node,"BaseURL")),n=Qa(e,{periodStart:i.attributes.start}),a=("number"==typeof i.attributes.duration&&(n.periodDuration=i.attributes.duration),Ao(i.node,"AdaptationSet"));return i=Mo(i.node),Za(a.map(((e,t,i)=>s=>{var r=Oo(s),n=No(t,Ao(s,"BaseURL")),a=Ao(s,"Role")[0];a={role:Oo(a)};let o=Qa(e,r,a);return r=Ao(s,"Accessibility")[0],(a=(e=>"urn:scte:dash:cc:cea-608:2015"===e.schemeIdUri?("string"!=typeof e.value?[]:e.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"===e.schemeIdUri?("string"!=typeof e.value?[]:e.value.split(";")).map((e=>{let t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};var i,s;return/=/.test(e)?([i,s=""]=e.split("="),t.channel=i,t.language=e,s.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)(Oo(r)))&&(o=Qa(o,{captionServices:a})),(r=Ao(s,"Label")[0])&&r.childNodes.length&&(a=r.childNodes[0].nodeValue.trim(),o=Qa(o,{label:a})),r=(e=>e.reduce(((e,t)=>{var i=Oo(t),s=(i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase()),Ro[i.schemeIdUri]);return s&&(e[s]={attributes:i},i=Ao(t,"cenc:pssh")[0])&&(t=Do(i),e[s].pssh=t&&$r(t)),e}),{}))(Ao(s,"ContentProtection")),Object.keys(r).length&&(o=Qa(o,{contentProtection:r})),a=Mo(s),r=Ao(s,"Representation"),s=Qa(i,a),Za(r.map(((e,t,i)=>s=>{var r=Ao(s,"BaseURL");r=No(t,r);let n=Qa(e,Oo(s)),a=Mo(s);return r.map((e=>({segmentInfo:Qa(i,a),attributes:Qa(n,e)})))})(o,n,s)))})(n,r,i)))},Fo=(e,t)=>(1{if(""===e)throw new Error("DASH_EMPTY_MANIFEST");var t,i=new Ka;let s;try{s=(t=i.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!s||s&&0>4?20+i:10+i))}function Ho(e,t,i){var s;return i>=t.length?t.length:(s=Jo(t,i,!1),Tn(e.bytes,s.bytes)?i:Ho(e,t,i+(e=Jo(t,i+s.length)).length+e.value+s.length))}function Vo(e,t){i=t,t=Array.isArray(i)?i.map((function(e){return Zo(e)})):[Zo(i)],e=fn(e);var i,s=[];if(t.length)for(var r=0;re.length?e.length:o+a.value);o=e.subarray(o,l),Tn(t[0],n.bytes)&&(1===t.length?s.push(o):s=s.concat(Vo(o,t.slice(1)))),r+=n.length+a.length+o.length}return s}function zo(e,t,i,s){void 0===s&&(s=1/0),e=fn(e),i=[].concat(i);for(var r,n=0,a=0;n>1&63),-1!==i.indexOf(l)&&(r=n+o),n+=o+("h264"===t?1:2)}else n++}return e.subarray(0,0)}var $o=Math.pow(2,32),Wo=function(e){var t;return(e=new DataView(e.buffer,e.byteOffset,e.byteLength)).getBigUint64?(t=e.getBigUint64(0))>>0,o=t.subarray(n+4,n+8);if(0==a)break;if((a=n+a)>t.length){if(s)break;a=t.length}var l=t.subarray(n+8,a);Tn(o,i[0])&&(1===i.length?r.push(l):r.push.apply(r,e(l,i.slice(1),s))),n=a}return r},Yo={EBML:fn([26,69,223,163]),DocType:fn([66,130]),Segment:fn([24,83,128,103]),SegmentInfo:fn([21,73,169,102]),Tracks:fn([22,84,174,107]),Track:fn([174]),TrackNumber:fn([215]),DefaultDuration:fn([35,227,131]),TrackEntry:fn([174]),TrackType:fn([131]),FlagDefault:fn([136]),CodecID:fn([134]),CodecPrivate:fn([99,162]),VideoTrack:fn([224]),AudioTrack:fn([225]),Cluster:fn([31,67,182,117]),Timestamp:fn([231]),TimestampScale:fn([42,215,177]),BlockGroup:fn([160]),BlockDuration:fn([155]),Block:fn([161]),SimpleBlock:fn([163])},Qo=[128,64,32,16,8,4,2,1],Jo=function(e,t,i,s){void 0===i&&(i=!0),void 0===s&&(s=!1);var r=function(e){for(var t=1,i=0;it&&t.responseURL&&e!==t.responseURL?t.responseURL:e,cl=e=>jr.log.debug?jr.log.debug.bind(jr,"VHS:",e+" >"):function(){};function pl(...e){var t=jr.obj||jr;return(t.merge||t.mergeOptions).apply(t,e)}function ml(...e){var t=jr.time||jr;return(t.createTimeRanges||t.createTimeRanges).apply(t,e)}function gl(e,t){return wl(e,(function(e,i){return e-Sl<=t&&i+Sl>=t}))}function fl(e,t){return wl(e,(function(e){return e-Tl>=t}))}function yl(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function _l(e,t){let i=0;if(e&&e.length)for(let n=0;n{var t=[];if(!e||!e.length)return"";for(let i=0;i "+e.end(i));return t.join(", ")},Cl=e=>{var t=[];for(let i=0;i{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},Il=e=>(e.segments||[]).reduce(((e,t,i)=>(t.parts?t.parts.forEach((function(s,r){e.push({duration:s.duration,segmentIndex:i,partIndex:r,part:s,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e)),[]),xl=e=>(e=e.segments&&e.segments.length&&e.segments[e.segments.length-1])&&e.parts||[],Al=({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)},Dl=(e,t)=>t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0Date.now()}function Rl(e){return e.excludeUntil&&e.excludeUntil===1/0}function Nl(e){var t=Ol(e);return!e.disabled&&!t}function Ml(e,t){return t.attributes&&t.attributes[e]}function Ul(e,t){var i,s=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let r=!1;for(i in s){for(var n in s[i])if(r=t(s[i][n]))break;if(r)break}return!!r}let Bl=(e,t)=>{if(1===e.playlists.length)return!0;let i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((e=>!!Nl(e)&&(e.attributes.BANDWIDTH||0)!(!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)),ql=e=>{if(!e||!e.playlists||!e.playlists.length)return Ul(e,(e=>e.playlists&&e.playlists.length||e.uri));for(let i=0;itn(e)))||(t=Ul(e,(e=>Fl(s,e))))))return!1}return!0};var jl={liveEdgeDelay:Dl,duration:Ll,seekable:function(e,t,i){var s=t||0;let r=bl(e,t,!0,i);return null===r?ml():ml(s,r=rTl)&&0<=a+Tl);if(0!==a&&!c||t===o.length-1){if(n){if(0e+"-"+t,zl=(e,t,i)=>`placeholder-uri-${e}-${t}-`+i,$l=(e,t)=>{e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((i=>{if(e.mediaGroups[i])for(var s in e.mediaGroups[i])for(var r in e.mediaGroups[i][s]){var n=e.mediaGroups[i][s][r];t(n,i,s,r)}}))},Wl=({playlist:e,uri:t,id:i})=>{e.id=i,e.playlistErrors_=0,t&&(e.uri=t),e.attributes=e.attributes||{}},Gl=(e,t,i=zl)=>{e.uri=t;for(let t=0;t{if(!t.playlists||!t.playlists.length){if(r&&"AUDIO"===s&&!t.uri)for(let t=0;t{let t=e.playlists.length;for(;t--;){var i=e.playlists[t];Wl({playlist:i,id:Vl(t,i.uri)}),i.resolvedUri=hl(e.uri,i.uri),e.playlists[i.id]=i,(e.playlists[i.uri]=i).attributes.BANDWIDTH||Hl.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}})(e),$l(n=e,(e=>{e.uri&&(e.resolvedUri=hl(n.uri,e.uri))}))};class Xl{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){null===this.offset_&&e.length&&([e]=e,void 0!==e.programDateTime)&&(this.offset_=e.programDateTime/1e3)}setPendingDateRanges(e=[]){var t;e.length&&([t]=e,t=t.startDate.getTime(),this.trimProcessedDateRanges_(t),this.pendingDateRanges_=e.reduce(((e,t)=>(e.set(t.id,t),e)),new Map))}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(null===this.offset_)return[];let e={},t=[];for(var i of(this.pendingDateRanges_.forEach(((i,s)=>{this.processedDateRanges_.has(s)||(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),i.class&&(e[i.class]?(s=e[i.class].push(i),i.classListIndex=s-1):(e[i.class]=[i],i.classListIndex=0)))})),t)){var s=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&s[i.classListIndex+1]?i.endTime=s[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach(((t,i)=>{t.startDate.getTime(){var r=t.status<200||299{if(!e)return t;var i=pl(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 s=0;s{!e.resolvedUri&&e.uri&&(e.resolvedUri=hl(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=hl(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=hl(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=hl(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((e=>{e.resolvedUri||(e.resolvedUri=hl(t,e.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((e=>{e.resolvedUri||(e.resolvedUri=hl(t,e.uri))}))},Zl=(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,ed=(e,t,i=Zl)=>{var s=pl(e,{}),r=s.playlists[t.id];if(!r)return null;if(i(r,t))return null;t.segments=Yl(t);let n=pl(r,t);if(n.preloadSegment&&!t.preloadSegment&&delete n.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(let e=0;e{var s=e.slice(),r=t.slice(),n=(i=i||0,[]);let a;for(let e=0;e{Jl(e,n.resolvedUri)}));for(let e=0;e{if(e.playlists)for(let i=0;i{var i,s=(s=(i=(i=e.segments||[])[i.length-1])&&i.parts&&i.parts[i.parts.length-1])&&s.duration||i&&i.duration;return t&&s?1e3*s:500*(e.partTargetDuration||e.targetDuration||10)},id=(e,t,i)=>{if(e){let s=[];return e.forEach((e=>{var t,i,r;e.attributes&&(({BANDWIDTH:t,RESOLUTION:i,CODECS:r}=e.attributes),s.push({id:e.id,bandwidth:t,resolution:i,codecs:r}))})),{type:t,isLive:i,renditions:s}}};class sd extends cr{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=cl("PlaylistLoader");var{withCredentials:s=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack,e=t.options_,this.customTagParsers=e&&e.customTagParsers||[],this.customTagMappers=e&&e.customTagMappers||[],this.llhls=e&&e.llhls,this.dateRangesStorage_=new Xl,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){var e=this.media();e&&(this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges),(e=this.dateRangesStorage_.getDateRangesToProcess()).length)&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(e)}handleMediaupdatetimeout_(){if("HAVE_METADATA"===this.state){var e=this.media();let t=hl(this.main.uri,e.uri);this.llhls&&(t=((e,t)=>{if(!t.endList&&t.serverControl){let r={};if(t.serverControl.canBlockReload){var i,s=t.preloadSegment;let e=t.mediaSequence+t.segments.length;s&&(s=s.parts||[],-1<(i=Al(t)-1)&&i!=s.length-1&&(r._HLS_part=i),-1{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:s}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${t}.`,responseText:e.responseText,code:500<=e.status?4:2,metadata:Kl({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return(({onwarn:e,oninfo:t,manifestString:i,customTagParsers:s=[],customTagMappers:r=[],llhls:n})=>{let a=new en,o=(e&&a.on("warn",e),t&&a.on("info",t),s.forEach((e=>a.addParser(e))),r.forEach((e=>a.addTagMapper(e))),a.push(i),a.end(),a.manifest);if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){o.hasOwnProperty(e)&&delete o[e]})),o.segments&&o.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!o.targetDuration){let t=10;o.segments&&o.segments.length&&(t=o.segments.reduce(((e,t)=>Math.max(e,t.duration)),0)),e&&e({message:"manifest has no targetDuration defaulting to "+t}),o.targetDuration=t}return(t=xl(o)).length&&!o.partTargetDuration&&(s=t.reduce(((e,t)=>Math.max(e,t.duration)),0),e&&(e({message:"manifest has no partTargetDuration defaulting to "+s}),Hl.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.")),o.partTargetDuration=s),o})({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})}catch(t){this.error=t,this.error.metadata={errorType:jr.Error.StreamingHlsPlaylistParserError,error:t}}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";var r={playlistInfo:{type:"media",uri:i}};(this.trigger({type:"playlistparsestart",metadata:r}),t=t||this.parseManifest_({url:i,manifestString:e})).lastRequest=Date.now(),Wl({playlist:t,uri:i,id:s}),e=ed(this.main,t),this.targetDuration=t.partTargetDuration||t.targetDuration,this.pendingMedia_=null,e?(this.main=e,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(td(this.media(),!!e)),r.parsedPlaylist=id(this.main.playlists,r.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:r}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Xl,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{let s=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"===s?this.trigger("loadedmetadata"):this.trigger("mediachange"));else if(this.updateMediaUpdateTimeout_(td(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");let t={playlistInfo:{type:"media",uri:(this.pendingMedia_=e).uri}};this.trigger({type:"playlistrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},((i,r)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=ul(e.resolvedUri,r),i)return this.playlistRequestError(this.request,e,s);this.trigger({type:"playlistrequestcomplete",metadata:t}),this.haveMetadata({playlistString:r.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===s?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(){if(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);else{let e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},((t,i)=>{if(this.request){if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:Kl({requestType:i.requestType,request:i,error:t})},"HAVE_NOTHING"===this.state&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=ul(this.src,i),this.trigger({type:"playlistparsestart",metadata:e}),t=this.parseManifest_({manifestString:i.responseText,url:this.src}),e.parsedPlaylist=id(t.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(t)}}))}}srcUri(){return"string"==typeof this.src?this.src:this.src.uri}setupInitialPlaylist(e){var t,i,s,r;this.state="HAVE_MAIN_MANIFEST",e.playlists?(this.main=e,Gl(this.main,this.srcUri()),e.playlists.forEach((e=>{e.segments=Yl(e),e.segments.forEach((t=>{Jl(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0])):(t=this.srcUri()||window.location.href,this.main=(s=Vl(0,i=t),(r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:i,id:s,resolvedUri:i,attributes:{}}]}).playlists[s]=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"))}updateOrDeleteClone(e,t){var i=this.main,s=e.ID;let r=i.playlists.length;for(;r--;){var n,a,o,l,d,h=i.playlists[r];h.attributes["PATHWAY-ID"]===s&&(n=h.resolvedUri,a=h.id,t?(o=this.createCloneURI_(h.resolvedUri,e),l=Vl(s,o),d=this.createCloneAttributes_(s,h.attributes),h=this.createClonePlaylist_(h,l,e,d),i.playlists[r]=h,i.playlists[l]=h,i.playlists[o]=h):i.playlists.splice(r,1),delete i.playlists[a],delete i.playlists[n])}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){let i=this.main,s=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((e=>{if(i.mediaGroups[e]&&i.mediaGroups[e][s])for(var t in i.mediaGroups[e])if(t===s){for(var r in i.mediaGroups[e][t])i.mediaGroups[e][t][r].playlists.forEach(((e,t)=>{var s=(e=i.playlists[e.id]).id;e=e.resolvedUri,delete i.playlists[s],delete i.playlists[e]}));delete i.mediaGroups[e][t]}})),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){var i=this.main,s=i.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),n=Vl(e.ID,r),a=this.createCloneAttributes_(e.ID,t.attributes);t=this.createClonePlaylist_(t,n,e,a),i.playlists[s]=t,i.playlists[n]=t,i.playlists[r]=t,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){let t=e.ID,i=e["BASE-ID"],s=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((r=>{if(s.mediaGroups[r]&&!s.mediaGroups[r][t])for(var n in s.mediaGroups[r])if(n===i){s.mediaGroups[r][t]={};for(let i in s.mediaGroups[r][n]){var a=s.mediaGroups[r][n][i];s.mediaGroups[r][t][i]=Kt({},a);let l=s.mediaGroups[r][t][i];var o=this.createCloneURI_(a.resolvedUri,e);l.resolvedUri=o,l.uri=o,l.playlists=[],a.playlists.forEach(((n,a)=>{var o,d=s.playlists[n.id],h=zl(r,t,i);h=Vl(t,h),d&&!s.playlists[h]&&(o=(d=this.createClonePlaylist_(d,h,e)).resolvedUri,s.playlists[h]=d,s.playlists[o]=d),l.playlists[a]=this.createClonePlaylist_(n,h,e)}))}}}))}createClonePlaylist_(e,t,i,s){return i={resolvedUri:i=this.createCloneURI_(e.resolvedUri,i),uri:i,id:t},e.segments&&(i.segments=[]),s&&(i.attributes=s),pl(e,i)}createCloneURI_(e,t){var i,s=new URL(e),r=(s.hostname=t["URI-REPLACEMENT"].HOST,t["URI-REPLACEMENT"].PARAMS);for(i of Object.keys(r))s.searchParams.set(i,r[i]);return s.href}createCloneAttributes_(e,t){let i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((s=>{t[s]&&(i[s]=e)})),i}getKeyIdSet(e){if(e.contentProtection){var t,i=new Set;for(t in e.contentProtection){var s=e.contentProtection[t].attributes.keyId;s&&i.add(s.toLowerCase())}return i}}}function rd(e,t,i,s){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),s(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 nd(){function e(t,i){t=pl({timeout:45e3},t);var s=e.beforeRequest||jr.Vhs.xhr.beforeRequest,r=e._requestCallbackSet||jr.Vhs.xhr._requestCallbackSet||new Set;let n=e._responseCallbackSet||jr.Vhs.xhr._responseCallbackSet;s&&"function"==typeof s&&(jr.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(s));var a=(!0===jr.Vhs.xhr.original?jr:jr.Vhs).xhr,o=((e,t)=>{if(e&&e.size){let i=t;return e.forEach((e=>{i=e(i)})),i}})(r,t);r.delete(s);let l=a(o||t,(function(e,t){var s,r,a,o;return r=l,a=e,o=t,(s=n)&&s.size&&s.forEach((e=>{e(r,a,o)})),rd(l,e,t,i)})),d=l.abort;return l.abort=function(){return l.aborted=!0,d.apply(l,arguments)},l.uri=t.uri,l.requestType=t.requestType,l.requestTime=Date.now(),l}return e.original=!0,e}function ad(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 od(e,t){return e=e.toString(16),"00".substring(0,2-e.length)+e+(t%2?" ":"")}function ld(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function dd(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function hd(e){return e.resolvedUri}let ud=function(e){let t={};return Object.keys(e).forEach((i=>{var s=e[i];gn(s)?t[i]={bytes:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength}:t[i]=s})),t},cd=e=>{var t=Array.prototype.slice.call(e);let i="";for(let e=0;ecd(e),textRanges:e=>{let t,i="";for(t=0;t{var o,l,d;if(a)return void 0!==e&&t&&s?t.endList||n.hasStarted_?(e=>{if(!e.segments||0===e.segments.length)return!1;for(let t=0;t{let i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;let s=t.segments[0];if(ie.transmuxedPresentationEnd-e.transmuxedPresentationStart-e.transmuxerPrependedSeconds)(e.videoTimingInfo):e.duration+.25*e.duration;return i>(n=new Date(r.getTime()+1e3*n))?null:{segment:s=i>new Date(r)?e:s,estimatedStart:s.videoTimingInfo?s.videoTimingInfo.transmuxedPresentationStart:jl.duration(t,t.mediaSequence+t.segments.indexOf(s)),type:s.videoTimingInfo?"accurate":"estimate"}})(e,t))?(l=((e,t)=>{let i,s;try{i=new Date(e),s=new Date(t)}catch(e){}return e=i.getTime(),(s.getTime()-e)/1e3})((o=d.segment).dateTimeObject,e),"estimate"===d.type?0===i?a({message:e+" is not buffered yet. Try again"}):(s(d.estimatedStart+l),void n.one("seeked",(()=>{pd({programTime:e,playlist:t,retryCount:i-1,seekTo:s,pauseAfterSeek:r,tech:n,callback:a})}))):(d=o.start+l,n.one("seeked",(()=>a(null,n.currentTime()))),r&&n.pause(),void s(d))):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 md(e,t){if(!Zl(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`placeholder-uri-${e}-${t}-`+(s.attributes.NAME||i),fd=(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,yd=(e,t)=>{var i,s={};for(i in e){var r=e[i].sidx;if(r){var n=co(r);if(!t[n])break;var a=t[n].sidxInfo;fd(a,r)&&(s[n]=t[n])}}return s};class _d extends P{constructor(e,t,i={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);var{withCredentials:s=!1}=i;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!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_=cl("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,metadata:e.metadata}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)}addSidxSegments_(e,t,i){let s=e.sidx&&co(e.sidx);if(e.sidx&&s&&!this.mainPlaylistLoader_.sidxMapping_[s]){let r=ul(e.sidx.resolvedUri),n=(r,n)=>{if(!this.requestErrored_(r,n,t)){r=this.mainPlaylistLoader_.sidxMapping_;var a=n.requestType;let o;try{o=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)},s=12,r=(0===i.version?(i.earliestPresentationTime=t.getUint32(s),i.firstOffset=t.getUint32(s+4),s+=8):(i.earliestPresentationTime=Wo(e.subarray(s)),i.firstOffset=Wo(e.subarray(s+8)),s+=16),t.getUint16(s+=2));for(s+=2;0>>7,referencedSize:2147483647&t.getUint32(s),subsegmentDuration:t.getUint32(s+4),startsWithSap:!!(128&e[s+8]),sapType:(112&e[s+8])>>>4,sapDeltaTime:268435455&t.getUint32(s+8)});return i}(fn(n.response).subarray(8))}catch(e){return e.metadata=Kl({requestType:a,request:n,parseFailure:!0}),void this.requestErrored_(e,n,t)}return r[s]={sidxInfo:e.sidx,sidx:o},ao(e,o,e.sidx.resolvedUri),i(!0)}};this.request=((e,t,i,s)=>{function r(e,t,s,r){return t.abort(),l=!0,i(e,t,s,r)}function n(e,t){var i;if(!l)return e?(e.metadata=Kl({requestType:"dash-sidx",request:t,error:e}),r(e,t,"",o)):(i=t.responseText.substring(o&&o.byteLength||0,t.responseText.length),o=function(){for(var e,t,i,s=arguments.length,r=new Array(s),n=0;n{if(4===e.readyState)return t()})(t,(()=>r(e,t,"",o))):r(null,t,i,o))}let a,o=[],l=!1,d=t({uri:e,beforeSend(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function({}){return rd(e,null,{statusCode:e.status},n)}))}},(function(e,t){return rd(d,e,t,n)}));return d})(r,this.vhs_.xhr,((t,i,s,a)=>{var o,l;return t?n(t,i):s&&"mp4"===s?(({offset:o,length:l}=e.sidx.byterange),a.length>=l+o?n(t,{response:a.subarray(o,o+l),status:i.status,uri:i.uri}):void(this.request=this.vhs_.xhr({uri:r,responseType:"arraybuffer",requestType:"dash-sidx",headers:ad({byterange:e.sidx.byterange})},n))):(t=s||"unknown",n({status:i.status,message:`Unsupported ${t} 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);let 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){let t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},((i,s)=>{var r;if(i&&(r=s.requestType,i.metadata=Kl({requestType:r,request:s,error:i})),this.requestErrored_(i,s))"HAVE_NOTHING"===this.state&&(this.started=!1);else{this.trigger({type:"manifestrequestcomplete",metadata:t});let i=s.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=s.responseText,s.responseHeaders&&s.responseHeaders.date?this.mainLoaded_=Date.parse(s.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=ul(this.mainPlaylistLoader_.srcUrl,s),!i)return e(s,i);this.handleMain_(),this.syncClientServerClock_((()=>e(s,i)))}}))}syncClientServerClock_(e){let t=(e=>(e=>{if(!(e=Ao(e,"UTCTiming")[0]))return null;var t=Oo(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})(qo(e)))(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:hl(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},((i,s)=>{if(this.request){var r;if(i)return r=s.requestType,this.error.metadata=Kl({requestType:r,request:s,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();let n;n="HEAD"===t.method?s.responseHeaders&&s.responseHeaders.date?Date.parse(s.responseHeaders.date):this.mainLoaded_:Date.parse(s.responseText),this.mainPlaylistLoader_.clientOffset_=n-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,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};let i;this.trigger({type:"manifestparsestart",metadata:t});try{i=(({mainXml:e,srcUrl:t,clientOffset:i,sidxMapping:s,previousManifest:r})=>(i={manifestUri:t,clientOffset:i,sidxMapping:s,previousManifest:r},s=(e=>e.map(xo))((e=((e,t={})=>{var{manifestUri:t="",NOW:i=Date.now(),clientOffset:s=0,eventHandler:r=function(){}}=t,n=Ao(e,"Period");if(!n.length)throw new Error("INVALID_NUMBER_OF_PERIOD");var a=Ao(e,"Location");let o=Oo(e);t=No([{baseUrl:t}],Ao(e,"BaseURL")),e=Ao(e,"ContentSteering"),o.type=o.type||"static",o.sourceDuration=o.mediaPresentationDuration||0,o.NOW=i,o.clientOffset=s,a.length&&(o.locations=a.map(Do));let l=[];return n.forEach(((e,t)=>{var i=Oo(e);t=l[t-1],i.start=(({attributes:e,priorPeriodAttributes:t,mpdType:i})=>"number"==typeof e.start?e.start:t&&"number"==typeof t.start&&"number"==typeof t.duration?t.start+t.duration:t||"static"!==i?null:0)({attributes:i,priorPeriodAttributes:t?t.attributes:null,mpdType:o.type}),l.push({node:e,attributes:i})})),{locations:o.locations,contentSteeringInfo:Fo(e,r),representationInfo:Za(l.map(Bo(o,t))),eventStream:Za(l.map(Uo))}})(qo(e=e),i)).representationInfo),r=To({dashPlaylists:s,locations:e.locations,contentSteering:e.contentSteeringInfo,sidxMapping:i.sidxMapping,previousManifest:i.previousManifest,eventStream:e.eventStream}),Gl(r,t,gd),r))({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(e){this.error=e,this.error.metadata={errorType:jr.Error.StreamingDashManifestParserError,error:e},this.trigger("error")}var s;if(e&&(i=((e,t,i)=>{let s=!0,r=pl(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts});for(let e=0;e{var a,o;e.playlists&&e.playlists.length&&(a=e.playlists[0].id,o=ed(r,e.playlists[0],md))&&(n in(r=o).mediaGroups[t][i]||(r.mediaGroups[t][i][n]=e),r.mediaGroups[t][i][n].playlists[0]=r.playlists[a],s=!1)})),l=t,$l(o=r,((e,t,i,s)=>{l.mediaGroups[t][i]&&s in l.mediaGroups[t][i]||delete o.mediaGroups[t][i][s]})),(s=t.minimumUpdatePeriod===e.minimumUpdatePeriod&&s)?null:r})(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e,(s=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0])&&s!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=s),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){var{duration:s,endList:e}=i;let r=[];i.playlists.forEach((e=>{r.push({id:e.id,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS})})),s={duration:s,isLive:!e,renditions:r},t.parsedManifest=s,this.trigger({type:"manifestparsecomplete",metadata:t})}return Boolean(i)}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){let 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=yd(e.playlists,t);return $l(e,((e,s,r,n)=>{e.playlists&&e.playlists.length&&(e=e.playlists,i=pl(i,yd(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;let i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){let e=()=>{this.media().endList||(this.mediaUpdateTimeout=window.setTimeout((()=>{this.trigger("mediaupdatetimeout"),e()}),td(this.media(),Boolean(i))))};e()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){e&&this.mainPlaylistLoader_.main.eventStream&&(e=this.mainPlaylistLoader_.main.eventStream.map((e=>({cueTime:e.start,frames:[{data:e.messageData}]}))),this.addMetadataToTextTrack("EventStream",e,this.mainPlaylistLoader_.main.duration))}getKeyIdSet(e){if(e.contentProtection){var t,i=new Set;for(t in e.contentProtection){var s=e.contentProtection[t].attributes["cenc:default_KID"];s&&i.add(s.replace(/-/g,"").toLowerCase())}return i}}}var vd={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 bd(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e}function Td(e){return function(){let 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=bd(new Worker(t));i.objURL=t;let s=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),s.call(this)},i}}function Sd(e){return`var browserWorkerPolyFill = ${bd.toString()};\nbrowserWorkerPolyFill(self);\n`+e}function wd(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)}var Ed=Td(Sd(wd((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),-1Ce;)e+=i*Ee;return e}function Z(e){var t,i;Z.prototype.init.call(this),this.type_=e||"shared",this.push=function(e){"metadata"===e.type?this.trigger("data",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=[],s=0,r=1;r>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},m=function(e){return t(T.hdlr,C[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))},n=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,k):t(T.smhd,I),i(),f(e))},l=function(e){for(var i=e.length,s=[];i--;)s[i]=v(e[i]);return t.apply(null,[T.mvex].concat(s))},d=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)},g=function(e){for(var i,s=e.samples||[],r=new Uint8Array(4+s.length),n=0;n>>8),a.push(255&r[l].byteLength),a=a.concat(Array.prototype.slice.call(r[l]));for(l=0;l>>8),o.push(255&n[l].byteLength),o=o.concat(Array.prototype.slice.call(n[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,[n.length],o))),t(T.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio&&(s=e.sarRatio[0],e=e.sarRatio[1],i.push(t(T.pasp,new Uint8Array([(4278190080&s)>>24,(16711680&s)>>16,(65280&s)>>8,255&s,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])))),t.apply(null,i)},R=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]),s(e))},u=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,s=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),n=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,n>>>24&255,n>>>16&255,n>>>8&255,255&n])),"audio"===e.type?(i=b(e,92),t(T.traf,s,r,i)):(n=g(e),i=b(e,n.length+92),t(T.traf,s,r,i,n))},h=function(e){return e.duration=e.duration||4294967295,t(T.trak,u(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)},N=function(e,t){var i=0,s=0,r=0,n=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(s=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset)&&(n=8),[0,0,i|s|r|n,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]},M=function(e,i){var s,r,n,a,o=e.samples||[];for(i+=20+16*o.length,e=N(o,i),(r=new Uint8Array(e.length+16*o.length)).set(e),s=e.length,a=0;a>>24,r[s++]=(16711680&n.duration)>>>16,r[s++]=(65280&n.duration)>>>8,r[s++]=255&n.duration,r[s++]=(4278190080&n.size)>>>24,r[s++]=(16711680&n.size)>>>16,r[s++]=(65280&n.size)>>>8,r[s++]=255&n.size,r[s++]=n.flags.isLeading<<2|n.flags.dependsOn,r[s++]=n.flags.isDependedOn<<6|n.flags.hasRedundancy<<4|n.flags.paddingValue<<1|n.flags.isNonSyncSample,r[s++]=61440&n.flags.degradationPriority,r[s++]=15&n.flags.degradationPriority,r[s++]=(4278190080&n.compositionTimeOffset)>>>24,r[s++]=(16711680&n.compositionTimeOffset)>>>16,r[s++]=(65280&n.compositionTimeOffset)>>>8,r[s++]=255&n.compositionTimeOffset;return t(T.trun,r)},U=function(e,i){var s,r,n,a,o=e.samples||[];for(i+=20+8*o.length,e=N(o,i),(s=new Uint8Array(e.length+8*o.length)).set(e),r=e.length,a=0;a>>24,s[r++]=(16711680&n.duration)>>>16,s[r++]=(65280&n.duration)>>>8,s[r++]=255&n.duration,s[r++]=(4278190080&n.size)>>>24,s[r++]=(16711680&n.size)>>>16,s[r++]=(65280&n.size)>>>8,s[r++]=255&n.size;return t(T.trun,s)},b=function(e,t){return("audio"===e.type?U:M)(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 s=[],r=i.length;r--;)s[r]=_(i[r]);return t.apply(null,[T.moof,n(e)].concat(s))},moov:o=function(e){for(var i=e.length,s=[];i--;)s[i]=h(e[i]);return t.apply(null,[T.moov,d(4294967295)].concat(s).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}}},se={groupNalsIntoFrames:function(e){var t,i,s=[],r=[];for(r.byteLength=0,r.nalCount=0,t=s.byteLength=r.duration=0;tde.ONE_SECOND_IN_TS/2))){for(a=(a=le()[e.samplerate])||t[0].data,o=0;o=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=0;i=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),0this.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||{},ye.prototype.init.call(this);var t,i=this,s=e.captionServices||{},r={};Object.keys(s).forEach((e=>{t=s[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)}}),_e=(ye.prototype=new me,ye.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},ye.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)},ye.prototype.push708Packet=function(){var e,t=this.current708Packet,i=t.data,s=null,r=0,n=i[r++];for(t.seq=n>>6,t.sizeCode=63&n;r>5)&&0("0"+(255&e).toString(16)).slice(-2))).join(""),String.fromCharCode(parseInt(n,16))):(t=fe[r=a|o]||r,4096&r&&r===t?"":String.fromCharCode(t)),l.pendingNewLine&&!l.isEmpty()&&l.newLine(this.getPts(e)),l.pendingNewLine=!1,l.addText(i),e},ye.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data;return G(i[e+1])&&G(i[e+2])?this.handleText(++e,t,{isMultiByte:!0}):e},ye.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},ye.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,s=i[e];return t.setCurrentWindow(7&s),t=t.currentWindow,s=i[++e],t.visible=(32&s)>>5,t.rowLock=(16&s)>>4,t.columnLock=(8&s)>>3,t.priority=7&s,s=i[++e],t.relativePositioning=(128&s)>>7,t.anchorVertical=127&s,s=i[++e],t.anchorHorizontal=s,s=i[++e],t.anchorPoint=(240&s)>>4,t.rowCount=15&s,s=i[++e],t.columnCount=63&s,s=i[++e],t.windowStyle=(56&s)>>3,t.penStyle=7&s,t.virtualRowCount=t.rowCount+1,e},ye.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,s=(i[e],t=t.currentWindow.winAttr,i[++e]);return t.fillOpacity=(192&s)>>6,t.fillRed=(48&s)>>4,t.fillGreen=(12&s)>>2,t.fillBlue=3&s,s=i[++e],t.borderType=(192&s)>>6,t.borderRed=(48&s)>>4,t.borderGreen=(12&s)>>2,t.borderBlue=3&s,s=i[++e],t.borderType+=(128&s)>>5,t.wordWrap=(64&s)>>6,t.printDirection=(48&s)>>4,t.scrollDirection=(12&s)>>2,t.justify=3&s,s=i[++e],t.effectSpeed=(240&s)>>4,t.effectDirection=(12&s)>>2,t.displayEffect=3&s,e},ye.prototype.flushDisplayed=function(e,t){for(var i=[],s=0;s<8;s++)t.windows[s].visible&&!t.windows[s].isEmpty()&&i.push(t.windows[s].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},ye.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)},ye.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],s=this.getPts(e);this.flushDisplayed(s,t);for(var r=0;r<8;r++)i&1<>4,t.offset=(12&s)>>2,t.penSize=3&s,s=i[++e],t.italics=(128&s)>>7,t.underline=(64&s)>>6,t.edgeType=(56&s)>>3,t.fontStyle=7&s,e},ye.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,s=(i[e],t=t.currentWindow.penColor,i[++e]);return t.fgOpacity=(192&s)>>6,t.fgRed=(48&s)>>4,t.fgGreen=(12&s)>>2,t.fgBlue=3&s,s=i[++e],t.bgOpacity=(192&s)>>6,t.bgRed=(48&s)>>4,t.bgGreen=(12&s)>>2,t.bgBlue=3&s,s=i[++e],t.edgeRed=(48&s)>>4,t.edgeGreen=(12&s)>>2,t.edgeBlue=3&s,e},ye.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,s=(i[e],t.currentWindow.penLoc);return t.currentWindow.pendingNewLine=!0,t=i[++e],s.row=15&t,t=i[++e],s.column=63&t,e},ye.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}),ve=14,be=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Te=function(e,t){Te.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,s,r,n=32639&e.ccData;n===this.lastControlCode_?this.lastControlCode_=null:(4096==(61440&n)?this.lastControlCode_=n:n!==this.PADDING_&&(this.lastControlCode_=null),t=n>>>8,i=255&n,n!==this.PADDING_&&(n===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":n===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):n===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(e.pts)):n===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(e.pts)):n===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(e.pts)):n===this.CARRIAGE_RETURN_?(this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts):n===this.BACKSPACE_?"popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1):n===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(e.pts),this.displayed_=Q()):n===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=Q():n===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Q()),this.mode_="paintOn",this.startPts_=e.pts):this.isSpecialCharacter(t,i)?(s=Y((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isExtCharacter(t,i)?("popOn"===this.mode_?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),s=Y((t=(3&t)<<8)|i),this[this.mode_](e.pts,s),this.column_++):this.isMidRowCode(t,i)?(this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&i)&&this.addFormatting(e.pts,["i"]),1==(1&i)&&this.addFormatting(e.pts,["u"])):this.isOffsetControlCode(t,i)?(this.nonDisplayed_[this.row_].offset=r=3&i,this.column_+=r):this.isPAC(t,i)?(r=be.indexOf(7968&n),"rollUp"===this.mode_&&(r-this.rollUpRows_+1<0&&(r=this.rollUpRows_-1),this.setRollUp(e.pts,r)),r!==this.row_&&0<=r&&r<=14&&(this.clearFormatting(e.pts),this.row_=r),1&i&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&n)&&(this.column_=4*(r=(14&n)>>1),this.nonDisplayed_[this.row_].indent+=r),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(e.pts,["i"])):this.isNormalChar(t)&&(0===i&&(i=null),s=Y(t),s+=Y(i),this[this.mode_](e.pts,s),this.column_+=s.length)))}},Se=(Te.prototype=new me,Te.prototype.flushDisplayed=function(e){let t=e=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},i=[];this.displayed_.forEach(((e,s)=>{if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(e){t(s)}e.text.length&&i.push({text:e.text,line:s+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&t(s)})),i.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:i,stream:this.name_})},Te.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Q(),this.nonDisplayed_=Q(),this.lastControlCode_=null,this.column_=0,this.row_=ve,this.rollUpRows_=2,this.formatting_=[]},Te.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_},Te.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},Te.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},Te.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},Te.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},Te.prototype.isPAC=function(e,t){return e>=this.BASE_&&e"}),""),this[this.mode_](e,t)},Te.prototype.clearFormatting=function(e){var t;this.formatting_.length&&(t=this.formatting_.reverse().reduce((function(e,t){return e+""}),""),this.formatting_=[],this[this.mode_](e,t))},Te.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_].text;this.nonDisplayed_[this.row_].text=i+=t},Te.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_].text;this.displayed_[this.row_].text=i+=t},Te.prototype.shiftRowsUp_=function(){for(var e=0;e{if(e)for(var s=i;s>>2,h.timeStamp=d=(d*=4)+(3&l[7]),void 0===t.pts&&void 0===t.dts&&(t.pts=h.timeStamp,t.dts=h.timeStamp),this.trigger("timestamp",h)),t.frames.push(h),(i=i+10+a)>>4&&(s+=t[s]+1),0===i.pid)i.type="pat",e(t.subarray(s),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(s),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,s,i]):this.processPes_(t,s,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Ve.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ve.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 je,De.STREAM_TYPES={h264:27,adts:15},(Pe=function(){function e(e,t,s){var r,n=new Uint8Array(e.size),a={type:t},l=0,d=0;if(e.data.length&&!(e.size<9)){for(a.trackId=e.data[0].pid,l=0;l>>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]))};Pe.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var t,i;switch(o.streamType){case Ve.H264_STREAM_TYPE:t=r,i="video";break;case Ve.ADTS_STREAM_TYPE:t=n,i="audio";break;case Ve.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"}),s=!0,i.trigger("data",e)}})[o.type]()},this.reset=function(){r.size=0,r.data.length=0,n.size=0,n.data.length=0,this.trigger("reset")},this.flushStreams_=function(){e(r,"video"),e(n,"audio"),e(a,"timed-metadata")},this.flush=function(){var e;!s&&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)),s=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new je,{PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:ze,TransportParseStream:De,ElementaryStream:Pe,TimestampRolloverStream:we,CaptionStream:He.CaptionStream,Cea608Stream:He.Cea608Stream,Cea708Stream:He.Cea708Stream,MetadataStream:Ue});for(Le in Ve)Ve.hasOwnProperty(Le)&&($e[Le]=Ve[Le]);je=$e,we=F;var We,Ge,Xe=oe.ONE_SECOND_IN_TS,Ke=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Ye=function(e){var t,i=0;Ye.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(s){var r,n,a,o,l,d,h=0;if(e||(i=0),"audio"===s.type){for(t&&t.length?(a=t,(t=new Uint8Array(a.byteLength+s.data.byteLength)).set(a),t.set(s.data,a.byteLength)):t=s.data;h+7>5,l=(o=1024*(1+(3&t[h+6])))*Xe/Ke[(60&t[h+2])>>>2],t.byteLength-h>>6&3),channelcount:(1&t[h+2])<<2|(192&t[h+3])>>>6,samplerate:Ke[(60&t[h+2])>>>2],samplingfrequencyindex:(60&t[h+2])>>>2,samplesize:16,data:t.subarray(h+7+n,h+r)}),i++,h+=r}"number"==typeof d&&(this.skipWarn_(d,h),d=null),t=t.subarray(h)}},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")}},Qe=(Ye.prototype=new we,He=Ye,Ue=F,function(e){var t=e.byteLength,i=0,s=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+s},this.loadWord=function(){var r=e.byteLength-t,n=new Uint8Array(4),a=Math.min(4,t);if(0===a)throw new Error("no bytes available");n.set(e.subarray(r,r+a)),i=new DataView(n.buffer).getUint32(0),s=8*a,t-=a},this.skipBits=function(e){var r;e>>32-r;return 0<(s-=r)?i<<=r:0>>e))return i<<=e,s-=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()}),Je=function(){var e,t,i=0;Je.prototype.init.call(this),this.push=function(s){for(var r,n=(t=t?((r=new Uint8Array(t.byteLength+s.data.byteLength)).set(t),r.set(s.data,t.byteLength),r):s.data).byteLength;i>4?20+i:10+i},it=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+=tt(e,t),it(e,t))},st=function(e,t,i){for(var s="",r=t;r=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:tt,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5;return 6144&e[t+3]|e[t+4]<<3|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==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i=10;64&e[5]&&(i=(i+=4)+Ze(e.subarray(10,14)));do{if((t=Ze(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 s,r,n=e.subarray(i+10,i+t+10),a=0;a>>2,(r*=4)+(3&s[7]);break}}while((i=i+10+t)e.length)break;s={type:"timed-metadata",data:e.subarray(a,a+n)},this.trigger("data",s),a+=n}else if(255==(255&e[a])&&240==(240&e[a+1])){if(e.length-a<7)break;if(a+(n=nt.parseAdtsSize(e,a))>e.length)break;s={type:"audio",data:e.subarray(a,a+n),pts:t,dts:t},this.trigger("data",s),a+=n}else a++;e=0>>4&&(t+=e[4]+1),t}function Ot(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}}It.prototype=new rt,(ht=function(e,t){var i,s,r=[],n=[],a=(t=t||{}).firstSequenceNumber||0;ht.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){ft.collectDtsInfo(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],Ct.forEach((function(t){e[t]=i[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||s||(s=t.data,e.pps=[t.data]),r.push(t)},this.flush=function(){for(var i,s,o,l=0;r.length&&"access_unit_delimiter_rbsp"!==r[0].nalUnitType;)r.shift();if(0!==r.length){if(i=mt.groupNalsIntoFrames(r),(i=mt.groupFramesIntoGops(i))[0][0].keyFrame||((d=this.getGopForFusion_(r[0],e))?(l=d.duration,i.unshift(d),i.byteLength+=d.byteLength,i.nalCount+=d.nalCount,i.pts=d.pts,i.dts=d.dts,i.duration+=d.duration):i=mt.extendFirstKeyFrame(i)),n.length){var d=t.alignGopsAtEnd?this.alignGopsAtEnd_(i):this.alignGopsAtStart_(i);if(!d)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");ft.clearDtsInfo(e),i=d}ft.collectDtsInfo(e,i),e.samples=mt.generateSampleTable(i),d=pt.mdat(mt.concatenateNalData(i)),e.baseMediaDecodeTime=ft.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",i.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),s=i[0],o=i[i.length-1],this.trigger("segmentTimingInfo",dt(e.baseMediaDecodeTime,s.dts,s.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),s=pt.moof(a,[e]),o=new Uint8Array(s.byteLength+d.byteLength),a++,o.set(s),o.set(d,s.byteLength),this.trigger("data",{track:e,boxes:o})}this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),r=[],this.gopCache_.length=0,n.length=0,this.trigger("reset")},this.resetStream_=function(){ft.clearDtsInfo(e),s=i=void 0},this.getGopForFusion_=function(t){for(var i,s,r,n=1/0,a=0;a=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,Ct.forEach((function(e){n.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,Et.forEach((function(e){n.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?n.type=this.pendingTracks[0].type:n.type="combined",this.emittedTracks+=this.pendingTracks.length,e=pt.initSegment(this.pendingTracks),n.initSegment=new Uint8Array(e.byteLength),n.initSegment.set(e),n.data=new Uint8Array(this.pendingBytes),s=0;s=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},ct.prototype.setRemux=function(e){this.remuxTracks=e},(ut=function(e){var t,i,s=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 yt.MetadataStream,r.aacStream=new Tt,r.audioTimestampRolloverStream=new yt.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new yt.TimestampRolloverStream("timed-metadata"),r.adtsStream=new vt,r.coalesceStream=new ct(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(n){"timed-metadata"!==n.type&&"audio"!==n.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:s.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new It(i,e),r.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),s.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),ot(this,r)},this.setupTsPipeline=function(){var r={};(this.transmuxPipeline_=r).type="ts",r.metadataStream=new yt.MetadataStream,r.packetStream=new yt.TransportPacketStream,r.parseStream=new yt.TransportParseStream,r.elementaryStream=new yt.ElementaryStream,r.timestampRolloverStream=new yt.TimestampRolloverStream,r.adtsStream=new vt,r.h264Stream=new bt,r.captionStream=new yt.CaptionStream(e),r.coalesceStream=new ct(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(n){var a;if("metadata"===n.type){for(a=n.tracks.length;a--;)t||"video"!==n.tracks[a].type?i||"audio"!==n.tracks[a].type||((i=n.tracks[a]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime):(t=n.tracks[a]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new ht(t,e),r.videoSegmentStream.on("log",s.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-s.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",s.trigger.bind(s,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",s.trigger.bind(s,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new It(i,e),r.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),s.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,s.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),ot(this,r)},this.setBaseMediaDecodeTime=function(s){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=s),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,ft.clearDtsInfo(i),r.audioTimestampRolloverStream)&&r.audioTimestampRolloverStream.discontinuity(),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,ft.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=St(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 rt;var Rt=ut,Nt=(he=function(e){return("00"+e.toString(16)).slice(-2)},F=function(e){return e>>>0}),Mt=xt,Ut=F,Bt=j.getUint64,Ft=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]}},qt=(je=ce="undefined"!=typeof window?window:void 0!==B?B:"undefined"!=typeof self?self:{},pe.discardEmulationPreventionBytes),jt=me.CaptionStream,Ht=At,Vt=je,zt=function(e,t){for(var i=e,s=0;s=e.byteLength?null:(i=null,192&(s=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&s)&&(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+Lt(e),i=e.subarray(t),s=0,r=0,n=!1;r>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase()),(s=Jt(e,["mdia","mdhd"])[0])&&(r.timescale=function(e){var t=0===e[0]?12:20;return Yt(e[t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])}(s)),t.push(r)})),t}(e);this.self.postMessage({action:"probeMp4Tracks",tracks:t,data:e},[e.buffer])}probeEmsgID3({data:e,offset:t}){t=function(e,t=0){return Jt(e,["emsg"]).map((e=>{e=function(e){var t,i,s,r,n,a,o,l=4,d=e[0],h=(0===d?(l=(l+=(r=Gt(e.subarray(l))).length)+(n=Gt(e.subarray(l))).length,s=(h=new DataView(e.buffer)).getUint32(l),o=h.getUint32(l+=4),t=h.getUint32(l+=4),i=h.getUint32(l+=4),l+=4):1===d&&(s=(h=new DataView(e.buffer)).getUint32(l),a=Xt(e.subarray(l+=4)),t=h.getUint32(l+=8),i=h.getUint32(l+=4),l=(l=(l+=4)+(r=Gt(e.subarray(l))).length)+(n=Gt(e.subarray(l))).length),{scheme_id_uri:r,value:n,timescale:s||1,presentation_time:a,presentation_time_delta:o,event_duration:t,id:i,message_data:new Uint8Array(e.subarray(l,e.byteLength))});return n="\0"!==(r=h).scheme_id_uri,a=0===(s=d)&&Kt(r.presentation_time_delta)&&n,o=1===s&&Kt(r.presentation_time)&&n,!(1e.length?s=!0:(null===a&&(t=e.subarray(l,l+o),a=oi.aac.parseAacTimestamp(t)),l+=o);break;case"audio":e.length-l<7||(o=oi.aac.parseAdtsSize(e,l))>e.length?s=!0:(null===n&&(t=e.subarray(l,l+o),n=oi.aac.parseSampleRate(t)),r++,l+=o);break;default:l++}if(s)return null}return null===n||null===a?null:{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*r*(i=li/n),pts:a+1024*r*i}]}}:function(e){var t,i={pid:null,table:null},s={};for(t in function(e,t){for(var i,s=0,r=di;r{let{transmuxer:t,bytes:i,audioAppendStart:s,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:d,onVideoSegmentTimingInfo:h,onAudioSegmentTimingInfo:u,onId3:c,onCaptions:p,onDone:m,onEndedTimeline:g,onTransmuxerLog:f,isEndOfTimeline:y,segment:_,triggerSegmentEventFn:v}=e,b={buffer:[]},T=y;var S,w;t.onmessage=i=>{t.currentTransmux!==e||("data"===i.data.action&&((e,t,i)=>{var{type:s,initSegment:r,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:d}=e.data.segment,n=(t.buffer.push({captions:n,captionStreams:a,metadata:o}),t=e.data.segment.boxes||{data:e.data.segment.data},{type:s,data:new Uint8Array(t.data,t.data.byteOffset,t.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)});void 0!==l&&(n.videoFrameDtsTime=l),void 0!==d&&(n.videoFramePtsTime=d),i(n)})(i,b,a),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&((e,t)=>{t.gopInfo=e.data.gopInfo})(i,b),"audioTimingInfo"===i.data.action&&l(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&d(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&h(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&u(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&&(T=!1,g()),"log"===i.data.action&&f(i.data.log),"transmuxed"!==i.data.type)||T||(t.onmessage=null,(({transmuxedData:e,callback:t})=>{e.buffer=[],t(e)})({transmuxedData:b,callback:m}),kd(t))},t.onerror=()=>{var e={message:"Received an error message from the transmuxer worker",metadata:{errorType:jr.Error.StreamingFailedToTransmuxSegment,segmentInfo:oh({segment:_})}};m(null,e)},s&&t.postMessage({action:"setAudioAppendStart",appendStart:s}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==n&&t.postMessage({action:"setRemux",remux:n}),i.byteLength&&(S=i instanceof ArrayBuffer?i:i.buffer,w=i instanceof ArrayBuffer?0:i.byteOffset,v({type:"segmenttransmuxingstart",segment:_}),t.postMessage({action:"push",data:S,byteOffset:w,byteLength:i.byteLength},[S])),y&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},kd=e=>{e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():Cd(e.currentTransmux))},Id=(e,t)=>{e.postMessage({action:t}),kd(e)};var xd=e=>{((e,t)=>{t.currentTransmux?t.transmuxQueue.push(Id.bind(null,t,e)):(t.currentTransmux=e,Id(t,e))})("reset",e)};function Ad(e){let t=0;return e.audio&&t++,e.video&&t++,t}function Dd(e,t){var i=t.attributes||{},s=zd(function(e){if((e=e.attributes||{}).CODECS)return hn(e.CODECS)}(t)||[]);return!Vd(e,t)||s.audio||((e,t)=>{if(!Vd(e,t))return!0;t=t.attributes||{};var i,s=e.mediaGroups.AUDIO[t.AUDIO];for(i in s)if(!s[i].uri&&!s[i].playlists)return!0;return!1})(e,t)||(t=zd(function(e,t){if(e.mediaGroups.AUDIO&&t){var i=e.mediaGroups.AUDIO[t];if(i)for(var s in i)if((s=i[s]).default&&s.playlists)return hn(s.playlists[0].attributes.CODECS)}return null}(e,i.AUDIO)||[])).audio&&(s.audio=t.audio),s}function Pd(e,t){return(e=e&&window.getComputedStyle(e))?e[t]:""}function Ld(e,t){let i,s;return i=(i=e.attributes.BANDWIDTH?e.attributes.BANDWIDTH:i)||window.Number.MAX_VALUE,s=(s=t.attributes.BANDWIDTH?t.attributes.BANDWIDTH:s)||window.Number.MAX_VALUE,i-s}let Od=function(e){let t=e.transmuxer,i=e.endAction||e.action,s=e.callback;var r,n=Kt({},e,{endAction:null,transmuxer:null,callback:null});let 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),s(r.data))};t.addEventListener("message",a),e.data?(r=e.data instanceof ArrayBuffer,n.byteOffset=r?0:e.data.byteOffset,n.byteLength=e.data.byteLength,r=[r?e.data:e.data.buffer],t.postMessage(n,r)):t.postMessage(n)},Rd=-101,Nd=-102,Md=e=>{e.forEach((e=>{e.abort()}))},Ud=(e,t)=>{var i=t.requestType;return i=Kl({requestType:i,request:t,error:e}),t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Rd,xhr:t,metadata:i}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Nd,xhr:t,metadata:i}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:2,xhr:t,metadata:i}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:2,xhr:t,metadata:i}:null},Bd=(e,t,i,s)=>(r,n)=>{var a=n.response;if(r=Ud(r,n))return i(r,e);if(16!==a.byteLength)return i({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:2,xhr:n},e);r=new DataView(a);var o=new Uint32Array([r.getUint32(0),r.getUint32(4),r.getUint32(8),r.getUint32(12)]);for(let e=0;e{var i,s=ll(e.map.bytes);if("mp4"!==s)return i=e.map.resolvedUri||e.map.uri,t({internal:!0,message:`Found unsupported ${s=s||"unknown"} container for initialization segment at URL: `+i,code:2,metadata:{mediaType:s}});Od({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:({tracks:i,data:s})=>(e.map.bytes=s,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))})},qd=({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let m=new Uint8Array(t);if(function(e){return 0{h(e,{data:m,type:n.hasAudio&&!n.isMuxed?"audio":"video"}),i&&i.length&&a(e,i),t&&t.length&&o(e,t),u(null,e,{})});Od({action:"probeMp4StartTime",timescales:e.map.timescales,data:m,transmuxer:e.transmuxer,callback:({data:i,startTime:a})=>{t=i.buffer,e.bytes=m=i,n.hasAudio&&!n.isMuxed&&s(e,"audio","start",a),n.hasVideo&&s(e,"video","start",a),Od({action:"probeEmsgID3",data:m,transmuxer:e.transmuxer,offset:a,callback:({emsgData:i,id3Frames:s})=>{t=i.buffer,e.bytes=m=i,r.video&&i.byteLength&&e.transmuxer?Od({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:e.transmuxer,data:m,timescales:e.map.timescales,trackIds:[r.video.id],callback:i=>{t=i.data.buffer,e.bytes=m=i.data,i.logs.forEach((function(e){c(pl(e,{stream:"mp4CaptionParser"}))})),l(i.captions,s)}}):l(void 0,s)}})}})}else e.transmuxer?(void 0===e.container&&(e.container=ll(m)),"ts"!==e.container&&"aac"!==e.container?(i(e,{hasAudio:!1,hasVideo:!1}),u(null,e,{})):(({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{var m=e.map&&e.map.tracks||{};let g=Boolean(m.audio&&m.video),f=s.bind(null,e,"audio","start"),y=s.bind(null,e,"audio","end"),_=s.bind(null,e,"video","start"),v=s.bind(null,e,"video","end");Od({action:"probeTs",transmuxer:e.transmuxer,data:t,baseStartTime:e.baseStartTime,callback:s=>{e.bytes=t=s.data,(s=s.result)&&(i(e,{hasAudio:s.hasAudio,hasVideo:s.hasVideo,isMuxed:g}),i=null),(e=>{e.transmuxer.currentTransmux?e.transmuxer.transmuxQueue.push(e):(e.transmuxer.currentTransmux=e,Cd(e))})({bytes:t,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,remux:g,onData:t=>{t.type="combined"===t.type?"video":t.type,h(e,t)},onTrackInfo:t=>{i&&(g&&(t.isMuxed=!0),i(e,t))},onAudioTimingInfo:e=>{f&&void 0!==e.start&&(f(e.start),f=null),y&&void 0!==e.end&&y(e.end)},onVideoTimingInfo:e=>{_&&void 0!==e.start&&(_(e.start),_=null),v&&void 0!==e.end&&v(e.end)},onVideoSegmentTimingInfo:t=>{var i={pts:{start:t.start.presentation,end:t.end.presentation},dts:{start:t.start.decode,end:t.end.decode}};p({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:i}),r(t)},onAudioSegmentTimingInfo:t=>{var i={pts:{start:t.start.pts,end:t.end.pts},dts:{start:t.start.dts,end:t.end.dts}};p({type:"segmenttransmuxingtiminginfoavailable",segment:e,timingInfo:i}),n(t)},onId3:(t,i)=>{a(e,t,i)},onCaptions:t=>{o(e,[t])},isEndOfTimeline:l,onEndedTimeline:()=>{d()},onTransmuxerLog:c,onDone:(t,i)=>{u&&(t.type="combined"===t.type?"video":t.type,p({type:"segmenttransmuxingcomplete",segment:e}),u(i,e,t))},segment:e,triggerSegmentEventFn:p})}})})({segment:e,bytes:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})):u(null,e,{})},jd=function({id:e,key:t,encryptedBytes:i,decryptionWorker:s,segment:r,doneFn:n},a){let o,l=t=>{t.data.source===e&&(s.removeEventListener("message",l),t=t.data.decrypted,a(new Uint8Array(t.bytes,t.byteOffset,t.byteLength)))};s.onerror=()=>{var e="An error occurred in the decryption worker",t=oh({segment:r});e={message:e,metadata:{error:new Error(e),errorType:jr.Error.StreamingFailedToDecryptSegment,segmentInfo:t,keyInfo:{uri:r.key.resolvedUri||r.map.key.resolvedUri}}},n(e,r)},s.addEventListener("message",l),o=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),s.postMessage(ud({source:e,encrypted:i,key:o,iv:t.iv}),[i.buffer,o.buffer])},Hd=cl("CodecUtils"),Vd=(e,t)=>(t=t.attributes||{},e&&e.mediaGroups&&e.mediaGroups.AUDIO&&t.AUDIO&&e.mediaGroups.AUDIO[t.AUDIO]),zd=function(e){let t={};return e.forEach((({mediaType:e,type:i,details:s})=>{t[e]=t[e]||[],t[e].push(dn(""+i+s))})),Object.keys(t).forEach((function(e){1{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}}))),u=(Gd(h,((e,t)=>e.bandwidth-t.bandwidth)),(h=h.filter((e=>!jl.isIncompatible(e.playlist)))).filter((e=>jl.isEnabled(e.playlist)))),c=(e=(u=u.length?u:h.filter((e=>!jl.isDisabled(e.playlist)))).filter((e=>e.bandwidth*vd.BANDWIDTH_VARIANCEe.bandwidth===c.bandwidth))[0];if(!1===r){let e=o||u[0]||h[0];if(e&&e.playlist){let t=o?"bandwidthBestRep":"sortedPlaylistReps";return u[0]&&(t="enabledPlaylistReps"),$d(`choosing ${Wd(e)} using ${t} with options`,a),e.playlist}}else{var l;let t,d;r=e.filter((e=>e.width&&e.height)),Gd(r,((e,t)=>e.width-t.width)),e=r.filter((e=>e.width===i&&e.height===s)),c=e[e.length-1],(e=e.filter((e=>e.bandwidth===c.bandwidth))[0])||(l=(t=r.filter((e=>e.width>i||se.width===t[0].width&&e.height===t[0].height)),c=l[l.length-1],d=l.filter((e=>e.bandwidth===c.bandwidth))[0]);let p,m=(n.leastPixelDiffSelector&&(l=r.map((e=>(e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-s),e))),Gd(l,((e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff)),p=l[0]),p||d||e||o||u[0]||h[0]);if(m&&m.playlist){let t="sortedPlaylistReps";return p?t="leastPixelDiffRep":d?t="resolutionPlusOneRep":e?t="resolutionBestRep":o?t="bandwidthBestRep":u[0]&&(t="enabledPlaylistReps"),$d(`choosing ${Wd(m)} using ${t} with options`,a),m.playlist}}return $d("could not choose a playlist with options",a),null}}function Kd(){let e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(e=this.customPixelRatio),Xd(this.playlists.main,this.systemBandwidth,parseInt(Pd(this.tech_.el(),"width"),10)*e,parseInt(Pd(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)}function Yd(e){try{return new URL(e).pathname.split("/").slice(-2).join("/")}catch(e){return""}}function Qd(e,t,i){let s;var r;if(i&&i.cues)for(s=i.cues.length;s--;)(r=i.cues[s]).startTime>=e&&r.endTime<=t&&i.removeCue(r)}let Jd={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},Zd=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),eh=(e,t,i)=>{e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,jr.browser.IS_ANY_SAFARI)||(e.metadataTrack_.inBandMetadataTrackDispatchType=t)},th=e=>"number"==typeof e&&isFinite(e),ih=e=>{var{startOfSegment:t,duration:i,segment:s,part:r,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:d,timeline:h}=e,o=o.length-1;let u="mediaIndex/partIndex increment";e.getMediaInfoForTime?u=`getMediaInfoForTime (${e.getMediaInfoForTime})`:e.isSyncRequest&&(u="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(u+=" with independent "+e.independent);var c="number"==typeof d,p=(e=e.segment.uri?"segment":"pre-segment",c?Al({preloadSegment:s})-1:0);return e+` [${n+l}/${n+o}]`+(c?` part [${d}/${p}]`:"")+` segment start/end [${s.start} => ${s.end}]`+(c?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${t}]`+` duration [${i}]`+` timeline [${h}]`+` selected by [${u}]`+` playlist [${a}]`},sh=e=>e+"TimingInfo",rh=({timelineChangeController:e,currentTimeline:t,segmentTimeline:i,loaderType:s,audioDisabled:r})=>!(t===i||("audio"===s?(t=e.lastTimelineChange({type:"main"}))&&t.to===i:"main"!==s||!r||(t=e.pendingTimelineChange({type:"audio"}))&&t.to===i)),nh=e=>{var t,i,s,r=e.pendingSegment_;r&&rh({timelineChangeController:e.timelineChangeController_,currentTimeline:e.currentTimeline_,segmentTimeline:r.timeline,loaderType:e.loaderType_,audioDisabled:e.audioDisabled_})&&(r=e.timelineChangeController_)&&(t=r.pendingTimelineChange({type:"audio"}),r=r.pendingTimelineChange({type:"main"}),s=(i=t&&r)&&t.to!==r.to,i)&&-1!==t.from&&-1!==r.from&&s&&(t=(i=e).timelineChangeController_.pendingTimelineChange({type:"audio"}),i=i.timelineChangeController_.pendingTimelineChange({type:"main"}),t&&i&&t.to!!e&&Math.round(e)>t+Tl,oh=({type:e,segment:t})=>{var i,s,r;if(t)return i=Boolean(t.key||t.map&&t.map.ke),s=Boolean(t.map&&!t.map.bytes),r=void 0===t.startOfSegment?t.start:t.startOfSegment,{type:e||t.type,uri:t.resolvedUri||t.uri,start:r,duration:t.duration,isEncrypted:i,isMediaInitialization:s}};class lh extends jr.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.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,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_=cl(`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_():nh(this)})),this.sourceUpdater_.on("codecschange",(e=>{this.trigger(Kt({type:"codecschange"},e))})),"main"===this.loaderType_&&this.timelineChangeController_.on("pendingtimelinechange",(()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():nh(this)})),"audio"===this.loaderType_&&this.timelineChangeController_.on("timelinechange",(e=>{this.trigger(Kt({type:"timelinechange"},e)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():nh(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():nh(this)}))}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return(e=>{let t=new Ed,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_&&xd(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return ml();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=dd(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;var i=hd(e);let s=this.keyCache_[i];return this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=s={resolvedUri:e.resolvedUri,bytes:e.bytes}),t={resolvedUri:(s||e).resolvedUri},s&&(t.bytes=s.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,s=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 n=null;if(s&&(s.id?n=s.id:s.uri&&(n=s.uri)),this.logger_(`playlist update [${n} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:\ncurrentTime: ${this.currentTime_()}\nbufferedEnd: ${yl(this.buffered_())}\n`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();s&&s.uri===e.uri?(t=e.mediaSequence-s.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(s,e)):(null!==this.mediaIndex&&(e.endList||"number"!=typeof e.partTargetDuration?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.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&xd(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;var e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;"hls"!==this.sourceType_||e||(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=(()=>{}),s=!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 a=1;var r,n=()=>{0==--a&&i()};for(r in!s&&this.audioDisabled_||(a++,this.sourceUpdater_.removeAudio(e,t,n)),!s&&"main"!==this.loaderType_||(this.gopBuffer_=((e,t,i,s)=>{var r=Math.ceil((t-s)*dl),n=Math.ceil((i-s)*dl);t=e.slice();let a=e.length;for(;a--&&!(e[a].pts<=n););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_),a++,this.sourceUpdater_.removeVideo(e,t,n)),this.inbandTextTracks_)Qd(e,t,this.inbandTextTracks_[r]);Qd(e,t,this.segmentMetadataTrack_),n()}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,t;this.sourceUpdater_.updating()||(e=this.chooseNextRequest_())&&(t={segmentInfo:oh({type:this.loaderType_,segment:e})},this.trigger({type:"segmentselected",metadata:t}),"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 s;return!(!t||!this.mediaSource_)&&(s="number"==typeof e&&t.segments[e],e=e+1===t.segments.length,i=!s||!s.parts||i+1===s.parts.length,t.endList)&&"open"===this.mediaSource_.readyState&&e&&i}chooseNextRequest_(){var e=yl(t=this.buffered_())||0,t=_l(t,this.currentTime_()),i=!this.hasPlayed_()&&1<=t,s=t>=this.goalBufferLength_(),r=this.playlist_.segments;if(!r.length||i||s)return null;if(this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_),(i={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)}).isSyncRequest)i.mediaIndex=function(e,t,i){t=t||[];var s=[];let r=0;for(let a=0;ai))return a}return 0===s.length?0:s[s.length-1]}(this.currentTimeline_,r,e),this.logger_("choose next request. Can not find sync point. Fallback to media Index: "+i.mediaIndex);else if(null!==this.mediaIndex){s=r[this.mediaIndex];var n="number"==typeof this.partIndex?this.partIndex:-1;i.startOfSegment=s.end||e,s.parts&&s.parts[n+1]?(i.mediaIndex=this.mediaIndex,i.partIndex=n+1):i.mediaIndex=this.mediaIndex+1}else{let t,r,a;if(s=this.fetchAtBuffer_?e:this.currentTime_(),this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:\nFor TargetTime: ${s}.\nCurrentTime: ${this.currentTime_()}\nBufferedEnd: ${e}\nFetch At Buffer: ${this.fetchAtBuffer_}\n`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){if(!(n=this.getSyncInfoFromMediaSequenceSync_(s)))return this.error({message:e="No sync info found while using media sequence sync",metadata:{errorType:jr.Error.StreamingFailedToSelectNextSegment,error:new Error(e)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null;this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${n.start} --\x3e ${n.end})`),t=n.segmentIndex,r=n.partIndex,a=n.start}else this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint."),t=(e=jl.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:s,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time})).segmentIndex,r=e.partIndex,a=e.startTime;i.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+s:"currentTime "+s,i.mediaIndex=t,i.startOfSegment=a,i.partIndex=r,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${i.mediaIndex} `)}let a=(n=r[i.mediaIndex])&&"number"==typeof i.partIndex&&n.parts&&n.parts[i.partIndex];return!n||"number"==typeof i.partIndex&&!a?null:("number"!=typeof i.partIndex&&n.parts&&(i.partIndex=0,a=n.parts[0]),e=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments,t||!a||e||a.independent||(0===i.partIndex?(t=(s=r[i.mediaIndex-1]).parts&&s.parts.length&&s.parts[s.parts.length-1])&&t.independent&&(--i.mediaIndex,i.partIndex=s.parts.length-1,i.independent="previous segment"):n.parts[i.partIndex-1].independent&&(--i.partIndex,i.independent="previous part")),e=this.mediaSource_&&"ended"===this.mediaSource_.readyState,i.mediaIndex>=r.length-1&&e&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,i.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(i)))}getSyncInfoFromMediaSequenceSync_(e){var t;return this.mediaSequenceSync_&&(e!==(t=Math.max(e,this.mediaSequenceSync_.start))&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to `+t),e=this.mediaSequenceSync_.getSyncInfoForTime(t))?e.isAppended?(t=this.mediaSequenceSync_.getSyncInfoForTime(e.end))?(t.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),t):null:e:null}generateSegmentInfo_(e){var t,{independent:e,playlist:i,mediaIndex:s,startOfSegment:r,isSyncRequest:t,partIndex:n,forceTimestampOffset:a,getMediaInfoForTime:o}=e,l=i.segments[s],d="number"==typeof n&&l.parts[n],s={requestId:"segment-loader-"+Math.random(),uri:d&&d.resolvedUri||l.resolvedUri,mediaIndex:s,partIndex:d?n:null,isSyncRequest:t,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:d&&d.duration||l.duration,segment:l,part:d,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:o,independent:e},n=void 0!==a?a:this.isPendingTimestampOffset_;return"number"==(s.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:n}),typeof(t=yl(this.sourceUpdater_.audioBuffered())))&&(s.audioAppendStart=t-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(s.gopsToAlignWith=((e,t,i)=>{if(null==t||!e.length)return[];var s=Math.ceil((t-i+3)*dl);let r;for(r=0;rs);r++);return e.slice(r)})(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),s}timestampOffsetForSegment_(e){return({segmentTimeline:e,currentTimeline:t,startOfSegment:i,buffered:s,overrideCheck:r}=[e][0]),r||e!==t?e!jl.isIncompatible(e)))).filter(jl.isEnabled);var h=(e=(d=d.length?d:e.filter((e=>!jl.isDisabled(e)))).filter(jl.hasAttribute.bind(null,"BANDWIDTH")).map((e=>{var t=l.getSyncPoint(e,r,o,i)?1:2;return{playlist:e,rebufferingImpact:jl.estimateSegmentRequestTime(n,s,e)*t-a}}))).filter((e=>e.rebufferingImpact<=0));return Gd(h,((e,t)=>Ld(t.playlist,e.playlist))),h.length?h[0]:(Gd(e,((e,t)=>e.rebufferingImpact-t.rebufferingImpact)),e[0]||null)}({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:r,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(n){var a=e-r-n.rebufferingImpact;let t=.5;r<=Tl&&(t=1),!n.playlist||n.playlist.uri===this.playlist_.uri||a{i[t.stream]=i[t.stream]||{startTime:1/0,captions:[],endTime:0};var s=i[t.stream];s.startTime=Math.min(s.startTime,t.startTime+e),s.endTime=Math.max(s.endTime,t.endTime+e),s.captions.push(t)})),Object.keys(i).forEach((t=>{var{startTime:s,endTime:r,captions:n}=i[t],a=this.inbandTextTracks_;this.logger_(`adding cues from ${s} -> ${r} for `+t),function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"});let r=i;/^cc708_/.test(i)&&(r="SERVICE"+i.split("_")[1]);var s=t.textTracks().getTrackById(r);if(s)e[i]=s;else{let n=i,a=i,o=!1;(s=(t.options_.vhs&&t.options_.vhs.captionServices||{})[r])&&(n=s.label,a=s.language,o=s.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:r,default:o,label:n,language:a},!1).track}}}(a,this.vhs_.tech_,t),Qd(s,r,a[t]),function({inbandTextTracks:e,captionArray:t,timestampOffset:i}){if(t){let s=window.WebKitDataCue||window.VTTCue;t.forEach((t=>{let r=t.stream;t.content?t.content.forEach((n=>{var a=new s(t.startTime+i,t.endTime+i,n.text);a.line=n.line,a.align="left",a.position=n.position,a.positionAlign="line-left",e[r].addCue(a)})):e[r].addCue(new s(t.startTime+i,t.endTime+i,t.text))}))}}({captionArray:n,inbandTextTracks:a,timestampOffset:e})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t))}handleId3_(e,t,i){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(i,t,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_()&&rh({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,s;return!!this.sourceUpdater_.ready()&&!(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_||(e=this.pendingSegment_,t=this.getCurrentMediaInfo_(),!e)||!t||(({hasAudio:t,hasVideo:i,isMuxed:s}=t),i&&!e.videoTimingInfo)||t&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||rh({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_())nh(this),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[sh(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:s}){if(i){var r=dd(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},s){var r=this.sourceUpdater_.audioBuffered(),n=this.sourceUpdater_.videoBuffered(),a=(1{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},s){s&&(22===s.code?this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i}):(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist `+e.playlist.id,metadata:{errorType:jr.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")))}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:r}){if(!r){var n=[s];let e=s.byteLength;i&&(n.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:n})}s={segmentInfo:oh({type:this.loaderType_,segment:e})},this.trigger({type:"segmentappendstart",metadata: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:s}=t;s&&s.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:s})))}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):(nh(this),this.loadQueue_.push((()=>{var t=Kt({},e,{forceTimestampOffset:!0});Kt(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),s=null!==this.mediaIndex,r=e.timeline!==this.currentTimeline_&&0{let _=[];var v,b,T,S,w,E,C,k,I;i=(({activeXhrs:e,decryptionWorker:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{let m=0,g=!1;return(f,y)=>{if(!g){if(f)return g=!0,Md(e),u(f,y);if((m+=1)===e.length){let m=function(){if(y.encryptedBytes)return(({decryptionWorker:e,segment:t,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})=>{p({type:"segmentdecryptionstart"}),jd({id:t.requestId,key:t.key,encryptedBytes:t.encryptedBytes,decryptionWorker:e,segment:t,doneFn:u},(e=>{t.bytes=e,p({type:"segmentdecryptioncomplete",segment:t}),qd({segment:t,bytes:t.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})}))})({decryptionWorker:t,segment:y,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p});qd({segment:y,bytes:y.bytes,trackInfoFn:i,timingInfoFn:s,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:d,dataFn:h,doneFn:u,onTransmuxerLog:c,triggerSegmentEventFn:p})};if(y.endOfAllRequests=Date.now(),y.map&&y.map.encryptedBytes&&!y.map.bytes)return p({type:"segmentdecryptionstart",segment:y}),jd({decryptionWorker:t,id:y.requestId+"-init",encryptedBytes:y.map.encryptedBytes,key:y.map.key,segment:y,doneFn:u},(t=>{y.map.bytes=t,p({type:"segmentdecryptioncomplete",segment:y}),Fd(y,(t=>{if(t)return Md(e),u(t,y);m()}))}));m()}}}})({activeXhrs:_,decryptionWorker:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:d,id3Fn:h,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:p,dataFn:m,doneFn:g,onTransmuxerLog:f,triggerSegmentEventFn:y}),s.key&&!s.key.bytes&&(a=[s.key],s.map&&!s.map.bytes&&s.map.key&&s.map.key.resolvedUri===s.key.resolvedUri&&a.push(s.map.key),o=pl(t,{uri:s.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),l=Bd(s,a,i,y),y({type:"segmentkeyloadstart",segment:s,keyInfo:{uri:s.key.resolvedUri}}),d=e(o,l),_.push(d)),s.map&&!s.map.bytes&&(!s.map.key||s.key&&s.key.resolvedUri===s.map.key.resolvedUri||(h=pl(t,{uri:s.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),u=Bd(s,[s.map.key],i,y),y({type:"segmentkeyloadstart",segment:s,keyInfo:{uri:s.map.key.resolvedUri}}),c=e(h,u),_.push(c)),p=pl(t,{uri:s.map.resolvedUri,responseType:"arraybuffer",headers:ad(s.map),requestType:"segment-media-initialization"}),({segment:v,finishProcessingFn:b,triggerSegmentEventFn:T}={segment:s,finishProcessingFn:i,triggerSegmentEventFn:y}),m=(e,t)=>(e=Ud(e,t))?b(e,v):(e=new Uint8Array(t.response),T({type:"segmentloaded",segment:v}),v.map.key?(v.map.encryptedBytes=e,b(null,v)):(v.map.bytes=e,void Fd(v,(function(e){if(e)return e.xhr=t,e.status=t.status,b(e,v);b(null,v)})))),y({type:"segmentloadstart",segment:s}),g=e(p,m),_.push(g)),f=pl(t,{uri:s.part&&s.part.resolvedUri||s.resolvedUri,responseType:"arraybuffer",headers:ad(s),requestType:"segment"}),({segment:S,finishProcessingFn:w,responseType:E,triggerSegmentEventFn:C}={segment:s,finishProcessingFn:i,responseType:f.responseType,triggerSegmentEventFn:y}),a=(e,t)=>(e=Ud(e,t))?w(e,S):(C({type:"segmentloaded",segment:S}),e="arraybuffer"!==E&&t.responseText?(e=>{var t=new Uint8Array(new ArrayBuffer(e.length));for(let i=0;i({bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}))(t),S.key?S.encryptedBytes=new Uint8Array(e):S.bytes=new Uint8Array(e),w(null,S)),(y({type:"segmentloadstart",segment:s}),o=e(f,a)).addEventListener("progress",(({segment:k,progressFn:I}={segment:s,progressFn:n}),e=>{if(!e.target.aborted)return k.stats=pl(k.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)),!k.stats.firstBytesReceivedAt&&k.stats.bytesReceived&&(k.stats.firstBytesReceivedAt=Date.now()),I(e,k)})),_.push(o);let x={};return _.forEach((e=>{var t,i;e.addEventListener("loadend",(({loadendState:t,abortFn:i}={loadendState:x,abortFn:r}),e=>{e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}))})),()=>Md(_)})({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:s})=>{this.logger_(ih(e)+` logged from transmuxer stream ${s} as a ${i}: `+t)},triggerSegmentEventFn:({type:e,segment:t,keyInfo:i,trackInfo:s,timingInfo:r})=>{t={segmentInfo:oh({segment:t})},i&&(t.keyInfo=i),s&&(t.trackInfo=s),r&&(t.timingInfo=r),this.trigger({type:e,metadata:t})}})}trimBackBuffer_(e){var t=((e,t,i)=>{let s=t-vd.BACK_BUFFER_LENGTH;return e.length&&(s=Math.max(s,e.start(0))),Math.min(t-i,s)})(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);0{if(!t.length)return e;if(i)return t.slice();var s=t[0].pts;let r=0;for(;r=s);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:s,currentVideoTimestampOffset:r,useVideoTimingInfo:n,videoTimingInfo:a,audioTimingInfo:o}){return void 0!==e?e:n?(e=t.segments[i-1],0!==i&&e&&void 0!==e.start&&e.end===s+r?a.start:s):o.start}waitForAppendsToComplete_(e){var t,i,s=this.getCurrentMediaInfo_(e);s?(({hasAudio:s,hasVideo:i,isMuxed:t}=s),i="main"===this.loaderType_&&i,s=!this.audioDisabled_&&s&&!t,e.waitingOnAppends=0,e.hasAppendedData_?(i&&e.waitingOnAppends++,s&&e.waitingOnAppends++,i&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&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_(),e=e;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_&&(e={segmentInfo:oh({type:this.loaderType_,segment:this.pendingSegment_})},this.trigger({type:"appendsdone",metadata:e})),this.pendingSegment_?((e=this.pendingSegment_).part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_}),(t=((e,t)=>{var i,s,r;return"hls"===t&&(t=(e=>{let t=0;return["video","audio"].forEach((function(i){if(i=e[i+"TimingInfo"]){var{start:i,end:s}=i;let e;"bigint"==typeof i||"bigint"==typeof s?e=window.BigInt(s)-window.BigInt(i):"number"==typeof i&&"number"==typeof s&&(e=s-i),void 0!==e&&e>t&&(t=e)}})),t="bigint"==typeof t&&t3*e.playlist.targetDuration,i=i&&i.end&&this.currentTime_()-i.end>3*e.playlist.partTargetDuration,t||i?(this.logger_(`bad ${t?"segment":"part"} `+ih(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,s,r;this.segmentMetadataTrack_&&(t=(r=e.segment).start,i=r.end,th(t))&&th(i)&&(Qd(t,i,this.segmentMetadataTrack_),s=window.WebKitDataCue||window.VTTCue,r={custom:r.custom,dateTimeObject:r.dateTimeObject,dateTimeString:r.dateTimeString,programDateTime:r.programDateTime,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 s(t,i,JSON.stringify(r))).value=r,this.segmentMetadataTrack_.addCue(e))}}function dh(){}function hh(e){return"string"!=typeof e?e:e.replace(/./,(e=>e.toUpperCase()))}let uh=["video","audio"],ch=(e,t)=>{var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},ph=(e,t)=>{if(0!==t.queue.length){let i=0,s=t.queue[i];if("mediaSource"===s.type)t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),s.action(t),s.doneFn&&s.doneFn(),ph("audio",t),ph("video",t));else if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!ch(e,t)){if(s.type!==e){if(null===(i=((e,t)=>{for(let s=0;s{var i=t[e+"Buffer"],s=hh(e);i&&(i.removeEventListener("updateend",t[`on${s}UpdateEnd_`]),i.removeEventListener("error",t[`on${s}Error_`]),t.codecs[e]=null,t[e+"Buffer"]=null)},gh=(e,t)=>e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t),fh=(e,t,i)=>(s,r)=>{var n=r[s+"Buffer"];if(gh(r.mediaSource,n)){r.logger_(`Appending segment ${t.mediaIndex}'s ${e.length} bytes to ${s}Buffer`);try{n.appendBuffer(e)}catch(n){r.logger_(`Error with code ${n.code} `+(22===n.code?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${t.mediaIndex} to ${s}Buffer`),r.queuePending[s]=null,i(n)}}},yh=(e,t)=>(i,s)=>{var r=s[i+"Buffer"];if(gh(s.mediaSource,r)){s.logger_(`Removing ${e} to ${t} from ${i}Buffer`);try{r.remove(e,t)}catch(r){s.logger_(`Remove ${e} to ${t} from ${i}Buffer failed`)}}},_h=e=>(t,i)=>{var s=i[t+"Buffer"];gh(i.mediaSource,s)&&(i.logger_(`Setting ${t}timestampOffset to `+e),s.timestampOffset=e)},vh=e=>(t,i)=>{e()},bh=e=>t=>{if("open"===t.mediaSource.readyState){t.logger_(`Calling mediaSource endOfStream(${e||""})`);try{t.mediaSource.endOfStream(e)}catch(t){jr.log.warn("Failed to call media source endOfStream",t)}}},Th=e=>t=>{t.logger_("Setting mediaSource duration to "+e);try{t.mediaSource.duration=e}catch(t){jr.log.warn("Failed to set media source duration",t)}},Sh=(e,t)=>i=>{var s=hh(e),r=un(t);(i.logger_(`Adding ${e}Buffer with codec ${t} to mediaSource`),r=i.mediaSource.addSourceBuffer(r)).addEventListener("updateend",i[`on${s}UpdateEnd_`]),r.addEventListener("error",i[`on${s}Error_`]),i.codecs[e]=t,i[e+"Buffer"]=r},wh=e=>t=>{var i=t[e+"Buffer"];if(mh(e,t),gh(t.mediaSource,i)){t.logger_(`Removing ${e}Buffer with codec ${t.codecs[e]} from mediaSource`);try{t.mediaSource.removeSourceBuffer(i)}catch(t){jr.log.warn(`Failed to removeSourceBuffer ${e}Buffer`,t)}}},Eh=e=>(t,i)=>{var s=i[t+"Buffer"],r=un(e);if(gh(i.mediaSource,s)){var n=e.substring(0,e.indexOf(".")),a=i.codecs[t],o=a.substring(0,a.indexOf("."));if(o!==n){o={codecsChangeInfo:{from:a,to:e}},i.trigger({type:"codecschange",metadata:o}),i.logger_(`changing ${t}Buffer codec from ${a} to `+e);try{s.changeType(r),i.codecs[t]=e}catch(s){o.errorType=jr.Error.StreamingCodecsChangeError,(o.error=s).metadata=o,i.error_=s,i.trigger("error"),jr.log.warn(`Failed to changeType on ${t}Buffer`,s)}}}},Ch=({type:e,sourceUpdater:t,action:i,doneFn:s,name:r})=>{t.queue.push({type:e,action:i,doneFn:s,name:r}),ph(e,t)},kh=(e,t)=>i=>{var s=function(e){if(0===e.length)return"Buffered Ranges are empty";let t="Buffered Ranges: \n";for(let r=0;rph("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=cl("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=kh("video",this),this.onAudioUpdateEnd_=kh("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){Ch({type:"mediaSource",sourceUpdater:this,action:Sh(e,t),name:"addSourceBuffer"})}abort(e){Ch({type:e,sourceUpdater:this,action:(e,t)=>{if("open"===t.mediaSource.readyState){var i=t[e+"Buffer"];if(gh(t.mediaSource,i)){t.logger_(`calling abort on ${e}Buffer`);try{i.abort()}catch(t){jr.log.warn(`Failed to abort on ${e}Buffer`,t)}}}},name:"abort"})}removeSourceBuffer(e){this.canRemoveSourceBuffer()?Ch({type:"mediaSource",sourceUpdater:this,action:wh(e),name:"removeSourceBuffer"}):jr.log.error("removeSourceBuffer is not supported!")}canRemoveSourceBuffer(){return!jr.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()?Ch({type:e,sourceUpdater:this,action:Eh(t),name:"changeType"}):jr.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:s,bytes:r}=e;this.processedAppend_=!0,"audio"===s&&this.videoBuffer&&!this.videoAppendQueued_?(this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`)):(Ch({type:s,sourceUpdater:this,action:fh(r,i||{mediaIndex:-1},e=t),doneFn:t,name:"appendBuffer"}),"video"===s&&(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 gh(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered||ml()}videoBuffered(){return gh(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered||ml()}buffered(){var e=gh(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=gh(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){let i=null,s=null,r=0;var n=[],a=[];if(!(e&&e.length&&t&&t.length))return ml();let o=e.length;for(;o--;)n.push({time:e.start(o),type:"start"}),n.push({time:e.end(o),type:"end"});for(o=t.length;o--;)n.push({time:t.start(o),type:"start"}),n.push({time:t.end(o),type:"end"});for(n.sort((function(e,t){return e.time-t.time})),o=0;o{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[e+"QueueCallback"]((()=>mh(e,this)))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}let xh=e=>decodeURIComponent(escape(String.fromCharCode.apply(null,e))),Ah=new Uint8Array("\n\n".split("").map((e=>e.charCodeAt(0))));class Dh extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Ph extends lh{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,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?ml([[(e=this.subtitlesTrack_.cues)[0].startTime,e[e.length-1].startTime]]):ml()}initSegmentForMap(e,t=!1){if(!e)return null;var i=dd(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(t=Ah.byteLength+e.bytes.byteLength,(t=new Uint8Array(t)).set(e.bytes),t.set(Ah,e.bytes.byteLength),this.initSegments_[i]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}),s||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){Qd(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===Rd&&this.handleTimeout_(),e.code===Nd?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);else{var s=this.pendingSegment_,r=(this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending"),s.segment);if(r.map&&(r.map.bytes=t.map.bytes),s.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_(s)}catch(e){return void this.stopForError({message:e.message,metadata:{errorType:jr.Error.StreamingVttParserError,error:e}})}this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest?(this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY"):(s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=r.duration,s.cues.forEach((e=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new window.VTTCue(e.startTime,e.endTime,e.text):e)})),function(e){var t=e.cues;if(t){var i={};for(let n=t.length-1;0<=n;n--){var s=t[n],r=s.startTime+`-${s.endTime}-`+s.text;i[r]?e.removeCue(s):i[r]=s}}}(this.subtitlesTrack_),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 Dh;"function"==typeof window.TextDecoder?t=new window.TextDecoder("utf8"):(t=window.WebVTT.StringDecoder(),i=!0);var s=new window.WebVTT.Parser(window,window.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=t=>{e.timestampmap=t},s.onparsingerror=e=>{jr.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){let t=e.segment.map.bytes;i&&(t=xh(t)),s.parse(t)}let r=e.bytes;i&&(r=xh(r)),s.parse(r),s.flush()}updateTimeMapping_(e,t,i){var s=e.segment;if(t)if(e.cues.length){var{MPEGTS:r,LOCAL:n}=e.timestampmap;let a=r/dl-n+t.mapping;e.cues.forEach((e=>{var i=e.endTime-e.startTime,s=this.handleRollover_(e.startTime+a,t.time);e.startTime=Math.max(s,0),e.endTime=Math.max(s+i,0)})),i.syncInfo||(r=e.cues[0].startTime,n=e.cues[e.cues.length-1].startTime,i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(r,n-s.duration)})}else s.empty=!0}handleRollover_(e,t){if(null===t)return e;let i=e*dl;var s=t*dl;let r;for(r=s=this.start&&ee.resetAppendedStatus()))}}class Rh{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach((e=>e.resetAppendStatus()))}update(e,t){var{mediaSequence:e,segments:i}=e;if(this.isReliable_=this.isReliablePlaylist_(e,i),this.isReliable_)return this.updateStorage_(i,e,this.calculateBaseTime_(e,t))}getSyncInfoForTime(e){for(var{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(var s of i)if(s.isInRange(e))return s}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){let s=new Map,r="\n",n=i,a=t;this.start_=n,e.forEach(((e,t)=>{let i=this.storage_.get(a);var o=n,l=o+e.duration,d=Boolean(i&&i.segmentSyncInfo&&i.segmentSyncInfo.isAppended),h=new Lh({start:o,end:l,appended:d,segmentIndex:t});e.syncInfo=h;let u=n;var c=(e.parts||[]).map(((e,s)=>{var n=u,o=u+e.duration,l=Boolean(i&&i.partsSyncInfo&&i.partsSyncInfo[s]&&i.partsSyncInfo[s].isAppended),d=new Lh({start:n,end:o,appended:l,segmentIndex:t,partIndex:s});return u=o,r+=`Media Sequence: ${a}.${s} | Range: ${n} --\x3e ${o} | Appended: ${l}\n`,e.syncInfo=d}));s.set(a,new Oh(h,c)),r+=`${Yd(e.resolvedUri)} | Media Sequence: ${a} | Range: ${o} --\x3e ${l} | Appended: ${d}\n`,a++,n=l})),this.end_=n,this.storage_=s,this.diagnostics_=r}calculateBaseTime_(e,t){return this.storage_.size?this.storage_.has(e)?this.storage_.get(e).segmentSyncInfo.start:t:0}isReliablePlaylist_(e,t){return null!=e&&Array.isArray(t)&&t.length}}class Nh extends Rh{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t){return this.storage_.size?super.calculateBaseTime_(e,t):(t=this.parent_.getSyncInfoForMediaSequence(e))?t.segmentSyncInfo.start:0}}let Mh=[{name:"VOD",run:(e,t,i,s,r)=>i!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(e,t,i,s,r,n)=>(e=e.getMediaSequenceSync(n))&&e.isReliable&&(n=e.getSyncInfoForTime(r))?{time:n.start,partIndex:n.partIndex,segmentIndex:n.segmentIndex}:null},{name:"ProgramDateTime",run:(e,t,i,s,r)=>{if(!Object.keys(e.timelineToDatetimeMappings).length)return null;let n=null,a=null;var o=Il(t);r=r||0;for(let i=0;i{let n=null,a=null;r=r||0;var o=Il(t);for(let e=0;e=d)&&(a=d,n={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return n}},{name:"Discontinuity",run:(e,t,i,s,r)=>{let n=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length){let i=null;for(let s=0;s=l)&&(i=l,n={time:o.time,segmentIndex:a,partIndex:null})}}}return n}},{name:"Playlist",run:(e,t,i,s,r)=>t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}];class Uh extends jr.EventTarget{constructor(e=0){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};var t=new Rh,i=new Nh(t),s=new Nh(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:s},this.logger_=cl("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,s,r){if(t!==1/0)return Mh.find((({name:e})=>"VOD"===e)).run(this,e,t);var n;if(!(t=this.runStrategies_(e,t,i,s,r)).length)return null;for(n of t){var{syncPoint:a,strategy:o}=n,{segmentIndex:l,time:d}=a;if(!(l<0)){var h=d+e.segments[l].duration;if(this.logger_(`Strategy: ${o}. Current time: ${s}. selected segment: ${l}. Time: [${d} -> ${h}]}`),d<=s&&sa){let o;o=n<0?i.start-vl({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:s}):i.end+vl({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[r]={time:o,accuracy:a}}}}dispose(){this.trigger("dispose"),this.off()}}class Bh extends jr.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({type:"timelinechange",metadata:{timelineChangeInfo:{from:t,to:i}}})),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}var Fh=Td(Sd(wd((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>7))^n]=n;for(a=o=0;!s[a];a^=l||1,o=c[o]||1)for(h=(h=o^o<<1^o<<2^o<<3^o<<4)>>8^255&h^99,m=16843009*u[d=u[l=u[r[s[a]=h]=a]]]^65537*d^257*l^16843008*a,p=257*u[h]^16843008*h,n=0;n<4;n++)t[n][a]=p=p<<24^p>>>8,i[n][h]=m=m<<24^m>>>8;for(n=0;n<5;n++)t[n]=t[n].slice(0),i[n]=i[n].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 n=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 d=e.slice(0),h=[];for(this._key=[d,h],i=o;i<4*o+28;i++)r=d[i-1],(i%o==0||8===o&&i%o==4)&&(r=n[r>>>24]<<24^n[r>>16&255]<<16^n[r>>8&255]<<8^n[255&r],i%o==0)&&(r=r<<8^r>>>24^l<<24,l=l<<1^283*(l>>7)),d[i]=d[i-o]^r;for(s=0;i;s++,i--)r=d[3&s?i:i-4],h[s]=i<=4||s<4?r:a[0][n[r>>>24]]^a[1][n[r>>16&255]]^a[2][n[r>>8&255]]^a[3][n[255&r]]}decrypt(e,t,i,s,r,n){var a,o,l=this._key[1];let d,h=e^l[0],u=s^l[1],c=i^l[2],p=t^l[3];var m=l.length/4-2;let g,f=4;var y=(e=this._tables[1])[0],_=e[1],v=e[2],b=e[3],T=e[4];for(g=0;g>>24]^_[u>>16&255]^v[c>>8&255]^b[255&p]^l[f],a=y[u>>>24]^_[c>>16&255]^v[p>>8&255]^b[255&h]^l[f+1],o=y[c>>>24]^_[p>>16&255]^v[h>>8&255]^b[255&u]^l[f+2],p=y[p>>>24]^_[h>>16&255]^v[u>>8&255]^b[255&c]^l[f+3],f+=4,h=d,u=a,c=o;for(g=0;g<4;g++)r[(3&-g)+n]=T[h>>>24]<<24^T[u>>16&255]<<16^T[c>>8&255]<<8^T[255&p]^l[f++],d=h,h=u,u=c,c=p,p=d}}class s 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 n{constructor(e,t,i,a){var o=n.STEP,l=new Int32Array(e.buffer);let d=new Uint8Array(e.byteLength),h=0;for(this.asyncStream_=new s,this.asyncStream_.push(this.decryptChunk_(l.subarray(h,h+o),t,i,d)),h=o;h>2),h=new i(Array.prototype.slice.call(t)),u=(t=new Uint8Array(e.byteLength),new Int32Array(t.buffer));let c,p,m,g,f;for(c=s[0],p=s[1],m=s[2],g=s[3],f=0;f{var s,r=e[i];s=r,("function"===ArrayBuffer.isView?ArrayBuffer.isView(s):s&&s.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])}))}}))));let qh=(e,t)=>{e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},jh=(e,t)=>{(t.activePlaylistLoader=e).load()},Hh={AUDIO:(e,t)=>()=>{var{mediaTypes:{[e]:i},excludePlaylist:s}=t,r=i.activeTrack(),n=((n=i.activeGroup()).filter((e=>e.default))[0]||n[0]).id,a=i.tracks[n];if(r===a)s({error:{message:"Problem encountered loading the default audio track."}});else{for(var o in jr.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),i.tracks)i.tracks[o].enabled=i.tracks[o]===a;i.onTrackChanged()}},SUBTITLES:(e,t)=>()=>{var{[e]:i}=t.mediaTypes,s=(jr.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),i.activeTrack());s&&(s.mode="disabled"),i.onTrackChanged()}},Vh={AUDIO:(e,t,i)=>{if(!t)return;let{tech:s,requestOptions:r,segmentLoaders:{[e]:n}}=i;t.on("loadedmetadata",(()=>{var e=t.media();n.playlist(e,r),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()})),t.on("loadedplaylist",(()=>{n.playlist(t.media(),r),s.paused()||n.load()})),t.on("error",Hh[e](e,i))},SUBTITLES:(e,t,i)=>{let{tech:s,requestOptions:r,segmentLoaders:{[e]:n},mediaTypes:{[e]:a}}=i;t.on("loadedmetadata",(()=>{var e=t.media();n.playlist(e,r),n.track(a.activeTrack()),(!s.paused()||e.endList&&"none"!==s.preload())&&n.load()})),t.on("loadedplaylist",(()=>{n.playlist(t.media(),r),s.paused()||n.load()})),t.on("error",Hh[e](e,i))}},zh={AUDIO:(e,t)=>{var i,s,{vhs:r,sourceType:n,segmentLoaders:{[e]:a},requestOptions:o,main:{mediaGroups:l},mediaTypes:{[e]:{groups:d,tracks:h,logger_:u}},mainPlaylistLoader:c}=t,p=ql(c.main);for(i in l[e]&&0!==Object.keys(l[e]).length||(l[e]={main:{default:{default:!0}}},p&&(l[e].main.default.playlists=c.main.playlists)),l[e])for(var m in d[i]||(d[i]=[]),l[e][i]){let a,g=l[e][i][m];a=p?(u(`AUDIO group '${i}' label '${m}' is a main playlist`),g.isMainPlaylist=!0,null):"vhs-json"===n&&g.playlists?new sd(g.playlists[0],r,o):g.resolvedUri?new sd(g.resolvedUri,r,o):g.playlists&&"dash"===n?new _d(g.playlists[0],r,o,c):null,g=pl({id:m,playlistLoader:a},g),Vh[e](e,g.playlistLoader,t),d[i].push(g),void 0===h[m]&&(s=new jr.AudioTrack({id:m,kind:(e=>{let t=e.default?"main":"alternative";return e.characteristics&&0<=e.characteristics.indexOf("public.accessibility.describes-video")?"main-desc":t})(g),enabled:!1,language:g.language,default:g.default,label:m}),h[m]=s)}a.on("error",Hh[e](e,t))},SUBTITLES:(e,t)=>{var i,s,{tech:r,vhs:n,sourceType:a,segmentLoaders:{[e]:o},requestOptions:l,main:{mediaGroups:d},mediaTypes:{[e]:{groups:h,tracks:u}},mainPlaylistLoader:c}=t;for(i in d[e])for(var p in h[i]||(h[i]=[]),d[e][i])if(n.options_.useForcedSubtitles||!d[e][i][p].forced){let o,m=d[e][i][p];if("hls"===a)o=new sd(m.resolvedUri,n,l);else if("dash"===a){if(!m.playlists.filter((e=>e.excludeUntil!==1/0)).length)return;o=new _d(m.playlists[0],n,l,c)}else"vhs-json"===a&&(o=new sd(m.playlists?m.playlists[0]:m.resolvedUri,n,l));m=pl({id:p,playlistLoader:o},m),Vh[e](e,m.playlistLoader,t),h[i].push(m),void 0===u[p]&&(s=r.addRemoteTextTrack({id:p,kind:"subtitles",default:m.default&&m.autoselect,language:m.language,label:p},!1).track,u[p]=s)}o.on("error",Hh[e](e,t))},"CLOSED-CAPTIONS":(e,t)=>{var i,{tech:s,main:{mediaGroups:r},mediaTypes:{[e]:{groups:n,tracks:a}}}=t;for(i in r[e])for(var o in n[i]||(n[i]=[]),r[e][i]){var l=r[e][i][o];if(/^(?:CC|SERVICE)/.test(l.instreamId)){var d=s.options_.vhs&&s.options_.vhs.captionServices||{};let e={label:o,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};void 0===(e=d[e.instreamId]?pl(e,d[e.instreamId]):e).default&&delete e.default,n[i].push(pl({id:o},l)),void 0===a[o]&&(d=s.addRemoteTextTrack({id:e.instreamId,kind:"captions",default:e.default,language:e.language,label:e.label},!1).track,a[o]=d)}}}},$h=(e,t)=>{for(let i=0;i()=>{var i,{[e]:{tracks:s}}=t.mediaTypes;for(i in s)if(s[i].enabled)return s[i];return null},SUBTITLES:(e,t)=>()=>{var i,{[e]:{tracks:s}}=t.mediaTypes;for(i in s)if("showing"===s[i].mode||"hidden"===s[i].mode)return s[i];return null}};class Gh{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){1===e&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=hl(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map((e=>[e.ID,e]))))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class Xh extends jr.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Gh,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=cl("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";var i=t.serverUri||t.serverURL;i?i.startsWith("data:")?this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1)):(this.steeringManifest.reloadUri=hl(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")):(this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error"))}requestSteeringManifest(e){var t=this.steeringManifest.reloadUri;if(t){let i=e?t:this.getRequestURI(t);if(i){let e={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:e}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},((t,s)=>{if(t)return 410===s.status?(this.logger_(`manifest request 410 ${t}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),void this.excludedSteeringManifestURLs.add(i)):429===s.status?(s=s.responseHeaders["retry-after"],this.logger_(`manifest request 429 ${t}.`),this.logger_(`content steering will retry in ${s} seconds.`),void this.startTTLTimeout_(parseInt(s,10))):(this.logger_(`manifest failed to load ${t}.`),void this.startTTLTimeout_());let r;this.trigger({type:"contentsteeringloadcomplete",metadata:e});try{r=JSON.parse(this.request_.responseText)}catch(t){s={errorType:jr.Error.StreamingContentSteeringParserError,error:t},this.trigger({type:"error",metadata:s})}this.assignSteeringProperties_(r),t={contentSteeringInfo:e.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}},this.trigger({type:"contentsteeringparsed",metadata:t}),this.startTTLTimeout_()}))}else this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose()}}setProxyServerUrl_(e){e=new window.URL(e);var t=new window.URL(this.proxyServerUrl_);return t.searchParams.set("url",encodeURI(e.toString())),this.setSteeringParams_(t.toString())}decodeDataUriManifest_(e){e=JSON.parse(window.atob(e)),this.assignSteeringProperties_(e)}setSteeringParams_(e){e=new window.URL(e);var t,i=this.getPathway(),s=this.getBandwidth_();return i&&(t=`_${this.manifestType_}_pathway`,e.searchParams.set(t,i)),s&&(t=`_${this.manifestType_}_throughput`,e.searchParams.set(t,s)),e.toString()}assignSteeringProperties_(e){var t;this.steeringManifest.version=e.VERSION,this.steeringManifest.version?(this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose()),t=(e=>{for(var t of e)if(this.availablePathways_.has(t))return t;return[...this.availablePathways_][0]})(this.steeringManifest.priority),this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))):(this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;var t=e=>this.excludedSteeringManifestURLs.has(e);if(this.proxyServerUrl_){var i=this.setProxyServerUrl_(e);if(!t(i))return i}return t(i=this.setSteeringParams_(e))?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){this.ttlTimeout_=window.setTimeout((()=>{this.requestSteeringManifest()}),1e3*e)}clearTTLTimeout_(){window.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new Gh}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(hl(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}let Kh,Yh=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"];class Qh extends jr.EventTarget{constructor(e){super();let{src:t,withCredentials:i,tech:s,bandwidth:r,externVhs:n,useCueTags:a,playlistExclusionDuration:o,enableLowInitialPlaylist:l,sourceType:d,cacheEncryptionKeys:h,bufferBasedABR:u,leastPixelDiffSelector:c,captionServices:p,experimentalUseMMS:m}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let g=e.maxPlaylistRetries;null!=g||(g=1/0),Kh=n,this.bufferBasedABR=Boolean(u),this.leastPixelDiffSelector=Boolean(c),this.withCredentials=i,this.tech_=s,this.vhs_=s.vhs,this.player_=e.player_,this.sourceType_=d,this.useCueTags_=a,this.playlistExclusionDuration=o,this.maxPlaylistRetries=g,this.enableLowInitialPlaylist=l,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:g,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=(()=>{let e={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((t=>{e[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:dh,activeTrack:dh,getActiveGroup:dh,onGroupChanged:dh,onTrackChanged:dh,lastTrack_:null,logger_:cl(`MediaGroups[${t}]`)}})),e})(),m&&window.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new window.ManagedMediaSource,jr.log("Using ManagedMediaSource")):window.MediaSource&&(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_=ml(),this.hasPlayed_=!1,this.syncController_=new Uh(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Fh,this.sourceUpdater_=new Ih(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Bh,this.keyStatusMap_=new Map;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:h,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_="dash"===this.sourceType_?new _d(t,this.vhs_,pl(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new sd(t,this.vhs_,pl(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new lh(pl(f,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new lh(pl(f,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Ph(pl(f,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise(((e,t)=>{function i(){s.off("vttjserror",r),e()}function r(){s.off("vttjsloaded",i),t()}s.one("vttjsloaded",i),s.one("vttjserror",r),s.addWebVttScript_()}))}),e),this.contentSteeringController_=new Xh(this.vhs_.xhr,(()=>this.mainSegmentLoader_.bandwidth)),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",(()=>this.startABRTimer_())),this.tech_.on("pause",(()=>this.stopABRTimer_())),this.tech_.on("play",(()=>this.startABRTimer_()))),Yh.forEach((e=>{this[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(this,e)})),this.logger_=cl("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,(()=>{let 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 s=(s=this.media())&&(s.id||s.uri),r=e&&(e.id||e.uri);s&&s!==r&&(this.logger_(`switch media ${s} -> ${r} from `+t),s={renditionInfo:{id:r,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t},this.trigger({type:"renditionselected",metadata:s}),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((e=>{var t=(t=this.mediaTypes_[e])?t.activeGroup():null;let i=this.contentSteeringController_.getPathway();t&&i&&(t=(t.length?t[0]:t).playlists.filter((e=>e.attributes.serviceLocation===i))).length&&this.mediaTypes_[e].activePlaylistLoader.media(t[0])}))}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,s=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{var n,a=i.main||s.length&&i[s[0]];for(n in a)if(a[n].default){r={label:n};break}}if(!r)return t;var o,l=[];for(o in i)if(i[o][r.label]){var d=i[o][r.label];if(d.playlists&&d.playlists.length)l.push.apply(l,d.playlists);else if(d.uri)l.push(d);else if(e.playlists.length)for(let t=0;t{var e=this.mainPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;Bl(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=>{zh[t](t,e)}));let{mediaTypes:t,mainPlaylistLoader:i,tech:s,vhs:r,segmentLoaders:{AUDIO:n,main:a}}=e;["AUDIO","SUBTITLES"].forEach((i=>{var s,r,n,a,o,l,d,h,u,c;t[i].activeGroup=(s=i,r=e,e=>{var{mainPlaylistLoader:t,mediaTypes:{[s]:{groups:i}}}=r,n=t.media();if(!n)return null;let a=null;n.attributes[s]&&(a=i[n.attributes[s]]);var o=Object.keys(i);if(!a)if("AUDIO"===s&&1t.id===e.id))[0]||null}),t[i].activeTrack=Wh[i](i,e),t[i].onGroupChanged=(n=i,a=e,()=>{var{segmentLoaders:{[n]:e,main:t},mediaTypes:{[n]:i}}=a,s=i.activeTrack(),r=i.getActiveGroup(),o=i.activePlaylistLoader,l=i.lastGroup_;r&&l&&r.id===l.id||(i.lastGroup_=r,i.lastTrack_=s,qh(e,i),r&&!r.isMainPlaylist&&(r.playlistLoader?(e.resyncLoader(),jh(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=(d=i,h=e,()=>{var e,t,{mainPlaylistLoader:i,segmentLoaders:{[d]:s,main:r},mediaTypes:{[d]:n}}=h,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,u=n.lastTrack_;if((!u||!a||u.id!==a.id)&&(n.lastGroup_=o,n.lastTrack_=a,qh(s,n),o)){if(o.isMainPlaylist)return a&&u&&a.id!==u.id&&(t=(e=h.vhs.playlistController_).selectPlaylist(),e.media()!==t)?(n.logger_(`track change. Switching main audio from ${u.id} to `+a.id),i.pause(),r.resetEverything(),void e.fastQualityChange_(t)):void 0;if("AUDIO"===d){if(!o.playlistLoader)return r.setAudio(!0),void r.resetEverything();s.setAudio(!0),r.setAudio(!1)}l===o.playlistLoader||(s.track&&s.track(a),s.resetEverything()),jh(o.playlistLoader,n)}}),t[i].getActiveGroup=([u,c]=[i,e.mediaTypes],()=>{var e=c[u].activeTrack();return e?c[u].activeGroup(e):null})}));var o,l=t.AUDIO.activeGroup();l&&(l=(l.filter((e=>e.default))[0]||l[0]).id,t.AUDIO.tracks[l].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),(t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n):a).setAudio(!0)),i.on("mediachange",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanged()))})),i.on("mediachanging",(()=>{["AUDIO","SUBTITLES"].forEach((e=>t[e].onGroupChanging()))}));let d=()=>{t.AUDIO.onTrackChanged(),s.trigger({type:"usage",name:"vhs-audio-change"})};for(o in s.audioTracks().addEventListener("change",d),s.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",(()=>{s.audioTracks().removeEventListener("change",d),s.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),s.clearTracks("audio"),t.AUDIO.tracks)s.audioTracks().addTrack(t.AUDIO.tracks[o])})({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.attachContentSteeringListeners_(),this.initContentSteeringController_(),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;Bl(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,"dash"===this.sourceType_&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():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"})})),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach((e=>{this.mainPlaylistLoader_.on(e,(e=>{this.player_.trigger(Kt({},e))}))}))}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){var i=e.mediaGroups||{};let s=!0;var r;for(r in e=Object.keys(i.AUDIO),i.AUDIO)for(var n in i.AUDIO[r])i.AUDIO[r][n].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Kh.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),e.length&&1 `+s.id;if(!e)return l(d+" as current playlist is not set"),!0;if(s.id!==e.id){var h=Boolean(gl(t,i).length);if(!e.endList)return h||"number"!=typeof e.partTargetDuration?(l(d+" as current playlist is live"),!0):(l(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1);if(h=_l(t,i),a<(t=o?vd.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:vd.MAX_BUFFER_LOW_WATER_LINE))return l(d+` as duration < max low water line (${a} < ${t})`),!0;if((i=s.attributes.BANDWIDTH)<(a=e.attributes.BANDWIDTH)&&(!o||h= bufferLowWaterLine (${h} >= ${r})`;return o&&(e+=` and next bandwidth > current bandwidth (${i} > ${a})`),l(e),!0}l(`not ${d} as no switching criteria met`)}}else jr.log.warn("We received no playlist to switch to. Please check your stream.");return!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}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.timelineChangeController_.on("audioTimelineBehind",(()=>{var e=this.audioSegmentLoader_.pendingSegment_;e&&e.segment&&e.segment.syncInfo&&(e=e.segment.syncInfo.end+.01,this.tech_.setCurrentTime(e))})),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:10}))}));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()})),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach((e=>{this.mainSegmentLoader_.on(e,(e=>{this.player_.trigger(Kt({},e))})),this.audioSegmentLoader_.on(e,(e=>{this.player_.trigger(Kt({},e))})),this.subtitleSegmentLoader_.on(e,(e=>{this.player_.trigger(Kt({},e))}))}))}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&&e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0)}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything((()=>{this.mainSegmentLoader_.load()}))}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(){})),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=Kh.Playlist.playlistEnd(e,t),t=this.tech_.currentTime(),(i=this.tech_.buffered()).length?(i=i.end(i.length-1))-t<=Sl&&e-i<=Sl:e-t<=Sl)}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 s=this.mainPlaylistLoader_.main.playlists,r=1===(r=s.filter(Nl)).length&&r[0]===e;if(1===s.length&&i!==1/0)return jr.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(r);if(r){if(this.main().contentSteering){let t=this.pathwayAttribute_(e);var n=1e3*this.contentSteeringController_.steeringManifest.ttl;return this.contentSteeringController_.excludePathway(t),this.excludeThenChangePathway_(),void setTimeout((()=>{this.contentSteeringController_.addAvailablePathway(t)}),n)}let t=!1;s.forEach((i=>{var s;i!==e&&void 0!==(s=i.excludeUntil)&&s!==1/0&&(t=!0,delete i.excludeUntil)})),t&&(jr.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let a;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"}),n=this.selectPlaylist())return(t.internal?this.logger_:jr.log.warn)(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.`+(t.message?" "+t.message:"")+` Switching to playlist ${n.id}.`),n.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),n.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]),s=n.targetDuration/2*1e3||5e3,i="number"==typeof n.lastRequest&&Date.now()-n.lastRequest<=s,this.switchMedia_(n,"exclude",r||i);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){let i=[];var s="all"===e,r=(!s&&"main"!==e||i.push(this.mainPlaylistLoader_),[]);!s&&"audio"!==e||r.push("AUDIO"),!s&&"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 s=this[t+"SegmentLoader_"];!s||e!==t&&"all"!==e||i.push(s)})),i.forEach((e=>t.forEach((t=>{"function"==typeof e[t]&&e[t]()}))))}setCurrentTime(e){var t=gl(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),void this.load()):0}duration(){var e;return this.mainPlaylistLoader_&&(e=this.mainPlaylistLoader_.media())?e.endList?this.mediaSource?this.mediaSource.duration:Kh.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 s=this.mainPlaylistLoader_.main,r=Kh.Playlist.seekable(t,i,Kh.Playlist.liveEdgeDelay(s,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=Kh.Playlist.seekable(t,i,Kh.Playlist.liveEdgeDelay(s,t))).length)return}let n,a;this.seekable_&&this.seekable_.length&&(n=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_=ml([[(e.start(0)>r.start(0)?e:r).start(0),(e.end(0){var t,i=this.mediaTypes_[e].groups;for(t in i)i[t].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_(){let e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;var i=Dd(this.main(),t);let s={};var r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=i.video||e.main.videoCodec||"avc1.4d400d"),e.main.isMuxed&&(s.video+=","+(i.audio||e.main.audioCodec||cn)),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||r)&&(s.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||cn,e.audio.isFmp4=(e.main.hasAudio&&!e.main.isMuxed?e.main:e.audio).isFmp4),s.audio||s.video){let n,a={};if(["video","audio"].forEach((function(t){var i;s.hasOwnProperty(t)&&!((i=e[t].isFmp4)?sn:rn)(s[t])&&(i=e[t].isFmp4?"browser":"muxer",a[i]=a[i]||[],a[i].push(s[t]),"audio"===t&&(n=i))})),r&&n&&t.attributes.AUDIO){let 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 ${n} does not support codec(s): "${s.audio}"`)}if(!Object.keys(a).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){let e=[];if(["video","audio"].forEach((t=>{var i=(hn(this.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(hn(s[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&e.push(`"${this.sourceUpdater_.codecs[t]}" -> "${s[t]}"`)})),e.length)return void this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${e.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0})}return s}i=Object.keys(a).reduce(((e,t)=>(e&&(e+=", "),e+`${t} does not support codec(s): "${a[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_(){let e=this.main().playlists,t=[];Object.keys(e).forEach((i=>{var s,r;i=e[i],-1===t.indexOf(i.id)&&(t.push(i.id),r=[],!(s=Dd(this.main,i)).audio||rn(s.audio)||sn(s.audio)||r.push("audio codec "+s.audio),!s.video||rn(s.video)||sn(s.video)||r.push("video codec "+s.video),s.text&&"stpp.ttml.im1t"===s.text&&r.push("text codec "+s.text),r.length)&&(i.excludeUntil=1/0,this.logger_(`excluding ${i.id} for unsupported: `+r.join(", ")))}))}excludeIncompatibleVariants_(e){let t=[],i=this.main().playlists,s=Ad(e=zd(hn(e))),r=e.video&&hn(e.video)[0]||null,n=e.audio&&hn(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=Ad(l=Dd(this.mainPlaylistLoader_.main,e)),l.audio||l.video)&&(o!==s&&a.push(`codec count "${o}" !== "${s}"`),this.sourceUpdater_.canChangeType()||(o=l.video&&hn(l.video)[0]||null,l=l.audio&&hn(l.audio)[0]||null,o&&r&&o.type.toLowerCase()!==r.type.toLowerCase()&&a.push(`video codec "${o.type}" !== "${r.type}"`),l&&n&&l.type.toLowerCase()!==n.type.toLowerCase()&&a.push(`audio codec "${l.type}" !== "${n.type}"`)),a.length)&&(e.excludeUntil=1/0,this.logger_(`excluding ${e.id}: `+a.join(" && ")))}))}updateAdCues_(e){let t=0;var i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i=0){if(e.segments){let a,o=i;for(let i=0;i=s.adStartTime&&t<=s.adEndTime)return s}return null}(t,o+n.duration/2)){if("cueIn"in n){a.endTime=o,a.adEndTime=o,o+=n.duration,a=null;continue}if(o{let i=e.metadataTrack_;if(i){let e=window.WebKitDataCue||window.VTTCue;t.forEach((t=>{for(var s of Object.keys(t)){var r;Zd.has(s)||((r=new e(t.startTime,t.endTime,"")).id=t.id,r.type="com.apple.quicktime.HLS",r.value={key:Jd[s],data:t[s]},"scte35Out"!==s&&"scte35In"!==s||(r.value.data=new Uint8Array(r.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(r))}t.processDateRange()}))}})({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){var s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();eh(this.inbandTextTracks_,e,this.tech_),(({inbandTextTracks:e,metadataArray:t,timestampOffset:i,videoDuration:s})=>{if(t){let a=window.WebKitDataCue||window.VTTCue,o=e.metadataTrack_;if(o&&(t.forEach((e=>{let t=e.cueTime+i;!("number"!=typeof t||window.isNaN(t)||t<0)&&t<1/0&&e.frames&&e.frames.length&&e.frames.forEach((e=>{var i,s=new a(t,t,e.value||e.url||e.data||"");s.frame=e,s.value=e,i=s,Object.defineProperties(i.frame,{id:{get:()=>(jr.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),i.value.key)},value:{get:()=>(jr.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),i.value.data)},privateData:{get:()=>(jr.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),i.value.data)}}),o.addCue(s)}))})),o.cues)&&o.cues.length){var r=o.cues,n=[];for(let e=0;e{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)=>{var n=e[i];i=isFinite(s)?s:i;let a=Number(t[r+1])||i;n.forEach((e=>{e.endTime=a}))}))}}})({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){var e=this.main();if(e.contentSteering){for(var t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart?this.contentSteeringController_.requestSteeringManifest(!0):this.tech_.one("canplay",(()=>{this.contentSteeringController_.requestSteeringManifest()}))}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach((e=>{this.contentSteeringController_.on(e,(e=>{this.trigger(Kt({},e))}))})),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",(()=>{let e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{var t,i=this.contentSteeringController_.getAvailablePathways(),s=[];for(t of e.playlists){var r=t.attributes.serviceLocation;if(r&&(s.push(r),!i.has(r)))return!0}return!(s.length||!i.size)})())&&this.resetContentSteeringController_()}))}excludeThenChangePathway_(){let e=this.contentSteeringController_.getPathway();if(e){this.handlePathwayClones_();let t=this.main().playlists,i=new Set,s=!1;Object.keys(t).forEach((r=>{r=t[r];var n=(n=this.pathwayAttribute_(r))&&e!==n,a=(r.excludeUntil===1/0&&"content-steering"===r.lastExcludeReason_&&!n&&(delete r.excludeUntil,delete r.lastExcludeReason_,s=!0),!r.excludeUntil&&r.excludeUntil!==1/0);!i.has(r.id)&&n&&a&&(i.add(r.id),r.excludeUntil=1/0,r.lastExcludeReason_="content-steering",this.logger_(`excluding ${r.id} for `+r.lastExcludeReason_))})),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach((t=>{(t=this.mediaTypes_[t]).activePlaylistLoader&&(t=t.activePlaylistLoader.media_)&&t.attributes.serviceLocation!==e&&(s=!0)})),s&&this.changeSegmentPathway_()}}handlePathwayClones_(){var e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||i&&i.size){for(var[s,r]of t.entries())i.get(s)||(this.mainPlaylistLoader_.updateOrDeleteClone(r),this.contentSteeringController_.excludePathway(s));for(let[s,r]of i.entries()){var n=t.get(s);n?this.equalPathwayClones_(n,r)||(this.mainPlaylistLoader_.updateOrDeleteClone(r,!0),this.contentSteeringController_.addAvailablePathway(s)):(e.filter((e=>e.attributes["PATHWAY-ID"]===r["BASE-ID"])).forEach((e=>{this.mainPlaylistLoader_.addClonePathway(r,e)})),this.contentSteeringController_.addAvailablePathway(s))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...i])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;var i,s,r=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(i in r)if(r[i]!==n[i])return!1;for(s in n)if(r[s]!==n[s])return!1;return!0}changeSegmentPathway_(){var e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.main){let e=0,t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach((i=>{var s=this.mainPlaylistLoader_.getKeyIdSet(i);s&&s.size&&s.forEach((s=>{var r="usable",n=(r=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)===r,i.lastExcludeReason_===t&&i.excludeUntil===1/0);r?n&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${s} is usable`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${s} doesn't exist in the keyStatusMap or is not usable`)),e++)}))})),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach((e=>{var i=e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height<720,s=e.excludeUntil===1/0&&e.lastExcludeReason_===t;i&&s&&(delete e.excludeUntil,jr.log.warn(`enabling non-HD playlist ${e.id} because all playlists were excluded due to ${t} key IDs`))}))}}addKeyStatus_(e,t){e=("string"==typeof e?e:(e=>(e=new Uint8Array(e),Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join("")))(e)).slice(0,32).toLowerCase(),this.logger_(`KeyStatus '${t}' with key ID ${e} added to the keyStatusMap`),this.keyStatusMap_.set(e,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}class Jh{constructor(e,t,i){var s,r,n,a,o=e.playlistController_,l=o.fastQualityChange_.bind(o);t.attributes&&(s=t.attributes.RESOLUTION,this.width=s&&s.width,this.height=s&&s.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]),this.codecs=Dd(o.main(),t),this.playlist=t,this.id=i,this.enabled=(r=e.playlists,n=t.id,a=l,e=>{var t=r.main.playlists[n],i=Rl(t),s=Nl(t);if(void 0===e)return s;e?delete t.disabled:t.disabled=!0;var o={renditionInfo:{id:n,bandwidth:t.attributes.BANDWIDTH,resolution:t.attributes.RESOLUTION,codecs:t.attributes.CODECS},cause:"fast-quality"};return e===s||i||(a(t),e?r.trigger({type:"renditionenabled",metadata:o}):r.trigger({type:"renditiondisabled",metadata:o})),e})}}let Zh=["seeking","seeked","pause","playing","error"];class eu extends jr.EventTarget{constructor(e){super(),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.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=cl("PlaybackWatcher"),this.logger_("initialize");let t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),n=this.playlistController_,a=["main","subtitle","audio"],o={},l=(a.forEach((e=>{o[e]={reset:()=>this.resetSegmentDownloads_(e),updateend:()=>this.checkSegmentDownloads_(e)},n[e+"SegmentLoader_"].on("appendsdone",o[e].updateend),n[e+"SegmentLoader_"].on("playlistupdate",o[e].reset),this.tech_.on(["seeked","seeking"],o[e].reset)})),e=>{["main","audio"].forEach((t=>{n[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",s),this.tech_.on(Zh,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(Zh,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=>{n[e+"SegmentLoader_"].off("appendsdone",o[e].updateend),n[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=t.end(t.length-1))?this.techWaiting_():void(5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.playedRanges_.push(ml([this.lastRecordedTime,e])),t={playedRanges:this.playedRanges_},this.playlistController_.trigger({type:"playedrangeschanged",metadata:t}),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=s=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)&&(i=(s=e.start(0))+(s===e.end(0)?0:Sl)),void 0!==i)this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${El(e)}. Seeking to `+i+".");else{var s=this.playlistController_.sourceUpdater_,r=(e=this.tech_.buffered(),s.audioBuffer?s.audioBuffered():null),n=(s=s.videoBuffer?s.videoBuffered():null,this.media()),a=n.partTargetDuration||2*(n.targetDuration-Tl),o=[r,s];for(let e=0;e ${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=fl(e,i)).length&&(this.logger_(`Stopped at ${i} and seeking to `+t.start(0)),this.resetTimeUpdate_(),this.skipTheGap_(i),!0)))}afterSeekableWindow_(e,t,i,s=!1){if(!e.length)return!1;let r=e.end(e.length-1)+Sl;return t>(i.endList||"number"!=typeof i.partTargetDuration&&!s?r:e.end(e.length-1)+3*i.targetDuration)}beforeSeekableWindow_(e,t){return!!(e.length&&0{e.trigger({type:"usage",name:"vhs-error-reload-initialized"})})),function(){a&&e.currentTime(a)});e.on("error",s),e.on("dispose",r),e.reloadSourceOnError=function(t){r(),iu(e,t)}};function su(e,t){var i=t.media();let s=-1;for(let t=0;tLd(e,t))),e=e.filter((e=>!!Dd(this.playlists.main,e).video)))[0]||null},lastBandwidthSelector:Kd,movingAverageBandwidthSelector:function(e){let t=-1,i=-1;if(e<0||1{Object.defineProperty(ru,e,{get:()=>(jr.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),vd[e]),set(t){jr.log.warn(`using Vhs.${e} is UNSAFE be sure you know what you are doing`),"number"!=typeof t||t<0?jr.log.warn(`value of Vhs.${e} must be greater than or equal to 0`):vd[e]=t}})})),"videojs-vhs"),au=(ru.canPlaySource=function(){return jr.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},({player:e,sourceKeySystems:t,audioMedia:i,mainPlaylists:s})=>{if(!e.eme.initializeMediaKeys)return Promise.resolve();var r;i=i?s.concat([i]):s,s=i,r=Object.keys(t),i=s.reduce(((e,t)=>{var i;return t.contentProtection&&(i=r.reduce(((e,i)=>{var s=t.contentProtection[i];return s&&s.pssh&&(e[i]={pssh:s.pssh}),e}),{}),Object.keys(i).length)&&e.push(i),e}),[]);let n=[],a=[];return i.forEach((t=>{a.push(new Promise(((t,i)=>{e.tech_.one("keysessioncreated",t)}))),n.push(new Promise(((i,s)=>{e.eme.initializeMediaKeys({keySystems:t},(e=>{e?s(e):i()}))})))})),Promise.race([Promise.all(n),Promise.race(a)])}),ou=()=>{if(!window.localStorage)return null;var e=window.localStorage.getItem(nu);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},lu=(e,t)=>{e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},du=(e,t)=>{e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},hu=(e,t)=>{e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},uu=(e,t)=>{e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};ru.supportsNativeHls=function(){if(!document||!document.createElement)return!1;let e=document.createElement("video");return!!jr.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))}))}(),ru.supportsNativeDash=!!(document&&document.createElement&&jr.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),ru.supportsTypeNatively=e=>"hls"===e?ru.supportsNativeHls:"dash"===e&&ru.supportsNativeDash,ru.isSupported=function(){return jr.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},ru.xhr.onRequest=function(e){lu(ru.xhr,e)},ru.xhr.onResponse=function(e){du(ru.xhr,e)},ru.xhr.offRequest=function(e){hu(ru.xhr,e)},ru.xhr.offResponse=function(e){uu(ru.xhr,e)},H=jr.getComponent("Component");class cu extends H{constructor(e,t,i){if(super(t,i.vhs),"number"==typeof i.initialBandwidth&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=cl("VhsHandler"),t.options_&&t.options_.playerId&&(i=jr.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_(e={}){this.options_=pl(this.options_,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_.useForcedSubtitles=this.options_.useForcedSubtitles||!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=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage&&((e=ou())&&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=vd.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===vd.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","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,"number"==typeof(e=this.options_.customPixelRatio)&&0<=e&&(this.customPixelRatio=e)}setOptions(e={}){this.setOptions_(e)}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=ru,this.options_.sourceType=nn(t),this.options_.seekTo=e=>{this.tech_.setCurrentTime(e)},this.options_.player_=this.player_,this.playlistController_=new Qh(this.options_),e=pl({liveRangeSafeTimeDelta:Sl},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_}),this.playbackWatcher_=new eu(e),this.attachStreamingEventListeners_(),this.playlistController_.on("error",(()=>{var e=jr.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?ru.movingAverageBandwidthSelector(.55):ru.STANDARD_PLAYLIST_SELECTOR,this.playlistController_.selectPlaylist=(this.selectPlaylist||t).bind(this),this.playlistController_.selectInitialPlaylist=ru.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=0this.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:()=>Cl(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:()=>Cl(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=ou())?pl(t,e):e;try{window.localStorage.setItem(nu,JSON.stringify(t))}catch(e){return}}}})),this.playlistController_.on("selectedinitialmedia",(()=>{var e;(e=this).representations=()=>{var t=e.playlistController_.main();return(t=ql(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists)?t.filter((e=>!Rl(e))).map(((t,i)=>new Jh(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"),au({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:s})=>!(!(t=((e,t,i)=>{if(!e)return e;let s={};t&&t.attributes&&t.attributes.CODECS&&(s=zd(hn(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(s.audio=i.attributes.CODECS);var r,n=un(s.video),a=un(s.audio),o={};for(r in e)o[r]={},a&&(o[r].audioContentType=a),n&&(o[r].videoContentType=n),t.contentProtection&&t.contentProtection[r]&&t.contentProtection[r].pssh&&(o[r].pssh=t.contentProtection[r].pssh),"string"==typeof e[r]&&(o[r].url=e[r]);return pl(e,o)})(t,i,s))||(e.currentSource().keySystems=t)&&!e.eme&&(jr.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=>{this.playlistController_.updatePlaylistByKeyStatus(e.keyId,e.status)})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),e?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}setupQualityLevels_(){var e=jr.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)})),su(e,t.playlists)})),this.playlists.on("mediachange",(()=>{su(this.qualityLevels_,this.playlists)})))}static version(){return{"@videojs/http-streaming":"3.14.2","mux.js":"7.0.3","mpd-parser":"1.3.0","m3u8-parser":"7.2.0","aes-decrypter":"4.0.2"}}version(){return this.constructor.version()}canChangeType(){return Ih.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 s,r;if(i)return e&&void 0!==t?(e=((e,t)=>{if(!t||!t.segments||0===t.segments.length)return null;let i,s=0;for(let r=0;rs){if(e>s+.25*r.duration)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:s-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}):(s={mediaSeconds:t},t=t,(r=(e=e.segment).dateTimeObject?(r=e.videoTimingInfo.transmuxerPrependedSeconds,t-=e.videoTimingInfo.transmuxedPresentationStart+r,new Date(e.dateTimeObject.getTime()+1e3*t)):null)&&(s.programDateTime=r.toISOString()),i(null,s)):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,s=2){return pd({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{lu(this.xhr,e)},this.xhr.onResponse=e=>{du(this.xhr,e)},this.xhr.offRequest=e=>{hu(this.xhr,e)},this.xhr.offResponse=e=>{uu(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach((e=>{this.playlistController_.on(e,(e=>{this.player_.trigger(Kt({},e))}))})),["gapjumped","playedrangeschanged"].forEach((e=>{this.playbackWatcher_.on(e,(e=>{this.player_.trigger(Kt({},e))}))}))}}let pu={name:"videojs-http-streaming",VERSION:"3.14.2",canHandleSource:(e,t={})=>!(!(t=pl(jr.options,t)).vhs.experimentalUseMMS&&!sn("avc1.4d400d,mp4a.40.2",!1))&&pu.canPlayType(e.type,t),handleSource:(e,t,i={})=>(i=pl(jr.options,i),t.vhs=new cu(e,t,i),t.vhs.xhr=nd(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs),canPlayType:(e,t)=>(e=nn(e))&&(t=pu.getOverrideNative(t),!ru.supportsTypeNatively(e)||t)?"maybe":"",getOverrideNative(e={}){var{vhs:e={}}=e,t=!(jr.browser.IS_ANY_SAFARI||jr.browser.IS_IOS),{overrideNative:e=t}=e;return e}};return sn("avc1.4d400d,mp4a.40.2",!0)&&jr.getTech("Html5").registerSourceHandler(pu,0),jr.VhsHandler=cu,jr.VhsSourceHandler=pu,jr.Vhs=ru,jr.use||jr.registerComponent("Vhs",ru),jr.options.vhs=jr.options.vhs||{},jr.getPlugin&&jr.getPlugin("reloadSourceOnError")||jr.registerPlugin("reloadSourceOnError",(function(e){iu(this,e)})),jr}));