@vouchfor/embeds 0.0.0-experiment.0f953a2 → 0.0.0-experiment.108d575

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,74 +1,74 @@
1
- var ty=Object.defineProperty;var iy=(ye,jt,Ui)=>jt in ye?ty(ye,jt,{enumerable:!0,configurable:!0,writable:!0,value:Ui}):ye[jt]=Ui;var qu=(ye,jt,Ui)=>(iy(ye,typeof jt!="symbol"?jt+"":jt,Ui),Ui);var embeds=async function(ye){"use strict";var Pu;var jt=typeof document<"u"?document.currentScript:null;function Ui(s,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in s)){const n=Object.getOwnPropertyDescriptor(i,r);n&&Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}/**
1
+ var embeds=function(ye){"use strict";var My=Object.defineProperty;var Py=(ye,Ei,zt)=>Ei in ye?My(ye,Ei,{enumerable:!0,configurable:!0,writable:!0,value:zt}):ye[Ei]=zt;var Ad=(ye,Ei,zt)=>(Py(ye,typeof Ei!="symbol"?Ei+"":Ei,zt),zt);var Zh;function Ei(s,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in s)){const n=Object.getOwnPropertyDescriptor(i,r);n&&Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const mr=globalThis,Un=mr.ShadowRoot&&(mr.ShadyCSS===void 0||mr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Pn=Symbol(),rA=new WeakMap;let nA=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Pn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Un&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=rA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&rA.set(t,e))}return e}toString(){return this.cssText}};const Os=s=>new nA(typeof s=="string"?s:s+"",void 0,Pn),it=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((i,r,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[n+1],s[0]);return new nA(t,s,Pn)},ju=(s,e)=>{if(Un)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=mr.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},oA=Un?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return Os(t)})(s):s;/**
5
+ */const zt=globalThis,Zn=zt.ShadowRoot&&(zt.ShadyCSS===void 0||zt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,eo=Symbol(),CA=new WeakMap;let vA=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==eo)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Zn&&e===void 0){const i=t!==void 0&&t.length===1;i&&(e=CA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&CA.set(t,e))}return e}toString(){return this.cssText}};const Os=s=>new vA(typeof s=="string"?s:s+"",void 0,eo),at=(s,...e)=>{const t=s.length===1?s[0]:e.reduce((i,r,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[n+1],s[0]);return new vA(t,s,eo)},ld=(s,e)=>{if(Zn)s.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const i=document.createElement("style"),r=zt.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=t.cssText,s.appendChild(i)}},yA=Zn?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return Os(t)})(s):s;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:Xu,defineProperty:Zu,getOwnPropertyDescriptor:zu,getOwnPropertyNames:ed,getOwnPropertySymbols:td,getPrototypeOf:id}=Object,Ri=globalThis,aA=Ri.trustedTypes,sd=aA?aA.emptyScript:"",Gn=Ri.reactiveElementPolyfillSupport,Ns=(s,e)=>s,Br={toAttribute(s,e){switch(e){case Boolean:s=s?sd:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},yr=(s,e)=>!Xu(s,e),AA={attribute:!0,type:String,converter:Br,reflect:!1,hasChanged:yr};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Ri.litPropertyMetadata??(Ri.litPropertyMetadata=new WeakMap);class ss extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=AA){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&Zu(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=zu(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??AA}static _$Ei(){if(this.hasOwnProperty(Ns("elementProperties")))return;const e=id(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ns("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ns("properties"))){const t=this.properties,i=[...ed(t),...td(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(oA(r))}else e!==void 0&&t.push(oA(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ju(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EC(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:Br).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Br;this._$Em=r,this[r]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??yr)(this[e],t))return;this.P(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$EO)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}}ss.elementStyles=[],ss.shadowRootOptions={mode:"open"},ss[Ns("elementProperties")]=new Map,ss[Ns("finalized")]=new Map,Gn==null||Gn({ReactiveElement:ss}),(Ri.reactiveElementVersions??(Ri.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:cd,defineProperty:ud,getOwnPropertyDescriptor:hd,getOwnPropertyNames:dd,getOwnPropertySymbols:gd,getPrototypeOf:fd}=Object,Li=globalThis,BA=Li.trustedTypes,pd=BA?BA.emptyScript:"",to=Li.reactiveElementPolyfillSupport,Us=(s,e)=>s,wr={toAttribute(s,e){switch(e){case Boolean:s=s?pd:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let t=s;switch(e){case Boolean:t=s!==null;break;case Number:t=s===null?null:Number(s);break;case Object:case Array:try{t=JSON.parse(s)}catch{t=null}}return t}},Rr=(s,e)=>!cd(s,e),QA={attribute:!0,type:String,converter:wr,reflect:!1,hasChanged:Rr};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Li.litPropertyMetadata??(Li.litPropertyMetadata=new WeakMap);class As extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=QA){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);r!==void 0&&ud(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=hd(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return r==null?void 0:r.call(this)},set(o){const a=r==null?void 0:r.call(this);n.call(this,o),this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??QA}static _$Ei(){if(this.hasOwnProperty(Us("elementProperties")))return;const e=fd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Us("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Us("properties"))){const t=this.properties,i=[...dd(t),...gd(t)];for(const r of i)this.createProperty(r,t[r])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[i,r]of t)this.elementProperties.set(i,r)}this._$Eh=new Map;for(const[t,i]of this.elementProperties){const r=this._$Eu(t,i);r!==void 0&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)t.unshift(yA(r))}else e!==void 0&&t.push(yA(e));return t}static _$Eu(e,t){const i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ld(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostConnected)==null?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var i;return(i=t.hostDisconnected)==null?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EC(e,t){var n;const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(r!==void 0&&i.reflect===!0){const o=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:wr).toAttribute(t,i.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){var n;const i=this.constructor,r=i._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const o=i.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:wr;this._$Em=r,this[r]=a.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??Rr)(this[e],t))return;this.P(e,t,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[n,o]of r)o.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(i=this._$EO)==null||i.forEach(r=>{var n;return(n=r.hostUpdate)==null?void 0:n.call(r)}),this.update(t)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(i=>{var r;return(r=i.hostUpdated)==null?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EC(t,this[t]))),this._$EU()}updated(e){}firstUpdated(e){}}As.elementStyles=[],As.shadowRootOptions={mode:"open"},As[Us("elementProperties")]=new Map,As[Us("finalized")]=new Map,to==null||to({ReactiveElement:As}),(Li.reactiveElementVersions??(Li.reactiveElementVersions=[])).push("2.0.4");/**
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const Us=globalThis,Qr=Us.trustedTypes,lA=Qr?Qr.createPolicy("lit-html",{createHTML:s=>s}):void 0,Hn="$lit$",gi=`lit$${(Math.random()+"").slice(9)}$`,$n="?"+gi,rd=`<${$n}>`,Pi=document,Ps=()=>Pi.createComment(""),Gs=s=>s===null||typeof s!="object"&&typeof s!="function",cA=Array.isArray,hA=s=>cA(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",Kn=`[
14
- \f\r]`,Hs=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,uA=/-->/g,dA=/>/g,Gi=RegExp(`>|${Kn}(?:([^\\s"'>=/]+)(${Kn}*=${Kn}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),gA=/'/g,fA=/"/g,EA=/^(?:script|style|textarea|title)$/i,nd=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),fe=nd(1),Gt=Symbol.for("lit-noChange"),We=Symbol.for("lit-nothing"),pA=new WeakMap,Hi=Pi.createTreeWalker(Pi,129);function IA(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return lA!==void 0?lA.createHTML(e):e}const CA=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":"",o=Hs;for(let a=0;a<t;a++){const A=s[a];let l,c,h=-1,u=0;for(;u<A.length&&(o.lastIndex=u,c=o.exec(A),c!==null);)u=o.lastIndex,o===Hs?c[1]==="!--"?o=uA:c[1]!==void 0?o=dA:c[2]!==void 0?(EA.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=Gi):c[3]!==void 0&&(o=Gi):o===Gi?c[0]===">"?(o=r??Hs,h=-1):c[1]===void 0?h=-2:(h=o.lastIndex-c[2].length,l=c[1],o=c[3]===void 0?Gi:c[3]==='"'?fA:gA):o===fA||o===gA?o=Gi:o===uA||o===dA?o=Hs:(o=Gi,r=void 0);const d=o===Gi&&s[a+1].startsWith("/>")?" ":"";n+=o===Hs?A+rd:h>=0?(i.push(l),A.slice(0,h)+Hn+A.slice(h)+gi+d):A+gi+(h===-2?a:d)}return[IA(s,n+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};class $s{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,o=0;const a=e.length-1,A=this.parts,[l,c]=CA(e,t);if(this.el=$s.createElement(l,i),Hi.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=Hi.nextNode())!==null&&A.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(Hn)){const u=c[o++],d=r.getAttribute(h).split(gi),g=/([.?@])?(.*)/.exec(u);A.push({type:1,index:n,name:g[2],strings:d,ctor:g[1]==="."?BA:g[1]==="?"?yA:g[1]==="@"?QA:Ks}),r.removeAttribute(h)}else h.startsWith(gi)&&(A.push({type:6,index:n}),r.removeAttribute(h));if(EA.test(r.tagName)){const h=r.textContent.split(gi),u=h.length-1;if(u>0){r.textContent=Qr?Qr.emptyScript:"";for(let d=0;d<u;d++)r.append(h[d],Ps()),Hi.nextNode(),A.push({type:2,index:++n});r.append(h[u],Ps())}}}else if(r.nodeType===8)if(r.data===$n)A.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(gi,h+1))!==-1;)A.push({type:7,index:n}),h+=gi.length-1}n++}}static createElement(e,t){const i=Pi.createElement("template");return i.innerHTML=e,i}}function $i(s,e,t=s,i){var o,a;if(e===Gt)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=Gs(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=r:t._$Cl=r),r!==void 0&&(e=$i(s,r._$AS(s,e.values),r,i)),e}class mA{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,r=((e==null?void 0:e.creationScope)??Pi).importNode(t,!0);Hi.currentNode=r;let n=Hi.nextNode(),o=0,a=0,A=i[0];for(;A!==void 0;){if(o===A.index){let l;A.type===2?l=new rs(n,n.nextSibling,this,e):A.type===1?l=new A.ctor(n,A.name,A.strings,this,e):A.type===6&&(l=new vA(n,this,e)),this._$AV.push(l),A=i[++a]}o!==(A==null?void 0:A.index)&&(n=Hi.nextNode(),o++)}return Hi.currentNode=Pi,r}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class rs{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=We,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=$i(this,e,t),Gs(e)?e===We||e==null||e===""?(this._$AH!==We&&this._$AR(),this._$AH=We):e!==this._$AH&&e!==Gt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):hA(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==We&&Gs(this._$AH)?this._$AA.nextSibling.data=e:this.T(Pi.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=$s.createElement(IA(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new mA(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=pA.get(e.strings);return t===void 0&&pA.set(e.strings,t=new $s(e)),t}k(e){cA(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const n of e)r===t.length?t.push(i=new rs(this.S(Ps()),this.S(Ps()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class Ks{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=We,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=We}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=$i(this,e,t,0),o=!Gs(e)||e!==this._$AH&&e!==Gt,o&&(this._$AH=e);else{const a=e;let A,l;for(e=n[0],A=0;A<n.length-1;A++)l=$i(this,a[i+A],t,A),l===Gt&&(l=this._$AH[A]),o||(o=!Gs(l)||l!==this._$AH[A]),l===We?e=We:e!==We&&(e+=(l??"")+n[A+1]),this._$AH[A]=l}o&&!r&&this.j(e)}j(e){e===We?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class BA extends Ks{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===We?void 0:e}}class yA extends Ks{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==We)}}class QA extends Ks{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=$i(this,e,t,0)??We)===Gt)return;const i=this._$AH,r=e===We&&i!==We||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==We&&(i===We||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class vA{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){$i(this,e)}}const od={P:Hn,A:gi,C:$n,M:1,L:CA,R:mA,D:hA,V:$i,I:rs,H:Ks,N:yA,U:QA,B:BA,F:vA},Yn=Us.litHtmlPolyfillSupport;Yn==null||Yn($s,rs),(Us.litHtmlVersions??(Us.litHtmlVersions=[])).push("3.1.2");const ad=(s,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let r=i._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;i._$litPart$=r=new rs(e.insertBefore(Ps(),n),n,void 0,t??{})}return r._$AI(s),r};/**
13
+ */const Gs=globalThis,xr=Gs.trustedTypes,bA=xr?xr.createPolicy("lit-html",{createHTML:s=>s}):void 0,io="$lit$",Ii=`lit$${(Math.random()+"").slice(9)}$`,so="?"+Ii,Ed=`<${so}>`,Hi=document,Hs=()=>Hi.createComment(""),$s=s=>s===null||typeof s!="object"&&typeof s!="function",SA=Array.isArray,wA=s=>SA(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",ro=`[
14
+ \f\r]`,Ys=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,RA=/-->/g,xA=/>/g,$i=RegExp(`>|${ro}(?:([^\\s"'>=/]+)(${ro}*=${ro}*(?:[^
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),TA=/'/g,DA=/"/g,LA=/^(?:script|style|textarea|title)$/i,Id=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),fe=Id(1),Ht=Symbol.for("lit-noChange"),ze=Symbol.for("lit-nothing"),_A=new WeakMap,Yi=Hi.createTreeWalker(Hi,129);function kA(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return bA!==void 0?bA.createHTML(e):e}const FA=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":"",o=Ys;for(let a=0;a<t;a++){const A=s[a];let l,c,u=-1,h=0;for(;h<A.length&&(o.lastIndex=h,c=o.exec(A),c!==null);)h=o.lastIndex,o===Ys?c[1]==="!--"?o=RA:c[1]!==void 0?o=xA:c[2]!==void 0?(LA.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=$i):c[3]!==void 0&&(o=$i):o===$i?c[0]===">"?(o=r??Ys,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,l=c[1],o=c[3]===void 0?$i:c[3]==='"'?DA:TA):o===DA||o===TA?o=$i:o===RA||o===xA?o=Ys:(o=$i,r=void 0);const d=o===$i&&s[a+1].startsWith("/>")?" ":"";n+=o===Ys?A+Ed:u>=0?(i.push(l),A.slice(0,u)+io+A.slice(u)+Ii+d):A+Ii+(u===-2?a:d)}return[kA(s,n+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};class Ks{constructor({strings:e,_$litType$:t},i){let r;this.parts=[];let n=0,o=0;const a=e.length-1,A=this.parts,[l,c]=FA(e,t);if(this.el=Ks.createElement(l,i),Yi.currentNode=this.el.content,t===2){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(r=Yi.nextNode())!==null&&A.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const u of r.getAttributeNames())if(u.endsWith(io)){const h=c[o++],d=r.getAttribute(u).split(Ii),g=/([.?@])?(.*)/.exec(h);A.push({type:1,index:n,name:g[2],strings:d,ctor:g[1]==="."?MA:g[1]==="?"?PA:g[1]==="@"?OA:Vs}),r.removeAttribute(u)}else u.startsWith(Ii)&&(A.push({type:6,index:n}),r.removeAttribute(u));if(LA.test(r.tagName)){const u=r.textContent.split(Ii),h=u.length-1;if(h>0){r.textContent=xr?xr.emptyScript:"";for(let d=0;d<h;d++)r.append(u[d],Hs()),Yi.nextNode(),A.push({type:2,index:++n});r.append(u[h],Hs())}}}else if(r.nodeType===8)if(r.data===so)A.push({type:2,index:n});else{let u=-1;for(;(u=r.data.indexOf(Ii,u+1))!==-1;)A.push({type:7,index:n}),u+=Ii.length-1}n++}}static createElement(e,t){const i=Hi.createElement("template");return i.innerHTML=e,i}}function Ki(s,e,t=s,i){var o,a;if(e===Ht)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=$s(e)?void 0:e._$litDirective$;return(r==null?void 0:r.constructor)!==n&&((a=r==null?void 0:r._$AO)==null||a.call(r,!1),n===void 0?r=void 0:(r=new n(s),r._$AT(s,t,i)),i!==void 0?(t._$Co??(t._$Co=[]))[i]=r:t._$Cl=r),r!==void 0&&(e=Ki(s,r._$AS(s,e.values),r,i)),e}class NA{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,r=((e==null?void 0:e.creationScope)??Hi).importNode(t,!0);Yi.currentNode=r;let n=Yi.nextNode(),o=0,a=0,A=i[0];for(;A!==void 0;){if(o===A.index){let l;A.type===2?l=new ls(n,n.nextSibling,this,e):A.type===1?l=new A.ctor(n,A.name,A.strings,this,e):A.type===6&&(l=new UA(n,this,e)),this._$AV.push(l),A=i[++a]}o!==(A==null?void 0:A.index)&&(n=Yi.nextNode(),o++)}return Yi.currentNode=Hi,r}p(e){let t=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class ls{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=ze,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=(r==null?void 0:r.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ki(this,e,t),$s(e)?e===ze||e==null||e===""?(this._$AH!==ze&&this._$AR(),this._$AH=ze):e!==this._$AH&&e!==Ht&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):wA(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==ze&&$s(this._$AH)?this._$AA.nextSibling.data=e:this.T(Hi.createTextNode(e)),this._$AH=e}$(e){var n;const{values:t,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Ks.createElement(kA(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)==null?void 0:n._$AD)===r)this._$AH.p(t);else{const o=new NA(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=_A.get(e.strings);return t===void 0&&_A.set(e.strings,t=new Ks(e)),t}k(e){SA(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const n of e)r===t.length?t.push(i=new ls(this.S(Hs()),this.S(Hs()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,t);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class Vs{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=ze,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=ze}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=Ki(this,e,t,0),o=!$s(e)||e!==this._$AH&&e!==Ht,o&&(this._$AH=e);else{const a=e;let A,l;for(e=n[0],A=0;A<n.length-1;A++)l=Ki(this,a[i+A],t,A),l===Ht&&(l=this._$AH[A]),o||(o=!$s(l)||l!==this._$AH[A]),l===ze?e=ze:e!==ze&&(e+=(l??"")+n[A+1]),this._$AH[A]=l}o&&!r&&this.j(e)}j(e){e===ze?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class MA extends Vs{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ze?void 0:e}}class PA extends Vs{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ze)}}class OA extends Vs{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=Ki(this,e,t,0)??ze)===Ht)return;const i=this._$AH,r=e===ze&&i!==ze||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==ze&&(i===ze||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class UA{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Ki(this,e)}}const md={P:io,A:Ii,C:so,M:1,L:FA,R:NA,D:wA,V:Ki,I:ls,H:Vs,N:PA,U:OA,B:MA,F:UA},no=Gs.litHtmlPolyfillSupport;no==null||no(Ks,ls),(Gs.litHtmlVersions??(Gs.litHtmlVersions=[])).push("3.1.2");const Cd=(s,e,t)=>{const i=(t==null?void 0:t.renderBefore)??e;let r=i._$litPart$;if(r===void 0){const n=(t==null?void 0:t.renderBefore)??null;i._$litPart$=r=new ls(e.insertBefore(Hs(),n),n,void 0,t??{})}return r._$AI(s),r};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */let fi=class extends ss{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ad(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return Gt}};fi._$litElement$=!0,fi.finalized=!0,(Pu=globalThis.litElementHydrateSupport)==null||Pu.call(globalThis,{LitElement:fi});const Vn=globalThis.litElementPolyfillSupport;Vn==null||Vn({LitElement:fi}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
19
+ */let mi=class extends As{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Cd(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return Ht}};mi._$litElement$=!0,mi.finalized=!0,(Zh=globalThis.litElementHydrateSupport)==null||Zh.call(globalThis,{LitElement:mi});const oo=globalThis.litElementPolyfillSupport;oo==null||oo({LitElement:mi}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.4");/**
20
20
  * @license
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
- */const vr=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};/**
23
+ */const Tr=s=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const Ad={attribute:!0,type:String,converter:Br,reflect:!1,hasChanged:yr},ld=(s=Ad,e,t)=>{const{kind:i,metadata:r}=t;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(t.name,s),i==="accessor"){const{name:o}=t;return{set(a){const A=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,A,s)},init(a){return a!==void 0&&this.P(o,void 0,s),a}}}if(i==="setter"){const{name:o}=t;return function(a){const A=this[o];e.call(this,a),this.requestUpdate(o,A,s)}}throw Error("Unsupported decorator location: "+i)};function V(s){return(e,t)=>typeof t=="object"?ld(s,e,t):((i,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(r,n):void 0})(s,e,t)}/**
27
+ */const vd={attribute:!0,type:String,converter:wr,reflect:!1,hasChanged:Rr},yd=(s=vd,e,t)=>{const{kind:i,metadata:r}=t;let n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(t.name,s),i==="accessor"){const{name:o}=t;return{set(a){const A=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,A,s)},init(a){return a!==void 0&&this.P(o,void 0,s),a}}}if(i==="setter"){const{name:o}=t;return function(a){const A=this[o];e.call(this,a),this.requestUpdate(o,A,s)}}throw Error("Unsupported decorator location: "+i)};function J(s){return(e,t)=>typeof t=="object"?yd(s,e,t):((i,r,n)=>{const o=r.hasOwnProperty(n);return r.constructor.createProperty(n,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(r,n):void 0})(s,e,t)}/**
28
28
  * @license
29
29
  * Copyright 2017 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */function Xe(s){return V({...s,state:!0,attribute:!1})}/**
31
+ */function Ze(s){return J({...s,state:!0,attribute:!1})}/**
32
32
  * @license
33
33
  * Copyright 2018 Google LLC
34
34
  * SPDX-License-Identifier: BSD-3-Clause
35
- */const st=s=>s??We;/**
35
+ */const et=s=>s??ze;/**
36
36
  * @license
37
37
  * Copyright 2020 Google LLC
38
38
  * SPDX-License-Identifier: BSD-3-Clause
39
- */const{I:cd}=od,hd=s=>s.strings===void 0,wA=()=>document.createComment(""),Ys=(s,e,t)=>{var n;const i=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const o=i.insertBefore(wA(),r),a=i.insertBefore(wA(),r);t=new cd(o,a,s,s.options)}else{const o=t._$AB.nextSibling,a=t._$AM,A=a!==s;if(A){let l;(n=t._$AQ)==null||n.call(t,s),t._$AM=s,t._$AP!==void 0&&(l=s._$AU)!==a._$AU&&t._$AP(l)}if(o!==r||A){let l=t._$AA;for(;l!==o;){const c=l.nextSibling;i.insertBefore(l,r),l=c}}}return t},Ki=(s,e,t=s)=>(s._$AI(e,t),s),ud={},dd=(s,e=ud)=>s._$AH=e,gd=s=>s._$AH,Jn=s=>{var i;(i=s._$AP)==null||i.call(s,!1,!0);let e=s._$AA;const t=s._$AB.nextSibling;for(;e!==t;){const r=e.nextSibling;e.remove(),e=r}};/**
39
+ */const{I:Bd}=md,Qd=s=>s.strings===void 0,GA=()=>document.createComment(""),Js=(s,e,t)=>{var n;const i=s._$AA.parentNode,r=e===void 0?s._$AB:e._$AA;if(t===void 0){const o=i.insertBefore(GA(),r),a=i.insertBefore(GA(),r);t=new Bd(o,a,s,s.options)}else{const o=t._$AB.nextSibling,a=t._$AM,A=a!==s;if(A){let l;(n=t._$AQ)==null||n.call(t,s),t._$AM=s,t._$AP!==void 0&&(l=s._$AU)!==a._$AU&&t._$AP(l)}if(o!==r||A){let l=t._$AA;for(;l!==o;){const c=l.nextSibling;i.insertBefore(l,r),l=c}}}return t},Vi=(s,e,t=s)=>(s._$AI(e,t),s),bd={},Sd=(s,e=bd)=>s._$AH=e,wd=s=>s._$AH,ao=s=>{var i;(i=s._$AP)==null||i.call(s,!1,!0);let e=s._$AA;const t=s._$AB.nextSibling;for(;e!==t;){const r=e.nextSibling;e.remove(),e=r}};/**
40
40
  * @license
41
41
  * Copyright 2017 Google LLC
42
42
  * SPDX-License-Identifier: BSD-3-Clause
43
- */const ns={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},os=s=>(...e)=>({_$litDirective$:s,values:e});let Vs=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
43
+ */const cs={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},us=s=>(...e)=>({_$litDirective$:s,values:e});let Ws=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
44
44
  * @license
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
- */const Js=(s,e)=>{var i;const t=s._$AN;if(t===void 0)return!1;for(const r of t)(i=r._$AO)==null||i.call(r,e,!1),Js(r,e);return!0},wr=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while((t==null?void 0:t.size)===0)},SA=s=>{for(let e;e=s._$AM;s=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(s))break;t.add(s),pd(e)}};function fd(s){this._$AN!==void 0?(wr(this),this._$AM=s,SA(this)):this._$AM=s}function Ed(s,e=!1,t=0){const i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(e)if(Array.isArray(i))for(let n=t;n<i.length;n++)Js(i[n],!1),wr(i[n]);else i!=null&&(Js(i,!1),wr(i));else Js(this,s)}const pd=s=>{s.type==ns.CHILD&&(s._$AP??(s._$AP=Ed),s._$AQ??(s._$AQ=fd))};class DA extends Vs{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),SA(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,r;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(r=this.disconnected)==null||r.call(this)),t&&(Js(this,e),wr(this))}setValue(e){if(hd(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
47
+ */const qs=(s,e)=>{var i;const t=s._$AN;if(t===void 0)return!1;for(const r of t)(i=r._$AO)==null||i.call(r,e,!1),qs(r,e);return!0},Dr=s=>{let e,t;do{if((e=s._$AM)===void 0)break;t=e._$AN,t.delete(s),s=e}while((t==null?void 0:t.size)===0)},HA=s=>{for(let e;e=s._$AM;s=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(s))break;t.add(s),Td(e)}};function Rd(s){this._$AN!==void 0?(Dr(this),this._$AM=s,HA(this)):this._$AM=s}function xd(s,e=!1,t=0){const i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(e)if(Array.isArray(i))for(let n=t;n<i.length;n++)qs(i[n],!1),Dr(i[n]);else i!=null&&(qs(i,!1),Dr(i));else qs(this,s)}const Td=s=>{s.type==cs.CHILD&&(s._$AP??(s._$AP=xd),s._$AQ??(s._$AQ=Rd))};class $A extends Ws{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),HA(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,r;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(r=this.disconnected)==null||r.call(this)),t&&(qs(this,e),Dr(this))}setValue(e){if(Qd(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
48
48
  * @license
49
49
  * Copyright 2020 Google LLC
50
50
  * SPDX-License-Identifier: BSD-3-Clause
51
- */const gt=()=>new Id;let Id=class{};const Wn=new WeakMap,ft=os(class extends DA{render(s){return We}update(s,[e]){var i;const t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=(i=s.options)==null?void 0:i.host,this.rt(this.ct=s.element)),We}rt(s){if(typeof this.Y=="function"){const e=this.ht??globalThis;let t=Wn.get(e);t===void 0&&(t=new WeakMap,Wn.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){var s,e;return typeof this.Y=="function"?(s=Wn.get(this.ht??globalThis))==null?void 0:s.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function Cd(s,e,t){function i(r){t.dispatchEvent(new CustomEvent(r.type,r))}return e.addEventListener(s,i),()=>{e.removeEventListener(s,i)}}class md{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=gt(),this.host=e,this._events=t,e.addController(this)}register(){return ft(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(Cd(e,this._forwardElementRef.value,this.host))})})}hostDisconnected(){this._cleanup.forEach(e=>{e()}),this._cleanup=[]}}/**
51
+ */const gt=()=>new Dd;let Dd=class{};const Ao=new WeakMap,ft=us(class extends $A{render(s){return ze}update(s,[e]){var i;const t=e!==this.Y;return t&&this.Y!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.Y=e,this.ht=(i=s.options)==null?void 0:i.host,this.rt(this.ct=s.element)),ze}rt(s){if(typeof this.Y=="function"){const e=this.ht??globalThis;let t=Ao.get(e);t===void 0&&(t=new WeakMap,Ao.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){var s,e;return typeof this.Y=="function"?(s=Ao.get(this.ht??globalThis))==null?void 0:s.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});function Ld(s,e,t){function i(r){t.dispatchEvent(new CustomEvent(r.type,r))}return e.addEventListener(s,i),()=>{e.removeEventListener(s,i)}}class _d{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=gt(),this.host=e,this._events=t,e.addController(this)}register(){return ft(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(Ld(e,this._forwardElementRef.value,this.host))})})}hostDisconnected(){this._cleanup.forEach(e=>{e()}),this._cleanup=[]}}/**
52
52
  * @license
53
53
  * Copyright 2017 Google LLC
54
54
  * SPDX-License-Identifier: BSD-3-Clause
55
- */const Bd=Symbol();class Sr{get taskComplete(){return this.t||(this.status===1?this.t=new Promise((e,t)=>{this.i=e,this.o=t}):this.status===3?this.t=Promise.reject(this.h):this.t=Promise.resolve(this.l)),this.t}constructor(e,t,i){var n;this.u=0,this.status=0,(this.p=e).addController(this);const r=typeof t=="object"?t:{task:t,args:i};this._=r.task,this.v=r.args,this.j=r.argsEqual??yd,this.m=r.onComplete,this.g=r.onError,this.autoRun=r.autoRun??!0,"initialValue"in r&&(this.l=r.initialValue,this.status=2,this.k=(n=this.A)==null?void 0:n.call(this))}hostUpdate(){this.autoRun===!0&&this.O()}hostUpdated(){this.autoRun==="afterUpdate"&&this.O()}A(){if(this.v===void 0)return;const e=this.v();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async O(){const e=this.A(),t=this.k;this.k=e,e===t||e===void 0||t!==void 0&&this.j(t,e)||await this.run(e)}async run(e){var o,a,A,l,c;let t,i;e??(e=this.A()),this.k=e,this.status===1?(o=this.T)==null||o.abort():(this.t=void 0,this.i=void 0,this.o=void 0),this.status=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this.p.requestUpdate()):this.p.requestUpdate();const r=++this.u;this.T=new AbortController;let n=!1;try{t=await this._(e,{signal:this.T.signal})}catch(h){n=!0,i=h}if(this.u===r){if(t===Bd)this.status=0;else{if(n===!1){try{(a=this.m)==null||a.call(this,t)}catch{}this.status=2,(A=this.i)==null||A.call(this,t)}else{try{(l=this.g)==null||l.call(this,i)}catch{}this.status=3,(c=this.o)==null||c.call(this,i)}this.l=t,this.h=i}this.p.requestUpdate()}}abort(e){var t;this.status===1&&((t=this.T)==null||t.abort(e))}get value(){return this.l}get error(){return this.h}render(e){var t,i,r,n;switch(this.status){case 0:return(t=e.initial)==null?void 0:t.call(e);case 1:return(i=e.pending)==null?void 0:i.call(e);case 2:return(r=e.complete)==null?void 0:r.call(e,this.value);case 3:return(n=e.error)==null?void 0:n.call(e,this.error);default:throw Error("Unexpected status: "+this.status)}}}const yd=(s,e)=>s===e||s.length===e.length&&s.every((t,i)=>!yr(t,e[i]));let Dr;const Qd=new Uint8Array(16);function vd(){if(!Dr&&(Dr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Dr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Dr(Qd)}const Et=[];for(let s=0;s<256;++s)Et.push((s+256).toString(16).slice(1));function wd(s,e=0){return Et[s[e+0]]+Et[s[e+1]]+Et[s[e+2]]+Et[s[e+3]]+"-"+Et[s[e+4]]+Et[s[e+5]]+"-"+Et[s[e+6]]+Et[s[e+7]]+"-"+Et[s[e+8]]+Et[s[e+9]]+"-"+Et[s[e+10]]+Et[s[e+11]]+Et[s[e+12]]+Et[s[e+13]]+Et[s[e+14]]+Et[s[e+15]]}const bA={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function xi(s,e,t){if(bA.randomUUID&&!e&&!s)return bA.randomUUID();s=s||{};const i=s.random||(s.rng||vd)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let r=0;r<16;++r)e[t+r]=i[r];return e}return wd(i)}const RA="https://d2rxhdlm2q91uk.cloudfront.net",Sd="https://d1ix11aj5kfygl.cloudfront.net",Dd="https://d157jlwnudd93d.cloudfront.net",xA="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",bd="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",Rd="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",xd="http://localhost:6060/v2",Td="https://embed-dev.vouchfor.com/v2",Ld="https://embed-staging.vouchfor.com/v2",kd="https://embed.vouchfor.com/v2";function br(s){if(!["local","dev","staging","prod"].includes(s))throw new Error(`Unknown environment: ${s}`);if(s==="local")return{videoUrl:RA,publicApiUrl:xA,embedApiUrl:xd};if(s==="dev")return{videoUrl:RA,publicApiUrl:xA,embedApiUrl:Td};if(s==="staging")return{videoUrl:Sd,publicApiUrl:bd,embedApiUrl:Ld};if(s==="prod")return{videoUrl:Dd,publicApiUrl:Rd,embedApiUrl:kd}}class Md{constructor(e){this._fetching=!1,this.getVouch=async(t,i,r)=>{var c;const{embedApiUrl:n}=br(t),o=xi(),a=await fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return this.host.dispatchEvent(new CustomEvent("vouch:loaded",{detail:A==null?void 0:A.id})),((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.getTemplate=async(t,i,r)=>{var c;const{embedApiUrl:n}=br(t),o=xi(),a=await fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.host=e,new Sr(this.host,async([t,i,r,n,o])=>{var a,A,l,c;try{if(e.vouch=void 0,e.template=void 0,r){let h;o&&(this.fetching=!0,h=await this.getTemplate(t,i,o)),this._vouch=r,e.template=h??((A=(a=r==null?void 0:r.settings)==null?void 0:a.template)==null?void 0:A.instance)}else if(n){this.fetching=!0;const[h,u]=await Promise.all([this.getVouch(t,i,n),o?this.getTemplate(t,i,o):null]);this._vouch=h,e.template=u??((c=(l=h==null?void 0:h.settings)==null?void 0:l.template)==null?void 0:c.instance)}}finally{this.fetching=!1}},()=>[e.env,e.apiKey,e.data,e.vouchId,e.templateId]),new Sr(this.host,([t,i])=>{e.vouch=t?{...t,questions:{items:t==null?void 0:t.questions.items.filter((r,n)=>!(i!=null&&i.length)||(i==null?void 0:i.includes(n+1)))}}:void 0},()=>[this._vouch,e.questions])}set fetching(e){this._fetching!==e&&(this._fetching=e,this.host.requestUpdate())}get fetching(){return this._fetching}}const _d=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!Fd(r,n)&&i||Object.defineProperty(s,t,n)},Fd=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},Od=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Nd=(s,e)=>`/* Wrapped ${s}*/
56
- ${e}`,Ud=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Pd=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Gd=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=Nd.bind(null,i,e.toString());Object.defineProperty(r,"name",Pd);const{writable:n,enumerable:o,configurable:a}=Ud;Object.defineProperty(s,"toString",{value:r,writable:n,enumerable:o,configurable:a})};function Hd(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))_d(s,e,r,t);return Od(s,e),Gd(s,e,i),s}const $d=new WeakMap,TA=new WeakMap;function qn(s,{cacheKey:e,cache:t=new Map,maxAge:i}={}){if(i===0)return s;if(typeof i=="number"){if(i>2147483647)throw new TypeError("The `maxAge` option cannot exceed 2147483647.");if(i<0)throw new TypeError("The `maxAge` option should not be a negative number.")}const r=function(...n){var l;const o=e?e(n):n[0],a=t.get(o);if(a)return a.data;const A=s.apply(this,n);if(t.set(o,{data:A,maxAge:i?Date.now()+i:Number.POSITIVE_INFINITY}),typeof i=="number"&&i!==Number.POSITIVE_INFINITY){const c=setTimeout(()=>{t.delete(o)},i);(l=c.unref)==null||l.call(c);const h=TA.get(s)??new Set;h.add(c),TA.set(s,h)}return A};return Hd(r,s,{ignoreNonConfigurable:!0}),$d.set(r,t),r}var Kd=(()=>{var s=jt&&jt.src||new URL("embeds.iife.js",document.baseURI).href;return function(e){e=e||{};var t;t||(t=typeof e<"u"?e:{});var i,r;t.ready=new Promise(function(I,C){i=I,r=C});var n=Object.assign({},t),o="";typeof document<"u"&&document.currentScript&&(o=document.currentScript.src),s&&(o=s),o.indexOf("blob:")!==0?o=o.substr(0,o.replace(/[?#].*/,"").lastIndexOf("/")+1):o="";var a=t.print||console.log.bind(console),A=t.printErr||console.warn.bind(console);Object.assign(t,n),n=null;var l;t.wasmBinary&&(l=t.wasmBinary),t.noExitRuntime,typeof WebAssembly!="object"&&J("no native wasm support detected");var c,h=!1;function u(I,C,x){x=C+x;for(var k="";!(C>=x);){var N=I[C++];if(!N)break;if(N&128){var W=I[C++]&63;if((N&224)==192)k+=String.fromCharCode((N&31)<<6|W);else{var z=I[C++]&63;N=(N&240)==224?(N&15)<<12|W<<6|z:(N&7)<<18|W<<12|z<<6|I[C++]&63,65536>N?k+=String.fromCharCode(N):(N-=65536,k+=String.fromCharCode(55296|N>>10,56320|N&1023))}}else k+=String.fromCharCode(N)}return k}var d,g,f,E,B,S,Q,m,y;function L(){var I=c.buffer;d=I,t.HEAP8=g=new Int8Array(I),t.HEAP16=E=new Int16Array(I),t.HEAP32=S=new Int32Array(I),t.HEAPU8=f=new Uint8Array(I),t.HEAPU16=B=new Uint16Array(I),t.HEAPU32=Q=new Uint32Array(I),t.HEAPF32=m=new Float32Array(I),t.HEAPF64=y=new Float64Array(I)}var v,F=[],G=[],M=[];function H(){var I=t.preRun.shift();F.unshift(I)}var j=0,U=null;function J(I){throw t.onAbort&&t.onAbort(I),I="Aborted("+I+")",A(I),h=!0,I=new WebAssembly.RuntimeError(I+". Build with -sASSERTIONS for more info."),r(I),I}function w(I){return I.startsWith("data:application/octet-stream;base64,")}var D;if(D="data:application/octet-stream;base64,AGFzbQEAAAABrAM2YAF/AGABfwF/YAJ/fwBgA39/fwBgAn98AGACf38Bf2ADf39/AX9gBH9/f30BfWAAAGADf398AGAEf39/fwBgAX8BfGACf38BfGAFf39/f38Bf2AAAX9gA39/fwF9YAZ/f31/fX8AYAJ/fwF9YAV/f39/fwBgAX8BfWADf35/AX5gB39/f39/f38AYAZ/f39/f38AYAR/f39/AX9gBH9/fX8AYAZ/fH9/f38Bf2ACf30AYAR/fHx/AGAIf39/f39/f38AYA1/f39/f39/f39/f39/AGAKf39/f39/f39/fwBgBX9/f39/AXxgBH9/fX0BfWAEfHx/fwF9YA1/fX1/f399fX9/f39/AX9gBn9/fX1/fwBgAn5/AX9gA399fQF9YAN/f30BfWABfAF8YAN/fHwAYAV/f319fQBgBX9/fX19AX1gDX99f31/fX99fX19fX8Bf2ALf39/f39/f319fX0AYAh/f39/f399fQBgBH9/fn4AYAd/f39/f39/AX9gAnx/AXxgBX9/fHx/AGADf39/AXxgBH9/f3wAYAN/f30AYAZ/f31/fX8BfwK1AR4BYQFhABwBYQFiAAMBYQFjAAgBYQFkABUBYQFlABIBYQFmAB0BYQFnAAABYQFoAB4BYQFpAAMB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QIgBEUNACADLQAMIAJB/wFxRg0BCyAFIAEgBiACEDQDQCAALQAAIgFBBHENASAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALcAyIADQALCyADQRBqJAALhQECA38BfgJAIABCgICAgBBUBEAgACEFDAELA0AgAUEBayIBIABCCoAiBUL2AX4gAHynQTByOgAAIABC/////58BViECIAUhACACDQALCyAFpyICBEADQCABQQFrIgEgAkEKbiIDQfYBbCACakEwcjoAACACQQlLIQQgAyECIAQNAAsLIAELNwECf0EEEB4iAiABNgIAQQQQHiIDIAE2AgBB/TkgAEGeOkG6J0G3ASACQZ46Qb4nQbgBIAMQBwteAQF/IABBADYCDCAAIAM2AhACQCABBEAgAUGAgICABE8NASABQQJ0EB4hBAsgACAENgIAIAAgBCACQQJ0aiICNgIIIAAgBCABQQJ0ajYCDCAAIAI2AgQgAA8LEFAAC0cBAX8gAi8ABiIDQQdxBEAgACABQegAaiADEB8PCyABQegAaiEBIAIvAA4iA0EHcQRAIAAgASADEB8PCyAAIAEgAi8AEBAfC0cBAX8gAi8AAiIDQQdxBEAgACABQegAaiADEB8PCyABQegAaiEBIAIvAA4iA0EHcQRAIAAgASADEB8PCyAAIAEgAi8AEBAfC3sAAkACQAJAAkAgA0EBaw4CAAECCyACLwAKIgNBB3FFDQEMAgsgAi8ACCIDQQdxRQ0ADAELIAIvAAQiA0EHcQRADAELIAFB6ABqIQEgAi8ADCIDQQdxBEAgACABIAMQHw8LIAAgASACLwAQEB8PCyAAIAFB6ABqIAMQHwt7AAJAAkACQAJAIANBAWsOAgABAgsgAi8ACCIDQQdxRQ0BDAILIAIvAAoiA0EHcUUNAAwBCyACLwAAIgNBB3EEQAwBCyABQegAaiEBIAIvAAwiA0EHcQRAIAAgASADEB8PCyAAIAEgAi8AEBAfDwsgACABQegAaiADEB8LnAoBC38jAEEQayIIJAAgASABLwAAQXhxIANyIgM7AAACQAJAAkACQAJAAkACQAJAAkACQCADQQhxBEAgA0H//wNx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ANBEGokACAIC1AAAkACQAJAAkACQCACDgQEAAECAwsgACABIAFBMGoQRA8LIAAgASABQTBqIAMQRQ8LIAAgASABQTBqEEMPCxAnAAsgACABIAFBMGogAxBGC3kCAX8BfSMAQRBrIgMkACADQQhqIAAgAUECdEGwJGooAgAgAhBMQwAAwH8hBAJAAkACQCADLQAMQQFrDgIAAQILIAMqAgghBAwBCyADKgIIQwAAAACUQwrXIzyUIQQLIANBEGokACAEQwAAAACXQwAAAAAgBCAEWxsLVAACQAJAAkACQAJAIAIOBAQAAQIDCyAAIAEgAUHCAGoQRA8LIAAgASABQcIAaiADEEUPCyAAIAEgAUHCAGoQQw8LECcACyAAIAEgAUHCAGogAxBGC84BAgN/An0jAEEQayIDJABBASEEIANBCGogAEH8AGoiBSAAIAFBAXRqQfYAaiIBLwEAEB8CQAJAIAMqAggiByACKgIAIgZcBEAgByAHWwRAIAItAAQhAgwCCyAGIAZcIQQLIAItAAQhAiAERQ0AIAMtAAwgAkH/AXFGDQELIAUgASAGIAIQNANAIAAtAAAiAUEEcQ0BIAAgAUEEcjoAACAAKAIQIgEEQCAAIAERAAALIABBgICA/gc2ApwBIAAoAtwDIgANAAsLIANBEGokAAvOAQIDfwJ9IwBBEGsiAyQAQQEhBCADQQhqIABB/ABqIgUgACABQQF0akHyAGoiAS8BABAfAkACQCADKgIIIgcgAioCACIGXARAIAcgB1sEQCACLQAEIQIMAgsgBiAGXCEECyACLQAEIQIgBEUNACADLQAMIAJB/wFxRg0BCyAFIAEgBiACEDQDQCAALQAAIgFBBHENASAAIAFBBHI6AAAgACgCECIBBEAgACABEQAACyAAQYCAgP4HNgKcASAAKALcAyIADQALCyADQRBqJAALCgAgAEEwa0EKSQsFABACAAsEACAACxQAIAAEQCAAIAAoAgAoAgQRAAALCysBAX8gACgCDCIBBEAgARAoCyAAKAIAIgEEQCAAIAE2AgQgARAoCyAAECgL8QMBA38jAEEQayIDJAAgAEIANwIEIABBwSA7ABUgAEIANwIMIABCgICAgICAgAI3A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sgCCAAECAiCiAHIAUvAHoQICILWw0BIAogClsNACALIAtcDQELIAFBFGogBUEUakHoABAsGiABQfwAaiAFQfwAahCUAQNAIAEtAAAiAEEEcQ0BIAEgAEEEcjoAACABKAIQIgAEQCABIAARAAALIAFBgICA/gc2ApwBIAEoAtwDIgENAAsLIAJBEGokAAu8AwEEfyMAQaAEayICJAAgACgCBCEBIABBADYCBCABBEAgASABKAIAKAIEEQAACyAAKAIIIQEgAEEANgIIIAEEQCABIAEoAgAoAgQRAAALAkAgACgCACIAKALkAyAAKALgA0YEQCAAKALcAw0BIAAgAkEgaiAAKALsAxBUIgEpAgA3AgAgACABKAIQNgIQIAAgASkCCDcCCCAAQRRqIAFBFGpB6AAQLBogACABKQKMATcCjAEgACABKQKEATcChAEgACABKQJ8NwJ8IAEoApQBIQQgAUEANgKUASAAKAKUASEDIAAgBDYClAEgAwRAIAMQUwsgAEGYAWogAUGYAWpByAIQLBogACgC4AMiAwRAIAAgAzYC5AMgAxAoCyAAIAEoAuADNgLgAyAAIAEoAuQDNgLkAyAAIAEoAugDNgLoAyABQQA2AugDIAFCADcC4AMgACABKQL0AzcC9AMgACABKQLsAzcC7AMgACABKAL8AzYC/AMgASgClAEhACABQQA2ApQBIAAEQCAAEFMLIAJBoARqJAAPCyACQYIcNgIQIAAgAkEQahAwECcACyACQcsRNgIAIAAgAhAwECcACwoAQQwQHiAAEGULCgBBDBAeQQAQZQsNACAAKAIALQAIQQFxCwoAIAAoAgAoAhALGQAgAUH/AXEEQBACAAsgACgCACgCDEEBcQsYACAAKAIAIgAgAC0ACEH+AXEgAXI6AAgLDAAgACgCACABNgIQC3oBAn8jAEEQayICJAAgACgCACEAIAFDAAAAAGBFBEAgAkHdEzYCACMAQRBrIgMkACADIAI2AgwCQCAARQRAQfguQZwkIAIQOhoMAQsgAEEAQQVBnCQgAiAAKAIEEQ0AGgsgA0EQaiQAECcACyAAIAE4AhQgAkEQaiQACyMAIAFB/wFxBEAQAgALIAAoAgAiACAAKAIMQX5xIAJyNgIMCz4BAn9BBBAeIQFBHBAeIgBCgICA/AM3AhQgAEIANwIMIABBADoACCAAQQA2AgAgAEEDNgIEIAEgADYCACABCyMAIAJBBUdBACACG0UEQEH4LiADIAQQOg8LQYgwIAMgBBA6CyIBAX4gASACrSADrUIghoQgBCAAERQAIgVCIIinJAEgBacLqAEBBX8gACgCVCIDKAIAIQUgAygCBCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhAsGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBAsGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAgICA+P8AIQIgBEL///////+//8MAVg0AQgAhAiAEQjCIpyIAQZH3AEkNACADIQIgBkL///////8/g0KAgICAgIDAAIQiBSEHAkAgAEGB9wBrIgFBwABxBEAgAiABQUBqrYYhB0IAIQIMAQsgAUUNACAHIAGtIgSGIAJBwAAgAWutiIQhByACIASGIQILIAggAjcDECAIIAc3AxgCQEGB+AAgAGsiAEHAAHEEQCAFIABBQGqtiCEDQgAhBQwBCyAARQ0AIAVBwAAgAGuthiADIACtIgKIhCEDIAUgAoghBQsgCCADNwMAIAggBTcDCCAIKQMIQgSGIAgpAwAiA0I8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ACyEBIAYoAgwhAyAAIAEpAwA3AwAgACABKQMINwMIIAMQESAGQTBqJAALCQAgABCEARAoCwwAIAAoAghB+hsQXAsJACAAEIYBECgLVQECfyMAQTBrIgIkACABIAAoAgQiA0EBdWohASAAKAIAIQAgAiABIANBAXEEfyABKAIAIABqKAIABSAACxECAEEwEB4gAkEwECwhACACQTBqJAAgAAs7AQF/IAEgACgCBCIFQQF1aiEBIAAoAgAhACABIAIgAyAEIAVBAXEEfyABKAIAIABqKAIABSAACxEbAAs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALEREACzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRDAALNQEBfyABIAAoAgQiAkEBdWohASAAKAIAIQAgASACQQFxBH8gASgCACAAaigCAAUgAAsRCwALYQECfyMAQRBrIgIkACABIAAoAgQiA0EBdWohASAAKAIAIQAgAiABIANBAXEEfyABKAIAIABqKAIABSAACxECAEEQEB4iACACKQMINwMIIAAgAikDADcDACACQRBqJAAgAAtjAQJ/IwBBEGsiAyQAIAEgACgCBCIEQQF1aiEBIAAoAgAhACADIAEgAiAEQQFxBH8gASgCACAAaigCAAUgAAsRAwBBEBAeIgAgAykDCDcDCCAAIAMpAwA3AwAgA0EQaiQAIAALNwEBfyABIAAoAgQiA0EBdWohASAAKAIAIQAgASACIANBAXEEfyABKAIAIABqKAIABSAACxEEAAs5AQF/IAEgACgCBCIEQQF1aiEBIAAoAgAhACABIAIgAyAEQQFxBH8gASgCACAAaigCAAUgAAsRCQALCQAgASAAEQEACwUAQf85Cw8AIAEgACgCAGogAjYCAAsNACABIAAoAgBqKAIACxgBAX9BEBAeIgBCADcDCCAAQQA2AgAgAAsYAQF/QRAQHiIAQgA3AwAgAEIANwMIIAALDABBMBAeQQBBMBAvCzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCA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jM0NTY3ODlBQkNERUYAQYQuCwHKAEGsLgsI//////////8AQfAuCwlQIQEAAAAAAAUAQYQvCwHFAEGcLwsKxgAAAMcAAAA4HQBBtC8LAQIAQcQvCwj//////////wBBiDALAQUAQZQwCwHIAEGsMAsOxgAAAMkAAABIHQAAAAQAQcQwCwEBAEHUMAsF/////woAQZgxCwHL",!w(D)){var X=D;D=t.locateFile?t.locateFile(X,o):o+X}function R(){var I=D;try{if(I==D&&l)return new Uint8Array(l);if(w(I))try{var C=zB(I.slice(37)),x=new Uint8Array(C.length);for(I=0;I<C.length;++I)x[I]=C.charCodeAt(I);var k=x}catch{throw Error("Converting base64 string to bytes failed.")}else k=void 0;var N=k;if(N)return N;throw"both async and sync fetching of the wasm failed"}catch(W){J(W)}}function b(){return l||typeof fetch!="function"?Promise.resolve().then(function(){return R()}):fetch(D,{credentials:"same-origin"}).then(function(I){if(!I.ok)throw"failed to load wasm binary file at '"+D+"'";return I.arrayBuffer()}).catch(function(){return R()})}function T(I){for(;0<I.length;)I.shift()(t)}function K(I){if(I===void 0)return"_unknown";I=I.replace(/[^a-zA-Z0-9_]/g,"$");var C=I.charCodeAt(0);return 48<=C&&57>=C?"_"+I:I}function P(I,C){return I=K(I),function(){return C.apply(this,arguments)}}var q=[{},{value:void 0},{value:null},{value:!0},{value:!1}],ie=[];function ce(I){var C=Error,x=P(I,function(k){this.name=I,this.message=k,k=Error(k).stack,k!==void 0&&(this.stack=this.toString()+`
57
- `+k.replace(/^Error(:[^\n]*)?\n/,""))});return x.prototype=Object.create(C.prototype),x.prototype.constructor=x,x.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},x}var he=void 0;function se(I){throw new he(I)}var Qe=I=>(I||se("Cannot use deleted val. handle = "+I),q[I].value),Se=I=>{switch(I){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var C=ie.length?ie.pop():q.length;return q[C]={ga:1,value:I},C}},Me=void 0,de=void 0;function oe(I){for(var C="";f[I];)C+=de[f[I++]];return C}var ne=[];function we(){for(;ne.length;){var I=ne.pop();I.M.$=!1,I.delete()}}var pe=void 0,Re={};function De(I,C){for(C===void 0&&se("ptr should not be undefined");I.R;)C=I.ba(C),I=I.R;return C}var Le={};function qe(I){I=Yu(I);var C=oe(I);return Di(I),C}function Oe(I,C){var x=Le[I];return x===void 0&&se(C+" has unknown type "+qe(I)),x}function Ke(){}var ve=!1;function Ye(I){--I.count.value,I.count.value===0&&(I.T?I.U.W(I.T):I.P.N.W(I.O))}function dt(I,C,x){return C===x?I:x.R===void 0?null:(I=dt(I,C,x.R),I===null?null:x.na(I))}var Tt={};function nt(I,C){return C=De(I,C),Re[C]}var Ct=void 0;function Jt(I){throw new Ct(I)}function ot(I,C){return C.P&&C.O||Jt("makeClassHandle requires ptr and ptrType"),!!C.U!=!!C.T&&Jt("Both smartPtrType and smartPtr must be specified"),C.count={value:1},bt(Object.create(I,{M:{value:C}}))}function bt(I){return typeof FinalizationRegistry>"u"?(bt=C=>C,I):(ve=new FinalizationRegistry(C=>{Ye(C.M)}),bt=C=>{var x=C.M;return x.T&&ve.register(C,{M:x},C),C},Ke=C=>{ve.unregister(C)},bt(I))}var ui={};function wi(I){for(;I.length;){var C=I.pop();I.pop()(C)}}function mt(I){return this.fromWireType(S[I>>2])}var Y={},le={};function ue(I,C,x){function k(ee){ee=x(ee),ee.length!==I.length&&Jt("Mismatched type converter count");for(var re=0;re<I.length;++re)Be(I[re],ee[re])}I.forEach(function(ee){le[ee]=C});var N=Array(C.length),W=[],z=0;C.forEach((ee,re)=>{Le.hasOwnProperty(ee)?N[re]=Le[ee]:(W.push(ee),Y.hasOwnProperty(ee)||(Y[ee]=[]),Y[ee].push(()=>{N[re]=Le[ee],++z,z===W.length&&k(N)}))}),W.length===0&&k(N)}function xe(I){switch(I){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+I)}}function Be(I,C,x={}){if(!("argPackAdvance"in C))throw new TypeError("registerType registeredInstance requires argPackAdvance");var k=C.name;if(I||se('type "'+k+'" must have a positive integer typeid pointer'),Le.hasOwnProperty(I)){if(x.ua)return;se("Cannot register type '"+k+"' twice")}Le[I]=C,delete le[I],Y.hasOwnProperty(I)&&(C=Y[I],delete Y[I],C.forEach(N=>N()))}function at(I){se(I.M.P.N.name+" instance already deleted")}function je(){}function di(I,C,x){if(I[C].S===void 0){var k=I[C];I[C]=function(){return I[C].S.hasOwnProperty(arguments.length)||se("Function '"+x+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+I[C].S+")!"),I[C].S[arguments.length].apply(this,arguments)},I[C].S=[],I[C].S[k.Z]=k}}function Mn(I,C){t.hasOwnProperty(I)?(se("Cannot register public name '"+I+"' twice"),di(t,I,I),t.hasOwnProperty(void 0)&&se("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),t[I].S[void 0]=C):t[I]=C}function Si(I,C,x,k,N,W,z,ee){this.name=I,this.constructor=C,this.X=x,this.W=k,this.R=N,this.pa=W,this.ba=z,this.na=ee,this.ja=[]}function is(I,C,x){for(;C!==x;)C.ba||se("Expected null or instance of "+x.name+", got an instance of "+C.name),I=C.ba(I),C=C.R;return I}function _s(I,C){return C===null?(this.ea&&se("null is not a valid "+this.name),0):(C.M||se('Cannot pass "'+iA(C)+'" as a '+this.name),C.M.O||se("Cannot pass deleted object as a pointer of type "+this.name),is(C.M.O,C.M.P.N,this.N))}function Ni(I,C){if(C===null){if(this.ea&&se("null is not a valid "+this.name),this.da){var x=this.fa();return I!==null&&I.push(this.W,x),x}return 0}if(C.M||se('Cannot pass "'+iA(C)+'" as a '+this.name),C.M.O||se("Cannot pass deleted object as a pointer of type "+this.name),!this.ca&&C.M.P.ca&&se("Cannot convert argument of type "+(C.M.U?C.M.U.name:C.M.P.name)+" to parameter type "+this.name),x=is(C.M.O,C.M.P.N,this.N),this.da)switch(C.M.T===void 0&&se("Passing raw pointer to smart pointer is illegal"),this.Ba){case 0:C.M.U===this?x=C.M.T:se("Cannot convert argument of type "+(C.M.U?C.M.U.name:C.M.P.name)+" to parameter type "+this.name);break;case 1:x=C.M.T;break;case 2:if(C.M.U===this)x=C.M.T;else{var k=C.clone();x=this.xa(x,Se(function(){k.delete()})),I!==null&&I.push(this.W,x)}break;default:se("Unsupporting sharing policy")}return x}function Za(I,C){return C===null?(this.ea&&se("null is not a valid "+this.name),0):(C.M||se('Cannot pass "'+iA(C)+'" as a '+this.name),C.M.O||se("Cannot pass deleted object as a pointer of type "+this.name),C.M.P.ca&&se("Cannot convert argument of type "+C.M.P.name+" to parameter type "+this.name),is(C.M.O,C.M.P.N,this.N))}function Lt(I,C,x,k){this.name=I,this.N=C,this.ea=x,this.ca=k,this.da=!1,this.W=this.xa=this.fa=this.ka=this.Ba=this.wa=void 0,C.R!==void 0?this.toWireType=Ni:(this.toWireType=k?_s:Za,this.V=null)}function Fs(I,C){t.hasOwnProperty(I)||Jt("Replacing nonexistant public symbol"),t[I]=C,t[I].Z=void 0}function PB(I,C){var x=[];return function(){if(x.length=0,Object.assign(x,arguments),I.includes("j")){var k=t["dynCall_"+I];k=x&&x.length?k.apply(null,[C].concat(x)):k.call(null,C)}else k=v.get(C).apply(null,x);return k}}function Wt(I,C){I=oe(I);var x=I.includes("j")?PB(I,C):v.get(C);return typeof x!="function"&&se("unknown function pointer with signature "+I+": "+C),x}var Gu=void 0;function _n(I,C){function x(W){N[W]||Le[W]||(le[W]?le[W].forEach(x):(k.push(W),N[W]=!0))}var k=[],N={};throw C.forEach(x),new Gu(I+": "+k.map(qe).join([", "]))}function za(I,C,x,k,N){var W=C.length;2>W&&se("argTypes array size mismatch! Must at least get return value and 'this' types!");var z=C[1]!==null&&x!==null,ee=!1;for(x=1;x<C.length;++x)if(C[x]!==null&&C[x].V===void 0){ee=!0;break}var re=C[0].name!=="void",te=W-2,ae=Array(te),Ce=[],ke=[];return function(){if(arguments.length!==te&&se("function "+I+" called with "+arguments.length+" arguments, expected "+te+" args!"),ke.length=0,Ce.length=z?2:1,Ce[0]=N,z){var tt=C[1].toWireType(ke,this);Ce[1]=tt}for(var Ne=0;Ne<te;++Ne)ae[Ne]=C[Ne+2].toWireType(ke,arguments[Ne]),Ce.push(ae[Ne]);if(Ne=k.apply(null,Ce),ee)wi(ke);else for(var kt=z?1:2;kt<C.length;kt++){var qt=kt===1?tt:ae[kt-2];C[kt].V!==null&&C[kt].V(qt)}return tt=re?C[0].fromWireType(Ne):void 0,tt}}function eA(I,C){for(var x=[],k=0;k<I;k++)x.push(Q[C+4*k>>2]);return x}function tA(I){4<I&&--q[I].ga===0&&(q[I]=void 0,ie.push(I))}function iA(I){if(I===null)return"null";var C=typeof I;return C==="object"||C==="array"||C==="function"?I.toString():""+I}function GB(I,C){switch(C){case 2:return function(x){return this.fromWireType(m[x>>2])};case 3:return function(x){return this.fromWireType(y[x>>3])};default:throw new TypeError("Unknown float type: "+I)}}function HB(I,C,x){switch(C){case 0:return x?function(k){return g[k]}:function(k){return f[k]};case 1:return x?function(k){return E[k>>1]}:function(k){return B[k>>1]};case 2:return x?function(k){return S[k>>2]}:function(k){return Q[k>>2]};default:throw new TypeError("Unknown integer type: "+I)}}function $B(I,C){for(var x="",k=0;!(k>=C/2);++k){var N=E[I+2*k>>1];if(N==0)break;x+=String.fromCharCode(N)}return x}function KB(I,C,x){if(x===void 0&&(x=2147483647),2>x)return 0;x-=2;var k=C;x=x<2*I.length?x/2:I.length;for(var N=0;N<x;++N)E[C>>1]=I.charCodeAt(N),C+=2;return E[C>>1]=0,C-k}function YB(I){return 2*I.length}function VB(I,C){for(var x=0,k="";!(x>=C/4);){var N=S[I+4*x>>2];if(N==0)break;++x,65536<=N?(N-=65536,k+=String.fromCharCode(55296|N>>10,56320|N&1023)):k+=String.fromCharCode(N)}return k}function JB(I,C,x){if(x===void 0&&(x=2147483647),4>x)return 0;var k=C;x=k+x-4;for(var N=0;N<I.length;++N){var W=I.charCodeAt(N);if(55296<=W&&57343>=W){var z=I.charCodeAt(++N);W=65536+((W&1023)<<10)|z&1023}if(S[C>>2]=W,C+=4,C+4>x)break}return S[C>>2]=0,C-k}function WB(I){for(var C=0,x=0;x<I.length;++x){var k=I.charCodeAt(x);55296<=k&&57343>=k&&++x,C+=4}return C}var qB={};function Hu(I){var C=qB[I];return C===void 0?oe(I):C}var Fn=[];function jB(I){var C=Fn.length;return Fn.push(I),C}function XB(I,C){for(var x=Array(I),k=0;k<I;++k)x[k]=Oe(Q[C+4*k>>2],"parameter "+k);return x}var $u=[],ZB=[null,[],[]];he=t.BindingError=ce("BindingError"),t.count_emval_handles=function(){for(var I=0,C=5;C<q.length;++C)q[C]!==void 0&&++I;return I},t.get_first_emval=function(){for(var I=5;I<q.length;++I)if(q[I]!==void 0)return q[I];return null},Me=t.PureVirtualError=ce("PureVirtualError");for(var Ku=Array(256),On=0;256>On;++On)Ku[On]=String.fromCharCode(On);de=Ku,t.getInheritedInstanceCount=function(){return Object.keys(Re).length},t.getLiveInheritedInstances=function(){var I=[],C;for(C in Re)Re.hasOwnProperty(C)&&I.push(Re[C]);return I},t.flushPendingDeletes=we,t.setDelayFunction=function(I){pe=I,ne.length&&pe&&pe(we)},Ct=t.InternalError=ce("InternalError"),je.prototype.isAliasOf=function(I){if(!(this instanceof je&&I instanceof je))return!1;var C=this.M.P.N,x=this.M.O,k=I.M.P.N;for(I=I.M.O;C.R;)x=C.ba(x),C=C.R;for(;k.R;)I=k.ba(I),k=k.R;return C===k&&x===I},je.prototype.clone=function(){if(this.M.O||at(this),this.M.aa)return this.M.count.value+=1,this;var I=bt,C=Object,x=C.create,k=Object.getPrototypeOf(this),N=this.M;return I=I(x.call(C,k,{M:{value:{count:N.count,$:N.$,aa:N.aa,O:N.O,P:N.P,T:N.T,U:N.U}}})),I.M.count.value+=1,I.M.$=!1,I},je.prototype.delete=function(){this.M.O||at(this),this.M.$&&!this.M.aa&&se("Object already scheduled for deletion"),Ke(this),Ye(this.M),this.M.aa||(this.M.T=void 0,this.M.O=void 0)},je.prototype.isDeleted=function(){return!this.M.O},je.prototype.deleteLater=function(){return this.M.O||at(this),this.M.$&&!this.M.aa&&se("Object already scheduled for deletion"),ne.push(this),ne.length===1&&pe&&pe(we),this.M.$=!0,this},Lt.prototype.qa=function(I){return this.ka&&(I=this.ka(I)),I},Lt.prototype.ha=function(I){this.W&&this.W(I)},Lt.prototype.argPackAdvance=8,Lt.prototype.readValueFromPointer=mt,Lt.prototype.deleteObject=function(I){I!==null&&I.delete()},Lt.prototype.fromWireType=function(I){function C(){return this.da?ot(this.N.X,{P:this.wa,O:x,U:this,T:I}):ot(this.N.X,{P:this,O:I})}var x=this.qa(I);if(!x)return this.ha(I),null;var k=nt(this.N,x);if(k!==void 0)return k.M.count.value===0?(k.M.O=x,k.M.T=I,k.clone()):(k=k.clone(),this.ha(I),k);if(k=this.N.pa(x),k=Tt[k],!k)return C.call(this);k=this.ca?k.la:k.pointerType;var N=dt(x,this.N,k.N);return N===null?C.call(this):this.da?ot(k.N.X,{P:k,O:N,U:this,T:I}):ot(k.N.X,{P:k,O:N})},Gu=t.UnboundTypeError=ce("UnboundTypeError");var zB=typeof atob=="function"?atob:function(I){var C="",x=0;I=I.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++)),N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++)),W="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++)),z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(x++));k=k<<2|N>>4,N=(N&15)<<4|W>>2;var ee=(W&3)<<6|z;C+=String.fromCharCode(k),W!==64&&(C+=String.fromCharCode(N)),z!==64&&(C+=String.fromCharCode(ee))}while(x<I.length);return C},ey={l:function(I,C,x,k){J("Assertion failed: "+(I?u(f,I):"")+", at: "+[C?C?u(f,C):"":"unknown filename",x,k?k?u(f,k):"":"unknown function"])},q:function(I,C,x){I=oe(I),C=Oe(C,"wrapper"),x=Qe(x);var k=[].slice,N=C.N,W=N.X,z=N.R.X,ee=N.R.constructor;I=P(I,function(){N.R.ja.forEach((function(te){if(this[te]===z[te])throw new Me("Pure virtual function "+te+" must be implemented in JavaScript")}).bind(this)),Object.defineProperty(this,"__parent",{value:W}),this.__construct.apply(this,k.call(arguments))}),W.__construct=function(){this===W&&se("Pass correct 'this' to __construct");var te=ee.implement.apply(void 0,[this].concat(k.call(arguments)));Ke(te);var ae=te.M;te.notifyOnDestruction(),ae.aa=!0,Object.defineProperties(this,{M:{value:ae}}),bt(this),te=ae.O,te=De(N,te),Re.hasOwnProperty(te)?se("Tried to register registered instance: "+te):Re[te]=this},W.__destruct=function(){this===W&&se("Pass correct 'this' to __destruct"),Ke(this);var te=this.M.O;te=De(N,te),Re.hasOwnProperty(te)?delete Re[te]:se("Tried to unregister unregistered instance: "+te)},I.prototype=Object.create(W);for(var re in x)I.prototype[re]=x[re];return Se(I)},j:function(I){var C=ui[I];delete ui[I];var x=C.fa,k=C.W,N=C.ia,W=N.map(z=>z.ta).concat(N.map(z=>z.za));ue([I],W,z=>{var ee={};return N.forEach((re,te)=>{var ae=z[te],Ce=re.ra,ke=re.sa,tt=z[te+N.length],Ne=re.ya,kt=re.Aa;ee[re.oa]={read:qt=>ae.fromWireType(Ce(ke,qt)),write:(qt,Cr)=>{var bi=[];Ne(kt,qt,tt.toWireType(bi,Cr)),wi(bi)}}}),[{name:C.name,fromWireType:function(re){var te={},ae;for(ae in ee)te[ae]=ee[ae].read(re);return k(re),te},toWireType:function(re,te){for(var ae in ee)if(!(ae in te))throw new TypeError('Missing field: "'+ae+'"');var Ce=x();for(ae in ee)ee[ae].write(Ce,te[ae]);return re!==null&&re.push(k,Ce),Ce},argPackAdvance:8,readValueFromPointer:mt,V:k}]})},v:function(){},B:function(I,C,x,k,N){var W=xe(x);C=oe(C),Be(I,{name:C,fromWireType:function(z){return!!z},toWireType:function(z,ee){return ee?k:N},argPackAdvance:8,readValueFromPointer:function(z){if(x===1)var ee=g;else if(x===2)ee=E;else if(x===4)ee=S;else throw new TypeError("Unknown boolean type size: "+C);return this.fromWireType(ee[z>>W])},V:null})},f:function(I,C,x,k,N,W,z,ee,re,te,ae,Ce,ke){ae=oe(ae),W=Wt(N,W),ee&&(ee=Wt(z,ee)),te&&(te=Wt(re,te)),ke=Wt(Ce,ke);var tt=K(ae);Mn(tt,function(){_n("Cannot construct "+ae+" due to unbound types",[k])}),ue([I,C,x],k?[k]:[],function(Ne){if(Ne=Ne[0],k)var kt=Ne.N,qt=kt.X;else qt=je.prototype;Ne=P(tt,function(){if(Object.getPrototypeOf(this)!==Cr)throw new he("Use 'new' to construct "+ae);if(bi.Y===void 0)throw new he(ae+" has no accessible constructor");var Wu=bi.Y[arguments.length];if(Wu===void 0)throw new he("Tried to invoke ctor of "+ae+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(bi.Y).toString()+") parameters instead!");return Wu.apply(this,arguments)});var Cr=Object.create(qt,{constructor:{value:Ne}});Ne.prototype=Cr;var bi=new Si(ae,Ne,Cr,ke,kt,W,ee,te);kt=new Lt(ae,bi,!0,!1),qt=new Lt(ae+"*",bi,!1,!1);var Ju=new Lt(ae+" const*",bi,!1,!0);return Tt[I]={pointerType:qt,la:Ju},Fs(tt,Ne),[kt,qt,Ju]})},d:function(I,C,x,k,N,W,z){var ee=eA(x,k);C=oe(C),W=Wt(N,W),ue([],[I],function(re){function te(){_n("Cannot call "+ae+" due to unbound types",ee)}re=re[0];var ae=re.name+"."+C;C.startsWith("@@")&&(C=Symbol[C.substring(2)]);var Ce=re.N.constructor;return Ce[C]===void 0?(te.Z=x-1,Ce[C]=te):(di(Ce,C,ae),Ce[C].S[x-1]=te),ue([],ee,function(ke){return ke=za(ae,[ke[0],null].concat(ke.slice(1)),null,W,z),Ce[C].S===void 0?(ke.Z=x-1,Ce[C]=ke):Ce[C].S[x-1]=ke,[]}),[]})},p:function(I,C,x,k,N,W){0<C||J();var z=eA(C,x);N=Wt(k,N),ue([],[I],function(ee){ee=ee[0];var re="constructor "+ee.name;if(ee.N.Y===void 0&&(ee.N.Y=[]),ee.N.Y[C-1]!==void 0)throw new he("Cannot register multiple constructors with identical number of parameters ("+(C-1)+") for class '"+ee.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return ee.N.Y[C-1]=()=>{_n("Cannot construct "+ee.name+" due to unbound types",z)},ue([],z,function(te){return te.splice(1,0,null),ee.N.Y[C-1]=za(re,te,null,N,W),[]}),[]})},a:function(I,C,x,k,N,W,z,ee){var re=eA(x,k);C=oe(C),W=Wt(N,W),ue([],[I],function(te){function ae(){_n("Cannot call "+Ce+" due to unbound types",re)}te=te[0];var Ce=te.name+"."+C;C.startsWith("@@")&&(C=Symbol[C.substring(2)]),ee&&te.N.ja.push(C);var ke=te.N.X,tt=ke[C];return tt===void 0||tt.S===void 0&&tt.className!==te.name&&tt.Z===x-2?(ae.Z=x-2,ae.className=te.name,ke[C]=ae):(di(ke,C,Ce),ke[C].S[x-2]=ae),ue([],re,function(Ne){return Ne=za(Ce,Ne,te,W,z),ke[C].S===void 0?(Ne.Z=x-2,ke[C]=Ne):ke[C].S[x-2]=Ne,[]}),[]})},A:function(I,C){C=oe(C),Be(I,{name:C,fromWireType:function(x){var k=Qe(x);return tA(x),k},toWireType:function(x,k){return Se(k)},argPackAdvance:8,readValueFromPointer:mt,V:null})},n:function(I,C,x){x=xe(x),C=oe(C),Be(I,{name:C,fromWireType:function(k){return k},toWireType:function(k,N){return N},argPackAdvance:8,readValueFromPointer:GB(C,x),V:null})},e:function(I,C,x,k,N){C=oe(C),N===-1&&(N=4294967295),N=xe(x);var W=ee=>ee;if(k===0){var z=32-8*x;W=ee=>ee<<z>>>z}x=C.includes("unsigned")?function(ee,re){return re>>>0}:function(ee,re){return re},Be(I,{name:C,fromWireType:W,toWireType:x,argPackAdvance:8,readValueFromPointer:HB(C,N,k!==0),V:null})},b:function(I,C,x){function k(W){W>>=2;var z=Q;return new N(d,z[W+1],z[W])}var N=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][C];x=oe(x),Be(I,{name:x,fromWireType:k,argPackAdvance:8,readValueFromPointer:k},{ua:!0})},o:function(I,C){C=oe(C);var x=C==="std::string";Be(I,{name:C,fromWireType:function(k){var N=Q[k>>2],W=k+4;if(x)for(var z=W,ee=0;ee<=N;++ee){var re=W+ee;if(ee==N||f[re]==0){if(z=z?u(f,z,re-z):"",te===void 0)var te=z;else te+="\0",te+=z;z=re+1}}else{for(te=Array(N),ee=0;ee<N;++ee)te[ee]=String.fromCharCode(f[W+ee]);te=te.join("")}return Di(k),te},toWireType:function(k,N){N instanceof ArrayBuffer&&(N=new Uint8Array(N));var W,z=typeof N=="string";if(z||N instanceof Uint8Array||N instanceof Uint8ClampedArray||N instanceof Int8Array||se("Cannot pass non-string to std::string"),x&&z){var ee=0;for(W=0;W<N.length;++W){var re=N.charCodeAt(W);127>=re?ee++:2047>=re?ee+=2:55296<=re&&57343>=re?(ee+=4,++W):ee+=3}W=ee}else W=N.length;if(ee=sA(4+W+1),re=ee+4,Q[ee>>2]=W,x&&z){if(z=re,re=W+1,W=f,0<re){re=z+re-1;for(var te=0;te<N.length;++te){var ae=N.charCodeAt(te);if(55296<=ae&&57343>=ae){var Ce=N.charCodeAt(++te);ae=65536+((ae&1023)<<10)|Ce&1023}if(127>=ae){if(z>=re)break;W[z++]=ae}else{if(2047>=ae){if(z+1>=re)break;W[z++]=192|ae>>6}else{if(65535>=ae){if(z+2>=re)break;W[z++]=224|ae>>12}else{if(z+3>=re)break;W[z++]=240|ae>>18,W[z++]=128|ae>>12&63}W[z++]=128|ae>>6&63}W[z++]=128|ae&63}}W[z]=0}}else if(z)for(z=0;z<W;++z)te=N.charCodeAt(z),255<te&&(Di(re),se("String has UTF-16 code units that do not fit in 8 bits")),f[re+z]=te;else for(z=0;z<W;++z)f[re+z]=N[z];return k!==null&&k.push(Di,ee),ee},argPackAdvance:8,readValueFromPointer:mt,V:function(k){Di(k)}})},i:function(I,C,x){if(x=oe(x),C===2)var k=$B,N=KB,W=YB,z=()=>B,ee=1;else C===4&&(k=VB,N=JB,W=WB,z=()=>Q,ee=2);Be(I,{name:x,fromWireType:function(re){for(var te=Q[re>>2],ae=z(),Ce,ke=re+4,tt=0;tt<=te;++tt){var Ne=re+4+tt*C;(tt==te||ae[Ne>>ee]==0)&&(ke=k(ke,Ne-ke),Ce===void 0?Ce=ke:(Ce+="\0",Ce+=ke),ke=Ne+C)}return Di(re),Ce},toWireType:function(re,te){typeof te!="string"&&se("Cannot pass non-string to C++ string type "+x);var ae=W(te),Ce=sA(4+ae+C);return Q[Ce>>2]=ae>>ee,N(te,Ce+4,ae+C),re!==null&&re.push(Di,Ce),Ce},argPackAdvance:8,readValueFromPointer:mt,V:function(re){Di(re)}})},k:function(I,C,x,k,N,W){ui[I]={name:oe(C),fa:Wt(x,k),W:Wt(N,W),ia:[]}},h:function(I,C,x,k,N,W,z,ee,re,te){ui[I].ia.push({oa:oe(C),ta:x,ra:Wt(k,N),sa:W,za:z,ya:Wt(ee,re),Aa:te})},C:function(I,C){C=oe(C),Be(I,{va:!0,name:C,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(I,C,x,k,N){I=Fn[I],C=Qe(C),x=Hu(x);var W=[];return Q[k>>2]=Se(W),I(C,x,W,N)},t:function(I,C,x,k){I=Fn[I],C=Qe(C),x=Hu(x),I(C,x,null,k)},g:tA,m:function(I,C){var x=XB(I,C),k=x[0];C=k.name+"_$"+x.slice(1).map(function(z){return z.name}).join("_")+"$";var N=$u[C];if(N!==void 0)return N;var W=Array(I-1);return N=jB((z,ee,re,te)=>{for(var ae=0,Ce=0;Ce<I-1;++Ce)W[Ce]=x[Ce+1].readValueFromPointer(te+ae),ae+=x[Ce+1].argPackAdvance;for(z=z[ee].apply(z,W),Ce=0;Ce<I-1;++Ce)x[Ce+1].ma&&x[Ce+1].ma(W[Ce]);if(!k.va)return k.toWireType(re,z)}),$u[C]=N},D:function(I){4<I&&(q[I].ga+=1)},r:function(I){var C=Qe(I);wi(C),tA(I)},c:function(){J("")},x:function(I,C,x){f.copyWithin(I,C,C+x)},w:function(I){var C=f.length;if(I>>>=0,2147483648<I)return!1;for(var x=1;4>=x;x*=2){var k=C*(1+.2/x);k=Math.min(k,I+100663296);var N=Math;k=Math.max(I,k),N=N.min.call(N,2147483648,k+(65536-k%65536)%65536);e:{try{c.grow(N-d.byteLength+65535>>>16),L();var W=1;break e}catch{}W=void 0}if(W)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(I,C,x,k){for(var N=0,W=0;W<x;W++){var z=Q[C>>2],ee=Q[C+4>>2];C+=8;for(var re=0;re<ee;re++){var te=f[z+re],ae=ZB[I];te===0||te===10?((I===1?a:A)(u(ae,0)),ae.length=0):ae.push(te)}N+=ee}return Q[k>>2]=N,0}};(function(){function I(N){t.asm=N.exports,c=t.asm.E,L(),v=t.asm.J,G.unshift(t.asm.F),j--,t.monitorRunDependencies&&t.monitorRunDependencies(j),j==0&&U&&(N=U,U=null,N())}function C(N){I(N.instance)}function x(N){return b().then(function(W){return WebAssembly.instantiate(W,k)}).then(function(W){return W}).then(N,function(W){A("failed to asynchronously prepare wasm: "+W),J(W)})}var k={a:ey};if(j++,t.monitorRunDependencies&&t.monitorRunDependencies(j),t.instantiateWasm)try{return t.instantiateWasm(k,I)}catch(N){A("Module.instantiateWasm callback failed with error: "+N),r(N)}return function(){return l||typeof WebAssembly.instantiateStreaming!="function"||w(D)||typeof fetch!="function"?x(C):fetch(D,{credentials:"same-origin"}).then(function(N){return WebAssembly.instantiateStreaming(N,k).then(C,function(W){return A("wasm streaming compile failed: "+W),A("falling back to ArrayBuffer instantiation"),x(C)})})}().catch(r),{}})(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.F).apply(null,arguments)};var Yu=t.___getTypeName=function(){return(Yu=t.___getTypeName=t.asm.G).apply(null,arguments)};t.__embind_initialize_bindings=function(){return(t.__embind_initialize_bindings=t.asm.H).apply(null,arguments)};var sA=t._malloc=function(){return(sA=t._malloc=t.asm.I).apply(null,arguments)},Di=t._free=function(){return(Di=t._free=t.asm.K).apply(null,arguments)};t.dynCall_jiji=function(){return(t.dynCall_jiji=t.asm.L).apply(null,arguments)};var Nn;U=function I(){Nn||Vu(),Nn||(U=I)};function Vu(){function I(){if(!Nn&&(Nn=!0,t.calledRun=!0,!h)){if(T(G),i(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;){var C=t.postRun.shift();M.unshift(C)}T(M)}}if(!(0<j)){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)H();T(F),0<j||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),I()},1)):I())}}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);0<t.preInit.length;)t.preInit.pop()();return Vu(),e.ready}})();let Ei=function(s){return s[s.Auto=0]="Auto",s[s.FlexStart=1]="FlexStart",s[s.Center=2]="Center",s[s.FlexEnd=3]="FlexEnd",s[s.Stretch=4]="Stretch",s[s.Baseline=5]="Baseline",s[s.SpaceBetween=6]="SpaceBetween",s[s.SpaceAround=7]="SpaceAround",s[s.SpaceEvenly=8]="SpaceEvenly",s}({}),LA=function(s){return s[s.Width=0]="Width",s[s.Height=1]="Height",s}({}),Rr=function(s){return s[s.Inherit=0]="Inherit",s[s.LTR=1]="LTR",s[s.RTL=2]="RTL",s}({}),kA=function(s){return s[s.Flex=0]="Flex",s[s.None=1]="None",s}({}),pi=function(s){return s[s.Left=0]="Left",s[s.Top=1]="Top",s[s.Right=2]="Right",s[s.Bottom=3]="Bottom",s[s.Start=4]="Start",s[s.End=5]="End",s[s.Horizontal=6]="Horizontal",s[s.Vertical=7]="Vertical",s[s.All=8]="All",s}({}),as=function(s){return s[s.None=0]="None",s[s.StretchFlexBasis=1]="StretchFlexBasis",s[s.AbsolutePositioningIncorrect=2]="AbsolutePositioningIncorrect",s[s.AbsolutePercentAgainstInnerSize=4]="AbsolutePercentAgainstInnerSize",s[s.All=2147483647]="All",s[s.Classic=2147483646]="Classic",s}({}),Yd=function(s){return s[s.WebFlexBasis=0]="WebFlexBasis",s}({}),xr=function(s){return s[s.Column=0]="Column",s[s.ColumnReverse=1]="ColumnReverse",s[s.Row=2]="Row",s[s.RowReverse=3]="RowReverse",s}({}),jn=function(s){return s[s.Column=0]="Column",s[s.Row=1]="Row",s[s.All=2]="All",s}({}),As=function(s){return s[s.FlexStart=0]="FlexStart",s[s.Center=1]="Center",s[s.FlexEnd=2]="FlexEnd",s[s.SpaceBetween=3]="SpaceBetween",s[s.SpaceAround=4]="SpaceAround",s[s.SpaceEvenly=5]="SpaceEvenly",s}({}),ls=function(s){return s[s.Error=0]="Error",s[s.Warn=1]="Warn",s[s.Info=2]="Info",s[s.Debug=3]="Debug",s[s.Verbose=4]="Verbose",s[s.Fatal=5]="Fatal",s}({}),Xn=function(s){return s[s.Undefined=0]="Undefined",s[s.Exactly=1]="Exactly",s[s.AtMost=2]="AtMost",s}({}),MA=function(s){return s[s.Default=0]="Default",s[s.Text=1]="Text",s}({}),Zn=function(s){return s[s.Visible=0]="Visible",s[s.Hidden=1]="Hidden",s[s.Scroll=2]="Scroll",s}({}),zn=function(s){return s[s.Static=0]="Static",s[s.Relative=1]="Relative",s[s.Absolute=2]="Absolute",s}({}),Xt=function(s){return s[s.Undefined=0]="Undefined",s[s.Point=1]="Point",s[s.Percent=2]="Percent",s[s.Auto=3]="Auto",s}({}),eo=function(s){return s[s.NoWrap=0]="NoWrap",s[s.Wrap=1]="Wrap",s[s.WrapReverse=2]="WrapReverse",s}({});const Vd={ALIGN_AUTO:Ei.Auto,ALIGN_FLEX_START:Ei.FlexStart,ALIGN_CENTER:Ei.Center,ALIGN_FLEX_END:Ei.FlexEnd,ALIGN_STRETCH:Ei.Stretch,ALIGN_BASELINE:Ei.Baseline,ALIGN_SPACE_BETWEEN:Ei.SpaceBetween,ALIGN_SPACE_AROUND:Ei.SpaceAround,ALIGN_SPACE_EVENLY:Ei.SpaceEvenly,DIMENSION_WIDTH:LA.Width,DIMENSION_HEIGHT:LA.Height,DIRECTION_INHERIT:Rr.Inherit,DIRECTION_LTR:Rr.LTR,DIRECTION_RTL:Rr.RTL,DISPLAY_FLEX:kA.Flex,DISPLAY_NONE:kA.None,EDGE_LEFT:pi.Left,EDGE_TOP:pi.Top,EDGE_RIGHT:pi.Right,EDGE_BOTTOM:pi.Bottom,EDGE_START:pi.Start,EDGE_END:pi.End,EDGE_HORIZONTAL:pi.Horizontal,EDGE_VERTICAL:pi.Vertical,EDGE_ALL:pi.All,ERRATA_NONE:as.None,ERRATA_STRETCH_FLEX_BASIS:as.StretchFlexBasis,ERRATA_ABSOLUTE_POSITIONING_INCORRECT:as.AbsolutePositioningIncorrect,ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE:as.AbsolutePercentAgainstInnerSize,ERRATA_ALL:as.All,ERRATA_CLASSIC:as.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:Yd.WebFlexBasis,FLEX_DIRECTION_COLUMN:xr.Column,FLEX_DIRECTION_COLUMN_REVERSE:xr.ColumnReverse,FLEX_DIRECTION_ROW:xr.Row,FLEX_DIRECTION_ROW_REVERSE:xr.RowReverse,GUTTER_COLUMN:jn.Column,GUTTER_ROW:jn.Row,GUTTER_ALL:jn.All,JUSTIFY_FLEX_START:As.FlexStart,JUSTIFY_CENTER:As.Center,JUSTIFY_FLEX_END:As.FlexEnd,JUSTIFY_SPACE_BETWEEN:As.SpaceBetween,JUSTIFY_SPACE_AROUND:As.SpaceAround,JUSTIFY_SPACE_EVENLY:As.SpaceEvenly,LOG_LEVEL_ERROR:ls.Error,LOG_LEVEL_WARN:ls.Warn,LOG_LEVEL_INFO:ls.Info,LOG_LEVEL_DEBUG:ls.Debug,LOG_LEVEL_VERBOSE:ls.Verbose,LOG_LEVEL_FATAL:ls.Fatal,MEASURE_MODE_UNDEFINED:Xn.Undefined,MEASURE_MODE_EXACTLY:Xn.Exactly,MEASURE_MODE_AT_MOST:Xn.AtMost,NODE_TYPE_DEFAULT:MA.Default,NODE_TYPE_TEXT:MA.Text,OVERFLOW_VISIBLE:Zn.Visible,OVERFLOW_HIDDEN:Zn.Hidden,OVERFLOW_SCROLL:Zn.Scroll,POSITION_TYPE_STATIC:zn.Static,POSITION_TYPE_RELATIVE:zn.Relative,POSITION_TYPE_ABSOLUTE:zn.Absolute,UNIT_UNDEFINED:Xt.Undefined,UNIT_POINT:Xt.Point,UNIT_PERCENT:Xt.Percent,UNIT_AUTO:Xt.Auto,WRAP_NO_WRAP:eo.NoWrap,WRAP_WRAP:eo.Wrap,WRAP_WRAP_REVERSE:eo.WrapReverse};function Jd(s){function e(r,n,o){const a=r[n];r[n]=function(){for(var A=arguments.length,l=new Array(A),c=0;c<A;c++)l[c]=arguments[c];return o.call(this,a,...l)}}for(const r of["setPosition","setMargin","setFlexBasis","setWidth","setHeight","setMinWidth","setMinHeight","setMaxWidth","setMaxHeight","setPadding"]){const n={[Xt.Point]:s.Node.prototype[r],[Xt.Percent]:s.Node.prototype[`${r}Percent`],[Xt.Auto]:s.Node.prototype[`${r}Auto`]};e(s.Node.prototype,r,function(o){for(var a=arguments.length,A=new Array(a>1?a-1:0),l=1;l<a;l++)A[l-1]=arguments[l];const c=A.pop();let h,u;if(c==="auto")h=Xt.Auto,u=void 0;else if(typeof c=="object")h=c.unit,u=c.valueOf();else if(h=typeof c=="string"&&c.endsWith("%")?Xt.Percent:Xt.Point,u=parseFloat(c),c!==void 0&&!Number.isNaN(c)&&Number.isNaN(u))throw new Error(`Invalid value ${c} for ${r}`);if(!n[h])throw new Error(`Failed to execute "${r}": Unsupported unit '${c}'`);return u!==void 0?n[h].call(this,...A,u):n[h].call(this,...A)})}function t(r){return s.MeasureCallback.implement({measure:function(){const{width:n,height:o}=r(...arguments);return{width:n??NaN,height:o??NaN}}})}e(s.Node.prototype,"setMeasureFunc",function(r,n){return n?r.call(this,t(n)):this.unsetMeasureFunc()});function i(r){return s.DirtiedCallback.implement({dirtied:r})}return e(s.Node.prototype,"setDirtiedFunc",function(r,n){r.call(this,i(n))}),e(s.Config.prototype,"free",function(){s.Config.destroy(this)}),e(s.Node,"create",(r,n)=>n?s.Node.createWithConfig(n):s.Node.createDefault()),e(s.Node.prototype,"free",function(){s.Node.destroy(this)}),e(s.Node.prototype,"freeRecursive",function(){for(let r=0,n=this.getChildCount();r<n;++r)this.getChild(0).freeRecursive();this.free()}),e(s.Node.prototype,"calculateLayout",function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NaN,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Rr.LTR;return r.call(this,n,o,a)}),{Config:s.Config,Node:s.Node,...Vd}}const Te=Jd(await Kd());var _A=function(){};const Wd=(s,e,t)=>Math.min(Math.max(t,s),e),FA=(s,e,t)=>{const i=e-s;return i===0?1:(t-s)/i},to=(s,e,t)=>-t*s+t*e+s,OA=(s,e)=>t=>Math.max(Math.min(t,e),s),Ws=s=>s%1?Number(s.toFixed(5)):s,Tr=/(-)?([\d]*\.?[\d])+/g,io=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,qd=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function qs(s){return typeof s=="string"}const Lr={test:s=>typeof s=="number",parse:parseFloat,transform:s=>s},NA=Object.assign(Object.assign({},Lr),{transform:OA(0,1)});Object.assign(Object.assign({},Lr),{default:1});const js=(s=>({test:e=>qs(e)&&e.endsWith(s)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${s}`}))("%");Object.assign(Object.assign({},js),{parse:s=>js.parse(s)/100,transform:s=>js.transform(s*100)});const so=(s,e)=>t=>!!(qs(t)&&qd.test(t)&&t.startsWith(s)||e&&Object.prototype.hasOwnProperty.call(t,e)),UA=(s,e,t)=>i=>{if(!qs(i))return i;const[r,n,o,a]=i.match(Tr);return{[s]:parseFloat(r),[e]:parseFloat(n),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Yi={test:so("hsl","hue"),parse:UA("hue","saturation","lightness"),transform:({hue:s,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(s)+", "+js.transform(Ws(e))+", "+js.transform(Ws(t))+", "+Ws(NA.transform(i))+")"},jd=OA(0,255),ro=Object.assign(Object.assign({},Lr),{transform:s=>Math.round(jd(s))}),Ti={test:so("rgb","red"),parse:UA("red","green","blue"),transform:({red:s,green:e,blue:t,alpha:i=1})=>"rgba("+ro.transform(s)+", "+ro.transform(e)+", "+ro.transform(t)+", "+Ws(NA.transform(i))+")"};function Xd(s){let e="",t="",i="",r="";return s.length>5?(e=s.substr(1,2),t=s.substr(3,2),i=s.substr(5,2),r=s.substr(7,2)):(e=s.substr(1,1),t=s.substr(2,1),i=s.substr(3,1),r=s.substr(4,1),e+=e,t+=t,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const no={test:so("#"),parse:Xd,transform:Ti.transform},kr={test:s=>Ti.test(s)||no.test(s)||Yi.test(s),parse:s=>Ti.test(s)?Ti.parse(s):Yi.test(s)?Yi.parse(s):no.parse(s),transform:s=>qs(s)?s:s.hasOwnProperty("red")?Ti.transform(s):Yi.transform(s)},PA="${c}",GA="${n}";function Zd(s){var e,t,i,r;return isNaN(s)&&qs(s)&&((t=(e=s.match(Tr))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((r=(i=s.match(io))===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0)>0}function HA(s){typeof s=="number"&&(s=`${s}`);const e=[];let t=0;const i=s.match(io);i&&(t=i.length,s=s.replace(io,PA),e.push(...i.map(kr.parse)));const r=s.match(Tr);return r&&(s=s.replace(Tr,GA),e.push(...r.map(Lr.parse))),{values:e,numColors:t,tokenised:s}}function $A(s){return HA(s).values}function KA(s){const{values:e,numColors:t,tokenised:i}=HA(s),r=e.length;return n=>{let o=i;for(let a=0;a<r;a++)o=o.replace(a<t?PA:GA,a<t?kr.transform(n[a]):Ws(n[a]));return o}}const zd=s=>typeof s=="number"?0:s;function eg(s){const e=$A(s);return KA(s)(e.map(zd))}const YA={test:Zd,parse:$A,createTransformer:KA,getAnimatableNone:eg};function oo(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?s+(e-s)*6*t:t<.5?e:t<.6666666666666666?s+(e-s)*(.6666666666666666-t)*6:s}function VA({hue:s,saturation:e,lightness:t,alpha:i}){s/=360,e/=100,t/=100;let r=0,n=0,o=0;if(!e)r=n=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,A=2*t-a;r=oo(A,a,s+.3333333333333333),n=oo(A,a,s),o=oo(A,a,s-.3333333333333333)}return{red:Math.round(r*255),green:Math.round(n*255),blue:Math.round(o*255),alpha:i}}const tg=(s,e,t)=>{const i=s*s,r=e*e;return Math.sqrt(Math.max(0,t*(r-i)+i))},ig=[no,Ti,Yi],JA=s=>ig.find(e=>e.test(s)),WA=(s,e)=>{let t=JA(s),i=JA(e),r=t.parse(s),n=i.parse(e);t===Yi&&(r=VA(r),t=Ti),i===Yi&&(n=VA(n),i=Ti);const o=Object.assign({},r);return a=>{for(const A in o)A!=="alpha"&&(o[A]=tg(r[A],n[A],a));return o.alpha=to(r.alpha,n.alpha,a),t.transform(o)}},sg=s=>typeof s=="number",rg=(s,e)=>t=>e(s(t)),qA=(...s)=>s.reduce(rg);function jA(s,e){return sg(s)?t=>to(s,e,t):kr.test(s)?WA(s,e):zA(s,e)}const XA=(s,e)=>{const t=[...s],i=t.length,r=s.map((n,o)=>jA(n,e[o]));return n=>{for(let o=0;o<i;o++)t[o]=r[o](n);return t}},ng=(s,e)=>{const t=Object.assign(Object.assign({},s),e),i={};for(const r in t)s[r]!==void 0&&e[r]!==void 0&&(i[r]=jA(s[r],e[r]));return r=>{for(const n in i)t[n]=i[n](r);return t}};function ZA(s){const e=YA.parse(s),t=e.length;let i=0,r=0,n=0;for(let o=0;o<t;o++)i||typeof e[o]=="number"?i++:e[o].hue!==void 0?n++:r++;return{parsed:e,numNumbers:i,numRGB:r,numHSL:n}}const zA=(s,e)=>{const t=YA.createTransformer(e),i=ZA(s),r=ZA(e);return i.numHSL===r.numHSL&&i.numRGB===r.numRGB&&i.numNumbers>=r.numNumbers?qA(XA(i.parsed,r.parsed),t):o=>`${o>0?e:s}`},og=(s,e)=>t=>to(s,e,t);function ag(s){if(typeof s=="number")return og;if(typeof s=="string")return kr.test(s)?WA:zA;if(Array.isArray(s))return XA;if(typeof s=="object")return ng}function Ag(s,e,t){const i=[],r=t||ag(s[0]),n=s.length-1;for(let o=0;o<n;o++){let a=r(s[o],s[o+1]);if(e){const A=Array.isArray(e)?e[o]:e;a=qA(A,a)}i.push(a)}return i}function lg([s,e],[t]){return i=>t(FA(s,e,i))}function cg(s,e){const t=s.length,i=t-1;return r=>{let n=0,o=!1;if(r<=s[0]?o=!0:r>=s[i]&&(n=i-1,o=!0),!o){let A=1;for(;A<t&&!(s[A]>r||A===i);A++);n=A-1}const a=FA(s[n],s[n+1],r);return e[n](a)}}function hg(s,e,{clamp:t=!0,ease:i,mixer:r}={}){const n=s.length;_A(n===e.length),_A(!i||!Array.isArray(i)||i.length===n-1),s[0]>s[n-1]&&(s=[].concat(s),e=[].concat(e),s.reverse(),e.reverse());const o=Ag(e,i,r),a=n===2?lg(s,o):cg(s,o);return t?A=>a(Wd(s[0],s[n-1],A)):a}const Mr=s=>e=>1-s(1-e),ao=s=>e=>e<=.5?s(2*e)/2:(2-s(2*(1-e)))/2,ug=s=>e=>Math.pow(e,s),el=s=>e=>e*e*((s+1)*e-s),dg=s=>{const e=el(s);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},tl=1.525,gg=4/11,fg=8/11,Eg=9/10,pg=s=>s,Ao=ug(2),Ig=Mr(Ao),Cg=ao(Ao),il=s=>1-Math.sin(Math.acos(s)),sl=Mr(il),mg=ao(sl),lo=el(tl),Bg=Mr(lo),yg=ao(lo),Qg=dg(tl),vg=4356/361,wg=35442/1805,Sg=16061/1805,_r=s=>{if(s===1||s===0)return s;const e=s*s;return s<gg?7.5625*e:s<fg?9.075*e-9.9*s+3.4:s<Eg?vg*e-wg*s+Sg:10.8*s*s-20.52*s+10.72},Dg=Mr(_r),bg=s=>s<.5?.5*(1-_r(1-s*2)):.5*_r(s*2-1)+.5;var Fr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rl(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var co={exports:{}};(function(s,e){(function(t,i){i(e)})(Fr,function(t){function i(R){var b,T,K=new Error(R);return b=K,T=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(b,T):b.__proto__=T,K}function r(R,b,T){var K=b.slice(0,T).split(/\n/),P=K.length,q=K[P-1].length+1;throw i(R+=" at line "+P+" col "+q+`:
58
-
59
- `+b.split(/\n/)[P-1]+`
60
- `+Array(q).join(" ")+"^")}i.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,o=!1;try{o=new Function("return (async function(){}).constructor")()}catch(R){if(!(R instanceof SyntaxError))throw R}function a(R,b){return Object.prototype.hasOwnProperty.call(R,b)}function A(R,b,T){for(var K in b)a(b,K)&&(b[K]==null||typeof b[K]!="object"||K!=="storage"&&K!=="prefixes"||T?R[K]=b[K]:R[K]=A({},b[K]));return R}var l=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,h=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,u=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function g(R){return d.test(R)?R.replace(d,"\\$&"):R}function f(R,b){b.rmWhitespace&&(R=R.replace(/[\r\n]+/g,`
61
- `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,h.lastIndex=0,u.lastIndex=0;var T=b.prefixes,K=[T.h,T.b,T.i,T.r,T.c,T.e].reduce(function(Me,de){return Me&&de?Me+"|"+g(de):de?g(de):Me},""),P=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+g(b.tags[1])+")","g"),q=new RegExp("([^]*?)"+g(b.tags[0])+"(-|_)?\\s*("+K+")?\\s*","g"),ie=0,ce=!1;function he(Me,de){var oe,ne={f:[]},we=0,pe="c";function Re(dt){var Tt=R.slice(ie,dt),nt=Tt.trim();if(pe==="f")nt==="safe"?ne.raw=!0:b.async&&l.test(nt)?(nt=nt.replace(l,""),ne.f.push([nt,"",!0])):ne.f.push([nt,""]);else if(pe==="fp")ne.f[ne.f.length-1][1]+=nt;else if(pe==="err"){if(nt){var Ct=Tt.search(/\S/);r("invalid syntax",R,ie+Ct)}}else ne[pe]=nt;ie=dt+1}for(de==="h"||de==="b"||de==="c"?pe="n":de==="r"&&(ne.raw=!0,de="i"),P.lastIndex=ie;(oe=P.exec(R))!==null;){var De=oe[1],Le=oe[2],qe=oe[3],Oe=oe[4],Ke=oe[5],ve=oe.index;if(De)De==="("?(we===0&&(pe==="n"?(Re(ve),pe="p"):pe==="f"&&(Re(ve),pe="fp")),we++):De===")"?--we===0&&pe!=="c"&&(Re(ve),pe="err"):we===0&&De==="|"?(Re(ve),pe="f"):De==="=>"&&(Re(ve),ie+=1,pe="res");else if(Le)if(Le==="/*"){var Ye=R.indexOf("*/",P.lastIndex);Ye===-1&&r("unclosed comment",R,oe.index),P.lastIndex=Ye+2}else Le==="'"?(h.lastIndex=oe.index,h.exec(R)?P.lastIndex=h.lastIndex:r("unclosed string",R,oe.index)):Le==='"'?(u.lastIndex=oe.index,u.exec(R)?P.lastIndex=u.lastIndex:r("unclosed string",R,oe.index)):Le==="`"&&(c.lastIndex=oe.index,c.exec(R)?P.lastIndex=c.lastIndex:r("unclosed string",R,oe.index));else if(qe)return Re(ve),ie=ve+oe[0].length,q.lastIndex=ie,ce=Ke,Oe&&de==="h"&&(de="s"),ne.t=de,ne}return r("unclosed tag",R,Me),ne}var se=function Me(de,oe){de.b=[],de.d=[];var ne,we=!1,pe=[];function Re(Ct,Jt){Ct&&(Ct=function(ot,bt,ui,wi){var mt,Y;return typeof bt.autoTrim=="string"?mt=Y=bt.autoTrim:Array.isArray(bt.autoTrim)&&(mt=bt.autoTrim[1],Y=bt.autoTrim[0]),(ui||ui===!1)&&(mt=ui),(wi||wi===!1)&&(Y=wi),mt==="slurp"&&Y==="slurp"?ot.trim():(mt==="_"||mt==="slurp"?ot=String.prototype.trimLeft?ot.trimLeft():ot.replace(/^[\s\uFEFF\xA0]+/,""):mt!=="-"&&mt!=="nl"||(ot=ot.replace(/^(?:\n|\r|\r\n)/,"")),Y==="_"||Y==="slurp"?ot=String.prototype.trimRight?ot.trimRight():ot.replace(/[\s\uFEFF\xA0]+$/,""):Y!=="-"&&Y!=="nl"||(ot=ot.replace(/(?:\n|\r|\r\n)$/,"")),ot)}(Ct,b,ce,Jt))&&(Ct=Ct.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),pe.push(Ct))}for(;(ne=q.exec(R))!==null;){var De,Le=ne[1],qe=ne[2],Oe=ne[3]||"";for(var Ke in T)if(T[Ke]===Oe){De=Ke;break}Re(Le,qe),ie=ne.index+ne[0].length,De||r("unrecognized tag type: "+Oe,R,ie);var ve=he(ne.index,De),Ye=ve.t;if(Ye==="h"){var dt=ve.n||"";b.async&&l.test(dt)&&(ve.a=!0,ve.n=dt.replace(l,"")),ve=Me(ve),pe.push(ve)}else if(Ye==="c"){if(de.n===ve.n)return we?(we.d=pe,de.b.push(we)):de.d=pe,de;r("Helper start and end don't match",R,ne.index+ne[0].length)}else if(Ye==="b"){we?(we.d=pe,de.b.push(we)):de.d=pe;var Tt=ve.n||"";b.async&&l.test(Tt)&&(ve.a=!0,ve.n=Tt.replace(l,"")),we=ve,pe=[]}else if(Ye==="s"){var nt=ve.n||"";b.async&&l.test(nt)&&(ve.a=!0,ve.n=nt.replace(l,"")),pe.push(ve)}else pe.push(ve)}if(!oe)throw i('unclosed helper "'+de.n+'"');return Re(R.slice(ie,R.length),!1),de.d=pe,de}({f:[]},!0);if(b.plugins)for(var Qe=0;Qe<b.plugins.length;Qe++){var Se=b.plugins[Qe];Se.processAST&&(se.d=Se.processAST(se.d,b))}return se.d}function E(R,b){var T=f(R,b),K="var tR='';"+(b.useWith?"with("+b.varName+"||{}){":"")+y(T,b)+"if(cb){cb(null,tR)} return tR"+(b.useWith?"}":"");if(b.plugins)for(var P=0;P<b.plugins.length;P++){var q=b.plugins[P];q.processFnString&&(K=q.processFnString(K,b))}return K}function B(R,b){for(var T=0;T<b.length;T++){var K=b[T][0],P=b[T][1];R=(b[T][2]?"await ":"")+"c.l('F','"+K+"')("+R,P&&(R+=","+P),R+=")"}return R}function S(R,b,T,K,P,q){var ie="{exec:"+(P?"async ":"")+m(T,b,R)+",params:["+K+"]";return q&&(ie+=",name:'"+q+"'"),P&&(ie+=",async:true"),ie+="}"}function Q(R,b){for(var T="[",K=0;K<R.length;K++){var P=R[K];T+=S(b,P.res||"",P.d,P.p||"",P.a,P.n),K<R.length&&(T+=",")}return T+="]"}function m(R,b,T){return"function("+b+"){var tR='';"+y(R,T)+"return tR}"}function y(R,b){for(var T=0,K=R.length,P="";T<K;T++){var q=R[T];if(typeof q=="string")P+="tR+='"+q+"';";else{var ie=q.t,ce=q.c||"",he=q.f,se=q.n||"",Qe=q.p||"",Se=q.res||"",Me=q.b,de=!!q.a;if(ie==="i"){b.defaultFilter&&(ce="c.l('F','"+b.defaultFilter+"')("+ce+")");var oe=B(ce,he);!q.raw&&b.autoEscape&&(oe="c.l('F','e')("+oe+")"),P+="tR+="+oe+";"}else if(ie==="h")if(b.storage.nativeHelpers.get(se))P+=b.storage.nativeHelpers.get(se)(q,b);else{var ne=(de?"await ":"")+"c.l('H','"+se+"')("+S(b,Se,q.d,Qe,de);ne+=Me?","+Q(Me,b):",[]",P+="tR+="+B(ne+=",c)",he)+";"}else ie==="s"?P+="tR+="+B((de?"await ":"")+"c.l('H','"+se+"')({params:["+Qe+"]},[],c)",he)+";":ie==="e"&&(P+=ce+`
62
- `)}}return P}var L=function(){function R(b){this.cache=b}return R.prototype.define=function(b,T){this.cache[b]=T},R.prototype.get=function(b){return this.cache[b]},R.prototype.remove=function(b){delete this.cache[b]},R.prototype.reset=function(){this.cache={}},R.prototype.load=function(b){A(this.cache,b,!0)},R}();function v(R,b,T,K){if(b&&b.length>0)throw i((K?"Native":"")+"Helper '"+R+"' doesn't accept blocks");if(T&&T.length>0)throw i((K?"Native":"")+"Helper '"+R+"' doesn't accept filters")}var F={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function G(R){return F[R]}var M=new L({}),H=new L({each:function(R,b){var T="",K=R.params[0];if(v("each",b,!1),R.async)return new Promise(function(q){(function ie(ce,he,se,Qe,Se){se(ce[he],he).then(function(Me){Qe+=Me,he===ce.length-1?Se(Qe):ie(ce,he+1,se,Qe,Se)})})(K,0,R.exec,T,q)});for(var P=0;P<K.length;P++)T+=R.exec(K[P],P);return T},foreach:function(R,b){var T=R.params[0];if(v("foreach",b,!1),R.async)return new Promise(function(q){(function ie(ce,he,se,Qe,Se,Me){Qe(he[se],ce[he[se]]).then(function(de){Se+=de,se===he.length-1?Me(Se):ie(ce,he,se+1,Qe,Se,Me)})})(T,Object.keys(T),0,R.exec,"",q)});var K="";for(var P in T)a(T,P)&&(K+=R.exec(P,T[P]));return K},include:function(R,b,T){v("include",b,!1);var K=T.storage.templates.get(R.params[0]);if(!K)throw i('Could not fetch template "'+R.params[0]+'"');return K(R.params[1],T)},extends:function(R,b,T){var K=R.params[1]||{};K.content=R.exec();for(var P=0;P<b.length;P++){var q=b[P];K[q.name]=q.exec()}var ie=T.storage.templates.get(R.params[0]);if(!ie)throw i('Could not fetch template "'+R.params[0]+'"');return ie(K,T)},useScope:function(R,b){return v("useScope",b,!1),R.exec(R.params[0])}}),j=new L({if:function(R,b){v("if",!1,R.f,!0);var T="if("+R.p+"){"+y(R.d,b)+"}";if(R.b)for(var K=0;K<R.b.length;K++){var P=R.b[K];P.n==="else"?T+="else{"+y(P.d,b)+"}":P.n==="elif"&&(T+="else if("+P.p+"){"+y(P.d,b)+"}")}return T},try:function(R,b){if(v("try",!1,R.f,!0),!R.b||R.b.length!==1||R.b[0].n!=="catch")throw i("native helper 'try' only accepts 1 block, 'catch'");var T="try{"+y(R.d,b)+"}",K=R.b[0];return T+="catch"+(K.res?"("+K.res+")":"")+"{"+y(K.d,b)+"}"},block:function(R,b){return v("block",R.b,R.f,!0),"if(!"+b.varName+"["+R.p+"]){tR+=("+m(R.d,"",b)+")()}else{tR+="+b.varName+"["+R.p+"]}"}}),U=new L({e:function(R){var b=String(R);return/[&<>"']/.test(b)?b.replace(/[&<>"']/g,G):b}}),J={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(R,b){if(R==="H"){var T=this.storage.helpers.get(b);if(T)return T;throw i("Can't find helper '"+b+"'")}if(R==="F"){var K=this.storage.filters.get(b);if(K)return K;throw i("Can't find filter '"+b+"'")}},async:!1,storage:{helpers:H,nativeHelpers:j,filters:U,templates:M},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function w(R,b){var T={};return A(T,J),b&&A(T,b),R&&A(T,R),T.l.bind(T),T}function D(R,b){var T=w(b||{}),K=Function;if(T.async){if(!o)throw i("This environment doesn't support async/await");K=o}try{return new K(T.varName,"c","cb",E(R,T))}catch(P){throw P instanceof SyntaxError?i(`Bad template syntax
63
-
64
- `+P.message+`
65
- `+Array(P.message.length+1).join("=")+`
66
- `+E(R,T)):P}}function X(R,b){var T;return b.cache&&b.name&&b.storage.templates.get(b.name)?b.storage.templates.get(b.name):(T=typeof R=="function"?R:D(R,b),b.cache&&b.name&&b.storage.templates.define(b.name,T),T)}J.l.bind(J),t.compile=D,t.compileScope=y,t.compileScopeIntoFunction=m,t.compileToString=E,t.defaultConfig=J,t.filters=U,t.getConfig=w,t.helpers=H,t.nativeHelpers=j,t.parse=f,t.render=function(R,b,T,K){var P=w(T||{});if(!P.async)return X(R,P)(b,P);if(!K){if(typeof n=="function")return new n(function(q,ie){try{q(X(R,P)(b,P))}catch(ce){ie(ce)}});throw i("Please provide a callback function, this env doesn't support Promises")}try{X(R,P)(b,P,K)}catch(q){return K(q)}},t.templates=M,Object.defineProperty(t,"__esModule",{value:!0})})})(co,co.exports);var ho=co.exports;const Rg=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!xg(r,n)&&i||Object.defineProperty(s,t,n)},xg=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},Tg=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Lg=(s,e)=>`/* Wrapped ${s}*/
67
- ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),_g=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=Lg.bind(null,i,e.toString());Object.defineProperty(r,"name",Mg),Object.defineProperty(s,"toString",{...kg,value:r})};function Fg(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Rg(s,e,r,t);return Tg(s,e),_g(s,e,i),s}const Og=new WeakMap;function Li(s,{cacheKey:e=([i])=>i,cache:t=new Map}={}){const i=new Map,r=function(...n){const o=e(n);if(i.has(o))return i.get(o);const a=(async()=>{try{if(t&&await t.has(o))return await t.get(o);const l=await s.apply(this,n);try{return l}finally{t&&await t.set(o,l)}}finally{i.delete(o)}})();return i.set(o,a),a};return Fg(r,s,{ignoreNonConfigurable:!0}),Og.set(r,t),r}function uo({canvas:s,scenes:e,currentTime:t}){if(e&&s){const i=e.scenes.filter(({start:n,duration:o})=>t>=n&&t<=n+o);if(i.length<=0)return;const r=s.getContext("2d");if(r){const n=e.transitionDuration,o=Math.max(...e.scenes.map(({start:a,duration:A})=>a+A));r.globalCompositeOperation="lighter",r.clearRect(0,0,s.width,s.height),i.forEach(({start:a,duration:A,draw:l,transitionCanvas:c})=>{if(r.globalAlpha=1,c.width=c.height=0,c.width=s.width,c.height=s.height,c.getContext("2d")){const u=a+A,d=a===0,g=u===o;l({currentTime:t,canvas:c}),!d&&t>=a&&t<=a+n?r.globalAlpha=Math.max(0,Math.min(1,(t-a)/n)):!g&&t>=u-n&&t<=u&&(r.globalAlpha=Math.max(0,Math.min(1,(u-t)/n))),r.drawImage(c,0,0,s.width,s.height)}})}}}function Ng(s){if(typeof s=="string"){const[e,t]=s.split(":");return Math.min(parseFloat(e),parseFloat(t))}return s}function Ug(s){if(typeof s=="string"){const[e,t]=s.split(":"),i=parseFloat(e),r=parseFloat(t);return i/r}return s}function go({resolution:s,aspectRatio:e}){const t=Ng(s),i=Ug(e),r=i>=1,n=Math.min(r?t*i:t/i,t),o=Math.max(r?t*i:t/i,t);return{resolution:t,aspectRatio:i,height:r?n:o,width:r?o:n}}function Pg({format:s,resolution:e,aspectRatio:t,sourceWidth:i,sourceHeight:r}){const{width:n,height:o}=go({resolution:e,aspectRatio:t}),a=i/r,A=t>a;let l=1;if(s==="letterbox"||s==="letterbox-video")l=A?o/r:n/i;else if(s==="squarebox"){const g=Math.min(o,n);l=i>=r?g/r:g/i}else s==="crop"&&(l=A?n/i:o/r);const c=n/l,h=o/l,u=(i-c)/2,d=(r-h)/2;return{sx:u,sy:d,sWidth:c,sHeight:h,scale:l}}function Xs({source:s,sx:e,sy:t,sw:i,sh:r,dx:n,dy:o,dw:a,dh:A}){const l=(s==null?void 0:s.naturalWidth)??(s==null?void 0:s.videoWidth)??(s==null?void 0:s.width),c=(s==null?void 0:s.naturalHeight)??(s==null?void 0:s.videoHeight)??(s==null?void 0:s.height);e=e??0,t=t??0,i=i??l,r=r??c,i<0&&(e+=i,i=Math.abs(i)),r<0&&(t+=r,r=Math.abs(r)),a<0&&(n+=a,a=Math.abs(a)),A<0&&(o+=A,A=Math.abs(A));const h=Math.max(e,0),u=Math.min(e+i,l),d=Math.max(t,0),g=Math.min(t+r,c),f=a/i,E=A/r;return[s,h,d,u-h,g-d,e<0?n-e*f:n,t<0?o-t*E:o,(u-h)*f,(g-d)*E]}function nl({context:s,source:e,crop:t,format:i="letterbox",posX:r,posY:n,drawAreaWidth:o,drawAreaHeight:a,sourceWidth:A,sourceHeight:l,cropCanvas:c,letterboxCanvas:h}){const{x:u,y:d,width:g,height:f}=t??{},E=A*(u??0),B=l*(d??0),S=A*Math.min(1-(u??0),g??1),Q=l*Math.min(1-(d??0),f??1),m=c.getContext("2d");if(m){c.width=S,c.height=Q;const D=Xs({source:e,sx:E,sy:B,sw:S,sh:Q,dx:0,dy:0,dw:S,dh:Q});m.drawImage(...D)}const y=S/Q,{sx:L,sy:v,sWidth:F,sHeight:G,scale:M}=Pg({resolution:Math.min(o,a),aspectRatio:o/a,format:i,sourceWidth:S,sourceHeight:Q}),H=c&&typeof s.filter<"u";if(i==="letterbox"||i==="squarebox"||i==="letterbox-video"&&!H){if(L<0){const D=Math.abs(L)*M;s.fillStyle="black",s.beginPath(),s.rect(r,n,D,a),s.rect(r+o-D,n,D,a),s.fill(),s.closePath()}if(v<0){const D=Math.abs(v)*M;s.fillStyle="black",s.beginPath(),s.rect(r,n,o,D),s.rect(r,n+a-D,o,D),s.fill(),s.closePath()}}if(i==="letterbox-video"&&H){const D=h.getContext("2d");if(D){h.width=S,h.height=Q,s.save(),s.globalCompositeOperation="destination-out",s.fillRect(r,n,o,a);const X=Xs({source:c,sx:L,sy:v,sw:F,sh:G,dx:r,dy:n,dw:o,dh:a});s.globalCompositeOperation="source-over",s.drawImage(...X),D.save();const R=1.2,b=-(S*R-S)/2,T=-(Q*R-Q)/2,K=Math.min(S/20,Q/20);if(D.filter=`blur(${K}px) brightness(20%)`,D.translate(b,T),D.scale(R,R),D.drawImage(c,0,0,S,Q),D.restore(),s.globalCompositeOperation="destination-over",L<0){const P=o/y,q=a/P,ie=Xs({source:h,sy:(1-q)*Q/2,sh:q*Q,dx:r,dy:n,dw:o,dh:a});s.drawImage(...ie)}if(v<0){const P=a*y,q=o/P,ie=Xs({source:h,sx:(1-q)*S/2,sw:q*S,dx:r,dy:n,dw:o,dh:a});s.drawImage(...ie)}s.restore()}}else{const D=Xs({source:c,sx:L,sy:v,sw:F,sh:G,dx:r,dy:n,dw:o,dh:a});s.drawImage(...D)}const j=L*-1*M,U=v*-1*M,J=o-j*2,w=a-U*2;return{dx:j,dy:U,dw:J,dh:w}}function ol({context:s,word:e,maxW:t=1/0}){const i=[],r=s.measureText(e);if(r.width<t)return[{text:e,metrics:r}];for(let n=0;n<e.length;n++){const o=i[i.length-1],a=((o==null?void 0:o.text)??"")+e[n],A=s.measureText(a);A.width<t?i[o?i.length-1:0]={text:a,metrics:A}:i.push({text:e[n],metrics:s.measureText(e[n])})}return i}const al=qn(({font:s,scale:e,context:t,maxW:i,maxH:r,text:n,minSize:o,maxSize:a})=>{var A,l;let c=0;if(a){c=(o??0)*e;let u=0;for(;a*e>c+1;){c+=1;const d=Pr({context:t,font:s,fontSize:c,text:n,maxW:i});if(u=d.reduce((g,f)=>(f.metrics.width>g&&(g=f.metrics.width),g),0),u>i||d.length*c>r){c-=1;break}}}else c=parseFloat(((l=(A=s.match(Ur))==null?void 0:A.groups)==null?void 0:l.value)??"0")*e;return c},{cacheKey:([{font:s,text:e,minSize:t,maxSize:i,scale:r,maxW:n,maxH:o}])=>`${s}_${e}_${t}_${i}_${r}_${n}_${o}`});function Gg(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:typeof s.top=="number"?s.top*e:s.top,right:typeof s.right=="number"?s.right*e:s.right,bottom:typeof s.bottom=="number"?s.bottom*e:s.bottom,left:typeof s.left=="number"?s.left*e:s.left}}function Al(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:(typeof s.top=="number"?s.top*e:s.top)??0,right:(typeof s.right=="number"?s.right*e:s.right)??0,bottom:(typeof s.bottom=="number"?s.bottom*e:s.bottom)??0,left:(typeof s.left=="number"?s.left*e:s.left)??0}}function ll(s,{layout:e,scale:t=1}){const{position:i="relative",inset:r,width:n,height:o,minWidth:a,minHeight:A,maxWidth:l,maxHeight:c,flex:h,gap:u,margin:d,padding:g,direction:f="column",align:E="start",alignSelf:B,justify:S="start"}=e,Q={static:Te.POSITION_TYPE_STATIC,relative:Te.POSITION_TYPE_RELATIVE,absolute:Te.POSITION_TYPE_ABSOLUTE};if(s.setPositionType(Q[i]),r){const{top:v,right:F,bottom:G,left:M}=Gg(r,t);v&&s.setPosition(Te.EDGE_TOP,v),F&&s.setPosition(Te.EDGE_RIGHT,F),G&&s.setPosition(Te.EDGE_BOTTOM,G),M&&s.setPosition(Te.EDGE_LEFT,M)}const m={row:Te.FLEX_DIRECTION_ROW,column:Te.FLEX_DIRECTION_COLUMN,"row-reverse":Te.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":Te.FLEX_DIRECTION_COLUMN_REVERSE};s.setFlexDirection(m[f]);const y={start:Te.ALIGN_FLEX_START,end:Te.ALIGN_FLEX_END,center:Te.ALIGN_CENTER,stretch:Te.ALIGN_STRETCH};s.setAlignItems(y[E]),B&&s.setAlignSelf(y[B]);const L={start:Te.JUSTIFY_FLEX_START,end:Te.JUSTIFY_FLEX_END,center:Te.JUSTIFY_CENTER,"space-between":Te.JUSTIFY_SPACE_BETWEEN,"space-around":Te.JUSTIFY_SPACE_AROUND,"space-evenly":Te.JUSTIFY_SPACE_EVENLY};if(s.setJustifyContent(L[S]),d){const{top:v,right:F,bottom:G,left:M}=Al(d,t);s.setMargin(Te.EDGE_TOP,v),s.setMargin(Te.EDGE_RIGHT,F),s.setMargin(Te.EDGE_BOTTOM,G),s.setMargin(Te.EDGE_LEFT,M)}if(g){const{top:v,right:F,bottom:G,left:M}=Al(g,t);s.setPadding(Te.EDGE_TOP,v),s.setPadding(Te.EDGE_RIGHT,F),s.setPadding(Te.EDGE_BOTTOM,G),s.setPadding(Te.EDGE_LEFT,M)}h&&s.setFlex(h),s.setGap(Te.GUTTER_ALL,(u??0)*t),n&&s.setWidth(typeof n=="number"?n*t:n),o&&(typeof o=="function"?s.setHeight("100%"):s.setHeight(typeof o=="number"?o*t:o)),a&&s.setMinWidth(typeof a=="number"?a*t:a),A&&s.setMinHeight(typeof A=="number"?A*t:A),l&&s.setMaxWidth(typeof l=="number"?l*t:l),c&&s.setMaxHeight(typeof c=="number"?c*t:c)}function cl({canvas:s,debug:e=!1,scale:t=1,position:i=[]}){i.forEach(({x:r,y:n,width:o,height:a,childNodes:A,element:l})=>{const c=s.getContext("2d",{alpha:!1});if(c){const{draw:h}=l;h&&(c.save(),h({scale:t,dx:r,dy:n,dw:o,dh:a}),e&&(c.strokeStyle="red",c.strokeRect(r,n,o,a))),cl({canvas:s,debug:e,scale:t,position:A}),c.restore()}})}function hl(s,e,t){const i=e.map((r,n)=>{const o=Te.Node.create(),{radius:a,elements:A=[],draw:l,...c}=r;return ll(o,{layout:c,scale:t}),s.insertChild(o,n),{node:o,element:r,childNodes:hl(o,A,t)}});return s.calculateLayout(void 0,void 0),i}function ul(s,e,t=0,i=0){const{top:r,left:n}=s.getComputedLayout();return e.map(({node:o,element:a,childNodes:A})=>{const{top:l,left:c,width:h,height:u}=o.getComputedLayout(),d=t+c,g=i+l;return{x:n+d,y:r+g,width:h,height:u,element:a,childNodes:ul(s,A,d,g)}})}function dl(s,e){s.forEach(({node:t,element:i,childNodes:r})=>{const{height:n}=i;if(n&&typeof n=="function"){const o=t.getComputedWidth(),a=t.getComputedHeight(),A=n({width:o,maxHeight:a,scale:e});t.setHeight(A)}dl(r,e)})}function Hg({canvas:s,origin:e,elements:t,...i}){const r={inset:{top:0,left:0},width:s.width,height:s.height,...e},n=Te.Node.create();ll(n,{layout:r}),n.calculateLayout(void 0,void 0);const{width:o,height:a}=n.getComputedLayout(),A=Math.min(o,a)/1080,l=hl(n,t,A);dl(l,A),n.calculateLayout(void 0,void 0);const c=ul(n,l);return cl({...i,scale:A,canvas:s,position:c})}const $g={linear:pg,easeIn:Ao,easeInOut:Cg,easeOut:Ig,circIn:il,circInOut:mg,circOut:sl,backIn:lo,backInOut:yg,backOut:Bg,anticipate:Qg,bounceIn:Dg,bounceInOut:bg,bounceOut:_r},Or=qn((s,e,{clamp:t=!0,ease:i="easeIn",...r}={})=>hg(s,e,{...r,clamp:t,ease:$g[i]}),{cacheKey:([s,e,t])=>JSON.stringify({from:s,to:e,options:t})}),gl=[{family:"Noto Arabic",regex:new RegExp("\\p{Script=Arabic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansArabic-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Chinese",regex:new RegExp("\\p{Script=Han}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansSC-VariableFont_wght.woff2",style:"normal"},{family:"Noto Hebrew",regex:new RegExp("\\p{Script=Hebrew}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansHebrew-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Hindi",regex:new RegExp("\\p{Script=Devanagari}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansDevanagari-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Japanese",regex:new RegExp("\\p{Script=Han}|\\p{Script=Katakana}|\\p{Script=Hiragana}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansJP-VariableFont_wght.woff2",style:"normal"},{family:"Noto Korean",regex:new RegExp("\\p{Script=Hangul}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKR-VariableFont_wght.woff2",style:"normal"},{family:"Noto Color Emoji",regex:new RegExp("\\p{Extended_Pictographic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoColorEmoji-Regular.woff2",style:"normal"}];function Nr({text:s,font:e}){let t=e;return gl.forEach(({family:i,regex:r})=>{r.exec(s)&&(t+=`, ${i}`)}),t}const Ii=1.8,Ur=/(?<value>\d+\.?\d*)(?=px)/;function fl(s,e=1){return typeof s=="number"?{topLeft:s*e,topRight:s*e,bottomRight:s*e,bottomLeft:s*e}:{topLeft:((s==null?void 0:s.topLeft)??0)*e,topRight:((s==null?void 0:s.topRight)??0)*e,bottomRight:((s==null?void 0:s.bottomRight)??0)*e,bottomLeft:((s==null?void 0:s.bottomLeft)??0)*e}}function El(s){const{visible:e,node:t}=s,i=[...(t==null?void 0:t.elements)??[],...(s==null?void 0:s.elements)??[]];return e??(t&&t.type!=="box"&&t.type!=="gradient"?!!t.value:i==null?void 0:i.some(r=>El(r)))}function pl({debug:s=!1,canvas:e,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:n=[],currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h}){return n.map(u=>{var d,g,f,E,B,S,Q,m;const{node:y,transient:L=[{from:0,duration:1/0}]}=u,v=e.getContext("2d"),F={total:o,content:a,scene:A},G={total:l,content:c,scene:h},M=L.reduce((H,{type:j="scene",from:U,duration:J,animation:w})=>{const D=U<0?G[j]+U:U;return F[j]>=D&&F[j]<=D+J&&H.push({type:j,animation:w,duration:J,from:D}),H},[]);if(v&&M.length>0&&El(u)){let H=u.width,j=u.height;if((y==null?void 0:y.type)==="text"&&y.value){const{align:U="left"}=y,J=Nr({text:y.value,font:y.font});v.save(),v.font=J,v.textBaseline="top",v.textAlign=U,y.wrap?j=({width:w,maxHeight:D,scale:X})=>{var R,b;const T=al({font:J,scale:X,context:v,maxW:w,maxH:D,text:y.value??"",minSize:(R=y.fill)==null?void 0:R.minSize,maxSize:(b=y.fill)==null?void 0:b.maxSize});return Pr({context:v,font:J,fontSize:T,text:y.value??"",maxW:w}).length*T}:(H=v.measureText(y.value).width,j=parseFloat(((g=(d=J.match(Ur))==null?void 0:d.groups)==null?void 0:g.value)??"0")),v.restore()}if((y==null?void 0:y.type)==="image"&&y.image&&y.size){const U=((f=y.image)==null?void 0:f.naturalWidth)??((E=y.image)==null?void 0:E.width),J=((B=y.image)==null?void 0:B.naturalHeight)??((S=y.image)==null?void 0:S.height),w=U/J,D=(Q=y.size)==null?void 0:Q.width,X=(m=y.size)==null?void 0:m.height;H=D??(w>=1?(X??0)*w:(X??0)/w),j=X??(w<1?(D??0)*w:(D??0)/w)}return{...u,width:H,height:j,elements:pl({debug:s,canvas:e,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:u.elements,currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h}),draw:({dx:U,dy:J,dw:w,dh:D,scale:X})=>{var R,b,T,K,P,q,ie,ce,he,se,Qe,Se,Me;if(M.forEach(de=>{const{type:oe="scene",from:ne,duration:we,animation:pe={type:"fade",duration:.3333333333333333,easing:{in:"easeOut",out:"easeOut"}}}=de;if(pe){const{type:Re,duration:De,easing:{in:Le="easeOut",out:qe="easeOut"}={}}=pe;if(ne>0&&F[oe]<=ne+De)switch(Re){case"fade":{const Oe=Or([ne,ne+De],[0,1],{ease:Le});v.globalAlpha=Oe(F[oe]);break}case"slide":{const{options:Oe}=pe,Ke={up:[{x:0,y:D},{x:0,y:0}],right:[{x:w,y:0},{x:0,y:0}],down:[{x:0,y:-D},{x:0,y:0}],left:[{x:-w,y:0},{x:0,y:0}]},ve=Or([ne,ne+De],Ke[Oe.direction.in],{ease:Le}),{x:Ye,y:dt}=ve(F[oe]);v.translate(Ye,dt);break}}if(ne+we<G[oe]&&ne+we-De<=F[oe])switch(Re){case"fade":{const Oe=Or([ne+we-De,ne+we],[1,0],{ease:qe});v.globalAlpha=Oe(F[oe]);break}case"slide":{const{options:Oe}=pe,Ke={up:[{x:0,y:0},{x:0,y:-D}],right:[{x:0,y:0},{x:w,y:0}],down:[{x:0,y:0},{x:0,y:D}],left:[{x:0,y:0},{x:-w,y:0}]},ve=Or([ne+we-De,ne+we],Ke[Oe.direction.out],{ease:qe}),{x:Ye,y:dt}=ve(F[oe]);v.translate(Ye,dt);break}}}}),y){const{type:de}=y;if(de==="box"){const{shadow:{color:oe="rgba(0, 0, 0, 0.5)",blur:ne=0,offset:{x:we=0,y:pe=0}={}}={}}=y;if(v.save(),v.fillStyle=oe,v.shadowColor=oe,v.shadowBlur=ne,v.shadowOffsetX=we+w+e.width,v.shadowOffsetY=pe+D+e.height,v.beginPath(),!u.radius)v.rect(U-w-e.width,J-D-e.height,w,D);else{const{topLeft:Re,topRight:De,bottomRight:Le,bottomLeft:qe}=fl(u.radius,X);v.roundRect(U-w-e.width,J-D-e.height,w,D,[Re,De,Le,qe])}v.fill(),v.closePath(),v.restore()}if(u.radius){const{topLeft:oe,topRight:ne,bottomRight:we,bottomLeft:pe}=fl(u.radius,X);v.beginPath(),v.moveTo(U+Math.min(D/Ii,oe),J),v.lineTo(U+w-Math.min(D/Ii,ne),J),v.quadraticCurveTo(U+w,J,U+w,J+Math.min(D/Ii,ne)),v.lineTo(U+w,J+D-Math.min(D/Ii,we)),v.quadraticCurveTo(U+w,J+D,U+w-Math.min(D/Ii,we),J+D),v.lineTo(U+Math.min(D/Ii,pe),J+D),v.quadraticCurveTo(U,J+D,U,J+D-Math.min(D/Ii,pe)),v.lineTo(U,J+Math.min(D/Ii,oe)),v.quadraticCurveTo(U,J,U+Math.min(D/Ii,oe),J),v.closePath(),s&&(v.strokeStyle="blue",v.stroke()),v.clip()}if(de==="box"&&(v.save(),v.fillStyle=y.background,v.fillRect(U,J,w,D),v.restore()),de==="text"&&y.value){const{align:oe="left"}=y,ne=Nr({text:y.value,font:y.font}),we=al({font:ne,scale:X,context:v,maxW:w,maxH:D,text:y.value??"",minSize:(R=y.fill)==null?void 0:R.minSize,maxSize:(b=y.fill)==null?void 0:b.maxSize});v.font=ne.replace(Ur,we.toString()),v.textBaseline="top",v.fillStyle=y.color,v.textAlign=oe;const pe={left:U,center:U+w/2,right:U+w};y.wrap?Pr({context:v,font:ne,fontSize:we,text:y.value,maxW:w}).forEach((De,Le)=>{v.fillText(De.text,pe[oe],J+we*Le)}):v.fillText(y.value,pe[oe],J)}if(de==="image"&&y.image&&v.drawImage(y.image,U,J,w,D),de==="video"&&((T=y.video)!=null&&T.node||(K=y.video)!=null&&K.getSource)){const oe=y.format??"letterbox",ne=((q=(P=y.video)==null?void 0:P.getSource)==null?void 0:q.call(P,A))??y.video.node,we=(ne==null?void 0:ne.videoWidth)??(ne==null?void 0:ne.naturalWidth)??(ne==null?void 0:ne.width),pe=(ne==null?void 0:ne.videoHeight)??(ne==null?void 0:ne.naturalHeight)??(ne==null?void 0:ne.height);if(we&&pe){const{dx:De,dy:Le,dw:qe,dh:Oe}=nl({context:v,cropCanvas:t,letterboxCanvas:r,source:ne,format:oe,crop:(ie=y==null?void 0:y.value)==null?void 0:ie.crop,sourceWidth:we,sourceHeight:pe,posX:U,posY:J,drawAreaWidth:w,drawAreaHeight:D});y.elements&&fo({debug:s,canvas:e,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:y.elements,currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h,origin:{inset:{top:Math.max(J,J+Le),left:Math.max(U,U+De)},width:Math.min(w,qe),height:Math.min(D,Oe)}})}const Re=1/3;if(y.poster&&o>=0&&o<=Re){v.save(),v.globalAlpha=1-o/Re;const De=((ce=y.poster)==null?void 0:ce.naturalWidth)??((he=y.poster)==null?void 0:he.width),Le=((se=y.poster)==null?void 0:se.naturalHeight)??((Qe=y.poster)==null?void 0:Qe.height);i.width=i.height=0,i.width=w,i.height=D;const qe=i.getContext("2d");if(qe&&De&&Le){const{dx:Oe,dy:Ke,dw:ve,dh:Ye}=nl({context:qe,cropCanvas:t,letterboxCanvas:r,source:y.poster,format:oe,crop:(Se=y==null?void 0:y.value)==null?void 0:Se.crop,sourceWidth:De,sourceHeight:Le,posX:0,posY:0,drawAreaWidth:w,drawAreaHeight:D});y.elements&&fo({debug:s,canvas:i,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:y.elements,currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h,origin:{inset:{top:Math.max(0,Ke),left:Math.max(0,Oe)},width:Math.min(w,ve),height:Math.min(D,Ye)}}),v.drawImage(i,U,J,w,D),v.restore()}}}if(de==="gradient"&&y.value){const oe=v.createLinearGradient(U+w,J,U+w,J+D);(Me=y.value)==null||Me.forEach(ne=>{oe.addColorStop(ne.percent,ne.color)}),v.fillStyle=oe,v.fillRect(U,J,w,D)}}}}}}).filter(Boolean)}function fo({debug:s,canvas:e,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:n,currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h,...u}){return Hg({...u,debug:s,canvas:e,elements:pl({debug:s,canvas:e,cropCanvas:t,posterCanvas:i,letterboxCanvas:r,elements:n,currentTime:o,contentTime:a,sceneTime:A,totalDuration:l,contentDuration:c,sceneDuration:h})})}const Pr=qn(({context:s,font:e,fontSize:t,text:i,maxW:r=1/0})=>{try{return s.save(),s.font=e.replace(Ur,t.toString()),i.split(`
68
- `).flatMap(o=>{const a=o.split(" ").filter(Boolean);return a.length?a.slice(1).reduce((A,l)=>{const h=`${A[A.length-1].text} ${l}`.trim(),u=s.measureText(h);return u.width>r?A=[...A,...ol({context:s,word:l,maxW:r})]:A[A.length-1]={text:h,metrics:u},A},ol({context:s,word:a[0],maxW:r})):{text:"",metrics:s.measureText("")}})}finally{s.restore()}},{cacheKey:([{font:s,fontSize:e,text:t,maxW:i}])=>`${s}_${e}_${t}_${i}`}),Kg=/\d{0,2}:?\d{2}:\d{2}\.\d{3}\s-->\s\d{0,2}:?\d{2}:\d{2}\.\d{3}\s{1,2}.*/g,Yg=/\d{0,2}:?\d{2}:\d{2}\.\d{3}/g;function Il(s){if(!s)return[];const e=s.match(Kg);return e?e==null?void 0:e.map(t=>{const[i,r]=t.replace(`\r
55
+ */const kd=Symbol();class Lr{get taskComplete(){return this.t||(this.status===1?this.t=new Promise((e,t)=>{this.i=e,this.o=t}):this.status===3?this.t=Promise.reject(this.h):this.t=Promise.resolve(this.l)),this.t}constructor(e,t,i){var n;this.u=0,this.status=0,(this.p=e).addController(this);const r=typeof t=="object"?t:{task:t,args:i};this._=r.task,this.v=r.args,this.j=r.argsEqual??Fd,this.m=r.onComplete,this.g=r.onError,this.autoRun=r.autoRun??!0,"initialValue"in r&&(this.l=r.initialValue,this.status=2,this.k=(n=this.A)==null?void 0:n.call(this))}hostUpdate(){this.autoRun===!0&&this.O()}hostUpdated(){this.autoRun==="afterUpdate"&&this.O()}A(){if(this.v===void 0)return;const e=this.v();if(!Array.isArray(e))throw Error("The args function must return an array");return e}async O(){const e=this.A(),t=this.k;this.k=e,e===t||e===void 0||t!==void 0&&this.j(t,e)||await this.run(e)}async run(e){var o,a,A,l,c;let t,i;e??(e=this.A()),this.k=e,this.status===1?(o=this.T)==null||o.abort():(this.t=void 0,this.i=void 0,this.o=void 0),this.status=1,this.autoRun==="afterUpdate"?queueMicrotask(()=>this.p.requestUpdate()):this.p.requestUpdate();const r=++this.u;this.T=new AbortController;let n=!1;try{t=await this._(e,{signal:this.T.signal})}catch(u){n=!0,i=u}if(this.u===r){if(t===kd)this.status=0;else{if(n===!1){try{(a=this.m)==null||a.call(this,t)}catch{}this.status=2,(A=this.i)==null||A.call(this,t)}else{try{(l=this.g)==null||l.call(this,i)}catch{}this.status=3,(c=this.o)==null||c.call(this,i)}this.l=t,this.h=i}this.p.requestUpdate()}}abort(e){var t;this.status===1&&((t=this.T)==null||t.abort(e))}get value(){return this.l}get error(){return this.h}render(e){var t,i,r,n;switch(this.status){case 0:return(t=e.initial)==null?void 0:t.call(e);case 1:return(i=e.pending)==null?void 0:i.call(e);case 2:return(r=e.complete)==null?void 0:r.call(e,this.value);case 3:return(n=e.error)==null?void 0:n.call(e,this.error);default:throw Error("Unexpected status: "+this.status)}}}const Fd=(s,e)=>s===e||s.length===e.length&&s.every((t,i)=>!Rr(t,e[i]));let _r;const Nd=new Uint8Array(16);function Md(){if(!_r&&(_r=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!_r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return _r(Nd)}const pt=[];for(let s=0;s<256;++s)pt.push((s+256).toString(16).slice(1));function Pd(s,e=0){return pt[s[e+0]]+pt[s[e+1]]+pt[s[e+2]]+pt[s[e+3]]+"-"+pt[s[e+4]]+pt[s[e+5]]+"-"+pt[s[e+6]]+pt[s[e+7]]+"-"+pt[s[e+8]]+pt[s[e+9]]+"-"+pt[s[e+10]]+pt[s[e+11]]+pt[s[e+12]]+pt[s[e+13]]+pt[s[e+14]]+pt[s[e+15]]}const YA={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function _i(s,e,t){if(YA.randomUUID&&!e&&!s)return YA.randomUUID();s=s||{};const i=s.random||(s.rng||Md)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let r=0;r<16;++r)e[t+r]=i[r];return e}return Pd(i)}const KA="https://d2rxhdlm2q91uk.cloudfront.net",Od="https://d1ix11aj5kfygl.cloudfront.net",Ud="https://d157jlwnudd93d.cloudfront.net",VA="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",Gd="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",Hd="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",$d="http://localhost:6060/v2",Yd="https://embed-dev.vouchfor.com/v2",Kd="https://embed-staging.vouchfor.com/v2",Vd="https://embed.vouchfor.com/v2";function kr(s){if(!["local","dev","staging","prod"].includes(s))throw new Error(`Unknown environment: ${s}`);if(s==="local")return{videoUrl:KA,publicApiUrl:VA,embedApiUrl:$d};if(s==="dev")return{videoUrl:KA,publicApiUrl:VA,embedApiUrl:Yd};if(s==="staging")return{videoUrl:Od,publicApiUrl:Gd,embedApiUrl:Kd};if(s==="prod")return{videoUrl:Ud,publicApiUrl:Hd,embedApiUrl:Vd}}class Jd{constructor(e){this._fetching=!1,this.getVouch=async(t,i,r)=>{var c;const{embedApiUrl:n}=kr(t),o=_i(),a=await fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return this.host.dispatchEvent(new CustomEvent("vouch:loaded",{detail:A==null?void 0:A.id})),((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/vouches/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.getTemplate=async(t,i,r)=>{var c;const{embedApiUrl:n}=kr(t),o=_i(),a=await fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["X-Cache-Check",o]]}),A=await a.json();return((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${n}/templates/${r}`,{method:"GET",headers:[["X-Api-Key",i],["Cache-Control","max-age=0"]]}),A},this.host=e,new Lr(this.host,async([t,i,r,n,o])=>{var a,A,l,c;try{if(e.vouch=void 0,e.template=void 0,r){let u;o&&(this.fetching=!0,u=await this.getTemplate(t,i,o)),this._vouch=r,e.template=u??((A=(a=r==null?void 0:r.settings)==null?void 0:a.template)==null?void 0:A.instance)}else if(n){this.fetching=!0;const[u,h]=await Promise.all([this.getVouch(t,i,n),o?this.getTemplate(t,i,o):null]);this._vouch=u,e.template=h??((c=(l=u==null?void 0:u.settings)==null?void 0:l.template)==null?void 0:c.instance)}}finally{this.fetching=!1}},()=>[e.env,e.apiKey,e.data,e.vouchId,e.templateId]),new Lr(this.host,([t,i])=>{e.vouch=t?{...t,questions:{items:t==null?void 0:t.questions.items.filter((r,n)=>!(i!=null&&i.length)||(i==null?void 0:i.includes(n+1)))}}:void 0},()=>[this._vouch,e.questions])}set fetching(e){this._fetching!==e&&(this._fetching=e,this.host.requestUpdate())}get fetching(){return this._fetching}}const Wd=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!qd(r,n)&&i||Object.defineProperty(s,t,n)},qd=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},jd=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Xd=(s,e)=>`/* Wrapped ${s}*/
56
+ ${e}`,zd=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Zd=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),eg=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=Xd.bind(null,i,e.toString());Object.defineProperty(r,"name",Zd);const{writable:n,enumerable:o,configurable:a}=zd;Object.defineProperty(s,"toString",{value:r,writable:n,enumerable:o,configurable:a})};function tg(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Wd(s,e,r,t);return jd(s,e),eg(s,e,i),s}const ig=new WeakMap,JA=new WeakMap;function Fr(s,{cacheKey:e,cache:t=new Map,maxAge:i}={}){if(i===0)return s;if(typeof i=="number"){if(i>2147483647)throw new TypeError("The `maxAge` option cannot exceed 2147483647.");if(i<0)throw new TypeError("The `maxAge` option should not be a negative number.")}const r=function(...n){var l;const o=e?e(n):n[0],a=t.get(o);if(a)return a.data;const A=s.apply(this,n);if(t.set(o,{data:A,maxAge:i?Date.now()+i:Number.POSITIVE_INFINITY}),typeof i=="number"&&i!==Number.POSITIVE_INFINITY){const c=setTimeout(()=>{t.delete(o)},i);(l=c.unref)==null||l.call(c);const u=JA.get(s)??new Set;u.add(c),JA.set(s,u)}return A};return tg(r,s,{ignoreNonConfigurable:!0}),ig.set(r,t),r}var WA=function(){};const sg=(s,e,t)=>Math.min(Math.max(t,s),e),qA=(s,e,t)=>{const i=e-s;return i===0?1:(t-s)/i},lo=(s,e,t)=>-t*s+t*e+s,jA=(s,e)=>t=>Math.max(Math.min(t,e),s),js=s=>s%1?Number(s.toFixed(5)):s,Nr=/(-)?([\d]*\.?[\d])+/g,co=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,rg=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Xs(s){return typeof s=="string"}const Mr={test:s=>typeof s=="number",parse:parseFloat,transform:s=>s},XA=Object.assign(Object.assign({},Mr),{transform:jA(0,1)});Object.assign(Object.assign({},Mr),{default:1});const zs=(s=>({test:e=>Xs(e)&&e.endsWith(s)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${s}`}))("%");Object.assign(Object.assign({},zs),{parse:s=>zs.parse(s)/100,transform:s=>zs.transform(s*100)});const uo=(s,e)=>t=>!!(Xs(t)&&rg.test(t)&&t.startsWith(s)||e&&Object.prototype.hasOwnProperty.call(t,e)),zA=(s,e,t)=>i=>{if(!Xs(i))return i;const[r,n,o,a]=i.match(Nr);return{[s]:parseFloat(r),[e]:parseFloat(n),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Ji={test:uo("hsl","hue"),parse:zA("hue","saturation","lightness"),transform:({hue:s,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(s)+", "+zs.transform(js(e))+", "+zs.transform(js(t))+", "+js(XA.transform(i))+")"},ng=jA(0,255),ho=Object.assign(Object.assign({},Mr),{transform:s=>Math.round(ng(s))}),ki={test:uo("rgb","red"),parse:zA("red","green","blue"),transform:({red:s,green:e,blue:t,alpha:i=1})=>"rgba("+ho.transform(s)+", "+ho.transform(e)+", "+ho.transform(t)+", "+js(XA.transform(i))+")"};function og(s){let e="",t="",i="",r="";return s.length>5?(e=s.substr(1,2),t=s.substr(3,2),i=s.substr(5,2),r=s.substr(7,2)):(e=s.substr(1,1),t=s.substr(2,1),i=s.substr(3,1),r=s.substr(4,1),e+=e,t+=t,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const go={test:uo("#"),parse:og,transform:ki.transform},Pr={test:s=>ki.test(s)||go.test(s)||Ji.test(s),parse:s=>ki.test(s)?ki.parse(s):Ji.test(s)?Ji.parse(s):go.parse(s),transform:s=>Xs(s)?s:s.hasOwnProperty("red")?ki.transform(s):Ji.transform(s)},ZA="${c}",el="${n}";function ag(s){var e,t,i,r;return isNaN(s)&&Xs(s)&&((t=(e=s.match(Nr))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((r=(i=s.match(co))===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0)>0}function tl(s){typeof s=="number"&&(s=`${s}`);const e=[];let t=0;const i=s.match(co);i&&(t=i.length,s=s.replace(co,ZA),e.push(...i.map(Pr.parse)));const r=s.match(Nr);return r&&(s=s.replace(Nr,el),e.push(...r.map(Mr.parse))),{values:e,numColors:t,tokenised:s}}function il(s){return tl(s).values}function sl(s){const{values:e,numColors:t,tokenised:i}=tl(s),r=e.length;return n=>{let o=i;for(let a=0;a<r;a++)o=o.replace(a<t?ZA:el,a<t?Pr.transform(n[a]):js(n[a]));return o}}const Ag=s=>typeof s=="number"?0:s;function lg(s){const e=il(s);return sl(s)(e.map(Ag))}const rl={test:ag,parse:il,createTransformer:sl,getAnimatableNone:lg};function fo(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?s+(e-s)*6*t:t<.5?e:t<.6666666666666666?s+(e-s)*(.6666666666666666-t)*6:s}function nl({hue:s,saturation:e,lightness:t,alpha:i}){s/=360,e/=100,t/=100;let r=0,n=0,o=0;if(!e)r=n=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,A=2*t-a;r=fo(A,a,s+.3333333333333333),n=fo(A,a,s),o=fo(A,a,s-.3333333333333333)}return{red:Math.round(r*255),green:Math.round(n*255),blue:Math.round(o*255),alpha:i}}const cg=(s,e,t)=>{const i=s*s,r=e*e;return Math.sqrt(Math.max(0,t*(r-i)+i))},ug=[go,ki,Ji],ol=s=>ug.find(e=>e.test(s)),al=(s,e)=>{let t=ol(s),i=ol(e),r=t.parse(s),n=i.parse(e);t===Ji&&(r=nl(r),t=ki),i===Ji&&(n=nl(n),i=ki);const o=Object.assign({},r);return a=>{for(const A in o)A!=="alpha"&&(o[A]=cg(r[A],n[A],a));return o.alpha=lo(r.alpha,n.alpha,a),t.transform(o)}},hg=s=>typeof s=="number",dg=(s,e)=>t=>e(s(t)),Al=(...s)=>s.reduce(dg);function ll(s,e){return hg(s)?t=>lo(s,e,t):Pr.test(s)?al(s,e):hl(s,e)}const cl=(s,e)=>{const t=[...s],i=t.length,r=s.map((n,o)=>ll(n,e[o]));return n=>{for(let o=0;o<i;o++)t[o]=r[o](n);return t}},gg=(s,e)=>{const t=Object.assign(Object.assign({},s),e),i={};for(const r in t)s[r]!==void 0&&e[r]!==void 0&&(i[r]=ll(s[r],e[r]));return r=>{for(const n in i)t[n]=i[n](r);return t}};function ul(s){const e=rl.parse(s),t=e.length;let i=0,r=0,n=0;for(let o=0;o<t;o++)i||typeof e[o]=="number"?i++:e[o].hue!==void 0?n++:r++;return{parsed:e,numNumbers:i,numRGB:r,numHSL:n}}const hl=(s,e)=>{const t=rl.createTransformer(e),i=ul(s),r=ul(e);return i.numHSL===r.numHSL&&i.numRGB===r.numRGB&&i.numNumbers>=r.numNumbers?Al(cl(i.parsed,r.parsed),t):o=>`${o>0?e:s}`},fg=(s,e)=>t=>lo(s,e,t);function pg(s){if(typeof s=="number")return fg;if(typeof s=="string")return Pr.test(s)?al:hl;if(Array.isArray(s))return cl;if(typeof s=="object")return gg}function Eg(s,e,t){const i=[],r=t||pg(s[0]),n=s.length-1;for(let o=0;o<n;o++){let a=r(s[o],s[o+1]);if(e){const A=Array.isArray(e)?e[o]:e;a=Al(A,a)}i.push(a)}return i}function Ig([s,e],[t]){return i=>t(qA(s,e,i))}function mg(s,e){const t=s.length,i=t-1;return r=>{let n=0,o=!1;if(r<=s[0]?o=!0:r>=s[i]&&(n=i-1,o=!0),!o){let A=1;for(;A<t&&!(s[A]>r||A===i);A++);n=A-1}const a=qA(s[n],s[n+1],r);return e[n](a)}}function Cg(s,e,{clamp:t=!0,ease:i,mixer:r}={}){const n=s.length;WA(n===e.length),WA(!i||!Array.isArray(i)||i.length===n-1),s[0]>s[n-1]&&(s=[].concat(s),e=[].concat(e),s.reverse(),e.reverse());const o=Eg(e,i,r),a=n===2?Ig(s,o):mg(s,o);return t?A=>a(sg(s[0],s[n-1],A)):a}const Or=s=>e=>1-s(1-e),po=s=>e=>e<=.5?s(2*e)/2:(2-s(2*(1-e)))/2,vg=s=>e=>Math.pow(e,s),dl=s=>e=>e*e*((s+1)*e-s),yg=s=>{const e=dl(s);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},gl=1.525,Bg=4/11,Qg=8/11,bg=9/10,Sg=s=>s,Eo=vg(2),wg=Or(Eo),Rg=po(Eo),fl=s=>1-Math.sin(Math.acos(s)),pl=Or(fl),xg=po(pl),Io=dl(gl),Tg=Or(Io),Dg=po(Io),Lg=yg(gl),_g=4356/361,kg=35442/1805,Fg=16061/1805,Ur=s=>{if(s===1||s===0)return s;const e=s*s;return s<Bg?7.5625*e:s<Qg?9.075*e-9.9*s+3.4:s<bg?_g*e-kg*s+Fg:10.8*s*s-20.52*s+10.72},Ng=Or(Ur),Mg=s=>s<.5?.5*(1-Ur(1-s*2)):.5*Ur(s*2-1)+.5;var Gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function El(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var mo={exports:{}};(function(s,e){(function(t,i){i(e)})(Gr,function(t){function i(R){var w,L,K=new Error(R);return w=K,L=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(w,L):w.__proto__=L,K}function r(R,w,L){var K=w.slice(0,L).split(/\n/),G=K.length,j=K[G-1].length+1;throw i(R+=" at line "+G+" col "+j+`:
57
+
58
+ `+w.split(/\n/)[G-1]+`
59
+ `+Array(j).join(" ")+"^")}i.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,o=!1;try{o=new Function("return (async function(){}).constructor")()}catch(R){if(!(R instanceof SyntaxError))throw R}function a(R,w){return Object.prototype.hasOwnProperty.call(R,w)}function A(R,w,L){for(var K in w)a(w,K)&&(w[K]==null||typeof w[K]!="object"||K!=="storage"&&K!=="prefixes"||L?R[K]=w[K]:R[K]=A({},w[K]));return R}var l=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,u=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,h=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function g(R){return d.test(R)?R.replace(d,"\\$&"):R}function f(R,w){w.rmWhitespace&&(R=R.replace(/[\r\n]+/g,`
60
+ `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,u.lastIndex=0,h.lastIndex=0;var L=w.prefixes,K=[L.h,L.b,L.i,L.r,L.c,L.e].reduce(function(ae,Ie){return ae&&Ie?ae+"|"+g(Ie):Ie?g(Ie):ae},""),G=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+g(w.tags[1])+")","g"),j=new RegExp("([^]*?)"+g(w.tags[0])+"(-|_)?\\s*("+K+")?\\s*","g"),te=0,ue=!1;function ce(ae,Ie){var _e,Te={f:[]},Ne=0,re="c";function le(Xe){var rt=R.slice(te,Xe),Ke=rt.trim();if(re==="f")Ke==="safe"?Te.raw=!0:w.async&&l.test(Ke)?(Ke=Ke.replace(l,""),Te.f.push([Ke,"",!0])):Te.f.push([Ke,""]);else if(re==="fp")Te.f[Te.f.length-1][1]+=Ke;else if(re==="err"){if(Ke){var nt=rt.search(/\S/);r("invalid syntax",R,te+nt)}}else Te[re]=Ke;te=Xe+1}for(Ie==="h"||Ie==="b"||Ie==="c"?re="n":Ie==="r"&&(Te.raw=!0,Ie="i"),G.lastIndex=te;(_e=G.exec(R))!==null;){var be=_e[1],De=_e[2],Ue=_e[3],we=_e[4],ke=_e[5],Ce=_e.index;if(be)be==="("?(Ne===0&&(re==="n"?(le(Ce),re="p"):re==="f"&&(le(Ce),re="fp")),Ne++):be===")"?--Ne===0&&re!=="c"&&(le(Ce),re="err"):Ne===0&&be==="|"?(le(Ce),re="f"):be==="=>"&&(le(Ce),te+=1,re="res");else if(De)if(De==="/*"){var Me=R.indexOf("*/",G.lastIndex);Me===-1&&r("unclosed comment",R,_e.index),G.lastIndex=Me+2}else De==="'"?(u.lastIndex=_e.index,u.exec(R)?G.lastIndex=u.lastIndex:r("unclosed string",R,_e.index)):De==='"'?(h.lastIndex=_e.index,h.exec(R)?G.lastIndex=h.lastIndex:r("unclosed string",R,_e.index)):De==="`"&&(c.lastIndex=_e.index,c.exec(R)?G.lastIndex=c.lastIndex:r("unclosed string",R,_e.index));else if(Ue)return le(Ce),te=Ce+_e[0].length,j.lastIndex=te,ue=ke,we&&Ie==="h"&&(Ie="s"),Te.t=Ie,Te}return r("unclosed tag",R,ae),Te}var me=function ae(Ie,_e){Ie.b=[],Ie.d=[];var Te,Ne=!1,re=[];function le(nt,Ri){nt&&(nt=function(yt,gi,fi,pi){var mt,Y;return typeof gi.autoTrim=="string"?mt=Y=gi.autoTrim:Array.isArray(gi.autoTrim)&&(mt=gi.autoTrim[1],Y=gi.autoTrim[0]),(fi||fi===!1)&&(mt=fi),(pi||pi===!1)&&(Y=pi),mt==="slurp"&&Y==="slurp"?yt.trim():(mt==="_"||mt==="slurp"?yt=String.prototype.trimLeft?yt.trimLeft():yt.replace(/^[\s\uFEFF\xA0]+/,""):mt!=="-"&&mt!=="nl"||(yt=yt.replace(/^(?:\n|\r|\r\n)/,"")),Y==="_"||Y==="slurp"?yt=String.prototype.trimRight?yt.trimRight():yt.replace(/[\s\uFEFF\xA0]+$/,""):Y!=="-"&&Y!=="nl"||(yt=yt.replace(/(?:\n|\r|\r\n)$/,"")),yt)}(nt,w,ue,Ri))&&(nt=nt.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),re.push(nt))}for(;(Te=j.exec(R))!==null;){var be,De=Te[1],Ue=Te[2],we=Te[3]||"";for(var ke in L)if(L[ke]===we){be=ke;break}le(De,Ue),te=Te.index+Te[0].length,be||r("unrecognized tag type: "+we,R,te);var Ce=ce(Te.index,be),Me=Ce.t;if(Me==="h"){var Xe=Ce.n||"";w.async&&l.test(Xe)&&(Ce.a=!0,Ce.n=Xe.replace(l,"")),Ce=ae(Ce),re.push(Ce)}else if(Me==="c"){if(Ie.n===Ce.n)return Ne?(Ne.d=re,Ie.b.push(Ne)):Ie.d=re,Ie;r("Helper start and end don't match",R,Te.index+Te[0].length)}else if(Me==="b"){Ne?(Ne.d=re,Ie.b.push(Ne)):Ie.d=re;var rt=Ce.n||"";w.async&&l.test(rt)&&(Ce.a=!0,Ce.n=rt.replace(l,"")),Ne=Ce,re=[]}else if(Me==="s"){var Ke=Ce.n||"";w.async&&l.test(Ke)&&(Ce.a=!0,Ce.n=Ke.replace(l,"")),re.push(Ce)}else re.push(Ce)}if(!_e)throw i('unclosed helper "'+Ie.n+'"');return le(R.slice(te,R.length),!1),Ie.d=re,Ie}({f:[]},!0);if(w.plugins)for(var Qe=0;Qe<w.plugins.length;Qe++){var xe=w.plugins[Qe];xe.processAST&&(me.d=xe.processAST(me.d,w))}return me.d}function p(R,w){var L=f(R,w),K="var tR='';"+(w.useWith?"with("+w.varName+"||{}){":"")+b(L,w)+"if(cb){cb(null,tR)} return tR"+(w.useWith?"}":"");if(w.plugins)for(var G=0;G<w.plugins.length;G++){var j=w.plugins[G];j.processFnString&&(K=j.processFnString(K,w))}return K}function v(R,w){for(var L=0;L<w.length;L++){var K=w[L][0],G=w[L][1];R=(w[L][2]?"await ":"")+"c.l('F','"+K+"')("+R,G&&(R+=","+G),R+=")"}return R}function y(R,w,L,K,G,j){var te="{exec:"+(G?"async ":"")+m(L,w,R)+",params:["+K+"]";return j&&(te+=",name:'"+j+"'"),G&&(te+=",async:true"),te+="}"}function Q(R,w){for(var L="[",K=0;K<R.length;K++){var G=R[K];L+=y(w,G.res||"",G.d,G.p||"",G.a,G.n),K<R.length&&(L+=",")}return L+="]"}function m(R,w,L){return"function("+w+"){var tR='';"+b(R,L)+"return tR}"}function b(R,w){for(var L=0,K=R.length,G="";L<K;L++){var j=R[L];if(typeof j=="string")G+="tR+='"+j+"';";else{var te=j.t,ue=j.c||"",ce=j.f,me=j.n||"",Qe=j.p||"",xe=j.res||"",ae=j.b,Ie=!!j.a;if(te==="i"){w.defaultFilter&&(ue="c.l('F','"+w.defaultFilter+"')("+ue+")");var _e=v(ue,ce);!j.raw&&w.autoEscape&&(_e="c.l('F','e')("+_e+")"),G+="tR+="+_e+";"}else if(te==="h")if(w.storage.nativeHelpers.get(me))G+=w.storage.nativeHelpers.get(me)(j,w);else{var Te=(Ie?"await ":"")+"c.l('H','"+me+"')("+y(w,xe,j.d,Qe,Ie);Te+=ae?","+Q(ae,w):",[]",G+="tR+="+v(Te+=",c)",ce)+";"}else te==="s"?G+="tR+="+v((Ie?"await ":"")+"c.l('H','"+me+"')({params:["+Qe+"]},[],c)",ce)+";":te==="e"&&(G+=ue+`
61
+ `)}}return G}var x=function(){function R(w){this.cache=w}return R.prototype.define=function(w,L){this.cache[w]=L},R.prototype.get=function(w){return this.cache[w]},R.prototype.remove=function(w){delete this.cache[w]},R.prototype.reset=function(){this.cache={}},R.prototype.load=function(w){A(this.cache,w,!0)},R}();function B(R,w,L,K){if(w&&w.length>0)throw i((K?"Native":"")+"Helper '"+R+"' doesn't accept blocks");if(L&&L.length>0)throw i((K?"Native":"")+"Helper '"+R+"' doesn't accept filters")}var H={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function _(R){return H[R]}var k=new x({}),U=new x({each:function(R,w){var L="",K=R.params[0];if(B("each",w,!1),R.async)return new Promise(function(j){(function te(ue,ce,me,Qe,xe){me(ue[ce],ce).then(function(ae){Qe+=ae,ce===ue.length-1?xe(Qe):te(ue,ce+1,me,Qe,xe)})})(K,0,R.exec,L,j)});for(var G=0;G<K.length;G++)L+=R.exec(K[G],G);return L},foreach:function(R,w){var L=R.params[0];if(B("foreach",w,!1),R.async)return new Promise(function(j){(function te(ue,ce,me,Qe,xe,ae){Qe(ce[me],ue[ce[me]]).then(function(Ie){xe+=Ie,me===ce.length-1?ae(xe):te(ue,ce,me+1,Qe,xe,ae)})})(L,Object.keys(L),0,R.exec,"",j)});var K="";for(var G in L)a(L,G)&&(K+=R.exec(G,L[G]));return K},include:function(R,w,L){B("include",w,!1);var K=L.storage.templates.get(R.params[0]);if(!K)throw i('Could not fetch template "'+R.params[0]+'"');return K(R.params[1],L)},extends:function(R,w,L){var K=R.params[1]||{};K.content=R.exec();for(var G=0;G<w.length;G++){var j=w[G];K[j.name]=j.exec()}var te=L.storage.templates.get(R.params[0]);if(!te)throw i('Could not fetch template "'+R.params[0]+'"');return te(K,L)},useScope:function(R,w){return B("useScope",w,!1),R.exec(R.params[0])}}),q=new x({if:function(R,w){B("if",!1,R.f,!0);var L="if("+R.p+"){"+b(R.d,w)+"}";if(R.b)for(var K=0;K<R.b.length;K++){var G=R.b[K];G.n==="else"?L+="else{"+b(G.d,w)+"}":G.n==="elif"&&(L+="else if("+G.p+"){"+b(G.d,w)+"}")}return L},try:function(R,w){if(B("try",!1,R.f,!0),!R.b||R.b.length!==1||R.b[0].n!=="catch")throw i("native helper 'try' only accepts 1 block, 'catch'");var L="try{"+b(R.d,w)+"}",K=R.b[0];return L+="catch"+(K.res?"("+K.res+")":"")+"{"+b(K.d,w)+"}"},block:function(R,w){return B("block",R.b,R.f,!0),"if(!"+w.varName+"["+R.p+"]){tR+=("+m(R.d,"",w)+")()}else{tR+="+w.varName+"["+R.p+"]}"}}),V=new x({e:function(R){var w=String(R);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,_):w}}),Z={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(R,w){if(R==="H"){var L=this.storage.helpers.get(w);if(L)return L;throw i("Can't find helper '"+w+"'")}if(R==="F"){var K=this.storage.filters.get(w);if(K)return K;throw i("Can't find filter '"+w+"'")}},async:!1,storage:{helpers:U,nativeHelpers:q,filters:V,templates:k},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function S(R,w){var L={};return A(L,Z),w&&A(L,w),R&&A(L,R),L.l.bind(L),L}function T(R,w){var L=S(w||{}),K=Function;if(L.async){if(!o)throw i("This environment doesn't support async/await");K=o}try{return new K(L.varName,"c","cb",p(R,L))}catch(G){throw G instanceof SyntaxError?i(`Bad template syntax
62
+
63
+ `+G.message+`
64
+ `+Array(G.message.length+1).join("=")+`
65
+ `+p(R,L)):G}}function O(R,w){var L;return w.cache&&w.name&&w.storage.templates.get(w.name)?w.storage.templates.get(w.name):(L=typeof R=="function"?R:T(R,w),w.cache&&w.name&&w.storage.templates.define(w.name,L),L)}Z.l.bind(Z),t.compile=T,t.compileScope=b,t.compileScopeIntoFunction=m,t.compileToString=p,t.defaultConfig=Z,t.filters=V,t.getConfig=S,t.helpers=U,t.nativeHelpers=q,t.parse=f,t.render=function(R,w,L,K){var G=S(L||{});if(!G.async)return O(R,G)(w,G);if(!K){if(typeof n=="function")return new n(function(j,te){try{j(O(R,G)(w,G))}catch(ue){te(ue)}});throw i("Please provide a callback function, this env doesn't support Promises")}try{O(R,G)(w,G,K)}catch(j){return K(j)}},t.templates=k,Object.defineProperty(t,"__esModule",{value:!0})})})(mo,mo.exports);var Co=mo.exports;const Pg=(s,e,t,i)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const r=Object.getOwnPropertyDescriptor(s,t),n=Object.getOwnPropertyDescriptor(e,t);!Og(r,n)&&i||Object.defineProperty(s,t,n)},Og=function(s,e){return s===void 0||s.configurable||s.writable===e.writable&&s.enumerable===e.enumerable&&s.configurable===e.configurable&&(s.writable||s.value===e.value)},Ug=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Gg=(s,e)=>`/* Wrapped ${s}*/
66
+ ${e}`,Hg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),$g=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Yg=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=Gg.bind(null,i,e.toString());Object.defineProperty(r,"name",$g),Object.defineProperty(s,"toString",{...Hg,value:r})};function Kg(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Pg(s,e,r,t);return Ug(s,e),Yg(s,e,i),s}const Vg=new WeakMap;function $t(s,{cacheKey:e=([i])=>i,cache:t=new Map}={}){const i=new Map,r=function(...n){const o=e(n);if(i.has(o))return i.get(o);const a=(async()=>{try{if(t&&await t.has(o))return await t.get(o);const l=await s.apply(this,n);try{return l}finally{t&&await t.set(o,l)}}finally{i.delete(o)}})();return i.set(o,a),a};return Kg(r,s,{ignoreNonConfigurable:!0}),Vg.set(r,t),r}var Il={},vo={},Be={};Object.defineProperty(Be,"__esModule",{value:!0}),Be.default=Be.Wrap=Be.Unit=Be.PrintOptions=Be.PositionType=Be.Overflow=Be.NodeType=Be.MeasureMode=Be.LogLevel=Be.Justify=Be.Gutter=Be.FlexDirection=Be.ExperimentalFeature=Be.Errata=Be.Edge=Be.Display=Be.Direction=Be.Dimension=Be.Align=void 0;let Ci=function(s){return s[s.Auto=0]="Auto",s[s.FlexStart=1]="FlexStart",s[s.Center=2]="Center",s[s.FlexEnd=3]="FlexEnd",s[s.Stretch=4]="Stretch",s[s.Baseline=5]="Baseline",s[s.SpaceBetween=6]="SpaceBetween",s[s.SpaceAround=7]="SpaceAround",s}({});Be.Align=Ci;let yo=function(s){return s[s.Width=0]="Width",s[s.Height=1]="Height",s}({});Be.Dimension=yo;let Hr=function(s){return s[s.Inherit=0]="Inherit",s[s.LTR=1]="LTR",s[s.RTL=2]="RTL",s}({});Be.Direction=Hr;let Bo=function(s){return s[s.Flex=0]="Flex",s[s.None=1]="None",s}({});Be.Display=Bo;let Zt=function(s){return s[s.Left=0]="Left",s[s.Top=1]="Top",s[s.Right=2]="Right",s[s.Bottom=3]="Bottom",s[s.Start=4]="Start",s[s.End=5]="End",s[s.Horizontal=6]="Horizontal",s[s.Vertical=7]="Vertical",s[s.All=8]="All",s}({});Be.Edge=Zt;let Zs=function(s){return s[s.None=0]="None",s[s.StretchFlexBasis=1]="StretchFlexBasis",s[s.All=2147483647]="All",s[s.Classic=2147483646]="Classic",s}({});Be.Errata=Zs;let $r=function(s){return s[s.WebFlexBasis=0]="WebFlexBasis",s[s.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",s[s.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",s}({});Be.ExperimentalFeature=$r;let er=function(s){return s[s.Column=0]="Column",s[s.ColumnReverse=1]="ColumnReverse",s[s.Row=2]="Row",s[s.RowReverse=3]="RowReverse",s}({});Be.FlexDirection=er;let Yr=function(s){return s[s.Column=0]="Column",s[s.Row=1]="Row",s[s.All=2]="All",s}({});Be.Gutter=Yr;let Wi=function(s){return s[s.FlexStart=0]="FlexStart",s[s.Center=1]="Center",s[s.FlexEnd=2]="FlexEnd",s[s.SpaceBetween=3]="SpaceBetween",s[s.SpaceAround=4]="SpaceAround",s[s.SpaceEvenly=5]="SpaceEvenly",s}({});Be.Justify=Wi;let qi=function(s){return s[s.Error=0]="Error",s[s.Warn=1]="Warn",s[s.Info=2]="Info",s[s.Debug=3]="Debug",s[s.Verbose=4]="Verbose",s[s.Fatal=5]="Fatal",s}({});Be.LogLevel=qi;let Kr=function(s){return s[s.Undefined=0]="Undefined",s[s.Exactly=1]="Exactly",s[s.AtMost=2]="AtMost",s}({});Be.MeasureMode=Kr;let Qo=function(s){return s[s.Default=0]="Default",s[s.Text=1]="Text",s}({});Be.NodeType=Qo;let Vr=function(s){return s[s.Visible=0]="Visible",s[s.Hidden=1]="Hidden",s[s.Scroll=2]="Scroll",s}({});Be.Overflow=Vr;let Jr=function(s){return s[s.Static=0]="Static",s[s.Relative=1]="Relative",s[s.Absolute=2]="Absolute",s}({});Be.PositionType=Jr;let Wr=function(s){return s[s.Layout=1]="Layout",s[s.Style=2]="Style",s[s.Children=4]="Children",s}({});Be.PrintOptions=Wr;let tr=function(s){return s[s.Undefined=0]="Undefined",s[s.Point=1]="Point",s[s.Percent=2]="Percent",s[s.Auto=3]="Auto",s}({});Be.Unit=tr;let qr=function(s){return s[s.NoWrap=0]="NoWrap",s[s.Wrap=1]="Wrap",s[s.WrapReverse=2]="WrapReverse",s}({});Be.Wrap=qr;var Jg={ALIGN_AUTO:Ci.Auto,ALIGN_FLEX_START:Ci.FlexStart,ALIGN_CENTER:Ci.Center,ALIGN_FLEX_END:Ci.FlexEnd,ALIGN_STRETCH:Ci.Stretch,ALIGN_BASELINE:Ci.Baseline,ALIGN_SPACE_BETWEEN:Ci.SpaceBetween,ALIGN_SPACE_AROUND:Ci.SpaceAround,DIMENSION_WIDTH:yo.Width,DIMENSION_HEIGHT:yo.Height,DIRECTION_INHERIT:Hr.Inherit,DIRECTION_LTR:Hr.LTR,DIRECTION_RTL:Hr.RTL,DISPLAY_FLEX:Bo.Flex,DISPLAY_NONE:Bo.None,EDGE_LEFT:Zt.Left,EDGE_TOP:Zt.Top,EDGE_RIGHT:Zt.Right,EDGE_BOTTOM:Zt.Bottom,EDGE_START:Zt.Start,EDGE_END:Zt.End,EDGE_HORIZONTAL:Zt.Horizontal,EDGE_VERTICAL:Zt.Vertical,EDGE_ALL:Zt.All,ERRATA_NONE:Zs.None,ERRATA_STRETCH_FLEX_BASIS:Zs.StretchFlexBasis,ERRATA_ALL:Zs.All,ERRATA_CLASSIC:Zs.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:$r.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:$r.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:$r.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:er.Column,FLEX_DIRECTION_COLUMN_REVERSE:er.ColumnReverse,FLEX_DIRECTION_ROW:er.Row,FLEX_DIRECTION_ROW_REVERSE:er.RowReverse,GUTTER_COLUMN:Yr.Column,GUTTER_ROW:Yr.Row,GUTTER_ALL:Yr.All,JUSTIFY_FLEX_START:Wi.FlexStart,JUSTIFY_CENTER:Wi.Center,JUSTIFY_FLEX_END:Wi.FlexEnd,JUSTIFY_SPACE_BETWEEN:Wi.SpaceBetween,JUSTIFY_SPACE_AROUND:Wi.SpaceAround,JUSTIFY_SPACE_EVENLY:Wi.SpaceEvenly,LOG_LEVEL_ERROR:qi.Error,LOG_LEVEL_WARN:qi.Warn,LOG_LEVEL_INFO:qi.Info,LOG_LEVEL_DEBUG:qi.Debug,LOG_LEVEL_VERBOSE:qi.Verbose,LOG_LEVEL_FATAL:qi.Fatal,MEASURE_MODE_UNDEFINED:Kr.Undefined,MEASURE_MODE_EXACTLY:Kr.Exactly,MEASURE_MODE_AT_MOST:Kr.AtMost,NODE_TYPE_DEFAULT:Qo.Default,NODE_TYPE_TEXT:Qo.Text,OVERFLOW_VISIBLE:Vr.Visible,OVERFLOW_HIDDEN:Vr.Hidden,OVERFLOW_SCROLL:Vr.Scroll,POSITION_TYPE_STATIC:Jr.Static,POSITION_TYPE_RELATIVE:Jr.Relative,POSITION_TYPE_ABSOLUTE:Jr.Absolute,PRINT_OPTIONS_LAYOUT:Wr.Layout,PRINT_OPTIONS_STYLE:Wr.Style,PRINT_OPTIONS_CHILDREN:Wr.Children,UNIT_UNDEFINED:tr.Undefined,UNIT_POINT:tr.Point,UNIT_PERCENT:tr.Percent,UNIT_AUTO:tr.Auto,WRAP_NO_WRAP:qr.NoWrap,WRAP_WRAP:qr.Wrap,WRAP_WRAP_REVERSE:qr.WrapReverse};Be.default=Jg,Object.defineProperty(vo,"__esModule",{value:!0}),vo.default=qg;var Fi=Wg(Be);function ml(s){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(ml=function(i){return i?t:e})(s)}function Wg(s,e){if(!e&&s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var t=ml(e);if(t&&t.has(s))return t.get(s);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in s)if(n!=="default"&&Object.prototype.hasOwnProperty.call(s,n)){var o=r?Object.getOwnPropertyDescriptor(s,n):null;o&&(o.get||o.set)?Object.defineProperty(i,n,o):i[n]=s[n]}return i.default=s,t&&t.set(s,i),i}function qg(s){function e(r,n,o){const a=r[n];r[n]=function(){for(var A=arguments.length,l=new Array(A),c=0;c<A;c++)l[c]=arguments[c];return o.call(this,a,...l)}}for(const r of["setPosition","setMargin","setFlexBasis","setWidth","setHeight","setMinWidth","setMinHeight","setMaxWidth","setMaxHeight","setPadding"]){const n={[Fi.Unit.Point]:s.Node.prototype[r],[Fi.Unit.Percent]:s.Node.prototype[`${r}Percent`],[Fi.Unit.Auto]:s.Node.prototype[`${r}Auto`]};e(s.Node.prototype,r,function(o){for(var a=arguments.length,A=new Array(a>1?a-1:0),l=1;l<a;l++)A[l-1]=arguments[l];const c=A.pop();let u,h;if(c==="auto")u=Fi.Unit.Auto,h=void 0;else if(typeof c=="object")u=c.unit,h=c.valueOf();else if(u=typeof c=="string"&&c.endsWith("%")?Fi.Unit.Percent:Fi.Unit.Point,h=parseFloat(c),!Number.isNaN(c)&&Number.isNaN(h))throw new Error(`Invalid value ${c} for ${r}`);if(!n[u])throw new Error(`Failed to execute "${r}": Unsupported unit '${c}'`);return h!==void 0?n[u].call(this,...A,h):n[u].call(this,...A)})}function t(r){return s.MeasureCallback.implement({measure:function(){const{width:n,height:o}=r(...arguments);return{width:n??NaN,height:o??NaN}}})}e(s.Node.prototype,"setMeasureFunc",function(r,n){return n?r.call(this,t(n)):this.unsetMeasureFunc()});function i(r){return s.DirtiedCallback.implement({dirtied:r})}return e(s.Node.prototype,"setDirtiedFunc",function(r,n){r.call(this,i(n))}),e(s.Config.prototype,"free",function(){s.Config.destroy(this)}),e(s.Node,"create",(r,n)=>n?s.Node.createWithConfig(n):s.Node.createDefault()),e(s.Node.prototype,"free",function(){s.Node.destroy(this)}),e(s.Node.prototype,"freeRecursive",function(){for(let r=0,n=this.getChildCount();r<n;++r)this.getChild(0).freeRecursive();this.free()}),e(s.Node.prototype,"calculateLayout",function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NaN,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Fi.Direction.LTR;return r.call(this,n,o,a)}),{Config:s.Config,Node:s.Node,...Fi.default}}var Cl={exports:{}};(function(s,e){var t=(()=>{var i=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(r){r=r||{};var n;n||(n=typeof r<"u"?r:{});var o,a;n.ready=new Promise(function(I,C){o=I,a=C});var A=Object.assign({},n),l="";typeof document<"u"&&document.currentScript&&(l=document.currentScript.src),i&&(l=i),l.indexOf("blob:")!==0?l=l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):l="";var c=n.print||console.log.bind(console),u=n.printErr||console.warn.bind(console);Object.assign(n,A),A=null;var h;n.wasmBinary&&(h=n.wasmBinary),n.noExitRuntime,typeof WebAssembly!="object"&&O("no native wasm support detected");var d,g=!1;function f(I,C,D){D=C+D;for(var F="";!(C>=D);){var P=I[C++];if(!P)break;if(P&128){var W=I[C++]&63;if((P&224)==192)F+=String.fromCharCode((P&31)<<6|W);else{var z=I[C++]&63;P=(P&240)==224?(P&15)<<12|W<<6|z:(P&7)<<18|W<<12|z<<6|I[C++]&63,65536>P?F+=String.fromCharCode(P):(P-=65536,F+=String.fromCharCode(55296|P>>10,56320|P&1023))}}else F+=String.fromCharCode(P)}return F}var p,v,y,Q,m,b,x,B,H;function _(){var I=d.buffer;p=I,n.HEAP8=v=new Int8Array(I),n.HEAP16=Q=new Int16Array(I),n.HEAP32=b=new Int32Array(I),n.HEAPU8=y=new Uint8Array(I),n.HEAPU16=m=new Uint16Array(I),n.HEAPU32=x=new Uint32Array(I),n.HEAPF32=B=new Float32Array(I),n.HEAPF64=H=new Float64Array(I)}var k,U=[],q=[],V=[];function Z(){var I=n.preRun.shift();U.unshift(I)}var S=0,T=null;function O(I){throw n.onAbort&&n.onAbort(I),I="Aborted("+I+")",u(I),g=!0,I=new WebAssembly.RuntimeError(I+". Build with -sASSERTIONS for more info."),a(I),I}function R(I){return I.startsWith("data:application/octet-stream;base64,")}var w;if(w="data:application/octet-stream;base64,AGFzbQEAAAABvgM4YAF/AGACf38AYAF/AX9gA39/fwBgAn98AGACf38Bf2ADf39/AX9gAABgA39/fABgAX8BfGADf399AX1gBX9/f39/AX9gAn9/AXxgAAF/YAZ/f31/fX8AYAR/f39/AX9gAn9/AX1gBn9/f39/fwF/YAV/f39/fwBgBH9/f38AYAN/fn8BfmAHf39/f39/fwBgBn9/f39/fwBgAn19AX1gAX0Bf2ABfwF9YAZ/fH9/f38Bf2ACf30AYAR/fHx/AGAIf39/f39/f38AYA1/f39/f39/f39/f39/AGAKf39/f39/f39/fwBgBX9/f39/AXxgBH9/fX0BfWAEfHx/fwF9YA5/fX1/f399fX9/f39/fwF/YAZ/f319f38AYAJ+fwF/YAR/fX1/AX1gA399fQF9YAF8AXxgBH98fHwAYAV/f319fQF9YA5/fX1/f399fX9/f39/fwBgB39/fX99f38AYA1/fX99f31/fX19fX1/AX9gBX9/fX19AGAEf39+fgBgB39/f39/f38Bf2ACfH8BfGAFf398fH8AYAN/f38BfWADf39/AXxgBH9/f3wAYAN/f30AYAZ/f31/fX8BfwKvAR0BYQFhAB0BYQFiAAMBYQFjABUBYQFkABIBYQFlAAcBYQFmAB4BYQFnAAABYQFoAB8BYQFpAAMBYQFqAAABYQFrABYBYQFsAAUBYQFtAAMBYQFuAAEBYQFvABYBYQFwAAYBYQFxAAABYQFyAAABYQFzACABYQF0ABMBYQF1AAsBYQF2ABUBYQF3AAIBYQF4AAMBYQF5AA8BYQF6AAIBYQFBAAEBYQFCABIBYQFDAAEDgwKBAgIXChAQCgoKIQIDEgAGBgcBBRgiGAYPCgMGIwMDBSQDGSUBDwoZAwMKAgUAAAIDAQMGAgcBCA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KgIAIQQgASgCBEEBaw4CAgEECyAAQf////97cUGAgICAAmq+IQQgAEGAgICABHFFDQELIAQgA5RDCtcjPJQhBAsgBEMAAAAAYEUNAQsgAiAEXg0BCyAFQwAAAABgRQRAIAIPCyAFIAIgAiAFXRshBAsgBAsEACAAC74BAQN/IAAtAABBIHFFBEACQCABIQMCQCACIAAiASgCECIABH8gAAUgARB+DQEgASgCEAsgASgCFCIFa0sEQCABIAMgAiABKAIkEQYAGgwCCwJAIAEoAlBBAEgNACACIQADQCAAIgRFDQEgAyAEQQFrIgBqLQAAQQpHDQALIAEgAyAEIAEoAiQRBgAgBEkNASADIARqIQMgAiAEayECIAEoAhQhBQsgBSADIAIQKxogASABKAIUIAJqNgIUCwsLC20BAX8jAEGAAmsiBSQAIARBgMAEcSACIANMckUEQCAFIAFB/wFxIAIgA2siA0GAAiADQYACSSIBGxAqGiABRQRAA0AgACAFQYACECcgA0GAAmsiA0H/AUsNAAsLIAAgBSADECcLIAVBgAJqJAALzAIBBX8gAARAIABBBGsiASgCACIFIQMgASECIABBCGsoAgAiACAAQX5xIgRHBEAgASAEayICKAIEIgAgAigCCDYCCCACKAIIIAA2AgQgBCAFaiEDCyABIAVqIgQoAgAiASABIARqQQRrKAIARwRAIAQoAgQiACAEKAIINgIIIAQoAgggADYCBCABIANqIQMLIAIgAzYCACADQXxxIAJqQQRrIANBAXI2AgAgAgJ/IAIoAgBBCGsiAUH/AE0EQCABQQN2QQFrDAELIAFBHSABZyIAa3ZBBHMgAEECdGtB7gBqIAFB/x9NDQAaQT8gAUEeIABrdkECcyAAQQF0a0HHAGoiACAAQT9PGwsiAUEEdCIAQdAuajYCBCACIABB2C5qIgAoAgA2AgggACACNgIAIAIoAgggAjYCBEHYNkHYNikDAEIBIAGthoQ3AwALC/ICAgJ/AX4CQCACRQ0AIAAgAToAACAAIAJqIgNBAWsgAToAACACQQNJDQAgACABOgACIAAgAToAASADQQNrIAE6AAAgA0ECayABOgAAIAJBB0kNACAAIAE6AAMgA0EEayABOgAAIAJBCUkNACAAQQAgAGtBA3EiBGoiAyABQf8BcUGBgoQIbCIBNgIAIAMgAiAEa0F8cSIEaiICQQRrIAE2AgAgBEEJSQ0AIAMgATYCCCADIAE2AgQgAkEIayABNgIAIAJBDGsgATYCACAEQRlJDQAgAyABNgIYIAMgATYCFCADIAE2AhAgAyABNgIMIAJBEGsgATYCACACQRRrIAE2AgAgAkEYayABNgIAIAJBHGsgATYCACAEIANBBHFBGHIiBGsiAkEgSQ0AIAGtQoGAgIAQfiEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkEgayICQR9LDQALCyAAC4AEAQN/IAJBgARPBEAgACABIAIQFyAADwsgACACaiEDAkAgACABc0EDcUUEQAJAIABBA3FFBEAgACECDAELIAJFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICQQNxRQ0BIAIgA0kNAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgACADQQRrIgRLBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsOAEHILigCABEHABBQAAuXAgEDfyMAQRBrIgQkACAEIAE2AgwCQAJAIABFBEAgBCgCDCEB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DADkDAA8LIAAgAiADEQEACw8LIAIgAigCACIBQQRqNgIAIAAgATQCADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATUCADcDAA8LIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASkDADcDAAtdAQR/IAAoAgAhAgNAIAIsAAAiAxBGBEBBfyEEIAAgAkEBaiICNgIAIAFBzJmz5gBNBH9BfyADQTBrIgMgAUEKbCIEaiADIARB/////wdzShsFIAQLIQEMAQsLIAELqBQCEn8BfiMAQdAAayIIJAAgCCABNgJMIAhBN2ohFyAIQThqIRQCQAJAAkACQANAIAEhDSAHIA5B/////wdzSg0BIAcgDmohDgJAAkACQCANIgctAAAiCQRAA0ACQAJAIAlB/wFxIgFFBEAgByEBDAELIAFBJUcNASAHIQkDQCAJLQABQSVHBEAgCSEBDAILIAdBAWohByAJLQACIQogCUECaiIBIQkgCkElRg0ACwsgByANayIHIA5B/////wdzIhhKDQcgAARAIAAgDSAHECcLIAcNBiAIIAE2AkwgAUEBaiEHQX8hEgJAIAEsAAEiChBGRQ0AIAEtAAJBJEcNACABQQNqIQcgCkEwayESQQEhFQsgCCAHNgJMQQAhDAJAIAcsAAAiCUEgayIBQR9LBEAgByEKDAELIAchCkEBIAF0IgFBidEEcUUNAANAIAggB0EBaiIKNgJMIAEgDHIhDCAHLAABIglBIGsiAUEgTw0BIAohB0EBIAF0IgFBidEEcQ0ACwsCQCAJQSpGBEACfwJAIAosAAEiARBGRQ0AIAotAAJBJEcNACABQQJ0IARqQcABa0EKNgIAIApBA2ohCUEBIRUgCiwAAUEDdCADakGAA2soAgAMAQsgFQ0GIApBAWohCSAARQRAIAggCTYCTEEAIRVBACETDAMLIAIgAigCACIBQQRqNgIAQQAhFSABKAIACyETIAggCTYCTCATQQBODQFBACATayETIAxBgMAAciEMDAELIAhBzABqEHEiE0EASA0IIAgoAkwhCQtBACEHQX8hCwJ/IAktAABBLkcEQCAJIQFBAAwBCyAJLQABQSpGBEACfwJAIAksAAIiARBGRQ0AIAktA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jYCGAsgAAvnAQEBfwJAAkAgAARAAn8gAUEEcQRAIAIgAyAEIAUgABEPAAwBCyACIAMgBCAAEQYACyIFDQELQcwEEB0iBSACQagEECsiAUEANgK0BCABQgA3AqwEIAIoArAEIgMgAigCrAQiBEcEQCADIARrIgZBAEgNAiABIAYQHSIANgKsBCABIAAgBmo2ArQEA0AgACAEKAIANgIAIABBBGohACAEQQRqIgQgA0cNAAsgASAANgKwBAsgASACKQK4BDcCuAQgASACKALIBDYCyAQgASACKQLABDcCwAQgAUEANgKoBAsgBQ8LEAQAC3EBAX8CQCAAKAIAIgAoAhgiAkECdkEDcSABRg0AIAAgAkFzcSABQQJ0QQxxcjYCGANAIAAtAAQiAUEEcQ0BIAAgAUEEcjoABCAAKAIUIgEEQCAAIAERAAALIABBgICA/gc2ArQCIAAoAqgEIgANAAsLCw0AIAAoAgBBByABEE0LDQAgACgCAEEGIAEQTQsNACAAKAIAQQUgARBNCxAAIAAoAgAgASACthAxEGILEAAgACgCACABIAK2EC8QYgt1AQF/AkAgACgCACIAKAIYIgJBEHZBA3EgAUYNACAAIAJB//9zcSABQRB0QYCADHFyNgIYA0AgAC0ABCIBQQRxDQEgACABQQRyOgAEIAAoAhQiAQRAIAAgAREAAAsgAEGAgID+BzYCtAIgACgCqAQiAA0ACwsLxwkCBn8DfQJAAkAgASgCACIFKAIYIAAoAgAiASgCGHNB////A3ENACAFKAIoIQACfwJAIAEoAigiAkHw4YP8B0cEQEMAAMB/IQhBAyACQarVqv0HRg0CGiACQY+evPwHRw0BQwAAAAAhCEEBDAILQQIMAQtBACACviIJIAlcDQAaIAJB/////3txQYCAgIACar4hCEECQQEgAkGAgICABHEbCyEDAn8CQCAAQfDhg/wHRwRAQwAAwH8hCUEDIABBqtWq/QdGDQIaIABBj568/AdHDQFDAAAAACEJQQEMAgtDAAAAACEJQQIMAQtBACAAviIKIApcDQAaIABB/////3txQYCAgIACar4hCUECQQEgAEGAgICABHEbCyADRyADRSAIIAhcIAkgCVxxciAI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AUEDSQRAQQEgAXQhASAAKAIAIgACfyACBEAgACgCDCABcgwBCyAAKAIMIAFBf3NxCzYCDA8LEAQAC00BAn9BBBAdIQFBHBAdIgBCgICA/AM3AhQgAEIANwIMIABBADYCACAAQQA6AAggAEEBNgIEQeA2QeA2KAIAQQFqNgIAIAEgADYCACABCxAAIABBDTYCBCAAIAE2AgALEAAgAEEKNgIEIAAgATYCAAsQACAAQQc2AgQgACABNgIACyMAIAJBBUdBACACG0UEQEGoLCADIAQQYw8LQbgtIAMgBBBjCyIBAX4gASACrSADrUIghoQgBCAAERQAIgVCIIinJAEgBacLqAEBBX8gACgCVCIDKAIAIQUgAygCBCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhArGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBArGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAgICA+P8AIQIgBEL///////+//8MAVg0AQgAhAiAEQjCIpyIAQZH3AEkNACADIQIgBkL///////8/g0KAgICAgIDAAIQiBSEHAkAgAEGB9wBrIgFBwABxBEAgAiABQUBqrYYhB0IAIQIMAQsgAUUNACAHIAGtIgSGIAJBwAAgAWutiIQhByACIASGIQILIAggAjcDEC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AIAaigCAAsYAQF/QRAQHSIAQgA3AwggAEEANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAIAEoAgAiBEHw////B0kEQAJAAkAgBEELTwRAIARBD3JBAWoiBRAdIQYgAyAFQYCAgIB4cjYCECADIAY2AgggAyAENgIMIAQgBmohBQwBCyADIAQ6ABMgA0EIaiIGIARqIQUgBEUNAQsgBiABQQRqIAQQKxoLIAVBADoAACADIAI2AgAgA0EYaiADQQhqIAMgABEDACADKAIYEBAgAygCGCIAEAYgAygCABAGIAMsABNBAEgEQCADKAIIECkLIANBIGokACAADwsQBAALKgEBf0EMEB0iAUEAOgAEIAEgACgCADYCCCAAQQA2AgAgAUHQIjYCACABCwUAQfw2C2kBAn8jAEEQayIGJAAgASAAKAIEIgdBAXVqIQEgACgCACEAIAYgASACIAMgBCAFIAdBAXEEfyABKAIAIABqKAIABSAACxEOAEEQEB0iACAGKQMINwMIIAAgBikDADcDACAGQRBqJAAgAAsFAEH4NgubAQIBfwF9IwBBEGsiAiQAIAAoAgAhACABQQZIBEACfwJAAkACQCABQQRrDgIAAQILIABBpAJqIAAtAKwCQQNxQQJGDQIaIABBnAJqDAILIABBnAJqIAAtAKwCQQNxQQJGDQEaIABBpAJqDAELIAAgAUECdGpBnAJqCyoCACEDIAJBEGokACADuw8LIAJB0A42AgAgACACEC0QLAALmwECAX8BfSMAQRBrIgIkACAAKAIAIQAgAUEGSARAAn8CQAJAAkAgAUEEaw4CAAECCyAAQZQCaiA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QIAQfQsCwj//////////wBBuC0LAQUAQcQtCwHTAEHcLQsO0QAAANQAAADoGwAAAAQAQfQtCwEBAEGELgsF/////woAQcguCwHW",!R(w)){var L=w;w=n.locateFile?n.locateFile(L,l):l+L}function K(){var I=w;try{if(I==w&&h)return new Uint8Array(h);if(R(I))try{var C=Fy(I.slice(37)),D=new Uint8Array(C.length);for(I=0;I<C.length;++I)D[I]=C.charCodeAt(I);var F=D}catch{throw Error("Converting base64 string to bytes failed.")}else F=void 0;var P=F;if(P)return P;throw"both async and sync fetching of the wasm failed"}catch(W){O(W)}}function G(){return h||typeof fetch!="function"?Promise.resolve().then(function(){return K()}):fetch(w,{credentials:"same-origin"}).then(function(I){if(!I.ok)throw"failed to load wasm binary file at '"+w+"'";return I.arrayBuffer()}).catch(function(){return K()})}function j(I){for(;0<I.length;)I.shift()(n)}function te(I){if(I===void 0)return"_unknown";I=I.replace(/[^a-zA-Z0-9_]/g,"$");var C=I.charCodeAt(0);return 48<=C&&57>=C?"_"+I:I}function ue(I,C){return I=te(I),function(){return C.apply(this,arguments)}}var ce=[{},{value:void 0},{value:null},{value:!0},{value:!1}],me=[];function Qe(I){var C=Error,D=ue(I,function(F){this.name=I,this.message=F,F=Error(F).stack,F!==void 0&&(this.stack=this.toString()+`
67
+ `+F.replace(/^Error(:[^\n]*)?\n/,""))});return D.prototype=Object.create(C.prototype),D.prototype.constructor=D,D.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},D}var xe=void 0;function ae(I){throw new xe(I)}var Ie=I=>(I||ae("Cannot use deleted val. handle = "+I),ce[I].value),_e=I=>{switch(I){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var C=me.length?me.pop():ce.length;return ce[C]={fa:1,value:I},C}},Te=void 0,Ne=void 0;function re(I){for(var C="";y[I];)C+=Ne[y[I++]];return C}var le=[];function be(){for(;le.length;){var I=le.pop();I.L.Z=!1,I.delete()}}var De=void 0,Ue={};function we(I,C){for(C===void 0&&ae("ptr should not be undefined");I.P;)C=I.aa(C),I=I.P;return C}var ke={};function Ce(I){I=rd(I);var C=re(I);return Ti(I),C}function Me(I,C){var D=ke[I];return D===void 0&&ae(C+" has unknown type "+Ce(I)),D}function Xe(){}var rt=!1;function Ke(I){--I.count.value,I.count.value===0&&(I.S?I.T.V(I.S):I.O.M.V(I.N))}function nt(I,C,D){return C===D?I:D.P===void 0?null:(I=nt(I,C,D.P),I===null?null:D.ma(I))}var Ri={};function yt(I,C){return C=we(I,C),Ue[C]}var gi=void 0;function fi(I){throw new gi(I)}function pi(I,C){return C.O&&C.N||fi("makeClassHandle requires ptr and ptrType"),!!C.T!=!!C.S&&fi("Both smartPtrType and smartPtr must be specified"),C.count={value:1},mt(Object.create(I,{L:{value:C}}))}function mt(I){return typeof FinalizationRegistry>"u"?(mt=C=>C,I):(rt=new FinalizationRegistry(C=>{Ke(C.L)}),mt=C=>{var D=C.L;return D.S&&rt.register(C,{L:D},C),C},Xe=C=>{rt.unregister(C)},mt(I))}var Y={};function Ae(I){for(;I.length;){var C=I.pop();I.pop()(C)}}function ge(I){return this.fromWireType(b[I>>2])}var Re={},Se={};function We(I,C,D){function F(ee){ee=D(ee),ee.length!==I.length&&fi("Mismatched type converter count");for(var se=0;se<I.length;++se)Qt(I[se],ee[se])}I.forEach(function(ee){Se[ee]=C});var P=Array(C.length),W=[],z=0;C.forEach((ee,se)=>{ke.hasOwnProperty(ee)?P[se]=ke[ee]:(W.push(ee),Re.hasOwnProperty(ee)||(Re[ee]=[]),Re[ee].push(()=>{P[se]=ke[ee],++z,z===W.length&&F(P)}))}),W.length===0&&F(P)}function Bt(I){switch(I){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+I)}}function Qt(I,C,D={}){if(!("argPackAdvance"in C))throw new TypeError("registerType registeredInstance requires argPackAdvance");var F=C.name;if(I||ae('type "'+F+'" must have a positive integer typeid pointer'),ke.hasOwnProperty(I)){if(D.ta)return;ae("Cannot register type '"+F+"' twice")}ke[I]=C,delete Se[I],Re.hasOwnProperty(I)&&(C=Re[I],delete Re[I],C.forEach(P=>P()))}function Ns(I){ae(I.L.O.M.name+" instance already deleted")}function bt(){}function as(I,C,D){if(I[C].R===void 0){var F=I[C];I[C]=function(){return I[C].R.hasOwnProperty(arguments.length)||ae("Function '"+D+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+I[C].R+")!"),I[C].R[arguments.length].apply(this,arguments)},I[C].R=[],I[C].R[F.Y]=F}}function Ms(I,C){n.hasOwnProperty(I)?(ae("Cannot register public name '"+I+"' twice"),as(n,I,I),n.hasOwnProperty(void 0)&&ae("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),n[I].R[void 0]=C):n[I]=C}function Gi(I,C,D,F,P,W,z,ee){this.name=I,this.constructor=C,this.W=D,this.V=F,this.P=P,this.oa=W,this.aa=z,this.ma=ee,this.ia=[]}function Qr(I,C,D){for(;C!==D;)C.aa||ae("Expected null or instance of "+D.name+", got an instance of "+C.name),I=C.aa(I),C=C.P;return I}function br(I,C){return C===null?(this.da&&ae("null is not a valid "+this.name),0):(C.L||ae('Cannot pass "'+IA(C)+'" as a '+this.name),C.L.N||ae("Cannot pass deleted object as a pointer of type "+this.name),Qr(C.L.N,C.L.O.M,this.M))}function Ps(I,C){if(C===null){if(this.da&&ae("null is not a valid "+this.name),this.ca){var D=this.ea();return I!==null&&I.push(this.V,D),D}return 0}if(C.L||ae('Cannot pass "'+IA(C)+'" as a '+this.name),C.L.N||ae("Cannot pass deleted object as a pointer of type "+this.name),!this.ba&&C.L.O.ba&&ae("Cannot convert argument of type "+(C.L.T?C.L.T.name:C.L.O.name)+" to parameter type "+this.name),D=Qr(C.L.N,C.L.O.M,this.M),this.ca)switch(C.L.S===void 0&&ae("Passing raw pointer to smart pointer is illegal"),this.Aa){case 0:C.L.T===this?D=C.L.S:ae("Cannot convert argument of type "+(C.L.T?C.L.T.name:C.L.O.name)+" to parameter type "+this.name);break;case 1:D=C.L.S;break;case 2:if(C.L.T===this)D=C.L.S;else{var F=C.clone();D=this.wa(D,_e(function(){F.delete()})),I!==null&&I.push(this.V,D)}break;default:ae("Unsupporting sharing policy")}return D}function Cy(I,C){return C===null?(this.da&&ae("null is not a valid "+this.name),0):(C.L||ae('Cannot pass "'+IA(C)+'" as a '+this.name),C.L.N||ae("Cannot pass deleted object as a pointer of type "+this.name),C.L.O.ba&&ae("Cannot convert argument of type "+C.L.O.name+" to parameter type "+this.name),Qr(C.L.N,C.L.O.M,this.M))}function xi(I,C,D,F){this.name=I,this.M=C,this.da=D,this.ba=F,this.ca=!1,this.V=this.wa=this.ea=this.ja=this.Aa=this.va=void 0,C.P!==void 0?this.toWireType=Ps:(this.toWireType=F?br:Cy,this.U=null)}function vy(I,C){n.hasOwnProperty(I)||fi("Replacing nonexistant public symbol"),n[I]=C,n[I].Y=void 0}function yy(I,C){var D=[];return function(){if(D.length=0,Object.assign(D,arguments),I.includes("j")){var F=n["dynCall_"+I];F=D&&D.length?F.apply(null,[C].concat(D)):F.call(null,C)}else F=k.get(C).apply(null,D);return F}}function jt(I,C){I=re(I);var D=I.includes("j")?yy(I,C):k.get(C);return typeof D!="function"&&ae("unknown function pointer with signature "+I+": "+C),D}var ed=void 0;function qn(I,C){function D(W){P[W]||ke[W]||(Se[W]?Se[W].forEach(D):(F.push(W),P[W]=!0))}var F=[],P={};throw C.forEach(D),new ed(I+": "+F.map(Ce).join([", "]))}function fA(I,C,D,F,P){var W=C.length;2>W&&ae("argTypes array size mismatch! Must at least get return value and 'this' types!");var z=C[1]!==null&&D!==null,ee=!1;for(D=1;D<C.length;++D)if(C[D]!==null&&C[D].U===void 0){ee=!0;break}var se=C[0].name!=="void",ie=W-2,ne=Array(ie),pe=[],Fe=[];return function(){if(arguments.length!==ie&&ae("function "+I+" called with "+arguments.length+" arguments, expected "+ie+" args!"),Fe.length=0,pe.length=z?2:1,pe[0]=P,z){var ot=C[1].toWireType(Fe,this);pe[1]=ot}for(var Ge=0;Ge<ie;++Ge)ne[Ge]=C[Ge+2].toWireType(Fe,arguments[Ge]),pe.push(ne[Ge]);if(Ge=F.apply(null,pe),ee)Ae(Fe);else for(var kt=z?1:2;kt<C.length;kt++){var Xt=kt===1?ot:ne[kt-2];C[kt].U!==null&&C[kt].U(Xt)}return ot=se?C[0].fromWireType(Ge):void 0,ot}}function pA(I,C){for(var D=[],F=0;F<I;F++)D.push(x[C+4*F>>2]);return D}function EA(I){4<I&&--ce[I].fa===0&&(ce[I]=void 0,me.push(I))}function IA(I){if(I===null)return"null";var C=typeof I;return C==="object"||C==="array"||C==="function"?I.toString():""+I}function By(I,C){switch(C){case 2:return function(D){return this.fromWireType(B[D>>2])};case 3:return function(D){return this.fromWireType(H[D>>3])};default:throw new TypeError("Unknown float type: "+I)}}function Qy(I,C,D){switch(C){case 0:return D?function(F){return v[F]}:function(F){return y[F]};case 1:return D?function(F){return Q[F>>1]}:function(F){return m[F>>1]};case 2:return D?function(F){return b[F>>2]}:function(F){return x[F>>2]};default:throw new TypeError("Unknown integer type: "+I)}}function by(I,C){for(var D="",F=0;!(F>=C/2);++F){var P=Q[I+2*F>>1];if(P==0)break;D+=String.fromCharCode(P)}return D}function Sy(I,C,D){if(D===void 0&&(D=2147483647),2>D)return 0;D-=2;var F=C;D=D<2*I.length?D/2:I.length;for(var P=0;P<D;++P)Q[C>>1]=I.charCodeAt(P),C+=2;return Q[C>>1]=0,C-F}function wy(I){return 2*I.length}function Ry(I,C){for(var D=0,F="";!(D>=C/4);){var P=b[I+4*D>>2];if(P==0)break;++D,65536<=P?(P-=65536,F+=String.fromCharCode(55296|P>>10,56320|P&1023)):F+=String.fromCharCode(P)}return F}function xy(I,C,D){if(D===void 0&&(D=2147483647),4>D)return 0;var F=C;D=F+D-4;for(var P=0;P<I.length;++P){var W=I.charCodeAt(P);if(55296<=W&&57343>=W){var z=I.charCodeAt(++P);W=65536+((W&1023)<<10)|z&1023}if(b[C>>2]=W,C+=4,C+4>D)break}return b[C>>2]=0,C-F}function Ty(I){for(var C=0,D=0;D<I.length;++D){var F=I.charCodeAt(D);55296<=F&&57343>=F&&++D,C+=4}return C}var Dy={};function td(I){var C=Dy[I];return C===void 0?re(I):C}var jn=[];function Ly(I){var C=jn.length;return jn.push(I),C}function _y(I,C){for(var D=Array(I),F=0;F<I;++F)D[F]=Me(x[C+4*F>>2],"parameter "+F);return D}var id=[],ky=[null,[],[]];xe=n.BindingError=Qe("BindingError"),n.count_emval_handles=function(){for(var I=0,C=5;C<ce.length;++C)ce[C]!==void 0&&++I;return I},n.get_first_emval=function(){for(var I=5;I<ce.length;++I)if(ce[I]!==void 0)return ce[I];return null},Te=n.PureVirtualError=Qe("PureVirtualError");for(var sd=Array(256),Xn=0;256>Xn;++Xn)sd[Xn]=String.fromCharCode(Xn);Ne=sd,n.getInheritedInstanceCount=function(){return Object.keys(Ue).length},n.getLiveInheritedInstances=function(){var I=[],C;for(C in Ue)Ue.hasOwnProperty(C)&&I.push(Ue[C]);return I},n.flushPendingDeletes=be,n.setDelayFunction=function(I){De=I,le.length&&De&&De(be)},gi=n.InternalError=Qe("InternalError"),bt.prototype.isAliasOf=function(I){if(!(this instanceof bt&&I instanceof bt))return!1;var C=this.L.O.M,D=this.L.N,F=I.L.O.M;for(I=I.L.N;C.P;)D=C.aa(D),C=C.P;for(;F.P;)I=F.aa(I),F=F.P;return C===F&&D===I},bt.prototype.clone=function(){if(this.L.N||Ns(this),this.L.$)return this.L.count.value+=1,this;var I=mt,C=Object,D=C.create,F=Object.getPrototypeOf(this),P=this.L;return I=I(D.call(C,F,{L:{value:{count:P.count,Z:P.Z,$:P.$,N:P.N,O:P.O,S:P.S,T:P.T}}})),I.L.count.value+=1,I.L.Z=!1,I},bt.prototype.delete=function(){this.L.N||Ns(this),this.L.Z&&!this.L.$&&ae("Object already scheduled for deletion"),Xe(this),Ke(this.L),this.L.$||(this.L.S=void 0,this.L.N=void 0)},bt.prototype.isDeleted=function(){return!this.L.N},bt.prototype.deleteLater=function(){return this.L.N||Ns(this),this.L.Z&&!this.L.$&&ae("Object already scheduled for deletion"),le.push(this),le.length===1&&De&&De(be),this.L.Z=!0,this},xi.prototype.pa=function(I){return this.ja&&(I=this.ja(I)),I},xi.prototype.ga=function(I){this.V&&this.V(I)},xi.prototype.argPackAdvance=8,xi.prototype.readValueFromPointer=ge,xi.prototype.deleteObject=function(I){I!==null&&I.delete()},xi.prototype.fromWireType=function(I){function C(){return this.ca?pi(this.M.W,{O:this.va,N:D,T:this,S:I}):pi(this.M.W,{O:this,N:I})}var D=this.pa(I);if(!D)return this.ga(I),null;var F=yt(this.M,D);if(F!==void 0)return F.L.count.value===0?(F.L.N=D,F.L.S=I,F.clone()):(F=F.clone(),this.ga(I),F);if(F=this.M.oa(D),F=Ri[F],!F)return C.call(this);F=this.ba?F.ka:F.pointerType;var P=nt(D,this.M,F.M);return P===null?C.call(this):this.ca?pi(F.M.W,{O:F,N:P,T:this,S:I}):pi(F.M.W,{O:F,N:P})},ed=n.UnboundTypeError=Qe("UnboundTypeError");var Fy=typeof atob=="function"?atob:function(I){var C="",D=0;I=I.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var F="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++)),P="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++)),W="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++)),z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(I.charAt(D++));F=F<<2|P>>4,P=(P&15)<<4|W>>2;var ee=(W&3)<<6|z;C+=String.fromCharCode(F),W!==64&&(C+=String.fromCharCode(P)),z!==64&&(C+=String.fromCharCode(ee))}while(D<I.length);return C},Ny={p:function(I,C,D){I=re(I),C=Me(C,"wrapper"),D=Ie(D);var F=[].slice,P=C.M,W=P.W,z=P.P.W,ee=P.P.constructor;I=ue(I,function(){P.P.ia.forEach((function(ie){if(this[ie]===z[ie])throw new Te("Pure virtual function "+ie+" must be implemented in JavaScript")}).bind(this)),Object.defineProperty(this,"__parent",{value:W}),this.__construct.apply(this,F.call(arguments))}),W.__construct=function(){this===W&&ae("Pass correct 'this' to __construct");var ie=ee.implement.apply(void 0,[this].concat(F.call(arguments)));Xe(ie);var ne=ie.L;ie.notifyOnDestruction(),ne.$=!0,Object.defineProperties(this,{L:{value:ne}}),mt(this),ie=ne.N,ie=we(P,ie),Ue.hasOwnProperty(ie)?ae("Tried to register registered instance: "+ie):Ue[ie]=this},W.__destruct=function(){this===W&&ae("Pass correct 'this' to __destruct"),Xe(this);var ie=this.L.N;ie=we(P,ie),Ue.hasOwnProperty(ie)?delete Ue[ie]:ae("Tried to unregister unregistered instance: "+ie)},I.prototype=Object.create(W);for(var se in D)I.prototype[se]=D[se];return _e(I)},j:function(I){var C=Y[I];delete Y[I];var D=C.ea,F=C.V,P=C.ha,W=P.map(z=>z.sa).concat(P.map(z=>z.ya));We([I],W,z=>{var ee={};return P.forEach((se,ie)=>{var ne=z[ie],pe=se.qa,Fe=se.ra,ot=z[ie+P.length],Ge=se.xa,kt=se.za;ee[se.na]={read:Xt=>ne.fromWireType(pe(Fe,Xt)),write:(Xt,Sr)=>{var Di=[];Ge(kt,Xt,ot.toWireType(Di,Sr)),Ae(Di)}}}),[{name:C.name,fromWireType:function(se){var ie={},ne;for(ne in ee)ie[ne]=ee[ne].read(se);return F(se),ie},toWireType:function(se,ie){for(var ne in ee)if(!(ne in ie))throw new TypeError('Missing field: "'+ne+'"');var pe=D();for(ne in ee)ee[ne].write(pe,ie[ne]);return se!==null&&se.push(F,pe),pe},argPackAdvance:8,readValueFromPointer:ge,U:F}]})},v:function(){},B:function(I,C,D,F,P){var W=Bt(D);C=re(C),Qt(I,{name:C,fromWireType:function(z){return!!z},toWireType:function(z,ee){return ee?F:P},argPackAdvance:8,readValueFromPointer:function(z){if(D===1)var ee=v;else if(D===2)ee=Q;else if(D===4)ee=b;else throw new TypeError("Unknown boolean type size: "+C);return this.fromWireType(ee[z>>W])},U:null})},f:function(I,C,D,F,P,W,z,ee,se,ie,ne,pe,Fe){ne=re(ne),W=jt(P,W),ee&&(ee=jt(z,ee)),ie&&(ie=jt(se,ie)),Fe=jt(pe,Fe);var ot=te(ne);Ms(ot,function(){qn("Cannot construct "+ne+" due to unbound types",[F])}),We([I,C,D],F?[F]:[],function(Ge){if(Ge=Ge[0],F)var kt=Ge.M,Xt=kt.W;else Xt=bt.prototype;Ge=ue(ot,function(){if(Object.getPrototypeOf(this)!==Sr)throw new xe("Use 'new' to construct "+ne);if(Di.X===void 0)throw new xe(ne+" has no accessible constructor");var ad=Di.X[arguments.length];if(ad===void 0)throw new xe("Tried to invoke ctor of "+ne+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Di.X).toString()+") parameters instead!");return ad.apply(this,arguments)});var Sr=Object.create(Xt,{constructor:{value:Ge}});Ge.prototype=Sr;var Di=new Gi(ne,Ge,Sr,Fe,kt,W,ee,ie);kt=new xi(ne,Di,!0,!1),Xt=new xi(ne+"*",Di,!1,!1);var od=new xi(ne+" const*",Di,!1,!0);return Ri[I]={pointerType:Xt,ka:od},vy(ot,Ge),[kt,Xt,od]})},c:function(I,C,D,F,P,W,z){var ee=pA(D,F);C=re(C),W=jt(P,W),We([],[I],function(se){function ie(){qn("Cannot call "+ne+" due to unbound types",ee)}se=se[0];var ne=se.name+"."+C;C.startsWith("@@")&&(C=Symbol[C.substring(2)]);var pe=se.M.constructor;return pe[C]===void 0?(ie.Y=D-1,pe[C]=ie):(as(pe,C,ne),pe[C].R[D-1]=ie),We([],ee,function(Fe){return Fe=fA(ne,[Fe[0],null].concat(Fe.slice(1)),null,W,z),pe[C].R===void 0?(Fe.Y=D-1,pe[C]=Fe):pe[C].R[D-1]=Fe,[]}),[]})},o:function(I,C,D,F,P,W){0<C||O();var z=pA(C,D);P=jt(F,P),We([],[I],function(ee){ee=ee[0];var se="constructor "+ee.name;if(ee.M.X===void 0&&(ee.M.X=[]),ee.M.X[C-1]!==void 0)throw new xe("Cannot register multiple constructors with identical number of parameters ("+(C-1)+") for class '"+ee.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return ee.M.X[C-1]=()=>{qn("Cannot construct "+ee.name+" due to unbound types",z)},We([],z,function(ie){return ie.splice(1,0,null),ee.M.X[C-1]=fA(se,ie,null,P,W),[]}),[]})},a:function(I,C,D,F,P,W,z,ee){var se=pA(D,F);C=re(C),W=jt(P,W),We([],[I],function(ie){function ne(){qn("Cannot call "+pe+" due to unbound types",se)}ie=ie[0];var pe=ie.name+"."+C;C.startsWith("@@")&&(C=Symbol[C.substring(2)]),ee&&ie.M.ia.push(C);var Fe=ie.M.W,ot=Fe[C];return ot===void 0||ot.R===void 0&&ot.className!==ie.name&&ot.Y===D-2?(ne.Y=D-2,ne.className=ie.name,Fe[C]=ne):(as(Fe,C,pe),Fe[C].R[D-2]=ne),We([],se,function(Ge){return Ge=fA(pe,Ge,ie,W,z),Fe[C].R===void 0?(Ge.Y=D-2,Fe[C]=Ge):Fe[C].R[D-2]=Ge,[]}),[]})},A:function(I,C){C=re(C),Qt(I,{name:C,fromWireType:function(D){var F=Ie(D);return EA(D),F},toWireType:function(D,F){return _e(F)},argPackAdvance:8,readValueFromPointer:ge,U:null})},m:function(I,C,D){D=Bt(D),C=re(C),Qt(I,{name:C,fromWireType:function(F){return F},toWireType:function(F,P){return P},argPackAdvance:8,readValueFromPointer:By(C,D),U:null})},d:function(I,C,D,F,P){C=re(C),P===-1&&(P=4294967295),P=Bt(D);var W=ee=>ee;if(F===0){var z=32-8*D;W=ee=>ee<<z>>>z}D=C.includes("unsigned")?function(ee,se){return se>>>0}:function(ee,se){return se},Qt(I,{name:C,fromWireType:W,toWireType:D,argPackAdvance:8,readValueFromPointer:Qy(C,P,F!==0),U:null})},b:function(I,C,D){function F(W){W>>=2;var z=x;return new P(p,z[W+1],z[W])}var P=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][C];D=re(D),Qt(I,{name:D,fromWireType:F,argPackAdvance:8,readValueFromPointer:F},{ta:!0})},n:function(I,C){C=re(C);var D=C==="std::string";Qt(I,{name:C,fromWireType:function(F){var P=x[F>>2],W=F+4;if(D)for(var z=W,ee=0;ee<=P;++ee){var se=W+ee;if(ee==P||y[se]==0){if(z=z?f(y,z,se-z):"",ie===void 0)var ie=z;else ie+="\0",ie+=z;z=se+1}}else{for(ie=Array(P),ee=0;ee<P;++ee)ie[ee]=String.fromCharCode(y[W+ee]);ie=ie.join("")}return Ti(F),ie},toWireType:function(F,P){P instanceof ArrayBuffer&&(P=new Uint8Array(P));var W,z=typeof P=="string";if(z||P instanceof Uint8Array||P instanceof Uint8ClampedArray||P instanceof Int8Array||ae("Cannot pass non-string to std::string"),D&&z){var ee=0;for(W=0;W<P.length;++W){var se=P.charCodeAt(W);127>=se?ee++:2047>=se?ee+=2:55296<=se&&57343>=se?(ee+=4,++W):ee+=3}W=ee}else W=P.length;if(ee=mA(4+W+1),se=ee+4,x[ee>>2]=W,D&&z){if(z=se,se=W+1,W=y,0<se){se=z+se-1;for(var ie=0;ie<P.length;++ie){var ne=P.charCodeAt(ie);if(55296<=ne&&57343>=ne){var pe=P.charCodeAt(++ie);ne=65536+((ne&1023)<<10)|pe&1023}if(127>=ne){if(z>=se)break;W[z++]=ne}else{if(2047>=ne){if(z+1>=se)break;W[z++]=192|ne>>6}else{if(65535>=ne){if(z+2>=se)break;W[z++]=224|ne>>12}else{if(z+3>=se)break;W[z++]=240|ne>>18,W[z++]=128|ne>>12&63}W[z++]=128|ne>>6&63}W[z++]=128|ne&63}}W[z]=0}}else if(z)for(z=0;z<W;++z)ie=P.charCodeAt(z),255<ie&&(Ti(se),ae("String has UTF-16 code units that do not fit in 8 bits")),y[se+z]=ie;else for(z=0;z<W;++z)y[se+z]=P[z];return F!==null&&F.push(Ti,ee),ee},argPackAdvance:8,readValueFromPointer:ge,U:function(F){Ti(F)}})},i:function(I,C,D){if(D=re(D),C===2)var F=by,P=Sy,W=wy,z=()=>m,ee=1;else C===4&&(F=Ry,P=xy,W=Ty,z=()=>x,ee=2);Qt(I,{name:D,fromWireType:function(se){for(var ie=x[se>>2],ne=z(),pe,Fe=se+4,ot=0;ot<=ie;++ot){var Ge=se+4+ot*C;(ot==ie||ne[Ge>>ee]==0)&&(Fe=F(Fe,Ge-Fe),pe===void 0?pe=Fe:(pe+="\0",pe+=Fe),Fe=Ge+C)}return Ti(se),pe},toWireType:function(se,ie){typeof ie!="string"&&ae("Cannot pass non-string to C++ string type "+D);var ne=W(ie),pe=mA(4+ne+C);return x[pe>>2]=ne>>ee,P(ie,pe+4,ne+C),se!==null&&se.push(Ti,pe),pe},argPackAdvance:8,readValueFromPointer:ge,U:function(se){Ti(se)}})},k:function(I,C,D,F,P,W){Y[I]={name:re(C),ea:jt(D,F),V:jt(P,W),ha:[]}},h:function(I,C,D,F,P,W,z,ee,se,ie){Y[I].ha.push({na:re(C),sa:D,qa:jt(F,P),ra:W,ya:z,xa:jt(ee,se),za:ie})},C:function(I,C){C=re(C),Qt(I,{ua:!0,name:C,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(I,C,D,F,P){I=jn[I],C=Ie(C),D=td(D);var W=[];return x[F>>2]=_e(W),I(C,D,W,P)},t:function(I,C,D,F){I=jn[I],C=Ie(C),D=td(D),I(C,D,null,F)},g:EA,l:function(I,C){var D=_y(I,C),F=D[0];C=F.name+"_$"+D.slice(1).map(function(z){return z.name}).join("_")+"$";var P=id[C];if(P!==void 0)return P;var W=Array(I-1);return P=Ly((z,ee,se,ie)=>{for(var ne=0,pe=0;pe<I-1;++pe)W[pe]=D[pe+1].readValueFromPointer(ie+ne),ne+=D[pe+1].argPackAdvance;for(z=z[ee].apply(z,W),pe=0;pe<I-1;++pe)D[pe+1].la&&D[pe+1].la(W[pe]);if(!F.ua)return F.toWireType(se,z)}),id[C]=P},q:function(I){4<I&&(ce[I].fa+=1)},r:function(I){var C=Ie(I);Ae(C),EA(I)},e:function(){O("")},x:function(I,C,D){y.copyWithin(I,C,C+D)},w:function(I){var C=y.length;if(I>>>=0,2147483648<I)return!1;for(var D=1;4>=D;D*=2){var F=C*(1+.2/D);F=Math.min(F,I+100663296);var P=Math;F=Math.max(I,F),P=P.min.call(P,2147483648,F+(65536-F%65536)%65536);e:{try{d.grow(P-p.byteLength+65535>>>16),_();var W=1;break e}catch{}W=void 0}if(W)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(I,C,D,F){for(var P=0,W=0;W<D;W++){var z=x[C>>2],ee=x[C+4>>2];C+=8;for(var se=0;se<ee;se++){var ie=y[z+se],ne=ky[I];ie===0||ie===10?((I===1?c:u)(f(ne,0)),ne.length=0):ne.push(ie)}P+=ee}return x[F>>2]=P,0}};(function(){function I(P){n.asm=P.exports,d=n.asm.D,_(),k=n.asm.I,q.unshift(n.asm.E),S--,n.monitorRunDependencies&&n.monitorRunDependencies(S),S==0&&T&&(P=T,T=null,P())}function C(P){I(P.instance)}function D(P){return G().then(function(W){return WebAssembly.instantiate(W,F)}).then(function(W){return W}).then(P,function(W){u("failed to asynchronously prepare wasm: "+W),O(W)})}var F={a:Ny};if(S++,n.monitorRunDependencies&&n.monitorRunDependencies(S),n.instantiateWasm)try{return n.instantiateWasm(F,I)}catch(P){u("Module.instantiateWasm callback failed with error: "+P),a(P)}return function(){return h||typeof WebAssembly.instantiateStreaming!="function"||R(w)||typeof fetch!="function"?D(C):fetch(w,{credentials:"same-origin"}).then(function(P){return WebAssembly.instantiateStreaming(P,F).then(C,function(W){return u("wasm streaming compile failed: "+W),u("falling back to ArrayBuffer instantiation"),D(C)})})}().catch(a),{}})(),n.___wasm_call_ctors=function(){return(n.___wasm_call_ctors=n.asm.E).apply(null,arguments)};var rd=n.___getTypeName=function(){return(rd=n.___getTypeName=n.asm.F).apply(null,arguments)};n.__embind_initialize_bindings=function(){return(n.__embind_initialize_bindings=n.asm.G).apply(null,arguments)};var mA=n._malloc=function(){return(mA=n._malloc=n.asm.H).apply(null,arguments)},Ti=n._free=function(){return(Ti=n._free=n.asm.J).apply(null,arguments)};n.dynCall_jiji=function(){return(n.dynCall_jiji=n.asm.K).apply(null,arguments)};var zn;T=function I(){zn||nd(),zn||(T=I)};function nd(){function I(){if(!zn&&(zn=!0,n.calledRun=!0,!g)){if(j(q),o(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;){var C=n.postRun.shift();V.unshift(C)}j(V)}}if(!(0<S)){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)Z();j(U),0<S||(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),I()},1)):I())}}if(n.preInit)for(typeof n.preInit=="function"&&(n.preInit=[n.preInit]);0<n.preInit.length;)n.preInit.pop()();return nd(),r.ready}})();s.exports=t})(Cl);var jg=Cl.exports;(function(s){Object.defineProperty(s,"__esModule",{value:!0});var e={loadYoga:!0};s.loadYoga=o;var t=r(vo),i=Be;Object.keys(i).forEach(function(a){a==="default"||a==="__esModule"||Object.prototype.hasOwnProperty.call(e,a)||a in s&&s[a]===i[a]||Object.defineProperty(s,a,{enumerable:!0,get:function(){return i[a]}})});function r(a){return a&&a.__esModule?a:{default:a}}const n=jg;async function o(){return(0,t.default)(await n())}})(Il);function bo({canvas:s,scenes:e,currentTime:t}){if(e&&s){const i=e.scenes.filter(({start:n,duration:o})=>t>=n&&t<=n+o);if(i.length<=0)return;const r=s.getContext("2d");if(r){const n=e.transitionDuration,o=Math.max(...e.scenes.map(({start:a,duration:A})=>a+A));r.globalCompositeOperation="lighter",r.clearRect(0,0,s.width,s.height),i.forEach(({start:a,duration:A,draw:l,transitionCanvas:c})=>{if(r.globalAlpha=1,c.width=c.height=0,c.width=s.width,c.height=s.height,c.getContext("2d")){const h=a+A,d=a===0,g=h===o;l({currentTime:t,canvas:c}),!d&&t>=a&&t<=a+n?r.globalAlpha=Math.max(0,Math.min(1,(t-a)/n)):!g&&t>=h-n&&t<=h&&(r.globalAlpha=Math.max(0,Math.min(1,(h-t)/n))),r.drawImage(c,0,0,s.width,s.height)}})}}}function Xg(s){if(typeof s=="string"){const[e,t]=s.split(":");return Math.min(parseFloat(e),parseFloat(t))}return s}function zg(s){if(typeof s=="string"){const[e,t]=s.split(":"),i=parseFloat(e),r=parseFloat(t);return i/r}return s}function So({resolution:s,aspectRatio:e}){const t=Xg(s),i=zg(e),r=i>=1,n=Math.min(r?t*i:t/i,t),o=Math.max(r?t*i:t/i,t);return{resolution:t,aspectRatio:i,height:r?n:o,width:r?o:n}}function Zg({format:s,resolution:e,aspectRatio:t,sourceWidth:i,sourceHeight:r}){const{width:n,height:o}=So({resolution:e,aspectRatio:t}),a=i/r,A=t>a;let l=1;if(s==="letterbox"||s==="letterbox-video")l=A?o/r:n/i;else if(s==="squarebox"){const g=Math.min(o,n);l=i>=r?g/r:g/i}else s==="crop"&&(l=A?n/i:o/r);const c=n/l,u=o/l,h=(i-c)/2,d=(r-u)/2;return{sx:h,sy:d,sWidth:c,sHeight:u,scale:l}}function ir({source:s,sx:e,sy:t,sw:i,sh:r,dx:n,dy:o,dw:a,dh:A}){const l=(s==null?void 0:s.naturalWidth)??(s==null?void 0:s.videoWidth)??(s==null?void 0:s.width),c=(s==null?void 0:s.naturalHeight)??(s==null?void 0:s.videoHeight)??(s==null?void 0:s.height);e=e??0,t=t??0,i=i??l,r=r??c,i<0&&(e+=i,i=Math.abs(i)),r<0&&(t+=r,r=Math.abs(r)),a<0&&(n+=a,a=Math.abs(a)),A<0&&(o+=A,A=Math.abs(A));const u=Math.max(e,0),h=Math.min(e+i,l),d=Math.max(t,0),g=Math.min(t+r,c),f=a/i,p=A/r;return[s,u,d,h-u,g-d,e<0?n-e*f:n,t<0?o-t*p:o,(h-u)*f,(g-d)*p]}function vl({context:s,source:e,crop:t,format:i="letterbox",posX:r,posY:n,drawAreaWidth:o,drawAreaHeight:a,sourceWidth:A,sourceHeight:l,cropCanvas:c,letterboxCanvas:u}){const{x:h,y:d,width:g,height:f}=t??{},p=A*(h??0),v=l*(d??0),y=A*Math.min(1-(h??0),g??1),Q=l*Math.min(1-(d??0),f??1),m=c.getContext("2d");if(m){c.width=y,c.height=Q;const T=ir({source:e,sx:p,sy:v,sw:y,sh:Q,dx:0,dy:0,dw:y,dh:Q});m.drawImage(...T)}const b=y/Q,{sx:x,sy:B,sWidth:H,sHeight:_,scale:k}=Zg({resolution:Math.min(o,a),aspectRatio:o/a,format:i,sourceWidth:y,sourceHeight:Q}),U=c&&typeof s.filter<"u";if(i==="letterbox"||i==="squarebox"||i==="letterbox-video"&&!U){if(x<0){const T=Math.abs(x)*k;s.fillStyle="black",s.beginPath(),s.rect(r,n,T,a),s.rect(r+o-T,n,T,a),s.fill(),s.closePath()}if(B<0){const T=Math.abs(B)*k;s.fillStyle="black",s.beginPath(),s.rect(r,n,o,T),s.rect(r,n+a-T,o,T),s.fill(),s.closePath()}}if(i==="letterbox-video"&&U){const T=u.getContext("2d");if(T){u.width=y,u.height=Q,s.save(),s.globalCompositeOperation="destination-out",s.fillRect(r,n,o,a);const O=ir({source:c,sx:x,sy:B,sw:H,sh:_,dx:r,dy:n,dw:o,dh:a});s.globalCompositeOperation="source-over",s.drawImage(...O),T.save();const R=1.2,w=-(y*R-y)/2,L=-(Q*R-Q)/2,K=Math.min(y/20,Q/20);if(T.filter=`blur(${K}px) brightness(20%)`,T.translate(w,L),T.scale(R,R),T.drawImage(c,0,0,y,Q),T.restore(),s.globalCompositeOperation="destination-over",x<0){const G=o/b,j=a/G,te=ir({source:u,sy:(1-j)*Q/2,sh:j*Q,dx:r,dy:n,dw:o,dh:a});s.drawImage(...te)}if(B<0){const G=a*b,j=o/G,te=ir({source:u,sx:(1-j)*y/2,sw:j*y,dx:r,dy:n,dw:o,dh:a});s.drawImage(...te)}s.restore()}}else{const T=ir({source:c,sx:x,sy:B,sw:H,sh:_,dx:r,dy:n,dw:o,dh:a});s.drawImage(...T)}const q=x*-1*k,V=B*-1*k,Z=o-q*2,S=a-V*2;return{dx:q,dy:V,dw:Z,dh:S}}const ef=/\d{0,2}:?\d{2}:\d{2}\.\d{3}\s-->\s\d{0,2}:?\d{2}:\d{2}\.\d{3}\s{1,2}.*/g,tf=/\d{0,2}:?\d{2}:\d{2}\.\d{3}/g;function yl(s){if(!s)return[];const e=s.match(ef);return e?e==null?void 0:e.map(t=>{const[i,r]=t.replace(`\r
69
68
  `,`
70
69
  `).split(`
71
- `),[n,o]=i.match(Yg)||[];return{start:n,end:o,text:r}}):[]}function Gr(s){const[e,t,i]=s.split(":");return i?parseInt(e)*60*60+parseInt(t)*60+parseFloat(i):parseInt(e)*60+parseInt(t)}function Vg({canvas:s,dx:e,dy:t,dw:i,dh:r,sceneTime:n,vttCaptions:o}){if(o){const A=Il(o).find(({start:l,end:c})=>l&&c&&n>=Gr(l)&&n<Gr(c));if(A){const l=s.getContext("2d");if(l){const c=Math.min(i,r),h=c*.04,u=Nr({text:o,font:`400 ${h}px Roobert Captions`});l.font=u,l.textBaseline="middle";const d=i*.9,g=Pr({context:l,font:u,fontSize:h,text:A.text,maxW:d});g.forEach(({text:f,metrics:E},B)=>{const S=e+(i-E.width)/2,Q=t+(r*.85-(h+c*.03)*(g.length-1-B)),m=h*.8,y=h/1.5,L=e+(i-E.width-y)/2,v=Q-m,F=E.width+y,G=m*2,M=l.globalAlpha;l.save(),l.globalAlpha=.8*M,l.fillStyle="#000000",l.beginPath(),l.roundRect(L,v,F,G,c*.01),l.fill(),l.closePath(),l.globalAlpha=M,l.fillStyle="#FFFFFF",l.fillText(f,S,Q),l.restore()})}}}}const Jg={id:"073977ec-6384-4329-b7c5-8275fb513e74",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",templates:[{id:"046f363c-960a-449c-ae5e-984ac6ab58c2",version:"3",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",layouts:[{name:"none",tree:`[
70
+ `),[n,o]=i.match(tf)||[];return{start:n,end:o,text:r}}):[]}function jr(s){const[e,t,i]=s.split(":");return i?parseInt(e)*60*60+parseInt(t)*60+parseFloat(i):parseInt(e)*60+parseInt(t)}function sf(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:typeof s.top=="number"?s.top*e:s.top,right:typeof s.right=="number"?s.right*e:s.right,bottom:typeof s.bottom=="number"?s.bottom*e:s.bottom,left:typeof s.left=="number"?s.left*e:s.left}}function Bl(s,e){return typeof s=="number"?{top:s*e,right:s*e,bottom:s*e,left:s*e}:{top:(typeof s.top=="number"?s.top*e:s.top)??0,right:(typeof s.right=="number"?s.right*e:s.right)??0,bottom:(typeof s.bottom=="number"?s.bottom*e:s.bottom)??0,left:(typeof s.left=="number"?s.left*e:s.left)??0}}function Ql(s,e,{layout:t,scale:i=1}){const{position:r="relative",inset:n,width:o,height:a,minWidth:A,minHeight:l,maxWidth:c,maxHeight:u,flex:h,gap:d,margin:g,padding:f,direction:p="column",align:v="start",alignSelf:y,justify:Q="start"}=t,m={static:s.POSITION_TYPE_STATIC,relative:s.POSITION_TYPE_RELATIVE,absolute:s.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(m[r]),n){const{top:H,right:_,bottom:k,left:U}=sf(n,i);typeof H<"u"&&e.setPosition(s.EDGE_TOP,H),typeof _<"u"&&e.setPosition(s.EDGE_RIGHT,_),typeof k<"u"&&e.setPosition(s.EDGE_BOTTOM,k),typeof U<"u"&&e.setPosition(s.EDGE_LEFT,U)}const b={row:s.FLEX_DIRECTION_ROW,column:s.FLEX_DIRECTION_COLUMN,"row-reverse":s.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":s.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(b[p]);const x={start:s.ALIGN_FLEX_START,end:s.ALIGN_FLEX_END,center:s.ALIGN_CENTER,stretch:s.ALIGN_STRETCH};e.setAlignItems(x[v]),y&&e.setAlignSelf(x[y]);const B={start:s.JUSTIFY_FLEX_START,end:s.JUSTIFY_FLEX_END,center:s.JUSTIFY_CENTER,"space-between":s.JUSTIFY_SPACE_BETWEEN,"space-around":s.JUSTIFY_SPACE_AROUND,"space-evenly":s.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(B[Q]),g){const{top:H,right:_,bottom:k,left:U}=Bl(g,i);e.setMargin(s.EDGE_TOP,H),e.setMargin(s.EDGE_RIGHT,_),e.setMargin(s.EDGE_BOTTOM,k),e.setMargin(s.EDGE_LEFT,U)}if(f){const{top:H,right:_,bottom:k,left:U}=Bl(f,i);e.setPadding(s.EDGE_TOP,H),e.setPadding(s.EDGE_RIGHT,_),e.setPadding(s.EDGE_BOTTOM,k),e.setPadding(s.EDGE_LEFT,U)}typeof h<"u"&&e.setFlex(h),e.setGap(s.GUTTER_ALL,(d??0)*i),typeof o<"u"&&e.setWidth(typeof o=="number"?o*i:o),typeof a<"u"&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*i:a)),typeof A<"u"&&e.setMinWidth(typeof A=="number"?A*i:A),typeof l<"u"&&e.setMinHeight(typeof l=="number"?l*i:l),typeof c<"u"&&e.setMaxWidth(typeof c=="number"?c*i:c),typeof u<"u"&&e.setMaxHeight(typeof u=="number"?u*i:u)}function bl({canvas:s,debug:e=!1,scale:t=1,position:i=[]}){i.forEach(({x:r,y:n,width:o,height:a,childNodes:A,element:l})=>{const c=s.getContext("2d",{alpha:!1});if(c){const{draw:u}=l;u&&(c.save(),u({scale:t,dx:r,dy:n,dw:o,dh:a}),e&&(c.strokeStyle="red",c.strokeRect(r,n,o,a))),bl({canvas:s,debug:e,scale:t,position:A}),c.restore()}})}function Sl(s,e,t,i){const r=t.map((n,o)=>{const a=s.Node.create(),{radius:A,elements:l=[],draw:c,...u}=n;return Ql(s,a,{layout:u,scale:i}),e.insertChild(a,o),{node:a,element:n,childNodes:Sl(s,a,l,i)}});return e.calculateLayout(),r}function wl(s,e,t=0,i=0){const{top:r,left:n}=s.getComputedLayout();return e.map(({node:o,element:a,childNodes:A})=>{const{top:l,left:c,width:u,height:h}=o.getComputedLayout(),d=t+c,g=i+l;return{x:n+d,y:r+g,width:u,height:h,element:a,childNodes:wl(s,A,d,g)}})}function Rl(s,e){s.forEach(({node:t,element:i,childNodes:r})=>{const{height:n}=i;if(n&&typeof n=="function"){const o=t.getComputedWidth(),a=t.getComputedHeight(),A=n({width:o,maxHeight:a,scale:e});t.setHeight(A)}Rl(r,e)})}function rf({yoga:s,canvas:e,origin:t,elements:i,...r}){const n={inset:{top:0,left:0},width:e.width,height:e.height,...t},o=s.Node.create();Ql(s,o,{layout:n}),o.calculateLayout();const{width:a,height:A}=o.getComputedLayout(),l=Math.min(a,A)/1080,c=Sl(s,o,i,l);Rl(c,l),o.calculateLayout();const u=wl(o,c);return o.freeRecursive(),bl({...r,scale:l,canvas:e,position:u})}function wo({sceneTime:s,words:e,groupTime:t=5}){const i=e.reduce((n,o)=>{const{start:a,end:A}=o;if(a&&A){const l=Math.floor(a/t)*t;n[l]=[...n[l]??[],o]}return n},{}),r=Math.floor(s/t)*t;return i[r]??[]}function xl({context:s,word:e,maxW:t=1/0}){const i=[],r=s.measureText(e);if(r.width<t)return[{text:e,metrics:r}];for(let n=0;n<e.length;n++){const o=i[i.length-1],a=((o==null?void 0:o.text)??"")+e[n],A=s.measureText(a);A.width<t?i[o?i.length-1:0]={text:a,metrics:A}:i.push({text:e[n],metrics:s.measureText(e[n])})}return i}const Xr=Fr(({context:s,fontSizes:e,text:t,maxW:i=1/0})=>{try{return s.save(),s.font=s.font.replace(Yt,e[0].toString()),t.split(`
71
+ `).flatMap(n=>{const o=n.split(" ").filter(Boolean);return o.length?o.slice(1).reduce((a,A,l)=>{const u=`${a[a.length-1].text} ${A}`.trim(),h=s.measureText(u);if(h.width>i)a=[...a,...xl({context:s,word:A,maxW:i})];else{const d=e[l%e.length];s.font=s.font.replace(Yt,d.toString()),a[a.length-1]={text:u,metrics:h}}return a},xl({context:s,word:o[0],maxW:i})):{text:"",metrics:s.measureText("")}})}finally{s.restore()}},{cacheKey:([{fontSizes:s,text:e,maxW:t}])=>`${JSON.stringify(s)}_${e}_${t}`}),Tl=Fr(({font:s,scale:e,context:t,maxW:i,maxH:r,text:n,minSize:o,maxSize:a})=>{var A,l;let c=0;if(a){c=(o??0)*e;let h=0;for(;a*e>c+1;){c+=1;const d=Xr({context:t,fontSizes:[c],text:n,maxW:i});if(h=d.reduce((g,f)=>(f.metrics.width>g&&(g=f.metrics.width),g),0),h>i||d.length*c>r){c-=1;break}}}else c=parseFloat(((l=(A=s.match(Yt))==null?void 0:A.groups)==null?void 0:l.value)??"0")*e;return c},{cacheKey:([{font:s,text:e,minSize:t,maxSize:i,scale:r,maxW:n,maxH:o}])=>`${s}_${e}_${t}_${i}_${r}_${n}_${o}`}),Ro=Fr(({context:s,fontSizes:e,maxW:t=1/0,words:i})=>{try{return s.save(),s.font=s.font.replace(Yt,e[0].toString()),i.length<=0?[]:i.slice(1).reduce((r,n)=>{var o;const a=n.text,l=`${(o=r[r.length-1])==null?void 0:o.text} ${a}`.trim(),c=s.measureText(l);if(c.width>t){const u=e[r.length%e.length];s.font=s.font.replace(Yt,u.toString()),r=[...r,{text:a,metrics:s.measureText(a),words:[n]}]}else r[r.length-1]={text:l,metrics:c,words:[...r[r.length-1].words,n]};return r},[{text:i[0].text,metrics:s.measureText(i[0].text),words:[i[0]]}])}finally{s.restore()}},{cacheKey:([{fontSizes:s,words:e,maxW:t}])=>`${JSON.stringify(s)}_${JSON.stringify(e)}_${t}`}),vi=1.8;function Dl({context:s,x:e,y:t,width:i,height:r,radii:n}){let o,a,A,l;typeof n=="number"?o=a=A=l=n:[o,a,A,l]=n,s.beginPath(),s.moveTo(e+Math.min(r/vi,o),t),s.lineTo(e+i-Math.min(r/vi,a),t),s.quadraticCurveTo(e+i,t,e+i,t+Math.min(r/vi,a)),s.lineTo(e+i,t+r-Math.min(r/vi,A)),s.quadraticCurveTo(e+i,t+r,e+i-Math.min(r/vi,A),t+r),s.lineTo(e+Math.min(r/vi,l),t+r),s.quadraticCurveTo(e,t+r,e,t+r-Math.min(r/vi,l)),s.lineTo(e,t+Math.min(r/vi,o)),s.quadraticCurveTo(e,t,e+Math.min(r/vi,o),t),s.closePath()}function xo({context:s,x:e,y:t,width:i,height:r,radii:n,clip:o=!1,debug:a=!1}){Dl({context:s,x:e,y:t,width:i,height:r,radii:n}),a&&(s.strokeStyle="blue",s.stroke()),o&&s.clip()}function nf({context:s,x:e,y:t,width:i,height:r,radii:n}){Dl({context:s,x:e,y:t,width:i,height:r,radii:n}),s.stroke()}const of={linear:Sg,easeIn:Eo,easeInOut:Rg,easeOut:wg,circIn:fl,circInOut:xg,circOut:pl,backIn:Io,backInOut:Dg,backOut:Tg,anticipate:Lg,bounceIn:Ng,bounceInOut:Mg,bounceOut:Ur},zr=Fr((s,e,{clamp:t=!0,ease:i="easeIn",...r}={})=>Cg(s,e,{...r,clamp:t,ease:of[i]}),{cacheKey:([s,e,t])=>JSON.stringify({from:s,to:e,options:t})}),Ll=[{family:"Noto Arabic",regex:new RegExp("\\p{Script=Arabic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansArabic-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Chinese",regex:new RegExp("\\p{Script=Han}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansSC-VariableFont_wght.woff2",style:"normal"},{family:"Noto Hebrew",regex:new RegExp("\\p{Script=Hebrew}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansHebrew-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Hindi",regex:new RegExp("\\p{Script=Devanagari}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansDevanagari-VariableFont_wdth%2Cwght.woff2",style:"normal"},{family:"Noto Japanese",regex:new RegExp("\\p{Script=Han}|\\p{Script=Katakana}|\\p{Script=Hiragana}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansJP-VariableFont_wght.woff2",style:"normal"},{family:"Noto Korean",regex:new RegExp("\\p{Script=Hangul}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoSansKR-VariableFont_wght.woff2",style:"normal"},{family:"Noto Color Emoji",regex:new RegExp("\\p{Extended_Pictographic}","u"),url:"https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/NotoColorEmoji-Regular.woff2",style:"normal"}];function hs({text:s,font:e}){let t=e;return Ll.forEach(({family:i,regex:r})=>{r.exec(s)&&(t+=`, ${i}`)}),t}const Yt=/(?<value>\d+\.?\d*)(?=px)/;function _l(s){const{visible:e,node:t}=s,i=[...(t==null?void 0:t.elements)??[],...(s==null?void 0:s.elements)??[]];return e??(t&&t.type!=="box"&&t.type!=="gradient"?!!t.value:i==null?void 0:i.some(r=>_l(r)))}function To(s,e=1){return typeof s=="number"?{topLeft:s*e,topRight:s*e,bottomRight:s*e,bottomLeft:s*e}:{topLeft:((s==null?void 0:s.topLeft)??0)*e,topRight:((s==null?void 0:s.topRight)??0)*e,bottomRight:((s==null?void 0:s.bottomRight)??0)*e,bottomLeft:((s==null?void 0:s.bottomLeft)??0)*e}}function kl({yoga:s,debug:e=!1,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o=[],currentTime:a,contentTime:A,sceneTime:l,sceneStart:c,totalDuration:u,contentDuration:h,sceneDuration:d}){return o.map(g=>{var f,p,v,y,Q,m,b,x;const{node:B,transient:H=[{from:0,duration:1/0}]}=g,_=t.getContext("2d"),k={total:a,content:A,scene:l},U={total:u,content:h,scene:d},q=H.reduce((V,{type:Z="scene",from:S,duration:T,animation:O})=>{const R=S<0?U[Z]+S:S;return k[Z]>=R&&k[Z]<=R+T&&V.push({type:Z,animation:O,duration:T,from:R}),V},[]);if(_&&q.length>0&&_l(g)){let V=g.width,Z=g.height;if((B==null?void 0:B.type)==="text"&&B.value){const{align:S="left"}=B,T=hs({text:B.value,font:B.font});_.save(),_.font=T,_.textBaseline="top",_.textAlign=S,B.wrap?(_.font=T,Z=({width:O,maxHeight:R,scale:w})=>{var L,K;const G=Tl({font:T,scale:w,context:_,maxW:O,maxH:R,text:B.value??"",minSize:(L=B.fill)==null?void 0:L.minSize,maxSize:(K=B.fill)==null?void 0:K.maxSize});return Xr({context:_,fontSizes:[G],text:B.value??"",maxW:O}).length*G}):(V=_.measureText(B.value).width,Z=parseFloat(((p=(f=T.match(Yt))==null?void 0:f.groups)==null?void 0:p.value)??"0")),_.restore()}if((B==null?void 0:B.type)==="captions"&&B.value&&(Z=({width:S})=>{if(B.value.type==="instagram"){const T=wo({sceneTime:l,words:B.value.words,groupTime:5}).map(O=>({...O,text:O.text.toUpperCase()}));if(T){const O=Math.min(t.width,t.height),R=[O*.05,O*.03,O*.04];return Ro({context:_,fontSizes:R,words:T,maxW:S}).reduce((L,K,G)=>L+=R[G%R.length],0)}}return 0}),(B==null?void 0:B.type)==="image"&&B.image&&B.size){const S=((v=B.image)==null?void 0:v.naturalWidth)??((y=B.image)==null?void 0:y.width),T=((Q=B.image)==null?void 0:Q.naturalHeight)??((m=B.image)==null?void 0:m.height),O=S/T,R=(b=B.size)==null?void 0:b.width,w=(x=B.size)==null?void 0:x.height;V=R??(w??0)*O,Z=w??(R??0)/O}return{...g,width:V,height:Z,elements:kl({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:g.elements,currentTime:a,contentTime:A,sceneTime:l,sceneStart:c,totalDuration:u,contentDuration:h,sceneDuration:d}),draw:({dx:S,dy:T,dw:O,dh:R,scale:w})=>{var L,K,G,j,te,ue,ce,me,Qe,xe,ae,Ie,_e,Te;if(q.forEach(Ne=>{const{type:re="scene",from:le,duration:be,animation:De={type:"fade",duration:.3333333333333333,easing:{in:"easeOut",out:"easeOut"}}}=Ne;if(De){const{type:Ue,duration:we,easing:{in:ke="easeOut",out:Ce="easeOut"}={}}=De;if(le>0&&k[re]<=le+we)switch(Ue){case"fade":{const Me=zr([le,le+we],[0,1],{ease:ke});_.globalAlpha=Me(k[re]);break}case"slide":{const{options:Me}=De,Xe={up:[{x:0,y:R},{x:0,y:0}],right:[{x:O,y:0},{x:0,y:0}],down:[{x:0,y:-R},{x:0,y:0}],left:[{x:-O,y:0},{x:0,y:0}]},rt=zr([le,le+we],Xe[Me.direction.in],{ease:ke}),{x:Ke,y:nt}=rt(k[re]);_.translate(Ke,nt);break}}if(le+be<U[re]&&le+be-we<=k[re])switch(Ue){case"fade":{const Me=zr([le+be-we,le+be],[1,0],{ease:Ce});_.globalAlpha=Me(k[re]);break}case"slide":{const{options:Me}=De,Xe={up:[{x:0,y:0},{x:0,y:-R}],right:[{x:0,y:0},{x:O,y:0}],down:[{x:0,y:0},{x:0,y:R}],left:[{x:0,y:0},{x:-O,y:0}]},rt=zr([le+be-we,le+be],Xe[Me.direction.out],{ease:Ce}),{x:Ke,y:nt}=rt(k[re]);_.translate(Ke,nt);break}}}}),B){const{type:Ne}=B;if(Ne==="box"&&B.shadow){const{shadow:{color:re="rgba(0, 0, 0, 0.5)",blur:le=0,offset:{x:be=0,y:De=0}={}}={}}=B;if(_.save(),_.fillStyle=re,_.shadowColor=re,_.shadowBlur=le,_.shadowOffsetX=be+O+t.width,_.shadowOffsetY=De+R+t.height,_.beginPath(),!g.radius)_.rect(S-O-t.width,T-R-t.height,O,R);else{const{topLeft:Ue,topRight:we,bottomRight:ke,bottomLeft:Ce}=To(g.radius,w);xo({debug:e,context:_,x:S-O-t.width,y:T-R-t.height,width:O,height:R,radii:[Ue,we,ke,Ce]})}_.fill(),_.closePath(),_.restore()}if(Ne==="box"&&B.border){const{border:{color:re="black",width:le=0}}=B;if(le){const{topLeft:be,topRight:De,bottomRight:Ue,bottomLeft:we}=To(g.radius,w);_.save(),_.lineWidth=le*w,_.strokeStyle=re,nf({context:_,x:S,y:T,width:O,height:R,radii:[be,De,Ue,we]}),_.restore()}}if(g.radius){const{topLeft:re,topRight:le,bottomRight:be,bottomLeft:De}=To(g.radius,w);xo({debug:e,context:_,x:S,y:T,width:O,height:R,radii:[re,le,be,De],clip:!0})}if(Ne==="box"&&B.background&&(_.save(),_.fillStyle=B.background,_.fillRect(S,T,O,R),_.restore()),Ne==="text"&&B.value){const{align:re="left"}=B,le=hs({text:B.value,font:B.font}),be=Tl({font:le,scale:w,context:_,maxW:O,maxH:R,text:B.value??"",minSize:(L=B.fill)==null?void 0:L.minSize,maxSize:(K=B.fill)==null?void 0:K.maxSize});_.font=le.replace(Yt,be.toString()),_.textBaseline="top",_.fillStyle=B.color,_.textAlign=re;const De={left:S,center:S+O/2,right:S+O};B.wrap?Xr({context:_,fontSizes:[be],text:B.value,maxW:O}).forEach((we,ke)=>{_.fillText(we.text,De[re],T+be*ke)}):_.fillText(B.value,De[re],T)}if(Ne==="image"&&B.image&&_.drawImage(B.image,S,T,O,R),Ne==="video"&&((G=B.video)!=null&&G.node||(j=B.video)!=null&&j.getSource)){const re=B.format??"letterbox",le=((ue=(te=B.video)==null?void 0:te.getSource)==null?void 0:ue.call(te,l))??B.video.node,be=(le==null?void 0:le.videoWidth)??(le==null?void 0:le.naturalWidth)??(le==null?void 0:le.width),De=(le==null?void 0:le.videoHeight)??(le==null?void 0:le.naturalHeight)??(le==null?void 0:le.height);if(be&&De){const{dx:we,dy:ke,dw:Ce,dh:Me}=vl({context:_,cropCanvas:i,letterboxCanvas:n,source:le,format:re,crop:(ce=B==null?void 0:B.value)==null?void 0:ce.crop,sourceWidth:be,sourceHeight:De,posX:S,posY:T,drawAreaWidth:O,drawAreaHeight:R});B.elements&&Do({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:B.elements,currentTime:a,contentTime:A,sceneTime:l,sceneStart:c,totalDuration:u,contentDuration:h,sceneDuration:d,origin:{inset:{top:Math.max(T,T+ke),left:Math.max(S,S+we)},width:Math.min(O,Ce),height:Math.min(R,Me)}})}const Ue=1/3;if(B.poster&&a>=0&&a<=Ue){_.save(),_.globalAlpha=1-a/Ue;const we=((me=B.poster)==null?void 0:me.naturalWidth)??((Qe=B.poster)==null?void 0:Qe.width),ke=((xe=B.poster)==null?void 0:xe.naturalHeight)??((ae=B.poster)==null?void 0:ae.height);r.width=r.height=0,r.width=O,r.height=R;const Ce=r.getContext("2d");if(Ce&&we&&ke){const{dx:Me,dy:Xe,dw:rt,dh:Ke}=vl({context:Ce,cropCanvas:i,letterboxCanvas:n,source:B.poster,format:re,crop:(Ie=B==null?void 0:B.value)==null?void 0:Ie.crop,sourceWidth:we,sourceHeight:ke,posX:0,posY:0,drawAreaWidth:O,drawAreaHeight:R});B.elements&&Do({yoga:s,debug:e,canvas:r,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:B.elements,currentTime:a,contentTime:A,sceneTime:l,sceneStart:c,totalDuration:u,contentDuration:h,sceneDuration:d,origin:{inset:{top:Math.max(0,Xe),left:Math.max(0,Me)},width:Math.min(O,rt),height:Math.min(R,Ke)}}),_.drawImage(r,S,T,O,R),_.restore()}}}if(Ne==="gradient"&&B.value){const re=_.createLinearGradient(S+O,T,S+O,T+R);(_e=B.value)==null||_e.forEach(le=>{re.addColorStop(le.percent,le.color)}),_.fillStyle=re,_.fillRect(S,T,O,R)}Ne==="captions"&&B.value&&(B.value.type==="vtt"&&af({canvas:t,dx:S,dy:T,dw:O,scale:w,font:B.value.font,sceneTime:l+c,vttCaptions:B.value.vtt}),B.value.type==="instagram"&&Af({canvas:t,context:_,dx:S,dy:T,dw:O,sceneTime:l+c,words:B.value.words}),B.value.type==="highlight"&&lf({context:_,dx:S,dy:T,dw:O,scale:w,font:B.value.font,color:(Te=B.value.options)==null?void 0:Te.color,sceneTime:l+c,words:B.value.words}))}}}}}).filter(Boolean)}function Do({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,sceneStart:c,totalDuration:u,contentDuration:h,sceneDuration:d,...g}){return rf({...g,yoga:s,debug:e,canvas:t,elements:kl({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,sceneStart:c,totalDuration:u,contentDuration:h,sceneDuration:d})})}function af({canvas:s,dx:e,dy:t,dw:i,scale:r,font:n,sceneTime:o,vttCaptions:a}){var A,l,c;if(a){const h=yl(a).find(({start:d,end:g})=>d&&g&&o>=jr(d)&&o<jr(g));if((A=h==null?void 0:h.text)!=null&&A.trim()){const d=s.getContext("2d");if(d){const g=parseFloat(((c=(l=n.match(Yt))==null?void 0:l.groups)==null?void 0:c.value)??"0")*r,f=hs({font:n.replace(Yt,g.toString()),text:a});d.font=f,d.textBaseline="middle";const p=Xr({context:d,fontSizes:[g],text:h.text,maxW:i});p.forEach(({text:v,metrics:y},Q)=>{const m=e+(i-y.width)/2,b=t+g*(p.length-1-Q),x=g*.8,B=g/1.5,H=e+(i-y.width-B)/2,_=b-x,k=y.width+B,U=x*2,q=d.globalAlpha;d.save(),d.globalAlpha=.8*q,d.fillStyle="#000000",d.beginPath(),xo({context:d,x:H,y:_,width:k,height:U,radii:10*r}),d.fill(),d.closePath(),d.globalAlpha=q,d.fillStyle="#FFFFFF",d.fillText(v,m,b),d.restore()})}}}}function Af({canvas:s,context:e,dx:t,dy:i,dw:r,sceneTime:n,words:o=[]}){e.save();const a=wo({sceneTime:n,words:o,groupTime:5}).map(A=>({...A,text:A.text.toUpperCase()}));if(a){const A=Math.min(s.width,s.height),l=[A*.05,A*.03,A*.04],c=Ro({context:e,fontSizes:l,words:a,maxW:r});c.forEach(({words:u},h)=>{const d=u.filter(({start:g})=>g<n);if(d.length>0){const g=c.reduce((v,y,Q)=>(Q<h&&(v+=l[Q%l.length]),v),0),f=l[h%l.length],p=hs({text:u.map(({text:v})=>v).join(" "),font:`600 ${f}px Roobert`});d.forEach((v,y)=>{const Q=v.text,m=d.reduce((B,{text:H},_)=>(_<y&&(B+=H+" "),B),""),b=t+e.measureText(m).width,x=i+g;e.font=p,e.textBaseline="top",e.fillStyle="#FFFFFF",e.globalAlpha=(n-v.start)*5,e.fillText(Q,b,x)})}})}e.restore()}function lf({context:s,dx:e,dy:t,dw:i,scale:r,font:n,color:o="red",sceneTime:a,words:A=[]}){var l,c;s.save();const u=wo({sceneTime:a,words:A,groupTime:2});if(u){const h=parseFloat(((c=(l=n.match(Yt))==null?void 0:l.groups)==null?void 0:c.value)??"0")*r,d=hs({font:n.replace(Yt,h.toString()),text:A.map(({text:v})=>v).join(" ")});s.font=d;const g=Ro({context:s,fontSizes:[h],words:u,maxW:i}),f=u.reverse().find(v=>a>=v.start),p=g.length*h;g.forEach(({words:v,metrics:y},Q)=>{const m=g.reduce((b,x,B)=>(B<Q&&(b+=h),b),0);v.forEach((b,x)=>{const B=b.text,H=v.reduce((U,{text:q},V)=>(V<x&&(U+=q+" "),U),""),_=e+(i-y.width)/2+s.measureText(H).width,k=t-p/2+m;s.textBaseline="top",s.fillStyle="#FFFFFF",s.save(),(f==null?void 0:f.start)===b.start&&(s.fillStyle=o),s.fillText(B,_,k),s.restore()})})}s.restore()}let Zr;const cf=new Uint8Array(16);function uf(){if(!Zr&&(Zr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Zr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Zr(cf)}const Et=[];for(let s=0;s<256;++s)Et.push((s+256).toString(16).slice(1));function hf(s,e=0){return Et[s[e+0]]+Et[s[e+1]]+Et[s[e+2]]+Et[s[e+3]]+"-"+Et[s[e+4]]+Et[s[e+5]]+"-"+Et[s[e+6]]+Et[s[e+7]]+"-"+Et[s[e+8]]+Et[s[e+9]]+"-"+Et[s[e+10]]+Et[s[e+11]]+Et[s[e+12]]+Et[s[e+13]]+Et[s[e+14]]+Et[s[e+15]]}const Fl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function df(s,e,t){if(Fl.randomUUID&&!e&&!s)return Fl.randomUUID();s=s||{};const i=s.random||(s.rng||uf)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let r=0;r<16;++r)e[t+r]=i[r];return e}return hf(i)}const gf={id:"073977ec-6384-4329-b7c5-8275fb513e74",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",templates:[{id:"046f363c-960a-449c-ae5e-984ac6ab58c2",version:"3",name:"None",entityId:"none",templateId:"a95e537e-fb4d-4d2f-9c72-86c0925c7176",layouts:[{name:"none",tree:`[
72
72
  {
73
73
  "width": "100%",
74
74
  "height": "100%",
@@ -80,6 +80,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
80
80
  "key": {{ it.key }},
81
81
  "src": {{ it.src }},
82
82
  "playlist": {{ it.playlist }},
83
+ "preview": {{ it.preview }},
83
84
  "poster": {{ it.poster }},
84
85
  "captions": {{ it.captions }},
85
86
  "duration": {{ it.duration }},
@@ -110,6 +111,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
110
111
  }`,derived:`{
111
112
  "src": {{ it._derived?.src }},
112
113
  "playlist": {{ it._derived?.playlist }},
114
+ "preview": {{ it._derived?.preview }},
113
115
  "captions": {{ it._derived?.captions }}
114
116
  }`}],root:"{{ it.intro?.questions?.items }}"},{scenes:[{layout:"none",data:`{
115
117
  "id": {{ it._root?.answer?.id }},
@@ -127,6 +129,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
127
129
  }`,derived:`{
128
130
  "src": {{ it._derived?.src }},
129
131
  "playlist": {{ it._derived?.playlist }},
132
+ "preview": {{ it._derived?.preview }},
130
133
  "captions": {{ it._derived?.captions }}
131
134
  }`}],root:"{{ it.questions?.items }}"},{scenes:[{layout:"none",data:`{
132
135
  "id": {{ it._root?.answer?.id }},
@@ -144,53 +147,54 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
144
147
  }`,derived:`{
145
148
  "src": {{ it._derived?.src }},
146
149
  "playlist": {{ it._derived?.playlist }},
150
+ "preview": {{ it._derived?.preview }},
147
151
  "captions": {{ it._derived?.captions }}
148
- }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}],meta:{frameRate:30,resolution:720,transitionDuration:1/3},system:!0,default:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};async function Wg(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Uu);return new s.Image}return new Image}const Cl=Li(async function(e){return e?new Promise((t,i)=>{Wg().then(r=>{r.onload=()=>{t(r)},r.onerror=n=>{i(n)},r.src=e})}):null});async function Eo({element:s,meta:e},t,i){var r,n,o;let a={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((r=A==null?void 0:A.value)!=null&&r.src||(n=A==null?void 0:A.value)!=null&&n.playlist)){const l=await t(A.value,e);let c;try{c=await Cl(A.value.poster)}catch{c=null}a={...a,node:{...A,video:l,poster:c,meta:await i(A.value,l.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let l;try{l=await Cl(A.value)}catch{l=null}a={...a,node:{...A,image:l}}}return a.node&&((o=s.node)!=null&&o.elements)&&(a.node.elements=await Promise.all(s.node.elements.map(l=>Eo({element:l,meta:e},t,i)))),s.elements&&(a.elements=await Promise.all(s.elements.map(l=>Eo({element:l,meta:e},t,i)))),a}async function Hr(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Uu),e=new s.Canvas;return e.gpu=!1,e}return document.createElement("canvas")}function Zs(s=[]){var e;for(const t of s){if(((e=t==null?void 0:t.node)==null?void 0:e.type)==="video")return t.node;const i=Zs(t==null?void 0:t.elements);if(i)return i}}function qg(s,e){return s.reduce((t,i,r)=>[...t,i.map(({duration:n},o)=>r===s.length-1&&o===i.length-1?n:n-e)],[])}function jg(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function Xg(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function $r(s){return s.flatMap(e=>e).reduce((e,t)=>e+t,0)}ho.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${Xg(s)}"`:jg(s)||Array.isArray(s)?JSON.stringify(s):s);const cs=(s,e,t)=>ho.render(s,e,ho.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function hs({data:s,template:e,burnCaptions:t=!1,debug:i=!1},r,n,o){var a,A,l,c;const h=e??Jg;if(!((a=h.templates)!=null&&a.length))throw new Error(`No templates found for template instance: ${h.id}`);let u=h.templates.find(({version:v})=>v===po);if(!u){const v=h.templates.map(({version:F})=>`"${F}"`).join(", ");console.warn(`Template renderer expects template version "${po}" but got ${v}`),u=h.templates[h.templates.length-1]}const d=await Promise.all(u.content.map(async({scenes:v,root:F})=>{const G={...h.options,...s,intro:h.intro,outro:h.outro};async function M(H,j){return Promise.all(v.map(async({layout:U,duration:J,data:w,derived:D,options:X})=>{var R,b,T;const K={...G,_index:j,_root:H,_derived:await r({data:s,rootData:H,index:j})},P=w?JSON.parse(await cs(w,K)):{},q=D?JSON.parse(await cs(D,K)):{},ie=X?JSON.parse(await cs(X,K)):{},ce=J?parseFloat(await cs(J,K)):NaN,he=(R=u.layouts.find(de=>de.name===U))==null?void 0:R.tree;if(!he)throw new Error(`Layout tree "${U}" not found in template "${u.id}" layouts.`);const se=JSON.parse(await cs(he,{...P,...q,...ie})),Qe=await Promise.all(se.flatMap(de=>Eo({element:de,meta:h.meta},n,o))),Se=Zs(Qe);return{duration:(isNaN(ce)?null:ce)??((b=Se==null?void 0:Se.meta)==null?void 0:b.duration)??0,captions:(T=Se==null?void 0:Se.meta)==null?void 0:T.captions,elements:Qe}}))}if(F){const H=JSON.parse(await cs(F,G));return Array.isArray(H)?(await Promise.all(H.map(async(j,U)=>M(j,U)))).flatMap(j=>j):M(H,null)}return M(s,null)}));if(d.every(v=>v.every(F=>{const G=Zs(F.elements);return!(G!=null&&G.value.src)&&!(G!=null&&G.value.playlist)}))){const v=d.flatMap(F=>F.map(G=>{const M=Zs(G.elements);return!(M!=null&&M.value.src)&&!(M!=null&&M.value.playlist)&&(M==null?void 0:M.value.id)}).filter(Boolean)).join(", ");throw new Error(`Video(s) with ID ${v} failed to load, video can not be processed`)}if(d.every(v=>v.every(F=>F.duration<=0)))throw new Error("No scenes have any duration, video can not be processed");const E=d.reduce((v,F)=>{const G=F.filter(M=>M.duration>0);return G.length>0&&(v=[...v,G]),v},[]),B=((A=h.meta)==null?void 0:A.frameRate)??30,S=((l=h.meta)==null?void 0:l.resolution)??720,Q=((c=h.meta)==null?void 0:c.transitionDuration)??1/3,m=qg(E,Q),y=$r(m);return{scenes:(await Promise.all(E.map((v,F)=>{const G=$r(m[F]),M=$r(m.slice(0,F));return Promise.all(v.map(async({duration:H,captions:j,elements:U},J)=>{var w,D;const X=await Hr(),R=await Hr(),b=await Hr(),T=await Hr(),K=Zs(U),P=$r([...m.slice(0,F),...m[F].slice(0,J)]);return{draw:({canvas:ie,currentTime:ce})=>{const he=Math.max(0,ce-M),se=Math.max(0,ce-P);fo({debug:i,canvas:ie,cropCanvas:X,posterCanvas:T,letterboxCanvas:R,elements:U,currentTime:ce,contentTime:he,sceneTime:se,totalDuration:y,contentDuration:G,sceneDuration:H}),j&&t&&Vg({canvas:ie,dx:0,dy:0,dw:ie.width,dh:ie.height,vttCaptions:j,sceneTime:se+((K==null?void 0:K.meta.start)??0)})},duration:H,transitionCanvas:b,start:P,video:K==null?void 0:K.video,videoMeta:K==null?void 0:K.meta,audio:{duration:H,src:(w=K==null?void 0:K.value)==null?void 0:w.src,start:(D=K==null?void 0:K.meta)==null?void 0:D.start}}}))}))).flatMap(v=>v),frameRate:B,resolution:S,transitionDuration:Q,fonts:u.fonts??[],duration:y}}const po="3",Zg={name:"@vouchfor/embeds",version:"0.0.0-experiment.0f953a2",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"experiment",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/canvas-video":"0.0.0-experiment.0f953a2","@vouchfor/media-player":"0.0.0-experiment.0f953a2",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.0.2","@storybook/addon-links":"^8.0.2","@storybook/blocks":"^8.0.2","@storybook/web-components":"^8.0.2","@storybook/web-components-vite":"^8.0.2","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.6","@vouchfor/eslint-config":"^1.0.1","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"0.0.0-experiment.0f953a2","@web/dev-server-esbuild":"^1.0.2","@web/test-runner":"^0.18.1","@web/test-runner-browserstack":"^0.7.1","@web/test-runner-mocha":"^0.9.0","@web/test-runner-playwright":"^0.11.0",glob:"^10.3.10","lint-staged":"^15.2.2",lit:"^3.1.2",lodash:"^4.17.21",react:"^18.2.0","react-dom":"^18.2.0","rollup-plugin-tla":"^0.0.2",sinon:"^17.0.1",storybook:"^8.0.2",svgson:"^5.3.1",typescript:"^5.4.3",vite:"^5.2.2","vite-plugin-commonjs":"^0.10.1","vite-plugin-dts":"^3.7.3","web-component-analyzer":"^2.0.0"}};function zg(s){const{publicApiUrl:e}=br(s),t=xi();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function ef(s){var n,o,a,A,l,c,h,u,d,g,f,E;if(typeof window>"u")return{client:null,tab:null,request:xi()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(A=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:A.call(a,"vouch-uid-client"),i=(c=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:c.call(l,"vouch-uid-tab");const r=xi();return e||(e=zg(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"vouch-uid-visitor",e)),t||(t=xi(),(g=(d=window.localStorage)==null?void 0:d.setItem)==null||g.call(d,"vouch-uid-client",t)),i||(i=xi(),(E=(f=window.sessionStorage)==null?void 0:f.setItem)==null||E.call(f,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function tf(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function sf(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const A=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());i[A]=a}}),{source:s,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:Zg.version,templateVersion:po,...i}}const ml=1;class rf{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=tf(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=br(this.host.env),{client:i,tab:r,request:n,visitor:o}=ef(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":sf(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+ml&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+ml&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var Io={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Fr<"u"&&Fr,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof a<"u"&&a,A={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(w){return w&&DataView.prototype.isPrototypeOf(w)}if(A.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(w){return w&&c.indexOf(Object.prototype.toString.call(w))>-1};function u(w){if(typeof w!="string"&&(w=String(w)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(w)||w==="")throw new TypeError('Invalid character in header field name: "'+w+'"');return w.toLowerCase()}function d(w){return typeof w!="string"&&(w=String(w)),w}function g(w){var D={next:function(){var X=w.shift();return{done:X===void 0,value:X}}};return A.iterable&&(D[Symbol.iterator]=function(){return D}),D}function f(w){this.map={},w instanceof f?w.forEach(function(D,X){this.append(X,D)},this):Array.isArray(w)?w.forEach(function(D){this.append(D[0],D[1])},this):w&&Object.getOwnPropertyNames(w).forEach(function(D){this.append(D,w[D])},this)}f.prototype.append=function(w,D){w=u(w),D=d(D);var X=this.map[w];this.map[w]=X?X+", "+D:D},f.prototype.delete=function(w){delete this.map[u(w)]},f.prototype.get=function(w){return w=u(w),this.has(w)?this.map[w]:null},f.prototype.has=function(w){return this.map.hasOwnProperty(u(w))},f.prototype.set=function(w,D){this.map[u(w)]=d(D)},f.prototype.forEach=function(w,D){for(var X in this.map)this.map.hasOwnProperty(X)&&w.call(D,this.map[X],X,this)},f.prototype.keys=function(){var w=[];return this.forEach(function(D,X){w.push(X)}),g(w)},f.prototype.values=function(){var w=[];return this.forEach(function(D){w.push(D)}),g(w)},f.prototype.entries=function(){var w=[];return this.forEach(function(D,X){w.push([X,D])}),g(w)},A.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function E(w){if(w.bodyUsed)return Promise.reject(new TypeError("Already read"));w.bodyUsed=!0}function B(w){return new Promise(function(D,X){w.onload=function(){D(w.result)},w.onerror=function(){X(w.error)}})}function S(w){var D=new FileReader,X=B(D);return D.readAsArrayBuffer(w),X}function Q(w){var D=new FileReader,X=B(D);return D.readAsText(w),X}function m(w){for(var D=new Uint8Array(w),X=new Array(D.length),R=0;R<D.length;R++)X[R]=String.fromCharCode(D[R]);return X.join("")}function y(w){if(w.slice)return w.slice(0);var D=new Uint8Array(w.byteLength);return D.set(new Uint8Array(w)),D.buffer}function L(){return this.bodyUsed=!1,this._initBody=function(w){this.bodyUsed=this.bodyUsed,this._bodyInit=w,w?typeof w=="string"?this._bodyText=w:A.blob&&Blob.prototype.isPrototypeOf(w)?this._bodyBlob=w:A.formData&&FormData.prototype.isPrototypeOf(w)?this._bodyFormData=w:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(w)?this._bodyText=w.toString():A.arrayBuffer&&A.blob&&l(w)?(this._bodyArrayBuffer=y(w.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(w)||h(w))?this._bodyArrayBuffer=y(w):this._bodyText=w=Object.prototype.toString.call(w):this._bodyText="",this.headers.get("content-type")||(typeof w=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):A.searchParams&&URLSearchParams.prototype.isPrototypeOf(w)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var w=E(this);if(w)return w;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var w=E(this);return w||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(S)}),this.text=function(){var w=E(this);if(w)return w;if(this._bodyBlob)return Q(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(m(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},A.formData&&(this.formData=function(){return this.text().then(M)}),this.json=function(){return this.text().then(JSON.parse)},this}var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function F(w){var D=w.toUpperCase();return v.indexOf(D)>-1?D:w}function G(w,D){if(!(this instanceof G))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D=D||{};var X=D.body;if(w instanceof G){if(w.bodyUsed)throw new TypeError("Already read");this.url=w.url,this.credentials=w.credentials,D.headers||(this.headers=new f(w.headers)),this.method=w.method,this.mode=w.mode,this.signal=w.signal,!X&&w._bodyInit!=null&&(X=w._bodyInit,w.bodyUsed=!0)}else this.url=String(w);if(this.credentials=D.credentials||this.credentials||"same-origin",(D.headers||!this.headers)&&(this.headers=new f(D.headers)),this.method=F(D.method||this.method||"GET"),this.mode=D.mode||this.mode||null,this.signal=D.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(X),(this.method==="GET"||this.method==="HEAD")&&(D.cache==="no-store"||D.cache==="no-cache")){var R=/([?&])_=[^&]*/;if(R.test(this.url))this.url=this.url.replace(R,"$1_="+new Date().getTime());else{var b=/\?/;this.url+=(b.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}G.prototype.clone=function(){return new G(this,{body:this._bodyInit})};function M(w){var D=new FormData;return w.trim().split("&").forEach(function(X){if(X){var R=X.split("="),b=R.shift().replace(/\+/g," "),T=R.join("=").replace(/\+/g," ");D.append(decodeURIComponent(b),decodeURIComponent(T))}}),D}function H(w){var D=new f,X=w.replace(/\r?\n[\t ]+/g," ");return X.split("\r").map(function(R){return R.indexOf(`
149
- `)===0?R.substr(1,R.length):R}).forEach(function(R){var b=R.split(":"),T=b.shift().trim();if(T){var K=b.join(":").trim();D.append(T,K)}}),D}L.call(G.prototype);function j(w,D){if(!(this instanceof j))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');D||(D={}),this.type="default",this.status=D.status===void 0?200:D.status,this.ok=this.status>=200&&this.status<300,this.statusText=D.statusText===void 0?"":""+D.statusText,this.headers=new f(D.headers),this.url=D.url||"",this._initBody(w)}L.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},j.error=function(){var w=new j(null,{status:0,statusText:""});return w.type="error",w};var U=[301,302,303,307,308];j.redirect=function(w,D){if(U.indexOf(D)===-1)throw new RangeError("Invalid status code");return new j(null,{status:D,headers:{location:w}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(D,X){this.message=D,this.name=X;var R=Error(D);this.stack=R.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function J(w,D){return new Promise(function(X,R){var b=new G(w,D);if(b.signal&&b.signal.aborted)return R(new o.DOMException("Aborted","AbortError"));var T=new XMLHttpRequest;function K(){T.abort()}T.onload=function(){var q={status:T.status,statusText:T.statusText,headers:H(T.getAllResponseHeaders()||"")};q.url="responseURL"in T?T.responseURL:q.headers.get("X-Request-URL");var ie="response"in T?T.response:T.responseText;setTimeout(function(){X(new j(ie,q))},0)},T.onerror=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},T.ontimeout=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},T.onabort=function(){setTimeout(function(){R(new o.DOMException("Aborted","AbortError"))},0)};function P(q){try{return q===""&&a.location.href?a.location.href:q}catch{return q}}T.open(b.method,P(b.url),!0),b.credentials==="include"?T.withCredentials=!0:b.credentials==="omit"&&(T.withCredentials=!1),"responseType"in T&&(A.blob?T.responseType="blob":A.arrayBuffer&&b.headers.get("Content-Type")&&b.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(T.responseType="arraybuffer")),D&&typeof D.headers=="object"&&!(D.headers instanceof f)?Object.getOwnPropertyNames(D.headers).forEach(function(q){T.setRequestHeader(q,d(D.headers[q]))}):b.headers.forEach(function(q,ie){T.setRequestHeader(ie,q)}),b.signal&&(b.signal.addEventListener("abort",K),T.onreadystatechange=function(){T.readyState===4&&b.signal.removeEventListener("abort",K)}),T.send(typeof b._bodyInit>"u"?null:b._bodyInit)})}return J.polyfill=!0,a.fetch||(a.fetch=J,a.Headers=f,a.Request=G,a.Response=j),o.Headers=f,o.Request=G,o.Response=j,o.fetch=J,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,s.exports=e})(Io,Io.exports);var nf=Io.exports;const Bl=rl(nf);async function of(s){var e;try{if((e=await Bl(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function yl({sources:s}){let e=null;const t=s==null?void 0:s.filter(Boolean),i=t==null?void 0:t.find(n=>n.startsWith("blob:")),r=t==null?void 0:t.find(n=>n.startsWith("file:"));if(i||r)return i??r;if(t.length>0){const n=t.map(o=>of(o));e=(await Promise.all(n)).find(Boolean)}return e}async function af(s){return s=s.trim(),s.startsWith("http")||s.startsWith("blob:")||s.startsWith("file")?(await Bl(s)).text():s}const Af=Li(async({original:s,translation:e,originalLanguage:t="",translationLanguage:i=""},{language:r})=>{const o={[t.split("-")[0]]:s,[i.split("-")[0]]:e}[r]??s;return o?af(o):null},{cacheKey:([s,{language:e}])=>JSON.stringify({...s,language:e})});async function lf(s){var e,t,i,r,n,o;const a=(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.input,A=(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.video,l=(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist;return{src:await yl({sources:[a,A]}),playlist:await yl({sources:[l]})}}function cf(s){var e,t,i,r,n,o,a,A,l,c,h,u;const d=((t=(e=s==null?void 0:s.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":(r=(i=s==null?void 0:s.answer)==null?void 0:i.contact)==null?void 0:r.name,g=((o=(n=s==null?void 0:s.answer)==null?void 0:n.client)==null?void 0:o.name)==="Not Supplied"?"":(A=(a=s==null?void 0:s.answer)==null?void 0:a.client)==null?void 0:A.name;return{name:d,companyName:g,firstName:(l=d==null?void 0:d.split(" "))==null?void 0:l[0],lastName:(c=d==null?void 0:d.split(" "))==null?void 0:c[1],companyRoleTitle:[g,(u=(h=s==null?void 0:s.answer)==null?void 0:h.contact)==null?void 0:u.roleTitle].filter(Boolean).join(", ")}}async function Co({rootData:s,index:e},t){var i,r,n,o,a,A,l,c,h,u,d,g,f,E;return{...cf(s),...await lf(s),key:`${s==null?void 0:s.id}-${e}`,captions:await Af({original:((r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.captions)??((o=(n=s==null?void 0:s.answer)==null?void 0:n.captions)==null?void 0:o.current),translation:((A=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:A.translation)??((c=(l=s==null?void 0:s.answer)==null?void 0:l.captions)==null?void 0:c.translation),originalLanguage:(u=(h=s==null?void 0:s.answer)==null?void 0:h.transcriptions)==null?void 0:u.language,translationLanguage:(f=(g=(d=s==null?void 0:s.answer)==null?void 0:d.transcriptions)==null?void 0:g.translation)==null?void 0:f.language},t),answerLabel:((E=s==null?void 0:s.answer)==null?void 0:E.label)??(s==null?void 0:s.title)}}const Kr={af:"Afrikaans",ar:"Arabic",da:"Danish",de:"German",en:"English",es:"Spanish",fa:"Farsi",fr:"French",gd:"Scottish Gaelic",he:"Hebrew",hi:"Hindi, Indian",id:"Indonesian",it:"Italian",ja:"Japanese",ko:"Korean",ms:"Malay",nl:"Dutch",pt:"Portuguese",ru:"Russian",ta:"Tamil",te:"Telugu",th:"Thai",tr:"Turkish",zh:"Chinese"};function hf({data:s}){var e,t;return((t=(e=s==null?void 0:s.questions)==null?void 0:e.items)==null?void 0:t.reduce((i,r)=>{var n,o,a,A,l,c,h;const u=(a=(o=(n=r==null?void 0:r.answer)==null?void 0:n.transcriptions)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(h=(c=(l=(A=r==null?void 0:r.answer)==null?void 0:A.transcriptions)==null?void 0:l.translation)==null?void 0:c.language)==null?void 0:h.split("-")[0];return u&&Kr[u]&&!i.find(g=>g.value===u)&&i.push({value:u,label:Kr[u]}),d&&Kr[d]&&!i.find(g=>g.value===d)&&i.push({value:d,label:Kr[d]}),i},[]))??[]}/**
152
+ }`}],root:"{{ it.outro?.questions?.items }}"}],system:!0}],meta:{frameRate:30,resolution:1080,transitionDuration:1/3},options:{videoFormat:"letterbox-video"},default:0,system:!0};async function ff(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>zh);return new s.Image}return new Image}const Nl=$t(async function(e){return e?new Promise((t,i)=>{ff().then(r=>{r.onload=()=>{t(r)},r.onerror=n=>{i(n)},r.src=e})}):null});async function Lo({element:s,meta:e},t,i){var r,n,o;let a={...s};const{node:A}=s;if((A==null?void 0:A.type)==="video"&&((r=A==null?void 0:A.value)!=null&&r.src||(n=A==null?void 0:A.value)!=null&&n.playlist)){const l=await t(A.value,e);let c;try{c=await Nl(A.value.poster)}catch{c=null}a={...a,node:{...A,video:l,poster:c,meta:await i(A.value,l.node,e)}}}if((A==null?void 0:A.type)==="image"&&A.value){let l;try{l=await Nl(A.value)}catch{l=null}a={...a,node:{...A,image:l}}}return a.node&&((o=s.node)!=null&&o.elements)&&(a.node.elements=await Promise.all(s.node.elements.map(l=>Lo({element:l,meta:e},t,i)))),s.elements&&(a.elements=await Promise.all(s.elements.map(l=>Lo({element:l,meta:e},t,i)))),a}function sr(s,e=[]){var t;for(const i of e){if(((t=i==null?void 0:i.node)==null?void 0:t.type)===s)return i.node;const r=sr(s,i==null?void 0:i.elements);if(r)return r}}function pf(s,e){return s.reduce((t,i,r)=>[...t,i.map((n,o)=>n.map(({duration:a},A)=>r===s.length-1&&o===i.length-1&&A===n.length-1?a:a-e))],[])}function Ef(s){if(s===null||typeof s!="object")return!1;if(Object.getPrototypeOf(s)===null)return!0;let e=s;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(s)===e}function If(s){return s.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}function en(s){return s.flatMap(e=>Array.isArray(e)?e.flatMap(t=>t):e).reduce((e,t)=>e+t,0)}const mf=$t(()=>Il.loadYoga());Co.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${If(s)}"`:Ef(s)||Array.isArray(s)?JSON.stringify(s):s);const ds=(s,e,t)=>Co.render(s,e,Co.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function Cf({data:s,template:e,meta:t,intro:i,outro:r,options:n},o,a,A){return await Promise.all(e.content.map(async({scenes:l,root:c})=>{const u={...n,...s,intro:i,outro:r};async function h(d,g){return Promise.all(l.map(async({layout:f,duration:p,data:v,derived:y,options:Q})=>{var m,b,x;const B={...u,_index:g,_root:d,_derived:await o({data:s,rootData:d,index:g})},H=v?JSON.parse(await ds(v,B)):{},_=y?JSON.parse(await ds(y,B)):{},k=Q?JSON.parse(await ds(Q,B)):{},U=p?parseFloat(await ds(p,B)):NaN,q=(m=e.layouts.find(O=>O.name===f))==null?void 0:m.tree;if(!q)throw new Error(`Layout tree "${f}" not found in template "${e.id}" layouts.`);const V=JSON.parse(await ds(q,{...H,..._,...k})),Z=await Promise.all(V.flatMap(O=>Lo({element:O,meta:t},a,A))),S=sr("video",Z);return{duration:(isNaN(U)?null:U)??((b=S==null?void 0:S.meta)==null?void 0:b.duration)??0,captions:(x=S==null?void 0:S.meta)==null?void 0:x.captions,elements:Z}}))}if(c){const d=JSON.parse(await ds(c,u));return Array.isArray(d)?Promise.all(d.map(async(g,f)=>h(g,f))):Promise.all([h(d,null)])}return Promise.all([h(s,null)])}))}async function tn(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>zh),e=new s.Canvas;return e.gpu=!1,e}return document.createElement("canvas")}async function gs({data:s,template:e,debug:t=!1},i,r,n){var o,a,A,l;const c=await mf(),u=e??gf;if(!((o=u.templates)!=null&&o.length))throw new Error(`No templates found for template instance: ${u.id}`);let h=u.templates.find(({version:_})=>_===_o);if(!h){const _=u.templates.map(({version:k})=>`"${k}"`).join(", ");console.warn(`Template renderer expects template version "${_o}" but got ${_}`),h=u.templates[u.templates.length-1]}const d=await Cf({data:s,template:h,meta:u.meta,intro:u.intro,outro:u.outro,options:u.options},i,r,n);if(d.every(_=>_.every(k=>k.every(U=>{const q=sr("video",U.elements);return!(q!=null&&q.value.src)&&!(q!=null&&q.value.playlist)})))){const _=d.flatMap(k=>k.flatMap(U=>U.map(q=>{const V=sr("video",q.elements);return!(V!=null&&V.value.src)&&!(V!=null&&V.value.playlist)&&(V==null?void 0:V.value.id)}).filter(Boolean))).join(", ");throw new Error(`Video(s) with ID ${_} failed to load, video can not be processed`)}if(d.every(_=>_.every(k=>k.every(U=>U.duration<=0))))throw new Error("No scenes have any duration, video can not be processed");const p=d.reduce((_,k)=>{const U=k.reduce((q,V)=>{const Z=V.filter(S=>S.duration>0);return Z.length>0?[...q,Z]:q},[]);return U.length>0?[..._,U]:_},[]),v=((a=u.meta)==null?void 0:a.frameRate)??30,y=((A=u.meta)==null?void 0:A.resolution)??1080,Q=((l=u.meta)==null?void 0:l.transitionDuration)??1/3,m=pf(p,Q),b=en(m),x=await Promise.all(p.map((_,k)=>{const U=en(m[k]),q=en(m.slice(0,k));return Promise.all(_.map((V,Z)=>Promise.all(V.map(async({duration:S,elements:T},O)=>{var R,w;const L=await tn(),K=await tn(),G=await tn(),j=await tn(),te=sr("video",T),ue=en([...m.slice(0,k),...m[k].slice(0,Z),...m[k][Z].slice(0,O)]);return{draw:({canvas:me,currentTime:Qe})=>{var xe;const ae=Math.max(0,Qe-q),Ie=Math.max(0,Qe-ue);Do({yoga:c,debug:t,canvas:me,cropCanvas:L,posterCanvas:j,letterboxCanvas:K,elements:T,currentTime:Qe,contentTime:ae,sceneTime:Ie,sceneStart:((xe=te==null?void 0:te.meta)==null?void 0:xe.start)??0,totalDuration:b,contentDuration:U,sceneDuration:S})},duration:S,transitionCanvas:G,id:df(),start:ue,video:te==null?void 0:te.video,videoMeta:te==null?void 0:te.meta,audio:{duration:S,src:(R=te==null?void 0:te.value)==null?void 0:R.src,start:(w=te==null?void 0:te.meta)==null?void 0:w.start}}}))))})),B=x.flatMap(_=>_);return{scenes:B.flatMap(_=>_),sections:B,contents:x,frameRate:v,resolution:y,transitionDuration:Q,fonts:(h==null?void 0:h.fonts)??[],duration:b}}const _o="3",vf={name:"@vouchfor/embeds",version:"0.0.0-experiment.108d575",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"experiment",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js","test:watch":"yarn test --watch"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/canvas-video":"0.0.0-experiment.108d575","@vouchfor/media-player":"0.0.0-experiment.108d575",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.0.4","@storybook/addon-links":"^8.0.4","@storybook/blocks":"^8.0.4","@storybook/web-components":"^8.0.4","@storybook/web-components-vite":"^8.0.4","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.6","@vouchfor/eslint-config":"^1.0.1","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"0.0.0-experiment.108d575","@web/dev-server-esbuild":"^1.0.2","@web/test-runner":"^0.18.1","@web/test-runner-browserstack":"^0.7.1","@web/test-runner-mocha":"^0.9.0","@web/test-runner-playwright":"^0.11.0",glob:"^10.3.10","lint-staged":"^15.2.2",lit:"^3.1.2",lodash:"^4.17.21",react:"^18.2.0","react-dom":"^18.2.0","rollup-plugin-tla":"^0.0.2",sinon:"^17.0.1",storybook:"^8.0.4",svgson:"^5.3.1",typescript:"^5.4.3",vite:"^5.2.2","vite-plugin-commonjs":"^0.10.1","vite-plugin-dts":"^3.7.3","web-component-analyzer":"^2.0.0"}};function yf(s){const{publicApiUrl:e}=kr(s),t=_i();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function Bf(s){var n,o,a,A,l,c,u,h,d,g,f,p;if(typeof window>"u")return{client:null,tab:null,request:_i()};let e=(o=(n=window.localStorage)==null?void 0:n.getItem)==null?void 0:o.call(n,"vouch-uid-visitor"),t=(A=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:A.call(a,"vouch-uid-client"),i=(c=(l=window.sessionStorage)==null?void 0:l.getItem)==null?void 0:c.call(l,"vouch-uid-tab");const r=_i();return e||(e=yf(s),(h=(u=window.localStorage)==null?void 0:u.setItem)==null||h.call(u,"vouch-uid-visitor",e)),t||(t=_i(),(g=(d=window.localStorage)==null?void 0:d.setItem)==null||g.call(d,"vouch-uid-client",t)),i||(i=_i(),(p=(f=window.sessionStorage)==null?void 0:f.setItem)==null||p.call(f,"vouch-uid-tab",i)),{client:t,tab:i,request:r,visitor:e}}function Qf(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function bf(s="embedded_player"){var r,n;const[e,t]=((n=(r=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:r.split)==null?void 0:n.call(r,"/"))??[],i={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const A=o.toLowerCase().replace(/[-_][a-z0-9]/g,l=>l.slice(-1).toUpperCase());i[A]=a}}),{source:s,time:new Date,region:t,country:e,screenHeight:window.screen.height,screenWidth:window.screen.width,referrer:document.referrer,currentUrl:location.href,embedType:"media-player-embed",embedVersion:vf.version,templateVersion:_o,...i}}const Ml=1;class Sf{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=Qf(i,this.host.vouch);!r||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...i,vouchId:r,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=kr(this.host.env),{client:i,tab:r,request:n,visitor:o}=Bf(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":i,"x-uid-tab":r,"x-uid-request":n,"x-uid-visitor":o,"x-reporting-metadata":bf(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Ml&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]}},this._handleVouchLoaded=({detail:t})=>{t&&(this._hasLoaded[t]||(this._createTrackingEvent("VOUCH_LOADED",{vouchId:t}),this._hasLoaded[t]=!0))},this._handlePlay=()=>{this._hasPlayed||(this._createTrackingEvent("VIDEO_PLAYED",{streamStart:this.host.currentTime}),this._hasPlayed=!0)},this._handleVideoPlay=({detail:{id:t,key:i}})=>{this._answersViewed[i]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[i]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:i,node:r}})=>{var n,o;!this.host.paused&&t===((o=(n=this.host.scene)==null?void 0:n.video)==null?void 0:o.id)&&(this._currentlyPlayingVideo={id:t,key:i,node:r},this._streamLatestTime[i]=r.currentTime,this._streamStartTime[i]||(this._streamStartTime[i]=r.currentTime,this._streamLatestTime[i]=r.currentTime))},this._handleVideoPause=({detail:{id:t,key:i}})=>{this._streamLatestTime[i]>this._streamStartTime[i]+Ml&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[i],streamEnd:this._streamLatestTime[i]}),delete this._streamStartTime[i],delete this._streamLatestTime[i]},this._pageUnloading=()=>{this._streamEnded(),this._sendTrackingEvent()},this._handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this._pageUnloading()},this._handlePageHide=()=>{this._pageUnloading()},this.host=e,e.addController(this)}hostConnected(){requestAnimationFrame(()=>{var e,t,i,r;"onvisibilitychange"in document?document.addEventListener("visibilitychange",this._handleVisibilityChange):window.addEventListener("pagehide",this._handlePageHide),this.host.addEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.addEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.addEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.addEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,i,r;this._pageUnloading(),"onvisibilitychange"in document?document.removeEventListener("visibilitychange",this._handleVisibilityChange):window.removeEventListener("pagehide",this._handlePageHide),this.host.removeEventListener("vouch:loaded",this._handleVouchLoaded),(e=this.host.mediaPlayer)==null||e.removeEventListener("play",this._handlePlay),(t=this.host.mediaPlayer)==null||t.removeEventListener("video:play",this._handleVideoPlay),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:pause",this._handleVideoPause),(r=this.host.mediaPlayer)==null||r.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var ko={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Gr<"u"&&Gr,i=function(){function n(){this.fetch=!1,this.DOMException=t.DOMException}return n.prototype=t,new n}();(function(n){(function(o){var a=typeof n<"u"&&n||typeof self<"u"&&self||typeof a<"u"&&a,A={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function l(S){return S&&DataView.prototype.isPrototypeOf(S)}if(A.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(S){return S&&c.indexOf(Object.prototype.toString.call(S))>-1};function h(S){if(typeof S!="string"&&(S=String(S)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(S)||S==="")throw new TypeError('Invalid character in header field name: "'+S+'"');return S.toLowerCase()}function d(S){return typeof S!="string"&&(S=String(S)),S}function g(S){var T={next:function(){var O=S.shift();return{done:O===void 0,value:O}}};return A.iterable&&(T[Symbol.iterator]=function(){return T}),T}function f(S){this.map={},S instanceof f?S.forEach(function(T,O){this.append(O,T)},this):Array.isArray(S)?S.forEach(function(T){this.append(T[0],T[1])},this):S&&Object.getOwnPropertyNames(S).forEach(function(T){this.append(T,S[T])},this)}f.prototype.append=function(S,T){S=h(S),T=d(T);var O=this.map[S];this.map[S]=O?O+", "+T:T},f.prototype.delete=function(S){delete this.map[h(S)]},f.prototype.get=function(S){return S=h(S),this.has(S)?this.map[S]:null},f.prototype.has=function(S){return this.map.hasOwnProperty(h(S))},f.prototype.set=function(S,T){this.map[h(S)]=d(T)},f.prototype.forEach=function(S,T){for(var O in this.map)this.map.hasOwnProperty(O)&&S.call(T,this.map[O],O,this)},f.prototype.keys=function(){var S=[];return this.forEach(function(T,O){S.push(O)}),g(S)},f.prototype.values=function(){var S=[];return this.forEach(function(T){S.push(T)}),g(S)},f.prototype.entries=function(){var S=[];return this.forEach(function(T,O){S.push([O,T])}),g(S)},A.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function p(S){if(S.bodyUsed)return Promise.reject(new TypeError("Already read"));S.bodyUsed=!0}function v(S){return new Promise(function(T,O){S.onload=function(){T(S.result)},S.onerror=function(){O(S.error)}})}function y(S){var T=new FileReader,O=v(T);return T.readAsArrayBuffer(S),O}function Q(S){var T=new FileReader,O=v(T);return T.readAsText(S),O}function m(S){for(var T=new Uint8Array(S),O=new Array(T.length),R=0;R<T.length;R++)O[R]=String.fromCharCode(T[R]);return O.join("")}function b(S){if(S.slice)return S.slice(0);var T=new Uint8Array(S.byteLength);return T.set(new Uint8Array(S)),T.buffer}function x(){return this.bodyUsed=!1,this._initBody=function(S){this.bodyUsed=this.bodyUsed,this._bodyInit=S,S?typeof S=="string"?this._bodyText=S:A.blob&&Blob.prototype.isPrototypeOf(S)?this._bodyBlob=S:A.formData&&FormData.prototype.isPrototypeOf(S)?this._bodyFormData=S:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)?this._bodyText=S.toString():A.arrayBuffer&&A.blob&&l(S)?(this._bodyArrayBuffer=b(S.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(S)||u(S))?this._bodyArrayBuffer=b(S):this._bodyText=S=Object.prototype.toString.call(S):this._bodyText="",this.headers.get("content-type")||(typeof S=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):A.searchParams&&URLSearchParams.prototype.isPrototypeOf(S)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var S=p(this);if(S)return S;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var S=p(this);return S||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(y)}),this.text=function(){var S=p(this);if(S)return S;if(this._bodyBlob)return Q(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(m(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},A.formData&&(this.formData=function(){return this.text().then(k)}),this.json=function(){return this.text().then(JSON.parse)},this}var B=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function H(S){var T=S.toUpperCase();return B.indexOf(T)>-1?T:S}function _(S,T){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');T=T||{};var O=T.body;if(S instanceof _){if(S.bodyUsed)throw new TypeError("Already read");this.url=S.url,this.credentials=S.credentials,T.headers||(this.headers=new f(S.headers)),this.method=S.method,this.mode=S.mode,this.signal=S.signal,!O&&S._bodyInit!=null&&(O=S._bodyInit,S.bodyUsed=!0)}else this.url=String(S);if(this.credentials=T.credentials||this.credentials||"same-origin",(T.headers||!this.headers)&&(this.headers=new f(T.headers)),this.method=H(T.method||this.method||"GET"),this.mode=T.mode||this.mode||null,this.signal=T.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&O)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(O),(this.method==="GET"||this.method==="HEAD")&&(T.cache==="no-store"||T.cache==="no-cache")){var R=/([?&])_=[^&]*/;if(R.test(this.url))this.url=this.url.replace(R,"$1_="+new Date().getTime());else{var w=/\?/;this.url+=(w.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})};function k(S){var T=new FormData;return S.trim().split("&").forEach(function(O){if(O){var R=O.split("="),w=R.shift().replace(/\+/g," "),L=R.join("=").replace(/\+/g," ");T.append(decodeURIComponent(w),decodeURIComponent(L))}}),T}function U(S){var T=new f,O=S.replace(/\r?\n[\t ]+/g," ");return O.split("\r").map(function(R){return R.indexOf(`
153
+ `)===0?R.substr(1,R.length):R}).forEach(function(R){var w=R.split(":"),L=w.shift().trim();if(L){var K=w.join(":").trim();T.append(L,K)}}),T}x.call(_.prototype);function q(S,T){if(!(this instanceof q))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');T||(T={}),this.type="default",this.status=T.status===void 0?200:T.status,this.ok=this.status>=200&&this.status<300,this.statusText=T.statusText===void 0?"":""+T.statusText,this.headers=new f(T.headers),this.url=T.url||"",this._initBody(S)}x.call(q.prototype),q.prototype.clone=function(){return new q(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},q.error=function(){var S=new q(null,{status:0,statusText:""});return S.type="error",S};var V=[301,302,303,307,308];q.redirect=function(S,T){if(V.indexOf(T)===-1)throw new RangeError("Invalid status code");return new q(null,{status:T,headers:{location:S}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(T,O){this.message=T,this.name=O;var R=Error(T);this.stack=R.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function Z(S,T){return new Promise(function(O,R){var w=new _(S,T);if(w.signal&&w.signal.aborted)return R(new o.DOMException("Aborted","AbortError"));var L=new XMLHttpRequest;function K(){L.abort()}L.onload=function(){var j={status:L.status,statusText:L.statusText,headers:U(L.getAllResponseHeaders()||"")};j.url="responseURL"in L?L.responseURL:j.headers.get("X-Request-URL");var te="response"in L?L.response:L.responseText;setTimeout(function(){O(new q(te,j))},0)},L.onerror=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},L.ontimeout=function(){setTimeout(function(){R(new TypeError("Network request failed"))},0)},L.onabort=function(){setTimeout(function(){R(new o.DOMException("Aborted","AbortError"))},0)};function G(j){try{return j===""&&a.location.href?a.location.href:j}catch{return j}}L.open(w.method,G(w.url),!0),w.credentials==="include"?L.withCredentials=!0:w.credentials==="omit"&&(L.withCredentials=!1),"responseType"in L&&(A.blob?L.responseType="blob":A.arrayBuffer&&w.headers.get("Content-Type")&&w.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(L.responseType="arraybuffer")),T&&typeof T.headers=="object"&&!(T.headers instanceof f)?Object.getOwnPropertyNames(T.headers).forEach(function(j){L.setRequestHeader(j,d(T.headers[j]))}):w.headers.forEach(function(j,te){L.setRequestHeader(te,j)}),w.signal&&(w.signal.addEventListener("abort",K),L.onreadystatechange=function(){L.readyState===4&&w.signal.removeEventListener("abort",K)}),L.send(typeof w._bodyInit>"u"?null:w._bodyInit)})}return Z.polyfill=!0,a.fetch||(a.fetch=Z,a.Headers=f,a.Request=_,a.Response=q),o.Headers=f,o.Request=_,o.Response=q,o.fetch=Z,o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,s.exports=e})(ko,ko.exports);var wf=ko.exports;const Pl=El(wf);async function Rf(s){var e;try{if((e=await Pl(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function Fo({sources:s}){let e=null;const t=s==null?void 0:s.filter(Boolean),i=t==null?void 0:t.find(n=>n.startsWith("blob:")),r=t==null?void 0:t.find(n=>!n.startsWith("http")&&!n.startsWith("blob:"));if(i||r)return i??r;if(t.length>0){const n=t.map(o=>Rf(o));e=(await Promise.all(n)).find(Boolean)}return e}async function xf(s){try{return(await Pl(s)).text()}catch{return null}}async function Tf(s){return s=s.trim(),s.startsWith("http")||s.startsWith("blob:")?xf(s):s}const Df=$t(async({original:s,translation:e,originalLanguage:t="",translationLanguage:i=""},{language:r})=>{var n,o;const a={[(n=i==null?void 0:i.split("-"))==null?void 0:n[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:s},A=(r&&a[r])??s;return A?Tf(A):null},{cacheKey:([s,{language:e}])=>JSON.stringify({...s,language:e})});function Lf(s){var e;return((e=s==null?void 0:s.items)==null?void 0:e.map(t=>{var i;return{text:(i=t.alternatives[0])==null?void 0:i.content,start:t.start_time,end:t.end_time}}))??[]}const _f=$t(async s=>{var e,t,i,r,n,o,a,A,l,c,u;const[h,d,g]=await Promise.all([Fo({sources:[(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.video,(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.input]}),Fo({sources:[(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist]}),Fo({sources:[((A=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:A.reducedQuality)??((u=(c=(l=s==null?void 0:s.answer)==null?void 0:l.media)==null?void 0:c.videos)==null?void 0:u.xs)]})]);return{src:h,playlist:d,preview:g}},{cacheKey:([s])=>{var e,t,i,r,n,o,a,A,l,c,u;return JSON.stringify({video:(t=(e=s==null?void 0:s.answer)==null?void 0:e.media)==null?void 0:t.video,input:(r=(i=s==null?void 0:s.answer)==null?void 0:i.media)==null?void 0:r.input,playlist:(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist,preview:((A=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:A.reducedQuality)??((u=(c=(l=s==null?void 0:s.answer)==null?void 0:l.media)==null?void 0:c.videos)==null?void 0:u.xs)})}});function kf(s){var e,t,i,r,n,o,a,A,l,c,u,h;const d=((t=(e=s==null?void 0:s.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((n=(r=(i=s==null?void 0:s.answer)==null?void 0:i.contact)==null?void 0:r.name)==null?void 0:n.trim())??"",g=((A=(a=(o=s==null?void 0:s.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:A.name)==="Not Supplied"?"":((h=(u=(c=(l=s==null?void 0:s.answer)==null?void 0:l.contact)==null?void 0:c.client)==null?void 0:u.name)==null?void 0:h.trim())??"",[f,p]=d.split(" ");return{name:d,firstName:f,lastName:p,companyName:g}}const Ff=$t(async(s,e,t)=>{var i,r,n;const o=(i=e==null?void 0:e.answer)==null?void 0:i.id;return((n=(r=s==null?void 0:s.questions)==null?void 0:r.items)==null?void 0:n.reduce((A,l)=>{var c;return((c=l==null?void 0:l.answer)==null?void 0:c.id)===o?(A??0)+1:A},0))<=1?o:`${o}-${t}`},{cacheKey:([s,e,t])=>{var i;return JSON.stringify({index:t,rootData:e,allQuestions:(i=s==null?void 0:s.questions)==null?void 0:i.items})}});async function No({data:s,rootData:e,index:t},i){var r,n,o,a,A,l,c,u,h,d,g,f,p,v,y;const[Q,m,b]=await Promise.all([Ff(s,e,t),_f(e),Df({original:((n=(r=e==null?void 0:e.answer)==null?void 0:r.media)==null?void 0:n.captions)??((a=(o=e==null?void 0:e.answer)==null?void 0:o.captions)==null?void 0:a.current),translation:((l=(A=e==null?void 0:e.answer)==null?void 0:A.media)==null?void 0:l.translation)??((u=(c=e==null?void 0:e.answer)==null?void 0:c.captions)==null?void 0:u.translation),originalLanguage:(d=(h=e==null?void 0:e.answer)==null?void 0:h.transcription)==null?void 0:d.language,translationLanguage:(p=(f=(g=e==null?void 0:e.answer)==null?void 0:g.transcription)==null?void 0:f.translation)==null?void 0:p.language},i)]);return{...m,...kf(e),key:Q,captions:b,wordTimings:Lf((v=e==null?void 0:e.answer)==null?void 0:v.transcription),answerLabel:((y=e==null?void 0:e.answer)==null?void 0:y.label)??(e==null?void 0:e.title)}}const sn={af:"Afrikaans",sq:"Albanian",am:"Amharic",ar:"Arabic",hy:"Armenian",az:"Azerbaijani",eu:"Basque",be:"Belarusian",bn:"Bengali",bs:"Bosnian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese (Simplified)",zh_TW:"Chinese (Traditional)",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fi:"Finnish",fr:"French",fa:"Farsi",tl:"Filipino",ka:"Georgian",de:"German",el:"Greek",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",kn:"Kannada",kk:"Kazakh",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",ml:"Malayalam",mt:"Maltese",mr:"Marathi",mn:"Mongolian",no:"Norwegian",ps:"Pashto",pl:"Polish",pt:"Portuguese",pa:"Punjabi",ro:"Romanian",ru:"Russian",sr:"Serbian",si:"Sinhala",sk:"Slovak",sl:"Slovenian",so:"Somali",es:"Spanish",sw:"Swahili",sv:"Swedish",ta:"Tamil",te:"Telugu",th:"Thai",tr:"Turkish",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",vi:"Vietnamese",cy:"Welsh"};function Nf({data:s}){var e,t;return((t=(e=s==null?void 0:s.questions)==null?void 0:e.items)==null?void 0:t.reduce((i,r)=>{var n,o,a,A,l,c,u;const h=(a=(o=(n=r==null?void 0:r.answer)==null?void 0:n.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(u=(c=(l=(A=r==null?void 0:r.answer)==null?void 0:A.transcription)==null?void 0:l.translation)==null?void 0:c.language)==null?void 0:u.split("-")[0];return h&&sn[h]&&!i.find(g=>g.value===h)&&i.push({value:h,label:sn[h]}),d&&sn[d]&&!i.find(g=>g.value===d)&&i.push({value:d,label:sn[d]}),i},[]))??[]}/**
150
154
  * @license
151
155
  * Copyright 2018 Google LLC
152
156
  * SPDX-License-Identifier: BSD-3-Clause
153
- */const Ue=os(class extends Vs{constructor(s){var e;if(super(s),s.type!==ns.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var i,r;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(const n in e)e[n]&&!((i=this.nt)!=null&&i.has(n))&&this.st.add(n);return this.render(e)}const t=s.element.classList;for(const n of this.st)n in e||(t.remove(n),this.st.delete(n));for(const n in e){const o=!!e[n];o===this.st.has(n)||(r=this.nt)!=null&&r.has(n)||(o?(t.add(n),this.st.add(n)):(t.remove(n),this.st.delete(n)))}return Gt}});/**
157
+ */const $e=us(class extends Ws{constructor(s){var e;if(super(s),s.type!==cs.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var i,r;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(n=>n!=="")));for(const n in e)e[n]&&!((i=this.nt)!=null&&i.has(n))&&this.st.add(n);return this.render(e)}const t=s.element.classList;for(const n of this.st)n in e||(t.remove(n),this.st.delete(n));for(const n in e){const o=!!e[n];o===this.st.has(n)||(r=this.nt)!=null&&r.has(n)||(o?(t.add(n),this.st.add(n)):(t.remove(n),this.st.delete(n)))}return Ht}});/**
154
158
  * @license
155
159
  * Copyright 2018 Google LLC
156
160
  * SPDX-License-Identifier: BSD-3-Clause
157
- */const Ql="important",uf=" !"+Ql,zs=os(class extends Vs{constructor(s){var e;if(super(s),s.type!==ns.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ft.add(i);const n=typeof r=="string"&&r.endsWith(uf);i.includes("-")||n?t.setProperty(i,n?r.slice(0,-11):r,n?Ql:""):t[i]=r}}return Gt}});var vl=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function df(s,e){return!!(s===e||vl(s)&&vl(e))}function gf(s,e){if(s.length!==e.length)return!1;for(var t=0;t<s.length;t++)if(!df(s[t],e[t]))return!1;return!0}function wl(s,e){e===void 0&&(e=gf);var t=null;function i(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t&&t.lastThis===this&&e(r,t.lastArgs))return t.lastResult;var o=s.apply(this,r);return t={lastResult:o,lastArgs:r,lastThis:this},o}return i.clear=function(){t=null},i}function ff(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Sl={exports:{}};(function(s,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(A,l,c){if(c=c||{},A=A.trim(),l=l.trim(),!l){if(!c.alwaysNormalize)return A;var h=a.parseURL(A);if(!h)throw new Error("Error trying to parse base URL.");return h.path=a.normalizePath(h.path),a.buildURLFromParts(h)}var u=a.parseURL(l);if(!u)throw new Error("Error trying to parse relative URL.");if(u.scheme)return c.alwaysNormalize?(u.path=a.normalizePath(u.path),a.buildURLFromParts(u)):l;var d=a.parseURL(A);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var g=r.exec(d.path);d.netLoc=g[1],d.path=g[2]}d.netLoc&&!d.path&&(d.path="/");var f={scheme:d.scheme,netLoc:u.netLoc,path:null,params:u.params,query:u.query,fragment:u.fragment};if(!u.netLoc&&(f.netLoc=d.netLoc,u.path[0]!=="/"))if(!u.path)f.path=d.path,u.params||(f.params=d.params,u.query||(f.query=d.query));else{var E=d.path,B=E.substring(0,E.lastIndexOf("/")+1)+u.path;f.path=a.normalizePath(B)}return f.path===null&&(f.path=c.alwaysNormalize?a.normalizePath(u.path):u.path),a.buildURLFromParts(f)},parseURL:function(A){var l=i.exec(A);return l?{scheme:l[1]||"",netLoc:l[2]||"",path:l[3]||"",params:l[4]||"",query:l[5]||"",fragment:l[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(n,"");A.length!==(A=A.replace(o,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};s.exports=a})()})(Sl);var mo=Sl.exports;function Dl(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(s,r).enumerable})),t.push.apply(t,i)}return t}function At(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Dl(Object(t),!0).forEach(function(i){If(s,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):Dl(Object(t)).forEach(function(i){Object.defineProperty(s,i,Object.getOwnPropertyDescriptor(t,i))})}return s}function Ef(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var i=t.call(s,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function pf(s){var e=Ef(s,"string");return typeof e=="symbol"?e:String(e)}function If(s,e,t){return e=pf(e),e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function Ze(){return Ze=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},Ze.apply(this,arguments)}const Ae=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},Cf=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=mf},mf=Number.MAX_SAFE_INTEGER||9007199254740991;let p=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",s}({}),Ie=function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s}({}),$=function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.UNKNOWN="unknown",s}({});const Vi=function(){},Bo={trace:Vi,debug:Vi,log:Vi,warn:Vi,info:Vi,error:Vi};let er=Bo;function Bf(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):Vi}function yf(s,...e){e.forEach(function(t){er[t]=s[t]?s[t].bind(s):Bf(t)})}function Qf(s,e){if(typeof console=="object"&&s===!0||typeof s=="object"){yf(s,"debug","log","info","warn","error");try{er.log(`Debug logs enabled for "${e}" in hls.js version 1.5.7`)}catch{er=Bo}}else er=Bo}const _=er,vf=/^(\d+)x(\d+)$/,bl=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ve{constructor(e){typeof e=="string"&&(e=Ve.parseAttrList(e)),Ze(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(r*2,r*2+2),16);return i}else return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=vf.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={},r='"';for(bl.lastIndex=0;(t=bl.exec(e))!==null;){let n=t[2];n.indexOf(r)===0&&n.lastIndexOf(r)===n.length-1&&(n=n.slice(1,-1));const o=t[1].trim();i[o]=n}return i}}function wf(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function Sf(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class Rl{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const r in i)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==i[r]){_.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=Ze(new Ve({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=new Date(this.attr["END-DATE"]);Ae(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(Ae(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&Ae(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Yr{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var _e={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class xl{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[_e.AUDIO]:null,[_e.VIDEO]:null,[_e.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let r;i.length===1?r=(t==null?void 0:t.byteRangeEndOffset)||0:r=parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=mo.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class yo extends xl{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new Yr,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!Ae(this.programDateTime))return null;const e=Ae(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,r,n,o=!1){const{elementaryStreams:a}=this,A=a[e];if(!A){a[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:o};return}A.startPTS=Math.min(A.startPTS,t),A.endPTS=Math.max(A.endPTS,i),A.startDTS=Math.min(A.startDTS,r),A.endDTS=Math.max(A.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[_e.AUDIO]=null,e[_e.VIDEO]=null,e[_e.AUDIOVIDEO]=null}}class Df extends xl{constructor(e,t,i,r,n){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new Yr,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,n),n&&(this.fragOffset=n.fragOffset+n.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}const bf=10;class Rf{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?Ae(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||bf}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Qo(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function xf(s){const e=vo(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Tf(s){const e=function(i,r,n){const o=i[r];i[r]=i[n],i[n]=o};e(s,0,3),e(s,1,2),e(s,4,5),e(s,6,7)}function Lf(s){const e=s.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),r=i[i.length-1].split(",");if(r.length===2){const n=r[0]==="base64",o=r[1];n?(i.splice(-1,1),t=Qo(o)):t=xf(o)}}return t}function vo(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}const us=typeof self<"u"?self:void 0;var He={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Qt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Tl(s){switch(s){case Qt.FAIRPLAY:return He.FAIRPLAY;case Qt.PLAYREADY:return He.PLAYREADY;case Qt.WIDEVINE:return He.WIDEVINE;case Qt.CLEARKEY:return He.CLEARKEY}}var Ll={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function kf(s){if(s===Ll.WIDEVINE)return He.WIDEVINE}function kl(s){switch(s){case He.FAIRPLAY:return Qt.FAIRPLAY;case He.PLAYREADY:return Qt.PLAYREADY;case He.WIDEVINE:return Qt.WIDEVINE;case He.CLEARKEY:return Qt.CLEARKEY}}function wo(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[He.FAIRPLAY,He.WIDEVINE,He.PLAYREADY,He.CLEARKEY].filter(r=>!!e[r]):[];return!i[He.WIDEVINE]&&t&&i.push(He.WIDEVINE),i}const Ml=function(s){return us!=null&&(s=us.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Mf(s,e,t,i){let r;switch(s){case He.FAIRPLAY:r=["cenc","sinf"];break;case He.WIDEVINE:case He.PLAYREADY:r=["cenc"];break;case He.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return _f(r,e,t,i)}function _f(s,e,t,i){return[{initDataTypes:s,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function Ji(s,e,t){return Uint8Array.prototype.slice?s.slice(e,t):new Uint8Array(Array.prototype.slice.call(s,e,t))}const So=(s,e)=>e+10<=s.length&&s[e]===73&&s[e+1]===68&&s[e+2]===51&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,_l=(s,e)=>e+10<=s.length&&s[e]===51&&s[e+1]===68&&s[e+2]===73&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,tr=(s,e)=>{const t=e;let i=0;for(;So(s,e);){i+=10;const r=Vr(s,e+6);i+=r,_l(s,e+10)&&(i+=10),e+=i}if(i>0)return s.subarray(t,t+i)},Vr=(s,e)=>{let t=0;return t=(s[e]&127)<<21,t|=(s[e+1]&127)<<14,t|=(s[e+2]&127)<<7,t|=s[e+3]&127,t},Ff=(s,e)=>So(s,e)&&Vr(s,e+6)+10<=s.length-e,Do=s=>{const e=Ol(s);for(let t=0;t<e.length;t++){const i=e[t];if(Fl(i))return Hf(i)}},Fl=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",Of=s=>{const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=Vr(s,4),i=10;return{type:e,size:t,data:s.subarray(i,i+t)}},Ol=s=>{let e=0;const t=[];for(;So(s,e);){const i=Vr(s,e+6);e+=10;const r=e+i;for(;e+8<r;){const n=Of(s.subarray(e)),o=Nf(n);o&&t.push(o),e+=n.size+10}_l(s,e)&&(e+=10)}return t},Nf=s=>s.type==="PRIV"?Uf(s):s.type[0]==="W"?Gf(s):Pf(s),Uf=s=>{if(s.size<2)return;const e=Zt(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},Pf=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=Zt(s.data.subarray(t),!0);t+=i.length+1;const r=Zt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Zt(s.data.subarray(1));return{key:s.type,data:e}},Gf=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=Zt(s.data.subarray(t),!0);t+=i.length+1;const r=Zt(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=Zt(s.data);return{key:s.type,data:e}},Hf=s=>{if(s.data.byteLength===8){const e=new Uint8Array(s.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}},Zt=(s,e=!1)=>{const t=$f();if(t){const l=t.decode(s);if(e){const c=l.indexOf("\0");return c!==-1?l.substring(0,c):l}return l.replace(/\0/g,"")}const i=s.length;let r,n,o,a="",A=0;for(;A<i;){if(r=s[A++],r===0&&e)return a;if(r===0||r===3)continue;switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(r);break;case 12:case 13:n=s[A++],a+=String.fromCharCode((r&31)<<6|n&63);break;case 14:n=s[A++],o=s[A++],a+=String.fromCharCode((r&15)<<12|(n&63)<<6|(o&63)<<0);break}}return a};let bo;function $f(){if(!navigator.userAgent.includes("PlayStation 4"))return!bo&&typeof self.TextDecoder<"u"&&(bo=new self.TextDecoder("utf-8")),bo}const zt={hexDump:function(s){let e="";for(let t=0;t<s.length;t++){let i=s[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}},Jr=Math.pow(2,32)-1,Kf=[].push,Nl={video:1,audio:2,id3:3,text:4};function rt(s){return String.fromCharCode.apply(null,s)}function Ul(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function ge(s,e){const t=Gl(s,e);return t<0?4294967296+t:t}function Pl(s,e){let t=ge(s,e);return t*=Math.pow(2,32),t+=ge(s,e+4),t}function Gl(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function Ro(s,e,t){s[e]=t>>24,s[e+1]=t>>16&255,s[e+2]=t>>8&255,s[e+3]=t&255}function Yf(s){const e=s.byteLength;for(let t=0;t<e;){const i=ge(s,t);if(i>8&&s[t+4]===109&&s[t+5]===111&&s[t+6]===111&&s[t+7]===102)return!0;t=i>1?t+i:e}return!1}function me(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let r=0;r<i;){const n=ge(s,r),o=rt(s.subarray(r+4,r+8)),a=n>1?r+n:i;if(o===e[0])if(e.length===1)t.push(s.subarray(r+8,a));else{const A=me(s.subarray(r+8,a),e.slice(1));A.length&&Kf.apply(t,A)}r=a}return t}function Vf(s){const e=[],t=s[0];let i=8;const r=ge(s,i);i+=4;let n=0,o=0;t===0?(n=ge(s,i),o=ge(s,i+4),i+=8):(n=Pl(s,i),o=Pl(s,i+8),i+=16),i+=2;let a=s.length+o;const A=Ul(s,i);i+=2;for(let l=0;l<A;l++){let c=i;const h=ge(s,c);c+=4;const u=h&2147483647;if((h&2147483648)>>>31===1)return _.warn("SIDX has hierarchical references (not supported)"),null;const g=ge(s,c);c+=4,e.push({referenceSize:u,subsegmentDuration:g,info:{duration:g/r,start:a,end:a+u-1}}),a+=u,c+=4,i=c}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:A,references:e}}function Hl(s){const e=[],t=me(s,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],o=me(n,["tkhd"])[0];if(o){let a=o[0];const A=ge(o,a===0?12:20),l=me(n,["mdia","mdhd"])[0];if(l){a=l[0];const c=ge(l,a===0?12:20),h=me(n,["mdia","hdlr"])[0];if(h){const u=rt(h.subarray(8,12)),d={soun:_e.AUDIO,vide:_e.VIDEO}[u];if(d){const g=me(n,["mdia","minf","stbl","stsd"])[0],f=Jf(g);e[A]={timescale:c,type:d},e[d]=At({timescale:c,id:A},f)}}}}}return me(s,["moov","mvex","trex"]).forEach(r=>{const n=ge(r,4),o=e[n];o&&(o.default={duration:ge(r,12),flags:ge(r,20)})}),e}function Jf(s){const e=s.subarray(8),t=e.subarray(86),i=rt(e.subarray(4,8));let r=i;const n=i==="enca"||i==="encv";if(n){const a=me(e,[i])[0].subarray(i==="enca"?28:78);me(a,["sinf"]).forEach(l=>{const c=me(l,["schm"])[0];if(c){const h=rt(c.subarray(4,8));if(h==="cbcs"||h==="cenc"){const u=me(l,["frma"])[0];u&&(r=rt(u))}}})}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const o=me(t,["avcC"])[0];r+="."+Wr(o[1])+Wr(o[2])+Wr(o[3]);break}case"mp4a":{const o=me(e,[i])[0],a=me(o.subarray(28),["esds"])[0];if(a&&a.length>12){let A=4;if(a[A++]!==3)break;A=xo(a,A),A+=2;const l=a[A++];if(l&128&&(A+=2),l&64&&(A+=a[A++]),a[A++]!==4)break;A=xo(a,A);const c=a[A++];if(c===64)r+="."+Wr(c);else break;if(A+=12,a[A++]!==5)break;A=xo(a,A);const h=a[A++];let u=(h&248)>>3;u===31&&(u+=1+((h&7)<<3)+((a[A]&224)>>5)),r+="."+u}break}case"hvc1":case"hev1":{const o=me(t,["hvcC"])[0],a=o[1],A=["","A","B","C"][a>>6],l=a&31,c=ge(o,2),h=(a&32)>>5?"H":"L",u=o[12],d=o.subarray(6,12);r+="."+A+l,r+="."+c.toString(16).toUpperCase(),r+="."+h+u;let g="";for(let f=d.length;f--;){const E=d[f];(E||g)&&(g="."+E.toString(16).toUpperCase()+g)}r+=g;break}case"dvh1":case"dvhe":{const o=me(t,["dvcC"])[0],a=o[2]>>1&127,A=o[2]<<5&32|o[3]>>3&31;r+="."+ei(a)+"."+ei(A);break}case"vp09":{const o=me(t,["vpcC"])[0],a=o[4],A=o[5],l=o[6]>>4&15;r+="."+ei(a)+"."+ei(A)+"."+ei(l);break}case"av01":{const o=me(t,["av1C"])[0],a=o[1]>>>5,A=o[1]&31,l=o[2]>>>7?"H":"M",c=(o[2]&64)>>6,h=(o[2]&32)>>5,u=a===2&&c?h?12:10:c?10:8,d=(o[2]&16)>>4,g=(o[2]&8)>>3,f=(o[2]&4)>>2,E=o[2]&3;r+="."+a+"."+ei(A)+l+"."+ei(u)+"."+d+"."+g+f+E+"."+ei(1)+"."+ei(1)+"."+ei(1)+"."+0;break}}return{codec:r,encrypted:n}}function xo(s,e){const t=e+5;for(;s[e++]&128&&e<t;);return e}function Wr(s){return("0"+s.toString(16).toUpperCase()).slice(-2)}function ei(s){return(s<10?"0":"")+s}function Wf(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&me(s,["moov","trak"]).forEach(r=>{const o=me(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=me(o,["enca"]);const A=a.length>0;A||(a=me(o,["encv"])),a.forEach(l=>{const c=A?l.subarray(28):l.subarray(78);me(c,["sinf"]).forEach(u=>{const d=$l(u);if(d){const g=d.subarray(8,24);g.some(f=>f!==0)||(_.log(`[eme] Patching keyId in 'enc${A?"a":"v"}>sinf>>tenc' box: ${zt.hexDump(g)} -> ${zt.hexDump(t)}`),d.set(t,8))}})})}),s}function $l(s){const e=me(s,["schm"])[0];if(e){const t=rt(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return me(s,["schi","tenc"])[0]}return _.error("[eme] missing 'schm' box"),null}function qf(s,e){return me(e,["moof","traf"]).reduce((t,i)=>{const r=me(i,["tfdt"])[0],n=r[0],o=me(i,["tfhd"]).reduce((a,A)=>{const l=ge(A,4),c=s[l];if(c){let h=ge(r,4);if(n===1){if(h===Jr)return _.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;h*=Jr+1,h+=ge(r,8)}const u=c.timescale||9e4,d=h/u;if(Ae(d)&&(a===null||d<a))return d}return a},null);return o!==null&&Ae(o)&&(t===null||o<t)?o:t},null)}function jf(s,e){let t=0,i=0,r=0;const n=me(s,["moof","traf"]);for(let o=0;o<n.length;o++){const a=n[o],A=me(a,["tfhd"])[0],l=ge(A,4),c=e[l];if(!c)continue;const h=c.default,u=ge(A,0)|(h==null?void 0:h.flags);let d=h==null?void 0:h.duration;u&8&&(u&2?d=ge(A,12):d=ge(A,8));const g=c.timescale||9e4,f=me(a,["trun"]);for(let E=0;E<f.length;E++){if(t=Xf(f[E]),!t&&d){const B=ge(f[E],4);t=d*B}c.type===_e.VIDEO?i+=t/g:c.type===_e.AUDIO&&(r+=t/g)}}if(i===0&&r===0){let o=1/0,a=0,A=0;const l=me(s,["sidx"]);for(let c=0;c<l.length;c++){const h=Vf(l[c]);if(h!=null&&h.references){o=Math.min(o,h.earliestPresentationTime/h.timescale);const u=h.references.reduce((d,g)=>d+g.info.duration||0,0);a=Math.max(a,u+h.earliestPresentationTime/h.timescale),A=a-o}}if(A&&Ae(A))return A}return i||r}function Xf(s){const e=ge(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const r=ge(s,4);for(let n=0;n<r;n++){if(e&256){const o=ge(s,t);i+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function Zf(s,e,t){me(e,["moof","traf"]).forEach(i=>{me(i,["tfhd"]).forEach(r=>{const n=ge(r,4),o=s[n];if(!o)return;const a=o.timescale||9e4;me(i,["tfdt"]).forEach(A=>{const l=A[0],c=t*a;if(c){let h=ge(A,4);if(l===0)h-=c,h=Math.max(h,0),Ro(A,4,h);else{h*=Math.pow(2,32),h+=ge(A,8),h-=c,h=Math.max(h,0);const u=Math.floor(h/(Jr+1)),d=Math.floor(h%(Jr+1));Ro(A,4,u),Ro(A,8,d)}}})})})}function zf(s){const e={valid:null,remainder:null},t=me(s,["moof"]);if(t.length<2)return e.remainder=s,e;const i=t[t.length-1];return e.valid=Ji(s,0,i.byteOffset-8),e.remainder=Ji(s,i.byteOffset-8),e}function Mt(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function Kl(s,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let o=!1;return me(i,["moof"]).map(A=>{const l=A.byteOffset-8;me(A,["traf"]).map(h=>{const u=me(h,["tfdt"]).map(d=>{const g=d[0];let f=ge(d,4);return g===1&&(f*=Math.pow(2,32),f+=ge(d,8)),f/r})[0];return u!==void 0&&(s=u),me(h,["tfhd"]).map(d=>{const g=ge(d,4),f=ge(d,0)&16777215,E=(f&1)!==0,B=(f&2)!==0,S=(f&8)!==0;let Q=0;const m=(f&16)!==0;let y=0;const L=(f&32)!==0;let v=8;g===n&&(E&&(v+=8),B&&(v+=4),S&&(Q=ge(d,v),v+=4),m&&(y=ge(d,v),v+=4),L&&(v+=4),e.type==="video"&&(o=e0(e.codec)),me(h,["trun"]).map(F=>{const G=F[0],M=ge(F,0)&16777215,H=(M&1)!==0;let j=0;const U=(M&4)!==0,J=(M&256)!==0;let w=0;const D=(M&512)!==0;let X=0;const R=(M&1024)!==0,b=(M&2048)!==0;let T=0;const K=ge(F,4);let P=8;H&&(j=ge(F,P),P+=4),U&&(P+=4);let q=j+l;for(let ie=0;ie<K;ie++){if(J?(w=ge(F,P),P+=4):w=Q,D?(X=ge(F,P),P+=4):X=y,R&&(P+=4),b&&(G===0?T=ge(F,P):T=Gl(F,P),P+=4),e.type===_e.VIDEO){let ce=0;for(;ce<X;){const he=ge(i,q);if(q+=4,t0(o,i[q])){const se=i.subarray(q,q+he);Yl(se,o?2:1,s+T/r,t)}q+=he,ce+=he+4}}s+=w/r}}))})})}),t}function e0(s){if(!s)return!1;const e=s.indexOf("."),t=e<0?s:s.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function t0(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Yl(s,e,t,i){const r=Vl(s);let n=0;n+=e;let o=0,a=0,A=0;for(;n<r.length;){o=0;do{if(n>=r.length)break;A=r[n++],o+=A}while(A===255);a=0;do{if(n>=r.length)break;A=r[n++],a+=A}while(A===255);const l=r.length-n;let c=n;if(a<l)n+=a;else if(a>l){_.error(`Malformed SEI payload. ${a} is too small, only ${l} bytes left to parse.`);break}if(o===4){if(r[c++]===181){const u=Ul(r,c);if(c+=2,u===49){const d=ge(r,c);if(c+=4,d===1195456820){const g=r[c++];if(g===3){const f=r[c++],E=31&f,B=64&f,S=B?2+E*3:0,Q=new Uint8Array(S);if(B){Q[0]=f;for(let m=1;m<S;m++)Q[m]=r[c++]}i.push({type:g,payloadType:o,pts:t,bytes:Q})}}}}}else if(o===5&&a>16){const h=[];for(let g=0;g<16;g++){const f=r[c++].toString(16);h.push(f.length==1?"0"+f:f),(g===3||g===5||g===7||g===9)&&h.push("-")}const u=a-16,d=new Uint8Array(u);for(let g=0;g<u;g++)d[g]=r[c++];i.push({payloadType:o,pts:t,uuid:h.join(""),userData:Zt(d),userDataBytes:d})}}}function Vl(s){const e=s.byteLength,t=[];let i=1;for(;i<e-2;)s[i]===0&&s[i+1]===0&&s[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return s;const r=e-t.length,n=new Uint8Array(r);let o=0;for(i=0;i<r;o++,i++)o===t[0]&&(o++,t.shift()),n[i]=s[o];return n}function i0(s){const e=s[0];let t="",i="",r=0,n=0,o=0,a=0,A=0,l=0;if(e===0){for(;rt(s.subarray(l,l+1))!=="\0";)t+=rt(s.subarray(l,l+1)),l+=1;for(t+=rt(s.subarray(l,l+1)),l+=1;rt(s.subarray(l,l+1))!=="\0";)i+=rt(s.subarray(l,l+1)),l+=1;i+=rt(s.subarray(l,l+1)),l+=1,r=ge(s,12),n=ge(s,16),a=ge(s,20),A=ge(s,24),l=28}else if(e===1){l+=4,r=ge(s,l),l+=4;const h=ge(s,l);l+=4;const u=ge(s,l);for(l+=4,o=4294967296*h+u,Cf(o)||(o=Number.MAX_SAFE_INTEGER,_.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=ge(s,l),l+=4,A=ge(s,l),l+=4;rt(s.subarray(l,l+1))!=="\0";)t+=rt(s.subarray(l,l+1)),l+=1;for(t+=rt(s.subarray(l,l+1)),l+=1;rt(s.subarray(l,l+1))!=="\0";)i+=rt(s.subarray(l,l+1)),l+=1;i+=rt(s.subarray(l,l+1)),l+=1}const c=s.subarray(l,s.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:o,presentationTimeDelta:n,eventDuration:a,id:A,payload:c}}function s0(s,...e){const t=e.length;let i=8,r=t;for(;r--;)i+=e[r].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=i&255,n.set(s,4),r=0,i=8;r<t;r++)n.set(e[r],i),i+=e[r].byteLength;return n}function r0(s,e,t){if(s.byteLength!==16)throw new RangeError("Invalid system id");let i,r;if(e){i=1,r=new Uint8Array(e.length*16);for(let a=0;a<e.length;a++){const A=e[a];if(A.byteLength!==16)throw new RangeError("Invalid key");r.set(A,a*16)}}else i=0,r=new Uint8Array;let n;i>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),s0([112,115,115,104],new Uint8Array([i,0,0,0]),s,n,r,o,t||new Uint8Array)}function n0(s){if(!(s instanceof ArrayBuffer)||s.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(s),i=t.getUint32(0);if(s.byteLength!==i&&i>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=zt.hexDump(new Uint8Array(s,12,16));const n=t.getUint32(28);if(e.version===0){if(i-32<n)return null;e.data=new Uint8Array(s,32,n)}else if(e.version===1){e.kids=[];for(let o=0;o<n;o++)e.kids.push(new Uint8Array(s,32+o*16,16))}return e}let qr={};class ir{static clearKeyUriToKeyIdMap(){qr={}}constructor(e,t,i,r=[1],n=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Qt.FAIRPLAY:case Qt.WIDEVINE:case Qt.PLAYREADY:case Qt.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&_.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=o0(e);return new ir(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=Lf(this.uri);if(t)switch(this.keyFormat){case Qt.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Qt.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=r0(i,null,t);const r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(r)),o=n.substring(n.indexOf("<"),n.length),l=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(l){const c=l.childNodes[0]?l.childNodes[0].nodeValue:l.getAttribute("VALUE");if(c){const h=Qo(c).subarray(0,16);Tf(h),this.keyId=h}}break}default:{let i=t.subarray(0,16);if(i.length!==16){const r=new Uint8Array(16);r.set(i,16-i.length),i=r}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=qr[this.uri];if(!i){const r=Object.keys(qr).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,r),qr[this.uri]=i}this.keyId=i}return this}}function o0(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const Jl=/\{\$([a-zA-Z0-9-_]+)\}/g;function Wl(s){return Jl.test(s)}function vt(s,e,t){if(s.variableList!==null||s.hasVariableRefs)for(let i=t.length;i--;){const r=t[i],n=e[r];n&&(e[r]=To(s,n))}}function To(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(Jl,i=>{const r=i.substring(2,i.length-1),n=t==null?void 0:t[r];return n===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),i):n})}return e}function ql(s,e,t){let i=s.variableList;i||(s.variableList=i={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(r))n=o.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(o){s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else r=e.NAME,n=e.VALUE;r in i?s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):i[r]=n||""}function a0(s,e,t){const i=e.IMPORT;if(t&&i in t){let r=s.variableList;r||(s.variableList=r={}),r[i]=t[i]}else s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}function ds(s=!0){return typeof self>"u"?void 0:(s||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const jr={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function A0(s,e){const t=jr[e];return!!t&&!!t[s.slice(0,4)]}function Lo(s,e,t=!0){return!s.split(",").some(i=>!jl(i,e,t))}function jl(s,e,t=!0){var i;const r=ds(t);return(i=r==null?void 0:r.isTypeSupported(sr(s,e)))!=null?i:!1}function sr(s,e){return`${e}/mp4;codecs="${s}"`}function Xl(s){if(s){const e=s.substring(0,4);return jr.video[e]}return 2}function Xr(s){return s.split(",").reduce((e,t)=>{const i=jr.video[t];return i?(i*2+e)/(e?3:2):(jr.audio[t]+e)/(e?2:1)},0)}const ko={};function l0(s,e=!0){if(ko[s])return ko[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[s];for(let i=0;i<t.length;i++)if(jl(t[i],"audio",e))return ko[s]=t[i],t[i];return s}const c0=/flac|opus/i;function Zr(s,e=!0){return s.replace(c0,t=>l0(t.toLowerCase(),e))}function Zl(s,e){return s&&s!=="mp4a"?s:e}function h0(s){const e=s.split(".");if(e.length>2){let t=e.shift()+".";return t+=parseInt(e.shift()).toString(16),t+=("000"+parseInt(e.shift()).toString(16)).slice(-4),t}return s}const zl=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,ec=/#EXT-X-MEDIA:(.*)/g,u0=/^#EXT(?:INF|-X-TARGETDURATION):/m,tc=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),d0=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class ti{static findGroup(e,t){for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return r}}static resolve(e,t){return mo.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return u0.test(e)}static parseMasterPlaylist(e,t){const i=Wl(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},n=[];zl.lastIndex=0;let o;for(;(o=zl.exec(e))!=null;)if(o[1]){var a;const l=new Ve(o[1]);vt(r,l,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=To(r,o[2]),h={attrs:l,bitrate:l.decimalInteger("BANDWIDTH")||l.decimalInteger("AVERAGE-BANDWIDTH"),name:l.NAME,url:ti.resolve(c,t)},u=l.decimalResolution("RESOLUTION");u&&(h.width=u.width,h.height=u.height),g0(l.CODECS,h),(a=h.unknownCodecs)!=null&&a.length||n.push(h),r.levels.push(h)}else if(o[3]){const l=o[3],c=o[4];switch(l){case"SESSION-DATA":{const h=new Ve(c);vt(r,h,["DATA-ID","LANGUAGE","VALUE","URI"]);const u=h["DATA-ID"];u&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[u]=h);break}case"SESSION-KEY":{const h=ic(c,t,r);h.encrypted&&h.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(h)):_.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const h=new Ve(c);vt(r,h,["NAME","VALUE","QUERYPARAM"]),ql(r,h,t)}break}case"CONTENT-STEERING":{const h=new Ve(c);vt(r,h,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:ti.resolve(h["SERVER-URI"],t),pathwayId:h["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=sc(c);break}}}const A=n.length>0&&n.length<r.levels.length;return r.levels=A?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,i){let r;const n={},o=i.levels,a={AUDIO:o.map(l=>({id:l.attrs.AUDIO,audioCodec:l.audioCodec})),SUBTITLES:o.map(l=>({id:l.attrs.SUBTITLES,textCodec:l.textCodec})),"CLOSED-CAPTIONS":[]};let A=0;for(ec.lastIndex=0;(r=ec.exec(e))!==null;){const l=new Ve(r[1]),c=l.TYPE;if(c){const h=a[c],u=n[c]||[];n[c]=u,vt(i,l,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=l.LANGUAGE,g=l["ASSOC-LANGUAGE"],f=l.CHANNELS,E=l.CHARACTERISTICS,B=l["INSTREAM-ID"],S={attrs:l,bitrate:0,id:A++,groupId:l["GROUP-ID"]||"",name:l.NAME||d||"",type:c,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:d,url:l.URI?ti.resolve(l.URI,t):""};if(g&&(S.assocLang=g),f&&(S.channels=f),E&&(S.characteristics=E),B&&(S.instreamId=B),h!=null&&h.length){const Q=ti.findGroup(h,S.groupId)||h[0];rc(S,Q,"audioCodec"),rc(S,Q,"textCodec")}u.push(S)}}return n}static parseLevelPlaylist(e,t,i,r,n,o){const a=new Rf(t),A=a.fragments;let l=null,c=0,h=0,u=0,d=0,g=null,f=new yo(r,t),E,B,S,Q=-1,m=!1,y=null;for(tc.lastIndex=0,a.m3u8=e,a.hasVariableRefs=Wl(e);(E=tc.exec(e))!==null;){m&&(m=!1,f=new yo(r,t),f.start=u,f.sn=c,f.cc=d,f.level=i,l&&(f.initSegment=l,f.rawProgramDateTime=l.rawProgramDateTime,l.rawProgramDateTime=null,y&&(f.setByteRange(y),y=null)));const G=E[1];if(G){f.duration=parseFloat(G);const M=(" "+E[2]).slice(1);f.title=M||null,f.tagList.push(M?["INF",G,M]:["INF",G])}else if(E[3]){if(Ae(f.duration)){f.start=u,S&&ac(f,S,a),f.sn=c,f.level=i,f.cc=d,A.push(f);const M=(" "+E[3]).slice(1);f.relurl=To(a,M),nc(f,g),g=f,u+=f.duration,c++,h=0,m=!0}}else if(E[4]){const M=(" "+E[4]).slice(1);g?f.setByteRange(M,g):f.setByteRange(M)}else if(E[5])f.rawProgramDateTime=(" "+E[5]).slice(1),f.tagList.push(["PROGRAM-DATE-TIME",f.rawProgramDateTime]),Q===-1&&(Q=A.length);else{if(E=E[0].match(d0),!E){_.warn("No matches on slow regex match for level playlist!");continue}for(B=1;B<E.length&&!(typeof E[B]<"u");B++);const M=(" "+E[B]).slice(1),H=(" "+E[B+1]).slice(1),j=E[B+2]?(" "+E[B+2]).slice(1):"";switch(M){case"PLAYLIST-TYPE":a.type=H.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(H);break;case"SKIP":{const U=new Ve(H);vt(a,U,["RECENTLY-REMOVED-DATERANGES"]);const J=U.decimalInteger("SKIPPED-SEGMENTS");if(Ae(J)){a.skippedSegments=J;for(let D=J;D--;)A.unshift(null);c+=J}const w=U.enumeratedString("RECENTLY-REMOVED-DATERANGES");w&&(a.recentlyRemovedDateranges=w.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(H),1);break;case"VERSION":a.version=parseInt(H);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(H||j)&&f.tagList.push(j?[H,j]:[H]);break;case"DISCONTINUITY":d++,f.tagList.push(["DIS"]);break;case"GAP":f.gap=!0,f.tagList.push([M]);break;case"BITRATE":f.tagList.push([M,H]);break;case"DATERANGE":{const U=new Ve(H);vt(a,U,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),vt(a,U,U.clientAttrs);const J=new Rl(U,a.dateRanges[U.ID]);J.isValid||a.skippedSegments?a.dateRanges[J.id]=J:_.warn(`Ignoring invalid DATERANGE tag: "${H}"`),f.tagList.push(["EXT-X-DATERANGE",H]);break}case"DEFINE":{{const U=new Ve(H);vt(a,U,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in U?a0(a,U,o):ql(a,U,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(H);break;case"KEY":{const U=ic(H,t,a);if(U.isSupported()){if(U.method==="NONE"){S=void 0;break}S||(S={}),S[U.keyFormat]&&(S=Ze({},S)),S[U.keyFormat]=U}else _.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${H}"`);break}case"START":a.startTimeOffset=sc(H);break;case"MAP":{const U=new Ve(H);if(vt(a,U,["BYTERANGE","URI"]),f.duration){const J=new yo(r,t);oc(J,U,i,S),l=J,f.initSegment=l,l.rawProgramDateTime&&!f.rawProgramDateTime&&(f.rawProgramDateTime=l.rawProgramDateTime)}else{const J=f.byteRangeEndOffset;if(J){const w=f.byteRangeStartOffset;y=`${J-w}@${w}`}else y=null;oc(f,U,i,S),l=f,m=!0}break}case"SERVER-CONTROL":{const U=new Ve(H);a.canBlockReload=U.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=U.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&U.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=U.optionalFloat("PART-HOLD-BACK",0),a.holdBack=U.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const U=new Ve(H);a.partTarget=U.decimalFloatingPoint("PART-TARGET");break}case"PART":{let U=a.partList;U||(U=a.partList=[]);const J=h>0?U[U.length-1]:void 0,w=h++,D=new Ve(H);vt(a,D,["BYTERANGE","URI"]);const X=new Df(D,f,t,w,J);U.push(X),f.duration+=X.duration;break}case"PRELOAD-HINT":{const U=new Ve(H);vt(a,U,["URI"]),a.preloadHint=U;break}case"RENDITION-REPORT":{const U=new Ve(H);vt(a,U,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(U);break}default:_.warn(`line parsed but not handled: ${E}`);break}}}g&&!g.relurl?(A.pop(),u-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(nc(f,g),f.cc=d,a.fragmentHint=f,S&&ac(f,S,a));const L=A.length,v=A[0],F=A[L-1];if(u+=a.skippedSegments*a.targetduration,u>0&&L&&F){a.averagetargetduration=u/L;const G=F.sn;a.endSN=G!=="initSegment"?G:0,a.live||(F.endList=!0),v&&(a.startCC=v.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(u+=a.fragmentHint.duration),a.totalduration=u,a.endCC=d,Q>0&&f0(A,Q),a}}function ic(s,e,t){var i,r;const n=new Ve(s);vt(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(i=n.METHOD)!=null?i:"",a=n.URI,A=n.hexadecimalInteger("IV"),l=n.KEYFORMATVERSIONS,c=(r=n.KEYFORMAT)!=null?r:"identity";a&&n.IV&&!A&&_.error(`Invalid IV: ${n.IV}`);const h=a?ti.resolve(a,e):"",u=(l||"1").split("/").map(Number).filter(Number.isFinite);return new ir(o,h,c,u,A)}function sc(s){const t=new Ve(s).decimalFloatingPoint("TIME-OFFSET");return Ae(t)?t:null}function g0(s,e){let t=(s||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const r=t.filter(n=>A0(n,i));r.length&&(e[`${i}Codec`]=r.join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function rc(s,e,t){const i=e[t];i&&(s[t]=i)}function f0(s,e){let t=s[e];for(let i=e;i--;){const r=s[i];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function nc(s,e){s.rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime),Ae(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null)}function oc(s,e,t,i){s.relurl=e.URI,e.BYTERANGE&&s.setByteRange(e.BYTERANGE),s.level=t,s.sn="initSegment",i&&(s.levelkeys=i),s.initSegment=null}function ac(s,e,t){s.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&i.push(s)}var be={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ee={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Ac(s){const{type:e}=s;switch(e){case be.AUDIO_TRACK:return Ee.AUDIO;case be.SUBTITLE_TRACK:return Ee.SUBTITLE;default:return Ee.MAIN}}function Mo(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class E0{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,r=t.loader,n=i||r,o=new n(t);return this.loaders[e.type]=o,o}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:be.MANIFEST,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:r,pathwayId:n,url:o,deliveryDirectives:a}=t;this.load({id:i,level:r,pathwayId:n,responseType:"text",type:be.LEVEL,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:be.AUDIO_TRACK,url:n,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:be.SUBTITLE_TRACK,url:n,deliveryDirectives:o})}load(e){var t;const i=this.hls.config;let r=this.getInternalLoader(e);if(r){const l=r.context;if(l&&l.url===e.url&&l.level===e.level){_.trace("[playlist-loader]: playlist request ongoing");return}_.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===be.MANIFEST?n=i.manifestLoadPolicy.default:n=Ze({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),Ae((t=e.deliveryDirectives)==null?void 0:t.part)){let l;if(e.type===be.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===be.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===be.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){const c=l.partTarget,h=l.targetduration;if(c&&h){const u=Math.max(c*3,h*.8)*1e3;n=Ze({},n,{maxTimeToFirstByteMs:Math.min(u,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(u,n.maxTimeToFirstByteMs)})}}}const o=n.errorRetry||n.timeoutRetry||{},a={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},A={onSuccess:(l,c,h,u)=>{const d=this.getInternalLoader(h);this.resetInternalLoader(h.type);const g=l.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,h,new Error("no EXTM3U delimiter"),u||null,c);return}c.parsing.start=performance.now(),ti.isMediaPlaylist(g)?this.handleTrackOrLevelPlaylist(l,c,h,u||null,d):this.handleMasterPlaylist(l,c,h,u)},onError:(l,c,h,u)=>{this.handleNetworkError(c,h,!1,l,u)},onTimeout:(l,c,h)=>{this.handleNetworkError(c,h,!0,void 0,l)}};r.load(e,a,A)}handleMasterPlaylist(e,t,i,r){const n=this.hls,o=e.data,a=Mo(e,i),A=ti.parseMasterPlaylist(o,a);if(A.playlistParsingError){this.handleManifestParsingError(e,i,A.playlistParsingError,r,t);return}const{contentSteering:l,levels:c,sessionData:h,sessionKeys:u,startTimeOffset:d,variableList:g}=A;this.variableList=g;const{AUDIO:f=[],SUBTITLES:E,"CLOSED-CAPTIONS":B}=ti.parseMasterPlaylistMedia(o,a,A);f.length&&!f.some(Q=>!Q.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(_.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ve({}),bitrate:0,url:""})),n.trigger(p.MANIFEST_LOADED,{levels:c,audioTracks:f,subtitles:E,captions:B,contentSteering:l,url:a,stats:t,networkDetails:r,sessionData:h,sessionKeys:u,startTimeOffset:d,variableList:g})}handleTrackOrLevelPlaylist(e,t,i,r,n){const o=this.hls,{id:a,level:A,type:l}=i,c=Mo(e,i),h=0,u=Ae(A)?A:Ae(a)?a:0,d=Ac(i),g=ti.parseLevelPlaylist(e.data,c,u,d,h,this.variableList);if(l===be.MANIFEST){const f={attrs:new Ve({}),bitrate:0,details:g,name:"",url:c};o.trigger(p.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:c,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=g,this.handlePlaylistLoaded(g,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(p.ERROR,{type:Ie.NETWORK_ERROR,details:$.MANIFEST_PARSING_ERROR,fatal:t.type===be.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,i=!1,r,n){let o=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===be.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===be.AUDIO_TRACK||e.type===be.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);_.warn(`[playlist-loader]: ${o}`);let A=$.UNKNOWN,l=!1;const c=this.getInternalLoader(e);switch(e.type){case be.MANIFEST:A=i?$.MANIFEST_LOAD_TIMEOUT:$.MANIFEST_LOAD_ERROR,l=!0;break;case be.LEVEL:A=i?$.LEVEL_LOAD_TIMEOUT:$.LEVEL_LOAD_ERROR,l=!1;break;case be.AUDIO_TRACK:A=i?$.AUDIO_TRACK_LOAD_TIMEOUT:$.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case be.SUBTITLE_TRACK:A=i?$.SUBTITLE_TRACK_LOAD_TIMEOUT:$.SUBTITLE_LOAD_ERROR,l=!1;break}c&&this.resetInternalLoader(e.type);const h={type:Ie.NETWORK_ERROR,details:A,fatal:l,url:e.url,loader:c,context:e,error:a,networkDetails:t,stats:n};if(r){const u=(t==null?void 0:t.url)||e.url;h.response=At({url:u,data:void 0},r)}this.hls.trigger(p.ERROR,h)}handlePlaylistLoaded(e,t,i,r,n,o){const a=this.hls,{type:A,level:l,id:c,groupId:h,deliveryDirectives:u}=r,d=Mo(t,r),g=Ac(r),f=typeof r.level=="number"&&g===Ee.MAIN?l:void 0;if(!e.fragments.length){const B=new Error("No Segments found in Playlist");a.trigger(p.ERROR,{type:Ie.NETWORK_ERROR,details:$.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:B,reason:B.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const E=e.playlistParsingError;if(E){a.trigger(p.ERROR,{type:Ie.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:E,reason:E.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),A){case be.MANIFEST:case be.LEVEL:a.trigger(p.LEVEL_LOADED,{details:e,level:f||0,id:c||0,stats:i,networkDetails:n,deliveryDirectives:u});break;case be.AUDIO_TRACK:a.trigger(p.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break;case be.SUBTITLE_TRACK:a.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break}}}function lc(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function cc(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){_.debug(`[texttrack-utils]: ${i}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,s.addCue(r)}catch(r){_.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(s.mode=t)}function gs(s){const e=s.mode;if(e==="disabled"&&(s.mode="hidden"),s.cues)for(let t=s.cues.length;t--;)s.removeCue(s.cues[t]);e==="disabled"&&(s.mode=e)}function _o(s,e,t,i){const r=s.mode;if(r==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const n=I0(s.cues,e,t);for(let o=0;o<n.length;o++)(!i||i(n[o]))&&s.removeCue(n[o])}r==="disabled"&&(s.mode=r)}function p0(s,e){if(e<s[0].startTime)return 0;const t=s.length-1;if(e>s[t].endTime)return-1;let i=0,r=t;for(;i<=r;){const n=Math.floor((r+i)/2);if(e<s[n].startTime)r=n-1;else if(e>s[n].startTime&&i<t)i=n+1;else return n}return s[i].startTime-e<e-s[r].startTime?i:r}function I0(s,e,t){const i=[],r=p0(s,e);if(r>-1)for(let n=r,o=s.length;n<o;n++){const a=s[n];if(a.startTime>=e&&a.endTime<=t)i.push(a);else if(a.startTime>t)return i}return i}function zr(s){const e=[];for(let t=0;t<s.length;t++){const i=s[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(s[t])}return e}var Ht={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const C0=.25;function Fo(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function hc(s,e,t,i,r){let n=new s(e,t,"");try{n.value=i,r&&(n.type=r)}catch{n=new s(e,t,JSON.stringify(r?At({type:r},i):i))}return n}const en=(()=>{const s=Fo();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Oo(s,e){return s.getTime()/1e3-e}function m0(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class B0{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(gs(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return lc(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:r}}}=this;if(!i&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=Fo();if(o)for(let a=0;a<n.length;a++){const A=n[a].type;if(A===Ht.emsg&&!i||!r)continue;const l=Ol(n[a].data);if(l){const c=n[a].pts;let h=c+n[a].duration;h>en&&(h=en),h-c<=0&&(h=c+C0);for(let d=0;d<l.length;d++){const g=l[d];if(!Fl(g)){this.updateId3CueEnds(c,A);const f=hc(o,c,h,g,A);f&&this.id3Track.addCue(f)}}}}}updateId3CueEnds(e,t){var i;const r=(i=this.id3Track)==null?void 0:i.cues;if(r)for(let n=r.length;n--;){const o=r[n];o.type===t&&o.startTime<e&&o.endTime===en&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){const{id3Track:n,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:A}}=o;if(n&&(a||A)){let l;r==="audio"?l=c=>c.type===Ht.audioId3&&A:r==="video"?l=c=>c.type===Ht.emsg&&a:l=c=>c.type===Ht.audioId3&&A||c.type===Ht.emsg&&a,_o(n,t,i,l)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:r}=this,{dateRanges:n}=t,o=Object.keys(n);if(r){const c=Object.keys(i).filter(h=>!o.includes(h));for(let h=c.length;h--;){const u=c[h];Object.keys(i[u].cues).forEach(d=>{r.removeCue(i[u].cues[d])}),delete i[u]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!Ae(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const A=a.programDateTime/1e3-a.start,l=Fo();for(let c=0;c<o.length;c++){const h=o[c],u=n[h],d=Oo(u.startDate,A),g=i[h],f=(g==null?void 0:g.cues)||{};let E=(g==null?void 0:g.durationKnown)||!1,B=en;const S=u.endDate;if(S)B=Oo(S,A),E=!0;else if(u.endOnNext&&!E){const m=o.reduce((y,L)=>{if(L!==u.id){const v=n[L];if(v.class===u.class&&v.startDate>u.startDate&&(!y||u.startDate<y.startDate))return v}return y},null);m&&(B=Oo(m.startDate,A),E=!0)}const Q=Object.keys(u.attr);for(let m=0;m<Q.length;m++){const y=Q[m];if(!wf(y))continue;const L=f[y];if(L)E&&!g.durationKnown&&(L.endTime=B);else if(l){let v=u.attr[y];Sf(y)&&(v=m0(v));const F=hc(l,d,B,{key:y,data:v},Ht.dateRange);F&&(F.id=h,this.id3Track.addCue(F),f[y]=F)}}i[h]={cues:f,dateRange:u,durationKnown:E}}}}class y0{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,A=this.hls.userConfig;let l=a&&i||t;(A.liveSyncDuration||A.liveSyncDurationCount||l===0)&&(l=n!==void 0?n:o*r);const c=r;return l+Math.min(this.stallCount*1,c)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;const r=i.edge,n=e-t-this.edgeStalled,o=r-i.totalduration,a=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,n),a)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(p.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(p.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===$.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&_.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1||!t.live)return;const o=this.targetLatency;if(o===null)return;const a=i-o,A=Math.min(this.maxLatency,o+t.targetduration);if(a<A&&a>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,n)),h=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,h))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const No=["NONE","TYPE-0","TYPE-1",null];function Q0(s){return No.indexOf(s)>-1}const tn=["SDR","PQ","HLG"];function v0(s){return!!s&&tn.indexOf(s)>-1}var rr={No:"",Yes:"YES",v2:"v2"};function w0(s,e){const{canSkipUntil:t,canSkipDateRanges:i,endSN:r}=s,n=e!==void 0?e-r:0;return t&&n<t?i?rr.v2:rr.Yes:rr.No}class uc{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class fs{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>!!t).map(t=>t.substring(0,4)).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return dc(this._audioGroups,e)}hasSubtitleGroup(e){return dc(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function dc(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function Uo(s,e){const t=e.startPTS;if(Ae(t)){let i=0,r;e.sn>s.sn?(i=t-s.start,r=s):(i=s.start-t,r=e),r.duration!==i&&(r.duration=i)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.start=s.start+(s.minEndPTS-s.start):e.start=s.start+s.duration:e.start=Math.max(s.start-e.duration,0)}function gc(s,e,t,i,r,n){i-t<=0&&(_.warn("Fragment should have a positive duration",e),i=t+e.duration,n=r+e.duration);let a=t,A=i;const l=e.startPTS,c=e.endPTS;if(Ae(l)){const E=Math.abs(l-t);Ae(e.deltaPTS)?e.deltaPTS=Math.max(E,e.deltaPTS):e.deltaPTS=E,a=Math.max(t,l),t=Math.min(t,l),r=Math.min(r,e.startDTS),A=Math.min(i,c),i=Math.max(i,c),n=Math.max(n,e.endDTS)}const h=t-e.start;e.start!==0&&(e.start=t),e.duration=i-e.start,e.startPTS=t,e.maxStartPTS=a,e.startDTS=r,e.endPTS=i,e.minEndPTS=A,e.endDTS=n;const u=e.sn;if(!s||u<s.startSN||u>s.endSN)return 0;let d;const g=u-s.startSN,f=s.fragments;for(f[g]=e,d=g;d>0;d--)Uo(f[d],f[d-1]);for(d=g;d<f.length-1;d++)Uo(f[d],f[d+1]);return s.fragmentHint&&Uo(f[f.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,h}function S0(s,e){let t=null;const i=s.fragments;for(let A=i.length-1;A>=0;A--){const l=i[A].initSegment;if(l){t=l;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let r=0,n;if(R0(s,e,(A,l)=>{A.relurl&&(r=A.cc-l.cc),Ae(A.startPTS)&&Ae(A.endPTS)&&(l.start=l.startPTS=A.startPTS,l.startDTS=A.startDTS,l.maxStartPTS=A.maxStartPTS,l.endPTS=A.endPTS,l.endDTS=A.endDTS,l.minEndPTS=A.minEndPTS,l.duration=A.endPTS-A.startPTS,l.duration&&(n=l),e.PTSKnown=e.alignedSliding=!0),l.elementaryStreams=A.elementaryStreams,l.loader=A.loader,l.stats=A.stats,A.initSegment&&(l.initSegment=A.initSegment,t=A.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(l=>{var c;l&&(!l.initSegment||l.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(l.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(A=>!A),e.deltaUpdateFailed){_.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let A=e.skippedSegments;A--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=D0(s.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(r){_.warn("discontinuity sliding from playlist, take drift into account");for(let A=0;A<o.length;A++)o[A].cc+=r}e.skippedSegments&&(e.startCC=e.fragments[0].cc),b0(s.partList,e.partList,(A,l)=>{l.elementaryStreams=A.elementaryStreams,l.stats=A.stats}),n?gc(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):fc(s,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const A=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=A),e.driftEndTime=a,e.driftEnd=A}else e.driftEndTime=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime}function D0(s,e,t){const i=Ze({},s);return t&&t.forEach(r=>{delete i[r]}),Object.keys(e).forEach(r=>{const n=new Rl(e[r].attr,i[r]);n.isValid?i[r]=n:_.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[r].attr)}"`)}),i}function b0(s,e,t){if(s&&e){let i=0;for(let r=0,n=s.length;r<=n;r++){const o=s[r],a=e[r+i];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):i--}}}function R0(s,e,t){const i=e.skippedSegments,r=Math.max(s.startSN,e.startSN)-e.startSN,n=(s.fragmentHint?1:0)+(i?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,o=e.startSN-s.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,A=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let l=r;l<=n;l++){const c=A[o+l];let h=a[l];i&&!h&&l<i&&(h=e.fragments[l]=c),c&&h&&t(c,h)}}function fc(s,e){const t=e.startSN+e.skippedSegments-s.startSN,i=s.fragments;t<0||t>=i.length||Po(e,i[t].start)}function Po(s,e){if(e){const t=s.fragments;for(let i=s.skippedSegments;i<t.length;i++)t[i].start+=e;s.fragmentHint&&(s.fragmentHint.start+=e)}}function x0(s,e=1/0){let t=1e3*s.targetduration;if(s.updated){const i=s.fragments;if(i.length&&t*4>e){const n=i[i.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function T0(s,e,t){if(!(s!=null&&s.details))return null;const i=s.details;let r=i.fragments[e-i.startSN];return r||(r=i.fragmentHint,r&&r.sn===e)?r:e<i.startSN&&t&&t.sn===e?t:null}function Ec(s,e,t){var i;return s!=null&&s.details?pc((i=s.details)==null?void 0:i.partList,e,t):null}function pc(s,e,t){if(s)for(let i=s.length;i--;){const r=s[i];if(r.index===t&&r.fragment.sn===e)return r}return null}function Ic(s){s.forEach((e,t)=>{const{details:i}=e;i!=null&&i.fragments&&i.fragments.forEach(r=>{r.level=t})})}function sn(s){switch(s.details){case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_TIMEOUT:case $.LEVEL_LOAD_TIMEOUT:case $.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Cc(s,e){const t=sn(e);return s.default[`${t?"timeout":"error"}Retry`]}function Go(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function mc(s){return At(At({},s),{errorRetry:null,timeoutRetry:null})}function rn(s,e,t,i){if(!s)return!1;const r=i==null?void 0:i.code,n=e<s.maxNumRetry&&(L0(r)||!!t);return s.shouldRetry?s.shouldRetry(s,e,t,i,n):n}function L0(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const Bc={search:function(s,e){let t=0,i=s.length-1,r=null,n=null;for(;t<=i;){r=(t+i)/2|0,n=s[r];const o=e(n);if(o>0)t=r+1;else if(o<0)i=r-1;else return n}return null}};function k0(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!Ae(e))return null;const i=s[0].programDateTime;if(e<(i||0))return null;const r=s[s.length-1].endProgramDateTime;if(e>=(r||0))return null;t=t||0;for(let n=0;n<s.length;++n){const o=s[n];if(M0(e,t,o))return o}return null}function nn(s,e,t=0,i=0){let r=null;if(s){r=e[s.sn-e[0].sn+1]||null;const o=s.endDTS-t;o>0&&o<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&(!s||s.level===r.level)&&Ho(t,i,r)===0)return r;const n=Bc.search(e,Ho.bind(null,t,i));return n&&(n!==s||!r)?n:r}function Ho(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=s?1:t.start-i>s&&t.start?-1:0}function M0(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function _0(s,e){return Bc.search(s,t=>t.cc<e?1:t.cc>e?-1:0)}var pt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},$t={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class F0{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=_.log.bind(_,"[info]:"),this.warn=_.warn.bind(_,"[warning]:"),this.error=_.error.bind(_,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.ERROR,this.onError,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.ERROR,this.onError,this),e.off(p.ERROR,this.onErrorOut,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===Ee.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,r;if(t.fatal)return;const n=this.hls,o=t.context;switch(t.details){case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case $.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction={action:pt.DoNothing,flags:$t.None};return}case $.FRAG_GAP:case $.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=pt.SendAlternateToPenaltyBox;return}case $.LEVEL_EMPTY_ERROR:case $.LEVEL_PARSING_ERROR:{var a,A;const l=t.parent===Ee.MAIN?t.level:n.loadLevel;t.details===$.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(A=a.levelDetails)!=null&&A.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l))}return;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_LOAD_ERROR:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const l=n.levels[n.loadLevel];if(l&&(o.type===be.AUDIO_TRACK&&l.hasAudioGroup(o.groupId)||o.type===be.SUBTITLE_TRACK&&l.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=pt.SendAlternateToPenaltyBox,t.errorAction.flags=$t.MoveAllAlternatesMatchingHost;return}}return;case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const l=n.levels[n.loadLevel],c=l==null?void 0:l.attrs["HDCP-LEVEL"];c?t.errorAction={action:pt.SendAlternateToPenaltyBox,flags:$t.MoveAllAlternatesMatchingHDCP,hdcpLevel:c}:this.keySystemError(t)}return;case $.BUFFER_ADD_CODEC_ERROR:case $.REMUX_ALLOC_ERROR:case $.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case $.INTERNAL_EXCEPTION:case $.BUFFER_APPENDING_ERROR:case $.BUFFER_FULL_ERROR:case $.LEVEL_SWITCH_ERROR:case $.BUFFER_STALLED_ERROR:case $.BUFFER_SEEK_OVER_HOLE:case $.BUFFER_NUDGE_ON_STALL:t.errorAction={action:pt.DoNothing,flags:$t.None};return}t.type===Ie.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,r=Cc(i.config.playlistLoadPolicy,e),n=this.playlistError++;if(rn(r,n,sn(e),e.response))return{action:pt.RetryRequest,flags:$t.None,retryConfig:r,retryCount:n};const a=this.getLevelSwitchAction(e,t);return r&&(a.retryConfig=r,a.retryCount=n),a}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:o}=t.config,a=Cc(e.details.startsWith("key")?o:n,e),A=t.levels.reduce((c,h)=>c+h.fragmentError,0);if(r&&(e.details!==$.FRAG_GAP&&r.fragmentError++,rn(a,A,sn(e),e.response)))return{action:pt.RetryRequest,flags:$t.None,retryConfig:a,retryCount:A};const l=this.getLevelSwitchAction(e,i);return a&&(l.retryConfig=a,l.retryCount=A),l}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const r=this.hls.levels[t];if(r){var n,o;const l=e.details;r.loadError++,l===$.BUFFER_APPEND_ERROR&&r.fragmentError++;let c=-1;const{levels:h,loadLevel:u,minAutoLevel:d,maxAutoLevel:g}=i;i.autoLevelEnabled||(i.loadLevel=-1);const f=(n=e.frag)==null?void 0:n.type,B=(f===Ee.AUDIO&&l===$.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(l===$.BUFFER_ADD_CODEC_ERROR||l===$.BUFFER_APPEND_ERROR))&&h.some(({audioCodec:L})=>r.audioCodec!==L),Q=e.sourceBufferName==="video"&&(l===$.BUFFER_ADD_CODEC_ERROR||l===$.BUFFER_APPEND_ERROR)&&h.some(({codecSet:L,audioCodec:v})=>r.codecSet!==L&&r.audioCodec===v),{type:m,groupId:y}=(o=e.context)!=null?o:{};for(let L=h.length;L--;){const v=(L+u)%h.length;if(v!==u&&v>=d&&v<=g&&h[v].loadError===0){var a,A;const F=h[v];if(l===$.FRAG_GAP&&e.frag){const G=h[v].details;if(G){const M=nn(e.frag,G.fragments,e.frag.start);if(M!=null&&M.gap)continue}}else{if(m===be.AUDIO_TRACK&&F.hasAudioGroup(y)||m===be.SUBTITLE_TRACK&&F.hasSubtitleGroup(y))continue;if(f===Ee.AUDIO&&(a=r.audioGroups)!=null&&a.some(G=>F.hasAudioGroup(G))||f===Ee.SUBTITLE&&(A=r.subtitleGroups)!=null&&A.some(G=>F.hasSubtitleGroup(G))||B&&r.audioCodec===F.audioCodec||!B&&r.audioCodec!==F.audioCodec||Q&&r.codecSet===F.codecSet)continue}c=v;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:pt.SendAlternateToPenaltyBox,flags:$t.None,nextAutoLevel:c}}return{action:pt.SendAlternateToPenaltyBox,flags:$t.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case pt.DoNothing:break;case pt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==$.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r,hdcpLevel:n,nextAutoLevel:o}=i;switch(r){case $t.None:this.switchLevel(e,o);break;case $t.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=No[No.indexOf(n)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,o)}switchLevel(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}class $o{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=_.log.bind(_,`${t}:`),this.warn=_.warn.bind(_,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t){const i=t==null?void 0:t.renditionReports;if(i){let r=-1;for(let n=0;n<i.length;n++){const o=i[n];let a;try{a=new self.URL(o.URI,t.url).href}catch(A){_.warn(`Could not construct new URL for Rendition Report: ${A}`),a=o.URI||""}if(a===e){r=n;break}else a===e.substring(0,a.length)&&(r=n)}if(r!==-1){const n=i[r],o=parseInt(n["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let a=parseInt(n["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const A=Math.min(t.age-t.partTarget,t.targetduration);a>=0&&A>t.partTarget&&(a+=1)}return new uc(o,a>=0?a:void 0,rr.No)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:r,stats:n}=t,o=self.performance.now(),a=n.loading.first?Math.max(0,o-n.loading.first):0;if(r.advancedDateTime=Date.now()-a,r.live||i!=null&&i.live){if(r.reloaded(i),i&&this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),i&&r.fragments.length>0&&S0(i,r),!this.canLoad||!r.live)return;let A,l,c;if(r.canBlockReload&&r.endSN&&r.advanced){const E=this.hls.config.lowLatencyMode,B=r.lastPartSn,S=r.endSN,Q=r.lastPartIndex,m=Q!==-1,y=B===S,L=E?0:Q;m?(l=y?S+1:B,c=y?L:Q+1):l=S+1;const v=r.age,F=v+r.ageHeader;let G=Math.min(F-r.partTarget,r.targetduration*1.5);if(G>0){if(i&&G>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${G} with playlist age: ${r.age}`),G=0;else{const M=Math.floor(G/r.targetduration);if(l+=M,c!==void 0){const H=Math.round(G%r.targetduration/r.partTarget);c+=H}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${v.toFixed(2)}s goal: ${G} skip sn ${M} to part ${c}`)}r.tuneInGoal=G}if(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c),E||!y){this.loadPlaylist(A);return}}else(r.canBlockReload||r.canSkipUntil)&&(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c));const h=this.hls.mainForwardBufferInfo,u=h?h.end-h.len:0,d=(r.edge-u)*1e3,g=x0(r,d);r.updated&&o>this.requestScheduled+g&&(this.requestScheduled=n.loading.start),l!==void 0&&r.canBlockReload?this.requestScheduled=n.loading.first+g-(r.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+g<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=g);let f=this.requestScheduled-o;f=Math.max(0,f),this.log(`reload live playlist ${e} in ${Math.round(f)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(A),f)}else this.clearTimer()}getDeliveryDirectives(e,t,i,r){let n=w0(e,i);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=rr.No),new uc(i,r,n)}checkRetry(e){const t=e.details,i=sn(e),r=e.errorAction,{action:n,retryCount:o=0,retryConfig:a}=r||{},A=!!r&&!!a&&(n===pt.RetryRequest||!r.resolved&&n===pt.SendAlternateToPenaltyBox);if(A){var l;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(i&&(l=e.context)!=null&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const c=Go(a,o);this.timer=self.setTimeout(()=>this.loadPlaylist(),c),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${c}ms`)}e.levelRetry=!0,r.resolved=!0}return A}}class Es{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class O0{constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Es(e),this.fast_=new Es(t),this.defaultTTFB_=r,this.ttfb_=new Es(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new Es(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Es(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Es(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,r=e/1e3,n=i/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const yc={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Qc={};function N0(s,e,t,i,r,n){const o=s.audioCodec?s.audioGroups:null,a=n==null?void 0:n.audioCodec,A=n==null?void 0:n.channels,l=A?parseInt(A):a?1/0:2;let c=null;if(o!=null&&o.length)try{o.length===1&&o[0]?c=e.groups[o[0]].channels:c=o.reduce((h,u)=>{if(u){const d=e.groups[u];if(!d)throw new Error(`Audio track group ${u} not found`);Object.keys(d.channels).forEach(g=>{h[g]=(h[g]||0)+d.channels[g]})}return h},{2:0})}catch{return!0}return s.videoCodec!==void 0&&(s.width>1920&&s.height>1088||s.height>1920&&s.width>1088||s.frameRate>Math.max(i,30)||s.videoRange!=="SDR"&&s.videoRange!==t||s.bitrate>Math.max(r,8e6))||!!c&&Ae(l)&&Object.keys(c).some(h=>parseInt(h)>l)}function U0(s,e,t){const i=s.videoCodec,r=s.audioCodec;if(!i||!r||!t)return Promise.resolve(yc);const n={width:s.width,height:s.height,bitrate:Math.ceil(Math.max(s.bitrate*.9,s.averageBitrate)),framerate:s.frameRate||30},o=s.videoRange;o!=="SDR"&&(n.transferFunction=o.toLowerCase());const a=i.split(",").map(A=>({type:"media-source",video:At(At({},n),{},{contentType:sr(A,"video")})}));return r&&s.audioGroups&&s.audioGroups.forEach(A=>{var l;A&&((l=e.groups[A])==null||l.tracks.forEach(c=>{if(c.groupId===A){const h=c.channels||"",u=parseFloat(h);Ae(u)&&u>2&&a.push.apply(a,r.split(",").map(d=>({type:"media-source",audio:{contentType:sr(d,"audio"),channels:""+u}})))}}))}),Promise.all(a.map(A=>{const l=P0(A);return Qc[l]||(Qc[l]=t.decodingInfo(A))})).then(A=>({supported:!A.some(l=>!l.supported),configurations:a,decodingInfoResults:A})).catch(A=>({supported:!1,configurations:a,decodingInfoResults:[],error:A}))}function P0(s){const{audio:e,video:t}=s,i=t||e;if(i){const r=i.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${r}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${r}`}return""}function G0(){if(typeof matchMedia=="function"){const s=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(s.media!==e.media)return s.matches===!0}return!1}function H0(s,e){let t=!1,i=[];return s&&(t=s!=="SDR",i=[s]),e&&(i=e.allowedVideoRanges||tn.slice(0),t=e.preferHDR!==void 0?e.preferHDR:G0(),t?i=i.filter(r=>r!=="SDR"):i=["SDR"]),{preferHDR:t,allowedVideoRanges:i}}function $0(s,e,t,i,r){const n=Object.keys(s),o=i==null?void 0:i.channels,a=i==null?void 0:i.audioCodec,A=o&&parseInt(o)===2;let l=!0,c=!1,h=1/0,u=1/0,d=1/0,g=0,f=[];const{preferHDR:E,allowedVideoRanges:B}=H0(e,r);for(let y=n.length;y--;){const L=s[n[y]];l=L.channels[2]>0,h=Math.min(h,L.minHeight),u=Math.min(u,L.minFramerate),d=Math.min(d,L.minBitrate);const v=B.filter(F=>L.videoRanges[F]>0);v.length>0&&(c=!0,f=v)}h=Ae(h)?h:0,u=Ae(u)?u:0;const S=Math.max(1080,h),Q=Math.max(30,u);return d=Ae(d)?d:t,t=Math.max(d,t),c||(e=void 0,f=[]),{codecSet:n.reduce((y,L)=>{const v=s[L];if(L===y)return y;if(v.minBitrate>t)return Ci(L,`min bitrate of ${v.minBitrate} > current estimate of ${t}`),y;if(!v.hasDefaultAudio)return Ci(L,"no renditions with default or auto-select sound found"),y;if(a&&L.indexOf(a.substring(0,4))%5!==0)return Ci(L,`audio codec preference "${a}" not found`),y;if(o&&!A){if(!v.channels[o])return Ci(L,`no renditions with ${o} channel sound found (channels options: ${Object.keys(v.channels)})`),y}else if((!a||A)&&l&&v.channels[2]===0)return Ci(L,"no renditions with stereo sound found"),y;return v.minHeight>S?(Ci(L,`min resolution of ${v.minHeight} > maximum of ${S}`),y):v.minFramerate>Q?(Ci(L,`min framerate of ${v.minFramerate} > maximum of ${Q}`),y):f.some(F=>v.videoRanges[F]>0)?v.maxScore<g?(Ci(L,`max score of ${v.maxScore} < selected max of ${g}`),y):y&&(Xr(L)>=Xr(y)||v.fragmentError>s[y].fragmentError)?y:(g=v.maxScore,L):(Ci(L,`no variants with VIDEO-RANGE of ${JSON.stringify(f)} found`),y)},void 0),videoRanges:f,preferHDR:E,minFramerate:u,minBitrate:d}}function Ci(s,e){_.log(`[abr] start candidates with "${s}" ignored because ${e}`)}function K0(s){return s.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const r=t.channels||"2";return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Y0(s,e,t,i){return s.slice(t,i+1).reduce((r,n)=>{if(!n.codecSet)return r;const o=n.audioGroups;let a=r[n.codecSet];a||(r[n.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,n.bitrate);const A=Math.min(n.height,n.width);return a.minHeight=Math.min(a.minHeight,A),a.minFramerate=Math.min(a.minFramerate,n.frameRate),a.maxScore=Math.max(a.maxScore,n.score),a.fragmentError+=n.fragmentError,a.videoRanges[n.videoRange]=(a.videoRanges[n.videoRange]||0)+1,o&&o.forEach(l=>{if(!l)return;const c=e.groups[l];a.hasDefaultAudio=a.hasDefaultAudio||e.hasDefaultAudio?c.hasDefault:c.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(c.channels).forEach(h=>{a.channels[h]=(a.channels[h]||0)+c.channels[h]})}),r},{})}function ii(s,e,t){if("attrs"in s){const i=e.indexOf(s);if(i!==-1)return i}for(let i=0;i<e.length;i++){const r=e[i];if(ps(s,r,t))return i}return-1}function ps(s,e,t){const{groupId:i,name:r,lang:n,assocLang:o,characteristics:a,default:A}=s,l=s.forced;return(i===void 0||e.groupId===i)&&(r===void 0||e.name===r)&&(n===void 0||e.lang===n)&&(n===void 0||e.assocLang===o)&&(A===void 0||e.default===A)&&(l===void 0||e.forced===l)&&(a===void 0||V0(a,e.characteristics))&&(t===void 0||t(s,e))}function V0(s,e=""){const t=s.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function Is(s,e){const{audioCodec:t,channels:i}=s;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function J0(s,e,t,i,r){const n=e[i],a=e.reduce((u,d,g)=>{const f=d.uri;return(u[f]||(u[f]=[])).push(g),u},{})[n.uri];a.length>1&&(i=Math.max.apply(Math,a));const A=n.videoRange,l=n.frameRate,c=n.codecSet.substring(0,4),h=vc(e,i,u=>{if(u.videoRange!==A||u.frameRate!==l||u.codecSet.substring(0,4)!==c)return!1;const d=u.audioGroups,g=t.filter(f=>!d||d.indexOf(f.groupId)!==-1);return ii(s,g,r)>-1});return h>-1?h:vc(e,i,u=>{const d=u.audioGroups,g=t.filter(f=>!d||d.indexOf(f.groupId)!==-1);return ii(s,g,r)>-1})}function vc(s,e,t){for(let i=e;i;i--)if(t(s[i]))return i;for(let i=e+1;i<s.length;i++)if(t(s[i]))return i;return-1}class W0{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:i,hls:r}=this,{autoLevelEnabled:n,media:o}=r;if(!t||!o)return;const a=performance.now(),A=i?i.stats:t.stats,l=i?i.duration:t.duration,c=a-A.loading.start,h=r.minAutoLevel;if(A.aborted||A.loaded&&A.loaded===A.total||t.level<=h){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||o.paused||!o.playbackRate||!o.readyState)return;const u=r.mainForwardBufferInfo;if(u===null)return;const d=this.bwEstimator.getEstimateTTFB(),g=Math.abs(o.playbackRate);if(c<=Math.max(d,1e3*(l/(g*2))))return;const f=u.len/g,E=A.loading.first?A.loading.first-A.loading.start:-1,B=A.loaded&&E>-1,S=this.getBwEstimate(),Q=r.levels,m=Q[t.level],y=A.total||Math.max(A.loaded,Math.round(l*m.averageBitrate/8));let L=B?c-E:c;L<1&&B&&(L=Math.min(c,A.loaded*8/S));const v=B?A.loaded*1e3/L:0,F=v?(y-A.loaded)/v:y*8/S+d/1e3;if(F<=f)return;const G=v?v*8:S;let M=Number.POSITIVE_INFINITY,H;for(H=t.level-1;H>h;H--){const U=Q[H].maxBitrate;if(M=this.getTimeToLoadFrag(d/1e3,G,l*U,!Q[H].details),M<f)break}if(M>=F||M>l*10)return;r.nextLoadLevel=r.nextAutoLevel=H,B?this.bwEstimator.sample(c-Math.min(d,E),A.loaded):this.bwEstimator.sampleTTFB(c);const j=Q[H].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>j&&this.resetEstimator(j),this.clearTimer(),_.warn(`[abr] Fragment ${t.sn}${i?" part "+i.index:""} of level ${t.level} is loading too slowly;
161
+ */const Ol="important",Mf=" !"+Ol,rr=us(class extends Ws{constructor(s){var e;if(super(s),s.type!==cs.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,t)=>{const i=s[t];return i==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:t}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?t.removeProperty(i):t[i]=null);for(const i in e){const r=e[i];if(r!=null){this.ft.add(i);const n=typeof r=="string"&&r.endsWith(Mf);i.includes("-")||n?t.setProperty(i,n?r.slice(0,-11):r,n?Ol:""):t[i]=r}}return Ht}});function Pf(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Ul={exports:{}};(function(s,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(A,l,c){if(c=c||{},A=A.trim(),l=l.trim(),!l){if(!c.alwaysNormalize)return A;var u=a.parseURL(A);if(!u)throw new Error("Error trying to parse base URL.");return u.path=a.normalizePath(u.path),a.buildURLFromParts(u)}var h=a.parseURL(l);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return c.alwaysNormalize?(h.path=a.normalizePath(h.path),a.buildURLFromParts(h)):l;var d=a.parseURL(A);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var g=r.exec(d.path);d.netLoc=g[1],d.path=g[2]}d.netLoc&&!d.path&&(d.path="/");var f={scheme:d.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(f.netLoc=d.netLoc,h.path[0]!=="/"))if(!h.path)f.path=d.path,h.params||(f.params=d.params,h.query||(f.query=d.query));else{var p=d.path,v=p.substring(0,p.lastIndexOf("/")+1)+h.path;f.path=a.normalizePath(v)}return f.path===null&&(f.path=c.alwaysNormalize?a.normalizePath(h.path):h.path),a.buildURLFromParts(f)},parseURL:function(A){var l=i.exec(A);return l?{scheme:l[1]||"",netLoc:l[2]||"",path:l[3]||"",params:l[4]||"",query:l[5]||"",fragment:l[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(n,"");A.length!==(A=A.replace(o,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};s.exports=a})()})(Ul);var Mo=Ul.exports;function Gl(s,e){var t=Object.keys(s);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(s,r).enumerable})),t.push.apply(t,i)}return t}function lt(s){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gl(Object(t),!0).forEach(function(i){Gf(s,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):Gl(Object(t)).forEach(function(i){Object.defineProperty(s,i,Object.getOwnPropertyDescriptor(t,i))})}return s}function Of(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var i=t.call(s,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function Uf(s){var e=Of(s,"string");return typeof e=="symbol"?e:String(e)}function Gf(s,e,t){return e=Uf(e),e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function tt(){return tt=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},tt.apply(this,arguments)}const oe=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},Hf=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=$f},$f=Number.MAX_SAFE_INTEGER||9007199254740991;let E=function(s){return s.MEDIA_ATTACHING="hlsMediaAttaching",s.MEDIA_ATTACHED="hlsMediaAttached",s.MEDIA_DETACHING="hlsMediaDetaching",s.MEDIA_DETACHED="hlsMediaDetached",s.BUFFER_RESET="hlsBufferReset",s.BUFFER_CODECS="hlsBufferCodecs",s.BUFFER_CREATED="hlsBufferCreated",s.BUFFER_APPENDING="hlsBufferAppending",s.BUFFER_APPENDED="hlsBufferAppended",s.BUFFER_EOS="hlsBufferEos",s.BUFFER_FLUSHING="hlsBufferFlushing",s.BUFFER_FLUSHED="hlsBufferFlushed",s.MANIFEST_LOADING="hlsManifestLoading",s.MANIFEST_LOADED="hlsManifestLoaded",s.MANIFEST_PARSED="hlsManifestParsed",s.LEVEL_SWITCHING="hlsLevelSwitching",s.LEVEL_SWITCHED="hlsLevelSwitched",s.LEVEL_LOADING="hlsLevelLoading",s.LEVEL_LOADED="hlsLevelLoaded",s.LEVEL_UPDATED="hlsLevelUpdated",s.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",s.LEVELS_UPDATED="hlsLevelsUpdated",s.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",s.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",s.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",s.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",s.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",s.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",s.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",s.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",s.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",s.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",s.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",s.CUES_PARSED="hlsCuesParsed",s.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",s.INIT_PTS_FOUND="hlsInitPtsFound",s.FRAG_LOADING="hlsFragLoading",s.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",s.FRAG_LOADED="hlsFragLoaded",s.FRAG_DECRYPTED="hlsFragDecrypted",s.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",s.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",s.FRAG_PARSING_METADATA="hlsFragParsingMetadata",s.FRAG_PARSED="hlsFragParsed",s.FRAG_BUFFERED="hlsFragBuffered",s.FRAG_CHANGED="hlsFragChanged",s.FPS_DROP="hlsFpsDrop",s.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",s.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",s.ERROR="hlsError",s.DESTROYING="hlsDestroying",s.KEY_LOADING="hlsKeyLoading",s.KEY_LOADED="hlsKeyLoaded",s.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",s.BACK_BUFFER_REACHED="hlsBackBufferReached",s.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",s}({}),Ee=function(s){return s.NETWORK_ERROR="networkError",s.MEDIA_ERROR="mediaError",s.KEY_SYSTEM_ERROR="keySystemError",s.MUX_ERROR="muxError",s.OTHER_ERROR="otherError",s}({}),$=function(s){return s.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",s.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",s.KEY_SYSTEM_NO_SESSION="keySystemNoSession",s.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",s.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",s.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",s.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",s.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",s.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",s.MANIFEST_LOAD_ERROR="manifestLoadError",s.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",s.MANIFEST_PARSING_ERROR="manifestParsingError",s.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",s.LEVEL_EMPTY_ERROR="levelEmptyError",s.LEVEL_LOAD_ERROR="levelLoadError",s.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",s.LEVEL_PARSING_ERROR="levelParsingError",s.LEVEL_SWITCH_ERROR="levelSwitchError",s.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",s.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",s.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",s.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",s.FRAG_LOAD_ERROR="fragLoadError",s.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",s.FRAG_DECRYPT_ERROR="fragDecryptError",s.FRAG_PARSING_ERROR="fragParsingError",s.FRAG_GAP="fragGap",s.REMUX_ALLOC_ERROR="remuxAllocError",s.KEY_LOAD_ERROR="keyLoadError",s.KEY_LOAD_TIMEOUT="keyLoadTimeOut",s.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",s.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",s.BUFFER_APPEND_ERROR="bufferAppendError",s.BUFFER_APPENDING_ERROR="bufferAppendingError",s.BUFFER_STALLED_ERROR="bufferStalledError",s.BUFFER_FULL_ERROR="bufferFullError",s.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",s.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",s.INTERNAL_EXCEPTION="internalException",s.INTERNAL_ABORTED="aborted",s.UNKNOWN="unknown",s}({});const ji=function(){},Po={trace:ji,debug:ji,log:ji,warn:ji,info:ji,error:ji};let nr=Po;function Yf(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):ji}function Kf(s,...e){e.forEach(function(t){nr[t]=s[t]?s[t].bind(s):Yf(t)})}function Vf(s,e){if(typeof console=="object"&&s===!0||typeof s=="object"){Kf(s,"debug","log","info","warn","error");try{nr.log(`Debug logs enabled for "${e}" in hls.js version 1.5.11`)}catch{nr=Po}}else nr=Po}const N=nr,Jf=/^(\d+)x(\d+)$/,Hl=/(.+?)=(".*?"|.*?)(?:,|$)/g;class qe{constructor(e){typeof e=="string"&&(e=qe.parseAttrList(e)),tt(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)i[r]=parseInt(t.slice(r*2,r*2+2),16);return i}else return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Jf.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={},r='"';for(Hl.lastIndex=0;(t=Hl.exec(e))!==null;){let n=t[2];n.indexOf(r)===0&&n.lastIndexOf(r)===n.length-1&&(n=n.slice(1,-1));const o=t[1].trim();i[o]=n}return i}}function Wf(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function qf(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class $l{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const r in i)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==i[r]){N.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=tt(new qe({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=new Date(this.attr["END-DATE"]);oe(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(oe(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&oe(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class rn{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var Pe={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Yl{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Pe.AUDIO]:null,[Pe.VIDEO]:null,[Pe.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let r;i.length===1?r=(t==null?void 0:t.byteRangeEndOffset)||0:r=parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Mo.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class Oo extends Yl{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new rn,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!oe(this.programDateTime))return null;const e=oe(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,r,n,o=!1){const{elementaryStreams:a}=this,A=a[e];if(!A){a[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:o};return}A.startPTS=Math.min(A.startPTS,t),A.endPTS=Math.max(A.endPTS,i),A.startDTS=Math.min(A.startDTS,r),A.endDTS=Math.max(A.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Pe.AUDIO]=null,e[Pe.VIDEO]=null,e[Pe.AUDIOVIDEO]=null}}class jf extends Yl{constructor(e,t,i,r,n){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new rn,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,n),n&&(this.fragOffset=n.fragOffset+n.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}const Xf=10;class zf{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?oe(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Xf}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Uo(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function Zf(s){const e=Go(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function e0(s){const e=function(i,r,n){const o=i[r];i[r]=i[n],i[n]=o};e(s,0,3),e(s,1,2),e(s,4,5),e(s,6,7)}function t0(s){const e=s.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),r=i[i.length-1].split(",");if(r.length===2){const n=r[0]==="base64",o=r[1];n?(i.splice(-1,1),t=Uo(o)):t=Zf(o)}}return t}function Go(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}const fs=typeof self<"u"?self:void 0;var Je={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},wt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Kl(s){switch(s){case wt.FAIRPLAY:return Je.FAIRPLAY;case wt.PLAYREADY:return Je.PLAYREADY;case wt.WIDEVINE:return Je.WIDEVINE;case wt.CLEARKEY:return Je.CLEARKEY}}var Vl={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function i0(s){if(s===Vl.WIDEVINE)return Je.WIDEVINE}function Jl(s){switch(s){case Je.FAIRPLAY:return wt.FAIRPLAY;case Je.PLAYREADY:return wt.PLAYREADY;case Je.WIDEVINE:return wt.WIDEVINE;case Je.CLEARKEY:return wt.CLEARKEY}}function Ho(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[Je.FAIRPLAY,Je.WIDEVINE,Je.PLAYREADY,Je.CLEARKEY].filter(r=>!!e[r]):[];return!i[Je.WIDEVINE]&&t&&i.push(Je.WIDEVINE),i}const Wl=function(s){return fs!=null&&(s=fs.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function s0(s,e,t,i){let r;switch(s){case Je.FAIRPLAY:r=["cenc","sinf"];break;case Je.WIDEVINE:case Je.PLAYREADY:r=["cenc"];break;case Je.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return r0(r,e,t,i)}function r0(s,e,t,i){return[{initDataTypes:s,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function Xi(s,e,t){return Uint8Array.prototype.slice?s.slice(e,t):new Uint8Array(Array.prototype.slice.call(s,e,t))}const $o=(s,e)=>e+10<=s.length&&s[e]===73&&s[e+1]===68&&s[e+2]===51&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,ql=(s,e)=>e+10<=s.length&&s[e]===51&&s[e+1]===68&&s[e+2]===73&&s[e+3]<255&&s[e+4]<255&&s[e+6]<128&&s[e+7]<128&&s[e+8]<128&&s[e+9]<128,or=(s,e)=>{const t=e;let i=0;for(;$o(s,e);){i+=10;const r=nn(s,e+6);i+=r,ql(s,e+10)&&(i+=10),e+=i}if(i>0)return s.subarray(t,t+i)},nn=(s,e)=>{let t=0;return t=(s[e]&127)<<21,t|=(s[e+1]&127)<<14,t|=(s[e+2]&127)<<7,t|=s[e+3]&127,t},n0=(s,e)=>$o(s,e)&&nn(s,e+6)+10<=s.length-e,Yo=s=>{const e=Xl(s);for(let t=0;t<e.length;t++){const i=e[t];if(jl(i))return u0(i)}},jl=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",o0=s=>{const e=String.fromCharCode(s[0],s[1],s[2],s[3]),t=nn(s,4),i=10;return{type:e,size:t,data:s.subarray(i,i+t)}},Xl=s=>{let e=0;const t=[];for(;$o(s,e);){const i=nn(s,e+6);e+=10;const r=e+i;for(;e+8<r;){const n=o0(s.subarray(e)),o=a0(n);o&&t.push(o),e+=n.size+10}ql(s,e)&&(e+=10)}return t},a0=s=>s.type==="PRIV"?A0(s):s.type[0]==="W"?c0(s):l0(s),A0=s=>{if(s.size<2)return;const e=ei(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},l0=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=ei(s.data.subarray(t),!0);t+=i.length+1;const r=ei(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=ei(s.data.subarray(1));return{key:s.type,data:e}},c0=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=ei(s.data.subarray(t),!0);t+=i.length+1;const r=ei(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=ei(s.data);return{key:s.type,data:e}},u0=s=>{if(s.data.byteLength===8){const e=new Uint8Array(s.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}},ei=(s,e=!1)=>{const t=h0();if(t){const l=t.decode(s);if(e){const c=l.indexOf("\0");return c!==-1?l.substring(0,c):l}return l.replace(/\0/g,"")}const i=s.length;let r,n,o,a="",A=0;for(;A<i;){if(r=s[A++],r===0&&e)return a;if(r===0||r===3)continue;switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(r);break;case 12:case 13:n=s[A++],a+=String.fromCharCode((r&31)<<6|n&63);break;case 14:n=s[A++],o=s[A++],a+=String.fromCharCode((r&15)<<12|(n&63)<<6|(o&63)<<0);break}}return a};let Ko;function h0(){if(!navigator.userAgent.includes("PlayStation 4"))return!Ko&&typeof self.TextDecoder<"u"&&(Ko=new self.TextDecoder("utf-8")),Ko}const ti={hexDump:function(s){let e="";for(let t=0;t<s.length;t++){let i=s[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}},on=Math.pow(2,32)-1,d0=[].push,zl={video:1,audio:2,id3:3,text:4};function At(s){return String.fromCharCode.apply(null,s)}function Zl(s,e){const t=s[e]<<8|s[e+1];return t<0?65536+t:t}function he(s,e){const t=tc(s,e);return t<0?4294967296+t:t}function ec(s,e){let t=he(s,e);return t*=Math.pow(2,32),t+=he(s,e+4),t}function tc(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function Vo(s,e,t){s[e]=t>>24,s[e+1]=t>>16&255,s[e+2]=t>>8&255,s[e+3]=t&255}function g0(s){const e=s.byteLength;for(let t=0;t<e;){const i=he(s,t);if(i>8&&s[t+4]===109&&s[t+5]===111&&s[t+6]===111&&s[t+7]===102)return!0;t=i>1?t+i:e}return!1}function ve(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let r=0;r<i;){const n=he(s,r),o=At(s.subarray(r+4,r+8)),a=n>1?r+n:i;if(o===e[0])if(e.length===1)t.push(s.subarray(r+8,a));else{const A=ve(s.subarray(r+8,a),e.slice(1));A.length&&d0.apply(t,A)}r=a}return t}function f0(s){const e=[],t=s[0];let i=8;const r=he(s,i);i+=4;let n=0,o=0;t===0?(n=he(s,i),o=he(s,i+4),i+=8):(n=ec(s,i),o=ec(s,i+8),i+=16),i+=2;let a=s.length+o;const A=Zl(s,i);i+=2;for(let l=0;l<A;l++){let c=i;const u=he(s,c);c+=4;const h=u&2147483647;if((u&2147483648)>>>31===1)return N.warn("SIDX has hierarchical references (not supported)"),null;const g=he(s,c);c+=4,e.push({referenceSize:h,subsegmentDuration:g,info:{duration:g/r,start:a,end:a+h-1}}),a+=h,c+=4,i=c}return{earliestPresentationTime:n,timescale:r,version:t,referencesCount:A,references:e}}function ic(s){const e=[],t=ve(s,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],o=ve(n,["tkhd"])[0];if(o){let a=o[0];const A=he(o,a===0?12:20),l=ve(n,["mdia","mdhd"])[0];if(l){a=l[0];const c=he(l,a===0?12:20),u=ve(n,["mdia","hdlr"])[0];if(u){const h=At(u.subarray(8,12)),d={soun:Pe.AUDIO,vide:Pe.VIDEO}[h];if(d){const g=ve(n,["mdia","minf","stbl","stsd"])[0],f=p0(g);e[A]={timescale:c,type:d},e[d]=lt({timescale:c,id:A},f)}}}}}return ve(s,["moov","mvex","trex"]).forEach(r=>{const n=he(r,4),o=e[n];o&&(o.default={duration:he(r,12),flags:he(r,20)})}),e}function p0(s){const e=s.subarray(8),t=e.subarray(86),i=At(e.subarray(4,8));let r=i;const n=i==="enca"||i==="encv";if(n){const a=ve(e,[i])[0].subarray(i==="enca"?28:78);ve(a,["sinf"]).forEach(l=>{const c=ve(l,["schm"])[0];if(c){const u=At(c.subarray(4,8));if(u==="cbcs"||u==="cenc"){const h=ve(l,["frma"])[0];h&&(r=At(h))}}})}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const o=ve(t,["avcC"])[0];r+="."+an(o[1])+an(o[2])+an(o[3]);break}case"mp4a":{const o=ve(e,[i])[0],a=ve(o.subarray(28),["esds"])[0];if(a&&a.length>12){let A=4;if(a[A++]!==3)break;A=Jo(a,A),A+=2;const l=a[A++];if(l&128&&(A+=2),l&64&&(A+=a[A++]),a[A++]!==4)break;A=Jo(a,A);const c=a[A++];if(c===64)r+="."+an(c);else break;if(A+=12,a[A++]!==5)break;A=Jo(a,A);const u=a[A++];let h=(u&248)>>3;h===31&&(h+=1+((u&7)<<3)+((a[A]&224)>>5)),r+="."+h}break}case"hvc1":case"hev1":{const o=ve(t,["hvcC"])[0],a=o[1],A=["","A","B","C"][a>>6],l=a&31,c=he(o,2),u=(a&32)>>5?"H":"L",h=o[12],d=o.subarray(6,12);r+="."+A+l,r+="."+c.toString(16).toUpperCase(),r+="."+u+h;let g="";for(let f=d.length;f--;){const p=d[f];(p||g)&&(g="."+p.toString(16).toUpperCase()+g)}r+=g;break}case"dvh1":case"dvhe":{const o=ve(t,["dvcC"])[0],a=o[2]>>1&127,A=o[2]<<5&32|o[3]>>3&31;r+="."+ii(a)+"."+ii(A);break}case"vp09":{const o=ve(t,["vpcC"])[0],a=o[4],A=o[5],l=o[6]>>4&15;r+="."+ii(a)+"."+ii(A)+"."+ii(l);break}case"av01":{const o=ve(t,["av1C"])[0],a=o[1]>>>5,A=o[1]&31,l=o[2]>>>7?"H":"M",c=(o[2]&64)>>6,u=(o[2]&32)>>5,h=a===2&&c?u?12:10:c?10:8,d=(o[2]&16)>>4,g=(o[2]&8)>>3,f=(o[2]&4)>>2,p=o[2]&3;r+="."+a+"."+ii(A)+l+"."+ii(h)+"."+d+"."+g+f+p+"."+ii(1)+"."+ii(1)+"."+ii(1)+"."+0;break}}return{codec:r,encrypted:n}}function Jo(s,e){const t=e+5;for(;s[e++]&128&&e<t;);return e}function an(s){return("0"+s.toString(16).toUpperCase()).slice(-2)}function ii(s){return(s<10?"0":"")+s}function E0(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&ve(s,["moov","trak"]).forEach(r=>{const o=ve(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=ve(o,["enca"]);const A=a.length>0;A||(a=ve(o,["encv"])),a.forEach(l=>{const c=A?l.subarray(28):l.subarray(78);ve(c,["sinf"]).forEach(h=>{const d=sc(h);if(d){const g=d.subarray(8,24);g.some(f=>f!==0)||(N.log(`[eme] Patching keyId in 'enc${A?"a":"v"}>sinf>>tenc' box: ${ti.hexDump(g)} -> ${ti.hexDump(t)}`),d.set(t,8))}})})}),s}function sc(s){const e=ve(s,["schm"])[0];if(e){const t=At(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ve(s,["schi","tenc"])[0]}return N.error("[eme] missing 'schm' box"),null}function I0(s,e){return ve(e,["moof","traf"]).reduce((t,i)=>{const r=ve(i,["tfdt"])[0],n=r[0],o=ve(i,["tfhd"]).reduce((a,A)=>{const l=he(A,4),c=s[l];if(c){let u=he(r,4);if(n===1){if(u===on)return N.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;u*=on+1,u+=he(r,8)}const h=c.timescale||9e4,d=u/h;if(oe(d)&&(a===null||d<a))return d}return a},null);return o!==null&&oe(o)&&(t===null||o<t)?o:t},null)}function m0(s,e){let t=0,i=0,r=0;const n=ve(s,["moof","traf"]);for(let o=0;o<n.length;o++){const a=n[o],A=ve(a,["tfhd"])[0],l=he(A,4),c=e[l];if(!c)continue;const u=c.default,h=he(A,0)|(u==null?void 0:u.flags);let d=u==null?void 0:u.duration;h&8&&(h&2?d=he(A,12):d=he(A,8));const g=c.timescale||9e4,f=ve(a,["trun"]);for(let p=0;p<f.length;p++){if(t=C0(f[p]),!t&&d){const v=he(f[p],4);t=d*v}c.type===Pe.VIDEO?i+=t/g:c.type===Pe.AUDIO&&(r+=t/g)}}if(i===0&&r===0){let o=1/0,a=0,A=0;const l=ve(s,["sidx"]);for(let c=0;c<l.length;c++){const u=f0(l[c]);if(u!=null&&u.references){o=Math.min(o,u.earliestPresentationTime/u.timescale);const h=u.references.reduce((d,g)=>d+g.info.duration||0,0);a=Math.max(a,h+u.earliestPresentationTime/u.timescale),A=a-o}}if(A&&oe(A))return A}return i||r}function C0(s){const e=he(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const r=he(s,4);for(let n=0;n<r;n++){if(e&256){const o=he(s,t);i+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function v0(s,e,t){ve(e,["moof","traf"]).forEach(i=>{ve(i,["tfhd"]).forEach(r=>{const n=he(r,4),o=s[n];if(!o)return;const a=o.timescale||9e4;ve(i,["tfdt"]).forEach(A=>{const l=A[0],c=t*a;if(c){let u=he(A,4);if(l===0)u-=c,u=Math.max(u,0),Vo(A,4,u);else{u*=Math.pow(2,32),u+=he(A,8),u-=c,u=Math.max(u,0);const h=Math.floor(u/(on+1)),d=Math.floor(u%(on+1));Vo(A,4,h),Vo(A,8,d)}}})})})}function y0(s){const e={valid:null,remainder:null},t=ve(s,["moof"]);if(t.length<2)return e.remainder=s,e;const i=t[t.length-1];return e.valid=Xi(s,0,i.byteOffset-8),e.remainder=Xi(s,i.byteOffset-8),e}function Ft(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function rc(s,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let o=!1;return ve(i,["moof"]).map(A=>{const l=A.byteOffset-8;ve(A,["traf"]).map(u=>{const h=ve(u,["tfdt"]).map(d=>{const g=d[0];let f=he(d,4);return g===1&&(f*=Math.pow(2,32),f+=he(d,8)),f/r})[0];return h!==void 0&&(s=h),ve(u,["tfhd"]).map(d=>{const g=he(d,4),f=he(d,0)&16777215,p=(f&1)!==0,v=(f&2)!==0,y=(f&8)!==0;let Q=0;const m=(f&16)!==0;let b=0;const x=(f&32)!==0;let B=8;g===n&&(p&&(B+=8),v&&(B+=4),y&&(Q=he(d,B),B+=4),m&&(b=he(d,B),B+=4),x&&(B+=4),e.type==="video"&&(o=B0(e.codec)),ve(u,["trun"]).map(H=>{const _=H[0],k=he(H,0)&16777215,U=(k&1)!==0;let q=0;const V=(k&4)!==0,Z=(k&256)!==0;let S=0;const T=(k&512)!==0;let O=0;const R=(k&1024)!==0,w=(k&2048)!==0;let L=0;const K=he(H,4);let G=8;U&&(q=he(H,G),G+=4),V&&(G+=4);let j=q+l;for(let te=0;te<K;te++){if(Z?(S=he(H,G),G+=4):S=Q,T?(O=he(H,G),G+=4):O=b,R&&(G+=4),w&&(_===0?L=he(H,G):L=tc(H,G),G+=4),e.type===Pe.VIDEO){let ue=0;for(;ue<O;){const ce=he(i,j);if(j+=4,Q0(o,i[j])){const me=i.subarray(j,j+ce);nc(me,o?2:1,s+L/r,t)}j+=ce,ue+=ce+4}}s+=S/r}}))})})}),t}function B0(s){if(!s)return!1;const e=s.indexOf("."),t=e<0?s:s.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function Q0(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function nc(s,e,t,i){const r=oc(s);let n=0;n+=e;let o=0,a=0,A=0;for(;n<r.length;){o=0;do{if(n>=r.length)break;A=r[n++],o+=A}while(A===255);a=0;do{if(n>=r.length)break;A=r[n++],a+=A}while(A===255);const l=r.length-n;let c=n;if(a<l)n+=a;else if(a>l){N.error(`Malformed SEI payload. ${a} is too small, only ${l} bytes left to parse.`);break}if(o===4){if(r[c++]===181){const h=Zl(r,c);if(c+=2,h===49){const d=he(r,c);if(c+=4,d===1195456820){const g=r[c++];if(g===3){const f=r[c++],p=31&f,v=64&f,y=v?2+p*3:0,Q=new Uint8Array(y);if(v){Q[0]=f;for(let m=1;m<y;m++)Q[m]=r[c++]}i.push({type:g,payloadType:o,pts:t,bytes:Q})}}}}}else if(o===5&&a>16){const u=[];for(let g=0;g<16;g++){const f=r[c++].toString(16);u.push(f.length==1?"0"+f:f),(g===3||g===5||g===7||g===9)&&u.push("-")}const h=a-16,d=new Uint8Array(h);for(let g=0;g<h;g++)d[g]=r[c++];i.push({payloadType:o,pts:t,uuid:u.join(""),userData:ei(d),userDataBytes:d})}}}function oc(s){const e=s.byteLength,t=[];let i=1;for(;i<e-2;)s[i]===0&&s[i+1]===0&&s[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return s;const r=e-t.length,n=new Uint8Array(r);let o=0;for(i=0;i<r;o++,i++)o===t[0]&&(o++,t.shift()),n[i]=s[o];return n}function b0(s){const e=s[0];let t="",i="",r=0,n=0,o=0,a=0,A=0,l=0;if(e===0){for(;At(s.subarray(l,l+1))!=="\0";)t+=At(s.subarray(l,l+1)),l+=1;for(t+=At(s.subarray(l,l+1)),l+=1;At(s.subarray(l,l+1))!=="\0";)i+=At(s.subarray(l,l+1)),l+=1;i+=At(s.subarray(l,l+1)),l+=1,r=he(s,12),n=he(s,16),a=he(s,20),A=he(s,24),l=28}else if(e===1){l+=4,r=he(s,l),l+=4;const u=he(s,l);l+=4;const h=he(s,l);for(l+=4,o=4294967296*u+h,Hf(o)||(o=Number.MAX_SAFE_INTEGER,N.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=he(s,l),l+=4,A=he(s,l),l+=4;At(s.subarray(l,l+1))!=="\0";)t+=At(s.subarray(l,l+1)),l+=1;for(t+=At(s.subarray(l,l+1)),l+=1;At(s.subarray(l,l+1))!=="\0";)i+=At(s.subarray(l,l+1)),l+=1;i+=At(s.subarray(l,l+1)),l+=1}const c=s.subarray(l,s.byteLength);return{schemeIdUri:t,value:i,timeScale:r,presentationTime:o,presentationTimeDelta:n,eventDuration:a,id:A,payload:c}}function S0(s,...e){const t=e.length;let i=8,r=t;for(;r--;)i+=e[r].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=i&255,n.set(s,4),r=0,i=8;r<t;r++)n.set(e[r],i),i+=e[r].byteLength;return n}function w0(s,e,t){if(s.byteLength!==16)throw new RangeError("Invalid system id");let i,r;if(e){i=1,r=new Uint8Array(e.length*16);for(let a=0;a<e.length;a++){const A=e[a];if(A.byteLength!==16)throw new RangeError("Invalid key");r.set(A,a*16)}}else i=0,r=new Uint8Array;let n;i>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),S0([112,115,115,104],new Uint8Array([i,0,0,0]),s,n,r,o,t||new Uint8Array)}function R0(s){if(!(s instanceof ArrayBuffer)||s.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(s),i=t.getUint32(0);if(s.byteLength!==i&&i>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=ti.hexDump(new Uint8Array(s,12,16));const n=t.getUint32(28);if(e.version===0){if(i-32<n)return null;e.data=new Uint8Array(s,32,n)}else if(e.version===1){e.kids=[];for(let o=0;o<n;o++)e.kids.push(new Uint8Array(s,32+o*16,16))}return e}let An={};class ar{static clearKeyUriToKeyIdMap(){An={}}constructor(e,t,i,r=[1],n=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case wt.FAIRPLAY:case wt.WIDEVINE:case wt.PLAYREADY:case wt.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&N.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=x0(e);return new ar(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=t0(this.uri);if(t)switch(this.keyFormat){case wt.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case wt.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=w0(i,null,t);const r=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(r)),o=n.substring(n.indexOf("<"),n.length),l=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(l){const c=l.childNodes[0]?l.childNodes[0].nodeValue:l.getAttribute("VALUE");if(c){const u=Uo(c).subarray(0,16);e0(u),this.keyId=u}}break}default:{let i=t.subarray(0,16);if(i.length!==16){const r=new Uint8Array(16);r.set(i,16-i.length),i=r}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=An[this.uri];if(!i){const r=Object.keys(An).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,r),An[this.uri]=i}this.keyId=i}return this}}function x0(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const ac=/\{\$([a-zA-Z0-9-_]+)\}/g;function Ac(s){return ac.test(s)}function Rt(s,e,t){if(s.variableList!==null||s.hasVariableRefs)for(let i=t.length;i--;){const r=t[i],n=e[r];n&&(e[r]=Wo(s,n))}}function Wo(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(ac,i=>{const r=i.substring(2,i.length-1),n=t==null?void 0:t[r];return n===void 0?(s.playlistParsingError||(s.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),i):n})}return e}function lc(s,e,t){let i=s.variableList;i||(s.variableList=i={});let r,n;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(r))n=o.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(o){s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else r=e.NAME,n=e.VALUE;r in i?s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):i[r]=n||""}function T0(s,e,t){const i=e.IMPORT;if(t&&i in t){let r=s.variableList;r||(s.variableList=r={}),r[i]=t[i]}else s.playlistParsingError||(s.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}function zi(s=!0){return typeof self>"u"?void 0:(s||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function D0(s){return typeof self<"u"&&s===self.ManagedMediaSource}const ln={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function L0(s,e){const t=ln[e];return!!t&&!!t[s.slice(0,4)]}function qo(s,e,t=!0){return!s.split(",").some(i=>!cc(i,e,t))}function cc(s,e,t=!0){var i;const r=zi(t);return(i=r==null?void 0:r.isTypeSupported(Ar(s,e)))!=null?i:!1}function Ar(s,e){return`${e}/mp4;codecs="${s}"`}function uc(s){if(s){const e=s.substring(0,4);return ln.video[e]}return 2}function cn(s){return s.split(",").reduce((e,t)=>{const i=ln.video[t];return i?(i*2+e)/(e?3:2):(ln.audio[t]+e)/(e?2:1)},0)}const jo={};function _0(s,e=!0){if(jo[s])return jo[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[s];for(let i=0;i<t.length;i++)if(cc(t[i],"audio",e))return jo[s]=t[i],t[i];return s}const k0=/flac|opus/i;function un(s,e=!0){return s.replace(k0,t=>_0(t.toLowerCase(),e))}function hc(s,e){return s&&s!=="mp4a"?s:e&&e.split(",")[0]}function F0(s){const e=s.split(".");if(e.length>2){let t=e.shift()+".";return t+=parseInt(e.shift()).toString(16),t+=("000"+parseInt(e.shift()).toString(16)).slice(-4),t}return s}const dc=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,gc=/#EXT-X-MEDIA:(.*)/g,N0=/^#EXT(?:INF|-X-TARGETDURATION):/m,fc=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),M0=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class si{static findGroup(e,t){for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return r}}static resolve(e,t){return Mo.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return N0.test(e)}static parseMasterPlaylist(e,t){const i=Ac(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},n=[];dc.lastIndex=0;let o;for(;(o=dc.exec(e))!=null;)if(o[1]){var a;const l=new qe(o[1]);Rt(r,l,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=Wo(r,o[2]),u={attrs:l,bitrate:l.decimalInteger("BANDWIDTH")||l.decimalInteger("AVERAGE-BANDWIDTH"),name:l.NAME,url:si.resolve(c,t)},h=l.decimalResolution("RESOLUTION");h&&(u.width=h.width,u.height=h.height),P0(l.CODECS,u),(a=u.unknownCodecs)!=null&&a.length||n.push(u),r.levels.push(u)}else if(o[3]){const l=o[3],c=o[4];switch(l){case"SESSION-DATA":{const u=new qe(c);Rt(r,u,["DATA-ID","LANGUAGE","VALUE","URI"]);const h=u["DATA-ID"];h&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[h]=u);break}case"SESSION-KEY":{const u=pc(c,t,r);u.encrypted&&u.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(u)):N.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const u=new qe(c);Rt(r,u,["NAME","VALUE","QUERYPARAM"]),lc(r,u,t)}break}case"CONTENT-STEERING":{const u=new qe(c);Rt(r,u,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:si.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=Ec(c);break}}}const A=n.length>0&&n.length<r.levels.length;return r.levels=A?n:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,i){let r;const n={},o=i.levels,a={AUDIO:o.map(l=>({id:l.attrs.AUDIO,audioCodec:l.audioCodec})),SUBTITLES:o.map(l=>({id:l.attrs.SUBTITLES,textCodec:l.textCodec})),"CLOSED-CAPTIONS":[]};let A=0;for(gc.lastIndex=0;(r=gc.exec(e))!==null;){const l=new qe(r[1]),c=l.TYPE;if(c){const u=a[c],h=n[c]||[];n[c]=h,Rt(i,l,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=l.LANGUAGE,g=l["ASSOC-LANGUAGE"],f=l.CHANNELS,p=l.CHARACTERISTICS,v=l["INSTREAM-ID"],y={attrs:l,bitrate:0,id:A++,groupId:l["GROUP-ID"]||"",name:l.NAME||d||"",type:c,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:d,url:l.URI?si.resolve(l.URI,t):""};if(g&&(y.assocLang=g),f&&(y.channels=f),p&&(y.characteristics=p),v&&(y.instreamId=v),u!=null&&u.length){const Q=si.findGroup(u,y.groupId)||u[0];Ic(y,Q,"audioCodec"),Ic(y,Q,"textCodec")}h.push(y)}}return n}static parseLevelPlaylist(e,t,i,r,n,o){const a=new zf(t),A=a.fragments;let l=null,c=0,u=0,h=0,d=0,g=null,f=new Oo(r,t),p,v,y,Q=-1,m=!1,b=null;for(fc.lastIndex=0,a.m3u8=e,a.hasVariableRefs=Ac(e);(p=fc.exec(e))!==null;){m&&(m=!1,f=new Oo(r,t),f.start=h,f.sn=c,f.cc=d,f.level=i,l&&(f.initSegment=l,f.rawProgramDateTime=l.rawProgramDateTime,l.rawProgramDateTime=null,b&&(f.setByteRange(b),b=null)));const _=p[1];if(_){f.duration=parseFloat(_);const k=(" "+p[2]).slice(1);f.title=k||null,f.tagList.push(k?["INF",_,k]:["INF",_])}else if(p[3]){if(oe(f.duration)){f.start=h,y&&vc(f,y,a),f.sn=c,f.level=i,f.cc=d,A.push(f);const k=(" "+p[3]).slice(1);f.relurl=Wo(a,k),mc(f,g),g=f,h+=f.duration,c++,u=0,m=!0}}else if(p[4]){const k=(" "+p[4]).slice(1);g?f.setByteRange(k,g):f.setByteRange(k)}else if(p[5])f.rawProgramDateTime=(" "+p[5]).slice(1),f.tagList.push(["PROGRAM-DATE-TIME",f.rawProgramDateTime]),Q===-1&&(Q=A.length);else{if(p=p[0].match(M0),!p){N.warn("No matches on slow regex match for level playlist!");continue}for(v=1;v<p.length&&!(typeof p[v]<"u");v++);const k=(" "+p[v]).slice(1),U=(" "+p[v+1]).slice(1),q=p[v+2]?(" "+p[v+2]).slice(1):"";switch(k){case"PLAYLIST-TYPE":a.type=U.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(U);break;case"SKIP":{const V=new qe(U);Rt(a,V,["RECENTLY-REMOVED-DATERANGES"]);const Z=V.decimalInteger("SKIPPED-SEGMENTS");if(oe(Z)){a.skippedSegments=Z;for(let T=Z;T--;)A.unshift(null);c+=Z}const S=V.enumeratedString("RECENTLY-REMOVED-DATERANGES");S&&(a.recentlyRemovedDateranges=S.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(U),1);break;case"VERSION":a.version=parseInt(U);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(U||q)&&f.tagList.push(q?[U,q]:[U]);break;case"DISCONTINUITY":d++,f.tagList.push(["DIS"]);break;case"GAP":f.gap=!0,f.tagList.push([k]);break;case"BITRATE":f.tagList.push([k,U]);break;case"DATERANGE":{const V=new qe(U);Rt(a,V,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Rt(a,V,V.clientAttrs);const Z=new $l(V,a.dateRanges[V.ID]);Z.isValid||a.skippedSegments?a.dateRanges[Z.id]=Z:N.warn(`Ignoring invalid DATERANGE tag: "${U}"`),f.tagList.push(["EXT-X-DATERANGE",U]);break}case"DEFINE":{{const V=new qe(U);Rt(a,V,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in V?T0(a,V,o):lc(a,V,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(U);break;case"KEY":{const V=pc(U,t,a);if(V.isSupported()){if(V.method==="NONE"){y=void 0;break}y||(y={}),y[V.keyFormat]&&(y=tt({},y)),y[V.keyFormat]=V}else N.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${U}"`);break}case"START":a.startTimeOffset=Ec(U);break;case"MAP":{const V=new qe(U);if(Rt(a,V,["BYTERANGE","URI"]),f.duration){const Z=new Oo(r,t);Cc(Z,V,i,y),l=Z,f.initSegment=l,l.rawProgramDateTime&&!f.rawProgramDateTime&&(f.rawProgramDateTime=l.rawProgramDateTime)}else{const Z=f.byteRangeEndOffset;if(Z){const S=f.byteRangeStartOffset;b=`${Z-S}@${S}`}else b=null;Cc(f,V,i,y),l=f,m=!0}break}case"SERVER-CONTROL":{const V=new qe(U);a.canBlockReload=V.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=V.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&V.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=V.optionalFloat("PART-HOLD-BACK",0),a.holdBack=V.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const V=new qe(U);a.partTarget=V.decimalFloatingPoint("PART-TARGET");break}case"PART":{let V=a.partList;V||(V=a.partList=[]);const Z=u>0?V[V.length-1]:void 0,S=u++,T=new qe(U);Rt(a,T,["BYTERANGE","URI"]);const O=new jf(T,f,t,S,Z);V.push(O),f.duration+=O.duration;break}case"PRELOAD-HINT":{const V=new qe(U);Rt(a,V,["URI"]),a.preloadHint=V;break}case"RENDITION-REPORT":{const V=new qe(U);Rt(a,V,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(V);break}default:N.warn(`line parsed but not handled: ${p}`);break}}}g&&!g.relurl?(A.pop(),h-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(mc(f,g),f.cc=d,a.fragmentHint=f,y&&vc(f,y,a));const x=A.length,B=A[0],H=A[x-1];if(h+=a.skippedSegments*a.targetduration,h>0&&x&&H){a.averagetargetduration=h/x;const _=H.sn;a.endSN=_!=="initSegment"?_:0,a.live||(H.endList=!0),B&&(a.startCC=B.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(h+=a.fragmentHint.duration),a.totalduration=h,a.endCC=d,Q>0&&O0(A,Q),a}}function pc(s,e,t){var i,r;const n=new qe(s);Rt(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(i=n.METHOD)!=null?i:"",a=n.URI,A=n.hexadecimalInteger("IV"),l=n.KEYFORMATVERSIONS,c=(r=n.KEYFORMAT)!=null?r:"identity";a&&n.IV&&!A&&N.error(`Invalid IV: ${n.IV}`);const u=a?si.resolve(a,e):"",h=(l||"1").split("/").map(Number).filter(Number.isFinite);return new ar(o,u,c,h,A)}function Ec(s){const t=new qe(s).decimalFloatingPoint("TIME-OFFSET");return oe(t)?t:null}function P0(s,e){let t=(s||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const r=t.filter(n=>L0(n,i));r.length&&(e[`${i}Codec`]=r.join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function Ic(s,e,t){const i=e[t];i&&(s[t]=i)}function O0(s,e){let t=s[e];for(let i=e;i--;){const r=s[i];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function mc(s,e){s.rawProgramDateTime?s.programDateTime=Date.parse(s.rawProgramDateTime):e!=null&&e.programDateTime&&(s.programDateTime=e.endProgramDateTime),oe(s.programDateTime)||(s.programDateTime=null,s.rawProgramDateTime=null)}function Cc(s,e,t,i){s.relurl=e.URI,e.BYTERANGE&&s.setByteRange(e.BYTERANGE),s.level=t,s.sn="initSegment",i&&(s.levelkeys=i),s.initSegment=null}function vc(s,e,t){s.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&i.push(s)}var Le={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},de={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function yc(s){const{type:e}=s;switch(e){case Le.AUDIO_TRACK:return de.AUDIO;case Le.SUBTITLE_TRACK:return de.SUBTITLE;default:return de.MAIN}}function Xo(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class U0{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,r=t.loader,n=i||r,o=new n(t);return this.loaders[e.type]=o,o}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Le.MANIFEST,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:r,pathwayId:n,url:o,deliveryDirectives:a}=t;this.load({id:i,level:r,pathwayId:n,responseType:"text",type:Le.LEVEL,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Le.AUDIO_TRACK,url:n,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:r,url:n,deliveryDirectives:o}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:Le.SUBTITLE_TRACK,url:n,deliveryDirectives:o})}load(e){var t;const i=this.hls.config;let r=this.getInternalLoader(e);if(r){const l=r.context;if(l&&l.url===e.url&&l.level===e.level){N.trace("[playlist-loader]: playlist request ongoing");return}N.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}let n;if(e.type===Le.MANIFEST?n=i.manifestLoadPolicy.default:n=tt({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),oe((t=e.deliveryDirectives)==null?void 0:t.part)){let l;if(e.type===Le.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===Le.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===Le.SUBTITLE_TRACK&&e.id!==null&&(l=this.hls.subtitleTracks[e.id].details),l){const c=l.partTarget,u=l.targetduration;if(c&&u){const h=Math.max(c*3,u*.8)*1e3;n=tt({},n,{maxTimeToFirstByteMs:Math.min(h,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,n.maxTimeToFirstByteMs)})}}}const o=n.errorRetry||n.timeoutRetry||{},a={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},A={onSuccess:(l,c,u,h)=>{const d=this.getInternalLoader(u);this.resetInternalLoader(u.type);const g=l.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(l,u,new Error("no EXTM3U delimiter"),h||null,c);return}c.parsing.start=performance.now(),si.isMediaPlaylist(g)?this.handleTrackOrLevelPlaylist(l,c,u,h||null,d):this.handleMasterPlaylist(l,c,u,h)},onError:(l,c,u,h)=>{this.handleNetworkError(c,u,!1,l,h)},onTimeout:(l,c,u)=>{this.handleNetworkError(c,u,!0,void 0,l)}};r.load(e,a,A)}handleMasterPlaylist(e,t,i,r){const n=this.hls,o=e.data,a=Xo(e,i),A=si.parseMasterPlaylist(o,a);if(A.playlistParsingError){this.handleManifestParsingError(e,i,A.playlistParsingError,r,t);return}const{contentSteering:l,levels:c,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:g}=A;this.variableList=g;const{AUDIO:f=[],SUBTITLES:p,"CLOSED-CAPTIONS":v}=si.parseMasterPlaylistMedia(o,a,A);f.length&&!f.some(Q=>!Q.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(N.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new qe({}),bitrate:0,url:""})),n.trigger(E.MANIFEST_LOADED,{levels:c,audioTracks:f,subtitles:p,captions:v,contentSteering:l,url:a,stats:t,networkDetails:r,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:g})}handleTrackOrLevelPlaylist(e,t,i,r,n){const o=this.hls,{id:a,level:A,type:l}=i,c=Xo(e,i),u=0,h=oe(A)?A:oe(a)?a:0,d=yc(i),g=si.parseLevelPlaylist(e.data,c,h,d,u,this.variableList);if(l===Le.MANIFEST){const f={attrs:new qe({}),bitrate:0,details:g,name:"",url:c};o.trigger(E.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:c,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=g,this.handlePlaylistLoaded(g,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(E.ERROR,{type:Ee.NETWORK_ERROR,details:$.MANIFEST_PARSING_ERROR,fatal:t.type===Le.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t,i=!1,r,n){let o=`A network ${i?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===Le.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Le.AUDIO_TRACK||e.type===Le.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);N.warn(`[playlist-loader]: ${o}`);let A=$.UNKNOWN,l=!1;const c=this.getInternalLoader(e);switch(e.type){case Le.MANIFEST:A=i?$.MANIFEST_LOAD_TIMEOUT:$.MANIFEST_LOAD_ERROR,l=!0;break;case Le.LEVEL:A=i?$.LEVEL_LOAD_TIMEOUT:$.LEVEL_LOAD_ERROR,l=!1;break;case Le.AUDIO_TRACK:A=i?$.AUDIO_TRACK_LOAD_TIMEOUT:$.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Le.SUBTITLE_TRACK:A=i?$.SUBTITLE_TRACK_LOAD_TIMEOUT:$.SUBTITLE_LOAD_ERROR,l=!1;break}c&&this.resetInternalLoader(e.type);const u={type:Ee.NETWORK_ERROR,details:A,fatal:l,url:e.url,loader:c,context:e,error:a,networkDetails:t,stats:n};if(r){const h=(t==null?void 0:t.url)||e.url;u.response=lt({url:h,data:void 0},r)}this.hls.trigger(E.ERROR,u)}handlePlaylistLoaded(e,t,i,r,n,o){const a=this.hls,{type:A,level:l,id:c,groupId:u,deliveryDirectives:h}=r,d=Xo(t,r),g=yc(r),f=typeof r.level=="number"&&g===de.MAIN?l:void 0;if(!e.fragments.length){const v=new Error("No Segments found in Playlist");a.trigger(E.ERROR,{type:Ee.NETWORK_ERROR,details:$.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:v,reason:v.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const p=e.playlistParsingError;if(p){a.trigger(E.ERROR,{type:Ee.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:p,reason:p.message,response:t,context:r,level:f,parent:g,networkDetails:n,stats:i});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),A){case Le.MANIFEST:case Le.LEVEL:a.trigger(E.LEVEL_LOADED,{details:e,level:f||0,id:c||0,stats:i,networkDetails:n,deliveryDirectives:h});break;case Le.AUDIO_TRACK:a.trigger(E.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:i,networkDetails:n,deliveryDirectives:h});break;case Le.SUBTITLE_TRACK:a.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:i,networkDetails:n,deliveryDirectives:h});break}}}function Bc(s,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=s,e.dispatchEvent(t)}function Qc(s,e){const t=s.mode;if(t==="disabled"&&(s.mode="hidden"),s.cues&&!s.cues.getCueById(e.id))try{if(s.addCue(e),!s.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){N.debug(`[texttrack-utils]: ${i}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,s.addCue(r)}catch(r){N.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(s.mode=t)}function ps(s){const e=s.mode;if(e==="disabled"&&(s.mode="hidden"),s.cues)for(let t=s.cues.length;t--;)s.removeCue(s.cues[t]);e==="disabled"&&(s.mode=e)}function zo(s,e,t,i){const r=s.mode;if(r==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const n=H0(s.cues,e,t);for(let o=0;o<n.length;o++)(!i||i(n[o]))&&s.removeCue(n[o])}r==="disabled"&&(s.mode=r)}function G0(s,e){if(e<s[0].startTime)return 0;const t=s.length-1;if(e>s[t].endTime)return-1;let i=0,r=t;for(;i<=r;){const n=Math.floor((r+i)/2);if(e<s[n].startTime)r=n-1;else if(e>s[n].startTime&&i<t)i=n+1;else return n}return s[i].startTime-e<e-s[r].startTime?i:r}function H0(s,e,t){const i=[],r=G0(s,e);if(r>-1)for(let n=r,o=s.length;n<o;n++){const a=s[n];if(a.startTime>=e&&a.endTime<=t)i.push(a);else if(a.startTime>t)return i}return i}function hn(s){const e=[];for(let t=0;t<s.length;t++){const i=s[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(s[t])}return e}var Kt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const $0=.25;function Zo(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function bc(s,e,t,i,r){let n=new s(e,t,"");try{n.value=i,r&&(n.type=r)}catch{n=new s(e,t,JSON.stringify(r?lt({type:r},i):i))}return n}const dn=(()=>{const s=Zo();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function ea(s,e){return s.getTime()/1e3-e}function Y0(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class K0{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(ps(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return Bc(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:r}}}=this;if(!i&&!r)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=Zo();if(o)for(let a=0;a<n.length;a++){const A=n[a].type;if(A===Kt.emsg&&!i||!r)continue;const l=Xl(n[a].data);if(l){const c=n[a].pts;let u=c+n[a].duration;u>dn&&(u=dn),u-c<=0&&(u=c+$0);for(let d=0;d<l.length;d++){const g=l[d];if(!jl(g)){this.updateId3CueEnds(c,A);const f=bc(o,c,u,g,A);f&&this.id3Track.addCue(f)}}}}}updateId3CueEnds(e,t){var i;const r=(i=this.id3Track)==null?void 0:i.cues;if(r)for(let n=r.length;n--;){const o=r[n];o.type===t&&o.startTime<e&&o.endTime===dn&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:r}){const{id3Track:n,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:A}}=o;if(n&&(a||A)){let l;r==="audio"?l=c=>c.type===Kt.audioId3&&A:r==="video"?l=c=>c.type===Kt.emsg&&a:l=c=>c.type===Kt.audioId3&&A||c.type===Kt.emsg&&a,zo(n,t,i,l)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:r}=this,{dateRanges:n}=t,o=Object.keys(n);if(r){const c=Object.keys(i).filter(u=>!o.includes(u));for(let u=c.length;u--;){const h=c[u];Object.keys(i[h].cues).forEach(d=>{r.removeCue(i[h].cues[d])}),delete i[h]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!oe(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const A=a.programDateTime/1e3-a.start,l=Zo();for(let c=0;c<o.length;c++){const u=o[c],h=n[u],d=ea(h.startDate,A),g=i[u],f=(g==null?void 0:g.cues)||{};let p=(g==null?void 0:g.durationKnown)||!1,v=dn;const y=h.endDate;if(y)v=ea(y,A),p=!0;else if(h.endOnNext&&!p){const m=o.reduce((b,x)=>{if(x!==h.id){const B=n[x];if(B.class===h.class&&B.startDate>h.startDate&&(!b||h.startDate<b.startDate))return B}return b},null);m&&(v=ea(m.startDate,A),p=!0)}const Q=Object.keys(h.attr);for(let m=0;m<Q.length;m++){const b=Q[m];if(!Wf(b))continue;const x=f[b];if(x)p&&!g.durationKnown&&(x.endTime=v);else if(l){let B=h.attr[b];qf(b)&&(B=Y0(B));const H=bc(l,d,v,{key:b,data:B},Kt.dateRange);H&&(H.id=u,this.id3Track.addCue(H),f[b]=H)}}i[u]={cues:f,dateRange:h,durationKnown:p}}}}class V0{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:i,targetduration:r}=e,{liveSyncDuration:n,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,A=this.hls.userConfig;let l=a&&i||t;(A.liveSyncDuration||A.liveSyncDurationCount||l===0)&&(l=n!==void 0?n:o*r);const c=r;return l+Math.min(this.stallCount*1,c)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;const r=i.edge,n=e-t-this.edgeStalled,o=r-i.totalduration,a=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(o,n),a)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(E.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===$.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&N.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:r,maxLiveSyncPlaybackRate:n}=this.config;if(!r||n===1||!t.live)return;const o=this.targetLatency;if(o===null)return;const a=i-o,A=Math.min(this.maxLatency,o+t.targetduration);if(a<A&&a>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,n)),u=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;e.playbackRate=Math.min(c,Math.max(1,u))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const ta=["NONE","TYPE-0","TYPE-1",null];function J0(s){return ta.indexOf(s)>-1}const gn=["SDR","PQ","HLG"];function W0(s){return!!s&&gn.indexOf(s)>-1}var fn={No:"",Yes:"YES",v2:"v2"};function Sc(s){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=s,r=i<e/2;return e&&r?t?fn.v2:fn.Yes:fn.No}class wc{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class Es{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>!!t).map(t=>t.substring(0,4)).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Rc(this._audioGroups,e)}hasSubtitleGroup(e){return Rc(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Rc(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function ia(s,e){const t=e.startPTS;if(oe(t)){let i=0,r;e.sn>s.sn?(i=t-s.start,r=s):(i=s.start-t,r=e),r.duration!==i&&(r.duration=i)}else e.sn>s.sn?s.cc===e.cc&&s.minEndPTS?e.start=s.start+(s.minEndPTS-s.start):e.start=s.start+s.duration:e.start=Math.max(s.start-e.duration,0)}function xc(s,e,t,i,r,n){i-t<=0&&(N.warn("Fragment should have a positive duration",e),i=t+e.duration,n=r+e.duration);let a=t,A=i;const l=e.startPTS,c=e.endPTS;if(oe(l)){const p=Math.abs(l-t);oe(e.deltaPTS)?e.deltaPTS=Math.max(p,e.deltaPTS):e.deltaPTS=p,a=Math.max(t,l),t=Math.min(t,l),r=Math.min(r,e.startDTS),A=Math.min(i,c),i=Math.max(i,c),n=Math.max(n,e.endDTS)}const u=t-e.start;e.start!==0&&(e.start=t),e.duration=i-e.start,e.startPTS=t,e.maxStartPTS=a,e.startDTS=r,e.endPTS=i,e.minEndPTS=A,e.endDTS=n;const h=e.sn;if(!s||h<s.startSN||h>s.endSN)return 0;let d;const g=h-s.startSN,f=s.fragments;for(f[g]=e,d=g;d>0;d--)ia(f[d],f[d-1]);for(d=g;d<f.length-1;d++)ia(f[d],f[d+1]);return s.fragmentHint&&ia(f[f.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,u}function q0(s,e){let t=null;const i=s.fragments;for(let A=i.length-1;A>=0;A--){const l=i[A].initSegment;if(l){t=l;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;let r=0,n;if(z0(s,e,(A,l)=>{A.relurl&&(r=A.cc-l.cc),oe(A.startPTS)&&oe(A.endPTS)&&(l.start=l.startPTS=A.startPTS,l.startDTS=A.startDTS,l.maxStartPTS=A.maxStartPTS,l.endPTS=A.endPTS,l.endDTS=A.endDTS,l.minEndPTS=A.minEndPTS,l.duration=A.endPTS-A.startPTS,l.duration&&(n=l),e.PTSKnown=e.alignedSliding=!0),l.elementaryStreams=A.elementaryStreams,l.loader=A.loader,l.stats=A.stats,A.initSegment&&(l.initSegment=A.initSegment,t=A.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(l=>{var c;l&&(!l.initSegment||l.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(l.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(A=>!A),e.deltaUpdateFailed){N.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let A=e.skippedSegments;A--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=j0(s.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(r){N.warn("discontinuity sliding from playlist, take drift into account");for(let A=0;A<o.length;A++)o[A].cc+=r}e.skippedSegments&&(e.startCC=e.fragments[0].cc),X0(s.partList,e.partList,(A,l)=>{l.elementaryStreams=A.elementaryStreams,l.stats=A.stats}),n?xc(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):Tc(s,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=s.driftStartTime,e.driftStart=s.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const A=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=A),e.driftEndTime=a,e.driftEnd=A}else e.driftEndTime=s.driftEndTime,e.driftEnd=s.driftEnd,e.advancedDateTime=s.advancedDateTime}function j0(s,e,t){const i=tt({},s);return t&&t.forEach(r=>{delete i[r]}),Object.keys(e).forEach(r=>{const n=new $l(e[r].attr,i[r]);n.isValid?i[r]=n:N.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[r].attr)}"`)}),i}function X0(s,e,t){if(s&&e){let i=0;for(let r=0,n=s.length;r<=n;r++){const o=s[r],a=e[r+i];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):i--}}}function z0(s,e,t){const i=e.skippedSegments,r=Math.max(s.startSN,e.startSN)-e.startSN,n=(s.fragmentHint?1:0)+(i?e.endSN:Math.min(s.endSN,e.endSN))-e.startSN,o=e.startSN-s.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,A=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;for(let l=r;l<=n;l++){const c=A[o+l];let u=a[l];i&&!u&&l<i&&(u=e.fragments[l]=c),c&&u&&t(c,u)}}function Tc(s,e){const t=e.startSN+e.skippedSegments-s.startSN,i=s.fragments;t<0||t>=i.length||sa(e,i[t].start)}function sa(s,e){if(e){const t=s.fragments;for(let i=s.skippedSegments;i<t.length;i++)t[i].start+=e;s.fragmentHint&&(s.fragmentHint.start+=e)}}function Z0(s,e=1/0){let t=1e3*s.targetduration;if(s.updated){const i=s.fragments;if(i.length&&t*4>e){const n=i[i.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function ep(s,e,t){if(!(s!=null&&s.details))return null;const i=s.details;let r=i.fragments[e-i.startSN];return r||(r=i.fragmentHint,r&&r.sn===e)?r:e<i.startSN&&t&&t.sn===e?t:null}function Dc(s,e,t){var i;return s!=null&&s.details?Lc((i=s.details)==null?void 0:i.partList,e,t):null}function Lc(s,e,t){if(s)for(let i=s.length;i--;){const r=s[i];if(r.index===t&&r.fragment.sn===e)return r}return null}function _c(s){s.forEach((e,t)=>{const{details:i}=e;i!=null&&i.fragments&&i.fragments.forEach(r=>{r.level=t})})}function pn(s){switch(s.details){case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_TIMEOUT:case $.LEVEL_LOAD_TIMEOUT:case $.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function kc(s,e){const t=pn(e);return s.default[`${t?"timeout":"error"}Retry`]}function ra(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function Fc(s){return lt(lt({},s),{errorRetry:null,timeoutRetry:null})}function En(s,e,t,i){if(!s)return!1;const r=i==null?void 0:i.code,n=e<s.maxNumRetry&&(tp(r)||!!t);return s.shouldRetry?s.shouldRetry(s,e,t,i,n):n}function tp(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const Nc={search:function(s,e){let t=0,i=s.length-1,r=null,n=null;for(;t<=i;){r=(t+i)/2|0,n=s[r];const o=e(n);if(o>0)t=r+1;else if(o<0)i=r-1;else return n}return null}};function ip(s,e,t){if(e===null||!Array.isArray(s)||!s.length||!oe(e))return null;const i=s[0].programDateTime;if(e<(i||0))return null;const r=s[s.length-1].endProgramDateTime;if(e>=(r||0))return null;t=t||0;for(let n=0;n<s.length;++n){const o=s[n];if(rp(e,t,o))return o}return null}function In(s,e,t=0,i=0,r=.005){let n=null;if(s){n=e[s.sn-e[0].sn+1]||null;const a=s.endDTS-t;a>0&&a<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(n=e[0]);if(n&&((!s||s.level===n.level)&&na(t,i,n)===0||sp(n,s,Math.min(r,i))))return n;const o=Nc.search(e,na.bind(null,t,i));return o&&(o!==s||!n)?o:n}function sp(s,e,t){if(e&&e.start===0&&e.level<s.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((r,n)=>(n[0]==="INF"&&(r+=parseFloat(n[1])),r),t);return s.start<=i}return!1}function na(s=0,e=0,t){if(t.start<=s&&t.start+t.duration>s)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=s?1:t.start-i>s&&t.start?-1:0}function rp(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function np(s,e){return Nc.search(s,t=>t.cc<e?1:t.cc>e?-1:0)}var It={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Vt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class op{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=N.log.bind(N,"[info]:"),this.warn=N.warn.bind(N,"[warning]:"),this.error=N.error.bind(N,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.ERROR,this.onError,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.ERROR,this.onError,this),e.off(E.ERROR,this.onErrorOut,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===de.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,r;if(t.fatal)return;const n=this.hls,o=t.context;switch(t.details){case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case $.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction={action:It.DoNothing,flags:Vt.None};return}case $.FRAG_GAP:case $.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=It.SendAlternateToPenaltyBox;return}case $.LEVEL_EMPTY_ERROR:case $.LEVEL_PARSING_ERROR:{var a,A;const l=t.parent===de.MAIN?t.level:n.loadLevel;t.details===$.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(A=a.levelDetails)!=null&&A.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,l):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,l))}return;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_LOAD_ERROR:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const l=n.levels[n.loadLevel];if(l&&(o.type===Le.AUDIO_TRACK&&l.hasAudioGroup(o.groupId)||o.type===Le.SUBTITLE_TRACK&&l.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=It.SendAlternateToPenaltyBox,t.errorAction.flags=Vt.MoveAllAlternatesMatchingHost;return}}return;case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const l=n.levels[n.loadLevel],c=l==null?void 0:l.attrs["HDCP-LEVEL"];c?t.errorAction={action:It.SendAlternateToPenaltyBox,flags:Vt.MoveAllAlternatesMatchingHDCP,hdcpLevel:c}:this.keySystemError(t)}return;case $.BUFFER_ADD_CODEC_ERROR:case $.REMUX_ALLOC_ERROR:case $.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case $.INTERNAL_EXCEPTION:case $.BUFFER_APPENDING_ERROR:case $.BUFFER_FULL_ERROR:case $.LEVEL_SWITCH_ERROR:case $.BUFFER_STALLED_ERROR:case $.BUFFER_SEEK_OVER_HOLE:case $.BUFFER_NUDGE_ON_STALL:t.errorAction={action:It.DoNothing,flags:Vt.None};return}t.type===Ee.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,r=kc(i.config.playlistLoadPolicy,e),n=this.playlistError++;if(En(r,n,pn(e),e.response))return{action:It.RetryRequest,flags:Vt.None,retryConfig:r,retryCount:n};const a=this.getLevelSwitchAction(e,t);return r&&(a.retryConfig=r,a.retryCount=n),a}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:o}=t.config,a=kc(e.details.startsWith("key")?o:n,e),A=t.levels.reduce((c,u)=>c+u.fragmentError,0);if(r&&(e.details!==$.FRAG_GAP&&r.fragmentError++,En(a,A,pn(e),e.response)))return{action:It.RetryRequest,flags:Vt.None,retryConfig:a,retryCount:A};const l=this.getLevelSwitchAction(e,i);return a&&(l.retryConfig=a,l.retryCount=A),l}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const r=this.hls.levels[t];if(r){var n,o;const l=e.details;r.loadError++,l===$.BUFFER_APPEND_ERROR&&r.fragmentError++;let c=-1;const{levels:u,loadLevel:h,minAutoLevel:d,maxAutoLevel:g}=i;i.autoLevelEnabled||(i.loadLevel=-1);const f=(n=e.frag)==null?void 0:n.type,v=(f===de.AUDIO&&l===$.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(l===$.BUFFER_ADD_CODEC_ERROR||l===$.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:x})=>r.audioCodec!==x),Q=e.sourceBufferName==="video"&&(l===$.BUFFER_ADD_CODEC_ERROR||l===$.BUFFER_APPEND_ERROR)&&u.some(({codecSet:x,audioCodec:B})=>r.codecSet!==x&&r.audioCodec===B),{type:m,groupId:b}=(o=e.context)!=null?o:{};for(let x=u.length;x--;){const B=(x+h)%u.length;if(B!==h&&B>=d&&B<=g&&u[B].loadError===0){var a,A;const H=u[B];if(l===$.FRAG_GAP&&f===de.MAIN&&e.frag){const _=u[B].details;if(_){const k=In(e.frag,_.fragments,e.frag.start);if(k!=null&&k.gap)continue}}else{if(m===Le.AUDIO_TRACK&&H.hasAudioGroup(b)||m===Le.SUBTITLE_TRACK&&H.hasSubtitleGroup(b))continue;if(f===de.AUDIO&&(a=r.audioGroups)!=null&&a.some(_=>H.hasAudioGroup(_))||f===de.SUBTITLE&&(A=r.subtitleGroups)!=null&&A.some(_=>H.hasSubtitleGroup(_))||v&&r.audioCodec===H.audioCodec||!v&&r.audioCodec!==H.audioCodec||Q&&r.codecSet===H.codecSet)continue}c=B;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:It.SendAlternateToPenaltyBox,flags:Vt.None,nextAutoLevel:c}}return{action:It.SendAlternateToPenaltyBox,flags:Vt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case It.DoNothing:break;case It.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==$.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:r,hdcpLevel:n,nextAutoLevel:o}=i;switch(r){case Vt.None:this.switchLevel(e,o);break;case Vt.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=ta[ta.indexOf(n)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,o)}switchLevel(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}class oa{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=N.log.bind(N,`${t}:`),this.warn=N.warn.bind(N,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const r=t==null?void 0:t.renditionReports;if(r){let n=-1;for(let o=0;o<r.length;o++){const a=r[o];let A;try{A=new self.URL(a.URI,t.url).href}catch(l){N.warn(`Could not construct new URL for Rendition Report: ${l}`),A=a.URI||""}if(A===e){n=o;break}else A===e.substring(0,A.length)&&(n=o)}if(n!==-1){const o=r[n],a=parseInt(o["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let A=parseInt(o["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const c=Math.min(t.age-t.partTarget,t.targetduration);A>=0&&c>t.partTarget&&(A+=1)}const l=i&&Sc(i);return new wc(a,A>=0?A:void 0,l)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:r,stats:n}=t,o=self.performance.now(),a=n.loading.first?Math.max(0,o-n.loading.first):0;if(r.advancedDateTime=Date.now()-a,r.live||i!=null&&i.live){if(r.reloaded(i),i&&this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),i&&r.fragments.length>0&&q0(i,r),!this.canLoad||!r.live)return;let A,l,c;if(r.canBlockReload&&r.endSN&&r.advanced){const p=this.hls.config.lowLatencyMode,v=r.lastPartSn,y=r.endSN,Q=r.lastPartIndex,m=Q!==-1,b=v===y,x=p?0:Q;m?(l=b?y+1:v,c=b?x:Q+1):l=y+1;const B=r.age,H=B+r.ageHeader;let _=Math.min(H-r.partTarget,r.targetduration*1.5);if(_>0){if(i&&_>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${_} with playlist age: ${r.age}`),_=0;else{const k=Math.floor(_/r.targetduration);if(l+=k,c!==void 0){const U=Math.round(_%r.targetduration/r.partTarget);c+=U}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${B.toFixed(2)}s goal: ${_} skip sn ${k} to part ${c}`)}r.tuneInGoal=_}if(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c),p||!b){this.loadPlaylist(A);return}}else(r.canBlockReload||r.canSkipUntil)&&(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c));const u=this.hls.mainForwardBufferInfo,h=u?u.end-u.len:0,d=(r.edge-h)*1e3,g=Z0(r,d);r.updated&&o>this.requestScheduled+g&&(this.requestScheduled=n.loading.start),l!==void 0&&r.canBlockReload?this.requestScheduled=n.loading.first+g-(r.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+g<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=g);let f=this.requestScheduled-o;f=Math.max(0,f),this.log(`reload live playlist ${e} in ${Math.round(f)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(A),f)}else this.clearTimer()}getDeliveryDirectives(e,t,i,r){let n=Sc(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=fn.No),new wc(i,r,n)}checkRetry(e){const t=e.details,i=pn(e),r=e.errorAction,{action:n,retryCount:o=0,retryConfig:a}=r||{},A=!!r&&!!a&&(n===It.RetryRequest||!r.resolved&&n===It.SendAlternateToPenaltyBox);if(A){var l;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(i&&(l=e.context)!=null&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const c=ra(a,o);this.timer=self.setTimeout(()=>this.loadPlaylist(),c),this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" in ${c}ms`)}e.levelRetry=!0,r.resolved=!0}return A}}class Is{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class ap{constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Is(e),this.fast_=new Is(t),this.defaultTTFB_=r,this.ttfb_=new Is(e)}update(e,t){const{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new Is(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new Is(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Is(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,r=e/1e3,n=i/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const Mc={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Pc={};function Ap(s,e,t,i,r,n){const o=s.audioCodec?s.audioGroups:null,a=n==null?void 0:n.audioCodec,A=n==null?void 0:n.channels,l=A?parseInt(A):a?1/0:2;let c=null;if(o!=null&&o.length)try{o.length===1&&o[0]?c=e.groups[o[0]].channels:c=o.reduce((u,h)=>{if(h){const d=e.groups[h];if(!d)throw new Error(`Audio track group ${h} not found`);Object.keys(d.channels).forEach(g=>{u[g]=(u[g]||0)+d.channels[g]})}return u},{2:0})}catch{return!0}return s.videoCodec!==void 0&&(s.width>1920&&s.height>1088||s.height>1920&&s.width>1088||s.frameRate>Math.max(i,30)||s.videoRange!=="SDR"&&s.videoRange!==t||s.bitrate>Math.max(r,8e6))||!!c&&oe(l)&&Object.keys(c).some(u=>parseInt(u)>l)}function lp(s,e,t){const i=s.videoCodec,r=s.audioCodec;if(!i||!r||!t)return Promise.resolve(Mc);const n={width:s.width,height:s.height,bitrate:Math.ceil(Math.max(s.bitrate*.9,s.averageBitrate)),framerate:s.frameRate||30},o=s.videoRange;o!=="SDR"&&(n.transferFunction=o.toLowerCase());const a=i.split(",").map(A=>({type:"media-source",video:lt(lt({},n),{},{contentType:Ar(A,"video")})}));return r&&s.audioGroups&&s.audioGroups.forEach(A=>{var l;A&&((l=e.groups[A])==null||l.tracks.forEach(c=>{if(c.groupId===A){const u=c.channels||"",h=parseFloat(u);oe(h)&&h>2&&a.push.apply(a,r.split(",").map(d=>({type:"media-source",audio:{contentType:Ar(d,"audio"),channels:""+h}})))}}))}),Promise.all(a.map(A=>{const l=cp(A);return Pc[l]||(Pc[l]=t.decodingInfo(A))})).then(A=>({supported:!A.some(l=>!l.supported),configurations:a,decodingInfoResults:A})).catch(A=>({supported:!1,configurations:a,decodingInfoResults:[],error:A}))}function cp(s){const{audio:e,video:t}=s,i=t||e;if(i){const r=i.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${r}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${r}`}return""}function up(){if(typeof matchMedia=="function"){const s=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(s.media!==e.media)return s.matches===!0}return!1}function hp(s,e){let t=!1,i=[];return s&&(t=s!=="SDR",i=[s]),e&&(i=e.allowedVideoRanges||gn.slice(0),t=e.preferHDR!==void 0?e.preferHDR:up(),t?i=i.filter(r=>r!=="SDR"):i=["SDR"]),{preferHDR:t,allowedVideoRanges:i}}function dp(s,e,t,i,r){const n=Object.keys(s),o=i==null?void 0:i.channels,a=i==null?void 0:i.audioCodec,A=o&&parseInt(o)===2;let l=!0,c=!1,u=1/0,h=1/0,d=1/0,g=0,f=[];const{preferHDR:p,allowedVideoRanges:v}=hp(e,r);for(let b=n.length;b--;){const x=s[n[b]];l=x.channels[2]>0,u=Math.min(u,x.minHeight),h=Math.min(h,x.minFramerate),d=Math.min(d,x.minBitrate);const B=v.filter(H=>x.videoRanges[H]>0);B.length>0&&(c=!0,f=B)}u=oe(u)?u:0,h=oe(h)?h:0;const y=Math.max(1080,u),Q=Math.max(30,h);return d=oe(d)?d:t,t=Math.max(d,t),c||(e=void 0,f=[]),{codecSet:n.reduce((b,x)=>{const B=s[x];if(x===b)return b;if(B.minBitrate>t)return yi(x,`min bitrate of ${B.minBitrate} > current estimate of ${t}`),b;if(!B.hasDefaultAudio)return yi(x,"no renditions with default or auto-select sound found"),b;if(a&&x.indexOf(a.substring(0,4))%5!==0)return yi(x,`audio codec preference "${a}" not found`),b;if(o&&!A){if(!B.channels[o])return yi(x,`no renditions with ${o} channel sound found (channels options: ${Object.keys(B.channels)})`),b}else if((!a||A)&&l&&B.channels[2]===0)return yi(x,"no renditions with stereo sound found"),b;return B.minHeight>y?(yi(x,`min resolution of ${B.minHeight} > maximum of ${y}`),b):B.minFramerate>Q?(yi(x,`min framerate of ${B.minFramerate} > maximum of ${Q}`),b):f.some(H=>B.videoRanges[H]>0)?B.maxScore<g?(yi(x,`max score of ${B.maxScore} < selected max of ${g}`),b):b&&(cn(x)>=cn(b)||B.fragmentError>s[b].fragmentError)?b:(g=B.maxScore,x):(yi(x,`no variants with VIDEO-RANGE of ${JSON.stringify(f)} found`),b)},void 0),videoRanges:f,preferHDR:p,minFramerate:h,minBitrate:d}}function yi(s,e){N.log(`[abr] start candidates with "${s}" ignored because ${e}`)}function gp(s){return s.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const r=t.channels||"2";return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function fp(s,e,t,i){return s.slice(t,i+1).reduce((r,n)=>{if(!n.codecSet)return r;const o=n.audioGroups;let a=r[n.codecSet];a||(r[n.codecSet]=a={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),a.minBitrate=Math.min(a.minBitrate,n.bitrate);const A=Math.min(n.height,n.width);return a.minHeight=Math.min(a.minHeight,A),a.minFramerate=Math.min(a.minFramerate,n.frameRate),a.maxScore=Math.max(a.maxScore,n.score),a.fragmentError+=n.fragmentError,a.videoRanges[n.videoRange]=(a.videoRanges[n.videoRange]||0)+1,o&&o.forEach(l=>{if(!l)return;const c=e.groups[l];c&&(a.hasDefaultAudio=a.hasDefaultAudio||e.hasDefaultAudio?c.hasDefault:c.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(c.channels).forEach(u=>{a.channels[u]=(a.channels[u]||0)+c.channels[u]}))}),r},{})}function ri(s,e,t){if("attrs"in s){const i=e.indexOf(s);if(i!==-1)return i}for(let i=0;i<e.length;i++){const r=e[i];if(ms(s,r,t))return i}return-1}function ms(s,e,t){const{groupId:i,name:r,lang:n,assocLang:o,characteristics:a,default:A}=s,l=s.forced;return(i===void 0||e.groupId===i)&&(r===void 0||e.name===r)&&(n===void 0||e.lang===n)&&(n===void 0||e.assocLang===o)&&(A===void 0||e.default===A)&&(l===void 0||e.forced===l)&&(a===void 0||pp(a,e.characteristics))&&(t===void 0||t(s,e))}function pp(s,e=""){const t=s.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function Cs(s,e){const{audioCodec:t,channels:i}=s;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function Ep(s,e,t,i,r){const n=e[i],a=e.reduce((h,d,g)=>{const f=d.uri;return(h[f]||(h[f]=[])).push(g),h},{})[n.uri];a.length>1&&(i=Math.max.apply(Math,a));const A=n.videoRange,l=n.frameRate,c=n.codecSet.substring(0,4),u=Oc(e,i,h=>{if(h.videoRange!==A||h.frameRate!==l||h.codecSet.substring(0,4)!==c)return!1;const d=h.audioGroups,g=t.filter(f=>!d||d.indexOf(f.groupId)!==-1);return ri(s,g,r)>-1});return u>-1?u:Oc(e,i,h=>{const d=h.audioGroups,g=t.filter(f=>!d||d.indexOf(f.groupId)!==-1);return ri(s,g,r)>-1})}function Oc(s,e,t){for(let i=e;i;i--)if(t(s[i]))return i;for(let i=e+1;i<s.length;i++)if(t(s[i]))return i;return-1}class Ip{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:i,hls:r}=this,{autoLevelEnabled:n,media:o}=r;if(!t||!o)return;const a=performance.now(),A=i?i.stats:t.stats,l=i?i.duration:t.duration,c=a-A.loading.start,u=r.minAutoLevel;if(A.aborted||A.loaded&&A.loaded===A.total||t.level<=u){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||o.paused||!o.playbackRate||!o.readyState)return;const h=r.mainForwardBufferInfo;if(h===null)return;const d=this.bwEstimator.getEstimateTTFB(),g=Math.abs(o.playbackRate);if(c<=Math.max(d,1e3*(l/(g*2))))return;const f=h.len/g,p=A.loading.first?A.loading.first-A.loading.start:-1,v=A.loaded&&p>-1,y=this.getBwEstimate(),Q=r.levels,m=Q[t.level],b=A.total||Math.max(A.loaded,Math.round(l*m.averageBitrate/8));let x=v?c-p:c;x<1&&v&&(x=Math.min(c,A.loaded*8/y));const B=v?A.loaded*1e3/x:0,H=B?(b-A.loaded)/B:b*8/y+d/1e3;if(H<=f)return;const _=B?B*8:y;let k=Number.POSITIVE_INFINITY,U;for(U=t.level-1;U>u;U--){const V=Q[U].maxBitrate;if(k=this.getTimeToLoadFrag(d/1e3,_,l*V,!Q[U].details),k<f)break}if(k>=H||k>l*10)return;r.nextLoadLevel=r.nextAutoLevel=U,v?this.bwEstimator.sample(c-Math.min(d,p),A.loaded):this.bwEstimator.sampleTTFB(c);const q=Q[U].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>q&&this.resetEstimator(q),this.clearTimer(),N.warn(`[abr] Fragment ${t.sn}${i?" part "+i.index:""} of level ${t.level} is loading too slowly;
158
162
  Time to underbuffer: ${f.toFixed(3)} s
159
- Estimated load time for current fragment: ${F.toFixed(3)} s
160
- Estimated load time for down switch fragment: ${M.toFixed(3)} s
161
- TTFB estimate: ${E|0} ms
162
- Current BW estimate: ${Ae(S)?S|0:"Unknown"} bps
163
+ Estimated load time for current fragment: ${H.toFixed(3)} s
164
+ Estimated load time for down switch fragment: ${k.toFixed(3)} s
165
+ TTFB estimate: ${p|0} ms
166
+ Current BW estimate: ${oe(y)?y|0:"Unknown"} bps
163
167
  New BW estimate: ${this.getBwEstimate()|0} bps
164
- Switching to level ${H} @ ${j|0} bps`),r.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:i,stats:A})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(_.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new O0(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(p.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var r;this.fragCurrent=i,this.partCurrent=(r=t.part)!=null?r:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case $.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:r,partCurrent:n}=this;if(i&&r&&i.sn===r.sn&&i.level===r.level){const o=performance.now(),a=n?n.stats:i.stats,A=o-a.loading.start,l=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&l>-1){const h=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(A-Math.min(h,l),a.loaded)}else this.bwEstimator.sampleTTFB(A)}break}}}getTimeToLoadFrag(e,t,i,r){const n=e+i/t,o=r?this.lastLevelLoadSec:0;return n+o}onLevelLoaded(e,t){const i=this.hls.config,{loading:r}=t.stats,n=r.end-r.start;Ae(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const r=i?i.stats:t.stats;if(t.type===Ee.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=i?i.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+r.loaded,A=(o.loaded?o.loaded.duration:0)+n;o.loaded={bytes:a,duration:A},o.realBitrate=Math.round(8*a/A)}if(t.bitrateTest){const n={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(p.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:i.stats;if(n.aborted||this.ignoreFragment(i))return;const o=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,n.loaded),n.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Ee.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,t,e,0,r,1,1);if(n>-1)return n;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return _.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=i&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,n)&&o[e].loadError<=o[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:r,config:n,minAutoLevel:o}=i,a=t?t.duration:e?e.duration:0,A=this.getBwEstimate(),l=this.getStarvationDelay();let c=n.abrBandWidthFactor,h=n.abrBandWidthUpFactor;if(l){const E=this.findBestLevel(A,o,r,l,0,c,h);if(E>=0)return E}let u=a?Math.min(a,n.maxStarvationDelay):n.maxStarvationDelay;if(!l){const E=this.bitrateTestDelay;E&&(u=(a?Math.min(a,n.maxLoadingDelay):n.maxLoadingDelay)-E,_.info(`[abr] bitrate test took ${Math.round(1e3*E)}ms, set first fragment max fetchDuration to ${Math.round(1e3*u)} ms`),c=h=1)}const d=this.findBestLevel(A,o,r,l,u,c,h);if(_.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`),d>-1)return d;const g=i.levels[o],f=i.levels[i.loadLevel];return(g==null?void 0:g.bitrate)<(f==null?void 0:f.bitrate)?o:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,r,n,o,a){var A;const l=r+n,c=this.lastLoadedFragLevel,h=c===-1?this.hls.firstLevel:c,{fragCurrent:u,partCurrent:d}=this,{levels:g,allAudioTracks:f,loadLevel:E,config:B}=this.hls;if(g.length===1)return 0;const S=g[h],Q=!!(S!=null&&(A=S.details)!=null&&A.live),m=E===-1||c===-1;let y,L="SDR",v=(S==null?void 0:S.frameRate)||0;const{audioPreference:F,videoPreference:G}=B,M=this.audioTracksByGroup||(this.audioTracksByGroup=K0(f));if(m){if(this.firstSelection!==-1)return this.firstSelection;const w=this.codecTiers||(this.codecTiers=Y0(g,M,t,i)),D=$0(w,L,e,F,G),{codecSet:X,videoRanges:R,minFramerate:b,minBitrate:T,preferHDR:K}=D;y=X,L=K?R[R.length-1]:R[0],v=b,e=Math.max(e,T),_.log(`[abr] picked start tier ${JSON.stringify(D)}`)}else y=S==null?void 0:S.codecSet,L=S==null?void 0:S.videoRange;const H=d?d.duration:u?u.duration:0,j=this.bwEstimator.getEstimateTTFB()/1e3,U=[];for(let w=i;w>=t;w--){var J;const D=g[w],X=w>h;if(!D)continue;if(B.useMediaCapabilities&&!D.supportedResult&&!D.supportedPromise){const ie=navigator.mediaCapabilities;typeof(ie==null?void 0:ie.decodingInfo)=="function"&&N0(D,M,L,v,e,F)?(D.supportedPromise=U0(D,M,ie),D.supportedPromise.then(ce=>{if(!this.hls)return;D.supportedResult=ce;const he=this.hls.levels,se=he.indexOf(D);ce.error?_.warn(`[abr] MediaCapabilities decodingInfo error: "${ce.error}" for level ${se} ${JSON.stringify(ce)}`):ce.supported||(_.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${se} ${JSON.stringify(ce)}`),se>-1&&he.length>1&&(_.log(`[abr] Removing unsupported level ${se}`),this.hls.removeLevel(se)))})):D.supportedResult=yc}if(y&&D.codecSet!==y||L&&D.videoRange!==L||X&&v>D.frameRate||!X&&v>0&&v<D.frameRate||D.supportedResult&&!((J=D.supportedResult.decodingInfoResults)!=null&&J[0].smooth)){U.push(w);continue}const R=D.details,b=(d?R==null?void 0:R.partTarget:R==null?void 0:R.averagetargetduration)||H;let T;X?T=a*e:T=o*e;const K=H&&r>=H*2&&n===0?g[w].averageBitrate:g[w].maxBitrate,P=this.getTimeToLoadFrag(j,T,K*b,R===void 0);if(T>=K&&(w===c||D.loadError===0&&D.fragmentError===0)&&(P<=j||!Ae(P)||Q&&!this.bitrateTestDelay||P<l)){const ie=this.forcedAutoLevel;return w!==E&&(ie===-1||ie!==E)&&(U.length&&_.trace(`[abr] Skipped level(s) ${U.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${g[U[0]].codecs}" ${g[U[0]].videoRange}; not compatible with "${S.codecs}" ${L}`),_.info(`[abr] switch candidate:${h}->${w} adjustedbw(${Math.round(T)})-bitrate=${Math.round(T-K)} ttfb:${j.toFixed(1)} avgDuration:${b.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${m} codecSet:${y} videoRange:${L} hls.loadLevel:${E}`)),m&&(this.firstSelection=w),w}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,r=Math.min(Math.max(e,i),t);this._nextAutoLevel!==r&&(this.nextAutoLevelKey="",this._nextAutoLevel=r)}}class q0{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var lt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class j0{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let r=i.length;r--;){const n=i[r];if(!n)break;const o=n.end;if(n.start<=e&&o!==null&&e<=o)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:i}=this,r=Object.keys(i);for(let n=r.length;n--;){const o=i[r[n]];if((o==null?void 0:o.body.type)===t&&o.buffered){const a=o.body;if(a.start<=e&&e<=a.end)return a}}return null}detectEvictedFragments(e,t,i,r){this.timeRanges&&(this.timeRanges[e]=t);const n=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a||n>=a.body.sn)return;if(!a.buffered&&!a.loaded){a.body.type===i&&this.removeFragment(a.body);return}const A=a.range[e];A&&A.time.some(l=>{const c=!this.isTimeBuffered(l.startPTS,l.endPTS,t);return c&&this.removeFragment(a.body),c})})}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:r}=e;if(!t||i.sn==="initSegment")return;const n=Cs(i),o=this.fragments[n];if(!o||o.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(A=>{const l=i.elementaryStreams[A];if(!l)return;const c=t[A],h=a||l.partial===!0;o.range[A]=this.getBufferedTimes(i,r,h,c)}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=i.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),on(o)||this.removeParts(i.sn-1,i.type)):this.removeFragment(o.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(r=>r.fragment.sn>=e))}fragBuffered(e,t){const i=Cs(e);let r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){const n={time:[],partial:i},o=e.start,a=e.end,A=e.minEndPTS||a,l=e.maxStartPTS||o;for(let c=0;c<r.length;c++){const h=r.start(c)-this.bufferPadding,u=r.end(c)+this.bufferPadding;if(l>=h&&A<=u){n.time.push({startPTS:Math.max(o,r.start(c)),endPTS:Math.min(a,r.end(c))});break}else if(o<u&&a>h){const d=Math.max(o,r.start(c)),g=Math.min(a,r.end(c));g>d&&(n.partial=!0,n.time.push({startPTS:d,endPTS:g}))}else if(a<=h)break}return n}getPartialFragment(e){let t=null,i,r,n,o=0;const{bufferPadding:a,fragments:A}=this;return Object.keys(A).forEach(l=>{const c=A[l];c&&on(c)&&(r=c.body.start-a,n=c.body.end+a,e>=r&&e<=n&&(i=Math.min(e-r,n-e),o<=i&&(t=c.body,o=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||on(t))}getState(e){const t=Cs(e),i=this.fragments[t];return i?i.buffered?on(i)?lt.PARTIAL:lt.OK:lt.APPENDING:lt.NOT_LOADED}isTimeBuffered(e,t,i){let r,n;for(let o=0;o<i.length;o++){if(r=i.start(o)-this.bufferPadding,n=i.end(o)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:r}=t;if(i.sn==="initSegment"||i.bitrateTest)return;const n=r?null:t,o=Cs(i);this.fragments[o]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:r,timeRanges:n}=t;if(i.sn==="initSegment")return;const o=i.type;if(r){let a=this.activePartLists[o];a||(this.activePartLists[o]=a=[]),a.push(r)}this.timeRanges=n,Object.keys(n).forEach(a=>{const A=n[a];this.detectEvictedFragments(a,A,o,r)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Cs(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const A=a.body;A.type!==i||r&&!A.gap||A.start<t&&A.end>e&&(a.buffered||n)&&this.removeFragment(A)})}removeFragment(e){const t=Cs(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const r=e.sn;this.activePartLists[e.type]=i.filter(n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function on(s){var e,t,i;return s.buffered&&(s.body.gap||((e=s.range.video)==null?void 0:e.partial)||((t=s.range.audio)==null?void 0:t.partial)||((i=s.range.audiovideo)==null?void 0:i.partial))}function Cs(s){return`${s.type}_${s.level}_${s.sn}`}const X0={length:0,start:()=>0,end:()=>0};class Pe{static isBuffered(e,t){try{if(e){const i=Pe.getBuffered(e);for(let r=0;r<i.length;r++)if(t>=i.start(r)&&t<=i.end(r))return!0}}catch{}return!1}static bufferInfo(e,t,i){try{if(e){const r=Pe.getBuffered(e),n=[];let o;for(o=0;o<r.length;o++)n.push({start:r.start(o),end:r.end(o)});return this.bufferedInfo(n,t,i)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.sort(function(l,c){const h=l.start-c.start;return h||c.end-l.end});let r=[];if(i)for(let l=0;l<e.length;l++){const c=r.length;if(c){const h=r[c-1].end;e[l].start-h<i?e[l].end>h&&(r[c-1].end=e[l].end):r.push(e[l])}else r.push(e[l])}else r=e;let n=0,o,a=t,A=t;for(let l=0;l<r.length;l++){const c=r[l].start,h=r[l].end;if(t+i>=c&&t<h)a=c,A=h,n=A-t;else if(t+i<c){o=c;break}}return{len:n,start:a||0,end:A||0,nextStart:o}}static getBuffered(e){try{return e.buffered}catch(t){return _.log("failed to get media.buffered",t),X0}}}class Ko{constructor(e,t,i,r=0,n=-1,o=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=an(),this.buffering={audio:an(),video:an(),audiovideo:an()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=o}}function an(){return{start:0,executeStart:0,executeEnd:0,end:0}}function An(s,e){for(let i=0,r=s.length;i<r;i++){var t;if(((t=s[i])==null?void 0:t.cc)===e)return s[i]}return null}function Z0(s,e,t){return!!(e&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function z0(s,e){const t=s.fragments,i=e.fragments;if(!i.length||!t.length){_.log("No fragments to align");return}const r=An(t,i[0].cc);if(!r||r&&!r.startPTS){_.log("No frag in previous level to align on");return}return r}function wc(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function Sc(s,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)wc(t[i],s);e.fragmentHint&&wc(e.fragmentHint,s),e.alignedSliding=!0}function eE(s,e,t){e&&(tE(s,t,e),!t.alignedSliding&&e&&ln(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&fc(e,t))}function tE(s,e,t){if(Z0(s,t,e)){const i=z0(t,e);i&&Ae(i.start)&&(_.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),Sc(i.start,e))}}function ln(s,e){if(!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=s.fragments,i=e.fragments;if(!t.length||!i.length)return;let r,n;const o=Math.min(e.endCC,s.endCC);e.startCC<o&&s.startCC<o&&(r=An(i,o),n=An(t,o)),(!r||!n)&&(r=i[Math.floor(i.length/2)],n=An(t,r.cc)||t[Math.floor(t.length/2)]);const a=r.programDateTime,A=n.programDateTime;if(!a||!A)return;const l=(A-a)/1e3-(n.start-r.start);Sc(l,s)}const Dc=Math.pow(2,17);class iE{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new mi({type:Ie.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(d=>d[0]==="GAP")){A(Rc(e));return}else e.gap=!1;const l=this.loader=e.loader=n?new n(r):new o(r),c=bc(e),h=mc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Dc};e.stats=l.stats,l.load(c,u,{onSuccess:(d,g,f,E)=>{this.resetLoader(e,l);let B=d.data;f.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(B.slice(0,16)),B=B.slice(16)),a({frag:e,part:null,payload:B,networkDetails:E})},onError:(d,g,f,E)=>{this.resetLoader(e,l),A(new mi({type:Ie.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:At({url:i,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:E}))},onAbort:(d,g,f)=>{this.resetLoader(e,l),A(new mi({type:Ie.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new mi({type:Ie.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:f,stats:d}))},onProgress:(d,g,f,E)=>{t&&t({frag:e,part:null,payload:f,networkDetails:E})}})})}loadPart(e,t,i){this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){A(Rc(e,t));return}const l=this.loader=e.loader=n?new n(r):new o(r),c=bc(e,t),h=mc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Dc};t.stats=l.stats,l.load(c,u,{onSuccess:(d,g,f,E)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const B={frag:e,part:t,payload:d.data,networkDetails:E};i(B),a(B)},onError:(d,g,f,E)=>{this.resetLoader(e,l),A(new mi({type:Ie.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:At({url:c.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:E}))},onAbort:(d,g,f)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),A(new mi({type:Ie.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new mi({type:Ie.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${u.timeout}ms`),networkDetails:f,stats:d}))}})})}updateStatsFromPart(e,t){const i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){const A=Math.round(e.duration/t.duration),l=Math.min(Math.round(i.loaded/n),A),h=(A-l)*Math.round(i.loaded/l);i.total=i.loaded+h}else i.total=Math.max(i.loaded,i.total);const o=i.loading,a=r.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function bc(s,e=null){const t=e||s,i={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(Ae(r)&&Ae(n)){var o;let a=r,A=n;if(s.sn==="initSegment"&&((o=s.decryptdata)==null?void 0:o.method)==="AES-128"){const l=n-r;l%16&&(A=n+(16-l%16)),r!==0&&(i.resetIV=!0,a=r-16)}i.rangeStart=a,i.rangeEnd=A}return i}function Rc(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:Ie.MEDIA_ERROR,details:$.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(i.part=e),(e||s).stats.aborted=!0,new mi(i)}class mi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class sE{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class rE{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function nE(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?Ji(s,0,e-t):s}class oE{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let r=0;r<4;r++)i[r]=t.getUint32(r*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],o=i[2],a=i[3],A=this.invSubMix,l=A[0],c=A[1],h=A[2],u=A[3],d=new Uint32Array(256);let g=0,f=0,E=0;for(E=0;E<256;E++)E<128?d[E]=E<<1:d[E]=E<<1^283;for(E=0;E<256;E++){let B=f^f<<1^f<<2^f<<3^f<<4;B=B>>>8^B&255^99,e[g]=B,t[B]=g;const S=d[g],Q=d[S],m=d[Q];let y=d[B]*257^B*16843008;r[g]=y<<24|y>>>8,n[g]=y<<16|y>>>16,o[g]=y<<8|y>>>24,a[g]=y,y=m*16843009^Q*65537^S*257^g*16843008,l[B]=y<<24|y>>>8,c[B]=y<<16|y>>>16,h[B]=y<<8|y>>>24,u[B]=y,g?(g=S^d[d[d[m^S]]],f^=d[d[f]]):g=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,r=0;for(;r<t.length&&i;)i=t[r]===this.key[r],r++;if(i)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const o=this.ksRows=(n+6+1)*4;let a,A;const l=this.keySchedule=new Uint32Array(o),c=this.invKeySchedule=new Uint32Array(o),h=this.sBox,u=this.rcon,d=this.invSubMix,g=d[0],f=d[1],E=d[2],B=d[3];let S,Q;for(a=0;a<o;a++){if(a<n){S=l[a]=t[a];continue}Q=S,a%n===0?(Q=Q<<8|Q>>>24,Q=h[Q>>>24]<<24|h[Q>>>16&255]<<16|h[Q>>>8&255]<<8|h[Q&255],Q^=u[a/n|0]<<24):n>6&&a%n===4&&(Q=h[Q>>>24]<<24|h[Q>>>16&255]<<16|h[Q>>>8&255]<<8|h[Q&255]),l[a]=S=(l[a-n]^Q)>>>0}for(A=0;A<o;A++)a=o-A,A&3?Q=l[a]:Q=l[a-4],A<4||a<=4?c[A]=Q:c[A]=g[h[Q>>>24]]^f[h[Q>>>16&255]]^E[h[Q>>>8&255]]^B[h[Q&255]],c[A]=c[A]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const r=this.keySize+6,n=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,A=a[0],l=a[1],c=a[2],h=a[3],u=this.uint8ArrayToUint32Array_(i);let d=u[0],g=u[1],f=u[2],E=u[3];const B=new Int32Array(e),S=new Int32Array(B.length);let Q,m,y,L,v,F,G,M,H,j,U,J,w,D;const X=this.networkToHostOrderSwap;for(;t<B.length;){for(H=X(B[t]),j=X(B[t+1]),U=X(B[t+2]),J=X(B[t+3]),v=H^n[0],F=J^n[1],G=U^n[2],M=j^n[3],w=4,D=1;D<r;D++)Q=A[v>>>24]^l[F>>16&255]^c[G>>8&255]^h[M&255]^n[w],m=A[F>>>24]^l[G>>16&255]^c[M>>8&255]^h[v&255]^n[w+1],y=A[G>>>24]^l[M>>16&255]^c[v>>8&255]^h[F&255]^n[w+2],L=A[M>>>24]^l[v>>16&255]^c[F>>8&255]^h[G&255]^n[w+3],v=Q,F=m,G=y,M=L,w=w+4;Q=o[v>>>24]<<24^o[F>>16&255]<<16^o[G>>8&255]<<8^o[M&255]^n[w],m=o[F>>>24]<<24^o[G>>16&255]<<16^o[M>>8&255]<<8^o[v&255]^n[w+1],y=o[G>>>24]<<24^o[M>>16&255]<<16^o[v>>8&255]<<8^o[F&255]^n[w+2],L=o[M>>>24]<<24^o[v>>16&255]<<16^o[F>>8&255]<<8^o[G&255]^n[w+3],S[t]=X(Q^d),S[t+1]=X(L^g),S[t+2]=X(y^f),S[t+3]=X(m^E),d=H,g=j,f=U,E=J,t=t+4}return S.buffer}}const aE=16;class Yo{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.subtle===null&&(this.useSoftware=!0)}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?nE(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i){return this.useSoftware?new Promise((r,n)=>{this.softwareDecrypt(new Uint8Array(e),t,i);const o=this.flush();o?r(o.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)}softwareDecrypt(e,t,i){const{currentIV:r,currentResult:n,remainderData:o}=this;this.logOnce("JS AES decrypt"),o&&(e=Mt(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;r&&(i=r);let A=this.softwareDecrypter;A||(A=this.softwareDecrypter=new oE),A.expandKey(t);const l=n;return this.currentResult=A.decrypt(a.buffer,0,i),this.currentIV=Ji(a,-16).buffer,l||null}webCryptoDecrypt(e,t,i){const r=this.subtle;return(this.key!==t||!this.fastAesKey)&&(this.key=t,this.fastAesKey=new rE(r,t)),this.fastAesKey.expandKey().then(n=>r?(this.logOnce("WebCrypto AES decrypt"),new sE(r,new Uint8Array(i)).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(_.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,i)))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%aE;return i!==e.length&&(t=Ji(e,0,i),this.remainderData=Ji(e,i)),t}logOnce(e){this.logEnabled&&(_.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const AE={toString:function(s){let e="";const t=s.length;for(let i=0;i<t;i++)e+=`[${s.start(i).toFixed(3)}-${s.end(i).toFixed(3)}]`;return e}},Z={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class Vo extends q0{constructor(e,t,i,r,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Z.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=n,this.logPrefix=r,this.log=_.log.bind(_,`${r}:`),this.warn=_.warn.bind(_,`${r}:`),this.hls=e,this.fragmentLoader=new iE(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Yo(e.config),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Z.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(i!=null&&i.length){const n=i[i.length-1];return Pe.isBuffered(this.media,n.start+n.duration/2)}const r=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(r)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const r=this.config;this.levels&&r.autoStartLoad&&this.state===Z.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:r,state:n}=this,o=i?i.currentTime:0,a=Pe.bufferInfo(r||i,o,e.maxBufferHole);if(this.log(`media seeking to ${Ae(o)?o.toFixed(3):o}, state: ${n}`),this.state===Z.ENDED)this.resetLoadingState();else if(t){const A=e.maxFragLookUpTolerance,l=t.start-A,c=t.start+t.duration+A;if(!a.len||c<a.start||l>a.end){const h=o>c;(o<l||h)&&(h&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}i&&(this.fragmentTracker.removeFragmentsInRange(o,1/0,this.playlistType,!0),this.lastCurrentTime=o),!this.loadedmetadata&&!a.len&&(this.nextLoadPosition=this.startPosition=o),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=Z.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const r=n=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${n.part?" p: "+n.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,i,r).then(n=>{if(!n)return;const o=this.state;if(this.fragContextChanged(e)){(o===Z.FRAG_LOADING||!this.fragCurrent&&o===Z.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=Z.IDLE);return}"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(p.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===Z.STOPPED||this.state===Z.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===lt.APPENDING){const n=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,n),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength);this.reduceMaxBufferLength(a)&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===lt.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:i};this.hls.trigger(p.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{if(!i||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:r}=this,{payload:n}=i,o=e.decryptdata;if(n&&n.byteLength>0&&o!=null&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),o.key.buffer,o.iv.buffer).catch(A=>{throw r.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:A,reason:A.message,frag:e}),A}).then(A=>{const l=self.performance.now();return r.trigger(p.FRAG_DECRYPTED,{frag:e,payload:A,stats:{tstart:a,tdecrypt:l}}),i.payload=A,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===Z.STOPPED||this.state===Z.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state=Z.IDLE,e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,r,n,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===Ee.MAIN?"level":"track"} ${e.level} (frag:[${((i=e.startPTS)!=null?i:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${a?AE.toString(Pe.getBuffered(a)):"(detached)"})`),e.sn!=="initSegment"){var A;if(e.type!==Ee.SUBTITLE){const c=e.elementaryStreams;if(!Object.keys(c).some(h=>!!c[h])){this.state=Z.IDLE;return}}const l=(A=this.levels)==null?void 0:A[e.level];l!=null&&l.fragmentError&&(this.log(`Resetting level fragment error count of ${l.fragmentError} on frag buffered`),l.fragmentError=0)}this.state=Z.IDLE,a&&(!this.loadedmetadata&&e.type==Ee.MAIN&&a.buffered.length&&((n=this.fragCurrent)==null?void 0:n.sn)===((o=this.fragPrevious)==null?void 0:o.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:r,partsLoaded:n}=e,o=!n||n.length===0||n.some(A=>!A),a=new Ko(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var n;const o=t==null?void 0:t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=Z.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(p.KEY_LOADED,c),this.state===Z.KEY_LOADING&&(this.state=Z.IDLE),c}),this.hls.trigger(p.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const c=o.partList;if(c&&r){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const h=this.getNextPart(c,e,i);if(h>-1){const u=c[h];this.log(`Loading part sn: ${e.sn} p: ${u.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${h}-${c.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=u.start+u.duration,this.state=Z.FRAG_LOADING;let d;return a?d=a.then(g=>!g||this.fragContextChanged(g.frag)?null:this.doFragPartsLoad(e,u,t,r)).catch(g=>this.handleFragLoadError(g)):d=this.doFragPartsLoad(e,u,t,r).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:u,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(c,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${o?"of ["+o.startSN+"-"+o.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),Ae(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Z.FRAG_LOADING;const A=this.config.progressive;let l;return A&&a?l=a.then(c=>!c||this.fragContextChanged(c==null?void 0:c.frag)?null:this.fragmentLoader.load(e,r)).catch(c=>this.handleFragLoadError(c)):l=Promise.all([this.fragmentLoader.load(e,A?r:void 0),a]).then(([c])=>(!A&&c&&r&&r(c),c)).catch(c=>this.handleFragLoadError(c)),this.hls.trigger(p.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,r){return new Promise((n,o)=>{var a;const A=[],l=(a=i.details)==null?void 0:a.partList,c=h=>{this.fragmentLoader.loadPart(e,h,r).then(u=>{A[h.index]=u;const d=u.part;this.hls.trigger(p.FRAG_LOADED,u);const g=Ec(i,e.sn,h.index+1)||pc(l,e.sn,h.index+1);if(g)c(g);else return n({frag:e,part:d,partsLoaded:A})}).catch(o)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===$.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:Ie.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Z.PARSING){!this.fragCurrent&&this.state!==Z.STOPPED&&this.state!==Z.ERROR&&(this.state=Z.IDLE);return}const{frag:i,part:r,level:n}=t,o=self.performance.now();i.stats.parsing.end=o,r&&(r.stats.parsing.end=o),this.updateLevelTiming(i,r,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:o}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${r}. The current chunk will not be buffered.`),null;const a=t[r],A=o>-1?Ec(a,n,o):null,l=A?A.fragment:T0(a,n,i);return l?(i&&i!==l&&(l.stats=i.stats),{frag:l,part:A,level:a}):null}bufferFragmentData(e,t,i,r,n){var o;if(!e||this.state!==Z.PARSING)return;const{data1:a,data2:A}=e;let l=a;if(a&&A&&(l=Mt(a,A)),!((o=l)!=null&&o.length))return;const c={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:l};if(this.hls.trigger(p.BUFFER_APPENDING,c),e.dropped&&e.independent&&!i){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Pe.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=Pe.bufferInfo(t,i,0),n=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),a=Math.max(Math.min(e.start-o,r.end-o),i+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return Ae(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:r}}=this,n=Pe.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,i);if(o&&n.nextStart<o.end)return Pe.bufferInfo(e,t,Math.max(n.nextStart,r))}return n}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,i=e||t.maxBufferLength;return t.maxMaxBufferLength>=i?(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0):!1}getAppendedFrag(e,t=Ee.MAIN){const i=this.fragmentTracker.getAppendedFrag(e,Ee.MAIN);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:n}=this,o=i[0].start;let a;if(t.live){const A=n.initialLiveManifestSize;if(r<A)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${A})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o)&&(a=this.getInitialLiveFragment(t,i),this.startPosition=this.nextLoadPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=i[0]);if(!a){const A=n.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,A,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===lt.OK||i===lt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,n){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(a===null)return a;if(e=a,o&&e&&!e.gap&&i.nextStart){const A=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r);if(A!==null&&i.len+A.len>=n)return this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let r=-1,n=!1,o=!0;for(let a=0,A=e.length;a<A;a++){const l=e[a];if(o=o&&!l.independent,r>-1&&i<l.start)break;const c=l.loaded;c?r=-1:(n||l.independent||o)&&l.fragment===t&&(r=a),n=c}return r}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=k0(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){const o=t[n-e.startSN];i.cc===o.cc&&(r=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=_0(t,i.cc),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:r}=this;let{fragPrevious:n}=this,{fragments:o,endSN:a}=i;const{fragmentHint:A}=i,l=r.maxFragLookUpTolerance,c=i.partList,h=!!(r.lowLatencyMode&&c!=null&&c.length&&A);h&&A&&!this.bitrateTest&&(o=o.concat(A),a=A.sn);let u;if(e<t){const d=e>t-l?0:l;u=nn(n,o,e,d)}else u=o[o.length-1];if(u){const d=u.sn-i.startSN,g=this.fragmentTracker.getState(u);if((g===lt.OK||g===lt.PARTIAL&&u.gap)&&(n=u),n&&u.sn===n.sn&&(!h||c[0].fragment.sn>u.sn)&&n&&u.level===n.level){const E=o[d+1];u.sn<a&&this.fragmentTracker.getState(E)!==lt.OK?u=E:u=null}}return u}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,n=i.currentTime,o=e.fragments[0].start,a=e.edge,A=n>=o-t.maxFragLookUpTolerance&&n<=a;if(r!==null&&i.duration>r&&(n<r||!A)){const l=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!A&&i.readyState<4||n<a-l)&&(this.loadedmetadata||(this.nextLoadPosition=r),i.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${r.toFixed(3)}`),i.currentTime=r))}}alignPlaylists(e,t,i){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const n=e.fragments[0].start,o=!t,a=e.alignedSliding&&Ae(n);if(o||!a&&!n){const{fragPrevious:A}=this;eE(A,i,e);const l=e.fragments[0].start;return this.log(`Live playlist sliding: ${l.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${A?A.sn:"na"} fragments: ${r}`),l}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;if(i<t&&(i=-1),i===-1||this.lastCurrentTime===-1){const r=this.startTimeOffset!==null,n=r?this.startTimeOffset:e.startTimeOffset;n!==null&&Ae(n)?(i=t+n,n<0&&(i+=e.totalduration),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Start time offset ${n} found in ${r?"multivariant":"media"} playlist, adjust startPosition to ${i}`),this.startPosition=i):e.live?i=this.hls.liveSyncPosition||t:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==Z.FRAG_LOADING_WAITING_RETRY)&&(this.state=Z.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const c=this.getCurrentContext(t.chunkMeta);c&&(t.frag=c.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===$.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction,{action:a,retryCount:A=0,retryConfig:l}=o||{};if(o&&a===pt.RetryRequest&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const c=Go(l,A);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${A+1}/${l.maxNumRetry} in ${c}ms`),o.resolved=!0,this.retryDate=self.performance.now()+c,this.state=Z.FRAG_LOADING_WAITING_RETRY}else if(l&&o)if(this.resetFragmentErrors(e),A<l.maxNumRetry)!n&&a!==pt.RemoveAlternatePermanently&&(o.resolved=!0);else{_.warn(`${t.details} reached or exceeded max retry (${A})`);return}else(o==null?void 0:o.action)===pt.SendAlternateToPenaltyBox?this.state=Z.WAITING_LEVEL:this.state=Z.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===Z.PARSING||this.state===Z.PARSED){const t=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,t),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===Ee.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Z.STOPPED&&(this.state=Z.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=Pe.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===Z.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Z.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){var n;const o=i.details;if(!o){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((A,l)=>{const c=e.elementaryStreams[l];if(c){const h=c.endPTS-c.startPTS;if(h<=0)return this.warn(`Could not parse fragment ${e.sn} ${l} duration reliably (${h})`),A||!1;const u=r?0:gc(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:o,level:i,drift:u,type:l,frag:e,start:c.startPTS,end:c.endPTS}),!0}return A},!1)&&((n=this.transmuxer)==null?void 0:n.error)===null){const A=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(i.fragmentError===0&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(A.message),this.hls.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:A,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=Z.PARSED,this.hls.trigger(p.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class xc{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=lE(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function lE(s,e){const t=new Uint8Array(e);let i=0;for(let r=0;r<s.length;r++){const n=s[r];t.set(n,i),i+=n.length}return t}function cE(){return typeof __HLS_WORKER_BUNDLE__=="function"}function hE(){const s=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(s);return{worker:new self.Worker(e),objectURL:e}}function uE(s){const e=new self.URL(s,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function si(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Jo{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=Mt(this.cachedData,e),this.cachedData=null);let i=tr(e,0),r=i?i.length:0,n;const o=this._audioTrack,a=this._id3Track,A=i?Do(i):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&Ae(A))&&(this.basePTS=dE(A,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ht.audioId3,duration:Number.POSITIVE_INFINITY});r<l;){if(this.canParse(e,r)){const c=this.appendFrame(o,e,r);c?(this.frameIndex++,this.lastPTS=c.sample.pts,r+=c.length,n=r):r=l}else Ff(e,r)?(i=tr(e,r),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ht.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,n=r):r++;if(r===l&&n!==l){const c=Ji(e,n);this.cachedData?this.cachedData=Mt(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:si(),id3Track:a,textTrack:si()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:si(),id3Track:this._id3Track,textTrack:si()}}destroy(){}}const dE=(s,e,t)=>{if(Ae(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};function gE(s,e,t,i){let r,n,o,a;const A=navigator.userAgent.toLowerCase(),l=i,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=((e[t+2]&192)>>>6)+1;const h=(e[t+2]&60)>>>2;if(h>c.length-1){const u=new Error(`invalid ADTS sampling index:${h}`);s.emit(p.ERROR,p.ERROR,{type:Ie.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!0,error:u,reason:u.message});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,_.log(`manifest codec:${i}, ADTS type:${r}, samplingIndex:${h}`),/firefox/i.test(A)?h>=6?(r=5,a=new Array(4),n=h-3):(r=2,a=new Array(2),n=h):A.indexOf("android")!==-1?(r=2,a=new Array(2),n=h):(r=5,a=new Array(4),i&&(i.indexOf("mp4a.40.29")!==-1||i.indexOf("mp4a.40.5")!==-1)||!i&&h>=6?n=h-3:((i&&i.indexOf("mp4a.40.2")!==-1&&(h>=6&&o===1||/vivaldi/i.test(A))||!i&&o===1)&&(r=2,a=new Array(2)),n=h)),a[0]=r<<3,a[0]|=(h&14)>>1,a[1]|=(h&1)<<7,a[1]|=o<<3,r===5&&(a[1]|=(n&14)>>1,a[2]=(n&1)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:c[h],channelCount:o,codec:"mp4a.40."+r,manifestCodec:l}}function Tc(s,e){return s[e]===255&&(s[e+1]&246)===240}function Lc(s,e){return s[e+1]&1?7:9}function Wo(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function fE(s,e){return e+5<s.length}function cn(s,e){return e+1<s.length&&Tc(s,e)}function EE(s,e){return fE(s,e)&&Tc(s,e)&&Wo(s,e)<=s.length-e}function pE(s,e){if(cn(s,e)){const t=Lc(s,e);if(e+t>=s.length)return!1;const i=Wo(s,e);if(i<=t)return!1;const r=e+i;return r===s.length||cn(s,r)}return!1}function kc(s,e,t,i,r){if(!s.samplerate){const n=gE(e,t,i,r);if(!n)return;s.config=n.config,s.samplerate=n.samplerate,s.channelCount=n.channelCount,s.codec=n.codec,s.manifestCodec=n.manifestCodec,_.log(`parsed codec:${s.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function Mc(s){return 9216e4/s}function IE(s,e){const t=Lc(s,e);if(e+t<=s.length){const i=Wo(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function _c(s,e,t,i,r){const n=Mc(s.samplerate),o=i+r*n,a=IE(e,t);let A;if(a){const{frameLength:h,headerLength:u}=a,d=u+h,g=Math.max(0,t+d-e.length);g?(A=new Uint8Array(d-u),A.set(e.subarray(t+u,e.length),0)):A=e.subarray(t+u,t+d);const f={unit:A,pts:o};return g||s.samples.push(f),{sample:f,length:d,missing:g}}const l=e.length-t;return A=new Uint8Array(l),A.set(e.subarray(t,e.length),0),{sample:{unit:A,pts:o},length:l,missing:-1}}let hn=null;const CE=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],mE=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],BE=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],yE=[0,1,1,4];function Fc(s,e,t,i,r){if(t+24>e.length)return;const n=Oc(e,t);if(n&&t+n.frameLength<=e.length){const o=n.samplesPerFrame*9e4/n.sampleRate,a=i+r*o,A={unit:e.subarray(t,t+n.frameLength),pts:a,dts:a};return s.config=[],s.channelCount=n.channelCount,s.samplerate=n.sampleRate,s.samples.push(A),{sample:A,length:n.frameLength,missing:0}}}function Oc(s,e){const t=s[e+1]>>3&3,i=s[e+1]>>1&3,r=s[e+2]>>4&15,n=s[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const o=s[e+2]>>1&1,a=s[e+3]>>6,A=t===3?3-i:i===3?3:4,l=CE[A*14+r-1]*1e3,h=mE[(t===3?0:t===2?1:2)*3+n],u=a===3?1:2,d=BE[t][i],g=yE[i],f=d*8*g,E=Math.floor(d*l/h+o)*g;if(hn===null){const Q=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);hn=Q?parseInt(Q[1]):0}return!!hn&&hn<=87&&i===2&&l>=224e3&&a===0&&(s[e+3]=s[e+3]|128),{sampleRate:h,channelCount:u,frameLength:E,samplesPerFrame:f}}}function qo(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function Nc(s,e){return e+1<s.length&&qo(s,e)}function QE(s,e){return qo(s,e)&&4<=s.length-e}function Uc(s,e){if(e+1<s.length&&qo(s,e)){const i=Oc(s,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const n=e+r;return n===s.length||Nc(s,n)}return!1}class vE extends Jo{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=tr(e,0);let i=(t==null?void 0:t.length)||0;if(Uc(e,i))return!1;for(let r=e.length;i<r;i++)if(pE(e,i))return _.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return EE(e,t)}appendFrame(e,t,i){kc(e,this.observer,t,i,e.manifestCodec);const r=_c(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const wE=/\/emsg[-/]ID3/i;class SE{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,r){const n=this.videoTrack=si("video",1),o=this.audioTrack=si("audio",1),a=this.txtTrack=si("text",1);if(this.id3Track=si("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const A=Hl(e);if(A.video){const{id:l,timescale:c,codec:h}=A.video;n.id=l,n.timescale=a.timescale=c,n.codec=h}if(A.audio){const{id:l,timescale:c,codec:h}=A.audio;o.id=l,o.timescale=c,o.codec=h}a.id=Nl.text,n.sampleDuration=0,n.duration=o.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return Yf(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Mt(this.remainderData,e));const a=zf(i);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=i;const o=this.extractID3Track(r,t);return n.samples=Kl(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return i.samples=Kl(e,t),{videoTrack:t,audioTrack:si(),id3Track:r,textTrack:si()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=me(e.samples,["emsg"]);r&&r.forEach(n=>{const o=i0(n);if(wE.test(o.schemeIdUri)){const a=Ae(o.presentationTime)?o.presentationTime/o.timeScale:t+o.presentationTimeDelta/o.timeScale;let A=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;A<=.001&&(A=Number.POSITIVE_INFINITY);const l=o.payload;i.samples.push({data:l,len:l.byteLength,dts:a,pts:a,type:Ht.emsg,duration:A})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const Pc=(s,e)=>{let t=0,i=5;e+=i;const r=new Uint32Array(1),n=new Uint32Array(1),o=new Uint8Array(1);for(;i>0;){o[0]=s[e];const a=Math.min(i,8),A=8-a;n[0]=4278190080>>>24+A<<A,r[0]=(o[0]&n[0])>>A,t=t?t<<a|r[0]:r[0],e+=1,i-=a}return t};class DE extends Jo{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const r=Gc(e,t,i,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=tr(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&Do(t)!==void 0&&Pc(e,i)<16}}function Gc(s,e,t,i,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const a=[48e3,44100,32e3][n],A=e[t+4]&63,c=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][A*3+n]*2;if(t+c>e.length)return-1;const h=e[t+6]>>5;let u=0;h===2?u+=2:(h&1&&h!==1&&(u+=2),h&4&&(u+=2));const d=(e[t+6]<<8|e[t+7])>>12-u&1,f=[2,1,2,3,3,4,4,5][h]+d,E=e[t+5]>>3,B=e[t+5]&7,S=new Uint8Array([n<<6|E<<1|B>>2,(B&3)<<6|h<<3|d<<2|A>>4,A<<4&224]),Q=1536/a*9e4,m=i+r*Q,y=e.subarray(t,t+c);return s.config=S,s.channelCount=f,s.samplerate=a,s.samples.push({unit:y,pts:m}),c}class bE{constructor(){this.VideoSample=null}createVideoSample(e,t,i,r){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:r,length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,r;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const n=i.units;r=n[n.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,r=i.length;if(r){const n=i[r-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&_.log(e.pts+"/"+e.dts+":"+e.debug)}}class Hc{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(i,i+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&_.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,i=8,r;for(let n=0;n<e;n++)i!==0&&(r=this.readEG(),i=(t+r+256)%256),t=i===0?t:i}readSPS(){let e=0,t=0,i=0,r=0,n,o,a;const A=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),h=this.readBoolean.bind(this),u=this.skipBits.bind(this),d=this.skipEG.bind(this),g=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);A();const E=A();if(l(5),u(3),A(),g(),E===100||E===110||E===122||E===244||E===44||E===83||E===86||E===118||E===128){const L=c();if(L===3&&u(1),g(),g(),u(1),h())for(o=L!==3?8:12,a=0;a<o;a++)h()&&(a<6?f(16):f(64))}g();const B=c();if(B===0)c();else if(B===1)for(u(1),d(),d(),n=c(),a=0;a<n;a++)d();g(),u(1);const S=c(),Q=c(),m=l(1);m===0&&u(1),u(1),h()&&(e=c(),t=c(),i=c(),r=c());let y=[1,1];if(h()&&h())switch(A()){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:{y=[A()<<8|A(),A()<<8|A()];break}}return{width:Math.ceil((S+1)*16-e*2-t*2),height:(2-m)*(Q+1)*16-(m?2:4)*(i+r),pixelRatio:y}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class RE extends bE{parseAVCPES(e,t,i,r,n){const o=this.parseAVCNALu(e,i.data);let a=this.VideoSample,A,l=!1;i.data=null,a&&o.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"")),o.forEach(c=>{var h;switch(c.type){case 1:{let f=!1;A=!0;const E=c.data;if(l&&E.length>4){const B=new Hc(E).readSliceType();(B===2||B===4||B===7||B===9)&&(f=!0)}if(f){var u;(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),a.frame=!0,a.key=f;break}case 5:A=!0,(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),a.key=!0,a.frame=!0;break;case 6:{A=!0,Yl(c.data,1,i.pts,t.samples);break}case 7:{var d,g;A=!0,l=!0;const f=c.data,B=new Hc(f).readSPS();if(!e.sps||e.width!==B.width||e.height!==B.height||((d=e.pixelRatio)==null?void 0:d[0])!==B.pixelRatio[0]||((g=e.pixelRatio)==null?void 0:g[1])!==B.pixelRatio[1]){e.width=B.width,e.height=B.height,e.pixelRatio=B.pixelRatio,e.sps=[f],e.duration=n;const S=f.subarray(1,4);let Q="avc1.";for(let m=0;m<3;m++){let y=S[m].toString(16);y.length<2&&(y="0"+y),Q+=y}e.codec=Q}break}case 8:A=!0,e.pps=[c.data];break;case 9:A=!0,e.audFound=!0,a&&this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:A=!0;break;default:A=!1,a&&(a.debug+="unknown NAL "+c.type+" ");break}a&&A&&a.units.push(c)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let r=e.naluState||0;const n=r,o=[];let a=0,A,l,c,h=-1,u=0;for(r===-1&&(h=0,u=t[0]&31,r=0,a=1);a<i;){if(A=t[a++],!r){r=A?0:1;continue}if(r===1){r=A?0:2;continue}if(!A)r=3;else if(A===1){if(l=a-r-1,h>=0){const d={data:t.subarray(h,l),type:u};o.push(d)}else{const d=this.getLastNalUnit(e.samples);d&&(n&&a<=4-n&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-n)),l>0&&(d.data=Mt(d.data,t.subarray(0,l)),d.state=0))}a<i?(c=t[a]&31,h=a,u=c,r=0):r=-1}else r=0}if(h>=0&&r>=0){const d={data:t.subarray(h,i),type:u,state:r};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);d&&(d.data=Mt(d.data,t))}return e.naluState=r,o}}class xE{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Yo(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),o=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(o).then(a=>{const A=new Uint8Array(a);r.set(A,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e}decryptAvcSample(e,t,i,r,n){const o=Vl(n.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(A=>{n.data=this.getAvcDecryptedUnit(o,A),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)})}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(i>=n.length);i++){const o=n[i];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,i,r,o),!this.decrypter.isSync()))return}}}}const ct=188;class ki{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.videoParser=new RE}static probe(e){const t=ki.syncOffset(e);return t>0&&_.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let i=Math.min(ct*5,t-ct)+1,r=0;for(;r<i;){let n=!1,o=-1,a=0;for(let A=r;A<t;A+=ct)if(e[A]===71&&(t-A===ct||e[A+ct]===71)){if(a++,o===-1&&(o=A,o!==0&&(i=Math.min(o+ct*99,e.length-ct)+1)),n||(n=jo(e,A)===0),n&&a>1&&(o===0&&a>2||A+ct>i))return o}else{if(a)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Nl[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=ki.createTrack("video"),this._audioTrack=ki.createTrack("audio",r),this._id3Track=ki.createTrack("id3"),this._txtTrack=ki.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=r}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,r=!1){i||(this.sampleAes=null);let n;const o=this._videoTrack,a=this._audioTrack,A=this._id3Track,l=this._txtTrack;let c=o.pid,h=o.pesData,u=a.pid,d=A.pid,g=a.pesData,f=A.pesData,E=null,B=this.pmtParsed,S=this._pmtId,Q=e.length;if(this.remainderData&&(e=Mt(this.remainderData,e),Q=e.length,this.remainderData=null),Q<ct&&!r)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};const m=Math.max(0,ki.syncOffset(e));Q-=(Q-m)%ct,Q<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,Q,e.buffer.byteLength-Q));let y=0;for(let v=m;v<Q;v+=ct)if(e[v]===71){const F=!!(e[v+1]&64),G=jo(e,v),M=(e[v+3]&48)>>4;let H;if(M>1){if(H=v+5+e[v+4],H===v+ct)continue}else H=v+4;switch(G){case c:F&&(h&&(n=ms(h))&&this.videoParser.parseAVCPES(o,l,n,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(H,v+ct)),h.size+=v+ct-H);break;case u:if(F){if(g&&(n=ms(g)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,n);break;case"mp3":this.parseMPEGPES(a,n);break;case"ac3":this.parseAC3PES(a,n);break}g={data:[],size:0}}g&&(g.data.push(e.subarray(H,v+ct)),g.size+=v+ct-H);break;case d:F&&(f&&(n=ms(f))&&this.parseID3PES(A,n),f={data:[],size:0}),f&&(f.data.push(e.subarray(H,v+ct)),f.size+=v+ct-H);break;case 0:F&&(H+=e[H]+1),S=this._pmtId=TE(e,H);break;case S:{F&&(H+=e[H]+1);const j=LE(e,H,this.typeSupported,i);c=j.videoPid,c>0&&(o.pid=c,o.segmentCodec=j.segmentVideoCodec),u=j.audioPid,u>0&&(a.pid=u,a.segmentCodec=j.segmentAudioCodec),d=j.id3Pid,d>0&&(A.pid=d),E!==null&&!B&&(_.warn(`MPEG-TS PMT found at ${v} after unknown PID '${E}'. Backtracking to sync byte @${m} to parse all TS packets.`),E=null,v=m-188),B=this.pmtParsed=!0;break}case 17:case 8191:break;default:E=G;break}}else y++;if(y>0){const v=new Error(`Found ${y} TS packet/s that do not start with 0x47`);this.observer.emit(p.ERROR,p.ERROR,{type:Ie.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:v,reason:v.message})}o.pesData=h,a.pesData=g,A.pesData=f;const L={audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};return r&&this.extractRemainingSamples(L),L}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:r,textTrack:n}=e,o=i.pesData,a=t.pesData,A=r.pesData;let l;if(o&&(l=ms(o))?(this.videoParser.parseAVCPES(i,n,l,!0,this._duration),i.pesData=null):i.pesData=o,a&&(l=ms(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l);break}t.pesData=null}else a!=null&&a.size&&_.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;A&&(l=ms(A))?(this.parseID3PES(r,l),r.pesData=null):r.pesData=A}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new xE(this.observer,this.config,t);return this.decrypt(r,n)}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const h=r.missing,u=r.sample.unit.byteLength;if(h===-1)n=Mt(r.sample.unit,n);else{const d=u-h;r.sample.unit.set(n.subarray(0,h),d),e.samples.push(r.sample),i=r.missing}}let o,a;for(o=i,a=n.length;o<a-1&&!cn(n,o);o++);if(o!==i){let h;const u=o<a-1;u?h=`AAC PES did not start with ADTS header,offset:${o}`:h="No ADTS header found in AAC PES";const d=new Error(h);if(_.warn(`parsing error: ${h}`),this.observer.emit(p.ERROR,p.ERROR,{type:Ie.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,levelRetry:u,error:d,reason:h}),!u)return}kc(e,this.observer,n,o,this.audioCodec);let A;if(t.pts!==void 0)A=t.pts;else if(r){const h=Mc(e.samplerate);A=r.sample.pts+h}else{_.warn("[tsdemuxer]: AAC PES unknown PTS");return}let l=0,c;for(;o<a;)if(c=_c(e,n,o,A,l),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(l++;o<a-1&&!cn(n,o);o++);}parseMPEGPES(e,t){const i=t.data,r=i.length;let n=0,o=0;const a=t.pts;if(a===void 0){_.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<r;)if(Nc(i,o)){const A=Fc(e,i,o,a,n);if(A)o+=A.length,n++;else break}else o++}parseAC3PES(e,t){{const i=t.data,r=t.pts;if(r===void 0){_.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=i.length;let o=0,a=0,A;for(;a<n&&(A=Gc(e,i,a,r,o++))>0;)a+=A}}parseID3PES(e,t){if(t.pts===void 0){_.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=Ze({},t,{type:this._videoTrack?Ht.emsg:Ht.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function jo(s,e){return((s[e+1]&31)<<8)+s[e+2]}function TE(s,e){return(s[e+10]&31)<<8|s[e+11]}function LE(s,e,t,i){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},n=(s[e+1]&15)<<8|s[e+2],o=e+3+n-4,a=(s[e+10]&15)<<8|s[e+11];for(e+=12+a;e<o;){const A=jo(s,e),l=(s[e+3]&15)<<8|s[e+4];switch(s[e]){case 207:if(!i){Xo("ADTS AAC");break}case 15:r.audioPid===-1&&(r.audioPid=A);break;case 21:r.id3Pid===-1&&(r.id3Pid=A);break;case 219:if(!i){Xo("H.264");break}case 27:r.videoPid===-1&&(r.videoPid=A,r.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?_.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=A,r.segmentAudioCodec="mp3");break;case 193:if(!i){Xo("AC-3");break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=A,r.segmentAudioCodec="ac3"):_.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&l>0){let c=e+5,h=l;for(;h>2;){switch(s[c]){case 106:t.ac3!==!0?_.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=A,r.segmentAudioCodec="ac3");break}const d=s[c+1]+2;c+=d,h-=d}}break;case 194:case 135:_.warn("Unsupported EC-3 in M2TS found");break;case 36:_.warn("Unsupported HEVC in M2TS found");break}e+=l+5}return r}function Xo(s){_.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function ms(s){let e=0,t,i,r,n,o;const a=s.data;if(!s||s.size===0)return null;for(;a[0].length<19&&a.length>1;)a[0]=Mt(a[0],a[1]),a.splice(1,1);if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(i=(t[4]<<8)+t[5],i&&i>s.size-6)return null;const l=t[7];l&192&&(n=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,l&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,n-o>54e5&&(_.warn(`${Math.round((n-o)/9e4)}s delta between PTS and DTS, align them`),n=o)):o=n),r=t[8];let c=r+9;if(s.size<=c)return null;s.size-=c;const h=new Uint8Array(s.size);for(let u=0,d=a.length;u<d;u++){t=a[u];let g=t.byteLength;if(c)if(c>g){c-=g;continue}else t=t.subarray(c),g-=c,c=0;h.set(t,e),e+=g}return i&&(i-=r+3),{data:h,pts:n,dts:o,len:i}}return null}class kE extends Jo{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=tr(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&Do(t)!==void 0&&Pc(e,i)<=16)return!1;for(let r=e.length;i<r;i++)if(Uc(e,i))return _.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return QE(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Fc(e,t,i,this.basePTS,this.frameIndex)}}class $c{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const Mi=Math.pow(2,32)-1;class O{static init(){O.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in O.types)O.types.hasOwnProperty(e)&&(O.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);O.HDLR_TYPES={video:t,audio:i};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=n,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,o,A,o,a),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,r))}static box(e,...t){let i=8,r=t.length;const n=r;for(;r--;)i+=t[r].byteLength;const o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=i&255,o.set(e,4),r=0,i=8;r<n;r++)o.set(t[r],i),i+=t[r].byteLength;return o}static hdlr(e){return O.box(O.types.hdlr,O.HDLR_TYPES[e])}static mdat(e){return O.box(O.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Mi+1)),r=Math.floor(t%(Mi+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return O.box(O.types.mdia,O.mdhd(e.timescale,e.duration),O.hdlr(e.type),O.minf(e))}static mfhd(e){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(e)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(e))}static moof(e,t,i){return O.box(O.types.moof,O.mfhd(e),O.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=O.trak(e[t]);return O.box.apply(null,[O.types.moov,O.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(O.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=O.trex(e[t]);return O.box.apply(null,[O.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Mi+1)),r=Math.floor(t%(Mi+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return O.box(O.types.mvhd,n)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,i[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return O.box(O.types.sdtp,i)}static stbl(e){return O.box(O.types.stbl,O.stsd(e),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))}static avc1(e){let t=[],i=[],r,n,o;for(r=0;r<e.sps.length;r++)n=e.sps[r],o=n.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],o=n.byteLength,i.push(o>>>8&255),i.push(o&255),i=i.concat(Array.prototype.slice.call(n));const a=O.box(O.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),A=e.width,l=e.height,c=e.pixelRatio[0],h=e.pixelRatio[1];return O.box(O.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,A>>8&255,A&255,l>>8&255,l&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,h>>24,h>>16&255,h>>8&255,h&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return O.box(O.types.mp4a,O.audioStsd(e),O.box(O.types.esds,O.esds(e)))}static mp3(e){return O.box(O.types[".mp3"],O.audioStsd(e))}static ac3(e){return O.box(O.types["ac-3"],O.audioStsd(e),O.box(O.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(e)):e.segmentCodec==="ac3"?O.box(O.types.stsd,O.STSD,O.ac3(e)):O.box(O.types.stsd,O.STSD,O.mp4a(e)):O.box(O.types.stsd,O.STSD,O.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,r=e.width,n=e.height,o=Math.floor(i/(Mi+1)),a=Math.floor(i%(Mi+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,a>>24,a>>16&255,a>>8&255,a&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const i=O.sdtp(e),r=e.id,n=Math.floor(t/(Mi+1)),o=Math.floor(t%(Mi+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,o>>24,o>>16&255,o>>8&255,o&255])),O.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,O.box(O.types.trak,O.tkhd(e),O.mdia(e))}static trex(e){const t=e.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],r=i.length,n=12+16*r,o=new Uint8Array(n);let a,A,l,c,h,u;for(t+=8+n,o.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<r;a++)A=i[a],l=A.duration,c=A.size,h=A.flags,u=A.cts,o.set([l>>>24&255,l>>>16&255,l>>>8&255,l&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,h.degradPrio&61440,h.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*a);return O.box(O.types.trun,o)}static initSegment(e){O.types||O.init();const t=O.moov(e);return Mt(O.FTYP,t)}}O.types=void 0,O.HDLR_TYPES=void 0,O.STTS=void 0,O.STSC=void 0,O.STCO=void 0,O.STSZ=void 0,O.VMHD=void 0,O.SMHD=void 0,O.STSD=void 0,O.FTYP=void 0,O.DINF=void 0;const Kc=9e4;function Zo(s,e,t=1,i=!1){const r=s*e*t;return i?Math.round(r):r}function ME(s,e,t=1,i=!1){return Zo(s,e,1/t,i)}function nr(s,e=!1){return Zo(s,1e3,1/Kc,e)}function _E(s,e=1){return Zo(s,Kc,1/e)}const FE=10*1e3,Yc=1024,OE=1152,NE=1536;let Bs=null,zo=null;class un{constructor(e,t,i,r=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,Bs===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Bs=o?parseInt(o[1]):0}if(zo===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);zo=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){_.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){_.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){_.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e.reduce((r,n)=>{const o=n.pts-r;return o<-4294967296?(t=!0,_t(r,n.pts)):o>0?r:n.pts},e[0].pts);return t&&_.debug("PTS rollover detected"),i}remux(e,t,i,r,n,o,a,A){let l,c,h,u,d,g,f=n,E=n;const B=e.pid>-1,S=t.pid>-1,Q=t.samples.length,m=e.samples.length>0,y=a&&Q>0||Q>1;if((!B||m)&&(!S||y)||this.ISGenerated||a){if(this.ISGenerated){var v,F,G,M;const J=this.videoTrackConfig;J&&(t.width!==J.width||t.height!==J.height||((v=t.pixelRatio)==null?void 0:v[0])!==((F=J.pixelRatio)==null?void 0:F[0])||((G=t.pixelRatio)==null?void 0:G[1])!==((M=J.pixelRatio)==null?void 0:M[1]))&&this.resetInitSegment()}else h=this.generateIS(e,t,n,o);const H=this.isVideoContiguous;let j=-1,U;if(y&&(j=UE(t.samples),!H&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,j>0){_.warn(`[mp4-remuxer]: Dropped ${j} out of ${Q} video samples due to a missing keyframe`);const J=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(j),t.dropped+=j,E+=(t.samples[0].pts-J)/t.inputTimeScale,U=E}else j===-1&&(_.warn(`[mp4-remuxer]: No keyframe found out of ${Q} video samples`),g=!1);if(this.ISGenerated){if(m&&y){const J=this.getVideoStartPts(t.samples),D=(_t(e.samples[0].pts,J)-J)/t.inputTimeScale;f+=Math.max(0,D),E+=Math.max(0,-D)}if(m){if(e.samplerate||(_.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,n,o)),c=this.remuxAudio(e,f,this.isAudioContiguous,o,S||y||A===Ee.AUDIO?E:void 0),y){const J=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(_.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,n,o)),l=this.remuxVideo(t,E,H,J)}}else y&&(l=this.remuxVideo(t,E,H,0));l&&(l.firstKeyFrame=j,l.independent=j!==-1,l.firstKeyFramePTS=U)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(d=Vc(i,n,this._initPTS,this._initDTS)),r.samples.length&&(u=Jc(r,n,this._initPTS))),{audio:c,video:l,initSegment:h,independent:g,text:u,id3:d}}generateIS(e,t,i,r){const n=e.samples,o=t.samples,a=this.typeSupported,A={},l=this._initPTS;let c=!l||r,h="audio/mp4",u,d,g;if(c&&(u=d=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(h="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}A.audio={id:"audio",container:h,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):O.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(g=e.inputTimeScale,!l||g!==l.timescale?u=d=n[0].pts-Math.round(g*i):c=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,A.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:O.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(g=t.inputTimeScale,!l||g!==l.timescale){const f=this.getVideoStartPts(o),E=Math.round(g*i);d=Math.min(d,_t(o[0].dts,f)-E),u=Math.min(u,f-E)}else c=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(A).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:u,timescale:g},this._initDTS={baseTime:d,timescale:g}):u=g=void 0,{tracks:A,initPTS:u,timescale:g}}remuxVideo(e,t,i,r){const n=e.inputTimeScale,o=e.samples,a=[],A=o.length,l=this._initPTS;let c=this.nextAvcDts,h=8,u=this.videoSampleDuration,d,g,f=Number.POSITIVE_INFINITY,E=Number.NEGATIVE_INFINITY,B=!1;if(!i||c===null){const b=t*n,T=o[0].pts-_t(o[0].dts,o[0].pts);Bs&&c!==null&&Math.abs(b-T-c)<15e3?i=!0:c=b-T}const S=l.baseTime*n/l.timescale;for(let b=0;b<A;b++){const T=o[b];T.pts=_t(T.pts-S,c),T.dts=_t(T.dts-S,c),T.dts<o[b>0?b-1:b].dts&&(B=!0)}B&&o.sort(function(b,T){const K=b.dts-T.dts,P=b.pts-T.pts;return K||P}),d=o[0].dts,g=o[o.length-1].dts;const Q=g-d,m=Q?Math.round(Q/(A-1)):u||e.inputTimeScale/30;if(i){const b=d-c,T=b>m,K=b<-1;if((T||K)&&(T?_.warn(`AVC: ${nr(b,!0)} ms (${b}dts) hole between fragments detected at ${t.toFixed(3)}`):_.warn(`AVC: ${nr(-b,!0)} ms (${b}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!K||c>=o[0].pts||Bs)){d=c;const P=o[0].pts-b;if(T)o[0].dts=d,o[0].pts=P;else for(let q=0;q<o.length&&!(o[q].dts>P);q++)o[q].dts-=b,o[q].pts-=b;_.log(`Video: Initial PTS/DTS adjusted: ${nr(P,!0)}/${nr(d,!0)}, delta: ${nr(b,!0)} ms`)}}d=Math.max(0,d);let y=0,L=0,v=d;for(let b=0;b<A;b++){const T=o[b],K=T.units,P=K.length;let q=0;for(let ie=0;ie<P;ie++)q+=K[ie].data.length;L+=q,y+=P,T.length=q,T.dts<v?(T.dts=v,v+=m/4|0||1):v=T.dts,f=Math.min(T.pts,f),E=Math.max(T.pts,E)}g=o[A-1].dts;const F=L+4*y+8;let G;try{G=new Uint8Array(F)}catch(b){this.observer.emit(p.ERROR,p.ERROR,{type:Ie.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:b,bytes:F,reason:`fail allocating video mdat ${F}`});return}const M=new DataView(G.buffer);M.setUint32(0,F),G.set(O.types.mdat,4);let H=!1,j=Number.POSITIVE_INFINITY,U=Number.POSITIVE_INFINITY,J=Number.NEGATIVE_INFINITY,w=Number.NEGATIVE_INFINITY;for(let b=0;b<A;b++){const T=o[b],K=T.units;let P=0;for(let ce=0,he=K.length;ce<he;ce++){const se=K[ce],Qe=se.data,Se=se.data.byteLength;M.setUint32(h,Se),h+=4,G.set(Qe,h),h+=Se,P+=4+Se}let q;if(b<A-1)u=o[b+1].dts-T.dts,q=o[b+1].pts-T.pts;else{const ce=this.config,he=b>0?T.dts-o[b-1].dts:m;if(q=b>0?T.pts-o[b-1].pts:m,ce.stretchShortVideoTrack&&this.nextAudioPts!==null){const se=Math.floor(ce.maxBufferHole*n),Qe=(r?f+r*n:this.nextAudioPts)-T.pts;Qe>se?(u=Qe-he,u<0?u=he:H=!0,_.log(`[mp4-remuxer]: It is approximately ${Qe/90} ms to the next segment; using duration ${u/90} ms for the last video frame.`)):u=he}else u=he}const ie=Math.round(T.pts-T.dts);j=Math.min(j,u),J=Math.max(J,u),U=Math.min(U,q),w=Math.max(w,q),a.push(new Wc(T.key,u,P,ie))}if(a.length){if(Bs){if(Bs<70){const b=a[0].flags;b.dependsOn=2,b.isNonSync=0}}else if(zo&&w-U<J-j&&m/J<.025&&a[0].cts===0){_.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let b=d;for(let T=0,K=a.length;T<K;T++){const P=b+a[T].duration,q=b+a[T].cts;if(T<K-1){const ie=P+a[T+1].cts;a[T].duration=ie-q}else a[T].duration=T?a[T-1].duration:m;a[T].cts=0,b=P}}}u=H||!u?m:u,this.nextAvcDts=c=g+u,this.videoSampleDuration=u,this.isVideoContiguous=!0;const R={data1:O.moof(e.sequenceNumber++,d,Ze({},e,{samples:a})),data2:G,startPTS:f/n,endPTS:(E+u)/n,startDTS:d/n,endDTS:c/n,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,R}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return OE;case"ac3":return NE;default:return Yc}}remuxAudio(e,t,i,r,n){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,A=o/a,l=this.getSamplesPerFrame(e),c=l*A,h=this._initPTS,u=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],g=n!==void 0;let f=e.samples,E=u?0:8,B=this.nextAudioPts||-1;const S=t*o,Q=h.baseTime*o/h.timescale;if(this.isAudioContiguous=i=i||f.length&&B>0&&(r&&Math.abs(S-B)<9e3||Math.abs(_t(f[0].pts-Q,S)-B)<20*c),f.forEach(function(D){D.pts=_t(D.pts-Q,S)}),!i||B<0){if(f=f.filter(D=>D.pts>=0),!f.length)return;n===0?B=0:r&&!g?B=Math.max(0,S):B=f[0].pts}if(e.segmentCodec==="aac"){const D=this.config.maxAudioFramesDrift;for(let X=0,R=B;X<f.length;X++){const b=f[X],T=b.pts,K=T-R,P=Math.abs(1e3*K/o);if(K<=-D*c&&g)X===0&&(_.warn(`Audio frame @ ${(T/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*K/o)} ms.`),this.nextAudioPts=B=R=T);else if(K>=D*c&&P<FE&&g){let q=Math.round(K/c);R=T-q*c,R<0&&(q--,R+=c),X===0&&(this.nextAudioPts=B=R),_.warn(`[mp4-remuxer]: Injecting ${q} audio frame @ ${(R/o).toFixed(3)}s due to ${Math.round(1e3*K/o)} ms gap.`);for(let ie=0;ie<q;ie++){const ce=Math.max(R,0);let he=$c.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);he||(_.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),he=b.unit.subarray()),f.splice(X,0,{unit:he,pts:ce}),R+=c,X++}}b.pts=R,R+=c}}let m=null,y=null,L,v=0,F=f.length;for(;F--;)v+=f[F].unit.byteLength;for(let D=0,X=f.length;D<X;D++){const R=f[D],b=R.unit;let T=R.pts;if(y!==null){const P=d[D-1];P.duration=Math.round((T-y)/A)}else if(i&&e.segmentCodec==="aac"&&(T=B),m=T,v>0){v+=E;try{L=new Uint8Array(v)}catch(P){this.observer.emit(p.ERROR,p.ERROR,{type:Ie.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:P,bytes:v,reason:`fail allocating audio mdat ${v}`});return}u||(new DataView(L.buffer).setUint32(0,v),L.set(O.types.mdat,4))}else return;L.set(b,E);const K=b.byteLength;E+=K,d.push(new Wc(!0,l,K,0)),y=T}const G=d.length;if(!G)return;const M=d[d.length-1];this.nextAudioPts=B=y+A*M.duration;const H=u?new Uint8Array(0):O.moof(e.sequenceNumber++,m/A,Ze({},e,{samples:d}));e.samples=[];const j=m/o,U=B/o,w={data1:H,data2:L,startPTS:j,endPTS:U,startDTS:j,endDTS:U,type:"audio",hasAudio:!0,hasVideo:!1,nb:G};return this.isAudioContiguous=!0,w}remuxEmptyAudio(e,t,i,r){const n=e.inputTimeScale,o=e.samplerate?e.samplerate:n,a=n/o,A=this.nextAudioPts,l=this._initDTS,c=l.baseTime*9e4/l.timescale,h=(A!==null?A:r.startDTS*n)+c,u=r.endDTS*n+c,d=a*Yc,g=Math.ceil((u-h)/d),f=$c.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(_.warn("[mp4-remuxer]: remux empty Audio"),!f){_.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const E=[];for(let B=0;B<g;B++){const S=h+B*d;E.push({unit:f,pts:S,dts:S})}return e.samples=E,this.remuxAudio(e,t,i,!1)}}function _t(s,e){let t;if(e===null)return s;for(e<s?t=-8589934592:t=8589934592;Math.abs(s-e)>4294967296;)s+=t;return s}function UE(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function Vc(s,e,t,i){const r=s.samples.length;if(!r)return;const n=s.inputTimeScale;for(let a=0;a<r;a++){const A=s.samples[a];A.pts=_t(A.pts-t.baseTime*n/t.timescale,e*n)/n,A.dts=_t(A.dts-i.baseTime*n/i.timescale,e*n)/n}const o=s.samples;return s.samples=[],{samples:o}}function Jc(s,e,t){const i=s.samples.length;if(!i)return;const r=s.inputTimeScale;for(let o=0;o<i;o++){const a=s.samples[o];a.pts=_t(a.pts-t.baseTime*r/t.timescale,e*r)/r}s.samples.sort((o,a)=>o.pts-a.pts);const n=s.samples;return s.samples=[],{samples:n}}class Wc{constructor(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class PE{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(Wf(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=Hl(e);r.audio&&(t=qc(r.audio,_e.AUDIO)),r.video&&(i=qc(r.video,_e.VIDEO));const n={};r.audio&&r.video?n.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?n.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:_.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,i,r,n,o){var a,A;let{initPTS:l,lastEndTime:c}=this;const h={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};Ae(c)||(c=this.lastEndTime=n||0);const u=t.samples;if(!(u!=null&&u.length))return h;const d={initPTS:void 0,timescale:1};let g=this.initData;if((a=g)!=null&&a.length||(this.generateInitSegment(u),g=this.initData),!((A=g)!=null&&A.length))return _.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const f=jf(u,g),E=qf(g,u),B=E===null?n:E;(GE(l,B,n,f)||d.timescale!==l.timescale&&o)&&(d.initPTS=B-n,l&&l.timescale===1&&_.warn(`Adjusting initPTS by ${d.initPTS-l.baseTime}`),this.initPTS=l={baseTime:d.initPTS,timescale:1});const S=e?B-l.baseTime/l.timescale:c,Q=S+f;Zf(g,u,l.baseTime/l.timescale),f>0?this.lastEndTime=Q:(_.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const m=!!g.audio,y=!!g.video;let L="";m&&(L+="audio"),y&&(L+="video");const v={data1:u,startPTS:S,startDTS:S,endPTS:Q,endDTS:Q,type:L,hasAudio:m,hasVideo:y,nb:1,dropped:0};return h.audio=v.type==="audio"?v:void 0,h.video=v.type!=="audio"?v:void 0,h.initSegment=d,h.id3=Vc(i,n,l,l),r.samples.length&&(h.text=Jc(r,n,l)),h}}function GE(s,e,t,i){if(s===null)return!0;const r=Math.max(i,1),n=e-s.baseTime/s.timescale;return Math.abs(n-t)>r}function qc(s,e){const t=s==null?void 0:s.codec;if(t&&t.length>4)return t;if(e===_e.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return Zr(t,!1);const i="mp4a.40.5";return _.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${i}"`),i}return _.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let Bi;try{Bi=self.performance.now.bind(self.performance)}catch{_.debug("Unable to use Performance API on this environment"),Bi=us==null?void 0:us.Date.now}const dn=[{demux:SE,remux:PE},{demux:ki,remux:un},{demux:vE,remux:un},{demux:kE,remux:un}];dn.splice(2,0,{demux:DE,remux:un});class jc{constructor(e,t,i,r,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,r){const n=i.transmuxing;n.executeStart=Bi();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:A}=this;r&&(this.currentTransmuxState=r);const{contiguous:l,discontinuity:c,trackSwitch:h,accurateTimeOffset:u,timeOffset:d,initSegmentChange:g}=r||a,{audioCodec:f,videoCodec:E,defaultInitPts:B,duration:S,initSegmentData:Q}=A,m=HE(o,t);if(m&&m.method==="AES-128"){const F=this.getDecrypter();if(F.isSync()){let G=F.softwareDecrypt(o,m.key.buffer,m.iv.buffer);if(i.part>-1&&(G=F.flush()),!G)return n.executeEnd=Bi(),ea(i);o=new Uint8Array(G)}else return this.decryptionPromise=F.webCryptoDecrypt(o,m.key.buffer,m.iv.buffer).then(G=>{const M=this.push(G,null,i);return this.decryptionPromise=null,M}),this.decryptionPromise}const y=this.needsProbing(c,h);if(y){const F=this.configureTransmuxer(o);if(F)return _.warn(`[transmuxer] ${F.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:Ie.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:F,reason:F.message}),n.executeEnd=Bi(),ea(i)}(c||h||g||y)&&this.resetInitSegment(Q,f,E,S,t),(c||g||y)&&this.resetInitialTimestamp(B),l||this.resetContiguity();const L=this.transmux(o,m,d,u,i),v=this.currentTransmuxState;return v.contiguous=!0,v.discontinuity=!1,v.trackSwitch=!1,n.executeEnd=Bi(),L}flush(e){const t=e.transmuxing;t.executeStart=Bi();const{decrypter:i,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const o=[],{timeOffset:a}=r;if(i){const h=i.flush();h&&o.push(this.push(h,null,e))}const{demuxer:A,remuxer:l}=this;if(!A||!l)return t.executeEnd=Bi(),[ea(e)];const c=A.flush(a);return gn(c)?c.then(h=>(this.flushRemux(o,h,e),o)):(this.flushRemux(o,c,e),o)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:n,id3Track:o,textTrack:a}=t,{accurateTimeOffset:A,timeOffset:l}=this.currentTransmuxState;_.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const c=this.remuxer.remux(r,n,o,a,l,A,!0,this.id);e.push({remuxResult:c,chunkMeta:i}),i.transmuxing.executeEnd=Bi()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,r,n){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,i,r),a.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,n){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,i,r,n):o=this.transmuxUnencrypted(e,i,r,n),o}transmuxUnencrypted(e,t,i,r){const{audioTrack:n,videoTrack:o,id3Track:a,textTrack:A}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,o,a,A,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,n){return this.demuxer.demuxSampleAes(e,t,i).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,i,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:r,vendor:n}=this;let o;for(let u=0,d=dn.length;u<d;u++){var a;if((a=dn[u].demux)!=null&&a.probe(e)){o=dn[u];break}}if(!o)return new Error("Failed to find demuxer by probing fragment data");const A=this.demuxer,l=this.remuxer,c=o.remux,h=o.demux;(!l||!(l instanceof c))&&(this.remuxer=new c(i,t,r,n)),(!A||!(A instanceof h))&&(this.demuxer=new h(i,t,r),this.probe=h.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Yo(this.config)),e}}function HE(s,e){let t=null;return s.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const ea=s=>({remuxResult:{},chunkMeta:s});function gn(s){return"then"in s&&s.then instanceof Function}class $E{constructor(e,t,i,r,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=n||null}}class KE{constructor(e,t,i,r,n,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=o}}var Xc={exports:{}};(function(s){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(A,l,c){this.fn=A,this.context=l,this.once=c||!1}function n(A,l,c,h,u){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new r(c,h||A,u),g=t?t+l:l;return A._events[g]?A._events[g].fn?A._events[g]=[A._events[g],d]:A._events[g].push(d):(A._events[g]=d,A._eventsCount++),A}function o(A,l){--A._eventsCount===0?A._events=new i:delete A._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,h;if(this._eventsCount===0)return l;for(h in c=this._events)e.call(c,h)&&l.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=t?t+l:l,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var u=0,d=h.length,g=new Array(d);u<d;u++)g[u]=h[u].fn;return g},a.prototype.listenerCount=function(l){var c=t?t+l:l,h=this._events[c];return h?h.fn?1:h.length:0},a.prototype.emit=function(l,c,h,u,d,g){var f=t?t+l:l;if(!this._events[f])return!1;var E=this._events[f],B=arguments.length,S,Q;if(E.fn){switch(E.once&&this.removeListener(l,E.fn,void 0,!0),B){case 1:return E.fn.call(E.context),!0;case 2:return E.fn.call(E.context,c),!0;case 3:return E.fn.call(E.context,c,h),!0;case 4:return E.fn.call(E.context,c,h,u),!0;case 5:return E.fn.call(E.context,c,h,u,d),!0;case 6:return E.fn.call(E.context,c,h,u,d,g),!0}for(Q=1,S=new Array(B-1);Q<B;Q++)S[Q-1]=arguments[Q];E.fn.apply(E.context,S)}else{var m=E.length,y;for(Q=0;Q<m;Q++)switch(E[Q].once&&this.removeListener(l,E[Q].fn,void 0,!0),B){case 1:E[Q].fn.call(E[Q].context);break;case 2:E[Q].fn.call(E[Q].context,c);break;case 3:E[Q].fn.call(E[Q].context,c,h);break;case 4:E[Q].fn.call(E[Q].context,c,h,u);break;default:if(!S)for(y=1,S=new Array(B-1);y<B;y++)S[y-1]=arguments[y];E[Q].fn.apply(E[Q].context,S)}}return!0},a.prototype.on=function(l,c,h){return n(this,l,c,h,!1)},a.prototype.once=function(l,c,h){return n(this,l,c,h,!0)},a.prototype.removeListener=function(l,c,h,u){var d=t?t+l:l;if(!this._events[d])return this;if(!c)return o(this,d),this;var g=this._events[d];if(g.fn)g.fn===c&&(!u||g.once)&&(!h||g.context===h)&&o(this,d);else{for(var f=0,E=[],B=g.length;f<B;f++)(g[f].fn!==c||u&&!g[f].once||h&&g[f].context!==h)&&E.push(g[f]);E.length?this._events[d]=E.length===1?E[0]:E:o(this,d)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=t?t+l:l,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,s.exports=a})(Xc);var YE=Xc.exports,ta=ff(YE);class Zc{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const o=(c,h)=>{h=h||{},h.frag=this.frag,h.id=this.id,c===p.ERROR&&(this.error=h.error),this.hls.trigger(c,h)};this.observer=new ta,this.observer.on(p.FRAG_DECRYPTED,o),this.observer.on(p.ERROR,o);const a=ds(n.preferManagedMediaSource)||{isTypeSupported:()=>!1},A={mpeg:a.isTypeSupported("audio/mpeg"),mp3:a.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:a.isTypeSupported('audio/mp4; codecs="ac-3"')},l=navigator.vendor;if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||cE())){try{n.workerPath?(_.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=uE(n.workerPath)):(_.log(`injecting Web Worker for "${t}"`),this.workerContext=hE()),this.onwmsg=u=>this.onWorkerMessage(u);const{worker:h}=this.workerContext;h.addEventListener("message",this.onwmsg),h.onerror=u=>{const d=new Error(`${u.message} (${u.filename}:${u.lineno})`);n.enableWorker=!1,_.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(p.ERROR,{type:Ie.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:d})},h.postMessage({cmd:"init",typeSupported:A,vendor:l,id:t,config:JSON.stringify(n)})}catch(h){_.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.resetWorker(),this.error=null,this.transmuxer=new jc(this.observer,A,n,l,t)}return}this.transmuxer=new jc(this.observer,A,n,l,t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,r,n,o,a,A,l,c){var h,u;l.transmuxing.start=self.performance.now();const{transmuxer:d}=this,g=o?o.start:n.start,f=n.decryptdata,E=this.frag,B=!(E&&n.cc===E.cc),S=!(E&&l.level===E.level),Q=E?l.sn-E.sn:-1,m=this.part?l.part-this.part.index:-1,y=Q===0&&l.id>1&&l.id===(E==null?void 0:E.stats.chunkCount),L=!S&&(Q===1||Q===0&&(m===1||y&&m<=0)),v=self.performance.now();(S||Q||n.stats.parsing.start===0)&&(n.stats.parsing.start=v),o&&(m||!L)&&(o.stats.parsing.start=v);const F=!(E&&((h=n.initSegment)==null?void 0:h.url)===((u=E.initSegment)==null?void 0:u.url)),G=new KE(B,L,A,S,g,F);if(!L||B||F){_.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}
165
- discontinuity: ${B}
166
- trackSwitch: ${S}
167
- contiguous: ${L}
168
+ Switching to level ${U} @ ${q|0} bps`),r.trigger(E.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:i,stats:A})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(N.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new ap(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(E.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var r;this.fragCurrent=i,this.partCurrent=(r=t.part)!=null?r:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case $.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:r,partCurrent:n}=this;if(i&&r&&i.sn===r.sn&&i.level===r.level){const o=performance.now(),a=n?n.stats:i.stats,A=o-a.loading.start,l=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&l>-1){const u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(A-Math.min(u,l),a.loaded)}else this.bwEstimator.sampleTTFB(A)}break}}}getTimeToLoadFrag(e,t,i,r){const n=e+i/t,o=r?this.lastLevelLoadSec:0;return n+o}onLevelLoaded(e,t){const i=this.hls.config,{loading:r}=t.stats,n=r.end-r.start;oe(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const r=i?i.stats:t.stats;if(t.type===de.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=i?i.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+r.loaded,A=(o.loaded?o.loaded.duration:0)+n;o.loaded={bytes:a,duration:A},o.realBitrate=Math.round(8*a/A)}if(t.bitrateTest){const n={stats:r,frag:t,part:i,id:t.type};this.onFragBuffered(E.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:r}=t,n=r!=null&&r.stats.loaded?r.stats:i.stats;if(n.aborted||this.ignoreFragment(i))return;const o=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,n.loaded),n.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==de.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,t,e,0,r,1,1);if(n>-1)return n;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return N.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=i&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,n)&&o[e].loadError<=o[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:r,config:n,minAutoLevel:o}=i,a=t?t.duration:e?e.duration:0,A=this.getBwEstimate(),l=this.getStarvationDelay();let c=n.abrBandWidthFactor,u=n.abrBandWidthUpFactor;if(l){const p=this.findBestLevel(A,o,r,l,0,c,u);if(p>=0)return p}let h=a?Math.min(a,n.maxStarvationDelay):n.maxStarvationDelay;if(!l){const p=this.bitrateTestDelay;p&&(h=(a?Math.min(a,n.maxLoadingDelay):n.maxLoadingDelay)-p,N.info(`[abr] bitrate test took ${Math.round(1e3*p)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),c=u=1)}const d=this.findBestLevel(A,o,r,l,h,c,u);if(N.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`),d>-1)return d;const g=i.levels[o],f=i.levels[i.loadLevel];return(g==null?void 0:g.bitrate)<(f==null?void 0:f.bitrate)?o:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,r,n,o,a){var A;const l=r+n,c=this.lastLoadedFragLevel,u=c===-1?this.hls.firstLevel:c,{fragCurrent:h,partCurrent:d}=this,{levels:g,allAudioTracks:f,loadLevel:p,config:v}=this.hls;if(g.length===1)return 0;const y=g[u],Q=!!(y!=null&&(A=y.details)!=null&&A.live),m=p===-1||c===-1;let b,x="SDR",B=(y==null?void 0:y.frameRate)||0;const{audioPreference:H,videoPreference:_}=v,k=this.audioTracksByGroup||(this.audioTracksByGroup=gp(f));if(m){if(this.firstSelection!==-1)return this.firstSelection;const S=this.codecTiers||(this.codecTiers=fp(g,k,t,i)),T=dp(S,x,e,H,_),{codecSet:O,videoRanges:R,minFramerate:w,minBitrate:L,preferHDR:K}=T;b=O,x=K?R[R.length-1]:R[0],B=w,e=Math.max(e,L),N.log(`[abr] picked start tier ${JSON.stringify(T)}`)}else b=y==null?void 0:y.codecSet,x=y==null?void 0:y.videoRange;const U=d?d.duration:h?h.duration:0,q=this.bwEstimator.getEstimateTTFB()/1e3,V=[];for(let S=i;S>=t;S--){var Z;const T=g[S],O=S>u;if(!T)continue;if(v.useMediaCapabilities&&!T.supportedResult&&!T.supportedPromise){const te=navigator.mediaCapabilities;typeof(te==null?void 0:te.decodingInfo)=="function"&&Ap(T,k,x,B,e,H)?(T.supportedPromise=lp(T,k,te),T.supportedPromise.then(ue=>{if(!this.hls)return;T.supportedResult=ue;const ce=this.hls.levels,me=ce.indexOf(T);ue.error?N.warn(`[abr] MediaCapabilities decodingInfo error: "${ue.error}" for level ${me} ${JSON.stringify(ue)}`):ue.supported||(N.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${me} ${JSON.stringify(ue)}`),me>-1&&ce.length>1&&(N.log(`[abr] Removing unsupported level ${me}`),this.hls.removeLevel(me)))})):T.supportedResult=Mc}if(b&&T.codecSet!==b||x&&T.videoRange!==x||O&&B>T.frameRate||!O&&B>0&&B<T.frameRate||T.supportedResult&&!((Z=T.supportedResult.decodingInfoResults)!=null&&Z[0].smooth)){V.push(S);continue}const R=T.details,w=(d?R==null?void 0:R.partTarget:R==null?void 0:R.averagetargetduration)||U;let L;O?L=a*e:L=o*e;const K=U&&r>=U*2&&n===0?g[S].averageBitrate:g[S].maxBitrate,G=this.getTimeToLoadFrag(q,L,K*w,R===void 0);if(L>=K&&(S===c||T.loadError===0&&T.fragmentError===0)&&(G<=q||!oe(G)||Q&&!this.bitrateTestDelay||G<l)){const te=this.forcedAutoLevel;return S!==p&&(te===-1||te!==p)&&(V.length&&N.trace(`[abr] Skipped level(s) ${V.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${g[V[0]].codecs}" ${g[V[0]].videoRange}; not compatible with "${y.codecs}" ${x}`),N.info(`[abr] switch candidate:${u}->${S} adjustedbw(${Math.round(L)})-bitrate=${Math.round(L-K)} ttfb:${q.toFixed(1)} avgDuration:${w.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${G.toFixed(1)} firstSelection:${m} codecSet:${b} videoRange:${x} hls.loadLevel:${p}`)),m&&(this.firstSelection=S),S}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,r=Math.min(Math.max(e,i),t);this._nextAutoLevel!==r&&(this.nextAutoLevelKey="",this._nextAutoLevel=r)}}class mp{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var ct={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Cp{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let r=i.length;r--;){const n=i[r];if(!n)break;const o=n.end;if(n.start<=e&&o!==null&&e<=o)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:i}=this,r=Object.keys(i);for(let n=r.length;n--;){const o=i[r[n]];if((o==null?void 0:o.body.type)===t&&o.buffered){const a=o.body;if(a.start<=e&&e<=a.end)return a}}return null}detectEvictedFragments(e,t,i,r){this.timeRanges&&(this.timeRanges[e]=t);const n=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a||n>=a.body.sn)return;if(!a.buffered&&!a.loaded){a.body.type===i&&this.removeFragment(a.body);return}const A=a.range[e];A&&A.time.some(l=>{const c=!this.isTimeBuffered(l.startPTS,l.endPTS,t);return c&&this.removeFragment(a.body),c})})}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:r}=e;if(!t||i.sn==="initSegment")return;const n=vs(i),o=this.fragments[n];if(!o||o.buffered&&i.gap)return;const a=!i.relurl;Object.keys(t).forEach(A=>{const l=i.elementaryStreams[A];if(!l)return;const c=t[A],u=a||l.partial===!0;o.range[A]=this.getBufferedTimes(i,r,u,c)}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=i.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),mn(o)||this.removeParts(i.sn-1,i.type)):this.removeFragment(o.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(r=>r.fragment.sn>=e))}fragBuffered(e,t){const i=vs(e);let r=this.fragments[i];!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,i,r){const n={time:[],partial:i},o=e.start,a=e.end,A=e.minEndPTS||a,l=e.maxStartPTS||o;for(let c=0;c<r.length;c++){const u=r.start(c)-this.bufferPadding,h=r.end(c)+this.bufferPadding;if(l>=u&&A<=h){n.time.push({startPTS:Math.max(o,r.start(c)),endPTS:Math.min(a,r.end(c))});break}else if(o<h&&a>u){const d=Math.max(o,r.start(c)),g=Math.min(a,r.end(c));g>d&&(n.partial=!0,n.time.push({startPTS:d,endPTS:g}))}else if(a<=u)break}return n}getPartialFragment(e){let t=null,i,r,n,o=0;const{bufferPadding:a,fragments:A}=this;return Object.keys(A).forEach(l=>{const c=A[l];c&&mn(c)&&(r=c.body.start-a,n=c.body.end+a,e>=r&&e<=n&&(i=Math.min(e-r,n-e),o<=i&&(t=c.body,o=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||mn(t))}getState(e){const t=vs(e),i=this.fragments[t];return i?i.buffered?mn(i)?ct.PARTIAL:ct.OK:ct.APPENDING:ct.NOT_LOADED}isTimeBuffered(e,t,i){let r,n;for(let o=0;o<i.length;o++){if(r=i.start(o)-this.bufferPadding,n=i.end(o)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:r}=t;if(i.sn==="initSegment"||i.bitrateTest)return;const n=r?null:t,o=vs(i);this.fragments[o]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:r,timeRanges:n}=t;if(i.sn==="initSegment")return;const o=i.type;if(r){let a=this.activePartLists[o];a||(this.activePartLists[o]=a=[]),a.push(r)}this.timeRanges=n,Object.keys(n).forEach(a=>{const A=n[a];this.detectEvictedFragments(a,A,o,r)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=vs(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,r,n){r&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const A=a.body;A.type!==i||r&&!A.gap||A.start<t&&A.end>e&&(a.buffered||n)&&this.removeFragment(A)})}removeFragment(e){const t=vs(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const r=e.sn;this.activePartLists[e.type]=i.filter(n=>n.fragment.sn!==r)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function mn(s){var e,t,i;return s.buffered&&(s.body.gap||((e=s.range.video)==null?void 0:e.partial)||((t=s.range.audio)==null?void 0:t.partial)||((i=s.range.audiovideo)==null?void 0:i.partial))}function vs(s){return`${s.type}_${s.level}_${s.sn}`}const vp={length:0,start:()=>0,end:()=>0};class Ye{static isBuffered(e,t){try{if(e){const i=Ye.getBuffered(e);for(let r=0;r<i.length;r++)if(t>=i.start(r)&&t<=i.end(r))return!0}}catch{}return!1}static bufferInfo(e,t,i){try{if(e){const r=Ye.getBuffered(e),n=[];let o;for(o=0;o<r.length;o++)n.push({start:r.start(o),end:r.end(o)});return this.bufferedInfo(n,t,i)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.sort(function(l,c){const u=l.start-c.start;return u||c.end-l.end});let r=[];if(i)for(let l=0;l<e.length;l++){const c=r.length;if(c){const u=r[c-1].end;e[l].start-u<i?e[l].end>u&&(r[c-1].end=e[l].end):r.push(e[l])}else r.push(e[l])}else r=e;let n=0,o,a=t,A=t;for(let l=0;l<r.length;l++){const c=r[l].start,u=r[l].end;if(t+i>=c&&t<u)a=c,A=u,n=A-t;else if(t+i<c){o=c;break}}return{len:n,start:a||0,end:A||0,nextStart:o}}static getBuffered(e){try{return e.buffered}catch(t){return N.log("failed to get media.buffered",t),vp}}}class aa{constructor(e,t,i,r=0,n=-1,o=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Cn(),this.buffering={audio:Cn(),video:Cn(),audiovideo:Cn()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=o}}function Cn(){return{start:0,executeStart:0,executeEnd:0,end:0}}function vn(s,e){for(let i=0,r=s.length;i<r;i++){var t;if(((t=s[i])==null?void 0:t.cc)===e)return s[i]}return null}function yp(s,e,t){return!!(e&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function Bp(s,e){const t=s.fragments,i=e.fragments;if(!i.length||!t.length){N.log("No fragments to align");return}const r=vn(t,i[0].cc);if(!r||r&&!r.startPTS){N.log("No frag in previous level to align on");return}return r}function Uc(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function Gc(s,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)Uc(t[i],s);e.fragmentHint&&Uc(e.fragmentHint,s),e.alignedSliding=!0}function Qp(s,e,t){e&&(bp(s,t,e),!t.alignedSliding&&e&&yn(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&Tc(e,t))}function bp(s,e,t){if(yp(s,t,e)){const i=Bp(t,e);i&&oe(i.start)&&(N.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),Gc(i.start,e))}}function yn(s,e){if(!s.hasProgramDateTime||!e.hasProgramDateTime)return;const t=s.fragments,i=e.fragments;if(!t.length||!i.length)return;let r,n;const o=Math.min(e.endCC,s.endCC);e.startCC<o&&s.startCC<o&&(r=vn(i,o),n=vn(t,o)),(!r||!n)&&(r=i[Math.floor(i.length/2)],n=vn(t,r.cc)||t[Math.floor(t.length/2)]);const a=r.programDateTime,A=n.programDateTime;if(!a||!A)return;const l=(A-a)/1e3-(n.start-r.start);Gc(l,s)}const Hc=Math.pow(2,17);class Sp{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new Bi({type:Ee.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(d=>d[0]==="GAP")){A(Yc(e));return}else e.gap=!1;const l=this.loader=e.loader=n?new n(r):new o(r),c=$c(e),u=Fc(r.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Hc};e.stats=l.stats,l.load(c,h,{onSuccess:(d,g,f,p)=>{this.resetLoader(e,l);let v=d.data;f.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(v.slice(0,16)),v=v.slice(16)),a({frag:e,part:null,payload:v,networkDetails:p})},onError:(d,g,f,p)=>{this.resetLoader(e,l),A(new Bi({type:Ee.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:lt({url:i,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:p}))},onAbort:(d,g,f)=>{this.resetLoader(e,l),A(new Bi({type:Ee.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new Bi({type:Ee.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:f,stats:d}))},onProgress:(d,g,f,p)=>{t&&t({frag:e,part:null,payload:f,networkDetails:p})}})})}loadPart(e,t,i){this.abort();const r=this.config,n=r.fLoader,o=r.loader;return new Promise((a,A)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){A(Yc(e,t));return}const l=this.loader=e.loader=n?new n(r):new o(r),c=$c(e,t),u=Fc(r.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Hc};t.stats=l.stats,l.load(c,h,{onSuccess:(d,g,f,p)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const v={frag:e,part:t,payload:d.data,networkDetails:p};i(v),a(v)},onError:(d,g,f,p)=>{this.resetLoader(e,l),A(new Bi({type:Ee.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:lt({url:c.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:f,stats:p}))},onAbort:(d,g,f)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),A(new Bi({type:Ee.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:f,stats:d}))},onTimeout:(d,g,f)=>{this.resetLoader(e,l),A(new Bi({type:Ee.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:f,stats:d}))}})})}updateStatsFromPart(e,t){const i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){const A=Math.round(e.duration/t.duration),l=Math.min(Math.round(i.loaded/n),A),u=(A-l)*Math.round(i.loaded/l);i.total=i.loaded+u}else i.total=Math.max(i.loaded,i.total);const o=i.loading,a=r.loading;o.start?o.first+=a.first-a.start:(o.start=a.start,o.first=a.first),o.end=a.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function $c(s,e=null){const t=e||s,i={frag:s,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(oe(r)&&oe(n)){var o;let a=r,A=n;if(s.sn==="initSegment"&&((o=s.decryptdata)==null?void 0:o.method)==="AES-128"){const l=n-r;l%16&&(A=n+(16-l%16)),r!==0&&(i.resetIV=!0,a=r-16)}i.rangeStart=a,i.rangeEnd=A}return i}function Yc(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:Ee.MEDIA_ERROR,details:$.FRAG_GAP,fatal:!1,frag:s,error:t,networkDetails:null};return e&&(i.part=e),(e||s).stats.aborted=!0,new Bi(i)}class Bi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class wp{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class Rp{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function xp(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?Xi(s,0,e-t):s}class Tp{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let r=0;r<4;r++)i[r]=t.getUint32(r*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],o=i[2],a=i[3],A=this.invSubMix,l=A[0],c=A[1],u=A[2],h=A[3],d=new Uint32Array(256);let g=0,f=0,p=0;for(p=0;p<256;p++)p<128?d[p]=p<<1:d[p]=p<<1^283;for(p=0;p<256;p++){let v=f^f<<1^f<<2^f<<3^f<<4;v=v>>>8^v&255^99,e[g]=v,t[v]=g;const y=d[g],Q=d[y],m=d[Q];let b=d[v]*257^v*16843008;r[g]=b<<24|b>>>8,n[g]=b<<16|b>>>16,o[g]=b<<8|b>>>24,a[g]=b,b=m*16843009^Q*65537^y*257^g*16843008,l[v]=b<<24|b>>>8,c[v]=b<<16|b>>>16,u[v]=b<<8|b>>>24,h[v]=b,g?(g=y^d[d[d[m^y]]],f^=d[d[f]]):g=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,r=0;for(;r<t.length&&i;)i=t[r]===this.key[r],r++;if(i)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const o=this.ksRows=(n+6+1)*4;let a,A;const l=this.keySchedule=new Uint32Array(o),c=this.invKeySchedule=new Uint32Array(o),u=this.sBox,h=this.rcon,d=this.invSubMix,g=d[0],f=d[1],p=d[2],v=d[3];let y,Q;for(a=0;a<o;a++){if(a<n){y=l[a]=t[a];continue}Q=y,a%n===0?(Q=Q<<8|Q>>>24,Q=u[Q>>>24]<<24|u[Q>>>16&255]<<16|u[Q>>>8&255]<<8|u[Q&255],Q^=h[a/n|0]<<24):n>6&&a%n===4&&(Q=u[Q>>>24]<<24|u[Q>>>16&255]<<16|u[Q>>>8&255]<<8|u[Q&255]),l[a]=y=(l[a-n]^Q)>>>0}for(A=0;A<o;A++)a=o-A,A&3?Q=l[a]:Q=l[a-4],A<4||a<=4?c[A]=Q:c[A]=g[u[Q>>>24]]^f[u[Q>>>16&255]]^p[u[Q>>>8&255]]^v[u[Q&255]],c[A]=c[A]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const r=this.keySize+6,n=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,A=a[0],l=a[1],c=a[2],u=a[3],h=this.uint8ArrayToUint32Array_(i);let d=h[0],g=h[1],f=h[2],p=h[3];const v=new Int32Array(e),y=new Int32Array(v.length);let Q,m,b,x,B,H,_,k,U,q,V,Z,S,T;const O=this.networkToHostOrderSwap;for(;t<v.length;){for(U=O(v[t]),q=O(v[t+1]),V=O(v[t+2]),Z=O(v[t+3]),B=U^n[0],H=Z^n[1],_=V^n[2],k=q^n[3],S=4,T=1;T<r;T++)Q=A[B>>>24]^l[H>>16&255]^c[_>>8&255]^u[k&255]^n[S],m=A[H>>>24]^l[_>>16&255]^c[k>>8&255]^u[B&255]^n[S+1],b=A[_>>>24]^l[k>>16&255]^c[B>>8&255]^u[H&255]^n[S+2],x=A[k>>>24]^l[B>>16&255]^c[H>>8&255]^u[_&255]^n[S+3],B=Q,H=m,_=b,k=x,S=S+4;Q=o[B>>>24]<<24^o[H>>16&255]<<16^o[_>>8&255]<<8^o[k&255]^n[S],m=o[H>>>24]<<24^o[_>>16&255]<<16^o[k>>8&255]<<8^o[B&255]^n[S+1],b=o[_>>>24]<<24^o[k>>16&255]<<16^o[B>>8&255]<<8^o[H&255]^n[S+2],x=o[k>>>24]<<24^o[B>>16&255]<<16^o[H>>8&255]<<8^o[_&255]^n[S+3],y[t]=O(Q^d),y[t+1]=O(x^g),y[t+2]=O(b^f),y[t+3]=O(m^p),d=U,g=q,f=V,p=Z,t=t+4}return y.buffer}}const Dp=16;class Aa{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?xp(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i){return this.useSoftware?new Promise((r,n)=>{this.softwareDecrypt(new Uint8Array(e),t,i);const o=this.flush();o?r(o.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)}softwareDecrypt(e,t,i){const{currentIV:r,currentResult:n,remainderData:o}=this;this.logOnce("JS AES decrypt"),o&&(e=Ft(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;r&&(i=r);let A=this.softwareDecrypter;A||(A=this.softwareDecrypter=new Tp),A.expandKey(t);const l=n;return this.currentResult=A.decrypt(a.buffer,0,i),this.currentIV=Xi(a,-16).buffer,l||null}webCryptoDecrypt(e,t,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i));this.key=t,this.fastAesKey=new Rp(this.subtle,t)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new wp(this.subtle,new Uint8Array(i)).decrypt(e.buffer,r)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(N.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(e,t,i)))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const r=this.flush();if(r)return r.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%Dp;return i!==e.length&&(t=Xi(e,0,i),this.remainderData=Xi(e,i)),t}logOnce(e){this.logEnabled&&(N.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Lp={toString:function(s){let e="";const t=s.length;for(let i=0;i<t;i++)e+=`[${s.start(i).toFixed(3)}-${s.end(i).toFixed(3)}]`;return e}},X={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class la extends mp{constructor(e,t,i,r,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=X.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=n,this.logPrefix=r,this.log=N.log.bind(N,`${r}:`),this.warn=N.warn.bind(N,`${r}:`),this.hls=e,this.fragmentLoader=new Sp(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Aa(e.config),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=X.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(i!=null&&i.length){const n=i[i.length-1];return Ye.isBuffered(this.media,n.start+n.duration/2)}const r=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(r)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const r=this.config;this.levels&&r.autoStartLoad&&this.state===X.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:r,state:n}=this,o=i?i.currentTime:0,a=Ye.bufferInfo(r||i,o,e.maxBufferHole);if(this.log(`media seeking to ${oe(o)?o.toFixed(3):o}, state: ${n}`),this.state===X.ENDED)this.resetLoadingState();else if(t){const A=e.maxFragLookUpTolerance,l=t.start-A,c=t.start+t.duration+A;if(!a.len||c<a.start||l>a.end){const u=o>c;(o<l||u)&&(u&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}i&&(this.fragmentTracker.removeFragmentsInRange(o,1/0,this.playlistType,!0),this.lastCurrentTime=o),!this.loadedmetadata&&!a.len&&(this.nextLoadPosition=this.startPosition=o),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=X.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const r=n=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${n.part?" p: "+n.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,i,r).then(n=>{if(!n)return;const o=this.state;if(this.fragContextChanged(e)){(o===X.FRAG_LOADING||!this.fragCurrent&&o===X.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=X.IDLE);return}"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(E.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===X.STOPPED||this.state===X.ERROR||(this.warn(`Frag error: ${(n==null?void 0:n.message)||n}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===ct.APPENDING){const n=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,n),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength),A=this.backtrackFragment;((A?e.sn-A.sn:0)===1||this.reduceMaxBufferLength(a))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===ct.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:i};this.hls.trigger(E.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{if(!i||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:r}=this,{payload:n}=i,o=e.decryptdata;if(n&&n.byteLength>0&&o!=null&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),o.key.buffer,o.iv.buffer).catch(A=>{throw r.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:A,reason:A.message,frag:e}),A}).then(A=>{const l=self.performance.now();return r.trigger(E.FRAG_DECRYPTED,{frag:e,payload:A,stats:{tstart:a,tdecrypt:l}}),i.payload=A,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===X.STOPPED||this.state===X.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state=X.IDLE,e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,r,n,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===de.MAIN?"level":"track"} ${e.level} (frag:[${((i=e.startPTS)!=null?i:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${a?Lp.toString(Ye.getBuffered(a)):"(detached)"})`),e.sn!=="initSegment"){var A;if(e.type!==de.SUBTITLE){const c=e.elementaryStreams;if(!Object.keys(c).some(u=>!!c[u])){this.state=X.IDLE;return}}const l=(A=this.levels)==null?void 0:A[e.level];l!=null&&l.fragmentError&&(this.log(`Resetting level fragment error count of ${l.fragmentError} on frag buffered`),l.fragmentError=0)}this.state=X.IDLE,a&&(!this.loadedmetadata&&e.type==de.MAIN&&a.buffered.length&&((n=this.fragCurrent)==null?void 0:n.sn)===((o=this.fragPrevious)==null?void 0:o.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:r,partsLoaded:n}=e,o=!n||n.length===0||n.some(A=>!A),a=new aa(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,r){var n;const o=t==null?void 0:t.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let a=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=X.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(E.KEY_LOADED,c),this.state===X.KEY_LOADING&&(this.state=X.IDLE),c}),this.hls.trigger(E.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(a=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&o.encryptedFragments.length&&this.keyLoader.loadClear(e,o.encryptedFragments),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const c=o.partList;if(c&&r){i>e.end&&o.fragmentHint&&(e=o.fragmentHint);const u=this.getNextPart(c,e,i);if(u>-1){const h=c[u];this.log(`Loading part sn: ${e.sn} p: ${h.index} cc: ${e.cc} of playlist [${o.startSN}-${o.endSN}] parts [0-${u}-${c.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=h.start+h.duration,this.state=X.FRAG_LOADING;let d;return a?d=a.then(g=>!g||this.fragContextChanged(g.frag)?null:this.doFragPartsLoad(e,h,t,r)).catch(g=>this.handleFragLoadError(g)):d=this.doFragPartsLoad(e,h,t,r).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(E.FRAG_LOADING,{frag:e,part:h,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(c,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${o?"of ["+o.startSN+"-"+o.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),oe(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=X.FRAG_LOADING;const A=this.config.progressive;let l;return A&&a?l=a.then(c=>!c||this.fragContextChanged(c==null?void 0:c.frag)?null:this.fragmentLoader.load(e,r)).catch(c=>this.handleFragLoadError(c)):l=Promise.all([this.fragmentLoader.load(e,A?r:void 0),a]).then(([c])=>(!A&&c&&r&&r(c),c)).catch(c=>this.handleFragLoadError(c)),this.hls.trigger(E.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,r){return new Promise((n,o)=>{var a;const A=[],l=(a=i.details)==null?void 0:a.partList,c=u=>{this.fragmentLoader.loadPart(e,u,r).then(h=>{A[u.index]=h;const d=h.part;this.hls.trigger(E.FRAG_LOADED,h);const g=Dc(i,e.sn,u.index+1)||Lc(l,e.sn,u.index+1);if(g)c(g);else return n({frag:e,part:d,partsLoaded:A})}).catch(o)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===$.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:Ee.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==X.PARSING){!this.fragCurrent&&this.state!==X.STOPPED&&this.state!==X.ERROR&&(this.state=X.IDLE);return}const{frag:i,part:r,level:n}=t,o=self.performance.now();i.stats.parsing.end=o,r&&(r.stats.parsing.end=o),this.updateLevelTiming(i,r,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:o}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${r}. The current chunk will not be buffered.`),null;const a=t[r],A=o>-1?Dc(a,n,o):null,l=A?A.fragment:ep(a,n,i);return l?(i&&i!==l&&(l.stats=i.stats),{frag:l,part:A,level:a}):null}bufferFragmentData(e,t,i,r,n){var o;if(!e||this.state!==X.PARSING)return;const{data1:a,data2:A}=e;let l=a;if(a&&A&&(l=Ft(a,A)),!((o=l)!=null&&o.length))return;const c={type:e.type,frag:t,part:i,chunkMeta:r,parent:t.type,data:l};if(this.hls.trigger(E.BUFFER_APPENDING,c),e.dropped&&e.independent&&!i){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Ye.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=Ye.bufferInfo(t,i,0),n=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),a=Math.max(Math.min(e.start-o,r.end-o),i+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return oe(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:r}}=this,n=Ye.bufferInfo(e,t,r);if(n.len===0&&n.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,i);if(o&&n.nextStart<o.end)return Ye.bufferInfo(e,t,Math.max(n.nextStart,r))}return n}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,i=e||t.maxBufferLength,r=t.maxMaxBufferLength/2;return r>=i?(t.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,t=de.MAIN){const i=this.fragmentTracker.getAppendedFrag(e,de.MAIN);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,r=i.length;if(!r)return null;const{config:n}=this,o=i[0].start;let a;if(t.live){const A=n.initialLiveManifestSize;if(r<A)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${A})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o)&&(a=this.getInitialLiveFragment(t,i),this.startPosition=this.nextLoadPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=i[0]);if(!a){const A=n.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,A,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===ct.OK||i===ct.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,r,n){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(a===null)return a;if(e=a,o&&e&&!e.gap&&i.nextStart){const A=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r);if(A!==null&&i.len+A.len>=n)return this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let r=-1,n=!1,o=!0;for(let a=0,A=e.length;a<A;a++){const l=e[a];if(o=o&&!l.independent,r>-1&&i<l.start)break;const c=l.loaded;c?r=-1:(n||l.independent||o)&&l.fragment===t&&(r=a),n=c}return r}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let r=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),r=ip(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){const o=t[n-e.startSN];i.cc===o.cc&&(r=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=np(t,i.cc),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(r=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){const{config:r}=this;let{fragPrevious:n}=this,{fragments:o,endSN:a}=i;const{fragmentHint:A}=i,{maxFragLookUpTolerance:l}=r,c=i.partList,u=!!(r.lowLatencyMode&&c!=null&&c.length&&A);u&&A&&!this.bitrateTest&&(o=o.concat(A),a=A.sn);let h;if(e<t){const d=e>t-l?0:l;h=In(n,o,e,d)}else h=o[o.length-1];if(h){const d=h.sn-i.startSN,g=this.fragmentTracker.getState(h);if((g===ct.OK||g===ct.PARTIAL&&h.gap)&&(n=h),n&&h.sn===n.sn&&(!u||c[0].fragment.sn>h.sn)&&n&&h.level===n.level){const p=o[d+1];h.sn<a&&this.fragmentTracker.getState(p)!==ct.OK?h=p:h=null}}return h}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const r=this.hls.liveSyncPosition,n=i.currentTime,o=e.fragments[0].start,a=e.edge,A=n>=o-t.maxFragLookUpTolerance&&n<=a;if(r!==null&&i.duration>r&&(n<r||!A)){const l=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!A&&i.readyState<4||n<a-l)&&(this.loadedmetadata||(this.nextLoadPosition=r),i.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${r.toFixed(3)}`),i.currentTime=r))}}alignPlaylists(e,t,i){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const n=e.fragments[0].start,o=!t,a=e.alignedSliding&&oe(n);if(o||!a&&!n){const{fragPrevious:A}=this;Qp(A,i,e);const l=e.fragments[0].start;return this.log(`Live playlist sliding: ${l.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${A?A.sn:"na"} fragments: ${r}`),l}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;if(i<t&&(i=-1),i===-1||this.lastCurrentTime===-1){const r=this.startTimeOffset!==null,n=r?this.startTimeOffset:e.startTimeOffset;n!==null&&oe(n)?(i=t+n,n<0&&(i+=e.totalduration),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Start time offset ${n} found in ${r?"multivariant":"media"} playlist, adjust startPosition to ${i}`),this.startPosition=i):e.live?i=this.hls.liveSyncPosition||t:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==X.FRAG_LOADING_WAITING_RETRY)&&(this.state=X.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const c=this.getCurrentContext(t.chunkMeta);c&&(t.frag=c.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var r;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(r=this.fragCurrent)==null?void 0:r.url}`);return}const n=t.details===$.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);const o=t.errorAction,{action:a,retryCount:A=0,retryConfig:l}=o||{};if(o&&a===It.RetryRequest&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const c=ra(l,A);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${A+1}/${l.maxNumRetry} in ${c}ms`),o.resolved=!0,this.retryDate=self.performance.now()+c,this.state=X.FRAG_LOADING_WAITING_RETRY}else if(l&&o)if(this.resetFragmentErrors(e),A<l.maxNumRetry)!n&&a!==It.RemoveAlternatePermanently&&(o.resolved=!0);else{N.warn(`${t.details} reached or exceeded max retry (${A})`);return}else(o==null?void 0:o.action)===It.SendAlternateToPenaltyBox?this.state=X.WAITING_LEVEL:this.state=X.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===X.PARSING||this.state===X.PARSED){const t=e.parent,i=this.getFwdBufferInfo(this.mediaBuffer,t),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(e){e===de.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==X.STOPPED&&(this.state=X.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=Ye.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===X.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=X.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){var n;const o=i.details;if(!o){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((A,l)=>{const c=e.elementaryStreams[l];if(c){const u=c.endPTS-c.startPTS;if(u<=0)return this.warn(`Could not parse fragment ${e.sn} ${l} duration reliably (${u})`),A||!1;const h=r?0:xc(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(E.LEVEL_PTS_UPDATED,{details:o,level:i,drift:h,type:l,frag:e,start:c.startPTS,end:c.endPTS}),!0}return A},!1)&&((n=this.transmuxer)==null?void 0:n.error)===null){const A=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(i.fragmentError===0&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(A.message),this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:A,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=X.PARSED,this.hls.trigger(E.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class Kc{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=_p(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function _p(s,e){const t=new Uint8Array(e);let i=0;for(let r=0;r<s.length;r++){const n=s[r];t.set(n,i),i+=n.length}return t}function kp(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Fp(){const s=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(s);return{worker:new self.Worker(e),objectURL:e}}function Np(s){const e=new self.URL(s,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function ni(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class ca{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=Ft(this.cachedData,e),this.cachedData=null);let i=or(e,0),r=i?i.length:0,n;const o=this._audioTrack,a=this._id3Track,A=i?Yo(i):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&oe(A))&&(this.basePTS=Mp(A,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Kt.audioId3,duration:Number.POSITIVE_INFINITY});r<l;){if(this.canParse(e,r)){const c=this.appendFrame(o,e,r);c?(this.frameIndex++,this.lastPTS=c.sample.pts,r+=c.length,n=r):r=l}else n0(e,r)?(i=or(e,r),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Kt.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,n=r):r++;if(r===l&&n!==l){const c=Xi(e,n);this.cachedData?this.cachedData=Ft(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:ni(),id3Track:a,textTrack:ni()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:ni(),id3Track:this._id3Track,textTrack:ni()}}destroy(){}}const Mp=(s,e,t)=>{if(oe(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};function Pp(s,e,t,i){let r,n,o,a;const A=navigator.userAgent.toLowerCase(),l=i,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=((e[t+2]&192)>>>6)+1;const u=(e[t+2]&60)>>>2;if(u>c.length-1){const h=new Error(`invalid ADTS sampling index:${u}`);s.emit(E.ERROR,E.ERROR,{type:Ee.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!0,error:h,reason:h.message});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,N.log(`manifest codec:${i}, ADTS type:${r}, samplingIndex:${u}`),/firefox/i.test(A)?u>=6?(r=5,a=new Array(4),n=u-3):(r=2,a=new Array(2),n=u):A.indexOf("android")!==-1?(r=2,a=new Array(2),n=u):(r=5,a=new Array(4),i&&(i.indexOf("mp4a.40.29")!==-1||i.indexOf("mp4a.40.5")!==-1)||!i&&u>=6?n=u-3:((i&&i.indexOf("mp4a.40.2")!==-1&&(u>=6&&o===1||/vivaldi/i.test(A))||!i&&o===1)&&(r=2,a=new Array(2)),n=u)),a[0]=r<<3,a[0]|=(u&14)>>1,a[1]|=(u&1)<<7,a[1]|=o<<3,r===5&&(a[1]|=(n&14)>>1,a[2]=(n&1)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:c[u],channelCount:o,codec:"mp4a.40."+r,manifestCodec:l}}function Vc(s,e){return s[e]===255&&(s[e+1]&246)===240}function Jc(s,e){return s[e+1]&1?7:9}function ua(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function Op(s,e){return e+5<s.length}function Bn(s,e){return e+1<s.length&&Vc(s,e)}function Up(s,e){return Op(s,e)&&Vc(s,e)&&ua(s,e)<=s.length-e}function Gp(s,e){if(Bn(s,e)){const t=Jc(s,e);if(e+t>=s.length)return!1;const i=ua(s,e);if(i<=t)return!1;const r=e+i;return r===s.length||Bn(s,r)}return!1}function Wc(s,e,t,i,r){if(!s.samplerate){const n=Pp(e,t,i,r);if(!n)return;s.config=n.config,s.samplerate=n.samplerate,s.channelCount=n.channelCount,s.codec=n.codec,s.manifestCodec=n.manifestCodec,N.log(`parsed codec:${s.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function qc(s){return 9216e4/s}function Hp(s,e){const t=Jc(s,e);if(e+t<=s.length){const i=ua(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function jc(s,e,t,i,r){const n=qc(s.samplerate),o=i+r*n,a=Hp(e,t);let A;if(a){const{frameLength:u,headerLength:h}=a,d=h+u,g=Math.max(0,t+d-e.length);g?(A=new Uint8Array(d-h),A.set(e.subarray(t+h,e.length),0)):A=e.subarray(t+h,t+d);const f={unit:A,pts:o};return g||s.samples.push(f),{sample:f,length:d,missing:g}}const l=e.length-t;return A=new Uint8Array(l),A.set(e.subarray(t,e.length),0),{sample:{unit:A,pts:o},length:l,missing:-1}}let Qn=null;const $p=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],Yp=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Kp=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Vp=[0,1,1,4];function Xc(s,e,t,i,r){if(t+24>e.length)return;const n=zc(e,t);if(n&&t+n.frameLength<=e.length){const o=n.samplesPerFrame*9e4/n.sampleRate,a=i+r*o,A={unit:e.subarray(t,t+n.frameLength),pts:a,dts:a};return s.config=[],s.channelCount=n.channelCount,s.samplerate=n.sampleRate,s.samples.push(A),{sample:A,length:n.frameLength,missing:0}}}function zc(s,e){const t=s[e+1]>>3&3,i=s[e+1]>>1&3,r=s[e+2]>>4&15,n=s[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&n!==3){const o=s[e+2]>>1&1,a=s[e+3]>>6,A=t===3?3-i:i===3?3:4,l=$p[A*14+r-1]*1e3,u=Yp[(t===3?0:t===2?1:2)*3+n],h=a===3?1:2,d=Kp[t][i],g=Vp[i],f=d*8*g,p=Math.floor(d*l/u+o)*g;if(Qn===null){const Q=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Qn=Q?parseInt(Q[1]):0}return!!Qn&&Qn<=87&&i===2&&l>=224e3&&a===0&&(s[e+3]=s[e+3]|128),{sampleRate:u,channelCount:h,frameLength:p,samplesPerFrame:f}}}function ha(s,e){return s[e]===255&&(s[e+1]&224)===224&&(s[e+1]&6)!==0}function Zc(s,e){return e+1<s.length&&ha(s,e)}function Jp(s,e){return ha(s,e)&&4<=s.length-e}function eu(s,e){if(e+1<s.length&&ha(s,e)){const i=zc(s,e);let r=4;i!=null&&i.frameLength&&(r=i.frameLength);const n=e+r;return n===s.length||Zc(s,n)}return!1}class Wp extends ca{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=or(e,0);let i=(t==null?void 0:t.length)||0;if(eu(e,i))return!1;for(let r=e.length;i<r;i++)if(Gp(e,i))return N.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Up(e,t)}appendFrame(e,t,i){Wc(e,this.observer,t,i,e.manifestCodec);const r=jc(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const qp=/\/emsg[-/]ID3/i;class jp{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,r){const n=this.videoTrack=ni("video",1),o=this.audioTrack=ni("audio",1),a=this.txtTrack=ni("text",1);if(this.id3Track=ni("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const A=ic(e);if(A.video){const{id:l,timescale:c,codec:u}=A.video;n.id=l,n.timescale=a.timescale=c,n.codec=u}if(A.audio){const{id:l,timescale:c,codec:u}=A.audio;o.id=l,o.timescale=c,o.codec=u}a.id=zl.text,n.sampleDuration=0,n.duration=o.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return g0(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Ft(this.remainderData,e));const a=y0(i);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=i;const o=this.extractID3Track(r,t);return n.samples=rc(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return i.samples=rc(e,t),{videoTrack:t,audioTrack:ni(),id3Track:r,textTrack:ni()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=ve(e.samples,["emsg"]);r&&r.forEach(n=>{const o=b0(n);if(qp.test(o.schemeIdUri)){const a=oe(o.presentationTime)?o.presentationTime/o.timeScale:t+o.presentationTimeDelta/o.timeScale;let A=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;A<=.001&&(A=Number.POSITIVE_INFINITY);const l=o.payload;i.samples.push({data:l,len:l.byteLength,dts:a,pts:a,type:Kt.emsg,duration:A})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const tu=(s,e)=>{let t=0,i=5;e+=i;const r=new Uint32Array(1),n=new Uint32Array(1),o=new Uint8Array(1);for(;i>0;){o[0]=s[e];const a=Math.min(i,8),A=8-a;n[0]=4278190080>>>24+A<<A,r[0]=(o[0]&n[0])>>A,t=t?t<<a|r[0]:r[0],e+=1,i-=a}return t};class Xp extends ca{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const r=iu(e,t,i,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=or(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&Yo(t)!==void 0&&tu(e,i)<16}}function iu(s,e,t,i,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const a=[48e3,44100,32e3][n],A=e[t+4]&63,c=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][A*3+n]*2;if(t+c>e.length)return-1;const u=e[t+6]>>5;let h=0;u===2?h+=2:(u&1&&u!==1&&(h+=2),u&4&&(h+=2));const d=(e[t+6]<<8|e[t+7])>>12-h&1,f=[2,1,2,3,3,4,4,5][u]+d,p=e[t+5]>>3,v=e[t+5]&7,y=new Uint8Array([n<<6|p<<1|v>>2,(v&3)<<6|u<<3|d<<2|A>>4,A<<4&224]),Q=1536/a*9e4,m=i+r*Q,b=e.subarray(t,t+c);return s.config=y,s.channelCount=f,s.samplerate=a,s.samples.push({unit:b,pts:m}),c}class zp{constructor(){this.VideoSample=null}createVideoSample(e,t,i,r){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:r,length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,r;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const n=i.units;r=n[n.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,r=i.length;if(r){const n=i[r-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&N.log(e.pts+"/"+e.dts+":"+e.debug)}}class su{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");r.set(e.subarray(i,i+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&N.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,i=8,r;for(let n=0;n<e;n++)i!==0&&(r=this.readEG(),i=(t+r+256)%256),t=i===0?t:i}readSPS(){let e=0,t=0,i=0,r=0,n,o,a;const A=this.readUByte.bind(this),l=this.readBits.bind(this),c=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),g=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);A();const p=A();if(l(5),h(3),A(),g(),p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){const x=c();if(x===3&&h(1),g(),g(),h(1),u())for(o=x!==3?8:12,a=0;a<o;a++)u()&&(a<6?f(16):f(64))}g();const v=c();if(v===0)c();else if(v===1)for(h(1),d(),d(),n=c(),a=0;a<n;a++)d();g(),h(1);const y=c(),Q=c(),m=l(1);m===0&&h(1),h(1),u()&&(e=c(),t=c(),i=c(),r=c());let b=[1,1];if(u()&&u())switch(A()){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[A()<<8|A(),A()<<8|A()];break}}return{width:Math.ceil((y+1)*16-e*2-t*2),height:(2-m)*(Q+1)*16-(m?2:4)*(i+r),pixelRatio:b}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class Zp extends zp{parseAVCPES(e,t,i,r,n){const o=this.parseAVCNALu(e,i.data);let a=this.VideoSample,A,l=!1;i.data=null,a&&o.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"")),o.forEach(c=>{var u;switch(c.type){case 1:{let f=!1;A=!0;const p=c.data;if(l&&p.length>4){const v=new su(p).readSliceType();(v===2||v===4||v===7||v===9)&&(f=!0)}if(f){var h;(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),a.frame=!0,a.key=f;break}case 5:A=!0,(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),a.key=!0,a.frame=!0;break;case 6:{A=!0,nc(c.data,1,i.pts,t.samples);break}case 7:{var d,g;A=!0,l=!0;const f=c.data,v=new su(f).readSPS();if(!e.sps||e.width!==v.width||e.height!==v.height||((d=e.pixelRatio)==null?void 0:d[0])!==v.pixelRatio[0]||((g=e.pixelRatio)==null?void 0:g[1])!==v.pixelRatio[1]){e.width=v.width,e.height=v.height,e.pixelRatio=v.pixelRatio,e.sps=[f],e.duration=n;const y=f.subarray(1,4);let Q="avc1.";for(let m=0;m<3;m++){let b=y[m].toString(16);b.length<2&&(b="0"+b),Q+=b}e.codec=Q}break}case 8:A=!0,e.pps=[c.data];break;case 9:A=!0,e.audFound=!0,a&&this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:A=!0;break;default:A=!1,a&&(a.debug+="unknown NAL "+c.type+" ");break}a&&A&&a.units.push(c)}),r&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let r=e.naluState||0;const n=r,o=[];let a=0,A,l,c,u=-1,h=0;for(r===-1&&(u=0,h=t[0]&31,r=0,a=1);a<i;){if(A=t[a++],!r){r=A?0:1;continue}if(r===1){r=A?0:2;continue}if(!A)r=3;else if(A===1){if(l=a-r-1,u>=0){const d={data:t.subarray(u,l),type:h};o.push(d)}else{const d=this.getLastNalUnit(e.samples);d&&(n&&a<=4-n&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-n)),l>0&&(d.data=Ft(d.data,t.subarray(0,l)),d.state=0))}a<i?(c=t[a]&31,u=a,h=c,r=0):r=-1}else r=0}if(u>=0&&r>=0){const d={data:t.subarray(u,i),type:h,state:r};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);d&&(d.data=Ft(d.data,t))}return e.naluState=r,o}}class eE{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Aa(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const r=e[t].unit;if(r.length<=16)return;const n=r.subarray(16,r.length-r.length%16),o=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(o).then(a=>{const A=new Uint8Array(a);r.set(A,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)i.set(e.subarray(n,n+16),r);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let r=0;for(let n=32;n<e.length-16;n+=160,r+=16)e.set(i.subarray(r,r+16),n);return e}decryptAvcSample(e,t,i,r,n){const o=oc(n.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(A=>{n.data=this.getAvcDecryptedUnit(o,A),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)})}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){r();return}const n=e[t].units;for(;!(i>=n.length);i++){const o=n[i];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,i,r,o),!this.decrypter.isSync()))return}}}}const ut=188;class Ni{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.videoParser=new Zp}static probe(e){const t=Ni.syncOffset(e);return t>0&&N.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let i=Math.min(ut*5,t-ut)+1,r=0;for(;r<i;){let n=!1,o=-1,a=0;for(let A=r;A<t;A+=ut)if(e[A]===71&&(t-A===ut||e[A+ut]===71)){if(a++,o===-1&&(o=A,o!==0&&(i=Math.min(o+ut*99,e.length-ut)+1)),n||(n=da(e,A)===0),n&&a>1&&(o===0&&a>2||A+ut>i))return o}else{if(a)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:zl[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Ni.createTrack("video"),this._audioTrack=Ni.createTrack("audio",r),this._id3Track=Ni.createTrack("id3"),this._txtTrack=Ni.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=r}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,r=!1){i||(this.sampleAes=null);let n;const o=this._videoTrack,a=this._audioTrack,A=this._id3Track,l=this._txtTrack;let c=o.pid,u=o.pesData,h=a.pid,d=A.pid,g=a.pesData,f=A.pesData,p=null,v=this.pmtParsed,y=this._pmtId,Q=e.length;if(this.remainderData&&(e=Ft(this.remainderData,e),Q=e.length,this.remainderData=null),Q<ut&&!r)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};const m=Math.max(0,Ni.syncOffset(e));Q-=(Q-m)%ut,Q<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,Q,e.buffer.byteLength-Q));let b=0;for(let B=m;B<Q;B+=ut)if(e[B]===71){const H=!!(e[B+1]&64),_=da(e,B),k=(e[B+3]&48)>>4;let U;if(k>1){if(U=B+5+e[B+4],U===B+ut)continue}else U=B+4;switch(_){case c:H&&(u&&(n=ys(u))&&this.videoParser.parseAVCPES(o,l,n,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(e.subarray(U,B+ut)),u.size+=B+ut-U);break;case h:if(H){if(g&&(n=ys(g)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,n);break;case"mp3":this.parseMPEGPES(a,n);break;case"ac3":this.parseAC3PES(a,n);break}g={data:[],size:0}}g&&(g.data.push(e.subarray(U,B+ut)),g.size+=B+ut-U);break;case d:H&&(f&&(n=ys(f))&&this.parseID3PES(A,n),f={data:[],size:0}),f&&(f.data.push(e.subarray(U,B+ut)),f.size+=B+ut-U);break;case 0:H&&(U+=e[U]+1),y=this._pmtId=tE(e,U);break;case y:{H&&(U+=e[U]+1);const q=iE(e,U,this.typeSupported,i,this.observer);c=q.videoPid,c>0&&(o.pid=c,o.segmentCodec=q.segmentVideoCodec),h=q.audioPid,h>0&&(a.pid=h,a.segmentCodec=q.segmentAudioCodec),d=q.id3Pid,d>0&&(A.pid=d),p!==null&&!v&&(N.warn(`MPEG-TS PMT found at ${B} after unknown PID '${p}'. Backtracking to sync byte @${m} to parse all TS packets.`),p=null,B=m-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=_;break}}else b++;b>0&&bn(this.observer,new Error(`Found ${b} TS packet/s that do not start with 0x47`)),o.pesData=u,a.pesData=g,A.pesData=f;const x={audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};return r&&this.extractRemainingSamples(x),x}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:r,textTrack:n}=e,o=i.pesData,a=t.pesData,A=r.pesData;let l;if(o&&(l=ys(o))?(this.videoParser.parseAVCPES(i,n,l,!0,this._duration),i.pesData=null):i.pesData=o,a&&(l=ys(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l);break}t.pesData=null}else a!=null&&a.size&&N.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;A&&(l=ys(A))?(this.parseID3PES(r,l),r.pesData=null):r.pesData=A}demuxSampleAes(e,t,i){const r=this.demux(e,i,!0,!this.config.progressive),n=this.sampleAes=new eE(this.observer,this.config,t);return this.decrypt(r,n)}decrypt(e,t){return new Promise(i=>{const{audioTrack:r,videoTrack:n}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const r=this.aacOverFlow;let n=t.data;if(r){this.aacOverFlow=null;const u=r.missing,h=r.sample.unit.byteLength;if(u===-1)n=Ft(r.sample.unit,n);else{const d=h-u;r.sample.unit.set(n.subarray(0,u),d),e.samples.push(r.sample),i=r.missing}}let o,a;for(o=i,a=n.length;o<a-1&&!Bn(n,o);o++);if(o!==i){let u;const h=o<a-1;if(h?u=`AAC PES did not start with ADTS header,offset:${o}`:u="No ADTS header found in AAC PES",bn(this.observer,new Error(u),h),!h)return}Wc(e,this.observer,n,o,this.audioCodec);let A;if(t.pts!==void 0)A=t.pts;else if(r){const u=qc(e.samplerate);A=r.sample.pts+u}else{N.warn("[tsdemuxer]: AAC PES unknown PTS");return}let l=0,c;for(;o<a;)if(c=jc(e,n,o,A,l),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(l++;o<a-1&&!Bn(n,o);o++);}parseMPEGPES(e,t){const i=t.data,r=i.length;let n=0,o=0;const a=t.pts;if(a===void 0){N.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<r;)if(Zc(i,o)){const A=Xc(e,i,o,a,n);if(A)o+=A.length,n++;else break}else o++}parseAC3PES(e,t){{const i=t.data,r=t.pts;if(r===void 0){N.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=i.length;let o=0,a=0,A;for(;a<n&&(A=iu(e,i,a,r,o++))>0;)a+=A}}parseID3PES(e,t){if(t.pts===void 0){N.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=tt({},t,{type:this._videoTrack?Kt.emsg:Kt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function da(s,e){return((s[e+1]&31)<<8)+s[e+2]}function tE(s,e){return(s[e+10]&31)<<8|s[e+11]}function iE(s,e,t,i,r){const n={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(s[e+1]&15)<<8|s[e+2],a=e+3+o-4,A=(s[e+10]&15)<<8|s[e+11];for(e+=12+A;e<a;){const l=da(s,e),c=(s[e+3]&15)<<8|s[e+4];switch(s[e]){case 207:if(!i){ga("ADTS AAC");break}case 15:n.audioPid===-1&&(n.audioPid=l);break;case 21:n.id3Pid===-1&&(n.id3Pid=l);break;case 219:if(!i){ga("H.264");break}case 27:n.videoPid===-1&&(n.videoPid=l,n.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?N.log("MPEG audio found, not supported in this browser"):n.audioPid===-1&&(n.audioPid=l,n.segmentAudioCodec="mp3");break;case 193:if(!i){ga("AC-3");break}case 129:t.ac3?n.audioPid===-1&&(n.audioPid=l,n.segmentAudioCodec="ac3"):N.log("AC-3 audio found, not supported in this browser");break;case 6:if(n.audioPid===-1&&c>0){let u=e+5,h=c;for(;h>2;){switch(s[u]){case 106:t.ac3!==!0?N.log("AC-3 audio found, not supported in this browser for now"):(n.audioPid=l,n.segmentAudioCodec="ac3");break}const g=s[u+1]+2;u+=g,h-=g}}break;case 194:case 135:return bn(r,new Error("Unsupported EC-3 in M2TS found")),n;case 36:return bn(r,new Error("Unsupported HEVC in M2TS found")),n}e+=c+5}return n}function bn(s,e,t){N.warn(`parsing error: ${e.message}`),s.emit(E.ERROR,E.ERROR,{type:Ee.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function ga(s){N.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function ys(s){let e=0,t,i,r,n,o;const a=s.data;if(!s||s.size===0)return null;for(;a[0].length<19&&a.length>1;)a[0]=Ft(a[0],a[1]),a.splice(1,1);if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(i=(t[4]<<8)+t[5],i&&i>s.size-6)return null;const l=t[7];l&192&&(n=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,l&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,n-o>54e5&&(N.warn(`${Math.round((n-o)/9e4)}s delta between PTS and DTS, align them`),n=o)):o=n),r=t[8];let c=r+9;if(s.size<=c)return null;s.size-=c;const u=new Uint8Array(s.size);for(let h=0,d=a.length;h<d;h++){t=a[h];let g=t.byteLength;if(c)if(c>g){c-=g;continue}else t=t.subarray(c),g-=c,c=0;u.set(t,e),e+=g}return i&&(i-=r+3),{data:u,pts:n,dts:o,len:i}}return null}class sE extends ca{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=or(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&Yo(t)!==void 0&&tu(e,i)<=16)return!1;for(let r=e.length;i<r;i++)if(eu(e,i))return N.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Jp(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Xc(e,t,i,this.basePTS,this.frameIndex)}}class ru{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const Mi=Math.pow(2,32)-1;class M{static init(){M.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in M.types)M.types.hasOwnProperty(e)&&(M.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);M.HDLR_TYPES={video:t,audio:i};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=n,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),A=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,o,A,o,a),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,r))}static box(e,...t){let i=8,r=t.length;const n=r;for(;r--;)i+=t[r].byteLength;const o=new Uint8Array(i);for(o[0]=i>>24&255,o[1]=i>>16&255,o[2]=i>>8&255,o[3]=i&255,o.set(e,4),r=0,i=8;r<n;r++)o.set(t[r],i),i+=t[r].byteLength;return o}static hdlr(e){return M.box(M.types.hdlr,M.HDLR_TYPES[e])}static mdat(e){return M.box(M.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(Mi+1)),r=Math.floor(t%(Mi+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return M.box(M.types.mdia,M.mdhd(e.timescale,e.duration),M.hdlr(e.type),M.minf(e))}static mfhd(e){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(e)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(e))}static moof(e,t,i){return M.box(M.types.moof,M.mfhd(e),M.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=M.trak(e[t]);return M.box.apply(null,[M.types.moov,M.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(M.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=M.trex(e[t]);return M.box.apply(null,[M.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(Mi+1)),r=Math.floor(t%(Mi+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return M.box(M.types.mvhd,n)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let r,n;for(r=0;r<t.length;r++)n=t[r].flags,i[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return M.box(M.types.sdtp,i)}static stbl(e){return M.box(M.types.stbl,M.stsd(e),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))}static avc1(e){let t=[],i=[],r,n,o;for(r=0;r<e.sps.length;r++)n=e.sps[r],o=n.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)n=e.pps[r],o=n.byteLength,i.push(o>>>8&255),i.push(o&255),i=i.concat(Array.prototype.slice.call(n));const a=M.box(M.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),A=e.width,l=e.height,c=e.pixelRatio[0],u=e.pixelRatio[1];return M.box(M.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,A>>8&255,A&255,l>>8&255,l&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),a,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,c&255,u>>24,u>>16&255,u>>8&255,u&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return M.box(M.types.mp4a,M.audioStsd(e),M.box(M.types.esds,M.esds(e)))}static mp3(e){return M.box(M.types[".mp3"],M.audioStsd(e))}static ac3(e){return M.box(M.types["ac-3"],M.audioStsd(e),M.box(M.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(e)):e.segmentCodec==="ac3"?M.box(M.types.stsd,M.STSD,M.ac3(e)):M.box(M.types.stsd,M.STSD,M.mp4a(e)):M.box(M.types.stsd,M.STSD,M.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,r=e.width,n=e.height,o=Math.floor(i/(Mi+1)),a=Math.floor(i%(Mi+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,a>>24,a>>16&255,a>>8&255,a&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,r&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const i=M.sdtp(e),r=e.id,n=Math.floor(t/(Mi+1)),o=Math.floor(t%(Mi+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,o>>24,o>>16&255,o>>8&255,o&255])),M.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,M.box(M.types.trak,M.tkhd(e),M.mdia(e))}static trex(e){const t=e.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],r=i.length,n=12+16*r,o=new Uint8Array(n);let a,A,l,c,u,h;for(t+=8+n,o.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<r;a++)A=i[a],l=A.duration,c=A.size,u=A.flags,h=A.cts,o.set([l>>>24&255,l>>>16&255,l>>>8&255,l&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,u.isLeading<<2|u.dependsOn,u.isDependedOn<<6|u.hasRedundancy<<4|u.paddingValue<<1|u.isNonSync,u.degradPrio&61440,u.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*a);return M.box(M.types.trun,o)}static initSegment(e){M.types||M.init();const t=M.moov(e);return Ft(M.FTYP,t)}}M.types=void 0,M.HDLR_TYPES=void 0,M.STTS=void 0,M.STSC=void 0,M.STCO=void 0,M.STSZ=void 0,M.VMHD=void 0,M.SMHD=void 0,M.STSD=void 0,M.FTYP=void 0,M.DINF=void 0;const nu=9e4;function fa(s,e,t=1,i=!1){const r=s*e*t;return i?Math.round(r):r}function rE(s,e,t=1,i=!1){return fa(s,e,1/t,i)}function lr(s,e=!1){return fa(s,1e3,1/nu,e)}function nE(s,e=1){return fa(s,nu,1/e)}const oE=10*1e3,ou=1024,aE=1152,AE=1536;let Bs=null,pa=null;class Sn{constructor(e,t,i,r=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,Bs===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Bs=o?parseInt(o[1]):0}if(pa===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);pa=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){N.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){N.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){N.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e.reduce((r,n)=>{const o=n.pts-r;return o<-4294967296?(t=!0,Nt(r,n.pts)):o>0?r:n.pts},e[0].pts);return t&&N.debug("PTS rollover detected"),i}remux(e,t,i,r,n,o,a,A){let l,c,u,h,d,g,f=n,p=n;const v=e.pid>-1,y=t.pid>-1,Q=t.samples.length,m=e.samples.length>0,b=a&&Q>0||Q>1;if((!v||m)&&(!y||b)||this.ISGenerated||a){if(this.ISGenerated){var B,H,_,k;const Z=this.videoTrackConfig;Z&&(t.width!==Z.width||t.height!==Z.height||((B=t.pixelRatio)==null?void 0:B[0])!==((H=Z.pixelRatio)==null?void 0:H[0])||((_=t.pixelRatio)==null?void 0:_[1])!==((k=Z.pixelRatio)==null?void 0:k[1]))&&this.resetInitSegment()}else u=this.generateIS(e,t,n,o);const U=this.isVideoContiguous;let q=-1,V;if(b&&(q=lE(t.samples),!U&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,q>0){N.warn(`[mp4-remuxer]: Dropped ${q} out of ${Q} video samples due to a missing keyframe`);const Z=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(q),t.dropped+=q,p+=(t.samples[0].pts-Z)/t.inputTimeScale,V=p}else q===-1&&(N.warn(`[mp4-remuxer]: No keyframe found out of ${Q} video samples`),g=!1);if(this.ISGenerated){if(m&&b){const Z=this.getVideoStartPts(t.samples),T=(Nt(e.samples[0].pts,Z)-Z)/t.inputTimeScale;f+=Math.max(0,T),p+=Math.max(0,-T)}if(m){if(e.samplerate||(N.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,n,o)),c=this.remuxAudio(e,f,this.isAudioContiguous,o,y||b||A===de.AUDIO?p:void 0),b){const Z=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(N.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,n,o)),l=this.remuxVideo(t,p,U,Z)}}else b&&(l=this.remuxVideo(t,p,U,0));l&&(l.firstKeyFrame=q,l.independent=q!==-1,l.firstKeyFramePTS=V)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(d=au(i,n,this._initPTS,this._initDTS)),r.samples.length&&(h=Au(r,n,this._initPTS))),{audio:c,video:l,initSegment:u,independent:g,text:h,id3:d}}generateIS(e,t,i,r){const n=e.samples,o=t.samples,a=this.typeSupported,A={},l=this._initPTS;let c=!l||r,u="audio/mp4",h,d,g;if(c&&(h=d=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":a.mpeg?(u="audio/mpeg",e.codec=""):a.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}A.audio={id:"audio",container:u,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):M.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(g=e.inputTimeScale,!l||g!==l.timescale?h=d=n[0].pts-Math.round(g*i):c=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,A.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:M.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(g=t.inputTimeScale,!l||g!==l.timescale){const f=this.getVideoStartPts(o),p=Math.round(g*i);d=Math.min(d,Nt(o[0].dts,f)-p),h=Math.min(h,f-p)}else c=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(A).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:h,timescale:g},this._initDTS={baseTime:d,timescale:g}):h=g=void 0,{tracks:A,initPTS:h,timescale:g}}remuxVideo(e,t,i,r){const n=e.inputTimeScale,o=e.samples,a=[],A=o.length,l=this._initPTS;let c=this.nextAvcDts,u=8,h=this.videoSampleDuration,d,g,f=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,v=!1;if(!i||c===null){const w=t*n,L=o[0].pts-Nt(o[0].dts,o[0].pts);Bs&&c!==null&&Math.abs(w-L-c)<15e3?i=!0:c=w-L}const y=l.baseTime*n/l.timescale;for(let w=0;w<A;w++){const L=o[w];L.pts=Nt(L.pts-y,c),L.dts=Nt(L.dts-y,c),L.dts<o[w>0?w-1:w].dts&&(v=!0)}v&&o.sort(function(w,L){const K=w.dts-L.dts,G=w.pts-L.pts;return K||G}),d=o[0].dts,g=o[o.length-1].dts;const Q=g-d,m=Q?Math.round(Q/(A-1)):h||e.inputTimeScale/30;if(i){const w=d-c,L=w>m,K=w<-1;if((L||K)&&(L?N.warn(`AVC: ${lr(w,!0)} ms (${w}dts) hole between fragments detected at ${t.toFixed(3)}`):N.warn(`AVC: ${lr(-w,!0)} ms (${w}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!K||c>=o[0].pts||Bs)){d=c;const G=o[0].pts-w;if(L)o[0].dts=d,o[0].pts=G;else for(let j=0;j<o.length&&!(o[j].dts>G);j++)o[j].dts-=w,o[j].pts-=w;N.log(`Video: Initial PTS/DTS adjusted: ${lr(G,!0)}/${lr(d,!0)}, delta: ${lr(w,!0)} ms`)}}d=Math.max(0,d);let b=0,x=0,B=d;for(let w=0;w<A;w++){const L=o[w],K=L.units,G=K.length;let j=0;for(let te=0;te<G;te++)j+=K[te].data.length;x+=j,b+=G,L.length=j,L.dts<B?(L.dts=B,B+=m/4|0||1):B=L.dts,f=Math.min(L.pts,f),p=Math.max(L.pts,p)}g=o[A-1].dts;const H=x+4*b+8;let _;try{_=new Uint8Array(H)}catch(w){this.observer.emit(E.ERROR,E.ERROR,{type:Ee.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:w,bytes:H,reason:`fail allocating video mdat ${H}`});return}const k=new DataView(_.buffer);k.setUint32(0,H),_.set(M.types.mdat,4);let U=!1,q=Number.POSITIVE_INFINITY,V=Number.POSITIVE_INFINITY,Z=Number.NEGATIVE_INFINITY,S=Number.NEGATIVE_INFINITY;for(let w=0;w<A;w++){const L=o[w],K=L.units;let G=0;for(let ue=0,ce=K.length;ue<ce;ue++){const me=K[ue],Qe=me.data,xe=me.data.byteLength;k.setUint32(u,xe),u+=4,_.set(Qe,u),u+=xe,G+=4+xe}let j;if(w<A-1)h=o[w+1].dts-L.dts,j=o[w+1].pts-L.pts;else{const ue=this.config,ce=w>0?L.dts-o[w-1].dts:m;if(j=w>0?L.pts-o[w-1].pts:m,ue.stretchShortVideoTrack&&this.nextAudioPts!==null){const me=Math.floor(ue.maxBufferHole*n),Qe=(r?f+r*n:this.nextAudioPts)-L.pts;Qe>me?(h=Qe-ce,h<0?h=ce:U=!0,N.log(`[mp4-remuxer]: It is approximately ${Qe/90} ms to the next segment; using duration ${h/90} ms for the last video frame.`)):h=ce}else h=ce}const te=Math.round(L.pts-L.dts);q=Math.min(q,h),Z=Math.max(Z,h),V=Math.min(V,j),S=Math.max(S,j),a.push(new lu(L.key,h,G,te))}if(a.length){if(Bs){if(Bs<70){const w=a[0].flags;w.dependsOn=2,w.isNonSync=0}}else if(pa&&S-V<Z-q&&m/Z<.025&&a[0].cts===0){N.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let w=d;for(let L=0,K=a.length;L<K;L++){const G=w+a[L].duration,j=w+a[L].cts;if(L<K-1){const te=G+a[L+1].cts;a[L].duration=te-j}else a[L].duration=L?a[L-1].duration:m;a[L].cts=0,w=G}}}h=U||!h?m:h,this.nextAvcDts=c=g+h,this.videoSampleDuration=h,this.isVideoContiguous=!0;const R={data1:M.moof(e.sequenceNumber++,d,tt({},e,{samples:a})),data2:_,startPTS:f/n,endPTS:(p+h)/n,startDTS:d/n,endDTS:c/n,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,R}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return aE;case"ac3":return AE;default:return ou}}remuxAudio(e,t,i,r,n){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,A=o/a,l=this.getSamplesPerFrame(e),c=l*A,u=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],g=n!==void 0;let f=e.samples,p=h?0:8,v=this.nextAudioPts||-1;const y=t*o,Q=u.baseTime*o/u.timescale;if(this.isAudioContiguous=i=i||f.length&&v>0&&(r&&Math.abs(y-v)<9e3||Math.abs(Nt(f[0].pts-Q,y)-v)<20*c),f.forEach(function(T){T.pts=Nt(T.pts-Q,y)}),!i||v<0){if(f=f.filter(T=>T.pts>=0),!f.length)return;n===0?v=0:r&&!g?v=Math.max(0,y):v=f[0].pts}if(e.segmentCodec==="aac"){const T=this.config.maxAudioFramesDrift;for(let O=0,R=v;O<f.length;O++){const w=f[O],L=w.pts,K=L-R,G=Math.abs(1e3*K/o);if(K<=-T*c&&g)O===0&&(N.warn(`Audio frame @ ${(L/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*K/o)} ms.`),this.nextAudioPts=v=R=L);else if(K>=T*c&&G<oE&&g){let j=Math.round(K/c);R=L-j*c,R<0&&(j--,R+=c),O===0&&(this.nextAudioPts=v=R),N.warn(`[mp4-remuxer]: Injecting ${j} audio frame @ ${(R/o).toFixed(3)}s due to ${Math.round(1e3*K/o)} ms gap.`);for(let te=0;te<j;te++){const ue=Math.max(R,0);let ce=ru.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);ce||(N.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ce=w.unit.subarray()),f.splice(O,0,{unit:ce,pts:ue}),R+=c,O++}}w.pts=R,R+=c}}let m=null,b=null,x,B=0,H=f.length;for(;H--;)B+=f[H].unit.byteLength;for(let T=0,O=f.length;T<O;T++){const R=f[T],w=R.unit;let L=R.pts;if(b!==null){const G=d[T-1];G.duration=Math.round((L-b)/A)}else if(i&&e.segmentCodec==="aac"&&(L=v),m=L,B>0){B+=p;try{x=new Uint8Array(B)}catch(G){this.observer.emit(E.ERROR,E.ERROR,{type:Ee.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:G,bytes:B,reason:`fail allocating audio mdat ${B}`});return}h||(new DataView(x.buffer).setUint32(0,B),x.set(M.types.mdat,4))}else return;x.set(w,p);const K=w.byteLength;p+=K,d.push(new lu(!0,l,K,0)),b=L}const _=d.length;if(!_)return;const k=d[d.length-1];this.nextAudioPts=v=b+A*k.duration;const U=h?new Uint8Array(0):M.moof(e.sequenceNumber++,m/A,tt({},e,{samples:d}));e.samples=[];const q=m/o,V=v/o,S={data1:U,data2:x,startPTS:q,endPTS:V,startDTS:q,endDTS:V,type:"audio",hasAudio:!0,hasVideo:!1,nb:_};return this.isAudioContiguous=!0,S}remuxEmptyAudio(e,t,i,r){const n=e.inputTimeScale,o=e.samplerate?e.samplerate:n,a=n/o,A=this.nextAudioPts,l=this._initDTS,c=l.baseTime*9e4/l.timescale,u=(A!==null?A:r.startDTS*n)+c,h=r.endDTS*n+c,d=a*ou,g=Math.ceil((h-u)/d),f=ru.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(N.warn("[mp4-remuxer]: remux empty Audio"),!f){N.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const p=[];for(let v=0;v<g;v++){const y=u+v*d;p.push({unit:f,pts:y,dts:y})}return e.samples=p,this.remuxAudio(e,t,i,!1)}}function Nt(s,e){let t;if(e===null)return s;for(e<s?t=-8589934592:t=8589934592;Math.abs(s-e)>4294967296;)s+=t;return s}function lE(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function au(s,e,t,i){const r=s.samples.length;if(!r)return;const n=s.inputTimeScale;for(let a=0;a<r;a++){const A=s.samples[a];A.pts=Nt(A.pts-t.baseTime*n/t.timescale,e*n)/n,A.dts=Nt(A.dts-i.baseTime*n/i.timescale,e*n)/n}const o=s.samples;return s.samples=[],{samples:o}}function Au(s,e,t){const i=s.samples.length;if(!i)return;const r=s.inputTimeScale;for(let o=0;o<i;o++){const a=s.samples[o];a.pts=Nt(a.pts-t.baseTime*r/t.timescale,e*r)/r}s.samples.sort((o,a)=>o.pts-a.pts);const n=s.samples;return s.samples=[],{samples:n}}class lu{constructor(e,t,i,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=r,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class cE{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(E0(e,r)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const r=this.initData=ic(e);r.audio&&(t=cu(r.audio,Pe.AUDIO)),r.video&&(i=cu(r.video,Pe.VIDEO));const n={};r.audio&&r.video?n.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:r.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:r.video?n.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:N.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,i,r,n,o){var a,A;let{initPTS:l,lastEndTime:c}=this;const u={audio:void 0,video:void 0,text:r,id3:i,initSegment:void 0};oe(c)||(c=this.lastEndTime=n||0);const h=t.samples;if(!(h!=null&&h.length))return u;const d={initPTS:void 0,timescale:1};let g=this.initData;if((a=g)!=null&&a.length||(this.generateInitSegment(h),g=this.initData),!((A=g)!=null&&A.length))return N.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const f=m0(h,g),p=I0(g,h),v=p===null?n:p;(uE(l,v,n,f)||d.timescale!==l.timescale&&o)&&(d.initPTS=v-n,l&&l.timescale===1&&N.warn(`Adjusting initPTS by ${d.initPTS-l.baseTime}`),this.initPTS=l={baseTime:d.initPTS,timescale:1});const y=e?v-l.baseTime/l.timescale:c,Q=y+f;v0(g,h,l.baseTime/l.timescale),f>0?this.lastEndTime=Q:(N.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const m=!!g.audio,b=!!g.video;let x="";m&&(x+="audio"),b&&(x+="video");const B={data1:h,startPTS:y,startDTS:y,endPTS:Q,endDTS:Q,type:x,hasAudio:m,hasVideo:b,nb:1,dropped:0};return u.audio=B.type==="audio"?B:void 0,u.video=B.type!=="audio"?B:void 0,u.initSegment=d,u.id3=au(i,n,l,l),r.samples.length&&(u.text=Au(r,n,l)),u}}function uE(s,e,t,i){if(s===null)return!0;const r=Math.max(i,1),n=e-s.baseTime/s.timescale;return Math.abs(n-t)>r}function cu(s,e){const t=s==null?void 0:s.codec;if(t&&t.length>4)return t;if(e===Pe.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return un(t,!1);const i="mp4a.40.5";return N.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${i}"`),i}return N.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let Qi;try{Qi=self.performance.now.bind(self.performance)}catch{N.debug("Unable to use Performance API on this environment"),Qi=fs==null?void 0:fs.Date.now}const wn=[{demux:jp,remux:cE},{demux:Ni,remux:Sn},{demux:Wp,remux:Sn},{demux:sE,remux:Sn}];wn.splice(2,0,{demux:Xp,remux:Sn});class uu{constructor(e,t,i,r,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.vendor=r,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,r){const n=i.transmuxing;n.executeStart=Qi();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:A}=this;r&&(this.currentTransmuxState=r);const{contiguous:l,discontinuity:c,trackSwitch:u,accurateTimeOffset:h,timeOffset:d,initSegmentChange:g}=r||a,{audioCodec:f,videoCodec:p,defaultInitPts:v,duration:y,initSegmentData:Q}=A,m=hE(o,t);if(m&&m.method==="AES-128"){const H=this.getDecrypter();if(H.isSync()){let _=H.softwareDecrypt(o,m.key.buffer,m.iv.buffer);if(i.part>-1&&(_=H.flush()),!_)return n.executeEnd=Qi(),Ea(i);o=new Uint8Array(_)}else return this.decryptionPromise=H.webCryptoDecrypt(o,m.key.buffer,m.iv.buffer).then(_=>{const k=this.push(_,null,i);return this.decryptionPromise=null,k}),this.decryptionPromise}const b=this.needsProbing(c,u);if(b){const H=this.configureTransmuxer(o);if(H)return N.warn(`[transmuxer] ${H.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:Ee.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:H,reason:H.message}),n.executeEnd=Qi(),Ea(i)}(c||u||g||b)&&this.resetInitSegment(Q,f,p,y,t),(c||g||b)&&this.resetInitialTimestamp(v),l||this.resetContiguity();const x=this.transmux(o,m,d,h,i),B=this.currentTransmuxState;return B.contiguous=!0,B.discontinuity=!1,B.trackSwitch=!1,n.executeEnd=Qi(),x}flush(e){const t=e.transmuxing;t.executeStart=Qi();const{decrypter:i,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const o=[],{timeOffset:a}=r;if(i){const u=i.flush();u&&o.push(this.push(u,null,e))}const{demuxer:A,remuxer:l}=this;if(!A||!l)return t.executeEnd=Qi(),[Ea(e)];const c=A.flush(a);return Rn(c)?c.then(u=>(this.flushRemux(o,u,e),o)):(this.flushRemux(o,c,e),o)}flushRemux(e,t,i){const{audioTrack:r,videoTrack:n,id3Track:o,textTrack:a}=t,{accurateTimeOffset:A,timeOffset:l}=this.currentTransmuxState;N.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const c=this.remuxer.remux(r,n,o,a,l,A,!0,this.id);e.push({remuxResult:c,chunkMeta:i}),i.transmuxing.executeEnd=Qi()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,r,n){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,i,r),a.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,r,n){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,i,r,n):o=this.transmuxUnencrypted(e,i,r,n),o}transmuxUnencrypted(e,t,i,r){const{audioTrack:n,videoTrack:o,id3Track:a,textTrack:A}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,o,a,A,t,i,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,i,r,n){return this.demuxer.demuxSampleAes(e,t,i).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,i,r,!1,this.id),chunkMeta:n}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:r,vendor:n}=this;let o;for(let h=0,d=wn.length;h<d;h++){var a;if((a=wn[h].demux)!=null&&a.probe(e)){o=wn[h];break}}if(!o)return new Error("Failed to find demuxer by probing fragment data");const A=this.demuxer,l=this.remuxer,c=o.remux,u=o.demux;(!l||!(l instanceof c))&&(this.remuxer=new c(i,t,r,n)),(!A||!(A instanceof u))&&(this.demuxer=new u(i,t,r),this.probe=u.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Aa(this.config)),e}}function hE(s,e){let t=null;return s.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Ea=s=>({remuxResult:{},chunkMeta:s});function Rn(s){return"then"in s&&s.then instanceof Function}class dE{constructor(e,t,i,r,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=n||null}}class gE{constructor(e,t,i,r,n,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=o}}var hu={exports:{}};(function(s){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(A,l,c){this.fn=A,this.context=l,this.once=c||!1}function n(A,l,c,u,h){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new r(c,u||A,h),g=t?t+l:l;return A._events[g]?A._events[g].fn?A._events[g]=[A._events[g],d]:A._events[g].push(d):(A._events[g]=d,A._eventsCount++),A}function o(A,l){--A._eventsCount===0?A._events=new i:delete A._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)e.call(c,u)&&l.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=t?t+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,d=u.length,g=new Array(d);h<d;h++)g[h]=u[h].fn;return g},a.prototype.listenerCount=function(l){var c=t?t+l:l,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,c,u,h,d,g){var f=t?t+l:l;if(!this._events[f])return!1;var p=this._events[f],v=arguments.length,y,Q;if(p.fn){switch(p.once&&this.removeListener(l,p.fn,void 0,!0),v){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,c),!0;case 3:return p.fn.call(p.context,c,u),!0;case 4:return p.fn.call(p.context,c,u,h),!0;case 5:return p.fn.call(p.context,c,u,h,d),!0;case 6:return p.fn.call(p.context,c,u,h,d,g),!0}for(Q=1,y=new Array(v-1);Q<v;Q++)y[Q-1]=arguments[Q];p.fn.apply(p.context,y)}else{var m=p.length,b;for(Q=0;Q<m;Q++)switch(p[Q].once&&this.removeListener(l,p[Q].fn,void 0,!0),v){case 1:p[Q].fn.call(p[Q].context);break;case 2:p[Q].fn.call(p[Q].context,c);break;case 3:p[Q].fn.call(p[Q].context,c,u);break;case 4:p[Q].fn.call(p[Q].context,c,u,h);break;default:if(!y)for(b=1,y=new Array(v-1);b<v;b++)y[b-1]=arguments[b];p[Q].fn.apply(p[Q].context,y)}}return!0},a.prototype.on=function(l,c,u){return n(this,l,c,u,!1)},a.prototype.once=function(l,c,u){return n(this,l,c,u,!0)},a.prototype.removeListener=function(l,c,u,h){var d=t?t+l:l;if(!this._events[d])return this;if(!c)return o(this,d),this;var g=this._events[d];if(g.fn)g.fn===c&&(!h||g.once)&&(!u||g.context===u)&&o(this,d);else{for(var f=0,p=[],v=g.length;f<v;f++)(g[f].fn!==c||h&&!g[f].once||u&&g[f].context!==u)&&p.push(g[f]);p.length?this._events[d]=p.length===1?p[0]:p:o(this,d)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=t?t+l:l,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,s.exports=a})(hu);var fE=hu.exports,Ia=Pf(fE);class du{constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;const o=(l,c)=>{c=c||{},c.frag=this.frag,c.id=this.id,l===E.ERROR&&(this.error=c.error),this.hls.trigger(l,c)};this.observer=new Ia,this.observer.on(E.FRAG_DECRYPTED,o),this.observer.on(E.ERROR,o);const a=zi(n.preferManagedMediaSource)||{isTypeSupported:()=>!1},A={mpeg:a.isTypeSupported("audio/mpeg"),mp3:a.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:a.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||kp())){try{n.workerPath?(N.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=Np(n.workerPath)):(N.log(`injecting Web Worker for "${t}"`),this.workerContext=Fp()),this.onwmsg=u=>this.onWorkerMessage(u);const{worker:c}=this.workerContext;c.addEventListener("message",this.onwmsg),c.onerror=u=>{const h=new Error(`${u.message} (${u.filename}:${u.lineno})`);n.enableWorker=!1,N.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(E.ERROR,{type:Ee.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:h})},c.postMessage({cmd:"init",typeSupported:A,vendor:"",id:t,config:JSON.stringify(n)})}catch(c){N.warn(`Error setting up "${t}" Web Worker, fallback to inline`,c),this.resetWorker(),this.error=null,this.transmuxer=new uu(this.observer,A,n,"",t)}return}this.transmuxer=new uu(this.observer,A,n,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,r,n,o,a,A,l,c){var u,h;l.transmuxing.start=self.performance.now();const{transmuxer:d}=this,g=o?o.start:n.start,f=n.decryptdata,p=this.frag,v=!(p&&n.cc===p.cc),y=!(p&&l.level===p.level),Q=p?l.sn-p.sn:-1,m=this.part?l.part-this.part.index:-1,b=Q===0&&l.id>1&&l.id===(p==null?void 0:p.stats.chunkCount),x=!y&&(Q===1||Q===0&&(m===1||b&&m<=0)),B=self.performance.now();(y||Q||n.stats.parsing.start===0)&&(n.stats.parsing.start=B),o&&(m||!x)&&(o.stats.parsing.start=B);const H=!(p&&((u=n.initSegment)==null?void 0:u.url)===((h=p.initSegment)==null?void 0:h.url)),_=new gE(v,x,A,y,g,H);if(!x||v||H){N.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}
169
+ discontinuity: ${v}
170
+ trackSwitch: ${y}
171
+ contiguous: ${x}
168
172
  accurateTimeOffset: ${A}
169
173
  timeOffset: ${g}
170
- initSegmentChange: ${F}`);const M=new $E(i,r,t,a,c);this.configureTransmuxer(M)}if(this.frag=n,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:G},e instanceof ArrayBuffer?[e]:[]);else if(d){const M=d.push(e,f,l,G);gn(M)?(d.async=!0,M.then(H=>{this.handleTransmuxComplete(H)}).catch(H=>{this.transmuxerError(H,l,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(M))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);gn(i)||t.async?(gn(i)||(i=Promise.resolve(i)),i.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data,i=this.hls;switch(t.event){case"init":{var r;const n=(r=this.workerContext)==null?void 0:r.objectURL;n&&self.URL.revokeObjectURL(n);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":_[t.data.logType]&&_[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function zc(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!ys(s[t].attrs,e[t].attrs))return!1;return!0}function ys(s,e,t){const i=s["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>s[r]!==e[r])}function ia(s,e){return e.label.toLowerCase()===s.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(s.lang||"").toLowerCase())}const eh=100;class VE extends Vo{constructor(e,t,i){super(e,t,i,"[audio-stream-controller]",Ee.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.ERROR,this.onError,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.ERROR,this.onError,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){if(i==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:r,timescale:n},this.log(`InitPTS for cc: ${o} found from main: ${r}`),this.videoTrackCC=o,this.state===Z.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=Z.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(eh),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=Z.IDLE):(this.loadedmetadata=!1,this.state=Z.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case Z.IDLE:this.doTickIdle();break;case Z.WAITING_TRACK:{var e;const{levels:i,trackId:r}=this,n=i==null||(e=i[r])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=Z.WAITING_INIT_PTS}break}case Z.FRAG_LOADING_WAITING_RETRY:{var t;const i=performance.now(),r=this.retryDate;if(!r||i>=r||(t=this.media)!=null&&t.seeking){const{levels:n,trackId:o}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[o])||null),this.state=Z.IDLE}break}case Z.WAITING_INIT_PTS:{const i=this.waitingData;if(i){const{frag:r,part:n,cache:o,complete:a}=i;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=Z.FRAG_LOADING;const A=o.flush(),l={frag:r,part:n,payload:A,networkDetails:null};this._handleFragmentLoadProgress(l),a&&super._handleFragmentLoadComplete(l)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${r.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const A=this.getLoadPosition(),l=Pe.bufferInfo(this.mediaBuffer,A,this.config.maxBufferHole);Ho(l.end,this.config.maxFragLookUpTolerance,r)<0&&(this.log(`Waiting fragment cc (${r.cc}) @ ${r.start} cancelled because another fragment at ${l.end} is needed`),this.clearWaitingFragment())}}else this.state=Z.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Z.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:r}=this,n=e.config;if(!i&&(this.startFragRequested||!n.startFragPrefetch)||!(t!=null&&t[r]))return;const o=t[r],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a)){this.state=Z.WAITING_TRACK;return}const A=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&A&&(this.bufferFlushed=!1,this.afterBufferFlushed(A,_e.AUDIO,Ee.AUDIO));const l=this.getFwdBufferInfo(A,Ee.AUDIO);if(l===null)return;const{bufferedTrack:c,switchingTrack:h}=this;if(!h&&this._streamEnded(l,a)){e.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=Z.ENDED;return}const u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Ee.MAIN),d=l.len,g=this.getMaxBufferLength(u==null?void 0:u.len),f=a.fragments,E=f[0].start;let B=this.flushing?this.getLoadPosition():l.end;if(h&&i){const y=this.getLoadPosition();c&&!ys(h.attrs,c.attrs)&&(B=y),a.PTSKnown&&y<E&&(l.end>E||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=E+.05)}if(d>=g&&!h&&B<f[f.length-1].start)return;let S=this.getNextFragment(B,a),Q=!1;if(S&&this.isLoopLoading(S,B)&&(Q=!!S.gap,S=this.getNextFragmentLoopLoading(S,a,l,Ee.MAIN,g)),!S){this.bufferFlushed=!0;return}const m=u&&S.start>u.end+a.targetduration;if(m||!(u!=null&&u.len)&&l.len){const y=this.getAppendedFrag(S.start,Ee.MAIN);if(y===null||(Q||(Q=!!y.gap||!!m&&u.len===0),m&&!Q||Q&&l.nextStart&&l.nextStart<y.end))return}this.loadFragment(S,o,B)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new fs(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?this.setInterval(eh):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=Z.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=Z.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(p.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:r}=this,{details:n,id:o}=t;if(!r){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Audio track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const a=r[o];let A=0;if(n.live||(i=a.details)!=null&&i.live){this.checkLiveUpdate(n);const c=this.mainDetails;if(n.deltaUpdateFailed||!c)return;if(!a.details&&n.hasProgramDateTime&&c.hasProgramDateTime)ln(n,c),A=n.fragments[0].start;else{var l;A=this.alignPlaylists(n,a.details,(l=this.levelLastLoaded)==null?void 0:l.details)}}a.details=n,this.levelLastLoaded=a,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(this.mainDetails||n,A),this.state===Z.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=Z.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{config:o,trackId:a,levels:A}=this;if(!A){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const l=A[a];if(!l){this.warn("Audio track is undefined on fragment load progress");return}const c=l.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const h=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let u=this.transmuxer;u||(u=this.transmuxer=new Zc(this.hls,Ee.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[i.cc],g=(t=i.initSegment)==null?void 0:t.data;if(d!==void 0){const E=r?r.index:-1,B=E!==-1,S=new Ko(i.level,i.sn,i.stats.chunkCount,n.byteLength,E,B);u.push(n,g,h,"",i,r,c.totalduration,!1,S,d)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);const{cache:f}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new xc,complete:!1};f.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=Z.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type!==Ee.AUDIO){if(!this.loadedmetadata&&i.type===Ee.MAIN){const n=this.videoBuffer||this.media;n&&Pe.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(i.sn!=="initSegment"){this.fragPrevious=i;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,At({},n)))}this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=Z.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.AUDIO,t);break;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Z.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===be.AUDIO_TRACK&&(this.state=Z.IDLE);break;case $.BUFFER_APPEND_ERROR:case $.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===$.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==_e.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==_e.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Z.ENDED&&(this.state=Z.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,Ee.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{details:h}=c,{audio:u,text:d,id3:g,initSegment:f}=n;if(this.fragContextChanged(A)||!h){this.fragmentTracker.removeFragment(A);return}if(this.state=Z.PARSING,this.switchingTrack&&u&&this.completeAudioSwitch(this.switchingTrack),f!=null&&f.tracks){const E=A.initSegment||A;this._bufferInitSegment(c,f.tracks,E,o),r.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:E,id:i,tracks:f.tracks})}if(u){const{startPTS:E,endPTS:B,startDTS:S,endDTS:Q}=u;l&&(l.elementaryStreams[_e.AUDIO]={startPTS:E,endPTS:B,startDTS:S,endDTS:Q}),A.setElementaryStreamInfo(_e.AUDIO,E,B,S,Q),this.bufferFragmentData(u,A,l,o)}if(g!=null&&(t=g.samples)!=null&&t.length){const E=Ze({id:i,frag:A,details:h},g);r.trigger(p.FRAG_PARSING_METADATA,E)}if(d){const E=Ze({id:i,frag:A,details:h},d);r.trigger(p.FRAG_PARSING_USERDATA,E)}}_bufferInitSegment(e,t,i,r){if(this.state!==Z.PARSING)return;t.video&&delete t.video;const n=t.audio;if(!n)return;n.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${o}/${n.codec}]`),o&&o.split(",").length===1&&(n.levelCodec=o),this.hls.trigger(p.BUFFER_CODECS,t);const a=n.initSegment;if(a!=null&&a.byteLength){const A={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:a};this.hls.trigger(p.BUFFER_APPENDING,A)}this.tickImmediate()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||r===lt.NOT_LOADED||r===lt.PARTIAL){var n;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=Z.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragments[0].start!==t.details.fragments[0].start&&ln(t.details,o)}else this.startFragRequested=!0,super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,r=i==null?void 0:i.attrs,n=e.attrs;t&&r&&(r.CHANNELS!==n.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(p.AUDIO_TRACK_SWITCHED,At({},e))}}class JE extends $o{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Audio track with id:${i} and group:${r} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(a=>(r==null?void 0:r.indexOf(a))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(u=>!i||i.indexOf(u.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(u=>u.default)&&(this.selectDefaultTrack=!1),a.forEach((u,d)=>{u.id=d});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const A=this.hls.config.audioPreference;if(!n&&A){const u=ii(A,a,Is);if(u>-1)n=a[u];else{const d=ii(A,this.tracks);n=this.tracks[d]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const c={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(p.AUDIO_TRACKS_UPDATED,c);const h=this.trackId;if(l!==-1&&h===-1)this.setAudioTrack(l);else if(a.length&&h===-1){var o;const u=new Error(`No audio track selected for current audio group-ID(s): ${(o=this.groupIds)==null?void 0:o.join(",")} track count: ${a.length}`);this.warn(u.message),this.hls.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:u})}}else this.shouldReloadPlaylist(n)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===be.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-1,this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const r=this.currentTrack;if(r&&ps(e,r,Is))return r;const n=ii(e,this.tracksInGroup,Is);if(n>-1){const o=this.tracksInGroup[n];return this.setAudioTrack(n),o}else if(r){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=J0(e,t.levels,i,o,Is);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=ii(e,i);if(o>-1)return i[o]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===i&&n||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(p.AUDIO_TRACK_SWITCHING,At({},r)),n))return;const o=this.switchParams(r.url,i==null?void 0:i.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(!(this.selectDefaultTrack&&!r.default)&&(!e||ps(e,r,Is)))return i}if(e){const{name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A}=e;for(let l=0;l<t.length;l++){const c=t[l];if(ps({name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A},c,Is))return l}for(let l=0;l<t.length;l++){const c=t[l];if(ys(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(let l=0;l<t.length;l++){const c=t[l];if(ys(e.attrs,c.attrs,["LANGUAGE"]))return l}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${i} "${t.name}" lang:${t.lang} group:${r}`),this.clearTimer(),this.hls.trigger(p.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}}const th=500;class WE extends Vo{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",Ee.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.ERROR,this.onError,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.ERROR,this.onError,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=Z.IDLE,this.setInterval(th),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:r}=t;if(this.fragPrevious=i,this.state=Z.IDLE,!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let o;const a=i.start;for(let l=0;l<n.length;l++)if(a>=n[l].start&&a<=n[l].end){o=n[l];break}const A=i.start+i.duration;o?o.end=A:(o={start:a,end:A},n.push(o)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:r}=t;if(i===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=n){o.shift();continue}else if(o[a].start<n)o[a].start=n;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(i,n,Ee.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===Ee.MAIN){var i;(i=this.media)!=null&&i.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===Ee.SUBTITLE&&(this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Z.STOPPED&&(this.state=Z.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&zc(this.levels,t)){this.levels=t.map(i=>new fs(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new fs(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ee.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(th)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:r,levels:n}=this,{details:o,id:a}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const A=n[r];if(a>=n.length||a!==r||!A)return;this.log(`Subtitle track ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(o.live||(i=A.details)!=null&&i.live){const h=this.mainDetails;if(o.deltaUpdateFailed||!h)return;const u=h.fragments[0];if(!A.details)o.hasProgramDateTime&&h.hasProgramDateTime?(ln(o,h),l=o.fragments[0].start):u&&(l=u.start,Po(o,l));else{var c;l=this.alignPlaylists(o,A.details,(c=this.levelLastLoaded)==null?void 0:c.details),l===0&&u&&(l=u.start,Po(o,l))}}A.details=o,this.levelLastLoaded=A,!this.startFragRequested&&(this.mainDetails||!o.live)&&this.setStartPosition(this.mainDetails||o,l),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===Z.IDLE&&(nn(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),A.details=void 0))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&r!=null&&r.key&&r.iv&&r.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer).catch(a=>{throw n.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const A=performance.now();n.trigger(p.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:A}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=Z.IDLE})}}doTick(){if(!this.media){this.state=Z.IDLE;return}if(this.state===Z.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details)return;const{config:r}=this,n=this.getLoadPosition(),o=Pe.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:a,len:A}=o,l=this.getFwdBufferInfo(this.media,Ee.MAIN),c=i.details,h=this.getMaxBufferLength(l==null?void 0:l.len)+c.levelTargetDuration;if(A>h)return;const u=c.fragments,d=u.length,g=c.edge;let f=null;const E=this.fragPrevious;if(a<g){const B=r.maxFragLookUpTolerance,S=a>g-B?0:B;f=nn(E,u,Math.max(u[0].start,a),S),!f&&E&&E.start<u[0].start&&(f=u[0])}else f=u[d-1];if(!f)return;if(f=this.mapToInitFragWhenRequired(f),f.sn!=="initSegment"){const B=f.sn-c.startSN,S=u[B-1];S&&S.cc===f.cc&&this.fragmentTracker.getState(S)===lt.NOT_LOADED&&(f=S)}this.fragmentTracker.getState(f)===lt.NOT_LOADED&&this.loadFragment(f,i,a)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,i){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,i))}get mediaBufferTimeRanges(){return new qE(this.tracksBuffered[this.currentTrackId]||[])}}class qE{constructor(e){this.buffered=void 0;const t=(i,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}class jE extends $o{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=zr(this.media.textTracks);for(let n=0;n<i.length;n++)if(i[n].mode==="hidden")t=i[n];else if(i[n].mode==="showing"){t=i[n];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),zr(this.media.textTracks).forEach(t=>{gs(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Subtitle track with id:${i} and group:${r} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(o=>(r==null?void 0:r.indexOf(o))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(c=>!i||i.indexOf(c.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(c=>c.default)&&(this.selectDefaultTrack=!1),o.forEach((c,h)=>{c.id=h});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const a=this.hls.config.subtitlePreference;if(!n&&a){this.selectDefaultTrack=!1;const c=ii(a,o);if(c>-1)n=o[c];else{const h=ii(a,this.tracks);n=this.tracks[h]}}let A=this.findTrackId(n);A===-1&&n&&(A=this.findTrackId(null));const l={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(p.SUBTITLE_TRACKS_UPDATED,l),A!==-1&&this.trackId===-1&&this.setSubtitleTrack(A)}else this.shouldReloadPlaylist(n)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const n=t[r];if(!(i&&!n.default||!i&&!e)&&(!e||ps(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(ys(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(ys(e.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(ia(r,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===be.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&ps(e,i))return i;const r=ii(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(i)return null;{const n=ii(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(p.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=zr(e.textTracks),i=this.currentTrack;let r;if(i&&(r=t.filter(n=>ia(i,n))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==r&&(n.mode="disabled")}),r){const n=this.subtitleDisplay?"showing":"hidden";r.mode!==n&&(r.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!Ae(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===i&&n)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:o,groupId:a="",name:A,type:l,url:c}=r;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:A,type:l,url:c});const h=this.switchParams(r.url,i==null?void 0:i.details);this.loadPlaylist(h)}}class XE{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const r=this.queues[t];r.push(e),r.length===1&&!i&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise(n=>{t=n}),r={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(r,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(r){_.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${r}`),i.onError(r);const n=this.buffers[e];n!=null&&n.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const ih=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class ZE{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=i=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:i,mediaSource:r}=this;this.log("Media source opened"),i&&(i.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(p.MEDIA_ATTACHED,{media:i,mediaSource:r})),r&&r.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:r}=this;i!==r&&_.error(`Media element src was set while attaching MediaSource (${r} > ${i})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=e.config.preferManagedMediaSource&&typeof self<"u"&&self.ManagedMediaSource,this.log=_.log.bind(_,t),this.warn=_.warn.bind(_,t),this.error=_.error.bind(_,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_APPENDING,this.onBufferAppending,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.BUFFER_EOS,this.onBufferEos,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.FRAG_PARSED,this.onFragParsed,this),e.on(p.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_APPENDING,this.onBufferAppending,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_EOS,this.onBufferEos,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.FRAG_PARSED,this.onFragParsed,this),e.off(p.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new XE(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,r=ds(this.appendSource);if(i&&r){var n;const o=this.mediaSource=new r;this.log(`created media source: ${(n=o.constructor)==null?void 0:n.name}`),o.addEventListener("sourceopen",this._onMediaSourceOpen),o.addEventListener("sourceended",this._onMediaSourceEnded),o.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(o.addEventListener("startstreaming",this._onStartStreaming),o.addEventListener("endstreaming",this._onEndStreaming));const a=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{i.removeAttribute("src");const A=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||A&&o instanceof A,sh(i),zE(i,a),i.load()}catch{i.src=a}else i.src=a;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){this.warn(`onMediaDetaching: ${r.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&sh(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(p.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var i;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(r){this.warn(`onBufferReset ${e}`,r)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,r=Object.keys(t);if(r.forEach(o=>{if(i){const A=this.tracks[o];if(A&&typeof A.buffer.changeType=="function"){var a;const{id:l,codec:c,levelCodec:h,container:u,metadata:d}=t[o],g=Zl(A.codec,A.levelCodec),f=g==null?void 0:g.replace(ih,"$1");let E=Zl(c,h);const B=(a=E)==null?void 0:a.replace(ih,"$1");if(E&&f!==B){o.slice(0,5)==="audio"&&(E=Zr(E,this.appendSource));const S=`${u};codecs=${E}`;this.appendChangeType(o,S),this.log(`switching codec ${g} to ${E}`),this.tracks[o]={buffer:A.buffer,codec:c,container:u,levelCodec:h,metadata:d,id:l}}}}else this.pendingTracks[o]=t[o]}),i)return;const n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(`${n} bufferCodec event(s) expected ${r.join(",")}`),this.bufferCodecEventsExpected=n),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,r={execute:()=>{const n=this.sourceBuffer[e];n&&(this.log(`changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{this.warn(`Failed to change ${e} SourceBuffer type`,n)}};i.append(r,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:r,tracks:n}=this,{data:o,type:a,frag:A,part:l,chunkMeta:c}=t,h=c.buffering[a],u=self.performance.now();h.start=u;const d=A.stats.buffering,g=l?l.stats.buffering:null;d.start===0&&(d.start=u),g&&g.start===0&&(g.start=u);const f=n.audio;let E=!1;a==="audio"&&(f==null?void 0:f.container)==="audio/mpeg"&&(E=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const B=A.start,S={execute:()=>{if(h.executeStart=self.performance.now(),E){const Q=this.sourceBuffer[a];if(Q){const m=B-Q.timestampOffset;Math.abs(m)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${B} (delta: ${m}) sn: ${A.sn})`),Q.timestampOffset=B)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const Q=self.performance.now();h.executeEnd=h.end=Q,d.first===0&&(d.first=Q),g&&g.first===0&&(g.first=Q);const{sourceBuffer:m}=this,y={};for(const L in m)y[L]=Pe.getBuffered(m[L]);this.appendErrors[a]=0,a==="audio"||a==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(p.BUFFER_APPENDED,{type:a,frag:A,part:l,chunkMeta:c,parent:A.type,timeRanges:y})},onError:Q=>{const m={type:Ie.MEDIA_ERROR,parent:A.type,details:$.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:A,part:l,chunkMeta:c,error:Q,err:Q,fatal:!1};if(Q.code===DOMException.QUOTA_EXCEEDED_ERR)m.details=$.BUFFER_FULL_ERROR;else{const y=++this.appendErrors[a];m.details=$.BUFFER_APPEND_ERROR,this.warn(`Failed ${y}/${i.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),y>=i.config.appendErrorMaxRetry&&(m.fatal=!0)}i.trigger(p.ERROR,m)}};r.append(S,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:i}=this,r=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(p.BUFFER_FLUSHED,{type:n})},onError:o=>{this.warn(`Failed to remove from ${n} SourceBuffer`,o)}});t.type?i.append(r(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{i.append(r(n),n)})}onFragParsed(e,t){const{frag:i,part:r}=t,n=[],o=r?r.elementaryStreams:i.elementaryStreams;o[_e.AUDIOVIDEO]?n.push("audiovideo"):(o[_e.AUDIO]&&n.push("audio"),o[_e.VIDEO]&&n.push("video"));const a=()=>{const A=self.performance.now();i.stats.buffering.end=A,r&&(r.stats.buffering.end=A);const l=r?r.stats:i.stats;this.hls.trigger(p.FRAG_BUFFERED,{frag:i,part:r,stats:l,id:i.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(a,n)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((r,n)=>{const o=this.sourceBuffer[n];return o&&(!t.type||t.type===n)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${n} sourceBuffer now EOS`))),r&&!!(!o||o.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const o=this.sourceBuffer[n];o&&(o.ending=!1)});const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.getSourceBufferTypes().length)return;const n=e.config,o=i.currentTime,a=t.levelTargetDuration,A=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(Ae(A)&&A>0){const l=Math.max(A,a),c=Math.floor(o/a)*a-l;this.flushBackBuffer(o,a,c)}if(Ae(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const l=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),c=Math.max(l,a),h=Math.floor(o/a)*a+c;this.flushFrontBuffer(o,a,h)}}flushBackBuffer(e,t,i){const{details:r,sourceBuffer:n}=this;this.getSourceBufferTypes().forEach(a=>{const A=n[a];if(A){const l=Pe.getBuffered(A);if(l.length>0&&i>l.start(0)){if(this.hls.trigger(p.BACK_BUFFER_REACHED,{bufferEnd:i}),r!=null&&r.live)this.hls.trigger(p.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(A.ended&&l.end(l.length-1)-e<t*2){this.log(`Cannot flush ${a} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:a})}}})}flushFrontBuffer(e,t,i){const{sourceBuffer:r}=this;this.getSourceBufferTypes().forEach(o=>{const a=r[o];if(a){const A=Pe.getBuffered(a),l=A.length;if(l<2)return;const c=A.start(l-1),h=A.end(l-1);if(i>c||e>=c&&e<=h)return;if(a.ended&&e-h<2*t){this.log(`Cannot flush ${o} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:o})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:i,mediaSource:r}=this,n=e.fragments[0].start+e.totalduration,o=i.duration,a=Ae(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(r.duration=1/0,this.updateSeekableRange(e)):(n>a&&n>o||!Ae(o))&&(this.log(`Updating Media Source duration to ${n.toFixed(3)}`),r.duration=n)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,i[0].start),o=Math.max(n,n+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${n}-${o}.`),t.setLiveSeekableRange(n,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,r=Object.keys(i).length;if(r&&(!e||r===2||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(p.BUFFER_CREATED,{tracks:this.tracks}),n.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){const n=e[r];if(!n)throw Error(`source buffer exists for track ${r}, however track does not`);let o=n.levelCodec||n.codec;o&&r.slice(0,5)==="audio"&&(o=Zr(o,this.appendSource));const a=`${n.container};codecs=${o}`;this.log(`creating sourceBuffer(${a})`);try{const A=t[r]=i.addSourceBuffer(a),l=r;this.addBufferListener(l,"updatestart",this._onSBUpdateStart),this.addBufferListener(l,"updateend",this._onSBUpdateEnd),this.addBufferListener(l,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(l,"bufferedchange",(c,h)=>{const u=h.removedRanges;u!=null&&u.length&&this.hls.trigger(p.BUFFER_FLUSHED,{type:r})}),this.tracks[r]={buffer:A,codec:o,container:n.container,levelCodec:n.levelCodec,metadata:n.metadata,id:n.id}}catch(A){this.error(`error while trying to add sourceBuffer: ${A.message}`),this.hls.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:A,sourceBufferName:r,mimeType:a})}}}get mediaSrc(){var e;const t=((e=this.media)==null?void 0:e.firstChild)||this.media;return t==null?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${r}`,t),this.hls.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.operationQueue.current(e);n&&n.onError(r)}removeExecutor(e,t,i){const{media:r,mediaSource:n,operationQueue:o,sourceBuffer:a}=this,A=a[e];if(!r||!n||!A){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const l=Ae(r.duration)?r.duration:1/0,c=Ae(n.duration)?n.duration:1/0,h=Math.max(0,t),u=Math.min(i,l,c);u>h&&(!A.ending||A.ended)?(A.ended=!1,this.log(`Removing [${h},${u}] from the ${e} SourceBuffer`),A.remove(h,u)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(!i){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}i.ended=!1,i.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:i}=this,r=t.map(n=>i.appendBlocker(n));Promise.all(r).then(()=>{e(),t.forEach(n=>{const o=this.sourceBuffer[n];o!=null&&o.updating||i.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const r=this.sourceBuffer[e];if(!r)return;const n=i.bind(this,e);this.listeners[e].push({event:t,listener:n}),r.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(i=>{t.removeEventListener(i.event,i.listener)})}}function sh(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function zE(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}const rh={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},nh=function(e){let t=e;return rh.hasOwnProperty(e)&&(t=rh[e]),String.fromCharCode(t)},Kt=15,yi=100,ep={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},tp={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ip={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},sp={25:2,26:4,29:6,30:8,31:10,27:13,28:15},rp=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class np{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;_.log(`${this.time} [${e}] ${i}`)}}}const Wi=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class oh{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class op{constructor(){this.uchar=" ",this.penState=new oh}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class ap{constructor(e){this.chars=[],this.pos=0,this.currPenState=new oh,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<yi;t++)this.chars.push(new op);this.logger=e}equals(e){for(let t=0;t<yi;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<yi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<yi;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>yi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=yi)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=nh(e);if(this.pos>=yi){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<yi;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<yi;i++){const r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class sa{constructor(e){this.rows=[],this.currRow=Kt-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Kt;t++)this.rows.push(new ap(e));this.logger=e}reset(){for(let e=0;e<Kt;e++)this.rows[e].clear();this.currRow=Kt-1}equals(e){let t=!0;for(let i=0;i<Kt;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Kt;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Kt;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let a=0;a<Kt;a++)this.rows[a].clear();const n=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[n].cueStartTime,A=this.logger.time;if(a!==null&&A!==null&&a<A)for(let l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(o.rows[n+l])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,o=Math.max(n-1,0);i.setCursor(e.indent),e.color=i.chars[o].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",r=-1;for(let n=0;n<Kt;n++){const o=this.rows[n].getTextString();o&&(r=n+1,e?t.push("Row "+r+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
171
- `)),i}getTextAndFormat(){return this.rows}}class ah{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new sa(i),this.nonDisplayedMemory=new sa(i),this.lastOutputScreen=new sa(i),this.currRollUpRow=this.displayedMemory.rows[Kt-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Kt-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Ah{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=ch(),this.logger=void 0;const r=this.logger=new np;this.channels=[null,new ah(e,t,r),new ah(e+1,i,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let i,r,n,o=!1;this.logger.time=e;for(let a=0;a<t.length;a+=2)if(r=t[a]&127,n=t[a+1]&127,!(r===0&&n===0)){if(this.logger.log(3,"["+Wi([t[a],t[a+1]])+"] -> ("+Wi([r,n])+")"),i=this.parseCmd(r,n),i||(i=this.parseMidrow(r,n)),i||(i=this.parsePAC(r,n)),i||(i=this.parseBackgroundAttributes(r,n)),!i&&(o=this.parseChars(r,n),o)){const A=this.currentChannel;A&&A>0?this.channels[A].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!i&&!o&&this.logger.log(2,"Couldn't parse cleaned data "+Wi([r,n])+" orig: "+Wi([t[a],t[a+1]]))}}parseCmd(e,t){const{cmdHistory:i}=this,r=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(r||n))return!1;if(lh(e,t,i))return Qs(null,null,i),this.logger.log(3,"Repeated command ("+Wi([e,t])+") is dropped"),!0;const o=e===20||e===21||e===23?1:2,a=this.channels[o];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),Qs(e,t,i),this.currentChannel=o,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[i];return r?(r.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Wi([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const r=this.cmdHistory,n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,o=(e===16||e===24)&&t>=64&&t<=95;if(!(n||o))return!1;if(lh(e,t,r))return Qs(null,null,r),!0;const a=e<=23?1:2;t>=64&&t<=95?i=a===1?ep[e]:ip[e]:i=a===1?tp[e]:sp[e];const A=this.channels[a];return A?(A.setPAC(this.interpretPAC(i,t)),Qs(e,t,r),this.currentChannel=a,!0):!1}interpretPAC(e,t){let i;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,r.underline=(i&1)===1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((i-16)/2)*4,r}parseChars(e,t){let i,r=null,n=null;if(e>=25?(i=2,n=e-8):(i=1,n=e),n>=17&&n<=19){let o;n===17?o=t+80:n===18?o=t+112:o=t+144,this.logger.log(2,"Special char '"+nh(o)+"' in channel "+i),r=[o]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);if(r){const o=Wi(r);this.logger.log(3,"Char codes = "+o.join(",")),Qs(e,t,this.cmdHistory)}return r}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(i||r))return!1;let n;const o={};e===16||e===24?(n=Math.floor((t-32)/2),o.background=rp[n],t%2===1&&(o.background=o.background+"_semi")):t===45?o.background="transparent":(o.foreground="black",t===47&&(o.underline=!0));const a=e<=23?1:2;return this.channels[a].setBkgData(o),Qs(e,t,this.cmdHistory),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}this.cmdHistory=ch()}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function Qs(s,e,t){t.a=s,t.b=e}function lh(s,e,t){return t.a===s&&t.b===e}function ch(){return{a:null,b:null}}class fn{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var ra=function(){if(us!=null&&us.VTTCue)return self.VTTCue;const s=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,A){if(typeof A!="string"||!Array.isArray(a))return!1;const l=A.toLowerCase();return~a.indexOf(l)?l:!1}function i(a){return t(s,a)}function r(a){return t(e,a)}function n(a,...A){let l=1;for(;l<arguments.length;l++){const c=arguments[l];for(const h in c)a[h]=c[h]}return a}function o(a,A,l){const c=this,h={enumerable:!0};c.hasBeenReset=!1;let u="",d=!1,g=a,f=A,E=l,B=null,S="",Q=!0,m="auto",y="start",L=50,v="middle",F=50,G="middle";Object.defineProperty(c,"id",n({},h,{get:function(){return u},set:function(M){u=""+M}})),Object.defineProperty(c,"pauseOnExit",n({},h,{get:function(){return d},set:function(M){d=!!M}})),Object.defineProperty(c,"startTime",n({},h,{get:function(){return g},set:function(M){if(typeof M!="number")throw new TypeError("Start time must be set to a number.");g=M,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",n({},h,{get:function(){return f},set:function(M){if(typeof M!="number")throw new TypeError("End time must be set to a number.");f=M,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",n({},h,{get:function(){return E},set:function(M){E=""+M,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",n({},h,{get:function(){return B},set:function(M){B=M,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",n({},h,{get:function(){return S},set:function(M){const H=i(M);if(H===!1)throw new SyntaxError("An invalid or illegal string was specified.");S=H,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",n({},h,{get:function(){return Q},set:function(M){Q=!!M,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",n({},h,{get:function(){return m},set:function(M){if(typeof M!="number"&&M!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");m=M,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",n({},h,{get:function(){return y},set:function(M){const H=r(M);if(!H)throw new SyntaxError("An invalid or illegal string was specified.");y=H,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",n({},h,{get:function(){return L},set:function(M){if(M<0||M>100)throw new Error("Position must be between 0 and 100.");L=M,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",n({},h,{get:function(){return v},set:function(M){const H=r(M);if(!H)throw new SyntaxError("An invalid or illegal string was specified.");v=H,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",n({},h,{get:function(){return F},set:function(M){if(M<0||M>100)throw new Error("Size must be between 0 and 100.");F=M,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",n({},h,{get:function(){return G},set:function(M){const H=r(M);if(!H)throw new SyntaxError("An invalid or illegal string was specified.");G=H,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class Ap{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function hh(s){function e(i,r,n,o){return(i|0)*3600+(r|0)*60+(n|0)+parseFloat(o||0)}const t=s.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class lp{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function uh(s,e,t,i){const r=i?s.split(i):[s];for(const n in r){if(typeof r[n]!="string")continue;const o=r[n].split(t);if(o.length!==2)continue;const a=o[0],A=o[1];e(a,A)}}const na=new ra(0,0,""),En=na.align==="middle"?"middle":"center";function cp(s,e,t){const i=s;function r(){const a=hh(s);if(a===null)throw new Error("Malformed timestamp: "+i);return s=s.replace(/^[^\sa-zA-Z-]+/,""),a}function n(a,A){const l=new lp;uh(a,function(u,d){let g;switch(u){case"region":for(let f=t.length-1;f>=0;f--)if(t[f].id===d){l.set(u,t[f].region);break}break;case"vertical":l.alt(u,d,["rl","lr"]);break;case"line":g=d.split(","),l.integer(u,g[0]),l.percent(u,g[0])&&l.set("snapToLines",!1),l.alt(u,g[0],["auto"]),g.length===2&&l.alt("lineAlign",g[1],["start",En,"end"]);break;case"position":g=d.split(","),l.percent(u,g[0]),g.length===2&&l.alt("positionAlign",g[1],["start",En,"end","line-left","line-right","auto"]);break;case"size":l.percent(u,d);break;case"align":l.alt(u,d,["start",En,"end","left","right"]);break}},/:/,/\s/),A.region=l.get("region",null),A.vertical=l.get("vertical","");let c=l.get("line","auto");c==="auto"&&na.line===-1&&(c=-1),A.line=c,A.lineAlign=l.get("lineAlign","start"),A.snapToLines=l.get("snapToLines",!0),A.size=l.get("size",100),A.align=l.get("align",En);let h=l.get("position","auto");h==="auto"&&na.position===50&&(h=A.align==="start"||A.align==="left"?0:A.align==="end"||A.align==="right"?100:50),A.position=h}function o(){s=s.replace(/^\s+/,"")}if(o(),e.startTime=r(),o(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);s=s.slice(3),o(),e.endTime=r(),o(),n(s,e)}function dh(s){return s.replace(/<br(?: \/)?>/gi,`
172
- `)}class hp{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Ap,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let n=t.buffer,o=0;for(n=dh(n);o<n.length&&n[o]!=="\r"&&n[o]!==`
174
+ initSegmentChange: ${H}`);const k=new dE(i,r,t,a,c);this.configureTransmuxer(k)}if(this.frag=n,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:_},e instanceof ArrayBuffer?[e]:[]);else if(d){const k=d.push(e,f,l,_);Rn(k)?(d.async=!0,k.then(U=>{this.handleTransmuxComplete(U)}).catch(U=>{this.transmuxerError(U,l,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(k))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);Rn(i)||t.async?(Rn(i)||(i=Promise.resolve(i)),i.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){N.warn(`worker message received with no ${t?"event name":"data"}`);return}const i=this.hls;if(this.hls)switch(t.event){case"init":{var r;const n=(r=this.workerContext)==null?void 0:r.objectURL;n&&self.URL.revokeObjectURL(n);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":N[t.data.logType]&&N[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function gu(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!Qs(s[t].attrs,e[t].attrs))return!1;return!0}function Qs(s,e,t){const i=s["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>s[r]!==e[r])}function ma(s,e){return e.label.toLowerCase()===s.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(s.lang||"").toLowerCase())}const fu=100;class pE extends la{constructor(e,t,i){super(e,t,i,"[audio-stream-controller]",de.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){if(i==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:r,timescale:n},this.log(`InitPTS for cc: ${o} found from main: ${r}`),this.videoTrackCC=o,this.state===X.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=X.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(fu),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=X.IDLE):(this.loadedmetadata=!1,this.state=X.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case X.IDLE:this.doTickIdle();break;case X.WAITING_TRACK:{var e;const{levels:i,trackId:r}=this,n=i==null||(e=i[r])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=X.WAITING_INIT_PTS}break}case X.FRAG_LOADING_WAITING_RETRY:{var t;const i=performance.now(),r=this.retryDate;if(!r||i>=r||(t=this.media)!=null&&t.seeking){const{levels:n,trackId:o}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[o])||null),this.state=X.IDLE}break}case X.WAITING_INIT_PTS:{const i=this.waitingData;if(i){const{frag:r,part:n,cache:o,complete:a}=i;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=X.FRAG_LOADING;const A=o.flush(),l={frag:r,part:n,payload:A,networkDetails:null};this._handleFragmentLoadProgress(l),a&&super._handleFragmentLoadComplete(l)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${r.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const A=this.getLoadPosition(),l=Ye.bufferInfo(this.mediaBuffer,A,this.config.maxBufferHole);na(l.end,this.config.maxFragLookUpTolerance,r)<0&&(this.log(`Waiting fragment cc (${r.cc}) @ ${r.start} cancelled because another fragment at ${l.end} is needed`),this.clearWaitingFragment())}}else this.state=X.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=X.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:r}=this,n=e.config;if(!i&&(this.startFragRequested||!n.startFragPrefetch)||!(t!=null&&t[r]))return;const o=t[r],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a)){this.state=X.WAITING_TRACK;return}const A=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&A&&(this.bufferFlushed=!1,this.afterBufferFlushed(A,Pe.AUDIO,de.AUDIO));const l=this.getFwdBufferInfo(A,de.AUDIO);if(l===null)return;const{bufferedTrack:c,switchingTrack:u}=this;if(!u&&this._streamEnded(l,a)){e.trigger(E.BUFFER_EOS,{type:"audio"}),this.state=X.ENDED;return}const h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,de.MAIN),d=l.len,g=this.getMaxBufferLength(h==null?void 0:h.len),f=a.fragments,p=f[0].start;let v=this.flushing?this.getLoadPosition():l.end;if(u&&i){const b=this.getLoadPosition();c&&!Qs(u.attrs,c.attrs)&&(v=b),a.PTSKnown&&b<p&&(l.end>p||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=p+.05)}if(d>=g&&!u&&v<f[f.length-1].start)return;let y=this.getNextFragment(v,a),Q=!1;if(y&&this.isLoopLoading(y,v)&&(Q=!!y.gap,y=this.getNextFragmentLoopLoading(y,a,l,de.MAIN,g)),!y){this.bufferFlushed=!0;return}const m=h&&y.start>h.end+a.targetduration;if(m||!(h!=null&&h.len)&&l.len){const b=this.getAppendedFrag(y.start,de.MAIN);if(b===null||(Q||(Q=!!b.gap||!!m&&h.len===0),m&&!Q||Q&&l.nextStart&&l.nextStart<b.end))return}this.loadFragment(y,o,v)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new Es(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?this.setInterval(fu):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=X.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=X.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(E.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:r}=this,{details:n,id:o}=t;if(!r){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Audio track ${o} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const a=r[o];let A=0;if(n.live||(i=a.details)!=null&&i.live){this.checkLiveUpdate(n);const c=this.mainDetails;if(n.deltaUpdateFailed||!c)return;if(!a.details&&n.hasProgramDateTime&&c.hasProgramDateTime)yn(n,c),A=n.fragments[0].start;else{var l;A=this.alignPlaylists(n,a.details,(l=this.levelLastLoaded)==null?void 0:l.details)}}a.details=n,this.levelLastLoaded=a,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(this.mainDetails||n,A),this.state===X.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=X.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{config:o,trackId:a,levels:A}=this;if(!A){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const l=A[a];if(!l){this.warn("Audio track is undefined on fragment load progress");return}const c=l.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const u=o.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new du(this.hls,de.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[i.cc],g=(t=i.initSegment)==null?void 0:t.data;if(d!==void 0){const p=r?r.index:-1,v=p!==-1,y=new aa(i.level,i.sn,i.stats.chunkCount,n.byteLength,p,v);h.push(n,g,u,"",i,r,c.totalduration,!1,y,d)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);const{cache:f}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new Kc,complete:!1};f.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=X.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i.type!==de.AUDIO){if(!this.loadedmetadata&&i.type===de.MAIN){const n=this.videoBuffer||this.media;n&&Ye.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(i.sn!=="initSegment"){this.fragPrevious=i;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(E.AUDIO_TRACK_SWITCHED,lt({},n)))}this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=X.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(de.AUDIO,t);break;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===X.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===Le.AUDIO_TRACK&&(this.state=X.IDLE);break;case $.BUFFER_APPEND_ERROR:case $.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===$.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Pe.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Pe.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===X.ENDED&&(this.state=X.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,de.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{details:u}=c,{audio:h,text:d,id3:g,initSegment:f}=n;if(this.fragContextChanged(A)||!u){this.fragmentTracker.removeFragment(A);return}if(this.state=X.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),f!=null&&f.tracks){const p=A.initSegment||A;this._bufferInitSegment(c,f.tracks,p,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:i,tracks:f.tracks})}if(h){const{startPTS:p,endPTS:v,startDTS:y,endDTS:Q}=h;l&&(l.elementaryStreams[Pe.AUDIO]={startPTS:p,endPTS:v,startDTS:y,endDTS:Q}),A.setElementaryStreamInfo(Pe.AUDIO,p,v,y,Q),this.bufferFragmentData(h,A,l,o)}if(g!=null&&(t=g.samples)!=null&&t.length){const p=tt({id:i,frag:A,details:u},g);r.trigger(E.FRAG_PARSING_METADATA,p)}if(d){const p=tt({id:i,frag:A,details:u},d);r.trigger(E.FRAG_PARSING_USERDATA,p)}}_bufferInitSegment(e,t,i,r){if(this.state!==X.PARSING)return;t.video&&delete t.video;const n=t.audio;if(!n)return;n.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${o}/${n.codec}]`),o&&o.split(",").length===1&&(n.levelCodec=o),this.hls.trigger(E.BUFFER_CODECS,t);const a=n.initSegment;if(a!=null&&a.byteLength){const A={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:a};this.hls.trigger(E.BUFFER_APPENDING,A)}this.tickImmediate()}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||r===ct.NOT_LOADED||r===ct.PARTIAL){var n;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=X.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragments[0].start!==t.details.fragments[0].start&&yn(t.details,o)}else this.startFragRequested=!0,super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,r=i==null?void 0:i.attrs,n=e.attrs;t&&r&&(r.CHANNELS!==n.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(E.AUDIO_TRACK_SWITCHED,lt({},e))}}class EE extends oa{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Audio track with id:${i} and group:${r} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(a=>(r==null?void 0:r.indexOf(a))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(h=>!i||i.indexOf(h.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(h=>h.default)&&(this.selectDefaultTrack=!1),a.forEach((h,d)=>{h.id=d});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const A=this.hls.config.audioPreference;if(!n&&A){const h=ri(A,a,Cs);if(h>-1)n=a[h];else{const d=ri(A,this.tracks);n=this.tracks[d]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const c={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(E.AUDIO_TRACKS_UPDATED,c);const u=this.trackId;if(l!==-1&&u===-1)this.setAudioTrack(l);else if(a.length&&u===-1){var o;const h=new Error(`No audio track selected for current audio group-ID(s): ${(o=this.groupIds)==null?void 0:o.join(",")} track count: ${a.length}`);this.warn(h.message),this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}else this.shouldReloadPlaylist(n)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===Le.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-1,this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const r=this.currentTrack;if(r&&ms(e,r,Cs))return r;const n=ri(e,this.tracksInGroup,Cs);if(n>-1){const o=this.tracksInGroup[n];return this.setAudioTrack(n),o}else if(r){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=Ep(e,t.levels,i,o,Cs);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=ri(e,i);if(o>-1)return i[o]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e],n=r.details&&!r.details.live;if(e===this.trackId&&r===i&&n||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(E.AUDIO_TRACK_SWITCHING,lt({},r)),n))return;const o=this.switchParams(r.url,i==null?void 0:i.details,r.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(!(this.selectDefaultTrack&&!r.default)&&(!e||ms(e,r,Cs)))return i}if(e){const{name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A}=e;for(let l=0;l<t.length;l++){const c=t[l];if(ms({name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A},c,Cs))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Qs(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Qs(e.attrs,c.attrs,["LANGUAGE"]))return l}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${i} "${t.name}" lang:${t.lang} group:${r}`),this.clearTimer(),this.hls.trigger(E.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}}const pu=500;class IE extends la{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",de.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=X.IDLE,this.setInterval(pu),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:r}=t;if(this.fragPrevious=i,this.state=X.IDLE,!r)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let o;const a=i.start;for(let l=0;l<n.length;l++)if(a>=n[l].start&&a<=n[l].end){o=n[l];break}const A=i.start+i.duration;o?o.end=A:(o={start:a,end:A},n.push(o)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:r}=t;if(i===0&&r!==Number.POSITIVE_INFINITY){const n=r-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=n){o.shift();continue}else if(o[a].start<n)o[a].start=n;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(i,n,de.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===de.MAIN){var i;(i=this.media)!=null&&i.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===de.SUBTITLE&&(t.details===$.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==X.STOPPED&&(this.state=X.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&gu(this.levels,t)){this.levels=t.map(i=>new Es(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new Es(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,de.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.setInterval(pu)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:r,levels:n}=this,{details:o,id:a}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const A=n[a];if(a>=n.length||!A)return;this.log(`Subtitle track ${a} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(o.live||(i=A.details)!=null&&i.live){const u=this.mainDetails;if(o.deltaUpdateFailed||!u)return;const h=u.fragments[0];if(!A.details)o.hasProgramDateTime&&u.hasProgramDateTime?(yn(o,u),l=o.fragments[0].start):h&&(l=h.start,sa(o,l));else{var c;l=this.alignPlaylists(o,A.details,(c=this.levelLastLoaded)==null?void 0:c.details),l===0&&h&&(l=h.start,sa(o,l))}}A.details=o,this.levelLastLoaded=A,a===r&&(!this.startFragRequested&&(this.mainDetails||!o.live)&&this.setStartPosition(this.mainDetails||o,l),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===X.IDLE&&(In(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),A.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,r=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&r!=null&&r.key&&r.iv&&r.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer).catch(a=>{throw n.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const A=performance.now();n.trigger(E.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:A}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=X.IDLE})}}doTick(){if(!this.media){this.state=X.IDLE;return}if(this.state===X.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details)return;const{config:r}=this,n=this.getLoadPosition(),o=Ye.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:a,len:A}=o,l=this.getFwdBufferInfo(this.media,de.MAIN),c=i.details,u=this.getMaxBufferLength(l==null?void 0:l.len)+c.levelTargetDuration;if(A>u)return;const h=c.fragments,d=h.length,g=c.edge;let f=null;const p=this.fragPrevious;if(a<g){const v=r.maxFragLookUpTolerance,y=a>g-v?0:v;f=In(p,h,Math.max(h[0].start,a),y),!f&&p&&p.start<h[0].start&&(f=h[0])}else f=h[d-1];if(!f)return;if(f=this.mapToInitFragWhenRequired(f),f.sn!=="initSegment"){const v=f.sn-c.startSN,y=h[v-1];y&&y.cc===f.cc&&this.fragmentTracker.getState(y)===ct.NOT_LOADED&&(f=y)}this.fragmentTracker.getState(f)===ct.NOT_LOADED&&this.loadFragment(f,i,a)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,i){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,i))}get mediaBufferTimeRanges(){return new mE(this.tracksBuffered[this.currentTrackId]||[])}}class mE{constructor(e){this.buffered=void 0;const t=(i,r,n)=>{if(r=r>>>0,r>n-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return e[r][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}class CE extends oa{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=hn(this.media.textTracks);for(let n=0;n<i.length;n++)if(i[n].mode==="hidden")t=i[n];else if(i[n].mode==="showing"){t=i[n];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),hn(this.media.textTracks).forEach(t=>{ps(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:r,details:n}=t,o=this.tracksInGroup[i];if(!o||o.groupId!==r){this.warn(`Subtitle track with id:${i} and group:${r} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${i} "${o.name}" lang:${o.lang} group:${r} loaded [${n.startSN}-${n.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,a)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,r=this.groupIds;let n=this.currentTrack;if(!i||(r==null?void 0:r.length)!==(i==null?void 0:i.length)||i!=null&&i.some(o=>(r==null?void 0:r.indexOf(o))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(c=>!i||i.indexOf(c.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(c=>c.default)&&(this.selectDefaultTrack=!1),o.forEach((c,u)=>{c.id=u});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const a=this.hls.config.subtitlePreference;if(!n&&a){this.selectDefaultTrack=!1;const c=ri(a,o);if(c>-1)n=o[c];else{const u=ri(a,this.tracks);n=this.tracks[u]}}let A=this.findTrackId(n);A===-1&&n&&(A=this.findTrackId(null));const l={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(E.SUBTITLE_TRACKS_UPDATED,l),A!==-1&&this.trackId===-1&&this.setSubtitleTrack(A)}else this.shouldReloadPlaylist(n)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const n=t[r];if(!(i&&!n.default||!i&&!e)&&(!e||ms(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(Qs(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(Qs(e.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const r=t[i];if(ma(r,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Le.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&ms(e,i))return i;const r=ri(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(i)return null;{const n=ri(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,r=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(E.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=hn(e.textTracks),i=this.currentTrack;let r;if(i&&(r=t.filter(n=>ma(i,n))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==r&&(n.mode="disabled")}),r){const n=this.subtitleDisplay?"showing":"hidden";r.mode!==n&&(r.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!oe(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!r.details&&!r.details.live;if(e===this.trackId&&r===i&&n)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:o,groupId:a="",name:A,type:l,url:c}=r;this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:A,type:l,url:c});const u=this.switchParams(r.url,i==null?void 0:i.details,r.details);this.loadPlaylist(u)}}class vE{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const r=this.queues[t];r.push(e),r.length===1&&!i&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise(n=>{t=n}),r={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(r,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(r){N.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${r}`),i.onError(r);const n=this.buffers[e];n!=null&&n.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Eu=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class yE{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=i=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:i,mediaSource:r}=this;this.log("Media source opened"),i&&(i.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(E.MEDIA_ATTACHED,{media:i,mediaSource:r})),r&&r.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:r}=this;i!==r&&N.error(`Media element src was set while attaching MediaSource (${r} > ${i})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=D0(zi(e.config.preferManagedMediaSource)),this.log=N.log.bind(N,t),this.warn=N.warn.bind(N,t),this.error=N.error.bind(N,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_APPENDING,this.onBufferAppending,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.BUFFER_EOS,this.onBufferEos,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.FRAG_PARSED,this.onFragParsed,this),e.on(E.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_APPENDING,this.onBufferAppending,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_EOS,this.onBufferEos,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.FRAG_PARSED,this.onFragParsed,this),e.off(E.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new vE(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,r=zi(this.appendSource);if(i&&r){var n;const o=this.mediaSource=new r;this.log(`created media source: ${(n=o.constructor)==null?void 0:n.name}`),o.addEventListener("sourceopen",this._onMediaSourceOpen),o.addEventListener("sourceended",this._onMediaSourceEnded),o.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(o.addEventListener("startstreaming",this._onStartStreaming),o.addEventListener("endstreaming",this._onEndStreaming));const a=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{i.removeAttribute("src");const A=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||A&&o instanceof A,Iu(i),BE(i,a),i.load()}catch{i.src=a}else i.src=a;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(r){this.warn(`onMediaDetaching: ${r.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&Iu(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(E.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var i;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(r){this.warn(`onBufferReset ${e}`,r)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,r=Object.keys(t);if(r.forEach(o=>{if(i){const A=this.tracks[o];if(A&&typeof A.buffer.changeType=="function"){var a;const{id:l,codec:c,levelCodec:u,container:h,metadata:d}=t[o],g=hc(A.codec,A.levelCodec),f=g==null?void 0:g.replace(Eu,"$1");let p=hc(c,u);const v=(a=p)==null?void 0:a.replace(Eu,"$1");if(p&&f!==v){o.slice(0,5)==="audio"&&(p=un(p,this.appendSource));const y=`${h};codecs=${p}`;this.appendChangeType(o,y),this.log(`switching codec ${g} to ${p}`),this.tracks[o]={buffer:A.buffer,codec:c,container:h,levelCodec:u,metadata:d,id:l}}}}else this.pendingTracks[o]=t[o]}),i)return;const n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(`${n} bufferCodec event(s) expected ${r.join(",")}`),this.bufferCodecEventsExpected=n),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,r={execute:()=>{const n=this.sourceBuffer[e];n&&(this.log(`changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{this.warn(`Failed to change ${e} SourceBuffer type`,n)}};i.append(r,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:r,tracks:n}=this,{data:o,type:a,frag:A,part:l,chunkMeta:c}=t,u=c.buffering[a],h=self.performance.now();u.start=h;const d=A.stats.buffering,g=l?l.stats.buffering:null;d.start===0&&(d.start=h),g&&g.start===0&&(g.start=h);const f=n.audio;let p=!1;a==="audio"&&(f==null?void 0:f.container)==="audio/mpeg"&&(p=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const v=A.start,y={execute:()=>{if(u.executeStart=self.performance.now(),p){const Q=this.sourceBuffer[a];if(Q){const m=v-Q.timestampOffset;Math.abs(m)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${v} (delta: ${m}) sn: ${A.sn})`),Q.timestampOffset=v)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const Q=self.performance.now();u.executeEnd=u.end=Q,d.first===0&&(d.first=Q),g&&g.first===0&&(g.first=Q);const{sourceBuffer:m}=this,b={};for(const x in m)b[x]=Ye.getBuffered(m[x]);this.appendErrors[a]=0,a==="audio"||a==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(E.BUFFER_APPENDED,{type:a,frag:A,part:l,chunkMeta:c,parent:A.type,timeRanges:b})},onError:Q=>{const m={type:Ee.MEDIA_ERROR,parent:A.type,details:$.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:A,part:l,chunkMeta:c,error:Q,err:Q,fatal:!1};if(Q.code===DOMException.QUOTA_EXCEEDED_ERR)m.details=$.BUFFER_FULL_ERROR;else{const b=++this.appendErrors[a];m.details=$.BUFFER_APPEND_ERROR,this.warn(`Failed ${b}/${i.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),b>=i.config.appendErrorMaxRetry&&(m.fatal=!0)}i.trigger(E.ERROR,m)}};r.append(y,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:i}=this,r=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(E.BUFFER_FLUSHED,{type:n})},onError:o=>{this.warn(`Failed to remove from ${n} SourceBuffer`,o)}});t.type?i.append(r(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{i.append(r(n),n)})}onFragParsed(e,t){const{frag:i,part:r}=t,n=[],o=r?r.elementaryStreams:i.elementaryStreams;o[Pe.AUDIOVIDEO]?n.push("audiovideo"):(o[Pe.AUDIO]&&n.push("audio"),o[Pe.VIDEO]&&n.push("video"));const a=()=>{const A=self.performance.now();i.stats.buffering.end=A,r&&(r.stats.buffering.end=A);const l=r?r.stats:i.stats;this.hls.trigger(E.FRAG_BUFFERED,{frag:i,part:r,stats:l,id:i.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(a,n)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((r,n)=>{const o=this.sourceBuffer[n];return o&&(!t.type||t.type===n)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${n} sourceBuffer now EOS`))),r&&!!(!o||o.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const o=this.sourceBuffer[n];o&&(o.ending=!1)});const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.getSourceBufferTypes().length)return;const n=e.config,o=i.currentTime,a=t.levelTargetDuration,A=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(oe(A)&&A>0){const l=Math.max(A,a),c=Math.floor(o/a)*a-l;this.flushBackBuffer(o,a,c)}if(oe(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const l=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),c=Math.max(l,a),u=Math.floor(o/a)*a+c;this.flushFrontBuffer(o,a,u)}}flushBackBuffer(e,t,i){const{details:r,sourceBuffer:n}=this;this.getSourceBufferTypes().forEach(a=>{const A=n[a];if(A){const l=Ye.getBuffered(A);if(l.length>0&&i>l.start(0)){if(this.hls.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:i}),r!=null&&r.live)this.hls.trigger(E.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(A.ended&&l.end(l.length-1)-e<t*2){this.log(`Cannot flush ${a} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:a})}}})}flushFrontBuffer(e,t,i){const{sourceBuffer:r}=this;this.getSourceBufferTypes().forEach(o=>{const a=r[o];if(a){const A=Ye.getBuffered(a),l=A.length;if(l<2)return;const c=A.start(l-1),u=A.end(l-1);if(i>c||e>=c&&e<=u)return;if(a.ended&&e-u<2*t){this.log(`Cannot flush ${o} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:o})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:i,mediaSource:r}=this,n=e.fragments[0].start+e.totalduration,o=i.duration,a=oe(r.duration)?r.duration:0;e.live&&t.config.liveDurationInfinity?(r.duration=1/0,this.updateSeekableRange(e)):(n>a&&n>o||!oe(o))&&(this.log(`Updating Media Source duration to ${n.toFixed(3)}`),r.duration=n)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,i[0].start),o=Math.max(n,n+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${n}-${o}.`),t.setLiveSeekableRange(n,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,r=Object.keys(i).length;if(r&&(!e||r===2||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(E.BUFFER_CREATED,{tracks:this.tracks}),n.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const n in e)if(!t[n]){var r;const o=e[n];if(!o)throw Error(`source buffer exists for track ${n}, however track does not`);let a=((r=o.levelCodec)==null?void 0:r.indexOf(","))===-1?o.levelCodec:o.codec;a&&n.slice(0,5)==="audio"&&(a=un(a,this.appendSource));const A=`${o.container};codecs=${a}`;this.log(`creating sourceBuffer(${A})`);try{const l=t[n]=i.addSourceBuffer(A),c=n;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(c,"bufferedchange",(u,h)=>{const d=h.removedRanges;d!=null&&d.length&&this.hls.trigger(E.BUFFER_FLUSHED,{type:n})}),this.tracks[n]={buffer:l,codec:a,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(l){this.error(`error while trying to add sourceBuffer: ${l.message}`),this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,sourceBufferName:n,mimeType:A})}}}get mediaSrc(){var e;const t=((e=this.media)==null?void 0:e.firstChild)||this.media;return t==null?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${r}`,t),this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const n=this.operationQueue.current(e);n&&n.onError(r)}removeExecutor(e,t,i){const{media:r,mediaSource:n,operationQueue:o,sourceBuffer:a}=this,A=a[e];if(!r||!n||!A){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const l=oe(r.duration)?r.duration:1/0,c=oe(n.duration)?n.duration:1/0,u=Math.max(0,t),h=Math.min(i,l,c);h>u&&(!A.ending||A.ended)?(A.ended=!1,this.log(`Removing [${u},${h}] from the ${e} SourceBuffer`),A.remove(u,h)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(!i){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}i.ended=!1,i.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:i}=this,r=t.map(n=>i.appendBlocker(n));Promise.all(r).then(()=>{e(),t.forEach(n=>{const o=this.sourceBuffer[n];o!=null&&o.updating||i.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const r=this.sourceBuffer[e];if(!r)return;const n=i.bind(this,e);this.listeners[e].push({event:t,listener:n}),r.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(i=>{t.removeEventListener(i.event,i.listener)})}}function Iu(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function BE(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}const QE={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},mu=s=>String.fromCharCode(QE[s]||s),Jt=15,bi=100,bE={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},SE={17:2,18:4,21:6,22:8,23:10,19:13,20:15},wE={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},RE={25:2,26:4,29:6,30:8,31:10,27:13,28:15},xE=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class TE{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;N.log(`${this.time} [${e}] ${i}`)}}}const Zi=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Cu{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const r=t[i];e.hasOwnProperty(r)&&(this[r]=e[r])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class DE{constructor(){this.uchar=" ",this.penState=new Cu}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class LE{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Cu,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<bi;t++)this.chars.push(new DE);this.logger=e}equals(e){for(let t=0;t<bi;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<bi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<bi;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>bi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=bi)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=mu(e);if(this.pos>=bi){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<bi;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<bi;i++){const r=this.chars[i].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Ca{constructor(e){this.rows=[],this.currRow=Jt-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Jt;t++)this.rows.push(new LE(e));this.logger=e}reset(){for(let e=0;e<Jt;e++)this.rows[e].clear();this.currRow=Jt-1}equals(e){let t=!0;for(let i=0;i<Jt;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Jt;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Jt;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let a=0;a<Jt;a++)this.rows[a].clear();const n=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[n].cueStartTime,A=this.logger.time;if(a!==null&&A!==null&&a<A)for(let l=0;l<this.nrRollUpRows;l++)this.rows[t-this.nrRollUpRows+l+1].copy(o.rows[n+l])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,o=Math.max(n-1,0);i.setCursor(e.indent),e.color=i.chars[o].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",r=-1;for(let n=0;n<Jt;n++){const o=this.rows[n].getTextString();o&&(r=n+1,e?t.push("Row "+r+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
175
+ `)),i}getTextAndFormat(){return this.rows}}class vu{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Ca(i),this.nonDisplayedMemory=new Ca(i),this.lastOutputScreen=new Ca(i),this.currRollUpRow=this.displayedMemory.rows[Jt-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Jt-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class yu{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=kE(),this.logger=void 0;const r=this.logger=new TE;this.channels=[null,new vu(e,t,r),new vu(e+1,i,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i<t.length;i+=2){const r=t[i]&127,n=t[i+1]&127;let o=!1,a=null;if(r===0&&n===0)continue;this.logger.log(3,()=>"["+Zi([t[i],t[i+1]])+"] -> ("+Zi([r,n])+")");const A=this.cmdHistory;if(r>=16&&r<=31){if(_E(r,n,A)){xn(null,null,A),this.logger.log(3,()=>"Repeated command ("+Zi([r,n])+") is dropped");continue}xn(r,n,this.cmdHistory),o=this.parseCmd(r,n),o||(o=this.parseMidrow(r,n)),o||(o=this.parsePAC(r,n)),o||(o=this.parseBackgroundAttributes(r,n))}else xn(null,null,A);if(!o&&(a=this.parseChars(r,n),a)){const c=this.currentChannel;c&&c>0?this.channels[c].insertChars(a):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!o&&!a&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Zi([r,n])+" orig: "+Zi([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=33&&t<=35;if(!(i||r))return!1;const n=e===20||e===21||e===23?1:2,o=this.channels[n];return e===20||e===21||e===28||e===29?t===32?o.ccRCL():t===33?o.ccBS():t===34?o.ccAOF():t===35?o.ccAON():t===36?o.ccDER():t===37?o.ccRU(2):t===38?o.ccRU(3):t===39?o.ccRU(4):t===40?o.ccFON():t===41?o.ccRDC():t===42?o.ccTR():t===43?o.ccRTD():t===44?o.ccEDM():t===45?o.ccCR():t===46?o.ccENM():t===47&&o.ccEOC():o.ccTO(t-32),this.currentChannel=n,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[i];return r?(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Zi([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(e===16||e===24)&&t>=64&&t<=95;if(!(r||n))return!1;const o=e<=23?1:2;t>=64&&t<=95?i=o===1?bE[e]:wE[e]:i=o===1?SE[e]:RE[e];const a=this.channels[o];return a?(a.setPAC(this.interpretPAC(i,t)),this.currentChannel=o,!0):!1}interpretPAC(e,t){let i;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,r.underline=(i&1)===1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((i-16)/2)*4,r}parseChars(e,t){let i,r=null,n=null;if(e>=25?(i=2,n=e-8):(i=1,n=e),n>=17&&n<=19){let o;n===17?o=t+80:n===18?o=t+112:o=t+144,this.logger.log(2,()=>"Special char '"+mu(o)+"' in channel "+i),r=[o]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes = "+Zi(r).join(",")),r}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(i||r))return!1;let n;const o={};e===16||e===24?(n=Math.floor((t-32)/2),o.background=xE[n],t%2===1&&(o.background=o.background+"_semi")):t===45?o.background="transparent":(o.foreground="black",t===47&&(o.underline=!0));const a=e<=23?1:2;return this.channels[a].setBkgData(o),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}xn(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function xn(s,e,t){t.a=s,t.b=e}function _E(s,e,t){return t.a===s&&t.b===e}function kE(){return{a:null,b:null}}class Tn{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var va=function(){if(fs!=null&&fs.VTTCue)return self.VTTCue;const s=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,A){if(typeof A!="string"||!Array.isArray(a))return!1;const l=A.toLowerCase();return~a.indexOf(l)?l:!1}function i(a){return t(s,a)}function r(a){return t(e,a)}function n(a,...A){let l=1;for(;l<arguments.length;l++){const c=arguments[l];for(const u in c)a[u]=c[u]}return a}function o(a,A,l){const c=this,u={enumerable:!0};c.hasBeenReset=!1;let h="",d=!1,g=a,f=A,p=l,v=null,y="",Q=!0,m="auto",b="start",x=50,B="middle",H=50,_="middle";Object.defineProperty(c,"id",n({},u,{get:function(){return h},set:function(k){h=""+k}})),Object.defineProperty(c,"pauseOnExit",n({},u,{get:function(){return d},set:function(k){d=!!k}})),Object.defineProperty(c,"startTime",n({},u,{get:function(){return g},set:function(k){if(typeof k!="number")throw new TypeError("Start time must be set to a number.");g=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",n({},u,{get:function(){return f},set:function(k){if(typeof k!="number")throw new TypeError("End time must be set to a number.");f=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",n({},u,{get:function(){return p},set:function(k){p=""+k,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",n({},u,{get:function(){return v},set:function(k){v=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",n({},u,{get:function(){return y},set:function(k){const U=i(k);if(U===!1)throw new SyntaxError("An invalid or illegal string was specified.");y=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",n({},u,{get:function(){return Q},set:function(k){Q=!!k,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",n({},u,{get:function(){return m},set:function(k){if(typeof k!="number"&&k!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");m=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",n({},u,{get:function(){return b},set:function(k){const U=r(k);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");b=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",n({},u,{get:function(){return x},set:function(k){if(k<0||k>100)throw new Error("Position must be between 0 and 100.");x=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",n({},u,{get:function(){return B},set:function(k){const U=r(k);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");B=U,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",n({},u,{get:function(){return H},set:function(k){if(k<0||k>100)throw new Error("Size must be between 0 and 100.");H=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",n({},u,{get:function(){return _},set:function(k){const U=r(k);if(!U)throw new SyntaxError("An invalid or illegal string was specified.");_=U,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class FE{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Bu(s){function e(i,r,n,o){return(i|0)*3600+(r|0)*60+(n|0)+parseFloat(o||0)}const t=s.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class NE{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function Qu(s,e,t,i){const r=i?s.split(i):[s];for(const n in r){if(typeof r[n]!="string")continue;const o=r[n].split(t);if(o.length!==2)continue;const a=o[0],A=o[1];e(a,A)}}const ya=new va(0,0,""),Dn=ya.align==="middle"?"middle":"center";function ME(s,e,t){const i=s;function r(){const a=Bu(s);if(a===null)throw new Error("Malformed timestamp: "+i);return s=s.replace(/^[^\sa-zA-Z-]+/,""),a}function n(a,A){const l=new NE;Qu(a,function(h,d){let g;switch(h){case"region":for(let f=t.length-1;f>=0;f--)if(t[f].id===d){l.set(h,t[f].region);break}break;case"vertical":l.alt(h,d,["rl","lr"]);break;case"line":g=d.split(","),l.integer(h,g[0]),l.percent(h,g[0])&&l.set("snapToLines",!1),l.alt(h,g[0],["auto"]),g.length===2&&l.alt("lineAlign",g[1],["start",Dn,"end"]);break;case"position":g=d.split(","),l.percent(h,g[0]),g.length===2&&l.alt("positionAlign",g[1],["start",Dn,"end","line-left","line-right","auto"]);break;case"size":l.percent(h,d);break;case"align":l.alt(h,d,["start",Dn,"end","left","right"]);break}},/:/,/\s/),A.region=l.get("region",null),A.vertical=l.get("vertical","");let c=l.get("line","auto");c==="auto"&&ya.line===-1&&(c=-1),A.line=c,A.lineAlign=l.get("lineAlign","start"),A.snapToLines=l.get("snapToLines",!0),A.size=l.get("size",100),A.align=l.get("align",Dn);let u=l.get("position","auto");u==="auto"&&ya.position===50&&(u=A.align==="start"||A.align==="left"?0:A.align==="end"||A.align==="right"?100:50),A.position=u}function o(){s=s.replace(/^\s+/,"")}if(o(),e.startTime=r(),o(),s.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);s=s.slice(3),o(),e.endTime=r(),o(),n(s,e)}function bu(s){return s.replace(/<br(?: \/)?>/gi,`
176
+ `)}class PE{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new FE,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let n=t.buffer,o=0;for(n=bu(n);o<n.length&&n[o]!=="\r"&&n[o]!==`
173
177
  `;)++o;const a=n.slice(0,o);return n[o]==="\r"&&++o,n[o]===`
174
- `&&++o,t.buffer=n.slice(o),a}function r(n){uh(n,function(o,a){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=i();const a=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(a!=null&&a[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let o=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(o?o=!1:n=i(),t.state){case"HEADER":/:/.test(n)?r(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new ra(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{cp(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=n.indexOf("-->")!==-1;if(!n||a&&(o=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
178
+ `&&++o,t.buffer=n.slice(o),a}function r(n){Qu(n,function(o,a){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=i();const a=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(a!=null&&a[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let o=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(o?o=!1:n=i(),t.state){case"HEADER":/:/.test(n)?r(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new va(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{ME(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=n.indexOf("-->")!==-1;if(!n||a&&(o=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
175
179
  `),t.cue.text+=n}continue;case"BADCUE":n||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
176
180
 
177
- `,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const up=/\r\n|\n\r|\n|\r/g,oa=function(e,t,i=0){return e.slice(i,i+t.length)===t},dp=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!Ae(t)||!Ae(i)||!Ae(r)||!Ae(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*r,t+=60*60*1e3*n,t},aa=function(e){let t=5381,i=e.length;for(;i;)t=t*33^e.charCodeAt(--i);return(t>>>0).toString()};function Aa(s,e,t){return aa(s.toString())+aa(e.toString())+aa(t)}const gp=function(e,t,i){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(o=n)!=null&&o.new;){var o;e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=i};function fp(s,e,t,i,r,n,o){const a=new hp,A=Zt(new Uint8Array(s)).trim().replace(up,`
181
+ `,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const OE=/\r\n|\n\r|\n|\r/g,Ba=function(e,t,i=0){return e.slice(i,i+t.length)===t},UE=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!oe(t)||!oe(i)||!oe(r)||!oe(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*r,t+=60*60*1e3*n,t},Qa=function(e){let t=5381,i=e.length;for(;i;)t=t*33^e.charCodeAt(--i);return(t>>>0).toString()};function ba(s,e,t){return Qa(s.toString())+Qa(e.toString())+Qa(t)}const GE=function(e,t,i){let r=e[t],n=e[r.prevCC];if(!n||!n.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(o=n)!=null&&o.new;){var o;e.ccOffset+=r.start-n.start,r.new=!1,r=n,n=e[r.prevCC]}e.presentationOffset=i};function HE(s,e,t,i,r,n,o){const a=new PE,A=ei(new Uint8Array(s)).trim().replace(OE,`
178
182
  `).split(`
179
- `),l=[],c=e?_E(e.baseTime,e.timescale):0;let h="00:00.000",u=0,d=0,g,f=!0;a.oncue=function(E){const B=t[i];let S=t.ccOffset;const Q=(u-c)/9e4;if(B!=null&&B.new&&(d!==void 0?S=t.ccOffset=B.start:gp(t,i,Q)),Q){if(!e){g=new Error("Missing initPTS for VTT MPEGTS");return}S=Q-t.presentationOffset}const m=E.endTime-E.startTime,y=_t((E.startTime+S-d)*9e4,r*9e4)/9e4;E.startTime=Math.max(y,0),E.endTime=Math.max(y+m,0);const L=E.text.trim();E.text=decodeURIComponent(encodeURIComponent(L)),E.id||(E.id=Aa(E.startTime,E.endTime,L)),E.endTime>0&&l.push(E)},a.onparsingerror=function(E){g=E},a.onflush=function(){if(g){o(g);return}n(l)},A.forEach(E=>{if(f)if(oa(E,"X-TIMESTAMP-MAP=")){f=!1,E.slice(16).split(",").forEach(B=>{oa(B,"LOCAL:")?h=B.slice(6):oa(B,"MPEGTS:")&&(u=parseInt(B.slice(7)))});try{d=dp(h)/1e3}catch(B){g=B}return}else E===""&&(f=!1);a.parse(E+`
180
- `)}),a.flush()}const la="stpp.ttml.im1t",gh=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,fh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Ep={left:"start",center:"center",right:"end",start:"start",end:"end"};function Eh(s,e,t,i){const r=me(new Uint8Array(s),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(a=>Zt(a)),o=ME(e.baseTime,1,e.timescale);try{n.forEach(a=>t(pp(a,o)))}catch(a){i(a)}}function pp(s,e){const r=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(n).reduce((h,u)=>(h[u]=r.getAttribute(`ttp:${u}`)||n[u],h),{}),a=r.getAttribute("xml:space")!=="preserve",A=ph(ca(r,"styling","style")),l=ph(ca(r,"layout","region")),c=ca(r,"body","[begin]");return[].map.call(c,h=>{const u=Ih(h,a);if(!u||!h.hasAttribute("begin"))return null;const d=ua(h.getAttribute("begin"),o),g=ua(h.getAttribute("dur"),o);let f=ua(h.getAttribute("end"),o);if(d===null)throw Ch(h);if(f===null){if(g===null)throw Ch(h);f=d+g}const E=new ra(d-e,f-e,u);E.id=Aa(E.startTime,E.endTime,E.text);const B=l[h.getAttribute("region")],S=A[h.getAttribute("style")],Q=Ip(B,S,A),{textAlign:m}=Q;if(m){const y=Ep[m];y&&(E.lineAlign=y),E.align=m}return Ze(E,Q),E}).filter(h=>h!==null)}function ca(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function ph(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Ih(s,e){return[].slice.call(s.childNodes).reduce((t,i,r)=>{var n;return i.nodeName==="br"&&r?t+`
181
- `:(n=i.childNodes)!=null&&n.length?Ih(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function Ip(s,e,t){const i="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(r=t[o]),n.reduce((a,A)=>{const l=ha(e,i,A)||ha(s,i,A)||ha(r,i,A);return l&&(a[A]=l),a},{})}function ha(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function Ch(s){return new Error(`Could not parse ttml timestamp ${s}`)}function ua(s,e){if(!s)return null;let t=hh(s);return t===null&&(gh.test(s)?t=Cp(s,e):fh.test(s)&&(t=mp(s,e))),t}function Cp(s,e){const t=gh.exec(s),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function mp(s,e){const t=fh.exec(s),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class Bp{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=yh(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new fn(this,"textTrack1"),t=new fn(this,"textTrack2"),i=new fn(this,"textTrack3"),r=new fn(this,"textTrack4");this.cea608Parser1=new Ah(1,e,t),this.cea608Parser2=new Ah(3,i,r)}}addCues(e,t,i,r,n){let o=!1;for(let a=n.length;a--;){const A=n[a],l=yp(A[0],A[1],t,i);if(l>=0&&(A[0]=Math.min(A[0],t),A[1]=Math.max(A[1],i),o=!0,l/(i-t)>.5))return}if(o||n.push([t,i]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,i,r)}else{const a=this.Cues.newCue(null,t,i,r);this.hls.trigger(p.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){const{unparsedVttFrags:o}=this;i==="main"&&(this.initPTS[t.cc]={baseTime:r,timescale:n}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(p.FRAG_LOADED,a)}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let r=0;r<i.textTracks.length;r++){const n=i.textTracks[r];if(Bh(n,{name:e,lang:t,attrs:{}}))return n}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:r}=this,{label:n,languageCode:o}=t[e],a=this.getExistingTrack(n,o);if(a)i[e]=a,gs(i[e]),lc(i[e],r);else{const A=this.createTextTrack("captions",n,o);A&&(A[e]=!0,i[e]=A)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,r={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,i){const r=this.media;if(r)return r.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{gs(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=yh(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)gs(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===la);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(zc(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const o=this.media,a=o?zr(o.textTracks):null;if(this.tracks.forEach((A,l)=>{let c;if(a){let h=null;for(let u=0;u<a.length;u++)if(a[u]&&Bh(a[u],A)){h=a[u],a[u]=null;break}h&&(c=h)}if(c)gs(c);else{const h=mh(A);c=this.createTextTrack(h,A.name,A.lang),c&&(c.mode="disabled")}c&&this.textTracks.push(c)}),a!=null&&a.length){const A=a.filter(l=>l!==null).map(l=>l.label);A.length&&_.warn(`Media element contains unused subtitle tracks: ${A.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const r=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!r)return;const n=`textTrack${r[1]}`,o=this.captionsProperties[n];o&&(o.label=i.name,i.lang&&(o.languageCode=i.lang),o.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:r,lastCc:n,lastSn:o,lastPartIndex:a}=this;if(!(!this.enabled||!i||!r)&&t.frag.type===Ee.MAIN){var A,l;const{cc:c,sn:h}=t.frag,u=(A=t==null||(l=t.part)==null?void 0:l.index)!=null?A:-1;h===o+1||h===o&&u===a+1||c===n||(i.reset(),r.reset()),this.lastCc=c,this.lastSn=h,this.lastPartIndex=u}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===Ee.SUBTITLE)if(r.byteLength){const n=i.decryptdata,o="stats"in t;if(n==null||!n.encrypted||o){const a=this.tracks[i.level],A=this.vttCCs;A[i.cc]||(A[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),a&&a.textCodec===la?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Eh(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),i.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{_.log(`Failed to parse IMSC1: ${r}`),i.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:i,payload:r}=e,{initPTS:n,unparsedVttFrags:o}=this,a=n.length-1;if(!n[i.cc]&&a===-1){o.push(e);return}const A=this.hls,l=(t=i.initSegment)!=null&&t.data?Mt(i.initSegment.data,new Uint8Array(r)):r;fp(l,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,c=>{this._appendCues(c,i.level),A.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},c=>{const h=c.message==="Missing initPTS for VTT MPEGTS";h?o.push(e):this._fallbackToIMSC1(i,r),_.log(`Failed to parse VTT cue: ${c}`),!(h&&a>i.cc)&&A.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:c})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Eh(t,this.initPTS[e.cc],()=>{i.textCodec=la,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>cc(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;i.trigger(p.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===Ee.SUBTITLE&&this.onFragLoaded(p.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:r}=this;if(!this.enabled||!i||!r)return;const{frag:n,samples:o}=t;if(!(n.type===Ee.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let a=0;a<o.length;a++){const A=o[a].bytes;if(A){const l=this.extractCea608Data(A);i.addData(o[a].pts,l[0]),r.addData(o[a].pts,l[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:n}){const{media:o}=this;if(!(!o||o.currentTime<i)){if(!n||n==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(A=>_o(a[A],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(A=>_o(a[A],t,r))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let r=2;for(let n=0;n<i;n++){const o=e[r++],a=127&e[r++],A=127&e[r++];if(a===0&&A===0)continue;if((4&o)!==0){const c=3&o;(c===0||c===1)&&(t[c].push(a),t[c].push(A))}}return t}}function mh(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function Bh(s,e){return!!s&&s.kind===mh(e)&&ia(e,s)}function yp(s,e,t,i){return Math.min(e,i)-Math.max(s,t)}function yh(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class da{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&Ae(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&_.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,da.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const r=(a,A)=>A?a.width!==A.width||a.height!==A.height:!0;let n=e.length-1;const o=Math.max(t,i);for(let a=0;a<e.length;a+=1){const A=e[a];if((A.width>=o||A.height>=o)&&r(A,e[a+1])){n=a;break}}return n}}class Qp{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,o=i-this.lastDroppedFrames,a=t-this.lastDecodedFrames,A=1e3*o/n,l=this.hls;if(l.trigger(p.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:i}),A>0&&o>l.config.fpsDroppedMonitoringThreshold*a){let c=l.currentLevel;_.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=c)&&(c=c-1,l.trigger(p.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:l.currentLevel}),l.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}const pn="[eme]";class vs{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=vs.CDMCleanupPromise?[vs.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=_.debug.bind(_,pn),this.log=_.log.bind(_,pn),this.warn=_.warn.bind(_,pn),this.error=_.error.bind(_,pn),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===He.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(o,a,A)=>!!o&&A.indexOf(o)===a,r=t.map(o=>o.audioCodec).filter(i),n=t.map(o=>o.videoCodec).filter(i);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((o,a)=>{const A=l=>{const c=l.shift();this.getMediaKeysPromise(c,r,n).then(h=>o({keySystem:c,mediaKeys:h})).catch(h=>{l.length?A(l):h instanceof Ft?a(h):a(new Ft({type:Ie.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_ACCESS,error:h,fatal:!0},h.message))})};A(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${i}`;return Ml===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return i(e,t)}getMediaKeysPromise(e,t,i){const r=Mf(e,t,i,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let o=n==null?void 0:n.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(r)}`),o=this.requestMediaKeySystemAccess(e,r);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(A=>{this.log(`Failed to obtain access to key-system "${e}": ${A}`)}),o.then(A=>{this.log(`Access for key-system "${A.keySystem}" obtained`);const l=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=A.createMediaKeys().then(c=>(this.log(`Media-keys created for "${e}"`),l.then(h=>h?this.setMediaKeysServerCertificate(c,e,h):c))),a.mediaKeys.catch(c=>{this.error(`Failed to create media-keys for "${e}"}: ${c}`)}),a.mediaKeys})}return o.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${zt.hexDump(e.keyId||[])}`);const r=i.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,n,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return zt.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${zt.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
182
- } (data length: ${t&&t.byteLength})`),r.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,i)=>{const r=wo(this.config),n=e.map(Tl).filter(o=>!!o&&r.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:o})=>{const a=kl(o);a?t(a):i(new Error(`Unable to find format for key-system "${o}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let n=this.keyIdToKeySessionPromise[i];return n||(n=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:a})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const A=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t});return this.generateRequestWithPreferredKeySession(A,"cenc",t.pssh,"playlist-key")}))),n.catch(o=>this.handleError(o))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Ft?this.hls.trigger(p.ERROR,e.data):this.hls.trigger(p.ERROR,{type:Ie.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=Tl(e.keyFormat),n=r?[r]:wo(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=wo(this.config)),e.length===0)throw new Ft({type:Ie.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),i===null)return;let r,n;if(t==="sinf"&&this.config.drmSystems[He.FAIRPLAY]){const c=rt(new Uint8Array(i));try{const h=Qo(JSON.parse(c).sinf),u=$l(new Uint8Array(h));if(!u)return;r=u.subarray(8,24),n=He.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=n0(i);if(c===null)return;c.version===0&&c.systemId===Ll.WIDEVINE&&c.data&&(r=c.data.subarray(8,24)),n=kf(c.systemId)}if(!n||!r)return;const o=zt.hexDump(r),{keyIdToKeySessionPromise:a,mediaKeySessions:A}=this;let l=a[o];for(let c=0;c<A.length;c++){const h=A[c],u=h.decryptdata;if(u.pssh||!u.keyId)continue;const d=zt.hexDump(u.keyId);if(o===d||u.uri.replace(/-/g,"").indexOf(o)!==-1){l=a[d],delete a[d],u.pssh=new Uint8Array(i),u.keyId=r,l=a[o]=l.then(()=>this.generateRequestWithPreferredKeySession(h,t,i,"encrypted-event-key-match"));break}}l||(l=a[o]=this.getKeySystemSelectionPromise([n]).then(({keySystem:c,mediaKeys:h})=>{var u;this.throwIfDestroyed();const d=new ir("ISO-23001-7",o,(u=kl(c))!=null?u:"");return d.pssh=new Uint8Array(i),d.keyId=r,this.attemptSetMediaKeys(c,h).then(()=>{this.throwIfDestroyed();const g=this.createMediaKeySessionContext({decryptdata:d,keySystem:c,mediaKeys:h});return this.generateRequestWithPreferredKeySession(g,t,i,"encrypted-event-no-match")})})),l.catch(c=>this.handleError(c))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>i.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,i,r){var n,o;const a=(n=this.config.drmSystems)==null||(o=n[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const g=a.call(this.hls,t,i,e);if(!g)throw new Error("Invalid response from configured generateRequest filter");t=g.initDataType,i=e.decryptdata.pssh=g.initData?new Uint8Array(g.initData):null}catch(g){var A;if(this.warn(g.message),(A=this.hls)!=null&&A.config.debug)throw g}if(i===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const c=new ta,h=e._onmessage=g=>{const f=e.mediaKeysSession;if(!f){c.emit("error",new Error("invalid state"));return}const{messageType:E,message:B}=g;this.log(`"${E}" message event for session "${f.sessionId}" message size: ${B.byteLength}`),E==="license-request"||E==="license-renewal"?this.renewLicense(e,B).catch(S=>{this.handleError(S),c.emit("error",S)}):E==="license-release"?e.keySystem===He.FAIRPLAY&&(this.updateKeySession(e,vo("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${E}"`)},u=e._onkeystatuseschange=g=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const E=e.keyStatus;c.emit("keyStatus",E),E==="expired"&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",h),e.mediaKeysSession.addEventListener("keystatuseschange",u);const d=new Promise((g,f)=>{c.on("error",f),c.on("keyStatus",E=>{E.startsWith("usable")?g():E==="output-restricted"?f(new Ft({type:Ie.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):E==="internal-error"?f(new Ft({type:Ie.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${E}"`)):E==="expired"?f(new Error("key expired while generating request")):this.warn(`unhandled key status change "${E}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var g;this.log(`Request generated for key-session "${(g=e.mediaKeysSession)==null?void 0:g.sessionId}" keyId: ${l}`)}).catch(g=>{throw new Ft({type:Ie.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_SESSION,error:g,fatal:!1},`Error generating key-session request: ${g}`)}).then(()=>d).catch(g=>{throw c.removeAllListeners(),this.removeSession(e),g}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${zt.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${zt.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,r=new i(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const A={responseType:"arraybuffer",url:n},l=t.certLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(u,d,g,f)=>{o(u.data)},onError:(u,d,g,f)=>{a(new Ft({type:Ie.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:At({url:A.url,data:void 0},u)},`"${e}" certificate request failed (${n}). Status: ${u.code} (${u.text})`))},onTimeout:(u,d,g)=>{a(new Ft({type:Ie.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:{url:A.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(u,d,g)=>{a(new Error("aborted"))}};r.load(A,c,h)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,n)=>{e.setServerCertificate(i).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),r(e)}).catch(o=>{n(new Ft({type:Ie.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(r=>{throw new Ft({type:Ie.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},r.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(i,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let c;for(let h=0,u=n.length;h<u;h++){var o,a;c=n[h];const d=(o=c.querySelector("name"))==null?void 0:o.textContent,g=(a=c.querySelector("value"))==null?void 0:a.textContent;d&&g&&e.setRequestHeader(d,g)}}const A=r.querySelector("Challenge"),l=A==null?void 0:A.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return vo(atob(l))}setupLicenseXHR(e,t,i,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,r)}).catch(o=>{if(!i.decryptdata)throw o;return e.open("POST",t,!0),n.call(this.hls,e,t,i,r)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const o=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let A=a.response;this.log(`License received ${A instanceof ArrayBuffer?A.byteLength:A}`);const l=this.config.licenseResponseCallback;if(l)try{A=l.call(this.hls,a,o,e)}catch(c){this.error(c)}r(A)}else{const A=i.errorRetry,l=A?A.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)n(new Ft({type:Ie.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const c=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:A,licenseChallenge:l})=>{e.keySystem==He.PLAYREADY&&(l=this.unpackPlayReadyKeyMessage(A,l)),A.send(l)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},ir.clearKeyUriToKeyIdMap();const i=t.length;vs.CDMCleanupPromise=Promise.all(t.map(r=>this.removeSession(r)).concat(e==null?void 0:e.setMediaKeys(null).catch(r=>{this.log(`Could not clear media keys: ${r}`)}))).then(()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(r=>{this.log(`Could not close sessions and clear media keys: ${r}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}vs.CDMCleanupPromise=void 0;class Ft extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var It;(function(s){s.MANIFEST="m",s.AUDIO="a",s.VIDEO="v",s.MUXED="av",s.INIT="i",s.CAPTION="c",s.TIMED_TEXT="tt",s.KEY="k",s.OTHER="o"})(It||(It={}));var ga;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(ga||(ga={}));var qi;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(qi||(qi={}));const vp={[qi.OBJECT]:["br","d","ot","tb"],[qi.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[qi.SESSION]:["cid","pr","sf","sid","st","v"],[qi.STATUS]:["bs","rtp"]};class ws{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(i=>i instanceof ws?i:new ws(i))),this.value=e,this.params=t}}class Qh{constructor(e){this.description=void 0,this.description=e}}const wp="Dict";function Sp(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function Dp(s,e,t,i){return new Error(`failed to ${s} "${Sp(e)}" as ${t}`,{cause:i})}const vh="Bare Item",bp="Boolean",Rp="Byte Sequence",xp="Decimal",Tp="Integer";function Lp(s){return s<-999999999999999||999999999999999<s}const kp=/[\x00-\x1f\x7f]+/,Mp="Token",_p="Key";function ri(s,e,t){return Dp("serialize",s,e,t)}function Fp(s){if(typeof s!="boolean")throw ri(s,bp);return s?"?1":"?0"}function Op(s){return btoa(String.fromCharCode(...s))}function Np(s){if(ArrayBuffer.isView(s)===!1)throw ri(s,Rp);return`:${Op(s)}:`}function wh(s){if(Lp(s))throw ri(s,Tp);return s.toString()}function Up(s){return`@${wh(s.getTime()/1e3)}`}function Sh(s,e){if(s<0)return-Sh(-s,e);const t=Math.pow(10,e);if(Math.abs(s*t%1-.5)<Number.EPSILON){const r=Math.floor(s*t);return(r%2===0?r:r+1)/t}else return Math.round(s*t)/t}function Pp(s){const e=Sh(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ri(s,xp);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Gp="String";function Hp(s){if(kp.test(s))throw ri(s,Gp);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function $p(s){return s.description||s.toString().slice(7,-1)}function Dh(s){const e=$p(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ri(e,Mp);return e}function fa(s){switch(typeof s){case"number":if(!Ae(s))throw ri(s,vh);return Number.isInteger(s)?wh(s):Pp(s);case"string":return Hp(s);case"symbol":return Dh(s);case"boolean":return Fp(s);case"object":if(s instanceof Date)return Up(s);if(s instanceof Uint8Array)return Np(s);if(s instanceof Qh)return Dh(s);default:throw ri(s,vh)}}function Ea(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw ri(s,_p);return s}function pa(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${Ea(e)}`:`;${Ea(e)}=${fa(t)}`).join("")}function bh(s){return s instanceof ws?`${fa(s.value)}${pa(s.params)}`:fa(s)}function Kp(s){return`(${s.value.map(bh).join(" ")})${pa(s.params)}`}function Yp(s,e={whitespace:!0}){if(typeof s!="object")throw ri(s,wp);const t=s instanceof Map?s.entries():Object.entries(s),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof ws||(n=new ws(n));let o=Ea(r);return n.value===!0?o+=pa(n.params):(o+="=",Array.isArray(n.value)?o+=Kp(n):o+=bh(n)),o}).join(`,${i}`)}function Vp(s,e){return Yp(s,e)}const Jp=s=>s==="ot"||s==="sf"||s==="st",Wp=s=>typeof s=="number"?Ae(s):s!=null&&s!==""&&s!==!1;function qp(s,e){const t=new URL(s),i=new URL(e);if(t.origin!==i.origin)return s;const r=t.pathname.split("/").slice(1),n=i.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")}function jp(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?n:n&3|8).toString(16)})}}}const In=s=>Math.round(s),Xp=(s,e)=>(e!=null&&e.baseUrl&&(s=qp(s,e.baseUrl)),encodeURIComponent(s)),Cn=s=>In(s/100)*100,Zp={br:In,d:In,bl:Cn,dl:Cn,mtp:Cn,nor:Xp,rtp:Cn,tb:In};function zp(s,e){const t={};if(s==null||typeof s!="object")return t;const i=Object.keys(s).sort(),r=Ze({},Zp,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;return i.forEach(o=>{if(n!=null&&n(o))return;let a=s[o];const A=r[o];A&&(a=A(a,e)),!(o==="v"&&a===1)&&(o=="pr"&&a===1||Wp(a)&&(Jp(o)&&typeof a=="string"&&(a=new Qh(a)),t[o]=a))}),t}function Rh(s,e={}){return s?Vp(zp(s,e),Ze({whitespace:!1},e)):""}function eI(s,e={}){if(!s)return{};const t=Object.entries(s),i=Object.entries(vp).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),r=t.reduce((n,o)=>{var a,A;const[l,c]=o,h=((a=i.find(u=>u[1].includes(l)))==null?void 0:a[0])||qi.REQUEST;return(A=n[h])!=null||(n[h]={}),n[h][l]=c,n},{});return Object.entries(r).reduce((n,[o,a])=>(n[o]=Rh(a,e),n),{})}function tI(s,e,t){return Ze(s,eI(e,t))}const iI="CMCD";function sI(s,e={}){if(!s)return"";const t=Rh(s,e);return`${iI}=${encodeURIComponent(t)}`}const xh=/CMCD=[^&#]+/;function rI(s,e,t){const i=sI(e,t);if(!i)return s;if(xh.test(s))return s.replace(xh,i);const r=s.includes("?")?"&":"?";return`${s}${r}${i}`}class nI{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=r=>{try{this.apply(r,{ot:It.MANIFEST,su:!this.initialized})}catch(n){_.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const n=r.frag,o=this.hls.levels[n.level],a=this.getObjectType(n),A={d:n.duration*1e3,ot:a};(a===It.VIDEO||a===It.AUDIO||a==It.MUXED)&&(A.br=o.bitrate/1e3,A.tb=this.getTopBandwidth(a)/1e3,A.bl=this.getBufferLength(a)),this.apply(r,A)}catch(n){_.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||jp(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHED,this.onMediaDetached,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHED,this.onMediaDetached,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:ga.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Ze(t,this.createData());const i=t.ot===It.INIT||t.ot===It.VIDEO||t.ot===It.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((n,o)=>(r.includes(o)&&(n[o]=t[o]),n),{})),this.useHeaders?(e.headers||(e.headers={}),tI(e.headers,t)):e.url=rI(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return It.TIMED_TEXT;if(e.sn==="initSegment")return It.INIT;if(t==="audio")return It.AUDIO;if(t==="main")return this.hls.audioTracks.length?It.VIDEO:It.MUXED}getTopBandwidth(e){let t=0,i;const r=this.hls;if(e===It.AUDIO)i=r.audioTracks;else{const n=r.maxAutoLevel,o=n>-1?n+1:r.levels.length;i=r.levels.slice(0,o)}for(const n of i)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,i=e===It.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Pe.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}}const oI=3e5;class aI{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=_.log.bind(_,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===pt.SendAlternateToPenaltyBox&&i.flags===$t.MoveAllAlternatesMatchingHost){const r=this.levels;let n=this.pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:A,type:l}=t.context;a&&r?o=this.getPathwayForGroupId(a,l,o):A&&(o=A)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!n&&r&&(n=r.reduce((a,A)=>(a.indexOf(A.pathwayId)===-1&&a.push(A.pathwayId),a),[])),n&&n.length>1&&(this.updatePathwayPriority(n),i.resolved=this.pathwayId!==o),i.resolved||_.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${r&&r.length} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(n=>{r-i[n]>oI&&delete i[n]});for(let n=0;n<e.length;n++){const o=e[n];if(o in i)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,A=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,Ic(t),this.hls.trigger(p.LEVELS_UPDATED,{levels:t});const l=this.hls.levels[a];A&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==A.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==A.bitrate&&this.log(`Unstable Pathways change from bitrate ${A.bitrate} to ${l.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,i){const r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===be.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===be.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},r={};e.forEach(n=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":A}=n;if(t.some(c=>c.pathwayId===o))return;const l=this.getLevelsForPathway(a).map(c=>{const h=new Ve(c.attrs);h["PATHWAY-ID"]=o;const u=h.AUDIO&&`${h.AUDIO}_clone_${o}`,d=h.SUBTITLES&&`${h.SUBTITLES}_clone_${o}`;u&&(i[h.AUDIO]=u,h.AUDIO=u),d&&(r[h.SUBTITLES]=d,h.SUBTITLES=d);const g=Lh(c.uri,h["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",A),f=new fs({attrs:h,audioCodec:c.audioCodec,bitrate:c.bitrate,height:c.height,name:c.name,url:g,videoCodec:c.videoCodec,width:c.width});if(c.audioGroups)for(let E=1;E<c.audioGroups.length;E++)f.addGroupId("audio",`${c.audioGroups[E]}_clone_${o}`);if(c.subtitleGroups)for(let E=1;E<c.subtitleGroups.length;E++)f.addGroupId("text",`${c.subtitleGroups[E]}_clone_${o}`);return f});t.push(...l),Th(this.audioTracks,i,A,o),Th(this.subtitleTracks,r,A,o)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+c)}const n={responseType:"json",url:r.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},A={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(c,h,u,d)=>{this.log(`Loaded steering manifest: "${r}"`);const g=c.data;if(g.VERSION!==1){this.log(`Steering VERSION ${g.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=g.TTL;const{"RELOAD-URI":f,"PATHWAY-CLONES":E,"PATHWAY-PRIORITY":B}=g;if(f)try{this.uri=new self.URL(f,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${f}`);return}this.scheduleRefresh(this.uri||u.url),E&&this.clonePathways(E);const S={steeringManifest:g,url:r.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,S),B&&this.updatePathwayPriority(B)},onError:(c,h,u,d)=>{if(this.log(`Error loading steering manifest: ${c.code} ${c.text} (${h.url})`),this.stopLoad(),c.code===410){this.enabled=!1,this.log(`Steering manifest ${h.url} no longer available`);return}let g=this.timeToLoad*1e3;if(c.code===429){const f=this.loader;if(typeof(f==null?void 0:f.getResponseHeader)=="function"){const E=f.getResponseHeader("Retry-After");E&&(g=parseFloat(E)*1e3)}this.log(`Steering manifest ${h.url} rate limited`);return}this.scheduleRefresh(this.uri||h.url,g)},onTimeout:(c,h,u)=>{this.log(`Timeout loading steering manifest (${h.url})`),this.scheduleRefresh(this.uri||h.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,A,l)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const r=(i=this.hls)==null?void 0:i.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Th(s,e,t,i){s&&Object.keys(e).forEach(r=>{const n=s.filter(o=>o.groupId===r).map(o=>{const a=Ze({},o);return a.details=void 0,a.attrs=new Ve(a.attrs),a.url=a.attrs.URI=Lh(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[r],a.attrs["PATHWAY-ID"]=i,a});s.push(...n)})}function Lh(s,e,t,i){const{HOST:r,PARAMS:n,[t]:o}=i;let a;e&&(a=o==null?void 0:o[e],a&&(s=a));const A=new self.URL(s);return r&&!a&&(A.host=r),n&&Object.keys(n).sort().forEach(l=>{l&&A.searchParams.set(l,n[l])}),A.href}const AI=/^age:\s*[\d.]+\s*$/im;class kh{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Yr,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null,this.stats=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!this.stats.aborted)return n(i,t.url)}).catch(o=>(i.open("GET",t.url,!0),n(i,t.url))).then(()=>{this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(o=>{this.callbacks.onError({code:i.status,text:o.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:o}=i.loadPolicy;if(r)for(const a in r)e.setRequestHeader(a,r[a]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=n&&Ae(n)?n:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const o=t.status,a=t.responseType!=="text";if(o>=200&&o<300&&(a&&t.response||t.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const A=a?t.response:t.responseText,l=t.responseType==="arraybuffer"?A.byteLength:A.length;if(i.loaded=i.total=l,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first),!this.callbacks)return;const c=this.callbacks.onProgress;if(c&&c(i,e,A,t),!this.callbacks)return;const h={url:t.responseURL,data:A,code:o};this.callbacks.onSuccess(h,i,e,t)}else{const A=n.loadPolicy.errorRetry,l=i.retry,c={url:e.url,data:void 0,code:o};rn(A,l,!1,c)?this.retry(A):(_.error(`${o} while loading ${e.url}`),this.callbacks.onError({code:o,text:t.statusText},e,t,i))}}}loadtimeout(){var e;const t=(e=this.config)==null?void 0:e.loadPolicy.timeoutRetry,i=this.stats.retry;if(rn(t,i,!0))this.retry(t);else{var r;_.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=Go(e,i.retry),i.retry++,_.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&AI.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}function lI(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const cI=/(\d+)-(\d+)\/(\d+)/;class Mh{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||gI,this.controller=new self.AbortController,this.stats=new Yr}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=hI(e,this.controller.signal),o=i.onProgress,a=e.responseType==="arraybuffer",A=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=l&&Ae(l)?l:c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(h=>{this.response=this.loader=h;const u=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},c-(u-r.loading.start)),!h.ok){const{status:d,statusText:g}=h;throw new fI(g||"fetch, bad network response",d,h)}return r.loading.first=u,r.total=dI(h.headers)||r.total,o&&Ae(t.highWaterMark)?this.loadProgressively(h,r,e,t.highWaterMark,o):a?h.arrayBuffer():e.responseType==="json"?h.json():h.text()}).then(h=>{const u=this.response;if(!u)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const d=h[A];d&&(r.loaded=r.total=d);const g={url:u.url,data:h,code:u.status};o&&!Ae(t.highWaterMark)&&o(r,e,h,u),i.onSuccess(g,r,e,u)}).catch(h=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;const u=h&&h.code||0,d=h?h.message:null;i.onError({code:u,text:d},e,h?h.details:null,r)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,r=0,n){const o=new xc,a=e.body.getReader(),A=()=>a.read().then(l=>{if(l.done)return o.dataLength&&n(t,i,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const c=l.value,h=c.length;return t.loaded+=h,h<r||o.dataLength?(o.push(c),o.dataLength>=r&&n(t,i,o.flush(),e)):n(t,i,c,e),A()}).catch(()=>Promise.reject());return A()}}function hI(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Ze({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function uI(s){const e=cI.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function dI(s){const e=s.get("Content-Range");if(e){const i=uI(e);if(Ae(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function gI(s,e){return new self.Request(s.url,e)}class fI extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const EI=/\s/,pI={newCue(s,e,t,i){const r=[];let n,o,a,A,l;const c=self.VTTCue||self.TextTrackCue;for(let u=0;u<i.rows.length;u++)if(n=i.rows[u],a=!0,A=0,l="",!n.isEmpty()){var h;for(let f=0;f<n.chars.length;f++)EI.test(n.chars[f].uchar)&&a?A++:(l+=n.chars[f].uchar,a=!1);n.cueStartTime=e,e===t&&(t+=1e-4),A>=16?A--:A++;const d=dh(l.trim()),g=Aa(e,t,d);s!=null&&(h=s.cues)!=null&&h.getCueById(g)||(o=new c(e,t,d),o.id=g,o.line=u+1,o.align="left",o.position=10+Math.min(80,Math.floor(A*8/32)*10),r.push(o))}return s&&r.length&&(r.sort((u,d)=>u.line==="auto"||d.line==="auto"?0:u.line>8&&d.line>8?d.line-u.line:u.line-d.line),r.forEach(u=>cc(s,u))),r}},II={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},_h=At(At({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:kh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:W0,bufferController:ZE,capLevelController:da,errorController:F0,fpsController:Qp,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Ml,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:II},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},CI()),{},{subtitleStreamController:WE,subtitleTrackController:jE,timelineController:Bp,audioStreamController:VE,audioTrackController:JE,emeController:vs,cmcdController:nI,contentSteeringController:aI});function CI(){return{cueHandler:pI,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function mI(s,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=Ia(s),i=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(n=>{const o=`${n==="level"?"playlist":n}LoadPolicy`,a=e[o]===void 0,A=[];r.forEach(l=>{const c=`${n}Loading${l}`,h=e[c];if(h!==void 0&&a){A.push(c);const u=t[o].default;switch(e[o]={default:u},l){case"TimeOut":u.maxLoadTimeMs=h,u.maxTimeToFirstByteMs=h;break;case"MaxRetry":u.errorRetry.maxNumRetry=h,u.timeoutRetry.maxNumRetry=h;break;case"RetryDelay":u.errorRetry.retryDelayMs=h,u.timeoutRetry.retryDelayMs=h;break;case"MaxRetryTimeout":u.errorRetry.maxRetryDelayMs=h,u.timeoutRetry.maxRetryDelayMs=h;break}}}),A.length&&_.warn(`hls.js config: "${A.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),At(At({},t),e)}function Ia(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(Ia):Object.keys(s).reduce((e,t)=>(e[t]=Ia(s[t]),e),{}):s}function BI(s){const e=s.loader;e!==Mh&&e!==kh?(_.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):lI()&&(s.loader=Mh,s.progressive=!0,s.enableSoftwareAES=!0,_.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Ca;class yI extends $o{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,r=[],n={},o={};let a=!1,A=!1,l=!1;t.levels.forEach(c=>{var h,u;const d=c.attrs;let{audioCodec:g,videoCodec:f}=c;((h=g)==null?void 0:h.indexOf("mp4a.40.34"))!==-1&&(Ca||(Ca=/chrome|firefox/i.test(navigator.userAgent)),Ca&&(c.audioCodec=g=void 0)),g&&(c.audioCodec=g=Zr(g,i)),((u=f)==null?void 0:u.indexOf("avc1"))===0&&(f=c.videoCodec=h0(f));const{width:E,height:B,unknownCodecs:S}=c;if(a||(a=!!(E&&B)),A||(A=!!f),l||(l=!!g),S!=null&&S.length||g&&!Lo(g,"audio",i)||f&&!Lo(f,"video",i))return;const{CODECS:Q,"FRAME-RATE":m,"HDCP-LEVEL":y,"PATHWAY-ID":L,RESOLUTION:v,"VIDEO-RANGE":F}=d,M=`${`${L||"."}-`}${c.bitrate}-${v}-${m}-${Q}-${F}-${y}`;if(n[M])if(n[M].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const H=o[M]+=1;c.attrs["PATHWAY-ID"]=new Array(H+1).join(".");const j=new fs(c);n[M]=j,r.push(j)}else n[M].addGroupId("audio",d.AUDIO),n[M].addGroupId("text",d.SUBTITLES);else{const H=new fs(c);n[M]=H,o[M]=1,r.push(H)}}),this.filterAndSortMediaOptions(r,t,a,A,l)}filterAndSortMediaOptions(e,t,i,r,n){let o=[],a=[],A=e;if((i||r)&&n&&(A=A.filter(({videoCodec:g,videoRange:f,width:E,height:B})=>(!!g||!!(E&&B))&&v0(f))),A.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const g=new Error("no level with compatible codecs found in manifest");this.hls.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:g,reason:g.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:g}=this.hls.config;o=t.audioTracks.filter(f=>!f.audioCodec||Lo(f.audioCodec,"audio",g)),Fh(o)}t.subtitles&&(a=t.subtitles,Fh(a));const l=A.slice(0);A.sort((g,f)=>{if(g.attrs["HDCP-LEVEL"]!==f.attrs["HDCP-LEVEL"])return(g.attrs["HDCP-LEVEL"]||"")>(f.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&g.height!==f.height)return g.height-f.height;if(g.frameRate!==f.frameRate)return g.frameRate-f.frameRate;if(g.videoRange!==f.videoRange)return tn.indexOf(g.videoRange)-tn.indexOf(f.videoRange);if(g.videoCodec!==f.videoCodec){const E=Xl(g.videoCodec),B=Xl(f.videoCodec);if(E!==B)return B-E}if(g.uri===f.uri&&g.codecSet!==f.codecSet){const E=Xr(g.codecSet),B=Xr(f.codecSet);if(E!==B)return B-E}return g.averageBitrate!==f.averageBitrate?g.averageBitrate-f.averageBitrate:0});let c=l[0];if(this.steering&&(A=this.steering.filterParsedLevels(A),A.length!==l.length)){for(let g=0;g<l.length;g++)if(l[g].pathwayId===A[0].pathwayId){c=l[g];break}}this._levels=A;for(let g=0;g<A.length;g++)if(A[g]===c){var h;this._firstLevel=g;const f=c.bitrate,E=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${A.length} level(s) found, first bitrate: ${f}`),((h=this.hls.userConfig)==null?void 0:h.abrEwmaDefaultEstimate)===void 0){const B=Math.min(f,this.hls.config.abrEwmaDefaultEstimateMax);B>E&&E===_h.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=B)}break}const u=n&&!r,d={levels:A,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:!u&&o.some(g=>!!g.url)};this.hls.trigger(p.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const c=new Error("invalid level idx"),h=e<0;if(this.hls.trigger(p.ERROR,{type:Ie.OTHER_ERROR,details:$.LEVEL_SWITCH_ERROR,level:e,fatal:h,error:c,reason:c.message}),h)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&o.details&&r&&n===a)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${a?" with Pathway "+a:""} from level ${i}${n?" with Pathway "+n:""}`);const A={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(p.LEVEL_SWITCHING,A);const l=o.details;if(!l||l.live){const c=this.switchParams(o.uri,r==null?void 0:r.details);this.loadPlaylist(c)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===be.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===Ee.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(n=>!!i[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var i;const{level:r,details:n}=t,o=this._levels[r];if(!o){var a;this.warn(`Invalid level index ${r}`),(a=t.deliveryDirectives)!=null&&a.skip&&(n.deltaUpdateFailed=!0);return}r===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(r,t,o.details)):(i=t.deliveryDirectives)!=null&&i.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let r=i.uri;if(e)try{r=e.addDirectives(r)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}const n=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${n?" Pathway "+n:""} ${r}`),this.clearTimer(),this.hls.trigger(p.LEVEL_LOADING,{url:r,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const i=this._levels.filter((r,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(o=>o.level=-1)),!1));Ic(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(p.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(p.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function Fh(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}class QI{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[i].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=$.KEY_LOAD_ERROR,i,r,n){return new mi({type:Ie.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:r}=e;for(let n=0;n<t.length;n++){const o=t[n];if(r<=o.cc&&(i==="initSegment"||o.sn==="initSegment"||i<o.sn)){this.emeController.selectKeySystemFormat(o).then(a=>{o.setKeyFormat(a)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const l=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,l))}const o=n.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((i=a)!=null&&i.decryptdata.key)return n.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((r=a)!=null&&r.keyLoadPromise){var A;switch((A=a.mediaKeySessionContext)==null?void 0:A.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(l=>(n.key=l.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(i);if(r)return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,i))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,r=i.loader,n=new r(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((o,a)=>{const A={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=i.keyLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(u,d,g,f)=>{const{frag:E,keyInfo:B,url:S}=g;if(!E.decryptdata||B!==this.keyUriToKeyInfo[S])return a(this.createKeyLoadError(E,$.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),f));B.decryptdata.key=E.decryptdata.key=new Uint8Array(u.data),E.keyLoader=null,B.loader=null,o({frag:E,keyInfo:B})},onError:(u,d,g,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,$.KEY_LOAD_ERROR,new Error(`HTTP Error ${u.code} loading key ${u.text}`),g,At({url:A.url,data:void 0},u)))},onTimeout:(u,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,$.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),g))},onAbort:(u,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,$.INTERNAL_ABORTED,new Error("key loading aborted"),g))}};n.load(A,c,h)})}resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}function Oh(){return self.SourceBuffer||self.WebKitSourceBuffer}function Nh(){if(!ds())return!1;const e=Oh();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function vI(){if(!Nh())return!1;const s=ds();return typeof(s==null?void 0:s.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>s.isTypeSupported(sr(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(sr(e,"audio"))))}function wI(){var s;const e=Oh();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const SI=250,mn=2,DI=.1,bI=.05;class RI{constructor(e,t,i,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:r,stalled:n}=this;if(r===null)return;const{currentTime:o,seeking:a}=r,A=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),n!==null){if(this.stallReported){const E=self.performance.now()-n;_.warn(`playback not stuck anymore @${o}, after ${Math.round(E)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||A){this.stalled=null;return}if(r.paused&&!a||r.ended||r.playbackRate===0||!Pe.getBuffered(r).length){this.nudgeRetry=0;return}const c=Pe.bufferInfo(r,o,0),h=c.nextStart||0;if(a){const E=c.len>mn,B=!h||t&&t.start<=o||h-o>mn&&!this.fragmentTracker.getPartialFragment(o);if(E||B)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var u;if(!(c.len>0)&&!h)return;const B=Math.max(h,c.start||0)-o,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,m=(S==null||(u=S.details)==null?void 0:u.live)?S.details.targetduration*2:mn,y=this.fragmentTracker.getPartialFragment(o);if(B>0&&(B<=m||y)){r.paused||this._trySkipBufferHole(y);return}}const d=self.performance.now();if(n===null){this.stalled=d;return}const g=d-n;if(!a&&g>=SI&&(this._reportStall(c),!this.media))return;const f=Pe.bufferInfo(r,o,i.maxBufferHole);this._tryFixBufferStall(f,g)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:r,media:n}=this;if(n===null)return;const o=n.currentTime,a=r.getPartialFragment(o);a&&(this._trySkipBufferHole(a)||!this.media)||(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-o<i.maxBufferHole)&&t>i.highBufferWatchdogPeriod*1e3&&(_.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:r}=this;if(!r&&i){this.stallReported=!0;const n=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);_.warn(n.message),t.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:r}=this;if(r===null)return 0;const n=r.currentTime,o=Pe.bufferInfo(r,n,0),a=n<o.start?o.start:o.nextStart;if(a){const A=o.len<=t.maxBufferHole,l=o.len>0&&o.len<1&&r.readyState<3,c=a-n;if(c>0&&(A||l)){if(c>t.maxBufferHole){const{fragmentTracker:u}=this;let d=!1;if(n===0){const g=u.getAppendedFrag(0,Ee.MAIN);g&&a<g.end&&(d=!0)}if(!d){const g=e||u.getAppendedFrag(n,Ee.MAIN);if(g){let f=!1,E=g.end;for(;E<a;){const B=u.getPartialFragment(E);if(B)E+=B.duration;else{f=!0;break}}if(f)return 0}}}const h=Math.max(a+bI,n+DI);if(_.warn(`skipping hole, adjusting currentTime from ${n} to ${h}`),this.moved=!0,this.stalled=null,r.currentTime=h,e&&!e.gap){const u=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${h}`);i.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:u,reason:u.message,frag:e})}return h}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:i,nudgeRetry:r}=this;if(i===null)return;const n=i.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){const o=n+(r+1)*e.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${n} to ${o}`);_.warn(a.message),i.currentTime=o,t.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const o=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);_.error(o.message),t.trigger(p.ERROR,{type:Ie.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const xI=100;class TI extends Vo{constructor(e,t,i){super(e,t,i,"[stream-controller]",Ee.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(p.ERROR,this.onError,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(p.ERROR,this.onError,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:i}=this;if(this.stopLoad(),this.setInterval(xI),this.level=-1,!this.startFragRequested){let r=i.startLevel;r===-1&&(i.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=i.firstAutoLevel),i.nextLoadLevel=r,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=Z.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=Z.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Z.WAITING_LEVEL:{const{levels:t,level:i}=this,r=t==null?void 0:t[i],n=r==null?void 0:r.details;if(n&&(!n.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(n))break;this.state=Z.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Z.IDLE;break}break}case Z.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:r,level:n}=this,o=r==null?void 0:r[n];this.resetStartWhenNotLoaded(o||null),this.state=Z.IDLE}}break}this.state===Z.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:r}=this;if(t===null||!r&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=e.nextLoadLevel;if(!(i!=null&&i[n]))return;const o=i[n],a=this.getMainFwdBufferInfo();if(a===null)return;const A=this.getLevelDetails();if(A&&this._streamEnded(a,A)){const f={};this.altAudio&&(f.type="video"),this.hls.trigger(p.BUFFER_EOS,f),this.state=Z.ENDED;return}e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const l=o.details;if(!l||this.state===Z.WAITING_LEVEL||l.live&&this.levelLastLoaded!==o){this.level=n,this.state=Z.WAITING_LEVEL;return}const c=a.len,h=this.getMaxBufferLength(o.maxBitrate);if(c>=h)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const u=this.backtrackFragment?this.backtrackFragment.start:a.end;let d=this.getNextFragment(u,l);if(this.couldBacktrack&&!this.fragPrevious&&d&&d.sn!=="initSegment"&&this.fragmentTracker.getState(d)!==lt.OK){var g;const E=((g=this.backtrackFragment)!=null?g:d).sn-l.startSN,B=l.fragments[E-1];B&&d.cc===B.cc&&(d=B,this.fragmentTracker.removeFragment(B))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(d&&this.isLoopLoading(d,u)){if(!d.gap){const E=this.audioOnly&&!this.altAudio?_e.AUDIO:_e.VIDEO,B=(E===_e.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;B&&this.afterBufferFlushed(B,E,Ee.MAIN)}d=this.getNextFragmentLoopLoading(d,l,a,Ee.MAIN,h)}d&&(d.initSegment&&!d.initSegment.data&&!this.bitrateTest&&(d=d.initSegment),this.loadFragment(d,o,u))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===lt.NOT_LOADED||r===lt.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Ee.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<n.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,A=e[a],l=this.fragLastKbps;l&&this.fragCurrent?i=this.fragCurrent.duration*A.maxBitrate/(1e3*l)+1:i=0}else i=0;const o=this.getBufferedFrag(t.currentTime+i);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const A=a.maxStartPTS?a.maxStartPTS:a.start,l=a.duration,c=Math.max(o.end,A+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*(this.couldBacktrack?.5:.125)),l*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(c,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Z.KEY_LOADING:case Z.FRAG_LOADING:case Z.FRAG_LOADING_WAITING_RETRY:case Z.PARSING:case Z.PARSED:this.state=Z.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new RI(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;Ae(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();if(i===null||i.len===0){this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(p.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,r=!1;t.levels.forEach(n=>{const o=n.audioCodec;o&&(i=i||o.indexOf("mp4a.40.2")!==-1,r=r||o.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&r&&!wI(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==Z.IDLE)return;const r=i[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(r.details))&&(this.state=Z.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r}=this,n=t.level,o=t.details,a=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const A=r[n],l=this.fragCurrent;l&&(this.state===Z.FRAG_LOADING||this.state===Z.FRAG_LOADING_WAITING_RETRY)&&l.level!==t.level&&l.loader&&this.abortCurrentFrag();let c=0;if(o.live||(i=A.details)!=null&&i.live){var h;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,A.details,(h=this.levelLastLoaded)==null?void 0:h.details)}if(A.details=o,this.levelLastLoaded=A,this.hls.trigger(p.LEVEL_UPDATED,{details:o,level:n}),this.state===Z.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=Z.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,c),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const a=o[i.level],A=a.details;if(!A){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const l=a.videoCodec,c=A.PTSKnown||!A.live,h=(t=i.initSegment)==null?void 0:t.data,u=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new Zc(this.hls,Ee.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=r?r.index:-1,f=g!==-1,E=new Ko(i.level,i.sn,i.stats.chunkCount,n.byteLength,g,f),B=this.initPTS[i.cc];d.push(n,h,u,l,i,r,A.totalduration,c,E,B)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const n=this.hls;i&&(n.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(p.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,r=!!this.hls.audioTracks[i].url;if(r){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()}onBufferCreated(e,t){const i=t.tracks;let r,n,o=!1;for(const a in i){const A=i[a];if(A.id==="main"){if(n=a,r=A,a==="video"){const l=i[a];l&&(this.videoBuffer=l.buffer)}}else o=!0}o&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i&&i.type!==Ee.MAIN)return;if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===Z.PARSED&&(this.state=Z.IDLE);return}const n=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=Z.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.MAIN,t);break;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Z.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===be.LEVEL&&(this.state=Z.IDLE);break;case $.BUFFER_APPEND_ERROR:case $.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===$.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Pe.getBuffered(e).length){const i=this.state!==Z.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,i)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=Z.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==_e.AUDIO||this.audioOnly&&!this.altAudio){const i=(t===_e.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,t,Ee.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const r=Pe.getBuffered(e),o=(r.length?r.start(0):0)-i;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),i+=o,this.startPosition=i),this.log(`seek to target start position ${i} from current time ${t}`),e.currentTime=i}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:r}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=Z.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),r.trigger(p.FRAG_LOADED,i),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i="main",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{video:h,text:u,id3:d,initSegment:g}=n,{details:f}=c,E=this.altAudio?void 0:n.audio;if(this.fragContextChanged(A)){this.fragmentTracker.removeFragment(A);return}if(this.state=Z.PARSING,g){if(g!=null&&g.tracks){const Q=A.initSegment||A;this._bufferInitSegment(c,g.tracks,Q,o),r.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:Q,id:i,tracks:g.tracks})}const B=g.initPTS,S=g.timescale;Ae(B)&&(this.initPTS[A.cc]={baseTime:B,timescale:S},r.trigger(p.INIT_PTS_FOUND,{frag:A,id:i,initPTS:B,timescale:S}))}if(h&&f&&A.sn!=="initSegment"){const B=f.fragments[A.sn-1-f.startSN],S=A.sn===f.startSN,Q=!B||A.cc>B.cc;if(n.independent!==!1){const{startPTS:m,endPTS:y,startDTS:L,endDTS:v}=h;if(l)l.elementaryStreams[h.type]={startPTS:m,endPTS:y,startDTS:L,endDTS:v};else if(h.firstKeyFrame&&h.independent&&o.id===1&&!Q&&(this.couldBacktrack=!0),h.dropped&&h.independent){const F=this.getMainFwdBufferInfo(),G=(F?F.end:this.getLoadPosition())+this.config.maxBufferHole,M=h.firstKeyFramePTS?h.firstKeyFramePTS:m;if(!S&&G<M-this.config.maxBufferHole&&!Q){this.backtrack(A);return}else Q&&(A.gap=!0);A.setElementaryStreamInfo(h.type,A.start,y,A.start,v,!0)}else S&&m>mn&&(A.gap=!0);A.setElementaryStreamInfo(h.type,m,y,L,v),this.backtrackFragment&&(this.backtrackFragment=A),this.bufferFragmentData(h,A,l,o,S||Q)}else if(S||Q)A.gap=!0;else{this.backtrack(A);return}}if(E){const{startPTS:B,endPTS:S,startDTS:Q,endDTS:m}=E;l&&(l.elementaryStreams[_e.AUDIO]={startPTS:B,endPTS:S,startDTS:Q,endDTS:m}),A.setElementaryStreamInfo(_e.AUDIO,B,S,Q,m),this.bufferFragmentData(E,A,l,o)}if(f&&d!=null&&(t=d.samples)!=null&&t.length){const B={id:i,frag:A,details:f,samples:d.samples};r.trigger(p.FRAG_PARSING_METADATA,B)}if(f&&u){const B={id:i,frag:A,details:f,samples:u.samples};r.trigger(p.FRAG_PARSING_USERDATA,B)}}_bufferInitSegment(e,t,i,r){if(this.state!==Z.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:n,video:o,audiovideo:a}=t;if(n){let A=e.audioCodec;const l=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(A&&(A.indexOf("mp4a.40.5")!==-1?A="mp4a.40.2":A="mp4a.40.5"),n.metadata.channelCount!==1&&l.indexOf("firefox")===-1&&(A="mp4a.40.5")),A&&A.indexOf("mp4a.40.5")!==-1&&l.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(A="mp4a.40.2",this.log(`Android: force audio codec to ${A}`)),e.audioCodec&&e.audioCodec!==A&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${A}"`),n.levelCodec=A,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${A||""}/${e.audioCodec||""}/${n.codec}]`)}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${o.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),this.hls.trigger(p.BUFFER_CODECS,t),Object.keys(t).forEach(A=>{const c=t[A].initSegment;c!=null&&c.byteLength&&this.hls.trigger(p.BUFFER_APPENDING,{type:A,data:c,frag:i,part:null,chunkMeta:r,parent:i.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Ee.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Z.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Pe.isBuffered(e,i)?t=this.getAppendedFrag(i):Pe.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(p.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(p.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&Ae(t)&&Ae(i.programDateTime)){const r=i.programDateTime+(t-i.start)*1e3;return new Date(r)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Qi{static get version(){return"1.5.7"}static isMSESupported(){return Nh()}static isSupported(){return vI()}static getMediaSource(){return ds()}static get Events(){return p}static get ErrorTypes(){return Ie}static get ErrorDetails(){return $}static get DefaultConfig(){return Qi.defaultConfig?Qi.defaultConfig:_h}static set DefaultConfig(e){Qi.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new ta,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,Qf(e.debug||!1,"Hls instance");const t=this.config=mI(Qi.DefaultConfig,e);this.userConfig=e,t.progressive&&BI(t);const{abrController:i,bufferController:r,capLevelController:n,errorController:o,fpsController:a}=t,A=new o(this),l=this.abrController=new i(this),c=this.bufferController=new r(this),h=this.capLevelController=new n(this),u=new a(this),d=new E0(this),g=new B0(this),f=t.contentSteeringController,E=f?new f(this):null,B=this.levelController=new yI(this,E),S=new j0(this),Q=new QI(this.config),m=this.streamController=new TI(this,S,Q);h.setStreamController(m),u.setStreamController(m);const y=[d,B,m];E&&y.splice(1,0,E),this.networkControllers=y;const L=[l,c,h,u,g,S];this.audioTrackController=this.createController(t.audioTrackController,y);const v=t.audioStreamController;v&&y.push(new v(this,S,Q)),this.subtitleTrackController=this.createController(t.subtitleTrackController,y);const F=t.subtitleStreamController;F&&y.push(new F(this,S,Q)),this.createController(t.timelineController,L),Q.emeController=this.emeController=this.createController(t.emeController,L),this.cmcdController=this.createController(t.cmcdController,L),this.latencyController=this.createController(y0,L),this.coreComponents=L,y.push(A);const G=A.onErrorOut;typeof G=="function"&&this.on(p.ERROR,G,A)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,r){this._emitter.off(e,t,i,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(_.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const r=e===p.ERROR;this.trigger(p.ERROR,{type:Ie.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:r,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){_.log("destroy"),this.trigger(p.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){_.log("attachMedia"),this._media=e,this.trigger(p.MEDIA_ATTACHING,{media:e})}detachMedia(){_.log("detachMedia"),this.trigger(p.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,r=this.url=mo.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,_.log(`loadSource:${r}`),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(p.MANIFEST_LOADING,{url:e})}startLoad(e=-1){_.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){_.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){_.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){_.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){_.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){_.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){_.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){_.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){_.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(_.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){Q0(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,i)for(let n=r;n--;){const o=e[n].attrs["HDCP-LEVEL"];if(o&&o<=i)return n}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}Qi.defaultConfig=void 0;function LI(s){return s&&s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function kI(s){return s}function MI(s,e){e=e||{};const t=e.delimiter||".",i=e.maxDepth,r=e.transformKey||kI,n={};function o(a,A,l){l=l||1,Object.keys(a).forEach(function(c){const h=a[c],u=e.safe&&Array.isArray(h),d=Object.prototype.toString.call(h),g=LI(h),f=d==="[object Object]"||d==="[object Array]",E=A?A+t+r(c):r(c);if(!u&&!g&&f&&Object.keys(h).length&&(!e.maxDepth||l<i))return o(h,E,l+1);n[E]=h})}return o(s),n}/**
183
+ `),l=[],c=e?nE(e.baseTime,e.timescale):0;let u="00:00.000",h=0,d=0,g,f=!0;a.oncue=function(p){const v=t[i];let y=t.ccOffset;const Q=(h-c)/9e4;if(v!=null&&v.new&&(d!==void 0?y=t.ccOffset=v.start:GE(t,i,Q)),Q){if(!e){g=new Error("Missing initPTS for VTT MPEGTS");return}y=Q-t.presentationOffset}const m=p.endTime-p.startTime,b=Nt((p.startTime+y-d)*9e4,r*9e4)/9e4;p.startTime=Math.max(b,0),p.endTime=Math.max(b+m,0);const x=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(x)),p.id||(p.id=ba(p.startTime,p.endTime,x)),p.endTime>0&&l.push(p)},a.onparsingerror=function(p){g=p},a.onflush=function(){if(g){o(g);return}n(l)},A.forEach(p=>{if(f)if(Ba(p,"X-TIMESTAMP-MAP=")){f=!1,p.slice(16).split(",").forEach(v=>{Ba(v,"LOCAL:")?u=v.slice(6):Ba(v,"MPEGTS:")&&(h=parseInt(v.slice(7)))});try{d=UE(u)/1e3}catch(v){g=v}return}else p===""&&(f=!1);a.parse(p+`
184
+ `)}),a.flush()}const Sa="stpp.ttml.im1t",Su=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,wu=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,$E={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ru(s,e,t,i){const r=ve(new Uint8Array(s),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(a=>ei(a)),o=rE(e.baseTime,1,e.timescale);try{n.forEach(a=>t(YE(a,o)))}catch(a){i(a)}}function YE(s,e){const r=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(n).reduce((u,h)=>(u[h]=r.getAttribute(`ttp:${h}`)||n[h],u),{}),a=r.getAttribute("xml:space")!=="preserve",A=xu(wa(r,"styling","style")),l=xu(wa(r,"layout","region")),c=wa(r,"body","[begin]");return[].map.call(c,u=>{const h=Tu(u,a);if(!h||!u.hasAttribute("begin"))return null;const d=xa(u.getAttribute("begin"),o),g=xa(u.getAttribute("dur"),o);let f=xa(u.getAttribute("end"),o);if(d===null)throw Du(u);if(f===null){if(g===null)throw Du(u);f=d+g}const p=new va(d-e,f-e,h);p.id=ba(p.startTime,p.endTime,p.text);const v=l[u.getAttribute("region")],y=A[u.getAttribute("style")],Q=KE(v,y,A),{textAlign:m}=Q;if(m){const b=$E[m];b&&(p.lineAlign=b),p.align=m}return tt(p,Q),p}).filter(u=>u!==null)}function wa(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function xu(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Tu(s,e){return[].slice.call(s.childNodes).reduce((t,i,r)=>{var n;return i.nodeName==="br"&&r?t+`
185
+ `:(n=i.childNodes)!=null&&n.length?Tu(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function KE(s,e,t){const i="http://www.w3.org/ns/ttml#styling";let r=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=s!=null&&s.hasAttribute("style")?s.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(r=t[o]),n.reduce((a,A)=>{const l=Ra(e,i,A)||Ra(s,i,A)||Ra(r,i,A);return l&&(a[A]=l),a},{})}function Ra(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function Du(s){return new Error(`Could not parse ttml timestamp ${s}`)}function xa(s,e){if(!s)return null;let t=Bu(s);return t===null&&(Su.test(s)?t=VE(s,e):wu.test(s)&&(t=JE(s,e))),t}function VE(s,e){const t=Su.exec(s),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function JE(s,e){const t=wu.exec(s),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class WE{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=ku(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new Tn(this,"textTrack1"),t=new Tn(this,"textTrack2"),i=new Tn(this,"textTrack3"),r=new Tn(this,"textTrack4");this.cea608Parser1=new yu(1,e,t),this.cea608Parser2=new yu(3,i,r)}}addCues(e,t,i,r,n){let o=!1;for(let a=n.length;a--;){const A=n[a],l=qE(A[0],A[1],t,i);if(l>=0&&(A[0]=Math.min(A[0],t),A[1]=Math.max(A[1],i),o=!0,l/(i-t)>.5))return}if(o||n.push([t,i]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,i,r)}else{const a=this.Cues.newCue(null,t,i,r);this.hls.trigger(E.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:r,timescale:n}){const{unparsedVttFrags:o}=this;i==="main"&&(this.initPTS[t.cc]={baseTime:r,timescale:n}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(E.FRAG_LOADED,a)}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let r=0;r<i.textTracks.length;r++){const n=i.textTracks[r];if(_u(n,{name:e,lang:t,attrs:{}}))return n}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:r}=this,{label:n,languageCode:o}=t[e],a=this.getExistingTrack(n,o);if(a)i[e]=a,ps(i[e]),Bc(i[e],r);else{const A=this.createTextTrack("captions",n,o);A&&(A[e]=!0,i[e]=A)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,r={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,i){const r=this.media;if(r)return r.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{ps(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=ku(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)ps(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===Sa);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(gu(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const o=this.media,a=o?hn(o.textTracks):null;if(this.tracks.forEach((A,l)=>{let c;if(a){let u=null;for(let h=0;h<a.length;h++)if(a[h]&&_u(a[h],A)){u=a[h],a[h]=null;break}u&&(c=u)}if(c)ps(c);else{const u=Lu(A);c=this.createTextTrack(u,A.name,A.lang),c&&(c.mode="disabled")}c&&this.textTracks.push(c)}),a!=null&&a.length){const A=a.filter(l=>l!==null).map(l=>l.label);A.length&&N.warn(`Media element contains unused subtitle tracks: ${A.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(a=>({label:a.name,kind:a.type.toLowerCase(),default:a.default,subtitleTrack:a}));this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const r=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!r)return;const n=`textTrack${r[1]}`,o=this.captionsProperties[n];o&&(o.label=i.name,i.lang&&(o.languageCode=i.lang),o.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===de.MAIN){var i,r;const{cea608Parser1:n,cea608Parser2:o,lastSn:a}=this,{cc:A,sn:l}=t.frag,c=(i=(r=t.part)==null?void 0:r.index)!=null?i:-1;n&&o&&(l!==a+1||l===a&&c!==this.lastPartIndex+1||A!==this.lastCc)&&(n.reset(),o.reset()),this.lastCc=A,this.lastSn=l,this.lastPartIndex=c}}onFragLoaded(e,t){const{frag:i,payload:r}=t;if(i.type===de.SUBTITLE)if(r.byteLength){const n=i.decryptdata,o="stats"in t;if(n==null||!n.encrypted||o){const a=this.tracks[i.level],A=this.vttCCs;A[i.cc]||(A[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),a&&a.textCodec===Sa?this._parseIMSC1(i,r):this._parseVTTs(t)}}else this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Ru(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{N.log(`Failed to parse IMSC1: ${r}`),i.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:i,payload:r}=e,{initPTS:n,unparsedVttFrags:o}=this,a=n.length-1;if(!n[i.cc]&&a===-1){o.push(e);return}const A=this.hls,l=(t=i.initSegment)!=null&&t.data?Ft(i.initSegment.data,new Uint8Array(r)):r;HE(l,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,c=>{this._appendCues(c,i.level),A.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},c=>{const u=c.message==="Missing initPTS for VTT MPEGTS";u?o.push(e):this._fallbackToIMSC1(i,r),N.log(`Failed to parse VTT cue: ${c}`),!(u&&a>i.cc)&&A.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:c})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Ru(t,this.initPTS[e.cc],()=>{i.textCodec=Sa,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(n=>Qc(r,n))}else{const r=this.tracks[t];if(!r)return;const n=r.default?"default":"subtitles"+t;i.trigger(E.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===de.SUBTITLE&&this.onFragLoaded(E.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:r}=this;if(!this.enabled||!i||!r)return;const{frag:n,samples:o}=t;if(!(n.type===de.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let a=0;a<o.length;a++){const A=o[a].bytes;if(A){const l=this.extractCea608Data(A);i.addData(o[a].pts,l[0]),r.addData(o[a].pts,l[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:r,type:n}){const{media:o}=this;if(!(!o||o.currentTime<i)){if(!n||n==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(A=>zo(a[A],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(A=>zo(a[A],t,r))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let r=2;for(let n=0;n<i;n++){const o=e[r++],a=127&e[r++],A=127&e[r++];if(a===0&&A===0)continue;if((4&o)!==0){const c=3&o;(c===0||c===1)&&(t[c].push(a),t[c].push(A))}}return t}}function Lu(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function _u(s,e){return!!s&&s.kind===Lu(e)&&ma(e,s)}function qE(s,e,t,i){return Math.min(e,i)-Math.max(s,t)}function ku(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Ta{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&oe(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&N.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((r,n)=>this.isLevelAllowed(r)&&n<=e);return this.clientRect=null,Ta.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const r=(a,A)=>A?a.width!==A.width||a.height!==A.height:!0;let n=e.length-1;const o=Math.max(t,i);for(let a=0;a<e.length;a+=1){const A=e[a];if((A.width>=o||A.height>=o)&&r(A,e[a+1])){n=a;break}}return n}}class jE{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const r=performance.now();if(t){if(this.lastTime){const n=r-this.lastTime,o=i-this.lastDroppedFrames,a=t-this.lastDecodedFrames,A=1e3*o/n,l=this.hls;if(l.trigger(E.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:i}),A>0&&o>l.config.fpsDroppedMonitoringThreshold*a){let c=l.currentLevel;N.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(l.autoLevelCapping===-1||l.autoLevelCapping>=c)&&(c=c-1,l.trigger(E.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:l.currentLevel}),l.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}const Ln="[eme]";class bs{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=bs.CDMCleanupPromise?[bs.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=N.debug.bind(N,Ln),this.log=N.log.bind(N,Ln),this.warn=N.warn.bind(N,Ln),this.error=N.error.bind(N,Ln),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,r=t[e];if(r)return r.licenseUrl;if(e===Je.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(o,a,A)=>!!o&&A.indexOf(o)===a,r=t.map(o=>o.audioCodec).filter(i),n=t.map(o=>o.videoCodec).filter(i);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((o,a)=>{const A=l=>{const c=l.shift();this.getMediaKeysPromise(c,r,n).then(u=>o({keySystem:c,mediaKeys:u})).catch(u=>{l.length?A(l):u instanceof Mt?a(u):a(new Mt({type:Ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_ACCESS,error:u,fatal:!0},u.message))})};A(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${i}`;return Wl===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return i(e,t)}getMediaKeysPromise(e,t,i){const r=s0(e,t,i,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let o=n==null?void 0:n.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(r)}`),o=this.requestMediaKeySystemAccess(e,r);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(A=>{this.log(`Failed to obtain access to key-system "${e}": ${A}`)}),o.then(A=>{this.log(`Access for key-system "${A.keySystem}" obtained`);const l=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=A.createMediaKeys().then(c=>(this.log(`Media-keys created for "${e}"`),l.then(u=>u?this.setMediaKeysServerCertificate(c,e,u):c))),a.mediaKeys.catch(c=>{this.error(`Failed to create media-keys for "${e}"}: ${c}`)}),a.mediaKeys})}return o.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${ti.hexDump(e.keyId||[])}`);const r=i.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),r=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(i,n,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return ti.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${ti.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
186
+ } (data length: ${t&&t.byteLength})`),r.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,i)=>{const r=Ho(this.config),n=e.map(Kl).filter(o=>!!o&&r.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:o})=>{const a=Jl(o);a?t(a):i(new Error(`Unable to find format for key-system "${o}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),r=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${r}`);let n=this.keyIdToKeySessionPromise[i];return n||(n=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then(({keySystem:o,mediaKeys:a})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${r}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const A=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t});return this.generateRequestWithPreferredKeySession(A,"cenc",t.pssh,"playlist-key")}))),n.catch(o=>this.handleError(o))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Mt?this.hls.trigger(E.ERROR,e.data):this.hls.trigger(E.ERROR,{type:Ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=Kl(e.keyFormat),n=r?[r]:Ho(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Ho(this.config)),e.length===0)throw new Mt({type:Ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),i===null)return;let r,n;if(t==="sinf"&&this.config.drmSystems[Je.FAIRPLAY]){const c=At(new Uint8Array(i));try{const u=Uo(JSON.parse(c).sinf),h=sc(new Uint8Array(u));if(!h)return;r=h.subarray(8,24),n=Je.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=R0(i);if(c===null)return;c.version===0&&c.systemId===Vl.WIDEVINE&&c.data&&(r=c.data.subarray(8,24)),n=i0(c.systemId)}if(!n||!r)return;const o=ti.hexDump(r),{keyIdToKeySessionPromise:a,mediaKeySessions:A}=this;let l=a[o];for(let c=0;c<A.length;c++){const u=A[c],h=u.decryptdata;if(h.pssh||!h.keyId)continue;const d=ti.hexDump(h.keyId);if(o===d||h.uri.replace(/-/g,"").indexOf(o)!==-1){l=a[d],delete a[d],h.pssh=new Uint8Array(i),h.keyId=r,l=a[o]=l.then(()=>this.generateRequestWithPreferredKeySession(u,t,i,"encrypted-event-key-match"));break}}l||(l=a[o]=this.getKeySystemSelectionPromise([n]).then(({keySystem:c,mediaKeys:u})=>{var h;this.throwIfDestroyed();const d=new ar("ISO-23001-7",o,(h=Jl(c))!=null?h:"");return d.pssh=new Uint8Array(i),d.keyId=r,this.attemptSetMediaKeys(c,u).then(()=>{this.throwIfDestroyed();const g=this.createMediaKeySessionContext({decryptdata:d,keySystem:c,mediaKeys:u});return this.generateRequestWithPreferredKeySession(g,t,i,"encrypted-event-no-match")})})),l.catch(c=>this.handleError(c))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>i.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,i,r){var n,o;const a=(n=this.config.drmSystems)==null||(o=n[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const g=a.call(this.hls,t,i,e);if(!g)throw new Error("Invalid response from configured generateRequest filter");t=g.initDataType,i=e.decryptdata.pssh=g.initData?new Uint8Array(g.initData):null}catch(g){var A;if(this.warn(g.message),(A=this.hls)!=null&&A.config.debug)throw g}if(i===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${r}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const c=new Ia,u=e._onmessage=g=>{const f=e.mediaKeysSession;if(!f){c.emit("error",new Error("invalid state"));return}const{messageType:p,message:v}=g;this.log(`"${p}" message event for session "${f.sessionId}" message size: ${v.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,v).catch(y=>{this.handleError(y),c.emit("error",y)}):p==="license-release"?e.keySystem===Je.FAIRPLAY&&(this.updateKeySession(e,Go("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${p}"`)},h=e._onkeystatuseschange=g=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const p=e.keyStatus;c.emit("keyStatus",p),p==="expired"&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",h);const d=new Promise((g,f)=>{c.on("error",f),c.on("keyStatus",p=>{p.startsWith("usable")?g():p==="output-restricted"?f(new Mt({type:Ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?f(new Mt({type:Ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${p}"`)):p==="expired"?f(new Error("key expired while generating request")):this.warn(`unhandled key status change "${p}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var g;this.log(`Request generated for key-session "${(g=e.mediaKeysSession)==null?void 0:g.sessionId}" keyId: ${l}`)}).catch(g=>{throw new Mt({type:Ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_SESSION,error:g,fatal:!1},`Error generating key-session request: ${g}`)}).then(()=>d).catch(g=>{throw c.removeAllListeners(),this.removeSession(e),g}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${ti.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${ti.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,r=new i(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const A={responseType:"arraybuffer",url:n},l=t.certLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(h,d,g,f)=>{o(h.data)},onError:(h,d,g,f)=>{a(new Mt({type:Ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:lt({url:A.url,data:void 0},h)},`"${e}" certificate request failed (${n}). Status: ${h.code} (${h.text})`))},onTimeout:(h,d,g)=>{a(new Mt({type:Ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:g,response:{url:A.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(h,d,g)=>{a(new Error("aborted"))}};r.load(A,c,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((r,n)=>{e.setServerCertificate(i).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),r(e)}).catch(o=>{n(new Mt({type:Ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(r=>{throw new Mt({type:Ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:r,fatal:!0},r.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(i,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let c;for(let u=0,h=n.length;u<h;u++){var o,a;c=n[u];const d=(o=c.querySelector("name"))==null?void 0:o.textContent,g=(a=c.querySelector("value"))==null?void 0:a.textContent;d&&g&&e.setRequestHeader(d,g)}}const A=r.querySelector("Challenge"),l=A==null?void 0:A.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return Go(atob(l))}setupLicenseXHR(e,t,i,r){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,i,r)}).catch(o=>{if(!i.decryptdata)throw o;return e.open("POST",t,!0),n.call(this.hls,e,t,i,r)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((r,n)=>{const o=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${o}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let A=a.response;this.log(`License received ${A instanceof ArrayBuffer?A.byteLength:A}`);const l=this.config.licenseResponseCallback;if(l)try{A=l.call(this.hls,a,o,e)}catch(c){this.error(c)}r(A)}else{const A=i.errorRetry,l=A?A.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)n(new Mt({type:Ee.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:o,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${o}). Status: ${a.status} (${a.statusText})`));else{const c=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} attempts left`),this.requestLicense(e,t).then(r,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:A,licenseChallenge:l})=>{e.keySystem==Je.PLAYREADY&&(l=this.unpackPlayReadyKeyMessage(A,l)),A.send(l)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},ar.clearKeyUriToKeyIdMap();const i=t.length;bs.CDMCleanupPromise=Promise.all(t.map(r=>this.removeSession(r)).concat(e==null?void 0:e.setMediaKeys(null).catch(r=>{this.log(`Could not clear media keys: ${r}`)}))).then(()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(r=>{this.log(`Could not close sessions and clear media keys: ${r}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((r,n)=>(r.indexOf(n.keyFormat)===-1&&r.push(n.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const r=this.mediaKeySessions.indexOf(e);return r>-1&&this.mediaKeySessions.splice(r,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}bs.CDMCleanupPromise=void 0;class Mt extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var Ct;(function(s){s.MANIFEST="m",s.AUDIO="a",s.VIDEO="v",s.MUXED="av",s.INIT="i",s.CAPTION="c",s.TIMED_TEXT="tt",s.KEY="k",s.OTHER="o"})(Ct||(Ct={}));var Da;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(Da||(Da={}));var es;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(es||(es={}));const XE={[es.OBJECT]:["br","d","ot","tb"],[es.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[es.SESSION]:["cid","pr","sf","sid","st","v"],[es.STATUS]:["bs","rtp"]};class Ss{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(i=>i instanceof Ss?i:new Ss(i))),this.value=e,this.params=t}}class Fu{constructor(e){this.description=void 0,this.description=e}}const zE="Dict";function ZE(s){return Array.isArray(s)?JSON.stringify(s):s instanceof Map?"Map{}":s instanceof Set?"Set{}":typeof s=="object"?JSON.stringify(s):String(s)}function eI(s,e,t,i){return new Error(`failed to ${s} "${ZE(e)}" as ${t}`,{cause:i})}const Nu="Bare Item",tI="Boolean",iI="Byte Sequence",sI="Decimal",rI="Integer";function nI(s){return s<-999999999999999||999999999999999<s}const oI=/[\x00-\x1f\x7f]+/,aI="Token",AI="Key";function oi(s,e,t){return eI("serialize",s,e,t)}function lI(s){if(typeof s!="boolean")throw oi(s,tI);return s?"?1":"?0"}function cI(s){return btoa(String.fromCharCode(...s))}function uI(s){if(ArrayBuffer.isView(s)===!1)throw oi(s,iI);return`:${cI(s)}:`}function Mu(s){if(nI(s))throw oi(s,rI);return s.toString()}function hI(s){return`@${Mu(s.getTime()/1e3)}`}function Pu(s,e){if(s<0)return-Pu(-s,e);const t=Math.pow(10,e);if(Math.abs(s*t%1-.5)<Number.EPSILON){const r=Math.floor(s*t);return(r%2===0?r:r+1)/t}else return Math.round(s*t)/t}function dI(s){const e=Pu(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw oi(s,sI);const t=e.toString();return t.includes(".")?t:`${t}.0`}const gI="String";function fI(s){if(oI.test(s))throw oi(s,gI);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function pI(s){return s.description||s.toString().slice(7,-1)}function Ou(s){const e=pI(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw oi(e,aI);return e}function La(s){switch(typeof s){case"number":if(!oe(s))throw oi(s,Nu);return Number.isInteger(s)?Mu(s):dI(s);case"string":return fI(s);case"symbol":return Ou(s);case"boolean":return lI(s);case"object":if(s instanceof Date)return hI(s);if(s instanceof Uint8Array)return uI(s);if(s instanceof Fu)return Ou(s);default:throw oi(s,Nu)}}function _a(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw oi(s,AI);return s}function ka(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${_a(e)}`:`;${_a(e)}=${La(t)}`).join("")}function Uu(s){return s instanceof Ss?`${La(s.value)}${ka(s.params)}`:La(s)}function EI(s){return`(${s.value.map(Uu).join(" ")})${ka(s.params)}`}function II(s,e={whitespace:!0}){if(typeof s!="object")throw oi(s,zE);const t=s instanceof Map?s.entries():Object.entries(s),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof Ss||(n=new Ss(n));let o=_a(r);return n.value===!0?o+=ka(n.params):(o+="=",Array.isArray(n.value)?o+=EI(n):o+=Uu(n)),o}).join(`,${i}`)}function mI(s,e){return II(s,e)}const CI=s=>s==="ot"||s==="sf"||s==="st",vI=s=>typeof s=="number"?oe(s):s!=null&&s!==""&&s!==!1;function yI(s,e){const t=new URL(s),i=new URL(e);if(t.origin!==i.origin)return s;const r=t.pathname.split("/").slice(1),n=i.pathname.split("/").slice(1,-1);for(;r[0]===n[0];)r.shift(),n.shift();for(;n.length;)n.shift(),r.unshift("..");return r.join("/")}function BI(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?n:n&3|8).toString(16)})}}}const _n=s=>Math.round(s),QI=(s,e)=>(e!=null&&e.baseUrl&&(s=yI(s,e.baseUrl)),encodeURIComponent(s)),kn=s=>_n(s/100)*100,bI={br:_n,d:_n,bl:kn,dl:kn,mtp:kn,nor:QI,rtp:kn,tb:_n};function SI(s,e){const t={};if(s==null||typeof s!="object")return t;const i=Object.keys(s).sort(),r=tt({},bI,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;return i.forEach(o=>{if(n!=null&&n(o))return;let a=s[o];const A=r[o];A&&(a=A(a,e)),!(o==="v"&&a===1)&&(o=="pr"&&a===1||vI(a)&&(CI(o)&&typeof a=="string"&&(a=new Fu(a)),t[o]=a))}),t}function Gu(s,e={}){return s?mI(SI(s,e),tt({whitespace:!1},e)):""}function wI(s,e={}){if(!s)return{};const t=Object.entries(s),i=Object.entries(XE).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),r=t.reduce((n,o)=>{var a,A;const[l,c]=o,u=((a=i.find(h=>h[1].includes(l)))==null?void 0:a[0])||es.REQUEST;return(A=n[u])!=null||(n[u]={}),n[u][l]=c,n},{});return Object.entries(r).reduce((n,[o,a])=>(n[o]=Gu(a,e),n),{})}function RI(s,e,t){return tt(s,wI(e,t))}const xI="CMCD";function TI(s,e={}){if(!s)return"";const t=Gu(s,e);return`${xI}=${encodeURIComponent(t)}`}const Hu=/CMCD=[^&#]+/;function DI(s,e,t){const i=TI(e,t);if(!i)return s;if(Hu.test(s))return s.replace(Hu,i);const r=s.includes("?")?"&":"?";return`${s}${r}${i}`}class LI{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=r=>{try{this.apply(r,{ot:Ct.MANIFEST,su:!this.initialized})}catch(n){N.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=r=>{try{const n=r.frag,o=this.hls.levels[n.level],a=this.getObjectType(n),A={d:n.duration*1e3,ot:a};(a===Ct.VIDEO||a===Ct.AUDIO||a==Ct.MUXED)&&(A.br=o.bitrate/1e3,A.tb=this.getTopBandwidth(a)/1e3,A.bl=this.getBufferLength(a)),this.apply(r,A)}catch(n){N.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||BI(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHED,this.onMediaDetached,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHED,this.onMediaDetached,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,r;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.buffer}createData(){var e;return{v:1,sf:Da.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){tt(t,this.createData());const i=t.ot===Ct.INIT||t.ot===Ct.VIDEO||t.ot===Ct.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((n,o)=>(r.includes(o)&&(n[o]=t[o]),n),{})),this.useHeaders?(e.headers||(e.headers={}),RI(e.headers,t)):e.url=DI(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Ct.TIMED_TEXT;if(e.sn==="initSegment")return Ct.INIT;if(t==="audio")return Ct.AUDIO;if(t==="main")return this.hls.audioTracks.length?Ct.VIDEO:Ct.MUXED}getTopBandwidth(e){let t=0,i;const r=this.hls;if(e===Ct.AUDIO)i=r.audioTracks;else{const n=r.maxAutoLevel,o=n>-1?n+1:r.levels.length;i=r.levels.slice(0,o)}for(const n of i)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,i=e===Ct.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Ye.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new i(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,o,a){t(n),this.loader.load(n,o,a)}}}}const _I=3e5;class kI{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=N.log.bind(N,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===It.SendAlternateToPenaltyBox&&i.flags===Vt.MoveAllAlternatesMatchingHost){const r=this.levels;let n=this.pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:A,type:l}=t.context;a&&r?o=this.getPathwayForGroupId(a,l,o):A&&(o=A)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!n&&r&&(n=r.reduce((a,A)=>(a.indexOf(A.pathwayId)===-1&&a.push(A.pathwayId),a),[])),n&&n.length>1&&(this.updatePathwayPriority(n),i.resolved=this.pathwayId!==o),i.resolved||N.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${r&&r.length} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const i=this.penalizedPathways,r=performance.now();Object.keys(i).forEach(n=>{r-i[n]>_I&&delete i[n]});for(let n=0;n<e.length;n++){const o=e[n];if(o in i)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,A=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,_c(t),this.hls.trigger(E.LEVELS_UPDATED,{levels:t});const l=this.hls.levels[a];A&&l&&this.levels&&(l.attrs["STABLE-VARIANT-ID"]!==A.attrs["STABLE-VARIANT-ID"]&&l.bitrate!==A.bitrate&&this.log(`Unstable Pathways change from bitrate ${A.bitrate} to ${l.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,i){const r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let n=0;n<r.length;n++)if(t===Le.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===Le.SUBTITLE_TRACK&&r[n].hasSubtitleGroup(e))return r[n].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},r={};e.forEach(n=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":A}=n;if(t.some(c=>c.pathwayId===o))return;const l=this.getLevelsForPathway(a).map(c=>{const u=new qe(c.attrs);u["PATHWAY-ID"]=o;const h=u.AUDIO&&`${u.AUDIO}_clone_${o}`,d=u.SUBTITLES&&`${u.SUBTITLES}_clone_${o}`;h&&(i[u.AUDIO]=h,u.AUDIO=h),d&&(r[u.SUBTITLES]=d,u.SUBTITLES=d);const g=Yu(c.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",A),f=new Es({attrs:u,audioCodec:c.audioCodec,bitrate:c.bitrate,height:c.height,name:c.name,url:g,videoCodec:c.videoCodec,width:c.width});if(c.audioGroups)for(let p=1;p<c.audioGroups.length;p++)f.addGroupId("audio",`${c.audioGroups[p]}_clone_${o}`);if(c.subtitleGroups)for(let p=1;p<c.subtitleGroups.length;p++)f.addGroupId("text",`${c.subtitleGroups[p]}_clone_${o}`);return f});t.push(...l),$u(this.audioTracks,i,A,o),$u(this.subtitleTracks,r,A,o)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let r;try{r=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+c)}const n={responseType:"json",url:r.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},A={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(c,u,h,d)=>{this.log(`Loaded steering manifest: "${r}"`);const g=c.data;if(g.VERSION!==1){this.log(`Steering VERSION ${g.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=g.TTL;const{"RELOAD-URI":f,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":v}=g;if(f)try{this.uri=new self.URL(f,r).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${f}`);return}this.scheduleRefresh(this.uri||h.url),p&&this.clonePathways(p);const y={steeringManifest:g,url:r.toString()};this.hls.trigger(E.STEERING_MANIFEST_LOADED,y),v&&this.updatePathwayPriority(v)},onError:(c,u,h,d)=>{if(this.log(`Error loading steering manifest: ${c.code} ${c.text} (${u.url})`),this.stopLoad(),c.code===410){this.enabled=!1,this.log(`Steering manifest ${u.url} no longer available`);return}let g=this.timeToLoad*1e3;if(c.code===429){const f=this.loader;if(typeof(f==null?void 0:f.getResponseHeader)=="function"){const p=f.getResponseHeader("Retry-After");p&&(g=parseFloat(p)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,g)},onTimeout:(c,u,h)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(n,A,l)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const r=(i=this.hls)==null?void 0:i.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function $u(s,e,t,i){s&&Object.keys(e).forEach(r=>{const n=s.filter(o=>o.groupId===r).map(o=>{const a=tt({},o);return a.details=void 0,a.attrs=new qe(a.attrs),a.url=a.attrs.URI=Yu(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[r],a.attrs["PATHWAY-ID"]=i,a});s.push(...n)})}function Yu(s,e,t,i){const{HOST:r,PARAMS:n,[t]:o}=i;let a;e&&(a=o==null?void 0:o[e],a&&(s=a));const A=new self.URL(s);return r&&!a&&(A.host=r),n&&Object.keys(n).sort().forEach(l=>{l&&A.searchParams.set(l,n[l])}),A.href}const FI=/^age:\s*[\d.]+\s*$/im;class Ku{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new rn,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return n(i,t.url)}).catch(o=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),n(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(o=>{this.callbacks.onError({code:i.status,text:o.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:o}=i.loadPolicy;if(r)for(const a in r)e.setRequestHeader(a,r[a]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=n&&oe(n)?n:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),r===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const o=t.status,a=t.responseType!=="text";if(o>=200&&o<300&&(a&&t.response||t.responseText!==null)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const A=a?t.response:t.responseText,l=t.responseType==="arraybuffer"?A.byteLength:A.length;if(i.loaded=i.total=l,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first),!this.callbacks)return;const c=this.callbacks.onProgress;if(c&&c(i,e,A,t),!this.callbacks)return;const u={url:t.responseURL,data:A,code:o};this.callbacks.onSuccess(u,i,e,t)}else{const A=n.loadPolicy.errorRetry,l=i.retry,c={url:e.url,data:void 0,code:o};En(A,l,!1,c)?this.retry(A):(N.error(`${o} while loading ${e.url}`),this.callbacks.onError({code:o,text:t.statusText},e,t,i))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(En(e,t,!0))this.retry(e);else{var i;N.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=ra(e,i.retry),i.retry++,N.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&FI.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}function NI(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const MI=/(\d+)-(\d+)\/(\d+)/;class Vu{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||GI,this.controller=new self.AbortController,this.stats=new rn}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const n=PI(e,this.controller.signal),o=i.onProgress,a=e.responseType==="arraybuffer",A=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=l&&oe(l)?l:c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const h=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(r,e,this.response)},c-(h-r.loading.start)),!u.ok){const{status:d,statusText:g}=u;throw new HI(g||"fetch, bad network response",d,u)}return r.loading.first=h,r.total=UI(u.headers)||r.total,o&&oe(t.highWaterMark)?this.loadProgressively(u,r,e,t.highWaterMark,o):a?u.arrayBuffer():e.responseType==="json"?u.json():u.text()}).then(u=>{const h=this.response;if(!h)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const d=u[A];d&&(r.loaded=r.total=d);const g={url:h.url,data:u,code:h.status};o&&!oe(t.highWaterMark)&&o(r,e,u,h),i.onSuccess(g,r,e,h)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;const h=u&&u.code||0,d=u?u.message:null;i.onError({code:h,text:d},e,u?u.details:null,r)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,r=0,n){const o=new Kc,a=e.body.getReader(),A=()=>a.read().then(l=>{if(l.done)return o.dataLength&&n(t,i,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const c=l.value,u=c.length;return t.loaded+=u,u<r||o.dataLength?(o.push(c),o.dataLength>=r&&n(t,i,o.flush(),e)):n(t,i,c,e),A()}).catch(()=>Promise.reject());return A()}}function PI(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(tt({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function OI(s){const e=MI.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function UI(s){const e=s.get("Content-Range");if(e){const i=OI(e);if(oe(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function GI(s,e){return new self.Request(s.url,e)}class HI extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const $I=/\s/,YI={newCue(s,e,t,i){const r=[];let n,o,a,A,l;const c=self.VTTCue||self.TextTrackCue;for(let h=0;h<i.rows.length;h++)if(n=i.rows[h],a=!0,A=0,l="",!n.isEmpty()){var u;for(let f=0;f<n.chars.length;f++)$I.test(n.chars[f].uchar)&&a?A++:(l+=n.chars[f].uchar,a=!1);n.cueStartTime=e,e===t&&(t+=1e-4),A>=16?A--:A++;const d=bu(l.trim()),g=ba(e,t,d);s!=null&&(u=s.cues)!=null&&u.getCueById(g)||(o=new c(e,t,d),o.id=g,o.line=h+1,o.align="left",o.position=10+Math.min(80,Math.floor(A*8/32)*10),r.push(o))}return s&&r.length&&(r.sort((h,d)=>h.line==="auto"||d.line==="auto"?0:h.line>8&&d.line>8?d.line-h.line:h.line-d.line),r.forEach(h=>Qc(s,h))),r}},KI={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Ju=lt(lt({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Ku,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Ip,bufferController:yE,capLevelController:Ta,errorController:op,fpsController:jE,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Wl,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:KI},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},VI()),{},{subtitleStreamController:IE,subtitleTrackController:CE,timelineController:WE,audioStreamController:pE,audioTrackController:EE,emeController:bs,cmcdController:LI,contentSteeringController:kI});function VI(){return{cueHandler:YI,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function JI(s,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=Fa(s),i=["manifest","level","frag"],r=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(n=>{const o=`${n==="level"?"playlist":n}LoadPolicy`,a=e[o]===void 0,A=[];r.forEach(l=>{const c=`${n}Loading${l}`,u=e[c];if(u!==void 0&&a){A.push(c);const h=t[o].default;switch(e[o]={default:h},l){case"TimeOut":h.maxLoadTimeMs=u,h.maxTimeToFirstByteMs=u;break;case"MaxRetry":h.errorRetry.maxNumRetry=u,h.timeoutRetry.maxNumRetry=u;break;case"RetryDelay":h.errorRetry.retryDelayMs=u,h.timeoutRetry.retryDelayMs=u;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=u,h.timeoutRetry.maxRetryDelayMs=u;break}}}),A.length&&N.warn(`hls.js config: "${A.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),lt(lt({},t),e)}function Fa(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(Fa):Object.keys(s).reduce((e,t)=>(e[t]=Fa(s[t]),e),{}):s}function WI(s){const e=s.loader;e!==Vu&&e!==Ku?(N.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):NI()&&(s.loader=Vu,s.progressive=!0,s.enableSoftwareAES=!0,N.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Na;class qI extends oa{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,r=[],n={},o={};let a=!1,A=!1,l=!1;t.levels.forEach(c=>{var u,h;const d=c.attrs;let{audioCodec:g,videoCodec:f}=c;((u=g)==null?void 0:u.indexOf("mp4a.40.34"))!==-1&&(Na||(Na=/chrome|firefox/i.test(navigator.userAgent)),Na&&(c.audioCodec=g=void 0)),g&&(c.audioCodec=g=un(g,i)),((h=f)==null?void 0:h.indexOf("avc1"))===0&&(f=c.videoCodec=F0(f));const{width:p,height:v,unknownCodecs:y}=c;if(a||(a=!!(p&&v)),A||(A=!!f),l||(l=!!g),y!=null&&y.length||g&&!qo(g,"audio",i)||f&&!qo(f,"video",i))return;const{CODECS:Q,"FRAME-RATE":m,"HDCP-LEVEL":b,"PATHWAY-ID":x,RESOLUTION:B,"VIDEO-RANGE":H}=d,k=`${`${x||"."}-`}${c.bitrate}-${B}-${m}-${Q}-${H}-${b}`;if(n[k])if(n[k].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const U=o[k]+=1;c.attrs["PATHWAY-ID"]=new Array(U+1).join(".");const q=new Es(c);n[k]=q,r.push(q)}else n[k].addGroupId("audio",d.AUDIO),n[k].addGroupId("text",d.SUBTITLES);else{const U=new Es(c);n[k]=U,o[k]=1,r.push(U)}}),this.filterAndSortMediaOptions(r,t,a,A,l)}filterAndSortMediaOptions(e,t,i,r,n){let o=[],a=[],A=e;if((i||r)&&n&&(A=A.filter(({videoCodec:g,videoRange:f,width:p,height:v})=>(!!g||!!(p&&v))&&W0(f))),A.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const g=new Error("no level with compatible codecs found in manifest");this.hls.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:g,reason:g.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:g}=this.hls.config;o=t.audioTracks.filter(f=>!f.audioCodec||qo(f.audioCodec,"audio",g)),Wu(o)}t.subtitles&&(a=t.subtitles,Wu(a));const l=A.slice(0);A.sort((g,f)=>{if(g.attrs["HDCP-LEVEL"]!==f.attrs["HDCP-LEVEL"])return(g.attrs["HDCP-LEVEL"]||"")>(f.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&g.height!==f.height)return g.height-f.height;if(g.frameRate!==f.frameRate)return g.frameRate-f.frameRate;if(g.videoRange!==f.videoRange)return gn.indexOf(g.videoRange)-gn.indexOf(f.videoRange);if(g.videoCodec!==f.videoCodec){const p=uc(g.videoCodec),v=uc(f.videoCodec);if(p!==v)return v-p}if(g.uri===f.uri&&g.codecSet!==f.codecSet){const p=cn(g.codecSet),v=cn(f.codecSet);if(p!==v)return v-p}return g.averageBitrate!==f.averageBitrate?g.averageBitrate-f.averageBitrate:0});let c=l[0];if(this.steering&&(A=this.steering.filterParsedLevels(A),A.length!==l.length)){for(let g=0;g<l.length;g++)if(l[g].pathwayId===A[0].pathwayId){c=l[g];break}}this._levels=A;for(let g=0;g<A.length;g++)if(A[g]===c){var u;this._firstLevel=g;const f=c.bitrate,p=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${A.length} level(s) found, first bitrate: ${f}`),((u=this.hls.userConfig)==null?void 0:u.abrEwmaDefaultEstimate)===void 0){const v=Math.min(f,this.hls.config.abrEwmaDefaultEstimateMax);v>p&&p===Ju.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=v)}break}const h=n&&!r,d={levels:A,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:!h&&o.some(g=>!!g.url)};this.hls.trigger(E.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const c=new Error("invalid level idx"),u=e<0;if(this.hls.trigger(E.ERROR,{type:Ee.OTHER_ERROR,details:$.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:c,reason:c.message}),u)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,i===e&&o.details&&r&&n===a)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${a?" with Pathway "+a:""} from level ${i}${n?" with Pathway "+n:""}`);const A={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(E.LEVEL_SWITCHING,A);const l=o.details;if(!l||l.live){const c=this.switchParams(o.uri,r==null?void 0:r.details,l);this.loadPlaylist(c)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===Le.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===de.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(n=>!!i[n]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var i;const{level:r,details:n}=t,o=this._levels[r];if(!o){var a;this.warn(`Invalid level index ${r}`),(a=t.deliveryDirectives)!=null&&a.skip&&(n.deltaUpdateFailed=!0);return}r===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(r,t,o.details)):(i=t.deliveryDirectives)!=null&&i.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let r=i.uri;if(e)try{r=e.addDirectives(r)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}const n=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${n?" Pathway "+n:""} ${r}`),this.clearTimer(),this.hls.trigger(E.LEVEL_LOADING,{url:r,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const i=this._levels.filter((r,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(r),r===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,r.details&&r.details.fragments.forEach(o=>o.level=-1)),!1));_c(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(E.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(E.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function Wu(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}class jI{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[i].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=$.KEY_LOAD_ERROR,i,r,n){return new Bi({type:Ee.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:r}=e;for(let n=0;n<t.length;n++){const o=t[n];if(r<=o.cc&&(i==="initSegment"||o.sn==="initSegment"||i<o.sn)){this.emeController.selectKeySystemFormat(o).then(a=>{o.setKeyFormat(a)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,r;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const l=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,l))}const o=n.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((i=a)!=null&&i.decryptdata.key)return n.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((r=a)!=null&&r.keyLoadPromise){var A;switch((A=a.mediaKeySessionContext)==null?void 0:A.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(l=>(n.key=l.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(a,e):this.loadKeyEME(a,e);case"AES-128":return this.loadKeyHTTP(a,e);default:return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const r=this.emeController.loadKey(i);if(r)return(e.keyLoadPromise=r.then(n=>(e.mediaKeySessionContext=n,i))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,r=i.loader,n=new r(i);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((o,a)=>{const A={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},l=i.keyLoadPolicy.default,c={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(h,d,g,f)=>{const{frag:p,keyInfo:v,url:y}=g;if(!p.decryptdata||v!==this.keyUriToKeyInfo[y])return a(this.createKeyLoadError(p,$.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),f));v.decryptdata.key=p.decryptdata.key=new Uint8Array(h.data),p.keyLoader=null,v.loader=null,o({frag:p,keyInfo:v})},onError:(h,d,g,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,$.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),g,lt({url:A.url,data:void 0},h)))},onTimeout:(h,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,$.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),g))},onAbort:(h,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,$.INTERNAL_ABORTED,new Error("key loading aborted"),g))}};n.load(A,c,u)})}resetLoader(e){const{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[r],n&&n.destroy()}}function qu(){return self.SourceBuffer||self.WebKitSourceBuffer}function ju(){if(!zi())return!1;const e=qu();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function XI(){if(!ju())return!1;const s=zi();return typeof(s==null?void 0:s.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>s.isTypeSupported(Ar(e,"video")))||["mp4a.40.2","fLaC"].some(e=>s.isTypeSupported(Ar(e,"audio"))))}function zI(){var s;const e=qu();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const ZI=250,Fn=2,em=.1,tm=.05;class im{constructor(e,t,i,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=r}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:r,stalled:n}=this;if(r===null)return;const{currentTime:o,seeking:a}=r,A=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),n!==null){if(this.stallReported){const p=self.performance.now()-n;N.warn(`playback not stuck anymore @${o}, after ${Math.round(p)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||A){this.stalled=null;return}if(r.paused&&!a||r.ended||r.playbackRate===0||!Ye.getBuffered(r).length){this.nudgeRetry=0;return}const c=Ye.bufferInfo(r,o,0),u=c.nextStart||0;if(a){const p=c.len>Fn,v=!u||t&&t.start<=o||u-o>Fn&&!this.fragmentTracker.getPartialFragment(o);if(p||v)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var h;if(!(c.len>0)&&!u)return;const v=Math.max(u,c.start||0)-o,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,m=(y==null||(h=y.details)==null?void 0:h.live)?y.details.targetduration*2:Fn,b=this.fragmentTracker.getPartialFragment(o);if(v>0&&(v<=m||b)){r.paused||this._trySkipBufferHole(b);return}}const d=self.performance.now();if(n===null){this.stalled=d;return}const g=d-n;if(!a&&g>=ZI&&(this._reportStall(c),!this.media))return;const f=Ye.bufferInfo(r,o,i.maxBufferHole);this._tryFixBufferStall(f,g)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:r,media:n}=this;if(n===null)return;const o=n.currentTime,a=r.getPartialFragment(o);a&&(this._trySkipBufferHole(a)||!this.media)||(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-o<i.maxBufferHole)&&t>i.highBufferWatchdogPeriod*1e3&&(N.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:r}=this;if(!r&&i){this.stallReported=!0;const n=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);N.warn(n.message),t.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:r}=this;if(r===null)return 0;const n=r.currentTime,o=Ye.bufferInfo(r,n,0),a=n<o.start?o.start:o.nextStart;if(a){const A=o.len<=t.maxBufferHole,l=o.len>0&&o.len<1&&r.readyState<3,c=a-n;if(c>0&&(A||l)){if(c>t.maxBufferHole){const{fragmentTracker:h}=this;let d=!1;if(n===0){const g=h.getAppendedFrag(0,de.MAIN);g&&a<g.end&&(d=!0)}if(!d){const g=e||h.getAppendedFrag(n,de.MAIN);if(g){let f=!1,p=g.end;for(;p<a;){const v=h.getPartialFragment(p);if(v)p+=v.duration;else{f=!0;break}}if(f)return 0}}}const u=Math.max(a+tm,n+em);if(N.warn(`skipping hole, adjusting currentTime from ${n} to ${u}`),this.moved=!0,this.stalled=null,r.currentTime=u,e&&!e.gap){const h=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${u}`);i.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:e})}return u}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:i,nudgeRetry:r}=this;if(i===null)return;const n=i.currentTime;if(this.nudgeRetry++,r<e.nudgeMaxRetry){const o=n+(r+1)*e.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${n} to ${o}`);N.warn(a.message),i.currentTime=o,t.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const o=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);N.error(o.message),t.trigger(E.ERROR,{type:Ee.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const sm=100;class rm extends la{constructor(e,t,i){super(e,t,i,"[stream-controller]",de.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(E.ERROR,this.onError,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(E.ERROR,this.onError,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:i}=this;if(this.stopLoad(),this.setInterval(sm),this.level=-1,!this.startFragRequested){let r=i.startLevel;r===-1&&(i.config.testBandwidth&&this.levels.length>1?(r=0,this.bitrateTest=!0):r=i.firstAutoLevel),i.nextLoadLevel=r,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=X.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=X.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case X.WAITING_LEVEL:{const{levels:t,level:i}=this,r=t==null?void 0:t[i],n=r==null?void 0:r.details;if(n&&(!n.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(n))break;this.state=X.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=X.IDLE;break}break}case X.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:r,level:n}=this,o=r==null?void 0:r[n];this.resetStartWhenNotLoaded(o||null),this.state=X.IDLE}}break}this.state===X.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:r}=this;if(t===null||!r&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=e.nextLoadLevel;if(!(i!=null&&i[n]))return;const o=i[n],a=this.getMainFwdBufferInfo();if(a===null)return;const A=this.getLevelDetails();if(A&&this._streamEnded(a,A)){const f={};this.altAudio&&(f.type="video"),this.hls.trigger(E.BUFFER_EOS,f),this.state=X.ENDED;return}e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const l=o.details;if(!l||this.state===X.WAITING_LEVEL||l.live&&this.levelLastLoaded!==o){this.level=n,this.state=X.WAITING_LEVEL;return}const c=a.len,u=this.getMaxBufferLength(o.maxBitrate);if(c>=u)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:a.end;let d=this.getNextFragment(h,l);if(this.couldBacktrack&&!this.fragPrevious&&d&&d.sn!=="initSegment"&&this.fragmentTracker.getState(d)!==ct.OK){var g;const p=((g=this.backtrackFragment)!=null?g:d).sn-l.startSN,v=l.fragments[p-1];v&&d.cc===v.cc&&(d=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(d&&this.isLoopLoading(d,h)){if(!d.gap){const p=this.audioOnly&&!this.altAudio?Pe.AUDIO:Pe.VIDEO,v=(p===Pe.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,p,de.MAIN)}d=this.getNextFragmentLoopLoading(d,l,a,de.MAIN,u)}d&&(d.initSegment&&!d.initSegment.data&&!this.bitrateTest&&(d=d.initSegment),this.loadFragment(d,o,h))}loadFragment(e,t,i){const r=this.fragmentTracker.getState(e);this.fragCurrent=e,r===ct.NOT_LOADED||r===ct.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,de.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<n.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,A=e[a],l=this.fragLastKbps;l&&this.fragCurrent?i=this.fragCurrent.duration*A.maxBitrate/(1e3*l)+1:i=0}else i=0;const o=this.getBufferedFrag(t.currentTime+i);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const A=a.maxStartPTS?a.maxStartPTS:a.start,l=a.duration,c=Math.max(o.end,A+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,l*(this.couldBacktrack?.5:.125)),l*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(c,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case X.KEY_LOADING:case X.FRAG_LOADING:case X.FRAG_LOADING_WAITING_RETRY:case X.PARSING:case X.PARSED:this.state=X.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new im(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;oe(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();if(i===null||i.len===0){this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(E.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,r=!1;t.levels.forEach(n=>{const o=n.audioCodec;o&&(i=i||o.indexOf("mp4a.40.2")!==-1,r=r||o.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&r&&!zI(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==X.IDLE)return;const r=i[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(r.details))&&(this.state=X.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:r}=this,n=t.level,o=t.details,a=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const A=r[n],l=this.fragCurrent;l&&(this.state===X.FRAG_LOADING||this.state===X.FRAG_LOADING_WAITING_RETRY)&&l.level!==t.level&&l.loader&&this.abortCurrentFrag();let c=0;if(o.live||(i=A.details)!=null&&i.live){var u;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,A.details,(u=this.levelLastLoaded)==null?void 0:u.details)}if(A.details=o,this.levelLastLoaded=A,this.hls.trigger(E.LEVEL_UPDATED,{details:o,level:n}),this.state===X.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=X.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,c),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:r,payload:n}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const a=o[i.level],A=a.details;if(!A){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const l=a.videoCodec,c=A.PTSKnown||!A.live,u=(t=i.initSegment)==null?void 0:t.data,h=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new du(this.hls,de.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=r?r.index:-1,f=g!==-1,p=new aa(i.level,i.sn,i.stats.chunkCount,n.byteLength,g,f),v=this.initPTS[i.cc];d.push(n,u,h,l,i,r,A.totalduration,c,p,v)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const n=this.hls;i&&(n.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(E.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,r=!!this.hls.audioTracks[i].url;if(r){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()}onBufferCreated(e,t){const i=t.tracks;let r,n,o=!1;for(const a in i){const A=i[a];if(A.id==="main"){if(n=a,r=A,a==="video"){const l=i[a];l&&(this.videoBuffer=l.buffer)}}else o=!0}o&&r?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:r}=t;if(i&&i.type!==de.MAIN)return;if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${r?" p: "+r.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===X.PARSED&&(this.state=X.IDLE);return}const n=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=X.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(de.MAIN,t);break;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===X.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===Le.LEVEL&&(this.state=X.IDLE);break;case $.BUFFER_APPEND_ERROR:case $.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===$.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Ye.getBuffered(e).length){const i=this.state!==X.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,i)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=X.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Pe.AUDIO||this.audioOnly&&!this.altAudio){const i=(t===Pe.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,t,de.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const r=Ye.getBuffered(e),o=(r.length?r.start(0):0)-i;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),i+=o,this.startPosition=i),this.log(`seek to target start position ${i} from current time ${t}`),e.currentTime=i}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:r}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=X.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),r.trigger(E.FRAG_LOADED,i),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i="main",{hls:r}=this,{remuxResult:n,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:A,part:l,level:c}=a,{video:u,text:h,id3:d,initSegment:g}=n,{details:f}=c,p=this.altAudio?void 0:n.audio;if(this.fragContextChanged(A)){this.fragmentTracker.removeFragment(A);return}if(this.state=X.PARSING,g){if(g!=null&&g.tracks){const Q=A.initSegment||A;this._bufferInitSegment(c,g.tracks,Q,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:Q,id:i,tracks:g.tracks})}const v=g.initPTS,y=g.timescale;oe(v)&&(this.initPTS[A.cc]={baseTime:v,timescale:y},r.trigger(E.INIT_PTS_FOUND,{frag:A,id:i,initPTS:v,timescale:y}))}if(u&&f&&A.sn!=="initSegment"){const v=f.fragments[A.sn-1-f.startSN],y=A.sn===f.startSN,Q=!v||A.cc>v.cc;if(n.independent!==!1){const{startPTS:m,endPTS:b,startDTS:x,endDTS:B}=u;if(l)l.elementaryStreams[u.type]={startPTS:m,endPTS:b,startDTS:x,endDTS:B};else if(u.firstKeyFrame&&u.independent&&o.id===1&&!Q&&(this.couldBacktrack=!0),u.dropped&&u.independent){const H=this.getMainFwdBufferInfo(),_=(H?H.end:this.getLoadPosition())+this.config.maxBufferHole,k=u.firstKeyFramePTS?u.firstKeyFramePTS:m;if(!y&&_<k-this.config.maxBufferHole&&!Q){this.backtrack(A);return}else Q&&(A.gap=!0);A.setElementaryStreamInfo(u.type,A.start,b,A.start,B,!0)}else y&&m>Fn&&(A.gap=!0);A.setElementaryStreamInfo(u.type,m,b,x,B),this.backtrackFragment&&(this.backtrackFragment=A),this.bufferFragmentData(u,A,l,o,y||Q)}else if(y||Q)A.gap=!0;else{this.backtrack(A);return}}if(p){const{startPTS:v,endPTS:y,startDTS:Q,endDTS:m}=p;l&&(l.elementaryStreams[Pe.AUDIO]={startPTS:v,endPTS:y,startDTS:Q,endDTS:m}),A.setElementaryStreamInfo(Pe.AUDIO,v,y,Q,m),this.bufferFragmentData(p,A,l,o)}if(f&&d!=null&&(t=d.samples)!=null&&t.length){const v={id:i,frag:A,details:f,samples:d.samples};r.trigger(E.FRAG_PARSING_METADATA,v)}if(f&&h){const v={id:i,frag:A,details:f,samples:h.samples};r.trigger(E.FRAG_PARSING_USERDATA,v)}}_bufferInitSegment(e,t,i,r){if(this.state!==X.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:n,video:o,audiovideo:a}=t;if(n){let A=e.audioCodec;const l=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){A&&(A.indexOf("mp4a.40.5")!==-1?A="mp4a.40.2":A="mp4a.40.5");const c=n.metadata;c&&"channelCount"in c&&(c.channelCount||1)!==1&&l.indexOf("firefox")===-1&&(A="mp4a.40.5")}A&&A.indexOf("mp4a.40.5")!==-1&&l.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(A="mp4a.40.2",this.log(`Android: force audio codec to ${A}`)),e.audioCodec&&e.audioCodec!==A&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${A}"`),n.levelCodec=A,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${A||""}/${e.audioCodec||""}/${n.codec}]`)}o&&(o.levelCodec=e.videoCodec,o.id="main",this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${o.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${e.codecs}/${a.codec}]`),this.hls.trigger(E.BUFFER_CODECS,t),Object.keys(t).forEach(A=>{const c=t[A].initSegment;c!=null&&c.byteLength&&this.hls.trigger(E.BUFFER_APPENDING,{type:A,data:c,frag:i,part:null,chunkMeta:r,parent:i.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,de.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=X.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Ye.isBuffered(e,i)?t=this.getAppendedFrag(i):Ye.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,n=t.level;(!r||t.sn!==r.sn||r.level!==n)&&(this.fragPlaying=t,this.hls.trigger(E.FRAG_CHANGED,{frag:t}),(!r||r.level!==n)&&this.hls.trigger(E.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&oe(t)&&oe(i.programDateTime)){const r=i.programDateTime+(t-i.start)*1e3;return new Date(r)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class Si{static get version(){return"1.5.11"}static isMSESupported(){return ju()}static isSupported(){return XI()}static getMediaSource(){return zi()}static get Events(){return E}static get ErrorTypes(){return Ee}static get ErrorDetails(){return $}static get DefaultConfig(){return Si.defaultConfig?Si.defaultConfig:Ju}static set DefaultConfig(e){Si.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Ia,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,Vf(e.debug||!1,"Hls instance");const t=this.config=JI(Si.DefaultConfig,e);this.userConfig=e,t.progressive&&WI(t);const{abrController:i,bufferController:r,capLevelController:n,errorController:o,fpsController:a}=t,A=new o(this),l=this.abrController=new i(this),c=this.bufferController=new r(this),u=this.capLevelController=new n(this),h=new a(this),d=new U0(this),g=new K0(this),f=t.contentSteeringController,p=f?new f(this):null,v=this.levelController=new qI(this,p),y=new Cp(this),Q=new jI(this.config),m=this.streamController=new rm(this,y,Q);u.setStreamController(m),h.setStreamController(m);const b=[d,v,m];p&&b.splice(1,0,p),this.networkControllers=b;const x=[l,c,u,h,g,y];this.audioTrackController=this.createController(t.audioTrackController,b);const B=t.audioStreamController;B&&b.push(new B(this,y,Q)),this.subtitleTrackController=this.createController(t.subtitleTrackController,b);const H=t.subtitleStreamController;H&&b.push(new H(this,y,Q)),this.createController(t.timelineController,x),Q.emeController=this.emeController=this.createController(t.emeController,x),this.cmcdController=this.createController(t.cmcdController,x),this.latencyController=this.createController(V0,x),this.coreComponents=x,b.push(A);const _=A.onErrorOut;typeof _=="function"&&this.on(E.ERROR,_,A)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,r){this._emitter.off(e,t,i,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(N.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const r=e===E.ERROR;this.trigger(E.ERROR,{type:Ee.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:r,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){N.log("destroy"),this.trigger(E.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){N.log("attachMedia"),this._media=e,this.trigger(E.MEDIA_ATTACHING,{media:e})}detachMedia(){N.log("detachMedia"),this.trigger(E.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,r=this.url=Mo.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,N.log(`loadSource:${r}`),t&&i&&(i!==r||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(E.MANIFEST_LOADING,{url:e})}startLoad(e=-1){N.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){N.log("stopLoad"),this.started=!1,this.networkControllers.forEach(e=>{e.stopLoad()})}resumeBuffering(){this.started&&this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.startLoad(-1)})}pauseBuffering(){this.networkControllers.forEach(e=>{"fragmentLoader"in e&&e.stopLoad()})}swapAudioCodec(){N.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){N.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){N.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){N.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){N.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){N.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){N.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(N.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){J0(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,i)for(let n=r;n--;){const o=e[n].attrs["HDCP-LEVEL"];if(o&&o<=i)return n}return r}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}Si.defaultConfig=void 0;function nm(s){return s&&s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function om(s){return s}function am(s,e){e=e||{};const t=e.delimiter||".",i=e.maxDepth,r=e.transformKey||om,n={};function o(a,A,l){l=l||1,Object.keys(a).forEach(function(c){const u=a[c],h=e.safe&&Array.isArray(u),d=Object.prototype.toString.call(u),g=nm(u),f=d==="[object Object]"||d==="[object Array]",p=A?A+t+r(c):r(c);if(!h&&!g&&f&&Object.keys(u).length&&(!e.maxDepth||l<i))return o(u,p,l+1);n[p]=u})}return o(s),n}var Xu=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function Am(s,e){return!!(s===e||Xu(s)&&Xu(e))}function lm(s,e){if(s.length!==e.length)return!1;for(var t=0;t<s.length;t++)if(!Am(s[t],e[t]))return!1;return!0}function cm(s,e){e===void 0&&(e=lm);var t=null;function i(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t&&t.lastThis===this&&e(r,t.lastArgs))return t.lastResult;var o=s.apply(this,r);return t={lastResult:o,lastArgs:r,lastThis:this},o}return i.clear=function(){t=null},i}/**
183
187
  * @license
184
188
  * Copyright 2017 Google LLC
185
189
  * SPDX-License-Identifier: BSD-3-Clause
186
- */const Uh=(s,e,t)=>{const i=new Map;for(let r=e;r<=t;r++)i.set(s[r],r);return i},Ph=os(class extends Vs{constructor(s){if(super(s),s.type!==ns.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const r=[],n=[];let o=0;for(const a of s)r[o]=i?i(a,o):o,n[o]=t(a,o),o++;return{values:n,keys:r}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,i]){const r=gd(s),{values:n,keys:o}=this.dt(e,t,i);if(!Array.isArray(r))return this.ut=o,n;const a=this.ut??(this.ut=[]),A=[];let l,c,h=0,u=r.length-1,d=0,g=n.length-1;for(;h<=u&&d<=g;)if(r[h]===null)h++;else if(r[u]===null)u--;else if(a[h]===o[d])A[d]=Ki(r[h],n[d]),h++,d++;else if(a[u]===o[g])A[g]=Ki(r[u],n[g]),u--,g--;else if(a[h]===o[g])A[g]=Ki(r[h],n[g]),Ys(s,A[g+1],r[h]),h++,g--;else if(a[u]===o[d])A[d]=Ki(r[u],n[d]),Ys(s,r[h],r[u]),u--,d++;else if(l===void 0&&(l=Uh(o,d,g),c=Uh(a,h,u)),l.has(a[h]))if(l.has(a[u])){const f=c.get(o[d]),E=f!==void 0?r[f]:null;if(E===null){const B=Ys(s,r[h]);Ki(B,n[d]),A[d]=B}else A[d]=Ki(E,n[d]),Ys(s,r[h],E),r[f]=null;d++}else Jn(r[u]),u--;else Jn(r[h]),h++;for(;d<=g;){const f=Ys(s,A[g+1]);Ki(f,n[d]),A[d++]=f}for(;h<=u;){const f=r[h++];f!==null&&Jn(f)}return this.ut=o,dd(s,A),Gt}});var wt="top",Ot="bottom",Nt="right",St="left",ma="auto",or=[wt,Ot,Nt,St],Ss="start",ar="end",_I="clippingParents",Gh="viewport",Ar="popper",FI="reference",Hh=or.reduce(function(s,e){return s.concat([e+"-"+Ss,e+"-"+ar])},[]),$h=[].concat(or,[ma]).reduce(function(s,e){return s.concat([e,e+"-"+Ss,e+"-"+ar])},[]),OI="beforeRead",NI="read",UI="afterRead",PI="beforeMain",GI="main",HI="afterMain",$I="beforeWrite",KI="write",YI="afterWrite",VI=[OI,NI,UI,PI,GI,HI,$I,KI,YI];function ni(s){return s?(s.nodeName||"").toLowerCase():null}function Rt(s){if(s==null)return window;if(s.toString()!=="[object Window]"){var e=s.ownerDocument;return e&&e.defaultView||window}return s}function ji(s){var e=Rt(s).Element;return s instanceof e||s instanceof Element}function Ut(s){var e=Rt(s).HTMLElement;return s instanceof e||s instanceof HTMLElement}function Ba(s){if(typeof ShadowRoot>"u")return!1;var e=Rt(s).ShadowRoot;return s instanceof e||s instanceof ShadowRoot}function JI(s){var e=s.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},r=e.attributes[t]||{},n=e.elements[t];!Ut(n)||!ni(n)||(Object.assign(n.style,i),Object.keys(r).forEach(function(o){var a=r[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function WI(s){var e=s.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var r=e.elements[i],n=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(A,l){return A[l]="",A},{});!Ut(r)||!ni(r)||(Object.assign(r.style,a),Object.keys(n).forEach(function(A){r.removeAttribute(A)}))})}}const Kh={name:"applyStyles",enabled:!0,phase:"write",fn:JI,effect:WI,requires:["computeStyles"]};function oi(s){return s.split("-")[0]}var Xi=Math.max,Bn=Math.min,Ds=Math.round;function ya(){var s=navigator.userAgentData;return s!=null&&s.brands&&Array.isArray(s.brands)?s.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Yh(){return!/^((?!chrome|android).)*safari/i.test(ya())}function bs(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=s.getBoundingClientRect(),r=1,n=1;e&&Ut(s)&&(r=s.offsetWidth>0&&Ds(i.width)/s.offsetWidth||1,n=s.offsetHeight>0&&Ds(i.height)/s.offsetHeight||1);var o=ji(s)?Rt(s):window,a=o.visualViewport,A=!Yh()&&t,l=(i.left+(A&&a?a.offsetLeft:0))/r,c=(i.top+(A&&a?a.offsetTop:0))/n,h=i.width/r,u=i.height/n;return{width:h,height:u,top:c,right:l+h,bottom:c+u,left:l,x:l,y:c}}function Qa(s){var e=bs(s),t=s.offsetWidth,i=s.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:s.offsetLeft,y:s.offsetTop,width:t,height:i}}function Vh(s,e){var t=e.getRootNode&&e.getRootNode();if(s.contains(e))return!0;if(t&&Ba(t)){var i=e;do{if(i&&s.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function vi(s){return Rt(s).getComputedStyle(s)}function qI(s){return["table","td","th"].indexOf(ni(s))>=0}function _i(s){return((ji(s)?s.ownerDocument:s.document)||window.document).documentElement}function yn(s){return ni(s)==="html"?s:s.assignedSlot||s.parentNode||(Ba(s)?s.host:null)||_i(s)}function Jh(s){return!Ut(s)||vi(s).position==="fixed"?null:s.offsetParent}function jI(s){var e=/firefox/i.test(ya()),t=/Trident/i.test(ya());if(t&&Ut(s)){var i=vi(s);if(i.position==="fixed")return null}var r=yn(s);for(Ba(r)&&(r=r.host);Ut(r)&&["html","body"].indexOf(ni(r))<0;){var n=vi(r);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return r;r=r.parentNode}return null}function lr(s){for(var e=Rt(s),t=Jh(s);t&&qI(t)&&vi(t).position==="static";)t=Jh(t);return t&&(ni(t)==="html"||ni(t)==="body"&&vi(t).position==="static")?e:t||jI(s)||e}function va(s){return["top","bottom"].indexOf(s)>=0?"x":"y"}function cr(s,e,t){return Xi(s,Bn(e,t))}function XI(s,e,t){var i=cr(s,e,t);return i>t?t:i}function Wh(){return{top:0,right:0,bottom:0,left:0}}function qh(s){return Object.assign({},Wh(),s)}function jh(s,e){return e.reduce(function(t,i){return t[i]=s,t},{})}var ZI=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,qh(typeof e!="number"?e:jh(e,or))};function zI(s){var e,t=s.state,i=s.name,r=s.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=oi(t.placement),A=va(a),l=[St,Nt].indexOf(a)>=0,c=l?"height":"width";if(!(!n||!o)){var h=ZI(r.padding,t),u=Qa(n),d=A==="y"?wt:St,g=A==="y"?Ot:Nt,f=t.rects.reference[c]+t.rects.reference[A]-o[A]-t.rects.popper[c],E=o[A]-t.rects.reference[A],B=lr(n),S=B?A==="y"?B.clientHeight||0:B.clientWidth||0:0,Q=f/2-E/2,m=h[d],y=S-u[c]-h[g],L=S/2-u[c]/2+Q,v=cr(m,L,y),F=A;t.modifiersData[i]=(e={},e[F]=v,e.centerOffset=v-L,e)}}function eC(s){var e=s.state,t=s.options,i=t.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||Vh(e.elements.popper,r)&&(e.elements.arrow=r))}const tC={name:"arrow",enabled:!0,phase:"main",fn:zI,effect:eC,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Rs(s){return s.split("-")[1]}var iC={top:"auto",right:"auto",bottom:"auto",left:"auto"};function sC(s,e){var t=s.x,i=s.y,r=e.devicePixelRatio||1;return{x:Ds(t*r)/r||0,y:Ds(i*r)/r||0}}function Xh(s){var e,t=s.popper,i=s.popperRect,r=s.placement,n=s.variation,o=s.offsets,a=s.position,A=s.gpuAcceleration,l=s.adaptive,c=s.roundOffsets,h=s.isFixed,u=o.x,d=u===void 0?0:u,g=o.y,f=g===void 0?0:g,E=typeof c=="function"?c({x:d,y:f}):{x:d,y:f};d=E.x,f=E.y;var B=o.hasOwnProperty("x"),S=o.hasOwnProperty("y"),Q=St,m=wt,y=window;if(l){var L=lr(t),v="clientHeight",F="clientWidth";if(L===Rt(t)&&(L=_i(t),vi(L).position!=="static"&&a==="absolute"&&(v="scrollHeight",F="scrollWidth")),L=L,r===wt||(r===St||r===Nt)&&n===ar){m=Ot;var G=h&&L===y&&y.visualViewport?y.visualViewport.height:L[v];f-=G-i.height,f*=A?1:-1}if(r===St||(r===wt||r===Ot)&&n===ar){Q=Nt;var M=h&&L===y&&y.visualViewport?y.visualViewport.width:L[F];d-=M-i.width,d*=A?1:-1}}var H=Object.assign({position:a},l&&iC),j=c===!0?sC({x:d,y:f},Rt(t)):{x:d,y:f};if(d=j.x,f=j.y,A){var U;return Object.assign({},H,(U={},U[m]=S?"0":"",U[Q]=B?"0":"",U.transform=(y.devicePixelRatio||1)<=1?"translate("+d+"px, "+f+"px)":"translate3d("+d+"px, "+f+"px, 0)",U))}return Object.assign({},H,(e={},e[m]=S?f+"px":"",e[Q]=B?d+"px":"",e.transform="",e))}function rC(s){var e=s.state,t=s.options,i=t.gpuAcceleration,r=i===void 0?!0:i,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,A=a===void 0?!0:a,l={placement:oi(e.placement),variation:Rs(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Xh(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:A})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Xh(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:A})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const nC={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:rC,data:{}};var Qn={passive:!0};function oC(s){var e=s.state,t=s.instance,i=s.options,r=i.scroll,n=r===void 0?!0:r,o=i.resize,a=o===void 0?!0:o,A=Rt(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&l.forEach(function(c){c.addEventListener("scroll",t.update,Qn)}),a&&A.addEventListener("resize",t.update,Qn),function(){n&&l.forEach(function(c){c.removeEventListener("scroll",t.update,Qn)}),a&&A.removeEventListener("resize",t.update,Qn)}}const aC={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:oC,data:{}};var AC={left:"right",right:"left",bottom:"top",top:"bottom"};function vn(s){return s.replace(/left|right|bottom|top/g,function(e){return AC[e]})}var lC={start:"end",end:"start"};function Zh(s){return s.replace(/start|end/g,function(e){return lC[e]})}function wa(s){var e=Rt(s),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function Sa(s){return bs(_i(s)).left+wa(s).scrollLeft}function cC(s,e){var t=Rt(s),i=_i(s),r=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,A=0;if(r){n=r.width,o=r.height;var l=Yh();(l||!l&&e==="fixed")&&(a=r.offsetLeft,A=r.offsetTop)}return{width:n,height:o,x:a+Sa(s),y:A}}function hC(s){var e,t=_i(s),i=wa(s),r=(e=s.ownerDocument)==null?void 0:e.body,n=Xi(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=Xi(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+Sa(s),A=-i.scrollTop;return vi(r||t).direction==="rtl"&&(a+=Xi(t.clientWidth,r?r.clientWidth:0)-n),{width:n,height:o,x:a,y:A}}function Da(s){var e=vi(s),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function zh(s){return["html","body","#document"].indexOf(ni(s))>=0?s.ownerDocument.body:Ut(s)&&Da(s)?s:zh(yn(s))}function hr(s,e){var t;e===void 0&&(e=[]);var i=zh(s),r=i===((t=s.ownerDocument)==null?void 0:t.body),n=Rt(i),o=r?[n].concat(n.visualViewport||[],Da(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(hr(yn(o)))}function ba(s){return Object.assign({},s,{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height})}function uC(s,e){var t=bs(s,!1,e==="fixed");return t.top=t.top+s.clientTop,t.left=t.left+s.clientLeft,t.bottom=t.top+s.clientHeight,t.right=t.left+s.clientWidth,t.width=s.clientWidth,t.height=s.clientHeight,t.x=t.left,t.y=t.top,t}function eu(s,e,t){return e===Gh?ba(cC(s,t)):ji(e)?uC(e,t):ba(hC(_i(s)))}function dC(s){var e=hr(yn(s)),t=["absolute","fixed"].indexOf(vi(s).position)>=0,i=t&&Ut(s)?lr(s):s;return ji(i)?e.filter(function(r){return ji(r)&&Vh(r,i)&&ni(r)!=="body"}):[]}function gC(s,e,t,i){var r=e==="clippingParents"?dC(s):[].concat(e),n=[].concat(r,[t]),o=n[0],a=n.reduce(function(A,l){var c=eu(s,l,i);return A.top=Xi(c.top,A.top),A.right=Bn(c.right,A.right),A.bottom=Bn(c.bottom,A.bottom),A.left=Xi(c.left,A.left),A},eu(s,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function tu(s){var e=s.reference,t=s.element,i=s.placement,r=i?oi(i):null,n=i?Rs(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,A;switch(r){case wt:A={x:o,y:e.y-t.height};break;case Ot:A={x:o,y:e.y+e.height};break;case Nt:A={x:e.x+e.width,y:a};break;case St:A={x:e.x-t.width,y:a};break;default:A={x:e.x,y:e.y}}var l=r?va(r):null;if(l!=null){var c=l==="y"?"height":"width";switch(n){case Ss:A[l]=A[l]-(e[c]/2-t[c]/2);break;case ar:A[l]=A[l]+(e[c]/2-t[c]/2);break}}return A}function ur(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=i===void 0?s.placement:i,n=t.strategy,o=n===void 0?s.strategy:n,a=t.boundary,A=a===void 0?_I:a,l=t.rootBoundary,c=l===void 0?Gh:l,h=t.elementContext,u=h===void 0?Ar:h,d=t.altBoundary,g=d===void 0?!1:d,f=t.padding,E=f===void 0?0:f,B=qh(typeof E!="number"?E:jh(E,or)),S=u===Ar?FI:Ar,Q=s.rects.popper,m=s.elements[g?S:u],y=gC(ji(m)?m:m.contextElement||_i(s.elements.popper),A,c,o),L=bs(s.elements.reference),v=tu({reference:L,element:Q,strategy:"absolute",placement:r}),F=ba(Object.assign({},Q,v)),G=u===Ar?F:L,M={top:y.top-G.top+B.top,bottom:G.bottom-y.bottom+B.bottom,left:y.left-G.left+B.left,right:G.right-y.right+B.right},H=s.modifiersData.offset;if(u===Ar&&H){var j=H[r];Object.keys(M).forEach(function(U){var J=[Nt,Ot].indexOf(U)>=0?1:-1,w=[wt,Ot].indexOf(U)>=0?"y":"x";M[U]+=j[w]*J})}return M}function fC(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,A=t.allowedAutoPlacements,l=A===void 0?$h:A,c=Rs(i),h=c?a?Hh:Hh.filter(function(g){return Rs(g)===c}):or,u=h.filter(function(g){return l.indexOf(g)>=0});u.length===0&&(u=h);var d=u.reduce(function(g,f){return g[f]=ur(s,{placement:f,boundary:r,rootBoundary:n,padding:o})[oi(f)],g},{});return Object.keys(d).sort(function(g,f){return d[g]-d[f]})}function EC(s){if(oi(s)===ma)return[];var e=vn(s);return[Zh(s),e,Zh(e)]}function pC(s){var e=s.state,t=s.options,i=s.name;if(!e.modifiersData[i]._skip){for(var r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!0:o,A=t.fallbackPlacements,l=t.padding,c=t.boundary,h=t.rootBoundary,u=t.altBoundary,d=t.flipVariations,g=d===void 0?!0:d,f=t.allowedAutoPlacements,E=e.options.placement,B=oi(E),S=B===E,Q=A||(S||!g?[vn(E)]:EC(E)),m=[E].concat(Q).reduce(function(ie,ce){return ie.concat(oi(ce)===ma?fC(e,{placement:ce,boundary:c,rootBoundary:h,padding:l,flipVariations:g,allowedAutoPlacements:f}):ce)},[]),y=e.rects.reference,L=e.rects.popper,v=new Map,F=!0,G=m[0],M=0;M<m.length;M++){var H=m[M],j=oi(H),U=Rs(H)===Ss,J=[wt,Ot].indexOf(j)>=0,w=J?"width":"height",D=ur(e,{placement:H,boundary:c,rootBoundary:h,altBoundary:u,padding:l}),X=J?U?Nt:St:U?Ot:wt;y[w]>L[w]&&(X=vn(X));var R=vn(X),b=[];if(n&&b.push(D[j]<=0),a&&b.push(D[X]<=0,D[R]<=0),b.every(function(ie){return ie})){G=H,F=!1;break}v.set(H,b)}if(F)for(var T=g?3:1,K=function(ce){var he=m.find(function(se){var Qe=v.get(se);if(Qe)return Qe.slice(0,ce).every(function(Se){return Se})});if(he)return G=he,"break"},P=T;P>0;P--){var q=K(P);if(q==="break")break}e.placement!==G&&(e.modifiersData[i]._skip=!0,e.placement=G,e.reset=!0)}}const IC={name:"flip",enabled:!0,phase:"main",fn:pC,requiresIfExists:["offset"],data:{_skip:!1}};function iu(s,e,t){return t===void 0&&(t={x:0,y:0}),{top:s.top-e.height-t.y,right:s.right-e.width+t.x,bottom:s.bottom-e.height+t.y,left:s.left-e.width-t.x}}function su(s){return[wt,Nt,Ot,St].some(function(e){return s[e]>=0})}function CC(s){var e=s.state,t=s.name,i=e.rects.reference,r=e.rects.popper,n=e.modifiersData.preventOverflow,o=ur(e,{elementContext:"reference"}),a=ur(e,{altBoundary:!0}),A=iu(o,i),l=iu(a,r,n),c=su(A),h=su(l);e.modifiersData[t]={referenceClippingOffsets:A,popperEscapeOffsets:l,isReferenceHidden:c,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":h})}const mC={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:CC};function BC(s,e,t){var i=oi(s),r=[St,wt].indexOf(i)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:s})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*r,[St,Nt].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function yC(s){var e=s.state,t=s.options,i=s.name,r=t.offset,n=r===void 0?[0,0]:r,o=$h.reduce(function(c,h){return c[h]=BC(h,e.rects,n),c},{}),a=o[e.placement],A=a.x,l=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=A,e.modifiersData.popperOffsets.y+=l),e.modifiersData[i]=o}const QC={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:yC};function vC(s){var e=s.state,t=s.name;e.modifiersData[t]=tu({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const wC={name:"popperOffsets",enabled:!0,phase:"read",fn:vC,data:{}};function SC(s){return s==="x"?"y":"x"}function DC(s){var e=s.state,t=s.options,i=s.name,r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!1:o,A=t.boundary,l=t.rootBoundary,c=t.altBoundary,h=t.padding,u=t.tether,d=u===void 0?!0:u,g=t.tetherOffset,f=g===void 0?0:g,E=ur(e,{boundary:A,rootBoundary:l,padding:h,altBoundary:c}),B=oi(e.placement),S=Rs(e.placement),Q=!S,m=va(B),y=SC(m),L=e.modifiersData.popperOffsets,v=e.rects.reference,F=e.rects.popper,G=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,M=typeof G=="number"?{mainAxis:G,altAxis:G}:Object.assign({mainAxis:0,altAxis:0},G),H=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,j={x:0,y:0};if(L){if(n){var U,J=m==="y"?wt:St,w=m==="y"?Ot:Nt,D=m==="y"?"height":"width",X=L[m],R=X+E[J],b=X-E[w],T=d?-F[D]/2:0,K=S===Ss?v[D]:F[D],P=S===Ss?-F[D]:-v[D],q=e.elements.arrow,ie=d&&q?Qa(q):{width:0,height:0},ce=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Wh(),he=ce[J],se=ce[w],Qe=cr(0,v[D],ie[D]),Se=Q?v[D]/2-T-Qe-he-M.mainAxis:K-Qe-he-M.mainAxis,Me=Q?-v[D]/2+T+Qe+se+M.mainAxis:P+Qe+se+M.mainAxis,de=e.elements.arrow&&lr(e.elements.arrow),oe=de?m==="y"?de.clientTop||0:de.clientLeft||0:0,ne=(U=H==null?void 0:H[m])!=null?U:0,we=X+Se-ne-oe,pe=X+Me-ne,Re=cr(d?Bn(R,we):R,X,d?Xi(b,pe):b);L[m]=Re,j[m]=Re-X}if(a){var De,Le=m==="x"?wt:St,qe=m==="x"?Ot:Nt,Oe=L[y],Ke=y==="y"?"height":"width",ve=Oe+E[Le],Ye=Oe-E[qe],dt=[wt,St].indexOf(B)!==-1,Tt=(De=H==null?void 0:H[y])!=null?De:0,nt=dt?ve:Oe-v[Ke]-F[Ke]-Tt+M.altAxis,Ct=dt?Oe+v[Ke]+F[Ke]-Tt-M.altAxis:Ye,Jt=d&&dt?XI(nt,Oe,Ct):cr(d?nt:ve,Oe,d?Ct:Ye);L[y]=Jt,j[y]=Jt-Oe}e.modifiersData[i]=j}}const bC={name:"preventOverflow",enabled:!0,phase:"main",fn:DC,requiresIfExists:["offset"]};function RC(s){return{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}}function xC(s){return s===Rt(s)||!Ut(s)?wa(s):RC(s)}function TC(s){var e=s.getBoundingClientRect(),t=Ds(e.width)/s.offsetWidth||1,i=Ds(e.height)/s.offsetHeight||1;return t!==1||i!==1}function LC(s,e,t){t===void 0&&(t=!1);var i=Ut(e),r=Ut(e)&&TC(e),n=_i(e),o=bs(s,r,t),a={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(i||!i&&!t)&&((ni(e)!=="body"||Da(n))&&(a=xC(e)),Ut(e)?(A=bs(e,!0),A.x+=e.clientLeft,A.y+=e.clientTop):n&&(A.x=Sa(n))),{x:o.left+a.scrollLeft-A.x,y:o.top+a.scrollTop-A.y,width:o.width,height:o.height}}function kC(s){var e=new Map,t=new Set,i=[];s.forEach(function(n){e.set(n.name,n)});function r(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var A=e.get(a);A&&r(A)}}),i.push(n)}return s.forEach(function(n){t.has(n.name)||r(n)}),i}function MC(s){var e=kC(s);return VI.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function _C(s){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(s())})})),e}}function FC(s){var e=s.reduce(function(t,i){var r=t[i.name];return t[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var ru={placement:"bottom",modifiers:[],strategy:"absolute"};function nu(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function OC(s){s===void 0&&(s={});var e=s,t=e.defaultModifiers,i=t===void 0?[]:t,r=e.defaultOptions,n=r===void 0?ru:r;return function(a,A,l){l===void 0&&(l=n);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},ru,n),modifiersData:{},elements:{reference:a,popper:A},attributes:{},styles:{}},h=[],u=!1,d={state:c,setOptions:function(B){var S=typeof B=="function"?B(c.options):B;f(),c.options=Object.assign({},n,c.options,S),c.scrollParents={reference:ji(a)?hr(a):a.contextElement?hr(a.contextElement):[],popper:hr(A)};var Q=MC(FC([].concat(i,c.options.modifiers)));return c.orderedModifiers=Q.filter(function(m){return m.enabled}),g(),d.update()},forceUpdate:function(){if(!u){var B=c.elements,S=B.reference,Q=B.popper;if(nu(S,Q)){c.rects={reference:LC(S,lr(Q),c.options.strategy==="fixed"),popper:Qa(Q)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(M){return c.modifiersData[M.name]=Object.assign({},M.data)});for(var m=0;m<c.orderedModifiers.length;m++){if(c.reset===!0){c.reset=!1,m=-1;continue}var y=c.orderedModifiers[m],L=y.fn,v=y.options,F=v===void 0?{}:v,G=y.name;typeof L=="function"&&(c=L({state:c,options:F,name:G,instance:d})||c)}}}},update:_C(function(){return new Promise(function(E){d.forceUpdate(),E(c)})}),destroy:function(){f(),u=!0}};if(!nu(a,A))return d;d.setOptions(l).then(function(E){!u&&l.onFirstUpdate&&l.onFirstUpdate(E)});function g(){c.orderedModifiers.forEach(function(E){var B=E.name,S=E.options,Q=S===void 0?{}:S,m=E.effect;if(typeof m=="function"){var y=m({state:c,name:B,instance:d,options:Q}),L=function(){};h.push(y||L)}})}function f(){h.forEach(function(E){return E()}),h=[]}return d}}var NC=[aC,wC,nC,Kh,QC,IC,bC,tC,mC],UC=OC({defaultModifiers:NC}),PC="tippy-box",ou="tippy-content",GC="tippy-backdrop",au="tippy-arrow",Au="tippy-svg-arrow",Zi={passive:!0,capture:!0},lu=function(){return document.body};function Ra(s,e,t){if(Array.isArray(s)){var i=s[e];return i??(Array.isArray(t)?t[e]:t)}return s}function xa(s,e){var t={}.toString.call(s);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function cu(s,e){return typeof s=="function"?s.apply(void 0,e):s}function hu(s,e){if(e===0)return s;var t;return function(i){clearTimeout(t),t=setTimeout(function(){s(i)},e)}}function HC(s){return s.split(/\s+/).filter(Boolean)}function xs(s){return[].concat(s)}function uu(s,e){s.indexOf(e)===-1&&s.push(e)}function $C(s){return s.filter(function(e,t){return s.indexOf(e)===t})}function KC(s){return s.split("-")[0]}function wn(s){return[].slice.call(s)}function du(s){return Object.keys(s).reduce(function(e,t){return s[t]!==void 0&&(e[t]=s[t]),e},{})}function dr(){return document.createElement("div")}function Sn(s){return["Element","Fragment"].some(function(e){return xa(s,e)})}function YC(s){return xa(s,"NodeList")}function VC(s){return xa(s,"MouseEvent")}function JC(s){return!!(s&&s._tippy&&s._tippy.reference===s)}function WC(s){return Sn(s)?[s]:YC(s)?wn(s):Array.isArray(s)?s:wn(document.querySelectorAll(s))}function Ta(s,e){s.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function gu(s,e){s.forEach(function(t){t&&t.setAttribute("data-state",e)})}function qC(s){var e,t=xs(s),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function jC(s,e){var t=e.clientX,i=e.clientY;return s.every(function(r){var n=r.popperRect,o=r.popperState,a=r.props,A=a.interactiveBorder,l=KC(o.placement),c=o.modifiersData.offset;if(!c)return!0;var h=l==="bottom"?c.top.y:0,u=l==="top"?c.bottom.y:0,d=l==="right"?c.left.x:0,g=l==="left"?c.right.x:0,f=n.top-i+h>A,E=i-n.bottom-u>A,B=n.left-t+d>A,S=t-n.right-g>A;return f||E||B||S})}function La(s,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){s[i](r,t)})}function fu(s,e){for(var t=e;t;){var i;if(s.contains(t))return!0;t=t.getRootNode==null||(i=t.getRootNode())==null?void 0:i.host}return!1}var ai={isTouch:!1},Eu=0;function XC(){ai.isTouch||(ai.isTouch=!0,window.performance&&document.addEventListener("mousemove",pu))}function pu(){var s=performance.now();s-Eu<20&&(ai.isTouch=!1,document.removeEventListener("mousemove",pu)),Eu=s}function ZC(){var s=document.activeElement;if(JC(s)){var e=s._tippy;s.blur&&!e.state.isVisible&&s.blur()}}function zC(){document.addEventListener("touchstart",XC,Zi),window.addEventListener("blur",ZC)}var em=typeof window<"u"&&typeof document<"u",tm=em?!!window.msCrypto:!1,im={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},sm={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Yt=Object.assign({appendTo:lu,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},im,sm),rm=Object.keys(Yt),nm=function(e){var t=Object.keys(e);t.forEach(function(i){Yt[i]=e[i]})};function Iu(s){var e=s.plugins||[],t=e.reduce(function(i,r){var n=r.name,o=r.defaultValue;if(n){var a;i[n]=s[n]!==void 0?s[n]:(a=Yt[n])!=null?a:o}return i},{});return Object.assign({},s,t)}function om(s,e){var t=e?Object.keys(Iu(Object.assign({},Yt,{plugins:e}))):rm,i=t.reduce(function(r,n){var o=(s.getAttribute("data-tippy-"+n)||"").trim();if(!o)return r;if(n==="content")r[n]=o;else try{r[n]=JSON.parse(o)}catch{r[n]=o}return r},{});return i}function Cu(s,e){var t=Object.assign({},e,{content:cu(e.content,[s])},e.ignoreAttributes?{}:om(s,e.plugins));return t.aria=Object.assign({},Yt.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var am=function(){return"innerHTML"};function ka(s,e){s[am()]=e}function mu(s){var e=dr();return s===!0?e.className=au:(e.className=Au,Sn(s)?e.appendChild(s):ka(e,s)),e}function Bu(s,e){Sn(e.content)?(ka(s,""),s.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?ka(s,e.content):s.textContent=e.content)}function Ma(s){var e=s.firstElementChild,t=wn(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(ou)}),arrow:t.find(function(i){return i.classList.contains(au)||i.classList.contains(Au)}),backdrop:t.find(function(i){return i.classList.contains(GC)})}}function yu(s){var e=dr(),t=dr();t.className=PC,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=dr();i.className=ou,i.setAttribute("data-state","hidden"),Bu(i,s.props),e.appendChild(t),t.appendChild(i),r(s.props,s.props);function r(n,o){var a=Ma(e),A=a.box,l=a.content,c=a.arrow;o.theme?A.setAttribute("data-theme",o.theme):A.removeAttribute("data-theme"),typeof o.animation=="string"?A.setAttribute("data-animation",o.animation):A.removeAttribute("data-animation"),o.inertia?A.setAttribute("data-inertia",""):A.removeAttribute("data-inertia"),A.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?A.setAttribute("role",o.role):A.removeAttribute("role"),(n.content!==o.content||n.allowHTML!==o.allowHTML)&&Bu(l,s.props),o.arrow?c?n.arrow!==o.arrow&&(A.removeChild(c),A.appendChild(mu(o.arrow))):A.appendChild(mu(o.arrow)):c&&A.removeChild(c)}return{popper:e,onUpdate:r}}yu.$$tippy=!0;var Am=1,Dn=[],_a=[];function lm(s,e){var t=Cu(s,Object.assign({},Yt,Iu(du(e)))),i,r,n,o=!1,a=!1,A=!1,l=!1,c,h,u,d=[],g=hu(we,t.interactiveDebounce),f,E=Am++,B=null,S=$C(t.plugins),Q={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},m={id:E,reference:s,popper:dr(),popperInstance:B,props:t,state:Q,plugins:S,clearDelayTimeouts:nt,setProps:Ct,setContent:Jt,show:ot,hide:bt,hideWithInteractivity:ui,enable:dt,disable:Tt,unmount:wi,destroy:mt};if(!t.render)return m;var y=t.render(m),L=y.popper,v=y.onUpdate;L.setAttribute("data-tippy-root",""),L.id="tippy-"+m.id,m.popper=L,s._tippy=m,L._tippy=m;var F=S.map(function(Y){return Y.fn(m)}),G=s.hasAttribute("aria-expanded");return de(),T(),X(),R("onCreate",[m]),t.showOnCreate&&ve(),L.addEventListener("mouseenter",function(){m.props.interactive&&m.state.isVisible&&m.clearDelayTimeouts()}),L.addEventListener("mouseleave",function(){m.props.interactive&&m.props.trigger.indexOf("mouseenter")>=0&&J().addEventListener("mousemove",g)}),m;function M(){var Y=m.props.touch;return Array.isArray(Y)?Y:[Y,0]}function H(){return M()[0]==="hold"}function j(){var Y;return!!((Y=m.props.render)!=null&&Y.$$tippy)}function U(){return f||s}function J(){var Y=U().parentNode;return Y?qC(Y):document}function w(){return Ma(L)}function D(Y){return m.state.isMounted&&!m.state.isVisible||ai.isTouch||c&&c.type==="focus"?0:Ra(m.props.delay,Y?0:1,Yt.delay)}function X(Y){Y===void 0&&(Y=!1),L.style.pointerEvents=m.props.interactive&&!Y?"":"none",L.style.zIndex=""+m.props.zIndex}function R(Y,le,ue){if(ue===void 0&&(ue=!0),F.forEach(function(Be){Be[Y]&&Be[Y].apply(Be,le)}),ue){var xe;(xe=m.props)[Y].apply(xe,le)}}function b(){var Y=m.props.aria;if(Y.content){var le="aria-"+Y.content,ue=L.id,xe=xs(m.props.triggerTarget||s);xe.forEach(function(Be){var at=Be.getAttribute(le);if(m.state.isVisible)Be.setAttribute(le,at?at+" "+ue:ue);else{var je=at&&at.replace(ue,"").trim();je?Be.setAttribute(le,je):Be.removeAttribute(le)}})}}function T(){if(!(G||!m.props.aria.expanded)){var Y=xs(m.props.triggerTarget||s);Y.forEach(function(le){m.props.interactive?le.setAttribute("aria-expanded",m.state.isVisible&&le===U()?"true":"false"):le.removeAttribute("aria-expanded")})}}function K(){J().removeEventListener("mousemove",g),Dn=Dn.filter(function(Y){return Y!==g})}function P(Y){if(!(ai.isTouch&&(A||Y.type==="mousedown"))){var le=Y.composedPath&&Y.composedPath()[0]||Y.target;if(!(m.props.interactive&&fu(L,le))){if(xs(m.props.triggerTarget||s).some(function(ue){return fu(ue,le)})){if(ai.isTouch||m.state.isVisible&&m.props.trigger.indexOf("click")>=0)return}else R("onClickOutside",[m,Y]);m.props.hideOnClick===!0&&(m.clearDelayTimeouts(),m.hide(),a=!0,setTimeout(function(){a=!1}),m.state.isMounted||he())}}}function q(){A=!0}function ie(){A=!1}function ce(){var Y=J();Y.addEventListener("mousedown",P,!0),Y.addEventListener("touchend",P,Zi),Y.addEventListener("touchstart",ie,Zi),Y.addEventListener("touchmove",q,Zi)}function he(){var Y=J();Y.removeEventListener("mousedown",P,!0),Y.removeEventListener("touchend",P,Zi),Y.removeEventListener("touchstart",ie,Zi),Y.removeEventListener("touchmove",q,Zi)}function se(Y,le){Se(Y,function(){!m.state.isVisible&&L.parentNode&&L.parentNode.contains(L)&&le()})}function Qe(Y,le){Se(Y,le)}function Se(Y,le){var ue=w().box;function xe(Be){Be.target===ue&&(La(ue,"remove",xe),le())}if(Y===0)return le();La(ue,"remove",h),La(ue,"add",xe),h=xe}function Me(Y,le,ue){ue===void 0&&(ue=!1);var xe=xs(m.props.triggerTarget||s);xe.forEach(function(Be){Be.addEventListener(Y,le,ue),d.push({node:Be,eventType:Y,handler:le,options:ue})})}function de(){H()&&(Me("touchstart",ne,{passive:!0}),Me("touchend",pe,{passive:!0})),HC(m.props.trigger).forEach(function(Y){if(Y!=="manual")switch(Me(Y,ne),Y){case"mouseenter":Me("mouseleave",pe);break;case"focus":Me(tm?"focusout":"blur",Re);break;case"focusin":Me("focusout",Re);break}})}function oe(){d.forEach(function(Y){var le=Y.node,ue=Y.eventType,xe=Y.handler,Be=Y.options;le.removeEventListener(ue,xe,Be)}),d=[]}function ne(Y){var le,ue=!1;if(!(!m.state.isEnabled||De(Y)||a)){var xe=((le=c)==null?void 0:le.type)==="focus";c=Y,f=Y.currentTarget,T(),!m.state.isVisible&&VC(Y)&&Dn.forEach(function(Be){return Be(Y)}),Y.type==="click"&&(m.props.trigger.indexOf("mouseenter")<0||o)&&m.props.hideOnClick!==!1&&m.state.isVisible?ue=!0:ve(Y),Y.type==="click"&&(o=!ue),ue&&!xe&&Ye(Y)}}function we(Y){var le=Y.target,ue=U().contains(le)||L.contains(le);if(!(Y.type==="mousemove"&&ue)){var xe=Ke().concat(L).map(function(Be){var at,je=Be._tippy,di=(at=je.popperInstance)==null?void 0:at.state;return di?{popperRect:Be.getBoundingClientRect(),popperState:di,props:t}:null}).filter(Boolean);jC(xe,Y)&&(K(),Ye(Y))}}function pe(Y){var le=De(Y)||m.props.trigger.indexOf("click")>=0&&o;if(!le){if(m.props.interactive){m.hideWithInteractivity(Y);return}Ye(Y)}}function Re(Y){m.props.trigger.indexOf("focusin")<0&&Y.target!==U()||m.props.interactive&&Y.relatedTarget&&L.contains(Y.relatedTarget)||Ye(Y)}function De(Y){return ai.isTouch?H()!==Y.type.indexOf("touch")>=0:!1}function Le(){qe();var Y=m.props,le=Y.popperOptions,ue=Y.placement,xe=Y.offset,Be=Y.getReferenceClientRect,at=Y.moveTransition,je=j()?Ma(L).arrow:null,di=Be?{getBoundingClientRect:Be,contextElement:Be.contextElement||U()}:s,Mn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(_s){var Ni=_s.state;if(j()){var Za=w(),Lt=Za.box;["placement","reference-hidden","escaped"].forEach(function(Fs){Fs==="placement"?Lt.setAttribute("data-placement",Ni.placement):Ni.attributes.popper["data-popper-"+Fs]?Lt.setAttribute("data-"+Fs,""):Lt.removeAttribute("data-"+Fs)}),Ni.attributes.popper={}}}},Si=[{name:"offset",options:{offset:xe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!at}},Mn];j()&&je&&Si.push({name:"arrow",options:{element:je,padding:3}}),Si.push.apply(Si,(le==null?void 0:le.modifiers)||[]),m.popperInstance=UC(di,L,Object.assign({},le,{placement:ue,onFirstUpdate:u,modifiers:Si}))}function qe(){m.popperInstance&&(m.popperInstance.destroy(),m.popperInstance=null)}function Oe(){var Y=m.props.appendTo,le,ue=U();m.props.interactive&&Y===lu||Y==="parent"?le=ue.parentNode:le=cu(Y,[ue]),le.contains(L)||le.appendChild(L),m.state.isMounted=!0,Le()}function Ke(){return wn(L.querySelectorAll("[data-tippy-root]"))}function ve(Y){m.clearDelayTimeouts(),Y&&R("onTrigger",[m,Y]),ce();var le=D(!0),ue=M(),xe=ue[0],Be=ue[1];ai.isTouch&&xe==="hold"&&Be&&(le=Be),le?i=setTimeout(function(){m.show()},le):m.show()}function Ye(Y){if(m.clearDelayTimeouts(),R("onUntrigger",[m,Y]),!m.state.isVisible){he();return}if(!(m.props.trigger.indexOf("mouseenter")>=0&&m.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(Y.type)>=0&&o)){var le=D(!1);le?r=setTimeout(function(){m.state.isVisible&&m.hide()},le):n=requestAnimationFrame(function(){m.hide()})}}function dt(){m.state.isEnabled=!0}function Tt(){m.hide(),m.state.isEnabled=!1}function nt(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(n)}function Ct(Y){if(!m.state.isDestroyed){R("onBeforeUpdate",[m,Y]),oe();var le=m.props,ue=Cu(s,Object.assign({},le,du(Y),{ignoreAttributes:!0}));m.props=ue,de(),le.interactiveDebounce!==ue.interactiveDebounce&&(K(),g=hu(we,ue.interactiveDebounce)),le.triggerTarget&&!ue.triggerTarget?xs(le.triggerTarget).forEach(function(xe){xe.removeAttribute("aria-expanded")}):ue.triggerTarget&&s.removeAttribute("aria-expanded"),T(),X(),v&&v(le,ue),m.popperInstance&&(Le(),Ke().forEach(function(xe){requestAnimationFrame(xe._tippy.popperInstance.forceUpdate)})),R("onAfterUpdate",[m,Y])}}function Jt(Y){m.setProps({content:Y})}function ot(){var Y=m.state.isVisible,le=m.state.isDestroyed,ue=!m.state.isEnabled,xe=ai.isTouch&&!m.props.touch,Be=Ra(m.props.duration,0,Yt.duration);if(!(Y||le||ue||xe)&&!U().hasAttribute("disabled")&&(R("onShow",[m],!1),m.props.onShow(m)!==!1)){if(m.state.isVisible=!0,j()&&(L.style.visibility="visible"),X(),ce(),m.state.isMounted||(L.style.transition="none"),j()){var at=w(),je=at.box,di=at.content;Ta([je,di],0)}u=function(){var Si;if(!(!m.state.isVisible||l)){if(l=!0,L.offsetHeight,L.style.transition=m.props.moveTransition,j()&&m.props.animation){var is=w(),_s=is.box,Ni=is.content;Ta([_s,Ni],Be),gu([_s,Ni],"visible")}b(),T(),uu(_a,m),(Si=m.popperInstance)==null||Si.forceUpdate(),R("onMount",[m]),m.props.animation&&j()&&Qe(Be,function(){m.state.isShown=!0,R("onShown",[m])})}},Oe()}}function bt(){var Y=!m.state.isVisible,le=m.state.isDestroyed,ue=!m.state.isEnabled,xe=Ra(m.props.duration,1,Yt.duration);if(!(Y||le||ue)&&(R("onHide",[m],!1),m.props.onHide(m)!==!1)){if(m.state.isVisible=!1,m.state.isShown=!1,l=!1,o=!1,j()&&(L.style.visibility="hidden"),K(),he(),X(!0),j()){var Be=w(),at=Be.box,je=Be.content;m.props.animation&&(Ta([at,je],xe),gu([at,je],"hidden"))}b(),T(),m.props.animation?j()&&se(xe,m.unmount):m.unmount()}}function ui(Y){J().addEventListener("mousemove",g),uu(Dn,g),g(Y)}function wi(){m.state.isVisible&&m.hide(),m.state.isMounted&&(qe(),Ke().forEach(function(Y){Y._tippy.unmount()}),L.parentNode&&L.parentNode.removeChild(L),_a=_a.filter(function(Y){return Y!==m}),m.state.isMounted=!1,R("onHidden",[m]))}function mt(){m.state.isDestroyed||(m.clearDelayTimeouts(),m.unmount(),oe(),delete s._tippy,m.state.isDestroyed=!0,R("onDestroy",[m]))}}function zi(s,e){e===void 0&&(e={});var t=Yt.plugins.concat(e.plugins||[]);zC();var i=Object.assign({},e,{plugins:t}),r=WC(s),n=r.reduce(function(o,a){var A=a&&lm(a,i);return A&&o.push(A),o},[]);return Sn(s)?n[0]:n}zi.defaultProps=Yt,zi.setDefaultProps=nm,zi.currentInput=ai,Object.assign({},Kh,{effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow)}}),zi.setDefaultProps({render:yu});class Ai extends Error{constructor(e,t=new Error,i=!1){super(),this.fatal=!1,this.fatal=i,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const cm=5;class hm{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=gt(),this._controls=gt(),this.host=e}set activeScenes(e){if(e!==this._activeScenes){const t=e[0],i=this._activeScenes[0];this._activeScenes=e,t!==i&&(this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e[0]})),this.host.requestUpdate())}}get activeScenes(){return this._activeScenes}set currentTime(e){var n,o,a,A,l;const t=Math.min(this.host.duration,Math.max(0,e));this._currentTime=t,this.activeScenes=((n=this.host.scenes)==null?void 0:n.filter(({start:c,duration:h})=>t>=c&&t<c+h))??[],this._upcomingScenes=((o=this.host.scenes)==null?void 0:o.filter(({start:c})=>t>=c-cm&&t<c))??[],this.loadScenes(),this.syncVideoState(),(a=this._controls.value)==null||a.setAttribute("currentTime",t.toString());const i=this.activeScenes[0],r=Il((A=i==null?void 0:i.videoMeta)==null?void 0:A.captions);this.caption=((l=r.find(({start:c,end:h})=>{var d;const u=t-i.start+(((d=i.videoMeta)==null?void 0:d.start)??0);return c&&h&&u>=Gr(c)&&u<=Gr(h)}))==null?void 0:l.text)??"",this.draw(t),!this.host.paused&&!this.host.loading&&!this.host.processing&&!this.host.waiting&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:t}))}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return ft(this._canvas)}controls(){return ft(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{var a,A,l;const{start:t,duration:i,video:r,videoMeta:n}=e,o=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(r&&n){const{key:c,hls:h,node:u}=r,{start:d,duration:g}=n,f=this.host.videoState[c];u&&f&&(u.currentTime>=d+g||u.ended||o&&(h?(a=h.startLoadOnce)==null||a.call(h,u.currentTime):f.initialised||(A=u.startLoadOnce)==null||A.call(u)))}else if(o){const c=`${t}-${i}`,h=this.host._sceneController.videoState[c];this.host.duration&&!((l=h==null?void 0:h.buffered)!=null&&l.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[c]:{...h,buffered:[{start:Math.max(0,t/this.host.duration*100),end:Math.min((t+i)/this.host.duration*100,100)}]}})}})}syncVideoState(){var e;(e=this.host.scenes)==null||e.forEach(t=>{if(t.video){const{key:i,node:r}=t.video,n=this.host.videoState[i],o=this.activeScenes.includes(t);if(r&&n)if(o&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(r.paused&&n.initialised)try{return r.play()}catch(a){throw new Ai("Video play error",a,!0)}}else r.paused||r.pause()}})}draw(e=this.currentTime){var t,i;this.host.sceneConfig&&this._canvas.value&&((i=(t=this.host).compilation)==null||i.call(t,{currentTime:e,scenes:this.host.sceneConfig,canvas:this._canvas.value}))}clear(){var t;const e=this._canvas.value;(t=e==null?void 0:e.getContext("2d"))==null||t.clearRect(0,0,e.width,e.height)}}function um(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function dm(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Fa(s){const{id:e,key:t,src:i,playlist:r,duration:n}=s;return new Promise(o=>{let a=null;const A=document.createElement("video");if(A.playsInline=!0,A.muted=!0,A.loop=!1,r&&!um()&&Qi.isSupported()){let l=!1;a=new Qi({autoStartLoad:!0,xhrSetup:c=>{const{open:h}=c,u=r.split("?")[1];c.open=function(d,g,f){g.toString().includes("?")||(g+="?"+u),h.apply(this,[d,g,f])}}}),a.loadSource(r),a.attachMedia(A),a.startLoadOnce=(c=-1,h)=>{if(a&&!l){const u=a==null?void 0:a.levels.findIndex(d=>Math.min(d.height,d.width)===h);a.startLevel=a.firstLevel,a.startLoad(c),l=!0,a.currentLevel=u!==-1?u:a.firstLevel}},a.on(Qi.Events.LEVEL_LOADED,async()=>{l||a==null||a.stopLoad(),o({id:e,key:t,hls:a,config:s,node:A})})}else{A.src=i;let l=!1;if(A.startLoadOnce=()=>{l||(A.preload="auto",A.load(),l=!0)},n)A.preload="none",o({id:e,key:t,hls:a,config:s,node:A});else{A.preload="metadata";const c=async()=>{o({id:e,key:t,hls:a,config:s,node:A}),A.removeEventListener("loadedmetadata",c)};A.addEventListener("loadedmetadata",c)}}})}async function Qu(s){return s.duration===1/0?new Promise(e=>{s.currentTime=Number.MAX_SAFE_INTEGER,s.ontimeupdate=()=>{s.ontimeupdate=null,e(s.duration),s.currentTime=0}}):s.duration}const gm=Li(async function(e){return new FontFace(e.name,`url(${e.woff2??e.url})`,{style:e.style,weight:e.weight}).load()},{cacheKey:([s])=>JSON.stringify(s)});let fm=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._scenes=null,this._videos={},this._videoMeta={},this._videoState={},this._createDataResolver=wl(t=>i=>this.host.dataResolver(i,{language:t})),this._resolveVideo=Li(async t=>{const{id:i,key:r}=t,n=await Fa(t);n.node.volume=this.host.volume,n.node.playbackRate=this.host.playbackRate;const o={loadeddata:this._handleLoadedData,waiting:this._handleWaiting,canplay:this._handleCanPlay,progress:this._handleProgress,seeking:this._handleSeeking,seeked:this._handleSeeked,play:this._handlePlay,playing:this._handlePlaying,pause:this._handlePause,stalled:this._handleStalled,timeupdate:this._handleTimeUpdate,ended:this._handleEnded,error:this._handleError},a=Object.keys(o).reduce((A,l)=>{const c=l,h=o[c]({id:i,key:r,node:n.node});return A[c]=h,n.node.addEventListener(l,h),A},{});return{...n,listeners:a}},{cacheKey:([{id:t,key:i,src:r,playlist:n}])=>JSON.stringify({id:t,key:i,src:r==null?void 0:r.split("?")[0],playlist:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=Li(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await Qu(i),c=(a??0)*l,h=(1-(A??0))*l;return{id:r,captions:n,start:c,duration:h-c}},{cacheKey:([{id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a}])=>JSON.stringify({id:t,key:i,captions:r,duration:n,startOffset:o,endOffset:a})}),this._handleLoadedData=({id:t,key:i,node:r})=>()=>{var o,a;const n=this.videoState[i];if(!(n!=null&&n.initialised)){this.videoState={...this.videoState,[i]:{...n,initialised:!0,waiting:!1,buffered:(n==null?void 0:n.buffered)??[]}};const A=(a=(o=this.scenes)==null?void 0:o.scenes)==null?void 0:a.find(({video:l})=>{l==null||l.key});A&&this._setVideoCurrentTime({scene:A,time:this.host.currentTime}),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:i,node:r}}))}},this._handleWaiting=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&!(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=({key:t,node:i})=>()=>{const r=this.videoState[t],n=this._getBufferSegments({key:t,node:i,duration:this.host.duration});this.videoState={...this.videoState,[t]:{...r,buffered:n}}},this._handleSeeking=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:i,node:r}}))},this._handleSeeked=({id:t,key:i,node:r})=>()=>{const n=this.videoState[i];n!=null&&n.initialised&&(this.host.draw(),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:i,node:r}})))},this._handlePlay=({id:t,key:i,node:r})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:i,node:r}}))},this._handlePlaying=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:i,node:r}}))},this._handlePause=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:i,node:r}}))},this._handleStalled=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:i,node:r}}))},this._handleTimeUpdate=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:i,node:r}}))},this._handleEnded=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:i,node:r}}))},this._handleError=({id:t,key:i,node:r})=>()=>{const n=new Ai(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:n,message:n.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:i,node:r}}))},this._cleanupVideo=t=>{var r;const i=this.videos[t];i&&(i.node.pause(),i.node.src="",(r=i.hls)==null||r.destroy(),Object.keys(i.listeners??{}).forEach(n=>{var o,a;if((o=this.videos)!=null&&o[t]){const A=(a=i.listeners)==null?void 0:a[n];A&&i.node.removeEventListener(n,A)}}),delete this.videos[t])},this.host=e,this.host.addController(this)}set hasPlayed(e){e!==this._hasPlayed&&(this._hasPlayed=e,this.host.requestUpdate())}get hasPlayed(){return this._hasPlayed}set duration(e){!isNaN(e)&&e!==this._duration&&(this._duration=e,this.host.requestUpdate(),this.host.dispatchEvent(new CustomEvent("durationchange",{detail:this._duration})))}get duration(){return this._duration}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}set videoMeta(e){e!==this._videoMeta&&(this._videoMeta=e,this.host.requestUpdate())}get videoMeta(){return this._videoMeta}set videoState(e){e!==this._videoState&&(this._videoState=e,this.host.requestUpdate())}get videoState(){return this._videoState}_getBufferSegments({key:e,node:t,duration:i}){var l;const r=t==null?void 0:t.buffered,n=[],{start:o,video:a,videoMeta:A}=((l=this.scenes)==null?void 0:l.scenes.find(({video:c})=>e===(c==null?void 0:c.key)))??{};if(t&&r&&a&&A&&typeof o<"u")for(let c=0;c<r.length;c++){const h=r.start(c),u=r.end(c);Math.max(h,A.start)<=Math.min(u,A.start+A.duration)&&n.push({start:Math.max(0,(Math.max(h-A.start,0)+o)/i*100),end:Math.min((Math.min(u-A.start,A.duration)+o)/i*100,100)})}return n}_setupTask(){new Sr(this.host,async([e,t,i,r,n,o,a])=>{try{let A=null;if(this.host._errors=[],i||e){if(this.host._processing=!0,i){let h=null;if(r)try{h=await(await fetch(r,{method:"GET"})).text()}catch(g){const f=new Ai("Track failed to fetch",g);this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:f,message:f.message}))}const d={questions:{items:[{answer:{id:"source",media:{[i.includes(".m3u8")?"playlist":"video"]:i},captions:{current:h}}}]}};try{this.scenes=await hs({data:d,template:t,burnCaptions:o,debug:a},this._createDataResolver(n),this._resolveVideo,this._resolveVideoMeta)}catch(g){try{this.scenes=await hs({data:d,burnCaptions:o,debug:a},this._createDataResolver(n),this._resolveVideo,this._resolveVideoMeta)}catch(f){throw new Ai("Fatal source template error",f,!0)}A=new Ai("Source template error",g)}}else try{this.scenes=await hs({data:e,template:t,burnCaptions:o,debug:a},this._createDataResolver(n),this._resolveVideo,this._resolveVideoMeta)}catch(h){try{this.scenes=await hs({data:e,burnCaptions:o,debug:a},this._createDataResolver(n),this._resolveVideo,this._resolveVideoMeta)}catch(u){throw new Ai("Fatal data template error",u,!0)}A=new Ai("Data template error",h)}Object.keys(this.videos).forEach(h=>{this.scenes.scenes.find(({video:u})=>h===(u==null?void 0:u.key))||this._videos[h].node.pause()});const l=this.scenes.scenes.reduce((h,{video:u})=>(u&&(h[u.key]=u),h),{});Object.keys(this.videos).join("|")!==Object.keys(l).join("|")&&this.host.reset(0,!1),this.videos=l,this.videoState={...this.videoState,...this.scenes.scenes.reduce((h,{video:u,start:d,duration:g})=>{var B;const f=(u==null?void 0:u.key)??`${d}-${g}`,E=this._getBufferSegments({key:f,node:u==null?void 0:u.node,duration:this.scenes.duration});return h[f]={initialised:!u,waiting:!!u,...this.videoState[f],buffered:u?E:(B=this.videoState[f])==null?void 0:B.buffered},h},{})},this.videoMeta=this.scenes.scenes.reduce((h,{video:u,videoMeta:d})=>(u&&d&&(h[u.key]=d),h),{}),(await Promise.all(this.scenes.fonts.map(h=>gm(h)))).forEach(h=>{document.fonts.add(h)}),this.duration=this.scenes.duration,this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused)}A&&this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:A,message:A.message}))}catch(A){this.scenes=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:A,message:A.message}))}finally{this.host._processing=!1}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template,src:this.host.src,track:this.host.track,language:this.host.language,burnCaptions:this.host.burnCaptions,debug:this.host.debug});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.data,this.host.template,this.host.src,this.host.track,this.host.language,this.host.burnCaptions,this.host.debug];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:i,video:r,videoMeta:n}=t;if(r&&r.node&&n&&typeof i<"u"){const o=e-i;r.node.currentTime=Math.max(n.start,Math.min(n.start+n.duration,o+n.start))}}setVideosCurrentTime(e){var t;(t=this.scenes)==null||t.scenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function Em(s){s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.msRequestFullscreen&&s.msRequestFullscreen()}function pm(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Oa=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],Im={id:"captions",event:"captions:click",label:"Closed Captions"},Cm={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},vu={title:"Playback Speed",items:[{id:"playback-rate-0.5",event:"playbackRate:click",label:"0.5x",value:.5},{id:"playback-rate-1",event:"playbackRate:click",label:"1.0x",value:1},{id:"playback-rate-1.5",event:"playbackRate:click",label:"1.5x",value:1.5},{id:"playback-rate-2",event:"playbackRate:click",label:"2.0x",value:2}]},mm={id:"playbackRate",label:"Playback playbackRate",subItems:vu};class Bm extends DA{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==ns.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}disconnected(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0}reconnected(){var e;this.element&&((e=this.observer)==null||e.observe(this.element))}update(e,[t]){return this.isConnected&&!this.observer&&(this.observer=new ResizeObserver(t),this.element=e.element,this.observer.observe(this.element)),Gt}}const Na=os(Bm),ym=wl(()=>{const s=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=gl.map(r=>({load:!1,font:new FontFace(r.family,`url(${r.url})`,{style:r.style})}));return[{load:!0,font:s},{load:!0,font:e},{load:!0,font:t},...i]}),li={"red-120":"#feeded","red-130":"#fcd5d0","red-400":"#e84a4a","red-500":"#c51c3a","red-700":"#a21c39","red-800":"#850231","red-900":"#580A2D","teal-80":"#f3fafa","teal-100":"#d6f1f1","teal-200":"#ace3e3","teal-300":"#7acace","teal-400":"#4faab2","teal-500":"#358f97","teal-600":"#287179","teal-700":"#22555c","teal-800":"#21484e","teal-900":"#1f3d42","teal-950":"#0d2126","purple-100":"#d7cfff","purple-700":"#5f2fe9","green-200":"#a4d7aa","green-500":"#38b319","green-800":"#2b3c2f","grey-100":"#f0f0f0","light-50":"rgba(255, 255, 255, .05)","light-100":"rgba(255, 255, 255, .1)","light-200":"rgba(255, 255, 255, .2)","light-400":"rgba(255, 255, 255, .4)","light-500":"rgba(255, 255, 255, .5)","light-640":"rgba(255, 255, 255, .64)","light-800":"rgba(255, 255, 255, .8)","light-1000":"#fff","dark-50":"rgba(0, 0, 0, .05)","dark-80":"rgba(0, 0, 0, .08)","dark-100":"rgba(0, 0, 0, .1)","dark-200":"rgba(0, 0, 0, .2)","dark-250":"rgba(0, 0, 0, .25)","dark-400":"rgba(0, 0, 0, .4)","dark-500":"rgba(0, 0, 0, .5)","dark-640":"rgba(0, 0, 0, .64)","dark-800":"rgba(0, 0, 0, .8)","dark-900":"rgba(0, 0, 0, .9)","dark-1000":"#000"},Qm={colors:li,space:{xxs:".25rem",xs:".5rem",small:".75rem",medium:"1rem",large:"1.5rem",xl:"2.5rem"},sizes:{xxs:"1rem",xs:"1.5rem",small:"2rem",medium:"2.5rem",large:"3rem"},fontWeights:{regular:400,semibold:600},lineHeights:{small:1.1,medium:1.25,large:1.4},letterSpacings:{xxs:"-.04rem",xs:"-.03rem",small:"-.02rem",medium:"-.01rem",large:0},fontSizes:{micro:".625rem",small:".75rem",medium:".875rem",large:"1rem",xl:"1.25rem",xxl:"1.5rem",xxxl:"2rem",huge:"2.75rem"},fontFamilies:{sans:'Roobert, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,"Noto Sans", "Noto Color Emoji", sans-serif, "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji"',mono:'"Maison Neue Mono", Menlo, Monaco, Consolas, Liberation Mono, "Courier New", monospace'},borderWidths:{thin:".0625rem"},radii:{small:".25rem",medium:".5rem",large:".75rem",xl:"1rem"},shadows:{small:`.25rem .25rem .25rem ${li["dark-100"]}`,medium:`0 .125rem .625rem ${li["dark-100"]}`,large:`0 .25rem 1rem ${li["dark-50"]}`,xl:`.25rem .25rem 1rem ${li["dark-250"]}`,xxl:`0 .25rem 2rem ${li["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${li["dark-250"]}`,toolbar:`0 -.625rem .625rem ${li["dark-50"]}`,text:`0 0 .25rem ${li["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:li["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},wu=MI(Qm,{delimiter:"-"}),vm=Object.keys(wu).map(s=>Os(`:host { --${s}: ${wu[s]}; }`)),Fe=(s=>{const t=class t extends s{firstUpdated(){ym().forEach(({load:n,font:o})=>{document.fonts.add(o),n&&o.load()})}};t.styles=[(s==null?void 0:s.styles)??[],vm,it`
190
+ */const zu=(s,e,t)=>{const i=new Map;for(let r=e;r<=t;r++)i.set(s[r],r);return i},Zu=us(class extends Ws{constructor(s){if(super(s),s.type!==cs.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,t){let i;t===void 0?t=e:e!==void 0&&(i=e);const r=[],n=[];let o=0;for(const a of s)r[o]=i?i(a,o):o,n[o]=t(a,o),o++;return{values:n,keys:r}}render(s,e,t){return this.dt(s,e,t).values}update(s,[e,t,i]){const r=wd(s),{values:n,keys:o}=this.dt(e,t,i);if(!Array.isArray(r))return this.ut=o,n;const a=this.ut??(this.ut=[]),A=[];let l,c,u=0,h=r.length-1,d=0,g=n.length-1;for(;u<=h&&d<=g;)if(r[u]===null)u++;else if(r[h]===null)h--;else if(a[u]===o[d])A[d]=Vi(r[u],n[d]),u++,d++;else if(a[h]===o[g])A[g]=Vi(r[h],n[g]),h--,g--;else if(a[u]===o[g])A[g]=Vi(r[u],n[g]),Js(s,A[g+1],r[u]),u++,g--;else if(a[h]===o[d])A[d]=Vi(r[h],n[d]),Js(s,r[u],r[h]),h--,d++;else if(l===void 0&&(l=zu(o,d,g),c=zu(a,u,h)),l.has(a[u]))if(l.has(a[h])){const f=c.get(o[d]),p=f!==void 0?r[f]:null;if(p===null){const v=Js(s,r[u]);Vi(v,n[d]),A[d]=v}else A[d]=Vi(p,n[d]),Js(s,r[u],p),r[f]=null;d++}else ao(r[h]),h--;else ao(r[u]),u++;for(;d<=g;){const f=Js(s,A[g+1]);Vi(f,n[d]),A[d++]=f}for(;u<=h;){const f=r[u++];f!==null&&ao(f)}return this.ut=o,Sd(s,A),Ht}});var xt="top",Pt="bottom",Ot="right",Tt="left",Ma="auto",cr=[xt,Pt,Ot,Tt],ws="start",ur="end",um="clippingParents",eh="viewport",hr="popper",hm="reference",th=cr.reduce(function(s,e){return s.concat([e+"-"+ws,e+"-"+ur])},[]),ih=[].concat(cr,[Ma]).reduce(function(s,e){return s.concat([e,e+"-"+ws,e+"-"+ur])},[]),dm="beforeRead",gm="read",fm="afterRead",pm="beforeMain",Em="main",Im="afterMain",mm="beforeWrite",Cm="write",vm="afterWrite",ym=[dm,gm,fm,pm,Em,Im,mm,Cm,vm];function ai(s){return s?(s.nodeName||"").toLowerCase():null}function Lt(s){if(s==null)return window;if(s.toString()!=="[object Window]"){var e=s.ownerDocument;return e&&e.defaultView||window}return s}function ts(s){var e=Lt(s).Element;return s instanceof e||s instanceof Element}function Ut(s){var e=Lt(s).HTMLElement;return s instanceof e||s instanceof HTMLElement}function Pa(s){if(typeof ShadowRoot>"u")return!1;var e=Lt(s).ShadowRoot;return s instanceof e||s instanceof ShadowRoot}function Bm(s){var e=s.state;Object.keys(e.elements).forEach(function(t){var i=e.styles[t]||{},r=e.attributes[t]||{},n=e.elements[t];!Ut(n)||!ai(n)||(Object.assign(n.style,i),Object.keys(r).forEach(function(o){var a=r[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function Qm(s){var e=s.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(i){var r=e.elements[i],n=e.attributes[i]||{},o=Object.keys(e.styles.hasOwnProperty(i)?e.styles[i]:t[i]),a=o.reduce(function(A,l){return A[l]="",A},{});!Ut(r)||!ai(r)||(Object.assign(r.style,a),Object.keys(n).forEach(function(A){r.removeAttribute(A)}))})}}const sh={name:"applyStyles",enabled:!0,phase:"write",fn:Bm,effect:Qm,requires:["computeStyles"]};function Ai(s){return s.split("-")[0]}var is=Math.max,Nn=Math.min,Rs=Math.round;function Oa(){var s=navigator.userAgentData;return s!=null&&s.brands&&Array.isArray(s.brands)?s.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function rh(){return!/^((?!chrome|android).)*safari/i.test(Oa())}function xs(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=s.getBoundingClientRect(),r=1,n=1;e&&Ut(s)&&(r=s.offsetWidth>0&&Rs(i.width)/s.offsetWidth||1,n=s.offsetHeight>0&&Rs(i.height)/s.offsetHeight||1);var o=ts(s)?Lt(s):window,a=o.visualViewport,A=!rh()&&t,l=(i.left+(A&&a?a.offsetLeft:0))/r,c=(i.top+(A&&a?a.offsetTop:0))/n,u=i.width/r,h=i.height/n;return{width:u,height:h,top:c,right:l+u,bottom:c+h,left:l,x:l,y:c}}function Ua(s){var e=xs(s),t=s.offsetWidth,i=s.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:s.offsetLeft,y:s.offsetTop,width:t,height:i}}function nh(s,e){var t=e.getRootNode&&e.getRootNode();if(s.contains(e))return!0;if(t&&Pa(t)){var i=e;do{if(i&&s.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function wi(s){return Lt(s).getComputedStyle(s)}function bm(s){return["table","td","th"].indexOf(ai(s))>=0}function Pi(s){return((ts(s)?s.ownerDocument:s.document)||window.document).documentElement}function Mn(s){return ai(s)==="html"?s:s.assignedSlot||s.parentNode||(Pa(s)?s.host:null)||Pi(s)}function oh(s){return!Ut(s)||wi(s).position==="fixed"?null:s.offsetParent}function Sm(s){var e=/firefox/i.test(Oa()),t=/Trident/i.test(Oa());if(t&&Ut(s)){var i=wi(s);if(i.position==="fixed")return null}var r=Mn(s);for(Pa(r)&&(r=r.host);Ut(r)&&["html","body"].indexOf(ai(r))<0;){var n=wi(r);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return r;r=r.parentNode}return null}function dr(s){for(var e=Lt(s),t=oh(s);t&&bm(t)&&wi(t).position==="static";)t=oh(t);return t&&(ai(t)==="html"||ai(t)==="body"&&wi(t).position==="static")?e:t||Sm(s)||e}function Ga(s){return["top","bottom"].indexOf(s)>=0?"x":"y"}function gr(s,e,t){return is(s,Nn(e,t))}function wm(s,e,t){var i=gr(s,e,t);return i>t?t:i}function ah(){return{top:0,right:0,bottom:0,left:0}}function Ah(s){return Object.assign({},ah(),s)}function lh(s,e){return e.reduce(function(t,i){return t[i]=s,t},{})}var Rm=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Ah(typeof e!="number"?e:lh(e,cr))};function xm(s){var e,t=s.state,i=s.name,r=s.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=Ai(t.placement),A=Ga(a),l=[Tt,Ot].indexOf(a)>=0,c=l?"height":"width";if(!(!n||!o)){var u=Rm(r.padding,t),h=Ua(n),d=A==="y"?xt:Tt,g=A==="y"?Pt:Ot,f=t.rects.reference[c]+t.rects.reference[A]-o[A]-t.rects.popper[c],p=o[A]-t.rects.reference[A],v=dr(n),y=v?A==="y"?v.clientHeight||0:v.clientWidth||0:0,Q=f/2-p/2,m=u[d],b=y-h[c]-u[g],x=y/2-h[c]/2+Q,B=gr(m,x,b),H=A;t.modifiersData[i]=(e={},e[H]=B,e.centerOffset=B-x,e)}}function Tm(s){var e=s.state,t=s.options,i=t.element,r=i===void 0?"[data-popper-arrow]":i;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||nh(e.elements.popper,r)&&(e.elements.arrow=r))}const Dm={name:"arrow",enabled:!0,phase:"main",fn:xm,effect:Tm,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ts(s){return s.split("-")[1]}var Lm={top:"auto",right:"auto",bottom:"auto",left:"auto"};function _m(s,e){var t=s.x,i=s.y,r=e.devicePixelRatio||1;return{x:Rs(t*r)/r||0,y:Rs(i*r)/r||0}}function ch(s){var e,t=s.popper,i=s.popperRect,r=s.placement,n=s.variation,o=s.offsets,a=s.position,A=s.gpuAcceleration,l=s.adaptive,c=s.roundOffsets,u=s.isFixed,h=o.x,d=h===void 0?0:h,g=o.y,f=g===void 0?0:g,p=typeof c=="function"?c({x:d,y:f}):{x:d,y:f};d=p.x,f=p.y;var v=o.hasOwnProperty("x"),y=o.hasOwnProperty("y"),Q=Tt,m=xt,b=window;if(l){var x=dr(t),B="clientHeight",H="clientWidth";if(x===Lt(t)&&(x=Pi(t),wi(x).position!=="static"&&a==="absolute"&&(B="scrollHeight",H="scrollWidth")),x=x,r===xt||(r===Tt||r===Ot)&&n===ur){m=Pt;var _=u&&x===b&&b.visualViewport?b.visualViewport.height:x[B];f-=_-i.height,f*=A?1:-1}if(r===Tt||(r===xt||r===Pt)&&n===ur){Q=Ot;var k=u&&x===b&&b.visualViewport?b.visualViewport.width:x[H];d-=k-i.width,d*=A?1:-1}}var U=Object.assign({position:a},l&&Lm),q=c===!0?_m({x:d,y:f},Lt(t)):{x:d,y:f};if(d=q.x,f=q.y,A){var V;return Object.assign({},U,(V={},V[m]=y?"0":"",V[Q]=v?"0":"",V.transform=(b.devicePixelRatio||1)<=1?"translate("+d+"px, "+f+"px)":"translate3d("+d+"px, "+f+"px, 0)",V))}return Object.assign({},U,(e={},e[m]=y?f+"px":"",e[Q]=v?d+"px":"",e.transform="",e))}function km(s){var e=s.state,t=s.options,i=t.gpuAcceleration,r=i===void 0?!0:i,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,A=a===void 0?!0:a,l={placement:Ai(e.placement),variation:Ts(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,ch(Object.assign({},l,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:A})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,ch(Object.assign({},l,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:A})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Fm={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:km,data:{}};var Pn={passive:!0};function Nm(s){var e=s.state,t=s.instance,i=s.options,r=i.scroll,n=r===void 0?!0:r,o=i.resize,a=o===void 0?!0:o,A=Lt(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&l.forEach(function(c){c.addEventListener("scroll",t.update,Pn)}),a&&A.addEventListener("resize",t.update,Pn),function(){n&&l.forEach(function(c){c.removeEventListener("scroll",t.update,Pn)}),a&&A.removeEventListener("resize",t.update,Pn)}}const Mm={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Nm,data:{}};var Pm={left:"right",right:"left",bottom:"top",top:"bottom"};function On(s){return s.replace(/left|right|bottom|top/g,function(e){return Pm[e]})}var Om={start:"end",end:"start"};function uh(s){return s.replace(/start|end/g,function(e){return Om[e]})}function Ha(s){var e=Lt(s),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function $a(s){return xs(Pi(s)).left+Ha(s).scrollLeft}function Um(s,e){var t=Lt(s),i=Pi(s),r=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,A=0;if(r){n=r.width,o=r.height;var l=rh();(l||!l&&e==="fixed")&&(a=r.offsetLeft,A=r.offsetTop)}return{width:n,height:o,x:a+$a(s),y:A}}function Gm(s){var e,t=Pi(s),i=Ha(s),r=(e=s.ownerDocument)==null?void 0:e.body,n=is(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=is(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+$a(s),A=-i.scrollTop;return wi(r||t).direction==="rtl"&&(a+=is(t.clientWidth,r?r.clientWidth:0)-n),{width:n,height:o,x:a,y:A}}function Ya(s){var e=wi(s),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function hh(s){return["html","body","#document"].indexOf(ai(s))>=0?s.ownerDocument.body:Ut(s)&&Ya(s)?s:hh(Mn(s))}function fr(s,e){var t;e===void 0&&(e=[]);var i=hh(s),r=i===((t=s.ownerDocument)==null?void 0:t.body),n=Lt(i),o=r?[n].concat(n.visualViewport||[],Ya(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(fr(Mn(o)))}function Ka(s){return Object.assign({},s,{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height})}function Hm(s,e){var t=xs(s,!1,e==="fixed");return t.top=t.top+s.clientTop,t.left=t.left+s.clientLeft,t.bottom=t.top+s.clientHeight,t.right=t.left+s.clientWidth,t.width=s.clientWidth,t.height=s.clientHeight,t.x=t.left,t.y=t.top,t}function dh(s,e,t){return e===eh?Ka(Um(s,t)):ts(e)?Hm(e,t):Ka(Gm(Pi(s)))}function $m(s){var e=fr(Mn(s)),t=["absolute","fixed"].indexOf(wi(s).position)>=0,i=t&&Ut(s)?dr(s):s;return ts(i)?e.filter(function(r){return ts(r)&&nh(r,i)&&ai(r)!=="body"}):[]}function Ym(s,e,t,i){var r=e==="clippingParents"?$m(s):[].concat(e),n=[].concat(r,[t]),o=n[0],a=n.reduce(function(A,l){var c=dh(s,l,i);return A.top=is(c.top,A.top),A.right=Nn(c.right,A.right),A.bottom=Nn(c.bottom,A.bottom),A.left=is(c.left,A.left),A},dh(s,o,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function gh(s){var e=s.reference,t=s.element,i=s.placement,r=i?Ai(i):null,n=i?Ts(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,A;switch(r){case xt:A={x:o,y:e.y-t.height};break;case Pt:A={x:o,y:e.y+e.height};break;case Ot:A={x:e.x+e.width,y:a};break;case Tt:A={x:e.x-t.width,y:a};break;default:A={x:e.x,y:e.y}}var l=r?Ga(r):null;if(l!=null){var c=l==="y"?"height":"width";switch(n){case ws:A[l]=A[l]-(e[c]/2-t[c]/2);break;case ur:A[l]=A[l]+(e[c]/2-t[c]/2);break}}return A}function pr(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=i===void 0?s.placement:i,n=t.strategy,o=n===void 0?s.strategy:n,a=t.boundary,A=a===void 0?um:a,l=t.rootBoundary,c=l===void 0?eh:l,u=t.elementContext,h=u===void 0?hr:u,d=t.altBoundary,g=d===void 0?!1:d,f=t.padding,p=f===void 0?0:f,v=Ah(typeof p!="number"?p:lh(p,cr)),y=h===hr?hm:hr,Q=s.rects.popper,m=s.elements[g?y:h],b=Ym(ts(m)?m:m.contextElement||Pi(s.elements.popper),A,c,o),x=xs(s.elements.reference),B=gh({reference:x,element:Q,strategy:"absolute",placement:r}),H=Ka(Object.assign({},Q,B)),_=h===hr?H:x,k={top:b.top-_.top+v.top,bottom:_.bottom-b.bottom+v.bottom,left:b.left-_.left+v.left,right:_.right-b.right+v.right},U=s.modifiersData.offset;if(h===hr&&U){var q=U[r];Object.keys(k).forEach(function(V){var Z=[Ot,Pt].indexOf(V)>=0?1:-1,S=[xt,Pt].indexOf(V)>=0?"y":"x";k[V]+=q[S]*Z})}return k}function Km(s,e){e===void 0&&(e={});var t=e,i=t.placement,r=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,A=t.allowedAutoPlacements,l=A===void 0?ih:A,c=Ts(i),u=c?a?th:th.filter(function(g){return Ts(g)===c}):cr,h=u.filter(function(g){return l.indexOf(g)>=0});h.length===0&&(h=u);var d=h.reduce(function(g,f){return g[f]=pr(s,{placement:f,boundary:r,rootBoundary:n,padding:o})[Ai(f)],g},{});return Object.keys(d).sort(function(g,f){return d[g]-d[f]})}function Vm(s){if(Ai(s)===Ma)return[];var e=On(s);return[uh(s),e,uh(e)]}function Jm(s){var e=s.state,t=s.options,i=s.name;if(!e.modifiersData[i]._skip){for(var r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!0:o,A=t.fallbackPlacements,l=t.padding,c=t.boundary,u=t.rootBoundary,h=t.altBoundary,d=t.flipVariations,g=d===void 0?!0:d,f=t.allowedAutoPlacements,p=e.options.placement,v=Ai(p),y=v===p,Q=A||(y||!g?[On(p)]:Vm(p)),m=[p].concat(Q).reduce(function(te,ue){return te.concat(Ai(ue)===Ma?Km(e,{placement:ue,boundary:c,rootBoundary:u,padding:l,flipVariations:g,allowedAutoPlacements:f}):ue)},[]),b=e.rects.reference,x=e.rects.popper,B=new Map,H=!0,_=m[0],k=0;k<m.length;k++){var U=m[k],q=Ai(U),V=Ts(U)===ws,Z=[xt,Pt].indexOf(q)>=0,S=Z?"width":"height",T=pr(e,{placement:U,boundary:c,rootBoundary:u,altBoundary:h,padding:l}),O=Z?V?Ot:Tt:V?Pt:xt;b[S]>x[S]&&(O=On(O));var R=On(O),w=[];if(n&&w.push(T[q]<=0),a&&w.push(T[O]<=0,T[R]<=0),w.every(function(te){return te})){_=U,H=!1;break}B.set(U,w)}if(H)for(var L=g?3:1,K=function(ue){var ce=m.find(function(me){var Qe=B.get(me);if(Qe)return Qe.slice(0,ue).every(function(xe){return xe})});if(ce)return _=ce,"break"},G=L;G>0;G--){var j=K(G);if(j==="break")break}e.placement!==_&&(e.modifiersData[i]._skip=!0,e.placement=_,e.reset=!0)}}const Wm={name:"flip",enabled:!0,phase:"main",fn:Jm,requiresIfExists:["offset"],data:{_skip:!1}};function fh(s,e,t){return t===void 0&&(t={x:0,y:0}),{top:s.top-e.height-t.y,right:s.right-e.width+t.x,bottom:s.bottom-e.height+t.y,left:s.left-e.width-t.x}}function ph(s){return[xt,Ot,Pt,Tt].some(function(e){return s[e]>=0})}function qm(s){var e=s.state,t=s.name,i=e.rects.reference,r=e.rects.popper,n=e.modifiersData.preventOverflow,o=pr(e,{elementContext:"reference"}),a=pr(e,{altBoundary:!0}),A=fh(o,i),l=fh(a,r,n),c=ph(A),u=ph(l);e.modifiersData[t]={referenceClippingOffsets:A,popperEscapeOffsets:l,isReferenceHidden:c,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":u})}const jm={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:qm};function Xm(s,e,t){var i=Ai(s),r=[Tt,xt].indexOf(i)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:s})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*r,[Tt,Ot].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function zm(s){var e=s.state,t=s.options,i=s.name,r=t.offset,n=r===void 0?[0,0]:r,o=ih.reduce(function(c,u){return c[u]=Xm(u,e.rects,n),c},{}),a=o[e.placement],A=a.x,l=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=A,e.modifiersData.popperOffsets.y+=l),e.modifiersData[i]=o}const Zm={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:zm};function eC(s){var e=s.state,t=s.name;e.modifiersData[t]=gh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const tC={name:"popperOffsets",enabled:!0,phase:"read",fn:eC,data:{}};function iC(s){return s==="x"?"y":"x"}function sC(s){var e=s.state,t=s.options,i=s.name,r=t.mainAxis,n=r===void 0?!0:r,o=t.altAxis,a=o===void 0?!1:o,A=t.boundary,l=t.rootBoundary,c=t.altBoundary,u=t.padding,h=t.tether,d=h===void 0?!0:h,g=t.tetherOffset,f=g===void 0?0:g,p=pr(e,{boundary:A,rootBoundary:l,padding:u,altBoundary:c}),v=Ai(e.placement),y=Ts(e.placement),Q=!y,m=Ga(v),b=iC(m),x=e.modifiersData.popperOffsets,B=e.rects.reference,H=e.rects.popper,_=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,k=typeof _=="number"?{mainAxis:_,altAxis:_}:Object.assign({mainAxis:0,altAxis:0},_),U=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,q={x:0,y:0};if(x){if(n){var V,Z=m==="y"?xt:Tt,S=m==="y"?Pt:Ot,T=m==="y"?"height":"width",O=x[m],R=O+p[Z],w=O-p[S],L=d?-H[T]/2:0,K=y===ws?B[T]:H[T],G=y===ws?-H[T]:-B[T],j=e.elements.arrow,te=d&&j?Ua(j):{width:0,height:0},ue=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:ah(),ce=ue[Z],me=ue[S],Qe=gr(0,B[T],te[T]),xe=Q?B[T]/2-L-Qe-ce-k.mainAxis:K-Qe-ce-k.mainAxis,ae=Q?-B[T]/2+L+Qe+me+k.mainAxis:G+Qe+me+k.mainAxis,Ie=e.elements.arrow&&dr(e.elements.arrow),_e=Ie?m==="y"?Ie.clientTop||0:Ie.clientLeft||0:0,Te=(V=U==null?void 0:U[m])!=null?V:0,Ne=O+xe-Te-_e,re=O+ae-Te,le=gr(d?Nn(R,Ne):R,O,d?is(w,re):w);x[m]=le,q[m]=le-O}if(a){var be,De=m==="x"?xt:Tt,Ue=m==="x"?Pt:Ot,we=x[b],ke=b==="y"?"height":"width",Ce=we+p[De],Me=we-p[Ue],Xe=[xt,Tt].indexOf(v)!==-1,rt=(be=U==null?void 0:U[b])!=null?be:0,Ke=Xe?Ce:we-B[ke]-H[ke]-rt+k.altAxis,nt=Xe?we+B[ke]+H[ke]-rt-k.altAxis:Me,Ri=d&&Xe?wm(Ke,we,nt):gr(d?Ke:Ce,we,d?nt:Me);x[b]=Ri,q[b]=Ri-we}e.modifiersData[i]=q}}const rC={name:"preventOverflow",enabled:!0,phase:"main",fn:sC,requiresIfExists:["offset"]};function nC(s){return{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}}function oC(s){return s===Lt(s)||!Ut(s)?Ha(s):nC(s)}function aC(s){var e=s.getBoundingClientRect(),t=Rs(e.width)/s.offsetWidth||1,i=Rs(e.height)/s.offsetHeight||1;return t!==1||i!==1}function AC(s,e,t){t===void 0&&(t=!1);var i=Ut(e),r=Ut(e)&&aC(e),n=Pi(e),o=xs(s,r,t),a={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(i||!i&&!t)&&((ai(e)!=="body"||Ya(n))&&(a=oC(e)),Ut(e)?(A=xs(e,!0),A.x+=e.clientLeft,A.y+=e.clientTop):n&&(A.x=$a(n))),{x:o.left+a.scrollLeft-A.x,y:o.top+a.scrollTop-A.y,width:o.width,height:o.height}}function lC(s){var e=new Map,t=new Set,i=[];s.forEach(function(n){e.set(n.name,n)});function r(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var A=e.get(a);A&&r(A)}}),i.push(n)}return s.forEach(function(n){t.has(n.name)||r(n)}),i}function cC(s){var e=lC(s);return ym.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function uC(s){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(s())})})),e}}function hC(s){var e=s.reduce(function(t,i){var r=t[i.name];return t[i.name]=r?Object.assign({},r,i,{options:Object.assign({},r.options,i.options),data:Object.assign({},r.data,i.data)}):i,t},{});return Object.keys(e).map(function(t){return e[t]})}var Eh={placement:"bottom",modifiers:[],strategy:"absolute"};function Ih(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];return!e.some(function(i){return!(i&&typeof i.getBoundingClientRect=="function")})}function dC(s){s===void 0&&(s={});var e=s,t=e.defaultModifiers,i=t===void 0?[]:t,r=e.defaultOptions,n=r===void 0?Eh:r;return function(a,A,l){l===void 0&&(l=n);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Eh,n),modifiersData:{},elements:{reference:a,popper:A},attributes:{},styles:{}},u=[],h=!1,d={state:c,setOptions:function(v){var y=typeof v=="function"?v(c.options):v;f(),c.options=Object.assign({},n,c.options,y),c.scrollParents={reference:ts(a)?fr(a):a.contextElement?fr(a.contextElement):[],popper:fr(A)};var Q=cC(hC([].concat(i,c.options.modifiers)));return c.orderedModifiers=Q.filter(function(m){return m.enabled}),g(),d.update()},forceUpdate:function(){if(!h){var v=c.elements,y=v.reference,Q=v.popper;if(Ih(y,Q)){c.rects={reference:AC(y,dr(Q),c.options.strategy==="fixed"),popper:Ua(Q)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(k){return c.modifiersData[k.name]=Object.assign({},k.data)});for(var m=0;m<c.orderedModifiers.length;m++){if(c.reset===!0){c.reset=!1,m=-1;continue}var b=c.orderedModifiers[m],x=b.fn,B=b.options,H=B===void 0?{}:B,_=b.name;typeof x=="function"&&(c=x({state:c,options:H,name:_,instance:d})||c)}}}},update:uC(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){f(),h=!0}};if(!Ih(a,A))return d;d.setOptions(l).then(function(p){!h&&l.onFirstUpdate&&l.onFirstUpdate(p)});function g(){c.orderedModifiers.forEach(function(p){var v=p.name,y=p.options,Q=y===void 0?{}:y,m=p.effect;if(typeof m=="function"){var b=m({state:c,name:v,instance:d,options:Q}),x=function(){};u.push(b||x)}})}function f(){u.forEach(function(p){return p()}),u=[]}return d}}var gC=[Mm,tC,Fm,sh,Zm,Wm,rC,Dm,jm],fC=dC({defaultModifiers:gC}),pC="tippy-box",mh="tippy-content",EC="tippy-backdrop",Ch="tippy-arrow",vh="tippy-svg-arrow",ss={passive:!0,capture:!0},yh=function(){return document.body};function Va(s,e,t){if(Array.isArray(s)){var i=s[e];return i??(Array.isArray(t)?t[e]:t)}return s}function Ja(s,e){var t={}.toString.call(s);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function Bh(s,e){return typeof s=="function"?s.apply(void 0,e):s}function Qh(s,e){if(e===0)return s;var t;return function(i){clearTimeout(t),t=setTimeout(function(){s(i)},e)}}function IC(s){return s.split(/\s+/).filter(Boolean)}function Ds(s){return[].concat(s)}function bh(s,e){s.indexOf(e)===-1&&s.push(e)}function mC(s){return s.filter(function(e,t){return s.indexOf(e)===t})}function CC(s){return s.split("-")[0]}function Un(s){return[].slice.call(s)}function Sh(s){return Object.keys(s).reduce(function(e,t){return s[t]!==void 0&&(e[t]=s[t]),e},{})}function Er(){return document.createElement("div")}function Gn(s){return["Element","Fragment"].some(function(e){return Ja(s,e)})}function vC(s){return Ja(s,"NodeList")}function yC(s){return Ja(s,"MouseEvent")}function BC(s){return!!(s&&s._tippy&&s._tippy.reference===s)}function QC(s){return Gn(s)?[s]:vC(s)?Un(s):Array.isArray(s)?s:Un(document.querySelectorAll(s))}function Wa(s,e){s.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function wh(s,e){s.forEach(function(t){t&&t.setAttribute("data-state",e)})}function bC(s){var e,t=Ds(s),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function SC(s,e){var t=e.clientX,i=e.clientY;return s.every(function(r){var n=r.popperRect,o=r.popperState,a=r.props,A=a.interactiveBorder,l=CC(o.placement),c=o.modifiersData.offset;if(!c)return!0;var u=l==="bottom"?c.top.y:0,h=l==="top"?c.bottom.y:0,d=l==="right"?c.left.x:0,g=l==="left"?c.right.x:0,f=n.top-i+u>A,p=i-n.bottom-h>A,v=n.left-t+d>A,y=t-n.right-g>A;return f||p||v||y})}function qa(s,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){s[i](r,t)})}function Rh(s,e){for(var t=e;t;){var i;if(s.contains(t))return!0;t=t.getRootNode==null||(i=t.getRootNode())==null?void 0:i.host}return!1}var li={isTouch:!1},xh=0;function wC(){li.isTouch||(li.isTouch=!0,window.performance&&document.addEventListener("mousemove",Th))}function Th(){var s=performance.now();s-xh<20&&(li.isTouch=!1,document.removeEventListener("mousemove",Th)),xh=s}function RC(){var s=document.activeElement;if(BC(s)){var e=s._tippy;s.blur&&!e.state.isVisible&&s.blur()}}function xC(){document.addEventListener("touchstart",wC,ss),window.addEventListener("blur",RC)}var TC=typeof window<"u"&&typeof document<"u",DC=TC?!!window.msCrypto:!1,LC={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},_C={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Wt=Object.assign({appendTo:yh,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},LC,_C),kC=Object.keys(Wt),FC=function(e){var t=Object.keys(e);t.forEach(function(i){Wt[i]=e[i]})};function Dh(s){var e=s.plugins||[],t=e.reduce(function(i,r){var n=r.name,o=r.defaultValue;if(n){var a;i[n]=s[n]!==void 0?s[n]:(a=Wt[n])!=null?a:o}return i},{});return Object.assign({},s,t)}function NC(s,e){var t=e?Object.keys(Dh(Object.assign({},Wt,{plugins:e}))):kC,i=t.reduce(function(r,n){var o=(s.getAttribute("data-tippy-"+n)||"").trim();if(!o)return r;if(n==="content")r[n]=o;else try{r[n]=JSON.parse(o)}catch{r[n]=o}return r},{});return i}function Lh(s,e){var t=Object.assign({},e,{content:Bh(e.content,[s])},e.ignoreAttributes?{}:NC(s,e.plugins));return t.aria=Object.assign({},Wt.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var MC=function(){return"innerHTML"};function ja(s,e){s[MC()]=e}function _h(s){var e=Er();return s===!0?e.className=Ch:(e.className=vh,Gn(s)?e.appendChild(s):ja(e,s)),e}function kh(s,e){Gn(e.content)?(ja(s,""),s.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?ja(s,e.content):s.textContent=e.content)}function Xa(s){var e=s.firstElementChild,t=Un(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(mh)}),arrow:t.find(function(i){return i.classList.contains(Ch)||i.classList.contains(vh)}),backdrop:t.find(function(i){return i.classList.contains(EC)})}}function Fh(s){var e=Er(),t=Er();t.className=pC,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=Er();i.className=mh,i.setAttribute("data-state","hidden"),kh(i,s.props),e.appendChild(t),t.appendChild(i),r(s.props,s.props);function r(n,o){var a=Xa(e),A=a.box,l=a.content,c=a.arrow;o.theme?A.setAttribute("data-theme",o.theme):A.removeAttribute("data-theme"),typeof o.animation=="string"?A.setAttribute("data-animation",o.animation):A.removeAttribute("data-animation"),o.inertia?A.setAttribute("data-inertia",""):A.removeAttribute("data-inertia"),A.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?A.setAttribute("role",o.role):A.removeAttribute("role"),(n.content!==o.content||n.allowHTML!==o.allowHTML)&&kh(l,s.props),o.arrow?c?n.arrow!==o.arrow&&(A.removeChild(c),A.appendChild(_h(o.arrow))):A.appendChild(_h(o.arrow)):c&&A.removeChild(c)}return{popper:e,onUpdate:r}}Fh.$$tippy=!0;var PC=1,Hn=[],za=[];function OC(s,e){var t=Lh(s,Object.assign({},Wt,Dh(Sh(e)))),i,r,n,o=!1,a=!1,A=!1,l=!1,c,u,h,d=[],g=Qh(Ne,t.interactiveDebounce),f,p=PC++,v=null,y=mC(t.plugins),Q={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},m={id:p,reference:s,popper:Er(),popperInstance:v,props:t,state:Q,plugins:y,clearDelayTimeouts:Ke,setProps:nt,setContent:Ri,show:yt,hide:gi,hideWithInteractivity:fi,enable:Xe,disable:rt,unmount:pi,destroy:mt};if(!t.render)return m;var b=t.render(m),x=b.popper,B=b.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+m.id,m.popper=x,s._tippy=m,x._tippy=m;var H=y.map(function(Y){return Y.fn(m)}),_=s.hasAttribute("aria-expanded");return Ie(),L(),O(),R("onCreate",[m]),t.showOnCreate&&Ce(),x.addEventListener("mouseenter",function(){m.props.interactive&&m.state.isVisible&&m.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){m.props.interactive&&m.props.trigger.indexOf("mouseenter")>=0&&Z().addEventListener("mousemove",g)}),m;function k(){var Y=m.props.touch;return Array.isArray(Y)?Y:[Y,0]}function U(){return k()[0]==="hold"}function q(){var Y;return!!((Y=m.props.render)!=null&&Y.$$tippy)}function V(){return f||s}function Z(){var Y=V().parentNode;return Y?bC(Y):document}function S(){return Xa(x)}function T(Y){return m.state.isMounted&&!m.state.isVisible||li.isTouch||c&&c.type==="focus"?0:Va(m.props.delay,Y?0:1,Wt.delay)}function O(Y){Y===void 0&&(Y=!1),x.style.pointerEvents=m.props.interactive&&!Y?"":"none",x.style.zIndex=""+m.props.zIndex}function R(Y,Ae,ge){if(ge===void 0&&(ge=!0),H.forEach(function(Se){Se[Y]&&Se[Y].apply(Se,Ae)}),ge){var Re;(Re=m.props)[Y].apply(Re,Ae)}}function w(){var Y=m.props.aria;if(Y.content){var Ae="aria-"+Y.content,ge=x.id,Re=Ds(m.props.triggerTarget||s);Re.forEach(function(Se){var We=Se.getAttribute(Ae);if(m.state.isVisible)Se.setAttribute(Ae,We?We+" "+ge:ge);else{var Bt=We&&We.replace(ge,"").trim();Bt?Se.setAttribute(Ae,Bt):Se.removeAttribute(Ae)}})}}function L(){if(!(_||!m.props.aria.expanded)){var Y=Ds(m.props.triggerTarget||s);Y.forEach(function(Ae){m.props.interactive?Ae.setAttribute("aria-expanded",m.state.isVisible&&Ae===V()?"true":"false"):Ae.removeAttribute("aria-expanded")})}}function K(){Z().removeEventListener("mousemove",g),Hn=Hn.filter(function(Y){return Y!==g})}function G(Y){if(!(li.isTouch&&(A||Y.type==="mousedown"))){var Ae=Y.composedPath&&Y.composedPath()[0]||Y.target;if(!(m.props.interactive&&Rh(x,Ae))){if(Ds(m.props.triggerTarget||s).some(function(ge){return Rh(ge,Ae)})){if(li.isTouch||m.state.isVisible&&m.props.trigger.indexOf("click")>=0)return}else R("onClickOutside",[m,Y]);m.props.hideOnClick===!0&&(m.clearDelayTimeouts(),m.hide(),a=!0,setTimeout(function(){a=!1}),m.state.isMounted||ce())}}}function j(){A=!0}function te(){A=!1}function ue(){var Y=Z();Y.addEventListener("mousedown",G,!0),Y.addEventListener("touchend",G,ss),Y.addEventListener("touchstart",te,ss),Y.addEventListener("touchmove",j,ss)}function ce(){var Y=Z();Y.removeEventListener("mousedown",G,!0),Y.removeEventListener("touchend",G,ss),Y.removeEventListener("touchstart",te,ss),Y.removeEventListener("touchmove",j,ss)}function me(Y,Ae){xe(Y,function(){!m.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&Ae()})}function Qe(Y,Ae){xe(Y,Ae)}function xe(Y,Ae){var ge=S().box;function Re(Se){Se.target===ge&&(qa(ge,"remove",Re),Ae())}if(Y===0)return Ae();qa(ge,"remove",u),qa(ge,"add",Re),u=Re}function ae(Y,Ae,ge){ge===void 0&&(ge=!1);var Re=Ds(m.props.triggerTarget||s);Re.forEach(function(Se){Se.addEventListener(Y,Ae,ge),d.push({node:Se,eventType:Y,handler:Ae,options:ge})})}function Ie(){U()&&(ae("touchstart",Te,{passive:!0}),ae("touchend",re,{passive:!0})),IC(m.props.trigger).forEach(function(Y){if(Y!=="manual")switch(ae(Y,Te),Y){case"mouseenter":ae("mouseleave",re);break;case"focus":ae(DC?"focusout":"blur",le);break;case"focusin":ae("focusout",le);break}})}function _e(){d.forEach(function(Y){var Ae=Y.node,ge=Y.eventType,Re=Y.handler,Se=Y.options;Ae.removeEventListener(ge,Re,Se)}),d=[]}function Te(Y){var Ae,ge=!1;if(!(!m.state.isEnabled||be(Y)||a)){var Re=((Ae=c)==null?void 0:Ae.type)==="focus";c=Y,f=Y.currentTarget,L(),!m.state.isVisible&&yC(Y)&&Hn.forEach(function(Se){return Se(Y)}),Y.type==="click"&&(m.props.trigger.indexOf("mouseenter")<0||o)&&m.props.hideOnClick!==!1&&m.state.isVisible?ge=!0:Ce(Y),Y.type==="click"&&(o=!ge),ge&&!Re&&Me(Y)}}function Ne(Y){var Ae=Y.target,ge=V().contains(Ae)||x.contains(Ae);if(!(Y.type==="mousemove"&&ge)){var Re=ke().concat(x).map(function(Se){var We,Bt=Se._tippy,Qt=(We=Bt.popperInstance)==null?void 0:We.state;return Qt?{popperRect:Se.getBoundingClientRect(),popperState:Qt,props:t}:null}).filter(Boolean);SC(Re,Y)&&(K(),Me(Y))}}function re(Y){var Ae=be(Y)||m.props.trigger.indexOf("click")>=0&&o;if(!Ae){if(m.props.interactive){m.hideWithInteractivity(Y);return}Me(Y)}}function le(Y){m.props.trigger.indexOf("focusin")<0&&Y.target!==V()||m.props.interactive&&Y.relatedTarget&&x.contains(Y.relatedTarget)||Me(Y)}function be(Y){return li.isTouch?U()!==Y.type.indexOf("touch")>=0:!1}function De(){Ue();var Y=m.props,Ae=Y.popperOptions,ge=Y.placement,Re=Y.offset,Se=Y.getReferenceClientRect,We=Y.moveTransition,Bt=q()?Xa(x).arrow:null,Qt=Se?{getBoundingClientRect:Se,contextElement:Se.contextElement||V()}:s,Ns={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ms){var Gi=Ms.state;if(q()){var Qr=S(),br=Qr.box;["placement","reference-hidden","escaped"].forEach(function(Ps){Ps==="placement"?br.setAttribute("data-placement",Gi.placement):Gi.attributes.popper["data-popper-"+Ps]?br.setAttribute("data-"+Ps,""):br.removeAttribute("data-"+Ps)}),Gi.attributes.popper={}}}},bt=[{name:"offset",options:{offset:Re}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!We}},Ns];q()&&Bt&&bt.push({name:"arrow",options:{element:Bt,padding:3}}),bt.push.apply(bt,(Ae==null?void 0:Ae.modifiers)||[]),m.popperInstance=fC(Qt,x,Object.assign({},Ae,{placement:ge,onFirstUpdate:h,modifiers:bt}))}function Ue(){m.popperInstance&&(m.popperInstance.destroy(),m.popperInstance=null)}function we(){var Y=m.props.appendTo,Ae,ge=V();m.props.interactive&&Y===yh||Y==="parent"?Ae=ge.parentNode:Ae=Bh(Y,[ge]),Ae.contains(x)||Ae.appendChild(x),m.state.isMounted=!0,De()}function ke(){return Un(x.querySelectorAll("[data-tippy-root]"))}function Ce(Y){m.clearDelayTimeouts(),Y&&R("onTrigger",[m,Y]),ue();var Ae=T(!0),ge=k(),Re=ge[0],Se=ge[1];li.isTouch&&Re==="hold"&&Se&&(Ae=Se),Ae?i=setTimeout(function(){m.show()},Ae):m.show()}function Me(Y){if(m.clearDelayTimeouts(),R("onUntrigger",[m,Y]),!m.state.isVisible){ce();return}if(!(m.props.trigger.indexOf("mouseenter")>=0&&m.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(Y.type)>=0&&o)){var Ae=T(!1);Ae?r=setTimeout(function(){m.state.isVisible&&m.hide()},Ae):n=requestAnimationFrame(function(){m.hide()})}}function Xe(){m.state.isEnabled=!0}function rt(){m.hide(),m.state.isEnabled=!1}function Ke(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(n)}function nt(Y){if(!m.state.isDestroyed){R("onBeforeUpdate",[m,Y]),_e();var Ae=m.props,ge=Lh(s,Object.assign({},Ae,Sh(Y),{ignoreAttributes:!0}));m.props=ge,Ie(),Ae.interactiveDebounce!==ge.interactiveDebounce&&(K(),g=Qh(Ne,ge.interactiveDebounce)),Ae.triggerTarget&&!ge.triggerTarget?Ds(Ae.triggerTarget).forEach(function(Re){Re.removeAttribute("aria-expanded")}):ge.triggerTarget&&s.removeAttribute("aria-expanded"),L(),O(),B&&B(Ae,ge),m.popperInstance&&(De(),ke().forEach(function(Re){requestAnimationFrame(Re._tippy.popperInstance.forceUpdate)})),R("onAfterUpdate",[m,Y])}}function Ri(Y){m.setProps({content:Y})}function yt(){var Y=m.state.isVisible,Ae=m.state.isDestroyed,ge=!m.state.isEnabled,Re=li.isTouch&&!m.props.touch,Se=Va(m.props.duration,0,Wt.duration);if(!(Y||Ae||ge||Re)&&!V().hasAttribute("disabled")&&(R("onShow",[m],!1),m.props.onShow(m)!==!1)){if(m.state.isVisible=!0,q()&&(x.style.visibility="visible"),O(),ue(),m.state.isMounted||(x.style.transition="none"),q()){var We=S(),Bt=We.box,Qt=We.content;Wa([Bt,Qt],0)}h=function(){var bt;if(!(!m.state.isVisible||l)){if(l=!0,x.offsetHeight,x.style.transition=m.props.moveTransition,q()&&m.props.animation){var as=S(),Ms=as.box,Gi=as.content;Wa([Ms,Gi],Se),wh([Ms,Gi],"visible")}w(),L(),bh(za,m),(bt=m.popperInstance)==null||bt.forceUpdate(),R("onMount",[m]),m.props.animation&&q()&&Qe(Se,function(){m.state.isShown=!0,R("onShown",[m])})}},we()}}function gi(){var Y=!m.state.isVisible,Ae=m.state.isDestroyed,ge=!m.state.isEnabled,Re=Va(m.props.duration,1,Wt.duration);if(!(Y||Ae||ge)&&(R("onHide",[m],!1),m.props.onHide(m)!==!1)){if(m.state.isVisible=!1,m.state.isShown=!1,l=!1,o=!1,q()&&(x.style.visibility="hidden"),K(),ce(),O(!0),q()){var Se=S(),We=Se.box,Bt=Se.content;m.props.animation&&(Wa([We,Bt],Re),wh([We,Bt],"hidden"))}w(),L(),m.props.animation?q()&&me(Re,m.unmount):m.unmount()}}function fi(Y){Z().addEventListener("mousemove",g),bh(Hn,g),g(Y)}function pi(){m.state.isVisible&&m.hide(),m.state.isMounted&&(Ue(),ke().forEach(function(Y){Y._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),za=za.filter(function(Y){return Y!==m}),m.state.isMounted=!1,R("onHidden",[m]))}function mt(){m.state.isDestroyed||(m.clearDelayTimeouts(),m.unmount(),_e(),delete s._tippy,m.state.isDestroyed=!0,R("onDestroy",[m]))}}function rs(s,e){e===void 0&&(e={});var t=Wt.plugins.concat(e.plugins||[]);xC();var i=Object.assign({},e,{plugins:t}),r=QC(s),n=r.reduce(function(o,a){var A=a&&OC(a,i);return A&&o.push(A),o},[]);return Gn(s)?n[0]:n}rs.defaultProps=Wt,rs.setDefaultProps=FC,rs.currentInput=li,Object.assign({},sh,{effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow)}}),rs.setDefaultProps({render:Fh});class ci extends Error{constructor(e,t=new Error,i=!1){super(),this.fatal=!1,this.fatal=i,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const UC=5;function GC(s,e){const t=s.map(({id:r})=>r).join("|"),i=e.map(({id:r})=>r).join("|");return t===i}class HC{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=gt(),this._controls=gt(),this.host=e}set activeScenes(e){GC(e,this._activeScenes)||(this._activeScenes=e,this.host.dispatchEvent(new CustomEvent("scenechange",{detail:e})),this.host.requestUpdate())}get activeScenes(){return this._activeScenes}set currentTime(e){var t,i,r,n,o;const a=Math.min(this.host.duration,Math.max(0,e));this.activeScenes=((t=this.host.scenes)==null?void 0:t.filter(({start:u,duration:h})=>a>=u&&a<u+h))??[];const A=a!==this.currentTime;this._currentTime=a,this._upcomingScenes=((i=this.host.scenes)==null?void 0:i.filter(({start:u})=>a>=u-UC&&a<u))??[],this.loadScenes(),this.syncVideoState(),(r=this._controls.value)==null||r.setAttribute("currentTime",a.toString());const l=this.activeScenes[0],c=yl((n=l==null?void 0:l.videoMeta)==null?void 0:n.captions);this.caption=((o=c.find(({start:u,end:h})=>{var d;const g=a-l.start+(((d=l.videoMeta)==null?void 0:d.start)??0);return u&&h&&g>=jr(u)&&g<=jr(h)}))==null?void 0:o.text)??"",A&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:a})),this.draw(a)}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return ft(this._canvas)}controls(){return ft(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{var t,i,r;const{start:n,duration:o,video:a,videoMeta:A}=e,l=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;if(a&&A){const{key:c,hls:u,node:h}=a,{start:d,duration:g}=A,f=this.host.videoState[c];h&&f&&(h.currentTime>=d+g||h.ended||l&&(u?(t=u.startLoadOnce)==null||t.call(u,d):f.initialised||(i=h.startLoadOnce)==null||i.call(h)))}else if(l){const c=`${n}-${o}`,u=this.host._sceneController.videoState[c];this.host.duration&&!((r=u==null?void 0:u.buffered)!=null&&r.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[c]:{...u,buffered:[{start:Math.max(0,n/this.host.duration*100),end:Math.min((n+o)/this.host.duration*100,100)}]}})}})}syncVideoState(){var e;(e=this.host.scenes)==null||e.forEach(t=>{if(t.video){const{key:i,node:r}=t.video,n=this.host.videoState[i],o=this.activeScenes.includes(t);if(r&&n)if(o&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(r.paused&&n.initialised)try{return r.play()}catch(a){throw new ci("Video play error",a,!0)}}else r.paused||r.pause()}})}draw(e=this.currentTime){var t,i;this.host.sceneConfig&&this._canvas.value&&((i=(t=this.host).compilation)==null||i.call(t,{currentTime:e,scenes:this.host.sceneConfig,canvas:this._canvas.value}))}clear(){var e;const t=this._canvas.value;(e=t==null?void 0:t.getContext("2d"))==null||e.clearRect(0,0,t.width,t.height)}}function $C(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function YC(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function KC(s,e){return new Promise(t=>{const{id:i,key:r,duration:n}=e,o=document.createElement("video");o.playsInline=!0,o.muted=!0,o.loop=!1,o.src=s;let a=!1;if(o.startLoadOnce=()=>{a||(o.preload="auto",o.load(),a=!0)},n)o.preload="none",t({id:i,key:r,hls:null,config:e,node:o});else{o.preload="metadata";const A=async()=>{t({id:i,key:r,hls:null,config:e,node:o}),o.removeEventListener("loadedmetadata",A)};o.addEventListener("loadedmetadata",A)}})}function VC(s,e){return new Promise(t=>{const{id:i,key:r}=e,n=document.createElement("video");n.playsInline=!0,n.muted=!0,n.loop=!1;let o=!1;const a=new Si({autoStartLoad:!0,xhrSetup:A=>{const{open:l}=A,c=s.split("?")[1];A.open=function(u,h,d){h.toString().includes("?")||(h+="?"+c),!(!o&&h.toString().includes(".ts"))&&l.apply(this,[u,h,d])}}});a.on(Si.Events.LEVEL_LOADED,async()=>{o||a==null||a.stopLoad(),t({id:i,key:r,hls:a,config:e,node:n})}),a.loadSource(s),a.attachMedia(n),a.startLoadOnce=(A=-1,l)=>{if(a&&!o){const c=a==null?void 0:a.levels.findIndex(u=>Math.min(u.height,u.width)===l);o=!0,a.startLevel=a.firstLevel,a.startLoad(A),a.currentLevel=c!==-1?c:a.firstLevel}}})}function Za(s){const{src:e,playlist:t}=s;return t&&!$C()&&Si.isSupported()?VC(t,s):KC(e,s)}async function Nh(s){return s.duration===1/0?new Promise(e=>{s.currentTime=Number.MAX_SAFE_INTEGER,s.ontimeupdate=()=>{s.ontimeupdate=null,e(s.duration),s.currentTime=0}}):s.duration}const JC=$t(async function(e){return new FontFace(e.name,`url(${e.woff2??e.url})`,{style:e.style,weight:e.weight}).load()},{cacheKey:([s])=>JSON.stringify(s)});let WC=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._scenes=null,this._videos={},this._videoMeta={},this._videoState={},this._delayProcessing=(t=100)=>{const i=new AbortController,r=setTimeout(()=>{i.signal.aborted||(this.host._processing=!0)},t);return i.signal.addEventListener("abort",()=>{clearTimeout(r)}),i},this._createDataResolver=t=>i=>this.host.dataResolver(i,{language:t}),this._resolveVideo=$t(async t=>{const{id:i,key:r}=t,n=await Za(t);n.node.volume=this.host.volume,n.node.playbackRate=this.host.playbackRate;const o={loadeddata:this._handleLoadedData,waiting:this._handleWaiting,canplay:this._handleCanPlay,progress:this._handleProgress,seeking:this._handleSeeking,seeked:this._handleSeeked,play:this._handlePlay,playing:this._handlePlaying,pause:this._handlePause,stalled:this._handleStalled,timeupdate:this._handleTimeUpdate,ended:this._handleEnded,error:this._handleError},a=Object.keys(o).reduce((A,l)=>{const c=l,u=o[c]({id:i,key:r,node:n.node});return A[c]=u,n.node.addEventListener(l,u),A},{});return{...n,listeners:a}},{cacheKey:([{id:t,key:i,src:r,playlist:n}])=>JSON.stringify({id:t,key:i,src:r==null?void 0:r.split("?")[0],playlist:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=$t(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await Nh(i),c=(a??0)*l,u=(1-(A??0))*l;return{id:r,config:t,captions:n,start:c,duration:u-c}},{cacheKey:([t])=>JSON.stringify(t)}),this._handleLoadedData=({id:t,key:i,node:r})=>()=>{var n,o;const a=this.videoState[i];if(!(a!=null&&a.initialised)){this.videoState={...this.videoState,[i]:{...a,initialised:!0,waiting:!1,buffered:(a==null?void 0:a.buffered)??[]}};const A=(o=(n=this.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({video:l})=>{l==null||l.key});A&&this._setVideoCurrentTime({scene:A,time:this.host.currentTime}),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:i,node:r}}))}},this._handleWaiting=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&!(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const i=this.videoState[t];i!=null&&i.initialised&&(i!=null&&i.waiting)&&(this.videoState={...this.videoState,[t]:{...i,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=({key:t,node:i})=>()=>{const r=this.videoState[t],n=this._getBufferSegments({key:t,node:i,duration:this.host.duration});this.videoState={...this.videoState,[t]:{...r,buffered:n}}},this._handleSeeking=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:i,node:r}}))},this._handleSeeked=({id:t,key:i,node:r})=>()=>{const n=this.videoState[i];n!=null&&n.initialised&&(this.host.draw(),this.host.activeScenes.map(o=>{var a;return(a=o.videoMeta)==null?void 0:a.id}).includes(t)&&this.host.dispatchEvent(new CustomEvent("seeked",{detail:this.host.currentTime})),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:i,node:r}})))},this._handlePlay=({id:t,key:i,node:r})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:i,node:r}}))},this._handlePlaying=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:i,node:r}}))},this._handlePause=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:i,node:r}}))},this._handleStalled=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:i,node:r}}))},this._handleTimeUpdate=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:i,node:r}}))},this._handleEnded=({id:t,key:i,node:r})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:i,node:r}}))},this._handleError=({id:t,key:i,node:r})=>()=>{const n=new ci(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:n,message:n.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:i,node:r}}))},this._cleanupVideo=t=>{var i;const r=this.videos[t];r&&(r.node.pause(),r.node.src="",(i=r.hls)==null||i.destroy(),Object.keys(r.listeners??{}).forEach(n=>{var o,a;if((o=this.videos)!=null&&o[t]){const A=(a=r.listeners)==null?void 0:a[n];A&&r.node.removeEventListener(n,A)}}),delete this.videos[t])},this.host=e,this.host.addController(this)}set hasPlayed(e){e!==this._hasPlayed&&(this._hasPlayed=e,this.host.requestUpdate())}get hasPlayed(){return this._hasPlayed}set duration(e){!isNaN(e)&&e!==this._duration&&(this._duration=e,this.host.requestUpdate(),this.host.dispatchEvent(new CustomEvent("durationchange",{detail:this._duration})))}get duration(){return this._duration}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}set videoMeta(e){e!==this._videoMeta&&(this._videoMeta=e,this.host.requestUpdate())}get videoMeta(){return this._videoMeta}set videoState(e){e!==this._videoState&&(this._videoState=e,this.host.requestUpdate())}get videoState(){return this._videoState}_getBufferSegments({key:e,node:t,duration:i}){var r;const n=t==null?void 0:t.buffered,o=[],{start:a,video:A,videoMeta:l}=((r=this.scenes)==null?void 0:r.scenes.find(({video:c})=>e===(c==null?void 0:c.key)))??{};if(t&&n&&A&&l&&typeof a<"u")for(let c=0;c<n.length;c++){const u=n.start(c),h=n.end(c);Math.max(u,l.start)<=Math.min(h,l.start+l.duration)&&o.push({start:Math.max(0,(Math.max(u-l.start,0)+a)/i*100),end:Math.min((Math.min(h-l.start,l.duration)+a)/i*100,100)})}return o}_setupTask(){new Lr(this.host,async([e,t,i,r,n,o])=>{var a;const A=this._delayProcessing();try{let l=null;if(this.host._errors=[],this.host._languages=this.host.languageResolver({data:e}),(!n||!this.host._languages.find(({value:c})=>n===c))&&(this.host._language=(a=this.host._languages[0])==null?void 0:a.value),i||e){if(i){let g=null;if(r)try{g=await(await fetch(r,{method:"GET"})).text()}catch(v){const y=new ci("Track failed to fetch",v);this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:y,message:y.message}))}const p={questions:{items:[{answer:{id:"source",media:{[i.includes(".m3u8")?"playlist":"video"]:i},captions:{current:g}}}]}};try{this.scenes=await gs({data:p,template:t,debug:o},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(v){try{this.scenes=await gs({data:p,debug:o},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(y){throw new ci("Fatal source template error",y,!0)}l=new ci("Source template error",v)}}else try{this.scenes=await gs({data:e,template:t,debug:o},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(g){try{this.scenes=await gs({data:e,debug:o},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(f){throw new ci("Fatal data template error",f,!0)}l=new ci("Data template error",g)}Object.keys(this.videos).forEach(g=>{this.scenes.scenes.find(({video:f})=>g===(f==null?void 0:f.key))||this._videos[g].node.pause()});const[c,u,h]=this.scenes.scenes.reduce((g,{video:f,videoMeta:p,start:v,duration:y})=>{var Q;f&&(g[0][f.key]=f,p&&(g[1][f.key]=p));const m=(f==null?void 0:f.key)??`${v}-${y}`,b=this._getBufferSegments({key:m,node:f==null?void 0:f.node,duration:this.scenes.duration});return g[2][m]={initialised:!f,waiting:!!f,...this.videoState[m],buffered:f?b:(Q=this.videoState[m])==null?void 0:Q.buffered},g},[{},{},{}]);this.videos=c,this.videoMeta=u,this.videoState={...this.videoState,...h},(await Promise.all(this.scenes.fonts.map(g=>JC(g)))).forEach(g=>{document.fonts.add(g)}),this.duration=this.scenes.duration,this.host.currentTime>this.duration?this.host.reset(this.duration,!1):this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused)}l&&this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:l,message:l.message})),this.host.dispatchEvent(new CustomEvent("scenesupdate",{detail:this.scenes,bubbles:!0,composed:!0}))}catch(l){this.scenes=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:l,message:l.message}))}finally{A.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template,src:this.host.src,track:this.host.track,language:this.host.language,debug:this.host.debug});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.data,this.host.template,this.host.src,this.host.track,this.host.language,this.host.debug];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:i,video:r,videoMeta:n}=t;if(r&&r.node&&n&&typeof i<"u"){const o=e-i;r.node.currentTime=Math.max(n.start,Math.min(n.start+n.duration,o+n.start))}}setVideosCurrentTime(e){var t;(t=this.scenes)==null||t.scenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function qC(s){s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.msRequestFullscreen&&s.msRequestFullscreen()}function jC(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const eA=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],XC={id:"captions",event:"captions:click",label:"Closed Captions"},zC={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Mh={title:"Playback Speed",items:[{id:"playback-rate-0.5",event:"playbackRate:click",label:"0.5x",value:.5},{id:"playback-rate-1",event:"playbackRate:click",label:"1.0x",value:1},{id:"playback-rate-1.5",event:"playbackRate:click",label:"1.5x",value:1.5},{id:"playback-rate-2",event:"playbackRate:click",label:"2.0x",value:2}]},ZC={id:"playbackRate",label:"Playback playbackRate",subItems:Mh};class ev extends $A{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==cs.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}disconnected(){var e;(e=this.observer)==null||e.disconnect(),this.observer=void 0}reconnected(){var e;this.element&&((e=this.observer)==null||e.observe(this.element))}update(e,[t]){return this.isConnected&&!this.observer&&(this.observer=new ResizeObserver(t),this.element=e.element,this.observer.observe(this.element)),Ht}}const tA=us(ev),tv=cm(()=>{const s=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert","url(https://vouch-clients.s3.ap-southeast-2.amazonaws.com/vouch/fonts/Roobert-Bold.woff2",{style:"normal",weight:"700"}),i=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),r=Ll.map(n=>({load:!1,font:new FontFace(n.family,`url(${n.url})`,{style:n.style})}));return[{load:!0,font:s},{load:!0,font:e},{load:!0,font:t},{load:!0,font:i},...r]}),ui={"red-120":"#feeded","red-130":"#fcd5d0","red-400":"#e84a4a","red-500":"#c51c3a","red-700":"#a21c39","red-800":"#850231","red-900":"#580A2D","teal-80":"#f3fafa","teal-100":"#d6f1f1","teal-200":"#ace3e3","teal-300":"#7acace","teal-400":"#4faab2","teal-500":"#358f97","teal-600":"#287179","teal-700":"#22555c","teal-800":"#21484e","teal-900":"#1f3d42","teal-950":"#0d2126","purple-100":"#d7cfff","purple-700":"#5f2fe9","green-200":"#a4d7aa","green-500":"#38b319","green-800":"#2b3c2f","grey-100":"#f0f0f0","light-50":"rgba(255, 255, 255, .05)","light-100":"rgba(255, 255, 255, .1)","light-200":"rgba(255, 255, 255, .2)","light-400":"rgba(255, 255, 255, .4)","light-500":"rgba(255, 255, 255, .5)","light-640":"rgba(255, 255, 255, .64)","light-800":"rgba(255, 255, 255, .8)","light-1000":"#fff","dark-50":"rgba(0, 0, 0, .05)","dark-80":"rgba(0, 0, 0, .08)","dark-100":"rgba(0, 0, 0, .1)","dark-200":"rgba(0, 0, 0, .2)","dark-250":"rgba(0, 0, 0, .25)","dark-400":"rgba(0, 0, 0, .4)","dark-500":"rgba(0, 0, 0, .5)","dark-640":"rgba(0, 0, 0, .64)","dark-800":"rgba(0, 0, 0, .8)","dark-900":"rgba(0, 0, 0, .9)","dark-1000":"#000"},iv={colors:ui,space:{xxs:".25rem",xs:".5rem",small:".75rem",medium:"1rem",large:"1.5rem",xl:"2.5rem"},sizes:{xxs:"1rem",xs:"1.5rem",small:"2rem",medium:"2.5rem",large:"3rem"},fontWeights:{regular:400,semibold:600},lineHeights:{small:1.1,medium:1.25,large:1.4},letterSpacings:{xxs:"-.04rem",xs:"-.03rem",small:"-.02rem",medium:"-.01rem",large:0},fontSizes:{micro:".625rem",small:".75rem",medium:".875rem",large:"1rem",xl:"1.25rem",xxl:"1.5rem",xxxl:"2rem",huge:"2.75rem"},fontFamilies:{sans:'Roobert, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,"Noto Sans", "Noto Color Emoji", sans-serif, "Segoe UI Emoji", "Segoe UI Symbol", "Apple Color Emoji"',mono:'"Maison Neue Mono", Menlo, Monaco, Consolas, Liberation Mono, "Courier New", monospace'},borderWidths:{thin:".0625rem"},radii:{small:".25rem",medium:".5rem",large:".75rem",xl:"1rem"},shadows:{small:`.25rem .25rem .25rem ${ui["dark-100"]}`,medium:`0 .125rem .625rem ${ui["dark-100"]}`,large:`0 .25rem 1rem ${ui["dark-50"]}`,xl:`.25rem .25rem 1rem ${ui["dark-250"]}`,xxl:`0 .25rem 2rem ${ui["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${ui["dark-250"]}`,toolbar:`0 -.625rem .625rem ${ui["dark-50"]}`,text:`0 0 .25rem ${ui["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:ui["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Ph=am(iv,{delimiter:"-"}),sv=Object.keys(Ph).map(s=>Os(`:host { --${s}: ${Ph[s]}; }`)),Oe=(s=>{const e=class extends s{firstUpdated(){tv().forEach(({load:n,font:o})=>{document.fonts.add(o),n&&o.load()})}};return e.styles=[(s==null?void 0:s.styles)??[],sv,at`
187
191
  :host {
188
192
  font-family: var(--fontFamilies-sans);
189
193
  font-size: var(--fontSizes-medium);
190
194
  line-height: var(--lineHeights-medium);
191
195
  font-weight: var(--fontWeights-regular);
192
196
  }
193
- `,it`
197
+ `,at`
194
198
  *,
195
199
  *::before,
196
200
  *::after,
@@ -264,12 +268,12 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
264
268
  scroll-behavior: auto !important;
265
269
  }
266
270
  }
267
- `];let e=t;return e})(fi),wm=(s,e)=>(typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,e)),e),Sm=(s,e)=>{const{kind:t,elements:i}=e;return{kind:t,elements:i,finisher(r){typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,r))}}},Bt=s=>e=>typeof e=="function"?wm(s,e):Sm(s,e);class Dm{constructor(e){this._memoKey=null,this._lastDeps=null,this._scenes=null,this._video=null,this._handleSeeked=()=>{this.host._draw()},this._createDataResolver=t=>i=>this.host.dataResolver(i,{language:t}),this._resolveVideo=Li(async t=>{const i=await Fa(t);return i.node.play=async()=>{},i.node.addEventListener("seeked",this._handleSeeked),i},{cacheKey:([{id:t,src:i,playlist:r}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0]})}),this._resolveAnswer=Li(async t=>{const{id:i,key:r,poster:n}=t,{node:o}=await Fa(t),a=new Image;return{id:i,key:r,config:t,node:o,getSource:()=>(n&&a.src!==n&&(a.onload=()=>{this.host._draw()},a.src=n),a)}},{cacheKey:([{id:t,src:i,playlist:r,poster:n}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0],poster:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=Li(async(t,i)=>{const{id:r,duration:n,startOffset:o,endOffset:a}=t,A=n??await Qu(i),l=(o??0)*A,c=(1-(a??0))*A;return{id:r,start:l,duration:c-l}},{cacheKey:([{id:t,duration:i,startOffset:r,endOffset:n}])=>JSON.stringify({id:t,duration:i,startOffset:r,endOffset:n})}),this.host=e,this.host.addController(this)}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}_setupTask(){new Sr(this.host,async([e,t,i,r])=>{var n,o;try{if(e){const a=e.includes(".m3u8")?"playlist":"video";try{this.scenes=await hs({data:{questions:{items:[{answer:{id:"source",media:{[a]:e}}}]}},template:i},this._createDataResolver(r),this._resolveVideo,this._resolveVideoMeta)}catch(A){throw new Ai("Video preview source template error",A)}this._video=((o=(n=this.scenes.scenes[0])==null?void 0:n.video)==null?void 0:o.node)??null}else if(t)try{this.scenes=await hs({data:t,template:i},this._createDataResolver(r),this._resolveAnswer,this._resolveVideoMeta)}catch(a){throw new Ai("Video preview data template error",a)}}catch(a){this.scenes=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:a,message:a.message}))}},()=>{const e=JSON.stringify({data:this.host.data,template:this.host.template,language:this.host.language});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.src,this.host.data,this.host.template,this.host.language];return this._memoKey=e,this._lastDeps=t,t})}hostConnected(){this._setupTask()}hostDisconnected(){this._video&&(this._video.pause(),this._video.removeEventListener("seeked",this._handleSeeked),this._video.src="",this._video=null)}}function Su(s,e,t){return Math.min(Math.max(e,s),t)}function Ua(s,e={}){const t=Math.max(0,s||0),i=Math.floor(t/3600),r=Math.floor(t%3600/60),n=Math.floor(t%3600%60),o=Math.floor(t%1*1e3);let a=i?`${i}:${`${r}`.padStart(2,"0")}:${`${n}`.padStart(2,"0")}`:`${r}:${`${n}`.padStart(2,"0")}`;return e.includeMs&&(a+=`:${`${o}`.padStart(3,"0")}`),a}var bm=Object.defineProperty,Rm=Object.getOwnPropertyDescriptor,Ts=(s,e,t,i)=>{for(var r=i>1?void 0:i?Rm(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&bm(e,t,r),r};let Fi=class extends Fe{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return fe`<button
268
- class=${Ue({active:this.active,"size-tiny":this.size==="tiny","size-small":this.size==="small","size-large":this.size==="large","radius-medium":this.rounded==="medium","radius-full":this.rounded==="full","weight-light":this.weight==="light","weight-heavy":this.weight==="heavy"})}
271
+ `],e})(mi),rv=(s,e)=>(typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,e)),e),nv=(s,e)=>{const{kind:t,elements:i}=e;return{kind:t,elements:i,finisher(r){typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,r))}}},St=s=>e=>typeof e=="function"?rv(s,e):nv(s,e);class ov{constructor(e){this._memoKey=null,this._lastDeps=null,this._scenes=null,this._video=null,this._handleSeeked=()=>{this.host._draw()},this._createDataResolver=t=>i=>this.host.dataResolver(i,{language:t}),this._resolveVideo=$t(async t=>{const i=await Za(t);return i.node.play=async()=>{},i.node.addEventListener("seeked",this._handleSeeked),i},{cacheKey:([{id:t,src:i,playlist:r}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0]})}),this._resolveAnswer=$t(async t=>{const{id:i,key:r,poster:n}=t,{node:o}=await Za(t),a=new Image;return{id:i,key:r,config:t,node:o,getSource:()=>(n&&a.src!==n&&(a.onload=()=>{this.host._draw()},a.src=n),a)}},{cacheKey:([{id:t,src:i,playlist:r,poster:n}])=>JSON.stringify({id:t,src:i==null?void 0:i.split("?")[0],playlist:r==null?void 0:r.split("?")[0],poster:n==null?void 0:n.split("?")[0]})}),this._resolveVideoMeta=$t(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await Nh(i),c=(a??0)*l,u=(1-(A??0))*l;return{id:r,config:t,captions:n,start:c,duration:u-c}},{cacheKey:([{id:t,duration:i,startOffset:r,endOffset:n}])=>JSON.stringify({id:t,duration:i,startOffset:r,endOffset:n})}),this.host=e,this.host.addController(this)}set scenes(e){e!==this._scenes&&(this._scenes=e,this.host.requestUpdate())}get scenes(){return this._scenes}_setupTask(){new Lr(this.host,async([e,t,i,r,n])=>{var o,a;try{if(e)return;if(t){const A=t.includes(".m3u8")?"playlist":"video";try{this.scenes=await gs({data:{questions:{items:[{answer:{id:"source",media:{[A]:t,reducedQuality:t}}}]}},template:r},this._createDataResolver(n),this._resolveVideo,this._resolveVideoMeta)}catch(l){throw new ci("Video preview source template error",l)}this._video=((a=(o=this.scenes.scenes[0])==null?void 0:o.video)==null?void 0:a.node)??null}else if(i)try{this.scenes=await gs({data:i,template:r},this._createDataResolver(n),this._resolveAnswer,this._resolveVideoMeta)}catch(A){throw new ci("Video preview data template error",A)}}catch(A){this.scenes=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:A,message:A.message}))}},()=>{const e=JSON.stringify({disabled:this.host.disabled,src:this.host.src,data:this.host.data,template:this.host.template,language:this.host.language});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.disabled,this.host.src,this.host.data,this.host.template,this.host.language];return this._memoKey=e,this._lastDeps=t,t})}hostConnected(){this._setupTask()}hostDisconnected(){this._video&&(this._video.pause(),this._video.removeEventListener("seeked",this._handleSeeked),this._video.src="",this._video=null)}}function Oh(s,e,t){return Math.min(Math.max(e,s),t)}function Ir(s,e){return e?e instanceof ShadowRoot?Ir(s,e.host):e instanceof HTMLElement&&e.matches(s)?e:Ir(s,e.parentNode):null}function iA(s,e={}){const t=Math.max(0,s||0),i=Math.floor(t/3600),r=Math.floor(t%3600/60),n=Math.floor(t%3600%60),o=Math.floor(t%1*1e3);let a=i?`${i}:${`${r}`.padStart(2,"0")}:${`${n}`.padStart(2,"0")}`:`${r}:${`${n}`.padStart(2,"0")}`;return e.includeMs&&(a+=`:${`${o}`.padStart(3,"0")}`),a}var av=Object.defineProperty,Av=Object.getOwnPropertyDescriptor,Ls=(s,e,t,i)=>{for(var r=i>1?void 0:i?Av(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&av(e,t,r),r};let Oi=class extends Oe{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return fe`<button
272
+ class=${$e({active:this.active,"size-tiny":this.size==="tiny","size-small":this.size==="small","size-large":this.size==="large","radius-medium":this.rounded==="medium","radius-full":this.rounded==="full","weight-light":this.weight==="light","weight-heavy":this.weight==="heavy"})}
269
273
  >
270
274
  <slot></slot>
271
275
  ${this.icon&&fe`<vmp-icon icon=${this.icon}></vmp-icon>`}
272
- </button>`}};Fi.styles=[Fe.styles??[],it`
276
+ </button>`}};Oi.styles=[Oe.styles??[],at`
273
277
  :host {
274
278
  --button-padding: var(--vu-button-padding, var(--space-s));
275
279
  --button-color: var(--vu-button-color, var(--colors-dark-640));
@@ -345,7 +349,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
345
349
  .weight-light:focus {
346
350
  --button-background: var(--vu-button-background-hover, #9d9d9d);
347
351
  }
348
- `],Ts([V({type:Boolean})],Fi.prototype,"active",2),Ts([V({type:String})],Fi.prototype,"size",2),Ts([V({type:String})],Fi.prototype,"rounded",2),Ts([V({type:String})],Fi.prototype,"weight",2),Ts([V({type:String})],Fi.prototype,"icon",2),Fi=Ts([Bt("vmp-button")],Fi);const Du={"arrow-left":()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
352
+ `],Ls([J({type:Boolean})],Oi.prototype,"active",2),Ls([J({type:String})],Oi.prototype,"size",2),Ls([J({type:String})],Oi.prototype,"rounded",2),Ls([J({type:String})],Oi.prototype,"weight",2),Ls([J({type:String})],Oi.prototype,"icon",2),Oi=Ls([St("vmp-button")],Oi);const Uh={"arrow-left":()=>fe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
349
353
  <path
350
354
  d="M16.6666 9.21875H6.52492L11.1833 4.85156L9.99992 3.75L3.33325 10L9.99992 16.25L11.1749 15.1484L6.52492 10.7812H16.6666V9.21875Z"
351
355
  fill="currentColor"
@@ -506,26 +510,26 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
506
510
  <path
507
511
  d="M9.853 23.246L4.86 7.688H0L7 27.42h5.52l7.265-19.733h-4.65L9.854 23.246zM95.12 7.08a8.905 8.905 0 00-4.648 1.294V0H86.14v27.419h4.332V16.087a4.656 4.656 0 014.649-4.65 4.656 4.656 0 014.649 4.65v11.332h4.332V16.087c.026-4.966-4.015-9.008-8.981-9.008zM57.188 19.02a4.656 4.656 0 01-4.649 4.649 4.656 4.656 0 01-4.649-4.65V7.689h-4.332V19.02c0 4.966 4.041 8.98 8.981 8.98 4.94 0 8.981-4.04 8.981-8.98V7.688h-4.332V19.02zM30.483 7.133c-5.732 0-10.408 4.675-10.408 10.407s4.676 10.408 10.408 10.408c5.732 0 10.408-4.676 10.408-10.408 0-5.732-4.676-10.407-10.408-10.407zm0 16.483a6.076 6.076 0 116.075-6.076c0 3.355-2.747 6.076-6.075 6.076zM74.517 23.616a6.076 6.076 0 010-12.151 6.132 6.132 0 015.045 2.668l3.592-2.43a10.473 10.473 0 00-8.637-4.57c-5.732 0-10.408 4.675-10.408 10.407s4.676 10.408 10.408 10.408a10.35 10.35 0 008.611-4.596l-3.593-2.43a5.975 5.975 0 01-5.018 2.694z"
508
512
  />
509
- </svg>`};var xm=Object.defineProperty,Tm=Object.getOwnPropertyDescriptor,bu=(s,e,t,i)=>{for(var r=i>1?void 0:i?Tm(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&xm(e,t,r),r};let bn=class extends Fe{render(){return!this.icon||!Object.keys(Du).includes(this.icon)?null:Du[this.icon]()}};bn.styles=[Fe.styles??[],it`
513
+ </svg>`};var lv=Object.defineProperty,cv=Object.getOwnPropertyDescriptor,Gh=(s,e,t,i)=>{for(var r=i>1?void 0:i?cv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&lv(e,t,r),r};let $n=class extends Oe{render(){return!this.icon||!Object.keys(Uh).includes(this.icon)?null:Uh[this.icon]()}};$n.styles=[Oe.styles??[],at`
510
514
  :host {
511
515
  display: flex;
512
516
  align-items: center;
513
517
  justify-content: center;
514
518
  flex-shrink: 0;
515
519
  }
516
- `],bu([V({type:String})],bn.prototype,"icon",2),bn=bu([Bt("vmp-icon")],bn);var Lm=Object.defineProperty,km=Object.getOwnPropertyDescriptor,Ls=(s,e,t,i)=>{for(var r=i>1?void 0:i?km(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Lm(e,t,r),r};let Oi=class extends Fe{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return fe`
520
+ `],Gh([J({type:String})],$n.prototype,"icon",2),$n=Gh([St("vmp-icon")],$n);var uv=Object.defineProperty,hv=Object.getOwnPropertyDescriptor,_s=(s,e,t,i)=>{for(var r=i>1?void 0:i?hv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&uv(e,t,r),r};let Ui=class extends Oe{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return fe`
517
521
  <vmp-button
518
522
  ?active=${this.active}
519
- size=${st(this.size)}
520
- rounded=${st(this.rounded)}
521
- weight=${st(this.weight)}
523
+ size=${et(this.size)}
524
+ rounded=${et(this.rounded)}
525
+ weight=${et(this.weight)}
522
526
  >
523
527
  <vmp-icon
524
- class=${Ue({tiny:this.size==="tiny",small:this.size==="small",large:this.size==="large"})}
525
- icon=${st(this.icon)}
528
+ class=${$e({tiny:this.size==="tiny",small:this.size==="small",large:this.size==="large"})}
529
+ icon=${et(this.icon)}
526
530
  ></vmp-icon>
527
531
  </vmp-button>
528
- `}};Oi.styles=[Fe.styles??[],it`
532
+ `}};Ui.styles=[Oe.styles??[],at`
529
533
  .tiny::part(svg) {
530
534
  height: 12px;
531
535
  width: 12px;
@@ -540,16 +544,16 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
540
544
  height: 32px;
541
545
  width: 32px;
542
546
  }
543
- `],Ls([V({type:Boolean})],Oi.prototype,"active",2),Ls([V({type:String})],Oi.prototype,"size",2),Ls([V({type:String})],Oi.prototype,"rounded",2),Ls([V({type:String})],Oi.prototype,"weight",2),Ls([V({type:String})],Oi.prototype,"icon",2),Oi=Ls([Bt("vmp-icon-button")],Oi);var Mm=Object.defineProperty,_m=Object.getOwnPropertyDescriptor,ht=(s,e,t,i)=>{for(var r=i>1?void 0:i?_m(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Mm(e,t,r),r};let Vt=class extends Fe{constructor(){super(...arguments),this.language="en",this.disabled=!1,this.aspectRatio=1,this.compilation=uo,this.dataResolver=Co,this._currentTime=0,this._sceneController=new Dm(this),this._canvasRef=gt(),this._previewRef=gt(),this._previewTimeRef=gt(),this._handleScrubberMouseEnter=({detail:{x:s,y:e,elementLeft:t,elementRight:i}})=>{var r,n;if((r=this._previewRef)!=null&&r.value){const o=this._previewRef.value.getBoundingClientRect(),a=(n=this._previewRef.value.getRootNode().host)==null?void 0:n.getBoundingClientRect();o&&a&&(this._previewRef.value.style.opacity="1",this._previewRef.value.style.transform=`translate3d(${Su(t-a.left,s-a.left-o.width/2,i-a.left-o.width)}px, ${e-a.top-o.height-28}px, 0)`)}},this._handleScrubberMouseMove=({detail:{time:s,x:e,elementLeft:t,elementRight:i}})=>{var r,n,o,a,A,l,c,h;if(this._currentTime=s,(r=this._sceneController.scenes)!=null&&r.scenes.length){const u=(A=(a=(o=(n=this._sceneController.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({start:d,duration:g,video:f})=>f&&s>=d&&s<=d+g))==null?void 0:a.video)==null?void 0:A.node;if(u&&(u.currentTime=s),this._draw(),(l=this._previewRef)!=null&&l.value){const d=this._previewRef.value.getBoundingClientRect(),g=(c=this._previewRef.value.getRootNode().host)==null?void 0:c.getBoundingClientRect();if(d&&g){const f=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[,E]=Array.from(f.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${Su(t-g.left,e-g.left-d.width/2,i-g.left-d.width)}px, ${E[1]}px, 0)`}}this._previewTimeRef.value&&this._previewTimeRef.value.setAttribute("content",Ua(Math.max(0,Math.min(this._currentTime,(h=this._sceneController.scenes)==null?void 0:h.duration))))}},this._handleScrubberMouseLeave=()=>{var s;(s=this._previewRef)!=null&&s.value&&(this._previewRef.value.style.opacity="0")},this._handleScrubberResize=({detail:{y:s}})=>{var e,t;if((e=this._previewRef)!=null&&e.value){const i=this._previewRef.value.getBoundingClientRect(),r=(t=this._previewRef.value.getRootNode().host)==null?void 0:t.getBoundingClientRect();if(i&&r){const n=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[o]=Array.from(n.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${o[1]}px, ${s-r.top-i.height-28}px, 0)`}}}}_draw(s=this._currentTime){var e,t;this._sceneController.scenes&&this._canvasRef.value&&((t=this.compilation)==null||t.call(this,{currentTime:Math.max(0,Math.min(s,(e=this._sceneController.scenes)==null?void 0:e.duration)),scenes:this._sceneController.scenes,canvas:this._canvasRef.value}))}connectedCallback(){super.connectedCallback(),document.addEventListener("scrubber:resize",this._handleScrubberResize),document.addEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),document.addEventListener("scrubber:mousemove",this._handleScrubberMouseMove),document.addEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("scrubber:resize",this._handleScrubberResize),document.removeEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),document.removeEventListener("scrubber:mousemove",this._handleScrubberMouseMove),document.removeEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}render(){var i;const{height:s,width:e}=go({resolution:180,aspectRatio:this.aspectRatio}),t=((i=this._sceneController.scenes)==null?void 0:i.scenes.length)??0;return!this.disabled&&(this.src||t>1)?fe`
547
+ `],_s([J({type:Boolean})],Ui.prototype,"active",2),_s([J({type:String})],Ui.prototype,"size",2),_s([J({type:String})],Ui.prototype,"rounded",2),_s([J({type:String})],Ui.prototype,"weight",2),_s([J({type:String})],Ui.prototype,"icon",2),Ui=_s([St("vmp-icon-button")],Ui);var dv=Object.defineProperty,gv=Object.getOwnPropertyDescriptor,ht=(s,e,t,i)=>{for(var r=i>1?void 0:i?gv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&dv(e,t,r),r};let qt=class extends Oe{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.compilation=bo,this.dataResolver=No,this._currentTime=0,this._sceneController=new ov(this),this._canvasRef=gt(),this._previewRef=gt(),this._previewTimeRef=gt(),this._handleScrubberMouseEnter=({detail:{x:s,y:e,elementLeft:t,elementRight:i}})=>{var r,n;if((r=this._previewRef)!=null&&r.value){const o=this._previewRef.value.getBoundingClientRect(),a=(n=this._previewRef.value.getRootNode().host)==null?void 0:n.getBoundingClientRect();o&&a&&(this._previewRef.value.style.opacity="1",this._previewRef.value.style.transform=`translate3d(${Oh(t-a.left,s-a.left-o.width/2,i-a.left-o.width)}px, ${e-a.top-o.height-28}px, 0)`)}},this._handleScrubberMouseMove=({detail:{time:s,x:e,elementLeft:t,elementRight:i}})=>{var r,n,o,a,A,l,c,u,h;if(this._currentTime=s,(r=this._sceneController.scenes)!=null&&r.scenes.length){const d=(o=(n=this._sceneController.scenes)==null?void 0:n.scenes)==null?void 0:o.find(({start:g,duration:f,video:p})=>p&&s>=g&&s<=g+f);if(d&&((a=d.video)!=null&&a.node)&&((l=(A=d.video.node).startLoadOnce)==null||l.call(A),d.video.node.currentTime=s-d.start),this._draw(),(c=this._previewRef)!=null&&c.value){const g=this._previewRef.value.getBoundingClientRect(),f=(u=this._previewRef.value.getRootNode().host)==null?void 0:u.getBoundingClientRect();if(g&&f){const p=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[,v]=Array.from(p.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${Oh(t-f.left,e-f.left-g.width/2,i-f.left-g.width)}px, ${v[1]}px, 0)`}}this._previewTimeRef.value&&this._previewTimeRef.value.setAttribute("content",iA(Math.max(0,Math.min(this._currentTime,(h=this._sceneController.scenes)==null?void 0:h.duration))))}},this._handleScrubberMouseLeave=()=>{var s;(s=this._previewRef)!=null&&s.value&&(this._previewRef.value.style.opacity="0")},this._handleScrubberResize=({detail:{y:s}})=>{var e,t;if((e=this._previewRef)!=null&&e.value){const i=this._previewRef.value.getBoundingClientRect(),r=(t=this._previewRef.value.getRootNode().host)==null?void 0:t.getBoundingClientRect();if(i&&r){const n=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[o]=Array.from(n.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${o[1]}px, ${s-r.top-i.height-28}px, 0)`}}}}_draw(s=this._currentTime){var e,t;this._sceneController.scenes&&this._canvasRef.value&&((t=this.compilation)==null||t.call(this,{currentTime:Math.max(0,Math.min(s,(e=this._sceneController.scenes)==null?void 0:e.duration)),scenes:this._sceneController.scenes,canvas:this._canvasRef.value}))}connectedCallback(){super.connectedCallback();const s=Ir("vmp-media-player",this);s==null||s.addEventListener("scrubber:resize",this._handleScrubberResize),s==null||s.addEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),s==null||s.addEventListener("scrubber:mousemove",this._handleScrubberMouseMove),s==null||s.addEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}disconnectedCallback(){super.disconnectedCallback();const s=Ir("vmp-media-player",this);s==null||s.removeEventListener("scrubber:resize",this._handleScrubberResize),s==null||s.removeEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),s==null||s.removeEventListener("scrubber:mousemove",this._handleScrubberMouseMove),s==null||s.removeEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}render(){var s;const{height:e,width:t}=So({resolution:180,aspectRatio:this.aspectRatio}),i=((s=this._sceneController.scenes)==null?void 0:s.scenes.length)??0;return!this.disabled&&(this.src||i>1)?fe`
544
548
  <div
545
549
  ${ft(this._previewRef)}
546
550
  class="preview"
547
- style=${zs({width:this.aspectRatio>1?"140px":void 0,height:this.aspectRatio<=1?"140px":void 0,aspectRatio:this.aspectRatio})}
551
+ style=${rr({width:this.aspectRatio>1?"140px":void 0,height:this.aspectRatio<=1?"140px":void 0,aspectRatio:this.aspectRatio})}
548
552
  >
549
- <canvas ${ft(this._canvasRef)} class="preview-canvas" width=${e} height=${s}></canvas>
553
+ <canvas ${ft(this._canvasRef)} class="preview-canvas" width=${t} height=${e}></canvas>
550
554
  <vmp-text ${ft(this._previewTimeRef)} class="preview-text" size="small"></vmp-text>
551
555
  </div>
552
- `:null}};Vt.styles=[Fe.styles??[],it`
556
+ `:null}};qt.styles=[Oe.styles??[],at`
553
557
  .preview {
554
558
  position: absolute;
555
559
  display: flex;
@@ -580,25 +584,26 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
580
584
  color: var(--colors-light-1000);
581
585
  font-variant-numeric: tabular-nums;
582
586
  }
583
- `],ht([V({type:String})],Vt.prototype,"src",2),ht([V({type:Object})],Vt.prototype,"data",2),ht([V({type:Object})],Vt.prototype,"template",2),ht([V({type:String})],Vt.prototype,"language",2),ht([V({type:Boolean})],Vt.prototype,"disabled",2),ht([V({type:Number})],Vt.prototype,"aspectRatio",2),ht([V({attribute:!1})],Vt.prototype,"compilation",2),ht([V({attribute:!1})],Vt.prototype,"dataResolver",2),Vt=ht([Bt("vmp-video-preview-content")],Vt);let ci=class extends Fe{constructor(){super(...arguments),this.language="en",this.disabled=!1,this.aspectRatio=1,this.compilation=uo,this.dataResolver=Co}render(){return fe`
587
+ `],ht([J({type:String})],qt.prototype,"src",2),ht([J({type:Object})],qt.prototype,"data",2),ht([J({type:Object})],qt.prototype,"template",2),ht([J({type:String})],qt.prototype,"language",2),ht([J({type:Boolean})],qt.prototype,"disabled",2),ht([J({type:Number})],qt.prototype,"aspectRatio",2),ht([J({attribute:!1})],qt.prototype,"compilation",2),ht([J({attribute:!1})],qt.prototype,"dataResolver",2),qt=ht([St("vmp-video-preview-content")],qt);let hi=class extends Oe{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.compilation=bo,this.dataResolver=No}render(){return fe`
584
588
  <vmp-video-preview-content
585
589
  ?disabled=${this.disabled}
586
590
  .src=${this.src}
587
591
  .data=${this.data}
588
592
  .template=${this.template}
593
+ .language=${this.language}
589
594
  .aspectRatio=${this.aspectRatio}
590
595
  .compilation=${this.compilation}
591
596
  .dataResolver=${this.dataResolver}
592
597
  ></vmp-video-preview-content>
593
- `}};ht([V({type:String})],ci.prototype,"src",2),ht([V({type:Object})],ci.prototype,"data",2),ht([V({type:Object})],ci.prototype,"template",2),ht([V({type:String})],ci.prototype,"language",2),ht([V({type:Boolean})],ci.prototype,"disabled",2),ht([V({type:Number})],ci.prototype,"aspectRatio",2),ht([V({attribute:!1})],ci.prototype,"compilation",2),ht([V({attribute:!1})],ci.prototype,"dataResolver",2),ci=ht([Bt("vmp-video-preview")],ci);class Fm extends Vs{constructor(e){if(super(e),e.type!==ns.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),Gt}}const Ru=os(Fm);class Om{constructor(e){this.hiddenControls=[],this._measureRef=gt(),this._prevControlsWidth=0,this._hideables={},this._showables={},this._onResize=t=>{var n,o,a;const i=this._measureRef.value,r=(a=(o=(n=t==null?void 0:t[0])==null?void 0:n.borderBoxSize)==null?void 0:o[0])==null?void 0:a.inlineSize;if(i&&r&&r!==this._prevControlsWidth){Object.keys(this._hideables).forEach(l=>{this._hideables[l].element.style.display=""}),Object.keys(this._showables).forEach(l=>{this._showables[l].element.style.display="none"});const A=[];for(;i.scrollWidth>i.offsetWidth;){const l=Object.keys(this._hideables).find(h=>this._hideables[h].hideIndex===A.length);if(!l)break;const c=this._hideables[l].element;c&&(c.style.display="none"),A.push(l),Object.keys(this._showables).forEach(h=>{this._showables[h].showOn.some(u=>A.includes(u))&&(this._showables[h].element.style.display="flex")})}this.hiddenControls=A,this._prevControlsWidth=r,this.host.requestUpdate()}},this.host=e}measure(){return ft(this._measureRef)}contain(){return Na(this._onResize)}hide(e,t){return Ru(i=>{this._hideables[e]={element:i,hideIndex:t}})}show(e,t){return Ru(i=>{this._showables[e]={element:i,showOn:t}})}}const Pa=".tippy-box[data-animation=shift-away-subtle][data-state=hidden]{opacity:0}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=top]{transform:translateY(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=bottom]{transform:translateY(-5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=left]{transform:translateX(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=right]{transform:translateX(-5px)}";var Nm=Object.defineProperty,Um=Object.getOwnPropertyDescriptor,gr=(s,e,t,i)=>{for(var r=i>1?void 0:i?Um(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Nm(e,t,r),r};let es=class extends Fe{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return fe`
598
+ `}};ht([J({type:String})],hi.prototype,"src",2),ht([J({type:Object})],hi.prototype,"data",2),ht([J({type:Object})],hi.prototype,"template",2),ht([J({type:String})],hi.prototype,"language",2),ht([J({type:Boolean})],hi.prototype,"disabled",2),ht([J({type:Number})],hi.prototype,"aspectRatio",2),ht([J({attribute:!1})],hi.prototype,"compilation",2),ht([J({attribute:!1})],hi.prototype,"dataResolver",2),hi=ht([St("vmp-video-preview")],hi);class fv extends Ws{constructor(e){if(super(e),e.type!==cs.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),Ht}}const Hh=us(fv);class pv{constructor(e){this.hiddenControls=[],this._measureRef=gt(),this._prevControlsWidth=0,this._hideables={},this._showables={},this._onResize=t=>{var i,r,n;const o=this._measureRef.value,a=(n=(r=(i=t==null?void 0:t[0])==null?void 0:i.borderBoxSize)==null?void 0:r[0])==null?void 0:n.inlineSize;if(o&&a&&a!==this._prevControlsWidth){Object.keys(this._hideables).forEach(l=>{this._hideables[l].element.style.display=""}),Object.keys(this._showables).forEach(l=>{this._showables[l].element.style.display="none"});const A=[];for(;o.scrollWidth>o.offsetWidth;){const l=Object.keys(this._hideables).find(u=>this._hideables[u].hideIndex===A.length);if(!l)break;const c=this._hideables[l].element;c&&(c.style.display="none"),A.push(l),Object.keys(this._showables).forEach(u=>{this._showables[u].showOn.some(h=>A.includes(h))&&(this._showables[u].element.style.display="flex")})}this.hiddenControls=A,this._prevControlsWidth=a,this.host.requestUpdate()}},this.host=e}measure(){return ft(this._measureRef)}contain(){return tA(this._onResize)}hide(e,t){return Hh(i=>{this._hideables[e]={element:i,hideIndex:t}})}show(e,t){return Hh(i=>{this._showables[e]={element:i,showOn:t}})}}const sA=".tippy-box[data-animation=shift-away-subtle][data-state=hidden]{opacity:0}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=top]{transform:translateY(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=bottom]{transform:translateY(-5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=left]{transform:translateX(5px)}.tippy-box[data-animation=shift-away-subtle][data-state=hidden][data-placement^=right]{transform:translateX(-5px)}";var Ev=Object.defineProperty,Iv=Object.getOwnPropertyDescriptor,mr=(s,e,t,i)=>{for(var r=i>1?void 0:i?Iv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Ev(e,t,r),r};let ns=class extends Oe{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return fe`
594
599
  <div
595
600
  part="content"
596
- class=${Ue({semibold:this.semibold,truncate:this.truncate,[this.size]:!0})}
597
- style=${zs({fontFamily:Nr({text:this.content,font:"var(--fontFamilies-sans)"})})}
601
+ class=${$e({semibold:this.semibold,truncate:this.truncate,[this.size]:!0})}
602
+ style=${rr({fontFamily:hs({text:this.content,font:"var(--fontFamilies-sans)"})})}
598
603
  >
599
604
  ${this.content}
600
605
  </div>
601
- `}};es.styles=[Fe.styles??[],it`
606
+ `}};ns.styles=[Oe.styles??[],at`
602
607
  :host {
603
608
  --text-size: var(--fontSizes-medium);
604
609
  --text-line-height: var(--lineHeights-medium);
@@ -635,7 +640,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
635
640
  text-overflow: ellipsis;
636
641
  overflow: hidden;
637
642
  }
638
- `],gr([V({type:Boolean})],es.prototype,"semibold",2),gr([V({type:Boolean})],es.prototype,"truncate",2),gr([V({type:String})],es.prototype,"size",2),gr([V({type:String})],es.prototype,"content",2),es=gr([Bt("vmp-text")],es);var Pm=Object.defineProperty,Gm=Object.getOwnPropertyDescriptor,fr=(s,e,t,i)=>{for(var r=i>1?void 0:i?Gm(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Pm(e,t,r),r};let ts=class extends Fe{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=gt()}_handleBackClick(){this.subItemsActive=null,this.visibleItems=this.items??null}willUpdate(){this.visibleItems=this.visibleItems??this.items??null}updated(){var e,t;const s=(t=(e=this.items)==null?void 0:e.items.find(({id:i})=>this.subItemsActive===i))==null?void 0:t.subItems;this.visibleItems=s??this.items??null,s||(this.subItemsActive=null)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var t;const s=(t=this.shadowRoot)==null?void 0:t.querySelector("slot"),e=s==null?void 0:s.assignedElements()[0];e&&this._contentRef.value&&(this.tippy=zi(e,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",trigger:"click",onShow:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){var s,e;return fe`
643
+ `],mr([J({type:Boolean})],ns.prototype,"semibold",2),mr([J({type:Boolean})],ns.prototype,"truncate",2),mr([J({type:String})],ns.prototype,"size",2),mr([J({type:String})],ns.prototype,"content",2),ns=mr([St("vmp-text")],ns);var mv=Object.defineProperty,Cv=Object.getOwnPropertyDescriptor,Cr=(s,e,t,i)=>{for(var r=i>1?void 0:i?Cv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&mv(e,t,r),r};let os=class extends Oe{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=gt()}_handleBackClick(){this.subItemsActive=null,this.visibleItems=this.items??null}willUpdate(){this.visibleItems=this.visibleItems??this.items??null}updated(){var s,e;const t=(e=(s=this.items)==null?void 0:s.items.find(({id:i})=>this.subItemsActive===i))==null?void 0:e.subItems;this.visibleItems=t??this.items??null,t||(this.subItemsActive=null)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=rs(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",trigger:"click",onShow:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){var s,e;return fe`
639
644
  <slot></slot>
640
645
  <div ${ft(this._contentRef)} class="content">
641
646
  <div class="title">
@@ -651,7 +656,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
651
656
  .content=${((s=this.visibleItems)==null?void 0:s.title)??"Sub Menu"}
652
657
  ></vmp-text>
653
658
  </div>
654
- ${Ph(((e=this.visibleItems)==null?void 0:e.items)??[],({id:t})=>t,t=>fe`
659
+ ${Zu(((e=this.visibleItems)==null?void 0:e.items)??[],({id:t})=>t,t=>fe`
655
660
  <button
656
661
  class="item"
657
662
  @click=${()=>{t.subItems&&(this.subItemsActive=t.id,this.visibleItems=t.subItems),t.event&&this.dispatchEvent(new CustomEvent(t.event,{detail:t,bubbles:!0,composed:!0}))}}
@@ -661,7 +666,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
661
666
  </button>
662
667
  `)}
663
668
  </div>
664
- `}};ts.styles=[Fe.styles??[],Os(Pa),it`
669
+ `}};os.styles=[Oe.styles??[],Os(sA),at`
665
670
  :host {
666
671
  display: flex;
667
672
  }
@@ -723,12 +728,12 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
723
728
  height: 20px;
724
729
  width: 20px;
725
730
  }
726
- `],fr([V({type:Object})],ts.prototype,"items",2),fr([V({type:Array})],ts.prototype,"activeItems",2),fr([Xe()],ts.prototype,"visibleItems",2),fr([Xe()],ts.prototype,"subItemsActive",2),ts=fr([Bt("vmp-menu")],ts);var Hm=Object.defineProperty,$m=Object.getOwnPropertyDescriptor,Ga=(s,e,t,i)=>{for(var r=i>1?void 0:i?$m(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Hm(e,t,r),r};let Er=class extends Fe{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=gt()}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var t;const s=(t=this.shadowRoot)==null?void 0:t.querySelector("slot"),e=s==null?void 0:s.assignedElements()[0];e&&this._contentRef.value&&(this.tippy=zi(e,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!1,placement:"top",zIndex:1e4,appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}updated(){var s,e;this.disabled?(s=this.tippy)==null||s.disable():(e=this.tippy)==null||e.enable()}render(){return fe`
731
+ `],Cr([J({type:Object})],os.prototype,"items",2),Cr([J({type:Array})],os.prototype,"activeItems",2),Cr([Ze()],os.prototype,"visibleItems",2),Cr([Ze()],os.prototype,"subItemsActive",2),os=Cr([St("vmp-menu")],os);var vv=Object.defineProperty,yv=Object.getOwnPropertyDescriptor,rA=(s,e,t,i)=>{for(var r=i>1?void 0:i?yv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&vv(e,t,r),r};let vr=class extends Oe{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=gt()}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=rs(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!1,placement:"top",zIndex:1e4,appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}updated(){var s,e;this.disabled?(s=this.tippy)==null||s.disable():(e=this.tippy)==null||e.enable()}render(){return fe`
727
732
  <slot></slot>
728
733
  <div ${ft(this._contentRef)} class="content">
729
734
  <vmp-text content=${this.content}></vmp-text>
730
735
  </div>
731
- `}};Er.styles=[Fe.styles??[],Os(Pa),it`
736
+ `}};vr.styles=[Oe.styles??[],Os(sA),at`
732
737
  :host {
733
738
  display: flex;
734
739
  }
@@ -742,7 +747,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
742
747
  background: var(--colors-dark-800);
743
748
  border-radius: var(--radii-medium);
744
749
  }
745
- `],Ga([V({type:String})],Er.prototype,"content",2),Ga([V({type:Boolean})],Er.prototype,"disabled",2),Er=Ga([Bt("vmp-tooltip")],Er);var Km=Object.defineProperty,Ym=Object.getOwnPropertyDescriptor,Ha=(s,e,t,i)=>{for(var r=i>1?void 0:i?Ym(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Km(e,t,r),r};let pr=class extends Fe{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=gt(),this._anchorRef=gt(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=zi(this._anchorRef.value,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",interactiveBorder:20,onShow:()=>{this._menuOpen=!0,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this._menuOpen=!1,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){return fe`
750
+ `],rA([J({type:String})],vr.prototype,"content",2),rA([J({type:Boolean})],vr.prototype,"disabled",2),vr=rA([St("vmp-tooltip")],vr);var Bv=Object.defineProperty,Qv=Object.getOwnPropertyDescriptor,nA=(s,e,t,i)=>{for(var r=i>1?void 0:i?Qv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Bv(e,t,r),r};let yr=class extends Oe{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=gt(),this._anchorRef=gt(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=rs(this._anchorRef.value,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!0,placement:"top",interactiveBorder:20,onShow:()=>{this._menuOpen=!0,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!0}))},onHide:()=>{this._menuOpen=!1,this.dispatchEvent(new CustomEvent("menu:toggle",{detail:!1}))},appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this.tippy)==null||s.destroy()}render(){return fe`
746
751
  <vmp-icon-button
747
752
  ${ft(this._anchorRef)}
748
753
  icon=${this.muted||this.volume===0?"muted":this.volume<1/3?"volume-low":this.volume<2/3?"volume-medium":"volume-high"}
@@ -762,7 +767,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
762
767
  @blur=${()=>{var s;return(s=this.tippy)==null?void 0:s.hide()}}
763
768
  />
764
769
  </div>
765
- `}};pr.styles=[Fe.styles??[],Os(Pa),it`
770
+ `}};yr.styles=[Oe.styles??[],Os(sA),at`
766
771
  .content {
767
772
  --volume-slider-height: 4px;
768
773
  --volume-slider-width: 78px;
@@ -904,11 +909,11 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
904
909
  --volume-slider-height: 8px;
905
910
  color: var(--colors-light-800);
906
911
  }
907
- `],Ha([V({type:Number})],pr.prototype,"volume",2),Ha([V({type:Boolean})],pr.prototype,"muted",2),pr=Ha([Bt("vmp-volume-button")],pr);var Vm=Object.defineProperty,Jm=Object.getOwnPropertyDescriptor,Rn=(s,e,t,i)=>{for(var r=i>1?void 0:i?Jm(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Vm(e,t,r),r};let ks=class extends Fe{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=gt(),this._handleContainerResize=()=>{var e;const s=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:resize",{detail:s,bubbles:!0,composed:!0}))},this._handleMouseEnter=s=>{var t;const e=(t=this._containerRef.value)==null?void 0:t.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:mouseenter",{detail:{x:s.clientX,y:s.clientY,elementLeft:(e==null?void 0:e.left)??0,elementRight:(e==null?void 0:e.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseMove=s=>{var r;const e=(r=this._containerRef.value)==null?void 0:r.getBoundingClientRect(),i=(s.clientX-((e==null?void 0:e.left)??0))/((e==null?void 0:e.width)??1);this.dispatchEvent(new CustomEvent("scrubber:mousemove",{detail:{x:s.clientX,y:s.clientY,time:i*this.duration,elementLeft:(e==null?void 0:e.left)??0,elementRight:(e==null?void 0:e.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseLeave=s=>{this.dispatchEvent(new CustomEvent("scrubber:mouseleave",{detail:{x:s.clientX,y:s.clientY},bubbles:!0,composed:!0}))}}render(){var e;const s=((e=this.buffer)==null?void 0:e.sort((t,i)=>t.start<i.start?-1:i.start<t.start?1:0).reduce((t,{start:i,end:r},n)=>{const o=t[n-1],a=Math.floor(i),A=Math.ceil(r);return t.push({id:i,start:Math.max(0,a),end:Math.min(A,100)}),o&&o.end>=i-1&&(t[n].start=o.end),t},[]))??[];return fe`
912
+ `],nA([J({type:Number})],yr.prototype,"volume",2),nA([J({type:Boolean})],yr.prototype,"muted",2),yr=nA([St("vmp-volume-button")],yr);var bv=Object.defineProperty,Sv=Object.getOwnPropertyDescriptor,Yn=(s,e,t,i)=>{for(var r=i>1?void 0:i?Sv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&bv(e,t,r),r};let ks=class extends Oe{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=gt(),this._handleContainerResize=()=>{var s;const e=(s=this._containerRef.value)==null?void 0:s.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:resize",{detail:e,bubbles:!0,composed:!0}))},this._handleMouseEnter=s=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:mouseenter",{detail:{x:s.clientX,y:s.clientY,elementLeft:(t==null?void 0:t.left)??0,elementRight:(t==null?void 0:t.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseMove=s=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect(),r=(s.clientX-((t==null?void 0:t.left)??0))/((t==null?void 0:t.width)??1);this.dispatchEvent(new CustomEvent("scrubber:mousemove",{detail:{x:s.clientX,y:s.clientY,time:r*this.duration,elementLeft:(t==null?void 0:t.left)??0,elementRight:(t==null?void 0:t.right)??document.body.offsetWidth},bubbles:!0,composed:!0}))},this._handleMouseLeave=s=>{this.dispatchEvent(new CustomEvent("scrubber:mouseleave",{detail:{x:s.clientX,y:s.clientY},bubbles:!0,composed:!0}))}}render(){var s;const e=((s=this.buffer)==null?void 0:s.sort((t,i)=>t.start<i.start?-1:i.start<t.start?1:0).reduce((t,{start:i,end:r},n)=>{const o=t[n-1],a=Math.floor(i),A=Math.ceil(r);return t.push({id:i,start:Math.max(0,a),end:Math.min(A,100)}),o&&o.end>=i-1&&(t[n].start=o.end),t},[]))??[];return fe`
908
913
  <div
909
914
  class="container"
910
915
  ${ft(this._containerRef)}
911
- ${Na(this._handleContainerResize)}
916
+ ${tA(this._handleContainerResize)}
912
917
  @mouseenter=${this._handleMouseEnter}
913
918
  @mousemove=${this._handleMouseMove}
914
919
  @mouseleave=${this._handleMouseLeave}
@@ -923,11 +928,11 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
923
928
  .value=${this.currentTime.toString()}
924
929
  data-testid="scrubber"
925
930
  />
926
- ${Ph(s,({id:t})=>t,t=>fe`
931
+ ${Zu(e,({id:t})=>t,t=>fe`
927
932
  <div class="buffer" style=${`left: ${t.start}%; width: ${t.end-t.start}%`}></div>
928
933
  `)}
929
934
  </div>
930
- `}};ks.styles=[Fe.styles??[],it`
935
+ `}};ks.styles=[Oe.styles??[],at`
931
936
  :host {
932
937
  --player-scrubber-height: 8px;
933
938
  --player-scrubber-shadow-width: 4000px;
@@ -1077,17 +1082,17 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1077
1082
  --player-scrubber-height: 16px;
1078
1083
  color: var(--colors-light-800);
1079
1084
  }
1080
- `],Rn([V({type:Number})],ks.prototype,"duration",2),Rn([V({type:Number})],ks.prototype,"currentTime",2),Rn([V({type:Array})],ks.prototype,"buffer",2),ks=Rn([Bt("vmp-progress-scrubber")],ks);var Wm=Object.defineProperty,qm=Object.getOwnPropertyDescriptor,ze=(s,e,t,i)=>{for(var r=i>1?void 0:i?qm(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Wm(e,t,r),r};let Je=class extends Fe{constructor(){super(...arguments),this.resizeHider=new Om(this),this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.languages=[],this.language="en",this.levels=[],this.level=-1,this.playbackRate=1,this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=Oa,this.volumeMenuOpen=!1,this.languageMenuOpen=!1,this.levelsMenuOpen=!1,this.playbackRateMenuOpen=!1,this.settingsMenuOpen=!1}_handleNavigateBackClick(){this.dispatchEvent(new CustomEvent("navigate:back",{bubbles:!0,composed:!0}))}_handleNavigateForwardClick(){this.dispatchEvent(new CustomEvent("navigate:forward",{bubbles:!0,composed:!0}))}_handlePlayClick(){this.dispatchEvent(new CustomEvent("play:click",{bubbles:!0,composed:!0,detail:this.playing}))}_handleCaptionsClick(){this.dispatchEvent(new CustomEvent("captions:click",{bubbles:!0,composed:!0,detail:this.captions}))}_handleFullscreenClick(){this.dispatchEvent(new CustomEvent("fullscreen:click",{bubbles:!0,composed:!0,detail:this.fullscreen}))}_handleVolumeMenuToggle({detail:s}){this.volumeMenuOpen=s}_handleLanguageMenuOpen({detail:s}){this.languageMenuOpen=s}_handleLevelsMenuOpen({detail:s}){this.levelsMenuOpen=s}_handlePlaybackMenuToggle({detail:s}){this.playbackRateMenuOpen=s}_handleSettingsMenuToggle({detail:s}){this.settingsMenuOpen=s}hideMenus(){var s,e;(e=Array.from((s=this.shadowRoot)==null?void 0:s.querySelectorAll("vmp-menu, vmp-tooltip, vmp-volume-button")))==null||e.forEach(t=>{var i;(i=t.tippy)==null||i.hide()})}render(){var v,F,G,M,H,j,U,J,w,D,X,R,b,T,K;const s=((v=this.languages)==null?void 0:v.map(P=>({id:`language-${P.value}`,event:"language:click",label:P.label,value:P.value})))??[],e={title:"Languages",items:s},t={id:"languages",label:"Languages",subItems:e},i=e.items.find(({value:P})=>P===this.language),r=((F=this.levels)==null?void 0:F.map((P,q)=>{const ie=Math.min(P.width,P.height);return{id:`level-${q.toString()}`,event:"level:click",label:`${ie}p`,value:{resolution:ie,level:q}}}))??[],n={title:"Quality",items:[...r.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},o={id:"levels",label:"Quality",subItems:n},a=(G=n.items)==null?void 0:G.find(({value:P})=>P.level===this.level),A=[(s==null?void 0:s.length)&&"languages","levels","playback-rate","captions","fullscreen"].filter(Boolean).filter(P=>{var q;return(q=this.controls)==null?void 0:q.includes(P)}),l={title:"Settings",items:[(s==null?void 0:s.length)&&t,Im,Cm,o,mm].filter(Boolean).filter(({id:P})=>A.includes(P)&&this.resizeHider.hiddenControls.includes(P))},c=(M=this.controls)==null?void 0:M.includes("progress"),h=(H=this.controls)==null?void 0:H.includes("navigation"),u=(j=this.controls)==null?void 0:j.includes("play"),d=(U=this.controls)==null?void 0:U.includes("volume"),g=(J=this.controls)==null?void 0:J.includes("current-time"),f=(w=this.controls)==null?void 0:w.includes("duration"),E=(D=this.controls)==null?void 0:D.includes("languages"),B=(X=this.controls)==null?void 0:X.includes("levels"),S=(R=this.controls)==null?void 0:R.includes("speed"),Q=(b=this.controls)==null?void 0:b.includes("captions"),m=(T=this.controls)==null?void 0:T.includes("fullscreen"),y=u||d||g||f||E||B||S||Q||m,L=[this.captions&&"captions",this.fullscreen&&"fullscreen",`language-${this.language}`,`level-${(K=this.level)==null?void 0:K.toString()}`,`playback-rate-${this.playbackRate.toString()}`].filter(Boolean);return fe`
1085
+ `],Yn([J({type:Number})],ks.prototype,"duration",2),Yn([J({type:Number})],ks.prototype,"currentTime",2),Yn([J({type:Array})],ks.prototype,"buffer",2),ks=Yn([St("vmp-progress-scrubber")],ks);var wv=Object.defineProperty,Rv=Object.getOwnPropertyDescriptor,it=(s,e,t,i)=>{for(var r=i>1?void 0:i?Rv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&wv(e,t,r),r};let je=class extends Oe{constructor(){super(...arguments),this.resizeHider=new pv(this),this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.languages=[],this.language="en",this.levels=[],this.level=-1,this.playbackRate=1,this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=eA,this.volumeMenuOpen=!1,this.languageMenuOpen=!1,this.levelsMenuOpen=!1,this.playbackRateMenuOpen=!1,this.settingsMenuOpen=!1}_handleNavigateBackClick(){this.dispatchEvent(new CustomEvent("navigate:back",{bubbles:!0,composed:!0}))}_handleNavigateForwardClick(){this.dispatchEvent(new CustomEvent("navigate:forward",{bubbles:!0,composed:!0}))}_handlePlayClick(){this.dispatchEvent(new CustomEvent("play:click",{bubbles:!0,composed:!0,detail:this.playing}))}_handleCaptionsClick(){this.dispatchEvent(new CustomEvent("captions:click",{bubbles:!0,composed:!0,detail:this.captions}))}_handleFullscreenClick(){this.dispatchEvent(new CustomEvent("fullscreen:click",{bubbles:!0,composed:!0,detail:this.fullscreen}))}_handleVolumeMenuToggle({detail:s}){this.volumeMenuOpen=s}_handleLanguageMenuOpen({detail:s}){this.languageMenuOpen=s}_handleLevelsMenuOpen({detail:s}){this.levelsMenuOpen=s}_handlePlaybackMenuToggle({detail:s}){this.playbackRateMenuOpen=s}_handleSettingsMenuToggle({detail:s}){this.settingsMenuOpen=s}hideMenus(){var s,e;(e=Array.from((s=this.shadowRoot)==null?void 0:s.querySelectorAll("vmp-menu, vmp-tooltip, vmp-volume-button")))==null||e.forEach(t=>{var i;(i=t.tippy)==null||i.hide()})}render(){var s,e,t,i,r,n,o,a,A,l,c,u,h,d,g;const f=((s=this.languages)==null?void 0:s.map(G=>({id:`language-${G.value}`,event:"language:click",label:G.label,value:G.value})))??[],p={title:"Languages",items:f},v={id:"languages",label:"Languages",subItems:p},y=p.items.find(({value:G})=>G===this.language),Q=((e=this.levels)==null?void 0:e.map((G,j)=>{const te=Math.min(G.width,G.height);return{id:`level-${j.toString()}`,event:"level:click",label:`${te}p`,value:{resolution:te,level:j}}}))??[],m={title:"Quality",items:[...Q.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},b={id:"levels",label:"Quality",subItems:m},x=(t=m.items)==null?void 0:t.find(({value:G})=>G.level===this.level),B=[(f==null?void 0:f.length)&&"languages","levels","playback-rate","captions","fullscreen"].filter(Boolean).filter(G=>{var j;return(j=this.controls)==null?void 0:j.includes(G)}),H={title:"Settings",items:[(f==null?void 0:f.length)&&v,XC,zC,b,ZC].filter(Boolean).filter(({id:G})=>B.includes(G)&&this.resizeHider.hiddenControls.includes(G))},_=(i=this.controls)==null?void 0:i.includes("progress"),k=(r=this.controls)==null?void 0:r.includes("navigation"),U=(n=this.controls)==null?void 0:n.includes("play"),q=(o=this.controls)==null?void 0:o.includes("volume"),V=(a=this.controls)==null?void 0:a.includes("current-time"),Z=(A=this.controls)==null?void 0:A.includes("duration"),S=(l=this.controls)==null?void 0:l.includes("languages"),T=(c=this.controls)==null?void 0:c.includes("levels"),O=(u=this.controls)==null?void 0:u.includes("speed"),R=(h=this.controls)==null?void 0:h.includes("captions"),w=(d=this.controls)==null?void 0:d.includes("fullscreen"),L=U||q||V||Z||S||T||O||R||w,K=[this.captions&&"captions",this.fullscreen&&"fullscreen",`language-${this.language}`,`level-${(g=this.level)==null?void 0:g.toString()}`,`playback-rate-${this.playbackRate.toString()}`].filter(Boolean);return fe`
1081
1086
  <div
1082
1087
  ${this.resizeHider.measure()}
1083
1088
  ${this.resizeHider.contain()}
1084
- class=${Ue({container:!0,hidden:!c&&!y})}
1089
+ class=${$e({container:!0,hidden:!_&&!L})}
1085
1090
  >
1086
1091
  <div
1087
- class=${Ue({"scrubber-container":!0,hidden:!c})}
1092
+ class=${$e({"scrubber-container":!0,hidden:!_})}
1088
1093
  >
1089
1094
  <vmp-progress-scrubber
1090
- class=${Ue({scrubber:!0,invisible:this.volumeMenuOpen||this.levelsMenuOpen||this.playbackRateMenuOpen||this.settingsMenuOpen})}
1095
+ class=${$e({scrubber:!0,invisible:this.volumeMenuOpen||this.levelsMenuOpen||this.playbackRateMenuOpen||this.settingsMenuOpen})}
1091
1096
  duration=${this.duration}
1092
1097
  currentTime=${this.currentTime}
1093
1098
  .buffer=${this.buffer}
@@ -1095,12 +1100,12 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1095
1100
  </div>
1096
1101
  <div
1097
1102
  ${this.resizeHider.contain()}
1098
- class=${Ue({buttons:!0,hidden:!y})}
1103
+ class=${$e({buttons:!0,hidden:!L})}
1099
1104
  >
1100
1105
  <div class="section">
1101
1106
  <div
1102
1107
  ${this.resizeHider.hide("navigation",7)}
1103
- class=${Ue({navigation:!0,hidden:!h})}
1108
+ class=${$e({navigation:!0,hidden:!k})}
1104
1109
  >
1105
1110
  <vmp-icon-button
1106
1111
  icon="arrow-left"
@@ -1116,7 +1121,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1116
1121
  ></vmp-icon-button>
1117
1122
  </div>
1118
1123
  <vmp-icon-button
1119
- class=${Ue({hidden:!u})}
1124
+ class=${$e({hidden:!U})}
1120
1125
  icon=${this.playing?"pause":"play"}
1121
1126
  weight="heavy"
1122
1127
  rounded="full"
@@ -1124,7 +1129,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1124
1129
  @click=${this._handlePlayClick}
1125
1130
  ></vmp-icon-button>
1126
1131
  <vmp-volume-button
1127
- class=${Ue({hidden:!d})}
1132
+ class=${$e({hidden:!q})}
1128
1133
  ?muted=${this.muted}
1129
1134
  volume=${this.volume}
1130
1135
  @menu:toggle=${this._handleVolumeMenuToggle}
@@ -1132,46 +1137,46 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1132
1137
  <div class="time">
1133
1138
  <vmp-text
1134
1139
  ${this.resizeHider.hide("current-time",2)}
1135
- class=${Ue({hidden:!g})}
1140
+ class=${$e({hidden:!V})}
1136
1141
  ?semibold=${!0}
1137
- content="${Ua(this.currentTime)}${f?"/":null}"
1142
+ content="${iA(this.currentTime)}${Z?"/":null}"
1138
1143
  ></vmp-text>
1139
1144
  <vmp-text
1140
1145
  ${this.resizeHider.hide("duration",6)}
1141
- class=${Ue({hidden:!f})}
1146
+ class=${$e({hidden:!Z})}
1142
1147
  ?semibold=${!0}
1143
- content=${Ua(this.duration)}
1148
+ content=${iA(this.duration)}
1144
1149
  ></vmp-text>
1145
1150
  </div>
1146
1151
  </div>
1147
1152
  <div class="section">
1148
1153
  <vmp-menu
1149
1154
  ${this.resizeHider.hide("languages",0)}
1150
- class=${Ue({hidden:!E||!s||s.length<=0})}
1151
- .items=${e}
1152
- .activeItems=${L}
1155
+ class=${$e({hidden:!S||!f||f.length<=1})}
1156
+ .items=${p}
1157
+ .activeItems=${K}
1153
1158
  @menu:toggle=${this._handleLanguageMenuOpen}
1154
1159
  >
1155
1160
  <vmp-tooltip content="Languages" ?disabled=${this.languageMenuOpen}>
1156
- <vmp-button ?active=${this.languageMenuOpen} icon="chevron-down">${i==null?void 0:i.label}</vmp-button>
1161
+ <vmp-button ?active=${this.languageMenuOpen} icon="chevron-down">${y==null?void 0:y.label}</vmp-button>
1157
1162
  </vmp-tooltip>
1158
1163
  </vmp-menu>
1159
1164
  <vmp-menu
1160
1165
  ${this.resizeHider.hide("levels",1)}
1161
- class=${Ue({hidden:!B||r.length<=0})}
1162
- .items=${n}
1163
- .activeItems=${L}
1166
+ class=${$e({hidden:!T||Q.length<=0})}
1167
+ .items=${m}
1168
+ .activeItems=${K}
1164
1169
  @menu:toggle=${this._handleLevelsMenuOpen}
1165
1170
  >
1166
1171
  <vmp-tooltip content="Quality" ?disabled=${this.levelsMenuOpen}>
1167
- <vmp-button ?active=${this.levelsMenuOpen} icon="chevron-down">${a==null?void 0:a.label}</vmp-button>
1172
+ <vmp-button ?active=${this.levelsMenuOpen} icon="chevron-down">${x==null?void 0:x.label}</vmp-button>
1168
1173
  </vmp-tooltip>
1169
1174
  </vmp-menu>
1170
1175
  <vmp-menu
1171
1176
  ${this.resizeHider.hide("playback-rate",5)}
1172
- class=${Ue({hidden:!S})}
1173
- .items=${vu}
1174
- .activeItems=${L}
1177
+ class=${$e({hidden:!O})}
1178
+ .items=${Mh}
1179
+ .activeItems=${K}
1175
1180
  @menu:toggle=${this._handlePlaybackMenuToggle}
1176
1181
  >
1177
1182
  <vmp-tooltip content="Playback speed" ?disabled=${this.playbackRateMenuOpen}>
@@ -1182,7 +1187,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1182
1187
  </vmp-menu>
1183
1188
  <vmp-tooltip
1184
1189
  ${this.resizeHider.hide("captions",4)}
1185
- class=${Ue({hidden:!Q})}
1190
+ class=${$e({hidden:!R})}
1186
1191
  content="Captions"
1187
1192
  >
1188
1193
  <vmp-icon-button
@@ -1195,7 +1200,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1195
1200
  <vmp-tooltip
1196
1201
  ${this.resizeHider.hide("fullscreen",3)}
1197
1202
  content="Fullscreen"
1198
- class=${Ue({hidden:!m})}
1203
+ class=${$e({hidden:!w})}
1199
1204
  >
1200
1205
  <vmp-icon-button
1201
1206
  ?active=${this.fullscreen}
@@ -1207,8 +1212,8 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1207
1212
  </vmp-tooltip>
1208
1213
  <vmp-menu
1209
1214
  ${this.resizeHider.show("settings",["levels","playback-rate","captions","fullscreen"])}
1210
- .items=${l}
1211
- .activeItems=${L}
1215
+ .items=${H}
1216
+ .activeItems=${K}
1212
1217
  @menu:toggle=${this._handleSettingsMenuToggle}
1213
1218
  >
1214
1219
  <vmp-tooltip content="Settings" ?disabled=${this.settingsMenuOpen}>
@@ -1218,7 +1223,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1218
1223
  </div>
1219
1224
  </div>
1220
1225
  </div>
1221
- `}};Je.styles=[Fe.styles??[],it`
1226
+ `}};je.styles=[Oe.styles??[],at`
1222
1227
  :host {
1223
1228
  --controls-border-radius: var(--player-border-radius, 0px);
1224
1229
 
@@ -1289,17 +1294,17 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1289
1294
  .hidden {
1290
1295
  display: none;
1291
1296
  }
1292
- `],ze([V({type:Boolean})],Je.prototype,"playing",2),ze([V({type:Number})],Je.prototype,"volume",2),ze([V({type:Boolean})],Je.prototype,"muted",2),ze([V({type:Number})],Je.prototype,"currentTime",2),ze([V({type:Number})],Je.prototype,"duration",2),ze([V({type:Array})],Je.prototype,"languages",2),ze([V({type:String})],Je.prototype,"language",2),ze([V({type:Array,attribute:!1})],Je.prototype,"levels",2),ze([V({type:Number})],Je.prototype,"level",2),ze([V({type:Number})],Je.prototype,"playbackRate",2),ze([V({type:Array})],Je.prototype,"buffer",2),ze([V({type:Boolean})],Je.prototype,"captions",2),ze([V({type:Boolean})],Je.prototype,"fullscreen",2),ze([V({type:Array})],Je.prototype,"controls",2),ze([Xe()],Je.prototype,"volumeMenuOpen",2),ze([Xe()],Je.prototype,"languageMenuOpen",2),ze([Xe()],Je.prototype,"levelsMenuOpen",2),ze([Xe()],Je.prototype,"playbackRateMenuOpen",2),ze([Xe()],Je.prototype,"settingsMenuOpen",2),Je=ze([Bt("vmp-player-controls")],Je);var jm=Object.defineProperty,Xm=Object.getOwnPropertyDescriptor,Zm=(s,e,t,i)=>{for(var r=i>1?void 0:i?Xm(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&jm(e,t,r),r};let $a=class extends Fe{render(){return fe`<vmp-icon icon="loading"></vmp-icon>`}};$a.styles=[Fe.styles??[],it`
1297
+ `],it([J({type:Boolean})],je.prototype,"playing",2),it([J({type:Number})],je.prototype,"volume",2),it([J({type:Boolean})],je.prototype,"muted",2),it([J({type:Number})],je.prototype,"currentTime",2),it([J({type:Number})],je.prototype,"duration",2),it([J({type:Array})],je.prototype,"languages",2),it([J({type:String})],je.prototype,"language",2),it([J({type:Array,attribute:!1})],je.prototype,"levels",2),it([J({type:Number})],je.prototype,"level",2),it([J({type:Number})],je.prototype,"playbackRate",2),it([J({type:Array})],je.prototype,"buffer",2),it([J({type:Boolean})],je.prototype,"captions",2),it([J({type:Boolean})],je.prototype,"fullscreen",2),it([J({type:Array})],je.prototype,"controls",2),it([Ze()],je.prototype,"volumeMenuOpen",2),it([Ze()],je.prototype,"languageMenuOpen",2),it([Ze()],je.prototype,"levelsMenuOpen",2),it([Ze()],je.prototype,"playbackRateMenuOpen",2),it([Ze()],je.prototype,"settingsMenuOpen",2),je=it([St("vmp-player-controls")],je);var xv=Object.defineProperty,Tv=Object.getOwnPropertyDescriptor,Dv=(s,e,t,i)=>{for(var r=i>1?void 0:i?Tv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&xv(e,t,r),r};let oA=class extends Oe{render(){return fe`<vmp-icon icon="loading"></vmp-icon>`}};oA.styles=[Oe.styles??[],at`
1293
1298
  :host {
1294
1299
  display: flex;
1295
1300
  align-items: center;
1296
1301
  justify-content: center;
1297
1302
  }
1298
- `],$a=Zm([Bt("vmp-loading-spinner")],$a);var zm=Object.defineProperty,eB=Object.getOwnPropertyDescriptor,xu=(s,e,t,i)=>{for(var r=i>1?void 0:i?eB(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&zm(e,t,r),r};let xn=class extends Fe{constructor(){super(...arguments),this.caption=""}render(){return fe`
1303
+ `],oA=Dv([St("vmp-loading-spinner")],oA);var Lv=Object.defineProperty,_v=Object.getOwnPropertyDescriptor,$h=(s,e,t,i)=>{for(var r=i>1?void 0:i?_v(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Lv(e,t,r),r};let Kn=class extends Oe{constructor(){super(...arguments),this.caption=""}render(){return fe`
1299
1304
  <div class="container">
1300
1305
  <vmp-text content=${this.caption} size="large"></vmp-text>
1301
1306
  </div>
1302
- `}};xn.styles=[Fe.styles??[],it`
1307
+ `}};Kn.styles=[Oe.styles??[],at`
1303
1308
  .container {
1304
1309
  display: block;
1305
1310
  margin: 0 var(--space-small);
@@ -1318,33 +1323,33 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1318
1323
  /* Line height controls the spacing between the cloned boxes so has to override the default */
1319
1324
  line-height: 2.2;
1320
1325
  }
1321
- `],xu([V({type:String})],xn.prototype,"caption",2),xn=xu([Bt("vmp-captions")],xn);var tB=Object.defineProperty,iB=Object.getOwnPropertyDescriptor,ut=(s,e,t,i)=>{for(var r=i>1?void 0:i?iB(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&tB(e,t,r),r};const sB=3e3;let et=class extends Fe{constructor(){super(...arguments),this.loading=!1,this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.languages=[],this.language="en",this.levels=[],this.level=-1,this.playbackRate=1,this.caption="",this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=Oa,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=gt()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},sB)}_immediateShowControls(){this.showControls=!0,clearTimeout(this._controlHideTimeout)}_immediateHideControls(){this.showControls=!1,this._hasTouched=!1,clearTimeout(this._controlHideTimeout)}willUpdate(s){var e;s.has("playing")&&this.playing&&this._startHideControls(),s.has("showControls")&&this.playing&&!this.showControls&&((e=this._playerControlsRef.value)==null||e.hideMenus())}render(){var i;const s=(i=this.controls)==null?void 0:i.includes("play-large"),e=this.playing&&!this.showControls,t=!!(s&&!this.playing);return fe`
1326
+ `],$h([J({type:String})],Kn.prototype,"caption",2),Kn=$h([St("vmp-captions")],Kn);var kv=Object.defineProperty,Fv=Object.getOwnPropertyDescriptor,dt=(s,e,t,i)=>{for(var r=i>1?void 0:i?Fv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&kv(e,t,r),r};const Nv=3e3;let st=class extends Oe{constructor(){super(...arguments),this.loading=!1,this.playing=!1,this.volume=1,this.muted=!1,this.currentTime=0,this.duration=0,this.languages=[],this.language="en",this.levels=[],this.level=-1,this.playbackRate=1,this.caption="",this.buffer=[],this.captions=!1,this.fullscreen=!1,this.controls=eA,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=gt()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},Nv)}_immediateShowControls(){this.showControls=!0,clearTimeout(this._controlHideTimeout)}_immediateHideControls(){this.showControls=!1,this._hasTouched=!1,clearTimeout(this._controlHideTimeout)}willUpdate(s){var e;s.has("playing")&&this.playing&&this._startHideControls(),s.has("showControls")&&this.playing&&!this.showControls&&((e=this._playerControlsRef.value)==null||e.hideMenus())}render(){var s;const e=(s=this.controls)==null?void 0:s.includes("play-large"),t=this.playing&&!this.showControls,i=!!(e&&!this.playing);return fe`
1322
1327
  <div
1323
- class=${Ue({container:!0,hide:e})}
1328
+ class=${$e({container:!0,hide:t})}
1324
1329
  @mousemove=${()=>{this._immediateShowControls(),this._startHideControls()}}
1325
1330
  @mouseleave=${this._immediateHideControls}
1326
1331
  @touchstart=${r=>{this.playing&&!this.showControls&&!this._hasTouched&&(r.preventDefault(),this._hasTouched=!0,this._immediateShowControls(),this._startHideControls())}}
1327
1332
  >
1328
1333
  <div
1329
- class=${Ue({fixtures:!0,invisible:!this.loading&&!t})}
1334
+ class=${$e({fixtures:!0,invisible:!this.loading&&!i})}
1330
1335
  @click=${()=>{this.showControls&&this.dispatchEvent(new CustomEvent("play:click",{bubbles:!0,composed:!0,detail:this.playing}))}}
1331
1336
  >
1332
1337
  <vmp-icon
1333
- class=${Ue({hidden:!t})}
1338
+ class=${$e({hidden:!i})}
1334
1339
  icon="play-large"
1335
1340
  ></vmp-icon>
1336
1341
  <vmp-loading-spinner
1337
- class=${Ue({hidden:!this.loading||t})}
1342
+ class=${$e({hidden:!this.loading||i})}
1338
1343
  ></vmp-loading-spinner>
1339
1344
  </div>
1340
1345
  <div
1341
- class=${Ue({controls:!0,hide:e})}
1346
+ class=${$e({controls:!0,hide:t})}
1342
1347
  @focusin=${this._immediateShowControls}
1343
1348
  @mousemove=${r=>{r.stopPropagation(),this._immediateShowControls()}}
1344
1349
  @click=${this._immediateShowControls}
1345
1350
  >
1346
1351
  ${this.captions?fe`<vmp-captions
1347
- class=${Ue({hidden:!this.caption,hiddenControls:e})}
1352
+ class=${$e({hidden:!this.caption,hiddenControls:t})}
1348
1353
  caption=${this.caption}
1349
1354
  ></vmp-captions>`:null}
1350
1355
  <vmp-player-controls
@@ -1355,7 +1360,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1355
1360
  currentTime=${this.currentTime}
1356
1361
  duration=${this.duration}
1357
1362
  .languages=${this.languages}
1358
- language=${this.language}
1363
+ .language=${this.language}
1359
1364
  .levels=${this.levels}
1360
1365
  .level=${this.level}
1361
1366
  playbackRate=${this.playbackRate}
@@ -1366,7 +1371,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1366
1371
  ></vmp-player-controls>
1367
1372
  </div>
1368
1373
  </div>
1369
- `}};et.styles=[Fe.styles??[],it`
1374
+ `}};st.styles=[Oe.styles??[],at`
1370
1375
  :host {
1371
1376
  --overlay-border-radius: var(--player-border-radius, 0px);
1372
1377
  }
@@ -1438,7 +1443,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1438
1443
  vmp-captions.hiddenControls {
1439
1444
  transform: translateY(calc(var(--space-small) * -1));
1440
1445
  }
1441
- `],ut([V({type:Boolean})],et.prototype,"loading",2),ut([V({type:Boolean})],et.prototype,"playing",2),ut([V({type:Number})],et.prototype,"volume",2),ut([V({type:Boolean})],et.prototype,"muted",2),ut([V({type:Number})],et.prototype,"currentTime",2),ut([V({type:Number})],et.prototype,"duration",2),ut([V({type:Array})],et.prototype,"languages",2),ut([V({type:String})],et.prototype,"language",2),ut([V({type:Array,attribute:!1})],et.prototype,"levels",2),ut([V({type:Number})],et.prototype,"level",2),ut([V({type:Number})],et.prototype,"playbackRate",2),ut([V({type:String})],et.prototype,"caption",2),ut([V({type:Array})],et.prototype,"buffer",2),ut([V({type:Boolean})],et.prototype,"captions",2),ut([V({type:Boolean})],et.prototype,"fullscreen",2),ut([V({type:Array})],et.prototype,"controls",2),ut([Xe()],et.prototype,"showControls",2),et=ut([Bt("vmp-player-overlay")],et);var rB=Object.defineProperty,nB=Object.getOwnPropertyDescriptor,$e=(s,e,t,i)=>{for(var r=i>1?void 0:i?nB(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&rB(e,t,r),r};const oB=1e3/60;let Ge=class extends Fe{constructor(){super(...arguments),this.burnCaptions=!1,this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.compilation=uo,this.dataResolver=Co,this.languageResolver=hf,this._sceneController=new fm(this),this._drawController=new hm(this),this._observer=null,this._wasPlaying=!1,this._manualMute=this.muted,this._seekerRAF=null,this._seekerTimeout=null,this._lastWaiting=!1,this._lastTimestamp=null,this._playerRef=gt(),this._canvasRef=gt(),this._pageHidden=document.visibilityState==="hidden",this._aspectRatio=this.propAspectRatio,this._processing=!1,this._waiting=!1,this._errors=[],this._seeking=!1,this._language="en",this._captions=!1,this._fullscreen=!1,this._initialised=null,this._paused=!0,this._playbackRate=1,this._volume=null,this._muted=null,this._videoResolution=-1,this._handleContainerResize=()=>{var s;(s=this.shadowRoot)!=null&&s.host&&!this.propAspectRatio&&(this._aspectRatio=this.shadowRoot.host.clientWidth/this.shadowRoot.host.clientHeight)},this._handleCanvasResize=()=>{this.draw()},this._loop=()=>{this._endLoop(),this._pageHidden?this._seekerTimeout=setTimeout(this._seeker,oB):this._seekerRAF=requestAnimationFrame(this._seeker)},this._endLoop=()=>{this._seekerRAF&&cancelAnimationFrame(this._seekerRAF),this._seekerTimeout&&clearTimeout(this._seekerTimeout),this._seekerRAF=null,this._seekerTimeout=null},this._seeker=(s=performance.now())=>{this.sceneConfig&&this.scenes.length>0&&(this._waiting=this._drawController.activeScenes.some(({video:e})=>{if(e){const{key:t}=e,i=this.videoState[t];return!i||!i.initialised||i.waiting||e.node.readyState<3}}),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),s-(this._lastTimestamp??0)>1e3/this.sceneConfig.frameRate&&(this._drawController.currentTime=this._drawController.currentTime+(s-(this._lastTimestamp??s))/1e3*this.playbackRate,this._lastTimestamp=s),this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))),this.paused||this._loop()},this._handleError=s=>{this._errors=[...this.errors,s.error],s.error.fatal&&this.pause()},this._handleFullscreenChange=()=>{document.fullscreenElement?this._fullscreen=!0:this._fullscreen=!1},this._handleVisibilityChange=()=>{this._pageHidden=document.visibilityState==="hidden",this.paused||this._loop()}}get aspectRatio(){return this._aspectRatio}get processing(){return this._processing}get waiting(){return!this.paused&&this._waiting}get errors(){return this._errors}get seeking(){return this._seeking}get language(){return this._language}get captions(){return this._captions}get fullscreen(){return this._fullscreen}get initialised(){return this._initialised=this._initialised??new Promise(s=>{const e=setInterval(()=>{!!this.errors.find(i=>i.fatal)&&s(!1),!this.loading&&!this.processing&&this.scenes.length>0&&s(!0)},500);setTimeout(()=>{clearInterval(e),s(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get scene(){return this._drawController.activeScenes[this._drawController.activeScenes.length-1]}get scenes(){var s;return((s=this._sceneController.scenes)==null?void 0:s.scenes)??[]}get sceneConfig(){return this._sceneController.scenes}get videos(){return this._sceneController.videos??{}}get videoState(){return this._sceneController.videoState}get sceneVideoState(){return this.scenes.reduce((s,{video:e,start:t,duration:i})=>{const r=(e==null?void 0:e.key)??`${t}-${i}`;return s[r]=this.videoState[r],s},{})}set paused(s){s!==this._paused&&(this._paused=s,this.requestUpdate(),this.dispatchEvent(new CustomEvent(s?"pause":"play")))}get paused(){return this._paused}set playbackRate(s){s!==this._playbackRate&&(this._playbackRate=s,this.scenes.forEach(({video:e})=>{e&&(e.node.playbackRate=s)}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:s})))}get playbackRate(){return this._playbackRate}set volume(s){const e=Math.min(1,Math.max(0,s));e!==this._volume&&(this.scenes.forEach(({video:t})=>{t&&(t.node.volume=e)}),localStorage.setItem("vmp-player-volume",e.toString()),this._volume=e,e>0&&(this.muted=!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(s){this.scenes.forEach(({video:e})=>{e&&(e.node.muted=s)}),s!==this._muted&&(this._muted=s,localStorage.setItem("vmp-player-muted",s.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(s){s!==this._videoResolution&&(this._videoResolution=s,this.scenes.forEach(({video:e})=>{if(e!=null&&e.hls){const t=e.hls.levels.findIndex(i=>Math.min(i.height,i.width)===s);e.hls.currentLevel=t??-1}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(s){s!==this._drawController.currentTime&&(this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s))}get currentTime(){return this._drawController.currentTime}reset(s=0,e=!1){this._lastTimestamp=null,this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s),e?this.play():this.pause()}clear(){this._drawController.clear()}play(){this.paused=!1,this._lastTimestamp=null,this.duration>0&&this._drawController.currentTime>=this.duration&&this.reset(0,!0),this._loop()}pause(){this._endLoop(),this.paused=!0,this.scenes.forEach(({video:s})=>{s&&s.node.pause()})}draw(s){return this._drawController.draw(s)}setScene(s){var e,t;if((e=this._sceneController)!=null&&e.scenes){const i=(t=this.scenes)==null?void 0:t[s];if(!i){const r=new Ai(`No scene at index: ${s}`);return this.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:r,message:r.message}))}this.reset(i.start+this._sceneController.scenes.transitionDuration,!this.paused)}}toggleFullscreen(s){s??this.fullscreen?pm():this._playerRef.value&&Em(this._playerRef.value)}connectedCallback(){var s;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(s=this.shadowRoot)!=null&&s.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(){this.propAspectRatio&&(this._aspectRatio=this.propAspectRatio)}updated(s){s.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this.processing&&!this._sceneController.hasPlayed&&s.has("_processing")&&this.play()}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this._observer)==null||s.disconnect(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?fe`
1446
+ `],dt([J({type:Boolean})],st.prototype,"loading",2),dt([J({type:Boolean})],st.prototype,"playing",2),dt([J({type:Number})],st.prototype,"volume",2),dt([J({type:Boolean})],st.prototype,"muted",2),dt([J({type:Number})],st.prototype,"currentTime",2),dt([J({type:Number})],st.prototype,"duration",2),dt([J({type:Array})],st.prototype,"languages",2),dt([J({type:String})],st.prototype,"language",2),dt([J({type:Array,attribute:!1})],st.prototype,"levels",2),dt([J({type:Number})],st.prototype,"level",2),dt([J({type:Number})],st.prototype,"playbackRate",2),dt([J({type:String})],st.prototype,"caption",2),dt([J({type:Array})],st.prototype,"buffer",2),dt([J({type:Boolean})],st.prototype,"captions",2),dt([J({type:Boolean})],st.prototype,"fullscreen",2),dt([J({type:Array})],st.prototype,"controls",2),dt([Ze()],st.prototype,"showControls",2),st=dt([St("vmp-player-overlay")],st);var Mv=Object.defineProperty,Pv=Object.getOwnPropertyDescriptor,Ve=(s,e,t,i)=>{for(var r=i>1?void 0:i?Pv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Mv(e,t,r),r};const Ov=1e3/60,Uv=.5;let He=class extends Oe{constructor(){super(...arguments),this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.compilation=bo,this.dataResolver=No,this.languageResolver=Nf,this._sceneController=new WC(this),this._drawController=new HC(this),this._observer=null,this._wasPlaying=!1,this._manualMute=this.muted,this._seekerRAF=null,this._seekerTimeout=null,this._lastWaiting=!1,this._lastTimestamp=null,this._playerRef=gt(),this._canvasRef=gt(),this._pageHidden=document.visibilityState==="hidden",this._aspectRatio=this.propAspectRatio,this._processing=!1,this._waiting=!1,this._errors=[],this._seeking=!1,this._language=this.propLanguage,this._languages=[],this._captions=!1,this._fullscreen=!1,this._initialised=null,this._paused=!0,this._playbackRate=1,this._volume=null,this._muted=null,this._videoResolution=-1,this._handleContainerResize=()=>{var s;(s=this.shadowRoot)!=null&&s.host&&!this.propAspectRatio&&(this._aspectRatio=this.shadowRoot.host.clientWidth/this.shadowRoot.host.clientHeight)},this._handleCanvasResize=()=>{this.draw()},this._loop=()=>{this._endLoop(),this._pageHidden?this._seekerTimeout=setTimeout(this._seeker,Ov):this._seekerRAF=requestAnimationFrame(this._seeker)},this._endLoop=()=>{this._seekerRAF&&cancelAnimationFrame(this._seekerRAF),this._seekerTimeout&&clearTimeout(this._seekerTimeout),this._seekerRAF=null,this._seekerTimeout=null},this._seeker=(s=performance.now())=>{if(this.sceneConfig&&this.scenes.length>0){if(this._waiting=this._drawController.activeScenes.some(({video:e})=>{if(e){const{key:t}=e,i=this.videoState[t];return!i||!i.initialised||i.waiting||e.node.readyState<3}}),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),s-(this._lastTimestamp??0)>1e3/this.sceneConfig.frameRate){let e=this._drawController.currentTime+(s-(this._lastTimestamp??s))/1e3*this.playbackRate;if(this.sceneConfig&&this.activeScenes.length===1&&this.activeScenes[0]){const t=this.activeScenes[0],{video:i,videoMeta:r}=t;if(i&&r){const n=Math.max(this.sceneConfig.transitionDuration,Uv);i.node.currentTime>r.start+n&&i.node.currentTime<r.start+r.duration-n&&(e=t.start+i.node.currentTime-r.start)}}this._drawController.currentTime=e,this._lastTimestamp=s}this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))}this.paused||this._loop()},this._handleError=s=>{this._errors=[...this.errors,s.error],s.error.fatal&&this.pause()},this._handleFullscreenChange=()=>{this===document.fullscreenElement?this._fullscreen=!0:this._fullscreen=!1},this._handleVisibilityChange=()=>{this._pageHidden=document.visibilityState==="hidden",this.paused||this._loop()}}get aspectRatio(){return this._aspectRatio}get processing(){return this._processing}get waiting(){return!this.paused&&this._waiting}get errors(){return this._errors}get seeking(){return this._seeking}get language(){return this._language}get languages(){return this._languages}get captions(){return this._captions}get fullscreen(){return this._fullscreen}get initialised(){return this._initialised=this._initialised??new Promise(s=>{const e=setInterval(()=>{!!this.errors.find(i=>i.fatal)&&s(!1),!this.loading&&!this.processing&&this.scenes.length>0&&s(!0)},500);setTimeout(()=>{clearInterval(e),s(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get activeScenes(){return this._drawController.activeScenes}get scene(){return this._drawController.activeScenes[this._drawController.activeScenes.length-1]}get scenes(){var s;return((s=this._sceneController.scenes)==null?void 0:s.scenes)??[]}get sceneConfig(){return this._sceneController.scenes}get videos(){return this._sceneController.videos??{}}get videoState(){return this._sceneController.videoState}get sceneVideoState(){return this.scenes.reduce((s,{video:e,start:t,duration:i})=>{const r=(e==null?void 0:e.key)??`${t}-${i}`;return s[r]=this.videoState[r],s},{})}set paused(s){s!==this._paused&&(this._paused=s,this.requestUpdate(),this.dispatchEvent(new CustomEvent(s?"pause":"play")))}get paused(){return this._paused}set playbackRate(s){s!==this._playbackRate&&(this._playbackRate=s,this.scenes.forEach(({video:e})=>{e&&(e.node.playbackRate=s)}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:s})))}get playbackRate(){return this._playbackRate}set volume(s){const e=Math.min(1,Math.max(0,s));e!==this._volume&&(this.scenes.forEach(({video:t})=>{t&&(t.node.volume=e)}),localStorage.setItem("vmp-player-volume",e.toString()),this._volume=e,e>0&&(this.muted=!1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(s){this.scenes.forEach(({video:e})=>{e&&(e.node.muted=s)}),s!==this._muted&&(this._muted=s,localStorage.setItem("vmp-player-muted",s.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:s?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(s){s!==this._videoResolution&&(this._videoResolution=s,this.scenes.forEach(({video:e})=>{if(e!=null&&e.hls){const t=e.hls.levels.findIndex(i=>Math.min(i.height,i.width)===s);e.hls.currentLevel=t??-1}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(s){s!==this._drawController.currentTime&&(this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s))}get currentTime(){return this._drawController.currentTime}reset(s=0,e=!1){this._lastTimestamp=null,this._drawController.currentTime=s,this._sceneController.setVideosCurrentTime(s),e?this.play():this.pause()}clear(){this._drawController.clear()}play(){this.paused=!1,this._lastTimestamp=null,this.duration>0&&this._drawController.currentTime>=this.duration&&this.reset(0,!0),this._loop()}pause(){this._endLoop(),this.paused=!0,this.scenes.forEach(({video:s})=>{s&&s.node.pause()})}draw(s){return this._drawController.draw(s)}setScene(s){var e,t;if((e=this._sceneController)!=null&&e.scenes){const i=(t=this.scenes)==null?void 0:t[s];if(!i){const r=new ci(`No scene at index: ${s}`);return this.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:r,message:r.message}))}this.reset(i.start+this._sceneController.scenes.transitionDuration,!this.paused)}}toggleFullscreen(s){s??this.fullscreen?jC():this._playerRef.value&&qC(this._playerRef.value)}connectedCallback(){var s;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(s=this.shadowRoot)!=null&&s.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(s){s.has("propAspectRatio")&&(this._aspectRatio=this.propAspectRatio),s.has("propLanguage")&&(this._language=this.propLanguage)}updated(s){s.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this._sceneController.hasPlayed&&!this.processing&&s.get("_processing")&&this.play(),s.has("_processing")&&this.processing&&this.dispatchEvent(new CustomEvent("processing"))}disconnectedCallback(){var s;super.disconnectedCallback(),(s=this._observer)==null||s.disconnect(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?fe`
1442
1447
  <style>
1443
1448
  :host {
1444
1449
  aspect-ratio: ${this.propAspectRatio};
@@ -1459,65 +1464,66 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1459
1464
  <vmp-text semibold content="An error has occurred when attempting to play this video."></vmp-text>
1460
1465
  <vmp-text semibold content="Please try again later."></vmp-text>
1461
1466
  </div>
1462
- </div>`}render(){var d,g,f,E,B,S;const s=this.loading||this.processing||!this.scenes||this.duration<=0,{height:e,width:t}=go({resolution:((d=this.sceneConfig)==null?void 0:d.resolution)??720,aspectRatio:this.aspectRatio}),i=Object.keys(this.sceneVideoState).reduce((Q,m)=>Q.concat(this.sceneVideoState[m].buffered??[]),[]),r=this.languageResolver({data:this.data}),n=s?[]:(g=this.controls??Oa)==null?void 0:g.filter(Q=>!(Q==="fullscreen"&&dm()||Q==="navigation"&&(!this.scenes||this.scenes.length<=1))),o=!(n!=null&&n.includes("preview")),a=(((f=this.scenes)==null?void 0:f.length)??0)-1,A=((E=this.scenes)==null?void 0:E.findIndex(Q=>Q===this._drawController.activeScenes[0]))??0,l=(S=(B=this._drawController.activeScenes[0])==null?void 0:B.video)==null?void 0:S.hls,c=this.loading||this.waiting||this.processing,h=!this.src&&!this.data,u=!!this.errors.find(Q=>Q.fatal);return fe`
1467
+ </div>`}render(){var s,e,t,i,r,n;const o=this.loading||this.processing||!this.scenes||this.duration<=0,{height:a,width:A}=So({resolution:((s=this.sceneConfig)==null?void 0:s.resolution)??1080,aspectRatio:this.aspectRatio}),l=Object.keys(this.sceneVideoState).reduce((y,Q)=>y.concat(this.sceneVideoState[Q].buffered??[]),[]),c=o?[]:(e=this.controls??eA)==null?void 0:e.filter(y=>!(y==="fullscreen"&&YC()||y==="navigation"&&(!this.scenes||this.scenes.length<=1))),u=!(c!=null&&c.includes("preview")),h=(((t=this.scenes)==null?void 0:t.length)??0)-1,d=((i=this.scenes)==null?void 0:i.findIndex(y=>y===this._drawController.activeScenes[0]))??0,g=(n=(r=this._drawController.activeScenes[0])==null?void 0:r.video)==null?void 0:n.hls,f=this.loading||this.waiting||this.processing,p=!this.src&&!this.data,v=!!this.errors.find(y=>y.fatal);return fe`
1463
1468
  ${this._renderStyles()}
1464
1469
  <div
1465
1470
  ${ft(this._playerRef)}
1466
- class=${Ue({player:!0,responsive:!this.propAspectRatio})}
1467
- style=${zs({aspectRatio:this.aspectRatio})}
1471
+ class=${$e({player:!0,responsive:!this.propAspectRatio})}
1472
+ style=${rr({aspectRatio:this.aspectRatio})}
1468
1473
  >
1469
- ${!c&&(h||u)?this._renderError():fe`<canvas
1474
+ ${!f&&(p||v)?this._renderError():fe`<canvas
1470
1475
  ${ft(this._canvasRef)}
1471
1476
  ${this._drawController.canvas()}
1472
- ${Na(this._handleCanvasResize)}
1473
- height=${e}
1474
- width=${t}
1477
+ ${tA(this._handleCanvasResize)}
1478
+ height=${a}
1479
+ width=${A}
1475
1480
  ></canvas>
1476
1481
  <vmp-player-overlay
1477
1482
  ${this._drawController.controls()}
1478
1483
  .data=${this.data}
1479
1484
  .template=${this.template}
1480
- ?disabled=${s}
1485
+ ?disabled=${o}
1481
1486
  ?playing=${!this.paused}
1482
- ?loading=${c}
1487
+ ?loading=${f}
1483
1488
  ?muted=${this.muted}
1484
1489
  volume=${this.volume}
1485
1490
  duration=${this.duration}
1486
- .languages=${r}
1487
- language=${this.language}
1488
- .levels=${(l==null?void 0:l.levels)??[]}
1489
- level=${st(l!=null&&l.autoLevelEnabled?-1:l==null?void 0:l.currentLevel)}
1491
+ .languages=${this.languages}
1492
+ .language=${this.language}
1493
+ .levels=${(g==null?void 0:g.levels)??[]}
1494
+ level=${et(g!=null&&g.autoLevelEnabled?-1:g==null?void 0:g.currentLevel)}
1490
1495
  playbackRate=${this.playbackRate}
1491
1496
  caption=${this._drawController.caption}
1492
- .buffer=${i}
1493
- .controls=${n}
1497
+ .buffer=${l}
1498
+ .controls=${c}
1494
1499
  ?captions=${this.captions}
1495
1500
  ?fullscreen=${this.fullscreen}
1496
- @navigate:back=${Q=>{Q.defaultPrevented||this.setScene(A<=0?a:A-1)}}
1497
- @navigate:forward=${Q=>{Q.defaultPrevented||this.setScene(A>=a?0:A+1)}}
1498
- @play:click=${({detail:Q})=>{s||(Q?this.pause():(this.muted=this._manualMute,this.play()))}}
1499
- @volume:click=${({detail:Q})=>{this.muted=!Q,this._manualMute=!Q}}
1500
- @language:click=${({detail:Q})=>{this._language=Q.value}}
1501
- @level:click=${({detail:Q})=>{this.videoResolution=Q.value.resolution}}
1502
- @playbackRate:click=${({detail:Q})=>{this.playbackRate=Q.value??1}}
1501
+ @navigate:back=${y=>{y.defaultPrevented||this.setScene(d<=0?h:d-1)}}
1502
+ @navigate:forward=${y=>{y.defaultPrevented||this.setScene(d>=h?0:d+1)}}
1503
+ @play:click=${({detail:y})=>{o||(y?this.pause():(this.muted=this._manualMute,this.play()))}}
1504
+ @volume:click=${({detail:y})=>{this.muted=!y,this._manualMute=!y}}
1505
+ @language:click=${({detail:y})=>{this._language=y.value}}
1506
+ @level:click=${({detail:y})=>{this.videoResolution=y.value.resolution}}
1507
+ @playbackRate:click=${({detail:y})=>{this.playbackRate=y.value??1}}
1503
1508
  @captions:click=${()=>{this._captions=!this._captions}}
1504
1509
  @fullscreen:click=${()=>{this.toggleFullscreen()}}
1505
- @input=${Q=>{const m=Q.composedPath()[0],y=m.getAttribute("key");if(y==="scrubber"){const L=parseFloat(m.value);this._drawController.currentTime=L,this._sceneController.setVideosCurrentTime(L),this.dispatchEvent(new CustomEvent("seeking",{detail:L}))}y==="volume"&&(this.volume=parseFloat(m.value))}}
1506
- @pointerdown=${Q=>{Q.composedPath()[0].getAttribute("key")==="scrubber"&&(this._seeking=!0,this._wasPlaying=!this.paused,this.paused||this.pause())}}
1507
- @pointerup=${Q=>{Q.composedPath()[0].getAttribute("key")==="scrubber"&&(this._seeking=!1,this._wasPlaying&&(this.play(),this._wasPlaying=!1),this.dispatchEvent(new CustomEvent("seeked",{detail:this._drawController.currentTime})))}}
1510
+ @input=${y=>{const Q=y.composedPath()[0],m=Q.getAttribute("key");if(m==="scrubber"){const b=parseFloat(Q.value);this._drawController.currentTime=b,this._sceneController.setVideosCurrentTime(b),this.dispatchEvent(new CustomEvent("seeking",{detail:b}))}m==="volume"&&(this.volume=parseFloat(Q.value))}}
1511
+ @pointerdown=${y=>{y.composedPath()[0].getAttribute("key")==="scrubber"&&(this._seeking=!0,this._wasPlaying=!this.paused,this.paused||this.pause())}}
1512
+ @pointerup=${y=>{y.composedPath()[0].getAttribute("key")==="scrubber"&&(this._seeking=!1,this._wasPlaying&&(this.play(),this._wasPlaying=!1))}}
1508
1513
  ></vmp-player-overlay>
1509
1514
  <vmp-video-preview
1510
- ?disabled=${o}
1515
+ ?disabled=${u}
1511
1516
  .src=${this.src}
1512
1517
  .data=${this.data}
1513
1518
  .template=${this.template}
1514
- language=${this.language}
1519
+ .language=${this.language}
1520
+ .languages=${this.languages}
1515
1521
  .aspectRatio=${this.aspectRatio}
1516
1522
  .compilation=${this.compilation}
1517
1523
  .dataResolver=${this.dataResolver}
1518
1524
  ></vmp-video-preview>`}
1519
1525
  </div>
1520
- `}};Ge.styles=[Fe.styles??[],it`
1526
+ `}};He.styles=[Oe.styles??[],at`
1521
1527
  :host {
1522
1528
  --player-border-radius: var(--vouch-media-player-border-radius, 0px);
1523
1529
 
@@ -1578,7 +1584,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1578
1584
  top: 0;
1579
1585
  left: 0;
1580
1586
  }
1581
- `],$e([V({type:Object})],Ge.prototype,"data",2),$e([V({type:Object})],Ge.prototype,"template",2),$e([V({type:Boolean})],Ge.prototype,"burnCaptions",2),$e([V({type:Boolean})],Ge.prototype,"debug",2),$e([V({type:String})],Ge.prototype,"src",2),$e([V({type:String})],Ge.prototype,"track",2),$e([V({type:Number,attribute:"aspectratio"})],Ge.prototype,"propAspectRatio",2),$e([V({type:String})],Ge.prototype,"preload",2),$e([V({type:Boolean})],Ge.prototype,"autoplay",2),$e([V({type:Boolean})],Ge.prototype,"loading",2),$e([V({type:Array})],Ge.prototype,"controls",2),$e([V({attribute:!1})],Ge.prototype,"compilation",2),$e([V({attribute:!1})],Ge.prototype,"dataResolver",2),$e([V({attribute:!1})],Ge.prototype,"languageResolver",2),$e([Xe()],Ge.prototype,"_pageHidden",2),$e([Xe()],Ge.prototype,"_aspectRatio",2),$e([Xe()],Ge.prototype,"_processing",2),$e([Xe()],Ge.prototype,"_waiting",2),$e([Xe()],Ge.prototype,"_errors",2),$e([Xe()],Ge.prototype,"_seeking",2),$e([Xe()],Ge.prototype,"_language",2),$e([Xe()],Ge.prototype,"_captions",2),$e([Xe()],Ge.prototype,"_fullscreen",2),Ge=$e([Bt("vmp-media-player")],Ge);var aB=Object.defineProperty,AB=Object.getOwnPropertyDescriptor,yt=(s,e,t,i)=>{for(var r=i>1?void 0:i?AB(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&aB(e,t,r),r};ye.PlayerEmbed=class extends fi{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="auto",this.autoplay=!1,this.aspectRatio=0,this.eventController=new md(this,["durationchange","ended","error","loadeddata","pause","stalled","play","playing","ratechange","scenechange","seeking","seeked","timeupdate","volumechange","waiting","video:loadeddata","video:seeking","video:seeked","video:play","video:playing","video:pause","video:stalled","video:timeupdate","video:ended","video:error"]),this._fetcherController=new Md(this),this._trackingController=new rf(this),this._mediaPlayerRef=gt()}get fetching(){return this._fetcherController.fetching}get waiting(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.waiting}get initialised(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.initialised}get seeking(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.seeking}get paused(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.paused}get captions(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.captions}get fullscreen(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.fullscreen}get duration(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.duration}set currentTime(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=e)}get currentTime(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.currentTime)??0}set playbackRate(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=e)}get playbackRate(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.playbackRate)??1}set volume(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=e)}get volume(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.volume)??1}set muted(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=e)}get muted(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.muted)??!1}get scene(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.scene)??null}get scenes(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.scenes)??[]}get sceneConfig(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.sceneConfig)??null}get videoState(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var e;(e=this._mediaPlayerRef.value)==null||e.play()}pause(){var e;(e=this._mediaPlayerRef.value)==null||e.pause()}reset(e=0,t=!1){var i;(i=this._mediaPlayerRef.value)==null||i.reset(e,t)}setScene(e){var t;(t=this._mediaPlayerRef.value)==null||t.setScene(e)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?fe`
1587
+ `],Ve([J({type:Object})],He.prototype,"data",2),Ve([J({type:Object})],He.prototype,"template",2),Ve([J({type:Boolean})],He.prototype,"debug",2),Ve([J({type:String})],He.prototype,"src",2),Ve([J({type:String})],He.prototype,"track",2),Ve([J({type:String,attribute:"language"})],He.prototype,"propLanguage",2),Ve([J({type:Number,attribute:"aspectratio"})],He.prototype,"propAspectRatio",2),Ve([J({type:String})],He.prototype,"preload",2),Ve([J({type:Boolean})],He.prototype,"autoplay",2),Ve([J({type:Boolean})],He.prototype,"loading",2),Ve([J({type:Array})],He.prototype,"controls",2),Ve([J({attribute:!1})],He.prototype,"compilation",2),Ve([J({attribute:!1})],He.prototype,"dataResolver",2),Ve([J({attribute:!1})],He.prototype,"languageResolver",2),Ve([Ze()],He.prototype,"_pageHidden",2),Ve([Ze()],He.prototype,"_aspectRatio",2),Ve([Ze()],He.prototype,"_processing",2),Ve([Ze()],He.prototype,"_waiting",2),Ve([Ze()],He.prototype,"_errors",2),Ve([Ze()],He.prototype,"_seeking",2),Ve([Ze()],He.prototype,"_language",2),Ve([Ze()],He.prototype,"_languages",2),Ve([Ze()],He.prototype,"_captions",2),Ve([Ze()],He.prototype,"_fullscreen",2),He=Ve([St("vmp-media-player")],He);var Gv=Object.defineProperty,Hv=Object.getOwnPropertyDescriptor,vt=(s,e,t,i)=>{for(var r=i>1?void 0:i?Hv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Gv(e,t,r),r};ye.PlayerEmbed=class extends mi{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="auto",this.autoplay=!1,this.aspectRatio=0,this.eventController=new _d(this,["durationchange","ended","error","loadeddata","pause","stalled","play","playing","ratechange","scenechange","scenesupdate","seeking","seeked","timeupdate","volumechange","processing","waiting","video:loadeddata","video:seeking","video:seeked","video:play","video:playing","video:pause","video:stalled","video:timeupdate","video:ended","video:error"]),this._fetcherController=new Jd(this),this._trackingController=new Sf(this),this._mediaPlayerRef=gt()}get fetching(){return this._fetcherController.fetching}get waiting(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.waiting}get initialised(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.initialised}get seeking(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.seeking}get paused(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.paused}get captions(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.captions}get fullscreen(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.fullscreen}get duration(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.duration}set currentTime(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=e)}get currentTime(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.currentTime)??0}set playbackRate(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=e)}get playbackRate(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.playbackRate)??1}set volume(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=e)}get volume(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.volume)??1}set muted(e){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=e)}get muted(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.muted)??!1}get scene(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.scene)??null}get scenes(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.scenes)??[]}get sceneConfig(){var e;return((e=this._mediaPlayerRef.value)==null?void 0:e.sceneConfig)??null}get videoState(){var e;return(e=this._mediaPlayerRef.value)==null?void 0:e.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var e;(e=this._mediaPlayerRef.value)==null||e.play()}pause(){var e;(e=this._mediaPlayerRef.value)==null||e.pause()}reset(e=0,t=!1){var i;(i=this._mediaPlayerRef.value)==null||i.reset(e,t)}setScene(e){var t;(t=this._mediaPlayerRef.value)==null||t.setScene(e)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?fe`
1582
1588
  <style>
1583
1589
  :host {
1584
1590
  aspect-ratio: ${this.aspectRatio};
@@ -1591,7 +1597,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1591
1597
  height: 100%;
1592
1598
  }
1593
1599
  </style>
1594
- `}render(){return fe`
1600
+ `}willUpdate(e){e.has("vouchId")&&this.vouchId!==e.get("vouchId")&&this.reset(0,!1)}render(){return fe`
1595
1601
  ${this._renderStyles()}
1596
1602
  <vmp-media-player
1597
1603
  ${ft(this._mediaPlayerRef)}
@@ -1600,22 +1606,23 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1600
1606
  ?loading=${this.fetching}
1601
1607
  .data=${this.vouch}
1602
1608
  .template=${this.template}
1603
- aspectRatio=${st(this.aspectRatio)}
1604
- preload=${st(this.preload)}
1609
+ aspectRatio=${et(this.aspectRatio)}
1610
+ preload=${et(this.preload)}
1611
+ language=${et(this.language)}
1605
1612
  .controls=${this.controls}
1606
1613
  ></vmp-media-player>
1607
- `}},ye.PlayerEmbed.styles=[it`
1614
+ `}},ye.PlayerEmbed.styles=[at`
1608
1615
  :host {
1609
1616
  display: flex;
1610
1617
  }
1611
- `],yt([V({type:Object})],ye.PlayerEmbed.prototype,"data",2),yt([V({type:String})],ye.PlayerEmbed.prototype,"vouchId",2),yt([V({type:String})],ye.PlayerEmbed.prototype,"templateId",2),yt([V({type:Array})],ye.PlayerEmbed.prototype,"questions",2),yt([V({type:String})],ye.PlayerEmbed.prototype,"env",2),yt([V({type:String})],ye.PlayerEmbed.prototype,"apiKey",2),yt([V({type:Boolean})],ye.PlayerEmbed.prototype,"disableTracking",2),yt([V({type:String})],ye.PlayerEmbed.prototype,"trackingSource",2),yt([V({type:Array})],ye.PlayerEmbed.prototype,"controls",2),yt([V({type:String})],ye.PlayerEmbed.prototype,"preload",2),yt([V({type:Boolean})],ye.PlayerEmbed.prototype,"autoplay",2),yt([V({type:Number})],ye.PlayerEmbed.prototype,"aspectRatio",2),yt([Xe()],ye.PlayerEmbed.prototype,"vouch",2),yt([Xe()],ye.PlayerEmbed.prototype,"template",2),ye.PlayerEmbed=yt([vr("vouch-embed-player")],ye.PlayerEmbed);function Tn(s,e,t,i=20,r=0){let n=[];if(r>=i)return n;const o=A=>{const l=A.assignedNodes().filter(c=>c.nodeType===1);return l.length>0?Tn(l[0].parentElement,e,t,i,r+1):[]},a=Array.from(s.children||[]);for(const A of a)e(A)||(t(A)&&n.push(A),A.shadowRoot!=null?n.push(...Tn(A.shadowRoot,e,t,i,r+1)):A.tagName==="SLOT"?n.push(...o(A)):n.push(...Tn(A,e,t,i,r+1)));return n}function Tu(s){return s.hasAttribute("hidden")||s.hasAttribute("aria-hidden")&&s.getAttribute("aria-hidden")!=="false"||s.style.display==="none"||s.style.opacity==="0"||s.style.visibility==="hidden"||s.style.visibility==="collapse"}function lB(s){return s.hasAttribute("disabled")||s.hasAttribute("aria-disabled")&&s.getAttribute("aria-disabled")!=="false"}function cB(s){return s.getAttribute("tabindex")==="-1"||Tu(s)||lB(s)?!1:s.hasAttribute("tabindex")||(s instanceof HTMLAnchorElement||s instanceof HTMLAreaElement)&&s.hasAttribute("href")||s instanceof HTMLButtonElement||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement||s instanceof HTMLIFrameElement}const Ka=new Map;function hB(s,e,t){const i=Ka.get(t);i!=null&&window.clearTimeout(i),Ka.set(t,window.setTimeout(()=>{s(),Ka.delete(t)},e))}const Lu=document.createElement("template");Lu.innerHTML=`
1618
+ `],vt([J({type:Object})],ye.PlayerEmbed.prototype,"data",2),vt([J({type:String})],ye.PlayerEmbed.prototype,"vouchId",2),vt([J({type:String})],ye.PlayerEmbed.prototype,"templateId",2),vt([J({type:Array})],ye.PlayerEmbed.prototype,"questions",2),vt([J({type:String})],ye.PlayerEmbed.prototype,"env",2),vt([J({type:String})],ye.PlayerEmbed.prototype,"apiKey",2),vt([J({type:Boolean})],ye.PlayerEmbed.prototype,"disableTracking",2),vt([J({type:String})],ye.PlayerEmbed.prototype,"trackingSource",2),vt([J({type:Array})],ye.PlayerEmbed.prototype,"controls",2),vt([J({type:String})],ye.PlayerEmbed.prototype,"preload",2),vt([J({type:Boolean})],ye.PlayerEmbed.prototype,"autoplay",2),vt([J({type:Number})],ye.PlayerEmbed.prototype,"aspectRatio",2),vt([J({type:String})],ye.PlayerEmbed.prototype,"language",2),vt([Ze()],ye.PlayerEmbed.prototype,"vouch",2),vt([Ze()],ye.PlayerEmbed.prototype,"template",2),ye.PlayerEmbed=vt([Tr("vouch-embed-player")],ye.PlayerEmbed);function Vn(s,e,t,i=20,r=0){let n=[];if(r>=i)return n;const o=A=>{const l=A.assignedNodes().filter(c=>c.nodeType===1);return l.length>0?Vn(l[0].parentElement,e,t,i,r+1):[]},a=Array.from(s.children||[]);for(const A of a)e(A)||(t(A)&&n.push(A),A.shadowRoot!=null?n.push(...Vn(A.shadowRoot,e,t,i,r+1)):A.tagName==="SLOT"?n.push(...o(A)):n.push(...Vn(A,e,t,i,r+1)));return n}function Yh(s){return s.hasAttribute("hidden")||s.hasAttribute("aria-hidden")&&s.getAttribute("aria-hidden")!=="false"||s.style.display==="none"||s.style.opacity==="0"||s.style.visibility==="hidden"||s.style.visibility==="collapse"}function $v(s){return s.hasAttribute("disabled")||s.hasAttribute("aria-disabled")&&s.getAttribute("aria-disabled")!=="false"}function Yv(s){return s.getAttribute("tabindex")==="-1"||Yh(s)||$v(s)?!1:s.hasAttribute("tabindex")||(s instanceof HTMLAnchorElement||s instanceof HTMLAreaElement)&&s.hasAttribute("href")||s instanceof HTMLButtonElement||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement||s instanceof HTMLIFrameElement}const aA=new Map;function Kv(s,e,t){const i=aA.get(t);i!=null&&window.clearTimeout(i),aA.set(t,window.setTimeout(()=>{s(),aA.delete(t)},e))}const Kh=document.createElement("template");Kh.innerHTML=`
1612
1619
  <div id="start"></div>
1613
1620
  <div id="backup"></div>
1614
1621
  <slot></slot>
1615
1622
  <div id="end"></div>
1616
- `;class uB extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Lu.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Tn(this,Tu,cB)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){hB(()=>{this.focused!==e&&(this._focused=e,this.render())},0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}window.customElements.define("focus-trap",uB);var dB=Object.defineProperty,gB=Object.getOwnPropertyDescriptor,Ya=(s,e,t,i)=>{for(var r=i>1?void 0:i?gB(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&dB(e,t,r),r};let Ir=class extends fi{constructor(){super(...arguments),this.open=!1,this.aspectRatio=0}render(){return fe`
1623
+ `;class Vv extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Kh.content.cloneNode(!0)),this.$backup=e.querySelector("#backup"),this.$start=e.querySelector("#start"),this.$end=e.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(e){e?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return Vn(this,Yh,Yv)}trapFocus(e){if(this.inactive)return;let t=this.getFocusableElements();t.length>0?(e?t[t.length-1].focus():t[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(e){Kv(()=>{this.focused!==e&&(this._focused=e,this.render())},0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}window.customElements.define("focus-trap",Vv);var Jv=Object.defineProperty,Wv=Object.getOwnPropertyDescriptor,AA=(s,e,t,i)=>{for(var r=i>1?void 0:i?Wv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Jv(e,t,r),r};let Br=class extends mi{constructor(){super(...arguments),this.open=!1,this.aspectRatio=0}render(){return fe`
1617
1624
  <div
1618
- class=${Ue({container:!0,hidden:!this.open})}
1625
+ class=${$e({container:!0,hidden:!this.open})}
1619
1626
  >
1620
1627
  <div
1621
1628
  class="background"
@@ -1623,8 +1630,8 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1623
1630
  ></div>
1624
1631
  <focus-trap>
1625
1632
  <div
1626
- class=${Ue({"video-frame":!0,grow:this.aspectRatio===0})}
1627
- style=${zs({aspectRatio:this.aspectRatio})}
1633
+ class=${$e({"video-frame":!0,grow:this.aspectRatio===0})}
1634
+ style=${rr({aspectRatio:this.aspectRatio})}
1628
1635
  >
1629
1636
  <slot></slot>
1630
1637
  <vmp-icon-button
@@ -1636,7 +1643,7 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1636
1643
  </div>
1637
1644
  </focus-trap>
1638
1645
  </div>
1639
- `}};Ir.styles=[it`
1646
+ `}};Br.styles=[at`
1640
1647
  :host {
1641
1648
  --vouch-media-player-border-radius: var(--vu-media-player-border-radius, 12px);
1642
1649
  --overlay-background-color: var(--vu-overlay-background-color, black);
@@ -1700,43 +1707,43 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1700
1707
  right: 0;
1701
1708
  margin: 10px;
1702
1709
  }
1703
- `],Ya([V({type:Boolean})],Ir.prototype,"open",2),Ya([V({type:Number})],Ir.prototype,"aspectRatio",2),Ir=Ya([vr("vouch-embed-dialog-overlay")],Ir);var fB=Object.defineProperty,EB=Object.getOwnPropertyDescriptor,xt=(s,e,t,i)=>{for(var r=i>1?void 0:i?EB(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&fB(e,t,r),r};let Dt=class extends fi{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="none",this.disableAutoplay=!1,this.aspectRatio=0,this._mediaPlayerRef=gt(),this.open=!1,this._handleToggle=({detail:s})=>{var e,t,i;this.id===s&&(this.open=!this.open,this.open?!this.disableAutoplay&&((e=this._mediaPlayerRef)!=null&&e.value)&&(this._mediaPlayerRef.value.muted=!1,this._mediaPlayerRef.value.play()):(i=(t=this._mediaPlayerRef)==null?void 0:t.value)==null||i.pause())},this._handleClose=()=>{var s,e;this.open=!1,(e=(s=this._mediaPlayerRef)==null?void 0:s.value)==null||e.pause()},this._handleDocumentKeyUp=s=>{s.key==="Escape"&&this._handleClose()}}connectedCallback(){super.connectedCallback(),document.addEventListener("dialogembed:click",this._handleToggle),document.addEventListener("keyup",this._handleDocumentKeyUp),document.addEventListener("close:click",this._handleClose),document.addEventListener("overlay:click",this._handleClose)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("dialogembed:click",this._handleToggle),document.removeEventListener("keyup",this._handleDocumentKeyUp),document.removeEventListener("close:click",this._handleClose),document.removeEventListener("overlay:click",this._handleClose)}createRenderRoot(){const s=document.createElement("div");return document.body.appendChild(s),s}render(){return fe`
1710
+ `],AA([J({type:Boolean})],Br.prototype,"open",2),AA([J({type:Number})],Br.prototype,"aspectRatio",2),Br=AA([Tr("vouch-embed-dialog-overlay")],Br);var qv=Object.defineProperty,jv=Object.getOwnPropertyDescriptor,_t=(s,e,t,i)=>{for(var r=i>1?void 0:i?jv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&qv(e,t,r),r};let Dt=class extends mi{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="none",this.disableAutoplay=!1,this.aspectRatio=0,this._mediaPlayerRef=gt(),this.open=!1,this._handleToggle=({detail:s})=>{var e,t,i;this.id===s&&(this.open=!this.open,this.open?!this.disableAutoplay&&((e=this._mediaPlayerRef)!=null&&e.value)&&(this._mediaPlayerRef.value.muted=!1,this._mediaPlayerRef.value.play()):(i=(t=this._mediaPlayerRef)==null?void 0:t.value)==null||i.pause())},this._handleClose=()=>{var s,e;this.open=!1,(e=(s=this._mediaPlayerRef)==null?void 0:s.value)==null||e.pause()},this._handleDocumentKeyUp=s=>{s.key==="Escape"&&this._handleClose()}}connectedCallback(){super.connectedCallback(),document.addEventListener("dialogembed:click",this._handleToggle),document.addEventListener("keyup",this._handleDocumentKeyUp),document.addEventListener("close:click",this._handleClose),document.addEventListener("overlay:click",this._handleClose)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("dialogembed:click",this._handleToggle),document.removeEventListener("keyup",this._handleDocumentKeyUp),document.removeEventListener("close:click",this._handleClose),document.removeEventListener("overlay:click",this._handleClose)}createRenderRoot(){const s=document.createElement("div");return document.body.appendChild(s),s}render(){return fe`
1704
1711
  <vouch-embed-dialog-overlay ?open=${this.open} aspectRatio=${this.aspectRatio}>
1705
1712
  <vouch-embed-player
1706
1713
  ${ft(this._mediaPlayerRef)}
1707
- style=${zs({maxWidth:"100%",maxHeight:"100%"})}
1714
+ style=${rr({maxWidth:"100%",maxHeight:"100%"})}
1708
1715
  ?autoplay=${!1}
1709
- vouchId=${st(this.vouchId)}
1710
- templateId=${st(this.templateId)}
1716
+ vouchId=${et(this.vouchId)}
1717
+ templateId=${et(this.templateId)}
1711
1718
  .questions=${this.questions}
1712
1719
  .controls=${this.controls}
1713
- env=${st(this.env)}
1714
- apiKey=${st(this.apiKey)}
1720
+ env=${et(this.env)}
1721
+ apiKey=${et(this.apiKey)}
1715
1722
  ?disableTracking=${this.disableTracking}
1716
- trackingSource=${st(this.trackingSource)}
1717
- preload=${st(this.preload)}
1723
+ trackingSource=${et(this.trackingSource)}
1724
+ preload=${et(this.preload)}
1718
1725
  aspectRatio=${this.aspectRatio}
1719
1726
  ></vouch-embed-player>
1720
1727
  </vouch-embed-dialog-overlay>
1721
- `}};xt([V({type:String})],Dt.prototype,"vouchId",2),xt([V({type:String})],Dt.prototype,"templateId",2),xt([V({type:Array})],Dt.prototype,"questions",2),xt([V({type:String})],Dt.prototype,"env",2),xt([V({type:String})],Dt.prototype,"apiKey",2),xt([V({type:Boolean})],Dt.prototype,"disableTracking",2),xt([V({type:String})],Dt.prototype,"trackingSource",2),xt([V({type:Array})],Dt.prototype,"controls",2),xt([V({type:String})],Dt.prototype,"preload",2),xt([V({type:Boolean})],Dt.prototype,"disableAutoplay",2),xt([V({type:Number})],Dt.prototype,"aspectRatio",2),xt([Xe()],Dt.prototype,"open",2),Dt=xt([vr("vouch-embed-dialog-portal")],Dt);var pB=Object.defineProperty,IB=Object.getOwnPropertyDescriptor,Pt=(s,e,t,i)=>{for(var r=i>1?void 0:i?IB(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&pB(e,t,r),r};ye.DialogEmbed=class extends fi{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="none",this.disableAutoplay=!1,this.aspectRatio=0,this._id=xi(),this._handleRootClick=()=>{this.dispatchEvent(new CustomEvent("dialogembed:click",{detail:this._id,bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleRootClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleRootClick)}render(){return fe`
1728
+ `}};_t([J({type:String})],Dt.prototype,"vouchId",2),_t([J({type:String})],Dt.prototype,"templateId",2),_t([J({type:Array})],Dt.prototype,"questions",2),_t([J({type:String})],Dt.prototype,"env",2),_t([J({type:String})],Dt.prototype,"apiKey",2),_t([J({type:Boolean})],Dt.prototype,"disableTracking",2),_t([J({type:String})],Dt.prototype,"trackingSource",2),_t([J({type:Array})],Dt.prototype,"controls",2),_t([J({type:String})],Dt.prototype,"preload",2),_t([J({type:Boolean})],Dt.prototype,"disableAutoplay",2),_t([J({type:Number})],Dt.prototype,"aspectRatio",2),_t([Ze()],Dt.prototype,"open",2),Dt=_t([Tr("vouch-embed-dialog-portal")],Dt);var Xv=Object.defineProperty,zv=Object.getOwnPropertyDescriptor,Gt=(s,e,t,i)=>{for(var r=i>1?void 0:i?zv(e,t):e,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(e,t,r):o(r))||r);return i&&r&&Xv(e,t,r),r};ye.DialogEmbed=class extends mi{constructor(){super(...arguments),this.env="prod",this.apiKey="",this.disableTracking=!1,this.trackingSource="embedded_player",this.preload="none",this.disableAutoplay=!1,this.aspectRatio=0,this._id=_i(),this._handleRootClick=()=>{this.dispatchEvent(new CustomEvent("dialogembed:click",{detail:this._id,bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleRootClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleRootClick)}render(){return fe`
1722
1729
  <slot>
1723
1730
  <vmp-button size="large">Play</vmp-button>
1724
1731
  </slot>
1725
1732
  <vouch-embed-dialog-portal
1726
1733
  id=${this._id}
1727
1734
  ?autoplay=${!1}
1728
- vouchId=${st(this.vouchId)}
1729
- templateId=${st(this.templateId)}
1735
+ vouchId=${et(this.vouchId)}
1736
+ templateId=${et(this.templateId)}
1730
1737
  .questions=${this.questions}
1731
1738
  .controls=${this.controls}
1732
- env=${st(this.env)}
1733
- apiKey=${st(this.apiKey)}
1739
+ env=${et(this.env)}
1740
+ apiKey=${et(this.apiKey)}
1734
1741
  ?disableTracking=${this.disableTracking}
1735
- trackingSource=${st(this.trackingSource)}
1736
- preload=${st(this.preload)}
1742
+ trackingSource=${et(this.trackingSource)}
1743
+ preload=${et(this.preload)}
1737
1744
  aspectRatio=${this.aspectRatio}
1738
1745
  ></vouch-embed-dialog-portal>
1739
- `}},ye.DialogEmbed.styles=[it`
1746
+ `}},ye.DialogEmbed.styles=[at`
1740
1747
  :host {
1741
1748
  --vu-button-padding: 10px 20px;
1742
1749
  --vu-button-background: #287179;
@@ -1746,5 +1753,5 @@ ${e}`,kg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mg=Objec
1746
1753
  width: fit-content;
1747
1754
  height: fit-content;
1748
1755
  }
1749
- `],Pt([V({type:String})],ye.DialogEmbed.prototype,"vouchId",2),Pt([V({type:String})],ye.DialogEmbed.prototype,"templateId",2),Pt([V({type:Array})],ye.DialogEmbed.prototype,"questions",2),Pt([V({type:String})],ye.DialogEmbed.prototype,"env",2),Pt([V({type:String})],ye.DialogEmbed.prototype,"apiKey",2),Pt([V({type:Boolean})],ye.DialogEmbed.prototype,"disableTracking",2),Pt([V({type:String})],ye.DialogEmbed.prototype,"trackingSource",2),Pt([V({type:Array})],ye.DialogEmbed.prototype,"controls",2),Pt([V({type:String})],ye.DialogEmbed.prototype,"preload",2),Pt([V({type:Boolean})],ye.DialogEmbed.prototype,"disableAutoplay",2),Pt([V({type:Number})],ye.DialogEmbed.prototype,"aspectRatio",2),ye.DialogEmbed=Pt([vr("vouch-embed-dialog")],ye.DialogEmbed);function hi(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function ku(s,e){for(var t="",i=0,r=-1,n=0,o,a=0;a<=s.length;++a){if(a<s.length)o=s.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(r===a-1||n===1))if(r!==a-1&&n===2){if(t.length<2||i!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var A=t.lastIndexOf("/");if(A!==t.length-1){A===-1?(t="",i=0):(t=t.slice(0,A),i=t.length-1-t.lastIndexOf("/")),r=a,n=0;continue}}else if(t.length===2||t.length===1){t="",i=0,r=a,n=0;continue}}e&&(t.length>0?t+="/..":t="..",i=2)}else t.length>0?t+="/"+s.slice(r+1,a):t=s.slice(r+1,a),i=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return t}function CB(s,e){var t=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+i:t+s+i:i}var Ms={resolve:function(){for(var e="",t=!1,i,r=arguments.length-1;r>=-1&&!t;r--){var n;r>=0?n=arguments[r]:(i===void 0&&(i=process.cwd()),n=i),hi(n),n.length!==0&&(e=n+"/"+e,t=n.charCodeAt(0)===47)}return e=ku(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(hi(e),e.length===0)return".";var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=ku(e,!t),e.length===0&&!t&&(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return hi(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];hi(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":Ms.normalize(e)},relative:function(e,t){if(hi(e),hi(t),e===t||(e=Ms.resolve(e),t=Ms.resolve(t),e===t))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var r=e.length,n=r-i,o=1;o<t.length&&t.charCodeAt(o)===47;++o);for(var a=t.length,A=a-o,l=n<A?n:A,c=-1,h=0;h<=l;++h){if(h===l){if(A>l){if(t.charCodeAt(o+h)===47)return t.slice(o+h+1);if(h===0)return t.slice(o+h)}else n>l&&(e.charCodeAt(i+h)===47?c=h:h===0&&(c=0));break}var u=e.charCodeAt(i+h),d=t.charCodeAt(o+h);if(u!==d)break;u===47&&(c=h)}var g="";for(h=i+c+1;h<=r;++h)(h===r||e.charCodeAt(h)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+t.slice(o+c):(o+=c,t.charCodeAt(o)===47&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(hi(e),e.length===0)return".";for(var t=e.charCodeAt(0),i=t===47,r=-1,n=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":".":i&&r===1?"//":e.slice(0,r)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');hi(e);var i=0,r=-1,n=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,A=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!n){i=o+1;break}}else A===-1&&(n=!1,A=o+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(r=o):(a=-1,r=A))}return i===r?r=A:r===-1&&(r=e.length),e.slice(i,r)}else{for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!n){i=o+1;break}}else r===-1&&(n=!1,r=o+1);return r===-1?"":e.slice(i,r)}},extname:function(e){hi(e);for(var t=-1,i=0,r=-1,n=!0,o=0,a=e.length-1;a>=0;--a){var A=e.charCodeAt(a);if(A===47){if(!n){i=a+1;break}continue}r===-1&&(n=!1,r=a+1),A===46?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===i+1?"":e.slice(t,r)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return CB("/",e)},parse:function(e){hi(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var i=e.charCodeAt(0),r=i===47,n;r?(t.root="/",n=1):n=0;for(var o=-1,a=0,A=-1,l=!0,c=e.length-1,h=0;c>=n;--c){if(i=e.charCodeAt(c),i===47){if(!l){a=c+1;break}continue}A===-1&&(l=!1,A=c+1),i===46?o===-1?o=c:h!==1&&(h=1):o!==-1&&(h=-1)}return o===-1||A===-1||h===0||h===1&&o===A-1&&o===a+1?A!==-1&&(a===0&&r?t.base=t.name=e.slice(1,A):t.base=t.name=e.slice(a,A)):(a===0&&r?(t.name=e.slice(1,o),t.base=e.slice(1,A)):(t.name=e.slice(a,o),t.base=e.slice(a,A)),t.ext=e.slice(o,A)),a>0?t.dir=e.slice(0,a-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};Ms.posix=Ms;var mB=Ms;const{basename:Mu,extname:BB}=mB;class yB{constructor(){let e=typeof Fr>"u",t="image/png",i="image/jpeg",r="image/jpeg",n="image/webp",o="application/pdf",a="image/svg+xml";Object.assign(this,{toMime:this.toMime.bind(this),fromMime:this.fromMime.bind(this),expected:e?'"png", "jpg", or "webp"':'"png", "jpg", "pdf", or "svg"',formats:e?{png:t,jpg:i,jpeg:r,webp:n}:{png:t,jpg:i,jpeg:r,pdf:o,svg:a},mimes:e?{[t]:"png",[i]:"jpg",[n]:"webp"}:{[t]:"png",[i]:"jpg",[o]:"pdf",[a]:"svg"}})}toMime(e){return this.formats[(e||"").replace(/^\./,"").toLowerCase()]}fromMime(e){return this.mimes[e]}}function QB(s,{filename:e="",extension:t="",format:f,page:r,quality:n,matte:o,density:a,outline:A,archive:d}={}){var{fromMime:c,toMime:h,expected:u}=new yB,d=d||"canvas",g=f||t.replace(/@\d+x$/i,"")||BB(e),f=c(h(g)||g),E=h(f),B=s.length;if(!g)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!f)throw new Error(`Unsupported file format "${g}" (expected ${u})`);if(!B)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let S,Q,m=e.replace(/{(\d*)}/g,(L,v)=>(Q=!0,v=parseInt(v,10),S=isFinite(v)?v:isFinite(S)?S:-1,"{}")),y=r>0?r-1:r<0?B+r:void 0;if(isFinite(y)&&y<0||y>=B)throw new RangeError(B==1?`Canvas only has a ‘page 1’ (${y} is out of bounds)`:`Canvas has pages 1–${B} (${y} is out of bounds)`);if(s=isFinite(y)?[s[y]]:Q||f=="pdf"?s:s.slice(-1),n===void 0)n=.92;else if(typeof n!="number"||!isFinite(n)||n<0||n>1)throw new TypeError("The quality option must be an number in the 0.0–1.0 range");if(a===void 0){let L=(t||Mu(e,g)).match(/@(\d+)x$/i);a=L?parseInt(L[1],10):1}else if(typeof a!="number"||!Number.isInteger(a)||a<1)throw new TypeError("The density option must be a non-negative integer");return A===void 0?A=!0:f=="svg"&&(A=!!A),{filename:e,pattern:m,format:f,mime:E,pages:s,padding:S,quality:n,matte:o,density:a,outline:A,archive:d}}class Ln{static for(e){return new Ln().append(e).get()}constructor(){this.crc=-1}get(){return~this.crc}append(e){for(var t=this.crc|0,i=this.table,r=0,n=e.length|0;r<n;r++)t=t>>>8^i[(t^e[r])&255];return this.crc=t,this}}Ln.prototype.table=(()=>{var s,e,t,i=[];for(s=0;s<256;s++){for(t=s,e=0;e<8;e++)t=t&1?t>>>1^3988292384:t>>>1;i[s]=t}return i})();function Va(s){let e=new Uint8Array(s),t=new DataView(e.buffer),i={array:e,view:t,size:s,set8(r,n){return t.setUint8(r,n),i},set16(r,n){return t.setUint16(r,n,!0),i},set32(r,n){return t.setUint32(r,n,!0),i},bytes(r,n){return e.set(n,r),i}};return i}const kn=class kn{constructor(e){let t=new Date;Object.assign(this,{directory:e,offset:0,files:[],time:(t.getHours()<<6|t.getMinutes())<<5|t.getSeconds()/2,date:(t.getFullYear()-1980<<4|t.getMonth()+1)<<5|t.getDate()}),this.add(e)}async add(e,t){let i=!t,r=kn.encoder.encode(`${this.directory}/${i?"":e}`),n=new Uint8Array(i?0:await t.arrayBuffer()),o=30+r.length,a=o+n.length,A=16,{offset:l}=this,c=Va(26).set32(0,134742036).set16(6,this.time).set16(8,this.date).set32(10,Ln.for(n)).set32(14,n.length).set32(18,n.length).set16(22,r.length);l+=o;let h=Va(o+n.length+A).set32(0,67324752).bytes(4,c.array).bytes(30,r).bytes(o,n);l+=n.length,h.set32(a,134695760).bytes(a+4,c.array.slice(10,22)),l+=A,this.files.push({offset:l,folder:i,name:r,header:c,payload:h}),this.offset=l}toBuffer(){let e=this.files.reduce((h,{name:u})=>46+u.length+h,0),t=Va(e+22),i=0;for(var{offset:r,name:n,header:o,folder:a}of this.files)t.set32(i,33639248).set16(i+4,20).bytes(i+6,o.array).set8(i+38,a?16:0).set32(i+42,r).bytes(i+46,n),i+=46+n.length;t.set32(i,101010256).set16(i+8,this.files.length).set16(i+10,this.files.length).set32(i+12,e).set32(i+16,this.offset);let A=new Uint8Array(this.offset+t.size),l=0;for(var{payload:c}of this.files)A.set(c.array,l),l+=c.size;return A.set(t.array,l),A}get blob(){return new Blob([this.toBuffer()],{type:"application/zip"})}};qu(kn,"encoder",new TextEncoder);let Ja=kn;const Wa=(s,e,t,i)=>{if(i){let{width:r,height:n}=s,o=Object.assign(document.createElement("canvas"),{width:r,height:n}),a=o.getContext("2d");a.fillStyle=i,a.fillRect(0,0,r,n),a.drawImage(s,0,0),s=o}return new Promise((r,n)=>s.toBlob(r,e,t))},vB=(...s)=>Wa(...s).then(e=>e.arrayBuffer()),wB=async(s,e,t,i,r)=>{_u(r,await Wa(s,e,t,i))},SB=async(s,e,t,i,r,n,o)=>{let a=c=>n.replace("{}",String(c+1).padStart(o,"0")),A=Mu(r,".zip")||"archive",l=new Ja(A);await Promise.all(s.map(async(c,h)=>{let u=a(h);await l.add(u,await Wa(c,e,t,i))})),_u(`${A}.zip`,l.blob)},_u=(s,e)=>{const t=window.URL.createObjectURL(e),i=document.createElement("a");i.style.display="none",i.href=t,i.setAttribute("download",s),typeof i.download>"u"&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>window.URL.revokeObjectURL(t),100)};var DB={asBuffer:vB,asDownload:wB,asZipDownload:SB,atScale:(s,e,t)=>s.map(i=>{if(e==1&&!t)return i.canvas;let r=document.createElement("canvas"),n=r.getContext("2d"),o=i.canvas?i.canvas:i;return r.width=o.width*e,r.height=o.height*e,t&&(n.fillStyle=t,n.fillRect(0,0,r.width,r.height)),n.scale(e,e),n.drawImage(o,0,0),r}),options:QB};const{asBuffer:qa,asDownload:bB,asZipDownload:RB,atScale:ja,options:Xa}=DB,Fu=Symbol.for("toDataURL"),xB=s=>{let e=Object.assign(new Ou,{crossOrigin:"Anonymous",src:s});return e.decode().then(()=>e)};class TB{constructor(e,t){let i=document.createElement("canvas"),r=[];Object.defineProperty(i,"async",{value:!0,writable:!1,enumerable:!0});for(var[n,o]of Object.entries({png:()=>qa(i,"image/png"),jpg:()=>qa(i,"image/jpeg"),pages:()=>r.concat(i).map(a=>a.getContext("2d"))}))Object.defineProperty(i,n,{get:o});return Object.assign(i,{width:e,height:t,newPage(...a){var{width:l,height:c}=i,A=Object.assign(document.createElement("canvas"),{width:l,height:c});A.getContext("2d").drawImage(i,0,0),r.push(A);var[l,c]=a.length?a:[l,c];return Object.assign(i,{width:l,height:c}).getContext("2d")},saveAs(a,A){A=typeof A=="number"?{quality:A}:A;let l=Xa(this.pages,{filename:a,...A}),{pattern:c,padding:h,mime:u,quality:d,matte:g,density:f,archive:E}=l,B=ja(l.pages,f);return h==null?bB(B[0],u,d,g,a):RB(B,u,d,g,E,c,h)},toBuffer(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=Xa(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=ja(d,g,u)[0];return qa(f,c,h,u)},[Fu]:i.toDataURL.bind(i),toDataURL(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=Xa(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=ja(d,g,u)[0],E=f[f===i?Fu:"toDataURL"](c,h);return Promise.resolve(E)}})}}const{CanvasRenderingContext2D:LB,CanvasGradient:kB,CanvasPattern:MB,Image:Ou,ImageData:_B,Path2D:FB,DOMMatrix:OB,DOMRect:NB,DOMPoint:UB}=window;var Nu={Canvas:TB,loadImage:xB,CanvasRenderingContext2D:LB,CanvasGradient:kB,CanvasPattern:MB,Image:Ou,ImageData:_B,Path2D:FB,DOMMatrix:OB,DOMRect:NB,DOMPoint:UB};const Uu=Ui({__proto__:null,default:rl(Nu)},[Nu]);return Object.defineProperty(ye,Symbol.toStringTag,{value:"Module"}),ye}({});
1756
+ `],Gt([J({type:String})],ye.DialogEmbed.prototype,"vouchId",2),Gt([J({type:String})],ye.DialogEmbed.prototype,"templateId",2),Gt([J({type:Array})],ye.DialogEmbed.prototype,"questions",2),Gt([J({type:String})],ye.DialogEmbed.prototype,"env",2),Gt([J({type:String})],ye.DialogEmbed.prototype,"apiKey",2),Gt([J({type:Boolean})],ye.DialogEmbed.prototype,"disableTracking",2),Gt([J({type:String})],ye.DialogEmbed.prototype,"trackingSource",2),Gt([J({type:Array})],ye.DialogEmbed.prototype,"controls",2),Gt([J({type:String})],ye.DialogEmbed.prototype,"preload",2),Gt([J({type:Boolean})],ye.DialogEmbed.prototype,"disableAutoplay",2),Gt([J({type:Number})],ye.DialogEmbed.prototype,"aspectRatio",2),ye.DialogEmbed=Gt([Tr("vouch-embed-dialog")],ye.DialogEmbed);function di(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function Vh(s,e){for(var t="",i=0,r=-1,n=0,o,a=0;a<=s.length;++a){if(a<s.length)o=s.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(r===a-1||n===1))if(r!==a-1&&n===2){if(t.length<2||i!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var A=t.lastIndexOf("/");if(A!==t.length-1){A===-1?(t="",i=0):(t=t.slice(0,A),i=t.length-1-t.lastIndexOf("/")),r=a,n=0;continue}}else if(t.length===2||t.length===1){t="",i=0,r=a,n=0;continue}}e&&(t.length>0?t+="/..":t="..",i=2)}else t.length>0?t+="/"+s.slice(r+1,a):t=s.slice(r+1,a),i=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return t}function Zv(s,e){var t=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+i:t+s+i:i}var Fs={resolve:function(){for(var e="",t=!1,i,r=arguments.length-1;r>=-1&&!t;r--){var n;r>=0?n=arguments[r]:(i===void 0&&(i=process.cwd()),n=i),di(n),n.length!==0&&(e=n+"/"+e,t=n.charCodeAt(0)===47)}return e=Vh(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(di(e),e.length===0)return".";var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return e=Vh(e,!t),e.length===0&&!t&&(e="."),e.length>0&&i&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return di(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var i=arguments[t];di(i),i.length>0&&(e===void 0?e=i:e+="/"+i)}return e===void 0?".":Fs.normalize(e)},relative:function(e,t){if(di(e),di(t),e===t||(e=Fs.resolve(e),t=Fs.resolve(t),e===t))return"";for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var r=e.length,n=r-i,o=1;o<t.length&&t.charCodeAt(o)===47;++o);for(var a=t.length,A=a-o,l=n<A?n:A,c=-1,u=0;u<=l;++u){if(u===l){if(A>l){if(t.charCodeAt(o+u)===47)return t.slice(o+u+1);if(u===0)return t.slice(o+u)}else n>l&&(e.charCodeAt(i+u)===47?c=u:u===0&&(c=0));break}var h=e.charCodeAt(i+u),d=t.charCodeAt(o+u);if(h!==d)break;h===47&&(c=u)}var g="";for(u=i+c+1;u<=r;++u)(u===r||e.charCodeAt(u)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+t.slice(o+c):(o+=c,t.charCodeAt(o)===47&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(di(e),e.length===0)return".";for(var t=e.charCodeAt(0),i=t===47,r=-1,n=!0,o=e.length-1;o>=1;--o)if(t=e.charCodeAt(o),t===47){if(!n){r=o;break}}else n=!1;return r===-1?i?"/":".":i&&r===1?"//":e.slice(0,r)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');di(e);var i=0,r=-1,n=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,A=-1;for(o=e.length-1;o>=0;--o){var l=e.charCodeAt(o);if(l===47){if(!n){i=o+1;break}}else A===-1&&(n=!1,A=o+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(r=o):(a=-1,r=A))}return i===r?r=A:r===-1&&(r=e.length),e.slice(i,r)}else{for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===47){if(!n){i=o+1;break}}else r===-1&&(n=!1,r=o+1);return r===-1?"":e.slice(i,r)}},extname:function(e){di(e);for(var t=-1,i=0,r=-1,n=!0,o=0,a=e.length-1;a>=0;--a){var A=e.charCodeAt(a);if(A===47){if(!n){i=a+1;break}continue}r===-1&&(n=!1,r=a+1),A===46?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===i+1?"":e.slice(t,r)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return Zv("/",e)},parse:function(e){di(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var i=e.charCodeAt(0),r=i===47,n;r?(t.root="/",n=1):n=0;for(var o=-1,a=0,A=-1,l=!0,c=e.length-1,u=0;c>=n;--c){if(i=e.charCodeAt(c),i===47){if(!l){a=c+1;break}continue}A===-1&&(l=!1,A=c+1),i===46?o===-1?o=c:u!==1&&(u=1):o!==-1&&(u=-1)}return o===-1||A===-1||u===0||u===1&&o===A-1&&o===a+1?A!==-1&&(a===0&&r?t.base=t.name=e.slice(1,A):t.base=t.name=e.slice(a,A)):(a===0&&r?(t.name=e.slice(1,o),t.base=e.slice(1,A)):(t.name=e.slice(a,o),t.base=e.slice(a,A)),t.ext=e.slice(o,A)),a>0?t.dir=e.slice(0,a-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};Fs.posix=Fs;var ey=Fs;const{basename:Jh,extname:ty}=ey;class iy{constructor(){let e=typeof Gr>"u",t="image/png",i="image/jpeg",r="image/jpeg",n="image/webp",o="application/pdf",a="image/svg+xml";Object.assign(this,{toMime:this.toMime.bind(this),fromMime:this.fromMime.bind(this),expected:e?'"png", "jpg", or "webp"':'"png", "jpg", "pdf", or "svg"',formats:e?{png:t,jpg:i,jpeg:r,webp:n}:{png:t,jpg:i,jpeg:r,pdf:o,svg:a},mimes:e?{[t]:"png",[i]:"jpg",[n]:"webp"}:{[t]:"png",[i]:"jpg",[o]:"pdf",[a]:"svg"}})}toMime(e){return this.formats[(e||"").replace(/^\./,"").toLowerCase()]}fromMime(e){return this.mimes[e]}}function sy(s,{filename:e="",extension:t="",format:f,page:r,quality:n,matte:o,density:a,outline:A,archive:d}={}){var{fromMime:c,toMime:u,expected:h}=new iy,d=d||"canvas",g=f||t.replace(/@\d+x$/i,"")||ty(e),f=c(u(g)||g),p=u(f),v=s.length;if(!g)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!f)throw new Error(`Unsupported file format "${g}" (expected ${h})`);if(!v)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let y,Q,m=e.replace(/{(\d*)}/g,(x,B)=>(Q=!0,B=parseInt(B,10),y=isFinite(B)?B:isFinite(y)?y:-1,"{}")),b=r>0?r-1:r<0?v+r:void 0;if(isFinite(b)&&b<0||b>=v)throw new RangeError(v==1?`Canvas only has a ‘page 1’ (${b} is out of bounds)`:`Canvas has pages 1–${v} (${b} is out of bounds)`);if(s=isFinite(b)?[s[b]]:Q||f=="pdf"?s:s.slice(-1),n===void 0)n=.92;else if(typeof n!="number"||!isFinite(n)||n<0||n>1)throw new TypeError("The quality option must be an number in the 0.0–1.0 range");if(a===void 0){let x=(t||Jh(e,g)).match(/@(\d+)x$/i);a=x?parseInt(x[1],10):1}else if(typeof a!="number"||!Number.isInteger(a)||a<1)throw new TypeError("The density option must be a non-negative integer");return A===void 0?A=!0:f=="svg"&&(A=!!A),{filename:e,pattern:m,format:f,mime:p,pages:s,padding:y,quality:n,matte:o,density:a,outline:A,archive:d}}class Jn{static for(e){return new Jn().append(e).get()}constructor(){this.crc=-1}get(){return~this.crc}append(e){for(var t=this.crc|0,i=this.table,r=0,n=e.length|0;r<n;r++)t=t>>>8^i[(t^e[r])&255];return this.crc=t,this}}Jn.prototype.table=(()=>{var s,e,t,i=[];for(s=0;s<256;s++){for(t=s,e=0;e<8;e++)t=t&1?t>>>1^3988292384:t>>>1;i[s]=t}return i})();function lA(s){let e=new Uint8Array(s),t=new DataView(e.buffer),i={array:e,view:t,size:s,set8(r,n){return t.setUint8(r,n),i},set16(r,n){return t.setUint16(r,n,!0),i},set32(r,n){return t.setUint32(r,n,!0),i},bytes(r,n){return e.set(n,r),i}};return i}const Wn=class Wn{constructor(e){let t=new Date;Object.assign(this,{directory:e,offset:0,files:[],time:(t.getHours()<<6|t.getMinutes())<<5|t.getSeconds()/2,date:(t.getFullYear()-1980<<4|t.getMonth()+1)<<5|t.getDate()}),this.add(e)}async add(e,t){let i=!t,r=Wn.encoder.encode(`${this.directory}/${i?"":e}`),n=new Uint8Array(i?0:await t.arrayBuffer()),o=30+r.length,a=o+n.length,A=16,{offset:l}=this,c=lA(26).set32(0,134742036).set16(6,this.time).set16(8,this.date).set32(10,Jn.for(n)).set32(14,n.length).set32(18,n.length).set16(22,r.length);l+=o;let u=lA(o+n.length+A).set32(0,67324752).bytes(4,c.array).bytes(30,r).bytes(o,n);l+=n.length,u.set32(a,134695760).bytes(a+4,c.array.slice(10,22)),l+=A,this.files.push({offset:l,folder:i,name:r,header:c,payload:u}),this.offset=l}toBuffer(){let e=this.files.reduce((u,{name:h})=>46+h.length+u,0),t=lA(e+22),i=0;for(var{offset:r,name:n,header:o,folder:a}of this.files)t.set32(i,33639248).set16(i+4,20).bytes(i+6,o.array).set8(i+38,a?16:0).set32(i+42,r).bytes(i+46,n),i+=46+n.length;t.set32(i,101010256).set16(i+8,this.files.length).set16(i+10,this.files.length).set32(i+12,e).set32(i+16,this.offset);let A=new Uint8Array(this.offset+t.size),l=0;for(var{payload:c}of this.files)A.set(c.array,l),l+=c.size;return A.set(t.array,l),A}get blob(){return new Blob([this.toBuffer()],{type:"application/zip"})}};Ad(Wn,"encoder",new TextEncoder);let cA=Wn;const uA=(s,e,t,i)=>{if(i){let{width:r,height:n}=s,o=Object.assign(document.createElement("canvas"),{width:r,height:n}),a=o.getContext("2d");a.fillStyle=i,a.fillRect(0,0,r,n),a.drawImage(s,0,0),s=o}return new Promise((r,n)=>s.toBlob(r,e,t))},ry=(...s)=>uA(...s).then(e=>e.arrayBuffer()),ny=async(s,e,t,i,r)=>{Wh(r,await uA(s,e,t,i))},oy=async(s,e,t,i,r,n,o)=>{let a=c=>n.replace("{}",String(c+1).padStart(o,"0")),A=Jh(r,".zip")||"archive",l=new cA(A);await Promise.all(s.map(async(c,u)=>{let h=a(u);await l.add(h,await uA(c,e,t,i))})),Wh(`${A}.zip`,l.blob)},Wh=(s,e)=>{const t=window.URL.createObjectURL(e),i=document.createElement("a");i.style.display="none",i.href=t,i.setAttribute("download",s),typeof i.download>"u"&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>window.URL.revokeObjectURL(t),100)};var ay={asBuffer:ry,asDownload:ny,asZipDownload:oy,atScale:(s,e,t)=>s.map(i=>{if(e==1&&!t)return i.canvas;let r=document.createElement("canvas"),n=r.getContext("2d"),o=i.canvas?i.canvas:i;return r.width=o.width*e,r.height=o.height*e,t&&(n.fillStyle=t,n.fillRect(0,0,r.width,r.height)),n.scale(e,e),n.drawImage(o,0,0),r}),options:sy};const{asBuffer:hA,asDownload:Ay,asZipDownload:ly,atScale:dA,options:gA}=ay,qh=Symbol.for("toDataURL"),cy=s=>{let e=Object.assign(new jh,{crossOrigin:"Anonymous",src:s});return e.decode().then(()=>e)};class uy{constructor(e,t){let i=document.createElement("canvas"),r=[];Object.defineProperty(i,"async",{value:!0,writable:!1,enumerable:!0});for(var[n,o]of Object.entries({png:()=>hA(i,"image/png"),jpg:()=>hA(i,"image/jpeg"),pages:()=>r.concat(i).map(a=>a.getContext("2d"))}))Object.defineProperty(i,n,{get:o});return Object.assign(i,{width:e,height:t,newPage(...a){var{width:l,height:c}=i,A=Object.assign(document.createElement("canvas"),{width:l,height:c});A.getContext("2d").drawImage(i,0,0),r.push(A);var[l,c]=a.length?a:[l,c];return Object.assign(i,{width:l,height:c}).getContext("2d")},saveAs(a,A){A=typeof A=="number"?{quality:A}:A;let l=gA(this.pages,{filename:a,...A}),{pattern:c,padding:u,mime:h,quality:d,matte:g,density:f,archive:p}=l,v=dA(l.pages,f);return u==null?Ay(v[0],h,d,g,a):ly(v,h,d,g,p,c,u)},toBuffer(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=gA(this.pages,{extension:a,...A}),{mime:c,quality:u,matte:h,pages:d,density:g}=l,f=dA(d,g,h)[0];return hA(f,c,u,h)},[qh]:i.toDataURL.bind(i),toDataURL(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=gA(this.pages,{extension:a,...A}),{mime:c,quality:u,matte:h,pages:d,density:g}=l,f=dA(d,g,h)[0],p=f[f===i?qh:"toDataURL"](c,u);return Promise.resolve(p)}})}}const{CanvasRenderingContext2D:hy,CanvasGradient:dy,CanvasPattern:gy,Image:jh,ImageData:fy,Path2D:py,DOMMatrix:Ey,DOMRect:Iy,DOMPoint:my}=window;var Xh={Canvas:uy,loadImage:cy,CanvasRenderingContext2D:hy,CanvasGradient:dy,CanvasPattern:gy,Image:jh,ImageData:fy,Path2D:py,DOMMatrix:Ey,DOMRect:Iy,DOMPoint:my};const zh=Ei({__proto__:null,default:El(Xh)},[Xh]);return Object.defineProperty(ye,Symbol.toStringTag,{value:"Module"}),ye}({});
1750
1757
  //# sourceMappingURL=embeds.iife.js.map