@vouchfor/embeds 0.0.0-experiment.22bdbfc → 0.0.0-experiment.24d239c

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ var dialogEmbed=function(mt){"use strict";/**
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
13
  */const Kn=globalThis,ki=Kn.trustedTypes,Dl=ki?ki.createPolicy("lit-html",{createHTML:r=>r}):void 0,ao="$lit$",vr=`lit$${(Math.random()+"").slice(9)}$`,lo="?"+vr,Yd=`<${lo}>`,$r=document,Jn=()=>$r.createComment(""),Wn=r=>r===null||typeof r!="object"&&typeof r!="function",_l=Array.isArray,Ll=r=>_l(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",Ao=`[
14
14
  \f\r]`,qn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fl=/-->/g,kl=/>/g,Yr=RegExp(`>|${Ao}(?:([^\\s"'>=/]+)(${Ao}*=${Ao}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Nl=/'/g,Ml=/"/g,Pl=/^(?:script|style|textarea|title)$/i,Vd=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Ce=Vd(1),Xt=Symbol.for("lit-noChange"),et=Symbol.for("lit-nothing"),Ol=new WeakMap,Vr=$r.createTreeWalker($r,129);function Ul(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Dl!==void 0?Dl.createHTML(e):e}const Gl=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":"",o=qn;for(let a=0;a<t;a++){const l=r[a];let A,c,u=-1,h=0;for(;h<l.length&&(o.lastIndex=h,c=o.exec(l),c!==null);)h=o.lastIndex,o===qn?c[1]==="!--"?o=Fl:c[1]!==void 0?o=kl:c[2]!==void 0?(Pl.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=Yr):c[3]!==void 0&&(o=Yr):o===Yr?c[0]===">"?(o=i??qn,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,A=c[1],o=c[3]===void 0?Yr:c[3]==='"'?Ml:Nl):o===Ml||o===Nl?o=Yr:o===Fl||o===kl?o=qn:(o=Yr,i=void 0);const d=o===Yr&&r[a+1].startsWith("/>")?" ":"";s+=o===qn?l+Yd:u>=0?(n.push(A),l.slice(0,u)+ao+l.slice(u)+vr+d):l+vr+(u===-2?a:d)}return[Ul(r,s+(r[t]||"<?>")+(e===2?"</svg>":"")),n]};class Xn{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,o=0;const a=e.length-1,l=this.parts,[A,c]=Gl(e,t);if(this.el=Xn.createElement(A,n),Vr.currentNode=this.el.content,t===2){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Vr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(ao)){const h=c[o++],d=i.getAttribute(u).split(vr),f=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:f[2],strings:d,ctor:f[1]==="."?$l:f[1]==="?"?Yl:f[1]==="@"?Vl:jn}),i.removeAttribute(u)}else u.startsWith(vr)&&(l.push({type:6,index:s}),i.removeAttribute(u));if(Pl.test(i.tagName)){const u=i.textContent.split(vr),h=u.length-1;if(h>0){i.textContent=ki?ki.emptyScript:"";for(let d=0;d<h;d++)i.append(u[d],Jn()),Vr.nextNode(),l.push({type:2,index:++s});i.append(u[h],Jn())}}}else if(i.nodeType===8)if(i.data===lo)l.push({type:2,index:s});else{let u=-1;for(;(u=i.data.indexOf(vr,u+1))!==-1;)l.push({type:7,index:s}),u+=vr.length-1}s++}}static createElement(e,t){const n=$r.createElement("template");return n.innerHTML=e,n}}function Kr(r,e,t=r,n){var o,a;if(e===Xt)return e;let i=n!==void 0?(o=t._$Co)==null?void 0:o[n]:t._$Cl;const s=Wn(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=i:t._$Cl=i),i!==void 0&&(e=Kr(r,i._$AS(r,e.values),i,n)),e}class Hl{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:n}=this._$AD,i=((e==null?void 0:e.creationScope)??$r).importNode(t,!0);Vr.currentNode=i;let s=Vr.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let A;l.type===2?A=new fn(s,s.nextSibling,this,e):l.type===1?A=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(A=new Kl(s,this,e)),this._$AV.push(A),l=n[++a]}o!==(l==null?void 0:l.index)&&(s=Vr.nextNode(),o++)}return Vr.currentNode=$r,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class fn{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=et,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=(i==null?void 0:i.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=Kr(this,e,t),Wn(e)?e===et||e==null||e===""?(this._$AH!==et&&this._$AR(),this._$AH=et):e!==this._$AH&&e!==Xt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ll(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!==et&&Wn(this._$AH)?this._$AA.nextSibling.data=e:this.T($r.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Xn.createElement(Ul(n.h,n.h[0]),this.options)),n);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const o=new Hl(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Ol.get(e.strings);return t===void 0&&Ol.set(e.strings,t=new Xn(e)),t}k(e){_l(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new fn(this.S(Jn()),this.S(Jn()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class jn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=et,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=et}_$AI(e,t=this,n,i){const s=this.strings;let o=!1;if(s===void 0)e=Kr(this,e,t,0),o=!Wn(e)||e!==this._$AH&&e!==Xt,o&&(this._$AH=e);else{const a=e;let l,A;for(e=s[0],l=0;l<s.length-1;l++)A=Kr(this,a[n+l],t,l),A===Xt&&(A=this._$AH[l]),o||(o=!Wn(A)||A!==this._$AH[l]),A===et?e=et:e!==et&&(e+=(A??"")+s[l+1]),this._$AH[l]=A}o&&!i&&this.j(e)}j(e){e===et?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class $l extends jn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===et?void 0:e}}class Yl extends jn{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==et)}}class Vl extends jn{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Kr(this,e,t,0)??et)===Xt)return;const n=this._$AH,i=e===et&&n!==et||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==et&&(n===et||i);i&&this.element.removeEventListener(this.name,this,n),s&&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 Kl{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Kr(this,e)}}const Kd={P:ao,A:vr,C:lo,M:1,L:Gl,R:Hl,D:Ll,V:Kr,I:fn,H:jn,N:Yl,U:Vl,B:$l,F:Kl},co=Kn.litHtmlPolyfillSupport;co==null||co(Xn,fn),(Kn.litHtmlVersions??(Kn.litHtmlVersions=[])).push("3.1.2");const Jd=(r,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let i=n._$litPart$;if(i===void 0){const s=(t==null?void 0:t.renderBefore)??null;n._$litPart$=i=new fn(e.insertBefore(Jn(),s),s,void 0,t??{})}return i._$AI(r),i};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Nl=/'/g,Ml=/"/g,Pl=/^(?:script|style|textarea|title)$/i,Vd=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Ce=Vd(1),Xt=Symbol.for("lit-noChange"),tt=Symbol.for("lit-nothing"),Ol=new WeakMap,Vr=$r.createTreeWalker($r,129);function Ul(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Dl!==void 0?Dl.createHTML(e):e}const Gl=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":"",o=qn;for(let a=0;a<t;a++){const l=r[a];let A,c,u=-1,h=0;for(;h<l.length&&(o.lastIndex=h,c=o.exec(l),c!==null);)h=o.lastIndex,o===qn?c[1]==="!--"?o=Fl:c[1]!==void 0?o=kl:c[2]!==void 0?(Pl.test(c[2])&&(i=RegExp("</"+c[2],"g")),o=Yr):c[3]!==void 0&&(o=Yr):o===Yr?c[0]===">"?(o=i??qn,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,A=c[1],o=c[3]===void 0?Yr:c[3]==='"'?Ml:Nl):o===Ml||o===Nl?o=Yr:o===Fl||o===kl?o=qn:(o=Yr,i=void 0);const d=o===Yr&&r[a+1].startsWith("/>")?" ":"";s+=o===qn?l+Yd:u>=0?(n.push(A),l.slice(0,u)+ao+l.slice(u)+vr+d):l+vr+(u===-2?a:d)}return[Ul(r,s+(r[t]||"<?>")+(e===2?"</svg>":"")),n]};class Xn{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,o=0;const a=e.length-1,l=this.parts,[A,c]=Gl(e,t);if(this.el=Xn.createElement(A,n),Vr.currentNode=this.el.content,t===2){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Vr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(ao)){const h=c[o++],d=i.getAttribute(u).split(vr),f=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:f[2],strings:d,ctor:f[1]==="."?$l:f[1]==="?"?Yl:f[1]==="@"?Vl:jn}),i.removeAttribute(u)}else u.startsWith(vr)&&(l.push({type:6,index:s}),i.removeAttribute(u));if(Pl.test(i.tagName)){const u=i.textContent.split(vr),h=u.length-1;if(h>0){i.textContent=ki?ki.emptyScript:"";for(let d=0;d<h;d++)i.append(u[d],Jn()),Vr.nextNode(),l.push({type:2,index:++s});i.append(u[h],Jn())}}}else if(i.nodeType===8)if(i.data===lo)l.push({type:2,index:s});else{let u=-1;for(;(u=i.data.indexOf(vr,u+1))!==-1;)l.push({type:7,index:s}),u+=vr.length-1}s++}}static createElement(e,t){const n=$r.createElement("template");return n.innerHTML=e,n}}function Kr(r,e,t=r,n){var o,a;if(e===Xt)return e;let i=n!==void 0?(o=t._$Co)==null?void 0:o[n]:t._$Cl;const s=Wn(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=i:t._$Cl=i),i!==void 0&&(e=Kr(r,i._$AS(r,e.values),i,n)),e}class Hl{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:n}=this._$AD,i=((e==null?void 0:e.creationScope)??$r).importNode(t,!0);Vr.currentNode=i;let s=Vr.nextNode(),o=0,a=0,l=n[0];for(;l!==void 0;){if(o===l.index){let A;l.type===2?A=new fn(s,s.nextSibling,this,e):l.type===1?A=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(A=new Kl(s,this,e)),this._$AV.push(A),l=n[++a]}o!==(l==null?void 0:l.index)&&(s=Vr.nextNode(),o++)}return Vr.currentNode=$r,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class fn{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=tt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=(i==null?void 0:i.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=Kr(this,e,t),Wn(e)?e===tt||e==null||e===""?(this._$AH!==tt&&this._$AR(),this._$AH=tt):e!==this._$AH&&e!==Xt&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Ll(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!==tt&&Wn(this._$AH)?this._$AA.nextSibling.data=e:this.T($r.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Xn.createElement(Ul(n.h,n.h[0]),this.options)),n);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const o=new Hl(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Ol.get(e.strings);return t===void 0&&Ol.set(e.strings,t=new Xn(e)),t}k(e){_l(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new fn(this.S(Jn()),this.S(Jn()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class jn{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=tt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=tt}_$AI(e,t=this,n,i){const s=this.strings;let o=!1;if(s===void 0)e=Kr(this,e,t,0),o=!Wn(e)||e!==this._$AH&&e!==Xt,o&&(this._$AH=e);else{const a=e;let l,A;for(e=s[0],l=0;l<s.length-1;l++)A=Kr(this,a[n+l],t,l),A===Xt&&(A=this._$AH[l]),o||(o=!Wn(A)||A!==this._$AH[l]),A===tt?e=tt:e!==tt&&(e+=(A??"")+s[l+1]),this._$AH[l]=A}o&&!i&&this.j(e)}j(e){e===tt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class $l extends jn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===tt?void 0:e}}class Yl extends jn{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==tt)}}class Vl extends jn{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Kr(this,e,t,0)??tt)===Xt)return;const n=this._$AH,i=e===tt&&n!==tt||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==tt&&(n===tt||i);i&&this.element.removeEventListener(this.name,this,n),s&&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 Kl{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Kr(this,e)}}const Kd={P:ao,A:vr,C:lo,M:1,L:Gl,R:Hl,D:Ll,V:Kr,I:fn,H:jn,N:Yl,U:Vl,B:$l,F:Kl},co=Kn.litHtmlPolyfillSupport;co==null||co(Xn,fn),(Kn.litHtmlVersions??(Kn.litHtmlVersions=[])).push("3.1.2");const Jd=(r,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let i=n._$litPart$;if(i===void 0){const s=(t==null?void 0:t.renderBefore)??null;n._$litPart$=i=new fn(e.insertBefore(Jn(),s),s,void 0,t??{})}return i._$AI(r),i};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
@@ -24,15 +24,15 @@ var dialogEmbed=function(mt){"use strict";/**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
- */const Wd={attribute:!0,type:String,converter:Li,reflect:!1,hasChanged:Fi},qd=(r=Wd,e,t)=>{const{kind:n,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(t.name,r),n==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,r)},init(a){return a!==void 0&&this.P(o,void 0,r),a}}}if(n==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,r)}}throw Error("Unsupported decorator location: "+n)};function te(r){return(e,t)=>typeof t=="object"?qd(r,e,t):((n,i,s)=>{const o=i.hasOwnProperty(s);return i.constructor.createProperty(s,o?{...n,wrapped:!0}:n),o?Object.getOwnPropertyDescriptor(i,s):void 0})(r,e,t)}/**
27
+ */const Wd={attribute:!0,type:String,converter:Li,reflect:!1,hasChanged:Fi},qd=(r=Wd,e,t)=>{const{kind:n,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(t.name,r),n==="accessor"){const{name:o}=t;return{set(a){const l=e.get.call(this);e.set.call(this,a),this.requestUpdate(o,l,r)},init(a){return a!==void 0&&this.P(o,void 0,r),a}}}if(n==="setter"){const{name:o}=t;return function(a){const l=this[o];e.call(this,a),this.requestUpdate(o,l,r)}}throw Error("Unsupported decorator location: "+n)};function ee(r){return(e,t)=>typeof t=="object"?qd(r,e,t):((n,i,s)=>{const o=i.hasOwnProperty(s);return i.constructor.createProperty(s,o?{...n,wrapped:!0}:n),o?Object.getOwnPropertyDescriptor(i,s):void 0})(r,e,t)}/**
28
28
  * @license
29
29
  * Copyright 2017 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */function tt(r){return te({...r,state:!0,attribute:!1})}/**
31
+ */function rt(r){return ee({...r,state:!0,attribute:!1})}/**
32
32
  * @license
33
33
  * Copyright 2018 Google LLC
34
34
  * SPDX-License-Identifier: BSD-3-Clause
35
- */const At=r=>r??et;let Mi;const Xd=new Uint8Array(16);function jd(){if(!Mi&&(Mi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Mi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mi(Xd)}const Et=[];for(let r=0;r<256;++r)Et.push((r+256).toString(16).slice(1));function zd(r,e=0){return Et[r[e+0]]+Et[r[e+1]]+Et[r[e+2]]+Et[r[e+3]]+"-"+Et[r[e+4]]+Et[r[e+5]]+"-"+Et[r[e+6]]+Et[r[e+7]]+"-"+Et[r[e+8]]+Et[r[e+9]]+"-"+Et[r[e+10]]+Et[r[e+11]]+Et[r[e+12]]+Et[r[e+13]]+Et[r[e+14]]+Et[r[e+15]]}const Jl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Fr(r,e,t){if(Jl.randomUUID&&!e&&!r)return Jl.randomUUID();r=r||{};const n=r.random||(r.rng||jd)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return zd(n)}/**
35
+ */const At=r=>r??tt;let Mi;const Xd=new Uint8Array(16);function jd(){if(!Mi&&(Mi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Mi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mi(Xd)}const Et=[];for(let r=0;r<256;++r)Et.push((r+256).toString(16).slice(1));function zd(r,e=0){return Et[r[e+0]]+Et[r[e+1]]+Et[r[e+2]]+Et[r[e+3]]+"-"+Et[r[e+4]]+Et[r[e+5]]+"-"+Et[r[e+6]]+Et[r[e+7]]+"-"+Et[r[e+8]]+Et[r[e+9]]+"-"+Et[r[e+10]]+Et[r[e+11]]+Et[r[e+12]]+Et[r[e+13]]+Et[r[e+14]]+Et[r[e+15]]}const Jl={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Fr(r,e,t){if(Jl.randomUUID&&!e&&!r)return Jl.randomUUID();r=r||{};const n=r.random||(r.rng||jd)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return zd(n)}/**
36
36
  * @license
37
37
  * Copyright 2020 Google LLC
38
38
  * SPDX-License-Identifier: BSD-3-Clause
@@ -48,34 +48,34 @@ var dialogEmbed=function(mt){"use strict";/**
48
48
  * @license
49
49
  * Copyright 2020 Google LLC
50
50
  * SPDX-License-Identifier: BSD-3-Clause
51
- */const It=()=>new lf;let lf=class{};const fo=new WeakMap,vt=pn(class extends Xl{render(r){return et}update(r,[e]){var n;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=(n=r.options)==null?void 0:n.host,this.rt(this.ct=r.element)),et}rt(r){if(typeof this.Y=="function"){const e=this.ht??globalThis;let t=fo.get(e);t===void 0&&(t=new WeakMap,fo.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,r),r!==void 0&&this.Y.call(this.ht,r)}else this.Y.value=r}get lt(){var r,e;return typeof this.Y=="function"?(r=fo.get(this.ht??globalThis))==null?void 0:r.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 Af(r,e,t){function n(i){t.dispatchEvent(new CustomEvent(i.type,i))}return e.addEventListener(r,n),()=>{e.removeEventListener(r,n)}}class cf{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=It(),this.host=e,this._events=t,e.addController(this)}register(){return vt(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(Af(e,this._forwardElementRef.value,this.host))})})}hostDisconnected(){this._cleanup.forEach(e=>{e()}),this._cleanup=[]}}/**
51
+ */const It=()=>new lf;let lf=class{};const fo=new WeakMap,vt=pn(class extends Xl{render(r){return tt}update(r,[e]){var n;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=(n=r.options)==null?void 0:n.host,this.rt(this.ct=r.element)),tt}rt(r){if(typeof this.Y=="function"){const e=this.ht??globalThis;let t=fo.get(e);t===void 0&&(t=new WeakMap,fo.set(e,t)),t.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),t.set(this.Y,r),r!==void 0&&this.Y.call(this.ht,r)}else this.Y.value=r}get lt(){var r,e;return typeof this.Y=="function"?(r=fo.get(this.ht??globalThis))==null?void 0:r.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 Af(r,e,t){function n(i){t.dispatchEvent(new CustomEvent(i.type,i))}return e.addEventListener(r,n),()=>{e.removeEventListener(r,n)}}class cf{constructor(e,t){this._events=[],this._cleanup=[],this._forwardElementRef=It(),this.host=e,this._events=t,e.addController(this)}register(){return vt(this._forwardElementRef)}hostConnected(){requestAnimationFrame(()=>{this._events.forEach(e=>{this._forwardElementRef.value&&this._cleanup.push(Af(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
55
  */const uf=Symbol();class Oi{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,n){var s;this.u=0,this.status=0,(this.p=e).addController(this);const i=typeof t=="object"?t:{task:t,args:n};this._=i.task,this.v=i.args,this.j=i.argsEqual??hf,this.m=i.onComplete,this.g=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.l=i.initialValue,this.status=2,this.k=(s=this.A)==null?void 0:s.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,l,A,c;let t,n;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 i=++this.u;this.T=new AbortController;let s=!1;try{t=await this._(e,{signal:this.T.signal})}catch(u){s=!0,n=u}if(this.u===i){if(t===uf)this.status=0;else{if(s===!1){try{(a=this.m)==null||a.call(this,t)}catch{}this.status=2,(l=this.i)==null||l.call(this,t)}else{try{(A=this.g)==null||A.call(this,n)}catch{}this.status=3,(c=this.o)==null||c.call(this,n)}this.l=t,this.h=n}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,n,i,s;switch(this.status){case 0:return(t=e.initial)==null?void 0:t.call(e);case 1:return(n=e.pending)==null?void 0:n.call(e);case 2:return(i=e.complete)==null?void 0:i.call(e,this.value);case 3:return(s=e.error)==null?void 0:s.call(e,this.error);default:throw Error("Unexpected status: "+this.status)}}}const hf=(r,e)=>r===e||r.length===e.length&&r.every((t,n)=>!Fi(t,e[n])),jl="https://d2rxhdlm2q91uk.cloudfront.net",df="https://d1ix11aj5kfygl.cloudfront.net",ff="https://d157jlwnudd93d.cloudfront.net",zl="https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev",gf="https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging",pf="https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod",mf="http://localhost:6060/v2",Ef="https://embed-dev.vouchfor.com/v2",If="https://embed-staging.vouchfor.com/v2",vf="https://embed.vouchfor.com/v2";function Ui(r){if(!["local","dev","staging","prod"].includes(r))throw new Error(`Unknown environment: ${r}`);if(r==="local")return{videoUrl:jl,publicApiUrl:zl,embedApiUrl:mf};if(r==="dev")return{videoUrl:jl,publicApiUrl:zl,embedApiUrl:Ef};if(r==="staging")return{videoUrl:df,publicApiUrl:gf,embedApiUrl:If};if(r==="prod")return{videoUrl:ff,publicApiUrl:pf,embedApiUrl:vf}}class Cf{constructor(e){this._fetching=!1,this.getVouch=async(t,n,i)=>{var c;const{embedApiUrl:s}=Ui(t),o=Fr(),a=await fetch(`${s}/vouches/${i}`,{method:"GET",headers:[["X-Api-Key",n],["X-Cache-Check",o]]}),l=await a.json();return this.host.dispatchEvent(new CustomEvent("vouch:loaded",{detail:l==null?void 0:l.id})),((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${s}/vouches/${i}`,{method:"GET",headers:[["X-Api-Key",n],["Cache-Control","max-age=0"]]}),l},this.getTemplate=async(t,n,i)=>{var c;const{embedApiUrl:s}=Ui(t),o=Fr(),a=await fetch(`${s}/templates/${i}`,{method:"GET",headers:[["X-Api-Key",n],["X-Cache-Check",o]]}),l=await a.json();return((c=a==null?void 0:a.headers)==null?void 0:c.get("X-Cache-Check"))!==o&&fetch(`${s}/templates/${i}`,{method:"GET",headers:[["X-Api-Key",n],["Cache-Control","max-age=0"]]}),l},this.host=e,new Oi(this.host,async([t,n,i,s,o])=>{var a,l,A,c;try{if(e.vouch=void 0,e.template=void 0,i){let u;o&&(this.fetching=!0,u=await this.getTemplate(t,n,o)),this._vouch=i,e.template=u??((l=(a=i==null?void 0:i.settings)==null?void 0:a.template)==null?void 0:l.instance)}else if(s){this.fetching=!0;const[u,h]=await Promise.all([this.getVouch(t,n,s),o?this.getTemplate(t,n,o):null]);this._vouch=u,e.template=h??((c=(A=u==null?void 0:u.settings)==null?void 0:A.template)==null?void 0:c.instance)}}finally{this.fetching=!1}},()=>[e.env,e.apiKey,e.data,e.vouchId,e.templateId]),new Oi(this.host,([t,n])=>{e.vouch=t?{...t,questions:{items:t==null?void 0:t.questions.items.filter((i,s)=>!(n!=null&&n.length)||(n==null?void 0:n.includes(s+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 yf=(r,e,t,n)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const i=Object.getOwnPropertyDescriptor(r,t),s=Object.getOwnPropertyDescriptor(e,t);!Bf(i,s)&&n||Object.defineProperty(r,t,s)},Bf=function(r,e){return r===void 0||r.configurable||r.writable===e.writable&&r.enumerable===e.enumerable&&r.configurable===e.configurable&&(r.writable||r.value===e.value)},Tf=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},Qf=(r,e)=>`/* Wrapped ${r}*/
56
- ${e}`,bf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xf=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),wf=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=Qf.bind(null,n,e.toString());Object.defineProperty(i,"name",xf);const{writable:s,enumerable:o,configurable:a}=bf;Object.defineProperty(r,"toString",{value:i,writable:s,enumerable:o,configurable:a})};function Sf(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))yf(r,e,i,t);return Tf(r,e),wf(r,e,n),r}const Rf=new WeakMap,Zl=new WeakMap;function go(r,{cacheKey:e,cache:t=new Map,maxAge:n}={}){if(n===0)return r;if(typeof n=="number"){if(n>2147483647)throw new TypeError("The `maxAge` option cannot exceed 2147483647.");if(n<0)throw new TypeError("The `maxAge` option should not be a negative number.")}const i=function(...s){var A;const o=e?e(s):s[0],a=t.get(o);if(a)return a.data;const l=r.apply(this,s);if(t.set(o,{data:l,maxAge:n?Date.now()+n:Number.POSITIVE_INFINITY}),typeof n=="number"&&n!==Number.POSITIVE_INFINITY){const c=setTimeout(()=>{t.delete(o)},n);(A=c.unref)==null||A.call(c);const u=Zl.get(r)??new Set;u.add(c),Zl.set(r,u)}return l};return Sf(i,r,{ignoreNonConfigurable:!0}),Rf.set(i,t),i}var mn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function po(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var mo={exports:{}};(function(r,e){(function(t,n){n(e)})(mn,function(t){function n(D){var S,F,W=new Error(D);return S=W,F=n.prototype,Object.setPrototypeOf?Object.setPrototypeOf(S,F):S.__proto__=F,W}function i(D,S,F){var W=S.slice(0,F).split(/\n/),Y=W.length,ne=W[Y-1].length+1;throw n(D+=" at line "+Y+" col "+ne+`:
56
+ ${e}`,bf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),xf=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),wf=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=Qf.bind(null,n,e.toString());Object.defineProperty(i,"name",xf);const{writable:s,enumerable:o,configurable:a}=bf;Object.defineProperty(r,"toString",{value:i,writable:s,enumerable:o,configurable:a})};function Sf(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))yf(r,e,i,t);return Tf(r,e),wf(r,e,n),r}const Rf=new WeakMap,Zl=new WeakMap;function go(r,{cacheKey:e,cache:t=new Map,maxAge:n}={}){if(n===0)return r;if(typeof n=="number"){if(n>2147483647)throw new TypeError("The `maxAge` option cannot exceed 2147483647.");if(n<0)throw new TypeError("The `maxAge` option should not be a negative number.")}const i=function(...s){var A;const o=e?e(s):s[0],a=t.get(o);if(a)return a.data;const l=r.apply(this,s);if(t.set(o,{data:l,maxAge:n?Date.now()+n:Number.POSITIVE_INFINITY}),typeof n=="number"&&n!==Number.POSITIVE_INFINITY){const c=setTimeout(()=>{t.delete(o)},n);(A=c.unref)==null||A.call(c);const u=Zl.get(r)??new Set;u.add(c),Zl.set(r,u)}return l};return Sf(i,r,{ignoreNonConfigurable:!0}),Rf.set(i,t),i}var mn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function po(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var mo={exports:{}};(function(r,e){(function(t,n){n(e)})(mn,function(t){function n(_){var S,F,J=new Error(_);return S=J,F=n.prototype,Object.setPrototypeOf?Object.setPrototypeOf(S,F):S.__proto__=F,J}function i(_,S,F){var J=S.slice(0,F).split(/\n/),Y=J.length,ne=J[Y-1].length+1;throw n(_+=" at line "+Y+" col "+ne+`:
57
57
 
58
58
  `+S.split(/\n/)[Y-1]+`
59
- `+Array(ne).join(" ")+"^")}n.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var s=new Function("return this")().Promise,o=!1;try{o=new Function("return (async function(){}).constructor")()}catch(D){if(!(D instanceof SyntaxError))throw D}function a(D,S){return Object.prototype.hasOwnProperty.call(D,S)}function l(D,S,F){for(var W in S)a(S,W)&&(S[W]==null||typeof S[W]!="object"||W!=="storage"&&W!=="prefixes"||F?D[W]=S[W]:D[W]=l({},S[W]));return D}var A=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,u=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,h=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function f(D){return d.test(D)?D.replace(d,"\\$&"):D}function g(D,S){S.rmWhitespace&&(D=D.replace(/[\r\n]+/g,`
60
- `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,u.lastIndex=0,h.lastIndex=0;var F=S.prefixes,W=[F.h,F.b,F.i,F.r,F.c,F.e].reduce(function(fe,Qe){return fe&&Qe?fe+"|"+f(Qe):Qe?f(Qe):fe},""),Y=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+f(S.tags[1])+")","g"),ne=new RegExp("([^]*?)"+f(S.tags[0])+"(-|_)?\\s*("+W+")?\\s*","g"),ce=0,pe=!1;function ge(fe,Qe){var Me,we={f:[]},We=0,Te="c";function T(be){var De=D.slice(ce,be),ke=De.trim();if(Te==="f")ke==="safe"?we.raw=!0:S.async&&A.test(ke)?(ke=ke.replace(A,""),we.f.push([ke,"",!0])):we.f.push([ke,""]);else if(Te==="fp")we.f[we.f.length-1][1]+=ke;else if(Te==="err"){if(ke){var _e=De.search(/\S/);i("invalid syntax",D,ce+_e)}}else we[Te]=ke;ce=be+1}for(Qe==="h"||Qe==="b"||Qe==="c"?Te="n":Qe==="r"&&(we.raw=!0,Qe="i"),Y.lastIndex=ce;(Me=Y.exec(D))!==null;){var m=Me[1],E=Me[2],x=Me[3],M=Me[4],z=Me[5],j=Me.index;if(m)m==="("?(We===0&&(Te==="n"?(T(j),Te="p"):Te==="f"&&(T(j),Te="fp")),We++):m===")"?--We===0&&Te!=="c"&&(T(j),Te="err"):We===0&&m==="|"?(T(j),Te="f"):m==="=>"&&(T(j),ce+=1,Te="res");else if(E)if(E==="/*"){var Ie=D.indexOf("*/",Y.lastIndex);Ie===-1&&i("unclosed comment",D,Me.index),Y.lastIndex=Ie+2}else E==="'"?(u.lastIndex=Me.index,u.exec(D)?Y.lastIndex=u.lastIndex:i("unclosed string",D,Me.index)):E==='"'?(h.lastIndex=Me.index,h.exec(D)?Y.lastIndex=h.lastIndex:i("unclosed string",D,Me.index)):E==="`"&&(c.lastIndex=Me.index,c.exec(D)?Y.lastIndex=c.lastIndex:i("unclosed string",D,Me.index));else if(x)return T(j),ce=j+Me[0].length,ne.lastIndex=ce,pe=z,M&&Qe==="h"&&(Qe="s"),we.t=Qe,we}return i("unclosed tag",D,fe),we}var Se=function fe(Qe,Me){Qe.b=[],Qe.d=[];var we,We=!1,Te=[];function T(_e,Mt){_e&&(_e=function(ut,Ut,Er,Ir){var Tt,q;return typeof Ut.autoTrim=="string"?Tt=q=Ut.autoTrim:Array.isArray(Ut.autoTrim)&&(Tt=Ut.autoTrim[1],q=Ut.autoTrim[0]),(Er||Er===!1)&&(Tt=Er),(Ir||Ir===!1)&&(q=Ir),Tt==="slurp"&&q==="slurp"?ut.trim():(Tt==="_"||Tt==="slurp"?ut=String.prototype.trimLeft?ut.trimLeft():ut.replace(/^[\s\uFEFF\xA0]+/,""):Tt!=="-"&&Tt!=="nl"||(ut=ut.replace(/^(?:\n|\r|\r\n)/,"")),q==="_"||q==="slurp"?ut=String.prototype.trimRight?ut.trimRight():ut.replace(/[\s\uFEFF\xA0]+$/,""):q!=="-"&&q!=="nl"||(ut=ut.replace(/(?:\n|\r|\r\n)$/,"")),ut)}(_e,S,pe,Mt))&&(_e=_e.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),Te.push(_e))}for(;(we=ne.exec(D))!==null;){var m,E=we[1],x=we[2],M=we[3]||"";for(var z in F)if(F[z]===M){m=z;break}T(E,x),ce=we.index+we[0].length,m||i("unrecognized tag type: "+M,D,ce);var j=ge(we.index,m),Ie=j.t;if(Ie==="h"){var be=j.n||"";S.async&&A.test(be)&&(j.a=!0,j.n=be.replace(A,"")),j=fe(j),Te.push(j)}else if(Ie==="c"){if(Qe.n===j.n)return We?(We.d=Te,Qe.b.push(We)):Qe.d=Te,Qe;i("Helper start and end don't match",D,we.index+we[0].length)}else if(Ie==="b"){We?(We.d=Te,Qe.b.push(We)):Qe.d=Te;var De=j.n||"";S.async&&A.test(De)&&(j.a=!0,j.n=De.replace(A,"")),We=j,Te=[]}else if(Ie==="s"){var ke=j.n||"";S.async&&A.test(ke)&&(j.a=!0,j.n=ke.replace(A,"")),Te.push(j)}else Te.push(j)}if(!Me)throw n('unclosed helper "'+Qe.n+'"');return T(D.slice(ce,D.length),!1),Qe.d=Te,Qe}({f:[]},!0);if(S.plugins)for(var Le=0;Le<S.plugins.length;Le++){var Ge=S.plugins[Le];Ge.processAST&&(Se.d=Ge.processAST(Se.d,S))}return Se.d}function p(D,S){var F=g(D,S),W="var tR='';"+(S.useWith?"with("+S.varName+"||{}){":"")+w(F,S)+"if(cb){cb(null,tR)} return tR"+(S.useWith?"}":"");if(S.plugins)for(var Y=0;Y<S.plugins.length;Y++){var ne=S.plugins[Y];ne.processFnString&&(W=ne.processFnString(W,S))}return W}function C(D,S){for(var F=0;F<S.length;F++){var W=S[F][0],Y=S[F][1];D=(S[F][2]?"await ":"")+"c.l('F','"+W+"')("+D,Y&&(D+=","+Y),D+=")"}return D}function Q(D,S,F,W,Y,ne){var ce="{exec:"+(Y?"async ":"")+y(F,S,D)+",params:["+W+"]";return ne&&(ce+=",name:'"+ne+"'"),Y&&(ce+=",async:true"),ce+="}"}function b(D,S){for(var F="[",W=0;W<D.length;W++){var Y=D[W];F+=Q(S,Y.res||"",Y.d,Y.p||"",Y.a,Y.n),W<D.length&&(F+=",")}return F+="]"}function y(D,S,F){return"function("+S+"){var tR='';"+w(D,F)+"return tR}"}function w(D,S){for(var F=0,W=D.length,Y="";F<W;F++){var ne=D[F];if(typeof ne=="string")Y+="tR+='"+ne+"';";else{var ce=ne.t,pe=ne.c||"",ge=ne.f,Se=ne.n||"",Le=ne.p||"",Ge=ne.res||"",fe=ne.b,Qe=!!ne.a;if(ce==="i"){S.defaultFilter&&(pe="c.l('F','"+S.defaultFilter+"')("+pe+")");var Me=C(pe,ge);!ne.raw&&S.autoEscape&&(Me="c.l('F','e')("+Me+")"),Y+="tR+="+Me+";"}else if(ce==="h")if(S.storage.nativeHelpers.get(Se))Y+=S.storage.nativeHelpers.get(Se)(ne,S);else{var we=(Qe?"await ":"")+"c.l('H','"+Se+"')("+Q(S,Ge,ne.d,Le,Qe);we+=fe?","+b(fe,S):",[]",Y+="tR+="+C(we+=",c)",ge)+";"}else ce==="s"?Y+="tR+="+C((Qe?"await ":"")+"c.l('H','"+Se+"')({params:["+Le+"]},[],c)",ge)+";":ce==="e"&&(Y+=pe+`
61
- `)}}return Y}var R=function(){function D(S){this.cache=S}return D.prototype.define=function(S,F){this.cache[S]=F},D.prototype.get=function(S){return this.cache[S]},D.prototype.remove=function(S){delete this.cache[S]},D.prototype.reset=function(){this.cache={}},D.prototype.load=function(S){l(this.cache,S,!0)},D}();function k(D,S,F,W){if(S&&S.length>0)throw n((W?"Native":"")+"Helper '"+D+"' doesn't accept blocks");if(F&&F.length>0)throw n((W?"Native":"")+"Helper '"+D+"' doesn't accept filters")}var $={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function K(D){return $[D]}var O=new R({}),J=new R({each:function(D,S){var F="",W=D.params[0];if(k("each",S,!1),D.async)return new Promise(function(ne){(function ce(pe,ge,Se,Le,Ge){Se(pe[ge],ge).then(function(fe){Le+=fe,ge===pe.length-1?Ge(Le):ce(pe,ge+1,Se,Le,Ge)})})(W,0,D.exec,F,ne)});for(var Y=0;Y<W.length;Y++)F+=D.exec(W[Y],Y);return F},foreach:function(D,S){var F=D.params[0];if(k("foreach",S,!1),D.async)return new Promise(function(ne){(function ce(pe,ge,Se,Le,Ge,fe){Le(ge[Se],pe[ge[Se]]).then(function(Qe){Ge+=Qe,Se===ge.length-1?fe(Ge):ce(pe,ge,Se+1,Le,Ge,fe)})})(F,Object.keys(F),0,D.exec,"",ne)});var W="";for(var Y in F)a(F,Y)&&(W+=D.exec(Y,F[Y]));return W},include:function(D,S,F){k("include",S,!1);var W=F.storage.templates.get(D.params[0]);if(!W)throw n('Could not fetch template "'+D.params[0]+'"');return W(D.params[1],F)},extends:function(D,S,F){var W=D.params[1]||{};W.content=D.exec();for(var Y=0;Y<S.length;Y++){var ne=S[Y];W[ne.name]=ne.exec()}var ce=F.storage.templates.get(D.params[0]);if(!ce)throw n('Could not fetch template "'+D.params[0]+'"');return ce(W,F)},useScope:function(D,S){return k("useScope",S,!1),D.exec(D.params[0])}}),ie=new R({if:function(D,S){k("if",!1,D.f,!0);var F="if("+D.p+"){"+w(D.d,S)+"}";if(D.b)for(var W=0;W<D.b.length;W++){var Y=D.b[W];Y.n==="else"?F+="else{"+w(Y.d,S)+"}":Y.n==="elif"&&(F+="else if("+Y.p+"){"+w(Y.d,S)+"}")}return F},try:function(D,S){if(k("try",!1,D.f,!0),!D.b||D.b.length!==1||D.b[0].n!=="catch")throw n("native helper 'try' only accepts 1 block, 'catch'");var F="try{"+w(D.d,S)+"}",W=D.b[0];return F+="catch"+(W.res?"("+W.res+")":"")+"{"+w(W.d,S)+"}"},block:function(D,S){return k("block",D.b,D.f,!0),"if(!"+S.varName+"["+D.p+"]){tR+=("+y(D.d,"",S)+")()}else{tR+="+S.varName+"["+D.p+"]}"}}),ee=new R({e:function(D){var S=String(D);return/[&<>"']/.test(S)?S.replace(/[&<>"']/g,K):S}}),le={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(D,S){if(D==="H"){var F=this.storage.helpers.get(S);if(F)return F;throw n("Can't find helper '"+S+"'")}if(D==="F"){var W=this.storage.filters.get(S);if(W)return W;throw n("Can't find filter '"+S+"'")}},async:!1,storage:{helpers:J,nativeHelpers:ie,filters:ee,templates:O},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function _(D,S){var F={};return l(F,le),S&&l(F,S),D&&l(F,D),F.l.bind(F),F}function P(D,S){var F=_(S||{}),W=Function;if(F.async){if(!o)throw n("This environment doesn't support async/await");W=o}try{return new W(F.varName,"c","cb",p(D,F))}catch(Y){throw Y instanceof SyntaxError?n(`Bad template syntax
59
+ `+Array(ne).join(" ")+"^")}n.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var s=new Function("return this")().Promise,o=!1;try{o=new Function("return (async function(){}).constructor")()}catch(_){if(!(_ instanceof SyntaxError))throw _}function a(_,S){return Object.prototype.hasOwnProperty.call(_,S)}function l(_,S,F){for(var J in S)a(S,J)&&(S[J]==null||typeof S[J]!="object"||J!=="storage"&&J!=="prefixes"||F?_[J]=S[J]:_[J]=l({},S[J]));return _}var A=/^async +/,c=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,u=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,h=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function f(_){return d.test(_)?_.replace(d,"\\$&"):_}function g(_,S){S.rmWhitespace&&(_=_.replace(/[\r\n]+/g,`
60
+ `).replace(/^\s+|\s+$/gm,"")),c.lastIndex=0,u.lastIndex=0,h.lastIndex=0;var F=S.prefixes,J=[F.h,F.b,F.i,F.r,F.c,F.e].reduce(function(fe,Qe){return fe&&Qe?fe+"|"+f(Qe):Qe?f(Qe):fe},""),Y=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+f(S.tags[1])+")","g"),ne=new RegExp("([^]*?)"+f(S.tags[0])+"(-|_)?\\s*("+J+")?\\s*","g"),ce=0,pe=!1;function ge(fe,Qe){var Me,we={f:[]},qe=0,Te="c";function T(be){var De=_.slice(ce,be),ke=De.trim();if(Te==="f")ke==="safe"?we.raw=!0:S.async&&A.test(ke)?(ke=ke.replace(A,""),we.f.push([ke,"",!0])):we.f.push([ke,""]);else if(Te==="fp")we.f[we.f.length-1][1]+=ke;else if(Te==="err"){if(ke){var _e=De.search(/\S/);i("invalid syntax",_,ce+_e)}}else we[Te]=ke;ce=be+1}for(Qe==="h"||Qe==="b"||Qe==="c"?Te="n":Qe==="r"&&(we.raw=!0,Qe="i"),Y.lastIndex=ce;(Me=Y.exec(_))!==null;){var m=Me[1],E=Me[2],x=Me[3],M=Me[4],z=Me[5],j=Me.index;if(m)m==="("?(qe===0&&(Te==="n"?(T(j),Te="p"):Te==="f"&&(T(j),Te="fp")),qe++):m===")"?--qe===0&&Te!=="c"&&(T(j),Te="err"):qe===0&&m==="|"?(T(j),Te="f"):m==="=>"&&(T(j),ce+=1,Te="res");else if(E)if(E==="/*"){var Ie=_.indexOf("*/",Y.lastIndex);Ie===-1&&i("unclosed comment",_,Me.index),Y.lastIndex=Ie+2}else E==="'"?(u.lastIndex=Me.index,u.exec(_)?Y.lastIndex=u.lastIndex:i("unclosed string",_,Me.index)):E==='"'?(h.lastIndex=Me.index,h.exec(_)?Y.lastIndex=h.lastIndex:i("unclosed string",_,Me.index)):E==="`"&&(c.lastIndex=Me.index,c.exec(_)?Y.lastIndex=c.lastIndex:i("unclosed string",_,Me.index));else if(x)return T(j),ce=j+Me[0].length,ne.lastIndex=ce,pe=z,M&&Qe==="h"&&(Qe="s"),we.t=Qe,we}return i("unclosed tag",_,fe),we}var Se=function fe(Qe,Me){Qe.b=[],Qe.d=[];var we,qe=!1,Te=[];function T(_e,Mt){_e&&(_e=function(ut,Ut,Er,Ir){var Tt,q;return typeof Ut.autoTrim=="string"?Tt=q=Ut.autoTrim:Array.isArray(Ut.autoTrim)&&(Tt=Ut.autoTrim[1],q=Ut.autoTrim[0]),(Er||Er===!1)&&(Tt=Er),(Ir||Ir===!1)&&(q=Ir),Tt==="slurp"&&q==="slurp"?ut.trim():(Tt==="_"||Tt==="slurp"?ut=String.prototype.trimLeft?ut.trimLeft():ut.replace(/^[\s\uFEFF\xA0]+/,""):Tt!=="-"&&Tt!=="nl"||(ut=ut.replace(/^(?:\n|\r|\r\n)/,"")),q==="_"||q==="slurp"?ut=String.prototype.trimRight?ut.trimRight():ut.replace(/[\s\uFEFF\xA0]+$/,""):q!=="-"&&q!=="nl"||(ut=ut.replace(/(?:\n|\r|\r\n)$/,"")),ut)}(_e,S,pe,Mt))&&(_e=_e.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),Te.push(_e))}for(;(we=ne.exec(_))!==null;){var m,E=we[1],x=we[2],M=we[3]||"";for(var z in F)if(F[z]===M){m=z;break}T(E,x),ce=we.index+we[0].length,m||i("unrecognized tag type: "+M,_,ce);var j=ge(we.index,m),Ie=j.t;if(Ie==="h"){var be=j.n||"";S.async&&A.test(be)&&(j.a=!0,j.n=be.replace(A,"")),j=fe(j),Te.push(j)}else if(Ie==="c"){if(Qe.n===j.n)return qe?(qe.d=Te,Qe.b.push(qe)):Qe.d=Te,Qe;i("Helper start and end don't match",_,we.index+we[0].length)}else if(Ie==="b"){qe?(qe.d=Te,Qe.b.push(qe)):Qe.d=Te;var De=j.n||"";S.async&&A.test(De)&&(j.a=!0,j.n=De.replace(A,"")),qe=j,Te=[]}else if(Ie==="s"){var ke=j.n||"";S.async&&A.test(ke)&&(j.a=!0,j.n=ke.replace(A,"")),Te.push(j)}else Te.push(j)}if(!Me)throw n('unclosed helper "'+Qe.n+'"');return T(_.slice(ce,_.length),!1),Qe.d=Te,Qe}({f:[]},!0);if(S.plugins)for(var Le=0;Le<S.plugins.length;Le++){var Ge=S.plugins[Le];Ge.processAST&&(Se.d=Ge.processAST(Se.d,S))}return Se.d}function p(_,S){var F=g(_,S),J="var tR='';"+(S.useWith?"with("+S.varName+"||{}){":"")+w(F,S)+"if(cb){cb(null,tR)} return tR"+(S.useWith?"}":"");if(S.plugins)for(var Y=0;Y<S.plugins.length;Y++){var ne=S.plugins[Y];ne.processFnString&&(J=ne.processFnString(J,S))}return J}function y(_,S){for(var F=0;F<S.length;F++){var J=S[F][0],Y=S[F][1];_=(S[F][2]?"await ":"")+"c.l('F','"+J+"')("+_,Y&&(_+=","+Y),_+=")"}return _}function Q(_,S,F,J,Y,ne){var ce="{exec:"+(Y?"async ":"")+C(F,S,_)+",params:["+J+"]";return ne&&(ce+=",name:'"+ne+"'"),Y&&(ce+=",async:true"),ce+="}"}function b(_,S){for(var F="[",J=0;J<_.length;J++){var Y=_[J];F+=Q(S,Y.res||"",Y.d,Y.p||"",Y.a,Y.n),J<_.length&&(F+=",")}return F+="]"}function C(_,S,F){return"function("+S+"){var tR='';"+w(_,F)+"return tR}"}function w(_,S){for(var F=0,J=_.length,Y="";F<J;F++){var ne=_[F];if(typeof ne=="string")Y+="tR+='"+ne+"';";else{var ce=ne.t,pe=ne.c||"",ge=ne.f,Se=ne.n||"",Le=ne.p||"",Ge=ne.res||"",fe=ne.b,Qe=!!ne.a;if(ce==="i"){S.defaultFilter&&(pe="c.l('F','"+S.defaultFilter+"')("+pe+")");var Me=y(pe,ge);!ne.raw&&S.autoEscape&&(Me="c.l('F','e')("+Me+")"),Y+="tR+="+Me+";"}else if(ce==="h")if(S.storage.nativeHelpers.get(Se))Y+=S.storage.nativeHelpers.get(Se)(ne,S);else{var we=(Qe?"await ":"")+"c.l('H','"+Se+"')("+Q(S,Ge,ne.d,Le,Qe);we+=fe?","+b(fe,S):",[]",Y+="tR+="+y(we+=",c)",ge)+";"}else ce==="s"?Y+="tR+="+y((Qe?"await ":"")+"c.l('H','"+Se+"')({params:["+Le+"]},[],c)",ge)+";":ce==="e"&&(Y+=pe+`
61
+ `)}}return Y}var R=function(){function _(S){this.cache=S}return _.prototype.define=function(S,F){this.cache[S]=F},_.prototype.get=function(S){return this.cache[S]},_.prototype.remove=function(S){delete this.cache[S]},_.prototype.reset=function(){this.cache={}},_.prototype.load=function(S){l(this.cache,S,!0)},_}();function k(_,S,F,J){if(S&&S.length>0)throw n((J?"Native":"")+"Helper '"+_+"' doesn't accept blocks");if(F&&F.length>0)throw n((J?"Native":"")+"Helper '"+_+"' doesn't accept filters")}var $={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function V(_){return $[_]}var O=new R({}),W=new R({each:function(_,S){var F="",J=_.params[0];if(k("each",S,!1),_.async)return new Promise(function(ne){(function ce(pe,ge,Se,Le,Ge){Se(pe[ge],ge).then(function(fe){Le+=fe,ge===pe.length-1?Ge(Le):ce(pe,ge+1,Se,Le,Ge)})})(J,0,_.exec,F,ne)});for(var Y=0;Y<J.length;Y++)F+=_.exec(J[Y],Y);return F},foreach:function(_,S){var F=_.params[0];if(k("foreach",S,!1),_.async)return new Promise(function(ne){(function ce(pe,ge,Se,Le,Ge,fe){Le(ge[Se],pe[ge[Se]]).then(function(Qe){Ge+=Qe,Se===ge.length-1?fe(Ge):ce(pe,ge,Se+1,Le,Ge,fe)})})(F,Object.keys(F),0,_.exec,"",ne)});var J="";for(var Y in F)a(F,Y)&&(J+=_.exec(Y,F[Y]));return J},include:function(_,S,F){k("include",S,!1);var J=F.storage.templates.get(_.params[0]);if(!J)throw n('Could not fetch template "'+_.params[0]+'"');return J(_.params[1],F)},extends:function(_,S,F){var J=_.params[1]||{};J.content=_.exec();for(var Y=0;Y<S.length;Y++){var ne=S[Y];J[ne.name]=ne.exec()}var ce=F.storage.templates.get(_.params[0]);if(!ce)throw n('Could not fetch template "'+_.params[0]+'"');return ce(J,F)},useScope:function(_,S){return k("useScope",S,!1),_.exec(_.params[0])}}),ie=new R({if:function(_,S){k("if",!1,_.f,!0);var F="if("+_.p+"){"+w(_.d,S)+"}";if(_.b)for(var J=0;J<_.b.length;J++){var Y=_.b[J];Y.n==="else"?F+="else{"+w(Y.d,S)+"}":Y.n==="elif"&&(F+="else if("+Y.p+"){"+w(Y.d,S)+"}")}return F},try:function(_,S){if(k("try",!1,_.f,!0),!_.b||_.b.length!==1||_.b[0].n!=="catch")throw n("native helper 'try' only accepts 1 block, 'catch'");var F="try{"+w(_.d,S)+"}",J=_.b[0];return F+="catch"+(J.res?"("+J.res+")":"")+"{"+w(J.d,S)+"}"},block:function(_,S){return k("block",_.b,_.f,!0),"if(!"+S.varName+"["+_.p+"]){tR+=("+C(_.d,"",S)+")()}else{tR+="+S.varName+"["+_.p+"]}"}}),te=new R({e:function(_){var S=String(_);return/[&<>"']/.test(S)?S.replace(/[&<>"']/g,V):S}}),le={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(_,S){if(_==="H"){var F=this.storage.helpers.get(S);if(F)return F;throw n("Can't find helper '"+S+"'")}if(_==="F"){var J=this.storage.filters.get(S);if(J)return J;throw n("Can't find filter '"+S+"'")}},async:!1,storage:{helpers:W,nativeHelpers:ie,filters:te,templates:O},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function D(_,S){var F={};return l(F,le),S&&l(F,S),_&&l(F,_),F.l.bind(F),F}function P(_,S){var F=D(S||{}),J=Function;if(F.async){if(!o)throw n("This environment doesn't support async/await");J=o}try{return new J(F.varName,"c","cb",p(_,F))}catch(Y){throw Y instanceof SyntaxError?n(`Bad template syntax
62
62
 
63
63
  `+Y.message+`
64
64
  `+Array(Y.message.length+1).join("=")+`
65
- `+p(D,F)):Y}}function X(D,S){var F;return S.cache&&S.name&&S.storage.templates.get(S.name)?S.storage.templates.get(S.name):(F=typeof D=="function"?D:P(D,S),S.cache&&S.name&&S.storage.templates.define(S.name,F),F)}le.l.bind(le),t.compile=P,t.compileScope=w,t.compileScopeIntoFunction=y,t.compileToString=p,t.defaultConfig=le,t.filters=ee,t.getConfig=_,t.helpers=J,t.nativeHelpers=ie,t.parse=g,t.render=function(D,S,F,W){var Y=_(F||{});if(!Y.async)return X(D,Y)(S,Y);if(!W){if(typeof s=="function")return new s(function(ne,ce){try{ne(X(D,Y)(S,Y))}catch(pe){ce(pe)}});throw n("Please provide a callback function, this env doesn't support Promises")}try{X(D,Y)(S,Y,W)}catch(ne){return W(ne)}},t.templates=O,Object.defineProperty(t,"__esModule",{value:!0})})})(mo,mo.exports);var Df=mo.exports;const _f=(r,e,t,n)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const i=Object.getOwnPropertyDescriptor(r,t),s=Object.getOwnPropertyDescriptor(e,t);!Lf(i,s)&&n||Object.defineProperty(r,t,s)},Lf=function(r,e){return r===void 0||r.configurable||r.writable===e.writable&&r.enumerable===e.enumerable&&r.configurable===e.configurable&&(r.writable||r.value===e.value)},Ff=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},kf=(r,e)=>`/* Wrapped ${r}*/
66
- ${e}`,Nf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mf=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Pf=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=kf.bind(null,n,e.toString());Object.defineProperty(i,"name",Mf),Object.defineProperty(r,"toString",{...Nf,value:i})};function Of(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))_f(r,e,i,t);return Ff(r,e),Pf(r,e,n),r}const Uf=new WeakMap;function Wr(r,{cacheKey:e=([n])=>n,cache:t=new Map}={}){const n=new Map,i=function(...s){const o=e(s);if(n.has(o))return n.get(o);const a=(async()=>{try{if(t&&await t.has(o))return await t.get(o);const A=await r.apply(this,s);try{return A}finally{t&&await t.set(o,A)}}finally{n.delete(o)}})();return n.set(o,a),a};return Of(i,r,{ignoreNonConfigurable:!0}),Uf.set(i,t),i}var eA={},Eo={},Re={};Object.defineProperty(Re,"__esModule",{value:!0}),Re.default=Re.Wrap=Re.Unit=Re.PrintOptions=Re.PositionType=Re.Overflow=Re.NodeType=Re.MeasureMode=Re.LogLevel=Re.Justify=Re.Gutter=Re.FlexDirection=Re.ExperimentalFeature=Re.Errata=Re.Edge=Re.Display=Re.Direction=Re.Dimension=Re.Align=void 0;let yr=function(r){return r[r.Auto=0]="Auto",r[r.FlexStart=1]="FlexStart",r[r.Center=2]="Center",r[r.FlexEnd=3]="FlexEnd",r[r.Stretch=4]="Stretch",r[r.Baseline=5]="Baseline",r[r.SpaceBetween=6]="SpaceBetween",r[r.SpaceAround=7]="SpaceAround",r}({});Re.Align=yr;let Io=function(r){return r[r.Width=0]="Width",r[r.Height=1]="Height",r}({});Re.Dimension=Io;let Gi=function(r){return r[r.Inherit=0]="Inherit",r[r.LTR=1]="LTR",r[r.RTL=2]="RTL",r}({});Re.Direction=Gi;let vo=function(r){return r[r.Flex=0]="Flex",r[r.None=1]="None",r}({});Re.Display=vo;let ir=function(r){return r[r.Left=0]="Left",r[r.Top=1]="Top",r[r.Right=2]="Right",r[r.Bottom=3]="Bottom",r[r.Start=4]="Start",r[r.End=5]="End",r[r.Horizontal=6]="Horizontal",r[r.Vertical=7]="Vertical",r[r.All=8]="All",r}({});Re.Edge=ir;let ti=function(r){return r[r.None=0]="None",r[r.StretchFlexBasis=1]="StretchFlexBasis",r[r.All=2147483647]="All",r[r.Classic=2147483646]="Classic",r}({});Re.Errata=ti;let Hi=function(r){return r[r.WebFlexBasis=0]="WebFlexBasis",r[r.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",r[r.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",r}({});Re.ExperimentalFeature=Hi;let ri=function(r){return r[r.Column=0]="Column",r[r.ColumnReverse=1]="ColumnReverse",r[r.Row=2]="Row",r[r.RowReverse=3]="RowReverse",r}({});Re.FlexDirection=ri;let $i=function(r){return r[r.Column=0]="Column",r[r.Row=1]="Row",r[r.All=2]="All",r}({});Re.Gutter=$i;let qr=function(r){return r[r.FlexStart=0]="FlexStart",r[r.Center=1]="Center",r[r.FlexEnd=2]="FlexEnd",r[r.SpaceBetween=3]="SpaceBetween",r[r.SpaceAround=4]="SpaceAround",r[r.SpaceEvenly=5]="SpaceEvenly",r}({});Re.Justify=qr;let Xr=function(r){return r[r.Error=0]="Error",r[r.Warn=1]="Warn",r[r.Info=2]="Info",r[r.Debug=3]="Debug",r[r.Verbose=4]="Verbose",r[r.Fatal=5]="Fatal",r}({});Re.LogLevel=Xr;let Yi=function(r){return r[r.Undefined=0]="Undefined",r[r.Exactly=1]="Exactly",r[r.AtMost=2]="AtMost",r}({});Re.MeasureMode=Yi;let Co=function(r){return r[r.Default=0]="Default",r[r.Text=1]="Text",r}({});Re.NodeType=Co;let Vi=function(r){return r[r.Visible=0]="Visible",r[r.Hidden=1]="Hidden",r[r.Scroll=2]="Scroll",r}({});Re.Overflow=Vi;let Ki=function(r){return r[r.Static=0]="Static",r[r.Relative=1]="Relative",r[r.Absolute=2]="Absolute",r}({});Re.PositionType=Ki;let Ji=function(r){return r[r.Layout=1]="Layout",r[r.Style=2]="Style",r[r.Children=4]="Children",r}({});Re.PrintOptions=Ji;let ni=function(r){return r[r.Undefined=0]="Undefined",r[r.Point=1]="Point",r[r.Percent=2]="Percent",r[r.Auto=3]="Auto",r}({});Re.Unit=ni;let Wi=function(r){return r[r.NoWrap=0]="NoWrap",r[r.Wrap=1]="Wrap",r[r.WrapReverse=2]="WrapReverse",r}({});Re.Wrap=Wi;var Gf={ALIGN_AUTO:yr.Auto,ALIGN_FLEX_START:yr.FlexStart,ALIGN_CENTER:yr.Center,ALIGN_FLEX_END:yr.FlexEnd,ALIGN_STRETCH:yr.Stretch,ALIGN_BASELINE:yr.Baseline,ALIGN_SPACE_BETWEEN:yr.SpaceBetween,ALIGN_SPACE_AROUND:yr.SpaceAround,DIMENSION_WIDTH:Io.Width,DIMENSION_HEIGHT:Io.Height,DIRECTION_INHERIT:Gi.Inherit,DIRECTION_LTR:Gi.LTR,DIRECTION_RTL:Gi.RTL,DISPLAY_FLEX:vo.Flex,DISPLAY_NONE:vo.None,EDGE_LEFT:ir.Left,EDGE_TOP:ir.Top,EDGE_RIGHT:ir.Right,EDGE_BOTTOM:ir.Bottom,EDGE_START:ir.Start,EDGE_END:ir.End,EDGE_HORIZONTAL:ir.Horizontal,EDGE_VERTICAL:ir.Vertical,EDGE_ALL:ir.All,ERRATA_NONE:ti.None,ERRATA_STRETCH_FLEX_BASIS:ti.StretchFlexBasis,ERRATA_ALL:ti.All,ERRATA_CLASSIC:ti.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:Hi.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:Hi.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:Hi.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:ri.Column,FLEX_DIRECTION_COLUMN_REVERSE:ri.ColumnReverse,FLEX_DIRECTION_ROW:ri.Row,FLEX_DIRECTION_ROW_REVERSE:ri.RowReverse,GUTTER_COLUMN:$i.Column,GUTTER_ROW:$i.Row,GUTTER_ALL:$i.All,JUSTIFY_FLEX_START:qr.FlexStart,JUSTIFY_CENTER:qr.Center,JUSTIFY_FLEX_END:qr.FlexEnd,JUSTIFY_SPACE_BETWEEN:qr.SpaceBetween,JUSTIFY_SPACE_AROUND:qr.SpaceAround,JUSTIFY_SPACE_EVENLY:qr.SpaceEvenly,LOG_LEVEL_ERROR:Xr.Error,LOG_LEVEL_WARN:Xr.Warn,LOG_LEVEL_INFO:Xr.Info,LOG_LEVEL_DEBUG:Xr.Debug,LOG_LEVEL_VERBOSE:Xr.Verbose,LOG_LEVEL_FATAL:Xr.Fatal,MEASURE_MODE_UNDEFINED:Yi.Undefined,MEASURE_MODE_EXACTLY:Yi.Exactly,MEASURE_MODE_AT_MOST:Yi.AtMost,NODE_TYPE_DEFAULT:Co.Default,NODE_TYPE_TEXT:Co.Text,OVERFLOW_VISIBLE:Vi.Visible,OVERFLOW_HIDDEN:Vi.Hidden,OVERFLOW_SCROLL:Vi.Scroll,POSITION_TYPE_STATIC:Ki.Static,POSITION_TYPE_RELATIVE:Ki.Relative,POSITION_TYPE_ABSOLUTE:Ki.Absolute,PRINT_OPTIONS_LAYOUT:Ji.Layout,PRINT_OPTIONS_STYLE:Ji.Style,PRINT_OPTIONS_CHILDREN:Ji.Children,UNIT_UNDEFINED:ni.Undefined,UNIT_POINT:ni.Point,UNIT_PERCENT:ni.Percent,UNIT_AUTO:ni.Auto,WRAP_NO_WRAP:Wi.NoWrap,WRAP_WRAP:Wi.Wrap,WRAP_WRAP_REVERSE:Wi.WrapReverse};Re.default=Gf,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.default=$f;var kr=Hf(Re);function tA(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(tA=function(n){return n?t:e})(r)}function Hf(r,e){if(!e&&r&&r.__esModule)return r;if(r===null||typeof r!="object"&&typeof r!="function")return{default:r};var t=tA(e);if(t&&t.has(r))return t.get(r);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in r)if(s!=="default"&&Object.prototype.hasOwnProperty.call(r,s)){var o=i?Object.getOwnPropertyDescriptor(r,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=r[s]}return n.default=r,t&&t.set(r,n),n}function $f(r){function e(i,s,o){const a=i[s];i[s]=function(){for(var l=arguments.length,A=new Array(l),c=0;c<l;c++)A[c]=arguments[c];return o.call(this,a,...A)}}for(const i of["setPosition","setMargin","setFlexBasis","setWidth","setHeight","setMinWidth","setMinHeight","setMaxWidth","setMaxHeight","setPadding"]){const s={[kr.Unit.Point]:r.Node.prototype[i],[kr.Unit.Percent]:r.Node.prototype[`${i}Percent`],[kr.Unit.Auto]:r.Node.prototype[`${i}Auto`]};e(r.Node.prototype,i,function(o){for(var a=arguments.length,l=new Array(a>1?a-1:0),A=1;A<a;A++)l[A-1]=arguments[A];const c=l.pop();let u,h;if(c==="auto")u=kr.Unit.Auto,h=void 0;else if(typeof c=="object")u=c.unit,h=c.valueOf();else if(u=typeof c=="string"&&c.endsWith("%")?kr.Unit.Percent:kr.Unit.Point,h=parseFloat(c),!Number.isNaN(c)&&Number.isNaN(h))throw new Error(`Invalid value ${c} for ${i}`);if(!s[u])throw new Error(`Failed to execute "${i}": Unsupported unit '${c}'`);return h!==void 0?s[u].call(this,...l,h):s[u].call(this,...l)})}function t(i){return r.MeasureCallback.implement({measure:function(){const{width:s,height:o}=i(...arguments);return{width:s??NaN,height:o??NaN}}})}e(r.Node.prototype,"setMeasureFunc",function(i,s){return s?i.call(this,t(s)):this.unsetMeasureFunc()});function n(i){return r.DirtiedCallback.implement({dirtied:i})}return e(r.Node.prototype,"setDirtiedFunc",function(i,s){i.call(this,n(s))}),e(r.Config.prototype,"free",function(){r.Config.destroy(this)}),e(r.Node,"create",(i,s)=>s?r.Node.createWithConfig(s):r.Node.createDefault()),e(r.Node.prototype,"free",function(){r.Node.destroy(this)}),e(r.Node.prototype,"freeRecursive",function(){for(let i=0,s=this.getChildCount();i<s;++i)this.getChild(0).freeRecursive();this.free()}),e(r.Node.prototype,"calculateLayout",function(i){let s=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]:kr.Direction.LTR;return i.call(this,s,o,a)}),{Config:r.Config,Node:r.Node,...kr.default}}var rA={exports:{}};(function(r,e){var t=(()=>{var n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(i){i=i||{};var s;s||(s=typeof i<"u"?i:{});var o,a;s.ready=new Promise(function(v,B){o=v,a=B});var l=Object.assign({},s),A="";typeof document<"u"&&document.currentScript&&(A=document.currentScript.src),n&&(A=n),A.indexOf("blob:")!==0?A=A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):A="";var c=s.print||console.log.bind(console),u=s.printErr||console.warn.bind(console);Object.assign(s,l),l=null;var h;s.wasmBinary&&(h=s.wasmBinary),s.noExitRuntime,typeof WebAssembly!="object"&&X("no native wasm support detected");var d,f=!1;function g(v,B,L){L=B+L;for(var N="";!(B>=L);){var H=v[B++];if(!H)break;if(H&128){var Z=v[B++]&63;if((H&224)==192)N+=String.fromCharCode((H&31)<<6|Z);else{var se=v[B++]&63;H=(H&240)==224?(H&15)<<12|Z<<6|se:(H&7)<<18|Z<<12|se<<6|v[B++]&63,65536>H?N+=String.fromCharCode(H):(H-=65536,N+=String.fromCharCode(55296|H>>10,56320|H&1023))}}else N+=String.fromCharCode(H)}return N}var p,C,Q,b,y,w,R,k,$;function K(){var v=d.buffer;p=v,s.HEAP8=C=new Int8Array(v),s.HEAP16=b=new Int16Array(v),s.HEAP32=w=new Int32Array(v),s.HEAPU8=Q=new Uint8Array(v),s.HEAPU16=y=new Uint16Array(v),s.HEAPU32=R=new Uint32Array(v),s.HEAPF32=k=new Float32Array(v),s.HEAPF64=$=new Float64Array(v)}var O,J=[],ie=[],ee=[];function le(){var v=s.preRun.shift();J.unshift(v)}var _=0,P=null;function X(v){throw s.onAbort&&s.onAbort(v),v="Aborted("+v+")",u(v),f=!0,v=new WebAssembly.RuntimeError(v+". Build with -sASSERTIONS for more info."),a(v),v}function D(v){return v.startsWith("data:application/octet-stream;base64,")}var S;if(S="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/fX8BfwKvAR0BYQFhAB0BYQFiAAMBYQFjABUBYQFkABIBYQFlAAcBYQFmAB4BYQFnAAABYQFoAB8BYQFpAAMBYQFqAAABYQFrAB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hAQJAIABBqtWq/QdHBEAgAL4iBCAEWw0BQfghIQELIAEqAgAhBCABKAIEQQFrDgIEAQYLIABB/////3txQYCAgIACar4hBCAAQYCAgIAEcUUNAwsgBCADlEMK1yM8lCEEDAILIAQhBQtDAAAAACEEAkAgACgC3AEiAEHw4YP8B0YNACAAQY+evPwHRg0CQfAhIQECQCAAQarVqv0HRwRAIAC+IgQgBFsNAUH4ISEBCyABKgIAIQQgASgCBEEBaw4CAgEECyAAQf////97cUGAgICAAmq+IQQgAEGAgICABHFFDQELIAQgA5RDCtcjPJQhBAsgBEMAAAAAYEUNAQsgAiAEXg0BCyAFQwAAAABgRQRAIAIPCyAFIAIgAiAFXRshBAsgBAsEACAAC74BAQN/IAAtAABBIHFFBEACQCABIQMCQCACIAAiASgCECIABH8gAAUgARB+DQEgASgCEAsgASgCFCIFa0sEQCABIAMgAiABKAIkEQYAGgwCCwJAIAEoAlBBAEgNACACIQADQCAAIgRFDQEgAyAEQQFrIgBqLQAAQQpHDQALIAEgAyAEIAEoAiQRBgAgBEkNASADIARqIQMgAiAEayECIAEoAhQhBQsgBSADIAIQKxogASABKAIUIAJqNgIUCwsLC20BAX8jAEGAAmsiBSQAIARBgMAEcSACIANMckUEQCAFIAFB/wFxIAIgA2siA0GAAiADQYACSSIBGxAqGiABRQRAA0AgACAFQYACECcgA0GAAmsiA0H/AUsNAAsLIAAgBSADECcLIAVBgAJqJAALzAIBBX8gAARAIABBBGsiASgCACIFIQMgASECIABBCGsoAgAiACAAQX5xIgRHBEAgASAEayICKAIEIgAgAigCCDYCCCACKAIIIAA2AgQgBCAFaiEDCyABIAVqIgQoAgAiASABIARqQQRrKAIARwRAIAQoAgQiACAEKAIINgIIIAQoAgggADYCBCABIANqIQMLIAIgAzYCACADQXxxIAJqQQRrIANBAXI2AgAgAgJ/IAIoAgBBCGsiAUH/AE0EQCABQQN2QQFrDAELIAFBHSABZyIAa3ZBBHMgAEECdGtB7gBqIAFB/x9NDQAaQT8gAUEeIABrdkEC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BQgBZBEADQCAEQQFrIQQgAUIBhiIBQgBZDQALCyACQQEgBGuthgwBCyACQv////////8Hg0KAgICAgICACIQLIQEgBEH/B0oEQANAAkAgAUKAgICAgICACH0iA0IAUw0AIAMiAUIAUg0AIABEAAAAAAAAAACiDwsgAUIBhiEBIARBAWsiBEH/B0oNAAtB/wchBAsCQCABQoCAgICAgIAIfSIDQgBTDQAgAyIBQgBSDQAgAEQAAAAAAAAAAKIPCyABQv////////8HWARAA0AgBEEBayEEIAFCgICAgICAgARUIQUgAUIBhiEBIAUNAAsLIAJCgICAgICAgICAf4MgAUKAgICAgICACH0gBK1CNIaEIAFBASAEa62IIARBAEobhL8LigEBA38DQCAAQQR0IgFB1C5qIAFB0C5qIgI2AgAgAUHYLmogAjYCACAAQQFqIgBBwABHDQALQTAQTxpB8DZBEDYCAEH0NkEANgIAEIQBQfQ2QaA3KAIANgIAQaA3QfA2NgIAQaQ3QcYBNgIAQag3QQA2AgAQdkGoN0GgNygCADYCAEGgN0GkNzYCAAukAwEHfyAABEAjAEEgayIGJAAgACgCACIBKAKoBCIDBEAgAyABEGsaIAFBADYCqAQLIAEoArAEIgIgASgCrAQiA0cEQEEBIAIgA2tBAnUiAiACQQFNGyEEQQAhAgNAIAMgAkECdGooAgBBADYCqAQgAkEBaiICIARHDQALCyABIAM2ArAEAkAgAyABQbQEaiICKAIARg0AIAZBCGpBAEEAIAIQQCICKAIEIAEoArAEIAEoAqwEIgRrIgVrIgMgBCAFEDYhBSABKAKsBCEEIAEgBTYCrAQgAiAENgIEIAEoArAEIQUgASACKAIINgKwBCACIAU2AgggASgCtAQhByABIAIoAgw2ArQEIAIgBDYCACACIAc2AgwgBCAFRwRAIAIgBSAEIAVrQQNqQXxxajYCCAsgBEUNACAEEEkgASgCrAQhAwsgAwRAIAEgAzYCsAQgAxBJCyABEEkgACgCCCEBIABBADYCCCABBEAgASABKAIAKAIEEQAACyAAKAIEIQEgAEEANgIEIAEEQCABIAEoAgAoAgQRAAALIAZBIG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QHSIAQoCAgPwDNwIUIABCADcCDCAAQQA2AgAgAEEAOgAIIABBATYCBEHkNiAANgIAQeg2QQE6AABB4DZB4DYoAgBBAWo2AgALIAAoAgQhBAJAIAAtAAhBCHEEQCAAQQBBBUEAQbwhIAIgBBERABoMAQsgAEEAQQVBvCEgAiAEEQsAGgsgA0EQaiQAECwACyAAQwAAAAAgASABQwAAAABbGzgCFCACQRBqJAALPAAgAUEDSQRAQQEgAXQhASAAKAIAIgACfyACBEAgACgCDCABcgwBCyAAKAIMIAFBf3NxCzYCDA8LEAQAC00BAn9BBBAdIQFBHBAdIgBCgICA/AM3AhQgAEIANwIMIABBADYCACAAQQA6AAggAEEBNgIEQeA2QeA2KAIAQQFqNgIAIAEgADYCACABCxAAIABBDTYCBCAAIAE2AgALEAAgAEEKNgIEIAAgATYCAAsQACAAQQc2AgQgACABNgIACyMAIAJBBUdBACACG0UEQEGoLCADIAQQYw8LQbgtIAMgBBBjCyIBAX4gASACrSADrUIghoQgBCAAERQAIgVCIIinJAEgBacLqAEBBX8gACgCVCIDKAIAIQUgAygCBCIEIAAoAhQgACgCHCIHayIGIAQgBkkbIgYEQCAFIAcgBhArGiADIAMoAgAgBmoiBTYCACADIAMoAgQgBmsiBDYCBAsgBCACIAIgBEsbIgQEQCAFIAEgBBArGiADIAMoAgAgBGoiBTYCACADIAMoAgQgBGs2AgQLIAVBADoAACAAIAAoAiwiATYCHCAAIAE2AhQgAgsEAEIACwQAQQALigUCBn4CfyABIAEoAgBBB2pBeHEiAUEQajYCACAAIQkgASkDACEDIAEpAwghBiMAQSBrIggkAAJAIAZC////////////AIMiBEKAgICAgIDAgDx9IARCgICAgICAwP/DAH1UBEAgBkIEhiADQjyIhCEEIANC//////////8PgyIDQoGAgICAgICACFoEQCAEQoGAgICAgICAwAB8IQIMAgsgBEKAgICAgICAgEB9IQIgA0KAgICAgICAgAhSDQEgAiAEQgGDfCECDAELIANQIARCgICAgICAwP//AFQgBEKAgICAgIDA//8AURtFBEAgBk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AQHSIAIAMpAwg3AwggACADKQMANwMAIANBEGokACAACzcBAX8gASAAKAIEIgNBAXVqIQEgACgCACEAIAEgAiADQQFxBH8gASgCACAAaigCAAUgAAsRBAALOQEBfyABIAAoAgQiBEEBdWohASAAKAIAIQAgASACIAMgBEEBcQR/IAEoAgAgAGooAgAFIAALEQgACwkAIAEgABECAAsFAEGbNwsPACABIAAoAgBqIAI2AgALDQAgASAAKAIAaigCAAsYAQF/QRAQHSIAQgA3AwggAEEANgIAIAALGAEBf0EQEB0iAEIANwMAIABCADcDCCAACwwAQTAQHUEAQTAQKgs3AQF/IAEgACgCBCIDQQF1aiEBIAAoAgAhACABIAIgA0EBcQR/IAEoAgAgAGooAgAFIAALERsACwUAQZY3CyEAIAAgASgCACABIAEsAAtBAEgbQZM3IAIoAgAQDzYCAAsqAQF/QQwQHSIBQQA6AAQgASAAKAIANgIIIABBADYCACABQcgjNgIAIAELBQBBkzcLBQBBkDcLIQAgACABKAIAIAEgASwAC0EASBtB/DYgAigCABAPNgIAC9gBAQR/IwBBIGsiAyQAIAEoAgAiBEHw////B0kEQAJAAkAgBEELTwRAIARBD3JBAWoiBRAdIQYgAyAFQYCAgIB4cjYCECADIAY2AgggAyAENgIMIAQgBmohBQwBCyADIAQ6ABMgA0EIaiIGIARqIQUgBEUNAQsgBiABQQRqIAQQKxoLIAVBADoAACADIAI2AgAgA0EYaiADQQhqIAMgABEDACADKAIYEBAgAygCGCIAEAYgAygCABAGIAMsABNBAEgEQCADKAIIECkLIANBIGokACAADwsQBAALKgEBf0EMEB0iAUEAOgAEIAEgACgCADYCCCAAQQA2AgAgAUHQIjYCACABCwUAQfw2C2kBAn8jAEEQayIGJAAgASAAKAIEIgdBAXVqIQEgACgCACEAIAYgASACIAMgBCAFIAdBAXEEfyABKAIAIABqKAIABSAACxEOAEEQEB0iACAGKQMINwMIIAAgBikDADcDACAGQRBqJAAgAAsFAEH4NgubAQIBfwF9IwBBEGsiAiQAIAAoAgAhACABQQZIBEACfwJA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AAGgAAABoaGgBB8ikLDhoAAAAaGhoAAAAAAAAJAEGjKgsBFABBryoLFRcAAAAAFwAAAAAJFAAAAAAAFAAAFABB3SoLARYAQekqCycVAAAAABUAAAAACRYAAAAAABYAABYAADAxMjM0NTY3ODlBQkNERUYAQbQrCwHVAEHcKwsI//////////8AQaAsCwnwHwEAAAAAAAUAQbQsCwHQAEHMLAsK0QAAANIAAADUGwBB5CwLAQIAQfQsCwj//////////wBBuC0LAQUAQcQtCwHTAEHcLQsO0QAAANQAAADoGwAAAAQAQfQtCwEBAEGELgsF/////woAQcguCwHW",!D(S)){var F=S;S=s.locateFile?s.locateFile(F,A):A+F}function W(){var v=S;try{if(v==S&&h)return new Uint8Array(h);if(D(v))try{var B=E1(v.slice(37)),L=new Uint8Array(B.length);for(v=0;v<B.length;++v)L[v]=B.charCodeAt(v);var N=L}catch{throw Error("Converting base64 string to bytes failed.")}else N=void 0;var H=N;if(H)return H;throw"both async and sync fetching of the wasm failed"}catch(Z){X(Z)}}function Y(){return h||typeof fetch!="function"?Promise.resolve().then(function(){return W()}):fetch(S,{credentials:"same-origin"}).then(function(v){if(!v.ok)throw"failed to load wasm binary file at '"+S+"'";return v.arrayBuffer()}).catch(function(){return W()})}function ne(v){for(;0<v.length;)v.shift()(s)}function ce(v){if(v===void 0)return"_unknown";v=v.replace(/[^a-zA-Z0-9_]/g,"$");var B=v.charCodeAt(0);return 48<=B&&57>=B?"_"+v:v}function pe(v,B){return v=ce(v),function(){return B.apply(this,arguments)}}var ge=[{},{value:void 0},{value:null},{value:!0},{value:!1}],Se=[];function Le(v){var B=Error,L=pe(v,function(N){this.name=v,this.message=N,N=Error(N).stack,N!==void 0&&(this.stack=this.toString()+`
67
- `+N.replace(/^Error(:[^\n]*)?\n/,""))});return L.prototype=Object.create(B.prototype),L.prototype.constructor=L,L.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},L}var Ge=void 0;function fe(v){throw new Ge(v)}var Qe=v=>(v||fe("Cannot use deleted val. handle = "+v),ge[v].value),Me=v=>{switch(v){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var B=Se.length?Se.pop():ge.length;return ge[B]={fa:1,value:v},B}},we=void 0,We=void 0;function Te(v){for(var B="";Q[v];)B+=We[Q[v++]];return B}var T=[];function m(){for(;T.length;){var v=T.pop();v.L.Z=!1,v.delete()}}var E=void 0,x={};function M(v,B){for(B===void 0&&fe("ptr should not be undefined");v.P;)B=v.aa(B),v=v.P;return B}var z={};function j(v){v=_d(v);var B=Te(v);return Dr(v),B}function Ie(v,B){var L=z[v];return L===void 0&&fe(B+" has unknown type "+j(v)),L}function be(){}var De=!1;function ke(v){--v.count.value,v.count.value===0&&(v.S?v.T.V(v.S):v.O.M.V(v.N))}function _e(v,B,L){return B===L?v:L.P===void 0?null:(v=_e(v,B,L.P),v===null?null:L.ma(v))}var Mt={};function ut(v,B){return B=M(v,B),x[B]}var Ut=void 0;function Er(v){throw new Ut(v)}function Ir(v,B){return B.O&&B.N||Er("makeClassHandle requires ptr and ptrType"),!!B.T!=!!B.S&&Er("Both smartPtrType and smartPtr must be specified"),B.count={value:1},Tt(Object.create(v,{L:{value:B}}))}function Tt(v){return typeof FinalizationRegistry>"u"?(Tt=B=>B,v):(De=new FinalizationRegistry(B=>{ke(B.L)}),Tt=B=>{var L=B.L;return L.S&&De.register(B,{L},B),B},be=B=>{De.unregister(B)},Tt(v))}var q={};function de(v){for(;v.length;){var B=v.pop();v.pop()(B)}}function ve(v){return this.fromWireType(w[v>>2])}var Pe={},Fe={};function qe(v,B,L){function N(oe){oe=L(oe),oe.length!==v.length&&Er("Mismatched type converter count");for(var Ae=0;Ae<v.length;++Ae)wt(v[Ae],oe[Ae])}v.forEach(function(oe){Fe[oe]=B});var H=Array(B.length),Z=[],se=0;B.forEach((oe,Ae)=>{z.hasOwnProperty(oe)?H[Ae]=z[oe]:(Z.push(oe),Pe.hasOwnProperty(oe)||(Pe[oe]=[]),Pe[oe].push(()=>{H[Ae]=z[oe],++se,se===Z.length&&N(H)}))}),Z.length===0&&N(H)}function xt(v){switch(v){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+v)}}function wt(v,B,L={}){if(!("argPackAdvance"in B))throw new TypeError("registerType registeredInstance requires argPackAdvance");var N=B.name;if(v||fe('type "'+N+'" must have a positive integer typeid pointer'),z.hasOwnProperty(v)){if(L.ta)return;fe("Cannot register type '"+N+"' twice")}z[v]=B,delete Fe[v],Pe.hasOwnProperty(v)&&(B=Pe[v],delete Pe[v],B.forEach(H=>H()))}function Gn(v){fe(v.L.O.M.name+" instance already deleted")}function St(){}function hn(v,B,L){if(v[B].R===void 0){var N=v[B];v[B]=function(){return v[B].R.hasOwnProperty(arguments.length)||fe("Function '"+L+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+v[B].R+")!"),v[B].R[arguments.length].apply(this,arguments)},v[B].R=[],v[B].R[N.Y]=N}}function Hn(v,B){s.hasOwnProperty(v)?(fe("Cannot register public name '"+v+"' twice"),hn(s,v,v),s.hasOwnProperty(void 0)&&fe("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),s[v].R[void 0]=B):s[v]=B}function Hr(v,B,L,N,H,Z,se,oe){this.name=v,this.constructor=B,this.W=L,this.V=N,this.P=H,this.oa=Z,this.aa=se,this.ma=oe,this.ia=[]}function Si(v,B,L){for(;B!==L;)B.aa||fe("Expected null or instance of "+L.name+", got an instance of "+B.name),v=B.aa(v),B=B.P;return v}function Ri(v,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+Tl(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),Si(B.L.N,B.L.O.M,this.M))}function $n(v,B){if(B===null){if(this.da&&fe("null is not a valid "+this.name),this.ca){var L=this.ea();return v!==null&&v.push(this.V,L),L}return 0}if(B.L||fe('Cannot pass "'+Tl(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),!this.ba&&B.L.O.ba&&fe("Cannot convert argument of type "+(B.L.T?B.L.T.name:B.L.O.name)+" to parameter type "+this.name),L=Si(B.L.N,B.L.O.M,this.M),this.ca)switch(B.L.S===void 0&&fe("Passing raw pointer to smart pointer is illegal"),this.Aa){case 0:B.L.T===this?L=B.L.S:fe("Cannot convert argument of type "+(B.L.T?B.L.T.name:B.L.O.name)+" to parameter type "+this.name);break;case 1:L=B.L.S;break;case 2:if(B.L.T===this)L=B.L.S;else{var N=B.clone();L=this.wa(L,Me(function(){N.delete()})),v!==null&&v.push(this.V,L)}break;default:fe("Unsupporting sharing policy")}return L}function n1(v,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+Tl(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),B.L.O.ba&&fe("Cannot convert argument of type "+B.L.O.name+" to parameter type "+this.name),Si(B.L.N,B.L.O.M,this.M))}function Rr(v,B,L,N){this.name=v,this.M=B,this.da=L,this.ba=N,this.ca=!1,this.V=this.wa=this.ea=this.ja=this.Aa=this.va=void 0,B.P!==void 0?this.toWireType=$n:(this.toWireType=N?Ri:n1,this.U=null)}function i1(v,B){s.hasOwnProperty(v)||Er("Replacing nonexistant public symbol"),s[v]=B,s[v].Y=void 0}function s1(v,B){var L=[];return function(){if(L.length=0,Object.assign(L,arguments),v.includes("j")){var N=s["dynCall_"+v];N=L&&L.length?N.apply(null,[B].concat(L)):N.call(null,B)}else N=O.get(B).apply(null,L);return N}}function rr(v,B){v=Te(v);var L=v.includes("j")?s1(v,B):O.get(B);return typeof L!="function"&&fe("unknown function pointer with signature "+v+": "+B),L}var wd=void 0;function eo(v,B){function L(Z){H[Z]||z[Z]||(Fe[Z]?Fe[Z].forEach(L):(N.push(Z),H[Z]=!0))}var N=[],H={};throw B.forEach(L),new wd(v+": "+N.map(j).join([", "]))}function Cl(v,B,L,N,H){var Z=B.length;2>Z&&fe("argTypes array size mismatch! Must at least get return value and 'this' types!");var se=B[1]!==null&&L!==null,oe=!1;for(L=1;L<B.length;++L)if(B[L]!==null&&B[L].U===void 0){oe=!0;break}var Ae=B[0].name!=="void",ae=Z-2,ue=Array(ae),ye=[],Ue=[];return function(){if(arguments.length!==ae&&fe("function "+v+" called with "+arguments.length+" arguments, expected "+ae+" args!"),Ue.length=0,ye.length=se?2:1,ye[0]=H,se){var at=B[1].toWireType(Ue,this);ye[1]=at}for(var Ye=0;Ye<ae;++Ye)ue[Ye]=B[Ye+2].toWireType(Ue,arguments[Ye]),ye.push(ue[Ye]);if(Ye=N.apply(null,ye),oe)de(Ue);else for(var Gt=se?1:2;Gt<B.length;Gt++){var nr=Gt===1?at:ue[Gt-2];B[Gt].U!==null&&B[Gt].U(nr)}return at=Ae?B[0].fromWireType(Ye):void 0,at}}function yl(v,B){for(var L=[],N=0;N<v;N++)L.push(R[B+4*N>>2]);return L}function Bl(v){4<v&&--ge[v].fa===0&&(ge[v]=void 0,Se.push(v))}function Tl(v){if(v===null)return"null";var B=typeof v;return B==="object"||B==="array"||B==="function"?v.toString():""+v}function o1(v,B){switch(B){case 2:return function(L){return this.fromWireType(k[L>>2])};case 3:return function(L){return this.fromWireType($[L>>3])};default:throw new TypeError("Unknown float type: "+v)}}function a1(v,B,L){switch(B){case 0:return L?function(N){return C[N]}:function(N){return Q[N]};case 1:return L?function(N){return b[N>>1]}:function(N){return y[N>>1]};case 2:return L?function(N){return w[N>>2]}:function(N){return R[N>>2]};default:throw new TypeError("Unknown integer type: "+v)}}function l1(v,B){for(var L="",N=0;!(N>=B/2);++N){var H=b[v+2*N>>1];if(H==0)break;L+=String.fromCharCode(H)}return L}function A1(v,B,L){if(L===void 0&&(L=2147483647),2>L)return 0;L-=2;var N=B;L=L<2*v.length?L/2:v.length;for(var H=0;H<L;++H)b[B>>1]=v.charCodeAt(H),B+=2;return b[B>>1]=0,B-N}function c1(v){return 2*v.length}function u1(v,B){for(var L=0,N="";!(L>=B/4);){var H=w[v+4*L>>2];if(H==0)break;++L,65536<=H?(H-=65536,N+=String.fromCharCode(55296|H>>10,56320|H&1023)):N+=String.fromCharCode(H)}return N}function h1(v,B,L){if(L===void 0&&(L=2147483647),4>L)return 0;var N=B;L=N+L-4;for(var H=0;H<v.length;++H){var Z=v.charCodeAt(H);if(55296<=Z&&57343>=Z){var se=v.charCodeAt(++H);Z=65536+((Z&1023)<<10)|se&1023}if(w[B>>2]=Z,B+=4,B+4>L)break}return w[B>>2]=0,B-N}function d1(v){for(var B=0,L=0;L<v.length;++L){var N=v.charCodeAt(L);55296<=N&&57343>=N&&++L,B+=4}return B}var f1={};function Sd(v){var B=f1[v];return B===void 0?Te(v):B}var to=[];function g1(v){var B=to.length;return to.push(v),B}function p1(v,B){for(var L=Array(v),N=0;N<v;++N)L[N]=Ie(R[B+4*N>>2],"parameter "+N);return L}var Rd=[],m1=[null,[],[]];Ge=s.BindingError=Le("BindingError"),s.count_emval_handles=function(){for(var v=0,B=5;B<ge.length;++B)ge[B]!==void 0&&++v;return v},s.get_first_emval=function(){for(var v=5;v<ge.length;++v)if(ge[v]!==void 0)return ge[v];return null},we=s.PureVirtualError=Le("PureVirtualError");for(var Dd=Array(256),ro=0;256>ro;++ro)Dd[ro]=String.fromCharCode(ro);We=Dd,s.getInheritedInstanceCount=function(){return Object.keys(x).length},s.getLiveInheritedInstances=function(){var v=[],B;for(B in x)x.hasOwnProperty(B)&&v.push(x[B]);return v},s.flushPendingDeletes=m,s.setDelayFunction=function(v){E=v,T.length&&E&&E(m)},Ut=s.InternalError=Le("InternalError"),St.prototype.isAliasOf=function(v){if(!(this instanceof St&&v instanceof St))return!1;var B=this.L.O.M,L=this.L.N,N=v.L.O.M;for(v=v.L.N;B.P;)L=B.aa(L),B=B.P;for(;N.P;)v=N.aa(v),N=N.P;return B===N&&L===v},St.prototype.clone=function(){if(this.L.N||Gn(this),this.L.$)return this.L.count.value+=1,this;var v=Tt,B=Object,L=B.create,N=Object.getPrototypeOf(this),H=this.L;return v=v(L.call(B,N,{L:{value:{count:H.count,Z:H.Z,$:H.$,N:H.N,O:H.O,S:H.S,T:H.T}}})),v.L.count.value+=1,v.L.Z=!1,v},St.prototype.delete=function(){this.L.N||Gn(this),this.L.Z&&!this.L.$&&fe("Object already scheduled for deletion"),be(this),ke(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||Gn(this),this.L.Z&&!this.L.$&&fe("Object already scheduled for deletion"),T.push(this),T.length===1&&E&&E(m),this.L.Z=!0,this},Rr.prototype.pa=function(v){return this.ja&&(v=this.ja(v)),v},Rr.prototype.ga=function(v){this.V&&this.V(v)},Rr.prototype.argPackAdvance=8,Rr.prototype.readValueFromPointer=ve,Rr.prototype.deleteObject=function(v){v!==null&&v.delete()},Rr.prototype.fromWireType=function(v){function B(){return this.ca?Ir(this.M.W,{O:this.va,N:L,T:this,S:v}):Ir(this.M.W,{O:this,N:v})}var L=this.pa(v);if(!L)return this.ga(v),null;var N=ut(this.M,L);if(N!==void 0)return N.L.count.value===0?(N.L.N=L,N.L.S=v,N.clone()):(N=N.clone(),this.ga(v),N);if(N=this.M.oa(L),N=Mt[N],!N)return B.call(this);N=this.ba?N.ka:N.pointerType;var H=_e(L,this.M,N.M);return H===null?B.call(this):this.ca?Ir(N.M.W,{O:N,N:H,T:this,S:v}):Ir(N.M.W,{O:N,N:H})},wd=s.UnboundTypeError=Le("UnboundTypeError");var E1=typeof atob=="function"?atob:function(v){var B="",L=0;v=v.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(v.charAt(L++)),H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(v.charAt(L++)),Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(v.charAt(L++)),se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(v.charAt(L++));N=N<<2|H>>4,H=(H&15)<<4|Z>>2;var oe=(Z&3)<<6|se;B+=String.fromCharCode(N),Z!==64&&(B+=String.fromCharCode(H)),se!==64&&(B+=String.fromCharCode(oe))}while(L<v.length);return B},I1={p:function(v,B,L){v=Te(v),B=Ie(B,"wrapper"),L=Qe(L);var N=[].slice,H=B.M,Z=H.W,se=H.P.W,oe=H.P.constructor;v=pe(v,function(){H.P.ia.forEach((function(ae){if(this[ae]===se[ae])throw new we("Pure virtual function "+ae+" must be implemented in JavaScript")}).bind(this)),Object.defineProperty(this,"__parent",{value:Z}),this.__construct.apply(this,N.call(arguments))}),Z.__construct=function(){this===Z&&fe("Pass correct 'this' to __construct");var ae=oe.implement.apply(void 0,[this].concat(N.call(arguments)));be(ae);var ue=ae.L;ae.notifyOnDestruction(),ue.$=!0,Object.defineProperties(this,{L:{value:ue}}),Tt(this),ae=ue.N,ae=M(H,ae),x.hasOwnProperty(ae)?fe("Tried to register registered instance: "+ae):x[ae]=this},Z.__destruct=function(){this===Z&&fe("Pass correct 'this' to __destruct"),be(this);var ae=this.L.N;ae=M(H,ae),x.hasOwnProperty(ae)?delete x[ae]:fe("Tried to unregister unregistered instance: "+ae)},v.prototype=Object.create(Z);for(var Ae in L)v.prototype[Ae]=L[Ae];return Me(v)},j:function(v){var B=q[v];delete q[v];var L=B.ea,N=B.V,H=B.ha,Z=H.map(se=>se.sa).concat(H.map(se=>se.ya));qe([v],Z,se=>{var oe={};return H.forEach((Ae,ae)=>{var ue=se[ae],ye=Ae.qa,Ue=Ae.ra,at=se[ae+H.length],Ye=Ae.xa,Gt=Ae.za;oe[Ae.na]={read:nr=>ue.fromWireType(ye(Ue,nr)),write:(nr,Di)=>{var _r=[];Ye(Gt,nr,at.toWireType(_r,Di)),de(_r)}}}),[{name:B.name,fromWireType:function(Ae){var ae={},ue;for(ue in oe)ae[ue]=oe[ue].read(Ae);return N(Ae),ae},toWireType:function(Ae,ae){for(var ue in oe)if(!(ue in ae))throw new TypeError('Missing field: "'+ue+'"');var ye=L();for(ue in oe)oe[ue].write(ye,ae[ue]);return Ae!==null&&Ae.push(N,ye),ye},argPackAdvance:8,readValueFromPointer:ve,U:N}]})},v:function(){},B:function(v,B,L,N,H){var Z=xt(L);B=Te(B),wt(v,{name:B,fromWireType:function(se){return!!se},toWireType:function(se,oe){return oe?N:H},argPackAdvance:8,readValueFromPointer:function(se){if(L===1)var oe=C;else if(L===2)oe=b;else if(L===4)oe=w;else throw new TypeError("Unknown boolean type size: "+B);return this.fromWireType(oe[se>>Z])},U:null})},f:function(v,B,L,N,H,Z,se,oe,Ae,ae,ue,ye,Ue){ue=Te(ue),Z=rr(H,Z),oe&&(oe=rr(se,oe)),ae&&(ae=rr(Ae,ae)),Ue=rr(ye,Ue);var at=ce(ue);Hn(at,function(){eo("Cannot construct "+ue+" due to unbound types",[N])}),qe([v,B,L],N?[N]:[],function(Ye){if(Ye=Ye[0],N)var Gt=Ye.M,nr=Gt.W;else nr=St.prototype;Ye=pe(at,function(){if(Object.getPrototypeOf(this)!==Di)throw new Ge("Use 'new' to construct "+ue);if(_r.X===void 0)throw new Ge(ue+" has no accessible constructor");var kd=_r.X[arguments.length];if(kd===void 0)throw new Ge("Tried to invoke ctor of "+ue+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(_r.X).toString()+") parameters instead!");return kd.apply(this,arguments)});var Di=Object.create(nr,{constructor:{value:Ye}});Ye.prototype=Di;var _r=new Hr(ue,Ye,Di,Ue,Gt,Z,oe,ae);Gt=new Rr(ue,_r,!0,!1),nr=new Rr(ue+"*",_r,!1,!1);var Fd=new Rr(ue+" const*",_r,!1,!0);return Mt[v]={pointerType:nr,ka:Fd},i1(at,Ye),[Gt,nr,Fd]})},c:function(v,B,L,N,H,Z,se){var oe=yl(L,N);B=Te(B),Z=rr(H,Z),qe([],[v],function(Ae){function ae(){eo("Cannot call "+ue+" due to unbound types",oe)}Ae=Ae[0];var ue=Ae.name+"."+B;B.startsWith("@@")&&(B=Symbol[B.substring(2)]);var ye=Ae.M.constructor;return ye[B]===void 0?(ae.Y=L-1,ye[B]=ae):(hn(ye,B,ue),ye[B].R[L-1]=ae),qe([],oe,function(Ue){return Ue=Cl(ue,[Ue[0],null].concat(Ue.slice(1)),null,Z,se),ye[B].R===void 0?(Ue.Y=L-1,ye[B]=Ue):ye[B].R[L-1]=Ue,[]}),[]})},o:function(v,B,L,N,H,Z){0<B||X();var se=yl(B,L);H=rr(N,H),qe([],[v],function(oe){oe=oe[0];var Ae="constructor "+oe.name;if(oe.M.X===void 0&&(oe.M.X=[]),oe.M.X[B-1]!==void 0)throw new Ge("Cannot register multiple constructors with identical number of parameters ("+(B-1)+") for class '"+oe.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return oe.M.X[B-1]=()=>{eo("Cannot construct "+oe.name+" due to unbound types",se)},qe([],se,function(ae){return ae.splice(1,0,null),oe.M.X[B-1]=Cl(Ae,ae,null,H,Z),[]}),[]})},a:function(v,B,L,N,H,Z,se,oe){var Ae=yl(L,N);B=Te(B),Z=rr(H,Z),qe([],[v],function(ae){function ue(){eo("Cannot call "+ye+" due to unbound types",Ae)}ae=ae[0];var ye=ae.name+"."+B;B.startsWith("@@")&&(B=Symbol[B.substring(2)]),oe&&ae.M.ia.push(B);var Ue=ae.M.W,at=Ue[B];return at===void 0||at.R===void 0&&at.className!==ae.name&&at.Y===L-2?(ue.Y=L-2,ue.className=ae.name,Ue[B]=ue):(hn(Ue,B,ye),Ue[B].R[L-2]=ue),qe([],Ae,function(Ye){return Ye=Cl(ye,Ye,ae,Z,se),Ue[B].R===void 0?(Ye.Y=L-2,Ue[B]=Ye):Ue[B].R[L-2]=Ye,[]}),[]})},A:function(v,B){B=Te(B),wt(v,{name:B,fromWireType:function(L){var N=Qe(L);return Bl(L),N},toWireType:function(L,N){return Me(N)},argPackAdvance:8,readValueFromPointer:ve,U:null})},m:function(v,B,L){L=xt(L),B=Te(B),wt(v,{name:B,fromWireType:function(N){return N},toWireType:function(N,H){return H},argPackAdvance:8,readValueFromPointer:o1(B,L),U:null})},d:function(v,B,L,N,H){B=Te(B),H===-1&&(H=4294967295),H=xt(L);var Z=oe=>oe;if(N===0){var se=32-8*L;Z=oe=>oe<<se>>>se}L=B.includes("unsigned")?function(oe,Ae){return Ae>>>0}:function(oe,Ae){return Ae},wt(v,{name:B,fromWireType:Z,toWireType:L,argPackAdvance:8,readValueFromPointer:a1(B,H,N!==0),U:null})},b:function(v,B,L){function N(Z){Z>>=2;var se=R;return new H(p,se[Z+1],se[Z])}var H=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][B];L=Te(L),wt(v,{name:L,fromWireType:N,argPackAdvance:8,readValueFromPointer:N},{ta:!0})},n:function(v,B){B=Te(B);var L=B==="std::string";wt(v,{name:B,fromWireType:function(N){var H=R[N>>2],Z=N+4;if(L)for(var se=Z,oe=0;oe<=H;++oe){var Ae=Z+oe;if(oe==H||Q[Ae]==0){if(se=se?g(Q,se,Ae-se):"",ae===void 0)var ae=se;else ae+="\0",ae+=se;se=Ae+1}}else{for(ae=Array(H),oe=0;oe<H;++oe)ae[oe]=String.fromCharCode(Q[Z+oe]);ae=ae.join("")}return Dr(N),ae},toWireType:function(N,H){H instanceof ArrayBuffer&&(H=new Uint8Array(H));var Z,se=typeof H=="string";if(se||H instanceof Uint8Array||H instanceof Uint8ClampedArray||H instanceof Int8Array||fe("Cannot pass non-string to std::string"),L&&se){var oe=0;for(Z=0;Z<H.length;++Z){var Ae=H.charCodeAt(Z);127>=Ae?oe++:2047>=Ae?oe+=2:55296<=Ae&&57343>=Ae?(oe+=4,++Z):oe+=3}Z=oe}else Z=H.length;if(oe=Ql(4+Z+1),Ae=oe+4,R[oe>>2]=Z,L&&se){if(se=Ae,Ae=Z+1,Z=Q,0<Ae){Ae=se+Ae-1;for(var ae=0;ae<H.length;++ae){var ue=H.charCodeAt(ae);if(55296<=ue&&57343>=ue){var ye=H.charCodeAt(++ae);ue=65536+((ue&1023)<<10)|ye&1023}if(127>=ue){if(se>=Ae)break;Z[se++]=ue}else{if(2047>=ue){if(se+1>=Ae)break;Z[se++]=192|ue>>6}else{if(65535>=ue){if(se+2>=Ae)break;Z[se++]=224|ue>>12}else{if(se+3>=Ae)break;Z[se++]=240|ue>>18,Z[se++]=128|ue>>12&63}Z[se++]=128|ue>>6&63}Z[se++]=128|ue&63}}Z[se]=0}}else if(se)for(se=0;se<Z;++se)ae=H.charCodeAt(se),255<ae&&(Dr(Ae),fe("String has UTF-16 code units that do not fit in 8 bits")),Q[Ae+se]=ae;else for(se=0;se<Z;++se)Q[Ae+se]=H[se];return N!==null&&N.push(Dr,oe),oe},argPackAdvance:8,readValueFromPointer:ve,U:function(N){Dr(N)}})},i:function(v,B,L){if(L=Te(L),B===2)var N=l1,H=A1,Z=c1,se=()=>y,oe=1;else B===4&&(N=u1,H=h1,Z=d1,se=()=>R,oe=2);wt(v,{name:L,fromWireType:function(Ae){for(var ae=R[Ae>>2],ue=se(),ye,Ue=Ae+4,at=0;at<=ae;++at){var Ye=Ae+4+at*B;(at==ae||ue[Ye>>oe]==0)&&(Ue=N(Ue,Ye-Ue),ye===void 0?ye=Ue:(ye+="\0",ye+=Ue),Ue=Ye+B)}return Dr(Ae),ye},toWireType:function(Ae,ae){typeof ae!="string"&&fe("Cannot pass non-string to C++ string type "+L);var ue=Z(ae),ye=Ql(4+ue+B);return R[ye>>2]=ue>>oe,H(ae,ye+4,ue+B),Ae!==null&&Ae.push(Dr,ye),ye},argPackAdvance:8,readValueFromPointer:ve,U:function(Ae){Dr(Ae)}})},k:function(v,B,L,N,H,Z){q[v]={name:Te(B),ea:rr(L,N),V:rr(H,Z),ha:[]}},h:function(v,B,L,N,H,Z,se,oe,Ae,ae){q[v].ha.push({na:Te(B),sa:L,qa:rr(N,H),ra:Z,ya:se,xa:rr(oe,Ae),za:ae})},C:function(v,B){B=Te(B),wt(v,{ua:!0,name:B,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(v,B,L,N,H){v=to[v],B=Qe(B),L=Sd(L);var Z=[];return R[N>>2]=Me(Z),v(B,L,Z,H)},t:function(v,B,L,N){v=to[v],B=Qe(B),L=Sd(L),v(B,L,null,N)},g:Bl,l:function(v,B){var L=p1(v,B),N=L[0];B=N.name+"_$"+L.slice(1).map(function(se){return se.name}).join("_")+"$";var H=Rd[B];if(H!==void 0)return H;var Z=Array(v-1);return H=g1((se,oe,Ae,ae)=>{for(var ue=0,ye=0;ye<v-1;++ye)Z[ye]=L[ye+1].readValueFromPointer(ae+ue),ue+=L[ye+1].argPackAdvance;for(se=se[oe].apply(se,Z),ye=0;ye<v-1;++ye)L[ye+1].la&&L[ye+1].la(Z[ye]);if(!N.ua)return N.toWireType(Ae,se)}),Rd[B]=H},q:function(v){4<v&&(ge[v].fa+=1)},r:function(v){var B=Qe(v);de(B),Bl(v)},e:function(){X("")},x:function(v,B,L){Q.copyWithin(v,B,B+L)},w:function(v){var B=Q.length;if(v>>>=0,2147483648<v)return!1;for(var L=1;4>=L;L*=2){var N=B*(1+.2/L);N=Math.min(N,v+100663296);var H=Math;N=Math.max(v,N),H=H.min.call(H,2147483648,N+(65536-N%65536)%65536);e:{try{d.grow(H-p.byteLength+65535>>>16),K();var Z=1;break e}catch{}Z=void 0}if(Z)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(v,B,L,N){for(var H=0,Z=0;Z<L;Z++){var se=R[B>>2],oe=R[B+4>>2];B+=8;for(var Ae=0;Ae<oe;Ae++){var ae=Q[se+Ae],ue=m1[v];ae===0||ae===10?((v===1?c:u)(g(ue,0)),ue.length=0):ue.push(ae)}H+=oe}return R[N>>2]=H,0}};(function(){function v(H){s.asm=H.exports,d=s.asm.D,K(),O=s.asm.I,ie.unshift(s.asm.E),_--,s.monitorRunDependencies&&s.monitorRunDependencies(_),_==0&&P&&(H=P,P=null,H())}function B(H){v(H.instance)}function L(H){return Y().then(function(Z){return WebAssembly.instantiate(Z,N)}).then(function(Z){return Z}).then(H,function(Z){u("failed to asynchronously prepare wasm: "+Z),X(Z)})}var N={a:I1};if(_++,s.monitorRunDependencies&&s.monitorRunDependencies(_),s.instantiateWasm)try{return s.instantiateWasm(N,v)}catch(H){u("Module.instantiateWasm callback failed with error: "+H),a(H)}return function(){return h||typeof WebAssembly.instantiateStreaming!="function"||D(S)||typeof fetch!="function"?L(B):fetch(S,{credentials:"same-origin"}).then(function(H){return WebAssembly.instantiateStreaming(H,N).then(B,function(Z){return u("wasm streaming compile failed: "+Z),u("falling back to ArrayBuffer instantiation"),L(B)})})}().catch(a),{}})(),s.___wasm_call_ctors=function(){return(s.___wasm_call_ctors=s.asm.E).apply(null,arguments)};var _d=s.___getTypeName=function(){return(_d=s.___getTypeName=s.asm.F).apply(null,arguments)};s.__embind_initialize_bindings=function(){return(s.__embind_initialize_bindings=s.asm.G).apply(null,arguments)};var Ql=s._malloc=function(){return(Ql=s._malloc=s.asm.H).apply(null,arguments)},Dr=s._free=function(){return(Dr=s._free=s.asm.J).apply(null,arguments)};s.dynCall_jiji=function(){return(s.dynCall_jiji=s.asm.K).apply(null,arguments)};var no;P=function v(){no||Ld(),no||(P=v)};function Ld(){function v(){if(!no&&(no=!0,s.calledRun=!0,!f)){if(ne(ie),o(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;){var B=s.postRun.shift();ee.unshift(B)}ne(ee)}}if(!(0<_)){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)le();ne(J),0<_||(s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),v()},1)):v())}}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);0<s.preInit.length;)s.preInit.pop()();return Ld(),i.ready}})();r.exports=t})(rA);var Yf=rA.exports;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e={loadYoga:!0};r.loadYoga=o;var t=i(Eo),n=Re;Object.keys(n).forEach(function(a){a==="default"||a==="__esModule"||Object.prototype.hasOwnProperty.call(e,a)||a in r&&r[a]===n[a]||Object.defineProperty(r,a,{enumerable:!0,get:function(){return n[a]}})});function i(a){return a&&a.__esModule?a:{default:a}}const s=Yf;async function o(){return(0,t.default)(await s())}})(eA);function Vf(r){for(var e=new Array(r),t=0;t<r;++t)e[t]=t;return e}var Kf=Vf;/*!
65
+ `+p(_,F)):Y}}function X(_,S){var F;return S.cache&&S.name&&S.storage.templates.get(S.name)?S.storage.templates.get(S.name):(F=typeof _=="function"?_:P(_,S),S.cache&&S.name&&S.storage.templates.define(S.name,F),F)}le.l.bind(le),t.compile=P,t.compileScope=w,t.compileScopeIntoFunction=C,t.compileToString=p,t.defaultConfig=le,t.filters=te,t.getConfig=D,t.helpers=W,t.nativeHelpers=ie,t.parse=g,t.render=function(_,S,F,J){var Y=D(F||{});if(!Y.async)return X(_,Y)(S,Y);if(!J){if(typeof s=="function")return new s(function(ne,ce){try{ne(X(_,Y)(S,Y))}catch(pe){ce(pe)}});throw n("Please provide a callback function, this env doesn't support Promises")}try{X(_,Y)(S,Y,J)}catch(ne){return J(ne)}},t.templates=O,Object.defineProperty(t,"__esModule",{value:!0})})})(mo,mo.exports);var Df=mo.exports;const _f=(r,e,t,n)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const i=Object.getOwnPropertyDescriptor(r,t),s=Object.getOwnPropertyDescriptor(e,t);!Lf(i,s)&&n||Object.defineProperty(r,t,s)},Lf=function(r,e){return r===void 0||r.configurable||r.writable===e.writable&&r.enumerable===e.enumerable&&r.configurable===e.configurable&&(r.writable||r.value===e.value)},Ff=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},kf=(r,e)=>`/* Wrapped ${r}*/
66
+ ${e}`,Nf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mf=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Pf=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,i=kf.bind(null,n,e.toString());Object.defineProperty(i,"name",Mf),Object.defineProperty(r,"toString",{...Nf,value:i})};function Of(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const i of Reflect.ownKeys(e))_f(r,e,i,t);return Ff(r,e),Pf(r,e,n),r}const Uf=new WeakMap;function Wr(r,{cacheKey:e=([n])=>n,cache:t=new Map}={}){const n=new Map,i=function(...s){const o=e(s);if(n.has(o))return n.get(o);const a=(async()=>{try{if(t&&await t.has(o))return await t.get(o);const A=await r.apply(this,s);try{return A}finally{t&&await t.set(o,A)}}finally{n.delete(o)}})();return n.set(o,a),a};return Of(i,r,{ignoreNonConfigurable:!0}),Uf.set(i,t),i}var eA={},Eo={},Re={};Object.defineProperty(Re,"__esModule",{value:!0}),Re.default=Re.Wrap=Re.Unit=Re.PrintOptions=Re.PositionType=Re.Overflow=Re.NodeType=Re.MeasureMode=Re.LogLevel=Re.Justify=Re.Gutter=Re.FlexDirection=Re.ExperimentalFeature=Re.Errata=Re.Edge=Re.Display=Re.Direction=Re.Dimension=Re.Align=void 0;let yr=function(r){return r[r.Auto=0]="Auto",r[r.FlexStart=1]="FlexStart",r[r.Center=2]="Center",r[r.FlexEnd=3]="FlexEnd",r[r.Stretch=4]="Stretch",r[r.Baseline=5]="Baseline",r[r.SpaceBetween=6]="SpaceBetween",r[r.SpaceAround=7]="SpaceAround",r}({});Re.Align=yr;let Io=function(r){return r[r.Width=0]="Width",r[r.Height=1]="Height",r}({});Re.Dimension=Io;let Gi=function(r){return r[r.Inherit=0]="Inherit",r[r.LTR=1]="LTR",r[r.RTL=2]="RTL",r}({});Re.Direction=Gi;let vo=function(r){return r[r.Flex=0]="Flex",r[r.None=1]="None",r}({});Re.Display=vo;let ir=function(r){return r[r.Left=0]="Left",r[r.Top=1]="Top",r[r.Right=2]="Right",r[r.Bottom=3]="Bottom",r[r.Start=4]="Start",r[r.End=5]="End",r[r.Horizontal=6]="Horizontal",r[r.Vertical=7]="Vertical",r[r.All=8]="All",r}({});Re.Edge=ir;let ti=function(r){return r[r.None=0]="None",r[r.StretchFlexBasis=1]="StretchFlexBasis",r[r.All=2147483647]="All",r[r.Classic=2147483646]="Classic",r}({});Re.Errata=ti;let Hi=function(r){return r[r.WebFlexBasis=0]="WebFlexBasis",r[r.AbsolutePercentageAgainstPaddingEdge=1]="AbsolutePercentageAgainstPaddingEdge",r[r.FixJNILocalRefOverflows=2]="FixJNILocalRefOverflows",r}({});Re.ExperimentalFeature=Hi;let ri=function(r){return r[r.Column=0]="Column",r[r.ColumnReverse=1]="ColumnReverse",r[r.Row=2]="Row",r[r.RowReverse=3]="RowReverse",r}({});Re.FlexDirection=ri;let $i=function(r){return r[r.Column=0]="Column",r[r.Row=1]="Row",r[r.All=2]="All",r}({});Re.Gutter=$i;let qr=function(r){return r[r.FlexStart=0]="FlexStart",r[r.Center=1]="Center",r[r.FlexEnd=2]="FlexEnd",r[r.SpaceBetween=3]="SpaceBetween",r[r.SpaceAround=4]="SpaceAround",r[r.SpaceEvenly=5]="SpaceEvenly",r}({});Re.Justify=qr;let Xr=function(r){return r[r.Error=0]="Error",r[r.Warn=1]="Warn",r[r.Info=2]="Info",r[r.Debug=3]="Debug",r[r.Verbose=4]="Verbose",r[r.Fatal=5]="Fatal",r}({});Re.LogLevel=Xr;let Yi=function(r){return r[r.Undefined=0]="Undefined",r[r.Exactly=1]="Exactly",r[r.AtMost=2]="AtMost",r}({});Re.MeasureMode=Yi;let Co=function(r){return r[r.Default=0]="Default",r[r.Text=1]="Text",r}({});Re.NodeType=Co;let Vi=function(r){return r[r.Visible=0]="Visible",r[r.Hidden=1]="Hidden",r[r.Scroll=2]="Scroll",r}({});Re.Overflow=Vi;let Ki=function(r){return r[r.Static=0]="Static",r[r.Relative=1]="Relative",r[r.Absolute=2]="Absolute",r}({});Re.PositionType=Ki;let Ji=function(r){return r[r.Layout=1]="Layout",r[r.Style=2]="Style",r[r.Children=4]="Children",r}({});Re.PrintOptions=Ji;let ni=function(r){return r[r.Undefined=0]="Undefined",r[r.Point=1]="Point",r[r.Percent=2]="Percent",r[r.Auto=3]="Auto",r}({});Re.Unit=ni;let Wi=function(r){return r[r.NoWrap=0]="NoWrap",r[r.Wrap=1]="Wrap",r[r.WrapReverse=2]="WrapReverse",r}({});Re.Wrap=Wi;var Gf={ALIGN_AUTO:yr.Auto,ALIGN_FLEX_START:yr.FlexStart,ALIGN_CENTER:yr.Center,ALIGN_FLEX_END:yr.FlexEnd,ALIGN_STRETCH:yr.Stretch,ALIGN_BASELINE:yr.Baseline,ALIGN_SPACE_BETWEEN:yr.SpaceBetween,ALIGN_SPACE_AROUND:yr.SpaceAround,DIMENSION_WIDTH:Io.Width,DIMENSION_HEIGHT:Io.Height,DIRECTION_INHERIT:Gi.Inherit,DIRECTION_LTR:Gi.LTR,DIRECTION_RTL:Gi.RTL,DISPLAY_FLEX:vo.Flex,DISPLAY_NONE:vo.None,EDGE_LEFT:ir.Left,EDGE_TOP:ir.Top,EDGE_RIGHT:ir.Right,EDGE_BOTTOM:ir.Bottom,EDGE_START:ir.Start,EDGE_END:ir.End,EDGE_HORIZONTAL:ir.Horizontal,EDGE_VERTICAL:ir.Vertical,EDGE_ALL:ir.All,ERRATA_NONE:ti.None,ERRATA_STRETCH_FLEX_BASIS:ti.StretchFlexBasis,ERRATA_ALL:ti.All,ERRATA_CLASSIC:ti.Classic,EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS:Hi.WebFlexBasis,EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE:Hi.AbsolutePercentageAgainstPaddingEdge,EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS:Hi.FixJNILocalRefOverflows,FLEX_DIRECTION_COLUMN:ri.Column,FLEX_DIRECTION_COLUMN_REVERSE:ri.ColumnReverse,FLEX_DIRECTION_ROW:ri.Row,FLEX_DIRECTION_ROW_REVERSE:ri.RowReverse,GUTTER_COLUMN:$i.Column,GUTTER_ROW:$i.Row,GUTTER_ALL:$i.All,JUSTIFY_FLEX_START:qr.FlexStart,JUSTIFY_CENTER:qr.Center,JUSTIFY_FLEX_END:qr.FlexEnd,JUSTIFY_SPACE_BETWEEN:qr.SpaceBetween,JUSTIFY_SPACE_AROUND:qr.SpaceAround,JUSTIFY_SPACE_EVENLY:qr.SpaceEvenly,LOG_LEVEL_ERROR:Xr.Error,LOG_LEVEL_WARN:Xr.Warn,LOG_LEVEL_INFO:Xr.Info,LOG_LEVEL_DEBUG:Xr.Debug,LOG_LEVEL_VERBOSE:Xr.Verbose,LOG_LEVEL_FATAL:Xr.Fatal,MEASURE_MODE_UNDEFINED:Yi.Undefined,MEASURE_MODE_EXACTLY:Yi.Exactly,MEASURE_MODE_AT_MOST:Yi.AtMost,NODE_TYPE_DEFAULT:Co.Default,NODE_TYPE_TEXT:Co.Text,OVERFLOW_VISIBLE:Vi.Visible,OVERFLOW_HIDDEN:Vi.Hidden,OVERFLOW_SCROLL:Vi.Scroll,POSITION_TYPE_STATIC:Ki.Static,POSITION_TYPE_RELATIVE:Ki.Relative,POSITION_TYPE_ABSOLUTE:Ki.Absolute,PRINT_OPTIONS_LAYOUT:Ji.Layout,PRINT_OPTIONS_STYLE:Ji.Style,PRINT_OPTIONS_CHILDREN:Ji.Children,UNIT_UNDEFINED:ni.Undefined,UNIT_POINT:ni.Point,UNIT_PERCENT:ni.Percent,UNIT_AUTO:ni.Auto,WRAP_NO_WRAP:Wi.NoWrap,WRAP_WRAP:Wi.Wrap,WRAP_WRAP_REVERSE:Wi.WrapReverse};Re.default=Gf,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.default=$f;var kr=Hf(Re);function tA(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(tA=function(n){return n?t:e})(r)}function Hf(r,e){if(!e&&r&&r.__esModule)return r;if(r===null||typeof r!="object"&&typeof r!="function")return{default:r};var t=tA(e);if(t&&t.has(r))return t.get(r);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in r)if(s!=="default"&&Object.prototype.hasOwnProperty.call(r,s)){var o=i?Object.getOwnPropertyDescriptor(r,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=r[s]}return n.default=r,t&&t.set(r,n),n}function $f(r){function e(i,s,o){const a=i[s];i[s]=function(){for(var l=arguments.length,A=new Array(l),c=0;c<l;c++)A[c]=arguments[c];return o.call(this,a,...A)}}for(const i of["setPosition","setMargin","setFlexBasis","setWidth","setHeight","setMinWidth","setMinHeight","setMaxWidth","setMaxHeight","setPadding"]){const s={[kr.Unit.Point]:r.Node.prototype[i],[kr.Unit.Percent]:r.Node.prototype[`${i}Percent`],[kr.Unit.Auto]:r.Node.prototype[`${i}Auto`]};e(r.Node.prototype,i,function(o){for(var a=arguments.length,l=new Array(a>1?a-1:0),A=1;A<a;A++)l[A-1]=arguments[A];const c=l.pop();let u,h;if(c==="auto")u=kr.Unit.Auto,h=void 0;else if(typeof c=="object")u=c.unit,h=c.valueOf();else if(u=typeof c=="string"&&c.endsWith("%")?kr.Unit.Percent:kr.Unit.Point,h=parseFloat(c),!Number.isNaN(c)&&Number.isNaN(h))throw new Error(`Invalid value ${c} for ${i}`);if(!s[u])throw new Error(`Failed to execute "${i}": Unsupported unit '${c}'`);return h!==void 0?s[u].call(this,...l,h):s[u].call(this,...l)})}function t(i){return r.MeasureCallback.implement({measure:function(){const{width:s,height:o}=i(...arguments);return{width:s??NaN,height:o??NaN}}})}e(r.Node.prototype,"setMeasureFunc",function(i,s){return s?i.call(this,t(s)):this.unsetMeasureFunc()});function n(i){return r.DirtiedCallback.implement({dirtied:i})}return e(r.Node.prototype,"setDirtiedFunc",function(i,s){i.call(this,n(s))}),e(r.Config.prototype,"free",function(){r.Config.destroy(this)}),e(r.Node,"create",(i,s)=>s?r.Node.createWithConfig(s):r.Node.createDefault()),e(r.Node.prototype,"free",function(){r.Node.destroy(this)}),e(r.Node.prototype,"freeRecursive",function(){for(let i=0,s=this.getChildCount();i<s;++i)this.getChild(0).freeRecursive();this.free()}),e(r.Node.prototype,"calculateLayout",function(i){let s=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]:kr.Direction.LTR;return i.call(this,s,o,a)}),{Config:r.Config,Node:r.Node,...kr.default}}var rA={exports:{}};(function(r,e){var t=(()=>{var n=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(i){i=i||{};var s;s||(s=typeof i<"u"?i:{});var o,a;s.ready=new Promise(function(v,B){o=v,a=B});var l=Object.assign({},s),A="";typeof document<"u"&&document.currentScript&&(A=document.currentScript.src),n&&(A=n),A.indexOf("blob:")!==0?A=A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):A="";var c=s.print||console.log.bind(console),u=s.printErr||console.warn.bind(console);Object.assign(s,l),l=null;var h;s.wasmBinary&&(h=s.wasmBinary),s.noExitRuntime,typeof WebAssembly!="object"&&X("no native wasm support detected");var d,f=!1;function g(v,B,L){L=B+L;for(var N="";!(B>=L);){var H=v[B++];if(!H)break;if(H&128){var Z=v[B++]&63;if((H&224)==192)N+=String.fromCharCode((H&31)<<6|Z);else{var se=v[B++]&63;H=(H&240)==224?(H&15)<<12|Z<<6|se:(H&7)<<18|Z<<12|se<<6|v[B++]&63,65536>H?N+=String.fromCharCode(H):(H-=65536,N+=String.fromCharCode(55296|H>>10,56320|H&1023))}}else N+=String.fromCharCode(H)}return N}var p,y,Q,b,C,w,R,k,$;function V(){var v=d.buffer;p=v,s.HEAP8=y=new Int8Array(v),s.HEAP16=b=new Int16Array(v),s.HEAP32=w=new Int32Array(v),s.HEAPU8=Q=new Uint8Array(v),s.HEAPU16=C=new Uint16Array(v),s.HEAPU32=R=new Uint32Array(v),s.HEAPF32=k=new Float32Array(v),s.HEAPF64=$=new Float64Array(v)}var O,W=[],ie=[],te=[];function le(){var v=s.preRun.shift();W.unshift(v)}var D=0,P=null;function X(v){throw s.onAbort&&s.onAbort(v),v="Aborted("+v+")",u(v),f=!0,v=new WebAssembly.RuntimeError(v+". Build with -sASSERTIONS for more info."),a(v),v}function _(v){return v.startsWith("data:application/octet-stream;base64,")}var S;if(S="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",!_(S)){var F=S;S=s.locateFile?s.locateFile(F,A):A+F}function J(){var v=S;try{if(v==S&&h)return new Uint8Array(h);if(_(v))try{var B=E1(v.slice(37)),L=new Uint8Array(B.length);for(v=0;v<B.length;++v)L[v]=B.charCodeAt(v);var N=L}catch{throw Error("Converting base64 string to bytes failed.")}else N=void 0;var H=N;if(H)return H;throw"both async and sync fetching of the wasm failed"}catch(Z){X(Z)}}function Y(){return h||typeof fetch!="function"?Promise.resolve().then(function(){return J()}):fetch(S,{credentials:"same-origin"}).then(function(v){if(!v.ok)throw"failed to load wasm binary file at '"+S+"'";return v.arrayBuffer()}).catch(function(){return J()})}function ne(v){for(;0<v.length;)v.shift()(s)}function ce(v){if(v===void 0)return"_unknown";v=v.replace(/[^a-zA-Z0-9_]/g,"$");var B=v.charCodeAt(0);return 48<=B&&57>=B?"_"+v:v}function pe(v,B){return v=ce(v),function(){return B.apply(this,arguments)}}var ge=[{},{value:void 0},{value:null},{value:!0},{value:!1}],Se=[];function Le(v){var B=Error,L=pe(v,function(N){this.name=v,this.message=N,N=Error(N).stack,N!==void 0&&(this.stack=this.toString()+`
67
+ `+N.replace(/^Error(:[^\n]*)?\n/,""))});return L.prototype=Object.create(B.prototype),L.prototype.constructor=L,L.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},L}var Ge=void 0;function fe(v){throw new Ge(v)}var Qe=v=>(v||fe("Cannot use deleted val. handle = "+v),ge[v].value),Me=v=>{switch(v){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var B=Se.length?Se.pop():ge.length;return ge[B]={fa:1,value:v},B}},we=void 0,qe=void 0;function Te(v){for(var B="";Q[v];)B+=qe[Q[v++]];return B}var T=[];function m(){for(;T.length;){var v=T.pop();v.L.Z=!1,v.delete()}}var E=void 0,x={};function M(v,B){for(B===void 0&&fe("ptr should not be undefined");v.P;)B=v.aa(B),v=v.P;return B}var z={};function j(v){v=_d(v);var B=Te(v);return Dr(v),B}function Ie(v,B){var L=z[v];return L===void 0&&fe(B+" has unknown type "+j(v)),L}function be(){}var De=!1;function ke(v){--v.count.value,v.count.value===0&&(v.S?v.T.V(v.S):v.O.M.V(v.N))}function _e(v,B,L){return B===L?v:L.P===void 0?null:(v=_e(v,B,L.P),v===null?null:L.ma(v))}var Mt={};function ut(v,B){return B=M(v,B),x[B]}var Ut=void 0;function Er(v){throw new Ut(v)}function Ir(v,B){return B.O&&B.N||Er("makeClassHandle requires ptr and ptrType"),!!B.T!=!!B.S&&Er("Both smartPtrType and smartPtr must be specified"),B.count={value:1},Tt(Object.create(v,{L:{value:B}}))}function Tt(v){return typeof FinalizationRegistry>"u"?(Tt=B=>B,v):(De=new FinalizationRegistry(B=>{ke(B.L)}),Tt=B=>{var L=B.L;return L.S&&De.register(B,{L},B),B},be=B=>{De.unregister(B)},Tt(v))}var q={};function de(v){for(;v.length;){var B=v.pop();v.pop()(B)}}function ve(v){return this.fromWireType(w[v>>2])}var Pe={},Fe={};function Xe(v,B,L){function N(oe){oe=L(oe),oe.length!==v.length&&Er("Mismatched type converter count");for(var Ae=0;Ae<v.length;++Ae)wt(v[Ae],oe[Ae])}v.forEach(function(oe){Fe[oe]=B});var H=Array(B.length),Z=[],se=0;B.forEach((oe,Ae)=>{z.hasOwnProperty(oe)?H[Ae]=z[oe]:(Z.push(oe),Pe.hasOwnProperty(oe)||(Pe[oe]=[]),Pe[oe].push(()=>{H[Ae]=z[oe],++se,se===Z.length&&N(H)}))}),Z.length===0&&N(H)}function xt(v){switch(v){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+v)}}function wt(v,B,L={}){if(!("argPackAdvance"in B))throw new TypeError("registerType registeredInstance requires argPackAdvance");var N=B.name;if(v||fe('type "'+N+'" must have a positive integer typeid pointer'),z.hasOwnProperty(v)){if(L.ta)return;fe("Cannot register type '"+N+"' twice")}z[v]=B,delete Fe[v],Pe.hasOwnProperty(v)&&(B=Pe[v],delete Pe[v],B.forEach(H=>H()))}function Gn(v){fe(v.L.O.M.name+" instance already deleted")}function St(){}function hn(v,B,L){if(v[B].R===void 0){var N=v[B];v[B]=function(){return v[B].R.hasOwnProperty(arguments.length)||fe("Function '"+L+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+v[B].R+")!"),v[B].R[arguments.length].apply(this,arguments)},v[B].R=[],v[B].R[N.Y]=N}}function Hn(v,B){s.hasOwnProperty(v)?(fe("Cannot register public name '"+v+"' twice"),hn(s,v,v),s.hasOwnProperty(void 0)&&fe("Cannot register multiple overloads of a function with the same number of arguments (undefined)!"),s[v].R[void 0]=B):s[v]=B}function Hr(v,B,L,N,H,Z,se,oe){this.name=v,this.constructor=B,this.W=L,this.V=N,this.P=H,this.oa=Z,this.aa=se,this.ma=oe,this.ia=[]}function Si(v,B,L){for(;B!==L;)B.aa||fe("Expected null or instance of "+L.name+", got an instance of "+B.name),v=B.aa(v),B=B.P;return v}function Ri(v,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+Tl(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),Si(B.L.N,B.L.O.M,this.M))}function $n(v,B){if(B===null){if(this.da&&fe("null is not a valid "+this.name),this.ca){var L=this.ea();return v!==null&&v.push(this.V,L),L}return 0}if(B.L||fe('Cannot pass "'+Tl(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),!this.ba&&B.L.O.ba&&fe("Cannot convert argument of type "+(B.L.T?B.L.T.name:B.L.O.name)+" to parameter type "+this.name),L=Si(B.L.N,B.L.O.M,this.M),this.ca)switch(B.L.S===void 0&&fe("Passing raw pointer to smart pointer is illegal"),this.Aa){case 0:B.L.T===this?L=B.L.S:fe("Cannot convert argument of type "+(B.L.T?B.L.T.name:B.L.O.name)+" to parameter type "+this.name);break;case 1:L=B.L.S;break;case 2:if(B.L.T===this)L=B.L.S;else{var N=B.clone();L=this.wa(L,Me(function(){N.delete()})),v!==null&&v.push(this.V,L)}break;default:fe("Unsupporting sharing policy")}return L}function n1(v,B){return B===null?(this.da&&fe("null is not a valid "+this.name),0):(B.L||fe('Cannot pass "'+Tl(B)+'" as a '+this.name),B.L.N||fe("Cannot pass deleted object as a pointer of type "+this.name),B.L.O.ba&&fe("Cannot convert argument of type "+B.L.O.name+" to parameter type "+this.name),Si(B.L.N,B.L.O.M,this.M))}function Rr(v,B,L,N){this.name=v,this.M=B,this.da=L,this.ba=N,this.ca=!1,this.V=this.wa=this.ea=this.ja=this.Aa=this.va=void 0,B.P!==void 0?this.toWireType=$n:(this.toWireType=N?Ri:n1,this.U=null)}function i1(v,B){s.hasOwnProperty(v)||Er("Replacing nonexistant public symbol"),s[v]=B,s[v].Y=void 0}function s1(v,B){var L=[];return function(){if(L.length=0,Object.assign(L,arguments),v.includes("j")){var N=s["dynCall_"+v];N=L&&L.length?N.apply(null,[B].concat(L)):N.call(null,B)}else N=O.get(B).apply(null,L);return N}}function rr(v,B){v=Te(v);var L=v.includes("j")?s1(v,B):O.get(B);return typeof L!="function"&&fe("unknown function pointer with signature "+v+": "+B),L}var wd=void 0;function eo(v,B){function L(Z){H[Z]||z[Z]||(Fe[Z]?Fe[Z].forEach(L):(N.push(Z),H[Z]=!0))}var N=[],H={};throw B.forEach(L),new wd(v+": "+N.map(j).join([", "]))}function Cl(v,B,L,N,H){var Z=B.length;2>Z&&fe("argTypes array size mismatch! Must at least get return value and 'this' types!");var se=B[1]!==null&&L!==null,oe=!1;for(L=1;L<B.length;++L)if(B[L]!==null&&B[L].U===void 0){oe=!0;break}var Ae=B[0].name!=="void",ae=Z-2,ue=Array(ae),ye=[],Ue=[];return function(){if(arguments.length!==ae&&fe("function "+v+" called with "+arguments.length+" arguments, expected "+ae+" args!"),Ue.length=0,ye.length=se?2:1,ye[0]=H,se){var at=B[1].toWireType(Ue,this);ye[1]=at}for(var Ye=0;Ye<ae;++Ye)ue[Ye]=B[Ye+2].toWireType(Ue,arguments[Ye]),ye.push(ue[Ye]);if(Ye=N.apply(null,ye),oe)de(Ue);else for(var Gt=se?1:2;Gt<B.length;Gt++){var nr=Gt===1?at:ue[Gt-2];B[Gt].U!==null&&B[Gt].U(nr)}return at=Ae?B[0].fromWireType(Ye):void 0,at}}function yl(v,B){for(var L=[],N=0;N<v;N++)L.push(R[B+4*N>>2]);return L}function Bl(v){4<v&&--ge[v].fa===0&&(ge[v]=void 0,Se.push(v))}function Tl(v){if(v===null)return"null";var B=typeof v;return B==="object"||B==="array"||B==="function"?v.toString():""+v}function o1(v,B){switch(B){case 2:return function(L){return this.fromWireType(k[L>>2])};case 3:return function(L){return this.fromWireType($[L>>3])};default:throw new TypeError("Unknown float type: "+v)}}function a1(v,B,L){switch(B){case 0:return L?function(N){return y[N]}:function(N){return Q[N]};case 1:return L?function(N){return b[N>>1]}:function(N){return C[N>>1]};case 2:return L?function(N){return w[N>>2]}:function(N){return R[N>>2]};default:throw new TypeError("Unknown integer type: "+v)}}function l1(v,B){for(var L="",N=0;!(N>=B/2);++N){var H=b[v+2*N>>1];if(H==0)break;L+=String.fromCharCode(H)}return L}function A1(v,B,L){if(L===void 0&&(L=2147483647),2>L)return 0;L-=2;var N=B;L=L<2*v.length?L/2:v.length;for(var H=0;H<L;++H)b[B>>1]=v.charCodeAt(H),B+=2;return b[B>>1]=0,B-N}function c1(v){return 2*v.length}function u1(v,B){for(var L=0,N="";!(L>=B/4);){var H=w[v+4*L>>2];if(H==0)break;++L,65536<=H?(H-=65536,N+=String.fromCharCode(55296|H>>10,56320|H&1023)):N+=String.fromCharCode(H)}return N}function h1(v,B,L){if(L===void 0&&(L=2147483647),4>L)return 0;var N=B;L=N+L-4;for(var H=0;H<v.length;++H){var Z=v.charCodeAt(H);if(55296<=Z&&57343>=Z){var se=v.charCodeAt(++H);Z=65536+((Z&1023)<<10)|se&1023}if(w[B>>2]=Z,B+=4,B+4>L)break}return w[B>>2]=0,B-N}function d1(v){for(var B=0,L=0;L<v.length;++L){var N=v.charCodeAt(L);55296<=N&&57343>=N&&++L,B+=4}return B}var f1={};function Sd(v){var B=f1[v];return B===void 0?Te(v):B}var to=[];function g1(v){var B=to.length;return to.push(v),B}function p1(v,B){for(var L=Array(v),N=0;N<v;++N)L[N]=Ie(R[B+4*N>>2],"parameter "+N);return L}var Rd=[],m1=[null,[],[]];Ge=s.BindingError=Le("BindingError"),s.count_emval_handles=function(){for(var v=0,B=5;B<ge.length;++B)ge[B]!==void 0&&++v;return v},s.get_first_emval=function(){for(var v=5;v<ge.length;++v)if(ge[v]!==void 0)return ge[v];return null},we=s.PureVirtualError=Le("PureVirtualError");for(var Dd=Array(256),ro=0;256>ro;++ro)Dd[ro]=String.fromCharCode(ro);qe=Dd,s.getInheritedInstanceCount=function(){return Object.keys(x).length},s.getLiveInheritedInstances=function(){var v=[],B;for(B in x)x.hasOwnProperty(B)&&v.push(x[B]);return v},s.flushPendingDeletes=m,s.setDelayFunction=function(v){E=v,T.length&&E&&E(m)},Ut=s.InternalError=Le("InternalError"),St.prototype.isAliasOf=function(v){if(!(this instanceof St&&v instanceof St))return!1;var B=this.L.O.M,L=this.L.N,N=v.L.O.M;for(v=v.L.N;B.P;)L=B.aa(L),B=B.P;for(;N.P;)v=N.aa(v),N=N.P;return B===N&&L===v},St.prototype.clone=function(){if(this.L.N||Gn(this),this.L.$)return this.L.count.value+=1,this;var v=Tt,B=Object,L=B.create,N=Object.getPrototypeOf(this),H=this.L;return v=v(L.call(B,N,{L:{value:{count:H.count,Z:H.Z,$:H.$,N:H.N,O:H.O,S:H.S,T:H.T}}})),v.L.count.value+=1,v.L.Z=!1,v},St.prototype.delete=function(){this.L.N||Gn(this),this.L.Z&&!this.L.$&&fe("Object already scheduled for deletion"),be(this),ke(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||Gn(this),this.L.Z&&!this.L.$&&fe("Object already scheduled for deletion"),T.push(this),T.length===1&&E&&E(m),this.L.Z=!0,this},Rr.prototype.pa=function(v){return this.ja&&(v=this.ja(v)),v},Rr.prototype.ga=function(v){this.V&&this.V(v)},Rr.prototype.argPackAdvance=8,Rr.prototype.readValueFromPointer=ve,Rr.prototype.deleteObject=function(v){v!==null&&v.delete()},Rr.prototype.fromWireType=function(v){function B(){return this.ca?Ir(this.M.W,{O:this.va,N:L,T:this,S:v}):Ir(this.M.W,{O:this,N:v})}var L=this.pa(v);if(!L)return this.ga(v),null;var N=ut(this.M,L);if(N!==void 0)return N.L.count.value===0?(N.L.N=L,N.L.S=v,N.clone()):(N=N.clone(),this.ga(v),N);if(N=this.M.oa(L),N=Mt[N],!N)return B.call(this);N=this.ba?N.ka:N.pointerType;var H=_e(L,this.M,N.M);return H===null?B.call(this):this.ca?Ir(N.M.W,{O:N,N:H,T:this,S:v}):Ir(N.M.W,{O:N,N:H})},wd=s.UnboundTypeError=Le("UnboundTypeError");var E1=typeof atob=="function"?atob:function(v){var B="",L=0;v=v.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(v.charAt(L++)),H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(v.charAt(L++)),Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(v.charAt(L++)),se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(v.charAt(L++));N=N<<2|H>>4,H=(H&15)<<4|Z>>2;var oe=(Z&3)<<6|se;B+=String.fromCharCode(N),Z!==64&&(B+=String.fromCharCode(H)),se!==64&&(B+=String.fromCharCode(oe))}while(L<v.length);return B},I1={p:function(v,B,L){v=Te(v),B=Ie(B,"wrapper"),L=Qe(L);var N=[].slice,H=B.M,Z=H.W,se=H.P.W,oe=H.P.constructor;v=pe(v,function(){H.P.ia.forEach((function(ae){if(this[ae]===se[ae])throw new we("Pure virtual function "+ae+" must be implemented in JavaScript")}).bind(this)),Object.defineProperty(this,"__parent",{value:Z}),this.__construct.apply(this,N.call(arguments))}),Z.__construct=function(){this===Z&&fe("Pass correct 'this' to __construct");var ae=oe.implement.apply(void 0,[this].concat(N.call(arguments)));be(ae);var ue=ae.L;ae.notifyOnDestruction(),ue.$=!0,Object.defineProperties(this,{L:{value:ue}}),Tt(this),ae=ue.N,ae=M(H,ae),x.hasOwnProperty(ae)?fe("Tried to register registered instance: "+ae):x[ae]=this},Z.__destruct=function(){this===Z&&fe("Pass correct 'this' to __destruct"),be(this);var ae=this.L.N;ae=M(H,ae),x.hasOwnProperty(ae)?delete x[ae]:fe("Tried to unregister unregistered instance: "+ae)},v.prototype=Object.create(Z);for(var Ae in L)v.prototype[Ae]=L[Ae];return Me(v)},j:function(v){var B=q[v];delete q[v];var L=B.ea,N=B.V,H=B.ha,Z=H.map(se=>se.sa).concat(H.map(se=>se.ya));Xe([v],Z,se=>{var oe={};return H.forEach((Ae,ae)=>{var ue=se[ae],ye=Ae.qa,Ue=Ae.ra,at=se[ae+H.length],Ye=Ae.xa,Gt=Ae.za;oe[Ae.na]={read:nr=>ue.fromWireType(ye(Ue,nr)),write:(nr,Di)=>{var _r=[];Ye(Gt,nr,at.toWireType(_r,Di)),de(_r)}}}),[{name:B.name,fromWireType:function(Ae){var ae={},ue;for(ue in oe)ae[ue]=oe[ue].read(Ae);return N(Ae),ae},toWireType:function(Ae,ae){for(var ue in oe)if(!(ue in ae))throw new TypeError('Missing field: "'+ue+'"');var ye=L();for(ue in oe)oe[ue].write(ye,ae[ue]);return Ae!==null&&Ae.push(N,ye),ye},argPackAdvance:8,readValueFromPointer:ve,U:N}]})},v:function(){},B:function(v,B,L,N,H){var Z=xt(L);B=Te(B),wt(v,{name:B,fromWireType:function(se){return!!se},toWireType:function(se,oe){return oe?N:H},argPackAdvance:8,readValueFromPointer:function(se){if(L===1)var oe=y;else if(L===2)oe=b;else if(L===4)oe=w;else throw new TypeError("Unknown boolean type size: "+B);return this.fromWireType(oe[se>>Z])},U:null})},f:function(v,B,L,N,H,Z,se,oe,Ae,ae,ue,ye,Ue){ue=Te(ue),Z=rr(H,Z),oe&&(oe=rr(se,oe)),ae&&(ae=rr(Ae,ae)),Ue=rr(ye,Ue);var at=ce(ue);Hn(at,function(){eo("Cannot construct "+ue+" due to unbound types",[N])}),Xe([v,B,L],N?[N]:[],function(Ye){if(Ye=Ye[0],N)var Gt=Ye.M,nr=Gt.W;else nr=St.prototype;Ye=pe(at,function(){if(Object.getPrototypeOf(this)!==Di)throw new Ge("Use 'new' to construct "+ue);if(_r.X===void 0)throw new Ge(ue+" has no accessible constructor");var kd=_r.X[arguments.length];if(kd===void 0)throw new Ge("Tried to invoke ctor of "+ue+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(_r.X).toString()+") parameters instead!");return kd.apply(this,arguments)});var Di=Object.create(nr,{constructor:{value:Ye}});Ye.prototype=Di;var _r=new Hr(ue,Ye,Di,Ue,Gt,Z,oe,ae);Gt=new Rr(ue,_r,!0,!1),nr=new Rr(ue+"*",_r,!1,!1);var Fd=new Rr(ue+" const*",_r,!1,!0);return Mt[v]={pointerType:nr,ka:Fd},i1(at,Ye),[Gt,nr,Fd]})},c:function(v,B,L,N,H,Z,se){var oe=yl(L,N);B=Te(B),Z=rr(H,Z),Xe([],[v],function(Ae){function ae(){eo("Cannot call "+ue+" due to unbound types",oe)}Ae=Ae[0];var ue=Ae.name+"."+B;B.startsWith("@@")&&(B=Symbol[B.substring(2)]);var ye=Ae.M.constructor;return ye[B]===void 0?(ae.Y=L-1,ye[B]=ae):(hn(ye,B,ue),ye[B].R[L-1]=ae),Xe([],oe,function(Ue){return Ue=Cl(ue,[Ue[0],null].concat(Ue.slice(1)),null,Z,se),ye[B].R===void 0?(Ue.Y=L-1,ye[B]=Ue):ye[B].R[L-1]=Ue,[]}),[]})},o:function(v,B,L,N,H,Z){0<B||X();var se=yl(B,L);H=rr(N,H),Xe([],[v],function(oe){oe=oe[0];var Ae="constructor "+oe.name;if(oe.M.X===void 0&&(oe.M.X=[]),oe.M.X[B-1]!==void 0)throw new Ge("Cannot register multiple constructors with identical number of parameters ("+(B-1)+") for class '"+oe.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return oe.M.X[B-1]=()=>{eo("Cannot construct "+oe.name+" due to unbound types",se)},Xe([],se,function(ae){return ae.splice(1,0,null),oe.M.X[B-1]=Cl(Ae,ae,null,H,Z),[]}),[]})},a:function(v,B,L,N,H,Z,se,oe){var Ae=yl(L,N);B=Te(B),Z=rr(H,Z),Xe([],[v],function(ae){function ue(){eo("Cannot call "+ye+" due to unbound types",Ae)}ae=ae[0];var ye=ae.name+"."+B;B.startsWith("@@")&&(B=Symbol[B.substring(2)]),oe&&ae.M.ia.push(B);var Ue=ae.M.W,at=Ue[B];return at===void 0||at.R===void 0&&at.className!==ae.name&&at.Y===L-2?(ue.Y=L-2,ue.className=ae.name,Ue[B]=ue):(hn(Ue,B,ye),Ue[B].R[L-2]=ue),Xe([],Ae,function(Ye){return Ye=Cl(ye,Ye,ae,Z,se),Ue[B].R===void 0?(Ye.Y=L-2,Ue[B]=Ye):Ue[B].R[L-2]=Ye,[]}),[]})},A:function(v,B){B=Te(B),wt(v,{name:B,fromWireType:function(L){var N=Qe(L);return Bl(L),N},toWireType:function(L,N){return Me(N)},argPackAdvance:8,readValueFromPointer:ve,U:null})},m:function(v,B,L){L=xt(L),B=Te(B),wt(v,{name:B,fromWireType:function(N){return N},toWireType:function(N,H){return H},argPackAdvance:8,readValueFromPointer:o1(B,L),U:null})},d:function(v,B,L,N,H){B=Te(B),H===-1&&(H=4294967295),H=xt(L);var Z=oe=>oe;if(N===0){var se=32-8*L;Z=oe=>oe<<se>>>se}L=B.includes("unsigned")?function(oe,Ae){return Ae>>>0}:function(oe,Ae){return Ae},wt(v,{name:B,fromWireType:Z,toWireType:L,argPackAdvance:8,readValueFromPointer:a1(B,H,N!==0),U:null})},b:function(v,B,L){function N(Z){Z>>=2;var se=R;return new H(p,se[Z+1],se[Z])}var H=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][B];L=Te(L),wt(v,{name:L,fromWireType:N,argPackAdvance:8,readValueFromPointer:N},{ta:!0})},n:function(v,B){B=Te(B);var L=B==="std::string";wt(v,{name:B,fromWireType:function(N){var H=R[N>>2],Z=N+4;if(L)for(var se=Z,oe=0;oe<=H;++oe){var Ae=Z+oe;if(oe==H||Q[Ae]==0){if(se=se?g(Q,se,Ae-se):"",ae===void 0)var ae=se;else ae+="\0",ae+=se;se=Ae+1}}else{for(ae=Array(H),oe=0;oe<H;++oe)ae[oe]=String.fromCharCode(Q[Z+oe]);ae=ae.join("")}return Dr(N),ae},toWireType:function(N,H){H instanceof ArrayBuffer&&(H=new Uint8Array(H));var Z,se=typeof H=="string";if(se||H instanceof Uint8Array||H instanceof Uint8ClampedArray||H instanceof Int8Array||fe("Cannot pass non-string to std::string"),L&&se){var oe=0;for(Z=0;Z<H.length;++Z){var Ae=H.charCodeAt(Z);127>=Ae?oe++:2047>=Ae?oe+=2:55296<=Ae&&57343>=Ae?(oe+=4,++Z):oe+=3}Z=oe}else Z=H.length;if(oe=Ql(4+Z+1),Ae=oe+4,R[oe>>2]=Z,L&&se){if(se=Ae,Ae=Z+1,Z=Q,0<Ae){Ae=se+Ae-1;for(var ae=0;ae<H.length;++ae){var ue=H.charCodeAt(ae);if(55296<=ue&&57343>=ue){var ye=H.charCodeAt(++ae);ue=65536+((ue&1023)<<10)|ye&1023}if(127>=ue){if(se>=Ae)break;Z[se++]=ue}else{if(2047>=ue){if(se+1>=Ae)break;Z[se++]=192|ue>>6}else{if(65535>=ue){if(se+2>=Ae)break;Z[se++]=224|ue>>12}else{if(se+3>=Ae)break;Z[se++]=240|ue>>18,Z[se++]=128|ue>>12&63}Z[se++]=128|ue>>6&63}Z[se++]=128|ue&63}}Z[se]=0}}else if(se)for(se=0;se<Z;++se)ae=H.charCodeAt(se),255<ae&&(Dr(Ae),fe("String has UTF-16 code units that do not fit in 8 bits")),Q[Ae+se]=ae;else for(se=0;se<Z;++se)Q[Ae+se]=H[se];return N!==null&&N.push(Dr,oe),oe},argPackAdvance:8,readValueFromPointer:ve,U:function(N){Dr(N)}})},i:function(v,B,L){if(L=Te(L),B===2)var N=l1,H=A1,Z=c1,se=()=>C,oe=1;else B===4&&(N=u1,H=h1,Z=d1,se=()=>R,oe=2);wt(v,{name:L,fromWireType:function(Ae){for(var ae=R[Ae>>2],ue=se(),ye,Ue=Ae+4,at=0;at<=ae;++at){var Ye=Ae+4+at*B;(at==ae||ue[Ye>>oe]==0)&&(Ue=N(Ue,Ye-Ue),ye===void 0?ye=Ue:(ye+="\0",ye+=Ue),Ue=Ye+B)}return Dr(Ae),ye},toWireType:function(Ae,ae){typeof ae!="string"&&fe("Cannot pass non-string to C++ string type "+L);var ue=Z(ae),ye=Ql(4+ue+B);return R[ye>>2]=ue>>oe,H(ae,ye+4,ue+B),Ae!==null&&Ae.push(Dr,ye),ye},argPackAdvance:8,readValueFromPointer:ve,U:function(Ae){Dr(Ae)}})},k:function(v,B,L,N,H,Z){q[v]={name:Te(B),ea:rr(L,N),V:rr(H,Z),ha:[]}},h:function(v,B,L,N,H,Z,se,oe,Ae,ae){q[v].ha.push({na:Te(B),sa:L,qa:rr(N,H),ra:Z,ya:se,xa:rr(oe,Ae),za:ae})},C:function(v,B){B=Te(B),wt(v,{ua:!0,name:B,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},s:function(v,B,L,N,H){v=to[v],B=Qe(B),L=Sd(L);var Z=[];return R[N>>2]=Me(Z),v(B,L,Z,H)},t:function(v,B,L,N){v=to[v],B=Qe(B),L=Sd(L),v(B,L,null,N)},g:Bl,l:function(v,B){var L=p1(v,B),N=L[0];B=N.name+"_$"+L.slice(1).map(function(se){return se.name}).join("_")+"$";var H=Rd[B];if(H!==void 0)return H;var Z=Array(v-1);return H=g1((se,oe,Ae,ae)=>{for(var ue=0,ye=0;ye<v-1;++ye)Z[ye]=L[ye+1].readValueFromPointer(ae+ue),ue+=L[ye+1].argPackAdvance;for(se=se[oe].apply(se,Z),ye=0;ye<v-1;++ye)L[ye+1].la&&L[ye+1].la(Z[ye]);if(!N.ua)return N.toWireType(Ae,se)}),Rd[B]=H},q:function(v){4<v&&(ge[v].fa+=1)},r:function(v){var B=Qe(v);de(B),Bl(v)},e:function(){X("")},x:function(v,B,L){Q.copyWithin(v,B,B+L)},w:function(v){var B=Q.length;if(v>>>=0,2147483648<v)return!1;for(var L=1;4>=L;L*=2){var N=B*(1+.2/L);N=Math.min(N,v+100663296);var H=Math;N=Math.max(v,N),H=H.min.call(H,2147483648,N+(65536-N%65536)%65536);e:{try{d.grow(H-p.byteLength+65535>>>16),V();var Z=1;break e}catch{}Z=void 0}if(Z)return!0}return!1},z:function(){return 52},u:function(){return 70},y:function(v,B,L,N){for(var H=0,Z=0;Z<L;Z++){var se=R[B>>2],oe=R[B+4>>2];B+=8;for(var Ae=0;Ae<oe;Ae++){var ae=Q[se+Ae],ue=m1[v];ae===0||ae===10?((v===1?c:u)(g(ue,0)),ue.length=0):ue.push(ae)}H+=oe}return R[N>>2]=H,0}};(function(){function v(H){s.asm=H.exports,d=s.asm.D,V(),O=s.asm.I,ie.unshift(s.asm.E),D--,s.monitorRunDependencies&&s.monitorRunDependencies(D),D==0&&P&&(H=P,P=null,H())}function B(H){v(H.instance)}function L(H){return Y().then(function(Z){return WebAssembly.instantiate(Z,N)}).then(function(Z){return Z}).then(H,function(Z){u("failed to asynchronously prepare wasm: "+Z),X(Z)})}var N={a:I1};if(D++,s.monitorRunDependencies&&s.monitorRunDependencies(D),s.instantiateWasm)try{return s.instantiateWasm(N,v)}catch(H){u("Module.instantiateWasm callback failed with error: "+H),a(H)}return function(){return h||typeof WebAssembly.instantiateStreaming!="function"||_(S)||typeof fetch!="function"?L(B):fetch(S,{credentials:"same-origin"}).then(function(H){return WebAssembly.instantiateStreaming(H,N).then(B,function(Z){return u("wasm streaming compile failed: "+Z),u("falling back to ArrayBuffer instantiation"),L(B)})})}().catch(a),{}})(),s.___wasm_call_ctors=function(){return(s.___wasm_call_ctors=s.asm.E).apply(null,arguments)};var _d=s.___getTypeName=function(){return(_d=s.___getTypeName=s.asm.F).apply(null,arguments)};s.__embind_initialize_bindings=function(){return(s.__embind_initialize_bindings=s.asm.G).apply(null,arguments)};var Ql=s._malloc=function(){return(Ql=s._malloc=s.asm.H).apply(null,arguments)},Dr=s._free=function(){return(Dr=s._free=s.asm.J).apply(null,arguments)};s.dynCall_jiji=function(){return(s.dynCall_jiji=s.asm.K).apply(null,arguments)};var no;P=function v(){no||Ld(),no||(P=v)};function Ld(){function v(){if(!no&&(no=!0,s.calledRun=!0,!f)){if(ne(ie),o(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;){var B=s.postRun.shift();te.unshift(B)}ne(te)}}if(!(0<D)){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)le();ne(W),0<D||(s.setStatus?(s.setStatus("Running..."),setTimeout(function(){setTimeout(function(){s.setStatus("")},1),v()},1)):v())}}if(s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);0<s.preInit.length;)s.preInit.pop()();return Ld(),i.ready}})();r.exports=t})(rA);var Yf=rA.exports;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var e={loadYoga:!0};r.loadYoga=o;var t=i(Eo),n=Re;Object.keys(n).forEach(function(a){a==="default"||a==="__esModule"||Object.prototype.hasOwnProperty.call(e,a)||a in r&&r[a]===n[a]||Object.defineProperty(r,a,{enumerable:!0,get:function(){return n[a]}})});function i(a){return a&&a.__esModule?a:{default:a}}const s=Yf;async function o(){return(0,t.default)(await s())}})(eA);function Vf(r){for(var e=new Array(r),t=0;t<r;++t)e[t]=t;return e}var Kf=Vf;/*!
68
68
  * Determine if an object is a Buffer
69
69
  *
70
70
  * @author Feross Aboukhadijeh <https://feross.org>
71
71
  * @license MIT
72
- */var Jf=function(r){return r!=null&&(nA(r)||Wf(r)||!!r._isBuffer)};function nA(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Wf(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&nA(r.slice(0,0))}var qf=Kf,Xf=Jf,jf=typeof Float64Array<"u";function zf(r,e){return r[0]-e[0]}function Zf(){var r=this.stride,e=new Array(r.length),t;for(t=0;t<e.length;++t)e[t]=[Math.abs(r[t]),t];e.sort(zf);var n=new Array(e.length);for(t=0;t<n.length;++t)n[t]=e[t][1];return n}function eg(r,e){var t=["View",e,"d",r].join("");e<0&&(t="View_Nil"+r);var n=r==="generic";if(e===-1){var i="function "+t+"(a){this.data=a;};var proto="+t+".prototype;proto.dtype='"+r+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+t+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+t+"(a){return new "+t+"(a);}",g=new Function(i);return g()}else if(e===0){var i="function "+t+"(a,d) {this.data = a;this.offset = d};var proto="+t+".prototype;proto.dtype='"+r+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+t+"_copy() {return new "+t+"(this.data,this.offset)};proto.pick=function "+t+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+t+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+t+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+t+"(a,b,c,d){return new "+t+"(a,d)}",g=new Function("TrivialArray",i);return g(qi[r][0])}var i=["'use strict'"],s=qf(e),o=s.map(function(p){return"i"+p}),a="this.offset+"+s.map(function(p){return"this.stride["+p+"]*i"+p}).join("+"),l=s.map(function(p){return"b"+p}).join(","),A=s.map(function(p){return"c"+p}).join(",");i.push("function "+t+"(a,"+l+","+A+",d){this.data=a","this.shape=["+l+"]","this.stride=["+A+"]","this.offset=d|0}","var proto="+t+".prototype","proto.dtype='"+r+"'","proto.dimension="+e),i.push("Object.defineProperty(proto,'size',{get:function "+t+"_size(){return "+s.map(function(p){return"this.shape["+p+"]"}).join("*"),"}})"),e===1?i.push("proto.order=[0]"):(i.push("Object.defineProperty(proto,'order',{get:"),e<4?(i.push("function "+t+"_order(){"),e===2?i.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):e===3&&i.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):i.push("ORDER})")),i.push("proto.set=function "+t+"_set("+o.join(",")+",v){"),n?i.push("return this.data.set("+a+",v)}"):i.push("return this.data["+a+"]=v}"),i.push("proto.get=function "+t+"_get("+o.join(",")+"){"),n?i.push("return this.data.get("+a+")}"):i.push("return this.data["+a+"]}"),i.push("proto.index=function "+t+"_index(",o.join(),"){return "+a+"}"),i.push("proto.hi=function "+t+"_hi("+o.join(",")+"){return new "+t+"(this.data,"+s.map(function(p){return["(typeof i",p,"!=='number'||i",p,"<0)?this.shape[",p,"]:i",p,"|0"].join("")}).join(",")+","+s.map(function(p){return"this.stride["+p+"]"}).join(",")+",this.offset)}");var c=s.map(function(p){return"a"+p+"=this.shape["+p+"]"}),u=s.map(function(p){return"c"+p+"=this.stride["+p+"]"});i.push("proto.lo=function "+t+"_lo("+o.join(",")+"){var b=this.offset,d=0,"+c.join(",")+","+u.join(","));for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'&&i"+h+">=0){d=i"+h+"|0;b+=c"+h+"*d;a"+h+"-=d}");i.push("return new "+t+"(this.data,"+s.map(function(p){return"a"+p}).join(",")+","+s.map(function(p){return"c"+p}).join(",")+",b)}"),i.push("proto.step=function "+t+"_step("+o.join(",")+"){var "+s.map(function(p){return"a"+p+"=this.shape["+p+"]"}).join(",")+","+s.map(function(p){return"b"+p+"=this.stride["+p+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'){d=i"+h+"|0;if(d<0){c+=b"+h+"*(a"+h+"-1);a"+h+"=ceil(-a"+h+"/d)}else{a"+h+"=ceil(a"+h+"/d)}b"+h+"*=d}");i.push("return new "+t+"(this.data,"+s.map(function(p){return"a"+p}).join(",")+","+s.map(function(p){return"b"+p}).join(",")+",c)}");for(var d=new Array(e),f=new Array(e),h=0;h<e;++h)d[h]="a[i"+h+"]",f[h]="b[i"+h+"]";i.push("proto.transpose=function "+t+"_transpose("+o+"){"+o.map(function(p,C){return p+"=("+p+"===undefined?"+C+":"+p+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+t+"(this.data,"+d.join(",")+","+f.join(",")+",this.offset)}"),i.push("proto.pick=function "+t+"_pick("+o+"){var a=[],b=[],c=this.offset");for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'&&i"+h+">=0){c=(c+this.stride["+h+"]*i"+h+")|0}else{a.push(this.shape["+h+"]);b.push(this.stride["+h+"])}");i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.push("return function construct_"+t+"(data,shape,stride,offset){return new "+t+"(data,"+s.map(function(p){return"shape["+p+"]"}).join(",")+","+s.map(function(p){return"stride["+p+"]"}).join(",")+",offset)}");var g=new Function("CTOR_LIST","ORDER",i.join(`
72
+ */var Jf=function(r){return r!=null&&(nA(r)||Wf(r)||!!r._isBuffer)};function nA(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Wf(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&nA(r.slice(0,0))}var qf=Kf,Xf=Jf,jf=typeof Float64Array<"u";function zf(r,e){return r[0]-e[0]}function Zf(){var r=this.stride,e=new Array(r.length),t;for(t=0;t<e.length;++t)e[t]=[Math.abs(r[t]),t];e.sort(zf);var n=new Array(e.length);for(t=0;t<n.length;++t)n[t]=e[t][1];return n}function eg(r,e){var t=["View",e,"d",r].join("");e<0&&(t="View_Nil"+r);var n=r==="generic";if(e===-1){var i="function "+t+"(a){this.data=a;};var proto="+t+".prototype;proto.dtype='"+r+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+t+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+t+"(a){return new "+t+"(a);}",g=new Function(i);return g()}else if(e===0){var i="function "+t+"(a,d) {this.data = a;this.offset = d};var proto="+t+".prototype;proto.dtype='"+r+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+t+"_copy() {return new "+t+"(this.data,this.offset)};proto.pick=function "+t+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+t+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+t+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+t+"(a,b,c,d){return new "+t+"(a,d)}",g=new Function("TrivialArray",i);return g(qi[r][0])}var i=["'use strict'"],s=qf(e),o=s.map(function(p){return"i"+p}),a="this.offset+"+s.map(function(p){return"this.stride["+p+"]*i"+p}).join("+"),l=s.map(function(p){return"b"+p}).join(","),A=s.map(function(p){return"c"+p}).join(",");i.push("function "+t+"(a,"+l+","+A+",d){this.data=a","this.shape=["+l+"]","this.stride=["+A+"]","this.offset=d|0}","var proto="+t+".prototype","proto.dtype='"+r+"'","proto.dimension="+e),i.push("Object.defineProperty(proto,'size',{get:function "+t+"_size(){return "+s.map(function(p){return"this.shape["+p+"]"}).join("*"),"}})"),e===1?i.push("proto.order=[0]"):(i.push("Object.defineProperty(proto,'order',{get:"),e<4?(i.push("function "+t+"_order(){"),e===2?i.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):e===3&&i.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):i.push("ORDER})")),i.push("proto.set=function "+t+"_set("+o.join(",")+",v){"),n?i.push("return this.data.set("+a+",v)}"):i.push("return this.data["+a+"]=v}"),i.push("proto.get=function "+t+"_get("+o.join(",")+"){"),n?i.push("return this.data.get("+a+")}"):i.push("return this.data["+a+"]}"),i.push("proto.index=function "+t+"_index(",o.join(),"){return "+a+"}"),i.push("proto.hi=function "+t+"_hi("+o.join(",")+"){return new "+t+"(this.data,"+s.map(function(p){return["(typeof i",p,"!=='number'||i",p,"<0)?this.shape[",p,"]:i",p,"|0"].join("")}).join(",")+","+s.map(function(p){return"this.stride["+p+"]"}).join(",")+",this.offset)}");var c=s.map(function(p){return"a"+p+"=this.shape["+p+"]"}),u=s.map(function(p){return"c"+p+"=this.stride["+p+"]"});i.push("proto.lo=function "+t+"_lo("+o.join(",")+"){var b=this.offset,d=0,"+c.join(",")+","+u.join(","));for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'&&i"+h+">=0){d=i"+h+"|0;b+=c"+h+"*d;a"+h+"-=d}");i.push("return new "+t+"(this.data,"+s.map(function(p){return"a"+p}).join(",")+","+s.map(function(p){return"c"+p}).join(",")+",b)}"),i.push("proto.step=function "+t+"_step("+o.join(",")+"){var "+s.map(function(p){return"a"+p+"=this.shape["+p+"]"}).join(",")+","+s.map(function(p){return"b"+p+"=this.stride["+p+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'){d=i"+h+"|0;if(d<0){c+=b"+h+"*(a"+h+"-1);a"+h+"=ceil(-a"+h+"/d)}else{a"+h+"=ceil(a"+h+"/d)}b"+h+"*=d}");i.push("return new "+t+"(this.data,"+s.map(function(p){return"a"+p}).join(",")+","+s.map(function(p){return"b"+p}).join(",")+",c)}");for(var d=new Array(e),f=new Array(e),h=0;h<e;++h)d[h]="a[i"+h+"]",f[h]="b[i"+h+"]";i.push("proto.transpose=function "+t+"_transpose("+o+"){"+o.map(function(p,y){return p+"=("+p+"===undefined?"+y+":"+p+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+t+"(this.data,"+d.join(",")+","+f.join(",")+",this.offset)}"),i.push("proto.pick=function "+t+"_pick("+o+"){var a=[],b=[],c=this.offset");for(var h=0;h<e;++h)i.push("if(typeof i"+h+"==='number'&&i"+h+">=0){c=(c+this.stride["+h+"]*i"+h+")|0}else{a.push(this.shape["+h+"]);b.push(this.stride["+h+"])}");i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.push("return function construct_"+t+"(data,shape,stride,offset){return new "+t+"(data,"+s.map(function(p){return"shape["+p+"]"}).join(",")+","+s.map(function(p){return"stride["+p+"]"}).join(",")+",offset)}");var g=new Function("CTOR_LIST","ORDER",i.join(`
73
73
  `));return g(qi[r],Zf)}function tg(r){if(Xf(r))return"buffer";if(jf)switch(Object.prototype.toString.call(r)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(r)?"array":"generic"}var qi={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};function rg(r,e,t,n){if(r===void 0){var A=qi.array[0];return A([])}else typeof r=="number"&&(r=[r]);e===void 0&&(e=[r.length]);var i=e.length;if(t===void 0){t=new Array(i);for(var s=i-1,o=1;s>=0;--s)t[s]=o,o*=e[s]}if(n===void 0){n=0;for(var s=0;s<i;++s)t[s]<0&&(n-=(e[s]-1)*t[s])}for(var a=tg(r),l=qi[a];l.length<=i+1;)l.push(eg(a,l.length-1));var A=l[i+1];return A(r,e,t,n)}var ng=rg,iA={};function ig(r,e){for(var t=1,n=r.length,i=r[0],s=r[0],o=1;o<n;++o)if(s=i,i=r[o],e(i,s)){if(o===t){t++;continue}r[t++]=i}return r.length=t,r}function sg(r){for(var e=1,t=r.length,n=r[0],i=r[0],s=1;s<t;++s,i=n)if(i=n,n=r[s],n!==i){if(s===e){e++;continue}r[e++]=n}return r.length=e,r}function og(r,e,t){return r.length===0?r:e?(t||r.sort(e),ig(r,e)):(t||r.sort(),sg(r))}var ag=og,lg=ag;function sA(r,e,t){var n=r.length,i=e.arrayArgs.length,s=e.indexArgs.length>0,o=[],a=[],l=0,A=0,c,u;for(c=0;c<n;++c)a.push(["i",c,"=0"].join(""));for(u=0;u<i;++u)for(c=0;c<n;++c)A=l,l=r[c],c===0?a.push(["d",u,"s",c,"=t",u,"p",l].join("")):a.push(["d",u,"s",c,"=(t",u,"p",l,"-s",A,"*t",u,"p",A,")"].join(""));for(a.length>0&&o.push("var "+a.join(",")),c=n-1;c>=0;--c)l=r[c],o.push(["for(i",c,"=0;i",c,"<s",l,";++i",c,"){"].join(""));for(o.push(t),c=0;c<n;++c){for(A=l,l=r[c],u=0;u<i;++u)o.push(["p",u,"+=d",u,"s",c].join(""));s&&(c>0&&o.push(["index[",A,"]-=s",A].join("")),o.push(["++index[",l,"]"].join(""))),o.push("}")}return o.join(`
74
74
  `)}function Ag(r,e,t,n){for(var i=e.length,s=t.arrayArgs.length,o=t.blockSize,a=t.indexArgs.length>0,l=[],A=0;A<s;++A)l.push(["var offset",A,"=p",A].join(""));for(var A=r;A<i;++A)l.push(["for(var j"+A+"=SS[",e[A],"]|0;j",A,">0;){"].join("")),l.push(["if(j",A,"<",o,"){"].join("")),l.push(["s",e[A],"=j",A].join("")),l.push(["j",A,"=0"].join("")),l.push(["}else{s",e[A],"=",o].join("")),l.push(["j",A,"-=",o,"}"].join("")),a&&l.push(["index[",e[A],"]=j",A].join(""));for(var A=0;A<s;++A){for(var c=["offset"+A],u=r;u<i;++u)c.push(["j",u,"*t",A,"p",e[u]].join(""));l.push(["p",A,"=(",c.join("+"),")"].join(""))}l.push(sA(e,t,n));for(var A=r;A<i;++A)l.push("}");return l.join(`
75
- `)}function cg(r){for(var e=0,t=r[0].length;e<t;){for(var n=1;n<r.length;++n)if(r[n][e]!==r[0][e])return e;++e}return e}function yo(r,e,t){for(var n=r.body,i=[],s=[],o=0;o<r.args.length;++o){var a=r.args[o];if(!(a.count<=0)){var l=new RegExp(a.name,"g"),A="",c=e.arrayArgs.indexOf(o);switch(e.argTypes[o]){case"offset":var u=e.offsetArgIndex.indexOf(o),h=e.offsetArgs[u];c=h.array,A="+q"+u;case"array":A="p"+c+A;var d="l"+o,f="a"+c;if(e.arrayBlockIndices[c]===0)a.count===1?t[c]==="generic"?a.lvalue?(i.push(["var ",d,"=",f,".get(",A,")"].join("")),n=n.replace(l,d),s.push([f,".set(",A,",",d,")"].join(""))):n=n.replace(l,[f,".get(",A,")"].join("")):n=n.replace(l,[f,"[",A,"]"].join("")):t[c]==="generic"?(i.push(["var ",d,"=",f,".get(",A,")"].join("")),n=n.replace(l,d),a.lvalue&&s.push([f,".set(",A,",",d,")"].join(""))):(i.push(["var ",d,"=",f,"[",A,"]"].join("")),n=n.replace(l,d),a.lvalue&&s.push([f,"[",A,"]=",d].join("")));else{for(var g=[a.name],p=[A],C=0;C<Math.abs(e.arrayBlockIndices[c]);C++)g.push("\\s*\\[([^\\]]+)\\]"),p.push("$"+(C+1)+"*t"+c+"b"+C);if(l=new RegExp(g.join(""),"g"),A=p.join("+"),t[c]==="generic")throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(l,[f,"[",A,"]"].join(""))}break;case"scalar":n=n.replace(l,"Y"+e.scalarArgs.indexOf(o));break;case"index":n=n.replace(l,"index");break;case"shape":n=n.replace(l,"shape");break}}}return[i.join(`
75
+ `)}function cg(r){for(var e=0,t=r[0].length;e<t;){for(var n=1;n<r.length;++n)if(r[n][e]!==r[0][e])return e;++e}return e}function yo(r,e,t){for(var n=r.body,i=[],s=[],o=0;o<r.args.length;++o){var a=r.args[o];if(!(a.count<=0)){var l=new RegExp(a.name,"g"),A="",c=e.arrayArgs.indexOf(o);switch(e.argTypes[o]){case"offset":var u=e.offsetArgIndex.indexOf(o),h=e.offsetArgs[u];c=h.array,A="+q"+u;case"array":A="p"+c+A;var d="l"+o,f="a"+c;if(e.arrayBlockIndices[c]===0)a.count===1?t[c]==="generic"?a.lvalue?(i.push(["var ",d,"=",f,".get(",A,")"].join("")),n=n.replace(l,d),s.push([f,".set(",A,",",d,")"].join(""))):n=n.replace(l,[f,".get(",A,")"].join("")):n=n.replace(l,[f,"[",A,"]"].join("")):t[c]==="generic"?(i.push(["var ",d,"=",f,".get(",A,")"].join("")),n=n.replace(l,d),a.lvalue&&s.push([f,".set(",A,",",d,")"].join(""))):(i.push(["var ",d,"=",f,"[",A,"]"].join("")),n=n.replace(l,d),a.lvalue&&s.push([f,"[",A,"]=",d].join("")));else{for(var g=[a.name],p=[A],y=0;y<Math.abs(e.arrayBlockIndices[c]);y++)g.push("\\s*\\[([^\\]]+)\\]"),p.push("$"+(y+1)+"*t"+c+"b"+y);if(l=new RegExp(g.join(""),"g"),A=p.join("+"),t[c]==="generic")throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(l,[f,"[",A,"]"].join(""))}break;case"scalar":n=n.replace(l,"Y"+e.scalarArgs.indexOf(o));break;case"index":n=n.replace(l,"index");break;case"shape":n=n.replace(l,"shape");break}}}return[i.join(`
76
76
  `),n,s.join(`
77
77
  `)].join(`
78
- `).trim()}function ug(r){for(var e=new Array(r.length),t=!0,n=0;n<r.length;++n){var i=r[n],s=i.match(/\d+/);s?s=s[0]:s="",i.charAt(0)===0?e[n]="u"+i.charAt(1)+s:e[n]=i.charAt(0)+s,n>0&&(t=t&&e[n]===e[n-1])}return t?e[0]:e.join("")}function hg(r,e){for(var t=e[1].length-Math.abs(r.arrayBlockIndices[0])|0,n=new Array(r.arrayArgs.length),i=new Array(r.arrayArgs.length),s=0;s<r.arrayArgs.length;++s)i[s]=e[2*s],n[s]=e[2*s+1];for(var o=[],a=[],l=[],A=[],c=[],s=0;s<r.arrayArgs.length;++s){r.arrayBlockIndices[s]<0?(l.push(0),A.push(t),o.push(t),a.push(t+r.arrayBlockIndices[s])):(l.push(r.arrayBlockIndices[s]),A.push(r.arrayBlockIndices[s]+t),o.push(0),a.push(r.arrayBlockIndices[s]));for(var u=[],h=0;h<n[s].length;h++)l[s]<=n[s][h]&&n[s][h]<A[s]&&u.push(n[s][h]-l[s]);c.push(u)}for(var d=["SS"],f=["'use strict'"],g=[],h=0;h<t;++h)g.push(["s",h,"=SS[",h,"]"].join(""));for(var s=0;s<r.arrayArgs.length;++s){d.push("a"+s),d.push("t"+s),d.push("p"+s);for(var h=0;h<t;++h)g.push(["t",s,"p",h,"=t",s,"[",l[s]+h,"]"].join(""));for(var h=0;h<Math.abs(r.arrayBlockIndices[s]);++h)g.push(["t",s,"b",h,"=t",s,"[",o[s]+h,"]"].join(""))}for(var s=0;s<r.scalarArgs.length;++s)d.push("Y"+s);if(r.shapeArgs.length>0&&g.push("shape=SS.slice(0)"),r.indexArgs.length>0){for(var p=new Array(t),s=0;s<t;++s)p[s]="0";g.push(["index=[",p.join(","),"]"].join(""))}for(var s=0;s<r.offsetArgs.length;++s){for(var C=r.offsetArgs[s],Q=[],h=0;h<C.offset.length;++h)C.offset[h]!==0&&(C.offset[h]===1?Q.push(["t",C.array,"p",h].join("")):Q.push([C.offset[h],"*t",C.array,"p",h].join("")));Q.length===0?g.push("q"+s+"=0"):g.push(["q",s,"=",Q.join("+")].join(""))}var b=lg([].concat(r.pre.thisVars).concat(r.body.thisVars).concat(r.post.thisVars));g=g.concat(b),g.length>0&&f.push("var "+g.join(","));for(var s=0;s<r.arrayArgs.length;++s)f.push("p"+s+"|=0");r.pre.body.length>3&&f.push(yo(r.pre,r,i));var y=yo(r.body,r,i),w=cg(c);w<t?f.push(Ag(w,c[0],r,y)):f.push(sA(c[0],r,y)),r.post.body.length>3&&f.push(yo(r.post,r,i)),r.debug&&console.log("-----Generated cwise routine for ",e,`:
78
+ `).trim()}function ug(r){for(var e=new Array(r.length),t=!0,n=0;n<r.length;++n){var i=r[n],s=i.match(/\d+/);s?s=s[0]:s="",i.charAt(0)===0?e[n]="u"+i.charAt(1)+s:e[n]=i.charAt(0)+s,n>0&&(t=t&&e[n]===e[n-1])}return t?e[0]:e.join("")}function hg(r,e){for(var t=e[1].length-Math.abs(r.arrayBlockIndices[0])|0,n=new Array(r.arrayArgs.length),i=new Array(r.arrayArgs.length),s=0;s<r.arrayArgs.length;++s)i[s]=e[2*s],n[s]=e[2*s+1];for(var o=[],a=[],l=[],A=[],c=[],s=0;s<r.arrayArgs.length;++s){r.arrayBlockIndices[s]<0?(l.push(0),A.push(t),o.push(t),a.push(t+r.arrayBlockIndices[s])):(l.push(r.arrayBlockIndices[s]),A.push(r.arrayBlockIndices[s]+t),o.push(0),a.push(r.arrayBlockIndices[s]));for(var u=[],h=0;h<n[s].length;h++)l[s]<=n[s][h]&&n[s][h]<A[s]&&u.push(n[s][h]-l[s]);c.push(u)}for(var d=["SS"],f=["'use strict'"],g=[],h=0;h<t;++h)g.push(["s",h,"=SS[",h,"]"].join(""));for(var s=0;s<r.arrayArgs.length;++s){d.push("a"+s),d.push("t"+s),d.push("p"+s);for(var h=0;h<t;++h)g.push(["t",s,"p",h,"=t",s,"[",l[s]+h,"]"].join(""));for(var h=0;h<Math.abs(r.arrayBlockIndices[s]);++h)g.push(["t",s,"b",h,"=t",s,"[",o[s]+h,"]"].join(""))}for(var s=0;s<r.scalarArgs.length;++s)d.push("Y"+s);if(r.shapeArgs.length>0&&g.push("shape=SS.slice(0)"),r.indexArgs.length>0){for(var p=new Array(t),s=0;s<t;++s)p[s]="0";g.push(["index=[",p.join(","),"]"].join(""))}for(var s=0;s<r.offsetArgs.length;++s){for(var y=r.offsetArgs[s],Q=[],h=0;h<y.offset.length;++h)y.offset[h]!==0&&(y.offset[h]===1?Q.push(["t",y.array,"p",h].join("")):Q.push([y.offset[h],"*t",y.array,"p",h].join("")));Q.length===0?g.push("q"+s+"=0"):g.push(["q",s,"=",Q.join("+")].join(""))}var b=lg([].concat(r.pre.thisVars).concat(r.body.thisVars).concat(r.post.thisVars));g=g.concat(b),g.length>0&&f.push("var "+g.join(","));for(var s=0;s<r.arrayArgs.length;++s)f.push("p"+s+"|=0");r.pre.body.length>3&&f.push(yo(r.pre,r,i));var C=yo(r.body,r,i),w=cg(c);w<t?f.push(Ag(w,c[0],r,C)):f.push(sA(c[0],r,C)),r.post.body.length>3&&f.push(yo(r.post,r,i)),r.debug&&console.log("-----Generated cwise routine for ",e,`:
79
79
  `+f.join(`
80
80
  `)+`
81
81
  ----------`);var R=[r.funcName||"unnamed","_cwise_loop_",n[0].join("s"),"m",w,ug(i)].join(""),k=new Function(["function ",R,"(",d.join(","),"){",f.join(`
@@ -88,11 +88,11 @@ ${e}`,Nf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mf=Objec
88
88
  *
89
89
  * @author Feross Aboukhadijeh <https://feross.org>
90
90
  * @license MIT
91
- */(function(r){var e=Xi,t=Qo,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=a,r.SlowBuffer=Q,r.INSPECT_MAX_BYTES=50;var i=2147483647;r.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{var T=new Uint8Array(1),m={foo:function(){return 42}};return Object.setPrototypeOf(m,Uint8Array.prototype),Object.setPrototypeOf(T,m),T.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');var m=new Uint8Array(T);return Object.setPrototypeOf(m,a.prototype),m}function a(T,m,E){if(typeof T=="number"){if(typeof m=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(T)}return l(T,m,E)}a.poolSize=8192;function l(T,m,E){if(typeof T=="string")return h(T,m);if(ArrayBuffer.isView(T))return f(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(we(T,ArrayBuffer)||T&&we(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(we(T,SharedArrayBuffer)||T&&we(T.buffer,SharedArrayBuffer)))return g(T,m,E);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var x=T.valueOf&&T.valueOf();if(x!=null&&x!==T)return a.from(x,m,E);var M=p(T);if(M)return M;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return a.from(T[Symbol.toPrimitive]("string"),m,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}a.from=function(T,m,E){return l(T,m,E)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function A(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function c(T,m,E){return A(T),T<=0?o(T):m!==void 0?typeof E=="string"?o(T).fill(m,E):o(T).fill(m):o(T)}a.alloc=function(T,m,E){return c(T,m,E)};function u(T){return A(T),o(T<0?0:C(T)|0)}a.allocUnsafe=function(T){return u(T)},a.allocUnsafeSlow=function(T){return u(T)};function h(T,m){if((typeof m!="string"||m==="")&&(m="utf8"),!a.isEncoding(m))throw new TypeError("Unknown encoding: "+m);var E=b(T,m)|0,x=o(E),M=x.write(T,m);return M!==E&&(x=x.slice(0,M)),x}function d(T){for(var m=T.length<0?0:C(T.length)|0,E=o(m),x=0;x<m;x+=1)E[x]=T[x]&255;return E}function f(T){if(we(T,Uint8Array)){var m=new Uint8Array(T);return g(m.buffer,m.byteOffset,m.byteLength)}return d(T)}function g(T,m,E){if(m<0||T.byteLength<m)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<m+(E||0))throw new RangeError('"length" is outside of buffer bounds');var x;return m===void 0&&E===void 0?x=new Uint8Array(T):E===void 0?x=new Uint8Array(T,m):x=new Uint8Array(T,m,E),Object.setPrototypeOf(x,a.prototype),x}function p(T){if(a.isBuffer(T)){var m=C(T.length)|0,E=o(m);return E.length===0||T.copy(E,0,0,m),E}if(T.length!==void 0)return typeof T.length!="number"||We(T.length)?o(0):d(T);if(T.type==="Buffer"&&Array.isArray(T.data))return d(T.data)}function C(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function Q(T){return+T!=T&&(T=0),a.alloc(+T)}a.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==a.prototype},a.compare=function(m,E){if(we(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),we(E,Uint8Array)&&(E=a.from(E,E.offset,E.byteLength)),!a.isBuffer(m)||!a.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===E)return 0;for(var x=m.length,M=E.length,z=0,j=Math.min(x,M);z<j;++z)if(m[z]!==E[z]){x=m[z],M=E[z];break}return x<M?-1:M<x?1:0},a.isEncoding=function(m){switch(String(m).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(m,E){if(!Array.isArray(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return a.alloc(0);var x;if(E===void 0)for(E=0,x=0;x<m.length;++x)E+=m[x].length;var M=a.allocUnsafe(E),z=0;for(x=0;x<m.length;++x){var j=m[x];if(we(j,Uint8Array))z+j.length>M.length?a.from(j).copy(M,z):Uint8Array.prototype.set.call(M,j,z);else if(a.isBuffer(j))j.copy(M,z);else throw new TypeError('"list" argument must be an Array of Buffers');z+=j.length}return M};function b(T,m){if(a.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||we(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);var E=T.length,x=arguments.length>2&&arguments[2]===!0;if(!x&&E===0)return 0;for(var M=!1;;)switch(m){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return Le(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E*2;case"hex":return E>>>1;case"base64":return Qe(T).length;default:if(M)return x?-1:Le(T).length;m=(""+m).toLowerCase(),M=!0}}a.byteLength=b;function y(T,m,E){var x=!1;if((m===void 0||m<0)&&(m=0),m>this.length||((E===void 0||E>this.length)&&(E=this.length),E<=0)||(E>>>=0,m>>>=0,E<=m))return"";for(T||(T="utf8");;)switch(T){case"hex":return S(this,m,E);case"utf8":case"utf-8":return le(this,m,E);case"ascii":return X(this,m,E);case"latin1":case"binary":return D(this,m,E);case"base64":return ee(this,m,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,m,E);default:if(x)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),x=!0}}a.prototype._isBuffer=!0;function w(T,m,E){var x=T[m];T[m]=T[E],T[E]=x}a.prototype.swap16=function(){var m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<m;E+=2)w(this,E,E+1);return this},a.prototype.swap32=function(){var m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<m;E+=4)w(this,E,E+3),w(this,E+1,E+2);return this},a.prototype.swap64=function(){var m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<m;E+=8)w(this,E,E+7),w(this,E+1,E+6),w(this,E+2,E+5),w(this,E+3,E+4);return this},a.prototype.toString=function(){var m=this.length;return m===0?"":arguments.length===0?le(this,0,m):y.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(m){if(!a.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:a.compare(this,m)===0},a.prototype.inspect=function(){var m="",E=r.INSPECT_MAX_BYTES;return m=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(m+=" ... "),"<Buffer "+m+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(m,E,x,M,z){if(we(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),!a.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(E===void 0&&(E=0),x===void 0&&(x=m?m.length:0),M===void 0&&(M=0),z===void 0&&(z=this.length),E<0||x>m.length||M<0||z>this.length)throw new RangeError("out of range index");if(M>=z&&E>=x)return 0;if(M>=z)return-1;if(E>=x)return 1;if(E>>>=0,x>>>=0,M>>>=0,z>>>=0,this===m)return 0;for(var j=z-M,Ie=x-E,be=Math.min(j,Ie),De=this.slice(M,z),ke=m.slice(E,x),_e=0;_e<be;++_e)if(De[_e]!==ke[_e]){j=De[_e],Ie=ke[_e];break}return j<Ie?-1:Ie<j?1:0};function R(T,m,E,x,M){if(T.length===0)return-1;if(typeof E=="string"?(x=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,We(E)&&(E=M?0:T.length-1),E<0&&(E=T.length+E),E>=T.length){if(M)return-1;E=T.length-1}else if(E<0)if(M)E=0;else return-1;if(typeof m=="string"&&(m=a.from(m,x)),a.isBuffer(m))return m.length===0?-1:k(T,m,E,x,M);if(typeof m=="number")return m=m&255,typeof Uint8Array.prototype.indexOf=="function"?M?Uint8Array.prototype.indexOf.call(T,m,E):Uint8Array.prototype.lastIndexOf.call(T,m,E):k(T,[m],E,x,M);throw new TypeError("val must be string, number or Buffer")}function k(T,m,E,x,M){var z=1,j=T.length,Ie=m.length;if(x!==void 0&&(x=String(x).toLowerCase(),x==="ucs2"||x==="ucs-2"||x==="utf16le"||x==="utf-16le")){if(T.length<2||m.length<2)return-1;z=2,j/=2,Ie/=2,E/=2}function be(ut,Ut){return z===1?ut[Ut]:ut.readUInt16BE(Ut*z)}var De;if(M){var ke=-1;for(De=E;De<j;De++)if(be(T,De)===be(m,ke===-1?0:De-ke)){if(ke===-1&&(ke=De),De-ke+1===Ie)return ke*z}else ke!==-1&&(De-=De-ke),ke=-1}else for(E+Ie>j&&(E=j-Ie),De=E;De>=0;De--){for(var _e=!0,Mt=0;Mt<Ie;Mt++)if(be(T,De+Mt)!==be(m,Mt)){_e=!1;break}if(_e)return De}return-1}a.prototype.includes=function(m,E,x){return this.indexOf(m,E,x)!==-1},a.prototype.indexOf=function(m,E,x){return R(this,m,E,x,!0)},a.prototype.lastIndexOf=function(m,E,x){return R(this,m,E,x,!1)};function $(T,m,E,x){E=Number(E)||0;var M=T.length-E;x?(x=Number(x),x>M&&(x=M)):x=M;var z=m.length;x>z/2&&(x=z/2);for(var j=0;j<x;++j){var Ie=parseInt(m.substr(j*2,2),16);if(We(Ie))return j;T[E+j]=Ie}return j}function K(T,m,E,x){return Me(Le(m,T.length-E),T,E,x)}function O(T,m,E,x){return Me(Ge(m),T,E,x)}function J(T,m,E,x){return Me(Qe(m),T,E,x)}function ie(T,m,E,x){return Me(fe(m,T.length-E),T,E,x)}a.prototype.write=function(m,E,x,M){if(E===void 0)M="utf8",x=this.length,E=0;else if(x===void 0&&typeof E=="string")M=E,x=this.length,E=0;else if(isFinite(E))E=E>>>0,isFinite(x)?(x=x>>>0,M===void 0&&(M="utf8")):(M=x,x=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var z=this.length-E;if((x===void 0||x>z)&&(x=z),m.length>0&&(x<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");M||(M="utf8");for(var j=!1;;)switch(M){case"hex":return $(this,m,E,x);case"utf8":case"utf-8":return K(this,m,E,x);case"ascii":case"latin1":case"binary":return O(this,m,E,x);case"base64":return J(this,m,E,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ie(this,m,E,x);default:if(j)throw new TypeError("Unknown encoding: "+M);M=(""+M).toLowerCase(),j=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ee(T,m,E){return m===0&&E===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(m,E))}function le(T,m,E){E=Math.min(T.length,E);for(var x=[],M=m;M<E;){var z=T[M],j=null,Ie=z>239?4:z>223?3:z>191?2:1;if(M+Ie<=E){var be,De,ke,_e;switch(Ie){case 1:z<128&&(j=z);break;case 2:be=T[M+1],(be&192)===128&&(_e=(z&31)<<6|be&63,_e>127&&(j=_e));break;case 3:be=T[M+1],De=T[M+2],(be&192)===128&&(De&192)===128&&(_e=(z&15)<<12|(be&63)<<6|De&63,_e>2047&&(_e<55296||_e>57343)&&(j=_e));break;case 4:be=T[M+1],De=T[M+2],ke=T[M+3],(be&192)===128&&(De&192)===128&&(ke&192)===128&&(_e=(z&15)<<18|(be&63)<<12|(De&63)<<6|ke&63,_e>65535&&_e<1114112&&(j=_e))}}j===null?(j=65533,Ie=1):j>65535&&(j-=65536,x.push(j>>>10&1023|55296),j=56320|j&1023),x.push(j),M+=Ie}return P(x)}var _=4096;function P(T){var m=T.length;if(m<=_)return String.fromCharCode.apply(String,T);for(var E="",x=0;x<m;)E+=String.fromCharCode.apply(String,T.slice(x,x+=_));return E}function X(T,m,E){var x="";E=Math.min(T.length,E);for(var M=m;M<E;++M)x+=String.fromCharCode(T[M]&127);return x}function D(T,m,E){var x="";E=Math.min(T.length,E);for(var M=m;M<E;++M)x+=String.fromCharCode(T[M]);return x}function S(T,m,E){var x=T.length;(!m||m<0)&&(m=0),(!E||E<0||E>x)&&(E=x);for(var M="",z=m;z<E;++z)M+=Te[T[z]];return M}function F(T,m,E){for(var x=T.slice(m,E),M="",z=0;z<x.length-1;z+=2)M+=String.fromCharCode(x[z]+x[z+1]*256);return M}a.prototype.slice=function(m,E){var x=this.length;m=~~m,E=E===void 0?x:~~E,m<0?(m+=x,m<0&&(m=0)):m>x&&(m=x),E<0?(E+=x,E<0&&(E=0)):E>x&&(E=x),E<m&&(E=m);var M=this.subarray(m,E);return Object.setPrototypeOf(M,a.prototype),M};function W(T,m,E){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+m>E)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(m,E,x){m=m>>>0,E=E>>>0,x||W(m,E,this.length);for(var M=this[m],z=1,j=0;++j<E&&(z*=256);)M+=this[m+j]*z;return M},a.prototype.readUintBE=a.prototype.readUIntBE=function(m,E,x){m=m>>>0,E=E>>>0,x||W(m,E,this.length);for(var M=this[m+--E],z=1;E>0&&(z*=256);)M+=this[m+--E]*z;return M},a.prototype.readUint8=a.prototype.readUInt8=function(m,E){return m=m>>>0,E||W(m,1,this.length),this[m]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(m,E){return m=m>>>0,E||W(m,2,this.length),this[m]|this[m+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(m,E){return m=m>>>0,E||W(m,2,this.length),this[m]<<8|this[m+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(m,E){return m=m>>>0,E||W(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(m,E){return m=m>>>0,E||W(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},a.prototype.readIntLE=function(m,E,x){m=m>>>0,E=E>>>0,x||W(m,E,this.length);for(var M=this[m],z=1,j=0;++j<E&&(z*=256);)M+=this[m+j]*z;return z*=128,M>=z&&(M-=Math.pow(2,8*E)),M},a.prototype.readIntBE=function(m,E,x){m=m>>>0,E=E>>>0,x||W(m,E,this.length);for(var M=E,z=1,j=this[m+--M];M>0&&(z*=256);)j+=this[m+--M]*z;return z*=128,j>=z&&(j-=Math.pow(2,8*E)),j},a.prototype.readInt8=function(m,E){return m=m>>>0,E||W(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},a.prototype.readInt16LE=function(m,E){m=m>>>0,E||W(m,2,this.length);var x=this[m]|this[m+1]<<8;return x&32768?x|4294901760:x},a.prototype.readInt16BE=function(m,E){m=m>>>0,E||W(m,2,this.length);var x=this[m+1]|this[m]<<8;return x&32768?x|4294901760:x},a.prototype.readInt32LE=function(m,E){return m=m>>>0,E||W(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},a.prototype.readInt32BE=function(m,E){return m=m>>>0,E||W(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},a.prototype.readFloatLE=function(m,E){return m=m>>>0,E||W(m,4,this.length),t.read(this,m,!0,23,4)},a.prototype.readFloatBE=function(m,E){return m=m>>>0,E||W(m,4,this.length),t.read(this,m,!1,23,4)},a.prototype.readDoubleLE=function(m,E){return m=m>>>0,E||W(m,8,this.length),t.read(this,m,!0,52,8)},a.prototype.readDoubleBE=function(m,E){return m=m>>>0,E||W(m,8,this.length),t.read(this,m,!1,52,8)};function Y(T,m,E,x,M,z){if(!a.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>M||m<z)throw new RangeError('"value" argument is out of bounds');if(E+x>T.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(m,E,x,M){if(m=+m,E=E>>>0,x=x>>>0,!M){var z=Math.pow(2,8*x)-1;Y(this,m,E,x,z,0)}var j=1,Ie=0;for(this[E]=m&255;++Ie<x&&(j*=256);)this[E+Ie]=m/j&255;return E+x},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(m,E,x,M){if(m=+m,E=E>>>0,x=x>>>0,!M){var z=Math.pow(2,8*x)-1;Y(this,m,E,x,z,0)}var j=x-1,Ie=1;for(this[E+j]=m&255;--j>=0&&(Ie*=256);)this[E+j]=m/Ie&255;return E+x},a.prototype.writeUint8=a.prototype.writeUInt8=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,1,255,0),this[E]=m&255,E+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,65535,0),this[E]=m&255,this[E+1]=m>>>8,E+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,65535,0),this[E]=m>>>8,this[E+1]=m&255,E+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,4294967295,0),this[E+3]=m>>>24,this[E+2]=m>>>16,this[E+1]=m>>>8,this[E]=m&255,E+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,4294967295,0),this[E]=m>>>24,this[E+1]=m>>>16,this[E+2]=m>>>8,this[E+3]=m&255,E+4},a.prototype.writeIntLE=function(m,E,x,M){if(m=+m,E=E>>>0,!M){var z=Math.pow(2,8*x-1);Y(this,m,E,x,z-1,-z)}var j=0,Ie=1,be=0;for(this[E]=m&255;++j<x&&(Ie*=256);)m<0&&be===0&&this[E+j-1]!==0&&(be=1),this[E+j]=(m/Ie>>0)-be&255;return E+x},a.prototype.writeIntBE=function(m,E,x,M){if(m=+m,E=E>>>0,!M){var z=Math.pow(2,8*x-1);Y(this,m,E,x,z-1,-z)}var j=x-1,Ie=1,be=0;for(this[E+j]=m&255;--j>=0&&(Ie*=256);)m<0&&be===0&&this[E+j+1]!==0&&(be=1),this[E+j]=(m/Ie>>0)-be&255;return E+x},a.prototype.writeInt8=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,1,127,-128),m<0&&(m=255+m+1),this[E]=m&255,E+1},a.prototype.writeInt16LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,32767,-32768),this[E]=m&255,this[E+1]=m>>>8,E+2},a.prototype.writeInt16BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,32767,-32768),this[E]=m>>>8,this[E+1]=m&255,E+2},a.prototype.writeInt32LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,2147483647,-2147483648),this[E]=m&255,this[E+1]=m>>>8,this[E+2]=m>>>16,this[E+3]=m>>>24,E+4},a.prototype.writeInt32BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[E]=m>>>24,this[E+1]=m>>>16,this[E+2]=m>>>8,this[E+3]=m&255,E+4};function ne(T,m,E,x,M,z){if(E+x>T.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function ce(T,m,E,x,M){return m=+m,E=E>>>0,M||ne(T,m,E,4),t.write(T,m,E,x,23,4),E+4}a.prototype.writeFloatLE=function(m,E,x){return ce(this,m,E,!0,x)},a.prototype.writeFloatBE=function(m,E,x){return ce(this,m,E,!1,x)};function pe(T,m,E,x,M){return m=+m,E=E>>>0,M||ne(T,m,E,8),t.write(T,m,E,x,52,8),E+8}a.prototype.writeDoubleLE=function(m,E,x){return pe(this,m,E,!0,x)},a.prototype.writeDoubleBE=function(m,E,x){return pe(this,m,E,!1,x)},a.prototype.copy=function(m,E,x,M){if(!a.isBuffer(m))throw new TypeError("argument should be a Buffer");if(x||(x=0),!M&&M!==0&&(M=this.length),E>=m.length&&(E=m.length),E||(E=0),M>0&&M<x&&(M=x),M===x||m.length===0||this.length===0)return 0;if(E<0)throw new RangeError("targetStart out of bounds");if(x<0||x>=this.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("sourceEnd out of bounds");M>this.length&&(M=this.length),m.length-E<M-x&&(M=m.length-E+x);var z=M-x;return this===m&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(E,x,M):Uint8Array.prototype.set.call(m,this.subarray(x,M),E),z},a.prototype.fill=function(m,E,x,M){if(typeof m=="string"){if(typeof E=="string"?(M=E,E=0,x=this.length):typeof x=="string"&&(M=x,x=this.length),M!==void 0&&typeof M!="string")throw new TypeError("encoding must be a string");if(typeof M=="string"&&!a.isEncoding(M))throw new TypeError("Unknown encoding: "+M);if(m.length===1){var z=m.charCodeAt(0);(M==="utf8"&&z<128||M==="latin1")&&(m=z)}}else typeof m=="number"?m=m&255:typeof m=="boolean"&&(m=Number(m));if(E<0||this.length<E||this.length<x)throw new RangeError("Out of range index");if(x<=E)return this;E=E>>>0,x=x===void 0?this.length:x>>>0,m||(m=0);var j;if(typeof m=="number")for(j=E;j<x;++j)this[j]=m;else{var Ie=a.isBuffer(m)?m:a.from(m,M),be=Ie.length;if(be===0)throw new TypeError('The value "'+m+'" is invalid for argument "value"');for(j=0;j<x-E;++j)this[j+E]=Ie[j%be]}return this};var ge=/[^+/0-9A-Za-z-_]/g;function Se(T){if(T=T.split("=")[0],T=T.trim().replace(ge,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function Le(T,m){m=m||1/0;for(var E,x=T.length,M=null,z=[],j=0;j<x;++j){if(E=T.charCodeAt(j),E>55295&&E<57344){if(!M){if(E>56319){(m-=3)>-1&&z.push(239,191,189);continue}else if(j+1===x){(m-=3)>-1&&z.push(239,191,189);continue}M=E;continue}if(E<56320){(m-=3)>-1&&z.push(239,191,189),M=E;continue}E=(M-55296<<10|E-56320)+65536}else M&&(m-=3)>-1&&z.push(239,191,189);if(M=null,E<128){if((m-=1)<0)break;z.push(E)}else if(E<2048){if((m-=2)<0)break;z.push(E>>6|192,E&63|128)}else if(E<65536){if((m-=3)<0)break;z.push(E>>12|224,E>>6&63|128,E&63|128)}else if(E<1114112){if((m-=4)<0)break;z.push(E>>18|240,E>>12&63|128,E>>6&63|128,E&63|128)}else throw new Error("Invalid code point")}return z}function Ge(T){for(var m=[],E=0;E<T.length;++E)m.push(T.charCodeAt(E)&255);return m}function fe(T,m){for(var E,x,M,z=[],j=0;j<T.length&&!((m-=2)<0);++j)E=T.charCodeAt(j),x=E>>8,M=E%256,z.push(M),z.push(x);return z}function Qe(T){return e.toByteArray(Se(T))}function Me(T,m,E,x){for(var M=0;M<x&&!(M+E>=m.length||M>=T.length);++M)m[M+E]=T[M];return M}function we(T,m){return T instanceof m||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===m.name}function We(T){return T!==T}var Te=function(){for(var T="0123456789abcdef",m=new Array(256),E=0;E<16;++E)for(var x=E*16,M=0;M<16;++M)m[x+M]=T[E]+T[M];return m}()})(lA);var Nr=ze,Ct=Bg,cA=lA.Buffer;mn.__TYPEDARRAY_POOL||(mn.__TYPEDARRAY_POOL={UINT8:Ct([32,0]),UINT16:Ct([32,0]),UINT32:Ct([32,0]),BIGUINT64:Ct([32,0]),INT8:Ct([32,0]),INT16:Ct([32,0]),INT32:Ct([32,0]),BIGINT64:Ct([32,0]),FLOAT:Ct([32,0]),DOUBLE:Ct([32,0]),DATA:Ct([32,0]),UINT8C:Ct([32,0]),BUFFER:Ct([32,0])});var _g=typeof Uint8ClampedArray<"u",Lg=typeof BigUint64Array<"u",Fg=typeof BigInt64Array<"u",rt=mn.__TYPEDARRAY_POOL;rt.UINT8C||(rt.UINT8C=Ct([32,0])),rt.BIGUINT64||(rt.BIGUINT64=Ct([32,0])),rt.BIGINT64||(rt.BIGINT64=Ct([32,0])),rt.BUFFER||(rt.BUFFER=Ct([32,0]));var ji=rt.DATA,zi=rt.BUFFER;Ne.free=function(e){if(cA.isBuffer(e))zi[Nr.log2(e.length)].push(e);else{if(Object.prototype.toString.call(e)!=="[object ArrayBuffer]"&&(e=e.buffer),!e)return;var t=e.length||e.byteLength,n=Nr.log2(t)|0;ji[n].push(e)}};function uA(r){if(r){var e=r.length||r.byteLength,t=Nr.log2(e);ji[t].push(r)}}function kg(r){uA(r.buffer)}Ne.freeUint8=Ne.freeUint16=Ne.freeUint32=Ne.freeBigUint64=Ne.freeInt8=Ne.freeInt16=Ne.freeInt32=Ne.freeBigInt64=Ne.freeFloat32=Ne.freeFloat=Ne.freeFloat64=Ne.freeDouble=Ne.freeUint8Clamped=Ne.freeDataView=kg,Ne.freeArrayBuffer=uA,Ne.freeBuffer=function(e){zi[Nr.log2(e.length)].push(e)},Ne.malloc=function(e,t){if(t===void 0||t==="arraybuffer")return Dt(e);switch(t){case"uint8":return bo(e);case"uint16":return hA(e);case"uint32":return dA(e);case"int8":return fA(e);case"int16":return gA(e);case"int32":return pA(e);case"float":case"float32":return mA(e);case"double":case"float64":return EA(e);case"uint8_clamped":return IA(e);case"bigint64":return CA(e);case"biguint64":return vA(e);case"buffer":return BA(e);case"data":case"dataview":return yA(e);default:return null}return null};function Dt(e){var e=Nr.nextPow2(e),t=Nr.log2(e),n=ji[t];return n.length>0?n.pop():new ArrayBuffer(e)}Ne.mallocArrayBuffer=Dt;function bo(r){return new Uint8Array(Dt(r),0,r)}Ne.mallocUint8=bo;function hA(r){return new Uint16Array(Dt(2*r),0,r)}Ne.mallocUint16=hA;function dA(r){return new Uint32Array(Dt(4*r),0,r)}Ne.mallocUint32=dA;function fA(r){return new Int8Array(Dt(r),0,r)}Ne.mallocInt8=fA;function gA(r){return new Int16Array(Dt(2*r),0,r)}Ne.mallocInt16=gA;function pA(r){return new Int32Array(Dt(4*r),0,r)}Ne.mallocInt32=pA;function mA(r){return new Float32Array(Dt(4*r),0,r)}Ne.mallocFloat32=Ne.mallocFloat=mA;function EA(r){return new Float64Array(Dt(8*r),0,r)}Ne.mallocFloat64=Ne.mallocDouble=EA;function IA(r){return _g?new Uint8ClampedArray(Dt(r),0,r):bo(r)}Ne.mallocUint8Clamped=IA;function vA(r){return Lg?new BigUint64Array(Dt(8*r),0,r):null}Ne.mallocBigUint64=vA;function CA(r){return Fg?new BigInt64Array(Dt(8*r),0,r):null}Ne.mallocBigInt64=CA;function yA(r){return new DataView(Dt(r),0,r)}Ne.mallocDataView=yA;function BA(r){r=Nr.nextPow2(r);var e=Nr.log2(r),t=zi[e];return t.length>0?t.pop():new cA(r)}Ne.mallocBuffer=BA,Ne.clearCache=function(){for(var e=0;e<32;++e)rt.UINT8[e].length=0,rt.UINT16[e].length=0,rt.UINT32[e].length=0,rt.INT8[e].length=0,rt.INT16[e].length=0,rt.INT32[e].length=0,rt.FLOAT[e].length=0,rt.DOUBLE[e].length=0,rt.BIGUINT64[e].length=0,rt.BIGINT64[e].length=0,rt.UINT8C[e].length=0,ji[e].length=0,zi[e].length=0};var Zi=ng,xo=iA,In=Ne,Ng=Gg,es=null,wo=null,ts=null;function Mg(r){es=[r.LINEAR,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_NEAREST],wo=[r.NEAREST,r.LINEAR,r.NEAREST_MIPMAP_NEAREST,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_LINEAR],ts=[r.REPEAT,r.CLAMP_TO_EDGE,r.MIRRORED_REPEAT]}function TA(r){return typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement||typeof ImageData<"u"&&r instanceof ImageData}var QA=function(r,e){xo.muls(r,e,255)};function So(r,e,t){var n=r.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>i||t<0||t>i)throw new Error("gl-texture2d: Invalid texture size");return r._shape=[e,t],r.bind(),n.texImage2D(n.TEXTURE_2D,0,r.format,e,t,0,r.format,r.type,null),r._mipLevels=[0],r}function rs(r,e,t,n,i,s){this.gl=r,this.handle=e,this.format=i,this.type=s,this._shape=[t,n],this._mipLevels=[0],this._magFilter=r.NEAREST,this._minFilter=r.NEAREST,this._wrapS=r.CLAMP_TO_EDGE,this._wrapT=r.CLAMP_TO_EDGE,this._anisoSamples=1;var o=this,a=[this._wrapS,this._wrapT];Object.defineProperties(a,[{get:function(){return o._wrapS},set:function(A){return o.wrapS=A}},{get:function(){return o._wrapT},set:function(A){return o.wrapT=A}}]),this._wrapVector=a;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return o._shape[0]},set:function(A){return o.width=A}},{get:function(){return o._shape[1]},set:function(A){return o.height=A}}]),this._shapeVector=l}var si=rs.prototype;Object.defineProperties(si,{minFilter:{get:function(){return this._minFilter},set:function(r){this.bind();var e=this.gl;if(this.type===e.FLOAT&&es.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),wo.indexOf(r)<0)throw new Error("gl-texture2d: Unknown filter mode "+r);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,r),this._minFilter=r}},magFilter:{get:function(){return this._magFilter},set:function(r){this.bind();var e=this.gl;if(this.type===e.FLOAT&&es.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),wo.indexOf(r)<0)throw new Error("gl-texture2d: Unknown filter mode "+r);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),this._magFilter=r}},mipSamples:{get:function(){return this._anisoSamples},set:function(r){var e=this._anisoSamples;if(this._anisoSamples=Math.max(r,1)|0,e!==this._anisoSamples){var t=this.gl.getExtension("EXT_texture_filter_anisotropic");t&&this.gl.texParameterf(this.gl.TEXTURE_2D,t.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(r){if(this.bind(),ts.indexOf(r)<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,r),this._wrapS=r}},wrapT:{get:function(){return this._wrapT},set:function(r){if(this.bind(),ts.indexOf(r)<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,r),this._wrapT=r}},wrap:{get:function(){return this._wrapVector},set:function(r){if(Array.isArray(r)||(r=[r,r]),r.length!==2)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(ts.indexOf(r[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);this._wrapS=r[0],this._wrapT=r[1];var t=this.gl;return this.bind(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this._wrapS),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this._wrapT),r}},shape:{get:function(){return this._shapeVector},set:function(r){if(!Array.isArray(r))r=[r|0,r|0];else if(r.length!==2)throw new Error("gl-texture2d: Invalid texture shape");return So(this,r[0]|0,r[1]|0),[r[0]|0,r[1]|0]}},width:{get:function(){return this._shape[0]},set:function(r){return r=r|0,So(this,r,this._shape[1]),r}},height:{get:function(){return this._shape[1]},set:function(r){return r=r|0,So(this,this._shape[0],r),r}}}),si.bind=function(r){var e=this.gl;return r!==void 0&&e.activeTexture(e.TEXTURE0+(r|0)),e.bindTexture(e.TEXTURE_2D,this.handle),r!==void 0?r|0:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},si.dispose=function(){this.gl.deleteTexture(this.handle)},si.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var r=Math.min(this._shape[0],this._shape[1]),e=0;r>0;++e,r>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},si.setPixels=function(r,e,t,n){var i=this.gl;this.bind(),Array.isArray(e)?(n=t,t=e[1]|0,e=e[0]|0):(e=e||0,t=t||0),n=n||0;var s=TA(r)?r:r.raw;if(s){var o=this._mipLevels.indexOf(n)<0;o?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,s),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,t,this.format,this.type,s)}else if(r.shape&&r.stride&&r.data){if(r.shape.length<2||e+r.shape[1]>this._shape[1]>>>n||t+r.shape[0]>this._shape[0]>>>n||e<0||t<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");Pg(i,e,t,n,this.format,this.type,this._mipLevels,r)}else throw new Error("gl-texture2d: Unsupported data type")};function bA(r,e){return r.length===3?e[2]===1&&e[1]===r[0]*r[2]&&e[0]===r[2]:e[0]===1&&e[1]===r[0]}function Pg(r,e,t,n,i,s,o,a){var l=a.dtype,A=a.shape.slice();if(A.length<2||A.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var c=0,u=0,h=bA(A,a.stride.slice());if(l==="float32"?c=r.FLOAT:l==="float64"?(c=r.FLOAT,h=!1,l="float32"):l==="uint8"?c=r.UNSIGNED_BYTE:(c=r.UNSIGNED_BYTE,h=!1,l="uint8"),A.length===2)u=r.LUMINANCE,A=[A[0],A[1],1],a=Zi(a.data,A,[a.stride[0],a.stride[1],1],a.offset);else if(A.length===3){if(A[2]===1)u=r.ALPHA;else if(A[2]===2)u=r.LUMINANCE_ALPHA;else if(A[2]===3)u=r.RGB;else if(A[2]===4)u=r.RGBA;else throw new Error("gl-texture2d: Invalid shape for pixel coords");A[2]}else throw new Error("gl-texture2d: Invalid shape for texture");if((u===r.LUMINANCE||u===r.ALPHA)&&(i===r.LUMINANCE||i===r.ALPHA)&&(u=i),u!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var d=a.size,f=o.indexOf(n)<0;if(f&&o.push(n),c===s&&h)a.offset===0&&a.data.length===d?f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,a.data):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,a.data):f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,a.data.subarray(a.offset,a.offset+d)):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,a.data.subarray(a.offset,a.offset+d));else{var g;s===r.FLOAT?g=In.mallocFloat32(d):g=In.mallocUint8(d);var p=Zi(g,A,[A[2],A[2]*A[0],1]);c===r.FLOAT&&s===r.UNSIGNED_BYTE?QA(p,a):xo.assign(p,a),f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,g.subarray(0,d)):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,g.subarray(0,d)),s===r.FLOAT?In.freeFloat32(g):In.freeUint8(g)}}function Ro(r){var e=r.createTexture();return r.bindTexture(r.TEXTURE_2D,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),e}function xA(r,e,t,n,i){var s=r.getParameter(r.MAX_TEXTURE_SIZE);if(e<0||e>s||t<0||t>s)throw new Error("gl-texture2d: Invalid texture shape");if(i===r.FLOAT&&!r.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var o=Ro(r);return r.texImage2D(r.TEXTURE_2D,0,n,e,t,0,n,i,null),new rs(r,o,e,t,n,i)}function Og(r,e,t,n,i,s){var o=Ro(r);return r.texImage2D(r.TEXTURE_2D,0,i,i,s,e),new rs(r,o,t,n,i,s)}function Ug(r,e){var t=e.dtype,n=e.shape.slice(),i=r.getParameter(r.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=bA(n,e.stride.slice()),o=0;t==="float32"?o=r.FLOAT:t==="float64"?(o=r.FLOAT,s=!1,t="float32"):t==="uint8"?o=r.UNSIGNED_BYTE:(o=r.UNSIGNED_BYTE,s=!1,t="uint8");var a=0;if(n.length===2)a=r.LUMINANCE,n=[n[0],n[1],1],e=Zi(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else if(n.length===3)if(n[2]===1)a=r.ALPHA;else if(n[2]===2)a=r.LUMINANCE_ALPHA;else if(n[2]===3)a=r.RGB;else if(n[2]===4)a=r.RGBA;else throw new Error("gl-texture2d: Invalid shape for pixel coords");else throw new Error("gl-texture2d: Invalid shape for texture");o===r.FLOAT&&!r.getExtension("OES_texture_float")&&(o=r.UNSIGNED_BYTE,s=!1);var l,A,c=e.size;if(s)e.offset===0&&e.data.length===c?l=e.data:l=e.data.subarray(e.offset,e.offset+c);else{var u=[n[2],n[2]*n[0],1];A=In.malloc(c,t);var h=Zi(A,n,u,0);(t==="float32"||t==="float64")&&o===r.UNSIGNED_BYTE?QA(h,e):xo.assign(h,e),l=A.subarray(0,c)}var d=Ro(r);return r.texImage2D(r.TEXTURE_2D,0,a,n[0],n[1],0,a,o,l),s||In.free(A),new rs(r,d,n[0],n[1],a,o)}function Gg(r){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(es||Mg(r),typeof arguments[1]=="number")return xA(r,arguments[1],arguments[2],arguments[3]||r.RGBA,arguments[4]||r.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return xA(r,arguments[1][0]|0,arguments[1][1]|0,arguments[2]||r.RGBA,arguments[3]||r.UNSIGNED_BYTE);if(typeof arguments[1]=="object"){var e=arguments[1],t=TA(e)?e:e.raw;if(t)return Og(r,t,e.width|0,e.height|0,arguments[2]||r.RGBA,arguments[3]||r.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return Ug(r,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}const ns=po(Ng);var wA={},SA=Hg;function Hg(r,e){for(var t={},n=0;n<r.length;++n)for(var i=r[n].name,s=i.split("."),o=t,a=0;a<s.length;++a){var l=s[a].split("[");if(l.length>1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var A=1;A<l.length;++A){var c=parseInt(l[A]);A<l.length-1||a<s.length-1?(c in o||(A<l.length-1?o[c]=[]:o[c]={}),o=o[c]):e?o[c]=n:o[c]=r[n].type}}else a<s.length-1?(l[0]in o||(o[l[0]]={}),o=o[l[0]]):e?o[l[0]]=n:o[l[0]]=r[n].type}return t}function oi(r,e,t){this.shortMessage=e||"",this.longMessage=t||"",this.rawError=r||"",this.message="gl-shader: "+(e||r||"")+(t?`
92
- `+t:""),this.stack=new Error().stack}oi.prototype=new Error,oi.prototype.name="GLError",oi.prototype.constructor=oi;var is=oi,$g=SA,jr=is,Yg=Vg;function RA(r){return function(){return r}}function Do(r,e){for(var t=new Array(r),n=0;n<r;++n)t[n]=e;return t}function Vg(r,e,t,n){function i(u){return function(h,d,f){return h.getUniform(d.program,f[u])}}function s(u){return function(d){for(var f=o("",u),g=0;g<f.length;++g){var p=f[g],C=p[0],Q=p[1];if(n[Q]){var b=d;if(typeof C=="string"&&(C.indexOf(".")===0||C.indexOf("[")===0)){var y=C;if(C.indexOf(".")===0&&(y=C.slice(1)),y.indexOf("]")===y.length-1){var w=y.indexOf("["),R=y.slice(0,w),k=y.slice(w+1,y.length-1);b=R?d[R][k]:d[k]}else b=d[y]}var $=t[Q].type,K;switch($){case"bool":case"int":case"sampler2D":case"samplerCube":r.uniform1i(n[Q],b);break;case"float":r.uniform1f(n[Q],b);break;default:var O=$.indexOf("vec");if(0<=O&&O<=1&&$.length===4+O){if(K=$.charCodeAt($.length-1)-48,K<2||K>4)throw new jr("","Invalid data type");switch($.charAt(0)){case"b":case"i":r["uniform"+K+"iv"](n[Q],b);break;case"v":r["uniform"+K+"fv"](n[Q],b);break;default:throw new jr("","Unrecognized data type for vector "+name+": "+$)}}else if($.indexOf("mat")===0&&$.length===4){if(K=$.charCodeAt($.length-1)-48,K<2||K>4)throw new jr("","Invalid uniform dimension type for matrix "+name+": "+$);r["uniformMatrix"+K+"fv"](n[Q],!1,b);break}else throw new jr("","Unknown uniform data type for "+name+": "+$)}}}}}function o(u,h){if(typeof h!="object")return[[u,h]];var d=[];for(var f in h){var g=h[f],p=u;parseInt(f)+""===f?p+="["+f+"]":p+="."+f,typeof g=="object"?d.push.apply(d,o(p,g)):d.push([p,g])}return d}function a(u){switch(u){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":return 0;case"float":return 0;default:var h=u.indexOf("vec");if(0<=h&&h<=1&&u.length===4+h){var d=u.charCodeAt(u.length-1)-48;if(d<2||d>4)throw new jr("","Invalid data type");return u.charAt(0)==="b"?Do(d,!1):Do(d,0)}else if(u.indexOf("mat")===0&&u.length===4){var d=u.charCodeAt(u.length-1)-48;if(d<2||d>4)throw new jr("","Invalid uniform dimension type for matrix "+name+": "+u);return Do(d*d,0)}else throw new jr("","Unknown uniform data type for "+name+": "+u)}}function l(u,h,d){if(typeof d=="object"){var f=A(d);Object.defineProperty(u,h,{get:RA(f),set:s(d),enumerable:!0,configurable:!1})}else n[d]?Object.defineProperty(u,h,{get:i(d),set:s(d),enumerable:!0,configurable:!1}):u[h]=a(t[d].type)}function A(u){var h;if(Array.isArray(u)){h=new Array(u.length);for(var d=0;d<u.length;++d)l(h,d,u[d])}else{h={};for(var f in u)l(h,f,u[f])}return h}var c=$g(t,!0);return{get:RA(A(c)),set:s(c),enumerable:!0,configurable:!0}}var Kg=qg,_o=is;function DA(r,e,t,n,i,s){this._gl=r,this._wrapper=e,this._index=t,this._locations=n,this._dimension=i,this._constFunc=s}var Lo=DA.prototype;Lo.pointer=function(e,t,n,i){var s=this,o=s._gl,a=s._locations[s._index];o.vertexAttribPointer(a,s._dimension,e||o.FLOAT,!!t,n||0,i||0),o.enableVertexAttribArray(a)},Lo.set=function(r,e,t,n){return this._constFunc(this._locations[this._index],r,e,t,n)},Object.defineProperty(Lo,"location",{get:function(){return this._locations[this._index]},set:function(r){return r!==this._locations[this._index]&&(this._locations[this._index]=r|0,this._wrapper.program=null),r|0}});var Jg=[function(r,e,t){return t.length===void 0?r.vertexAttrib1f(e,t):r.vertexAttrib1fv(e,t)},function(r,e,t,n){return t.length===void 0?r.vertexAttrib2f(e,t,n):r.vertexAttrib2fv(e,t)},function(r,e,t,n,i){return t.length===void 0?r.vertexAttrib3f(e,t,n,i):r.vertexAttrib3fv(e,t)},function(r,e,t,n,i,s){return t.length===void 0?r.vertexAttrib4f(e,t,n,i,s):r.vertexAttrib4fv(e,t)}];function Fo(r,e,t,n,i,s,o){var a=Jg[i],l=new DA(r,e,t,n,i,a);Object.defineProperty(s,o,{set:function(A){return r.disableVertexAttribArray(n[t]),a(r,n[t],A),A},get:function(){return l},enumerable:!0})}function Wg(r,e,t,n,i,s,o){for(var a=new Array(i),l=new Array(i),A=0;A<i;++A)Fo(r,e,t[A],n,i,a,A),l[A]=a[A];Object.defineProperty(a,"location",{set:function(h){if(Array.isArray(h))for(var d=0;d<i;++d)l[d].location=h[d];else for(var d=0;d<i;++d)l[d].location=h+d;return h},get:function(){for(var h=new Array(i),d=0;d<i;++d)h[d]=n[t[d]];return h},enumerable:!0}),a.pointer=function(h,d,f,g){h=h||r.FLOAT,d=!!d,f=f||i*i,g=g||0;for(var p=0;p<i;++p){var C=n[t[p]];r.vertexAttribPointer(C,i,h,d,f,g+p*i),r.enableVertexAttribArray(C)}};var c=new Array(i),u=r["vertexAttrib"+i+"fv"];Object.defineProperty(s,o,{set:function(h){for(var d=0;d<i;++d){var f=n[t[d]];if(r.disableVertexAttribArray(f),Array.isArray(h[0]))u.call(r,f,h[d]);else{for(var g=0;g<i;++g)c[g]=h[i*d+g];u.call(r,f,c)}}return h},get:function(){return a},enumerable:!0})}function qg(r,e,t,n){for(var i={},s=0,o=t.length;s<o;++s){var a=t[s],l=a.name,A=a.type,c=a.locations;switch(A){case"bool":case"int":case"float":Fo(r,e,c[0],n,1,i,l);break;default:if(A.indexOf("vec")>=0){var u=A.charCodeAt(A.length-1)-48;if(u<2||u>4)throw new _o("","Invalid data type for attribute "+l+": "+A);Fo(r,e,c[0],n,u,i,l)}else if(A.indexOf("mat")>=0){var u=A.charCodeAt(A.length-1)-48;if(u<2||u>4)throw new _o("","Invalid data type for attribute "+l+": "+A);Wg(r,e,c,n,u,i,l)}else throw new _o("","Unknown data type for attribute "+l+": "+A);break}}return i}var ko={},_A={};(function(r){(function(){var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(a){return i(o(a),arguments)}function n(a,l){return t.apply(null,[a].concat(l||[]))}function i(a,l){var A=1,c=a.length,u,h="",d,f,g,p,C,Q,b,y;for(d=0;d<c;d++)if(typeof a[d]=="string")h+=a[d];else if(typeof a[d]=="object"){if(g=a[d],g.keys)for(u=l[A],f=0;f<g.keys.length;f++){if(u==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',g.keys[f],g.keys[f-1]));u=u[g.keys[f]]}else g.param_no?u=l[g.param_no]:u=l[A++];if(e.not_type.test(g.type)&&e.not_primitive.test(g.type)&&u instanceof Function&&(u=u()),e.numeric_arg.test(g.type)&&typeof u!="number"&&isNaN(u))throw new TypeError(t("[sprintf] expecting number but found %T",u));switch(e.number.test(g.type)&&(b=u>=0),g.type){case"b":u=parseInt(u,10).toString(2);break;case"c":u=String.fromCharCode(parseInt(u,10));break;case"d":case"i":u=parseInt(u,10);break;case"j":u=JSON.stringify(u,null,g.width?parseInt(g.width):0);break;case"e":u=g.precision?parseFloat(u).toExponential(g.precision):parseFloat(u).toExponential();break;case"f":u=g.precision?parseFloat(u).toFixed(g.precision):parseFloat(u);break;case"g":u=g.precision?String(Number(u.toPrecision(g.precision))):parseFloat(u);break;case"o":u=(parseInt(u,10)>>>0).toString(8);break;case"s":u=String(u),u=g.precision?u.substring(0,g.precision):u;break;case"t":u=String(!!u),u=g.precision?u.substring(0,g.precision):u;break;case"T":u=Object.prototype.toString.call(u).slice(8,-1).toLowerCase(),u=g.precision?u.substring(0,g.precision):u;break;case"u":u=parseInt(u,10)>>>0;break;case"v":u=u.valueOf(),u=g.precision?u.substring(0,g.precision):u;break;case"x":u=(parseInt(u,10)>>>0).toString(16);break;case"X":u=(parseInt(u,10)>>>0).toString(16).toUpperCase();break}e.json.test(g.type)?h+=u:(e.number.test(g.type)&&(!b||g.sign)?(y=b?"+":"-",u=u.toString().replace(e.sign,"")):y="",C=g.pad_char?g.pad_char==="0"?"0":g.pad_char.charAt(1):" ",Q=g.width-(y+u).length,p=g.width&&Q>0?C.repeat(Q):"",h+=g.align?y+u+p:C==="0"?y+p+u:p+y+u)}return h}var s=Object.create(null);function o(a){if(s[a])return s[a];for(var l=a,A,c=[],u=0;l;){if((A=e.text.exec(l))!==null)c.push(A[0]);else if((A=e.modulo.exec(l))!==null)c.push("%");else if((A=e.placeholder.exec(l))!==null){if(A[2]){u|=1;var h=[],d=A[2],f=[];if((f=e.key.exec(d))!==null)for(h.push(f[1]);(d=d.substring(f[0].length))!=="";)if((f=e.key_access.exec(d))!==null)h.push(f[1]);else if((f=e.index_access.exec(d))!==null)h.push(f[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");A[2]=h}else u|=2;if(u===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");c.push({placeholder:A[0],param_no:A[1],keys:A[2],sign:A[3],pad_char:A[4],align:A[5],width:A[6],precision:A[7],type:A[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");l=l.substring(A[0].length)}return s[a]=c}r.sprintf=t,r.vsprintf=n,typeof window<"u"&&(window.sprintf=t,window.vsprintf=n)})()})(_A);var Xg={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"},jg=Xg,zg=function(e){return jg[e]},LA=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","uint","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"],Zg=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"],FA=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"],e0=LA,t0=e0.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"]),No=FA;No=No.slice().filter(function(r){return!/^(gl\_|texture)/.test(r)});var r0=No.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"]),n0=d0,i0=LA,kA=Zg,s0=FA,o0=t0,a0=r0,jt=999,NA=9999,Mo=0,Po=1,MA=2,PA=3,OA=4,ai=5,l0=6,A0=7,c0=8,UA=9,u0=10,GA=11,h0=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function d0(r){var e=0,t=0,n=jt,i,s,o=[],a=[],l=1,A=0,c=0,u=!1,h=!1,d="",f;r=r||{};var g=s0,p=i0;r.version==="300 es"&&(g=a0,p=o0);for(var C={},Q={},e=0;e<g.length;e++)C[g[e]]=!0;for(var e=0;e<p.length;e++)Q[p[e]]=!0;return function(X){return a=[],X!==null?y(X):w()};function b(X){X.length&&a.push({type:h0[n],data:X,position:c,line:l,column:A})}function y(X){e=0,X.toString&&(X=X.toString()),d+=X.replace(/\r\n/g,`
93
- `),f=d.length;for(var D;i=d[e],e<f;){switch(D=e,n){case Mo:e=O();break;case Po:e=K();break;case MA:e=$();break;case PA:e=J();break;case OA:e=le();break;case GA:e=ee();break;case ai:e=_();break;case NA:e=P();break;case UA:e=k();break;case jt:e=R();break}if(D!==e)switch(d[D]){case`
91
+ */(function(r){var e=Xi,t=Qo,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=a,r.SlowBuffer=Q,r.INSPECT_MAX_BYTES=50;var i=2147483647;r.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{var T=new Uint8Array(1),m={foo:function(){return 42}};return Object.setPrototypeOf(m,Uint8Array.prototype),Object.setPrototypeOf(T,m),T.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(T){if(T>i)throw new RangeError('The value "'+T+'" is invalid for option "size"');var m=new Uint8Array(T);return Object.setPrototypeOf(m,a.prototype),m}function a(T,m,E){if(typeof T=="number"){if(typeof m=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(T)}return l(T,m,E)}a.poolSize=8192;function l(T,m,E){if(typeof T=="string")return h(T,m);if(ArrayBuffer.isView(T))return f(T);if(T==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T);if(we(T,ArrayBuffer)||T&&we(T.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(we(T,SharedArrayBuffer)||T&&we(T.buffer,SharedArrayBuffer)))return g(T,m,E);if(typeof T=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var x=T.valueOf&&T.valueOf();if(x!=null&&x!==T)return a.from(x,m,E);var M=p(T);if(M)return M;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof T[Symbol.toPrimitive]=="function")return a.from(T[Symbol.toPrimitive]("string"),m,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof T)}a.from=function(T,m,E){return l(T,m,E)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function A(T){if(typeof T!="number")throw new TypeError('"size" argument must be of type number');if(T<0)throw new RangeError('The value "'+T+'" is invalid for option "size"')}function c(T,m,E){return A(T),T<=0?o(T):m!==void 0?typeof E=="string"?o(T).fill(m,E):o(T).fill(m):o(T)}a.alloc=function(T,m,E){return c(T,m,E)};function u(T){return A(T),o(T<0?0:y(T)|0)}a.allocUnsafe=function(T){return u(T)},a.allocUnsafeSlow=function(T){return u(T)};function h(T,m){if((typeof m!="string"||m==="")&&(m="utf8"),!a.isEncoding(m))throw new TypeError("Unknown encoding: "+m);var E=b(T,m)|0,x=o(E),M=x.write(T,m);return M!==E&&(x=x.slice(0,M)),x}function d(T){for(var m=T.length<0?0:y(T.length)|0,E=o(m),x=0;x<m;x+=1)E[x]=T[x]&255;return E}function f(T){if(we(T,Uint8Array)){var m=new Uint8Array(T);return g(m.buffer,m.byteOffset,m.byteLength)}return d(T)}function g(T,m,E){if(m<0||T.byteLength<m)throw new RangeError('"offset" is outside of buffer bounds');if(T.byteLength<m+(E||0))throw new RangeError('"length" is outside of buffer bounds');var x;return m===void 0&&E===void 0?x=new Uint8Array(T):E===void 0?x=new Uint8Array(T,m):x=new Uint8Array(T,m,E),Object.setPrototypeOf(x,a.prototype),x}function p(T){if(a.isBuffer(T)){var m=y(T.length)|0,E=o(m);return E.length===0||T.copy(E,0,0,m),E}if(T.length!==void 0)return typeof T.length!="number"||qe(T.length)?o(0):d(T);if(T.type==="Buffer"&&Array.isArray(T.data))return d(T.data)}function y(T){if(T>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return T|0}function Q(T){return+T!=T&&(T=0),a.alloc(+T)}a.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==a.prototype},a.compare=function(m,E){if(we(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),we(E,Uint8Array)&&(E=a.from(E,E.offset,E.byteLength)),!a.isBuffer(m)||!a.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===E)return 0;for(var x=m.length,M=E.length,z=0,j=Math.min(x,M);z<j;++z)if(m[z]!==E[z]){x=m[z],M=E[z];break}return x<M?-1:M<x?1:0},a.isEncoding=function(m){switch(String(m).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(m,E){if(!Array.isArray(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return a.alloc(0);var x;if(E===void 0)for(E=0,x=0;x<m.length;++x)E+=m[x].length;var M=a.allocUnsafe(E),z=0;for(x=0;x<m.length;++x){var j=m[x];if(we(j,Uint8Array))z+j.length>M.length?a.from(j).copy(M,z):Uint8Array.prototype.set.call(M,j,z);else if(a.isBuffer(j))j.copy(M,z);else throw new TypeError('"list" argument must be an Array of Buffers');z+=j.length}return M};function b(T,m){if(a.isBuffer(T))return T.length;if(ArrayBuffer.isView(T)||we(T,ArrayBuffer))return T.byteLength;if(typeof T!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof T);var E=T.length,x=arguments.length>2&&arguments[2]===!0;if(!x&&E===0)return 0;for(var M=!1;;)switch(m){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return Le(T).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E*2;case"hex":return E>>>1;case"base64":return Qe(T).length;default:if(M)return x?-1:Le(T).length;m=(""+m).toLowerCase(),M=!0}}a.byteLength=b;function C(T,m,E){var x=!1;if((m===void 0||m<0)&&(m=0),m>this.length||((E===void 0||E>this.length)&&(E=this.length),E<=0)||(E>>>=0,m>>>=0,E<=m))return"";for(T||(T="utf8");;)switch(T){case"hex":return S(this,m,E);case"utf8":case"utf-8":return le(this,m,E);case"ascii":return X(this,m,E);case"latin1":case"binary":return _(this,m,E);case"base64":return te(this,m,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,m,E);default:if(x)throw new TypeError("Unknown encoding: "+T);T=(T+"").toLowerCase(),x=!0}}a.prototype._isBuffer=!0;function w(T,m,E){var x=T[m];T[m]=T[E],T[E]=x}a.prototype.swap16=function(){var m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<m;E+=2)w(this,E,E+1);return this},a.prototype.swap32=function(){var m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<m;E+=4)w(this,E,E+3),w(this,E+1,E+2);return this},a.prototype.swap64=function(){var m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<m;E+=8)w(this,E,E+7),w(this,E+1,E+6),w(this,E+2,E+5),w(this,E+3,E+4);return this},a.prototype.toString=function(){var m=this.length;return m===0?"":arguments.length===0?le(this,0,m):C.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(m){if(!a.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:a.compare(this,m)===0},a.prototype.inspect=function(){var m="",E=r.INSPECT_MAX_BYTES;return m=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(m+=" ... "),"<Buffer "+m+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(m,E,x,M,z){if(we(m,Uint8Array)&&(m=a.from(m,m.offset,m.byteLength)),!a.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(E===void 0&&(E=0),x===void 0&&(x=m?m.length:0),M===void 0&&(M=0),z===void 0&&(z=this.length),E<0||x>m.length||M<0||z>this.length)throw new RangeError("out of range index");if(M>=z&&E>=x)return 0;if(M>=z)return-1;if(E>=x)return 1;if(E>>>=0,x>>>=0,M>>>=0,z>>>=0,this===m)return 0;for(var j=z-M,Ie=x-E,be=Math.min(j,Ie),De=this.slice(M,z),ke=m.slice(E,x),_e=0;_e<be;++_e)if(De[_e]!==ke[_e]){j=De[_e],Ie=ke[_e];break}return j<Ie?-1:Ie<j?1:0};function R(T,m,E,x,M){if(T.length===0)return-1;if(typeof E=="string"?(x=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,qe(E)&&(E=M?0:T.length-1),E<0&&(E=T.length+E),E>=T.length){if(M)return-1;E=T.length-1}else if(E<0)if(M)E=0;else return-1;if(typeof m=="string"&&(m=a.from(m,x)),a.isBuffer(m))return m.length===0?-1:k(T,m,E,x,M);if(typeof m=="number")return m=m&255,typeof Uint8Array.prototype.indexOf=="function"?M?Uint8Array.prototype.indexOf.call(T,m,E):Uint8Array.prototype.lastIndexOf.call(T,m,E):k(T,[m],E,x,M);throw new TypeError("val must be string, number or Buffer")}function k(T,m,E,x,M){var z=1,j=T.length,Ie=m.length;if(x!==void 0&&(x=String(x).toLowerCase(),x==="ucs2"||x==="ucs-2"||x==="utf16le"||x==="utf-16le")){if(T.length<2||m.length<2)return-1;z=2,j/=2,Ie/=2,E/=2}function be(ut,Ut){return z===1?ut[Ut]:ut.readUInt16BE(Ut*z)}var De;if(M){var ke=-1;for(De=E;De<j;De++)if(be(T,De)===be(m,ke===-1?0:De-ke)){if(ke===-1&&(ke=De),De-ke+1===Ie)return ke*z}else ke!==-1&&(De-=De-ke),ke=-1}else for(E+Ie>j&&(E=j-Ie),De=E;De>=0;De--){for(var _e=!0,Mt=0;Mt<Ie;Mt++)if(be(T,De+Mt)!==be(m,Mt)){_e=!1;break}if(_e)return De}return-1}a.prototype.includes=function(m,E,x){return this.indexOf(m,E,x)!==-1},a.prototype.indexOf=function(m,E,x){return R(this,m,E,x,!0)},a.prototype.lastIndexOf=function(m,E,x){return R(this,m,E,x,!1)};function $(T,m,E,x){E=Number(E)||0;var M=T.length-E;x?(x=Number(x),x>M&&(x=M)):x=M;var z=m.length;x>z/2&&(x=z/2);for(var j=0;j<x;++j){var Ie=parseInt(m.substr(j*2,2),16);if(qe(Ie))return j;T[E+j]=Ie}return j}function V(T,m,E,x){return Me(Le(m,T.length-E),T,E,x)}function O(T,m,E,x){return Me(Ge(m),T,E,x)}function W(T,m,E,x){return Me(Qe(m),T,E,x)}function ie(T,m,E,x){return Me(fe(m,T.length-E),T,E,x)}a.prototype.write=function(m,E,x,M){if(E===void 0)M="utf8",x=this.length,E=0;else if(x===void 0&&typeof E=="string")M=E,x=this.length,E=0;else if(isFinite(E))E=E>>>0,isFinite(x)?(x=x>>>0,M===void 0&&(M="utf8")):(M=x,x=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var z=this.length-E;if((x===void 0||x>z)&&(x=z),m.length>0&&(x<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");M||(M="utf8");for(var j=!1;;)switch(M){case"hex":return $(this,m,E,x);case"utf8":case"utf-8":return V(this,m,E,x);case"ascii":case"latin1":case"binary":return O(this,m,E,x);case"base64":return W(this,m,E,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ie(this,m,E,x);default:if(j)throw new TypeError("Unknown encoding: "+M);M=(""+M).toLowerCase(),j=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function te(T,m,E){return m===0&&E===T.length?e.fromByteArray(T):e.fromByteArray(T.slice(m,E))}function le(T,m,E){E=Math.min(T.length,E);for(var x=[],M=m;M<E;){var z=T[M],j=null,Ie=z>239?4:z>223?3:z>191?2:1;if(M+Ie<=E){var be,De,ke,_e;switch(Ie){case 1:z<128&&(j=z);break;case 2:be=T[M+1],(be&192)===128&&(_e=(z&31)<<6|be&63,_e>127&&(j=_e));break;case 3:be=T[M+1],De=T[M+2],(be&192)===128&&(De&192)===128&&(_e=(z&15)<<12|(be&63)<<6|De&63,_e>2047&&(_e<55296||_e>57343)&&(j=_e));break;case 4:be=T[M+1],De=T[M+2],ke=T[M+3],(be&192)===128&&(De&192)===128&&(ke&192)===128&&(_e=(z&15)<<18|(be&63)<<12|(De&63)<<6|ke&63,_e>65535&&_e<1114112&&(j=_e))}}j===null?(j=65533,Ie=1):j>65535&&(j-=65536,x.push(j>>>10&1023|55296),j=56320|j&1023),x.push(j),M+=Ie}return P(x)}var D=4096;function P(T){var m=T.length;if(m<=D)return String.fromCharCode.apply(String,T);for(var E="",x=0;x<m;)E+=String.fromCharCode.apply(String,T.slice(x,x+=D));return E}function X(T,m,E){var x="";E=Math.min(T.length,E);for(var M=m;M<E;++M)x+=String.fromCharCode(T[M]&127);return x}function _(T,m,E){var x="";E=Math.min(T.length,E);for(var M=m;M<E;++M)x+=String.fromCharCode(T[M]);return x}function S(T,m,E){var x=T.length;(!m||m<0)&&(m=0),(!E||E<0||E>x)&&(E=x);for(var M="",z=m;z<E;++z)M+=Te[T[z]];return M}function F(T,m,E){for(var x=T.slice(m,E),M="",z=0;z<x.length-1;z+=2)M+=String.fromCharCode(x[z]+x[z+1]*256);return M}a.prototype.slice=function(m,E){var x=this.length;m=~~m,E=E===void 0?x:~~E,m<0?(m+=x,m<0&&(m=0)):m>x&&(m=x),E<0?(E+=x,E<0&&(E=0)):E>x&&(E=x),E<m&&(E=m);var M=this.subarray(m,E);return Object.setPrototypeOf(M,a.prototype),M};function J(T,m,E){if(T%1!==0||T<0)throw new RangeError("offset is not uint");if(T+m>E)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(m,E,x){m=m>>>0,E=E>>>0,x||J(m,E,this.length);for(var M=this[m],z=1,j=0;++j<E&&(z*=256);)M+=this[m+j]*z;return M},a.prototype.readUintBE=a.prototype.readUIntBE=function(m,E,x){m=m>>>0,E=E>>>0,x||J(m,E,this.length);for(var M=this[m+--E],z=1;E>0&&(z*=256);)M+=this[m+--E]*z;return M},a.prototype.readUint8=a.prototype.readUInt8=function(m,E){return m=m>>>0,E||J(m,1,this.length),this[m]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(m,E){return m=m>>>0,E||J(m,2,this.length),this[m]|this[m+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(m,E){return m=m>>>0,E||J(m,2,this.length),this[m]<<8|this[m+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(m,E){return m=m>>>0,E||J(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(m,E){return m=m>>>0,E||J(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},a.prototype.readIntLE=function(m,E,x){m=m>>>0,E=E>>>0,x||J(m,E,this.length);for(var M=this[m],z=1,j=0;++j<E&&(z*=256);)M+=this[m+j]*z;return z*=128,M>=z&&(M-=Math.pow(2,8*E)),M},a.prototype.readIntBE=function(m,E,x){m=m>>>0,E=E>>>0,x||J(m,E,this.length);for(var M=E,z=1,j=this[m+--M];M>0&&(z*=256);)j+=this[m+--M]*z;return z*=128,j>=z&&(j-=Math.pow(2,8*E)),j},a.prototype.readInt8=function(m,E){return m=m>>>0,E||J(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},a.prototype.readInt16LE=function(m,E){m=m>>>0,E||J(m,2,this.length);var x=this[m]|this[m+1]<<8;return x&32768?x|4294901760:x},a.prototype.readInt16BE=function(m,E){m=m>>>0,E||J(m,2,this.length);var x=this[m+1]|this[m]<<8;return x&32768?x|4294901760:x},a.prototype.readInt32LE=function(m,E){return m=m>>>0,E||J(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},a.prototype.readInt32BE=function(m,E){return m=m>>>0,E||J(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},a.prototype.readFloatLE=function(m,E){return m=m>>>0,E||J(m,4,this.length),t.read(this,m,!0,23,4)},a.prototype.readFloatBE=function(m,E){return m=m>>>0,E||J(m,4,this.length),t.read(this,m,!1,23,4)},a.prototype.readDoubleLE=function(m,E){return m=m>>>0,E||J(m,8,this.length),t.read(this,m,!0,52,8)},a.prototype.readDoubleBE=function(m,E){return m=m>>>0,E||J(m,8,this.length),t.read(this,m,!1,52,8)};function Y(T,m,E,x,M,z){if(!a.isBuffer(T))throw new TypeError('"buffer" argument must be a Buffer instance');if(m>M||m<z)throw new RangeError('"value" argument is out of bounds');if(E+x>T.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(m,E,x,M){if(m=+m,E=E>>>0,x=x>>>0,!M){var z=Math.pow(2,8*x)-1;Y(this,m,E,x,z,0)}var j=1,Ie=0;for(this[E]=m&255;++Ie<x&&(j*=256);)this[E+Ie]=m/j&255;return E+x},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(m,E,x,M){if(m=+m,E=E>>>0,x=x>>>0,!M){var z=Math.pow(2,8*x)-1;Y(this,m,E,x,z,0)}var j=x-1,Ie=1;for(this[E+j]=m&255;--j>=0&&(Ie*=256);)this[E+j]=m/Ie&255;return E+x},a.prototype.writeUint8=a.prototype.writeUInt8=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,1,255,0),this[E]=m&255,E+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,65535,0),this[E]=m&255,this[E+1]=m>>>8,E+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,65535,0),this[E]=m>>>8,this[E+1]=m&255,E+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,4294967295,0),this[E+3]=m>>>24,this[E+2]=m>>>16,this[E+1]=m>>>8,this[E]=m&255,E+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,4294967295,0),this[E]=m>>>24,this[E+1]=m>>>16,this[E+2]=m>>>8,this[E+3]=m&255,E+4},a.prototype.writeIntLE=function(m,E,x,M){if(m=+m,E=E>>>0,!M){var z=Math.pow(2,8*x-1);Y(this,m,E,x,z-1,-z)}var j=0,Ie=1,be=0;for(this[E]=m&255;++j<x&&(Ie*=256);)m<0&&be===0&&this[E+j-1]!==0&&(be=1),this[E+j]=(m/Ie>>0)-be&255;return E+x},a.prototype.writeIntBE=function(m,E,x,M){if(m=+m,E=E>>>0,!M){var z=Math.pow(2,8*x-1);Y(this,m,E,x,z-1,-z)}var j=x-1,Ie=1,be=0;for(this[E+j]=m&255;--j>=0&&(Ie*=256);)m<0&&be===0&&this[E+j+1]!==0&&(be=1),this[E+j]=(m/Ie>>0)-be&255;return E+x},a.prototype.writeInt8=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,1,127,-128),m<0&&(m=255+m+1),this[E]=m&255,E+1},a.prototype.writeInt16LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,32767,-32768),this[E]=m&255,this[E+1]=m>>>8,E+2},a.prototype.writeInt16BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,2,32767,-32768),this[E]=m>>>8,this[E+1]=m&255,E+2},a.prototype.writeInt32LE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,2147483647,-2147483648),this[E]=m&255,this[E+1]=m>>>8,this[E+2]=m>>>16,this[E+3]=m>>>24,E+4},a.prototype.writeInt32BE=function(m,E,x){return m=+m,E=E>>>0,x||Y(this,m,E,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[E]=m>>>24,this[E+1]=m>>>16,this[E+2]=m>>>8,this[E+3]=m&255,E+4};function ne(T,m,E,x,M,z){if(E+x>T.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function ce(T,m,E,x,M){return m=+m,E=E>>>0,M||ne(T,m,E,4),t.write(T,m,E,x,23,4),E+4}a.prototype.writeFloatLE=function(m,E,x){return ce(this,m,E,!0,x)},a.prototype.writeFloatBE=function(m,E,x){return ce(this,m,E,!1,x)};function pe(T,m,E,x,M){return m=+m,E=E>>>0,M||ne(T,m,E,8),t.write(T,m,E,x,52,8),E+8}a.prototype.writeDoubleLE=function(m,E,x){return pe(this,m,E,!0,x)},a.prototype.writeDoubleBE=function(m,E,x){return pe(this,m,E,!1,x)},a.prototype.copy=function(m,E,x,M){if(!a.isBuffer(m))throw new TypeError("argument should be a Buffer");if(x||(x=0),!M&&M!==0&&(M=this.length),E>=m.length&&(E=m.length),E||(E=0),M>0&&M<x&&(M=x),M===x||m.length===0||this.length===0)return 0;if(E<0)throw new RangeError("targetStart out of bounds");if(x<0||x>=this.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("sourceEnd out of bounds");M>this.length&&(M=this.length),m.length-E<M-x&&(M=m.length-E+x);var z=M-x;return this===m&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(E,x,M):Uint8Array.prototype.set.call(m,this.subarray(x,M),E),z},a.prototype.fill=function(m,E,x,M){if(typeof m=="string"){if(typeof E=="string"?(M=E,E=0,x=this.length):typeof x=="string"&&(M=x,x=this.length),M!==void 0&&typeof M!="string")throw new TypeError("encoding must be a string");if(typeof M=="string"&&!a.isEncoding(M))throw new TypeError("Unknown encoding: "+M);if(m.length===1){var z=m.charCodeAt(0);(M==="utf8"&&z<128||M==="latin1")&&(m=z)}}else typeof m=="number"?m=m&255:typeof m=="boolean"&&(m=Number(m));if(E<0||this.length<E||this.length<x)throw new RangeError("Out of range index");if(x<=E)return this;E=E>>>0,x=x===void 0?this.length:x>>>0,m||(m=0);var j;if(typeof m=="number")for(j=E;j<x;++j)this[j]=m;else{var Ie=a.isBuffer(m)?m:a.from(m,M),be=Ie.length;if(be===0)throw new TypeError('The value "'+m+'" is invalid for argument "value"');for(j=0;j<x-E;++j)this[j+E]=Ie[j%be]}return this};var ge=/[^+/0-9A-Za-z-_]/g;function Se(T){if(T=T.split("=")[0],T=T.trim().replace(ge,""),T.length<2)return"";for(;T.length%4!==0;)T=T+"=";return T}function Le(T,m){m=m||1/0;for(var E,x=T.length,M=null,z=[],j=0;j<x;++j){if(E=T.charCodeAt(j),E>55295&&E<57344){if(!M){if(E>56319){(m-=3)>-1&&z.push(239,191,189);continue}else if(j+1===x){(m-=3)>-1&&z.push(239,191,189);continue}M=E;continue}if(E<56320){(m-=3)>-1&&z.push(239,191,189),M=E;continue}E=(M-55296<<10|E-56320)+65536}else M&&(m-=3)>-1&&z.push(239,191,189);if(M=null,E<128){if((m-=1)<0)break;z.push(E)}else if(E<2048){if((m-=2)<0)break;z.push(E>>6|192,E&63|128)}else if(E<65536){if((m-=3)<0)break;z.push(E>>12|224,E>>6&63|128,E&63|128)}else if(E<1114112){if((m-=4)<0)break;z.push(E>>18|240,E>>12&63|128,E>>6&63|128,E&63|128)}else throw new Error("Invalid code point")}return z}function Ge(T){for(var m=[],E=0;E<T.length;++E)m.push(T.charCodeAt(E)&255);return m}function fe(T,m){for(var E,x,M,z=[],j=0;j<T.length&&!((m-=2)<0);++j)E=T.charCodeAt(j),x=E>>8,M=E%256,z.push(M),z.push(x);return z}function Qe(T){return e.toByteArray(Se(T))}function Me(T,m,E,x){for(var M=0;M<x&&!(M+E>=m.length||M>=T.length);++M)m[M+E]=T[M];return M}function we(T,m){return T instanceof m||T!=null&&T.constructor!=null&&T.constructor.name!=null&&T.constructor.name===m.name}function qe(T){return T!==T}var Te=function(){for(var T="0123456789abcdef",m=new Array(256),E=0;E<16;++E)for(var x=E*16,M=0;M<16;++M)m[x+M]=T[E]+T[M];return m}()})(lA);var Nr=ze,Ct=Bg,cA=lA.Buffer;mn.__TYPEDARRAY_POOL||(mn.__TYPEDARRAY_POOL={UINT8:Ct([32,0]),UINT16:Ct([32,0]),UINT32:Ct([32,0]),BIGUINT64:Ct([32,0]),INT8:Ct([32,0]),INT16:Ct([32,0]),INT32:Ct([32,0]),BIGINT64:Ct([32,0]),FLOAT:Ct([32,0]),DOUBLE:Ct([32,0]),DATA:Ct([32,0]),UINT8C:Ct([32,0]),BUFFER:Ct([32,0])});var _g=typeof Uint8ClampedArray<"u",Lg=typeof BigUint64Array<"u",Fg=typeof BigInt64Array<"u",nt=mn.__TYPEDARRAY_POOL;nt.UINT8C||(nt.UINT8C=Ct([32,0])),nt.BIGUINT64||(nt.BIGUINT64=Ct([32,0])),nt.BIGINT64||(nt.BIGINT64=Ct([32,0])),nt.BUFFER||(nt.BUFFER=Ct([32,0]));var ji=nt.DATA,zi=nt.BUFFER;Ne.free=function(e){if(cA.isBuffer(e))zi[Nr.log2(e.length)].push(e);else{if(Object.prototype.toString.call(e)!=="[object ArrayBuffer]"&&(e=e.buffer),!e)return;var t=e.length||e.byteLength,n=Nr.log2(t)|0;ji[n].push(e)}};function uA(r){if(r){var e=r.length||r.byteLength,t=Nr.log2(e);ji[t].push(r)}}function kg(r){uA(r.buffer)}Ne.freeUint8=Ne.freeUint16=Ne.freeUint32=Ne.freeBigUint64=Ne.freeInt8=Ne.freeInt16=Ne.freeInt32=Ne.freeBigInt64=Ne.freeFloat32=Ne.freeFloat=Ne.freeFloat64=Ne.freeDouble=Ne.freeUint8Clamped=Ne.freeDataView=kg,Ne.freeArrayBuffer=uA,Ne.freeBuffer=function(e){zi[Nr.log2(e.length)].push(e)},Ne.malloc=function(e,t){if(t===void 0||t==="arraybuffer")return Dt(e);switch(t){case"uint8":return bo(e);case"uint16":return hA(e);case"uint32":return dA(e);case"int8":return fA(e);case"int16":return gA(e);case"int32":return pA(e);case"float":case"float32":return mA(e);case"double":case"float64":return EA(e);case"uint8_clamped":return IA(e);case"bigint64":return CA(e);case"biguint64":return vA(e);case"buffer":return BA(e);case"data":case"dataview":return yA(e);default:return null}return null};function Dt(e){var e=Nr.nextPow2(e),t=Nr.log2(e),n=ji[t];return n.length>0?n.pop():new ArrayBuffer(e)}Ne.mallocArrayBuffer=Dt;function bo(r){return new Uint8Array(Dt(r),0,r)}Ne.mallocUint8=bo;function hA(r){return new Uint16Array(Dt(2*r),0,r)}Ne.mallocUint16=hA;function dA(r){return new Uint32Array(Dt(4*r),0,r)}Ne.mallocUint32=dA;function fA(r){return new Int8Array(Dt(r),0,r)}Ne.mallocInt8=fA;function gA(r){return new Int16Array(Dt(2*r),0,r)}Ne.mallocInt16=gA;function pA(r){return new Int32Array(Dt(4*r),0,r)}Ne.mallocInt32=pA;function mA(r){return new Float32Array(Dt(4*r),0,r)}Ne.mallocFloat32=Ne.mallocFloat=mA;function EA(r){return new Float64Array(Dt(8*r),0,r)}Ne.mallocFloat64=Ne.mallocDouble=EA;function IA(r){return _g?new Uint8ClampedArray(Dt(r),0,r):bo(r)}Ne.mallocUint8Clamped=IA;function vA(r){return Lg?new BigUint64Array(Dt(8*r),0,r):null}Ne.mallocBigUint64=vA;function CA(r){return Fg?new BigInt64Array(Dt(8*r),0,r):null}Ne.mallocBigInt64=CA;function yA(r){return new DataView(Dt(r),0,r)}Ne.mallocDataView=yA;function BA(r){r=Nr.nextPow2(r);var e=Nr.log2(r),t=zi[e];return t.length>0?t.pop():new cA(r)}Ne.mallocBuffer=BA,Ne.clearCache=function(){for(var e=0;e<32;++e)nt.UINT8[e].length=0,nt.UINT16[e].length=0,nt.UINT32[e].length=0,nt.INT8[e].length=0,nt.INT16[e].length=0,nt.INT32[e].length=0,nt.FLOAT[e].length=0,nt.DOUBLE[e].length=0,nt.BIGUINT64[e].length=0,nt.BIGINT64[e].length=0,nt.UINT8C[e].length=0,ji[e].length=0,zi[e].length=0};var Zi=ng,xo=iA,In=Ne,Ng=Gg,es=null,wo=null,ts=null;function Mg(r){es=[r.LINEAR,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_NEAREST],wo=[r.NEAREST,r.LINEAR,r.NEAREST_MIPMAP_NEAREST,r.NEAREST_MIPMAP_LINEAR,r.LINEAR_MIPMAP_NEAREST,r.LINEAR_MIPMAP_LINEAR],ts=[r.REPEAT,r.CLAMP_TO_EDGE,r.MIRRORED_REPEAT]}function TA(r){return typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement||typeof ImageData<"u"&&r instanceof ImageData}var QA=function(r,e){xo.muls(r,e,255)};function So(r,e,t){var n=r.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>i||t<0||t>i)throw new Error("gl-texture2d: Invalid texture size");return r._shape=[e,t],r.bind(),n.texImage2D(n.TEXTURE_2D,0,r.format,e,t,0,r.format,r.type,null),r._mipLevels=[0],r}function rs(r,e,t,n,i,s){this.gl=r,this.handle=e,this.format=i,this.type=s,this._shape=[t,n],this._mipLevels=[0],this._magFilter=r.NEAREST,this._minFilter=r.NEAREST,this._wrapS=r.CLAMP_TO_EDGE,this._wrapT=r.CLAMP_TO_EDGE,this._anisoSamples=1;var o=this,a=[this._wrapS,this._wrapT];Object.defineProperties(a,[{get:function(){return o._wrapS},set:function(A){return o.wrapS=A}},{get:function(){return o._wrapT},set:function(A){return o.wrapT=A}}]),this._wrapVector=a;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return o._shape[0]},set:function(A){return o.width=A}},{get:function(){return o._shape[1]},set:function(A){return o.height=A}}]),this._shapeVector=l}var si=rs.prototype;Object.defineProperties(si,{minFilter:{get:function(){return this._minFilter},set:function(r){this.bind();var e=this.gl;if(this.type===e.FLOAT&&es.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),wo.indexOf(r)<0)throw new Error("gl-texture2d: Unknown filter mode "+r);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,r),this._minFilter=r}},magFilter:{get:function(){return this._magFilter},set:function(r){this.bind();var e=this.gl;if(this.type===e.FLOAT&&es.indexOf(r)>=0&&(e.getExtension("OES_texture_float_linear")||(r=e.NEAREST)),wo.indexOf(r)<0)throw new Error("gl-texture2d: Unknown filter mode "+r);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),this._magFilter=r}},mipSamples:{get:function(){return this._anisoSamples},set:function(r){var e=this._anisoSamples;if(this._anisoSamples=Math.max(r,1)|0,e!==this._anisoSamples){var t=this.gl.getExtension("EXT_texture_filter_anisotropic");t&&this.gl.texParameterf(this.gl.TEXTURE_2D,t.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(r){if(this.bind(),ts.indexOf(r)<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,r),this._wrapS=r}},wrapT:{get:function(){return this._wrapT},set:function(r){if(this.bind(),ts.indexOf(r)<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,r),this._wrapT=r}},wrap:{get:function(){return this._wrapVector},set:function(r){if(Array.isArray(r)||(r=[r,r]),r.length!==2)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;e<2;++e)if(ts.indexOf(r[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+r);this._wrapS=r[0],this._wrapT=r[1];var t=this.gl;return this.bind(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,this._wrapS),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,this._wrapT),r}},shape:{get:function(){return this._shapeVector},set:function(r){if(!Array.isArray(r))r=[r|0,r|0];else if(r.length!==2)throw new Error("gl-texture2d: Invalid texture shape");return So(this,r[0]|0,r[1]|0),[r[0]|0,r[1]|0]}},width:{get:function(){return this._shape[0]},set:function(r){return r=r|0,So(this,r,this._shape[1]),r}},height:{get:function(){return this._shape[1]},set:function(r){return r=r|0,So(this,this._shape[0],r),r}}}),si.bind=function(r){var e=this.gl;return r!==void 0&&e.activeTexture(e.TEXTURE0+(r|0)),e.bindTexture(e.TEXTURE_2D,this.handle),r!==void 0?r|0:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},si.dispose=function(){this.gl.deleteTexture(this.handle)},si.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var r=Math.min(this._shape[0],this._shape[1]),e=0;r>0;++e,r>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},si.setPixels=function(r,e,t,n){var i=this.gl;this.bind(),Array.isArray(e)?(n=t,t=e[1]|0,e=e[0]|0):(e=e||0,t=t||0),n=n||0;var s=TA(r)?r:r.raw;if(s){var o=this._mipLevels.indexOf(n)<0;o?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,s),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,t,this.format,this.type,s)}else if(r.shape&&r.stride&&r.data){if(r.shape.length<2||e+r.shape[1]>this._shape[1]>>>n||t+r.shape[0]>this._shape[0]>>>n||e<0||t<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");Pg(i,e,t,n,this.format,this.type,this._mipLevels,r)}else throw new Error("gl-texture2d: Unsupported data type")};function bA(r,e){return r.length===3?e[2]===1&&e[1]===r[0]*r[2]&&e[0]===r[2]:e[0]===1&&e[1]===r[0]}function Pg(r,e,t,n,i,s,o,a){var l=a.dtype,A=a.shape.slice();if(A.length<2||A.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var c=0,u=0,h=bA(A,a.stride.slice());if(l==="float32"?c=r.FLOAT:l==="float64"?(c=r.FLOAT,h=!1,l="float32"):l==="uint8"?c=r.UNSIGNED_BYTE:(c=r.UNSIGNED_BYTE,h=!1,l="uint8"),A.length===2)u=r.LUMINANCE,A=[A[0],A[1],1],a=Zi(a.data,A,[a.stride[0],a.stride[1],1],a.offset);else if(A.length===3){if(A[2]===1)u=r.ALPHA;else if(A[2]===2)u=r.LUMINANCE_ALPHA;else if(A[2]===3)u=r.RGB;else if(A[2]===4)u=r.RGBA;else throw new Error("gl-texture2d: Invalid shape for pixel coords");A[2]}else throw new Error("gl-texture2d: Invalid shape for texture");if((u===r.LUMINANCE||u===r.ALPHA)&&(i===r.LUMINANCE||i===r.ALPHA)&&(u=i),u!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var d=a.size,f=o.indexOf(n)<0;if(f&&o.push(n),c===s&&h)a.offset===0&&a.data.length===d?f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,a.data):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,a.data):f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,a.data.subarray(a.offset,a.offset+d)):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,a.data.subarray(a.offset,a.offset+d));else{var g;s===r.FLOAT?g=In.mallocFloat32(d):g=In.mallocUint8(d);var p=Zi(g,A,[A[2],A[2]*A[0],1]);c===r.FLOAT&&s===r.UNSIGNED_BYTE?QA(p,a):xo.assign(p,a),f?r.texImage2D(r.TEXTURE_2D,n,i,A[0],A[1],0,i,s,g.subarray(0,d)):r.texSubImage2D(r.TEXTURE_2D,n,e,t,A[0],A[1],i,s,g.subarray(0,d)),s===r.FLOAT?In.freeFloat32(g):In.freeUint8(g)}}function Ro(r){var e=r.createTexture();return r.bindTexture(r.TEXTURE_2D,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),e}function xA(r,e,t,n,i){var s=r.getParameter(r.MAX_TEXTURE_SIZE);if(e<0||e>s||t<0||t>s)throw new Error("gl-texture2d: Invalid texture shape");if(i===r.FLOAT&&!r.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var o=Ro(r);return r.texImage2D(r.TEXTURE_2D,0,n,e,t,0,n,i,null),new rs(r,o,e,t,n,i)}function Og(r,e,t,n,i,s){var o=Ro(r);return r.texImage2D(r.TEXTURE_2D,0,i,i,s,e),new rs(r,o,t,n,i,s)}function Ug(r,e){var t=e.dtype,n=e.shape.slice(),i=r.getParameter(r.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=bA(n,e.stride.slice()),o=0;t==="float32"?o=r.FLOAT:t==="float64"?(o=r.FLOAT,s=!1,t="float32"):t==="uint8"?o=r.UNSIGNED_BYTE:(o=r.UNSIGNED_BYTE,s=!1,t="uint8");var a=0;if(n.length===2)a=r.LUMINANCE,n=[n[0],n[1],1],e=Zi(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else if(n.length===3)if(n[2]===1)a=r.ALPHA;else if(n[2]===2)a=r.LUMINANCE_ALPHA;else if(n[2]===3)a=r.RGB;else if(n[2]===4)a=r.RGBA;else throw new Error("gl-texture2d: Invalid shape for pixel coords");else throw new Error("gl-texture2d: Invalid shape for texture");o===r.FLOAT&&!r.getExtension("OES_texture_float")&&(o=r.UNSIGNED_BYTE,s=!1);var l,A,c=e.size;if(s)e.offset===0&&e.data.length===c?l=e.data:l=e.data.subarray(e.offset,e.offset+c);else{var u=[n[2],n[2]*n[0],1];A=In.malloc(c,t);var h=Zi(A,n,u,0);(t==="float32"||t==="float64")&&o===r.UNSIGNED_BYTE?QA(h,e):xo.assign(h,e),l=A.subarray(0,c)}var d=Ro(r);return r.texImage2D(r.TEXTURE_2D,0,a,n[0],n[1],0,a,o,l),s||In.free(A),new rs(r,d,n[0],n[1],a,o)}function Gg(r){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(es||Mg(r),typeof arguments[1]=="number")return xA(r,arguments[1],arguments[2],arguments[3]||r.RGBA,arguments[4]||r.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return xA(r,arguments[1][0]|0,arguments[1][1]|0,arguments[2]||r.RGBA,arguments[3]||r.UNSIGNED_BYTE);if(typeof arguments[1]=="object"){var e=arguments[1],t=TA(e)?e:e.raw;if(t)return Og(r,t,e.width|0,e.height|0,arguments[2]||r.RGBA,arguments[3]||r.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return Ug(r,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}const ns=po(Ng);var wA={},SA=Hg;function Hg(r,e){for(var t={},n=0;n<r.length;++n)for(var i=r[n].name,s=i.split("."),o=t,a=0;a<s.length;++a){var l=s[a].split("[");if(l.length>1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var A=1;A<l.length;++A){var c=parseInt(l[A]);A<l.length-1||a<s.length-1?(c in o||(A<l.length-1?o[c]=[]:o[c]={}),o=o[c]):e?o[c]=n:o[c]=r[n].type}}else a<s.length-1?(l[0]in o||(o[l[0]]={}),o=o[l[0]]):e?o[l[0]]=n:o[l[0]]=r[n].type}return t}function oi(r,e,t){this.shortMessage=e||"",this.longMessage=t||"",this.rawError=r||"",this.message="gl-shader: "+(e||r||"")+(t?`
92
+ `+t:""),this.stack=new Error().stack}oi.prototype=new Error,oi.prototype.name="GLError",oi.prototype.constructor=oi;var is=oi,$g=SA,jr=is,Yg=Vg;function RA(r){return function(){return r}}function Do(r,e){for(var t=new Array(r),n=0;n<r;++n)t[n]=e;return t}function Vg(r,e,t,n){function i(u){return function(h,d,f){return h.getUniform(d.program,f[u])}}function s(u){return function(d){for(var f=o("",u),g=0;g<f.length;++g){var p=f[g],y=p[0],Q=p[1];if(n[Q]){var b=d;if(typeof y=="string"&&(y.indexOf(".")===0||y.indexOf("[")===0)){var C=y;if(y.indexOf(".")===0&&(C=y.slice(1)),C.indexOf("]")===C.length-1){var w=C.indexOf("["),R=C.slice(0,w),k=C.slice(w+1,C.length-1);b=R?d[R][k]:d[k]}else b=d[C]}var $=t[Q].type,V;switch($){case"bool":case"int":case"sampler2D":case"samplerCube":r.uniform1i(n[Q],b);break;case"float":r.uniform1f(n[Q],b);break;default:var O=$.indexOf("vec");if(0<=O&&O<=1&&$.length===4+O){if(V=$.charCodeAt($.length-1)-48,V<2||V>4)throw new jr("","Invalid data type");switch($.charAt(0)){case"b":case"i":r["uniform"+V+"iv"](n[Q],b);break;case"v":r["uniform"+V+"fv"](n[Q],b);break;default:throw new jr("","Unrecognized data type for vector "+name+": "+$)}}else if($.indexOf("mat")===0&&$.length===4){if(V=$.charCodeAt($.length-1)-48,V<2||V>4)throw new jr("","Invalid uniform dimension type for matrix "+name+": "+$);r["uniformMatrix"+V+"fv"](n[Q],!1,b);break}else throw new jr("","Unknown uniform data type for "+name+": "+$)}}}}}function o(u,h){if(typeof h!="object")return[[u,h]];var d=[];for(var f in h){var g=h[f],p=u;parseInt(f)+""===f?p+="["+f+"]":p+="."+f,typeof g=="object"?d.push.apply(d,o(p,g)):d.push([p,g])}return d}function a(u){switch(u){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":return 0;case"float":return 0;default:var h=u.indexOf("vec");if(0<=h&&h<=1&&u.length===4+h){var d=u.charCodeAt(u.length-1)-48;if(d<2||d>4)throw new jr("","Invalid data type");return u.charAt(0)==="b"?Do(d,!1):Do(d,0)}else if(u.indexOf("mat")===0&&u.length===4){var d=u.charCodeAt(u.length-1)-48;if(d<2||d>4)throw new jr("","Invalid uniform dimension type for matrix "+name+": "+u);return Do(d*d,0)}else throw new jr("","Unknown uniform data type for "+name+": "+u)}}function l(u,h,d){if(typeof d=="object"){var f=A(d);Object.defineProperty(u,h,{get:RA(f),set:s(d),enumerable:!0,configurable:!1})}else n[d]?Object.defineProperty(u,h,{get:i(d),set:s(d),enumerable:!0,configurable:!1}):u[h]=a(t[d].type)}function A(u){var h;if(Array.isArray(u)){h=new Array(u.length);for(var d=0;d<u.length;++d)l(h,d,u[d])}else{h={};for(var f in u)l(h,f,u[f])}return h}var c=$g(t,!0);return{get:RA(A(c)),set:s(c),enumerable:!0,configurable:!0}}var Kg=qg,_o=is;function DA(r,e,t,n,i,s){this._gl=r,this._wrapper=e,this._index=t,this._locations=n,this._dimension=i,this._constFunc=s}var Lo=DA.prototype;Lo.pointer=function(e,t,n,i){var s=this,o=s._gl,a=s._locations[s._index];o.vertexAttribPointer(a,s._dimension,e||o.FLOAT,!!t,n||0,i||0),o.enableVertexAttribArray(a)},Lo.set=function(r,e,t,n){return this._constFunc(this._locations[this._index],r,e,t,n)},Object.defineProperty(Lo,"location",{get:function(){return this._locations[this._index]},set:function(r){return r!==this._locations[this._index]&&(this._locations[this._index]=r|0,this._wrapper.program=null),r|0}});var Jg=[function(r,e,t){return t.length===void 0?r.vertexAttrib1f(e,t):r.vertexAttrib1fv(e,t)},function(r,e,t,n){return t.length===void 0?r.vertexAttrib2f(e,t,n):r.vertexAttrib2fv(e,t)},function(r,e,t,n,i){return t.length===void 0?r.vertexAttrib3f(e,t,n,i):r.vertexAttrib3fv(e,t)},function(r,e,t,n,i,s){return t.length===void 0?r.vertexAttrib4f(e,t,n,i,s):r.vertexAttrib4fv(e,t)}];function Fo(r,e,t,n,i,s,o){var a=Jg[i],l=new DA(r,e,t,n,i,a);Object.defineProperty(s,o,{set:function(A){return r.disableVertexAttribArray(n[t]),a(r,n[t],A),A},get:function(){return l},enumerable:!0})}function Wg(r,e,t,n,i,s,o){for(var a=new Array(i),l=new Array(i),A=0;A<i;++A)Fo(r,e,t[A],n,i,a,A),l[A]=a[A];Object.defineProperty(a,"location",{set:function(h){if(Array.isArray(h))for(var d=0;d<i;++d)l[d].location=h[d];else for(var d=0;d<i;++d)l[d].location=h+d;return h},get:function(){for(var h=new Array(i),d=0;d<i;++d)h[d]=n[t[d]];return h},enumerable:!0}),a.pointer=function(h,d,f,g){h=h||r.FLOAT,d=!!d,f=f||i*i,g=g||0;for(var p=0;p<i;++p){var y=n[t[p]];r.vertexAttribPointer(y,i,h,d,f,g+p*i),r.enableVertexAttribArray(y)}};var c=new Array(i),u=r["vertexAttrib"+i+"fv"];Object.defineProperty(s,o,{set:function(h){for(var d=0;d<i;++d){var f=n[t[d]];if(r.disableVertexAttribArray(f),Array.isArray(h[0]))u.call(r,f,h[d]);else{for(var g=0;g<i;++g)c[g]=h[i*d+g];u.call(r,f,c)}}return h},get:function(){return a},enumerable:!0})}function qg(r,e,t,n){for(var i={},s=0,o=t.length;s<o;++s){var a=t[s],l=a.name,A=a.type,c=a.locations;switch(A){case"bool":case"int":case"float":Fo(r,e,c[0],n,1,i,l);break;default:if(A.indexOf("vec")>=0){var u=A.charCodeAt(A.length-1)-48;if(u<2||u>4)throw new _o("","Invalid data type for attribute "+l+": "+A);Fo(r,e,c[0],n,u,i,l)}else if(A.indexOf("mat")>=0){var u=A.charCodeAt(A.length-1)-48;if(u<2||u>4)throw new _o("","Invalid data type for attribute "+l+": "+A);Wg(r,e,c,n,u,i,l)}else throw new _o("","Unknown data type for attribute "+l+": "+A);break}}return i}var ko={},_A={};(function(r){(function(){var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(a){return i(o(a),arguments)}function n(a,l){return t.apply(null,[a].concat(l||[]))}function i(a,l){var A=1,c=a.length,u,h="",d,f,g,p,y,Q,b,C;for(d=0;d<c;d++)if(typeof a[d]=="string")h+=a[d];else if(typeof a[d]=="object"){if(g=a[d],g.keys)for(u=l[A],f=0;f<g.keys.length;f++){if(u==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',g.keys[f],g.keys[f-1]));u=u[g.keys[f]]}else g.param_no?u=l[g.param_no]:u=l[A++];if(e.not_type.test(g.type)&&e.not_primitive.test(g.type)&&u instanceof Function&&(u=u()),e.numeric_arg.test(g.type)&&typeof u!="number"&&isNaN(u))throw new TypeError(t("[sprintf] expecting number but found %T",u));switch(e.number.test(g.type)&&(b=u>=0),g.type){case"b":u=parseInt(u,10).toString(2);break;case"c":u=String.fromCharCode(parseInt(u,10));break;case"d":case"i":u=parseInt(u,10);break;case"j":u=JSON.stringify(u,null,g.width?parseInt(g.width):0);break;case"e":u=g.precision?parseFloat(u).toExponential(g.precision):parseFloat(u).toExponential();break;case"f":u=g.precision?parseFloat(u).toFixed(g.precision):parseFloat(u);break;case"g":u=g.precision?String(Number(u.toPrecision(g.precision))):parseFloat(u);break;case"o":u=(parseInt(u,10)>>>0).toString(8);break;case"s":u=String(u),u=g.precision?u.substring(0,g.precision):u;break;case"t":u=String(!!u),u=g.precision?u.substring(0,g.precision):u;break;case"T":u=Object.prototype.toString.call(u).slice(8,-1).toLowerCase(),u=g.precision?u.substring(0,g.precision):u;break;case"u":u=parseInt(u,10)>>>0;break;case"v":u=u.valueOf(),u=g.precision?u.substring(0,g.precision):u;break;case"x":u=(parseInt(u,10)>>>0).toString(16);break;case"X":u=(parseInt(u,10)>>>0).toString(16).toUpperCase();break}e.json.test(g.type)?h+=u:(e.number.test(g.type)&&(!b||g.sign)?(C=b?"+":"-",u=u.toString().replace(e.sign,"")):C="",y=g.pad_char?g.pad_char==="0"?"0":g.pad_char.charAt(1):" ",Q=g.width-(C+u).length,p=g.width&&Q>0?y.repeat(Q):"",h+=g.align?C+u+p:y==="0"?C+p+u:p+C+u)}return h}var s=Object.create(null);function o(a){if(s[a])return s[a];for(var l=a,A,c=[],u=0;l;){if((A=e.text.exec(l))!==null)c.push(A[0]);else if((A=e.modulo.exec(l))!==null)c.push("%");else if((A=e.placeholder.exec(l))!==null){if(A[2]){u|=1;var h=[],d=A[2],f=[];if((f=e.key.exec(d))!==null)for(h.push(f[1]);(d=d.substring(f[0].length))!=="";)if((f=e.key_access.exec(d))!==null)h.push(f[1]);else if((f=e.index_access.exec(d))!==null)h.push(f[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");A[2]=h}else u|=2;if(u===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");c.push({placeholder:A[0],param_no:A[1],keys:A[2],sign:A[3],pad_char:A[4],align:A[5],width:A[6],precision:A[7],type:A[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");l=l.substring(A[0].length)}return s[a]=c}r.sprintf=t,r.vsprintf=n,typeof window<"u"&&(window.sprintf=t,window.vsprintf=n)})()})(_A);var Xg={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"},jg=Xg,zg=function(e){return jg[e]},LA=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","uint","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"],Zg=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"],FA=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"],e0=LA,t0=e0.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"]),No=FA;No=No.slice().filter(function(r){return!/^(gl\_|texture)/.test(r)});var r0=No.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"]),n0=d0,i0=LA,kA=Zg,s0=FA,o0=t0,a0=r0,jt=999,NA=9999,Mo=0,Po=1,MA=2,PA=3,OA=4,ai=5,l0=6,A0=7,c0=8,UA=9,u0=10,GA=11,h0=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function d0(r){var e=0,t=0,n=jt,i,s,o=[],a=[],l=1,A=0,c=0,u=!1,h=!1,d="",f;r=r||{};var g=s0,p=i0;r.version==="300 es"&&(g=a0,p=o0);for(var y={},Q={},e=0;e<g.length;e++)y[g[e]]=!0;for(var e=0;e<p.length;e++)Q[p[e]]=!0;return function(X){return a=[],X!==null?C(X):w()};function b(X){X.length&&a.push({type:h0[n],data:X,position:c,line:l,column:A})}function C(X){e=0,X.toString&&(X=X.toString()),d+=X.replace(/\r\n/g,`
93
+ `),f=d.length;for(var _;i=d[e],e<f;){switch(_=e,n){case Mo:e=O();break;case Po:e=V();break;case MA:e=$();break;case PA:e=W();break;case OA:e=le();break;case GA:e=te();break;case ai:e=D();break;case NA:e=P();break;case UA:e=k();break;case jt:e=R();break}if(_!==e)switch(d[_]){case`
94
94
  `:A=0,++l;break;default:++A;break}}return t+=e,d=d.slice(e),a}function w(X){return o.length&&b(o.join("")),n=u0,b("(eof)"),a}function R(){return o=o.length?[]:o,s==="/"&&i==="*"?(c=t+e-1,n=Mo,s=i,e+1):s==="/"&&i==="/"?(c=t+e-1,n=Po,s=i,e+1):i==="#"?(n=MA,c=t+e,e):/\s/.test(i)?(n=UA,c=t+e,e):(u=/\d/.test(i),h=/[^\w_]/.test(i),c=t+e,n=u?OA:h?PA:NA,e)}function k(){return/[^\s]/g.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function $(){return(i==="\r"||i===`
95
- `)&&s!=="\\"?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function K(){return $()}function O(){return i==="/"&&s==="*"?(o.push(i),b(o.join("")),n=jt,e+1):(o.push(i),s=i,e+1)}function J(){if(s==="."&&/\d/.test(i))return n=ai,e;if(s==="/"&&i==="*")return n=Mo,e;if(s==="/"&&i==="/")return n=Po,e;if(i==="."&&o.length){for(;ie(o););return n=ai,e}if(i===";"||i===")"||i==="("){if(o.length)for(;ie(o););return b(i),n=jt,e+1}var X=o.length===2&&i!=="=";if(/[\w_\d\s]/.test(i)||X){for(;ie(o););return n=jt,e}return o.push(i),s=i,e+1}function ie(X){var D=0,S,F;do{if(S=kA.indexOf(X.slice(0,X.length+D).join("")),F=kA[S],S===-1){if(D--+X.length>0)continue;F=X.slice(0,1).join("")}return b(F),c+=F.length,o=o.slice(F.length),o.length}while(!0)}function ee(){return/[^a-fA-F0-9]/.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function le(){return i==="."||/[eE]/.test(i)?(o.push(i),n=ai,s=i,e+1):i==="x"&&o.length===1&&o[0]==="0"?(n=GA,o.push(i),s=i,e+1):/[^\d]/.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function _(){return i==="f"&&(o.push(i),s=i,e+=1),/[eE]/.test(i)||(i==="-"||i==="+")&&/[eE]/.test(s)?(o.push(i),s=i,e+1):/[^\d]/.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function P(){if(/[^\d\w_]/.test(i)){var X=o.join("");return Q[X]?n=c0:C[X]?n=A0:n=l0,b(o.join("")),n=jt,e}return o.push(i),s=i,e+1}}var f0=n0,g0=p0;function p0(r,e){var t=f0(e),n=[];return n=n.concat(t(r)),n=n.concat(t(null)),n}var m0=function(e){return atob(e)},E0=g0,I0=m0,v0=C0;function C0(r){for(var e=Array.isArray(r)?r:E0(r),t=0;t<e.length;t++){var n=e[t];if(n.type==="preprocessor"){var i=n.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/);if(i&&i[2]){var s=i[1],o=i[2];return(s?I0(o):o).trim()}}}}/*!
95
+ `)&&s!=="\\"?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function V(){return $()}function O(){return i==="/"&&s==="*"?(o.push(i),b(o.join("")),n=jt,e+1):(o.push(i),s=i,e+1)}function W(){if(s==="."&&/\d/.test(i))return n=ai,e;if(s==="/"&&i==="*")return n=Mo,e;if(s==="/"&&i==="/")return n=Po,e;if(i==="."&&o.length){for(;ie(o););return n=ai,e}if(i===";"||i===")"||i==="("){if(o.length)for(;ie(o););return b(i),n=jt,e+1}var X=o.length===2&&i!=="=";if(/[\w_\d\s]/.test(i)||X){for(;ie(o););return n=jt,e}return o.push(i),s=i,e+1}function ie(X){var _=0,S,F;do{if(S=kA.indexOf(X.slice(0,X.length+_).join("")),F=kA[S],S===-1){if(_--+X.length>0)continue;F=X.slice(0,1).join("")}return b(F),c+=F.length,o=o.slice(F.length),o.length}while(!0)}function te(){return/[^a-fA-F0-9]/.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function le(){return i==="."||/[eE]/.test(i)?(o.push(i),n=ai,s=i,e+1):i==="x"&&o.length===1&&o[0]==="0"?(n=GA,o.push(i),s=i,e+1):/[^\d]/.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function D(){return i==="f"&&(o.push(i),s=i,e+=1),/[eE]/.test(i)||(i==="-"||i==="+")&&/[eE]/.test(s)?(o.push(i),s=i,e+1):/[^\d]/.test(i)?(b(o.join("")),n=jt,e):(o.push(i),s=i,e+1)}function P(){if(/[^\d\w_]/.test(i)){var X=o.join("");return Q[X]?n=c0:y[X]?n=A0:n=l0,b(o.join("")),n=jt,e}return o.push(i),s=i,e+1}}var f0=n0,g0=p0;function p0(r,e){var t=f0(e),n=[];return n=n.concat(t(r)),n=n.concat(t(null)),n}var m0=function(e){return atob(e)},E0=g0,I0=m0,v0=C0;function C0(r){for(var e=Array.isArray(r)?r:E0(r),t=0;t<e.length;t++){var n=e[t];if(n.type==="preprocessor"){var i=n.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/);if(i&&i[2]){var s=i[1],o=i[2];return(s?I0(o):o).trim()}}}}/*!
96
96
  * repeat-string <https://github.com/jonschlinkert/repeat-string>
97
97
  *
98
98
  * Copyright (c) 2014-2015, Jon Schlinkert.
@@ -110,7 +110,7 @@ ${e}`,Nf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mf=Objec
110
110
  `,l[A+1]){var f=l[A+1];f=f.substr(f.split(":",3).join(":").length+1).trim(),s+=ss(`^^^ %s
111
111
 
112
112
  `,f)}}return{long:s.trim(),short:o.trim()}}var Uo,HA;function F0(){if(HA)return Uo;HA=1,Uo=r;function r(e,t){var n={identity:t},i=e.valueOf;return Object.defineProperty(e,"valueOf",{value:function(s){return s!==t?i.apply(this,arguments):n},writable:!0}),n}return Uo}var Go,$A;function k0(){if($A)return Go;$A=1;var r=F0();Go=e;function e(){var t={};return function(n){if((typeof n!="object"||n===null)&&typeof n!="function")throw new Error("Weakmap-shim: Key must be object");var i=n.valueOf(t);return i&&i.identity===t?i:r(n,t)}}return Go}var Ho,YA;function N0(){if(YA)return Ho;YA=1;var r=k0();Ho=e;function e(){var t=r();return{get:function(n,i){var s=t(n);return s.hasOwnProperty("value")?s.value:i},set:function(n,i){return t(n).value=i,this},has:function(n){return"value"in t(n)},delete:function(n){return delete t(n).value}}}return Ho}ko.shader=H0,ko.program=$0;var $o=is,M0=_0,P0=typeof WeakMap>"u"?N0():WeakMap,VA=new P0,O0=0;function KA(r,e,t,n,i,s,o){this.id=r,this.src=e,this.type=t,this.shader=n,this.count=s,this.programs=[],this.cache=o}KA.prototype.dispose=function(){if(--this.count===0){for(var r=this.cache,e=r.gl,t=this.programs,n=0,i=t.length;n<i;++n){var s=r.programs[t[n]];s&&(delete r.programs[n],e.deleteProgram(s))}e.deleteShader(this.shader),delete r.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};function JA(r){this.gl=r,this.shaders=[{},{}],this.programs={}}var WA=JA.prototype;function U0(r,e,t){var n=r.createShader(e);if(r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS)){var i=r.getShaderInfoLog(n);try{var s=M0(i,t,e)}catch(o){throw console.warn("Failed to format compiler error: "+o),new $o(i,`Error compiling shader:
113
- `+i)}throw new $o(i,s.short,s.long)}return n}WA.getShaderReference=function(r,e){var t=this.gl,n=this.shaders[r===t.FRAGMENT_SHADER|0],i=n[e];if(!i||!t.isShader(i.shader)){var s=U0(t,r,e);i=n[e]=new KA(O0++,e,r,s,[],1,this)}else i.count+=1;return i};function G0(r,e,t,n,i){var s=r.createProgram();r.attachShader(s,e),r.attachShader(s,t);for(var o=0;o<n.length;++o)r.bindAttribLocation(s,i[o],n[o]);if(r.linkProgram(s),!r.getProgramParameter(s,r.LINK_STATUS)){var a=r.getProgramInfoLog(s);throw new $o(a,"Error linking program: "+a)}return s}WA.getProgram=function(r,e,t,n){var i=[r.id,e.id,t.join(":"),n.join(":")].join("@"),s=this.programs[i];return(!s||!this.gl.isProgram(s))&&(this.programs[i]=s=G0(this.gl,r.shader,e.shader,t,n),r.programs.push(i),e.programs.push(i)),s};function qA(r){var e=VA.get(r);return e||(e=new JA(r),VA.set(r,e)),e}function H0(r,e,t){return qA(r).getShaderReference(e,t)}function $0(r,e,t,n,i){return qA(r).getProgram(e,t,n,i)}var Yo={};Yo.uniforms=Y0,Yo.attributes=V0;var XA={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},os=null;function jA(r,e){if(!os){var t=Object.keys(XA);os={};for(var n=0;n<t.length;++n){var i=t[n];os[r[i]]=XA[i]}}return os[e]}function Y0(r,e){for(var t=r.getProgramParameter(e,r.ACTIVE_UNIFORMS),n=[],i=0;i<t;++i){var s=r.getActiveUniform(e,i);if(s){var o=jA(r,s.type);if(s.size>1)for(var a=0;a<s.size;++a)n.push({name:s.name.replace("[0]","["+a+"]"),type:o});else n.push({name:s.name,type:o})}}return n}function V0(r,e){for(var t=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES),n=[],i=0;i<t;++i){var s=r.getActiveAttrib(e,i);s&&n.push({name:s.name,type:jA(r,s.type)})}return n}var K0=Yg,J0=Kg,zA=SA,Vo=ko,ZA=Yo,W0=is;function ec(r){this.gl=r,this.gl.lastAttribCount=0,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}var Ko=ec.prototype;Ko.bind=function(){this.program||this._relink();var r,e=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES),t=this.gl.lastAttribCount;if(e>t)for(r=t;r<e;r++)this.gl.enableVertexAttribArray(r);else if(t>e)for(r=e;r<t;r++)this.gl.disableVertexAttribArray(r);this.gl.lastAttribCount=e,this.gl.useProgram(this.program)},Ko.dispose=function(){for(var r=this.gl.lastAttribCount,e=0;e<r;e++)this.gl.disableVertexAttribArray(e);this.gl.lastAttribCount=0,this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null};function q0(r,e){return r.name<e.name?-1:1}Ko.update=function(r,e,t,n){if(!e||arguments.length===1){var i=r;r=i.vertex,e=i.fragment,t=i.uniforms,n=i.attributes}var s=this,o=s.gl,a=s._vref;s._vref=Vo.shader(o,o.VERTEX_SHADER,r),a&&a.dispose(),s.vertShader=s._vref.shader;var l=this._fref;if(s._fref=Vo.shader(o,o.FRAGMENT_SHADER,e),l&&l.dispose(),s.fragShader=s._fref.shader,!t||!n){var A=o.createProgram();if(o.attachShader(A,s.fragShader),o.attachShader(A,s.vertShader),o.linkProgram(A),!o.getProgramParameter(A,o.LINK_STATUS)){var c=o.getProgramInfoLog(A);throw new W0(c,"Error linking program:"+c)}t=t||ZA.uniforms(o,A),n=n||ZA.attributes(o,A),o.deleteProgram(A)}n=n.slice(),n.sort(q0);var u=[],h=[],d=[],f;for(f=0;f<n.length;++f){var g=n[f];if(g.type.indexOf("mat")>=0){for(var p=g.type.charAt(g.type.length-1)|0,C=new Array(p),Q=0;Q<p;++Q)C[Q]=d.length,h.push(g.name+"["+Q+"]"),typeof g.location=="number"?d.push(g.location+Q):Array.isArray(g.location)&&g.location.length===p&&typeof g.location[Q]=="number"?d.push(g.location[Q]|0):d.push(-1);u.push({name:g.name,type:g.type,locations:C})}else u.push({name:g.name,type:g.type,locations:[d.length]}),h.push(g.name),typeof g.location=="number"?d.push(g.location|0):d.push(-1)}var b=0;for(f=0;f<d.length;++f)if(d[f]<0){for(;d.indexOf(b)>=0;)b+=1;d[f]=b}var y=new Array(t.length);function w(){s.program=Vo.program(o,s._vref,s._fref,h,d);for(var R=0;R<t.length;++R)y[R]=o.getUniformLocation(s.program,t[R].name)}w(),s._relink=w,s.types={uniforms:zA(t),attributes:zA(n)},s.attributes=J0(o,s,u,d),Object.defineProperty(s,"uniforms",K0(o,s,t,y))};function X0(r,e,t,n,i){var s=new ec(r);return s.update(e,t,n,i),s}var j0=X0;Object.defineProperty(wA,"__esModule",{value:!0});var z0=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Z0=j0,ep=tp(Z0);function tp(r){return r&&r.__esModule?r:{default:r}}var rp=`attribute vec2 _p;
113
+ `+i)}throw new $o(i,s.short,s.long)}return n}WA.getShaderReference=function(r,e){var t=this.gl,n=this.shaders[r===t.FRAGMENT_SHADER|0],i=n[e];if(!i||!t.isShader(i.shader)){var s=U0(t,r,e);i=n[e]=new KA(O0++,e,r,s,[],1,this)}else i.count+=1;return i};function G0(r,e,t,n,i){var s=r.createProgram();r.attachShader(s,e),r.attachShader(s,t);for(var o=0;o<n.length;++o)r.bindAttribLocation(s,i[o],n[o]);if(r.linkProgram(s),!r.getProgramParameter(s,r.LINK_STATUS)){var a=r.getProgramInfoLog(s);throw new $o(a,"Error linking program: "+a)}return s}WA.getProgram=function(r,e,t,n){var i=[r.id,e.id,t.join(":"),n.join(":")].join("@"),s=this.programs[i];return(!s||!this.gl.isProgram(s))&&(this.programs[i]=s=G0(this.gl,r.shader,e.shader,t,n),r.programs.push(i),e.programs.push(i)),s};function qA(r){var e=VA.get(r);return e||(e=new JA(r),VA.set(r,e)),e}function H0(r,e,t){return qA(r).getShaderReference(e,t)}function $0(r,e,t,n,i){return qA(r).getProgram(e,t,n,i)}var Yo={};Yo.uniforms=Y0,Yo.attributes=V0;var XA={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},os=null;function jA(r,e){if(!os){var t=Object.keys(XA);os={};for(var n=0;n<t.length;++n){var i=t[n];os[r[i]]=XA[i]}}return os[e]}function Y0(r,e){for(var t=r.getProgramParameter(e,r.ACTIVE_UNIFORMS),n=[],i=0;i<t;++i){var s=r.getActiveUniform(e,i);if(s){var o=jA(r,s.type);if(s.size>1)for(var a=0;a<s.size;++a)n.push({name:s.name.replace("[0]","["+a+"]"),type:o});else n.push({name:s.name,type:o})}}return n}function V0(r,e){for(var t=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES),n=[],i=0;i<t;++i){var s=r.getActiveAttrib(e,i);s&&n.push({name:s.name,type:jA(r,s.type)})}return n}var K0=Yg,J0=Kg,zA=SA,Vo=ko,ZA=Yo,W0=is;function ec(r){this.gl=r,this.gl.lastAttribCount=0,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}var Ko=ec.prototype;Ko.bind=function(){this.program||this._relink();var r,e=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES),t=this.gl.lastAttribCount;if(e>t)for(r=t;r<e;r++)this.gl.enableVertexAttribArray(r);else if(t>e)for(r=e;r<t;r++)this.gl.disableVertexAttribArray(r);this.gl.lastAttribCount=e,this.gl.useProgram(this.program)},Ko.dispose=function(){for(var r=this.gl.lastAttribCount,e=0;e<r;e++)this.gl.disableVertexAttribArray(e);this.gl.lastAttribCount=0,this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null};function q0(r,e){return r.name<e.name?-1:1}Ko.update=function(r,e,t,n){if(!e||arguments.length===1){var i=r;r=i.vertex,e=i.fragment,t=i.uniforms,n=i.attributes}var s=this,o=s.gl,a=s._vref;s._vref=Vo.shader(o,o.VERTEX_SHADER,r),a&&a.dispose(),s.vertShader=s._vref.shader;var l=this._fref;if(s._fref=Vo.shader(o,o.FRAGMENT_SHADER,e),l&&l.dispose(),s.fragShader=s._fref.shader,!t||!n){var A=o.createProgram();if(o.attachShader(A,s.fragShader),o.attachShader(A,s.vertShader),o.linkProgram(A),!o.getProgramParameter(A,o.LINK_STATUS)){var c=o.getProgramInfoLog(A);throw new W0(c,"Error linking program:"+c)}t=t||ZA.uniforms(o,A),n=n||ZA.attributes(o,A),o.deleteProgram(A)}n=n.slice(),n.sort(q0);var u=[],h=[],d=[],f;for(f=0;f<n.length;++f){var g=n[f];if(g.type.indexOf("mat")>=0){for(var p=g.type.charAt(g.type.length-1)|0,y=new Array(p),Q=0;Q<p;++Q)y[Q]=d.length,h.push(g.name+"["+Q+"]"),typeof g.location=="number"?d.push(g.location+Q):Array.isArray(g.location)&&g.location.length===p&&typeof g.location[Q]=="number"?d.push(g.location[Q]|0):d.push(-1);u.push({name:g.name,type:g.type,locations:y})}else u.push({name:g.name,type:g.type,locations:[d.length]}),h.push(g.name),typeof g.location=="number"?d.push(g.location|0):d.push(-1)}var b=0;for(f=0;f<d.length;++f)if(d[f]<0){for(;d.indexOf(b)>=0;)b+=1;d[f]=b}var C=new Array(t.length);function w(){s.program=Vo.program(o,s._vref,s._fref,h,d);for(var R=0;R<t.length;++R)C[R]=o.getUniformLocation(s.program,t[R].name)}w(),s._relink=w,s.types={uniforms:zA(t),attributes:zA(n)},s.attributes=J0(o,s,u,d),Object.defineProperty(s,"uniforms",K0(o,s,t,C))};function X0(r,e,t,n,i){var s=new ec(r);return s.update(e,t,n,i),s}var j0=X0;Object.defineProperty(wA,"__esModule",{value:!0});var z0=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Z0=j0,ep=tp(Z0);function tp(r){return r&&r.__esModule?r:{default:r}}var rp=`attribute vec2 _p;
114
114
  varying vec2 _uv;
115
115
  void main() {
116
116
  gl_Position = vec4(_p,0.0,1.0);
@@ -2451,8 +2451,8 @@ vec4 transition(vec2 uv) {
2451
2451
  return mix(a, b, step(0.0+p.y,progress));
2452
2452
  }
2453
2453
  `,author:"Jake Nelson",license:"MIT",createdAt:"Wed, 1 Nov 2017 15:24:36 -0500",updatedAt:"Thu, 2 Nov 2017 18:37:42 -0500"}];const rc=po(sp);var nc;function op(r){if(typeof r=="string"){const[e,t]=r.split(":");return Math.min(parseFloat(e),parseFloat(t))}return r}function ap(r){if(typeof r=="string"){const[e,t]=r.split(":"),n=parseFloat(e),i=parseFloat(t);return n/i}return r}function ic({resolution:r,aspectRatio:e}){const t=op(r),n=ap(e),i=n>=1,s=Math.min(i?t*n:t/n,t),o=Math.max(i?t*n:t/n,t);return{resolution:t,aspectRatio:n,height:i?s:o,width:i?o:s}}const li=/(?<value>\d+\.?\d*)(?=px)/;function sc({context:r,word:e,maxW:t=1/0}){const n=[],i=r.measureText(e);if(i.width<t)return[{text:e,metrics:i}];for(let s=0;s<e.length;s++){const o=n[n.length-1],a=((o==null?void 0:o.text)??"")+e[s],l=r.measureText(a);l.width<t?n[o?n.length-1:0]={text:a,metrics:l}:n.push({text:e[s],metrics:r.measureText(e[s])})}return n}const lp=go(({context:r,fontSizes:e,text:t,maxW:n=1/0})=>{try{return r.save(),r.font=r.font.replace(li,e[0].toString()),t.split(`
2454
- `).flatMap(s=>{const o=s.split(" ").filter(Boolean);return o.length?o.slice(1).reduce((a,l,A)=>{const u=`${a[a.length-1].text} ${l}`.trim(),h=r.measureText(u);if(h.width>n)a=[...a,...sc({context:r,word:l,maxW:n})];else{const d=e[A%e.length];r.font=r.font.replace(li,d.toString()),a[a.length-1]={text:u,metrics:h}}return a},sc({context:r,word:o[0],maxW:n})):{text:"",metrics:r.measureText("")}})}finally{r.restore()}},{cacheKey:([{fontSizes:r,text:e,maxW:t}])=>`${JSON.stringify(r)}_${e}_${t}`}),oc=[{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 Ap({text:r,font:e}){let t=e;return oc.forEach(({family:n,regex:i})=>{i.exec(r)&&(t+=`, ${n}`)}),t}go(({context:r,fontSizes:e,maxW:t=1/0,words:n})=>{try{return r.save(),r.font=r.font.replace(li,e[0].toString()),n.length<=0?[]:n.slice(1).reduce((i,s)=>{var o;const a=s.text,A=`${(o=i[i.length-1])==null?void 0:o.text} ${a}`.trim(),c=r.measureText(A);if(c.width>t){const u=e[i.length%e.length];r.font=r.font.replace(li,u.toString()),i=[...i,{text:a,metrics:r.measureText(a),words:[s]}]}else i[i.length-1]={text:A,metrics:c,words:[...i[i.length-1].words,s]};return i},[{text:n[0].text,metrics:r.measureText(n[0].text),words:[n[0]]}])}finally{r.restore()}},{cacheKey:([{fontSizes:r,words:e,maxW:t}])=>`${JSON.stringify(r)}_${JSON.stringify(e)}_${t}`});let as;const cp=new Uint8Array(16);function up(){if(!as&&(as=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!as))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return as(cp)}const yt=[];for(let r=0;r<256;++r)yt.push((r+256).toString(16).slice(1));function hp(r,e=0){return yt[r[e+0]]+yt[r[e+1]]+yt[r[e+2]]+yt[r[e+3]]+"-"+yt[r[e+4]]+yt[r[e+5]]+"-"+yt[r[e+6]]+yt[r[e+7]]+"-"+yt[r[e+8]]+yt[r[e+9]]+"-"+yt[r[e+10]]+yt[r[e+11]]+yt[r[e+12]]+yt[r[e+13]]+yt[r[e+14]]+yt[r[e+15]]}const ac={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function dp(r,e,t){if(ac.randomUUID&&!e&&!r)return ac.randomUUID();r=r||{};const n=r.random||(r.rng||up)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return hp(n)}go(({font:r,scale:e,context:t,maxW:n,maxH:i,text:s,minSize:o,maxSize:a})=>{var l,A;let c=0;if(a){c=(o??0)*e;let h=0;for(;a*e>c+1;){c+=1;const d=lp({context:t,fontSizes:[c],text:s,maxW:n});if(h=d.reduce((f,g)=>(g.metrics.width>f&&(f=g.metrics.width),f),0),h>n||d.length*c>i){c-=1;break}}}else c=parseFloat(((A=(l=r.match(li))==null?void 0:l.groups)==null?void 0:A.value)??"0")*e;return c},{cacheKey:([{font:r,text:e,minSize:t,maxSize:n,scale:i,maxW:s,maxH:o}])=>`${r}_${e}_${t}_${n}_${i}_${s}_${o}`});function fp(r){if(r===null||typeof r!="object")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e}function gp(r){return r.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}const pp=Wr(()=>eA.loadYoga());Df.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${gp(r)}"`:fp(r)||Array.isArray(r)?JSON.stringify(r):r);const mp="3";function Ep(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:typeof r.top=="number"?r.top*e:r.top,right:typeof r.right=="number"?r.right*e:r.right,bottom:typeof r.bottom=="number"?r.bottom*e:r.bottom,left:typeof r.left=="number"?r.left*e:r.left}}function lc(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:(typeof r.top=="number"?r.top*e:r.top)??0,right:(typeof r.right=="number"?r.right*e:r.right)??0,bottom:(typeof r.bottom=="number"?r.bottom*e:r.bottom)??0,left:(typeof r.left=="number"?r.left*e:r.left)??0}}function Ac(r,e,{layout:t,scale:n=1}){const{position:i="relative",inset:s,width:o,height:a,minWidth:l,minHeight:A,maxWidth:c,maxHeight:u,flex:h,gap:d,margin:f,padding:g,direction:p="column",align:C="start",alignSelf:Q,justify:b="start"}=t,y={static:r.POSITION_TYPE_STATIC,relative:r.POSITION_TYPE_RELATIVE,absolute:r.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(y[i]),s){const{top:$,right:K,bottom:O,left:J}=Ep(s,n);typeof $<"u"&&e.setPosition(r.EDGE_TOP,$),typeof K<"u"&&e.setPosition(r.EDGE_RIGHT,K),typeof O<"u"&&e.setPosition(r.EDGE_BOTTOM,O),typeof J<"u"&&e.setPosition(r.EDGE_LEFT,J)}const w={row:r.FLEX_DIRECTION_ROW,column:r.FLEX_DIRECTION_COLUMN,"row-reverse":r.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":r.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(w[p]);const R={start:r.ALIGN_FLEX_START,end:r.ALIGN_FLEX_END,center:r.ALIGN_CENTER,stretch:r.ALIGN_STRETCH};e.setAlignItems(R[C]),Q&&e.setAlignSelf(R[Q]);const k={start:r.JUSTIFY_FLEX_START,end:r.JUSTIFY_FLEX_END,center:r.JUSTIFY_CENTER,"space-between":r.JUSTIFY_SPACE_BETWEEN,"space-around":r.JUSTIFY_SPACE_AROUND,"space-evenly":r.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(k[b]),f){const{top:$,right:K,bottom:O,left:J}=lc(f,n);e.setMargin(r.EDGE_TOP,$),e.setMargin(r.EDGE_RIGHT,K),e.setMargin(r.EDGE_BOTTOM,O),e.setMargin(r.EDGE_LEFT,J)}if(g){const{top:$,right:K,bottom:O,left:J}=lc(g,n);e.setPadding(r.EDGE_TOP,$),e.setPadding(r.EDGE_RIGHT,K),e.setPadding(r.EDGE_BOTTOM,O),e.setPadding(r.EDGE_LEFT,J)}typeof h<"u"&&e.setFlex(h),e.setGap(r.GUTTER_ALL,(d??0)*n),typeof o<"u"&&e.setWidth(typeof o=="number"?o*n:o),typeof a<"u"&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*n:a)),typeof l<"u"&&e.setMinWidth(typeof l=="number"?l*n:l),typeof A<"u"&&e.setMinHeight(typeof A=="number"?A*n:A),typeof c<"u"&&e.setMaxWidth(typeof c=="number"?c*n:c),typeof u<"u"&&e.setMaxHeight(typeof u=="number"?u*n:u)}async function cc({yoga:r,index:e,parent:t,element:n,resolvers:i}){var s;const{type:o,layout:a,options:l,renderer:A}=n,c=r.Node.create();Ac(r,c,{layout:a}),t.insertChild(c,e);let u=null;(A.type==="text"||A.type==="image"||A.type==="video")&&(u=await i[A.type](l));const h=[];for await(const[d,f]of((s=n.children)==null?void 0:s.entries())??[])h.push(await cc({yoga:r,index:d,parent:c,element:f,resolvers:i}));return t.calculateLayout(),{type:o,node:c,element:n,renderer:A,options:l,dependencies:u,childNodes:h}}function uc(r,e,t=0,n=0){const{top:i,left:s}=r.getComputedLayout(),{top:o,left:a,width:l,height:A}=e.node.getComputedLayout(),c=t+a,u=n+o,h=e.childNodes.map(d=>uc(r,d,c,u));return{...e,x:s+c,y:i+u,width:l,height:A,childNodes:h}}async function hc(r,e,t){for await(const{node:n,options:i,dependencies:s,renderer:o,childNodes:a}of e){const{width:l,height:A}=o;if(l){const c=await l({node:n,options:i,dependencies:s,measureCanvas:t});n.setWidth(c)}if(A){const c=await A({node:n,options:i,dependencies:s,measureCanvas:t});n.setHeight(c)}await hc(r,a,t)}r.calculateLayout()}async function Ip({yoga:r,root:e,resolvers:t,measureCanvas:n}){const i=r.Node.create();Ac(r,i,{layout:e.layout});const s=await cc({yoga:r,index:0,parent:i,element:e.element,resolvers:t});await hc(i,[s],n),i.calculateLayout();const{top:o,left:a,width:l,height:A}=i.getComputedLayout(),c={root:{x:a,y:o,width:l,height:A},node:uc(i,s)};return i.freeRecursive(),c}const vp=(((nc=rc)==null?void 0:nc.default)??rc).reduce((r,e)=>(r[e.name]=e,r),{});function Cp({name:r,canvas:e,to:t,from:n,progress:i}){var s,o,a;const l=e.getContext("webgl",{alpha:!0});if(l){l.disable(l.DEPTH_TEST),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!0);const A=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,A),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),l.STATIC_DRAW),l.viewport(0,0,e.width,e.height);const c=(((s=ns)==null?void 0:s.default)??ns)(l,n);c.minFilter=l.LINEAR,c.magFilter=l.LINEAR;const u=(((o=ns)==null?void 0:o.default)??ns)(l,t);u.minFilter=l.LINEAR,u.magFilter=l.LINEAR;const h=(((a=tc)==null?void 0:a.default)??tc)(l,vp[r]);h.draw(i,c,u,e.width,e.height),c.dispose(),u.dispose(),h.dispose(),l.flush()}}async function yp(){return document.createElement("canvas")}function ls(r){let e=0;for(const t of r)Array.isArray(t)?e+=ls(t):e+=t;return e}function Bp(r){return r.map(({type:e,duration:t},n)=>{var i,s,o,a;if(e==="transition"){const l=((i=r[n-2])==null?void 0:i.type)==="transition"?r[n-2]:null,A=((s=r[n-1])==null?void 0:s.duration)??1/0,c=((o=r[n+1])==null?void 0:o.duration)??1/0,u=((a=r[n+2])==null?void 0:a.type)==="transition"?r[n+2]:null;return Math.min(l?A/2:A,t,u?c/2:c)*-1}return t})}function dc(r){var e;return{...r,children:((e=r.children)==null?void 0:e.map(t=>{if(t.type!=="recipe")return dc(t)}).filter(Boolean))??[]}}function fc({x:r,y:e,node:t,scale:n,duration:i}){const s=[];t.type==="recipe"&&s.push({id:dp(),type:"scene",x:r+t.x*n,y:e+t.y*n,scale:n,duration:i,root:{layout:{width:t.width,height:t.height},element:dc({...t.element,layout:{...t.element.layout,position:"static",width:"100%",height:"100%",margin:0,maxWidth:"100%",maxHeight:"100%"}})}});for(const o of t.childNodes)s.push(...fc({x:r,y:e,node:o,scale:n,duration:i}));return s}async function gc({node:r,canvases:e,sceneTime:t}){await r.renderer.render({canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:r.width,dh:r.height,options:r.options,dependencies:r.dependencies});for await(const n of r.childNodes)await gc({node:n,canvases:e,sceneTime:t})}async function Tp({layout:r,canvases:e,sceneTime:t}){const{node:n}=r;await gc({node:{...n,x:0,y:0},canvases:e,sceneTime:t})}async function pc({config:r,resolvers:e,canvasFactory:t=yp}){const n=await pp();async function i(l,A=0){const{x:c,y:u,scale:h=1,root:d,duration:f}=l,g=await t(),p=await t(),C=await t(),Q=await t(),b=await t(),y=await t(),w=await Ip({yoga:n,root:d,resolvers:e,measureCanvas:y}),R=async K=>{const O=Math.max(0,K-A);g.width=g.height=0,g.width=w.node.width,g.height=w.node.height,await Tp({layout:w,sceneTime:O,canvases:{sceneCanvas:g,cropCanvas:C,letterboxCanvas:Q,posterCanvas:b}})},k=c??w.node.x,$=u??w.node.y;return{x:k,y:$,scale:h,draw:R,start:A,duration:f,layout:w,sceneCanvas:g,transitionCanvas:p,id:l.id,config:l,childScenes:fc({x:k,y:$,node:w.node,scale:h,duration:f})}}const s=await Promise.all(r.tracks.map(async l=>{const A=Bp(l),c=await Promise.all(l.reduce((f,g,p)=>{if(g.type!=="scene")return f;const C=ls(A.slice(0,p));return f.push(i(g,C)),f},[])),u=l.reduce((f,g,p)=>{if(g.type!=="gap")return f;const C=ls(A.slice(0,p));return f.push({id:g.id,start:C,config:g,duration:g.duration}),f},[]),h=l.reduce((f,g,p)=>{if(g.type!=="transition")return f;const C=g.duration,Q=ls(A.slice(0,p))-C;return f.push({id:g.id,name:g.name,start:Q,duration:C,config:g,to:c.find(({id:b})=>{var y;return b===((y=l[p+1])==null?void 0:y.id)}),from:c.find(({id:b})=>{var y;return b===((y=l[p-1])==null?void 0:y.id)})}),f},[]),d=l.map(({id:f})=>c.find(({id:g})=>g===f)??u.find(({id:g})=>g===f)??h.find(({id:g})=>g===f)).filter(Boolean);return{drawScenes:c,gapScenes:u,transitions:h,scenes:d,config:l,duration:Math.max(...d.map(({start:f,duration:g})=>f+g)),trackCanvas:await t()}}));console.log({tracks:s});const o=await t();return{draw:async({canvas:l,currentTime:A})=>{const c=l.getContext("2d");if(c){c.globalAlpha=1,c.globalCompositeOperation="source-over",c.clearRect(0,0,l.width,l.height),c.save(),c.fillStyle="black",c.fillRect(0,0,l.width,l.height),c.restore();for await(const{drawScenes:u,transitions:h,trackCanvas:d}of s){d.width=d.height=0,d.width=l.width,d.height=l.height;const f=u.filter(({start:p,duration:C})=>A>=p&&A<p+C);if(f.length<=0)continue;const g=h.find(({start:p,duration:C})=>A>=p&&A<p+C);for await(const{id:p,x:C,y:Q,scale:b,start:y,duration:w,sceneCanvas:R,transitionCanvas:k,draw:$}of f)if(await($==null?void 0:$(A)),!g)c.drawImage(R,C,Q,R.width*b,R.height*b);else{const{name:K,to:O,from:J,duration:ie}=g;o.width=o.height=k.width=k.height=0,o.width=k.width=R.width,o.height=k.height=R.height;const ee=(O==null?void 0:O.id)===p,le=(J==null?void 0:J.id)===p,_=ee&&O.sceneCanvas||o,P=le&&J.sceneCanvas||o,X=ee?Math.min(1,Math.max(0,(A-y)/ie)):Math.min(1,Math.max(0,1-(y+w-A)/ie));Cp({name:K,progress:X,to:_,from:P,canvas:k});const D=d.getContext("2d");if(!D)return;D.globalCompositeOperation="lighter",D.drawImage(k,C,Q,k.width*b,k.height*b)}c.drawImage(d,0,0,d.width,d.height)}}},tracks:s,audioTracks:r.audioTracks,duration:Math.max(...s.map(({duration:l})=>l),...r.audioTracks.map(({start:l,duration:A})=>l+A))}}const Qp={name:"@vouchfor/embeds",version:"0.0.0-experiment.22bdbfc",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"experiment",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js","test:watch":"yarn test --watch"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/canvas-video":"0.0.0-experiment.22bdbfc","@vouchfor/media-player":"0.0.0-experiment.22bdbfc",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.0.4","@storybook/addon-links":"^8.0.4","@storybook/blocks":"^8.0.4","@storybook/web-components":"^8.0.4","@storybook/web-components-vite":"^8.0.4","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.6","@vouchfor/eslint-config":"^1.0.1","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"0.0.0-experiment.22bdbfc","@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 bp(r){const{publicApiUrl:e}=Ui(r),t=Fr();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function xp(r){var s,o,a,l,A,c,u,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Fr()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),n=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const i=Fr();return e||(e=bp(r),(h=(u=window.localStorage)==null?void 0:u.setItem)==null||h.call(u,"vouch-uid-visitor",e)),t||(t=Fr(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),n||(n=Fr(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",n)),{client:t,tab:n,request:i,visitor:e}}function wp(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function Sp(r="embedded_player"){var i,s;const[e,t]=((s=(i=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:i.split)==null?void 0:s.call(i,"/"))??[],n={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const l=o.toLowerCase().replace(/[-_][a-z0-9]/g,A=>A.slice(-1).toUpperCase());n[l]=a}}),{source:r,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:Qp.version,templateVersion:mp,...n}}const mc=1;class Rp{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,n)=>{const i=wp(n,this.host.vouch);!i||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...n,vouchId:i,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=Ui(this.host.env),{client:n,tab:i,request:s,visitor:o}=xp(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":n,"x-uid-tab":i,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":Sp(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:n}=this._currentlyPlayingVideo;this._streamLatestTime[n]>this._streamStartTime[n]+mc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]}},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:n}})=>{this._answersViewed[n]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[n]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:n,node:i}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:n,node:i},this._streamLatestTime[n]=i.currentTime,this._streamStartTime[n]||(this._streamStartTime[n]=i.currentTime,this._streamLatestTime[n]=i.currentTime))},this._handleVideoPause=({detail:{id:t,key:n}})=>{this._streamLatestTime[n]>this._streamStartTime[n]+mc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]},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,n,i;"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),(n=this.host.mediaPlayer)==null||n.addEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,n,i;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),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var Jo={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof mn<"u"&&mn,n=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof a<"u"&&a,l={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 A(_){return _&&DataView.prototype.isPrototypeOf(_)}if(l.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(_){return _&&c.indexOf(Object.prototype.toString.call(_))>-1};function h(_){if(typeof _!="string"&&(_=String(_)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(_)||_==="")throw new TypeError('Invalid character in header field name: "'+_+'"');return _.toLowerCase()}function d(_){return typeof _!="string"&&(_=String(_)),_}function f(_){var P={next:function(){var X=_.shift();return{done:X===void 0,value:X}}};return l.iterable&&(P[Symbol.iterator]=function(){return P}),P}function g(_){this.map={},_ instanceof g?_.forEach(function(P,X){this.append(X,P)},this):Array.isArray(_)?_.forEach(function(P){this.append(P[0],P[1])},this):_&&Object.getOwnPropertyNames(_).forEach(function(P){this.append(P,_[P])},this)}g.prototype.append=function(_,P){_=h(_),P=d(P);var X=this.map[_];this.map[_]=X?X+", "+P:P},g.prototype.delete=function(_){delete this.map[h(_)]},g.prototype.get=function(_){return _=h(_),this.has(_)?this.map[_]:null},g.prototype.has=function(_){return this.map.hasOwnProperty(h(_))},g.prototype.set=function(_,P){this.map[h(_)]=d(P)},g.prototype.forEach=function(_,P){for(var X in this.map)this.map.hasOwnProperty(X)&&_.call(P,this.map[X],X,this)},g.prototype.keys=function(){var _=[];return this.forEach(function(P,X){_.push(X)}),f(_)},g.prototype.values=function(){var _=[];return this.forEach(function(P){_.push(P)}),f(_)},g.prototype.entries=function(){var _=[];return this.forEach(function(P,X){_.push([X,P])}),f(_)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(_){if(_.bodyUsed)return Promise.reject(new TypeError("Already read"));_.bodyUsed=!0}function C(_){return new Promise(function(P,X){_.onload=function(){P(_.result)},_.onerror=function(){X(_.error)}})}function Q(_){var P=new FileReader,X=C(P);return P.readAsArrayBuffer(_),X}function b(_){var P=new FileReader,X=C(P);return P.readAsText(_),X}function y(_){for(var P=new Uint8Array(_),X=new Array(P.length),D=0;D<P.length;D++)X[D]=String.fromCharCode(P[D]);return X.join("")}function w(_){if(_.slice)return _.slice(0);var P=new Uint8Array(_.byteLength);return P.set(new Uint8Array(_)),P.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(_){this.bodyUsed=this.bodyUsed,this._bodyInit=_,_?typeof _=="string"?this._bodyText=_:l.blob&&Blob.prototype.isPrototypeOf(_)?this._bodyBlob=_:l.formData&&FormData.prototype.isPrototypeOf(_)?this._bodyFormData=_:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(_)?this._bodyText=_.toString():l.arrayBuffer&&l.blob&&A(_)?(this._bodyArrayBuffer=w(_.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(_)||u(_))?this._bodyArrayBuffer=w(_):this._bodyText=_=Object.prototype.toString.call(_):this._bodyText="",this.headers.get("content-type")||(typeof _=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(_)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var _=p(this);if(_)return _;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 _=p(this);return _||(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(Q)}),this.text=function(){var _=p(this);if(_)return _;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(y(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(O)}),this.json=function(){return this.text().then(JSON.parse)},this}var k=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function $(_){var P=_.toUpperCase();return k.indexOf(P)>-1?P:_}function K(_,P){if(!(this instanceof K))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P=P||{};var X=P.body;if(_ instanceof K){if(_.bodyUsed)throw new TypeError("Already read");this.url=_.url,this.credentials=_.credentials,P.headers||(this.headers=new g(_.headers)),this.method=_.method,this.mode=_.mode,this.signal=_.signal,!X&&_._bodyInit!=null&&(X=_._bodyInit,_.bodyUsed=!0)}else this.url=String(_);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new g(P.headers)),this.method=$(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(X),(this.method==="GET"||this.method==="HEAD")&&(P.cache==="no-store"||P.cache==="no-cache")){var D=/([?&])_=[^&]*/;if(D.test(this.url))this.url=this.url.replace(D,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}K.prototype.clone=function(){return new K(this,{body:this._bodyInit})};function O(_){var P=new FormData;return _.trim().split("&").forEach(function(X){if(X){var D=X.split("="),S=D.shift().replace(/\+/g," "),F=D.join("=").replace(/\+/g," ");P.append(decodeURIComponent(S),decodeURIComponent(F))}}),P}function J(_){var P=new g,X=_.replace(/\r?\n[\t ]+/g," ");return X.split("\r").map(function(D){return D.indexOf(`
2455
- `)===0?D.substr(1,D.length):D}).forEach(function(D){var S=D.split(":"),F=S.shift().trim();if(F){var W=S.join(":").trim();P.append(F,W)}}),P}R.call(K.prototype);function ie(_,P){if(!(this instanceof ie))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.ok=this.status>=200&&this.status<300,this.statusText=P.statusText===void 0?"":""+P.statusText,this.headers=new g(P.headers),this.url=P.url||"",this._initBody(_)}R.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},ie.error=function(){var _=new ie(null,{status:0,statusText:""});return _.type="error",_};var ee=[301,302,303,307,308];ie.redirect=function(_,P){if(ee.indexOf(P)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:P,headers:{location:_}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(P,X){this.message=P,this.name=X;var D=Error(P);this.stack=D.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function le(_,P){return new Promise(function(X,D){var S=new K(_,P);if(S.signal&&S.signal.aborted)return D(new o.DOMException("Aborted","AbortError"));var F=new XMLHttpRequest;function W(){F.abort()}F.onload=function(){var ne={status:F.status,statusText:F.statusText,headers:J(F.getAllResponseHeaders()||"")};ne.url="responseURL"in F?F.responseURL:ne.headers.get("X-Request-URL");var ce="response"in F?F.response:F.responseText;setTimeout(function(){X(new ie(ce,ne))},0)},F.onerror=function(){setTimeout(function(){D(new TypeError("Network request failed"))},0)},F.ontimeout=function(){setTimeout(function(){D(new TypeError("Network request failed"))},0)},F.onabort=function(){setTimeout(function(){D(new o.DOMException("Aborted","AbortError"))},0)};function Y(ne){try{return ne===""&&a.location.href?a.location.href:ne}catch{return ne}}F.open(S.method,Y(S.url),!0),S.credentials==="include"?F.withCredentials=!0:S.credentials==="omit"&&(F.withCredentials=!1),"responseType"in F&&(l.blob?F.responseType="blob":l.arrayBuffer&&S.headers.get("Content-Type")&&S.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(F.responseType="arraybuffer")),P&&typeof P.headers=="object"&&!(P.headers instanceof g)?Object.getOwnPropertyNames(P.headers).forEach(function(ne){F.setRequestHeader(ne,d(P.headers[ne]))}):S.headers.forEach(function(ne,ce){F.setRequestHeader(ce,ne)}),S.signal&&(S.signal.addEventListener("abort",W),F.onreadystatechange=function(){F.readyState===4&&S.signal.removeEventListener("abort",W)}),F.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return le.polyfill=!0,a.fetch||(a.fetch=le,a.Headers=g,a.Request=K,a.Response=ie),o.Headers=g,o.Request=K,o.Response=ie,o.fetch=le,o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=t.fetch?t:n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,r.exports=e})(Jo,Jo.exports);var Dp=Jo.exports;const Ec=po(Dp);async function _p(r){var e;try{if((e=await Ec(r,{method:"HEAD"}))!=null&&e.ok)return r}catch{return}}async function Wo({sources:r}){let e=null;const t=r==null?void 0:r.filter(Boolean),n=t==null?void 0:t.find(s=>s.startsWith("blob:")),i=t==null?void 0:t.find(s=>!s.startsWith("http")&&!s.startsWith("blob:"));if(n||i)return n??i;if(t.length>0){const s=t.map(o=>_p(o));e=(await Promise.all(s)).find(Boolean)}return e}async function Lp(r){try{return(await Ec(r)).text()}catch{return null}}async function Fp(r){return r=r.trim(),r.startsWith("http")||r.startsWith("blob:")?Lp(r):r}const kp=Wr(async({original:r,translation:e,originalLanguage:t="",translationLanguage:n=""},{language:i})=>{var s,o;const a={[(s=n==null?void 0:n.split("-"))==null?void 0:s[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:r},l=(i&&a[i])??r;return l?Fp(l):null},{cacheKey:([r,{language:e}])=>JSON.stringify({...r,language:e})});function Np(r){var e;return((e=r==null?void 0:r.items)==null?void 0:e.map(t=>{var n;return{text:(n=t.alternatives[0])==null?void 0:n.content,start:t.start_time,end:t.end_time}}))??[]}const Mp=Wr(async r=>{var e,t,n,i,s,o,a,l,A,c,u;const[h,d,f]=await Promise.all([Wo({sources:[(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,(i=(n=r==null?void 0:r.answer)==null?void 0:n.media)==null?void 0:i.input]}),Wo({sources:[(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),Wo({sources:[((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)]})]);return{src:h,playlist:d,preview:f}},{cacheKey:([r])=>{var e,t,n,i,s,o,a,l,A,c,u;return JSON.stringify({video:(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,input:(i=(n=r==null?void 0:r.answer)==null?void 0:n.media)==null?void 0:i.input,playlist:(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist,preview:((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)})}});function Ic(r){var e,t,n,i,s,o,a,l,A,c,u,h;const d=((t=(e=r==null?void 0:r.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((s=(i=(n=r==null?void 0:r.answer)==null?void 0:n.contact)==null?void 0:i.name)==null?void 0:s.trim())??"",f=((l=(a=(o=r==null?void 0:r.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:l.name)==="Not Supplied"?"":((h=(u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.contact)==null?void 0:c.client)==null?void 0:u.name)==null?void 0:h.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}const Pp=Wr(async(r,e,t)=>{var n,i,s;const o=(n=e==null?void 0:e.answer)==null?void 0:n.id;return((s=(i=r==null?void 0:r.questions)==null?void 0:i.items)==null?void 0:s.reduce((l,A)=>{var c;return((c=A==null?void 0:A.answer)==null?void 0:c.id)===o?(l??0)+1:l},0))<=1?o:`${o}-${t}`},{cacheKey:([r,e,t])=>{var n;return JSON.stringify({index:t,rootData:e,allQuestions:(n=r==null?void 0:r.questions)==null?void 0:n.items})}});async function qo({data:r,rootData:e,index:t},n){var i,s,o,a,l,A,c,u,h,d,f,g,p,C,Q,b,y,w,R,k,$,K,O,J;const[ie,ee,le]=await Promise.all([Pp(r,e,t),Mp(e),kp({original:((s=(i=e==null?void 0:e.answer)==null?void 0:i.media)==null?void 0:s.captions)??((a=(o=e==null?void 0:e.answer)==null?void 0:o.captions)==null?void 0:a.current),translation:((A=(l=e==null?void 0:e.answer)==null?void 0:l.media)==null?void 0:A.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=(g=(f=e==null?void 0:e.answer)==null?void 0:f.transcription)==null?void 0:g.translation)==null?void 0:p.language},n)]),_=Ic(e);return{...ee,..._,key:ie,captions:le,wordTimings:Np((C=e==null?void 0:e.answer)==null?void 0:C.transcription),answerLabel:((Q=e==null?void 0:e.answer)==null?void 0:Q.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((R=(w=(y=(b=r==null?void 0:r.questions)==null?void 0:b.items)==null?void 0:y[t-1])==null?void 0:w.answer)==null?void 0:R.label)??((K=($=(k=r==null?void 0:r.questions)==null?void 0:k.items)==null?void 0:$[t-1])==null?void 0:K.title)??null:null,isFirstInstanceOfName:t?((J=(O=r==null?void 0:r.questions)==null?void 0:O.items)==null?void 0:J.findIndex(P=>Ic(P).name===_.name))===t:!0}}const As={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 Op({data:r}){var e,t;return((t=(e=r==null?void 0:r.questions)==null?void 0:e.items)==null?void 0:t.reduce((n,i)=>{var s,o,a,l,A,c,u;const h=(a=(o=(s=i==null?void 0:i.answer)==null?void 0:s.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(u=(c=(A=(l=i==null?void 0:i.answer)==null?void 0:l.transcription)==null?void 0:A.translation)==null?void 0:c.language)==null?void 0:u.split("-")[0];return h&&As[h]&&!n.find(f=>f.value===h)&&n.push({value:h,label:As[h]}),d&&As[d]&&!n.find(f=>f.value===d)&&n.push({value:d,label:As[d]}),n},[]))??[]}/**
2454
+ `).flatMap(s=>{const o=s.split(" ").filter(Boolean);return o.length?o.slice(1).reduce((a,l,A)=>{const u=`${a[a.length-1].text} ${l}`.trim(),h=r.measureText(u);if(h.width>n)a=[...a,...sc({context:r,word:l,maxW:n})];else{const d=e[A%e.length];r.font=r.font.replace(li,d.toString()),a[a.length-1]={text:u,metrics:h}}return a},sc({context:r,word:o[0],maxW:n})):{text:"",metrics:r.measureText("")}})}finally{r.restore()}},{cacheKey:([{fontSizes:r,text:e,maxW:t}])=>`${JSON.stringify(r)}_${e}_${t}`}),oc=[{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 Ap({text:r,font:e}){let t=e;return oc.forEach(({family:n,regex:i})=>{i.exec(r)&&(t+=`, ${n}`)}),t}go(({context:r,fontSizes:e,maxW:t=1/0,words:n})=>{try{return r.save(),r.font=r.font.replace(li,e[0].toString()),n.length<=0?[]:n.slice(1).reduce((i,s)=>{var o;const a=s.text,A=`${(o=i[i.length-1])==null?void 0:o.text} ${a}`.trim(),c=r.measureText(A);if(c.width>t){const u=e[i.length%e.length];r.font=r.font.replace(li,u.toString()),i=[...i,{text:a,metrics:r.measureText(a),words:[s]}]}else i[i.length-1]={text:A,metrics:c,words:[...i[i.length-1].words,s]};return i},[{text:n[0].text,metrics:r.measureText(n[0].text),words:[n[0]]}])}finally{r.restore()}},{cacheKey:([{fontSizes:r,words:e,maxW:t}])=>`${JSON.stringify(r)}_${JSON.stringify(e)}_${t}`});let as;const cp=new Uint8Array(16);function up(){if(!as&&(as=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!as))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return as(cp)}const yt=[];for(let r=0;r<256;++r)yt.push((r+256).toString(16).slice(1));function hp(r,e=0){return yt[r[e+0]]+yt[r[e+1]]+yt[r[e+2]]+yt[r[e+3]]+"-"+yt[r[e+4]]+yt[r[e+5]]+"-"+yt[r[e+6]]+yt[r[e+7]]+"-"+yt[r[e+8]]+yt[r[e+9]]+"-"+yt[r[e+10]]+yt[r[e+11]]+yt[r[e+12]]+yt[r[e+13]]+yt[r[e+14]]+yt[r[e+15]]}const ac={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function dp(r,e,t){if(ac.randomUUID&&!e&&!r)return ac.randomUUID();r=r||{};const n=r.random||(r.rng||up)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=n[i];return e}return hp(n)}go(({font:r,scale:e,context:t,maxW:n,maxH:i,text:s,minSize:o,maxSize:a})=>{var l,A;let c=0;if(a){c=(o??0)*e;let h=0;for(;a*e>c+1;){c+=1;const d=lp({context:t,fontSizes:[c],text:s,maxW:n});if(h=d.reduce((f,g)=>(g.metrics.width>f&&(f=g.metrics.width),f),0),h>n||d.length*c>i){c-=1;break}}}else c=parseFloat(((A=(l=r.match(li))==null?void 0:l.groups)==null?void 0:A.value)??"0")*e;return c},{cacheKey:([{font:r,text:e,minSize:t,maxSize:n,scale:i,maxW:s,maxH:o}])=>`${r}_${e}_${t}_${n}_${i}_${s}_${o}`});function fp(r){if(r===null||typeof r!="object")return!1;if(Object.getPrototypeOf(r)===null)return!0;let e=r;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(r)===e}function gp(r){return r.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/"/g,'\\"')}const pp=Wr(()=>eA.loadYoga());Df.filters.define("parse",r=>typeof r>"u"?null:typeof r=="string"?`"${gp(r)}"`:fp(r)||Array.isArray(r)?JSON.stringify(r):r);const mp="3";function Ep(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:typeof r.top=="number"?r.top*e:r.top,right:typeof r.right=="number"?r.right*e:r.right,bottom:typeof r.bottom=="number"?r.bottom*e:r.bottom,left:typeof r.left=="number"?r.left*e:r.left}}function lc(r,e){return typeof r=="number"?{top:r*e,right:r*e,bottom:r*e,left:r*e}:{top:(typeof r.top=="number"?r.top*e:r.top)??0,right:(typeof r.right=="number"?r.right*e:r.right)??0,bottom:(typeof r.bottom=="number"?r.bottom*e:r.bottom)??0,left:(typeof r.left=="number"?r.left*e:r.left)??0}}function Ac(r,e,{layout:t,scale:n=1}){const{position:i="relative",inset:s,width:o,height:a,minWidth:l,minHeight:A,maxWidth:c,maxHeight:u,flex:h,gap:d,margin:f,padding:g,direction:p="column",align:y="start",alignSelf:Q,justify:b="start"}=t,C={static:r.POSITION_TYPE_STATIC,relative:r.POSITION_TYPE_RELATIVE,absolute:r.POSITION_TYPE_ABSOLUTE};if(e.setPositionType(C[i]),s){const{top:$,right:V,bottom:O,left:W}=Ep(s,n);typeof $<"u"&&e.setPosition(r.EDGE_TOP,$),typeof V<"u"&&e.setPosition(r.EDGE_RIGHT,V),typeof O<"u"&&e.setPosition(r.EDGE_BOTTOM,O),typeof W<"u"&&e.setPosition(r.EDGE_LEFT,W)}const w={row:r.FLEX_DIRECTION_ROW,column:r.FLEX_DIRECTION_COLUMN,"row-reverse":r.FLEX_DIRECTION_ROW_REVERSE,"column-reverse":r.FLEX_DIRECTION_COLUMN_REVERSE};e.setFlexDirection(w[p]);const R={start:r.ALIGN_FLEX_START,end:r.ALIGN_FLEX_END,center:r.ALIGN_CENTER,stretch:r.ALIGN_STRETCH};e.setAlignItems(R[y]),Q&&e.setAlignSelf(R[Q]);const k={start:r.JUSTIFY_FLEX_START,end:r.JUSTIFY_FLEX_END,center:r.JUSTIFY_CENTER,"space-between":r.JUSTIFY_SPACE_BETWEEN,"space-around":r.JUSTIFY_SPACE_AROUND,"space-evenly":r.JUSTIFY_SPACE_EVENLY};if(e.setJustifyContent(k[b]),f){const{top:$,right:V,bottom:O,left:W}=lc(f,n);e.setMargin(r.EDGE_TOP,$),e.setMargin(r.EDGE_RIGHT,V),e.setMargin(r.EDGE_BOTTOM,O),e.setMargin(r.EDGE_LEFT,W)}if(g){const{top:$,right:V,bottom:O,left:W}=lc(g,n);e.setPadding(r.EDGE_TOP,$),e.setPadding(r.EDGE_RIGHT,V),e.setPadding(r.EDGE_BOTTOM,O),e.setPadding(r.EDGE_LEFT,W)}typeof h<"u"&&e.setFlex(h),e.setGap(r.GUTTER_ALL,(d??0)*n),typeof o<"u"&&e.setWidth(typeof o=="number"?o*n:o),typeof a<"u"&&(typeof a=="function"?e.setHeight("100%"):e.setHeight(typeof a=="number"?a*n:a)),typeof l<"u"&&e.setMinWidth(typeof l=="number"?l*n:l),typeof A<"u"&&e.setMinHeight(typeof A=="number"?A*n:A),typeof c<"u"&&e.setMaxWidth(typeof c=="number"?c*n:c),typeof u<"u"&&e.setMaxHeight(typeof u=="number"?u*n:u)}async function cc({yoga:r,index:e,parent:t,element:n,resolvers:i}){var s,o;const{type:a,layout:l={},options:A,renderer:c}=n,u=r.Node.create();Ac(r,u,{layout:l}),t.insertChild(u,e);let h=null;i&&((c==null?void 0:c.type)==="text"||(c==null?void 0:c.type)==="image"||(c==null?void 0:c.type)==="video")&&(h=await((s=i[c.type])==null?void 0:s.call(i,A))??null);const d=[];for await(const[f,g]of((o=n.children)==null?void 0:o.entries())??[])d.push(await cc({yoga:r,index:f,parent:u,element:g,resolvers:i}));return t.calculateLayout(),{type:a,node:u,element:n,renderer:c,options:A,dependencies:h,childNodes:d}}function uc(r,e,t=0,n=0){const{top:i,left:s}=r.getComputedLayout(),{top:o,left:a,width:l,height:A}=e.node.getComputedLayout(),c=t+a,u=n+o,h=e.childNodes.map(d=>uc(r,d,c,u));return{...e,x:s+c,y:i+u,width:l,height:A,childNodes:h}}async function hc(r,e,t){for await(const{node:n,options:i,dependencies:s,renderer:o,childNodes:a}of e)if(o){const{width:l,height:A}=o;if(l){const c=await l({node:n,options:i,dependencies:s,measureCanvas:t});n.setWidth(c)}if(A){const c=await A({node:n,options:i,dependencies:s,measureCanvas:t});n.setHeight(c)}await hc(r,a,t)}r.calculateLayout()}async function Ip({root:r,resolvers:e,measureCanvas:t}){const n=await pp(),i=n.Node.create();Ac(n,i,{layout:r.layout});const s=await cc({yoga:n,index:0,parent:i,element:r.element,resolvers:e});await hc(i,[s],t),i.calculateLayout();const{top:o,left:a,width:l,height:A}=i.getComputedLayout(),c={root:{x:a,y:o,width:l,height:A},node:uc(i,s)};return i.freeRecursive(),c}const vp=(((nc=rc)==null?void 0:nc.default)??rc).reduce((r,e)=>(r[e.name]=e,r),{});function Cp({name:r,canvas:e,to:t,from:n,progress:i}){var s,o,a;const l=e.getContext("webgl",{alpha:!0});if(l){l.disable(l.DEPTH_TEST),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!0);const A=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,A),l.bufferData(l.ARRAY_BUFFER,new Float32Array([-1,-1,-1,4,4,-1]),l.STATIC_DRAW),l.viewport(0,0,e.width,e.height);const c=(((s=ns)==null?void 0:s.default)??ns)(l,n);c.minFilter=l.LINEAR,c.magFilter=l.LINEAR;const u=(((o=ns)==null?void 0:o.default)??ns)(l,t);u.minFilter=l.LINEAR,u.magFilter=l.LINEAR;const h=(((a=tc)==null?void 0:a.default)??tc)(l,vp[r]);h.draw(i,c,u,e.width,e.height),c.dispose(),u.dispose(),h.dispose(),l.flush()}}async function yp(){return document.createElement("canvas")}function ls(r){let e=0;for(const t of r)Array.isArray(t)?e+=ls(t):e+=t;return e}function Bp(r){return r.map(({type:e,duration:t},n)=>{var i,s,o,a;if(e==="transition"){const l=((i=r[n-2])==null?void 0:i.type)==="transition"?r[n-2]:null,A=((s=r[n-1])==null?void 0:s.duration)??1/0,c=((o=r[n+1])==null?void 0:o.duration)??1/0,u=((a=r[n+2])==null?void 0:a.type)==="transition"?r[n+2]:null;return Math.min(l?A/2:A,t,u?c/2:c)*-1}return t})}function dc(r){var e;return{...r,children:((e=r.children)==null?void 0:e.map(t=>{if(t.type!=="recipe")return dc(t)}).filter(Boolean))??[]}}function fc({x:r,y:e,node:t,scale:n,duration:i}){const s=[];t.type==="recipe"&&s.push({id:dp(),type:"scene",x:r+t.x*n,y:e+t.y*n,scale:n,duration:i,root:{layout:{width:t.width,height:t.height},element:dc({...t.element,layout:{...t.element.layout,position:"static",width:"100%",height:"100%",margin:0,maxWidth:"100%",maxHeight:"100%"}})}});for(const o of t.childNodes)s.push(...fc({x:r,y:e,node:o,scale:n,duration:i}));return s}async function gc({node:r,canvases:e,sceneTime:t}){var n;await((n=r.renderer)==null?void 0:n.render({canvases:e,sceneTime:t,dx:r.x,dy:r.y,dw:r.width,dh:r.height,options:r.options,dependencies:r.dependencies}));for await(const i of r.childNodes)await gc({node:i,canvases:e,sceneTime:t})}async function Tp({layout:r,canvases:e,sceneTime:t}){const{node:n}=r;await gc({node:{...n,x:0,y:0},canvases:e,sceneTime:t})}async function pc({config:r,resolvers:e,canvasFactory:t=yp}){async function n(a,l=0){const{x:A,y:c,scale:u=1,root:h,duration:d}=a,f=await t(),g=await t(),p=await t(),y=await t(),Q=await t(),b=await t(),C=await Ip({root:h,resolvers:e,measureCanvas:b}),w=async $=>{const V=Math.max(0,$-l);f.width=f.height=0,f.width=C.node.width,f.height=C.node.height,await Tp({layout:C,sceneTime:V,canvases:{sceneCanvas:f,cropCanvas:p,letterboxCanvas:y,posterCanvas:Q}})},R=A??C.node.x,k=c??C.node.y;return{x:R,y:k,scale:u,draw:w,start:l,duration:d,layout:C,sceneCanvas:f,transitionCanvas:g,id:a.id,config:a,childScenes:fc({x:R,y:k,node:C.node,scale:u,duration:d})}}const i=await Promise.all(r.tracks.map(async a=>{const l=Bp(a),A=await Promise.all(a.reduce((d,f,g)=>{if(f.type!=="scene")return d;const p=ls(l.slice(0,g));return d.push(n(f,p)),d},[])),c=a.reduce((d,f,g)=>{if(f.type!=="gap")return d;const p=ls(l.slice(0,g));return d.push({id:f.id,start:p,config:f,duration:f.duration}),d},[]),u=a.reduce((d,f,g)=>{if(f.type!=="transition")return d;const p=f.duration,y=ls(l.slice(0,g))-p;return d.push({id:f.id,name:f.name,start:y,duration:p,config:f,to:A.find(({id:Q})=>{var b;return Q===((b=a[g+1])==null?void 0:b.id)}),from:A.find(({id:Q})=>{var b;return Q===((b=a[g-1])==null?void 0:b.id)})}),d},[]),h=a.map(({id:d})=>A.find(({id:f})=>f===d)??c.find(({id:f})=>f===d)??u.find(({id:f})=>f===d)).filter(Boolean);return{drawScenes:A,gapScenes:c,transitions:u,scenes:h,config:a,duration:Math.max(...h.map(({start:d,duration:f})=>d+f)),trackCanvas:await t()}}));console.log({tracks:i});const s=await t();return{draw:async({canvas:a,currentTime:l})=>{const A=a.getContext("2d");if(A){A.globalAlpha=1,A.globalCompositeOperation="source-over",A.clearRect(0,0,a.width,a.height),A.save(),A.fillStyle="black",A.fillRect(0,0,a.width,a.height),A.restore();for await(const{drawScenes:c,transitions:u,trackCanvas:h}of i){h.width=h.height=0,h.width=a.width,h.height=a.height;const d=c.filter(({start:g,duration:p})=>l>=g&&l<g+p);if(d.length<=0)continue;const f=u.find(({start:g,duration:p})=>l>=g&&l<g+p);for await(const{id:g,x:p,y,scale:Q,start:b,duration:C,sceneCanvas:w,transitionCanvas:R,draw:k}of d)if(await(k==null?void 0:k(l)),!f)A.drawImage(w,p,y,w.width*Q,w.height*Q);else{const{name:$,to:V,from:O,duration:W}=f;s.width=s.height=R.width=R.height=0,s.width=R.width=w.width,s.height=R.height=w.height;const ie=(V==null?void 0:V.id)===g,te=(O==null?void 0:O.id)===g,le=ie&&V.sceneCanvas||s,D=te&&O.sceneCanvas||s,P=ie?Math.min(1,Math.max(0,(l-b)/W)):Math.min(1,Math.max(0,1-(b+C-l)/W));Cp({name:$,progress:P,to:le,from:D,canvas:R});const X=h.getContext("2d");if(!X)return;X.globalCompositeOperation="lighter",X.drawImage(R,p,y,R.width*Q,R.height*Q)}A.drawImage(h,0,0,h.width,h.height)}}},tracks:i,audioTracks:r.audioTracks,duration:Math.max(...i.map(({duration:a})=>a),...r.audioTracks.map(({start:a,duration:l})=>a+l))}}const Qp={name:"@vouchfor/embeds",version:"0.0.0-experiment.24d239c",license:"MIT",author:"Aaron Williams",main:"dist/es/embeds.js",module:"dist/es/embeds.js",type:"module",types:"dist/es/src/index.d.ts",exports:{".":"./dist/es/embeds.js"},files:["dist","src"],publishConfig:{tag:"experiment",access:"public"},engines:{node:">=18.18.0"},scripts:{build:"rm -rf dist && tsc && yarn build:self","build:deps":"yarn --cwd ../media-player build","build:self":"vite build --mode iife && vite build --mode es && node scripts/build.cjs","build:package":"yarn build","build:storybook":"yarn prebuild && storybook build","generate:manifest":"wca src --outFile custom-elements.json",lint:"eslint . --quiet","lint:fix":"eslint . --fix","lint:staged":"lint-staged",prepublishOnly:"yarn build",size:"size-limit",storybook:"yarn prebuild && storybook dev -p 6007",prebuild:"yarn build:deps && yarn generate:manifest",test:"rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner","test:ci":"yarn test --config web-test-runner.ci.config.js","test:watch":"yarn test --watch"},"lint-staged":{"**/*.{ts,tsx,js}":"eslint --fix --quiet","**/*.{md,json,yml}":"prettier --write"},dependencies:{"@a11y/focus-trap":"^1.0.5","@lit/task":"^1.0.0","@vouchfor/canvas-video":"0.0.0-experiment.24d239c","@vouchfor/media-player":"0.0.0-experiment.24d239c",uuid:"^9.0.1"},peerDependencies:{lit:"^3.1.2"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@open-wc/testing":"^4.0.0","@storybook/addon-essentials":"^8.0.4","@storybook/addon-links":"^8.0.4","@storybook/blocks":"^8.0.4","@storybook/web-components":"^8.0.4","@storybook/web-components-vite":"^8.0.4","@svgr/core":"^8.1.0","@types/flat":"^5.0.5","@types/mocha":"^10.0.6","@vouchfor/eslint-config":"^1.0.1","@vouchfor/prettier-config":"^1.0.1","@vouchfor/video-utils":"0.0.0-experiment.24d239c","@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 bp(r){const{publicApiUrl:e}=Ui(r),t=Fr();return navigator.sendBeacon(`${e}/api/visitor`,JSON.stringify({visitorId:t})),t}function xp(r){var s,o,a,l,A,c,u,h,d,f,g,p;if(typeof window>"u")return{client:null,tab:null,request:Fr()};let e=(o=(s=window.localStorage)==null?void 0:s.getItem)==null?void 0:o.call(s,"vouch-uid-visitor"),t=(l=(a=window.localStorage)==null?void 0:a.getItem)==null?void 0:l.call(a,"vouch-uid-client"),n=(c=(A=window.sessionStorage)==null?void 0:A.getItem)==null?void 0:c.call(A,"vouch-uid-tab");const i=Fr();return e||(e=bp(r),(h=(u=window.localStorage)==null?void 0:u.setItem)==null||h.call(u,"vouch-uid-visitor",e)),t||(t=Fr(),(f=(d=window.localStorage)==null?void 0:d.setItem)==null||f.call(d,"vouch-uid-client",t)),n||(n=Fr(),(p=(g=window.sessionStorage)==null?void 0:g.setItem)==null||p.call(g,"vouch-uid-tab",n)),{client:t,tab:n,request:i,visitor:e}}function wp(r,e){return r&&"vouchId"in r?r.vouchId:(e==null?void 0:e.id)??null}function Sp(r="embedded_player"){var i,s;const[e,t]=((s=(i=Intl.DateTimeFormat().resolvedOptions().timeZone)==null?void 0:i.split)==null?void 0:s.call(i,"/"))??[],n={};return[...new URLSearchParams(location.search).entries()].forEach(([o,a])=>{if(/utm/.test(o)){const l=o.toLowerCase().replace(/[-_][a-z0-9]/g,A=>A.slice(-1).toUpperCase());n[l]=a}}),{source:r,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:Qp.version,templateVersion:mp,...n}}const mc=1;class Rp{constructor(e){this._batchedEvents=[],this._hasPlayed=!1,this._hasLoaded={},this._answersViewed={},this._streamStartTime={},this._streamLatestTime={},this._currentlyPlayingVideo=null,this._createTrackingEvent=(t,n)=>{const i=wp(n,this.host.vouch);!i||this.host.disableTracking||this._batchedEvents.push({event:t,payload:{...n,vouchId:i,time:new Date().toISOString()}})},this._sendTrackingEvent=()=>{if(this._batchedEvents.length<=0)return;const{publicApiUrl:t}=Ui(this.host.env),{client:n,tab:i,request:s,visitor:o}=xp(this.host.env);navigator.sendBeacon(`${t}/api/batchevents`,JSON.stringify({payload:{events:this._batchedEvents},context:{"x-uid-client":n,"x-uid-tab":i,"x-uid-request":s,"x-uid-visitor":o,"x-reporting-metadata":Sp(this.host.trackingSource)}})),this._batchedEvents=[]},this._streamEnded=()=>{if(this._currentlyPlayingVideo){const{id:t,key:n}=this._currentlyPlayingVideo;this._streamLatestTime[n]>this._streamStartTime[n]+mc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]}},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:n}})=>{this._answersViewed[n]||(this._createTrackingEvent("VOUCH_RESPONSE_VIEWED",{answerId:t}),this._answersViewed[n]=!0)},this._handleVideoTimeUpdate=({detail:{id:t,key:n,node:i}})=>{this.host.paused||(this._currentlyPlayingVideo={id:t,key:n,node:i},this._streamLatestTime[n]=i.currentTime,this._streamStartTime[n]||(this._streamStartTime[n]=i.currentTime,this._streamLatestTime[n]=i.currentTime))},this._handleVideoPause=({detail:{id:t,key:n}})=>{this._streamLatestTime[n]>this._streamStartTime[n]+mc&&this._createTrackingEvent("VIDEO_STREAMED",{answerId:t,streamStart:this._streamStartTime[n],streamEnd:this._streamLatestTime[n]}),delete this._streamStartTime[n],delete this._streamLatestTime[n]},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,n,i;"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),(n=this.host.mediaPlayer)==null||n.addEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.addEventListener("video:timeupdate",this._handleVideoTimeUpdate)})}hostDisconnected(){var e,t,n,i;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),(n=this.host.mediaPlayer)==null||n.removeEventListener("video:pause",this._handleVideoPause),(i=this.host.mediaPlayer)==null||i.removeEventListener("video:timeupdate",this._handleVideoTimeUpdate)}}var Jo={exports:{}};(function(r,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof mn<"u"&&mn,n=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof a<"u"&&a,l={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 A(D){return D&&DataView.prototype.isPrototypeOf(D)}if(l.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(D){return D&&c.indexOf(Object.prototype.toString.call(D))>-1};function h(D){if(typeof D!="string"&&(D=String(D)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(D)||D==="")throw new TypeError('Invalid character in header field name: "'+D+'"');return D.toLowerCase()}function d(D){return typeof D!="string"&&(D=String(D)),D}function f(D){var P={next:function(){var X=D.shift();return{done:X===void 0,value:X}}};return l.iterable&&(P[Symbol.iterator]=function(){return P}),P}function g(D){this.map={},D instanceof g?D.forEach(function(P,X){this.append(X,P)},this):Array.isArray(D)?D.forEach(function(P){this.append(P[0],P[1])},this):D&&Object.getOwnPropertyNames(D).forEach(function(P){this.append(P,D[P])},this)}g.prototype.append=function(D,P){D=h(D),P=d(P);var X=this.map[D];this.map[D]=X?X+", "+P:P},g.prototype.delete=function(D){delete this.map[h(D)]},g.prototype.get=function(D){return D=h(D),this.has(D)?this.map[D]:null},g.prototype.has=function(D){return this.map.hasOwnProperty(h(D))},g.prototype.set=function(D,P){this.map[h(D)]=d(P)},g.prototype.forEach=function(D,P){for(var X in this.map)this.map.hasOwnProperty(X)&&D.call(P,this.map[X],X,this)},g.prototype.keys=function(){var D=[];return this.forEach(function(P,X){D.push(X)}),f(D)},g.prototype.values=function(){var D=[];return this.forEach(function(P){D.push(P)}),f(D)},g.prototype.entries=function(){var D=[];return this.forEach(function(P,X){D.push([X,P])}),f(D)},l.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function p(D){if(D.bodyUsed)return Promise.reject(new TypeError("Already read"));D.bodyUsed=!0}function y(D){return new Promise(function(P,X){D.onload=function(){P(D.result)},D.onerror=function(){X(D.error)}})}function Q(D){var P=new FileReader,X=y(P);return P.readAsArrayBuffer(D),X}function b(D){var P=new FileReader,X=y(P);return P.readAsText(D),X}function C(D){for(var P=new Uint8Array(D),X=new Array(P.length),_=0;_<P.length;_++)X[_]=String.fromCharCode(P[_]);return X.join("")}function w(D){if(D.slice)return D.slice(0);var P=new Uint8Array(D.byteLength);return P.set(new Uint8Array(D)),P.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(D){this.bodyUsed=this.bodyUsed,this._bodyInit=D,D?typeof D=="string"?this._bodyText=D:l.blob&&Blob.prototype.isPrototypeOf(D)?this._bodyBlob=D:l.formData&&FormData.prototype.isPrototypeOf(D)?this._bodyFormData=D:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)?this._bodyText=D.toString():l.arrayBuffer&&l.blob&&A(D)?(this._bodyArrayBuffer=w(D.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(D)||u(D))?this._bodyArrayBuffer=w(D):this._bodyText=D=Object.prototype.toString.call(D):this._bodyText="",this.headers.get("content-type")||(typeof D=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(D)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var D=p(this);if(D)return D;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 D=p(this);return D||(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(Q)}),this.text=function(){var D=p(this);if(D)return D;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)},l.formData&&(this.formData=function(){return this.text().then(O)}),this.json=function(){return this.text().then(JSON.parse)},this}var k=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function $(D){var P=D.toUpperCase();return k.indexOf(P)>-1?P:D}function V(D,P){if(!(this instanceof V))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P=P||{};var X=P.body;if(D instanceof V){if(D.bodyUsed)throw new TypeError("Already read");this.url=D.url,this.credentials=D.credentials,P.headers||(this.headers=new g(D.headers)),this.method=D.method,this.mode=D.mode,this.signal=D.signal,!X&&D._bodyInit!=null&&(X=D._bodyInit,D.bodyUsed=!0)}else this.url=String(D);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new g(P.headers)),this.method=$(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&X)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(X),(this.method==="GET"||this.method==="HEAD")&&(P.cache==="no-store"||P.cache==="no-cache")){var _=/([?&])_=[^&]*/;if(_.test(this.url))this.url=this.url.replace(_,"$1_="+new Date().getTime());else{var S=/\?/;this.url+=(S.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}V.prototype.clone=function(){return new V(this,{body:this._bodyInit})};function O(D){var P=new FormData;return D.trim().split("&").forEach(function(X){if(X){var _=X.split("="),S=_.shift().replace(/\+/g," "),F=_.join("=").replace(/\+/g," ");P.append(decodeURIComponent(S),decodeURIComponent(F))}}),P}function W(D){var P=new g,X=D.replace(/\r?\n[\t ]+/g," ");return X.split("\r").map(function(_){return _.indexOf(`
2455
+ `)===0?_.substr(1,_.length):_}).forEach(function(_){var S=_.split(":"),F=S.shift().trim();if(F){var J=S.join(":").trim();P.append(F,J)}}),P}R.call(V.prototype);function ie(D,P){if(!(this instanceof ie))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.ok=this.status>=200&&this.status<300,this.statusText=P.statusText===void 0?"":""+P.statusText,this.headers=new g(P.headers),this.url=P.url||"",this._initBody(D)}R.call(ie.prototype),ie.prototype.clone=function(){return new ie(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},ie.error=function(){var D=new ie(null,{status:0,statusText:""});return D.type="error",D};var te=[301,302,303,307,308];ie.redirect=function(D,P){if(te.indexOf(P)===-1)throw new RangeError("Invalid status code");return new ie(null,{status:P,headers:{location:D}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(P,X){this.message=P,this.name=X;var _=Error(P);this.stack=_.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function le(D,P){return new Promise(function(X,_){var S=new V(D,P);if(S.signal&&S.signal.aborted)return _(new o.DOMException("Aborted","AbortError"));var F=new XMLHttpRequest;function J(){F.abort()}F.onload=function(){var ne={status:F.status,statusText:F.statusText,headers:W(F.getAllResponseHeaders()||"")};ne.url="responseURL"in F?F.responseURL:ne.headers.get("X-Request-URL");var ce="response"in F?F.response:F.responseText;setTimeout(function(){X(new ie(ce,ne))},0)},F.onerror=function(){setTimeout(function(){_(new TypeError("Network request failed"))},0)},F.ontimeout=function(){setTimeout(function(){_(new TypeError("Network request failed"))},0)},F.onabort=function(){setTimeout(function(){_(new o.DOMException("Aborted","AbortError"))},0)};function Y(ne){try{return ne===""&&a.location.href?a.location.href:ne}catch{return ne}}F.open(S.method,Y(S.url),!0),S.credentials==="include"?F.withCredentials=!0:S.credentials==="omit"&&(F.withCredentials=!1),"responseType"in F&&(l.blob?F.responseType="blob":l.arrayBuffer&&S.headers.get("Content-Type")&&S.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(F.responseType="arraybuffer")),P&&typeof P.headers=="object"&&!(P.headers instanceof g)?Object.getOwnPropertyNames(P.headers).forEach(function(ne){F.setRequestHeader(ne,d(P.headers[ne]))}):S.headers.forEach(function(ne,ce){F.setRequestHeader(ce,ne)}),S.signal&&(S.signal.addEventListener("abort",J),F.onreadystatechange=function(){F.readyState===4&&S.signal.removeEventListener("abort",J)}),F.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return le.polyfill=!0,a.fetch||(a.fetch=le,a.Headers=g,a.Request=V,a.Response=ie),o.Headers=g,o.Request=V,o.Response=ie,o.fetch=le,o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=t.fetch?t:n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,r.exports=e})(Jo,Jo.exports);var Dp=Jo.exports;const Ec=po(Dp);async function _p(r){var e;try{if((e=await Ec(r,{method:"HEAD"}))!=null&&e.ok)return r}catch{return}}async function Wo({sources:r}){let e=null;const t=r==null?void 0:r.filter(Boolean),n=t==null?void 0:t.find(s=>s.startsWith("blob:")),i=t==null?void 0:t.find(s=>!s.startsWith("http")&&!s.startsWith("blob:"));if(n||i)return n??i;if(t.length>0){const s=t.map(o=>_p(o));e=(await Promise.all(s)).find(Boolean)}return e}async function Lp(r){try{return(await Ec(r)).text()}catch{return null}}async function Fp(r){return r=r.trim(),r.startsWith("http")||r.startsWith("blob:")?Lp(r):r}const kp=Wr(async({original:r,translation:e,originalLanguage:t="",translationLanguage:n=""},{language:i})=>{var s,o;const a={[(s=n==null?void 0:n.split("-"))==null?void 0:s[0]]:e,[(o=t==null?void 0:t.split("-"))==null?void 0:o[0]]:r},l=(i&&a[i])??r;return l?Fp(l):null},{cacheKey:([r,{language:e}])=>JSON.stringify({...r,language:e})});function Np(r){var e;return((e=r==null?void 0:r.items)==null?void 0:e.map(t=>{var n;return{text:(n=t.alternatives[0])==null?void 0:n.content,start:t.start_time,end:t.end_time}}))??[]}const Mp=Wr(async r=>{var e,t,n,i,s,o,a,l,A,c,u;const[h,d,f]=await Promise.all([Wo({sources:[(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,(i=(n=r==null?void 0:r.answer)==null?void 0:n.media)==null?void 0:i.input]}),Wo({sources:[(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist]}),Wo({sources:[((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)]})]);return{src:h,playlist:d,preview:f}},{cacheKey:([r])=>{var e,t,n,i,s,o,a,l,A,c,u;return JSON.stringify({video:(t=(e=r==null?void 0:r.answer)==null?void 0:e.media)==null?void 0:t.video,input:(i=(n=r==null?void 0:r.answer)==null?void 0:n.media)==null?void 0:i.input,playlist:(o=(s=r==null?void 0:r.answer)==null?void 0:s.media)==null?void 0:o.playlist,preview:((l=(a=r==null?void 0:r.answer)==null?void 0:a.media)==null?void 0:l.reducedQuality)??((u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.media)==null?void 0:c.videos)==null?void 0:u.xs)})}});function Ic(r){var e,t,n,i,s,o,a,l,A,c,u,h;const d=((t=(e=r==null?void 0:r.answer)==null?void 0:e.contact)==null?void 0:t.name)==="Anonymous"?"":((s=(i=(n=r==null?void 0:r.answer)==null?void 0:n.contact)==null?void 0:i.name)==null?void 0:s.trim())??"",f=((l=(a=(o=r==null?void 0:r.answer)==null?void 0:o.contact)==null?void 0:a.client)==null?void 0:l.name)==="Not Supplied"?"":((h=(u=(c=(A=r==null?void 0:r.answer)==null?void 0:A.contact)==null?void 0:c.client)==null?void 0:u.name)==null?void 0:h.trim())??"",[g,p]=d.split(" ");return{name:d,firstName:g,lastName:p,companyName:f}}const Pp=Wr(async(r,e,t)=>{var n,i,s;const o=(n=e==null?void 0:e.answer)==null?void 0:n.id;return((s=(i=r==null?void 0:r.questions)==null?void 0:i.items)==null?void 0:s.reduce((l,A)=>{var c;return((c=A==null?void 0:A.answer)==null?void 0:c.id)===o?(l??0)+1:l},0))<=1?o:`${o}-${t}`},{cacheKey:([r,e,t])=>{var n;return JSON.stringify({index:t,rootData:e,allQuestions:(n=r==null?void 0:r.questions)==null?void 0:n.items})}});async function qo({data:r,rootData:e,index:t},n){var i,s,o,a,l,A,c,u,h,d,f,g,p,y,Q,b,C,w,R,k,$,V,O,W;const[ie,te,le]=await Promise.all([Pp(r,e,t),Mp(e),kp({original:((s=(i=e==null?void 0:e.answer)==null?void 0:i.media)==null?void 0:s.captions)??((a=(o=e==null?void 0:e.answer)==null?void 0:o.captions)==null?void 0:a.current),translation:((A=(l=e==null?void 0:e.answer)==null?void 0:l.media)==null?void 0:A.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=(g=(f=e==null?void 0:e.answer)==null?void 0:f.transcription)==null?void 0:g.translation)==null?void 0:p.language},n)]),D=Ic(e);return{...te,...D,key:ie,captions:le,wordTimings:Np((y=e==null?void 0:e.answer)==null?void 0:y.transcription),answerLabel:((Q=e==null?void 0:e.answer)==null?void 0:Q.label)??(e==null?void 0:e.title),prevAnswerLabel:t?((R=(w=(C=(b=r==null?void 0:r.questions)==null?void 0:b.items)==null?void 0:C[t-1])==null?void 0:w.answer)==null?void 0:R.label)??((V=($=(k=r==null?void 0:r.questions)==null?void 0:k.items)==null?void 0:$[t-1])==null?void 0:V.title)??null:null,isFirstInstanceOfName:t?((W=(O=r==null?void 0:r.questions)==null?void 0:O.items)==null?void 0:W.findIndex(P=>Ic(P).name===D.name))===t:!0}}const As={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 Op({data:r}){var e,t;return((t=(e=r==null?void 0:r.questions)==null?void 0:e.items)==null?void 0:t.reduce((n,i)=>{var s,o,a,l,A,c,u;const h=(a=(o=(s=i==null?void 0:i.answer)==null?void 0:s.transcription)==null?void 0:o.language)==null?void 0:a.split("-")[0],d=(u=(c=(A=(l=i==null?void 0:i.answer)==null?void 0:l.transcription)==null?void 0:A.translation)==null?void 0:c.language)==null?void 0:u.split("-")[0];return h&&As[h]&&!n.find(f=>f.value===h)&&n.push({value:h,label:As[h]}),d&&As[d]&&!n.find(f=>f.value===d)&&n.push({value:d,label:As[d]}),n},[]))??[]}/**
2456
2456
  * @license
2457
2457
  * Copyright 2018 Google LLC
2458
2458
  * SPDX-License-Identifier: BSD-3-Clause
@@ -2460,21 +2460,21 @@ vec4 transition(vec2 uv) {
2460
2460
  * @license
2461
2461
  * Copyright 2018 Google LLC
2462
2462
  * SPDX-License-Identifier: BSD-3-Clause
2463
- */const vc="important",Up=" !"+vc,Ai=pn(class extends Zn{constructor(r){var e;if(super(r),r.type!==gn.ATTRIBUTE||r.name!=="style"||((e=r.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(r){return Object.keys(r).reduce((e,t)=>{const n=r[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(r,[e]){const{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const i=e[n];if(i!=null){this.ft.add(n);const s=typeof i=="string"&&i.endsWith(Up);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?vc:""):t[n]=i}}return Xt}});function Gp(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Cc={exports:{}};(function(r,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(l,A,c){if(c=c||{},l=l.trim(),A=A.trim(),!A){if(!c.alwaysNormalize)return l;var u=a.parseURL(l);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(A);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)):A;var d=a.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var f=i.exec(d.path);d.netLoc=f[1],d.path=f[2]}d.netLoc&&!d.path&&(d.path="/");var g={scheme:d.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(g.netLoc=d.netLoc,h.path[0]!=="/"))if(!h.path)g.path=d.path,h.params||(g.params=d.params,h.query||(g.query=d.query));else{var p=d.path,C=p.substring(0,p.lastIndexOf("/")+1)+h.path;g.path=a.normalizePath(C)}return g.path===null&&(g.path=c.alwaysNormalize?a.normalizePath(h.path):h.path),a.buildURLFromParts(g)},parseURL:function(l){var A=n.exec(l);return A?{scheme:A[1]||"",netLoc:A[2]||"",path:A[3]||"",params:A[4]||"",query:A[5]||"",fragment:A[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(s,"");l.length!==(l=l.replace(o,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};r.exports=a})()})(Cc);var Xo=Cc.exports;function yc(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ht(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yc(Object(t),!0).forEach(function(n){Yp(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):yc(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Hp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function $p(r){var e=Hp(r,"string");return typeof e=="symbol"?e:String(e)}function Yp(r,e,t){return e=$p(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function it(){return it=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},it.apply(this,arguments)}const he=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Vp=Number.isSafeInteger||function(r){return typeof r=="number"&&Math.abs(r)<=Kp},Kp=Number.MAX_SAFE_INTEGER||9007199254740991;let I=function(r){return r.MEDIA_ATTACHING="hlsMediaAttaching",r.MEDIA_ATTACHED="hlsMediaAttached",r.MEDIA_DETACHING="hlsMediaDetaching",r.MEDIA_DETACHED="hlsMediaDetached",r.BUFFER_RESET="hlsBufferReset",r.BUFFER_CODECS="hlsBufferCodecs",r.BUFFER_CREATED="hlsBufferCreated",r.BUFFER_APPENDING="hlsBufferAppending",r.BUFFER_APPENDED="hlsBufferAppended",r.BUFFER_EOS="hlsBufferEos",r.BUFFER_FLUSHING="hlsBufferFlushing",r.BUFFER_FLUSHED="hlsBufferFlushed",r.MANIFEST_LOADING="hlsManifestLoading",r.MANIFEST_LOADED="hlsManifestLoaded",r.MANIFEST_PARSED="hlsManifestParsed",r.LEVEL_SWITCHING="hlsLevelSwitching",r.LEVEL_SWITCHED="hlsLevelSwitched",r.LEVEL_LOADING="hlsLevelLoading",r.LEVEL_LOADED="hlsLevelLoaded",r.LEVEL_UPDATED="hlsLevelUpdated",r.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",r.LEVELS_UPDATED="hlsLevelsUpdated",r.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",r.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",r.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",r.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",r.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",r.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",r.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",r.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",r.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",r.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",r.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",r.CUES_PARSED="hlsCuesParsed",r.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",r.INIT_PTS_FOUND="hlsInitPtsFound",r.FRAG_LOADING="hlsFragLoading",r.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",r.FRAG_LOADED="hlsFragLoaded",r.FRAG_DECRYPTED="hlsFragDecrypted",r.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",r.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",r.FRAG_PARSING_METADATA="hlsFragParsingMetadata",r.FRAG_PARSED="hlsFragParsed",r.FRAG_BUFFERED="hlsFragBuffered",r.FRAG_CHANGED="hlsFragChanged",r.FPS_DROP="hlsFpsDrop",r.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",r.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",r.ERROR="hlsError",r.DESTROYING="hlsDestroying",r.KEY_LOADING="hlsKeyLoading",r.KEY_LOADED="hlsKeyLoaded",r.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",r.BACK_BUFFER_REACHED="hlsBackBufferReached",r.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",r}({}),Be=function(r){return r.NETWORK_ERROR="networkError",r.MEDIA_ERROR="mediaError",r.KEY_SYSTEM_ERROR="keySystemError",r.MUX_ERROR="muxError",r.OTHER_ERROR="otherError",r}({}),V=function(r){return r.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",r.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",r.KEY_SYSTEM_NO_SESSION="keySystemNoSession",r.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",r.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",r.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",r.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",r.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",r.MANIFEST_LOAD_ERROR="manifestLoadError",r.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",r.MANIFEST_PARSING_ERROR="manifestParsingError",r.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",r.LEVEL_EMPTY_ERROR="levelEmptyError",r.LEVEL_LOAD_ERROR="levelLoadError",r.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",r.LEVEL_PARSING_ERROR="levelParsingError",r.LEVEL_SWITCH_ERROR="levelSwitchError",r.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",r.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",r.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",r.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",r.FRAG_LOAD_ERROR="fragLoadError",r.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",r.FRAG_DECRYPT_ERROR="fragDecryptError",r.FRAG_PARSING_ERROR="fragParsingError",r.FRAG_GAP="fragGap",r.REMUX_ALLOC_ERROR="remuxAllocError",r.KEY_LOAD_ERROR="keyLoadError",r.KEY_LOAD_TIMEOUT="keyLoadTimeOut",r.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",r.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",r.BUFFER_APPEND_ERROR="bufferAppendError",r.BUFFER_APPENDING_ERROR="bufferAppendingError",r.BUFFER_STALLED_ERROR="bufferStalledError",r.BUFFER_FULL_ERROR="bufferFullError",r.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",r.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",r.INTERNAL_EXCEPTION="internalException",r.INTERNAL_ABORTED="aborted",r.UNKNOWN="unknown",r}({});const zr=function(){},jo={trace:zr,debug:zr,log:zr,warn:zr,info:zr,error:zr};let ci=jo;function Jp(r){const e=self.console[r];return e?e.bind(self.console,`[${r}] >`):zr}function Wp(r,...e){e.forEach(function(t){ci[t]=r[t]?r[t].bind(r):Jp(t)})}function qp(r,e){if(typeof console=="object"&&r===!0||typeof r=="object"){Wp(r,"debug","log","info","warn","error");try{ci.log(`Debug logs enabled for "${e}" in hls.js version 1.5.11`)}catch{ci=jo}}else ci=jo}const U=ci,Xp=/^(\d+)x(\d+)$/,Bc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Xe{constructor(e){typeof e=="string"&&(e=Xe.parseAttrList(e)),it(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 n=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)n[i]=parseInt(t.slice(i*2,i*2+2),16);return n}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 n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Xp.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const n={},i='"';for(Bc.lastIndex=0;(t=Bc.exec(e))!==null;){let s=t[2];s.indexOf(i)===0&&s.lastIndexOf(i)===s.length-1&&(s=s.slice(1,-1));const o=t[1].trim();n[o]=s}return n}}function jp(r){return r!=="ID"&&r!=="CLASS"&&r!=="START-DATE"&&r!=="DURATION"&&r!=="END-DATE"&&r!=="END-ON-NEXT"}function zp(r){return r==="SCTE35-OUT"||r==="SCTE35-IN"}class Tc{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const n=t.attr;for(const i in n)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==n[i]){U.warn(`DATERANGE tag attribute: "${i}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=i;break}e=it(new Xe({}),n,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const n=new Date(this.attr["END-DATE"]);he(n.getTime())&&(this._endDate=n)}}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(he(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&&he(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class cs{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 He={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Qc{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[He.AUDIO]:null,[He.VIDEO]:null,[He.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const n=e.split("@",2);let i;n.length===1?i=(t==null?void 0:t.byteRangeEndOffset)||0:i=parseInt(n[1]),this._byteRange=[i,parseInt(n[0])+i]}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=Xo.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class zo extends Qc{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 cs,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 n=Object.keys(this.levelkeys);if(n.length===1)return this._decryptdata=this.levelkeys[n[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!he(this.programDateTime))return null;const e=he(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),n=t.length;if(n>1||n===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,n,i,s,o=!1){const{elementaryStreams:a}=this,l=a[e];if(!l){a[e]={startPTS:t,endPTS:n,startDTS:i,endDTS:s,partial:o};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,n),l.startDTS=Math.min(l.startDTS,i),l.endDTS=Math.max(l.endDTS,s)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[He.AUDIO]=null,e[He.VIDEO]=null,e[He.AUDIOVIDEO]=null}}class Zp extends Qc{constructor(e,t,n,i,s){super(n),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 cs,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=i;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,s),s&&(this.fragOffset=s.fragOffset+s.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 em=10;class tm{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,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>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?he(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||em}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 Zo(r){return Uint8Array.from(atob(r),e=>e.charCodeAt(0))}function rm(r){const e=ea(r).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function nm(r){const e=function(n,i,s){const o=n[i];n[i]=n[s],n[s]=o};e(r,0,3),e(r,1,2),e(r,4,5),e(r,6,7)}function im(r){const e=r.split(":");let t=null;if(e[0]==="data"&&e.length===2){const n=e[1].split(";"),i=n[n.length-1].split(",");if(i.length===2){const s=i[0]==="base64",o=i[1];s?(n.splice(-1,1),t=Zo(o)):t=rm(o)}}return t}function ea(r){return Uint8Array.from(unescape(encodeURIComponent(r)),e=>e.charCodeAt(0))}const vn=typeof self<"u"?self:void 0;var Je={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},_t={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function bc(r){switch(r){case _t.FAIRPLAY:return Je.FAIRPLAY;case _t.PLAYREADY:return Je.PLAYREADY;case _t.WIDEVINE:return Je.WIDEVINE;case _t.CLEARKEY:return Je.CLEARKEY}}var xc={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function sm(r){if(r===xc.WIDEVINE)return Je.WIDEVINE}function wc(r){switch(r){case Je.FAIRPLAY:return _t.FAIRPLAY;case Je.PLAYREADY:return _t.PLAYREADY;case Je.WIDEVINE:return _t.WIDEVINE;case Je.CLEARKEY:return _t.CLEARKEY}}function ta(r){const{drmSystems:e,widevineLicenseUrl:t}=r,n=e?[Je.FAIRPLAY,Je.WIDEVINE,Je.PLAYREADY,Je.CLEARKEY].filter(i=>!!e[i]):[];return!n[Je.WIDEVINE]&&t&&n.push(Je.WIDEVINE),n}const Sc=function(r){return vn!=null&&(r=vn.navigator)!=null&&r.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function om(r,e,t,n){let i;switch(r){case Je.FAIRPLAY:i=["cenc","sinf"];break;case Je.WIDEVINE:case Je.PLAYREADY:i=["cenc"];break;case Je.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${r}`)}return am(i,e,t,n)}function am(r,e,t,n){return[{initDataTypes:r,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs="${s}"`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs="${s}"`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function Zr(r,e,t){return Uint8Array.prototype.slice?r.slice(e,t):new Uint8Array(Array.prototype.slice.call(r,e,t))}const ra=(r,e)=>e+10<=r.length&&r[e]===73&&r[e+1]===68&&r[e+2]===51&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128,Rc=(r,e)=>e+10<=r.length&&r[e]===51&&r[e+1]===68&&r[e+2]===73&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128,ui=(r,e)=>{const t=e;let n=0;for(;ra(r,e);){n+=10;const i=us(r,e+6);n+=i,Rc(r,e+10)&&(n+=10),e+=n}if(n>0)return r.subarray(t,t+n)},us=(r,e)=>{let t=0;return t=(r[e]&127)<<21,t|=(r[e+1]&127)<<14,t|=(r[e+2]&127)<<7,t|=r[e+3]&127,t},lm=(r,e)=>ra(r,e)&&us(r,e+6)+10<=r.length-e,na=r=>{const e=_c(r);for(let t=0;t<e.length;t++){const n=e[t];if(Dc(n))return fm(n)}},Dc=r=>r&&r.key==="PRIV"&&r.info==="com.apple.streaming.transportStreamTimestamp",Am=r=>{const e=String.fromCharCode(r[0],r[1],r[2],r[3]),t=us(r,4),n=10;return{type:e,size:t,data:r.subarray(n,n+t)}},_c=r=>{let e=0;const t=[];for(;ra(r,e);){const n=us(r,e+6);e+=10;const i=e+n;for(;e+8<i;){const s=Am(r.subarray(e)),o=cm(s);o&&t.push(o),e+=s.size+10}Rc(r,e)&&(e+=10)}return t},cm=r=>r.type==="PRIV"?um(r):r.type[0]==="W"?dm(r):hm(r),um=r=>{if(r.size<2)return;const e=or(r.data,!0),t=new Uint8Array(r.data.subarray(e.length+1));return{key:r.type,info:e,data:t.buffer}},hm=r=>{if(r.size<2)return;if(r.type==="TXXX"){let t=1;const n=or(r.data.subarray(t),!0);t+=n.length+1;const i=or(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=or(r.data.subarray(1));return{key:r.type,data:e}},dm=r=>{if(r.type==="WXXX"){if(r.size<2)return;let t=1;const n=or(r.data.subarray(t),!0);t+=n.length+1;const i=or(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=or(r.data);return{key:r.type,data:e}},fm=r=>{if(r.data.byteLength===8){const e=new Uint8Array(r.data),t=e[3]&1;let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,t&&(n+=4772185884e-2),Math.round(n)}},or=(r,e=!1)=>{const t=gm();if(t){const A=t.decode(r);if(e){const c=A.indexOf("\0");return c!==-1?A.substring(0,c):A}return A.replace(/\0/g,"")}const n=r.length;let i,s,o,a="",l=0;for(;l<n;){if(i=r[l++],i===0&&e)return a;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(i);break;case 12:case 13:s=r[l++],a+=String.fromCharCode((i&31)<<6|s&63);break;case 14:s=r[l++],o=r[l++],a+=String.fromCharCode((i&15)<<12|(s&63)<<6|(o&63)<<0);break}}return a};let ia;function gm(){if(!navigator.userAgent.includes("PlayStation 4"))return!ia&&typeof self.TextDecoder<"u"&&(ia=new self.TextDecoder("utf-8")),ia}const ar={hexDump:function(r){let e="";for(let t=0;t<r.length;t++){let n=r[t].toString(16);n.length<2&&(n="0"+n),e+=n}return e}},hs=Math.pow(2,32)-1,pm=[].push,Lc={video:1,audio:2,id3:3,text:4};function ct(r){return String.fromCharCode.apply(null,r)}function Fc(r,e){const t=r[e]<<8|r[e+1];return t<0?65536+t:t}function me(r,e){const t=Nc(r,e);return t<0?4294967296+t:t}function kc(r,e){let t=me(r,e);return t*=Math.pow(2,32),t+=me(r,e+4),t}function Nc(r,e){return r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}function sa(r,e,t){r[e]=t>>24,r[e+1]=t>>16&255,r[e+2]=t>>8&255,r[e+3]=t&255}function mm(r){const e=r.byteLength;for(let t=0;t<e;){const n=me(r,t);if(n>8&&r[t+4]===109&&r[t+5]===111&&r[t+6]===111&&r[t+7]===102)return!0;t=n>1?t+n:e}return!1}function xe(r,e){const t=[];if(!e.length)return t;const n=r.byteLength;for(let i=0;i<n;){const s=me(r,i),o=ct(r.subarray(i+4,i+8)),a=s>1?i+s:n;if(o===e[0])if(e.length===1)t.push(r.subarray(i+8,a));else{const l=xe(r.subarray(i+8,a),e.slice(1));l.length&&pm.apply(t,l)}i=a}return t}function Em(r){const e=[],t=r[0];let n=8;const i=me(r,n);n+=4;let s=0,o=0;t===0?(s=me(r,n),o=me(r,n+4),n+=8):(s=kc(r,n),o=kc(r,n+8),n+=16),n+=2;let a=r.length+o;const l=Fc(r,n);n+=2;for(let A=0;A<l;A++){let c=n;const u=me(r,c);c+=4;const h=u&2147483647;if((u&2147483648)>>>31===1)return U.warn("SIDX has hierarchical references (not supported)"),null;const f=me(r,c);c+=4,e.push({referenceSize:h,subsegmentDuration:f,info:{duration:f/i,start:a,end:a+h-1}}),a+=h,c+=4,n=c}return{earliestPresentationTime:s,timescale:i,version:t,referencesCount:l,references:e}}function Mc(r){const e=[],t=xe(r,["moov","trak"]);for(let i=0;i<t.length;i++){const s=t[i],o=xe(s,["tkhd"])[0];if(o){let a=o[0];const l=me(o,a===0?12:20),A=xe(s,["mdia","mdhd"])[0];if(A){a=A[0];const c=me(A,a===0?12:20),u=xe(s,["mdia","hdlr"])[0];if(u){const h=ct(u.subarray(8,12)),d={soun:He.AUDIO,vide:He.VIDEO}[h];if(d){const f=xe(s,["mdia","minf","stbl","stsd"])[0],g=Im(f);e[l]={timescale:c,type:d},e[d]=ht({timescale:c,id:l},g)}}}}}return xe(r,["moov","mvex","trex"]).forEach(i=>{const s=me(i,4),o=e[s];o&&(o.default={duration:me(i,12),flags:me(i,20)})}),e}function Im(r){const e=r.subarray(8),t=e.subarray(86),n=ct(e.subarray(4,8));let i=n;const s=n==="enca"||n==="encv";if(s){const a=xe(e,[n])[0].subarray(n==="enca"?28:78);xe(a,["sinf"]).forEach(A=>{const c=xe(A,["schm"])[0];if(c){const u=ct(c.subarray(4,8));if(u==="cbcs"||u==="cenc"){const h=xe(A,["frma"])[0];h&&(i=ct(h))}}})}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const o=xe(t,["avcC"])[0];i+="."+ds(o[1])+ds(o[2])+ds(o[3]);break}case"mp4a":{const o=xe(e,[n])[0],a=xe(o.subarray(28),["esds"])[0];if(a&&a.length>12){let l=4;if(a[l++]!==3)break;l=oa(a,l),l+=2;const A=a[l++];if(A&128&&(l+=2),A&64&&(l+=a[l++]),a[l++]!==4)break;l=oa(a,l);const c=a[l++];if(c===64)i+="."+ds(c);else break;if(l+=12,a[l++]!==5)break;l=oa(a,l);const u=a[l++];let h=(u&248)>>3;h===31&&(h+=1+((u&7)<<3)+((a[l]&224)>>5)),i+="."+h}break}case"hvc1":case"hev1":{const o=xe(t,["hvcC"])[0],a=o[1],l=["","A","B","C"][a>>6],A=a&31,c=me(o,2),u=(a&32)>>5?"H":"L",h=o[12],d=o.subarray(6,12);i+="."+l+A,i+="."+c.toString(16).toUpperCase(),i+="."+u+h;let f="";for(let g=d.length;g--;){const p=d[g];(p||f)&&(f="."+p.toString(16).toUpperCase()+f)}i+=f;break}case"dvh1":case"dvhe":{const o=xe(t,["dvcC"])[0],a=o[2]>>1&127,l=o[2]<<5&32|o[3]>>3&31;i+="."+lr(a)+"."+lr(l);break}case"vp09":{const o=xe(t,["vpcC"])[0],a=o[4],l=o[5],A=o[6]>>4&15;i+="."+lr(a)+"."+lr(l)+"."+lr(A);break}case"av01":{const o=xe(t,["av1C"])[0],a=o[1]>>>5,l=o[1]&31,A=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,f=(o[2]&8)>>3,g=(o[2]&4)>>2,p=o[2]&3;i+="."+a+"."+lr(l)+A+"."+lr(h)+"."+d+"."+f+g+p+"."+lr(1)+"."+lr(1)+"."+lr(1)+"."+0;break}}return{codec:i,encrypted:s}}function oa(r,e){const t=e+5;for(;r[e++]&128&&e<t;);return e}function ds(r){return("0"+r.toString(16).toUpperCase()).slice(-2)}function lr(r){return(r<10?"0":"")+r}function vm(r,e){if(!r||!e)return r;const t=e.keyId;return t&&e.isCommonEncryption&&xe(r,["moov","trak"]).forEach(i=>{const o=xe(i,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=xe(o,["enca"]);const l=a.length>0;l||(a=xe(o,["encv"])),a.forEach(A=>{const c=l?A.subarray(28):A.subarray(78);xe(c,["sinf"]).forEach(h=>{const d=Pc(h);if(d){const f=d.subarray(8,24);f.some(g=>g!==0)||(U.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${ar.hexDump(f)} -> ${ar.hexDump(t)}`),d.set(t,8))}})})}),r}function Pc(r){const e=xe(r,["schm"])[0];if(e){const t=ct(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return xe(r,["schi","tenc"])[0]}return U.error("[eme] missing 'schm' box"),null}function Cm(r,e){return xe(e,["moof","traf"]).reduce((t,n)=>{const i=xe(n,["tfdt"])[0],s=i[0],o=xe(n,["tfhd"]).reduce((a,l)=>{const A=me(l,4),c=r[A];if(c){let u=me(i,4);if(s===1){if(u===hs)return U.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;u*=hs+1,u+=me(i,8)}const h=c.timescale||9e4,d=u/h;if(he(d)&&(a===null||d<a))return d}return a},null);return o!==null&&he(o)&&(t===null||o<t)?o:t},null)}function ym(r,e){let t=0,n=0,i=0;const s=xe(r,["moof","traf"]);for(let o=0;o<s.length;o++){const a=s[o],l=xe(a,["tfhd"])[0],A=me(l,4),c=e[A];if(!c)continue;const u=c.default,h=me(l,0)|(u==null?void 0:u.flags);let d=u==null?void 0:u.duration;h&8&&(h&2?d=me(l,12):d=me(l,8));const f=c.timescale||9e4,g=xe(a,["trun"]);for(let p=0;p<g.length;p++){if(t=Bm(g[p]),!t&&d){const C=me(g[p],4);t=d*C}c.type===He.VIDEO?n+=t/f:c.type===He.AUDIO&&(i+=t/f)}}if(n===0&&i===0){let o=1/0,a=0,l=0;const A=xe(r,["sidx"]);for(let c=0;c<A.length;c++){const u=Em(A[c]);if(u!=null&&u.references){o=Math.min(o,u.earliestPresentationTime/u.timescale);const h=u.references.reduce((d,f)=>d+f.info.duration||0,0);a=Math.max(a,h+u.earliestPresentationTime/u.timescale),l=a-o}}if(l&&he(l))return l}return n||i}function Bm(r){const e=me(r,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let n=0;const i=me(r,4);for(let s=0;s<i;s++){if(e&256){const o=me(r,t);n+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return n}function Tm(r,e,t){xe(e,["moof","traf"]).forEach(n=>{xe(n,["tfhd"]).forEach(i=>{const s=me(i,4),o=r[s];if(!o)return;const a=o.timescale||9e4;xe(n,["tfdt"]).forEach(l=>{const A=l[0],c=t*a;if(c){let u=me(l,4);if(A===0)u-=c,u=Math.max(u,0),sa(l,4,u);else{u*=Math.pow(2,32),u+=me(l,8),u-=c,u=Math.max(u,0);const h=Math.floor(u/(hs+1)),d=Math.floor(u%(hs+1));sa(l,4,h),sa(l,8,d)}}})})})}function Qm(r){const e={valid:null,remainder:null},t=xe(r,["moof"]);if(t.length<2)return e.remainder=r,e;const n=t[t.length-1];return e.valid=Zr(r,0,n.byteOffset-8),e.remainder=Zr(r,n.byteOffset-8),e}function $t(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function Oc(r,e){const t=[],n=e.samples,i=e.timescale,s=e.id;let o=!1;return xe(n,["moof"]).map(l=>{const A=l.byteOffset-8;xe(l,["traf"]).map(u=>{const h=xe(u,["tfdt"]).map(d=>{const f=d[0];let g=me(d,4);return f===1&&(g*=Math.pow(2,32),g+=me(d,8)),g/i})[0];return h!==void 0&&(r=h),xe(u,["tfhd"]).map(d=>{const f=me(d,4),g=me(d,0)&16777215,p=(g&1)!==0,C=(g&2)!==0,Q=(g&8)!==0;let b=0;const y=(g&16)!==0;let w=0;const R=(g&32)!==0;let k=8;f===s&&(p&&(k+=8),C&&(k+=4),Q&&(b=me(d,k),k+=4),y&&(w=me(d,k),k+=4),R&&(k+=4),e.type==="video"&&(o=bm(e.codec)),xe(u,["trun"]).map($=>{const K=$[0],O=me($,0)&16777215,J=(O&1)!==0;let ie=0;const ee=(O&4)!==0,le=(O&256)!==0;let _=0;const P=(O&512)!==0;let X=0;const D=(O&1024)!==0,S=(O&2048)!==0;let F=0;const W=me($,4);let Y=8;J&&(ie=me($,Y),Y+=4),ee&&(Y+=4);let ne=ie+A;for(let ce=0;ce<W;ce++){if(le?(_=me($,Y),Y+=4):_=b,P?(X=me($,Y),Y+=4):X=w,D&&(Y+=4),S&&(K===0?F=me($,Y):F=Nc($,Y),Y+=4),e.type===He.VIDEO){let pe=0;for(;pe<X;){const ge=me(n,ne);if(ne+=4,xm(o,n[ne])){const Se=n.subarray(ne,ne+ge);Uc(Se,o?2:1,r+F/i,t)}ne+=ge,pe+=ge+4}}r+=_/i}}))})})}),t}function bm(r){if(!r)return!1;const e=r.indexOf("."),t=e<0?r:r.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function xm(r,e){if(r){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Uc(r,e,t,n){const i=Gc(r);let s=0;s+=e;let o=0,a=0,l=0;for(;s<i.length;){o=0;do{if(s>=i.length)break;l=i[s++],o+=l}while(l===255);a=0;do{if(s>=i.length)break;l=i[s++],a+=l}while(l===255);const A=i.length-s;let c=s;if(a<A)s+=a;else if(a>A){U.error(`Malformed SEI payload. ${a} is too small, only ${A} bytes left to parse.`);break}if(o===4){if(i[c++]===181){const h=Fc(i,c);if(c+=2,h===49){const d=me(i,c);if(c+=4,d===1195456820){const f=i[c++];if(f===3){const g=i[c++],p=31&g,C=64&g,Q=C?2+p*3:0,b=new Uint8Array(Q);if(C){b[0]=g;for(let y=1;y<Q;y++)b[y]=i[c++]}n.push({type:f,payloadType:o,pts:t,bytes:b})}}}}}else if(o===5&&a>16){const u=[];for(let f=0;f<16;f++){const g=i[c++].toString(16);u.push(g.length==1?"0"+g:g),(f===3||f===5||f===7||f===9)&&u.push("-")}const h=a-16,d=new Uint8Array(h);for(let f=0;f<h;f++)d[f]=i[c++];n.push({payloadType:o,pts:t,uuid:u.join(""),userData:or(d),userDataBytes:d})}}}function Gc(r){const e=r.byteLength,t=[];let n=1;for(;n<e-2;)r[n]===0&&r[n+1]===0&&r[n+2]===3?(t.push(n+2),n+=2):n++;if(t.length===0)return r;const i=e-t.length,s=new Uint8Array(i);let o=0;for(n=0;n<i;o++,n++)o===t[0]&&(o++,t.shift()),s[n]=r[o];return s}function wm(r){const e=r[0];let t="",n="",i=0,s=0,o=0,a=0,l=0,A=0;if(e===0){for(;ct(r.subarray(A,A+1))!=="\0";)t+=ct(r.subarray(A,A+1)),A+=1;for(t+=ct(r.subarray(A,A+1)),A+=1;ct(r.subarray(A,A+1))!=="\0";)n+=ct(r.subarray(A,A+1)),A+=1;n+=ct(r.subarray(A,A+1)),A+=1,i=me(r,12),s=me(r,16),a=me(r,20),l=me(r,24),A=28}else if(e===1){A+=4,i=me(r,A),A+=4;const u=me(r,A);A+=4;const h=me(r,A);for(A+=4,o=4294967296*u+h,Vp(o)||(o=Number.MAX_SAFE_INTEGER,U.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=me(r,A),A+=4,l=me(r,A),A+=4;ct(r.subarray(A,A+1))!=="\0";)t+=ct(r.subarray(A,A+1)),A+=1;for(t+=ct(r.subarray(A,A+1)),A+=1;ct(r.subarray(A,A+1))!=="\0";)n+=ct(r.subarray(A,A+1)),A+=1;n+=ct(r.subarray(A,A+1)),A+=1}const c=r.subarray(A,r.byteLength);return{schemeIdUri:t,value:n,timeScale:i,presentationTime:o,presentationTimeDelta:s,eventDuration:a,id:l,payload:c}}function Sm(r,...e){const t=e.length;let n=8,i=t;for(;i--;)n+=e[i].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=n&255,s.set(r,4),i=0,n=8;i<t;i++)s.set(e[i],n),n+=e[i].byteLength;return s}function Rm(r,e,t){if(r.byteLength!==16)throw new RangeError("Invalid system id");let n,i;if(e){n=1,i=new Uint8Array(e.length*16);for(let a=0;a<e.length;a++){const l=e[a];if(l.byteLength!==16)throw new RangeError("Invalid key");i.set(l,a*16)}}else n=0,i=new Uint8Array;let s;n>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),Sm([112,115,115,104],new Uint8Array([n,0,0,0]),r,s,i,o,t||new Uint8Array)}function Dm(r){if(!(r instanceof ArrayBuffer)||r.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(r),n=t.getUint32(0);if(r.byteLength!==n&&n>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=ar.hexDump(new Uint8Array(r,12,16));const s=t.getUint32(28);if(e.version===0){if(n-32<s)return null;e.data=new Uint8Array(r,32,s)}else if(e.version===1){e.kids=[];for(let o=0;o<s;o++)e.kids.push(new Uint8Array(r,32+o*16,16))}return e}let fs={};class hi{static clearKeyUriToKeyIdMap(){fs={}}constructor(e,t,n,i=[1],s=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=n,this.keyFormatVersions=i,this.iv=s,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 _t.FAIRPLAY:case _t.WIDEVINE:case _t.PLAYREADY:case _t.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&&U.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const n=_m(e);return new hi(this.method,this.uri,"identity",this.keyFormatVersions,n)}const t=im(this.uri);if(t)switch(this.keyFormat){case _t.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case _t.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Rm(n,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),s=String.fromCharCode.apply(null,Array.from(i)),o=s.substring(s.indexOf("<"),s.length),A=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(A){const c=A.childNodes[0]?A.childNodes[0].nodeValue:A.getAttribute("VALUE");if(c){const u=Zo(c).subarray(0,16);nm(u),this.keyId=u}}break}default:{let n=t.subarray(0,16);if(n.length!==16){const i=new Uint8Array(16);i.set(n,16-n.length),n=i}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n=fs[this.uri];if(!n){const i=Object.keys(fs).length%Number.MAX_SAFE_INTEGER;n=new Uint8Array(16),new DataView(n.buffer,12,4).setUint32(0,i),fs[this.uri]=n}this.keyId=n}return this}}function _m(r){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=r>>8*(15-t)&255;return e}const Hc=/\{\$([a-zA-Z0-9-_]+)\}/g;function $c(r){return Hc.test(r)}function Lt(r,e,t){if(r.variableList!==null||r.hasVariableRefs)for(let n=t.length;n--;){const i=t[n],s=e[i];s&&(e[i]=aa(r,s))}}function aa(r,e){if(r.variableList!==null||r.hasVariableRefs){const t=r.variableList;return e.replace(Hc,n=>{const i=n.substring(2,n.length-1),s=t==null?void 0:t[i];return s===void 0?(r.playlistParsingError||(r.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),n):s})}return e}function Yc(r,e,t){let n=r.variableList;n||(r.variableList=n={});let i,s;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(i))s=o.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(o){r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else i=e.NAME,s=e.VALUE;i in n?r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):n[i]=s||""}function Lm(r,e,t){const n=e.IMPORT;if(t&&n in t){let i=r.variableList;i||(r.variableList=i={}),i[n]=t[n]}else r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}function en(r=!0){return typeof self>"u"?void 0:(r||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Fm(r){return typeof self<"u"&&r===self.ManagedMediaSource}const gs={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 km(r,e){const t=gs[e];return!!t&&!!t[r.slice(0,4)]}function la(r,e,t=!0){return!r.split(",").some(n=>!Vc(n,e,t))}function Vc(r,e,t=!0){var n;const i=en(t);return(n=i==null?void 0:i.isTypeSupported(di(r,e)))!=null?n:!1}function di(r,e){return`${e}/mp4;codecs="${r}"`}function Kc(r){if(r){const e=r.substring(0,4);return gs.video[e]}return 2}function ps(r){return r.split(",").reduce((e,t)=>{const n=gs.video[t];return n?(n*2+e)/(e?3:2):(gs.audio[t]+e)/(e?2:1)},0)}const Aa={};function Nm(r,e=!0){if(Aa[r])return Aa[r];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[r];for(let n=0;n<t.length;n++)if(Vc(t[n],"audio",e))return Aa[r]=t[n],t[n];return r}const Mm=/flac|opus/i;function ms(r,e=!0){return r.replace(Mm,t=>Nm(t.toLowerCase(),e))}function Jc(r,e){return r&&r!=="mp4a"?r:e&&e.split(",")[0]}function Pm(r){const e=r.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 r}const Wc=/#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,qc=/#EXT-X-MEDIA:(.*)/g,Om=/^#EXT(?:INF|-X-TARGETDURATION):/m,Xc=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"),Um=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 Ar{static findGroup(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.id===t)return i}}static resolve(e,t){return Xo.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Om.test(e)}static parseMasterPlaylist(e,t){const n=$c(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},s=[];Wc.lastIndex=0;let o;for(;(o=Wc.exec(e))!=null;)if(o[1]){var a;const A=new Xe(o[1]);Lt(i,A,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=aa(i,o[2]),u={attrs:A,bitrate:A.decimalInteger("BANDWIDTH")||A.decimalInteger("AVERAGE-BANDWIDTH"),name:A.NAME,url:Ar.resolve(c,t)},h=A.decimalResolution("RESOLUTION");h&&(u.width=h.width,u.height=h.height),Gm(A.CODECS,u),(a=u.unknownCodecs)!=null&&a.length||s.push(u),i.levels.push(u)}else if(o[3]){const A=o[3],c=o[4];switch(A){case"SESSION-DATA":{const u=new Xe(c);Lt(i,u,["DATA-ID","LANGUAGE","VALUE","URI"]);const h=u["DATA-ID"];h&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[h]=u);break}case"SESSION-KEY":{const u=jc(c,t,i);u.encrypted&&u.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(u)):U.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const u=new Xe(c);Lt(i,u,["NAME","VALUE","QUERYPARAM"]),Yc(i,u,t)}break}case"CONTENT-STEERING":{const u=new Xe(c);Lt(i,u,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:Ar.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=zc(c);break}}}const l=s.length>0&&s.length<i.levels.length;return i.levels=l?s:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,n){let i;const s={},o=n.levels,a={AUDIO:o.map(A=>({id:A.attrs.AUDIO,audioCodec:A.audioCodec})),SUBTITLES:o.map(A=>({id:A.attrs.SUBTITLES,textCodec:A.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(qc.lastIndex=0;(i=qc.exec(e))!==null;){const A=new Xe(i[1]),c=A.TYPE;if(c){const u=a[c],h=s[c]||[];s[c]=h,Lt(n,A,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=A.LANGUAGE,f=A["ASSOC-LANGUAGE"],g=A.CHANNELS,p=A.CHARACTERISTICS,C=A["INSTREAM-ID"],Q={attrs:A,bitrate:0,id:l++,groupId:A["GROUP-ID"]||"",name:A.NAME||d||"",type:c,default:A.bool("DEFAULT"),autoselect:A.bool("AUTOSELECT"),forced:A.bool("FORCED"),lang:d,url:A.URI?Ar.resolve(A.URI,t):""};if(f&&(Q.assocLang=f),g&&(Q.channels=g),p&&(Q.characteristics=p),C&&(Q.instreamId=C),u!=null&&u.length){const b=Ar.findGroup(u,Q.groupId)||u[0];Zc(Q,b,"audioCodec"),Zc(Q,b,"textCodec")}h.push(Q)}}return s}static parseLevelPlaylist(e,t,n,i,s,o){const a=new tm(t),l=a.fragments;let A=null,c=0,u=0,h=0,d=0,f=null,g=new zo(i,t),p,C,Q,b=-1,y=!1,w=null;for(Xc.lastIndex=0,a.m3u8=e,a.hasVariableRefs=$c(e);(p=Xc.exec(e))!==null;){y&&(y=!1,g=new zo(i,t),g.start=h,g.sn=c,g.cc=d,g.level=n,A&&(g.initSegment=A,g.rawProgramDateTime=A.rawProgramDateTime,A.rawProgramDateTime=null,w&&(g.setByteRange(w),w=null)));const K=p[1];if(K){g.duration=parseFloat(K);const O=(" "+p[2]).slice(1);g.title=O||null,g.tagList.push(O?["INF",K,O]:["INF",K])}else if(p[3]){if(he(g.duration)){g.start=h,Q&&ru(g,Q,a),g.sn=c,g.level=n,g.cc=d,l.push(g);const O=(" "+p[3]).slice(1);g.relurl=aa(a,O),eu(g,f),f=g,h+=g.duration,c++,u=0,y=!0}}else if(p[4]){const O=(" "+p[4]).slice(1);f?g.setByteRange(O,f):g.setByteRange(O)}else if(p[5])g.rawProgramDateTime=(" "+p[5]).slice(1),g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]),b===-1&&(b=l.length);else{if(p=p[0].match(Um),!p){U.warn("No matches on slow regex match for level playlist!");continue}for(C=1;C<p.length&&!(typeof p[C]<"u");C++);const O=(" "+p[C]).slice(1),J=(" "+p[C+1]).slice(1),ie=p[C+2]?(" "+p[C+2]).slice(1):"";switch(O){case"PLAYLIST-TYPE":a.type=J.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(J);break;case"SKIP":{const ee=new Xe(J);Lt(a,ee,["RECENTLY-REMOVED-DATERANGES"]);const le=ee.decimalInteger("SKIPPED-SEGMENTS");if(he(le)){a.skippedSegments=le;for(let P=le;P--;)l.unshift(null);c+=le}const _=ee.enumeratedString("RECENTLY-REMOVED-DATERANGES");_&&(a.recentlyRemovedDateranges=_.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(J),1);break;case"VERSION":a.version=parseInt(J);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(J||ie)&&g.tagList.push(ie?[J,ie]:[J]);break;case"DISCONTINUITY":d++,g.tagList.push(["DIS"]);break;case"GAP":g.gap=!0,g.tagList.push([O]);break;case"BITRATE":g.tagList.push([O,J]);break;case"DATERANGE":{const ee=new Xe(J);Lt(a,ee,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Lt(a,ee,ee.clientAttrs);const le=new Tc(ee,a.dateRanges[ee.ID]);le.isValid||a.skippedSegments?a.dateRanges[le.id]=le:U.warn(`Ignoring invalid DATERANGE tag: "${J}"`),g.tagList.push(["EXT-X-DATERANGE",J]);break}case"DEFINE":{{const ee=new Xe(J);Lt(a,ee,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in ee?Lm(a,ee,o):Yc(a,ee,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(J);break;case"KEY":{const ee=jc(J,t,a);if(ee.isSupported()){if(ee.method==="NONE"){Q=void 0;break}Q||(Q={}),Q[ee.keyFormat]&&(Q=it({},Q)),Q[ee.keyFormat]=ee}else U.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${J}"`);break}case"START":a.startTimeOffset=zc(J);break;case"MAP":{const ee=new Xe(J);if(Lt(a,ee,["BYTERANGE","URI"]),g.duration){const le=new zo(i,t);tu(le,ee,n,Q),A=le,g.initSegment=A,A.rawProgramDateTime&&!g.rawProgramDateTime&&(g.rawProgramDateTime=A.rawProgramDateTime)}else{const le=g.byteRangeEndOffset;if(le){const _=g.byteRangeStartOffset;w=`${le-_}@${_}`}else w=null;tu(g,ee,n,Q),A=g,y=!0}break}case"SERVER-CONTROL":{const ee=new Xe(J);a.canBlockReload=ee.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=ee.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&ee.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=ee.optionalFloat("PART-HOLD-BACK",0),a.holdBack=ee.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const ee=new Xe(J);a.partTarget=ee.decimalFloatingPoint("PART-TARGET");break}case"PART":{let ee=a.partList;ee||(ee=a.partList=[]);const le=u>0?ee[ee.length-1]:void 0,_=u++,P=new Xe(J);Lt(a,P,["BYTERANGE","URI"]);const X=new Zp(P,g,t,_,le);ee.push(X),g.duration+=X.duration;break}case"PRELOAD-HINT":{const ee=new Xe(J);Lt(a,ee,["URI"]),a.preloadHint=ee;break}case"RENDITION-REPORT":{const ee=new Xe(J);Lt(a,ee,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(ee);break}default:U.warn(`line parsed but not handled: ${p}`);break}}}f&&!f.relurl?(l.pop(),h-=f.duration,a.partList&&(a.fragmentHint=f)):a.partList&&(eu(g,f),g.cc=d,a.fragmentHint=g,Q&&ru(g,Q,a));const R=l.length,k=l[0],$=l[R-1];if(h+=a.skippedSegments*a.targetduration,h>0&&R&&$){a.averagetargetduration=h/R;const K=$.sn;a.endSN=K!=="initSegment"?K:0,a.live||($.endList=!0),k&&(a.startCC=k.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(h+=a.fragmentHint.duration),a.totalduration=h,a.endCC=d,b>0&&Hm(l,b),a}}function jc(r,e,t){var n,i;const s=new Xe(r);Lt(t,s,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(n=s.METHOD)!=null?n:"",a=s.URI,l=s.hexadecimalInteger("IV"),A=s.KEYFORMATVERSIONS,c=(i=s.KEYFORMAT)!=null?i:"identity";a&&s.IV&&!l&&U.error(`Invalid IV: ${s.IV}`);const u=a?Ar.resolve(a,e):"",h=(A||"1").split("/").map(Number).filter(Number.isFinite);return new hi(o,u,c,h,l)}function zc(r){const t=new Xe(r).decimalFloatingPoint("TIME-OFFSET");return he(t)?t:null}function Gm(r,e){let t=(r||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const i=t.filter(s=>km(s,n));i.length&&(e[`${n}Codec`]=i.join(","),t=t.filter(s=>i.indexOf(s)===-1))}),e.unknownCodecs=t}function Zc(r,e,t){const n=e[t];n&&(r[t]=n)}function Hm(r,e){let t=r[e];for(let n=e;n--;){const i=r[n];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function eu(r,e){r.rawProgramDateTime?r.programDateTime=Date.parse(r.rawProgramDateTime):e!=null&&e.programDateTime&&(r.programDateTime=e.endProgramDateTime),he(r.programDateTime)||(r.programDateTime=null,r.rawProgramDateTime=null)}function tu(r,e,t,n){r.relurl=e.URI,e.BYTERANGE&&r.setByteRange(e.BYTERANGE),r.level=t,r.sn="initSegment",n&&(r.levelkeys=n),r.initSegment=null}function ru(r,e,t){r.levelkeys=e;const{encryptedFragments:n}=t;(!n.length||n[n.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&n.push(r)}var Oe={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ee={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function nu(r){const{type:e}=r;switch(e){case Oe.AUDIO_TRACK:return Ee.AUDIO;case Oe.SUBTITLE_TRACK:return Ee.SUBTITLE;default:return Ee.MAIN}}function ca(r,e){let t=r.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class $m{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,n=t.pLoader,i=t.loader,s=n||i,o=new s(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:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Oe.MANIFEST,url:n,deliveryDirectives:null})}onLevelLoading(e,t){const{id:n,level:i,pathwayId:s,url:o,deliveryDirectives:a}=t;this.load({id:n,level:i,pathwayId:s,responseType:"text",type:Oe.LEVEL,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:Oe.AUDIO_TRACK,url:s,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:Oe.SUBTITLE_TRACK,url:s,deliveryDirectives:o})}load(e){var t;const n=this.hls.config;let i=this.getInternalLoader(e);if(i){const A=i.context;if(A&&A.url===e.url&&A.level===e.level){U.trace("[playlist-loader]: playlist request ongoing");return}U.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let s;if(e.type===Oe.MANIFEST?s=n.manifestLoadPolicy.default:s=it({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),he((t=e.deliveryDirectives)==null?void 0:t.part)){let A;if(e.type===Oe.LEVEL&&e.level!==null?A=this.hls.levels[e.level].details:e.type===Oe.AUDIO_TRACK&&e.id!==null?A=this.hls.audioTracks[e.id].details:e.type===Oe.SUBTITLE_TRACK&&e.id!==null&&(A=this.hls.subtitleTracks[e.id].details),A){const c=A.partTarget,u=A.targetduration;if(c&&u){const h=Math.max(c*3,u*.8)*1e3;s=it({},s,{maxTimeToFirstByteMs:Math.min(h,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,s.maxTimeToFirstByteMs)})}}}const o=s.errorRetry||s.timeoutRetry||{},a={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},l={onSuccess:(A,c,u,h)=>{const d=this.getInternalLoader(u);this.resetInternalLoader(u.type);const f=A.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(A,u,new Error("no EXTM3U delimiter"),h||null,c);return}c.parsing.start=performance.now(),Ar.isMediaPlaylist(f)?this.handleTrackOrLevelPlaylist(A,c,u,h||null,d):this.handleMasterPlaylist(A,c,u,h)},onError:(A,c,u,h)=>{this.handleNetworkError(c,u,!1,A,h)},onTimeout:(A,c,u)=>{this.handleNetworkError(c,u,!0,void 0,A)}};i.load(e,a,l)}handleMasterPlaylist(e,t,n,i){const s=this.hls,o=e.data,a=ca(e,n),l=Ar.parseMasterPlaylist(o,a);if(l.playlistParsingError){this.handleManifestParsingError(e,n,l.playlistParsingError,i,t);return}const{contentSteering:A,levels:c,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:f}=l;this.variableList=f;const{AUDIO:g=[],SUBTITLES:p,"CLOSED-CAPTIONS":C}=Ar.parseMasterPlaylistMedia(o,a,l);g.length&&!g.some(b=>!b.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(U.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Xe({}),bitrate:0,url:""})),s.trigger(I.MANIFEST_LOADED,{levels:c,audioTracks:g,subtitles:p,captions:C,contentSteering:A,url:a,stats:t,networkDetails:i,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:f})}handleTrackOrLevelPlaylist(e,t,n,i,s){const o=this.hls,{id:a,level:l,type:A}=n,c=ca(e,n),u=0,h=he(l)?l:he(a)?a:0,d=nu(n),f=Ar.parseLevelPlaylist(e.data,c,h,d,u,this.variableList);if(A===Oe.MANIFEST){const g={attrs:new Xe({}),bitrate:0,details:f,name:"",url:c};o.trigger(I.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:c,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=f,this.handlePlaylistLoaded(f,e,t,n,i,s)}handleManifestParsingError(e,t,n,i,s){this.hls.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:V.MANIFEST_PARSING_ERROR,fatal:t.type===Oe.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:i,stats:s})}handleNetworkError(e,t,n=!1,i,s){let o=`A network ${n?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===Oe.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Oe.AUDIO_TRACK||e.type===Oe.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);U.warn(`[playlist-loader]: ${o}`);let l=V.UNKNOWN,A=!1;const c=this.getInternalLoader(e);switch(e.type){case Oe.MANIFEST:l=n?V.MANIFEST_LOAD_TIMEOUT:V.MANIFEST_LOAD_ERROR,A=!0;break;case Oe.LEVEL:l=n?V.LEVEL_LOAD_TIMEOUT:V.LEVEL_LOAD_ERROR,A=!1;break;case Oe.AUDIO_TRACK:l=n?V.AUDIO_TRACK_LOAD_TIMEOUT:V.AUDIO_TRACK_LOAD_ERROR,A=!1;break;case Oe.SUBTITLE_TRACK:l=n?V.SUBTITLE_TRACK_LOAD_TIMEOUT:V.SUBTITLE_LOAD_ERROR,A=!1;break}c&&this.resetInternalLoader(e.type);const u={type:Be.NETWORK_ERROR,details:l,fatal:A,url:e.url,loader:c,context:e,error:a,networkDetails:t,stats:s};if(i){const h=(t==null?void 0:t.url)||e.url;u.response=ht({url:h,data:void 0},i)}this.hls.trigger(I.ERROR,u)}handlePlaylistLoaded(e,t,n,i,s,o){const a=this.hls,{type:l,level:A,id:c,groupId:u,deliveryDirectives:h}=i,d=ca(t,i),f=nu(i),g=typeof i.level=="number"&&f===Ee.MAIN?A:void 0;if(!e.fragments.length){const C=new Error("No Segments found in Playlist");a.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:V.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:C,reason:C.message,response:t,context:i,level:g,parent:f,networkDetails:s,stats:n});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const p=e.playlistParsingError;if(p){a.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:V.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:p,reason:p.message,response:t,context:i,level:g,parent:f,networkDetails:s,stats:n});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case Oe.MANIFEST:case Oe.LEVEL:a.trigger(I.LEVEL_LOADED,{details:e,level:g||0,id:c||0,stats:n,networkDetails:s,deliveryDirectives:h});break;case Oe.AUDIO_TRACK:a.trigger(I.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break;case Oe.SUBTITLE_TRACK:a.trigger(I.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break}}}function iu(r,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=r,e.dispatchEvent(t)}function su(r,e){const t=r.mode;if(t==="disabled"&&(r.mode="hidden"),r.cues&&!r.cues.getCueById(e.id))try{if(r.addCue(e),!r.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(n){U.debug(`[texttrack-utils]: ${n}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,r.addCue(i)}catch(i){U.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(r.mode=t)}function Cn(r){const e=r.mode;if(e==="disabled"&&(r.mode="hidden"),r.cues)for(let t=r.cues.length;t--;)r.removeCue(r.cues[t]);e==="disabled"&&(r.mode=e)}function ua(r,e,t,n){const i=r.mode;if(i==="disabled"&&(r.mode="hidden"),r.cues&&r.cues.length>0){const s=Vm(r.cues,e,t);for(let o=0;o<s.length;o++)(!n||n(s[o]))&&r.removeCue(s[o])}i==="disabled"&&(r.mode=i)}function Ym(r,e){if(e<r[0].startTime)return 0;const t=r.length-1;if(e>r[t].endTime)return-1;let n=0,i=t;for(;n<=i;){const s=Math.floor((i+n)/2);if(e<r[s].startTime)i=s-1;else if(e>r[s].startTime&&n<t)n=s+1;else return s}return r[n].startTime-e<e-r[i].startTime?n:i}function Vm(r,e,t){const n=[],i=Ym(r,e);if(i>-1)for(let s=i,o=r.length;s<o;s++){const a=r[s];if(a.startTime>=e&&a.endTime<=t)n.push(a);else if(a.startTime>t)return n}return n}function Es(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(r[t])}return e}var zt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const Km=.25;function ha(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function ou(r,e,t,n,i){let s=new r(e,t,"");try{s.value=n,i&&(s.type=i)}catch{s=new r(e,t,JSON.stringify(i?ht({type:i},n):n))}return s}const Is=(()=>{const r=ha();try{r&&new r(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function da(r,e){return r.getTime()/1e3-e}function Jm(r){return Uint8Array.from(r.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Wm{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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Cn(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 n=e[t];if(n.kind==="metadata"&&n.label==="id3")return iu(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:n,enableID3MetadataCues:i}}}=this;if(!n&&!i)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=ha();if(o)for(let a=0;a<s.length;a++){const l=s[a].type;if(l===zt.emsg&&!n||!i)continue;const A=_c(s[a].data);if(A){const c=s[a].pts;let u=c+s[a].duration;u>Is&&(u=Is),u-c<=0&&(u=c+Km);for(let d=0;d<A.length;d++){const f=A[d];if(!Dc(f)){this.updateId3CueEnds(c,l);const g=ou(o,c,u,f,l);g&&this.id3Track.addCue(g)}}}}}updateId3CueEnds(e,t){var n;const i=(n=this.id3Track)==null?void 0:n.cues;if(i)for(let s=i.length;s--;){const o=i[s];o.type===t&&o.startTime<e&&o.endTime===Is&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:i}){const{id3Track:s,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:l}}=o;if(s&&(a||l)){let A;i==="audio"?A=c=>c.type===zt.audioId3&&l:i==="video"?A=c=>c.type===zt.emsg&&a:A=c=>c.type===zt.audioId3&&l||c.type===zt.emsg&&a,ua(s,t,n,A)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:n,id3Track:i}=this,{dateRanges:s}=t,o=Object.keys(s);if(i){const c=Object.keys(n).filter(u=>!o.includes(u));for(let u=c.length;u--;){const h=c[u];Object.keys(n[h].cues).forEach(d=>{i.removeCue(n[h].cues[d])}),delete n[h]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!he(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=a.programDateTime/1e3-a.start,A=ha();for(let c=0;c<o.length;c++){const u=o[c],h=s[u],d=da(h.startDate,l),f=n[u],g=(f==null?void 0:f.cues)||{};let p=(f==null?void 0:f.durationKnown)||!1,C=Is;const Q=h.endDate;if(Q)C=da(Q,l),p=!0;else if(h.endOnNext&&!p){const y=o.reduce((w,R)=>{if(R!==h.id){const k=s[R];if(k.class===h.class&&k.startDate>h.startDate&&(!w||h.startDate<w.startDate))return k}return w},null);y&&(C=da(y.startDate,l),p=!0)}const b=Object.keys(h.attr);for(let y=0;y<b.length;y++){const w=b[y];if(!jp(w))continue;const R=g[w];if(R)p&&!f.durationKnown&&(R.endTime=C);else if(A){let k=h.attr[w];zp(w)&&(k=Jm(k));const $=ou(A,d,C,{key:w,data:k},zt.dateRange);$&&($.id=u,this.id3Track.addCue($),g[w]=$)}}n[u]={cues:g,dateRange:h,durationKnown:p}}}}class qm{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:n,targetduration:i}=e,{liveSyncDuration:s,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,l=this.hls.userConfig;let A=a&&n||t;(l.liveSyncDuration||l.liveSyncDurationCount||A===0)&&(A=s!==void 0?s:o*i);const c=i;return A+Math.min(this.stallCount*1,c)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,n=this.levelDetails;if(e===null||t===null||n===null)return null;const i=n.edge,s=e-t-this.edgeStalled,o=i-n.totalduration,a=i-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(o,s),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 n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(I.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 n;t.details===V.BUFFER_STALLED_ERROR&&(this.stallCount++,(n=this.levelDetails)!=null&&n.live&&U.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 n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:s}=this.config;if(!i||s===1||!t.live)return;const o=this.targetLatency;if(o===null)return;const a=n-o,l=Math.min(this.maxLatency,o+t.targetduration);if(a<l&&a>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,s)),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 fa=["NONE","TYPE-0","TYPE-1",null];function Xm(r){return fa.indexOf(r)>-1}const vs=["SDR","PQ","HLG"];function jm(r){return!!r&&vs.indexOf(r)>-1}var Cs={No:"",Yes:"YES",v2:"v2"};function au(r){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=r,i=n<e/2;return e&&i?t?Cs.v2:Cs.Yes:Cs.No}class lu{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}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 yn{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 Au(this._audioGroups,e)}hasSubtitleGroup(e){return Au(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(t)===-1&&n.push(t)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(t)===-1&&n.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 Au(r,e){return!e||!r?!1:r.indexOf(e)!==-1}function ga(r,e){const t=e.startPTS;if(he(t)){let n=0,i;e.sn>r.sn?(n=t-r.start,i=r):(n=r.start-t,i=e),i.duration!==n&&(i.duration=n)}else e.sn>r.sn?r.cc===e.cc&&r.minEndPTS?e.start=r.start+(r.minEndPTS-r.start):e.start=r.start+r.duration:e.start=Math.max(r.start-e.duration,0)}function cu(r,e,t,n,i,s){n-t<=0&&(U.warn("Fragment should have a positive duration",e),n=t+e.duration,s=i+e.duration);let a=t,l=n;const A=e.startPTS,c=e.endPTS;if(he(A)){const p=Math.abs(A-t);he(e.deltaPTS)?e.deltaPTS=Math.max(p,e.deltaPTS):e.deltaPTS=p,a=Math.max(t,A),t=Math.min(t,A),i=Math.min(i,e.startDTS),l=Math.min(n,c),n=Math.max(n,c),s=Math.max(s,e.endDTS)}const u=t-e.start;e.start!==0&&(e.start=t),e.duration=n-e.start,e.startPTS=t,e.maxStartPTS=a,e.startDTS=i,e.endPTS=n,e.minEndPTS=l,e.endDTS=s;const h=e.sn;if(!r||h<r.startSN||h>r.endSN)return 0;let d;const f=h-r.startSN,g=r.fragments;for(g[f]=e,d=f;d>0;d--)ga(g[d],g[d-1]);for(d=f;d<g.length-1;d++)ga(g[d],g[d+1]);return r.fragmentHint&&ga(g[g.length-1],r.fragmentHint),r.PTSKnown=r.alignedSliding=!0,u}function zm(r,e){let t=null;const n=r.fragments;for(let l=n.length-1;l>=0;l--){const A=n[l].initSegment;if(A){t=A;break}}r.fragmentHint&&delete r.fragmentHint.endPTS;let i=0,s;if(tE(r,e,(l,A)=>{l.relurl&&(i=l.cc-A.cc),he(l.startPTS)&&he(l.endPTS)&&(A.start=A.startPTS=l.startPTS,A.startDTS=l.startDTS,A.maxStartPTS=l.maxStartPTS,A.endPTS=l.endPTS,A.endDTS=l.endDTS,A.minEndPTS=l.minEndPTS,A.duration=l.endPTS-l.startPTS,A.duration&&(s=A),e.PTSKnown=e.alignedSliding=!0),A.elementaryStreams=l.elementaryStreams,A.loader=l.loader,A.stats=l.stats,l.initSegment&&(A.initSegment=l.initSegment,t=l.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(A=>{var c;A&&(!A.initSegment||A.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(A.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(l=>!l),e.deltaUpdateFailed){U.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let l=e.skippedSegments;l--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=Zm(r.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(i){U.warn("discontinuity sliding from playlist, take drift into account");for(let l=0;l<o.length;l++)o[l].cc+=i}e.skippedSegments&&(e.startCC=e.fragments[0].cc),eE(r.partList,e.partList,(l,A)=>{A.elementaryStreams=l.elementaryStreams,A.stats=l.stats}),s?cu(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):uu(r,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=r.driftStartTime,e.driftStart=r.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const l=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=l),e.driftEndTime=a,e.driftEnd=l}else e.driftEndTime=r.driftEndTime,e.driftEnd=r.driftEnd,e.advancedDateTime=r.advancedDateTime}function Zm(r,e,t){const n=it({},r);return t&&t.forEach(i=>{delete n[i]}),Object.keys(e).forEach(i=>{const s=new Tc(e[i].attr,n[i]);s.isValid?n[i]=s:U.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[i].attr)}"`)}),n}function eE(r,e,t){if(r&&e){let n=0;for(let i=0,s=r.length;i<=s;i++){const o=r[i],a=e[i+n];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):n--}}}function tE(r,e,t){const n=e.skippedSegments,i=Math.max(r.startSN,e.startSN)-e.startSN,s=(r.fragmentHint?1:0)+(n?e.endSN:Math.min(r.endSN,e.endSN))-e.startSN,o=e.startSN-r.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments;for(let A=i;A<=s;A++){const c=l[o+A];let u=a[A];n&&!u&&A<n&&(u=e.fragments[A]=c),c&&u&&t(c,u)}}function uu(r,e){const t=e.startSN+e.skippedSegments-r.startSN,n=r.fragments;t<0||t>=n.length||pa(e,n[t].start)}function pa(r,e){if(e){const t=r.fragments;for(let n=r.skippedSegments;n<t.length;n++)t[n].start+=e;r.fragmentHint&&(r.fragmentHint.start+=e)}}function rE(r,e=1/0){let t=1e3*r.targetduration;if(r.updated){const n=r.fragments;if(n.length&&t*4>e){const s=n[n.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function nE(r,e,t){if(!(r!=null&&r.details))return null;const n=r.details;let i=n.fragments[e-n.startSN];return i||(i=n.fragmentHint,i&&i.sn===e)?i:e<n.startSN&&t&&t.sn===e?t:null}function hu(r,e,t){var n;return r!=null&&r.details?du((n=r.details)==null?void 0:n.partList,e,t):null}function du(r,e,t){if(r)for(let n=r.length;n--;){const i=r[n];if(i.index===t&&i.fragment.sn===e)return i}return null}function fu(r){r.forEach((e,t)=>{const{details:n}=e;n!=null&&n.fragments&&n.fragments.forEach(i=>{i.level=t})})}function ys(r){switch(r.details){case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_TIMEOUT:case V.LEVEL_LOAD_TIMEOUT:case V.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function gu(r,e){const t=ys(e);return r.default[`${t?"timeout":"error"}Retry`]}function ma(r,e){const t=r.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*r.retryDelayMs,r.maxRetryDelayMs)}function pu(r){return ht(ht({},r),{errorRetry:null,timeoutRetry:null})}function Bs(r,e,t,n){if(!r)return!1;const i=n==null?void 0:n.code,s=e<r.maxNumRetry&&(iE(i)||!!t);return r.shouldRetry?r.shouldRetry(r,e,t,n,s):s}function iE(r){return r===0&&navigator.onLine===!1||!!r&&(r<400||r>499)}const mu={search:function(r,e){let t=0,n=r.length-1,i=null,s=null;for(;t<=n;){i=(t+n)/2|0,s=r[i];const o=e(s);if(o>0)t=i+1;else if(o<0)n=i-1;else return s}return null}};function sE(r,e,t){if(e===null||!Array.isArray(r)||!r.length||!he(e))return null;const n=r[0].programDateTime;if(e<(n||0))return null;const i=r[r.length-1].endProgramDateTime;if(e>=(i||0))return null;t=t||0;for(let s=0;s<r.length;++s){const o=r[s];if(aE(e,t,o))return o}return null}function Ts(r,e,t=0,n=0,i=.005){let s=null;if(r){s=e[r.sn-e[0].sn+1]||null;const a=r.endDTS-t;a>0&&a<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!r||r.level===s.level)&&Ea(t,n,s)===0||oE(s,r,Math.min(i,n))))return s;const o=mu.search(e,Ea.bind(null,t,n));return o&&(o!==r||!s)?o:s}function oE(r,e,t){if(e&&e.start===0&&e.level<r.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((i,s)=>(s[0]==="INF"&&(i+=parseFloat(s[1])),i),t);return r.start<=n}return!1}function Ea(r=0,e=0,t){if(t.start<=r&&t.start+t.duration>r)return 0;const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-n<=r?1:t.start-n>r&&t.start?-1:0}function aE(r,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>r}function lE(r,e){return mu.search(r,t=>t.cc<e?1:t.cc>e?-1:0)}var Bt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Zt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class AE{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=U.log.bind(U,"[info]:"),this.warn=U.warn.bind(U,"[warning]:"),this.error=U.error.bind(U,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(I.ERROR,this.onError,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(I.ERROR,this.onError,this),e.off(I.ERROR,this.onErrorOut,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===Ee.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var n,i;if(t.fatal)return;const s=this.hls,o=t.context;switch(t.details){case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case V.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction={action:Bt.DoNothing,flags:Zt.None};return}case V.FRAG_GAP:case V.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Bt.SendAlternateToPenaltyBox;return}case V.LEVEL_EMPTY_ERROR:case V.LEVEL_PARSING_ERROR:{var a,l;const A=t.parent===Ee.MAIN?t.level:s.loadLevel;t.details===V.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(l=a.levelDetails)!=null&&l.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,A):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,A))}return;case V.LEVEL_LOAD_ERROR:case V.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case V.AUDIO_TRACK_LOAD_ERROR:case V.AUDIO_TRACK_LOAD_TIMEOUT:case V.SUBTITLE_LOAD_ERROR:case V.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const A=s.levels[s.loadLevel];if(A&&(o.type===Oe.AUDIO_TRACK&&A.hasAudioGroup(o.groupId)||o.type===Oe.SUBTITLE_TRACK&&A.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.loadLevel),t.errorAction.action=Bt.SendAlternateToPenaltyBox,t.errorAction.flags=Zt.MoveAllAlternatesMatchingHost;return}}return;case V.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const A=s.levels[s.loadLevel],c=A==null?void 0:A.attrs["HDCP-LEVEL"];c?t.errorAction={action:Bt.SendAlternateToPenaltyBox,flags:Zt.MoveAllAlternatesMatchingHDCP,hdcpLevel:c}:this.keySystemError(t)}return;case V.BUFFER_ADD_CODEC_ERROR:case V.REMUX_ALLOC_ERROR:case V.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:s.loadLevel);return;case V.INTERNAL_EXCEPTION:case V.BUFFER_APPENDING_ERROR:case V.BUFFER_FULL_ERROR:case V.LEVEL_SWITCH_ERROR:case V.BUFFER_STALLED_ERROR:case V.BUFFER_SEEK_OVER_HOLE:case V.BUFFER_NUDGE_ON_STALL:t.errorAction={action:Bt.DoNothing,flags:Zt.None};return}t.type===Be.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 n=this.hls,i=gu(n.config.playlistLoadPolicy,e),s=this.playlistError++;if(Bs(i,s,ys(e),e.response))return{action:Bt.RetryRequest,flags:Zt.None,retryConfig:i,retryCount:s};const a=this.getLevelSwitchAction(e,t);return i&&(a.retryConfig=i,a.retryCount=s),a}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),i=t.levels[n],{fragLoadPolicy:s,keyLoadPolicy:o}=t.config,a=gu(e.details.startsWith("key")?o:s,e),l=t.levels.reduce((c,u)=>c+u.fragmentError,0);if(i&&(e.details!==V.FRAG_GAP&&i.fragmentError++,Bs(a,l,ys(e),e.response)))return{action:Bt.RetryRequest,flags:Zt.None,retryConfig:a,retryCount:l};const A=this.getLevelSwitchAction(e,n);return a&&(A.retryConfig=a,A.retryCount=l),A}getLevelSwitchAction(e,t){const n=this.hls;t==null&&(t=n.loadLevel);const i=this.hls.levels[t];if(i){var s,o;const A=e.details;i.loadError++,A===V.BUFFER_APPEND_ERROR&&i.fragmentError++;let c=-1;const{levels:u,loadLevel:h,minAutoLevel:d,maxAutoLevel:f}=n;n.autoLevelEnabled||(n.loadLevel=-1);const g=(s=e.frag)==null?void 0:s.type,C=(g===Ee.AUDIO&&A===V.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(A===V.BUFFER_ADD_CODEC_ERROR||A===V.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:R})=>i.audioCodec!==R),b=e.sourceBufferName==="video"&&(A===V.BUFFER_ADD_CODEC_ERROR||A===V.BUFFER_APPEND_ERROR)&&u.some(({codecSet:R,audioCodec:k})=>i.codecSet!==R&&i.audioCodec===k),{type:y,groupId:w}=(o=e.context)!=null?o:{};for(let R=u.length;R--;){const k=(R+h)%u.length;if(k!==h&&k>=d&&k<=f&&u[k].loadError===0){var a,l;const $=u[k];if(A===V.FRAG_GAP&&g===Ee.MAIN&&e.frag){const K=u[k].details;if(K){const O=Ts(e.frag,K.fragments,e.frag.start);if(O!=null&&O.gap)continue}}else{if(y===Oe.AUDIO_TRACK&&$.hasAudioGroup(w)||y===Oe.SUBTITLE_TRACK&&$.hasSubtitleGroup(w))continue;if(g===Ee.AUDIO&&(a=i.audioGroups)!=null&&a.some(K=>$.hasAudioGroup(K))||g===Ee.SUBTITLE&&(l=i.subtitleGroups)!=null&&l.some(K=>$.hasSubtitleGroup(K))||C&&i.audioCodec===$.audioCodec||!C&&i.audioCodec!==$.audioCodec||b&&i.codecSet===$.codecSet)continue}c=k;break}}if(c>-1&&n.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:Bt.SendAlternateToPenaltyBox,flags:Zt.None,nextAutoLevel:c}}return{action:Bt.SendAlternateToPenaltyBox,flags:Zt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case Bt.DoNothing:break;case Bt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==V.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,n=e.errorAction;if(!n)return;const{flags:i,hdcpLevel:s,nextAutoLevel:o}=n;switch(i){case Zt.None:this.switchLevel(e,o);break;case Zt.MoveAllAlternatesMatchingHDCP:s&&(t.maxHdcpLevel=fa[fa.indexOf(s)-1],n.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}n.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 Ia{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=U.log.bind(U,`${t}:`),this.warn=U.warn.bind(U,`${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,n){const i=t==null?void 0:t.renditionReports;if(i){let s=-1;for(let o=0;o<i.length;o++){const a=i[o];let l;try{l=new self.URL(a.URI,t.url).href}catch(A){U.warn(`Could not construct new URL for Rendition Report: ${A}`),l=a.URI||""}if(l===e){s=o;break}else l===e.substring(0,l.length)&&(s=o)}if(s!==-1){const o=i[s],a=parseInt(o["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let l=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);l>=0&&c>t.partTarget&&(l+=1)}const A=n&&au(n);return new lu(a,l>=0?l:void 0,A)}}}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,n){const{details:i,stats:s}=t,o=self.performance.now(),a=s.loading.first?Math.max(0,o-s.loading.first):0;if(i.advancedDateTime=Date.now()-a,i.live||n!=null&&n.live){if(i.reloaded(n),n&&this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),n&&i.fragments.length>0&&zm(n,i),!this.canLoad||!i.live)return;let l,A,c;if(i.canBlockReload&&i.endSN&&i.advanced){const p=this.hls.config.lowLatencyMode,C=i.lastPartSn,Q=i.endSN,b=i.lastPartIndex,y=b!==-1,w=C===Q,R=p?0:b;y?(A=w?Q+1:C,c=w?R:b+1):A=Q+1;const k=i.age,$=k+i.ageHeader;let K=Math.min($-i.partTarget,i.targetduration*1.5);if(K>0){if(n&&K>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${K} with playlist age: ${i.age}`),K=0;else{const O=Math.floor(K/i.targetduration);if(A+=O,c!==void 0){const J=Math.round(K%i.targetduration/i.partTarget);c+=J}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${k.toFixed(2)}s goal: ${K} skip sn ${O} to part ${c}`)}i.tuneInGoal=K}if(l=this.getDeliveryDirectives(i,t.deliveryDirectives,A,c),p||!w){this.loadPlaylist(l);return}}else(i.canBlockReload||i.canSkipUntil)&&(l=this.getDeliveryDirectives(i,t.deliveryDirectives,A,c));const u=this.hls.mainForwardBufferInfo,h=u?u.end-u.len:0,d=(i.edge-h)*1e3,f=rE(i,d);i.updated&&o>this.requestScheduled+f&&(this.requestScheduled=s.loading.start),A!==void 0&&i.canBlockReload?this.requestScheduled=s.loading.first+f-(i.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+f<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=f);let g=this.requestScheduled-o;g=Math.max(0,g),this.log(`reload live playlist ${e} in ${Math.round(g)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(l),g)}else this.clearTimer()}getDeliveryDirectives(e,t,n,i){let s=au(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,s=Cs.No),new lu(n,i,s)}checkRetry(e){const t=e.details,n=ys(e),i=e.errorAction,{action:s,retryCount:o=0,retryConfig:a}=i||{},l=!!i&&!!a&&(s===Bt.RetryRequest||!i.resolved&&s===Bt.SendAlternateToPenaltyBox);if(l){var A;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(n&&(A=e.context)!=null&&A.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const c=ma(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,i.resolved=!0}return l}}class Bn{constructor(e,t=0,n=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_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*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 cE{constructor(e,t,n,i=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_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Bn(e),this.fast_=new Bn(t),this.defaultTTFB_=i,this.ttfb_=new Bn(e)}update(e,t){const{slow_:n,fast_:i,ttfb_:s}=this;n.halfLife!==e&&(this.slow_=new Bn(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.fast_=new Bn(t,i.getEstimate(),i.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new Bn(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const n=8*t,i=e/1e3,s=n/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,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 Eu={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Iu={};function uE(r,e,t,n,i,s){const o=r.audioCodec?r.audioGroups:null,a=s==null?void 0:s.audioCodec,l=s==null?void 0:s.channels,A=l?parseInt(l):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(f=>{u[f]=(u[f]||0)+d.channels[f]})}return u},{2:0})}catch{return!0}return r.videoCodec!==void 0&&(r.width>1920&&r.height>1088||r.height>1920&&r.width>1088||r.frameRate>Math.max(n,30)||r.videoRange!=="SDR"&&r.videoRange!==t||r.bitrate>Math.max(i,8e6))||!!c&&he(A)&&Object.keys(c).some(u=>parseInt(u)>A)}function hE(r,e,t){const n=r.videoCodec,i=r.audioCodec;if(!n||!i||!t)return Promise.resolve(Eu);const s={width:r.width,height:r.height,bitrate:Math.ceil(Math.max(r.bitrate*.9,r.averageBitrate)),framerate:r.frameRate||30},o=r.videoRange;o!=="SDR"&&(s.transferFunction=o.toLowerCase());const a=n.split(",").map(l=>({type:"media-source",video:ht(ht({},s),{},{contentType:di(l,"video")})}));return i&&r.audioGroups&&r.audioGroups.forEach(l=>{var A;l&&((A=e.groups[l])==null||A.tracks.forEach(c=>{if(c.groupId===l){const u=c.channels||"",h=parseFloat(u);he(h)&&h>2&&a.push.apply(a,i.split(",").map(d=>({type:"media-source",audio:{contentType:di(d,"audio"),channels:""+h}})))}}))}),Promise.all(a.map(l=>{const A=dE(l);return Iu[A]||(Iu[A]=t.decodingInfo(l))})).then(l=>({supported:!l.some(A=>!A.supported),configurations:a,decodingInfoResults:l})).catch(l=>({supported:!1,configurations:a,decodingInfoResults:[],error:l}))}function dE(r){const{audio:e,video:t}=r,n=t||e;if(n){const i=n.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${i}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${i}`}return""}function fE(){if(typeof matchMedia=="function"){const r=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(r.media!==e.media)return r.matches===!0}return!1}function gE(r,e){let t=!1,n=[];return r&&(t=r!=="SDR",n=[r]),e&&(n=e.allowedVideoRanges||vs.slice(0),t=e.preferHDR!==void 0?e.preferHDR:fE(),t?n=n.filter(i=>i!=="SDR"):n=["SDR"]),{preferHDR:t,allowedVideoRanges:n}}function pE(r,e,t,n,i){const s=Object.keys(r),o=n==null?void 0:n.channels,a=n==null?void 0:n.audioCodec,l=o&&parseInt(o)===2;let A=!0,c=!1,u=1/0,h=1/0,d=1/0,f=0,g=[];const{preferHDR:p,allowedVideoRanges:C}=gE(e,i);for(let w=s.length;w--;){const R=r[s[w]];A=R.channels[2]>0,u=Math.min(u,R.minHeight),h=Math.min(h,R.minFramerate),d=Math.min(d,R.minBitrate);const k=C.filter($=>R.videoRanges[$]>0);k.length>0&&(c=!0,g=k)}u=he(u)?u:0,h=he(h)?h:0;const Q=Math.max(1080,u),b=Math.max(30,h);return d=he(d)?d:t,t=Math.max(d,t),c||(e=void 0,g=[]),{codecSet:s.reduce((w,R)=>{const k=r[R];if(R===w)return w;if(k.minBitrate>t)return Tr(R,`min bitrate of ${k.minBitrate} > current estimate of ${t}`),w;if(!k.hasDefaultAudio)return Tr(R,"no renditions with default or auto-select sound found"),w;if(a&&R.indexOf(a.substring(0,4))%5!==0)return Tr(R,`audio codec preference "${a}" not found`),w;if(o&&!l){if(!k.channels[o])return Tr(R,`no renditions with ${o} channel sound found (channels options: ${Object.keys(k.channels)})`),w}else if((!a||l)&&A&&k.channels[2]===0)return Tr(R,"no renditions with stereo sound found"),w;return k.minHeight>Q?(Tr(R,`min resolution of ${k.minHeight} > maximum of ${Q}`),w):k.minFramerate>b?(Tr(R,`min framerate of ${k.minFramerate} > maximum of ${b}`),w):g.some($=>k.videoRanges[$]>0)?k.maxScore<f?(Tr(R,`max score of ${k.maxScore} < selected max of ${f}`),w):w&&(ps(R)>=ps(w)||k.fragmentError>r[w].fragmentError)?w:(f=k.maxScore,R):(Tr(R,`no variants with VIDEO-RANGE of ${JSON.stringify(g)} found`),w)},void 0),videoRanges:g,preferHDR:p,minFramerate:h,minBitrate:d}}function Tr(r,e){U.log(`[abr] start candidates with "${r}" ignored because ${e}`)}function mE(r){return r.reduce((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const i=t.channels||"2";return n.channels[i]=(n.channels[i]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function EE(r,e,t,n){return r.slice(t,n+1).reduce((i,s)=>{if(!s.codecSet)return i;const o=s.audioGroups;let a=i[s.codecSet];a||(i[s.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,s.bitrate);const l=Math.min(s.height,s.width);return a.minHeight=Math.min(a.minHeight,l),a.minFramerate=Math.min(a.minFramerate,s.frameRate),a.maxScore=Math.max(a.maxScore,s.score),a.fragmentError+=s.fragmentError,a.videoRanges[s.videoRange]=(a.videoRanges[s.videoRange]||0)+1,o&&o.forEach(A=>{if(!A)return;const c=e.groups[A];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]}))}),i},{})}function cr(r,e,t){if("attrs"in r){const n=e.indexOf(r);if(n!==-1)return n}for(let n=0;n<e.length;n++){const i=e[n];if(Tn(r,i,t))return n}return-1}function Tn(r,e,t){const{groupId:n,name:i,lang:s,assocLang:o,characteristics:a,default:l}=r,A=r.forced;return(n===void 0||e.groupId===n)&&(i===void 0||e.name===i)&&(s===void 0||e.lang===s)&&(s===void 0||e.assocLang===o)&&(l===void 0||e.default===l)&&(A===void 0||e.forced===A)&&(a===void 0||IE(a,e.characteristics))&&(t===void 0||t(r,e))}function IE(r,e=""){const t=r.split(","),n=e.split(",");return t.length===n.length&&!t.some(i=>n.indexOf(i)===-1)}function Qn(r,e){const{audioCodec:t,channels:n}=r;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function vE(r,e,t,n,i){const s=e[n],a=e.reduce((h,d,f)=>{const g=d.uri;return(h[g]||(h[g]=[])).push(f),h},{})[s.uri];a.length>1&&(n=Math.max.apply(Math,a));const l=s.videoRange,A=s.frameRate,c=s.codecSet.substring(0,4),u=vu(e,n,h=>{if(h.videoRange!==l||h.frameRate!==A||h.codecSet.substring(0,4)!==c)return!1;const d=h.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return cr(r,f,i)>-1});return u>-1?u:vu(e,n,h=>{const d=h.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return cr(r,f,i)>-1})}function vu(r,e,t){for(let n=e;n;n--)if(t(r[n]))return n;for(let n=e+1;n<r.length;n++)if(t(r[n]))return n;return-1}class CE{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:n,hls:i}=this,{autoLevelEnabled:s,media:o}=i;if(!t||!o)return;const a=performance.now(),l=n?n.stats:t.stats,A=n?n.duration:t.duration,c=a-l.loading.start,u=i.minAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||t.level<=u){this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||o.paused||!o.playbackRate||!o.readyState)return;const h=i.mainForwardBufferInfo;if(h===null)return;const d=this.bwEstimator.getEstimateTTFB(),f=Math.abs(o.playbackRate);if(c<=Math.max(d,1e3*(A/(f*2))))return;const g=h.len/f,p=l.loading.first?l.loading.first-l.loading.start:-1,C=l.loaded&&p>-1,Q=this.getBwEstimate(),b=i.levels,y=b[t.level],w=l.total||Math.max(l.loaded,Math.round(A*y.averageBitrate/8));let R=C?c-p:c;R<1&&C&&(R=Math.min(c,l.loaded*8/Q));const k=C?l.loaded*1e3/R:0,$=k?(w-l.loaded)/k:w*8/Q+d/1e3;if($<=g)return;const K=k?k*8:Q;let O=Number.POSITIVE_INFINITY,J;for(J=t.level-1;J>u;J--){const ee=b[J].maxBitrate;if(O=this.getTimeToLoadFrag(d/1e3,K,A*ee,!b[J].details),O<g)break}if(O>=$||O>A*10)return;i.nextLoadLevel=i.nextAutoLevel=J,C?this.bwEstimator.sample(c-Math.min(d,p),l.loaded):this.bwEstimator.sampleTTFB(c);const ie=b[J].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>ie&&this.resetEstimator(ie),this.clearTimer(),U.warn(`[abr] Fragment ${t.sn}${n?" part "+n.index:""} of level ${t.level} is loading too slowly;
2463
+ */const vc="important",Up=" !"+vc,Ai=pn(class extends Zn{constructor(r){var e;if(super(r),r.type!==gn.ATTRIBUTE||r.name!=="style"||((e=r.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(r){return Object.keys(r).reduce((e,t)=>{const n=r[t];return n==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(r,[e]){const{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const n of this.ft)e[n]==null&&(this.ft.delete(n),n.includes("-")?t.removeProperty(n):t[n]=null);for(const n in e){const i=e[n];if(i!=null){this.ft.add(n);const s=typeof i=="string"&&i.endsWith(Up);n.includes("-")||s?t.setProperty(n,s?i.slice(0,-11):i,s?vc:""):t[n]=i}}return Xt}});function Gp(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Cc={exports:{}};(function(r,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(l,A,c){if(c=c||{},l=l.trim(),A=A.trim(),!A){if(!c.alwaysNormalize)return l;var u=a.parseURL(l);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(A);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)):A;var d=a.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");if(!d.netLoc&&d.path&&d.path[0]!=="/"){var f=i.exec(d.path);d.netLoc=f[1],d.path=f[2]}d.netLoc&&!d.path&&(d.path="/");var g={scheme:d.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(g.netLoc=d.netLoc,h.path[0]!=="/"))if(!h.path)g.path=d.path,h.params||(g.params=d.params,h.query||(g.query=d.query));else{var p=d.path,y=p.substring(0,p.lastIndexOf("/")+1)+h.path;g.path=a.normalizePath(y)}return g.path===null&&(g.path=c.alwaysNormalize?a.normalizePath(h.path):h.path),a.buildURLFromParts(g)},parseURL:function(l){var A=n.exec(l);return A?{scheme:A[1]||"",netLoc:A[2]||"",path:A[3]||"",params:A[4]||"",query:A[5]||"",fragment:A[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(s,"");l.length!==(l=l.replace(o,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};r.exports=a})()})(Cc);var Xo=Cc.exports;function yc(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ht(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yc(Object(t),!0).forEach(function(n){Yp(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):yc(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Hp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function $p(r){var e=Hp(r,"string");return typeof e=="symbol"?e:String(e)}function Yp(r,e,t){return e=$p(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function it(){return it=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},it.apply(this,arguments)}const he=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Vp=Number.isSafeInteger||function(r){return typeof r=="number"&&Math.abs(r)<=Kp},Kp=Number.MAX_SAFE_INTEGER||9007199254740991;let I=function(r){return r.MEDIA_ATTACHING="hlsMediaAttaching",r.MEDIA_ATTACHED="hlsMediaAttached",r.MEDIA_DETACHING="hlsMediaDetaching",r.MEDIA_DETACHED="hlsMediaDetached",r.BUFFER_RESET="hlsBufferReset",r.BUFFER_CODECS="hlsBufferCodecs",r.BUFFER_CREATED="hlsBufferCreated",r.BUFFER_APPENDING="hlsBufferAppending",r.BUFFER_APPENDED="hlsBufferAppended",r.BUFFER_EOS="hlsBufferEos",r.BUFFER_FLUSHING="hlsBufferFlushing",r.BUFFER_FLUSHED="hlsBufferFlushed",r.MANIFEST_LOADING="hlsManifestLoading",r.MANIFEST_LOADED="hlsManifestLoaded",r.MANIFEST_PARSED="hlsManifestParsed",r.LEVEL_SWITCHING="hlsLevelSwitching",r.LEVEL_SWITCHED="hlsLevelSwitched",r.LEVEL_LOADING="hlsLevelLoading",r.LEVEL_LOADED="hlsLevelLoaded",r.LEVEL_UPDATED="hlsLevelUpdated",r.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",r.LEVELS_UPDATED="hlsLevelsUpdated",r.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",r.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",r.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",r.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",r.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",r.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",r.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",r.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",r.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",r.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",r.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",r.CUES_PARSED="hlsCuesParsed",r.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",r.INIT_PTS_FOUND="hlsInitPtsFound",r.FRAG_LOADING="hlsFragLoading",r.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",r.FRAG_LOADED="hlsFragLoaded",r.FRAG_DECRYPTED="hlsFragDecrypted",r.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",r.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",r.FRAG_PARSING_METADATA="hlsFragParsingMetadata",r.FRAG_PARSED="hlsFragParsed",r.FRAG_BUFFERED="hlsFragBuffered",r.FRAG_CHANGED="hlsFragChanged",r.FPS_DROP="hlsFpsDrop",r.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",r.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",r.ERROR="hlsError",r.DESTROYING="hlsDestroying",r.KEY_LOADING="hlsKeyLoading",r.KEY_LOADED="hlsKeyLoaded",r.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",r.BACK_BUFFER_REACHED="hlsBackBufferReached",r.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",r}({}),Be=function(r){return r.NETWORK_ERROR="networkError",r.MEDIA_ERROR="mediaError",r.KEY_SYSTEM_ERROR="keySystemError",r.MUX_ERROR="muxError",r.OTHER_ERROR="otherError",r}({}),K=function(r){return r.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",r.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",r.KEY_SYSTEM_NO_SESSION="keySystemNoSession",r.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",r.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",r.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",r.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",r.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",r.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",r.MANIFEST_LOAD_ERROR="manifestLoadError",r.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",r.MANIFEST_PARSING_ERROR="manifestParsingError",r.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",r.LEVEL_EMPTY_ERROR="levelEmptyError",r.LEVEL_LOAD_ERROR="levelLoadError",r.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",r.LEVEL_PARSING_ERROR="levelParsingError",r.LEVEL_SWITCH_ERROR="levelSwitchError",r.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",r.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",r.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",r.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",r.FRAG_LOAD_ERROR="fragLoadError",r.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",r.FRAG_DECRYPT_ERROR="fragDecryptError",r.FRAG_PARSING_ERROR="fragParsingError",r.FRAG_GAP="fragGap",r.REMUX_ALLOC_ERROR="remuxAllocError",r.KEY_LOAD_ERROR="keyLoadError",r.KEY_LOAD_TIMEOUT="keyLoadTimeOut",r.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",r.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",r.BUFFER_APPEND_ERROR="bufferAppendError",r.BUFFER_APPENDING_ERROR="bufferAppendingError",r.BUFFER_STALLED_ERROR="bufferStalledError",r.BUFFER_FULL_ERROR="bufferFullError",r.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",r.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",r.INTERNAL_EXCEPTION="internalException",r.INTERNAL_ABORTED="aborted",r.UNKNOWN="unknown",r}({});const zr=function(){},jo={trace:zr,debug:zr,log:zr,warn:zr,info:zr,error:zr};let ci=jo;function Jp(r){const e=self.console[r];return e?e.bind(self.console,`[${r}] >`):zr}function Wp(r,...e){e.forEach(function(t){ci[t]=r[t]?r[t].bind(r):Jp(t)})}function qp(r,e){if(typeof console=="object"&&r===!0||typeof r=="object"){Wp(r,"debug","log","info","warn","error");try{ci.log(`Debug logs enabled for "${e}" in hls.js version 1.5.11`)}catch{ci=jo}}else ci=jo}const U=ci,Xp=/^(\d+)x(\d+)$/,Bc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class je{constructor(e){typeof e=="string"&&(e=je.parseAttrList(e)),it(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 n=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)n[i]=parseInt(t.slice(i*2,i*2+2),16);return n}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 n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=Xp.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const n={},i='"';for(Bc.lastIndex=0;(t=Bc.exec(e))!==null;){let s=t[2];s.indexOf(i)===0&&s.lastIndexOf(i)===s.length-1&&(s=s.slice(1,-1));const o=t[1].trim();n[o]=s}return n}}function jp(r){return r!=="ID"&&r!=="CLASS"&&r!=="START-DATE"&&r!=="DURATION"&&r!=="END-DATE"&&r!=="END-ON-NEXT"}function zp(r){return r==="SCTE35-OUT"||r==="SCTE35-IN"}class Tc{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const n=t.attr;for(const i in n)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==n[i]){U.warn(`DATERANGE tag attribute: "${i}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=i;break}e=it(new je({}),n,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const n=new Date(this.attr["END-DATE"]);he(n.getTime())&&(this._endDate=n)}}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(he(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&&he(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class cs{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 He={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class Qc{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[He.AUDIO]:null,[He.VIDEO]:null,[He.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const n=e.split("@",2);let i;n.length===1?i=(t==null?void 0:t.byteRangeEndOffset)||0:i=parseInt(n[1]),this._byteRange=[i,parseInt(n[0])+i]}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=Xo.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class zo extends Qc{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 cs,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 n=Object.keys(this.levelkeys);if(n.length===1)return this._decryptdata=this.levelkeys[n[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!he(this.programDateTime))return null;const e=he(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),n=t.length;if(n>1||n===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,n,i,s,o=!1){const{elementaryStreams:a}=this,l=a[e];if(!l){a[e]={startPTS:t,endPTS:n,startDTS:i,endDTS:s,partial:o};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,n),l.startDTS=Math.min(l.startDTS,i),l.endDTS=Math.max(l.endDTS,s)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[He.AUDIO]=null,e[He.VIDEO]=null,e[He.AUDIOVIDEO]=null}}class Zp extends Qc{constructor(e,t,n,i,s){super(n),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 cs,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=i;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,s),s&&(this.fragOffset=s.fragOffset+s.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 em=10;class tm{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,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>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?he(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||em}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 Zo(r){return Uint8Array.from(atob(r),e=>e.charCodeAt(0))}function rm(r){const e=ea(r).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function nm(r){const e=function(n,i,s){const o=n[i];n[i]=n[s],n[s]=o};e(r,0,3),e(r,1,2),e(r,4,5),e(r,6,7)}function im(r){const e=r.split(":");let t=null;if(e[0]==="data"&&e.length===2){const n=e[1].split(";"),i=n[n.length-1].split(",");if(i.length===2){const s=i[0]==="base64",o=i[1];s?(n.splice(-1,1),t=Zo(o)):t=rm(o)}}return t}function ea(r){return Uint8Array.from(unescape(encodeURIComponent(r)),e=>e.charCodeAt(0))}const vn=typeof self<"u"?self:void 0;var Je={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},_t={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function bc(r){switch(r){case _t.FAIRPLAY:return Je.FAIRPLAY;case _t.PLAYREADY:return Je.PLAYREADY;case _t.WIDEVINE:return Je.WIDEVINE;case _t.CLEARKEY:return Je.CLEARKEY}}var xc={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function sm(r){if(r===xc.WIDEVINE)return Je.WIDEVINE}function wc(r){switch(r){case Je.FAIRPLAY:return _t.FAIRPLAY;case Je.PLAYREADY:return _t.PLAYREADY;case Je.WIDEVINE:return _t.WIDEVINE;case Je.CLEARKEY:return _t.CLEARKEY}}function ta(r){const{drmSystems:e,widevineLicenseUrl:t}=r,n=e?[Je.FAIRPLAY,Je.WIDEVINE,Je.PLAYREADY,Je.CLEARKEY].filter(i=>!!e[i]):[];return!n[Je.WIDEVINE]&&t&&n.push(Je.WIDEVINE),n}const Sc=function(r){return vn!=null&&(r=vn.navigator)!=null&&r.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function om(r,e,t,n){let i;switch(r){case Je.FAIRPLAY:i=["cenc","sinf"];break;case Je.WIDEVINE:case Je.PLAYREADY:i=["cenc"];break;case Je.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${r}`)}return am(i,e,t,n)}function am(r,e,t,n){return[{initDataTypes:r,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs="${s}"`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs="${s}"`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function Zr(r,e,t){return Uint8Array.prototype.slice?r.slice(e,t):new Uint8Array(Array.prototype.slice.call(r,e,t))}const ra=(r,e)=>e+10<=r.length&&r[e]===73&&r[e+1]===68&&r[e+2]===51&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128,Rc=(r,e)=>e+10<=r.length&&r[e]===51&&r[e+1]===68&&r[e+2]===73&&r[e+3]<255&&r[e+4]<255&&r[e+6]<128&&r[e+7]<128&&r[e+8]<128&&r[e+9]<128,ui=(r,e)=>{const t=e;let n=0;for(;ra(r,e);){n+=10;const i=us(r,e+6);n+=i,Rc(r,e+10)&&(n+=10),e+=n}if(n>0)return r.subarray(t,t+n)},us=(r,e)=>{let t=0;return t=(r[e]&127)<<21,t|=(r[e+1]&127)<<14,t|=(r[e+2]&127)<<7,t|=r[e+3]&127,t},lm=(r,e)=>ra(r,e)&&us(r,e+6)+10<=r.length-e,na=r=>{const e=_c(r);for(let t=0;t<e.length;t++){const n=e[t];if(Dc(n))return fm(n)}},Dc=r=>r&&r.key==="PRIV"&&r.info==="com.apple.streaming.transportStreamTimestamp",Am=r=>{const e=String.fromCharCode(r[0],r[1],r[2],r[3]),t=us(r,4),n=10;return{type:e,size:t,data:r.subarray(n,n+t)}},_c=r=>{let e=0;const t=[];for(;ra(r,e);){const n=us(r,e+6);e+=10;const i=e+n;for(;e+8<i;){const s=Am(r.subarray(e)),o=cm(s);o&&t.push(o),e+=s.size+10}Rc(r,e)&&(e+=10)}return t},cm=r=>r.type==="PRIV"?um(r):r.type[0]==="W"?dm(r):hm(r),um=r=>{if(r.size<2)return;const e=or(r.data,!0),t=new Uint8Array(r.data.subarray(e.length+1));return{key:r.type,info:e,data:t.buffer}},hm=r=>{if(r.size<2)return;if(r.type==="TXXX"){let t=1;const n=or(r.data.subarray(t),!0);t+=n.length+1;const i=or(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=or(r.data.subarray(1));return{key:r.type,data:e}},dm=r=>{if(r.type==="WXXX"){if(r.size<2)return;let t=1;const n=or(r.data.subarray(t),!0);t+=n.length+1;const i=or(r.data.subarray(t));return{key:r.type,info:n,data:i}}const e=or(r.data);return{key:r.type,data:e}},fm=r=>{if(r.data.byteLength===8){const e=new Uint8Array(r.data),t=e[3]&1;let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,t&&(n+=4772185884e-2),Math.round(n)}},or=(r,e=!1)=>{const t=gm();if(t){const A=t.decode(r);if(e){const c=A.indexOf("\0");return c!==-1?A.substring(0,c):A}return A.replace(/\0/g,"")}const n=r.length;let i,s,o,a="",l=0;for(;l<n;){if(i=r[l++],i===0&&e)return a;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(i);break;case 12:case 13:s=r[l++],a+=String.fromCharCode((i&31)<<6|s&63);break;case 14:s=r[l++],o=r[l++],a+=String.fromCharCode((i&15)<<12|(s&63)<<6|(o&63)<<0);break}}return a};let ia;function gm(){if(!navigator.userAgent.includes("PlayStation 4"))return!ia&&typeof self.TextDecoder<"u"&&(ia=new self.TextDecoder("utf-8")),ia}const ar={hexDump:function(r){let e="";for(let t=0;t<r.length;t++){let n=r[t].toString(16);n.length<2&&(n="0"+n),e+=n}return e}},hs=Math.pow(2,32)-1,pm=[].push,Lc={video:1,audio:2,id3:3,text:4};function ct(r){return String.fromCharCode.apply(null,r)}function Fc(r,e){const t=r[e]<<8|r[e+1];return t<0?65536+t:t}function me(r,e){const t=Nc(r,e);return t<0?4294967296+t:t}function kc(r,e){let t=me(r,e);return t*=Math.pow(2,32),t+=me(r,e+4),t}function Nc(r,e){return r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}function sa(r,e,t){r[e]=t>>24,r[e+1]=t>>16&255,r[e+2]=t>>8&255,r[e+3]=t&255}function mm(r){const e=r.byteLength;for(let t=0;t<e;){const n=me(r,t);if(n>8&&r[t+4]===109&&r[t+5]===111&&r[t+6]===111&&r[t+7]===102)return!0;t=n>1?t+n:e}return!1}function xe(r,e){const t=[];if(!e.length)return t;const n=r.byteLength;for(let i=0;i<n;){const s=me(r,i),o=ct(r.subarray(i+4,i+8)),a=s>1?i+s:n;if(o===e[0])if(e.length===1)t.push(r.subarray(i+8,a));else{const l=xe(r.subarray(i+8,a),e.slice(1));l.length&&pm.apply(t,l)}i=a}return t}function Em(r){const e=[],t=r[0];let n=8;const i=me(r,n);n+=4;let s=0,o=0;t===0?(s=me(r,n),o=me(r,n+4),n+=8):(s=kc(r,n),o=kc(r,n+8),n+=16),n+=2;let a=r.length+o;const l=Fc(r,n);n+=2;for(let A=0;A<l;A++){let c=n;const u=me(r,c);c+=4;const h=u&2147483647;if((u&2147483648)>>>31===1)return U.warn("SIDX has hierarchical references (not supported)"),null;const f=me(r,c);c+=4,e.push({referenceSize:h,subsegmentDuration:f,info:{duration:f/i,start:a,end:a+h-1}}),a+=h,c+=4,n=c}return{earliestPresentationTime:s,timescale:i,version:t,referencesCount:l,references:e}}function Mc(r){const e=[],t=xe(r,["moov","trak"]);for(let i=0;i<t.length;i++){const s=t[i],o=xe(s,["tkhd"])[0];if(o){let a=o[0];const l=me(o,a===0?12:20),A=xe(s,["mdia","mdhd"])[0];if(A){a=A[0];const c=me(A,a===0?12:20),u=xe(s,["mdia","hdlr"])[0];if(u){const h=ct(u.subarray(8,12)),d={soun:He.AUDIO,vide:He.VIDEO}[h];if(d){const f=xe(s,["mdia","minf","stbl","stsd"])[0],g=Im(f);e[l]={timescale:c,type:d},e[d]=ht({timescale:c,id:l},g)}}}}}return xe(r,["moov","mvex","trex"]).forEach(i=>{const s=me(i,4),o=e[s];o&&(o.default={duration:me(i,12),flags:me(i,20)})}),e}function Im(r){const e=r.subarray(8),t=e.subarray(86),n=ct(e.subarray(4,8));let i=n;const s=n==="enca"||n==="encv";if(s){const a=xe(e,[n])[0].subarray(n==="enca"?28:78);xe(a,["sinf"]).forEach(A=>{const c=xe(A,["schm"])[0];if(c){const u=ct(c.subarray(4,8));if(u==="cbcs"||u==="cenc"){const h=xe(A,["frma"])[0];h&&(i=ct(h))}}})}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const o=xe(t,["avcC"])[0];i+="."+ds(o[1])+ds(o[2])+ds(o[3]);break}case"mp4a":{const o=xe(e,[n])[0],a=xe(o.subarray(28),["esds"])[0];if(a&&a.length>12){let l=4;if(a[l++]!==3)break;l=oa(a,l),l+=2;const A=a[l++];if(A&128&&(l+=2),A&64&&(l+=a[l++]),a[l++]!==4)break;l=oa(a,l);const c=a[l++];if(c===64)i+="."+ds(c);else break;if(l+=12,a[l++]!==5)break;l=oa(a,l);const u=a[l++];let h=(u&248)>>3;h===31&&(h+=1+((u&7)<<3)+((a[l]&224)>>5)),i+="."+h}break}case"hvc1":case"hev1":{const o=xe(t,["hvcC"])[0],a=o[1],l=["","A","B","C"][a>>6],A=a&31,c=me(o,2),u=(a&32)>>5?"H":"L",h=o[12],d=o.subarray(6,12);i+="."+l+A,i+="."+c.toString(16).toUpperCase(),i+="."+u+h;let f="";for(let g=d.length;g--;){const p=d[g];(p||f)&&(f="."+p.toString(16).toUpperCase()+f)}i+=f;break}case"dvh1":case"dvhe":{const o=xe(t,["dvcC"])[0],a=o[2]>>1&127,l=o[2]<<5&32|o[3]>>3&31;i+="."+lr(a)+"."+lr(l);break}case"vp09":{const o=xe(t,["vpcC"])[0],a=o[4],l=o[5],A=o[6]>>4&15;i+="."+lr(a)+"."+lr(l)+"."+lr(A);break}case"av01":{const o=xe(t,["av1C"])[0],a=o[1]>>>5,l=o[1]&31,A=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,f=(o[2]&8)>>3,g=(o[2]&4)>>2,p=o[2]&3;i+="."+a+"."+lr(l)+A+"."+lr(h)+"."+d+"."+f+g+p+"."+lr(1)+"."+lr(1)+"."+lr(1)+"."+0;break}}return{codec:i,encrypted:s}}function oa(r,e){const t=e+5;for(;r[e++]&128&&e<t;);return e}function ds(r){return("0"+r.toString(16).toUpperCase()).slice(-2)}function lr(r){return(r<10?"0":"")+r}function vm(r,e){if(!r||!e)return r;const t=e.keyId;return t&&e.isCommonEncryption&&xe(r,["moov","trak"]).forEach(i=>{const o=xe(i,["mdia","minf","stbl","stsd"])[0].subarray(8);let a=xe(o,["enca"]);const l=a.length>0;l||(a=xe(o,["encv"])),a.forEach(A=>{const c=l?A.subarray(28):A.subarray(78);xe(c,["sinf"]).forEach(h=>{const d=Pc(h);if(d){const f=d.subarray(8,24);f.some(g=>g!==0)||(U.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${ar.hexDump(f)} -> ${ar.hexDump(t)}`),d.set(t,8))}})})}),r}function Pc(r){const e=xe(r,["schm"])[0];if(e){const t=ct(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return xe(r,["schi","tenc"])[0]}return U.error("[eme] missing 'schm' box"),null}function Cm(r,e){return xe(e,["moof","traf"]).reduce((t,n)=>{const i=xe(n,["tfdt"])[0],s=i[0],o=xe(n,["tfhd"]).reduce((a,l)=>{const A=me(l,4),c=r[A];if(c){let u=me(i,4);if(s===1){if(u===hs)return U.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),a;u*=hs+1,u+=me(i,8)}const h=c.timescale||9e4,d=u/h;if(he(d)&&(a===null||d<a))return d}return a},null);return o!==null&&he(o)&&(t===null||o<t)?o:t},null)}function ym(r,e){let t=0,n=0,i=0;const s=xe(r,["moof","traf"]);for(let o=0;o<s.length;o++){const a=s[o],l=xe(a,["tfhd"])[0],A=me(l,4),c=e[A];if(!c)continue;const u=c.default,h=me(l,0)|(u==null?void 0:u.flags);let d=u==null?void 0:u.duration;h&8&&(h&2?d=me(l,12):d=me(l,8));const f=c.timescale||9e4,g=xe(a,["trun"]);for(let p=0;p<g.length;p++){if(t=Bm(g[p]),!t&&d){const y=me(g[p],4);t=d*y}c.type===He.VIDEO?n+=t/f:c.type===He.AUDIO&&(i+=t/f)}}if(n===0&&i===0){let o=1/0,a=0,l=0;const A=xe(r,["sidx"]);for(let c=0;c<A.length;c++){const u=Em(A[c]);if(u!=null&&u.references){o=Math.min(o,u.earliestPresentationTime/u.timescale);const h=u.references.reduce((d,f)=>d+f.info.duration||0,0);a=Math.max(a,h+u.earliestPresentationTime/u.timescale),l=a-o}}if(l&&he(l))return l}return n||i}function Bm(r){const e=me(r,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let n=0;const i=me(r,4);for(let s=0;s<i;s++){if(e&256){const o=me(r,t);n+=o,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return n}function Tm(r,e,t){xe(e,["moof","traf"]).forEach(n=>{xe(n,["tfhd"]).forEach(i=>{const s=me(i,4),o=r[s];if(!o)return;const a=o.timescale||9e4;xe(n,["tfdt"]).forEach(l=>{const A=l[0],c=t*a;if(c){let u=me(l,4);if(A===0)u-=c,u=Math.max(u,0),sa(l,4,u);else{u*=Math.pow(2,32),u+=me(l,8),u-=c,u=Math.max(u,0);const h=Math.floor(u/(hs+1)),d=Math.floor(u%(hs+1));sa(l,4,h),sa(l,8,d)}}})})})}function Qm(r){const e={valid:null,remainder:null},t=xe(r,["moof"]);if(t.length<2)return e.remainder=r,e;const n=t[t.length-1];return e.valid=Zr(r,0,n.byteOffset-8),e.remainder=Zr(r,n.byteOffset-8),e}function $t(r,e){const t=new Uint8Array(r.length+e.length);return t.set(r),t.set(e,r.length),t}function Oc(r,e){const t=[],n=e.samples,i=e.timescale,s=e.id;let o=!1;return xe(n,["moof"]).map(l=>{const A=l.byteOffset-8;xe(l,["traf"]).map(u=>{const h=xe(u,["tfdt"]).map(d=>{const f=d[0];let g=me(d,4);return f===1&&(g*=Math.pow(2,32),g+=me(d,8)),g/i})[0];return h!==void 0&&(r=h),xe(u,["tfhd"]).map(d=>{const f=me(d,4),g=me(d,0)&16777215,p=(g&1)!==0,y=(g&2)!==0,Q=(g&8)!==0;let b=0;const C=(g&16)!==0;let w=0;const R=(g&32)!==0;let k=8;f===s&&(p&&(k+=8),y&&(k+=4),Q&&(b=me(d,k),k+=4),C&&(w=me(d,k),k+=4),R&&(k+=4),e.type==="video"&&(o=bm(e.codec)),xe(u,["trun"]).map($=>{const V=$[0],O=me($,0)&16777215,W=(O&1)!==0;let ie=0;const te=(O&4)!==0,le=(O&256)!==0;let D=0;const P=(O&512)!==0;let X=0;const _=(O&1024)!==0,S=(O&2048)!==0;let F=0;const J=me($,4);let Y=8;W&&(ie=me($,Y),Y+=4),te&&(Y+=4);let ne=ie+A;for(let ce=0;ce<J;ce++){if(le?(D=me($,Y),Y+=4):D=b,P?(X=me($,Y),Y+=4):X=w,_&&(Y+=4),S&&(V===0?F=me($,Y):F=Nc($,Y),Y+=4),e.type===He.VIDEO){let pe=0;for(;pe<X;){const ge=me(n,ne);if(ne+=4,xm(o,n[ne])){const Se=n.subarray(ne,ne+ge);Uc(Se,o?2:1,r+F/i,t)}ne+=ge,pe+=ge+4}}r+=D/i}}))})})}),t}function bm(r){if(!r)return!1;const e=r.indexOf("."),t=e<0?r:r.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function xm(r,e){if(r){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Uc(r,e,t,n){const i=Gc(r);let s=0;s+=e;let o=0,a=0,l=0;for(;s<i.length;){o=0;do{if(s>=i.length)break;l=i[s++],o+=l}while(l===255);a=0;do{if(s>=i.length)break;l=i[s++],a+=l}while(l===255);const A=i.length-s;let c=s;if(a<A)s+=a;else if(a>A){U.error(`Malformed SEI payload. ${a} is too small, only ${A} bytes left to parse.`);break}if(o===4){if(i[c++]===181){const h=Fc(i,c);if(c+=2,h===49){const d=me(i,c);if(c+=4,d===1195456820){const f=i[c++];if(f===3){const g=i[c++],p=31&g,y=64&g,Q=y?2+p*3:0,b=new Uint8Array(Q);if(y){b[0]=g;for(let C=1;C<Q;C++)b[C]=i[c++]}n.push({type:f,payloadType:o,pts:t,bytes:b})}}}}}else if(o===5&&a>16){const u=[];for(let f=0;f<16;f++){const g=i[c++].toString(16);u.push(g.length==1?"0"+g:g),(f===3||f===5||f===7||f===9)&&u.push("-")}const h=a-16,d=new Uint8Array(h);for(let f=0;f<h;f++)d[f]=i[c++];n.push({payloadType:o,pts:t,uuid:u.join(""),userData:or(d),userDataBytes:d})}}}function Gc(r){const e=r.byteLength,t=[];let n=1;for(;n<e-2;)r[n]===0&&r[n+1]===0&&r[n+2]===3?(t.push(n+2),n+=2):n++;if(t.length===0)return r;const i=e-t.length,s=new Uint8Array(i);let o=0;for(n=0;n<i;o++,n++)o===t[0]&&(o++,t.shift()),s[n]=r[o];return s}function wm(r){const e=r[0];let t="",n="",i=0,s=0,o=0,a=0,l=0,A=0;if(e===0){for(;ct(r.subarray(A,A+1))!=="\0";)t+=ct(r.subarray(A,A+1)),A+=1;for(t+=ct(r.subarray(A,A+1)),A+=1;ct(r.subarray(A,A+1))!=="\0";)n+=ct(r.subarray(A,A+1)),A+=1;n+=ct(r.subarray(A,A+1)),A+=1,i=me(r,12),s=me(r,16),a=me(r,20),l=me(r,24),A=28}else if(e===1){A+=4,i=me(r,A),A+=4;const u=me(r,A);A+=4;const h=me(r,A);for(A+=4,o=4294967296*u+h,Vp(o)||(o=Number.MAX_SAFE_INTEGER,U.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),a=me(r,A),A+=4,l=me(r,A),A+=4;ct(r.subarray(A,A+1))!=="\0";)t+=ct(r.subarray(A,A+1)),A+=1;for(t+=ct(r.subarray(A,A+1)),A+=1;ct(r.subarray(A,A+1))!=="\0";)n+=ct(r.subarray(A,A+1)),A+=1;n+=ct(r.subarray(A,A+1)),A+=1}const c=r.subarray(A,r.byteLength);return{schemeIdUri:t,value:n,timeScale:i,presentationTime:o,presentationTimeDelta:s,eventDuration:a,id:l,payload:c}}function Sm(r,...e){const t=e.length;let n=8,i=t;for(;i--;)n+=e[i].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=n&255,s.set(r,4),i=0,n=8;i<t;i++)s.set(e[i],n),n+=e[i].byteLength;return s}function Rm(r,e,t){if(r.byteLength!==16)throw new RangeError("Invalid system id");let n,i;if(e){n=1,i=new Uint8Array(e.length*16);for(let a=0;a<e.length;a++){const l=e[a];if(l.byteLength!==16)throw new RangeError("Invalid key");i.set(l,a*16)}}else n=0,i=new Uint8Array;let s;n>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const o=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(o.buffer).setUint32(0,t.byteLength,!1),Sm([112,115,115,104],new Uint8Array([n,0,0,0]),r,s,i,o,t||new Uint8Array)}function Dm(r){if(!(r instanceof ArrayBuffer)||r.byteLength<32)return null;const e={version:0,systemId:"",kids:null,data:null},t=new DataView(r),n=t.getUint32(0);if(r.byteLength!==n&&n>44||t.getUint32(4)!==1886614376||(e.version=t.getUint32(8)>>>24,e.version>1))return null;e.systemId=ar.hexDump(new Uint8Array(r,12,16));const s=t.getUint32(28);if(e.version===0){if(n-32<s)return null;e.data=new Uint8Array(r,32,s)}else if(e.version===1){e.kids=[];for(let o=0;o<s;o++)e.kids.push(new Uint8Array(r,32+o*16,16))}return e}let fs={};class hi{static clearKeyUriToKeyIdMap(){fs={}}constructor(e,t,n,i=[1],s=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=n,this.keyFormatVersions=i,this.iv=s,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 _t.FAIRPLAY:case _t.WIDEVINE:case _t.PLAYREADY:case _t.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&&U.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const n=_m(e);return new hi(this.method,this.uri,"identity",this.keyFormatVersions,n)}const t=im(this.uri);if(t)switch(this.keyFormat){case _t.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case _t.PLAYREADY:{const n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Rm(n,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),s=String.fromCharCode.apply(null,Array.from(i)),o=s.substring(s.indexOf("<"),s.length),A=new DOMParser().parseFromString(o,"text/xml").getElementsByTagName("KID")[0];if(A){const c=A.childNodes[0]?A.childNodes[0].nodeValue:A.getAttribute("VALUE");if(c){const u=Zo(c).subarray(0,16);nm(u),this.keyId=u}}break}default:{let n=t.subarray(0,16);if(n.length!==16){const i=new Uint8Array(16);i.set(n,16-n.length),n=i}this.keyId=n;break}}if(!this.keyId||this.keyId.byteLength!==16){let n=fs[this.uri];if(!n){const i=Object.keys(fs).length%Number.MAX_SAFE_INTEGER;n=new Uint8Array(16),new DataView(n.buffer,12,4).setUint32(0,i),fs[this.uri]=n}this.keyId=n}return this}}function _m(r){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=r>>8*(15-t)&255;return e}const Hc=/\{\$([a-zA-Z0-9-_]+)\}/g;function $c(r){return Hc.test(r)}function Lt(r,e,t){if(r.variableList!==null||r.hasVariableRefs)for(let n=t.length;n--;){const i=t[n],s=e[i];s&&(e[i]=aa(r,s))}}function aa(r,e){if(r.variableList!==null||r.hasVariableRefs){const t=r.variableList;return e.replace(Hc,n=>{const i=n.substring(2,n.length-1),s=t==null?void 0:t[i];return s===void 0?(r.playlistParsingError||(r.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),n):s})}return e}function Yc(r,e,t){let n=r.variableList;n||(r.variableList=n={});let i,s;if("QUERYPARAM"in e){i=e.QUERYPARAM;try{const o=new self.URL(t).searchParams;if(o.has(i))s=o.get(i);else throw new Error(`"${i}" does not match any query parameter in URI: "${t}"`)}catch(o){r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else i=e.NAME,s=e.VALUE;i in n?r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):n[i]=s||""}function Lm(r,e,t){const n=e.IMPORT;if(t&&n in t){let i=r.variableList;i||(r.variableList=i={}),i[n]=t[n]}else r.playlistParsingError||(r.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}function en(r=!0){return typeof self>"u"?void 0:(r||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Fm(r){return typeof self<"u"&&r===self.ManagedMediaSource}const gs={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 km(r,e){const t=gs[e];return!!t&&!!t[r.slice(0,4)]}function la(r,e,t=!0){return!r.split(",").some(n=>!Vc(n,e,t))}function Vc(r,e,t=!0){var n;const i=en(t);return(n=i==null?void 0:i.isTypeSupported(di(r,e)))!=null?n:!1}function di(r,e){return`${e}/mp4;codecs="${r}"`}function Kc(r){if(r){const e=r.substring(0,4);return gs.video[e]}return 2}function ps(r){return r.split(",").reduce((e,t)=>{const n=gs.video[t];return n?(n*2+e)/(e?3:2):(gs.audio[t]+e)/(e?2:1)},0)}const Aa={};function Nm(r,e=!0){if(Aa[r])return Aa[r];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[r];for(let n=0;n<t.length;n++)if(Vc(t[n],"audio",e))return Aa[r]=t[n],t[n];return r}const Mm=/flac|opus/i;function ms(r,e=!0){return r.replace(Mm,t=>Nm(t.toLowerCase(),e))}function Jc(r,e){return r&&r!=="mp4a"?r:e&&e.split(",")[0]}function Pm(r){const e=r.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 r}const Wc=/#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,qc=/#EXT-X-MEDIA:(.*)/g,Om=/^#EXT(?:INF|-X-TARGETDURATION):/m,Xc=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"),Um=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 Ar{static findGroup(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.id===t)return i}}static resolve(e,t){return Xo.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Om.test(e)}static parseMasterPlaylist(e,t){const n=$c(e),i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},s=[];Wc.lastIndex=0;let o;for(;(o=Wc.exec(e))!=null;)if(o[1]){var a;const A=new je(o[1]);Lt(i,A,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const c=aa(i,o[2]),u={attrs:A,bitrate:A.decimalInteger("BANDWIDTH")||A.decimalInteger("AVERAGE-BANDWIDTH"),name:A.NAME,url:Ar.resolve(c,t)},h=A.decimalResolution("RESOLUTION");h&&(u.width=h.width,u.height=h.height),Gm(A.CODECS,u),(a=u.unknownCodecs)!=null&&a.length||s.push(u),i.levels.push(u)}else if(o[3]){const A=o[3],c=o[4];switch(A){case"SESSION-DATA":{const u=new je(c);Lt(i,u,["DATA-ID","LANGUAGE","VALUE","URI"]);const h=u["DATA-ID"];h&&(i.sessionData===null&&(i.sessionData={}),i.sessionData[h]=u);break}case"SESSION-KEY":{const u=jc(c,t,i);u.encrypted&&u.isSupported()?(i.sessionKeys===null&&(i.sessionKeys=[]),i.sessionKeys.push(u)):U.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${c}"`);break}case"DEFINE":{{const u=new je(c);Lt(i,u,["NAME","VALUE","QUERYPARAM"]),Yc(i,u,t)}break}case"CONTENT-STEERING":{const u=new je(c);Lt(i,u,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:Ar.resolve(u["SERVER-URI"],t),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{i.startTimeOffset=zc(c);break}}}const l=s.length>0&&s.length<i.levels.length;return i.levels=l?s:i.levels,i.levels.length===0&&(i.playlistParsingError=new Error("no levels found in manifest")),i}static parseMasterPlaylistMedia(e,t,n){let i;const s={},o=n.levels,a={AUDIO:o.map(A=>({id:A.attrs.AUDIO,audioCodec:A.audioCodec})),SUBTITLES:o.map(A=>({id:A.attrs.SUBTITLES,textCodec:A.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(qc.lastIndex=0;(i=qc.exec(e))!==null;){const A=new je(i[1]),c=A.TYPE;if(c){const u=a[c],h=s[c]||[];s[c]=h,Lt(n,A,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=A.LANGUAGE,f=A["ASSOC-LANGUAGE"],g=A.CHANNELS,p=A.CHARACTERISTICS,y=A["INSTREAM-ID"],Q={attrs:A,bitrate:0,id:l++,groupId:A["GROUP-ID"]||"",name:A.NAME||d||"",type:c,default:A.bool("DEFAULT"),autoselect:A.bool("AUTOSELECT"),forced:A.bool("FORCED"),lang:d,url:A.URI?Ar.resolve(A.URI,t):""};if(f&&(Q.assocLang=f),g&&(Q.channels=g),p&&(Q.characteristics=p),y&&(Q.instreamId=y),u!=null&&u.length){const b=Ar.findGroup(u,Q.groupId)||u[0];Zc(Q,b,"audioCodec"),Zc(Q,b,"textCodec")}h.push(Q)}}return s}static parseLevelPlaylist(e,t,n,i,s,o){const a=new tm(t),l=a.fragments;let A=null,c=0,u=0,h=0,d=0,f=null,g=new zo(i,t),p,y,Q,b=-1,C=!1,w=null;for(Xc.lastIndex=0,a.m3u8=e,a.hasVariableRefs=$c(e);(p=Xc.exec(e))!==null;){C&&(C=!1,g=new zo(i,t),g.start=h,g.sn=c,g.cc=d,g.level=n,A&&(g.initSegment=A,g.rawProgramDateTime=A.rawProgramDateTime,A.rawProgramDateTime=null,w&&(g.setByteRange(w),w=null)));const V=p[1];if(V){g.duration=parseFloat(V);const O=(" "+p[2]).slice(1);g.title=O||null,g.tagList.push(O?["INF",V,O]:["INF",V])}else if(p[3]){if(he(g.duration)){g.start=h,Q&&ru(g,Q,a),g.sn=c,g.level=n,g.cc=d,l.push(g);const O=(" "+p[3]).slice(1);g.relurl=aa(a,O),eu(g,f),f=g,h+=g.duration,c++,u=0,C=!0}}else if(p[4]){const O=(" "+p[4]).slice(1);f?g.setByteRange(O,f):g.setByteRange(O)}else if(p[5])g.rawProgramDateTime=(" "+p[5]).slice(1),g.tagList.push(["PROGRAM-DATE-TIME",g.rawProgramDateTime]),b===-1&&(b=l.length);else{if(p=p[0].match(Um),!p){U.warn("No matches on slow regex match for level playlist!");continue}for(y=1;y<p.length&&!(typeof p[y]<"u");y++);const O=(" "+p[y]).slice(1),W=(" "+p[y+1]).slice(1),ie=p[y+2]?(" "+p[y+2]).slice(1):"";switch(O){case"PLAYLIST-TYPE":a.type=W.toUpperCase();break;case"MEDIA-SEQUENCE":c=a.startSN=parseInt(W);break;case"SKIP":{const te=new je(W);Lt(a,te,["RECENTLY-REMOVED-DATERANGES"]);const le=te.decimalInteger("SKIPPED-SEGMENTS");if(he(le)){a.skippedSegments=le;for(let P=le;P--;)l.unshift(null);c+=le}const D=te.enumeratedString("RECENTLY-REMOVED-DATERANGES");D&&(a.recentlyRemovedDateranges=D.split(" "));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(W),1);break;case"VERSION":a.version=parseInt(W);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(W||ie)&&g.tagList.push(ie?[W,ie]:[W]);break;case"DISCONTINUITY":d++,g.tagList.push(["DIS"]);break;case"GAP":g.gap=!0,g.tagList.push([O]);break;case"BITRATE":g.tagList.push([O,W]);break;case"DATERANGE":{const te=new je(W);Lt(a,te,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Lt(a,te,te.clientAttrs);const le=new Tc(te,a.dateRanges[te.ID]);le.isValid||a.skippedSegments?a.dateRanges[le.id]=le:U.warn(`Ignoring invalid DATERANGE tag: "${W}"`),g.tagList.push(["EXT-X-DATERANGE",W]);break}case"DEFINE":{{const te=new je(W);Lt(a,te,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in te?Lm(a,te,o):Yc(a,te,t)}break}case"DISCONTINUITY-SEQUENCE":d=parseInt(W);break;case"KEY":{const te=jc(W,t,a);if(te.isSupported()){if(te.method==="NONE"){Q=void 0;break}Q||(Q={}),Q[te.keyFormat]&&(Q=it({},Q)),Q[te.keyFormat]=te}else U.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${W}"`);break}case"START":a.startTimeOffset=zc(W);break;case"MAP":{const te=new je(W);if(Lt(a,te,["BYTERANGE","URI"]),g.duration){const le=new zo(i,t);tu(le,te,n,Q),A=le,g.initSegment=A,A.rawProgramDateTime&&!g.rawProgramDateTime&&(g.rawProgramDateTime=A.rawProgramDateTime)}else{const le=g.byteRangeEndOffset;if(le){const D=g.byteRangeStartOffset;w=`${le-D}@${D}`}else w=null;tu(g,te,n,Q),A=g,C=!0}break}case"SERVER-CONTROL":{const te=new je(W);a.canBlockReload=te.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=te.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&te.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=te.optionalFloat("PART-HOLD-BACK",0),a.holdBack=te.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const te=new je(W);a.partTarget=te.decimalFloatingPoint("PART-TARGET");break}case"PART":{let te=a.partList;te||(te=a.partList=[]);const le=u>0?te[te.length-1]:void 0,D=u++,P=new je(W);Lt(a,P,["BYTERANGE","URI"]);const X=new Zp(P,g,t,D,le);te.push(X),g.duration+=X.duration;break}case"PRELOAD-HINT":{const te=new je(W);Lt(a,te,["URI"]),a.preloadHint=te;break}case"RENDITION-REPORT":{const te=new je(W);Lt(a,te,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(te);break}default:U.warn(`line parsed but not handled: ${p}`);break}}}f&&!f.relurl?(l.pop(),h-=f.duration,a.partList&&(a.fragmentHint=f)):a.partList&&(eu(g,f),g.cc=d,a.fragmentHint=g,Q&&ru(g,Q,a));const R=l.length,k=l[0],$=l[R-1];if(h+=a.skippedSegments*a.targetduration,h>0&&R&&$){a.averagetargetduration=h/R;const V=$.sn;a.endSN=V!=="initSegment"?V:0,a.live||($.endList=!0),k&&(a.startCC=k.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(h+=a.fragmentHint.duration),a.totalduration=h,a.endCC=d,b>0&&Hm(l,b),a}}function jc(r,e,t){var n,i;const s=new je(r);Lt(t,s,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=(n=s.METHOD)!=null?n:"",a=s.URI,l=s.hexadecimalInteger("IV"),A=s.KEYFORMATVERSIONS,c=(i=s.KEYFORMAT)!=null?i:"identity";a&&s.IV&&!l&&U.error(`Invalid IV: ${s.IV}`);const u=a?Ar.resolve(a,e):"",h=(A||"1").split("/").map(Number).filter(Number.isFinite);return new hi(o,u,c,h,l)}function zc(r){const t=new je(r).decimalFloatingPoint("TIME-OFFSET");return he(t)?t:null}function Gm(r,e){let t=(r||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const i=t.filter(s=>km(s,n));i.length&&(e[`${n}Codec`]=i.join(","),t=t.filter(s=>i.indexOf(s)===-1))}),e.unknownCodecs=t}function Zc(r,e,t){const n=e[t];n&&(r[t]=n)}function Hm(r,e){let t=r[e];for(let n=e;n--;){const i=r[n];if(!i)return;i.programDateTime=t.programDateTime-i.duration*1e3,t=i}}function eu(r,e){r.rawProgramDateTime?r.programDateTime=Date.parse(r.rawProgramDateTime):e!=null&&e.programDateTime&&(r.programDateTime=e.endProgramDateTime),he(r.programDateTime)||(r.programDateTime=null,r.rawProgramDateTime=null)}function tu(r,e,t,n){r.relurl=e.URI,e.BYTERANGE&&r.setByteRange(e.BYTERANGE),r.level=t,r.sn="initSegment",n&&(r.levelkeys=n),r.initSegment=null}function ru(r,e,t){r.levelkeys=e;const{encryptedFragments:n}=t;(!n.length||n[n.length-1].levelkeys!==e)&&Object.keys(e).some(i=>e[i].isCommonEncryption)&&n.push(r)}var Oe={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Ee={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function nu(r){const{type:e}=r;switch(e){case Oe.AUDIO_TRACK:return Ee.AUDIO;case Oe.SUBTITLE_TRACK:return Ee.SUBTITLE;default:return Ee.MAIN}}function ca(r,e){let t=r.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class $m{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(I.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,n=t.pLoader,i=t.loader,s=n||i,o=new s(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:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Oe.MANIFEST,url:n,deliveryDirectives:null})}onLevelLoading(e,t){const{id:n,level:i,pathwayId:s,url:o,deliveryDirectives:a}=t;this.load({id:n,level:i,pathwayId:s,responseType:"text",type:Oe.LEVEL,url:o,deliveryDirectives:a})}onAudioTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:Oe.AUDIO_TRACK,url:s,deliveryDirectives:o})}onSubtitleTrackLoading(e,t){const{id:n,groupId:i,url:s,deliveryDirectives:o}=t;this.load({id:n,groupId:i,level:null,responseType:"text",type:Oe.SUBTITLE_TRACK,url:s,deliveryDirectives:o})}load(e){var t;const n=this.hls.config;let i=this.getInternalLoader(e);if(i){const A=i.context;if(A&&A.url===e.url&&A.level===e.level){U.trace("[playlist-loader]: playlist request ongoing");return}U.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),i.abort()}let s;if(e.type===Oe.MANIFEST?s=n.manifestLoadPolicy.default:s=it({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(e),he((t=e.deliveryDirectives)==null?void 0:t.part)){let A;if(e.type===Oe.LEVEL&&e.level!==null?A=this.hls.levels[e.level].details:e.type===Oe.AUDIO_TRACK&&e.id!==null?A=this.hls.audioTracks[e.id].details:e.type===Oe.SUBTITLE_TRACK&&e.id!==null&&(A=this.hls.subtitleTracks[e.id].details),A){const c=A.partTarget,u=A.targetduration;if(c&&u){const h=Math.max(c*3,u*.8)*1e3;s=it({},s,{maxTimeToFirstByteMs:Math.min(h,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,s.maxTimeToFirstByteMs)})}}}const o=s.errorRetry||s.timeoutRetry||{},a={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},l={onSuccess:(A,c,u,h)=>{const d=this.getInternalLoader(u);this.resetInternalLoader(u.type);const f=A.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(A,u,new Error("no EXTM3U delimiter"),h||null,c);return}c.parsing.start=performance.now(),Ar.isMediaPlaylist(f)?this.handleTrackOrLevelPlaylist(A,c,u,h||null,d):this.handleMasterPlaylist(A,c,u,h)},onError:(A,c,u,h)=>{this.handleNetworkError(c,u,!1,A,h)},onTimeout:(A,c,u)=>{this.handleNetworkError(c,u,!0,void 0,A)}};i.load(e,a,l)}handleMasterPlaylist(e,t,n,i){const s=this.hls,o=e.data,a=ca(e,n),l=Ar.parseMasterPlaylist(o,a);if(l.playlistParsingError){this.handleManifestParsingError(e,n,l.playlistParsingError,i,t);return}const{contentSteering:A,levels:c,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:f}=l;this.variableList=f;const{AUDIO:g=[],SUBTITLES:p,"CLOSED-CAPTIONS":y}=Ar.parseMasterPlaylistMedia(o,a,l);g.length&&!g.some(b=>!b.url)&&c[0].audioCodec&&!c[0].attrs.AUDIO&&(U.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new je({}),bitrate:0,url:""})),s.trigger(I.MANIFEST_LOADED,{levels:c,audioTracks:g,subtitles:p,captions:y,contentSteering:A,url:a,stats:t,networkDetails:i,sessionData:u,sessionKeys:h,startTimeOffset:d,variableList:f})}handleTrackOrLevelPlaylist(e,t,n,i,s){const o=this.hls,{id:a,level:l,type:A}=n,c=ca(e,n),u=0,h=he(l)?l:he(a)?a:0,d=nu(n),f=Ar.parseLevelPlaylist(e.data,c,h,d,u,this.variableList);if(A===Oe.MANIFEST){const g={attrs:new je({}),bitrate:0,details:f,name:"",url:c};o.trigger(I.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:c,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=f,this.handlePlaylistLoaded(f,e,t,n,i,s)}handleManifestParsingError(e,t,n,i,s){this.hls.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:K.MANIFEST_PARSING_ERROR,fatal:t.type===Oe.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:i,stats:s})}handleNetworkError(e,t,n=!1,i,s){let o=`A network ${n?"timeout":"error"+(i?" (status "+i.code+")":"")} occurred while loading ${e.type}`;e.type===Oe.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Oe.AUDIO_TRACK||e.type===Oe.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const a=new Error(o);U.warn(`[playlist-loader]: ${o}`);let l=K.UNKNOWN,A=!1;const c=this.getInternalLoader(e);switch(e.type){case Oe.MANIFEST:l=n?K.MANIFEST_LOAD_TIMEOUT:K.MANIFEST_LOAD_ERROR,A=!0;break;case Oe.LEVEL:l=n?K.LEVEL_LOAD_TIMEOUT:K.LEVEL_LOAD_ERROR,A=!1;break;case Oe.AUDIO_TRACK:l=n?K.AUDIO_TRACK_LOAD_TIMEOUT:K.AUDIO_TRACK_LOAD_ERROR,A=!1;break;case Oe.SUBTITLE_TRACK:l=n?K.SUBTITLE_TRACK_LOAD_TIMEOUT:K.SUBTITLE_LOAD_ERROR,A=!1;break}c&&this.resetInternalLoader(e.type);const u={type:Be.NETWORK_ERROR,details:l,fatal:A,url:e.url,loader:c,context:e,error:a,networkDetails:t,stats:s};if(i){const h=(t==null?void 0:t.url)||e.url;u.response=ht({url:h,data:void 0},i)}this.hls.trigger(I.ERROR,u)}handlePlaylistLoaded(e,t,n,i,s,o){const a=this.hls,{type:l,level:A,id:c,groupId:u,deliveryDirectives:h}=i,d=ca(t,i),f=nu(i),g=typeof i.level=="number"&&f===Ee.MAIN?A:void 0;if(!e.fragments.length){const y=new Error("No Segments found in Playlist");a.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:K.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:y,reason:y.message,response:t,context:i,level:g,parent:f,networkDetails:s,stats:n});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const p=e.playlistParsingError;if(p){a.trigger(I.ERROR,{type:Be.NETWORK_ERROR,details:K.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:p,reason:p.message,response:t,context:i,level:g,parent:f,networkDetails:s,stats:n});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case Oe.MANIFEST:case Oe.LEVEL:a.trigger(I.LEVEL_LOADED,{details:e,level:g||0,id:c||0,stats:n,networkDetails:s,deliveryDirectives:h});break;case Oe.AUDIO_TRACK:a.trigger(I.AUDIO_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break;case Oe.SUBTITLE_TRACK:a.trigger(I.SUBTITLE_TRACK_LOADED,{details:e,id:c||0,groupId:u||"",stats:n,networkDetails:s,deliveryDirectives:h});break}}}function iu(r,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=r,e.dispatchEvent(t)}function su(r,e){const t=r.mode;if(t==="disabled"&&(r.mode="hidden"),r.cues&&!r.cues.getCueById(e.id))try{if(r.addCue(e),!r.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(n){U.debug(`[texttrack-utils]: ${n}`);try{const i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,r.addCue(i)}catch(i){U.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${i}`)}}t==="disabled"&&(r.mode=t)}function Cn(r){const e=r.mode;if(e==="disabled"&&(r.mode="hidden"),r.cues)for(let t=r.cues.length;t--;)r.removeCue(r.cues[t]);e==="disabled"&&(r.mode=e)}function ua(r,e,t,n){const i=r.mode;if(i==="disabled"&&(r.mode="hidden"),r.cues&&r.cues.length>0){const s=Vm(r.cues,e,t);for(let o=0;o<s.length;o++)(!n||n(s[o]))&&r.removeCue(s[o])}i==="disabled"&&(r.mode=i)}function Ym(r,e){if(e<r[0].startTime)return 0;const t=r.length-1;if(e>r[t].endTime)return-1;let n=0,i=t;for(;n<=i;){const s=Math.floor((i+n)/2);if(e<r[s].startTime)i=s-1;else if(e>r[s].startTime&&n<t)n=s+1;else return s}return r[n].startTime-e<e-r[i].startTime?n:i}function Vm(r,e,t){const n=[],i=Ym(r,e);if(i>-1)for(let s=i,o=r.length;s<o;s++){const a=r[s];if(a.startTime>=e&&a.endTime<=t)n.push(a);else if(a.startTime>t)return n}return n}function Es(r){const e=[];for(let t=0;t<r.length;t++){const n=r[t];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(r[t])}return e}var zt={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const Km=.25;function ha(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function ou(r,e,t,n,i){let s=new r(e,t,"");try{s.value=n,i&&(s.type=i)}catch{s=new r(e,t,JSON.stringify(i?ht({type:i},n):n))}return s}const Is=(()=>{const r=ha();try{r&&new r(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function da(r,e){return r.getTime()/1e3-e}function Jm(r){return Uint8Array.from(r.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class Wm{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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Cn(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 n=e[t];if(n.kind==="metadata"&&n.label==="id3")return iu(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:n,enableID3MetadataCues:i}}}=this;if(!n&&!i)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=ha();if(o)for(let a=0;a<s.length;a++){const l=s[a].type;if(l===zt.emsg&&!n||!i)continue;const A=_c(s[a].data);if(A){const c=s[a].pts;let u=c+s[a].duration;u>Is&&(u=Is),u-c<=0&&(u=c+Km);for(let d=0;d<A.length;d++){const f=A[d];if(!Dc(f)){this.updateId3CueEnds(c,l);const g=ou(o,c,u,f,l);g&&this.id3Track.addCue(g)}}}}}updateId3CueEnds(e,t){var n;const i=(n=this.id3Track)==null?void 0:n.cues;if(i)for(let s=i.length;s--;){const o=i[s];o.type===t&&o.startTime<e&&o.endTime===Is&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:i}){const{id3Track:s,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:l}}=o;if(s&&(a||l)){let A;i==="audio"?A=c=>c.type===zt.audioId3&&l:i==="video"?A=c=>c.type===zt.emsg&&a:A=c=>c.type===zt.audioId3&&l||c.type===zt.emsg&&a,ua(s,t,n,A)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:n,id3Track:i}=this,{dateRanges:s}=t,o=Object.keys(s);if(i){const c=Object.keys(n).filter(u=>!o.includes(u));for(let u=c.length;u--;){const h=c[u];Object.keys(n[h].cues).forEach(d=>{i.removeCue(n[h].cues[d])}),delete n[h]}}const a=t.fragments[t.fragments.length-1];if(o.length===0||!he(a==null?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=a.programDateTime/1e3-a.start,A=ha();for(let c=0;c<o.length;c++){const u=o[c],h=s[u],d=da(h.startDate,l),f=n[u],g=(f==null?void 0:f.cues)||{};let p=(f==null?void 0:f.durationKnown)||!1,y=Is;const Q=h.endDate;if(Q)y=da(Q,l),p=!0;else if(h.endOnNext&&!p){const C=o.reduce((w,R)=>{if(R!==h.id){const k=s[R];if(k.class===h.class&&k.startDate>h.startDate&&(!w||h.startDate<w.startDate))return k}return w},null);C&&(y=da(C.startDate,l),p=!0)}const b=Object.keys(h.attr);for(let C=0;C<b.length;C++){const w=b[C];if(!jp(w))continue;const R=g[w];if(R)p&&!f.durationKnown&&(R.endTime=y);else if(A){let k=h.attr[w];zp(w)&&(k=Jm(k));const $=ou(A,d,y,{key:w,data:k},zt.dateRange);$&&($.id=u,this.id3Track.addCue($),g[w]=$)}}n[u]={cues:g,dateRange:h,durationKnown:p}}}}class qm{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:n,targetduration:i}=e,{liveSyncDuration:s,liveSyncDurationCount:o,lowLatencyMode:a}=this.config,l=this.hls.userConfig;let A=a&&n||t;(l.liveSyncDuration||l.liveSyncDurationCount||A===0)&&(A=s!==void 0?s:o*i);const c=i;return A+Math.min(this.stallCount*1,c)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,n=this.levelDetails;if(e===null||t===null||n===null)return null;const i=n.edge,s=e-t-this.edgeStalled,o=i-n.totalduration,a=i-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(o,s),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 n=e.buffered.length;return(n?e.buffered.end(n-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(I.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 n;t.details===K.BUFFER_STALLED_ERROR&&(this.stallCount++,(n=this.levelDetails)!=null&&n.live&&U.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 n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:s}=this.config;if(!i||s===1||!t.live)return;const o=this.targetLatency;if(o===null)return;const a=n-o,l=Math.min(this.maxLatency,o+t.targetduration);if(a<l&&a>.05&&this.forwardBufferLength>1){const c=Math.min(2,Math.max(1,s)),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 fa=["NONE","TYPE-0","TYPE-1",null];function Xm(r){return fa.indexOf(r)>-1}const vs=["SDR","PQ","HLG"];function jm(r){return!!r&&vs.indexOf(r)>-1}var Cs={No:"",Yes:"YES",v2:"v2"};function au(r){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=r,i=n<e/2;return e&&i?t?Cs.v2:Cs.Yes:Cs.No}class lu{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}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 yn{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 Au(this._audioGroups,e)}hasSubtitleGroup(e){return Au(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(t)===-1&&n.push(t)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(t)===-1&&n.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 Au(r,e){return!e||!r?!1:r.indexOf(e)!==-1}function ga(r,e){const t=e.startPTS;if(he(t)){let n=0,i;e.sn>r.sn?(n=t-r.start,i=r):(n=r.start-t,i=e),i.duration!==n&&(i.duration=n)}else e.sn>r.sn?r.cc===e.cc&&r.minEndPTS?e.start=r.start+(r.minEndPTS-r.start):e.start=r.start+r.duration:e.start=Math.max(r.start-e.duration,0)}function cu(r,e,t,n,i,s){n-t<=0&&(U.warn("Fragment should have a positive duration",e),n=t+e.duration,s=i+e.duration);let a=t,l=n;const A=e.startPTS,c=e.endPTS;if(he(A)){const p=Math.abs(A-t);he(e.deltaPTS)?e.deltaPTS=Math.max(p,e.deltaPTS):e.deltaPTS=p,a=Math.max(t,A),t=Math.min(t,A),i=Math.min(i,e.startDTS),l=Math.min(n,c),n=Math.max(n,c),s=Math.max(s,e.endDTS)}const u=t-e.start;e.start!==0&&(e.start=t),e.duration=n-e.start,e.startPTS=t,e.maxStartPTS=a,e.startDTS=i,e.endPTS=n,e.minEndPTS=l,e.endDTS=s;const h=e.sn;if(!r||h<r.startSN||h>r.endSN)return 0;let d;const f=h-r.startSN,g=r.fragments;for(g[f]=e,d=f;d>0;d--)ga(g[d],g[d-1]);for(d=f;d<g.length-1;d++)ga(g[d],g[d+1]);return r.fragmentHint&&ga(g[g.length-1],r.fragmentHint),r.PTSKnown=r.alignedSliding=!0,u}function zm(r,e){let t=null;const n=r.fragments;for(let l=n.length-1;l>=0;l--){const A=n[l].initSegment;if(A){t=A;break}}r.fragmentHint&&delete r.fragmentHint.endPTS;let i=0,s;if(tE(r,e,(l,A)=>{l.relurl&&(i=l.cc-A.cc),he(l.startPTS)&&he(l.endPTS)&&(A.start=A.startPTS=l.startPTS,A.startDTS=l.startDTS,A.maxStartPTS=l.maxStartPTS,A.endPTS=l.endPTS,A.endDTS=l.endDTS,A.minEndPTS=l.minEndPTS,A.duration=l.endPTS-l.startPTS,A.duration&&(s=A),e.PTSKnown=e.alignedSliding=!0),A.elementaryStreams=l.elementaryStreams,A.loader=l.loader,A.stats=l.stats,l.initSegment&&(A.initSegment=l.initSegment,t=l.initSegment)}),t&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach(A=>{var c;A&&(!A.initSegment||A.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(A.initSegment=t)}),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some(l=>!l),e.deltaUpdateFailed){U.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let l=e.skippedSegments;l--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=Zm(r.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const o=e.fragments;if(i){U.warn("discontinuity sliding from playlist, take drift into account");for(let l=0;l<o.length;l++)o[l].cc+=i}e.skippedSegments&&(e.startCC=e.fragments[0].cc),eE(r.partList,e.partList,(l,A)=>{A.elementaryStreams=l.elementaryStreams,A.stats=l.stats}),s?cu(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):uu(r,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=r.driftStartTime,e.driftStart=r.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const l=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=l),e.driftEndTime=a,e.driftEnd=l}else e.driftEndTime=r.driftEndTime,e.driftEnd=r.driftEnd,e.advancedDateTime=r.advancedDateTime}function Zm(r,e,t){const n=it({},r);return t&&t.forEach(i=>{delete n[i]}),Object.keys(e).forEach(i=>{const s=new Tc(e[i].attr,n[i]);s.isValid?n[i]=s:U.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[i].attr)}"`)}),n}function eE(r,e,t){if(r&&e){let n=0;for(let i=0,s=r.length;i<=s;i++){const o=r[i],a=e[i+n];o&&a&&o.index===a.index&&o.fragment.sn===a.fragment.sn?t(o,a):n--}}}function tE(r,e,t){const n=e.skippedSegments,i=Math.max(r.startSN,e.startSN)-e.startSN,s=(r.fragmentHint?1:0)+(n?e.endSN:Math.min(r.endSN,e.endSN))-e.startSN,o=e.startSN-r.startSN,a=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=r.fragmentHint?r.fragments.concat(r.fragmentHint):r.fragments;for(let A=i;A<=s;A++){const c=l[o+A];let u=a[A];n&&!u&&A<n&&(u=e.fragments[A]=c),c&&u&&t(c,u)}}function uu(r,e){const t=e.startSN+e.skippedSegments-r.startSN,n=r.fragments;t<0||t>=n.length||pa(e,n[t].start)}function pa(r,e){if(e){const t=r.fragments;for(let n=r.skippedSegments;n<t.length;n++)t[n].start+=e;r.fragmentHint&&(r.fragmentHint.start+=e)}}function rE(r,e=1/0){let t=1e3*r.targetduration;if(r.updated){const n=r.fragments;if(n.length&&t*4>e){const s=n[n.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function nE(r,e,t){if(!(r!=null&&r.details))return null;const n=r.details;let i=n.fragments[e-n.startSN];return i||(i=n.fragmentHint,i&&i.sn===e)?i:e<n.startSN&&t&&t.sn===e?t:null}function hu(r,e,t){var n;return r!=null&&r.details?du((n=r.details)==null?void 0:n.partList,e,t):null}function du(r,e,t){if(r)for(let n=r.length;n--;){const i=r[n];if(i.index===t&&i.fragment.sn===e)return i}return null}function fu(r){r.forEach((e,t)=>{const{details:n}=e;n!=null&&n.fragments&&n.fragments.forEach(i=>{i.level=t})})}function ys(r){switch(r.details){case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_TIMEOUT:case K.LEVEL_LOAD_TIMEOUT:case K.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function gu(r,e){const t=ys(e);return r.default[`${t?"timeout":"error"}Retry`]}function ma(r,e){const t=r.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*r.retryDelayMs,r.maxRetryDelayMs)}function pu(r){return ht(ht({},r),{errorRetry:null,timeoutRetry:null})}function Bs(r,e,t,n){if(!r)return!1;const i=n==null?void 0:n.code,s=e<r.maxNumRetry&&(iE(i)||!!t);return r.shouldRetry?r.shouldRetry(r,e,t,n,s):s}function iE(r){return r===0&&navigator.onLine===!1||!!r&&(r<400||r>499)}const mu={search:function(r,e){let t=0,n=r.length-1,i=null,s=null;for(;t<=n;){i=(t+n)/2|0,s=r[i];const o=e(s);if(o>0)t=i+1;else if(o<0)n=i-1;else return s}return null}};function sE(r,e,t){if(e===null||!Array.isArray(r)||!r.length||!he(e))return null;const n=r[0].programDateTime;if(e<(n||0))return null;const i=r[r.length-1].endProgramDateTime;if(e>=(i||0))return null;t=t||0;for(let s=0;s<r.length;++s){const o=r[s];if(aE(e,t,o))return o}return null}function Ts(r,e,t=0,n=0,i=.005){let s=null;if(r){s=e[r.sn-e[0].sn+1]||null;const a=r.endDTS-t;a>0&&a<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!r||r.level===s.level)&&Ea(t,n,s)===0||oE(s,r,Math.min(i,n))))return s;const o=mu.search(e,Ea.bind(null,t,n));return o&&(o!==r||!s)?o:s}function oE(r,e,t){if(e&&e.start===0&&e.level<r.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((i,s)=>(s[0]==="INF"&&(i+=parseFloat(s[1])),i),t);return r.start<=n}return!1}function Ea(r=0,e=0,t){if(t.start<=r&&t.start+t.duration>r)return 0;const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-n<=r?1:t.start-n>r&&t.start?-1:0}function aE(r,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>r}function lE(r,e){return mu.search(r,t=>t.cc<e?1:t.cc>e?-1:0)}var Bt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Zt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class AE{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=U.log.bind(U,"[info]:"),this.warn=U.warn.bind(U,"[warning]:"),this.error=U.error.bind(U,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(I.ERROR,this.onError,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(I.ERROR,this.onError,this),e.off(I.ERROR,this.onErrorOut,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===Ee.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var n,i;if(t.fatal)return;const s=this.hls,o=t.context;switch(t.details){case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case K.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction={action:Bt.DoNothing,flags:Zt.None};return}case K.FRAG_GAP:case K.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Bt.SendAlternateToPenaltyBox;return}case K.LEVEL_EMPTY_ERROR:case K.LEVEL_PARSING_ERROR:{var a,l;const A=t.parent===Ee.MAIN?t.level:s.loadLevel;t.details===K.LEVEL_EMPTY_ERROR&&((a=t.context)!=null&&(l=a.levelDetails)!=null&&l.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,A):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,A))}return;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:typeof(o==null?void 0:o.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level));return;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.SUBTITLE_LOAD_ERROR:case K.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){const A=s.levels[s.loadLevel];if(A&&(o.type===Oe.AUDIO_TRACK&&A.hasAudioGroup(o.groupId)||o.type===Oe.SUBTITLE_TRACK&&A.hasSubtitleGroup(o.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.loadLevel),t.errorAction.action=Bt.SendAlternateToPenaltyBox,t.errorAction.flags=Zt.MoveAllAlternatesMatchingHost;return}}return;case K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const A=s.levels[s.loadLevel],c=A==null?void 0:A.attrs["HDCP-LEVEL"];c?t.errorAction={action:Bt.SendAlternateToPenaltyBox,flags:Zt.MoveAllAlternatesMatchingHDCP,hdcpLevel:c}:this.keySystemError(t)}return;case K.BUFFER_ADD_CODEC_ERROR:case K.REMUX_ALLOC_ERROR:case K.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(i=t.level)!=null?i:s.loadLevel);return;case K.INTERNAL_EXCEPTION:case K.BUFFER_APPENDING_ERROR:case K.BUFFER_FULL_ERROR:case K.LEVEL_SWITCH_ERROR:case K.BUFFER_STALLED_ERROR:case K.BUFFER_SEEK_OVER_HOLE:case K.BUFFER_NUDGE_ON_STALL:t.errorAction={action:Bt.DoNothing,flags:Zt.None};return}t.type===Be.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 n=this.hls,i=gu(n.config.playlistLoadPolicy,e),s=this.playlistError++;if(Bs(i,s,ys(e),e.response))return{action:Bt.RetryRequest,flags:Zt.None,retryConfig:i,retryCount:s};const a=this.getLevelSwitchAction(e,t);return i&&(a.retryConfig=i,a.retryCount=s),a}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),i=t.levels[n],{fragLoadPolicy:s,keyLoadPolicy:o}=t.config,a=gu(e.details.startsWith("key")?o:s,e),l=t.levels.reduce((c,u)=>c+u.fragmentError,0);if(i&&(e.details!==K.FRAG_GAP&&i.fragmentError++,Bs(a,l,ys(e),e.response)))return{action:Bt.RetryRequest,flags:Zt.None,retryConfig:a,retryCount:l};const A=this.getLevelSwitchAction(e,n);return a&&(A.retryConfig=a,A.retryCount=l),A}getLevelSwitchAction(e,t){const n=this.hls;t==null&&(t=n.loadLevel);const i=this.hls.levels[t];if(i){var s,o;const A=e.details;i.loadError++,A===K.BUFFER_APPEND_ERROR&&i.fragmentError++;let c=-1;const{levels:u,loadLevel:h,minAutoLevel:d,maxAutoLevel:f}=n;n.autoLevelEnabled||(n.loadLevel=-1);const g=(s=e.frag)==null?void 0:s.type,y=(g===Ee.AUDIO&&A===K.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(A===K.BUFFER_ADD_CODEC_ERROR||A===K.BUFFER_APPEND_ERROR))&&u.some(({audioCodec:R})=>i.audioCodec!==R),b=e.sourceBufferName==="video"&&(A===K.BUFFER_ADD_CODEC_ERROR||A===K.BUFFER_APPEND_ERROR)&&u.some(({codecSet:R,audioCodec:k})=>i.codecSet!==R&&i.audioCodec===k),{type:C,groupId:w}=(o=e.context)!=null?o:{};for(let R=u.length;R--;){const k=(R+h)%u.length;if(k!==h&&k>=d&&k<=f&&u[k].loadError===0){var a,l;const $=u[k];if(A===K.FRAG_GAP&&g===Ee.MAIN&&e.frag){const V=u[k].details;if(V){const O=Ts(e.frag,V.fragments,e.frag.start);if(O!=null&&O.gap)continue}}else{if(C===Oe.AUDIO_TRACK&&$.hasAudioGroup(w)||C===Oe.SUBTITLE_TRACK&&$.hasSubtitleGroup(w))continue;if(g===Ee.AUDIO&&(a=i.audioGroups)!=null&&a.some(V=>$.hasAudioGroup(V))||g===Ee.SUBTITLE&&(l=i.subtitleGroups)!=null&&l.some(V=>$.hasSubtitleGroup(V))||y&&i.audioCodec===$.audioCodec||!y&&i.audioCodec!==$.audioCodec||b&&i.codecSet===$.codecSet)continue}c=k;break}}if(c>-1&&n.loadLevel!==c)return e.levelRetry=!0,this.playlistError=0,{action:Bt.SendAlternateToPenaltyBox,flags:Zt.None,nextAutoLevel:c}}return{action:Bt.SendAlternateToPenaltyBox,flags:Zt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case Bt.DoNothing:break;case Bt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==K.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,n=e.errorAction;if(!n)return;const{flags:i,hdcpLevel:s,nextAutoLevel:o}=n;switch(i){case Zt.None:this.switchLevel(e,o);break;case Zt.MoveAllAlternatesMatchingHDCP:s&&(t.maxHdcpLevel=fa[fa.indexOf(s)-1],n.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}n.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 Ia{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=U.log.bind(U,`${t}:`),this.warn=U.warn.bind(U,`${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,n){const i=t==null?void 0:t.renditionReports;if(i){let s=-1;for(let o=0;o<i.length;o++){const a=i[o];let l;try{l=new self.URL(a.URI,t.url).href}catch(A){U.warn(`Could not construct new URL for Rendition Report: ${A}`),l=a.URI||""}if(l===e){s=o;break}else l===e.substring(0,l.length)&&(s=o)}if(s!==-1){const o=i[s],a=parseInt(o["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let l=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);l>=0&&c>t.partTarget&&(l+=1)}const A=n&&au(n);return new lu(a,l>=0?l:void 0,A)}}}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,n){const{details:i,stats:s}=t,o=self.performance.now(),a=s.loading.first?Math.max(0,o-s.loading.first):0;if(i.advancedDateTime=Date.now()-a,i.live||n!=null&&n.live){if(i.reloaded(n),n&&this.log(`live playlist ${e} ${i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED"}`),n&&i.fragments.length>0&&zm(n,i),!this.canLoad||!i.live)return;let l,A,c;if(i.canBlockReload&&i.endSN&&i.advanced){const p=this.hls.config.lowLatencyMode,y=i.lastPartSn,Q=i.endSN,b=i.lastPartIndex,C=b!==-1,w=y===Q,R=p?0:b;C?(A=w?Q+1:y,c=w?R:b+1):A=Q+1;const k=i.age,$=k+i.ageHeader;let V=Math.min($-i.partTarget,i.targetduration*1.5);if(V>0){if(n&&V>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${V} with playlist age: ${i.age}`),V=0;else{const O=Math.floor(V/i.targetduration);if(A+=O,c!==void 0){const W=Math.round(V%i.targetduration/i.partTarget);c+=W}this.log(`CDN Tune-in age: ${i.ageHeader}s last advanced ${k.toFixed(2)}s goal: ${V} skip sn ${O} to part ${c}`)}i.tuneInGoal=V}if(l=this.getDeliveryDirectives(i,t.deliveryDirectives,A,c),p||!w){this.loadPlaylist(l);return}}else(i.canBlockReload||i.canSkipUntil)&&(l=this.getDeliveryDirectives(i,t.deliveryDirectives,A,c));const u=this.hls.mainForwardBufferInfo,h=u?u.end-u.len:0,d=(i.edge-h)*1e3,f=rE(i,d);i.updated&&o>this.requestScheduled+f&&(this.requestScheduled=s.loading.start),A!==void 0&&i.canBlockReload?this.requestScheduled=s.loading.first+f-(i.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+f<o?this.requestScheduled=o:this.requestScheduled-o<=0&&(this.requestScheduled+=f);let g=this.requestScheduled-o;g=Math.max(0,g),this.log(`reload live playlist ${e} in ${Math.round(g)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(l),g)}else this.clearTimer()}getDeliveryDirectives(e,t,n,i){let s=au(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,i=t.part,s=Cs.No),new lu(n,i,s)}checkRetry(e){const t=e.details,n=ys(e),i=e.errorAction,{action:s,retryCount:o=0,retryConfig:a}=i||{},l=!!i&&!!a&&(s===Bt.RetryRequest||!i.resolved&&s===Bt.SendAlternateToPenaltyBox);if(l){var A;if(this.requestScheduled=-1,o>=a.maxNumRetry)return!1;if(n&&(A=e.context)!=null&&A.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${a.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const c=ma(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,i.resolved=!0}return l}}class Bn{constructor(e,t=0,n=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_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*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 cE{constructor(e,t,n,i=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_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Bn(e),this.fast_=new Bn(t),this.defaultTTFB_=i,this.ttfb_=new Bn(e)}update(e,t){const{slow_:n,fast_:i,ttfb_:s}=this;n.halfLife!==e&&(this.slow_=new Bn(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.fast_=new Bn(t,i.getEstimate(),i.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new Bn(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const n=8*t,i=e/1e3,s=n/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,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 Eu={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Iu={};function uE(r,e,t,n,i,s){const o=r.audioCodec?r.audioGroups:null,a=s==null?void 0:s.audioCodec,l=s==null?void 0:s.channels,A=l?parseInt(l):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(f=>{u[f]=(u[f]||0)+d.channels[f]})}return u},{2:0})}catch{return!0}return r.videoCodec!==void 0&&(r.width>1920&&r.height>1088||r.height>1920&&r.width>1088||r.frameRate>Math.max(n,30)||r.videoRange!=="SDR"&&r.videoRange!==t||r.bitrate>Math.max(i,8e6))||!!c&&he(A)&&Object.keys(c).some(u=>parseInt(u)>A)}function hE(r,e,t){const n=r.videoCodec,i=r.audioCodec;if(!n||!i||!t)return Promise.resolve(Eu);const s={width:r.width,height:r.height,bitrate:Math.ceil(Math.max(r.bitrate*.9,r.averageBitrate)),framerate:r.frameRate||30},o=r.videoRange;o!=="SDR"&&(s.transferFunction=o.toLowerCase());const a=n.split(",").map(l=>({type:"media-source",video:ht(ht({},s),{},{contentType:di(l,"video")})}));return i&&r.audioGroups&&r.audioGroups.forEach(l=>{var A;l&&((A=e.groups[l])==null||A.tracks.forEach(c=>{if(c.groupId===l){const u=c.channels||"",h=parseFloat(u);he(h)&&h>2&&a.push.apply(a,i.split(",").map(d=>({type:"media-source",audio:{contentType:di(d,"audio"),channels:""+h}})))}}))}),Promise.all(a.map(l=>{const A=dE(l);return Iu[A]||(Iu[A]=t.decodingInfo(l))})).then(l=>({supported:!l.some(A=>!A.supported),configurations:a,decodingInfoResults:l})).catch(l=>({supported:!1,configurations:a,decodingInfoResults:[],error:l}))}function dE(r){const{audio:e,video:t}=r,n=t||e;if(n){const i=n.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${i}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${i}`}return""}function fE(){if(typeof matchMedia=="function"){const r=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(r.media!==e.media)return r.matches===!0}return!1}function gE(r,e){let t=!1,n=[];return r&&(t=r!=="SDR",n=[r]),e&&(n=e.allowedVideoRanges||vs.slice(0),t=e.preferHDR!==void 0?e.preferHDR:fE(),t?n=n.filter(i=>i!=="SDR"):n=["SDR"]),{preferHDR:t,allowedVideoRanges:n}}function pE(r,e,t,n,i){const s=Object.keys(r),o=n==null?void 0:n.channels,a=n==null?void 0:n.audioCodec,l=o&&parseInt(o)===2;let A=!0,c=!1,u=1/0,h=1/0,d=1/0,f=0,g=[];const{preferHDR:p,allowedVideoRanges:y}=gE(e,i);for(let w=s.length;w--;){const R=r[s[w]];A=R.channels[2]>0,u=Math.min(u,R.minHeight),h=Math.min(h,R.minFramerate),d=Math.min(d,R.minBitrate);const k=y.filter($=>R.videoRanges[$]>0);k.length>0&&(c=!0,g=k)}u=he(u)?u:0,h=he(h)?h:0;const Q=Math.max(1080,u),b=Math.max(30,h);return d=he(d)?d:t,t=Math.max(d,t),c||(e=void 0,g=[]),{codecSet:s.reduce((w,R)=>{const k=r[R];if(R===w)return w;if(k.minBitrate>t)return Tr(R,`min bitrate of ${k.minBitrate} > current estimate of ${t}`),w;if(!k.hasDefaultAudio)return Tr(R,"no renditions with default or auto-select sound found"),w;if(a&&R.indexOf(a.substring(0,4))%5!==0)return Tr(R,`audio codec preference "${a}" not found`),w;if(o&&!l){if(!k.channels[o])return Tr(R,`no renditions with ${o} channel sound found (channels options: ${Object.keys(k.channels)})`),w}else if((!a||l)&&A&&k.channels[2]===0)return Tr(R,"no renditions with stereo sound found"),w;return k.minHeight>Q?(Tr(R,`min resolution of ${k.minHeight} > maximum of ${Q}`),w):k.minFramerate>b?(Tr(R,`min framerate of ${k.minFramerate} > maximum of ${b}`),w):g.some($=>k.videoRanges[$]>0)?k.maxScore<f?(Tr(R,`max score of ${k.maxScore} < selected max of ${f}`),w):w&&(ps(R)>=ps(w)||k.fragmentError>r[w].fragmentError)?w:(f=k.maxScore,R):(Tr(R,`no variants with VIDEO-RANGE of ${JSON.stringify(g)} found`),w)},void 0),videoRanges:g,preferHDR:p,minFramerate:h,minBitrate:d}}function Tr(r,e){U.log(`[abr] start candidates with "${r}" ignored because ${e}`)}function mE(r){return r.reduce((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const i=t.channels||"2";return n.channels[i]=(n.channels[i]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function EE(r,e,t,n){return r.slice(t,n+1).reduce((i,s)=>{if(!s.codecSet)return i;const o=s.audioGroups;let a=i[s.codecSet];a||(i[s.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,s.bitrate);const l=Math.min(s.height,s.width);return a.minHeight=Math.min(a.minHeight,l),a.minFramerate=Math.min(a.minFramerate,s.frameRate),a.maxScore=Math.max(a.maxScore,s.score),a.fragmentError+=s.fragmentError,a.videoRanges[s.videoRange]=(a.videoRanges[s.videoRange]||0)+1,o&&o.forEach(A=>{if(!A)return;const c=e.groups[A];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]}))}),i},{})}function cr(r,e,t){if("attrs"in r){const n=e.indexOf(r);if(n!==-1)return n}for(let n=0;n<e.length;n++){const i=e[n];if(Tn(r,i,t))return n}return-1}function Tn(r,e,t){const{groupId:n,name:i,lang:s,assocLang:o,characteristics:a,default:l}=r,A=r.forced;return(n===void 0||e.groupId===n)&&(i===void 0||e.name===i)&&(s===void 0||e.lang===s)&&(s===void 0||e.assocLang===o)&&(l===void 0||e.default===l)&&(A===void 0||e.forced===A)&&(a===void 0||IE(a,e.characteristics))&&(t===void 0||t(r,e))}function IE(r,e=""){const t=r.split(","),n=e.split(",");return t.length===n.length&&!t.some(i=>n.indexOf(i)===-1)}function Qn(r,e){const{audioCodec:t,channels:n}=r;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function vE(r,e,t,n,i){const s=e[n],a=e.reduce((h,d,f)=>{const g=d.uri;return(h[g]||(h[g]=[])).push(f),h},{})[s.uri];a.length>1&&(n=Math.max.apply(Math,a));const l=s.videoRange,A=s.frameRate,c=s.codecSet.substring(0,4),u=vu(e,n,h=>{if(h.videoRange!==l||h.frameRate!==A||h.codecSet.substring(0,4)!==c)return!1;const d=h.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return cr(r,f,i)>-1});return u>-1?u:vu(e,n,h=>{const d=h.audioGroups,f=t.filter(g=>!d||d.indexOf(g.groupId)!==-1);return cr(r,f,i)>-1})}function vu(r,e,t){for(let n=e;n;n--)if(t(r[n]))return n;for(let n=e+1;n<r.length;n++)if(t(r[n]))return n;return-1}class CE{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:n,hls:i}=this,{autoLevelEnabled:s,media:o}=i;if(!t||!o)return;const a=performance.now(),l=n?n.stats:t.stats,A=n?n.duration:t.duration,c=a-l.loading.start,u=i.minAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||t.level<=u){this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||o.paused||!o.playbackRate||!o.readyState)return;const h=i.mainForwardBufferInfo;if(h===null)return;const d=this.bwEstimator.getEstimateTTFB(),f=Math.abs(o.playbackRate);if(c<=Math.max(d,1e3*(A/(f*2))))return;const g=h.len/f,p=l.loading.first?l.loading.first-l.loading.start:-1,y=l.loaded&&p>-1,Q=this.getBwEstimate(),b=i.levels,C=b[t.level],w=l.total||Math.max(l.loaded,Math.round(A*C.averageBitrate/8));let R=y?c-p:c;R<1&&y&&(R=Math.min(c,l.loaded*8/Q));const k=y?l.loaded*1e3/R:0,$=k?(w-l.loaded)/k:w*8/Q+d/1e3;if($<=g)return;const V=k?k*8:Q;let O=Number.POSITIVE_INFINITY,W;for(W=t.level-1;W>u;W--){const te=b[W].maxBitrate;if(O=this.getTimeToLoadFrag(d/1e3,V,A*te,!b[W].details),O<g)break}if(O>=$||O>A*10)return;i.nextLoadLevel=i.nextAutoLevel=W,y?this.bwEstimator.sample(c-Math.min(d,p),l.loaded):this.bwEstimator.sampleTTFB(c);const ie=b[W].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>ie&&this.resetEstimator(ie),this.clearTimer(),U.warn(`[abr] Fragment ${t.sn}${n?" part "+n.index:""} of level ${t.level} is loading too slowly;
2464
2464
  Time to underbuffer: ${g.toFixed(3)} s
2465
2465
  Estimated load time for current fragment: ${$.toFixed(3)} s
2466
2466
  Estimated load time for down switch fragment: ${O.toFixed(3)} s
2467
2467
  TTFB estimate: ${p|0} ms
2468
2468
  Current BW estimate: ${he(Q)?Q|0:"Unknown"} bps
2469
2469
  New BW estimate: ${this.getBwEstimate()|0} bps
2470
- Switching to level ${J} @ ${ie|0} bps`),i.trigger(I.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:n,stats:l})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(U.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 cE(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.FRAG_LOADING,this.onFragLoading,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.FRAG_LOADING,this.onFragLoading,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(I.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 n=t.frag;if(!this.ignoreFragment(n)){if(!n.bitrateTest){var i;this.fragCurrent=n,this.partCurrent=(i=t.part)!=null?i: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 V.BUFFER_ADD_CODEC_ERROR:case V.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case V.FRAG_LOAD_TIMEOUT:{const n=t.frag,{fragCurrent:i,partCurrent:s}=this;if(n&&i&&n.sn===i.sn&&n.level===i.level){const o=performance.now(),a=s?s.stats:n.stats,l=o-a.loading.start,A=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&A>-1){const u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(u,A),a.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,n,i){const s=e+n/t,o=i?this.lastLevelLoadSec:0;return s+o}onLevelLoaded(e,t){const n=this.hls.config,{loading:i}=t.stats,s=i.end-i.start;he(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:n}){const i=n?n.stats:t.stats;if(t.type===Ee.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=n?n.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+i.loaded,l=(o.loaded?o.loaded.duration:0)+s;o.loaded={bytes:a,duration:l},o.realBitrate=Math.round(8*a/l)}if(t.bitrateTest){const s={stats:i,frag:t,part:n,id:t.type};this.onFragBuffered(I.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:i}=t,s=i!=null&&i.stats.loaded?i.stats:n.stats;if(s.aborted||this.ignoreFragment(n))return;const o=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,s.loaded),s.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Ee.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,s=this.findBestLevel(n,t,e,0,i,1,1);if(s>-1)return s;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return U.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,n=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=n&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,s)&&o[e].loadError<=o[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:n}=this,{maxAutoLevel:i,config:s,minAutoLevel:o}=n,a=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),A=this.getStarvationDelay();let c=s.abrBandWidthFactor,u=s.abrBandWidthUpFactor;if(A){const p=this.findBestLevel(l,o,i,A,0,c,u);if(p>=0)return p}let h=a?Math.min(a,s.maxStarvationDelay):s.maxStarvationDelay;if(!A){const p=this.bitrateTestDelay;p&&(h=(a?Math.min(a,s.maxLoadingDelay):s.maxLoadingDelay)-p,U.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(l,o,i,A,h,c,u);if(U.info(`[abr] ${A?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`),d>-1)return d;const f=n.levels[o],g=n.levels[n.loadLevel];return(f==null?void 0:f.bitrate)<(g==null?void 0:g.bitrate)?o:n.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,i,s,o,a){var l;const A=i+s,c=this.lastLoadedFragLevel,u=c===-1?this.hls.firstLevel:c,{fragCurrent:h,partCurrent:d}=this,{levels:f,allAudioTracks:g,loadLevel:p,config:C}=this.hls;if(f.length===1)return 0;const Q=f[u],b=!!(Q!=null&&(l=Q.details)!=null&&l.live),y=p===-1||c===-1;let w,R="SDR",k=(Q==null?void 0:Q.frameRate)||0;const{audioPreference:$,videoPreference:K}=C,O=this.audioTracksByGroup||(this.audioTracksByGroup=mE(g));if(y){if(this.firstSelection!==-1)return this.firstSelection;const _=this.codecTiers||(this.codecTiers=EE(f,O,t,n)),P=pE(_,R,e,$,K),{codecSet:X,videoRanges:D,minFramerate:S,minBitrate:F,preferHDR:W}=P;w=X,R=W?D[D.length-1]:D[0],k=S,e=Math.max(e,F),U.log(`[abr] picked start tier ${JSON.stringify(P)}`)}else w=Q==null?void 0:Q.codecSet,R=Q==null?void 0:Q.videoRange;const J=d?d.duration:h?h.duration:0,ie=this.bwEstimator.getEstimateTTFB()/1e3,ee=[];for(let _=n;_>=t;_--){var le;const P=f[_],X=_>u;if(!P)continue;if(C.useMediaCapabilities&&!P.supportedResult&&!P.supportedPromise){const ce=navigator.mediaCapabilities;typeof(ce==null?void 0:ce.decodingInfo)=="function"&&uE(P,O,R,k,e,$)?(P.supportedPromise=hE(P,O,ce),P.supportedPromise.then(pe=>{if(!this.hls)return;P.supportedResult=pe;const ge=this.hls.levels,Se=ge.indexOf(P);pe.error?U.warn(`[abr] MediaCapabilities decodingInfo error: "${pe.error}" for level ${Se} ${JSON.stringify(pe)}`):pe.supported||(U.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${Se} ${JSON.stringify(pe)}`),Se>-1&&ge.length>1&&(U.log(`[abr] Removing unsupported level ${Se}`),this.hls.removeLevel(Se)))})):P.supportedResult=Eu}if(w&&P.codecSet!==w||R&&P.videoRange!==R||X&&k>P.frameRate||!X&&k>0&&k<P.frameRate||P.supportedResult&&!((le=P.supportedResult.decodingInfoResults)!=null&&le[0].smooth)){ee.push(_);continue}const D=P.details,S=(d?D==null?void 0:D.partTarget:D==null?void 0:D.averagetargetduration)||J;let F;X?F=a*e:F=o*e;const W=J&&i>=J*2&&s===0?f[_].averageBitrate:f[_].maxBitrate,Y=this.getTimeToLoadFrag(ie,F,W*S,D===void 0);if(F>=W&&(_===c||P.loadError===0&&P.fragmentError===0)&&(Y<=ie||!he(Y)||b&&!this.bitrateTestDelay||Y<A)){const ce=this.forcedAutoLevel;return _!==p&&(ce===-1||ce!==p)&&(ee.length&&U.trace(`[abr] Skipped level(s) ${ee.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${f[ee[0]].codecs}" ${f[ee[0]].videoRange}; not compatible with "${Q.codecs}" ${R}`),U.info(`[abr] switch candidate:${u}->${_} adjustedbw(${Math.round(F)})-bitrate=${Math.round(F-W)} ttfb:${ie.toFixed(1)} avgDuration:${S.toFixed(1)} maxFetchDuration:${A.toFixed(1)} fetchDuration:${Y.toFixed(1)} firstSelection:${y} codecSet:${w} videoRange:${R} hls.loadLevel:${p}`)),y&&(this.firstSelection=_),_}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls,i=Math.min(Math.max(e,n),t);this._nextAutoLevel!==i&&(this.nextAutoLevelKey="",this._nextAutoLevel=i)}}class yE{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 dt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class BE{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(I.BUFFER_APPENDED,this.onBufferAppended,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.BUFFER_APPENDED,this.onBufferAppended,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const n=this.activePartLists[t];if(n)for(let i=n.length;i--;){const s=n[i];if(!s)break;const o=s.end;if(s.start<=e&&o!==null&&e<=o)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:n}=this,i=Object.keys(n);for(let s=i.length;s--;){const o=n[i[s]];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,n,i){this.timeRanges&&(this.timeRanges[e]=t);const s=(i==null?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a||s>=a.body.sn)return;if(!a.buffered&&!a.loaded){a.body.type===n&&this.removeFragment(a.body);return}const l=a.range[e];l&&l.time.some(A=>{const c=!this.isTimeBuffered(A.startPTS,A.endPTS,t);return c&&this.removeFragment(a.body),c})})}detectPartialFragments(e){const t=this.timeRanges,{frag:n,part:i}=e;if(!t||n.sn==="initSegment")return;const s=bn(n),o=this.fragments[s];if(!o||o.buffered&&n.gap)return;const a=!n.relurl;Object.keys(t).forEach(l=>{const A=n.elementaryStreams[l];if(!A)return;const c=t[l],u=a||A.partial===!0;o.range[l]=this.getBufferedTimes(n,i,u,c)}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=n.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),Qs(o)||this.removeParts(n.sn-1,n.type)):this.removeFragment(o.body)}removeParts(e,t){const n=this.activePartLists[t];n&&(this.activePartLists[t]=n.filter(i=>i.fragment.sn>=e))}fragBuffered(e,t){const n=bn(e);let i=this.fragments[n];!i&&t&&(i=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(e,t,n,i){const s={time:[],partial:n},o=e.start,a=e.end,l=e.minEndPTS||a,A=e.maxStartPTS||o;for(let c=0;c<i.length;c++){const u=i.start(c)-this.bufferPadding,h=i.end(c)+this.bufferPadding;if(A>=u&&l<=h){s.time.push({startPTS:Math.max(o,i.start(c)),endPTS:Math.min(a,i.end(c))});break}else if(o<h&&a>u){const d=Math.max(o,i.start(c)),f=Math.min(a,i.end(c));f>d&&(s.partial=!0,s.time.push({startPTS:d,endPTS:f}))}else if(a<=u)break}return s}getPartialFragment(e){let t=null,n,i,s,o=0;const{bufferPadding:a,fragments:l}=this;return Object.keys(l).forEach(A=>{const c=l[A];c&&Qs(c)&&(i=c.body.start-a,s=c.body.end+a,e>=i&&e<=s&&(n=Math.min(e-i,s-e),o<=n&&(t=c.body,o=n)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Qs(t))}getState(e){const t=bn(e),n=this.fragments[t];return n?n.buffered?Qs(n)?dt.PARTIAL:dt.OK:dt.APPENDING:dt.NOT_LOADED}isTimeBuffered(e,t,n){let i,s;for(let o=0;o<n.length;o++){if(i=n.start(o)-this.bufferPadding,s=n.end(o)+this.bufferPadding,e>=i&&t<=s)return!0;if(t<=i)return!1}return!1}onFragLoaded(e,t){const{frag:n,part:i}=t;if(n.sn==="initSegment"||n.bitrateTest)return;const s=i?null:t,o=bn(n);this.fragments[o]={body:n,appendedPTS:null,loaded:s,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:n,part:i,timeRanges:s}=t;if(n.sn==="initSegment")return;const o=n.type;if(i){let a=this.activePartLists[o];a||(this.activePartLists[o]=a=[]),a.push(i)}this.timeRanges=s,Object.keys(s).forEach(a=>{const l=s[a];this.detectEvictedFragments(a,l,o,i)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=bn(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,n,i,s){i&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const l=a.body;l.type!==n||i&&!l.gap||l.start<t&&l.end>e&&(a.buffered||s)&&this.removeFragment(l)})}removeFragment(e){const t=bn(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const i=e.sn;this.activePartLists[e.type]=n.filter(s=>s.fragment.sn!==i)}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 Qs(r){var e,t,n;return r.buffered&&(r.body.gap||((e=r.range.video)==null?void 0:e.partial)||((t=r.range.audio)==null?void 0:t.partial)||((n=r.range.audiovideo)==null?void 0:n.partial))}function bn(r){return`${r.type}_${r.level}_${r.sn}`}const TE={length:0,start:()=>0,end:()=>0};class Ke{static isBuffered(e,t){try{if(e){const n=Ke.getBuffered(e);for(let i=0;i<n.length;i++)if(t>=n.start(i)&&t<=n.end(i))return!0}}catch{}return!1}static bufferInfo(e,t,n){try{if(e){const i=Ke.getBuffered(e),s=[];let o;for(o=0;o<i.length;o++)s.push({start:i.start(o),end:i.end(o)});return this.bufferedInfo(s,t,n)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.sort(function(A,c){const u=A.start-c.start;return u||c.end-A.end});let i=[];if(n)for(let A=0;A<e.length;A++){const c=i.length;if(c){const u=i[c-1].end;e[A].start-u<n?e[A].end>u&&(i[c-1].end=e[A].end):i.push(e[A])}else i.push(e[A])}else i=e;let s=0,o,a=t,l=t;for(let A=0;A<i.length;A++){const c=i[A].start,u=i[A].end;if(t+n>=c&&t<u)a=c,l=u,s=l-t;else if(t+n<c){o=c;break}}return{len:s,start:a||0,end:l||0,nextStart:o}}static getBuffered(e){try{return e.buffered}catch(t){return U.log("failed to get media.buffered",t),TE}}}class va{constructor(e,t,n,i=0,s=-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=bs(),this.buffering={audio:bs(),video:bs(),audiovideo:bs()},this.level=e,this.sn=t,this.id=n,this.size=i,this.part=s,this.partial=o}}function bs(){return{start:0,executeStart:0,executeEnd:0,end:0}}function xs(r,e){for(let n=0,i=r.length;n<i;n++){var t;if(((t=r[n])==null?void 0:t.cc)===e)return r[n]}return null}function QE(r,e,t){return!!(e&&(t.endCC>t.startCC||r&&r.cc<t.startCC))}function bE(r,e){const t=r.fragments,n=e.fragments;if(!n.length||!t.length){U.log("No fragments to align");return}const i=xs(t,n[0].cc);if(!i||i&&!i.startPTS){U.log("No frag in previous level to align on");return}return i}function Cu(r,e){if(r){const t=r.start+e;r.start=r.startPTS=t,r.endPTS=t+r.duration}}function yu(r,e){const t=e.fragments;for(let n=0,i=t.length;n<i;n++)Cu(t[n],r);e.fragmentHint&&Cu(e.fragmentHint,r),e.alignedSliding=!0}function xE(r,e,t){e&&(wE(r,t,e),!t.alignedSliding&&e&&ws(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&uu(e,t))}function wE(r,e,t){if(QE(r,t,e)){const n=bE(t,e);n&&he(n.start)&&(U.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),yu(n.start,e))}}function ws(r,e){if(!r.hasProgramDateTime||!e.hasProgramDateTime)return;const t=r.fragments,n=e.fragments;if(!t.length||!n.length)return;let i,s;const o=Math.min(e.endCC,r.endCC);e.startCC<o&&r.startCC<o&&(i=xs(n,o),s=xs(t,o)),(!i||!s)&&(i=n[Math.floor(n.length/2)],s=xs(t,i.cc)||t[Math.floor(t.length/2)]);const a=i.programDateTime,l=s.programDateTime;if(!a||!l)return;const A=(l-a)/1e3-(s.start-i.start);yu(A,r)}const Bu=Math.pow(2,17);class SE{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 n=e.url;if(!n)return Promise.reject(new Qr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,s=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(d=>d[0]==="GAP")){l(Qu(e));return}else e.gap=!1;const A=this.loader=e.loader=s?new s(i):new o(i),c=Tu(e),u=pu(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Bu};e.stats=A.stats,A.load(c,h,{onSuccess:(d,f,g,p)=>{this.resetLoader(e,A);let C=d.data;g.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(C.slice(0,16)),C=C.slice(16)),a({frag:e,part:null,payload:C,networkDetails:p})},onError:(d,f,g,p)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:ht({url:n,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:g,stats:p}))},onAbort:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:d}))},onTimeout:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:d}))},onProgress:(d,f,g,p)=>{t&&t({frag:e,part:null,payload:g,networkDetails:p})}})})}loadPart(e,t,n){this.abort();const i=this.config,s=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(Qu(e,t));return}const A=this.loader=e.loader=s?new s(i):new o(i),c=Tu(e,t),u=pu(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Bu};t.stats=A.stats,A.load(c,h,{onSuccess:(d,f,g,p)=>{this.resetLoader(e,A),this.updateStatsFromPart(e,t);const C={frag:e,part:t,payload:d.data,networkDetails:p};n(C),a(C)},onError:(d,f,g,p)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:ht({url:c.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:g,stats:p}))},onAbort:(d,f,g)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:g,stats:d}))},onTimeout:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:V.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:d}))}})})}updateStatsFromPart(e,t){const n=e.stats,i=t.stats,s=i.total;if(n.loaded+=i.loaded,s){const l=Math.round(e.duration/t.duration),A=Math.min(Math.round(n.loaded/s),l),u=(l-A)*Math.round(n.loaded/A);n.total=n.loaded+u}else n.total=Math.max(n.loaded,n.total);const o=n.loading,a=i.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 Tu(r,e=null){const t=e||r,n={frag:r,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,s=t.byteRangeEndOffset;if(he(i)&&he(s)){var o;let a=i,l=s;if(r.sn==="initSegment"&&((o=r.decryptdata)==null?void 0:o.method)==="AES-128"){const A=s-i;A%16&&(l=s+(16-A%16)),i!==0&&(n.resetIV=!0,a=i-16)}n.rangeStart=a,n.rangeEnd=l}return n}function Qu(r,e){const t=new Error(`GAP ${r.gap?"tag":"attribute"} found`),n={type:Be.MEDIA_ERROR,details:V.FRAG_GAP,fatal:!1,frag:r,error:t,networkDetails:null};return e&&(n.part=e),(e||r).stats.aborted=!0,new Qr(n)}class Qr extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class RE{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 DE{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 _E(r){const e=r.byteLength,t=e&&new DataView(r.buffer).getUint8(e-1);return t?Zr(r,0,e-t):r}class LE{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),n=new Uint32Array(4);for(let i=0;i<4;i++)n[i]=t.getUint32(i*4);return n}initTable(){const e=this.sBox,t=this.invSBox,n=this.subMix,i=n[0],s=n[1],o=n[2],a=n[3],l=this.invSubMix,A=l[0],c=l[1],u=l[2],h=l[3],d=new Uint32Array(256);let f=0,g=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 C=g^g<<1^g<<2^g<<3^g<<4;C=C>>>8^C&255^99,e[f]=C,t[C]=f;const Q=d[f],b=d[Q],y=d[b];let w=d[C]*257^C*16843008;i[f]=w<<24|w>>>8,s[f]=w<<16|w>>>16,o[f]=w<<8|w>>>24,a[f]=w,w=y*16843009^b*65537^Q*257^f*16843008,A[C]=w<<24|w>>>8,c[C]=w<<16|w>>>16,u[C]=w<<8|w>>>24,h[C]=w,f?(f=Q^d[d[d[y^Q]]],g^=d[d[g]]):f=g=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,i=0;for(;i<t.length&&n;)n=t[i]===this.key[i],i++;if(n)return;this.key=t;const s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const o=this.ksRows=(s+6+1)*4;let a,l;const A=this.keySchedule=new Uint32Array(o),c=this.invKeySchedule=new Uint32Array(o),u=this.sBox,h=this.rcon,d=this.invSubMix,f=d[0],g=d[1],p=d[2],C=d[3];let Q,b;for(a=0;a<o;a++){if(a<s){Q=A[a]=t[a];continue}b=Q,a%s===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/s|0]<<24):s>6&&a%s===4&&(b=u[b>>>24]<<24|u[b>>>16&255]<<16|u[b>>>8&255]<<8|u[b&255]),A[a]=Q=(A[a-s]^b)>>>0}for(l=0;l<o;l++)a=o-l,l&3?b=A[a]:b=A[a-4],l<4||a<=4?c[l]=b:c[l]=f[u[b>>>24]]^g[u[b>>>16&255]]^p[u[b>>>8&255]]^C[u[b&255]],c[l]=c[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){const i=this.keySize+6,s=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,l=a[0],A=a[1],c=a[2],u=a[3],h=this.uint8ArrayToUint32Array_(n);let d=h[0],f=h[1],g=h[2],p=h[3];const C=new Int32Array(e),Q=new Int32Array(C.length);let b,y,w,R,k,$,K,O,J,ie,ee,le,_,P;const X=this.networkToHostOrderSwap;for(;t<C.length;){for(J=X(C[t]),ie=X(C[t+1]),ee=X(C[t+2]),le=X(C[t+3]),k=J^s[0],$=le^s[1],K=ee^s[2],O=ie^s[3],_=4,P=1;P<i;P++)b=l[k>>>24]^A[$>>16&255]^c[K>>8&255]^u[O&255]^s[_],y=l[$>>>24]^A[K>>16&255]^c[O>>8&255]^u[k&255]^s[_+1],w=l[K>>>24]^A[O>>16&255]^c[k>>8&255]^u[$&255]^s[_+2],R=l[O>>>24]^A[k>>16&255]^c[$>>8&255]^u[K&255]^s[_+3],k=b,$=y,K=w,O=R,_=_+4;b=o[k>>>24]<<24^o[$>>16&255]<<16^o[K>>8&255]<<8^o[O&255]^s[_],y=o[$>>>24]<<24^o[K>>16&255]<<16^o[O>>8&255]<<8^o[k&255]^s[_+1],w=o[K>>>24]<<24^o[O>>16&255]<<16^o[k>>8&255]<<8^o[$&255]^s[_+2],R=o[O>>>24]<<24^o[k>>16&255]<<16^o[$>>8&255]<<8^o[K&255]^s[_+3],Q[t]=X(b^d),Q[t+1]=X(R^f),Q[t+2]=X(w^g),Q[t+3]=X(y^p),d=J,f=ie,g=ee,p=le,t=t+4}return Q.buffer}}const FE=16;class Ca{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 n=self.crypto;n&&(this.subtle=n.subtle||n.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 n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?_E(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n){return this.useSoftware?new Promise((i,s)=>{this.softwareDecrypt(new Uint8Array(e),t,n);const o=this.flush();o?i(o.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,n)}softwareDecrypt(e,t,n){const{currentIV:i,currentResult:s,remainderData:o}=this;this.logOnce("JS AES decrypt"),o&&(e=$t(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;i&&(n=i);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new LE),l.expandKey(t);const A=s;return this.currentResult=l.decrypt(a.buffer,0,n),this.currentIV=Zr(a,-16).buffer,A||null}webCryptoDecrypt(e,t,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n));this.key=t,this.fastAesKey=new DE(this.subtle,t)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new RE(this.subtle,new Uint8Array(n)).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(U.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,n)))}onWebCryptoError(e,t,n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n);const i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const n=e.length-e.length%FE;return n!==e.length&&(t=Zr(e,0,n),this.remainderData=Zr(e,n)),t}logOnce(e){this.logEnabled&&(U.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const kE={toString:function(r){let e="";const t=r.length;for(let n=0;n<t;n++)e+=`[${r.start(n).toFixed(3)}-${r.end(n).toFixed(3)}]`;return e}},re={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 ya extends yE{constructor(e,t,n,i,s){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=re.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=s,this.logPrefix=i,this.log=U.log.bind(U,`${i}:`),this.warn=U.warn.bind(U,`${i}:`),this.hls=e,this.fragmentLoader=new SE(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Ca(e.config),e.on(I.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=re.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const n=t.partList;if(n!=null&&n.length){const s=n[n.length-1];return Ke.isBuffered(this.media,s.start+s.duration/2)}const i=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(i)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const n=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),n.addEventListener("seeking",this.onvseeking),n.addEventListener("ended",this.onvended);const i=this.config;this.levels&&i.autoStartLoad&&this.state===re.STOPPED&&this.startLoad(i.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:n,mediaBuffer:i,state:s}=this,o=n?n.currentTime:0,a=Ke.bufferInfo(i||n,o,e.maxBufferHole);if(this.log(`media seeking to ${he(o)?o.toFixed(3):o}, state: ${s}`),this.state===re.ENDED)this.resetLoadingState();else if(t){const l=e.maxFragLookUpTolerance,A=t.start-l,c=t.start+t.duration+l;if(!a.len||c<a.start||A>a.end){const u=o>c;(o<A||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)}}n&&(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(I.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=re.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,n){this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){const i=s=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${s.part?" p: "+s.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,n,i).then(s=>{if(!s)return;const o=this.state;if(this.fragContextChanged(e)){(o===re.FRAG_LOADING||!this.fragCurrent&&o===re.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=re.IDLE);return}"payload"in s&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(I.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===re.STOPPED||this.state===re.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===dt.APPENDING){const s=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,s),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(a))&&n.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===dt.PARTIAL&&n.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,n=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:n};this.hls.trigger(I.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(n=>{if(!n||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:i}=this,{payload:s}=n,o=e.decryptdata;if(s&&s.byteLength>0&&o!=null&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),o.key.buffer,o.iv.buffer).catch(l=>{throw i.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:e}),l}).then(l=>{const A=self.performance.now();return i.trigger(I.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:a,tdecrypt:A}}),n.payload=l,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===re.STOPPED||this.state===re.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state=re.IDLE,e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.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 n,i,s,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===Ee.MAIN?"level":"track"} ${e.level} (frag:[${((n=e.startPTS)!=null?n:NaN).toFixed(3)}-${((i=e.endPTS)!=null?i:NaN).toFixed(3)}] > buffer:${a?kE.toString(Ke.getBuffered(a)):"(detached)"})`),e.sn!=="initSegment"){var l;if(e.type!==Ee.SUBTITLE){const c=e.elementaryStreams;if(!Object.keys(c).some(u=>!!c[u])){this.state=re.IDLE;return}}const A=(l=this.levels)==null?void 0:l[e.level];A!=null&&A.fragmentError&&(this.log(`Resetting level fragment error count of ${A.fragmentError} on frag buffered`),A.fragmentError=0)}this.state=re.IDLE,a&&(!this.loadedmetadata&&e.type==Ee.MAIN&&a.buffered.length&&((s=this.fragCurrent)==null?void 0:s.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:n,part:i,partsLoaded:s}=e,o=!s||s.length===0||s.some(l=>!l),a=new va(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,i){var s;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&&!((s=e.decryptdata)!=null&&s.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=re.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(I.KEY_LOADED,c),this.state===re.KEY_LOADING&&(this.state=re.IDLE),c}),this.hls.trigger(I.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),n=Math.max(e.start,n||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const c=o.partList;if(c&&i){n>e.end&&o.fragmentHint&&(e=o.fragmentHint);const u=this.getNextPart(c,e,n);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(n.toFixed(3))}`),this.nextLoadPosition=h.start+h.duration,this.state=re.FRAG_LOADING;let d;return a?d=a.then(f=>!f||this.fragContextChanged(f.frag)?null:this.doFragPartsLoad(e,h,t,i)).catch(f=>this.handleFragLoadError(f)):d=this.doFragPartsLoad(e,h,t,i).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(I.FRAG_LOADING,{frag:e,part:h,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(c,n))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(n.toFixed(3))}`),he(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=re.FRAG_LOADING;const l=this.config.progressive;let A;return l&&a?A=a.then(c=>!c||this.fragContextChanged(c==null?void 0:c.frag)?null:this.fragmentLoader.load(e,i)).catch(c=>this.handleFragLoadError(c)):A=Promise.all([this.fragmentLoader.load(e,l?i:void 0),a]).then(([c])=>(!l&&c&&i&&i(c),c)).catch(c=>this.handleFragLoadError(c)),this.hls.trigger(I.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):A}doFragPartsLoad(e,t,n,i){return new Promise((s,o)=>{var a;const l=[],A=(a=n.details)==null?void 0:a.partList,c=u=>{this.fragmentLoader.loadPart(e,u,i).then(h=>{l[u.index]=h;const d=h.part;this.hls.trigger(I.FRAG_LOADED,h);const f=hu(n,e.sn,u.index+1)||du(A,e.sn,u.index+1);if(f)c(f);else return s({frag:e,part:d,partsLoaded:l})}).catch(o)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===V.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(I.ERROR,t)}else this.hls.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:V.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==re.PARSING){!this.fragCurrent&&this.state!==re.STOPPED&&this.state!==re.ERROR&&(this.state=re.IDLE);return}const{frag:n,part:i,level:s}=t,o=self.performance.now();n.stats.parsing.end=o,i&&(i.stats.parsing.end=o),this.updateLevelTiming(n,i,s,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:n}=this,{level:i,sn:s,part:o}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${s} of level ${i}. The current chunk will not be buffered.`),null;const a=t[i],l=o>-1?hu(a,s,o):null,A=l?l.fragment:nE(a,s,n);return A?(n&&n!==A&&(A.stats=n.stats),{frag:A,part:l,level:a}):null}bufferFragmentData(e,t,n,i,s){var o;if(!e||this.state!==re.PARSING)return;const{data1:a,data2:l}=e;let A=a;if(a&&l&&(A=$t(a,l)),!((o=A)!=null&&o.length))return;const c={type:e.type,frag:t,part:n,chunkMeta:i,parent:t.type,data:A};if(this.hls.trigger(I.BUFFER_APPENDING,c),e.dropped&&e.independent&&!n){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Ke.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,i=Ke.bufferInfo(t,n,0),s=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),a=Math.max(Math.min(e.start-o,i.end-o),n+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const n=this.getLoadPosition();return he(n)?this.getFwdBufferInfoAtPos(e,n,t):null}getFwdBufferInfoAtPos(e,t,n){const{config:{maxBufferHole:i}}=this,s=Ke.bufferInfo(e,t,i);if(s.len===0&&s.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,n);if(o&&s.nextStart<o.end)return Ke.bufferInfo(e,t,Math.max(s.nextStart,i))}return s}getMaxBufferLength(e){const{config:t}=this;let n;return e?n=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):n=t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,n=e||t.maxBufferLength,i=t.maxMaxBufferLength/2;return i>=n?(t.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0):!1}getAppendedFrag(e,t=Ee.MAIN){const n=this.fragmentTracker.getAppendedFrag(e,Ee.MAIN);return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const n=t.fragments,i=n.length;if(!i)return null;const{config:s}=this,o=n[0].start;let a;if(t.live){const l=s.initialLiveManifestSize;if(i<l)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${l})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o)&&(a=this.getInitialLiveFragment(t,n),this.startPosition=this.nextLoadPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=n[0]);if(!a){const l=s.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,l,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===dt.OK||n===dt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,i,s){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(a===null)return a;if(e=a,o&&e&&!e.gap&&n.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,i);if(l!==null&&n.len+l.len>=s)return this.log(`buffer full after gaps in "${i}" 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,n){let i=-1,s=!1,o=!0;for(let a=0,l=e.length;a<l;a++){const A=e[a];if(o=o&&!A.independent,i>-1&&n<A.start)break;const c=A.loaded;c?i=-1:(s||A.independent||o)&&A.fragment===t&&(i=a),s=c}return i}loadedEndOfParts(e,t){const n=e[e.length-1];return n&&t>n.start&&n.loaded}getInitialLiveFragment(e,t){const n=this.fragPrevious;let i=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),i=sE(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const s=n.sn+1;if(s>=e.startSN&&s<=e.endSN){const o=t[s-e.startSN];n.cc===o.cc&&(i=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=lE(t,n.cc),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,n){const{config:i}=this;let{fragPrevious:s}=this,{fragments:o,endSN:a}=n;const{fragmentHint:l}=n,{maxFragLookUpTolerance:A}=i,c=n.partList,u=!!(i.lowLatencyMode&&c!=null&&c.length&&l);u&&l&&!this.bitrateTest&&(o=o.concat(l),a=l.sn);let h;if(e<t){const d=e>t-A?0:A;h=Ts(s,o,e,d)}else h=o[o.length-1];if(h){const d=h.sn-n.startSN,f=this.fragmentTracker.getState(h);if((f===dt.OK||f===dt.PARTIAL&&h.gap)&&(s=h),s&&h.sn===s.sn&&(!u||c[0].fragment.sn>h.sn)&&s&&h.level===s.level){const p=o[d+1];h.sn<a&&this.fragmentTracker.getState(p)!==dt.OK?h=p:h=null}}return h}synchronizeToLiveEdge(e){const{config:t,media:n}=this;if(!n)return;const i=this.hls.liveSyncPosition,s=n.currentTime,o=e.fragments[0].start,a=e.edge,l=s>=o-t.maxFragLookUpTolerance&&s<=a;if(i!==null&&n.duration>i&&(s<i||!l)){const A=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!l&&n.readyState<4||s<a-A)&&(this.loadedmetadata||(this.nextLoadPosition=i),n.readyState&&(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${i.toFixed(3)}`),n.currentTime=i))}}alignPlaylists(e,t,n){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const s=e.fragments[0].start,o=!t,a=e.alignedSliding&&he(s);if(o||!a&&!s){const{fragPrevious:l}=this;xE(l,n,e);const A=e.fragments[0].start;return this.log(`Live playlist sliding: ${A.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${l?l.sn:"na"} fragments: ${i}`),A}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;if(n<t&&(n=-1),n===-1||this.lastCurrentTime===-1){const i=this.startTimeOffset!==null,s=i?this.startTimeOffset:e.startTimeOffset;s!==null&&he(s)?(n=t+s,s<0&&(n+=e.totalduration),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Start time offset ${s} found in ${i?"multivariant":"media"} playlist, adjust startPosition to ${n}`),this.startPosition=n):e.live?n=this.hls.liveSyncPosition||t:this.startPosition=n=0,this.lastCurrentTime=n}this.nextLoadPosition=n}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!==re.FRAG_LOADING_WAITING_RETRY)&&(this.state=re.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const c=this.getCurrentContext(t.chunkMeta);c&&(t.frag=c.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){var i;this.warn(`Frag load error must match current frag to retry ${n.url} > ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const s=t.details===V.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(n,!0);const o=t.errorAction,{action:a,retryCount:l=0,retryConfig:A}=o||{};if(o&&a===Bt.RetryRequest&&A){this.resetStartWhenNotLoaded(this.levelLastLoaded);const c=ma(A,l);this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${l+1}/${A.maxNumRetry} in ${c}ms`),o.resolved=!0,this.retryDate=self.performance.now()+c,this.state=re.FRAG_LOADING_WAITING_RETRY}else if(A&&o)if(this.resetFragmentErrors(e),l<A.maxNumRetry)!s&&a!==Bt.RemoveAlternatePermanently&&(o.resolved=!0);else{U.warn(`${t.details} reached or exceeded max retry (${l})`);return}else(o==null?void 0:o.action)===Bt.SendAlternateToPenaltyBox?this.state=re.WAITING_LEVEL:this.state=re.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===re.PARSING||this.state===re.PARSED){const t=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,t),i=n&&n.len>.5;i&&this.reduceMaxBufferLength(n.len);const s=!i;return s&&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(),s}return!1}resetFragmentErrors(e){e===Ee.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==re.STOPPED&&(this.state=re.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;const i=Ke.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,n),this.state===re.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=re.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,n,i){var s;const o=n.details;if(!o){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,A)=>{const c=e.elementaryStreams[A];if(c){const u=c.endPTS-c.startPTS;if(u<=0)return this.warn(`Could not parse fragment ${e.sn} ${A} duration reliably (${u})`),l||!1;const h=i?0:cu(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(I.LEVEL_PTS_UPDATED,{details:o,level:n,drift:h,type:A,frag:e,start:c.startPTS,end:c.endPTS}),!0}return l},!1)&&((s=this.transmuxer)==null?void 0:s.error)===null){const l=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(n.fragmentError===0&&(n.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=re.PARSED,this.hls.trigger(I.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 bu{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let n;if(e.length)e.length===1?n=e[0]:n=NE(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function NE(r,e){const t=new Uint8Array(e);let n=0;for(let i=0;i<r.length;i++){const s=r[i];t.set(s,n),n+=s.length}return t}function ME(){return typeof __HLS_WORKER_BUNDLE__=="function"}function PE(){const r=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(r);return{worker:new self.Worker(e),objectURL:e}}function OE(r){const e=new self.URL(r,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function ur(r="",e=9e4){return{type:r,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Ba{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,n,i){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,n){}demux(e,t){this.cachedData&&(e=$t(this.cachedData,e),this.cachedData=null);let n=ui(e,0),i=n?n.length:0,s;const o=this._audioTrack,a=this._id3Track,l=n?na(n):void 0,A=e.length;for((this.basePTS===null||this.frameIndex===0&&he(l))&&(this.basePTS=UE(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:zt.audioId3,duration:Number.POSITIVE_INFINITY});i<A;){if(this.canParse(e,i)){const c=this.appendFrame(o,e,i);c?(this.frameIndex++,this.lastPTS=c.sample.pts,i+=c.length,s=i):i=A}else lm(e,i)?(n=ui(e,i),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:zt.audioId3,duration:Number.POSITIVE_INFINITY}),i+=n.length,s=i):i++;if(i===A&&s!==A){const c=Zr(e,s);this.cachedData?this.cachedData=$t(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:ur(),id3Track:a,textTrack:ur()}}demuxSampleAes(e,t,n){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:ur(),id3Track:this._id3Track,textTrack:ur()}}destroy(){}}const UE=(r,e,t)=>{if(he(r))return r*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};function GE(r,e,t,n){let i,s,o,a;const l=navigator.userAgent.toLowerCase(),A=n,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=((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}`);r.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!0,error:h,reason:h.message});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,U.log(`manifest codec:${n}, ADTS type:${i}, samplingIndex:${u}`),/firefox/i.test(l)?u>=6?(i=5,a=new Array(4),s=u-3):(i=2,a=new Array(2),s=u):l.indexOf("android")!==-1?(i=2,a=new Array(2),s=u):(i=5,a=new Array(4),n&&(n.indexOf("mp4a.40.29")!==-1||n.indexOf("mp4a.40.5")!==-1)||!n&&u>=6?s=u-3:((n&&n.indexOf("mp4a.40.2")!==-1&&(u>=6&&o===1||/vivaldi/i.test(l))||!n&&o===1)&&(i=2,a=new Array(2)),s=u)),a[0]=i<<3,a[0]|=(u&14)>>1,a[1]|=(u&1)<<7,a[1]|=o<<3,i===5&&(a[1]|=(s&14)>>1,a[2]=(s&1)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:c[u],channelCount:o,codec:"mp4a.40."+i,manifestCodec:A}}function xu(r,e){return r[e]===255&&(r[e+1]&246)===240}function wu(r,e){return r[e+1]&1?7:9}function Ta(r,e){return(r[e+3]&3)<<11|r[e+4]<<3|(r[e+5]&224)>>>5}function HE(r,e){return e+5<r.length}function Ss(r,e){return e+1<r.length&&xu(r,e)}function $E(r,e){return HE(r,e)&&xu(r,e)&&Ta(r,e)<=r.length-e}function YE(r,e){if(Ss(r,e)){const t=wu(r,e);if(e+t>=r.length)return!1;const n=Ta(r,e);if(n<=t)return!1;const i=e+n;return i===r.length||Ss(r,i)}return!1}function Su(r,e,t,n,i){if(!r.samplerate){const s=GE(e,t,n,i);if(!s)return;r.config=s.config,r.samplerate=s.samplerate,r.channelCount=s.channelCount,r.codec=s.codec,r.manifestCodec=s.manifestCodec,U.log(`parsed codec:${r.codec}, rate:${s.samplerate}, channels:${s.channelCount}`)}}function Ru(r){return 9216e4/r}function VE(r,e){const t=wu(r,e);if(e+t<=r.length){const n=Ta(r,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function Du(r,e,t,n,i){const s=Ru(r.samplerate),o=n+i*s,a=VE(e,t);let l;if(a){const{frameLength:u,headerLength:h}=a,d=h+u,f=Math.max(0,t+d-e.length);f?(l=new Uint8Array(d-h),l.set(e.subarray(t+h,e.length),0)):l=e.subarray(t+h,t+d);const g={unit:l,pts:o};return f||r.samples.push(g),{sample:g,length:d,missing:f}}const A=e.length-t;return l=new Uint8Array(A),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:o},length:A,missing:-1}}let Rs=null;const KE=[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],JE=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],WE=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],qE=[0,1,1,4];function _u(r,e,t,n,i){if(t+24>e.length)return;const s=Lu(e,t);if(s&&t+s.frameLength<=e.length){const o=s.samplesPerFrame*9e4/s.sampleRate,a=n+i*o,l={unit:e.subarray(t,t+s.frameLength),pts:a,dts:a};return r.config=[],r.channelCount=s.channelCount,r.samplerate=s.sampleRate,r.samples.push(l),{sample:l,length:s.frameLength,missing:0}}}function Lu(r,e){const t=r[e+1]>>3&3,n=r[e+1]>>1&3,i=r[e+2]>>4&15,s=r[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&s!==3){const o=r[e+2]>>1&1,a=r[e+3]>>6,l=t===3?3-n:n===3?3:4,A=KE[l*14+i-1]*1e3,u=JE[(t===3?0:t===2?1:2)*3+s],h=a===3?1:2,d=WE[t][n],f=qE[n],g=d*8*f,p=Math.floor(d*A/u+o)*f;if(Rs===null){const b=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Rs=b?parseInt(b[1]):0}return!!Rs&&Rs<=87&&n===2&&A>=224e3&&a===0&&(r[e+3]=r[e+3]|128),{sampleRate:u,channelCount:h,frameLength:p,samplesPerFrame:g}}}function Qa(r,e){return r[e]===255&&(r[e+1]&224)===224&&(r[e+1]&6)!==0}function Fu(r,e){return e+1<r.length&&Qa(r,e)}function XE(r,e){return Qa(r,e)&&4<=r.length-e}function ku(r,e){if(e+1<r.length&&Qa(r,e)){const n=Lu(r,e);let i=4;n!=null&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===r.length||Fu(r,s)}return!1}class jE extends Ba{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=ui(e,0);let n=(t==null?void 0:t.length)||0;if(ku(e,n))return!1;for(let i=e.length;n<i;n++)if(YE(e,n))return U.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return $E(e,t)}appendFrame(e,t,n){Su(e,this.observer,t,n,e.manifestCodec);const i=Du(e,t,n,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const zE=/\/emsg[-/]ID3/i;class ZE{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,n,i){const s=this.videoTrack=ur("video",1),o=this.audioTrack=ur("audio",1),a=this.txtTrack=ur("text",1);if(this.id3Track=ur("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=Mc(e);if(l.video){const{id:A,timescale:c,codec:u}=l.video;s.id=A,s.timescale=a.timescale=c,s.codec=u}if(l.audio){const{id:A,timescale:c,codec:u}=l.audio;o.id=A,o.timescale=c,o.codec=u}a.id=Lc.text,s.sampleDuration=0,s.duration=o.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return mm(e)}demux(e,t){this.timeOffset=t;let n=e;const i=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=$t(this.remainderData,e));const a=Qm(n);this.remainderData=a.remainder,i.samples=a.valid||new Uint8Array}else i.samples=n;const o=this.extractID3Track(i,t);return s.samples=Oc(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return n.samples=Oc(e,t),{videoTrack:t,audioTrack:ur(),id3Track:i,textTrack:ur()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const i=xe(e.samples,["emsg"]);i&&i.forEach(s=>{const o=wm(s);if(zE.test(o.schemeIdUri)){const a=he(o.presentationTime)?o.presentationTime/o.timeScale:t+o.presentationTimeDelta/o.timeScale;let l=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const A=o.payload;n.samples.push({data:A,len:A.byteLength,dts:a,pts:a,type:zt.emsg,duration:l})}})}return n}demuxSampleAes(e,t,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const Nu=(r,e)=>{let t=0,n=5;e+=n;const i=new Uint32Array(1),s=new Uint32Array(1),o=new Uint8Array(1);for(;n>0;){o[0]=r[e];const a=Math.min(n,8),l=8-a;s[0]=4278190080>>>24+l<<l,i[0]=(o[0]&s[0])>>l,t=t?t<<a|i[0]:i[0],e+=1,n-=a}return t};class eI extends Ba{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const i=Mu(e,t,n,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=ui(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&na(t)!==void 0&&Nu(e,n)<16}}function Mu(r,e,t,n,i){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const a=[48e3,44100,32e3][s],l=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][l*3+s]*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,g=[2,1,2,3,3,4,4,5][u]+d,p=e[t+5]>>3,C=e[t+5]&7,Q=new Uint8Array([s<<6|p<<1|C>>2,(C&3)<<6|u<<3|d<<2|l>>4,l<<4&224]),b=1536/a*9e4,y=n+i*b,w=e.subarray(t,t+c);return r.config=Q,r.channelCount=g,r.samplerate=a,r.samples.push({unit:w,pts:y}),c}class tI{constructor(){this.VideoSample=null}createVideoSample(e,t,n,i){return{key:e,frame:!1,pts:t,dts:n,units:[],debug:i,length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,i;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){const s=n.units;i=s[s.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const n=t.samples,i=n.length;if(i){const s=n[i-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&U.log(e.pts+"/"+e.dts+":"+e.debug)}}class Pu{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,n=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");i.set(e.subarray(n,n+s)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}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 n=this.word>>>32-t;if(e>32&&U.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?n<<t|this.readBits(t):n}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,n=8,i;for(let s=0;s<e;s++)n!==0&&(i=this.readEG(),n=(t+i+256)%256),t=n===0?t:n}readSPS(){let e=0,t=0,n=0,i=0,s,o,a;const l=this.readUByte.bind(this),A=this.readBits.bind(this),c=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),f=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);l();const p=l();if(A(5),h(3),l(),f(),p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){const R=c();if(R===3&&h(1),f(),f(),h(1),u())for(o=R!==3?8:12,a=0;a<o;a++)u()&&(a<6?g(16):g(64))}f();const C=c();if(C===0)c();else if(C===1)for(h(1),d(),d(),s=c(),a=0;a<s;a++)d();f(),h(1);const Q=c(),b=c(),y=A(1);y===0&&h(1),h(1),u()&&(e=c(),t=c(),n=c(),i=c());let w=[1,1];if(u()&&u())switch(l()){case 1:w=[1,1];break;case 2:w=[12,11];break;case 3:w=[10,11];break;case 4:w=[16,11];break;case 5:w=[40,33];break;case 6:w=[24,11];break;case 7:w=[20,11];break;case 8:w=[32,11];break;case 9:w=[80,33];break;case 10:w=[18,11];break;case 11:w=[15,11];break;case 12:w=[64,33];break;case 13:w=[160,99];break;case 14:w=[4,3];break;case 15:w=[3,2];break;case 16:w=[2,1];break;case 255:{w=[l()<<8|l(),l()<<8|l()];break}}return{width:Math.ceil((Q+1)*16-e*2-t*2),height:(2-y)*(b+1)*16-(y?2:4)*(n+i),pixelRatio:w}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class rI extends tI{parseAVCPES(e,t,n,i,s){const o=this.parseAVCNALu(e,n.data);let a=this.VideoSample,l,A=!1;n.data=null,a&&o.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts,"")),o.forEach(c=>{var u;switch(c.type){case 1:{let g=!1;l=!0;const p=c.data;if(A&&p.length>4){const C=new Pu(p).readSliceType();(C===2||C===4||C===7||C===9)&&(g=!0)}if(g){var h;(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts,"")),a.frame=!0,a.key=g;break}case 5:l=!0,(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts,"")),a.key=!0,a.frame=!0;break;case 6:{l=!0,Uc(c.data,1,n.pts,t.samples);break}case 7:{var d,f;l=!0,A=!0;const g=c.data,C=new Pu(g).readSPS();if(!e.sps||e.width!==C.width||e.height!==C.height||((d=e.pixelRatio)==null?void 0:d[0])!==C.pixelRatio[0]||((f=e.pixelRatio)==null?void 0:f[1])!==C.pixelRatio[1]){e.width=C.width,e.height=C.height,e.pixelRatio=C.pixelRatio,e.sps=[g],e.duration=s;const Q=g.subarray(1,4);let b="avc1.";for(let y=0;y<3;y++){let w=Q[y].toString(16);w.length<2&&(w="0"+w),b+=w}e.codec=b}break}case 8:l=!0,e.pps=[c.data];break;case 9:l=!0,e.audFound=!0,a&&this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts,"");break;case 12:l=!0;break;default:l=!1,a&&(a.debug+="unknown NAL "+c.type+" ");break}a&&l&&a.units.push(c)}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}parseAVCNALu(e,t){const n=t.byteLength;let i=e.naluState||0;const s=i,o=[];let a=0,l,A,c,u=-1,h=0;for(i===-1&&(u=0,h=t[0]&31,i=0,a=1);a<n;){if(l=t[a++],!i){i=l?0:1;continue}if(i===1){i=l?0:2;continue}if(!l)i=3;else if(l===1){if(A=a-i-1,u>=0){const d={data:t.subarray(u,A),type:h};o.push(d)}else{const d=this.getLastNalUnit(e.samples);d&&(s&&a<=4-s&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-s)),A>0&&(d.data=$t(d.data,t.subarray(0,A)),d.state=0))}a<n?(c=t[a]&31,u=a,h=c,i=0):i=-1}else i=0}if(u>=0&&i>=0){const d={data:t.subarray(u,n),type:h,state:i};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);d&&(d.data=$t(d.data,t))}return e.naluState=i,o}}class nI{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Ca(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,n){const i=e[t].unit;if(i.length<=16)return;const s=i.subarray(16,i.length-i.length%16),o=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(o).then(a=>{const l=new Uint8Array(a);i.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)})}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)n.set(e.subarray(s,s+16),i);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)e.set(n.subarray(i,i+16),s);return e}decryptAvcSample(e,t,n,i,s){const o=Gc(s.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(l=>{s.data=this.getAvcDecryptedUnit(o,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,i)})}decryptAvcSamples(e,t,n,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length){i();return}const s=e[t].units;for(;!(n>=s.length);n++){const o=s[n];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,n,i,o),!this.decrypter.isSync()))return}}}}const ft=188;class Mr{constructor(e,t,n){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=n,this.videoParser=new rI}static probe(e){const t=Mr.syncOffset(e);return t>0&&U.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let n=Math.min(ft*5,t-ft)+1,i=0;for(;i<n;){let s=!1,o=-1,a=0;for(let l=i;l<t;l+=ft)if(e[l]===71&&(t-l===ft||e[l+ft]===71)){if(a++,o===-1&&(o=l,o!==0&&(n=Math.min(o+ft*99,e.length-ft)+1)),s||(s=ba(e,l)===0),s&&a>1&&(o===0&&a>2||l+ft>n))return o}else{if(a)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Lc[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Mr.createTrack("video"),this._audioTrack=Mr.createTrack("audio",i),this._id3Track=Mr.createTrack("id3"),this._txtTrack=Mr.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n,this._duration=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,i=!1){n||(this.sampleAes=null);let s;const o=this._videoTrack,a=this._audioTrack,l=this._id3Track,A=this._txtTrack;let c=o.pid,u=o.pesData,h=a.pid,d=l.pid,f=a.pesData,g=l.pesData,p=null,C=this.pmtParsed,Q=this._pmtId,b=e.length;if(this.remainderData&&(e=$t(this.remainderData,e),b=e.length,this.remainderData=null),b<ft&&!i)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:l,textTrack:A};const y=Math.max(0,Mr.syncOffset(e));b-=(b-y)%ft,b<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,b,e.buffer.byteLength-b));let w=0;for(let k=y;k<b;k+=ft)if(e[k]===71){const $=!!(e[k+1]&64),K=ba(e,k),O=(e[k+3]&48)>>4;let J;if(O>1){if(J=k+5+e[k+4],J===k+ft)continue}else J=k+4;switch(K){case c:$&&(u&&(s=xn(u))&&this.videoParser.parseAVCPES(o,A,s,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(e.subarray(J,k+ft)),u.size+=k+ft-J);break;case h:if($){if(f&&(s=xn(f)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,s);break;case"mp3":this.parseMPEGPES(a,s);break;case"ac3":this.parseAC3PES(a,s);break}f={data:[],size:0}}f&&(f.data.push(e.subarray(J,k+ft)),f.size+=k+ft-J);break;case d:$&&(g&&(s=xn(g))&&this.parseID3PES(l,s),g={data:[],size:0}),g&&(g.data.push(e.subarray(J,k+ft)),g.size+=k+ft-J);break;case 0:$&&(J+=e[J]+1),Q=this._pmtId=iI(e,J);break;case Q:{$&&(J+=e[J]+1);const ie=sI(e,J,this.typeSupported,n,this.observer);c=ie.videoPid,c>0&&(o.pid=c,o.segmentCodec=ie.segmentVideoCodec),h=ie.audioPid,h>0&&(a.pid=h,a.segmentCodec=ie.segmentAudioCodec),d=ie.id3Pid,d>0&&(l.pid=d),p!==null&&!C&&(U.warn(`MPEG-TS PMT found at ${k} after unknown PID '${p}'. Backtracking to sync byte @${y} to parse all TS packets.`),p=null,k=y-188),C=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=K;break}}else w++;w>0&&Ds(this.observer,new Error(`Found ${w} TS packet/s that do not start with 0x47`)),o.pesData=u,a.pesData=f,l.pesData=g;const R={audioTrack:a,videoTrack:o,id3Track:l,textTrack:A};return i&&this.extractRemainingSamples(R),R}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:n,id3Track:i,textTrack:s}=e,o=n.pesData,a=t.pesData,l=i.pesData;let A;if(o&&(A=xn(o))?(this.videoParser.parseAVCPES(n,s,A,!0,this._duration),n.pesData=null):n.pesData=o,a&&(A=xn(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,A);break;case"mp3":this.parseMPEGPES(t,A);break;case"ac3":this.parseAC3PES(t,A);break}t.pesData=null}else a!=null&&a.size&&U.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;l&&(A=xn(l))?(this.parseID3PES(i,A),i.pesData=null):i.pesData=l}demuxSampleAes(e,t,n){const i=this.demux(e,n,!0,!this.config.progressive),s=this.sampleAes=new nI(this.observer,this.config,t);return this.decrypt(i,s)}decrypt(e,t){return new Promise(n=>{const{audioTrack:i,videoTrack:s}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{n(e)}):n(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{n(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let n=0;const i=this.aacOverFlow;let s=t.data;if(i){this.aacOverFlow=null;const u=i.missing,h=i.sample.unit.byteLength;if(u===-1)s=$t(i.sample.unit,s);else{const d=h-u;i.sample.unit.set(s.subarray(0,u),d),e.samples.push(i.sample),n=i.missing}}let o,a;for(o=n,a=s.length;o<a-1&&!Ss(s,o);o++);if(o!==n){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",Ds(this.observer,new Error(u),h),!h)return}Su(e,this.observer,s,o,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(i){const u=Ru(e.samplerate);l=i.sample.pts+u}else{U.warn("[tsdemuxer]: AAC PES unknown PTS");return}let A=0,c;for(;o<a;)if(c=Du(e,s,o,l,A),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(A++;o<a-1&&!Ss(s,o);o++);}parseMPEGPES(e,t){const n=t.data,i=n.length;let s=0,o=0;const a=t.pts;if(a===void 0){U.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<i;)if(Fu(n,o)){const l=_u(e,n,o,a,s);if(l)o+=l.length,s++;else break}else o++}parseAC3PES(e,t){{const n=t.data,i=t.pts;if(i===void 0){U.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=n.length;let o=0,a=0,l;for(;a<s&&(l=Mu(e,n,a,i,o++))>0;)a+=l}}parseID3PES(e,t){if(t.pts===void 0){U.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=it({},t,{type:this._videoTrack?zt.emsg:zt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function ba(r,e){return((r[e+1]&31)<<8)+r[e+2]}function iI(r,e){return(r[e+10]&31)<<8|r[e+11]}function sI(r,e,t,n,i){const s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(r[e+1]&15)<<8|r[e+2],a=e+3+o-4,l=(r[e+10]&15)<<8|r[e+11];for(e+=12+l;e<a;){const A=ba(r,e),c=(r[e+3]&15)<<8|r[e+4];switch(r[e]){case 207:if(!n){xa("ADTS AAC");break}case 15:s.audioPid===-1&&(s.audioPid=A);break;case 21:s.id3Pid===-1&&(s.id3Pid=A);break;case 219:if(!n){xa("H.264");break}case 27:s.videoPid===-1&&(s.videoPid=A,s.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?U.log("MPEG audio found, not supported in this browser"):s.audioPid===-1&&(s.audioPid=A,s.segmentAudioCodec="mp3");break;case 193:if(!n){xa("AC-3");break}case 129:t.ac3?s.audioPid===-1&&(s.audioPid=A,s.segmentAudioCodec="ac3"):U.log("AC-3 audio found, not supported in this browser");break;case 6:if(s.audioPid===-1&&c>0){let u=e+5,h=c;for(;h>2;){switch(r[u]){case 106:t.ac3!==!0?U.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=A,s.segmentAudioCodec="ac3");break}const f=r[u+1]+2;u+=f,h-=f}}break;case 194:case 135:return Ds(i,new Error("Unsupported EC-3 in M2TS found")),s;case 36:return Ds(i,new Error("Unsupported HEVC in M2TS found")),s}e+=c+5}return s}function Ds(r,e,t){U.warn(`parsing error: ${e.message}`),r.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function xa(r){U.log(`${r} with AES-128-CBC encryption found in unencrypted stream`)}function xn(r){let e=0,t,n,i,s,o;const a=r.data;if(!r||r.size===0)return null;for(;a[0].length<19&&a.length>1;)a[0]=$t(a[0],a[1]),a.splice(1,1);if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(n=(t[4]<<8)+t[5],n&&n>r.size-6)return null;const A=t[7];A&192&&(s=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,A&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,s-o>54e5&&(U.warn(`${Math.round((s-o)/9e4)}s delta between PTS and DTS, align them`),s=o)):o=s),i=t[8];let c=i+9;if(r.size<=c)return null;r.size-=c;const u=new Uint8Array(r.size);for(let h=0,d=a.length;h<d;h++){t=a[h];let f=t.byteLength;if(c)if(c>f){c-=f;continue}else t=t.subarray(c),f-=c,c=0;u.set(t,e),e+=f}return n&&(n-=i+3),{data:u,pts:s,dts:o,len:n}}return null}class oI extends Ba{resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=ui(e,0);let n=(t==null?void 0:t.length)||0;if(t&&e[n]===11&&e[n+1]===119&&na(t)!==void 0&&Nu(e,n)<=16)return!1;for(let i=e.length;n<i;n++)if(ku(e,n))return U.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return XE(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return _u(e,t,n,this.basePTS,this.frameIndex)}}class Ou{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 Pr=Math.pow(2,32)-1;class G{static init(){G.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 G.types)G.types.hasOwnProperty(e)&&(G.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]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);G.HDLR_TYPES={video:t,audio:n};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);G.STTS=G.STSC=G.STCO=s,G.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),G.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),G.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),G.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]),l=new Uint8Array([0,0,0,1]);G.FTYP=G.box(G.types.ftyp,o,l,o,a),G.DINF=G.box(G.types.dinf,G.box(G.types.dref,i))}static box(e,...t){let n=8,i=t.length;const s=i;for(;i--;)n+=t[i].byteLength;const o=new Uint8Array(n);for(o[0]=n>>24&255,o[1]=n>>16&255,o[2]=n>>8&255,o[3]=n&255,o.set(e,4),i=0,n=8;i<s;i++)o.set(t[i],n),n+=t[i].byteLength;return o}static hdlr(e){return G.box(G.types.hdlr,G.HDLR_TYPES[e])}static mdat(e){return G.box(G.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(Pr+1)),i=Math.floor(t%(Pr+1));return G.box(G.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,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return G.box(G.types.mdia,G.mdhd(e.timescale,e.duration),G.hdlr(e.type),G.minf(e))}static mfhd(e){return G.box(G.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"?G.box(G.types.minf,G.box(G.types.smhd,G.SMHD),G.DINF,G.stbl(e)):G.box(G.types.minf,G.box(G.types.vmhd,G.VMHD),G.DINF,G.stbl(e))}static moof(e,t,n){return G.box(G.types.moof,G.mfhd(e),G.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=G.trak(e[t]);return G.box.apply(null,[G.types.moov,G.mvhd(e[0].timescale,e[0].duration)].concat(n).concat(G.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=G.trex(e[t]);return G.box.apply(null,[G.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(Pr+1)),i=Math.floor(t%(Pr+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&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 G.box(G.types.mvhd,s)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let i,s;for(i=0;i<t.length;i++)s=t[i].flags,n[i+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return G.box(G.types.sdtp,n)}static stbl(e){return G.box(G.types.stbl,G.stsd(e),G.box(G.types.stts,G.STTS),G.box(G.types.stsc,G.STSC),G.box(G.types.stsz,G.STSZ),G.box(G.types.stco,G.STCO))}static avc1(e){let t=[],n=[],i,s,o;for(i=0;i<e.sps.length;i++)s=e.sps[i],o=s.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(s));for(i=0;i<e.pps.length;i++)s=e.pps[i],o=s.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(s));const a=G.box(G.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),l=e.width,A=e.height,c=e.pixelRatio[0],u=e.pixelRatio[1];return G.box(G.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,A>>8&255,A&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,G.box(G.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),G.box(G.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 G.box(G.types.mp4a,G.audioStsd(e),G.box(G.types.esds,G.esds(e)))}static mp3(e){return G.box(G.types[".mp3"],G.audioStsd(e))}static ac3(e){return G.box(G.types["ac-3"],G.audioStsd(e),G.box(G.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?G.box(G.types.stsd,G.STSD,G.mp3(e)):e.segmentCodec==="ac3"?G.box(G.types.stsd,G.STSD,G.ac3(e)):G.box(G.types.stsd,G.STSD,G.mp4a(e)):G.box(G.types.stsd,G.STSD,G.avc1(e))}static tkhd(e){const t=e.id,n=e.duration*e.timescale,i=e.width,s=e.height,o=Math.floor(n/(Pr+1)),a=Math.floor(n%(Pr+1));return G.box(G.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,i>>8&255,i&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,t){const n=G.sdtp(e),i=e.id,s=Math.floor(t/(Pr+1)),o=Math.floor(t%(Pr+1));return G.box(G.types.traf,G.box(G.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),G.box(G.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&255])),G.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,G.box(G.types.trak,G.tkhd(e),G.mdia(e))}static trex(e){const t=e.id;return G.box(G.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 n=e.samples||[],i=n.length,s=12+16*i,o=new Uint8Array(s);let a,l,A,c,u,h;for(t+=8+s,o.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<i;a++)l=n[a],A=l.duration,c=l.size,u=l.flags,h=l.cts,o.set([A>>>24&255,A>>>16&255,A>>>8&255,A&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 G.box(G.types.trun,o)}static initSegment(e){G.types||G.init();const t=G.moov(e);return $t(G.FTYP,t)}}G.types=void 0,G.HDLR_TYPES=void 0,G.STTS=void 0,G.STSC=void 0,G.STCO=void 0,G.STSZ=void 0,G.VMHD=void 0,G.SMHD=void 0,G.STSD=void 0,G.FTYP=void 0,G.DINF=void 0;const Uu=9e4;function wa(r,e,t=1,n=!1){const i=r*e*t;return n?Math.round(i):i}function aI(r,e,t=1,n=!1){return wa(r,e,1/t,n)}function fi(r,e=!1){return wa(r,1e3,1/Uu,e)}function lI(r,e=1){return wa(r,Uu,1/e)}const AI=10*1e3,Gu=1024,cI=1152,uI=1536;let wn=null,Sa=null;class _s{constructor(e,t,n,i=""){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=n,this.ISGenerated=!1,wn===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);wn=o?parseInt(o[1]):0}if(Sa===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);Sa=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){U.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){U.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){U.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const n=e.reduce((i,s)=>{const o=s.pts-i;return o<-4294967296?(t=!0,Yt(i,s.pts)):o>0?i:s.pts},e[0].pts);return t&&U.debug("PTS rollover detected"),n}remux(e,t,n,i,s,o,a,l){let A,c,u,h,d,f,g=s,p=s;const C=e.pid>-1,Q=t.pid>-1,b=t.samples.length,y=e.samples.length>0,w=a&&b>0||b>1;if((!C||y)&&(!Q||w)||this.ISGenerated||a){if(this.ISGenerated){var k,$,K,O;const le=this.videoTrackConfig;le&&(t.width!==le.width||t.height!==le.height||((k=t.pixelRatio)==null?void 0:k[0])!==(($=le.pixelRatio)==null?void 0:$[0])||((K=t.pixelRatio)==null?void 0:K[1])!==((O=le.pixelRatio)==null?void 0:O[1]))&&this.resetInitSegment()}else u=this.generateIS(e,t,s,o);const J=this.isVideoContiguous;let ie=-1,ee;if(w&&(ie=hI(t.samples),!J&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,ie>0){U.warn(`[mp4-remuxer]: Dropped ${ie} out of ${b} video samples due to a missing keyframe`);const le=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(ie),t.dropped+=ie,p+=(t.samples[0].pts-le)/t.inputTimeScale,ee=p}else ie===-1&&(U.warn(`[mp4-remuxer]: No keyframe found out of ${b} video samples`),f=!1);if(this.ISGenerated){if(y&&w){const le=this.getVideoStartPts(t.samples),P=(Yt(e.samples[0].pts,le)-le)/t.inputTimeScale;g+=Math.max(0,P),p+=Math.max(0,-P)}if(y){if(e.samplerate||(U.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,s,o)),c=this.remuxAudio(e,g,this.isAudioContiguous,o,Q||w||l===Ee.AUDIO?p:void 0),w){const le=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(U.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,s,o)),A=this.remuxVideo(t,p,J,le)}}else w&&(A=this.remuxVideo(t,p,J,0));A&&(A.firstKeyFrame=ie,A.independent=ie!==-1,A.firstKeyFramePTS=ee)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(d=Hu(n,s,this._initPTS,this._initDTS)),i.samples.length&&(h=$u(i,s,this._initPTS))),{audio:c,video:A,initSegment:u,independent:f,text:h,id3:d}}generateIS(e,t,n,i){const s=e.samples,o=t.samples,a=this.typeSupported,l={},A=this._initPTS;let c=!A||i,u="audio/mp4",h,d,f;if(c&&(h=d=1/0),e.config&&s.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}l.audio={id:"audio",container:u,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):G.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(f=e.inputTimeScale,!A||f!==A.timescale?h=d=s[0].pts-Math.round(f*n):c=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:G.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(f=t.inputTimeScale,!A||f!==A.timescale){const g=this.getVideoStartPts(o),p=Math.round(f*n);d=Math.min(d,Yt(o[0].dts,g)-p),h=Math.min(h,g-p)}else c=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:h,timescale:f},this._initDTS={baseTime:d,timescale:f}):h=f=void 0,{tracks:l,initPTS:h,timescale:f}}remuxVideo(e,t,n,i){const s=e.inputTimeScale,o=e.samples,a=[],l=o.length,A=this._initPTS;let c=this.nextAvcDts,u=8,h=this.videoSampleDuration,d,f,g=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,C=!1;if(!n||c===null){const S=t*s,F=o[0].pts-Yt(o[0].dts,o[0].pts);wn&&c!==null&&Math.abs(S-F-c)<15e3?n=!0:c=S-F}const Q=A.baseTime*s/A.timescale;for(let S=0;S<l;S++){const F=o[S];F.pts=Yt(F.pts-Q,c),F.dts=Yt(F.dts-Q,c),F.dts<o[S>0?S-1:S].dts&&(C=!0)}C&&o.sort(function(S,F){const W=S.dts-F.dts,Y=S.pts-F.pts;return W||Y}),d=o[0].dts,f=o[o.length-1].dts;const b=f-d,y=b?Math.round(b/(l-1)):h||e.inputTimeScale/30;if(n){const S=d-c,F=S>y,W=S<-1;if((F||W)&&(F?U.warn(`AVC: ${fi(S,!0)} ms (${S}dts) hole between fragments detected at ${t.toFixed(3)}`):U.warn(`AVC: ${fi(-S,!0)} ms (${S}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!W||c>=o[0].pts||wn)){d=c;const Y=o[0].pts-S;if(F)o[0].dts=d,o[0].pts=Y;else for(let ne=0;ne<o.length&&!(o[ne].dts>Y);ne++)o[ne].dts-=S,o[ne].pts-=S;U.log(`Video: Initial PTS/DTS adjusted: ${fi(Y,!0)}/${fi(d,!0)}, delta: ${fi(S,!0)} ms`)}}d=Math.max(0,d);let w=0,R=0,k=d;for(let S=0;S<l;S++){const F=o[S],W=F.units,Y=W.length;let ne=0;for(let ce=0;ce<Y;ce++)ne+=W[ce].data.length;R+=ne,w+=Y,F.length=ne,F.dts<k?(F.dts=k,k+=y/4|0||1):k=F.dts,g=Math.min(F.pts,g),p=Math.max(F.pts,p)}f=o[l-1].dts;const $=R+4*w+8;let K;try{K=new Uint8Array($)}catch(S){this.observer.emit(I.ERROR,I.ERROR,{type:Be.MUX_ERROR,details:V.REMUX_ALLOC_ERROR,fatal:!1,error:S,bytes:$,reason:`fail allocating video mdat ${$}`});return}const O=new DataView(K.buffer);O.setUint32(0,$),K.set(G.types.mdat,4);let J=!1,ie=Number.POSITIVE_INFINITY,ee=Number.POSITIVE_INFINITY,le=Number.NEGATIVE_INFINITY,_=Number.NEGATIVE_INFINITY;for(let S=0;S<l;S++){const F=o[S],W=F.units;let Y=0;for(let pe=0,ge=W.length;pe<ge;pe++){const Se=W[pe],Le=Se.data,Ge=Se.data.byteLength;O.setUint32(u,Ge),u+=4,K.set(Le,u),u+=Ge,Y+=4+Ge}let ne;if(S<l-1)h=o[S+1].dts-F.dts,ne=o[S+1].pts-F.pts;else{const pe=this.config,ge=S>0?F.dts-o[S-1].dts:y;if(ne=S>0?F.pts-o[S-1].pts:y,pe.stretchShortVideoTrack&&this.nextAudioPts!==null){const Se=Math.floor(pe.maxBufferHole*s),Le=(i?g+i*s:this.nextAudioPts)-F.pts;Le>Se?(h=Le-ge,h<0?h=ge:J=!0,U.log(`[mp4-remuxer]: It is approximately ${Le/90} ms to the next segment; using duration ${h/90} ms for the last video frame.`)):h=ge}else h=ge}const ce=Math.round(F.pts-F.dts);ie=Math.min(ie,h),le=Math.max(le,h),ee=Math.min(ee,ne),_=Math.max(_,ne),a.push(new Yu(F.key,h,Y,ce))}if(a.length){if(wn){if(wn<70){const S=a[0].flags;S.dependsOn=2,S.isNonSync=0}}else if(Sa&&_-ee<le-ie&&y/le<.025&&a[0].cts===0){U.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let S=d;for(let F=0,W=a.length;F<W;F++){const Y=S+a[F].duration,ne=S+a[F].cts;if(F<W-1){const ce=Y+a[F+1].cts;a[F].duration=ce-ne}else a[F].duration=F?a[F-1].duration:y;a[F].cts=0,S=Y}}}h=J||!h?y:h,this.nextAvcDts=c=f+h,this.videoSampleDuration=h,this.isVideoContiguous=!0;const D={data1:G.moof(e.sequenceNumber++,d,it({},e,{samples:a})),data2:K,startPTS:g/s,endPTS:(p+h)/s,startDTS:d/s,endDTS:c/s,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,D}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return cI;case"ac3":return uI;default:return Gu}}remuxAudio(e,t,n,i,s){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,l=o/a,A=this.getSamplesPerFrame(e),c=A*l,u=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],f=s!==void 0;let g=e.samples,p=h?0:8,C=this.nextAudioPts||-1;const Q=t*o,b=u.baseTime*o/u.timescale;if(this.isAudioContiguous=n=n||g.length&&C>0&&(i&&Math.abs(Q-C)<9e3||Math.abs(Yt(g[0].pts-b,Q)-C)<20*c),g.forEach(function(P){P.pts=Yt(P.pts-b,Q)}),!n||C<0){if(g=g.filter(P=>P.pts>=0),!g.length)return;s===0?C=0:i&&!f?C=Math.max(0,Q):C=g[0].pts}if(e.segmentCodec==="aac"){const P=this.config.maxAudioFramesDrift;for(let X=0,D=C;X<g.length;X++){const S=g[X],F=S.pts,W=F-D,Y=Math.abs(1e3*W/o);if(W<=-P*c&&f)X===0&&(U.warn(`Audio frame @ ${(F/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*W/o)} ms.`),this.nextAudioPts=C=D=F);else if(W>=P*c&&Y<AI&&f){let ne=Math.round(W/c);D=F-ne*c,D<0&&(ne--,D+=c),X===0&&(this.nextAudioPts=C=D),U.warn(`[mp4-remuxer]: Injecting ${ne} audio frame @ ${(D/o).toFixed(3)}s due to ${Math.round(1e3*W/o)} ms gap.`);for(let ce=0;ce<ne;ce++){const pe=Math.max(D,0);let ge=Ou.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);ge||(U.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ge=S.unit.subarray()),g.splice(X,0,{unit:ge,pts:pe}),D+=c,X++}}S.pts=D,D+=c}}let y=null,w=null,R,k=0,$=g.length;for(;$--;)k+=g[$].unit.byteLength;for(let P=0,X=g.length;P<X;P++){const D=g[P],S=D.unit;let F=D.pts;if(w!==null){const Y=d[P-1];Y.duration=Math.round((F-w)/l)}else if(n&&e.segmentCodec==="aac"&&(F=C),y=F,k>0){k+=p;try{R=new Uint8Array(k)}catch(Y){this.observer.emit(I.ERROR,I.ERROR,{type:Be.MUX_ERROR,details:V.REMUX_ALLOC_ERROR,fatal:!1,error:Y,bytes:k,reason:`fail allocating audio mdat ${k}`});return}h||(new DataView(R.buffer).setUint32(0,k),R.set(G.types.mdat,4))}else return;R.set(S,p);const W=S.byteLength;p+=W,d.push(new Yu(!0,A,W,0)),w=F}const K=d.length;if(!K)return;const O=d[d.length-1];this.nextAudioPts=C=w+l*O.duration;const J=h?new Uint8Array(0):G.moof(e.sequenceNumber++,y/l,it({},e,{samples:d}));e.samples=[];const ie=y/o,ee=C/o,_={data1:J,data2:R,startPTS:ie,endPTS:ee,startDTS:ie,endDTS:ee,type:"audio",hasAudio:!0,hasVideo:!1,nb:K};return this.isAudioContiguous=!0,_}remuxEmptyAudio(e,t,n,i){const s=e.inputTimeScale,o=e.samplerate?e.samplerate:s,a=s/o,l=this.nextAudioPts,A=this._initDTS,c=A.baseTime*9e4/A.timescale,u=(l!==null?l:i.startDTS*s)+c,h=i.endDTS*s+c,d=a*Gu,f=Math.ceil((h-u)/d),g=Ou.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(U.warn("[mp4-remuxer]: remux empty Audio"),!g){U.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const p=[];for(let C=0;C<f;C++){const Q=u+C*d;p.push({unit:g,pts:Q,dts:Q})}return e.samples=p,this.remuxAudio(e,t,n,!1)}}function Yt(r,e){let t;if(e===null)return r;for(e<r?t=-8589934592:t=8589934592;Math.abs(r-e)>4294967296;)r+=t;return r}function hI(r){for(let e=0;e<r.length;e++)if(r[e].key)return e;return-1}function Hu(r,e,t,n){const i=r.samples.length;if(!i)return;const s=r.inputTimeScale;for(let a=0;a<i;a++){const l=r.samples[a];l.pts=Yt(l.pts-t.baseTime*s/t.timescale,e*s)/s,l.dts=Yt(l.dts-n.baseTime*s/n.timescale,e*s)/s}const o=r.samples;return r.samples=[],{samples:o}}function $u(r,e,t){const n=r.samples.length;if(!n)return;const i=r.inputTimeScale;for(let o=0;o<n;o++){const a=r.samples[o];a.pts=Yt(a.pts-t.baseTime*i/t.timescale,e*i)/i}r.samples.sort((o,a)=>o.pts-a.pts);const s=r.samples;return r.samples=[],{samples:s}}class Yu{constructor(e,t,n,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=n,this.cts=i,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class dI{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,n,i){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(vm(e,i)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:n}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const i=this.initData=Mc(e);i.audio&&(t=Vu(i.audio,He.AUDIO)),i.video&&(n=Vu(i.video,He.VIDEO));const s={};i.audio&&i.video?s.audiovideo={container:"video/mp4",codec:t+","+n,initSegment:e,id:"main"}:i.audio?s.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?s.video={container:"video/mp4",codec:n,initSegment:e,id:"main"}:U.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s}remux(e,t,n,i,s,o){var a,l;let{initPTS:A,lastEndTime:c}=this;const u={audio:void 0,video:void 0,text:i,id3:n,initSegment:void 0};he(c)||(c=this.lastEndTime=s||0);const h=t.samples;if(!(h!=null&&h.length))return u;const d={initPTS:void 0,timescale:1};let f=this.initData;if((a=f)!=null&&a.length||(this.generateInitSegment(h),f=this.initData),!((l=f)!=null&&l.length))return U.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const g=ym(h,f),p=Cm(f,h),C=p===null?s:p;(fI(A,C,s,g)||d.timescale!==A.timescale&&o)&&(d.initPTS=C-s,A&&A.timescale===1&&U.warn(`Adjusting initPTS by ${d.initPTS-A.baseTime}`),this.initPTS=A={baseTime:d.initPTS,timescale:1});const Q=e?C-A.baseTime/A.timescale:c,b=Q+g;Tm(f,h,A.baseTime/A.timescale),g>0?this.lastEndTime=b:(U.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const y=!!f.audio,w=!!f.video;let R="";y&&(R+="audio"),w&&(R+="video");const k={data1:h,startPTS:Q,startDTS:Q,endPTS:b,endDTS:b,type:R,hasAudio:y,hasVideo:w,nb:1,dropped:0};return u.audio=k.type==="audio"?k:void 0,u.video=k.type!=="audio"?k:void 0,u.initSegment=d,u.id3=Hu(n,s,A,A),i.samples.length&&(u.text=$u(i,s,A)),u}}function fI(r,e,t,n){if(r===null)return!0;const i=Math.max(n,1),s=e-r.baseTime/r.timescale;return Math.abs(s-t)>i}function Vu(r,e){const t=r==null?void 0:r.codec;if(t&&t.length>4)return t;if(e===He.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return ms(t,!1);const n="mp4a.40.5";return U.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${n}"`),n}return U.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let br;try{br=self.performance.now.bind(self.performance)}catch{U.debug("Unable to use Performance API on this environment"),br=vn==null?void 0:vn.Date.now}const Ls=[{demux:ZE,remux:dI},{demux:Mr,remux:_s},{demux:jE,remux:_s},{demux:oI,remux:_s}];Ls.splice(2,0,{demux:eI,remux:_s});class Ku{constructor(e,t,n,i,s){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=n,this.vendor=i,this.id=s}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,i){const s=n.transmuxing;s.executeStart=br();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:l}=this;i&&(this.currentTransmuxState=i);const{contiguous:A,discontinuity:c,trackSwitch:u,accurateTimeOffset:h,timeOffset:d,initSegmentChange:f}=i||a,{audioCodec:g,videoCodec:p,defaultInitPts:C,duration:Q,initSegmentData:b}=l,y=gI(o,t);if(y&&y.method==="AES-128"){const $=this.getDecrypter();if($.isSync()){let K=$.softwareDecrypt(o,y.key.buffer,y.iv.buffer);if(n.part>-1&&(K=$.flush()),!K)return s.executeEnd=br(),Ra(n);o=new Uint8Array(K)}else return this.decryptionPromise=$.webCryptoDecrypt(o,y.key.buffer,y.iv.buffer).then(K=>{const O=this.push(K,null,n);return this.decryptionPromise=null,O}),this.decryptionPromise}const w=this.needsProbing(c,u);if(w){const $=this.configureTransmuxer(o);if($)return U.warn(`[transmuxer] ${$.message}`),this.observer.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,fatal:!1,error:$,reason:$.message}),s.executeEnd=br(),Ra(n)}(c||u||f||w)&&this.resetInitSegment(b,g,p,Q,t),(c||f||w)&&this.resetInitialTimestamp(C),A||this.resetContiguity();const R=this.transmux(o,y,d,h,n),k=this.currentTransmuxState;return k.contiguous=!0,k.discontinuity=!1,k.trackSwitch=!1,s.executeEnd=br(),R}flush(e){const t=e.transmuxing;t.executeStart=br();const{decrypter:n,currentTransmuxState:i,decryptionPromise:s}=this;if(s)return s.then(()=>this.flush(e));const o=[],{timeOffset:a}=i;if(n){const u=n.flush();u&&o.push(this.push(u,null,e))}const{demuxer:l,remuxer:A}=this;if(!l||!A)return t.executeEnd=br(),[Ra(e)];const c=l.flush(a);return Fs(c)?c.then(u=>(this.flushRemux(o,u,e),o)):(this.flushRemux(o,c,e),o)}flushRemux(e,t,n){const{audioTrack:i,videoTrack:s,id3Track:o,textTrack:a}=t,{accurateTimeOffset:l,timeOffset:A}=this.currentTransmuxState;U.log(`[transmuxer.ts]: Flushed fragment ${n.sn}${n.part>-1?" p: "+n.part:""} of level ${n.level}`);const c=this.remuxer.remux(i,s,o,a,A,l,!0,this.id);e.push({remuxResult:c,chunkMeta:n}),n.transmuxing.executeEnd=br()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,i,s){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,n,i),a.resetInitSegment(e,t,n,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,i,s){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,n,i,s):o=this.transmuxUnencrypted(e,n,i,s),o}transmuxUnencrypted(e,t,n,i){const{audioTrack:s,videoTrack:o,id3Track:a,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,o,a,l,t,n,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,n,i,s){return this.demuxer.demuxSampleAes(e,t,n).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,n,i,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:i,vendor:s}=this;let o;for(let h=0,d=Ls.length;h<d;h++){var a;if((a=Ls[h].demux)!=null&&a.probe(e)){o=Ls[h];break}}if(!o)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,A=this.remuxer,c=o.remux,u=o.demux;(!A||!(A instanceof c))&&(this.remuxer=new c(n,t,i,s)),(!l||!(l instanceof u))&&(this.demuxer=new u(n,t,i),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 Ca(this.config)),e}}function gI(r,e){let t=null;return r.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Ra=r=>({remuxResult:{},chunkMeta:r});function Fs(r){return"then"in r&&r.then instanceof Function}class pI{constructor(e,t,n,i,s){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=n,this.duration=i,this.defaultInitPts=s||null}}class mI{constructor(e,t,n,i,s,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=n,this.trackSwitch=i,this.timeOffset=s,this.initSegmentChange=o}}var Ju={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(l,A,c){this.fn=l,this.context=A,this.once=c||!1}function s(l,A,c,u,h){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new i(c,u||l,h),f=t?t+A:A;return l._events[f]?l._events[f].fn?l._events[f]=[l._events[f],d]:l._events[f].push(d):(l._events[f]=d,l._eventsCount++),l}function o(l,A){--l._eventsCount===0?l._events=new n:delete l._events[A]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var A=[],c,u;if(this._eventsCount===0)return A;for(u in c=this._events)e.call(c,u)&&A.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(c)):A},a.prototype.listeners=function(A){var c=t?t+A:A,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,d=u.length,f=new Array(d);h<d;h++)f[h]=u[h].fn;return f},a.prototype.listenerCount=function(A){var c=t?t+A:A,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(A,c,u,h,d,f){var g=t?t+A:A;if(!this._events[g])return!1;var p=this._events[g],C=arguments.length,Q,b;if(p.fn){switch(p.once&&this.removeListener(A,p.fn,void 0,!0),C){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,f),!0}for(b=1,Q=new Array(C-1);b<C;b++)Q[b-1]=arguments[b];p.fn.apply(p.context,Q)}else{var y=p.length,w;for(b=0;b<y;b++)switch(p[b].once&&this.removeListener(A,p[b].fn,void 0,!0),C){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(!Q)for(w=1,Q=new Array(C-1);w<C;w++)Q[w-1]=arguments[w];p[b].fn.apply(p[b].context,Q)}}return!0},a.prototype.on=function(A,c,u){return s(this,A,c,u,!1)},a.prototype.once=function(A,c,u){return s(this,A,c,u,!0)},a.prototype.removeListener=function(A,c,u,h){var d=t?t+A:A;if(!this._events[d])return this;if(!c)return o(this,d),this;var f=this._events[d];if(f.fn)f.fn===c&&(!h||f.once)&&(!u||f.context===u)&&o(this,d);else{for(var g=0,p=[],C=f.length;g<C;g++)(f[g].fn!==c||h&&!f[g].once||u&&f[g].context!==u)&&p.push(f[g]);p.length?this._events[d]=p.length===1?p[0]:p:o(this,d)}return this},a.prototype.removeAllListeners=function(A){var c;return A?(c=t?t+A:A,this._events[c]&&o(this,c)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(Ju);var EI=Ju.exports,Da=Gp(EI);class Wu{constructor(e,t,n,i){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 s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;const o=(A,c)=>{c=c||{},c.frag=this.frag,c.id=this.id,A===I.ERROR&&(this.error=c.error),this.hls.trigger(A,c)};this.observer=new Da,this.observer.on(I.FRAG_DECRYPTED,o),this.observer.on(I.ERROR,o);const a=en(s.preferManagedMediaSource)||{isTypeSupported:()=>!1},l={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"&&(s.workerPath||ME())){try{s.workerPath?(U.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=OE(s.workerPath)):(U.log(`injecting Web Worker for "${t}"`),this.workerContext=PE()),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})`);s.enableWorker=!1,U.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:V.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:h})},c.postMessage({cmd:"init",typeSupported:l,vendor:"",id:t,config:JSON.stringify(s)})}catch(c){U.warn(`Error setting up "${t}" Web Worker, fallback to inline`,c),this.resetWorker(),this.error=null,this.transmuxer=new Ku(this.observer,l,s,"",t)}return}this.transmuxer=new Ku(this.observer,l,s,"",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,n,i,s,o,a,l,A,c){var u,h;A.transmuxing.start=self.performance.now();const{transmuxer:d}=this,f=o?o.start:s.start,g=s.decryptdata,p=this.frag,C=!(p&&s.cc===p.cc),Q=!(p&&A.level===p.level),b=p?A.sn-p.sn:-1,y=this.part?A.part-this.part.index:-1,w=b===0&&A.id>1&&A.id===(p==null?void 0:p.stats.chunkCount),R=!Q&&(b===1||b===0&&(y===1||w&&y<=0)),k=self.performance.now();(Q||b||s.stats.parsing.start===0)&&(s.stats.parsing.start=k),o&&(y||!R)&&(o.stats.parsing.start=k);const $=!(p&&((u=s.initSegment)==null?void 0:u.url)===((h=p.initSegment)==null?void 0:h.url)),K=new mI(C,R,l,Q,f,$);if(!R||C||$){U.log(`[transmuxer-interface, ${s.type}]: Starting new transmux session for sn: ${A.sn} p: ${A.part} level: ${A.level} id: ${A.id}
2471
- discontinuity: ${C}
2470
+ Switching to level ${W} @ ${ie|0} bps`),i.trigger(I.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:n,stats:l})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(U.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 cE(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.FRAG_LOADING,this.onFragLoading,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.FRAG_LOADING,this.onFragLoading,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(I.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 n=t.frag;if(!this.ignoreFragment(n)){if(!n.bitrateTest){var i;this.fragCurrent=n,this.partCurrent=(i=t.part)!=null?i: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 K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case K.FRAG_LOAD_TIMEOUT:{const n=t.frag,{fragCurrent:i,partCurrent:s}=this;if(n&&i&&n.sn===i.sn&&n.level===i.level){const o=performance.now(),a=s?s.stats:n.stats,l=o-a.loading.start,A=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&A>-1){const u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(u,A),a.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,n,i){const s=e+n/t,o=i?this.lastLevelLoadSec:0;return s+o}onLevelLoaded(e,t){const n=this.hls.config,{loading:i}=t.stats,s=i.end-i.start;he(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:n}){const i=n?n.stats:t.stats;if(t.type===Ee.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const s=n?n.duration:t.duration,o=this.hls.levels[t.level],a=(o.loaded?o.loaded.bytes:0)+i.loaded,l=(o.loaded?o.loaded.duration:0)+s;o.loaded={bytes:a,duration:l},o.realBitrate=Math.round(8*a/l)}if(t.bitrateTest){const s={stats:i,frag:t,part:n,id:t.type};this.onFragBuffered(I.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:i}=t,s=i!=null&&i.stats.loaded?i.stats:n.stats;if(s.aborted||this.ignoreFragment(n))return;const o=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,s.loaded),s.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Ee.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,s=this.findBestLevel(n,t,e,0,i,1,1);if(s>-1)return s;const o=this.hls.firstLevel,a=Math.min(Math.max(o,t),e);return U.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,n=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const s=n&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,s)&&o[e].loadError<=o[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:n}=this,{maxAutoLevel:i,config:s,minAutoLevel:o}=n,a=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),A=this.getStarvationDelay();let c=s.abrBandWidthFactor,u=s.abrBandWidthUpFactor;if(A){const p=this.findBestLevel(l,o,i,A,0,c,u);if(p>=0)return p}let h=a?Math.min(a,s.maxStarvationDelay):s.maxStarvationDelay;if(!A){const p=this.bitrateTestDelay;p&&(h=(a?Math.min(a,s.maxLoadingDelay):s.maxLoadingDelay)-p,U.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(l,o,i,A,h,c,u);if(U.info(`[abr] ${A?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`),d>-1)return d;const f=n.levels[o],g=n.levels[n.loadLevel];return(f==null?void 0:f.bitrate)<(g==null?void 0:g.bitrate)?o:n.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,i=e.mainForwardBufferInfo;return(i?i.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,i,s,o,a){var l;const A=i+s,c=this.lastLoadedFragLevel,u=c===-1?this.hls.firstLevel:c,{fragCurrent:h,partCurrent:d}=this,{levels:f,allAudioTracks:g,loadLevel:p,config:y}=this.hls;if(f.length===1)return 0;const Q=f[u],b=!!(Q!=null&&(l=Q.details)!=null&&l.live),C=p===-1||c===-1;let w,R="SDR",k=(Q==null?void 0:Q.frameRate)||0;const{audioPreference:$,videoPreference:V}=y,O=this.audioTracksByGroup||(this.audioTracksByGroup=mE(g));if(C){if(this.firstSelection!==-1)return this.firstSelection;const D=this.codecTiers||(this.codecTiers=EE(f,O,t,n)),P=pE(D,R,e,$,V),{codecSet:X,videoRanges:_,minFramerate:S,minBitrate:F,preferHDR:J}=P;w=X,R=J?_[_.length-1]:_[0],k=S,e=Math.max(e,F),U.log(`[abr] picked start tier ${JSON.stringify(P)}`)}else w=Q==null?void 0:Q.codecSet,R=Q==null?void 0:Q.videoRange;const W=d?d.duration:h?h.duration:0,ie=this.bwEstimator.getEstimateTTFB()/1e3,te=[];for(let D=n;D>=t;D--){var le;const P=f[D],X=D>u;if(!P)continue;if(y.useMediaCapabilities&&!P.supportedResult&&!P.supportedPromise){const ce=navigator.mediaCapabilities;typeof(ce==null?void 0:ce.decodingInfo)=="function"&&uE(P,O,R,k,e,$)?(P.supportedPromise=hE(P,O,ce),P.supportedPromise.then(pe=>{if(!this.hls)return;P.supportedResult=pe;const ge=this.hls.levels,Se=ge.indexOf(P);pe.error?U.warn(`[abr] MediaCapabilities decodingInfo error: "${pe.error}" for level ${Se} ${JSON.stringify(pe)}`):pe.supported||(U.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${Se} ${JSON.stringify(pe)}`),Se>-1&&ge.length>1&&(U.log(`[abr] Removing unsupported level ${Se}`),this.hls.removeLevel(Se)))})):P.supportedResult=Eu}if(w&&P.codecSet!==w||R&&P.videoRange!==R||X&&k>P.frameRate||!X&&k>0&&k<P.frameRate||P.supportedResult&&!((le=P.supportedResult.decodingInfoResults)!=null&&le[0].smooth)){te.push(D);continue}const _=P.details,S=(d?_==null?void 0:_.partTarget:_==null?void 0:_.averagetargetduration)||W;let F;X?F=a*e:F=o*e;const J=W&&i>=W*2&&s===0?f[D].averageBitrate:f[D].maxBitrate,Y=this.getTimeToLoadFrag(ie,F,J*S,_===void 0);if(F>=J&&(D===c||P.loadError===0&&P.fragmentError===0)&&(Y<=ie||!he(Y)||b&&!this.bitrateTestDelay||Y<A)){const ce=this.forcedAutoLevel;return D!==p&&(ce===-1||ce!==p)&&(te.length&&U.trace(`[abr] Skipped level(s) ${te.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${f[te[0]].codecs}" ${f[te[0]].videoRange}; not compatible with "${Q.codecs}" ${R}`),U.info(`[abr] switch candidate:${u}->${D} adjustedbw(${Math.round(F)})-bitrate=${Math.round(F-J)} ttfb:${ie.toFixed(1)} avgDuration:${S.toFixed(1)} maxFetchDuration:${A.toFixed(1)} fetchDuration:${Y.toFixed(1)} firstSelection:${C} codecSet:${w} videoRange:${R} hls.loadLevel:${p}`)),C&&(this.firstSelection=D),D}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls,i=Math.min(Math.max(e,n),t);this._nextAutoLevel!==i&&(this.nextAutoLevelKey="",this._nextAutoLevel=i)}}class yE{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 dt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class BE{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(I.BUFFER_APPENDED,this.onBufferAppended,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.BUFFER_APPENDED,this.onBufferAppended,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const n=this.activePartLists[t];if(n)for(let i=n.length;i--;){const s=n[i];if(!s)break;const o=s.end;if(s.start<=e&&o!==null&&e<=o)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:n}=this,i=Object.keys(n);for(let s=i.length;s--;){const o=n[i[s]];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,n,i){this.timeRanges&&(this.timeRanges[e]=t);const s=(i==null?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a||s>=a.body.sn)return;if(!a.buffered&&!a.loaded){a.body.type===n&&this.removeFragment(a.body);return}const l=a.range[e];l&&l.time.some(A=>{const c=!this.isTimeBuffered(A.startPTS,A.endPTS,t);return c&&this.removeFragment(a.body),c})})}detectPartialFragments(e){const t=this.timeRanges,{frag:n,part:i}=e;if(!t||n.sn==="initSegment")return;const s=bn(n),o=this.fragments[s];if(!o||o.buffered&&n.gap)return;const a=!n.relurl;Object.keys(t).forEach(l=>{const A=n.elementaryStreams[l];if(!A)return;const c=t[l],u=a||A.partial===!0;o.range[l]=this.getBufferedTimes(n,i,u,c)}),o.loaded=null,Object.keys(o.range).length?(o.buffered=!0,(o.body.endList=n.endList||o.body.endList)&&(this.endListFragments[o.body.type]=o),Qs(o)||this.removeParts(n.sn-1,n.type)):this.removeFragment(o.body)}removeParts(e,t){const n=this.activePartLists[t];n&&(this.activePartLists[t]=n.filter(i=>i.fragment.sn>=e))}fragBuffered(e,t){const n=bn(e);let i=this.fragments[n];!i&&t&&(i=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)}getBufferedTimes(e,t,n,i){const s={time:[],partial:n},o=e.start,a=e.end,l=e.minEndPTS||a,A=e.maxStartPTS||o;for(let c=0;c<i.length;c++){const u=i.start(c)-this.bufferPadding,h=i.end(c)+this.bufferPadding;if(A>=u&&l<=h){s.time.push({startPTS:Math.max(o,i.start(c)),endPTS:Math.min(a,i.end(c))});break}else if(o<h&&a>u){const d=Math.max(o,i.start(c)),f=Math.min(a,i.end(c));f>d&&(s.partial=!0,s.time.push({startPTS:d,endPTS:f}))}else if(a<=u)break}return s}getPartialFragment(e){let t=null,n,i,s,o=0;const{bufferPadding:a,fragments:l}=this;return Object.keys(l).forEach(A=>{const c=l[A];c&&Qs(c)&&(i=c.body.start-a,s=c.body.end+a,e>=i&&e<=s&&(n=Math.min(e-i,s-e),o<=n&&(t=c.body,o=n)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Qs(t))}getState(e){const t=bn(e),n=this.fragments[t];return n?n.buffered?Qs(n)?dt.PARTIAL:dt.OK:dt.APPENDING:dt.NOT_LOADED}isTimeBuffered(e,t,n){let i,s;for(let o=0;o<n.length;o++){if(i=n.start(o)-this.bufferPadding,s=n.end(o)+this.bufferPadding,e>=i&&t<=s)return!0;if(t<=i)return!1}return!1}onFragLoaded(e,t){const{frag:n,part:i}=t;if(n.sn==="initSegment"||n.bitrateTest)return;const s=i?null:t,o=bn(n);this.fragments[o]={body:n,appendedPTS:null,loaded:s,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:n,part:i,timeRanges:s}=t;if(n.sn==="initSegment")return;const o=n.type;if(i){let a=this.activePartLists[o];a||(this.activePartLists[o]=a=[]),a.push(i)}this.timeRanges=s,Object.keys(s).forEach(a=>{const l=s[a];this.detectEvictedFragments(a,l,o,i)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=bn(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,n,i,s){i&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const a=this.fragments[o];if(!a)return;const l=a.body;l.type!==n||i&&!l.gap||l.start<t&&l.end>e&&(a.buffered||s)&&this.removeFragment(l)})}removeFragment(e){const t=bn(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const i=e.sn;this.activePartLists[e.type]=n.filter(s=>s.fragment.sn!==i)}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 Qs(r){var e,t,n;return r.buffered&&(r.body.gap||((e=r.range.video)==null?void 0:e.partial)||((t=r.range.audio)==null?void 0:t.partial)||((n=r.range.audiovideo)==null?void 0:n.partial))}function bn(r){return`${r.type}_${r.level}_${r.sn}`}const TE={length:0,start:()=>0,end:()=>0};class Ke{static isBuffered(e,t){try{if(e){const n=Ke.getBuffered(e);for(let i=0;i<n.length;i++)if(t>=n.start(i)&&t<=n.end(i))return!0}}catch{}return!1}static bufferInfo(e,t,n){try{if(e){const i=Ke.getBuffered(e),s=[];let o;for(o=0;o<i.length;o++)s.push({start:i.start(o),end:i.end(o)});return this.bufferedInfo(s,t,n)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.sort(function(A,c){const u=A.start-c.start;return u||c.end-A.end});let i=[];if(n)for(let A=0;A<e.length;A++){const c=i.length;if(c){const u=i[c-1].end;e[A].start-u<n?e[A].end>u&&(i[c-1].end=e[A].end):i.push(e[A])}else i.push(e[A])}else i=e;let s=0,o,a=t,l=t;for(let A=0;A<i.length;A++){const c=i[A].start,u=i[A].end;if(t+n>=c&&t<u)a=c,l=u,s=l-t;else if(t+n<c){o=c;break}}return{len:s,start:a||0,end:l||0,nextStart:o}}static getBuffered(e){try{return e.buffered}catch(t){return U.log("failed to get media.buffered",t),TE}}}class va{constructor(e,t,n,i=0,s=-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=bs(),this.buffering={audio:bs(),video:bs(),audiovideo:bs()},this.level=e,this.sn=t,this.id=n,this.size=i,this.part=s,this.partial=o}}function bs(){return{start:0,executeStart:0,executeEnd:0,end:0}}function xs(r,e){for(let n=0,i=r.length;n<i;n++){var t;if(((t=r[n])==null?void 0:t.cc)===e)return r[n]}return null}function QE(r,e,t){return!!(e&&(t.endCC>t.startCC||r&&r.cc<t.startCC))}function bE(r,e){const t=r.fragments,n=e.fragments;if(!n.length||!t.length){U.log("No fragments to align");return}const i=xs(t,n[0].cc);if(!i||i&&!i.startPTS){U.log("No frag in previous level to align on");return}return i}function Cu(r,e){if(r){const t=r.start+e;r.start=r.startPTS=t,r.endPTS=t+r.duration}}function yu(r,e){const t=e.fragments;for(let n=0,i=t.length;n<i;n++)Cu(t[n],r);e.fragmentHint&&Cu(e.fragmentHint,r),e.alignedSliding=!0}function xE(r,e,t){e&&(wE(r,t,e),!t.alignedSliding&&e&&ws(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&uu(e,t))}function wE(r,e,t){if(QE(r,t,e)){const n=bE(t,e);n&&he(n.start)&&(U.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),yu(n.start,e))}}function ws(r,e){if(!r.hasProgramDateTime||!e.hasProgramDateTime)return;const t=r.fragments,n=e.fragments;if(!t.length||!n.length)return;let i,s;const o=Math.min(e.endCC,r.endCC);e.startCC<o&&r.startCC<o&&(i=xs(n,o),s=xs(t,o)),(!i||!s)&&(i=n[Math.floor(n.length/2)],s=xs(t,i.cc)||t[Math.floor(t.length/2)]);const a=i.programDateTime,l=s.programDateTime;if(!a||!l)return;const A=(l-a)/1e3-(s.start-i.start);yu(A,r)}const Bu=Math.pow(2,17);class SE{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 n=e.url;if(!n)return Promise.reject(new Qr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const i=this.config,s=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(d=>d[0]==="GAP")){l(Qu(e));return}else e.gap=!1;const A=this.loader=e.loader=s?new s(i):new o(i),c=Tu(e),u=pu(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Bu};e.stats=A.stats,A.load(c,h,{onSuccess:(d,f,g,p)=>{this.resetLoader(e,A);let y=d.data;g.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(y.slice(0,16)),y=y.slice(16)),a({frag:e,part:null,payload:y,networkDetails:p})},onError:(d,f,g,p)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:ht({url:n,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:g,stats:p}))},onAbort:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:g,stats:d}))},onTimeout:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:d}))},onProgress:(d,f,g,p)=>{t&&t({frag:e,part:null,payload:g,networkDetails:p})}})})}loadPart(e,t,n){this.abort();const i=this.config,s=i.fLoader,o=i.loader;return new Promise((a,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(Qu(e,t));return}const A=this.loader=e.loader=s?new s(i):new o(i),c=Tu(e,t),u=pu(i.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Bu};t.stats=A.stats,A.load(c,h,{onSuccess:(d,f,g,p)=>{this.resetLoader(e,A),this.updateStatsFromPart(e,t);const y={frag:e,part:t,payload:d.data,networkDetails:p};n(y),a(y)},onError:(d,f,g,p)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:ht({url:c.url,data:void 0},d),error:new Error(`HTTP Error ${d.code} ${d.text}`),networkDetails:g,stats:p}))},onAbort:(d,f,g)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:g,stats:d}))},onTimeout:(d,f,g)=>{this.resetLoader(e,A),l(new Qr({type:Be.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:g,stats:d}))}})})}updateStatsFromPart(e,t){const n=e.stats,i=t.stats,s=i.total;if(n.loaded+=i.loaded,s){const l=Math.round(e.duration/t.duration),A=Math.min(Math.round(n.loaded/s),l),u=(l-A)*Math.round(n.loaded/A);n.total=n.loaded+u}else n.total=Math.max(n.loaded,n.total);const o=n.loading,a=i.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 Tu(r,e=null){const t=e||r,n={frag:r,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},i=t.byteRangeStartOffset,s=t.byteRangeEndOffset;if(he(i)&&he(s)){var o;let a=i,l=s;if(r.sn==="initSegment"&&((o=r.decryptdata)==null?void 0:o.method)==="AES-128"){const A=s-i;A%16&&(l=s+(16-A%16)),i!==0&&(n.resetIV=!0,a=i-16)}n.rangeStart=a,n.rangeEnd=l}return n}function Qu(r,e){const t=new Error(`GAP ${r.gap?"tag":"attribute"} found`),n={type:Be.MEDIA_ERROR,details:K.FRAG_GAP,fatal:!1,frag:r,error:t,networkDetails:null};return e&&(n.part=e),(e||r).stats.aborted=!0,new Qr(n)}class Qr extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class RE{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 DE{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 _E(r){const e=r.byteLength,t=e&&new DataView(r.buffer).getUint8(e-1);return t?Zr(r,0,e-t):r}class LE{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),n=new Uint32Array(4);for(let i=0;i<4;i++)n[i]=t.getUint32(i*4);return n}initTable(){const e=this.sBox,t=this.invSBox,n=this.subMix,i=n[0],s=n[1],o=n[2],a=n[3],l=this.invSubMix,A=l[0],c=l[1],u=l[2],h=l[3],d=new Uint32Array(256);let f=0,g=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 y=g^g<<1^g<<2^g<<3^g<<4;y=y>>>8^y&255^99,e[f]=y,t[y]=f;const Q=d[f],b=d[Q],C=d[b];let w=d[y]*257^y*16843008;i[f]=w<<24|w>>>8,s[f]=w<<16|w>>>16,o[f]=w<<8|w>>>24,a[f]=w,w=C*16843009^b*65537^Q*257^f*16843008,A[y]=w<<24|w>>>8,c[y]=w<<16|w>>>16,u[y]=w<<8|w>>>24,h[y]=w,f?(f=Q^d[d[d[C^Q]]],g^=d[d[g]]):f=g=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,i=0;for(;i<t.length&&n;)n=t[i]===this.key[i],i++;if(n)return;this.key=t;const s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const o=this.ksRows=(s+6+1)*4;let a,l;const A=this.keySchedule=new Uint32Array(o),c=this.invKeySchedule=new Uint32Array(o),u=this.sBox,h=this.rcon,d=this.invSubMix,f=d[0],g=d[1],p=d[2],y=d[3];let Q,b;for(a=0;a<o;a++){if(a<s){Q=A[a]=t[a];continue}b=Q,a%s===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/s|0]<<24):s>6&&a%s===4&&(b=u[b>>>24]<<24|u[b>>>16&255]<<16|u[b>>>8&255]<<8|u[b&255]),A[a]=Q=(A[a-s]^b)>>>0}for(l=0;l<o;l++)a=o-l,l&3?b=A[a]:b=A[a-4],l<4||a<=4?c[l]=b:c[l]=f[u[b>>>24]]^g[u[b>>>16&255]]^p[u[b>>>8&255]]^y[u[b&255]],c[l]=c[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){const i=this.keySize+6,s=this.invKeySchedule,o=this.invSBox,a=this.invSubMix,l=a[0],A=a[1],c=a[2],u=a[3],h=this.uint8ArrayToUint32Array_(n);let d=h[0],f=h[1],g=h[2],p=h[3];const y=new Int32Array(e),Q=new Int32Array(y.length);let b,C,w,R,k,$,V,O,W,ie,te,le,D,P;const X=this.networkToHostOrderSwap;for(;t<y.length;){for(W=X(y[t]),ie=X(y[t+1]),te=X(y[t+2]),le=X(y[t+3]),k=W^s[0],$=le^s[1],V=te^s[2],O=ie^s[3],D=4,P=1;P<i;P++)b=l[k>>>24]^A[$>>16&255]^c[V>>8&255]^u[O&255]^s[D],C=l[$>>>24]^A[V>>16&255]^c[O>>8&255]^u[k&255]^s[D+1],w=l[V>>>24]^A[O>>16&255]^c[k>>8&255]^u[$&255]^s[D+2],R=l[O>>>24]^A[k>>16&255]^c[$>>8&255]^u[V&255]^s[D+3],k=b,$=C,V=w,O=R,D=D+4;b=o[k>>>24]<<24^o[$>>16&255]<<16^o[V>>8&255]<<8^o[O&255]^s[D],C=o[$>>>24]<<24^o[V>>16&255]<<16^o[O>>8&255]<<8^o[k&255]^s[D+1],w=o[V>>>24]<<24^o[O>>16&255]<<16^o[k>>8&255]<<8^o[$&255]^s[D+2],R=o[O>>>24]<<24^o[k>>16&255]<<16^o[$>>8&255]<<8^o[V&255]^s[D+3],Q[t]=X(b^d),Q[t+1]=X(R^f),Q[t+2]=X(w^g),Q[t+3]=X(C^p),d=W,f=ie,g=te,p=le,t=t+4}return Q.buffer}}const FE=16;class Ca{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 n=self.crypto;n&&(this.subtle=n.subtle||n.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 n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?_E(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n){return this.useSoftware?new Promise((i,s)=>{this.softwareDecrypt(new Uint8Array(e),t,n);const o=this.flush();o?i(o.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,n)}softwareDecrypt(e,t,n){const{currentIV:i,currentResult:s,remainderData:o}=this;this.logOnce("JS AES decrypt"),o&&(e=$t(o,e),this.remainderData=null);const a=this.getValidChunk(e);if(!a.length)return null;i&&(n=i);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new LE),l.expandKey(t);const A=s;return this.currentResult=l.decrypt(a.buffer,0,n),this.currentIV=Zr(a,-16).buffer,A||null}webCryptoDecrypt(e,t,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n));this.key=t,this.fastAesKey=new DE(this.subtle,t)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new RE(this.subtle,new Uint8Array(n)).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(U.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,n)))}onWebCryptoError(e,t,n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n);const i=this.flush();if(i)return i.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const n=e.length-e.length%FE;return n!==e.length&&(t=Zr(e,0,n),this.remainderData=Zr(e,n)),t}logOnce(e){this.logEnabled&&(U.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const kE={toString:function(r){let e="";const t=r.length;for(let n=0;n<t;n++)e+=`[${r.start(n).toFixed(3)}-${r.end(n).toFixed(3)}]`;return e}},re={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 ya extends yE{constructor(e,t,n,i,s){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=re.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=s,this.logPrefix=i,this.log=U.log.bind(U,`${i}:`),this.warn=U.warn.bind(U,`${i}:`),this.hls=e,this.fragmentLoader=new SE(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Ca(e.config),e.on(I.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=re.STOPPED}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const n=t.partList;if(n!=null&&n.length){const s=n[n.length-1];return Ke.isBuffered(this.media,s.start+s.duration/2)}const i=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(i)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const n=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),n.addEventListener("seeking",this.onvseeking),n.addEventListener("ended",this.onvended);const i=this.config;this.levels&&i.autoStartLoad&&this.state===re.STOPPED&&this.startLoad(i.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:n,mediaBuffer:i,state:s}=this,o=n?n.currentTime:0,a=Ke.bufferInfo(i||n,o,e.maxBufferHole);if(this.log(`media seeking to ${he(o)?o.toFixed(3):o}, state: ${s}`),this.state===re.ENDED)this.resetLoadingState();else if(t){const l=e.maxFragLookUpTolerance,A=t.start-l,c=t.start+t.duration+l;if(!a.len||c<a.start||A>a.end){const u=o>c;(o<A||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)}}n&&(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(I.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=re.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,n){this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){const i=s=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${s.part?" p: "+s.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,n,i).then(s=>{if(!s)return;const o=this.state;if(this.fragContextChanged(e)){(o===re.FRAG_LOADING||!this.fragCurrent&&o===re.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=re.IDLE);return}"payload"in s&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(I.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===re.STOPPED||this.state===re.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===dt.APPENDING){const s=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,s),a=Math.max(e.duration,o?o.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(a))&&n.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===dt.PARTIAL&&n.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,n=null){if(!(e-t))return;const i={startOffset:e,endOffset:t,type:n};this.hls.trigger(I.BUFFER_FLUSHING,i)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(n=>{if(!n||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:i}=this,{payload:s}=n,o=e.decryptdata;if(s&&s.byteLength>0&&o!=null&&o.key&&o.iv&&o.method==="AES-128"){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),o.key.buffer,o.iv.buffer).catch(l=>{throw i.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:e}),l}).then(l=>{const A=self.performance.now();return i.trigger(I.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:a,tdecrypt:A}}),n.payload=l,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===re.STOPPED||this.state===re.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state=re.IDLE,e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.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 n,i,s,o;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===Ee.MAIN?"level":"track"} ${e.level} (frag:[${((n=e.startPTS)!=null?n:NaN).toFixed(3)}-${((i=e.endPTS)!=null?i:NaN).toFixed(3)}] > buffer:${a?kE.toString(Ke.getBuffered(a)):"(detached)"})`),e.sn!=="initSegment"){var l;if(e.type!==Ee.SUBTITLE){const c=e.elementaryStreams;if(!Object.keys(c).some(u=>!!c[u])){this.state=re.IDLE;return}}const A=(l=this.levels)==null?void 0:l[e.level];A!=null&&A.fragmentError&&(this.log(`Resetting level fragment error count of ${A.fragmentError} on frag buffered`),A.fragmentError=0)}this.state=re.IDLE,a&&(!this.loadedmetadata&&e.type==Ee.MAIN&&a.buffered.length&&((s=this.fragCurrent)==null?void 0:s.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:n,part:i,partsLoaded:s}=e,o=!s||s.length===0||s.some(l=>!l),a=new va(n.level,n.sn,n.stats.chunkCount+1,0,i?i.index:-1,!o);t.flush(a)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,i){var s;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&&!((s=e.decryptdata)!=null&&s.key)?(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=re.KEY_LOADING,this.fragCurrent=e,a=this.keyLoader.load(e).then(c=>{if(!this.fragContextChanged(c.frag))return this.hls.trigger(I.KEY_LOADED,c),this.state===re.KEY_LOADING&&(this.state=re.IDLE),c}),this.hls.trigger(I.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),n=Math.max(e.start,n||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const c=o.partList;if(c&&i){n>e.end&&o.fragmentHint&&(e=o.fragmentHint);const u=this.getNextPart(c,e,n);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(n.toFixed(3))}`),this.nextLoadPosition=h.start+h.duration,this.state=re.FRAG_LOADING;let d;return a?d=a.then(f=>!f||this.fragContextChanged(f.frag)?null:this.doFragPartsLoad(e,h,t,i)).catch(f=>this.handleFragLoadError(f)):d=this.doFragPartsLoad(e,h,t,i).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(I.FRAG_LOADING,{frag:e,part:h,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}else if(!e.url||this.loadedEndOfParts(c,n))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(n.toFixed(3))}`),he(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=re.FRAG_LOADING;const l=this.config.progressive;let A;return l&&a?A=a.then(c=>!c||this.fragContextChanged(c==null?void 0:c.frag)?null:this.fragmentLoader.load(e,i)).catch(c=>this.handleFragLoadError(c)):A=Promise.all([this.fragmentLoader.load(e,l?i:void 0),a]).then(([c])=>(!l&&c&&i&&i(c),c)).catch(c=>this.handleFragLoadError(c)),this.hls.trigger(I.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):A}doFragPartsLoad(e,t,n,i){return new Promise((s,o)=>{var a;const l=[],A=(a=n.details)==null?void 0:a.partList,c=u=>{this.fragmentLoader.loadPart(e,u,i).then(h=>{l[u.index]=h;const d=h.part;this.hls.trigger(I.FRAG_LOADED,h);const f=hu(n,e.sn,u.index+1)||du(A,e.sn,u.index+1);if(f)c(f);else return s({frag:e,part:d,partsLoaded:l})}).catch(o)};c(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===K.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(I.ERROR,t)}else this.hls.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==re.PARSING){!this.fragCurrent&&this.state!==re.STOPPED&&this.state!==re.ERROR&&(this.state=re.IDLE);return}const{frag:n,part:i,level:s}=t,o=self.performance.now();n.stats.parsing.end=o,i&&(i.stats.parsing.end=o),this.updateLevelTiming(n,i,s,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:n}=this,{level:i,sn:s,part:o}=e;if(!(t!=null&&t[i]))return this.warn(`Levels object was unset while buffering fragment ${s} of level ${i}. The current chunk will not be buffered.`),null;const a=t[i],l=o>-1?hu(a,s,o):null,A=l?l.fragment:nE(a,s,n);return A?(n&&n!==A&&(A.stats=n.stats),{frag:A,part:l,level:a}):null}bufferFragmentData(e,t,n,i,s){var o;if(!e||this.state!==re.PARSING)return;const{data1:a,data2:l}=e;let A=a;if(a&&l&&(A=$t(a,l)),!((o=A)!=null&&o.length))return;const c={type:e.type,frag:t,part:n,chunkMeta:i,parent:t.type,data:A};if(this.hls.trigger(I.BUFFER_APPENDING,c),e.dropped&&e.independent&&!n){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Ke.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,i=Ke.bufferInfo(t,n,0),s=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),a=Math.max(Math.min(e.start-o,i.end-o),n+o);e.start-a>o&&this.flushMainBuffer(a,e.start)}getFwdBufferInfo(e,t){const n=this.getLoadPosition();return he(n)?this.getFwdBufferInfoAtPos(e,n,t):null}getFwdBufferInfoAtPos(e,t,n){const{config:{maxBufferHole:i}}=this,s=Ke.bufferInfo(e,t,i);if(s.len===0&&s.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(t,n);if(o&&s.nextStart<o.end)return Ke.bufferInfo(e,t,Math.max(s.nextStart,i))}return s}getMaxBufferLength(e){const{config:t}=this;let n;return e?n=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):n=t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e){const t=this.config,n=e||t.maxBufferLength,i=t.maxMaxBufferLength/2;return i>=n?(t.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0):!1}getAppendedFrag(e,t=Ee.MAIN){const n=this.fragmentTracker.getAppendedFrag(e,Ee.MAIN);return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const n=t.fragments,i=n.length;if(!i)return null;const{config:s}=this,o=n[0].start;let a;if(t.live){const l=s.initialLiveManifestSize;if(i<l)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${l})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o)&&(a=this.getInitialLiveFragment(t,n),this.startPosition=this.nextLoadPosition=a?this.hls.liveSyncPosition||a.start:e)}else e<=o&&(a=n[0]);if(!a){const l=s.lowLatencyMode?t.partEnd:t.fragmentEnd;a=this.getFragmentAtPosition(e,l,t)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===dt.OK||n===dt.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,i,s){const o=e.gap,a=this.getNextFragment(this.nextLoadPosition,t);if(a===null)return a;if(e=a,o&&e&&!e.gap&&n.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,i);if(l!==null&&n.len+l.len>=s)return this.log(`buffer full after gaps in "${i}" 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,n){let i=-1,s=!1,o=!0;for(let a=0,l=e.length;a<l;a++){const A=e[a];if(o=o&&!A.independent,i>-1&&n<A.start)break;const c=A.loaded;c?i=-1:(s||A.independent||o)&&A.fragment===t&&(i=a),s=c}return i}loadedEndOfParts(e,t){const n=e[e.length-1];return n&&t>n.start&&n.loaded}getInitialLiveFragment(e,t){const n=this.fragPrevious;let i=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),i=sE(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const s=n.sn+1;if(s>=e.startSN&&s<=e.endSN){const o=t[s-e.startSN];n.cc===o.cc&&(i=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=lE(t,n.cc),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(i=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i}getFragmentAtPosition(e,t,n){const{config:i}=this;let{fragPrevious:s}=this,{fragments:o,endSN:a}=n;const{fragmentHint:l}=n,{maxFragLookUpTolerance:A}=i,c=n.partList,u=!!(i.lowLatencyMode&&c!=null&&c.length&&l);u&&l&&!this.bitrateTest&&(o=o.concat(l),a=l.sn);let h;if(e<t){const d=e>t-A?0:A;h=Ts(s,o,e,d)}else h=o[o.length-1];if(h){const d=h.sn-n.startSN,f=this.fragmentTracker.getState(h);if((f===dt.OK||f===dt.PARTIAL&&h.gap)&&(s=h),s&&h.sn===s.sn&&(!u||c[0].fragment.sn>h.sn)&&s&&h.level===s.level){const p=o[d+1];h.sn<a&&this.fragmentTracker.getState(p)!==dt.OK?h=p:h=null}}return h}synchronizeToLiveEdge(e){const{config:t,media:n}=this;if(!n)return;const i=this.hls.liveSyncPosition,s=n.currentTime,o=e.fragments[0].start,a=e.edge,l=s>=o-t.maxFragLookUpTolerance&&s<=a;if(i!==null&&n.duration>i&&(s<i||!l)){const A=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!l&&n.readyState<4||s<a-A)&&(this.loadedmetadata||(this.nextLoadPosition=i),n.readyState&&(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${i.toFixed(3)}`),n.currentTime=i))}}alignPlaylists(e,t,n){const i=e.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const s=e.fragments[0].start,o=!t,a=e.alignedSliding&&he(s);if(o||!a&&!s){const{fragPrevious:l}=this;xE(l,n,e);const A=e.fragments[0].start;return this.log(`Live playlist sliding: ${A.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${l?l.sn:"na"} fragments: ${i}`),A}return s}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;if(n<t&&(n=-1),n===-1||this.lastCurrentTime===-1){const i=this.startTimeOffset!==null,s=i?this.startTimeOffset:e.startTimeOffset;s!==null&&he(s)?(n=t+s,s<0&&(n+=e.totalduration),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Start time offset ${s} found in ${i?"multivariant":"media"} playlist, adjust startPosition to ${n}`),this.startPosition=n):e.live?n=this.hls.liveSyncPosition||t:this.startPosition=n=0,this.lastCurrentTime=n}this.nextLoadPosition=n}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!==re.FRAG_LOADING_WAITING_RETRY)&&(this.state=re.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const c=this.getCurrentContext(t.chunkMeta);c&&(t.frag=c.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){var i;this.warn(`Frag load error must match current frag to retry ${n.url} > ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const s=t.details===K.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(n,!0);const o=t.errorAction,{action:a,retryCount:l=0,retryConfig:A}=o||{};if(o&&a===Bt.RetryRequest&&A){this.resetStartWhenNotLoaded(this.levelLastLoaded);const c=ma(A,l);this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${l+1}/${A.maxNumRetry} in ${c}ms`),o.resolved=!0,this.retryDate=self.performance.now()+c,this.state=re.FRAG_LOADING_WAITING_RETRY}else if(A&&o)if(this.resetFragmentErrors(e),l<A.maxNumRetry)!s&&a!==Bt.RemoveAlternatePermanently&&(o.resolved=!0);else{U.warn(`${t.details} reached or exceeded max retry (${l})`);return}else(o==null?void 0:o.action)===Bt.SendAlternateToPenaltyBox?this.state=re.WAITING_LEVEL:this.state=re.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===re.PARSING||this.state===re.PARSED){const t=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,t),i=n&&n.len>.5;i&&this.reduceMaxBufferLength(n.len);const s=!i;return s&&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(),s}return!1}resetFragmentErrors(e){e===Ee.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==re.STOPPED&&(this.state=re.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;const i=Ke.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,n),this.state===re.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=re.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,n,i){var s;const o=n.details;if(!o){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,A)=>{const c=e.elementaryStreams[A];if(c){const u=c.endPTS-c.startPTS;if(u<=0)return this.warn(`Could not parse fragment ${e.sn} ${A} duration reliably (${u})`),l||!1;const h=i?0:cu(o,e,c.startPTS,c.endPTS,c.startDTS,c.endDTS);return this.hls.trigger(I.LEVEL_PTS_UPDATED,{details:o,level:n,drift:h,type:A,frag:e,start:c.startPTS,end:c.endPTS}),!0}return l},!1)&&((s=this.transmuxer)==null?void 0:s.error)===null){const l=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(n.fragmentError===0&&(n.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=re.PARSED,this.hls.trigger(I.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 bu{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let n;if(e.length)e.length===1?n=e[0]:n=NE(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function NE(r,e){const t=new Uint8Array(e);let n=0;for(let i=0;i<r.length;i++){const s=r[i];t.set(s,n),n+=s.length}return t}function ME(){return typeof __HLS_WORKER_BUNDLE__=="function"}function PE(){const r=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(r);return{worker:new self.Worker(e),objectURL:e}}function OE(r){const e=new self.URL(r,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function ur(r="",e=9e4){return{type:r,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Ba{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,n,i){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,n){}demux(e,t){this.cachedData&&(e=$t(this.cachedData,e),this.cachedData=null);let n=ui(e,0),i=n?n.length:0,s;const o=this._audioTrack,a=this._id3Track,l=n?na(n):void 0,A=e.length;for((this.basePTS===null||this.frameIndex===0&&he(l))&&(this.basePTS=UE(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:zt.audioId3,duration:Number.POSITIVE_INFINITY});i<A;){if(this.canParse(e,i)){const c=this.appendFrame(o,e,i);c?(this.frameIndex++,this.lastPTS=c.sample.pts,i+=c.length,s=i):i=A}else lm(e,i)?(n=ui(e,i),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:zt.audioId3,duration:Number.POSITIVE_INFINITY}),i+=n.length,s=i):i++;if(i===A&&s!==A){const c=Zr(e,s);this.cachedData?this.cachedData=$t(this.cachedData,c):this.cachedData=c}}return{audioTrack:o,videoTrack:ur(),id3Track:a,textTrack:ur()}}demuxSampleAes(e,t,n){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:ur(),id3Track:this._id3Track,textTrack:ur()}}destroy(){}}const UE=(r,e,t)=>{if(he(r))return r*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};function GE(r,e,t,n){let i,s,o,a;const l=navigator.userAgent.toLowerCase(),A=n,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=((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}`);r.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!0,error:h,reason:h.message});return}return o=(e[t+2]&1)<<2,o|=(e[t+3]&192)>>>6,U.log(`manifest codec:${n}, ADTS type:${i}, samplingIndex:${u}`),/firefox/i.test(l)?u>=6?(i=5,a=new Array(4),s=u-3):(i=2,a=new Array(2),s=u):l.indexOf("android")!==-1?(i=2,a=new Array(2),s=u):(i=5,a=new Array(4),n&&(n.indexOf("mp4a.40.29")!==-1||n.indexOf("mp4a.40.5")!==-1)||!n&&u>=6?s=u-3:((n&&n.indexOf("mp4a.40.2")!==-1&&(u>=6&&o===1||/vivaldi/i.test(l))||!n&&o===1)&&(i=2,a=new Array(2)),s=u)),a[0]=i<<3,a[0]|=(u&14)>>1,a[1]|=(u&1)<<7,a[1]|=o<<3,i===5&&(a[1]|=(s&14)>>1,a[2]=(s&1)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:c[u],channelCount:o,codec:"mp4a.40."+i,manifestCodec:A}}function xu(r,e){return r[e]===255&&(r[e+1]&246)===240}function wu(r,e){return r[e+1]&1?7:9}function Ta(r,e){return(r[e+3]&3)<<11|r[e+4]<<3|(r[e+5]&224)>>>5}function HE(r,e){return e+5<r.length}function Ss(r,e){return e+1<r.length&&xu(r,e)}function $E(r,e){return HE(r,e)&&xu(r,e)&&Ta(r,e)<=r.length-e}function YE(r,e){if(Ss(r,e)){const t=wu(r,e);if(e+t>=r.length)return!1;const n=Ta(r,e);if(n<=t)return!1;const i=e+n;return i===r.length||Ss(r,i)}return!1}function Su(r,e,t,n,i){if(!r.samplerate){const s=GE(e,t,n,i);if(!s)return;r.config=s.config,r.samplerate=s.samplerate,r.channelCount=s.channelCount,r.codec=s.codec,r.manifestCodec=s.manifestCodec,U.log(`parsed codec:${r.codec}, rate:${s.samplerate}, channels:${s.channelCount}`)}}function Ru(r){return 9216e4/r}function VE(r,e){const t=wu(r,e);if(e+t<=r.length){const n=Ta(r,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function Du(r,e,t,n,i){const s=Ru(r.samplerate),o=n+i*s,a=VE(e,t);let l;if(a){const{frameLength:u,headerLength:h}=a,d=h+u,f=Math.max(0,t+d-e.length);f?(l=new Uint8Array(d-h),l.set(e.subarray(t+h,e.length),0)):l=e.subarray(t+h,t+d);const g={unit:l,pts:o};return f||r.samples.push(g),{sample:g,length:d,missing:f}}const A=e.length-t;return l=new Uint8Array(A),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:o},length:A,missing:-1}}let Rs=null;const KE=[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],JE=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],WE=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],qE=[0,1,1,4];function _u(r,e,t,n,i){if(t+24>e.length)return;const s=Lu(e,t);if(s&&t+s.frameLength<=e.length){const o=s.samplesPerFrame*9e4/s.sampleRate,a=n+i*o,l={unit:e.subarray(t,t+s.frameLength),pts:a,dts:a};return r.config=[],r.channelCount=s.channelCount,r.samplerate=s.sampleRate,r.samples.push(l),{sample:l,length:s.frameLength,missing:0}}}function Lu(r,e){const t=r[e+1]>>3&3,n=r[e+1]>>1&3,i=r[e+2]>>4&15,s=r[e+2]>>2&3;if(t!==1&&i!==0&&i!==15&&s!==3){const o=r[e+2]>>1&1,a=r[e+3]>>6,l=t===3?3-n:n===3?3:4,A=KE[l*14+i-1]*1e3,u=JE[(t===3?0:t===2?1:2)*3+s],h=a===3?1:2,d=WE[t][n],f=qE[n],g=d*8*f,p=Math.floor(d*A/u+o)*f;if(Rs===null){const b=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Rs=b?parseInt(b[1]):0}return!!Rs&&Rs<=87&&n===2&&A>=224e3&&a===0&&(r[e+3]=r[e+3]|128),{sampleRate:u,channelCount:h,frameLength:p,samplesPerFrame:g}}}function Qa(r,e){return r[e]===255&&(r[e+1]&224)===224&&(r[e+1]&6)!==0}function Fu(r,e){return e+1<r.length&&Qa(r,e)}function XE(r,e){return Qa(r,e)&&4<=r.length-e}function ku(r,e){if(e+1<r.length&&Qa(r,e)){const n=Lu(r,e);let i=4;n!=null&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===r.length||Fu(r,s)}return!1}class jE extends Ba{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=ui(e,0);let n=(t==null?void 0:t.length)||0;if(ku(e,n))return!1;for(let i=e.length;n<i;n++)if(YE(e,n))return U.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return $E(e,t)}appendFrame(e,t,n){Su(e,this.observer,t,n,e.manifestCodec);const i=Du(e,t,n,this.basePTS,this.frameIndex);if(i&&i.missing===0)return i}}const zE=/\/emsg[-/]ID3/i;class ZE{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,n,i){const s=this.videoTrack=ur("video",1),o=this.audioTrack=ur("audio",1),a=this.txtTrack=ur("text",1);if(this.id3Track=ur("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=Mc(e);if(l.video){const{id:A,timescale:c,codec:u}=l.video;s.id=A,s.timescale=a.timescale=c,s.codec=u}if(l.audio){const{id:A,timescale:c,codec:u}=l.audio;o.id=A,o.timescale=c,o.codec=u}a.id=Lc.text,s.sampleDuration=0,s.duration=o.duration=i}resetContiguity(){this.remainderData=null}static probe(e){return mm(e)}demux(e,t){this.timeOffset=t;let n=e;const i=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=$t(this.remainderData,e));const a=Qm(n);this.remainderData=a.remainder,i.samples=a.valid||new Uint8Array}else i.samples=n;const o=this.extractID3Track(i,t);return s.samples=Oc(t,i),{videoTrack:i,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const i=this.extractID3Track(t,this.timeOffset);return n.samples=Oc(e,t),{videoTrack:t,audioTrack:ur(),id3Track:i,textTrack:ur()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const i=xe(e.samples,["emsg"]);i&&i.forEach(s=>{const o=wm(s);if(zE.test(o.schemeIdUri)){const a=he(o.presentationTime)?o.presentationTime/o.timeScale:t+o.presentationTimeDelta/o.timeScale;let l=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const A=o.payload;n.samples.push({data:A,len:A.byteLength,dts:a,pts:a,type:zt.emsg,duration:l})}})}return n}demuxSampleAes(e,t,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const Nu=(r,e)=>{let t=0,n=5;e+=n;const i=new Uint32Array(1),s=new Uint32Array(1),o=new Uint8Array(1);for(;n>0;){o[0]=r[e];const a=Math.min(n,8),l=8-a;s[0]=4278190080>>>24+l<<l,i[0]=(o[0]&s[0])>>l,t=t?t<<a|i[0]:i[0],e+=1,n-=a}return t};class eI extends Ba{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const i=Mu(e,t,n,this.basePTS,this.frameIndex);if(i!==-1)return{sample:e.samples[e.samples.length-1],length:i,missing:0}}static probe(e){if(!e)return!1;const t=ui(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&na(t)!==void 0&&Nu(e,n)<16}}function Mu(r,e,t,n,i){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const a=[48e3,44100,32e3][s],l=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][l*3+s]*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,g=[2,1,2,3,3,4,4,5][u]+d,p=e[t+5]>>3,y=e[t+5]&7,Q=new Uint8Array([s<<6|p<<1|y>>2,(y&3)<<6|u<<3|d<<2|l>>4,l<<4&224]),b=1536/a*9e4,C=n+i*b,w=e.subarray(t,t+c);return r.config=Q,r.channelCount=g,r.samplerate=a,r.samples.push({unit:w,pts:C}),c}class tI{constructor(){this.VideoSample=null}createVideoSample(e,t,n,i){return{key:e,frame:!1,pts:t,dts:n,units:[],debug:i,length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,i;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){const s=n.units;i=s[s.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const n=t.samples,i=n.length;if(i){const s=n[i-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&U.log(e.pts+"/"+e.dts+":"+e.debug)}}class Pu{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,n=e.byteLength-t,i=new Uint8Array(4),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");i.set(e.subarray(n,n+s)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}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 n=this.word>>>32-t;if(e>32&&U.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?n<<t|this.readBits(t):n}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,n=8,i;for(let s=0;s<e;s++)n!==0&&(i=this.readEG(),n=(t+i+256)%256),t=n===0?t:n}readSPS(){let e=0,t=0,n=0,i=0,s,o,a;const l=this.readUByte.bind(this),A=this.readBits.bind(this),c=this.readUEG.bind(this),u=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),f=this.skipUEG.bind(this),g=this.skipScalingList.bind(this);l();const p=l();if(A(5),h(3),l(),f(),p===100||p===110||p===122||p===244||p===44||p===83||p===86||p===118||p===128){const R=c();if(R===3&&h(1),f(),f(),h(1),u())for(o=R!==3?8:12,a=0;a<o;a++)u()&&(a<6?g(16):g(64))}f();const y=c();if(y===0)c();else if(y===1)for(h(1),d(),d(),s=c(),a=0;a<s;a++)d();f(),h(1);const Q=c(),b=c(),C=A(1);C===0&&h(1),h(1),u()&&(e=c(),t=c(),n=c(),i=c());let w=[1,1];if(u()&&u())switch(l()){case 1:w=[1,1];break;case 2:w=[12,11];break;case 3:w=[10,11];break;case 4:w=[16,11];break;case 5:w=[40,33];break;case 6:w=[24,11];break;case 7:w=[20,11];break;case 8:w=[32,11];break;case 9:w=[80,33];break;case 10:w=[18,11];break;case 11:w=[15,11];break;case 12:w=[64,33];break;case 13:w=[160,99];break;case 14:w=[4,3];break;case 15:w=[3,2];break;case 16:w=[2,1];break;case 255:{w=[l()<<8|l(),l()<<8|l()];break}}return{width:Math.ceil((Q+1)*16-e*2-t*2),height:(2-C)*(b+1)*16-(C?2:4)*(n+i),pixelRatio:w}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class rI extends tI{parseAVCPES(e,t,n,i,s){const o=this.parseAVCNALu(e,n.data);let a=this.VideoSample,l,A=!1;n.data=null,a&&o.length&&!e.audFound&&(this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts,"")),o.forEach(c=>{var u;switch(c.type){case 1:{let g=!1;l=!0;const p=c.data;if(A&&p.length>4){const y=new Pu(p).readSliceType();(y===2||y===4||y===7||y===9)&&(g=!0)}if(g){var h;(h=a)!=null&&h.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null)}a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts,"")),a.frame=!0,a.key=g;break}case 5:l=!0,(u=a)!=null&&u.frame&&!a.key&&(this.pushAccessUnit(a,e),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts,"")),a.key=!0,a.frame=!0;break;case 6:{l=!0,Uc(c.data,1,n.pts,t.samples);break}case 7:{var d,f;l=!0,A=!0;const g=c.data,y=new Pu(g).readSPS();if(!e.sps||e.width!==y.width||e.height!==y.height||((d=e.pixelRatio)==null?void 0:d[0])!==y.pixelRatio[0]||((f=e.pixelRatio)==null?void 0:f[1])!==y.pixelRatio[1]){e.width=y.width,e.height=y.height,e.pixelRatio=y.pixelRatio,e.sps=[g],e.duration=s;const Q=g.subarray(1,4);let b="avc1.";for(let C=0;C<3;C++){let w=Q[C].toString(16);w.length<2&&(w="0"+w),b+=w}e.codec=b}break}case 8:l=!0,e.pps=[c.data];break;case 9:l=!0,e.audFound=!0,a&&this.pushAccessUnit(a,e),a=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts,"");break;case 12:l=!0;break;default:l=!1,a&&(a.debug+="unknown NAL "+c.type+" ");break}a&&l&&a.units.push(c)}),i&&a&&(this.pushAccessUnit(a,e),this.VideoSample=null)}parseAVCNALu(e,t){const n=t.byteLength;let i=e.naluState||0;const s=i,o=[];let a=0,l,A,c,u=-1,h=0;for(i===-1&&(u=0,h=t[0]&31,i=0,a=1);a<n;){if(l=t[a++],!i){i=l?0:1;continue}if(i===1){i=l?0:2;continue}if(!l)i=3;else if(l===1){if(A=a-i-1,u>=0){const d={data:t.subarray(u,A),type:h};o.push(d)}else{const d=this.getLastNalUnit(e.samples);d&&(s&&a<=4-s&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-s)),A>0&&(d.data=$t(d.data,t.subarray(0,A)),d.state=0))}a<n?(c=t[a]&31,u=a,h=c,i=0):i=-1}else i=0}if(u>=0&&i>=0){const d={data:t.subarray(u,n),type:h,state:i};o.push(d)}if(o.length===0){const d=this.getLastNalUnit(e.samples);d&&(d.data=$t(d.data,t))}return e.naluState=i,o}}class nI{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Ca(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,n){const i=e[t].unit;if(i.length<=16)return;const s=i.subarray(16,i.length-i.length%16),o=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(o).then(a=>{const l=new Uint8Array(a);i.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)})}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)n.set(e.subarray(s,s+16),i);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let i=0;for(let s=32;s<e.length-16;s+=160,i+=16)e.set(n.subarray(i,i+16),s);return e}decryptAvcSample(e,t,n,i,s){const o=Gc(s.data),a=this.getAvcEncryptedData(o);this.decryptBuffer(a.buffer).then(l=>{s.data=this.getAvcDecryptedUnit(o,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,i)})}decryptAvcSamples(e,t,n,i){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length){i();return}const s=e[t].units;for(;!(n>=s.length);n++){const o=s[n];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,t,n,i,o),!this.decrypter.isSync()))return}}}}const ft=188;class Mr{constructor(e,t,n){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=n,this.videoParser=new rI}static probe(e){const t=Mr.syncOffset(e);return t>0&&U.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let n=Math.min(ft*5,t-ft)+1,i=0;for(;i<n;){let s=!1,o=-1,a=0;for(let l=i;l<t;l+=ft)if(e[l]===71&&(t-l===ft||e[l+ft]===71)){if(a++,o===-1&&(o=l,o!==0&&(n=Math.min(o+ft*99,e.length-ft)+1)),s||(s=ba(e,l)===0),s&&a>1&&(o===0&&a>2||l+ft>n))return o}else{if(a)return-1;break}i++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Lc[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Mr.createTrack("video"),this._audioTrack=Mr.createTrack("audio",i),this._id3Track=Mr.createTrack("id3"),this._txtTrack=Mr.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n,this._duration=i}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,i=!1){n||(this.sampleAes=null);let s;const o=this._videoTrack,a=this._audioTrack,l=this._id3Track,A=this._txtTrack;let c=o.pid,u=o.pesData,h=a.pid,d=l.pid,f=a.pesData,g=l.pesData,p=null,y=this.pmtParsed,Q=this._pmtId,b=e.length;if(this.remainderData&&(e=$t(this.remainderData,e),b=e.length,this.remainderData=null),b<ft&&!i)return this.remainderData=e,{audioTrack:a,videoTrack:o,id3Track:l,textTrack:A};const C=Math.max(0,Mr.syncOffset(e));b-=(b-C)%ft,b<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,b,e.buffer.byteLength-b));let w=0;for(let k=C;k<b;k+=ft)if(e[k]===71){const $=!!(e[k+1]&64),V=ba(e,k),O=(e[k+3]&48)>>4;let W;if(O>1){if(W=k+5+e[k+4],W===k+ft)continue}else W=k+4;switch(V){case c:$&&(u&&(s=xn(u))&&this.videoParser.parseAVCPES(o,A,s,!1,this._duration),u={data:[],size:0}),u&&(u.data.push(e.subarray(W,k+ft)),u.size+=k+ft-W);break;case h:if($){if(f&&(s=xn(f)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,s);break;case"mp3":this.parseMPEGPES(a,s);break;case"ac3":this.parseAC3PES(a,s);break}f={data:[],size:0}}f&&(f.data.push(e.subarray(W,k+ft)),f.size+=k+ft-W);break;case d:$&&(g&&(s=xn(g))&&this.parseID3PES(l,s),g={data:[],size:0}),g&&(g.data.push(e.subarray(W,k+ft)),g.size+=k+ft-W);break;case 0:$&&(W+=e[W]+1),Q=this._pmtId=iI(e,W);break;case Q:{$&&(W+=e[W]+1);const ie=sI(e,W,this.typeSupported,n,this.observer);c=ie.videoPid,c>0&&(o.pid=c,o.segmentCodec=ie.segmentVideoCodec),h=ie.audioPid,h>0&&(a.pid=h,a.segmentCodec=ie.segmentAudioCodec),d=ie.id3Pid,d>0&&(l.pid=d),p!==null&&!y&&(U.warn(`MPEG-TS PMT found at ${k} after unknown PID '${p}'. Backtracking to sync byte @${C} to parse all TS packets.`),p=null,k=C-188),y=this.pmtParsed=!0;break}case 17:case 8191:break;default:p=V;break}}else w++;w>0&&Ds(this.observer,new Error(`Found ${w} TS packet/s that do not start with 0x47`)),o.pesData=u,a.pesData=f,l.pesData=g;const R={audioTrack:a,videoTrack:o,id3Track:l,textTrack:A};return i&&this.extractRemainingSamples(R),R}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:n,id3Track:i,textTrack:s}=e,o=n.pesData,a=t.pesData,l=i.pesData;let A;if(o&&(A=xn(o))?(this.videoParser.parseAVCPES(n,s,A,!0,this._duration),n.pesData=null):n.pesData=o,a&&(A=xn(a))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,A);break;case"mp3":this.parseMPEGPES(t,A);break;case"ac3":this.parseAC3PES(t,A);break}t.pesData=null}else a!=null&&a.size&&U.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=a;l&&(A=xn(l))?(this.parseID3PES(i,A),i.pesData=null):i.pesData=l}demuxSampleAes(e,t,n){const i=this.demux(e,n,!0,!this.config.progressive),s=this.sampleAes=new nI(this.observer,this.config,t);return this.decrypt(i,s)}decrypt(e,t){return new Promise(n=>{const{audioTrack:i,videoTrack:s}=e;i.samples&&i.segmentCodec==="aac"?t.decryptAacSamples(i.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{n(e)}):n(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{n(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let n=0;const i=this.aacOverFlow;let s=t.data;if(i){this.aacOverFlow=null;const u=i.missing,h=i.sample.unit.byteLength;if(u===-1)s=$t(i.sample.unit,s);else{const d=h-u;i.sample.unit.set(s.subarray(0,u),d),e.samples.push(i.sample),n=i.missing}}let o,a;for(o=n,a=s.length;o<a-1&&!Ss(s,o);o++);if(o!==n){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",Ds(this.observer,new Error(u),h),!h)return}Su(e,this.observer,s,o,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(i){const u=Ru(e.samplerate);l=i.sample.pts+u}else{U.warn("[tsdemuxer]: AAC PES unknown PTS");return}let A=0,c;for(;o<a;)if(c=Du(e,s,o,l,A),o+=c.length,c.missing){this.aacOverFlow=c;break}else for(A++;o<a-1&&!Ss(s,o);o++);}parseMPEGPES(e,t){const n=t.data,i=n.length;let s=0,o=0;const a=t.pts;if(a===void 0){U.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<i;)if(Fu(n,o)){const l=_u(e,n,o,a,s);if(l)o+=l.length,s++;else break}else o++}parseAC3PES(e,t){{const n=t.data,i=t.pts;if(i===void 0){U.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=n.length;let o=0,a=0,l;for(;a<s&&(l=Mu(e,n,a,i,o++))>0;)a+=l}}parseID3PES(e,t){if(t.pts===void 0){U.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=it({},t,{type:this._videoTrack?zt.emsg:zt.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function ba(r,e){return((r[e+1]&31)<<8)+r[e+2]}function iI(r,e){return(r[e+10]&31)<<8|r[e+11]}function sI(r,e,t,n,i){const s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(r[e+1]&15)<<8|r[e+2],a=e+3+o-4,l=(r[e+10]&15)<<8|r[e+11];for(e+=12+l;e<a;){const A=ba(r,e),c=(r[e+3]&15)<<8|r[e+4];switch(r[e]){case 207:if(!n){xa("ADTS AAC");break}case 15:s.audioPid===-1&&(s.audioPid=A);break;case 21:s.id3Pid===-1&&(s.id3Pid=A);break;case 219:if(!n){xa("H.264");break}case 27:s.videoPid===-1&&(s.videoPid=A,s.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?U.log("MPEG audio found, not supported in this browser"):s.audioPid===-1&&(s.audioPid=A,s.segmentAudioCodec="mp3");break;case 193:if(!n){xa("AC-3");break}case 129:t.ac3?s.audioPid===-1&&(s.audioPid=A,s.segmentAudioCodec="ac3"):U.log("AC-3 audio found, not supported in this browser");break;case 6:if(s.audioPid===-1&&c>0){let u=e+5,h=c;for(;h>2;){switch(r[u]){case 106:t.ac3!==!0?U.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=A,s.segmentAudioCodec="ac3");break}const f=r[u+1]+2;u+=f,h-=f}}break;case 194:case 135:return Ds(i,new Error("Unsupported EC-3 in M2TS found")),s;case 36:return Ds(i,new Error("Unsupported HEVC in M2TS found")),s}e+=c+5}return s}function Ds(r,e,t){U.warn(`parsing error: ${e.message}`),r.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function xa(r){U.log(`${r} with AES-128-CBC encryption found in unencrypted stream`)}function xn(r){let e=0,t,n,i,s,o;const a=r.data;if(!r||r.size===0)return null;for(;a[0].length<19&&a.length>1;)a[0]=$t(a[0],a[1]),a.splice(1,1);if(t=a[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(n=(t[4]<<8)+t[5],n&&n>r.size-6)return null;const A=t[7];A&192&&(s=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,A&64?(o=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,s-o>54e5&&(U.warn(`${Math.round((s-o)/9e4)}s delta between PTS and DTS, align them`),s=o)):o=s),i=t[8];let c=i+9;if(r.size<=c)return null;r.size-=c;const u=new Uint8Array(r.size);for(let h=0,d=a.length;h<d;h++){t=a[h];let f=t.byteLength;if(c)if(c>f){c-=f;continue}else t=t.subarray(c),f-=c,c=0;u.set(t,e),e+=f}return n&&(n-=i+3),{data:u,pts:s,dts:o,len:n}}return null}class oI extends Ba{resetInitSegment(e,t,n,i){super.resetInitSegment(e,t,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=ui(e,0);let n=(t==null?void 0:t.length)||0;if(t&&e[n]===11&&e[n+1]===119&&na(t)!==void 0&&Nu(e,n)<=16)return!1;for(let i=e.length;n<i;n++)if(ku(e,n))return U.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return XE(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return _u(e,t,n,this.basePTS,this.frameIndex)}}class Ou{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 Pr=Math.pow(2,32)-1;class G{static init(){G.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 G.types)G.types.hasOwnProperty(e)&&(G.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]),n=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);G.HDLR_TYPES={video:t,audio:n};const i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);G.STTS=G.STSC=G.STCO=s,G.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),G.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),G.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),G.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]),l=new Uint8Array([0,0,0,1]);G.FTYP=G.box(G.types.ftyp,o,l,o,a),G.DINF=G.box(G.types.dinf,G.box(G.types.dref,i))}static box(e,...t){let n=8,i=t.length;const s=i;for(;i--;)n+=t[i].byteLength;const o=new Uint8Array(n);for(o[0]=n>>24&255,o[1]=n>>16&255,o[2]=n>>8&255,o[3]=n&255,o.set(e,4),i=0,n=8;i<s;i++)o.set(t[i],n),n+=t[i].byteLength;return o}static hdlr(e){return G.box(G.types.hdlr,G.HDLR_TYPES[e])}static mdat(e){return G.box(G.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(Pr+1)),i=Math.floor(t%(Pr+1));return G.box(G.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,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&255,85,196,0,0]))}static mdia(e){return G.box(G.types.mdia,G.mdhd(e.timescale,e.duration),G.hdlr(e.type),G.minf(e))}static mfhd(e){return G.box(G.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"?G.box(G.types.minf,G.box(G.types.smhd,G.SMHD),G.DINF,G.stbl(e)):G.box(G.types.minf,G.box(G.types.vmhd,G.VMHD),G.DINF,G.stbl(e))}static moof(e,t,n){return G.box(G.types.moof,G.mfhd(e),G.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=G.trak(e[t]);return G.box.apply(null,[G.types.moov,G.mvhd(e[0].timescale,e[0].duration)].concat(n).concat(G.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=G.trex(e[t]);return G.box.apply(null,[G.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(Pr+1)),i=Math.floor(t%(Pr+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24,n>>16&255,n>>8&255,n&255,i>>24,i>>16&255,i>>8&255,i&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 G.box(G.types.mvhd,s)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let i,s;for(i=0;i<t.length;i++)s=t[i].flags,n[i+4]=s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy;return G.box(G.types.sdtp,n)}static stbl(e){return G.box(G.types.stbl,G.stsd(e),G.box(G.types.stts,G.STTS),G.box(G.types.stsc,G.STSC),G.box(G.types.stsz,G.STSZ),G.box(G.types.stco,G.STCO))}static avc1(e){let t=[],n=[],i,s,o;for(i=0;i<e.sps.length;i++)s=e.sps[i],o=s.byteLength,t.push(o>>>8&255),t.push(o&255),t=t.concat(Array.prototype.slice.call(s));for(i=0;i<e.pps.length;i++)s=e.pps[i],o=s.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(s));const a=G.box(G.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),l=e.width,A=e.height,c=e.pixelRatio[0],u=e.pixelRatio[1];return G.box(G.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,A>>8&255,A&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,G.box(G.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),G.box(G.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 G.box(G.types.mp4a,G.audioStsd(e),G.box(G.types.esds,G.esds(e)))}static mp3(e){return G.box(G.types[".mp3"],G.audioStsd(e))}static ac3(e){return G.box(G.types["ac-3"],G.audioStsd(e),G.box(G.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?G.box(G.types.stsd,G.STSD,G.mp3(e)):e.segmentCodec==="ac3"?G.box(G.types.stsd,G.STSD,G.ac3(e)):G.box(G.types.stsd,G.STSD,G.mp4a(e)):G.box(G.types.stsd,G.STSD,G.avc1(e))}static tkhd(e){const t=e.id,n=e.duration*e.timescale,i=e.width,s=e.height,o=Math.floor(n/(Pr+1)),a=Math.floor(n%(Pr+1));return G.box(G.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,i>>8&255,i&255,0,0,s>>8&255,s&255,0,0]))}static traf(e,t){const n=G.sdtp(e),i=e.id,s=Math.floor(t/(Pr+1)),o=Math.floor(t%(Pr+1));return G.box(G.types.traf,G.box(G.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,i&255])),G.box(G.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&255])),G.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,G.box(G.types.trak,G.tkhd(e),G.mdia(e))}static trex(e){const t=e.id;return G.box(G.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 n=e.samples||[],i=n.length,s=12+16*i,o=new Uint8Array(s);let a,l,A,c,u,h;for(t+=8+s,o.set([e.type==="video"?1:0,0,15,1,i>>>24&255,i>>>16&255,i>>>8&255,i&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),a=0;a<i;a++)l=n[a],A=l.duration,c=l.size,u=l.flags,h=l.cts,o.set([A>>>24&255,A>>>16&255,A>>>8&255,A&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 G.box(G.types.trun,o)}static initSegment(e){G.types||G.init();const t=G.moov(e);return $t(G.FTYP,t)}}G.types=void 0,G.HDLR_TYPES=void 0,G.STTS=void 0,G.STSC=void 0,G.STCO=void 0,G.STSZ=void 0,G.VMHD=void 0,G.SMHD=void 0,G.STSD=void 0,G.FTYP=void 0,G.DINF=void 0;const Uu=9e4;function wa(r,e,t=1,n=!1){const i=r*e*t;return n?Math.round(i):i}function aI(r,e,t=1,n=!1){return wa(r,e,1/t,n)}function fi(r,e=!1){return wa(r,1e3,1/Uu,e)}function lI(r,e=1){return wa(r,Uu,1/e)}const AI=10*1e3,Gu=1024,cI=1152,uI=1536;let wn=null,Sa=null;class _s{constructor(e,t,n,i=""){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=n,this.ISGenerated=!1,wn===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);wn=o?parseInt(o[1]):0}if(Sa===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);Sa=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){U.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){U.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){U.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const n=e.reduce((i,s)=>{const o=s.pts-i;return o<-4294967296?(t=!0,Yt(i,s.pts)):o>0?i:s.pts},e[0].pts);return t&&U.debug("PTS rollover detected"),n}remux(e,t,n,i,s,o,a,l){let A,c,u,h,d,f,g=s,p=s;const y=e.pid>-1,Q=t.pid>-1,b=t.samples.length,C=e.samples.length>0,w=a&&b>0||b>1;if((!y||C)&&(!Q||w)||this.ISGenerated||a){if(this.ISGenerated){var k,$,V,O;const le=this.videoTrackConfig;le&&(t.width!==le.width||t.height!==le.height||((k=t.pixelRatio)==null?void 0:k[0])!==(($=le.pixelRatio)==null?void 0:$[0])||((V=t.pixelRatio)==null?void 0:V[1])!==((O=le.pixelRatio)==null?void 0:O[1]))&&this.resetInitSegment()}else u=this.generateIS(e,t,s,o);const W=this.isVideoContiguous;let ie=-1,te;if(w&&(ie=hI(t.samples),!W&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,ie>0){U.warn(`[mp4-remuxer]: Dropped ${ie} out of ${b} video samples due to a missing keyframe`);const le=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(ie),t.dropped+=ie,p+=(t.samples[0].pts-le)/t.inputTimeScale,te=p}else ie===-1&&(U.warn(`[mp4-remuxer]: No keyframe found out of ${b} video samples`),f=!1);if(this.ISGenerated){if(C&&w){const le=this.getVideoStartPts(t.samples),P=(Yt(e.samples[0].pts,le)-le)/t.inputTimeScale;g+=Math.max(0,P),p+=Math.max(0,-P)}if(C){if(e.samplerate||(U.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),u=this.generateIS(e,t,s,o)),c=this.remuxAudio(e,g,this.isAudioContiguous,o,Q||w||l===Ee.AUDIO?p:void 0),w){const le=c?c.endPTS-c.startPTS:0;t.inputTimeScale||(U.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),u=this.generateIS(e,t,s,o)),A=this.remuxVideo(t,p,W,le)}}else w&&(A=this.remuxVideo(t,p,W,0));A&&(A.firstKeyFrame=ie,A.independent=ie!==-1,A.firstKeyFramePTS=te)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(d=Hu(n,s,this._initPTS,this._initDTS)),i.samples.length&&(h=$u(i,s,this._initPTS))),{audio:c,video:A,initSegment:u,independent:f,text:h,id3:d}}generateIS(e,t,n,i){const s=e.samples,o=t.samples,a=this.typeSupported,l={},A=this._initPTS;let c=!A||i,u="audio/mp4",h,d,f;if(c&&(h=d=1/0),e.config&&s.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}l.audio={id:"audio",container:u,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&a.mpeg?new Uint8Array(0):G.initSegment([e]),metadata:{channelCount:e.channelCount}},c&&(f=e.inputTimeScale,!A||f!==A.timescale?h=d=s[0].pts-Math.round(f*n):c=!1)}if(t.sps&&t.pps&&o.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:G.initSegment([t]),metadata:{width:t.width,height:t.height}},c)if(f=t.inputTimeScale,!A||f!==A.timescale){const g=this.getVideoStartPts(o),p=Math.round(f*n);d=Math.min(d,Yt(o[0].dts,g)-p),h=Math.min(h,g-p)}else c=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,c?(this._initPTS={baseTime:h,timescale:f},this._initDTS={baseTime:d,timescale:f}):h=f=void 0,{tracks:l,initPTS:h,timescale:f}}remuxVideo(e,t,n,i){const s=e.inputTimeScale,o=e.samples,a=[],l=o.length,A=this._initPTS;let c=this.nextAvcDts,u=8,h=this.videoSampleDuration,d,f,g=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,y=!1;if(!n||c===null){const S=t*s,F=o[0].pts-Yt(o[0].dts,o[0].pts);wn&&c!==null&&Math.abs(S-F-c)<15e3?n=!0:c=S-F}const Q=A.baseTime*s/A.timescale;for(let S=0;S<l;S++){const F=o[S];F.pts=Yt(F.pts-Q,c),F.dts=Yt(F.dts-Q,c),F.dts<o[S>0?S-1:S].dts&&(y=!0)}y&&o.sort(function(S,F){const J=S.dts-F.dts,Y=S.pts-F.pts;return J||Y}),d=o[0].dts,f=o[o.length-1].dts;const b=f-d,C=b?Math.round(b/(l-1)):h||e.inputTimeScale/30;if(n){const S=d-c,F=S>C,J=S<-1;if((F||J)&&(F?U.warn(`AVC: ${fi(S,!0)} ms (${S}dts) hole between fragments detected at ${t.toFixed(3)}`):U.warn(`AVC: ${fi(-S,!0)} ms (${S}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!J||c>=o[0].pts||wn)){d=c;const Y=o[0].pts-S;if(F)o[0].dts=d,o[0].pts=Y;else for(let ne=0;ne<o.length&&!(o[ne].dts>Y);ne++)o[ne].dts-=S,o[ne].pts-=S;U.log(`Video: Initial PTS/DTS adjusted: ${fi(Y,!0)}/${fi(d,!0)}, delta: ${fi(S,!0)} ms`)}}d=Math.max(0,d);let w=0,R=0,k=d;for(let S=0;S<l;S++){const F=o[S],J=F.units,Y=J.length;let ne=0;for(let ce=0;ce<Y;ce++)ne+=J[ce].data.length;R+=ne,w+=Y,F.length=ne,F.dts<k?(F.dts=k,k+=C/4|0||1):k=F.dts,g=Math.min(F.pts,g),p=Math.max(F.pts,p)}f=o[l-1].dts;const $=R+4*w+8;let V;try{V=new Uint8Array($)}catch(S){this.observer.emit(I.ERROR,I.ERROR,{type:Be.MUX_ERROR,details:K.REMUX_ALLOC_ERROR,fatal:!1,error:S,bytes:$,reason:`fail allocating video mdat ${$}`});return}const O=new DataView(V.buffer);O.setUint32(0,$),V.set(G.types.mdat,4);let W=!1,ie=Number.POSITIVE_INFINITY,te=Number.POSITIVE_INFINITY,le=Number.NEGATIVE_INFINITY,D=Number.NEGATIVE_INFINITY;for(let S=0;S<l;S++){const F=o[S],J=F.units;let Y=0;for(let pe=0,ge=J.length;pe<ge;pe++){const Se=J[pe],Le=Se.data,Ge=Se.data.byteLength;O.setUint32(u,Ge),u+=4,V.set(Le,u),u+=Ge,Y+=4+Ge}let ne;if(S<l-1)h=o[S+1].dts-F.dts,ne=o[S+1].pts-F.pts;else{const pe=this.config,ge=S>0?F.dts-o[S-1].dts:C;if(ne=S>0?F.pts-o[S-1].pts:C,pe.stretchShortVideoTrack&&this.nextAudioPts!==null){const Se=Math.floor(pe.maxBufferHole*s),Le=(i?g+i*s:this.nextAudioPts)-F.pts;Le>Se?(h=Le-ge,h<0?h=ge:W=!0,U.log(`[mp4-remuxer]: It is approximately ${Le/90} ms to the next segment; using duration ${h/90} ms for the last video frame.`)):h=ge}else h=ge}const ce=Math.round(F.pts-F.dts);ie=Math.min(ie,h),le=Math.max(le,h),te=Math.min(te,ne),D=Math.max(D,ne),a.push(new Yu(F.key,h,Y,ce))}if(a.length){if(wn){if(wn<70){const S=a[0].flags;S.dependsOn=2,S.isNonSync=0}}else if(Sa&&D-te<le-ie&&C/le<.025&&a[0].cts===0){U.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let S=d;for(let F=0,J=a.length;F<J;F++){const Y=S+a[F].duration,ne=S+a[F].cts;if(F<J-1){const ce=Y+a[F+1].cts;a[F].duration=ce-ne}else a[F].duration=F?a[F-1].duration:C;a[F].cts=0,S=Y}}}h=W||!h?C:h,this.nextAvcDts=c=f+h,this.videoSampleDuration=h,this.isVideoContiguous=!0;const _={data1:G.moof(e.sequenceNumber++,d,it({},e,{samples:a})),data2:V,startPTS:g/s,endPTS:(p+h)/s,startDTS:d/s,endDTS:c/s,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:e.dropped};return e.samples=[],e.dropped=0,_}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return cI;case"ac3":return uI;default:return Gu}}remuxAudio(e,t,n,i,s){const o=e.inputTimeScale,a=e.samplerate?e.samplerate:o,l=o/a,A=this.getSamplesPerFrame(e),c=A*l,u=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,d=[],f=s!==void 0;let g=e.samples,p=h?0:8,y=this.nextAudioPts||-1;const Q=t*o,b=u.baseTime*o/u.timescale;if(this.isAudioContiguous=n=n||g.length&&y>0&&(i&&Math.abs(Q-y)<9e3||Math.abs(Yt(g[0].pts-b,Q)-y)<20*c),g.forEach(function(P){P.pts=Yt(P.pts-b,Q)}),!n||y<0){if(g=g.filter(P=>P.pts>=0),!g.length)return;s===0?y=0:i&&!f?y=Math.max(0,Q):y=g[0].pts}if(e.segmentCodec==="aac"){const P=this.config.maxAudioFramesDrift;for(let X=0,_=y;X<g.length;X++){const S=g[X],F=S.pts,J=F-_,Y=Math.abs(1e3*J/o);if(J<=-P*c&&f)X===0&&(U.warn(`Audio frame @ ${(F/o).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*J/o)} ms.`),this.nextAudioPts=y=_=F);else if(J>=P*c&&Y<AI&&f){let ne=Math.round(J/c);_=F-ne*c,_<0&&(ne--,_+=c),X===0&&(this.nextAudioPts=y=_),U.warn(`[mp4-remuxer]: Injecting ${ne} audio frame @ ${(_/o).toFixed(3)}s due to ${Math.round(1e3*J/o)} ms gap.`);for(let ce=0;ce<ne;ce++){const pe=Math.max(_,0);let ge=Ou.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);ge||(U.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ge=S.unit.subarray()),g.splice(X,0,{unit:ge,pts:pe}),_+=c,X++}}S.pts=_,_+=c}}let C=null,w=null,R,k=0,$=g.length;for(;$--;)k+=g[$].unit.byteLength;for(let P=0,X=g.length;P<X;P++){const _=g[P],S=_.unit;let F=_.pts;if(w!==null){const Y=d[P-1];Y.duration=Math.round((F-w)/l)}else if(n&&e.segmentCodec==="aac"&&(F=y),C=F,k>0){k+=p;try{R=new Uint8Array(k)}catch(Y){this.observer.emit(I.ERROR,I.ERROR,{type:Be.MUX_ERROR,details:K.REMUX_ALLOC_ERROR,fatal:!1,error:Y,bytes:k,reason:`fail allocating audio mdat ${k}`});return}h||(new DataView(R.buffer).setUint32(0,k),R.set(G.types.mdat,4))}else return;R.set(S,p);const J=S.byteLength;p+=J,d.push(new Yu(!0,A,J,0)),w=F}const V=d.length;if(!V)return;const O=d[d.length-1];this.nextAudioPts=y=w+l*O.duration;const W=h?new Uint8Array(0):G.moof(e.sequenceNumber++,C/l,it({},e,{samples:d}));e.samples=[];const ie=C/o,te=y/o,D={data1:W,data2:R,startPTS:ie,endPTS:te,startDTS:ie,endDTS:te,type:"audio",hasAudio:!0,hasVideo:!1,nb:V};return this.isAudioContiguous=!0,D}remuxEmptyAudio(e,t,n,i){const s=e.inputTimeScale,o=e.samplerate?e.samplerate:s,a=s/o,l=this.nextAudioPts,A=this._initDTS,c=A.baseTime*9e4/A.timescale,u=(l!==null?l:i.startDTS*s)+c,h=i.endDTS*s+c,d=a*Gu,f=Math.ceil((h-u)/d),g=Ou.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(U.warn("[mp4-remuxer]: remux empty Audio"),!g){U.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const p=[];for(let y=0;y<f;y++){const Q=u+y*d;p.push({unit:g,pts:Q,dts:Q})}return e.samples=p,this.remuxAudio(e,t,n,!1)}}function Yt(r,e){let t;if(e===null)return r;for(e<r?t=-8589934592:t=8589934592;Math.abs(r-e)>4294967296;)r+=t;return r}function hI(r){for(let e=0;e<r.length;e++)if(r[e].key)return e;return-1}function Hu(r,e,t,n){const i=r.samples.length;if(!i)return;const s=r.inputTimeScale;for(let a=0;a<i;a++){const l=r.samples[a];l.pts=Yt(l.pts-t.baseTime*s/t.timescale,e*s)/s,l.dts=Yt(l.dts-n.baseTime*s/n.timescale,e*s)/s}const o=r.samples;return r.samples=[],{samples:o}}function $u(r,e,t){const n=r.samples.length;if(!n)return;const i=r.inputTimeScale;for(let o=0;o<n;o++){const a=r.samples[o];a.pts=Yt(a.pts-t.baseTime*i/t.timescale,e*i)/i}r.samples.sort((o,a)=>o.pts-a.pts);const s=r.samples;return r.samples=[],{samples:s}}class Yu{constructor(e,t,n,i){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=n,this.cts=i,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class dI{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,n,i){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(vm(e,i)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:n}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const i=this.initData=Mc(e);i.audio&&(t=Vu(i.audio,He.AUDIO)),i.video&&(n=Vu(i.video,He.VIDEO));const s={};i.audio&&i.video?s.audiovideo={container:"video/mp4",codec:t+","+n,initSegment:e,id:"main"}:i.audio?s.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:i.video?s.video={container:"video/mp4",codec:n,initSegment:e,id:"main"}:U.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s}remux(e,t,n,i,s,o){var a,l;let{initPTS:A,lastEndTime:c}=this;const u={audio:void 0,video:void 0,text:i,id3:n,initSegment:void 0};he(c)||(c=this.lastEndTime=s||0);const h=t.samples;if(!(h!=null&&h.length))return u;const d={initPTS:void 0,timescale:1};let f=this.initData;if((a=f)!=null&&a.length||(this.generateInitSegment(h),f=this.initData),!((l=f)!=null&&l.length))return U.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),u;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const g=ym(h,f),p=Cm(f,h),y=p===null?s:p;(fI(A,y,s,g)||d.timescale!==A.timescale&&o)&&(d.initPTS=y-s,A&&A.timescale===1&&U.warn(`Adjusting initPTS by ${d.initPTS-A.baseTime}`),this.initPTS=A={baseTime:d.initPTS,timescale:1});const Q=e?y-A.baseTime/A.timescale:c,b=Q+g;Tm(f,h,A.baseTime/A.timescale),g>0?this.lastEndTime=b:(U.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const C=!!f.audio,w=!!f.video;let R="";C&&(R+="audio"),w&&(R+="video");const k={data1:h,startPTS:Q,startDTS:Q,endPTS:b,endDTS:b,type:R,hasAudio:C,hasVideo:w,nb:1,dropped:0};return u.audio=k.type==="audio"?k:void 0,u.video=k.type!=="audio"?k:void 0,u.initSegment=d,u.id3=Hu(n,s,A,A),i.samples.length&&(u.text=$u(i,s,A)),u}}function fI(r,e,t,n){if(r===null)return!0;const i=Math.max(n,1),s=e-r.baseTime/r.timescale;return Math.abs(s-t)>i}function Vu(r,e){const t=r==null?void 0:r.codec;if(t&&t.length>4)return t;if(e===He.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return ms(t,!1);const n="mp4a.40.5";return U.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${n}"`),n}return U.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let br;try{br=self.performance.now.bind(self.performance)}catch{U.debug("Unable to use Performance API on this environment"),br=vn==null?void 0:vn.Date.now}const Ls=[{demux:ZE,remux:dI},{demux:Mr,remux:_s},{demux:jE,remux:_s},{demux:oI,remux:_s}];Ls.splice(2,0,{demux:eI,remux:_s});class Ku{constructor(e,t,n,i,s){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=n,this.vendor=i,this.id=s}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,i){const s=n.transmuxing;s.executeStart=br();let o=new Uint8Array(e);const{currentTransmuxState:a,transmuxConfig:l}=this;i&&(this.currentTransmuxState=i);const{contiguous:A,discontinuity:c,trackSwitch:u,accurateTimeOffset:h,timeOffset:d,initSegmentChange:f}=i||a,{audioCodec:g,videoCodec:p,defaultInitPts:y,duration:Q,initSegmentData:b}=l,C=gI(o,t);if(C&&C.method==="AES-128"){const $=this.getDecrypter();if($.isSync()){let V=$.softwareDecrypt(o,C.key.buffer,C.iv.buffer);if(n.part>-1&&(V=$.flush()),!V)return s.executeEnd=br(),Ra(n);o=new Uint8Array(V)}else return this.decryptionPromise=$.webCryptoDecrypt(o,C.key.buffer,C.iv.buffer).then(V=>{const O=this.push(V,null,n);return this.decryptionPromise=null,O}),this.decryptionPromise}const w=this.needsProbing(c,u);if(w){const $=this.configureTransmuxer(o);if($)return U.warn(`[transmuxer] ${$.message}`),this.observer.emit(I.ERROR,I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:$,reason:$.message}),s.executeEnd=br(),Ra(n)}(c||u||f||w)&&this.resetInitSegment(b,g,p,Q,t),(c||f||w)&&this.resetInitialTimestamp(y),A||this.resetContiguity();const R=this.transmux(o,C,d,h,n),k=this.currentTransmuxState;return k.contiguous=!0,k.discontinuity=!1,k.trackSwitch=!1,s.executeEnd=br(),R}flush(e){const t=e.transmuxing;t.executeStart=br();const{decrypter:n,currentTransmuxState:i,decryptionPromise:s}=this;if(s)return s.then(()=>this.flush(e));const o=[],{timeOffset:a}=i;if(n){const u=n.flush();u&&o.push(this.push(u,null,e))}const{demuxer:l,remuxer:A}=this;if(!l||!A)return t.executeEnd=br(),[Ra(e)];const c=l.flush(a);return Fs(c)?c.then(u=>(this.flushRemux(o,u,e),o)):(this.flushRemux(o,c,e),o)}flushRemux(e,t,n){const{audioTrack:i,videoTrack:s,id3Track:o,textTrack:a}=t,{accurateTimeOffset:l,timeOffset:A}=this.currentTransmuxState;U.log(`[transmuxer.ts]: Flushed fragment ${n.sn}${n.part>-1?" p: "+n.part:""} of level ${n.level}`);const c=this.remuxer.remux(i,s,o,a,A,l,!0,this.id);e.push({remuxResult:c,chunkMeta:n}),n.transmuxing.executeEnd=br()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,i,s){const{demuxer:o,remuxer:a}=this;!o||!a||(o.resetInitSegment(e,t,n,i),a.resetInitSegment(e,t,n,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,i,s){let o;return t&&t.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,t,n,i,s):o=this.transmuxUnencrypted(e,n,i,s),o}transmuxUnencrypted(e,t,n,i){const{audioTrack:s,videoTrack:o,id3Track:a,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,o,a,l,t,n,!1,this.id),chunkMeta:i}}transmuxSampleAes(e,t,n,i,s){return this.demuxer.demuxSampleAes(e,t,n).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,n,i,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:i,vendor:s}=this;let o;for(let h=0,d=Ls.length;h<d;h++){var a;if((a=Ls[h].demux)!=null&&a.probe(e)){o=Ls[h];break}}if(!o)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,A=this.remuxer,c=o.remux,u=o.demux;(!A||!(A instanceof c))&&(this.remuxer=new c(n,t,i,s)),(!l||!(l instanceof u))&&(this.demuxer=new u(n,t,i),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 Ca(this.config)),e}}function gI(r,e){let t=null;return r.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Ra=r=>({remuxResult:{},chunkMeta:r});function Fs(r){return"then"in r&&r.then instanceof Function}class pI{constructor(e,t,n,i,s){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=n,this.duration=i,this.defaultInitPts=s||null}}class mI{constructor(e,t,n,i,s,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=n,this.trackSwitch=i,this.timeOffset=s,this.initSegmentChange=o}}var Ju={exports:{}};(function(r){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(l,A,c){this.fn=l,this.context=A,this.once=c||!1}function s(l,A,c,u,h){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new i(c,u||l,h),f=t?t+A:A;return l._events[f]?l._events[f].fn?l._events[f]=[l._events[f],d]:l._events[f].push(d):(l._events[f]=d,l._eventsCount++),l}function o(l,A){--l._eventsCount===0?l._events=new n:delete l._events[A]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var A=[],c,u;if(this._eventsCount===0)return A;for(u in c=this._events)e.call(c,u)&&A.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(c)):A},a.prototype.listeners=function(A){var c=t?t+A:A,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,d=u.length,f=new Array(d);h<d;h++)f[h]=u[h].fn;return f},a.prototype.listenerCount=function(A){var c=t?t+A:A,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(A,c,u,h,d,f){var g=t?t+A:A;if(!this._events[g])return!1;var p=this._events[g],y=arguments.length,Q,b;if(p.fn){switch(p.once&&this.removeListener(A,p.fn,void 0,!0),y){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,f),!0}for(b=1,Q=new Array(y-1);b<y;b++)Q[b-1]=arguments[b];p.fn.apply(p.context,Q)}else{var C=p.length,w;for(b=0;b<C;b++)switch(p[b].once&&this.removeListener(A,p[b].fn,void 0,!0),y){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(!Q)for(w=1,Q=new Array(y-1);w<y;w++)Q[w-1]=arguments[w];p[b].fn.apply(p[b].context,Q)}}return!0},a.prototype.on=function(A,c,u){return s(this,A,c,u,!1)},a.prototype.once=function(A,c,u){return s(this,A,c,u,!0)},a.prototype.removeListener=function(A,c,u,h){var d=t?t+A:A;if(!this._events[d])return this;if(!c)return o(this,d),this;var f=this._events[d];if(f.fn)f.fn===c&&(!h||f.once)&&(!u||f.context===u)&&o(this,d);else{for(var g=0,p=[],y=f.length;g<y;g++)(f[g].fn!==c||h&&!f[g].once||u&&f[g].context!==u)&&p.push(f[g]);p.length?this._events[d]=p.length===1?p[0]:p:o(this,d)}return this},a.prototype.removeAllListeners=function(A){var c;return A?(c=t?t+A:A,this._events[c]&&o(this,c)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,r.exports=a})(Ju);var EI=Ju.exports,Da=Gp(EI);class Wu{constructor(e,t,n,i){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 s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;const o=(A,c)=>{c=c||{},c.frag=this.frag,c.id=this.id,A===I.ERROR&&(this.error=c.error),this.hls.trigger(A,c)};this.observer=new Da,this.observer.on(I.FRAG_DECRYPTED,o),this.observer.on(I.ERROR,o);const a=en(s.preferManagedMediaSource)||{isTypeSupported:()=>!1},l={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"&&(s.workerPath||ME())){try{s.workerPath?(U.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=OE(s.workerPath)):(U.log(`injecting Web Worker for "${t}"`),this.workerContext=PE()),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})`);s.enableWorker=!1,U.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:h})},c.postMessage({cmd:"init",typeSupported:l,vendor:"",id:t,config:JSON.stringify(s)})}catch(c){U.warn(`Error setting up "${t}" Web Worker, fallback to inline`,c),this.resetWorker(),this.error=null,this.transmuxer=new Ku(this.observer,l,s,"",t)}return}this.transmuxer=new Ku(this.observer,l,s,"",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,n,i,s,o,a,l,A,c){var u,h;A.transmuxing.start=self.performance.now();const{transmuxer:d}=this,f=o?o.start:s.start,g=s.decryptdata,p=this.frag,y=!(p&&s.cc===p.cc),Q=!(p&&A.level===p.level),b=p?A.sn-p.sn:-1,C=this.part?A.part-this.part.index:-1,w=b===0&&A.id>1&&A.id===(p==null?void 0:p.stats.chunkCount),R=!Q&&(b===1||b===0&&(C===1||w&&C<=0)),k=self.performance.now();(Q||b||s.stats.parsing.start===0)&&(s.stats.parsing.start=k),o&&(C||!R)&&(o.stats.parsing.start=k);const $=!(p&&((u=s.initSegment)==null?void 0:u.url)===((h=p.initSegment)==null?void 0:h.url)),V=new mI(y,R,l,Q,f,$);if(!R||y||$){U.log(`[transmuxer-interface, ${s.type}]: Starting new transmux session for sn: ${A.sn} p: ${A.part} level: ${A.level} id: ${A.id}
2471
+ discontinuity: ${y}
2472
2472
  trackSwitch: ${Q}
2473
2473
  contiguous: ${R}
2474
2474
  accurateTimeOffset: ${l}
2475
2475
  timeOffset: ${f}
2476
- initSegmentChange: ${$}`);const O=new pI(n,i,t,a,c);this.configureTransmuxer(O)}if(this.frag=s,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:g,chunkMeta:A,state:K},e instanceof ArrayBuffer?[e]:[]);else if(d){const O=d.push(e,g,A,K);Fs(O)?(d.async=!0,O.then(J=>{this.handleTransmuxComplete(J)}).catch(J=>{this.transmuxerError(J,A,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(O))}}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 n=t.flush(e);Fs(n)||t.async?(Fs(n)||(n=Promise.resolve(n)),n.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")})):this.handleFlushResult(n,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){U.warn(`worker message received with no ${t?"event name":"data"}`);return}const n=this.hls;if(this.hls)switch(t.event){case"init":{var i;const s=(i=this.workerContext)==null?void 0:i.objectURL;s&&self.URL.revokeObjectURL(s);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":U[t.data.logType]&&U[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,n.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 qu(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Sn(r[t].attrs,e[t].attrs))return!1;return!0}function Sn(r,e,t){const n=r["STABLE-RENDITION-ID"];return n&&!t?n===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>r[i]!==e[i])}function _a(r,e){return e.label.toLowerCase()===r.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(r.lang||"").toLowerCase())}const Xu=100;class II extends ya{constructor(e,t,n){super(e,t,n,"[audio-stream-controller]",Ee.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(I.ERROR,this.onError,this),e.on(I.BUFFER_RESET,this.onBufferReset,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(I.ERROR,this.onError,this),e.off(I.BUFFER_RESET,this.onBufferReset,this),e.off(I.BUFFER_CREATED,this.onBufferCreated,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s}){if(n==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:i,timescale:s},this.log(`InitPTS for cc: ${o} found from main: ${i}`),this.videoTrackCC=o,this.state===re.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=re.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Xu),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=re.IDLE):(this.loadedmetadata=!1,this.state=re.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case re.IDLE:this.doTickIdle();break;case re.WAITING_TRACK:{var e;const{levels:n,trackId:i}=this,s=n==null||(e=n[i])==null?void 0:e.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=re.WAITING_INIT_PTS}break}case re.FRAG_LOADING_WAITING_RETRY:{var t;const n=performance.now(),i=this.retryDate;if(!i||n>=i||(t=this.media)!=null&&t.seeking){const{levels:s,trackId:o}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((s==null?void 0:s[o])||null),this.state=re.IDLE}break}case re.WAITING_INIT_PTS:{const n=this.waitingData;if(n){const{frag:i,part:s,cache:o,complete:a}=n;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=re.FRAG_LOADING;const l=o.flush(),A={frag:i,part:s,payload:l,networkDetails:null};this._handleFragmentLoadProgress(A),a&&super._handleFragmentLoadComplete(A)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const l=this.getLoadPosition(),A=Ke.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);Ea(A.end,this.config.maxFragLookUpTolerance,i)<0&&(this.log(`Waiting fragment cc (${i.cc}) @ ${i.start} cancelled because another fragment at ${A.end} is needed`),this.clearWaitingFragment())}}else this.state=re.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=re.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:n,trackId:i}=this,s=e.config;if(!n&&(this.startFragRequested||!s.startFragPrefetch)||!(t!=null&&t[i]))return;const o=t[i],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a)){this.state=re.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,He.AUDIO,Ee.AUDIO));const A=this.getFwdBufferInfo(l,Ee.AUDIO);if(A===null)return;const{bufferedTrack:c,switchingTrack:u}=this;if(!u&&this._streamEnded(A,a)){e.trigger(I.BUFFER_EOS,{type:"audio"}),this.state=re.ENDED;return}const h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Ee.MAIN),d=A.len,f=this.getMaxBufferLength(h==null?void 0:h.len),g=a.fragments,p=g[0].start;let C=this.flushing?this.getLoadPosition():A.end;if(u&&n){const w=this.getLoadPosition();c&&!Sn(u.attrs,c.attrs)&&(C=w),a.PTSKnown&&w<p&&(A.end>p||A.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=p+.05)}if(d>=f&&!u&&C<g[g.length-1].start)return;let Q=this.getNextFragment(C,a),b=!1;if(Q&&this.isLoopLoading(Q,C)&&(b=!!Q.gap,Q=this.getNextFragmentLoopLoading(Q,a,A,Ee.MAIN,f)),!Q){this.bufferFlushed=!0;return}const y=h&&Q.start>h.end+a.targetduration;if(y||!(h!=null&&h.len)&&A.len){const w=this.getAppendedFrag(Q.start,Ee.MAIN);if(w===null||(b||(b=!!w.gap||!!y&&h.len===0),y&&!b||b&&A.nextStart&&A.nextStart<w.end))return}this.loadFragment(Q,o,C)}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(n=>new yn(n))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),n?this.setInterval(Xu):this.resetTransmuxer(),n?(this.switchingTrack=t,this.state=re.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=re.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(I.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var n;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:i}=this,{details:s,id:o}=t;if(!i){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Audio track ${o} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const a=i[o];let l=0;if(s.live||(n=a.details)!=null&&n.live){this.checkLiveUpdate(s);const c=this.mainDetails;if(s.deltaUpdateFailed||!c)return;if(!a.details&&s.hasProgramDateTime&&c.hasProgramDateTime)ws(s,c),l=s.fragments[0].start;else{var A;l=this.alignPlaylists(s,a.details,(A=this.levelLastLoaded)==null?void 0:A.details)}}a.details=s,this.levelLastLoaded=a,!this.startFragRequested&&(this.mainDetails||!s.live)&&this.setStartPosition(this.mainDetails||s,l),this.state===re.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=re.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:n,part:i,payload:s}=e,{config:o,trackId:a,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const A=l[a];if(!A){this.warn("Audio track is undefined on fragment load progress");return}const c=A.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(n.start);return}const u=o.defaultAudioCodec||A.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new Wu(this.hls,Ee.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[n.cc],f=(t=n.initSegment)==null?void 0:t.data;if(d!==void 0){const p=i?i.index:-1,C=p!==-1,Q=new va(n.level,n.sn,n.stats.chunkCount,s.byteLength,p,C);h.push(s,f,u,"",n,i,c.totalduration,!1,Q,d)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);const{cache:g}=this.waitingData=this.waitingData||{frag:n,part:i,cache:new bu,complete:!1};g.push(new Uint8Array(s)),this.waitingVideoCC=this.videoTrackCC,this.state=re.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 n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n.type!==Ee.AUDIO){if(!this.loadedmetadata&&n.type===Ee.MAIN){const s=this.videoBuffer||this.media;s&&Ke.getBuffered(s).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(n.sn!=="initSegment"){this.fragPrevious=n;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(I.AUDIO_TRACK_SWITCHED,ht({},s)))}this.fragBufferedComplete(n,i)}onError(e,t){var n;if(t.fatal){this.state=re.ERROR;return}switch(t.details){case V.FRAG_GAP:case V.FRAG_PARSING_ERROR:case V.FRAG_DECRYPT_ERROR:case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.AUDIO,t);break;case V.AUDIO_TRACK_LOAD_ERROR:case V.AUDIO_TRACK_LOAD_TIMEOUT:case V.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===re.WAITING_TRACK&&((n=t.context)==null?void 0:n.type)===Oe.AUDIO_TRACK&&(this.state=re.IDLE);break;case V.BUFFER_APPEND_ERROR:case V.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===V.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case V.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==He.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==He.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===re.ENDED&&(this.state=re.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,t,Ee.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:i}=this,{remuxResult:s,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:A,level:c}=a,{details:u}=c,{audio:h,text:d,id3:f,initSegment:g}=s;if(this.fragContextChanged(l)||!u){this.fragmentTracker.removeFragment(l);return}if(this.state=re.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),g!=null&&g.tracks){const p=l.initSegment||l;this._bufferInitSegment(c,g.tracks,p,o),i.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:n,tracks:g.tracks})}if(h){const{startPTS:p,endPTS:C,startDTS:Q,endDTS:b}=h;A&&(A.elementaryStreams[He.AUDIO]={startPTS:p,endPTS:C,startDTS:Q,endDTS:b}),l.setElementaryStreamInfo(He.AUDIO,p,C,Q,b),this.bufferFragmentData(h,l,A,o)}if(f!=null&&(t=f.samples)!=null&&t.length){const p=it({id:n,frag:l,details:u},f);i.trigger(I.FRAG_PARSING_METADATA,p)}if(d){const p=it({id:n,frag:l,details:u},d);i.trigger(I.FRAG_PARSING_USERDATA,p)}}_bufferInitSegment(e,t,n,i){if(this.state!==re.PARSING)return;t.video&&delete t.video;const s=t.audio;if(!s)return;s.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${o}/${s.codec}]`),o&&o.split(",").length===1&&(s.levelCodec=o),this.hls.trigger(I.BUFFER_CODECS,t);const a=s.initSegment;if(a!=null&&a.byteLength){const l={type:"audio",frag:n,part:null,chunkMeta:i,parent:n.type,data:a};this.hls.trigger(I.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||i===dt.NOT_LOADED||i===dt.PARTIAL){var s;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((s=t.details)!=null&&s.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=re.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragments[0].start!==t.details.fragments[0].start&&ws(t.details,o)}else this.startFragRequested=!0,super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:n}=this,i=n==null?void 0:n.attrs,s=e.attrs;t&&i&&(i.CHANNELS!==s.CHANNELS||n.name!==e.name||n.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(I.AUDIO_TRACK_SWITCHED,ht({},e))}}class vI extends Ia{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(I.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:n,groupId:i,details:s}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Audio track with id:${n} and group:${i} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.audioGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(a=>(i==null?void 0:i.indexOf(a))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(h=>!n||n.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(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const l=this.hls.config.audioPreference;if(!s&&l){const h=cr(l,a,Qn);if(h>-1)s=a[h];else{const d=cr(l,this.tracks);s=this.tracks[d]}}let A=this.findTrackId(s);A===-1&&s&&(A=this.findTrackId(null));const c={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${n==null?void 0:n.join(",")}`),this.hls.trigger(I.AUDIO_TRACKS_UPDATED,c);const u=this.trackId;if(A!==-1&&u===-1)this.setAudioTrack(A);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(I.ERROR,{type:Be.MEDIA_ERROR,details:V.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}else this.shouldReloadPlaylist(s)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===Oe.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 n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&&Tn(e,i,Qn))return i;const s=cr(e,this.tracksInGroup,Qn);if(s>-1){const o=this.tracksInGroup[s];return this.setAudioTrack(s),o}else if(i){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=vE(e,t.levels,n,o,Qn);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=cr(e,n);if(o>-1)return n[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 n=this.currentTrack,i=t[e],s=i.details&&!i.details.live;if(e===this.trackId&&i===n&&s||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(I.AUDIO_TRACK_SWITCHING,ht({},i)),s))return;const o=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(!(this.selectDefaultTrack&&!i.default)&&(!e||Tn(e,i,Qn)))return n}if(e){const{name:n,lang:i,assocLang:s,characteristics:o,audioCodec:a,channels:l}=e;for(let A=0;A<t.length;A++){const c=t[A];if(Tn({name:n,lang:i,assocLang:s,characteristics:o,audioCodec:a,channels:l},c,Qn))return A}for(let A=0;A<t.length;A++){const c=t[A];if(Sn(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return A}for(let A=0;A<t.length;A++){const c=t[A];if(Sn(e.attrs,c.attrs,["LANGUAGE"]))return A}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const n=t.id,i=t.groupId;let s=t.url;if(e)try{s=e.addDirectives(s)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${n} "${t.name}" lang:${t.lang} group:${i}`),this.clearTimer(),this.hls.trigger(I.AUDIO_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:e||null})}}}const ju=500;class CI extends ya{constructor(e,t,n){super(e,t,n,"[subtitle-stream-controller]",Ee.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.ERROR,this.onError,this),e.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.ERROR,this.onError,this),e.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=re.IDLE,this.setInterval(ju),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:n,success:i}=t;if(this.fragPrevious=n,this.state=re.IDLE,!i)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let o;const a=n.start;for(let A=0;A<s.length;A++)if(a>=s[A].start&&a<=s[A].end){o=s[A];break}const l=n.start+n.duration;o?o.end=l:(o={start:a,end:l},s.push(o)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null)}onBufferFlushing(e,t){const{startOffset:n,endOffset:i}=t;if(n===0&&i!==Number.POSITIVE_INFINITY){const s=i-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=s){o.shift();continue}else if(o[a].start<s)o[a].start=s;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(n,s,Ee.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===Ee.MAIN){var n;(n=this.media)!=null&&n.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const n=t.frag;(n==null?void 0:n.type)===Ee.SUBTITLE&&(t.details===V.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==re.STOPPED&&(this.state=re.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&qu(this.levels,t)){this.levels=t.map(n=>new yn(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const i=new yn(n);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ee.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(ju)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:i,levels:s}=this,{details:o,id:a}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const l=s[a];if(a>=s.length||!l)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 A=0;if(o.live||(n=l.details)!=null&&n.live){const u=this.mainDetails;if(o.deltaUpdateFailed||!u)return;const h=u.fragments[0];if(!l.details)o.hasProgramDateTime&&u.hasProgramDateTime?(ws(o,u),A=o.fragments[0].start):h&&(A=h.start,pa(o,A));else{var c;A=this.alignPlaylists(o,l.details,(c=this.levelLastLoaded)==null?void 0:c.details),A===0&&h&&(A=h.start,pa(o,A))}}l.details=o,this.levelLastLoaded=l,a===i&&(!this.startFragRequested&&(this.mainDetails||!o.live)&&this.setStartPosition(this.mainDetails||o,A),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===re.IDLE&&(Ts(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:n}=e,i=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&i!=null&&i.key&&i.iv&&i.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer).catch(a=>{throw s.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const l=performance.now();s.trigger(I.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:l}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=re.IDLE})}}doTick(){if(!this.media){this.state=re.IDLE;return}if(this.state===re.IDLE){const{currentTrackId:e,levels:t}=this,n=t==null?void 0:t[e];if(!n||!t.length||!n.details)return;const{config:i}=this,s=this.getLoadPosition(),o=Ke.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,i.maxBufferHole),{end:a,len:l}=o,A=this.getFwdBufferInfo(this.media,Ee.MAIN),c=n.details,u=this.getMaxBufferLength(A==null?void 0:A.len)+c.levelTargetDuration;if(l>u)return;const h=c.fragments,d=h.length,f=c.edge;let g=null;const p=this.fragPrevious;if(a<f){const C=i.maxFragLookUpTolerance,Q=a>f-C?0:C;g=Ts(p,h,Math.max(h[0].start,a),Q),!g&&p&&p.start<h[0].start&&(g=h[0])}else g=h[d-1];if(!g)return;if(g=this.mapToInitFragWhenRequired(g),g.sn!=="initSegment"){const C=g.sn-c.startSN,Q=h[C-1];Q&&Q.cc===g.cc&&this.fragmentTracker.getState(Q)===dt.NOT_LOADED&&(g=Q)}this.fragmentTracker.getState(g)===dt.NOT_LOADED&&this.loadFragment(g,n,a)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,n){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,n))}get mediaBufferTimeRanges(){return new yI(this.tracksBuffered[this.currentTrackId]||[])}}class yI{constructor(e){this.buffered=void 0;const t=(n,i,s)=>{if(i=i>>>0,i>s-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][n]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}class BI extends Ia{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 n=Es(this.media.textTracks);for(let s=0;s<n.length;s++)if(n[s].mode==="hidden")t=n[s];else if(n[s].mode==="showing"){t=n[s];break}const i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(I.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),Es(this.media.textTracks).forEach(t=>{Cn(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:n,groupId:i,details:s}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Subtitle track with id:${n} and group:${i} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.subtitleGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(o=>(i==null?void 0:i.indexOf(o))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(c=>!n||n.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(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const a=this.hls.config.subtitlePreference;if(!s&&a){this.selectDefaultTrack=!1;const c=cr(a,o);if(c>-1)s=o[c];else{const u=cr(a,this.tracks);s=this.tracks[u]}}let l=this.findTrackId(s);l===-1&&s&&(l=this.findTrackId(null));const A={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${n==null?void 0:n.join(",")}" group-id`),this.hls.trigger(I.SUBTITLE_TRACKS_UPDATED,A),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}else this.shouldReloadPlaylist(s)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,n=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const s=t[i];if(!(n&&!s.default||!n&&!e)&&(!e||Tn(s,e)))return i}if(e){for(let i=0;i<t.length;i++){const s=t[i];if(Sn(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const s=t[i];if(Sn(e.attrs,s.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(_a(i,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Oe.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 n=this.currentTrack;if(n&&Tn(e,n))return n;const i=cr(e,this.tracksInGroup);if(i>-1){const s=this.tracksInGroup[i];return this.setSubtitleTrack(i),s}else{if(n)return null;{const s=cr(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const n=t.id,i=t.groupId;let s=t.url;if(e)try{s=e.addDirectives(s)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${n}`),this.hls.trigger(I.SUBTITLE_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Es(e.textTracks),n=this.currentTrack;let i;if(n&&(i=t.filter(s=>_a(n,s))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==i&&(s.mode="disabled")}),i){const s=this.subtitleDisplay?"showing":"hidden";i.mode!==s&&(i.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!he(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const n=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!i.details&&!i.details.live;if(e===this.trackId&&i===n&&s)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:o,groupId:a="",name:l,type:A,url:c}=i;this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:l,type:A,url:c});const u=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(u)}}class TI{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,n){const i=this.queues[t];i.push(e),i.length===1&&!n&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const n=new Promise(s=>{t=s}),i={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(i,e),n}executeNext(e){const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(i){U.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${i}`),n.onError(i);const s=this.buffers[e];s!=null&&s.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const zu=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class QI{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=n=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:n,mediaSource:i}=this;this.log("Media source opened"),n&&(n.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(I.MEDIA_ATTACHED,{media:n,mediaSource:i})),i&&i.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:n,_objectUrl:i}=this;n!==i&&U.error(`Media element src was set while attaching MediaSource (${i} > ${n})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=Fm(en(e.config.preferManagedMediaSource)),this.log=U.log.bind(U,t),this.warn=U.warn.bind(U,t),this.error=U.error.bind(U,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(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.BUFFER_RESET,this.onBufferReset,this),e.on(I.BUFFER_APPENDING,this.onBufferAppending,this),e.on(I.BUFFER_CODECS,this.onBufferCodecs,this),e.on(I.BUFFER_EOS,this.onBufferEos,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(I.FRAG_PARSED,this.onFragParsed,this),e.on(I.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.BUFFER_RESET,this.onBufferReset,this),e.off(I.BUFFER_APPENDING,this.onBufferAppending,this),e.off(I.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.BUFFER_EOS,this.onBufferEos,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(I.FRAG_PARSED,this.onFragParsed,this),e.off(I.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new TI(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 n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const n=this.media=t.media,i=en(this.appendSource);if(n&&i){var s;const o=this.mediaSource=new i;this.log(`created media source: ${(s=o.constructor)==null?void 0:s.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{n.removeAttribute("src");const l=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||l&&o instanceof l,Zu(n),bI(n,a),n.load()}catch{n.src=a}else n.src=a;n.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:n}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(i){this.warn(`onMediaDetaching: ${i.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),n&&self.URL.revokeObjectURL(n),this.mediaSrc===n?(e.removeAttribute("src"),this.appendSource&&Zu(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(I.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 n;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(i){this.warn(`onBufferReset ${e}`,i)}}onBufferCodecs(e,t){const n=this.getSourceBufferTypes().length,i=Object.keys(t);if(i.forEach(o=>{if(n){const l=this.tracks[o];if(l&&typeof l.buffer.changeType=="function"){var a;const{id:A,codec:c,levelCodec:u,container:h,metadata:d}=t[o],f=Jc(l.codec,l.levelCodec),g=f==null?void 0:f.replace(zu,"$1");let p=Jc(c,u);const C=(a=p)==null?void 0:a.replace(zu,"$1");if(p&&g!==C){o.slice(0,5)==="audio"&&(p=ms(p,this.appendSource));const Q=`${h};codecs=${p}`;this.appendChangeType(o,Q),this.log(`switching codec ${f} to ${p}`),this.tracks[o]={buffer:l.buffer,codec:c,container:h,levelCodec:u,metadata:d,id:A}}}}else this.pendingTracks[o]=t[o]}),n)return;const s=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==s&&(this.log(`${s} bufferCodec event(s) expected ${i.join(",")}`),this.bufferCodecEventsExpected=s),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:n}=this,i={execute:()=>{const s=this.sourceBuffer[e];s&&(this.log(`changing ${e} sourceBuffer type to ${t}`),s.changeType(t)),n.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:s=>{this.warn(`Failed to change ${e} SourceBuffer type`,s)}};n.append(i,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:n,operationQueue:i,tracks:s}=this,{data:o,type:a,frag:l,part:A,chunkMeta:c}=t,u=c.buffering[a],h=self.performance.now();u.start=h;const d=l.stats.buffering,f=A?A.stats.buffering:null;d.start===0&&(d.start=h),f&&f.start===0&&(f.start=h);const g=s.audio;let p=!1;a==="audio"&&(g==null?void 0:g.container)==="audio/mpeg"&&(p=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const C=l.start,Q={execute:()=>{if(u.executeStart=self.performance.now(),p){const b=this.sourceBuffer[a];if(b){const y=C-b.timestampOffset;Math.abs(y)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${C} (delta: ${y}) sn: ${l.sn})`),b.timestampOffset=C)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const b=self.performance.now();u.executeEnd=u.end=b,d.first===0&&(d.first=b),f&&f.first===0&&(f.first=b);const{sourceBuffer:y}=this,w={};for(const R in y)w[R]=Ke.getBuffered(y[R]);this.appendErrors[a]=0,a==="audio"||a==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(I.BUFFER_APPENDED,{type:a,frag:l,part:A,chunkMeta:c,parent:l.type,timeRanges:w})},onError:b=>{const y={type:Be.MEDIA_ERROR,parent:l.type,details:V.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:l,part:A,chunkMeta:c,error:b,err:b,fatal:!1};if(b.code===DOMException.QUOTA_EXCEEDED_ERR)y.details=V.BUFFER_FULL_ERROR;else{const w=++this.appendErrors[a];y.details=V.BUFFER_APPEND_ERROR,this.warn(`Failed ${w}/${n.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),w>=n.config.appendErrorMaxRetry&&(y.fatal=!0)}n.trigger(I.ERROR,y)}};i.append(Q,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:n}=this,i=s=>({execute:this.removeExecutor.bind(this,s,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(I.BUFFER_FLUSHED,{type:s})},onError:o=>{this.warn(`Failed to remove from ${s} SourceBuffer`,o)}});t.type?n.append(i(t.type),t.type):this.getSourceBufferTypes().forEach(s=>{n.append(i(s),s)})}onFragParsed(e,t){const{frag:n,part:i}=t,s=[],o=i?i.elementaryStreams:n.elementaryStreams;o[He.AUDIOVIDEO]?s.push("audiovideo"):(o[He.AUDIO]&&s.push("audio"),o[He.VIDEO]&&s.push("video"));const a=()=>{const l=self.performance.now();n.stats.buffering.end=l,i&&(i.stats.buffering.end=l);const A=i?i.stats:n.stats;this.hls.trigger(I.FRAG_BUFFERED,{frag:n,part:i,stats:A,id:n.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(a,s)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((i,s)=>{const o=this.sourceBuffer[s];return o&&(!t.type||t.type===s)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${s} sourceBuffer now EOS`))),i&&!!(!o||o.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(s=>{const o=this.sourceBuffer[s];o&&(o.ending=!1)});const{mediaSource:i}=this;if(!i||i.readyState!=="open"){i&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${i.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),i.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:n}=this;if(!n||t===null||!this.getSourceBufferTypes().length)return;const s=e.config,o=n.currentTime,a=t.levelTargetDuration,l=t.live&&s.liveBackBufferLength!==null?s.liveBackBufferLength:s.backBufferLength;if(he(l)&&l>0){const A=Math.max(l,a),c=Math.floor(o/a)*a-A;this.flushBackBuffer(o,a,c)}if(he(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const A=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),c=Math.max(A,a),u=Math.floor(o/a)*a+c;this.flushFrontBuffer(o,a,u)}}flushBackBuffer(e,t,n){const{details:i,sourceBuffer:s}=this;this.getSourceBufferTypes().forEach(a=>{const l=s[a];if(l){const A=Ke.getBuffered(l);if(A.length>0&&n>A.start(0)){if(this.hls.trigger(I.BACK_BUFFER_REACHED,{bufferEnd:n}),i!=null&&i.live)this.hls.trigger(I.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(l.ended&&A.end(A.length-1)-e<t*2){this.log(`Cannot flush ${a} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:a})}}})}flushFrontBuffer(e,t,n){const{sourceBuffer:i}=this;this.getSourceBufferTypes().forEach(o=>{const a=i[o];if(a){const l=Ke.getBuffered(a),A=l.length;if(A<2)return;const c=l.start(A-1),u=l.end(A-1);if(n>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(I.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:n,mediaSource:i}=this,s=e.fragments[0].start+e.totalduration,o=n.duration,a=he(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(s>a&&s>o||!he(o))&&(this.log(`Updating Media Source duration to ${s.toFixed(3)}`),i.duration=s)}updateSeekableRange(e){const t=this.mediaSource,n=e.fragments;if(n.length&&e.live&&t!=null&&t.setLiveSeekableRange){const s=Math.max(0,n[0].start),o=Math.max(s,s+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${s}-${o}.`),t.setLiveSeekableRange(s,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:n}=this,i=Object.keys(n).length;if(i&&(!e||i===2||"audiovideo"in n)){this.createSourceBuffers(n),this.pendingTracks={};const s=this.getSourceBufferTypes();if(s.length)this.hls.trigger(I.BUFFER_CREATED,{tracks:this.tracks}),s.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:n}=this;if(!n)throw Error("createSourceBuffers called when mediaSource was null");for(const s in e)if(!t[s]){var i;const o=e[s];if(!o)throw Error(`source buffer exists for track ${s}, however track does not`);let a=((i=o.levelCodec)==null?void 0:i.indexOf(","))===-1?o.levelCodec:o.codec;a&&s.slice(0,5)==="audio"&&(a=ms(a,this.appendSource));const l=`${o.container};codecs=${a}`;this.log(`creating sourceBuffer(${l})`);try{const A=t[s]=n.addSourceBuffer(l),c=s;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(I.BUFFER_FLUSHED,{type:s})}),this.tracks[s]={buffer:A,codec:a,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(A){this.error(`error while trying to add sourceBuffer: ${A.message}`),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:A,sourceBufferName:s,mimeType:l})}}}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:n}=this;n.current(e).onComplete(),n.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var n;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${i}`,t),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const s=this.operationQueue.current(e);s&&s.onError(i)}removeExecutor(e,t,n){const{media:i,mediaSource:s,operationQueue:o,sourceBuffer:a}=this,l=a[e];if(!i||!s||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const A=he(i.duration)?i.duration:1/0,c=he(s.duration)?s.duration:1/0,u=Math.max(0,t),h=Math.min(n,A,c);h>u&&(!l.ending||l.ended)?(l.ended=!1,this.log(`Removing [${u},${h}] from the ${e} SourceBuffer`),l.remove(u,h)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const n=this.sourceBuffer[t];if(!n){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}n.ended=!1,n.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:n}=this,i=t.map(s=>n.appendBlocker(s));Promise.all(i).then(()=>{e(),t.forEach(s=>{const o=this.sourceBuffer[s];o!=null&&o.updating||n.shiftAndExecuteNext(s)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,n){const i=this.sourceBuffer[e];if(!i)return;const s=n.bind(this,e);this.listeners[e].push({event:t,listener:s}),i.addEventListener(t,s)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(n=>{t.removeEventListener(n.event,n.listener)})}}function Zu(r){const e=r.querySelectorAll("source");[].slice.call(e).forEach(t=>{r.removeChild(t)})}function bI(r,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,r.appendChild(t)}const xI={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},eh=r=>String.fromCharCode(xI[r]||r),er=15,xr=100,wI={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},SI={17:2,18:4,21:6,22:8,23:10,19:13,20:15},RI={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},DI={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_I=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class LI{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n=typeof t=="function"?t():t;U.log(`${this.time} [${e}] ${n}`)}}}const tn=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class th{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 n=0;n<t.length;n++){const i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}}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 FI{constructor(){this.uchar=" ",this.penState=new th}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 kI{constructor(e){this.chars=[],this.pos=0,this.currPenState=new th,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<xr;t++)this.chars.push(new FI);this.logger=e}equals(e){for(let t=0;t<xr;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<xr;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<xr;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>xr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=xr)}moveCursor(e){const t=this.pos+e;if(e>1)for(let n=this.pos+1;n<t+1;n++)this.chars[n].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=eh(e);if(this.pos>=xr){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<xr;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 n=0;n<xr;n++){const i=this.chars[n].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class La{constructor(e){this.rows=[],this.currRow=er-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<er;t++)this.rows.push(new kI(e));this.logger=e}reset(){for(let e=0;e<er;e++)this.rows[e].clear();this.currRow=er-1}equals(e){let t=!0;for(let n=0;n<er;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<er;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<er;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<er;a++)this.rows[a].clear();const s=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[s].cueStartTime,l=this.logger.time;if(a!==null&&l!==null&&a<l)for(let A=0;A<this.nrRollUpRows;A++)this.rows[t-this.nrRollUpRows+A+1].copy(o.rows[s+A])}}this.currRow=t;const n=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,o=Math.max(s-1,0);n.setCursor(e.indent),e.color=n.chars[o].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}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 n="",i=-1;for(let s=0;s<er;s++){const o=this.rows[s].getTextString();o&&(i=s+1,e?t.push("Row "+i+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?n="["+t.join(" | ")+"]":n=t.join(`
2477
- `)),n}getTextAndFormat(){return this.rows}}class rh{constructor(e,t,n){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 La(n),this.nonDisplayedMemory=new La(n),this.lastOutputScreen=new La(n),this.currRollUpRow=this.displayedMemory.rows[er-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[er-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 n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);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 n=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[n]}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 nh{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=MI(),this.logger=void 0;const i=this.logger=new LI;this.channels=[null,new rh(e,t,i),new rh(e+1,n,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let n=0;n<t.length;n+=2){const i=t[n]&127,s=t[n+1]&127;let o=!1,a=null;if(i===0&&s===0)continue;this.logger.log(3,()=>"["+tn([t[n],t[n+1]])+"] -> ("+tn([i,s])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(NI(i,s,l)){ks(null,null,l),this.logger.log(3,()=>"Repeated command ("+tn([i,s])+") is dropped");continue}ks(i,s,this.cmdHistory),o=this.parseCmd(i,s),o||(o=this.parseMidrow(i,s)),o||(o=this.parsePAC(i,s)),o||(o=this.parseBackgroundAttributes(i,s))}else ks(null,null,l);if(!o&&(a=this.parseChars(i,s),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 "+tn([i,s])+" orig: "+tn([t[n],t[n+1]]))}}parseCmd(e,t){const n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(n||i))return!1;const s=e===20||e===21||e===23?1:2,o=this.channels[s];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=s,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[n];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+tn([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let n;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(i||s))return!1;const o=e<=23?1:2;t>=64&&t<=95?n=o===1?wI[e]:RI[e]:n=o===1?SI[e]:DI[e];const a=this.channels[o];return a?(a.setPAC(this.interpretPAC(n,t)),this.currentChannel=o,!0):!1}interpretPAC(e,t){let n;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?n=t-96:n=t-64,i.underline=(n&1)===1,n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((n-16)/2)*4,i}parseChars(e,t){let n,i=null,s=null;if(e>=25?(n=2,s=e-8):(n=1,s=e),s>=17&&s<=19){let o;s===17?o=t+80:s===18?o=t+112:o=t+144,this.logger.log(2,()=>"Special char '"+eh(o)+"' in channel "+n),i=[o]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+tn(i).join(",")),i}parseBackgroundAttributes(e,t){const n=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(n||i))return!1;let s;const o={};e===16||e===24?(s=Math.floor((t-32)/2),o.background=_I[s],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()}ks(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function ks(r,e,t){t.a=r,t.b=e}function NI(r,e,t){return t.a===r&&t.b===e}function MI(){return{a:null,b:null}}class Ns{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,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var Fa=function(){if(vn!=null&&vn.VTTCue)return self.VTTCue;const r=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,l){if(typeof l!="string"||!Array.isArray(a))return!1;const A=l.toLowerCase();return~a.indexOf(A)?A:!1}function n(a){return t(r,a)}function i(a){return t(e,a)}function s(a,...l){let A=1;for(;A<arguments.length;A++){const c=arguments[A];for(const u in c)a[u]=c[u]}return a}function o(a,l,A){const c=this,u={enumerable:!0};c.hasBeenReset=!1;let h="",d=!1,f=a,g=l,p=A,C=null,Q="",b=!0,y="auto",w="start",R=50,k="middle",$=50,K="middle";Object.defineProperty(c,"id",s({},u,{get:function(){return h},set:function(O){h=""+O}})),Object.defineProperty(c,"pauseOnExit",s({},u,{get:function(){return d},set:function(O){d=!!O}})),Object.defineProperty(c,"startTime",s({},u,{get:function(){return f},set:function(O){if(typeof O!="number")throw new TypeError("Start time must be set to a number.");f=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",s({},u,{get:function(){return g},set:function(O){if(typeof O!="number")throw new TypeError("End time must be set to a number.");g=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",s({},u,{get:function(){return p},set:function(O){p=""+O,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",s({},u,{get:function(){return C},set:function(O){C=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",s({},u,{get:function(){return Q},set:function(O){const J=n(O);if(J===!1)throw new SyntaxError("An invalid or illegal string was specified.");Q=J,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",s({},u,{get:function(){return b},set:function(O){b=!!O,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",s({},u,{get:function(){return y},set:function(O){if(typeof O!="number"&&O!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");y=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",s({},u,{get:function(){return w},set:function(O){const J=i(O);if(!J)throw new SyntaxError("An invalid or illegal string was specified.");w=J,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",s({},u,{get:function(){return R},set:function(O){if(O<0||O>100)throw new Error("Position must be between 0 and 100.");R=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",s({},u,{get:function(){return k},set:function(O){const J=i(O);if(!J)throw new SyntaxError("An invalid or illegal string was specified.");k=J,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",s({},u,{get:function(){return $},set:function(O){if(O<0||O>100)throw new Error("Size must be between 0 and 100.");$=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",s({},u,{get:function(){return K},set:function(O){const J=i(O);if(!J)throw new SyntaxError("An invalid or illegal string was specified.");K=J,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class PI{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function ih(r){function e(n,i,s,o){return(n|0)*3600+(i|0)*60+(s|0)+parseFloat(o||0)}const t=r.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 OI{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let i=0;i<n.length;++i)if(t===n[i]){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 n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function sh(r,e,t,n){const i=n?r.split(n):[r];for(const s in i){if(typeof i[s]!="string")continue;const o=i[s].split(t);if(o.length!==2)continue;const a=o[0],l=o[1];e(a,l)}}const ka=new Fa(0,0,""),Ms=ka.align==="middle"?"middle":"center";function UI(r,e,t){const n=r;function i(){const a=ih(r);if(a===null)throw new Error("Malformed timestamp: "+n);return r=r.replace(/^[^\sa-zA-Z-]+/,""),a}function s(a,l){const A=new OI;sh(a,function(h,d){let f;switch(h){case"region":for(let g=t.length-1;g>=0;g--)if(t[g].id===d){A.set(h,t[g].region);break}break;case"vertical":A.alt(h,d,["rl","lr"]);break;case"line":f=d.split(","),A.integer(h,f[0]),A.percent(h,f[0])&&A.set("snapToLines",!1),A.alt(h,f[0],["auto"]),f.length===2&&A.alt("lineAlign",f[1],["start",Ms,"end"]);break;case"position":f=d.split(","),A.percent(h,f[0]),f.length===2&&A.alt("positionAlign",f[1],["start",Ms,"end","line-left","line-right","auto"]);break;case"size":A.percent(h,d);break;case"align":A.alt(h,d,["start",Ms,"end","left","right"]);break}},/:/,/\s/),l.region=A.get("region",null),l.vertical=A.get("vertical","");let c=A.get("line","auto");c==="auto"&&ka.line===-1&&(c=-1),l.line=c,l.lineAlign=A.get("lineAlign","start"),l.snapToLines=A.get("snapToLines",!0),l.size=A.get("size",100),l.align=A.get("align",Ms);let u=A.get("position","auto");u==="auto"&&ka.position===50&&(u=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=u}function o(){r=r.replace(/^\s+/,"")}if(o(),e.startTime=i(),o(),r.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);r=r.slice(3),o(),e.endTime=i(),o(),s(r,e)}function oh(r){return r.replace(/<br(?: \/)?>/gi,`
2476
+ initSegmentChange: ${$}`);const O=new pI(n,i,t,a,c);this.configureTransmuxer(O)}if(this.frag=s,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:g,chunkMeta:A,state:V},e instanceof ArrayBuffer?[e]:[]);else if(d){const O=d.push(e,g,A,V);Fs(O)?(d.async=!0,O.then(W=>{this.handleTransmuxComplete(W)}).catch(W=>{this.transmuxerError(W,A,"transmuxer-interface push error")})):(d.async=!1,this.handleTransmuxComplete(O))}}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 n=t.flush(e);Fs(n)||t.async?(Fs(n)||(n=Promise.resolve(n)),n.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")})):this.handleFlushResult(n,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){U.warn(`worker message received with no ${t?"event name":"data"}`);return}const n=this.hls;if(this.hls)switch(t.event){case"init":{var i;const s=(i=this.workerContext)==null?void 0:i.objectURL;s&&self.URL.revokeObjectURL(s);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":U[t.data.logType]&&U[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,n.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 qu(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Sn(r[t].attrs,e[t].attrs))return!1;return!0}function Sn(r,e,t){const n=r["STABLE-RENDITION-ID"];return n&&!t?n===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>r[i]!==e[i])}function _a(r,e){return e.label.toLowerCase()===r.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(r.lang||"").toLowerCase())}const Xu=100;class II extends ya{constructor(e,t,n){super(e,t,n,"[audio-stream-controller]",Ee.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(I.ERROR,this.onError,this),e.on(I.BUFFER_RESET,this.onBufferReset,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(I.ERROR,this.onError,this),e.off(I.BUFFER_RESET,this.onBufferReset,this),e.off(I.BUFFER_CREATED,this.onBufferCreated,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s}){if(n==="main"){const o=t.cc;this.initPTS[t.cc]={baseTime:i,timescale:s},this.log(`InitPTS for cc: ${o} found from main: ${i}`),this.videoTrackCC=o,this.state===re.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=re.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Xu),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=re.IDLE):(this.loadedmetadata=!1,this.state=re.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case re.IDLE:this.doTickIdle();break;case re.WAITING_TRACK:{var e;const{levels:n,trackId:i}=this,s=n==null||(e=n[i])==null?void 0:e.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=re.WAITING_INIT_PTS}break}case re.FRAG_LOADING_WAITING_RETRY:{var t;const n=performance.now(),i=this.retryDate;if(!i||n>=i||(t=this.media)!=null&&t.seeking){const{levels:s,trackId:o}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((s==null?void 0:s[o])||null),this.state=re.IDLE}break}case re.WAITING_INIT_PTS:{const n=this.waitingData;if(n){const{frag:i,part:s,cache:o,complete:a}=n;if(this.initPTS[i.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=re.FRAG_LOADING;const l=o.flush(),A={frag:i,part:s,payload:l,networkDetails:null};this._handleFragmentLoadProgress(A),a&&super._handleFragmentLoadComplete(A)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${i.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const l=this.getLoadPosition(),A=Ke.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);Ea(A.end,this.config.maxFragLookUpTolerance,i)<0&&(this.log(`Waiting fragment cc (${i.cc}) @ ${i.start} cancelled because another fragment at ${A.end} is needed`),this.clearWaitingFragment())}}else this.state=re.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=re.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:n,trackId:i}=this,s=e.config;if(!n&&(this.startFragRequested||!s.startFragPrefetch)||!(t!=null&&t[i]))return;const o=t[i],a=o.details;if(!a||a.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(a)){this.state=re.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,He.AUDIO,Ee.AUDIO));const A=this.getFwdBufferInfo(l,Ee.AUDIO);if(A===null)return;const{bufferedTrack:c,switchingTrack:u}=this;if(!u&&this._streamEnded(A,a)){e.trigger(I.BUFFER_EOS,{type:"audio"}),this.state=re.ENDED;return}const h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,Ee.MAIN),d=A.len,f=this.getMaxBufferLength(h==null?void 0:h.len),g=a.fragments,p=g[0].start;let y=this.flushing?this.getLoadPosition():A.end;if(u&&n){const w=this.getLoadPosition();c&&!Sn(u.attrs,c.attrs)&&(y=w),a.PTSKnown&&w<p&&(A.end>p||A.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=p+.05)}if(d>=f&&!u&&y<g[g.length-1].start)return;let Q=this.getNextFragment(y,a),b=!1;if(Q&&this.isLoopLoading(Q,y)&&(b=!!Q.gap,Q=this.getNextFragmentLoopLoading(Q,a,A,Ee.MAIN,f)),!Q){this.bufferFlushed=!0;return}const C=h&&Q.start>h.end+a.targetduration;if(C||!(h!=null&&h.len)&&A.len){const w=this.getAppendedFrag(Q.start,Ee.MAIN);if(w===null||(b||(b=!!w.gap||!!C&&h.len===0),C&&!b||b&&A.nextStart&&A.nextStart<w.end))return}this.loadFragment(Q,o,y)}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(n=>new yn(n))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:i}=this;i&&(i.abortRequests(),this.removeUnbufferedFrags(i.start)),this.resetLoadingState(),n?this.setInterval(Xu):this.resetTransmuxer(),n?(this.switchingTrack=t,this.state=re.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=re.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(I.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var n;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:i}=this,{details:s,id:o}=t;if(!i){this.warn(`Audio tracks were reset while loading level ${o}`);return}this.log(`Audio track ${o} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const a=i[o];let l=0;if(s.live||(n=a.details)!=null&&n.live){this.checkLiveUpdate(s);const c=this.mainDetails;if(s.deltaUpdateFailed||!c)return;if(!a.details&&s.hasProgramDateTime&&c.hasProgramDateTime)ws(s,c),l=s.fragments[0].start;else{var A;l=this.alignPlaylists(s,a.details,(A=this.levelLastLoaded)==null?void 0:A.details)}}a.details=s,this.levelLastLoaded=a,!this.startFragRequested&&(this.mainDetails||!s.live)&&this.setStartPosition(this.mainDetails||s,l),this.state===re.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=re.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:n,part:i,payload:s}=e,{config:o,trackId:a,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const A=l[a];if(!A){this.warn("Audio track is undefined on fragment load progress");return}const c=A.details;if(!c){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(n.start);return}const u=o.defaultAudioCodec||A.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new Wu(this.hls,Ee.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[n.cc],f=(t=n.initSegment)==null?void 0:t.data;if(d!==void 0){const p=i?i.index:-1,y=p!==-1,Q=new va(n.level,n.sn,n.stats.chunkCount,s.byteLength,p,y);h.push(s,f,u,"",n,i,c.totalduration,!1,Q,d)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${c.startSN} ,${c.endSN}],track ${a}`);const{cache:g}=this.waitingData=this.waitingData||{frag:n,part:i,cache:new bu,complete:!1};g.push(new Uint8Array(s)),this.waitingVideoCC=this.videoTrackCC,this.state=re.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 n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n.type!==Ee.AUDIO){if(!this.loadedmetadata&&n.type===Ee.MAIN){const s=this.videoBuffer||this.media;s&&Ke.getBuffered(s).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(n.sn!=="initSegment"){this.fragPrevious=n;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(I.AUDIO_TRACK_SWITCHED,ht({},s)))}this.fragBufferedComplete(n,i)}onError(e,t){var n;if(t.fatal){this.state=re.ERROR;return}switch(t.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.AUDIO,t);break;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===re.WAITING_TRACK&&((n=t.context)==null?void 0:n.type)===Oe.AUDIO_TRACK&&(this.state=re.IDLE);break;case K.BUFFER_APPEND_ERROR:case K.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===K.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==He.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==He.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===re.ENDED&&(this.state=re.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,t,Ee.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:i}=this,{remuxResult:s,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:A,level:c}=a,{details:u}=c,{audio:h,text:d,id3:f,initSegment:g}=s;if(this.fragContextChanged(l)||!u){this.fragmentTracker.removeFragment(l);return}if(this.state=re.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),g!=null&&g.tracks){const p=l.initSegment||l;this._bufferInitSegment(c,g.tracks,p,o),i.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:p,id:n,tracks:g.tracks})}if(h){const{startPTS:p,endPTS:y,startDTS:Q,endDTS:b}=h;A&&(A.elementaryStreams[He.AUDIO]={startPTS:p,endPTS:y,startDTS:Q,endDTS:b}),l.setElementaryStreamInfo(He.AUDIO,p,y,Q,b),this.bufferFragmentData(h,l,A,o)}if(f!=null&&(t=f.samples)!=null&&t.length){const p=it({id:n,frag:l,details:u},f);i.trigger(I.FRAG_PARSING_METADATA,p)}if(d){const p=it({id:n,frag:l,details:u},d);i.trigger(I.FRAG_PARSING_USERDATA,p)}}_bufferInitSegment(e,t,n,i){if(this.state!==re.PARSING)return;t.video&&delete t.video;const s=t.audio;if(!s)return;s.id="audio";const o=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${o}/${s.codec}]`),o&&o.split(",").length===1&&(s.levelCodec=o),this.hls.trigger(I.BUFFER_CODECS,t);const a=s.initSegment;if(a!=null&&a.byteLength){const l={type:"audio",frag:n,part:null,chunkMeta:i,parent:n.type,data:a};this.hls.trigger(I.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||i===dt.NOT_LOADED||i===dt.PARTIAL){var s;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((s=t.details)!=null&&s.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=re.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragments[0].start!==t.details.fragments[0].start&&ws(t.details,o)}else this.startFragRequested=!0,super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:n}=this,i=n==null?void 0:n.attrs,s=e.attrs;t&&i&&(i.CHANNELS!==s.CHANNELS||n.name!==e.name||n.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(I.AUDIO_TRACK_SWITCHED,ht({},e))}}class vI extends Ia{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(I.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:n,groupId:i,details:s}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Audio track with id:${n} and group:${i} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Audio track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.audioGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(a=>(i==null?void 0:i.indexOf(a))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(h=>!n||n.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(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const l=this.hls.config.audioPreference;if(!s&&l){const h=cr(l,a,Qn);if(h>-1)s=a[h];else{const d=cr(l,this.tracks);s=this.tracks[d]}}let A=this.findTrackId(s);A===-1&&s&&(A=this.findTrackId(null));const c={audioTracks:a};this.log(`Updating audio tracks, ${a.length} track(s) found in group(s): ${n==null?void 0:n.join(",")}`),this.hls.trigger(I.AUDIO_TRACKS_UPDATED,c);const u=this.trackId;if(A!==-1&&u===-1)this.setAudioTrack(A);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(I.ERROR,{type:Be.MEDIA_ERROR,details:K.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}else this.shouldReloadPlaylist(s)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===Oe.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 n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const i=this.currentTrack;if(i&&Tn(e,i,Qn))return i;const s=cr(e,this.tracksInGroup,Qn);if(s>-1){const o=this.tracksInGroup[s];return this.setAudioTrack(s),o}else if(i){let o=t.loadLevel;o===-1&&(o=t.firstAutoLevel);const a=vE(e,t.levels,n,o,Qn);if(a===-1)return null;t.nextLoadLevel=a}if(e.channels||e.audioCodec){const o=cr(e,n);if(o>-1)return n[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 n=this.currentTrack,i=t[e],s=i.details&&!i.details.live;if(e===this.trackId&&i===n&&s||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(I.AUDIO_TRACK_SWITCHING,ht({},i)),s))return;const o=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(o)}findTrackId(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(!(this.selectDefaultTrack&&!i.default)&&(!e||Tn(e,i,Qn)))return n}if(e){const{name:n,lang:i,assocLang:s,characteristics:o,audioCodec:a,channels:l}=e;for(let A=0;A<t.length;A++){const c=t[A];if(Tn({name:n,lang:i,assocLang:s,characteristics:o,audioCodec:a,channels:l},c,Qn))return A}for(let A=0;A<t.length;A++){const c=t[A];if(Sn(e.attrs,c.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return A}for(let A=0;A<t.length;A++){const c=t[A];if(Sn(e.attrs,c.attrs,["LANGUAGE"]))return A}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const n=t.id,i=t.groupId;let s=t.url;if(e)try{s=e.addDirectives(s)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`loading audio-track playlist ${n} "${t.name}" lang:${t.lang} group:${i}`),this.clearTimer(),this.hls.trigger(I.AUDIO_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:e||null})}}}const ju=500;class CI extends ya{constructor(e,t,n){super(e,t,n,"[subtitle-stream-controller]",Ee.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.ERROR,this.onError,this),e.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.ERROR,this.onError,this),e.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(I.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(I.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=re.IDLE,this.setInterval(ju),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:n,success:i}=t;if(this.fragPrevious=n,this.state=re.IDLE,!i)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let o;const a=n.start;for(let A=0;A<s.length;A++)if(a>=s[A].start&&a<=s[A].end){o=s[A];break}const l=n.start+n.duration;o?o.end=l:(o={start:a,end:l},s.push(o)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null)}onBufferFlushing(e,t){const{startOffset:n,endOffset:i}=t;if(n===0&&i!==Number.POSITIVE_INFINITY){const s=i-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(o=>{for(let a=0;a<o.length;){if(o[a].end<=s){o.shift();continue}else if(o[a].start<s)o[a].start=s;else break;a++}}),this.fragmentTracker.removeFragmentsInRange(n,s,Ee.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===Ee.MAIN){var n;(n=this.media)!=null&&n.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const n=t.frag;(n==null?void 0:n.type)===Ee.SUBTITLE&&(t.details===K.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==re.STOPPED&&(this.state=re.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&qu(this.levels,t)){this.levels=t.map(n=>new yn(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const i=new yn(n);return this.tracksBuffered[i.id]=[],i}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Ee.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const i=this.levels[this.currentTrackId];i!=null&&i.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,i&&this.setInterval(ju)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:i,levels:s}=this,{details:o,id:a}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${a}`);return}const l=s[a];if(a>=s.length||!l)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 A=0;if(o.live||(n=l.details)!=null&&n.live){const u=this.mainDetails;if(o.deltaUpdateFailed||!u)return;const h=u.fragments[0];if(!l.details)o.hasProgramDateTime&&u.hasProgramDateTime?(ws(o,u),A=o.fragments[0].start):h&&(A=h.start,pa(o,A));else{var c;A=this.alignPlaylists(o,l.details,(c=this.levelLastLoaded)==null?void 0:c.details),A===0&&h&&(A=h.start,pa(o,A))}}l.details=o,this.levelLastLoaded=l,a===i&&(!this.startFragRequested&&(this.mainDetails||!o.live)&&this.setStartPosition(this.mainDetails||o,A),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===re.IDLE&&(Ts(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:n}=e,i=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&i!=null&&i.key&&i.iv&&i.method==="AES-128"){const o=performance.now();this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer).catch(a=>{throw s.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:a,reason:a.message,frag:t}),a}).then(a=>{const l=performance.now();s.trigger(I.FRAG_DECRYPTED,{frag:t,payload:a,stats:{tstart:o,tdecrypt:l}})}).catch(a=>{this.warn(`${a.name}: ${a.message}`),this.state=re.IDLE})}}doTick(){if(!this.media){this.state=re.IDLE;return}if(this.state===re.IDLE){const{currentTrackId:e,levels:t}=this,n=t==null?void 0:t[e];if(!n||!t.length||!n.details)return;const{config:i}=this,s=this.getLoadPosition(),o=Ke.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,i.maxBufferHole),{end:a,len:l}=o,A=this.getFwdBufferInfo(this.media,Ee.MAIN),c=n.details,u=this.getMaxBufferLength(A==null?void 0:A.len)+c.levelTargetDuration;if(l>u)return;const h=c.fragments,d=h.length,f=c.edge;let g=null;const p=this.fragPrevious;if(a<f){const y=i.maxFragLookUpTolerance,Q=a>f-y?0:y;g=Ts(p,h,Math.max(h[0].start,a),Q),!g&&p&&p.start<h[0].start&&(g=h[0])}else g=h[d-1];if(!g)return;if(g=this.mapToInitFragWhenRequired(g),g.sn!=="initSegment"){const y=g.sn-c.startSN,Q=h[y-1];Q&&Q.cc===g.cc&&this.fragmentTracker.getState(Q)===dt.NOT_LOADED&&(g=Q)}this.fragmentTracker.getState(g)===dt.NOT_LOADED&&this.loadFragment(g,n,a)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,n){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,n))}get mediaBufferTimeRanges(){return new yI(this.tracksBuffered[this.currentTrackId]||[])}}class yI{constructor(e){this.buffered=void 0;const t=(n,i,s)=>{if(i=i>>>0,i>s-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][n]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}class BI extends Ia{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 n=Es(this.media.textTracks);for(let s=0;s<n.length;s++)if(n[s].mode==="hidden")t=n[s];else if(n[s].mode==="showing"){t=n[s];break}const i=this.findTrackForTextTrack(t);this.subtitleTrack!==i&&this.setSubtitleTrack(i)},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(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADING,this.onLevelLoading,this),e.off(I.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(I.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(I.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),Es(this.media.textTracks).forEach(t=>{Cn(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:n,groupId:i,details:s}=t,o=this.tracksInGroup[n];if(!o||o.groupId!==i){this.warn(`Subtitle track with id:${n} and group:${i} not found in active group ${o==null?void 0:o.groupId}`);return}const a=o.details;o.details=t.details,this.log(`Subtitle track ${n} "${o.name}" lang:${o.lang} group:${i} loaded [${s.startSN}-${s.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.subtitleGroups||null,i=this.groupIds;let s=this.currentTrack;if(!n||(i==null?void 0:i.length)!==(n==null?void 0:n.length)||n!=null&&n.some(o=>(i==null?void 0:i.indexOf(o))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(c=>!n||n.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(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const a=this.hls.config.subtitlePreference;if(!s&&a){this.selectDefaultTrack=!1;const c=cr(a,o);if(c>-1)s=o[c];else{const u=cr(a,this.tracks);s=this.tracks[u]}}let l=this.findTrackId(s);l===-1&&s&&(l=this.findTrackId(null));const A={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${n==null?void 0:n.join(",")}" group-id`),this.hls.trigger(I.SUBTITLE_TRACKS_UPDATED,A),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}else this.shouldReloadPlaylist(s)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,n=this.selectDefaultTrack;for(let i=0;i<t.length;i++){const s=t[i];if(!(n&&!s.default||!n&&!e)&&(!e||Tn(s,e)))return i}if(e){for(let i=0;i<t.length;i++){const s=t[i];if(Sn(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){const s=t[i];if(Sn(e.attrs,s.attrs,["LANGUAGE"]))return i}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const i=t[n];if(_a(i,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Oe.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 n=this.currentTrack;if(n&&Tn(e,n))return n;const i=cr(e,this.tracksInGroup);if(i>-1){const s=this.tracksInGroup[i];return this.setSubtitleTrack(i),s}else{if(n)return null;{const s=cr(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const n=t.id,i=t.groupId;let s=t.url;if(e)try{s=e.addDirectives(s)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}this.log(`Loading subtitle playlist for id ${n}`),this.hls.trigger(I.SUBTITLE_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Es(e.textTracks),n=this.currentTrack;let i;if(n&&(i=t.filter(s=>_a(n,s))[0],i||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==i&&(s.mode="disabled")}),i){const s=this.subtitleDisplay?"showing":"hidden";i.mode!==s&&(i.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!he(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const n=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),!i){this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!i.details&&!i.details.live;if(e===this.trackId&&i===n&&s)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:o,groupId:a="",name:l,type:A,url:c}=i;this.hls.trigger(I.SUBTITLE_TRACK_SWITCH,{id:o,groupId:a,name:l,type:A,url:c});const u=this.switchParams(i.url,n==null?void 0:n.details,i.details);this.loadPlaylist(u)}}class TI{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,n){const i=this.queues[t];i.push(e),i.length===1&&!n&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const n=new Promise(s=>{t=s}),i={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(i,e),n}executeNext(e){const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(i){U.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${i}`),n.onError(i);const s=this.buffers[e];s!=null&&s.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const zu=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class QI{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=n=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:n,mediaSource:i}=this;this.log("Media source opened"),n&&(n.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(I.MEDIA_ATTACHED,{media:n,mediaSource:i})),i&&i.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:n,_objectUrl:i}=this;n!==i&&U.error(`Media element src was set while attaching MediaSource (${i} > ${n})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=Fm(en(e.config.preferManagedMediaSource)),this.log=U.log.bind(U,t),this.warn=U.warn.bind(U,t),this.error=U.error.bind(U,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(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.BUFFER_RESET,this.onBufferReset,this),e.on(I.BUFFER_APPENDING,this.onBufferAppending,this),e.on(I.BUFFER_CODECS,this.onBufferCodecs,this),e.on(I.BUFFER_EOS,this.onBufferEos,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(I.FRAG_PARSED,this.onFragParsed,this),e.on(I.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.BUFFER_RESET,this.onBufferReset,this),e.off(I.BUFFER_APPENDING,this.onBufferAppending,this),e.off(I.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.BUFFER_EOS,this.onBufferEos,this),e.off(I.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(I.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(I.FRAG_PARSED,this.onFragParsed,this),e.off(I.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new TI(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 n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const n=this.media=t.media,i=en(this.appendSource);if(n&&i){var s;const o=this.mediaSource=new i;this.log(`created media source: ${(s=o.constructor)==null?void 0:s.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{n.removeAttribute("src");const l=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||l&&o instanceof l,Zu(n),bI(n,a),n.load()}catch{n.src=a}else n.src=a;n.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:n}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(i){this.warn(`onMediaDetaching: ${i.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),n&&self.URL.revokeObjectURL(n),this.mediaSrc===n?(e.removeAttribute("src"),this.appendSource&&Zu(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(I.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 n;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(i){this.warn(`onBufferReset ${e}`,i)}}onBufferCodecs(e,t){const n=this.getSourceBufferTypes().length,i=Object.keys(t);if(i.forEach(o=>{if(n){const l=this.tracks[o];if(l&&typeof l.buffer.changeType=="function"){var a;const{id:A,codec:c,levelCodec:u,container:h,metadata:d}=t[o],f=Jc(l.codec,l.levelCodec),g=f==null?void 0:f.replace(zu,"$1");let p=Jc(c,u);const y=(a=p)==null?void 0:a.replace(zu,"$1");if(p&&g!==y){o.slice(0,5)==="audio"&&(p=ms(p,this.appendSource));const Q=`${h};codecs=${p}`;this.appendChangeType(o,Q),this.log(`switching codec ${f} to ${p}`),this.tracks[o]={buffer:l.buffer,codec:c,container:h,levelCodec:u,metadata:d,id:A}}}}else this.pendingTracks[o]=t[o]}),n)return;const s=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==s&&(this.log(`${s} bufferCodec event(s) expected ${i.join(",")}`),this.bufferCodecEventsExpected=s),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:n}=this,i={execute:()=>{const s=this.sourceBuffer[e];s&&(this.log(`changing ${e} sourceBuffer type to ${t}`),s.changeType(t)),n.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:s=>{this.warn(`Failed to change ${e} SourceBuffer type`,s)}};n.append(i,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:n,operationQueue:i,tracks:s}=this,{data:o,type:a,frag:l,part:A,chunkMeta:c}=t,u=c.buffering[a],h=self.performance.now();u.start=h;const d=l.stats.buffering,f=A?A.stats.buffering:null;d.start===0&&(d.start=h),f&&f.start===0&&(f.start=h);const g=s.audio;let p=!1;a==="audio"&&(g==null?void 0:g.container)==="audio/mpeg"&&(p=!this.lastMpegAudioChunk||c.id===1||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);const y=l.start,Q={execute:()=>{if(u.executeStart=self.performance.now(),p){const b=this.sourceBuffer[a];if(b){const C=y-b.timestampOffset;Math.abs(C)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${y} (delta: ${C}) sn: ${l.sn})`),b.timestampOffset=y)}}this.appendExecutor(o,a)},onStart:()=>{},onComplete:()=>{const b=self.performance.now();u.executeEnd=u.end=b,d.first===0&&(d.first=b),f&&f.first===0&&(f.first=b);const{sourceBuffer:C}=this,w={};for(const R in C)w[R]=Ke.getBuffered(C[R]);this.appendErrors[a]=0,a==="audio"||a==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(I.BUFFER_APPENDED,{type:a,frag:l,part:A,chunkMeta:c,parent:l.type,timeRanges:w})},onError:b=>{const C={type:Be.MEDIA_ERROR,parent:l.type,details:K.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:l,part:A,chunkMeta:c,error:b,err:b,fatal:!1};if(b.code===DOMException.QUOTA_EXCEEDED_ERR)C.details=K.BUFFER_FULL_ERROR;else{const w=++this.appendErrors[a];C.details=K.BUFFER_APPEND_ERROR,this.warn(`Failed ${w}/${n.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),w>=n.config.appendErrorMaxRetry&&(C.fatal=!0)}n.trigger(I.ERROR,C)}};i.append(Q,a,!!this.pendingTracks[a])}onBufferFlushing(e,t){const{operationQueue:n}=this,i=s=>({execute:this.removeExecutor.bind(this,s,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(I.BUFFER_FLUSHED,{type:s})},onError:o=>{this.warn(`Failed to remove from ${s} SourceBuffer`,o)}});t.type?n.append(i(t.type),t.type):this.getSourceBufferTypes().forEach(s=>{n.append(i(s),s)})}onFragParsed(e,t){const{frag:n,part:i}=t,s=[],o=i?i.elementaryStreams:n.elementaryStreams;o[He.AUDIOVIDEO]?s.push("audiovideo"):(o[He.AUDIO]&&s.push("audio"),o[He.VIDEO]&&s.push("video"));const a=()=>{const l=self.performance.now();n.stats.buffering.end=l,i&&(i.stats.buffering.end=l);const A=i?i.stats:n.stats;this.hls.trigger(I.FRAG_BUFFERED,{frag:n,part:i,stats:A,id:n.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(a,s)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((i,s)=>{const o=this.sourceBuffer[s];return o&&(!t.type||t.type===s)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${s} sourceBuffer now EOS`))),i&&!!(!o||o.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(s=>{const o=this.sourceBuffer[s];o&&(o.ending=!1)});const{mediaSource:i}=this;if(!i||i.readyState!=="open"){i&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${i.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),i.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:n}=this;if(!n||t===null||!this.getSourceBufferTypes().length)return;const s=e.config,o=n.currentTime,a=t.levelTargetDuration,l=t.live&&s.liveBackBufferLength!==null?s.liveBackBufferLength:s.backBufferLength;if(he(l)&&l>0){const A=Math.max(l,a),c=Math.floor(o/a)*a-A;this.flushBackBuffer(o,a,c)}if(he(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const A=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),c=Math.max(A,a),u=Math.floor(o/a)*a+c;this.flushFrontBuffer(o,a,u)}}flushBackBuffer(e,t,n){const{details:i,sourceBuffer:s}=this;this.getSourceBufferTypes().forEach(a=>{const l=s[a];if(l){const A=Ke.getBuffered(l);if(A.length>0&&n>A.start(0)){if(this.hls.trigger(I.BACK_BUFFER_REACHED,{bufferEnd:n}),i!=null&&i.live)this.hls.trigger(I.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(l.ended&&A.end(A.length-1)-e<t*2){this.log(`Cannot flush ${a} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:a})}}})}flushFrontBuffer(e,t,n){const{sourceBuffer:i}=this;this.getSourceBufferTypes().forEach(o=>{const a=i[o];if(a){const l=Ke.getBuffered(a),A=l.length;if(A<2)return;const c=l.start(A-1),u=l.end(A-1);if(n>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(I.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:n,mediaSource:i}=this,s=e.fragments[0].start+e.totalduration,o=n.duration,a=he(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(s>a&&s>o||!he(o))&&(this.log(`Updating Media Source duration to ${s.toFixed(3)}`),i.duration=s)}updateSeekableRange(e){const t=this.mediaSource,n=e.fragments;if(n.length&&e.live&&t!=null&&t.setLiveSeekableRange){const s=Math.max(0,n[0].start),o=Math.max(s,s+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${s}-${o}.`),t.setLiveSeekableRange(s,o)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:n}=this,i=Object.keys(n).length;if(i&&(!e||i===2||"audiovideo"in n)){this.createSourceBuffers(n),this.pendingTracks={};const s=this.getSourceBufferTypes();if(s.length)this.hls.trigger(I.BUFFER_CREATED,{tracks:this.tracks}),s.forEach(o=>{t.executeNext(o)});else{const o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:n}=this;if(!n)throw Error("createSourceBuffers called when mediaSource was null");for(const s in e)if(!t[s]){var i;const o=e[s];if(!o)throw Error(`source buffer exists for track ${s}, however track does not`);let a=((i=o.levelCodec)==null?void 0:i.indexOf(","))===-1?o.levelCodec:o.codec;a&&s.slice(0,5)==="audio"&&(a=ms(a,this.appendSource));const l=`${o.container};codecs=${a}`;this.log(`creating sourceBuffer(${l})`);try{const A=t[s]=n.addSourceBuffer(l),c=s;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(I.BUFFER_FLUSHED,{type:s})}),this.tracks[s]={buffer:A,codec:a,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(A){this.error(`error while trying to add sourceBuffer: ${A.message}`),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:A,sourceBufferName:s,mimeType:l})}}}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:n}=this;n.current(e).onComplete(),n.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var n;const i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${i}`,t),this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const s=this.operationQueue.current(e);s&&s.onError(i)}removeExecutor(e,t,n){const{media:i,mediaSource:s,operationQueue:o,sourceBuffer:a}=this,l=a[e];if(!i||!s||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),o.shiftAndExecuteNext(e);return}const A=he(i.duration)?i.duration:1/0,c=he(s.duration)?s.duration:1/0,u=Math.max(0,t),h=Math.min(n,A,c);h>u&&(!l.ending||l.ended)?(l.ended=!1,this.log(`Removing [${u},${h}] from the ${e} SourceBuffer`),l.remove(u,h)):o.shiftAndExecuteNext(e)}appendExecutor(e,t){const n=this.sourceBuffer[t];if(!n){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}n.ended=!1,n.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:n}=this,i=t.map(s=>n.appendBlocker(s));Promise.all(i).then(()=>{e(),t.forEach(s=>{const o=this.sourceBuffer[s];o!=null&&o.updating||n.shiftAndExecuteNext(s)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,n){const i=this.sourceBuffer[e];if(!i)return;const s=n.bind(this,e);this.listeners[e].push({event:t,listener:s}),i.addEventListener(t,s)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(n=>{t.removeEventListener(n.event,n.listener)})}}function Zu(r){const e=r.querySelectorAll("source");[].slice.call(e).forEach(t=>{r.removeChild(t)})}function bI(r,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,r.appendChild(t)}const xI={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},eh=r=>String.fromCharCode(xI[r]||r),er=15,xr=100,wI={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},SI={17:2,18:4,21:6,22:8,23:10,19:13,20:15},RI={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},DI={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_I=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class LI{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n=typeof t=="function"?t():t;U.log(`${this.time} [${e}] ${n}`)}}}const tn=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class th{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 n=0;n<t.length;n++){const i=t[n];e.hasOwnProperty(i)&&(this[i]=e[i])}}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 FI{constructor(){this.uchar=" ",this.penState=new th}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 kI{constructor(e){this.chars=[],this.pos=0,this.currPenState=new th,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<xr;t++)this.chars.push(new FI);this.logger=e}equals(e){for(let t=0;t<xr;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<xr;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<xr;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>xr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=xr)}moveCursor(e){const t=this.pos+e;if(e>1)for(let n=this.pos+1;n<t+1;n++)this.chars[n].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=eh(e);if(this.pos>=xr){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<xr;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 n=0;n<xr;n++){const i=this.chars[n].uchar;i!==" "&&(t=!1),e.push(i)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class La{constructor(e){this.rows=[],this.currRow=er-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<er;t++)this.rows.push(new kI(e));this.logger=e}reset(){for(let e=0;e<er;e++)this.rows[e].clear();this.currRow=er-1}equals(e){let t=!0;for(let n=0;n<er;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<er;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<er;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<er;a++)this.rows[a].clear();const s=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const a=o.rows[s].cueStartTime,l=this.logger.time;if(a!==null&&l!==null&&a<l)for(let A=0;A<this.nrRollUpRows;A++)this.rows[t-this.nrRollUpRows+A+1].copy(o.rows[s+A])}}this.currRow=t;const n=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,o=Math.max(s-1,0);n.setCursor(e.indent),e.color=n.chars[o].penState.foreground}const i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}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 n="",i=-1;for(let s=0;s<er;s++){const o=this.rows[s].getTextString();o&&(i=s+1,e?t.push("Row "+i+": '"+o+"'"):t.push(o.trim()))}return t.length>0&&(e?n="["+t.join(" | ")+"]":n=t.join(`
2477
+ `)),n}getTextAndFormat(){return this.rows}}class rh{constructor(e,t,n){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 La(n),this.nonDisplayedMemory=new La(n),this.lastOutputScreen=new La(n),this.currRollUpRow=this.displayedMemory.rows[er-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[er-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 n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);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 n=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[n]}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 nh{constructor(e,t,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=MI(),this.logger=void 0;const i=this.logger=new LI;this.channels=[null,new rh(e,t,i),new rh(e+1,n,i)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let n=0;n<t.length;n+=2){const i=t[n]&127,s=t[n+1]&127;let o=!1,a=null;if(i===0&&s===0)continue;this.logger.log(3,()=>"["+tn([t[n],t[n+1]])+"] -> ("+tn([i,s])+")");const l=this.cmdHistory;if(i>=16&&i<=31){if(NI(i,s,l)){ks(null,null,l),this.logger.log(3,()=>"Repeated command ("+tn([i,s])+") is dropped");continue}ks(i,s,this.cmdHistory),o=this.parseCmd(i,s),o||(o=this.parseMidrow(i,s)),o||(o=this.parsePAC(i,s)),o||(o=this.parseBackgroundAttributes(i,s))}else ks(null,null,l);if(!o&&(a=this.parseChars(i,s),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 "+tn([i,s])+" orig: "+tn([t[n],t[n+1]]))}}parseCmd(e,t){const n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=33&&t<=35;if(!(n||i))return!1;const s=e===20||e===21||e===23?1:2,o=this.channels[s];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=s,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const i=this.channels[n];return i?(i.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+tn([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let n;const i=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,s=(e===16||e===24)&&t>=64&&t<=95;if(!(i||s))return!1;const o=e<=23?1:2;t>=64&&t<=95?n=o===1?wI[e]:RI[e]:n=o===1?SI[e]:DI[e];const a=this.channels[o];return a?(a.setPAC(this.interpretPAC(n,t)),this.currentChannel=o,!0):!1}interpretPAC(e,t){let n;const i={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?n=t-96:n=t-64,i.underline=(n&1)===1,n<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(i.italics=!0,i.color="white"):i.indent=Math.floor((n-16)/2)*4,i}parseChars(e,t){let n,i=null,s=null;if(e>=25?(n=2,s=e-8):(n=1,s=e),s>=17&&s<=19){let o;s===17?o=t+80:s===18?o=t+112:o=t+144,this.logger.log(2,()=>"Special char '"+eh(o)+"' in channel "+n),i=[o]}else e>=32&&e<=127&&(i=t===0?[e]:[e,t]);return i&&this.logger.log(3,()=>"Char codes = "+tn(i).join(",")),i}parseBackgroundAttributes(e,t){const n=(e===16||e===24)&&t>=32&&t<=47,i=(e===23||e===31)&&t>=45&&t<=47;if(!(n||i))return!1;let s;const o={};e===16||e===24?(s=Math.floor((t-32)/2),o.background=_I[s],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()}ks(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function ks(r,e,t){t.a=r,t.b=e}function NI(r,e,t){return t.a===r&&t.b===e}function MI(){return{a:null,b:null}}class Ns{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,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var Fa=function(){if(vn!=null&&vn.VTTCue)return self.VTTCue;const r=["","lr","rl"],e=["start","middle","end","left","right"];function t(a,l){if(typeof l!="string"||!Array.isArray(a))return!1;const A=l.toLowerCase();return~a.indexOf(A)?A:!1}function n(a){return t(r,a)}function i(a){return t(e,a)}function s(a,...l){let A=1;for(;A<arguments.length;A++){const c=arguments[A];for(const u in c)a[u]=c[u]}return a}function o(a,l,A){const c=this,u={enumerable:!0};c.hasBeenReset=!1;let h="",d=!1,f=a,g=l,p=A,y=null,Q="",b=!0,C="auto",w="start",R=50,k="middle",$=50,V="middle";Object.defineProperty(c,"id",s({},u,{get:function(){return h},set:function(O){h=""+O}})),Object.defineProperty(c,"pauseOnExit",s({},u,{get:function(){return d},set:function(O){d=!!O}})),Object.defineProperty(c,"startTime",s({},u,{get:function(){return f},set:function(O){if(typeof O!="number")throw new TypeError("Start time must be set to a number.");f=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"endTime",s({},u,{get:function(){return g},set:function(O){if(typeof O!="number")throw new TypeError("End time must be set to a number.");g=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"text",s({},u,{get:function(){return p},set:function(O){p=""+O,this.hasBeenReset=!0}})),Object.defineProperty(c,"region",s({},u,{get:function(){return y},set:function(O){y=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"vertical",s({},u,{get:function(){return Q},set:function(O){const W=n(O);if(W===!1)throw new SyntaxError("An invalid or illegal string was specified.");Q=W,this.hasBeenReset=!0}})),Object.defineProperty(c,"snapToLines",s({},u,{get:function(){return b},set:function(O){b=!!O,this.hasBeenReset=!0}})),Object.defineProperty(c,"line",s({},u,{get:function(){return C},set:function(O){if(typeof O!="number"&&O!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"lineAlign",s({},u,{get:function(){return w},set:function(O){const W=i(O);if(!W)throw new SyntaxError("An invalid or illegal string was specified.");w=W,this.hasBeenReset=!0}})),Object.defineProperty(c,"position",s({},u,{get:function(){return R},set:function(O){if(O<0||O>100)throw new Error("Position must be between 0 and 100.");R=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"positionAlign",s({},u,{get:function(){return k},set:function(O){const W=i(O);if(!W)throw new SyntaxError("An invalid or illegal string was specified.");k=W,this.hasBeenReset=!0}})),Object.defineProperty(c,"size",s({},u,{get:function(){return $},set:function(O){if(O<0||O>100)throw new Error("Size must be between 0 and 100.");$=O,this.hasBeenReset=!0}})),Object.defineProperty(c,"align",s({},u,{get:function(){return V},set:function(O){const W=i(O);if(!W)throw new SyntaxError("An invalid or illegal string was specified.");V=W,this.hasBeenReset=!0}})),c.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class PI{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function ih(r){function e(n,i,s,o){return(n|0)*3600+(i|0)*60+(s|0)+parseFloat(o||0)}const t=r.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 OI{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let i=0;i<n.length;++i)if(t===n[i]){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 n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function sh(r,e,t,n){const i=n?r.split(n):[r];for(const s in i){if(typeof i[s]!="string")continue;const o=i[s].split(t);if(o.length!==2)continue;const a=o[0],l=o[1];e(a,l)}}const ka=new Fa(0,0,""),Ms=ka.align==="middle"?"middle":"center";function UI(r,e,t){const n=r;function i(){const a=ih(r);if(a===null)throw new Error("Malformed timestamp: "+n);return r=r.replace(/^[^\sa-zA-Z-]+/,""),a}function s(a,l){const A=new OI;sh(a,function(h,d){let f;switch(h){case"region":for(let g=t.length-1;g>=0;g--)if(t[g].id===d){A.set(h,t[g].region);break}break;case"vertical":A.alt(h,d,["rl","lr"]);break;case"line":f=d.split(","),A.integer(h,f[0]),A.percent(h,f[0])&&A.set("snapToLines",!1),A.alt(h,f[0],["auto"]),f.length===2&&A.alt("lineAlign",f[1],["start",Ms,"end"]);break;case"position":f=d.split(","),A.percent(h,f[0]),f.length===2&&A.alt("positionAlign",f[1],["start",Ms,"end","line-left","line-right","auto"]);break;case"size":A.percent(h,d);break;case"align":A.alt(h,d,["start",Ms,"end","left","right"]);break}},/:/,/\s/),l.region=A.get("region",null),l.vertical=A.get("vertical","");let c=A.get("line","auto");c==="auto"&&ka.line===-1&&(c=-1),l.line=c,l.lineAlign=A.get("lineAlign","start"),l.snapToLines=A.get("snapToLines",!0),l.size=A.get("size",100),l.align=A.get("align",Ms);let u=A.get("position","auto");u==="auto"&&ka.position===50&&(u=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=u}function o(){r=r.replace(/^\s+/,"")}if(o(),e.startTime=i(),o(),r.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);r=r.slice(3),o(),e.endTime=i(),o(),s(r,e)}function oh(r){return r.replace(/<br(?: \/)?>/gi,`
2478
2478
  `)}class GI{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new PI,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 n(){let s=t.buffer,o=0;for(s=oh(s);o<s.length&&s[o]!=="\r"&&s[o]!==`
2479
2479
  `;)++o;const a=s.slice(0,o);return s[o]==="\r"&&++o,s[o]===`
2480
2480
  `&&++o,t.buffer=s.slice(o),a}function i(s){sh(s,function(o,a){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=n();const a=s.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:s=n(),t.state){case"HEADER":/:/.test(s)?i(s):s||(t.state="ID");continue;case"NOTE":s||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){t.state="NOTE";break}if(!s)continue;if(t.cue=new Fa(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{UI(s,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const a=s.indexOf("-->")!==-1;if(!s||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+=`
@@ -2482,14 +2482,14 @@ vec4 transition(vec2 uv) {
2482
2482
 
2483
2483
  `,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 HI=/\r\n|\n\r|\n|\r/g,Na=function(e,t,n=0){return e.slice(n,n+t.length)===t},$I=function(e){let t=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),i=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!he(t)||!he(n)||!he(i)||!he(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*i,t+=60*60*1e3*s,t},Ma=function(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0).toString()};function Pa(r,e,t){return Ma(r.toString())+Ma(e.toString())+Ma(t)}const YI=function(e,t,n){let i=e[t],s=e[i.prevCC];if(!s||!s.new&&i.new){e.ccOffset=e.presentationOffset=i.start,i.new=!1;return}for(;(o=s)!=null&&o.new;){var o;e.ccOffset+=i.start-s.start,i.new=!1,i=s,s=e[i.prevCC]}e.presentationOffset=n};function VI(r,e,t,n,i,s,o){const a=new GI,l=or(new Uint8Array(r)).trim().replace(HI,`
2484
2484
  `).split(`
2485
- `),A=[],c=e?lI(e.baseTime,e.timescale):0;let u="00:00.000",h=0,d=0,f,g=!0;a.oncue=function(p){const C=t[n];let Q=t.ccOffset;const b=(h-c)/9e4;if(C!=null&&C.new&&(d!==void 0?Q=t.ccOffset=C.start:YI(t,n,b)),b){if(!e){f=new Error("Missing initPTS for VTT MPEGTS");return}Q=b-t.presentationOffset}const y=p.endTime-p.startTime,w=Yt((p.startTime+Q-d)*9e4,i*9e4)/9e4;p.startTime=Math.max(w,0),p.endTime=Math.max(w+y,0);const R=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(R)),p.id||(p.id=Pa(p.startTime,p.endTime,R)),p.endTime>0&&A.push(p)},a.onparsingerror=function(p){f=p},a.onflush=function(){if(f){o(f);return}s(A)},l.forEach(p=>{if(g)if(Na(p,"X-TIMESTAMP-MAP=")){g=!1,p.slice(16).split(",").forEach(C=>{Na(C,"LOCAL:")?u=C.slice(6):Na(C,"MPEGTS:")&&(h=parseInt(C.slice(7)))});try{d=$I(u)/1e3}catch(C){f=C}return}else p===""&&(g=!1);a.parse(p+`
2486
- `)}),a.flush()}const Oa="stpp.ttml.im1t",ah=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,lh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,KI={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ah(r,e,t,n){const i=xe(new Uint8Array(r),["mdat"]);if(i.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const s=i.map(a=>or(a)),o=aI(e.baseTime,1,e.timescale);try{s.forEach(a=>t(JI(a,o)))}catch(a){n(a)}}function JI(r,e){const i=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(s).reduce((u,h)=>(u[h]=i.getAttribute(`ttp:${h}`)||s[h],u),{}),a=i.getAttribute("xml:space")!=="preserve",l=ch(Ua(i,"styling","style")),A=ch(Ua(i,"layout","region")),c=Ua(i,"body","[begin]");return[].map.call(c,u=>{const h=uh(u,a);if(!h||!u.hasAttribute("begin"))return null;const d=Ha(u.getAttribute("begin"),o),f=Ha(u.getAttribute("dur"),o);let g=Ha(u.getAttribute("end"),o);if(d===null)throw hh(u);if(g===null){if(f===null)throw hh(u);g=d+f}const p=new Fa(d-e,g-e,h);p.id=Pa(p.startTime,p.endTime,p.text);const C=A[u.getAttribute("region")],Q=l[u.getAttribute("style")],b=WI(C,Q,l),{textAlign:y}=b;if(y){const w=KI[y];w&&(p.lineAlign=w),p.align=y}return it(p,b),p}).filter(u=>u!==null)}function Ua(r,e,t){const n=r.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function ch(r){return r.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function uh(r,e){return[].slice.call(r.childNodes).reduce((t,n,i)=>{var s;return n.nodeName==="br"&&i?t+`
2487
- `:(s=n.childNodes)!=null&&s.length?uh(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function WI(r,e,t){const n="http://www.w3.org/ns/ttml#styling";let i=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=r!=null&&r.hasAttribute("style")?r.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(i=t[o]),s.reduce((a,l)=>{const A=Ga(e,n,l)||Ga(r,n,l)||Ga(i,n,l);return A&&(a[l]=A),a},{})}function Ga(r,e,t){return r&&r.hasAttributeNS(e,t)?r.getAttributeNS(e,t):null}function hh(r){return new Error(`Could not parse ttml timestamp ${r}`)}function Ha(r,e){if(!r)return null;let t=ih(r);return t===null&&(ah.test(r)?t=qI(r,e):lh.test(r)&&(t=XI(r,e))),t}function qI(r,e){const t=ah.exec(r),n=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/e.frameRate}function XI(r,e){const t=lh.exec(r),n=Number(t[1]);switch(t[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class jI{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=gh(),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(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(I.FRAG_LOADING,this.onFragLoading,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this),e.on(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(I.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(I.FRAG_LOADING,this.onFragLoading,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this),e.off(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(I.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(I.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 Ns(this,"textTrack1"),t=new Ns(this,"textTrack2"),n=new Ns(this,"textTrack3"),i=new Ns(this,"textTrack4");this.cea608Parser1=new nh(1,e,t),this.cea608Parser2=new nh(3,n,i)}}addCues(e,t,n,i,s){let o=!1;for(let a=s.length;a--;){const l=s[a],A=zI(l[0],l[1],t,n);if(A>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],n),o=!0,A/(n-t)>.5))return}if(o||s.push([t,n]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,n,i)}else{const a=this.Cues.newCue(null,t,n,i);this.hls.trigger(I.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s}){const{unparsedVttFrags:o}=this;n==="main"&&(this.initPTS[t.cc]={baseTime:i,timescale:s}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(I.FRAG_LOADED,a)}))}getExistingTrack(e,t){const{media:n}=this;if(n)for(let i=0;i<n.textTracks.length;i++){const s=n.textTracks[i];if(fh(s,{name:e,lang:t,attrs:{}}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:n,media:i}=this,{label:s,languageCode:o}=t[e],a=this.getExistingTrack(s,o);if(a)n[e]=a,Cn(n[e]),iu(n[e],i);else{const l=this.createTextTrack("captions",s,o);l&&(l[e]=!0,n[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n=t.label,i={_id:e,label:n,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,n){const i=this.media;if(i)return i.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{Cn(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=gh(),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 n=0;n<t.length;n++)Cn(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],i=n.some(s=>s.textCodec===Oa);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(qu(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const o=this.media,a=o?Es(o.textTracks):null;if(this.tracks.forEach((l,A)=>{let c;if(a){let u=null;for(let h=0;h<a.length;h++)if(a[h]&&fh(a[h],l)){u=a[h],a[h]=null;break}u&&(c=u)}if(c)Cn(c);else{const u=dh(l);c=this.createTextTrack(u,l.name,l.lang),c&&(c.mode="disabled")}c&&this.textTracks.push(c)}),a!=null&&a.length){const l=a.filter(A=>A!==null).map(A=>A.label);l.length&&U.warn(`Media element contains unused subtitle tracks: ${l.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(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(n=>{const i=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!i)return;const s=`textTrack${i[1]}`,o=this.captionsProperties[s];o&&(o.label=n.name,n.lang&&(o.languageCode=n.lang),o.media=n)})}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===Ee.MAIN){var n,i;const{cea608Parser1:s,cea608Parser2:o,lastSn:a}=this,{cc:l,sn:A}=t.frag,c=(n=(i=t.part)==null?void 0:i.index)!=null?n:-1;s&&o&&(A!==a+1||A===a&&c!==this.lastPartIndex+1||l!==this.lastCc)&&(s.reset(),o.reset()),this.lastCc=l,this.lastSn=A,this.lastPartIndex=c}}onFragLoaded(e,t){const{frag:n,payload:i}=t;if(n.type===Ee.SUBTITLE)if(i.byteLength){const s=n.decryptdata,o="stats"in t;if(s==null||!s.encrypted||o){const a=this.tracks[n.level],l=this.vttCCs;l[n.cc]||(l[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),a&&a.textCodec===Oa?this._parseIMSC1(n,i):this._parseVTTs(t)}}else this.hls.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;Ah(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),n.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{U.log(`Failed to parse IMSC1: ${i}`),n.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:n,payload:i}=e,{initPTS:s,unparsedVttFrags:o}=this,a=s.length-1;if(!s[n.cc]&&a===-1){o.push(e);return}const l=this.hls,A=(t=n.initSegment)!=null&&t.data?$t(n.initSegment.data,new Uint8Array(i)):i;VI(A,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,c=>{this._appendCues(c,n.level),l.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},c=>{const u=c.message==="Missing initPTS for VTT MPEGTS";u?o.push(e):this._fallbackToIMSC1(n,i),U.log(`Failed to parse VTT cue: ${c}`),!(u&&a>n.cc)&&l.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:c})})}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||Ah(t,this.initPTS[e.cc],()=>{n.textCodec=Oa,this._parseIMSC1(e,t)},()=>{n.textCodec="wvtt"})}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(s=>su(i,s))}else{const i=this.tracks[t];if(!i)return;const s=i.default?"default":"subtitles"+t;n.trigger(I.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===Ee.SUBTITLE&&this.onFragLoaded(I.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:n,cea608Parser2:i}=this;if(!this.enabled||!n||!i)return;const{frag:s,samples:o}=t;if(!(s.type===Ee.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let a=0;a<o.length;a++){const l=o[a].bytes;if(l){const A=this.extractCea608Data(l);n.addData(o[a].pts,A[0]),i.addData(o[a].pts,A[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:i,type:s}){const{media:o}=this;if(!(!o||o.currentTime<n)){if(!s||s==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(l=>ua(a[l],t,n))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(l=>ua(a[l],t,i))}}}extractCea608Data(e){const t=[[],[]],n=e[0]&31;let i=2;for(let s=0;s<n;s++){const o=e[i++],a=127&e[i++],l=127&e[i++];if(a===0&&l===0)continue;if((4&o)!==0){const c=3&o;(c===0||c===1)&&(t[c].push(a),t[c].push(l))}}return t}}function dh(r){return r.characteristics&&/transcribes-spoken-dialog/gi.test(r.characteristics)&&/describes-music-and-sound/gi.test(r.characteristics)?"captions":"subtitles"}function fh(r,e){return!!r&&r.kind===dh(e)&&_a(e,r)}function zI(r,e,t,n){return Math.min(e,n)-Math.max(r,t)}function gh(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class $a{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(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.BUFFER_CODECS,this.onBufferCodecs,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.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 n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&he(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,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&U.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,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 n=t.filter((i,s)=>this.isLevelAllowed(i)&&s<=e);return this.clientRect=null,$a.getMaxLevelByMediaSize(n,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 n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.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(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;const i=(a,l)=>l?a.width!==l.width||a.height!==l.height:!0;let s=e.length-1;const o=Math.max(t,n);for(let a=0;a<e.length;a+=1){const l=e[a];if((l.width>=o||l.height>=o)&&i(l,e[a+1])){s=a;break}}return s}}class ZI{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(I.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const n=this.hls.config;if(n.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,n){const i=performance.now();if(t){if(this.lastTime){const s=i-this.lastTime,o=n-this.lastDroppedFrames,a=t-this.lastDecodedFrames,l=1e3*o/s,A=this.hls;if(A.trigger(I.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:n}),l>0&&o>A.config.fpsDroppedMonitoringThreshold*a){let c=A.currentLevel;U.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(A.autoLevelCapping===-1||A.autoLevelCapping>=c)&&(c=c-1,A.trigger(I.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:A.currentLevel}),A.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,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 Ps="[eme]";class Rn{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=Rn.CDMCleanupPromise?[Rn.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=U.debug.bind(U,Ps),this.log=U.log.bind(U,Ps),this.warn=U.warn.bind(U,Ps),this.error=U.error.bind(U,Ps),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(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(I.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:n}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===Je.WIDEVINE&&n)return n;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,n=t[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(o,a,l)=>!!o&&l.indexOf(o)===a,i=t.map(o=>o.audioCodec).filter(n),s=t.map(o=>o.videoCodec).filter(n);return i.length+s.length===0&&s.push("avc1.42e01e"),new Promise((o,a)=>{const l=A=>{const c=A.shift();this.getMediaKeysPromise(c,i,s).then(u=>o({keySystem:c,mediaKeys:u})).catch(u=>{A.length?l(A):u instanceof Vt?a(u):a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_ACCESS,error:u,fatal:!0},u.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${n}`;return Sc===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return n(e,t)}getMediaKeysPromise(e,t,n){const i=om(e,t,n,this.config.drmSystemOptions),s=this.keySystemAccessPromises[e];let o=s==null?void 0:s.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(i)}`),o=this.requestMediaKeySystemAccess(e,i);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),o.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);const A=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=l.createMediaKeys().then(c=>(this.log(`Media-keys created for "${e}"`),A.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(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${ar.hexDump(e.keyId||[])}`);const i=n.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),s="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(n,s,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 ar.hexDump(e.keyId)}updateKeySession(e,t){var n;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${ar.hexDump(((n=e.decryptdata)==null?void 0:n.keyId)||[])}
2488
- } (data length: ${t&&t.byteLength})`),i.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,n)=>{const i=ta(this.config),s=e.map(bc).filter(o=>!!o&&i.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(s).then(({keySystem:o})=>{const a=wc(o);a?t(a):n(new Error(`Unable to find format for key-system "${o}"`))}).catch(n)})}loadKey(e){const t=e.keyInfo.decryptdata,n=this.getKeyIdString(t),i=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let s=this.keyIdToKeySessionPromise[n];return s||(s=this.keyIdToKeySessionPromise[n]=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 ${i}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const l=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t});return this.generateRequestWithPreferredKeySession(l,"cenc",t.pssh,"playlist-key")}))),s.catch(o=>this.handleError(o))),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Vt?this.hls.trigger(I.ERROR,e.data):this.hls.trigger(I.ERROR,{type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),n=this.keyIdToKeySessionPromise[t];if(!n){const i=bc(e.keyFormat),s=i?[i]:ta(this.config);return this.attemptKeySystemAccess(s)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=ta(this.config)),e.length===0)throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.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:n}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),n===null)return;let i,s;if(t==="sinf"&&this.config.drmSystems[Je.FAIRPLAY]){const c=ct(new Uint8Array(n));try{const u=Zo(JSON.parse(c).sinf),h=Pc(new Uint8Array(u));if(!h)return;i=h.subarray(8,24),s=Je.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=Dm(n);if(c===null)return;c.version===0&&c.systemId===xc.WIDEVINE&&c.data&&(i=c.data.subarray(8,24)),s=sm(c.systemId)}if(!s||!i)return;const o=ar.hexDump(i),{keyIdToKeySessionPromise:a,mediaKeySessions:l}=this;let A=a[o];for(let c=0;c<l.length;c++){const u=l[c],h=u.decryptdata;if(h.pssh||!h.keyId)continue;const d=ar.hexDump(h.keyId);if(o===d||h.uri.replace(/-/g,"").indexOf(o)!==-1){A=a[d],delete a[d],h.pssh=new Uint8Array(n),h.keyId=i,A=a[o]=A.then(()=>this.generateRequestWithPreferredKeySession(u,t,n,"encrypted-event-key-match"));break}}A||(A=a[o]=this.getKeySystemSelectionPromise([s]).then(({keySystem:c,mediaKeys:u})=>{var h;this.throwIfDestroyed();const d=new hi("ISO-23001-7",o,(h=wc(c))!=null?h:"");return d.pssh=new Uint8Array(n),d.keyId=i,this.attemptSetMediaKeys(c,u).then(()=>{this.throwIfDestroyed();const f=this.createMediaKeySessionContext({decryptdata:d,keySystem:c,mediaKeys:u});return this.generateRequestWithPreferredKeySession(f,t,n,"encrypted-event-no-match")})})),A.catch(c=>this.handleError(c))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(n).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>n.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,n,i){var s,o;const a=(s=this.config.drmSystems)==null||(o=s[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const f=a.call(this.hls,t,n,e);if(!f)throw new Error("Invalid response from configured generateRequest filter");t=f.initDataType,n=e.decryptdata.pssh=f.initData?new Uint8Array(f.initData):null}catch(f){var l;if(this.warn(f.message),(l=this.hls)!=null&&l.config.debug)throw f}if(n===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const A=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${A} (init data type: ${t} length: ${n?n.byteLength:null})`);const c=new Da,u=e._onmessage=f=>{const g=e.mediaKeysSession;if(!g){c.emit("error",new Error("invalid state"));return}const{messageType:p,message:C}=f;this.log(`"${p}" message event for session "${g.sessionId}" message size: ${C.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,C).catch(Q=>{this.handleError(Q),c.emit("error",Q)}):p==="license-release"?e.keySystem===Je.FAIRPLAY&&(this.updateKeySession(e,ea("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${p}"`)},h=e._onkeystatuseschange=f=>{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 ${A}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",h);const d=new Promise((f,g)=>{c.on("error",g),c.on("keyStatus",p=>{p.startsWith("usable")?f():p==="output-restricted"?g(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?g(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${p}"`)):p==="expired"?g(new Error("key expired while generating request")):this.warn(`unhandled key status change "${p}"`)})});return e.mediaKeysSession.generateRequest(t,n).then(()=>{var f;this.log(`Request generated for key-session "${(f=e.mediaKeysSession)==null?void 0:f.sessionId}" keyId: ${A}`)}).catch(f=>{throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_NO_SESSION,error:f,fatal:!1},`Error generating key-session request: ${f}`)}).then(()=>d).catch(f=>{throw c.removeAllListeners(),this.removeSession(e),f}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,n)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${ar.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))} session keyId: ${ar.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,n=t.loader,i=new n(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const l={responseType:"arraybuffer",url:s},A=t.certLoadPolicy.default,c={loadPolicy:A,timeout:A.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(h,d,f,g)=>{o(h.data)},onError:(h,d,f,g)=>{a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:ht({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${s}). Status: ${h.code} (${h.text})`))},onTimeout:(h,d,f)=>{a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(h,d,f)=>{a(new Error("aborted"))}};i.load(l,c,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((i,s)=>{e.setServerCertificate(n).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${n==null?void 0:n.byteLength}) on "${t}"`),i(e)}).catch(o=>{s(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(i=>{throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:i,fatal:!0},i.message)}))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(n,"application/xml"),s=i.querySelectorAll("HttpHeader");if(s.length>0){let c;for(let u=0,h=s.length;u<h;u++){var o,a;c=s[u];const d=(o=c.querySelector("name"))==null?void 0:o.textContent,f=(a=c.querySelector("value"))==null?void 0:a.textContent;d&&f&&e.setRequestHeader(d,f)}}const l=i.querySelector("Challenge"),A=l==null?void 0:l.textContent;if(!A)throw new Error("Cannot find <Challenge> in key message");return ea(atob(A))}setupLicenseXHR(e,t,n,i){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,n,i)}).catch(o=>{if(!n.decryptdata)throw o;return e.open("POST",t,!0),s.call(this.hls,e,t,n,i)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise((i,s)=>{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 s(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let l=a.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const A=this.config.licenseResponseCallback;if(A)try{l=A.call(this.hls,a,o,e)}catch(c){this.error(c)}i(l)}else{const l=n.errorRetry,A=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A||a.status>=400&&a.status<500)s(new Vt({type:Be.KEY_SYSTEM_ERROR,details:V.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=A-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} attempts left`),this.requestLicense(e,t).then(i,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:l,licenseChallenge:A})=>{e.keySystem==Je.PLAYREADY&&(A=this.unpackPlayReadyKeyMessage(l,A)),l.send(A)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,n.addEventListener("encrypted",this.onMediaEncrypted),n.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={},hi.clearKeyUriToKeyIdMap();const n=t.length;Rn.CDMCleanupPromise=Promise.all(t.map(i=>this.removeSession(i)).concat(e==null?void 0:e.setMediaKeys(null).catch(i=>{this.log(`Could not clear media keys: ${i}`)}))).then(()=>{n&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(i=>{this.log(`Could not close sessions and clear media keys: ${i}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const n=t.reduce((i,s)=>(i.indexOf(s.keyFormat)===-1&&i.push(s.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n}=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),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),t.remove().catch(s=>{this.log(`Could not remove session: ${s}`)}).then(()=>t.close()).catch(s=>{this.log(`Could not close session: ${s}`)})}}}Rn.CDMCleanupPromise=void 0;class Vt 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 Qt;(function(r){r.MANIFEST="m",r.AUDIO="a",r.VIDEO="v",r.MUXED="av",r.INIT="i",r.CAPTION="c",r.TIMED_TEXT="tt",r.KEY="k",r.OTHER="o"})(Qt||(Qt={}));var Ya;(function(r){r.DASH="d",r.HLS="h",r.SMOOTH="s",r.OTHER="o"})(Ya||(Ya={}));var rn;(function(r){r.OBJECT="CMCD-Object",r.REQUEST="CMCD-Request",r.SESSION="CMCD-Session",r.STATUS="CMCD-Status"})(rn||(rn={}));const ev={[rn.OBJECT]:["br","d","ot","tb"],[rn.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[rn.SESSION]:["cid","pr","sf","sid","st","v"],[rn.STATUS]:["bs","rtp"]};class Dn{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(n=>n instanceof Dn?n:new Dn(n))),this.value=e,this.params=t}}class ph{constructor(e){this.description=void 0,this.description=e}}const tv="Dict";function rv(r){return Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":typeof r=="object"?JSON.stringify(r):String(r)}function nv(r,e,t,n){return new Error(`failed to ${r} "${rv(e)}" as ${t}`,{cause:n})}const mh="Bare Item",iv="Boolean",sv="Byte Sequence",ov="Decimal",av="Integer";function lv(r){return r<-999999999999999||999999999999999<r}const Av=/[\x00-\x1f\x7f]+/,cv="Token",uv="Key";function hr(r,e,t){return nv("serialize",r,e,t)}function hv(r){if(typeof r!="boolean")throw hr(r,iv);return r?"?1":"?0"}function dv(r){return btoa(String.fromCharCode(...r))}function fv(r){if(ArrayBuffer.isView(r)===!1)throw hr(r,sv);return`:${dv(r)}:`}function Eh(r){if(lv(r))throw hr(r,av);return r.toString()}function gv(r){return`@${Eh(r.getTime()/1e3)}`}function Ih(r,e){if(r<0)return-Ih(-r,e);const t=Math.pow(10,e);if(Math.abs(r*t%1-.5)<Number.EPSILON){const i=Math.floor(r*t);return(i%2===0?i:i+1)/t}else return Math.round(r*t)/t}function pv(r){const e=Ih(r,3);if(Math.floor(Math.abs(e)).toString().length>12)throw hr(r,ov);const t=e.toString();return t.includes(".")?t:`${t}.0`}const mv="String";function Ev(r){if(Av.test(r))throw hr(r,mv);return`"${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Iv(r){return r.description||r.toString().slice(7,-1)}function vh(r){const e=Iv(r);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw hr(e,cv);return e}function Va(r){switch(typeof r){case"number":if(!he(r))throw hr(r,mh);return Number.isInteger(r)?Eh(r):pv(r);case"string":return Ev(r);case"symbol":return vh(r);case"boolean":return hv(r);case"object":if(r instanceof Date)return gv(r);if(r instanceof Uint8Array)return fv(r);if(r instanceof ph)return vh(r);default:throw hr(r,mh)}}function Ka(r){if(/^[a-z*][a-z0-9\-_.*]*$/.test(r)===!1)throw hr(r,uv);return r}function Ja(r){return r==null?"":Object.entries(r).map(([e,t])=>t===!0?`;${Ka(e)}`:`;${Ka(e)}=${Va(t)}`).join("")}function Ch(r){return r instanceof Dn?`${Va(r.value)}${Ja(r.params)}`:Va(r)}function vv(r){return`(${r.value.map(Ch).join(" ")})${Ja(r.params)}`}function Cv(r,e={whitespace:!0}){if(typeof r!="object")throw hr(r,tv);const t=r instanceof Map?r.entries():Object.entries(r),n=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,s])=>{s instanceof Dn||(s=new Dn(s));let o=Ka(i);return s.value===!0?o+=Ja(s.params):(o+="=",Array.isArray(s.value)?o+=vv(s):o+=Ch(s)),o}).join(`,${n}`)}function yv(r,e){return Cv(r,e)}const Bv=r=>r==="ot"||r==="sf"||r==="st",Tv=r=>typeof r=="number"?he(r):r!=null&&r!==""&&r!==!1;function Qv(r,e){const t=new URL(r),n=new URL(e);if(t.origin!==n.origin)return r;const i=t.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);for(;i[0]===s[0];)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")}function bv(){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,i=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?s:s&3|8).toString(16)})}}}const Os=r=>Math.round(r),xv=(r,e)=>(e!=null&&e.baseUrl&&(r=Qv(r,e.baseUrl)),encodeURIComponent(r)),Us=r=>Os(r/100)*100,wv={br:Os,d:Os,bl:Us,dl:Us,mtp:Us,nor:xv,rtp:Us,tb:Os};function Sv(r,e){const t={};if(r==null||typeof r!="object")return t;const n=Object.keys(r).sort(),i=it({},wv,e==null?void 0:e.formatters),s=e==null?void 0:e.filter;return n.forEach(o=>{if(s!=null&&s(o))return;let a=r[o];const l=i[o];l&&(a=l(a,e)),!(o==="v"&&a===1)&&(o=="pr"&&a===1||Tv(a)&&(Bv(o)&&typeof a=="string"&&(a=new ph(a)),t[o]=a))}),t}function yh(r,e={}){return r?yv(Sv(r,e),it({whitespace:!1},e)):""}function Rv(r,e={}){if(!r)return{};const t=Object.entries(r),n=Object.entries(ev).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),i=t.reduce((s,o)=>{var a,l;const[A,c]=o,u=((a=n.find(h=>h[1].includes(A)))==null?void 0:a[0])||rn.REQUEST;return(l=s[u])!=null||(s[u]={}),s[u][A]=c,s},{});return Object.entries(i).reduce((s,[o,a])=>(s[o]=yh(a,e),s),{})}function Dv(r,e,t){return it(r,Rv(e,t))}const _v="CMCD";function Lv(r,e={}){if(!r)return"";const t=yh(r,e);return`${_v}=${encodeURIComponent(t)}`}const Bh=/CMCD=[^&#]+/;function Fv(r,e,t){const n=Lv(e,t);if(!n)return r;if(Bh.test(r))return r.replace(Bh,n);const i=r.includes("?")?"&":"?";return`${r}${i}${n}`}class kv{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=i=>{try{this.apply(i,{ot:Qt.MANIFEST,su:!this.initialized})}catch(s){U.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=i=>{try{const s=i.frag,o=this.hls.levels[s.level],a=this.getObjectType(s),l={d:s.duration*1e3,ot:a};(a===Qt.VIDEO||a===Qt.AUDIO||a==Qt.MUXED)&&(l.br=o.bitrate/1e3,l.tb=this.getTopBandwidth(a)/1e3,l.bl=this.getBufferLength(a)),this.apply(i,l)}catch(s){U.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||bv(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHED,this.onMediaDetached,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHED,this.onMediaDetached,this),e.off(I.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 n,i;this.audioBuffer=(n=t.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:Ya.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){it(t,this.createData());const n=t.ot===Qt.INIT||t.ot===Qt.VIDEO||t.ot===Qt.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((s,o)=>(i.includes(o)&&(s[o]=t[o]),s),{})),this.useHeaders?(e.headers||(e.headers={}),Dv(e.headers,t)):e.url=Fv(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Qt.TIMED_TEXT;if(e.sn==="initSegment")return Qt.INIT;if(t==="audio")return Qt.AUDIO;if(t==="main")return this.hls.audioTracks.length?Qt.VIDEO:Qt.MUXED}getTopBandwidth(e){let t=0,n;const i=this.hls;if(e===Qt.AUDIO)n=i.audioTracks;else{const s=i.maxAutoLevel,o=s>-1?s+1:i.levels.length;n=i.levels.slice(0,o)}for(const s of n)s.bitrate>t&&(t=s.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,n=e===Qt.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:Ke.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,o,a){t(s),this.loader.load(s,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,o,a){t(s),this.loader.load(s,o,a)}}}}const Nv=3e5;class Mv{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=U.log.bind(U,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.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(n=>n!==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:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if((n==null?void 0:n.action)===Bt.SendAlternateToPenaltyBox&&n.flags===Zt.MoveAllAlternatesMatchingHost){const i=this.levels;let s=this.pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:l,type:A}=t.context;a&&i?o=this.getPathwayForGroupId(a,A,o):l&&(o=l)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!s&&i&&(s=i.reduce((a,l)=>(a.indexOf(l.pathwayId)===-1&&a.push(l.pathwayId),a),[])),s&&s.length>1&&(this.updatePathwayPriority(s),n.resolved=this.pathwayId!==o),n.resolved||U.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${i&&i.length} priorities: ${JSON.stringify(s)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}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 n=this.penalizedPathways,i=performance.now();Object.keys(n).forEach(s=>{i-n[s]>Nv&&delete n[s]});for(let s=0;s<e.length;s++){const o=e[s];if(o in n)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,l=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,fu(t),this.hls.trigger(I.LEVELS_UPDATED,{levels:t});const A=this.hls.levels[a];l&&A&&this.levels&&(A.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&A.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${A.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,n){const i=this.getLevelsForPathway(n).concat(this.levels||[]);for(let s=0;s<i.length;s++)if(t===Oe.AUDIO_TRACK&&i[s].hasAudioGroup(e)||t===Oe.SUBTITLE_TRACK&&i[s].hasSubtitleGroup(e))return i[s].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},i={};e.forEach(s=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":l}=s;if(t.some(c=>c.pathwayId===o))return;const A=this.getLevelsForPathway(a).map(c=>{const u=new Xe(c.attrs);u["PATHWAY-ID"]=o;const h=u.AUDIO&&`${u.AUDIO}_clone_${o}`,d=u.SUBTITLES&&`${u.SUBTITLES}_clone_${o}`;h&&(n[u.AUDIO]=h,u.AUDIO=h),d&&(i[u.SUBTITLES]=d,u.SUBTITLES=d);const f=Qh(c.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),g=new yn({attrs:u,audioCodec:c.audioCodec,bitrate:c.bitrate,height:c.height,name:c.name,url:f,videoCodec:c.videoCodec,width:c.width});if(c.audioGroups)for(let p=1;p<c.audioGroups.length;p++)g.addGroupId("audio",`${c.audioGroups[p]}_clone_${o}`);if(c.subtitleGroups)for(let p=1;p<c.subtitleGroups.length;p++)g.addGroupId("text",`${c.subtitleGroups[p]}_clone_${o}`);return g});t.push(...A),Th(this.audioTracks,n,l,o),Th(this.subtitleTracks,i,l,o)})}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+c)}const s={responseType:"json",url:i.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},A={onSuccess:(c,u,h,d)=>{this.log(`Loaded steering manifest: "${i}"`);const f=c.data;if(f.VERSION!==1){this.log(`Steering VERSION ${f.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=f.TTL;const{"RELOAD-URI":g,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":C}=f;if(g)try{this.uri=new self.URL(g,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${g}`);return}this.scheduleRefresh(this.uri||h.url),p&&this.clonePathways(p);const Q={steeringManifest:f,url:i.toString()};this.hls.trigger(I.STEERING_MANIFEST_LOADED,Q),C&&this.updatePathwayPriority(C)},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 f=this.timeToLoad*1e3;if(c.code===429){const g=this.loader;if(typeof(g==null?void 0:g.getResponseHeader)=="function"){const p=g.getResponseHeader("Retry-After");p&&(f=parseFloat(p)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,f)},onTimeout:(c,u,h)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(s,l,A)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const i=(n=this.hls)==null?void 0:n.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Th(r,e,t,n){r&&Object.keys(e).forEach(i=>{const s=r.filter(o=>o.groupId===i).map(o=>{const a=it({},o);return a.details=void 0,a.attrs=new Xe(a.attrs),a.url=a.attrs.URI=Qh(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[i],a.attrs["PATHWAY-ID"]=n,a});r.push(...s)})}function Qh(r,e,t,n){const{HOST:i,PARAMS:s,[t]:o}=n;let a;e&&(a=o==null?void 0:o[e],a&&(r=a));const l=new self.URL(r);return i&&!a&&(l.host=i),s&&Object.keys(s).sort().forEach(A=>{A&&l.searchParams.set(A,s[A])}),l.href}const Pv=/^age:\s*[\d.]+\s*$/im;class bh{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 cs,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,n){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=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return s(n,t.url)}).catch(o=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",t.url,!0),s(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(o=>{this.callbacks.onError({code:n.status,text:o.message},t,n,i)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:o}=n.loadPolicy;if(i)for(const a in i)e.setRequestHeader(a,i[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),n.timeout=s&&he(s)?s:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const i=t.readyState,s=this.config;if(!n.aborted&&i>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),i===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)){n.loading.end=Math.max(self.performance.now(),n.loading.first);const l=a?t.response:t.responseText,A=t.responseType==="arraybuffer"?l.byteLength:l.length;if(n.loaded=n.total=A,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first),!this.callbacks)return;const c=this.callbacks.onProgress;if(c&&c(n,e,l,t),!this.callbacks)return;const u={url:t.responseURL,data:l,code:o};this.callbacks.onSuccess(u,n,e,t)}else{const l=s.loadPolicy.errorRetry,A=n.retry,c={url:e.url,data:void 0,code:o};Bs(l,A,!1,c)?this.retry(l):(U.error(`${o} while loading ${e.url}`),this.callbacks.onError({code:o,text:t.statusText},e,t,n))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Bs(e,t,!0))this.retry(e);else{var n;U.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=ma(e,n.retry),n.retry++,U.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${n.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&&Pv.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 Ov(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const Uv=/(\d+)-(\d+)\/(\d+)/;class xh{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||Yv,this.controller=new self.AbortController,this.stats=new cs}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,n){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const s=Gv(e,this.controller.signal),o=n.onProgress,a=e.responseType==="arraybuffer",l=a?"byteLength":"length",{maxTimeToFirstByteMs:A,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=A&&he(A)?A:c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(i,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const h=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(i,e,this.response)},c-(h-i.loading.start)),!u.ok){const{status:d,statusText:f}=u;throw new Vv(f||"fetch, bad network response",d,u)}return i.loading.first=h,i.total=$v(u.headers)||i.total,o&&he(t.highWaterMark)?this.loadProgressively(u,i,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),i.loading.end=Math.max(self.performance.now(),i.loading.first);const d=u[l];d&&(i.loaded=i.total=d);const f={url:h.url,data:u,code:h.status};o&&!he(t.highWaterMark)&&o(i,e,u,h),n.onSuccess(f,i,e,h)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const h=u&&u.code||0,d=u?u.message:null;n.onError({code:h,text:d},e,u?u.details:null,i)})}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,n,i=0,s){const o=new bu,a=e.body.getReader(),l=()=>a.read().then(A=>{if(A.done)return o.dataLength&&s(t,n,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const c=A.value,u=c.length;return t.loaded+=u,u<i||o.dataLength?(o.push(c),o.dataLength>=i&&s(t,n,o.flush(),e)):s(t,n,c,e),l()}).catch(()=>Promise.reject());return l()}}function Gv(r,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(it({},r.headers))};return r.rangeEnd&&t.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),t}function Hv(r){const e=Uv.exec(r);if(e)return parseInt(e[2])-parseInt(e[1])+1}function $v(r){const e=r.get("Content-Range");if(e){const n=Hv(e);if(he(n))return n}const t=r.get("Content-Length");if(t)return parseInt(t)}function Yv(r,e){return new self.Request(r.url,e)}class Vv extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const Kv=/\s/,Jv={newCue(r,e,t,n){const i=[];let s,o,a,l,A;const c=self.VTTCue||self.TextTrackCue;for(let h=0;h<n.rows.length;h++)if(s=n.rows[h],a=!0,l=0,A="",!s.isEmpty()){var u;for(let g=0;g<s.chars.length;g++)Kv.test(s.chars[g].uchar)&&a?l++:(A+=s.chars[g].uchar,a=!1);s.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const d=oh(A.trim()),f=Pa(e,t,d);r!=null&&(u=r.cues)!=null&&u.getCueById(f)||(o=new c(e,t,d),o.id=f,o.line=h+1,o.align="left",o.position=10+Math.min(80,Math.floor(l*8/32)*10),i.push(o))}return r&&i.length&&(i.sort((h,d)=>h.line==="auto"||d.line==="auto"?0:h.line>8&&d.line>8?d.line-h.line:h.line-d.line),i.forEach(h=>su(r,h))),i}},Wv={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},wh=ht(ht({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:bh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:CE,bufferController:QI,capLevelController:$a,errorController:AE,fpsController:ZI,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:Sc,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:Wv},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},qv()),{},{subtitleStreamController:CI,subtitleTrackController:BI,timelineController:jI,audioStreamController:II,audioTrackController:vI,emeController:Rn,cmcdController:kv,contentSteeringController:Mv});function qv(){return{cueHandler:Jv,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 Xv(r,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=Wa(r),n=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(s=>{const o=`${s==="level"?"playlist":s}LoadPolicy`,a=e[o]===void 0,l=[];i.forEach(A=>{const c=`${s}Loading${A}`,u=e[c];if(u!==void 0&&a){l.push(c);const h=t[o].default;switch(e[o]={default:h},A){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}}}),l.length&&U.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),ht(ht({},t),e)}function Wa(r){return r&&typeof r=="object"?Array.isArray(r)?r.map(Wa):Object.keys(r).reduce((e,t)=>(e[t]=Wa(r[t]),e),{}):r}function jv(r){const e=r.loader;e!==xh&&e!==bh?(U.log("[config]: Custom loader detected, cannot enable progressive streaming"),r.progressive=!1):Ov()&&(r.loader=xh,r.progressive=!0,r.enableSoftwareAES=!0,U.log("[config]: Progressive streaming enabled, using FetchLoader"))}let qa;class zv extends Ia{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.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 n=this.hls.config.preferManagedMediaSource,i=[],s={},o={};let a=!1,l=!1,A=!1;t.levels.forEach(c=>{var u,h;const d=c.attrs;let{audioCodec:f,videoCodec:g}=c;((u=f)==null?void 0:u.indexOf("mp4a.40.34"))!==-1&&(qa||(qa=/chrome|firefox/i.test(navigator.userAgent)),qa&&(c.audioCodec=f=void 0)),f&&(c.audioCodec=f=ms(f,n)),((h=g)==null?void 0:h.indexOf("avc1"))===0&&(g=c.videoCodec=Pm(g));const{width:p,height:C,unknownCodecs:Q}=c;if(a||(a=!!(p&&C)),l||(l=!!g),A||(A=!!f),Q!=null&&Q.length||f&&!la(f,"audio",n)||g&&!la(g,"video",n))return;const{CODECS:b,"FRAME-RATE":y,"HDCP-LEVEL":w,"PATHWAY-ID":R,RESOLUTION:k,"VIDEO-RANGE":$}=d,O=`${`${R||"."}-`}${c.bitrate}-${k}-${y}-${b}-${$}-${w}`;if(s[O])if(s[O].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const J=o[O]+=1;c.attrs["PATHWAY-ID"]=new Array(J+1).join(".");const ie=new yn(c);s[O]=ie,i.push(ie)}else s[O].addGroupId("audio",d.AUDIO),s[O].addGroupId("text",d.SUBTITLES);else{const J=new yn(c);s[O]=J,o[O]=1,i.push(J)}}),this.filterAndSortMediaOptions(i,t,a,l,A)}filterAndSortMediaOptions(e,t,n,i,s){let o=[],a=[],l=e;if((n||i)&&s&&(l=l.filter(({videoCodec:f,videoRange:g,width:p,height:C})=>(!!f||!!(p&&C))&&jm(g))),l.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 f=new Error("no level with compatible codecs found in manifest");this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:f,reason:f.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:f}=this.hls.config;o=t.audioTracks.filter(g=>!g.audioCodec||la(g.audioCodec,"audio",f)),Sh(o)}t.subtitles&&(a=t.subtitles,Sh(a));const A=l.slice(0);l.sort((f,g)=>{if(f.attrs["HDCP-LEVEL"]!==g.attrs["HDCP-LEVEL"])return(f.attrs["HDCP-LEVEL"]||"")>(g.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&f.height!==g.height)return f.height-g.height;if(f.frameRate!==g.frameRate)return f.frameRate-g.frameRate;if(f.videoRange!==g.videoRange)return vs.indexOf(f.videoRange)-vs.indexOf(g.videoRange);if(f.videoCodec!==g.videoCodec){const p=Kc(f.videoCodec),C=Kc(g.videoCodec);if(p!==C)return C-p}if(f.uri===g.uri&&f.codecSet!==g.codecSet){const p=ps(f.codecSet),C=ps(g.codecSet);if(p!==C)return C-p}return f.averageBitrate!==g.averageBitrate?f.averageBitrate-g.averageBitrate:0});let c=A[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==A.length)){for(let f=0;f<A.length;f++)if(A[f].pathwayId===l[0].pathwayId){c=A[f];break}}this._levels=l;for(let f=0;f<l.length;f++)if(l[f]===c){var u;this._firstLevel=f;const g=c.bitrate,p=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${g}`),((u=this.hls.userConfig)==null?void 0:u.abrEwmaDefaultEstimate)===void 0){const C=Math.min(g,this.hls.config.abrEwmaDefaultEstimateMax);C>p&&p===wh.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=C)}break}const h=s&&!i,d={levels:l,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:i,altAudio:!h&&o.some(f=>!!f.url)};this.hls.trigger(I.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(I.ERROR,{type:Be.OTHER_ERROR,details:V.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:c,reason:c.message}),u)return;e=Math.min(e,t.length-1)}const n=this.currentLevelIndex,i=this.currentLevel,s=i?i.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,n===e&&o.details&&i&&s===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 ${n}${s?" with Pathway "+s:""}`);const l={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(I.LEVEL_SWITCHING,l);const A=o.details;if(!A||A.live){const c=this.switchParams(o.uri,i==null?void 0:i.details,A);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===Oe.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===Ee.MAIN){const n=t.elementaryStreams;if(!Object.keys(n).some(s=>!!n[s]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var n;const{level:i,details:s}=t,o=this._levels[i];if(!o){var a;this.warn(`Invalid level index ${i}`),(a=t.deliveryDirectives)!=null&&a.skip&&(s.deltaUpdateFailed=!0);return}i===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(i,t,o.details)):(n=t.deliveryDirectives)!=null&&n.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,n=this.currentLevel;if(n&&this.shouldLoadPlaylist(n)){let i=n.uri;if(e)try{i=e.addDirectives(i)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}const s=n.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${s?" Pathway "+s:""} ${i}`),this.clearTimer(),this.hls.trigger(I.LEVEL_LOADING,{url:i,level:t,pathwayId:n.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 n=this._levels.filter((i,s)=>s!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(o=>o.level=-1)),!1));fu(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(I.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(I.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function Sh(r){const e={};r.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}class Zv{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[n].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.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=V.KEY_LOAD_ERROR,n,i,s){return new Qr({type:Be.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:n,networkDetails:i})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:n,cc:i}=e;for(let s=0;s<t.length;s++){const o=t[s];if(i<=o.cc&&(n==="initSegment"||o.sn==="initSegment"||n<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 n,i;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const A=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,V.KEY_LOAD_ERROR,A))}const o=s.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,V.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((n=a)!=null&&n.decryptdata.key)return s.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((i=a)!=null&&i.keyLoadPromise){var l;switch((l=a.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(A=>(s.key=A.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.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,V.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(n);if(i)return(e.keyLoadPromise=i.then(s=>(e.mediaKeySessionContext=s,n))).catch(s=>{throw e.keyLoadPromise=null,s})}return Promise.resolve(n)}loadKeyHTTP(e,t){const n=this.config,i=n.loader,s=new i(n);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((o,a)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},A=n.keyLoadPolicy.default,c={loadPolicy:A,timeout:A.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(h,d,f,g)=>{const{frag:p,keyInfo:C,url:Q}=f;if(!p.decryptdata||C!==this.keyUriToKeyInfo[Q])return a(this.createKeyLoadError(p,V.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),g));C.decryptdata.key=p.decryptdata.key=new Uint8Array(h.data),p.keyLoader=null,C.loader=null,o({frag:p,keyInfo:C})},onError:(h,d,f,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,V.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),f,ht({url:l.url,data:void 0},h)))},onTimeout:(h,d,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,V.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),f))},onAbort:(h,d,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,V.INTERNAL_ABORTED,new Error("key loading aborted"),f))}};s.load(l,c,u)})}resetLoader(e){const{frag:t,keyInfo:n,url:i}=e,s=n.loader;t.keyLoader===s&&(t.keyLoader=null,n.loader=null),delete this.keyUriToKeyInfo[i],s&&s.destroy()}}function Rh(){return self.SourceBuffer||self.WebKitSourceBuffer}function Dh(){if(!en())return!1;const e=Rh();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function eC(){if(!Dh())return!1;const r=en();return typeof(r==null?void 0:r.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>r.isTypeSupported(di(e,"video")))||["mp4a.40.2","fLaC"].some(e=>r.isTypeSupported(di(e,"audio"))))}function tC(){var r;const e=Rh();return typeof(e==null||(r=e.prototype)==null?void 0:r.changeType)=="function"}const rC=250,Gs=2,nC=.1,iC=.05;class sC{constructor(e,t,n,i){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=n,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:n,media:i,stalled:s}=this;if(i===null)return;const{currentTime:o,seeking:a}=i,l=this.seeking&&!a,A=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),s!==null){if(this.stallReported){const p=self.performance.now()-s;U.warn(`playback not stuck anymore @${o}, after ${Math.round(p)}ms`),this.stallReported=!1}this.stalled=null}return}if(A||l){this.stalled=null;return}if(i.paused&&!a||i.ended||i.playbackRate===0||!Ke.getBuffered(i).length){this.nudgeRetry=0;return}const c=Ke.bufferInfo(i,o,0),u=c.nextStart||0;if(a){const p=c.len>Gs,C=!u||t&&t.start<=o||u-o>Gs&&!this.fragmentTracker.getPartialFragment(o);if(p||C)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var h;if(!(c.len>0)&&!u)return;const C=Math.max(u,c.start||0)-o,Q=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,y=(Q==null||(h=Q.details)==null?void 0:h.live)?Q.details.targetduration*2:Gs,w=this.fragmentTracker.getPartialFragment(o);if(C>0&&(C<=y||w)){i.paused||this._trySkipBufferHole(w);return}}const d=self.performance.now();if(s===null){this.stalled=d;return}const f=d-s;if(!a&&f>=rC&&(this._reportStall(c),!this.media))return;const g=Ke.bufferInfo(i,o,n.maxBufferHole);this._tryFixBufferStall(g,f)}_tryFixBufferStall(e,t){const{config:n,fragmentTracker:i,media:s}=this;if(s===null)return;const o=s.currentTime,a=i.getPartialFragment(o);a&&(this._trySkipBufferHole(a)||!this.media)||(e.len>n.maxBufferHole||e.nextStart&&e.nextStart-o<n.maxBufferHole)&&t>n.highBufferWatchdogPeriod*1e3&&(U.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:n,stallReported:i}=this;if(!i&&n){this.stallReported=!0;const s=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${JSON.stringify(e)})`);U.warn(s.message),t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:n,media:i}=this;if(i===null)return 0;const s=i.currentTime,o=Ke.bufferInfo(i,s,0),a=s<o.start?o.start:o.nextStart;if(a){const l=o.len<=t.maxBufferHole,A=o.len>0&&o.len<1&&i.readyState<3,c=a-s;if(c>0&&(l||A)){if(c>t.maxBufferHole){const{fragmentTracker:h}=this;let d=!1;if(s===0){const f=h.getAppendedFrag(0,Ee.MAIN);f&&a<f.end&&(d=!0)}if(!d){const f=e||h.getAppendedFrag(s,Ee.MAIN);if(f){let g=!1,p=f.end;for(;p<a;){const C=h.getPartialFragment(p);if(C)p+=C.duration;else{g=!0;break}}if(g)return 0}}}const u=Math.max(a+iC,s+nC);if(U.warn(`skipping hole, adjusting currentTime from ${s} to ${u}`),this.moved=!0,this.stalled=null,i.currentTime=u,e&&!e.gap){const h=new Error(`fragment loaded with buffer holes, seeking from ${s} to ${u}`);n.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:e})}return u}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:n,nudgeRetry:i}=this;if(n===null)return;const s=n.currentTime;if(this.nudgeRetry++,i<e.nudgeMaxRetry){const o=s+(i+1)*e.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${s} to ${o}`);U.warn(a.message),n.currentTime=o,t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const o=new Error(`Playhead still not moving while enough data buffered @${s} after ${e.nudgeMaxRetry} nudges`);U.error(o.message),t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:V.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const oC=100;class aC extends ya{constructor(e,t,n){super(e,t,n,"[stream-controller]",Ee.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(I.ERROR,this.onError,this),e.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this),e.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(I.ERROR,this.onError,this),e.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(I.BUFFER_CREATED,this.onBufferCreated,this),e.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:n}=this;if(this.stopLoad(),this.setInterval(oC),this.level=-1,!this.startFragRequested){let i=n.startLevel;i===-1&&(n.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=n.firstAutoLevel),n.nextLoadLevel=i,this.level=n.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=re.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=re.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case re.WAITING_LEVEL:{const{levels:t,level:n}=this,i=t==null?void 0:t[n],s=i==null?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(s))break;this.state=re.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=re.IDLE;break}break}case re.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),n=this.retryDate;if(!n||t>=n||(e=this.media)!=null&&e.seeking){const{levels:i,level:s}=this,o=i==null?void 0:i[s];this.resetStartWhenNotLoaded(o||null),this.state=re.IDLE}}break}this.state===re.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:n,media:i}=this;if(t===null||!i&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=e.nextLoadLevel;if(!(n!=null&&n[s]))return;const o=n[s],a=this.getMainFwdBufferInfo();if(a===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(a,l)){const g={};this.altAudio&&(g.type="video"),this.hls.trigger(I.BUFFER_EOS,g),this.state=re.ENDED;return}e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const A=o.details;if(!A||this.state===re.WAITING_LEVEL||A.live&&this.levelLastLoaded!==o){this.level=s,this.state=re.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,A);if(this.couldBacktrack&&!this.fragPrevious&&d&&d.sn!=="initSegment"&&this.fragmentTracker.getState(d)!==dt.OK){var f;const p=((f=this.backtrackFragment)!=null?f:d).sn-A.startSN,C=A.fragments[p-1];C&&d.cc===C.cc&&(d=C,this.fragmentTracker.removeFragment(C))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(d&&this.isLoopLoading(d,h)){if(!d.gap){const p=this.audioOnly&&!this.altAudio?He.AUDIO:He.VIDEO,C=(p===He.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;C&&this.afterBufferFlushed(C,p,Ee.MAIN)}d=this.getNextFragmentLoopLoading(d,A,a,Ee.MAIN,u)}d&&(d.initSegment&&!d.initSegment.data&&!this.bitrateTest&&(d=d.initSegment),this.loadFragment(d,o,h))}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===dt.NOT_LOADED||i===dt.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,n)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Ee.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let n;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const s=this.getLevelDetails();if(s!=null&&s.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<s.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,l=e[a],A=this.fragLastKbps;A&&this.fragCurrent?n=this.fragCurrent.duration*l.maxBitrate/(1e3*A)+1:n=0}else n=0;const o=this.getBufferedFrag(t.currentTime+n);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const l=a.maxStartPTS?a.maxStartPTS:a.start,A=a.duration,c=Math.max(o.end,l+Math.min(Math.max(A-this.config.maxFragLookUpTolerance,A*(this.couldBacktrack?.5:.125)),A*(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 re.KEY_LOADING:case re.FRAG_LOADING:case re.FRAG_LOADING_WAITING_RETRY:case re.PARSING:case re.PARSED:this.state=re.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 n=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener("playing",this.onvplaying),n.addEventListener("seeked",this.onvseeked),this.gapController=new sC(this.config,n,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;he(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const n=this.getMainFwdBufferInfo();if(n===null||n.len===0){this.warn(`Main forward buffer length on "seeked" event ${n?n.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(I.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 n=!1,i=!1;t.levels.forEach(s=>{const o=s.audioCodec;o&&(n=n||o.indexOf("mp4a.40.2")!==-1,i=i||o.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=n&&i&&!tC(),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:n}=this;if(!n||this.state!==re.IDLE)return;const i=n[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=re.WAITING_LEVEL)}onLevelLoaded(e,t){var n;const{levels:i}=this,s=t.level,o=t.details,a=o.totalduration;if(!i){this.warn(`Levels were reset while loading level ${s}`);return}this.log(`Level ${s} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const l=i[s],A=this.fragCurrent;A&&(this.state===re.FRAG_LOADING||this.state===re.FRAG_LOADING_WAITING_RETRY)&&A.level!==t.level&&A.loader&&this.abortCurrentFrag();let c=0;if(o.live||(n=l.details)!=null&&n.live){var u;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,l.details,(u=this.levelLastLoaded)==null?void 0:u.details)}if(l.details=o,this.levelLastLoaded=l,this.hls.trigger(I.LEVEL_UPDATED,{details:o,level:s}),this.state===re.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=re.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,c),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:n,part:i,payload:s}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const a=o[n.level],l=a.details;if(!l){this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),this.fragmentTracker.removeFragment(n);return}const A=a.videoCodec,c=l.PTSKnown||!l.live,u=(t=n.initSegment)==null?void 0:t.data,h=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new Wu(this.hls,Ee.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,g=f!==-1,p=new va(n.level,n.sn,n.stats.chunkCount,s.byteLength,f,g),C=this.initPTS[n.cc];d.push(s,u,h,A,n,i,l.totalduration,c,p,C)}onAudioTrackSwitching(e,t){const n=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 s=this.hls;n&&(s.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),s.trigger(I.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const n=t.id,i=!!this.hls.audioTracks[n].url;if(i){const s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=i,this.tick()}onBufferCreated(e,t){const n=t.tracks;let i,s,o=!1;for(const a in n){const l=n[a];if(l.id==="main"){if(s=a,i=l,a==="video"){const A=n[a];A&&(this.videoBuffer=A.buffer)}}else o=!0}o&&i?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n&&n.type!==Ee.MAIN)return;if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===re.PARSED&&(this.state=re.IDLE);return}const s=i?i.stats:n.stats;this.fragLastKbps=Math.round(8*s.total/(s.buffering.end-s.loading.first)),n.sn!=="initSegment"&&(this.fragPrevious=n),this.fragBufferedComplete(n,i)}onError(e,t){var n;if(t.fatal){this.state=re.ERROR;return}switch(t.details){case V.FRAG_GAP:case V.FRAG_PARSING_ERROR:case V.FRAG_DECRYPT_ERROR:case V.FRAG_LOAD_ERROR:case V.FRAG_LOAD_TIMEOUT:case V.KEY_LOAD_ERROR:case V.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.MAIN,t);break;case V.LEVEL_LOAD_ERROR:case V.LEVEL_LOAD_TIMEOUT:case V.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===re.WAITING_LEVEL&&((n=t.context)==null?void 0:n.type)===Oe.LEVEL&&(this.state=re.IDLE);break;case V.BUFFER_APPEND_ERROR:case V.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===V.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case V.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Ke.getBuffered(e).length){const n=this.state!==re.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,n)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=re.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==He.AUDIO||this.audioOnly&&!this.altAudio){const n=(t===He.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(n,t,Ee.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}const i=Ke.getBuffered(e),o=(i.length?i.start(0):0)-n;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),n+=o,this.startPosition=n),this.log(`seek to target start position ${n} from current time ${t}`),e.currentTime=n}}_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(n=>{const{hls:i}=this;if(!n||this.fragContextChanged(e))return;t.fragmentError=0,this.state=re.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const s=e.stats;s.parsing.start=s.parsing.end=s.buffering.start=s.buffering.end=self.performance.now(),i.trigger(I.FRAG_LOADED,n),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const n="main",{hls:i}=this,{remuxResult:s,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:A,level:c}=a,{video:u,text:h,id3:d,initSegment:f}=s,{details:g}=c,p=this.altAudio?void 0:s.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=re.PARSING,f){if(f!=null&&f.tracks){const b=l.initSegment||l;this._bufferInitSegment(c,f.tracks,b,o),i.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:b,id:n,tracks:f.tracks})}const C=f.initPTS,Q=f.timescale;he(C)&&(this.initPTS[l.cc]={baseTime:C,timescale:Q},i.trigger(I.INIT_PTS_FOUND,{frag:l,id:n,initPTS:C,timescale:Q}))}if(u&&g&&l.sn!=="initSegment"){const C=g.fragments[l.sn-1-g.startSN],Q=l.sn===g.startSN,b=!C||l.cc>C.cc;if(s.independent!==!1){const{startPTS:y,endPTS:w,startDTS:R,endDTS:k}=u;if(A)A.elementaryStreams[u.type]={startPTS:y,endPTS:w,startDTS:R,endDTS:k};else if(u.firstKeyFrame&&u.independent&&o.id===1&&!b&&(this.couldBacktrack=!0),u.dropped&&u.independent){const $=this.getMainFwdBufferInfo(),K=($?$.end:this.getLoadPosition())+this.config.maxBufferHole,O=u.firstKeyFramePTS?u.firstKeyFramePTS:y;if(!Q&&K<O-this.config.maxBufferHole&&!b){this.backtrack(l);return}else b&&(l.gap=!0);l.setElementaryStreamInfo(u.type,l.start,w,l.start,k,!0)}else Q&&y>Gs&&(l.gap=!0);l.setElementaryStreamInfo(u.type,y,w,R,k),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(u,l,A,o,Q||b)}else if(Q||b)l.gap=!0;else{this.backtrack(l);return}}if(p){const{startPTS:C,endPTS:Q,startDTS:b,endDTS:y}=p;A&&(A.elementaryStreams[He.AUDIO]={startPTS:C,endPTS:Q,startDTS:b,endDTS:y}),l.setElementaryStreamInfo(He.AUDIO,C,Q,b,y),this.bufferFragmentData(p,l,A,o)}if(g&&d!=null&&(t=d.samples)!=null&&t.length){const C={id:n,frag:l,details:g,samples:d.samples};i.trigger(I.FRAG_PARSING_METADATA,C)}if(g&&h){const C={id:n,frag:l,details:g,samples:h.samples};i.trigger(I.FRAG_PARSING_USERDATA,C)}}_bufferInitSegment(e,t,n,i){if(this.state!==re.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:s,video:o,audiovideo:a}=t;if(s){let l=e.audioCodec;const A=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5");const c=s.metadata;c&&"channelCount"in c&&(c.channelCount||1)!==1&&A.indexOf("firefox")===-1&&(l="mp4a.40.5")}l&&l.indexOf("mp4a.40.5")!==-1&&A.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),s.levelCodec=l,s.id="main",this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${s.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(I.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{const c=t[l].initSegment;c!=null&&c.byteLength&&this.hls.trigger(I.BUFFER_APPENDING,{type:l,data:c,frag:n,part:null,chunkMeta:i,parent:n.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Ee.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=re.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const n=e.currentTime;if(Ke.isBuffered(e,n)?t=this.getAppendedFrag(n):Ke.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,s=t.level;(!i||t.sn!==i.sn||i.level!==s)&&(this.fragPlaying=t,this.hls.trigger(I.FRAG_CHANGED,{frag:t}),(!i||i.level!==s)&&this.hls.trigger(I.LEVEL_SWITCHED,{level:s}))}}}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,n=this.currentFrag;if(n&&he(t)&&he(n.programDateTime)){const i=n.programDateTime+(t-n.start)*1e3;return new Date(i)}}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 wr{static get version(){return"1.5.11"}static isMSESupported(){return Dh()}static isSupported(){return eC()}static getMediaSource(){return en()}static get Events(){return I}static get ErrorTypes(){return Be}static get ErrorDetails(){return V}static get DefaultConfig(){return wr.defaultConfig?wr.defaultConfig:wh}static set DefaultConfig(e){wr.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 Da,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,qp(e.debug||!1,"Hls instance");const t=this.config=Xv(wr.DefaultConfig,e);this.userConfig=e,t.progressive&&jv(t);const{abrController:n,bufferController:i,capLevelController:s,errorController:o,fpsController:a}=t,l=new o(this),A=this.abrController=new n(this),c=this.bufferController=new i(this),u=this.capLevelController=new s(this),h=new a(this),d=new $m(this),f=new Wm(this),g=t.contentSteeringController,p=g?new g(this):null,C=this.levelController=new zv(this,p),Q=new BE(this),b=new Zv(this.config),y=this.streamController=new aC(this,Q,b);u.setStreamController(y),h.setStreamController(y);const w=[d,C,y];p&&w.splice(1,0,p),this.networkControllers=w;const R=[A,c,u,h,f,Q];this.audioTrackController=this.createController(t.audioTrackController,w);const k=t.audioStreamController;k&&w.push(new k(this,Q,b)),this.subtitleTrackController=this.createController(t.subtitleTrackController,w);const $=t.subtitleStreamController;$&&w.push(new $(this,Q,b)),this.createController(t.timelineController,R),b.emeController=this.emeController=this.createController(t.emeController,R),this.cmcdController=this.createController(t.cmcdController,R),this.latencyController=this.createController(qm,R),this.coreComponents=R,w.push(l);const K=l.onErrorOut;typeof K=="function"&&this.on(I.ERROR,K,l)}createController(e,t){if(e){const n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,i){this._emitter.off(e,t,n,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(n){if(U.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;const i=e===I.ERROR;this.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:V.INTERNAL_EXCEPTION,fatal:i,event:e,error:n}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){U.log("destroy"),this.trigger(I.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){U.log("attachMedia"),this._media=e,this.trigger(I.MEDIA_ATTACHING,{media:e})}detachMedia(){U.log("detachMedia"),this.trigger(I.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,n=this.url,i=this.url=Xo.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,U.log(`loadSource:${i}`),t&&n&&(n!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(I.MANIFEST_LOADING,{url:e})}startLoad(e=-1){U.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){U.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(){U.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){U.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){U.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){U.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){U.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){U.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){U.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&&(U.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){Xm(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 n=e.length;for(let i=0;i<n;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,n)for(let s=i;s--;){const o=e[s].attrs["HDCP-LEVEL"];if(o&&o<=n)return s}return i}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}}wr.defaultConfig=void 0;function lC(r){return r&&r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function AC(r){return r}function cC(r,e){e=e||{};const t=e.delimiter||".",n=e.maxDepth,i=e.transformKey||AC,s={};function o(a,l,A){A=A||1,Object.keys(a).forEach(function(c){const u=a[c],h=e.safe&&Array.isArray(u),d=Object.prototype.toString.call(u),f=lC(u),g=d==="[object Object]"||d==="[object Array]",p=l?l+t+i(c):i(c);if(!h&&!f&&g&&Object.keys(u).length&&(!e.maxDepth||A<n))return o(u,p,A+1);s[p]=u})}return o(r),s}var _h=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function uC(r,e){return!!(r===e||_h(r)&&_h(e))}function hC(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(!uC(r[t],e[t]))return!1;return!0}function dC(r,e){e===void 0&&(e=hC);var t=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(t&&t.lastThis===this&&e(i,t.lastArgs))return t.lastResult;var o=r.apply(this,i);return t={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){t=null},n}/**
2485
+ `),A=[],c=e?lI(e.baseTime,e.timescale):0;let u="00:00.000",h=0,d=0,f,g=!0;a.oncue=function(p){const y=t[n];let Q=t.ccOffset;const b=(h-c)/9e4;if(y!=null&&y.new&&(d!==void 0?Q=t.ccOffset=y.start:YI(t,n,b)),b){if(!e){f=new Error("Missing initPTS for VTT MPEGTS");return}Q=b-t.presentationOffset}const C=p.endTime-p.startTime,w=Yt((p.startTime+Q-d)*9e4,i*9e4)/9e4;p.startTime=Math.max(w,0),p.endTime=Math.max(w+C,0);const R=p.text.trim();p.text=decodeURIComponent(encodeURIComponent(R)),p.id||(p.id=Pa(p.startTime,p.endTime,R)),p.endTime>0&&A.push(p)},a.onparsingerror=function(p){f=p},a.onflush=function(){if(f){o(f);return}s(A)},l.forEach(p=>{if(g)if(Na(p,"X-TIMESTAMP-MAP=")){g=!1,p.slice(16).split(",").forEach(y=>{Na(y,"LOCAL:")?u=y.slice(6):Na(y,"MPEGTS:")&&(h=parseInt(y.slice(7)))});try{d=$I(u)/1e3}catch(y){f=y}return}else p===""&&(g=!1);a.parse(p+`
2486
+ `)}),a.flush()}const Oa="stpp.ttml.im1t",ah=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,lh=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,KI={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ah(r,e,t,n){const i=xe(new Uint8Array(r),["mdat"]);if(i.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const s=i.map(a=>or(a)),o=aI(e.baseTime,1,e.timescale);try{s.forEach(a=>t(JI(a,o)))}catch(a){n(a)}}function JI(r,e){const i=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("tt")[0];if(!i)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(s).reduce((u,h)=>(u[h]=i.getAttribute(`ttp:${h}`)||s[h],u),{}),a=i.getAttribute("xml:space")!=="preserve",l=ch(Ua(i,"styling","style")),A=ch(Ua(i,"layout","region")),c=Ua(i,"body","[begin]");return[].map.call(c,u=>{const h=uh(u,a);if(!h||!u.hasAttribute("begin"))return null;const d=Ha(u.getAttribute("begin"),o),f=Ha(u.getAttribute("dur"),o);let g=Ha(u.getAttribute("end"),o);if(d===null)throw hh(u);if(g===null){if(f===null)throw hh(u);g=d+f}const p=new Fa(d-e,g-e,h);p.id=Pa(p.startTime,p.endTime,p.text);const y=A[u.getAttribute("region")],Q=l[u.getAttribute("style")],b=WI(y,Q,l),{textAlign:C}=b;if(C){const w=KI[C];w&&(p.lineAlign=w),p.align=C}return it(p,b),p}).filter(u=>u!==null)}function Ua(r,e,t){const n=r.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function ch(r){return r.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function uh(r,e){return[].slice.call(r.childNodes).reduce((t,n,i)=>{var s;return n.nodeName==="br"&&i?t+`
2487
+ `:(s=n.childNodes)!=null&&s.length?uh(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function WI(r,e,t){const n="http://www.w3.org/ns/ttml#styling";let i=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=r!=null&&r.hasAttribute("style")?r.getAttribute("style"):null;return o&&t.hasOwnProperty(o)&&(i=t[o]),s.reduce((a,l)=>{const A=Ga(e,n,l)||Ga(r,n,l)||Ga(i,n,l);return A&&(a[l]=A),a},{})}function Ga(r,e,t){return r&&r.hasAttributeNS(e,t)?r.getAttributeNS(e,t):null}function hh(r){return new Error(`Could not parse ttml timestamp ${r}`)}function Ha(r,e){if(!r)return null;let t=ih(r);return t===null&&(ah.test(r)?t=qI(r,e):lh.test(r)&&(t=XI(r,e))),t}function qI(r,e){const t=ah.exec(r),n=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/e.frameRate}function XI(r,e){const t=lh.exec(r),n=Number(t[1]);switch(t[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class jI{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=gh(),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(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(I.FRAG_LOADING,this.onFragLoading,this),e.on(I.FRAG_LOADED,this.onFragLoaded,this),e.on(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(I.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(I.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(I.FRAG_LOADING,this.onFragLoading,this),e.off(I.FRAG_LOADED,this.onFragLoaded,this),e.off(I.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(I.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(I.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(I.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(I.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 Ns(this,"textTrack1"),t=new Ns(this,"textTrack2"),n=new Ns(this,"textTrack3"),i=new Ns(this,"textTrack4");this.cea608Parser1=new nh(1,e,t),this.cea608Parser2=new nh(3,n,i)}}addCues(e,t,n,i,s){let o=!1;for(let a=s.length;a--;){const l=s[a],A=zI(l[0],l[1],t,n);if(A>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],n),o=!0,A/(n-t)>.5))return}if(o||s.push([t,n]),this.config.renderTextTracksNatively){const a=this.captionsTracks[e];this.Cues.newCue(a,t,n,i)}else{const a=this.Cues.newCue(null,t,n,i);this.hls.trigger(I.CUES_PARSED,{type:"captions",cues:a,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:i,timescale:s}){const{unparsedVttFrags:o}=this;n==="main"&&(this.initPTS[t.cc]={baseTime:i,timescale:s}),o.length&&(this.unparsedVttFrags=[],o.forEach(a=>{this.onFragLoaded(I.FRAG_LOADED,a)}))}getExistingTrack(e,t){const{media:n}=this;if(n)for(let i=0;i<n.textTracks.length;i++){const s=n.textTracks[i];if(fh(s,{name:e,lang:t,attrs:{}}))return s}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:n,media:i}=this,{label:s,languageCode:o}=t[e],a=this.getExistingTrack(s,o);if(a)n[e]=a,Cn(n[e]),iu(n[e],i);else{const l=this.createTextTrack("captions",s,o);l&&(l[e]=!0,n[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n=t.label,i={_id:e,label:n,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}createTextTrack(e,t,n){const i=this.media;if(i)return i.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{Cn(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=gh(),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 n=0;n<t.length;n++)Cn(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],i=n.some(s=>s.textCodec===Oa);if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(qu(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const o=this.media,a=o?Es(o.textTracks):null;if(this.tracks.forEach((l,A)=>{let c;if(a){let u=null;for(let h=0;h<a.length;h++)if(a[h]&&fh(a[h],l)){u=a[h],a[h]=null;break}u&&(c=u)}if(c)Cn(c);else{const u=dh(l);c=this.createTextTrack(u,l.name,l.lang),c&&(c.mode="disabled")}c&&this.textTracks.push(c)}),a!=null&&a.length){const l=a.filter(A=>A!==null).map(A=>A.label);l.length&&U.warn(`Media element contains unused subtitle tracks: ${l.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(I.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(n=>{const i=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!i)return;const s=`textTrack${i[1]}`,o=this.captionsProperties[s];o&&(o.label=n.name,n.lang&&(o.languageCode=n.lang),o.media=n)})}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===Ee.MAIN){var n,i;const{cea608Parser1:s,cea608Parser2:o,lastSn:a}=this,{cc:l,sn:A}=t.frag,c=(n=(i=t.part)==null?void 0:i.index)!=null?n:-1;s&&o&&(A!==a+1||A===a&&c!==this.lastPartIndex+1||l!==this.lastCc)&&(s.reset(),o.reset()),this.lastCc=l,this.lastSn=A,this.lastPartIndex=c}}onFragLoaded(e,t){const{frag:n,payload:i}=t;if(n.type===Ee.SUBTITLE)if(i.byteLength){const s=n.decryptdata,o="stats"in t;if(s==null||!s.encrypted||o){const a=this.tracks[n.level],l=this.vttCCs;l[n.cc]||(l[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),a&&a.textCodec===Oa?this._parseIMSC1(n,i):this._parseVTTs(t)}}else this.hls.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;Ah(t,this.initPTS[e.cc],i=>{this._appendCues(i,e.level),n.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},i=>{U.log(`Failed to parse IMSC1: ${i}`),n.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:i})})}_parseVTTs(e){var t;const{frag:n,payload:i}=e,{initPTS:s,unparsedVttFrags:o}=this,a=s.length-1;if(!s[n.cc]&&a===-1){o.push(e);return}const l=this.hls,A=(t=n.initSegment)!=null&&t.data?$t(n.initSegment.data,new Uint8Array(i)):i;VI(A,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,c=>{this._appendCues(c,n.level),l.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},c=>{const u=c.message==="Missing initPTS for VTT MPEGTS";u?o.push(e):this._fallbackToIMSC1(n,i),U.log(`Failed to parse VTT cue: ${c}`),!(u&&a>n.cc)&&l.trigger(I.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:c})})}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||Ah(t,this.initPTS[e.cc],()=>{n.textCodec=Oa,this._parseIMSC1(e,t)},()=>{n.textCodec="wvtt"})}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||i.mode==="disabled")return;e.forEach(s=>su(i,s))}else{const i=this.tracks[t];if(!i)return;const s=i.default?"default":"subtitles"+t;n.trigger(I.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===Ee.SUBTITLE&&this.onFragLoaded(I.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:n,cea608Parser2:i}=this;if(!this.enabled||!n||!i)return;const{frag:s,samples:o}=t;if(!(s.type===Ee.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let a=0;a<o.length;a++){const l=o[a].bytes;if(l){const A=this.extractCea608Data(l);n.addData(o[a].pts,A[0]),i.addData(o[a].pts,A[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:i,type:s}){const{media:o}=this;if(!(!o||o.currentTime<n)){if(!s||s==="video"){const{captionsTracks:a}=this;Object.keys(a).forEach(l=>ua(a[l],t,n))}if(this.config.renderTextTracksNatively&&t===0&&i!==void 0){const{textTracks:a}=this;Object.keys(a).forEach(l=>ua(a[l],t,i))}}}extractCea608Data(e){const t=[[],[]],n=e[0]&31;let i=2;for(let s=0;s<n;s++){const o=e[i++],a=127&e[i++],l=127&e[i++];if(a===0&&l===0)continue;if((4&o)!==0){const c=3&o;(c===0||c===1)&&(t[c].push(a),t[c].push(l))}}return t}}function dh(r){return r.characteristics&&/transcribes-spoken-dialog/gi.test(r.characteristics)&&/describes-music-and-sound/gi.test(r.characteristics)?"captions":"subtitles"}function fh(r,e){return!!r&&r.kind===dh(e)&&_a(e,r)}function zI(r,e,t,n){return Math.min(e,n)-Math.max(r,t)}function gh(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class $a{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(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.BUFFER_CODECS,this.onBufferCodecs,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(I.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.BUFFER_CODECS,this.onBufferCodecs,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.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 n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&he(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,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&U.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,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 n=t.filter((i,s)=>this.isLevelAllowed(i)&&s<=e);return this.clientRect=null,$a.getMaxLevelByMediaSize(n,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 n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.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(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;const i=(a,l)=>l?a.width!==l.width||a.height!==l.height:!0;let s=e.length-1;const o=Math.max(t,n);for(let a=0;a<e.length;a+=1){const l=e[a];if((l.width>=o||l.height>=o)&&i(l,e[a+1])){s=a;break}}return s}}class ZI{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(I.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const n=this.hls.config;if(n.capLevelOnFPSDrop){const i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&typeof i.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,n){const i=performance.now();if(t){if(this.lastTime){const s=i-this.lastTime,o=n-this.lastDroppedFrames,a=t-this.lastDecodedFrames,l=1e3*o/s,A=this.hls;if(A.trigger(I.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:n}),l>0&&o>A.config.fpsDroppedMonitoringThreshold*a){let c=A.currentLevel;U.warn("drop FPS ratio greater than max allowed value for currentLevel: "+c),c>0&&(A.autoLevelCapping===-1||A.autoLevelCapping>=c)&&(c=c-1,A.trigger(I.FPS_DROP_LEVEL_CAPPING,{level:c,droppedLevel:A.currentLevel}),A.autoLevelCapping=c,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=n,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 Ps="[eme]";class Rn{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=Rn.CDMCleanupPromise?[Rn.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=U.debug.bind(U,Ps),this.log=U.log.bind(U,Ps),this.warn=U.warn.bind(U,Ps),this.error=U.error.bind(U,Ps),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(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(I.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(I.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(I.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:n}=this.config,i=t[e];if(i)return i.licenseUrl;if(e===Je.WIDEVINE&&n)return n;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,n=t[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(o,a,l)=>!!o&&l.indexOf(o)===a,i=t.map(o=>o.audioCodec).filter(n),s=t.map(o=>o.videoCodec).filter(n);return i.length+s.length===0&&s.push("avc1.42e01e"),new Promise((o,a)=>{const l=A=>{const c=A.shift();this.getMediaKeysPromise(c,i,s).then(u=>o({keySystem:c,mediaKeys:u})).catch(u=>{A.length?l(A):u instanceof Vt?a(u):a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_ACCESS,error:u,fatal:!0},u.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let i=`Configured requestMediaKeySystemAccess is not a function ${n}`;return Sc===null&&self.location.protocol==="http:"&&(i=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(i))}return n(e,t)}getMediaKeysPromise(e,t,n){const i=om(e,t,n,this.config.drmSystemOptions),s=this.keySystemAccessPromises[e];let o=s==null?void 0:s.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(i)}`),o=this.requestMediaKeySystemAccess(e,i);const a=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),o.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);const A=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),a.mediaKeys=l.createMediaKeys().then(c=>(this.log(`Media-keys created for "${e}"`),A.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(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${ar.hexDump(e.keyId||[])}`);const i=n.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),s="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(n,s,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 ar.hexDump(e.keyId)}updateKeySession(e,t){var n;const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyID ${ar.hexDump(((n=e.decryptdata)==null?void 0:n.keyId)||[])}
2488
+ } (data length: ${t&&t.byteLength})`),i.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,n)=>{const i=ta(this.config),s=e.map(bc).filter(o=>!!o&&i.indexOf(o)!==-1);return this.getKeySystemSelectionPromise(s).then(({keySystem:o})=>{const a=wc(o);a?t(a):n(new Error(`Unable to find format for key-system "${o}"`))}).catch(n)})}loadKey(e){const t=e.keyInfo.decryptdata,n=this.getKeyIdString(t),i=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);let s=this.keyIdToKeySessionPromise[n];return s||(s=this.keyIdToKeySessionPromise[n]=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 ${i}`),this.attemptSetMediaKeys(o,a).then(()=>{this.throwIfDestroyed();const l=this.createMediaKeySessionContext({keySystem:o,mediaKeys:a,decryptdata:t});return this.generateRequestWithPreferredKeySession(l,"cenc",t.pssh,"playlist-key")}))),s.catch(o=>this.handleError(o))),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Vt?this.hls.trigger(I.ERROR,e.data):this.hls.trigger(I.ERROR,{type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),n=this.keyIdToKeySessionPromise[t];if(!n){const i=bc(e.keyFormat),s=i?[i]:ta(this.config);return this.attemptKeySystemAccess(s)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=ta(this.config)),e.length===0)throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.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:n}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),n===null)return;let i,s;if(t==="sinf"&&this.config.drmSystems[Je.FAIRPLAY]){const c=ct(new Uint8Array(n));try{const u=Zo(JSON.parse(c).sinf),h=Pc(new Uint8Array(u));if(!h)return;i=h.subarray(8,24),s=Je.FAIRPLAY}catch{this.warn('Failed to parse sinf "encrypted" event message initData');return}}else{const c=Dm(n);if(c===null)return;c.version===0&&c.systemId===xc.WIDEVINE&&c.data&&(i=c.data.subarray(8,24)),s=sm(c.systemId)}if(!s||!i)return;const o=ar.hexDump(i),{keyIdToKeySessionPromise:a,mediaKeySessions:l}=this;let A=a[o];for(let c=0;c<l.length;c++){const u=l[c],h=u.decryptdata;if(h.pssh||!h.keyId)continue;const d=ar.hexDump(h.keyId);if(o===d||h.uri.replace(/-/g,"").indexOf(o)!==-1){A=a[d],delete a[d],h.pssh=new Uint8Array(n),h.keyId=i,A=a[o]=A.then(()=>this.generateRequestWithPreferredKeySession(u,t,n,"encrypted-event-key-match"));break}}A||(A=a[o]=this.getKeySystemSelectionPromise([s]).then(({keySystem:c,mediaKeys:u})=>{var h;this.throwIfDestroyed();const d=new hi("ISO-23001-7",o,(h=wc(c))!=null?h:"");return d.pssh=new Uint8Array(n),d.keyId=i,this.attemptSetMediaKeys(c,u).then(()=>{this.throwIfDestroyed();const f=this.createMediaKeySessionContext({decryptdata:d,keySystem:c,mediaKeys:u});return this.generateRequestWithPreferredKeySession(f,t,n,"encrypted-event-no-match")})})),A.catch(c=>this.handleError(c))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const i=Promise.all(n).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(i),i.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(i),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>n.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,n,i){var s,o;const a=(s=this.config.drmSystems)==null||(o=s[e.keySystem])==null?void 0:o.generateRequest;if(a)try{const f=a.call(this.hls,t,n,e);if(!f)throw new Error("Invalid response from configured generateRequest filter");t=f.initDataType,n=e.decryptdata.pssh=f.initData?new Uint8Array(f.initData):null}catch(f){var l;if(this.warn(f.message),(l=this.hls)!=null&&l.config.debug)throw f}if(n===null)return this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e);const A=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${i}": ${A} (init data type: ${t} length: ${n?n.byteLength:null})`);const c=new Da,u=e._onmessage=f=>{const g=e.mediaKeysSession;if(!g){c.emit("error",new Error("invalid state"));return}const{messageType:p,message:y}=f;this.log(`"${p}" message event for session "${g.sessionId}" message size: ${y.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,y).catch(Q=>{this.handleError(Q),c.emit("error",Q)}):p==="license-release"?e.keySystem===Je.FAIRPLAY&&(this.updateKeySession(e,ea("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${p}"`)},h=e._onkeystatuseschange=f=>{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 ${A}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",u),e.mediaKeysSession.addEventListener("keystatuseschange",h);const d=new Promise((f,g)=>{c.on("error",g),c.on("keyStatus",p=>{p.startsWith("usable")?f():p==="output-restricted"?g(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):p==="internal-error"?g(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${p}"`)):p==="expired"?g(new Error("key expired while generating request")):this.warn(`unhandled key status change "${p}"`)})});return e.mediaKeysSession.generateRequest(t,n).then(()=>{var f;this.log(`Request generated for key-session "${(f=e.mediaKeysSession)==null?void 0:f.sessionId}" keyId: ${A}`)}).catch(f=>{throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_SESSION,error:f,fatal:!1},`Error generating key-session request: ${f}`)}).then(()=>d).catch(f=>{throw c.removeAllListeners(),this.removeSession(e),f}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,n)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${ar.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))} session keyId: ${ar.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,n=t.loader,i=new n(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,a)=>{const l={responseType:"arraybuffer",url:s},A=t.certLoadPolicy.default,c={loadPolicy:A,timeout:A.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(h,d,f,g)=>{o(h.data)},onError:(h,d,f,g)=>{a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:ht({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${s}). Status: ${h.code} (${h.text})`))},onTimeout:(h,d,f)=>{a(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:f,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(h,d,f)=>{a(new Error("aborted"))}};i.load(l,c,u)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((i,s)=>{e.setServerCertificate(n).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${n==null?void 0:n.byteLength}) on "${t}"`),i(e)}).catch(o=>{s(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(i=>{throw new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:i,fatal:!0},i.message)}))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const i=new DOMParser().parseFromString(n,"application/xml"),s=i.querySelectorAll("HttpHeader");if(s.length>0){let c;for(let u=0,h=s.length;u<h;u++){var o,a;c=s[u];const d=(o=c.querySelector("name"))==null?void 0:o.textContent,f=(a=c.querySelector("value"))==null?void 0:a.textContent;d&&f&&e.setRequestHeader(d,f)}}const l=i.querySelector("Challenge"),A=l==null?void 0:l.textContent;if(!A)throw new Error("Cannot find <Challenge> in key message");return ea(atob(A))}setupLicenseXHR(e,t,n,i){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,n,i)}).catch(o=>{if(!n.decryptdata)throw o;return e.open("POST",t,!0),s.call(this.hls,e,t,n,i)}).then(o=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:o||i})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise((i,s)=>{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 s(new Error("invalid state"));if(a.readyState===4)if(a.status===200){this._requestLicenseFailureCount=0;let l=a.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const A=this.config.licenseResponseCallback;if(A)try{l=A.call(this.hls,a,o,e)}catch(c){this.error(c)}i(l)}else{const l=n.errorRetry,A=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A||a.status>=400&&a.status<500)s(new Vt({type:Be.KEY_SYSTEM_ERROR,details:K.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=A-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${c} attempts left`),this.requestLicense(e,t).then(i,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=a,this.setupLicenseXHR(a,o,e,t).then(({xhr:l,licenseChallenge:A})=>{e.keySystem==Je.PLAYREADY&&(A=this.unpackPlayReadyKeyMessage(l,A)),l.send(A)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,n.addEventListener("encrypted",this.onMediaEncrypted),n.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={},hi.clearKeyUriToKeyIdMap();const n=t.length;Rn.CDMCleanupPromise=Promise.all(t.map(i=>this.removeSession(i)).concat(e==null?void 0:e.setMediaKeys(null).catch(i=>{this.log(`Could not clear media keys: ${i}`)}))).then(()=>{n&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(i=>{this.log(`Could not close sessions and clear media keys: ${i}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const n=t.reduce((i,s)=>(i.indexOf(s.keyFormat)===-1&&i.push(s.keyFormat),i),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n}=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),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),t.remove().catch(s=>{this.log(`Could not remove session: ${s}`)}).then(()=>t.close()).catch(s=>{this.log(`Could not close session: ${s}`)})}}}Rn.CDMCleanupPromise=void 0;class Vt 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 Qt;(function(r){r.MANIFEST="m",r.AUDIO="a",r.VIDEO="v",r.MUXED="av",r.INIT="i",r.CAPTION="c",r.TIMED_TEXT="tt",r.KEY="k",r.OTHER="o"})(Qt||(Qt={}));var Ya;(function(r){r.DASH="d",r.HLS="h",r.SMOOTH="s",r.OTHER="o"})(Ya||(Ya={}));var rn;(function(r){r.OBJECT="CMCD-Object",r.REQUEST="CMCD-Request",r.SESSION="CMCD-Session",r.STATUS="CMCD-Status"})(rn||(rn={}));const ev={[rn.OBJECT]:["br","d","ot","tb"],[rn.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[rn.SESSION]:["cid","pr","sf","sid","st","v"],[rn.STATUS]:["bs","rtp"]};class Dn{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(n=>n instanceof Dn?n:new Dn(n))),this.value=e,this.params=t}}class ph{constructor(e){this.description=void 0,this.description=e}}const tv="Dict";function rv(r){return Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":typeof r=="object"?JSON.stringify(r):String(r)}function nv(r,e,t,n){return new Error(`failed to ${r} "${rv(e)}" as ${t}`,{cause:n})}const mh="Bare Item",iv="Boolean",sv="Byte Sequence",ov="Decimal",av="Integer";function lv(r){return r<-999999999999999||999999999999999<r}const Av=/[\x00-\x1f\x7f]+/,cv="Token",uv="Key";function hr(r,e,t){return nv("serialize",r,e,t)}function hv(r){if(typeof r!="boolean")throw hr(r,iv);return r?"?1":"?0"}function dv(r){return btoa(String.fromCharCode(...r))}function fv(r){if(ArrayBuffer.isView(r)===!1)throw hr(r,sv);return`:${dv(r)}:`}function Eh(r){if(lv(r))throw hr(r,av);return r.toString()}function gv(r){return`@${Eh(r.getTime()/1e3)}`}function Ih(r,e){if(r<0)return-Ih(-r,e);const t=Math.pow(10,e);if(Math.abs(r*t%1-.5)<Number.EPSILON){const i=Math.floor(r*t);return(i%2===0?i:i+1)/t}else return Math.round(r*t)/t}function pv(r){const e=Ih(r,3);if(Math.floor(Math.abs(e)).toString().length>12)throw hr(r,ov);const t=e.toString();return t.includes(".")?t:`${t}.0`}const mv="String";function Ev(r){if(Av.test(r))throw hr(r,mv);return`"${r.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Iv(r){return r.description||r.toString().slice(7,-1)}function vh(r){const e=Iv(r);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw hr(e,cv);return e}function Va(r){switch(typeof r){case"number":if(!he(r))throw hr(r,mh);return Number.isInteger(r)?Eh(r):pv(r);case"string":return Ev(r);case"symbol":return vh(r);case"boolean":return hv(r);case"object":if(r instanceof Date)return gv(r);if(r instanceof Uint8Array)return fv(r);if(r instanceof ph)return vh(r);default:throw hr(r,mh)}}function Ka(r){if(/^[a-z*][a-z0-9\-_.*]*$/.test(r)===!1)throw hr(r,uv);return r}function Ja(r){return r==null?"":Object.entries(r).map(([e,t])=>t===!0?`;${Ka(e)}`:`;${Ka(e)}=${Va(t)}`).join("")}function Ch(r){return r instanceof Dn?`${Va(r.value)}${Ja(r.params)}`:Va(r)}function vv(r){return`(${r.value.map(Ch).join(" ")})${Ja(r.params)}`}function Cv(r,e={whitespace:!0}){if(typeof r!="object")throw hr(r,tv);const t=r instanceof Map?r.entries():Object.entries(r),n=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([i,s])=>{s instanceof Dn||(s=new Dn(s));let o=Ka(i);return s.value===!0?o+=Ja(s.params):(o+="=",Array.isArray(s.value)?o+=vv(s):o+=Ch(s)),o}).join(`,${n}`)}function yv(r,e){return Cv(r,e)}const Bv=r=>r==="ot"||r==="sf"||r==="st",Tv=r=>typeof r=="number"?he(r):r!=null&&r!==""&&r!==!1;function Qv(r,e){const t=new URL(r),n=new URL(e);if(t.origin!==n.origin)return r;const i=t.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);for(;i[0]===s[0];)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")}function bv(){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,i=>{const s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i=="x"?s:s&3|8).toString(16)})}}}const Os=r=>Math.round(r),xv=(r,e)=>(e!=null&&e.baseUrl&&(r=Qv(r,e.baseUrl)),encodeURIComponent(r)),Us=r=>Os(r/100)*100,wv={br:Os,d:Os,bl:Us,dl:Us,mtp:Us,nor:xv,rtp:Us,tb:Os};function Sv(r,e){const t={};if(r==null||typeof r!="object")return t;const n=Object.keys(r).sort(),i=it({},wv,e==null?void 0:e.formatters),s=e==null?void 0:e.filter;return n.forEach(o=>{if(s!=null&&s(o))return;let a=r[o];const l=i[o];l&&(a=l(a,e)),!(o==="v"&&a===1)&&(o=="pr"&&a===1||Tv(a)&&(Bv(o)&&typeof a=="string"&&(a=new ph(a)),t[o]=a))}),t}function yh(r,e={}){return r?yv(Sv(r,e),it({whitespace:!1},e)):""}function Rv(r,e={}){if(!r)return{};const t=Object.entries(r),n=Object.entries(ev).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),i=t.reduce((s,o)=>{var a,l;const[A,c]=o,u=((a=n.find(h=>h[1].includes(A)))==null?void 0:a[0])||rn.REQUEST;return(l=s[u])!=null||(s[u]={}),s[u][A]=c,s},{});return Object.entries(i).reduce((s,[o,a])=>(s[o]=yh(a,e),s),{})}function Dv(r,e,t){return it(r,Rv(e,t))}const _v="CMCD";function Lv(r,e={}){if(!r)return"";const t=yh(r,e);return`${_v}=${encodeURIComponent(t)}`}const Bh=/CMCD=[^&#]+/;function Fv(r,e,t){const n=Lv(e,t);if(!n)return r;if(Bh.test(r))return r.replace(Bh,n);const i=r.includes("?")?"&":"?";return`${r}${i}${n}`}class kv{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=i=>{try{this.apply(i,{ot:Qt.MANIFEST,su:!this.initialized})}catch(s){U.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=i=>{try{const s=i.frag,o=this.hls.levels[s.level],a=this.getObjectType(s),l={d:s.duration*1e3,ot:a};(a===Qt.VIDEO||a===Qt.AUDIO||a==Qt.MUXED)&&(l.br=o.bitrate/1e3,l.tb=this.getTopBandwidth(a)/1e3,l.bl=this.getBufferLength(a)),this.apply(i,l)}catch(s){U.warn("Could not generate segment CMCD data.",s)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||bv(),this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHED,this.onMediaDetached,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHED,this.onMediaDetached,this),e.off(I.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 n,i;this.audioBuffer=(n=t.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(i=t.tracks.video)==null?void 0:i.buffer}createData(){var e;return{v:1,sf:Ya.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){it(t,this.createData());const n=t.ot===Qt.INIT||t.ot===Qt.VIDEO||t.ot===Qt.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:i}=this;i&&(t=Object.keys(t).reduce((s,o)=>(i.includes(o)&&(s[o]=t[o]),s),{})),this.useHeaders?(e.headers||(e.headers={}),Dv(e.headers,t)):e.url=Fv(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Qt.TIMED_TEXT;if(e.sn==="initSegment")return Qt.INIT;if(t==="audio")return Qt.AUDIO;if(t==="main")return this.hls.audioTracks.length?Qt.VIDEO:Qt.MUXED}getTopBandwidth(e){let t=0,n;const i=this.hls;if(e===Qt.AUDIO)n=i.audioTracks;else{const s=i.maxAutoLevel,o=s>-1?s+1:i.levels.length;n=i.levels.slice(0,o)}for(const s of n)s.bitrate>t&&(t=s.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,n=e===Qt.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:Ke.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,o,a){t(s),this.loader.load(s,o,a)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new n(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,o,a){t(s),this.loader.load(s,o,a)}}}}const Nv=3e5;class Mv{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=U.log.bind(U,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.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(n=>n!==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:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if((n==null?void 0:n.action)===Bt.SendAlternateToPenaltyBox&&n.flags===Zt.MoveAllAlternatesMatchingHost){const i=this.levels;let s=this.pathwayPriority,o=this.pathwayId;if(t.context){const{groupId:a,pathwayId:l,type:A}=t.context;a&&i?o=this.getPathwayForGroupId(a,A,o):l&&(o=l)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!s&&i&&(s=i.reduce((a,l)=>(a.indexOf(l.pathwayId)===-1&&a.push(l.pathwayId),a),[])),s&&s.length>1&&(this.updatePathwayPriority(s),n.resolved=this.pathwayId!==o),n.resolved||U.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${o} levels: ${i&&i.length} priorities: ${JSON.stringify(s)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}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 n=this.penalizedPathways,i=performance.now();Object.keys(n).forEach(s=>{i-n[s]>Nv&&delete n[s]});for(let s=0;s<e.length;s++){const o=e[s];if(o in n)continue;if(o===this.pathwayId)return;const a=this.hls.nextLoadLevel,l=this.hls.levels[a];if(t=this.getLevelsForPathway(o),t.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,fu(t),this.hls.trigger(I.LEVELS_UPDATED,{levels:t});const A=this.hls.levels[a];l&&A&&this.levels&&(A.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&A.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${A.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,n){const i=this.getLevelsForPathway(n).concat(this.levels||[]);for(let s=0;s<i.length;s++)if(t===Oe.AUDIO_TRACK&&i[s].hasAudioGroup(e)||t===Oe.SUBTITLE_TRACK&&i[s].hasSubtitleGroup(e))return i[s].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},i={};e.forEach(s=>{const{ID:o,"BASE-ID":a,"URI-REPLACEMENT":l}=s;if(t.some(c=>c.pathwayId===o))return;const A=this.getLevelsForPathway(a).map(c=>{const u=new je(c.attrs);u["PATHWAY-ID"]=o;const h=u.AUDIO&&`${u.AUDIO}_clone_${o}`,d=u.SUBTITLES&&`${u.SUBTITLES}_clone_${o}`;h&&(n[u.AUDIO]=h,u.AUDIO=h),d&&(i[u.SUBTITLES]=d,u.SUBTITLES=d);const f=Qh(c.uri,u["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),g=new yn({attrs:u,audioCodec:c.audioCodec,bitrate:c.bitrate,height:c.height,name:c.name,url:f,videoCodec:c.videoCodec,width:c.width});if(c.audioGroups)for(let p=1;p<c.audioGroups.length;p++)g.addGroupId("audio",`${c.audioGroups[p]}_clone_${o}`);if(c.subtitleGroups)for(let p=1;p<c.subtitleGroups.length;p++)g.addGroupId("text",`${c.subtitleGroups[p]}_clone_${o}`);return g});t.push(...A),Th(this.audioTracks,n,l,o),Th(this.subtitleTracks,i,l,o)})}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let i;try{i=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(i.protocol!=="data:"){const c=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;i.searchParams.set("_HLS_pathway",this.pathwayId),i.searchParams.set("_HLS_throughput",""+c)}const s={responseType:"json",url:i.href},o=t.steeringManifestLoadPolicy.default,a=o.errorRetry||o.timeoutRetry||{},l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},A={onSuccess:(c,u,h,d)=>{this.log(`Loaded steering manifest: "${i}"`);const f=c.data;if(f.VERSION!==1){this.log(`Steering VERSION ${f.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=f.TTL;const{"RELOAD-URI":g,"PATHWAY-CLONES":p,"PATHWAY-PRIORITY":y}=f;if(g)try{this.uri=new self.URL(g,i).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${g}`);return}this.scheduleRefresh(this.uri||h.url),p&&this.clonePathways(p);const Q={steeringManifest:f,url:i.toString()};this.hls.trigger(I.STEERING_MANIFEST_LOADED,Q),y&&this.updatePathwayPriority(y)},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 f=this.timeToLoad*1e3;if(c.code===429){const g=this.loader;if(typeof(g==null?void 0:g.getResponseHeader)=="function"){const p=g.getResponseHeader("Retry-After");p&&(f=parseFloat(p)*1e3)}this.log(`Steering manifest ${u.url} rate limited`);return}this.scheduleRefresh(this.uri||u.url,f)},onTimeout:(c,u,h)=>{this.log(`Timeout loading steering manifest (${u.url})`),this.scheduleRefresh(this.uri||u.url)}};this.log(`Requesting steering manifest: ${i}`),this.loader.load(s,l,A)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const i=(n=this.hls)==null?void 0:n.media;if(i&&!i.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Th(r,e,t,n){r&&Object.keys(e).forEach(i=>{const s=r.filter(o=>o.groupId===i).map(o=>{const a=it({},o);return a.details=void 0,a.attrs=new je(a.attrs),a.url=a.attrs.URI=Qh(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),a.groupId=a.attrs["GROUP-ID"]=e[i],a.attrs["PATHWAY-ID"]=n,a});r.push(...s)})}function Qh(r,e,t,n){const{HOST:i,PARAMS:s,[t]:o}=n;let a;e&&(a=o==null?void 0:o[e],a&&(r=a));const l=new self.URL(r);return i&&!a&&(l.host=i),s&&Object.keys(s).sort().forEach(A=>{A&&l.searchParams.set(A,s[A])}),l.href}const Pv=/^age:\s*[\d.]+\s*$/im;class bh{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 cs,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,n){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=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;const s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return s(n,t.url)}).catch(o=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",t.url,!0),s(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(o=>{this.callbacks.onError({code:n.status,text:o.message},t,n,i)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const i=t.headers,{maxTimeToFirstByteMs:s,maxLoadTimeMs:o}=n.loadPolicy;if(i)for(const a in i)e.setRequestHeader(a,i[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),n.timeout=s&&he(s)?s:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const i=t.readyState,s=this.config;if(!n.aborted&&i>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),i===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)){n.loading.end=Math.max(self.performance.now(),n.loading.first);const l=a?t.response:t.responseText,A=t.responseType==="arraybuffer"?l.byteLength:l.length;if(n.loaded=n.total=A,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first),!this.callbacks)return;const c=this.callbacks.onProgress;if(c&&c(n,e,l,t),!this.callbacks)return;const u={url:t.responseURL,data:l,code:o};this.callbacks.onSuccess(u,n,e,t)}else{const l=s.loadPolicy.errorRetry,A=n.retry,c={url:e.url,data:void 0,code:o};Bs(l,A,!1,c)?this.retry(l):(U.error(`${o} while loading ${e.url}`),this.callbacks.onError({code:o,text:t.statusText},e,t,n))}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Bs(e,t,!0))this.retry(e);else{var n;U.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=ma(e,n.retry),n.retry++,U.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${n.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&&Pv.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 Ov(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const Uv=/(\d+)-(\d+)\/(\d+)/;class xh{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||Yv,this.controller=new self.AbortController,this.stats=new cs}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,n){const i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();const s=Gv(e,this.controller.signal),o=n.onProgress,a=e.responseType==="arraybuffer",l=a?"byteLength":"length",{maxTimeToFirstByteMs:A,maxLoadTimeMs:c}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=A&&he(A)?A:c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(i,e,this.response)},t.timeout),self.fetch(this.request).then(u=>{this.response=this.loader=u;const h=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),n.onTimeout(i,e,this.response)},c-(h-i.loading.start)),!u.ok){const{status:d,statusText:f}=u;throw new Vv(f||"fetch, bad network response",d,u)}return i.loading.first=h,i.total=$v(u.headers)||i.total,o&&he(t.highWaterMark)?this.loadProgressively(u,i,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),i.loading.end=Math.max(self.performance.now(),i.loading.first);const d=u[l];d&&(i.loaded=i.total=d);const f={url:h.url,data:u,code:h.status};o&&!he(t.highWaterMark)&&o(i,e,u,h),n.onSuccess(f,i,e,h)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;const h=u&&u.code||0,d=u?u.message:null;n.onError({code:h,text:d},e,u?u.details:null,i)})}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,n,i=0,s){const o=new bu,a=e.body.getReader(),l=()=>a.read().then(A=>{if(A.done)return o.dataLength&&s(t,n,o.flush(),e),Promise.resolve(new ArrayBuffer(0));const c=A.value,u=c.length;return t.loaded+=u,u<i||o.dataLength?(o.push(c),o.dataLength>=i&&s(t,n,o.flush(),e)):s(t,n,c,e),l()}).catch(()=>Promise.reject());return l()}}function Gv(r,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(it({},r.headers))};return r.rangeEnd&&t.headers.set("Range","bytes="+r.rangeStart+"-"+String(r.rangeEnd-1)),t}function Hv(r){const e=Uv.exec(r);if(e)return parseInt(e[2])-parseInt(e[1])+1}function $v(r){const e=r.get("Content-Range");if(e){const n=Hv(e);if(he(n))return n}const t=r.get("Content-Length");if(t)return parseInt(t)}function Yv(r,e){return new self.Request(r.url,e)}class Vv extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const Kv=/\s/,Jv={newCue(r,e,t,n){const i=[];let s,o,a,l,A;const c=self.VTTCue||self.TextTrackCue;for(let h=0;h<n.rows.length;h++)if(s=n.rows[h],a=!0,l=0,A="",!s.isEmpty()){var u;for(let g=0;g<s.chars.length;g++)Kv.test(s.chars[g].uchar)&&a?l++:(A+=s.chars[g].uchar,a=!1);s.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const d=oh(A.trim()),f=Pa(e,t,d);r!=null&&(u=r.cues)!=null&&u.getCueById(f)||(o=new c(e,t,d),o.id=f,o.line=h+1,o.align="left",o.position=10+Math.min(80,Math.floor(l*8/32)*10),i.push(o))}return r&&i.length&&(i.sort((h,d)=>h.line==="auto"||d.line==="auto"?0:h.line>8&&d.line>8?d.line-h.line:h.line-d.line),i.forEach(h=>su(r,h))),i}},Wv={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},wh=ht(ht({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:bh,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:CE,bufferController:QI,capLevelController:$a,errorController:AE,fpsController:ZI,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:Sc,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:Wv},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},qv()),{},{subtitleStreamController:CI,subtitleTrackController:BI,timelineController:jI,audioStreamController:II,audioTrackController:vI,emeController:Rn,cmcdController:kv,contentSteeringController:Mv});function qv(){return{cueHandler:Jv,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 Xv(r,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=Wa(r),n=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(s=>{const o=`${s==="level"?"playlist":s}LoadPolicy`,a=e[o]===void 0,l=[];i.forEach(A=>{const c=`${s}Loading${A}`,u=e[c];if(u!==void 0&&a){l.push(c);const h=t[o].default;switch(e[o]={default:h},A){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}}}),l.length&&U.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${o}": ${JSON.stringify(e[o])}`)}),ht(ht({},t),e)}function Wa(r){return r&&typeof r=="object"?Array.isArray(r)?r.map(Wa):Object.keys(r).reduce((e,t)=>(e[t]=Wa(r[t]),e),{}):r}function jv(r){const e=r.loader;e!==xh&&e!==bh?(U.log("[config]: Custom loader detected, cannot enable progressive streaming"),r.progressive=!1):Ov()&&(r.loader=xh,r.progressive=!0,r.enableSoftwareAES=!0,U.log("[config]: Progressive streaming enabled, using FetchLoader"))}let qa;class zv extends Ia{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(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this),e.on(I.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this),e.off(I.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 n=this.hls.config.preferManagedMediaSource,i=[],s={},o={};let a=!1,l=!1,A=!1;t.levels.forEach(c=>{var u,h;const d=c.attrs;let{audioCodec:f,videoCodec:g}=c;((u=f)==null?void 0:u.indexOf("mp4a.40.34"))!==-1&&(qa||(qa=/chrome|firefox/i.test(navigator.userAgent)),qa&&(c.audioCodec=f=void 0)),f&&(c.audioCodec=f=ms(f,n)),((h=g)==null?void 0:h.indexOf("avc1"))===0&&(g=c.videoCodec=Pm(g));const{width:p,height:y,unknownCodecs:Q}=c;if(a||(a=!!(p&&y)),l||(l=!!g),A||(A=!!f),Q!=null&&Q.length||f&&!la(f,"audio",n)||g&&!la(g,"video",n))return;const{CODECS:b,"FRAME-RATE":C,"HDCP-LEVEL":w,"PATHWAY-ID":R,RESOLUTION:k,"VIDEO-RANGE":$}=d,O=`${`${R||"."}-`}${c.bitrate}-${k}-${C}-${b}-${$}-${w}`;if(s[O])if(s[O].uri!==c.url&&!c.attrs["PATHWAY-ID"]){const W=o[O]+=1;c.attrs["PATHWAY-ID"]=new Array(W+1).join(".");const ie=new yn(c);s[O]=ie,i.push(ie)}else s[O].addGroupId("audio",d.AUDIO),s[O].addGroupId("text",d.SUBTITLES);else{const W=new yn(c);s[O]=W,o[O]=1,i.push(W)}}),this.filterAndSortMediaOptions(i,t,a,l,A)}filterAndSortMediaOptions(e,t,n,i,s){let o=[],a=[],l=e;if((n||i)&&s&&(l=l.filter(({videoCodec:f,videoRange:g,width:p,height:y})=>(!!f||!!(p&&y))&&jm(g))),l.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 f=new Error("no level with compatible codecs found in manifest");this.hls.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:f,reason:f.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:f}=this.hls.config;o=t.audioTracks.filter(g=>!g.audioCodec||la(g.audioCodec,"audio",f)),Sh(o)}t.subtitles&&(a=t.subtitles,Sh(a));const A=l.slice(0);l.sort((f,g)=>{if(f.attrs["HDCP-LEVEL"]!==g.attrs["HDCP-LEVEL"])return(f.attrs["HDCP-LEVEL"]||"")>(g.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&f.height!==g.height)return f.height-g.height;if(f.frameRate!==g.frameRate)return f.frameRate-g.frameRate;if(f.videoRange!==g.videoRange)return vs.indexOf(f.videoRange)-vs.indexOf(g.videoRange);if(f.videoCodec!==g.videoCodec){const p=Kc(f.videoCodec),y=Kc(g.videoCodec);if(p!==y)return y-p}if(f.uri===g.uri&&f.codecSet!==g.codecSet){const p=ps(f.codecSet),y=ps(g.codecSet);if(p!==y)return y-p}return f.averageBitrate!==g.averageBitrate?f.averageBitrate-g.averageBitrate:0});let c=A[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==A.length)){for(let f=0;f<A.length;f++)if(A[f].pathwayId===l[0].pathwayId){c=A[f];break}}this._levels=l;for(let f=0;f<l.length;f++)if(l[f]===c){var u;this._firstLevel=f;const g=c.bitrate,p=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${g}`),((u=this.hls.userConfig)==null?void 0:u.abrEwmaDefaultEstimate)===void 0){const y=Math.min(g,this.hls.config.abrEwmaDefaultEstimateMax);y>p&&p===wh.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=y)}break}const h=s&&!i,d={levels:l,audioTracks:o,subtitleTracks:a,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:i,altAudio:!h&&o.some(f=>!!f.url)};this.hls.trigger(I.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(I.ERROR,{type:Be.OTHER_ERROR,details:K.LEVEL_SWITCH_ERROR,level:e,fatal:u,error:c,reason:c.message}),u)return;e=Math.min(e,t.length-1)}const n=this.currentLevelIndex,i=this.currentLevel,s=i?i.attrs["PATHWAY-ID"]:void 0,o=t[e],a=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,n===e&&o.details&&i&&s===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 ${n}${s?" with Pathway "+s:""}`);const l={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(I.LEVEL_SWITCHING,l);const A=o.details;if(!A||A.live){const c=this.switchParams(o.uri,i==null?void 0:i.details,A);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===Oe.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===Ee.MAIN){const n=t.elementaryStreams;if(!Object.keys(n).some(s=>!!n[s]))return;const i=this._levels[t.level];i!=null&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var n;const{level:i,details:s}=t,o=this._levels[i];if(!o){var a;this.warn(`Invalid level index ${i}`),(a=t.deliveryDirectives)!=null&&a.skip&&(s.deltaUpdateFailed=!0);return}i===this.currentLevelIndex?(o.fragmentError===0&&(o.loadError=0),this.playlistLoaded(i,t,o.details)):(n=t.deliveryDirectives)!=null&&n.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,n=this.currentLevel;if(n&&this.shouldLoadPlaylist(n)){let i=n.uri;if(e)try{i=e.addDirectives(i)}catch(o){this.warn(`Could not construct new URL with HLS Delivery Directives: ${o}`)}const s=n.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${s?" Pathway "+s:""} ${i}`),this.clearTimer(),this.hls.trigger(I.LEVEL_LOADING,{url:i,level:t,pathwayId:n.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 n=this._levels.filter((i,s)=>s!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(o=>o.level=-1)),!1));fu(n),this._levels=n,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(I.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(I.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))}}function Sh(r){const e={};r.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}class Zv{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyUriToKeyInfo){const i=this.keyUriToKeyInfo[n].loader;if(i){var t;if(e&&e!==((t=i.context)==null?void 0:t.frag.type))return;i.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=K.KEY_LOAD_ERROR,n,i,s){return new Qr({type:Be.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:n,networkDetails:i})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:n,cc:i}=e;for(let s=0;s<t.length;s++){const o=t[s];if(i<=o.cc&&(n==="initSegment"||o.sn==="initSegment"||n<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 n,i;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const A=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,K.KEY_LOAD_ERROR,A))}const o=s.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));let a=this.keyUriToKeyInfo[o];if((n=a)!=null&&n.decryptdata.key)return s.key=a.decryptdata.key,Promise.resolve({frag:e,keyInfo:a});if((i=a)!=null&&i.keyLoadPromise){var l;switch((l=a.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then(A=>(s.key=A.keyInfo.decryptdata.key,{frag:e,keyInfo:a}))}}switch(a=this.keyUriToKeyInfo[o]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.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,K.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const i=this.emeController.loadKey(n);if(i)return(e.keyLoadPromise=i.then(s=>(e.mediaKeySessionContext=s,n))).catch(s=>{throw e.keyLoadPromise=null,s})}return Promise.resolve(n)}loadKeyHTTP(e,t){const n=this.config,i=n.loader,s=new i(n);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((o,a)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},A=n.keyLoadPolicy.default,c={loadPolicy:A,timeout:A.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(h,d,f,g)=>{const{frag:p,keyInfo:y,url:Q}=f;if(!p.decryptdata||y!==this.keyUriToKeyInfo[Q])return a(this.createKeyLoadError(p,K.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),g));y.decryptdata.key=p.decryptdata.key=new Uint8Array(h.data),p.keyLoader=null,y.loader=null,o({frag:p,keyInfo:y})},onError:(h,d,f,g)=>{this.resetLoader(d),a(this.createKeyLoadError(t,K.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),f,ht({url:l.url,data:void 0},h)))},onTimeout:(h,d,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,K.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),f))},onAbort:(h,d,f)=>{this.resetLoader(d),a(this.createKeyLoadError(t,K.INTERNAL_ABORTED,new Error("key loading aborted"),f))}};s.load(l,c,u)})}resetLoader(e){const{frag:t,keyInfo:n,url:i}=e,s=n.loader;t.keyLoader===s&&(t.keyLoader=null,n.loader=null),delete this.keyUriToKeyInfo[i],s&&s.destroy()}}function Rh(){return self.SourceBuffer||self.WebKitSourceBuffer}function Dh(){if(!en())return!1;const e=Rh();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function eC(){if(!Dh())return!1;const r=en();return typeof(r==null?void 0:r.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>r.isTypeSupported(di(e,"video")))||["mp4a.40.2","fLaC"].some(e=>r.isTypeSupported(di(e,"audio"))))}function tC(){var r;const e=Rh();return typeof(e==null||(r=e.prototype)==null?void 0:r.changeType)=="function"}const rC=250,Gs=2,nC=.1,iC=.05;class sC{constructor(e,t,n,i){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=n,this.hls=i}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:n,media:i,stalled:s}=this;if(i===null)return;const{currentTime:o,seeking:a}=i,l=this.seeking&&!a,A=!this.seeking&&a;if(this.seeking=a,o!==e){if(this.moved=!0,a||(this.nudgeRetry=0),s!==null){if(this.stallReported){const p=self.performance.now()-s;U.warn(`playback not stuck anymore @${o}, after ${Math.round(p)}ms`),this.stallReported=!1}this.stalled=null}return}if(A||l){this.stalled=null;return}if(i.paused&&!a||i.ended||i.playbackRate===0||!Ke.getBuffered(i).length){this.nudgeRetry=0;return}const c=Ke.bufferInfo(i,o,0),u=c.nextStart||0;if(a){const p=c.len>Gs,y=!u||t&&t.start<=o||u-o>Gs&&!this.fragmentTracker.getPartialFragment(o);if(p||y)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var h;if(!(c.len>0)&&!u)return;const y=Math.max(u,c.start||0)-o,Q=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,C=(Q==null||(h=Q.details)==null?void 0:h.live)?Q.details.targetduration*2:Gs,w=this.fragmentTracker.getPartialFragment(o);if(y>0&&(y<=C||w)){i.paused||this._trySkipBufferHole(w);return}}const d=self.performance.now();if(s===null){this.stalled=d;return}const f=d-s;if(!a&&f>=rC&&(this._reportStall(c),!this.media))return;const g=Ke.bufferInfo(i,o,n.maxBufferHole);this._tryFixBufferStall(g,f)}_tryFixBufferStall(e,t){const{config:n,fragmentTracker:i,media:s}=this;if(s===null)return;const o=s.currentTime,a=i.getPartialFragment(o);a&&(this._trySkipBufferHole(a)||!this.media)||(e.len>n.maxBufferHole||e.nextStart&&e.nextStart-o<n.maxBufferHole)&&t>n.highBufferWatchdogPeriod*1e3&&(U.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:n,stallReported:i}=this;if(!i&&n){this.stallReported=!0;const s=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${JSON.stringify(e)})`);U.warn(s.message),t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:n,media:i}=this;if(i===null)return 0;const s=i.currentTime,o=Ke.bufferInfo(i,s,0),a=s<o.start?o.start:o.nextStart;if(a){const l=o.len<=t.maxBufferHole,A=o.len>0&&o.len<1&&i.readyState<3,c=a-s;if(c>0&&(l||A)){if(c>t.maxBufferHole){const{fragmentTracker:h}=this;let d=!1;if(s===0){const f=h.getAppendedFrag(0,Ee.MAIN);f&&a<f.end&&(d=!0)}if(!d){const f=e||h.getAppendedFrag(s,Ee.MAIN);if(f){let g=!1,p=f.end;for(;p<a;){const y=h.getPartialFragment(p);if(y)p+=y.duration;else{g=!0;break}}if(g)return 0}}}const u=Math.max(a+iC,s+nC);if(U.warn(`skipping hole, adjusting currentTime from ${s} to ${u}`),this.moved=!0,this.stalled=null,i.currentTime=u,e&&!e.gap){const h=new Error(`fragment loaded with buffer holes, seeking from ${s} to ${u}`);n.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:e})}return u}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:n,nudgeRetry:i}=this;if(n===null)return;const s=n.currentTime;if(this.nudgeRetry++,i<e.nudgeMaxRetry){const o=s+(i+1)*e.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${s} to ${o}`);U.warn(a.message),n.currentTime=o,t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const o=new Error(`Playhead still not moving while enough data buffered @${s} after ${e.nudgeMaxRetry} nudges`);U.error(o.message),t.trigger(I.ERROR,{type:Be.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}}const oC=100;class aC extends ya{constructor(e,t,n){super(e,t,n,"[stream-controller]",Ee.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(I.MANIFEST_LOADING,this.onManifestLoading,this),e.on(I.MANIFEST_PARSED,this.onManifestParsed,this),e.on(I.LEVEL_LOADING,this.onLevelLoading,this),e.on(I.LEVEL_LOADED,this.onLevelLoaded,this),e.on(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(I.ERROR,this.onError,this),e.on(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(I.BUFFER_CREATED,this.onBufferCreated,this),e.on(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(I.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(I.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(I.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(I.MANIFEST_LOADING,this.onManifestLoading,this),e.off(I.MANIFEST_PARSED,this.onManifestParsed,this),e.off(I.LEVEL_LOADED,this.onLevelLoaded,this),e.off(I.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(I.ERROR,this.onError,this),e.off(I.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(I.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(I.BUFFER_CREATED,this.onBufferCreated,this),e.off(I.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(I.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(I.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:n}=this;if(this.stopLoad(),this.setInterval(oC),this.level=-1,!this.startFragRequested){let i=n.startLevel;i===-1&&(n.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=n.firstAutoLevel),n.nextLoadLevel=i,this.level=n.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=re.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=re.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case re.WAITING_LEVEL:{const{levels:t,level:n}=this,i=t==null?void 0:t[n],s=i==null?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(s))break;this.state=re.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=re.IDLE;break}break}case re.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),n=this.retryDate;if(!n||t>=n||(e=this.media)!=null&&e.seeking){const{levels:i,level:s}=this,o=i==null?void 0:i[s];this.resetStartWhenNotLoaded(o||null),this.state=re.IDLE}}break}this.state===re.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:n,media:i}=this;if(t===null||!i&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=e.nextLoadLevel;if(!(n!=null&&n[s]))return;const o=n[s],a=this.getMainFwdBufferInfo();if(a===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(a,l)){const g={};this.altAudio&&(g.type="video"),this.hls.trigger(I.BUFFER_EOS,g),this.state=re.ENDED;return}e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const A=o.details;if(!A||this.state===re.WAITING_LEVEL||A.live&&this.levelLastLoaded!==o){this.level=s,this.state=re.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,A);if(this.couldBacktrack&&!this.fragPrevious&&d&&d.sn!=="initSegment"&&this.fragmentTracker.getState(d)!==dt.OK){var f;const p=((f=this.backtrackFragment)!=null?f:d).sn-A.startSN,y=A.fragments[p-1];y&&d.cc===y.cc&&(d=y,this.fragmentTracker.removeFragment(y))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(d&&this.isLoopLoading(d,h)){if(!d.gap){const p=this.audioOnly&&!this.altAudio?He.AUDIO:He.VIDEO,y=(p===He.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;y&&this.afterBufferFlushed(y,p,Ee.MAIN)}d=this.getNextFragmentLoopLoading(d,A,a,Ee.MAIN,u)}d&&(d.initSegment&&!d.initSegment.data&&!this.bitrateTest&&(d=d.initSegment),this.loadFragment(d,o,h))}loadFragment(e,t,n){const i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===dt.NOT_LOADED||i===dt.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,n)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Ee.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let n;const i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);const s=this.getLevelDetails();if(s!=null&&s.live){const a=this.getMainFwdBufferInfo();if(!a||a.len<s.targetduration*2)return}if(!t.paused&&e){const a=this.hls.nextLoadLevel,l=e[a],A=this.fragLastKbps;A&&this.fragCurrent?n=this.fragCurrent.duration*l.maxBitrate/(1e3*A)+1:n=0}else n=0;const o=this.getBufferedFrag(t.currentTime+n);if(o){const a=this.followingBufferedFrag(o);if(a){this.abortCurrentFrag();const l=a.maxStartPTS?a.maxStartPTS:a.start,A=a.duration,c=Math.max(o.end,l+Math.min(Math.max(A-this.config.maxFragLookUpTolerance,A*(this.couldBacktrack?.5:.125)),A*(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 re.KEY_LOADING:case re.FRAG_LOADING:case re.FRAG_LOADING_WAITING_RETRY:case re.PARSING:case re.PARSED:this.state=re.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 n=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener("playing",this.onvplaying),n.addEventListener("seeked",this.onvseeked),this.gapController=new sC(this.config,n,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;he(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const n=this.getMainFwdBufferInfo();if(n===null||n.len===0){this.warn(`Main forward buffer length on "seeked" event ${n?n.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(I.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 n=!1,i=!1;t.levels.forEach(s=>{const o=s.audioCodec;o&&(n=n||o.indexOf("mp4a.40.2")!==-1,i=i||o.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=n&&i&&!tC(),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:n}=this;if(!n||this.state!==re.IDLE)return;const i=n[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=re.WAITING_LEVEL)}onLevelLoaded(e,t){var n;const{levels:i}=this,s=t.level,o=t.details,a=o.totalduration;if(!i){this.warn(`Levels were reset while loading level ${s}`);return}this.log(`Level ${s} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${a}`);const l=i[s],A=this.fragCurrent;A&&(this.state===re.FRAG_LOADING||this.state===re.FRAG_LOADING_WAITING_RETRY)&&A.level!==t.level&&A.loader&&this.abortCurrentFrag();let c=0;if(o.live||(n=l.details)!=null&&n.live){var u;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;c=this.alignPlaylists(o,l.details,(u=this.levelLastLoaded)==null?void 0:u.details)}if(l.details=o,this.levelLastLoaded=l,this.hls.trigger(I.LEVEL_UPDATED,{details:o,level:s}),this.state===re.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=re.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,c),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:n,part:i,payload:s}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const a=o[n.level],l=a.details;if(!l){this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),this.fragmentTracker.removeFragment(n);return}const A=a.videoCodec,c=l.PTSKnown||!l.live,u=(t=n.initSegment)==null?void 0:t.data,h=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new Wu(this.hls,Ee.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=i?i.index:-1,g=f!==-1,p=new va(n.level,n.sn,n.stats.chunkCount,s.byteLength,f,g),y=this.initPTS[n.cc];d.push(s,u,h,A,n,i,l.totalduration,c,p,y)}onAudioTrackSwitching(e,t){const n=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 s=this.hls;n&&(s.trigger(I.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),s.trigger(I.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const n=t.id,i=!!this.hls.audioTracks[n].url;if(i){const s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=i,this.tick()}onBufferCreated(e,t){const n=t.tracks;let i,s,o=!1;for(const a in n){const l=n[a];if(l.id==="main"){if(s=a,i=l,a==="video"){const A=n[a];A&&(this.videoBuffer=A.buffer)}}else o=!0}o&&i?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:n,part:i}=t;if(n&&n.type!==Ee.MAIN)return;if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${i?" p: "+i.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===re.PARSED&&(this.state=re.IDLE);return}const s=i?i.stats:n.stats;this.fragLastKbps=Math.round(8*s.total/(s.buffering.end-s.loading.first)),n.sn!=="initSegment"&&(this.fragPrevious=n),this.fragBufferedComplete(n,i)}onError(e,t){var n;if(t.fatal){this.state=re.ERROR;return}switch(t.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ee.MAIN,t);break;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===re.WAITING_LEVEL&&((n=t.context)==null?void 0:n.type)===Oe.LEVEL&&(this.state=re.IDLE);break;case K.BUFFER_APPEND_ERROR:case K.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===K.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Ke.getBuffered(e).length){const n=this.state!==re.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,n)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=re.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==He.AUDIO||this.audioOnly&&!this.altAudio){const n=(t===He.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(n,t,Ee.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}const i=Ke.getBuffered(e),o=(i.length?i.start(0):0)-n;o>0&&(o<this.config.maxBufferHole||o<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${o} to match buffer start`),n+=o,this.startPosition=n),this.log(`seek to target start position ${n} from current time ${t}`),e.currentTime=n}}_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(n=>{const{hls:i}=this;if(!n||this.fragContextChanged(e))return;t.fragmentError=0,this.state=re.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const s=e.stats;s.parsing.start=s.parsing.end=s.buffering.start=s.buffering.end=self.performance.now(),i.trigger(I.FRAG_LOADED,n),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const n="main",{hls:i}=this,{remuxResult:s,chunkMeta:o}=e,a=this.getCurrentContext(o);if(!a){this.resetWhenMissingContext(o);return}const{frag:l,part:A,level:c}=a,{video:u,text:h,id3:d,initSegment:f}=s,{details:g}=c,p=this.altAudio?void 0:s.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=re.PARSING,f){if(f!=null&&f.tracks){const b=l.initSegment||l;this._bufferInitSegment(c,f.tracks,b,o),i.trigger(I.FRAG_PARSING_INIT_SEGMENT,{frag:b,id:n,tracks:f.tracks})}const y=f.initPTS,Q=f.timescale;he(y)&&(this.initPTS[l.cc]={baseTime:y,timescale:Q},i.trigger(I.INIT_PTS_FOUND,{frag:l,id:n,initPTS:y,timescale:Q}))}if(u&&g&&l.sn!=="initSegment"){const y=g.fragments[l.sn-1-g.startSN],Q=l.sn===g.startSN,b=!y||l.cc>y.cc;if(s.independent!==!1){const{startPTS:C,endPTS:w,startDTS:R,endDTS:k}=u;if(A)A.elementaryStreams[u.type]={startPTS:C,endPTS:w,startDTS:R,endDTS:k};else if(u.firstKeyFrame&&u.independent&&o.id===1&&!b&&(this.couldBacktrack=!0),u.dropped&&u.independent){const $=this.getMainFwdBufferInfo(),V=($?$.end:this.getLoadPosition())+this.config.maxBufferHole,O=u.firstKeyFramePTS?u.firstKeyFramePTS:C;if(!Q&&V<O-this.config.maxBufferHole&&!b){this.backtrack(l);return}else b&&(l.gap=!0);l.setElementaryStreamInfo(u.type,l.start,w,l.start,k,!0)}else Q&&C>Gs&&(l.gap=!0);l.setElementaryStreamInfo(u.type,C,w,R,k),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(u,l,A,o,Q||b)}else if(Q||b)l.gap=!0;else{this.backtrack(l);return}}if(p){const{startPTS:y,endPTS:Q,startDTS:b,endDTS:C}=p;A&&(A.elementaryStreams[He.AUDIO]={startPTS:y,endPTS:Q,startDTS:b,endDTS:C}),l.setElementaryStreamInfo(He.AUDIO,y,Q,b,C),this.bufferFragmentData(p,l,A,o)}if(g&&d!=null&&(t=d.samples)!=null&&t.length){const y={id:n,frag:l,details:g,samples:d.samples};i.trigger(I.FRAG_PARSING_METADATA,y)}if(g&&h){const y={id:n,frag:l,details:g,samples:h.samples};i.trigger(I.FRAG_PARSING_USERDATA,y)}}_bufferInitSegment(e,t,n,i){if(this.state!==re.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:s,video:o,audiovideo:a}=t;if(s){let l=e.audioCodec;const A=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5");const c=s.metadata;c&&"channelCount"in c&&(c.channelCount||1)!==1&&A.indexOf("firefox")===-1&&(l="mp4a.40.5")}l&&l.indexOf("mp4a.40.5")!==-1&&A.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),s.levelCodec=l,s.id="main",this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${s.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(I.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{const c=t[l].initSegment;c!=null&&c.byteLength&&this.hls.trigger(I.BUFFER_APPENDING,{type:l,data:c,frag:n,part:null,chunkMeta:i,parent:n.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,Ee.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=re.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const n=e.currentTime;if(Ke.isBuffered(e,n)?t=this.getAppendedFrag(n):Ke.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;const i=this.fragPlaying,s=t.level;(!i||t.sn!==i.sn||i.level!==s)&&(this.fragPlaying=t,this.hls.trigger(I.FRAG_CHANGED,{frag:t}),(!i||i.level!==s)&&this.hls.trigger(I.LEVEL_SWITCHED,{level:s}))}}}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,n=this.currentFrag;if(n&&he(t)&&he(n.programDateTime)){const i=n.programDateTime+(t-n.start)*1e3;return new Date(i)}}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 wr{static get version(){return"1.5.11"}static isMSESupported(){return Dh()}static isSupported(){return eC()}static getMediaSource(){return en()}static get Events(){return I}static get ErrorTypes(){return Be}static get ErrorDetails(){return K}static get DefaultConfig(){return wr.defaultConfig?wr.defaultConfig:wh}static set DefaultConfig(e){wr.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 Da,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,qp(e.debug||!1,"Hls instance");const t=this.config=Xv(wr.DefaultConfig,e);this.userConfig=e,t.progressive&&jv(t);const{abrController:n,bufferController:i,capLevelController:s,errorController:o,fpsController:a}=t,l=new o(this),A=this.abrController=new n(this),c=this.bufferController=new i(this),u=this.capLevelController=new s(this),h=new a(this),d=new $m(this),f=new Wm(this),g=t.contentSteeringController,p=g?new g(this):null,y=this.levelController=new zv(this,p),Q=new BE(this),b=new Zv(this.config),C=this.streamController=new aC(this,Q,b);u.setStreamController(C),h.setStreamController(C);const w=[d,y,C];p&&w.splice(1,0,p),this.networkControllers=w;const R=[A,c,u,h,f,Q];this.audioTrackController=this.createController(t.audioTrackController,w);const k=t.audioStreamController;k&&w.push(new k(this,Q,b)),this.subtitleTrackController=this.createController(t.subtitleTrackController,w);const $=t.subtitleStreamController;$&&w.push(new $(this,Q,b)),this.createController(t.timelineController,R),b.emeController=this.emeController=this.createController(t.emeController,R),this.cmcdController=this.createController(t.cmcdController,R),this.latencyController=this.createController(qm,R),this.coreComponents=R,w.push(l);const V=l.onErrorOut;typeof V=="function"&&this.on(I.ERROR,V,l)}createController(e,t){if(e){const n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,i){this._emitter.off(e,t,n,i)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(n){if(U.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;const i=e===I.ERROR;this.trigger(I.ERROR,{type:Be.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:i,event:e,error:n}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){U.log("destroy"),this.trigger(I.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){U.log("attachMedia"),this._media=e,this.trigger(I.MEDIA_ATTACHING,{media:e})}detachMedia(){U.log("detachMedia"),this.trigger(I.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,n=this.url,i=this.url=Xo.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,U.log(`loadSource:${i}`),t&&n&&(n!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(I.MANIFEST_LOADING,{url:e})}startLoad(e=-1){U.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach(t=>{t.startLoad(e)})}stopLoad(){U.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(){U.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){U.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){U.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){U.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){U.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){U.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){U.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&&(U.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){Xm(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 n=e.length;for(let i=0;i<n;i++)if(e[i].maxBitrate>=t)return i;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this;let i;if(t===-1&&e!=null&&e.length?i=e.length-1:i=t,n)for(let s=i;s--;){const o=e[s].attrs["HDCP-LEVEL"];if(o&&o<=n)return s}return i}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}}wr.defaultConfig=void 0;function lC(r){return r&&r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function AC(r){return r}function cC(r,e){e=e||{};const t=e.delimiter||".",n=e.maxDepth,i=e.transformKey||AC,s={};function o(a,l,A){A=A||1,Object.keys(a).forEach(function(c){const u=a[c],h=e.safe&&Array.isArray(u),d=Object.prototype.toString.call(u),f=lC(u),g=d==="[object Object]"||d==="[object Array]",p=l?l+t+i(c):i(c);if(!h&&!f&&g&&Object.keys(u).length&&(!e.maxDepth||A<n))return o(u,p,A+1);s[p]=u})}return o(r),s}var _h=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function uC(r,e){return!!(r===e||_h(r)&&_h(e))}function hC(r,e){if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(!uC(r[t],e[t]))return!1;return!0}function dC(r,e){e===void 0&&(e=hC);var t=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(t&&t.lastThis===this&&e(i,t.lastArgs))return t.lastResult;var o=r.apply(this,i);return t={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){t=null},n}/**
2489
2489
  * @license
2490
2490
  * Copyright 2017 Google LLC
2491
2491
  * SPDX-License-Identifier: BSD-3-Clause
2492
- */const Lh=(r,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(r[i],i);return n},Fh=pn(class extends Zn{constructor(r){if(super(r),r.type!==gn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],s=[];let o=0;for(const a of r)i[o]=n?n(a,o):o,s[o]=t(a,o),o++;return{values:s,keys:i}}render(r,e,t){return this.dt(r,e,t).values}update(r,[e,t,n]){const i=nf(r),{values:s,keys:o}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=o,s;const a=this.ut??(this.ut=[]),l=[];let A,c,u=0,h=i.length-1,d=0,f=s.length-1;for(;u<=h&&d<=f;)if(i[u]===null)u++;else if(i[h]===null)h--;else if(a[u]===o[d])l[d]=Jr(i[u],s[d]),u++,d++;else if(a[h]===o[f])l[f]=Jr(i[h],s[f]),h--,f--;else if(a[u]===o[f])l[f]=Jr(i[u],s[f]),zn(r,l[f+1],i[u]),u++,f--;else if(a[h]===o[d])l[d]=Jr(i[h],s[d]),zn(r,i[u],i[h]),h--,d++;else if(A===void 0&&(A=Lh(o,d,f),c=Lh(a,u,h)),A.has(a[u]))if(A.has(a[h])){const g=c.get(o[d]),p=g!==void 0?i[g]:null;if(p===null){const C=zn(r,i[u]);Jr(C,s[d]),l[d]=C}else l[d]=Jr(p,s[d]),zn(r,i[u],p),i[g]=null;d++}else ho(i[h]),h--;else ho(i[u]),u++;for(;d<=f;){const g=zn(r,l[f+1]);Jr(g,s[d]),l[d++]=g}for(;u<=h;){const g=i[u++];g!==null&&ho(g)}return this.ut=o,rf(r,l),Xt}});var Ft="top",Kt="bottom",Jt="right",kt="left",Xa="auto",gi=[Ft,Kt,Jt,kt],_n="start",pi="end",fC="clippingParents",kh="viewport",mi="popper",gC="reference",Nh=gi.reduce(function(r,e){return r.concat([e+"-"+_n,e+"-"+pi])},[]),Mh=[].concat(gi,[Xa]).reduce(function(r,e){return r.concat([e,e+"-"+_n,e+"-"+pi])},[]),pC="beforeRead",mC="read",EC="afterRead",IC="beforeMain",vC="main",CC="afterMain",yC="beforeWrite",BC="write",TC="afterWrite",QC=[pC,mC,EC,IC,vC,CC,yC,BC,TC];function dr(r){return r?(r.nodeName||"").toLowerCase():null}function Pt(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function nn(r){var e=Pt(r).Element;return r instanceof e||r instanceof Element}function Wt(r){var e=Pt(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function ja(r){if(typeof ShadowRoot>"u")return!1;var e=Pt(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function bC(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!Wt(s)||!dr(s)||(Object.assign(s.style,n),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function xC(r){var e=r.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(n){var i=e.elements[n],s=e.attributes[n]||{},o=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:t[n]),a=o.reduce(function(l,A){return l[A]="",l},{});!Wt(i)||!dr(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const Ph={name:"applyStyles",enabled:!0,phase:"write",fn:bC,effect:xC,requires:["computeStyles"]};function fr(r){return r.split("-")[0]}var sn=Math.max,Hs=Math.min,Ln=Math.round;function za(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Oh(){return!/^((?!chrome|android).)*safari/i.test(za())}function Fn(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),i=1,s=1;e&&Wt(r)&&(i=r.offsetWidth>0&&Ln(n.width)/r.offsetWidth||1,s=r.offsetHeight>0&&Ln(n.height)/r.offsetHeight||1);var o=nn(r)?Pt(r):window,a=o.visualViewport,l=!Oh()&&t,A=(n.left+(l&&a?a.offsetLeft:0))/i,c=(n.top+(l&&a?a.offsetTop:0))/s,u=n.width/i,h=n.height/s;return{width:u,height:h,top:c,right:A+u,bottom:c+h,left:A,x:A,y:c}}function Za(r){var e=Fn(r),t=r.offsetWidth,n=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:n}}function Uh(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&ja(t)){var n=e;do{if(n&&r.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Sr(r){return Pt(r).getComputedStyle(r)}function wC(r){return["table","td","th"].indexOf(dr(r))>=0}function Or(r){return((nn(r)?r.ownerDocument:r.document)||window.document).documentElement}function $s(r){return dr(r)==="html"?r:r.assignedSlot||r.parentNode||(ja(r)?r.host:null)||Or(r)}function Gh(r){return!Wt(r)||Sr(r).position==="fixed"?null:r.offsetParent}function SC(r){var e=/firefox/i.test(za()),t=/Trident/i.test(za());if(t&&Wt(r)){var n=Sr(r);if(n.position==="fixed")return null}var i=$s(r);for(ja(i)&&(i=i.host);Wt(i)&&["html","body"].indexOf(dr(i))<0;){var s=Sr(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Ei(r){for(var e=Pt(r),t=Gh(r);t&&wC(t)&&Sr(t).position==="static";)t=Gh(t);return t&&(dr(t)==="html"||dr(t)==="body"&&Sr(t).position==="static")?e:t||SC(r)||e}function el(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function Ii(r,e,t){return sn(r,Hs(e,t))}function RC(r,e,t){var n=Ii(r,e,t);return n>t?t:n}function Hh(){return{top:0,right:0,bottom:0,left:0}}function $h(r){return Object.assign({},Hh(),r)}function Yh(r,e){return e.reduce(function(t,n){return t[n]=r,t},{})}var DC=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,$h(typeof e!="number"?e:Yh(e,gi))};function _C(r){var e,t=r.state,n=r.name,i=r.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=fr(t.placement),l=el(a),A=[kt,Jt].indexOf(a)>=0,c=A?"height":"width";if(!(!s||!o)){var u=DC(i.padding,t),h=Za(s),d=l==="y"?Ft:kt,f=l==="y"?Kt:Jt,g=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],p=o[l]-t.rects.reference[l],C=Ei(s),Q=C?l==="y"?C.clientHeight||0:C.clientWidth||0:0,b=g/2-p/2,y=u[d],w=Q-h[c]-u[f],R=Q/2-h[c]/2+b,k=Ii(y,R,w),$=l;t.modifiersData[n]=(e={},e[$]=k,e.centerOffset=k-R,e)}}function LC(r){var e=r.state,t=r.options,n=t.element,i=n===void 0?"[data-popper-arrow]":n;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Uh(e.elements.popper,i)&&(e.elements.arrow=i))}const FC={name:"arrow",enabled:!0,phase:"main",fn:_C,effect:LC,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function kn(r){return r.split("-")[1]}var kC={top:"auto",right:"auto",bottom:"auto",left:"auto"};function NC(r,e){var t=r.x,n=r.y,i=e.devicePixelRatio||1;return{x:Ln(t*i)/i||0,y:Ln(n*i)/i||0}}function Vh(r){var e,t=r.popper,n=r.popperRect,i=r.placement,s=r.variation,o=r.offsets,a=r.position,l=r.gpuAcceleration,A=r.adaptive,c=r.roundOffsets,u=r.isFixed,h=o.x,d=h===void 0?0:h,f=o.y,g=f===void 0?0:f,p=typeof c=="function"?c({x:d,y:g}):{x:d,y:g};d=p.x,g=p.y;var C=o.hasOwnProperty("x"),Q=o.hasOwnProperty("y"),b=kt,y=Ft,w=window;if(A){var R=Ei(t),k="clientHeight",$="clientWidth";if(R===Pt(t)&&(R=Or(t),Sr(R).position!=="static"&&a==="absolute"&&(k="scrollHeight",$="scrollWidth")),R=R,i===Ft||(i===kt||i===Jt)&&s===pi){y=Kt;var K=u&&R===w&&w.visualViewport?w.visualViewport.height:R[k];g-=K-n.height,g*=l?1:-1}if(i===kt||(i===Ft||i===Kt)&&s===pi){b=Jt;var O=u&&R===w&&w.visualViewport?w.visualViewport.width:R[$];d-=O-n.width,d*=l?1:-1}}var J=Object.assign({position:a},A&&kC),ie=c===!0?NC({x:d,y:g},Pt(t)):{x:d,y:g};if(d=ie.x,g=ie.y,l){var ee;return Object.assign({},J,(ee={},ee[y]=Q?"0":"",ee[b]=C?"0":"",ee.transform=(w.devicePixelRatio||1)<=1?"translate("+d+"px, "+g+"px)":"translate3d("+d+"px, "+g+"px, 0)",ee))}return Object.assign({},J,(e={},e[y]=Q?g+"px":"",e[b]=C?d+"px":"",e.transform="",e))}function MC(r){var e=r.state,t=r.options,n=t.gpuAcceleration,i=n===void 0?!0:n,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,A={placement:fr(e.placement),variation:kn(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Vh(Object.assign({},A,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Vh(Object.assign({},A,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const PC={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:MC,data:{}};var Ys={passive:!0};function OC(r){var e=r.state,t=r.instance,n=r.options,i=n.scroll,s=i===void 0?!0:i,o=n.resize,a=o===void 0?!0:o,l=Pt(e.elements.popper),A=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&A.forEach(function(c){c.addEventListener("scroll",t.update,Ys)}),a&&l.addEventListener("resize",t.update,Ys),function(){s&&A.forEach(function(c){c.removeEventListener("scroll",t.update,Ys)}),a&&l.removeEventListener("resize",t.update,Ys)}}const UC={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:OC,data:{}};var GC={left:"right",right:"left",bottom:"top",top:"bottom"};function Vs(r){return r.replace(/left|right|bottom|top/g,function(e){return GC[e]})}var HC={start:"end",end:"start"};function Kh(r){return r.replace(/start|end/g,function(e){return HC[e]})}function tl(r){var e=Pt(r),t=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:t,scrollTop:n}}function rl(r){return Fn(Or(r)).left+tl(r).scrollLeft}function $C(r,e){var t=Pt(r),n=Or(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var A=Oh();(A||!A&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+rl(r),y:l}}function YC(r){var e,t=Or(r),n=tl(r),i=(e=r.ownerDocument)==null?void 0:e.body,s=sn(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=sn(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+rl(r),l=-n.scrollTop;return Sr(i||t).direction==="rtl"&&(a+=sn(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function nl(r){var e=Sr(r),t=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+n)}function Jh(r){return["html","body","#document"].indexOf(dr(r))>=0?r.ownerDocument.body:Wt(r)&&nl(r)?r:Jh($s(r))}function vi(r,e){var t;e===void 0&&(e=[]);var n=Jh(r),i=n===((t=r.ownerDocument)==null?void 0:t.body),s=Pt(n),o=i?[s].concat(s.visualViewport||[],nl(n)?n:[]):n,a=e.concat(o);return i?a:a.concat(vi($s(o)))}function il(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function VC(r,e){var t=Fn(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function Wh(r,e,t){return e===kh?il($C(r,t)):nn(e)?VC(e,t):il(YC(Or(r)))}function KC(r){var e=vi($s(r)),t=["absolute","fixed"].indexOf(Sr(r).position)>=0,n=t&&Wt(r)?Ei(r):r;return nn(n)?e.filter(function(i){return nn(i)&&Uh(i,n)&&dr(i)!=="body"}):[]}function JC(r,e,t,n){var i=e==="clippingParents"?KC(r):[].concat(e),s=[].concat(i,[t]),o=s[0],a=s.reduce(function(l,A){var c=Wh(r,A,n);return l.top=sn(c.top,l.top),l.right=Hs(c.right,l.right),l.bottom=Hs(c.bottom,l.bottom),l.left=sn(c.left,l.left),l},Wh(r,o,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function qh(r){var e=r.reference,t=r.element,n=r.placement,i=n?fr(n):null,s=n?kn(n):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case Ft:l={x:o,y:e.y-t.height};break;case Kt:l={x:o,y:e.y+e.height};break;case Jt:l={x:e.x+e.width,y:a};break;case kt:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var A=i?el(i):null;if(A!=null){var c=A==="y"?"height":"width";switch(s){case _n:l[A]=l[A]-(e[c]/2-t[c]/2);break;case pi:l[A]=l[A]+(e[c]/2-t[c]/2);break}}return l}function Ci(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=n===void 0?r.placement:n,s=t.strategy,o=s===void 0?r.strategy:s,a=t.boundary,l=a===void 0?fC:a,A=t.rootBoundary,c=A===void 0?kh:A,u=t.elementContext,h=u===void 0?mi:u,d=t.altBoundary,f=d===void 0?!1:d,g=t.padding,p=g===void 0?0:g,C=$h(typeof p!="number"?p:Yh(p,gi)),Q=h===mi?gC:mi,b=r.rects.popper,y=r.elements[f?Q:h],w=JC(nn(y)?y:y.contextElement||Or(r.elements.popper),l,c,o),R=Fn(r.elements.reference),k=qh({reference:R,element:b,strategy:"absolute",placement:i}),$=il(Object.assign({},b,k)),K=h===mi?$:R,O={top:w.top-K.top+C.top,bottom:K.bottom-w.bottom+C.bottom,left:w.left-K.left+C.left,right:K.right-w.right+C.right},J=r.modifiersData.offset;if(h===mi&&J){var ie=J[i];Object.keys(O).forEach(function(ee){var le=[Jt,Kt].indexOf(ee)>=0?1:-1,_=[Ft,Kt].indexOf(ee)>=0?"y":"x";O[ee]+=ie[_]*le})}return O}function WC(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,A=l===void 0?Mh:l,c=kn(n),u=c?a?Nh:Nh.filter(function(f){return kn(f)===c}):gi,h=u.filter(function(f){return A.indexOf(f)>=0});h.length===0&&(h=u);var d=h.reduce(function(f,g){return f[g]=Ci(r,{placement:g,boundary:i,rootBoundary:s,padding:o})[fr(g)],f},{});return Object.keys(d).sort(function(f,g){return d[f]-d[g]})}function qC(r){if(fr(r)===Xa)return[];var e=Vs(r);return[Kh(r),e,Kh(e)]}function XC(r){var e=r.state,t=r.options,n=r.name;if(!e.modifiersData[n]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,A=t.padding,c=t.boundary,u=t.rootBoundary,h=t.altBoundary,d=t.flipVariations,f=d===void 0?!0:d,g=t.allowedAutoPlacements,p=e.options.placement,C=fr(p),Q=C===p,b=l||(Q||!f?[Vs(p)]:qC(p)),y=[p].concat(b).reduce(function(ce,pe){return ce.concat(fr(pe)===Xa?WC(e,{placement:pe,boundary:c,rootBoundary:u,padding:A,flipVariations:f,allowedAutoPlacements:g}):pe)},[]),w=e.rects.reference,R=e.rects.popper,k=new Map,$=!0,K=y[0],O=0;O<y.length;O++){var J=y[O],ie=fr(J),ee=kn(J)===_n,le=[Ft,Kt].indexOf(ie)>=0,_=le?"width":"height",P=Ci(e,{placement:J,boundary:c,rootBoundary:u,altBoundary:h,padding:A}),X=le?ee?Jt:kt:ee?Kt:Ft;w[_]>R[_]&&(X=Vs(X));var D=Vs(X),S=[];if(s&&S.push(P[ie]<=0),a&&S.push(P[X]<=0,P[D]<=0),S.every(function(ce){return ce})){K=J,$=!1;break}k.set(J,S)}if($)for(var F=f?3:1,W=function(pe){var ge=y.find(function(Se){var Le=k.get(Se);if(Le)return Le.slice(0,pe).every(function(Ge){return Ge})});if(ge)return K=ge,"break"},Y=F;Y>0;Y--){var ne=W(Y);if(ne==="break")break}e.placement!==K&&(e.modifiersData[n]._skip=!0,e.placement=K,e.reset=!0)}}const jC={name:"flip",enabled:!0,phase:"main",fn:XC,requiresIfExists:["offset"],data:{_skip:!1}};function Xh(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function jh(r){return[Ft,Jt,Kt,kt].some(function(e){return r[e]>=0})}function zC(r){var e=r.state,t=r.name,n=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Ci(e,{elementContext:"reference"}),a=Ci(e,{altBoundary:!0}),l=Xh(o,n),A=Xh(a,i,s),c=jh(l),u=jh(A);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:A,isReferenceHidden:c,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":u})}const ZC={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:zC};function ey(r,e,t){var n=fr(r),i=[kt,Ft].indexOf(n)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[kt,Jt].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}function ty(r){var e=r.state,t=r.options,n=r.name,i=t.offset,s=i===void 0?[0,0]:i,o=Mh.reduce(function(c,u){return c[u]=ey(u,e.rects,s),c},{}),a=o[e.placement],l=a.x,A=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=A),e.modifiersData[n]=o}const ry={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:ty};function ny(r){var e=r.state,t=r.name;e.modifiersData[t]=qh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const iy={name:"popperOffsets",enabled:!0,phase:"read",fn:ny,data:{}};function sy(r){return r==="x"?"y":"x"}function oy(r){var e=r.state,t=r.options,n=r.name,i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,A=t.rootBoundary,c=t.altBoundary,u=t.padding,h=t.tether,d=h===void 0?!0:h,f=t.tetherOffset,g=f===void 0?0:f,p=Ci(e,{boundary:l,rootBoundary:A,padding:u,altBoundary:c}),C=fr(e.placement),Q=kn(e.placement),b=!Q,y=el(C),w=sy(y),R=e.modifiersData.popperOffsets,k=e.rects.reference,$=e.rects.popper,K=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,O=typeof K=="number"?{mainAxis:K,altAxis:K}:Object.assign({mainAxis:0,altAxis:0},K),J=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ie={x:0,y:0};if(R){if(s){var ee,le=y==="y"?Ft:kt,_=y==="y"?Kt:Jt,P=y==="y"?"height":"width",X=R[y],D=X+p[le],S=X-p[_],F=d?-$[P]/2:0,W=Q===_n?k[P]:$[P],Y=Q===_n?-$[P]:-k[P],ne=e.elements.arrow,ce=d&&ne?Za(ne):{width:0,height:0},pe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Hh(),ge=pe[le],Se=pe[_],Le=Ii(0,k[P],ce[P]),Ge=b?k[P]/2-F-Le-ge-O.mainAxis:W-Le-ge-O.mainAxis,fe=b?-k[P]/2+F+Le+Se+O.mainAxis:Y+Le+Se+O.mainAxis,Qe=e.elements.arrow&&Ei(e.elements.arrow),Me=Qe?y==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,we=(ee=J==null?void 0:J[y])!=null?ee:0,We=X+Ge-we-Me,Te=X+fe-we,T=Ii(d?Hs(D,We):D,X,d?sn(S,Te):S);R[y]=T,ie[y]=T-X}if(a){var m,E=y==="x"?Ft:kt,x=y==="x"?Kt:Jt,M=R[w],z=w==="y"?"height":"width",j=M+p[E],Ie=M-p[x],be=[Ft,kt].indexOf(C)!==-1,De=(m=J==null?void 0:J[w])!=null?m:0,ke=be?j:M-k[z]-$[z]-De+O.altAxis,_e=be?M+k[z]+$[z]-De-O.altAxis:Ie,Mt=d&&be?RC(ke,M,_e):Ii(d?ke:j,M,d?_e:Ie);R[w]=Mt,ie[w]=Mt-M}e.modifiersData[n]=ie}}const ay={name:"preventOverflow",enabled:!0,phase:"main",fn:oy,requiresIfExists:["offset"]};function ly(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function Ay(r){return r===Pt(r)||!Wt(r)?tl(r):ly(r)}function cy(r){var e=r.getBoundingClientRect(),t=Ln(e.width)/r.offsetWidth||1,n=Ln(e.height)/r.offsetHeight||1;return t!==1||n!==1}function uy(r,e,t){t===void 0&&(t=!1);var n=Wt(e),i=Wt(e)&&cy(e),s=Or(e),o=Fn(r,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(n||!n&&!t)&&((dr(e)!=="body"||nl(s))&&(a=Ay(e)),Wt(e)?(l=Fn(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=rl(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function hy(r){var e=new Map,t=new Set,n=[];r.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),n.push(s)}return r.forEach(function(s){t.has(s.name)||i(s)}),n}function dy(r){var e=hy(r);return QC.reduce(function(t,n){return t.concat(e.filter(function(i){return i.phase===n}))},[])}function fy(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function gy(r){var e=r.reduce(function(t,n){var i=t[n.name];return t[n.name]=i?Object.assign({},i,n,{options:Object.assign({},i.options,n.options),data:Object.assign({},i.data,n.data)}):n,t},{});return Object.keys(e).map(function(t){return e[t]})}var zh={placement:"bottom",modifiers:[],strategy:"absolute"};function Zh(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return!e.some(function(n){return!(n&&typeof n.getBoundingClientRect=="function")})}function py(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,n=t===void 0?[]:t,i=e.defaultOptions,s=i===void 0?zh:i;return function(a,l,A){A===void 0&&(A=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},zh,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},u=[],h=!1,d={state:c,setOptions:function(C){var Q=typeof C=="function"?C(c.options):C;g(),c.options=Object.assign({},s,c.options,Q),c.scrollParents={reference:nn(a)?vi(a):a.contextElement?vi(a.contextElement):[],popper:vi(l)};var b=dy(gy([].concat(n,c.options.modifiers)));return c.orderedModifiers=b.filter(function(y){return y.enabled}),f(),d.update()},forceUpdate:function(){if(!h){var C=c.elements,Q=C.reference,b=C.popper;if(Zh(Q,b)){c.rects={reference:uy(Q,Ei(b),c.options.strategy==="fixed"),popper:Za(b)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(O){return c.modifiersData[O.name]=Object.assign({},O.data)});for(var y=0;y<c.orderedModifiers.length;y++){if(c.reset===!0){c.reset=!1,y=-1;continue}var w=c.orderedModifiers[y],R=w.fn,k=w.options,$=k===void 0?{}:k,K=w.name;typeof R=="function"&&(c=R({state:c,options:$,name:K,instance:d})||c)}}}},update:fy(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){g(),h=!0}};if(!Zh(a,l))return d;d.setOptions(A).then(function(p){!h&&A.onFirstUpdate&&A.onFirstUpdate(p)});function f(){c.orderedModifiers.forEach(function(p){var C=p.name,Q=p.options,b=Q===void 0?{}:Q,y=p.effect;if(typeof y=="function"){var w=y({state:c,name:C,instance:d,options:b}),R=function(){};u.push(w||R)}})}function g(){u.forEach(function(p){return p()}),u=[]}return d}}var my=[UC,iy,PC,Ph,ry,jC,ay,FC,ZC],Ey=py({defaultModifiers:my}),Iy="tippy-box",ed="tippy-content",vy="tippy-backdrop",td="tippy-arrow",rd="tippy-svg-arrow",on={passive:!0,capture:!0},nd=function(){return document.body};function sl(r,e,t){if(Array.isArray(r)){var n=r[e];return n??(Array.isArray(t)?t[e]:t)}return r}function ol(r,e){var t={}.toString.call(r);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function id(r,e){return typeof r=="function"?r.apply(void 0,e):r}function sd(r,e){if(e===0)return r;var t;return function(n){clearTimeout(t),t=setTimeout(function(){r(n)},e)}}function Cy(r){return r.split(/\s+/).filter(Boolean)}function Nn(r){return[].concat(r)}function od(r,e){r.indexOf(e)===-1&&r.push(e)}function yy(r){return r.filter(function(e,t){return r.indexOf(e)===t})}function By(r){return r.split("-")[0]}function Ks(r){return[].slice.call(r)}function ad(r){return Object.keys(r).reduce(function(e,t){return r[t]!==void 0&&(e[t]=r[t]),e},{})}function yi(){return document.createElement("div")}function Js(r){return["Element","Fragment"].some(function(e){return ol(r,e)})}function Ty(r){return ol(r,"NodeList")}function Qy(r){return ol(r,"MouseEvent")}function by(r){return!!(r&&r._tippy&&r._tippy.reference===r)}function xy(r){return Js(r)?[r]:Ty(r)?Ks(r):Array.isArray(r)?r:Ks(document.querySelectorAll(r))}function al(r,e){r.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function ld(r,e){r.forEach(function(t){t&&t.setAttribute("data-state",e)})}function wy(r){var e,t=Nn(r),n=t[0];return n!=null&&(e=n.ownerDocument)!=null&&e.body?n.ownerDocument:document}function Sy(r,e){var t=e.clientX,n=e.clientY;return r.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,A=By(o.placement),c=o.modifiersData.offset;if(!c)return!0;var u=A==="bottom"?c.top.y:0,h=A==="top"?c.bottom.y:0,d=A==="right"?c.left.x:0,f=A==="left"?c.right.x:0,g=s.top-n+u>l,p=n-s.bottom-h>l,C=s.left-t+d>l,Q=t-s.right-f>l;return g||p||C||Q})}function ll(r,e,t){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){r[n](i,t)})}function Ad(r,e){for(var t=e;t;){var n;if(r.contains(t))return!0;t=t.getRootNode==null||(n=t.getRootNode())==null?void 0:n.host}return!1}var gr={isTouch:!1},cd=0;function Ry(){gr.isTouch||(gr.isTouch=!0,window.performance&&document.addEventListener("mousemove",ud))}function ud(){var r=performance.now();r-cd<20&&(gr.isTouch=!1,document.removeEventListener("mousemove",ud)),cd=r}function Dy(){var r=document.activeElement;if(by(r)){var e=r._tippy;r.blur&&!e.state.isVisible&&r.blur()}}function _y(){document.addEventListener("touchstart",Ry,on),window.addEventListener("blur",Dy)}var Ly=typeof window<"u"&&typeof document<"u",Fy=Ly?!!window.msCrypto:!1,ky={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Ny={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},tr=Object.assign({appendTo:nd,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},ky,Ny),My=Object.keys(tr),Py=function(e){var t=Object.keys(e);t.forEach(function(n){tr[n]=e[n]})};function hd(r){var e=r.plugins||[],t=e.reduce(function(n,i){var s=i.name,o=i.defaultValue;if(s){var a;n[s]=r[s]!==void 0?r[s]:(a=tr[s])!=null?a:o}return n},{});return Object.assign({},r,t)}function Oy(r,e){var t=e?Object.keys(hd(Object.assign({},tr,{plugins:e}))):My,n=t.reduce(function(i,s){var o=(r.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return n}function dd(r,e){var t=Object.assign({},e,{content:id(e.content,[r])},e.ignoreAttributes?{}:Oy(r,e.plugins));return t.aria=Object.assign({},tr.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 Uy=function(){return"innerHTML"};function Al(r,e){r[Uy()]=e}function fd(r){var e=yi();return r===!0?e.className=td:(e.className=rd,Js(r)?e.appendChild(r):Al(e,r)),e}function gd(r,e){Js(e.content)?(Al(r,""),r.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Al(r,e.content):r.textContent=e.content)}function cl(r){var e=r.firstElementChild,t=Ks(e.children);return{box:e,content:t.find(function(n){return n.classList.contains(ed)}),arrow:t.find(function(n){return n.classList.contains(td)||n.classList.contains(rd)}),backdrop:t.find(function(n){return n.classList.contains(vy)})}}function pd(r){var e=yi(),t=yi();t.className=Iy,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var n=yi();n.className=ed,n.setAttribute("data-state","hidden"),gd(n,r.props),e.appendChild(t),t.appendChild(n),i(r.props,r.props);function i(s,o){var a=cl(e),l=a.box,A=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&gd(A,r.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(fd(o.arrow))):l.appendChild(fd(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}pd.$$tippy=!0;var Gy=1,Ws=[],ul=[];function Hy(r,e){var t=dd(r,Object.assign({},tr,hd(ad(e)))),n,i,s,o=!1,a=!1,l=!1,A=!1,c,u,h,d=[],f=sd(We,t.interactiveDebounce),g,p=Gy++,C=null,Q=yy(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},y={id:p,reference:r,popper:yi(),popperInstance:C,props:t,state:b,plugins:Q,clearDelayTimeouts:ke,setProps:_e,setContent:Mt,show:ut,hide:Ut,hideWithInteractivity:Er,enable:be,disable:De,unmount:Ir,destroy:Tt};if(!t.render)return y;var w=t.render(y),R=w.popper,k=w.onUpdate;R.setAttribute("data-tippy-root",""),R.id="tippy-"+y.id,y.popper=R,r._tippy=y,R._tippy=y;var $=Q.map(function(q){return q.fn(y)}),K=r.hasAttribute("aria-expanded");return Qe(),F(),X(),D("onCreate",[y]),t.showOnCreate&&j(),R.addEventListener("mouseenter",function(){y.props.interactive&&y.state.isVisible&&y.clearDelayTimeouts()}),R.addEventListener("mouseleave",function(){y.props.interactive&&y.props.trigger.indexOf("mouseenter")>=0&&le().addEventListener("mousemove",f)}),y;function O(){var q=y.props.touch;return Array.isArray(q)?q:[q,0]}function J(){return O()[0]==="hold"}function ie(){var q;return!!((q=y.props.render)!=null&&q.$$tippy)}function ee(){return g||r}function le(){var q=ee().parentNode;return q?wy(q):document}function _(){return cl(R)}function P(q){return y.state.isMounted&&!y.state.isVisible||gr.isTouch||c&&c.type==="focus"?0:sl(y.props.delay,q?0:1,tr.delay)}function X(q){q===void 0&&(q=!1),R.style.pointerEvents=y.props.interactive&&!q?"":"none",R.style.zIndex=""+y.props.zIndex}function D(q,de,ve){if(ve===void 0&&(ve=!0),$.forEach(function(Fe){Fe[q]&&Fe[q].apply(Fe,de)}),ve){var Pe;(Pe=y.props)[q].apply(Pe,de)}}function S(){var q=y.props.aria;if(q.content){var de="aria-"+q.content,ve=R.id,Pe=Nn(y.props.triggerTarget||r);Pe.forEach(function(Fe){var qe=Fe.getAttribute(de);if(y.state.isVisible)Fe.setAttribute(de,qe?qe+" "+ve:ve);else{var xt=qe&&qe.replace(ve,"").trim();xt?Fe.setAttribute(de,xt):Fe.removeAttribute(de)}})}}function F(){if(!(K||!y.props.aria.expanded)){var q=Nn(y.props.triggerTarget||r);q.forEach(function(de){y.props.interactive?de.setAttribute("aria-expanded",y.state.isVisible&&de===ee()?"true":"false"):de.removeAttribute("aria-expanded")})}}function W(){le().removeEventListener("mousemove",f),Ws=Ws.filter(function(q){return q!==f})}function Y(q){if(!(gr.isTouch&&(l||q.type==="mousedown"))){var de=q.composedPath&&q.composedPath()[0]||q.target;if(!(y.props.interactive&&Ad(R,de))){if(Nn(y.props.triggerTarget||r).some(function(ve){return Ad(ve,de)})){if(gr.isTouch||y.state.isVisible&&y.props.trigger.indexOf("click")>=0)return}else D("onClickOutside",[y,q]);y.props.hideOnClick===!0&&(y.clearDelayTimeouts(),y.hide(),a=!0,setTimeout(function(){a=!1}),y.state.isMounted||ge())}}}function ne(){l=!0}function ce(){l=!1}function pe(){var q=le();q.addEventListener("mousedown",Y,!0),q.addEventListener("touchend",Y,on),q.addEventListener("touchstart",ce,on),q.addEventListener("touchmove",ne,on)}function ge(){var q=le();q.removeEventListener("mousedown",Y,!0),q.removeEventListener("touchend",Y,on),q.removeEventListener("touchstart",ce,on),q.removeEventListener("touchmove",ne,on)}function Se(q,de){Ge(q,function(){!y.state.isVisible&&R.parentNode&&R.parentNode.contains(R)&&de()})}function Le(q,de){Ge(q,de)}function Ge(q,de){var ve=_().box;function Pe(Fe){Fe.target===ve&&(ll(ve,"remove",Pe),de())}if(q===0)return de();ll(ve,"remove",u),ll(ve,"add",Pe),u=Pe}function fe(q,de,ve){ve===void 0&&(ve=!1);var Pe=Nn(y.props.triggerTarget||r);Pe.forEach(function(Fe){Fe.addEventListener(q,de,ve),d.push({node:Fe,eventType:q,handler:de,options:ve})})}function Qe(){J()&&(fe("touchstart",we,{passive:!0}),fe("touchend",Te,{passive:!0})),Cy(y.props.trigger).forEach(function(q){if(q!=="manual")switch(fe(q,we),q){case"mouseenter":fe("mouseleave",Te);break;case"focus":fe(Fy?"focusout":"blur",T);break;case"focusin":fe("focusout",T);break}})}function Me(){d.forEach(function(q){var de=q.node,ve=q.eventType,Pe=q.handler,Fe=q.options;de.removeEventListener(ve,Pe,Fe)}),d=[]}function we(q){var de,ve=!1;if(!(!y.state.isEnabled||m(q)||a)){var Pe=((de=c)==null?void 0:de.type)==="focus";c=q,g=q.currentTarget,F(),!y.state.isVisible&&Qy(q)&&Ws.forEach(function(Fe){return Fe(q)}),q.type==="click"&&(y.props.trigger.indexOf("mouseenter")<0||o)&&y.props.hideOnClick!==!1&&y.state.isVisible?ve=!0:j(q),q.type==="click"&&(o=!ve),ve&&!Pe&&Ie(q)}}function We(q){var de=q.target,ve=ee().contains(de)||R.contains(de);if(!(q.type==="mousemove"&&ve)){var Pe=z().concat(R).map(function(Fe){var qe,xt=Fe._tippy,wt=(qe=xt.popperInstance)==null?void 0:qe.state;return wt?{popperRect:Fe.getBoundingClientRect(),popperState:wt,props:t}:null}).filter(Boolean);Sy(Pe,q)&&(W(),Ie(q))}}function Te(q){var de=m(q)||y.props.trigger.indexOf("click")>=0&&o;if(!de){if(y.props.interactive){y.hideWithInteractivity(q);return}Ie(q)}}function T(q){y.props.trigger.indexOf("focusin")<0&&q.target!==ee()||y.props.interactive&&q.relatedTarget&&R.contains(q.relatedTarget)||Ie(q)}function m(q){return gr.isTouch?J()!==q.type.indexOf("touch")>=0:!1}function E(){x();var q=y.props,de=q.popperOptions,ve=q.placement,Pe=q.offset,Fe=q.getReferenceClientRect,qe=q.moveTransition,xt=ie()?cl(R).arrow:null,wt=Fe?{getBoundingClientRect:Fe,contextElement:Fe.contextElement||ee()}:r,Gn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Hn){var Hr=Hn.state;if(ie()){var Si=_(),Ri=Si.box;["placement","reference-hidden","escaped"].forEach(function($n){$n==="placement"?Ri.setAttribute("data-placement",Hr.placement):Hr.attributes.popper["data-popper-"+$n]?Ri.setAttribute("data-"+$n,""):Ri.removeAttribute("data-"+$n)}),Hr.attributes.popper={}}}},St=[{name:"offset",options:{offset:Pe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!qe}},Gn];ie()&&xt&&St.push({name:"arrow",options:{element:xt,padding:3}}),St.push.apply(St,(de==null?void 0:de.modifiers)||[]),y.popperInstance=Ey(wt,R,Object.assign({},de,{placement:ve,onFirstUpdate:h,modifiers:St}))}function x(){y.popperInstance&&(y.popperInstance.destroy(),y.popperInstance=null)}function M(){var q=y.props.appendTo,de,ve=ee();y.props.interactive&&q===nd||q==="parent"?de=ve.parentNode:de=id(q,[ve]),de.contains(R)||de.appendChild(R),y.state.isMounted=!0,E()}function z(){return Ks(R.querySelectorAll("[data-tippy-root]"))}function j(q){y.clearDelayTimeouts(),q&&D("onTrigger",[y,q]),pe();var de=P(!0),ve=O(),Pe=ve[0],Fe=ve[1];gr.isTouch&&Pe==="hold"&&Fe&&(de=Fe),de?n=setTimeout(function(){y.show()},de):y.show()}function Ie(q){if(y.clearDelayTimeouts(),D("onUntrigger",[y,q]),!y.state.isVisible){ge();return}if(!(y.props.trigger.indexOf("mouseenter")>=0&&y.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(q.type)>=0&&o)){var de=P(!1);de?i=setTimeout(function(){y.state.isVisible&&y.hide()},de):s=requestAnimationFrame(function(){y.hide()})}}function be(){y.state.isEnabled=!0}function De(){y.hide(),y.state.isEnabled=!1}function ke(){clearTimeout(n),clearTimeout(i),cancelAnimationFrame(s)}function _e(q){if(!y.state.isDestroyed){D("onBeforeUpdate",[y,q]),Me();var de=y.props,ve=dd(r,Object.assign({},de,ad(q),{ignoreAttributes:!0}));y.props=ve,Qe(),de.interactiveDebounce!==ve.interactiveDebounce&&(W(),f=sd(We,ve.interactiveDebounce)),de.triggerTarget&&!ve.triggerTarget?Nn(de.triggerTarget).forEach(function(Pe){Pe.removeAttribute("aria-expanded")}):ve.triggerTarget&&r.removeAttribute("aria-expanded"),F(),X(),k&&k(de,ve),y.popperInstance&&(E(),z().forEach(function(Pe){requestAnimationFrame(Pe._tippy.popperInstance.forceUpdate)})),D("onAfterUpdate",[y,q])}}function Mt(q){y.setProps({content:q})}function ut(){var q=y.state.isVisible,de=y.state.isDestroyed,ve=!y.state.isEnabled,Pe=gr.isTouch&&!y.props.touch,Fe=sl(y.props.duration,0,tr.duration);if(!(q||de||ve||Pe)&&!ee().hasAttribute("disabled")&&(D("onShow",[y],!1),y.props.onShow(y)!==!1)){if(y.state.isVisible=!0,ie()&&(R.style.visibility="visible"),X(),pe(),y.state.isMounted||(R.style.transition="none"),ie()){var qe=_(),xt=qe.box,wt=qe.content;al([xt,wt],0)}h=function(){var St;if(!(!y.state.isVisible||A)){if(A=!0,R.offsetHeight,R.style.transition=y.props.moveTransition,ie()&&y.props.animation){var hn=_(),Hn=hn.box,Hr=hn.content;al([Hn,Hr],Fe),ld([Hn,Hr],"visible")}S(),F(),od(ul,y),(St=y.popperInstance)==null||St.forceUpdate(),D("onMount",[y]),y.props.animation&&ie()&&Le(Fe,function(){y.state.isShown=!0,D("onShown",[y])})}},M()}}function Ut(){var q=!y.state.isVisible,de=y.state.isDestroyed,ve=!y.state.isEnabled,Pe=sl(y.props.duration,1,tr.duration);if(!(q||de||ve)&&(D("onHide",[y],!1),y.props.onHide(y)!==!1)){if(y.state.isVisible=!1,y.state.isShown=!1,A=!1,o=!1,ie()&&(R.style.visibility="hidden"),W(),ge(),X(!0),ie()){var Fe=_(),qe=Fe.box,xt=Fe.content;y.props.animation&&(al([qe,xt],Pe),ld([qe,xt],"hidden"))}S(),F(),y.props.animation?ie()&&Se(Pe,y.unmount):y.unmount()}}function Er(q){le().addEventListener("mousemove",f),od(Ws,f),f(q)}function Ir(){y.state.isVisible&&y.hide(),y.state.isMounted&&(x(),z().forEach(function(q){q._tippy.unmount()}),R.parentNode&&R.parentNode.removeChild(R),ul=ul.filter(function(q){return q!==y}),y.state.isMounted=!1,D("onHidden",[y]))}function Tt(){y.state.isDestroyed||(y.clearDelayTimeouts(),y.unmount(),Me(),delete r._tippy,y.state.isDestroyed=!0,D("onDestroy",[y]))}}function an(r,e){e===void 0&&(e={});var t=tr.plugins.concat(e.plugins||[]);_y();var n=Object.assign({},e,{plugins:t}),i=xy(r),s=i.reduce(function(o,a){var l=a&&Hy(a,n);return l&&o.push(l),o},[]);return Js(r)?s[0]:s}an.defaultProps=tr,an.setDefaultProps=Py,an.currentInput=gr,Object.assign({},Ph,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),an.setDefaultProps({render:pd});function ln(r){const e=[];return r.renderer.type==="video"&&e.push(r.options),e.push(...r.childNodes.flatMap(ln).filter(Boolean)),e}class qs extends Error{constructor(e,t=new Error,n=!1){super(),this.fatal=!1,this.fatal=n,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const $y=5;function Yy(r,e){const t=r.map(({id:i})=>i).join("|"),n=e.map(({id:i})=>i).join("|");return t===n}class Vy{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=It(),this._controls=It(),this.host=e}set activeScenes(e){Yy(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,n,i;const s=Math.min(this.host.duration,Math.max(0,e));this.activeScenes=((t=this.host.composition)==null?void 0:t.tracks.reduce((a,l)=>a.concat(l.drawScenes.filter(({start:A,duration:c})=>s>=A&&s<A+c)),[]))??[];const o=s!==this.currentTime;this._currentTime=s,this._upcomingScenes=((n=this.host.composition)==null?void 0:n.tracks.reduce((a,l)=>a.concat(l.drawScenes.filter(({start:A})=>s>=A-$y&&s<A)),[]))??[],this.loadScenes(),this.syncVideoState(),(i=this._controls.value)==null||i.setAttribute("currentTime",s.toString()),o&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:s})),this.draw(s)}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return vt(this._canvas)}controls(){return vt(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{const{start:t,duration:n}=e,i=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;ln(e.layout.node).forEach(o=>{var a,l,A;if(o!=null&&o.key&&this.host.videos[o==null?void 0:o.key]){const c=this.host.videos[o==null?void 0:o.key],{key:u,hls:h,node:d,start:f,duration:g}=c,p=this.host.videoState[u];d&&p&&(d.currentTime>=f+g||d.ended||i&&(h?(a=h.startLoadOnce)==null||a.call(h,f):p.initialised||(l=d.startLoadOnce)==null||l.call(d)))}else if(i){const c=`${t}-${n}`,u=this.host._sceneController.videoState[c];this.host.duration&&!((A=u==null?void 0:u.buffered)!=null&&A.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[c]:{...u,buffered:[{start:Math.max(0,t/this.host.duration*100),end:Math.min((t+n)/this.host.duration*100,100)}]}})}})})}syncVideoState(){var e;(e=this.host.composition)==null||e.tracks.forEach(t=>{var n;(n=t.drawScenes)==null||n.forEach(i=>{ln(i.layout.node).forEach(o=>{if(o!=null&&o.key&&this.host.videos[o==null?void 0:o.key]){const a=this.host.videos[o==null?void 0:o.key],{key:l,node:A}=a,c=this.host.videoState[l],u=this.activeScenes.includes(i);if(A&&c)if(u&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(A.paused&&c.initialised)try{return A.play()}catch(h){throw new qs("Video play error",h,!0)}}else A.paused||A.pause()}})})})}draw(e=this.currentTime){this.host.composition&&this._canvas.value&&this.host.composition.draw({currentTime:e,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)}}async function md(r){return r.duration===1/0?new Promise(e=>{r.currentTime=Number.MAX_SAFE_INTEGER,r.ontimeupdate=()=>{r.ontimeupdate=null,e(r.duration),r.currentTime=0}}):r.duration}function Ky(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Jy(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Wy(r,e){return new Promise(async t=>{const{id:n,key:i,duration:s,startOffset:o,endOffset:a}=e,l=document.createElement("video");l.playsInline=!0,l.muted=!0,l.loop=!1,l.src=r;let A=!1;if(l.startLoadOnce=()=>{A||(l.preload="auto",l.load(),A=!0)},s){l.preload="none";const c=(o??0)*s,u=(1-(a??0))*s;t({id:n,key:i,hls:null,config:e,node:l,start:c,duration:u-c})}else{l.preload="metadata";const c=async()=>{const u=await md(l),h=(o??0)*u,d=(1-(a??0))*u;t({id:n,key:i,hls:null,config:e,node:l,start:h,duration:d-h}),l.removeEventListener("loadedmetadata",c)};l.addEventListener("loadedmetadata",c)}})}function qy(r,e){return new Promise(t=>{const{id:n,key:i,startOffset:s,endOffset:o}=e,a=document.createElement("video");a.playsInline=!0,a.muted=!0,a.loop=!1;let l=!1;const A=new wr({autoStartLoad:!0,xhrSetup:c=>{const{open:u}=c,h=r.split("?")[1];c.open=function(d,f,g){h&&!f.toString().includes("?")&&(f+="?"+h),!(!l&&f.toString().includes(".ts"))&&u.apply(this,[d,f,g])}}});A.on(wr.Events.LEVEL_LOADED,async()=>{l||A==null||A.stopLoad();const c=await md(a),u=(s??0)*c,h=(1-(o??0))*c;t({id:n,key:i,hls:A,config:e,node:a,start:u,duration:h-u})}),A.loadSource(r),A.attachMedia(a),A.startLoadOnce=(c=-1,u)=>{if(A&&!l){const h=A.levels.findIndex(d=>Math.min(d.height,d.width)===u);l=!0,A.startLevel=A.firstLevel,A.startLoad(c),A.currentLevel=h!==-1?h:A.firstLevel}}})}function Xy(r){const{src:e,playlist:t}=r;return t&&!Ky()&&wr.isSupported()?qy(t,r):Wy(e,r)}const jy=Wr(async function(e){return!(e!=null&&e.client)&&!(e!=null&&e.server)?null:new FontFace(e.family,`url(${e.client??e.server})`,{style:"normal",weight:e.weight}).load()},{cacheKey:([r])=>JSON.stringify(r)});let zy=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._composition=null,this._videos={},this._videoState={},this._delayProcessing=(t=100)=>{const n=new AbortController,i=setTimeout(()=>{n.signal.aborted||(this.host._processing=!0)},t);return n.signal.addEventListener("abort",()=>{clearTimeout(i)}),n},this._createImageResolver=Wr(async({src:t})=>t?new Promise((n,i)=>{const s=new Image;s.onload=()=>{n({image:s})},s.onerror=o=>{i(o)},s.src=t}):{image:null}),this._videoFactory=Wr(async t=>{const{id:n,key:i}=t,s=await Xy(t);s.node.volume=this.host.volume,s.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((l,A)=>{const c=A,u=o[c]({id:n,key:i,node:s.node});return l[c]=u,s.node.addEventListener(A,u),l},{});return{video:s,listeners:a,source:()=>s.node}},{cacheKey:([{id:t,key:n,src:i,playlist:s}])=>JSON.stringify({id:t,key:n,src:i==null?void 0:i.split("?")[0],playlist:s==null?void 0:s.split("?")[0]})}),this._createVideoResolver=async t=>{const{video:n,listeners:i,source:s}=await this._videoFactory(t);return this.videos={...this.videos,[t.key]:{...n,listeners:i}},this.videoState={...this.videoState,[t.key]:{initialised:!n,waiting:!!n,...this.videoState[t.key]}},{video:s}},this._handleLoadedData=({id:t,key:n,node:i})=>()=>{const s=this.videoState[n];s!=null&&s.initialised||(this.videoState={...this.videoState,[n]:{...s,initialised:!0,waiting:!1,buffered:(s==null?void 0:s.buffered)??[]}},this.setVideosCurrentTime(this.host.currentTime),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:n,node:i}})))},this._handleWaiting=({key:t})=>()=>{const n=this.videoState[t];n!=null&&n.initialised&&!(n!=null&&n.waiting)&&(this.videoState={...this.videoState,[t]:{...n,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const n=this.videoState[t];n!=null&&n.initialised&&(n!=null&&n.waiting)&&(this.videoState={...this.videoState,[t]:{...n,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=()=>()=>{},this._handleSeeking=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:n,node:i}}))},this._handleSeeked=({id:t,key:n,node:i})=>()=>{const s=this.videoState[n];s!=null&&s.initialised&&(this.host.draw(),this.host.activeScenes.flatMap(o=>ln(o.layout.node).map(({id:l})=>l)).includes(t)&&this.host.dispatchEvent(new CustomEvent("seeked",{detail:this.host.currentTime})),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:n,node:i}})))},this._handlePlay=({id:t,key:n,node:i})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:n,node:i}}))},this._handlePlaying=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:n,node:i}}))},this._handlePause=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:n,node:i}}))},this._handleStalled=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:n,node:i}}))},this._handleTimeUpdate=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:n,node:i}}))},this._handleEnded=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:n,node:i}}))},this._handleError=({id:t,key:n,node:i})=>()=>{const s=new qs(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:s,message:s.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:n,node:i}}))},this._cleanupVideo=t=>{var n;const i=this.videos[t];i&&(i.node.pause(),i.node.src="",(n=i.hls)==null||n.destroy(),Object.keys(i.listeners??{}).forEach(s=>{var o,a;if((o=this.videos)!=null&&o[t]){const l=(a=i.listeners)==null?void 0:a[s];l&&i.node.removeEventListener(s,l)}}),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 composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}set videoState(e){e!==this._videoState&&(this._videoState=e,this.host.requestUpdate())}get videoState(){return this._videoState}_setupTask(){new Oi(this.host,async([e,t])=>{var n;const i=this._delayProcessing();try{if(this.host._errors=[],(!t||!this.host._languages.find(({value:s})=>t===s))&&(this.host._language=(n=this.host._languages[0])==null?void 0:n.value),e){try{this.composition=await pc({config:e,resolvers:{text:async({font:s})=>{const o=await jy(s);return o&&document.fonts.add(o),{font:s}},image:this._createImageResolver,video:this._createVideoResolver}})}catch(s){throw new qs("Fatal composition error",s,!0)}this.duration=this.composition.duration,this.host.currentTime>this.duration?this.host.reset(this.duration,!1):this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused)}this.host.dispatchEvent(new CustomEvent("compositionupdate",{detail:this.composition,bubbles:!0,composed:!0}))}catch(s){this.composition=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:s,message:s.message}))}finally{i.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({config:this.host.config,language:this.host.language});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.config,this.host.language];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:n}=t;ln(t.layout.node).forEach(s=>{if(s!=null&&s.key&&this.videos[s==null?void 0:s.key]){const o=this.videos[s==null?void 0:s.key],a=e-n;o.node.currentTime=Math.max(o.start,Math.min(o.start+o.duration,a+o.start))}})}setVideosCurrentTime(e){var t;(t=this.composition)==null||t.tracks.forEach(n=>{n.drawScenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function Zy(r){r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen&&r.msRequestFullscreen()}function eB(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const hl=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],tB={id:"captions",event:"captions:click",label:"Closed Captions"},rB={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Ed={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}]},nB={id:"playbackRate",label:"Playback playbackRate",subItems:Ed};class iB extends Xl{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==gn.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)),Xt}}const dl=pn(iB),sB=dC(()=>{const r=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert","url(https://vouch-clients.s3.ap-southeast-2.amazonaws.com/vouch/fonts/Roobert-Bold.woff2",{style:"normal",weight:"700"}),n=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=oc.map(s=>({load:!1,font:new FontFace(s.family,`url(${s.url})`,{style:s.style})}));return[{load:!0,font:r},{load:!0,font:e},{load:!0,font:t},{load:!0,font:n},...i]}),pr={"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"},oB={colors:pr,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 ${pr["dark-100"]}`,medium:`0 .125rem .625rem ${pr["dark-100"]}`,large:`0 .25rem 1rem ${pr["dark-50"]}`,xl:`.25rem .25rem 1rem ${pr["dark-250"]}`,xxl:`0 .25rem 2rem ${pr["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${pr["dark-250"]}`,toolbar:`0 -.625rem .625rem ${pr["dark-50"]}`,text:`0 0 .25rem ${pr["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:pr["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Id=cC(oB,{delimiter:"-"}),aB=Object.keys(Id).map(r=>Yn(`:host { --${r}: ${Id[r]}; }`)),$e=(r=>{const e=class extends r{firstUpdated(){sB().forEach(({load:s,font:o})=>{document.fonts.add(o),s&&o.load()})}};return e.styles=[(r==null?void 0:r.styles)??[],aB,lt`
2492
+ */const Lh=(r,e,t)=>{const n=new Map;for(let i=e;i<=t;i++)n.set(r[i],i);return n},Fh=pn(class extends Zn{constructor(r){if(super(r),r.type!==gn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);const i=[],s=[];let o=0;for(const a of r)i[o]=n?n(a,o):o,s[o]=t(a,o),o++;return{values:s,keys:i}}render(r,e,t){return this.dt(r,e,t).values}update(r,[e,t,n]){const i=nf(r),{values:s,keys:o}=this.dt(e,t,n);if(!Array.isArray(i))return this.ut=o,s;const a=this.ut??(this.ut=[]),l=[];let A,c,u=0,h=i.length-1,d=0,f=s.length-1;for(;u<=h&&d<=f;)if(i[u]===null)u++;else if(i[h]===null)h--;else if(a[u]===o[d])l[d]=Jr(i[u],s[d]),u++,d++;else if(a[h]===o[f])l[f]=Jr(i[h],s[f]),h--,f--;else if(a[u]===o[f])l[f]=Jr(i[u],s[f]),zn(r,l[f+1],i[u]),u++,f--;else if(a[h]===o[d])l[d]=Jr(i[h],s[d]),zn(r,i[u],i[h]),h--,d++;else if(A===void 0&&(A=Lh(o,d,f),c=Lh(a,u,h)),A.has(a[u]))if(A.has(a[h])){const g=c.get(o[d]),p=g!==void 0?i[g]:null;if(p===null){const y=zn(r,i[u]);Jr(y,s[d]),l[d]=y}else l[d]=Jr(p,s[d]),zn(r,i[u],p),i[g]=null;d++}else ho(i[h]),h--;else ho(i[u]),u++;for(;d<=f;){const g=zn(r,l[f+1]);Jr(g,s[d]),l[d++]=g}for(;u<=h;){const g=i[u++];g!==null&&ho(g)}return this.ut=o,rf(r,l),Xt}});var Ft="top",Kt="bottom",Jt="right",kt="left",Xa="auto",gi=[Ft,Kt,Jt,kt],_n="start",pi="end",fC="clippingParents",kh="viewport",mi="popper",gC="reference",Nh=gi.reduce(function(r,e){return r.concat([e+"-"+_n,e+"-"+pi])},[]),Mh=[].concat(gi,[Xa]).reduce(function(r,e){return r.concat([e,e+"-"+_n,e+"-"+pi])},[]),pC="beforeRead",mC="read",EC="afterRead",IC="beforeMain",vC="main",CC="afterMain",yC="beforeWrite",BC="write",TC="afterWrite",QC=[pC,mC,EC,IC,vC,CC,yC,BC,TC];function dr(r){return r?(r.nodeName||"").toLowerCase():null}function Pt(r){if(r==null)return window;if(r.toString()!=="[object Window]"){var e=r.ownerDocument;return e&&e.defaultView||window}return r}function nn(r){var e=Pt(r).Element;return r instanceof e||r instanceof Element}function Wt(r){var e=Pt(r).HTMLElement;return r instanceof e||r instanceof HTMLElement}function ja(r){if(typeof ShadowRoot>"u")return!1;var e=Pt(r).ShadowRoot;return r instanceof e||r instanceof ShadowRoot}function bC(r){var e=r.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},s=e.elements[t];!Wt(s)||!dr(s)||(Object.assign(s.style,n),Object.keys(i).forEach(function(o){var a=i[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function xC(r){var e=r.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(n){var i=e.elements[n],s=e.attributes[n]||{},o=Object.keys(e.styles.hasOwnProperty(n)?e.styles[n]:t[n]),a=o.reduce(function(l,A){return l[A]="",l},{});!Wt(i)||!dr(i)||(Object.assign(i.style,a),Object.keys(s).forEach(function(l){i.removeAttribute(l)}))})}}const Ph={name:"applyStyles",enabled:!0,phase:"write",fn:bC,effect:xC,requires:["computeStyles"]};function fr(r){return r.split("-")[0]}var sn=Math.max,Hs=Math.min,Ln=Math.round;function za(){var r=navigator.userAgentData;return r!=null&&r.brands&&Array.isArray(r.brands)?r.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Oh(){return!/^((?!chrome|android).)*safari/i.test(za())}function Fn(r,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var n=r.getBoundingClientRect(),i=1,s=1;e&&Wt(r)&&(i=r.offsetWidth>0&&Ln(n.width)/r.offsetWidth||1,s=r.offsetHeight>0&&Ln(n.height)/r.offsetHeight||1);var o=nn(r)?Pt(r):window,a=o.visualViewport,l=!Oh()&&t,A=(n.left+(l&&a?a.offsetLeft:0))/i,c=(n.top+(l&&a?a.offsetTop:0))/s,u=n.width/i,h=n.height/s;return{width:u,height:h,top:c,right:A+u,bottom:c+h,left:A,x:A,y:c}}function Za(r){var e=Fn(r),t=r.offsetWidth,n=r.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:r.offsetLeft,y:r.offsetTop,width:t,height:n}}function Uh(r,e){var t=e.getRootNode&&e.getRootNode();if(r.contains(e))return!0;if(t&&ja(t)){var n=e;do{if(n&&r.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Sr(r){return Pt(r).getComputedStyle(r)}function wC(r){return["table","td","th"].indexOf(dr(r))>=0}function Or(r){return((nn(r)?r.ownerDocument:r.document)||window.document).documentElement}function $s(r){return dr(r)==="html"?r:r.assignedSlot||r.parentNode||(ja(r)?r.host:null)||Or(r)}function Gh(r){return!Wt(r)||Sr(r).position==="fixed"?null:r.offsetParent}function SC(r){var e=/firefox/i.test(za()),t=/Trident/i.test(za());if(t&&Wt(r)){var n=Sr(r);if(n.position==="fixed")return null}var i=$s(r);for(ja(i)&&(i=i.host);Wt(i)&&["html","body"].indexOf(dr(i))<0;){var s=Sr(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function Ei(r){for(var e=Pt(r),t=Gh(r);t&&wC(t)&&Sr(t).position==="static";)t=Gh(t);return t&&(dr(t)==="html"||dr(t)==="body"&&Sr(t).position==="static")?e:t||SC(r)||e}function el(r){return["top","bottom"].indexOf(r)>=0?"x":"y"}function Ii(r,e,t){return sn(r,Hs(e,t))}function RC(r,e,t){var n=Ii(r,e,t);return n>t?t:n}function Hh(){return{top:0,right:0,bottom:0,left:0}}function $h(r){return Object.assign({},Hh(),r)}function Yh(r,e){return e.reduce(function(t,n){return t[n]=r,t},{})}var DC=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,$h(typeof e!="number"?e:Yh(e,gi))};function _C(r){var e,t=r.state,n=r.name,i=r.options,s=t.elements.arrow,o=t.modifiersData.popperOffsets,a=fr(t.placement),l=el(a),A=[kt,Jt].indexOf(a)>=0,c=A?"height":"width";if(!(!s||!o)){var u=DC(i.padding,t),h=Za(s),d=l==="y"?Ft:kt,f=l==="y"?Kt:Jt,g=t.rects.reference[c]+t.rects.reference[l]-o[l]-t.rects.popper[c],p=o[l]-t.rects.reference[l],y=Ei(s),Q=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,b=g/2-p/2,C=u[d],w=Q-h[c]-u[f],R=Q/2-h[c]/2+b,k=Ii(C,R,w),$=l;t.modifiersData[n]=(e={},e[$]=k,e.centerOffset=k-R,e)}}function LC(r){var e=r.state,t=r.options,n=t.element,i=n===void 0?"[data-popper-arrow]":n;i!=null&&(typeof i=="string"&&(i=e.elements.popper.querySelector(i),!i)||Uh(e.elements.popper,i)&&(e.elements.arrow=i))}const FC={name:"arrow",enabled:!0,phase:"main",fn:_C,effect:LC,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function kn(r){return r.split("-")[1]}var kC={top:"auto",right:"auto",bottom:"auto",left:"auto"};function NC(r,e){var t=r.x,n=r.y,i=e.devicePixelRatio||1;return{x:Ln(t*i)/i||0,y:Ln(n*i)/i||0}}function Vh(r){var e,t=r.popper,n=r.popperRect,i=r.placement,s=r.variation,o=r.offsets,a=r.position,l=r.gpuAcceleration,A=r.adaptive,c=r.roundOffsets,u=r.isFixed,h=o.x,d=h===void 0?0:h,f=o.y,g=f===void 0?0:f,p=typeof c=="function"?c({x:d,y:g}):{x:d,y:g};d=p.x,g=p.y;var y=o.hasOwnProperty("x"),Q=o.hasOwnProperty("y"),b=kt,C=Ft,w=window;if(A){var R=Ei(t),k="clientHeight",$="clientWidth";if(R===Pt(t)&&(R=Or(t),Sr(R).position!=="static"&&a==="absolute"&&(k="scrollHeight",$="scrollWidth")),R=R,i===Ft||(i===kt||i===Jt)&&s===pi){C=Kt;var V=u&&R===w&&w.visualViewport?w.visualViewport.height:R[k];g-=V-n.height,g*=l?1:-1}if(i===kt||(i===Ft||i===Kt)&&s===pi){b=Jt;var O=u&&R===w&&w.visualViewport?w.visualViewport.width:R[$];d-=O-n.width,d*=l?1:-1}}var W=Object.assign({position:a},A&&kC),ie=c===!0?NC({x:d,y:g},Pt(t)):{x:d,y:g};if(d=ie.x,g=ie.y,l){var te;return Object.assign({},W,(te={},te[C]=Q?"0":"",te[b]=y?"0":"",te.transform=(w.devicePixelRatio||1)<=1?"translate("+d+"px, "+g+"px)":"translate3d("+d+"px, "+g+"px, 0)",te))}return Object.assign({},W,(e={},e[C]=Q?g+"px":"",e[b]=y?d+"px":"",e.transform="",e))}function MC(r){var e=r.state,t=r.options,n=t.gpuAcceleration,i=n===void 0?!0:n,s=t.adaptive,o=s===void 0?!0:s,a=t.roundOffsets,l=a===void 0?!0:a,A={placement:fr(e.placement),variation:kn(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Vh(Object.assign({},A,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Vh(Object.assign({},A,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const PC={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:MC,data:{}};var Ys={passive:!0};function OC(r){var e=r.state,t=r.instance,n=r.options,i=n.scroll,s=i===void 0?!0:i,o=n.resize,a=o===void 0?!0:o,l=Pt(e.elements.popper),A=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&A.forEach(function(c){c.addEventListener("scroll",t.update,Ys)}),a&&l.addEventListener("resize",t.update,Ys),function(){s&&A.forEach(function(c){c.removeEventListener("scroll",t.update,Ys)}),a&&l.removeEventListener("resize",t.update,Ys)}}const UC={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:OC,data:{}};var GC={left:"right",right:"left",bottom:"top",top:"bottom"};function Vs(r){return r.replace(/left|right|bottom|top/g,function(e){return GC[e]})}var HC={start:"end",end:"start"};function Kh(r){return r.replace(/start|end/g,function(e){return HC[e]})}function tl(r){var e=Pt(r),t=e.pageXOffset,n=e.pageYOffset;return{scrollLeft:t,scrollTop:n}}function rl(r){return Fn(Or(r)).left+tl(r).scrollLeft}function $C(r,e){var t=Pt(r),n=Or(r),i=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;var A=Oh();(A||!A&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a+rl(r),y:l}}function YC(r){var e,t=Or(r),n=tl(r),i=(e=r.ownerDocument)==null?void 0:e.body,s=sn(t.scrollWidth,t.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),o=sn(t.scrollHeight,t.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-n.scrollLeft+rl(r),l=-n.scrollTop;return Sr(i||t).direction==="rtl"&&(a+=sn(t.clientWidth,i?i.clientWidth:0)-s),{width:s,height:o,x:a,y:l}}function nl(r){var e=Sr(r),t=e.overflow,n=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+i+n)}function Jh(r){return["html","body","#document"].indexOf(dr(r))>=0?r.ownerDocument.body:Wt(r)&&nl(r)?r:Jh($s(r))}function vi(r,e){var t;e===void 0&&(e=[]);var n=Jh(r),i=n===((t=r.ownerDocument)==null?void 0:t.body),s=Pt(n),o=i?[s].concat(s.visualViewport||[],nl(n)?n:[]):n,a=e.concat(o);return i?a:a.concat(vi($s(o)))}function il(r){return Object.assign({},r,{left:r.x,top:r.y,right:r.x+r.width,bottom:r.y+r.height})}function VC(r,e){var t=Fn(r,!1,e==="fixed");return t.top=t.top+r.clientTop,t.left=t.left+r.clientLeft,t.bottom=t.top+r.clientHeight,t.right=t.left+r.clientWidth,t.width=r.clientWidth,t.height=r.clientHeight,t.x=t.left,t.y=t.top,t}function Wh(r,e,t){return e===kh?il($C(r,t)):nn(e)?VC(e,t):il(YC(Or(r)))}function KC(r){var e=vi($s(r)),t=["absolute","fixed"].indexOf(Sr(r).position)>=0,n=t&&Wt(r)?Ei(r):r;return nn(n)?e.filter(function(i){return nn(i)&&Uh(i,n)&&dr(i)!=="body"}):[]}function JC(r,e,t,n){var i=e==="clippingParents"?KC(r):[].concat(e),s=[].concat(i,[t]),o=s[0],a=s.reduce(function(l,A){var c=Wh(r,A,n);return l.top=sn(c.top,l.top),l.right=Hs(c.right,l.right),l.bottom=Hs(c.bottom,l.bottom),l.left=sn(c.left,l.left),l},Wh(r,o,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function qh(r){var e=r.reference,t=r.element,n=r.placement,i=n?fr(n):null,s=n?kn(n):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(i){case Ft:l={x:o,y:e.y-t.height};break;case Kt:l={x:o,y:e.y+e.height};break;case Jt:l={x:e.x+e.width,y:a};break;case kt:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var A=i?el(i):null;if(A!=null){var c=A==="y"?"height":"width";switch(s){case _n:l[A]=l[A]-(e[c]/2-t[c]/2);break;case pi:l[A]=l[A]+(e[c]/2-t[c]/2);break}}return l}function Ci(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=n===void 0?r.placement:n,s=t.strategy,o=s===void 0?r.strategy:s,a=t.boundary,l=a===void 0?fC:a,A=t.rootBoundary,c=A===void 0?kh:A,u=t.elementContext,h=u===void 0?mi:u,d=t.altBoundary,f=d===void 0?!1:d,g=t.padding,p=g===void 0?0:g,y=$h(typeof p!="number"?p:Yh(p,gi)),Q=h===mi?gC:mi,b=r.rects.popper,C=r.elements[f?Q:h],w=JC(nn(C)?C:C.contextElement||Or(r.elements.popper),l,c,o),R=Fn(r.elements.reference),k=qh({reference:R,element:b,strategy:"absolute",placement:i}),$=il(Object.assign({},b,k)),V=h===mi?$:R,O={top:w.top-V.top+y.top,bottom:V.bottom-w.bottom+y.bottom,left:w.left-V.left+y.left,right:V.right-w.right+y.right},W=r.modifiersData.offset;if(h===mi&&W){var ie=W[i];Object.keys(O).forEach(function(te){var le=[Jt,Kt].indexOf(te)>=0?1:-1,D=[Ft,Kt].indexOf(te)>=0?"y":"x";O[te]+=ie[D]*le})}return O}function WC(r,e){e===void 0&&(e={});var t=e,n=t.placement,i=t.boundary,s=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,A=l===void 0?Mh:l,c=kn(n),u=c?a?Nh:Nh.filter(function(f){return kn(f)===c}):gi,h=u.filter(function(f){return A.indexOf(f)>=0});h.length===0&&(h=u);var d=h.reduce(function(f,g){return f[g]=Ci(r,{placement:g,boundary:i,rootBoundary:s,padding:o})[fr(g)],f},{});return Object.keys(d).sort(function(f,g){return d[f]-d[g]})}function qC(r){if(fr(r)===Xa)return[];var e=Vs(r);return[Kh(r),e,Kh(e)]}function XC(r){var e=r.state,t=r.options,n=r.name;if(!e.modifiersData[n]._skip){for(var i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,A=t.padding,c=t.boundary,u=t.rootBoundary,h=t.altBoundary,d=t.flipVariations,f=d===void 0?!0:d,g=t.allowedAutoPlacements,p=e.options.placement,y=fr(p),Q=y===p,b=l||(Q||!f?[Vs(p)]:qC(p)),C=[p].concat(b).reduce(function(ce,pe){return ce.concat(fr(pe)===Xa?WC(e,{placement:pe,boundary:c,rootBoundary:u,padding:A,flipVariations:f,allowedAutoPlacements:g}):pe)},[]),w=e.rects.reference,R=e.rects.popper,k=new Map,$=!0,V=C[0],O=0;O<C.length;O++){var W=C[O],ie=fr(W),te=kn(W)===_n,le=[Ft,Kt].indexOf(ie)>=0,D=le?"width":"height",P=Ci(e,{placement:W,boundary:c,rootBoundary:u,altBoundary:h,padding:A}),X=le?te?Jt:kt:te?Kt:Ft;w[D]>R[D]&&(X=Vs(X));var _=Vs(X),S=[];if(s&&S.push(P[ie]<=0),a&&S.push(P[X]<=0,P[_]<=0),S.every(function(ce){return ce})){V=W,$=!1;break}k.set(W,S)}if($)for(var F=f?3:1,J=function(pe){var ge=C.find(function(Se){var Le=k.get(Se);if(Le)return Le.slice(0,pe).every(function(Ge){return Ge})});if(ge)return V=ge,"break"},Y=F;Y>0;Y--){var ne=J(Y);if(ne==="break")break}e.placement!==V&&(e.modifiersData[n]._skip=!0,e.placement=V,e.reset=!0)}}const jC={name:"flip",enabled:!0,phase:"main",fn:XC,requiresIfExists:["offset"],data:{_skip:!1}};function Xh(r,e,t){return t===void 0&&(t={x:0,y:0}),{top:r.top-e.height-t.y,right:r.right-e.width+t.x,bottom:r.bottom-e.height+t.y,left:r.left-e.width-t.x}}function jh(r){return[Ft,Jt,Kt,kt].some(function(e){return r[e]>=0})}function zC(r){var e=r.state,t=r.name,n=e.rects.reference,i=e.rects.popper,s=e.modifiersData.preventOverflow,o=Ci(e,{elementContext:"reference"}),a=Ci(e,{altBoundary:!0}),l=Xh(o,n),A=Xh(a,i,s),c=jh(l),u=jh(A);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:A,isReferenceHidden:c,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":u})}const ZC={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:zC};function ey(r,e,t){var n=fr(r),i=[kt,Ft].indexOf(n)>=0?-1:1,s=typeof t=="function"?t(Object.assign({},e,{placement:r})):t,o=s[0],a=s[1];return o=o||0,a=(a||0)*i,[kt,Jt].indexOf(n)>=0?{x:a,y:o}:{x:o,y:a}}function ty(r){var e=r.state,t=r.options,n=r.name,i=t.offset,s=i===void 0?[0,0]:i,o=Mh.reduce(function(c,u){return c[u]=ey(u,e.rects,s),c},{}),a=o[e.placement],l=a.x,A=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=A),e.modifiersData[n]=o}const ry={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:ty};function ny(r){var e=r.state,t=r.name;e.modifiersData[t]=qh({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const iy={name:"popperOffsets",enabled:!0,phase:"read",fn:ny,data:{}};function sy(r){return r==="x"?"y":"x"}function oy(r){var e=r.state,t=r.options,n=r.name,i=t.mainAxis,s=i===void 0?!0:i,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,A=t.rootBoundary,c=t.altBoundary,u=t.padding,h=t.tether,d=h===void 0?!0:h,f=t.tetherOffset,g=f===void 0?0:f,p=Ci(e,{boundary:l,rootBoundary:A,padding:u,altBoundary:c}),y=fr(e.placement),Q=kn(e.placement),b=!Q,C=el(y),w=sy(C),R=e.modifiersData.popperOffsets,k=e.rects.reference,$=e.rects.popper,V=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,O=typeof V=="number"?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),W=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ie={x:0,y:0};if(R){if(s){var te,le=C==="y"?Ft:kt,D=C==="y"?Kt:Jt,P=C==="y"?"height":"width",X=R[C],_=X+p[le],S=X-p[D],F=d?-$[P]/2:0,J=Q===_n?k[P]:$[P],Y=Q===_n?-$[P]:-k[P],ne=e.elements.arrow,ce=d&&ne?Za(ne):{width:0,height:0},pe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Hh(),ge=pe[le],Se=pe[D],Le=Ii(0,k[P],ce[P]),Ge=b?k[P]/2-F-Le-ge-O.mainAxis:J-Le-ge-O.mainAxis,fe=b?-k[P]/2+F+Le+Se+O.mainAxis:Y+Le+Se+O.mainAxis,Qe=e.elements.arrow&&Ei(e.elements.arrow),Me=Qe?C==="y"?Qe.clientTop||0:Qe.clientLeft||0:0,we=(te=W==null?void 0:W[C])!=null?te:0,qe=X+Ge-we-Me,Te=X+fe-we,T=Ii(d?Hs(_,qe):_,X,d?sn(S,Te):S);R[C]=T,ie[C]=T-X}if(a){var m,E=C==="x"?Ft:kt,x=C==="x"?Kt:Jt,M=R[w],z=w==="y"?"height":"width",j=M+p[E],Ie=M-p[x],be=[Ft,kt].indexOf(y)!==-1,De=(m=W==null?void 0:W[w])!=null?m:0,ke=be?j:M-k[z]-$[z]-De+O.altAxis,_e=be?M+k[z]+$[z]-De-O.altAxis:Ie,Mt=d&&be?RC(ke,M,_e):Ii(d?ke:j,M,d?_e:Ie);R[w]=Mt,ie[w]=Mt-M}e.modifiersData[n]=ie}}const ay={name:"preventOverflow",enabled:!0,phase:"main",fn:oy,requiresIfExists:["offset"]};function ly(r){return{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}}function Ay(r){return r===Pt(r)||!Wt(r)?tl(r):ly(r)}function cy(r){var e=r.getBoundingClientRect(),t=Ln(e.width)/r.offsetWidth||1,n=Ln(e.height)/r.offsetHeight||1;return t!==1||n!==1}function uy(r,e,t){t===void 0&&(t=!1);var n=Wt(e),i=Wt(e)&&cy(e),s=Or(e),o=Fn(r,i,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(n||!n&&!t)&&((dr(e)!=="body"||nl(s))&&(a=Ay(e)),Wt(e)?(l=Fn(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):s&&(l.x=rl(s))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function hy(r){var e=new Map,t=new Set,n=[];r.forEach(function(s){e.set(s.name,s)});function i(s){t.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&i(l)}}),n.push(s)}return r.forEach(function(s){t.has(s.name)||i(s)}),n}function dy(r){var e=hy(r);return QC.reduce(function(t,n){return t.concat(e.filter(function(i){return i.phase===n}))},[])}function fy(r){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(r())})})),e}}function gy(r){var e=r.reduce(function(t,n){var i=t[n.name];return t[n.name]=i?Object.assign({},i,n,{options:Object.assign({},i.options,n.options),data:Object.assign({},i.data,n.data)}):n,t},{});return Object.keys(e).map(function(t){return e[t]})}var zh={placement:"bottom",modifiers:[],strategy:"absolute"};function Zh(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return!e.some(function(n){return!(n&&typeof n.getBoundingClientRect=="function")})}function py(r){r===void 0&&(r={});var e=r,t=e.defaultModifiers,n=t===void 0?[]:t,i=e.defaultOptions,s=i===void 0?zh:i;return function(a,l,A){A===void 0&&(A=s);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},zh,s),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},u=[],h=!1,d={state:c,setOptions:function(y){var Q=typeof y=="function"?y(c.options):y;g(),c.options=Object.assign({},s,c.options,Q),c.scrollParents={reference:nn(a)?vi(a):a.contextElement?vi(a.contextElement):[],popper:vi(l)};var b=dy(gy([].concat(n,c.options.modifiers)));return c.orderedModifiers=b.filter(function(C){return C.enabled}),f(),d.update()},forceUpdate:function(){if(!h){var y=c.elements,Q=y.reference,b=y.popper;if(Zh(Q,b)){c.rects={reference:uy(Q,Ei(b),c.options.strategy==="fixed"),popper:Za(b)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(O){return c.modifiersData[O.name]=Object.assign({},O.data)});for(var C=0;C<c.orderedModifiers.length;C++){if(c.reset===!0){c.reset=!1,C=-1;continue}var w=c.orderedModifiers[C],R=w.fn,k=w.options,$=k===void 0?{}:k,V=w.name;typeof R=="function"&&(c=R({state:c,options:$,name:V,instance:d})||c)}}}},update:fy(function(){return new Promise(function(p){d.forceUpdate(),p(c)})}),destroy:function(){g(),h=!0}};if(!Zh(a,l))return d;d.setOptions(A).then(function(p){!h&&A.onFirstUpdate&&A.onFirstUpdate(p)});function f(){c.orderedModifiers.forEach(function(p){var y=p.name,Q=p.options,b=Q===void 0?{}:Q,C=p.effect;if(typeof C=="function"){var w=C({state:c,name:y,instance:d,options:b}),R=function(){};u.push(w||R)}})}function g(){u.forEach(function(p){return p()}),u=[]}return d}}var my=[UC,iy,PC,Ph,ry,jC,ay,FC,ZC],Ey=py({defaultModifiers:my}),Iy="tippy-box",ed="tippy-content",vy="tippy-backdrop",td="tippy-arrow",rd="tippy-svg-arrow",on={passive:!0,capture:!0},nd=function(){return document.body};function sl(r,e,t){if(Array.isArray(r)){var n=r[e];return n??(Array.isArray(t)?t[e]:t)}return r}function ol(r,e){var t={}.toString.call(r);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function id(r,e){return typeof r=="function"?r.apply(void 0,e):r}function sd(r,e){if(e===0)return r;var t;return function(n){clearTimeout(t),t=setTimeout(function(){r(n)},e)}}function Cy(r){return r.split(/\s+/).filter(Boolean)}function Nn(r){return[].concat(r)}function od(r,e){r.indexOf(e)===-1&&r.push(e)}function yy(r){return r.filter(function(e,t){return r.indexOf(e)===t})}function By(r){return r.split("-")[0]}function Ks(r){return[].slice.call(r)}function ad(r){return Object.keys(r).reduce(function(e,t){return r[t]!==void 0&&(e[t]=r[t]),e},{})}function yi(){return document.createElement("div")}function Js(r){return["Element","Fragment"].some(function(e){return ol(r,e)})}function Ty(r){return ol(r,"NodeList")}function Qy(r){return ol(r,"MouseEvent")}function by(r){return!!(r&&r._tippy&&r._tippy.reference===r)}function xy(r){return Js(r)?[r]:Ty(r)?Ks(r):Array.isArray(r)?r:Ks(document.querySelectorAll(r))}function al(r,e){r.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function ld(r,e){r.forEach(function(t){t&&t.setAttribute("data-state",e)})}function wy(r){var e,t=Nn(r),n=t[0];return n!=null&&(e=n.ownerDocument)!=null&&e.body?n.ownerDocument:document}function Sy(r,e){var t=e.clientX,n=e.clientY;return r.every(function(i){var s=i.popperRect,o=i.popperState,a=i.props,l=a.interactiveBorder,A=By(o.placement),c=o.modifiersData.offset;if(!c)return!0;var u=A==="bottom"?c.top.y:0,h=A==="top"?c.bottom.y:0,d=A==="right"?c.left.x:0,f=A==="left"?c.right.x:0,g=s.top-n+u>l,p=n-s.bottom-h>l,y=s.left-t+d>l,Q=t-s.right-f>l;return g||p||y||Q})}function ll(r,e,t){var n=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(i){r[n](i,t)})}function Ad(r,e){for(var t=e;t;){var n;if(r.contains(t))return!0;t=t.getRootNode==null||(n=t.getRootNode())==null?void 0:n.host}return!1}var gr={isTouch:!1},cd=0;function Ry(){gr.isTouch||(gr.isTouch=!0,window.performance&&document.addEventListener("mousemove",ud))}function ud(){var r=performance.now();r-cd<20&&(gr.isTouch=!1,document.removeEventListener("mousemove",ud)),cd=r}function Dy(){var r=document.activeElement;if(by(r)){var e=r._tippy;r.blur&&!e.state.isVisible&&r.blur()}}function _y(){document.addEventListener("touchstart",Ry,on),window.addEventListener("blur",Dy)}var Ly=typeof window<"u"&&typeof document<"u",Fy=Ly?!!window.msCrypto:!1,ky={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},Ny={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},tr=Object.assign({appendTo:nd,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},ky,Ny),My=Object.keys(tr),Py=function(e){var t=Object.keys(e);t.forEach(function(n){tr[n]=e[n]})};function hd(r){var e=r.plugins||[],t=e.reduce(function(n,i){var s=i.name,o=i.defaultValue;if(s){var a;n[s]=r[s]!==void 0?r[s]:(a=tr[s])!=null?a:o}return n},{});return Object.assign({},r,t)}function Oy(r,e){var t=e?Object.keys(hd(Object.assign({},tr,{plugins:e}))):My,n=t.reduce(function(i,s){var o=(r.getAttribute("data-tippy-"+s)||"").trim();if(!o)return i;if(s==="content")i[s]=o;else try{i[s]=JSON.parse(o)}catch{i[s]=o}return i},{});return n}function dd(r,e){var t=Object.assign({},e,{content:id(e.content,[r])},e.ignoreAttributes?{}:Oy(r,e.plugins));return t.aria=Object.assign({},tr.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 Uy=function(){return"innerHTML"};function Al(r,e){r[Uy()]=e}function fd(r){var e=yi();return r===!0?e.className=td:(e.className=rd,Js(r)?e.appendChild(r):Al(e,r)),e}function gd(r,e){Js(e.content)?(Al(r,""),r.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Al(r,e.content):r.textContent=e.content)}function cl(r){var e=r.firstElementChild,t=Ks(e.children);return{box:e,content:t.find(function(n){return n.classList.contains(ed)}),arrow:t.find(function(n){return n.classList.contains(td)||n.classList.contains(rd)}),backdrop:t.find(function(n){return n.classList.contains(vy)})}}function pd(r){var e=yi(),t=yi();t.className=Iy,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var n=yi();n.className=ed,n.setAttribute("data-state","hidden"),gd(n,r.props),e.appendChild(t),t.appendChild(n),i(r.props,r.props);function i(s,o){var a=cl(e),l=a.box,A=a.content,c=a.arrow;o.theme?l.setAttribute("data-theme",o.theme):l.removeAttribute("data-theme"),typeof o.animation=="string"?l.setAttribute("data-animation",o.animation):l.removeAttribute("data-animation"),o.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof o.maxWidth=="number"?o.maxWidth+"px":o.maxWidth,o.role?l.setAttribute("role",o.role):l.removeAttribute("role"),(s.content!==o.content||s.allowHTML!==o.allowHTML)&&gd(A,r.props),o.arrow?c?s.arrow!==o.arrow&&(l.removeChild(c),l.appendChild(fd(o.arrow))):l.appendChild(fd(o.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:i}}pd.$$tippy=!0;var Gy=1,Ws=[],ul=[];function Hy(r,e){var t=dd(r,Object.assign({},tr,hd(ad(e)))),n,i,s,o=!1,a=!1,l=!1,A=!1,c,u,h,d=[],f=sd(qe,t.interactiveDebounce),g,p=Gy++,y=null,Q=yy(t.plugins),b={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},C={id:p,reference:r,popper:yi(),popperInstance:y,props:t,state:b,plugins:Q,clearDelayTimeouts:ke,setProps:_e,setContent:Mt,show:ut,hide:Ut,hideWithInteractivity:Er,enable:be,disable:De,unmount:Ir,destroy:Tt};if(!t.render)return C;var w=t.render(C),R=w.popper,k=w.onUpdate;R.setAttribute("data-tippy-root",""),R.id="tippy-"+C.id,C.popper=R,r._tippy=C,R._tippy=C;var $=Q.map(function(q){return q.fn(C)}),V=r.hasAttribute("aria-expanded");return Qe(),F(),X(),_("onCreate",[C]),t.showOnCreate&&j(),R.addEventListener("mouseenter",function(){C.props.interactive&&C.state.isVisible&&C.clearDelayTimeouts()}),R.addEventListener("mouseleave",function(){C.props.interactive&&C.props.trigger.indexOf("mouseenter")>=0&&le().addEventListener("mousemove",f)}),C;function O(){var q=C.props.touch;return Array.isArray(q)?q:[q,0]}function W(){return O()[0]==="hold"}function ie(){var q;return!!((q=C.props.render)!=null&&q.$$tippy)}function te(){return g||r}function le(){var q=te().parentNode;return q?wy(q):document}function D(){return cl(R)}function P(q){return C.state.isMounted&&!C.state.isVisible||gr.isTouch||c&&c.type==="focus"?0:sl(C.props.delay,q?0:1,tr.delay)}function X(q){q===void 0&&(q=!1),R.style.pointerEvents=C.props.interactive&&!q?"":"none",R.style.zIndex=""+C.props.zIndex}function _(q,de,ve){if(ve===void 0&&(ve=!0),$.forEach(function(Fe){Fe[q]&&Fe[q].apply(Fe,de)}),ve){var Pe;(Pe=C.props)[q].apply(Pe,de)}}function S(){var q=C.props.aria;if(q.content){var de="aria-"+q.content,ve=R.id,Pe=Nn(C.props.triggerTarget||r);Pe.forEach(function(Fe){var Xe=Fe.getAttribute(de);if(C.state.isVisible)Fe.setAttribute(de,Xe?Xe+" "+ve:ve);else{var xt=Xe&&Xe.replace(ve,"").trim();xt?Fe.setAttribute(de,xt):Fe.removeAttribute(de)}})}}function F(){if(!(V||!C.props.aria.expanded)){var q=Nn(C.props.triggerTarget||r);q.forEach(function(de){C.props.interactive?de.setAttribute("aria-expanded",C.state.isVisible&&de===te()?"true":"false"):de.removeAttribute("aria-expanded")})}}function J(){le().removeEventListener("mousemove",f),Ws=Ws.filter(function(q){return q!==f})}function Y(q){if(!(gr.isTouch&&(l||q.type==="mousedown"))){var de=q.composedPath&&q.composedPath()[0]||q.target;if(!(C.props.interactive&&Ad(R,de))){if(Nn(C.props.triggerTarget||r).some(function(ve){return Ad(ve,de)})){if(gr.isTouch||C.state.isVisible&&C.props.trigger.indexOf("click")>=0)return}else _("onClickOutside",[C,q]);C.props.hideOnClick===!0&&(C.clearDelayTimeouts(),C.hide(),a=!0,setTimeout(function(){a=!1}),C.state.isMounted||ge())}}}function ne(){l=!0}function ce(){l=!1}function pe(){var q=le();q.addEventListener("mousedown",Y,!0),q.addEventListener("touchend",Y,on),q.addEventListener("touchstart",ce,on),q.addEventListener("touchmove",ne,on)}function ge(){var q=le();q.removeEventListener("mousedown",Y,!0),q.removeEventListener("touchend",Y,on),q.removeEventListener("touchstart",ce,on),q.removeEventListener("touchmove",ne,on)}function Se(q,de){Ge(q,function(){!C.state.isVisible&&R.parentNode&&R.parentNode.contains(R)&&de()})}function Le(q,de){Ge(q,de)}function Ge(q,de){var ve=D().box;function Pe(Fe){Fe.target===ve&&(ll(ve,"remove",Pe),de())}if(q===0)return de();ll(ve,"remove",u),ll(ve,"add",Pe),u=Pe}function fe(q,de,ve){ve===void 0&&(ve=!1);var Pe=Nn(C.props.triggerTarget||r);Pe.forEach(function(Fe){Fe.addEventListener(q,de,ve),d.push({node:Fe,eventType:q,handler:de,options:ve})})}function Qe(){W()&&(fe("touchstart",we,{passive:!0}),fe("touchend",Te,{passive:!0})),Cy(C.props.trigger).forEach(function(q){if(q!=="manual")switch(fe(q,we),q){case"mouseenter":fe("mouseleave",Te);break;case"focus":fe(Fy?"focusout":"blur",T);break;case"focusin":fe("focusout",T);break}})}function Me(){d.forEach(function(q){var de=q.node,ve=q.eventType,Pe=q.handler,Fe=q.options;de.removeEventListener(ve,Pe,Fe)}),d=[]}function we(q){var de,ve=!1;if(!(!C.state.isEnabled||m(q)||a)){var Pe=((de=c)==null?void 0:de.type)==="focus";c=q,g=q.currentTarget,F(),!C.state.isVisible&&Qy(q)&&Ws.forEach(function(Fe){return Fe(q)}),q.type==="click"&&(C.props.trigger.indexOf("mouseenter")<0||o)&&C.props.hideOnClick!==!1&&C.state.isVisible?ve=!0:j(q),q.type==="click"&&(o=!ve),ve&&!Pe&&Ie(q)}}function qe(q){var de=q.target,ve=te().contains(de)||R.contains(de);if(!(q.type==="mousemove"&&ve)){var Pe=z().concat(R).map(function(Fe){var Xe,xt=Fe._tippy,wt=(Xe=xt.popperInstance)==null?void 0:Xe.state;return wt?{popperRect:Fe.getBoundingClientRect(),popperState:wt,props:t}:null}).filter(Boolean);Sy(Pe,q)&&(J(),Ie(q))}}function Te(q){var de=m(q)||C.props.trigger.indexOf("click")>=0&&o;if(!de){if(C.props.interactive){C.hideWithInteractivity(q);return}Ie(q)}}function T(q){C.props.trigger.indexOf("focusin")<0&&q.target!==te()||C.props.interactive&&q.relatedTarget&&R.contains(q.relatedTarget)||Ie(q)}function m(q){return gr.isTouch?W()!==q.type.indexOf("touch")>=0:!1}function E(){x();var q=C.props,de=q.popperOptions,ve=q.placement,Pe=q.offset,Fe=q.getReferenceClientRect,Xe=q.moveTransition,xt=ie()?cl(R).arrow:null,wt=Fe?{getBoundingClientRect:Fe,contextElement:Fe.contextElement||te()}:r,Gn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Hn){var Hr=Hn.state;if(ie()){var Si=D(),Ri=Si.box;["placement","reference-hidden","escaped"].forEach(function($n){$n==="placement"?Ri.setAttribute("data-placement",Hr.placement):Hr.attributes.popper["data-popper-"+$n]?Ri.setAttribute("data-"+$n,""):Ri.removeAttribute("data-"+$n)}),Hr.attributes.popper={}}}},St=[{name:"offset",options:{offset:Pe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Xe}},Gn];ie()&&xt&&St.push({name:"arrow",options:{element:xt,padding:3}}),St.push.apply(St,(de==null?void 0:de.modifiers)||[]),C.popperInstance=Ey(wt,R,Object.assign({},de,{placement:ve,onFirstUpdate:h,modifiers:St}))}function x(){C.popperInstance&&(C.popperInstance.destroy(),C.popperInstance=null)}function M(){var q=C.props.appendTo,de,ve=te();C.props.interactive&&q===nd||q==="parent"?de=ve.parentNode:de=id(q,[ve]),de.contains(R)||de.appendChild(R),C.state.isMounted=!0,E()}function z(){return Ks(R.querySelectorAll("[data-tippy-root]"))}function j(q){C.clearDelayTimeouts(),q&&_("onTrigger",[C,q]),pe();var de=P(!0),ve=O(),Pe=ve[0],Fe=ve[1];gr.isTouch&&Pe==="hold"&&Fe&&(de=Fe),de?n=setTimeout(function(){C.show()},de):C.show()}function Ie(q){if(C.clearDelayTimeouts(),_("onUntrigger",[C,q]),!C.state.isVisible){ge();return}if(!(C.props.trigger.indexOf("mouseenter")>=0&&C.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(q.type)>=0&&o)){var de=P(!1);de?i=setTimeout(function(){C.state.isVisible&&C.hide()},de):s=requestAnimationFrame(function(){C.hide()})}}function be(){C.state.isEnabled=!0}function De(){C.hide(),C.state.isEnabled=!1}function ke(){clearTimeout(n),clearTimeout(i),cancelAnimationFrame(s)}function _e(q){if(!C.state.isDestroyed){_("onBeforeUpdate",[C,q]),Me();var de=C.props,ve=dd(r,Object.assign({},de,ad(q),{ignoreAttributes:!0}));C.props=ve,Qe(),de.interactiveDebounce!==ve.interactiveDebounce&&(J(),f=sd(qe,ve.interactiveDebounce)),de.triggerTarget&&!ve.triggerTarget?Nn(de.triggerTarget).forEach(function(Pe){Pe.removeAttribute("aria-expanded")}):ve.triggerTarget&&r.removeAttribute("aria-expanded"),F(),X(),k&&k(de,ve),C.popperInstance&&(E(),z().forEach(function(Pe){requestAnimationFrame(Pe._tippy.popperInstance.forceUpdate)})),_("onAfterUpdate",[C,q])}}function Mt(q){C.setProps({content:q})}function ut(){var q=C.state.isVisible,de=C.state.isDestroyed,ve=!C.state.isEnabled,Pe=gr.isTouch&&!C.props.touch,Fe=sl(C.props.duration,0,tr.duration);if(!(q||de||ve||Pe)&&!te().hasAttribute("disabled")&&(_("onShow",[C],!1),C.props.onShow(C)!==!1)){if(C.state.isVisible=!0,ie()&&(R.style.visibility="visible"),X(),pe(),C.state.isMounted||(R.style.transition="none"),ie()){var Xe=D(),xt=Xe.box,wt=Xe.content;al([xt,wt],0)}h=function(){var St;if(!(!C.state.isVisible||A)){if(A=!0,R.offsetHeight,R.style.transition=C.props.moveTransition,ie()&&C.props.animation){var hn=D(),Hn=hn.box,Hr=hn.content;al([Hn,Hr],Fe),ld([Hn,Hr],"visible")}S(),F(),od(ul,C),(St=C.popperInstance)==null||St.forceUpdate(),_("onMount",[C]),C.props.animation&&ie()&&Le(Fe,function(){C.state.isShown=!0,_("onShown",[C])})}},M()}}function Ut(){var q=!C.state.isVisible,de=C.state.isDestroyed,ve=!C.state.isEnabled,Pe=sl(C.props.duration,1,tr.duration);if(!(q||de||ve)&&(_("onHide",[C],!1),C.props.onHide(C)!==!1)){if(C.state.isVisible=!1,C.state.isShown=!1,A=!1,o=!1,ie()&&(R.style.visibility="hidden"),J(),ge(),X(!0),ie()){var Fe=D(),Xe=Fe.box,xt=Fe.content;C.props.animation&&(al([Xe,xt],Pe),ld([Xe,xt],"hidden"))}S(),F(),C.props.animation?ie()&&Se(Pe,C.unmount):C.unmount()}}function Er(q){le().addEventListener("mousemove",f),od(Ws,f),f(q)}function Ir(){C.state.isVisible&&C.hide(),C.state.isMounted&&(x(),z().forEach(function(q){q._tippy.unmount()}),R.parentNode&&R.parentNode.removeChild(R),ul=ul.filter(function(q){return q!==C}),C.state.isMounted=!1,_("onHidden",[C]))}function Tt(){C.state.isDestroyed||(C.clearDelayTimeouts(),C.unmount(),Me(),delete r._tippy,C.state.isDestroyed=!0,_("onDestroy",[C]))}}function an(r,e){e===void 0&&(e={});var t=tr.plugins.concat(e.plugins||[]);_y();var n=Object.assign({},e,{plugins:t}),i=xy(r),s=i.reduce(function(o,a){var l=a&&Hy(a,n);return l&&o.push(l),o},[]);return Js(r)?s[0]:s}an.defaultProps=tr,an.setDefaultProps=Py,an.currentInput=gr,Object.assign({},Ph,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),an.setDefaultProps({render:pd});function ln(r){var e;const t=[];return((e=r.renderer)==null?void 0:e.type)==="video"&&t.push(r.options),t.push(...r.childNodes.flatMap(ln).filter(Boolean)),t}class qs extends Error{constructor(e,t=new Error,n=!1){super(),this.fatal=!1,this.fatal=n,this.stack=t.stack,this.message=[e,t.message].filter(Boolean).join(" - ")}}const $y=5;function Yy(r,e){const t=r.map(({id:i})=>i).join("|"),n=e.map(({id:i})=>i).join("|");return t===n}class Vy{constructor(e){this._caption="",this._currentTime=0,this._activeScenes=[],this._upcomingScenes=[],this._canvas=It(),this._controls=It(),this.host=e}set activeScenes(e){Yy(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,n,i;const s=Math.min(this.host.duration,Math.max(0,e));this.activeScenes=((t=this.host.composition)==null?void 0:t.tracks.reduce((a,l)=>a.concat(l.drawScenes.filter(({start:A,duration:c})=>s>=A&&s<A+c)),[]))??[];const o=s!==this.currentTime;this._currentTime=s,this._upcomingScenes=((n=this.host.composition)==null?void 0:n.tracks.reduce((a,l)=>a.concat(l.drawScenes.filter(({start:A})=>s>=A-$y&&s<A)),[]))??[],this.loadScenes(),this.syncVideoState(),(i=this._controls.value)==null||i.setAttribute("currentTime",s.toString()),o&&this.host.dispatchEvent(new CustomEvent("timeupdate",{detail:s})),this.draw(s)}get currentTime(){return this._currentTime}set caption(e){e!==this._caption&&(this._caption=e,this.host.requestUpdate())}get caption(){return this._caption}canvas(){return vt(this._canvas)}controls(){return vt(this._controls)}loadScenes(){[...this.activeScenes,...this._upcomingScenes].forEach(e=>{const{start:t,duration:n}=e,i=this.host.currentTime>0||this.host.preload==="auto"||!this.host.paused;ln(e.layout.node).forEach(o=>{var a,l,A;if(o!=null&&o.key&&this.host.videos[o==null?void 0:o.key]){const c=this.host.videos[o==null?void 0:o.key],{key:u,hls:h,node:d,start:f,duration:g}=c,p=this.host.videoState[u];d&&p&&(d.currentTime>=f+g||d.ended||i&&(h?(a=h.startLoadOnce)==null||a.call(h,f):p.initialised||(l=d.startLoadOnce)==null||l.call(d)))}else if(i){const c=`${t}-${n}`,u=this.host._sceneController.videoState[c];this.host.duration&&!((A=u==null?void 0:u.buffered)!=null&&A.length)&&(this.host._sceneController.videoState={...this.host._sceneController.videoState,[c]:{...u,buffered:[{start:Math.max(0,t/this.host.duration*100),end:Math.min((t+n)/this.host.duration*100,100)}]}})}})})}syncVideoState(){var e;(e=this.host.composition)==null||e.tracks.forEach(t=>{var n;(n=t.drawScenes)==null||n.forEach(i=>{ln(i.layout.node).forEach(o=>{if(o!=null&&o.key&&this.host.videos[o==null?void 0:o.key]){const a=this.host.videos[o==null?void 0:o.key],{key:l,node:A}=a,c=this.host.videoState[l],u=this.activeScenes.includes(i);if(A&&c)if(u&&!this.host.waiting&&!this.host.loading&&!this.host.paused){if(A.paused&&c.initialised)try{return A.play()}catch(h){throw new qs("Video play error",h,!0)}}else A.paused||A.pause()}})})})}draw(e=this.currentTime){this.host.composition&&this._canvas.value&&this.host.composition.draw({currentTime:e,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)}}async function md(r){return r.duration===1/0?new Promise(e=>{r.currentTime=Number.MAX_SAFE_INTEGER,r.ontimeupdate=()=>{r.ontimeupdate=null,e(r.duration),r.currentTime=0}}):r.duration}function Ky(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Jy(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Wy(r,e){return new Promise(async t=>{const{id:n,key:i,duration:s,startOffset:o,endOffset:a}=e,l=document.createElement("video");l.playsInline=!0,l.muted=!0,l.loop=!1,l.src=r;let A=!1;if(l.startLoadOnce=()=>{A||(l.preload="auto",l.load(),A=!0)},s){l.preload="none";const c=(o??0)*s,u=(1-(a??0))*s;t({id:n,key:i,hls:null,config:e,node:l,start:c,duration:u-c})}else{l.preload="metadata";const c=async()=>{const u=await md(l),h=(o??0)*u,d=(1-(a??0))*u;t({id:n,key:i,hls:null,config:e,node:l,start:h,duration:d-h}),l.removeEventListener("loadedmetadata",c)};l.addEventListener("loadedmetadata",c)}})}function qy(r,e){return new Promise(t=>{const{id:n,key:i,startOffset:s,endOffset:o}=e,a=document.createElement("video");a.playsInline=!0,a.muted=!0,a.loop=!1;let l=!1;const A=new wr({autoStartLoad:!0,xhrSetup:c=>{const{open:u}=c,h=r.split("?")[1];c.open=function(d,f,g){h&&!f.toString().includes("?")&&(f+="?"+h),!(!l&&f.toString().includes(".ts"))&&u.apply(this,[d,f,g])}}});A.on(wr.Events.LEVEL_LOADED,async()=>{l||A==null||A.stopLoad();const c=await md(a),u=(s??0)*c,h=(1-(o??0))*c;t({id:n,key:i,hls:A,config:e,node:a,start:u,duration:h-u})}),A.loadSource(r),A.attachMedia(a),A.startLoadOnce=(c=-1,u)=>{if(A&&!l){const h=A.levels.findIndex(d=>Math.min(d.height,d.width)===u);l=!0,A.startLevel=A.firstLevel,A.startLoad(c),A.currentLevel=h!==-1?h:A.firstLevel}}})}function Xy(r){const{src:e,playlist:t}=r;return t&&!Ky()&&wr.isSupported()?qy(t,r):Wy(e,r)}const jy=Wr(async function(e){return!(e!=null&&e.family.client)&&!(e!=null&&e.family.server)?null:new FontFace(e.family.name,`url(${e.family.client??e.family.server})`,{style:"normal",weight:e.weight}).load()},{cacheKey:([r])=>JSON.stringify(r)});let zy=class{constructor(e){this._hasPlayed=!1,this._memoKey=null,this._lastDeps=null,this._duration=0,this._composition=null,this._videos={},this._videoState={},this._delayProcessing=(t=100)=>{const n=new AbortController,i=setTimeout(()=>{n.signal.aborted||(this.host._processing=!0)},t);return n.signal.addEventListener("abort",()=>{clearTimeout(i)}),n},this._createImageResolver=Wr(async({src:t})=>t?new Promise((n,i)=>{const s=new Image;s.onload=()=>{n({image:s})},s.onerror=o=>{i(o)},s.src=t}):{image:null}),this._videoFactory=Wr(async t=>{const{id:n,key:i}=t,s=await Xy(t);s.node.volume=this.host.volume,s.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((l,A)=>{const c=A,u=o[c]({id:n,key:i,node:s.node});return l[c]=u,s.node.addEventListener(A,u),l},{});return{video:s,listeners:a,source:()=>s.node}},{cacheKey:([{id:t,key:n,src:i,playlist:s}])=>JSON.stringify({id:t,key:n,src:i==null?void 0:i.split("?")[0],playlist:s==null?void 0:s.split("?")[0]})}),this._createVideoResolver=async t=>{const{video:n,listeners:i,source:s}=await this._videoFactory(t);return this.videos={...this.videos,[t.key]:{...n,listeners:i}},this.videoState={...this.videoState,[t.key]:{initialised:!n,waiting:!!n,...this.videoState[t.key]}},{video:s}},this._handleLoadedData=({id:t,key:n,node:i})=>()=>{const s=this.videoState[n];s!=null&&s.initialised||(this.videoState={...this.videoState,[n]:{...s,initialised:!0,waiting:!1,buffered:(s==null?void 0:s.buffered)??[]}},this.setVideosCurrentTime(this.host.currentTime),this.host.dispatchEvent(new CustomEvent("video:loadeddata",{detail:{id:t,key:n,node:i}})))},this._handleWaiting=({key:t})=>()=>{const n=this.videoState[t];n!=null&&n.initialised&&!(n!=null&&n.waiting)&&(this.videoState={...this.videoState,[t]:{...n,waiting:!0}})},this._handleCanPlay=({key:t})=>()=>{const n=this.videoState[t];n!=null&&n.initialised&&(n!=null&&n.waiting)&&(this.videoState={...this.videoState,[t]:{...n,waiting:!1}}),this.host.paused&&this.host.draw()},this._handleProgress=()=>()=>{},this._handleSeeking=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:seeking",{detail:{id:t,key:n,node:i}}))},this._handleSeeked=({id:t,key:n,node:i})=>()=>{const s=this.videoState[n];s!=null&&s.initialised&&(this.host.draw(),this.host.activeScenes.flatMap(o=>ln(o.layout.node).map(({id:l})=>l)).includes(t)&&this.host.dispatchEvent(new CustomEvent("seeked",{detail:this.host.currentTime})),this.host.dispatchEvent(new CustomEvent("video:seeked",{detail:{id:t,key:n,node:i}})))},this._handlePlay=({id:t,key:n,node:i})=>()=>{this.hasPlayed=!0,this.host.dispatchEvent(new CustomEvent("video:play",{detail:{id:t,key:n,node:i}}))},this._handlePlaying=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:playing",{detail:{id:t,key:n,node:i}}))},this._handlePause=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:pause",{detail:{id:t,key:n,node:i}}))},this._handleStalled=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:stalled",{detail:{id:t,key:n,node:i}}))},this._handleTimeUpdate=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:timeupdate",{detail:{id:t,key:n,node:i}}))},this._handleEnded=({id:t,key:n,node:i})=>()=>{this.host.dispatchEvent(new CustomEvent("video:ended",{detail:{id:t,key:n,node:i}}))},this._handleError=({id:t,key:n,node:i})=>()=>{const s=new qs(`Video error - answer ${t} failed to load`);this.host.dispatchEvent(new ErrorEvent("error",{bubbles:!0,composed:!0,error:s,message:s.message})),this.host.dispatchEvent(new CustomEvent("video:error",{detail:{id:t,key:n,node:i}}))},this._cleanupVideo=t=>{var n;const i=this.videos[t];i&&(i.node.pause(),i.node.src="",(n=i.hls)==null||n.destroy(),Object.keys(i.listeners??{}).forEach(s=>{var o,a;if((o=this.videos)!=null&&o[t]){const l=(a=i.listeners)==null?void 0:a[s];l&&i.node.removeEventListener(s,l)}}),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 composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}set videoState(e){e!==this._videoState&&(this._videoState=e,this.host.requestUpdate())}get videoState(){return this._videoState}_setupTask(){new Oi(this.host,async([e,t])=>{var n;const i=this._delayProcessing();try{if(this.host._errors=[],(!t||!this.host._languages.find(({value:s})=>t===s))&&(this.host._language=(n=this.host._languages[0])==null?void 0:n.value),e){try{this.composition=await pc({config:e,resolvers:{text:async({font:s})=>{const o=await jy(s);return o&&document.fonts.add(o),{font:s}},image:this._createImageResolver,video:this._createVideoResolver}})}catch(s){throw new qs("Fatal composition error",s,!0)}this.duration=this.composition.duration,this.host.currentTime>this.duration?this.host.reset(this.duration,!1):this.host.paused&&this.host.reset(this.host.currentTime,!this.host.paused)}this.host.dispatchEvent(new CustomEvent("compositionupdate",{detail:this.composition,bubbles:!0,composed:!0}))}catch(s){this.composition=null,this.duration=0,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:s,message:s.message}))}finally{i.abort(),this.host._processing=!1}},()=>{const e=JSON.stringify({config:this.host.config,language:this.host.language});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.config,this.host.language];return this._memoKey=e,this._lastDeps=t,t})}_setVideoCurrentTime({time:e,scene:t}){const{start:n}=t;ln(t.layout.node).forEach(s=>{if(s!=null&&s.key&&this.videos[s==null?void 0:s.key]){const o=this.videos[s==null?void 0:s.key],a=e-n;o.node.currentTime=Math.max(o.start,Math.min(o.start+o.duration,a+o.start))}})}setVideosCurrentTime(e){var t;(t=this.composition)==null||t.tracks.forEach(n=>{n.drawScenes.forEach(i=>{this._setVideoCurrentTime({time:e,scene:i})})})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}};function Zy(r){r.requestFullscreen?r.requestFullscreen():r.mozRequestFullScreen?r.mozRequestFullScreen():r.webkitRequestFullscreen?r.webkitRequestFullscreen():r.msRequestFullscreen&&r.msRequestFullscreen()}function eB(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}const hl=["progress","play-large","navigation","play","volume","current-time","duration","speed","captions","fullscreen","preview"],tB={id:"captions",event:"captions:click",label:"Closed Captions"},rB={id:"fullscreen",event:"fullscreen:click",label:"Full Screen"},Ed={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}]},nB={id:"playbackRate",label:"Playback playbackRate",subItems:Ed};class iB extends Xl{constructor(e){if(super(e),this.element=null,this.observer=void 0,e.type!==gn.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)),Xt}}const dl=pn(iB),sB=dC(()=>{const r=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),e=new FontFace("Roobert","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-SemiBold.woff2)",{style:"normal",weight:"600"}),t=new FontFace("Roobert","url(https://vouch-clients.s3.ap-southeast-2.amazonaws.com/vouch/fonts/Roobert-Bold.woff2",{style:"normal",weight:"700"}),n=new FontFace("Roobert Captions","url(https://media-player-fonts.s3.ap-southeast-2.amazonaws.com/Roobert-Regular.woff2)",{style:"normal",weight:"400"}),i=oc.map(s=>({load:!1,font:new FontFace(s.family,`url(${s.url})`,{style:s.style})}));return[{load:!0,font:r},{load:!0,font:e},{load:!0,font:t},{load:!0,font:n},...i]}),pr={"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"},oB={colors:pr,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 ${pr["dark-100"]}`,medium:`0 .125rem .625rem ${pr["dark-100"]}`,large:`0 .25rem 1rem ${pr["dark-50"]}`,xl:`.25rem .25rem 1rem ${pr["dark-250"]}`,xxl:`0 .25rem 2rem ${pr["dark-100"]}`,xxxl:`.25rem .25rem 3rem ${pr["dark-250"]}`,toolbar:`0 -.625rem .625rem ${pr["dark-50"]}`,text:`0 0 .25rem ${pr["dark-250"]}`},timings:{fast:".1s",normal:".2s",slow:".3s"},easings:{linear:"linear"},focusOutline:{width:".2rem",color:pr["dark-400"]},iconSizes:{small:"0.75rem",medium:"1rem",large:"1.5rem"}},Id=cC(oB,{delimiter:"-"}),aB=Object.keys(Id).map(r=>Yn(`:host { --${r}: ${Id[r]}; }`)),$e=(r=>{const e=class extends r{firstUpdated(){sB().forEach(({load:s,font:o})=>{document.fonts.add(o),s&&o.load()})}};return e.styles=[(r==null?void 0:r.styles)??[],aB,lt`
2493
2493
  :host {
2494
2494
  font-family: var(--fontFamilies-sans);
2495
2495
  font-size: var(--fontSizes-medium);
@@ -2570,7 +2570,7 @@ vec4 transition(vec2 uv) {
2570
2570
  scroll-behavior: auto !important;
2571
2571
  }
2572
2572
  }
2573
- `],e})(Cr),lB=(r,e)=>(typeof window<"u"&&(window.customElements.get(r)??window.customElements.define(r,e)),e),AB=(r,e)=>{const{kind:t,elements:n}=e;return{kind:t,elements:n,finisher(i){typeof window<"u"&&(window.customElements.get(r)??window.customElements.define(r,i))}}},Rt=r=>e=>typeof e=="function"?lB(r,e):AB(r,e);class cB{constructor(e){this._memoKey=null,this._lastDeps=null,this._composition=null,this._videos={},this._cleanupVideo=t=>{var n;const i=this.videos[t];i&&(i.node.pause(),i.node.src="",(n=i.hls)==null||n.destroy(),delete this.videos[t])},this.host=e,this.host.addController(this)}set composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}_setupTask(){new Oi(this.host,async([e,t])=>{try{if(!t||e)return;try{this.composition=await pc({config:t,resolvers:{text:()=>({font:null}),image:()=>({image:null}),video:()=>({video:()=>null})}})}catch(n){throw new qs("Video preview data template error",n)}}catch(n){this.composition=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:n,message:n.message}))}},()=>{const e=JSON.stringify({disabled:this.host.disabled,config:this.host.config});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.disabled,this.host.config];return this._memoKey=e,this._lastDeps=t,t})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}}function vd(r,e,t){return Math.min(Math.max(e,r),t)}function Bi(r,e){return e?e instanceof ShadowRoot?Bi(r,e.host):e instanceof HTMLElement&&e.matches(r)?e:Bi(r,e.parentNode):null}function fl(r,e={}){const t=Math.max(0,r||0),n=Math.floor(t/3600),i=Math.floor(t%3600/60),s=Math.floor(t%3600%60),o=Math.floor(t%1*1e3);let a=n?`${n}:${`${i}`.padStart(2,"0")}:${`${s}`.padStart(2,"0")}`:`${i}:${`${s}`.padStart(2,"0")}`;return e.includeMs&&(a+=`:${`${o}`.padStart(3,"0")}`),a}var uB=Object.defineProperty,hB=Object.getOwnPropertyDescriptor,Mn=(r,e,t,n)=>{for(var i=n>1?void 0:n?hB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&uB(e,t,i),i};let Ur=class extends $e{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return Ce`<button
2573
+ `],e})(Cr),lB=(r,e)=>(typeof window<"u"&&(window.customElements.get(r)??window.customElements.define(r,e)),e),AB=(r,e)=>{const{kind:t,elements:n}=e;return{kind:t,elements:n,finisher(i){typeof window<"u"&&(window.customElements.get(r)??window.customElements.define(r,i))}}},Rt=r=>e=>typeof e=="function"?lB(r,e):AB(r,e);class cB{constructor(e){this._memoKey=null,this._lastDeps=null,this._composition=null,this._videos={},this._cleanupVideo=t=>{var n;const i=this.videos[t];i&&(i.node.pause(),i.node.src="",(n=i.hls)==null||n.destroy(),delete this.videos[t])},this.host=e,this.host.addController(this)}set composition(e){e!==this._composition&&(this._composition=e,this.host.requestUpdate())}get composition(){return this._composition}set videos(e){e!==this._videos&&(this._videos=e,this.host.requestUpdate())}get videos(){return this._videos}_setupTask(){new Oi(this.host,async([e,t])=>{try{if(!t||e)return;try{this.composition=await pc({config:t})}catch(n){throw new qs("Video preview data template error",n)}}catch(n){this.composition=null,this.host.dispatchEvent(new ErrorEvent("error",{composed:!0,bubbles:!0,error:n,message:n.message}))}},()=>{const e=JSON.stringify({disabled:this.host.disabled,config:this.host.config});if(this._lastDeps&&this._memoKey===e)return this._lastDeps;const t=[this.host.disabled,this.host.config];return this._memoKey=e,this._lastDeps=t,t})}hostConnected(){this._setupTask()}hostDisconnected(){Object.keys(this.videos).forEach(e=>{this._cleanupVideo(e)}),this.videos={}}}function vd(r,e,t){return Math.min(Math.max(e,r),t)}function Bi(r,e){return e?e instanceof ShadowRoot?Bi(r,e.host):e instanceof HTMLElement&&e.matches(r)?e:Bi(r,e.parentNode):null}function fl(r,e={}){const t=Math.max(0,r||0),n=Math.floor(t/3600),i=Math.floor(t%3600/60),s=Math.floor(t%3600%60),o=Math.floor(t%1*1e3);let a=n?`${n}:${`${i}`.padStart(2,"0")}:${`${s}`.padStart(2,"0")}`:`${i}:${`${s}`.padStart(2,"0")}`;return e.includeMs&&(a+=`:${`${o}`.padStart(3,"0")}`),a}var uB=Object.defineProperty,hB=Object.getOwnPropertyDescriptor,Mn=(r,e,t,n)=>{for(var i=n>1?void 0:n?hB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&uB(e,t,i),i};let Ur=class extends $e{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return Ce`<button
2574
2574
  class=${Ve({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"})}
2575
2575
  >
2576
2576
  <slot></slot>
@@ -2651,7 +2651,7 @@ vec4 transition(vec2 uv) {
2651
2651
  .weight-light:focus {
2652
2652
  --button-background: var(--vu-button-background-hover, #9d9d9d);
2653
2653
  }
2654
- `],Mn([te({type:Boolean})],Ur.prototype,"active",2),Mn([te({type:String})],Ur.prototype,"size",2),Mn([te({type:String})],Ur.prototype,"rounded",2),Mn([te({type:String})],Ur.prototype,"weight",2),Mn([te({type:String})],Ur.prototype,"icon",2),Ur=Mn([Rt("vmp-button")],Ur);const Cd={"arrow-left":()=>Ce`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
2654
+ `],Mn([ee({type:Boolean})],Ur.prototype,"active",2),Mn([ee({type:String})],Ur.prototype,"size",2),Mn([ee({type:String})],Ur.prototype,"rounded",2),Mn([ee({type:String})],Ur.prototype,"weight",2),Mn([ee({type:String})],Ur.prototype,"icon",2),Ur=Mn([Rt("vmp-button")],Ur);const Cd={"arrow-left":()=>Ce`<svg width="20" height="20" viewBox="0 0 20 20" fill="none" part="svg">
2655
2655
  <path
2656
2656
  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"
2657
2657
  fill="currentColor"
@@ -2819,7 +2819,7 @@ vec4 transition(vec2 uv) {
2819
2819
  justify-content: center;
2820
2820
  flex-shrink: 0;
2821
2821
  }
2822
- `],yd([te({type:String})],Xs.prototype,"icon",2),Xs=yd([Rt("vmp-icon")],Xs);var gB=Object.defineProperty,pB=Object.getOwnPropertyDescriptor,Pn=(r,e,t,n)=>{for(var i=n>1?void 0:n?pB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&gB(e,t,i),i};let Gr=class extends $e{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return Ce`
2822
+ `],yd([ee({type:String})],Xs.prototype,"icon",2),Xs=yd([Rt("vmp-icon")],Xs);var gB=Object.defineProperty,pB=Object.getOwnPropertyDescriptor,Pn=(r,e,t,n)=>{for(var i=n>1?void 0:n?pB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&gB(e,t,i),i};let Gr=class extends $e{constructor(){super(...arguments),this.active=!1,this.size="small",this.rounded="medium",this.weight="light"}render(){return Ce`
2823
2823
  <vmp-button
2824
2824
  ?active=${this.active}
2825
2825
  size=${At(this.size)}
@@ -2846,7 +2846,7 @@ vec4 transition(vec2 uv) {
2846
2846
  height: 32px;
2847
2847
  width: 32px;
2848
2848
  }
2849
- `],Pn([te({type:Boolean})],Gr.prototype,"active",2),Pn([te({type:String})],Gr.prototype,"size",2),Pn([te({type:String})],Gr.prototype,"rounded",2),Pn([te({type:String})],Gr.prototype,"weight",2),Pn([te({type:String})],Gr.prototype,"icon",2),Gr=Pn([Rt("vmp-icon-button")],Gr);var mB=Object.defineProperty,EB=Object.getOwnPropertyDescriptor,mr=(r,e,t,n)=>{for(var i=n>1?void 0:n?EB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&mB(e,t,i),i};let An=class extends $e{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=qo,this._currentTime=0,this._sceneController=new cB(this),this._canvasRef=It(),this._previewRef=It(),this._previewTimeRef=It(),this._handleScrubberMouseEnter=({detail:{x:r,y:e,elementLeft:t,elementRight:n}})=>{var i,s;if((i=this._previewRef)!=null&&i.value){const o=this._previewRef.value.getBoundingClientRect(),a=(s=this._previewRef.value.getRootNode().host)==null?void 0:s.getBoundingClientRect();o&&a&&(this._previewRef.value.style.opacity="1",this._previewRef.value.style.transform=`translate3d(${vd(t-a.left,r-a.left-o.width/2,n-a.left-o.width)}px, ${e-a.top-o.height-28}px, 0)`)}},this._handleScrubberMouseMove=({detail:{time:r,x:e,elementLeft:t,elementRight:n}})=>{var i,s,o,a,l,A,c,u,h,d;if(this._currentTime=r,(o=(s=(i=this._sceneController.composition)==null?void 0:i.tracks)==null?void 0:s[0])!=null&&o.scenes){const f=(c=(A=(l=(a=this._sceneController.composition)==null?void 0:a.tracks)==null?void 0:l[0])==null?void 0:A.drawScenes)==null?void 0:c.find(({start:g,duration:p})=>r>=g&&r<=g+p);if(f&&ln(f.layout.node).forEach(p=>{var C,Q;if(p!=null&&p.key&&this._sceneController.videos[p.key]){const b=this._sceneController.videos[p.key];(Q=(C=b.node).startLoadOnce)==null||Q.call(C),b.node.currentTime=r-f.start}}),this._draw(),(u=this._previewRef)!=null&&u.value){const g=this._previewRef.value.getBoundingClientRect(),p=(h=this._previewRef.value.getRootNode().host)==null?void 0:h.getBoundingClientRect();if(g&&p){const C=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[,Q]=Array.from(C.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${vd(t-p.left,e-p.left-g.width/2,n-p.left-g.width)}px, ${Q[1]}px, 0)`}}this._previewTimeRef.value&&this._previewTimeRef.value.setAttribute("content",fl(Math.max(0,Math.min(this._currentTime,(d=this._sceneController.composition)==null?void 0:d.duration))))}},this._handleScrubberMouseLeave=()=>{var r;(r=this._previewRef)!=null&&r.value&&(this._previewRef.value.style.opacity="0")},this._handleScrubberResize=({detail:{y:r}})=>{var e,t;if((e=this._previewRef)!=null&&e.value){const n=this._previewRef.value.getBoundingClientRect(),i=(t=this._previewRef.value.getRootNode().host)==null?void 0:t.getBoundingClientRect();if(n&&i){const s=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[o]=Array.from(s.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${o[1]}px, ${r-i.top-n.height-28}px, 0)`}}}}_draw(r=this._currentTime){this._sceneController.composition&&this._canvasRef.value&&this._sceneController.composition.draw({canvas:this._canvasRef.value,currentTime:Math.max(0,Math.min(r,this._sceneController.composition.duration))})}connectedCallback(){super.connectedCallback();const r=Bi("vmp-media-player",this);r==null||r.addEventListener("scrubber:resize",this._handleScrubberResize),r==null||r.addEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),r==null||r.addEventListener("scrubber:mousemove",this._handleScrubberMouseMove),r==null||r.addEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}disconnectedCallback(){super.disconnectedCallback();const r=Bi("vmp-media-player",this);r==null||r.removeEventListener("scrubber:resize",this._handleScrubberResize),r==null||r.removeEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),r==null||r.removeEventListener("scrubber:mousemove",this._handleScrubberMouseMove),r==null||r.removeEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}render(){var r,e,t;const{height:n,width:i}=ic({resolution:180,aspectRatio:this.aspectRatio}),s=((t=(e=(r=this._sceneController.composition)==null?void 0:r.tracks)==null?void 0:e[0])==null?void 0:t.scenes.length)??0;return!this.disabled&&s>1?Ce`
2849
+ `],Pn([ee({type:Boolean})],Gr.prototype,"active",2),Pn([ee({type:String})],Gr.prototype,"size",2),Pn([ee({type:String})],Gr.prototype,"rounded",2),Pn([ee({type:String})],Gr.prototype,"weight",2),Pn([ee({type:String})],Gr.prototype,"icon",2),Gr=Pn([Rt("vmp-icon-button")],Gr);var mB=Object.defineProperty,EB=Object.getOwnPropertyDescriptor,mr=(r,e,t,n)=>{for(var i=n>1?void 0:n?EB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&mB(e,t,i),i};let An=class extends $e{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=qo,this._currentTime=0,this._sceneController=new cB(this),this._canvasRef=It(),this._previewRef=It(),this._previewTimeRef=It(),this._handleScrubberMouseEnter=({detail:{x:r,y:e,elementLeft:t,elementRight:n}})=>{var i,s;if((i=this._previewRef)!=null&&i.value){const o=this._previewRef.value.getBoundingClientRect(),a=(s=this._previewRef.value.getRootNode().host)==null?void 0:s.getBoundingClientRect();o&&a&&(this._previewRef.value.style.opacity="1",this._previewRef.value.style.transform=`translate3d(${vd(t-a.left,r-a.left-o.width/2,n-a.left-o.width)}px, ${e-a.top-o.height-28}px, 0)`)}},this._handleScrubberMouseMove=({detail:{time:r,x:e,elementLeft:t,elementRight:n}})=>{var i,s,o,a,l,A,c,u,h,d;if(this._currentTime=r,(o=(s=(i=this._sceneController.composition)==null?void 0:i.tracks)==null?void 0:s[0])!=null&&o.scenes){const f=(c=(A=(l=(a=this._sceneController.composition)==null?void 0:a.tracks)==null?void 0:l[0])==null?void 0:A.drawScenes)==null?void 0:c.find(({start:g,duration:p})=>r>=g&&r<=g+p);if(f&&ln(f.layout.node).forEach(p=>{var y,Q;if(p!=null&&p.key&&this._sceneController.videos[p.key]){const b=this._sceneController.videos[p.key];(Q=(y=b.node).startLoadOnce)==null||Q.call(y),b.node.currentTime=r-f.start}}),this._draw(),(u=this._previewRef)!=null&&u.value){const g=this._previewRef.value.getBoundingClientRect(),p=(h=this._previewRef.value.getRootNode().host)==null?void 0:h.getBoundingClientRect();if(g&&p){const y=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[,Q]=Array.from(y.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${vd(t-p.left,e-p.left-g.width/2,n-p.left-g.width)}px, ${Q[1]}px, 0)`}}this._previewTimeRef.value&&this._previewTimeRef.value.setAttribute("content",fl(Math.max(0,Math.min(this._currentTime,(d=this._sceneController.composition)==null?void 0:d.duration))))}},this._handleScrubberMouseLeave=()=>{var r;(r=this._previewRef)!=null&&r.value&&(this._previewRef.value.style.opacity="0")},this._handleScrubberResize=({detail:{y:r}})=>{var e,t;if((e=this._previewRef)!=null&&e.value){const n=this._previewRef.value.getBoundingClientRect(),i=(t=this._previewRef.value.getRootNode().host)==null?void 0:t.getBoundingClientRect();if(n&&i){const s=this._previewRef.value.style.transform||"translate3d(0px, 0px, 0px)",[o]=Array.from(s.matchAll(/([+-]?([0-9]*[.])?[0-9]+)(?=px)\w+/g));this._previewRef.value.style.transform=`translate3d(${o[1]}px, ${r-i.top-n.height-28}px, 0)`}}}}_draw(r=this._currentTime){this._sceneController.composition&&this._canvasRef.value&&this._sceneController.composition.draw({canvas:this._canvasRef.value,currentTime:Math.max(0,Math.min(r,this._sceneController.composition.duration))})}connectedCallback(){super.connectedCallback();const r=Bi("vmp-media-player",this);r==null||r.addEventListener("scrubber:resize",this._handleScrubberResize),r==null||r.addEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),r==null||r.addEventListener("scrubber:mousemove",this._handleScrubberMouseMove),r==null||r.addEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}disconnectedCallback(){super.disconnectedCallback();const r=Bi("vmp-media-player",this);r==null||r.removeEventListener("scrubber:resize",this._handleScrubberResize),r==null||r.removeEventListener("scrubber:mouseenter",this._handleScrubberMouseEnter),r==null||r.removeEventListener("scrubber:mousemove",this._handleScrubberMouseMove),r==null||r.removeEventListener("scrubber:mouseleave",this._handleScrubberMouseLeave)}render(){var r,e,t;const{height:n,width:i}=ic({resolution:180,aspectRatio:this.aspectRatio}),s=((t=(e=(r=this._sceneController.composition)==null?void 0:r.tracks)==null?void 0:e[0])==null?void 0:t.scenes.length)??0;return!this.disabled&&s>1?Ce`
2850
2850
  <div
2851
2851
  ${vt(this._previewRef)}
2852
2852
  class="preview"
@@ -2886,14 +2886,14 @@ vec4 transition(vec2 uv) {
2886
2886
  color: var(--colors-light-1000);
2887
2887
  font-variant-numeric: tabular-nums;
2888
2888
  }
2889
- `],mr([te({type:Object})],An.prototype,"config",2),mr([te({type:Boolean})],An.prototype,"disabled",2),mr([te({type:Number})],An.prototype,"aspectRatio",2),mr([te({attribute:!1})],An.prototype,"dataResolver",2),An=mr([Rt("vmp-video-preview-content")],An);let On=class extends $e{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=qo}render(){return Ce`
2889
+ `],mr([ee({type:Object})],An.prototype,"config",2),mr([ee({type:Boolean})],An.prototype,"disabled",2),mr([ee({type:Number})],An.prototype,"aspectRatio",2),mr([ee({attribute:!1})],An.prototype,"dataResolver",2),An=mr([Rt("vmp-video-preview-content")],An);let On=class extends $e{constructor(){super(...arguments),this.disabled=!1,this.aspectRatio=1,this.dataResolver=qo}render(){return Ce`
2890
2890
  <vmp-video-preview-content
2891
2891
  ?disabled=${this.disabled}
2892
2892
  .config=${this.config}
2893
2893
  .aspectRatio=${this.aspectRatio}
2894
2894
  .dataResolver=${this.dataResolver}
2895
2895
  ></vmp-video-preview-content>
2896
- `}};mr([te({type:Object})],On.prototype,"config",2),mr([te({type:Boolean})],On.prototype,"disabled",2),mr([te({type:Number})],On.prototype,"aspectRatio",2),mr([te({attribute:!1})],On.prototype,"dataResolver",2),On=mr([Rt("vmp-video-preview")],On);class IB extends Zn{constructor(e){if(super(e),e.type!==gn.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),Xt}}const Bd=pn(IB);class vB{constructor(e){this.hiddenControls=[],this._measureRef=It(),this._prevControlsWidth=0,this._hideables={},this._showables={},this._onResize=t=>{var n,i,s;const o=this._measureRef.value,a=(s=(i=(n=t==null?void 0:t[0])==null?void 0:n.borderBoxSize)==null?void 0:i[0])==null?void 0:s.inlineSize;if(o&&a&&a!==this._prevControlsWidth){Object.keys(this._hideables).forEach(A=>{this._hideables[A].element.style.display=""}),Object.keys(this._showables).forEach(A=>{this._showables[A].element.style.display="none"});const l=[];for(;o.scrollWidth>o.offsetWidth;){const A=Object.keys(this._hideables).find(u=>this._hideables[u].hideIndex===l.length);if(!A)break;const c=this._hideables[A].element;c&&(c.style.display="none"),l.push(A),Object.keys(this._showables).forEach(u=>{this._showables[u].showOn.some(h=>l.includes(h))&&(this._showables[u].element.style.display="flex")})}this.hiddenControls=l,this._prevControlsWidth=a,this.host.requestUpdate()}},this.host=e}measure(){return vt(this._measureRef)}contain(){return dl(this._onResize)}hide(e,t){return Bd(n=>{this._hideables[e]={element:n,hideIndex:t}})}show(e,t){return Bd(n=>{this._showables[e]={element:n,showOn:t}})}}const gl=".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 CB=Object.defineProperty,yB=Object.getOwnPropertyDescriptor,Ti=(r,e,t,n)=>{for(var i=n>1?void 0:n?yB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&CB(e,t,i),i};let cn=class extends $e{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return Ce`
2896
+ `}};mr([ee({type:Object})],On.prototype,"config",2),mr([ee({type:Boolean})],On.prototype,"disabled",2),mr([ee({type:Number})],On.prototype,"aspectRatio",2),mr([ee({attribute:!1})],On.prototype,"dataResolver",2),On=mr([Rt("vmp-video-preview")],On);class IB extends Zn{constructor(e){if(super(e),e.type!==gn.ELEMENT)throw new Error("Resize directive must be used in an Element expression")}update(e,[t]){return t==null||t(e.element),Xt}}const Bd=pn(IB);class vB{constructor(e){this.hiddenControls=[],this._measureRef=It(),this._prevControlsWidth=0,this._hideables={},this._showables={},this._onResize=t=>{var n,i,s;const o=this._measureRef.value,a=(s=(i=(n=t==null?void 0:t[0])==null?void 0:n.borderBoxSize)==null?void 0:i[0])==null?void 0:s.inlineSize;if(o&&a&&a!==this._prevControlsWidth){Object.keys(this._hideables).forEach(A=>{this._hideables[A].element.style.display=""}),Object.keys(this._showables).forEach(A=>{this._showables[A].element.style.display="none"});const l=[];for(;o.scrollWidth>o.offsetWidth;){const A=Object.keys(this._hideables).find(u=>this._hideables[u].hideIndex===l.length);if(!A)break;const c=this._hideables[A].element;c&&(c.style.display="none"),l.push(A),Object.keys(this._showables).forEach(u=>{this._showables[u].showOn.some(h=>l.includes(h))&&(this._showables[u].element.style.display="flex")})}this.hiddenControls=l,this._prevControlsWidth=a,this.host.requestUpdate()}},this.host=e}measure(){return vt(this._measureRef)}contain(){return dl(this._onResize)}hide(e,t){return Bd(n=>{this._hideables[e]={element:n,hideIndex:t}})}show(e,t){return Bd(n=>{this._showables[e]={element:n,showOn:t}})}}const gl=".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 CB=Object.defineProperty,yB=Object.getOwnPropertyDescriptor,Ti=(r,e,t,n)=>{for(var i=n>1?void 0:n?yB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&CB(e,t,i),i};let cn=class extends $e{constructor(){super(...arguments),this.semibold=!1,this.truncate=!1,this.size="medium",this.content=""}render(){return Ce`
2897
2897
  <div
2898
2898
  part="content"
2899
2899
  class=${Ve({semibold:this.semibold,truncate:this.truncate,[this.size]:!0})}
@@ -2938,7 +2938,7 @@ vec4 transition(vec2 uv) {
2938
2938
  text-overflow: ellipsis;
2939
2939
  overflow: hidden;
2940
2940
  }
2941
- `],Ti([te({type:Boolean})],cn.prototype,"semibold",2),Ti([te({type:Boolean})],cn.prototype,"truncate",2),Ti([te({type:String})],cn.prototype,"size",2),Ti([te({type:String})],cn.prototype,"content",2),cn=Ti([Rt("vmp-text")],cn);var BB=Object.defineProperty,TB=Object.getOwnPropertyDescriptor,Qi=(r,e,t,n)=>{for(var i=n>1?void 0:n?TB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&BB(e,t,i),i};let un=class extends $e{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=It()}_handleBackClick(){this.subItemsActive=null,this.visibleItems=this.items??null}willUpdate(){this.visibleItems=this.visibleItems??this.items??null}updated(){var r,e;const t=(e=(r=this.items)==null?void 0:r.items.find(({id:n})=>this.subItemsActive===n))==null?void 0:e.subItems;this.visibleItems=t??this.items??null,t||(this.subItemsActive=null)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var r;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=an(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 r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}render(){var r,e;return Ce`
2941
+ `],Ti([ee({type:Boolean})],cn.prototype,"semibold",2),Ti([ee({type:Boolean})],cn.prototype,"truncate",2),Ti([ee({type:String})],cn.prototype,"size",2),Ti([ee({type:String})],cn.prototype,"content",2),cn=Ti([Rt("vmp-text")],cn);var BB=Object.defineProperty,TB=Object.getOwnPropertyDescriptor,Qi=(r,e,t,n)=>{for(var i=n>1?void 0:n?TB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&BB(e,t,i),i};let un=class extends $e{constructor(){super(...arguments),this.activeItems=[],this.visibleItems=null,this.subItemsActive=null,this.tippy=null,this._contentRef=It()}_handleBackClick(){this.subItemsActive=null,this.visibleItems=this.items??null}willUpdate(){this.visibleItems=this.visibleItems??this.items??null}updated(){var r,e;const t=(e=(r=this.items)==null?void 0:r.items.find(({id:n})=>this.subItemsActive===n))==null?void 0:e.subItems;this.visibleItems=t??this.items??null,t||(this.subItemsActive=null)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var r;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=an(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 r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}render(){var r,e;return Ce`
2942
2942
  <slot></slot>
2943
2943
  <div ${vt(this._contentRef)} class="content">
2944
2944
  <div class="title">
@@ -3026,7 +3026,7 @@ vec4 transition(vec2 uv) {
3026
3026
  height: 20px;
3027
3027
  width: 20px;
3028
3028
  }
3029
- `],Qi([te({type:Object})],un.prototype,"items",2),Qi([te({type:Array})],un.prototype,"activeItems",2),Qi([tt()],un.prototype,"visibleItems",2),Qi([tt()],un.prototype,"subItemsActive",2),un=Qi([Rt("vmp-menu")],un);var QB=Object.defineProperty,bB=Object.getOwnPropertyDescriptor,pl=(r,e,t,n)=>{for(var i=n>1?void 0:n?bB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&QB(e,t,i),i};let bi=class extends $e{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=It()}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var r;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=an(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!1,placement:"top",zIndex:1e4,appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}updated(){var r,e;this.disabled?(r=this.tippy)==null||r.disable():(e=this.tippy)==null||e.enable()}render(){return Ce`
3029
+ `],Qi([ee({type:Object})],un.prototype,"items",2),Qi([ee({type:Array})],un.prototype,"activeItems",2),Qi([rt()],un.prototype,"visibleItems",2),Qi([rt()],un.prototype,"subItemsActive",2),un=Qi([Rt("vmp-menu")],un);var QB=Object.defineProperty,bB=Object.getOwnPropertyDescriptor,pl=(r,e,t,n)=>{for(var i=n>1?void 0:n?bB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&QB(e,t,i),i};let bi=class extends $e{constructor(){super(...arguments),this.content="",this.disabled=!1,this.tippy=null,this._contentRef=It()}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{var r;const e=(r=this.shadowRoot)==null?void 0:r.querySelector("slot"),t=e==null?void 0:e.assignedElements()[0];t&&this._contentRef.value&&(this.tippy=an(t,{content:this._contentRef.value,allowHTML:!0,arrow:!1,animation:"shift-away-subtle",interactive:!1,placement:"top",zIndex:1e4,appendTo:()=>this.shadowRoot}))})}disconnectedCallback(){var r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}updated(){var r,e;this.disabled?(r=this.tippy)==null||r.disable():(e=this.tippy)==null||e.enable()}render(){return Ce`
3030
3030
  <slot></slot>
3031
3031
  <div ${vt(this._contentRef)} class="content">
3032
3032
  <vmp-text content=${this.content}></vmp-text>
@@ -3045,7 +3045,7 @@ vec4 transition(vec2 uv) {
3045
3045
  background: var(--colors-dark-800);
3046
3046
  border-radius: var(--radii-medium);
3047
3047
  }
3048
- `],pl([te({type:String})],bi.prototype,"content",2),pl([te({type:Boolean})],bi.prototype,"disabled",2),bi=pl([Rt("vmp-tooltip")],bi);var xB=Object.defineProperty,wB=Object.getOwnPropertyDescriptor,ml=(r,e,t,n)=>{for(var i=n>1?void 0:n?wB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&xB(e,t,i),i};let xi=class extends $e{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=It(),this._anchorRef=It(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=an(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 r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}render(){return Ce`
3048
+ `],pl([ee({type:String})],bi.prototype,"content",2),pl([ee({type:Boolean})],bi.prototype,"disabled",2),bi=pl([Rt("vmp-tooltip")],bi);var xB=Object.defineProperty,wB=Object.getOwnPropertyDescriptor,ml=(r,e,t,n)=>{for(var i=n>1?void 0:n?wB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&xB(e,t,i),i};let xi=class extends $e{constructor(){super(...arguments),this.volume=1,this.muted=!1,this.tippy=null,this._contentRef=It(),this._anchorRef=It(),this._menuOpen=!1}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._anchorRef.value&&this._contentRef.value&&(this.tippy=an(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 r;super.disconnectedCallback(),(r=this.tippy)==null||r.destroy()}render(){return Ce`
3049
3049
  <vmp-icon-button
3050
3050
  ${vt(this._anchorRef)}
3051
3051
  icon=${this.muted||this.volume===0?"muted":this.volume<1/3?"volume-low":this.volume<2/3?"volume-medium":"volume-high"}
@@ -3207,7 +3207,7 @@ vec4 transition(vec2 uv) {
3207
3207
  --volume-slider-height: 8px;
3208
3208
  color: var(--colors-light-800);
3209
3209
  }
3210
- `],ml([te({type:Number})],xi.prototype,"volume",2),ml([te({type:Boolean})],xi.prototype,"muted",2),xi=ml([Rt("vmp-volume-button")],xi);var SB=Object.defineProperty,RB=Object.getOwnPropertyDescriptor,js=(r,e,t,n)=>{for(var i=n>1?void 0:n?RB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&SB(e,t,i),i};let Un=class extends $e{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=It(),this._handleContainerResize=()=>{var r;const e=(r=this._containerRef.value)==null?void 0:r.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:resize",{detail:e,bubbles:!0,composed:!0}))},this._handleMouseEnter=r=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:mouseenter",{detail:{x:r.clientX,y:r.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=r=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect(),i=(r.clientX-((t==null?void 0:t.left)??0))/((t==null?void 0:t.width)??1);this.dispatchEvent(new CustomEvent("scrubber:mousemove",{detail:{x:r.clientX,y:r.clientY,time:i*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=r=>{this.dispatchEvent(new CustomEvent("scrubber:mouseleave",{detail:{x:r.clientX,y:r.clientY},bubbles:!0,composed:!0}))}}render(){var r;const e=((r=this.buffer)==null?void 0:r.sort((t,n)=>t.start<n.start?-1:n.start<t.start?1:0).reduce((t,{start:n,end:i},s)=>{const o=t[s-1],a=Math.floor(n),l=Math.ceil(i);return t.push({id:n,start:Math.max(0,a),end:Math.min(l,100)}),o&&o.end>=n-1&&(t[s].start=o.end),t},[]))??[];return Ce`
3210
+ `],ml([ee({type:Number})],xi.prototype,"volume",2),ml([ee({type:Boolean})],xi.prototype,"muted",2),xi=ml([Rt("vmp-volume-button")],xi);var SB=Object.defineProperty,RB=Object.getOwnPropertyDescriptor,js=(r,e,t,n)=>{for(var i=n>1?void 0:n?RB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&SB(e,t,i),i};let Un=class extends $e{constructor(){super(...arguments),this.duration=0,this.currentTime=0,this.buffer=[],this._containerRef=It(),this._handleContainerResize=()=>{var r;const e=(r=this._containerRef.value)==null?void 0:r.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:resize",{detail:e,bubbles:!0,composed:!0}))},this._handleMouseEnter=r=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect();this.dispatchEvent(new CustomEvent("scrubber:mouseenter",{detail:{x:r.clientX,y:r.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=r=>{var e;const t=(e=this._containerRef.value)==null?void 0:e.getBoundingClientRect(),i=(r.clientX-((t==null?void 0:t.left)??0))/((t==null?void 0:t.width)??1);this.dispatchEvent(new CustomEvent("scrubber:mousemove",{detail:{x:r.clientX,y:r.clientY,time:i*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=r=>{this.dispatchEvent(new CustomEvent("scrubber:mouseleave",{detail:{x:r.clientX,y:r.clientY},bubbles:!0,composed:!0}))}}render(){var r;const e=((r=this.buffer)==null?void 0:r.sort((t,n)=>t.start<n.start?-1:n.start<t.start?1:0).reduce((t,{start:n,end:i},s)=>{const o=t[s-1],a=Math.floor(n),l=Math.ceil(i);return t.push({id:n,start:Math.max(0,a),end:Math.min(l,100)}),o&&o.end>=n-1&&(t[s].start=o.end),t},[]))??[];return Ce`
3211
3211
  <div
3212
3212
  class="container"
3213
3213
  ${vt(this._containerRef)}
@@ -3380,14 +3380,14 @@ vec4 transition(vec2 uv) {
3380
3380
  --player-scrubber-height: 16px;
3381
3381
  color: var(--colors-light-800);
3382
3382
  }
3383
- `],js([te({type:Number})],Un.prototype,"duration",2),js([te({type:Number})],Un.prototype,"currentTime",2),js([te({type:Array})],Un.prototype,"buffer",2),Un=js([Rt("vmp-progress-scrubber")],Un);var DB=Object.defineProperty,_B=Object.getOwnPropertyDescriptor,st=(r,e,t,n)=>{for(var i=n>1?void 0:n?_B(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&DB(e,t,i),i};let Ze=class extends $e{constructor(){super(...arguments),this.resizeHider=new vB(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=hl,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:r}){this.volumeMenuOpen=r}_handleLanguageMenuOpen({detail:r}){this.languageMenuOpen=r}_handleLevelsMenuOpen({detail:r}){this.levelsMenuOpen=r}_handlePlaybackMenuToggle({detail:r}){this.playbackRateMenuOpen=r}_handleSettingsMenuToggle({detail:r}){this.settingsMenuOpen=r}hideMenus(){var r,e;(e=Array.from((r=this.shadowRoot)==null?void 0:r.querySelectorAll("vmp-menu, vmp-tooltip, vmp-volume-button")))==null||e.forEach(t=>{var n;(n=t.tippy)==null||n.hide()})}render(){var r,e,t,n,i,s,o,a,l,A,c,u,h,d,f;const g=((r=this.languages)==null?void 0:r.map(Y=>({id:`language-${Y.value}`,event:"language:click",label:Y.label,value:Y.value})))??[],p={title:"Languages",items:g},C={id:"languages",label:"Languages",subItems:p},Q=p.items.find(({value:Y})=>Y===this.language),b=((e=this.levels)==null?void 0:e.map((Y,ne)=>{const ce=Math.min(Y.width,Y.height);return{id:`level-${ne.toString()}`,event:"level:click",label:`${ce}p`,value:{resolution:ce,level:ne}}}))??[],y={title:"Quality",items:[...b.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},w={id:"levels",label:"Quality",subItems:y},R=(t=y.items)==null?void 0:t.find(({value:Y})=>Y.level===this.level),k=[(g==null?void 0:g.length)&&"languages","levels","playback-rate","captions","fullscreen"].filter(Boolean).filter(Y=>{var ne;return(ne=this.controls)==null?void 0:ne.includes(Y)}),$={title:"Settings",items:[(g==null?void 0:g.length)&&C,tB,rB,w,nB].filter(Boolean).filter(({id:Y})=>k.includes(Y)&&this.resizeHider.hiddenControls.includes(Y))},K=(n=this.controls)==null?void 0:n.includes("progress"),O=(i=this.controls)==null?void 0:i.includes("navigation"),J=(s=this.controls)==null?void 0:s.includes("play"),ie=(o=this.controls)==null?void 0:o.includes("volume"),ee=(a=this.controls)==null?void 0:a.includes("current-time"),le=(l=this.controls)==null?void 0:l.includes("duration"),_=(A=this.controls)==null?void 0:A.includes("languages"),P=(c=this.controls)==null?void 0:c.includes("levels"),X=(u=this.controls)==null?void 0:u.includes("speed"),D=(h=this.controls)==null?void 0:h.includes("captions"),S=(d=this.controls)==null?void 0:d.includes("fullscreen"),F=J||ie||ee||le||_||P||X||D||S,W=[this.captions&&"captions",this.fullscreen&&"fullscreen",`language-${this.language}`,`level-${(f=this.level)==null?void 0:f.toString()}`,`playback-rate-${this.playbackRate.toString()}`].filter(Boolean);return Ce`
3383
+ `],js([ee({type:Number})],Un.prototype,"duration",2),js([ee({type:Number})],Un.prototype,"currentTime",2),js([ee({type:Array})],Un.prototype,"buffer",2),Un=js([Rt("vmp-progress-scrubber")],Un);var DB=Object.defineProperty,_B=Object.getOwnPropertyDescriptor,st=(r,e,t,n)=>{for(var i=n>1?void 0:n?_B(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&DB(e,t,i),i};let Ze=class extends $e{constructor(){super(...arguments),this.resizeHider=new vB(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=hl,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:r}){this.volumeMenuOpen=r}_handleLanguageMenuOpen({detail:r}){this.languageMenuOpen=r}_handleLevelsMenuOpen({detail:r}){this.levelsMenuOpen=r}_handlePlaybackMenuToggle({detail:r}){this.playbackRateMenuOpen=r}_handleSettingsMenuToggle({detail:r}){this.settingsMenuOpen=r}hideMenus(){var r,e;(e=Array.from((r=this.shadowRoot)==null?void 0:r.querySelectorAll("vmp-menu, vmp-tooltip, vmp-volume-button")))==null||e.forEach(t=>{var n;(n=t.tippy)==null||n.hide()})}render(){var r,e,t,n,i,s,o,a,l,A,c,u,h,d,f;const g=((r=this.languages)==null?void 0:r.map(Y=>({id:`language-${Y.value}`,event:"language:click",label:Y.label,value:Y.value})))??[],p={title:"Languages",items:g},y={id:"languages",label:"Languages",subItems:p},Q=p.items.find(({value:Y})=>Y===this.language),b=((e=this.levels)==null?void 0:e.map((Y,ne)=>{const ce=Math.min(Y.width,Y.height);return{id:`level-${ne.toString()}`,event:"level:click",label:`${ce}p`,value:{resolution:ce,level:ne}}}))??[],C={title:"Quality",items:[...b.reverse(),{id:"level--1",event:"level:click",label:"Auto",value:{level:-1,resolution:"auto"}}]},w={id:"levels",label:"Quality",subItems:C},R=(t=C.items)==null?void 0:t.find(({value:Y})=>Y.level===this.level),k=[(g==null?void 0:g.length)&&"languages","levels","playback-rate","captions","fullscreen"].filter(Boolean).filter(Y=>{var ne;return(ne=this.controls)==null?void 0:ne.includes(Y)}),$={title:"Settings",items:[(g==null?void 0:g.length)&&y,tB,rB,w,nB].filter(Boolean).filter(({id:Y})=>k.includes(Y)&&this.resizeHider.hiddenControls.includes(Y))},V=(n=this.controls)==null?void 0:n.includes("progress"),O=(i=this.controls)==null?void 0:i.includes("navigation"),W=(s=this.controls)==null?void 0:s.includes("play"),ie=(o=this.controls)==null?void 0:o.includes("volume"),te=(a=this.controls)==null?void 0:a.includes("current-time"),le=(l=this.controls)==null?void 0:l.includes("duration"),D=(A=this.controls)==null?void 0:A.includes("languages"),P=(c=this.controls)==null?void 0:c.includes("levels"),X=(u=this.controls)==null?void 0:u.includes("speed"),_=(h=this.controls)==null?void 0:h.includes("captions"),S=(d=this.controls)==null?void 0:d.includes("fullscreen"),F=W||ie||te||le||D||P||X||_||S,J=[this.captions&&"captions",this.fullscreen&&"fullscreen",`language-${this.language}`,`level-${(f=this.level)==null?void 0:f.toString()}`,`playback-rate-${this.playbackRate.toString()}`].filter(Boolean);return Ce`
3384
3384
  <div
3385
3385
  ${this.resizeHider.measure()}
3386
3386
  ${this.resizeHider.contain()}
3387
- class=${Ve({container:!0,hidden:!K&&!F})}
3387
+ class=${Ve({container:!0,hidden:!V&&!F})}
3388
3388
  >
3389
3389
  <div
3390
- class=${Ve({"scrubber-container":!0,hidden:!K})}
3390
+ class=${Ve({"scrubber-container":!0,hidden:!V})}
3391
3391
  >
3392
3392
  <vmp-progress-scrubber
3393
3393
  class=${Ve({scrubber:!0,invisible:this.volumeMenuOpen||this.levelsMenuOpen||this.playbackRateMenuOpen||this.settingsMenuOpen})}
@@ -3419,7 +3419,7 @@ vec4 transition(vec2 uv) {
3419
3419
  ></vmp-icon-button>
3420
3420
  </div>
3421
3421
  <vmp-icon-button
3422
- class=${Ve({hidden:!J})}
3422
+ class=${Ve({hidden:!W})}
3423
3423
  icon=${this.playing?"pause":"play"}
3424
3424
  weight="heavy"
3425
3425
  rounded="full"
@@ -3435,7 +3435,7 @@ vec4 transition(vec2 uv) {
3435
3435
  <div class="time">
3436
3436
  <vmp-text
3437
3437
  ${this.resizeHider.hide("current-time",2)}
3438
- class=${Ve({hidden:!ee})}
3438
+ class=${Ve({hidden:!te})}
3439
3439
  ?semibold=${!0}
3440
3440
  content="${fl(this.currentTime)}${le?"/":null}"
3441
3441
  ></vmp-text>
@@ -3450,9 +3450,9 @@ vec4 transition(vec2 uv) {
3450
3450
  <div class="section">
3451
3451
  <vmp-menu
3452
3452
  ${this.resizeHider.hide("languages",0)}
3453
- class=${Ve({hidden:!_||!g||g.length<=1})}
3453
+ class=${Ve({hidden:!D||!g||g.length<=1})}
3454
3454
  .items=${p}
3455
- .activeItems=${W}
3455
+ .activeItems=${J}
3456
3456
  @menu:toggle=${this._handleLanguageMenuOpen}
3457
3457
  >
3458
3458
  <vmp-tooltip content="Languages" ?disabled=${this.languageMenuOpen}>
@@ -3462,8 +3462,8 @@ vec4 transition(vec2 uv) {
3462
3462
  <vmp-menu
3463
3463
  ${this.resizeHider.hide("levels",1)}
3464
3464
  class=${Ve({hidden:!P||b.length<=0})}
3465
- .items=${y}
3466
- .activeItems=${W}
3465
+ .items=${C}
3466
+ .activeItems=${J}
3467
3467
  @menu:toggle=${this._handleLevelsMenuOpen}
3468
3468
  >
3469
3469
  <vmp-tooltip content="Quality" ?disabled=${this.levelsMenuOpen}>
@@ -3474,7 +3474,7 @@ vec4 transition(vec2 uv) {
3474
3474
  ${this.resizeHider.hide("playback-rate",5)}
3475
3475
  class=${Ve({hidden:!X})}
3476
3476
  .items=${Ed}
3477
- .activeItems=${W}
3477
+ .activeItems=${J}
3478
3478
  @menu:toggle=${this._handlePlaybackMenuToggle}
3479
3479
  >
3480
3480
  <vmp-tooltip content="Playback speed" ?disabled=${this.playbackRateMenuOpen}>
@@ -3485,7 +3485,7 @@ vec4 transition(vec2 uv) {
3485
3485
  </vmp-menu>
3486
3486
  <vmp-tooltip
3487
3487
  ${this.resizeHider.hide("captions",4)}
3488
- class=${Ve({hidden:!D})}
3488
+ class=${Ve({hidden:!_})}
3489
3489
  content="Captions"
3490
3490
  >
3491
3491
  <vmp-icon-button
@@ -3511,7 +3511,7 @@ vec4 transition(vec2 uv) {
3511
3511
  <vmp-menu
3512
3512
  ${this.resizeHider.show("settings",["levels","playback-rate","captions","fullscreen"])}
3513
3513
  .items=${$}
3514
- .activeItems=${W}
3514
+ .activeItems=${J}
3515
3515
  @menu:toggle=${this._handleSettingsMenuToggle}
3516
3516
  >
3517
3517
  <vmp-tooltip content="Settings" ?disabled=${this.settingsMenuOpen}>
@@ -3592,7 +3592,7 @@ vec4 transition(vec2 uv) {
3592
3592
  .hidden {
3593
3593
  display: none;
3594
3594
  }
3595
- `],st([te({type:Boolean})],Ze.prototype,"playing",2),st([te({type:Number})],Ze.prototype,"volume",2),st([te({type:Boolean})],Ze.prototype,"muted",2),st([te({type:Number})],Ze.prototype,"currentTime",2),st([te({type:Number})],Ze.prototype,"duration",2),st([te({type:Array})],Ze.prototype,"languages",2),st([te({type:String})],Ze.prototype,"language",2),st([te({type:Array,attribute:!1})],Ze.prototype,"levels",2),st([te({type:Number})],Ze.prototype,"level",2),st([te({type:Number})],Ze.prototype,"playbackRate",2),st([te({type:Array})],Ze.prototype,"buffer",2),st([te({type:Boolean})],Ze.prototype,"captions",2),st([te({type:Boolean})],Ze.prototype,"fullscreen",2),st([te({type:Array})],Ze.prototype,"controls",2),st([tt()],Ze.prototype,"volumeMenuOpen",2),st([tt()],Ze.prototype,"languageMenuOpen",2),st([tt()],Ze.prototype,"levelsMenuOpen",2),st([tt()],Ze.prototype,"playbackRateMenuOpen",2),st([tt()],Ze.prototype,"settingsMenuOpen",2),Ze=st([Rt("vmp-player-controls")],Ze);var LB=Object.defineProperty,FB=Object.getOwnPropertyDescriptor,kB=(r,e,t,n)=>{for(var i=n>1?void 0:n?FB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&LB(e,t,i),i};let El=class extends $e{render(){return Ce`<vmp-icon icon="loading"></vmp-icon>`}};El.styles=[$e.styles??[],lt`
3595
+ `],st([ee({type:Boolean})],Ze.prototype,"playing",2),st([ee({type:Number})],Ze.prototype,"volume",2),st([ee({type:Boolean})],Ze.prototype,"muted",2),st([ee({type:Number})],Ze.prototype,"currentTime",2),st([ee({type:Number})],Ze.prototype,"duration",2),st([ee({type:Array})],Ze.prototype,"languages",2),st([ee({type:String})],Ze.prototype,"language",2),st([ee({type:Array,attribute:!1})],Ze.prototype,"levels",2),st([ee({type:Number})],Ze.prototype,"level",2),st([ee({type:Number})],Ze.prototype,"playbackRate",2),st([ee({type:Array})],Ze.prototype,"buffer",2),st([ee({type:Boolean})],Ze.prototype,"captions",2),st([ee({type:Boolean})],Ze.prototype,"fullscreen",2),st([ee({type:Array})],Ze.prototype,"controls",2),st([rt()],Ze.prototype,"volumeMenuOpen",2),st([rt()],Ze.prototype,"languageMenuOpen",2),st([rt()],Ze.prototype,"levelsMenuOpen",2),st([rt()],Ze.prototype,"playbackRateMenuOpen",2),st([rt()],Ze.prototype,"settingsMenuOpen",2),Ze=st([Rt("vmp-player-controls")],Ze);var LB=Object.defineProperty,FB=Object.getOwnPropertyDescriptor,kB=(r,e,t,n)=>{for(var i=n>1?void 0:n?FB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&LB(e,t,i),i};let El=class extends $e{render(){return Ce`<vmp-icon icon="loading"></vmp-icon>`}};El.styles=[$e.styles??[],lt`
3596
3596
  :host {
3597
3597
  display: flex;
3598
3598
  align-items: center;
@@ -3621,7 +3621,7 @@ vec4 transition(vec2 uv) {
3621
3621
  /* Line height controls the spacing between the cloned boxes so has to override the default */
3622
3622
  line-height: 2.2;
3623
3623
  }
3624
- `],Td([te({type:String})],zs.prototype,"caption",2),zs=Td([Rt("vmp-captions")],zs);var PB=Object.defineProperty,OB=Object.getOwnPropertyDescriptor,gt=(r,e,t,n)=>{for(var i=n>1?void 0:n?OB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&PB(e,t,i),i};const UB=3e3;let ot=class extends $e{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=hl,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=It()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},UB)}_immediateShowControls(){this.showControls=!0,clearTimeout(this._controlHideTimeout)}_immediateHideControls(){this.showControls=!1,this._hasTouched=!1,clearTimeout(this._controlHideTimeout)}willUpdate(r){var e;r.has("playing")&&this.playing&&this._startHideControls(),r.has("showControls")&&this.playing&&!this.showControls&&((e=this._playerControlsRef.value)==null||e.hideMenus())}render(){var r;const e=(r=this.controls)==null?void 0:r.includes("play-large"),t=this.playing&&!this.showControls,n=!!(e&&!this.playing);return Ce`
3624
+ `],Td([ee({type:String})],zs.prototype,"caption",2),zs=Td([Rt("vmp-captions")],zs);var PB=Object.defineProperty,OB=Object.getOwnPropertyDescriptor,gt=(r,e,t,n)=>{for(var i=n>1?void 0:n?OB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&PB(e,t,i),i};const UB=3e3;let ot=class extends $e{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=hl,this.showControls=!0,this._hasTouched=!1,this._playerControlsRef=It()}_startHideControls(){clearTimeout(this._controlHideTimeout),this._controlHideTimeout=setTimeout(()=>{this.showControls=!1,this._hasTouched=!1},UB)}_immediateShowControls(){this.showControls=!0,clearTimeout(this._controlHideTimeout)}_immediateHideControls(){this.showControls=!1,this._hasTouched=!1,clearTimeout(this._controlHideTimeout)}willUpdate(r){var e;r.has("playing")&&this.playing&&this._startHideControls(),r.has("showControls")&&this.playing&&!this.showControls&&((e=this._playerControlsRef.value)==null||e.hideMenus())}render(){var r;const e=(r=this.controls)==null?void 0:r.includes("play-large"),t=this.playing&&!this.showControls,n=!!(e&&!this.playing);return Ce`
3625
3625
  <div
3626
3626
  class=${Ve({container:!0,hide:t})}
3627
3627
  @mousemove=${()=>{this._immediateShowControls(),this._startHideControls()}}
@@ -3741,7 +3741,7 @@ vec4 transition(vec2 uv) {
3741
3741
  vmp-captions.hiddenControls {
3742
3742
  transform: translateY(calc(var(--space-small) * -1));
3743
3743
  }
3744
- `],gt([te({type:Boolean})],ot.prototype,"loading",2),gt([te({type:Boolean})],ot.prototype,"playing",2),gt([te({type:Number})],ot.prototype,"volume",2),gt([te({type:Boolean})],ot.prototype,"muted",2),gt([te({type:Number})],ot.prototype,"currentTime",2),gt([te({type:Number})],ot.prototype,"duration",2),gt([te({type:Array})],ot.prototype,"languages",2),gt([te({type:String})],ot.prototype,"language",2),gt([te({type:Array,attribute:!1})],ot.prototype,"levels",2),gt([te({type:Number})],ot.prototype,"level",2),gt([te({type:Number})],ot.prototype,"playbackRate",2),gt([te({type:String})],ot.prototype,"caption",2),gt([te({type:Array})],ot.prototype,"buffer",2),gt([te({type:Boolean})],ot.prototype,"captions",2),gt([te({type:Boolean})],ot.prototype,"fullscreen",2),gt([te({type:Array})],ot.prototype,"controls",2),gt([tt()],ot.prototype,"showControls",2),ot=gt([Rt("vmp-player-overlay")],ot);var GB=Object.defineProperty,HB=Object.getOwnPropertyDescriptor,nt=(r,e,t,n)=>{for(var i=n>1?void 0:n?HB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&GB(e,t,i),i};const $B=1e3/60,YB=30;let je=class extends $e{constructor(){super(...arguments),this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.dataResolver=qo,this.languageResolver=Op,this._sceneController=new zy(this),this._drawController=new Vy(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=It(),this._canvasRef=It(),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 r;(r=this.shadowRoot)!=null&&r.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,$B):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=(r=performance.now())=>{if(this.composition){if(this._waiting=this._drawController.activeScenes.some(e=>ln(e.layout.node).some(n=>{if(n!=null&&n.key&&this.videos[n==null?void 0:n.key]&&this.videoState[n==null?void 0:n.key]){const i=this.videos[n==null?void 0:n.key],s=this.videoState[n==null?void 0:n.key];return!s||!s.initialised||s.waiting||i.node.readyState<3}})),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),r-(this._lastTimestamp??0)>1e3/YB){let e=this._drawController.currentTime;const t=(r-(this._lastTimestamp??r))/1e3*this.playbackRate;e+=t,this._drawController.currentTime=e,this._lastTimestamp=r}this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))}this.paused||this._loop()},this._handleError=r=>{this._errors=[...this.errors,r.error],r.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(r=>{const e=setInterval(()=>{!!this.errors.find(n=>n.fatal)&&r(!1),!this.loading&&!this.processing&&this.composition&&this.duration>0&&r(!0)},500);setTimeout(()=>{clearInterval(e),r(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get videos(){return this._sceneController.videos??{}}get videoState(){return this._sceneController.videoState}get composition(){return this._sceneController.composition}get activeScenes(){return this._drawController.activeScenes}set paused(r){r!==this._paused&&(this._paused=r,this.requestUpdate(),this.dispatchEvent(new CustomEvent(r?"pause":"play")))}get paused(){return this._paused}set playbackRate(r){r!==this._playbackRate&&(this._playbackRate=r,Object.values(this.videos).forEach(({node:e})=>{e.playbackRate=r}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:r})))}get playbackRate(){return this._playbackRate}set volume(r){const e=Math.min(1,Math.max(0,r));e!==this._volume&&(Object.values(this.videos).forEach(({node:t})=>{t.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:r})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(r){Object.values(this.videos).forEach(({node:e})=>{e.muted=r}),r!==this._muted&&(this._muted=r,localStorage.setItem("vmp-player-muted",r.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:r?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(r){r!==this._videoResolution&&(this._videoResolution=r,Object.values(this.videos).forEach(({hls:e})=>{if(e){const t=e.levels.findIndex(n=>Math.min(n.height,n.width)===r);e.currentLevel=t??-1}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(r){r!==this._drawController.currentTime&&(this._drawController.currentTime=r,this._sceneController.setVideosCurrentTime(r))}get currentTime(){return this._drawController.currentTime}reset(r=0,e=!1){this._lastTimestamp=null,this._drawController.currentTime=r,this._sceneController.setVideosCurrentTime(r),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,Object.values(this.videos).forEach(({node:r})=>{r.pause()})}draw(r){return this._drawController.draw(r)}toggleFullscreen(r){r??this.fullscreen?eB():this._playerRef.value&&Zy(this._playerRef.value)}connectedCallback(){var r;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(r=this.shadowRoot)!=null&&r.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(r){r.has("propAspectRatio")&&(this._aspectRatio=this.propAspectRatio),r.has("propLanguage")&&(this._language=this.propLanguage)}updated(r){r.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this._sceneController.hasPlayed&&!this.processing&&r.get("_processing")&&this.play(),r.has("_processing")&&this.processing&&this.dispatchEvent(new CustomEvent("processing"))}disconnectedCallback(){var r;super.disconnectedCallback(),(r=this._observer)==null||r.disconnect(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?Ce`
3744
+ `],gt([ee({type:Boolean})],ot.prototype,"loading",2),gt([ee({type:Boolean})],ot.prototype,"playing",2),gt([ee({type:Number})],ot.prototype,"volume",2),gt([ee({type:Boolean})],ot.prototype,"muted",2),gt([ee({type:Number})],ot.prototype,"currentTime",2),gt([ee({type:Number})],ot.prototype,"duration",2),gt([ee({type:Array})],ot.prototype,"languages",2),gt([ee({type:String})],ot.prototype,"language",2),gt([ee({type:Array,attribute:!1})],ot.prototype,"levels",2),gt([ee({type:Number})],ot.prototype,"level",2),gt([ee({type:Number})],ot.prototype,"playbackRate",2),gt([ee({type:String})],ot.prototype,"caption",2),gt([ee({type:Array})],ot.prototype,"buffer",2),gt([ee({type:Boolean})],ot.prototype,"captions",2),gt([ee({type:Boolean})],ot.prototype,"fullscreen",2),gt([ee({type:Array})],ot.prototype,"controls",2),gt([rt()],ot.prototype,"showControls",2),ot=gt([Rt("vmp-player-overlay")],ot);var GB=Object.defineProperty,HB=Object.getOwnPropertyDescriptor,et=(r,e,t,n)=>{for(var i=n>1?void 0:n?HB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&GB(e,t,i),i};const $B=1e3/60,YB=30;let We=class extends $e{constructor(){super(...arguments),this.debug=!1,this.propAspectRatio=0,this.preload="auto",this.autoplay=!1,this.loading=!1,this.disabled=!1,this.dataResolver=qo,this.languageResolver=Op,this._sceneController=new zy(this),this._drawController=new Vy(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=It(),this._canvasRef=It(),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 r;(r=this.shadowRoot)!=null&&r.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,$B):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=(r=performance.now())=>{if(this.composition){if(this._waiting=this._drawController.activeScenes.some(e=>ln(e.layout.node).some(n=>{if(n!=null&&n.key&&this.videos[n==null?void 0:n.key]&&this.videoState[n==null?void 0:n.key]){const i=this.videos[n==null?void 0:n.key],s=this.videoState[n==null?void 0:n.key];return!s||!s.initialised||s.waiting||i.node.readyState<3}})),this.waiting?(this._lastTimestamp=null,this._lastWaiting||this.dispatchEvent(new CustomEvent("waiting"))):this._lastWaiting&&this.dispatchEvent(new CustomEvent("playing")),r-(this._lastTimestamp??0)>1e3/YB){let e=this._drawController.currentTime;const t=(r-(this._lastTimestamp??r))/1e3*this.playbackRate;e+=t,this._drawController.currentTime=e,this._lastTimestamp=r}this._lastWaiting=this._waiting,this._drawController.currentTime>=this.duration&&(this.pause(),this.dispatchEvent(new CustomEvent("ended")))}this.paused||this._loop()},this._handleError=r=>{this._errors=[...this.errors,r.error],r.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(r=>{const e=setInterval(()=>{!!this.errors.find(n=>n.fatal)&&r(!1),!this.loading&&!this.processing&&this.composition&&this.duration>0&&r(!0)},500);setTimeout(()=>{clearInterval(e),r(!1)},60*1e3)}),this._initialised}get duration(){return this._sceneController.duration}get videos(){return this._sceneController.videos??{}}get videoState(){return this._sceneController.videoState}get composition(){return this._sceneController.composition}get activeScenes(){return this._drawController.activeScenes}set paused(r){r!==this._paused&&(this._paused=r,this.requestUpdate(),this.dispatchEvent(new CustomEvent(r?"pause":"play")))}get paused(){return this._paused}set playbackRate(r){r!==this._playbackRate&&(this._playbackRate=r,Object.values(this.videos).forEach(({node:e})=>{e.playbackRate=r}),this.requestUpdate(),this.dispatchEvent(new CustomEvent("ratechange",{detail:r})))}get playbackRate(){return this._playbackRate}set volume(r){const e=Math.min(1,Math.max(0,r));e!==this._volume&&(Object.values(this.videos).forEach(({node:t})=>{t.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:r})))}get volume(){return this._volume??(this._volume=parseFloat(localStorage.getItem("vmp-player-volume")??"1"))}set muted(r){Object.values(this.videos).forEach(({node:e})=>{e.muted=r}),r!==this._muted&&(this._muted=r,localStorage.setItem("vmp-player-muted",r.toString()),this.requestUpdate(),this.dispatchEvent(new CustomEvent("volumechange",{detail:r?0:this.volume})))}get muted(){return this._muted??(this._muted=this.autoplay||localStorage.getItem("vmp-player-muted")==="true")}set videoResolution(r){r!==this._videoResolution&&(this._videoResolution=r,Object.values(this.videos).forEach(({hls:e})=>{if(e){const t=e.levels.findIndex(n=>Math.min(n.height,n.width)===r);e.currentLevel=t??-1}}),this.requestUpdate())}get videoResolution(){return this._videoResolution}set currentTime(r){r!==this._drawController.currentTime&&(this._drawController.currentTime=r,this._sceneController.setVideosCurrentTime(r))}get currentTime(){return this._drawController.currentTime}reset(r=0,e=!1){this._lastTimestamp=null,this._drawController.currentTime=r,this._sceneController.setVideosCurrentTime(r),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,Object.values(this.videos).forEach(({node:r})=>{r.pause()})}draw(r){return this._drawController.draw(r)}toggleFullscreen(r){r??this.fullscreen?eB():this._playerRef.value&&Zy(this._playerRef.value)}connectedCallback(){var r;super.connectedCallback(),this.addEventListener("error",this._handleError),document.addEventListener("fullscreenchange",this._handleFullscreenChange),document.addEventListener("visibilitychange",this._handleVisibilityChange),(r=this.shadowRoot)!=null&&r.host&&(this._observer=new ResizeObserver(this._handleContainerResize),this._observer.observe(this.shadowRoot.host))}willUpdate(r){r.has("propAspectRatio")&&(this._aspectRatio=this.propAspectRatio),r.has("propLanguage")&&(this._language=this.propLanguage)}updated(r){r.has("propAspectRatio")&&!this.propAspectRatio&&this._handleContainerResize(),this.autoplay&&!this._sceneController.hasPlayed&&!this.processing&&r.get("_processing")&&this.play(),r.has("_processing")&&this.processing&&this.dispatchEvent(new CustomEvent("processing"))}disconnectedCallback(){var r;super.disconnectedCallback(),(r=this._observer)==null||r.disconnect(),document.removeEventListener("fullscreenchange",this._handleFullscreenChange),document.removeEventListener("visibilitychange",this._handleVisibilityChange)}_renderStyles(){return this.propAspectRatio?typeof this.propAspectRatio=="number"?Ce`
3745
3745
  <style>
3746
3746
  :host {
3747
3747
  aspect-ratio: ${this.propAspectRatio};
@@ -3762,7 +3762,7 @@ vec4 transition(vec2 uv) {
3762
3762
  <vmp-text semibold content="An error has occurred when attempting to play this video."></vmp-text>
3763
3763
  <vmp-text semibold content="Please try again later."></vmp-text>
3764
3764
  </div>
3765
- </div>`}render(){var r;const e=this.loading||this.processing||!this.composition||this.duration<=0,{height:t,width:n}=ic({resolution:1080,aspectRatio:this.aspectRatio}),i=e?[]:(r=this.controls??hl)==null?void 0:r.filter(A=>!(A==="fullscreen"&&Jy())),s=!(i!=null&&i.includes("preview")),o=this.loading||this.waiting||this.processing,a=!this.config,l=!!this.errors.find(A=>A.fatal);return Ce`
3765
+ </div>`}render(){var r;const e=this.disabled||this.loading||this.processing||!this.composition||this.duration<=0,{height:t,width:n}=ic({resolution:1080,aspectRatio:this.aspectRatio}),i=e?[]:(r=this.controls??hl)==null?void 0:r.filter(A=>!(A==="fullscreen"&&Jy())),s=!(i!=null&&i.includes("preview")),o=this.loading||this.waiting||this.processing,a=!this.config,l=!!this.errors.find(A=>A.fatal);return Ce`
3766
3766
  ${this._renderStyles()}
3767
3767
  <div
3768
3768
  ${vt(this._playerRef)}
@@ -3810,7 +3810,7 @@ vec4 transition(vec2 uv) {
3810
3810
  .dataResolver=${this.dataResolver}
3811
3811
  ></vmp-video-preview>`}
3812
3812
  </div>
3813
- `}};je.styles=[$e.styles??[],lt`
3813
+ `}};We.styles=[$e.styles??[],lt`
3814
3814
  :host {
3815
3815
  --player-border-radius: var(--vouch-media-player-border-radius, 0px);
3816
3816
 
@@ -3871,7 +3871,7 @@ vec4 transition(vec2 uv) {
3871
3871
  top: 0;
3872
3872
  left: 0;
3873
3873
  }
3874
- `],nt([te({type:Boolean})],je.prototype,"debug",2),nt([te({type:Object})],je.prototype,"config",2),nt([te({type:String,attribute:"language"})],je.prototype,"propLanguage",2),nt([te({type:Number,attribute:"aspectratio"})],je.prototype,"propAspectRatio",2),nt([te({type:String})],je.prototype,"preload",2),nt([te({type:Boolean})],je.prototype,"autoplay",2),nt([te({type:Boolean})],je.prototype,"loading",2),nt([te({type:Array})],je.prototype,"controls",2),nt([te({attribute:!1})],je.prototype,"dataResolver",2),nt([te({attribute:!1})],je.prototype,"languageResolver",2),nt([tt()],je.prototype,"_pageHidden",2),nt([tt()],je.prototype,"_aspectRatio",2),nt([tt()],je.prototype,"_processing",2),nt([tt()],je.prototype,"_waiting",2),nt([tt()],je.prototype,"_errors",2),nt([tt()],je.prototype,"_seeking",2),nt([tt()],je.prototype,"_language",2),nt([tt()],je.prototype,"_languages",2),nt([tt()],je.prototype,"_captions",2),nt([tt()],je.prototype,"_fullscreen",2),je=nt([Rt("vmp-media-player")],je);var VB=Object.defineProperty,KB=Object.getOwnPropertyDescriptor,bt=(r,e,t,n)=>{for(var i=n>1?void 0:n?KB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&VB(e,t,i),i};let pt=class extends Cr{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 cf(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 Cf(this),this._trackingController=new Rp(this),this._mediaPlayerRef=It()}get fetching(){return this._fetcherController.fetching}get waiting(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.waiting}get initialised(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.initialised}get seeking(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.seeking}get paused(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.paused}get captions(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.captions}get fullscreen(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.fullscreen}get duration(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.duration}set currentTime(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=r)}get currentTime(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.currentTime)??0}set playbackRate(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=r)}get playbackRate(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.playbackRate)??1}set volume(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=r)}get volume(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.volume)??1}set muted(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=r)}get muted(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.muted)??!1}get videoState(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var r;(r=this._mediaPlayerRef.value)==null||r.play()}pause(){var r;(r=this._mediaPlayerRef.value)==null||r.pause()}reset(r=0,e=!1){var t;(t=this._mediaPlayerRef.value)==null||t.reset(r,e)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?Ce`
3874
+ `],et([ee({type:Boolean})],We.prototype,"debug",2),et([ee({type:Object})],We.prototype,"config",2),et([ee({type:String,attribute:"language"})],We.prototype,"propLanguage",2),et([ee({type:Number,attribute:"aspectratio"})],We.prototype,"propAspectRatio",2),et([ee({type:String})],We.prototype,"preload",2),et([ee({type:Boolean})],We.prototype,"autoplay",2),et([ee({type:Boolean})],We.prototype,"loading",2),et([ee({type:Boolean})],We.prototype,"disabled",2),et([ee({type:Array})],We.prototype,"controls",2),et([ee({attribute:!1})],We.prototype,"dataResolver",2),et([ee({attribute:!1})],We.prototype,"languageResolver",2),et([rt()],We.prototype,"_pageHidden",2),et([rt()],We.prototype,"_aspectRatio",2),et([rt()],We.prototype,"_processing",2),et([rt()],We.prototype,"_waiting",2),et([rt()],We.prototype,"_errors",2),et([rt()],We.prototype,"_seeking",2),et([rt()],We.prototype,"_language",2),et([rt()],We.prototype,"_languages",2),et([rt()],We.prototype,"_captions",2),et([rt()],We.prototype,"_fullscreen",2),We=et([Rt("vmp-media-player")],We);var VB=Object.defineProperty,KB=Object.getOwnPropertyDescriptor,bt=(r,e,t,n)=>{for(var i=n>1?void 0:n?KB(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&VB(e,t,i),i};let pt=class extends Cr{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 cf(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 Cf(this),this._trackingController=new Rp(this),this._mediaPlayerRef=It()}get fetching(){return this._fetcherController.fetching}get waiting(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.waiting}get initialised(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.initialised}get seeking(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.seeking}get paused(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.paused}get captions(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.captions}get fullscreen(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.fullscreen}get duration(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.duration}set currentTime(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.currentTime=r)}get currentTime(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.currentTime)??0}set playbackRate(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.playbackRate=r)}get playbackRate(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.playbackRate)??1}set volume(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.volume=r)}get volume(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.volume)??1}set muted(r){this._mediaPlayerRef.value&&(this._mediaPlayerRef.value.muted=r)}get muted(){var r;return((r=this._mediaPlayerRef.value)==null?void 0:r.muted)??!1}get videoState(){var r;return(r=this._mediaPlayerRef.value)==null?void 0:r.videoState}get mediaPlayer(){return this._mediaPlayerRef.value}play(){var r;(r=this._mediaPlayerRef.value)==null||r.play()}pause(){var r;(r=this._mediaPlayerRef.value)==null||r.pause()}reset(r=0,e=!1){var t;(t=this._mediaPlayerRef.value)==null||t.reset(r,e)}_renderStyles(){return this.aspectRatio?typeof this.aspectRatio=="number"?Ce`
3875
3875
  <style>
3876
3876
  :host {
3877
3877
  aspect-ratio: ${this.aspectRatio};
@@ -3900,7 +3900,7 @@ vec4 transition(vec2 uv) {
3900
3900
  :host {
3901
3901
  display: flex;
3902
3902
  }
3903
- `],bt([te({type:Object})],pt.prototype,"data",2),bt([te({type:String})],pt.prototype,"vouchId",2),bt([te({type:String})],pt.prototype,"templateId",2),bt([te({type:Array})],pt.prototype,"questions",2),bt([te({type:String})],pt.prototype,"env",2),bt([te({type:String})],pt.prototype,"apiKey",2),bt([te({type:Boolean})],pt.prototype,"disableTracking",2),bt([te({type:String})],pt.prototype,"trackingSource",2),bt([te({type:Array})],pt.prototype,"controls",2),bt([te({type:String})],pt.prototype,"preload",2),bt([te({type:Boolean})],pt.prototype,"autoplay",2),bt([te({type:Number})],pt.prototype,"aspectRatio",2),bt([te({type:String})],pt.prototype,"language",2),bt([tt()],pt.prototype,"vouch",2),bt([tt()],pt.prototype,"template",2),pt=bt([Ni("vouch-embed-player")],pt);function Zs(r,e,t,n=20,i=0){let s=[];if(i>=n)return s;const o=l=>{const A=l.assignedNodes().filter(c=>c.nodeType===1);return A.length>0?Zs(A[0].parentElement,e,t,n,i+1):[]},a=Array.from(r.children||[]);for(const l of a)e(l)||(t(l)&&s.push(l),l.shadowRoot!=null?s.push(...Zs(l.shadowRoot,e,t,n,i+1)):l.tagName==="SLOT"?s.push(...o(l)):s.push(...Zs(l,e,t,n,i+1)));return s}function Qd(r){return r.hasAttribute("hidden")||r.hasAttribute("aria-hidden")&&r.getAttribute("aria-hidden")!=="false"||r.style.display==="none"||r.style.opacity==="0"||r.style.visibility==="hidden"||r.style.visibility==="collapse"}function JB(r){return r.hasAttribute("disabled")||r.hasAttribute("aria-disabled")&&r.getAttribute("aria-disabled")!=="false"}function WB(r){return r.getAttribute("tabindex")==="-1"||Qd(r)||JB(r)?!1:r.hasAttribute("tabindex")||(r instanceof HTMLAnchorElement||r instanceof HTMLAreaElement)&&r.hasAttribute("href")||r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement||r instanceof HTMLIFrameElement}const Il=new Map;function qB(r,e,t){const n=Il.get(t);n!=null&&window.clearTimeout(n),Il.set(t,window.setTimeout(()=>{r(),Il.delete(t)},e))}const bd=document.createElement("template");bd.innerHTML=`
3903
+ `],bt([ee({type:Object})],pt.prototype,"data",2),bt([ee({type:String})],pt.prototype,"vouchId",2),bt([ee({type:String})],pt.prototype,"templateId",2),bt([ee({type:Array})],pt.prototype,"questions",2),bt([ee({type:String})],pt.prototype,"env",2),bt([ee({type:String})],pt.prototype,"apiKey",2),bt([ee({type:Boolean})],pt.prototype,"disableTracking",2),bt([ee({type:String})],pt.prototype,"trackingSource",2),bt([ee({type:Array})],pt.prototype,"controls",2),bt([ee({type:String})],pt.prototype,"preload",2),bt([ee({type:Boolean})],pt.prototype,"autoplay",2),bt([ee({type:Number})],pt.prototype,"aspectRatio",2),bt([ee({type:String})],pt.prototype,"language",2),bt([rt()],pt.prototype,"vouch",2),bt([rt()],pt.prototype,"template",2),pt=bt([Ni("vouch-embed-player")],pt);function Zs(r,e,t,n=20,i=0){let s=[];if(i>=n)return s;const o=l=>{const A=l.assignedNodes().filter(c=>c.nodeType===1);return A.length>0?Zs(A[0].parentElement,e,t,n,i+1):[]},a=Array.from(r.children||[]);for(const l of a)e(l)||(t(l)&&s.push(l),l.shadowRoot!=null?s.push(...Zs(l.shadowRoot,e,t,n,i+1)):l.tagName==="SLOT"?s.push(...o(l)):s.push(...Zs(l,e,t,n,i+1)));return s}function Qd(r){return r.hasAttribute("hidden")||r.hasAttribute("aria-hidden")&&r.getAttribute("aria-hidden")!=="false"||r.style.display==="none"||r.style.opacity==="0"||r.style.visibility==="hidden"||r.style.visibility==="collapse"}function JB(r){return r.hasAttribute("disabled")||r.hasAttribute("aria-disabled")&&r.getAttribute("aria-disabled")!=="false"}function WB(r){return r.getAttribute("tabindex")==="-1"||Qd(r)||JB(r)?!1:r.hasAttribute("tabindex")||(r instanceof HTMLAnchorElement||r instanceof HTMLAreaElement)&&r.hasAttribute("href")||r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement||r instanceof HTMLIFrameElement}const Il=new Map;function qB(r,e,t){const n=Il.get(t);n!=null&&window.clearTimeout(n),Il.set(t,window.setTimeout(()=>{r(),Il.delete(t)},e))}const bd=document.createElement("template");bd.innerHTML=`
3904
3904
  <div id="start"></div>
3905
3905
  <div id="backup"></div>
3906
3906
  <slot></slot>
@@ -3992,7 +3992,7 @@ vec4 transition(vec2 uv) {
3992
3992
  right: 0;
3993
3993
  margin: 10px;
3994
3994
  }
3995
- `],vl([te({type:Boolean})],wi.prototype,"open",2),vl([te({type:Number})],wi.prototype,"aspectRatio",2),wi=vl([Ni("vouch-embed-dialog-overlay")],wi);var ZB=Object.defineProperty,e1=Object.getOwnPropertyDescriptor,Ot=(r,e,t,n)=>{for(var i=n>1?void 0:n?e1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&ZB(e,t,i),i};let Nt=class extends Cr{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=It(),this.open=!1,this._handleToggle=({detail:r})=>{var e,t,n;this.id===r&&(this.open=!this.open,this.open?!this.disableAutoplay&&((e=this._mediaPlayerRef)!=null&&e.value)&&(this._mediaPlayerRef.value.muted=!1,this._mediaPlayerRef.value.play()):(n=(t=this._mediaPlayerRef)==null?void 0:t.value)==null||n.pause())},this._handleClose=()=>{var r,e;this.open=!1,(e=(r=this._mediaPlayerRef)==null?void 0:r.value)==null||e.pause()},this._handleDocumentKeyUp=r=>{r.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 r=document.createElement("div");return document.body.appendChild(r),r}render(){return Ce`
3995
+ `],vl([ee({type:Boolean})],wi.prototype,"open",2),vl([ee({type:Number})],wi.prototype,"aspectRatio",2),wi=vl([Ni("vouch-embed-dialog-overlay")],wi);var ZB=Object.defineProperty,e1=Object.getOwnPropertyDescriptor,Ot=(r,e,t,n)=>{for(var i=n>1?void 0:n?e1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&ZB(e,t,i),i};let Nt=class extends Cr{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=It(),this.open=!1,this._handleToggle=({detail:r})=>{var e,t,n;this.id===r&&(this.open=!this.open,this.open?!this.disableAutoplay&&((e=this._mediaPlayerRef)!=null&&e.value)&&(this._mediaPlayerRef.value.muted=!1,this._mediaPlayerRef.value.play()):(n=(t=this._mediaPlayerRef)==null?void 0:t.value)==null||n.pause())},this._handleClose=()=>{var r,e;this.open=!1,(e=(r=this._mediaPlayerRef)==null?void 0:r.value)==null||e.pause()},this._handleDocumentKeyUp=r=>{r.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 r=document.createElement("div");return document.body.appendChild(r),r}render(){return Ce`
3996
3996
  <vouch-embed-dialog-overlay ?open=${this.open} aspectRatio=${this.aspectRatio}>
3997
3997
  <vouch-embed-player
3998
3998
  ${vt(this._mediaPlayerRef)}
@@ -4010,7 +4010,7 @@ vec4 transition(vec2 uv) {
4010
4010
  aspectRatio=${this.aspectRatio}
4011
4011
  ></vouch-embed-player>
4012
4012
  </vouch-embed-dialog-overlay>
4013
- `}};Ot([te({type:String})],Nt.prototype,"vouchId",2),Ot([te({type:String})],Nt.prototype,"templateId",2),Ot([te({type:Array})],Nt.prototype,"questions",2),Ot([te({type:String})],Nt.prototype,"env",2),Ot([te({type:String})],Nt.prototype,"apiKey",2),Ot([te({type:Boolean})],Nt.prototype,"disableTracking",2),Ot([te({type:String})],Nt.prototype,"trackingSource",2),Ot([te({type:Array})],Nt.prototype,"controls",2),Ot([te({type:String})],Nt.prototype,"preload",2),Ot([te({type:Boolean})],Nt.prototype,"disableAutoplay",2),Ot([te({type:Number})],Nt.prototype,"aspectRatio",2),Ot([tt()],Nt.prototype,"open",2),Nt=Ot([Ni("vouch-embed-dialog-portal")],Nt);var t1=Object.defineProperty,r1=Object.getOwnPropertyDescriptor,qt=(r,e,t,n)=>{for(var i=n>1?void 0:n?r1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&t1(e,t,i),i};return mt.DialogEmbed=class extends Cr{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=Fr(),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 Ce`
4013
+ `}};Ot([ee({type:String})],Nt.prototype,"vouchId",2),Ot([ee({type:String})],Nt.prototype,"templateId",2),Ot([ee({type:Array})],Nt.prototype,"questions",2),Ot([ee({type:String})],Nt.prototype,"env",2),Ot([ee({type:String})],Nt.prototype,"apiKey",2),Ot([ee({type:Boolean})],Nt.prototype,"disableTracking",2),Ot([ee({type:String})],Nt.prototype,"trackingSource",2),Ot([ee({type:Array})],Nt.prototype,"controls",2),Ot([ee({type:String})],Nt.prototype,"preload",2),Ot([ee({type:Boolean})],Nt.prototype,"disableAutoplay",2),Ot([ee({type:Number})],Nt.prototype,"aspectRatio",2),Ot([rt()],Nt.prototype,"open",2),Nt=Ot([Ni("vouch-embed-dialog-portal")],Nt);var t1=Object.defineProperty,r1=Object.getOwnPropertyDescriptor,qt=(r,e,t,n)=>{for(var i=n>1?void 0:n?r1(e,t):e,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&t1(e,t,i),i};return mt.DialogEmbed=class extends Cr{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=Fr(),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 Ce`
4014
4014
  <slot>
4015
4015
  <vmp-button size="large">Play</vmp-button>
4016
4016
  </slot>
@@ -4038,5 +4038,5 @@ vec4 transition(vec2 uv) {
4038
4038
  width: fit-content;
4039
4039
  height: fit-content;
4040
4040
  }
4041
- `],qt([te({type:String})],mt.DialogEmbed.prototype,"vouchId",2),qt([te({type:String})],mt.DialogEmbed.prototype,"templateId",2),qt([te({type:Array})],mt.DialogEmbed.prototype,"questions",2),qt([te({type:String})],mt.DialogEmbed.prototype,"env",2),qt([te({type:String})],mt.DialogEmbed.prototype,"apiKey",2),qt([te({type:Boolean})],mt.DialogEmbed.prototype,"disableTracking",2),qt([te({type:String})],mt.DialogEmbed.prototype,"trackingSource",2),qt([te({type:Array})],mt.DialogEmbed.prototype,"controls",2),qt([te({type:String})],mt.DialogEmbed.prototype,"preload",2),qt([te({type:Boolean})],mt.DialogEmbed.prototype,"disableAutoplay",2),qt([te({type:Number})],mt.DialogEmbed.prototype,"aspectRatio",2),mt.DialogEmbed=qt([Ni("vouch-embed-dialog")],mt.DialogEmbed),Object.defineProperty(mt,Symbol.toStringTag,{value:"Module"}),mt}({});
4041
+ `],qt([ee({type:String})],mt.DialogEmbed.prototype,"vouchId",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"templateId",2),qt([ee({type:Array})],mt.DialogEmbed.prototype,"questions",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"env",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"apiKey",2),qt([ee({type:Boolean})],mt.DialogEmbed.prototype,"disableTracking",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"trackingSource",2),qt([ee({type:Array})],mt.DialogEmbed.prototype,"controls",2),qt([ee({type:String})],mt.DialogEmbed.prototype,"preload",2),qt([ee({type:Boolean})],mt.DialogEmbed.prototype,"disableAutoplay",2),qt([ee({type:Number})],mt.DialogEmbed.prototype,"aspectRatio",2),mt.DialogEmbed=qt([Ni("vouch-embed-dialog")],mt.DialogEmbed),Object.defineProperty(mt,Symbol.toStringTag,{value:"Module"}),mt}({});
4042
4042
  //# sourceMappingURL=embed.iife.js.map