@vouchfor/embeds 3.0.2 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,22 +1,22 @@
1
- var dialogEmbed=function(Je){"use strict";var Ly=Object.defineProperty;var _y=(Je,Ei,Zt)=>Ei in Je?Ly(Je,Ei,{enumerable:!0,configurable:!0,writable:!0,value:Zt}):Je[Ei]=Zt;var ad=(Je,Ei,Zt)=>(_y(Je,typeof Ei!="symbol"?Ei+"":Ei,Zt),Zt);var zu;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"}))}/**
1
+ var dialogEmbed=function(We){"use strict";var Dy=Object.defineProperty;var Ly=(We,Ei,Zt)=>Ei in We?Dy(We,Ei,{enumerable:!0,configurable:!0,writable:!0,value:Zt}):We[Ei]=Zt;var ad=(We,Ei,Zt)=>(Ly(We,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 Zt=globalThis,Zn=Zt.ShadowRoot&&(Zt.ShadyCSS===void 0||Zt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,eo=Symbol(),mA=new WeakMap;let CA=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=mA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&mA.set(t,e))}return e}toString(){return this.cssText}};const Os=s=>new CA(typeof s=="string"?s:s+"",void 0,eo),ot=(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 CA(t,s,eo)},Ad=(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)}},vA=Zn?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(),mA=new WeakMap;let CA=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=mA.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&mA.set(t,e))}return e}toString(){return this.cssText}};const Os=s=>new CA(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 CA(t,s,eo)},Ad=(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)}},vA=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:ld,defineProperty:cd,getOwnPropertyDescriptor:hd,getOwnPropertyNames:ud,getOwnPropertySymbols:dd,getPrototypeOf:gd}=Object,Li=globalThis,yA=Li.trustedTypes,fd=yA?yA.emptyScript:"",to=Li.reactiveElementPolyfillSupport,Ps=(s,e)=>s,Sr={toAttribute(s,e){switch(e){case Boolean:s=s?fd: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}},wr=(s,e)=>!ld(s,e),BA={attribute:!0,type:String,converter:Sr,reflect:!1,hasChanged:wr};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=BA){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&&cd(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)??BA}static _$Ei(){if(this.hasOwnProperty(Ps("elementProperties")))return;const e=gd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ps("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ps("properties"))){const t=this.properties,i=[...ud(t),...dd(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(vA(r))}else e!==void 0&&t.push(vA(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 Ad(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:Sr).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:Sr;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??wr)(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[Ps("elementProperties")]=new Map,As[Ps("finalized")]=new Map,to==null||to({ReactiveElement:As}),(Li.reactiveElementVersions??(Li.reactiveElementVersions=[])).push("2.0.4");/**
9
+ */const{is:ld,defineProperty:cd,getOwnPropertyDescriptor:ud,getOwnPropertyNames:hd,getOwnPropertySymbols:dd,getPrototypeOf:gd}=Object,Li=globalThis,yA=Li.trustedTypes,fd=yA?yA.emptyScript:"",to=Li.reactiveElementPolyfillSupport,Ps=(s,e)=>s,Sr={toAttribute(s,e){switch(e){case Boolean:s=s?fd: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}},wr=(s,e)=>!ld(s,e),BA={attribute:!0,type:String,converter:Sr,reflect:!1,hasChanged:wr};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=BA){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&&cd(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=ud(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)??BA}static _$Ei(){if(this.hasOwnProperty(Ps("elementProperties")))return;const e=gd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ps("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ps("properties"))){const t=this.properties,i=[...hd(t),...dd(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(vA(r))}else e!==void 0&&t.push(vA(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 Ad(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:Sr).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:Sr;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??wr)(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[Ps("elementProperties")]=new Map,As[Ps("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
13
  */const Us=globalThis,Rr=Us.trustedTypes,QA=Rr?Rr.createPolicy("lit-html",{createHTML:s=>s}):void 0,io="$lit$",Ii=`lit$${(Math.random()+"").slice(9)}$`,so="?"+Ii,pd=`<${so}>`,Hi=document,Gs=()=>Hi.createComment(""),Hs=s=>s===null||typeof s!="object"&&typeof s!="function",bA=Array.isArray,SA=s=>bA(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",ro=`[
14
14
  \f\r]`,$s=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,wA=/-->/g,RA=/>/g,$i=RegExp(`>|${ro}(?:([^\\s"'>=/]+)(${ro}*=${ro}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),xA=/'/g,TA=/"/g,DA=/^(?:script|style|textarea|title)$/i,Ed=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),Ee=Ed(1),Yt=Symbol.for("lit-noChange"),Xe=Symbol.for("lit-nothing"),LA=new WeakMap,Yi=Hi.createTreeWalker(Hi,129);function _A(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return QA!==void 0?QA.createHTML(e):e}const kA=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":"",o=$s;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===$s?c[1]==="!--"?o=wA:c[1]!==void 0?o=RA:c[2]!==void 0?(DA.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=$i):c[3]!==void 0&&(o=$i):o===$i?c[0]===">"?(o=r??$s,h=-1):c[1]===void 0?h=-2:(h=o.lastIndex-c[2].length,l=c[1],o=c[3]===void 0?$i:c[3]==='"'?TA:xA):o===TA||o===xA?o=$i:o===wA||o===RA?o=$s:(o=$i,r=void 0);const d=o===$i&&s[a+1].startsWith("/>")?" ":"";n+=o===$s?A+pd:h>=0?(i.push(l),A.slice(0,h)+io+A.slice(h)+Ii+d):A+Ii+(h===-2?a:d)}return[_A(s,n+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};class Ys{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]=kA(e,t);if(this.el=Ys.createElement(l,i),Yi.currentNode=this.el.content,t===2){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=Yi.nextNode())!==null&&A.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(const h of r.getAttributeNames())if(h.endsWith(io)){const u=c[o++],d=r.getAttribute(h).split(Ii),g=/([.?@])?(.*)/.exec(u);A.push({type:1,index:n,name:g[2],strings:d,ctor:g[1]==="."?NA:g[1]==="?"?MA:g[1]==="@"?OA:Ks}),r.removeAttribute(h)}else h.startsWith(Ii)&&(A.push({type:6,index:n}),r.removeAttribute(h));if(DA.test(r.tagName)){const h=r.textContent.split(Ii),u=h.length-1;if(u>0){r.textContent=Rr?Rr.emptyScript:"";for(let d=0;d<u;d++)r.append(h[d],Gs()),Yi.nextNode(),A.push({type:2,index:++n});r.append(h[u],Gs())}}}else if(r.nodeType===8)if(r.data===so)A.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(Ii,h+1))!==-1;)A.push({type:7,index:n}),h+=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===Yt)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=Hs(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 FA{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 PA(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=Xe,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),Hs(e)?e===Xe||e==null||e===""?(this._$AH!==Xe&&this._$AR(),this._$AH=Xe):e!==this._$AH&&e!==Yt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):SA(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!==Xe&&Hs(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=Ys.createElement(_A(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 FA(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=LA.get(e.strings);return t===void 0&&LA.set(e.strings,t=new Ys(e)),t}k(e){bA(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(Gs()),this.S(Gs()),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=Xe,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=Xe}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(n===void 0)e=Ki(this,e,t,0),o=!Hs(e)||e!==this._$AH&&e!==Yt,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===Yt&&(l=this._$AH[A]),o||(o=!Hs(l)||l!==this._$AH[A]),l===Xe?e=Xe:e!==Xe&&(e+=(l??"")+n[A+1]),this._$AH[A]=l}o&&!r&&this.j(e)}j(e){e===Xe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class NA extends Ks{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Xe?void 0:e}}class MA extends Ks{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Xe)}}class OA extends Ks{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)??Xe)===Yt)return;const i=this._$AH,r=e===Xe&&i!==Xe||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Xe&&(i===Xe||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 PA{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 Id={P:io,A:Ii,C:so,M:1,L:kA,R:FA,D:SA,V:Ki,I:ls,H:Ks,N:MA,U:OA,B:NA,F:PA},no=Us.litHtmlPolyfillSupport;no==null||no(Ys,ls),(Us.litHtmlVersions??(Us.litHtmlVersions=[])).push("3.1.2");const md=(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(Gs(),n),n,void 0,t??{})}return r._$AI(s),r};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),xA=/'/g,TA=/"/g,DA=/^(?:script|style|textarea|title)$/i,Ed=s=>(e,...t)=>({_$litType$:s,strings:e,values:t}),pe=Ed(1),Yt=Symbol.for("lit-noChange"),ze=Symbol.for("lit-nothing"),LA=new WeakMap,Yi=Hi.createTreeWalker(Hi,129);function _A(s,e){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return QA!==void 0?QA.createHTML(e):e}const kA=(s,e)=>{const t=s.length-1,i=[];let r,n=e===2?"<svg>":"",o=$s;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===$s?c[1]==="!--"?o=wA:c[1]!==void 0?o=RA:c[2]!==void 0?(DA.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=$i):c[3]!==void 0&&(o=$i):o===$i?c[0]===">"?(o=r??$s,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]==='"'?TA:xA):o===TA||o===xA?o=$i:o===wA||o===RA?o=$s:(o=$i,r=void 0);const d=o===$i&&s[a+1].startsWith("/>")?" ":"";n+=o===$s?A+pd:u>=0?(i.push(l),A.slice(0,u)+io+A.slice(u)+Ii+d):A+Ii+(u===-2?a:d)}return[_A(s,n+(s[t]||"<?>")+(e===2?"</svg>":"")),i]};class Ys{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]=kA(e,t);if(this.el=Ys.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]==="."?NA:g[1]==="?"?MA:g[1]==="@"?OA:Ks}),r.removeAttribute(u)}else u.startsWith(Ii)&&(A.push({type:6,index:n}),r.removeAttribute(u));if(DA.test(r.tagName)){const u=r.textContent.split(Ii),h=u.length-1;if(h>0){r.textContent=Rr?Rr.emptyScript:"";for(let d=0;d<h;d++)r.append(u[d],Gs()),Yi.nextNode(),A.push({type:2,index:++n});r.append(u[h],Gs())}}}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===Yt)return e;let r=i!==void 0?(o=t._$Co)==null?void 0:o[i]:t._$Cl;const n=Hs(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 FA{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 PA(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),Hs(e)?e===ze||e==null||e===""?(this._$AH!==ze&&this._$AR(),this._$AH=ze):e!==this._$AH&&e!==Yt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):SA(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&&Hs(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=Ys.createElement(_A(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 FA(r,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=LA.get(e.strings);return t===void 0&&LA.set(e.strings,t=new Ys(e)),t}k(e){bA(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(Gs()),this.S(Gs()),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=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=!Hs(e)||e!==this._$AH&&e!==Yt,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===Yt&&(l=this._$AH[A]),o||(o=!Hs(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 NA extends Ks{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ze?void 0:e}}class MA extends Ks{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ze)}}class OA extends Ks{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)===Yt)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 PA{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 Id={P:io,A:Ii,C:so,M:1,L:kA,R:FA,D:SA,V:Ki,I:ls,H:Ks,N:MA,U:OA,B:NA,F:PA},no=Us.litHtmlPolyfillSupport;no==null||no(Ys,ls),(Us.litHtmlVersions??(Us.litHtmlVersions=[])).push("3.1.2");const md=(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(Gs(),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 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=md(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 Yt}};mi._$litElement$=!0,mi.finalized=!0,(zu=globalThis.litElementHydrateSupport)==null||zu.call(globalThis,{LitElement:mi});const oo=globalThis.litElementPolyfillSupport;oo==null||oo({LitElement:mi}),(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=md(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 Yt}};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
@@ -28,11 +28,11 @@ var dialogEmbed=function(Je){"use strict";var Ly=Object.defineProperty;var _y=(J
28
28
  * @license
29
29
  * Copyright 2017 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */function ze(s){return J({...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 Ze=s=>s??Xe;let Tr;const yd=new Uint8Array(16);function Bd(){if(!Tr&&(Tr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Tr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Tr(yd)}const gt=[];for(let s=0;s<256;++s)gt.push((s+256).toString(16).slice(1));function Qd(s,e=0){return gt[s[e+0]]+gt[s[e+1]]+gt[s[e+2]]+gt[s[e+3]]+"-"+gt[s[e+4]]+gt[s[e+5]]+"-"+gt[s[e+6]]+gt[s[e+7]]+"-"+gt[s[e+8]]+gt[s[e+9]]+"-"+gt[s[e+10]]+gt[s[e+11]]+gt[s[e+12]]+gt[s[e+13]]+gt[s[e+14]]+gt[s[e+15]]}const UA={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function _i(s,e,t){if(UA.randomUUID&&!e&&!s)return UA.randomUUID();s=s||{};const i=s.random||(s.rng||Bd)();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 Qd(i)}/**
35
+ */const et=s=>s??ze;let Tr;const yd=new Uint8Array(16);function Bd(){if(!Tr&&(Tr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Tr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Tr(yd)}const gt=[];for(let s=0;s<256;++s)gt.push((s+256).toString(16).slice(1));function Qd(s,e=0){return gt[s[e+0]]+gt[s[e+1]]+gt[s[e+2]]+gt[s[e+3]]+"-"+gt[s[e+4]]+gt[s[e+5]]+"-"+gt[s[e+6]]+gt[s[e+7]]+"-"+gt[s[e+8]]+gt[s[e+9]]+"-"+gt[s[e+10]]+gt[s[e+11]]+gt[s[e+12]]+gt[s[e+13]]+gt[s[e+14]]+gt[s[e+15]]}const UA={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function _i(s,e,t){if(UA.randomUUID&&!e&&!s)return UA.randomUUID();s=s||{};const i=s.random||(s.rng||Bd)();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 Qd(i)}/**
36
36
  * @license
37
37
  * Copyright 2020 Google LLC
38
38
  * SPDX-License-Identifier: BSD-3-Clause
@@ -40,7 +40,7 @@ var dialogEmbed=function(Je){"use strict";var Ly=Object.defineProperty;var _y=(J
40
40
  * @license
41
41
  * Copyright 2017 Google LLC
42
42
  * SPDX-License-Identifier: BSD-3-Clause
43
- */const cs={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},hs=s=>(...e)=>({_$litDirective$:s,values:e});let Js=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 Js=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
@@ -48,27 +48,27 @@ var dialogEmbed=function(Je){"use strict";var Ly=Object.defineProperty;var _y=(J
48
48
  * @license
49
49
  * Copyright 2020 Google LLC
50
50
  * SPDX-License-Identifier: BSD-3-Clause
51
- */const ft=()=>new _d;let _d=class{};const Ao=new WeakMap,pt=hs(class extends $A{render(s){return Xe}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)),Xe}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 kd(s,e,t){function i(r){t.dispatchEvent(new CustomEvent(r.type,r))}return e.addEventListener(s,i),()=>{e.removeEventListener(s,i)}}class Fd{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=ft(),this.host=e,this._events=t,e.addController(this)}register(){return pt(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(kd(e,this._forwardElementRef.value,this.host))})})}hostDisconnected(){this._cleanup.forEach(e=>{e()}),this._cleanup=[]}}/**
51
+ */const ft=()=>new _d;let _d=class{};const Ao=new WeakMap,pt=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 kd(s,e,t){function i(r){t.dispatchEvent(new CustomEvent(r.type,r))}return e.addEventListener(s,i),()=>{e.removeEventListener(s,i)}}class Fd{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=ft(),this.host=e,this._events=t,e.addController(this)}register(){return pt(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(kd(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 Nd=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??Md,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===Nd)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 Md=(s,e)=>s===e||s.length===e.length&&s.every((t,i)=>!wr(t,e[i])),YA="https://d2rxhdlm2q91uk.cloudfront.net",Od="https://d1ix11aj5kfygl.cloudfront.net",Pd="https://d157jlwnudd93d.cloudfront.net",KA="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",Ud="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",Gd="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",Hd="http://localhost:6060/v2",$d="https://embed-dev.vouchfor.com/v2",Yd="https://embed-staging.vouchfor.com/v2",Kd="https://embed.vouchfor.com/v2";function _r(s){if(!["local","dev","staging","prod"].includes(s))throw new Error(`Unknown environment: ${s}`);if(s==="local")return{videoUrl:YA,publicApiUrl:KA,embedApiUrl:Hd};if(s==="dev")return{videoUrl:YA,publicApiUrl:KA,embedApiUrl:$d};if(s==="staging")return{videoUrl:Od,publicApiUrl:Ud,embedApiUrl:Yd};if(s==="prod")return{videoUrl:Pd,publicApiUrl:Gd,embedApiUrl:Kd}}class Vd{constructor(e){this._fetching=!1,this.getVouch=async(t,i,r)=>{var c;const{embedApiUrl:n}=_r(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}=_r(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 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 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 Jd=(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);!Wd(r,n)&&i||Object.defineProperty(s,t,n)},Wd=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)},qd=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},jd=(s,e)=>`/* Wrapped ${s}*/
56
- ${e}`,Xd=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),zd=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Zd=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=jd.bind(null,i,e.toString());Object.defineProperty(r,"name",zd);const{writable:n,enumerable:o,configurable:a}=Xd;Object.defineProperty(s,"toString",{value:r,writable:n,enumerable:o,configurable:a})};function eg(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Jd(s,e,r,t);return qd(s,e),Zd(s,e,i),s}const tg=new WeakMap,VA=new WeakMap;function lo(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=VA.get(s)??new Set;h.add(c),VA.set(s,h)}return A};return eg(r,s,{ignoreNonConfigurable:!0}),tg.set(r,t),r}var JA=function(){};const ig=(s,e,t)=>Math.min(Math.max(t,s),e),WA=(s,e,t)=>{const i=e-s;return i===0?1:(t-s)/i},co=(s,e,t)=>-t*s+t*e+s,qA=(s,e)=>t=>Math.max(Math.min(t,e),s),qs=s=>s%1?Number(s.toFixed(5)):s,kr=/(-)?([\d]*\.?[\d])+/g,ho=/(#[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,sg=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function js(s){return typeof s=="string"}const Fr={test:s=>typeof s=="number",parse:parseFloat,transform:s=>s},jA=Object.assign(Object.assign({},Fr),{transform:qA(0,1)});Object.assign(Object.assign({},Fr),{default:1});const Xs=(s=>({test:e=>js(e)&&e.endsWith(s)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${s}`}))("%");Object.assign(Object.assign({},Xs),{parse:s=>Xs.parse(s)/100,transform:s=>Xs.transform(s*100)});const uo=(s,e)=>t=>!!(js(t)&&sg.test(t)&&t.startsWith(s)||e&&Object.prototype.hasOwnProperty.call(t,e)),XA=(s,e,t)=>i=>{if(!js(i))return i;const[r,n,o,a]=i.match(kr);return{[s]:parseFloat(r),[e]:parseFloat(n),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Ji={test:uo("hsl","hue"),parse:XA("hue","saturation","lightness"),transform:({hue:s,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(s)+", "+Xs.transform(qs(e))+", "+Xs.transform(qs(t))+", "+qs(jA.transform(i))+")"},rg=qA(0,255),go=Object.assign(Object.assign({},Fr),{transform:s=>Math.round(rg(s))}),ki={test:uo("rgb","red"),parse:XA("red","green","blue"),transform:({red:s,green:e,blue:t,alpha:i=1})=>"rgba("+go.transform(s)+", "+go.transform(e)+", "+go.transform(t)+", "+qs(jA.transform(i))+")"};function ng(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 fo={test:uo("#"),parse:ng,transform:ki.transform},Nr={test:s=>ki.test(s)||fo.test(s)||Ji.test(s),parse:s=>ki.test(s)?ki.parse(s):Ji.test(s)?Ji.parse(s):fo.parse(s),transform:s=>js(s)?s:s.hasOwnProperty("red")?ki.transform(s):Ji.transform(s)},zA="${c}",ZA="${n}";function og(s){var e,t,i,r;return isNaN(s)&&js(s)&&((t=(e=s.match(kr))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((r=(i=s.match(ho))===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0)>0}function el(s){typeof s=="number"&&(s=`${s}`);const e=[];let t=0;const i=s.match(ho);i&&(t=i.length,s=s.replace(ho,zA),e.push(...i.map(Nr.parse)));const r=s.match(kr);return r&&(s=s.replace(kr,ZA),e.push(...r.map(Fr.parse))),{values:e,numColors:t,tokenised:s}}function tl(s){return el(s).values}function il(s){const{values:e,numColors:t,tokenised:i}=el(s),r=e.length;return n=>{let o=i;for(let a=0;a<r;a++)o=o.replace(a<t?zA:ZA,a<t?Nr.transform(n[a]):qs(n[a]));return o}}const ag=s=>typeof s=="number"?0:s;function Ag(s){const e=tl(s);return il(s)(e.map(ag))}const sl={test:og,parse:tl,createTransformer:il,getAnimatableNone:Ag};function po(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 rl({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=po(A,a,s+.3333333333333333),n=po(A,a,s),o=po(A,a,s-.3333333333333333)}return{red:Math.round(r*255),green:Math.round(n*255),blue:Math.round(o*255),alpha:i}}const lg=(s,e,t)=>{const i=s*s,r=e*e;return Math.sqrt(Math.max(0,t*(r-i)+i))},cg=[fo,ki,Ji],nl=s=>cg.find(e=>e.test(s)),ol=(s,e)=>{let t=nl(s),i=nl(e),r=t.parse(s),n=i.parse(e);t===Ji&&(r=rl(r),t=ki),i===Ji&&(n=rl(n),i=ki);const o=Object.assign({},r);return a=>{for(const A in o)A!=="alpha"&&(o[A]=lg(r[A],n[A],a));return o.alpha=co(r.alpha,n.alpha,a),t.transform(o)}},hg=s=>typeof s=="number",ug=(s,e)=>t=>e(s(t)),al=(...s)=>s.reduce(ug);function Al(s,e){return hg(s)?t=>co(s,e,t):Nr.test(s)?ol(s,e):hl(s,e)}const ll=(s,e)=>{const t=[...s],i=t.length,r=s.map((n,o)=>Al(n,e[o]));return n=>{for(let o=0;o<i;o++)t[o]=r[o](n);return t}},dg=(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]=Al(s[r],e[r]));return r=>{for(const n in i)t[n]=i[n](r);return t}};function cl(s){const e=sl.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=sl.createTransformer(e),i=cl(s),r=cl(e);return i.numHSL===r.numHSL&&i.numRGB===r.numRGB&&i.numNumbers>=r.numNumbers?al(ll(i.parsed,r.parsed),t):o=>`${o>0?e:s}`},gg=(s,e)=>t=>co(s,e,t);function fg(s){if(typeof s=="number")return gg;if(typeof s=="string")return Nr.test(s)?ol:hl;if(Array.isArray(s))return ll;if(typeof s=="object")return dg}function pg(s,e,t){const i=[],r=t||fg(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 Eg([s,e],[t]){return i=>t(WA(s,e,i))}function Ig(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=WA(s[n],s[n+1],r);return e[n](a)}}function mg(s,e,{clamp:t=!0,ease:i,mixer:r}={}){const n=s.length;JA(n===e.length),JA(!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=pg(e,i,r),a=n===2?Eg(s,o):Ig(s,o);return t?A=>a(ig(s[0],s[n-1],A)):a}const Mr=s=>e=>1-s(1-e),Eo=s=>e=>e<=.5?s(2*e)/2:(2-s(2*(1-e)))/2,Cg=s=>e=>Math.pow(e,s),ul=s=>e=>e*e*((s+1)*e-s),vg=s=>{const e=ul(s);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},dl=1.525,yg=4/11,Bg=8/11,Qg=9/10,bg=s=>s,Io=Cg(2),Sg=Mr(Io),wg=Eo(Io),gl=s=>1-Math.sin(Math.acos(s)),fl=Mr(gl),Rg=Eo(fl),mo=ul(dl),xg=Mr(mo),Tg=Eo(mo),Dg=vg(dl),Lg=4356/361,_g=35442/1805,kg=16061/1805,Or=s=>{if(s===1||s===0)return s;const e=s*s;return s<yg?7.5625*e:s<Bg?9.075*e-9.9*s+3.4:s<Qg?Lg*e-_g*s+kg:10.8*s*s-20.52*s+10.72},Fg=Mr(Or),Ng=s=>s<.5?.5*(1-Or(1-s*2)):.5*Or(s*2-1)+.5;var Pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pl(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)})(Pr,function(t){function i(x){var w,T,$=new Error(x);return w=$,T=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(w,T):w.__proto__=T,$}function r(x,w,T){var $=w.slice(0,T).split(/\n/),U=$.length,j=$[U-1].length+1;throw i(x+=" at line "+U+" col "+j+`:
55
+ */const Nd=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??Md,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===Nd)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 Md=(s,e)=>s===e||s.length===e.length&&s.every((t,i)=>!wr(t,e[i])),YA="https://d2rxhdlm2q91uk.cloudfront.net",Od="https://d1ix11aj5kfygl.cloudfront.net",Pd="https://d157jlwnudd93d.cloudfront.net",KA="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",Ud="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",Gd="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",Hd="http://localhost:6060/v2",$d="https://embed-dev.vouchfor.com/v2",Yd="https://embed-staging.vouchfor.com/v2",Kd="https://embed.vouchfor.com/v2";function _r(s){if(!["local","dev","staging","prod"].includes(s))throw new Error(`Unknown environment: ${s}`);if(s==="local")return{videoUrl:YA,publicApiUrl:KA,embedApiUrl:Hd};if(s==="dev")return{videoUrl:YA,publicApiUrl:KA,embedApiUrl:$d};if(s==="staging")return{videoUrl:Od,publicApiUrl:Ud,embedApiUrl:Yd};if(s==="prod")return{videoUrl:Pd,publicApiUrl:Gd,embedApiUrl:Kd}}class Vd{constructor(e){this._fetching=!1,this.getVouch=async(t,i,r)=>{var c;const{embedApiUrl:n}=_r(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}=_r(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 Jd=(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);!Wd(r,n)&&i||Object.defineProperty(s,t,n)},Wd=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)},qd=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},jd=(s,e)=>`/* Wrapped ${s}*/
56
+ ${e}`,Xd=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),zd=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Zd=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=jd.bind(null,i,e.toString());Object.defineProperty(r,"name",zd);const{writable:n,enumerable:o,configurable:a}=Xd;Object.defineProperty(s,"toString",{value:r,writable:n,enumerable:o,configurable:a})};function eg(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Jd(s,e,r,t);return qd(s,e),Zd(s,e,i),s}const tg=new WeakMap,VA=new WeakMap;function lo(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=VA.get(s)??new Set;u.add(c),VA.set(s,u)}return A};return eg(r,s,{ignoreNonConfigurable:!0}),tg.set(r,t),r}var JA=function(){};const ig=(s,e,t)=>Math.min(Math.max(t,s),e),WA=(s,e,t)=>{const i=e-s;return i===0?1:(t-s)/i},co=(s,e,t)=>-t*s+t*e+s,qA=(s,e)=>t=>Math.max(Math.min(t,e),s),qs=s=>s%1?Number(s.toFixed(5)):s,kr=/(-)?([\d]*\.?[\d])+/g,uo=/(#[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,sg=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function js(s){return typeof s=="string"}const Fr={test:s=>typeof s=="number",parse:parseFloat,transform:s=>s},jA=Object.assign(Object.assign({},Fr),{transform:qA(0,1)});Object.assign(Object.assign({},Fr),{default:1});const Xs=(s=>({test:e=>js(e)&&e.endsWith(s)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${s}`}))("%");Object.assign(Object.assign({},Xs),{parse:s=>Xs.parse(s)/100,transform:s=>Xs.transform(s*100)});const ho=(s,e)=>t=>!!(js(t)&&sg.test(t)&&t.startsWith(s)||e&&Object.prototype.hasOwnProperty.call(t,e)),XA=(s,e,t)=>i=>{if(!js(i))return i;const[r,n,o,a]=i.match(kr);return{[s]:parseFloat(r),[e]:parseFloat(n),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Ji={test:ho("hsl","hue"),parse:XA("hue","saturation","lightness"),transform:({hue:s,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(s)+", "+Xs.transform(qs(e))+", "+Xs.transform(qs(t))+", "+qs(jA.transform(i))+")"},rg=qA(0,255),go=Object.assign(Object.assign({},Fr),{transform:s=>Math.round(rg(s))}),ki={test:ho("rgb","red"),parse:XA("red","green","blue"),transform:({red:s,green:e,blue:t,alpha:i=1})=>"rgba("+go.transform(s)+", "+go.transform(e)+", "+go.transform(t)+", "+qs(jA.transform(i))+")"};function ng(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 fo={test:ho("#"),parse:ng,transform:ki.transform},Nr={test:s=>ki.test(s)||fo.test(s)||Ji.test(s),parse:s=>ki.test(s)?ki.parse(s):Ji.test(s)?Ji.parse(s):fo.parse(s),transform:s=>js(s)?s:s.hasOwnProperty("red")?ki.transform(s):Ji.transform(s)},zA="${c}",ZA="${n}";function og(s){var e,t,i,r;return isNaN(s)&&js(s)&&((t=(e=s.match(kr))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((r=(i=s.match(uo))===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0)>0}function el(s){typeof s=="number"&&(s=`${s}`);const e=[];let t=0;const i=s.match(uo);i&&(t=i.length,s=s.replace(uo,zA),e.push(...i.map(Nr.parse)));const r=s.match(kr);return r&&(s=s.replace(kr,ZA),e.push(...r.map(Fr.parse))),{values:e,numColors:t,tokenised:s}}function tl(s){return el(s).values}function il(s){const{values:e,numColors:t,tokenised:i}=el(s),r=e.length;return n=>{let o=i;for(let a=0;a<r;a++)o=o.replace(a<t?zA:ZA,a<t?Nr.transform(n[a]):qs(n[a]));return o}}const ag=s=>typeof s=="number"?0:s;function Ag(s){const e=tl(s);return il(s)(e.map(ag))}const sl={test:og,parse:tl,createTransformer:il,getAnimatableNone:Ag};function po(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 rl({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=po(A,a,s+.3333333333333333),n=po(A,a,s),o=po(A,a,s-.3333333333333333)}return{red:Math.round(r*255),green:Math.round(n*255),blue:Math.round(o*255),alpha:i}}const lg=(s,e,t)=>{const i=s*s,r=e*e;return Math.sqrt(Math.max(0,t*(r-i)+i))},cg=[fo,ki,Ji],nl=s=>cg.find(e=>e.test(s)),ol=(s,e)=>{let t=nl(s),i=nl(e),r=t.parse(s),n=i.parse(e);t===Ji&&(r=rl(r),t=ki),i===Ji&&(n=rl(n),i=ki);const o=Object.assign({},r);return a=>{for(const A in o)A!=="alpha"&&(o[A]=lg(r[A],n[A],a));return o.alpha=co(r.alpha,n.alpha,a),t.transform(o)}},ug=s=>typeof s=="number",hg=(s,e)=>t=>e(s(t)),al=(...s)=>s.reduce(hg);function Al(s,e){return ug(s)?t=>co(s,e,t):Nr.test(s)?ol(s,e):ul(s,e)}const ll=(s,e)=>{const t=[...s],i=t.length,r=s.map((n,o)=>Al(n,e[o]));return n=>{for(let o=0;o<i;o++)t[o]=r[o](n);return t}},dg=(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]=Al(s[r],e[r]));return r=>{for(const n in i)t[n]=i[n](r);return t}};function cl(s){const e=sl.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 ul=(s,e)=>{const t=sl.createTransformer(e),i=cl(s),r=cl(e);return i.numHSL===r.numHSL&&i.numRGB===r.numRGB&&i.numNumbers>=r.numNumbers?al(ll(i.parsed,r.parsed),t):o=>`${o>0?e:s}`},gg=(s,e)=>t=>co(s,e,t);function fg(s){if(typeof s=="number")return gg;if(typeof s=="string")return Nr.test(s)?ol:ul;if(Array.isArray(s))return ll;if(typeof s=="object")return dg}function pg(s,e,t){const i=[],r=t||fg(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 Eg([s,e],[t]){return i=>t(WA(s,e,i))}function Ig(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=WA(s[n],s[n+1],r);return e[n](a)}}function mg(s,e,{clamp:t=!0,ease:i,mixer:r}={}){const n=s.length;JA(n===e.length),JA(!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=pg(e,i,r),a=n===2?Eg(s,o):Ig(s,o);return t?A=>a(ig(s[0],s[n-1],A)):a}const Mr=s=>e=>1-s(1-e),Eo=s=>e=>e<=.5?s(2*e)/2:(2-s(2*(1-e)))/2,Cg=s=>e=>Math.pow(e,s),hl=s=>e=>e*e*((s+1)*e-s),vg=s=>{const e=hl(s);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},dl=1.525,yg=4/11,Bg=8/11,Qg=9/10,bg=s=>s,Io=Cg(2),Sg=Mr(Io),wg=Eo(Io),gl=s=>1-Math.sin(Math.acos(s)),fl=Mr(gl),Rg=Eo(fl),mo=hl(dl),xg=Mr(mo),Tg=Eo(mo),Dg=vg(dl),Lg=4356/361,_g=35442/1805,kg=16061/1805,Or=s=>{if(s===1||s===0)return s;const e=s*s;return s<yg?7.5625*e:s<Bg?9.075*e-9.9*s+3.4:s<Qg?Lg*e-_g*s+kg:10.8*s*s-20.52*s+10.72},Fg=Mr(Or),Ng=s=>s<.5?.5*(1-Or(1-s*2)):.5*Or(s*2-1)+.5;var Pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pl(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)})(Pr,function(t){function i(S){var w,T,Y=new Error(S);return w=Y,T=i.prototype,Object.setPrototypeOf?Object.setPrototypeOf(w,T):w.__proto__=T,Y}function r(S,w,T){var Y=w.slice(0,T).split(/\n/),U=Y.length,q=Y[U-1].length+1;throw i(S+=" at line "+U+" col "+q+`:
57
57
 
58
58
  `+w.split(/\n/)[U-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(x){if(!(x instanceof SyntaxError))throw x}function a(x,w){return Object.prototype.hasOwnProperty.call(x,w)}function A(x,w,T){for(var $ in w)a(w,$)&&(w[$]==null||typeof w[$]!="object"||$!=="storage"&&$!=="prefixes"||T?x[$]=w[$]:x[$]=A({},w[$]));return x}var l=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,h=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,u=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function g(x){return d.test(x)?x.replace(d,"\\$&"):x}function f(x,w){w.rmWhitespace&&(x=x.replace(/[\r\n]+/g,`
60
- `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,h.lastIndex=0,u.lastIndex=0;var T=w.prefixes,$=[T.h,T.b,T.i,T.r,T.c,T.e].reduce(function(ne,fe){return ne&&fe?ne+"|"+g(fe):fe?g(fe):ne},""),U=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+g(w.tags[1])+")","g"),j=new RegExp("([^]*?)"+g(w.tags[0])+"(-|_)?\\s*("+$+")?\\s*","g"),ie=0,he=!1;function re(ne,fe){var Ce,ue={f:[]},le=0,ae="c";function we(je){var dt=x.slice(ie,je),rt=dt.trim();if(ae==="f")rt==="safe"?ue.raw=!0:w.async&&l.test(rt)?(rt=rt.replace(l,""),ue.f.push([rt,"",!0])):ue.f.push([rt,""]);else if(ae==="fp")ue.f[ue.f.length-1][1]+=rt;else if(ae==="err"){if(rt){var yt=dt.search(/\S/);r("invalid syntax",x,ie+yt)}}else ue[ae]=rt;ie=je+1}for(fe==="h"||fe==="b"||fe==="c"?ae="n":fe==="r"&&(ue.raw=!0,fe="i"),U.lastIndex=ie;(Ce=U.exec(x))!==null;){var ke=Ce[1],xe=Ce[2],Fe=Ce[3],Ue=Ce[4],Le=Ce[5],Se=Ce.index;if(ke)ke==="("?(le===0&&(ae==="n"?(we(Se),ae="p"):ae==="f"&&(we(Se),ae="fp")),le++):ke===")"?--le===0&&ae!=="c"&&(we(Se),ae="err"):le===0&&ke==="|"?(we(Se),ae="f"):ke==="=>"&&(we(Se),ie+=1,ae="res");else if(xe)if(xe==="/*"){var Ke=x.indexOf("*/",U.lastIndex);Ke===-1&&r("unclosed comment",x,Ce.index),U.lastIndex=Ke+2}else xe==="'"?(h.lastIndex=Ce.index,h.exec(x)?U.lastIndex=h.lastIndex:r("unclosed string",x,Ce.index)):xe==='"'?(u.lastIndex=Ce.index,u.exec(x)?U.lastIndex=u.lastIndex:r("unclosed string",x,Ce.index)):xe==="`"&&(c.lastIndex=Ce.index,c.exec(x)?U.lastIndex=c.lastIndex:r("unclosed string",x,Ce.index));else if(Fe)return we(Se),ie=Se+Ce[0].length,j.lastIndex=ie,he=Le,Ue&&fe==="h"&&(fe="s"),ue.t=fe,ue}return r("unclosed tag",x,ne),ue}var ve=function ne(fe,Ce){fe.b=[],fe.d=[];var ue,le=!1,ae=[];function we(yt,Ri){yt&&(yt=function(Bt,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"?Bt.trim():(mt==="_"||mt==="slurp"?Bt=String.prototype.trimLeft?Bt.trimLeft():Bt.replace(/^[\s\uFEFF\xA0]+/,""):mt!=="-"&&mt!=="nl"||(Bt=Bt.replace(/^(?:\n|\r|\r\n)/,"")),Y==="_"||Y==="slurp"?Bt=String.prototype.trimRight?Bt.trimRight():Bt.replace(/[\s\uFEFF\xA0]+$/,""):Y!=="-"&&Y!=="nl"||(Bt=Bt.replace(/(?:\n|\r|\r\n)$/,"")),Bt)}(yt,w,he,Ri))&&(yt=yt.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),ae.push(yt))}for(;(ue=j.exec(x))!==null;){var ke,xe=ue[1],Fe=ue[2],Ue=ue[3]||"";for(var Le in T)if(T[Le]===Ue){ke=Le;break}we(xe,Fe),ie=ue.index+ue[0].length,ke||r("unrecognized tag type: "+Ue,x,ie);var Se=re(ue.index,ke),Ke=Se.t;if(Ke==="h"){var je=Se.n||"";w.async&&l.test(je)&&(Se.a=!0,Se.n=je.replace(l,"")),Se=ne(Se),ae.push(Se)}else if(Ke==="c"){if(fe.n===Se.n)return le?(le.d=ae,fe.b.push(le)):fe.d=ae,fe;r("Helper start and end don't match",x,ue.index+ue[0].length)}else if(Ke==="b"){le?(le.d=ae,fe.b.push(le)):fe.d=ae;var dt=Se.n||"";w.async&&l.test(dt)&&(Se.a=!0,Se.n=dt.replace(l,"")),le=Se,ae=[]}else if(Ke==="s"){var rt=Se.n||"";w.async&&l.test(rt)&&(Se.a=!0,Se.n=rt.replace(l,"")),ae.push(Se)}else ae.push(Se)}if(!Ce)throw i('unclosed helper "'+fe.n+'"');return we(x.slice(ie,x.length),!1),fe.d=ae,fe}({f:[]},!0);if(w.plugins)for(var Qe=0;Qe<w.plugins.length;Qe++){var be=w.plugins[Qe];be.processAST&&(ve.d=be.processAST(ve.d,w))}return ve.d}function p(x,w){var T=f(x,w),$="var tR='';"+(w.useWith?"with("+w.varName+"||{}){":"")+Q(T,w)+"if(cb){cb(null,tR)} return tR"+(w.useWith?"}":"");if(w.plugins)for(var U=0;U<w.plugins.length;U++){var j=w.plugins[U];j.processFnString&&($=j.processFnString($,w))}return $}function v(x,w){for(var T=0;T<w.length;T++){var $=w[T][0],U=w[T][1];x=(w[T][2]?"await ":"")+"c.l('F','"+$+"')("+x,U&&(x+=","+U),x+=")"}return x}function y(x,w,T,$,U,j){var ie="{exec:"+(U?"async ":"")+C(T,w,x)+",params:["+$+"]";return j&&(ie+=",name:'"+j+"'"),U&&(ie+=",async:true"),ie+="}"}function b(x,w){for(var T="[",$=0;$<x.length;$++){var U=x[$];T+=y(w,U.res||"",U.d,U.p||"",U.a,U.n),$<x.length&&(T+=",")}return T+="]"}function C(x,w,T){return"function("+w+"){var tR='';"+Q(x,T)+"return tR}"}function Q(x,w){for(var T=0,$=x.length,U="";T<$;T++){var j=x[T];if(typeof j=="string")U+="tR+='"+j+"';";else{var ie=j.t,he=j.c||"",re=j.f,ve=j.n||"",Qe=j.p||"",be=j.res||"",ne=j.b,fe=!!j.a;if(ie==="i"){w.defaultFilter&&(he="c.l('F','"+w.defaultFilter+"')("+he+")");var Ce=v(he,re);!j.raw&&w.autoEscape&&(Ce="c.l('F','e')("+Ce+")"),U+="tR+="+Ce+";"}else if(ie==="h")if(w.storage.nativeHelpers.get(ve))U+=w.storage.nativeHelpers.get(ve)(j,w);else{var ue=(fe?"await ":"")+"c.l('H','"+ve+"')("+y(w,be,j.d,Qe,fe);ue+=ne?","+b(ne,w):",[]",U+="tR+="+v(ue+=",c)",re)+";"}else ie==="s"?U+="tR+="+v((fe?"await ":"")+"c.l('H','"+ve+"')({params:["+Qe+"]},[],c)",re)+";":ie==="e"&&(U+=he+`
61
- `)}}return U}var B=function(){function x(w){this.cache=w}return x.prototype.define=function(w,T){this.cache[w]=T},x.prototype.get=function(w){return this.cache[w]},x.prototype.remove=function(w){delete this.cache[w]},x.prototype.reset=function(){this.cache={}},x.prototype.load=function(w){A(this.cache,w,!0)},x}();function L(x,w,T,$){if(w&&w.length>0)throw i(($?"Native":"")+"Helper '"+x+"' doesn't accept blocks");if(T&&T.length>0)throw i(($?"Native":"")+"Helper '"+x+"' doesn't accept filters")}var _={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function K(x){return _[x]}var k=new B({}),O=new B({each:function(x,w){var T="",$=x.params[0];if(L("each",w,!1),x.async)return new Promise(function(j){(function ie(he,re,ve,Qe,be){ve(he[re],re).then(function(ne){Qe+=ne,re===he.length-1?be(Qe):ie(he,re+1,ve,Qe,be)})})($,0,x.exec,T,j)});for(var U=0;U<$.length;U++)T+=x.exec($[U],U);return T},foreach:function(x,w){var T=x.params[0];if(L("foreach",w,!1),x.async)return new Promise(function(j){(function ie(he,re,ve,Qe,be,ne){Qe(re[ve],he[re[ve]]).then(function(fe){be+=fe,ve===re.length-1?ne(be):ie(he,re,ve+1,Qe,be,ne)})})(T,Object.keys(T),0,x.exec,"",j)});var $="";for(var U in T)a(T,U)&&($+=x.exec(U,T[U]));return $},include:function(x,w,T){L("include",w,!1);var $=T.storage.templates.get(x.params[0]);if(!$)throw i('Could not fetch template "'+x.params[0]+'"');return $(x.params[1],T)},extends:function(x,w,T){var $=x.params[1]||{};$.content=x.exec();for(var U=0;U<w.length;U++){var j=w[U];$[j.name]=j.exec()}var ie=T.storage.templates.get(x.params[0]);if(!ie)throw i('Could not fetch template "'+x.params[0]+'"');return ie($,T)},useScope:function(x,w){return L("useScope",w,!1),x.exec(x.params[0])}}),X=new B({if:function(x,w){L("if",!1,x.f,!0);var T="if("+x.p+"){"+Q(x.d,w)+"}";if(x.b)for(var $=0;$<x.b.length;$++){var U=x.b[$];U.n==="else"?T+="else{"+Q(U.d,w)+"}":U.n==="elif"&&(T+="else if("+U.p+"){"+Q(U.d,w)+"}")}return T},try:function(x,w){if(L("try",!1,x.f,!0),!x.b||x.b.length!==1||x.b[0].n!=="catch")throw i("native helper 'try' only accepts 1 block, 'catch'");var T="try{"+Q(x.d,w)+"}",$=x.b[0];return T+="catch"+($.res?"("+$.res+")":"")+"{"+Q($.d,w)+"}"},block:function(x,w){return L("block",x.b,x.f,!0),"if(!"+w.varName+"["+x.p+"]){tR+=("+C(x.d,"",w)+")()}else{tR+="+w.varName+"["+x.p+"]}"}}),V=new B({e:function(x){var w=String(x);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,K):w}}),q={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(x,w){if(x==="H"){var T=this.storage.helpers.get(w);if(T)return T;throw i("Can't find helper '"+w+"'")}if(x==="F"){var $=this.storage.filters.get(w);if($)return $;throw i("Can't find filter '"+w+"'")}},async:!1,storage:{helpers:O,nativeHelpers:X,filters:V,templates:k},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function S(x,w){var T={};return A(T,q),w&&A(T,w),x&&A(T,x),T.l.bind(T),T}function R(x,w){var T=S(w||{}),$=Function;if(T.async){if(!o)throw i("This environment doesn't support async/await");$=o}try{return new $(T.varName,"c","cb",p(x,T))}catch(U){throw U instanceof SyntaxError?i(`Bad template syntax
59
+ `+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(S){if(!(S instanceof SyntaxError))throw S}function a(S,w){return Object.prototype.hasOwnProperty.call(S,w)}function A(S,w,T){for(var Y in w)a(w,Y)&&(w[Y]==null||typeof w[Y]!="object"||Y!=="storage"&&Y!=="prefixes"||T?S[Y]=w[Y]:S[Y]=A({},w[Y]));return S}var l=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,u=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,h=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function g(S){return d.test(S)?S.replace(d,"\\$&"):S}function f(S,w){w.rmWhitespace&&(S=S.replace(/[\r\n]+/g,`
60
+ `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,u.lastIndex=0,h.lastIndex=0;var T=w.prefixes,Y=[T.h,T.b,T.i,T.r,T.c,T.e].reduce(function(oe,de){return oe&&de?oe+"|"+g(de):de?g(de):oe},""),U=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+g(w.tags[1])+")","g"),q=new RegExp("([^]*?)"+g(w.tags[0])+"(-|_)?\\s*("+Y+")?\\s*","g"),se=0,ce=!1;function ne(oe,de){var Be,ve={f:[]},ge=0,te="c";function Se(Xe){var nt=S.slice(se,Xe),Ve=nt.trim();if(te==="f")Ve==="safe"?ve.raw=!0:w.async&&l.test(Ve)?(Ve=Ve.replace(l,""),ve.f.push([Ve,"",!0])):ve.f.push([Ve,""]);else if(te==="fp")ve.f[ve.f.length-1][1]+=Ve;else if(te==="err"){if(Ve){var yt=nt.search(/\S/);r("invalid syntax",S,se+yt)}}else ve[te]=Ve;se=Xe+1}for(de==="h"||de==="b"||de==="c"?te="n":de==="r"&&(ve.raw=!0,de="i"),U.lastIndex=se;(Be=U.exec(S))!==null;){var xe=Be[1],Oe=Be[2],Te=Be[3],Fe=Be[4],ke=Be[5],Ce=Be.index;if(xe)xe==="("?(ge===0&&(te==="n"?(Se(Ce),te="p"):te==="f"&&(Se(Ce),te="fp")),ge++):xe===")"?--ge===0&&te!=="c"&&(Se(Ce),te="err"):ge===0&&xe==="|"?(Se(Ce),te="f"):xe==="=>"&&(Se(Ce),se+=1,te="res");else if(Oe)if(Oe==="/*"){var Ke=S.indexOf("*/",U.lastIndex);Ke===-1&&r("unclosed comment",S,Be.index),U.lastIndex=Ke+2}else Oe==="'"?(u.lastIndex=Be.index,u.exec(S)?U.lastIndex=u.lastIndex:r("unclosed string",S,Be.index)):Oe==='"'?(h.lastIndex=Be.index,h.exec(S)?U.lastIndex=h.lastIndex:r("unclosed string",S,Be.index)):Oe==="`"&&(c.lastIndex=Be.index,c.exec(S)?U.lastIndex=c.lastIndex:r("unclosed string",S,Be.index));else if(Te)return Se(Ce),se=Ce+Be[0].length,q.lastIndex=se,ce=ke,Fe&&de==="h"&&(de="s"),ve.t=de,ve}return r("unclosed tag",S,oe),ve}var me=function oe(de,Be){de.b=[],de.d=[];var ve,ge=!1,te=[];function Se(yt,Ri){yt&&(yt=function(Bt,gi,fi,pi){var mt,K;return typeof gi.autoTrim=="string"?mt=K=gi.autoTrim:Array.isArray(gi.autoTrim)&&(mt=gi.autoTrim[1],K=gi.autoTrim[0]),(fi||fi===!1)&&(mt=fi),(pi||pi===!1)&&(K=pi),mt==="slurp"&&K==="slurp"?Bt.trim():(mt==="_"||mt==="slurp"?Bt=String.prototype.trimLeft?Bt.trimLeft():Bt.replace(/^[\s\uFEFF\xA0]+/,""):mt!=="-"&&mt!=="nl"||(Bt=Bt.replace(/^(?:\n|\r|\r\n)/,"")),K==="_"||K==="slurp"?Bt=String.prototype.trimRight?Bt.trimRight():Bt.replace(/[\s\uFEFF\xA0]+$/,""):K!=="-"&&K!=="nl"||(Bt=Bt.replace(/(?:\n|\r|\r\n)$/,"")),Bt)}(yt,w,ce,Ri))&&(yt=yt.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),te.push(yt))}for(;(ve=q.exec(S))!==null;){var xe,Oe=ve[1],Te=ve[2],Fe=ve[3]||"";for(var ke in T)if(T[ke]===Fe){xe=ke;break}Se(Oe,Te),se=ve.index+ve[0].length,xe||r("unrecognized tag type: "+Fe,S,se);var Ce=ne(ve.index,xe),Ke=Ce.t;if(Ke==="h"){var Xe=Ce.n||"";w.async&&l.test(Xe)&&(Ce.a=!0,Ce.n=Xe.replace(l,"")),Ce=oe(Ce),te.push(Ce)}else if(Ke==="c"){if(de.n===Ce.n)return ge?(ge.d=te,de.b.push(ge)):de.d=te,de;r("Helper start and end don't match",S,ve.index+ve[0].length)}else if(Ke==="b"){ge?(ge.d=te,de.b.push(ge)):de.d=te;var nt=Ce.n||"";w.async&&l.test(nt)&&(Ce.a=!0,Ce.n=nt.replace(l,"")),ge=Ce,te=[]}else if(Ke==="s"){var Ve=Ce.n||"";w.async&&l.test(Ve)&&(Ce.a=!0,Ce.n=Ve.replace(l,"")),te.push(Ce)}else te.push(Ce)}if(!Be)throw i('unclosed helper "'+de.n+'"');return Se(S.slice(se,S.length),!1),de.d=te,de}({f:[]},!0);if(w.plugins)for(var be=0;be<w.plugins.length;be++){var we=w.plugins[be];we.processAST&&(me.d=we.processAST(me.d,w))}return me.d}function p(S,w){var T=f(S,w),Y="var tR='';"+(w.useWith?"with("+w.varName+"||{}){":"")+Q(T,w)+"if(cb){cb(null,tR)} return tR"+(w.useWith?"}":"");if(w.plugins)for(var U=0;U<w.plugins.length;U++){var q=w.plugins[U];q.processFnString&&(Y=q.processFnString(Y,w))}return Y}function v(S,w){for(var T=0;T<w.length;T++){var Y=w[T][0],U=w[T][1];S=(w[T][2]?"await ":"")+"c.l('F','"+Y+"')("+S,U&&(S+=","+U),S+=")"}return S}function y(S,w,T,Y,U,q){var se="{exec:"+(U?"async ":"")+C(T,w,S)+",params:["+Y+"]";return q&&(se+=",name:'"+q+"'"),U&&(se+=",async:true"),se+="}"}function b(S,w){for(var T="[",Y=0;Y<S.length;Y++){var U=S[Y];T+=y(w,U.res||"",U.d,U.p||"",U.a,U.n),Y<S.length&&(T+=",")}return T+="]"}function C(S,w,T){return"function("+w+"){var tR='';"+Q(S,T)+"return tR}"}function Q(S,w){for(var T=0,Y=S.length,U="";T<Y;T++){var q=S[T];if(typeof q=="string")U+="tR+='"+q+"';";else{var se=q.t,ce=q.c||"",ne=q.f,me=q.n||"",be=q.p||"",we=q.res||"",oe=q.b,de=!!q.a;if(se==="i"){w.defaultFilter&&(ce="c.l('F','"+w.defaultFilter+"')("+ce+")");var Be=v(ce,ne);!q.raw&&w.autoEscape&&(Be="c.l('F','e')("+Be+")"),U+="tR+="+Be+";"}else if(se==="h")if(w.storage.nativeHelpers.get(me))U+=w.storage.nativeHelpers.get(me)(q,w);else{var ve=(de?"await ":"")+"c.l('H','"+me+"')("+y(w,we,q.d,be,de);ve+=oe?","+b(oe,w):",[]",U+="tR+="+v(ve+=",c)",ne)+";"}else se==="s"?U+="tR+="+v((de?"await ":"")+"c.l('H','"+me+"')({params:["+be+"]},[],c)",ne)+";":se==="e"&&(U+=ce+`
61
+ `)}}return U}var B=function(){function S(w){this.cache=w}return S.prototype.define=function(w,T){this.cache[w]=T},S.prototype.get=function(w){return this.cache[w]},S.prototype.remove=function(w){delete this.cache[w]},S.prototype.reset=function(){this.cache={}},S.prototype.load=function(w){A(this.cache,w,!0)},S}();function L(S,w,T,Y){if(w&&w.length>0)throw i((Y?"Native":"")+"Helper '"+S+"' doesn't accept blocks");if(T&&T.length>0)throw i((Y?"Native":"")+"Helper '"+S+"' doesn't accept filters")}var _={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function $(S){return _[S]}var k=new B({}),M=new B({each:function(S,w){var T="",Y=S.params[0];if(L("each",w,!1),S.async)return new Promise(function(q){(function se(ce,ne,me,be,we){me(ce[ne],ne).then(function(oe){be+=oe,ne===ce.length-1?we(be):se(ce,ne+1,me,be,we)})})(Y,0,S.exec,T,q)});for(var U=0;U<Y.length;U++)T+=S.exec(Y[U],U);return T},foreach:function(S,w){var T=S.params[0];if(L("foreach",w,!1),S.async)return new Promise(function(q){(function se(ce,ne,me,be,we,oe){be(ne[me],ce[ne[me]]).then(function(de){we+=de,me===ne.length-1?oe(we):se(ce,ne,me+1,be,we,oe)})})(T,Object.keys(T),0,S.exec,"",q)});var Y="";for(var U in T)a(T,U)&&(Y+=S.exec(U,T[U]));return Y},include:function(S,w,T){L("include",w,!1);var Y=T.storage.templates.get(S.params[0]);if(!Y)throw i('Could not fetch template "'+S.params[0]+'"');return Y(S.params[1],T)},extends:function(S,w,T){var Y=S.params[1]||{};Y.content=S.exec();for(var U=0;U<w.length;U++){var q=w[U];Y[q.name]=q.exec()}var se=T.storage.templates.get(S.params[0]);if(!se)throw i('Could not fetch template "'+S.params[0]+'"');return se(Y,T)},useScope:function(S,w){return L("useScope",w,!1),S.exec(S.params[0])}}),X=new B({if:function(S,w){L("if",!1,S.f,!0);var T="if("+S.p+"){"+Q(S.d,w)+"}";if(S.b)for(var Y=0;Y<S.b.length;Y++){var U=S.b[Y];U.n==="else"?T+="else{"+Q(U.d,w)+"}":U.n==="elif"&&(T+="else if("+U.p+"){"+Q(U.d,w)+"}")}return T},try:function(S,w){if(L("try",!1,S.f,!0),!S.b||S.b.length!==1||S.b[0].n!=="catch")throw i("native helper 'try' only accepts 1 block, 'catch'");var T="try{"+Q(S.d,w)+"}",Y=S.b[0];return T+="catch"+(Y.res?"("+Y.res+")":"")+"{"+Q(Y.d,w)+"}"},block:function(S,w){return L("block",S.b,S.f,!0),"if(!"+w.varName+"["+S.p+"]){tR+=("+C(S.d,"",w)+")()}else{tR+="+w.varName+"["+S.p+"]}"}}),V=new B({e:function(S){var w=String(S);return/[&<>"']/.test(w)?w.replace(/[&<>"']/g,$):w}}),z={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(S,w){if(S==="H"){var T=this.storage.helpers.get(w);if(T)return T;throw i("Can't find helper '"+w+"'")}if(S==="F"){var Y=this.storage.filters.get(w);if(Y)return Y;throw i("Can't find filter '"+w+"'")}},async:!1,storage:{helpers:M,nativeHelpers:X,filters:V,templates:k},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function R(S,w){var T={};return A(T,z),w&&A(T,w),S&&A(T,S),T.l.bind(T),T}function x(S,w){var T=R(w||{}),Y=Function;if(T.async){if(!o)throw i("This environment doesn't support async/await");Y=o}try{return new Y(T.varName,"c","cb",p(S,T))}catch(U){throw U instanceof SyntaxError?i(`Bad template syntax
62
62
 
63
63
  `+U.message+`
64
64
  `+Array(U.message.length+1).join("=")+`
65
- `+p(x,T)):U}}function G(x,w){var T;return w.cache&&w.name&&w.storage.templates.get(w.name)?w.storage.templates.get(w.name):(T=typeof x=="function"?x:R(x,w),w.cache&&w.name&&w.storage.templates.define(w.name,T),T)}q.l.bind(q),t.compile=R,t.compileScope=Q,t.compileScopeIntoFunction=C,t.compileToString=p,t.defaultConfig=q,t.filters=V,t.getConfig=S,t.helpers=O,t.nativeHelpers=X,t.parse=f,t.render=function(x,w,T,$){var U=S(T||{});if(!U.async)return G(x,U)(w,U);if(!$){if(typeof n=="function")return new n(function(j,ie){try{j(G(x,U)(w,U))}catch(he){ie(he)}});throw i("Please provide a callback function, this env doesn't support Promises")}try{G(x,U)(w,U,$)}catch(j){return $(j)}},t.templates=k,Object.defineProperty(t,"__esModule",{value:!0})})})(Co,Co.exports);var vo=Co.exports;const Mg=(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)},Pg=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Ug=(s,e)=>`/* Wrapped ${s}*/
66
- ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),$g=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=Ug.bind(null,i,e.toString());Object.defineProperty(r,"name",Hg),Object.defineProperty(s,"toString",{...Gg,value:r})};function Yg(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Mg(s,e,r,t);return Pg(s,e),$g(s,e,i),s}const Kg=new WeakMap;function Kt(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 Yg(r,s,{ignoreNonConfigurable:!0}),Kg.set(r,t),r}var El={},yo={},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 Bo=function(s){return s[s.Width=0]="Width",s[s.Height=1]="Height",s}({});Be.Dimension=Bo;let Ur=function(s){return s[s.Inherit=0]="Inherit",s[s.LTR=1]="LTR",s[s.RTL=2]="RTL",s}({});Be.Direction=Ur;let Qo=function(s){return s[s.Flex=0]="Flex",s[s.None=1]="None",s}({});Be.Display=Qo;let ei=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=ei;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 Gr=function(s){return s[s.WebFlexBasis=0]="WebFlexBasis",s[s.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",s[s.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",s}({});Be.ExperimentalFeature=Gr;let Zs=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=Zs;let Hr=function(s){return s[s.Column=0]="Column",s[s.Row=1]="Row",s[s.All=2]="All",s}({});Be.Gutter=Hr;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 $r=function(s){return s[s.Undefined=0]="Undefined",s[s.Exactly=1]="Exactly",s[s.AtMost=2]="AtMost",s}({});Be.MeasureMode=$r;let bo=function(s){return s[s.Default=0]="Default",s[s.Text=1]="Text",s}({});Be.NodeType=bo;let Yr=function(s){return s[s.Visible=0]="Visible",s[s.Hidden=1]="Hidden",s[s.Scroll=2]="Scroll",s}({});Be.Overflow=Yr;let Kr=function(s){return s[s.Static=0]="Static",s[s.Relative=1]="Relative",s[s.Absolute=2]="Absolute",s}({});Be.PositionType=Kr;let Vr=function(s){return s[s.Layout=1]="Layout",s[s.Style=2]="Style",s[s.Children=4]="Children",s}({});Be.PrintOptions=Vr;let er=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=er;let Jr=function(s){return s[s.NoWrap=0]="NoWrap",s[s.Wrap=1]="Wrap",s[s.WrapReverse=2]="WrapReverse",s}({});Be.Wrap=Jr;var Vg={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:Bo.Width,DIMENSION_HEIGHT:Bo.Height,DIRECTION_INHERIT:Ur.Inherit,DIRECTION_LTR:Ur.LTR,DIRECTION_RTL:Ur.RTL,DISPLAY_FLEX:Qo.Flex,DISPLAY_NONE:Qo.None,EDGE_LEFT:ei.Left,EDGE_TOP:ei.Top,EDGE_RIGHT:ei.Right,EDGE_BOTTOM:ei.Bottom,EDGE_START:ei.Start,EDGE_END:ei.End,EDGE_HORIZONTAL:ei.Horizontal,EDGE_VERTICAL:ei.Vertical,EDGE_ALL:ei.All,ERRATA_NONE:zs.None,ERRATA_STRETCH_FLEX_BASIS:zs.StretchFlexBasis,ERRATA_ALL:zs.All,ERRATA_CLASSIC:zs.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:Gr.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:Gr.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:Gr.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:Zs.Column,FLEX_DIRECTION_COLUMN_REVERSE:Zs.ColumnReverse,FLEX_DIRECTION_ROW:Zs.Row,FLEX_DIRECTION_ROW_REVERSE:Zs.RowReverse,GUTTER_COLUMN:Hr.Column,GUTTER_ROW:Hr.Row,GUTTER_ALL:Hr.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:$r.Undefined,MEASURE_MODE_EXACTLY:$r.Exactly,MEASURE_MODE_AT_MOST:$r.AtMost,NODE_TYPE_DEFAULT:bo.Default,NODE_TYPE_TEXT:bo.Text,OVERFLOW_VISIBLE:Yr.Visible,OVERFLOW_HIDDEN:Yr.Hidden,OVERFLOW_SCROLL:Yr.Scroll,POSITION_TYPE_STATIC:Kr.Static,POSITION_TYPE_RELATIVE:Kr.Relative,POSITION_TYPE_ABSOLUTE:Kr.Absolute,PRINT_OPTIONS_LAYOUT:Vr.Layout,PRINT_OPTIONS_STYLE:Vr.Style,PRINT_OPTIONS_CHILDREN:Vr.Children,UNIT_UNDEFINED:er.Undefined,UNIT_POINT:er.Point,UNIT_PERCENT:er.Percent,UNIT_AUTO:er.Auto,WRAP_NO_WRAP:Jr.NoWrap,WRAP_WRAP:Jr.Wrap,WRAP_WRAP_REVERSE:Jr.WrapReverse};Be.default=Vg,Object.defineProperty(yo,"__esModule",{value:!0}),yo.default=Wg;var Fi=Jg(Be);function Il(s){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Il=function(i){return i?t:e})(s)}function Jg(s,e){if(!e&&s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var t=Il(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 Wg(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 h,u;if(c==="auto")h=Fi.Unit.Auto,u=void 0;else if(typeof c=="object")h=c.unit,u=c.valueOf();else if(h=typeof c=="string"&&c.endsWith("%")?Fi.Unit.Percent:Fi.Unit.Point,u=parseFloat(c),!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]:Fi.Direction.LTR;return r.call(this,n,o,a)}),{Config:s.Config,Node:s.Node,...Fi.default}}var ml={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,m){o=I,a=m});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),h=n.printErr||console.warn.bind(console);Object.assign(n,A),A=null;var u;n.wasmBinary&&(u=n.wasmBinary),n.noExitRuntime,typeof WebAssembly!="object"&&G("no native wasm support detected");var d,g=!1;function f(I,m,D){D=m+D;for(var F="";!(m>=D);){var P=I[m++];if(!P)break;if(P&128){var W=I[m++]&63;if((P&224)==192)F+=String.fromCharCode((P&31)<<6|W);else{var Z=I[m++]&63;P=(P&240)==224?(P&15)<<12|W<<6|Z:(P&7)<<18|W<<12|Z<<6|I[m++]&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,b,C,Q,B,L,_;function K(){var I=d.buffer;p=I,n.HEAP8=v=new Int8Array(I),n.HEAP16=b=new Int16Array(I),n.HEAP32=Q=new Int32Array(I),n.HEAPU8=y=new Uint8Array(I),n.HEAPU16=C=new Uint16Array(I),n.HEAPU32=B=new Uint32Array(I),n.HEAPF32=L=new Float32Array(I),n.HEAPF64=_=new Float64Array(I)}var k,O=[],X=[],V=[];function q(){var I=n.preRun.shift();O.unshift(I)}var S=0,R=null;function G(I){throw n.onAbort&&n.onAbort(I),I="Aborted("+I+")",h(I),g=!0,I=new WebAssembly.RuntimeError(I+". Build with -sASSERTIONS for more info."),a(I),I}function x(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/fX8BfwKvAR0BYQFhAB0BYQFiAAMBYQFjABUBYQFkABIBYQFlAAcBYQFmAB4BYQFnAAABYQFoAB8BYQFpAAMBYQFqAAABYQFrABYBYQFsAAUBYQFtAAMBYQFuAAEBYQFvABYBYQFwAAYBYQFxAAABYQFyAAABYQFzACABYQF0ABMBYQF1AAsBYQF2ABUBYQF3AAIBYQF4AAMBYQF5AA8BYQF6AAIBYQFBAAEBYQFCABIBYQF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AAIAJqIgNBAWsgAToAACACQQNJDQAgACABOgACIAAgAToAASADQQNrIAE6AAAgA0ECayABOgAAIAJBB0kNACAAIAE6AAMgA0EEayABOgAAIAJBCUkNACAAQQAgAGtBA3EiBGoiAyABQf8BcUGBgoQIbCIBNgIAIAMgAiAEa0F8cSIEaiICQQRrIAE2AgAgBEEJSQ0AIAMgATYCCCADIAE2AgQgAkEIayABNgIAIAJBDGsgATYCACAEQRlJDQAgAyABNgIYIAMgATYCFCADIAE2AhAgAyABNgIMIAJBEGsgATYCACACQRRrIAE2AgAgAkEYayABNgIAIAJBHGsgATYCACAEIANBBHFBGHIiBGsiAkEgSQ0AIAGtQoGAgIAQfiEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkEgayICQR9LDQALCyAAC4AEAQN/IAJBgARPBEAgACABIAIQFyAADwsgACACaiEDAkAgACABc0EDcUUEQAJAIABBA3FFBEAgACECDAELIAJFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICQQNxRQ0BIAIgA0kNAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgACADQQRrIgRLBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJ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ADAfyEHIAkoAgRBAWsOAgIBAwsgCEH/////e3FBgICAgAJqviEGIAhBgICAgARxRQ0BCyAGIAKUQwrXIzyUIQcMAQsgBiEHCyAHIAAgASADEB8gACABIAMQIpKSIQMCQAJAAkACQCAEKAIADgMBAAADCyAFKgIAIgIgAiADIAIgA10bIAMgA1wbIQMMAQsgAyADXA0BIARBAjYCAAsgBSADOAIACwtvAQF/AkAgAEEYaiIDECYgAUECdGooArABIAJGDQAgAxAmIAFBAnRqIAI2ArABA0AgAC0ABCIBQQRxDQEgACABQQRyOgAEIAAoAhQiAQRAIAAgAREAAAsgAEGAgID+BzYCtAIgACgCqAQiAA0ACwsLVgECfSAAKAKoBEUEQEMAAAAADwsCQCAAKgIkIgEgAVsNAEMAAIA/IQEgACgCuAQtAAhBAXENAEMAAAAAIQEgACoCHCICQwAAAABdRQ0AIAKMIQELIAELhQECA38BfgJAIABCgICAgBBUBEAgACEFDAELA0AgAUEBayIBIABCCoAiBUL2AX4gAHynQTByOgAAIABC/////58BViECIAUhACACDQALCyAFpyICBEADQCABQQFrIgEgAkEKbiIDQfYBbCACakEwcjoAACACQQlLIQQgAyECIAQNAAsLIAELNwECf0EEEB0iAiABNgIAQQQQHSIDIAE2AgBBmTcgAEG6N0HqJEHCASACQbo3Qe4kQcMBIAMQBwteAQF/IABBADYCDCAAIAM2AhACQCABBEAgAUGAgICABE8NASABQQJ0EB0hBAsgACAENgIAIAAgBCACQQJ0aiICNgIIIAAgBCABQQJ0ajYCDCAAIAI2AgQgAA8LEFAAC9QBAgJ9AX8gAEHQAGohACABQQJ0QdAhaigCACEFAkACQAJAAn8gAUF+cUECRgRAIABBBSAFQY+evPwHEDMMAQsgACAFQY+evPwHEDILIgFB8OGD/AdGDQAgAUGPnrz8B0YNAkHwISEAAkAgAUGq1ar9B0cEQCABviIDIANbDQFB+CEhAAsgACoCACEDQwAAwH8hBCAAKAIEQQFrDgIDAQILIAFB/////3txQYCAgIACar4hAyABQYCAgIAEcUUNAgsgAyA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ACAAIAEwAAA3AwAPCyACIAIoAgAiAUEEajYCACAAIAExAAA3AwAPCwALIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASsDADkDAA8LIAAgAiADEQEACw8LIAIgAigCACIBQQRqNgIAIAAgATQCADcDAA8LIAIgAigCACIBQQRqNgIAIAAgATUCADcDAA8LIAIgAigCAEEHakF4cSIBQQhqNgIAIAAgASkDADcDAAtdAQR/IAAoAgAhAgNAIAIsAAAiAxBGBEBBfyEEIAAgAkEBaiICNgIAIAFBzJmz5gBNBH9BfyADQTBrIgMgAUEKbCIEaiADIARB/////wdzShsFIAQLIQEMAQsLIAELqBQCEn8BfiMAQdAAayIIJAAgCCABNgJMIAhBN2ohFyAIQThqIRQCQAJAAkACQANAIAEhDSAHIA5B/////wdzSg0BIAcgDmohDgJAAkACQCANIgctAAAiCQRAA0ACQAJAIAlB/wFxIgFFBEAgByEBDAELIAFBJUcNASAHIQkDQCAJLQABQSVHBEAgCSEBDAILIAdBAWohByAJLQACIQogCUECaiIBIQkgCkElRg0ACwsgByANayIHIA5B/////wdzIhhKDQcgAARAIAAgDSAHECcLIAcNBiAIIAE2AkwgAUEBaiEHQX8hEgJAIAEsAAEiChBGRQ0AIAEtAAJBJEcNACABQQNqIQcgCkEwayESQQEhFQsgCCAHNgJMQQAhDAJAIAcsAAAiCUEgayIBQR9LBEAgByEKDAELIAchCkEBIAF0IgFBidEEcUUNAANAIAggB0EBaiIKNgJMIAEgDHIhDCAHLAABIglBIGsiAUEgTw0BIAohB0EBIAF0IgFBidEEcQ0ACwsCQCAJQSpGBEACfwJAIAosAAEiARBGRQ0AIAotAAJBJEcNACABQQJ0IARqQcABa0EKNgIAIApBA2ohCUEBIRUgCiwAAUEDdCADakGAA2soAgAMAQsgFQ0GIApBAWohCSAARQRAIAggCTYCTEEAIRVBACETDAMLIAIgAigCACIBQQRqNgIAQQAhFSABKAIACyETIAggCTYCTCATQQBODQFBACATayETIAxBgMAAciEMDAELIAhBzABqEHEiE0EASA0II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BERABoMAQsgAEEAQQVBvCEgAiAEEQsAGgsgA0EQaiQAECwACyAAQwAAAAAgASABQwAAAABbGzgCFCACQRBqJAALPAAgAUEDSQRAQQEgAXQhASAAKAIAIgACfyACBEAgACgCDCABcgwBCyAAKAIMIAFBf3NxCzYCDA8LEAQAC00BAn9BBBAdIQFBHBAdIgBCgICA/AM3AhQgAEIANwIMIABBADYCACAAQQA6AAggAEEBNgIEQeA2QeA2KAIAQQFqNgIAIAEgADYCACABCxAAIABBDTYCBCAAIAE2AgALEAAgAEEKNgIEIAAgATYCAAsQACAAQQc2AgQgACABNgIACyMAIAJBBUdBACACG0UEQEGoLCADIAQQYw8LQbgtIAMgBBBjCyIBAX4gASACrSADrUIghoQgBCAAERQAIgVCIIinJAEgBacLqAEBBX8gACgCVCIDKAIAIQUgAygCBCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhArGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBArGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBkIEhiADQjyIhEL/////////A4NCgICAgICAgPz/AIQhAgwBC0KAgICAgICA+P8AIQIgBEL///////+//8MAVg0AQgAhAiAEQjCIpyIAQZH3AEkNACADIQIgBkL///////8/g0KAgICAgIDAAIQiBSEHAkAgAEGB9w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ASACIAMgBEEBcQR/IAEoAgAgAGooAgAFIAALEQgACwkAIAEgABECAAsFAEGbNwsPACABIAAoAgBqIAI2AgALDQAgASAAKAIAaigCAAsYAQF/QRAQHSIAQgA3AwggAEEANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAIAEoAgAiBEHw////B0kEQAJAAkAgBEELTwRAIARBD3JBAWoiBRAdIQYgAyAFQYCAgIB4cjYCECADIAY2AgggAyAENgIMIAQgBmohBQwBCyADIAQ6ABMgA0EIaiIGIARqIQUgBEUNAQsgBiABQQRqIAQQKxoLIAVBADoAACADIAI2AgAgA0EYaiADQQhqIAMgABEDACADKAIYEBAgAygCGCIAEAYgAygCABAGIAMsABNBAEgEQCADKAIIECkLIANBIGokACAADwsQBAALKgEBf0EMEB0iAUEAOgAEIAEgACgCADYCCCAAQQA2AgAgAUHQIjYCACABCwUAQfw2C2kBAn8jAEEQayIGJAAgASAAKAIEIgdBAXVqIQEgACgCACEAIAYgASACIAMgBCAFIAdBAXEEfyABKAIAIABqKAIABSAACxEOAEEQEB0iACAGKQMINwMIIAAgBikDADcDACAGQRBqJAAgAAsFAEH4NgubAQIBfwF9IwBBEGsiAiQAIAAoAgAhACABQQZIBEACfwJAAkACQCABQQRrDgIAAQILIABBpAJqIAAtAKwCQQNxQQJGDQIaIABBnAJqDAILIABBnAJqIAAtAKwCQQNxQQJGDQEaIABBpAJqDAELIAAgAUECdGpBnAJqCyoCACEDIAJBEGokACADuw8LIAJB0A42Ag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kNERUYAQbQrCwHVAEHcKwsI//////////8AQaAsCwnwHwEAAAAAAAUAQbQsCwHQAEHMLAsK0QAAANIAAADUGwBB5CwLAQIAQfQsCwj//////////wBBuC0LAQUAQcQtCwHTAEHcLQsO0QAAANQAAADoGwAAAAQAQfQtCwEBAEGELgsF/////woAQcguCwHW",!x(w)){var T=w;w=n.locateFile?n.locateFile(T,l):l+T}function $(){var I=w;try{if(I==w&&u)return new Uint8Array(u);if(x(I))try{var m=Ty(I.slice(37)),D=new Uint8Array(m.length);for(I=0;I<m.length;++I)D[I]=m.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){G(W)}}function U(){return u||typeof fetch!="function"?Promise.resolve().then(function(){return $()}):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 $()})}function j(I){for(;0<I.length;)I.shift()(n)}function ie(I){if(I===void 0)return"_unknown";I=I.replace(/[^a-zA-Z0-9_]/g,"$");var m=I.charCodeAt(0);return 48<=m&&57>=m?"_"+I:I}function he(I,m){return I=ie(I),function(){return m.apply(this,arguments)}}var re=[{},{value:void 0},{value:null},{value:!0},{value:!1}],ve=[];function Qe(I){var m=Error,D=he(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(m.prototype),D.prototype.constructor=D,D.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},D}var be=void 0;function ne(I){throw new be(I)}var fe=I=>(I||ne("Cannot use deleted val. handle = "+I),re[I].value),Ce=I=>{switch(I){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var m=ve.length?ve.pop():re.length;return re[m]={fa:1,value:I},m}},ue=void 0,le=void 0;function ae(I){for(var m="";y[I];)m+=le[y[I++]];return m}var we=[];function ke(){for(;we.length;){var I=we.pop();I.L.Z=!1,I.delete()}}var xe=void 0,Fe={};function Ue(I,m){for(m===void 0&&ne("ptr should not be undefined");I.P;)m=I.aa(m),I=I.P;return m}var Le={};function Se(I){I=sd(I);var m=ae(I);return Ti(I),m}function Ke(I,m){var D=Le[I];return D===void 0&&ne(m+" has unknown type "+Se(I)),D}function je(){}var dt=!1;function rt(I){--I.count.value,I.count.value===0&&(I.S?I.T.V(I.S):I.O.M.V(I.N))}function yt(I,m,D){return m===D?I:D.P===void 0?null:(I=yt(I,m,D.P),I===null?null:D.ma(I))}var Ri={};function Bt(I,m){return m=Ue(I,m),Fe[m]}var gi=void 0;function fi(I){throw new gi(I)}function pi(I,m){return m.O&&m.N||fi("makeClassHandle requires ptr and ptrType"),!!m.T!=!!m.S&&fi("Both smartPtrType and smartPtr must be specified"),m.count={value:1},mt(Object.create(I,{L:{value:m}}))}function mt(I){return typeof FinalizationRegistry>"u"?(mt=m=>m,I):(dt=new FinalizationRegistry(m=>{rt(m.L)}),mt=m=>{var D=m.L;return D.S&&dt.register(m,{L:D},m),m},je=m=>{dt.unregister(m)},mt(I))}var Y={};function ce(I){for(;I.length;){var m=I.pop();I.pop()(m)}}function pe(I){return this.fromWireType(Q[I>>2])}var Te={},Re={};function Ve(I,m,D){function F(ee){ee=D(ee),ee.length!==I.length&&fi("Mismatched type converter count");for(var se=0;se<I.length;++se)bt(I[se],ee[se])}I.forEach(function(ee){Re[ee]=m});var P=Array(m.length),W=[],Z=0;m.forEach((ee,se)=>{Le.hasOwnProperty(ee)?P[se]=Le[ee]:(W.push(ee),Te.hasOwnProperty(ee)||(Te[ee]=[]),Te[ee].push(()=>{P[se]=Le[ee],++Z,Z===W.length&&F(P)}))}),W.length===0&&F(P)}function Qt(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 bt(I,m,D={}){if(!("argPackAdvance"in m))throw new TypeError("registerType registeredInstance requires argPackAdvance");var F=m.name;if(I||ne('type "'+F+'" must have a positive integer typeid pointer'),Le.hasOwnProperty(I)){if(D.ta)return;ne("Cannot register type '"+F+"' twice")}Le[I]=m,delete Re[I],Te.hasOwnProperty(I)&&(m=Te[I],delete Te[I],m.forEach(P=>P()))}function Fs(I){ne(I.L.O.M.name+" instance already deleted")}function St(){}function as(I,m,D){if(I[m].R===void 0){var F=I[m];I[m]=function(){return I[m].R.hasOwnProperty(arguments.length)||ne("Function '"+D+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+I[m].R+")!"),I[m].R[arguments.length].apply(this,arguments)},I[m].R=[],I[m].R[F.Y]=F}}function Ns(I,m){n.hasOwnProperty(I)?(ne("Cannot register public name '"+I+"' twice"),as(n,I,I),n.hasOwnProperty(void 0)&&ne("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),n[I].R[void 0]=m):n[I]=m}function Gi(I,m,D,F,P,W,Z,ee){this.name=I,this.constructor=m,this.W=D,this.V=F,this.P=P,this.oa=W,this.aa=Z,this.ma=ee,this.ia=[]}function Br(I,m,D){for(;m!==D;)m.aa||ne("Expected null or instance of "+D.name+", got an instance of "+m.name),I=m.aa(I),m=m.P;return I}function Qr(I,m){return m===null?(this.da&&ne("null is not a valid "+this.name),0):(m.L||ne('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||ne("Cannot pass deleted object as a pointer of type "+this.name),Br(m.L.N,m.L.O.M,this.M))}function Ms(I,m){if(m===null){if(this.da&&ne("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(m.L||ne('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||ne("Cannot pass deleted object as a pointer of type "+this.name),!this.ba&&m.L.O.ba&&ne("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name),D=Br(m.L.N,m.L.O.M,this.M),this.ca)switch(m.L.S===void 0&&ne("Passing raw pointer to smart pointer is illegal"),this.Aa){case 0:m.L.T===this?D=m.L.S:ne("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name);break;case 1:D=m.L.S;break;case 2:if(m.L.T===this)D=m.L.S;else{var F=m.clone();D=this.wa(D,Ce(function(){F.delete()})),I!==null&&I.push(this.V,D)}break;default:ne("Unsupporting sharing policy")}return D}function fy(I,m){return m===null?(this.da&&ne("null is not a valid "+this.name),0):(m.L||ne('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||ne("Cannot pass deleted object as a pointer of type "+this.name),m.L.O.ba&&ne("Cannot convert argument of type "+m.L.O.name+" to parameter type "+this.name),Br(m.L.N,m.L.O.M,this.M))}function xi(I,m,D,F){this.name=I,this.M=m,this.da=D,this.ba=F,this.ca=!1,this.V=this.wa=this.ea=this.ja=this.Aa=this.va=void 0,m.P!==void 0?this.toWireType=Ms:(this.toWireType=F?Qr:fy,this.U=null)}function py(I,m){n.hasOwnProperty(I)||fi("Replacing nonexistant public symbol"),n[I]=m,n[I].Y=void 0}function Ey(I,m){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,[m].concat(D)):F.call(null,m)}else F=k.get(m).apply(null,D);return F}}function Xt(I,m){I=ae(I);var D=I.includes("j")?Ey(I,m):k.get(m);return typeof D!="function"&&ne("unknown function pointer with signature "+I+": "+m),D}var Zu=void 0;function qn(I,m){function D(W){P[W]||Le[W]||(Re[W]?Re[W].forEach(D):(F.push(W),P[W]=!0))}var F=[],P={};throw m.forEach(D),new Zu(I+": "+F.map(Se).join([", "]))}function gA(I,m,D,F,P){var W=m.length;2>W&&ne("argTypes array size mismatch! Must at least get return value and 'this' types!");var Z=m[1]!==null&&D!==null,ee=!1;for(D=1;D<m.length;++D)if(m[D]!==null&&m[D].U===void 0){ee=!0;break}var se=m[0].name!=="void",te=W-2,oe=Array(te),Ie=[],_e=[];return function(){if(arguments.length!==te&&ne("function "+I+" called with "+arguments.length+" arguments, expected "+te+" args!"),_e.length=0,Ie.length=Z?2:1,Ie[0]=P,Z){var nt=m[1].toWireType(_e,this);Ie[1]=nt}for(var Oe=0;Oe<te;++Oe)oe[Oe]=m[Oe+2].toWireType(_e,arguments[Oe]),Ie.push(oe[Oe]);if(Oe=F.apply(null,Ie),ee)ce(_e);else for(var Ft=Z?1:2;Ft<m.length;Ft++){var zt=Ft===1?nt:oe[Ft-2];m[Ft].U!==null&&m[Ft].U(zt)}return nt=se?m[0].fromWireType(Oe):void 0,nt}}function fA(I,m){for(var D=[],F=0;F<I;F++)D.push(B[m+4*F>>2]);return D}function pA(I){4<I&&--re[I].fa===0&&(re[I]=void 0,ve.push(I))}function EA(I){if(I===null)return"null";var m=typeof I;return m==="object"||m==="array"||m==="function"?I.toString():""+I}function Iy(I,m){switch(m){case 2:return function(D){return this.fromWireType(L[D>>2])};case 3:return function(D){return this.fromWireType(_[D>>3])};default:throw new TypeError("Unknown float type: "+I)}}function my(I,m,D){switch(m){case 0:return D?function(F){return v[F]}:function(F){return y[F]};case 1:return D?function(F){return b[F>>1]}:function(F){return C[F>>1]};case 2:return D?function(F){return Q[F>>2]}:function(F){return B[F>>2]};default:throw new TypeError("Unknown integer type: "+I)}}function Cy(I,m){for(var D="",F=0;!(F>=m/2);++F){var P=b[I+2*F>>1];if(P==0)break;D+=String.fromCharCode(P)}return D}function vy(I,m,D){if(D===void 0&&(D=2147483647),2>D)return 0;D-=2;var F=m;D=D<2*I.length?D/2:I.length;for(var P=0;P<D;++P)b[m>>1]=I.charCodeAt(P),m+=2;return b[m>>1]=0,m-F}function yy(I){return 2*I.length}function By(I,m){for(var D=0,F="";!(D>=m/4);){var P=Q[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 Qy(I,m,D){if(D===void 0&&(D=2147483647),4>D)return 0;var F=m;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(Q[m>>2]=W,m+=4,m+4>D)break}return Q[m>>2]=0,m-F}function by(I){for(var m=0,D=0;D<I.length;++D){var F=I.charCodeAt(D);55296<=F&&57343>=F&&++D,m+=4}return m}var Sy={};function ed(I){var m=Sy[I];return m===void 0?ae(I):m}var jn=[];function wy(I){var m=jn.length;return jn.push(I),m}function Ry(I,m){for(var D=Array(I),F=0;F<I;++F)D[F]=Ke(B[m+4*F>>2],"parameter "+F);return D}var td=[],xy=[null,[],[]];be=n.BindingError=Qe("BindingError"),n.count_emval_handles=function(){for(var I=0,m=5;m<re.length;++m)re[m]!==void 0&&++I;return I},n.get_first_emval=function(){for(var I=5;I<re.length;++I)if(re[I]!==void 0)return re[I];return null},ue=n.PureVirtualError=Qe("PureVirtualError");for(var id=Array(256),Xn=0;256>Xn;++Xn)id[Xn]=String.fromCharCode(Xn);le=id,n.getInheritedInstanceCount=function(){return Object.keys(Fe).length},n.getLiveInheritedInstances=function(){var I=[],m;for(m in Fe)Fe.hasOwnProperty(m)&&I.push(Fe[m]);return I},n.flushPendingDeletes=ke,n.setDelayFunction=function(I){xe=I,we.length&&xe&&xe(ke)},gi=n.InternalError=Qe("InternalError"),St.prototype.isAliasOf=function(I){if(!(this instanceof St&&I instanceof St))return!1;var m=this.L.O.M,D=this.L.N,F=I.L.O.M;for(I=I.L.N;m.P;)D=m.aa(D),m=m.P;for(;F.P;)I=F.aa(I),F=F.P;return m===F&&D===I},St.prototype.clone=function(){if(this.L.N||Fs(this),this.L.$)return this.L.count.value+=1,this;var I=mt,m=Object,D=m.create,F=Object.getPrototypeOf(this),P=this.L;return I=I(D.call(m,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},St.prototype.delete=function(){this.L.N||Fs(this),this.L.Z&&!this.L.$&&ne("Object already scheduled for deletion"),je(this),rt(this.L),this.L.$||(this.L.S=void 0,this.L.N=void 0)},St.prototype.isDeleted=function(){return!this.L.N},St.prototype.deleteLater=function(){return this.L.N||Fs(this),this.L.Z&&!this.L.$&&ne("Object already scheduled for deletion"),we.push(this),we.length===1&&xe&&xe(ke),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=pe,xi.prototype.deleteObject=function(I){I!==null&&I.delete()},xi.prototype.fromWireType=function(I){function m(){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=Bt(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 m.call(this);F=this.ba?F.ka:F.pointerType;var P=yt(D,this.M,F.M);return P===null?m.call(this):this.ca?pi(F.M.W,{O:F,N:P,T:this,S:I}):pi(F.M.W,{O:F,N:P})},Zu=n.UnboundTypeError=Qe("UnboundTypeError");var Ty=typeof atob=="function"?atob:function(I){var m="",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;m+=String.fromCharCode(F),W!==64&&(m+=String.fromCharCode(P)),Z!==64&&(m+=String.fromCharCode(ee))}while(D<I.length);return m},Dy={p:function(I,m,D){I=ae(I),m=Ke(m,"wrapper"),D=fe(D);var F=[].slice,P=m.M,W=P.W,Z=P.P.W,ee=P.P.constructor;I=he(I,function(){P.P.ia.forEach((function(te){if(this[te]===Z[te])throw new ue("Pure virtual function "+te+" 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&&ne("Pass correct 'this' to __construct");var te=ee.implement.apply(void 0,[this].concat(F.call(arguments)));je(te);var oe=te.L;te.notifyOnDestruction(),oe.$=!0,Object.defineProperties(this,{L:{value:oe}}),mt(this),te=oe.N,te=Ue(P,te),Fe.hasOwnProperty(te)?ne("Tried to register registered instance: "+te):Fe[te]=this},W.__destruct=function(){this===W&&ne("Pass correct 'this' to __destruct"),je(this);var te=this.L.N;te=Ue(P,te),Fe.hasOwnProperty(te)?delete Fe[te]:ne("Tried to unregister unregistered instance: "+te)},I.prototype=Object.create(W);for(var se in D)I.prototype[se]=D[se];return Ce(I)},j:function(I){var m=Y[I];delete Y[I];var D=m.ea,F=m.V,P=m.ha,W=P.map(Z=>Z.sa).concat(P.map(Z=>Z.ya));Ve([I],W,Z=>{var ee={};return P.forEach((se,te)=>{var oe=Z[te],Ie=se.qa,_e=se.ra,nt=Z[te+P.length],Oe=se.xa,Ft=se.za;ee[se.na]={read:zt=>oe.fromWireType(Ie(_e,zt)),write:(zt,br)=>{var Di=[];Oe(Ft,zt,nt.toWireType(Di,br)),ce(Di)}}}),[{name:m.name,fromWireType:function(se){var te={},oe;for(oe in ee)te[oe]=ee[oe].read(se);return F(se),te},toWireType:function(se,te){for(var oe in ee)if(!(oe in te))throw new TypeError('Missing field: "'+oe+'"');var Ie=D();for(oe in ee)ee[oe].write(Ie,te[oe]);return se!==null&&se.push(F,Ie),Ie},argPackAdvance:8,readValueFromPointer:pe,U:F}]})},v:function(){},B:function(I,m,D,F,P){var W=Qt(D);m=ae(m),bt(I,{name:m,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=b;else if(D===4)ee=Q;else throw new TypeError("Unknown boolean type size: "+m);return this.fromWireType(ee[Z>>W])},U:null})},f:function(I,m,D,F,P,W,Z,ee,se,te,oe,Ie,_e){oe=ae(oe),W=Xt(P,W),ee&&(ee=Xt(Z,ee)),te&&(te=Xt(se,te)),_e=Xt(Ie,_e);var nt=ie(oe);Ns(nt,function(){qn("Cannot construct "+oe+" due to unbound types",[F])}),Ve([I,m,D],F?[F]:[],function(Oe){if(Oe=Oe[0],F)var Ft=Oe.M,zt=Ft.W;else zt=St.prototype;Oe=he(nt,function(){if(Object.getPrototypeOf(this)!==br)throw new be("Use 'new' to construct "+oe);if(Di.X===void 0)throw new be(oe+" has no accessible constructor");var od=Di.X[arguments.length];if(od===void 0)throw new be("Tried to invoke ctor of "+oe+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Di.X).toString()+") parameters instead!");return od.apply(this,arguments)});var br=Object.create(zt,{constructor:{value:Oe}});Oe.prototype=br;var Di=new Gi(oe,Oe,br,_e,Ft,W,ee,te);Ft=new xi(oe,Di,!0,!1),zt=new xi(oe+"*",Di,!1,!1);var nd=new xi(oe+" const*",Di,!1,!0);return Ri[I]={pointerType:zt,ka:nd},py(nt,Oe),[Ft,zt,nd]})},c:function(I,m,D,F,P,W,Z){var ee=fA(D,F);m=ae(m),W=Xt(P,W),Ve([],[I],function(se){function te(){qn("Cannot call "+oe+" due to unbound types",ee)}se=se[0];var oe=se.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]);var Ie=se.M.constructor;return Ie[m]===void 0?(te.Y=D-1,Ie[m]=te):(as(Ie,m,oe),Ie[m].R[D-1]=te),Ve([],ee,function(_e){return _e=gA(oe,[_e[0],null].concat(_e.slice(1)),null,W,Z),Ie[m].R===void 0?(_e.Y=D-1,Ie[m]=_e):Ie[m].R[D-1]=_e,[]}),[]})},o:function(I,m,D,F,P,W){0<m||G();var Z=fA(m,D);P=Xt(F,P),Ve([],[I],function(ee){ee=ee[0];var se="constructor "+ee.name;if(ee.M.X===void 0&&(ee.M.X=[]),ee.M.X[m-1]!==void 0)throw new be("Cannot register multiple constructors with identical number of parameters ("+(m-1)+") for class '"+ee.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return ee.M.X[m-1]=()=>{qn("Cannot construct "+ee.name+" due to unbound types",Z)},Ve([],Z,function(te){return te.splice(1,0,null),ee.M.X[m-1]=gA(se,te,null,P,W),[]}),[]})},a:function(I,m,D,F,P,W,Z,ee){var se=fA(D,F);m=ae(m),W=Xt(P,W),Ve([],[I],function(te){function oe(){qn("Cannot call "+Ie+" due to unbound types",se)}te=te[0];var Ie=te.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]),ee&&te.M.ia.push(m);var _e=te.M.W,nt=_e[m];return nt===void 0||nt.R===void 0&&nt.className!==te.name&&nt.Y===D-2?(oe.Y=D-2,oe.className=te.name,_e[m]=oe):(as(_e,m,Ie),_e[m].R[D-2]=oe),Ve([],se,function(Oe){return Oe=gA(Ie,Oe,te,W,Z),_e[m].R===void 0?(Oe.Y=D-2,_e[m]=Oe):_e[m].R[D-2]=Oe,[]}),[]})},A:function(I,m){m=ae(m),bt(I,{name:m,fromWireType:function(D){var F=fe(D);return pA(D),F},toWireType:function(D,F){return Ce(F)},argPackAdvance:8,readValueFromPointer:pe,U:null})},m:function(I,m,D){D=Qt(D),m=ae(m),bt(I,{name:m,fromWireType:function(F){return F},toWireType:function(F,P){return P},argPackAdvance:8,readValueFromPointer:Iy(m,D),U:null})},d:function(I,m,D,F,P){m=ae(m),P===-1&&(P=4294967295),P=Qt(D);var W=ee=>ee;if(F===0){var Z=32-8*D;W=ee=>ee<<Z>>>Z}D=m.includes("unsigned")?function(ee,se){return se>>>0}:function(ee,se){return se},bt(I,{name:m,fromWireType:W,toWireType:D,argPackAdvance:8,readValueFromPointer:my(m,P,F!==0),U:null})},b:function(I,m,D){function F(W){W>>=2;var Z=B;return new P(p,Z[W+1],Z[W])}var P=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][m];D=ae(D),bt(I,{name:D,fromWireType:F,argPackAdvance:8,readValueFromPointer:F},{ta:!0})},n:function(I,m){m=ae(m);var D=m==="std::string";bt(I,{name:m,fromWireType:function(F){var P=B[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):"",te===void 0)var te=Z;else te+="\0",te+=Z;Z=se+1}}else{for(te=Array(P),ee=0;ee<P;++ee)te[ee]=String.fromCharCode(y[W+ee]);te=te.join("")}return Ti(F),te},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||ne("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=IA(4+W+1),se=ee+4,B[ee>>2]=W,D&&Z){if(Z=se,se=W+1,W=y,0<se){se=Z+se-1;for(var te=0;te<P.length;++te){var oe=P.charCodeAt(te);if(55296<=oe&&57343>=oe){var Ie=P.charCodeAt(++te);oe=65536+((oe&1023)<<10)|Ie&1023}if(127>=oe){if(Z>=se)break;W[Z++]=oe}else{if(2047>=oe){if(Z+1>=se)break;W[Z++]=192|oe>>6}else{if(65535>=oe){if(Z+2>=se)break;W[Z++]=224|oe>>12}else{if(Z+3>=se)break;W[Z++]=240|oe>>18,W[Z++]=128|oe>>12&63}W[Z++]=128|oe>>6&63}W[Z++]=128|oe&63}}W[Z]=0}}else if(Z)for(Z=0;Z<W;++Z)te=P.charCodeAt(Z),255<te&&(Ti(se),ne("String has UTF-16 code units that do not fit in 8 bits")),y[se+Z]=te;else for(Z=0;Z<W;++Z)y[se+Z]=P[Z];return F!==null&&F.push(Ti,ee),ee},argPackAdvance:8,readValueFromPointer:pe,U:function(F){Ti(F)}})},i:function(I,m,D){if(D=ae(D),m===2)var F=Cy,P=vy,W=yy,Z=()=>C,ee=1;else m===4&&(F=By,P=Qy,W=by,Z=()=>B,ee=2);bt(I,{name:D,fromWireType:function(se){for(var te=B[se>>2],oe=Z(),Ie,_e=se+4,nt=0;nt<=te;++nt){var Oe=se+4+nt*m;(nt==te||oe[Oe>>ee]==0)&&(_e=F(_e,Oe-_e),Ie===void 0?Ie=_e:(Ie+="\0",Ie+=_e),_e=Oe+m)}return Ti(se),Ie},toWireType:function(se,te){typeof te!="string"&&ne("Cannot pass non-string to C++ string type "+D);var oe=W(te),Ie=IA(4+oe+m);return B[Ie>>2]=oe>>ee,P(te,Ie+4,oe+m),se!==null&&se.push(Ti,Ie),Ie},argPackAdvance:8,readValueFromPointer:pe,U:function(se){Ti(se)}})},k:function(I,m,D,F,P,W){Y[I]={name:ae(m),ea:Xt(D,F),V:Xt(P,W),ha:[]}},h:function(I,m,D,F,P,W,Z,ee,se,te){Y[I].ha.push({na:ae(m),sa:D,qa:Xt(F,P),ra:W,ya:Z,xa:Xt(ee,se),za:te})},C:function(I,m){m=ae(m),bt(I,{ua:!0,name:m,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(I,m,D,F,P){I=jn[I],m=fe(m),D=ed(D);var W=[];return B[F>>2]=Ce(W),I(m,D,W,P)},t:function(I,m,D,F){I=jn[I],m=fe(m),D=ed(D),I(m,D,null,F)},g:pA,l:function(I,m){var D=Ry(I,m),F=D[0];m=F.name+"_$"+D.slice(1).map(function(Z){return Z.name}).join("_")+"$";var P=td[m];if(P!==void 0)return P;var W=Array(I-1);return P=wy((Z,ee,se,te)=>{for(var oe=0,Ie=0;Ie<I-1;++Ie)W[Ie]=D[Ie+1].readValueFromPointer(te+oe),oe+=D[Ie+1].argPackAdvance;for(Z=Z[ee].apply(Z,W),Ie=0;Ie<I-1;++Ie)D[Ie+1].la&&D[Ie+1].la(W[Ie]);if(!F.ua)return F.toWireType(se,Z)}),td[m]=P},q:function(I){4<I&&(re[I].fa+=1)},r:function(I){var m=fe(I);ce(m),pA(I)},e:function(){G("")},x:function(I,m,D){y.copyWithin(I,m,m+D)},w:function(I){var m=y.length;if(I>>>=0,2147483648<I)return!1;for(var D=1;4>=D;D*=2){var F=m*(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),K();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,m,D,F){for(var P=0,W=0;W<D;W++){var Z=B[m>>2],ee=B[m+4>>2];m+=8;for(var se=0;se<ee;se++){var te=y[Z+se],oe=xy[I];te===0||te===10?((I===1?c:h)(f(oe,0)),oe.length=0):oe.push(te)}P+=ee}return B[F>>2]=P,0}};(function(){function I(P){n.asm=P.exports,d=n.asm.D,K(),k=n.asm.I,X.unshift(n.asm.E),S--,n.monitorRunDependencies&&n.monitorRunDependencies(S),S==0&&R&&(P=R,R=null,P())}function m(P){I(P.instance)}function D(P){return U().then(function(W){return WebAssembly.instantiate(W,F)}).then(function(W){return W}).then(P,function(W){h("failed to asynchronously prepare wasm: "+W),G(W)})}var F={a:Dy};if(S++,n.monitorRunDependencies&&n.monitorRunDependencies(S),n.instantiateWasm)try{return n.instantiateWasm(F,I)}catch(P){h("Module.instantiateWasm callback failed with error: "+P),a(P)}return function(){return u||typeof WebAssembly.instantiateStreaming!="function"||x(w)||typeof fetch!="function"?D(m):fetch(w,{credentials:"same-origin"}).then(function(P){return WebAssembly.instantiateStreaming(P,F).then(m,function(W){return h("wasm streaming compile failed: "+W),h("falling back to ArrayBuffer instantiation"),D(m)})})}().catch(a),{}})(),n.___wasm_call_ctors=function(){return(n.___wasm_call_ctors=n.asm.E).apply(null,arguments)};var sd=n.___getTypeName=function(){return(sd=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 IA=n._malloc=function(){return(IA=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;R=function I(){zn||rd(),zn||(R=I)};function rd(){function I(){if(!zn&&(zn=!0,n.calledRun=!0,!g)){if(j(X),o(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;){var m=n.postRun.shift();V.unshift(m)}j(V)}}if(!(0<S)){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)q();j(O),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 rd(),r.ready}})();s.exports=t})(ml);var qg=ml.exports;(function(s){Object.defineProperty(s,"__esModule",{value:!0});var e={loadYoga:!0};s.loadYoga=o;var t=r(yo),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=qg;async function o(){return(0,t.default)(await n())}})(El);function So({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 jg(s){if(typeof s=="string"){const[e,t]=s.split(":");return Math.min(parseFloat(e),parseFloat(t))}return s}function Xg(s){if(typeof s=="string"){const[e,t]=s.split(":"),i=parseFloat(e),r=parseFloat(t);return i/r}return s}function wo({resolution:s,aspectRatio:e}){const t=jg(s),i=Xg(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}=wo({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 tr({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,p=A/r;return[s,h,d,u-h,g-d,e<0?n-e*f:n,t<0?o-t*p:o,(u-h)*f,(g-d)*p]}function Cl({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??{},p=A*(u??0),v=l*(d??0),y=A*Math.min(1-(u??0),g??1),b=l*Math.min(1-(d??0),f??1),C=c.getContext("2d");if(C){c.width=y,c.height=b;const R=tr({source:e,sx:p,sy:v,sw:y,sh:b,dx:0,dy:0,dw:y,dh:b});C.drawImage(...R)}const Q=y/b,{sx:B,sy:L,sWidth:_,sHeight:K,scale:k}=zg({resolution:Math.min(o,a),aspectRatio:o/a,format:i,sourceWidth:y,sourceHeight:b}),O=c&&typeof s.filter<"u";if(i==="letterbox"||i==="squarebox"||i==="letterbox-video"&&!O){if(B<0){const R=Math.abs(B)*k;s.fillStyle="black",s.beginPath(),s.rect(r,n,R,a),s.rect(r+o-R,n,R,a),s.fill(),s.closePath()}if(L<0){const R=Math.abs(L)*k;s.fillStyle="black",s.beginPath(),s.rect(r,n,o,R),s.rect(r,n+a-R,o,R),s.fill(),s.closePath()}}if(i==="letterbox-video"&&O){const R=h.getContext("2d");if(R){h.width=y,h.height=b,s.save(),s.globalCompositeOperation="destination-out",s.fillRect(r,n,o,a);const G=tr({source:c,sx:B,sy:L,sw:_,sh:K,dx:r,dy:n,dw:o,dh:a});s.globalCompositeOperation="source-over",s.drawImage(...G),R.save();const x=1.2,w=-(y*x-y)/2,T=-(b*x-b)/2,$=Math.min(y/20,b/20);if(R.filter=`blur(${$}px) brightness(20%)`,R.translate(w,T),R.scale(x,x),R.drawImage(c,0,0,y,b),R.restore(),s.globalCompositeOperation="destination-over",B<0){const U=o/Q,j=a/U,ie=tr({source:h,sy:(1-j)*b/2,sh:j*b,dx:r,dy:n,dw:o,dh:a});s.drawImage(...ie)}if(L<0){const U=a*Q,j=o/U,ie=tr({source:h,sx:(1-j)*y/2,sw:j*y,dx:r,dy:n,dw:o,dh:a});s.drawImage(...ie)}s.restore()}}else{const R=tr({source:c,sx:B,sy:L,sw:_,sh:K,dx:r,dy:n,dw:o,dh:a});s.drawImage(...R)}const X=B*-1*k,V=L*-1*k,q=o-X*2,S=a-V*2;return{dx:X,dy:V,dw:q,dh:S}}function vl({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 yl=lo(({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=Xr({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(jr))==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}`}),vi=1.8;function Bl({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 Ro({context:s,x:e,y:t,width:i,height:r,radii:n,clip:o=!1,debug:a=!1}){Bl({context:s,x:e,y:t,width:i,height:r,radii:n}),a&&(s.strokeStyle="blue",s.stroke()),o&&s.clip()}function Zg({context:s,x:e,y:t,width:i,height:r,radii:n}){Bl({context:s,x:e,y:t,width:i,height:r,radii:n}),s.stroke()}function ef(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 Ql(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 bl(s,e,{layout:t,scale:i=1}){const{position:r="relative",inset:n,width:o,height:a,minWidth:A,minHeight:l,maxWidth:c,maxHeight:h,flex:u,gap:d,margin:g,padding:f,direction:p="column",align:v="start",alignSelf:y,justify:b="start"}=t,C={static:s.POSITION_TYPE_STATIC,relative:s.POSITION_TYPE_RELATIVE,absolute:s.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(C[r]),n){const{top:_,right:K,bottom:k,left:O}=ef(n,i);typeof _<"u"&&e.setPosition(s.EDGE_TOP,_),typeof K<"u"&&e.setPosition(s.EDGE_RIGHT,K),typeof k<"u"&&e.setPosition(s.EDGE_BOTTOM,k),typeof O<"u"&&e.setPosition(s.EDGE_LEFT,O)}const Q={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(Q[p]);const B={start:s.ALIGN_FLEX_START,end:s.ALIGN_FLEX_END,center:s.ALIGN_CENTER,stretch:s.ALIGN_STRETCH};e.setAlignItems(B[v]),y&&e.setAlignSelf(B[y]);const L={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(L[b]),g){const{top:_,right:K,bottom:k,left:O}=Ql(g,i);e.setMargin(s.EDGE_TOP,_),e.setMargin(s.EDGE_RIGHT,K),e.setMargin(s.EDGE_BOTTOM,k),e.setMargin(s.EDGE_LEFT,O)}if(f){const{top:_,right:K,bottom:k,left:O}=Ql(f,i);e.setPadding(s.EDGE_TOP,_),e.setPadding(s.EDGE_RIGHT,K),e.setPadding(s.EDGE_BOTTOM,k),e.setPadding(s.EDGE_LEFT,O)}typeof u<"u"&&e.setFlex(u),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 h<"u"&&e.setMaxHeight(typeof h=="number"?h*i:h)}function Sl({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))),Sl({canvas:s,debug:e,scale:t,position:A}),c.restore()}})}function wl(s,e,t,i){const r=t.map((n,o)=>{const a=s.Node.create(),{radius:A,elements:l=[],draw:c,...h}=n;return bl(s,a,{layout:h,scale:i}),e.insertChild(a,o),{node:a,element:n,childNodes:wl(s,a,l,i)}});return e.calculateLayout(),r}function Rl(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:Rl(s,A,d,g)}})}function xl(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)}xl(r,e)})}function tf({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();bl(s,o,{layout:n}),o.calculateLayout();const{width:a,height:A}=o.getComputedLayout(),l=Math.min(a,A)/1080,c=wl(s,o,i,l);xl(c,l),o.calculateLayout();const h=Rl(o,c);return o.freeRecursive(),Sl({...r,scale:l,canvas:e,position:h})}const sf={linear:bg,easeIn:Io,easeInOut:wg,easeOut:Sg,circIn:gl,circInOut:Rg,circOut:fl,backIn:mo,backInOut:Tg,backOut:xg,anticipate:Dg,bounceIn:Fg,bounceInOut:Ng,bounceOut:Or},Wr=lo((s,e,{clamp:t=!0,ease:i="easeIn",...r}={})=>mg(s,e,{...r,clamp:t,ease:sf[i]}),{cacheKey:([s,e,t])=>JSON.stringify({from:s,to:e,options:t})}),Tl=[{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 qr({text:s,font:e}){let t=e;return Tl.forEach(({family:i,regex:r})=>{r.exec(s)&&(t+=`, ${i}`)}),t}const jr=/(?<value>\d+\.?\d*)(?=px)/;function xo(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 Dl(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=>Dl(r)))}function Ll({yoga:s,debug:e=!1,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o=[],currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u}){return o.map(d=>{var g,f,p,v,y,b,C,Q;const{node:B,transient:L=[{from:0,duration:1/0}]}=d,_=t.getContext("2d"),K={total:a,content:A,scene:l},k={total:c,content:h,scene:u},O=L.reduce((X,{type:V="scene",from:q,duration:S,animation:R})=>{const G=q<0?k[V]+q:q;return K[V]>=G&&K[V]<=G+S&&X.push({type:V,animation:R,duration:S,from:G}),X},[]);if(_&&O.length>0&&Dl(d)){let X=d.width,V=d.height;if((B==null?void 0:B.type)==="text"&&B.value){const{align:q="left"}=B,S=qr({text:B.value,font:B.font});_.save(),_.font=S,_.textBaseline="top",_.textAlign=q,B.wrap?V=({width:R,maxHeight:G,scale:x})=>{var w,T;const $=yl({font:S,scale:x,context:_,maxW:R,maxH:G,text:B.value??"",minSize:(w=B.fill)==null?void 0:w.minSize,maxSize:(T=B.fill)==null?void 0:T.maxSize});return Xr({context:_,font:S,fontSize:$,text:B.value??"",maxW:R}).length*$}:(X=_.measureText(B.value).width,V=parseFloat(((f=(g=S.match(jr))==null?void 0:g.groups)==null?void 0:f.value)??"0")),_.restore()}if((B==null?void 0:B.type)==="image"&&B.image&&B.size){const q=((p=B.image)==null?void 0:p.naturalWidth)??((v=B.image)==null?void 0:v.width),S=((y=B.image)==null?void 0:y.naturalHeight)??((b=B.image)==null?void 0:b.height),R=q/S,G=(C=B.size)==null?void 0:C.width,x=(Q=B.size)==null?void 0:Q.height;X=G??(x??0)*R,V=x??(G??0)/R}return{...d,width:X,height:V,elements:Ll({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:d.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u}),draw:({dx:q,dy:S,dw:R,dh:G,scale:x})=>{var w,T,$,U,j,ie,he,re,ve,Qe,be,ne,fe;if(O.forEach(Ce=>{const{type:ue="scene",from:le,duration:ae,animation:we={type:"fade",duration:.3333333333333333,easing:{in:"easeOut",out:"easeOut"}}}=Ce;if(we){const{type:ke,duration:xe,easing:{in:Fe="easeOut",out:Ue="easeOut"}={}}=we;if(le>0&&K[ue]<=le+xe)switch(ke){case"fade":{const Le=Wr([le,le+xe],[0,1],{ease:Fe});_.globalAlpha=Le(K[ue]);break}case"slide":{const{options:Le}=we,Se={up:[{x:0,y:G},{x:0,y:0}],right:[{x:R,y:0},{x:0,y:0}],down:[{x:0,y:-G},{x:0,y:0}],left:[{x:-R,y:0},{x:0,y:0}]},Ke=Wr([le,le+xe],Se[Le.direction.in],{ease:Fe}),{x:je,y:dt}=Ke(K[ue]);_.translate(je,dt);break}}if(le+ae<k[ue]&&le+ae-xe<=K[ue])switch(ke){case"fade":{const Le=Wr([le+ae-xe,le+ae],[1,0],{ease:Ue});_.globalAlpha=Le(K[ue]);break}case"slide":{const{options:Le}=we,Se={up:[{x:0,y:0},{x:0,y:-G}],right:[{x:0,y:0},{x:R,y:0}],down:[{x:0,y:0},{x:0,y:G}],left:[{x:0,y:0},{x:-R,y:0}]},Ke=Wr([le+ae-xe,le+ae],Se[Le.direction.out],{ease:Ue}),{x:je,y:dt}=Ke(K[ue]);_.translate(je,dt);break}}}}),B){const{type:Ce}=B;if(Ce==="box"&&B.shadow){const{shadow:{color:ue="rgba(0, 0, 0, 0.5)",blur:le=0,offset:{x:ae=0,y:we=0}={}}={}}=B;if(_.save(),_.fillStyle=ue,_.shadowColor=ue,_.shadowBlur=le,_.shadowOffsetX=ae+R+t.width,_.shadowOffsetY=we+G+t.height,_.beginPath(),!d.radius)_.rect(q-R-t.width,S-G-t.height,R,G);else{const{topLeft:ke,topRight:xe,bottomRight:Fe,bottomLeft:Ue}=xo(d.radius,x);Ro({debug:e,context:_,x:q-R-t.width,y:S-G-t.height,width:R,height:G,radii:[ke,xe,Fe,Ue]})}_.fill(),_.closePath(),_.restore()}if(Ce==="box"&&B.border){const{border:{color:ue="black",width:le=0}}=B;if(le){const{topLeft:ae,topRight:we,bottomRight:ke,bottomLeft:xe}=xo(d.radius,x);_.save(),_.lineWidth=le*x,_.strokeStyle=ue,Zg({context:_,x:q,y:S,width:R,height:G,radii:[ae,we,ke,xe]}),_.restore()}}if(d.radius){const{topLeft:ue,topRight:le,bottomRight:ae,bottomLeft:we}=xo(d.radius,x);Ro({debug:e,context:_,x:q,y:S,width:R,height:G,radii:[ue,le,ae,we],clip:!0})}if(Ce==="box"&&B.background&&(_.save(),_.fillStyle=B.background,_.fillRect(q,S,R,G),_.restore()),Ce==="text"&&B.value){const{align:ue="left"}=B,le=qr({text:B.value,font:B.font}),ae=yl({font:le,scale:x,context:_,maxW:R,maxH:G,text:B.value??"",minSize:(w=B.fill)==null?void 0:w.minSize,maxSize:(T=B.fill)==null?void 0:T.maxSize});_.font=le.replace(jr,ae.toString()),_.textBaseline="top",_.fillStyle=B.color,_.textAlign=ue;const we={left:q,center:q+R/2,right:q+R};B.wrap?Xr({context:_,font:le,fontSize:ae,text:B.value,maxW:R}).forEach((xe,Fe)=>{_.fillText(xe.text,we[ue],S+ae*Fe)}):_.fillText(B.value,we[ue],S)}if(Ce==="image"&&B.image&&_.drawImage(B.image,q,S,R,G),Ce==="video"&&(($=B.video)!=null&&$.node||(U=B.video)!=null&&U.getSource)){const ue=B.format??"letterbox",le=((ie=(j=B.video)==null?void 0:j.getSource)==null?void 0:ie.call(j,l))??B.video.node,ae=(le==null?void 0:le.videoWidth)??(le==null?void 0:le.naturalWidth)??(le==null?void 0:le.width),we=(le==null?void 0:le.videoHeight)??(le==null?void 0:le.naturalHeight)??(le==null?void 0:le.height);if(ae&&we){const{dx:xe,dy:Fe,dw:Ue,dh:Le}=Cl({context:_,cropCanvas:i,letterboxCanvas:n,source:le,format:ue,crop:(he=B==null?void 0:B.value)==null?void 0:he.crop,sourceWidth:ae,sourceHeight:we,posX:q,posY:S,drawAreaWidth:R,drawAreaHeight:G});B.elements&&To({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:B.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,origin:{inset:{top:Math.max(S,S+Fe),left:Math.max(q,q+xe)},width:Math.min(R,Ue),height:Math.min(G,Le)}})}const ke=1/3;if(B.poster&&a>=0&&a<=ke){_.save(),_.globalAlpha=1-a/ke;const xe=((re=B.poster)==null?void 0:re.naturalWidth)??((ve=B.poster)==null?void 0:ve.width),Fe=((Qe=B.poster)==null?void 0:Qe.naturalHeight)??((be=B.poster)==null?void 0:be.height);r.width=r.height=0,r.width=R,r.height=G;const Ue=r.getContext("2d");if(Ue&&xe&&Fe){const{dx:Le,dy:Se,dw:Ke,dh:je}=Cl({context:Ue,cropCanvas:i,letterboxCanvas:n,source:B.poster,format:ue,crop:(ne=B==null?void 0:B.value)==null?void 0:ne.crop,sourceWidth:xe,sourceHeight:Fe,posX:0,posY:0,drawAreaWidth:R,drawAreaHeight:G});B.elements&&To({yoga:s,debug:e,canvas:r,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:B.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,origin:{inset:{top:Math.max(0,Se),left:Math.max(0,Le)},width:Math.min(R,Ke),height:Math.min(G,je)}}),_.drawImage(r,q,S,R,G),_.restore()}}}if(Ce==="gradient"&&B.value){const ue=_.createLinearGradient(q+R,S,q+R,S+G);(fe=B.value)==null||fe.forEach(le=>{ue.addColorStop(le.percent,le.color)}),_.fillStyle=ue,_.fillRect(q,S,R,G)}}}}}}).filter(Boolean)}function To({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u,...d}){return tf({...d,yoga:s,debug:e,canvas:t,elements:Ll({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:h,sceneDuration:u})})}const Xr=lo(({context:s,font:e,fontSize:t,text:i,maxW:r=1/0})=>{try{return s.save(),s.font=e.replace(jr,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,...vl({context:s,word:l,maxW:r})]:A[A.length-1]={text:h,metrics:u},A},vl({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}`}),rf=/\d{0,2}:?\d{2}:\d{2}\.\d{3}\s-->\s\d{0,2}:?\d{2}:\d{2}\.\d{3}\s{1,2}.*/g,nf=/\d{0,2}:?\d{2}:\d{2}\.\d{3}/g;function _l(s){if(!s)return[];const e=s.match(rf);return e?e==null?void 0:e.map(t=>{const[i,r]=t.replace(`\r
65
+ `+p(S,T)):U}}function G(S,w){var T;return w.cache&&w.name&&w.storage.templates.get(w.name)?w.storage.templates.get(w.name):(T=typeof S=="function"?S:x(S,w),w.cache&&w.name&&w.storage.templates.define(w.name,T),T)}z.l.bind(z),t.compile=x,t.compileScope=Q,t.compileScopeIntoFunction=C,t.compileToString=p,t.defaultConfig=z,t.filters=V,t.getConfig=R,t.helpers=M,t.nativeHelpers=X,t.parse=f,t.render=function(S,w,T,Y){var U=R(T||{});if(!U.async)return G(S,U)(w,U);if(!Y){if(typeof n=="function")return new n(function(q,se){try{q(G(S,U)(w,U))}catch(ce){se(ce)}});throw i("Please provide a callback function, this env doesn't support Promises")}try{G(S,U)(w,U,Y)}catch(q){return Y(q)}},t.templates=k,Object.defineProperty(t,"__esModule",{value:!0})})})(Co,Co.exports);var vo=Co.exports;const Mg=(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)},Pg=(s,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(s)&&Object.setPrototypeOf(s,t)},Ug=(s,e)=>`/* Wrapped ${s}*/
66
+ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),$g=(s,e,t)=>{const i=t===""?"":`with ${t.trim()}() `,r=Ug.bind(null,i,e.toString());Object.defineProperty(r,"name",Hg),Object.defineProperty(s,"toString",{...Gg,value:r})};function Yg(s,e,{ignoreNonConfigurable:t=!1}={}){const{name:i}=s;for(const r of Reflect.ownKeys(e))Mg(s,e,r,t);return Pg(s,e),$g(s,e,i),s}const Kg=new WeakMap;function Kt(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 Yg(r,s,{ignoreNonConfigurable:!0}),Kg.set(r,t),r}var El={},yo={},Qe={};Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.default=Qe.Wrap=Qe.Unit=Qe.PrintOptions=Qe.PositionType=Qe.Overflow=Qe.NodeType=Qe.MeasureMode=Qe.LogLevel=Qe.Justify=Qe.Gutter=Qe.FlexDirection=Qe.ExperimentalFeature=Qe.Errata=Qe.Edge=Qe.Display=Qe.Direction=Qe.Dimension=Qe.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}({});Qe.Align=Ci;let Bo=function(s){return s[s.Width=0]="Width",s[s.Height=1]="Height",s}({});Qe.Dimension=Bo;let Ur=function(s){return s[s.Inherit=0]="Inherit",s[s.LTR=1]="LTR",s[s.RTL=2]="RTL",s}({});Qe.Direction=Ur;let Qo=function(s){return s[s.Flex=0]="Flex",s[s.None=1]="None",s}({});Qe.Display=Qo;let ei=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}({});Qe.Edge=ei;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}({});Qe.Errata=zs;let Gr=function(s){return s[s.WebFlexBasis=0]="WebFlexBasis",s[s.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",s[s.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",s}({});Qe.ExperimentalFeature=Gr;let Zs=function(s){return s[s.Column=0]="Column",s[s.ColumnReverse=1]="ColumnReverse",s[s.Row=2]="Row",s[s.RowReverse=3]="RowReverse",s}({});Qe.FlexDirection=Zs;let Hr=function(s){return s[s.Column=0]="Column",s[s.Row=1]="Row",s[s.All=2]="All",s}({});Qe.Gutter=Hr;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}({});Qe.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}({});Qe.LogLevel=qi;let $r=function(s){return s[s.Undefined=0]="Undefined",s[s.Exactly=1]="Exactly",s[s.AtMost=2]="AtMost",s}({});Qe.MeasureMode=$r;let bo=function(s){return s[s.Default=0]="Default",s[s.Text=1]="Text",s}({});Qe.NodeType=bo;let Yr=function(s){return s[s.Visible=0]="Visible",s[s.Hidden=1]="Hidden",s[s.Scroll=2]="Scroll",s}({});Qe.Overflow=Yr;let Kr=function(s){return s[s.Static=0]="Static",s[s.Relative=1]="Relative",s[s.Absolute=2]="Absolute",s}({});Qe.PositionType=Kr;let Vr=function(s){return s[s.Layout=1]="Layout",s[s.Style=2]="Style",s[s.Children=4]="Children",s}({});Qe.PrintOptions=Vr;let er=function(s){return s[s.Undefined=0]="Undefined",s[s.Point=1]="Point",s[s.Percent=2]="Percent",s[s.Auto=3]="Auto",s}({});Qe.Unit=er;let Jr=function(s){return s[s.NoWrap=0]="NoWrap",s[s.Wrap=1]="Wrap",s[s.WrapReverse=2]="WrapReverse",s}({});Qe.Wrap=Jr;var Vg={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:Bo.Width,DIMENSION_HEIGHT:Bo.Height,DIRECTION_INHERIT:Ur.Inherit,DIRECTION_LTR:Ur.LTR,DIRECTION_RTL:Ur.RTL,DISPLAY_FLEX:Qo.Flex,DISPLAY_NONE:Qo.None,EDGE_LEFT:ei.Left,EDGE_TOP:ei.Top,EDGE_RIGHT:ei.Right,EDGE_BOTTOM:ei.Bottom,EDGE_START:ei.Start,EDGE_END:ei.End,EDGE_HORIZONTAL:ei.Horizontal,EDGE_VERTICAL:ei.Vertical,EDGE_ALL:ei.All,ERRATA_NONE:zs.None,ERRATA_STRETCH_FLEX_BASIS:zs.StretchFlexBasis,ERRATA_ALL:zs.All,ERRATA_CLASSIC:zs.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:Gr.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:Gr.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:Gr.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:Zs.Column,FLEX_DIRECTION_COLUMN_REVERSE:Zs.ColumnReverse,FLEX_DIRECTION_ROW:Zs.Row,FLEX_DIRECTION_ROW_REVERSE:Zs.RowReverse,GUTTER_COLUMN:Hr.Column,GUTTER_ROW:Hr.Row,GUTTER_ALL:Hr.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:$r.Undefined,MEASURE_MODE_EXACTLY:$r.Exactly,MEASURE_MODE_AT_MOST:$r.AtMost,NODE_TYPE_DEFAULT:bo.Default,NODE_TYPE_TEXT:bo.Text,OVERFLOW_VISIBLE:Yr.Visible,OVERFLOW_HIDDEN:Yr.Hidden,OVERFLOW_SCROLL:Yr.Scroll,POSITION_TYPE_STATIC:Kr.Static,POSITION_TYPE_RELATIVE:Kr.Relative,POSITION_TYPE_ABSOLUTE:Kr.Absolute,PRINT_OPTIONS_LAYOUT:Vr.Layout,PRINT_OPTIONS_STYLE:Vr.Style,PRINT_OPTIONS_CHILDREN:Vr.Children,UNIT_UNDEFINED:er.Undefined,UNIT_POINT:er.Point,UNIT_PERCENT:er.Percent,UNIT_AUTO:er.Auto,WRAP_NO_WRAP:Jr.NoWrap,WRAP_WRAP:Jr.Wrap,WRAP_WRAP_REVERSE:Jr.WrapReverse};Qe.default=Vg,Object.defineProperty(yo,"__esModule",{value:!0}),yo.default=Wg;var Fi=Jg(Qe);function Il(s){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(Il=function(i){return i?t:e})(s)}function Jg(s,e){if(!e&&s&&s.__esModule)return s;if(s===null||typeof s!="object"&&typeof s!="function")return{default:s};var t=Il(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 Wg(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 ml={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,m){o=I,a=m});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"&&G("no native wasm support detected");var d,g=!1;function f(I,m,D){D=m+D;for(var F="";!(m>=D);){var P=I[m++];if(!P)break;if(P&128){var W=I[m++]&63;if((P&224)==192)F+=String.fromCharCode((P&31)<<6|W);else{var Z=I[m++]&63;P=(P&240)==224?(P&15)<<12|W<<6|Z:(P&7)<<18|W<<12|Z<<6|I[m++]&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,b,C,Q,B,L,_;function $(){var I=d.buffer;p=I,n.HEAP8=v=new Int8Array(I),n.HEAP16=b=new Int16Array(I),n.HEAP32=Q=new Int32Array(I),n.HEAPU8=y=new Uint8Array(I),n.HEAPU16=C=new Uint16Array(I),n.HEAPU32=B=new Uint32Array(I),n.HEAPF32=L=new Float32Array(I),n.HEAPF64=_=new Float64Array(I)}var k,M=[],X=[],V=[];function z(){var I=n.preRun.shift();M.unshift(I)}var R=0,x=null;function G(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 S(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/f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gICAgAJqviEEIAFBgICAgARxRQ0BCyAEIAOUQwrXIzyUIQUMAQsgBCEFC0MAAAAAIQQCQCAAKALYASIAQfDhg/wHRg0AIABBj568/AdGDQRB8CEhAQJAIABBqtWq/QdHBEAgAL4iBCAEWw0BQfghIQELIAEqAgAhBCABKAIEQQFrDgIEAQYLIABB/////3txQYCAgIACar4hBCAAQYCAgIAEcUUNAwsgBCADlEMK1yM8lCEEDAILIAQhBQtDAAAAACEEAkAgACgC3AEiAEHw4YP8B0YNACAAQY+evPwHRg0CQfAhIQECQCAAQarVqv0HRwRAIAC+IgQgBFsNAUH4ISEBCyABKgIAIQQgASgCBEEBaw4CAgEECyAAQf////97cUGAgICAAmq+IQQgAEGAgICABHFFDQELIAQgA5RDCtcjPJQhBAsgBEMAAAAAYEUNAQsgAiAEXg0BCyAFQwAAAABgRQRAIAIPCyAFIAIgAiAFXRshBAsgBAsEACAAC74BAQN/IAAtAABBIHFFBEACQCABIQMCQCACIAAiASgCECIABH8gAAUgARB+DQEgASgCEAsgASgCFCIFa0sEQCABIAMgAiABKAIkEQYAGgwCCwJAIAEoAlBBAEgNACACIQADQCAAIgRFDQEgAyAEQQFrIgBqLQAAQQpHDQALIAEgAyAEIAEoAiQRBgAgBEkNASADIARqIQMgAiAEayECIAEoAhQhBQsgBSADIAIQKxogASABKAIUIAJqNgIUCwsLC20BAX8jAEGAAmsiBSQAIARBgMAEcSACIANMckUEQCAFIAFB/wFxIAIgA2siA0GAAiADQYACSSIBGxAqGiABRQRAA0AgACAFQYACECcgA0GAAmsiA0H/AUsNAAsLIAAgBSADECcLIAVBgAJqJAALzAIBBX8gAARAIABBBGsiASgCACIFIQMgASECIABBCGsoAgAiACAAQX5xIgRHBEAgASAEayICKAIEIgAgAigCCDYCCCACKAIIIAA2AgQgBCAFaiEDCyABIAVqIgQoAgAiASABIARqQQRrKAIARwRAIAQoAgQiACAEKAIINgIIIAQoAgggADYCBCABIANqIQMLIAIgAzYCACADQXxxIAJqQQRrIANBA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I2AhAL/QEBA38jAEEQayICJAAgACgCACEAIAFDAAAAAGBFBEAgAkHXETYCACMAQRBrIgMkACADIAI2AgwCQCAADQBB6DYtAAAEQEHkNigCACEADAELQRwQHSIAQoCAgPwDNwIUIABCADcCDCAAQQA2AgAgAEEAOgAIIABBATYCBEHkNiAANgIAQeg2QQE6AABB4DZB4DYoAgBBAWo2AgALIAAoAgQhBAJAIAAtAAhBCHEEQCAAQQBBBUEAQbwhIAIgBBERABoMAQsgAEEAQQVBvCEgAiAEEQsAGgsgA0EQaiQAECwACyAAQwAAAAAgASABQwAAAABbGzgCFCACQRBqJAALPAAgAUEDSQRAQQEgAXQhASAAKAIAIgACfyACBEAgACgCDCABcgwBCyAAKAIMIAFBf3NxCzYCDA8LEAQAC00BAn9BBBAdIQFBHBAdIgBCgICA/AM3AhQgAEIANwIMIABBADYCACAAQQA6AAggAEEBNgIEQeA2QeA2KAIAQQFqNgIAIAEgADYCACABCxAAIABBDTYCBCAAIAE2AgALEAAgAEEKNgIEIAAgATYCAAsQACAAQQc2AgQgACABNgIACyMAIAJBBUdBACACG0UEQEGoLCADIAQQYw8LQbgtIAMgBBBjCyIBAX4gASACrSADrUIghoQgBCAAERQAIgVCIIinJAEgBacLqAEBBX8gACgCVCIDKAIAIQUgAygCBCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhArGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBArGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAw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IpAwA3AwAgAkEQaiQAIAALYwECfyMAQRBrIgMkACABIAAoAgQiBEEBdWohASAAKAIAIQAgAyABIAIgBEEBcQR/IAEoAgAgAGooAgAFIAALEQMAQRAQHSIAIAMpAwg3AwggACADKQMANwMAIANBEGokACAACzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRBAALOQEBfyABIAAoAgQiBEEBdWohASAAKAIAIQAgASACIAMgBEEBcQR/IAEoAgAgAGooAgAFIAALEQgACwkAIAEgABECAAsFAEGbNwsPACABIAAoAgBqIAI2AgALDQAgASAAKAIAaigCAAsYAQF/QRAQHSIAQgA3AwggAEEANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAIAEoAgAiBEHw////B0kEQAJAAkAgBEELTwRAIARBD3JBAWoiBRAdIQYgAyAFQYCAgIB4cjYCECADIAY2AgggAyAENgIMIAQgBmohBQwBCyADIAQ6ABMgA0EIaiIGIARqIQUgBEUNAQsgBiABQQRqIAQQKxoLIAVBADoAACADIAI2AgAgA0EYaiADQQhqIAMgABEDACADKAIYEBAgAygCGCIAEAYgAygCABAGIAMsABNBAEgEQCADKAIIECkLIANBIGokACAADwsQBAALKgEBf0EMEB0iAUEAOgAEIAEgACgCADYCCCAAQQA2AgAgAUHQIjYCACABCwUAQfw2C2kBAn8jAEEQayIGJAAgASAAKAIEIgdBAXVqIQEgACgCACEAIAYgASACIAMgBCAFIAdBAXEEfyABKAIAI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wAAAAAAAwAAAwAQfUoCwEQAEGBKQsVDwAAAAQPAAAAAAkQAAAAAAAQAAAQAEGvKQsBEgBBuykLHhEAAAAAEQAAAAAJEgAAAAAAEgAAEgAAGgAAABoaGgBB8ikLDhoAAAAaGhoAAAAAAAAJAEGjKgsBFABBryoLFRcAAAAAFwAAAAAJFAAAAAAAFAAAFABB3SoLARYAQekqCycVAAAAABUAAAAACRYAAAAAABYAABYAADAxMjM0NTY3ODlBQkNERUYAQbQrCwHVAEHcKwsI//////////8AQaAsCwnwHwEAAAAAAAUAQbQsCwHQAEHMLAsK0QAAANIAAADUGwBB5CwLAQIAQfQsCwj//////////wBBuC0LAQUAQcQtCwHTAEHcLQsO0QAAANQAAADoGwAAAAQAQfQtCwEBAEGELgsF/////woAQcguCwHW",!S(w)){var T=w;w=n.locateFile?n.locateFile(T,l):l+T}function Y(){var I=w;try{if(I==w&&h)return new Uint8Array(h);if(S(I))try{var m=xy(I.slice(37)),D=new Uint8Array(m.length);for(I=0;I<m.length;++I)D[I]=m.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){G(W)}}function U(){return h||typeof fetch!="function"?Promise.resolve().then(function(){return Y()}):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 Y()})}function q(I){for(;0<I.length;)I.shift()(n)}function se(I){if(I===void 0)return"_unknown";I=I.replace(/[^a-zA-Z0-9_]/g,"$");var m=I.charCodeAt(0);return 48<=m&&57>=m?"_"+I:I}function ce(I,m){return I=se(I),function(){return m.apply(this,arguments)}}var ne=[{},{value:void 0},{value:null},{value:!0},{value:!1}],me=[];function be(I){var m=Error,D=ce(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(m.prototype),D.prototype.constructor=D,D.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},D}var we=void 0;function oe(I){throw new we(I)}var de=I=>(I||oe("Cannot use deleted val. handle = "+I),ne[I].value),Be=I=>{switch(I){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var m=me.length?me.pop():ne.length;return ne[m]={fa:1,value:I},m}},ve=void 0,ge=void 0;function te(I){for(var m="";y[I];)m+=ge[y[I++]];return m}var Se=[];function xe(){for(;Se.length;){var I=Se.pop();I.L.Z=!1,I.delete()}}var Oe=void 0,Te={};function Fe(I,m){for(m===void 0&&oe("ptr should not be undefined");I.P;)m=I.aa(m),I=I.P;return m}var ke={};function Ce(I){I=sd(I);var m=te(I);return Ti(I),m}function Ke(I,m){var D=ke[I];return D===void 0&&oe(m+" has unknown type "+Ce(I)),D}function Xe(){}var nt=!1;function Ve(I){--I.count.value,I.count.value===0&&(I.S?I.T.V(I.S):I.O.M.V(I.N))}function yt(I,m,D){return m===D?I:D.P===void 0?null:(I=yt(I,m,D.P),I===null?null:D.ma(I))}var Ri={};function Bt(I,m){return m=Fe(I,m),Te[m]}var gi=void 0;function fi(I){throw new gi(I)}function pi(I,m){return m.O&&m.N||fi("makeClassHandle requires ptr and ptrType"),!!m.T!=!!m.S&&fi("Both smartPtrType and smartPtr must be specified"),m.count={value:1},mt(Object.create(I,{L:{value:m}}))}function mt(I){return typeof FinalizationRegistry>"u"?(mt=m=>m,I):(nt=new FinalizationRegistry(m=>{Ve(m.L)}),mt=m=>{var D=m.L;return D.S&&nt.register(m,{L:D},m),m},Xe=m=>{nt.unregister(m)},mt(I))}var K={};function le(I){for(;I.length;){var m=I.pop();I.pop()(m)}}function fe(I){return this.fromWireType(Q[I>>2])}var De={},Re={};function Je(I,m,D){function F(ee){ee=D(ee),ee.length!==I.length&&fi("Mismatched type converter count");for(var re=0;re<I.length;++re)bt(I[re],ee[re])}I.forEach(function(ee){Re[ee]=m});var P=Array(m.length),W=[],Z=0;m.forEach((ee,re)=>{ke.hasOwnProperty(ee)?P[re]=ke[ee]:(W.push(ee),De.hasOwnProperty(ee)||(De[ee]=[]),De[ee].push(()=>{P[re]=ke[ee],++Z,Z===W.length&&F(P)}))}),W.length===0&&F(P)}function Qt(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 bt(I,m,D={}){if(!("argPackAdvance"in m))throw new TypeError("registerType registeredInstance requires argPackAdvance");var F=m.name;if(I||oe('type "'+F+'" must have a positive integer typeid pointer'),ke.hasOwnProperty(I)){if(D.ta)return;oe("Cannot register type '"+F+"' twice")}ke[I]=m,delete Re[I],De.hasOwnProperty(I)&&(m=De[I],delete De[I],m.forEach(P=>P()))}function Fs(I){oe(I.L.O.M.name+" instance already deleted")}function St(){}function as(I,m,D){if(I[m].R===void 0){var F=I[m];I[m]=function(){return I[m].R.hasOwnProperty(arguments.length)||oe("Function '"+D+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+I[m].R+")!"),I[m].R[arguments.length].apply(this,arguments)},I[m].R=[],I[m].R[F.Y]=F}}function Ns(I,m){n.hasOwnProperty(I)?(oe("Cannot register public name '"+I+"' twice"),as(n,I,I),n.hasOwnProperty(void 0)&&oe("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),n[I].R[void 0]=m):n[I]=m}function Gi(I,m,D,F,P,W,Z,ee){this.name=I,this.constructor=m,this.W=D,this.V=F,this.P=P,this.oa=W,this.aa=Z,this.ma=ee,this.ia=[]}function Br(I,m,D){for(;m!==D;)m.aa||oe("Expected null or instance of "+D.name+", got an instance of "+m.name),I=m.aa(I),m=m.P;return I}function Qr(I,m){return m===null?(this.da&&oe("null is not a valid "+this.name),0):(m.L||oe('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||oe("Cannot pass deleted object as a pointer of type "+this.name),Br(m.L.N,m.L.O.M,this.M))}function Ms(I,m){if(m===null){if(this.da&&oe("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(m.L||oe('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||oe("Cannot pass deleted object as a pointer of type "+this.name),!this.ba&&m.L.O.ba&&oe("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name),D=Br(m.L.N,m.L.O.M,this.M),this.ca)switch(m.L.S===void 0&&oe("Passing raw pointer to smart pointer is illegal"),this.Aa){case 0:m.L.T===this?D=m.L.S:oe("Cannot convert argument of type "+(m.L.T?m.L.T.name:m.L.O.name)+" to parameter type "+this.name);break;case 1:D=m.L.S;break;case 2:if(m.L.T===this)D=m.L.S;else{var F=m.clone();D=this.wa(D,Be(function(){F.delete()})),I!==null&&I.push(this.V,D)}break;default:oe("Unsupporting sharing policy")}return D}function gy(I,m){return m===null?(this.da&&oe("null is not a valid "+this.name),0):(m.L||oe('Cannot pass "'+EA(m)+'" as a '+this.name),m.L.N||oe("Cannot pass deleted object as a pointer of type "+this.name),m.L.O.ba&&oe("Cannot convert argument of type "+m.L.O.name+" to parameter type "+this.name),Br(m.L.N,m.L.O.M,this.M))}function xi(I,m,D,F){this.name=I,this.M=m,this.da=D,this.ba=F,this.ca=!1,this.V=this.wa=this.ea=this.ja=this.Aa=this.va=void 0,m.P!==void 0?this.toWireType=Ms:(this.toWireType=F?Qr:gy,this.U=null)}function fy(I,m){n.hasOwnProperty(I)||fi("Replacing nonexistant public symbol"),n[I]=m,n[I].Y=void 0}function py(I,m){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,[m].concat(D)):F.call(null,m)}else F=k.get(m).apply(null,D);return F}}function Xt(I,m){I=te(I);var D=I.includes("j")?py(I,m):k.get(m);return typeof D!="function"&&oe("unknown function pointer with signature "+I+": "+m),D}var Zh=void 0;function qn(I,m){function D(W){P[W]||ke[W]||(Re[W]?Re[W].forEach(D):(F.push(W),P[W]=!0))}var F=[],P={};throw m.forEach(D),new Zh(I+": "+F.map(Ce).join([", "]))}function gA(I,m,D,F,P){var W=m.length;2>W&&oe("argTypes array size mismatch! Must at least get return value and 'this' types!");var Z=m[1]!==null&&D!==null,ee=!1;for(D=1;D<m.length;++D)if(m[D]!==null&&m[D].U===void 0){ee=!0;break}var re=m[0].name!=="void",ie=W-2,ae=Array(ie),Ee=[],_e=[];return function(){if(arguments.length!==ie&&oe("function "+I+" called with "+arguments.length+" arguments, expected "+ie+" args!"),_e.length=0,Ee.length=Z?2:1,Ee[0]=P,Z){var ot=m[1].toWireType(_e,this);Ee[1]=ot}for(var Pe=0;Pe<ie;++Pe)ae[Pe]=m[Pe+2].toWireType(_e,arguments[Pe]),Ee.push(ae[Pe]);if(Pe=F.apply(null,Ee),ee)le(_e);else for(var Ft=Z?1:2;Ft<m.length;Ft++){var zt=Ft===1?ot:ae[Ft-2];m[Ft].U!==null&&m[Ft].U(zt)}return ot=re?m[0].fromWireType(Pe):void 0,ot}}function fA(I,m){for(var D=[],F=0;F<I;F++)D.push(B[m+4*F>>2]);return D}function pA(I){4<I&&--ne[I].fa===0&&(ne[I]=void 0,me.push(I))}function EA(I){if(I===null)return"null";var m=typeof I;return m==="object"||m==="array"||m==="function"?I.toString():""+I}function Ey(I,m){switch(m){case 2:return function(D){return this.fromWireType(L[D>>2])};case 3:return function(D){return this.fromWireType(_[D>>3])};default:throw new TypeError("Unknown float type: "+I)}}function Iy(I,m,D){switch(m){case 0:return D?function(F){return v[F]}:function(F){return y[F]};case 1:return D?function(F){return b[F>>1]}:function(F){return C[F>>1]};case 2:return D?function(F){return Q[F>>2]}:function(F){return B[F>>2]};default:throw new TypeError("Unknown integer type: "+I)}}function my(I,m){for(var D="",F=0;!(F>=m/2);++F){var P=b[I+2*F>>1];if(P==0)break;D+=String.fromCharCode(P)}return D}function Cy(I,m,D){if(D===void 0&&(D=2147483647),2>D)return 0;D-=2;var F=m;D=D<2*I.length?D/2:I.length;for(var P=0;P<D;++P)b[m>>1]=I.charCodeAt(P),m+=2;return b[m>>1]=0,m-F}function vy(I){return 2*I.length}function yy(I,m){for(var D=0,F="";!(D>=m/4);){var P=Q[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 By(I,m,D){if(D===void 0&&(D=2147483647),4>D)return 0;var F=m;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(Q[m>>2]=W,m+=4,m+4>D)break}return Q[m>>2]=0,m-F}function Qy(I){for(var m=0,D=0;D<I.length;++D){var F=I.charCodeAt(D);55296<=F&&57343>=F&&++D,m+=4}return m}var by={};function ed(I){var m=by[I];return m===void 0?te(I):m}var jn=[];function Sy(I){var m=jn.length;return jn.push(I),m}function wy(I,m){for(var D=Array(I),F=0;F<I;++F)D[F]=Ke(B[m+4*F>>2],"parameter "+F);return D}var td=[],Ry=[null,[],[]];we=n.BindingError=be("BindingError"),n.count_emval_handles=function(){for(var I=0,m=5;m<ne.length;++m)ne[m]!==void 0&&++I;return I},n.get_first_emval=function(){for(var I=5;I<ne.length;++I)if(ne[I]!==void 0)return ne[I];return null},ve=n.PureVirtualError=be("PureVirtualError");for(var id=Array(256),Xn=0;256>Xn;++Xn)id[Xn]=String.fromCharCode(Xn);ge=id,n.getInheritedInstanceCount=function(){return Object.keys(Te).length},n.getLiveInheritedInstances=function(){var I=[],m;for(m in Te)Te.hasOwnProperty(m)&&I.push(Te[m]);return I},n.flushPendingDeletes=xe,n.setDelayFunction=function(I){Oe=I,Se.length&&Oe&&Oe(xe)},gi=n.InternalError=be("InternalError"),St.prototype.isAliasOf=function(I){if(!(this instanceof St&&I instanceof St))return!1;var m=this.L.O.M,D=this.L.N,F=I.L.O.M;for(I=I.L.N;m.P;)D=m.aa(D),m=m.P;for(;F.P;)I=F.aa(I),F=F.P;return m===F&&D===I},St.prototype.clone=function(){if(this.L.N||Fs(this),this.L.$)return this.L.count.value+=1,this;var I=mt,m=Object,D=m.create,F=Object.getPrototypeOf(this),P=this.L;return I=I(D.call(m,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},St.prototype.delete=function(){this.L.N||Fs(this),this.L.Z&&!this.L.$&&oe("Object already scheduled for deletion"),Xe(this),Ve(this.L),this.L.$||(this.L.S=void 0,this.L.N=void 0)},St.prototype.isDeleted=function(){return!this.L.N},St.prototype.deleteLater=function(){return this.L.N||Fs(this),this.L.Z&&!this.L.$&&oe("Object already scheduled for deletion"),Se.push(this),Se.length===1&&Oe&&Oe(xe),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=fe,xi.prototype.deleteObject=function(I){I!==null&&I.delete()},xi.prototype.fromWireType=function(I){function m(){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=Bt(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 m.call(this);F=this.ba?F.ka:F.pointerType;var P=yt(D,this.M,F.M);return P===null?m.call(this):this.ca?pi(F.M.W,{O:F,N:P,T:this,S:I}):pi(F.M.W,{O:F,N:P})},Zh=n.UnboundTypeError=be("UnboundTypeError");var xy=typeof atob=="function"?atob:function(I){var m="",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;m+=String.fromCharCode(F),W!==64&&(m+=String.fromCharCode(P)),Z!==64&&(m+=String.fromCharCode(ee))}while(D<I.length);return m},Ty={p:function(I,m,D){I=te(I),m=Ke(m,"wrapper"),D=de(D);var F=[].slice,P=m.M,W=P.W,Z=P.P.W,ee=P.P.constructor;I=ce(I,function(){P.P.ia.forEach((function(ie){if(this[ie]===Z[ie])throw new ve("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&&oe("Pass correct 'this' to __construct");var ie=ee.implement.apply(void 0,[this].concat(F.call(arguments)));Xe(ie);var ae=ie.L;ie.notifyOnDestruction(),ae.$=!0,Object.defineProperties(this,{L:{value:ae}}),mt(this),ie=ae.N,ie=Fe(P,ie),Te.hasOwnProperty(ie)?oe("Tried to register registered instance: "+ie):Te[ie]=this},W.__destruct=function(){this===W&&oe("Pass correct 'this' to __destruct"),Xe(this);var ie=this.L.N;ie=Fe(P,ie),Te.hasOwnProperty(ie)?delete Te[ie]:oe("Tried to unregister unregistered instance: "+ie)},I.prototype=Object.create(W);for(var re in D)I.prototype[re]=D[re];return Be(I)},j:function(I){var m=K[I];delete K[I];var D=m.ea,F=m.V,P=m.ha,W=P.map(Z=>Z.sa).concat(P.map(Z=>Z.ya));Je([I],W,Z=>{var ee={};return P.forEach((re,ie)=>{var ae=Z[ie],Ee=re.qa,_e=re.ra,ot=Z[ie+P.length],Pe=re.xa,Ft=re.za;ee[re.na]={read:zt=>ae.fromWireType(Ee(_e,zt)),write:(zt,br)=>{var Di=[];Pe(Ft,zt,ot.toWireType(Di,br)),le(Di)}}}),[{name:m.name,fromWireType:function(re){var ie={},ae;for(ae in ee)ie[ae]=ee[ae].read(re);return F(re),ie},toWireType:function(re,ie){for(var ae in ee)if(!(ae in ie))throw new TypeError('Missing field: "'+ae+'"');var Ee=D();for(ae in ee)ee[ae].write(Ee,ie[ae]);return re!==null&&re.push(F,Ee),Ee},argPackAdvance:8,readValueFromPointer:fe,U:F}]})},v:function(){},B:function(I,m,D,F,P){var W=Qt(D);m=te(m),bt(I,{name:m,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=b;else if(D===4)ee=Q;else throw new TypeError("Unknown boolean type size: "+m);return this.fromWireType(ee[Z>>W])},U:null})},f:function(I,m,D,F,P,W,Z,ee,re,ie,ae,Ee,_e){ae=te(ae),W=Xt(P,W),ee&&(ee=Xt(Z,ee)),ie&&(ie=Xt(re,ie)),_e=Xt(Ee,_e);var ot=se(ae);Ns(ot,function(){qn("Cannot construct "+ae+" due to unbound types",[F])}),Je([I,m,D],F?[F]:[],function(Pe){if(Pe=Pe[0],F)var Ft=Pe.M,zt=Ft.W;else zt=St.prototype;Pe=ce(ot,function(){if(Object.getPrototypeOf(this)!==br)throw new we("Use 'new' to construct "+ae);if(Di.X===void 0)throw new we(ae+" has no accessible constructor");var od=Di.X[arguments.length];if(od===void 0)throw new we("Tried to invoke ctor of "+ae+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(Di.X).toString()+") parameters instead!");return od.apply(this,arguments)});var br=Object.create(zt,{constructor:{value:Pe}});Pe.prototype=br;var Di=new Gi(ae,Pe,br,_e,Ft,W,ee,ie);Ft=new xi(ae,Di,!0,!1),zt=new xi(ae+"*",Di,!1,!1);var nd=new xi(ae+" const*",Di,!1,!0);return Ri[I]={pointerType:zt,ka:nd},fy(ot,Pe),[Ft,zt,nd]})},c:function(I,m,D,F,P,W,Z){var ee=fA(D,F);m=te(m),W=Xt(P,W),Je([],[I],function(re){function ie(){qn("Cannot call "+ae+" due to unbound types",ee)}re=re[0];var ae=re.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]);var Ee=re.M.constructor;return Ee[m]===void 0?(ie.Y=D-1,Ee[m]=ie):(as(Ee,m,ae),Ee[m].R[D-1]=ie),Je([],ee,function(_e){return _e=gA(ae,[_e[0],null].concat(_e.slice(1)),null,W,Z),Ee[m].R===void 0?(_e.Y=D-1,Ee[m]=_e):Ee[m].R[D-1]=_e,[]}),[]})},o:function(I,m,D,F,P,W){0<m||G();var Z=fA(m,D);P=Xt(F,P),Je([],[I],function(ee){ee=ee[0];var re="constructor "+ee.name;if(ee.M.X===void 0&&(ee.M.X=[]),ee.M.X[m-1]!==void 0)throw new we("Cannot register multiple constructors with identical number of parameters ("+(m-1)+") for class '"+ee.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return ee.M.X[m-1]=()=>{qn("Cannot construct "+ee.name+" due to unbound types",Z)},Je([],Z,function(ie){return ie.splice(1,0,null),ee.M.X[m-1]=gA(re,ie,null,P,W),[]}),[]})},a:function(I,m,D,F,P,W,Z,ee){var re=fA(D,F);m=te(m),W=Xt(P,W),Je([],[I],function(ie){function ae(){qn("Cannot call "+Ee+" due to unbound types",re)}ie=ie[0];var Ee=ie.name+"."+m;m.startsWith("@@")&&(m=Symbol[m.substring(2)]),ee&&ie.M.ia.push(m);var _e=ie.M.W,ot=_e[m];return ot===void 0||ot.R===void 0&&ot.className!==ie.name&&ot.Y===D-2?(ae.Y=D-2,ae.className=ie.name,_e[m]=ae):(as(_e,m,Ee),_e[m].R[D-2]=ae),Je([],re,function(Pe){return Pe=gA(Ee,Pe,ie,W,Z),_e[m].R===void 0?(Pe.Y=D-2,_e[m]=Pe):_e[m].R[D-2]=Pe,[]}),[]})},A:function(I,m){m=te(m),bt(I,{name:m,fromWireType:function(D){var F=de(D);return pA(D),F},toWireType:function(D,F){return Be(F)},argPackAdvance:8,readValueFromPointer:fe,U:null})},m:function(I,m,D){D=Qt(D),m=te(m),bt(I,{name:m,fromWireType:function(F){return F},toWireType:function(F,P){return P},argPackAdvance:8,readValueFromPointer:Ey(m,D),U:null})},d:function(I,m,D,F,P){m=te(m),P===-1&&(P=4294967295),P=Qt(D);var W=ee=>ee;if(F===0){var Z=32-8*D;W=ee=>ee<<Z>>>Z}D=m.includes("unsigned")?function(ee,re){return re>>>0}:function(ee,re){return re},bt(I,{name:m,fromWireType:W,toWireType:D,argPackAdvance:8,readValueFromPointer:Iy(m,P,F!==0),U:null})},b:function(I,m,D){function F(W){W>>=2;var Z=B;return new P(p,Z[W+1],Z[W])}var P=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][m];D=te(D),bt(I,{name:D,fromWireType:F,argPackAdvance:8,readValueFromPointer:F},{ta:!0})},n:function(I,m){m=te(m);var D=m==="std::string";bt(I,{name:m,fromWireType:function(F){var P=B[F>>2],W=F+4;if(D)for(var Z=W,ee=0;ee<=P;++ee){var re=W+ee;if(ee==P||y[re]==0){if(Z=Z?f(y,Z,re-Z):"",ie===void 0)var ie=Z;else ie+="\0",ie+=Z;Z=re+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||oe("Cannot pass non-string to std::string"),D&&Z){var ee=0;for(W=0;W<P.length;++W){var re=P.charCodeAt(W);127>=re?ee++:2047>=re?ee+=2:55296<=re&&57343>=re?(ee+=4,++W):ee+=3}W=ee}else W=P.length;if(ee=IA(4+W+1),re=ee+4,B[ee>>2]=W,D&&Z){if(Z=re,re=W+1,W=y,0<re){re=Z+re-1;for(var ie=0;ie<P.length;++ie){var ae=P.charCodeAt(ie);if(55296<=ae&&57343>=ae){var Ee=P.charCodeAt(++ie);ae=65536+((ae&1023)<<10)|Ee&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)ie=P.charCodeAt(Z),255<ie&&(Ti(re),oe("String has UTF-16 code units that do not fit in 8 bits")),y[re+Z]=ie;else for(Z=0;Z<W;++Z)y[re+Z]=P[Z];return F!==null&&F.push(Ti,ee),ee},argPackAdvance:8,readValueFromPointer:fe,U:function(F){Ti(F)}})},i:function(I,m,D){if(D=te(D),m===2)var F=my,P=Cy,W=vy,Z=()=>C,ee=1;else m===4&&(F=yy,P=By,W=Qy,Z=()=>B,ee=2);bt(I,{name:D,fromWireType:function(re){for(var ie=B[re>>2],ae=Z(),Ee,_e=re+4,ot=0;ot<=ie;++ot){var Pe=re+4+ot*m;(ot==ie||ae[Pe>>ee]==0)&&(_e=F(_e,Pe-_e),Ee===void 0?Ee=_e:(Ee+="\0",Ee+=_e),_e=Pe+m)}return Ti(re),Ee},toWireType:function(re,ie){typeof ie!="string"&&oe("Cannot pass non-string to C++ string type "+D);var ae=W(ie),Ee=IA(4+ae+m);return B[Ee>>2]=ae>>ee,P(ie,Ee+4,ae+m),re!==null&&re.push(Ti,Ee),Ee},argPackAdvance:8,readValueFromPointer:fe,U:function(re){Ti(re)}})},k:function(I,m,D,F,P,W){K[I]={name:te(m),ea:Xt(D,F),V:Xt(P,W),ha:[]}},h:function(I,m,D,F,P,W,Z,ee,re,ie){K[I].ha.push({na:te(m),sa:D,qa:Xt(F,P),ra:W,ya:Z,xa:Xt(ee,re),za:ie})},C:function(I,m){m=te(m),bt(I,{ua:!0,name:m,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(I,m,D,F,P){I=jn[I],m=de(m),D=ed(D);var W=[];return B[F>>2]=Be(W),I(m,D,W,P)},t:function(I,m,D,F){I=jn[I],m=de(m),D=ed(D),I(m,D,null,F)},g:pA,l:function(I,m){var D=wy(I,m),F=D[0];m=F.name+"_$"+D.slice(1).map(function(Z){return Z.name}).join("_")+"$";var P=td[m];if(P!==void 0)return P;var W=Array(I-1);return P=Sy((Z,ee,re,ie)=>{for(var ae=0,Ee=0;Ee<I-1;++Ee)W[Ee]=D[Ee+1].readValueFromPointer(ie+ae),ae+=D[Ee+1].argPackAdvance;for(Z=Z[ee].apply(Z,W),Ee=0;Ee<I-1;++Ee)D[Ee+1].la&&D[Ee+1].la(W[Ee]);if(!F.ua)return F.toWireType(re,Z)}),td[m]=P},q:function(I){4<I&&(ne[I].fa+=1)},r:function(I){var m=de(I);le(m),pA(I)},e:function(){G("")},x:function(I,m,D){y.copyWithin(I,m,m+D)},w:function(I){var m=y.length;if(I>>>=0,2147483648<I)return!1;for(var D=1;4>=D;D*=2){var F=m*(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,m,D,F){for(var P=0,W=0;W<D;W++){var Z=B[m>>2],ee=B[m+4>>2];m+=8;for(var re=0;re<ee;re++){var ie=y[Z+re],ae=Ry[I];ie===0||ie===10?((I===1?c:u)(f(ae,0)),ae.length=0):ae.push(ie)}P+=ee}return B[F>>2]=P,0}};(function(){function I(P){n.asm=P.exports,d=n.asm.D,$(),k=n.asm.I,X.unshift(n.asm.E),R--,n.monitorRunDependencies&&n.monitorRunDependencies(R),R==0&&x&&(P=x,x=null,P())}function m(P){I(P.instance)}function D(P){return U().then(function(W){return WebAssembly.instantiate(W,F)}).then(function(W){return W}).then(P,function(W){u("failed to asynchronously prepare wasm: "+W),G(W)})}var F={a:Ty};if(R++,n.monitorRunDependencies&&n.monitorRunDependencies(R),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"||S(w)||typeof fetch!="function"?D(m):fetch(w,{credentials:"same-origin"}).then(function(P){return WebAssembly.instantiateStreaming(P,F).then(m,function(W){return u("wasm streaming compile failed: "+W),u("falling back to ArrayBuffer instantiation"),D(m)})})}().catch(a),{}})(),n.___wasm_call_ctors=function(){return(n.___wasm_call_ctors=n.asm.E).apply(null,arguments)};var sd=n.___getTypeName=function(){return(sd=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 IA=n._malloc=function(){return(IA=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;x=function I(){zn||rd(),zn||(x=I)};function rd(){function I(){if(!zn&&(zn=!0,n.calledRun=!0,!g)){if(q(X),o(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;){var m=n.postRun.shift();V.unshift(m)}q(V)}}if(!(0<R)){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)z();q(M),0<R||(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 rd(),r.ready}})();s.exports=t})(ml);var qg=ml.exports;(function(s){Object.defineProperty(s,"__esModule",{value:!0});var e={loadYoga:!0};s.loadYoga=o;var t=r(yo),i=Qe;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=qg;async function o(){return(0,t.default)(await n())}})(El);function So({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 jg(s){if(typeof s=="string"){const[e,t]=s.split(":");return Math.min(parseFloat(e),parseFloat(t))}return s}function Xg(s){if(typeof s=="string"){const[e,t]=s.split(":"),i=parseFloat(e),r=parseFloat(t);return i/r}return s}function wo({resolution:s,aspectRatio:e}){const t=jg(s),i=Xg(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}=wo({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 tr({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 Cl({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),b=l*Math.min(1-(d??0),f??1),C=c.getContext("2d");if(C){c.width=y,c.height=b;const x=tr({source:e,sx:p,sy:v,sw:y,sh:b,dx:0,dy:0,dw:y,dh:b});C.drawImage(...x)}const Q=y/b,{sx:B,sy:L,sWidth:_,sHeight:$,scale:k}=zg({resolution:Math.min(o,a),aspectRatio:o/a,format:i,sourceWidth:y,sourceHeight:b}),M=c&&typeof s.filter<"u";if(i==="letterbox"||i==="squarebox"||i==="letterbox-video"&&!M){if(B<0){const x=Math.abs(B)*k;s.fillStyle="black",s.beginPath(),s.rect(r,n,x,a),s.rect(r+o-x,n,x,a),s.fill(),s.closePath()}if(L<0){const x=Math.abs(L)*k;s.fillStyle="black",s.beginPath(),s.rect(r,n,o,x),s.rect(r,n+a-x,o,x),s.fill(),s.closePath()}}if(i==="letterbox-video"&&M){const x=u.getContext("2d");if(x){u.width=y,u.height=b,s.save(),s.globalCompositeOperation="destination-out",s.fillRect(r,n,o,a);const G=tr({source:c,sx:B,sy:L,sw:_,sh:$,dx:r,dy:n,dw:o,dh:a});s.globalCompositeOperation="source-over",s.drawImage(...G),x.save();const S=1.2,w=-(y*S-y)/2,T=-(b*S-b)/2,Y=Math.min(y/20,b/20);if(x.filter=`blur(${Y}px) brightness(20%)`,x.translate(w,T),x.scale(S,S),x.drawImage(c,0,0,y,b),x.restore(),s.globalCompositeOperation="destination-over",B<0){const U=o/Q,q=a/U,se=tr({source:u,sy:(1-q)*b/2,sh:q*b,dx:r,dy:n,dw:o,dh:a});s.drawImage(...se)}if(L<0){const U=a*Q,q=o/U,se=tr({source:u,sx:(1-q)*y/2,sw:q*y,dx:r,dy:n,dw:o,dh:a});s.drawImage(...se)}s.restore()}}else{const x=tr({source:c,sx:B,sy:L,sw:_,sh:$,dx:r,dy:n,dw:o,dh:a});s.drawImage(...x)}const X=B*-1*k,V=L*-1*k,z=o-X*2,R=a-V*2;return{dx:X,dy:V,dw:z,dh:R}}function vl({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 yl=lo(({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,font:s,fontSize: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(jr))==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}`}),vi=1.8;function Bl({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 Ro({context:s,x:e,y:t,width:i,height:r,radii:n,clip:o=!1,debug:a=!1}){Bl({context:s,x:e,y:t,width:i,height:r,radii:n}),a&&(s.strokeStyle="blue",s.stroke()),o&&s.clip()}function Zg({context:s,x:e,y:t,width:i,height:r,radii:n}){Bl({context:s,x:e,y:t,width:i,height:r,radii:n}),s.stroke()}function ef(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 Ql(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 bl(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:b="start"}=t,C={static:s.POSITION_TYPE_STATIC,relative:s.POSITION_TYPE_RELATIVE,absolute:s.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(C[r]),n){const{top:_,right:$,bottom:k,left:M}=ef(n,i);typeof _<"u"&&e.setPosition(s.EDGE_TOP,_),typeof $<"u"&&e.setPosition(s.EDGE_RIGHT,$),typeof k<"u"&&e.setPosition(s.EDGE_BOTTOM,k),typeof M<"u"&&e.setPosition(s.EDGE_LEFT,M)}const Q={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(Q[p]);const B={start:s.ALIGN_FLEX_START,end:s.ALIGN_FLEX_END,center:s.ALIGN_CENTER,stretch:s.ALIGN_STRETCH};e.setAlignItems(B[v]),y&&e.setAlignSelf(B[y]);const L={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(L[b]),g){const{top:_,right:$,bottom:k,left:M}=Ql(g,i);e.setMargin(s.EDGE_TOP,_),e.setMargin(s.EDGE_RIGHT,$),e.setMargin(s.EDGE_BOTTOM,k),e.setMargin(s.EDGE_LEFT,M)}if(f){const{top:_,right:$,bottom:k,left:M}=Ql(f,i);e.setPadding(s.EDGE_TOP,_),e.setPadding(s.EDGE_RIGHT,$),e.setPadding(s.EDGE_BOTTOM,k),e.setPadding(s.EDGE_LEFT,M)}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 Sl({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))),Sl({canvas:s,debug:e,scale:t,position:A}),c.restore()}})}function wl(s,e,t,i){const r=t.map((n,o)=>{const a=s.Node.create(),{radius:A,elements:l=[],draw:c,...u}=n;return bl(s,a,{layout:u,scale:i}),e.insertChild(a,o),{node:a,element:n,childNodes:wl(s,a,l,i)}});return e.calculateLayout(),r}function Rl(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:Rl(s,A,d,g)}})}function xl(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)}xl(r,e)})}function tf({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();bl(s,o,{layout:n}),o.calculateLayout();const{width:a,height:A}=o.getComputedLayout(),l=Math.min(a,A)/1080,c=wl(s,o,i,l);xl(c,l),o.calculateLayout();const u=Rl(o,c);return o.freeRecursive(),Sl({...r,scale:l,canvas:e,position:u})}const sf={linear:bg,easeIn:Io,easeInOut:wg,easeOut:Sg,circIn:gl,circInOut:Rg,circOut:fl,backIn:mo,backInOut:Tg,backOut:xg,anticipate:Dg,bounceIn:Fg,bounceInOut:Ng,bounceOut:Or},Wr=lo((s,e,{clamp:t=!0,ease:i="easeIn",...r}={})=>mg(s,e,{...r,clamp:t,ease:sf[i]}),{cacheKey:([s,e,t])=>JSON.stringify({from:s,to:e,options:t})}),Tl=[{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 qr({text:s,font:e}){let t=e;return Tl.forEach(({family:i,regex:r})=>{r.exec(s)&&(t+=`, ${i}`)}),t}const jr=/(?<value>\d+\.?\d*)(?=px)/;function xo(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 Dl(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=>Dl(r)))}function Ll({yoga:s,debug:e=!1,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o=[],currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:u,sceneDuration:h}){return o.map(d=>{var g,f,p,v,y,b,C,Q;const{node:B,transient:L=[{from:0,duration:1/0}]}=d,_=t.getContext("2d"),$={total:a,content:A,scene:l},k={total:c,content:u,scene:h},{activeTransients:M,inactiveTransients:X}=L.reduce((V,{type:z="scene",from:R,duration:x,animation:G})=>{const S=R<0?k[z]+R:R;return $[z]>=S&&$[z]<=S+x?V.activeTransients.push({type:z,animation:G,duration:x,from:S}):V.inactiveTransients.push({type:z,animation:G,duration:x,from:S}),V},{activeTransients:[],inactiveTransients:[]});if(_&&M.length>0&&Dl(d)){let V=d.width,z=d.height;if((B==null?void 0:B.type)==="text"&&B.value){const{align:R="left"}=B,x=qr({text:B.value,font:B.font});_.save(),_.font=x,_.textBaseline="top",_.textAlign=R,B.wrap?z=({width:G,maxHeight:S,scale:w})=>{var T,Y;const U=yl({font:x,scale:w,context:_,maxW:G,maxH:S,text:B.value??"",minSize:(T=B.fill)==null?void 0:T.minSize,maxSize:(Y=B.fill)==null?void 0:Y.maxSize});return Xr({context:_,font:x,fontSize:U,text:B.value??"",maxW:G}).length*U}:(V=_.measureText(B.value).width,z=parseFloat(((f=(g=x.match(jr))==null?void 0:g.groups)==null?void 0:f.value)??"0")),_.restore()}if((B==null?void 0:B.type)==="image"&&B.image&&B.size){const R=((p=B.image)==null?void 0:p.naturalWidth)??((v=B.image)==null?void 0:v.width),x=((y=B.image)==null?void 0:y.naturalHeight)??((b=B.image)==null?void 0:b.height),G=R/x,S=(C=B.size)==null?void 0:C.width,w=(Q=B.size)==null?void 0:Q.height;V=S??(w??0)*G,z=w??(S??0)/G}return{...d,width:V,height:z,elements:Ll({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:d.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:u,sceneDuration:h}),draw:({dx:R,dy:x,dw:G,dh:S,scale:w})=>{var T,Y,U,q,se,ce,ne,me,be,we,oe,de,Be;if(X.some(ve=>{var ge;return((ge=ve.animation)==null?void 0:ge.type)==="fade"})&&(_.globalAlpha=0),M.forEach(ve=>{const{type:ge="scene",from:te,duration:Se,animation:xe={type:"fade",duration:.3333333333333333,easing:{in:"easeOut",out:"easeOut"}}}=ve;if(xe){const{type:Oe,duration:Te,easing:{in:Fe="easeOut",out:ke="easeOut"}={}}=xe;if(te>0&&$[ge]<=te+Te)switch(Oe){case"fade":{const Ce=Wr([te,te+Te],[0,1],{ease:Fe});_.globalAlpha=Ce($[ge]);break}case"slide":{const{options:Ce}=xe,Ke={up:[{x:0,y:S},{x:0,y:0}],right:[{x:G,y:0},{x:0,y:0}],down:[{x:0,y:-S},{x:0,y:0}],left:[{x:-G,y:0},{x:0,y:0}]},Xe=Wr([te,te+Te],Ke[Ce.direction.in],{ease:Fe}),{x:nt,y:Ve}=Xe($[ge]);_.translate(nt,Ve);break}}if(te+Se<k[ge]&&te+Se-Te<=$[ge])switch(Oe){case"fade":{const Ce=Wr([te+Se-Te,te+Se],[1,0],{ease:ke});_.globalAlpha=Ce($[ge]);break}case"slide":{const{options:Ce}=xe,Ke={up:[{x:0,y:0},{x:0,y:-S}],right:[{x:0,y:0},{x:G,y:0}],down:[{x:0,y:0},{x:0,y:S}],left:[{x:0,y:0},{x:-G,y:0}]},Xe=Wr([te+Se-Te,te+Se],Ke[Ce.direction.out],{ease:ke}),{x:nt,y:Ve}=Xe($[ge]);_.translate(nt,Ve);break}}}}),B){const{type:ve}=B;if(ve==="box"&&B.shadow){const{shadow:{color:ge="rgba(0, 0, 0, 0.5)",blur:te=0,offset:{x:Se=0,y:xe=0}={}}={}}=B;if(_.save(),_.fillStyle=ge,_.shadowColor=ge,_.shadowBlur=te,_.shadowOffsetX=Se+G+t.width,_.shadowOffsetY=xe+S+t.height,_.beginPath(),!d.radius)_.rect(R-G-t.width,x-S-t.height,G,S);else{const{topLeft:Oe,topRight:Te,bottomRight:Fe,bottomLeft:ke}=xo(d.radius,w);Ro({debug:e,context:_,x:R-G-t.width,y:x-S-t.height,width:G,height:S,radii:[Oe,Te,Fe,ke]})}_.fill(),_.closePath(),_.restore()}if(ve==="box"&&B.border){const{border:{color:ge="black",width:te=0}}=B;if(te){const{topLeft:Se,topRight:xe,bottomRight:Oe,bottomLeft:Te}=xo(d.radius,w);_.save(),_.lineWidth=te*w,_.strokeStyle=ge,Zg({context:_,x:R,y:x,width:G,height:S,radii:[Se,xe,Oe,Te]}),_.restore()}}if(d.radius){const{topLeft:ge,topRight:te,bottomRight:Se,bottomLeft:xe}=xo(d.radius,w);Ro({debug:e,context:_,x:R,y:x,width:G,height:S,radii:[ge,te,Se,xe],clip:!0})}if(ve==="box"&&B.background&&(_.save(),_.fillStyle=B.background,_.fillRect(R,x,G,S),_.restore()),ve==="text"&&B.value){const{align:ge="left"}=B,te=qr({text:B.value,font:B.font}),Se=yl({font:te,scale:w,context:_,maxW:G,maxH:S,text:B.value??"",minSize:(T=B.fill)==null?void 0:T.minSize,maxSize:(Y=B.fill)==null?void 0:Y.maxSize});_.font=te.replace(jr,Se.toString()),_.textBaseline="top",_.fillStyle=B.color,_.textAlign=ge;const xe={left:R,center:R+G/2,right:R+G};B.wrap?Xr({context:_,font:te,fontSize:Se,text:B.value,maxW:G}).forEach((Te,Fe)=>{_.fillText(Te.text,xe[ge],x+Se*Fe)}):_.fillText(B.value,xe[ge],x)}if(ve==="image"&&B.image&&_.drawImage(B.image,R,x,G,S),ve==="video"&&((U=B.video)!=null&&U.node||(q=B.video)!=null&&q.getSource)){const ge=B.format??"letterbox",te=((ce=(se=B.video)==null?void 0:se.getSource)==null?void 0:ce.call(se,l))??B.video.node,Se=(te==null?void 0:te.videoWidth)??(te==null?void 0:te.naturalWidth)??(te==null?void 0:te.width),xe=(te==null?void 0:te.videoHeight)??(te==null?void 0:te.naturalHeight)??(te==null?void 0:te.height);if(Se&&xe){const{dx:Te,dy:Fe,dw:ke,dh:Ce}=Cl({context:_,cropCanvas:i,letterboxCanvas:n,source:te,format:ge,crop:(ne=B==null?void 0:B.value)==null?void 0:ne.crop,sourceWidth:Se,sourceHeight:xe,posX:R,posY:x,drawAreaWidth:G,drawAreaHeight:S});B.elements&&To({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:B.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:u,sceneDuration:h,origin:{inset:{top:Math.max(x,x+Fe),left:Math.max(R,R+Te)},width:Math.min(G,ke),height:Math.min(S,Ce)}})}const Oe=1/3;if(B.poster&&a>=0&&a<=Oe){_.save(),_.globalAlpha=1-a/Oe;const Te=((me=B.poster)==null?void 0:me.naturalWidth)??((be=B.poster)==null?void 0:be.width),Fe=((we=B.poster)==null?void 0:we.naturalHeight)??((oe=B.poster)==null?void 0:oe.height);r.width=r.height=0,r.width=G,r.height=S;const ke=r.getContext("2d");if(ke&&Te&&Fe){const{dx:Ce,dy:Ke,dw:Xe,dh:nt}=Cl({context:ke,cropCanvas:i,letterboxCanvas:n,source:B.poster,format:ge,crop:(de=B==null?void 0:B.value)==null?void 0:de.crop,sourceWidth:Te,sourceHeight:Fe,posX:0,posY:0,drawAreaWidth:G,drawAreaHeight:S});B.elements&&To({yoga:s,debug:e,canvas:r,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:B.elements,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:u,sceneDuration:h,origin:{inset:{top:Math.max(0,Ke),left:Math.max(0,Ce)},width:Math.min(G,Xe),height:Math.min(S,nt)}}),_.drawImage(r,R,x,G,S),_.restore()}}}if(ve==="gradient"&&B.value){const ge=_.createLinearGradient(R+G,x,R+G,x+S);(Be=B.value)==null||Be.forEach(te=>{ge.addColorStop(te.percent,te.color)}),_.fillStyle=ge,_.fillRect(R,x,G,S)}}}}}}).filter(Boolean)}function To({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:u,sceneDuration:h,...d}){return tf({...d,yoga:s,debug:e,canvas:t,elements:Ll({yoga:s,debug:e,canvas:t,cropCanvas:i,posterCanvas:r,letterboxCanvas:n,elements:o,currentTime:a,contentTime:A,sceneTime:l,totalDuration:c,contentDuration:u,sceneDuration:h})})}const Xr=lo(({context:s,font:e,fontSize:t,text:i,maxW:r=1/0})=>{try{return s.save(),s.font=e.replace(jr,t.toString()),i.split(`
68
+ `).flatMap(o=>{const a=o.split(" ").filter(Boolean);return a.length?a.slice(1).reduce((A,l)=>{const u=`${A[A.length-1].text} ${l}`.trim(),h=s.measureText(u);return h.width>r?A=[...A,...vl({context:s,word:l,maxW:r})]:A[A.length-1]={text:u,metrics:h},A},vl({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}`}),rf=/\d{0,2}:?\d{2}:\d{2}\.\d{3}\s-->\s\d{0,2}:?\d{2}:\d{2}\.\d{3}\s{1,2}.*/g,nf=/\d{0,2}:?\d{2}:\d{2}\.\d{3}/g;function _l(s){if(!s)return[];const e=s.match(rf);return e?e==null?void 0:e.map(t=>{const[i,r]=t.replace(`\r
69
69
  `,`
70
70
  `).split(`
71
- `),[n,o]=i.match(nf)||[];return{start:n,end:o,text:r}}):[]}function zr(s){const[e,t,i]=s.split(":");return i?parseInt(e)*60*60+parseInt(t)*60+parseFloat(i):parseInt(e)*60+parseInt(t)}function of({canvas:s,dx:e,dy:t,dw:i,dh:r,sceneTime:n,vttCaptions:o}){var a;if(o){const l=_l(o).find(({start:c,end:h})=>c&&h&&n>=zr(c)&&n<zr(h));if((a=l==null?void 0:l.text)!=null&&a.trim()){const c=s.getContext("2d");if(c){const h=Math.min(i,r),u=h*.04,d=qr({text:o,font:`400 ${u}px Roobert Captions`});c.font=d,c.textBaseline="middle";const g=i*.9,f=Xr({context:c,font:d,fontSize:u,text:l.text,maxW:g});f.forEach(({text:p,metrics:v},y)=>{const b=e+(i-v.width)/2,C=t+(r*.85-(u+h*.03)*(f.length-1-y)),Q=u*.8,B=u/1.5,L=e+(i-v.width-B)/2,_=C-Q,K=v.width+B,k=Q*2,O=c.globalAlpha;c.save(),c.globalAlpha=.8*O,c.fillStyle="#000000",c.beginPath(),Ro({context:c,x:L,y:_,width:K,height:k,radii:h*.01}),c.fill(),c.closePath(),c.globalAlpha=O,c.fillStyle="#FFFFFF",c.fillText(p,b,C),c.restore()})}}}}let Zr;const af=new Uint8Array(16);function Af(){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(af)}const Et=[];for(let s=0;s<256;++s)Et.push((s+256).toString(16).slice(1));function lf(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 kl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function cf(s,e,t){if(kl.randomUUID&&!e&&!s)return kl.randomUUID();s=s||{};const i=s.random||(s.rng||Af)();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 lf(i)}const hf={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:`[
71
+ `),[n,o]=i.match(nf)||[];return{start:n,end:o,text:r}}):[]}function zr(s){const[e,t,i]=s.split(":");return i?parseInt(e)*60*60+parseInt(t)*60+parseFloat(i):parseInt(e)*60+parseInt(t)}function of({canvas:s,dx:e,dy:t,dw:i,dh:r,sceneTime:n,vttCaptions:o}){var a;if(o){const l=_l(o).find(({start:c,end:u})=>c&&u&&n>=zr(c)&&n<zr(u));if((a=l==null?void 0:l.text)!=null&&a.trim()){const c=s.getContext("2d");if(c){const u=Math.min(i,r),h=u*.04,d=qr({text:o,font:`400 ${h}px Roobert Captions`});c.font=d,c.textBaseline="middle";const g=i*.9,f=Xr({context:c,font:d,fontSize:h,text:l.text,maxW:g});f.forEach(({text:p,metrics:v},y)=>{const b=e+(i-v.width)/2,C=t+(r*.85-(h+u*.03)*(f.length-1-y)),Q=h*.8,B=h/1.5,L=e+(i-v.width-B)/2,_=C-Q,$=v.width+B,k=Q*2,M=c.globalAlpha;c.save(),c.globalAlpha=.8*M,c.fillStyle="#000000",c.beginPath(),Ro({context:c,x:L,y:_,width:$,height:k,radii:u*.01}),c.fill(),c.closePath(),c.globalAlpha=M,c.fillStyle="#FFFFFF",c.fillText(p,b,C),c.restore()})}}}}let Zr;const af=new Uint8Array(16);function Af(){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(af)}const Et=[];for(let s=0;s<256;++s)Et.push((s+256).toString(16).slice(1));function lf(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 kl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function cf(s,e,t){if(kl.randomUUID&&!e&&!s)return kl.randomUUID();s=s||{};const i=s.random||(s.rng||Af)();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 lf(i)}const uf={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%",
@@ -149,52 +149,52 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
149
149
  "playlist": {{ it._derived?.playlist }},
150
150
  "preview": {{ it._derived?.preview }},
151
151
  "captions": {{ it._derived?.captions }}
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 uf(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Xu);return new s.Image}return new Image}const Fl=Kt(async function(e){return e?new Promise((t,i)=>{uf().then(r=>{r.onload=()=>{t(r)},r.onerror=n=>{i(n)},r.src=e})}):null});async function Do({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 Fl(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 Fl(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=>Do({element:l,meta:e},t,i)))),s.elements&&(a.elements=await Promise.all(s.elements.map(l=>Do({element:l,meta:e},t,i)))),a}async function en(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Xu),e=new s.Canvas;return e.gpu=!1,e}return document.createElement("canvas")}function ir(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=ir(t==null?void 0:t.elements);if(i)return i}}function df(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 gf(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 ff(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 tn(s){return s.flatMap(e=>Array.isArray(e)?e.flatMap(t=>t):e).reduce((e,t)=>e+t,0)}const pf=Kt(()=>El.loadYoga());vo.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${ff(s)}"`:gf(s)||Array.isArray(s)?JSON.stringify(s):s);const us=(s,e,t)=>vo.render(s,e,vo.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function ds({data:s,template:e,burnCaptions:t=!1,debug:i=!1},r,n,o){var a,A,l,c;const h=await pf(),u=e??hf;if(!((a=u.templates)!=null&&a.length))throw new Error(`No templates found for template instance: ${u.id}`);let d=u.templates.find(({version:k})=>k===Lo);if(!d){const k=u.templates.map(({version:O})=>`"${O}"`).join(", ");console.warn(`Template renderer expects template version "${Lo}" but got ${k}`),d=u.templates[u.templates.length-1]}const g=await Promise.all(d.content.map(async({scenes:k,root:O})=>{const X={...u.options,...s,intro:u.intro,outro:u.outro};async function V(q,S){return Promise.all(k.map(async({layout:R,duration:G,data:x,derived:w,options:T})=>{var $,U,j;const ie={...X,_index:S,_root:q,_derived:await r({data:s,rootData:q,index:S})},he=x?JSON.parse(await us(x,ie)):{},re=w?JSON.parse(await us(w,ie)):{},ve=T?JSON.parse(await us(T,ie)):{},Qe=G?parseFloat(await us(G,ie)):NaN,be=($=d.layouts.find(le=>le.name===R))==null?void 0:$.tree;if(!be)throw new Error(`Layout tree "${R}" not found in template "${d.id}" layouts.`);const ne=JSON.parse(await us(be,{...he,...re,...ve})),fe=await Promise.all(ne.flatMap(le=>Do({element:le,meta:u.meta},n,o))),Ce=ir(fe);return{duration:(isNaN(Qe)?null:Qe)??((U=Ce==null?void 0:Ce.meta)==null?void 0:U.duration)??0,captions:(j=Ce==null?void 0:Ce.meta)==null?void 0:j.captions,elements:fe}}))}if(O){const q=JSON.parse(await us(O,X));return Array.isArray(q)?Promise.all(q.map(async(S,R)=>V(S,R))):Promise.all([V(q,null)])}return Promise.all([V(s,null)])}));if(g.every(k=>k.every(O=>O.every(X=>{const V=ir(X.elements);return!(V!=null&&V.value.src)&&!(V!=null&&V.value.playlist)})))){const k=g.flatMap(O=>O.flatMap(X=>X.map(V=>{const q=ir(V.elements);return!(q!=null&&q.value.src)&&!(q!=null&&q.value.playlist)&&(q==null?void 0:q.value.id)}).filter(Boolean))).join(", ");throw new Error(`Video(s) with ID ${k} failed to load, video can not be processed`)}if(g.every(k=>k.every(O=>O.every(X=>X.duration<=0))))throw new Error("No scenes have any duration, video can not be processed");const v=g.reduce((k,O)=>{const X=O.reduce((V,q)=>{const S=q.filter(R=>R.duration>0);return S.length>0?[...V,S]:V},[]);return X.length>0?[...k,X]:k},[]),y=((A=u.meta)==null?void 0:A.frameRate)??30,b=((l=u.meta)==null?void 0:l.resolution)??1080,C=((c=u.meta)==null?void 0:c.transitionDuration)??1/3,Q=df(v,C),B=tn(Q),L=await Promise.all(v.map((k,O)=>{const X=tn(Q[O]),V=tn(Q.slice(0,O));return Promise.all(k.map((q,S)=>Promise.all(q.map(async({duration:R,captions:G,elements:x},w)=>{var T,$;const U=await en(),j=await en(),ie=await en(),he=await en(),re=ir(x),ve=tn([...Q.slice(0,O),...Q[O].slice(0,S),...Q[O][S].slice(0,w)]);return{draw:({canvas:be,currentTime:ne})=>{const fe=Math.max(0,ne-V),Ce=Math.max(0,ne-ve);To({yoga:h,debug:i,canvas:be,cropCanvas:U,posterCanvas:he,letterboxCanvas:j,elements:x,currentTime:ne,contentTime:fe,sceneTime:Ce,totalDuration:B,contentDuration:X,sceneDuration:R}),G&&t&&of({canvas:be,dx:0,dy:0,dw:be.width,dh:be.height,vttCaptions:G,sceneTime:Ce+((re==null?void 0:re.meta.start)??0)})},duration:R,transitionCanvas:ie,id:cf(),start:ve,video:re==null?void 0:re.video,videoMeta:re==null?void 0:re.meta,audio:{duration:R,src:(T=re==null?void 0:re.value)==null?void 0:T.src,start:($=re==null?void 0:re.meta)==null?void 0:$.start}}}))))})),_=L.flatMap(k=>k);return{scenes:_.flatMap(k=>k),sections:_,contents:L,frameRate:y,resolution:b,transitionDuration:C,fonts:d.fonts??[],duration:B}}const Lo="3",Ef={name:"@vouchfor/embeds",version:"3.0.2",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:"latest",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":"^8.2.1","@vouchfor/media-player":"^4.0.2",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":"^1.2.1","@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 If(s){const{publicApiUrl:e}=_r(s),t=_i();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function mf(s){var n,o,a,A,l,c,h,u,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=If(s),(u=(h=window.localStorage)==null?void 0:h.setItem)==null||u.call(h,"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 Cf(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function vf(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:Ef.version,templateVersion:Lo,...i}}const Nl=1;class yf{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=Cf(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}=_r(this.host.env),{client:i,tab:r,request:n,visitor:o}=mf(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":vf(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Nl&&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]+Nl&&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 _o={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Pr<"u"&&Pr,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]"],h=ArrayBuffer.isView||function(S){return S&&c.indexOf(Object.prototype.toString.call(S))>-1};function u(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 R={next:function(){var G=S.shift();return{done:G===void 0,value:G}}};return A.iterable&&(R[Symbol.iterator]=function(){return R}),R}function f(S){this.map={},S instanceof f?S.forEach(function(R,G){this.append(G,R)},this):Array.isArray(S)?S.forEach(function(R){this.append(R[0],R[1])},this):S&&Object.getOwnPropertyNames(S).forEach(function(R){this.append(R,S[R])},this)}f.prototype.append=function(S,R){S=u(S),R=d(R);var G=this.map[S];this.map[S]=G?G+", "+R:R},f.prototype.delete=function(S){delete this.map[u(S)]},f.prototype.get=function(S){return S=u(S),this.has(S)?this.map[S]:null},f.prototype.has=function(S){return this.map.hasOwnProperty(u(S))},f.prototype.set=function(S,R){this.map[u(S)]=d(R)},f.prototype.forEach=function(S,R){for(var G in this.map)this.map.hasOwnProperty(G)&&S.call(R,this.map[G],G,this)},f.prototype.keys=function(){var S=[];return this.forEach(function(R,G){S.push(G)}),g(S)},f.prototype.values=function(){var S=[];return this.forEach(function(R){S.push(R)}),g(S)},f.prototype.entries=function(){var S=[];return this.forEach(function(R,G){S.push([G,R])}),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(R,G){S.onload=function(){R(S.result)},S.onerror=function(){G(S.error)}})}function y(S){var R=new FileReader,G=v(R);return R.readAsArrayBuffer(S),G}function b(S){var R=new FileReader,G=v(R);return R.readAsText(S),G}function C(S){for(var R=new Uint8Array(S),G=new Array(R.length),x=0;x<R.length;x++)G[x]=String.fromCharCode(R[x]);return G.join("")}function Q(S){if(S.slice)return S.slice(0);var R=new Uint8Array(S.byteLength);return R.set(new Uint8Array(S)),R.buffer}function B(){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=Q(S.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(S)||h(S))?this._bodyArrayBuffer=Q(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 b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(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 L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(S){var R=S.toUpperCase();return L.indexOf(R)>-1?R:S}function K(S,R){if(!(this instanceof K))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R=R||{};var G=R.body;if(S instanceof K){if(S.bodyUsed)throw new TypeError("Already read");this.url=S.url,this.credentials=S.credentials,R.headers||(this.headers=new f(S.headers)),this.method=S.method,this.mode=S.mode,this.signal=S.signal,!G&&S._bodyInit!=null&&(G=S._bodyInit,S.bodyUsed=!0)}else this.url=String(S);if(this.credentials=R.credentials||this.credentials||"same-origin",(R.headers||!this.headers)&&(this.headers=new f(R.headers)),this.method=_(R.method||this.method||"GET"),this.mode=R.mode||this.mode||null,this.signal=R.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&G)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(G),(this.method==="GET"||this.method==="HEAD")&&(R.cache==="no-store"||R.cache==="no-cache")){var x=/([?&])_=[^&]*/;if(x.test(this.url))this.url=this.url.replace(x,"$1_="+new Date().getTime());else{var w=/\?/;this.url+=(w.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}K.prototype.clone=function(){return new K(this,{body:this._bodyInit})};function k(S){var R=new FormData;return S.trim().split("&").forEach(function(G){if(G){var x=G.split("="),w=x.shift().replace(/\+/g," "),T=x.join("=").replace(/\+/g," ");R.append(decodeURIComponent(w),decodeURIComponent(T))}}),R}function O(S){var R=new f,G=S.replace(/\r?\n[\t ]+/g," ");return G.split("\r").map(function(x){return x.indexOf(`
153
- `)===0?x.substr(1,x.length):x}).forEach(function(x){var w=x.split(":"),T=w.shift().trim();if(T){var $=w.join(":").trim();R.append(T,$)}}),R}B.call(K.prototype);function X(S,R){if(!(this instanceof X))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');R||(R={}),this.type="default",this.status=R.status===void 0?200:R.status,this.ok=this.status>=200&&this.status<300,this.statusText=R.statusText===void 0?"":""+R.statusText,this.headers=new f(R.headers),this.url=R.url||"",this._initBody(S)}B.call(X.prototype),X.prototype.clone=function(){return new X(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},X.error=function(){var S=new X(null,{status:0,statusText:""});return S.type="error",S};var V=[301,302,303,307,308];X.redirect=function(S,R){if(V.indexOf(R)===-1)throw new RangeError("Invalid status code");return new X(null,{status:R,headers:{location:S}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(R,G){this.message=R,this.name=G;var x=Error(R);this.stack=x.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function q(S,R){return new Promise(function(G,x){var w=new K(S,R);if(w.signal&&w.signal.aborted)return x(new o.DOMException("Aborted","AbortError"));var T=new XMLHttpRequest;function $(){T.abort()}T.onload=function(){var j={status:T.status,statusText:T.statusText,headers:O(T.getAllResponseHeaders()||"")};j.url="responseURL"in T?T.responseURL:j.headers.get("X-Request-URL");var ie="response"in T?T.response:T.responseText;setTimeout(function(){G(new X(ie,j))},0)},T.onerror=function(){setTimeout(function(){x(new TypeError("Network request failed"))},0)},T.ontimeout=function(){setTimeout(function(){x(new TypeError("Network request failed"))},0)},T.onabort=function(){setTimeout(function(){x(new o.DOMException("Aborted","AbortError"))},0)};function U(j){try{return j===""&&a.location.href?a.location.href:j}catch{return j}}T.open(w.method,U(w.url),!0),w.credentials==="include"?T.withCredentials=!0:w.credentials==="omit"&&(T.withCredentials=!1),"responseType"in T&&(A.blob?T.responseType="blob":A.arrayBuffer&&w.headers.get("Content-Type")&&w.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(T.responseType="arraybuffer")),R&&typeof R.headers=="object"&&!(R.headers instanceof f)?Object.getOwnPropertyNames(R.headers).forEach(function(j){T.setRequestHeader(j,d(R.headers[j]))}):w.headers.forEach(function(j,ie){T.setRequestHeader(ie,j)}),w.signal&&(w.signal.addEventListener("abort",$),T.onreadystatechange=function(){T.readyState===4&&w.signal.removeEventListener("abort",$)}),T.send(typeof w._bodyInit>"u"?null:w._bodyInit)})}return q.polyfill=!0,a.fetch||(a.fetch=q,a.Headers=f,a.Request=K,a.Response=X),o.Headers=f,o.Request=K,o.Response=X,o.fetch=q,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})(_o,_o.exports);var Bf=_o.exports;const Ml=pl(Bf);async function Qf(s){var e;try{if((e=await Ml(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function ko({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=>Qf(o));e=(await Promise.all(n)).find(Boolean)}return e}async function bf(s){try{return(await Ml(s)).text()}catch{return null}}async function Sf(s){return s=s.trim(),s.startsWith("http")||s.startsWith("blob:")?bf(s):s}const wf=Kt(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?Sf(A):null},{cacheKey:([s,{language:e}])=>JSON.stringify({...s,language:e})}),Rf=Kt(async s=>{var e,t,i,r,n,o,a,A,l,c,h;const[u,d,g]=await Promise.all([ko({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]}),ko({sources:[(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist]}),ko({sources:[((A=(a=s==null?void 0:s.answer)==null?void 0:a.media)==null?void 0:A.reducedQuality)??((h=(c=(l=s==null?void 0:s.answer)==null?void 0:l.media)==null?void 0:c.videos)==null?void 0:h.xs)]})]);return{src:u,playlist:d,preview:g}},{cacheKey:([s])=>{var e,t,i,r,n,o,a,A,l,c,h;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)??((h=(c=(l=s==null?void 0:s.answer)==null?void 0:l.media)==null?void 0:c.videos)==null?void 0:h.xs)})}});function xf(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"?"":((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"?"":((u=(h=(c=(l=s==null?void 0:s.answer)==null?void 0:l.contact)==null?void 0:c.client)==null?void 0:h.name)==null?void 0:u.trim())??"",[f,p]=d.split(" ");return{name:d,firstName:f,lastName:p,companyName:g}}const Tf=Kt(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 Fo({data:s,rootData:e,index:t},i){var r,n,o,a,A,l,c,h,u,d,g,f,p,v;const[y,b,C]=await Promise.all([Tf(s,e,t),Rf(e),wf({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)??((h=(c=e==null?void 0:e.answer)==null?void 0:c.captions)==null?void 0:h.translation),originalLanguage:(d=(u=e==null?void 0:e.answer)==null?void 0:u.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{...b,...xf(e),key:y,captions:C,answerLabel:((v=e==null?void 0:e.answer)==null?void 0:v.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 Df({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.transcription)==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.transcription)==null?void 0:l.translation)==null?void 0:c.language)==null?void 0:h.split("-")[0];return u&&sn[u]&&!i.find(g=>g.value===u)&&i.push({value:u,label:sn[u]}),d&&sn[d]&&!i.find(g=>g.value===d)&&i.push({value:d,label:sn[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 hf(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Xh);return new s.Image}return new Image}const Fl=Kt(async function(e){return e?new Promise((t,i)=>{hf().then(r=>{r.onload=()=>{t(r)},r.onerror=n=>{i(n)},r.src=e})}):null});async function Do({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 Fl(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 Fl(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=>Do({element:l,meta:e},t,i)))),s.elements&&(a.elements=await Promise.all(s.elements.map(l=>Do({element:l,meta:e},t,i)))),a}async function en(){if(typeof window>"u"){const s=await Promise.resolve().then(()=>Xh),e=new s.Canvas;return e.gpu=!1,e}return document.createElement("canvas")}function ir(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=ir(t==null?void 0:t.elements);if(i)return i}}function df(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 gf(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 ff(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 tn(s){return s.flatMap(e=>Array.isArray(e)?e.flatMap(t=>t):e).reduce((e,t)=>e+t,0)}const pf=Kt(()=>El.loadYoga());vo.filters.define("parse",s=>typeof s>"u"?null:typeof s=="string"?`"${ff(s)}"`:gf(s)||Array.isArray(s)?JSON.stringify(s):s);const hs=(s,e,t)=>vo.render(s,e,vo.getConfig({autoEscape:!1,defaultFilter:"parse",...t}));async function ds({data:s,template:e,burnCaptions:t=!1,debug:i=!1},r,n,o){var a,A,l,c;const u=await pf(),h=e??uf;if(!((a=h.templates)!=null&&a.length))throw new Error(`No templates found for template instance: ${h.id}`);let d=h.templates.find(({version:k})=>k===Lo);if(!d){const k=h.templates.map(({version:M})=>`"${M}"`).join(", ");console.warn(`Template renderer expects template version "${Lo}" but got ${k}`),d=h.templates[h.templates.length-1]}const g=await Promise.all(d.content.map(async({scenes:k,root:M})=>{const X={...h.options,...s,intro:h.intro,outro:h.outro};async function V(z,R){return Promise.all(k.map(async({layout:x,duration:G,data:S,derived:w,options:T})=>{var Y,U,q;const se={...X,_index:R,_root:z,_derived:await r({data:s,rootData:z,index:R})},ce=S?JSON.parse(await hs(S,se)):{},ne=w?JSON.parse(await hs(w,se)):{},me=T?JSON.parse(await hs(T,se)):{},be=G?parseFloat(await hs(G,se)):NaN,we=(Y=d.layouts.find(ge=>ge.name===x))==null?void 0:Y.tree;if(!we)throw new Error(`Layout tree "${x}" not found in template "${d.id}" layouts.`);const oe=JSON.parse(await hs(we,{...ce,...ne,...me})),de=await Promise.all(oe.flatMap(ge=>Do({element:ge,meta:h.meta},n,o))),Be=ir(de);return{duration:(isNaN(be)?null:be)??((U=Be==null?void 0:Be.meta)==null?void 0:U.duration)??0,captions:(q=Be==null?void 0:Be.meta)==null?void 0:q.captions,elements:de}}))}if(M){const z=JSON.parse(await hs(M,X));return Array.isArray(z)?Promise.all(z.map(async(R,x)=>V(R,x))):Promise.all([V(z,null)])}return Promise.all([V(s,null)])}));if(g.every(k=>k.every(M=>M.every(X=>{const V=ir(X.elements);return!(V!=null&&V.value.src)&&!(V!=null&&V.value.playlist)})))){const k=g.flatMap(M=>M.flatMap(X=>X.map(V=>{const z=ir(V.elements);return!(z!=null&&z.value.src)&&!(z!=null&&z.value.playlist)&&(z==null?void 0:z.value.id)}).filter(Boolean))).join(", ");throw new Error(`Video(s) with ID ${k} failed to load, video can not be processed`)}if(g.every(k=>k.every(M=>M.every(X=>X.duration<=0))))throw new Error("No scenes have any duration, video can not be processed");const v=g.reduce((k,M)=>{const X=M.reduce((V,z)=>{const R=z.filter(x=>x.duration>0);return R.length>0?[...V,R]:V},[]);return X.length>0?[...k,X]:k},[]),y=((A=h.meta)==null?void 0:A.frameRate)??30,b=((l=h.meta)==null?void 0:l.resolution)??1080,C=((c=h.meta)==null?void 0:c.transitionDuration)??1/3,Q=df(v,C),B=tn(Q),L=await Promise.all(v.map((k,M)=>{const X=tn(Q[M]),V=tn(Q.slice(0,M));return Promise.all(k.map((z,R)=>Promise.all(z.map(async({duration:x,captions:G,elements:S},w)=>{var T,Y;const U=await en(),q=await en(),se=await en(),ce=await en(),ne=ir(S),me=tn([...Q.slice(0,M),...Q[M].slice(0,R),...Q[M][R].slice(0,w)]);return{draw:({canvas:we,currentTime:oe})=>{const de=Math.max(0,oe-V),Be=Math.max(0,oe-me);To({yoga:u,debug:i,canvas:we,cropCanvas:U,posterCanvas:ce,letterboxCanvas:q,elements:S,currentTime:oe,contentTime:de,sceneTime:Be,totalDuration:B,contentDuration:X,sceneDuration:x}),G&&t&&of({canvas:we,dx:0,dy:0,dw:we.width,dh:we.height,vttCaptions:G,sceneTime:Be+((ne==null?void 0:ne.meta.start)??0)})},duration:x,transitionCanvas:se,id:cf(),start:me,video:ne==null?void 0:ne.video,videoMeta:ne==null?void 0:ne.meta,audio:{duration:x,src:(T=ne==null?void 0:ne.value)==null?void 0:T.src,start:(Y=ne==null?void 0:ne.meta)==null?void 0:Y.start}}}))))})),_=L.flatMap(k=>k);return{scenes:_.flatMap(k=>k),sections:_,contents:L,frameRate:y,resolution:b,transitionDuration:C,fonts:d.fonts??[],duration:B}}const Lo="3",Ef={name:"@vouchfor/embeds",version:"3.1.1",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:"latest",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":"^8.2.2","@vouchfor/media-player":"^4.1.1",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":"^1.3.1","@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 If(s){const{publicApiUrl:e}=_r(s),t=_i();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function mf(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=If(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 Cf(s,e){return s&&"vouchId"in s?s.vouchId:(e==null?void 0:e.id)??null}function vf(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:Ef.version,templateVersion:Lo,...i}}const Nl=1;class yf{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,i)=>{const r=Cf(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}=_r(this.host.env),{client:i,tab:r,request:n,visitor:o}=mf(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":vf(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:i}=this._currentlyPlayingVideo;this._streamLatestTime[i]>this._streamStartTime[i]+Nl&&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]+Nl&&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 _o={exports:{}};(function(s,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Pr<"u"&&Pr,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(R){return R&&DataView.prototype.isPrototypeOf(R)}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(R){return R&&c.indexOf(Object.prototype.toString.call(R))>-1};function h(R){if(typeof R!="string"&&(R=String(R)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(R)||R==="")throw new TypeError('Invalid character in header field name: "'+R+'"');return R.toLowerCase()}function d(R){return typeof R!="string"&&(R=String(R)),R}function g(R){var x={next:function(){var G=R.shift();return{done:G===void 0,value:G}}};return A.iterable&&(x[Symbol.iterator]=function(){return x}),x}function f(R){this.map={},R instanceof f?R.forEach(function(x,G){this.append(G,x)},this):Array.isArray(R)?R.forEach(function(x){this.append(x[0],x[1])},this):R&&Object.getOwnPropertyNames(R).forEach(function(x){this.append(x,R[x])},this)}f.prototype.append=function(R,x){R=h(R),x=d(x);var G=this.map[R];this.map[R]=G?G+", "+x:x},f.prototype.delete=function(R){delete this.map[h(R)]},f.prototype.get=function(R){return R=h(R),this.has(R)?this.map[R]:null},f.prototype.has=function(R){return this.map.hasOwnProperty(h(R))},f.prototype.set=function(R,x){this.map[h(R)]=d(x)},f.prototype.forEach=function(R,x){for(var G in this.map)this.map.hasOwnProperty(G)&&R.call(x,this.map[G],G,this)},f.prototype.keys=function(){var R=[];return this.forEach(function(x,G){R.push(G)}),g(R)},f.prototype.values=function(){var R=[];return this.forEach(function(x){R.push(x)}),g(R)},f.prototype.entries=function(){var R=[];return this.forEach(function(x,G){R.push([G,x])}),g(R)},A.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function p(R){if(R.bodyUsed)return Promise.reject(new TypeError("Already read"));R.bodyUsed=!0}function v(R){return new Promise(function(x,G){R.onload=function(){x(R.result)},R.onerror=function(){G(R.error)}})}function y(R){var x=new FileReader,G=v(x);return x.readAsArrayBuffer(R),G}function b(R){var x=new FileReader,G=v(x);return x.readAsText(R),G}function C(R){for(var x=new Uint8Array(R),G=new Array(x.length),S=0;S<x.length;S++)G[S]=String.fromCharCode(x[S]);return G.join("")}function Q(R){if(R.slice)return R.slice(0);var x=new Uint8Array(R.byteLength);return x.set(new Uint8Array(R)),x.buffer}function B(){return this.bodyUsed=!1,this._initBody=function(R){this.bodyUsed=this.bodyUsed,this._bodyInit=R,R?typeof R=="string"?this._bodyText=R:A.blob&&Blob.prototype.isPrototypeOf(R)?this._bodyBlob=R:A.formData&&FormData.prototype.isPrototypeOf(R)?this._bodyFormData=R:A.searchParams&&URLSearchParams.prototype.isPrototypeOf(R)?this._bodyText=R.toString():A.arrayBuffer&&A.blob&&l(R)?(this._bodyArrayBuffer=Q(R.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):A.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(R)||u(R))?this._bodyArrayBuffer=Q(R):this._bodyText=R=Object.prototype.toString.call(R):this._bodyText="",this.headers.get("content-type")||(typeof R=="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(R)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},A.blob&&(this.blob=function(){var R=p(this);if(R)return R;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 R=p(this);return R||(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 R=p(this);if(R)return R;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(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 L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(R){var x=R.toUpperCase();return L.indexOf(x)>-1?x:R}function $(R,x){if(!(this instanceof $))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');x=x||{};var G=x.body;if(R instanceof $){if(R.bodyUsed)throw new TypeError("Already read");this.url=R.url,this.credentials=R.credentials,x.headers||(this.headers=new f(R.headers)),this.method=R.method,this.mode=R.mode,this.signal=R.signal,!G&&R._bodyInit!=null&&(G=R._bodyInit,R.bodyUsed=!0)}else this.url=String(R);if(this.credentials=x.credentials||this.credentials||"same-origin",(x.headers||!this.headers)&&(this.headers=new f(x.headers)),this.method=_(x.method||this.method||"GET"),this.mode=x.mode||this.mode||null,this.signal=x.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&G)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(G),(this.method==="GET"||this.method==="HEAD")&&(x.cache==="no-store"||x.cache==="no-cache")){var S=/([?&])_=[^&]*/;if(S.test(this.url))this.url=this.url.replace(S,"$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(R){var x=new FormData;return R.trim().split("&").forEach(function(G){if(G){var S=G.split("="),w=S.shift().replace(/\+/g," "),T=S.join("=").replace(/\+/g," ");x.append(decodeURIComponent(w),decodeURIComponent(T))}}),x}function M(R){var x=new f,G=R.replace(/\r?\n[\t ]+/g," ");return G.split("\r").map(function(S){return S.indexOf(`
153
+ `)===0?S.substr(1,S.length):S}).forEach(function(S){var w=S.split(":"),T=w.shift().trim();if(T){var Y=w.join(":").trim();x.append(T,Y)}}),x}B.call($.prototype);function X(R,x){if(!(this instanceof X))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');x||(x={}),this.type="default",this.status=x.status===void 0?200:x.status,this.ok=this.status>=200&&this.status<300,this.statusText=x.statusText===void 0?"":""+x.statusText,this.headers=new f(x.headers),this.url=x.url||"",this._initBody(R)}B.call(X.prototype),X.prototype.clone=function(){return new X(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},X.error=function(){var R=new X(null,{status:0,statusText:""});return R.type="error",R};var V=[301,302,303,307,308];X.redirect=function(R,x){if(V.indexOf(x)===-1)throw new RangeError("Invalid status code");return new X(null,{status:x,headers:{location:R}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(x,G){this.message=x,this.name=G;var S=Error(x);this.stack=S.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function z(R,x){return new Promise(function(G,S){var w=new $(R,x);if(w.signal&&w.signal.aborted)return S(new o.DOMException("Aborted","AbortError"));var T=new XMLHttpRequest;function Y(){T.abort()}T.onload=function(){var q={status:T.status,statusText:T.statusText,headers:M(T.getAllResponseHeaders()||"")};q.url="responseURL"in T?T.responseURL:q.headers.get("X-Request-URL");var se="response"in T?T.response:T.responseText;setTimeout(function(){G(new X(se,q))},0)},T.onerror=function(){setTimeout(function(){S(new TypeError("Network request failed"))},0)},T.ontimeout=function(){setTimeout(function(){S(new TypeError("Network request failed"))},0)},T.onabort=function(){setTimeout(function(){S(new o.DOMException("Aborted","AbortError"))},0)};function U(q){try{return q===""&&a.location.href?a.location.href:q}catch{return q}}T.open(w.method,U(w.url),!0),w.credentials==="include"?T.withCredentials=!0:w.credentials==="omit"&&(T.withCredentials=!1),"responseType"in T&&(A.blob?T.responseType="blob":A.arrayBuffer&&w.headers.get("Content-Type")&&w.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(T.responseType="arraybuffer")),x&&typeof x.headers=="object"&&!(x.headers instanceof f)?Object.getOwnPropertyNames(x.headers).forEach(function(q){T.setRequestHeader(q,d(x.headers[q]))}):w.headers.forEach(function(q,se){T.setRequestHeader(se,q)}),w.signal&&(w.signal.addEventListener("abort",Y),T.onreadystatechange=function(){T.readyState===4&&w.signal.removeEventListener("abort",Y)}),T.send(typeof w._bodyInit>"u"?null:w._bodyInit)})}return z.polyfill=!0,a.fetch||(a.fetch=z,a.Headers=f,a.Request=$,a.Response=X),o.Headers=f,o.Request=$,o.Response=X,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})(_o,_o.exports);var Bf=_o.exports;const Ml=pl(Bf);async function Qf(s){var e;try{if((e=await Ml(s,{method:"HEAD"}))!=null&&e.ok)return s}catch{return}}async function ko({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=>Qf(o));e=(await Promise.all(n)).find(Boolean)}return e}async function bf(s){try{return(await Ml(s)).text()}catch{return null}}async function Sf(s){return s=s.trim(),s.startsWith("http")||s.startsWith("blob:")?bf(s):s}const wf=Kt(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?Sf(A):null},{cacheKey:([s,{language:e}])=>JSON.stringify({...s,language:e})}),Rf=Kt(async s=>{var e,t,i,r,n,o,a,A,l,c,u;const[h,d,g]=await Promise.all([ko({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]}),ko({sources:[(o=(n=s==null?void 0:s.answer)==null?void 0:n.media)==null?void 0:o.playlist]}),ko({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 xf(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 Tf=Kt(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 Fo({data:s,rootData:e,index:t},i){var r,n,o,a,A,l,c,u,h,d,g,f,p,v,y,b,C,Q,B,L,_;const[$,k,M]=await Promise.all([Tf(s,e,t),Rf(e),wf({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{...k,...xf(e),key:$,captions:M,answerLabel:((v=e==null?void 0:e.answer)==null?void 0:v.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((Q=(C=(b=(y=s==null?void 0:s.questions)==null?void 0:y.items)==null?void 0:b[t-1])==null?void 0:C.answer)==null?void 0:Q.label)??((_=(L=(B=s==null?void 0:s.questions)==null?void 0:B.items)==null?void 0:L[t-1])==null?void 0:_.title)??null:null}}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 Df({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},[]))??[]}/**
154
154
  * @license
155
155
  * Copyright 2018 Google LLC
156
156
  * SPDX-License-Identifier: BSD-3-Clause
157
- */const Ge=hs(class extends Js{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 Yt}});/**
157
+ */const Ge=us(class extends Js{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 Yt}});/**
158
158
  * @license
159
159
  * Copyright 2018 Google LLC
160
160
  * SPDX-License-Identifier: BSD-3-Clause
161
- */const Ol="important",Lf=" !"+Ol,sr=hs(class extends Js{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(Lf);i.includes("-")||n?t.setProperty(i,n?r.slice(0,-11):r,n?Ol:""):t[i]=r}}return Yt}});function _f(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Pl={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 p=d.path,v=p.substring(0,p.lastIndexOf("/")+1)+u.path;f.path=a.normalizePath(v)}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})()})(Pl);var No=Pl.exports;function Ul(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?Ul(Object(t),!0).forEach(function(i){Nf(s,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):Ul(Object(t)).forEach(function(i){Object.defineProperty(s,i,Object.getOwnPropertyDescriptor(t,i))})}return s}function kf(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 Ff(s){var e=kf(s,"string");return typeof e=="symbol"?e:String(e)}function Nf(s,e,t){return e=Ff(e),e in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}function et(){return et=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},et.apply(this,arguments)}const Ae=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},Mf=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=Of},Of=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}({}),me=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}({}),H=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(){},Mo={trace:ji,debug:ji,log:ji,warn:ji,info:ji,error:ji};let rr=Mo;function Pf(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):ji}function Uf(s,...e){e.forEach(function(t){rr[t]=s[t]?s[t].bind(s):Pf(t)})}function Gf(s,e){if(typeof console=="object"&&s===!0||typeof s=="object"){Uf(s,"debug","log","info","warn","error");try{rr.log(`Debug logs enabled for "${e}" in hls.js version 1.5.11`)}catch{rr=Mo}}else rr=Mo}const N=rr,Hf=/^(\d+)x(\d+)$/,Gl=/(.+?)=(".*?"|.*?)(?:,|$)/g;class We{constructor(e){typeof e=="string"&&(e=We.parseAttrList(e)),et(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=Hf.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(Gl.lastIndex=0;(t=Gl.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 $f(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function Yf(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class Hl{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=et(new We({}),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 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 Ne={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class $l{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Ne.AUDIO]:null,[Ne.VIDEO]:null,[Ne.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=No.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class Oo extends $l{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||!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[Ne.AUDIO]=null,e[Ne.VIDEO]=null,e[Ne.AUDIOVIDEO]=null}}class Kf extends $l{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 Vf=10;class Jf{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||Vf}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 Po(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function Wf(s){const e=Uo(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function qf(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 jf(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=Po(o)):t=Wf(o)}}return t}function Uo(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}const gs=typeof self<"u"?self:void 0;var Ye={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Rt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Yl(s){switch(s){case Rt.FAIRPLAY:return Ye.FAIRPLAY;case Rt.PLAYREADY:return Ye.PLAYREADY;case Rt.WIDEVINE:return Ye.WIDEVINE;case Rt.CLEARKEY:return Ye.CLEARKEY}}var Kl={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Xf(s){if(s===Kl.WIDEVINE)return Ye.WIDEVINE}function Vl(s){switch(s){case Ye.FAIRPLAY:return Rt.FAIRPLAY;case Ye.PLAYREADY:return Rt.PLAYREADY;case Ye.WIDEVINE:return Rt.WIDEVINE;case Ye.CLEARKEY:return Rt.CLEARKEY}}function Go(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[Ye.FAIRPLAY,Ye.WIDEVINE,Ye.PLAYREADY,Ye.CLEARKEY].filter(r=>!!e[r]):[];return!i[Ye.WIDEVINE]&&t&&i.push(Ye.WIDEVINE),i}const Jl=function(s){return gs!=null&&(s=gs.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function zf(s,e,t,i){let r;switch(s){case Ye.FAIRPLAY:r=["cenc","sinf"];break;case Ye.WIDEVINE:case Ye.PLAYREADY:r=["cenc"];break;case Ye.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return Zf(r,e,t,i)}function Zf(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 Ho=(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,Wl=(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,nr=(s,e)=>{const t=e;let i=0;for(;Ho(s,e);){i+=10;const r=nn(s,e+6);i+=r,Wl(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},e0=(s,e)=>Ho(s,e)&&nn(s,e+6)+10<=s.length-e,$o=s=>{const e=jl(s);for(let t=0;t<e.length;t++){const i=e[t];if(ql(i))return o0(i)}},ql=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",t0=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)}},jl=s=>{let e=0;const t=[];for(;Ho(s,e);){const i=nn(s,e+6);e+=10;const r=e+i;for(;e+8<r;){const n=t0(s.subarray(e)),o=i0(n);o&&t.push(o),e+=n.size+10}Wl(s,e)&&(e+=10)}return t},i0=s=>s.type==="PRIV"?s0(s):s.type[0]==="W"?n0(s):r0(s),s0=s=>{if(s.size<2)return;const e=ti(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},r0=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=ti(s.data.subarray(t),!0);t+=i.length+1;const r=ti(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=ti(s.data.subarray(1));return{key:s.type,data:e}},n0=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=ti(s.data.subarray(t),!0);t+=i.length+1;const r=ti(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=ti(s.data);return{key:s.type,data:e}},o0=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)}},ti=(s,e=!1)=>{const t=a0();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 Yo;function a0(){if(!navigator.userAgent.includes("PlayStation 4"))return!Yo&&typeof self.TextDecoder<"u"&&(Yo=new self.TextDecoder("utf-8")),Yo}const ii={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,A0=[].push,Xl={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 de(s,e){const t=ec(s,e);return t<0?4294967296+t:t}function Zl(s,e){let t=de(s,e);return t*=Math.pow(2,32),t+=de(s,e+4),t}function ec(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function Ko(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 l0(s){const e=s.byteLength;for(let t=0;t<e;){const i=de(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 ye(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let r=0;r<i;){const n=de(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=ye(s.subarray(r+8,a),e.slice(1));A.length&&A0.apply(t,A)}r=a}return t}function c0(s){const e=[],t=s[0];let i=8;const r=de(s,i);i+=4;let n=0,o=0;t===0?(n=de(s,i),o=de(s,i+4),i+=8):(n=Zl(s,i),o=Zl(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 h=de(s,c);c+=4;const u=h&2147483647;if((h&2147483648)>>>31===1)return N.warn("SIDX has hierarchical references (not supported)"),null;const g=de(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 tc(s){const e=[],t=ye(s,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],o=ye(n,["tkhd"])[0];if(o){let a=o[0];const A=de(o,a===0?12:20),l=ye(n,["mdia","mdhd"])[0];if(l){a=l[0];const c=de(l,a===0?12:20),h=ye(n,["mdia","hdlr"])[0];if(h){const u=at(h.subarray(8,12)),d={soun:Ne.AUDIO,vide:Ne.VIDEO}[u];if(d){const g=ye(n,["mdia","minf","stbl","stsd"])[0],f=h0(g);e[A]={timescale:c,type:d},e[d]=At({timescale:c,id:A},f)}}}}}return ye(s,["moov","mvex","trex"]).forEach(r=>{const n=de(r,4),o=e[n];o&&(o.default={duration:de(r,12),flags:de(r,20)})}),e}function h0(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=ye(e,[i])[0].subarray(i==="enca"?28:78);ye(a,["sinf"]).forEach(l=>{const c=ye(l,["schm"])[0];if(c){const h=at(c.subarray(4,8));if(h==="cbcs"||h==="cenc"){const u=ye(l,["frma"])[0];u&&(r=at(u))}}})}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const o=ye(t,["avcC"])[0];r+="."+an(o[1])+an(o[2])+an(o[3]);break}case"mp4a":{const o=ye(e,[i])[0],a=ye(o.subarray(28),["esds"])[0];if(a&&a.length>12){let A=4;if(a[A++]!==3)break;A=Vo(a,A),A+=2;const l=a[A++];if(l&128&&(A+=2),l&64&&(A+=a[A++]),a[A++]!==4)break;A=Vo(a,A);const c=a[A++];if(c===64)r+="."+an(c);else break;if(A+=12,a[A++]!==5)break;A=Vo(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=ye(t,["hvcC"])[0],a=o[1],A=["","A","B","C"][a>>6],l=a&31,c=de(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 p=d[f];(p||g)&&(g="."+p.toString(16).toUpperCase()+g)}r+=g;break}case"dvh1":case"dvhe":{const o=ye(t,["dvcC"])[0],a=o[2]>>1&127,A=o[2]<<5&32|o[3]>>3&31;r+="."+si(a)+"."+si(A);break}case"vp09":{const o=ye(t,["vpcC"])[0],a=o[4],A=o[5],l=o[6]>>4&15;r+="."+si(a)+"."+si(A)+"."+si(l);break}case"av01":{const o=ye(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,p=o[2]&3;r+="."+a+"."+si(A)+l+"."+si(u)+"."+d+"."+g+f+p+"."+si(1)+"."+si(1)+"."+si(1)+"."+0;break}}return{codec:r,encrypted:n}}function Vo(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 si(s){return(s<10?"0":"")+s}function u0(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&ye(s,["moov","trak"]).forEach(r=>{const o=ye(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=ye(o,["enca"]);const A=a.length>0;A||(a=ye(o,["encv"])),a.forEach(l=>{const c=A?l.subarray(28):l.subarray(78);ye(c,["sinf"]).forEach(u=>{const d=ic(u);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: ${ii.hexDump(g)} -> ${ii.hexDump(t)}`),d.set(t,8))}})})}),s}function ic(s){const e=ye(s,["schm"])[0];if(e){const t=at(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ye(s,["schi","tenc"])[0]}return N.error("[eme] missing 'schm' box"),null}function d0(s,e){return ye(e,["moof","traf"]).reduce((t,i)=>{const r=ye(i,["tfdt"])[0],n=r[0],o=ye(i,["tfhd"]).reduce((a,A)=>{const l=de(A,4),c=s[l];if(c){let h=de(r,4);if(n===1){if(h===on)return N.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;h*=on+1,h+=de(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 g0(s,e){let t=0,i=0,r=0;const n=ye(s,["moof","traf"]);for(let o=0;o<n.length;o++){const a=n[o],A=ye(a,["tfhd"])[0],l=de(A,4),c=e[l];if(!c)continue;const h=c.default,u=de(A,0)|(h==null?void 0:h.flags);let d=h==null?void 0:h.duration;u&8&&(u&2?d=de(A,12):d=de(A,8));const g=c.timescale||9e4,f=ye(a,["trun"]);for(let p=0;p<f.length;p++){if(t=f0(f[p]),!t&&d){const v=de(f[p],4);t=d*v}c.type===Ne.VIDEO?i+=t/g:c.type===Ne.AUDIO&&(r+=t/g)}}if(i===0&&r===0){let o=1/0,a=0,A=0;const l=ye(s,["sidx"]);for(let c=0;c<l.length;c++){const h=c0(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 f0(s){const e=de(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const r=de(s,4);for(let n=0;n<r;n++){if(e&256){const o=de(s,t);i+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function p0(s,e,t){ye(e,["moof","traf"]).forEach(i=>{ye(i,["tfhd"]).forEach(r=>{const n=de(r,4),o=s[n];if(!o)return;const a=o.timescale||9e4;ye(i,["tfdt"]).forEach(A=>{const l=A[0],c=t*a;if(c){let h=de(A,4);if(l===0)h-=c,h=Math.max(h,0),Ko(A,4,h);else{h*=Math.pow(2,32),h+=de(A,8),h-=c,h=Math.max(h,0);const u=Math.floor(h/(on+1)),d=Math.floor(h%(on+1));Ko(A,4,u),Ko(A,8,d)}}})})})}function E0(s){const e={valid:null,remainder:null},t=ye(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 Nt(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function sc(s,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let o=!1;return ye(i,["moof"]).map(A=>{const l=A.byteOffset-8;ye(A,["traf"]).map(h=>{const u=ye(h,["tfdt"]).map(d=>{const g=d[0];let f=de(d,4);return g===1&&(f*=Math.pow(2,32),f+=de(d,8)),f/r})[0];return u!==void 0&&(s=u),ye(h,["tfhd"]).map(d=>{const g=de(d,4),f=de(d,0)&16777215,p=(f&1)!==0,v=(f&2)!==0,y=(f&8)!==0;let b=0;const C=(f&16)!==0;let Q=0;const B=(f&32)!==0;let L=8;g===n&&(p&&(L+=8),v&&(L+=4),y&&(b=de(d,L),L+=4),C&&(Q=de(d,L),L+=4),B&&(L+=4),e.type==="video"&&(o=I0(e.codec)),ye(h,["trun"]).map(_=>{const K=_[0],k=de(_,0)&16777215,O=(k&1)!==0;let X=0;const V=(k&4)!==0,q=(k&256)!==0;let S=0;const R=(k&512)!==0;let G=0;const x=(k&1024)!==0,w=(k&2048)!==0;let T=0;const $=de(_,4);let U=8;O&&(X=de(_,U),U+=4),V&&(U+=4);let j=X+l;for(let ie=0;ie<$;ie++){if(q?(S=de(_,U),U+=4):S=b,R?(G=de(_,U),U+=4):G=Q,x&&(U+=4),w&&(K===0?T=de(_,U):T=ec(_,U),U+=4),e.type===Ne.VIDEO){let he=0;for(;he<G;){const re=de(i,j);if(j+=4,m0(o,i[j])){const ve=i.subarray(j,j+re);rc(ve,o?2:1,s+T/r,t)}j+=re,he+=re+4}}s+=S/r}}))})})}),t}function I0(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 m0(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function rc(s,e,t,i){const r=nc(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 u=zl(r,c);if(c+=2,u===49){const d=de(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,b=new Uint8Array(y);if(v){b[0]=f;for(let C=1;C<y;C++)b[C]=r[c++]}i.push({type:g,payloadType:o,pts:t,bytes:b})}}}}}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:ti(d),userDataBytes:d})}}}function nc(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 C0(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=de(s,12),n=de(s,16),a=de(s,20),A=de(s,24),l=28}else if(e===1){l+=4,r=de(s,l),l+=4;const h=de(s,l);l+=4;const u=de(s,l);for(l+=4,o=4294967296*h+u,Mf(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=de(s,l),l+=4,A=de(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 v0(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 y0(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),v0([112,115,115,104],new Uint8Array([i,0,0,0]),s,n,r,o,t||new Uint8Array)}function B0(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=ii.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 or{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 Rt.FAIRPLAY:case Rt.WIDEVINE:case Rt.PLAYREADY:case Rt.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=Q0(e);return new or(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=jf(this.uri);if(t)switch(this.keyFormat){case Rt.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Rt.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=y0(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=Po(c).subarray(0,16);qf(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=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 Q0(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const oc=/\{\$([a-zA-Z0-9-_]+)\}/g;function ac(s){return oc.test(s)}function xt(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]=Jo(s,n))}}function Jo(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(oc,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 Ac(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 b0(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 S0(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 w0(s,e){const t=ln[e];return!!t&&!!t[s.slice(0,4)]}function Wo(s,e,t=!0){return!s.split(",").some(i=>!lc(i,e,t))}function lc(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 cc(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 qo={};function R0(s,e=!0){if(qo[s])return qo[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[s];for(let i=0;i<t.length;i++)if(lc(t[i],"audio",e))return qo[s]=t[i],t[i];return s}const x0=/flac|opus/i;function hn(s,e=!0){return s.replace(x0,t=>R0(t.toLowerCase(),e))}function hc(s,e){return s&&s!=="mp4a"?s:e&&e.split(",")[0]}function T0(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 uc=/#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,dc=/#EXT-X-MEDIA:(.*)/g,D0=/^#EXT(?:INF|-X-TARGETDURATION):/m,gc=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"),L0=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 ri{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 No.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return D0.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=[];uc.lastIndex=0;let o;for(;(o=uc.exec(e))!=null;)if(o[1]){var a;const l=new We(o[1]);xt(r,l,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=Jo(r,o[2]),h={attrs:l,bitrate:l.decimalInteger("BANDWIDTH")||l.decimalInteger("AVERAGE-BANDWIDTH"),name:l.NAME,url:ri.resolve(c,t)},u=l.decimalResolution("RESOLUTION");u&&(h.width=u.width,h.height=u.height),_0(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 We(c);xt(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=fc(c,t,r);h.encrypted&&h.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(h)):N.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const h=new We(c);xt(r,h,["NAME","VALUE","QUERYPARAM"]),Ac(r,h,t)}break}case"CONTENT-STEERING":{const h=new We(c);xt(r,h,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:ri.resolve(h["SERVER-URI"],t),pathwayId:h["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=pc(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(dc.lastIndex=0;(r=dc.exec(e))!==null;){const l=new We(r[1]),c=l.TYPE;if(c){const h=a[c],u=n[c]||[];n[c]=u,xt(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?ri.resolve(l.URI,t):""};if(g&&(y.assocLang=g),f&&(y.channels=f),p&&(y.characteristics=p),v&&(y.instreamId=v),h!=null&&h.length){const b=ri.findGroup(h,y.groupId)||h[0];Ec(y,b,"audioCodec"),Ec(y,b,"textCodec")}u.push(y)}}return n}static parseLevelPlaylist(e,t,i,r,n,o){const a=new Jf(t),A=a.fragments;let l=null,c=0,h=0,u=0,d=0,g=null,f=new Oo(r,t),p,v,y,b=-1,C=!1,Q=null;for(gc.lastIndex=0,a.m3u8=e,a.hasVariableRefs=ac(e);(p=gc.exec(e))!==null;){C&&(C=!1,f=new Oo(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,Q&&(f.setByteRange(Q),Q=null)));const K=p[1];if(K){f.duration=parseFloat(K);const k=(" "+p[2]).slice(1);f.title=k||null,f.tagList.push(k?["INF",K,k]:["INF",K])}else if(p[3]){if(Ae(f.duration)){f.start=u,y&&Cc(f,y,a),f.sn=c,f.level=i,f.cc=d,A.push(f);const k=(" "+p[3]).slice(1);f.relurl=Jo(a,k),Ic(f,g),g=f,u+=f.duration,c++,h=0,C=!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]),b===-1&&(b=A.length);else{if(p=p[0].match(L0),!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),O=(" "+p[v+1]).slice(1),X=p[v+2]?(" "+p[v+2]).slice(1):"";switch(k){case"PLAYLIST-TYPE":a.type=O.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(O);break;case"SKIP":{const V=new We(O);xt(a,V,["RECENTLY-REMOVED-DATERANGES"]);const q=V.decimalInteger("SKIPPED-SEGMENTS");if(Ae(q)){a.skippedSegments=q;for(let R=q;R--;)A.unshift(null);c+=q}const S=V.enumeratedString("RECENTLY-REMOVED-DATERANGES");S&&(a.recentlyRemovedDateranges=S.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(O),1);break;case"VERSION":a.version=parseInt(O);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(O||X)&&f.tagList.push(X?[O,X]:[O]);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,O]);break;case"DATERANGE":{const V=new We(O);xt(a,V,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),xt(a,V,V.clientAttrs);const q=new Hl(V,a.dateRanges[V.ID]);q.isValid||a.skippedSegments?a.dateRanges[q.id]=q:N.warn(`Ignoring invalid DATERANGE tag: "${O}"`),f.tagList.push(["EXT-X-DATERANGE",O]);break}case"DEFINE":{{const V=new We(O);xt(a,V,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in V?b0(a,V,o):Ac(a,V,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(O);break;case"KEY":{const V=fc(O,t,a);if(V.isSupported()){if(V.method==="NONE"){y=void 0;break}y||(y={}),y[V.keyFormat]&&(y=et({},y)),y[V.keyFormat]=V}else N.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${O}"`);break}case"START":a.startTimeOffset=pc(O);break;case"MAP":{const V=new We(O);if(xt(a,V,["BYTERANGE","URI"]),f.duration){const q=new Oo(r,t);mc(q,V,i,y),l=q,f.initSegment=l,l.rawProgramDateTime&&!f.rawProgramDateTime&&(f.rawProgramDateTime=l.rawProgramDateTime)}else{const q=f.byteRangeEndOffset;if(q){const S=f.byteRangeStartOffset;Q=`${q-S}@${S}`}else Q=null;mc(f,V,i,y),l=f,C=!0}break}case"SERVER-CONTROL":{const V=new We(O);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 We(O);a.partTarget=V.decimalFloatingPoint("PART-TARGET");break}case"PART":{let V=a.partList;V||(V=a.partList=[]);const q=h>0?V[V.length-1]:void 0,S=h++,R=new We(O);xt(a,R,["BYTERANGE","URI"]);const G=new Kf(R,f,t,S,q);V.push(G),f.duration+=G.duration;break}case"PRELOAD-HINT":{const V=new We(O);xt(a,V,["URI"]),a.preloadHint=V;break}case"RENDITION-REPORT":{const V=new We(O);xt(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(),u-=g.duration,a.partList&&(a.fragmentHint=g)):a.partList&&(Ic(f,g),f.cc=d,a.fragmentHint=f,y&&Cc(f,y,a));const B=A.length,L=A[0],_=A[B-1];if(u+=a.skippedSegments*a.targetduration,u>0&&B&&_){a.averagetargetduration=u/B;const K=_.sn;a.endSN=K!=="initSegment"?K:0,a.live||(_.endList=!0),L&&(a.startCC=L.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(u+=a.fragmentHint.duration),a.totalduration=u,a.endCC=d,b>0&&k0(A,b),a}}function fc(s,e,t){var i,r;const n=new We(s);xt(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 h=a?ri.resolve(a,e):"",u=(l||"1").split("/").map(Number).filter(Number.isFinite);return new or(o,h,c,u,A)}function pc(s){const t=new We(s).decimalFloatingPoint("TIME-OFFSET");return Ae(t)?t:null}function _0(s,e){let t=(s||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const r=t.filter(n=>w0(n,i));r.length&&(e[`${i}Codec`]=r.join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function Ec(s,e,t){const i=e[t];i&&(s[t]=i)}function k0(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 Ic(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 mc(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 Cc(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 De={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},ge={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function vc(s){const{type:e}=s;switch(e){case De.AUDIO_TRACK:return ge.AUDIO;case De.SUBTITLE_TRACK:return ge.SUBTITLE;default:return ge.MAIN}}function jo(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class F0{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:De.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:De.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:De.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:De.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===De.MANIFEST?n=i.manifestLoadPolicy.default:n=et({},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===De.LEVEL&&e.level!==null?l=this.hls.levels[e.level].details:e.type===De.AUDIO_TRACK&&e.id!==null?l=this.hls.audioTracks[e.id].details:e.type===De.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=et({},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(),ri.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=jo(e,i),A=ri.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:p,"CLOSED-CAPTIONS":v}=ri.parseMasterPlaylistMedia(o,a,A);f.length&&!f.some(b=>!b.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 We({}),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: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=jo(e,i),h=0,u=Ae(A)?A:Ae(a)?a:0,d=vc(i),g=ri.parseLevelPlaylist(e.data,c,u,d,h,this.variableList);if(l===De.MANIFEST){const f={attrs:new We({}),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:me.NETWORK_ERROR,details:H.MANIFEST_PARSING_ERROR,fatal:t.type===De.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===De.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===De.AUDIO_TRACK||e.type===De.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);N.warn(`[playlist-loader]: ${o}`);let A=H.UNKNOWN,l=!1;const c=this.getInternalLoader(e);switch(e.type){case De.MANIFEST:A=i?H.MANIFEST_LOAD_TIMEOUT:H.MANIFEST_LOAD_ERROR,l=!0;break;case De.LEVEL:A=i?H.LEVEL_LOAD_TIMEOUT:H.LEVEL_LOAD_ERROR,l=!1;break;case De.AUDIO_TRACK:A=i?H.AUDIO_TRACK_LOAD_TIMEOUT:H.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case De.SUBTITLE_TRACK:A=i?H.SUBTITLE_TRACK_LOAD_TIMEOUT:H.SUBTITLE_LOAD_ERROR,l=!1;break}c&&this.resetInternalLoader(e.type);const h={type:me.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(E.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=jo(t,r),g=vc(r),f=typeof r.level=="number"&&g===ge.MAIN?l:void 0;if(!e.fragments.length){const v=new Error("No Segments found in Playlist");a.trigger(E.ERROR,{type:me.NETWORK_ERROR,details:H.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:me.NETWORK_ERROR,details:H.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 De.MANIFEST:case De.LEVEL:a.trigger(E.LEVEL_LOADED,{details:e,level:f||0,id:c||0,stats:i,networkDetails:n,deliveryDirectives:u});break;case De.AUDIO_TRACK:a.trigger(E.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break;case De.SUBTITLE_TRACK:a.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:u});break}}}function yc(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 Bc(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 fs(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 Xo(s,e,t,i){const r=s.mode;if(r==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const n=M0(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 N0(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 M0(s,e,t){const i=[],r=N0(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 un(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 Vt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const O0=.25;function zo(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Qc(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 dn=(()=>{const s=zo();try{s&&new s(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Zo(s,e){return s.getTime()/1e3-e}function P0(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class U0{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&&(fs(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 yc(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===Vt.emsg&&!i||!r)continue;const l=jl(n[a].data);if(l){const c=n[a].pts;let h=c+n[a].duration;h>dn&&(h=dn),h-c<=0&&(h=c+O0);for(let d=0;d<l.length;d++){const g=l[d];if(!ql(g)){this.updateId3CueEnds(c,A);const f=Qc(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===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===Vt.audioId3&&A:r==="video"?l=c=>c.type===Vt.emsg&&a:l=c=>c.type===Vt.audioId3&&A||c.type===Vt.emsg&&a,Xo(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=zo();for(let c=0;c<o.length;c++){const h=o[c],u=n[h],d=Zo(u.startDate,A),g=i[h],f=(g==null?void 0:g.cues)||{};let p=(g==null?void 0:g.durationKnown)||!1,v=dn;const y=u.endDate;if(y)v=Zo(y,A),p=!0;else if(u.endOnNext&&!p){const C=o.reduce((Q,B)=>{if(B!==u.id){const L=n[B];if(L.class===u.class&&L.startDate>u.startDate&&(!Q||u.startDate<Q.startDate))return L}return Q},null);C&&(v=Zo(C.startDate,A),p=!0)}const b=Object.keys(u.attr);for(let C=0;C<b.length;C++){const Q=b[C];if(!$f(Q))continue;const B=f[Q];if(B)p&&!g.durationKnown&&(B.endTime=v);else if(l){let L=u.attr[Q];Yf(Q)&&(L=P0(L));const _=Qc(l,d,v,{key:Q,data:L},Vt.dateRange);_&&(_.id=h,this.id3Track.addCue(_),f[Q]=_)}}i[h]={cues:f,dateRange:u,durationKnown:p}}}}class G0{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===H.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)),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 ea=["NONE","TYPE-0","TYPE-1",null];function H0(s){return ea.indexOf(s)>-1}const gn=["SDR","PQ","HLG"];function $0(s){return!!s&&gn.indexOf(s)>-1}var fn={No:"",Yes:"YES",v2:"v2"};function bc(s){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=s,r=i<e/2;return e&&r?t?fn.v2:fn.Yes:fn.No}class Sc{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 ps{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 wc(this._audioGroups,e)}hasSubtitleGroup(e){return wc(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 wc(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function ta(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 Rc(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(Ae(l)){const p=Math.abs(l-t);Ae(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 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--)ta(f[d],f[d-1]);for(d=g;d<f.length-1;d++)ta(f[d],f[d+1]);return s.fragmentHint&&ta(f[f.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,h}function Y0(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(J0(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){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=K0(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),V0(s.partList,e.partList,(A,l)=>{l.elementaryStreams=A.elementaryStreams,l.stats=A.stats}),n?Rc(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):xc(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 K0(s,e,t){const i=et({},s);return t&&t.forEach(r=>{delete i[r]}),Object.keys(e).forEach(r=>{const n=new Hl(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 V0(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 J0(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 xc(s,e){const t=e.startSN+e.skippedSegments-s.startSN,i=s.fragments;t<0||t>=i.length||ia(e,i[t].start)}function ia(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 W0(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 q0(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 Tc(s,e,t){var i;return s!=null&&s.details?Dc((i=s.details)==null?void 0:i.partList,e,t):null}function Dc(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 Lc(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 H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_TIMEOUT:case H.LEVEL_LOAD_TIMEOUT:case H.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function _c(s,e){const t=pn(e);return s.default[`${t?"timeout":"error"}Retry`]}function sa(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function kc(s){return At(At({},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&&(j0(r)||!!t);return s.shouldRetry?s.shouldRetry(s,e,t,i,n):n}function j0(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const Fc={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 X0(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(Z0(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)&&ra(t,i,n)===0||z0(n,s,Math.min(r,i))))return n;const o=Fc.search(e,ra.bind(null,t,i));return o&&(o!==s||!n)?o:n}function z0(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 ra(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 Z0(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function ep(s,e){return Fc.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},Jt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class tp{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)===ge.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 H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case H.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction={action:It.DoNothing,flags:Jt.None};return}case H.FRAG_GAP:case H.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=It.SendAlternateToPenaltyBox;return}case H.LEVEL_EMPTY_ERROR:case H.LEVEL_PARSING_ERROR:{var a,A;const l=t.parent===ge.MAIN?t.level:n.loadLevel;t.details===H.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 H.LEVEL_LOAD_ERROR:case H.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case H.AUDIO_TRACK_LOAD_ERROR:case H.AUDIO_TRACK_LOAD_TIMEOUT:case H.SUBTITLE_LOAD_ERROR:case H.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const l=n.levels[n.loadLevel];if(l&&(o.type===De.AUDIO_TRACK&&l.hasAudioGroup(o.groupId)||o.type===De.SUBTITLE_TRACK&&l.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=It.SendAlternateToPenaltyBox,t.errorAction.flags=Jt.MoveAllAlternatesMatchingHost;return}}return;case H.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:Jt.MoveAllAlternatesMatchingHDCP,hdcpLevel:c}:this.keySystemError(t)}return;case H.BUFFER_ADD_CODEC_ERROR:case H.REMUX_ALLOC_ERROR:case H.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case H.INTERNAL_EXCEPTION:case H.BUFFER_APPENDING_ERROR:case H.BUFFER_FULL_ERROR:case H.LEVEL_SWITCH_ERROR:case H.BUFFER_STALLED_ERROR:case H.BUFFER_SEEK_OVER_HOLE:case H.BUFFER_NUDGE_ON_STALL:t.errorAction={action:It.DoNothing,flags:Jt.None};return}t.type===me.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=_c(i.config.playlistLoadPolicy,e),n=this.playlistError++;if(En(r,n,pn(e),e.response))return{action:It.RetryRequest,flags:Jt.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=_c(e.details.startsWith("key")?o:n,e),A=t.levels.reduce((c,h)=>c+h.fragmentError,0);if(r&&(e.details!==H.FRAG_GAP&&r.fragmentError++,En(a,A,pn(e),e.response)))return{action:It.RetryRequest,flags:Jt.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===H.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,v=(f===ge.AUDIO&&l===H.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(l===H.BUFFER_ADD_CODEC_ERROR||l===H.BUFFER_APPEND_ERROR))&&h.some(({audioCodec:B})=>r.audioCodec!==B),b=e.sourceBufferName==="video"&&(l===H.BUFFER_ADD_CODEC_ERROR||l===H.BUFFER_APPEND_ERROR)&&h.some(({codecSet:B,audioCodec:L})=>r.codecSet!==B&&r.audioCodec===L),{type:C,groupId:Q}=(o=e.context)!=null?o:{};for(let B=h.length;B--;){const L=(B+u)%h.length;if(L!==u&&L>=d&&L<=g&&h[L].loadError===0){var a,A;const _=h[L];if(l===H.FRAG_GAP&&f===ge.MAIN&&e.frag){const K=h[L].details;if(K){const k=In(e.frag,K.fragments,e.frag.start);if(k!=null&&k.gap)continue}}else{if(C===De.AUDIO_TRACK&&_.hasAudioGroup(Q)||C===De.SUBTITLE_TRACK&&_.hasSubtitleGroup(Q))continue;if(f===ge.AUDIO&&(a=r.audioGroups)!=null&&a.some(K=>_.hasAudioGroup(K))||f===ge.SUBTITLE&&(A=r.subtitleGroups)!=null&&A.some(K=>_.hasSubtitleGroup(K))||v&&r.audioCodec===_.audioCodec||!v&&r.audioCodec!==_.audioCodec||b&&r.codecSet===_.codecSet)continue}c=L;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:It.SendAlternateToPenaltyBox,flags:Jt.None,nextAutoLevel:c}}return{action:It.SendAlternateToPenaltyBox,flags:Jt.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!==H.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 Jt.None:this.switchLevel(e,o);break;case Jt.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=ea[ea.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 na{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&&bc(i);return new Sc(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&&Y0(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,b=r.lastPartIndex,C=b!==-1,Q=v===y,B=p?0:b;C?(l=Q?y+1:v,c=Q?B:b+1):l=y+1;const L=r.age,_=L+r.ageHeader;let K=Math.min(_-r.partTarget,r.targetduration*1.5);if(K>0){if(i&&K>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${K} with playlist age: ${r.age}`),K=0;else{const k=Math.floor(K/r.targetduration);if(l+=k,c!==void 0){const O=Math.round(K%r.targetduration/r.partTarget);c+=O}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${L.toFixed(2)}s goal: ${K} skip sn ${k} to part ${c}`)}r.tuneInGoal=K}if(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c),p||!Q){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=W0(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=bc(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=fn.No),new Sc(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=sa(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 ip{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 Nc={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Mc={};function sp(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 rp(s,e,t){const i=s.videoCodec,r=s.audioCodec;if(!i||!r||!t)return Promise.resolve(Nc);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: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 h=c.channels||"",u=parseFloat(h);Ae(u)&&u>2&&a.push.apply(a,r.split(",").map(d=>({type:"media-source",audio:{contentType:ar(d,"audio"),channels:""+u}})))}}))}),Promise.all(a.map(A=>{const l=np(A);return Mc[l]||(Mc[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 np(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 op(){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 ap(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:op(),t?i=i.filter(r=>r!=="SDR"):i=["SDR"]),{preferHDR:t,allowedVideoRanges:i}}function Ap(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:p,allowedVideoRanges:v}=ap(e,r);for(let Q=n.length;Q--;){const B=s[n[Q]];l=B.channels[2]>0,h=Math.min(h,B.minHeight),u=Math.min(u,B.minFramerate),d=Math.min(d,B.minBitrate);const L=v.filter(_=>B.videoRanges[_]>0);L.length>0&&(c=!0,f=L)}h=Ae(h)?h:0,u=Ae(u)?u:0;const y=Math.max(1080,h),b=Math.max(30,u);return d=Ae(d)?d:t,t=Math.max(d,t),c||(e=void 0,f=[]),{codecSet:n.reduce((Q,B)=>{const L=s[B];if(B===Q)return Q;if(L.minBitrate>t)return yi(B,`min bitrate of ${L.minBitrate} > current estimate of ${t}`),Q;if(!L.hasDefaultAudio)return yi(B,"no renditions with default or auto-select sound found"),Q;if(a&&B.indexOf(a.substring(0,4))%5!==0)return yi(B,`audio codec preference "${a}" not found`),Q;if(o&&!A){if(!L.channels[o])return yi(B,`no renditions with ${o} channel sound found (channels options: ${Object.keys(L.channels)})`),Q}else if((!a||A)&&l&&L.channels[2]===0)return yi(B,"no renditions with stereo sound found"),Q;return L.minHeight>y?(yi(B,`min resolution of ${L.minHeight} > maximum of ${y}`),Q):L.minFramerate>b?(yi(B,`min framerate of ${L.minFramerate} > maximum of ${b}`),Q):f.some(_=>L.videoRanges[_]>0)?L.maxScore<g?(yi(B,`max score of ${L.maxScore} < selected max of ${g}`),Q):Q&&(cn(B)>=cn(Q)||L.fragmentError>s[Q].fragmentError)?Q:(g=L.maxScore,B):(yi(B,`no variants with VIDEO-RANGE of ${JSON.stringify(f)} found`),Q)},void 0),videoRanges:f,preferHDR:p,minFramerate:u,minBitrate:d}}function yi(s,e){N.log(`[abr] start candidates with "${s}" ignored because ${e}`)}function lp(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 cp(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(h=>{a.channels[h]=(a.channels[h]||0)+c.channels[h]}))}),r},{})}function ni(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(Is(s,r,t))return i}return-1}function Is(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||hp(a,e.characteristics))&&(t===void 0||t(s,e))}function hp(s,e=""){const t=s.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function ms(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 up(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=Oc(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 ni(s,g,r)>-1});return h>-1?h:Oc(e,i,u=>{const d=u.audioGroups,g=t.filter(f=>!d||d.indexOf(f.groupId)!==-1);return ni(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 dp{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,p=A.loading.first?A.loading.first-A.loading.start:-1,v=A.loaded&&p>-1,y=this.getBwEstimate(),b=r.levels,C=b[t.level],Q=A.total||Math.max(A.loaded,Math.round(l*C.averageBitrate/8));let B=v?c-p:c;B<1&&v&&(B=Math.min(c,A.loaded*8/y));const L=v?A.loaded*1e3/B:0,_=L?(Q-A.loaded)/L:Q*8/y+d/1e3;if(_<=f)return;const K=L?L*8:y;let k=Number.POSITIVE_INFINITY,O;for(O=t.level-1;O>h;O--){const V=b[O].maxBitrate;if(k=this.getTimeToLoadFrag(d/1e3,K,l*V,!b[O].details),k<f)break}if(k>=_||k>l*10)return;r.nextLoadLevel=r.nextAutoLevel=O,v?this.bwEstimator.sample(c-Math.min(d,p),A.loaded):this.bwEstimator.sampleTTFB(c);const X=b[O].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>X&&this.resetEstimator(X),this.clearTimer(),N.warn(`[abr] Fragment ${t.sn}${i?" part "+i.index:""} of level ${t.level} is loading too slowly;
161
+ */const Ol="important",Lf=" !"+Ol,sr=us(class extends Js{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(Lf);i.includes("-")||n?t.setProperty(i,n?r.slice(0,-11):r,n?Ol:""):t[i]=r}}return Yt}});function _f(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Pl={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})()})(Pl);var No=Pl.exports;function Ul(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?Ul(Object(t),!0).forEach(function(i){Nf(s,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(t)):Ul(Object(t)).forEach(function(i){Object.defineProperty(s,i,Object.getOwnPropertyDescriptor(t,i))})}return s}function kf(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 Ff(s){var e=kf(s,"string");return typeof e=="symbol"?e:String(e)}function Nf(s,e,t){return e=Ff(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 Ae=Number.isFinite||function(s){return typeof s=="number"&&isFinite(s)},Mf=Number.isSafeInteger||function(s){return typeof s=="number"&&Math.abs(s)<=Of},Of=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}({}),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}({}),H=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(){},Mo={trace:ji,debug:ji,log:ji,warn:ji,info:ji,error:ji};let rr=Mo;function Pf(s){const e=self.console[s];return e?e.bind(self.console,`[${s}] >`):ji}function Uf(s,...e){e.forEach(function(t){rr[t]=s[t]?s[t].bind(s):Pf(t)})}function Gf(s,e){if(typeof console=="object"&&s===!0||typeof s=="object"){Uf(s,"debug","log","info","warn","error");try{rr.log(`Debug logs enabled for "${e}" in hls.js version 1.5.11`)}catch{rr=Mo}}else rr=Mo}const N=rr,Hf=/^(\d+)x(\d+)$/,Gl=/(.+?)=(".*?"|.*?)(?:,|$)/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=Hf.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(Gl.lastIndex=0;(t=Gl.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 $f(s){return s!=="ID"&&s!=="CLASS"&&s!=="START-DATE"&&s!=="DURATION"&&s!=="END-DATE"&&s!=="END-ON-NEXT"}function Yf(s){return s==="SCTE35-OUT"||s==="SCTE35-IN"}class Hl{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"]);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 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 Ne={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class $l{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Ne.AUDIO]:null,[Ne.VIDEO]:null,[Ne.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=No.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class Oo extends $l{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||!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[Ne.AUDIO]=null,e[Ne.VIDEO]=null,e[Ne.AUDIOVIDEO]=null}}class Kf extends $l{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 Vf=10;class Jf{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||Vf}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 Po(s){return Uint8Array.from(atob(s),e=>e.charCodeAt(0))}function Wf(s){const e=Uo(s).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function qf(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 jf(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=Po(o)):t=Wf(o)}}return t}function Uo(s){return Uint8Array.from(unescape(encodeURIComponent(s)),e=>e.charCodeAt(0))}const gs=typeof self<"u"?self:void 0;var Ye={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Rt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Yl(s){switch(s){case Rt.FAIRPLAY:return Ye.FAIRPLAY;case Rt.PLAYREADY:return Ye.PLAYREADY;case Rt.WIDEVINE:return Ye.WIDEVINE;case Rt.CLEARKEY:return Ye.CLEARKEY}}var Kl={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Xf(s){if(s===Kl.WIDEVINE)return Ye.WIDEVINE}function Vl(s){switch(s){case Ye.FAIRPLAY:return Rt.FAIRPLAY;case Ye.PLAYREADY:return Rt.PLAYREADY;case Ye.WIDEVINE:return Rt.WIDEVINE;case Ye.CLEARKEY:return Rt.CLEARKEY}}function Go(s){const{drmSystems:e,widevineLicenseUrl:t}=s,i=e?[Ye.FAIRPLAY,Ye.WIDEVINE,Ye.PLAYREADY,Ye.CLEARKEY].filter(r=>!!e[r]):[];return!i[Ye.WIDEVINE]&&t&&i.push(Ye.WIDEVINE),i}const Jl=function(s){return gs!=null&&(s=gs.navigator)!=null&&s.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function zf(s,e,t,i){let r;switch(s){case Ye.FAIRPLAY:r=["cenc","sinf"];break;case Ye.WIDEVINE:case Ye.PLAYREADY:r=["cenc"];break;case Ye.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${s}`)}return Zf(r,e,t,i)}function Zf(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 Ho=(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,Wl=(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,nr=(s,e)=>{const t=e;let i=0;for(;Ho(s,e);){i+=10;const r=nn(s,e+6);i+=r,Wl(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},e0=(s,e)=>Ho(s,e)&&nn(s,e+6)+10<=s.length-e,$o=s=>{const e=jl(s);for(let t=0;t<e.length;t++){const i=e[t];if(ql(i))return o0(i)}},ql=s=>s&&s.key==="PRIV"&&s.info==="com.apple.streaming.transportStreamTimestamp",t0=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)}},jl=s=>{let e=0;const t=[];for(;Ho(s,e);){const i=nn(s,e+6);e+=10;const r=e+i;for(;e+8<r;){const n=t0(s.subarray(e)),o=i0(n);o&&t.push(o),e+=n.size+10}Wl(s,e)&&(e+=10)}return t},i0=s=>s.type==="PRIV"?s0(s):s.type[0]==="W"?n0(s):r0(s),s0=s=>{if(s.size<2)return;const e=ti(s.data,!0),t=new Uint8Array(s.data.subarray(e.length+1));return{key:s.type,info:e,data:t.buffer}},r0=s=>{if(s.size<2)return;if(s.type==="TXXX"){let t=1;const i=ti(s.data.subarray(t),!0);t+=i.length+1;const r=ti(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=ti(s.data.subarray(1));return{key:s.type,data:e}},n0=s=>{if(s.type==="WXXX"){if(s.size<2)return;let t=1;const i=ti(s.data.subarray(t),!0);t+=i.length+1;const r=ti(s.data.subarray(t));return{key:s.type,info:i,data:r}}const e=ti(s.data);return{key:s.type,data:e}},o0=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)}},ti=(s,e=!1)=>{const t=a0();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 Yo;function a0(){if(!navigator.userAgent.includes("PlayStation 4"))return!Yo&&typeof self.TextDecoder<"u"&&(Yo=new self.TextDecoder("utf-8")),Yo}const ii={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,A0=[].push,Xl={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 ue(s,e){const t=ec(s,e);return t<0?4294967296+t:t}function Zl(s,e){let t=ue(s,e);return t*=Math.pow(2,32),t+=ue(s,e+4),t}function ec(s,e){return s[e]<<24|s[e+1]<<16|s[e+2]<<8|s[e+3]}function Ko(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 l0(s){const e=s.byteLength;for(let t=0;t<e;){const i=ue(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 ye(s,e){const t=[];if(!e.length)return t;const i=s.byteLength;for(let r=0;r<i;){const n=ue(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=ye(s.subarray(r+8,a),e.slice(1));A.length&&A0.apply(t,A)}r=a}return t}function c0(s){const e=[],t=s[0];let i=8;const r=ue(s,i);i+=4;let n=0,o=0;t===0?(n=ue(s,i),o=ue(s,i+4),i+=8):(n=Zl(s,i),o=Zl(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=ue(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=ue(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 tc(s){const e=[],t=ye(s,["moov","trak"]);for(let r=0;r<t.length;r++){const n=t[r],o=ye(n,["tkhd"])[0];if(o){let a=o[0];const A=ue(o,a===0?12:20),l=ye(n,["mdia","mdhd"])[0];if(l){a=l[0];const c=ue(l,a===0?12:20),u=ye(n,["mdia","hdlr"])[0];if(u){const h=At(u.subarray(8,12)),d={soun:Ne.AUDIO,vide:Ne.VIDEO}[h];if(d){const g=ye(n,["mdia","minf","stbl","stsd"])[0],f=u0(g);e[A]={timescale:c,type:d},e[d]=lt({timescale:c,id:A},f)}}}}}return ye(s,["moov","mvex","trex"]).forEach(r=>{const n=ue(r,4),o=e[n];o&&(o.default={duration:ue(r,12),flags:ue(r,20)})}),e}function u0(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=ye(e,[i])[0].subarray(i==="enca"?28:78);ye(a,["sinf"]).forEach(l=>{const c=ye(l,["schm"])[0];if(c){const u=At(c.subarray(4,8));if(u==="cbcs"||u==="cenc"){const h=ye(l,["frma"])[0];h&&(r=At(h))}}})}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const o=ye(t,["avcC"])[0];r+="."+an(o[1])+an(o[2])+an(o[3]);break}case"mp4a":{const o=ye(e,[i])[0],a=ye(o.subarray(28),["esds"])[0];if(a&&a.length>12){let A=4;if(a[A++]!==3)break;A=Vo(a,A),A+=2;const l=a[A++];if(l&128&&(A+=2),l&64&&(A+=a[A++]),a[A++]!==4)break;A=Vo(a,A);const c=a[A++];if(c===64)r+="."+an(c);else break;if(A+=12,a[A++]!==5)break;A=Vo(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=ye(t,["hvcC"])[0],a=o[1],A=["","A","B","C"][a>>6],l=a&31,c=ue(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=ye(t,["dvcC"])[0],a=o[2]>>1&127,A=o[2]<<5&32|o[3]>>3&31;r+="."+si(a)+"."+si(A);break}case"vp09":{const o=ye(t,["vpcC"])[0],a=o[4],A=o[5],l=o[6]>>4&15;r+="."+si(a)+"."+si(A)+"."+si(l);break}case"av01":{const o=ye(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+"."+si(A)+l+"."+si(h)+"."+d+"."+g+f+p+"."+si(1)+"."+si(1)+"."+si(1)+"."+0;break}}return{codec:r,encrypted:n}}function Vo(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 si(s){return(s<10?"0":"")+s}function h0(s,e){if(!s||!e)return s;const t=e.keyId;return t&&e.isCommonEncryption&&ye(s,["moov","trak"]).forEach(r=>{const o=ye(r,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=ye(o,["enca"]);const A=a.length>0;A||(a=ye(o,["encv"])),a.forEach(l=>{const c=A?l.subarray(28):l.subarray(78);ye(c,["sinf"]).forEach(h=>{const d=ic(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: ${ii.hexDump(g)} -> ${ii.hexDump(t)}`),d.set(t,8))}})})}),s}function ic(s){const e=ye(s,["schm"])[0];if(e){const t=At(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ye(s,["schi","tenc"])[0]}return N.error("[eme] missing 'schm' box"),null}function d0(s,e){return ye(e,["moof","traf"]).reduce((t,i)=>{const r=ye(i,["tfdt"])[0],n=r[0],o=ye(i,["tfhd"]).reduce((a,A)=>{const l=ue(A,4),c=s[l];if(c){let u=ue(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+=ue(r,8)}const h=c.timescale||9e4,d=u/h;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 g0(s,e){let t=0,i=0,r=0;const n=ye(s,["moof","traf"]);for(let o=0;o<n.length;o++){const a=n[o],A=ye(a,["tfhd"])[0],l=ue(A,4),c=e[l];if(!c)continue;const u=c.default,h=ue(A,0)|(u==null?void 0:u.flags);let d=u==null?void 0:u.duration;h&8&&(h&2?d=ue(A,12):d=ue(A,8));const g=c.timescale||9e4,f=ye(a,["trun"]);for(let p=0;p<f.length;p++){if(t=f0(f[p]),!t&&d){const v=ue(f[p],4);t=d*v}c.type===Ne.VIDEO?i+=t/g:c.type===Ne.AUDIO&&(r+=t/g)}}if(i===0&&r===0){let o=1/0,a=0,A=0;const l=ye(s,["sidx"]);for(let c=0;c<l.length;c++){const u=c0(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&&Ae(A))return A}return i||r}function f0(s){const e=ue(s,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const r=ue(s,4);for(let n=0;n<r;n++){if(e&256){const o=ue(s,t);i+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function p0(s,e,t){ye(e,["moof","traf"]).forEach(i=>{ye(i,["tfhd"]).forEach(r=>{const n=ue(r,4),o=s[n];if(!o)return;const a=o.timescale||9e4;ye(i,["tfdt"]).forEach(A=>{const l=A[0],c=t*a;if(c){let u=ue(A,4);if(l===0)u-=c,u=Math.max(u,0),Ko(A,4,u);else{u*=Math.pow(2,32),u+=ue(A,8),u-=c,u=Math.max(u,0);const h=Math.floor(u/(on+1)),d=Math.floor(u%(on+1));Ko(A,4,h),Ko(A,8,d)}}})})})}function E0(s){const e={valid:null,remainder:null},t=ye(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 Nt(s,e){const t=new Uint8Array(s.length+e.length);return t.set(s),t.set(e,s.length),t}function sc(s,e){const t=[],i=e.samples,r=e.timescale,n=e.id;let o=!1;return ye(i,["moof"]).map(A=>{const l=A.byteOffset-8;ye(A,["traf"]).map(u=>{const h=ye(u,["tfdt"]).map(d=>{const g=d[0];let f=ue(d,4);return g===1&&(f*=Math.pow(2,32),f+=ue(d,8)),f/r})[0];return h!==void 0&&(s=h),ye(u,["tfhd"]).map(d=>{const g=ue(d,4),f=ue(d,0)&16777215,p=(f&1)!==0,v=(f&2)!==0,y=(f&8)!==0;let b=0;const C=(f&16)!==0;let Q=0;const B=(f&32)!==0;let L=8;g===n&&(p&&(L+=8),v&&(L+=4),y&&(b=ue(d,L),L+=4),C&&(Q=ue(d,L),L+=4),B&&(L+=4),e.type==="video"&&(o=I0(e.codec)),ye(u,["trun"]).map(_=>{const $=_[0],k=ue(_,0)&16777215,M=(k&1)!==0;let X=0;const V=(k&4)!==0,z=(k&256)!==0;let R=0;const x=(k&512)!==0;let G=0;const S=(k&1024)!==0,w=(k&2048)!==0;let T=0;const Y=ue(_,4);let U=8;M&&(X=ue(_,U),U+=4),V&&(U+=4);let q=X+l;for(let se=0;se<Y;se++){if(z?(R=ue(_,U),U+=4):R=b,x?(G=ue(_,U),U+=4):G=Q,S&&(U+=4),w&&($===0?T=ue(_,U):T=ec(_,U),U+=4),e.type===Ne.VIDEO){let ce=0;for(;ce<G;){const ne=ue(i,q);if(q+=4,m0(o,i[q])){const me=i.subarray(q,q+ne);rc(me,o?2:1,s+T/r,t)}q+=ne,ce+=ne+4}}s+=R/r}}))})})}),t}function I0(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 m0(s,e){if(s){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function rc(s,e,t,i){const r=nc(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=ue(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,b=new Uint8Array(y);if(v){b[0]=f;for(let C=1;C<y;C++)b[C]=r[c++]}i.push({type:g,payloadType:o,pts:t,bytes:b})}}}}}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:ti(d),userDataBytes:d})}}}function nc(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 C0(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=ue(s,12),n=ue(s,16),a=ue(s,20),A=ue(s,24),l=28}else if(e===1){l+=4,r=ue(s,l),l+=4;const u=ue(s,l);l+=4;const h=ue(s,l);for(l+=4,o=4294967296*u+h,Mf(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=ue(s,l),l+=4,A=ue(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 v0(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 y0(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),v0([112,115,115,104],new Uint8Array([i,0,0,0]),s,n,r,o,t||new Uint8Array)}function B0(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=ii.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 or{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 Rt.FAIRPLAY:case Rt.WIDEVINE:case Rt.PLAYREADY:case Rt.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=Q0(e);return new or(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=jf(this.uri);if(t)switch(this.keyFormat){case Rt.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Rt.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=y0(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=Po(c).subarray(0,16);qf(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 Q0(s){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=s>>8*(15-t)&255;return e}const oc=/\{\$([a-zA-Z0-9-_]+)\}/g;function ac(s){return oc.test(s)}function xt(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]=Jo(s,n))}}function Jo(s,e){if(s.variableList!==null||s.hasVariableRefs){const t=s.variableList;return e.replace(oc,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 Ac(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 b0(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 S0(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 w0(s,e){const t=ln[e];return!!t&&!!t[s.slice(0,4)]}function Wo(s,e,t=!0){return!s.split(",").some(i=>!lc(i,e,t))}function lc(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 cc(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 qo={};function R0(s,e=!0){if(qo[s])return qo[s];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[s];for(let i=0;i<t.length;i++)if(lc(t[i],"audio",e))return qo[s]=t[i],t[i];return s}const x0=/flac|opus/i;function un(s,e=!0){return s.replace(x0,t=>R0(t.toLowerCase(),e))}function uc(s,e){return s&&s!=="mp4a"?s:e&&e.split(",")[0]}function T0(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 hc=/#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,dc=/#EXT-X-MEDIA:(.*)/g,D0=/^#EXT(?:INF|-X-TARGETDURATION):/m,gc=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"),L0=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 ri{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 No.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return D0.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=[];hc.lastIndex=0;let o;for(;(o=hc.exec(e))!=null;)if(o[1]){var a;const l=new qe(o[1]);xt(r,l,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=Jo(r,o[2]),u={attrs:l,bitrate:l.decimalInteger("BANDWIDTH")||l.decimalInteger("AVERAGE-BANDWIDTH"),name:l.NAME,url:ri.resolve(c,t)},h=l.decimalResolution("RESOLUTION");h&&(u.width=h.width,u.height=h.height),_0(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);xt(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=fc(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);xt(r,u,["NAME","VALUE","QUERYPARAM"]),Ac(r,u,t)}break}case"CONTENT-STEERING":{const u=new qe(c);xt(r,u,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:ri.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=pc(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(dc.lastIndex=0;(r=dc.exec(e))!==null;){const l=new qe(r[1]),c=l.TYPE;if(c){const u=a[c],h=n[c]||[];n[c]=h,xt(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?ri.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 b=ri.findGroup(u,y.groupId)||u[0];Ec(y,b,"audioCodec"),Ec(y,b,"textCodec")}h.push(y)}}return n}static parseLevelPlaylist(e,t,i,r,n,o){const a=new Jf(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,b=-1,C=!1,Q=null;for(gc.lastIndex=0,a.m3u8=e,a.hasVariableRefs=ac(e);(p=gc.exec(e))!==null;){C&&(C=!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,Q&&(f.setByteRange(Q),Q=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(Ae(f.duration)){f.start=h,y&&Cc(f,y,a),f.sn=c,f.level=i,f.cc=d,A.push(f);const k=(" "+p[3]).slice(1);f.relurl=Jo(a,k),Ic(f,g),g=f,h+=f.duration,c++,u=0,C=!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]),b===-1&&(b=A.length);else{if(p=p[0].match(L0),!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),M=(" "+p[v+1]).slice(1),X=p[v+2]?(" "+p[v+2]).slice(1):"";switch(k){case"PLAYLIST-TYPE":a.type=M.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(M);break;case"SKIP":{const V=new qe(M);xt(a,V,["RECENTLY-REMOVED-DATERANGES"]);const z=V.decimalInteger("SKIPPED-SEGMENTS");if(Ae(z)){a.skippedSegments=z;for(let x=z;x--;)A.unshift(null);c+=z}const R=V.enumeratedString("RECENTLY-REMOVED-DATERANGES");R&&(a.recentlyRemovedDateranges=R.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(M),1);break;case"VERSION":a.version=parseInt(M);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(M||X)&&f.tagList.push(X?[M,X]:[M]);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,M]);break;case"DATERANGE":{const V=new qe(M);xt(a,V,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),xt(a,V,V.clientAttrs);const z=new Hl(V,a.dateRanges[V.ID]);z.isValid||a.skippedSegments?a.dateRanges[z.id]=z:N.warn(`Ignoring invalid DATERANGE tag: "${M}"`),f.tagList.push(["EXT-X-DATERANGE",M]);break}case"DEFINE":{{const V=new qe(M);xt(a,V,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in V?b0(a,V,o):Ac(a,V,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(M);break;case"KEY":{const V=fc(M,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: "${M}"`);break}case"START":a.startTimeOffset=pc(M);break;case"MAP":{const V=new qe(M);if(xt(a,V,["BYTERANGE","URI"]),f.duration){const z=new Oo(r,t);mc(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 R=f.byteRangeStartOffset;Q=`${z-R}@${R}`}else Q=null;mc(f,V,i,y),l=f,C=!0}break}case"SERVER-CONTROL":{const V=new qe(M);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(M);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,R=u++,x=new qe(M);xt(a,x,["BYTERANGE","URI"]);const G=new Kf(x,f,t,R,z);V.push(G),f.duration+=G.duration;break}case"PRELOAD-HINT":{const V=new qe(M);xt(a,V,["URI"]),a.preloadHint=V;break}case"RENDITION-REPORT":{const V=new qe(M);xt(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&&(Ic(f,g),f.cc=d,a.fragmentHint=f,y&&Cc(f,y,a));const B=A.length,L=A[0],_=A[B-1];if(h+=a.skippedSegments*a.targetduration,h>0&&B&&_){a.averagetargetduration=h/B;const $=_.sn;a.endSN=$!=="initSegment"?$:0,a.live||(_.endList=!0),L&&(a.startCC=L.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(h+=a.fragmentHint.duration),a.totalduration=h,a.endCC=d,b>0&&k0(A,b),a}}function fc(s,e,t){var i,r;const n=new qe(s);xt(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?ri.resolve(a,e):"",h=(l||"1").split("/").map(Number).filter(Number.isFinite);return new or(o,u,c,h,A)}function pc(s){const t=new qe(s).decimalFloatingPoint("TIME-OFFSET");return Ae(t)?t:null}function _0(s,e){let t=(s||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const r=t.filter(n=>w0(n,i));r.length&&(e[`${i}Codec`]=r.join(","),t=t.filter(n=>r.indexOf(n)===-1))}),e.unknownCodecs=t}function Ec(s,e,t){const i=e[t];i&&(s[t]=i)}function k0(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 Ic(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 mc(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 Cc(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"},he={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function vc(s){const{type:e}=s;switch(e){case Le.AUDIO_TRACK:return he.AUDIO;case Le.SUBTITLE_TRACK:return he.SUBTITLE;default:return he.MAIN}}function jo(s,e){let t=s.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class F0{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),Ae((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(),ri.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=jo(e,i),A=ri.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}=ri.parseMasterPlaylistMedia(o,a,A);f.length&&!f.some(b=>!b.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=jo(e,i),u=0,h=Ae(A)?A:Ae(a)?a:0,d=vc(i),g=ri.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:Ie.NETWORK_ERROR,details:H.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=H.UNKNOWN,l=!1;const c=this.getInternalLoader(e);switch(e.type){case Le.MANIFEST:A=i?H.MANIFEST_LOAD_TIMEOUT:H.MANIFEST_LOAD_ERROR,l=!0;break;case Le.LEVEL:A=i?H.LEVEL_LOAD_TIMEOUT:H.LEVEL_LOAD_ERROR,l=!1;break;case Le.AUDIO_TRACK:A=i?H.AUDIO_TRACK_LOAD_TIMEOUT:H.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Le.SUBTITLE_TRACK:A=i?H.SUBTITLE_TRACK_LOAD_TIMEOUT:H.SUBTITLE_LOAD_ERROR,l=!1;break}c&&this.resetInternalLoader(e.type);const u={type:Ie.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=jo(t,r),g=vc(r),f=typeof r.level=="number"&&g===he.MAIN?l:void 0;if(!e.fragments.length){const v=new Error("No Segments found in Playlist");a.trigger(E.ERROR,{type:Ie.NETWORK_ERROR,details:H.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:Ie.NETWORK_ERROR,details:H.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 yc(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 Bc(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 fs(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 Xo(s,e,t,i){const r=s.mode;if(r==="disabled"&&(s.mode="hidden"),s.cues&&s.cues.length>0){const n=M0(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 N0(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 M0(s,e,t){const i=[],r=N0(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 Vt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const O0=.25;function zo(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Qc(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 Zo(s,e){return s.getTime()/1e3-e}function P0(s){return Uint8Array.from(s.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class U0{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&&(fs(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 yc(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===Vt.emsg&&!i||!r)continue;const l=jl(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+O0);for(let d=0;d<l.length;d++){const g=l[d];if(!ql(g)){this.updateId3CueEnds(c,A);const f=Qc(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===Vt.audioId3&&A:r==="video"?l=c=>c.type===Vt.emsg&&a:l=c=>c.type===Vt.audioId3&&A||c.type===Vt.emsg&&a,Xo(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||!Ae(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=Zo(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=Zo(y,A),p=!0;else if(h.endOnNext&&!p){const C=o.reduce((Q,B)=>{if(B!==h.id){const L=n[B];if(L.class===h.class&&L.startDate>h.startDate&&(!Q||h.startDate<Q.startDate))return L}return Q},null);C&&(v=Zo(C.startDate,A),p=!0)}const b=Object.keys(h.attr);for(let C=0;C<b.length;C++){const Q=b[C];if(!$f(Q))continue;const B=f[Q];if(B)p&&!g.durationKnown&&(B.endTime=v);else if(l){let L=h.attr[Q];Yf(Q)&&(L=P0(L));const _=Qc(l,d,v,{key:Q,data:L},Vt.dateRange);_&&(_.id=u,this.id3Track.addCue(_),f[Q]=_)}}i[u]={cues:f,dateRange:h,durationKnown:p}}}}class G0{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===H.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 ea=["NONE","TYPE-0","TYPE-1",null];function H0(s){return ea.indexOf(s)>-1}const gn=["SDR","PQ","HLG"];function $0(s){return!!s&&gn.indexOf(s)>-1}var fn={No:"",Yes:"YES",v2:"v2"};function bc(s){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=s,r=i<e/2;return e&&r?t?fn.v2:fn.Yes:fn.No}class Sc{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 ps{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 wc(this._audioGroups,e)}hasSubtitleGroup(e){return wc(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 wc(s,e){return!e||!s?!1:s.indexOf(e)!==-1}function ta(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 Rc(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(Ae(l)){const p=Math.abs(l-t);Ae(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--)ta(f[d],f[d-1]);for(d=g;d<f.length-1;d++)ta(f[d],f[d+1]);return s.fragmentHint&&ta(f[f.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,u}function Y0(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(J0(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){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=K0(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),V0(s.partList,e.partList,(A,l)=>{l.elementaryStreams=A.elementaryStreams,l.stats=A.stats}),n?Rc(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):xc(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 K0(s,e,t){const i=tt({},s);return t&&t.forEach(r=>{delete i[r]}),Object.keys(e).forEach(r=>{const n=new Hl(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 V0(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 J0(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 xc(s,e){const t=e.startSN+e.skippedSegments-s.startSN,i=s.fragments;t<0||t>=i.length||ia(e,i[t].start)}function ia(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 W0(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 q0(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 Tc(s,e,t){var i;return s!=null&&s.details?Dc((i=s.details)==null?void 0:i.partList,e,t):null}function Dc(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 Lc(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 H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_TIMEOUT:case H.LEVEL_LOAD_TIMEOUT:case H.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function _c(s,e){const t=pn(e);return s.default[`${t?"timeout":"error"}Retry`]}function sa(s,e){const t=s.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*s.retryDelayMs,s.maxRetryDelayMs)}function kc(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&&(j0(r)||!!t);return s.shouldRetry?s.shouldRetry(s,e,t,i,n):n}function j0(s){return s===0&&navigator.onLine===!1||!!s&&(s<400||s>499)}const Fc={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 X0(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(Z0(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)&&ra(t,i,n)===0||z0(n,s,Math.min(r,i))))return n;const o=Fc.search(e,ra.bind(null,t,i));return o&&(o!==s||!n)?o:n}function z0(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 ra(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 Z0(s,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>s}function ep(s,e){return Fc.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},Jt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class tp{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)===he.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 H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case H.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction={action:It.DoNothing,flags:Jt.None};return}case H.FRAG_GAP:case H.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=It.SendAlternateToPenaltyBox;return}case H.LEVEL_EMPTY_ERROR:case H.LEVEL_PARSING_ERROR:{var a,A;const l=t.parent===he.MAIN?t.level:n.loadLevel;t.details===H.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 H.LEVEL_LOAD_ERROR:case H.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case H.AUDIO_TRACK_LOAD_ERROR:case H.AUDIO_TRACK_LOAD_TIMEOUT:case H.SUBTITLE_LOAD_ERROR:case H.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=Jt.MoveAllAlternatesMatchingHost;return}}return;case H.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:Jt.MoveAllAlternatesMatchingHDCP,hdcpLevel:c}:this.keySystemError(t)}return;case H.BUFFER_ADD_CODEC_ERROR:case H.REMUX_ALLOC_ERROR:case H.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(r=t.level)!=null?r:n.loadLevel);return;case H.INTERNAL_EXCEPTION:case H.BUFFER_APPENDING_ERROR:case H.BUFFER_FULL_ERROR:case H.LEVEL_SWITCH_ERROR:case H.BUFFER_STALLED_ERROR:case H.BUFFER_SEEK_OVER_HOLE:case H.BUFFER_NUDGE_ON_STALL:t.errorAction={action:It.DoNothing,flags:Jt.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=_c(i.config.playlistLoadPolicy,e),n=this.playlistError++;if(En(r,n,pn(e),e.response))return{action:It.RetryRequest,flags:Jt.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=_c(e.details.startsWith("key")?o:n,e),A=t.levels.reduce((c,u)=>c+u.fragmentError,0);if(r&&(e.details!==H.FRAG_GAP&&r.fragmentError++,En(a,A,pn(e),e.response)))return{action:It.RetryRequest,flags:Jt.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===H.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===he.AUDIO&&l===H.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(l===H.BUFFER_ADD_CODEC_ERROR||l===H.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:B})=>r.audioCodec!==B),b=e.sourceBufferName==="video"&&(l===H.BUFFER_ADD_CODEC_ERROR||l===H.BUFFER_APPEND_ERROR)&&u.some(({codecSet:B,audioCodec:L})=>r.codecSet!==B&&r.audioCodec===L),{type:C,groupId:Q}=(o=e.context)!=null?o:{};for(let B=u.length;B--;){const L=(B+h)%u.length;if(L!==h&&L>=d&&L<=g&&u[L].loadError===0){var a,A;const _=u[L];if(l===H.FRAG_GAP&&f===he.MAIN&&e.frag){const $=u[L].details;if($){const k=In(e.frag,$.fragments,e.frag.start);if(k!=null&&k.gap)continue}}else{if(C===Le.AUDIO_TRACK&&_.hasAudioGroup(Q)||C===Le.SUBTITLE_TRACK&&_.hasSubtitleGroup(Q))continue;if(f===he.AUDIO&&(a=r.audioGroups)!=null&&a.some($=>_.hasAudioGroup($))||f===he.SUBTITLE&&(A=r.subtitleGroups)!=null&&A.some($=>_.hasSubtitleGroup($))||v&&r.audioCodec===_.audioCodec||!v&&r.audioCodec!==_.audioCodec||b&&r.codecSet===_.codecSet)continue}c=L;break}}if(c>-1&&i.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:It.SendAlternateToPenaltyBox,flags:Jt.None,nextAutoLevel:c}}return{action:It.SendAlternateToPenaltyBox,flags:Jt.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!==H.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 Jt.None:this.switchLevel(e,o);break;case Jt.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=ea[ea.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 na{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&&bc(i);return new Sc(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&&Y0(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,b=r.lastPartIndex,C=b!==-1,Q=v===y,B=p?0:b;C?(l=Q?y+1:v,c=Q?B:b+1):l=y+1;const L=r.age,_=L+r.ageHeader;let $=Math.min(_-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 M=Math.round($%r.targetduration/r.partTarget);c+=M}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${L.toFixed(2)}s goal: ${$} skip sn ${k} to part ${c}`)}r.tuneInGoal=$}if(A=this.getDeliveryDirectives(r,t.deliveryDirectives,l,c),p||!Q){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=W0(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=bc(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=fn.No),new Sc(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=sa(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 ip{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 Nc={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Mc={};function sp(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&&Ae(l)&&Object.keys(c).some(u=>parseInt(u)>l)}function rp(s,e,t){const i=s.videoCodec,r=s.audioCodec;if(!i||!r||!t)return Promise.resolve(Nc);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);Ae(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=np(A);return Mc[l]||(Mc[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 np(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 op(){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 ap(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:op(),t?i=i.filter(r=>r!=="SDR"):i=["SDR"]),{preferHDR:t,allowedVideoRanges:i}}function Ap(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}=ap(e,r);for(let Q=n.length;Q--;){const B=s[n[Q]];l=B.channels[2]>0,u=Math.min(u,B.minHeight),h=Math.min(h,B.minFramerate),d=Math.min(d,B.minBitrate);const L=v.filter(_=>B.videoRanges[_]>0);L.length>0&&(c=!0,f=L)}u=Ae(u)?u:0,h=Ae(h)?h:0;const y=Math.max(1080,u),b=Math.max(30,h);return d=Ae(d)?d:t,t=Math.max(d,t),c||(e=void 0,f=[]),{codecSet:n.reduce((Q,B)=>{const L=s[B];if(B===Q)return Q;if(L.minBitrate>t)return yi(B,`min bitrate of ${L.minBitrate} > current estimate of ${t}`),Q;if(!L.hasDefaultAudio)return yi(B,"no renditions with default or auto-select sound found"),Q;if(a&&B.indexOf(a.substring(0,4))%5!==0)return yi(B,`audio codec preference "${a}" not found`),Q;if(o&&!A){if(!L.channels[o])return yi(B,`no renditions with ${o} channel sound found (channels options: ${Object.keys(L.channels)})`),Q}else if((!a||A)&&l&&L.channels[2]===0)return yi(B,"no renditions with stereo sound found"),Q;return L.minHeight>y?(yi(B,`min resolution of ${L.minHeight} > maximum of ${y}`),Q):L.minFramerate>b?(yi(B,`min framerate of ${L.minFramerate} > maximum of ${b}`),Q):f.some(_=>L.videoRanges[_]>0)?L.maxScore<g?(yi(B,`max score of ${L.maxScore} < selected max of ${g}`),Q):Q&&(cn(B)>=cn(Q)||L.fragmentError>s[Q].fragmentError)?Q:(g=L.maxScore,B):(yi(B,`no variants with VIDEO-RANGE of ${JSON.stringify(f)} found`),Q)},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 lp(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 cp(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 ni(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(Is(s,r,t))return i}return-1}function Is(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||up(a,e.characteristics))&&(t===void 0||t(s,e))}function up(s,e=""){const t=s.split(","),i=e.split(",");return t.length===i.length&&!t.some(r=>i.indexOf(r)===-1)}function ms(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 hp(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 ni(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 ni(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 dp{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(),b=r.levels,C=b[t.level],Q=A.total||Math.max(A.loaded,Math.round(l*C.averageBitrate/8));let B=v?c-p:c;B<1&&v&&(B=Math.min(c,A.loaded*8/y));const L=v?A.loaded*1e3/B:0,_=L?(Q-A.loaded)/L:Q*8/y+d/1e3;if(_<=f)return;const $=L?L*8:y;let k=Number.POSITIVE_INFINITY,M;for(M=t.level-1;M>u;M--){const V=b[M].maxBitrate;if(k=this.getTimeToLoadFrag(d/1e3,$,l*V,!b[M].details),k<f)break}if(k>=_||k>l*10)return;r.nextLoadLevel=r.nextAutoLevel=M,v?this.bwEstimator.sample(c-Math.min(d,p),A.loaded):this.bwEstimator.sampleTTFB(c);const X=b[M].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>X&&this.resetEstimator(X),this.clearTimer(),N.warn(`[abr] Fragment ${t.sn}${i?" part "+i.index:""} of level ${t.level} is loading too slowly;
162
162
  Time to underbuffer: ${f.toFixed(3)} s
163
163
  Estimated load time for current fragment: ${_.toFixed(3)} s
164
164
  Estimated load time for down switch fragment: ${k.toFixed(3)} s
165
165
  TTFB estimate: ${p|0} ms
166
166
  Current BW estimate: ${Ae(y)?y|0:"Unknown"} bps
167
167
  New BW estimate: ${this.getBwEstimate()|0} bps
168
- Switching to level ${O} @ ${X|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 ip(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 H.BUFFER_ADD_CODEC_ERROR:case H.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case H.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===ge.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!==ge.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,h=n.abrBandWidthUpFactor;if(l){const p=this.findBestLevel(A,o,r,l,0,c,h);if(p>=0)return p}let u=a?Math.min(a,n.maxStarvationDelay):n.maxStarvationDelay;if(!l){const p=this.bitrateTestDelay;p&&(u=(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*u)} ms`),c=h=1)}const d=this.findBestLevel(A,o,r,l,u,c,h);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,h=c===-1?this.hls.firstLevel:c,{fragCurrent:u,partCurrent:d}=this,{levels:g,allAudioTracks:f,loadLevel:p,config:v}=this.hls;if(g.length===1)return 0;const y=g[h],b=!!(y!=null&&(A=y.details)!=null&&A.live),C=p===-1||c===-1;let Q,B="SDR",L=(y==null?void 0:y.frameRate)||0;const{audioPreference:_,videoPreference:K}=v,k=this.audioTracksByGroup||(this.audioTracksByGroup=lp(f));if(C){if(this.firstSelection!==-1)return this.firstSelection;const S=this.codecTiers||(this.codecTiers=cp(g,k,t,i)),R=Ap(S,B,e,_,K),{codecSet:G,videoRanges:x,minFramerate:w,minBitrate:T,preferHDR:$}=R;Q=G,B=$?x[x.length-1]:x[0],L=w,e=Math.max(e,T),N.log(`[abr] picked start tier ${JSON.stringify(R)}`)}else Q=y==null?void 0:y.codecSet,B=y==null?void 0:y.videoRange;const O=d?d.duration:u?u.duration:0,X=this.bwEstimator.getEstimateTTFB()/1e3,V=[];for(let S=i;S>=t;S--){var q;const R=g[S],G=S>h;if(!R)continue;if(v.useMediaCapabilities&&!R.supportedResult&&!R.supportedPromise){const ie=navigator.mediaCapabilities;typeof(ie==null?void 0:ie.decodingInfo)=="function"&&sp(R,k,B,L,e,_)?(R.supportedPromise=rp(R,k,ie),R.supportedPromise.then(he=>{if(!this.hls)return;R.supportedResult=he;const re=this.hls.levels,ve=re.indexOf(R);he.error?N.warn(`[abr] MediaCapabilities decodingInfo error: "${he.error}" for level ${ve} ${JSON.stringify(he)}`):he.supported||(N.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${ve} ${JSON.stringify(he)}`),ve>-1&&re.length>1&&(N.log(`[abr] Removing unsupported level ${ve}`),this.hls.removeLevel(ve)))})):R.supportedResult=Nc}if(Q&&R.codecSet!==Q||B&&R.videoRange!==B||G&&L>R.frameRate||!G&&L>0&&L<R.frameRate||R.supportedResult&&!((q=R.supportedResult.decodingInfoResults)!=null&&q[0].smooth)){V.push(S);continue}const x=R.details,w=(d?x==null?void 0:x.partTarget:x==null?void 0:x.averagetargetduration)||O;let T;G?T=a*e:T=o*e;const $=O&&r>=O*2&&n===0?g[S].averageBitrate:g[S].maxBitrate,U=this.getTimeToLoadFrag(X,T,$*w,x===void 0);if(T>=$&&(S===c||R.loadError===0&&R.fragmentError===0)&&(U<=X||!Ae(U)||b&&!this.bitrateTestDelay||U<l)){const ie=this.forcedAutoLevel;return S!==p&&(ie===-1||ie!==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}" ${B}`),N.info(`[abr] switch candidate:${h}->${S} adjustedbw(${Math.round(T)})-bitrate=${Math.round(T-$)} ttfb:${X.toFixed(1)} avgDuration:${w.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${U.toFixed(1)} firstSelection:${C} codecSet:${Q} videoRange:${B} hls.loadLevel:${p}`)),C&&(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 gp{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 fp{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=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),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=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&&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=Cs(e),i=this.fragments[t];return i?i.buffered?mn(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 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 Cs(s){return`${s.type}_${s.level}_${s.sn}`}const pp={length:0,start:()=>0,end:()=>0};class He{static isBuffered(e,t){try{if(e){const i=He.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=He.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 N.log("failed to get media.buffered",t),pp}}}class oa{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 Ep(s,e,t){return!!(e&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function Ip(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 Pc(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function Uc(s,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)Pc(t[i],s);e.fragmentHint&&Pc(e.fragmentHint,s),e.alignedSliding=!0}function mp(s,e,t){e&&(Cp(s,t,e),!t.alignedSliding&&e&&yn(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&xc(e,t))}function Cp(s,e,t){if(Ep(s,t,e)){const i=Ip(t,e);i&&Ae(i.start)&&(N.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),Uc(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);Uc(l,s)}const Gc=Math.pow(2,17);class vp{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:me.NETWORK_ERROR,details:H.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($c(e));return}else e.gap=!1;const l=this.loader=e.loader=n?new n(r):new o(r),c=Hc(e),h=kc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Gc};e.stats=l.stats,l.load(c,u,{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:me.NETWORK_ERROR,details:H.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:p}))},onAbort:(d,g,f)=>{this.resetLoader(e,l),A(new Bi({type:me.NETWORK_ERROR,details:H.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:me.NETWORK_ERROR,details:H.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${u.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($c(e,t));return}const l=this.loader=e.loader=n?new n(r):new o(r),c=Hc(e,t),h=kc(r.fragLoadPolicy.default),u={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Gc};t.stats=l.stats,l.load(c,u,{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:me.NETWORK_ERROR,details:H.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:p}))},onAbort:(d,g,f)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),A(new Bi({type:me.NETWORK_ERROR,details:H.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:me.NETWORK_ERROR,details:H.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 Hc(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 $c(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:me.MEDIA_ERROR,details:H.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 yp{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 Bp{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 Qp(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?Xi(s,0,e-t):s}class bp{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,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],b=d[y],C=d[b];let Q=d[v]*257^v*16843008;r[g]=Q<<24|Q>>>8,n[g]=Q<<16|Q>>>16,o[g]=Q<<8|Q>>>24,a[g]=Q,Q=C*16843009^b*65537^y*257^g*16843008,l[v]=Q<<24|Q>>>8,c[v]=Q<<16|Q>>>16,h[v]=Q<<8|Q>>>24,u[v]=Q,g?(g=y^d[d[d[C^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),h=this.sBox,u=this.rcon,d=this.invSubMix,g=d[0],f=d[1],p=d[2],v=d[3];let y,b;for(a=0;a<o;a++){if(a<n){y=l[a]=t[a];continue}b=y,a%n===0?(b=b<<8|b>>>24,b=h[b>>>24]<<24|h[b>>>16&255]<<16|h[b>>>8&255]<<8|h[b&255],b^=u[a/n|0]<<24):n>6&&a%n===4&&(b=h[b>>>24]<<24|h[b>>>16&255]<<16|h[b>>>8&255]<<8|h[b&255]),l[a]=y=(l[a-n]^b)>>>0}for(A=0;A<o;A++)a=o-A,A&3?b=l[a]:b=l[a-4],A<4||a<=4?c[A]=b:c[A]=g[h[b>>>24]]^f[h[b>>>16&255]]^p[h[b>>>8&255]]^v[h[b&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],p=u[3];const v=new Int32Array(e),y=new Int32Array(v.length);let b,C,Q,B,L,_,K,k,O,X,V,q,S,R;const G=this.networkToHostOrderSwap;for(;t<v.length;){for(O=G(v[t]),X=G(v[t+1]),V=G(v[t+2]),q=G(v[t+3]),L=O^n[0],_=q^n[1],K=V^n[2],k=X^n[3],S=4,R=1;R<r;R++)b=A[L>>>24]^l[_>>16&255]^c[K>>8&255]^h[k&255]^n[S],C=A[_>>>24]^l[K>>16&255]^c[k>>8&255]^h[L&255]^n[S+1],Q=A[K>>>24]^l[k>>16&255]^c[L>>8&255]^h[_&255]^n[S+2],B=A[k>>>24]^l[L>>16&255]^c[_>>8&255]^h[K&255]^n[S+3],L=b,_=C,K=Q,k=B,S=S+4;b=o[L>>>24]<<24^o[_>>16&255]<<16^o[K>>8&255]<<8^o[k&255]^n[S],C=o[_>>>24]<<24^o[K>>16&255]<<16^o[k>>8&255]<<8^o[L&255]^n[S+1],Q=o[K>>>24]<<24^o[k>>16&255]<<16^o[L>>8&255]<<8^o[_&255]^n[S+2],B=o[k>>>24]<<24^o[L>>16&255]<<16^o[_>>8&255]<<8^o[K&255]^n[S+3],y[t]=G(b^d),y[t+1]=G(B^g),y[t+2]=G(Q^f),y[t+3]=G(C^p),d=O,g=X,f=V,p=q,t=t+4}return y.buffer}}const Sp=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?Qp(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=Nt(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 bp),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 Bp(this.subtle,t)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new yp(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%Sp;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 wp={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 Aa extends gp{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=N.log.bind(N,`${r}:`),this.warn=N.warn.bind(N,`${r}:`),this.hls=e,this.fragmentLoader=new vp(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=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 He.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=He.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(E.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(E.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===z.STOPPED||this.state===z.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)===lt.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)===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(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:me.MEDIA_ERROR,details:H.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===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===ge.MAIN?"level":"track"} ${e.level} (frag:[${((i=e.startPTS)!=null?i:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${a?wp.toString(He.getBuffered(a)):"(detached)"})`),e.sn!=="initSegment"){var A;if(e.type!==ge.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==ge.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 oa(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(E.KEY_LOADED,c),this.state===z.KEY_LOADING&&(this.state=z.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 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(E.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(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=h=>{this.fragmentLoader.loadPart(e,h,r).then(u=>{A[h.index]=u;const d=u.part;this.hls.trigger(E.FRAG_LOADED,u);const g=Tc(i,e.sn,h.index+1)||Dc(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===H.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:me.OTHER_ERROR,details:H.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?Tc(a,n,o):null,l=A?A.fragment:q0(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=Nt(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(!He.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=He.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=He.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 He.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=ge.MAIN){const i=this.fragmentTracker.getAppendedFrag(e,ge.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=X0(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=ep(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,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=In(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 p=o[d+1];u.sn<a&&this.fragmentTracker.getState(p)!==lt.OK?u=p: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;mp(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===H.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=sa(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!==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=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===ge.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=He.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:Rc(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(E.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(E.ERROR,{type:me.MEDIA_ERROR,details:H.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(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 Yc{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=Rp(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Rp(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 xp(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Tp(){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 Dp(s){const e=new self.URL(s,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function oi(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class la{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=Nt(this.cachedData,e),this.cachedData=null);let i=nr(e,0),r=i?i.length:0,n;const o=this._audioTrack,a=this._id3Track,A=i?$o(i):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&Ae(A))&&(this.basePTS=Lp(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:Vt.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 e0(e,r)?(i=nr(e,r),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Vt.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=Nt(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:oi(),id3Track:a,textTrack:oi()}}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:oi(),id3Track:this._id3Track,textTrack:oi()}}destroy(){}}const Lp=(s,e,t)=>{if(Ae(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};function _p(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(E.ERROR,E.ERROR,{type:me.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!0,error:u,reason:u.message});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,N.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 Kc(s,e){return s[e]===255&&(s[e+1]&246)===240}function Vc(s,e){return s[e+1]&1?7:9}function ca(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function kp(s,e){return e+5<s.length}function Bn(s,e){return e+1<s.length&&Kc(s,e)}function Fp(s,e){return kp(s,e)&&Kc(s,e)&&ca(s,e)<=s.length-e}function Np(s,e){if(Bn(s,e)){const t=Vc(s,e);if(e+t>=s.length)return!1;const i=ca(s,e);if(i<=t)return!1;const r=e+i;return r===s.length||Bn(s,r)}return!1}function Jc(s,e,t,i,r){if(!s.samplerate){const n=_p(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 Wc(s){return 9216e4/s}function Mp(s,e){const t=Vc(s,e);if(e+t<=s.length){const i=ca(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function qc(s,e,t,i,r){const n=Wc(s.samplerate),o=i+r*n,a=Mp(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 Qn=null;const Op=[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],Pp=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Up=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Gp=[0,1,1,4];function jc(s,e,t,i,r){if(t+24>e.length)return;const n=Xc(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 Xc(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=Op[A*14+r-1]*1e3,h=Pp[(t===3?0:t===2?1:2)*3+n],u=a===3?1:2,d=Up[t][i],g=Gp[i],f=d*8*g,p=Math.floor(d*l/h+o)*g;if(Qn===null){const b=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Qn=b?parseInt(b[1]):0}return!!Qn&&Qn<=87&&i===2&&l>=224e3&&a===0&&(s[e+3]=s[e+3]|128),{sampleRate:h,channelCount:u,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 Hp(s,e){return ha(s,e)&&4<=s.length-e}function Zc(s,e){if(e+1<s.length&&ha(s,e)){const i=Xc(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 $p extends la{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=nr(e,0);let i=(t==null?void 0:t.length)||0;if(Zc(e,i))return!1;for(let r=e.length;i<r;i++)if(Np(e,i))return N.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Fp(e,t)}appendFrame(e,t,i){Jc(e,this.observer,t,i,e.manifestCodec);const r=qc(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Yp=/\/emsg[-/]ID3/i;class Kp{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=oi("video",1),o=this.audioTrack=oi("audio",1),a=this.txtTrack=oi("text",1);if(this.id3Track=oi("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const A=tc(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=Xl.text,n.sampleDuration=0,n.duration=o.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return l0(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Nt(this.remainderData,e));const a=E0(i);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=i;const o=this.extractID3Track(r,t);return n.samples=sc(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=sc(e,t),{videoTrack:t,audioTrack:oi(),id3Track:r,textTrack:oi()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=ye(e.samples,["emsg"]);r&&r.forEach(n=>{const o=C0(n);if(Yp.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:Vt.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 eh=(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 Vp extends la{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=th(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=nr(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&$o(t)!==void 0&&eh(e,i)<16}}function th(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,p=e[t+5]>>3,v=e[t+5]&7,y=new Uint8Array([n<<6|p<<1|v>>2,(v&3)<<6|h<<3|d<<2|A>>4,A<<4&224]),b=1536/a*9e4,C=i+r*b,Q=e.subarray(t,t+c);return s.config=y,s.channelCount=f,s.samplerate=a,s.samples.push({unit:Q,pts:C}),c}class Jp{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 ih{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),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 p=A();if(l(5),u(3),A(),g(),p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){const B=c();if(B===3&&u(1),g(),g(),u(1),h())for(o=B!==3?8:12,a=0;a<o;a++)h()&&(a<6?f(16):f(64))}g();const v=c();if(v===0)c();else if(v===1)for(u(1),d(),d(),n=c(),a=0;a<n;a++)d();g(),u(1);const y=c(),b=c(),C=l(1);C===0&&u(1),u(1),h()&&(e=c(),t=c(),i=c(),r=c());let Q=[1,1];if(h()&&h())switch(A()){case 1:Q=[1,1];break;case 2:Q=[12,11];break;case 3:Q=[10,11];break;case 4:Q=[16,11];break;case 5:Q=[40,33];break;case 6:Q=[24,11];break;case 7:Q=[20,11];break;case 8:Q=[32,11];break;case 9:Q=[80,33];break;case 10:Q=[18,11];break;case 11:Q=[15,11];break;case 12:Q=[64,33];break;case 13:Q=[160,99];break;case 14:Q=[4,3];break;case 15:Q=[3,2];break;case 16:Q=[2,1];break;case 255:{Q=[A()<<8|A(),A()<<8|A()];break}}return{width:Math.ceil((y+1)*16-e*2-t*2),height:(2-C)*(b+1)*16-(C?2:4)*(i+r),pixelRatio:Q}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class Wp extends Jp{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 p=c.data;if(l&&p.length>4){const v=new ih(p).readSliceType();(v===2||v===4||v===7||v===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,rc(c.data,1,i.pts,t.samples);break}case 7:{var d,g;A=!0,l=!0;const f=c.data,v=new ih(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 b="avc1.";for(let C=0;C<3;C++){let Q=y[C].toString(16);Q.length<2&&(Q="0"+Q),b+=Q}e.codec=b}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=Nt(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=Nt(d.data,t))}return e.naluState=r,o}}class qp{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=nc(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 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 Wp}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(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=ua(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:Xl[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,h=o.pesData,u=a.pid,d=A.pid,g=a.pesData,f=A.pesData,p=null,v=this.pmtParsed,y=this._pmtId,b=e.length;if(this.remainderData&&(e=Nt(this.remainderData,e),b=e.length,this.remainderData=null),b<ct&&!r)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};const C=Math.max(0,Ni.syncOffset(e));b-=(b-C)%ct,b<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,b,e.buffer.byteLength-b));let Q=0;for(let L=C;L<b;L+=ct)if(e[L]===71){const _=!!(e[L+1]&64),K=ua(e,L),k=(e[L+3]&48)>>4;let O;if(k>1){if(O=L+5+e[L+4],O===L+ct)continue}else O=L+4;switch(K){case c:_&&(h&&(n=vs(h))&&this.videoParser.parseAVCPES(o,l,n,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(O,L+ct)),h.size+=L+ct-O);break;case u:if(_){if(g&&(n=vs(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(O,L+ct)),g.size+=L+ct-O);break;case d:_&&(f&&(n=vs(f))&&this.parseID3PES(A,n),f={data:[],size:0}),f&&(f.data.push(e.subarray(O,L+ct)),f.size+=L+ct-O);break;case 0:_&&(O+=e[O]+1),y=this._pmtId=jp(e,O);break;case y:{_&&(O+=e[O]+1);const X=Xp(e,O,this.typeSupported,i,this.observer);c=X.videoPid,c>0&&(o.pid=c,o.segmentCodec=X.segmentVideoCodec),u=X.audioPid,u>0&&(a.pid=u,a.segmentCodec=X.segmentAudioCodec),d=X.id3Pid,d>0&&(A.pid=d),p!==null&&!v&&(N.warn(`MPEG-TS PMT found at ${L} after unknown PID '${p}'. Backtracking to sync byte @${C} to parse all TS packets.`),p=null,L=C-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=K;break}}else Q++;Q>0&&bn(this.observer,new Error(`Found ${Q} TS packet/s that do not start with 0x47`)),o.pesData=h,a.pesData=g,A.pesData=f;const B={audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};return r&&this.extractRemainingSamples(B),B}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=vs(o))?(this.videoParser.parseAVCPES(i,n,l,!0,this._duration),i.pesData=null):i.pesData=o,a&&(l=vs(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=vs(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 qp(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=Nt(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&&!Bn(n,o);o++);if(o!==i){let h;const u=o<a-1;if(u?h=`AAC PES did not start with ADTS header,offset:${o}`:h="No ADTS header found in AAC PES",bn(this.observer,new Error(h),u),!u)return}Jc(e,this.observer,n,o,this.audioCodec);let A;if(t.pts!==void 0)A=t.pts;else if(r){const h=Wc(e.samplerate);A=r.sample.pts+h}else{N.warn("[tsdemuxer]: AAC PES unknown PTS");return}let l=0,c;for(;o<a;)if(c=qc(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=jc(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=th(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=et({},t,{type:this._videoTrack?Vt.emsg:Vt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function ua(s,e){return((s[e+1]&31)<<8)+s[e+2]}function jp(s,e){return(s[e+10]&31)<<8|s[e+11]}function Xp(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=ua(s,e),c=(s[e+3]&15)<<8|s[e+4];switch(s[e]){case 207:if(!i){da("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){da("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){da("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 h=e+5,u=c;for(;u>2;){switch(s[h]){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[h+1]+2;h+=g,u-=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:me.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function da(s){N.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function vs(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]=Nt(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 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 zp extends la{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=nr(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&$o(t)!==void 0&&eh(e,i)<=16)return!1;for(let r=e.length;i<r;i++)if(Zc(e,i))return N.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Hp(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return jc(e,t,i,this.basePTS,this.frameIndex)}}class sh{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],h=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,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 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,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 M.box(M.types.trun,o)}static initSegment(e){M.types||M.init();const t=M.moov(e);return Nt(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 rh=9e4;function ga(s,e,t=1,i=!1){const r=s*e*t;return i?Math.round(r):r}function Zp(s,e,t=1,i=!1){return ga(s,e,1/t,i)}function Ar(s,e=!1){return ga(s,1e3,1/rh,e)}function eE(s,e=1){return ga(s,rh,1/e)}const tE=10*1e3,nh=1024,iE=1152,sE=1536;let ys=null,fa=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,ys===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ys=o?parseInt(o[1]):0}if(fa===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);fa=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,Mt(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,h,u,d,g,f=n,p=n;const v=e.pid>-1,y=t.pid>-1,b=t.samples.length,C=e.samples.length>0,Q=a&&b>0||b>1;if((!v||C)&&(!y||Q)||this.ISGenerated||a){if(this.ISGenerated){var L,_,K,k;const q=this.videoTrackConfig;q&&(t.width!==q.width||t.height!==q.height||((L=t.pixelRatio)==null?void 0:L[0])!==((_=q.pixelRatio)==null?void 0:_[0])||((K=t.pixelRatio)==null?void 0:K[1])!==((k=q.pixelRatio)==null?void 0:k[1]))&&this.resetInitSegment()}else h=this.generateIS(e,t,n,o);const O=this.isVideoContiguous;let X=-1,V;if(Q&&(X=rE(t.samples),!O&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,X>0){N.warn(`[mp4-remuxer]: Dropped ${X} out of ${b} video samples due to a missing keyframe`);const q=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(X),t.dropped+=X,p+=(t.samples[0].pts-q)/t.inputTimeScale,V=p}else X===-1&&(N.warn(`[mp4-remuxer]: No keyframe found out of ${b} video samples`),g=!1);if(this.ISGenerated){if(C&&Q){const q=this.getVideoStartPts(t.samples),R=(Mt(e.samples[0].pts,q)-q)/t.inputTimeScale;f+=Math.max(0,R),p+=Math.max(0,-R)}if(C){if(e.samplerate||(N.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,n,o)),c=this.remuxAudio(e,f,this.isAudioContiguous,o,y||Q||A===ge.AUDIO?p:void 0),Q){const q=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(N.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,n,o)),l=this.remuxVideo(t,p,O,q)}}else Q&&(l=this.remuxVideo(t,p,O,0));l&&(l.firstKeyFrame=X,l.independent=X!==-1,l.firstKeyFramePTS=V)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(d=oh(i,n,this._initPTS,this._initDTS)),r.samples.length&&(u=ah(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):M.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: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,Mt(o[0].dts,f)-p),u=Math.min(u,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: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,p=Number.NEGATIVE_INFINITY,v=!1;if(!i||c===null){const w=t*n,T=o[0].pts-Mt(o[0].dts,o[0].pts);ys&&c!==null&&Math.abs(w-T-c)<15e3?i=!0:c=w-T}const y=l.baseTime*n/l.timescale;for(let w=0;w<A;w++){const T=o[w];T.pts=Mt(T.pts-y,c),T.dts=Mt(T.dts-y,c),T.dts<o[w>0?w-1:w].dts&&(v=!0)}v&&o.sort(function(w,T){const $=w.dts-T.dts,U=w.pts-T.pts;return $||U}),d=o[0].dts,g=o[o.length-1].dts;const b=g-d,C=b?Math.round(b/(A-1)):u||e.inputTimeScale/30;if(i){const w=d-c,T=w>C,$=w<-1;if((T||$)&&(T?N.warn(`AVC: ${Ar(w,!0)} ms (${w}dts) hole between fragments detected at ${t.toFixed(3)}`):N.warn(`AVC: ${Ar(-w,!0)} ms (${w}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!$||c>=o[0].pts||ys)){d=c;const U=o[0].pts-w;if(T)o[0].dts=d,o[0].pts=U;else for(let j=0;j<o.length&&!(o[j].dts>U);j++)o[j].dts-=w,o[j].pts-=w;N.log(`Video: Initial PTS/DTS adjusted: ${Ar(U,!0)}/${Ar(d,!0)}, delta: ${Ar(w,!0)} ms`)}}d=Math.max(0,d);let Q=0,B=0,L=d;for(let w=0;w<A;w++){const T=o[w],$=T.units,U=$.length;let j=0;for(let ie=0;ie<U;ie++)j+=$[ie].data.length;B+=j,Q+=U,T.length=j,T.dts<L?(T.dts=L,L+=C/4|0||1):L=T.dts,f=Math.min(T.pts,f),p=Math.max(T.pts,p)}g=o[A-1].dts;const _=B+4*Q+8;let K;try{K=new Uint8Array(_)}catch(w){this.observer.emit(E.ERROR,E.ERROR,{type:me.MUX_ERROR,details:H.REMUX_ALLOC_ERROR,fatal:!1,error:w,bytes:_,reason:`fail allocating video mdat ${_}`});return}const k=new DataView(K.buffer);k.setUint32(0,_),K.set(M.types.mdat,4);let O=!1,X=Number.POSITIVE_INFINITY,V=Number.POSITIVE_INFINITY,q=Number.NEGATIVE_INFINITY,S=Number.NEGATIVE_INFINITY;for(let w=0;w<A;w++){const T=o[w],$=T.units;let U=0;for(let he=0,re=$.length;he<re;he++){const ve=$[he],Qe=ve.data,be=ve.data.byteLength;k.setUint32(h,be),h+=4,K.set(Qe,h),h+=be,U+=4+be}let j;if(w<A-1)u=o[w+1].dts-T.dts,j=o[w+1].pts-T.pts;else{const he=this.config,re=w>0?T.dts-o[w-1].dts:C;if(j=w>0?T.pts-o[w-1].pts:C,he.stretchShortVideoTrack&&this.nextAudioPts!==null){const ve=Math.floor(he.maxBufferHole*n),Qe=(r?f+r*n:this.nextAudioPts)-T.pts;Qe>ve?(u=Qe-re,u<0?u=re:O=!0,N.log(`[mp4-remuxer]: It is approximately ${Qe/90} ms to the next segment; using duration ${u/90} ms for the last video frame.`)):u=re}else u=re}const ie=Math.round(T.pts-T.dts);X=Math.min(X,u),q=Math.max(q,u),V=Math.min(V,j),S=Math.max(S,j),a.push(new Ah(T.key,u,U,ie))}if(a.length){if(ys){if(ys<70){const w=a[0].flags;w.dependsOn=2,w.isNonSync=0}}else if(fa&&S-V<q-X&&C/q<.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 T=0,$=a.length;T<$;T++){const U=w+a[T].duration,j=w+a[T].cts;if(T<$-1){const ie=U+a[T+1].cts;a[T].duration=ie-j}else a[T].duration=T?a[T-1].duration:C;a[T].cts=0,w=U}}}u=O||!u?C:u,this.nextAvcDts=c=g+u,this.videoSampleDuration=u,this.isVideoContiguous=!0;const x={data1:M.moof(e.sequenceNumber++,d,et({},e,{samples:a})),data2:K,startPTS:f/n,endPTS:(p+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,x}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return iE;case"ac3":return sE;default:return nh}}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,p=u?0:8,v=this.nextAudioPts||-1;const y=t*o,b=h.baseTime*o/h.timescale;if(this.isAudioContiguous=i=i||f.length&&v>0&&(r&&Math.abs(y-v)<9e3||Math.abs(Mt(f[0].pts-b,y)-v)<20*c),f.forEach(function(R){R.pts=Mt(R.pts-b,y)}),!i||v<0){if(f=f.filter(R=>R.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 R=this.config.maxAudioFramesDrift;for(let G=0,x=v;G<f.length;G++){const w=f[G],T=w.pts,$=T-x,U=Math.abs(1e3*$/o);if($<=-R*c&&g)G===0&&(N.warn(`Audio frame @ ${(T/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*$/o)} ms.`),this.nextAudioPts=v=x=T);else if($>=R*c&&U<tE&&g){let j=Math.round($/c);x=T-j*c,x<0&&(j--,x+=c),G===0&&(this.nextAudioPts=v=x),N.warn(`[mp4-remuxer]: Injecting ${j} audio frame @ ${(x/o).toFixed(3)}s due to ${Math.round(1e3*$/o)} ms gap.`);for(let ie=0;ie<j;ie++){const he=Math.max(x,0);let re=sh.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);re||(N.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),re=w.unit.subarray()),f.splice(G,0,{unit:re,pts:he}),x+=c,G++}}w.pts=x,x+=c}}let C=null,Q=null,B,L=0,_=f.length;for(;_--;)L+=f[_].unit.byteLength;for(let R=0,G=f.length;R<G;R++){const x=f[R],w=x.unit;let T=x.pts;if(Q!==null){const U=d[R-1];U.duration=Math.round((T-Q)/A)}else if(i&&e.segmentCodec==="aac"&&(T=v),C=T,L>0){L+=p;try{B=new Uint8Array(L)}catch(U){this.observer.emit(E.ERROR,E.ERROR,{type:me.MUX_ERROR,details:H.REMUX_ALLOC_ERROR,fatal:!1,error:U,bytes:L,reason:`fail allocating audio mdat ${L}`});return}u||(new DataView(B.buffer).setUint32(0,L),B.set(M.types.mdat,4))}else return;B.set(w,p);const $=w.byteLength;p+=$,d.push(new Ah(!0,l,$,0)),Q=T}const K=d.length;if(!K)return;const k=d[d.length-1];this.nextAudioPts=v=Q+A*k.duration;const O=u?new Uint8Array(0):M.moof(e.sequenceNumber++,C/A,et({},e,{samples:d}));e.samples=[];const X=C/o,V=v/o,S={data1:O,data2:B,startPTS:X,endPTS:V,startDTS:X,endDTS:V,type:"audio",hasAudio:!0,hasVideo:!1,nb:K};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,h=(A!==null?A:r.startDTS*n)+c,u=r.endDTS*n+c,d=a*nh,g=Math.ceil((u-h)/d),f=sh.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=h+v*d;p.push({unit:f,pts:y,dts:y})}return e.samples=p,this.remuxAudio(e,t,i,!1)}}function Mt(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 rE(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function oh(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=Mt(A.pts-t.baseTime*n/t.timescale,e*n)/n,A.dts=Mt(A.dts-i.baseTime*n/i.timescale,e*n)/n}const o=s.samples;return s.samples=[],{samples:o}}function ah(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=Mt(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 Ah{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 nE{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(u0(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=tc(e);r.audio&&(t=lh(r.audio,Ne.AUDIO)),r.video&&(i=lh(r.video,Ne.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 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 N.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const f=g0(u,g),p=d0(g,u),v=p===null?n:p;(oE(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,b=y+f;p0(g,u,l.baseTime/l.timescale),f>0?this.lastEndTime=b:(N.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const C=!!g.audio,Q=!!g.video;let B="";C&&(B+="audio"),Q&&(B+="video");const L={data1:u,startPTS:y,startDTS:y,endPTS:b,endDTS:b,type:B,hasAudio:C,hasVideo:Q,nb:1,dropped:0};return h.audio=L.type==="audio"?L:void 0,h.video=L.type!=="audio"?L:void 0,h.initSegment=d,h.id3=oh(i,n,l,l),r.samples.length&&(h.text=ah(r,n,l)),h}}function oE(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 lh(s,e){const t=s==null?void 0:s.codec;if(t&&t.length>4)return t;if(e===Ne.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return hn(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=gs==null?void 0:gs.Date.now}const wn=[{demux:Kp,remux:nE},{demux:Ni,remux:Sn},{demux:$p,remux:Sn},{demux:zp,remux:Sn}];wn.splice(2,0,{demux:Vp,remux:Sn});class ch{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:h,accurateTimeOffset:u,timeOffset:d,initSegmentChange:g}=r||a,{audioCodec:f,videoCodec:p,defaultInitPts:v,duration:y,initSegmentData:b}=A,C=aE(o,t);if(C&&C.method==="AES-128"){const _=this.getDecrypter();if(_.isSync()){let K=_.softwareDecrypt(o,C.key.buffer,C.iv.buffer);if(i.part>-1&&(K=_.flush()),!K)return n.executeEnd=Qi(),pa(i);o=new Uint8Array(K)}else return this.decryptionPromise=_.webCryptoDecrypt(o,C.key.buffer,C.iv.buffer).then(K=>{const k=this.push(K,null,i);return this.decryptionPromise=null,k}),this.decryptionPromise}const Q=this.needsProbing(c,h);if(Q){const _=this.configureTransmuxer(o);if(_)return N.warn(`[transmuxer] ${_.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:me.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,error:_,reason:_.message}),n.executeEnd=Qi(),pa(i)}(c||h||g||Q)&&this.resetInitSegment(b,f,p,y,t),(c||g||Q)&&this.resetInitialTimestamp(v),l||this.resetContiguity();const B=this.transmux(o,C,d,u,i),L=this.currentTransmuxState;return L.contiguous=!0,L.discontinuity=!1,L.trackSwitch=!1,n.executeEnd=Qi(),B}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 h=i.flush();h&&o.push(this.push(h,null,e))}const{demuxer:A,remuxer:l}=this;if(!A||!l)return t.executeEnd=Qi(),[pa(e)];const c=A.flush(a);return Rn(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;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 u=0,d=wn.length;u<d;u++){var a;if((a=wn[u].demux)!=null&&a.probe(e)){o=wn[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 aa(this.config)),e}}function aE(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 pa=s=>({remuxResult:{},chunkMeta:s});function Rn(s){return"then"in s&&s.then instanceof Function}class AE{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 lE{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 hh={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 p=this._events[f],v=arguments.length,y,b;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,h),!0;case 4:return p.fn.call(p.context,c,h,u),!0;case 5:return p.fn.call(p.context,c,h,u,d),!0;case 6:return p.fn.call(p.context,c,h,u,d,g),!0}for(b=1,y=new Array(v-1);b<v;b++)y[b-1]=arguments[b];p.fn.apply(p.context,y)}else{var C=p.length,Q;for(b=0;b<C;b++)switch(p[b].once&&this.removeListener(l,p[b].fn,void 0,!0),v){case 1:p[b].fn.call(p[b].context);break;case 2:p[b].fn.call(p[b].context,c);break;case 3:p[b].fn.call(p[b].context,c,h);break;case 4:p[b].fn.call(p[b].context,c,h,u);break;default:if(!y)for(Q=1,y=new Array(v-1);Q<v;Q++)y[Q-1]=arguments[Q];p[b].fn.apply(p[b].context,y)}}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,p=[],v=g.length;f<v;f++)(g[f].fn!==c||u&&!g[f].once||h&&g[f].context!==h)&&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})(hh);var cE=hh.exports,Ea=_f(cE);class uh{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 Ea,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||xp())){try{n.workerPath?(N.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=Dp(n.workerPath)):(N.log(`injecting Web Worker for "${t}"`),this.workerContext=Tp()),this.onwmsg=h=>this.onWorkerMessage(h);const{worker:c}=this.workerContext;c.addEventListener("message",this.onwmsg),c.onerror=h=>{const u=new Error(`${h.message} (${h.filename}:${h.lineno})`);n.enableWorker=!1,N.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(E.ERROR,{type:me.OTHER_ERROR,details:H.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})},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 ch(this.observer,A,n,"",t)}return}this.transmuxer=new ch(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 h,u;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),b=p?l.sn-p.sn:-1,C=this.part?l.part-this.part.index:-1,Q=b===0&&l.id>1&&l.id===(p==null?void 0:p.stats.chunkCount),B=!y&&(b===1||b===0&&(C===1||Q&&C<=0)),L=self.performance.now();(y||b||n.stats.parsing.start===0)&&(n.stats.parsing.start=L),o&&(C||!B)&&(o.stats.parsing.start=L);const _=!(p&&((h=n.initSegment)==null?void 0:h.url)===((u=p.initSegment)==null?void 0:u.url)),K=new lE(v,B,A,y,g,_);if(!B||v||_){N.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}
168
+ Switching to level ${M} @ ${X|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 ip(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 H.BUFFER_ADD_CODEC_ERROR:case H.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case H.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;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===he.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!==he.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],b=!!(y!=null&&(A=y.details)!=null&&A.live),C=p===-1||c===-1;let Q,B="SDR",L=(y==null?void 0:y.frameRate)||0;const{audioPreference:_,videoPreference:$}=v,k=this.audioTracksByGroup||(this.audioTracksByGroup=lp(f));if(C){if(this.firstSelection!==-1)return this.firstSelection;const R=this.codecTiers||(this.codecTiers=cp(g,k,t,i)),x=Ap(R,B,e,_,$),{codecSet:G,videoRanges:S,minFramerate:w,minBitrate:T,preferHDR:Y}=x;Q=G,B=Y?S[S.length-1]:S[0],L=w,e=Math.max(e,T),N.log(`[abr] picked start tier ${JSON.stringify(x)}`)}else Q=y==null?void 0:y.codecSet,B=y==null?void 0:y.videoRange;const M=d?d.duration:h?h.duration:0,X=this.bwEstimator.getEstimateTTFB()/1e3,V=[];for(let R=i;R>=t;R--){var z;const x=g[R],G=R>u;if(!x)continue;if(v.useMediaCapabilities&&!x.supportedResult&&!x.supportedPromise){const se=navigator.mediaCapabilities;typeof(se==null?void 0:se.decodingInfo)=="function"&&sp(x,k,B,L,e,_)?(x.supportedPromise=rp(x,k,se),x.supportedPromise.then(ce=>{if(!this.hls)return;x.supportedResult=ce;const ne=this.hls.levels,me=ne.indexOf(x);ce.error?N.warn(`[abr] MediaCapabilities decodingInfo error: "${ce.error}" for level ${me} ${JSON.stringify(ce)}`):ce.supported||(N.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${me} ${JSON.stringify(ce)}`),me>-1&&ne.length>1&&(N.log(`[abr] Removing unsupported level ${me}`),this.hls.removeLevel(me)))})):x.supportedResult=Nc}if(Q&&x.codecSet!==Q||B&&x.videoRange!==B||G&&L>x.frameRate||!G&&L>0&&L<x.frameRate||x.supportedResult&&!((z=x.supportedResult.decodingInfoResults)!=null&&z[0].smooth)){V.push(R);continue}const S=x.details,w=(d?S==null?void 0:S.partTarget:S==null?void 0:S.averagetargetduration)||M;let T;G?T=a*e:T=o*e;const Y=M&&r>=M*2&&n===0?g[R].averageBitrate:g[R].maxBitrate,U=this.getTimeToLoadFrag(X,T,Y*w,S===void 0);if(T>=Y&&(R===c||x.loadError===0&&x.fragmentError===0)&&(U<=X||!Ae(U)||b&&!this.bitrateTestDelay||U<l)){const se=this.forcedAutoLevel;return R!==p&&(se===-1||se!==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}" ${B}`),N.info(`[abr] switch candidate:${u}->${R} adjustedbw(${Math.round(T)})-bitrate=${Math.round(T-Y)} ttfb:${X.toFixed(1)} avgDuration:${w.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${U.toFixed(1)} firstSelection:${C} codecSet:${Q} videoRange:${B} hls.loadLevel:${p}`)),C&&(this.firstSelection=R),R}}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 gp{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 fp{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=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],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=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 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=Cs(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=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 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 Cs(s){return`${s.type}_${s.level}_${s.sn}`}const pp={length:0,start:()=>0,end:()=>0};class He{static isBuffered(e,t){try{if(e){const i=He.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=He.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),pp}}}class oa{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 Ep(s,e,t){return!!(e&&(t.endCC>t.startCC||s&&s.cc<t.startCC))}function Ip(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 Pc(s,e){if(s){const t=s.start+e;s.start=s.startPTS=t,s.endPTS=t+s.duration}}function Uc(s,e){const t=e.fragments;for(let i=0,r=t.length;i<r;i++)Pc(t[i],s);e.fragmentHint&&Pc(e.fragmentHint,s),e.alignedSliding=!0}function mp(s,e,t){e&&(Cp(s,t,e),!t.alignedSliding&&e&&yn(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&xc(e,t))}function Cp(s,e,t){if(Ep(s,t,e)){const i=Ip(t,e);i&&Ae(i.start)&&(N.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),Uc(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);Uc(l,s)}const Gc=Math.pow(2,17);class vp{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:Ie.NETWORK_ERROR,details:H.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($c(e));return}else e.gap=!1;const l=this.loader=e.loader=n?new n(r):new o(r),c=Hc(e),u=kc(r.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Gc};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:Ie.NETWORK_ERROR,details:H.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:Ie.NETWORK_ERROR,details:H.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:Ie.NETWORK_ERROR,details:H.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($c(e,t));return}const l=this.loader=e.loader=n?new n(r):new o(r),c=Hc(e,t),u=kc(r.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Gc};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:Ie.NETWORK_ERROR,details:H.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:Ie.NETWORK_ERROR,details:H.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:Ie.NETWORK_ERROR,details:H.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 Hc(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 $c(s,e){const t=new Error(`GAP ${s.gap?"tag":"attribute"} found`),i={type:Ie.MEDIA_ERROR,details:H.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 yp{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 Bp{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 Qp(s){const e=s.byteLength,t=e&&new DataView(s.buffer).getUint8(e-1);return t?Xi(s,0,e-t):s}class bp{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],b=d[y],C=d[b];let Q=d[v]*257^v*16843008;r[g]=Q<<24|Q>>>8,n[g]=Q<<16|Q>>>16,o[g]=Q<<8|Q>>>24,a[g]=Q,Q=C*16843009^b*65537^y*257^g*16843008,l[v]=Q<<24|Q>>>8,c[v]=Q<<16|Q>>>16,u[v]=Q<<8|Q>>>24,h[v]=Q,g?(g=y^d[d[d[C^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,b;for(a=0;a<o;a++){if(a<n){y=l[a]=t[a];continue}b=y,a%n===0?(b=b<<8|b>>>24,b=u[b>>>24]<<24|u[b>>>16&255]<<16|u[b>>>8&255]<<8|u[b&255],b^=h[a/n|0]<<24):n>6&&a%n===4&&(b=u[b>>>24]<<24|u[b>>>16&255]<<16|u[b>>>8&255]<<8|u[b&255]),l[a]=y=(l[a-n]^b)>>>0}for(A=0;A<o;A++)a=o-A,A&3?b=l[a]:b=l[a-4],A<4||a<=4?c[A]=b:c[A]=g[u[b>>>24]]^f[u[b>>>16&255]]^p[u[b>>>8&255]]^v[u[b&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 b,C,Q,B,L,_,$,k,M,X,V,z,R,x;const G=this.networkToHostOrderSwap;for(;t<v.length;){for(M=G(v[t]),X=G(v[t+1]),V=G(v[t+2]),z=G(v[t+3]),L=M^n[0],_=z^n[1],$=V^n[2],k=X^n[3],R=4,x=1;x<r;x++)b=A[L>>>24]^l[_>>16&255]^c[$>>8&255]^u[k&255]^n[R],C=A[_>>>24]^l[$>>16&255]^c[k>>8&255]^u[L&255]^n[R+1],Q=A[$>>>24]^l[k>>16&255]^c[L>>8&255]^u[_&255]^n[R+2],B=A[k>>>24]^l[L>>16&255]^c[_>>8&255]^u[$&255]^n[R+3],L=b,_=C,$=Q,k=B,R=R+4;b=o[L>>>24]<<24^o[_>>16&255]<<16^o[$>>8&255]<<8^o[k&255]^n[R],C=o[_>>>24]<<24^o[$>>16&255]<<16^o[k>>8&255]<<8^o[L&255]^n[R+1],Q=o[$>>>24]<<24^o[k>>16&255]<<16^o[L>>8&255]<<8^o[_&255]^n[R+2],B=o[k>>>24]<<24^o[L>>16&255]<<16^o[_>>8&255]<<8^o[$&255]^n[R+3],y[t]=G(b^d),y[t+1]=G(B^g),y[t+2]=G(Q^f),y[t+3]=G(C^p),d=M,g=X,f=V,p=z,t=t+4}return y.buffer}}const Sp=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?Qp(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=Nt(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 bp),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 Bp(this.subtle,t)}return this.fastAesKey.expandKey().then(r=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new yp(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%Sp;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 wp={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}},j={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 Aa extends gp{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=j.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 vp(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=j.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 He.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===j.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=He.bufferInfo(r||i,o,e.maxBufferHole);if(this.log(`media seeking to ${Ae(o)?o.toFixed(3):o}, state: ${n}`),this.state===j.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=j.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===j.FRAG_LOADING||!this.fragCurrent&&o===j.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=j.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===j.STOPPED||this.state===j.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:Ie.MEDIA_ERROR,details:H.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===j.STOPPED||this.state===j.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=j.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===he.MAIN?"level":"track"} ${e.level} (frag:[${((i=e.startPTS)!=null?i:NaN).toFixed(3)}-${((r=e.endPTS)!=null?r:NaN).toFixed(3)}] > buffer:${a?wp.toString(He.getBuffered(a)):"(detached)"})`),e.sn!=="initSegment"){var A;if(e.type!==he.SUBTITLE){const c=e.elementaryStreams;if(!Object.keys(c).some(u=>!!c[u])){this.state=j.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=j.IDLE,a&&(!this.loadedmetadata&&e.type==he.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 oa(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=j.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===j.KEY_LOADING&&(this.state=j.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=j.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))}`),Ae(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=j.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=Tc(i,e.sn,u.index+1)||Dc(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===H.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:Ie.OTHER_ERROR,details:H.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==j.PARSING){!this.fragCurrent&&this.state!==j.STOPPED&&this.state!==j.ERROR&&(this.state=j.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?Tc(a,n,o):null,l=A?A.fragment:q0(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!==j.PARSING)return;const{data1:a,data2:A}=e;let l=a;if(a&&A&&(l=Nt(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(!He.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,r=He.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=He.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 He.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=he.MAIN){const i=this.fragmentTracker.getAppendedFrag(e,he.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=X0(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=ep(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&&Ae(n);if(o||!a&&!n){const{fragPrevious:A}=this;mp(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!==j.FRAG_LOADING_WAITING_RETRY)&&(this.state=j.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===H.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=sa(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=j.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=j.WAITING_LEVEL:this.state=j.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===j.PARSING||this.state===j.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===he.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==j.STOPPED&&(this.state=j.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const r=He.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,i),this.state===j.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=j.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:Rc(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:Ie.MEDIA_ERROR,details:H.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=j.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 Yc{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=Rp(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Rp(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 xp(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Tp(){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 Dp(s){const e=new self.URL(s,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function oi(s="",e=9e4){return{type:s,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class la{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=Nt(this.cachedData,e),this.cachedData=null);let i=nr(e,0),r=i?i.length:0,n;const o=this._audioTrack,a=this._id3Track,A=i?$o(i):void 0,l=e.length;for((this.basePTS===null||this.frameIndex===0&&Ae(A))&&(this.basePTS=Lp(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:Vt.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 e0(e,r)?(i=nr(e,r),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Vt.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=Nt(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:oi(),id3Track:a,textTrack:oi()}}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:oi(),id3Track:this._id3Track,textTrack:oi()}}destroy(){}}const Lp=(s,e,t)=>{if(Ae(s))return s*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};function _p(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:Ie.MEDIA_ERROR,details:H.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 Kc(s,e){return s[e]===255&&(s[e+1]&246)===240}function Vc(s,e){return s[e+1]&1?7:9}function ca(s,e){return(s[e+3]&3)<<11|s[e+4]<<3|(s[e+5]&224)>>>5}function kp(s,e){return e+5<s.length}function Bn(s,e){return e+1<s.length&&Kc(s,e)}function Fp(s,e){return kp(s,e)&&Kc(s,e)&&ca(s,e)<=s.length-e}function Np(s,e){if(Bn(s,e)){const t=Vc(s,e);if(e+t>=s.length)return!1;const i=ca(s,e);if(i<=t)return!1;const r=e+i;return r===s.length||Bn(s,r)}return!1}function Jc(s,e,t,i,r){if(!s.samplerate){const n=_p(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 Wc(s){return 9216e4/s}function Mp(s,e){const t=Vc(s,e);if(e+t<=s.length){const i=ca(s,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function qc(s,e,t,i,r){const n=Wc(s.samplerate),o=i+r*n,a=Mp(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 Op=[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],Pp=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Up=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Gp=[0,1,1,4];function jc(s,e,t,i,r){if(t+24>e.length)return;const n=Xc(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 Xc(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=Op[A*14+r-1]*1e3,u=Pp[(t===3?0:t===2?1:2)*3+n],h=a===3?1:2,d=Up[t][i],g=Gp[i],f=d*8*g,p=Math.floor(d*l/u+o)*g;if(Qn===null){const b=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Qn=b?parseInt(b[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 ua(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&&ua(s,e)}function Hp(s,e){return ua(s,e)&&4<=s.length-e}function Zc(s,e){if(e+1<s.length&&ua(s,e)){const i=Xc(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 $p extends la{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=nr(e,0);let i=(t==null?void 0:t.length)||0;if(Zc(e,i))return!1;for(let r=e.length;i<r;i++)if(Np(e,i))return N.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Fp(e,t)}appendFrame(e,t,i){Jc(e,this.observer,t,i,e.manifestCodec);const r=qc(e,t,i,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const Yp=/\/emsg[-/]ID3/i;class Kp{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=oi("video",1),o=this.audioTrack=oi("audio",1),a=this.txtTrack=oi("text",1);if(this.id3Track=oi("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const A=tc(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=Xl.text,n.sampleDuration=0,n.duration=o.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return l0(e)}demux(e,t){this.timeOffset=t;let i=e;const r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Nt(this.remainderData,e));const a=E0(i);this.remainderData=a.remainder,r.samples=a.valid||new Uint8Array}else r.samples=i;const o=this.extractID3Track(r,t);return n.samples=sc(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=sc(e,t),{videoTrack:t,audioTrack:oi(),id3Track:r,textTrack:oi()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const r=ye(e.samples,["emsg"]);r&&r.forEach(n=>{const o=C0(n);if(Yp.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:Vt.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 eu=(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 Vp extends la{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=tu(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=nr(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&$o(t)!==void 0&&eu(e,i)<16}}function tu(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]),b=1536/a*9e4,C=i+r*b,Q=e.subarray(t,t+c);return s.config=y,s.channelCount=f,s.samplerate=a,s.samples.push({unit:Q,pts:C}),c}class Jp{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 iu{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 B=c();if(B===3&&h(1),g(),g(),h(1),u())for(o=B!==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(),b=c(),C=l(1);C===0&&h(1),h(1),u()&&(e=c(),t=c(),i=c(),r=c());let Q=[1,1];if(u()&&u())switch(A()){case 1:Q=[1,1];break;case 2:Q=[12,11];break;case 3:Q=[10,11];break;case 4:Q=[16,11];break;case 5:Q=[40,33];break;case 6:Q=[24,11];break;case 7:Q=[20,11];break;case 8:Q=[32,11];break;case 9:Q=[80,33];break;case 10:Q=[18,11];break;case 11:Q=[15,11];break;case 12:Q=[64,33];break;case 13:Q=[160,99];break;case 14:Q=[4,3];break;case 15:Q=[3,2];break;case 16:Q=[2,1];break;case 255:{Q=[A()<<8|A(),A()<<8|A()];break}}return{width:Math.ceil((y+1)*16-e*2-t*2),height:(2-C)*(b+1)*16-(C?2:4)*(i+r),pixelRatio:Q}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class Wp extends Jp{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 iu(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,rc(c.data,1,i.pts,t.samples);break}case 7:{var d,g;A=!0,l=!0;const f=c.data,v=new iu(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 b="avc1.";for(let C=0;C<3;C++){let Q=y[C].toString(16);Q.length<2&&(Q="0"+Q),b+=Q}e.codec=b}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=Nt(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=Nt(d.data,t))}return e.naluState=r,o}}class qp{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=nc(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 Wp}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=ha(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:Xl[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,b=e.length;if(this.remainderData&&(e=Nt(this.remainderData,e),b=e.length,this.remainderData=null),b<ut&&!r)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};const C=Math.max(0,Ni.syncOffset(e));b-=(b-C)%ut,b<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,b,e.buffer.byteLength-b));let Q=0;for(let L=C;L<b;L+=ut)if(e[L]===71){const _=!!(e[L+1]&64),$=ha(e,L),k=(e[L+3]&48)>>4;let M;if(k>1){if(M=L+5+e[L+4],M===L+ut)continue}else M=L+4;switch($){case c:_&&(u&&(n=vs(u))&&this.videoParser.parseAVCPES(o,l,n,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(e.subarray(M,L+ut)),u.size+=L+ut-M);break;case h:if(_){if(g&&(n=vs(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(M,L+ut)),g.size+=L+ut-M);break;case d:_&&(f&&(n=vs(f))&&this.parseID3PES(A,n),f={data:[],size:0}),f&&(f.data.push(e.subarray(M,L+ut)),f.size+=L+ut-M);break;case 0:_&&(M+=e[M]+1),y=this._pmtId=jp(e,M);break;case y:{_&&(M+=e[M]+1);const X=Xp(e,M,this.typeSupported,i,this.observer);c=X.videoPid,c>0&&(o.pid=c,o.segmentCodec=X.segmentVideoCodec),h=X.audioPid,h>0&&(a.pid=h,a.segmentCodec=X.segmentAudioCodec),d=X.id3Pid,d>0&&(A.pid=d),p!==null&&!v&&(N.warn(`MPEG-TS PMT found at ${L} after unknown PID '${p}'. Backtracking to sync byte @${C} to parse all TS packets.`),p=null,L=C-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=$;break}}else Q++;Q>0&&bn(this.observer,new Error(`Found ${Q} TS packet/s that do not start with 0x47`)),o.pesData=u,a.pesData=g,A.pesData=f;const B={audioTrack:a,videoTrack:o,id3Track:A,textTrack:l};return r&&this.extractRemainingSamples(B),B}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=vs(o))?(this.videoParser.parseAVCPES(i,n,l,!0,this._duration),i.pesData=null):i.pesData=o,a&&(l=vs(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=vs(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 qp(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=Nt(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}Jc(e,this.observer,n,o,this.audioCodec);let A;if(t.pts!==void 0)A=t.pts;else if(r){const u=Wc(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=qc(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=jc(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=tu(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?Vt.emsg:Vt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function ha(s,e){return((s[e+1]&31)<<8)+s[e+2]}function jp(s,e){return(s[e+10]&31)<<8|s[e+11]}function Xp(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=ha(s,e),c=(s[e+3]&15)<<8|s[e+4];switch(s[e]){case 207:if(!i){da("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){da("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){da("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:Ie.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function da(s){N.log(`${s} with AES-128-CBC encryption found in unencrypted stream`)}function vs(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]=Nt(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 zp extends la{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=nr(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&$o(t)!==void 0&&eu(e,i)<=16)return!1;for(let r=e.length;i<r;i++)if(Zc(e,i))return N.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Hp(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return jc(e,t,i,this.basePTS,this.frameIndex)}}class su{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],u=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,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 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,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 O.box(O.types.trun,o)}static initSegment(e){O.types||O.init();const t=O.moov(e);return Nt(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 ru=9e4;function ga(s,e,t=1,i=!1){const r=s*e*t;return i?Math.round(r):r}function Zp(s,e,t=1,i=!1){return ga(s,e,1/t,i)}function Ar(s,e=!1){return ga(s,1e3,1/ru,e)}function eE(s,e=1){return ga(s,ru,1/e)}const tE=10*1e3,nu=1024,iE=1152,sE=1536;let ys=null,fa=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,ys===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ys=o?parseInt(o[1]):0}if(fa===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);fa=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,Mt(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,b=t.samples.length,C=e.samples.length>0,Q=a&&b>0||b>1;if((!v||C)&&(!y||Q)||this.ISGenerated||a){if(this.ISGenerated){var L,_,$,k;const z=this.videoTrackConfig;z&&(t.width!==z.width||t.height!==z.height||((L=t.pixelRatio)==null?void 0:L[0])!==((_=z.pixelRatio)==null?void 0:_[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 M=this.isVideoContiguous;let X=-1,V;if(Q&&(X=rE(t.samples),!M&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,X>0){N.warn(`[mp4-remuxer]: Dropped ${X} out of ${b} video samples due to a missing keyframe`);const z=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(X),t.dropped+=X,p+=(t.samples[0].pts-z)/t.inputTimeScale,V=p}else X===-1&&(N.warn(`[mp4-remuxer]: No keyframe found out of ${b} video samples`),g=!1);if(this.ISGenerated){if(C&&Q){const z=this.getVideoStartPts(t.samples),x=(Mt(e.samples[0].pts,z)-z)/t.inputTimeScale;f+=Math.max(0,x),p+=Math.max(0,-x)}if(C){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||Q||A===he.AUDIO?p:void 0),Q){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,M,z)}}else Q&&(l=this.remuxVideo(t,p,M,0));l&&(l.firstKeyFrame=X,l.independent=X!==-1,l.firstKeyFramePTS=V)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(d=ou(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):O.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:O.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,Mt(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,T=o[0].pts-Mt(o[0].dts,o[0].pts);ys&&c!==null&&Math.abs(w-T-c)<15e3?i=!0:c=w-T}const y=l.baseTime*n/l.timescale;for(let w=0;w<A;w++){const T=o[w];T.pts=Mt(T.pts-y,c),T.dts=Mt(T.dts-y,c),T.dts<o[w>0?w-1:w].dts&&(v=!0)}v&&o.sort(function(w,T){const Y=w.dts-T.dts,U=w.pts-T.pts;return Y||U}),d=o[0].dts,g=o[o.length-1].dts;const b=g-d,C=b?Math.round(b/(A-1)):h||e.inputTimeScale/30;if(i){const w=d-c,T=w>C,Y=w<-1;if((T||Y)&&(T?N.warn(`AVC: ${Ar(w,!0)} ms (${w}dts) hole between fragments detected at ${t.toFixed(3)}`):N.warn(`AVC: ${Ar(-w,!0)} ms (${w}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Y||c>=o[0].pts||ys)){d=c;const U=o[0].pts-w;if(T)o[0].dts=d,o[0].pts=U;else for(let q=0;q<o.length&&!(o[q].dts>U);q++)o[q].dts-=w,o[q].pts-=w;N.log(`Video: Initial PTS/DTS adjusted: ${Ar(U,!0)}/${Ar(d,!0)}, delta: ${Ar(w,!0)} ms`)}}d=Math.max(0,d);let Q=0,B=0,L=d;for(let w=0;w<A;w++){const T=o[w],Y=T.units,U=Y.length;let q=0;for(let se=0;se<U;se++)q+=Y[se].data.length;B+=q,Q+=U,T.length=q,T.dts<L?(T.dts=L,L+=C/4|0||1):L=T.dts,f=Math.min(T.pts,f),p=Math.max(T.pts,p)}g=o[A-1].dts;const _=B+4*Q+8;let $;try{$=new Uint8Array(_)}catch(w){this.observer.emit(E.ERROR,E.ERROR,{type:Ie.MUX_ERROR,details:H.REMUX_ALLOC_ERROR,fatal:!1,error:w,bytes:_,reason:`fail allocating video mdat ${_}`});return}const k=new DataView($.buffer);k.setUint32(0,_),$.set(O.types.mdat,4);let M=!1,X=Number.POSITIVE_INFINITY,V=Number.POSITIVE_INFINITY,z=Number.NEGATIVE_INFINITY,R=Number.NEGATIVE_INFINITY;for(let w=0;w<A;w++){const T=o[w],Y=T.units;let U=0;for(let ce=0,ne=Y.length;ce<ne;ce++){const me=Y[ce],be=me.data,we=me.data.byteLength;k.setUint32(u,we),u+=4,$.set(be,u),u+=we,U+=4+we}let q;if(w<A-1)h=o[w+1].dts-T.dts,q=o[w+1].pts-T.pts;else{const ce=this.config,ne=w>0?T.dts-o[w-1].dts:C;if(q=w>0?T.pts-o[w-1].pts:C,ce.stretchShortVideoTrack&&this.nextAudioPts!==null){const me=Math.floor(ce.maxBufferHole*n),be=(r?f+r*n:this.nextAudioPts)-T.pts;be>me?(h=be-ne,h<0?h=ne:M=!0,N.log(`[mp4-remuxer]: It is approximately ${be/90} ms to the next segment; using duration ${h/90} ms for the last video frame.`)):h=ne}else h=ne}const se=Math.round(T.pts-T.dts);X=Math.min(X,h),z=Math.max(z,h),V=Math.min(V,q),R=Math.max(R,q),a.push(new Au(T.key,h,U,se))}if(a.length){if(ys){if(ys<70){const w=a[0].flags;w.dependsOn=2,w.isNonSync=0}}else if(fa&&R-V<z-X&&C/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 T=0,Y=a.length;T<Y;T++){const U=w+a[T].duration,q=w+a[T].cts;if(T<Y-1){const se=U+a[T+1].cts;a[T].duration=se-q}else a[T].duration=T?a[T-1].duration:C;a[T].cts=0,w=U}}}h=M||!h?C:h,this.nextAvcDts=c=g+h,this.videoSampleDuration=h,this.isVideoContiguous=!0;const S={data1:O.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,S}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return iE;case"ac3":return sE;default:return nu}}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,b=u.baseTime*o/u.timescale;if(this.isAudioContiguous=i=i||f.length&&v>0&&(r&&Math.abs(y-v)<9e3||Math.abs(Mt(f[0].pts-b,y)-v)<20*c),f.forEach(function(x){x.pts=Mt(x.pts-b,y)}),!i||v<0){if(f=f.filter(x=>x.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 x=this.config.maxAudioFramesDrift;for(let G=0,S=v;G<f.length;G++){const w=f[G],T=w.pts,Y=T-S,U=Math.abs(1e3*Y/o);if(Y<=-x*c&&g)G===0&&(N.warn(`Audio frame @ ${(T/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*Y/o)} ms.`),this.nextAudioPts=v=S=T);else if(Y>=x*c&&U<tE&&g){let q=Math.round(Y/c);S=T-q*c,S<0&&(q--,S+=c),G===0&&(this.nextAudioPts=v=S),N.warn(`[mp4-remuxer]: Injecting ${q} audio frame @ ${(S/o).toFixed(3)}s due to ${Math.round(1e3*Y/o)} ms gap.`);for(let se=0;se<q;se++){const ce=Math.max(S,0);let ne=su.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);ne||(N.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ne=w.unit.subarray()),f.splice(G,0,{unit:ne,pts:ce}),S+=c,G++}}w.pts=S,S+=c}}let C=null,Q=null,B,L=0,_=f.length;for(;_--;)L+=f[_].unit.byteLength;for(let x=0,G=f.length;x<G;x++){const S=f[x],w=S.unit;let T=S.pts;if(Q!==null){const U=d[x-1];U.duration=Math.round((T-Q)/A)}else if(i&&e.segmentCodec==="aac"&&(T=v),C=T,L>0){L+=p;try{B=new Uint8Array(L)}catch(U){this.observer.emit(E.ERROR,E.ERROR,{type:Ie.MUX_ERROR,details:H.REMUX_ALLOC_ERROR,fatal:!1,error:U,bytes:L,reason:`fail allocating audio mdat ${L}`});return}h||(new DataView(B.buffer).setUint32(0,L),B.set(O.types.mdat,4))}else return;B.set(w,p);const Y=w.byteLength;p+=Y,d.push(new Au(!0,l,Y,0)),Q=T}const $=d.length;if(!$)return;const k=d[d.length-1];this.nextAudioPts=v=Q+A*k.duration;const M=h?new Uint8Array(0):O.moof(e.sequenceNumber++,C/A,tt({},e,{samples:d}));e.samples=[];const X=C/o,V=v/o,R={data1:M,data2:B,startPTS:X,endPTS:V,startDTS:X,endDTS:V,type:"audio",hasAudio:!0,hasVideo:!1,nb:$};return this.isAudioContiguous=!0,R}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*nu,g=Math.ceil((h-u)/d),f=su.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 Mt(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 rE(s){for(let e=0;e<s.length;e++)if(s[e].key)return e;return-1}function ou(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=Mt(A.pts-t.baseTime*n/t.timescale,e*n)/n,A.dts=Mt(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=Mt(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 Au{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 nE{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(h0(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=tc(e);r.audio&&(t=lu(r.audio,Ne.AUDIO)),r.video&&(i=lu(r.video,Ne.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};Ae(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=g0(h,g),p=d0(g,h),v=p===null?n:p;(oE(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,b=y+f;p0(g,h,l.baseTime/l.timescale),f>0?this.lastEndTime=b:(N.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const C=!!g.audio,Q=!!g.video;let B="";C&&(B+="audio"),Q&&(B+="video");const L={data1:h,startPTS:y,startDTS:y,endPTS:b,endDTS:b,type:B,hasAudio:C,hasVideo:Q,nb:1,dropped:0};return u.audio=L.type==="audio"?L:void 0,u.video=L.type!=="audio"?L:void 0,u.initSegment=d,u.id3=ou(i,n,l,l),r.samples.length&&(u.text=au(r,n,l)),u}}function oE(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 lu(s,e){const t=s==null?void 0:s.codec;if(t&&t.length>4)return t;if(e===Ne.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=gs==null?void 0:gs.Date.now}const wn=[{demux:Kp,remux:nE},{demux:Ni,remux:Sn},{demux:$p,remux:Sn},{demux:zp,remux:Sn}];wn.splice(2,0,{demux:Vp,remux:Sn});class cu{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:b}=A,C=aE(o,t);if(C&&C.method==="AES-128"){const _=this.getDecrypter();if(_.isSync()){let $=_.softwareDecrypt(o,C.key.buffer,C.iv.buffer);if(i.part>-1&&($=_.flush()),!$)return n.executeEnd=Qi(),pa(i);o=new Uint8Array($)}else return this.decryptionPromise=_.webCryptoDecrypt(o,C.key.buffer,C.iv.buffer).then($=>{const k=this.push($,null,i);return this.decryptionPromise=null,k}),this.decryptionPromise}const Q=this.needsProbing(c,u);if(Q){const _=this.configureTransmuxer(o);if(_)return N.warn(`[transmuxer] ${_.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:Ie.MEDIA_ERROR,details:H.FRAG_PARSING_ERROR,fatal:!1,error:_,reason:_.message}),n.executeEnd=Qi(),pa(i)}(c||u||g||Q)&&this.resetInitSegment(b,f,p,y,t),(c||g||Q)&&this.resetInitialTimestamp(v),l||this.resetContiguity();const B=this.transmux(o,C,d,h,i),L=this.currentTransmuxState;return L.contiguous=!0,L.discontinuity=!1,L.trackSwitch=!1,n.executeEnd=Qi(),B}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(),[pa(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 aE(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 pa=s=>({remuxResult:{},chunkMeta:s});function Rn(s){return"then"in s&&s.then instanceof Function}class AE{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 lE{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 uu={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,b;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(b=1,y=new Array(v-1);b<v;b++)y[b-1]=arguments[b];p.fn.apply(p.context,y)}else{var C=p.length,Q;for(b=0;b<C;b++)switch(p[b].once&&this.removeListener(l,p[b].fn,void 0,!0),v){case 1:p[b].fn.call(p[b].context);break;case 2:p[b].fn.call(p[b].context,c);break;case 3:p[b].fn.call(p[b].context,c,u);break;case 4:p[b].fn.call(p[b].context,c,u,h);break;default:if(!y)for(Q=1,y=new Array(v-1);Q<v;Q++)y[Q-1]=arguments[Q];p[b].fn.apply(p[b].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})(uu);var cE=uu.exports,Ea=_f(cE);class hu{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 Ea,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||xp())){try{n.workerPath?(N.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=Dp(n.workerPath)):(N.log(`injecting Web Worker for "${t}"`),this.workerContext=Tp()),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:Ie.OTHER_ERROR,details:H.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 cu(this.observer,A,n,"",t)}return}this.transmuxer=new cu(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),b=p?l.sn-p.sn:-1,C=this.part?l.part-this.part.index:-1,Q=b===0&&l.id>1&&l.id===(p==null?void 0:p.stats.chunkCount),B=!y&&(b===1||b===0&&(C===1||Q&&C<=0)),L=self.performance.now();(y||b||n.stats.parsing.start===0)&&(n.stats.parsing.start=L),o&&(C||!B)&&(o.stats.parsing.start=L);const _=!(p&&((u=n.initSegment)==null?void 0:u.url)===((h=p.initSegment)==null?void 0:h.url)),$=new lE(v,B,A,y,g,_);if(!B||v||_){N.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}
169
169
  discontinuity: ${v}
170
170
  trackSwitch: ${y}
171
171
  contiguous: ${B}
172
172
  accurateTimeOffset: ${A}
173
173
  timeOffset: ${g}
174
- initSegmentChange: ${_}`);const k=new AE(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:K},e instanceof ArrayBuffer?[e]:[]);else if(d){const k=d.push(e,f,l,K);Rn(k)?(d.async=!0,k.then(O=>{this.handleTransmuxComplete(O)}).catch(O=>{this.transmuxerError(O,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:me.MEDIA_ERROR,details:H.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 dh(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!Bs(s[t].attrs,e[t].attrs))return!1;return!0}function Bs(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 gh=100;class hE extends Aa{constructor(e,t,i){super(e,t,i,"[audio-stream-controller]",ge.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===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(gh),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=He.bufferInfo(this.mediaBuffer,A,this.config.maxBufferHole);ra(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,Ne.AUDIO,ge.AUDIO));const l=this.getFwdBufferInfo(A,ge.AUDIO);if(l===null)return;const{bufferedTrack:c,switchingTrack:h}=this;if(!h&&this._streamEnded(l,a)){e.trigger(E.BUFFER_EOS,{type:"audio"}),this.state=z.ENDED;return}const u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,ge.MAIN),d=l.len,g=this.getMaxBufferLength(u==null?void 0:u.len),f=a.fragments,p=f[0].start;let v=this.flushing?this.getLoadPosition():l.end;if(h&&i){const Q=this.getLoadPosition();c&&!Bs(h.attrs,c.attrs)&&(v=Q),a.PTSKnown&&Q<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&&!h&&v<f[f.length-1].start)return;let y=this.getNextFragment(v,a),b=!1;if(y&&this.isLoopLoading(y,v)&&(b=!!y.gap,y=this.getNextFragmentLoopLoading(y,a,l,ge.MAIN,g)),!y){this.bufferFlushed=!0;return}const C=u&&y.start>u.end+a.targetduration;if(C||!(u!=null&&u.len)&&l.len){const Q=this.getAppendedFrag(y.start,ge.MAIN);if(Q===null||(b||(b=!!Q.gap||!!C&&u.len===0),C&&!b||b&&l.nextStart&&l.nextStart<Q.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 ps(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(gh):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(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===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 uh(this.hls,ge.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 oa(i.level,i.sn,i.stats.chunkCount,n.byteLength,p,v);u.push(n,g,h,"",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 Yc,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!==ge.AUDIO){if(!this.loadedmetadata&&i.type===ge.MAIN){const n=this.videoBuffer||this.media;n&&He.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,At({},n)))}this.fragBufferedComplete(i,r)}onError(e,t){var i;if(t.fatal){this.state=z.ERROR;return}switch(t.details){case H.FRAG_GAP:case H.FRAG_PARSING_ERROR:case H.FRAG_DECRYPT_ERROR:case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ge.AUDIO,t);break;case H.AUDIO_TRACK_LOAD_ERROR:case H.AUDIO_TRACK_LOAD_TIMEOUT:case H.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===z.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===De.AUDIO_TRACK&&(this.state=z.IDLE);break;case H.BUFFER_APPEND_ERROR:case H.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===H.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case H.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Ne.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Ne.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,ge.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 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(u){const{startPTS:p,endPTS:v,startDTS:y,endDTS:b}=u;l&&(l.elementaryStreams[Ne.AUDIO]={startPTS:p,endPTS:v,startDTS:y,endDTS:b}),A.setElementaryStreamInfo(Ne.AUDIO,p,v,y,b),this.bufferFragmentData(u,A,l,o)}if(g!=null&&(t=g.samples)!=null&&t.length){const p=et({id:i,frag:A,details:h},g);r.trigger(E.FRAG_PARSING_METADATA,p)}if(d){const p=et({id:i,frag:A,details:h},d);r.trigger(E.FRAG_PARSING_USERDATA,p)}}_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(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===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&&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,At({},e))}}class uE extends na{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(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=ni(A,a,ms);if(u>-1)n=a[u];else{const d=ni(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 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(E.ERROR,{type:me.MEDIA_ERROR,details:H.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===De.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&&Is(e,r,ms))return r;const n=ni(e,this.tracksInGroup,ms);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=up(e,t.levels,i,o,ms);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=ni(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,At({},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||Is(e,r,ms)))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(Is({name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A},c,ms))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Bs(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Bs(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 fh=500;class dE extends Aa{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",ge.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=z.IDLE,this.setInterval(fh),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,ge.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===ge.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)===ge.SUBTITLE&&(t.details===H.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==z.STOPPED&&(this.state=z.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&dh(this.levels,t)){this.levels=t.map(i=>new ps(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new ps(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ge.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(fh)}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 h=this.mainDetails;if(o.deltaUpdateFailed||!h)return;const u=h.fragments[0];if(!A.details)o.hasProgramDateTime&&h.hasProgramDateTime?(yn(o,h),l=o.fragments[0].start):u&&(l=u.start,ia(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,ia(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===z.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:me.MEDIA_ERROR,details:H.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=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=He.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:a,len:A}=o,l=this.getFwdBufferInfo(this.media,ge.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 p=this.fragPrevious;if(a<g){const v=r.maxFragLookUpTolerance,y=a>g-v?0:v;f=In(p,u,Math.max(u[0].start,a),y),!f&&p&&p.start<u[0].start&&(f=u[0])}else f=u[d-1];if(!f)return;if(f=this.mapToInitFragWhenRequired(f),f.sn!=="initSegment"){const v=f.sn-c.startSN,y=u[v-1];y&&y.cc===f.cc&&this.fragmentTracker.getState(y)===lt.NOT_LOADED&&(f=y)}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 gE(this.tracksBuffered[this.currentTrackId]||[])}}class gE{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 fE extends na{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=un(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),un(this.media.textTracks).forEach(t=>{fs(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=ni(a,o);if(c>-1)n=o[c];else{const h=ni(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(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||Is(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(Bs(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(Bs(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===De.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&&Is(e,i))return i;const r=ni(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(i)return null;{const n=ni(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=un(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(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 h=this.switchParams(r.url,i==null?void 0:i.details,r.details);this.loadPlaylist(h)}}class pE{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 ph=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class EE{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=S0(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 pE(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,Eh(i),IE(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&&Eh(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:h,container:u,metadata:d}=t[o],g=hc(A.codec,A.levelCodec),f=g==null?void 0:g.replace(ph,"$1");let p=hc(c,h);const v=(a=p)==null?void 0:a.replace(ph,"$1");if(p&&f!==v){o.slice(0,5)==="audio"&&(p=hn(p,this.appendSource));const y=`${u};codecs=${p}`;this.appendChangeType(o,y),this.log(`switching codec ${g} to ${p}`),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 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(h.executeStart=self.performance.now(),p){const b=this.sourceBuffer[a];if(b){const C=v-b.timestampOffset;Math.abs(C)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${v} (delta: ${C}) sn: ${A.sn})`),b.timestampOffset=v)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const b=self.performance.now();h.executeEnd=h.end=b,d.first===0&&(d.first=b),g&&g.first===0&&(g.first=b);const{sourceBuffer:C}=this,Q={};for(const B in C)Q[B]=He.getBuffered(C[B]);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:Q})},onError:b=>{const C={type:me.MEDIA_ERROR,parent:A.type,details:H.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:A,part:l,chunkMeta:c,error:b,err:b,fatal:!1};if(b.code===DOMException.QUOTA_EXCEEDED_ERR)C.details=H.BUFFER_FULL_ERROR;else{const Q=++this.appendErrors[a];C.details=H.BUFFER_APPEND_ERROR,this.warn(`Failed ${Q}/${i.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),Q>=i.config.appendErrorMaxRetry&&(C.fatal=!0)}i.trigger(E.ERROR,C)}};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[Ne.AUDIOVIDEO]?n.push("audiovideo"):(o[Ne.AUDIO]&&n.push("audio"),o[Ne.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(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=He.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=He.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(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=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(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:me.MEDIA_ERROR,details:H.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=hn(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",(h,u)=>{const d=u.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:me.MEDIA_ERROR,details:H.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:me.MEDIA_ERROR,details:H.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 Eh(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function IE(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}const mE={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},Ih=s=>String.fromCharCode(mE[s]||s),Wt=15,bi=100,CE={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},vE={17:2,18:4,21:6,22:8,23:10,19:13,20:15},yE={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},BE={25:2,26:4,29:6,30:8,31:10,27:13,28:15},QE=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class bE{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 mh{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 SE{constructor(){this.uchar=" ",this.penState=new mh}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 wE{constructor(e){this.chars=[],this.pos=0,this.currPenState=new mh,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<bi;t++)this.chars.push(new SE);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=Ih(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 ma{constructor(e){this.rows=[],this.currRow=Wt-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Wt;t++)this.rows.push(new wE(e));this.logger=e}reset(){for(let e=0;e<Wt;e++)this.rows[e].clear();this.currRow=Wt-1}equals(e){let t=!0;for(let i=0;i<Wt;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Wt;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Wt;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<Wt;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<Wt;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 Ch{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 ma(i),this.nonDisplayedMemory=new ma(i),this.lastOutputScreen=new ma(i),this.currRollUpRow=this.displayedMemory.rows[Wt-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[Wt-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 vh{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=xE(),this.logger=void 0;const r=this.logger=new bE;this.channels=[null,new Ch(e,t,r),new Ch(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(RE(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?CE[e]:yE[e]:i=o===1?vE[e]:BE[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 '"+Ih(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=QE[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 RE(s,e,t){return t.a===s&&t.b===e}function xE(){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 Ca=function(){if(gs!=null&&gs.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,p=l,v=null,y="",b=!0,C="auto",Q="start",B=50,L="middle",_=50,K="middle";Object.defineProperty(c,"id",n({},h,{get:function(){return u},set:function(k){u=""+k}})),Object.defineProperty(c,"pauseOnExit",n({},h,{get:function(){return d},set:function(k){d=!!k}})),Object.defineProperty(c,"startTime",n({},h,{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({},h,{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({},h,{get:function(){return p},set:function(k){p=""+k,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",n({},h,{get:function(){return v},set:function(k){v=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",n({},h,{get:function(){return y},set:function(k){const O=i(k);if(O===!1)throw new SyntaxError("An invalid or illegal string was specified.");y=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",n({},h,{get:function(){return b},set:function(k){b=!!k,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",n({},h,{get:function(){return C},set:function(k){if(typeof k!="number"&&k!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",n({},h,{get:function(){return Q},set:function(k){const O=r(k);if(!O)throw new SyntaxError("An invalid or illegal string was specified.");Q=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",n({},h,{get:function(){return B},set:function(k){if(k<0||k>100)throw new Error("Position must be between 0 and 100.");B=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",n({},h,{get:function(){return L},set:function(k){const O=r(k);if(!O)throw new SyntaxError("An invalid or illegal string was specified.");L=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",n({},h,{get:function(){return _},set:function(k){if(k<0||k>100)throw new Error("Size must be between 0 and 100.");_=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",n({},h,{get:function(){return K},set:function(k){const O=r(k);if(!O)throw new SyntaxError("An invalid or illegal string was specified.");K=O,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class TE{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function yh(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 DE{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 Bh(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 va=new Ca(0,0,""),Dn=va.align==="middle"?"middle":"center";function LE(s,e,t){const i=s;function r(){const a=yh(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 DE;Bh(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",Dn,"end"]);break;case"position":g=d.split(","),l.percent(u,g[0]),g.length===2&&l.alt("positionAlign",g[1],["start",Dn,"end","line-left","line-right","auto"]);break;case"size":l.percent(u,d);break;case"align":l.alt(u,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"&&va.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 h=l.get("position","auto");h==="auto"&&va.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 Qh(s){return s.replace(/<br(?: \/)?>/gi,`
176
- `)}class _E{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new TE,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=Qh(n);o<n.length&&n[o]!=="\r"&&n[o]!==`
174
+ initSegmentChange: ${_}`);const k=new AE(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(M=>{this.handleTransmuxComplete(M)}).catch(M=>{this.transmuxerError(M,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:Ie.MEDIA_ERROR,details:H.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 du(s,e){if(s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(!Bs(s[t].attrs,e[t].attrs))return!1;return!0}function Bs(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 gu=100;class uE extends Aa{constructor(e,t,i){super(e,t,i,"[audio-stream-controller]",he.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===j.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=j.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(gu),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=j.IDLE):(this.loadedmetadata=!1,this.state=j.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case j.IDLE:this.doTickIdle();break;case j.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=j.WAITING_INIT_PTS}break}case j.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=j.IDLE}break}case j.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=j.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=He.bufferInfo(this.mediaBuffer,A,this.config.maxBufferHole);ra(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=j.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=j.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=j.WAITING_TRACK;return}const A=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&A&&(this.bufferFlushed=!1,this.afterBufferFlushed(A,Ne.AUDIO,he.AUDIO));const l=this.getFwdBufferInfo(A,he.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=j.ENDED;return}const h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,he.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 Q=this.getLoadPosition();c&&!Bs(u.attrs,c.attrs)&&(v=Q),a.PTSKnown&&Q<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),b=!1;if(y&&this.isLoopLoading(y,v)&&(b=!!y.gap,y=this.getNextFragmentLoopLoading(y,a,l,he.MAIN,g)),!y){this.bufferFlushed=!0;return}const C=h&&y.start>h.end+a.targetduration;if(C||!(h!=null&&h.len)&&l.len){const Q=this.getAppendedFrag(y.start,he.MAIN);if(Q===null||(b||(b=!!Q.gap||!!C&&h.len===0),C&&!b||b&&l.nextStart&&l.nextStart<Q.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 ps(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(gu):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=j.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=j.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===j.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=j.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 hu(this.hls,he.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 oa(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 Yc,complete:!1};f.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=j.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!==he.AUDIO){if(!this.loadedmetadata&&i.type===he.MAIN){const n=this.videoBuffer||this.media;n&&He.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=j.ERROR;return}switch(t.details){case H.FRAG_GAP:case H.FRAG_PARSING_ERROR:case H.FRAG_DECRYPT_ERROR:case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(he.AUDIO,t);break;case H.AUDIO_TRACK_LOAD_ERROR:case H.AUDIO_TRACK_LOAD_TIMEOUT:case H.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===j.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===Le.AUDIO_TRACK&&(this.state=j.IDLE);break;case H.BUFFER_APPEND_ERROR:case H.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===H.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case H.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Ne.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Ne.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===j.ENDED&&(this.state=j.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,he.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=j.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:b}=h;l&&(l.elementaryStreams[Ne.AUDIO]={startPTS:p,endPTS:v,startDTS:y,endDTS:b}),A.setElementaryStreamInfo(Ne.AUDIO,p,v,y,b),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!==j.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=j.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 hE extends na{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=ni(A,a,ms);if(h>-1)n=a[h];else{const d=ni(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:Ie.MEDIA_ERROR,details:H.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&&Is(e,r,ms))return r;const n=ni(e,this.tracksInGroup,ms);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=hp(e,t.levels,i,o,ms);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=ni(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||Is(e,r,ms)))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(Is({name:i,lang:r,assocLang:n,characteristics:o,audioCodec:a,channels:A},c,ms))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Bs(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return l}for(let l=0;l<t.length;l++){const c=t[l];if(Bs(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 fu=500;class dE extends Aa{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",he.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=j.IDLE,this.setInterval(fu),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=j.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,he.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===he.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)===he.SUBTITLE&&(t.details===H.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==j.STOPPED&&(this.state=j.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&du(this.levels,t)){this.levels=t.map(i=>new ps(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const r=new ps(i);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,he.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(fu)}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,ia(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,ia(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===j.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:Ie.MEDIA_ERROR,details:H.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=j.IDLE})}}doTick(){if(!this.media){this.state=j.IDLE;return}if(this.state===j.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=He.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,r.maxBufferHole),{end:a,len:A}=o,l=this.getFwdBufferInfo(this.media,he.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 gE(this.tracksBuffered[this.currentTrackId]||[])}}class gE{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 fE extends na{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=>{fs(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=ni(a,o);if(c>-1)n=o[c];else{const u=ni(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||Is(n,e)))return r}if(e){for(let r=0;r<t.length;r++){const n=t[r];if(Bs(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const n=t[r];if(Bs(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===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&&Is(e,i))return i;const r=ni(e,this.tracksInGroup);if(r>-1){const n=this.tracksInGroup[r];return this.setSubtitleTrack(r),n}else{if(i)return null;{const n=ni(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=>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(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 pE{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 pu=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class EE{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=S0(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 pE(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,Eu(i),IE(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&&Eu(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=uc(A.codec,A.levelCodec),f=g==null?void 0:g.replace(pu,"$1");let p=uc(c,u);const v=(a=p)==null?void 0:a.replace(pu,"$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 b=this.sourceBuffer[a];if(b){const C=v-b.timestampOffset;Math.abs(C)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${v} (delta: ${C}) sn: ${A.sn})`),b.timestampOffset=v)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const b=self.performance.now();u.executeEnd=u.end=b,d.first===0&&(d.first=b),g&&g.first===0&&(g.first=b);const{sourceBuffer:C}=this,Q={};for(const B in C)Q[B]=He.getBuffered(C[B]);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:Q})},onError:b=>{const C={type:Ie.MEDIA_ERROR,parent:A.type,details:H.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:A,part:l,chunkMeta:c,error:b,err:b,fatal:!1};if(b.code===DOMException.QUOTA_EXCEEDED_ERR)C.details=H.BUFFER_FULL_ERROR;else{const Q=++this.appendErrors[a];C.details=H.BUFFER_APPEND_ERROR,this.warn(`Failed ${Q}/${i.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),Q>=i.config.appendErrorMaxRetry&&(C.fatal=!0)}i.trigger(E.ERROR,C)}};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[Ne.AUDIOVIDEO]?n.push("audiovideo"):(o[Ne.AUDIO]&&n.push("audio"),o[Ne.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(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),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=He.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=He.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=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(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:Ie.MEDIA_ERROR,details:H.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:Ie.MEDIA_ERROR,details:H.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:Ie.MEDIA_ERROR,details:H.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,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 Eu(s){const e=s.querySelectorAll("source");[].slice.call(e).forEach(t=>{s.removeChild(t)})}function IE(s,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,s.appendChild(t)}const mE={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},Iu=s=>String.fromCharCode(mE[s]||s),Wt=15,bi=100,CE={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},vE={17:2,18:4,21:6,22:8,23:10,19:13,20:15},yE={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},BE={25:2,26:4,29:6,30:8,31:10,27:13,28:15},QE=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class bE{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 mu{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 SE{constructor(){this.uchar=" ",this.penState=new mu}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 wE{constructor(e){this.chars=[],this.pos=0,this.currPenState=new mu,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<bi;t++)this.chars.push(new SE);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=Iu(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 ma{constructor(e){this.rows=[],this.currRow=Wt-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Wt;t++)this.rows.push(new wE(e));this.logger=e}reset(){for(let e=0;e<Wt;e++)this.rows[e].clear();this.currRow=Wt-1}equals(e){let t=!0;for(let i=0;i<Wt;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Wt;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Wt;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<Wt;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<Wt;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 Cu{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 ma(i),this.nonDisplayedMemory=new ma(i),this.lastOutputScreen=new ma(i),this.currRollUpRow=this.displayedMemory.rows[Wt-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[Wt-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 vu{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=xE(),this.logger=void 0;const r=this.logger=new bE;this.channels=[null,new Cu(e,t,r),new Cu(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(RE(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?CE[e]:yE[e]:i=o===1?vE[e]:BE[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 '"+Iu(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=QE[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 RE(s,e,t){return t.a===s&&t.b===e}function xE(){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 Ca=function(){if(gs!=null&&gs.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="",b=!0,C="auto",Q="start",B=50,L="middle",_=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 M=i(k);if(M===!1)throw new SyntaxError("An invalid or illegal string was specified.");y=M,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",n({},u,{get:function(){return b},set:function(k){b=!!k,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",n({},u,{get:function(){return C},set:function(k){if(typeof k!="number"&&k!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",n({},u,{get:function(){return Q},set:function(k){const M=r(k);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");Q=M,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",n({},u,{get:function(){return B},set:function(k){if(k<0||k>100)throw new Error("Position must be between 0 and 100.");B=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",n({},u,{get:function(){return L},set:function(k){const M=r(k);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");L=M,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",n({},u,{get:function(){return _},set:function(k){if(k<0||k>100)throw new Error("Size must be between 0 and 100.");_=k,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",n({},u,{get:function(){return $},set:function(k){const M=r(k);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");$=M,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class TE{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function yu(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 DE{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 Bu(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 va=new Ca(0,0,""),Dn=va.align==="middle"?"middle":"center";function LE(s,e,t){const i=s;function r(){const a=yu(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 DE;Bu(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"&&va.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"&&va.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 Qu(s){return s.replace(/<br(?: \/)?>/gi,`
176
+ `)}class _E{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new TE,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=Qu(n);o<n.length&&n[o]!=="\r"&&n[o]!==`
177
177
  `;)++o;const a=n.slice(0,o);return n[o]==="\r"&&++o,n[o]===`
178
- `&&++o,t.buffer=n.slice(o),a}function r(n){Bh(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 Ca(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{LE(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){Bu(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 Ca(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{LE(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+=`
179
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+=`
180
180
 
181
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 kE=/\r\n|\n\r|\n|\r/g,ya=function(e,t,i=0){return e.slice(i,i+t.length)===t},FE=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},Ba=function(e){let t=5381,i=e.length;for(;i;)t=t*33^e.charCodeAt(--i);return(t>>>0).toString()};function Qa(s,e,t){return Ba(s.toString())+Ba(e.toString())+Ba(t)}const NE=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 ME(s,e,t,i,r,n,o){const a=new _E,A=ti(new Uint8Array(s)).trim().replace(kE,`
182
182
  `).split(`
183
- `),l=[],c=e?eE(e.baseTime,e.timescale):0;let h="00:00.000",u=0,d=0,g,f=!0;a.oncue=function(p){const v=t[i];let y=t.ccOffset;const b=(u-c)/9e4;if(v!=null&&v.new&&(d!==void 0?y=t.ccOffset=v.start:NE(t,i,b)),b){if(!e){g=new Error("Missing initPTS for VTT MPEGTS");return}y=b-t.presentationOffset}const C=p.endTime-p.startTime,Q=Mt((p.startTime+y-d)*9e4,r*9e4)/9e4;p.startTime=Math.max(Q,0),p.endTime=Math.max(Q+C,0);const B=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(B)),p.id||(p.id=Qa(p.startTime,p.endTime,B)),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(ya(p,"X-TIMESTAMP-MAP=")){f=!1,p.slice(16).split(",").forEach(v=>{ya(v,"LOCAL:")?h=v.slice(6):ya(v,"MPEGTS:")&&(u=parseInt(v.slice(7)))});try{d=FE(h)/1e3}catch(v){g=v}return}else p===""&&(f=!1);a.parse(p+`
184
- `)}),a.flush()}const ba="stpp.ttml.im1t",bh=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Sh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,OE={left:"start",center:"center",right:"end",start:"start",end:"end"};function wh(s,e,t,i){const r=ye(new Uint8Array(s),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(a=>ti(a)),o=Zp(e.baseTime,1,e.timescale);try{n.forEach(a=>t(PE(a,o)))}catch(a){i(a)}}function PE(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=Rh(Sa(r,"styling","style")),l=Rh(Sa(r,"layout","region")),c=Sa(r,"body","[begin]");return[].map.call(c,h=>{const u=xh(h,a);if(!u||!h.hasAttribute("begin"))return null;const d=Ra(h.getAttribute("begin"),o),g=Ra(h.getAttribute("dur"),o);let f=Ra(h.getAttribute("end"),o);if(d===null)throw Th(h);if(f===null){if(g===null)throw Th(h);f=d+g}const p=new Ca(d-e,f-e,u);p.id=Qa(p.startTime,p.endTime,p.text);const v=l[h.getAttribute("region")],y=A[h.getAttribute("style")],b=UE(v,y,A),{textAlign:C}=b;if(C){const Q=OE[C];Q&&(p.lineAlign=Q),p.align=C}return et(p,b),p}).filter(h=>h!==null)}function Sa(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Rh(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function xh(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?xh(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function UE(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=wa(e,i,A)||wa(s,i,A)||wa(r,i,A);return l&&(a[A]=l),a},{})}function wa(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function Th(s){return new Error(`Could not parse ttml timestamp ${s}`)}function Ra(s,e){if(!s)return null;let t=yh(s);return t===null&&(bh.test(s)?t=GE(s,e):Sh.test(s)&&(t=HE(s,e))),t}function GE(s,e){const t=bh.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 HE(s,e){const t=Sh.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 $E{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=_h(),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 vh(1,e,t),this.cea608Parser2=new vh(3,i,r)}}addCues(e,t,i,r,n){let o=!1;for(let a=n.length;a--;){const A=n[a],l=YE(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(Lh(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,fs(i[e]),yc(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=>{fs(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=_h(),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++)fs(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===ba);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(dh(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const o=this.media,a=o?un(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]&&Lh(a[u],A)){h=a[u],a[u]=null;break}h&&(c=h)}if(c)fs(c);else{const h=Dh(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&&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===ge.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===ge.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===ba?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;wh(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?Nt(i.initSegment.data,new Uint8Array(r)):r;ME(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 h=c.message==="Missing initPTS for VTT MPEGTS";h?o.push(e):this._fallbackToIMSC1(i,r),N.log(`Failed to parse VTT cue: ${c}`),!(h&&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||wh(t,this.initPTS[e.cc],()=>{i.textCodec=ba,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=>Bc(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===ge.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===ge.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=>Xo(a[A],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(A=>Xo(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 Dh(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function Lh(s,e){return!!s&&s.kind===Dh(e)&&Ia(e,s)}function YE(s,e,t,i){return Math.min(e,i)-Math.max(s,t)}function _h(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class xa{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&&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&&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,xa.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 KE{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 Qs{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=Qs.CDMCleanupPromise?[Qs.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===Ye.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 Ot?a(h):a(new Ot({type:me.KEY_SYSTEM_ERROR,details:H.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 Jl===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=zf(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: ${ii.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 ii.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${ii.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=Go(this.config),n=e.map(Yl).filter(o=>!!o&&r.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:o})=>{const a=Vl(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 Ot?this.hls.trigger(E.ERROR,e.data):this.hls.trigger(E.ERROR,{type:me.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=Yl(e.keyFormat),n=r?[r]:Go(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Go(this.config)),e.length===0)throw new Ot({type:me.KEY_SYSTEM_ERROR,details:H.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[Ye.FAIRPLAY]){const c=at(new Uint8Array(i));try{const h=Po(JSON.parse(c).sinf),u=ic(new Uint8Array(h));if(!u)return;r=u.subarray(8,24),n=Ye.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=B0(i);if(c===null)return;c.version===0&&c.systemId===Kl.WIDEVINE&&c.data&&(r=c.data.subarray(8,24)),n=Xf(c.systemId)}if(!n||!r)return;const o=ii.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=ii.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 or("ISO-23001-7",o,(u=Vl(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 Ea,h=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===Ye.FAIRPLAY&&(this.updateKeySession(e,Uo("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${p}"`)},u=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",h),e.mediaKeysSession.addEventListener("keystatuseschange",u);const d=new Promise((g,f)=>{c.on("error",f),c.on("keyStatus",p=>{p.startsWith("usable")?g():p==="output-restricted"?f(new Ot({type:me.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?f(new Ot({type:me.KEY_SYSTEM_ERROR,details:H.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 Ot({type:me.KEY_SYSTEM_ERROR,details:H.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: ${ii.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${ii.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 Ot({type:me.KEY_SYSTEM_ERROR,details:H.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 Ot({type:me.KEY_SYSTEM_ERROR,details:H.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 Ot({type:me.KEY_SYSTEM_ERROR,details:H.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 Ot({type:me.KEY_SYSTEM_ERROR,details:H.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 Uo(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 Ot({type:me.KEY_SYSTEM_ERROR,details:H.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==Ye.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={},or.clearKeyUriToKeyIdMap();const i=t.length;Qs.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}`)})}}}Qs.CDMCleanupPromise=void 0;class Ot 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 Ta;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(Ta||(Ta={}));var es;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(es||(es={}));const VE={[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 bs{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(i=>i instanceof bs?i:new bs(i))),this.value=e,this.params=t}}class kh{constructor(e){this.description=void 0,this.description=e}}const JE="Dict";function WE(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 qE(s,e,t,i){return new Error(`failed to ${s} "${WE(e)}" as ${t}`,{cause:i})}const Fh="Bare Item",jE="Boolean",XE="Byte Sequence",zE="Decimal",ZE="Integer";function eI(s){return s<-999999999999999||999999999999999<s}const tI=/[\x00-\x1f\x7f]+/,iI="Token",sI="Key";function ai(s,e,t){return qE("serialize",s,e,t)}function rI(s){if(typeof s!="boolean")throw ai(s,jE);return s?"?1":"?0"}function nI(s){return btoa(String.fromCharCode(...s))}function oI(s){if(ArrayBuffer.isView(s)===!1)throw ai(s,XE);return`:${nI(s)}:`}function Nh(s){if(eI(s))throw ai(s,ZE);return s.toString()}function aI(s){return`@${Nh(s.getTime()/1e3)}`}function Mh(s,e){if(s<0)return-Mh(-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 AI(s){const e=Mh(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ai(s,zE);const t=e.toString();return t.includes(".")?t:`${t}.0`}const lI="String";function cI(s){if(tI.test(s))throw ai(s,lI);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function hI(s){return s.description||s.toString().slice(7,-1)}function Oh(s){const e=hI(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ai(e,iI);return e}function Da(s){switch(typeof s){case"number":if(!Ae(s))throw ai(s,Fh);return Number.isInteger(s)?Nh(s):AI(s);case"string":return cI(s);case"symbol":return Oh(s);case"boolean":return rI(s);case"object":if(s instanceof Date)return aI(s);if(s instanceof Uint8Array)return oI(s);if(s instanceof kh)return Oh(s);default:throw ai(s,Fh)}}function La(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw ai(s,sI);return s}function _a(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${La(e)}`:`;${La(e)}=${Da(t)}`).join("")}function Ph(s){return s instanceof bs?`${Da(s.value)}${_a(s.params)}`:Da(s)}function uI(s){return`(${s.value.map(Ph).join(" ")})${_a(s.params)}`}function dI(s,e={whitespace:!0}){if(typeof s!="object")throw ai(s,JE);const t=s instanceof Map?s.entries():Object.entries(s),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof bs||(n=new bs(n));let o=La(r);return n.value===!0?o+=_a(n.params):(o+="=",Array.isArray(n.value)?o+=uI(n):o+=Ph(n)),o}).join(`,${i}`)}function gI(s,e){return dI(s,e)}const fI=s=>s==="ot"||s==="sf"||s==="st",pI=s=>typeof s=="number"?Ae(s):s!=null&&s!==""&&s!==!1;function EI(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 II(){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),mI=(s,e)=>(e!=null&&e.baseUrl&&(s=EI(s,e.baseUrl)),encodeURIComponent(s)),kn=s=>_n(s/100)*100,CI={br:_n,d:_n,bl:kn,dl:kn,mtp:kn,nor:mI,rtp:kn,tb:_n};function vI(s,e){const t={};if(s==null||typeof s!="object")return t;const i=Object.keys(s).sort(),r=et({},CI,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||pI(a)&&(fI(o)&&typeof a=="string"&&(a=new kh(a)),t[o]=a))}),t}function Uh(s,e={}){return s?gI(vI(s,e),et({whitespace:!1},e)):""}function yI(s,e={}){if(!s)return{};const t=Object.entries(s),i=Object.entries(VE).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])||es.REQUEST;return(A=n[h])!=null||(n[h]={}),n[h][l]=c,n},{});return Object.entries(r).reduce((n,[o,a])=>(n[o]=Uh(a,e),n),{})}function BI(s,e,t){return et(s,yI(e,t))}const QI="CMCD";function bI(s,e={}){if(!s)return"";const t=Uh(s,e);return`${QI}=${encodeURIComponent(t)}`}const Gh=/CMCD=[^&#]+/;function SI(s,e,t){const i=bI(e,t);if(!i)return s;if(Gh.test(s))return s.replace(Gh,i);const r=s.includes("?")?"&":"?";return`${s}${r}${i}`}class wI{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||II(),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:Ta.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){et(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={}),BI(e.headers,t)):e.url=SI(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:He.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 RI=3e5;class xI{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===Jt.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]>RI&&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,Lc(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===De.AUDIO_TRACK&&r[n].hasAudioGroup(e)||t===De.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 We(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=$h(c.uri,h["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",A),f=new ps({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 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),Hh(this.audioTracks,i,A,o),Hh(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":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||u.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,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 p=f.getResponseHeader("Retry-After");p&&(g=parseFloat(p)*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 Hh(s,e,t,i){s&&Object.keys(e).forEach(r=>{const n=s.filter(o=>o.groupId===r).map(o=>{const a=et({},o);return a.details=void 0,a.attrs=new We(a.attrs),a.url=a.attrs.URI=$h(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 $h(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 TI=/^age:\s*[\d.]+\s*$/im;class Yh{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&&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};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=sa(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&&TI.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 DI(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const LI=/(\d+)-(\d+)\/(\d+)/;class Kh{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||NI,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=_I(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 MI(g||"fetch, bad network response",d,h)}return r.loading.first=u,r.total=FI(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 Yc,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 _I(s,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(et({},s.headers))};return s.rangeEnd&&t.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),t}function kI(s){const e=LI.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function FI(s){const e=s.get("Content-Range");if(e){const i=kI(e);if(Ae(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function NI(s,e){return new self.Request(s.url,e)}class MI extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const OI=/\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++)OI.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=Qh(l.trim()),g=Qa(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=>Bc(s,u))),r}},UI={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Vh=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:Yh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:dp,bufferController:EE,capLevelController:xa,errorController:tp,fpsController:KE,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:Jl,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:UI},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},GI()),{},{subtitleStreamController:dE,subtitleTrackController:fE,timelineController:$E,audioStreamController:hE,audioTrackController:uE,emeController:Qs,cmcdController:wI,contentSteeringController:xI});function GI(){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 HI(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=ka(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&&N.warn(`hls.js config: "${A.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),At(At({},t),e)}function ka(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(ka):Object.keys(s).reduce((e,t)=>(e[t]=ka(s[t]),e),{}):s}function $I(s){const e=s.loader;e!==Kh&&e!==Yh?(N.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):DI()&&(s.loader=Kh,s.progressive=!0,s.enableSoftwareAES=!0,N.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Fa;class YI extends na{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 h,u;const d=c.attrs;let{audioCodec:g,videoCodec:f}=c;((h=g)==null?void 0:h.indexOf("mp4a.40.34"))!==-1&&(Fa||(Fa=/chrome|firefox/i.test(navigator.userAgent)),Fa&&(c.audioCodec=g=void 0)),g&&(c.audioCodec=g=hn(g,i)),((u=f)==null?void 0:u.indexOf("avc1"))===0&&(f=c.videoCodec=T0(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&&!Wo(g,"audio",i)||f&&!Wo(f,"video",i))return;const{CODECS:b,"FRAME-RATE":C,"HDCP-LEVEL":Q,"PATHWAY-ID":B,RESOLUTION:L,"VIDEO-RANGE":_}=d,k=`${`${B||"."}-`}${c.bitrate}-${L}-${C}-${b}-${_}-${Q}`;if(n[k])if(n[k].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const O=o[k]+=1;c.attrs["PATHWAY-ID"]=new Array(O+1).join(".");const X=new ps(c);n[k]=X,r.push(X)}else n[k].addGroupId("audio",d.AUDIO),n[k].addGroupId("text",d.SUBTITLES);else{const O=new ps(c);n[k]=O,o[k]=1,r.push(O)}}),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))&&$0(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:me.MEDIA_ERROR,details:H.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||Wo(f.audioCodec,"audio",g)),Jh(o)}t.subtitles&&(a=t.subtitles,Jh(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=cc(g.videoCodec),v=cc(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 h;this._firstLevel=g;const f=c.bitrate,p=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 v=Math.min(f,this.hls.config.abrEwmaDefaultEstimateMax);v>p&&p===Vh.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=v)}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(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"),h=e<0;if(this.hls.trigger(E.ERROR,{type:me.OTHER_ERROR,details:H.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(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===De.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===ge.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));Lc(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 Jh(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}class KI{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=H.KEY_LOAD_ERROR,i,r,n){return new Bi({type:me.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,H.KEY_LOAD_ERROR,l))}const o=n.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,H.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,H.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:p,keyInfo:v,url:y}=g;if(!p.decryptdata||v!==this.keyUriToKeyInfo[y])return a(this.createKeyLoadError(p,H.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),f));v.decryptdata.key=p.decryptdata.key=new Uint8Array(u.data),p.keyLoader=null,v.loader=null,o({frag:p,keyInfo:v})},onError:(u,d,g,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,H.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,H.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),g))},onAbort:(u,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,H.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 Wh(){return self.SourceBuffer||self.WebKitSourceBuffer}function qh(){if(!zi())return!1;const e=Wh();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function VI(){if(!qh())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 JI(){var s;const e=Wh();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const WI=250,Fn=2,qI=.1,jI=.05;class XI{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||!He.getBuffered(r).length){this.nudgeRetry=0;return}const c=He.bufferInfo(r,o,0),h=c.nextStart||0;if(a){const p=c.len>Fn,v=!h||t&&t.start<=o||h-o>Fn&&!this.fragmentTracker.getPartialFragment(o);if(p||v)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var u;if(!(c.len>0)&&!h)return;const v=Math.max(h,c.start||0)-o,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,C=(y==null||(u=y.details)==null?void 0:u.live)?y.details.targetduration*2:Fn,Q=this.fragmentTracker.getPartialFragment(o);if(v>0&&(v<=C||Q)){r.paused||this._trySkipBufferHole(Q);return}}const d=self.performance.now();if(n===null){this.stalled=d;return}const g=d-n;if(!a&&g>=WI&&(this._reportStall(c),!this.media))return;const f=He.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:me.MEDIA_ERROR,details:H.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=He.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,ge.MAIN);g&&a<g.end&&(d=!0)}if(!d){const g=e||u.getAppendedFrag(n,ge.MAIN);if(g){let f=!1,p=g.end;for(;p<a;){const v=u.getPartialFragment(p);if(v)p+=v.duration;else{f=!0;break}}if(f)return 0}}}const h=Math.max(a+jI,n+qI);if(N.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(E.ERROR,{type:me.MEDIA_ERROR,details:H.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}`);N.warn(a.message),i.currentTime=o,t.trigger(E.ERROR,{type:me.MEDIA_ERROR,details:H.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:me.MEDIA_ERROR,details:H.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const zI=100;class ZI extends Aa{constructor(e,t,i){super(e,t,i,"[stream-controller]",ge.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(zI),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(E.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 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,u)){if(!d.gap){const p=this.audioOnly&&!this.altAudio?Ne.AUDIO:Ne.VIDEO,v=(p===Ne.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,p,ge.MAIN)}d=this.getNextFragmentLoopLoading(d,l,a,ge.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,ge.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 XI(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(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&&!JI(),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(E.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 uh(this.hls,ge.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=r?r.index:-1,f=g!==-1,p=new oa(i.level,i.sn,i.stats.chunkCount,n.byteLength,g,f),v=this.initPTS[i.cc];d.push(n,h,u,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!==ge.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 H.FRAG_GAP:case H.FRAG_PARSING_ERROR:case H.FRAG_DECRYPT_ERROR:case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ge.MAIN,t);break;case H.LEVEL_LOAD_ERROR:case H.LEVEL_LOAD_TIMEOUT:case H.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===z.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===De.LEVEL&&(this.state=z.IDLE);break;case H.BUFFER_APPEND_ERROR:case H.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===H.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case H.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!He.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!==Ne.AUDIO||this.audioOnly&&!this.altAudio){const i=(t===Ne.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,t,ge.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=He.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(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:h,text:u,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=z.PARSING,g){if(g!=null&&g.tracks){const b=A.initSegment||A;this._bufferInitSegment(c,g.tracks,b,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:b,id:i,tracks:g.tracks})}const v=g.initPTS,y=g.timescale;Ae(v)&&(this.initPTS[A.cc]={baseTime:v,timescale:y},r.trigger(E.INIT_PTS_FOUND,{frag:A,id:i,initPTS:v,timescale:y}))}if(h&&f&&A.sn!=="initSegment"){const v=f.fragments[A.sn-1-f.startSN],y=A.sn===f.startSN,b=!v||A.cc>v.cc;if(n.independent!==!1){const{startPTS:C,endPTS:Q,startDTS:B,endDTS:L}=h;if(l)l.elementaryStreams[h.type]={startPTS:C,endPTS:Q,startDTS:B,endDTS:L};else if(h.firstKeyFrame&&h.independent&&o.id===1&&!b&&(this.couldBacktrack=!0),h.dropped&&h.independent){const _=this.getMainFwdBufferInfo(),K=(_?_.end:this.getLoadPosition())+this.config.maxBufferHole,k=h.firstKeyFramePTS?h.firstKeyFramePTS:C;if(!y&&K<k-this.config.maxBufferHole&&!b){this.backtrack(A);return}else b&&(A.gap=!0);A.setElementaryStreamInfo(h.type,A.start,Q,A.start,L,!0)}else y&&C>Fn&&(A.gap=!0);A.setElementaryStreamInfo(h.type,C,Q,B,L),this.backtrackFragment&&(this.backtrackFragment=A),this.bufferFragmentData(h,A,l,o,y||b)}else if(y||b)A.gap=!0;else{this.backtrack(A);return}}if(p){const{startPTS:v,endPTS:y,startDTS:b,endDTS:C}=p;l&&(l.elementaryStreams[Ne.AUDIO]={startPTS:v,endPTS:y,startDTS:b,endDTS:C}),A.setElementaryStreamInfo(Ne.AUDIO,v,y,b,C),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&&u){const v={id:i,frag:A,details:f,samples:u.samples};r.trigger(E.FRAG_PARSING_USERDATA,v)}}_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();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,ge.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(He.isBuffered(e,i)?t=this.getAppendedFrag(i):He.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&&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 Si{static get version(){return"1.5.11"}static isMSESupported(){return qh()}static isSupported(){return VI()}static getMediaSource(){return zi()}static get Events(){return E}static get ErrorTypes(){return me}static get ErrorDetails(){return H}static get DefaultConfig(){return Si.defaultConfig?Si.defaultConfig:Vh}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 Ea,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,Gf(e.debug||!1,"Hls instance");const t=this.config=HI(Si.DefaultConfig,e);this.userConfig=e,t.progressive&&$I(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 F0(this),g=new U0(this),f=t.contentSteeringController,p=f?new f(this):null,v=this.levelController=new YI(this,p),y=new fp(this),b=new KI(this.config),C=this.streamController=new ZI(this,y,b);h.setStreamController(C),u.setStreamController(C);const Q=[d,v,C];p&&Q.splice(1,0,p),this.networkControllers=Q;const B=[l,c,h,u,g,y];this.audioTrackController=this.createController(t.audioTrackController,Q);const L=t.audioStreamController;L&&Q.push(new L(this,y,b)),this.subtitleTrackController=this.createController(t.subtitleTrackController,Q);const _=t.subtitleStreamController;_&&Q.push(new _(this,y,b)),this.createController(t.timelineController,B),b.emeController=this.emeController=this.createController(t.emeController,B),this.cmcdController=this.createController(t.cmcdController,B),this.latencyController=this.createController(G0,B),this.coreComponents=B,Q.push(A);const K=A.onErrorOut;typeof K=="function"&&this.on(E.ERROR,K,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:me.OTHER_ERROR,details:H.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=No.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){H0(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 em(s){return s&&s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function tm(s){return s}function im(s,e){e=e||{};const t=e.delimiter||".",i=e.maxDepth,r=e.transformKey||tm,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=em(h),f=d==="[object Object]"||d==="[object Array]",p=A?A+t+r(c):r(c);if(!u&&!g&&f&&Object.keys(h).length&&(!e.maxDepth||l<i))return o(h,p,l+1);n[p]=h})}return o(s),n}var jh=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function sm(s,e){return!!(s===e||jh(s)&&jh(e))}function rm(s,e){if(s.length!==e.length)return!1;for(var t=0;t<s.length;t++)if(!sm(s[t],e[t]))return!1;return!0}function nm(s,e){e===void 0&&(e=rm);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
+ `),l=[],c=e?eE(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 b=(h-c)/9e4;if(v!=null&&v.new&&(d!==void 0?y=t.ccOffset=v.start:NE(t,i,b)),b){if(!e){g=new Error("Missing initPTS for VTT MPEGTS");return}y=b-t.presentationOffset}const C=p.endTime-p.startTime,Q=Mt((p.startTime+y-d)*9e4,r*9e4)/9e4;p.startTime=Math.max(Q,0),p.endTime=Math.max(Q+C,0);const B=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(B)),p.id||(p.id=Qa(p.startTime,p.endTime,B)),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(ya(p,"X-TIMESTAMP-MAP=")){f=!1,p.slice(16).split(",").forEach(v=>{ya(v,"LOCAL:")?u=v.slice(6):ya(v,"MPEGTS:")&&(h=parseInt(v.slice(7)))});try{d=FE(u)/1e3}catch(v){g=v}return}else p===""&&(f=!1);a.parse(p+`
184
+ `)}),a.flush()}const ba="stpp.ttml.im1t",bu=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Su=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,OE={left:"start",center:"center",right:"end",start:"start",end:"end"};function wu(s,e,t,i){const r=ye(new Uint8Array(s),["mdat"]);if(r.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const n=r.map(a=>ti(a)),o=Zp(e.baseTime,1,e.timescale);try{n.forEach(a=>t(PE(a,o)))}catch(a){i(a)}}function PE(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=Ru(Sa(r,"styling","style")),l=Ru(Sa(r,"layout","region")),c=Sa(r,"body","[begin]");return[].map.call(c,u=>{const h=xu(u,a);if(!h||!u.hasAttribute("begin"))return null;const d=Ra(u.getAttribute("begin"),o),g=Ra(u.getAttribute("dur"),o);let f=Ra(u.getAttribute("end"),o);if(d===null)throw Tu(u);if(f===null){if(g===null)throw Tu(u);f=d+g}const p=new Ca(d-e,f-e,h);p.id=Qa(p.startTime,p.endTime,p.text);const v=l[u.getAttribute("region")],y=A[u.getAttribute("style")],b=UE(v,y,A),{textAlign:C}=b;if(C){const Q=OE[C];Q&&(p.lineAlign=Q),p.align=C}return tt(p,b),p}).filter(u=>u!==null)}function Sa(s,e,t){const i=s.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Ru(s){return s.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function xu(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?xu(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function UE(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=wa(e,i,A)||wa(s,i,A)||wa(r,i,A);return l&&(a[A]=l),a},{})}function wa(s,e,t){return s&&s.hasAttributeNS(e,t)?s.getAttributeNS(e,t):null}function Tu(s){return new Error(`Could not parse ttml timestamp ${s}`)}function Ra(s,e){if(!s)return null;let t=yu(s);return t===null&&(bu.test(s)?t=GE(s,e):Su.test(s)&&(t=HE(s,e))),t}function GE(s,e){const t=bu.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 HE(s,e){const t=Su.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 $E{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=_u(),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 vu(1,e,t),this.cea608Parser2=new vu(3,i,r)}}addCues(e,t,i,r,n){let o=!1;for(let a=n.length;a--;){const A=n[a],l=YE(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(Lu(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,fs(i[e]),yc(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=>{fs(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=_u(),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++)fs(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],r=i.some(n=>n.textCodec===ba);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(du(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]&&Lu(a[h],A)){u=a[h],a[h]=null;break}u&&(c=u)}if(c)fs(c);else{const u=Du(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===he.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===he.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===ba?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;wu(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?Nt(i.initSegment.data,new Uint8Array(r)):r;ME(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||wu(t,this.initPTS[e.cc],()=>{i.textCodec=ba,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=>Bc(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===he.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===he.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=>Xo(a[A],t,i))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(A=>Xo(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 Du(s){return s.characteristics&&/transcribes-spoken-dialog/gi.test(s.characteristics)&&/describes-music-and-sound/gi.test(s.characteristics)?"captions":"subtitles"}function Lu(s,e){return!!s&&s.kind===Du(e)&&Ia(e,s)}function YE(s,e,t,i){return Math.min(e,i)-Math.max(s,t)}function _u(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class xa{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&&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&&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,xa.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 KE{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 Qs{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=Qs.CDMCleanupPromise?[Qs.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===Ye.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 Ot?a(u):a(new Ot({type:Ie.KEY_SYSTEM_ERROR,details:H.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 Jl===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=zf(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: ${ii.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 ii.hexDump(e.keyId)}updateKeySession(e,t){var i;const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyID ${ii.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=Go(this.config),n=e.map(Yl).filter(o=>!!o&&r.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:o})=>{const a=Vl(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 Ot?this.hls.trigger(E.ERROR,e.data):this.hls.trigger(E.ERROR,{type:Ie.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const r=Yl(e.keyFormat),n=r?[r]:Go(this.config);return this.attemptKeySystemAccess(n)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Go(this.config)),e.length===0)throw new Ot({type:Ie.KEY_SYSTEM_ERROR,details:H.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[Ye.FAIRPLAY]){const c=At(new Uint8Array(i));try{const u=Po(JSON.parse(c).sinf),h=ic(new Uint8Array(u));if(!h)return;r=h.subarray(8,24),n=Ye.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=B0(i);if(c===null)return;c.version===0&&c.systemId===Kl.WIDEVINE&&c.data&&(r=c.data.subarray(8,24)),n=Xf(c.systemId)}if(!n||!r)return;const o=ii.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=ii.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 or("ISO-23001-7",o,(h=Vl(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 Ea,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===Ye.FAIRPLAY&&(this.updateKeySession(e,Uo("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 Ot({type:Ie.KEY_SYSTEM_ERROR,details:H.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?f(new Ot({type:Ie.KEY_SYSTEM_ERROR,details:H.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 Ot({type:Ie.KEY_SYSTEM_ERROR,details:H.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: ${ii.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${ii.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 Ot({type:Ie.KEY_SYSTEM_ERROR,details:H.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 Ot({type:Ie.KEY_SYSTEM_ERROR,details:H.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 Ot({type:Ie.KEY_SYSTEM_ERROR,details:H.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 Ot({type:Ie.KEY_SYSTEM_ERROR,details:H.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 Uo(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 Ot({type:Ie.KEY_SYSTEM_ERROR,details:H.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==Ye.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={},or.clearKeyUriToKeyIdMap();const i=t.length;Qs.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}`)})}}}Qs.CDMCleanupPromise=void 0;class Ot 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 Ta;(function(s){s.DASH="d",s.HLS="h",s.SMOOTH="s",s.OTHER="o"})(Ta||(Ta={}));var es;(function(s){s.OBJECT="CMCD-Object",s.REQUEST="CMCD-Request",s.SESSION="CMCD-Session",s.STATUS="CMCD-Status"})(es||(es={}));const VE={[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 bs{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(i=>i instanceof bs?i:new bs(i))),this.value=e,this.params=t}}class ku{constructor(e){this.description=void 0,this.description=e}}const JE="Dict";function WE(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 qE(s,e,t,i){return new Error(`failed to ${s} "${WE(e)}" as ${t}`,{cause:i})}const Fu="Bare Item",jE="Boolean",XE="Byte Sequence",zE="Decimal",ZE="Integer";function eI(s){return s<-999999999999999||999999999999999<s}const tI=/[\x00-\x1f\x7f]+/,iI="Token",sI="Key";function ai(s,e,t){return qE("serialize",s,e,t)}function rI(s){if(typeof s!="boolean")throw ai(s,jE);return s?"?1":"?0"}function nI(s){return btoa(String.fromCharCode(...s))}function oI(s){if(ArrayBuffer.isView(s)===!1)throw ai(s,XE);return`:${nI(s)}:`}function Nu(s){if(eI(s))throw ai(s,ZE);return s.toString()}function aI(s){return`@${Nu(s.getTime()/1e3)}`}function Mu(s,e){if(s<0)return-Mu(-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 AI(s){const e=Mu(s,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ai(s,zE);const t=e.toString();return t.includes(".")?t:`${t}.0`}const lI="String";function cI(s){if(tI.test(s))throw ai(s,lI);return`"${s.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function uI(s){return s.description||s.toString().slice(7,-1)}function Ou(s){const e=uI(s);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ai(e,iI);return e}function Da(s){switch(typeof s){case"number":if(!Ae(s))throw ai(s,Fu);return Number.isInteger(s)?Nu(s):AI(s);case"string":return cI(s);case"symbol":return Ou(s);case"boolean":return rI(s);case"object":if(s instanceof Date)return aI(s);if(s instanceof Uint8Array)return oI(s);if(s instanceof ku)return Ou(s);default:throw ai(s,Fu)}}function La(s){if(/^[a-z*][a-z0-9\-_.*]*$/.test(s)===!1)throw ai(s,sI);return s}function _a(s){return s==null?"":Object.entries(s).map(([e,t])=>t===!0?`;${La(e)}`:`;${La(e)}=${Da(t)}`).join("")}function Pu(s){return s instanceof bs?`${Da(s.value)}${_a(s.params)}`:Da(s)}function hI(s){return`(${s.value.map(Pu).join(" ")})${_a(s.params)}`}function dI(s,e={whitespace:!0}){if(typeof s!="object")throw ai(s,JE);const t=s instanceof Map?s.entries():Object.entries(s),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,n])=>{n instanceof bs||(n=new bs(n));let o=La(r);return n.value===!0?o+=_a(n.params):(o+="=",Array.isArray(n.value)?o+=hI(n):o+=Pu(n)),o}).join(`,${i}`)}function gI(s,e){return dI(s,e)}const fI=s=>s==="ot"||s==="sf"||s==="st",pI=s=>typeof s=="number"?Ae(s):s!=null&&s!==""&&s!==!1;function EI(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 II(){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),mI=(s,e)=>(e!=null&&e.baseUrl&&(s=EI(s,e.baseUrl)),encodeURIComponent(s)),kn=s=>_n(s/100)*100,CI={br:_n,d:_n,bl:kn,dl:kn,mtp:kn,nor:mI,rtp:kn,tb:_n};function vI(s,e){const t={};if(s==null||typeof s!="object")return t;const i=Object.keys(s).sort(),r=tt({},CI,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||pI(a)&&(fI(o)&&typeof a=="string"&&(a=new ku(a)),t[o]=a))}),t}function Uu(s,e={}){return s?gI(vI(s,e),tt({whitespace:!1},e)):""}function yI(s,e={}){if(!s)return{};const t=Object.entries(s),i=Object.entries(VE).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]=Uu(a,e),n),{})}function BI(s,e,t){return tt(s,yI(e,t))}const QI="CMCD";function bI(s,e={}){if(!s)return"";const t=Uu(s,e);return`${QI}=${encodeURIComponent(t)}`}const Gu=/CMCD=[^&#]+/;function SI(s,e,t){const i=bI(e,t);if(!i)return s;if(Gu.test(s))return s.replace(Gu,i);const r=s.includes("?")?"&":"?";return`${s}${r}${i}`}class wI{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||II(),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:Ta.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={}),BI(e.headers,t)):e.url=SI(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:He.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 RI=3e5;class xI{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===Jt.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]>RI&&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,Lc(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=$u(c.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",A),f=new ps({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),Hu(this.audioTracks,i,A,o),Hu(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 Hu(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=$u(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 $u(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 TI=/^age:\s*[\d.]+\s*$/im;class Yu{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&&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 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=sa(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&&TI.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 DI(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const LI=/(\d+)-(\d+)\/(\d+)/;class Ku{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||NI,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=_I(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(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 MI(g||"fetch, bad network response",d,u)}return r.loading.first=h,r.total=FI(u.headers)||r.total,o&&Ae(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&&!Ae(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 Yc,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 _I(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 kI(s){const e=LI.exec(s);if(e)return parseInt(e[2])-parseInt(e[1])+1}function FI(s){const e=s.get("Content-Range");if(e){const i=kI(e);if(Ae(i))return i}const t=s.get("Content-Length");if(t)return parseInt(t)}function NI(s,e){return new self.Request(s.url,e)}class MI extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const OI=/\s/,PI={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++)OI.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=Qu(l.trim()),g=Qa(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=>Bc(s,h))),r}},UI={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Vu=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:Yu,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:dp,bufferController:EE,capLevelController:xa,errorController:tp,fpsController:KE,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:Jl,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:UI},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},GI()),{},{subtitleStreamController:dE,subtitleTrackController:fE,timelineController:$E,audioStreamController:uE,audioTrackController:hE,emeController:Qs,cmcdController:wI,contentSteeringController:xI});function GI(){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 HI(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=ka(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 ka(s){return s&&typeof s=="object"?Array.isArray(s)?s.map(ka):Object.keys(s).reduce((e,t)=>(e[t]=ka(s[t]),e),{}):s}function $I(s){const e=s.loader;e!==Ku&&e!==Yu?(N.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1):DI()&&(s.loader=Ku,s.progressive=!0,s.enableSoftwareAES=!0,N.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Fa;class YI extends na{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&&(Fa||(Fa=/chrome|firefox/i.test(navigator.userAgent)),Fa&&(c.audioCodec=g=void 0)),g&&(c.audioCodec=g=un(g,i)),((h=f)==null?void 0:h.indexOf("avc1"))===0&&(f=c.videoCodec=T0(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&&!Wo(g,"audio",i)||f&&!Wo(f,"video",i))return;const{CODECS:b,"FRAME-RATE":C,"HDCP-LEVEL":Q,"PATHWAY-ID":B,RESOLUTION:L,"VIDEO-RANGE":_}=d,k=`${`${B||"."}-`}${c.bitrate}-${L}-${C}-${b}-${_}-${Q}`;if(n[k])if(n[k].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const M=o[k]+=1;c.attrs["PATHWAY-ID"]=new Array(M+1).join(".");const X=new ps(c);n[k]=X,r.push(X)}else n[k].addGroupId("audio",d.AUDIO),n[k].addGroupId("text",d.SUBTITLES);else{const M=new ps(c);n[k]=M,o[k]=1,r.push(M)}}),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))&&$0(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:Ie.MEDIA_ERROR,details:H.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||Wo(f.audioCodec,"audio",g)),Ju(o)}t.subtitles&&(a=t.subtitles,Ju(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=cc(g.videoCodec),v=cc(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===Vu.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:Ie.OTHER_ERROR,details:H.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===he.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));Lc(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 Ju(s){const e={};s.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}class KI{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=H.KEY_LOAD_ERROR,i,r,n){return new Bi({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,H.KEY_LOAD_ERROR,l))}const o=n.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,H.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,H.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,H.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,H.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,H.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),g))},onAbort:(h,d,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,H.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 Wu(){return self.SourceBuffer||self.WebKitSourceBuffer}function qu(){if(!zi())return!1;const e=Wu();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function VI(){if(!qu())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 JI(){var s;const e=Wu();return typeof(e==null||(s=e.prototype)==null?void 0:s.changeType)=="function"}const WI=250,Fn=2,qI=.1,jI=.05;class XI{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||!He.getBuffered(r).length){this.nudgeRetry=0;return}const c=He.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,C=(y==null||(h=y.details)==null?void 0:h.live)?y.details.targetduration*2:Fn,Q=this.fragmentTracker.getPartialFragment(o);if(v>0&&(v<=C||Q)){r.paused||this._trySkipBufferHole(Q);return}}const d=self.performance.now();if(n===null){this.stalled=d;return}const g=d-n;if(!a&&g>=WI&&(this._reportStall(c),!this.media))return;const f=He.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:Ie.MEDIA_ERROR,details:H.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=He.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,he.MAIN);g&&a<g.end&&(d=!0)}if(!d){const g=e||h.getAppendedFrag(n,he.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+jI,n+qI);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:Ie.MEDIA_ERROR,details:H.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:Ie.MEDIA_ERROR,details:H.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:Ie.MEDIA_ERROR,details:H.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const zI=100;class ZI extends Aa{constructor(e,t,i){super(e,t,i,"[stream-controller]",he.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(zI),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=j.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=j.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case j.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=j.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=j.IDLE;break}break}case j.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=j.IDLE}}break}this.state===j.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=j.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===j.WAITING_LEVEL||l.live&&this.levelLastLoaded!==o){this.level=n,this.state=j.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?Ne.AUDIO:Ne.VIDEO,v=(p===Ne.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,p,he.MAIN)}d=this.getNextFragmentLoopLoading(d,l,a,he.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,he.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 j.KEY_LOADING:case j.FRAG_LOADING:case j.FRAG_LOADING_WAITING_RETRY:case j.PARSING:case j.PARSED:this.state=j.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 XI(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(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&&!JI(),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!==j.IDLE)return;const r=i[t.level];(!r.details||r.details.live&&this.levelLastLoaded!==r||this.waitForCdnTuneIn(r.details))&&(this.state=j.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===j.FRAG_LOADING||this.state===j.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===j.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=j.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 hu(this.hls,he.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),g=r?r.index:-1,f=g!==-1,p=new oa(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!==he.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===j.PARSED&&(this.state=j.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=j.ERROR;return}switch(t.details){case H.FRAG_GAP:case H.FRAG_PARSING_ERROR:case H.FRAG_DECRYPT_ERROR:case H.FRAG_LOAD_ERROR:case H.FRAG_LOAD_TIMEOUT:case H.KEY_LOAD_ERROR:case H.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(he.MAIN,t);break;case H.LEVEL_LOAD_ERROR:case H.LEVEL_LOAD_TIMEOUT:case H.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===j.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===Le.LEVEL&&(this.state=j.IDLE);break;case H.BUFFER_APPEND_ERROR:case H.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===H.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case H.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!He.getBuffered(e).length){const i=this.state!==j.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,i)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=j.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Ne.AUDIO||this.audioOnly&&!this.altAudio){const i=(t===Ne.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,t,he.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=He.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=j.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=j.PARSING,g){if(g!=null&&g.tracks){const b=A.initSegment||A;this._bufferInitSegment(c,g.tracks,b,o),r.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:b,id:i,tracks:g.tracks})}const v=g.initPTS,y=g.timescale;Ae(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,b=!v||A.cc>v.cc;if(n.independent!==!1){const{startPTS:C,endPTS:Q,startDTS:B,endDTS:L}=u;if(l)l.elementaryStreams[u.type]={startPTS:C,endPTS:Q,startDTS:B,endDTS:L};else if(u.firstKeyFrame&&u.independent&&o.id===1&&!b&&(this.couldBacktrack=!0),u.dropped&&u.independent){const _=this.getMainFwdBufferInfo(),$=(_?_.end:this.getLoadPosition())+this.config.maxBufferHole,k=u.firstKeyFramePTS?u.firstKeyFramePTS:C;if(!y&&$<k-this.config.maxBufferHole&&!b){this.backtrack(A);return}else b&&(A.gap=!0);A.setElementaryStreamInfo(u.type,A.start,Q,A.start,L,!0)}else y&&C>Fn&&(A.gap=!0);A.setElementaryStreamInfo(u.type,C,Q,B,L),this.backtrackFragment&&(this.backtrackFragment=A),this.bufferFragmentData(u,A,l,o,y||b)}else if(y||b)A.gap=!0;else{this.backtrack(A);return}}if(p){const{startPTS:v,endPTS:y,startDTS:b,endDTS:C}=p;l&&(l.elementaryStreams[Ne.AUDIO]={startPTS:v,endPTS:y,startDTS:b,endDTS:C}),A.setElementaryStreamInfo(Ne.AUDIO,v,y,b,C),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!==j.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,he.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=j.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(He.isBuffered(e,i)?t=this.getAppendedFrag(i):He.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&&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 Si{static get version(){return"1.5.11"}static isMSESupported(){return qu()}static isSupported(){return VI()}static getMediaSource(){return zi()}static get Events(){return E}static get ErrorTypes(){return Ie}static get ErrorDetails(){return H}static get DefaultConfig(){return Si.defaultConfig?Si.defaultConfig:Vu}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 Ea,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,Gf(e.debug||!1,"Hls instance");const t=this.config=HI(Si.DefaultConfig,e);this.userConfig=e,t.progressive&&$I(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 F0(this),g=new U0(this),f=t.contentSteeringController,p=f?new f(this):null,v=this.levelController=new YI(this,p),y=new fp(this),b=new KI(this.config),C=this.streamController=new ZI(this,y,b);u.setStreamController(C),h.setStreamController(C);const Q=[d,v,C];p&&Q.splice(1,0,p),this.networkControllers=Q;const B=[l,c,u,h,g,y];this.audioTrackController=this.createController(t.audioTrackController,Q);const L=t.audioStreamController;L&&Q.push(new L(this,y,b)),this.subtitleTrackController=this.createController(t.subtitleTrackController,Q);const _=t.subtitleStreamController;_&&Q.push(new _(this,y,b)),this.createController(t.timelineController,B),b.emeController=this.emeController=this.createController(t.emeController,B),this.cmcdController=this.createController(t.cmcdController,B),this.latencyController=this.createController(G0,B),this.coreComponents=B,Q.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:Ie.OTHER_ERROR,details:H.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=No.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){H0(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 em(s){return s&&s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function tm(s){return s}function im(s,e){e=e||{};const t=e.delimiter||".",i=e.maxDepth,r=e.transformKey||tm,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=em(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 ju=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function sm(s,e){return!!(s===e||ju(s)&&ju(e))}function rm(s,e){if(s.length!==e.length)return!1;for(var t=0;t<s.length;t++)if(!sm(s[t],e[t]))return!1;return!0}function nm(s,e){e===void 0&&(e=rm);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}/**
187
187
  * @license
188
188
  * Copyright 2017 Google LLC
189
189
  * SPDX-License-Identifier: BSD-3-Clause
190
- */const Xh=(s,e,t)=>{const i=new Map;for(let r=e;r<=t;r++)i.set(s[r],r);return i},zh=hs(class extends Js{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=xd(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]=Vi(r[h],n[d]),h++,d++;else if(a[u]===o[g])A[g]=Vi(r[u],n[g]),u--,g--;else if(a[h]===o[g])A[g]=Vi(r[h],n[g]),Vs(s,A[g+1],r[h]),h++,g--;else if(a[u]===o[d])A[d]=Vi(r[u],n[d]),Vs(s,r[h],r[u]),u--,d++;else if(l===void 0&&(l=Xh(o,d,g),c=Xh(a,h,u)),l.has(a[h]))if(l.has(a[u])){const f=c.get(o[d]),p=f!==void 0?r[f]:null;if(p===null){const v=Vs(s,r[h]);Vi(v,n[d]),A[d]=v}else A[d]=Vi(p,n[d]),Vs(s,r[h],p),r[f]=null;d++}else ao(r[u]),u--;else ao(r[h]),h++;for(;d<=g;){const f=Vs(s,A[g+1]);Vi(f,n[d]),A[d++]=f}for(;h<=u;){const f=r[h++];f!==null&&ao(f)}return this.ut=o,Rd(s,A),Yt}});var Tt="top",Pt="bottom",Ut="right",Dt="left",Na="auto",lr=[Tt,Pt,Ut,Dt],Ss="start",cr="end",om="clippingParents",Zh="viewport",hr="popper",am="reference",eu=lr.reduce(function(s,e){return s.concat([e+"-"+Ss,e+"-"+cr])},[]),tu=[].concat(lr,[Na]).reduce(function(s,e){return s.concat([e,e+"-"+Ss,e+"-"+cr])},[]),Am="beforeRead",lm="read",cm="afterRead",hm="beforeMain",um="main",dm="afterMain",gm="beforeWrite",fm="write",pm="afterWrite",Em=[Am,lm,cm,hm,um,dm,gm,fm,pm];function Ai(s){return s?(s.nodeName||"").toLowerCase():null}function _t(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=_t(s).Element;return s instanceof e||s instanceof Element}function Gt(s){var e=_t(s).HTMLElement;return s instanceof e||s instanceof HTMLElement}function Ma(s){if(typeof ShadowRoot>"u")return!1;var e=_t(s).ShadowRoot;return s instanceof e||s instanceof ShadowRoot}function Im(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];!Gt(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 mm(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},{});!Gt(r)||!Ai(r)||(Object.assign(r.style,a),Object.keys(n).forEach(function(A){r.removeAttribute(A)}))})}}const iu={name:"applyStyles",enabled:!0,phase:"write",fn:Im,effect:mm,requires:["computeStyles"]};function li(s){return s.split("-")[0]}var is=Math.max,Nn=Math.min,ws=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 su(){return!/^((?!chrome|android).)*safari/i.test(Oa())}function Rs(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=s.getBoundingClientRect(),r=1,n=1;e&&Gt(s)&&(r=s.offsetWidth>0&&ws(i.width)/s.offsetWidth||1,n=s.offsetHeight>0&&ws(i.height)/s.offsetHeight||1);var o=ts(s)?_t(s):window,a=o.visualViewport,A=!su()&&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 Pa(s){var e=Rs(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 ru(s,e){var t=e.getRootNode&&e.getRootNode();if(s.contains(e))return!0;if(t&&Ma(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 _t(s).getComputedStyle(s)}function Cm(s){return["table","td","th"].indexOf(Ai(s))>=0}function Oi(s){return((ts(s)?s.ownerDocument:s.document)||window.document).documentElement}function Mn(s){return Ai(s)==="html"?s:s.assignedSlot||s.parentNode||(Ma(s)?s.host:null)||Oi(s)}function nu(s){return!Gt(s)||wi(s).position==="fixed"?null:s.offsetParent}function vm(s){var e=/firefox/i.test(Oa()),t=/Trident/i.test(Oa());if(t&&Gt(s)){var i=wi(s);if(i.position==="fixed")return null}var r=Mn(s);for(Ma(r)&&(r=r.host);Gt(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 ur(s){for(var e=_t(s),t=nu(s);t&&Cm(t)&&wi(t).position==="static";)t=nu(t);return t&&(Ai(t)==="html"||Ai(t)==="body"&&wi(t).position==="static")?e:t||vm(s)||e}function Ua(s){return["top","bottom"].indexOf(s)>=0?"x":"y"}function dr(s,e,t){return is(s,Nn(e,t))}function ym(s,e,t){var i=dr(s,e,t);return i>t?t:i}function ou(){return{top:0,right:0,bottom:0,left:0}}function au(s){return Object.assign({},ou(),s)}function Au(s,e){return e.reduce(function(t,i){return t[i]=s,t},{})}var Bm=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,au(typeof e!="number"?e:Au(e,lr))};function Qm(s){var e,t=s.state,i=s.name,r=s.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=li(t.placement),A=Ua(a),l=[Dt,Ut].indexOf(a)>=0,c=l?"height":"width";if(!(!n||!o)){var h=Bm(r.padding,t),u=Pa(n),d=A==="y"?Tt:Dt,g=A==="y"?Pt:Ut,f=t.rects.reference[c]+t.rects.reference[A]-o[A]-t.rects.popper[c],p=o[A]-t.rects.reference[A],v=ur(n),y=v?A==="y"?v.clientHeight||0:v.clientWidth||0:0,b=f/2-p/2,C=h[d],Q=y-u[c]-h[g],B=y/2-u[c]/2+b,L=dr(C,B,Q),_=A;t.modifiersData[i]=(e={},e[_]=L,e.centerOffset=L-B,e)}}function bm(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)||ru(e.elements.popper,r)&&(e.elements.arrow=r))}const Sm={name:"arrow",enabled:!0,phase:"main",fn:Qm,effect:bm,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function xs(s){return s.split("-")[1]}var wm={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Rm(s,e){var t=s.x,i=s.y,r=e.devicePixelRatio||1;return{x:ws(t*r)/r||0,y:ws(i*r)/r||0}}function lu(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,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"),b=Dt,C=Tt,Q=window;if(l){var B=ur(t),L="clientHeight",_="clientWidth";if(B===_t(t)&&(B=Oi(t),wi(B).position!=="static"&&a==="absolute"&&(L="scrollHeight",_="scrollWidth")),B=B,r===Tt||(r===Dt||r===Ut)&&n===cr){C=Pt;var K=h&&B===Q&&Q.visualViewport?Q.visualViewport.height:B[L];f-=K-i.height,f*=A?1:-1}if(r===Dt||(r===Tt||r===Pt)&&n===cr){b=Ut;var k=h&&B===Q&&Q.visualViewport?Q.visualViewport.width:B[_];d-=k-i.width,d*=A?1:-1}}var O=Object.assign({position:a},l&&wm),X=c===!0?Rm({x:d,y:f},_t(t)):{x:d,y:f};if(d=X.x,f=X.y,A){var V;return Object.assign({},O,(V={},V[C]=y?"0":"",V[b]=v?"0":"",V.transform=(Q.devicePixelRatio||1)<=1?"translate("+d+"px, "+f+"px)":"translate3d("+d+"px, "+f+"px, 0)",V))}return Object.assign({},O,(e={},e[C]=y?f+"px":"",e[b]=v?d+"px":"",e.transform="",e))}function xm(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:li(e.placement),variation:xs(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,lu(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,lu(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 Tm={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:xm,data:{}};var On={passive:!0};function Dm(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=_t(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&l.forEach(function(c){c.addEventListener("scroll",t.update,On)}),a&&A.addEventListener("resize",t.update,On),function(){n&&l.forEach(function(c){c.removeEventListener("scroll",t.update,On)}),a&&A.removeEventListener("resize",t.update,On)}}const Lm={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Dm,data:{}};var _m={left:"right",right:"left",bottom:"top",top:"bottom"};function Pn(s){return s.replace(/left|right|bottom|top/g,function(e){return _m[e]})}var km={start:"end",end:"start"};function cu(s){return s.replace(/start|end/g,function(e){return km[e]})}function Ga(s){var e=_t(s),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function Ha(s){return Rs(Oi(s)).left+Ga(s).scrollLeft}function Fm(s,e){var t=_t(s),i=Oi(s),r=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,A=0;if(r){n=r.width,o=r.height;var l=su();(l||!l&&e==="fixed")&&(a=r.offsetLeft,A=r.offsetTop)}return{width:n,height:o,x:a+Ha(s),y:A}}function Nm(s){var e,t=Oi(s),i=Ga(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+Ha(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 $a(s){var e=wi(s),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function hu(s){return["html","body","#document"].indexOf(Ai(s))>=0?s.ownerDocument.body:Gt(s)&&$a(s)?s:hu(Mn(s))}function gr(s,e){var t;e===void 0&&(e=[]);var i=hu(s),r=i===((t=s.ownerDocument)==null?void 0:t.body),n=_t(i),o=r?[n].concat(n.visualViewport||[],$a(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(gr(Mn(o)))}function Ya(s){return Object.assign({},s,{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height})}function Mm(s,e){var t=Rs(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 uu(s,e,t){return e===Zh?Ya(Fm(s,t)):ts(e)?Mm(e,t):Ya(Nm(Oi(s)))}function Om(s){var e=gr(Mn(s)),t=["absolute","fixed"].indexOf(wi(s).position)>=0,i=t&&Gt(s)?ur(s):s;return ts(i)?e.filter(function(r){return ts(r)&&ru(r,i)&&Ai(r)!=="body"}):[]}function Pm(s,e,t,i){var r=e==="clippingParents"?Om(s):[].concat(e),n=[].concat(r,[t]),o=n[0],a=n.reduce(function(A,l){var c=uu(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},uu(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 du(s){var e=s.reference,t=s.element,i=s.placement,r=i?li(i):null,n=i?xs(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,A;switch(r){case Tt:A={x:o,y:e.y-t.height};break;case Pt:A={x:o,y:e.y+e.height};break;case Ut:A={x:e.x+e.width,y:a};break;case Dt:A={x:e.x-t.width,y:a};break;default:A={x:e.x,y:e.y}}var l=r?Ua(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 cr:A[l]=A[l]+(e[c]/2-t[c]/2);break}}return A}function fr(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?om:a,l=t.rootBoundary,c=l===void 0?Zh:l,h=t.elementContext,u=h===void 0?hr:h,d=t.altBoundary,g=d===void 0?!1:d,f=t.padding,p=f===void 0?0:f,v=au(typeof p!="number"?p:Au(p,lr)),y=u===hr?am:hr,b=s.rects.popper,C=s.elements[g?y:u],Q=Pm(ts(C)?C:C.contextElement||Oi(s.elements.popper),A,c,o),B=Rs(s.elements.reference),L=du({reference:B,element:b,strategy:"absolute",placement:r}),_=Ya(Object.assign({},b,L)),K=u===hr?_:B,k={top:Q.top-K.top+v.top,bottom:K.bottom-Q.bottom+v.bottom,left:Q.left-K.left+v.left,right:K.right-Q.right+v.right},O=s.modifiersData.offset;if(u===hr&&O){var X=O[r];Object.keys(k).forEach(function(V){var q=[Ut,Pt].indexOf(V)>=0?1:-1,S=[Tt,Pt].indexOf(V)>=0?"y":"x";k[V]+=X[S]*q})}return k}function Um(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?tu:A,c=xs(i),h=c?a?eu:eu.filter(function(g){return xs(g)===c}):lr,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]=fr(s,{placement:f,boundary:r,rootBoundary:n,padding:o})[li(f)],g},{});return Object.keys(d).sort(function(g,f){return d[g]-d[f]})}function Gm(s){if(li(s)===Na)return[];var e=Pn(s);return[cu(s),e,cu(e)]}function Hm(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,p=e.options.placement,v=li(p),y=v===p,b=A||(y||!g?[Pn(p)]:Gm(p)),C=[p].concat(b).reduce(function(ie,he){return ie.concat(li(he)===Na?Um(e,{placement:he,boundary:c,rootBoundary:h,padding:l,flipVariations:g,allowedAutoPlacements:f}):he)},[]),Q=e.rects.reference,B=e.rects.popper,L=new Map,_=!0,K=C[0],k=0;k<C.length;k++){var O=C[k],X=li(O),V=xs(O)===Ss,q=[Tt,Pt].indexOf(X)>=0,S=q?"width":"height",R=fr(e,{placement:O,boundary:c,rootBoundary:h,altBoundary:u,padding:l}),G=q?V?Ut:Dt:V?Pt:Tt;Q[S]>B[S]&&(G=Pn(G));var x=Pn(G),w=[];if(n&&w.push(R[X]<=0),a&&w.push(R[G]<=0,R[x]<=0),w.every(function(ie){return ie})){K=O,_=!1;break}L.set(O,w)}if(_)for(var T=g?3:1,$=function(he){var re=C.find(function(ve){var Qe=L.get(ve);if(Qe)return Qe.slice(0,he).every(function(be){return be})});if(re)return K=re,"break"},U=T;U>0;U--){var j=$(U);if(j==="break")break}e.placement!==K&&(e.modifiersData[i]._skip=!0,e.placement=K,e.reset=!0)}}const $m={name:"flip",enabled:!0,phase:"main",fn:Hm,requiresIfExists:["offset"],data:{_skip:!1}};function gu(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 fu(s){return[Tt,Ut,Pt,Dt].some(function(e){return s[e]>=0})}function Ym(s){var e=s.state,t=s.name,i=e.rects.reference,r=e.rects.popper,n=e.modifiersData.preventOverflow,o=fr(e,{elementContext:"reference"}),a=fr(e,{altBoundary:!0}),A=gu(o,i),l=gu(a,r,n),c=fu(A),h=fu(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 Km={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Ym};function Vm(s,e,t){var i=li(s),r=[Dt,Tt].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,[Dt,Ut].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function Jm(s){var e=s.state,t=s.options,i=s.name,r=t.offset,n=r===void 0?[0,0]:r,o=tu.reduce(function(c,h){return c[h]=Vm(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 Wm={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Jm};function qm(s){var e=s.state,t=s.name;e.modifiersData[t]=du({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const jm={name:"popperOffsets",enabled:!0,phase:"read",fn:qm,data:{}};function Xm(s){return s==="x"?"y":"x"}function zm(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,p=fr(e,{boundary:A,rootBoundary:l,padding:h,altBoundary:c}),v=li(e.placement),y=xs(e.placement),b=!y,C=Ua(v),Q=Xm(C),B=e.modifiersData.popperOffsets,L=e.rects.reference,_=e.rects.popper,K=typeof f=="function"?f(Object.assign({},e.rects,{placement:e.placement})):f,k=typeof K=="number"?{mainAxis:K,altAxis:K}:Object.assign({mainAxis:0,altAxis:0},K),O=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,X={x:0,y:0};if(B){if(n){var V,q=C==="y"?Tt:Dt,S=C==="y"?Pt:Ut,R=C==="y"?"height":"width",G=B[C],x=G+p[q],w=G-p[S],T=d?-_[R]/2:0,$=y===Ss?L[R]:_[R],U=y===Ss?-_[R]:-L[R],j=e.elements.arrow,ie=d&&j?Pa(j):{width:0,height:0},he=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:ou(),re=he[q],ve=he[S],Qe=dr(0,L[R],ie[R]),be=b?L[R]/2-T-Qe-re-k.mainAxis:$-Qe-re-k.mainAxis,ne=b?-L[R]/2+T+Qe+ve+k.mainAxis:U+Qe+ve+k.mainAxis,fe=e.elements.arrow&&ur(e.elements.arrow),Ce=fe?C==="y"?fe.clientTop||0:fe.clientLeft||0:0,ue=(V=O==null?void 0:O[C])!=null?V:0,le=G+be-ue-Ce,ae=G+ne-ue,we=dr(d?Nn(x,le):x,G,d?is(w,ae):w);B[C]=we,X[C]=we-G}if(a){var ke,xe=C==="x"?Tt:Dt,Fe=C==="x"?Pt:Ut,Ue=B[Q],Le=Q==="y"?"height":"width",Se=Ue+p[xe],Ke=Ue-p[Fe],je=[Tt,Dt].indexOf(v)!==-1,dt=(ke=O==null?void 0:O[Q])!=null?ke:0,rt=je?Se:Ue-L[Le]-_[Le]-dt+k.altAxis,yt=je?Ue+L[Le]+_[Le]-dt-k.altAxis:Ke,Ri=d&&je?ym(rt,Ue,yt):dr(d?rt:Se,Ue,d?yt:Ke);B[Q]=Ri,X[Q]=Ri-Ue}e.modifiersData[i]=X}}const Zm={name:"preventOverflow",enabled:!0,phase:"main",fn:zm,requiresIfExists:["offset"]};function eC(s){return{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}}function tC(s){return s===_t(s)||!Gt(s)?Ga(s):eC(s)}function iC(s){var e=s.getBoundingClientRect(),t=ws(e.width)/s.offsetWidth||1,i=ws(e.height)/s.offsetHeight||1;return t!==1||i!==1}function sC(s,e,t){t===void 0&&(t=!1);var i=Gt(e),r=Gt(e)&&iC(e),n=Oi(e),o=Rs(s,r,t),a={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(i||!i&&!t)&&((Ai(e)!=="body"||$a(n))&&(a=tC(e)),Gt(e)?(A=Rs(e,!0),A.x+=e.clientLeft,A.y+=e.clientTop):n&&(A.x=Ha(n))),{x:o.left+a.scrollLeft-A.x,y:o.top+a.scrollTop-A.y,width:o.width,height:o.height}}function rC(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 nC(s){var e=rC(s);return Em.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function oC(s){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(s())})})),e}}function aC(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 pu={placement:"bottom",modifiers:[],strategy:"absolute"};function Eu(){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 AC(s){s===void 0&&(s={});var e=s,t=e.defaultModifiers,i=t===void 0?[]:t,r=e.defaultOptions,n=r===void 0?pu:r;return function(a,A,l){l===void 0&&(l=n);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},pu,n),modifiersData:{},elements:{reference:a,popper:A},attributes:{},styles:{}},h=[],u=!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)?gr(a):a.contextElement?gr(a.contextElement):[],popper:gr(A)};var b=nC(aC([].concat(i,c.options.modifiers)));return c.orderedModifiers=b.filter(function(C){return C.enabled}),g(),d.update()},forceUpdate:function(){if(!u){var v=c.elements,y=v.reference,b=v.popper;if(Eu(y,b)){c.rects={reference:sC(y,ur(b),c.options.strategy==="fixed"),popper:Pa(b)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(k){return c.modifiersData[k.name]=Object.assign({},k.data)});for(var C=0;C<c.orderedModifiers.length;C++){if(c.reset===!0){c.reset=!1,C=-1;continue}var Q=c.orderedModifiers[C],B=Q.fn,L=Q.options,_=L===void 0?{}:L,K=Q.name;typeof B=="function"&&(c=B({state:c,options:_,name:K,instance:d})||c)}}}},update:oC(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){f(),u=!0}};if(!Eu(a,A))return d;d.setOptions(l).then(function(p){!u&&l.onFirstUpdate&&l.onFirstUpdate(p)});function g(){c.orderedModifiers.forEach(function(p){var v=p.name,y=p.options,b=y===void 0?{}:y,C=p.effect;if(typeof C=="function"){var Q=C({state:c,name:v,instance:d,options:b}),B=function(){};h.push(Q||B)}})}function f(){h.forEach(function(p){return p()}),h=[]}return d}}var lC=[Lm,jm,Tm,iu,Wm,$m,Zm,Sm,Km],cC=AC({defaultModifiers:lC}),hC="tippy-box",Iu="tippy-content",uC="tippy-backdrop",mu="tippy-arrow",Cu="tippy-svg-arrow",ss={passive:!0,capture:!0},vu=function(){return document.body};function Ka(s,e,t){if(Array.isArray(s)){var i=s[e];return i??(Array.isArray(t)?t[e]:t)}return s}function Va(s,e){var t={}.toString.call(s);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function yu(s,e){return typeof s=="function"?s.apply(void 0,e):s}function Bu(s,e){if(e===0)return s;var t;return function(i){clearTimeout(t),t=setTimeout(function(){s(i)},e)}}function dC(s){return s.split(/\s+/).filter(Boolean)}function Ts(s){return[].concat(s)}function Qu(s,e){s.indexOf(e)===-1&&s.push(e)}function gC(s){return s.filter(function(e,t){return s.indexOf(e)===t})}function fC(s){return s.split("-")[0]}function Un(s){return[].slice.call(s)}function bu(s){return Object.keys(s).reduce(function(e,t){return s[t]!==void 0&&(e[t]=s[t]),e},{})}function pr(){return document.createElement("div")}function Gn(s){return["Element","Fragment"].some(function(e){return Va(s,e)})}function pC(s){return Va(s,"NodeList")}function EC(s){return Va(s,"MouseEvent")}function IC(s){return!!(s&&s._tippy&&s._tippy.reference===s)}function mC(s){return Gn(s)?[s]:pC(s)?Un(s):Array.isArray(s)?s:Un(document.querySelectorAll(s))}function Ja(s,e){s.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Su(s,e){s.forEach(function(t){t&&t.setAttribute("data-state",e)})}function CC(s){var e,t=Ts(s),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function vC(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=fC(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,p=i-n.bottom-u>A,v=n.left-t+d>A,y=t-n.right-g>A;return f||p||v||y})}function Wa(s,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){s[i](r,t)})}function wu(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 ci={isTouch:!1},Ru=0;function yC(){ci.isTouch||(ci.isTouch=!0,window.performance&&document.addEventListener("mousemove",xu))}function xu(){var s=performance.now();s-Ru<20&&(ci.isTouch=!1,document.removeEventListener("mousemove",xu)),Ru=s}function BC(){var s=document.activeElement;if(IC(s)){var e=s._tippy;s.blur&&!e.state.isVisible&&s.blur()}}function QC(){document.addEventListener("touchstart",yC,ss),window.addEventListener("blur",BC)}var bC=typeof window<"u"&&typeof document<"u",SC=bC?!!window.msCrypto:!1,wC={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},RC={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},qt=Object.assign({appendTo:vu,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},wC,RC),xC=Object.keys(qt),TC=function(e){var t=Object.keys(e);t.forEach(function(i){qt[i]=e[i]})};function Tu(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=qt[n])!=null?a:o}return i},{});return Object.assign({},s,t)}function DC(s,e){var t=e?Object.keys(Tu(Object.assign({},qt,{plugins:e}))):xC,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 Du(s,e){var t=Object.assign({},e,{content:yu(e.content,[s])},e.ignoreAttributes?{}:DC(s,e.plugins));return t.aria=Object.assign({},qt.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 LC=function(){return"innerHTML"};function qa(s,e){s[LC()]=e}function Lu(s){var e=pr();return s===!0?e.className=mu:(e.className=Cu,Gn(s)?e.appendChild(s):qa(e,s)),e}function _u(s,e){Gn(e.content)?(qa(s,""),s.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?qa(s,e.content):s.textContent=e.content)}function ja(s){var e=s.firstElementChild,t=Un(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(Iu)}),arrow:t.find(function(i){return i.classList.contains(mu)||i.classList.contains(Cu)}),backdrop:t.find(function(i){return i.classList.contains(uC)})}}function ku(s){var e=pr(),t=pr();t.className=hC,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=pr();i.className=Iu,i.setAttribute("data-state","hidden"),_u(i,s.props),e.appendChild(t),t.appendChild(i),r(s.props,s.props);function r(n,o){var a=ja(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)&&_u(l,s.props),o.arrow?c?n.arrow!==o.arrow&&(A.removeChild(c),A.appendChild(Lu(o.arrow))):A.appendChild(Lu(o.arrow)):c&&A.removeChild(c)}return{popper:e,onUpdate:r}}ku.$$tippy=!0;var _C=1,Hn=[],Xa=[];function kC(s,e){var t=Du(s,Object.assign({},qt,Tu(bu(e)))),i,r,n,o=!1,a=!1,A=!1,l=!1,c,h,u,d=[],g=Bu(le,t.interactiveDebounce),f,p=_C++,v=null,y=gC(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},C={id:p,reference:s,popper:pr(),popperInstance:v,props:t,state:b,plugins:y,clearDelayTimeouts:rt,setProps:yt,setContent:Ri,show:Bt,hide:gi,hideWithInteractivity:fi,enable:je,disable:dt,unmount:pi,destroy:mt};if(!t.render)return C;var Q=t.render(C),B=Q.popper,L=Q.onUpdate;B.setAttribute("data-tippy-root",""),B.id="tippy-"+C.id,C.popper=B,s._tippy=C,B._tippy=C;var _=y.map(function(Y){return Y.fn(C)}),K=s.hasAttribute("aria-expanded");return fe(),T(),G(),x("onCreate",[C]),t.showOnCreate&&Se(),B.addEventListener("mouseenter",function(){C.props.interactive&&C.state.isVisible&&C.clearDelayTimeouts()}),B.addEventListener("mouseleave",function(){C.props.interactive&&C.props.trigger.indexOf("mouseenter")>=0&&q().addEventListener("mousemove",g)}),C;function k(){var Y=C.props.touch;return Array.isArray(Y)?Y:[Y,0]}function O(){return k()[0]==="hold"}function X(){var Y;return!!((Y=C.props.render)!=null&&Y.$$tippy)}function V(){return f||s}function q(){var Y=V().parentNode;return Y?CC(Y):document}function S(){return ja(B)}function R(Y){return C.state.isMounted&&!C.state.isVisible||ci.isTouch||c&&c.type==="focus"?0:Ka(C.props.delay,Y?0:1,qt.delay)}function G(Y){Y===void 0&&(Y=!1),B.style.pointerEvents=C.props.interactive&&!Y?"":"none",B.style.zIndex=""+C.props.zIndex}function x(Y,ce,pe){if(pe===void 0&&(pe=!0),_.forEach(function(Re){Re[Y]&&Re[Y].apply(Re,ce)}),pe){var Te;(Te=C.props)[Y].apply(Te,ce)}}function w(){var Y=C.props.aria;if(Y.content){var ce="aria-"+Y.content,pe=B.id,Te=Ts(C.props.triggerTarget||s);Te.forEach(function(Re){var Ve=Re.getAttribute(ce);if(C.state.isVisible)Re.setAttribute(ce,Ve?Ve+" "+pe:pe);else{var Qt=Ve&&Ve.replace(pe,"").trim();Qt?Re.setAttribute(ce,Qt):Re.removeAttribute(ce)}})}}function T(){if(!(K||!C.props.aria.expanded)){var Y=Ts(C.props.triggerTarget||s);Y.forEach(function(ce){C.props.interactive?ce.setAttribute("aria-expanded",C.state.isVisible&&ce===V()?"true":"false"):ce.removeAttribute("aria-expanded")})}}function $(){q().removeEventListener("mousemove",g),Hn=Hn.filter(function(Y){return Y!==g})}function U(Y){if(!(ci.isTouch&&(A||Y.type==="mousedown"))){var ce=Y.composedPath&&Y.composedPath()[0]||Y.target;if(!(C.props.interactive&&wu(B,ce))){if(Ts(C.props.triggerTarget||s).some(function(pe){return wu(pe,ce)})){if(ci.isTouch||C.state.isVisible&&C.props.trigger.indexOf("click")>=0)return}else x("onClickOutside",[C,Y]);C.props.hideOnClick===!0&&(C.clearDelayTimeouts(),C.hide(),a=!0,setTimeout(function(){a=!1}),C.state.isMounted||re())}}}function j(){A=!0}function ie(){A=!1}function he(){var Y=q();Y.addEventListener("mousedown",U,!0),Y.addEventListener("touchend",U,ss),Y.addEventListener("touchstart",ie,ss),Y.addEventListener("touchmove",j,ss)}function re(){var Y=q();Y.removeEventListener("mousedown",U,!0),Y.removeEventListener("touchend",U,ss),Y.removeEventListener("touchstart",ie,ss),Y.removeEventListener("touchmove",j,ss)}function ve(Y,ce){be(Y,function(){!C.state.isVisible&&B.parentNode&&B.parentNode.contains(B)&&ce()})}function Qe(Y,ce){be(Y,ce)}function be(Y,ce){var pe=S().box;function Te(Re){Re.target===pe&&(Wa(pe,"remove",Te),ce())}if(Y===0)return ce();Wa(pe,"remove",h),Wa(pe,"add",Te),h=Te}function ne(Y,ce,pe){pe===void 0&&(pe=!1);var Te=Ts(C.props.triggerTarget||s);Te.forEach(function(Re){Re.addEventListener(Y,ce,pe),d.push({node:Re,eventType:Y,handler:ce,options:pe})})}function fe(){O()&&(ne("touchstart",ue,{passive:!0}),ne("touchend",ae,{passive:!0})),dC(C.props.trigger).forEach(function(Y){if(Y!=="manual")switch(ne(Y,ue),Y){case"mouseenter":ne("mouseleave",ae);break;case"focus":ne(SC?"focusout":"blur",we);break;case"focusin":ne("focusout",we);break}})}function Ce(){d.forEach(function(Y){var ce=Y.node,pe=Y.eventType,Te=Y.handler,Re=Y.options;ce.removeEventListener(pe,Te,Re)}),d=[]}function ue(Y){var ce,pe=!1;if(!(!C.state.isEnabled||ke(Y)||a)){var Te=((ce=c)==null?void 0:ce.type)==="focus";c=Y,f=Y.currentTarget,T(),!C.state.isVisible&&EC(Y)&&Hn.forEach(function(Re){return Re(Y)}),Y.type==="click"&&(C.props.trigger.indexOf("mouseenter")<0||o)&&C.props.hideOnClick!==!1&&C.state.isVisible?pe=!0:Se(Y),Y.type==="click"&&(o=!pe),pe&&!Te&&Ke(Y)}}function le(Y){var ce=Y.target,pe=V().contains(ce)||B.contains(ce);if(!(Y.type==="mousemove"&&pe)){var Te=Le().concat(B).map(function(Re){var Ve,Qt=Re._tippy,bt=(Ve=Qt.popperInstance)==null?void 0:Ve.state;return bt?{popperRect:Re.getBoundingClientRect(),popperState:bt,props:t}:null}).filter(Boolean);vC(Te,Y)&&($(),Ke(Y))}}function ae(Y){var ce=ke(Y)||C.props.trigger.indexOf("click")>=0&&o;if(!ce){if(C.props.interactive){C.hideWithInteractivity(Y);return}Ke(Y)}}function we(Y){C.props.trigger.indexOf("focusin")<0&&Y.target!==V()||C.props.interactive&&Y.relatedTarget&&B.contains(Y.relatedTarget)||Ke(Y)}function ke(Y){return ci.isTouch?O()!==Y.type.indexOf("touch")>=0:!1}function xe(){Fe();var Y=C.props,ce=Y.popperOptions,pe=Y.placement,Te=Y.offset,Re=Y.getReferenceClientRect,Ve=Y.moveTransition,Qt=X()?ja(B).arrow:null,bt=Re?{getBoundingClientRect:Re,contextElement:Re.contextElement||V()}:s,Fs={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ns){var Gi=Ns.state;if(X()){var Br=S(),Qr=Br.box;["placement","reference-hidden","escaped"].forEach(function(Ms){Ms==="placement"?Qr.setAttribute("data-placement",Gi.placement):Gi.attributes.popper["data-popper-"+Ms]?Qr.setAttribute("data-"+Ms,""):Qr.removeAttribute("data-"+Ms)}),Gi.attributes.popper={}}}},St=[{name:"offset",options:{offset:Te}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Ve}},Fs];X()&&Qt&&St.push({name:"arrow",options:{element:Qt,padding:3}}),St.push.apply(St,(ce==null?void 0:ce.modifiers)||[]),C.popperInstance=cC(bt,B,Object.assign({},ce,{placement:pe,onFirstUpdate:u,modifiers:St}))}function Fe(){C.popperInstance&&(C.popperInstance.destroy(),C.popperInstance=null)}function Ue(){var Y=C.props.appendTo,ce,pe=V();C.props.interactive&&Y===vu||Y==="parent"?ce=pe.parentNode:ce=yu(Y,[pe]),ce.contains(B)||ce.appendChild(B),C.state.isMounted=!0,xe()}function Le(){return Un(B.querySelectorAll("[data-tippy-root]"))}function Se(Y){C.clearDelayTimeouts(),Y&&x("onTrigger",[C,Y]),he();var ce=R(!0),pe=k(),Te=pe[0],Re=pe[1];ci.isTouch&&Te==="hold"&&Re&&(ce=Re),ce?i=setTimeout(function(){C.show()},ce):C.show()}function Ke(Y){if(C.clearDelayTimeouts(),x("onUntrigger",[C,Y]),!C.state.isVisible){re();return}if(!(C.props.trigger.indexOf("mouseenter")>=0&&C.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(Y.type)>=0&&o)){var ce=R(!1);ce?r=setTimeout(function(){C.state.isVisible&&C.hide()},ce):n=requestAnimationFrame(function(){C.hide()})}}function je(){C.state.isEnabled=!0}function dt(){C.hide(),C.state.isEnabled=!1}function rt(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(n)}function yt(Y){if(!C.state.isDestroyed){x("onBeforeUpdate",[C,Y]),Ce();var ce=C.props,pe=Du(s,Object.assign({},ce,bu(Y),{ignoreAttributes:!0}));C.props=pe,fe(),ce.interactiveDebounce!==pe.interactiveDebounce&&($(),g=Bu(le,pe.interactiveDebounce)),ce.triggerTarget&&!pe.triggerTarget?Ts(ce.triggerTarget).forEach(function(Te){Te.removeAttribute("aria-expanded")}):pe.triggerTarget&&s.removeAttribute("aria-expanded"),T(),G(),L&&L(ce,pe),C.popperInstance&&(xe(),Le().forEach(function(Te){requestAnimationFrame(Te._tippy.popperInstance.forceUpdate)})),x("onAfterUpdate",[C,Y])}}function Ri(Y){C.setProps({content:Y})}function Bt(){var Y=C.state.isVisible,ce=C.state.isDestroyed,pe=!C.state.isEnabled,Te=ci.isTouch&&!C.props.touch,Re=Ka(C.props.duration,0,qt.duration);if(!(Y||ce||pe||Te)&&!V().hasAttribute("disabled")&&(x("onShow",[C],!1),C.props.onShow(C)!==!1)){if(C.state.isVisible=!0,X()&&(B.style.visibility="visible"),G(),he(),C.state.isMounted||(B.style.transition="none"),X()){var Ve=S(),Qt=Ve.box,bt=Ve.content;Ja([Qt,bt],0)}u=function(){var St;if(!(!C.state.isVisible||l)){if(l=!0,B.offsetHeight,B.style.transition=C.props.moveTransition,X()&&C.props.animation){var as=S(),Ns=as.box,Gi=as.content;Ja([Ns,Gi],Re),Su([Ns,Gi],"visible")}w(),T(),Qu(Xa,C),(St=C.popperInstance)==null||St.forceUpdate(),x("onMount",[C]),C.props.animation&&X()&&Qe(Re,function(){C.state.isShown=!0,x("onShown",[C])})}},Ue()}}function gi(){var Y=!C.state.isVisible,ce=C.state.isDestroyed,pe=!C.state.isEnabled,Te=Ka(C.props.duration,1,qt.duration);if(!(Y||ce||pe)&&(x("onHide",[C],!1),C.props.onHide(C)!==!1)){if(C.state.isVisible=!1,C.state.isShown=!1,l=!1,o=!1,X()&&(B.style.visibility="hidden"),$(),re(),G(!0),X()){var Re=S(),Ve=Re.box,Qt=Re.content;C.props.animation&&(Ja([Ve,Qt],Te),Su([Ve,Qt],"hidden"))}w(),T(),C.props.animation?X()&&ve(Te,C.unmount):C.unmount()}}function fi(Y){q().addEventListener("mousemove",g),Qu(Hn,g),g(Y)}function pi(){C.state.isVisible&&C.hide(),C.state.isMounted&&(Fe(),Le().forEach(function(Y){Y._tippy.unmount()}),B.parentNode&&B.parentNode.removeChild(B),Xa=Xa.filter(function(Y){return Y!==C}),C.state.isMounted=!1,x("onHidden",[C]))}function mt(){C.state.isDestroyed||(C.clearDelayTimeouts(),C.unmount(),Ce(),delete s._tippy,C.state.isDestroyed=!0,x("onDestroy",[C]))}}function rs(s,e){e===void 0&&(e={});var t=qt.plugins.concat(e.plugins||[]);QC();var i=Object.assign({},e,{plugins:t}),r=mC(s),n=r.reduce(function(o,a){var A=a&&kC(a,i);return A&&o.push(A),o},[]);return Gn(s)?n[0]:n}rs.defaultProps=qt,rs.setDefaultProps=TC,rs.currentInput=ci,Object.assign({},iu,{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:ku});class hi 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 FC=5;function NC(s,e){const t=s.map(({id:r})=>r).join("|"),i=e.map(({id:r})=>r).join("|");return t===i}class MC{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=ft(),this._controls=ft(),this.host=e}set activeScenes(e){NC(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:h,duration:u})=>a>=h&&a<h+u))??[];const A=a!==this.currentTime;this._currentTime=a,this._upcomingScenes=((i=this.host.scenes)==null?void 0:i.filter(({start:h})=>a>=h-FC&&a<h))??[],this.loadScenes(),this.syncVideoState(),(r=this._controls.value)==null||r.setAttribute("currentTime",a.toString());const l=this.activeScenes[0],c=_l((n=l==null?void 0:l.videoMeta)==null?void 0:n.captions);this.caption=((o=c.find(({start:h,end:u})=>{var d;const g=a-l.start+(((d=l.videoMeta)==null?void 0:d.start)??0);return h&&u&&g>=zr(h)&&g<=zr(u)}))==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 pt(this._canvas)}controls(){return pt(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:h,node:u}=a,{start:d,duration:g}=A,f=this.host.videoState[c];u&&f&&(u.currentTime>=d+g||u.ended||l&&(h?(t=h.startLoadOnce)==null||t.call(h,d):f.initialised||(i=u.startLoadOnce)==null||i.call(u)))}else if(l){const c=`${n}-${o}`,h=this.host._sceneController.videoState[c];this.host.duration&&!((r=h==null?void 0:h.buffered)!=null&&r.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[c]:{...h,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 hi("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 OC(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function PC(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function UC(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 GC(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(h,u,d){u.toString().includes("?")||(u+="?"+c),!(!o&&u.toString().includes(".ts"))&&l.apply(this,[h,u,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(h=>Math.min(h.height,h.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&&!OC()&&Si.isSupported()?GC(t,s):UC(e,s)}async function Fu(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 HC=Kt(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 $C=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=Kt(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,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=Kt(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await Fu(i),c=(a??0)*l,h=(1-(A??0))*l;return{id:r,config:t,captions:n,start:c,duration:h-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 hi(`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 h=n.start(c),u=n.end(c);Math.max(h,l.start)<=Math.min(u,l.start+l.duration)&&o.push({start:Math.max(0,(Math.max(h-l.start,0)+a)/i*100),end:Math.min((Math.min(u-l.start,l.duration)+a)/i*100,100)})}return o}_setupTask(){new Lr(this.host,async([e,t,i,r,n,o,a])=>{var A;const l=this._delayProcessing();try{let c=null;if(this.host._errors=[],this.host._languages=this.host.languageResolver({data:e}),(!n||!this.host._languages.find(({value:h})=>n===h))&&(this.host._language=(A=this.host._languages[0])==null?void 0:A.value),i||e){if(i){let f=null;if(r)try{f=await(await fetch(r,{method:"GET"})).text()}catch(y){const b=new hi("Track failed to fetch",y);this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:b,message:b.message}))}const v={questions:{items:[{answer:{id:"source",media:{[i.includes(".m3u8")?"playlist":"video"]:i},captions:{current:f}}}]}};try{this.scenes=await ds({data:v,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(y){try{this.scenes=await ds({data:v,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(b){throw new hi("Fatal source template error",b,!0)}c=new hi("Source template error",y)}}else try{this.scenes=await ds({data:e,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(f){try{this.scenes=await ds({data:e,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(p){throw new hi("Fatal data template error",p,!0)}c=new hi("Data template error",f)}Object.keys(this.videos).forEach(f=>{this.scenes.scenes.find(({video:p})=>f===(p==null?void 0:p.key))||this._videos[f].node.pause()});const[h,u,d]=this.scenes.scenes.reduce((f,{video:p,videoMeta:v,start:y,duration:b})=>{var C;p&&(f[0][p.key]=p,v&&(f[1][p.key]=v));const Q=(p==null?void 0:p.key)??`${y}-${b}`,B=this._getBufferSegments({key:Q,node:p==null?void 0:p.node,duration:this.scenes.duration});return f[2][Q]={initialised:!p,waiting:!!p,...this.videoState[Q],buffered:p?B:(C=this.videoState[Q])==null?void 0:C.buffered},f},[{},{},{}]);this.videos=h,this.videoMeta=u,this.videoState={...this.videoState,...d},(await Promise.all(this.scenes.fonts.map(f=>HC(f)))).forEach(f=>{document.fonts.add(f)}),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)}c&&this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message})),this.host.dispatchEvent(new CustomEvent("scenesupdate",{detail:this.scenes,bubbles:!0,composed:!0}))}catch(c){this.scenes=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message}))}finally{l.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,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 YC(s){s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.msRequestFullscreen&&s.msRequestFullscreen()}function KC(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Za=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],VC={id:"captions",event:"captions:click",label:"Closed Captions"},JC={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Nu={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}]},WC={id:"playbackRate",label:"Playback playbackRate",subItems:Nu};class qC 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)),Yt}}const eA=hs(qC),jC=nm(()=>{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=Tl.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]}),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"},XC={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"}},Mu=im(XC,{delimiter:"-"}),zC=Object.keys(Mu).map(s=>Os(`:host { --${s}: ${Mu[s]}; }`)),Me=(s=>{const e=class extends s{firstUpdated(){jC().forEach(({load:n,font:o})=>{document.fonts.add(o),n&&o.load()})}};return e.styles=[(s==null?void 0:s.styles)??[],zC,ot`
190
+ */const Xu=(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 Js{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=xd(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]),Vs(s,A[g+1],r[u]),u++,g--;else if(a[h]===o[d])A[d]=Vi(r[h],n[d]),Vs(s,r[u],r[h]),h--,d++;else if(l===void 0&&(l=Xu(o,d,g),c=Xu(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=Vs(s,r[u]);Vi(v,n[d]),A[d]=v}else A[d]=Vi(p,n[d]),Vs(s,r[u],p),r[f]=null;d++}else ao(r[h]),h--;else ao(r[u]),u++;for(;d<=g;){const f=Vs(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,Rd(s,A),Yt}});var Tt="top",Pt="bottom",Ut="right",Dt="left",Na="auto",lr=[Tt,Pt,Ut,Dt],Ss="start",cr="end",om="clippingParents",Zu="viewport",ur="popper",am="reference",eh=lr.reduce(function(s,e){return s.concat([e+"-"+Ss,e+"-"+cr])},[]),th=[].concat(lr,[Na]).reduce(function(s,e){return s.concat([e,e+"-"+Ss,e+"-"+cr])},[]),Am="beforeRead",lm="read",cm="afterRead",um="beforeMain",hm="main",dm="afterMain",gm="beforeWrite",fm="write",pm="afterWrite",Em=[Am,lm,cm,um,hm,dm,gm,fm,pm];function Ai(s){return s?(s.nodeName||"").toLowerCase():null}function _t(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=_t(s).Element;return s instanceof e||s instanceof Element}function Gt(s){var e=_t(s).HTMLElement;return s instanceof e||s instanceof HTMLElement}function Ma(s){if(typeof ShadowRoot>"u")return!1;var e=_t(s).ShadowRoot;return s instanceof e||s instanceof ShadowRoot}function Im(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];!Gt(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 mm(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},{});!Gt(r)||!Ai(r)||(Object.assign(r.style,a),Object.keys(n).forEach(function(A){r.removeAttribute(A)}))})}}const ih={name:"applyStyles",enabled:!0,phase:"write",fn:Im,effect:mm,requires:["computeStyles"]};function li(s){return s.split("-")[0]}var is=Math.max,Nn=Math.min,ws=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 sh(){return!/^((?!chrome|android).)*safari/i.test(Oa())}function Rs(s,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var i=s.getBoundingClientRect(),r=1,n=1;e&&Gt(s)&&(r=s.offsetWidth>0&&ws(i.width)/s.offsetWidth||1,n=s.offsetHeight>0&&ws(i.height)/s.offsetHeight||1);var o=ts(s)?_t(s):window,a=o.visualViewport,A=!sh()&&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 Pa(s){var e=Rs(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 rh(s,e){var t=e.getRootNode&&e.getRootNode();if(s.contains(e))return!0;if(t&&Ma(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 _t(s).getComputedStyle(s)}function Cm(s){return["table","td","th"].indexOf(Ai(s))>=0}function Oi(s){return((ts(s)?s.ownerDocument:s.document)||window.document).documentElement}function Mn(s){return Ai(s)==="html"?s:s.assignedSlot||s.parentNode||(Ma(s)?s.host:null)||Oi(s)}function nh(s){return!Gt(s)||wi(s).position==="fixed"?null:s.offsetParent}function vm(s){var e=/firefox/i.test(Oa()),t=/Trident/i.test(Oa());if(t&&Gt(s)){var i=wi(s);if(i.position==="fixed")return null}var r=Mn(s);for(Ma(r)&&(r=r.host);Gt(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 hr(s){for(var e=_t(s),t=nh(s);t&&Cm(t)&&wi(t).position==="static";)t=nh(t);return t&&(Ai(t)==="html"||Ai(t)==="body"&&wi(t).position==="static")?e:t||vm(s)||e}function Ua(s){return["top","bottom"].indexOf(s)>=0?"x":"y"}function dr(s,e,t){return is(s,Nn(e,t))}function ym(s,e,t){var i=dr(s,e,t);return i>t?t:i}function oh(){return{top:0,right:0,bottom:0,left:0}}function ah(s){return Object.assign({},oh(),s)}function Ah(s,e){return e.reduce(function(t,i){return t[i]=s,t},{})}var Bm=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,ah(typeof e!="number"?e:Ah(e,lr))};function Qm(s){var e,t=s.state,i=s.name,r=s.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=li(t.placement),A=Ua(a),l=[Dt,Ut].indexOf(a)>=0,c=l?"height":"width";if(!(!n||!o)){var u=Bm(r.padding,t),h=Pa(n),d=A==="y"?Tt:Dt,g=A==="y"?Pt:Ut,f=t.rects.reference[c]+t.rects.reference[A]-o[A]-t.rects.popper[c],p=o[A]-t.rects.reference[A],v=hr(n),y=v?A==="y"?v.clientHeight||0:v.clientWidth||0:0,b=f/2-p/2,C=u[d],Q=y-h[c]-u[g],B=y/2-h[c]/2+b,L=dr(C,B,Q),_=A;t.modifiersData[i]=(e={},e[_]=L,e.centerOffset=L-B,e)}}function bm(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)||rh(e.elements.popper,r)&&(e.elements.arrow=r))}const Sm={name:"arrow",enabled:!0,phase:"main",fn:Qm,effect:bm,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function xs(s){return s.split("-")[1]}var wm={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Rm(s,e){var t=s.x,i=s.y,r=e.devicePixelRatio||1;return{x:ws(t*r)/r||0,y:ws(i*r)/r||0}}function lh(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"),b=Dt,C=Tt,Q=window;if(l){var B=hr(t),L="clientHeight",_="clientWidth";if(B===_t(t)&&(B=Oi(t),wi(B).position!=="static"&&a==="absolute"&&(L="scrollHeight",_="scrollWidth")),B=B,r===Tt||(r===Dt||r===Ut)&&n===cr){C=Pt;var $=u&&B===Q&&Q.visualViewport?Q.visualViewport.height:B[L];f-=$-i.height,f*=A?1:-1}if(r===Dt||(r===Tt||r===Pt)&&n===cr){b=Ut;var k=u&&B===Q&&Q.visualViewport?Q.visualViewport.width:B[_];d-=k-i.width,d*=A?1:-1}}var M=Object.assign({position:a},l&&wm),X=c===!0?Rm({x:d,y:f},_t(t)):{x:d,y:f};if(d=X.x,f=X.y,A){var V;return Object.assign({},M,(V={},V[C]=y?"0":"",V[b]=v?"0":"",V.transform=(Q.devicePixelRatio||1)<=1?"translate("+d+"px, "+f+"px)":"translate3d("+d+"px, "+f+"px, 0)",V))}return Object.assign({},M,(e={},e[C]=y?f+"px":"",e[b]=v?d+"px":"",e.transform="",e))}function xm(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:li(e.placement),variation:xs(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,lh(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,lh(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 Tm={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:xm,data:{}};var On={passive:!0};function Dm(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=_t(e.elements.popper),l=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&l.forEach(function(c){c.addEventListener("scroll",t.update,On)}),a&&A.addEventListener("resize",t.update,On),function(){n&&l.forEach(function(c){c.removeEventListener("scroll",t.update,On)}),a&&A.removeEventListener("resize",t.update,On)}}const Lm={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Dm,data:{}};var _m={left:"right",right:"left",bottom:"top",top:"bottom"};function Pn(s){return s.replace(/left|right|bottom|top/g,function(e){return _m[e]})}var km={start:"end",end:"start"};function ch(s){return s.replace(/start|end/g,function(e){return km[e]})}function Ga(s){var e=_t(s),t=e.pageXOffset,i=e.pageYOffset;return{scrollLeft:t,scrollTop:i}}function Ha(s){return Rs(Oi(s)).left+Ga(s).scrollLeft}function Fm(s,e){var t=_t(s),i=Oi(s),r=t.visualViewport,n=i.clientWidth,o=i.clientHeight,a=0,A=0;if(r){n=r.width,o=r.height;var l=sh();(l||!l&&e==="fixed")&&(a=r.offsetLeft,A=r.offsetTop)}return{width:n,height:o,x:a+Ha(s),y:A}}function Nm(s){var e,t=Oi(s),i=Ga(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+Ha(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 $a(s){var e=wi(s),t=e.overflow,i=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+i)}function uh(s){return["html","body","#document"].indexOf(Ai(s))>=0?s.ownerDocument.body:Gt(s)&&$a(s)?s:uh(Mn(s))}function gr(s,e){var t;e===void 0&&(e=[]);var i=uh(s),r=i===((t=s.ownerDocument)==null?void 0:t.body),n=_t(i),o=r?[n].concat(n.visualViewport||[],$a(i)?i:[]):i,a=e.concat(o);return r?a:a.concat(gr(Mn(o)))}function Ya(s){return Object.assign({},s,{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height})}function Mm(s,e){var t=Rs(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 hh(s,e,t){return e===Zu?Ya(Fm(s,t)):ts(e)?Mm(e,t):Ya(Nm(Oi(s)))}function Om(s){var e=gr(Mn(s)),t=["absolute","fixed"].indexOf(wi(s).position)>=0,i=t&&Gt(s)?hr(s):s;return ts(i)?e.filter(function(r){return ts(r)&&rh(r,i)&&Ai(r)!=="body"}):[]}function Pm(s,e,t,i){var r=e==="clippingParents"?Om(s):[].concat(e),n=[].concat(r,[t]),o=n[0],a=n.reduce(function(A,l){var c=hh(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},hh(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 dh(s){var e=s.reference,t=s.element,i=s.placement,r=i?li(i):null,n=i?xs(i):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,A;switch(r){case Tt:A={x:o,y:e.y-t.height};break;case Pt:A={x:o,y:e.y+e.height};break;case Ut:A={x:e.x+e.width,y:a};break;case Dt:A={x:e.x-t.width,y:a};break;default:A={x:e.x,y:e.y}}var l=r?Ua(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 cr:A[l]=A[l]+(e[c]/2-t[c]/2);break}}return A}function fr(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?om:a,l=t.rootBoundary,c=l===void 0?Zu:l,u=t.elementContext,h=u===void 0?ur: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:Ah(p,lr)),y=h===ur?am:ur,b=s.rects.popper,C=s.elements[g?y:h],Q=Pm(ts(C)?C:C.contextElement||Oi(s.elements.popper),A,c,o),B=Rs(s.elements.reference),L=dh({reference:B,element:b,strategy:"absolute",placement:r}),_=Ya(Object.assign({},b,L)),$=h===ur?_:B,k={top:Q.top-$.top+v.top,bottom:$.bottom-Q.bottom+v.bottom,left:Q.left-$.left+v.left,right:$.right-Q.right+v.right},M=s.modifiersData.offset;if(h===ur&&M){var X=M[r];Object.keys(k).forEach(function(V){var z=[Ut,Pt].indexOf(V)>=0?1:-1,R=[Tt,Pt].indexOf(V)>=0?"y":"x";k[V]+=X[R]*z})}return k}function Um(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?th:A,c=xs(i),u=c?a?eh:eh.filter(function(g){return xs(g)===c}):lr,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]=fr(s,{placement:f,boundary:r,rootBoundary:n,padding:o})[li(f)],g},{});return Object.keys(d).sort(function(g,f){return d[g]-d[f]})}function Gm(s){if(li(s)===Na)return[];var e=Pn(s);return[ch(s),e,ch(e)]}function Hm(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=li(p),y=v===p,b=A||(y||!g?[Pn(p)]:Gm(p)),C=[p].concat(b).reduce(function(se,ce){return se.concat(li(ce)===Na?Um(e,{placement:ce,boundary:c,rootBoundary:u,padding:l,flipVariations:g,allowedAutoPlacements:f}):ce)},[]),Q=e.rects.reference,B=e.rects.popper,L=new Map,_=!0,$=C[0],k=0;k<C.length;k++){var M=C[k],X=li(M),V=xs(M)===Ss,z=[Tt,Pt].indexOf(X)>=0,R=z?"width":"height",x=fr(e,{placement:M,boundary:c,rootBoundary:u,altBoundary:h,padding:l}),G=z?V?Ut:Dt:V?Pt:Tt;Q[R]>B[R]&&(G=Pn(G));var S=Pn(G),w=[];if(n&&w.push(x[X]<=0),a&&w.push(x[G]<=0,x[S]<=0),w.every(function(se){return se})){$=M,_=!1;break}L.set(M,w)}if(_)for(var T=g?3:1,Y=function(ce){var ne=C.find(function(me){var be=L.get(me);if(be)return be.slice(0,ce).every(function(we){return we})});if(ne)return $=ne,"break"},U=T;U>0;U--){var q=Y(U);if(q==="break")break}e.placement!==$&&(e.modifiersData[i]._skip=!0,e.placement=$,e.reset=!0)}}const $m={name:"flip",enabled:!0,phase:"main",fn:Hm,requiresIfExists:["offset"],data:{_skip:!1}};function gh(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 fh(s){return[Tt,Ut,Pt,Dt].some(function(e){return s[e]>=0})}function Ym(s){var e=s.state,t=s.name,i=e.rects.reference,r=e.rects.popper,n=e.modifiersData.preventOverflow,o=fr(e,{elementContext:"reference"}),a=fr(e,{altBoundary:!0}),A=gh(o,i),l=gh(a,r,n),c=fh(A),u=fh(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 Km={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Ym};function Vm(s,e,t){var i=li(s),r=[Dt,Tt].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,[Dt,Ut].indexOf(i)>=0?{x:a,y:o}:{x:o,y:a}}function Jm(s){var e=s.state,t=s.options,i=s.name,r=t.offset,n=r===void 0?[0,0]:r,o=th.reduce(function(c,u){return c[u]=Vm(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 Wm={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Jm};function qm(s){var e=s.state,t=s.name;e.modifiersData[t]=dh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const jm={name:"popperOffsets",enabled:!0,phase:"read",fn:qm,data:{}};function Xm(s){return s==="x"?"y":"x"}function zm(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=fr(e,{boundary:A,rootBoundary:l,padding:u,altBoundary:c}),v=li(e.placement),y=xs(e.placement),b=!y,C=Ua(v),Q=Xm(C),B=e.modifiersData.popperOffsets,L=e.rects.reference,_=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},$),M=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,X={x:0,y:0};if(B){if(n){var V,z=C==="y"?Tt:Dt,R=C==="y"?Pt:Ut,x=C==="y"?"height":"width",G=B[C],S=G+p[z],w=G-p[R],T=d?-_[x]/2:0,Y=y===Ss?L[x]:_[x],U=y===Ss?-_[x]:-L[x],q=e.elements.arrow,se=d&&q?Pa(q):{width:0,height:0},ce=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:oh(),ne=ce[z],me=ce[R],be=dr(0,L[x],se[x]),we=b?L[x]/2-T-be-ne-k.mainAxis:Y-be-ne-k.mainAxis,oe=b?-L[x]/2+T+be+me+k.mainAxis:U+be+me+k.mainAxis,de=e.elements.arrow&&hr(e.elements.arrow),Be=de?C==="y"?de.clientTop||0:de.clientLeft||0:0,ve=(V=M==null?void 0:M[C])!=null?V:0,ge=G+we-ve-Be,te=G+oe-ve,Se=dr(d?Nn(S,ge):S,G,d?is(w,te):w);B[C]=Se,X[C]=Se-G}if(a){var xe,Oe=C==="x"?Tt:Dt,Te=C==="x"?Pt:Ut,Fe=B[Q],ke=Q==="y"?"height":"width",Ce=Fe+p[Oe],Ke=Fe-p[Te],Xe=[Tt,Dt].indexOf(v)!==-1,nt=(xe=M==null?void 0:M[Q])!=null?xe:0,Ve=Xe?Ce:Fe-L[ke]-_[ke]-nt+k.altAxis,yt=Xe?Fe+L[ke]+_[ke]-nt-k.altAxis:Ke,Ri=d&&Xe?ym(Ve,Fe,yt):dr(d?Ve:Ce,Fe,d?yt:Ke);B[Q]=Ri,X[Q]=Ri-Fe}e.modifiersData[i]=X}}const Zm={name:"preventOverflow",enabled:!0,phase:"main",fn:zm,requiresIfExists:["offset"]};function eC(s){return{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}}function tC(s){return s===_t(s)||!Gt(s)?Ga(s):eC(s)}function iC(s){var e=s.getBoundingClientRect(),t=ws(e.width)/s.offsetWidth||1,i=ws(e.height)/s.offsetHeight||1;return t!==1||i!==1}function sC(s,e,t){t===void 0&&(t=!1);var i=Gt(e),r=Gt(e)&&iC(e),n=Oi(e),o=Rs(s,r,t),a={scrollLeft:0,scrollTop:0},A={x:0,y:0};return(i||!i&&!t)&&((Ai(e)!=="body"||$a(n))&&(a=tC(e)),Gt(e)?(A=Rs(e,!0),A.x+=e.clientLeft,A.y+=e.clientTop):n&&(A.x=Ha(n))),{x:o.left+a.scrollLeft-A.x,y:o.top+a.scrollTop-A.y,width:o.width,height:o.height}}function rC(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 nC(s){var e=rC(s);return Em.reduce(function(t,i){return t.concat(e.filter(function(r){return r.phase===i}))},[])}function oC(s){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(s())})})),e}}function aC(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 ph={placement:"bottom",modifiers:[],strategy:"absolute"};function Eh(){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 AC(s){s===void 0&&(s={});var e=s,t=e.defaultModifiers,i=t===void 0?[]:t,r=e.defaultOptions,n=r===void 0?ph:r;return function(a,A,l){l===void 0&&(l=n);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},ph,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)?gr(a):a.contextElement?gr(a.contextElement):[],popper:gr(A)};var b=nC(aC([].concat(i,c.options.modifiers)));return c.orderedModifiers=b.filter(function(C){return C.enabled}),g(),d.update()},forceUpdate:function(){if(!h){var v=c.elements,y=v.reference,b=v.popper;if(Eh(y,b)){c.rects={reference:sC(y,hr(b),c.options.strategy==="fixed"),popper:Pa(b)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(k){return c.modifiersData[k.name]=Object.assign({},k.data)});for(var C=0;C<c.orderedModifiers.length;C++){if(c.reset===!0){c.reset=!1,C=-1;continue}var Q=c.orderedModifiers[C],B=Q.fn,L=Q.options,_=L===void 0?{}:L,$=Q.name;typeof B=="function"&&(c=B({state:c,options:_,name:$,instance:d})||c)}}}},update:oC(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){f(),h=!0}};if(!Eh(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,b=y===void 0?{}:y,C=p.effect;if(typeof C=="function"){var Q=C({state:c,name:v,instance:d,options:b}),B=function(){};u.push(Q||B)}})}function f(){u.forEach(function(p){return p()}),u=[]}return d}}var lC=[Lm,jm,Tm,ih,Wm,$m,Zm,Sm,Km],cC=AC({defaultModifiers:lC}),uC="tippy-box",Ih="tippy-content",hC="tippy-backdrop",mh="tippy-arrow",Ch="tippy-svg-arrow",ss={passive:!0,capture:!0},vh=function(){return document.body};function Ka(s,e,t){if(Array.isArray(s)){var i=s[e];return i??(Array.isArray(t)?t[e]:t)}return s}function Va(s,e){var t={}.toString.call(s);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function yh(s,e){return typeof s=="function"?s.apply(void 0,e):s}function Bh(s,e){if(e===0)return s;var t;return function(i){clearTimeout(t),t=setTimeout(function(){s(i)},e)}}function dC(s){return s.split(/\s+/).filter(Boolean)}function Ts(s){return[].concat(s)}function Qh(s,e){s.indexOf(e)===-1&&s.push(e)}function gC(s){return s.filter(function(e,t){return s.indexOf(e)===t})}function fC(s){return s.split("-")[0]}function Un(s){return[].slice.call(s)}function bh(s){return Object.keys(s).reduce(function(e,t){return s[t]!==void 0&&(e[t]=s[t]),e},{})}function pr(){return document.createElement("div")}function Gn(s){return["Element","Fragment"].some(function(e){return Va(s,e)})}function pC(s){return Va(s,"NodeList")}function EC(s){return Va(s,"MouseEvent")}function IC(s){return!!(s&&s._tippy&&s._tippy.reference===s)}function mC(s){return Gn(s)?[s]:pC(s)?Un(s):Array.isArray(s)?s:Un(document.querySelectorAll(s))}function Ja(s,e){s.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Sh(s,e){s.forEach(function(t){t&&t.setAttribute("data-state",e)})}function CC(s){var e,t=Ts(s),i=t[0];return i!=null&&(e=i.ownerDocument)!=null&&e.body?i.ownerDocument:document}function vC(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=fC(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 Wa(s,e,t){var i=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){s[i](r,t)})}function wh(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 ci={isTouch:!1},Rh=0;function yC(){ci.isTouch||(ci.isTouch=!0,window.performance&&document.addEventListener("mousemove",xh))}function xh(){var s=performance.now();s-Rh<20&&(ci.isTouch=!1,document.removeEventListener("mousemove",xh)),Rh=s}function BC(){var s=document.activeElement;if(IC(s)){var e=s._tippy;s.blur&&!e.state.isVisible&&s.blur()}}function QC(){document.addEventListener("touchstart",yC,ss),window.addEventListener("blur",BC)}var bC=typeof window<"u"&&typeof document<"u",SC=bC?!!window.msCrypto:!1,wC={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},RC={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},qt=Object.assign({appendTo:vh,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},wC,RC),xC=Object.keys(qt),TC=function(e){var t=Object.keys(e);t.forEach(function(i){qt[i]=e[i]})};function Th(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=qt[n])!=null?a:o}return i},{});return Object.assign({},s,t)}function DC(s,e){var t=e?Object.keys(Th(Object.assign({},qt,{plugins:e}))):xC,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 Dh(s,e){var t=Object.assign({},e,{content:yh(e.content,[s])},e.ignoreAttributes?{}:DC(s,e.plugins));return t.aria=Object.assign({},qt.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 LC=function(){return"innerHTML"};function qa(s,e){s[LC()]=e}function Lh(s){var e=pr();return s===!0?e.className=mh:(e.className=Ch,Gn(s)?e.appendChild(s):qa(e,s)),e}function _h(s,e){Gn(e.content)?(qa(s,""),s.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?qa(s,e.content):s.textContent=e.content)}function ja(s){var e=s.firstElementChild,t=Un(e.children);return{box:e,content:t.find(function(i){return i.classList.contains(Ih)}),arrow:t.find(function(i){return i.classList.contains(mh)||i.classList.contains(Ch)}),backdrop:t.find(function(i){return i.classList.contains(hC)})}}function kh(s){var e=pr(),t=pr();t.className=uC,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var i=pr();i.className=Ih,i.setAttribute("data-state","hidden"),_h(i,s.props),e.appendChild(t),t.appendChild(i),r(s.props,s.props);function r(n,o){var a=ja(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)&&_h(l,s.props),o.arrow?c?n.arrow!==o.arrow&&(A.removeChild(c),A.appendChild(Lh(o.arrow))):A.appendChild(Lh(o.arrow)):c&&A.removeChild(c)}return{popper:e,onUpdate:r}}kh.$$tippy=!0;var _C=1,Hn=[],Xa=[];function kC(s,e){var t=Dh(s,Object.assign({},qt,Th(bh(e)))),i,r,n,o=!1,a=!1,A=!1,l=!1,c,u,h,d=[],g=Bh(ge,t.interactiveDebounce),f,p=_C++,v=null,y=gC(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},C={id:p,reference:s,popper:pr(),popperInstance:v,props:t,state:b,plugins:y,clearDelayTimeouts:Ve,setProps:yt,setContent:Ri,show:Bt,hide:gi,hideWithInteractivity:fi,enable:Xe,disable:nt,unmount:pi,destroy:mt};if(!t.render)return C;var Q=t.render(C),B=Q.popper,L=Q.onUpdate;B.setAttribute("data-tippy-root",""),B.id="tippy-"+C.id,C.popper=B,s._tippy=C,B._tippy=C;var _=y.map(function(K){return K.fn(C)}),$=s.hasAttribute("aria-expanded");return de(),T(),G(),S("onCreate",[C]),t.showOnCreate&&Ce(),B.addEventListener("mouseenter",function(){C.props.interactive&&C.state.isVisible&&C.clearDelayTimeouts()}),B.addEventListener("mouseleave",function(){C.props.interactive&&C.props.trigger.indexOf("mouseenter")>=0&&z().addEventListener("mousemove",g)}),C;function k(){var K=C.props.touch;return Array.isArray(K)?K:[K,0]}function M(){return k()[0]==="hold"}function X(){var K;return!!((K=C.props.render)!=null&&K.$$tippy)}function V(){return f||s}function z(){var K=V().parentNode;return K?CC(K):document}function R(){return ja(B)}function x(K){return C.state.isMounted&&!C.state.isVisible||ci.isTouch||c&&c.type==="focus"?0:Ka(C.props.delay,K?0:1,qt.delay)}function G(K){K===void 0&&(K=!1),B.style.pointerEvents=C.props.interactive&&!K?"":"none",B.style.zIndex=""+C.props.zIndex}function S(K,le,fe){if(fe===void 0&&(fe=!0),_.forEach(function(Re){Re[K]&&Re[K].apply(Re,le)}),fe){var De;(De=C.props)[K].apply(De,le)}}function w(){var K=C.props.aria;if(K.content){var le="aria-"+K.content,fe=B.id,De=Ts(C.props.triggerTarget||s);De.forEach(function(Re){var Je=Re.getAttribute(le);if(C.state.isVisible)Re.setAttribute(le,Je?Je+" "+fe:fe);else{var Qt=Je&&Je.replace(fe,"").trim();Qt?Re.setAttribute(le,Qt):Re.removeAttribute(le)}})}}function T(){if(!($||!C.props.aria.expanded)){var K=Ts(C.props.triggerTarget||s);K.forEach(function(le){C.props.interactive?le.setAttribute("aria-expanded",C.state.isVisible&&le===V()?"true":"false"):le.removeAttribute("aria-expanded")})}}function Y(){z().removeEventListener("mousemove",g),Hn=Hn.filter(function(K){return K!==g})}function U(K){if(!(ci.isTouch&&(A||K.type==="mousedown"))){var le=K.composedPath&&K.composedPath()[0]||K.target;if(!(C.props.interactive&&wh(B,le))){if(Ts(C.props.triggerTarget||s).some(function(fe){return wh(fe,le)})){if(ci.isTouch||C.state.isVisible&&C.props.trigger.indexOf("click")>=0)return}else S("onClickOutside",[C,K]);C.props.hideOnClick===!0&&(C.clearDelayTimeouts(),C.hide(),a=!0,setTimeout(function(){a=!1}),C.state.isMounted||ne())}}}function q(){A=!0}function se(){A=!1}function ce(){var K=z();K.addEventListener("mousedown",U,!0),K.addEventListener("touchend",U,ss),K.addEventListener("touchstart",se,ss),K.addEventListener("touchmove",q,ss)}function ne(){var K=z();K.removeEventListener("mousedown",U,!0),K.removeEventListener("touchend",U,ss),K.removeEventListener("touchstart",se,ss),K.removeEventListener("touchmove",q,ss)}function me(K,le){we(K,function(){!C.state.isVisible&&B.parentNode&&B.parentNode.contains(B)&&le()})}function be(K,le){we(K,le)}function we(K,le){var fe=R().box;function De(Re){Re.target===fe&&(Wa(fe,"remove",De),le())}if(K===0)return le();Wa(fe,"remove",u),Wa(fe,"add",De),u=De}function oe(K,le,fe){fe===void 0&&(fe=!1);var De=Ts(C.props.triggerTarget||s);De.forEach(function(Re){Re.addEventListener(K,le,fe),d.push({node:Re,eventType:K,handler:le,options:fe})})}function de(){M()&&(oe("touchstart",ve,{passive:!0}),oe("touchend",te,{passive:!0})),dC(C.props.trigger).forEach(function(K){if(K!=="manual")switch(oe(K,ve),K){case"mouseenter":oe("mouseleave",te);break;case"focus":oe(SC?"focusout":"blur",Se);break;case"focusin":oe("focusout",Se);break}})}function Be(){d.forEach(function(K){var le=K.node,fe=K.eventType,De=K.handler,Re=K.options;le.removeEventListener(fe,De,Re)}),d=[]}function ve(K){var le,fe=!1;if(!(!C.state.isEnabled||xe(K)||a)){var De=((le=c)==null?void 0:le.type)==="focus";c=K,f=K.currentTarget,T(),!C.state.isVisible&&EC(K)&&Hn.forEach(function(Re){return Re(K)}),K.type==="click"&&(C.props.trigger.indexOf("mouseenter")<0||o)&&C.props.hideOnClick!==!1&&C.state.isVisible?fe=!0:Ce(K),K.type==="click"&&(o=!fe),fe&&!De&&Ke(K)}}function ge(K){var le=K.target,fe=V().contains(le)||B.contains(le);if(!(K.type==="mousemove"&&fe)){var De=ke().concat(B).map(function(Re){var Je,Qt=Re._tippy,bt=(Je=Qt.popperInstance)==null?void 0:Je.state;return bt?{popperRect:Re.getBoundingClientRect(),popperState:bt,props:t}:null}).filter(Boolean);vC(De,K)&&(Y(),Ke(K))}}function te(K){var le=xe(K)||C.props.trigger.indexOf("click")>=0&&o;if(!le){if(C.props.interactive){C.hideWithInteractivity(K);return}Ke(K)}}function Se(K){C.props.trigger.indexOf("focusin")<0&&K.target!==V()||C.props.interactive&&K.relatedTarget&&B.contains(K.relatedTarget)||Ke(K)}function xe(K){return ci.isTouch?M()!==K.type.indexOf("touch")>=0:!1}function Oe(){Te();var K=C.props,le=K.popperOptions,fe=K.placement,De=K.offset,Re=K.getReferenceClientRect,Je=K.moveTransition,Qt=X()?ja(B).arrow:null,bt=Re?{getBoundingClientRect:Re,contextElement:Re.contextElement||V()}:s,Fs={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Ns){var Gi=Ns.state;if(X()){var Br=R(),Qr=Br.box;["placement","reference-hidden","escaped"].forEach(function(Ms){Ms==="placement"?Qr.setAttribute("data-placement",Gi.placement):Gi.attributes.popper["data-popper-"+Ms]?Qr.setAttribute("data-"+Ms,""):Qr.removeAttribute("data-"+Ms)}),Gi.attributes.popper={}}}},St=[{name:"offset",options:{offset:De}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Je}},Fs];X()&&Qt&&St.push({name:"arrow",options:{element:Qt,padding:3}}),St.push.apply(St,(le==null?void 0:le.modifiers)||[]),C.popperInstance=cC(bt,B,Object.assign({},le,{placement:fe,onFirstUpdate:h,modifiers:St}))}function Te(){C.popperInstance&&(C.popperInstance.destroy(),C.popperInstance=null)}function Fe(){var K=C.props.appendTo,le,fe=V();C.props.interactive&&K===vh||K==="parent"?le=fe.parentNode:le=yh(K,[fe]),le.contains(B)||le.appendChild(B),C.state.isMounted=!0,Oe()}function ke(){return Un(B.querySelectorAll("[data-tippy-root]"))}function Ce(K){C.clearDelayTimeouts(),K&&S("onTrigger",[C,K]),ce();var le=x(!0),fe=k(),De=fe[0],Re=fe[1];ci.isTouch&&De==="hold"&&Re&&(le=Re),le?i=setTimeout(function(){C.show()},le):C.show()}function Ke(K){if(C.clearDelayTimeouts(),S("onUntrigger",[C,K]),!C.state.isVisible){ne();return}if(!(C.props.trigger.indexOf("mouseenter")>=0&&C.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(K.type)>=0&&o)){var le=x(!1);le?r=setTimeout(function(){C.state.isVisible&&C.hide()},le):n=requestAnimationFrame(function(){C.hide()})}}function Xe(){C.state.isEnabled=!0}function nt(){C.hide(),C.state.isEnabled=!1}function Ve(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(n)}function yt(K){if(!C.state.isDestroyed){S("onBeforeUpdate",[C,K]),Be();var le=C.props,fe=Dh(s,Object.assign({},le,bh(K),{ignoreAttributes:!0}));C.props=fe,de(),le.interactiveDebounce!==fe.interactiveDebounce&&(Y(),g=Bh(ge,fe.interactiveDebounce)),le.triggerTarget&&!fe.triggerTarget?Ts(le.triggerTarget).forEach(function(De){De.removeAttribute("aria-expanded")}):fe.triggerTarget&&s.removeAttribute("aria-expanded"),T(),G(),L&&L(le,fe),C.popperInstance&&(Oe(),ke().forEach(function(De){requestAnimationFrame(De._tippy.popperInstance.forceUpdate)})),S("onAfterUpdate",[C,K])}}function Ri(K){C.setProps({content:K})}function Bt(){var K=C.state.isVisible,le=C.state.isDestroyed,fe=!C.state.isEnabled,De=ci.isTouch&&!C.props.touch,Re=Ka(C.props.duration,0,qt.duration);if(!(K||le||fe||De)&&!V().hasAttribute("disabled")&&(S("onShow",[C],!1),C.props.onShow(C)!==!1)){if(C.state.isVisible=!0,X()&&(B.style.visibility="visible"),G(),ce(),C.state.isMounted||(B.style.transition="none"),X()){var Je=R(),Qt=Je.box,bt=Je.content;Ja([Qt,bt],0)}h=function(){var St;if(!(!C.state.isVisible||l)){if(l=!0,B.offsetHeight,B.style.transition=C.props.moveTransition,X()&&C.props.animation){var as=R(),Ns=as.box,Gi=as.content;Ja([Ns,Gi],Re),Sh([Ns,Gi],"visible")}w(),T(),Qh(Xa,C),(St=C.popperInstance)==null||St.forceUpdate(),S("onMount",[C]),C.props.animation&&X()&&be(Re,function(){C.state.isShown=!0,S("onShown",[C])})}},Fe()}}function gi(){var K=!C.state.isVisible,le=C.state.isDestroyed,fe=!C.state.isEnabled,De=Ka(C.props.duration,1,qt.duration);if(!(K||le||fe)&&(S("onHide",[C],!1),C.props.onHide(C)!==!1)){if(C.state.isVisible=!1,C.state.isShown=!1,l=!1,o=!1,X()&&(B.style.visibility="hidden"),Y(),ne(),G(!0),X()){var Re=R(),Je=Re.box,Qt=Re.content;C.props.animation&&(Ja([Je,Qt],De),Sh([Je,Qt],"hidden"))}w(),T(),C.props.animation?X()&&me(De,C.unmount):C.unmount()}}function fi(K){z().addEventListener("mousemove",g),Qh(Hn,g),g(K)}function pi(){C.state.isVisible&&C.hide(),C.state.isMounted&&(Te(),ke().forEach(function(K){K._tippy.unmount()}),B.parentNode&&B.parentNode.removeChild(B),Xa=Xa.filter(function(K){return K!==C}),C.state.isMounted=!1,S("onHidden",[C]))}function mt(){C.state.isDestroyed||(C.clearDelayTimeouts(),C.unmount(),Be(),delete s._tippy,C.state.isDestroyed=!0,S("onDestroy",[C]))}}function rs(s,e){e===void 0&&(e={});var t=qt.plugins.concat(e.plugins||[]);QC();var i=Object.assign({},e,{plugins:t}),r=mC(s),n=r.reduce(function(o,a){var A=a&&kC(a,i);return A&&o.push(A),o},[]);return Gn(s)?n[0]:n}rs.defaultProps=qt,rs.setDefaultProps=TC,rs.currentInput=ci,Object.assign({},ih,{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:kh});class ui 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 FC=5;function NC(s,e){const t=s.map(({id:r})=>r).join("|"),i=e.map(({id:r})=>r).join("|");return t===i}class MC{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=ft(),this._controls=ft(),this.host=e}set activeScenes(e){NC(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-FC&&a<u))??[],this.loadScenes(),this.syncVideoState(),(r=this._controls.value)==null||r.setAttribute("currentTime",a.toString());const l=this.activeScenes[0],c=_l((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>=zr(u)&&g<=zr(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 pt(this._canvas)}controls(){return pt(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 ui("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 OC(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function PC(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function UC(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 GC(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&&!OC()&&Si.isSupported()?GC(t,s):UC(e,s)}async function Fh(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 HC=Kt(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 $C=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=Kt(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=Kt(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await Fh(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 ui(`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,a])=>{var A;const l=this._delayProcessing();try{let c=null;if(this.host._errors=[],this.host._languages=this.host.languageResolver({data:e}),(!n||!this.host._languages.find(({value:u})=>n===u))&&(this.host._language=(A=this.host._languages[0])==null?void 0:A.value),i||e){if(i){let f=null;if(r)try{f=await(await fetch(r,{method:"GET"})).text()}catch(y){const b=new ui("Track failed to fetch",y);this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:b,message:b.message}))}const v={questions:{items:[{answer:{id:"source",media:{[i.includes(".m3u8")?"playlist":"video"]:i},captions:{current:f}}}]}};try{this.scenes=await ds({data:v,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(y){try{this.scenes=await ds({data:v,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(b){throw new ui("Fatal source template error",b,!0)}c=new ui("Source template error",y)}}else try{this.scenes=await ds({data:e,template:t,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(f){try{this.scenes=await ds({data:e,burnCaptions:o,debug:a},this._createDataResolver(this.host.language),this._resolveVideo,this._resolveVideoMeta)}catch(p){throw new ui("Fatal data template error",p,!0)}c=new ui("Data template error",f)}Object.keys(this.videos).forEach(f=>{this.scenes.scenes.find(({video:p})=>f===(p==null?void 0:p.key))||this._videos[f].node.pause()});const[u,h,d]=this.scenes.scenes.reduce((f,{video:p,videoMeta:v,start:y,duration:b})=>{var C;p&&(f[0][p.key]=p,v&&(f[1][p.key]=v));const Q=(p==null?void 0:p.key)??`${y}-${b}`,B=this._getBufferSegments({key:Q,node:p==null?void 0:p.node,duration:this.scenes.duration});return f[2][Q]={initialised:!p,waiting:!!p,...this.videoState[Q],buffered:p?B:(C=this.videoState[Q])==null?void 0:C.buffered},f},[{},{},{}]);this.videos=u,this.videoMeta=h,this.videoState={...this.videoState,...d},(await Promise.all(this.scenes.fonts.map(f=>HC(f)))).forEach(f=>{document.fonts.add(f)}),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)}c&&this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message})),this.host.dispatchEvent(new CustomEvent("scenesupdate",{detail:this.scenes,bubbles:!0,composed:!0}))}catch(c){this.scenes=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:c,message:c.message}))}finally{l.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,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 YC(s){s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen?s.mozRequestFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.msRequestFullscreen&&s.msRequestFullscreen()}function KC(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const Za=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],VC={id:"captions",event:"captions:click",label:"Closed Captions"},JC={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Nh={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}]},WC={id:"playbackRate",label:"Playback playbackRate",subItems:Nh};class qC 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)),Yt}}const eA=us(qC),jC=nm(()=>{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=Tl.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]}),hi={"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"},XC={colors:hi,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 ${hi["dark-100"]}`,medium:`0 .125rem .625rem ${hi["dark-100"]}`,large:`0 .25rem 1rem ${hi["dark-50"]}`,xl:`.25rem .25rem 1rem ${hi["dark-250"]}`,xxl:`0 .25rem 2rem ${hi["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${hi["dark-250"]}`,toolbar:`0 -.625rem .625rem ${hi["dark-50"]}`,text:`0 0 .25rem ${hi["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:hi["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Mh=im(XC,{delimiter:"-"}),zC=Object.keys(Mh).map(s=>Os(`:host { --${s}: ${Mh[s]}; }`)),Me=(s=>{const e=class extends s{firstUpdated(){jC().forEach(({load:n,font:o})=>{document.fonts.add(o),n&&o.load()})}};return e.styles=[(s==null?void 0:s.styles)??[],zC,at`
191
191
  :host {
192
192
  font-family: var(--fontFamilies-sans);
193
193
  font-size: var(--fontSizes-medium);
194
194
  line-height: var(--lineHeights-medium);
195
195
  font-weight: var(--fontWeights-regular);
196
196
  }
197
- `,ot`
197
+ `,at`
198
198
  *,
199
199
  *::before,
200
200
  *::after,
@@ -268,12 +268,12 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
268
268
  scroll-behavior: auto !important;
269
269
  }
270
270
  }
271
- `],e})(mi),ZC=(s,e)=>(typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,e)),e),ev=(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))}}},wt=s=>e=>typeof e=="function"?ZC(s,e):ev(s,e);class tv{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=Kt(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=Kt(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=Kt(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await Fu(i),c=(a??0)*l,h=(1-(A??0))*l;return{id:r,config:t,captions:n,start:c,duration:h-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,o])=>{var a,A;try{if(e)return;if(t){const l=t.includes(".m3u8")?"playlist":"video";try{this.scenes=await ds({data:{questions:{items:[{answer:{id:"source",media:{[l]:t,reducedQuality:t}}}]}},template:r,burnCaptions:o},this._createDataResolver(n),this._resolveVideo,this._resolveVideoMeta)}catch(c){throw new hi("Video preview source template error",c)}this._video=((A=(a=this.scenes.scenes[0])==null?void 0:a.video)==null?void 0:A.node)??null}else if(i)try{this.scenes=await ds({data:i,template:r,burnCaptions:o},this._createDataResolver(n),this._resolveAnswer,this._resolveVideoMeta)}catch(l){throw new hi("Video preview data template error",l)}}catch(l){this.scenes=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:l,message:l.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,burnCaptions:this.host.burnCaptions});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,this.host.burnCaptions];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 Ou(s,e,t){return Math.min(Math.max(e,s),t)}function Er(s,e){return e?e instanceof ShadowRoot?Er(s,e.host):e instanceof HTMLElement&&e.matches(s)?e:Er(s,e.parentNode):null}function tA(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 iv=Object.defineProperty,sv=Object.getOwnPropertyDescriptor,Ds=(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&&iv(e,t,r),r};let Pi=class extends Me{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return Ee`<button
271
+ `],e})(mi),ZC=(s,e)=>(typeof window<"u"&&(window.customElements.get(s)??window.customElements.define(s,e)),e),ev=(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))}}},wt=s=>e=>typeof e=="function"?ZC(s,e):ev(s,e);class tv{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=Kt(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=Kt(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=Kt(async(t,i)=>{const{id:r,captions:n,duration:o,startOffset:a,endOffset:A}=t,l=o??await Fh(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,o])=>{var a,A;try{if(e)return;if(t){const l=t.includes(".m3u8")?"playlist":"video";try{this.scenes=await ds({data:{questions:{items:[{answer:{id:"source",media:{[l]:t,reducedQuality:t}}}]}},template:r,burnCaptions:o},this._createDataResolver(n),this._resolveVideo,this._resolveVideoMeta)}catch(c){throw new ui("Video preview source template error",c)}this._video=((A=(a=this.scenes.scenes[0])==null?void 0:a.video)==null?void 0:A.node)??null}else if(i)try{this.scenes=await ds({data:i,template:r,burnCaptions:o},this._createDataResolver(n),this._resolveAnswer,this._resolveVideoMeta)}catch(l){throw new ui("Video preview data template error",l)}}catch(l){this.scenes=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:l,message:l.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,burnCaptions:this.host.burnCaptions});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,this.host.burnCaptions];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 Er(s,e){return e?e instanceof ShadowRoot?Er(s,e.host):e instanceof HTMLElement&&e.matches(s)?e:Er(s,e.parentNode):null}function tA(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 iv=Object.defineProperty,sv=Object.getOwnPropertyDescriptor,Ds=(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&&iv(e,t,r),r};let Pi=class extends Me{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return pe`<button
272
272
  class=${Ge({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"})}
273
273
  >
274
274
  <slot></slot>
275
- ${this.icon&&Ee`<vmp-icon icon=${this.icon}></vmp-icon>`}
276
- </button>`}};Pi.styles=[Me.styles??[],ot`
275
+ ${this.icon&&pe`<vmp-icon icon=${this.icon}></vmp-icon>`}
276
+ </button>`}};Pi.styles=[Me.styles??[],at`
277
277
  :host {
278
278
  --button-padding: var(--vu-button-padding, var(--space-s));
279
279
  --button-color: var(--vu-button-color, var(--colors-dark-640));
@@ -349,42 +349,42 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
349
349
  .weight-light:focus {
350
350
  --button-background: var(--vu-button-background-hover, #9d9d9d);
351
351
  }
352
- `],Ds([J({type:Boolean})],Pi.prototype,"active",2),Ds([J({type:String})],Pi.prototype,"size",2),Ds([J({type:String})],Pi.prototype,"rounded",2),Ds([J({type:String})],Pi.prototype,"weight",2),Ds([J({type:String})],Pi.prototype,"icon",2),Pi=Ds([wt("vmp-button")],Pi);const Pu={"arrow-left":()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
352
+ `],Ds([J({type:Boolean})],Pi.prototype,"active",2),Ds([J({type:String})],Pi.prototype,"size",2),Ds([J({type:String})],Pi.prototype,"rounded",2),Ds([J({type:String})],Pi.prototype,"weight",2),Ds([J({type:String})],Pi.prototype,"icon",2),Pi=Ds([wt("vmp-button")],Pi);const Ph={"arrow-left":()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
353
353
  <path
354
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"
355
355
  fill="currentColor"
356
356
  />
357
- </svg>`,"arrow-right":()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
357
+ </svg>`,"arrow-right":()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
358
358
  <path
359
359
  d="M3.75 9.21875H13.2578L8.89062 4.85156L10 3.75L16.25 10L10 16.25L8.89844 15.1484L13.2578 10.7812H3.75V9.21875Z"
360
360
  fill="currentColor"
361
361
  />
362
- </svg>`,"captions-cross":()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
362
+ </svg>`,"captions-cross":()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
363
363
  <path
364
364
  d="M17.0625 19.4167L14.3125 16.6667H3.33333C2.875 16.6667 2.4825 16.5036 2.15583 16.1775C1.82972 15.8509 1.66667 15.4584 1.66667 15V4.16669C1.66667 4.13891 1.66667 4.11446 1.66667 4.09335C1.66667 4.0728 1.66667 4.04863 1.66667 4.02085L0.5625 2.91669L1.75 1.72919L18.25 18.2292L17.0625 19.4167ZM18.3333 15.9375L14.7083 12.3125C14.8056 12.2431 14.8786 12.1495 14.9275 12.0317C14.9758 11.9134 15 11.7917 15 11.6667V10.8334H13.75V11.25H13.6458L12.0833 9.68752V8.75002H13.75V9.16669H15V8.33335C15 8.09724 14.92 7.89919 14.76 7.73919C14.6006 7.57974 14.4028 7.50002 14.1667 7.50002H11.6667C11.4306 7.50002 11.2328 7.57974 11.0733 7.73919C10.9133 7.89919 10.8333 8.09724 10.8333 8.33335V8.43752L5.72917 3.33335H16.6667C17.125 3.33335 17.5175 3.49669 17.8442 3.82335C18.1703 4.14946 18.3333 4.54169 18.3333 5.00002V15.9375ZM5.83333 12.5H8.33333C8.56944 12.5 8.7675 12.42 8.9275 12.26C9.08694 12.1006 9.16667 11.9028 9.16667 11.6667V11.5209L8.47917 10.8334H7.91667V11.25H6.25V8.60419L5.3125 7.66669C5.21528 7.73613 5.13889 7.82974 5.08333 7.94752C5.02778 8.06585 5 8.19446 5 8.33335V11.6667C5 11.9028 5.07972 12.1006 5.23917 12.26C5.39917 12.42 5.59722 12.5 5.83333 12.5Z"
365
365
  fill="currentColor"
366
366
  />
367
- </svg>`,captions:()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
367
+ </svg>`,captions:()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
368
368
  <path
369
369
  d="M5.83342 12.5H8.33342C8.56953 12.5 8.76758 12.42 8.92758 12.26C9.08703 12.1005 9.16675 11.9028 9.16675 11.6666V10.8333H7.91675V11.25H6.25008V8.74998H7.91675V9.16665H9.16675V8.33331C9.16675 8.0972 9.08703 7.89915 8.92758 7.73915C8.76758 7.5797 8.56953 7.49998 8.33342 7.49998H5.83342C5.5973 7.49998 5.39925 7.5797 5.23925 7.73915C5.0798 7.89915 5.00008 8.0972 5.00008 8.33331V11.6666C5.00008 11.9028 5.0798 12.1005 5.23925 12.26C5.39925 12.42 5.5973 12.5 5.83342 12.5ZM11.6667 12.5H14.1667C14.4029 12.5 14.6006 12.42 14.7601 12.26C14.9201 12.1005 15.0001 11.9028 15.0001 11.6666V10.8333H13.7501V11.25H12.0834V8.74998H13.7501V9.16665H15.0001V8.33331C15.0001 8.0972 14.9201 7.89915 14.7601 7.73915C14.6006 7.5797 14.4029 7.49998 14.1667 7.49998H11.6667C11.4306 7.49998 11.2329 7.5797 11.0734 7.73915C10.9134 7.89915 10.8334 8.0972 10.8334 8.33331V11.6666C10.8334 11.9028 10.9134 12.1005 11.0734 12.26C11.2329 12.42 11.4306 12.5 11.6667 12.5ZM3.33341 16.6666C2.87508 16.6666 2.48258 16.5036 2.15591 16.1775C1.8298 15.8508 1.66675 15.4583 1.66675 15V4.99998C1.66675 4.54165 1.8298 4.14942 2.15591 3.82331C2.48258 3.49665 2.87508 3.33331 3.33341 3.33331H16.6667C17.1251 3.33331 17.5176 3.49665 17.8442 3.82331C18.1704 4.14942 18.3334 4.54165 18.3334 4.99998V15C18.3334 15.4583 18.1704 15.8508 17.8442 16.1775C17.5176 16.5036 17.1251 16.6666 16.6667 16.6666H3.33341Z"
370
370
  fill="currentColor"
371
371
  />
372
- </svg>`,"chevron-down":()=>Ee`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" part="svg">
372
+ </svg>`,"chevron-down":()=>pe`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" part="svg">
373
373
  <path
374
374
  d="M11.8032 7.13666L10.8632 6.19666L7.80322 9.24999L4.74322 6.19666L3.80322 7.13666L7.80322 11.1367L11.8032 7.13666Z"
375
375
  fill="currentColor"
376
376
  />
377
- </svg>`,close:()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" part="svg">
377
+ </svg>`,close:()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" part="svg">
378
378
  <path
379
379
  d="M15.8334 5.34163L14.6584 4.16663L10 8.82496L5.34169 4.16663L4.16669 5.34163L8.82502 9.99996L4.16669 14.6583L5.34169 15.8333L10 11.175L14.6584 15.8333L15.8334 14.6583L11.175 9.99996L15.8334 5.34163Z"
380
380
  fill="currentColor"
381
381
  />
382
- </svg>`,error:()=>Ee`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" part="svg">
382
+ </svg>`,error:()=>pe`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" part="svg">
383
383
  <path
384
384
  d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2Zm1 15h-2v-2h2v2Zm0-4h-2V7h2v6Z"
385
385
  fill="currentColor"
386
386
  />
387
- </svg>`,loading:()=>Ee`<svg class="spinner" width="50" height="50" viewBox="0 0 50 50" part="svg">
387
+ </svg>`,loading:()=>pe`<svg class="spinner" width="50" height="50" viewBox="0 0 50 50" part="svg">
388
388
  <style>
389
389
  /* SVG spinner icon animation */
390
390
  .spinner {
@@ -444,62 +444,62 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
444
444
  }
445
445
  </style>
446
446
  <circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="5" />
447
- </svg>`,maximize:()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
447
+ </svg>`,maximize:()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
448
448
  <path
449
449
  fill-rule="evenodd"
450
450
  clip-rule="evenodd"
451
451
  d="M6.66675 3.33331H3.33341H1.66675V4.99998V8.33331H3.33341V4.99998H6.66675V3.33331ZM6.66675 15H3.33341V11.6666H1.66675V15V16.6666H3.33341H6.66675V15ZM13.3334 3.33331H16.6667H18.3334V4.99998V8.33331H16.6667V4.99998H13.3334V3.33331ZM16.6667 15H13.3334V16.6666H16.6667H18.3334V15V11.6666H16.6667V15Z"
452
452
  fill="currentColor"
453
453
  />
454
- </svg>`,minimize:()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
454
+ </svg>`,minimize:()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
455
455
  <path
456
456
  fill-rule="evenodd"
457
457
  clip-rule="evenodd"
458
458
  d="M5.00008 3.33331H6.66675V6.66665V8.33331H5.00008H1.66675V6.66665H5.00008V3.33331ZM5.00008 11.6666H1.66675V13.3333H5.00008V16.6666H6.66675V13.3333V11.6666H5.00008ZM15.0001 6.66665H18.3334V8.33331H15.0001H13.3334V6.66665V3.33331H15.0001V6.66665ZM18.3334 11.6666H15.0001H13.3334V13.3333V16.6666H15.0001V13.3333H18.3334V11.6666Z"
459
459
  fill="currentColor"
460
460
  />
461
- </svg>`,muted:()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
461
+ </svg>`,muted:()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
462
462
  <path
463
463
  d="M13.75 10C13.75 8.525 12.9 7.25833 11.6667 6.64167V8.48333L13.7083 10.525C13.7333 10.3583 13.75 10.1833 13.75 10ZM15.8333 10C15.8333 10.7833 15.6667 11.5167 15.3833 12.2L16.6417 13.4583C17.1917 12.425 17.5 11.25 17.5 10C17.5 6.43333 15.0083 3.45 11.6667 2.69167V4.40833C14.075 5.125 15.8333 7.35833 15.8333 10ZM3.55833 2.5L2.5 3.55833L6.44167 7.5H2.5V12.5H5.83333L10 16.6667V11.0583L13.5417 14.6C12.9833 15.0333 12.3583 15.375 11.6667 15.5833V17.3C12.8167 17.0417 13.8583 16.5083 14.7417 15.7917L16.4417 17.5L17.5 16.4417L10 8.94167L3.55833 2.5ZM10 3.33333L8.25833 5.075L10 6.81667V3.33333Z"
464
464
  fill="currentColor"
465
465
  />
466
- </svg>`,pause:()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
466
+ </svg>`,pause:()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
467
467
  <path
468
468
  fill-rule="evenodd"
469
469
  clip-rule="evenodd"
470
470
  d="M8.33333 2.5H5V17.5H8.33333V2.5ZM15 2.5H11.6667V17.5H15V2.5Z"
471
471
  fill="currentColor"
472
472
  />
473
- </svg>`,"play-large":()=>Ee`<svg width="45" height="53" viewBox="0 0 45 53" fill="none" part="svg">
473
+ </svg>`,"play-large":()=>pe`<svg width="45" height="53" viewBox="0 0 45 53" fill="none" part="svg">
474
474
  <path
475
475
  d="M43.5 23.8319C45.5 25.0083 45.5 27.9492 43.5 29.1256L4.5 52.0647C2.5 53.2411 0 51.7706 0 49.4179V3.53961C0 1.18687 2.5 -0.283582 4.5 0.892785L43.5 23.8319Z"
476
476
  fill="currentColor"
477
477
  />
478
- </svg>`,play:()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
478
+ </svg>`,play:()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
479
479
  <path d="M17.3803 9.99998L5.83325 16.6666V3.33331L17.3803 9.99998Z" fill="currentColor" />
480
- </svg>`,settings:()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
480
+ </svg>`,settings:()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
481
481
  <path
482
482
  d="M7.70833 18.3334L7.375 15.6667C7.19445 15.5972 7.02444 15.5139 6.865 15.4167C6.705 15.3195 6.54861 15.2153 6.39583 15.1042L3.91667 16.1459L1.625 12.1875L3.77083 10.5625C3.75694 10.4653 3.75 10.3714 3.75 10.2809C3.75 10.1909 3.75 10.0972 3.75 10C3.75 9.9028 3.75 9.80891 3.75 9.71835C3.75 9.62835 3.75694 9.53474 3.77083 9.43752L1.625 7.81252L3.91667 3.85419L6.39583 4.89585C6.54861 4.78474 6.70833 4.68058 6.875 4.58335C7.04167 4.48613 7.20833 4.4028 7.375 4.33335L7.70833 1.66669H12.2917L12.625 4.33335C12.8056 4.4028 12.9758 4.48613 13.1358 4.58335C13.2953 4.68058 13.4514 4.78474 13.6042 4.89585L16.0833 3.85419L18.375 7.81252L16.2292 9.43752C16.2431 9.53474 16.25 9.62835 16.25 9.71835C16.25 9.80891 16.25 9.9028 16.25 10C16.25 10.0972 16.25 10.1909 16.25 10.2809C16.25 10.3714 16.2361 10.4653 16.2083 10.5625L18.3542 12.1875L16.0625 16.1459L13.6042 15.1042C13.4514 15.2153 13.2917 15.3195 13.125 15.4167C12.9583 15.5139 12.7917 15.5972 12.625 15.6667L12.2917 18.3334H7.70833ZM10.0417 12.9167C10.8472 12.9167 11.5347 12.632 12.1042 12.0625C12.6736 11.4931 12.9583 10.8056 12.9583 10C12.9583 9.19447 12.6736 8.50696 12.1042 7.93752C11.5347 7.36808 10.8472 7.08335 10.0417 7.08335C9.22222 7.08335 8.53111 7.36808 7.96833 7.93752C7.40611 8.50696 7.125 9.19447 7.125 10C7.125 10.8056 7.40611 11.4931 7.96833 12.0625C8.53111 12.632 9.22222 12.9167 10.0417 12.9167ZM10.0417 11.25C9.69445 11.25 9.39945 11.1284 9.15667 10.885C8.91333 10.6422 8.79167 10.3472 8.79167 10C8.79167 9.6528 8.91333 9.3578 9.15667 9.11502C9.39945 8.87169 9.69445 8.75002 10.0417 8.75002C10.3889 8.75002 10.6842 8.87169 10.9275 9.11502C11.1703 9.3578 11.2917 9.6528 11.2917 10C11.2917 10.3472 11.1703 10.6422 10.9275 10.885C10.6842 11.1284 10.3889 11.25 10.0417 11.25ZM9.16667 16.6667H10.8125L11.1042 14.4584C11.5347 14.3472 11.9342 14.1839 12.3025 13.9684C12.6703 13.7534 13.0069 13.4931 13.3125 13.1875L15.375 14.0417L16.1875 12.625L14.3958 11.2709C14.4653 11.0764 14.5139 10.8714 14.5417 10.6559C14.5694 10.4409 14.5833 10.2222 14.5833 10C14.5833 9.7778 14.5694 9.55891 14.5417 9.34335C14.5139 9.12835 14.4653 8.92363 14.3958 8.72919L16.1875 7.37502L15.375 5.95835L13.3125 6.83335C13.0069 6.51391 12.6703 6.24641 12.3025 6.03085C11.9342 5.81585 11.5347 5.6528 11.1042 5.54169L10.8333 3.33335H9.1875L8.89583 5.54169C8.46528 5.6528 8.06611 5.81585 7.69833 6.03085C7.33 6.24641 6.99306 6.50697 6.6875 6.81252L4.625 5.95835L3.8125 7.37502L5.60417 8.70835C5.53472 8.91669 5.48611 9.12502 5.45833 9.33335C5.43056 9.54169 5.41667 9.76391 5.41667 10C5.41667 10.2222 5.43056 10.4375 5.45833 10.6459C5.48611 10.8542 5.53472 11.0625 5.60417 11.2709L3.8125 12.625L4.625 14.0417L6.6875 13.1667C6.99306 13.4861 7.33 13.7534 7.69833 13.9684C8.06611 14.1839 8.46528 14.3472 8.89583 14.4584L9.16667 16.6667Z"
483
483
  fill="currentColor"
484
484
  />
485
- </svg>`,tick:()=>Ee`<svg width="20" height="21" viewBox="0 0 20 21" fill="none" part="svg">
485
+ </svg>`,tick:()=>pe`<svg width="20" height="21" viewBox="0 0 20 21" fill="none" part="svg">
486
486
  <path
487
487
  d="M7.50016 14.0001L4.00016 10.5001L2.8335 11.6667L7.50016 16.3334L17.5002 6.33341L16.3335 5.16675L7.50016 14.0001Z"
488
488
  fill="currentColor"
489
489
  />
490
- </svg>`,"volume-high":()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
490
+ </svg>`,"volume-high":()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
491
491
  <path
492
492
  d="M2.5 7.49998V12.5H5.83333L10 16.6667V3.33332L5.83333 7.49998H2.5ZM13.75 9.99998C13.75 8.52498 12.9 7.25832 11.6667 6.64165V13.35C12.9 12.7417 13.75 11.475 13.75 9.99998ZM11.6667 2.69165V4.40832C14.075 5.12498 15.8333 7.35832 15.8333 9.99998C15.8333 12.6417 14.075 14.875 11.6667 15.5917V17.3083C15.0083 16.55 17.5 13.5667 17.5 9.99998C17.5 6.43332 15.0083 3.44998 11.6667 2.69165Z"
493
493
  fill="currentColor"
494
494
  />
495
- </svg>`,"volume-low":()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
495
+ </svg>`,"volume-low":()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
496
496
  <path d="M5.83325 7.49998V12.5H9.16658L13.3333 16.6666V3.33331L9.16658 7.49998H5.83325Z" fill="currentColor" />
497
- </svg>`,"volume-medium":()=>Ee`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
497
+ </svg>`,"volume-medium":()=>pe`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
498
498
  <path
499
499
  d="M15.4167 9.99998C15.4167 8.52498 14.5667 7.25831 13.3334 6.64165V13.35C14.5667 12.7416 15.4167 11.475 15.4167 9.99998ZM4.16675 7.49998V12.5H7.50008L11.6667 16.6666V3.33331L7.50008 7.49998H4.16675Z"
500
500
  fill="currentColor"
501
501
  />
502
- </svg>`,vouch:()=>Ee`<svg
502
+ </svg>`,vouch:()=>pe`<svg
503
503
  xmlns="http://www.w3.org/2000/svg"
504
504
  height="28"
505
505
  width="105"
@@ -510,26 +510,26 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
510
510
  <path
511
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"
512
512
  />
513
- </svg>`};var rv=Object.defineProperty,nv=Object.getOwnPropertyDescriptor,Uu=(s,e,t,i)=>{for(var r=i>1?void 0:i?nv(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&&rv(e,t,r),r};let $n=class extends Me{render(){return!this.icon||!Object.keys(Pu).includes(this.icon)?null:Pu[this.icon]()}};$n.styles=[Me.styles??[],ot`
513
+ </svg>`};var rv=Object.defineProperty,nv=Object.getOwnPropertyDescriptor,Uh=(s,e,t,i)=>{for(var r=i>1?void 0:i?nv(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&&rv(e,t,r),r};let $n=class extends Me{render(){return!this.icon||!Object.keys(Ph).includes(this.icon)?null:Ph[this.icon]()}};$n.styles=[Me.styles??[],at`
514
514
  :host {
515
515
  display: flex;
516
516
  align-items: center;
517
517
  justify-content: center;
518
518
  flex-shrink: 0;
519
519
  }
520
- `],Uu([J({type:String})],$n.prototype,"icon",2),$n=Uu([wt("vmp-icon")],$n);var ov=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&&ov(e,t,r),r};let Ui=class extends Me{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return Ee`
520
+ `],Uh([J({type:String})],$n.prototype,"icon",2),$n=Uh([wt("vmp-icon")],$n);var ov=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&&ov(e,t,r),r};let Ui=class extends Me{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return pe`
521
521
  <vmp-button
522
522
  ?active=${this.active}
523
- size=${Ze(this.size)}
524
- rounded=${Ze(this.rounded)}
525
- weight=${Ze(this.weight)}
523
+ size=${et(this.size)}
524
+ rounded=${et(this.rounded)}
525
+ weight=${et(this.weight)}
526
526
  >
527
527
  <vmp-icon
528
528
  class=${Ge({tiny:this.size==="tiny",small:this.size==="small",large:this.size==="large"})}
529
- icon=${Ze(this.icon)}
529
+ icon=${et(this.icon)}
530
530
  ></vmp-icon>
531
531
  </vmp-button>
532
- `}};Ui.styles=[Me.styles??[],ot`
532
+ `}};Ui.styles=[Me.styles??[],at`
533
533
  .tiny::part(svg) {
534
534
  height: 12px;
535
535
  width: 12px;
@@ -544,7 +544,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
544
544
  height: 32px;
545
545
  width: 32px;
546
546
  }
547
- `],Ls([J({type:Boolean})],Ui.prototype,"active",2),Ls([J({type:String})],Ui.prototype,"size",2),Ls([J({type:String})],Ui.prototype,"rounded",2),Ls([J({type:String})],Ui.prototype,"weight",2),Ls([J({type:String})],Ui.prototype,"icon",2),Ui=Ls([wt("vmp-icon-button")],Ui);var Av=Object.defineProperty,lv=Object.getOwnPropertyDescriptor,tt=(s,e,t,i)=>{for(var r=i>1?void 0:i?lv(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 Ht=class extends Me{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.burnCaptions=!1,this.compilation=So,this.dataResolver=Fo,this._currentTime=0,this._sceneController=new tv(this),this._canvasRef=ft(),this._previewRef=ft(),this._previewTimeRef=ft(),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(${Ou(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,u;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=(h=this._previewRef.value.getRootNode().host)==null?void 0:h.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(${Ou(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",tA(Math.max(0,Math.min(this._currentTime,(u=this._sceneController.scenes)==null?void 0:u.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=Er("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=Er("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}=wo({resolution:180,aspectRatio:this.aspectRatio}),i=((s=this._sceneController.scenes)==null?void 0:s.scenes.length)??0;return!this.disabled&&(this.src||i>1)?Ee`
547
+ `],Ls([J({type:Boolean})],Ui.prototype,"active",2),Ls([J({type:String})],Ui.prototype,"size",2),Ls([J({type:String})],Ui.prototype,"rounded",2),Ls([J({type:String})],Ui.prototype,"weight",2),Ls([J({type:String})],Ui.prototype,"icon",2),Ui=Ls([wt("vmp-icon-button")],Ui);var Av=Object.defineProperty,lv=Object.getOwnPropertyDescriptor,it=(s,e,t,i)=>{for(var r=i>1?void 0:i?lv(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 Ht=class extends Me{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.burnCaptions=!1,this.compilation=So,this.dataResolver=Fo,this._currentTime=0,this._sceneController=new tv(this),this._canvasRef=ft(),this._previewRef=ft(),this._previewTimeRef=ft(),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",tA(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=Er("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=Er("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}=wo({resolution:180,aspectRatio:this.aspectRatio}),i=((s=this._sceneController.scenes)==null?void 0:s.scenes.length)??0;return!this.disabled&&(this.src||i>1)?pe`
548
548
  <div
549
549
  ${pt(this._previewRef)}
550
550
  class="preview"
@@ -553,7 +553,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
553
553
  <canvas ${pt(this._canvasRef)} class="preview-canvas" width=${t} height=${e}></canvas>
554
554
  <vmp-text ${pt(this._previewTimeRef)} class="preview-text" size="small"></vmp-text>
555
555
  </div>
556
- `:null}};Ht.styles=[Me.styles??[],ot`
556
+ `:null}};Ht.styles=[Me.styles??[],at`
557
557
  .preview {
558
558
  position: absolute;
559
559
  display: flex;
@@ -584,7 +584,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
584
584
  color: var(--colors-light-1000);
585
585
  font-variant-numeric: tabular-nums;
586
586
  }
587
- `],tt([J({type:String})],Ht.prototype,"src",2),tt([J({type:Object})],Ht.prototype,"data",2),tt([J({type:Object})],Ht.prototype,"template",2),tt([J({type:String})],Ht.prototype,"language",2),tt([J({type:Boolean})],Ht.prototype,"disabled",2),tt([J({type:Number})],Ht.prototype,"aspectRatio",2),tt([J({type:Boolean})],Ht.prototype,"burnCaptions",2),tt([J({attribute:!1})],Ht.prototype,"compilation",2),tt([J({attribute:!1})],Ht.prototype,"dataResolver",2),Ht=tt([wt("vmp-video-preview-content")],Ht);let jt=class extends Me{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.burnCaptions=!1,this.compilation=So,this.dataResolver=Fo}render(){return Ee`
587
+ `],it([J({type:String})],Ht.prototype,"src",2),it([J({type:Object})],Ht.prototype,"data",2),it([J({type:Object})],Ht.prototype,"template",2),it([J({type:String})],Ht.prototype,"language",2),it([J({type:Boolean})],Ht.prototype,"disabled",2),it([J({type:Number})],Ht.prototype,"aspectRatio",2),it([J({type:Boolean})],Ht.prototype,"burnCaptions",2),it([J({attribute:!1})],Ht.prototype,"compilation",2),it([J({attribute:!1})],Ht.prototype,"dataResolver",2),Ht=it([wt("vmp-video-preview-content")],Ht);let jt=class extends Me{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.burnCaptions=!1,this.compilation=So,this.dataResolver=Fo}render(){return pe`
588
588
  <vmp-video-preview-content
589
589
  ?disabled=${this.disabled}
590
590
  .src=${this.src}
@@ -596,7 +596,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
596
596
  .compilation=${this.compilation}
597
597
  .dataResolver=${this.dataResolver}
598
598
  ></vmp-video-preview-content>
599
- `}};tt([J({type:String})],jt.prototype,"src",2),tt([J({type:Object})],jt.prototype,"data",2),tt([J({type:Object})],jt.prototype,"template",2),tt([J({type:String})],jt.prototype,"language",2),tt([J({type:Boolean})],jt.prototype,"disabled",2),tt([J({type:Number})],jt.prototype,"aspectRatio",2),tt([J({type:Boolean})],jt.prototype,"burnCaptions",2),tt([J({attribute:!1})],jt.prototype,"compilation",2),tt([J({attribute:!1})],jt.prototype,"dataResolver",2),jt=tt([wt("vmp-video-preview")],jt);class cv extends Js{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),Yt}}const Gu=hs(cv);class hv{constructor(e){this.hiddenControls=[],this._measureRef=ft(),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(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=a,this.host.requestUpdate()}},this.host=e}measure(){return pt(this._measureRef)}contain(){return eA(this._onResize)}hide(e,t){return Gu(i=>{this._hideables[e]={element:i,hideIndex:t}})}show(e,t){return Gu(i=>{this._showables[e]={element:i,showOn:t}})}}const iA=".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 uv=Object.defineProperty,dv=Object.getOwnPropertyDescriptor,Ir=(s,e,t,i)=>{for(var r=i>1?void 0:i?dv(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 ns=class extends Me{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return Ee`
599
+ `}};it([J({type:String})],jt.prototype,"src",2),it([J({type:Object})],jt.prototype,"data",2),it([J({type:Object})],jt.prototype,"template",2),it([J({type:String})],jt.prototype,"language",2),it([J({type:Boolean})],jt.prototype,"disabled",2),it([J({type:Number})],jt.prototype,"aspectRatio",2),it([J({type:Boolean})],jt.prototype,"burnCaptions",2),it([J({attribute:!1})],jt.prototype,"compilation",2),it([J({attribute:!1})],jt.prototype,"dataResolver",2),jt=it([wt("vmp-video-preview")],jt);class cv extends Js{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),Yt}}const Gh=us(cv);class uv{constructor(e){this.hiddenControls=[],this._measureRef=ft(),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 pt(this._measureRef)}contain(){return eA(this._onResize)}hide(e,t){return Gh(i=>{this._hideables[e]={element:i,hideIndex:t}})}show(e,t){return Gh(i=>{this._showables[e]={element:i,showOn:t}})}}const iA=".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 hv=Object.defineProperty,dv=Object.getOwnPropertyDescriptor,Ir=(s,e,t,i)=>{for(var r=i>1?void 0:i?dv(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&&hv(e,t,r),r};let ns=class extends Me{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return pe`
600
600
  <div
601
601
  part="content"
602
602
  class=${Ge({semibold:this.semibold,truncate:this.truncate,[this.size]:!0})}
@@ -604,7 +604,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
604
604
  >
605
605
  ${this.content}
606
606
  </div>
607
- `}};ns.styles=[Me.styles??[],ot`
607
+ `}};ns.styles=[Me.styles??[],at`
608
608
  :host {
609
609
  --text-size: var(--fontSizes-medium);
610
610
  --text-line-height: var(--lineHeights-medium);
@@ -641,11 +641,11 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
641
641
  text-overflow: ellipsis;
642
642
  overflow: hidden;
643
643
  }
644
- `],Ir([J({type:Boolean})],ns.prototype,"semibold",2),Ir([J({type:Boolean})],ns.prototype,"truncate",2),Ir([J({type:String})],ns.prototype,"size",2),Ir([J({type:String})],ns.prototype,"content",2),ns=Ir([wt("vmp-text")],ns);var gv=Object.defineProperty,fv=Object.getOwnPropertyDescriptor,mr=(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&&gv(e,t,r),r};let os=class extends Me{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=ft()}_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 Ee`
644
+ `],Ir([J({type:Boolean})],ns.prototype,"semibold",2),Ir([J({type:Boolean})],ns.prototype,"truncate",2),Ir([J({type:String})],ns.prototype,"size",2),Ir([J({type:String})],ns.prototype,"content",2),ns=Ir([wt("vmp-text")],ns);var gv=Object.defineProperty,fv=Object.getOwnPropertyDescriptor,mr=(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&&gv(e,t,r),r};let os=class extends Me{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=ft()}_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 pe`
645
645
  <slot></slot>
646
646
  <div ${pt(this._contentRef)} class="content">
647
647
  <div class="title">
648
- ${this.subItemsActive?Ee`
648
+ ${this.subItemsActive?pe`
649
649
  <button class="back" @click=${this._handleBackClick}>
650
650
  <vmp-icon icon="chevron-down"></vmp-icon>
651
651
  </button>
@@ -657,17 +657,17 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
657
657
  .content=${((s=this.visibleItems)==null?void 0:s.title)??"Sub Menu"}
658
658
  ></vmp-text>
659
659
  </div>
660
- ${zh(((e=this.visibleItems)==null?void 0:e.items)??[],({id:t})=>t,t=>Ee`
660
+ ${zu(((e=this.visibleItems)==null?void 0:e.items)??[],({id:t})=>t,t=>pe`
661
661
  <button
662
662
  class="item"
663
663
  @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}))}}
664
664
  >
665
665
  <vmp-text ?semibold=${!0} size="small" content=${t.label}></vmp-text>
666
- ${t.subItems?Ee`<vmp-icon class="forward" icon="chevron-down"></vmp-icon>`:this.activeItems.includes(t.id)?Ee`<vmp-icon icon="tick"></vmp-icon>`:null}
666
+ ${t.subItems?pe`<vmp-icon class="forward" icon="chevron-down"></vmp-icon>`:this.activeItems.includes(t.id)?pe`<vmp-icon icon="tick"></vmp-icon>`:null}
667
667
  </button>
668
668
  `)}
669
669
  </div>
670
- `}};os.styles=[Me.styles??[],Os(iA),ot`
670
+ `}};os.styles=[Me.styles??[],Os(iA),at`
671
671
  :host {
672
672
  display: flex;
673
673
  }
@@ -729,12 +729,12 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
729
729
  height: 20px;
730
730
  width: 20px;
731
731
  }
732
- `],mr([J({type:Object})],os.prototype,"items",2),mr([J({type:Array})],os.prototype,"activeItems",2),mr([ze()],os.prototype,"visibleItems",2),mr([ze()],os.prototype,"subItemsActive",2),os=mr([wt("vmp-menu")],os);var pv=Object.defineProperty,Ev=Object.getOwnPropertyDescriptor,sA=(s,e,t,i)=>{for(var r=i>1?void 0:i?Ev(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&&pv(e,t,r),r};let Cr=class extends Me{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=ft()}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 Ee`
732
+ `],mr([J({type:Object})],os.prototype,"items",2),mr([J({type:Array})],os.prototype,"activeItems",2),mr([Ze()],os.prototype,"visibleItems",2),mr([Ze()],os.prototype,"subItemsActive",2),os=mr([wt("vmp-menu")],os);var pv=Object.defineProperty,Ev=Object.getOwnPropertyDescriptor,sA=(s,e,t,i)=>{for(var r=i>1?void 0:i?Ev(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&&pv(e,t,r),r};let Cr=class extends Me{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=ft()}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 pe`
733
733
  <slot></slot>
734
734
  <div ${pt(this._contentRef)} class="content">
735
735
  <vmp-text content=${this.content}></vmp-text>
736
736
  </div>
737
- `}};Cr.styles=[Me.styles??[],Os(iA),ot`
737
+ `}};Cr.styles=[Me.styles??[],Os(iA),at`
738
738
  :host {
739
739
  display: flex;
740
740
  }
@@ -748,7 +748,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
748
748
  background: var(--colors-dark-800);
749
749
  border-radius: var(--radii-medium);
750
750
  }
751
- `],sA([J({type:String})],Cr.prototype,"content",2),sA([J({type:Boolean})],Cr.prototype,"disabled",2),Cr=sA([wt("vmp-tooltip")],Cr);var Iv=Object.defineProperty,mv=Object.getOwnPropertyDescriptor,rA=(s,e,t,i)=>{for(var r=i>1?void 0:i?mv(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&&Iv(e,t,r),r};let vr=class extends Me{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=ft(),this._anchorRef=ft(),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 Ee`
751
+ `],sA([J({type:String})],Cr.prototype,"content",2),sA([J({type:Boolean})],Cr.prototype,"disabled",2),Cr=sA([wt("vmp-tooltip")],Cr);var Iv=Object.defineProperty,mv=Object.getOwnPropertyDescriptor,rA=(s,e,t,i)=>{for(var r=i>1?void 0:i?mv(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&&Iv(e,t,r),r};let vr=class extends Me{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=ft(),this._anchorRef=ft(),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 pe`
752
752
  <vmp-icon-button
753
753
  ${pt(this._anchorRef)}
754
754
  icon=${this.muted||this.volume===0?"muted":this.volume<1/3?"volume-low":this.volume<2/3?"volume-medium":"volume-high"}
@@ -768,7 +768,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
768
768
  @blur=${()=>{var s;return(s=this.tippy)==null?void 0:s.hide()}}
769
769
  />
770
770
  </div>
771
- `}};vr.styles=[Me.styles??[],Os(iA),ot`
771
+ `}};vr.styles=[Me.styles??[],Os(iA),at`
772
772
  .content {
773
773
  --volume-slider-height: 4px;
774
774
  --volume-slider-width: 78px;
@@ -910,7 +910,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
910
910
  --volume-slider-height: 8px;
911
911
  color: var(--colors-light-800);
912
912
  }
913
- `],rA([J({type:Number})],vr.prototype,"volume",2),rA([J({type:Boolean})],vr.prototype,"muted",2),vr=rA([wt("vmp-volume-button")],vr);var Cv=Object.defineProperty,vv=Object.getOwnPropertyDescriptor,Yn=(s,e,t,i)=>{for(var r=i>1?void 0:i?vv(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&&Cv(e,t,r),r};let _s=class extends Me{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=ft(),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 Ee`
913
+ `],rA([J({type:Number})],vr.prototype,"volume",2),rA([J({type:Boolean})],vr.prototype,"muted",2),vr=rA([wt("vmp-volume-button")],vr);var Cv=Object.defineProperty,vv=Object.getOwnPropertyDescriptor,Yn=(s,e,t,i)=>{for(var r=i>1?void 0:i?vv(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&&Cv(e,t,r),r};let _s=class extends Me{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=ft(),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 pe`
914
914
  <div
915
915
  class="container"
916
916
  ${pt(this._containerRef)}
@@ -929,11 +929,11 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
929
929
  .value=${this.currentTime.toString()}
930
930
  data-testid="scrubber"
931
931
  />
932
- ${zh(e,({id:t})=>t,t=>Ee`
932
+ ${zu(e,({id:t})=>t,t=>pe`
933
933
  <div class="buffer" style=${`left: ${t.start}%; width: ${t.end-t.start}%`}></div>
934
934
  `)}
935
935
  </div>
936
- `}};_s.styles=[Me.styles??[],ot`
936
+ `}};_s.styles=[Me.styles??[],at`
937
937
  :host {
938
938
  --player-scrubber-height: 8px;
939
939
  --player-scrubber-shadow-width: 4000px;
@@ -1083,14 +1083,14 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1083
1083
  --player-scrubber-height: 16px;
1084
1084
  color: var(--colors-light-800);
1085
1085
  }
1086
- `],Yn([J({type:Number})],_s.prototype,"duration",2),Yn([J({type:Number})],_s.prototype,"currentTime",2),Yn([J({type:Array})],_s.prototype,"buffer",2),_s=Yn([wt("vmp-progress-scrubber")],_s);var yv=Object.defineProperty,Bv=Object.getOwnPropertyDescriptor,it=(s,e,t,i)=>{for(var r=i>1?void 0:i?Bv(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&&yv(e,t,r),r};let qe=class extends Me{constructor(){super(...arguments),this.resizeHider=new hv(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=Za,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,h,u,d,g;const f=((s=this.languages)==null?void 0:s.map(U=>({id:`language-${U.value}`,event:"language:click",label:U.label,value:U.value})))??[],p={title:"Languages",items:f},v={id:"languages",label:"Languages",subItems:p},y=p.items.find(({value:U})=>U===this.language),b=((e=this.levels)==null?void 0:e.map((U,j)=>{const ie=Math.min(U.width,U.height);return{id:`level-${j.toString()}`,event:"level:click",label:`${ie}p`,value:{resolution:ie,level:j}}}))??[],C={title:"Quality",items:[...b.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},Q={id:"levels",label:"Quality",subItems:C},B=(t=C.items)==null?void 0:t.find(({value:U})=>U.level===this.level),L=[(f==null?void 0:f.length)&&"languages","levels","playback-rate","captions","fullscreen"].filter(Boolean).filter(U=>{var j;return(j=this.controls)==null?void 0:j.includes(U)}),_={title:"Settings",items:[(f==null?void 0:f.length)&&v,VC,JC,Q,WC].filter(Boolean).filter(({id:U})=>L.includes(U)&&this.resizeHider.hiddenControls.includes(U))},K=(i=this.controls)==null?void 0:i.includes("progress"),k=(r=this.controls)==null?void 0:r.includes("navigation"),O=(n=this.controls)==null?void 0:n.includes("play"),X=(o=this.controls)==null?void 0:o.includes("volume"),V=(a=this.controls)==null?void 0:a.includes("current-time"),q=(A=this.controls)==null?void 0:A.includes("duration"),S=(l=this.controls)==null?void 0:l.includes("languages"),R=(c=this.controls)==null?void 0:c.includes("levels"),G=(h=this.controls)==null?void 0:h.includes("speed"),x=(u=this.controls)==null?void 0:u.includes("captions"),w=(d=this.controls)==null?void 0:d.includes("fullscreen"),T=O||X||V||q||S||R||G||x||w,$=[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 Ee`
1086
+ `],Yn([J({type:Number})],_s.prototype,"duration",2),Yn([J({type:Number})],_s.prototype,"currentTime",2),Yn([J({type:Array})],_s.prototype,"buffer",2),_s=Yn([wt("vmp-progress-scrubber")],_s);var yv=Object.defineProperty,Bv=Object.getOwnPropertyDescriptor,st=(s,e,t,i)=>{for(var r=i>1?void 0:i?Bv(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&&yv(e,t,r),r};let je=class extends Me{constructor(){super(...arguments),this.resizeHider=new uv(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=Za,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(U=>({id:`language-${U.value}`,event:"language:click",label:U.label,value:U.value})))??[],p={title:"Languages",items:f},v={id:"languages",label:"Languages",subItems:p},y=p.items.find(({value:U})=>U===this.language),b=((e=this.levels)==null?void 0:e.map((U,q)=>{const se=Math.min(U.width,U.height);return{id:`level-${q.toString()}`,event:"level:click",label:`${se}p`,value:{resolution:se,level:q}}}))??[],C={title:"Quality",items:[...b.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},Q={id:"levels",label:"Quality",subItems:C},B=(t=C.items)==null?void 0:t.find(({value:U})=>U.level===this.level),L=[(f==null?void 0:f.length)&&"languages","levels","playback-rate","captions","fullscreen"].filter(Boolean).filter(U=>{var q;return(q=this.controls)==null?void 0:q.includes(U)}),_={title:"Settings",items:[(f==null?void 0:f.length)&&v,VC,JC,Q,WC].filter(Boolean).filter(({id:U})=>L.includes(U)&&this.resizeHider.hiddenControls.includes(U))},$=(i=this.controls)==null?void 0:i.includes("progress"),k=(r=this.controls)==null?void 0:r.includes("navigation"),M=(n=this.controls)==null?void 0:n.includes("play"),X=(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"),R=(l=this.controls)==null?void 0:l.includes("languages"),x=(c=this.controls)==null?void 0:c.includes("levels"),G=(u=this.controls)==null?void 0:u.includes("speed"),S=(h=this.controls)==null?void 0:h.includes("captions"),w=(d=this.controls)==null?void 0:d.includes("fullscreen"),T=M||X||V||z||R||x||G||S||w,Y=[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 pe`
1087
1087
  <div
1088
1088
  ${this.resizeHider.measure()}
1089
1089
  ${this.resizeHider.contain()}
1090
- class=${Ge({container:!0,hidden:!K&&!T})}
1090
+ class=${Ge({container:!0,hidden:!$&&!T})}
1091
1091
  >
1092
1092
  <div
1093
- class=${Ge({"scrubber-container":!0,hidden:!K})}
1093
+ class=${Ge({"scrubber-container":!0,hidden:!$})}
1094
1094
  >
1095
1095
  <vmp-progress-scrubber
1096
1096
  class=${Ge({scrubber:!0,invisible:this.volumeMenuOpen||this.levelsMenuOpen||this.playbackRateMenuOpen||this.settingsMenuOpen})}
@@ -1122,7 +1122,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1122
1122
  ></vmp-icon-button>
1123
1123
  </div>
1124
1124
  <vmp-icon-button
1125
- class=${Ge({hidden:!O})}
1125
+ class=${Ge({hidden:!M})}
1126
1126
  icon=${this.playing?"pause":"play"}
1127
1127
  weight="heavy"
1128
1128
  rounded="full"
@@ -1140,11 +1140,11 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1140
1140
  ${this.resizeHider.hide("current-time",2)}
1141
1141
  class=${Ge({hidden:!V})}
1142
1142
  ?semibold=${!0}
1143
- content="${tA(this.currentTime)}${q?"/":null}"
1143
+ content="${tA(this.currentTime)}${z?"/":null}"
1144
1144
  ></vmp-text>
1145
1145
  <vmp-text
1146
1146
  ${this.resizeHider.hide("duration",6)}
1147
- class=${Ge({hidden:!q})}
1147
+ class=${Ge({hidden:!z})}
1148
1148
  ?semibold=${!0}
1149
1149
  content=${tA(this.duration)}
1150
1150
  ></vmp-text>
@@ -1153,9 +1153,9 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1153
1153
  <div class="section">
1154
1154
  <vmp-menu
1155
1155
  ${this.resizeHider.hide("languages",0)}
1156
- class=${Ge({hidden:!S||!f||f.length<=1})}
1156
+ class=${Ge({hidden:!R||!f||f.length<=1})}
1157
1157
  .items=${p}
1158
- .activeItems=${$}
1158
+ .activeItems=${Y}
1159
1159
  @menu:toggle=${this._handleLanguageMenuOpen}
1160
1160
  >
1161
1161
  <vmp-tooltip content="Languages" ?disabled=${this.languageMenuOpen}>
@@ -1164,9 +1164,9 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1164
1164
  </vmp-menu>
1165
1165
  <vmp-menu
1166
1166
  ${this.resizeHider.hide("levels",1)}
1167
- class=${Ge({hidden:!R||b.length<=0})}
1167
+ class=${Ge({hidden:!x||b.length<=0})}
1168
1168
  .items=${C}
1169
- .activeItems=${$}
1169
+ .activeItems=${Y}
1170
1170
  @menu:toggle=${this._handleLevelsMenuOpen}
1171
1171
  >
1172
1172
  <vmp-tooltip content="Quality" ?disabled=${this.levelsMenuOpen}>
@@ -1176,8 +1176,8 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1176
1176
  <vmp-menu
1177
1177
  ${this.resizeHider.hide("playback-rate",5)}
1178
1178
  class=${Ge({hidden:!G})}
1179
- .items=${Nu}
1180
- .activeItems=${$}
1179
+ .items=${Nh}
1180
+ .activeItems=${Y}
1181
1181
  @menu:toggle=${this._handlePlaybackMenuToggle}
1182
1182
  >
1183
1183
  <vmp-tooltip content="Playback speed" ?disabled=${this.playbackRateMenuOpen}>
@@ -1188,7 +1188,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1188
1188
  </vmp-menu>
1189
1189
  <vmp-tooltip
1190
1190
  ${this.resizeHider.hide("captions",4)}
1191
- class=${Ge({hidden:!x})}
1191
+ class=${Ge({hidden:!S})}
1192
1192
  content="Captions"
1193
1193
  >
1194
1194
  <vmp-icon-button
@@ -1214,7 +1214,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1214
1214
  <vmp-menu
1215
1215
  ${this.resizeHider.show("settings",["levels","playback-rate","captions","fullscreen"])}
1216
1216
  .items=${_}
1217
- .activeItems=${$}
1217
+ .activeItems=${Y}
1218
1218
  @menu:toggle=${this._handleSettingsMenuToggle}
1219
1219
  >
1220
1220
  <vmp-tooltip content="Settings" ?disabled=${this.settingsMenuOpen}>
@@ -1224,7 +1224,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1224
1224
  </div>
1225
1225
  </div>
1226
1226
  </div>
1227
- `}};qe.styles=[Me.styles??[],ot`
1227
+ `}};je.styles=[Me.styles??[],at`
1228
1228
  :host {
1229
1229
  --controls-border-radius: var(--player-border-radius, 0px);
1230
1230
 
@@ -1295,17 +1295,17 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1295
1295
  .hidden {
1296
1296
  display: none;
1297
1297
  }
1298
- `],it([J({type:Boolean})],qe.prototype,"playing",2),it([J({type:Number})],qe.prototype,"volume",2),it([J({type:Boolean})],qe.prototype,"muted",2),it([J({type:Number})],qe.prototype,"currentTime",2),it([J({type:Number})],qe.prototype,"duration",2),it([J({type:Array})],qe.prototype,"languages",2),it([J({type:String})],qe.prototype,"language",2),it([J({type:Array,attribute:!1})],qe.prototype,"levels",2),it([J({type:Number})],qe.prototype,"level",2),it([J({type:Number})],qe.prototype,"playbackRate",2),it([J({type:Array})],qe.prototype,"buffer",2),it([J({type:Boolean})],qe.prototype,"captions",2),it([J({type:Boolean})],qe.prototype,"fullscreen",2),it([J({type:Array})],qe.prototype,"controls",2),it([ze()],qe.prototype,"volumeMenuOpen",2),it([ze()],qe.prototype,"languageMenuOpen",2),it([ze()],qe.prototype,"levelsMenuOpen",2),it([ze()],qe.prototype,"playbackRateMenuOpen",2),it([ze()],qe.prototype,"settingsMenuOpen",2),qe=it([wt("vmp-player-controls")],qe);var Qv=Object.defineProperty,bv=Object.getOwnPropertyDescriptor,Sv=(s,e,t,i)=>{for(var r=i>1?void 0:i?bv(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 nA=class extends Me{render(){return Ee`<vmp-icon icon="loading"></vmp-icon>`}};nA.styles=[Me.styles??[],ot`
1298
+ `],st([J({type:Boolean})],je.prototype,"playing",2),st([J({type:Number})],je.prototype,"volume",2),st([J({type:Boolean})],je.prototype,"muted",2),st([J({type:Number})],je.prototype,"currentTime",2),st([J({type:Number})],je.prototype,"duration",2),st([J({type:Array})],je.prototype,"languages",2),st([J({type:String})],je.prototype,"language",2),st([J({type:Array,attribute:!1})],je.prototype,"levels",2),st([J({type:Number})],je.prototype,"level",2),st([J({type:Number})],je.prototype,"playbackRate",2),st([J({type:Array})],je.prototype,"buffer",2),st([J({type:Boolean})],je.prototype,"captions",2),st([J({type:Boolean})],je.prototype,"fullscreen",2),st([J({type:Array})],je.prototype,"controls",2),st([Ze()],je.prototype,"volumeMenuOpen",2),st([Ze()],je.prototype,"languageMenuOpen",2),st([Ze()],je.prototype,"levelsMenuOpen",2),st([Ze()],je.prototype,"playbackRateMenuOpen",2),st([Ze()],je.prototype,"settingsMenuOpen",2),je=st([wt("vmp-player-controls")],je);var Qv=Object.defineProperty,bv=Object.getOwnPropertyDescriptor,Sv=(s,e,t,i)=>{for(var r=i>1?void 0:i?bv(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 nA=class extends Me{render(){return pe`<vmp-icon icon="loading"></vmp-icon>`}};nA.styles=[Me.styles??[],at`
1299
1299
  :host {
1300
1300
  display: flex;
1301
1301
  align-items: center;
1302
1302
  justify-content: center;
1303
1303
  }
1304
- `],nA=Sv([wt("vmp-loading-spinner")],nA);var wv=Object.defineProperty,Rv=Object.getOwnPropertyDescriptor,Hu=(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 Kn=class extends Me{constructor(){super(...arguments),this.caption=""}render(){return Ee`
1304
+ `],nA=Sv([wt("vmp-loading-spinner")],nA);var wv=Object.defineProperty,Rv=Object.getOwnPropertyDescriptor,Hh=(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 Kn=class extends Me{constructor(){super(...arguments),this.caption=""}render(){return pe`
1305
1305
  <div class="container">
1306
1306
  <vmp-text content=${this.caption} size="large"></vmp-text>
1307
1307
  </div>
1308
- `}};Kn.styles=[Me.styles??[],ot`
1308
+ `}};Kn.styles=[Me.styles??[],at`
1309
1309
  .container {
1310
1310
  display: block;
1311
1311
  margin: 0 var(--space-small);
@@ -1324,7 +1324,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1324
1324
  /* Line height controls the spacing between the cloned boxes so has to override the default */
1325
1325
  line-height: 2.2;
1326
1326
  }
1327
- `],Hu([J({type:String})],Kn.prototype,"caption",2),Kn=Hu([wt("vmp-captions")],Kn);var xv=Object.defineProperty,Tv=Object.getOwnPropertyDescriptor,ht=(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};const Dv=3e3;let st=class extends Me{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=Za,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=ft()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},Dv)}_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 Ee`
1327
+ `],Hh([J({type:String})],Kn.prototype,"caption",2),Kn=Hh([wt("vmp-captions")],Kn);var xv=Object.defineProperty,Tv=Object.getOwnPropertyDescriptor,ht=(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};const Dv=3e3;let rt=class extends Me{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=Za,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=ft()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},Dv)}_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 pe`
1328
1328
  <div
1329
1329
  class=${Ge({container:!0,hide:t})}
1330
1330
  @mousemove=${()=>{this._immediateShowControls(),this._startHideControls()}}
@@ -1349,7 +1349,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1349
1349
  @mousemove=${r=>{r.stopPropagation(),this._immediateShowControls()}}
1350
1350
  @click=${this._immediateShowControls}
1351
1351
  >
1352
- ${this.captions?Ee`<vmp-captions
1352
+ ${this.captions?pe`<vmp-captions
1353
1353
  class=${Ge({hidden:!this.caption,hiddenControls:t})}
1354
1354
  caption=${this.caption}
1355
1355
  ></vmp-captions>`:null}
@@ -1372,7 +1372,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1372
1372
  ></vmp-player-controls>
1373
1373
  </div>
1374
1374
  </div>
1375
- `}};st.styles=[Me.styles??[],ot`
1375
+ `}};rt.styles=[Me.styles??[],at`
1376
1376
  :host {
1377
1377
  --overlay-border-radius: var(--player-border-radius, 0px);
1378
1378
  }
@@ -1444,20 +1444,20 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1444
1444
  vmp-captions.hiddenControls {
1445
1445
  transform: translateY(calc(var(--space-small) * -1));
1446
1446
  }
1447
- `],ht([J({type:Boolean})],st.prototype,"loading",2),ht([J({type:Boolean})],st.prototype,"playing",2),ht([J({type:Number})],st.prototype,"volume",2),ht([J({type:Boolean})],st.prototype,"muted",2),ht([J({type:Number})],st.prototype,"currentTime",2),ht([J({type:Number})],st.prototype,"duration",2),ht([J({type:Array})],st.prototype,"languages",2),ht([J({type:String})],st.prototype,"language",2),ht([J({type:Array,attribute:!1})],st.prototype,"levels",2),ht([J({type:Number})],st.prototype,"level",2),ht([J({type:Number})],st.prototype,"playbackRate",2),ht([J({type:String})],st.prototype,"caption",2),ht([J({type:Array})],st.prototype,"buffer",2),ht([J({type:Boolean})],st.prototype,"captions",2),ht([J({type:Boolean})],st.prototype,"fullscreen",2),ht([J({type:Array})],st.prototype,"controls",2),ht([ze()],st.prototype,"showControls",2),st=ht([wt("vmp-player-overlay")],st);var Lv=Object.defineProperty,_v=Object.getOwnPropertyDescriptor,$e=(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};const kv=1e3/60,Fv=.5;let Pe=class extends Me{constructor(){super(...arguments),this.burnCaptions=!1,this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.compilation=So,this.dataResolver=Fo,this.languageResolver=Df,this._sceneController=new $C(this),this._drawController=new MC(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=ft(),this._canvasRef=ft(),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,kv):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,Fv);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 hi(`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?KC():this._playerRef.value&&YC(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"?Ee`
1447
+ `],ht([J({type:Boolean})],rt.prototype,"loading",2),ht([J({type:Boolean})],rt.prototype,"playing",2),ht([J({type:Number})],rt.prototype,"volume",2),ht([J({type:Boolean})],rt.prototype,"muted",2),ht([J({type:Number})],rt.prototype,"currentTime",2),ht([J({type:Number})],rt.prototype,"duration",2),ht([J({type:Array})],rt.prototype,"languages",2),ht([J({type:String})],rt.prototype,"language",2),ht([J({type:Array,attribute:!1})],rt.prototype,"levels",2),ht([J({type:Number})],rt.prototype,"level",2),ht([J({type:Number})],rt.prototype,"playbackRate",2),ht([J({type:String})],rt.prototype,"caption",2),ht([J({type:Array})],rt.prototype,"buffer",2),ht([J({type:Boolean})],rt.prototype,"captions",2),ht([J({type:Boolean})],rt.prototype,"fullscreen",2),ht([J({type:Array})],rt.prototype,"controls",2),ht([Ze()],rt.prototype,"showControls",2),rt=ht([wt("vmp-player-overlay")],rt);var Lv=Object.defineProperty,_v=Object.getOwnPropertyDescriptor,$e=(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};const kv=1e3/60;let Ue=class extends Me{constructor(){super(...arguments),this.burnCaptions=!1,this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.compilation=So,this.dataResolver=Fo,this.languageResolver=Df,this._sceneController=new $C(this),this._drawController=new MC(this),this._observer=null,this._wasPlaying=!1,this._manualMute=this.muted,this._seekerRAF=null,this._seekerTimeout=null,this._lastWaiting=!1,this._lastTimestamp=null,this._lastCurrentTime=null,this._playerRef=ft(),this._canvasRef=ft(),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,kv):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;const t=(s-(this._lastTimestamp??s))/1e3*this.playbackRate;if(this.sceneConfig&&this.activeScenes[0]&&this.activeScenes[0].video){const i=this.activeScenes[0].video;this._lastCurrentTime!==i.node.currentTime&&(e+=t),this._lastCurrentTime=i.node.currentTime}else e+=t;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._lastCurrentTime=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._lastCurrentTime=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 ui(`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?KC():this._playerRef.value&&YC(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"?pe`
1448
1448
  <style>
1449
1449
  :host {
1450
1450
  aspect-ratio: ${this.propAspectRatio};
1451
1451
  }
1452
1452
  </style>
1453
- `:null:Ee`
1453
+ `:null:pe`
1454
1454
  <style>
1455
1455
  :host {
1456
1456
  width: 100%;
1457
1457
  height: 100%;
1458
1458
  }
1459
1459
  </style>
1460
- `}_renderError(){return Ee`<div class="error">
1460
+ `}_renderError(){return pe`<div class="error">
1461
1461
  <div class="error-icon">
1462
1462
  <vmp-icon icon="error"></vmp-icon>
1463
1463
  </div>
@@ -1465,14 +1465,14 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1465
1465
  <vmp-text semibold content="An error has occurred when attempting to play this video."></vmp-text>
1466
1466
  <vmp-text semibold content="Please try again later."></vmp-text>
1467
1467
  </div>
1468
- </div>`}render(){var s,e,t,i,r,n;const o=this.loading||this.processing||!this.scenes||this.duration<=0,{height:a,width:A}=wo({resolution:((s=this.sceneConfig)==null?void 0:s.resolution)??1080,aspectRatio:this.aspectRatio}),l=Object.keys(this.sceneVideoState).reduce((y,b)=>y.concat(this.sceneVideoState[b].buffered??[]),[]),c=o?[]:(e=this.controls??Za)==null?void 0:e.filter(y=>!(y==="fullscreen"&&PC()||y==="navigation"&&(!this.scenes||this.scenes.length<=1))),h=!(c!=null&&c.includes("preview")),u=(((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 Ee`
1468
+ </div>`}render(){var s,e,t,i,r,n;const o=this.loading||this.processing||!this.scenes||this.duration<=0,{height:a,width:A}=wo({resolution:((s=this.sceneConfig)==null?void 0:s.resolution)??1080,aspectRatio:this.aspectRatio}),l=Object.keys(this.sceneVideoState).reduce((y,b)=>y.concat(this.sceneVideoState[b].buffered??[]),[]),c=o?[]:(e=this.controls??Za)==null?void 0:e.filter(y=>!(y==="fullscreen"&&PC()||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 pe`
1469
1469
  ${this._renderStyles()}
1470
1470
  <div
1471
1471
  ${pt(this._playerRef)}
1472
1472
  class=${Ge({player:!0,responsive:!this.propAspectRatio})}
1473
1473
  style=${sr({aspectRatio:this.aspectRatio})}
1474
1474
  >
1475
- ${!f&&(p||v)?this._renderError():Ee`<canvas
1475
+ ${!f&&(p||v)?this._renderError():pe`<canvas
1476
1476
  ${pt(this._canvasRef)}
1477
1477
  ${this._drawController.canvas()}
1478
1478
  ${eA(this._handleCanvasResize)}
@@ -1492,15 +1492,15 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1492
1492
  .languages=${this.languages}
1493
1493
  .language=${this.language}
1494
1494
  .levels=${(g==null?void 0:g.levels)??[]}
1495
- level=${Ze(g!=null&&g.autoLevelEnabled?-1:g==null?void 0:g.currentLevel)}
1495
+ level=${et(g!=null&&g.autoLevelEnabled?-1:g==null?void 0:g.currentLevel)}
1496
1496
  playbackRate=${this.playbackRate}
1497
1497
  caption=${this._drawController.caption}
1498
1498
  .buffer=${l}
1499
1499
  .controls=${c}
1500
1500
  ?captions=${this.captions}
1501
1501
  ?fullscreen=${this.fullscreen}
1502
- @navigate:back=${y=>{y.defaultPrevented||this.setScene(d<=0?u:d-1)}}
1503
- @navigate:forward=${y=>{y.defaultPrevented||this.setScene(d>=u?0:d+1)}}
1502
+ @navigate:back=${y=>{y.defaultPrevented||this.setScene(d<=0?h:d-1)}}
1503
+ @navigate:forward=${y=>{y.defaultPrevented||this.setScene(d>=h?0:d+1)}}
1504
1504
  @play:click=${({detail:y})=>{o||(y?this.pause():(this.muted=this._manualMute,this.play()))}}
1505
1505
  @volume:click=${({detail:y})=>{this.muted=!y,this._manualMute=!y}}
1506
1506
  @language:click=${({detail:y})=>{this._language=y.value}}
@@ -1513,7 +1513,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1513
1513
  @pointerup=${y=>{y.composedPath()[0].getAttribute("key")==="scrubber"&&(this._seeking=!1,this._wasPlaying&&(this.play(),this._wasPlaying=!1))}}
1514
1514
  ></vmp-player-overlay>
1515
1515
  <vmp-video-preview
1516
- ?disabled=${h}
1516
+ ?disabled=${u}
1517
1517
  .src=${this.src}
1518
1518
  .data=${this.data}
1519
1519
  .template=${this.template}
@@ -1525,7 +1525,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1525
1525
  .dataResolver=${this.dataResolver}
1526
1526
  ></vmp-video-preview>`}
1527
1527
  </div>
1528
- `}};Pe.styles=[Me.styles??[],ot`
1528
+ `}};Ue.styles=[Me.styles??[],at`
1529
1529
  :host {
1530
1530
  --player-border-radius: var(--vouch-media-player-border-radius, 0px);
1531
1531
 
@@ -1586,20 +1586,20 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1586
1586
  top: 0;
1587
1587
  left: 0;
1588
1588
  }
1589
- `],$e([J({type:Object})],Pe.prototype,"data",2),$e([J({type:Object})],Pe.prototype,"template",2),$e([J({type:Boolean})],Pe.prototype,"burnCaptions",2),$e([J({type:Boolean})],Pe.prototype,"debug",2),$e([J({type:String})],Pe.prototype,"src",2),$e([J({type:String})],Pe.prototype,"track",2),$e([J({type:String,attribute:"language"})],Pe.prototype,"propLanguage",2),$e([J({type:Number,attribute:"aspectratio"})],Pe.prototype,"propAspectRatio",2),$e([J({type:String})],Pe.prototype,"preload",2),$e([J({type:Boolean})],Pe.prototype,"autoplay",2),$e([J({type:Boolean})],Pe.prototype,"loading",2),$e([J({type:Array})],Pe.prototype,"controls",2),$e([J({attribute:!1})],Pe.prototype,"compilation",2),$e([J({attribute:!1})],Pe.prototype,"dataResolver",2),$e([J({attribute:!1})],Pe.prototype,"languageResolver",2),$e([ze()],Pe.prototype,"_pageHidden",2),$e([ze()],Pe.prototype,"_aspectRatio",2),$e([ze()],Pe.prototype,"_processing",2),$e([ze()],Pe.prototype,"_waiting",2),$e([ze()],Pe.prototype,"_errors",2),$e([ze()],Pe.prototype,"_seeking",2),$e([ze()],Pe.prototype,"_language",2),$e([ze()],Pe.prototype,"_languages",2),$e([ze()],Pe.prototype,"_captions",2),$e([ze()],Pe.prototype,"_fullscreen",2),Pe=$e([wt("vmp-media-player")],Pe);var Nv=Object.defineProperty,Mv=Object.getOwnPropertyDescriptor,vt=(s,e,t,i)=>{for(var r=i>1?void 0:i?Mv(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&&Nv(e,t,r),r};let ut=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 Fd(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 Vd(this),this._trackingController=new yf(this),this._mediaPlayerRef=ft()}get fetching(){return this._fetcherController.fetching}get waiting(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.waiting}get initialised(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.initialised}get seeking(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.seeking}get paused(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.paused}get captions(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.captions}get fullscreen(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.fullscreen}get duration(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.duration}set currentTime(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=s)}get currentTime(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.currentTime)??0}set playbackRate(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=s)}get playbackRate(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.playbackRate)??1}set volume(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=s)}get volume(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.volume)??1}set muted(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=s)}get muted(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.muted)??!1}get scene(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.scene)??null}get scenes(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.scenes)??[]}get sceneConfig(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.sceneConfig)??null}get videoState(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var s;(s=this._mediaPlayerRef.value)==null||s.play()}pause(){var s;(s=this._mediaPlayerRef.value)==null||s.pause()}reset(s=0,e=!1){var t;(t=this._mediaPlayerRef.value)==null||t.reset(s,e)}setScene(s){var e;(e=this._mediaPlayerRef.value)==null||e.setScene(s)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?Ee`
1589
+ `],$e([J({type:Object})],Ue.prototype,"data",2),$e([J({type:Object})],Ue.prototype,"template",2),$e([J({type:Boolean})],Ue.prototype,"burnCaptions",2),$e([J({type:Boolean})],Ue.prototype,"debug",2),$e([J({type:String})],Ue.prototype,"src",2),$e([J({type:String})],Ue.prototype,"track",2),$e([J({type:String,attribute:"language"})],Ue.prototype,"propLanguage",2),$e([J({type:Number,attribute:"aspectratio"})],Ue.prototype,"propAspectRatio",2),$e([J({type:String})],Ue.prototype,"preload",2),$e([J({type:Boolean})],Ue.prototype,"autoplay",2),$e([J({type:Boolean})],Ue.prototype,"loading",2),$e([J({type:Array})],Ue.prototype,"controls",2),$e([J({attribute:!1})],Ue.prototype,"compilation",2),$e([J({attribute:!1})],Ue.prototype,"dataResolver",2),$e([J({attribute:!1})],Ue.prototype,"languageResolver",2),$e([Ze()],Ue.prototype,"_pageHidden",2),$e([Ze()],Ue.prototype,"_aspectRatio",2),$e([Ze()],Ue.prototype,"_processing",2),$e([Ze()],Ue.prototype,"_waiting",2),$e([Ze()],Ue.prototype,"_errors",2),$e([Ze()],Ue.prototype,"_seeking",2),$e([Ze()],Ue.prototype,"_language",2),$e([Ze()],Ue.prototype,"_languages",2),$e([Ze()],Ue.prototype,"_captions",2),$e([Ze()],Ue.prototype,"_fullscreen",2),Ue=$e([wt("vmp-media-player")],Ue);var Fv=Object.defineProperty,Nv=Object.getOwnPropertyDescriptor,vt=(s,e,t,i)=>{for(var r=i>1?void 0:i?Nv(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&&Fv(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="auto",this.autoplay=!1,this.aspectRatio=0,this.eventController=new Fd(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 Vd(this),this._trackingController=new yf(this),this._mediaPlayerRef=ft()}get fetching(){return this._fetcherController.fetching}get waiting(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.waiting}get initialised(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.initialised}get seeking(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.seeking}get paused(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.paused}get captions(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.captions}get fullscreen(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.fullscreen}get duration(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.duration}set currentTime(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=s)}get currentTime(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.currentTime)??0}set playbackRate(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=s)}get playbackRate(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.playbackRate)??1}set volume(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=s)}get volume(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.volume)??1}set muted(s){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=s)}get muted(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.muted)??!1}get scene(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.scene)??null}get scenes(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.scenes)??[]}get sceneConfig(){var s;return((s=this._mediaPlayerRef.value)==null?void 0:s.sceneConfig)??null}get videoState(){var s;return(s=this._mediaPlayerRef.value)==null?void 0:s.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var s;(s=this._mediaPlayerRef.value)==null||s.play()}pause(){var s;(s=this._mediaPlayerRef.value)==null||s.pause()}reset(s=0,e=!1){var t;(t=this._mediaPlayerRef.value)==null||t.reset(s,e)}setScene(s){var e;(e=this._mediaPlayerRef.value)==null||e.setScene(s)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?pe`
1590
1590
  <style>
1591
1591
  :host {
1592
1592
  aspect-ratio: ${this.aspectRatio};
1593
1593
  }
1594
1594
  </style>
1595
- `:null:Ee`
1595
+ `:null:pe`
1596
1596
  <style>
1597
1597
  :host {
1598
1598
  width: 100%;
1599
1599
  height: 100%;
1600
1600
  }
1601
1601
  </style>
1602
- `}willUpdate(s){s.has("vouchId")&&this.vouchId!==s.get("vouchId")&&this.reset(0,!1)}render(){return Ee`
1602
+ `}willUpdate(s){s.has("vouchId")&&this.vouchId!==s.get("vouchId")&&this.reset(0,!1)}render(){return pe`
1603
1603
  ${this._renderStyles()}
1604
1604
  <vmp-media-player
1605
1605
  ${pt(this._mediaPlayerRef)}
@@ -1608,21 +1608,21 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1608
1608
  ?loading=${this.fetching}
1609
1609
  .data=${this.vouch}
1610
1610
  .template=${this.template}
1611
- aspectRatio=${Ze(this.aspectRatio)}
1612
- preload=${Ze(this.preload)}
1613
- language=${Ze(this.language)}
1611
+ aspectRatio=${et(this.aspectRatio)}
1612
+ preload=${et(this.preload)}
1613
+ language=${et(this.language)}
1614
1614
  .controls=${this.controls}
1615
1615
  ></vmp-media-player>
1616
- `}};ut.styles=[ot`
1616
+ `}};dt.styles=[at`
1617
1617
  :host {
1618
1618
  display: flex;
1619
1619
  }
1620
- `],vt([J({type:Object})],ut.prototype,"data",2),vt([J({type:String})],ut.prototype,"vouchId",2),vt([J({type:String})],ut.prototype,"templateId",2),vt([J({type:Array})],ut.prototype,"questions",2),vt([J({type:String})],ut.prototype,"env",2),vt([J({type:String})],ut.prototype,"apiKey",2),vt([J({type:Boolean})],ut.prototype,"disableTracking",2),vt([J({type:String})],ut.prototype,"trackingSource",2),vt([J({type:Array})],ut.prototype,"controls",2),vt([J({type:String})],ut.prototype,"preload",2),vt([J({type:Boolean})],ut.prototype,"autoplay",2),vt([J({type:Number})],ut.prototype,"aspectRatio",2),vt([J({type:String})],ut.prototype,"language",2),vt([ze()],ut.prototype,"vouch",2),vt([ze()],ut.prototype,"template",2),ut=vt([xr("vouch-embed-player")],ut);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 $u(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 Ov(s){return s.hasAttribute("disabled")||s.hasAttribute("aria-disabled")&&s.getAttribute("aria-disabled")!=="false"}function Pv(s){return s.getAttribute("tabindex")==="-1"||$u(s)||Ov(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 oA=new Map;function Uv(s,e,t){const i=oA.get(t);i!=null&&window.clearTimeout(i),oA.set(t,window.setTimeout(()=>{s(),oA.delete(t)},e))}const Yu=document.createElement("template");Yu.innerHTML=`
1620
+ `],vt([J({type:Object})],dt.prototype,"data",2),vt([J({type:String})],dt.prototype,"vouchId",2),vt([J({type:String})],dt.prototype,"templateId",2),vt([J({type:Array})],dt.prototype,"questions",2),vt([J({type:String})],dt.prototype,"env",2),vt([J({type:String})],dt.prototype,"apiKey",2),vt([J({type:Boolean})],dt.prototype,"disableTracking",2),vt([J({type:String})],dt.prototype,"trackingSource",2),vt([J({type:Array})],dt.prototype,"controls",2),vt([J({type:String})],dt.prototype,"preload",2),vt([J({type:Boolean})],dt.prototype,"autoplay",2),vt([J({type:Number})],dt.prototype,"aspectRatio",2),vt([J({type:String})],dt.prototype,"language",2),vt([Ze()],dt.prototype,"vouch",2),vt([Ze()],dt.prototype,"template",2),dt=vt([xr("vouch-embed-player")],dt);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 $h(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 Mv(s){return s.hasAttribute("disabled")||s.hasAttribute("aria-disabled")&&s.getAttribute("aria-disabled")!=="false"}function Ov(s){return s.getAttribute("tabindex")==="-1"||$h(s)||Mv(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 oA=new Map;function Pv(s,e,t){const i=oA.get(t);i!=null&&window.clearTimeout(i),oA.set(t,window.setTimeout(()=>{s(),oA.delete(t)},e))}const Yh=document.createElement("template");Yh.innerHTML=`
1621
1621
  <div id="start"></div>
1622
1622
  <div id="backup"></div>
1623
1623
  <slot></slot>
1624
1624
  <div id="end"></div>
1625
- `;class Gv extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Yu.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,$u,Pv)}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){Uv(()=>{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",Gv);var Hv=Object.defineProperty,$v=Object.getOwnPropertyDescriptor,aA=(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&&Hv(e,t,r),r};let yr=class extends mi{constructor(){super(...arguments),this.open=!1,this.aspectRatio=0}render(){return Ee`
1625
+ `;class Uv extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const e=this.attachShadow({mode:"open"});e.appendChild(Yh.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,$h,Ov)}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){Pv(()=>{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",Uv);var Gv=Object.defineProperty,Hv=Object.getOwnPropertyDescriptor,aA=(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};let yr=class extends mi{constructor(){super(...arguments),this.open=!1,this.aspectRatio=0}render(){return pe`
1626
1626
  <div
1627
1627
  class=${Ge({container:!0,hidden:!this.open})}
1628
1628
  >
@@ -1645,7 +1645,7 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1645
1645
  </div>
1646
1646
  </focus-trap>
1647
1647
  </div>
1648
- `}};yr.styles=[ot`
1648
+ `}};yr.styles=[at`
1649
1649
  :host {
1650
1650
  --vouch-media-player-border-radius: var(--vu-media-player-border-radius, 12px);
1651
1651
  --overlay-background-color: var(--vu-overlay-background-color, black);
@@ -1709,43 +1709,43 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1709
1709
  right: 0;
1710
1710
  margin: 10px;
1711
1711
  }
1712
- `],aA([J({type:Boolean})],yr.prototype,"open",2),aA([J({type:Number})],yr.prototype,"aspectRatio",2),yr=aA([xr("vouch-embed-dialog-overlay")],yr);var Yv=Object.defineProperty,Kv=Object.getOwnPropertyDescriptor,kt=(s,e,t,i)=>{for(var r=i>1?void 0:i?Kv(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&&Yv(e,t,r),r};let Lt=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=ft(),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 Ee`
1712
+ `],aA([J({type:Boolean})],yr.prototype,"open",2),aA([J({type:Number})],yr.prototype,"aspectRatio",2),yr=aA([xr("vouch-embed-dialog-overlay")],yr);var $v=Object.defineProperty,Yv=Object.getOwnPropertyDescriptor,kt=(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&&$v(e,t,r),r};let Lt=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=ft(),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 pe`
1713
1713
  <vouch-embed-dialog-overlay ?open=${this.open} aspectRatio=${this.aspectRatio}>
1714
1714
  <vouch-embed-player
1715
1715
  ${pt(this._mediaPlayerRef)}
1716
1716
  style=${sr({maxWidth:"100%",maxHeight:"100%"})}
1717
1717
  ?autoplay=${!1}
1718
- vouchId=${Ze(this.vouchId)}
1719
- templateId=${Ze(this.templateId)}
1718
+ vouchId=${et(this.vouchId)}
1719
+ templateId=${et(this.templateId)}
1720
1720
  .questions=${this.questions}
1721
1721
  .controls=${this.controls}
1722
- env=${Ze(this.env)}
1723
- apiKey=${Ze(this.apiKey)}
1722
+ env=${et(this.env)}
1723
+ apiKey=${et(this.apiKey)}
1724
1724
  ?disableTracking=${this.disableTracking}
1725
- trackingSource=${Ze(this.trackingSource)}
1726
- preload=${Ze(this.preload)}
1725
+ trackingSource=${et(this.trackingSource)}
1726
+ preload=${et(this.preload)}
1727
1727
  aspectRatio=${this.aspectRatio}
1728
1728
  ></vouch-embed-player>
1729
1729
  </vouch-embed-dialog-overlay>
1730
- `}};kt([J({type:String})],Lt.prototype,"vouchId",2),kt([J({type:String})],Lt.prototype,"templateId",2),kt([J({type:Array})],Lt.prototype,"questions",2),kt([J({type:String})],Lt.prototype,"env",2),kt([J({type:String})],Lt.prototype,"apiKey",2),kt([J({type:Boolean})],Lt.prototype,"disableTracking",2),kt([J({type:String})],Lt.prototype,"trackingSource",2),kt([J({type:Array})],Lt.prototype,"controls",2),kt([J({type:String})],Lt.prototype,"preload",2),kt([J({type:Boolean})],Lt.prototype,"disableAutoplay",2),kt([J({type:Number})],Lt.prototype,"aspectRatio",2),kt([ze()],Lt.prototype,"open",2),Lt=kt([xr("vouch-embed-dialog-portal")],Lt);var Vv=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&&Vv(e,t,r),r};Je.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 Ee`
1730
+ `}};kt([J({type:String})],Lt.prototype,"vouchId",2),kt([J({type:String})],Lt.prototype,"templateId",2),kt([J({type:Array})],Lt.prototype,"questions",2),kt([J({type:String})],Lt.prototype,"env",2),kt([J({type:String})],Lt.prototype,"apiKey",2),kt([J({type:Boolean})],Lt.prototype,"disableTracking",2),kt([J({type:String})],Lt.prototype,"trackingSource",2),kt([J({type:Array})],Lt.prototype,"controls",2),kt([J({type:String})],Lt.prototype,"preload",2),kt([J({type:Boolean})],Lt.prototype,"disableAutoplay",2),kt([J({type:Number})],Lt.prototype,"aspectRatio",2),kt([Ze()],Lt.prototype,"open",2),Lt=kt([xr("vouch-embed-dialog-portal")],Lt);var Kv=Object.defineProperty,Vv=Object.getOwnPropertyDescriptor,$t=(s,e,t,i)=>{for(var r=i>1?void 0:i?Vv(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};We.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 pe`
1731
1731
  <slot>
1732
1732
  <vmp-button size="large">Play</vmp-button>
1733
1733
  </slot>
1734
1734
  <vouch-embed-dialog-portal
1735
1735
  id=${this._id}
1736
1736
  ?autoplay=${!1}
1737
- vouchId=${Ze(this.vouchId)}
1738
- templateId=${Ze(this.templateId)}
1737
+ vouchId=${et(this.vouchId)}
1738
+ templateId=${et(this.templateId)}
1739
1739
  .questions=${this.questions}
1740
1740
  .controls=${this.controls}
1741
- env=${Ze(this.env)}
1742
- apiKey=${Ze(this.apiKey)}
1741
+ env=${et(this.env)}
1742
+ apiKey=${et(this.apiKey)}
1743
1743
  ?disableTracking=${this.disableTracking}
1744
- trackingSource=${Ze(this.trackingSource)}
1745
- preload=${Ze(this.preload)}
1744
+ trackingSource=${et(this.trackingSource)}
1745
+ preload=${et(this.preload)}
1746
1746
  aspectRatio=${this.aspectRatio}
1747
1747
  ></vouch-embed-dialog-portal>
1748
- `}},Je.DialogEmbed.styles=[ot`
1748
+ `}},We.DialogEmbed.styles=[at`
1749
1749
  :host {
1750
1750
  --vu-button-padding: 10px 20px;
1751
1751
  --vu-button-background: #287179;
@@ -1755,5 +1755,5 @@ ${e}`,Gg=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Hg=Objec
1755
1755
  width: fit-content;
1756
1756
  height: fit-content;
1757
1757
  }
1758
- `],$t([J({type:String})],Je.DialogEmbed.prototype,"vouchId",2),$t([J({type:String})],Je.DialogEmbed.prototype,"templateId",2),$t([J({type:Array})],Je.DialogEmbed.prototype,"questions",2),$t([J({type:String})],Je.DialogEmbed.prototype,"env",2),$t([J({type:String})],Je.DialogEmbed.prototype,"apiKey",2),$t([J({type:Boolean})],Je.DialogEmbed.prototype,"disableTracking",2),$t([J({type:String})],Je.DialogEmbed.prototype,"trackingSource",2),$t([J({type:Array})],Je.DialogEmbed.prototype,"controls",2),$t([J({type:String})],Je.DialogEmbed.prototype,"preload",2),$t([J({type:Boolean})],Je.DialogEmbed.prototype,"disableAutoplay",2),$t([J({type:Number})],Je.DialogEmbed.prototype,"aspectRatio",2),Je.DialogEmbed=$t([xr("vouch-embed-dialog")],Je.DialogEmbed);function di(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 Wv(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 ks={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=Ku(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=Ku(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?".":ks.normalize(e)},relative:function(e,t){if(di(e),di(t),e===t||(e=ks.resolve(e),t=ks.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(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 Wv("/",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,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};ks.posix=ks;var qv=ks;const{basename:Vu,extname:jv}=qv;class Xv{constructor(){let e=typeof Pr>"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 zv(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 Xv,d=d||"canvas",g=f||t.replace(/@\d+x$/i,"")||jv(e),f=c(h(g)||g),p=h(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 ${u})`);if(!v)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let y,b,C=e.replace(/{(\d*)}/g,(B,L)=>(b=!0,L=parseInt(L,10),y=isFinite(L)?L:isFinite(y)?y:-1,"{}")),Q=r>0?r-1:r<0?v+r:void 0;if(isFinite(Q)&&Q<0||Q>=v)throw new RangeError(v==1?`Canvas only has a ‘page 1’ (${Q} is out of bounds)`:`Canvas has pages 1–${v} (${Q} is out of bounds)`);if(s=isFinite(Q)?[s[Q]]:b||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 B=(t||Vu(e,g)).match(/@(\d+)x$/i);a=B?parseInt(B[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:C,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 AA(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=AA(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 h=AA(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=AA(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 lA=Wn;const cA=(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))},Zv=(...s)=>cA(...s).then(e=>e.arrayBuffer()),ey=async(s,e,t,i,r)=>{Ju(r,await cA(s,e,t,i))},ty=async(s,e,t,i,r,n,o)=>{let a=c=>n.replace("{}",String(c+1).padStart(o,"0")),A=Vu(r,".zip")||"archive",l=new lA(A);await Promise.all(s.map(async(c,h)=>{let u=a(h);await l.add(u,await cA(c,e,t,i))})),Ju(`${A}.zip`,l.blob)},Ju=(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 iy={asBuffer:Zv,asDownload:ey,asZipDownload:ty,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:zv};const{asBuffer:hA,asDownload:sy,asZipDownload:ry,atScale:uA,options:dA}=iy,Wu=Symbol.for("toDataURL"),ny=s=>{let e=Object.assign(new qu,{crossOrigin:"Anonymous",src:s});return e.decode().then(()=>e)};class oy{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=dA(this.pages,{filename:a,...A}),{pattern:c,padding:h,mime:u,quality:d,matte:g,density:f,archive:p}=l,v=uA(l.pages,f);return h==null?sy(v[0],u,d,g,a):ry(v,u,d,g,p,c,h)},toBuffer(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=dA(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=uA(d,g,u)[0];return hA(f,c,h,u)},[Wu]:i.toDataURL.bind(i),toDataURL(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=dA(this.pages,{extension:a,...A}),{mime:c,quality:h,matte:u,pages:d,density:g}=l,f=uA(d,g,u)[0],p=f[f===i?Wu:"toDataURL"](c,h);return Promise.resolve(p)}})}}const{CanvasRenderingContext2D:ay,CanvasGradient:Ay,CanvasPattern:ly,Image:qu,ImageData:cy,Path2D:hy,DOMMatrix:uy,DOMRect:dy,DOMPoint:gy}=window;var ju={Canvas:oy,loadImage:ny,CanvasRenderingContext2D:ay,CanvasGradient:Ay,CanvasPattern:ly,Image:qu,ImageData:cy,Path2D:hy,DOMMatrix:uy,DOMRect:dy,DOMPoint:gy};const Xu=Ei({__proto__:null,default:pl(ju)},[ju]);return Object.defineProperty(Je,Symbol.toStringTag,{value:"Module"}),Je}({});
1758
+ `],$t([J({type:String})],We.DialogEmbed.prototype,"vouchId",2),$t([J({type:String})],We.DialogEmbed.prototype,"templateId",2),$t([J({type:Array})],We.DialogEmbed.prototype,"questions",2),$t([J({type:String})],We.DialogEmbed.prototype,"env",2),$t([J({type:String})],We.DialogEmbed.prototype,"apiKey",2),$t([J({type:Boolean})],We.DialogEmbed.prototype,"disableTracking",2),$t([J({type:String})],We.DialogEmbed.prototype,"trackingSource",2),$t([J({type:Array})],We.DialogEmbed.prototype,"controls",2),$t([J({type:String})],We.DialogEmbed.prototype,"preload",2),$t([J({type:Boolean})],We.DialogEmbed.prototype,"disableAutoplay",2),$t([J({type:Number})],We.DialogEmbed.prototype,"aspectRatio",2),We.DialogEmbed=$t([xr("vouch-embed-dialog")],We.DialogEmbed);function di(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function Kh(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 Jv(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 ks={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=Kh(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=Kh(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?".":ks.normalize(e)},relative:function(e,t){if(di(e),di(t),e===t||(e=ks.resolve(e),t=ks.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 Jv("/",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};ks.posix=ks;var Wv=ks;const{basename:Vh,extname:qv}=Wv;class jv{constructor(){let e=typeof Pr>"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 Xv(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 jv,d=d||"canvas",g=f||t.replace(/@\d+x$/i,"")||qv(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,b,C=e.replace(/{(\d*)}/g,(B,L)=>(b=!0,L=parseInt(L,10),y=isFinite(L)?L:isFinite(y)?y:-1,"{}")),Q=r>0?r-1:r<0?v+r:void 0;if(isFinite(Q)&&Q<0||Q>=v)throw new RangeError(v==1?`Canvas only has a ‘page 1’ (${Q} is out of bounds)`:`Canvas has pages 1–${v} (${Q} is out of bounds)`);if(s=isFinite(Q)?[s[Q]]:b||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 B=(t||Vh(e,g)).match(/@(\d+)x$/i);a=B?parseInt(B[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:C,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 AA(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=AA(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=AA(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=AA(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 lA=Wn;const cA=(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))},zv=(...s)=>cA(...s).then(e=>e.arrayBuffer()),Zv=async(s,e,t,i,r)=>{Jh(r,await cA(s,e,t,i))},ey=async(s,e,t,i,r,n,o)=>{let a=c=>n.replace("{}",String(c+1).padStart(o,"0")),A=Vh(r,".zip")||"archive",l=new lA(A);await Promise.all(s.map(async(c,u)=>{let h=a(u);await l.add(h,await cA(c,e,t,i))})),Jh(`${A}.zip`,l.blob)},Jh=(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 ty={asBuffer:zv,asDownload:Zv,asZipDownload:ey,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:Xv};const{asBuffer:uA,asDownload:iy,asZipDownload:sy,atScale:hA,options:dA}=ty,Wh=Symbol.for("toDataURL"),ry=s=>{let e=Object.assign(new qh,{crossOrigin:"Anonymous",src:s});return e.decode().then(()=>e)};class ny{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:()=>uA(i,"image/png"),jpg:()=>uA(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=dA(this.pages,{filename:a,...A}),{pattern:c,padding:u,mime:h,quality:d,matte:g,density:f,archive:p}=l,v=hA(l.pages,f);return u==null?iy(v[0],h,d,g,a):sy(v,h,d,g,p,c,u)},toBuffer(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=dA(this.pages,{extension:a,...A}),{mime:c,quality:u,matte:h,pages:d,density:g}=l,f=hA(d,g,h)[0];return uA(f,c,u,h)},[Wh]:i.toDataURL.bind(i),toDataURL(a="png",A={}){A=typeof A=="number"?{quality:A}:A;let l=dA(this.pages,{extension:a,...A}),{mime:c,quality:u,matte:h,pages:d,density:g}=l,f=hA(d,g,h)[0],p=f[f===i?Wh:"toDataURL"](c,u);return Promise.resolve(p)}})}}const{CanvasRenderingContext2D:oy,CanvasGradient:ay,CanvasPattern:Ay,Image:qh,ImageData:ly,Path2D:cy,DOMMatrix:uy,DOMRect:hy,DOMPoint:dy}=window;var jh={Canvas:ny,loadImage:ry,CanvasRenderingContext2D:oy,CanvasGradient:ay,CanvasPattern:Ay,Image:qh,ImageData:ly,Path2D:cy,DOMMatrix:uy,DOMRect:hy,DOMPoint:dy};const Xh=Ei({__proto__:null,default:pl(jh)},[jh]);return Object.defineProperty(We,Symbol.toStringTag,{value:"Module"}),We}({});
1759
1759
  //# sourceMappingURL=embed.iife.js.map